Kaynağa Gözat

Feature #5397 - Replacing mysql_fetch_array() with Database::fetch_array(). Installation scripts and some other files are skipped in this transaction.

Ivan Tcholakov 15 yıl önce
ebeveyn
işleme
ada9c84124
53 değiştirilmiş dosya ile 321 ekleme ve 324 silme
  1. 1 1
      main/admin/course_virtual.php
  2. 1 1
      main/admin/session_category_edit.php
  3. 1 1
      main/admin/session_edit.php
  4. 4 4
      main/admin/settings.php
  5. 1 1
      main/chat/chat_hidden.php
  6. 2 2
      main/course_home/2column.php
  7. 2 2
      main/course_home/3column.php
  8. 2 2
      main/course_home/btf_functions.php
  9. 2 2
      main/course_info/infocours.php
  10. 1 1
      main/course_info/postpone.php
  11. 3 3
      main/dropbox/dropbox_class.inc.php
  12. 1 1
      main/dropbox/dropbox_download.php
  13. 2 2
      main/dropbox/dropbox_submit.php
  14. 1 1
      main/exercice/hotpotatoes.lib.php
  15. 1 1
      main/exercice/hotspot_answers.as.php
  16. 1 1
      main/exercice/mark_free_answer.php
  17. 1 1
      main/inc/global.inc.php
  18. 1 1
      main/inc/introductionSection.inc.php
  19. 4 4
      main/inc/lib/classmanager.lib.php
  20. 2 2
      main/inc/lib/fileManage.lib.php
  21. 1 1
      main/inc/lib/fileUpload.lib.php
  22. 10 10
      main/inc/lib/surveymanager.lib.php
  23. 2 2
      main/inc/tool_navigation_menu.inc.php
  24. 1 1
      main/metadata/importdocs.php
  25. 6 6
      main/metadata/importlinks.php
  26. 3 3
      main/metadata/importmanifest.php
  27. 1 1
      main/metadata/index.php
  28. 2 2
      main/metadata/md_document.php
  29. 1 1
      main/metadata/md_funcs.php
  30. 2 2
      main/metadata/md_link.php
  31. 2 2
      main/metadata/md_phpdig.php
  32. 1 1
      main/metadata/md_scorm.php
  33. 1 1
      main/metadata/search.php
  34. 1 1
      main/metadata/statistics.php
  35. 1 1
      main/metadata/update_indexabletext.php
  36. 1 1
      main/newscorm/aicc.class.php
  37. 5 5
      main/newscorm/document.php
  38. 41 41
      main/newscorm/learnpath_functions.inc.php
  39. 54 54
      main/newscorm/resourcelinker.inc.php
  40. 21 21
      main/newscorm/resourcelinker.php
  41. 1 1
      main/newscorm/scorm.class.php
  42. 1 1
      main/newscorm/scorm.lib.php
  43. 4 4
      main/newscorm/scorm_admin.php
  44. 1 1
      main/online/online_links.php
  45. 1 1
      main/online/online_master.php
  46. 6 6
      main/permissions/permissions_functions.inc.php
  47. 54 54
      main/resourcelinker/resourcelinker.inc.php
  48. 20 20
      main/resourcelinker/resourcelinker.php
  49. 1 1
      main/tracking/logins_details.php
  50. 1 1
      main/user/user_add.php
  51. 39 39
      main/work/work.php
  52. 0 3
      tests/main/inc/lib/main_api.lib.test.php
  53. 1 1
      tests/main/inc/lib/stats.lib.inc.test.php

+ 1 - 1
main/admin/course_virtual.php

@@ -227,7 +227,7 @@ function display_create_virtual_course_form()
 									ORDER BY tree_pos";
 			$category_result = Database::query($sql_query, __FILE__, __LINE__);
 
