瀏覽代碼

[svn r9991] replace $_uid with $_user['user_id']

Patrick Cool 18 年之前
父節點
當前提交
68e71769f9

+ 1 - 2
main/admin/user_list.php

@@ -1,6 +1,6 @@
 <?php
 
-// $Id: user_list.php 9981 2006-11-15 00:05:16Z pcool $
+// $Id: user_list.php 9991 2006-11-15 12:11:22Z pcool $
 /*
 ==============================================================================
 	Dokeos - elearning and course management software
@@ -75,7 +75,6 @@ function login_user($user_id)
 
 	$message = "Attempting to login as ".$firstname." ".$lastname." (id ".$user_id.")";
 
-	$_uid = $user_id;
 	//bug: this only works if $_uid is global
 	api_session_register('_uid');
 

+ 1 - 1
main/blog/blog.php

@@ -339,7 +339,7 @@ else
 							FROM ".$tbl_blogs_tasks_rel_user."
 							WHERE
 								`blog_id` = ".$blog_id." AND
-								`user_id` = ".$_uid." AND
+								`user_id` = ".$_user['user_id']." AND
 								`task_id` = ".$task_id;
 
 	$result = api_sql_query($sql, __LINE__, __FILE__);

+ 1 - 1
main/exercice/showinframes.php

@@ -73,7 +73,7 @@ if ($content=="")
 				"			}\n".
 				"			else\n".
 				"			{\n".
-				"				window.location.href = \"".api_get_path(WEB_PATH)."main/exercice/"."savescores.php?origin=$origin&learnpath_id=$learnpath_id&learnpath_item_id=$learnpath_item_id&time=$time&test=".$doc_url."&uid=".$_uid."&cid=".$cid."&score=\"+Score;\n".
+				"				window.location.href = \"".api_get_path(WEB_PATH)."main/exercice/"."savescores.php?origin=$origin&learnpath_id=$learnpath_id&learnpath_item_id=$learnpath_item_id&time=$time&test=".$doc_url."&uid=".$_user['user_id']."&cid=".$cid."&score=\"+Score;\n".
 				"			}\n".
 				"		}\n".
 				"}\n".

+ 6 - 7
main/scorm/closesco.php

@@ -46,7 +46,6 @@ $origin							= $_GET['origin'];
 $max									= $_GET['max'];
 $min									= $_GET['min'];
 $file									= $_GET['file'];
-$_uid									= $_SESSION['_uid'];
 
 $charset_lang = 'ISO-8859-15';
 
@@ -81,7 +80,7 @@ if($_SESSION['dont_save_last']!=true){
 		if(is_array($items[$j])){
 			//error_log('items['.$j.'] is an array',0);
 			$sql = "SELECT status FROM $TBL_SCORM_SCO_DATA 
-				WHERE (contentId='$contentId' and studentId='$_uid' and scoIdentifier='".$items[$j]['identifier']."')";
+				WHERE (contentId='$contentId' and studentId='".$_user['user_id']."' and scoIdentifier='".$items[$j]['identifier']."')";
 			$result = api_sql_query($sql,__FILE__,__LINE__);
 			$ar=mysql_fetch_array($result);
 			$sub_lesson_status=$ar['status'];
@@ -91,12 +90,12 @@ if($_SESSION['dont_save_last']!=true){
 	}
 	if($sub_cluster_completed){
 		//error_log("Element $my_sco_identifier has no incomplete children, change status to $lesson_status",0);
-		$sql="UPDATE $TBL_SCORM_SCO_DATA SET score='$score', status='$lesson_status', time='$time' WHERE (studentId='$_uid' and scoIdentifier='$my_sco_identifier' and contentId='$contentId')";
+		$sql="UPDATE $TBL_SCORM_SCO_DATA SET score='$score', status='$lesson_status', time='$time' WHERE (studentId='".$_user['user_id']."' and scoIdentifier='$my_sco_identifier' and contentId='$contentId')";
 		$result = api_sql_query($sql,__FILE__,__LINE__);
 		//error_log($sql,0);
 	}else{
 		//error_log("Element $my_sco_identifier has incomplete children, set status to incomplete)",0);
-		$sql="UPDATE $TBL_SCORM_SCO_DATA SET score='$score', status='incomplete', time='$time' WHERE (studentId='$_uid' and scoIdentifier='$my_sco_identifier' and contentId='$contentId')";
+		$sql="UPDATE $TBL_SCORM_SCO_DATA SET score='$score', status='incomplete', time='$time' WHERE (studentId='".$_user['user_id']."' and scoIdentifier='$my_sco_identifier' and contentId='$contentId')";
 		$result = api_sql_query($sql,__FILE__,__LINE__);
 	}
 }else{
@@ -132,7 +131,7 @@ for ($cluster=($startcluster*10); (($cluster<=($startcluster*10+9)) && ($cluster
 	$i = (!empty($items_clusterinfo_dictionary[$cluster])?$items_clusterinfo_dictionary[$cluster]:0);
 	$id=$items[$i]['identifier'];
 	$sql = "SELECT status FROM $TBL_SCORM_SCO_DATA 
-		WHERE (contentId='$contentId' and studentId='$_uid' and scoIdentifier='$id')";
+		WHERE (contentId='$contentId' and studentId='".$_user['user_id']."' and scoIdentifier='$id')";
 	$result = api_sql_query($sql,__FILE__,__LINE__);
 	$ar=mysql_fetch_array($result);
 	$cluster_lesson_status=$ar['status'];
@@ -146,7 +145,7 @@ if ($clustercompleted) { //if every sub-element of this cluster was completed
 	//} while (($items[$i]['clusterinfo'] != $startcluster) and ($i <= count($items)));
 	$i = (!empty($items_clusterinfo_dictionary[$startcluster])?$items_clusterinfo_dictionary[$startcluster]:0);	
 	$my_sco_identifier=$items[$i]['identifier'];
-	$sql="UPDATE $TBL_SCORM_SCO_DATA SET status='completed' WHERE (studentId='$_uid' and scoIdentifier='$my_sco_identifier' and contentId='$contentId')";
+	$sql="UPDATE $TBL_SCORM_SCO_DATA SET status='completed' WHERE (studentId='".$_user['user_id']."' and scoIdentifier='$my_sco_identifier' and contentId='$contentId')";
 	//echo $sql;
 	$result = api_sql_query($sql,__FILE__,__LINE__);
 } else { // if at least one element was not completed
@@ -156,7 +155,7 @@ if ($clustercompleted) { //if every sub-element of this cluster was completed
 	//} while (($items[$i]['clusterinfo'] != $startcluster) and ($i <= count($items)));
 	$i = (!empty($items_clusterinfo_dictionary[$startcluster])?$items_clusterinfo_dictionary[$startcluster]:0);	
 	$my_sco_identifier=$items[$i]['identifier'];
-	$sql="UPDATE $TBL_SCORM_SCO_DATA SET status='incomplete' WHERE (studentId='$_uid' and scoIdentifier='$my_sco_identifier' and contentId='$contentId')";
+	$sql="UPDATE $TBL_SCORM_SCO_DATA SET status='incomplete' WHERE (studentId='".$_user['user_id']."' and scoIdentifier='$my_sco_identifier' and contentId='$contentId')";
 	//echo $sql;
 	$result = api_sql_query($sql,__FILE__,__LINE__);
 }

+ 5 - 7
main/scorm/contents.php

@@ -62,8 +62,6 @@ if(substr($request_file,0,strlen($file_path)) != $file_path || strpos($request_f
 {
 	api_not_allowed();
 }
-//$s_identifier		= $_SESSION['s_identifier'];
-$_uid					= $_SESSION['_uid'];
 
 //Charset settings (very important for imported contents)
 $charset = GetXMLEncode($_GET['file']);
@@ -321,7 +319,7 @@ $_SESSION['contentId'] = $mycontentId;
 $everopened = true;
 $numrows2 = 0; 
 $result2='';
-$sql2 = "SELECT * FROM $TBL_SCORM_SCO_DATA WHERE (studentId='$_uid' and contentId='$mycontentId')";
+$sql2 = "SELECT * FROM $TBL_SCORM_SCO_DATA WHERE (studentId='".$_user['user_id']."' and contentId='$mycontentId')";
 $result2 = api_sql_query($sql2,__FILE__,__LINE__);
 $numrows2 = mysql_num_rows($result2);
 
@@ -360,7 +358,7 @@ if ( $menu == 'restart' ) { //Restrart clicked
 		
 		//5.1.b.2 update the status for the current user and content in the SCORM data table
 		$sql = "UPDATE $TBL_SCORM_SCO_DATA SET score='0', status='not attempted', time='00:00' "
-							." WHERE (studentId='$_uid' and contentId='$mycontentId')";
+							." WHERE (studentId='".$_user['user_id']."' and contentId='$mycontentId')";
 		$result = api_sql_query($sql,__FILE__,__LINE__);
 		//5.1.b.3 clean session vars about this content
 		api_session_unregister('s_href');
@@ -477,7 +475,7 @@ if ( $menu == 'restart' ) { //Restrart clicked
 		// the database table
 		foreach($items as $i => $myitem ) {
 			$sql="SELECT * FROM $TBL_SCORM_SCO_DATA 
-				WHERE (studentId='$_uid' 
+				WHERE (studentId='".$_user['user_id']."' 
 				AND contentId='".$mycontentId."' 
 				AND scoIdentifier = '".$myitem['identifier']."')";// order by scoId";
 			$result = api_sql_query($sql,__FILE__,__LINE__);
@@ -587,7 +585,7 @@ while ($items[$i]) {
 		$sql = "INSERT INTO $TBL_SCORM_SCO_DATA "
 					."(contentId, scoId, scoIdentifier, scoTitle, status, studentID, score, time)VALUES "
 					."('".$mycontentId."','".$index."','".$items[$i]['identifier']."','"
-					.addslashes($items[$i]['title'])."','not attempted','".$_uid."','0','00:00')";
+					.addslashes($items[$i]['title'])."','not attempted','".$_user['user_id']."','0','00:00')";
 		$result = api_sql_query($sql,__FILE__,__LINE__);
 	}
 	
@@ -613,7 +611,7 @@ while ($items[$i]) {
 	
 	//6.2.7 Get the recorded status for this document/content
 	$sql3 = "SELECT status FROM $TBL_SCORM_SCO_DATA WHERE "
-				." (contentId='$mycontentId' and studentId='$_uid' and scoIdentifier='$identifier')";
+				." (contentId='$mycontentId' and studentId='".$_user['user_id']."' and scoIdentifier='$identifier')";
 	$result3 = api_sql_query($sql3,__FILE__,__LINE__);
 	$ar3=mysql_fetch_array($result3);
 	$lesson_status=$ar3['status'];

+ 3 - 3
main/scorm/index.php

@@ -18,7 +18,8 @@ $langFile = "scorm";
 include('../inc/global.inc.php');
 $this_section=SECTION_COURSES;
 
-if ($_uid=='') { //that means, that the used logged out in the other window
+if ($_user['user_id']=='') 
+{ //that means, that the used logged out in the other window
 	echo "<script type=\"text/javascript\">
 			/* <![CDATA[ */
 			alert('".get_lang('ScormLoggedout')."');
