فهرست منبع

Replacing deprecated function is_allowed_to_edit() with api_is_allowed_to_edit()

Julio Montoya 13 سال پیش
والد
کامیت
a062225181

+ 3 - 3
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."'";

+ 2 - 2
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 "<a name=\"top\"></a>";
@@ -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) {

+ 1 - 1
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;

+ 1 - 1
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);

+ 1 - 1
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);

+ 2 - 2
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'];

+ 1 - 1
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);

+ 1 - 1
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

+ 1 - 1
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');

+ 1 - 1
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);
 

+ 1 - 1
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);
 

+ 1 - 1
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

+ 1 - 1
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

+ 1 - 1
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