-			while ($current_category = mysql_fetch_array($category_result))
+			while ($current_category = Database::fetch_array($category_result))
 			{
 				echo "<option value=\"", $current_category["code"], "\"";
 				echo ">(", $current_category["code"], ") ", $current_category["name"];

+ 1 - 1
main/admin/session_category_edit.php

@@ -38,7 +38,7 @@ $interbreadcrumb[]=array('url' => 'index.php',"name" => get_lang('PlatformAdmin'
 $interbreadcrumb[]=array('url' => "session_category_list.php","name" => get_lang('ListSessionCategory'));
 $sql = "SELECT * FROM $tbl_session_category WHERE id='".$id."' ORDER BY name";
 $result=Database::query($sql,__FILE__,__LINE__);
-if (!$infos=mysql_fetch_array($result)) {
+if (!$infos=Database::fetch_array($result)) {
 	header('Location: session_list.php');
 	exit();
 }

+ 1 - 1
main/admin/session_edit.php

@@ -29,7 +29,7 @@ $interbreadcrumb[]=array('url' => "session_list.php","name" => get_lang('Session
 
 $result=Database::query("SELECT name,date_start,date_end,id_coach, session_admin_id, nb_days_access_before_beginning, nb_days_access_after_end, session_category_id, visibility FROM $tbl_session WHERE id='$id'",__FILE__,__LINE__);
 
-if (!$infos=mysql_fetch_array($result)) {
+if (!$infos=Database::fetch_array($result)) {
 	header('Location: session_list.php');
 	exit();
 }

+ 4 - 4
main/admin/settings.php

@@ -90,7 +90,7 @@ if (!empty($_GET['category']) && !in_array($_GET['category'], array('Plugins', '
 
 	$sqlcountsettings = "SELECT COUNT(*) FROM $table_settings_current WHERE category='".$my_category."' AND type<>'checkbox'";
 	$resultcountsettings = Database::query($sqlcountsettings, __FILE__, __LINE__);
-	$countsetting = mysql_fetch_array($resultcountsettings);
+	$countsetting = Database::fetch_array($resultcountsettings);
 
 	if ($_configuration['access_url']==1)
 	{
@@ -128,7 +128,7 @@ if (!empty($_GET['category']) && !in_array($_GET['category'], array('Plugins', '
 	//print_r($settings_by_access_list);echo '</pre>';
 	//$sqlsettings = "SELECT DISTINCT * FROM $table_settings_current WHERE category='$my_category' GROUP BY variable ORDER BY id ASC";
 	//$resultsettings = Database::query($sqlsettings, __FILE__, __LINE__);
-	//while ($row = mysql_fetch_array($resultsettings))
+	//while ($row = Database::fetch_array($resultsettings))
 	$default_values = array();
 	foreach($settings as $row) {
 		if ($row['variable'] == 'search_enabled') { continue; }
@@ -381,7 +381,7 @@ $action_images['search']        = 'search.gif';
 //$resultcategories = Database::query($selectcategories, __FILE__, __LINE__);
 $resultcategories = api_get_settings_categories(array('stylesheets','Plugins', 'Templates', 'Search'));
 echo "\n<div class=\"actions\">";
-//while ($row = mysql_fetch_array($resultcategories))
+//while ($row = Database::fetch_array($resultcategories))
 foreach($resultcategories as $row)
 {
 	echo "\n\t<a href=\"".api_get_self()."?category=".$row['category']."\">".Display::return_icon($action_images[strtolower($row['category'])], api_ucfirst(get_lang($row['category']))).api_ucfirst(get_lang($row['category']))."</a>";
@@ -530,7 +530,7 @@ function handle_plugins()
 	//$sql = "SELECT * FROM $table_settings_current WHERE category='Plugins'";
 	//$result = Database::query($sql);
 	$result = api_get_settings('Plugins');
-	//while ($row = mysql_fetch_array($result))
+	//while ($row = Database::fetch_array($result))
 	foreach($result as $row)
 	{
 		$usedplugins[$row['variable']][] = $row['selected_value'];

+ 1 - 1
main/chat/chat_hidden.php

@@ -114,7 +114,7 @@ if ($_SESSION["origin"] == 'whoisonline') {  //check if our target has denied ou
 	$track_user_table = Database::get_main_table(TABLE_MAIN_USER);
 	$sql="select chatcall_text from $track_user_table where ( user_id = $talk_to )";
 	$result=Database::query($sql,__FILE__,__LINE__);
-	$row=mysql_fetch_array($result);
+	$row=Database::fetch_array($result);
 	if ($row['chatcall_text'] == 'DENIED') {
 		echo "<script language=javascript> alert('".get_lang('ChatDenied')."'); </script>";
 		$sql="update $track_user_table set chatcall_user_id = '', chatcall_date = '', chatcall_text='' where (user_id = $talk_to)";

+ 2 - 2
main/course_home/2column.php

@@ -85,7 +85,7 @@ function show_tools($course_tool_category)
 	$i=0;
 
 	// grabbing all the tools from $course_tool_table
-	while ($temp_row = mysql_fetch_array($result))
+	while ($temp_row = Database::fetch_array($result))
 	{
 		if($course_tool_category == TOOL_PUBLIC_BUT_HIDDEN && $temp_row['image'] != 'scormbuilder.gif')
 		{
@@ -119,7 +119,7 @@ function show_tools($course_tool_category)
 	{
 		$properties = array();
 		$result_links=Database::query($sql_links,__FILE__,__LINE__);
-		while ($links_row=mysql_fetch_array($result_links))
+		while ($links_row=Database::fetch_array($result_links))
 		{
 			unset($properties);
 			$properties['name']=$links_row['title'];

+ 2 - 2
main/course_home/3column.php

@@ -89,7 +89,7 @@ if (is_allowed_to_edit())
 	{
 		$sql = "SELECT * FROM $TBL_ACCUEIL WHERE id=$id";
 		$result = Database::query($sql,__FILE__,__LINE__);
-		$toolsRow = mysql_fetch_array($result);
+		$toolsRow = Database::fetch_array($result);
 		$tool_name = htmlspecialchars($toolsRow['name'] != "" ? $toolsRow['name'] : $toolsRow['link'],ENT_QUOTES,$charset);
 		if($toolsRow['img'] != "external.gif")
 		{
@@ -154,7 +154,7 @@ if (is_allowed_to_edit())
 	elseif (isset ($update) && $update)
 	{
 		$result 	= Database::query("SELECT * FROM $TBL_ACCUEIL WHERE id=$id");
-		$toolsRow 	= mysql_fetch_array($result);
+		$toolsRow 	= Database::fetch_array($result);
 		$racine		= $_configuration['root_sys']."/".$currentCourseID."/images/";
 		$chemin		= $racine;
 		$name	= $toolsRow[1];

+ 2 - 2
main/course_home/btf_functions.php

@@ -84,7 +84,7 @@ function showtools2($cat)
 	$result = Database::query($sql, __FILE__, __LINE__);
 
 	// grabbing all the tools from $course_tool_table
-	while ($tempRow = mysql_fetch_array($result))
+	while ($tempRow = Database::fetch_array($result))
 	{
 		/*
 		if ($tempRow['img'] !== "scormbuilder.gif" AND $tempRow['img'] !== "blog.gif")
@@ -118,7 +118,7 @@ function showtools2($cat)
 								WHERE tl.on_homepage='1' AND tip.visibility = 1";
 		}
 		$result_links = Database::query($sql_links);
-		while ($links_row = mysql_fetch_array($result_links))
+		while ($links_row = Database::fetch_array($result_links))
 		{
 			$properties = array ();
 			$properties['name'] = $links_row['title'];

+ 2 - 2
main/course_info/infocours.php

@@ -123,7 +123,7 @@ if(mysql_num_rows($q_result_titulars)==0){
 }
 
 $a_profs[0] = '-- '.get_lang('NoManager').' --';
-while ($a_titulars = mysql_fetch_array($q_result_titulars)) {
+while ($a_titulars = Database::fetch_array($q_result_titulars)) {
 	$s_username = $a_titulars['username'];
 	$s_lastname = $a_titulars['lastname'];
 	$s_firstname = $a_titulars['firstname'];
@@ -138,7 +138,7 @@ while ($a_titulars = mysql_fetch_array($q_result_titulars)) {
 	$a_profs[api_get_person_name($s_firstname, $s_lastname)] = api_get_person_name($s_lastname, $s_firstname).' ('.$s_username.')';
 }
 
-while ($cat = mysql_fetch_array($res))
+while ($cat = Database::fetch_array($res))
 {
 	$categories[$cat['code']] = '('.$cat['code'].') '.$cat['name'];
 	ksort($categories);

+ 1 - 1
main/course_info/postpone.php

@@ -77,7 +77,7 @@ $currentCourseRepository 	= $_course["path"];
 
 $sqlCourseExtention 			= "SELECT last_visit, last_edit, creation_date, expiration_date FROM ".$TABLECOURSE." WHERE code = '".$_cid."'";
 $resultCourseExtention 			= Database::query($sqlCourseExtention,__FILE__,__LINE__);
-$currentCourseExtentionData 	= mysql_fetch_array($resultCourseExtention);
+$currentCourseExtentionData 	= Database::fetch_array($resultCourseExtention);
 $currentCourseLastVisit 		= $currentCourseExtentionData["last_visit"];
 $currentCourseLastEdit			= $currentCourseExtentionData["last_edit"];
 $currentCourseCreationDate 		= $currentCourseExtentionData["creation_date"];

+ 3 - 3
main/dropbox/dropbox_class.inc.php

@@ -114,7 +114,7 @@ class Dropbox_Work {
 				FROM ".dropbox_cnf("tbl_file")."
 				WHERE filename = '".addslashes($this->filename)."'";
         $result = Database::query($sql,__FILE__,__LINE__);
-		$res = mysql_fetch_array($result);
+		$res = Database::fetch_array($result);
 		if ($res != FALSE) {
 			$this->isOldWork = TRUE;
 		}
@@ -174,7 +174,7 @@ class Dropbox_Work {
 				FROM ".dropbox_cnf("tbl_file")."
 				WHERE id='".addslashes($id)."'";
         $result = Database::query($sql,__FILE__,__LINE__);
-		$res = mysql_fetch_array($result,MYSQL_ASSOC);
+		$res = Database::fetch_array($result, 'ASSOC');
 
 		// Check if uploader is still in Dokeos system
 		$uploader_id = stripslashes($res["uploader_id"]);
@@ -215,7 +215,7 @@ class Dropbox_Work {
 		$result = Database::query("SELECT feedback_date, feedback, cat_id FROM ".
 		    dropbox_cnf("tbl_post")." WHERE dest_user_id='".$_user['user_id'].
 		    "' AND file_id='".$id."'",__FILE__,__LINE__);
-		if ($res = mysql_fetch_array($result))
+		if ($res = Database::fetch_array($result))
 		{
     		$this->feedback_date = $res["feedback_date"];
     		$this->feedback = $res["feedback"];

+ 1 - 1
main/dropbox/dropbox_download.php

@@ -58,7 +58,7 @@ if ( isset($_GET['cat_id']) AND is_numeric($_GET['cat_id']) AND $_GET['action']=
 				" ;
 	}
 	$result=Database::query($sql,__FILE__,__LINE__);
-	while ($row=mysql_fetch_array($result))
+	while ($row=Database::fetch_array($result))
 	{
 		$files_to_download[]=$row['id'];
 	}

+ 2 - 2
main/dropbox/dropbox_submit.php

@@ -339,7 +339,7 @@ if ( isset( $_GET['mailingIndex']))  // examine or send
             }
 
 	        $result = Database::query($sel . $thisRecip . "'",__FILE__,__LINE__);
-	        while ( ($res = mysql_fetch_array($result))) {$students[] = $res;}
+	        while ( ($res = Database::fetch_array($result))) {$students[] = $res;}
 	        mysql_free_result($result);
 
 	    	if (count($students) == 1)
@@ -487,7 +487,7 @@ if ( isset( $_GET['mailingIndex']))  // examine or send
 	        if ( mysql_num_rows($result) > 0)
 	        {
 		        $remainingUsers = '';
-		        while ( ($res = mysql_fetch_array($result)))
+		        while ( ($res = Database::fetch_array($result)))
 		        {
 					$remainingUsers .= ', ' . htmlspecialchars(api_get_person_name($res[1], $res[0]), ENT_QUOTES, $charset);
 		        }

+ 1 - 1
main/exercice/hotpotatoes.lib.php

@@ -92,7 +92,7 @@ function GetComment($path,$course_code='') {
 	$query = "select comment from $dbTable where path='$path'";
 	$result = Database::query($query,__FILE__,__LINE__);
 
-	while ($row = mysql_fetch_array($result)) {
+	while ($row = Database::fetch_array($result)) {
 		return $row[0];
 	}
 	return "";

+ 1 - 1
main/exercice/hotspot_answers.as.php

@@ -40,7 +40,7 @@ $result = Database::query($sql,__FILE__,__LINE__);
 $output = "hotspot_lang=$courseLang&hotspot_image=$pictureName&hotspot_image_width=$pictureWidth&hotspot_image_height=$pictureHeight&courseCode=$coursePath";
 $i = 0;
 
-while ($hotspot = mysql_fetch_array($result))
+while ($hotspot = Database::fetch_array($result))
 {
 	$output .= "&hotspot_".$hotspot['id']."=true";
 	// Square or rectancle

+ 1 - 1
main/exercice/mark_free_answer.php

@@ -139,7 +139,7 @@ if($action == 'mark'){
 			#echo $sql;
 			$res = Database::query($sql,__FILE__,__LINE__);
 			if(mysql_num_rows($res)>0){
-				$row = mysql_fetch_array($res);
+				$row = Database::fetch_array($res);
 				//@todo Check that just summing past score and the new free answer mark doesn't come up
 				// with a score higher than the possible score for that exercise
 				$my_score = $row['exe_result'] + $_POST['score'];

+ 1 - 1
main/inc/global.inc.php

@@ -120,7 +120,7 @@ if (!mysql_select_db($_configuration['main_database'], $dokeos_database_connecti
 // The platform's character set must be retrieved at this early moment.
 $sql = "SELECT selected_value FROM settings_current WHERE variable = 'platform_charset';";
 $result = Database::query($sql, __FILE__, __LINE__);
-while ($row = @mysql_fetch_array($result)) {
+while ($row = @Database::fetch_array($result)) {
 	$charset = $row[0];
 }
 if (empty($charset)) {

+ 1 - 1
main/inc/introductionSection.inc.php

@@ -128,7 +128,7 @@ if ($intro_editAllowed) {
 
 $sql = "SELECT intro_text FROM $TBL_INTRODUCTION WHERE id='".$moduleId."'";
 $intro_dbQuery = Database::query($sql,__FILE__,__LINE__);
-$intro_dbResult = mysql_fetch_array($intro_dbQuery);
+$intro_dbResult = Database::fetch_array($intro_dbQuery);
 $intro_content = $intro_dbResult['intro_text'];
 
 /* Determines the correct display */

+ 4 - 4
main/inc/lib/classmanager.lib.php

@@ -46,7 +46,7 @@ class ClassManager
 		$table_class = Database :: get_main_table(TABLE_MAIN_CLASS);
 		$sql = "SELECT * FROM $table_class WHERE id='".$class_id."'";
 		$res = Database::query($sql, __FILE__, __LINE__);
-		return mysql_fetch_array($res, MYSQL_ASSOC);
+		return Database::fetch_array($res, 'ASSOC');
 	}
 	/**
 	 * Change the name of a class
@@ -111,7 +111,7 @@ class ClassManager
 		$sql = "SELECT * FROM $table_class_user cu, $table_user u WHERE cu.class_id = '".$class_id."' AND cu.user_id = u.user_id";
 		$res = Database::query($sql, __FILE__, __LINE__);
 		$users = array ();
-		while ($user = mysql_fetch_array($res, MYSQL_ASSOC))
+		while ($user = Database::fetch_array($res, 'ASSOC'))
 		{
 			$users[] = $user;
 		}
@@ -174,7 +174,7 @@ class ClassManager
 		$sql = "SELECT * FROM $table_class_course cc, $table_course c WHERE cc.class_id = '".$class_id."' AND cc.course_code = c.code";
 		$res = Database::query($sql, __FILE__, __LINE__);
 		$courses = array ();
-		while ($course = mysql_fetch_array($res, MYSQL_ASSOC))
+		while ($course = Database::fetch_array($res, 'ASSOC'))
 		{
 			$courses[] = $course;
 		}
@@ -253,7 +253,7 @@ class ClassManager
 		$sql = "SELECT cl.* FROM $table_class cl, $table_course_class cc WHERE cc.course_code = '".mysql_real_escape_string($course_code)."' AND cc.class_id = cl.id";
 		$res = Database::query($sql, __FILE__, __LINE__);
 		$classes = array ();
-		while ($class = mysql_fetch_array($res, MYSQL_ASSOC))
+		while ($class = Database::fetch_array($res, 'ASSOC'))
 		{
 			$classes[] = $class;
 		}

+ 2 - 2
main/inc/lib/fileManage.lib.php

@@ -69,7 +69,7 @@ function update_db_info($action, $oldPath, $newPath="")
             $mdType = (substr($dbTable, -13) == 'scormdocument') ?
                 'Scorm' : 'Document';
 
-            while ($row = mysql_fetch_array($result))
+            while ($row = Database::fetch_array($result))
             {
                 $eid = $mdType . '.' . $row['id'];
                 $mdStore->mds_delete($eid);
@@ -783,7 +783,7 @@ class FileManager
 		$sql_query = "SELECT count(*) as number_existing FROM $glued_table WHERE path='$full_file_name'";
 		//api_display_debug_info($sql_query);
 		$sql_result = Database::query($sql_query,__FILE__,__LINE__);
-		$result = mysql_fetch_array($sql_result);
+		$result = Database::fetch_array($sql_result);
 
 		//determine which query to execute
 		if( $result["number_existing"] > 0 )

+ 1 - 1
main/inc/lib/fileUpload.lib.php

@@ -1318,7 +1318,7 @@ function set_default_settings($upload_path,$filename,$filetype="file")
 	//$query="select count(*) as bestaat from `$dbTable` where path='$upload_path/$filename'";
 	$query="select count(*) as bestaat from $dbTable where path='$upload_path/$filename'";
 	$result=Database::query($query,__FILE__,__LINE__);
-	$row=mysql_fetch_array($result);
+	$row=Database::fetch_array($result);
 	if($row["bestaat"]>0)
 		//$query="update `$dbTable` set path='$upload_path/$filename',visibility='$default_visibility', filetype='$filetype' where path='$upload_path/$filename'";
 		$query="update $dbTable set path='$upload_path/$filename',visibility='$default_visibility', filetype='$filetype' where path='$upload_path/$filename'";

+ 10 - 10
main/inc/lib/surveymanager.lib.php

@@ -48,7 +48,7 @@ class SurveyManager {
 			$str_survey_list .= "<select name=\"exiztingsurvey\" $extra_script>\n";
 			$str_survey_list .= "<option value=\"\">--Select Survey--</option>";
 
-			while($result=mysql_fetch_array($sql_result))
+			while($result=Database::fetch_array($sql_result))
 			{
 			 $selected = ($seleced_surveyid==$result[survey_id])?"selected":"";
 			 $str_survey_list .= "\n<option value=\"".$result[survey_id]."\" ".$selected.">".$result[title]."</option>";
@@ -96,7 +96,7 @@ class SurveyManager {
 
 			$sql = 'SELECT MAX(sortby) FROM '.$table_group.' WHERE survey_id="'.Database::escape_string($survey_id).'"';
 			$rs = Database::query($sql, __FILE__, __LINE__);
-			list($sortby) = mysql_fetch_array($rs);
+			list($sortby) = Database::fetch_array($rs);
 			$sortby++;
 			$sql="INSERT INTO $table_group(group_id,survey_id,groupname,introduction, sortby) values('','$survey_id','$group_title','$introduction','$sortby')";
 			$result=Database::query($sql);
@@ -188,7 +188,7 @@ class SurveyManager {
 		$sql_result = Database::query($sql_query,__FILE__,__LINE__);
 		echo "<select name=\"author\">";
 		echo "<option value=\"\"><--Select Survey--></optional>";
-		while ($result =@mysql_fetch_array($sql_result))
+		while ($result =@Database::fetch_array($sql_result))
 		{
 			echo "\n<option value=\"".$result[survey_id]."\">".$result[title]."</option>";
 		}
@@ -612,7 +612,7 @@ class SurveyManager {
 			$str_group_list = "";
 			$str_group_list .= "<select name=\"exiztinggroup\" $extra_script>\n";
 
-			while($result=mysql_fetch_array($sql_result))
+			while($result=Database::fetch_array($sql_result))
 			{
 			 $selected = ($seleced_groupid==$result[group_id])?"selected":"";
 			 $str_group_list .= "\n<option value=\"".$result[group_id]."\" ".$selected.">".$result[groupname]."</option>\n";
@@ -1667,7 +1667,7 @@ function get_questions_move($curr_dbname)
 {
 	$sql_select_questions="SELECT  * from $curr_dbname.questions order by `sortby` asc";
 	$result=mysql_query($sql_select_questions);
-	while ($row=mysql_fetch_array($result))
+	while ($row=Database::fetch_array($result))
 		{
 		// we only need the database name of the course
 		$question1[]=array("caption"=> $row['caption'], "qid" => $row['qid'],"sortby" => $row['sortby']);
@@ -1684,7 +1684,7 @@ function listGroups($id_survey, $fields = '*')
 			WHERE survey_id='.$id_survey.' ORDER BY sortby';
 	$rs = Database::query($sql, __FILE__, __LINE__);
 	$groups = array();
-	while($row = mysql_fetch_array($rs)){
+	while($row = Database::fetch_array($rs)){
 		$groups[] = $row;
 	}
 	return $groups;
@@ -1708,7 +1708,7 @@ function listQuestions($id_survey, $fields = '*')
 	$rs = Database::query($sql, __FILE__, __LINE__);
 
 	$questions = array();
-	while($row = mysql_fetch_array($rs)){
+	while($row = Database::fetch_array($rs)){
 		$questions[] = $row;
 	}
 
@@ -1728,7 +1728,7 @@ function listAnswers($qid){
 	$rs = Database::query($sql, __FILE__, __LINE__);
 
 	$answers = array();
-	while($row = mysql_fetch_array($rs)){
+	while($row = Database::fetch_array($rs)){
 		$answers[] = $row;
 	}
 
@@ -1747,7 +1747,7 @@ function listUsers($survey_id, $dbname, $fields='id, user_id, firstname, lastnam
 				$order_clause;
 	$rs = Database::query($sql, __FILE__, __LINE__);
 	$users = array();
-	while ($row = mysql_fetch_array($rs)) {
+	while ($row = Database::fetch_array($rs)) {
 		$users[] = $row;
 	}
 	return $users;
@@ -1761,7 +1761,7 @@ function getUserAnswersDetails($id_userAnswers, $params=''){
 	$sql = 'SELECT * FROM '.$table_answers.' '.$where.' '.$order;
 	$rs = Database::query($sql, __FILE__, __LINE__);
 	$answers = array();
-	while($row = mysql_fetch_array($rs))
+	while($row = Database::fetch_array($rs))
 		$answers[] = $row;
 
 	return $answers;

+ 2 - 2
main/inc/tool_navigation_menu.inc.php

@@ -75,7 +75,7 @@ function get_navigation_items($include_admin_tools = false)
 
 		$sql_menu_query = "SELECT * FROM $course_tools_table WHERE visibility='1' and admin='0' ORDER BY id ASC";
 		$sql_result = Database::query($sql_menu_query, __FILE__, __LINE__);
-		while ($row = mysql_fetch_array($sql_result))
+		while ($row = Database::fetch_array($sql_result))
 		{
 			$navigation_items[$row['id']] = $row;
 			/*
@@ -107,7 +107,7 @@ function get_navigation_items($include_admin_tools = false)
 			$course_settings_sql = "	SELECT name,image FROM $course_tools_table
 															WHERE link='course_info/infocours.php'";
 			$sql_result = Database::query($course_settings_sql);
-			$course_setting_info = mysql_fetch_array($sql_result);
+			$course_setting_info = Database::fetch_array($sql_result);
 			$course_setting_visual_name = get_lang(ucfirst($course_setting_info['name']));
 			if (api_get_session_id()==0) {
 				// course settings item

+ 1 - 1
main/metadata/importdocs.php

@@ -65,7 +65,7 @@ echo get_lang('Tool'), ': ', mysql_num_rows($result), "<br><br>\n";
 
 $idt = array(); $cidpar = '?cidReq=' . $_course['sysCode'];
 
-while ($row = mysql_fetch_array($result))  // load indexabletexts in memory
+while ($row = Database::fetch_array($result))  // load indexabletexts in memory
 {
     $mdObj = new mdobject($_course, substr($row['eid'], AFTER_DOT));
     $idt[$mdObj->mdo_url . $cidpar] = $row['indexabletext'];

+ 6 - 6
main/metadata/importlinks.php

@@ -88,7 +88,7 @@ function get_cat($catname)
     $linkcat_table = Database::get_course_table(TABLE_LINK_CATEGORY);
     $result = Database::query("SELECT id FROM $linkcat_table WHERE " . $cateq, __FILE__, __LINE__);
 
-    if (mysql_num_rows($result) >= 1 && ($row = mysql_fetch_array($result)))
+    if (mysql_num_rows($result) >= 1 && ($row = Database::fetch_array($result)))
         return $row['id'];  // several categories with same name: take first
 
     return FALSE;
@@ -107,7 +107,7 @@ if (isset($lcn))  // category_title
 
     $result = $mdStore->mds_get_many('eid,mdxmltext', OF_EID_TYPE);
 
-    while ($row = mysql_fetch_array($result))
+    while ($row = Database::fetch_array($result))
         if (check_andor_get($row, '', $mdCat, $lcn)) $uceids[] = $row['eid'];
 
     if (($lci = get_cat($lcn)) !== FALSE)
@@ -115,7 +115,7 @@ if (isset($lcn))  // category_title
         $link_table = Database::get_course_table(TABLE_LINK);
         $result = Database::query("SELECT id FROM $link_table WHERE category_id=" . $lci, __FILE__, __LINE__);
 
-        while ($row = mysql_fetch_array($result))
+        while ($row = Database::fetch_array($result))
         {
             $lceids[$id = (int) $row['id']] = ($eid = EID_TYPE . '.' . $id);
 
@@ -194,7 +194,7 @@ elseif ($slo == get_lang('Index') && file_exists($phpDigIncCn) && count($mceids)
         OF_EID_TYPE . " AND eid IN ('" .
         implode("','", array_map('addslashes', $mceids)) . "')");
 
-    while ($row = mysql_fetch_array($result))  // load indexabletexts in memory
+    while ($row = Database::fetch_array($result))  // load indexabletexts in memory
         $idt[check_andor_get($row, $mdUrl)] = $row['indexabletext'];
 
     require($phpDigIncCn);  // switch to PhpDig DB
@@ -279,7 +279,7 @@ echo '<h3>', get_lang('Statistics'), '</h3>', "\n";
 $result = $mdStore->mds_get_many('eid,mdxmltext', OF_EID_TYPE);
 echo get_lang('TotalMDEs'), mysql_num_rows($result), "\n";
 
-while ($row = mysql_fetch_array($result))
+while ($row = Database::fetch_array($result))
 {
     $cat = check_andor_get($row, $mdCat);
     $perCat[$cat] = ($pc = $perCat[$cat]) ? $pc + 1 : 1;
@@ -327,7 +327,7 @@ if (count($perCat)) foreach ($perCat as $cat => $number)
 $linkcat_table = Database::get_course_table(TABLE_LINK_CATEGORY);
 $result = Database::query("SELECT category_title FROM $linkcat_table", __FILE__, __LINE__);
 
-while ($row = mysql_fetch_array($result))
+while ($row = Database::fetch_array($result))
 {
     $cat = $row['category_title']; $hcat = htmlspecialchars($cat, ENT_QUOTES, $charset);
     if ($perCat[$cat] == $hcat) $dups[] = $cat;

+ 3 - 3
main/metadata/importmanifest.php

@@ -65,7 +65,7 @@ if (isset($workWith))  // explicit in URL, or selected at bottom of screen
 
     if (mysql_num_rows($result) == 1)
     {
-        if (($row = mysql_fetch_array($result)))
+        if (($row = Database::fetch_array($result)))
         {
         	$sdi = $row['id'];
         }
@@ -408,7 +408,7 @@ elseif ($smo == get_lang('Index') && file_exists($phpDigIncCn) &&
         ($sdisub ? "." . $sdisub . "\_%'" : ".%'") .
         ($sdiall ? "" : " AND NOT INSTR(eid,'_')"));  // SQL LIKE underscore
 
-    while ($row = mysql_fetch_array($result))  // load indexabletexts in memory
+    while ($row = Database::fetch_array($result))  // load indexabletexts in memory
     {
         // URL: index.php[?sid=xxx[&thumb=yyy]] (file[1]/@href: pptslnnn_t.jpg)
 
@@ -460,7 +460,7 @@ echo '<h3>', get_lang('Statistics'), '</h3>', "\n";
 $result = $mdStore->mds_get_many('eid', "eid LIKE '" . EID_TYPE . ".%'");
 echo get_lang('TotalMDEs'), mysql_num_rows($result), "\n";
 
-while ($row = mysql_fetch_array($result))
+while ($row = Database::fetch_array($result))
 {
     $eid_id = substr($eid = $row['eid'], TPLEN);
 

+ 1 - 1
main/metadata/index.php

@@ -70,7 +70,7 @@ $result = Database::query("SELECT isocode FROM " .
 
 $sep = ":"; $langLangs = $sep . "xx" . $sep . "xx";
 
-while ($row = mysql_fetch_array($result))
+while ($row = Database::fetch_array($result))
     if (($isocode = $row['isocode']))
     	$langLangs .= ",, " . $isocode . $sep . $isocode;
 

+ 2 - 2
main/metadata/md_document.php

@@ -164,7 +164,7 @@ function mdobject($_course, $id)
     $this->mdo_dcmap_e = $ieee_dcmap_e; $this->mdo_dcmap_v = $ieee_dcmap_v;
 
     $document_table = Database::get_course_table(TABLE_DOCUMENT);
-    if (($docinfo = @mysql_fetch_array(Database::query(
+    if (($docinfo = @Database::fetch_array(Database::query(
             "SELECT path,title,comment,filetype FROM $document_table WHERE id='" .
             addslashes($id) . "'", __FILE__, __LINE__))))
     {
@@ -177,7 +177,7 @@ function mdobject($_course, $id)
         $group_info = Database::get_course_table(TABLE_GROUP);
         if (($result = Database::query(
                 "SELECT id,secret_directory FROM $group_info",  __FILE__, __LINE__)))
-            while (($row = mysql_fetch_array($result)))
+            while (($row = Database::fetch_array($result)))
                 if (($secdir = $row['secret_directory'] . '/') ==
                         substr($this->mdo_path, 0, strlen($secdir)))
                 {

+ 1 - 1
main/metadata/md_funcs.php

@@ -263,7 +263,7 @@ var $mds_something;
 
 function mds_get($eid, $column = 'mdxmltext', $must_exist = '')  // none: FALSE
 {
-    if (($mdt = mysql_fetch_array($this->_query("SELECT " . $column .
+    if (($mdt = Database::fetch_array($this->_query("SELECT " . $column .
         " FROM " . MDS_TABLE . " WHERE ", $eid)))) return $mdt[$column];
 
     if ($must_exist) give_up($must_exist . $this->_coldat('eid', $eid));

+ 2 - 2
main/metadata/md_link.php

@@ -198,7 +198,7 @@ function mdobject($_course, $id)
     $this->mdo_dcmap_e = $ieee_dcmap_e; $this->mdo_dcmap_v = $ieee_dcmap_v;
 
     $link_table = Database::get_course_table(TABLE_LINK);
-    if (($linkinfo = @mysql_fetch_array(Database::query(
+    if (($linkinfo = @Database::fetch_array(Database::query(
             "SELECT url,title,description,category_id FROM $link_table WHERE id='" .
             addslashes($id) . "'", __FILE__, __LINE__))))
     {
@@ -208,7 +208,7 @@ function mdobject($_course, $id)
         $this->mdo_category =    ($lci = $linkinfo['category_id']);
 
         $linkcat_table = Database::get_course_table(TABLE_LINK_CATEGORY);
-        if (($catinfo = @mysql_fetch_array(Database::query(
+        if (($catinfo = @Database::fetch_array(Database::query(
                 "SELECT category_title FROM $linkcat_table WHERE id='" .
                 addslashes($lci) . "'", __FILE__, __LINE__))))
             $this->mdo_category_title =    $catinfo['category_title'];

+ 2 - 2
main/metadata/md_phpdig.php

@@ -78,7 +78,7 @@ function find_site($url)
 
     if (mysql_num_rows($result) == 1)
     {
-        $row = mysql_fetch_array($result); return (int) $row['site_id'];
+        $row = Database::fetch_array($result); return (int) $row['site_id'];
     }
     else
     {
@@ -105,7 +105,7 @@ function remove_engine_entries($url, $path, $file = '')
         "spider WHERE site_id=" . ($site_id = find_site($url)) . $and_path,
         __FILE__, __LINE__);  // find page(s)
 
-    while ($row = mysql_fetch_array($result))
+    while ($row = Database::fetch_array($result))
     {
         Database::query("DELETE FROM " . PHPDIG_DB_PREFIX .
             "engine WHERE spider_id=" . (int)$row['spider_id'],

+ 1 - 1
main/metadata/md_scorm.php

@@ -87,7 +87,7 @@ function mdobject($_course, $id)
 
     $this->mdo_dcmap_e = $ieee_dcmap_e; $this->mdo_dcmap_v = $ieee_dcmap_v;
 	$sql = "SELECT path,description,lp_type FROM $scormdocument WHERE id='" . addslashes($id) . "'";
-    if (($docinfo = @mysql_fetch_array(Database::query($sql,__FILE__, __LINE__))))
+    if (($docinfo = @Database::fetch_array(Database::query($sql,__FILE__, __LINE__))))
     {
         $this->mdo_path =     $docinfo['path'];
 		//Sometimes the new scorm-tool adds '/.' at the end of a directory name, so remove this before continue

+ 1 - 1
main/metadata/search.php

@@ -96,7 +96,7 @@ if (isset($_POST['mdsc']))  // Search criteria
 
         $result = $mdStore->mds_get_many('eid,mdxmltext', $whereclause);
 
-        while (($myrow = @mysql_fetch_array($result)))
+        while (($myrow = @Database::fetch_array($result)))
         {
             // not quite a real manifest, but very much like one...
 

+ 1 - 1
main/metadata/statistics.php

@@ -84,7 +84,7 @@ echo get_lang('TotalMDEs'), mysql_num_rows($result), "<br>\n";
 
 echo count($kwds), ' ', get_lang('CourseKwds'), '<br>', "\n";
 
-while ($row = mysql_fetch_array($result))
+while ($row = Database::fetch_array($result))
 {
     $eid = $row['eid']; $curr = ''; $xmltext = $row['mdxmltext']; $offset = 0;
 

+ 1 - 1
main/metadata/update_indexabletext.php

@@ -58,7 +58,7 @@ echo get_lang('TotalMDEs'), $total = mysql_num_rows($result), "<br><br>\n";
 
 if ($total > 100) set_time_limit((int) ($total / 10));
 
-while ($row = mysql_fetch_array($result))
+while ($row = Database::fetch_array($result))
 {
     $eid = $row['eid']; $xmltext = $row['mdxmltext'];
     $xhtDoc->xht_xmldoc = new xmddoc(explode("\n", $xmltext));

+ 1 - 1
main/newscorm/aicc.class.php

@@ -673,7 +673,7 @@ class aicc extends learnpath {
 
 		$sql = "SELECT * FROM $tbl_lp WHERE id=".$lp_id;
 		$result = Database::query($sql, __FILE__, __LINE__);
-		$row = mysql_fetch_array($result);
+		$row = Database::fetch_array($result);
 		$LPname = $row['path'];
 		$list = split('/',$LPname);
 		$LPnamesafe = $list[0];

+ 5 - 5
main/newscorm/document.php

@@ -130,7 +130,7 @@ $result = mysql_query ("SELECT * FROM $tbl_document
 				WHERE path LIKE    '".$curDirPath."/%'
 				AND   path NOT LIKE '".$curDirPath."/%/%'");
 
-if ($result) while($row = mysql_fetch_array($result, MYSQL_ASSOC))
+if ($result) while($row = Database::fetch_array($result, 'ASSOC'))
 {
   $attribute['path'      ][] = $row['path'      ];
   $attribute['visibility'][] = $row['visibility'];
@@ -353,7 +353,7 @@ if ($fileList)
     }
     $sql="SELECT name FROM $tbl_document WHERE ((path='$sqlpath') and (filetype='folder'))";
     $result=Database::query($sql,__FILE__,__LINE__);
-    $row=mysql_fetch_array($result);
+    $row=Database::fetch_array($result);
     if ($row['name']) { $name=$row['name']; } else { $name=$dspFileName; }
     echo	"<tr align=\"center\"", " class=".$oddclass.">\n",
         	"<td align=\"left\" valign='middle'>&nbsp;",
@@ -418,18 +418,18 @@ if (!$curDirPath) {
   $sql="select * from $tbl_learnpath_main";
   $result=Database::query($sql,__FILE__,__LINE__);
   $counter=0;
-  while ($row=mysql_fetch_array($result)) {
+  while ($row=Database::fetch_array($result)) {
     $counter++;
     if (($counter % 2)==0) { $oddclass="row_odd"; } else { $oddclass="row_even"; }
 
     $id=$row["learnpath_id"];
     $sql2="SELECT * FROM $tbl_learnpath_main where learnpath_id=$id";
     $result2=Database::query($sql2,__FILE__,__LINE__);
-    $row2=mysql_fetch_array($result2);
+    $row2=Database::fetch_array($result2);
     $name=$row2['learnpath_name'];
     $sql3="SELECT * FROM $tbl_tool where (name=\"$name\" and image='scormbuilder.gif')";
     $result3=Database::query($sql3,__FILE__,__LINE__);
-    $row3=mysql_fetch_array($result3);
+    $row3=Database::fetch_array($result3);
     if ((api_is_allowed_to_edit()) or ((!api_is_allowed_to_edit()) and ($row3["visibility"] == '1'))) {
       $row['learnpath_name']=str_replace(' ','&nbsp;',$row['learnpath_name']);
       if ($row3["visibility"] != '1') { $style=' class="invisible"'; } else { $style=''; }

+ 41 - 41
main/newscorm/learnpath_functions.inc.php

@@ -95,7 +95,7 @@ function deletemodule($parent_item_id)
 	//Added for multi-level behaviour - slightly recursive
 	$sql = "SELECT * FROM $tbl_learnpath_chapter WHERE lp_id=$learnpath_id";
 	$result = Database::query($sql, __FILE__, __LINE__);
-	while ($row = mysql_fetch_array($result))
+	while ($row = Database::fetch_array($result))
 	{
 		if ($row['parent_item_id'] == $parent_item_id)
 		{
@@ -154,7 +154,7 @@ function deletepath($path_id)
 	//also delete all elements inside that path
 	$sql = "SELECT * FROM $tbl_learnpath_chapter WHERE lp_id=$path_id";
 	$result = Database::query($sql, __FILE__, __LINE__);
-	while ($row = mysql_fetch_array($result))
+	while ($row = Database::fetch_array($result))
 	{
 		deletemodule($row['id']);
 	}
@@ -280,7 +280,7 @@ function movemodule($direction, $id)
 	// see similar comment in moveitem() function
 	// @TODO: this only works for chapters in multi-level mode. Why not gather
 	// this function and moveitem to keep only one multi-uses function?
-	while ($row = mysql_fetch_array($result))
+	while ($row = Database::fetch_array($result))
 	{
 		// step 2: performing the move (only happens when passed trhough step 1 at least once)
 		if (!empty ($this_cat_order))
@@ -332,7 +332,7 @@ function insert_item($type = 'item', $name, $chapter_description = '', $parent_i
 			AND parent_item_id = $parent_id
 			ORDER BY display_order DESC";
 	$result = Database::query($sql, __FILE__, __LINE__);
-	$row = mysql_fetch_array($result);
+	$row = Database::fetch_array($result);
 	$last_chapter_order = $row["display_order"];
 
 	// getting the last order number of the items
@@ -340,7 +340,7 @@ function insert_item($type = 'item', $name, $chapter_description = '', $parent_i
 			AND parent_item_id = $parent_id
 			ORDER BY display_order DESC";
 	$result = Database::query($sql, __FILE__, __LINE__);
-	$row = mysql_fetch_array($result);
+	$row = Database::fetch_array($result);
 	$last_item_order = $row["display_order"];
 	$new_order = max($last_chapter_order, $last_item_order) + 1;
 
@@ -390,7 +390,7 @@ function array_learnpath_categories()
 	$sql = "SELECT * FROM  $tbl_learnpath_chapter  WHERE (lp_id=$learnpath_id) ORDER BY display_order ASC";
 	$result = Database::query($sql, __FILE__, __LINE__);
 
-	while ($row = mysql_fetch_array($result))
+	while ($row = Database::fetch_array($result))
 	{
 		$array_learnpath_categories[] = array ($row["id"], $row["chapter_name"]);
 	}
@@ -464,7 +464,7 @@ function display_learnpath_chapters($parent_item_id = 0, $tree = array (), $leve
 	$counter = 0;
 	$num_modules = count($tree[$parent_item_id]);
 
-	//while ($row=mysql_fetch_array($result))
+	//while ($row=Database::fetch_array($result))
 	if (isset ($tree[$parent_item_id]))
 	{
 		foreach ($tree[$parent_item_id] as $row)
@@ -579,7 +579,7 @@ function display_learnpath_chapters($parent_item_id = 0, $tree = array (), $leve
 							{
 								echo get_lang('prereq_deleted_error');
 							}
-							$row_items2 = mysql_fetch_array($result_items2);
+							$row_items2 = Database::fetch_array($result_items2);
 							display_addedresource_link_in_learnpath($row_items2["item_type"], $row_items2["ref"], '', $row_items2["id"], 'builder', '', 0);
 							if ((($row_items2["item_type"] == TOOL_QUIZ) or ($row_items2["item_type"] == 'HotPotatoes')) and ($row_items['prerequisite']))
 							{
@@ -597,7 +597,7 @@ function display_learnpath_chapters($parent_item_id = 0, $tree = array (), $leve
 							{
 								echo "<font color='red'>$lang_prereq_deleted_error</font>";
 							}
-							$row_items2 = mysql_fetch_array($result_items2);
+							$row_items2 = Database::fetch_array($result_items2);
 							echo " {$row_items2['title']}";
 						}*/
 					}
@@ -658,7 +658,7 @@ function display_all_learnpath()
 	$i = 1;
 	$num_modules = mysql_num_rows($result);
 
-	while ($row = mysql_fetch_array($result))
+	while ($row = Database::fetch_array($result))
 	{
 		//other grey color : #E6E6E6
 		echo "<tr><td bgcolor=\"$color2\" width=400><b>&nbsp;";
@@ -674,11 +674,11 @@ function display_all_learnpath()
 			$id = $row["lp_id"];
 			$sql2 = "SELECT * FROM $tbl_learnpath_main where lp_id=$id";
 			$result2 = Database::query($sql2, __FILE__, __LINE__);
-			$row2 = mysql_fetch_array($result2);
+			$row2 = Database::fetch_array($result2);
 			$name = $row2['learnpath_name'];
 			$sql3 = "SELECT * FROM $tbl_tool where (name=\"$name\" and image='scormbuilder.gif')";
 			$result3 = Database::query($sql3, __FILE__, __LINE__);
-			$row3 = mysql_fetch_array($result3);
+			$row3 = Database::fetch_array($result3);
 			if (($row3["visibility"]) == '1')
 			{
 				echo "<td bgcolor=\"$color2\" align=center><a href='".api_get_self()."?action=publishpath&set=i&id=".$row["lp_id"]."'&SQMSESSID=36812c2dea7d8d6e708d5e6a2f09b0b9><img src=\"../img/visible.gif\" border=\"0\" title=\"$lang_no_publish\"></a></td>";
@@ -820,16 +820,16 @@ function learnpath_items($itemid)
 
 	$sql_items = "SELECT parent_item_id FROM $tbl_lp_item WHERE id='$itemid'";
 	$moduleid_sql = Database::query($sql_items);
-	$moduleid_array = mysql_fetch_array($moduleid_sql); //first row of the results
+	$moduleid_array = Database::fetch_array($moduleid_sql); //first row of the results
 	$moduleid = $moduleid_array["parent_item_id"];
 
 	$sql_items = "SELECT * FROM $tbl_lp_item WHERE parent_item_id='$moduleid' ORDER BY display_order ASC";
 	$result_items = Database::query($sql_items);
-	$ar = mysql_fetch_array($result_items);
+	$ar = Database::fetch_array($result_items);
 	while ($ar != '')
 	{
 		$result[] = $ar;
-		$ar = mysql_fetch_array($result_items);
+		$ar = Database::fetch_array($result_items);
 	}
 	return $result;
 
@@ -850,11 +850,11 @@ function learnpath_chapters($learnpath_id)
 	$sql_items = "SELECT * FROM $tbl_lp_item WHERE lp_id='$learnpath_id' AND item_type='dokeos_chapter' ORDER BY display_order ASC";
 	//$sql_items = "SELECT * FROM $tbl_learnpath_chapter WHERE lp_id='$learnpath_id' ORDER BY display_order ASC";
 	$result_items = Database::query($sql_items, __FILE__, __LINE__);
-	$ar = mysql_fetch_array($result_items);
+	$ar = Database::fetch_array($result_items);
 	while ($ar != '')
 	{
 		$result[] = $ar;
-		$ar = mysql_fetch_array($result_items);
+		$ar = Database::fetch_array($result_items);
 	}
 	return $result;
 
@@ -910,7 +910,7 @@ function prereqcheck($id_in_path)
 	//3 Get item data from the database
 	$sql_items = "SELECT * FROM $tbl_learnpath_item WHERE id='$id_in_path'";
 	$result_items = Database::query($sql_items);
-	$row = mysql_fetch_array($result_items);
+	$row = Database::fetch_array($result_items);
 	//4 Check prerequisite's type
 	if ($row['prereq_type'] == 'i')
 	{
@@ -930,7 +930,7 @@ function prereqcheck($id_in_path)
 		}
 		$sql_items3 = "SELECT * FROM $tbl_learnpath_user WHERE (learnpath_item_id='$id_in_path3' and user_id=$user_id)";
 		$result_items3 = Database::query($sql_items3);
-		$row3 = mysql_fetch_array($result_items3);
+		$row3 = Database::fetch_array($result_items3);
 
 		//4.a.3 Get the link that needs to be shown for the current item (not the prereq)
 		$stepname = display_addedresource_link_in_learnpath($row['item_type'], $row['ref'], '', $id_in_path, 'builder', 'nolink');
@@ -940,7 +940,7 @@ function prereqcheck($id_in_path)
 		//4.a.4 Get the prerequisite item
 		$sql6 = "SELECT * FROM $tbl_learnpath_item WHERE (id='$id_in_path3')";
 		$result6 = Database::query($sql6);
-		$row6 = mysql_fetch_array($result6);
+		$row6 = Database::fetch_array($result6);
 		//4.a.5 Get a link to the prerequisite item
 		$prereqname = display_addedresource_link_in_learnpath($row6['item_type'], $row6['ref'], '', $id_in_path3, 'builder', 'nolink'); //this is the prereq of the step we want to open
 
@@ -986,7 +986,7 @@ function prereqcheck($id_in_path)
 		$sql_items3 = "SELECT * FROM $tbl_lp_item WHERE parent_item_id='$id_in_path2'";
 		$result_items3 = Database::query($sql_items3);
 		$allcompleted = true;
-		while ($row3 = mysql_fetch_array($result_items3))
+		while ($row3 = Database::fetch_array($result_items3))
 		{
 			//4.b.3 Cycle through items in the prerequisite chapter
 			//4.b.3.1 Get data ready to use
@@ -1002,7 +1002,7 @@ function prereqcheck($id_in_path)
 			//4.b.3.2 Get user-item relation
 			$sql_items4 = "SELECT * FROM $tbl_learnpath_user WHERE (learnpath_item_id='$id_in_path4' and user_id=$user_id)";
 			$result_items4 = Database::query($sql_items4);
-			$row4 = mysql_fetch_array($result_items4);
+			$row4 = Database::fetch_array($result_items4);
 			//4.b.3.3 If any of these elements is not 'completed', the overall completion status is false
 			if ($row4['status'] != "completed" and $row4['status'] != 'passed')
 			{
@@ -1019,7 +1019,7 @@ function prereqcheck($id_in_path)
 			//4.b.4.b Something was not completed. Return corresponding message
 			$sql5 = "SELECT * FROM $tbl_learnpath_chapter WHERE (lp_id='$learnpath_id' and id='$id_in_path2')";
 			$result5 = Database::query($sql5);
-			$row5 = mysql_fetch_array($result5);
+			$row5 = Database::fetch_array($result5);
 			$prereqmodulename = trim($row5['chapter_name']);
 			$prereq = $langPrereqModuleMinimum1.$prereqmodulename.$langPrereqModuleMinimum2;
 		}
@@ -1084,7 +1084,7 @@ function get_learnpath_tree($learnpath_id)
 		//error_log('New LP - learnpath_functions - get_learnpath_tree: '.$sql,0);
 		$res = Database::query($sql, __FILE__, __LINE__);
 		//error_log('New LP - learnpath_functions - get_learnpath_tree: Found '.Database::num_rows($res).' results',0);
-		while ($myrow = mysql_fetch_array($res, MYSQL_ASSOC))
+		while ($myrow = Database::fetch_array($res, 'ASSOC'))
 		{
 			//$items[] = $myrow;
 			//$items_by_chapter[$myrow['parent_item_id']][$myrow['display_order']] = $myrow;
@@ -1196,7 +1196,7 @@ function display_toc_chapter_contents($tree, $parent_item_id = 0, $learnpath_id,
 			// If this element is an item (understand: not a directory/module)
 			$sql0 = "SELECT * FROM $tbl_learnpath_user WHERE (user_id='".$uid."' and learnpath_item_id='".$elem['id']."' and lp_id='".$learnpath_id."')";
 			$result0 = Database::query($sql0, __FILE__, __LINE__);
-			$row0 = mysql_fetch_array($result0);
+			$row0 = Database::fetch_array($result0);
 
 			$completed = '';
 			if (($row0['status'] == 'completed') or ($row0['status'] == 'passed'))
@@ -1295,7 +1295,7 @@ function get_tracking_table($learnpath_id, $user_id, $parent_item_id = 0, $tree
 
 			$sql = "SELECT * FROM $tbl_learnpath_user "."WHERE user_id = $user_id "."AND lp_id = $learnpath_id "."AND learnpath_item_id = ".$elem['id'];
 			$res = Database::query($sql, __FILE__, __LINE__);
-			$myrow = mysql_fetch_array($res);
+			$myrow = Database::fetch_array($res);
 
 			if (($myrow['status'] == 'completed') || ($myrow['status'] == 'passed'))
 			{
@@ -1341,7 +1341,7 @@ function is_empty($id)
 
 	if ($num_modules != 0)
 	{
-		while ($row = mysql_fetch_array($result))
+		while ($row = Database::fetch_array($result))
 		{
 
 			$num_items = 0;
@@ -1700,7 +1700,7 @@ function exportitem($id, $item_id, $item_type, $add_scorm_communications = false
 			$barreMois = "";
 
 			//3 For each event corresponding to this agenda, do the following:
-			while ($myrow = mysql_fetch_array($result))
+			while ($myrow = Database::fetch_array($result))
 			{
 				//3.1 Make the blue month bar appear only once.
 				if ($barreMois != date("m", strtotime($myrow["start_date"])))
@@ -1774,7 +1774,7 @@ function exportitem($id, $item_id, $item_type, $add_scorm_communications = false
 			$expcontent .= "<table class=\"data_table\">";
 
 			//3 For each announcement matching the query
-			while ($myrow = mysql_fetch_array($result))
+			while ($myrow = Database::fetch_array($result))
 			{
 				//3.1 Get the __ field data
 				$content = $myrow[1];
@@ -1821,7 +1821,7 @@ function exportitem($id, $item_id, $item_type, $add_scorm_communications = false
 				//2.a This course has one (or more) description in the database
 				$expcontent .= "<hr noshade=\"noshade\" size=\"1\" />";
 				//2.a.1 For each description available for this course
-				while ($row = mysql_fetch_array($result))
+				while ($row = Database::fetch_array($result))
 				{
 					//2.a.1.1 Write title to export string
 					$expcontent .= "<h4>".$row['title']."</h4>";
@@ -1845,7 +1845,7 @@ function exportitem($id, $item_id, $item_type, $add_scorm_communications = false
 			$tbl_document = Database::get_course_table(TABLE_DOCUMENT);
 			$sql_query = "SELECT * FROM $tbl_document WHERE id=$item_id";
 			$sql_result = Database::query($sql_query, __FILE__, __LINE__);
-			$myrow = mysql_fetch_array($sql_result);
+			$myrow = Database::fetch_array($sql_result);
 			//2 Get the origin path of the document to treat it internally
 			$orig = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document'.$myrow["path"];
 			//3 Make some kind of strange transformation to get the destination filepath ???
@@ -1958,7 +1958,7 @@ function exportitem($id, $item_id, $item_type, $add_scorm_communications = false
 			//1 Get the introduction text data from the database
 			$TBL_INTRO = Database :: get_course_tool_intro_table();
 			$result = Database::query("SELECT * FROM ".$TBL_INTRO." WHERE id=1");
-			$myrow = mysql_fetch_array($result);
+			$myrow = Database::fetch_array($result);
 			$intro = $myrow["intro_text"];
 			//2 Write introduction text to the export string
 			$expcontent .= "<br />".$intro;
@@ -1969,7 +1969,7 @@ function exportitem($id, $item_id, $item_type, $add_scorm_communications = false
 			//1 Get HotPotatoes data from the document table
 			$tbl_document = Database::get_course_table(TABLE_DOCUMENT);
 			$result = Database::query("SELECT * FROM $tbl_document WHERE id=$item_id", __FILE__, __LINE__);
-			$myrow = mysql_fetch_array($result);
+			$myrow = Database::fetch_array($result);
 			//2 Get the document path
 			$testfile = api_get_path(SYS_COURSE_PATH).$_course['path']."/document".urldecode($myrow['path']);
 			//3 Get the document contents into a string
@@ -2047,11 +2047,11 @@ function exportitem($id, $item_id, $item_type, $add_scorm_communications = false
 			$tbl_posts =Database::get_course_table(TABLE_FORUM_POST);
 			$tbl_posts_text =Database::get_course_table(TOOL_FORUM_POST_TEXT_TABLE);
 			$result = Database::query("SELECT * FROM $tbl_posts where post_id=$item_id", __FILE__, __LINE__);
-			$myrow = mysql_fetch_array($result);
+			$myrow = Database::fetch_array($result);
 			// grabbing the title of the post
 			$sql_titel = "SELECT * FROM $tbl_posts_text WHERE post_id=".$myrow["post_id"];
 			$result_titel = Database::query($sql_titel, __FILE__, __LINE__);
-			$myrow_titel = mysql_fetch_array($result_titel);
+			$myrow_titel = Database::fetch_array($result_titel);
 
 			$posternom = $myrow['nom'];
 			$posterprenom = $myrow['prenom'];
@@ -2093,7 +2093,7 @@ function exportitem($id, $item_id, $item_type, $add_scorm_communications = false
 			//1 Get the link data from the database
 			$TABLETOOLLINK = Database :: get_course_link_table();
 			$result = Database::query("SELECT * FROM $TABLETOOLLINK WHERE id=$item_id", __FILE__, __LINE__);
-			$myrow = mysql_fetch_array($result);
+			$myrow = Database::fetch_array($result);
 			$thelink = $myrow["url"];
 			//2 Check the link type (open in blank page or in current page)
 			if ($item_type == "Link _blank")
@@ -2200,7 +2200,7 @@ function exportpath($learnpath_id)
 	include_once (api_get_path(LIBRARY_PATH)."fileUpload.lib.php");
 	$sql = "SELECT * FROM $tbl_learnpath_main WHERE (lp_id=$learnpath_id)";
 	$result = Database::query($sql, __FILE__, __LINE__);
-	$row = mysql_fetch_array($result);
+	$row = Database::fetch_array($result);
 	$LPname = $row['learnpath_name'];
 	$LPnamesafe = replace_dangerous_char($LPname, 'strict');
 
@@ -2231,7 +2231,7 @@ function exportpath($learnpath_id)
 	$result = Database::query($sql, __FILE__, __LINE__);
 
 	//5 export the items listed in Circle I one by one
-	while ($row = mysql_fetch_array($result))
+	while ($row = Database::fetch_array($result))
 	{
 		//5.1 Get items data from the database for this chapter
 		$parent_item_id = $row['id'];
@@ -2240,7 +2240,7 @@ function exportpath($learnpath_id)
 		$sql2b = "SELECT * FROM $tbl_learnpath_item WHERE (parent_item_id=$parent_item_id) ORDER BY display_order ASC";
 		$result2b = Database::query($sql2b, __FILE__, __LINE__);
 
-		while ($row2 = mysql_fetch_array($result2b))
+		while ($row2 = Database::fetch_array($result2b))
 		{
 			//5.1.1 Check if the element is in the circle1 array
 			$tobeexported = false;
@@ -2456,7 +2456,7 @@ function createimsmanifest($circle1_files, $learnpath_id)
 
 		$sql = "SELECT * FROM $tbl_learnpath_item WHERE (id=".$circle1_files[2][$i].")";
 		$result = Database::query($sql, __FILE__, __LINE__);
-		$row = mysql_fetch_array($result);
+		$row = Database::fetch_array($result);
 		$parent_item_id = $row['parent_item_id'];
 
 		if ($parent_item_id != $previous_item_id)
@@ -2464,7 +2464,7 @@ function createimsmanifest($circle1_files, $learnpath_id)
 			//we create the item tag for the chapter (without indifierref)
 			$sql2 = "SELECT * FROM $tbl_learnpath_chapter WHERE (id=".$parent_item_id.")";
 			$result2 = Database::query($sql2, __FILE__, __LINE__);
-			$row2 = mysql_fetch_array($result2);
+			$row2 = Database::fetch_array($result2);
 			$chapter_name = $row2['chapter_name'];
 
 			$attributes = '';

+ 54 - 54
main/newscorm/resourcelinker.inc.php

@@ -114,7 +114,7 @@ function show_documents($folder)
 	$document_table = Database::get_course_table(TABLE_DOCUMENT);
 	$sql="SELECT * from $document_table, $item_property_table WHERE id=ref AND tool = '".TOOL_DOCUMENT."' AND $visibility AND to_group_id = 0 AND to_user_id IS NULL  ORDER BY path ASC";
 	$result=Database::query($sql,__FILE__,__LINE__);
-	while ($row=mysql_fetch_array($result))
+	while ($row=Database::fetch_array($result))
 	{
 		if (!$folder)
 		{
@@ -169,7 +169,7 @@ function show_documents($folder)
 			//	echo '<br />';
 			//	}// if (str_replace($folder.'/','',$conform_folder)!==$folder)
 		} // else (if (!$folder))
-	} //while ($row=mysql_fetch_array($result))
+	} //while ($row=Database::fetch_array($result))
 
 	// this is code for the case that we are in a subfolder
 	if ($good_paths)
@@ -282,31 +282,31 @@ function display_addedresource_link($type, $id, $style='')
 		case 'Agenda':
 			$TABLEAGENDA = $_course['dbNameGlu'].'calendar_event';
 			$result = Database::query("SELECT * FROM `$TABLEAGENDA` WHERE id=$id",__FILE__,__LINE__);
-			$myrow = mysql_fetch_array($result);
+			$myrow = Database::fetch_array($result);
 			echo '<img src="../img/agenda.gif" align="middle" /> <a href="../calendar/agenda.php"'.$styling.'>'.$myrow['title']."</a><br />\n";
 			break;
 		case 'Ad_Valvas':
 			$tbl_announcement = $_course['dbNameGlu'].'announcement';
 			$result = Database::query("SELECT * FROM `$tbl_announcement` WHERE id=$id",__FILE__,__LINE__);
-			$myrow = mysql_fetch_array($result);
+			$myrow = Database::fetch_array($result);
 			echo '<img src="../img/valves.gif" align="middle" /> <a href="../announcements/announcements.php"'.$styling.'>'.$myrow['title']."</a><br />\n";
 			break;
 		case 'Link':
 			$TABLETOOLLINK = $_course['dbNameGlu'].'link';
 			$result = Database::query("SELECT * FROM `$TABLETOOLLINK` WHERE id=$id",__FILE__,__LINE__);
-			$myrow = mysql_fetch_array($result);
+			$myrow = Database::fetch_array($result);
 			echo '<img src="../img/links.gif" align="middle" /> <a href="#" onclick="javascript:window.open(\'../link/link_goto.php?link_id='.$myrow['id'].'&amp;link_url='.urlencode($myrow['url'])."','MyWindow','width=500,height=400,top='+((screen.height-400)/2)+',left='+((screen.width-500)/2)+',scrollbars=1,resizable=1,menubar=1'); return false;\"".$styling.'>'.$myrow['title']."</a><br />\n";
 			break;
 		case 'Exercise':
 			$TBL_EXERCICES = $_course['dbNameGlu'].'quiz';
 			$result = Database::query("SELECT * FROM `$TBL_EXERCICES` WHERE id=$id",__FILE__,__LINE__);
-			$myrow = mysql_fetch_array($result);
+			$myrow = Database::fetch_array($result);
 			echo '<img src="../img/quiz.gif" align="middle" /> <a href="../exercice/exercice_submit.php?exerciseId='.$myrow['id'].'"'.$styling.'>'.$myrow['title']."</a><br />\n";
 			break;
 		case 'Forum':
 			$TBL_FORUMS = $_course['dbNameGlu'].'bb_forums';
 			$result = Database::query("SELECT * FROM `$TBL_FORUMS` WHERE forum_id=$id",__FILE__,__LINE__);
-			$myrow = mysql_fetch_array($result);
+			$myrow = Database::fetch_array($result);
 			echo '<img src="../img/forum.gif" align="middle" /> <a href="../phpbb/viewforum.php?forum='.$myrow['forum_id'].'&amp;md5='.$myrow['md5'].'"'.$styling.'>'.$myrow['forum_name']."</a><br />\n";
 			break;
 		case 'Thread':  //=topics
@@ -314,11 +314,11 @@ function display_addedresource_link($type, $id, $style='')
 			$tbl_posts_text	= $_course['dbNameGlu'].'bb_posts_text';
 			$TBL_FORUMS		= $_course['dbNameGlu'].'bb_forums';
 			$result = Database::query("SELECT * FROM `$tbl_posts` posts, `$TBL_FORUMS` forum WHERE forum.forum_id=posts.forum_id and post_id=$id",__FILE__,__LINE__);
-			$myrow = mysql_fetch_array($result);
+			$myrow = Database::fetch_array($result);
 			// grabbing the title of the post
 			$sql_title = "SELECT * FROM `$tbl_posts_text` WHERE post_id=".$myrow["post_id"];
 			$result_title = Database::query($sql_title,__FILE__,__LINE__);
-			$myrow_title = mysql_fetch_array($result_title);
+			$myrow_title = Database::fetch_array($result_title);
 			echo '<img src="../img/forum.gif" align="middle" /> <a href="../phpbb/viewtopic.php?topic='.$myrow['topic_id'].'&amp;forum='.$myrow['forum_id'].'&amp;md5='.$myrow['md5'].'"'.$styling.'>'.$myrow_title['post_title']."</a><br />\n";
 			break;
 		case 'Post':
@@ -331,7 +331,7 @@ function display_addedresource_link($type, $id, $style='')
 		case 'Document':
 			$dbTable = $_course['dbNameGlu'].'document';
 			$result = Database::query("SELECT * FROM `$dbTable` WHERE id=$id",__FILE__,__LINE__);
-			$myrow = mysql_fetch_array($result);
+			$myrow = Database::fetch_array($result);
 			$pathname = explode('/',$myrow['path']); // making a correct name for the link
 			$last = count($pathname) - 1;  // making a correct name for the link
 			$filename = $pathname[$last];  // making a correct name for the link
@@ -386,10 +386,10 @@ function display_addedresource_link_in_learnpath($type, $id, $completed, $id_in_
 		case "Agenda":
 			$TABLEAGENDA 		= $_course['dbNameGlu']."calendar_event";
 			$result = Database::query("SELECT * FROM `$TABLEAGENDA` WHERE id=$id",__FILE__,__LINE__);
-			$myrow=mysql_fetch_array($result);
+			$myrow=Database::fetch_array($result);
 
 			$sql="select * from $tbl_lp_item where id=$id_in_path";
-			$result=Database::query($sql,__FILE__,__LINE__);	$row=mysql_fetch_array($result);
+			$result=Database::query($sql,__FILE__,__LINE__);	$row=Database::fetch_array($result);
 			if ($row['title'] != '') { $myrow["title"]=$row['title']; }
 			$desc=$row['description'];
 			$agenda_id=$row['item_id'];
@@ -436,10 +436,10 @@ function display_addedresource_link_in_learnpath($type, $id, $completed, $id_in_
 		case "Ad_Valvas":
 			$tbl_announcement = $_course['dbNameGlu']."announcement";
 			$result = Database::query("SELECT * FROM `$tbl_announcement` WHERE id=$id",__FILE__,__LINE__);
-			$myrow=mysql_fetch_array($result);
+			$myrow=Database::fetch_array($result);
 
 			$sql="select * from $tbl_lp_item where id=$id_in_path";
-			$result=Database::query($sql,__FILE__,__LINE__);	$row=mysql_fetch_array($result);
+			$result=Database::query($sql,__FILE__,__LINE__);	$row=Database::fetch_array($result);
 			if ($row['title'] != '') { $myrow["content"]=$row['title']; }
 			$desc=$row['description'];
 			$ann_id=$row['item_id'];
@@ -496,10 +496,10 @@ function display_addedresource_link_in_learnpath($type, $id, $completed, $id_in_
 		case "Link" :
 			$TABLETOOLLINK	= $_course['dbNameGlu']."link";
 			$result= Database::query("SELECT * FROM `$TABLETOOLLINK` WHERE id=$id",__FILE__,__LINE__);
-			$myrow=mysql_fetch_array($result);
+			$myrow=Database::fetch_array($result);
 
 			$sql="select * from $tbl_lp_item where id=$id_in_path";
-			$result=Database::query($sql,__FILE__,__LINE__);	$row=mysql_fetch_array($result);
+			$result=Database::query($sql,__FILE__,__LINE__);	$row=Database::fetch_array($result);
 			if ($row['title'] != '') { $myrow["title"]=$row['title']; }
 			$desc=$row['description'];
 			echo str_repeat("&nbsp;&gt;",$level);
@@ -555,14 +555,14 @@ function display_addedresource_link_in_learnpath($type, $id, $completed, $id_in_
 		case "Exercise":
 			$TBL_EXERCICES  = $_course['dbNameGlu'].'quiz';
 			$result= Database::query("SELECT * FROM `$TBL_EXERCICES` WHERE id=$id",__FILE__,__LINE__);
-			$myrow=mysql_fetch_array($result);
+			$myrow=Database::fetch_array($result);
 
 			if ($builder=='builder') { $origin='builder'; }
 			  //this is needed for the exercise_submit.php can delete the session info about tests
 
 			$sql="select * from $tbl_lp_item where id=$id_in_path";
 			$result=Database::query($sql,__FILE__,__LINE__);
-			$row=mysql_fetch_array($result);
+			$row=Database::fetch_array($result);
 			if ($row['title'] != '') { $myrow["title"]=$row['title']; }
 			$desc=$row['description'];
 			echo str_repeat("&nbsp;&gt;",$level);
@@ -613,7 +613,7 @@ function display_addedresource_link_in_learnpath($type, $id, $completed, $id_in_
 			$TBL_DOCUMENT  = $_course['dbNameGlu'].'document';
 			$documentPath=api_get_path('SYS_COURSE_PATH').$_course['path'].'/document';
 			$result = Database::query("SELECT * FROM `".$TBL_DOCUMENT."` WHERE id=$id");
-			$myrow= mysql_fetch_array($result);
+			$myrow= Database::fetch_array($result);
 			$path=$myrow["path"];
 			$name=GetQuizName($path,$documentPath);
 
@@ -621,7 +621,7 @@ function display_addedresource_link_in_learnpath($type, $id, $completed, $id_in_
 			  //this is needed for the exercise_submit.php can delete the session info about tests
 
 			$sql="select * from $tbl_lp_item where id=$id_in_path";
-			$result=Database::query($sql,__FILE__,__LINE__);	$row=mysql_fetch_array($result);
+			$result=Database::query($sql,__FILE__,__LINE__);	$row=Database::fetch_array($result);
 			if ($row['title'] != '') { $name=$row['title']; }
 			$desc=$row['description'];
 			echo str_repeat("&nbsp;&gt;",$level);
@@ -671,10 +671,10 @@ function display_addedresource_link_in_learnpath($type, $id, $completed, $id_in_
 		case "Forum":
 			$TBL_FORUMS = Database::get_course_table(TABLE_FORUM,$_course['database']);
 			$result= Database::query("SELECT * FROM $TBL_FORUMS WHERE forum_id=$id",__FILE__,__LINE__);
-			$myrow=mysql_fetch_array($result);
+			$myrow=Database::fetch_array($result);
 
 			$sql="select * from $tbl_lp_item where id=$id_in_path";
-			$result=Database::query($sql,__FILE__,__LINE__);	$row=mysql_fetch_array($result);
+			$result=Database::query($sql,__FILE__,__LINE__);	$row=Database::fetch_array($result);
 			if ($row['title'] != '') { $myrow["forum_name"]=$row['title']; }
 			$desc=$row['description'];
 			echo str_repeat("&nbsp;&gt;",$level);
@@ -723,10 +723,10 @@ function display_addedresource_link_in_learnpath($type, $id, $completed, $id_in_
 			$tbl_topics = Database::get_course_table(TABLE_FORUM_THREAD,$_course['database']);
 			$sql="SELECT * FROM $tbl_topics where topic_id=$id";
 			$result= Database::query($sql,__FILE__,__LINE__);
-			$myrow=mysql_fetch_array($result);
+			$myrow=Database::fetch_array($result);
 
 			$sql="select * from $tbl_lp_item where id=$id_in_path";
-			$result=Database::query($sql,__FILE__,__LINE__);	$row=mysql_fetch_array($result);
+			$result=Database::query($sql,__FILE__,__LINE__);	$row=Database::fetch_array($result);
 			if ($row['title'] != '') { $myrow["topic_title"]=$row['title']; }
 			$desc=$row['description'];
 			echo str_repeat("&nbsp;&gt;",$level);
@@ -775,14 +775,14 @@ function display_addedresource_link_in_learnpath($type, $id, $completed, $id_in_
 			$tbl_posts_text  = $_course['dbNameGlu'].'bb_posts_text';
 			$TBL_FORUMS = $_course['dbNameGlu']."bb_forums";
 			$result= Database::query("SELECT * FROM `$tbl_posts` where post_id=$id",__FILE__,__LINE__);
-			$myrow=mysql_fetch_array($result);
+			$myrow=Database::fetch_array($result);
 			// grabbing the title of the post
 			$sql_titel="SELECT * FROM `$tbl_posts_text` WHERE post_id=".$myrow["post_id"];
 			$result_titel=Database::query($sql_titel,__FILE__,__LINE__);
-			$myrow_titel=mysql_fetch_array($result_titel);
+			$myrow_titel=Database::fetch_array($result_titel);
 
 			$sql="select * from $tbl_lp_item where id=$id_in_path";
-			$result=Database::query($sql,__FILE__,__LINE__);	$row=mysql_fetch_array($result);
+			$result=Database::query($sql,__FILE__,__LINE__);	$row=Database::fetch_array($result);
 			if ($row['title'] != '') { $myrow_titel["post_title"]=$row['title']; }
 			$desc=$row['description'];
 			echo str_repeat("&nbsp;&gt;",$level);
@@ -839,7 +839,7 @@ function display_addedresource_link_in_learnpath($type, $id, $completed, $id_in_
 			$mysql = "SELECT * FROM `$dbTable` WHERE id=$id";
 			//error_log('New LP - Querying document table: '.$mysql,0);
 			$result = Database::query($mysql,__FILE__,__LINE__);
-			$myrow=mysql_fetch_array($result);
+			$myrow=Database::fetch_array($result);
 
 			$pathname=explode("/",$myrow["path"]); // making a correct name for the link
 			$last=count($pathname)-1;  // making a correct name for the link
@@ -861,7 +861,7 @@ function display_addedresource_link_in_learnpath($type, $id, $completed, $id_in_
 
 			$sql="select * from $tbl_lp_item where id=$id_in_path";
 			//error_log('New LP - Querying lp_item table: '.$sql,0);
-			$result=Database::query($sql,__FILE__,__LINE__);	$row=mysql_fetch_array($result);
+			$result=Database::query($sql,__FILE__,__LINE__);	$row=Database::fetch_array($result);
 			if ($row['title'] != '') { $filename=$row['title']; }
 			$desc=$row['description'];
 
@@ -906,7 +906,7 @@ function display_addedresource_link_in_learnpath($type, $id, $completed, $id_in_
 		case "Assignments":
 			$name=get_lang('Assignments');
 			$sql="select * from $tbl_lp_item where id=$id_in_path";
-			$result=Database::query($sql,__FILE__,__LINE__);	$row=mysql_fetch_array($result);
+			$result=Database::query($sql,__FILE__,__LINE__);	$row=Database::fetch_array($result);
 			if ($row['title'] != '') { $name=$row['title']; }
 			$desc=$row['description'];
 			echo str_repeat("&nbsp;&gt;",$level);
@@ -955,7 +955,7 @@ function display_addedresource_link_in_learnpath($type, $id, $completed, $id_in_
 		case "Dropbox":
 			$name=get_lang('Dropbox');
 			$sql="select * from $tbl_lp_item where id=$id_in_path";
-			$result=Database::query($sql,__FILE__,__LINE__);	$row=mysql_fetch_array($result);
+			$result=Database::query($sql,__FILE__,__LINE__);	$row=Database::fetch_array($result);
 			if ($row['title'] != '') { $name=$row['title']; }
 			$desc=$row['description'];
 			echo str_repeat("&nbsp;&gt;",$level);
@@ -994,7 +994,7 @@ function display_addedresource_link_in_learnpath($type, $id, $completed, $id_in_
 		case "Introduction_text":
 			$name=get_lang('IntroductionText');
 			$sql="select * from $tbl_lp_item where id=$id_in_path";
-			$result=Database::query($sql,__FILE__,__LINE__);	$row=mysql_fetch_array($result);
+			$result=Database::query($sql,__FILE__,__LINE__);	$row=Database::fetch_array($result);
 			if ($row['title'] != '') { $name=$row['title']; }
 			$desc=$row['description'];
 			echo str_repeat("&nbsp;&gt;",$level);
@@ -1035,7 +1035,7 @@ function display_addedresource_link_in_learnpath($type, $id, $completed, $id_in_
 		case "Course_description":
 			$name=get_lang('CourseDescription');
 			$sql="select * from $tbl_lp_item where id=$id_in_path";
-			$result=Database::query($sql,__FILE__,__LINE__);	$row=mysql_fetch_array($result);
+			$result=Database::query($sql,__FILE__,__LINE__);	$row=Database::fetch_array($result);
 			if ($row['title'] != '') { $name=$row['title']; }
 			$desc=$row['description'];
 			echo str_repeat("&nbsp;&gt;",$level);
@@ -1075,7 +1075,7 @@ function display_addedresource_link_in_learnpath($type, $id, $completed, $id_in_
 		case "Groups":
 			$name=get_lang('Groups');
 			$sql="select * from $tbl_lp_item where id=$id_in_path";
-			$result=Database::query($sql,__FILE__,__LINE__);	$row=mysql_fetch_array($result);
+			$result=Database::query($sql,__FILE__,__LINE__);	$row=Database::fetch_array($result);
 			if ($row['title'] != '') { $name=$row['title']; }
 			$desc=$row['description'];
 			echo str_repeat("&nbsp;&gt;",$level);
@@ -1114,7 +1114,7 @@ function display_addedresource_link_in_learnpath($type, $id, $completed, $id_in_
 		case "Users":
 			$name=get_lang('Users');
 			$sql="select * from $tbl_lp_item where id=$id_in_path";
-			$result=Database::query($sql,__FILE__,__LINE__);	$row=mysql_fetch_array($result);
+			$result=Database::query($sql,__FILE__,__LINE__);	$row=Database::fetch_array($result);
 			if ($row['title'] != '') { $name=$row['title']; }
 			$desc=$row['description'];
 			echo str_repeat("&nbsp;&gt;",$level);
@@ -1181,10 +1181,10 @@ function get_addedresource_link_in_learnpath($type, $id, $id_in_path)
 		case "Agenda":
 			$TABLEAGENDA 		= $_course['dbNameGlu']."calendar_event";
 			$result = Database::query("SELECT * FROM `$TABLEAGENDA` WHERE id=$id",__FILE__,__LINE__);
-			$myrow=mysql_fetch_array($result);
+			$myrow=Database::fetch_array($result);
 
 			$sql="select * from $tbl_lp_item where id=$id_in_path";
-			$result=Database::query($sql,__FILE__,__LINE__);	$row=mysql_fetch_array($result);
+			$result=Database::query($sql,__FILE__,__LINE__);	$row=Database::fetch_array($result);
 			if ($row['title'] != '') { $myrow["title"]=$row['title']; }
 			$desc=$row['description'];
 			$agenda_id=$row['item_id'];
@@ -1202,7 +1202,7 @@ function get_addedresource_link_in_learnpath($type, $id, $id_in_path)
 		case "Ad_Valvas":
 			$tbl_announcement = Database::get_course_table(TABLE_ANNOUNCEMENT);
 			$result = Database::query("SELECT * FROM $tbl_announcement WHERE id=$id",__FILE__,__LINE__);
-			$myrow=mysql_fetch_array($result);
+			$myrow=Database::fetch_array($result);
 
 			if ($builder != 'builder')
 			{
@@ -1217,10 +1217,10 @@ function get_addedresource_link_in_learnpath($type, $id, $id_in_path)
 		case "Link" :
 			$TABLETOOLLINK	= $_course['dbNameGlu']."link";
 			$result= Database::query("SELECT * FROM `$TABLETOOLLINK` WHERE id=$id",__FILE__,__LINE__);
-			$myrow=mysql_fetch_array($result);
+			$myrow=Database::fetch_array($result);
 
 			$sql="select * from $tbl_lp_item where id=$id_in_path";
-			$result=Database::query($sql,__FILE__,__LINE__);	$row=mysql_fetch_array($result);
+			$result=Database::query($sql,__FILE__,__LINE__);	$row=Database::fetch_array($result);
 
 			$thelink=$myrow["url"];
 			if ($builder != 'builder')
@@ -1236,13 +1236,13 @@ function get_addedresource_link_in_learnpath($type, $id, $id_in_path)
 		case "Exercise":
 			$TBL_EXERCICES  = $_course['dbNameGlu'].'quiz';
 			$result= Database::query("SELECT * FROM `$TBL_EXERCICES` WHERE id=$id",__FILE__,__LINE__);
-			$myrow=mysql_fetch_array($result);
+			$myrow=Database::fetch_array($result);
 
 			if ($builder=='builder') { $origin='builder'; }
 			  //this is needed for the exercise_submit.php can delete the session info about tests
 
 			$sql="select * from $tbl_lp_item where id=$id_in_path";
-			$result=Database::query($sql,__FILE__,__LINE__);	$row=mysql_fetch_array($result);
+			$result=Database::query($sql,__FILE__,__LINE__);	$row=Database::fetch_array($result);
 			if ($row['title'] != '') { $myrow["title"]=$row['title']; }
 
 			if ($builder != 'builder')
@@ -1259,7 +1259,7 @@ function get_addedresource_link_in_learnpath($type, $id, $id_in_path)
 	  	    $TBL_DOCUMENT  = $_course['dbNameGlu'].'document';
 		    $documentPath=api_get_path('SYS_COURSE_PATH').$_course['path'].'/document';
 			$result = Database::query("SELECT * FROM `".$TBL_DOCUMENT."` WHERE id=$id");
-		    $myrow= mysql_fetch_array($result);
+		    $myrow= Database::fetch_array($result);
 		    $path=$myrow["path"];
 		  	$name=GetQuizName($path,$documentPath);
 
@@ -1280,12 +1280,12 @@ function get_addedresource_link_in_learnpath($type, $id, $id_in_path)
 		case "Forum":
 			$TBL_FORUMS = $_course['dbNameGlu']."bb_forums";  // TODO: This is the old table name, it should be corrected.
 			$result= Database::query("SELECT * FROM `$TBL_FORUMS` WHERE forum_id=$id",__FILE__,__LINE__);
-			$myrow=mysql_fetch_array($result);
+			$myrow=Database::fetch_array($result);
 
 			if ($builder=='builder') { $origin='builder'; }
 
 			$sql="select * from $tbl_lp_item where id=$id_in_path";
-			$result=Database::query($sql,__FILE__,__LINE__);	$row=mysql_fetch_array($result);
+			$result=Database::query($sql,__FILE__,__LINE__);	$row=Database::fetch_array($result);
 			if ($row['title'] != '') { $myrow["forum_name"]=$row['title']; }
 
 			if ($myrow["forum_name"]=='') { $type="Forum"; }
@@ -1307,10 +1307,10 @@ function get_addedresource_link_in_learnpath($type, $id, $id_in_path)
 			$TBL_FORUMS = $_course['dbNameGlu']."bb_forums";
 			$sql="SELECT * FROM `$tbl_topics` where topic_id=$id";
 			$result= Database::query($sql,__FILE__,__LINE__);
-			$myrow=mysql_fetch_array($result);
+			$myrow=Database::fetch_array($result);
 
 			$sql="select * from $tbl_lp_item where id=$id_in_path";
-			$result=Database::query($sql,__FILE__,__LINE__);	$row=mysql_fetch_array($result);
+			$result=Database::query($sql,__FILE__,__LINE__);	$row=Database::fetch_array($result);
 
 			if ($builder != 'builder')
 			{
@@ -1327,14 +1327,14 @@ function get_addedresource_link_in_learnpath($type, $id, $id_in_path)
 			$tbl_posts_text  = $_course['dbNameGlu'].'bb_posts_text';
 			$TBL_FORUMS = $_course['dbNameGlu']."bb_forums";
 			$result= Database::query("SELECT * FROM `$tbl_posts` where post_id=$id",__FILE__,__LINE__);
-			$myrow=mysql_fetch_array($result);
+			$myrow=Database::fetch_array($result);
 			// grabbing the title of the post
 			$sql_titel="SELECT * FROM `$tbl_posts_text` WHERE post_id=".$myrow["post_id"];
 			$result_titel=Database::query($sql_titel,__FILE__,__LINE__);
-			$myrow_titel=mysql_fetch_array($result_titel);
+			$myrow_titel=Database::fetch_array($result_titel);
 
 			$sql="select * from $tbl_lp_item where id=$id_in_path";
-			$result=Database::query($sql,__FILE__,__LINE__);	$row=mysql_fetch_array($result);
+			$result=Database::query($sql,__FILE__,__LINE__);	$row=Database::fetch_array($result);
 			if ($row['title'] != '') { $myrow_titel["post_title"]=$row['title']; }
 			$desc=$row['description'];
     		$link .= str_repeat("&nbsp;&gt;",$level);
@@ -1357,14 +1357,14 @@ function get_addedresource_link_in_learnpath($type, $id, $id_in_path)
 		case "Document":
 			$dbTable  = $_course['dbNameGlu']."document";
 			$result=Database::query("SELECT * FROM `$dbTable` WHERE id=$id",__FILE__,__LINE__);
-			$myrow=mysql_fetch_array($result);
+			$myrow=Database::fetch_array($result);
 
 			$pathname=explode("/",$myrow["path"]); // making a correct name for the link
 			$last=count($pathname)-1;  // making a correct name for the link
 			$filename=$pathname[$last];  // making a correct name for the link
 
 			$sql="select * from $tbl_lp_item where id=$id_in_path";
-			$result=Database::query($sql,__FILE__,__LINE__);	$row=mysql_fetch_array($result);
+			$result=Database::query($sql,__FILE__,__LINE__);	$row=Database::fetch_array($result);
 
 			if ($builder != 'builder')
 			{
@@ -1533,7 +1533,7 @@ function edit_added_resources($type, $id)
 
 	$sql="SELECT * FROM `$TABLERESOURCE` WHERE source_type='$type' and source_id=$id";
 	$result=Database::query($sql,__FILE__,__LINE__);
-	while ($row=mysql_fetch_array($result))
+	while ($row=Database::fetch_array($result))
 	{
 		$addedresource[]=$row["resource_type"];
 		$addedresourceid[]=$row["resource_id"];
@@ -1576,7 +1576,7 @@ function display_added_resources($type, $id, $style='')
 
 	$sql="SELECT * FROM `$TABLERESOURCE` WHERE source_type='$type' and source_id='$id'";
 	$result=Database::query($sql,__FILE__,__LINE__);
-	while ($row=mysql_fetch_array($result))
+	while ($row=Database::fetch_array($result))
 	{
 		if ($origin != 'learnpath')
 		{

+ 21 - 21
main/newscorm/resourcelinker.php

@@ -130,7 +130,7 @@ if (!empty ($_POST['add_chapter']) && !empty ($_POST['title']))
 			"WHERE lp_id = $learnpath_id ".
 			" AND parent_item_id = $chapter_id";
 	$res = Database::query($sql, __FILE__, __LINE__);
-	$row = mysql_fetch_array($res);
+	$row = Database::fetch_array($res);
 	$lastorder_item = $row['maxi'];
 	if(empty($lastorder_item)){
 		$lastorder_item = 0;
@@ -310,7 +310,7 @@ if ($add)
 						//get title from tool-type table
 						$tooltable = Database::get_course_table(TABLE_DOCUMENT);
 						$result = Database::query("SELECT * FROM $tooltable WHERE id=".$addedresourceid[$i],__FILE__,__LINE__);
-						$myrow=mysql_fetch_array($result);
+						$myrow=Database::fetch_array($result);
 						$title = $myrow['title'];
 						break;
 					case 'Exercise':
@@ -318,7 +318,7 @@ if ($add)
 						//get title from tool-type table
 						$tooltable = Database::get_course_table(TABLE_QUIZ_TEST);
 						$result = Database::query("SELECT * FROM $tooltable WHERE id=".$addedresourceid[$i],__FILE__,__LINE__);
-						$myrow=mysql_fetch_array($result);
+						$myrow=Database::fetch_array($result);
 						$title = $myrow['title'];
 						break;
 					case 'Forum':
@@ -330,7 +330,7 @@ if ($add)
 						//get title from tool-type table
 						$tooltable = Database::get_course_table(TABLE_AGENDA);
 						$result = Database::query("SELECT * FROM $tooltable WHERE id=".$addedresourceid[$i],__FILE__,__LINE__);
-						$myrow=mysql_fetch_array($result);
+						$myrow=Database::fetch_array($result);
 						$title = $myrow['title'];
 						break;
 					case 'Ad_Valvas':
@@ -338,7 +338,7 @@ if ($add)
 						//get title from tool-type table
 						$tooltable = Database::get_course_table(TABLE_ANNOUNCEMENT);
 						$result = Database::query("SELECT * FROM $tooltable WHERE id=".$addedresourceid[$i],__FILE__,__LINE__);
-						$myrow=mysql_fetch_array($result);
+						$myrow=Database::fetch_array($result);
 						$title = $myrow['title'];
 						break;
 
@@ -495,12 +495,12 @@ else
 	$learnpath_select_query = "	SELECT * FROM $tbl_lp
 		  								WHERE id=$learnpath_id";
 	$sql_result = Database::query($learnpath_select_query);
-	$therow = mysql_fetch_array($sql_result);
+	$therow = Database::fetch_array($sql_result);
 
 	$learnpath_chapter_query = "	SELECT * FROM $tbl_lp_item
 		  								WHERE (lp_id = '$learnpath_id' and id = '$chapter_id')";
 	$sql_result = Database::query($learnpath_chapter_query);
-	$therow2 = mysql_fetch_array($sql_result);
+	$therow2 = Database::fetch_array($sql_result);
 
 	$from_learnpath = 'yes';
 	session_register('from_learnpath');
@@ -535,7 +535,7 @@ $active_modules=array();
 $tool_table = Database::get_course_table(TABLE_TOOL_LIST);
 $sql_select_active="SELECT * FROM $tool_table WHERE visibility='1'";
 $result_select_active=Database::query($sql_select_active);
-while ($row=mysql_fetch_array($result_select_active))
+while ($row=Database::fetch_array($result_select_active))
 {
 	$active_modules[]=$row['name'];
 }
@@ -750,7 +750,7 @@ if ($content == "Agenda")
 
 	$result = Database::query($sql);
 
-	while ($myrow = mysql_fetch_array($result))
+	while ($myrow = Database::fetch_array($result))
 	{
 		echo "<table width=\"100%\"><tr><td bgcolor=\"#E6E6E6\">";
 		echo "<img src='../img/agenda.gif' alt='agenda'>";
@@ -821,7 +821,7 @@ if ($content == "Ad_Valvas")
 	$sql = "SELECT * FROM ".$tbl_announcement." a, ".$item_property_table." i  WHERE i.tool = '".TOOL_ANNOUNCEMENT."' AND a.id=i.ref AND i.visibility='1' AND i.to_group_id = 0 AND i.to_user_id IS NULL ORDER BY a.display_order ASC";
 	//error_log($sql,0);
 	$result = Database::query($sql,__FILE__,__LINE__);
-	while ($myrow = mysql_fetch_array($result))
+	while ($myrow = Database::fetch_array($result))
 	{
 		echo "<table width=\"100%\"><tr><td>";
 		echo "<img src='../img/valves.gif' alt='advalvas'>";
@@ -853,7 +853,7 @@ if ($content == "Forum")
 		$sql = "SELECT * FROM ".$TBL_FORUMS." forums, ".$TBL_CATAGORIES." categories WHERE forums.forum_category=categories.cat_id ORDER BY forums.forum_category DESC";
 		//error_log($sql,0);
 		$result = Database::query($sql, __FILE__, __LINE__);
-		while ($myrow = mysql_fetch_array($result))
+		while ($myrow = Database::fetch_array($result))
 		{
 			if ($myrow["cat_title"] !== $old_cat_title)
 			{
@@ -871,13 +871,13 @@ if ($content == "Forum")
 		// displaying the category title
 		$sql = "SELECT * FROM ".$TBL_CATAGORIES." WHERE cat_id=$category";
 		$result = Database::query($sql, __FILE__, __LINE__);
-		$myrow = mysql_fetch_array($result);
+		$myrow = Database::fetch_array($result);
 		echo "<tr><td bgcolor='#4171B5' colspan='2'><font color='white'><b>".$myrow["cat_title"]."</b></font></td></tr>";
 
 		// displaying the forum title
 		$sql = "SELECT * FROM ".$TBL_FORUMS." forums, ".$TBL_FORUMTOPICS." topics WHERE forums.forum_id=topics.forum_id";
 		$result = Database::query($sql, __FILE__, __LINE__);
-		$myrow = mysql_fetch_array($result);
+		$myrow = Database::fetch_array($result);
 		echo "<tr><td bgcolor='#cccccc' colspan='2'><b>".$myrow["forum_name"]."</b></td></tr>";
 
 		if (!$thread)
@@ -885,7 +885,7 @@ if ($content == "Forum")
 			// displaying all the threads of this forum
 			$sql = "SELECT * FROM ".$TBL_FORUMTOPICS." WHERE forum_id=$forum";
 			$result = Database::query($sql, __FILE__, __LINE__);
-			while ($myrow = mysql_fetch_array($result))
+			while ($myrow = Database::fetch_array($result))
 			{
 				echo "<tr><td><a href='".api_get_self()."?content=Forum&category=$category&forum=1&thread=".$myrow["topic_id"]."&action=$action&lp_id=$learnpath_id&parent_item_id=$chapter_id&originalresource=no'>".$myrow["topic_title"]."</a>  (".$myrow["prenom"]." ".$myrow["nom"].")</td><td>";
 				showorhide_addresourcelink("Thread", $myrow["topic_id"]);
@@ -897,7 +897,7 @@ if ($content == "Forum")
 			// displaying all the replies
 			$sql = "SELECT * FROM ".$tbl_posts." post WHERE post.topic_id=$thread ORDER BY post.post_id ASC";
 			$result = Database::query($sql, __FILE__, __LINE__);
-			while ($myrow = mysql_fetch_array($result))
+			while ($myrow = Database::fetch_array($result))
 			{
 				echo "<tr><td><b>".$myrow["post_title"]."</b><br>";
 				echo $myrow["post_text"]."</td>";
@@ -947,7 +947,7 @@ if ($content == "Link")
 	if (mysql_num_rows($result) > 0)
 	{
 		echo "<table width=\"100%\"><tr><td bgcolor=\"#E6E6E6\"><i>".get_lang('NoCategory')."</i></td></tr></table>";
-		while ($myrow = mysql_fetch_array($result))
+		while ($myrow = Database::fetch_array($result))
 		{
 			echo "<img src='../img/links.gif'>".$myrow["title"];
 			echo "<br>";
@@ -959,12 +959,12 @@ if ($content == "Link")
 	// showing the categories and the links in it.
 	$sqlcategories = "SELECT * FROM ".$tbl_categories." ORDER by display_order DESC";
 	$resultcategories = Database::query($sqlcategories) or die;
-	while ($myrow = @ mysql_fetch_array($resultcategories))
+	while ($myrow = @ Database::fetch_array($resultcategories))
 	{
 		$sql_links = "SELECT * FROM ".$link_table.", ".$item_property_table." WHERE category_id='".$myrow["id"]."' AND tool = '".TOOL_LINK."' AND id=ref AND visibility='1' ORDER BY display_order DESC";
 		echo "<table width=\"100%\"><tr><td bgcolor=\"#E6E6E6\"><i>".$myrow["category_title"]."</i></td></tr></table>";
 		$result_links = Database::query($sql_links, __FILE__, __LINE__);
-		while ($myrow = mysql_fetch_array($result_links))
+		while ($myrow = Database::fetch_array($result_links))
 		{
 			echo "<img src='../img/links.gif' />".$myrow["title"];
 			echo "<br>";
@@ -983,7 +983,7 @@ if (($content == "Exercise") or ($content == "HotPotatoes"))
 {
 	$TBL_EXERCICES = Database::get_course_table(TABLE_QUIZ_TEST);
 	$result = Database::query("SELECT * FROM ".$TBL_EXERCICES." WHERE active='1' ORDER BY id ASC");
-	while ($myrow = mysql_fetch_array($result))
+	while ($myrow = Database::fetch_array($result))
 	{
 		echo "<img src='../img/quiz.gif'>".$myrow["title"]."<br>";
 		showorhide_addresourcelink($content, $myrow["id"]);
@@ -997,7 +997,7 @@ if (($content == "Exercise") or ($content == "HotPotatoes"))
 		$documentPath = api_get_path('SYS_COURSE_PATH').$_course['path'].'/document';
 		$sql = "SELECT * FROM ".$TBL_DOCUMENT." WHERE (path LIKE '%htm%' OR path LIKE '%html%') AND path LIKE '".$uploadPath."/%/%' ORDER BY `id` ASC";
 		$result = Database::query($sql, __FILE__, __LINE__);
-		while ($myrow = mysql_fetch_array($result))
+		while ($myrow = Database::fetch_array($result))
 		{
 			$path = $myrow["path"];
 			echo "<img src='../img/jqz.jpg'>".GetQuizName($path, $documentPath)."<br>";
@@ -1042,7 +1042,7 @@ if ($content == "Externallink")
 	$sql = "SELECT * FROM `$tbl_categories` ORDER BY display_order ASC";
 	echo $sql;
 	$result = Database::query($sql, __FILE__, __LINE__);
-	while ($row = mysql_fetch_array($result))
+	while ($row = Database::fetch_array($result))
 	{
 		echo "<option value='".$row["id"]."'>".$row["category_title"]."</option>";
 	}

+ 1 - 1
main/newscorm/scorm.class.php

@@ -862,7 +862,7 @@ class scorm extends learnpath {
 
 		$sql = "SELECT * FROM $tbl_lp WHERE id=".$lp_id;
 		$result = Database::query($sql, __FILE__, __LINE__);
-		$row = mysql_fetch_array($result);
+		$row = Database::fetch_array($result);
 		$LPname = $row['path'];
 		$list = split('/',$LPname);
 		$LPnamesafe = $list[0];

+ 1 - 1
main/newscorm/scorm.lib.php

@@ -61,7 +61,7 @@ function removescormDir($dir)
             $courseid=$_course['official_code'];
             $sql="SELECT * FROM ".Database::get_scorm_table(TABLE_SCORM_MAIN)." where (contentTitle='$scormdir' and dokeosCourse='$courseid')";
             $result=Database::query($sql,__FILE__,__LINE__);
-            while ($row=mysql_fetch_array($result))
+            while ($row=Database::fetch_array($result))
             {
 	      $c=$row['contentId'];
 	      $sql2="DELETE FROM ".Database::get_scorm_table(TABLE_SCORM_SCO_DATA)." where contentId=$c";

+ 4 - 4
main/newscorm/scorm_admin.php

@@ -100,7 +100,7 @@ switch($action){
 			$result=Database::query($sql,__FILE__,__LINE__);
 			$sql="SELECT * FROM $tbl_learnpath_chapter where learnpath_id=$id";
 			$result=Database::query($sql,__FILE__,__LINE__);
-			while ($row=mysql_fetch_array($result))
+			while ($row=Database::fetch_array($result))
 			{
 				$c=$row['id'];
 				$sql2="DELETE FROM $tbl_learnpath_item where chapter_id=$c";
@@ -119,7 +119,7 @@ switch($action){
 		if(!empty($id)){
 			$sql="SELECT * FROM $tbl_learnpath_main where learnpath_id=$id";
 			$result=Database::query($sql,__FILE__,__LINE__);
-			$row=mysql_fetch_array($result);
+			$row=Database::fetch_array($result);
 			$name=domesticate($row['learnpath_name']);
 			if ($set_visibility == 'i') {
 				$s=$name." ".get_lang('_no_published');
@@ -133,7 +133,7 @@ switch($action){
 			}
 			$sql="SELECT * FROM $tbl_tool where (name='$name' and image='scormbuilder.gif')";
 			$result=Database::query($sql,__FILE__,__LINE__);
-			$row2=mysql_fetch_array($result);
+			$row2=Database::fetch_array($result);
 			$num=mysql_num_rows($result);
 			if (($set_visibility == 'i') && ($num>0))
 			{
@@ -386,7 +386,7 @@ if($is_allowedToEdit) // TEACHER ONLY
     // At least one of these variables are empty. So it's okay to proceed this way
     /* Check if there is yet a record for this file in the DB */
     $result = mysql_query ("SELECT * FROM $tbl_document WHERE path LIKE '".$visibilityPath."'");
-    while($row = mysql_fetch_array($result, MYSQL_ASSOC))
+    while($row = Database::fetch_array($result, 'ASSOC'))
     {
       $attribute['path'      ] = $row['path'      ];
       $attribute['visibility'] = $row['visibility'];

+ 1 - 1
main/online/online_links.php

@@ -149,7 +149,7 @@ $result=Database::query($query,__FILE__,__LINE__);
 
 $Links=array();
 
-while($row=mysql_fetch_array($result))
+while($row=Database::fetch_array($result))
 {
 	$Links[]=$row;
 

+ 1 - 1
main/online/online_master.php

@@ -47,7 +47,7 @@ $tbl_online_link=Database::get_course_table(TABLE_ONLINE_LINK);
 $query="SELECT t1.user_id,username,picture_uri,t2.status FROM $tbl_user t1,$tbl_course_user t2 WHERE t1.user_id=t2.user_id AND course_code='$_cid' AND (t1.user_id='".$_user['user_id']."' OR t2.status='1')";
 $result=Database::query($query,__FILE__,__LINE__);
 
-while($row=mysql_fetch_array($result))
+while($row=Database::fetch_array($result))
 {
 	if($row['user_id'] == $_user['user_id'])
 	{

+ 6 - 6
main/permissions/permissions_functions.inc.php

@@ -164,7 +164,7 @@ function get_permissions($content, $id)
 		WHERE " . $id_field . "='" . mysql_real_escape_string($id) . "'";
 	$result = Database::query($sql, __FILE__, __LINE__);
 
-	while($row = mysql_fetch_array($result))
+	while($row = Database::fetch_array($result))
 		$currentpermissions[$row['tool']][] = $row['action'];
 
 	return $currentpermissions;
@@ -420,7 +420,7 @@ function display_role_list($current_course_roles, $current_platform_roles)
 	// platform roles
 	$sql="SELECT * FROM $platform_roles_table";
 	$result=Database::query($sql, __FILE__, __LINE__);
-	while ($row=mysql_fetch_array($result))
+	while ($row=Database::fetch_array($result))
 	{
 		if(in_array($row['role_id'], $current_platform_roles))
 		{
@@ -449,7 +449,7 @@ function display_role_list($current_course_roles, $current_platform_roles)
 	// course roles
 	$sql="SELECT * FROM $coures_roles_table";
 	$result=Database::query($sql, __FILE__, __LINE__);
-	while ($row=mysql_fetch_array($result))
+	while ($row=Database::fetch_array($result))
 	{
 		if(in_array($row['role_id'], $current_course_roles))
 		{
@@ -505,7 +505,7 @@ function get_roles($content,$id, $scope='course')
 	//$sql="SELECT role.role_id FROM $table role_group_user, $table_role role WHERE role_group_user.$id_field = '$id' AND role_group_user.role_id=role.role_id AND role_group_user.scope='".$scope."'";$sql="SELECT role.role_id FROM $table role_group_user, $table_role role WHERE role_group_user.$id_field = '$id' AND role_group_user.role_id=role.role_id AND role_group_user.scope='".$scope."'";
 	$sql="SELECT role_id FROM $table WHERE $id_field = '$id' AND scope='".$scope."'";
 	$result=Database::query($sql, __FILE__, __LINE__);
-	while ($row=mysql_fetch_array($result))
+	while ($row=Database::fetch_array($result))
 	{
 		$current_roles[]=$row['role_id'];
 	}
@@ -533,7 +533,7 @@ function get_all_roles($content='course')
 	$current_roles=array();
 	$sql="SELECT * FROM $table_role";
 	$result=Database::query($sql, __FILE__, __LINE__);
-	while ($row=mysql_fetch_array($result))
+	while ($row=Database::fetch_array($result))
 	{
 		$roles[]=$row;
 	}
@@ -596,7 +596,7 @@ function get_roles_permissions($content,$id, $scope='course')
 
 	$result = Database::query($sql, __FILE__, __LINE__);
 
-	while($row=mysql_fetch_array($result))
+	while($row=Database::fetch_array($result))
 		$current_role_permissions[$row['tool']][]=$row['action'];
 
 	return $current_role_permissions;

+ 54 - 54
main/resourcelinker/resourcelinker.inc.php

@@ -110,7 +110,7 @@ function show_documents($folder)
 	$document_table = Database::get_course_table(TABLE_DOCUMENT);
 	$sql="SELECT * from $document_table, $item_property_table WHERE id=ref AND tool = '".TOOL_DOCUMENT."' AND $visibility AND to_group_id = 0 AND to_user_id IS NULL  ORDER BY path ASC";
 	$result=Database::query($sql,__FILE__,__LINE__);
-	while ($row=mysql_fetch_array($result))
+	while ($row=Database::fetch_array($result))
 	{
 		if (!$folder)
 		{
@@ -165,7 +165,7 @@ function show_documents($folder)
 			//	echo '<br />';
 			//	}// if (str_replace($folder.'/','',$conform_folder)!==$folder)
 		} // else (if (!$folder))
-	} //while ($row=mysql_fetch_array($result))
+	} //while ($row=Database::fetch_array($result))
 
 	// this is code for the case that we are in a subfolder
 	if ($good_paths)
@@ -277,31 +277,31 @@ function display_addedresource_link($type, $id, $style='')
 		case 'Agenda':
 			$TABLEAGENDA = $_course['dbNameGlu'].'calendar_event';
 			$result = Database::query("SELECT * FROM `$TABLEAGENDA` WHERE id=$id",__FILE__,__LINE__);
-			$myrow = mysql_fetch_array($result);
+			$myrow = Database::fetch_array($result);
 			echo '<img src="../img/agenda.gif" align="middle" /> <a href="../calendar/agenda.php"'.$styling.'>'.$myrow['title']."</a><br />\n";
 			break;
 		case 'Ad_Valvas':
 			$tbl_announcement = $_course['dbNameGlu'].'announcement';
 			$result = Database::query("SELECT * FROM `$tbl_announcement` WHERE id=$id",__FILE__,__LINE__);
-			$myrow = mysql_fetch_array($result);
+			$myrow = Database::fetch_array($result);
 			echo '<img src="../img/valves.gif" align="middle" /> <a href="../announcements/announcements.php"'.$styling.'>'.$myrow['title']."</a><br />\n";
 			break;
 		case 'Link':
 			$TABLETOOLLINK = $_course['dbNameGlu'].'link';
 			$result = Database::query("SELECT * FROM `$TABLETOOLLINK` WHERE id=$id",__FILE__,__LINE__);
-			$myrow = mysql_fetch_array($result);
+			$myrow = Database::fetch_array($result);
 			echo '<img src="../img/links.gif" align="middle" /> <a href="#" onclick="javascript:window.open(\'../link/link_goto.php?link_id='.$myrow['id'].'&amp;link_url='.urlencode($myrow['url'])."','MyWindow','width=500,height=400,top='+((screen.height-400)/2)+',left='+((screen.width-500)/2)+',scrollbars=1,resizable=1,menubar=1'); return false;\"".$styling.'>'.$myrow['title']."</a><br />\n";
 			break;
 		case 'Exercise':
 			$TBL_EXERCICES = $_course['dbNameGlu'].'quiz';
 			$result = Database::query("SELECT * FROM `$TBL_EXERCICES` WHERE id=$id",__FILE__,__LINE__);
-			$myrow = mysql_fetch_array($result);
+			$myrow = Database::fetch_array($result);
 			echo '<img src="../img/quiz.gif" align="middle" /> <a href="../exercice/exercice_submit.php?exerciseId='.$myrow['id'].'"'.$styling.'>'.$myrow['title']."</a><br />\n";
 			break;
 		case 'Forum':
 			$TBL_FORUMS = $_course['dbNameGlu'].'bb_forums';
 			$result = Database::query("SELECT * FROM `$TBL_FORUMS` WHERE forum_id=$id",__FILE__,__LINE__);
-			$myrow = mysql_fetch_array($result);
+			$myrow = Database::fetch_array($result);
 			echo '<img src="../img/forum.gif" align="middle" /> <a href="../phpbb/viewforum.php?forum='.$myrow['forum_id'].'&amp;md5='.$myrow['md5'].'"'.$styling.'>'.$myrow['forum_name']."</a><br />\n";
 			break;
 		case 'Thread':  //=topics
@@ -309,11 +309,11 @@ function display_addedresource_link($type, $id, $style='')
 			$tbl_posts_text	= $_course['dbNameGlu'].'bb_posts_text';
 			$TBL_FORUMS		= $_course['dbNameGlu'].'bb_forums';
 			$result = Database::query("SELECT * FROM `$tbl_posts` posts, `$TBL_FORUMS` forum WHERE forum.forum_id=posts.forum_id and post_id=$id",__FILE__,__LINE__);
-			$myrow = mysql_fetch_array($result);
+			$myrow = Database::fetch_array($result);
 			// grabbing the title of the post
 			$sql_title = "SELECT * FROM `$tbl_posts_text` WHERE post_id=".$myrow["post_id"];
 			$result_title = Database::query($sql_title,__FILE__,__LINE__);
-			$myrow_title = mysql_fetch_array($result_title);
+			$myrow_title = Database::fetch_array($result_title);
 			echo '<img src="../img/forum.gif" align="middle" /> <a href="../phpbb/viewtopic.php?topic='.$myrow['topic_id'].'&amp;forum='.$myrow['forum_id'].'&amp;md5='.$myrow['md5'].'"'.$styling.'>'.$myrow_title['post_title']."</a><br />\n";
 			break;
 		case 'Post':
@@ -327,7 +327,7 @@ function display_addedresource_link($type, $id, $style='')
 		case 'Document':
 			$dbTable = $_course['dbNameGlu'].'document';
 			$result = Database::query("SELECT * FROM `$dbTable` WHERE id=$id",__FILE__,__LINE__);
-			$myrow = mysql_fetch_array($result);
+			$myrow = Database::fetch_array($result);
 			$pathname = explode('/',$myrow['path']); // making a correct name for the link
 			$last = count($pathname) - 1;  // making a correct name for the link
 			$filename = $pathname[$last];  // making a correct name for the link
@@ -379,10 +379,10 @@ function display_addedresource_link_in_learnpath($type, $id, $completed, $id_in_
 		case "Agenda":
 			$TABLEAGENDA 		= $_course['dbNameGlu']."calendar_event";
 			$result = Database::query("SELECT * FROM `$TABLEAGENDA` WHERE id=$id",__FILE__,__LINE__);
-			$myrow=mysql_fetch_array($result);
+			$myrow=Database::fetch_array($result);
 
 			$sql="select * from $tbl_learnpath_item where id=$id_in_path";
-			$result=Database::query($sql,__FILE__,__LINE__);	$row=mysql_fetch_array($result);
+			$result=Database::query($sql,__FILE__,__LINE__);	$row=Database::fetch_array($result);
 			if ($row['title'] != '') { $myrow["title"]=$row['title']; }
 			$desc=$row['description'];
 			$agenda_id=$row['item_id'];
@@ -428,10 +428,10 @@ function display_addedresource_link_in_learnpath($type, $id, $completed, $id_in_
 		case "Ad_Valvas":
 			$tbl_announcement = $_course['dbNameGlu']."announcement";
 			$result = Database::query("SELECT * FROM `$tbl_announcement` WHERE id=$id",__FILE__,__LINE__);
-			$myrow=mysql_fetch_array($result);
+			$myrow=Database::fetch_array($result);
 
 			$sql="select * from $tbl_learnpath_item where id=$id_in_path";
-			$result=Database::query($sql,__FILE__,__LINE__);	$row=mysql_fetch_array($result);
+			$result=Database::query($sql,__FILE__,__LINE__);	$row=Database::fetch_array($result);
 			if ($row['title'] != '') { $myrow["content"]=$row['title']; }
 			$desc=$row['description'];
 			$ann_id=$row['item_id'];
@@ -487,10 +487,10 @@ function display_addedresource_link_in_learnpath($type, $id, $completed, $id_in_
 		case "Link" :
 			$TABLETOOLLINK	= $_course['dbNameGlu']."link";
 			$result= Database::query("SELECT * FROM `$TABLETOOLLINK` WHERE id=$id",__FILE__,__LINE__);
-			$myrow=mysql_fetch_array($result);
+			$myrow=Database::fetch_array($result);
 
 			$sql="select * from $tbl_learnpath_item where id=$id_in_path";
-			$result=Database::query($sql,__FILE__,__LINE__);	$row=mysql_fetch_array($result);
+			$result=Database::query($sql,__FILE__,__LINE__);	$row=Database::fetch_array($result);
 			if ($row['title'] != '') { $myrow["title"]=$row['title']; }
 			$desc=$row['description'];
 			echo str_repeat("&nbsp;&gt;",$level);
@@ -545,13 +545,13 @@ function display_addedresource_link_in_learnpath($type, $id, $completed, $id_in_
 		case "Exercise":
 			$TBL_EXERCICES  = $_course['dbNameGlu'].'quiz';
 			$result= Database::query("SELECT * FROM `$TBL_EXERCICES` WHERE id=$id",__FILE__,__LINE__);
-			$myrow=mysql_fetch_array($result);
+			$myrow=Database::fetch_array($result);
 
 			if ($builder=='builder') { $origin='builder'; }
 			  //this is needed for the exercise_submit.php can delete the session info about tests
 
 			$sql="select * from $tbl_learnpath_item where id=$id_in_path";
-			$result=Database::query($sql,__FILE__,__LINE__);	$row=mysql_fetch_array($result);
+			$result=Database::query($sql,__FILE__,__LINE__);	$row=Database::fetch_array($result);
 			if ($row['title'] != '') { $myrow["title"]=$row['title']; }
 			$desc=$row['description'];
 			echo str_repeat("&nbsp;&gt;",$level);
@@ -601,7 +601,7 @@ function display_addedresource_link_in_learnpath($type, $id, $completed, $id_in_
 			$TBL_DOCUMENT  = $_course['dbNameGlu'].'document';
 			$documentPath=api_get_path('SYS_COURSE_PATH').$_course['path'].'/document';
 			$result = Database::query("SELECT * FROM `".$TBL_DOCUMENT."` WHERE id=$id");
-			$myrow= mysql_fetch_array($result);
+			$myrow= Database::fetch_array($result);
 			$path=$myrow["path"];
 			$name=GetQuizName($path,$documentPath);
 
@@ -609,7 +609,7 @@ function display_addedresource_link_in_learnpath($type, $id, $completed, $id_in_
 			  //this is needed for the exercise_submit.php can delete the session info about tests
 
 			$sql="select * from $tbl_learnpath_item where id=$id_in_path";
-			$result=Database::query($sql,__FILE__,__LINE__);	$row=mysql_fetch_array($result);
+			$result=Database::query($sql,__FILE__,__LINE__);	$row=Database::fetch_array($result);
 			if ($row['title'] != '') { $name=$row['title']; }
 			$desc=$row['description'];
 			echo str_repeat("&nbsp;&gt;",$level);
@@ -658,10 +658,10 @@ function display_addedresource_link_in_learnpath($type, $id, $completed, $id_in_
 		case "Forum":
 			$TBL_FORUMS = $_course['dbNameGlu']."bb_forums";
 			$result= Database::query("SELECT * FROM `$TBL_FORUMS` WHERE forum_id=$id",__FILE__,__LINE__);
-			$myrow=mysql_fetch_array($result);
+			$myrow=Database::fetch_array($result);
 
 			$sql="select * from $tbl_learnpath_item where id=$id_in_path";
-			$result=Database::query($sql,__FILE__,__LINE__);	$row=mysql_fetch_array($result);
+			$result=Database::query($sql,__FILE__,__LINE__);	$row=Database::fetch_array($result);
 			if ($row['title'] != '') { $myrow["forum_name"]=$row['title']; }
 			$desc=$row['description'];
 			echo str_repeat("&nbsp;&gt;",$level);
@@ -711,10 +711,10 @@ function display_addedresource_link_in_learnpath($type, $id, $completed, $id_in_
 			$TBL_FORUMS = $_course['dbNameGlu']."bb_forums";
 			$sql="SELECT * FROM `$tbl_topics` where topic_id=$id";
 			$result= Database::query($sql,__FILE__,__LINE__);
-			$myrow=mysql_fetch_array($result);
+			$myrow=Database::fetch_array($result);
 
 			$sql="select * from $tbl_learnpath_item where id=$id_in_path";
-			$result=Database::query($sql,__FILE__,__LINE__);	$row=mysql_fetch_array($result);
+			$result=Database::query($sql,__FILE__,__LINE__);	$row=Database::fetch_array($result);
 			if ($row['title'] != '') { $myrow["topic_title"]=$row['title']; }
 			$desc=$row['description'];
 			echo str_repeat("&nbsp;&gt;",$level);
@@ -762,14 +762,14 @@ function display_addedresource_link_in_learnpath($type, $id, $completed, $id_in_
 			$tbl_posts_text  = $_course['dbNameGlu'].'bb_posts_text';
 			$TBL_FORUMS = $_course['dbNameGlu']."bb_forums";
 			$result= Database::query("SELECT * FROM `$tbl_posts` where post_id=$id",__FILE__,__LINE__);
-			$myrow=mysql_fetch_array($result);
+			$myrow=Database::fetch_array($result);
 			// grabbing the title of the post
 			$sql_titel="SELECT * FROM `$tbl_posts_text` WHERE post_id=".$myrow["post_id"];
 			$result_titel=Database::query($sql_titel,__FILE__,__LINE__);
-			$myrow_titel=mysql_fetch_array($result_titel);
+			$myrow_titel=Database::fetch_array($result_titel);
 
 			$sql="select * from $tbl_learnpath_item where id=$id_in_path";
-			$result=Database::query($sql,__FILE__,__LINE__);	$row=mysql_fetch_array($result);
+			$result=Database::query($sql,__FILE__,__LINE__);	$row=Database::fetch_array($result);
 			if ($row['title'] != '') { $myrow_titel["post_title"]=$row['title']; }
 			$desc=$row['description'];
 			echo str_repeat("&nbsp;&gt;",$level);
@@ -823,7 +823,7 @@ function display_addedresource_link_in_learnpath($type, $id, $completed, $id_in_
 		case "Document":
 			$dbTable  = $_course['dbNameGlu']."document";
 			$result=Database::query("SELECT * FROM `$dbTable` WHERE id=$id",__FILE__,__LINE__);
-			$myrow=mysql_fetch_array($result);
+			$myrow=Database::fetch_array($result);
 
 			$pathname=explode("/",$myrow["path"]); // making a correct name for the link
 			$last=count($pathname)-1;  // making a correct name for the link
@@ -844,7 +844,7 @@ function display_addedresource_link_in_learnpath($type, $id, $completed, $id_in_
 			$image=choose_image($filename);
 
 			$sql="select * from $tbl_learnpath_item where id=$id_in_path";
-			$result=Database::query($sql,__FILE__,__LINE__);	$row=mysql_fetch_array($result);
+			$result=Database::query($sql,__FILE__,__LINE__);	$row=Database::fetch_array($result);
 			if ($row['title'] != '') { $filename=$row['title']; }
 			$desc=$row['description'];
 
@@ -888,7 +888,7 @@ function display_addedresource_link_in_learnpath($type, $id, $completed, $id_in_
 		case "Assignments":
 			$name=get_lang('Assignments');
 			$sql="select * from $tbl_learnpath_item where id=$id_in_path";
-			$result=Database::query($sql,__FILE__,__LINE__);	$row=mysql_fetch_array($result);
+			$result=Database::query($sql,__FILE__,__LINE__);	$row=Database::fetch_array($result);
 			if ($row['title'] != '') { $name=$row['title']; }
 			$desc=$row['description'];
 			echo str_repeat("&nbsp;&gt;",$level);
@@ -935,7 +935,7 @@ function display_addedresource_link_in_learnpath($type, $id, $completed, $id_in_
 		case "Dropbox":
 			$name=get_lang('Dropbox');
 			$sql="select * from $tbl_learnpath_item where id=$id_in_path";
-			$result=Database::query($sql,__FILE__,__LINE__);	$row=mysql_fetch_array($result);
+			$result=Database::query($sql,__FILE__,__LINE__);	$row=Database::fetch_array($result);
 			if ($row['title'] != '') { $name=$row['title']; }
 			$desc=$row['description'];
 			echo str_repeat("&nbsp;&gt;",$level);
@@ -972,7 +972,7 @@ function display_addedresource_link_in_learnpath($type, $id, $completed, $id_in_
 		case "Introduction_text":
 			$name=get_lang('IntroductionText');
 			$sql="select * from $tbl_learnpath_item where id=$id_in_path";
-			$result=Database::query($sql,__FILE__,__LINE__);	$row=mysql_fetch_array($result);
+			$result=Database::query($sql,__FILE__,__LINE__);	$row=Database::fetch_array($result);
 			if ($row['title'] != '') { $name=$row['title']; }
 			$desc=$row['description'];
 			echo str_repeat("&nbsp;&gt;",$level);
@@ -1011,7 +1011,7 @@ function display_addedresource_link_in_learnpath($type, $id, $completed, $id_in_
 		case "Course_description":
 			$name=get_lang('CourseDescription');
 			$sql="select * from $tbl_learnpath_item where id=$id_in_path";
-			$result=Database::query($sql,__FILE__,__LINE__);	$row=mysql_fetch_array($result);
+			$result=Database::query($sql,__FILE__,__LINE__);	$row=Database::fetch_array($result);
 			if ($row['title'] != '') { $name=$row['title']; }
 			$desc=$row['description'];
 			echo str_repeat("&nbsp;&gt;",$level);
@@ -1049,7 +1049,7 @@ function display_addedresource_link_in_learnpath($type, $id, $completed, $id_in_
 		case "Groups":
 			$name=get_lang('Groups');
 			$sql="select * from $tbl_learnpath_item where id=$id_in_path";
-			$result=Database::query($sql,__FILE__,__LINE__);	$row=mysql_fetch_array($result);
+			$result=Database::query($sql,__FILE__,__LINE__);	$row=Database::fetch_array($result);
 			if ($row['title'] != '') { $name=$row['title']; }
 			$desc=$row['description'];
 			echo str_repeat("&nbsp;&gt;",$level);
@@ -1086,7 +1086,7 @@ function display_addedresource_link_in_learnpath($type, $id, $completed, $id_in_
 		case "Users":
 			$name=get_lang('Users');
 			$sql="select * from $tbl_learnpath_item where id=$id_in_path";
-			$result=Database::query($sql,__FILE__,__LINE__);	$row=mysql_fetch_array($result);
+			$result=Database::query($sql,__FILE__,__LINE__);	$row=Database::fetch_array($result);
 			if ($row['title'] != '') { $name=$row['title']; }
 			$desc=$row['description'];
 			echo str_repeat("&nbsp;&gt;",$level);
@@ -1152,10 +1152,10 @@ function get_addedresource_link_in_learnpath($type, $id, $id_in_path)
 		case "Agenda":
 			$TABLEAGENDA 		= $_course['dbNameGlu']."calendar_event";
 			$result = Database::query("SELECT * FROM `$TABLEAGENDA` WHERE id=$id",__FILE__,__LINE__);
-			$myrow=mysql_fetch_array($result);
+			$myrow=Database::fetch_array($result);
 
 			$sql="select * from $tbl_learnpath_item where id=$id_in_path";
-			$result=Database::query($sql,__FILE__,__LINE__);	$row=mysql_fetch_array($result);
+			$result=Database::query($sql,__FILE__,__LINE__);	$row=Database::fetch_array($result);
 			if ($row['title'] != '') { $myrow["title"]=$row['title']; }
 			$desc=$row['description'];
 			$agenda_id=$row['item_id'];
@@ -1173,7 +1173,7 @@ function get_addedresource_link_in_learnpath($type, $id, $id_in_path)
 		case "Ad_Valvas":
 			$tbl_announcement = Database::get_course_table(TABLE_ANNOUNCEMENT);
 			$result = Database::query("SELECT * FROM $tbl_announcement WHERE id=$id",__FILE__,__LINE__);
-			$myrow=mysql_fetch_array($result);
+			$myrow=Database::fetch_array($result);
 
 			if ($builder != 'builder')
 			{
@@ -1188,10 +1188,10 @@ function get_addedresource_link_in_learnpath($type, $id, $id_in_path)
 		case "Link" :
 			$TABLETOOLLINK	= $_course['dbNameGlu']."link";
 			$result= Database::query("SELECT * FROM `$TABLETOOLLINK` WHERE id=$id",__FILE__,__LINE__);
-			$myrow=mysql_fetch_array($result);
+			$myrow=Database::fetch_array($result);
 
 			$sql="select * from $tbl_learnpath_item where id=$id_in_path";
-			$result=Database::query($sql,__FILE__,__LINE__);	$row=mysql_fetch_array($result);
+			$result=Database::query($sql,__FILE__,__LINE__);	$row=Database::fetch_array($result);
 
 			$thelink=$myrow["url"];
 			if ($builder != 'builder')
@@ -1207,13 +1207,13 @@ function get_addedresource_link_in_learnpath($type, $id, $id_in_path)
 		case "Exercise":
 			$TBL_EXERCICES  = $_course['dbNameGlu'].'quiz';
 			$result= Database::query("SELECT * FROM `$TBL_EXERCICES` WHERE id=$id",__FILE__,__LINE__);
-			$myrow=mysql_fetch_array($result);
+			$myrow=Database::fetch_array($result);
 
 			if ($builder=='builder') { $origin='builder'; }
 			  //this is needed for the exercise_submit.php can delete the session info about tests
 
 			$sql="select * from $tbl_learnpath_item where id=$id_in_path";
-			$result=Database::query($sql,__FILE__,__LINE__);	$row=mysql_fetch_array($result);
+			$result=Database::query($sql,__FILE__,__LINE__);	$row=Database::fetch_array($result);
 			if ($row['title'] != '') { $myrow["title"]=$row['title']; }
 
 			if ($builder != 'builder')
@@ -1230,7 +1230,7 @@ function get_addedresource_link_in_learnpath($type, $id, $id_in_path)
 	  	    $TBL_DOCUMENT  = $_course['dbNameGlu'].'document';
 		    $documentPath=api_get_path('SYS_COURSE_PATH').$_course['path'].'/document';
 			$result = Database::query("SELECT * FROM `".$TBL_DOCUMENT."` WHERE id=$id");
-		    $myrow= mysql_fetch_array($result);
+		    $myrow= Database::fetch_array($result);
 		    $path=$myrow["path"];
 		  	$name=GetQuizName($path,$documentPath);
 
@@ -1251,12 +1251,12 @@ function get_addedresource_link_in_learnpath($type, $id, $id_in_path)
 		case "Forum":
 			$TBL_FORUMS = $_course['dbNameGlu']."bb_forums";
 			$result= Database::query("SELECT * FROM `$TBL_FORUMS` WHERE forum_id=$id",__FILE__,__LINE__);
-			$myrow=mysql_fetch_array($result);
+			$myrow=Database::fetch_array($result);
 
 			if ($builder=='builder') { $origin='builder'; }
 
 			$sql="select * from $tbl_learnpath_item where id=$id_in_path";
-			$result=Database::query($sql,__FILE__,__LINE__);	$row=mysql_fetch_array($result);
+			$result=Database::query($sql,__FILE__,__LINE__);	$row=Database::fetch_array($result);
 			if ($row['title'] != '') { $myrow["forum_name"]=$row['title']; }
 
 			if ($myrow["forum_name"]=='') { $type="Forum"; }
@@ -1278,10 +1278,10 @@ function get_addedresource_link_in_learnpath($type, $id, $id_in_path)
 			$TBL_FORUMS = $_course['dbNameGlu']."bb_forums";
 			$sql="SELECT * FROM `$tbl_topics` where topic_id=$id";
 			$result= Database::query($sql,__FILE__,__LINE__);
-			$myrow=mysql_fetch_array($result);
+			$myrow=Database::fetch_array($result);
 
 			$sql="select * from $tbl_learnpath_item where id=$id_in_path";
-			$result=Database::query($sql,__FILE__,__LINE__);	$row=mysql_fetch_array($result);
+			$result=Database::query($sql,__FILE__,__LINE__);	$row=Database::fetch_array($result);
 
 			if ($builder != 'builder')
 			{
@@ -1299,14 +1299,14 @@ function get_addedresource_link_in_learnpath($type, $id, $id_in_path)
 			$tbl_posts_text  = $_course['dbNameGlu'].'bb_posts_text';
 			$TBL_FORUMS = $_course['dbNameGlu']."bb_forums";
 			$result= Database::query("SELECT * FROM `$tbl_posts` where post_id=$id",__FILE__,__LINE__);
-			$myrow=mysql_fetch_array($result);
+			$myrow=Database::fetch_array($result);
 			// grabbing the title of the post
 			$sql_titel="SELECT * FROM `$tbl_posts_text` WHERE post_id=".$myrow["post_id"];
 			$result_titel=Database::query($sql_titel,__FILE__,__LINE__);
-			$myrow_titel=mysql_fetch_array($result_titel);
+			$myrow_titel=Database::fetch_array($result_titel);
 
 			$sql="select * from $tbl_learnpath_item where id=$id_in_path";
-			$result=Database::query($sql,__FILE__,__LINE__);	$row=mysql_fetch_array($result);
+			$result=Database::query($sql,__FILE__,__LINE__);	$row=Database::fetch_array($result);
 			if ($row['title'] != '') { $myrow_titel["post_title"]=$row['title']; }
 			$desc=$row['description'];
     		$link .= str_repeat("&nbsp;&gt;",$level);
@@ -1330,14 +1330,14 @@ function get_addedresource_link_in_learnpath($type, $id, $id_in_path)
 		case "Document":
 			$dbTable  = $_course['dbNameGlu']."document";
 			$result=Database::query("SELECT * FROM `$dbTable` WHERE id=$id",__FILE__,__LINE);
-			$myrow=mysql_fetch_array($result);
+			$myrow=Database::fetch_array($result);
 
 			$pathname=explode("/",$myrow["path"]); // making a correct name for the link
 			$last=count($pathname)-1;  // making a correct name for the link
 			$filename=$pathname[$last];  // making a correct name for the link
 
 			$sql="select * from $tbl_learnpath_item where id=$id_in_path";
-			$result=Database::query($sql,__FILE__,__LINE__);	$row=mysql_fetch_array($result);
+			$result=Database::query($sql,__FILE__,__LINE__);	$row=Database::fetch_array($result);
 
 			if ($builder != 'builder')
 			{
@@ -1506,7 +1506,7 @@ function edit_added_resources($type, $id)
 
 	$sql="SELECT * FROM `$TABLERESOURCE` WHERE source_type='$type' and source_id=$id";
 	$result=Database::query($sql,__FILE__,__LINE__);
-	while ($row=mysql_fetch_array($result))
+	while ($row=Database::fetch_array($result))
 	{
 		$addedresource[]=$row["resource_type"];
 		$addedresourceid[]=$row["resource_id"];
@@ -1549,7 +1549,7 @@ function display_added_resources($type, $id, $style='')
 
 	$sql="SELECT * FROM `$TABLERESOURCE` WHERE source_type='$type' and source_id='$id'";
 	$result=Database::query($sql,__FILE__,__LINE__);
-	while ($row=mysql_fetch_array($result))
+	while ($row=Database::fetch_array($result))
 	{
 		if ($origin != 'learnpath')
 		{

+ 20 - 20
main/resourcelinker/resourcelinker.php

@@ -125,12 +125,12 @@ if (!empty ($_POST['add_chapter']) && !empty ($_POST['title']))
 	// get max display_order so far in this parent chapter
 	$sql = "SELECT MAX(display_order) FROM $tbl_learnpath_chapter WHERE learnpath_id = $learnpath_id "." AND parent_chapter_id = $chapter_id";
 	$res = Database::query($sql, __FILE__, __LINE__);
-	$row = mysql_fetch_array($res);
+	$row = Database::fetch_array($res);
 	$max_temp = $row[0];
 
 	$sql = "SELECT MAX(display_order) FROM $tbl_learnpath_item WHERE "." chapter_id = $chapter_id";
 	$res = Database::query($sql, __FILE__, __LINE__);
-	$row = mysql_fetch_array($res);
+	$row = Database::fetch_array($res);
 	$max_temp2 = $row[0];
 	if ($max_temp2 > $max_temp)
 	{
@@ -213,7 +213,7 @@ if ($add)
 		if(mysql_num_rows($result)==0){
 			$lastorder_item = 0;
 		}else{
-			$row = mysql_fetch_array($result);
+			$row = Database::fetch_array($result);
 			$lastorder_item = ($row[0]);
 		}
 		$sql = "SELECT MAX(display_order) FROM $tbl_learnpath_chapter WHERE parent_chapter_id=$chapter_id";
@@ -221,7 +221,7 @@ if ($add)
 		if(mysql_num_rows($result)==0){
 			$lastorder_chapter = 0;
 		}else{
-			$row = mysql_fetch_array($result);
+			$row = Database::fetch_array($result);
 			$lastorder_chapter = ($row[0]);
 		}
 		$lastorder = ($lastorder_chapter>$lastorder_item?$lastorder_chapter+1:$lastorder_item+1);
@@ -403,12 +403,12 @@ else
 	$learnpath_select_query = "	SELECT * FROM $tbl_learnpath_main
 		  								WHERE learnpath_id=$learnpath_id";
 	$sql_result = Database::query($learnpath_select_query);
-	$therow = mysql_fetch_array($sql_result);
+	$therow = Database::fetch_array($sql_result);
 
 	$learnpath_chapter_query = "	SELECT * FROM $tbl_learnpath_chapter
 		  								WHERE (learnpath_id = '$learnpath_id' and id = '$chapter_id')";
 	$sql_result = Database::query($learnpath_chapter_query);
-	$therow2 = mysql_fetch_array($sql_result);
+	$therow2 = Database::fetch_array($sql_result);
 
 	$from_learnpath = 'yes';
 	session_register('from_learnpath');
@@ -443,7 +443,7 @@ $active_modules=array();
 $tool_table = Database::get_course_table(TABLE_TOOL_LIST);
 $sql_select_active="SELECT * FROM $tool_table WHERE visibility='1'";
 $result_select_active=Database::query($sql_select_active);
-while ($row=mysql_fetch_array($result_select_active))
+while ($row=Database::fetch_array($result_select_active))
 {
 	$active_modules[]=$row['name'];
 }
@@ -653,7 +653,7 @@ if ($content == "Agenda")
 
 	$result = Database::query($sql);
 
-	while ($myrow = mysql_fetch_array($result))
+	while ($myrow = Database::fetch_array($result))
 	{
 		echo "<table width=\"100%\"><tr><td bgcolor=\"#E6E6E6\">";
 		echo "<img src='../img/agenda.gif' alt='agenda'>";
@@ -723,7 +723,7 @@ if ($content == "Ad_Valvas")
 	$sql = "SELECT * FROM ".$tbl_announcement." a, ".$item_property_table." i  WHERE i.tool = '".TOOL_ANNOUNCEMENT."' AND a.id=i.ref AND i.visibility='1' AND i.to_group_id = 0 AND i.to_user_id IS NULL ORDER BY a.display_order ASC";
 
 	$result = Database::query($sql,__FILE__,__LINE__);
-	while ($myrow = mysql_fetch_array($result))
+	while ($myrow = Database::fetch_array($result))
 	{
 		echo "<table width=\"100%\"><tr><td>";
 		echo "<img src='../img/valves.gif' alt='advalvas'>";
@@ -755,7 +755,7 @@ if ($content == "Forum")
 	{
 		$sql = "SELECT * FROM ".$TBL_FORUMS." forums, ".$TBL_CATAGORIES." categories WHERE forums.cat_id=categories.cat_id ORDER BY forums.cat_id DESC";
 		$result = Database::query($sql, __FILE__, __LINE__);
-		while ($myrow = mysql_fetch_array($result))
+		while ($myrow = Database::fetch_array($result))
 		{
 			if ($myrow["cat_title"] !== $old_cat_title)
 			{
@@ -773,13 +773,13 @@ if ($content == "Forum")
 		// displaying the category title
 		$sql = "SELECT * FROM ".$TBL_CATAGORIES." WHERE cat_id=$category";
 		$result = Database::query($sql, __FILE__, __LINE__);
-		$myrow = mysql_fetch_array($result);
+		$myrow = Database::fetch_array($result);
 		echo "<tr><td bgcolor='#4171B5' colspan='2'><font color='white'><b>".$myrow["cat_title"]."</b></font></td></tr>";
 
 		// displaying the forum title
 		$sql = "SELECT * FROM ".$TBL_FORUMS." forums, ".$TBL_FORUMTOPICS." topics WHERE forums.forum_id=topics.forum_id";
 		$result = Database::query($sql, __FILE__, __LINE__);
-		$myrow = mysql_fetch_array($result);
+		$myrow = Database::fetch_array($result);
 		echo "<tr><td bgcolor='#cccccc' colspan='2'><b>".$myrow["forum_name"]."</b></td></tr>";
 
 		if (!$thread)
@@ -787,7 +787,7 @@ if ($content == "Forum")
 			// displaying all the threads of this forum
 			$sql = "SELECT * FROM ".$TBL_FORUMTOPICS." WHERE forum_id=$forum";
 			$result = Database::query($sql, __FILE__, __LINE__);
-			while ($myrow = mysql_fetch_array($result))
+			while ($myrow = Database::fetch_array($result))
 			{
 				echo "<tr><td><a href='".api_get_self()."?content=Forum&category=$category&forum=1&thread=".$myrow["topic_id"]."&action=$action&learnpath_id=$learnpath_id&chapter_id=$chapter_id&originalresource=no'>".$myrow["topic_title"]."</a>  (".$myrow["prenom"]." ".$myrow["nom"].")</td><td>";
 				showorhide_addresourcelink("Thread", $myrow["topic_id"]);
@@ -799,7 +799,7 @@ if ($content == "Forum")
 			// displaying all the replies
 			$sql = "SELECT * FROM ".$tbl_posts." post, ".$tbl_posts_text." post_text WHERE post_text.post_id=post.post_id and post.topic_id=$thread ORDER BY post_text.post_id ASC";
 			$result = Database::query($sql, __FILE__, __LINE__);
-			while ($myrow = mysql_fetch_array($result))
+			while ($myrow = Database::fetch_array($result))
 			{
 				echo "<tr><td><b>".$myrow["post_title"]."</b><br>";
 				echo $myrow["post_text"]."</td>";
@@ -849,7 +849,7 @@ if ($content == "Link")
 	if (mysql_num_rows($result) > 0)
 	{
 		echo "<table width=\"100%\"><tr><td bgcolor=\"#E6E6E6\"><i>".get_lang('NoCategory')."</i></td></tr></table>";
-		while ($myrow = mysql_fetch_array($result))
+		while ($myrow = Database::fetch_array($result))
 		{
 			echo "<img src='../img/links.gif'>".$myrow["title"];
 			echo "<br>";
@@ -861,12 +861,12 @@ if ($content == "Link")
 	// showing the categories and the links in it.
 	$sqlcategories = "SELECT * FROM ".$tbl_categories." ORDER by display_order DESC";
 	$resultcategories = Database::query($sqlcategories) or die;
-	while ($myrow = @ mysql_fetch_array($resultcategories))
+	while ($myrow = @ Database::fetch_array($resultcategories))
 	{
 		$sql_links = "SELECT * FROM ".$link_table.", ".$item_property_table." WHERE category_id='".$myrow["id"]."' AND tool = '".TOOL_LINK."' AND id=ref AND visibility='1' ORDER BY display_order DESC";
 		echo "<table width=\"100%\"><tr><td bgcolor=\"#E6E6E6\"><i>".$myrow["category_title"]."</i></td></tr></table>";
 		$result_links = Database::query($sql_links, __FILE__, __LINE__);
-		while ($myrow = mysql_fetch_array($result_links))
+		while ($myrow = Database::fetch_array($result_links))
 		{
 			echo "<img src='../img/links.gif' />".$myrow["title"];
 			echo "<br>";
@@ -885,7 +885,7 @@ if (($content == "Exercise") or ($content == "HotPotatoes"))
 {
 	$TBL_EXERCICES = Database::get_course_table(TABLE_QUIZ_TEST);
 	$result = Database::query("SELECT * FROM ".$TBL_EXERCICES." WHERE active='1' ORDER BY id ASC");
-	while ($myrow = mysql_fetch_array($result))
+	while ($myrow = Database::fetch_array($result))
 	{
 		echo "<img src='../img/quiz.gif'>".$myrow["title"]."<br>";
 		showorhide_addresourcelink($content, $myrow["id"]);
@@ -899,7 +899,7 @@ if (($content == "Exercise") or ($content == "HotPotatoes"))
 		$documentPath = api_get_path('SYS_COURSE_PATH').$_course['path'].'/document';
 		$sql = "SELECT * FROM ".$TBL_DOCUMENT." WHERE (path LIKE '%htm%' OR path LIKE '%html%') AND path LIKE '".$uploadPath."/%/%' ORDER BY `id` ASC";
 		$result = Database::query($sql, __FILE__, __LINE__);
-		while ($myrow = mysql_fetch_array($result))
+		while ($myrow = Database::fetch_array($result))
 		{
 			$path = $myrow["path"];
 			echo "<img src='../img/jqz.gif'>".GetQuizName($path, $documentPath)."<br>";
@@ -944,7 +944,7 @@ if ($content == "Externallink")
 	$sql = "SELECT * FROM `$tbl_categories` ORDER BY display_order ASC";
 	echo $sql;
 	$result = Database::query($sql, __FILE__, __LINE__);
-	while ($row = mysql_fetch_array($result))
+	while ($row = Database::fetch_array($result))
 	{
 		echo "<option value='".$row["id"]."'>".$row["category_title"]."</option>";
 	}

+ 1 - 1
main/tracking/logins_details.php

@@ -117,7 +117,7 @@ if( ( $is_allowedToTrack || $is_allowedToTrackEverybodyInCourse ) && $_configura
                         AND `u`.`user_id` = '$uInfo'";
     }
     $query = Database::query($sql,__FILE__,__LINE__);
-    $res = @mysql_fetch_array($query);
+    $res = @Database::fetch_array($query);
     if(is_array($res))
     {
         $res[2] == "" ? $res2 = get_lang('NoEmail') : $res2 = Display::encrypted_mailto_link($res[2]);

+ 1 - 1
main/user/user_add.php

@@ -100,7 +100,7 @@ if($register)
 
 		if(mysql_num_rows($result))
 		{
-			while($user=mysql_fetch_array($result))
+			while($user=Database::fetch_array($result))
 			{
 				// check if the user is already registered to the platform
 

+ 39 - 39
main/work/work.php

@@ -396,7 +396,7 @@ if (!empty ($_POST['changeProperties'])) {
 } else {
 	$query = "SELECT * FROM " . $main_course_table . " WHERE code=\"" . $_course['sysCode'] . "\"";
 	$result = Database::query($query, __FILE__, __LINE__);
-	$row = mysql_fetch_array($result);
+	$row = Database::fetch_array($result);
 	$uploadvisibledisabled = $row["show_score"];
 }
 
@@ -414,7 +414,7 @@ Display :: display_introduction_section(TOOL_STUDENTPUBLICATION);
 -----------------------------------------------------------
 */
 if (api_is_allowed_to_edit(null,true)) {
-	
+
 	/*-------------------------------------------
 				DELETE WORK COMMAND
 	-----------------------------------------*/
@@ -441,11 +441,11 @@ if (api_is_allowed_to_edit(null,true)) {
 	  -----------------------------------------*/
 	$qualification_number=0;
 	if (!empty($edit)) {
-		
-		if (api_get_session_id()!=0 && api_is_allowed_to_session_edit(false,true)==false) {		 
+
+		if (api_get_session_id()!=0 && api_is_allowed_to_session_edit(false,true)==false) {
 			api_not_allowed();
 		}
-	
+
 		$sql = "SELECT * FROM  " . $work_table . "  WHERE id='" . $edit . "'";
 		$result = Database::query($sql, __FILE__, __LINE__);
 
@@ -463,11 +463,11 @@ if (api_is_allowed_to_edit(null,true)) {
 		MAKE INVISIBLE WORK COMMAND
 	  -----------------------------------------*/
 
-	if (!empty($make_invisible)) {	
-		if (api_get_session_id()!=0 && api_is_allowed_to_session_edit(false,true)==false) {		 
+	if (!empty($make_invisible)) {
+		if (api_get_session_id()!=0 && api_is_allowed_to_session_edit(false,true)==false) {
 			api_not_allowed();
 		}
-		if (isset($make_invisible) && $make_invisible == "all") {		
+		if (isset($make_invisible) && $make_invisible == "all") {
 			$sql = "ALTER TABLE " . $work_table . "
 						        CHANGE accepted accepted TINYINT(1) DEFAULT '0'";
 
@@ -494,8 +494,8 @@ if (api_is_allowed_to_edit(null,true)) {
 		MAKE VISIBLE WORK COMMAND
 	  -----------------------------------------*/
 
-	if (!empty($make_visible)) { 
-		if (api_get_session_id()!=0 && api_is_allowed_to_session_edit(false,true)==false) {		 
+	if (!empty($make_visible)) {
+		if (api_get_session_id()!=0 && api_is_allowed_to_session_edit(false,true)==false) {
 			api_not_allowed();
 		}
 		if (isset($make_visible) && $make_visible == "all") {
@@ -527,13 +527,13 @@ if (api_is_allowed_to_edit(null,true)) {
 	 * Create dir command
 	 ---------------------*/
 	if (!empty ($_REQUEST['new_dir'])) {
-		
-		
-		if (api_get_session_id()!=0 && api_is_allowed_to_session_edit(false,true)==false) {		 
+
+
+		if (api_get_session_id()!=0 && api_is_allowed_to_session_edit(false,true)==false) {
 			api_not_allowed();
 		}
-		
-		
+
+
 		function get_date_from_select($prefix) {
 				return $_POST[$prefix.'_year'].'-'.two_digits($_POST[$prefix.'_month']).'-'.two_digits($_POST[$prefix.'_day']).' '.two_digits($_POST[$prefix.'_hour']).':'.two_digits($_POST[$prefix.'_minute']).':00';
 		}
@@ -664,25 +664,25 @@ if (api_is_allowed_to_edit(null,true)) {
 	/* -------------------
 	 * Delete dir command
 	 --------------------*/
-	if (!empty ($_REQUEST['delete_dir'])) {		
-		
-		if (api_get_session_id()!=0 && api_is_allowed_to_session_edit(false,true)==false) {		 
+	if (!empty ($_REQUEST['delete_dir'])) {
+
+		if (api_get_session_id()!=0 && api_is_allowed_to_session_edit(false,true)==false) {
 			api_not_allowed();
 		}
-		
+
 		$delete_directory=$_REQUEST['delete_dir'];
 		$id=$_REQUEST['delete2'];
 		del_dir($base_work_dir . '/', $delete_directory,$id);
 		Display :: display_confirmation_message(get_lang('DirDeleted') . ': '.$delete_directory);
 	}
-	if (!empty ($_REQUEST['delete2'])) {	
-		
-		
-		if (api_get_session_id()!=0 && api_is_allowed_to_session_edit(false,true)==false) {		 
+	if (!empty ($_REQUEST['delete2'])) {
+
+
+		if (api_get_session_id()!=0 && api_is_allowed_to_session_edit(false,true)==false) {
 			api_not_allowed();
 		}
-		
-			
+
+
 		$delete_2=$_REQUEST['delete2'];
 		// gets calendar_id from student_publication_assigment
 		$sql = "SELECT add_to_calendar FROM $TSTDPUBASG WHERE publication_id ='$delete_2'";
@@ -761,12 +761,12 @@ else {
 	/*-------------------------------------------
 				DELETE WORK COMMAND
 	-----------------------------------------*/
-	if ($delete) {		
-			
-		if (api_get_session_id()!=0 && api_is_allowed_to_session_edit(false,true)==false) {		 
+	if ($delete) {
+
+		if (api_get_session_id()!=0 && api_is_allowed_to_session_edit(false,true)==false) {
 			api_not_allowed();
 		}
-	
+
 		if ($delete == "all") {
 			/*not authorized to this user */
 		} else {
@@ -800,13 +800,13 @@ else {
 	/*-------------------------------------------
 	           EDIT COMMAND WORK COMMAND
 	  -----------------------------------------*/
-	  
-	if ($edit) {		
-				
-		if (api_get_session_id()!=0 && api_is_allowed_to_session_edit(false,true)==false) {		 
+
+	if ($edit) {
+
+		if (api_get_session_id()!=0 && api_is_allowed_to_session_edit(false,true)==false) {
 			api_not_allowed();
 		}
-		
+
 		//Get the author ID for that document from the item_property table
 		$author_sql = "SELECT * FROM $iprop_table WHERE tool = 'work' AND insert_user_id='$user_id' AND ref=" . $edit;
 		$author_qry = Database::query($author_sql, __FILE__, __LINE__);
@@ -815,7 +815,7 @@ else {
 			$sql = "SELECT * FROM  " . $work_table . "  WHERE id='" . $edit . "'";
 			$result = Database::query($sql, __FILE__, __LINE__);
 			if ($result ) {
-				$row = mysql_fetch_array($result);
+				$row = Database::fetch_array($result);
 				$workTitle = $row['title'];
 				$workAuthor = $row['author'];
 				$workDescription = $row['description'];
@@ -1138,12 +1138,12 @@ endif;
 
 if ($is_course_member) {
 	if (($display_upload_form || $edit)&&!$has_ended) {
-		
-		if (api_get_session_id()!=0 && api_is_allowed_to_session_edit(false,true)==false) {		 
+
+		if (api_get_session_id()!=0 && api_is_allowed_to_session_edit(false,true)==false) {
 			api_not_allowed();
 		}
-		
-		
+
+
 		if ($edit) {
 			//Get the author ID for that document from the item_property table
 			$is_author = false;

+ 0 - 3
tests/main/inc/lib/main_api.lib.test.php

@@ -577,11 +577,8 @@ class TestMainApi extends UnitTestCase {
 	}
 
 	function testApiGetLanguages(){
-		$result=true;
-		$row = mysql_fetch_array($result);
 		$res= api_get_languages();
 		$this->assertTrue($res);
-		$this->assertFalse($row);
 	}
 
 	function testApiGetThemes(){

+ 1 - 1
tests/main/inc/lib/stats.lib.inc.test.php

@@ -134,7 +134,7 @@ class TestStats extends UnitTestCase {
             FROM `".$TABLESTATS_COUNTRIES."`";
     	$i=$i++;
         $resu = mysql_query( $sql );
-        $row = mysql_fetch_array( $resu );
+        $row = Database::fetch_array( $resu );
         $list_countries[$i][0] = $row["code"];
         $list_countries[$i][1] = $row["country"];
 		$res=loadCountries();