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

skala
Patrick Cool 19 years ago
parent 702d95bab7
commit e3ff50a87a
  1. 2
      main/exercice/Hpdownload.php
  2. 26
      main/exercice/exercice.php
  3. 10
      main/exercice/exercise.class.php
  4. 2
      main/exercice/hotpotatoes.lib.php
  5. 10
      main/exercice/hotpotatoes.php
  6. 2
      main/exercice/hotspot_answers.as.php
  7. 2
      main/exercice/hotspot_savescore.inc.php
  8. 9
      main/exercice/savescores.php
  9. 19
      main/exercice/showinframes.php
  10. 2
      main/forum/editpost.php
  11. 41
      main/forum/forumfunction.inc.php
  12. 2
      main/forum/index.php
  13. 2
      main/forum/newthread.php
  14. 2
      main/forum/reply.php
  15. 2
      main/forum/viewforum.php
  16. 2
      main/forum/viewforumcategory.php
  17. 2
      main/forum/viewthread.php
  18. 6
      main/forum/viewthread_flat.inc.php
  19. 6
      main/forum/viewthread_nested.inc.php
  20. 6
      main/forum/viewthread_threaded.inc.php
  21. 8
      main/group/group.php
  22. 2
      main/group/group_space.php
  23. 56
      main/inc/lib/events.lib.inc.php
  24. 4
      main/inc/lib/fckeditor/editor/plugins/Attachment/fck_Attachment.php
  25. 18
      main/inc/lib/fileUpload.lib.php
  26. 14
      main/inc/lib/groupmanager.lib.php
  27. 2
      main/inc/lib/javascript/email_links.lib.js.php
  28. 6
      main/inc/lib/online.inc.php
  29. 4
      main/inc/lib/surveymanager.lib.php
  30. 14
      main/inc/lib/system_announcements.lib.php
  31. 14
      main/inc/lib/usermanager.lib.php
  32. 21
      main/install/update_db.inc.php

@ -148,7 +148,7 @@ if($content_type == 'text/html')
" SaveScoreVariable = 1;\n".
" if (C.ie)\n".
" {\n".
" document.location.href = \"".$exercicePath."savescores.php?origin=$origin&time=$time&test=".$doc_url."&uid=".$_uid."&cid=".$cid."&score=\"+Score;\n".
" document.location.href = \"".$exercicePath."savescores.php?origin=$origin&time=$time&test=".$doc_url."&uid=".$_user['user_id']."&cid=".$cid."&score=\"+Score;\n".
" //window.alert(Score);\n".
" }\n".
" else\n".