@@ -27,8 +28,7 @@ if ($_uid=='') { //that means, that the used logged out in the other window
 		  </script>";
 	exit();
 }
-?>
-<?php echo "<html><head><title>".get_lang('ScormTitle')."</title></head>"; ?>
+echo "<html><head><title>".get_lang('ScormTitle')."</title></head>"; ?>
 
 
 <frameset rows="40,*" frameborder="yes" framespacing="1">

+ 2 - 3
main/scorm/opensco.php

@@ -46,7 +46,6 @@ $sco_identifier = $_GET['sco_identifier'];
 $file 		= $_GET['file'];
 $edoceo 	= $_GET['edoceo'];
 $items 		= $_SESSION['items'];
-$_uid		= $_SESSION['_uid'];
 $contentId	= $_SESSION['contentId'];
 $openDir = $_REQUEST['openDir'];
 //prepare those variables for scormfunctions.php
@@ -101,8 +100,8 @@ $i=$_SESSION['items_dictionary'][$prereq];
 $prereqtitle=$items[$i]['title'];
 if ($prereq != '') {
 	$result = api_sql_query("SELECT status FROM $TBL_SCORM_SCO_DATA 
-		WHERE (scoIdentifier='$prereq' and studentId='$_uid' and contentId='$contentId')",__FILE__,__LINE__);
-	//echo "SELECT status FROM `$TBL_SCORM_SCO_DATA` WHERE (scoIdentifier='$prereq' and studentId='$_uid' and contentId='$contentId')";
+		WHERE (scoIdentifier='$prereq' and studentId='".$_user['user_id']."' and contentId='$contentId')",__FILE__,__LINE__);
+	//echo "SELECT status FROM `$TBL_SCORM_SCO_DATA` WHERE (scoIdentifier='$prereq' and studentId='".$_user['user_id']."' and contentId='$contentId')";
 	$ar=mysql_fetch_array($result);
 	$status=$ar['status'];
 	if ($status=='completed' or $status='passed') 	{ $openpage=true; }	else { $openpage=false; }

+ 1 - 1
main/scorm/scormdocument.php

@@ -488,7 +488,7 @@ if(api_is_allowed_to_edit()) // TEACHER ONLY
 					$dialogBox = get_lang('DownloadEnd');
 				}
 
-				api_item_property_update($_course, TOOL_LEARNPATH, $id, "LearnpathAdded", $_uid);
+				api_item_property_update($_course, TOOL_LEARNPATH, $id, "LearnpathAdded", $_user['user_id']);
 			}
 			else
 			{

+ 2 - 5
main/scorm/scormfunctions.php

@@ -46,9 +46,6 @@ include('../inc/global.inc.php');
 $this_section=SECTION_COURSES;
 
 $TBL_SCORM_SCO_DATA=$scormDbName.".scorm_sco_data";
-
-$_uid							= $_SESSION['_uid'];
-$_user						= $_SESSION['_user'];
 $old_s_identifier	= $_SESSION['old_sco_identifier'];
 $my_s_identifier	= $_SESSION['s_identifier'];
 $file							= $_SESSION['file'];
@@ -142,7 +139,7 @@ result='entry, exit, lesson_status, student_id, student_name, lesson_location, t
 	case 'cmi.core.lesson_status'	: 
     if(lesson_status != '') {result=lesson_status;}
     else{<?php
-        $result = api_sql_query("SELECT status FROM $TBL_SCORM_SCO_DATA WHERE (studentId='$_uid' and scoIdentifier='$my_s_identifier')");
+        $result = api_sql_query("SELECT status FROM $TBL_SCORM_SCO_DATA WHERE (studentId='".$_user['user_id']."' and scoIdentifier='$my_s_identifier')");
         $ar=mysql_fetch_array($result);
         $status=$ar['status'];
         if(empty($ar['status'])){$status = "not attempted";}
@@ -151,7 +148,7 @@ result='entry, exit, lesson_status, student_id, student_name, lesson_location, t
         echo " result='$status';";?>
         } 
     break;
-	case 'cmi.core.student_id'	   : <?php echo "result='$_uid';"; ?> break;
+	case 'cmi.core.student_id'	   : <?php echo "result='".$_user['user_id']."';"; ?> break;
 	case 'cmi.core.student_name'	: 
 	  <?php
 		$who=$_user ['firstName']." ".$_user ['lastName'];

+ 1 - 1
main/survey/survey_white.php

@@ -124,7 +124,7 @@ while($o_group = mysql_fetch_object($rsGroups) ){
 			// select the previous answer the user did
 			$sql = '	SELECT answer 
 						FROM '.$db_name.'.survey_report 
-						WHERE user_id='.$_uid.' AND survey_id='.$surveyid.' AND qid='.$o_question->qid;
+						WHERE user_id='.$_user['user_id'].' AND survey_id='.$surveyid.' AND qid='.$o_question->qid;
 			
 			$rsAttempt = api_sql_query($sql, __FILE__, __LINE__);
 			list($answer) = mysql_fetch_array($rsAttempt);

+ 3 - 3
main/tracking/personnalLog.php

@@ -121,7 +121,7 @@ if ( $is_trackingEnabled )
     </tr>";
         $sql = "SELECT `login_date`
                     FROM `".$TABLETRACK_LOGIN."`
-                    WHERE `login_user_id` = '".$_uid."'
+                    WHERE `login_user_id` = '".$_user['user_id']."'
                     ORDER BY `login_date` DESC
                     LIMIT ".$limitOfDisplayedLogins."";
         echo "<tr><td style='padding-left : 40px;' valign='top'>".get_lang('LoginsExplaination')."<br/>";
@@ -154,7 +154,7 @@ if ( $is_trackingEnabled )
 
                 $sql = "SELECT `access_tool`, count(access_tool), `access_cours_code`
                             FROM `".$TABLETRACK_ACCESS."`
-                            WHERE `access_user_id` = '".$_uid."'".
+                            WHERE `access_user_id` = '".$_user['user_id']."'".
                                 //AND access_tool IS NOT NULL
                                 "AND access_date > '".$value."'
                                 AND access_date < '".$previousDate."'
@@ -242,7 +242,7 @@ if ( $is_trackingEnabled )
         echo " Ceci est amen  etre dplac vers la page de garde des exercices ";
         $sql = "SELECT `ce`.`title`, `te`.`exe_result` , `te`.`exe_weighting`, `te`.`exe_date`
                     FROM `$TABLECOURSE_EXERCICES` AS ce , `$TABLETRACK_EXERCICES` AS te
-                    WHERE `te`.`exe_user_id` = '$_uid'
+                    WHERE `te`.`exe_user_id` = '".$_user['user_id']."'
                         AND `te`.`exe_exo_id` = `ce`.`id`
                     ORDER BY `te`.`exe_cours_id` ASC, `ce`.`title` ASC, `te`.`exe_date`ASC";
     

+ 5 - 5
main/upload/upload.document.php

@@ -76,7 +76,7 @@ if(isset($_FILES['user_upload']))
 	if($upload_ok)
 	{
 		//file got on the server without problems, now process it
-		$new_path = handle_uploaded_document($_course, $_FILES['user_upload'],$base_work_dir,$_POST['curdirpath'],$_uid,$to_group_id,$to_user_id,$max_filled_space,$_POST['unzip'],$_POST['if_exists']);
+		$new_path = handle_uploaded_document($_course, $_FILES['user_upload'],$base_work_dir,$_POST['curdirpath'],$_user['user_id'],$to_group_id,$to_user_id,$max_filled_space,$_POST['unzip'],$_POST['if_exists']);
     	$new_comment = isset($_POST['comment']) ? trim($_POST['comment']) : '';
     	$new_title = isset($_POST['title']) ? trim($_POST['title']) : '';
 		
@@ -109,13 +109,13 @@ if(isset($_POST['submit_image']))
 		//we could also create a function for this, I'm not sure...
 		//create a directory for the missing files
 		$img_directory = str_replace('.','_',$_POST['related_file']."_files");
-		$missing_files_dir = create_unexisting_directory($_course,$_uid,$to_group_id,$to_user_id,$base_work_dir,$img_directory);
+		$missing_files_dir = create_unexisting_directory($_course,$_user['user_id'],$to_group_id,$to_user_id,$base_work_dir,$img_directory);
 		//put the uploaded files in the new directory and get the paths
-		$paths_to_replace_in_file = move_uploaded_file_collection_into_directory($_course, $_FILES['img_file'],$base_work_dir,$missing_files_dir,$_uid,$to_group_id,$to_user_id,$max_filled_space);
+		$paths_to_replace_in_file = move_uploaded_file_collection_into_directory($_course, $_FILES['img_file'],$base_work_dir,$missing_files_dir,$_user['user_id'],$to_group_id,$to_user_id,$max_filled_space);
 		//open the html file and replace the paths
 		replace_img_path_in_html_file($_POST['img_file_path'],$paths_to_replace_in_file,$base_work_dir.$_POST['related_file']);
 		//update parent folders
-		item_property_update_on_folder($_course,$_POST['curdirpath'],$_uid);	
+		item_property_update_on_folder($_course,$_POST['curdirpath'],$_user['user_id']);	
 	}
 }
 //they want to create a directory
@@ -123,7 +123,7 @@ if(isset($_POST['create_dir']) && $_POST['dirname']!='')
 {
 	$added_slash = ($path=='/')?'':'/';
 	$dir_name = $path.$added_slash.replace_dangerous_char($_POST['dirname']);
-	$created_dir = create_unexisting_directory($_course,$_uid,$to_group_id,$to_user_id,$base_work_dir,$dir_name,$_POST['dirname']);
+	$created_dir = create_unexisting_directory($_course,$_user['user_id'],$to_group_id,$to_user_id,$base_work_dir,$dir_name,$_POST['dirname']);
 	if($created_dir)
 	{
 		//Display::display_normal_message("<strong>".$created_dir."</strong> was created!");

+ 6 - 6
main/user/user.php

@@ -97,10 +97,10 @@ function display_user_search_form()
 */
 function show_users_in_virtual_courses()
 {
-	global $_course, $_uid;
+	global $_course, $_user;
 	$real_course_code = $_course['sysCode'];
 	$real_course_info = Database::get_course_info($real_course_code);
-	$user_subscribed_virtual_course_list = CourseManager::get_list_of_virtual_courses_for_specific_user_and_real_course($_uid, $real_course_code);
+	$user_subscribed_virtual_course_list = CourseManager::get_list_of_virtual_courses_for_specific_user_and_real_course($_user['user_id'], $real_course_code);
 	$number_of_virtual_courses = count($user_subscribed_virtual_course_list);
 	$row = 0;
 	$column_header[$row ++] = "ID";
@@ -192,7 +192,7 @@ if(api_is_allowed_to_edit())
 		{
 			case 'unsubscribe' :
 				// Make sure we don't unsubscribe current user from the course
-				$user_ids = array_diff($_POST['user'],array($_uid));
+				$user_ids = array_diff($_POST['user'],array($_user['user_id']));
 				if(count($user_ids) > 0)
 				{
 					CourseManager::unsubscribe_user($user_ids, $_SESSION['_course']['sysCode']);
@@ -248,7 +248,7 @@ if(api_is_allowed_to_edit())
 	// Unregister user from course
 	if($_GET['unregister'])
 	{
-		if(isset($_GET['user_id']) && is_numeric($_GET['user_id']) && $_GET['user_id'] != $_uid)
+		if(isset($_GET['user_id']) && is_numeric($_GET['user_id']) && $_GET['user_id'] != $_user['user_id'])
 		{
 			CourseManager::unsubscribe_user($_GET['user_id'],$_SESSION['_course']['sysCode']);
 			$message = get_lang('UserUnsubscribed');
@@ -498,7 +498,7 @@ function get_user_data($from, $number_of_items, $column, $direction)
  */
 function modify_filter($user_id)
 {
-	global $origin,$_uid,$is_allowed_to_track;
+	global $origin,$_user,$is_allowed_to_track;
 
 	// info
 	$result = '<a href="userInfo.php?origin='.$origin.'&amp;uInfo='.$user_id.'"><img border="0" alt="'.get_lang('Info').'" src="../img/info_small.gif" /></a>';
@@ -511,7 +511,7 @@ function modify_filter($user_id)
 		// edit
 		$result .= '<a href="userInfo.php?origin='.$origin.'&amp;editMainUserInfo='.$user_id.'"><img border="0" alt="'.get_lang('Edit').'" src="../img/edit.gif" /></a>';
 		// unregister
-		 if( $user_id != $_uid)
+		 if( $user_id != $_user['user_id'])
 		{
 			$result .= '<a href="'.$_SERVER['PHP_SELF'].'?unregister=yes&amp;user_id='.$user_id.'&amp;'.$sort_params.'" onclick="javascript:if(!confirm(\''.addslashes(htmlentities(get_lang('ConfirmYourChoice'))).'\')) return false;"><img border="0" alt="'.get_lang("Unreg").'" src="../img/delete.gif"/></a>';
 		}

+ 2 - 2
main/user/userInfo.php

@@ -92,7 +92,7 @@ $mainDB = $mainDbName;
 $courseCode = $currentCourseID = $_course['sysCode'];
 $tbl_coursUser = Database :: get_main_table(MAIN_COURSE_USER_TABLE);
 
-$userIdViewer = $_uid; // id fo the user currently online
+$userIdViewer = $_user['user_id']; // id fo the user currently online
 //$userIdViewed = $_GET['userIdViewed']; // Id of the user we want to view
 
 $allowedToEditContent = ($userIdViewer == $userIdViewed) || $is_platformAdmin;
@@ -322,7 +322,7 @@ elseif ($displayMode == "viewMainInfoEdit")
 
 		echo "<form action=\"".$_SERVER['PHP_SELF']."\" method=\"post\">\n", "<input type=\"hidden\" name=\"submitMainUserInfo\" value=\"$userIdViewed\">\n", "<table width=\"80%\" border=\"0\">", "<tr align=\"center\" bgcolor=\"#E6E6E6\">\n", "<td align=\"left\">", get_lang('Name'), "</td>\n", "<td align=\"left\">", get_lang('Role'), "</td>\n", "<td>", get_lang('Tutor'), "</td>\n", "<td>", get_lang('CourseManager'), "</td>\n", "</tr>\n", "<tr align=\"center\">", "<td align=\"left\"><b>", htmlize($mainUserInfo['firstName']), " ", htmlize($mainUserInfo['lastName']), "</b></td>\n", "<td align=\"left\"><input type=\"text\" name =\"role\" value=\"", $mainUserInfo['role'], "\" maxlength=\"40\"></td>", "<td><input class=\"checkbox\" type=\"checkbox\" name=\"promoteTutor\" value=\"1\" ", $tutorChecked, "></td>";
 
-		if (!($is_courseAdmin && $_uid == $userIdViewed))
+		if (!($is_courseAdmin && $_user['user_id'] == $userIdViewed))
 		{
 			echo "<td><input class=\"checkbox\" type=\"checkbox\" name=\"promoteCourseAdmin\" value=\"1\"", $courseAdminChecked, "></td>\n";
 		}

+ 2 - 2
main/user/userInfoLib.php

@@ -258,9 +258,9 @@ function move_cat_rank_by_rank($rank, $direction) // up & down.
 
 function update_user_course_properties($user_id, $course_code, $properties)
 {
-	global $tbl_coursUser,$_uid;
+	global $tbl_coursUser,$_user;
         $sqlChangeStatus = "";
-        if ($user_id != $_uid)
+        if ($user_id != $_user['user_id'])
             $sqlChangeStatus = "`status`     = '".$properties['status']."',";
 	$result = api_sql_query("UPDATE $tbl_coursUser
 	                        SET     `role`       = '".$properties['role']."',

+ 1 - 1
main/user/user_add.php

@@ -149,7 +149,7 @@ if($register)
 		                           email     = '$email_form',
 		                           status    = '$platformStatus',
 		                           official_code = '$official_code_form',
-		                           creator_id = '$_uid'");
+		                           creator_id = '".$_user['user_id']."'");
 
 		$userId = mysql_insert_id();