From 3ebf11a2963604410965b04c5d8d4d29253b8375 Mon Sep 17 00:00:00 2001 From: Yannick Warnier Date: Fri, 12 Mar 2010 15:50:37 -0500 Subject: [PATCH] Minor syntax cleaning --- main/document/document.php | 394 ++++++++++++------------------------- 1 file changed, 121 insertions(+), 273 deletions(-) diff --git a/main/document/document.php b/main/document/document.php index 6dc9cd5009..4d0f0699ae 100755 --- a/main/document/document.php +++ b/main/document/document.php @@ -1,38 +1,14 @@ -'; //jQuery @@ -86,7 +59,7 @@ $(document).ready( function() { } ); '; //session -if(isset($_GET['id_session'])) { +if (isset($_GET['id_session'])) { $_SESSION['id_session'] = Security::remove_XSS($_GET['id_session']); } @@ -97,8 +70,7 @@ $tool_sql = 'SELECT visibility FROM ' . $table_course_tool . ' WHERE name = "'. $tool_result = Database::query($tool_sql); $tool_row = Database::fetch_array($tool_result); $tool_visibility = $tool_row['visibility']; -if ($tool_visibility == '0' && $to_group_id == '0' && !($is_allowed_to_edit || $group_member_with_upload_rights)) -{ +if ($tool_visibility == '0' && $to_group_id == '0' && !($is_allowed_to_edit || $group_member_with_upload_rights)) { api_not_allowed(true); } @@ -122,7 +94,7 @@ function confirmation (name) //what's the current path? //we will verify this a bit further down -if(isset($_GET['curdirpath']) && $_GET['curdirpath']!='') { +if (isset($_GET['curdirpath']) && $_GET['curdirpath']!='') { $curdirpath = Security::remove_XSS($_GET['curdirpath']); } elseif (isset($_POST['curdirpath']) && $_POST['curdirpath']!='') { $curdirpath = Security::remove_XSS($_POST['curdirpath']); @@ -131,64 +103,52 @@ if(isset($_GET['curdirpath']) && $_GET['curdirpath']!='') { } $curdirpathurl = urlencode($curdirpath); -$course_dir = $_course['path']."/document"; -$sys_course_path = api_get_path(SYS_COURSE_PATH); -$base_work_dir = $sys_course_path.$course_dir; -$http_www = api_get_path('WEB_COURSE_PATH').$_course['path'].'/document'; -$dbl_click_id = 0; // used to avoid double-click +$course_dir = $_course['path']."/document"; +$sys_course_path= api_get_path(SYS_COURSE_PATH); +$base_work_dir = $sys_course_path.$course_dir; +$http_www = api_get_path(WEB_COURSE_PATH).$_course['path'].'/document'; +$dbl_click_id = 0; // used to avoid double-click $is_allowed_to_edit = api_is_allowed_to_edit(null,true); $group_member_with_upload_rights = false; //if the group id is set, we show them group documents -if(isset($_SESSION['_gid']) && $_SESSION['_gid']!='') -{ +if (isset($_SESSION['_gid']) && $_SESSION['_gid']!='') { //needed for group related stuff - require_once(api_get_path(LIBRARY_PATH) . 'groupmanager.lib.php'); + require_once($lib_path. 'groupmanager.lib.php'); //get group info $group_properties = GroupManager::get_group_properties($_SESSION['_gid']); $noPHP_SELF=true; //let's assume the user cannot upload files for the group $group_member_with_upload_rights = false; - if($group_properties['doc_state']==2) //documents are private - { - if($is_allowed_to_edit || GroupManager :: is_user_in_group($_user['user_id'],$_SESSION['_gid'])) //only courseadmin or group members (members + tutors) allowed - { + if($group_properties['doc_state']==2) { //documents are private + if($is_allowed_to_edit || GroupManager :: is_user_in_group($_user['user_id'],$_SESSION['_gid'])) { //only courseadmin or group members (members + tutors) allowed $to_group_id = $_SESSION['_gid']; $req_gid = '&gidReq='.$_SESSION['_gid']; $interbreadcrumb[]= array ("url"=>"../group/group.php", "name"=> get_lang('Groups')); $interbreadcrumb[]= array ("url"=>"../group/group_space.php?gidReq=".$_SESSION['_gid'], "name"=> get_lang('GroupSpace').' ('.$group_properties['name'].')'); //they are allowed to upload $group_member_with_upload_rights = true; - } - else - { + } else { $to_group_id = 0; $req_gid = ''; } - } - elseif($group_properties['doc_state']==1) //documents are public - { + } elseif($group_properties['doc_state']==1) { //documents are public $to_group_id = $_SESSION['_gid']; $req_gid = '&gidReq='.$_SESSION['_gid']; $interbreadcrumb[]= array ("url"=>"../group/group.php", "name"=> get_lang('Groups')); $interbreadcrumb[]= array ("url"=>"../group/group_space.php?gidReq=".$_SESSION['_gid'], "name"=> get_lang('GroupSpace').' ('.$group_properties['name'].')'); //allowed to upload? - if($is_allowed_to_edit || GroupManager::is_subscribed($_user['user_id'],$_SESSION['_gid'])) //only courseadmin or group members can upload - { + if($is_allowed_to_edit || GroupManager::is_subscribed($_user['user_id'],$_SESSION['_gid'])) { //only courseadmin or group members can upload $group_member_with_upload_rights = true; } - } - else //documents not active for this group - { + } else { //documents not active for this group $to_group_id = 0; $req_gid = ''; } $_SESSION['group_member_with_upload_rights'] = $group_member_with_upload_rights; -} -else -{ +} else { $to_group_id = 0; $req_gid = ''; } @@ -197,39 +157,31 @@ if (api_get_session_id()!=0) { $group_member_with_upload_rights = $group_member_with_upload_rights && api_is_allowed_to_session_edit(false,true); } -/* ------------------------------------------------------------ - Libraries ------------------------------------------------------------ -*/ -//the main_api.lib.php, database.lib.php and display.lib.php -//libraries are included by default - -require_once api_get_path(LIBRARY_PATH) . 'fileDisplay.lib.php'; -require_once api_get_path(LIBRARY_PATH) . 'document.lib.php'; -require_once api_get_path(LIBRARY_PATH) . 'tablesort.lib.php'; -require_once api_get_path(LIBRARY_PATH) . 'fileUpload.lib.php'; +/* Libraries */ +//The main_api.lib.php, database.lib.php and display.lib.php +//Libraries are included by default +require_once $lib_path.'fileDisplay.lib.php'; +require_once $lib_path.'document.lib.php'; +require_once $lib_path.'tablesort.lib.php'; +require_once $lib_path.'fileUpload.lib.php'; -//----------------------------------------------------------- //check the path //if the path is not found (no document id), set the path to / -if(!DocumentManager::get_document_id($_course,$curdirpath)) -{ +if(!DocumentManager::get_document_id($_course,$curdirpath)) { $curdirpath = '/'; //urlencoded version $curdirpathurl = '%2F'; } //if they are looking at group documents they can't see the root -if($to_group_id!=0 && $curdirpath=='/') -{ +if($to_group_id!=0 && $curdirpath=='/') { $curdirpath = $group_properties['directory']; $curdirpathurl = urlencode($group_properties['directory']); } //----------------------------------------------------------- // check visibility of the current dir path. Don't show anything if not allowed -if (!(DocumentManager::is_visible($curdirpath, $_course)||$is_allowed_to_edit)){ +if (!(DocumentManager::is_visible($curdirpath, $_course)||$is_allowed_to_edit)) { api_not_allowed(); } /* @@ -247,8 +199,7 @@ $current_session_id = api_get_session_id(); ----------------------------------------------------------- */ -if (!file_exists($base_work_dir.'/shared_folder/sf_user_'.api_get_user_id())) -{ +if (!file_exists($base_work_dir.'/shared_folder/sf_user_'.api_get_user_id())) { $usf_dir_title=api_get_person_name($_user['firstName'], $_user['lastName']); $usf_dir_name='/shared_folder/sf_user_'.api_get_user_id(); $to_group_id=0; @@ -262,12 +213,10 @@ if (!file_exists($base_work_dir.'/shared_folder/sf_user_'.api_get_user_id())) */ //-------------------------------------------------------------------// -if (isset($_GET['action']) && $_GET['action']=="download") -{ +if (isset($_GET['action']) && $_GET['action']=='download') { $my_get_id=Security::remove_XSS($_GET['id']); //check if the document is in the database - if(!DocumentManager::get_document_id($_course,$my_get_id)) - { + if (!DocumentManager::get_document_id($_course,$my_get_id)) { //file not found! header('HTTP/1.0 404 Not Found'); $error404 = ''; @@ -286,7 +235,7 @@ if (isset($_GET['action']) && $_GET['action']=="download") // check visibility of document and paths if (!($is_allowed_to_edit || $group_member_with_upload_rights) && - !DocumentManager::is_visible($my_get_id, $_course)){ + !DocumentManager::is_visible($my_get_id, $_course)) { api_not_allowed(); } @@ -294,12 +243,11 @@ if (isset($_GET['action']) && $_GET['action']=="download") $full_file_name = $base_work_dir.$doc_url; DocumentManager::file_send_for_download($full_file_name,true); exit; - } +} //-------------------------------------------------------------------// //download of an completed folder -if(isset($_GET['action']) && $_GET['action']=="downloadfolder" && (api_get_setting('students_download_folders') == 'true' || api_is_allowed_to_edit() || api_is_platform_admin())) -{ +if (isset($_GET['action']) && $_GET['action']=="downloadfolder" && (api_get_setting('students_download_folders') == 'true' || api_is_allowed_to_edit() || api_is_platform_admin())) { require('downloadfolder.inc.php'); } //-------------------------------------------------------------------// @@ -321,8 +269,7 @@ $interbreadcrumb[]= array ('url'=>'', 'name'=> get_lang('ToolDocument')); $dir_array=explode("/",$curdirpath); $array_len=count($dir_array); -if ($array_len >1) -{ +if ($array_len >1) { if(empty($_SESSION['_gid'])) { $url_dir='document.php?&curdirpath=/'; @@ -331,14 +278,10 @@ if ($array_len >1) } $dir_acum=''; -for ($i=0; $i<$array_len;$i++) -{ - if($dir_array[$i] =='shared_folder') - { +for ($i=0; $i<$array_len;$i++) { + if($dir_array[$i] =='shared_folder') { $dir_array[$i]=get_lang('SharedFolder'); - } - elseif(strstr($dir_array[$i], 'sf_user_')) - { + } elseif(strstr($dir_array[$i], 'sf_user_')) { $userinfo=Database::get_user_info_from_id(substr($dir_array[$i], 8)); $dir_array[$i]=api_get_person_name($userinfo['firstname'], $userinfo['lastname']); } @@ -351,8 +294,7 @@ for ($i=0; $i<$array_len;$i++) Display::display_header('','Doc'); /* - * Lib for event log, stats & tracking - * plus record of the access + * Lib for event log, stats & tracking & record of the access */ event_access_tool(TOOL_DOCUMENT); @@ -361,61 +303,40 @@ event_access_tool(TOOL_DOCUMENT); DISPLAY ============================================================================== */ -if($to_group_id !=0) //add group name after for group documents -{ +if ($to_group_id !=0) { //add group name after for group documents $add_group_to_title = ' ('.$group_properties['name'].')'; } -//api_display_tool_title($tool_name.$add_group_to_title); - -/* ------------------------------------------------------------ - Introduction section - (editable by course admins) ------------------------------------------------------------ -*/ -if(!empty($_SESSION['_gid'])) -{ +/* Introduction section (editable by course admins) */ +if (!empty($_SESSION['_gid'])) { Display::display_introduction_section(TOOL_DOCUMENT.$_SESSION['_gid']); -} -else -{ +} else { Display::display_introduction_section(TOOL_DOCUMENT); } /*============================================================================*/ -if($is_allowed_to_edit || $group_member_with_upload_rights) // TEACHER ONLY -{ +if ($is_allowed_to_edit || $group_member_with_upload_rights) { // TEACHER ONLY /*====================================== MOVE FILE OR DIRECTORY ======================================*/ $my_get_move=Security::remove_XSS($_GET['move']); - if (isset($_GET['move']) && $_GET['move']!='') - { - if (!$is_allowed_to_edit) - { - if(DocumentManager::check_readonly($_course,$_user['user_id'],$my_get_move)) - { + if (isset($_GET['move']) && $_GET['move']!='') { + if (!$is_allowed_to_edit) { + if (DocumentManager::check_readonly($_course,$_user['user_id'],$my_get_move)) { api_not_allowed(); } } - if(DocumentManager::get_document_id($_course,$my_get_move)) - { + if (DocumentManager::get_document_id($_course,$my_get_move)) { $folders = DocumentManager::get_all_document_folders($_course,$to_group_id,$is_allowed_to_edit || $group_member_with_upload_rights); echo '
'.get_lang('Move').'
'; echo build_move_to_selector($folders,Security::remove_XSS($_GET['curdirpath']),$my_get_move,$group_properties['directory']); } - - } - if (isset($_POST['move_to']) && isset($_POST['move_file'])) - { - if (!$is_allowed_to_edit) - { - if(DocumentManager::check_readonly($_course,$_user['user_id'],$my_get_move)) - { + if (isset($_POST['move_to']) && isset($_POST['move_file'])) { + if (!$is_allowed_to_edit) { + if (DocumentManager::check_readonly($_course,$_user['user_id'],$my_get_move)) { api_not_allowed(); } } @@ -426,86 +347,63 @@ if($is_allowed_to_edit || $group_member_with_upload_rights) // TEACHER ONLY $dbTable = Database::get_course_table(TABLE_DOCUMENT); //security fix: make sure they can't move files that are not in the document table - if(DocumentManager::get_document_id($_course,$_POST['move_file'])) - { - if ( move($base_work_dir.$_POST['move_file'],$base_work_dir.$_POST['move_to']) ) - { + if (DocumentManager::get_document_id($_course,$_POST['move_file'])) { + if ( move($base_work_dir.$_POST['move_file'],$base_work_dir.$_POST['move_to']) ) { update_db_info("update", $_POST['move_file'], $_POST['move_to']."/".basename($_POST['move_file'])); //set the current path $curdirpath = $_POST['move_to']; $curdirpathurl = urlencode($_POST['move_to']); Display::display_confirmation_message(get_lang('DirMv')); - } - else - { + } else { Display::display_error_message(get_lang('Impossible')); } - } - else - { + } else { Display::display_error_message(get_lang('Impossible')); } - - } /*====================================== DELETE FILE OR DIRECTORY ======================================*/ - if ( isset($_GET['delete']) ) - { - if (!$is_allowed_to_edit) - { - if(DocumentManager::check_readonly($_course,$_user['user_id'],$_GET['delete'],'',true)) - { + if ( isset($_GET['delete']) ) { + if (!$is_allowed_to_edit) { + if (DocumentManager::check_readonly($_course,$_user['user_id'],$_GET['delete'],'',true)) { api_not_allowed(); } } require_once(api_get_path(LIBRARY_PATH) . 'fileManage.lib.php'); - if(DocumentManager::delete_document($_course,$_GET['delete'],$base_work_dir)) - { + if (DocumentManager::delete_document($_course,$_GET['delete'],$base_work_dir)) { Display::display_confirmation_message(get_lang('DocDeleted')); - } - else - { - + } else { Display::display_error_message(get_lang('DocDeleteError')); } - - } - if( isset($_POST['action'])) - { - switch($_POST['action']) - { + if (isset($_POST['action'])) { + switch($_POST['action']) { case 'delete': - foreach($_POST['path'] as $index => $path) - { - if (!$is_allowed_to_edit) - { - if(DocumentManager::check_readonly($_course,$_user['user_id'],$path)) - { + foreach ($_POST['path'] as $index => $path) { + if (!$is_allowed_to_edit) { + if (DocumentManager::check_readonly($_course,$_user['user_id'],$path)) { Display::display_error_message(get_lang('CantDeleteReadonlyFiles')); break 2; } } } - foreach($_POST['path'] as $index => $path) - { + foreach ($_POST['path'] as $index => $path) { if (strcmp($path,'/audio')===0 or strcmp($path,'/flash')===0 or strcmp($path,'/images')===0 or strcmp($path,'/shared_folder')===0 or strcmp($path,'/video')===0) { continue; } else { - $delete_document = DocumentManager::delete_document($_course,$path,$base_work_dir); + $delete_document = DocumentManager::delete_document($_course,$path,$base_work_dir); } } if (!empty($delete_document)) { - Display::display_confirmation_message(get_lang('DocDeleted')); + Display::display_confirmation_message(get_lang('DocDeleted')); } break; } @@ -516,49 +414,38 @@ if($is_allowed_to_edit || $group_member_with_upload_rights) // TEACHER ONLY ======================================*/ //create directory with $_POST data - if(isset($_POST['create_dir']) && $_POST['dirname']!='') - { + if (isset($_POST['create_dir']) && $_POST['dirname']!='') { //needed for directory creation require_once(api_get_path(LIBRARY_PATH) . 'fileUpload.lib.php'); $post_dir_name=Security::remove_XSS($_POST['dirname']); - if ($post_dir_name=='../' || $post_dir_name=='.' || $post_dir_name=='..') - { + if ($post_dir_name=='../' || $post_dir_name=='.' || $post_dir_name=='..') { Display::display_error_message(get_lang('CannotCreateDir')); - } - else - { + } else { $added_slash = ($curdirpath=='/')?'':'/'; $dir_name = $curdirpath.$added_slash.replace_dangerous_char($post_dir_name); $dir_name = disable_dangerous_file($dir_name); $dir_check=$base_work_dir.''.$dir_name; - if(!is_dir($dir_check)) - { + if (!is_dir($dir_check)) { $created_dir = create_unexisting_directory($_course,$_user['user_id'],$to_group_id,$to_user_id,$base_work_dir,$dir_name,$post_dir_name); - if($created_dir) - { + if ($created_dir) { Display::display_confirmation_message(''.get_lang('DirCr').'',false); //uncomment if you want to enter the created dir //$curdirpath = $created_dir; //$curdirpathurl = urlencode($curdirpath); - } - else - { + } else { Display::display_error_message(get_lang('CannotCreateDir')); } - } - else - { + } else { Display::display_error_message(get_lang('CannotCreateDir')); } } } //show them the form for the directory name - if(isset($_GET['createdir'])) - { + if (isset($_GET['createdir'])) { //show the form echo create_dir_form(); } @@ -568,41 +455,30 @@ if($is_allowed_to_edit || $group_member_with_upload_rights) // TEACHER ONLY VISIBILITY COMMANDS ======================================*/ - if ((isset($_GET['set_invisible']) && !empty($_GET['set_invisible'])) || (isset($_GET['set_visible']) && !empty($_GET['set_visible'])) AND $_GET['set_visible']<>'*' AND $_GET['set_invisible']<>'*') - { + if ((isset($_GET['set_invisible']) && !empty($_GET['set_invisible'])) || (isset($_GET['set_visible']) && !empty($_GET['set_visible'])) AND $_GET['set_visible']<>'*' AND $_GET['set_invisible']<>'*') { //make visible or invisible? - if(isset($_GET['set_visible'])) - { + if (isset($_GET['set_visible'])) { $update_id = $_GET['set_visible']; $visibility_command = 'visible'; - } - else - { + } else { $update_id = $_GET['set_invisible']; $visibility_command = 'invisible'; } - if (!$is_allowed_to_edit) - { - if(DocumentManager::check_readonly($_course,$_user['user_id'],'',$update_id)) - { + if (!$is_allowed_to_edit) { + if(DocumentManager::check_readonly($_course,$_user['user_id'],'',$update_id)) { api_not_allowed(); } } //update item_property to change visibility - if(api_item_property_update($_course, TOOL_DOCUMENT, $update_id, $visibility_command, $_user['user_id'],null,null,null,null,$current_session_id)) - { + if(api_item_property_update($_course, TOOL_DOCUMENT, $update_id, $visibility_command, $_user['user_id'],null,null,null,null,$current_session_id)) { Display::display_confirmation_message(get_lang("ViMod")); - } - else - { + } else { Display::display_error_message(get_lang("ViModProb")); } - } - /*====================================== TEMPLATE ACTION ======================================*/ @@ -627,7 +503,7 @@ if($is_allowed_to_edit || $group_member_with_upload_rights) // TEACHER ONLY //show the form Display::display_normal_message($template_text,false); - } elseif(isset($_GET['add_as_template']) && isset($_POST['create_template'])) { + } elseif (isset($_GET['add_as_template']) && isset($_POST['create_template'])) { $document_id_for_template = intval(Database::escape_string($_GET['add_as_template'])); @@ -687,7 +563,7 @@ if($is_allowed_to_edit || $group_member_with_upload_rights) // TEACHER ONLY Display::display_confirmation_message(get_lang('DocumentSetAsTemplate')); } - if(isset($_GET['remove_as_template'])) { + if (isset($_GET['remove_as_template'])) { $document_id_for_template = intval($_GET['remove_as_template']); $course_code = api_get_course_id(); $user_id = api_get_user_id(); @@ -708,8 +584,7 @@ $docs_and_folders = DocumentManager::get_all_document_data($_course,$curdirpath, @@ -730,8 +604,7 @@ if($folders===false) '); //print_r($docs_and_folders); //echo(''); @@ -743,8 +616,7 @@ if(isset($docs_and_folders) && is_array($docs_and_folders)) $sortable_data = array(); - while (list ($key, $id) = each($docs_and_folders)) - { + while (list ($key, $id) = each($docs_and_folders)) { $row = array (); //if the item is invisible, wrap it in a span with class invisible @@ -759,26 +631,22 @@ if(isset($docs_and_folders) && is_array($docs_and_folders)) $document_name=basename($id['path']); //Juan Carlos RaƱa: Get firstname and lastname when folder is in shared_folder. //TODO: check if is also necessary (above else) - if(strstr($document_name, 'sf_user_')) - { + if (strstr($document_name, 'sf_user_')) { $userinfo=Database::get_user_info_from_id(substr($document_name, 8)); $document_name=api_get_person_name($userinfo['firstname'], $userinfo['lastname']); - } - elseif(strstr($document_name, 'shared_folder')) - { + } elseif(strstr($document_name, 'shared_folder')) { $document_name=get_lang('SharedFolder'); } } //data for checkbox if (($is_allowed_to_edit || $group_member_with_upload_rights) AND count($docs_and_folders)>1) { $row[] = $id['path']; - } // Show the Owner of the file only in groups $user_link=''; - if(isset($_SESSION['_gid']) && $_SESSION['_gid']!='') { + if (isset($_SESSION['_gid']) && $_SESSION['_gid']!='') { if (!empty($id['insert_user_id'])) { $user_info=UserManager::get_user_info_by_id($id['insert_user_id']); $user_name=api_get_person_name($user_info['firstname'], $user_info['lastname']); @@ -808,16 +676,12 @@ if(isset($docs_and_folders) && is_array($docs_and_folders)) $row[] = $invisibility_span_open.$display_date.$invisibility_span_close.''; //admins get an edit column - if ($is_allowed_to_edit || $group_member_with_upload_rights) - { + if ($is_allowed_to_edit || $group_member_with_upload_rights) { $is_template = (isset($id['is_template'])?$id['is_template']:false); // if readonly, check if it the owner of the file or if the user is an admin - if ($id['insert_user_id'] == $_user['user_id'] || api_is_platform_admin()) - { + if ($id['insert_user_id'] == $_user['user_id'] || api_is_platform_admin()) { $edit_icons = build_edit_icons($curdirpath,$id['filetype'],$id['path'],$id['visibility'],$key, $is_template,0); - } - else - { + } else { $edit_icons = build_edit_icons($curdirpath,$id['filetype'],$id['path'],$id['visibility'],$key, $is_template,$id['readonly']); } $row[] = $edit_icons; @@ -828,23 +692,19 @@ if(isset($docs_and_folders) && is_array($docs_and_folders)) $sortable_data[] = $row; } - //******************************************************************************************* -} -else -{ +} else { $sortable_data=''; $table_footer='
'.get_lang('NoDocsInFolder').'
'; } $column_show=array(); - if ($is_allowed_to_edit || $group_member_with_upload_rights || is_my_shared_folder($_user['user_id'],$curdirpath))// TODO:check enable more options for shared folders - { +if ($is_allowed_to_edit || $group_member_with_upload_rights || is_my_shared_folder($_user['user_id'],$curdirpath)) { + // @TODO:check enable more options for shared folders /* CREATE NEW DOCUMENT OR NEW DIRECTORY / GO TO UPLOAD / DOWNLOAD ZIPPED FOLDER */ ?> - +
   @@ -853,8 +713,7 @@ $column_show=array();   - +   @@ -872,8 +731,7 @@ $column_show=array(); } // Slideshow by Patrick Cool, May 2004 require("document_slideshow.inc.php"); - if ($image_present) - { + if ($image_present) { echo " ". get_lang('ViewSlideshow') . ""; } echo ""; @@ -881,8 +739,7 @@ $column_show=array(); //============================================================================== -if (($is_allowed_to_edit || $group_member_with_upload_rights) AND count($docs_and_folders)>1) -{ +if (($is_allowed_to_edit || $group_member_with_upload_rights) AND count($docs_and_folders)>1) { $column_show[]=1; } @@ -891,16 +748,14 @@ $column_show[]=1; $column_show[]=1; $column_show[]=1; -if ($is_allowed_to_edit || $group_member_with_upload_rights) -{ +if ($is_allowed_to_edit || $group_member_with_upload_rights) { $column_show[]=1; } $column_show[]=0; $column_order=array(); -if ( count($row) == 8 ) -{ +if ( count($row) == 8 ) { $column_order[]=1; $column_order[]=2; $column_order[]=7; @@ -919,16 +774,14 @@ $table = new SortableTableFromArrayConfig($sortable_data,$default_column,20,$tab $query_vars['curdirpath'] = $curdirpath; -if(isset($_SESSION['_gid'])) -{ +if (isset($_SESSION['_gid'])) { $query_vars['gidReq'] = $_SESSION['_gid']; } $query_vars['cidReq'] = api_get_course_id(); $table->set_additional_parameters($query_vars); $column = 0; -if (($is_allowed_to_edit || $group_member_with_upload_rights) AND count($docs_and_folders)>1) -{ +if (($is_allowed_to_edit || $group_member_with_upload_rights) AND count($docs_and_folders)>1) { $table->set_header($column++,'',false); } $table->set_header($column++,get_lang('Type')); @@ -938,17 +791,14 @@ $table->set_header($column++,get_lang('Name')); $table->set_header($column++,get_lang('Size')); $table->set_header($column++,get_lang('Date')); //admins get an edit column -if ($is_allowed_to_edit || $group_member_with_upload_rights) -{ +if ($is_allowed_to_edit || $group_member_with_upload_rights) { $table->set_header($column++,get_lang('Modify'),false); } //actions on multiple selected documents //currently only delete action -> take only DELETE right into account -if (count($docs_and_folders)>1) -{ - if ($is_allowed_to_edit || $group_member_with_upload_rights) - { +if (count($docs_and_folders)>1) { + if ($is_allowed_to_edit || $group_member_with_upload_rights) { $form_actions = array(); $form_action['delete'] = get_lang('Delete'); $table->set_form_actions($form_action,'path'); @@ -956,11 +806,9 @@ if (count($docs_and_folders)>1) } $table->display(); -if(!empty($table_footer)) -{ +if (!empty($table_footer)) { echo $table_footer; } // footer -Display::display_footer(); -?> +Display::display_footer(); \ No newline at end of file