@ -197,9 +197,9 @@ if($is_allowedToEdit)
//$time = time();
//$time = date("Y-m-d H:i:s", $time);
//$query = "INSERT INTO $TBL_ITEM_PROPERTY (tool, ref, insert_user_id, insert_date, lastedit_type) VALUES ('".TOOL_DOCUMENT."', $id, $_uid, '$time', 'DocumentAdded' )";
//$query = "INSERT INTO $TBL_ITEM_PROPERTY (tool, ref, insert_user_id, insert_date, lastedit_type) VALUES ('".TOOL_DOCUMENT."', $id, $_user['user_id'], '$time', 'DocumentAdded' )";
//api_sql_query($query,__FILE__,__LINE__);
api_item_property_update($_course,TOOL_DOCUMENT,$id,'FolderCreated',$_uid);
api_item_property_update($_course,TOOL_DOCUMENT,$id,'FolderCreated',$_user['user_id']);
}
if(!is_dir($picturePath))
@ -218,9 +218,9 @@ if($is_allowedToEdit)
//$time = time();
//$time = date("Y-m-d H:i:s", $time);
//$query = "INSERT INTO $TBL_ITEM_PROPERTY (tool, ref, insert_user_id, insert_date, lastedit_type) VALUES ('".TOOL_DOCUMENT."', $id, $_uid, '$time', 'DocumentAdded' )";
//$query = "INSERT INTO $TBL_ITEM_PROPERTY (tool, ref, insert_user_id, insert_date, lastedit_type) VALUES ('".TOOL_DOCUMENT."', $id, $_user['user_id'], '$time', 'DocumentAdded' )";
//api_sql_query($query,__FILE__,__LINE__);
api_item_property_update($_course,TOOL_DOCUMENT,$id,'FolderCreated',$_uid);
api_item_property_update($_course,TOOL_DOCUMENT,$id,'FolderCreated',$_user['user_id']);
}
}
if($origin != 'learnpath'){
@ -247,7 +247,7 @@ $sql="SELECT count(id) FROM $TBL_EXERCICES";
$res = api_sql_query($sql,__FILE__,__LINE__);
list($nbrexerc) = mysql_fetch_row($res);
HotPotGCt($documentPath,1,$_uid);
HotPotGCt($documentPath,1,$_user['user_id']);
// only for administrator
@ -272,7 +272,7 @@ if($is_allowedToEdit)
$objExerciseTmp->save();
// "WHAT'S NEW" notification: update table item_property (previously last_tooledit)
api_item_property_update($_course, TOOL_QUIZ, $exerciseId, "QuizAdded", $_uid);
api_item_property_update($_course, TOOL_QUIZ, $exerciseId, "QuizAdded", $_user['user_id']);
break;
case 'disable': // disables an exercise
@ -317,7 +317,7 @@ if($is_allowedToEdit)
$query = "SELECT id FROM $TBL_DOCUMENT WHERE path='$file'";
$res = api_sql_query($query,__FILE__,__LINE__);
$row = Database::fetch_array($res, 'ASSOC');
api_item_property_update($_course, TOOL_DOCUMENT, $row['id'], 'visible', $_uid);
api_item_property_update($_course, TOOL_DOCUMENT, $row['id'], 'visible', $_user['user_id']);
//$dialogBox = get_lang('ViMod');
break;
@ -326,7 +326,7 @@ if($is_allowedToEdit)
$query = "SELECT id FROM $TBL_DOCUMENT WHERE path='$file'";
$res = api_sql_query($query,__FILE__,__LINE__);
$row = Database::fetch_array($res, 'ASSOC');
api_item_property_update($_course, TOOL_DOCUMENT, $row['id'], 'invisible', $_uid);
api_item_property_update($_course, TOOL_DOCUMENT, $row['id'], 'invisible', $_user['user_id']);
#$query = "UPDATE $TBL_DOCUMENT SET visibility='$newVisibilityStatus' WHERE path=\"".$file."\""; //added by Toon
#api_sql_query($query,__FILE__,__LINE__);
//$dialogBox = get_lang('ViMod');
@ -636,7 +636,7 @@ if($show == 'test'){
<tr>
<td width="20" align="right"><?php echo ($ind+($page*$limitExPage)).'.'; ?><!--<img src="../img/jqz.jpg" alt="HotPotatoes" />--></td>
<td width="1">&nbsp;</td>
<td><a href="showinframes.php?file=<?php echo $path?>&cid=<?php echo $_course['official_code'];?>&uid=<?php echo $_uid;?>" <?php if(!$active) echo 'class="invisible"'; ?>><?php echo $title?></a></td>
<td><a href="showinframes.php?file=<?php echo $path?>&cid=<?php echo $_course['official_code'];?>&uid=<?php echo $_user['user_id'];?>" <?php if(!$active) echo 'class="invisible"'; ?>><?php echo $title?></a></td>
</tr>
</table></td>
<td>
@ -674,7 +674,7 @@ if($show == 'test'){
<td width="20" align="right"><?php echo ($ind+($page*$limitExPage)).'.'; ?><!--<img src="../img/jqz.jpg" alt="HotPotatoes" />--></td>
<td width="1">&nbsp;</td>
<td><a href="showinframes.php?<?php echo api_get_cidreq()."&file=".$path."&cid=".$_course['official_code']."&uid=".$_uid.'"'; if(!$active) echo 'class="invisible"'; ?>"><?php echo $title;?></a></td>
<td><a href="showinframes.php?<?php echo api_get_cidreq()."&file=".$path."&cid=".$_course['official_code']."&uid=".$_user['user_id'].'"'; if(!$active) echo 'class="invisible"'; ?>"><?php echo $title;?></a></td>
</tr>
</table></td>
@ -849,7 +849,7 @@ $message = "<p>You attempt for the test #test# has been viewed/commented/correct
if($is_allowedToEdit)
{
//get all results (ourself and the others) as an admin should see them
//AND exe_user_id <> $_uid clause has been removed
//AND exe_user_id <> $_user['user_id'] clause has been removed
$sql="SELECT CONCAT(`lastname`,' ',`firstname`),`ce`.`title`, `te`.`exe_result` ,
`te`.`exe_weighting`, UNIX_TIMESTAMP(`te`.`exe_date`),`te`.`exe_Id`,email
FROM $TBL_EXERCICES AS ce , `$TBL_TRACK_EXERCICES` AS te, $TBL_USER AS user
@ -867,12 +867,12 @@ $message = "<p>You attempt for the test #test# has been viewed/commented/correct
{ // get only this user's results
$sql="SELECT '',`ce`.`title`, `te`.`exe_result` , `te`.`exe_weighting`, UNIX_TIMESTAMP(`te`.`exe_date`),`te`.`exe_Id`
FROM $TBL_EXERCICES AS ce , `$TBL_TRACK_EXERCICES` AS te
WHERE `te`.`exe_exo_id` = `ce`.`id` AND `te`.`exe_user_id`='$_uid' AND `te`.`exe_cours_id`='$_cid'
WHERE `te`.`exe_exo_id` = `ce`.`id` AND `te`.`exe_user_id`='".$_user['user_id']."' AND `te`.`exe_cours_id`='$_cid'
ORDER BY `te`.`exe_cours_id` ASC, `ce`.`title` ASC, `te`.`exe_date`ASC";
$hpsql="SELECT '',exe_name, exe_result , exe_weighting, UNIX_TIMESTAMP(exe_date)
FROM `$TBL_TRACK_HOTPOTATOES`
WHERE exe_user_id = '$_uid' AND exe_cours_id = '".$_cid."'
WHERE exe_user_id = '".$_user['user_id']."' AND exe_cours_id = '".$_cid."'
ORDER BY exe_cours_id ASC, exe_date ASC";
}

@ -1,4 +1,4 @@
<?php // $Id: exercise.class.php 9246 2006-09-25 13:24:53Z bmol $
<?php // $Id: exercise.class.php 9986 2006-11-15 01:14:12Z pcool $
/*
==============================================================================
Dokeos - elearning and course management software
@ -322,7 +322,7 @@ class Exercise
*/
function updateSound($sound,$delete)
{
global $audioPath, $documentPath,$_course,$_uid;
global $audioPath, $documentPath,$_course, $_user;
$TBL_DOCUMENT = Database::get_course_table(DOCUMENT_TABLE);
$TBL_ITEM_PROPERTY = Database::get_course_table(ITEM_PROPERTY_TABLE);
@ -350,10 +350,10 @@ class Exercise
/*$query = "INSERT INTO $TBL_ITEM_PROPERTY "
."(tool, ref, insert_user_id,to_group_id, insert_date, lastedit_date, lastedit_type) "
." VALUES "
."('".TOOL_DOCUMENT."', $id, $_uid, 0, '$time', '$time', 'DocumentAdded' )";
."('".TOOL_DOCUMENT."', $id, $_user['user_id'], 0, '$time', '$time', 'DocumentAdded' )";
api_sql_query($query,__FILE__,__LINE__);*/
api_item_property_update($_course, TOOL_DOCUMENT, $id, 'DocumentAdded',$_uid);
item_property_update_on_folder($_course,str_replace($documentPath,'',$audioPath),$_uid);
api_item_property_update($_course, TOOL_DOCUMENT, $id, 'DocumentAdded',$_user['user_id']);
item_property_update_on_folder($_course,str_replace($documentPath,'',$audioPath),$_user['user_id']);
}
}
}

@ -41,7 +41,7 @@
*/
function hotpotatoes_init($baseWorkDir)
{
//global $_course, $_uid;
//global $_course, $_user;
$documentPath=$baseWorkDir.'/';
if (!is_dir($documentPath))
{

@ -62,9 +62,9 @@ if ($is_allowedToEdit)
//create the "HotPotatoes" directory
$doc_id = add_document($_course, '/HotPotatoes_files','folder',0,'HotPotatoes Files');
//update properties in dbase (in any case)
api_item_property_update($_course,TOOL_DOCUMENT,$doc_id,'FolderCreated',$_uid);
api_item_property_update($_course,TOOL_DOCUMENT,$doc_id,'FolderCreated',$_user['user_id']);
//make invisible(in any case) - why?
api_item_property_update($_course,TOOL_DOCUMENT,$doc_id,'invisible',$_uid);
api_item_property_update($_course,TOOL_DOCUMENT,$doc_id,'invisible',$_user['user_id']);
}
}
@ -121,7 +121,7 @@ if(($is_allowedToEdit) && (($finish == 0) || ($finish == 2)))
$fld = GenerateHpFolder($document_sys_path.$uploadPath."/");
@mkdir($document_sys_path.$uploadPath."/".$fld);
$doc_id = add_document($_course, '/HotPotatoes_files/'.$fld,'folder',0,$fld);
api_item_property_update($_course,TOOL_DOCUMENT,$doc_id,'FolderCreated',$_uid);
api_item_property_update($_course,TOOL_DOCUMENT,$doc_id,'FolderCreated',$_user['user_id']);
}
else
{ //it is not the first step... get the filename directly from the system params
@ -131,7 +131,7 @@ if(($is_allowedToEdit) && (($finish == 0) || ($finish == 2)))
/*if (treat_uploaded_file($_FILES['userFile'], $document_sys_path,
$uploadPath."/".$fld, $maxFilledSpace, $unzip))*/
$allow_output_on_success = false;
if (handle_uploaded_document($_course,$_FILES['userFile'],$document_sys_path,$uploadPath."/".$fld,$_uid,null,null,$maxFilledSpace,$unzip,'',$allow_output_on_success))
if (handle_uploaded_document($_course,$_FILES['userFile'],$document_sys_path,$uploadPath."/".$fld,$_user['user_id'],null,null,$maxFilledSpace,$unzip,'',$allow_output_on_success))
{
if ($finish==2)
@ -169,7 +169,7 @@ if(($is_allowedToEdit) && (($finish == 0) || ($finish == 2)))
/*, visibility='v' */
api_sql_query($query,__FILE__,__LINE__);
api_item_property_update($_course, TOOL_QUIZ, $id, "QuizAdded", $_uid);
api_item_property_update($_course, TOOL_QUIZ, $id, "QuizAdded", $_user['user_id']);
}
else
{

@ -39,7 +39,7 @@
//include('../inc/lib/database.inc.lib');
// set vars
$userId = $_uid;
$userId = $_user['user_id'];
$questionId = $_GET['modifyAnswers'];
$objQuestion = new Question();
$objQuestion->read($questionId);

@ -65,7 +65,7 @@
$TBL_TRACK_E_HOTSPOT = Database::get_statistic_table(STATISTIC_TRACK_E_HOTSPOTS);
// Save into db
$sql = "INSERT INTO $TBL_TRACK_E_HOTSPOT (`user_id` , `course_id` , `quiz_id` , `question_id` , `answer_id` , `correct` , `coordinate` ) VALUES ('$_uid', '$courseCode', '$exerciseId', '$questionId', '$answerId', '$hit', '$coordinates')";
$sql = "INSERT INTO $TBL_TRACK_E_HOTSPOT (`user_id` , `course_id` , `quiz_id` , `question_id` , `answer_id` , `correct` , `coordinate` ) VALUES ('".$_user['user_id']."', '$courseCode', '$exerciseId', '$questionId', '$answerId', '$hit', '$coordinates')";
$result = api_sql_query($sql,__FILE__,__LINE__);
// Save insert id into session if users changes answer.

@ -38,12 +38,11 @@ include_once (api_get_path(LIBRARY_PATH).'fileManage.lib.php');
$documentPath = api_get_path(SYS_COURSE_PATH).$_course['path']."/document";
$full_file_path = $documentPath.$test;
my_delete($full_file_path.$_uid.".t.html");
my_delete($full_file_path.$_user['user_id'].".t.html");
$TABLETRACK_HOTPOTATOES = $statsDbName."`.`track_e_hotpotatoes";
$tbl_learnpath_user = Database::get_course_table(LEARNPATH_USER_TABLE);
//$_course['dbNameGlu']."learnpath_user";
$_uid = $uid;
$_cid = $cid;
$test = mysql_real_escape_string($_REQUEST['test']);
$score = mysql_real_escape_string($_REQUEST['score']);
@ -52,7 +51,7 @@ $origin = $_REQUEST['origin'];
function save_scores($file, $score)
{
global $is_trackingEnabled, $origin, $tbl_learnpath_user,
$learnpath_id, $learnpath_item_id, $_uid, $_cid,
$learnpath_id, $learnpath_item_id, $_user, $_cid,
$TABLETRACK_HOTPOTATOES;
// if tracking is disabled record nothing
$weighting = 100; // 100%
@ -61,9 +60,9 @@ function save_scores($file, $score)
if (!$is_trackingEnabled){return 0;}
if ($_uid)
if ($_user['user_id'])
{
$user_id = "'".$_uid."'";
$user_id = "'".$_user['user_id']."'";
}
else // anonymous
{

@ -43,7 +43,6 @@ require_once(api_get_path(SYS_PATH).'main/exercice/hotpotatoes.lib.php');
// init
$doc_url=urldecode($_GET['file']);
$cid = $_course['official_code'];
$_uid = $_SESSION['_uid'];
$documentPath= api_get_path(SYS_COURSE_PATH).$_course['path']."/document";
$documentWebPath= api_get_path(WEB_COURSE_PATH).$_course['path']."/document";
$origin = $_REQUEST['origin'];
@ -53,8 +52,8 @@ $time = $_REQUEST['time'];
// read content
$full_file_path = $documentPath.$doc_url;
my_delete($full_file_path.$_uid.".t.html");
$content = ReadFileCont($full_file_path.$_uid.".t.html");
my_delete($full_file_path.$_user['user_id'].".t.html");
$content = ReadFileCont($full_file_path.$_user['user_id'].".t.html");
if ($content=="")
{
@ -69,7 +68,7 @@ if ($content=="")
" SaveScoreVariable = 1;\n".
" if (C.ie)\n".
" {\n".
" document.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".
" document.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".
" //window.alert(Score);\n".
" }\n".
" else\n".
@ -88,17 +87,17 @@ if ($content=="")
$newcontent = str_replace($prehref,$posthref,$newcontent);
if (CheckSubFolder($full_file_path.$_uid.".t.html")==0)
if (CheckSubFolder($full_file_path.$_user['user_id'].".t.html")==0)
{ $newcontent = ReplaceImgTag($newcontent); }
}
else
{
//my_delete($full_file_path.$_uid.".t.html");
//my_delete($full_file_path.$_user['user_id'].".t.html");
$newcontent = $content;
}
WriteFileCont($full_file_path.$_uid.".t.html",$newcontent);
WriteFileCont($full_file_path.$_user['user_id'].".t.html",$newcontent);
/* $prehref="javascript:void(0);";
$posthref=$rootWeb."main/exercice/Hpdownload.php?doc_url=".$doc_url."&cid=".$cid."&uid=".$uid;
@ -110,7 +109,7 @@ WriteFileCont($full_file_path.$_uid.".t.html",$newcontent);
*/
$doc_url = GetFolderPath($doc_url).urlencode(GetFileName($doc_url));
// echo $documentWebPath.$doc_url.$_uid.".t.html";
// echo $documentWebPath.$doc_url.$_user['user_id'].".t.html";
// exit;
?>
<html>
@ -123,7 +122,7 @@ if ($origin!='learnpath') {
?>
<frameset rows="130,*" border="0" frameborder="no">
<frame name="top" scrolling="no" noresize target="contents" src="testheaderpage.php?file=<?php echo urlencode($_GET['file']); ?>">
<frame name="main" src="<?php echo $documentWebPath.$doc_url.$_uid.".t.html?time=$time"; ?>">
<frame name="main" src="<?php echo $documentWebPath.$doc_url.$_user['user_id'].".t.html?time=$time"; ?>">
<noframes>
<body>
<p>This page uses frames, but your browser doesn't support them.
@ -136,7 +135,7 @@ if ($origin!='learnpath') {
} else {
?>
<script language='Javascript' type='text/javascript'>
s='<?php echo $documentWebPath.$doc_url.$_uid; ?>.t.html?time=<?php echo $time; ?>';
s='<?php echo $documentWebPath.$doc_url.$_user['user_id']; ?>.t.html?time=<?php echo $time; ?>';
//document.write(s);
window.location=s;
</script>

@ -147,7 +147,7 @@ if (!api_is_allowed_to_edit() AND ($current_forum_category['locked']<>0 OR $curr
{
forum_not_allowed_here();
}
if (!$_uid AND $current_forum['allow_anonymous']==0)
if (!$_user['user_id'] AND $current_forum['allow_anonymous']==0)
{
forum_not_allowed_here();
}

@ -397,7 +397,7 @@ function store_forumcategory($values)
{
global $table_categories;
global $_course;
global $_uid;
global $_user;
// find the max cat_order. The new forum category is added at the end => max cat_order + &
$sql="SELECT MAX(cat_order) as sort_max FROM ".mysql_real_escape_string($table_categories);
@ -410,7 +410,7 @@ function store_forumcategory($values)
$sql="UPDATE ".$table_categories." SET cat_title='".mysql_real_escape_string($values['forum_category_title'])."', cat_comment='".mysql_real_escape_string($values['forum_category_comment'])."' WHERE cat_id='".mysql_real_escape_string($values['forum_category_id'])."'";
api_sql_query($sql);
$last_id=mysql_insert_id();
api_item_property_update($_course, TOOL_FORUM_CATEGORY, $values['forum_category_id'],"ForumCategoryAdded", $_uid);
api_item_property_update($_course, TOOL_FORUM_CATEGORY, $values['forum_category_id'],"ForumCategoryAdded", $_user['user_id']);
$return_message=get_lang('ForumCategoryEdited');
}
else
@ -418,7 +418,7 @@ function store_forumcategory($values)
$sql="INSERT INTO ".$table_categories." (cat_title, cat_comment, cat_order) VALUES ('".mysql_real_escape_string($values['forum_category_title'])."','".mysql_real_escape_string($values['forum_category_comment'])."','".mysql_real_escape_string($new_max)."')";
api_sql_query($sql);
$last_id=mysql_insert_id();
api_item_property_update($_course, TOOL_FORUM_CATEGORY, $last_id,"ForumCategoryAdded", $_uid);
api_item_property_update($_course, TOOL_FORUM_CATEGORY, $last_id,"ForumCategoryAdded", $_user['user_id']);
$return_message=get_lang('ForumCategoryAdded');
}
@ -438,7 +438,7 @@ function store_forum($values)
{
global $table_forums;
global $_course;
global $_uid;
global $_user;
// find the max forum_order for the given category. The new forum is added at the end => max cat_order + &
$sql="SELECT MAX(forum_order) as sort_max FROM ".$table_forums." WHERE forum_category=".mysql_real_escape_string($values['forum_category']);
@ -483,7 +483,7 @@ function store_forum($values)
'".mysql_real_escape_string($new_max)."')";
api_sql_query($sql, __LINE__,__FILE__);
$last_id=mysql_insert_id();
api_item_property_update($_course, TOOL_FORUM, $last_id,"ForumCategoryAdded", $_uid);
api_item_property_update($_course, TOOL_FORUM, $last_id,"ForumCategoryAdded", $_user['user_id']);
$return_message=get_lang('ForumAdded');
}
@ -1516,7 +1516,7 @@ function store_thread($values)
{
global $table_threads;
global $table_posts;
global $_uid;
global $_user;
global $_course;
global $current_forum;
@ -1535,20 +1535,20 @@ function store_thread($values)
$sql="INSERT INTO $table_threads (thread_title, forum_id, thread_poster_id, thread_poster_name, thread_date, thread_sticky)
VALUES ('".mysql_real_escape_string($values['post_title'])."',
'".mysql_real_escape_string($values['forum_id'])."',
'".mysql_real_escape_string($_uid)."',
'".mysql_real_escape_string($_user['user_id'])."',
'".mysql_real_escape_string($values['poster_name'])."',
'".mysql_real_escape_string($post_date)."',
'".mysql_real_escape_string($values['thread_sticky'])."')";
$result=api_sql_query($sql, __LINE__, __FILE__);
$last_thread_id=mysql_insert_id();
api_item_property_update($_course, TOOL_FORUM_THREAD, $last_thread_id,"ForumThreadAdded", $_uid);
api_item_property_update($_course, TOOL_FORUM_THREAD, $last_thread_id,"ForumThreadAdded", $_user['user_id']);
// if the forum properties tell that the posts have to be approved we have to put the whole thread invisible
// because otherwise the students will see the thread and not the post in the thread.
// we also have to change $visible because the post itself has to be visible in this case (otherwise the teacher would have
// to make the thread visible AND the post
if ($visible==0)
{
api_item_property_update($_course, TOOL_FORUM_THREAD, $last_thread_id,"invisible", $_uid);
api_item_property_update($_course, TOOL_FORUM_THREAD, $last_thread_id,"invisible", $_user['user_id']);
$visible=1;
}
@ -1559,7 +1559,7 @@ function store_thread($values)
'".mysql_real_escape_string($values['post_text'])."',
'".mysql_real_escape_string($last_thread_id)."',
'".mysql_real_escape_string($values['forum_id'])."',
'".mysql_real_escape_string($_uid)."',
'".mysql_real_escape_string($_user['user_id'])."',
'".mysql_real_escape_string($values['poster_name'])."',
'".mysql_real_escape_string($post_date)."',
'".mysql_real_escape_string($values['post_notification'])."','0',
@ -1610,7 +1610,6 @@ function show_add_post_form($action='', $id='', $form_values='')
global $forum_setting;
global $current_forum;
global $_user;
global $_uid;
// initiate the object
$form = new FormValidator('thread', 'post', $_SERVER['PHP_SELF'].'?forum='.$_GET['forum'].'&thread='.$_GET['thread'].'&post='.$_GET['post'].'&action='.$_GET['action']);
@ -1621,7 +1620,7 @@ function show_add_post_form($action='', $id='', $form_values='')
$form->addElement('hidden', 'thread_id', $_GET['thread']);
// if anonymous posts are allowed we also display a form to allow the user to put his name or username in
if ($current_forum['allow_anonymous']==1 AND !isset($_uid))
if ($current_forum['allow_anonymous']==1 AND !isset($_user['user_id']))
{
$form->addElement('text', 'poster_name', get_lang('Name'));
}
@ -1629,7 +1628,7 @@ function show_add_post_form($action='', $id='', $form_values='')
$form->addElement('text', 'post_title', get_lang('Title'));
$form->addElement('html_editor', 'post_text', get_lang('Text'));
if ($forum_setting['allow_post_notificiation'] AND isset($_uid))
if ($forum_setting['allow_post_notificiation'] AND isset($_user['user_id']))
{
$form->addElement('checkbox', 'post_notification', '', get_lang('NotifyByEmail').' ('.$_user['mail'].')');
}
@ -1676,7 +1675,7 @@ function show_add_post_form($action='', $id='', $form_values='')
// the course admin can make a thread sticky (=appears with special icon and always on top)
$form->addRule('post_title', '<div class="required">'.get_lang('ThisFieldIsRequired'), 'required');
if ($current_forum['allow_anonymous']==1 AND !isset($_uid))
if ($current_forum['allow_anonymous']==1 AND !isset($_user['user_id']))
{
$form->addRule('poster_name', '<div class="required">'.get_lang('ThisFieldIsRequired'), 'required');
}
@ -1709,7 +1708,7 @@ function store_reply($values)
{
global $table_threads;
global $table_posts;
global $_uid;
global $_user;
global $_course;
global $current_forum;
@ -1729,7 +1728,7 @@ function store_reply($values)
'".mysql_real_escape_string($values['post_text'])."',
'".mysql_real_escape_string($values['thread_id'])."',
'".mysql_real_escape_string($values['forum_id'])."',
'".mysql_real_escape_string($_uid)."',
'".mysql_real_escape_string($_user['user_id'])."',
'".mysql_real_escape_string($post_date)."',
'".mysql_real_escape_string($values['post_notification'])."',
'".mysql_real_escape_string($values['post_parent_id'])."',
@ -1745,7 +1744,7 @@ function store_reply($values)
update_thread($values['thread_id'], $new_post_id,$post_date);
// update the forum
api_item_property_update($_course, TOOL_FORUM, $values['forum_id'],"NewMessageInForum", $_uid);
api_item_property_update($_course, TOOL_FORUM, $values['forum_id'],"NewMessageInForum", $_user['user_id']);
$message=get_lang('ReplyAdded').'<br />';
if ($current_forum['approval_direct_post']=='1' AND !api_is_allowed_to_edit())
@ -1987,7 +1986,7 @@ function forum_not_allowed_here()
*/
function get_whats_new()
{
global $_uid;
global $_user;
global $_course;
global $table_posts;
@ -2001,7 +2000,7 @@ function get_whats_new()
if (!$_SESSION['last_forum_access'])
{
$tracking_last_tool_access=Database::get_statistic_table(STATISTIC_TRACK_E_LASTACCESS_TABLE);
$sql="SELECT * FROM ".$tracking_last_tool_access." WHERE access_user_id='".mysql_real_escape_string($_uid)."' AND access_cours_code='".mysql_real_escape_string($_course['sysCode'])."' AND access_tool='".mysql_real_escape_string($tool)."'";
$sql="SELECT * FROM ".$tracking_last_tool_access." WHERE access_user_id='".mysql_real_escape_string($_user['user_id'])."' AND access_cours_code='".mysql_real_escape_string($_course['sysCode'])."' AND access_tool='".mysql_real_escape_string($tool)."'";
$result=api_sql_query($sql,__FILE__,__LINE__);
$row=mysql_fetch_array($result);
$_SESSION['last_forum_access']=$row['access_date'];
@ -2316,7 +2315,7 @@ function handle_mail_cue($content, $id)
function send_mail($user_info=array(), $thread_information=array())
{
global $_course;
global $_uid;
global $_user;
$email_subject = get_lang('NewForumPost')." - ".$_course['official_code'];
@ -2336,7 +2335,7 @@ function send_mail($user_info=array(), $thread_information=array())
if(empty($charset)){$charset='ISO-8859-1';}
$encoding = 'Content-Type: text/html; charset='. $charset;
if ($user_info['user_id']<>$_uid)
if ($user_info['user_id']<>$_user['user_id'])
{
$newmail = api_mail($user_info["lastname"].' '.$user_info["firstname"], $user_info["email"], $email_subject, $email_body, $_SESSION['_user']['lastName'].' '.$_SESSION['_user']['firstName'], $_SESSION['_user']['mail'],$encoding);
}

@ -138,7 +138,7 @@ $forum_list=get_forums();
*/
// the groups of the user
$groups_of_user=array();
$groups_of_user=GroupManager::get_group_ids($_course['dbName'], $_uid);
$groups_of_user=GroupManager::get_group_ids($_course['dbName'], $_user['user_id']);
// all groups in the course (and sorting them as the id of the group = the key of the array
$all_groups=GroupManager::get_group_list();
if(is_array($all_groups))

@ -151,7 +151,7 @@ if (!api_is_allowed_to_edit() AND $current_forum['allow_new_threads']<>1)
forum_not_allowed_here();
}
// 4. anonymous posts are not allowed and the user is not logged in
if (!$_uid AND $current_forum['allow_anonymous']<>1)
if (!$_user['user_id'] AND $current_forum['allow_anonymous']<>1)
{
forum_not_allowed_here();
}

@ -148,7 +148,7 @@ if (!api_is_allowed_to_edit() AND ($current_forum_category['locked']<>0 OR $curr
{
forum_not_allowed_here();
}
if (!$_uid AND $current_forum['allow_anonymous']==0)
if (!$_user['user_id'] AND $current_forum['allow_anonymous']==0)
{
forum_not_allowed_here();
}

@ -168,7 +168,7 @@ if (isset($message))
// 1. the course admin is here
// 2. the course member is here and new threads are allowed
// 3. a visitor is here and new threads AND allowed AND anonymous posts are allowed
if (api_is_allowed_to_edit() OR ($current_forum['allow_new_threads']==1 AND isset($_uid)) OR ($current_forum['allow_new_threads']==1 AND !isset($_uid) AND $current_forum['allow_anonymous']==1))
if (api_is_allowed_to_edit() OR ($current_forum['allow_new_threads']==1 AND isset($_user['user_id'])) OR ($current_forum['allow_new_threads']==1 AND !isset($_user['user_id']) AND $current_forum['allow_anonymous']==1))
{
echo '<a href="newthread.php?forum='.$_GET['forum'].'">'.get_lang('NewTopic').'</a>';
}

@ -146,7 +146,7 @@ $forum_list=get_forums();
------------------------------------------------------------------------------------------------------
*/
$groups_of_user=array();
$groups_of_user=GroupManager::get_group_ids($_course['dbName'], $_uid);
$groups_of_user=GroupManager::get_group_ids($_course['dbName'], $_user['user_id']);
//my_print_r($groups_of_user);

@ -179,7 +179,7 @@ if ($message<>'PostDeletedSpecial') // in this case the first and only post of t
if ($current_forum_category['locked']==0 AND $current_forum['locked']==0 AND $current_thread['locked']==0 OR api_is_allowed_to_edit())
{
// The link should only appear when the user is logged in or when anonymous posts are allowed.
if ($_uid OR ($current_forum['allow_anonymous']==1 AND !$_uid))
if ($_user['user_id'] OR ($current_forum['allow_anonymous']==1 AND !$_user['user_id']))
{
echo '<a href="reply.php?forum='.$_GET['forum'].'&amp;thread='.$_GET['thread'].'&amp;action=replythread">'.get_lang('ReplyToThread').'</a>';
}

@ -88,7 +88,7 @@ foreach ($rows as $row)
echo $row['post_date'].'<br /><br />';
// The user who posted it can edit his thread only if the course admin allowed this in the properties of the forum
// The course admin him/herself can do this off course always
if (($current_forum['allow_edit']==1 AND $row['user_id']==$_uid) or api_is_allowed_to_edit())
if (($current_forum['allow_edit']==1 AND $row['user_id']==$_user['user_id']) or api_is_allowed_to_edit())
{
echo "<a href=\"editpost.php?forum=".$_GET['forum']."&amp;thread=".$_GET['thread']."&amp;post=".$row['post_id']."\">".icon('../img/edit.gif',get_lang('Edit'))."</a>\n";
}
@ -103,7 +103,7 @@ foreach ($rows as $row)
//if (($current_forum_category['locked']==0 AND $current_forum['locked']==0 AND $current_thread['locked']==0) OR api_is_allowed_to_edit())
if ($current_forum_category['locked']==0 AND $current_forum['locked']==0 AND $current_thread['locked']==0 OR api_is_allowed_to_edit())
{
if ($_uid OR ($current_forum['allow_anonymous']==1 AND !$_uid))
if ($_user['user_id'] OR ($current_forum['allow_anonymous']==1 AND !$_user['user_id']))
{
echo '<a href="reply.php?forum='.$_GET['forum'].'&amp;thread='.$_GET['thread'].'&amp;post='.$row['post_id'].'&amp;action=replymessage">'.get_lang('ReplyToMessage').'</a><br />';
echo '<a href="reply.php?forum='.$_GET['forum'].'&amp;thread='.$_GET['thread'].'&amp;post='.$row['post_id'].'&amp;action=quote">'.get_lang('QuoteMessage').'</a><br /><br />';
@ -134,7 +134,7 @@ foreach ($rows as $row)
{
$post_image=icon('../img/forumpost.gif');
}
if ($row['post_notification']=='1' AND $row['poster_id']==$_uid)
if ($row['post_notification']=='1' AND $row['poster_id']==$_user['user_id'])
{
$post_image.=icon('../img/forumnotification.gif',get_lang('YouWillBeNotified'));
}

@ -93,7 +93,7 @@ foreach ($rows as $post)
echo $post['post_date'].'<br /><br />';
// The user who posted it can edit his thread only if the course admin allowed this in the properties of the forum
// The course admin him/herself can do this off course always
if (($current_forum['allow_edit']==1 AND $post['user_id']==$_uid) or api_is_allowed_to_edit())
if (($current_forum['allow_edit']==1 AND $post['user_id']==$_user['user_id']) or api_is_allowed_to_edit())
{
echo "<a href=\"editpost.php?forum=".$_GET['forum']."&amp;thread=".$_GET['thread']."&amp;post=".$post['post_id']."\">".icon('../img/edit.gif',get_lang('Edit'))."</a>\n";
}
@ -108,7 +108,7 @@ foreach ($rows as $post)
//if (($current_forum_category['locked']==0 AND $current_forum['locked']==0 AND $current_thread['locked']==0) OR api_is_allowed_to_edit())
if ($current_forum_category['locked']==0 AND $current_forum['locked']==0 AND $current_thread['locked']==0 OR api_is_allowed_to_edit())
{
if ($_uid OR ($current_forum['allow_anonymous']==1 AND !$_uid))
if ($_user['user_id'] OR ($current_forum['allow_anonymous']==1 AND !$_user['user_id']))
{
echo '<a href="reply.php?forum='.$_GET['forum'].'&amp;thread='.$_GET['thread'].'&amp;post='.$post['post_id'].'&amp;action=replymessage">'.get_lang('ReplyToMessage').'</a><br />';
echo '<a href="reply.php?forum='.$_GET['forum'].'&amp;thread='.$_GET['thread'].'&amp;post='.$post['post_id'].'&amp;action=quote">'.get_lang('QuoteMessage').'</a><br /><br />';
@ -139,7 +139,7 @@ foreach ($rows as $post)
{
$post_image=icon('../img/forumpost.gif');
}
if ($post['post_notification']=='1' AND $post['poster_id']==$_uid)
if ($post['post_notification']=='1' AND $post['poster_id']==$_user['user_id'])
{
$post_image.=icon('../img/forumnotification.gif',get_lang('YouWillBeNotified'));
}

@ -104,7 +104,7 @@ echo display_user_link($rows[$display_post_id]['user_id'], $name).'<br />';
echo $rows[$display_post_id]['post_date'].'<br /><br />';
// The user who posted it can edit his thread only if the course admin allowed this in the properties of the forum
// The course admin him/herself can do this off course always
if (($current_forum['allow_edit']==1 AND $rows[$display_post_id]['user_id']==$_uid) or api_is_allowed_to_edit())
if (($current_forum['allow_edit']==1 AND $rows[$display_post_id]['user_id']==$_user['user_id']) or api_is_allowed_to_edit())
{
echo "<a href=\"editpost.php?forum=".$_GET['forum']."&amp;thread=".$_GET['thread']."&amp;post=".$rows[$display_post_id]['post_id']."\">".icon('../img/edit.gif',get_lang('Edit'))."</a>\n";
}
@ -119,7 +119,7 @@ echo '<br /><br />';
//if (($current_forum_category['locked']==0 AND $current_forum['locked']==0 AND $current_thread['locked']==0) OR api_is_allowed_to_edit())
if ($current_forum_category['locked']==0 AND $current_forum['locked']==0 AND $current_thread['locked']==0 OR api_is_allowed_to_edit())
{
if ($_uid OR ($current_forum['allow_anonymous']==1 AND !$_uid))
if ($_user['user_id'] OR ($current_forum['allow_anonymous']==1 AND !$_user['user_id']))
{
echo '<a href="reply.php?forum='.$_GET['forum'].'&amp;thread='.$_GET['thread'].'&amp;post='.$rows[$display_post_id]['post_id'].'&amp;action=replymessage">'.get_lang('ReplyToMessage').'</a><br />';
echo '<a href="reply.php?forum='.$_GET['forum'].'&amp;thread='.$_GET['thread'].'&amp;post='.$rows[$display_post_id]['post_id'].'&amp;action=quote">'.get_lang('QuoteMessage').'</a><br /><br />';
@ -150,7 +150,7 @@ else
{
$post_image=icon('../img/forumpost.gif');
}
if ($rows[$display_post_id]['post_notification']=='1' AND $rows[$display_post_id]['poster_id']==$_uid)
if ($rows[$display_post_id]['post_notification']=='1' AND $rows[$display_post_id]['poster_id']==$_user['user_id'])
{
$post_image.=icon('../img/forumnotification.gif',get_lang('YouWillBeNotified'));
}

@ -252,7 +252,7 @@ foreach ($group_cats as $index => $category)
{
$totalRegistered = 0;
// Determine wether current user is tutor for this course
$user_is_tutor = GroupManager :: is_tutor($_uid);
$user_is_tutor = GroupManager :: is_tutor($_user['user_id']);
$group_data = array ();
foreach ($group_list as $index => $this_group)
{
@ -268,7 +268,7 @@ foreach ($group_cats as $index => $category)
}
// group name
if (api_is_allowed_to_edit() || in_array($_uid,$tutorsids_of_group) || $this_group['is_member'] || GroupManager::user_has_access($_uid,$this_group['id'],GROUP_TOOL_FORUM) || GroupManager::user_has_access($_uid,$this_group['id'],GROUP_TOOL_DOCUMENTS))
if (api_is_allowed_to_edit() || in_array($_user['user_id'],$tutorsids_of_group) || $this_group['is_member'] || GroupManager::user_has_access($_user['user_id'],$this_group['id'],GROUP_TOOL_FORUM) || GroupManager::user_has_access($_user['user_id'],$this_group['id'],GROUP_TOOL_DOCUMENTS))
{
$group_name = '<a href="group_space.php?'.api_get_cidreq().'&amp;origin='.$origin.'&amp;gidReq='.$this_group['id'].'">'.$this_group['name'].'</a>';
if ($_SESSION['_uid'] && $_SESSION['_uid'] == $this_group['id_tutor'])
@ -288,11 +288,11 @@ foreach ($group_cats as $index => $category)
// self-registration / unregistration
if (!api_is_allowed_to_edit())
{
if (GroupManager :: is_self_registration_allowed($_uid, $this_group['id']))
if (GroupManager :: is_self_registration_allowed($_user['user_id'], $this_group['id']))
{
$row[] = '<a href="group.php?category='.$category['id'].'&amp;action=self_reg&amp;group_id='.$this_group['id'].'" onclick="javascript:if(!confirm('."'".addslashes(htmlentities(get_lang("ConfirmYourChoice")))."'".')) return false;">'.get_lang("GroupSelfRegInf").'</a>';
}
elseif (GroupManager :: is_self_unregistration_allowed($_uid, $this_group['id']))
elseif (GroupManager :: is_self_unregistration_allowed($_user['user_id'], $this_group['id']))
{
$row[] = '<a href="group.php?category='.$category['id'].'&amp;action=self_unreg&amp;group_id='.$this_group['id'].'" onclick="javascript:if(!confirm('."'".addslashes(htmlentities(get_lang("ConfirmYourChoice")))."'".')) return false;">'.get_lang("GroupSelfUnRegInf").'</a>';
}

@ -91,7 +91,7 @@ if ($_GET['selfUnReg'] && GroupManager :: is_self_unregistration_allowed($_SESSI
/*
* Edit the group
*/
if (api_is_allowed_to_edit() or GroupManager :: is_tutor($_uid))
if (api_is_allowed_to_edit() or GroupManager :: is_tutor($_user['user_id']))
{
echo "<a href=\"group_edit.php?origin=$origin\">".get_lang("EditGroup")."</a><br/><br/>";
}

@ -111,7 +111,7 @@ function event_login()
// if tracking is disabled record nothing
if (!$is_trackingEnabled)
return 0;
global $_uid;
global $_user;
global $TABLETRACK_LOGIN;
$reallyNow = time();
$sql = "INSERT INTO `".$TABLETRACK_LOGIN."`
@ -121,7 +121,7 @@ function event_login()
`login_date`)
VALUES
('".$_uid."',
('".$_user['user_id']."',
'".$_SERVER['REMOTE_ADDR']."',
FROM_UNIXTIME(".$reallyNow."))";
$res = api_sql_query($sql,__FILE__,__LINE__);
@ -140,7 +140,7 @@ function event_access_course()
// if tracking is disabled record nothing
if (!$is_trackingEnabled)
return 0;
global $_uid;
global $_user;
global $_cid;
global $TABLETRACK_ACCESS;
global $TABLETRACK_LASTACCESS; //for "what's new" notification
@ -155,9 +155,9 @@ function event_access_course()
}
$reallyNow = time();
if ($_uid)
if ($_user['user_id'])
{
$user_id = "'".$_uid."'";
$user_id = "'".$_user['user_id']."'";
}
else // anonymous
{
@ -211,7 +211,7 @@ function event_access_tool($tool, $id_session=0)
global $is_trackingEnabled;
// if tracking is disabled record nothing
// if( ! $is_trackingEnabled ) return 0; //commented because "what's new" notification must always occur
global $_uid;
global $_user;
global $_cid;
global $TABLETRACK_ACCESS;
global $rootWeb;
@ -228,7 +228,7 @@ function event_access_tool($tool, $id_session=0)
}
$reallyNow = time();
$user_id = $_uid ? "'".$_uid."'" : "NULL"; // "NULL" is anonymous
$user_id = $_user['user_id'] ? "'".$_user['user_id']."'" : "NULL"; // "NULL" is anonymous
// record information
// only if user comes from the course $_cid
//if( eregi($rootWeb.$_cid,$_SERVER['HTTP_REFERER'] ) )
@ -288,13 +288,13 @@ function event_download($doc_url)
// if tracking is disabled record nothing
if (!$is_trackingEnabled)
return 0;
global $_uid;
global $_user;
global $_cid;
global $TABLETRACK_DOWNLOADS;
$reallyNow = time();
if ($_uid)
if ($_user['user_id'])
{
$user_id = "'".$_uid."'";
$user_id = "'".$_user['user_id']."'";
}
else // anonymous
{
@ -333,13 +333,13 @@ function event_upload($doc_id)
// if tracking is disabled record nothing
if (!$is_trackingEnabled)
return 0;
global $_uid;
global $_user;
global $_cid;
global $TABLETRACK_UPLOADS;
$reallyNow = time();
if ($_uid)
if ($_user['user_id'])
{
$user_id = "'".$_uid."'";
$user_id = "'".$_user['user_id']."'";
}
else // anonymous
{
@ -377,13 +377,13 @@ function event_link($link_id)
// if tracking is disabled record nothing
if (!$is_trackingEnabled)
return 0;
global $_uid;
global $_user;
global $_cid;
global $TABLETRACK_LINKS;
$reallyNow = time();
if ($_uid)
if ($_user['user_id'])
{
$user_id = "'".$_uid."'";
$user_id = "'".$_user['user_id']."'";
}
else // anonymous
{
@ -422,14 +422,14 @@ function event_exercice($exo_id, $score, $weighting)
// if tracking is disabled record nothing
if (!$is_trackingEnabled)
return 0;
global $_uid;
global $_user;
global $_cid;
global $TABLETRACK_EXERCICES;
global $origin, $learnpath_id, $learnpath_item_id;
$reallyNow = time();
if ($_uid)
if ($_user['user_id'])
{
$user_id = "'".$_uid."'";
$user_id = "'".$_user['user_id']."'";
}
else // anonymous
{
@ -482,14 +482,14 @@ function event_subscription($cours_id, $action)
// if tracking is disabled record nothing
if (!$is_trackingEnabled)
return 0;
global $_uid;
global $_user;
global $TABLETRACK_SUBSCRIPTIONS;
$sql = "INSERT INTO `$TABLETRACK_SUBSCRIPTIONS`
(`sub_user_id`,
`sub_cours_id`,
`sub_action`)
VALUES
('".$_uid."',
('".$_user['user_id']."',
'".$cours_id."',
'".$action."')";
$res = api_sql_query($sql,__FILE__,__LINE__);
@ -511,19 +511,19 @@ function event_default($type_event, $values)
// if tracking is disabled record nothing
if (!$is_trackingEnabled)
return 0;
global $_uid;
global $_user;
global $_cid;
global $TABLETRACK_DEFAULT;
$reallyNow = time();
if ($_uid)
if ($_user['user_id'])
{
$user_id = "'".$_uid."'";
$user_id = "'".$_user['user_id']."'";
}
else // anonymous
{
$user_id = "NULL";
}
if ($_uid)
if ($_user['user_id'])
{
$cours_id = "'".$_cid."'";
}
@ -555,14 +555,14 @@ function exercise_attempt($score,$answer,$quesId,$exeId,$j)
// if tracking is disabled record nothing
if (!$is_trackingEnabled)
return 0;
global $_uid;
global $_user;
global $_cid;
global $TABLETRACK_ATTEMPT;
global $origin, $learnpath_id, $learnpath_item_id;
$reallyNow = time();
if ($_uid)
if ($_user['user_id'])
{
$user_id = "'".$_uid."'";
$user_id = "'".$_user['user_id']."'";
}
else // anonymous
{

@ -23,7 +23,7 @@ if(isset($_SESSION['_gid']) && $_SESSION['_gid']!='') //if the group id is set,
$group_properties = GroupManager::get_group_properties($_SESSION['_gid']);
$noPHP_SELF=true;
if($is_allowed_to_edit || GroupManager::is_user_in_group($_uid,$_SESSION['_gid'])) //only courseadmin or group members allowed
if($is_allowed_to_edit || GroupManager::is_user_in_group($_user['user_id'],$_SESSION['_gid'])) //only courseadmin or group members allowed
{
$to_group_id = $_SESSION['_gid'];
$req_gid = '&amp;gidReq='.$_SESSION['_gid'];
@ -72,7 +72,7 @@ if($_POST['fileupload']=="Attach File"){
if($upload_ok)
{
//file got on the server without problems, now process it
$new_path = handle_uploaded_document($_course, $_FILES['uploadedfile'],$base_work_dir,$path,$_uid,$to_group_id,$to_user_id,$max_filled_space,0,'overwrite');
$new_path = handle_uploaded_document($_course, $_FILES['uploadedfile'],$base_work_dir,$path,$_user['user_id'],$to_group_id,$to_user_id,$max_filled_space,0,'overwrite');
$new_comment = isset($_POST['comment']) ? trim($_POST['comment']) : '';
$new_title = isset($_POST['title']) ? trim($_POST['title']) : '';

@ -889,7 +889,7 @@ function unzip_uploaded_file($uploadedFile, $uploadPath, $baseWorkDir, $maxFille
function unzip_uploaded_document($uploaded_file, $upload_path, $base_work_dir, $max_filled_space, $output = true)
{
global $_course;
global $_uid;
global $_user;
global $to_user_id;
global $to_group_id;
@ -966,7 +966,7 @@ function unzip_uploaded_document($uploaded_file, $upload_path, $base_work_dir, $
$folder_id = add_document($_course,$upload_path.dirname($cleaned_up_filename),'folder',0,basename(dirname($cleaned_up_filename)));
if($folder_id)
{
api_item_property_update($_course,TOOL_DOCUMENT,$folder_id,'FolderAdded',$_uid,$to_group_id,$to_user_id);
api_item_property_update($_course,TOOL_DOCUMENT,$folder_id,'FolderAdded',$_user['user_id'],$to_group_id,$to_user_id);
//echo('folder '.$upload_path.dirname($cleaned_up_filename)." added<br>\n");
}
}
@ -988,7 +988,7 @@ function unzip_uploaded_document($uploaded_file, $upload_path, $base_work_dir, $
{
$lastedit_type = ($filetype=='folder')?'FolderAdded':'DocumentAdded';
//update item property for document
api_item_property_update($_course,TOOL_DOCUMENT,$document_id,$lastedit_type,$_uid,$to_group_id,$to_user_id);
api_item_property_update($_course,TOOL_DOCUMENT,$document_id,$lastedit_type,$_user['user_id'],$to_group_id,$to_user_id);
}
}
//file/dir exists -> update
@ -996,14 +996,14 @@ function unzip_uploaded_document($uploaded_file, $upload_path, $base_work_dir, $
{
$lastedit_type = ($filetype=='folder')?'FolderUpdated':'DocumentUpdated';
//update the document in item_property
api_item_property_update($_course,TOOL_DOCUMENT,$document_id,$lastedit_type,$_uid,$to_group_id,$to_user_id);
api_item_property_update($_course,TOOL_DOCUMENT,$document_id,$lastedit_type,$_user['user_id'],$to_group_id,$to_user_id);
}
}
}
//print_r_pre($zip_content_array);
//if the file is in a folder, we need to update all parent folders
item_property_update_on_folder($_course,$upload_path,$_uid);
item_property_update_on_folder($_course,$upload_path,$_user['user_id']);
//display success message to user
chdir($save_dir); //return to previous dir position
if($output){
@ -1757,7 +1757,7 @@ function build_missing_files_form($missing_files,$upload_path,$file_name)
* @param string $base_work_dir
* @param string $current_path, needed for recursivity
*/
function add_all_documents_in_folder_to_database($_course,$_uid,$base_work_dir,$current_path='')
function add_all_documents_in_folder_to_database($_course,$user_id,$base_work_dir,$current_path='')
{
$path = $base_work_dir.$current_path;
@ -1779,12 +1779,12 @@ $handle=opendir($path);
if(!DocumentManager::get_document_id($_course, $current_path.'/'.$safe_file))
{
$document_id=add_document($_course,$current_path.'/'.$safe_file,'folder',0,$title);
api_item_property_update($_course,TOOL_DOCUMENT,$document_id,'DocumentAdded',$_uid);
api_item_property_update($_course,TOOL_DOCUMENT,$document_id,'DocumentAdded',$user_id);
//echo $current_path.'/'.$safe_file." added!<br/>";
}
//recursive
add_all_documents_in_folder_to_database($_course,$_uid,$base_work_dir,$current_path.'/'.$safe_file);
add_all_documents_in_folder_to_database($_course,$user_id,$base_work_dir,$current_path.'/'.$safe_file);
}
//file!
else
@ -1797,7 +1797,7 @@ $handle=opendir($path);
$title=get_document_title($file);
$size = filesize($base_work_dir.$current_path.'/'.$safe_file);
$document_id = add_document($_course,$current_path.'/'.$safe_file,'file',$size,$title);
api_item_property_update($_course,TOOL_DOCUMENT,$document_id,'DocumentAdded',$_uid);
api_item_property_update($_course,TOOL_DOCUMENT,$document_id,'DocumentAdded',$user_id);
//echo $current_path.'/'.$safe_file." added!<br/>";
}
}

@ -93,7 +93,7 @@ class GroupManager
*/
function get_group_list($category = null, $course_code = null)
{
global $_uid;
global $_user;
$course_db = '';
if ($course_code != null)
{
@ -116,7 +116,7 @@ class GroupManager
COUNT(ug2.id) number_of_members
FROM ".$table_group." `g`
LEFT JOIN ".$table_group_user." `ug`
ON `ug`.`group_id` = `g`.`id` AND `ug`.`user_id` = '".$_uid."'
ON `ug`.`group_id` = `g`.`id` AND `ug`.`user_id` = '".$_user['user_id']."'
LEFT JOIN ".$table_group_user." `ug2`
ON `ug2`.`group_id` = `g`.`id`";
if ($category != null)
@ -144,7 +144,7 @@ class GroupManager
*/
function create_group($name, $category_id, $tutor, $places)
{
global $_course,$_uid;
global $_course,$_user;
$currentCourseRepository = $_course['path'];
$coursesRepositorySys = api_get_path(SYS_COURSE_PATH);
$table_group = Database :: get_course_table(GROUP_TABLE);
@ -165,7 +165,7 @@ class GroupManager
FileManager :: mkdirs($coursesRepositorySys.$currentCourseRepository."/group/".$secret_directory, 0777);
*/
$desired_dir_name= '/'.replace_dangerous_char($name,'strict').'_groupdocs';
$dir_name = create_unexisting_directory($_course,$_uid,$lastId,NULL,$coursesRepositorySys.$currentCourseRepository.'/document',$desired_dir_name);
$dir_name = create_unexisting_directory($_course,$_user['user_id'],$lastId,NULL,$coursesRepositorySys.$currentCourseRepository.'/document',$desired_dir_name);
/* Stores the directory path into the group table */
$sql = "UPDATE ".$table_group." SET name = '".mysql_real_escape_string($name)."', secret_directory = '".$dir_name."' WHERE id ='".$lastId."'";
api_sql_query($sql,__FILE__,__LINE__);
@ -821,7 +821,7 @@ class GroupManager
global $_course;
$course_code = $_course['sysCode'];
$category = GroupManager :: get_category_from_group($group_id);
$result = CourseManager :: is_user_subscribed_in_real_or_linked_course($_uid, $course_code);
$result = CourseManager :: is_user_subscribed_in_real_or_linked_course($user_id, $course_code);
$result = !GroupManager :: is_subscribed($user_id, $group_id);
$result &= (GroupManager :: number_of_students($group_id) < GroupManager :: maximum_number_of_students($group_id));
if ($category['groups_per_user'] == GROUP_PER_MEMBER_NO_LIMIT)
@ -1141,14 +1141,14 @@ class GroupManager
*/
function get_complete_list_of_users_that_can_be_added_to_group($course_code, $group_id)
{
global $_course, $_uid;
global $_course, $_user;
$category = GroupManager :: get_category_from_group($group_id, $course_code);
$number_of_groups_limit = $category['groups_per_user'] == GROUP_PER_MEMBER_NO_LIMIT ? INFINITE : $category['groups_per_user'];
$real_course_code = $_course['sysCode'];
$real_course_info = Database :: get_course_info($real_course_code);
$real_course_user_list = CourseManager :: get_user_list_from_course_code($virtual_course_code);
//get list of all virtual courses
$user_subscribed_course_list = CourseManager :: get_list_of_virtual_courses_for_specific_user_and_real_course($_uid, $real_course_code);
$user_subscribed_course_list = CourseManager :: get_list_of_virtual_courses_for_specific_user_and_real_course($_user['user_id'], $real_course_code);
//add real course to the list
$user_subscribed_course_list[] = $real_course_info;
if (!is_array($user_subscribed_course_list))

@ -9,7 +9,7 @@
* If the user is not logged in, don't define anything, so the normal
* handling of mailto link can proceed
*/
if(!empty($_uid) AND string_2_boolean(api_get_setting('allow_email_editor'))){
if(!empty($_user['user_id']) AND string_2_boolean(api_get_setting('allow_email_editor'))){
?>
<script language="javascript" version="1.3" type="text/javascript">
/**

@ -180,14 +180,14 @@ function ClearURL($path)
function chatcall() {
global $_uid, $_cid;
global $_user, $_cid;
if (!$_uid)
if (!$_user['user_id'])
{
return (false);
}
$track_user_table = Database::get_main_table(MAIN_USER_TABLE);
$sql="select chatcall_user_id, chatcall_date from $track_user_table where ( user_id = $_uid )";
$sql="select chatcall_user_id, chatcall_date from $track_user_table where ( user_id = '".$_user['user_id']."' )";
$result=api_sql_query($sql,__FILE__,__LINE__);
$row=mysql_fetch_array($result);

@ -51,8 +51,8 @@ class SurveyManager
* @return int new user id - if the new user creation succeeds
* boolean false otherwise
*
* @desc The function tries to retrieve $tbl_user and $_uid from the global space.
* if it exists, $_uid is the creator id
* @desc The function tries to retrieve $tbl_user and $_user['user_id'] from the global space.
* if it exists, $_user['user_id'] is the creator id
* If a problem arises, it stores the error message in global $api_failureList
* @todo rework to use Database API

@ -116,7 +116,7 @@ class SystemAnnouncementManager
return;
}
function display_all_announcements($visible, $id = -1,$start = 0,$_uid)
function display_all_announcements($visible, $id = -1,$start = 0,$user_id)
{
$user_selected_language = $_SESSION["user_language_choice"] ? $_SESSION["user_language_choice"] : get_setting('platformLanguage');
@ -159,7 +159,7 @@ class SystemAnnouncementManager
echo '<table align="center">';
echo '<tr>';
echo '<td>';
SystemAnnouncementManager :: display_fleche($_uid);
SystemAnnouncementManager :: display_fleche($user_id);
echo '</td>';
echo '</tr>';
echo '</table>';
@ -185,7 +185,7 @@ class SystemAnnouncementManager
echo '<table align="center">';
echo '<tr>';
echo '<td>';
SystemAnnouncementManager :: display_fleche($_uid);
SystemAnnouncementManager :: display_fleche($user_id);
echo '</td>';
echo '</tr>';
echo '</table>';
@ -194,10 +194,10 @@ class SystemAnnouncementManager
return;
}
function display_fleche($_uid)
function display_fleche($user_id)
{
$start = (int)$_GET['start'];
$nb_announcement = SystemAnnouncementManager :: count_nb_announcement($start,$_uid);
$nb_announcement = SystemAnnouncementManager :: count_nb_announcement($start,$user_id);
$next = ((int)$_GET['start']+19);
$prev = ((int)$_GET['start']-19);
@ -223,7 +223,7 @@ class SystemAnnouncementManager
}
function count_nb_announcement($start = 0,$_uid = '')
function count_nb_announcement($start = 0,$user_id = '')
{
$visibility = api_is_allowed_to_create_course() ? VISIBLE_TEACHER : VISIBLE_STUDENT;
$user_selected_language = $_SESSION["user_language_choice"] ? $_SESSION["user_language_choice"] : get_setting('platformLanguage');
@ -231,7 +231,7 @@ class SystemAnnouncementManager
$sql = 'SELECT id
FROM '.$db_table.'
WHERE lang="'.$user_selected_language.'"';
if (isset($_uid))
if (isset($user_id))
{
switch ($visibility)
{

@ -51,20 +51,24 @@ class UserManager
* @return int new user id - if the new user creation succeeds
* boolean false otherwise
*
* @desc The function tries to retrieve $_uid from the global space.
* if it exists, $_uid is the creator id If a problem arises,
* @desc The function tries to retrieve $_user['user_id'] from the global space.
* if it exists, $_user['user_id'] is the creator id If a problem arises,
* it stores the error message in global $api_failureList
*
* @todo Add the user language to the parameters
*/
function create_user($firstName, $lastName, $status, $email, $loginName, $password, $official_code = '', $language="english", $phone = '', $picture_uri = '', $auth_source = PLATFORM_AUTH_SOURCE, $expiration_date = '0000-00-00 00:00:00', $active = 1)
{
global $_uid, $userPasswordCrypted;
global $_user, $userPasswordCrypted;
$table_user = Database::get_main_table(MAIN_USER_TABLE);
if ($_uid)
$creator_id = $_uid;
if ($_user['user_id'])
{
$creator_id = $_user['user_id'];
}
else
{
$creator_id = '';
}
// First check wether the login already exists
if (! UserManager::is_username_available($loginName))
return api_set_failure('login-pass already taken');

@ -981,12 +981,13 @@ else
/**
* This function stores the forum category in the database. The new category is added to the end.
* @author Patrick Cool <patrick.cool@UGent.be>, Ghent University
* @todo is this the same function as in forumfunction.inc.php? If this is the case then it should not appear here.
*/
function store_forumcategory($values)
{
global $table_categories;
global $_course;
global $_uid;
global $_user;
// find the max cat_order. The new forum category is added at the end => max cat_order + &
$sql="SELECT MAX(cat_order) as sort_max FROM ".mysql_real_escape_string($table_categories);
@ -997,19 +998,20 @@ function store_forumcategory($values)
$sql="INSERT INTO ".$table_categories." (cat_title, cat_comment, cat_order) VALUES ('".mysql_real_escape_string($values['forum_category_title'])."','".mysql_real_escape_string($values['forum_category_comment'])."','".mysql_real_escape_string($new_max)."')";
api_sql_query($sql);
$last_id=mysql_insert_id();
api_item_property_update($_course, TOOL_FORUM_CATEGORY, $last_id,"ForumCategoryAdded", $_uid);
api_item_property_update($_course, TOOL_FORUM_CATEGORY, $last_id,"ForumCategoryAdded", $_user['user_id']);
return array('id'=>$last_id,'title'=>$values['forum_category_title']) ;
}
/**
* This function stores the forum in the database. The new forum is added to the end.
* @author Patrick Cool <patrick.cool@UGent.be>, Ghent University
* @todo is this the same function as in forumfunction.inc.php? If this is the case then it should not appear here.
*/
function store_forum($values)
{
global $table_forums;
global $_course;
global $_uid;
global $_user;
// find the max forum_order for the given category. The new forum is added at the end => max cat_order + &
$sql="SELECT MAX(forum_order) as sort_max FROM ".$table_forums." WHERE forum_category=".mysql_real_escape_string($values['forum_category']);
@ -1034,7 +1036,7 @@ function store_forum($values)
'".mysql_real_escape_string($new_max)."')";
api_sql_query($sql, __LINE__,__FILE__);
$last_id=mysql_insert_id();
api_item_property_update($_course, TOOL_FORUM, $last_id,"ForumCategoryAdded", $_uid);
api_item_property_update($_course, TOOL_FORUM, $last_id,"ForumCategoryAdded", $_user['user_id']);
return array('id'=>$last_id, 'title'=>$values['forum_title']);
}
@ -1042,12 +1044,13 @@ function store_forum($values)
* This function stores a new thread. This is done through an entry in the forum_thread table AND
* in the forum_post table because. The threads are also stored in the item_property table. (forum posts are not (yet))
* @author Patrick Cool <patrick.cool@UGent.be>, Ghent University
* @todo is this the same function as in forumfunction.inc.php? If this is the case then it should not appear here.
*/
function store_thread($values)
{
global $table_threads;
global $table_posts;
global $_uid;
global $_user;
global $_course;
global $current_forum;
@ -1062,14 +1065,14 @@ function store_thread($values)
'".mysql_real_escape_string($values['thread_sticky'])."')";
$result=api_sql_query($sql, __LINE__, __FILE__);
$last_thread_id=mysql_insert_id();
api_item_property_update($_course, TOOL_FORUM_THREAD, $last_thread_id,"ForumThreadAdded", $_uid);
api_item_property_update($_course, TOOL_FORUM_THREAD, $last_thread_id,"ForumThreadAdded", $_user['user_id']);
// if the forum properties tell that the posts have to be approved we have to put the whole thread invisible
// because otherwise the students will see the thread and not the post in the thread.
// we also have to change $visible because the post itself has to be visible in this case (otherwise the teacher would have
// to make the thread visible AND the post
if ($values['visible']==0)
{
api_item_property_update($_course, TOOL_FORUM_THREAD, $last_thread_id,"invisible", $_uid);
api_item_property_update($_course, TOOL_FORUM_THREAD, $last_thread_id,"invisible", $_user['user_id']);
$visible=1;
}
@ -1081,6 +1084,7 @@ function store_thread($values)
* @param $phpbb_forum_id the forum_id of the old (phpbb) forum
* @param $new_forum_id the forum_id in the new forum
* @author Patrick Cool <patrick.cool@UGent.be>, Ghent University
* @todo is this the same function as in forumfunction.inc.php? If this is the case then it should not appear here.
*/
function migrate_threads_of_forum($phpbb_forum_id, $new_forum_id)
{
@ -1130,6 +1134,7 @@ function migrate_threads_of_forum($phpbb_forum_id, $new_forum_id)
* @param $phpbb_forum_id the forum_id of the old (phpbb) forum
* @param $new_forum_id the forum_id in the new forum
* @author Patrick Cool <patrick.cool@UGent.be>, Ghent University
* @todo is this the same function as in forumfunction.inc.php? If this is the case then it should not appear here.
*/
function migrate_posts_of_thread($phpbb_thread_id, $new_forum_thread_id, $new_forum_id)
{
@ -1207,6 +1212,7 @@ function migrate_posts_of_thread($phpbb_thread_id, $new_forum_thread_id, $new_fo
/**
* This function gets all the added resources for phpbb forum posts
* @author Patrick Cool <patrick.cool@UGent.be>, Ghent University
* @todo is this the same function as in forumfunction.inc.php? If this is the case then it should not appear here.
*/
function get_added_resources()
{
@ -1226,6 +1232,7 @@ function get_added_resources()
/**
* This function gets the forum category information based on the name
* @author Patrick Cool <patrick.cool@UGent.be>, Ghent University
* @todo is this the same function as in forumfunction.inc.php? If this is the case then it should not appear here.
*/
function get_forumcategory_id_by_name($forum_category_name)
{

Loading…
Cancel
Save