From a06222518118030e83e9476b035cecd026ec6809 Mon Sep 17 00:00:00 2001 From: Julio Montoya Date: Wed, 15 Jun 2011 14:24:29 +0200 Subject: [PATCH] Replacing deprecated function is_allowed_to_edit() with api_is_allowed_to_edit() --- main/admin/calendar.lib.php | 6 +++--- main/admin/calendar.php | 4 ++-- main/document/edit_document.php | 2 +- main/document/edit_draw.php | 2 +- main/document/edit_paint.php | 2 +- main/forum/forumfunction.inc.php | 4 ++-- main/metadata/importdocs.php | 2 +- main/metadata/importlinks.php | 2 +- main/metadata/importmanifest.php | 2 +- main/metadata/index.php | 2 +- main/metadata/playscormmdset.inc.php | 2 +- main/metadata/statistics.php | 2 +- main/metadata/update_indexabletext.php | 2 +- main/work/downloadfolder.inc.php | 2 +- 14 files changed, 18 insertions(+), 18 deletions(-) mode change 100644 => 100755 main/metadata/statistics.php mode change 100644 => 100755 main/metadata/update_indexabletext.php mode change 100644 => 100755 main/work/downloadfolder.inc.php diff --git a/main/admin/calendar.lib.php b/main/admin/calendar.lib.php index 6b1069f72a..666748bd48 100755 --- a/main/admin/calendar.lib.php +++ b/main/admin/calendar.lib.php @@ -608,7 +608,7 @@ function showhide_agenda_item($id) { ==================================================*/ // and $_GET['isStudentView']<>"false" is added to prevent that the visibility is changed after you do the following: // change visibility -> studentview -> course manager view - if ((is_allowed_to_edit() && !api_is_anonymous()) and $_GET['isStudentView']<>"false") + if ((api_is_allowed_to_edit() && !api_is_anonymous()) and $_GET['isStudentView']<>"false") { if (isset($_GET['id'])&&$_GET['id']&&isset($_GET['action'])&&$_GET['action']=="showhide") { @@ -672,7 +672,7 @@ function display_agenda_items() { $repeats = array(); //placeholder for repeated events - if (is_allowed_to_edit() && !api_is_anonymous()) { + if (api_is_allowed_to_edit() && !api_is_anonymous()) { $sql="SELECT * FROM ".$TABLEAGENDA; global $_configuration; @@ -2853,7 +2853,7 @@ function agenda_add_item($title, $content, $db_start_date, $db_end_date) { } $repeats = array(); $data=array(); - if (is_allowed_to_edit()) { + if (api_is_allowed_to_edit()) { $sql="SELECT DISTINCT * FROM ".$TABLEAGENDA." agenda WHERE MONTH(start_date)='".$month."' AND YEAR(start_date)='".$year."'"; diff --git a/main/admin/calendar.php b/main/admin/calendar.php index f60084b7f6..e47e168bb5 100755 --- a/main/admin/calendar.php +++ b/main/admin/calendar.php @@ -140,7 +140,7 @@ $tbl_groupUser = Database::get_course_table(TABLE_GROUP_USER); ACCESS RIGHTS */ // permission stuff - also used by loading from global in agenda.inc.php -$is_allowed_to_edit = is_allowed_to_edit() OR (api_get_course_setting('allow_user_edit_agenda') && !api_is_anonymous()); +$is_allowed_to_edit = api_is_allowed_to_edit() OR (api_get_course_setting('allow_user_edit_agenda') && !api_is_anonymous()); // insert an anchor (top) so one can jump back to the top of the page echo ""; @@ -230,7 +230,7 @@ if (api_is_allowed_to_edit(false,true)) { $id=(int)$_GET['id']; if( ! (api_is_course_coach() && !api_is_element_in_the_session(TOOL_AGENDA, $id ) ) ) { // a coach can only delete an element belonging to his session - if (is_allowed_to_edit() && !api_is_anonymous()) { + if (api_is_allowed_to_edit() && !api_is_anonymous()) { if (!empty($id)) { $res_del = delete_agenda_item($id); if ($res_del) { diff --git a/main/document/edit_document.php b/main/document/edit_document.php index 2326512d31..40d97ef312 100755 --- a/main/document/edit_document.php +++ b/main/document/edit_document.php @@ -144,7 +144,7 @@ $html_editor_config = array( 'BaseHref' => api_get_path(WEB_COURSE_PATH).$_course['path'].'/document'.$dir ); -$is_allowed_to_edit = is_allowed_to_edit(null, true) || $_SESSION['group_member_with_upload_rights']|| is_my_shared_folder(api_get_user_id(), $dir, $current_session_id); +$is_allowed_to_edit = api_is_allowed_to_edit(null, true) || $_SESSION['group_member_with_upload_rights']|| is_my_shared_folder(api_get_user_id(), $dir, $current_session_id); $use_document_title = api_get_setting('use_document_title') == 'true'; $noPHP_SELF = true; diff --git a/main/document/edit_draw.php b/main/document/edit_draw.php index b1f868a31c..5e7f86bbcb 100644 --- a/main/document/edit_draw.php +++ b/main/document/edit_draw.php @@ -94,7 +94,7 @@ if (!$is_certificate_mode) else $interbreadcrumb[]= array ( 'url' => '../gradebook/'.$_SESSION['gradebook_dest'], 'name' => get_lang('Gradebook')); -$is_allowedToEdit = is_allowed_to_edit() || $_SESSION['group_member_with_upload_rights'] || is_my_shared_folder(api_get_user_id(), $dir, $current_session_id); +$is_allowedToEdit = api_is_allowed_to_edit(null, true) || $_SESSION['group_member_with_upload_rights'] || is_my_shared_folder(api_get_user_id(), $dir, $current_session_id); if (!$is_allowedToEdit) { api_not_allowed(true); diff --git a/main/document/edit_paint.php b/main/document/edit_paint.php index 5743d15b5f..dd0f155cfc 100644 --- a/main/document/edit_paint.php +++ b/main/document/edit_paint.php @@ -101,7 +101,7 @@ if (!$is_certificate_mode) else $interbreadcrumb[]= array ( 'url' => '../gradebook/'.$_SESSION['gradebook_dest'], 'name' => get_lang('Gradebook')); -$is_allowedToEdit = is_allowed_to_edit() || $_SESSION['group_member_with_upload_rights'] || is_my_shared_folder(api_get_user_id(), $dir, $current_session_id); +$is_allowedToEdit = api_is_allowed_to_edit(null, true) || $_SESSION['group_member_with_upload_rights'] || is_my_shared_folder(api_get_user_id(), $dir, $current_session_id); if (!$is_allowedToEdit) { api_not_allowed(true); diff --git a/main/forum/forumfunction.inc.php b/main/forum/forumfunction.inc.php index a3c98f3eef..2596836a7b 100755 --- a/main/forum/forumfunction.inc.php +++ b/main/forum/forumfunction.inc.php @@ -1304,7 +1304,7 @@ function get_forums($id='', $course_db_name = '') { if ($id == '') { if (is_array($forum_list)) { foreach ($forum_list as $key => $value) { - $last_post_info_of_forum = get_last_post_information($key, is_allowed_to_edit(), $course_db_name); + $last_post_info_of_forum = get_last_post_information($key, api_is_allowed_to_edit(), $course_db_name); $forum_list[$key]['last_post_id'] = $last_post_info_of_forum['last_post_id']; $forum_list[$key]['last_poster_id'] = $last_post_info_of_forum['last_poster_id']; $forum_list[$key]['last_post_date'] = $last_post_info_of_forum['last_post_date']; @@ -1316,7 +1316,7 @@ function get_forums($id='', $course_db_name = '') { $forum_list = array(); } } else { - $last_post_info_of_forum = get_last_post_information($id, is_allowed_to_edit(), $course_db_name); + $last_post_info_of_forum = get_last_post_information($id, api_is_allowed_to_edit(), $course_db_name); $forum_list['last_post_id'] = $last_post_info_of_forum['last_post_id']; $forum_list['last_poster_id'] = $last_post_info_of_forum['last_poster_id']; $forum_list['last_post_date'] = $last_post_info_of_forum['last_post_date']; diff --git a/main/metadata/importdocs.php b/main/metadata/importdocs.php index 95a93cd620..51f48fc247 100755 --- a/main/metadata/importdocs.php +++ b/main/metadata/importdocs.php @@ -33,7 +33,7 @@ $nameTools = get_lang('Tool'); $_course = api_get_course_info(); isset($_course) or give_up(get_lang('Sorry')); -$is_allowed_to_edit = isset($_user['user_id']) && $is_courseMember && is_allowed_to_edit(); +$is_allowed_to_edit = isset($_user['user_id']) && $is_courseMember && api_is_allowed_to_edit(); if (!$is_allowed_to_edit) give_up(get_lang('Denied')); $mdObj = new mdobject($_course, 0); diff --git a/main/metadata/importlinks.php b/main/metadata/importlinks.php index 814d823244..a649fa82e9 100755 --- a/main/metadata/importlinks.php +++ b/main/metadata/importlinks.php @@ -33,7 +33,7 @@ $nameTools = get_lang('Tool'); $_course = api_get_course_info(); isset($_course) or give_up(get_lang('Sorry')); -$is_allowed_to_edit = isset($_user['user_id']) && $is_courseMember && is_allowed_to_edit(); +$is_allowed_to_edit = isset($_user['user_id']) && $is_courseMember && api_is_allowed_to_edit(); if (!$is_allowed_to_edit) give_up(get_lang('Denied')); $mdStore = new mdstore($is_allowed_to_edit); // create table if needed diff --git a/main/metadata/importmanifest.php b/main/metadata/importmanifest.php index 7d4c206305..8c93274f8a 100755 --- a/main/metadata/importmanifest.php +++ b/main/metadata/importmanifest.php @@ -41,7 +41,7 @@ $regs = array(); $_course = api_get_course_info(); isset($_course) or give_up(get_lang('Sorry')); -$is_allowed_to_edit = isset($_user['user_id']) && $is_courseMember && is_allowed_to_edit(); +$is_allowed_to_edit = isset($_user['user_id']) && $is_courseMember && api_is_allowed_to_edit(); if (!$is_allowed_to_edit) give_up(get_lang('Denied')); $baseWorkDir = get_course_path() . ($courseDir = $_course['path'] . '/scorm'); diff --git a/main/metadata/index.php b/main/metadata/index.php index 357d36f515..e8d8e5f402 100755 --- a/main/metadata/index.php +++ b/main/metadata/index.php @@ -77,7 +77,7 @@ while ($row = Database::fetch_array($result)) // XML and DB STUFF -----------------------------------------------------------> -$is_allowed_to_edit = isset($_user['user_id']) && $is_courseMember && is_allowed_to_edit(); +$is_allowed_to_edit = isset($_user['user_id']) && $is_courseMember && api_is_allowed_to_edit(); $mdStore = new mdstore($is_allowed_to_edit); diff --git a/main/metadata/playscormmdset.inc.php b/main/metadata/playscormmdset.inc.php index ec28ccd6cc..788fc55330 100755 --- a/main/metadata/playscormmdset.inc.php +++ b/main/metadata/playscormmdset.inc.php @@ -87,7 +87,7 @@ for ($i = 0; $i < 10; $i++) // XML and DB STUFF -----------------------------------------------------------> -$is_allowed_to_edit = isset($_user['user_id']) && $is_courseMember && is_allowed_to_edit(); +$is_allowed_to_edit = isset($_user['user_id']) && $is_courseMember && api_is_allowed_to_edit(); $mdStore = new mdstore($is_allowed_to_edit); diff --git a/main/metadata/statistics.php b/main/metadata/statistics.php old mode 100644 new mode 100755 index 727cc1defc..02a0dccfa6 --- a/main/metadata/statistics.php +++ b/main/metadata/statistics.php @@ -33,7 +33,7 @@ $nameTools = get_lang('Tool'); $_course = api_get_course_info(); isset($_course) or give_up(get_lang('Sorry')); -$is_allowed_to_edit = isset($_user['user_id']) && $is_courseMember && is_allowed_to_edit(); +$is_allowed_to_edit = isset($_user['user_id']) && $is_courseMember && api_is_allowed_to_edit(); if (!$is_allowed_to_edit) give_up(get_lang('Denied')); $mdStore = new mdstore(FALSE); // no create from statistics diff --git a/main/metadata/update_indexabletext.php b/main/metadata/update_indexabletext.php old mode 100644 new mode 100755 index 547639ff7c..fa2138e6c5 --- a/main/metadata/update_indexabletext.php +++ b/main/metadata/update_indexabletext.php @@ -35,7 +35,7 @@ $nameTools = get_lang('Tool'); $_course = api_get_course_info(); isset($_course) or give_up(get_lang('Sorry')); -$is_allowed_to_edit = isset($_user['user_id']) && $is_courseMember && is_allowed_to_edit(); +$is_allowed_to_edit = isset($_user['user_id']) && $is_courseMember && api_is_allowed_to_edit(); if (!$is_allowed_to_edit) give_up(get_lang('Denied')); $mdStore = new mdstore($is_allowed_to_edit); // create table if needed diff --git a/main/work/downloadfolder.inc.php b/main/work/downloadfolder.inc.php old mode 100644 new mode 100755 index 851aca8c43..97a7f95a1f --- a/main/work/downloadfolder.inc.php +++ b/main/work/downloadfolder.inc.php @@ -53,7 +53,7 @@ $prop_table = Database::get_course_table(TABLE_ITEM_PROPERTY); //normal users get only visible files that are in visible folders //admins are allowed to download invisible files -if (is_allowed_to_edit()) { +if (api_is_allowed_to_edit()) { //folder we want to zip --> no longer used, deleted files are included too like this //$what_to_zip = $sys_course_path.$_course['path']."/document".$path; //creation of the zipped folder