Feature #272 - Elimination of mysql_*() function calls.

skala
Ivan Tcholakov 16 years ago
parent 64afee94dd
commit 0ab1c275e1
  1. 12
      index.php
  2. 12
      main/admin/special_exports.php
  3. 20
      main/announcements/announcements.inc.php
  4. 12
      main/coursecopy/classes/CourseBuilder.class.php
  5. 8
      main/document/downloadfolder.inc.php
  6. 6
      main/dropbox/dropbox_class.inc.php
  7. 2
      main/dropbox/dropbox_submit.php
  8. 2
      main/exercice/hotspot_actionscript.as.php
  9. 1
      main/inc/banner.inc.php
  10. 3
      main/inc/global.inc.php
  11. 28
      main/inc/lib/add_course.lib.inc.php
  12. 28
      main/inc/lib/blog.lib.php
  13. 132
      main/inc/lib/document.lib.php
  14. 1
      main/inc/lib/export.lib.inc.php
  15. 2
      main/inc/lib/fileUpload.lib.php
  16. 79
      main/inc/lib/stats.lib.inc.php
  17. 241
      main/inc/lib/statsUtils.lib.inc.php
  18. 438
      main/inc/lib/tracking.lib.php
  19. 2
      main/newscorm/aicc.class.php
  20. 4
      main/newscorm/learnpath.class.php
  21. 2
      main/newscorm/learnpathItem.class.php
  22. 2
      main/online/online_links.php
  23. 1
      main/online/online_streaming.php
  24. 4
      main/permissions/blog_permissions.inc.php
  25. 6
      main/survey/survey.download.inc.php
  26. 2
      main/survey/survey_invitation.php
  27. 2
      main/tracking/userLog.php
  28. 2
      main/tracking/userlogCSV.php
  29. 8
      main/wiki/index.php
  30. 8
      main/work/downloadfolder.inc.php

@ -152,7 +152,7 @@ if (!empty($_POST['submitAuth'])) {
api_session_register('user_last_login_datetime');
}
}
mysql_free_result($result_last_login);
Database::free_result($result_last_login);
//event_login();
if (api_is_platform_admin()) {
@ -231,8 +231,8 @@ if (!empty($_GET['include']) && preg_match('/^[a-zA-Z0-9_-]*\.html$/', $_GET['in
$home_top_temp = file_get_contents($home.'home_top.html');
}
}
if(trim($home_top_temp)=='') {
$home_top_temp = get_lang('PortalHomepageDefaultIntroduction');
if(trim($home_top_temp)=='') {
$home_top_temp = get_lang('PortalHomepageDefaultIntroduction');
}
$open = str_replace('{rel_path}', api_get_path(REL_PATH), $home_top_temp);
echo $open;
@ -443,12 +443,12 @@ function display_anonymous_right_menu() {
echo "</ul>";
echo "</div>";
}
//deleting the myprofile link
if (api_get_setting('allow_social_tool') == true) {
unset($menu_navigation['myprofile']);
unset($menu_navigation['myprofile']);
}
if (!empty($menu_navigation)) {
echo "<div class=\"menusection\">";
echo "<span class=\"menusectioncaption\">".get_lang("MainNavigation")."</span>";

@ -61,7 +61,7 @@ if ((isset ($_POST['action']) && $_POST['action'] == 'course_select_form') || (i
$sql_session = "SELECT id, name FROM $tbl_session ";
$query_session = Database::query($sql_session, __FILE__, __LINE__);
$ListSession = array();
while($rows_session = mysql_fetch_assoc($query_session)) {
while ($rows_session = Database::fetch_assoc($query_session)) {
$ListSession[$rows_session['id']] = $rows_session['name'];
}
$zip_folder=new PclZip($FileZip['TEMP_FILE_ZIP']);
@ -83,7 +83,7 @@ if ((isset ($_POST['action']) && $_POST['action'] == 'course_select_form') || (i
AND `props`.`visibility`<>'2'
AND `props`.`to_group_id`=".$to_group_id."";
$query = Database::query($sql ,__FILE__,__LINE__);
while($rows_course_file = mysql_fetch_assoc($query)) {
while ($rows_course_file = Database::fetch_assoc($query)) {
$zip_folder->add($FileZip['PATH_COURSE'].$_course['directory']."/document".$rows_course_file['path'],
PCLZIP_OPT_ADD_PATH, $_course['directory'],
PCLZIP_OPT_REMOVE_PATH, $FileZip['PATH_COURSE'].$_course['directory']."/document".$FileZip['PATH_REMOVE']
@ -101,7 +101,7 @@ if ((isset ($_POST['action']) && $_POST['action'] == 'course_select_form') || (i
AND `props`.`visibility`<>'2'
AND `props`.`to_group_id`=".$to_group_id."";
$query_session_doc = Database::query($sql_session_doc, __FILE__, __LINE__);
while($rows_course_session_file = mysql_fetch_assoc($query_session_doc)) {
while ($rows_course_session_file = Database::fetch_assoc($query_session_doc)) {
$zip_folder->add($FileZip['PATH_COURSE'].$_course['directory'].'/document'.$rows_course_session_file['path'],
PCLZIP_OPT_ADD_PATH, $_course['directory']."/".$ListSession[$session_id],
PCLZIP_OPT_REMOVE_PATH, $FileZip['PATH_COURSE'].$_course['directory'].'/document'.$FileZip['PATH_REMOVE']
@ -195,7 +195,7 @@ function fullexportspecial(){
AND `props`.`visibility`<>'2'
AND `props`.`to_group_id`=".$to_group_id."";
$query = Database::query($sql ,__FILE__,__LINE__);
while($rows_course_file = mysql_fetch_assoc($query)) {
while ($rows_course_file = Database::fetch_assoc($query)) {
$rows_course_file['path'];
$zip_folder->add($FileZip['PATH_COURSE'].$_course['directory']."/document".$rows_course_file['path'],
PCLZIP_OPT_ADD_PATH, $_course['directory'],
@ -208,7 +208,7 @@ function fullexportspecial(){
INNER JOIN $tbl_session ON id_session = id
WHERE course_code = '$code_course' ";
$query_session = Database::query($sql_session, __FILE__, __LINE__);
while($rows_session = mysql_fetch_assoc($query_session)) {
while ($rows_session = Database::fetch_assoc($query_session)) {
$session_id = $rows_session['id'];
$sql_session_doc = "SELECT path FROM $tbl_document AS docs,$tbl_property AS props
WHERE `props`.`tool`='".TOOL_DOCUMENT."'
@ -219,7 +219,7 @@ function fullexportspecial(){
AND `props`.`visibility`<>'2'
AND `props`.`to_group_id`=".$to_group_id."";
$query_session_doc = Database::query($sql_session_doc, __FILE__, __LINE__);
while($rows_course_session_file = mysql_fetch_assoc($query_session_doc)) {
while ($rows_course_session_file = Database::fetch_assoc($query_session_doc)) {
$zip_folder->add($FileZip['PATH_COURSE'].$_course['directory'].'/document'.$rows_course_session_file['path'],
PCLZIP_OPT_ADD_PATH, $_course['directory']."/".$rows_session['name'],
PCLZIP_OPT_REMOVE_PATH, $FileZip['PATH_COURSE'].$_course['directory'].'/document'.$FileZip['PATH_REMOVE']

@ -254,7 +254,7 @@ function construct_selected_select_form($group_list=null, $user_list=null,$to_al
if (!is_array($to_already_selected) || !in_array("USER:".$this_user['user_id'],$to_already_selected)) // $to_already_selected is the array containing the users (and groups) that are already selected
{
echo "\t\t<option value=\"USER:",$this_user['user_id'],"\">",
"", api_get_person_name($this_user['lastname'], $this_user['firstname']),
"", api_get_person_name($this_user['firstname'], $this_user['lastname']),
"</option>\n";
}
}
@ -357,9 +357,9 @@ function load_edit_users($tool, $id)
$tool = Database::escape_string($tool);
$id = Database::escape_string($id);
$sql="SELECT * FROM $tbl_item_property WHERE tool='$tool' AND ref='$id'";
$result=Database::query($sql,__FILE__,__LINE__) or die (mysql_error());
while ($row=Database::fetch_array($result))
$sql = "SELECT * FROM $tbl_item_property WHERE tool='$tool' AND ref='$id'";
$result = Database::query($sql,__FILE__,__LINE__) or die();
while ($row = Database::fetch_array($result))
{
$to_group=$row['to_group_id'];
switch ($to_group)
@ -754,10 +754,10 @@ function change_visibility_announcement($tool,$id)
$tool = Database::escape_string($tool);
$id = Database::escape_string($id);
$sql="SELECT * FROM $tbl_item_property WHERE tool='$tool' AND ref='$id'";
$sql = "SELECT * FROM $tbl_item_property WHERE tool='$tool' AND ref='$id'";
$result=Database::query($sql,__FILE__,__LINE__) or die (mysql_error());
$row=Database::fetch_array($result);
$result = Database::query($sql,__FILE__,__LINE__) or die();
$row = Database::fetch_array($result);
if ($row['visibility']=='1')
{
@ -858,7 +858,7 @@ function store_advalvas_group_item($emailTitle,$newContent, $order, $to, $to_use
// store in the table announcement
$sql = "INSERT INTO $tbl_announcement SET content = '$newContent', title = '$emailTitle', end_date = NOW(), display_order ='$order', session_id=".intval($_SESSION['id_session']);
$result = Database::query($sql,__FILE__,__LINE__) or die (mysql_error());
$result = Database::query($sql,__FILE__,__LINE__) or die();
if ($result === false) {
return false;
}
@ -924,7 +924,7 @@ function edit_advalvas_item($id,$emailTitle,$newContent,$to,$file = array(), $fi
// store the modifications in the table announcement
$sql = "UPDATE $tbl_announcement SET content='$newContent', title = '$emailTitle' WHERE id='$id'";
$result = Database::query($sql,__FILE__,__LINE__) or die (mysql_error());
$result = Database::query($sql,__FILE__,__LINE__) or die();
// save attachment file
$row_attach = get_attachment($id);
@ -940,7 +940,7 @@ function edit_advalvas_item($id,$emailTitle,$newContent,$to,$file = array(), $fi
// we remove everything from item_property for this
$sql_delete="DELETE FROM $tbl_item_property WHERE ref='$id' AND tool='announcement'";
$result = Database::query($sql_delete,__FILE__,__LINE__) or die (mysql_error());
$result = Database::query($sql_delete,__FILE__,__LINE__) or die();
// store in item_property (first the groups, then the users
if (!is_null($to)) // !is_null($to): when no user is selected we send it to everyone

@ -89,7 +89,7 @@ class CourseBuilder
$this->build_learnpaths();
$this->build_surveys();
$this->build_glossary();
}
//TABLE_LINKED_RESOURCES is the "resource" course table, which is deprecated, apparently
@ -689,7 +689,7 @@ class CourseBuilder
INNER JOIN $tbl_session ON id_session = id
WHERE course_code = '$code_course' ";
$query_session = Database::query($sql_session, __FILE__, __LINE__);
while($rows_session = mysql_fetch_assoc($query_session)) {
while ($rows_session = Database::fetch_assoc($query_session)) {
$session = new CourseSession($rows_session['id'], $rows_session['name']);
$this->course->add_resource($session);
}
@ -697,8 +697,8 @@ class CourseBuilder
}
return $list;
}
function build_wiki($session_id = 0, $course_code = 0)
function build_wiki($session_id = 0, $course_code = 0)
{
if (!empty($session_id) && !empty($course_code)) {
$course_info = api_get_course_info($course_code);
@ -710,10 +710,10 @@ class CourseBuilder
$sql = 'SELECT * FROM ' . $tbl_wiki . ' WHERE session_id = 0';
}
$db_result = api_sql_query($sql, __FILE__, __LINE__);
while ($obj = mysql_fetch_object($db_result))
while ($obj = Database::fetch_object($db_result))
{
$wiki = new Wiki($obj->id, $obj->page_id, $obj->reflink, $obj->title, $obj->content, $obj->user_id, $obj->group_id, $obj->dtime, $obj->progress, $obj->version);
$this->course->add_resource($wiki);
}
}
}
}

@ -82,7 +82,7 @@ if (is_allowed_to_edit())
//search for all files that are not deleted => visibility != 2
$query = Database::query("SELECT path FROM $doc_table AS docs,$prop_table AS props WHERE `props`.`tool`='".TOOL_DOCUMENT."' AND `docs`.`id`=`props`.`ref` AND `docs`.`path` LIKE '".$querypath."/%' AND `docs`.`filetype`='file' AND `props`.`visibility`<>'2' AND `props`.`to_group_id`=".$to_group_id."",__FILE__,__LINE__);
//add tem to the zip file
while($not_deleted_file = mysql_fetch_assoc($query))
while ($not_deleted_file = Database::fetch_assoc($query))
{
$zip_folder->add($sys_course_path.$_course['path']."/document".$not_deleted_file['path'],PCLZIP_OPT_REMOVE_PATH, $sys_course_path.$_course['path']."/document".$remove_dir);
}
@ -104,7 +104,7 @@ else
//1st: get all files that are visible in the given path
$query = Database::query("SELECT path FROM $doc_table AS docs,$prop_table AS props WHERE `props`.`tool`='".TOOL_DOCUMENT."' AND `docs`.`id`=`props`.`ref` AND `docs`.`path` LIKE '".$querypath."/%' AND `props`.`visibility`='1' AND `docs`.`filetype`='file' AND `props`.`to_group_id`=".$to_group_id,__FILE__,__LINE__);
//add them to an array
while($all_visible_files = mysql_fetch_assoc($query))
while ($all_visible_files = Database::fetch_assoc($query))
{
$all_visible_files_path[] = $all_visible_files['path'];
//echo "visible files: ".$sys_course_path.$_course['path']."/document".$all_visible_files['path']."<br>";
@ -118,13 +118,13 @@ else
if(Database::num_rows($query2)>0)
{
//add tem to an array
while($invisible_folders = mysql_fetch_assoc($query2))
while ($invisible_folders = Database::fetch_assoc($query2))
{
//3rd: get all files that are in the found invisible folder (these are "invisible" too)
//echo "<br><br>invisible folders: ".$sys_course_path.$_course['path']."/document".$invisible_folders['path']."<br>";
$query3 = Database::query("SELECT path FROM $doc_table AS docs,$prop_table AS props WHERE `props`.`tool`='".TOOL_DOCUMENT."' AND `docs`.`id`=`props`.`ref` AND `docs`.`path` LIKE '".$invisible_folders['path']."/%' AND `docs`.`filetype`='file' AND `props`.`visibility`='1'",__FILE__,__LINE__);
//add tem to an array
while($files_in_invisible_folder = mysql_fetch_assoc($query3))
while ($files_in_invisible_folder = Database::fetch_assoc($query3))
{
$files_in_invisible_folder_path[] = $files_in_invisible_folder['path'];
//echo "<br><br>files in invisible folders: ".$sys_course_path.$_course['path']."/document".$files_in_invisible_folder['path']." <b>id ".$files_in_invisible_folder['id']."</b><br>";

@ -39,7 +39,7 @@
* @version 1.30
* @copyright 2004
* @author Jan Bols <jan@ivpv.UGent.be>
* with contributions by René Haentjens <rene.haentjens@UGent.be> (see RH)
* with contributions by René Haentjens <rene.haentjens@UGent.be> (see RH)
* @package dokeos.dropbox
*/
class Dropbox_Work {
@ -69,7 +69,7 @@ class Dropbox_Work {
* @return Dropbox_Work
*/
function Dropbox_Work ($arg1, $arg2=null, $arg3=null, $arg4=null, $arg5=null, $arg6=null) {
if (func_num_args()>1) {
$this->_createNewWork($arg1, $arg2, $arg3, $arg4, $arg5, $arg6);
} else {
@ -647,7 +647,7 @@ class Dropbox_Person
*/
function filter_received_work($type,$value) {
global $dropbox_cnf;
$new_received_work = array();
foreach ($this->receivedWork as $index => $work) {
switch ($type) {

@ -340,7 +340,7 @@ if ( isset( $_GET['mailingIndex'])) // examine or send
$result = Database::query($sel . $thisRecip . "'",__FILE__,__LINE__);
while ( ($res = Database::fetch_array($result))) {$students[] = $res;}
mysql_free_result($result);
Database::free_result($result);
if (count($students) == 1)
{

@ -39,7 +39,7 @@ $output = "hotspot_lang=$courseLang&hotspot_image=$pictureName&hotspot_image_wid
$i = 0;
$nmbrTries = 0;
while ($hotspot = mysql_fetch_assoc($result))
while ($hotspot = Database::fetch_assoc($result))
{
$output .= "&hotspot_".$hotspot['id']."=true";
$output .= "&hotspot_".$hotspot['id']."_answer=".str_replace('&','{amp}',$hotspot['answer']);

@ -413,7 +413,6 @@ if (isset ($dokeos_database_connection)) {
// if multiple database, prefix table names with the course database name in SQL queries (or no prefix if the table is in
// the main database)
// (ex. SELECT * FROM `table_from_main_db` - SELECT * FROM `courseDB`.`table_from_course_db`)
//mysql_select_db($_configuration['main_database'], $dokeos_database_connection);
Database::select_db($_configuration['main_database'], $dokeos_database_connection);
}
?>

@ -95,7 +95,6 @@ if (empty($_configuration['statistics_database']) && $already_installed) {
}
// Connect to the server database and select the main dokeos database.
//if (!($dokeos_database_connection = @mysql_connect($_configuration['db_host'], $_configuration['db_user'], $_configuration['db_password']))) {
if (!($dokeos_database_connection = @Database::connect(
array(
'server' => $_configuration['db_host'],
@ -118,7 +117,6 @@ if (!$_configuration['db_host']) {
// The system has not been designed to use special SQL modes that were introduced since MySQL 5.
Database::query("set session sql_mode='';", __FILE__, __LINE__);
//if (!mysql_select_db($_configuration['main_database'], $dokeos_database_connection)) {
if (!Database::select_db($_configuration['main_database'], $dokeos_database_connection)) {
$global_error_code = 5;
// Connection to the main Dokeos database is impossible, it might be missing or restricted or its configuration option might be incorrect.
@ -334,7 +332,6 @@ if (api_get_setting('server_type') == 'test') {
}
}
/*
-----------------------------------------------------------
LOAD LANGUAGE FILES SECTION

@ -1623,7 +1623,7 @@ function update_Db_course($courseDbName, $language = null)
PRIMARY KEY (survey_id)
)" . $charset_clause;
$result = Database::query($sql,__FILE__,__LINE__) or die(mysql_error($sql));
$result = Database::query($sql,__FILE__,__LINE__) or die();
$sql = "ALTER TABLE `".$TABLESURVEY."` ADD INDEX ( session_id )";
Database::query($sql,__FILE__,__LINE__);
@ -1638,7 +1638,7 @@ function update_Db_course($courseDbName, $language = null)
session_id SMALLINT(5) UNSIGNED NOT NULL default 0,
PRIMARY KEY (survey_invitation_id)
)" . $charset_clause;
$result = Database::query($sql, __FILE__, __LINE__) or die(mysql_error($sql));
$result = Database::query($sql, __FILE__, __LINE__) or die();
$sql = "CREATE TABLE `".$TABLESURVEYQUESTION."` (
question_id int unsigned NOT NULL auto_increment,
@ -1655,7 +1655,7 @@ function update_Db_course($courseDbName, $language = null)
survey_group_sec2 int unsigned NOT NULL default '0',
PRIMARY KEY (question_id)
)" . $charset_clause;
$result = Database::query($sql, __FILE__, __LINE__) or die(mysql_error($sql));
$result = Database::query($sql, __FILE__, __LINE__) or die();
$sql ="CREATE TABLE `".$TABLESURVEYQUESTIONOPTION."` (
question_option_id int unsigned NOT NULL auto_increment,
@ -1666,7 +1666,7 @@ function update_Db_course($courseDbName, $language = null)
value int NOT NULL default '0',
PRIMARY KEY (question_option_id)
)" . $charset_clause;
$result = Database::query($sql, __FILE__, __LINE__) or die(mysql_error($sql));
$result = Database::query($sql, __FILE__, __LINE__) or die();
$sql = "CREATE TABLE `".$TABLESURVEYANSWER."` (
answer_id int unsigned NOT NULL auto_increment,
@ -1677,7 +1677,7 @@ function update_Db_course($courseDbName, $language = null)
user varchar(250) NOT NULL,
PRIMARY KEY (answer_id)
)" . $charset_clause;
$result = Database::query($sql, __FILE__, __LINE__) or die(mysql_error($sql));
$result = Database::query($sql, __FILE__, __LINE__) or die();
$sql = "CREATE TABLE `".$TABLESURVEYGROUP."` (
id int unsigned NOT NULL auto_increment,
@ -1687,7 +1687,7 @@ function update_Db_course($courseDbName, $language = null)
PRIMARY KEY (id)
)" . $charset_clause;
$result = Database::query($sql, __FILE__, __LINE__) or die(mysql_error($sql));
$result = Database::query($sql, __FILE__, __LINE__) or die();
// table glosary
$sql = "CREATE TABLE `".$TBL_GLOSSARY."` (
@ -1698,7 +1698,7 @@ function update_Db_course($courseDbName, $language = null)
session_id smallint default 0,
PRIMARY KEY (glossary_id)
)" . $charset_clause;
$result = Database::query($sql, __FILE__, __LINE__) or die(mysql_error($sql));
$result = Database::query($sql, __FILE__, __LINE__) or die();
$sql = "ALTER TABLE `".$TBL_GLOSSARY . "` ADD INDEX ( session_id ) ";
Database::query($sql, __FILE__, __LINE__);
@ -1715,7 +1715,7 @@ function update_Db_course($courseDbName, $language = null)
status int,
PRIMARY KEY (notebook_id)
)" . $charset_clause;
$result = Database::query($sql, __FILE__, __LINE__) or die(mysql_error($sql));
$result = Database::query($sql, __FILE__, __LINE__) or die();
/* Attendance tool */
@ -1731,7 +1731,7 @@ function update_Db_course($courseDbName, $language = null)
attendance_weight float(6,2) NOT NULL default '0.0',
session_id int NOT NULL default 0
)" . $charset_clause;
$result = Database::query($sql, __FILE__, __LINE__) or die(mysql_error($sql));
$result = Database::query($sql, __FILE__, __LINE__) or die();
$sql = "ALTER TABLE `".$TBL_ATTENDANCE . "` ADD INDEX (session_id)";
Database::query($sql, __FILE__, __LINE__);
$sql = "ALTER TABLE `".$TBL_ATTENDANCE . "` ADD INDEX (active)";
@ -1745,7 +1745,7 @@ function update_Db_course($courseDbName, $language = null)
presence tinyint(3) NOT NULL DEFAULT 0,
PRIMARY KEY(user_id, attendance_calendar_id)
)" . $charset_clause;
$result = Database::query($sql, __FILE__, __LINE__) or die(mysql_error($sql));
$result = Database::query($sql, __FILE__, __LINE__) or die();
$sql = "ALTER TABLE `".$TBL_ATTENDANCE_SHEET . "` ADD INDEX (presence) ";
Database::query($sql, __FILE__, __LINE__);
@ -1758,7 +1758,7 @@ function update_Db_course($courseDbName, $language = null)
done_attendance tinyint(3) NOT NULL default 0,
PRIMARY KEY(id)
)" . $charset_clause;
$result = Database::query($sql, __FILE__, __LINE__) or die(mysql_error($sql));
$result = Database::query($sql, __FILE__, __LINE__) or die();
$sql = "ALTER TABLE `".$TBL_ATTENDANCE_CALENDAR."` ADD INDEX (attendance_id)";
Database::query($sql, __FILE__, __LINE__);
$sql = "ALTER TABLE `".$TBL_ATTENDANCE_CALENDAR."` ADD INDEX (done_attendance)";
@ -1772,7 +1772,7 @@ function update_Db_course($courseDbName, $language = null)
attendance_id int NOT NULL,
score int NOT NULL DEFAULT 0
)" . $charset_clause;
$result = Database::query($sql, __FILE__, __LINE__) or die(mysql_error($sql));
$result = Database::query($sql, __FILE__, __LINE__) or die();
$sql = "ALTER TABLE `".$TBL_ATTENDANCE_RESULT."` ADD INDEX (attendance_id)";
Database::query($sql, __FILE__, __LINE__);
$sql = "ALTER TABLE `".$TBL_ATTENDANCE_RESULT."` ADD INDEX (user_id)";
@ -2069,10 +2069,10 @@ function fill_Db_course($courseDbName, $courseRepository, $language,$default_doc
include (api_get_path(SYS_CODE_PATH) . "lang/english/create_course.inc.php");
$file_to_include = "lang/".$language . "/create_course.inc.php";
if (file_exists($file_to_include))
if (file_exists($file_to_include)) {
include (api_get_path(SYS_CODE_PATH) . $file_to_include);
}
//mysql_select_db("$courseDbName");
Database::select_db("$courseDbName");
/*

@ -224,7 +224,7 @@ class Blog {
public static function create_post ($title, $full_text, $file_comment, $blog_id) {
global $_user;
global $_course;
$blog_table_attachment = Database::get_course_table(TABLE_BLOGS_ATTACHMENT);
$upload_ok=true;
$has_attachment=false;
@ -640,7 +640,7 @@ class Blog {
WHERE task_rel_user.user_id = ".(int)$_user['user_id']." ORDER BY target_date ASC";
$result = Database::query($sql, __FILE__, __LINE__);
if(mysql_numrows($result) > 0)
if (Database::num_rows($result) > 0)
{
echo '<ul>';
while($mytask = Database::fetch_array($result))
@ -1868,7 +1868,7 @@ class Blog {
$arrUserTasks = array();
while($row = mysql_fetch_assoc($result))
while ($row = Database::fetch_assoc($result))
{
$arrUserTasks[] = $row['task_id'];
}
@ -1882,7 +1882,7 @@ class Blog {
AND user_id = '".(int)$user_id."'
AND task_id = '".(int)$task_id."'";
$result = Database::query($sql, __FILE__, __LINE__);
$row = mysql_fetch_assoc($result);
$row = Database::fetch_assoc($result);
$old_date = $row['target_date'];
$date = explode('-', $row['target_date']);
@ -2021,7 +2021,7 @@ class Blog {
";
$result = @Database::query($sql, __FILE__, __LINE__);
$row = mysql_fetch_assoc($result);
$row = Database::fetch_assoc($result);
if($row['number'] == 0)
{
@ -2056,7 +2056,7 @@ class Blog {
";
$result = @Database::query($sql, __FILE__, __LINE__);
$row = mysql_fetch_assoc($result);
$row = Database::fetch_assoc($result);
if($row['number'] == 0 || ($row['number'] != 0 && $task_id == $old_task_id && $user_id == $old_user_id))
{
@ -2094,7 +2094,7 @@ class Blog {
FROM $tbl_blogs_tasks
WHERE task_id = '".(int)$task_id."'";
$result = Database::query($sql, __FILE__, __LINE__);
$row = mysql_fetch_assoc($result);
$row = Database::fetch_assoc($result);
// Get posts and authors
$sql = "
SELECT
@ -2318,7 +2318,6 @@ class Blog {
ON user.user_id = blogs_rel_user.user_id
WHERE blogs_rel_user.blog_id = '".(int)$blog_id."'";
//$sql_result = mysql_query($sql_query) or die(mysql_error());
if (!($sql_result = Database::query($sql_query, __FILE__, __LINE__))) {
return false;
}
@ -2343,7 +2342,6 @@ class Blog {
INNER JOIN " . Database::get_course_table(TABLE_BLOGS_TASKS) . " bt ON btu.task_id = bt.task_id
WHERE btu.blog_id = $blog_id AND btu.user_id = " . $myrow['user_id'] . "";
//$sql_res = mysql_query($sql) or die(mysql_error());
if (!($sql_res = Database::query($sql, __FILE__, __LINE__))) {
die();
}
@ -2574,7 +2572,7 @@ class Blog {
ORDER BY target_date ASC";
$result = Database::query($sql, __FILE__, __LINE__);
if(mysql_numrows($result) > 0)
if (Database::num_rows($result) > 0)
{
while($mytask = Database::fetch_array($result))
{
@ -2879,7 +2877,7 @@ class Blog {
function get_blog_attachment($blog_id, $post_id=null,$comment_id=null)
{
$blog_table_attachment = Database::get_course_table(TABLE_BLOGS_ATTACHMENT);
$blog_id = Database::escape_string($blog_id);
$comment_id = Database::escape_string($comment_id);
$post_id = Database::escape_string($post_id);
@ -2898,9 +2896,9 @@ function get_blog_attachment($blog_id, $post_id=null,$comment_id=null)
}
$where.=' comment_id ="'.$comment_id.'" ';
}
$sql = 'SELECT path, filename, comment FROM '. $blog_table_attachment.' WHERE blog_id ="'.intval($blog_id).'" '.$where;
$result=Database::query($sql, __FILE__, __LINE__);
if (Database::num_rows($result)!=0)
{
@ -2920,8 +2918,8 @@ function get_blog_attachment($blog_id, $post_id=null,$comment_id=null)
function delete_all_blog_attachment($blog_id,$post_id=null,$comment_id=null)
{
global $_course;
global $_course;
$blog_table_attachment = Database::get_course_table(TABLE_BLOGS_ATTACHMENT);
$blog_id = Database::escape_string($blog_id);
$comment_id = Database::escape_string($comment_id);

@ -310,9 +310,9 @@ class DocumentManager {
*/
public static function file_visible_to_user ($this_course, $doc_url) {
$current_session_id = api_get_session_id();
$is_allowed_to_edit = api_is_allowed_to_edit(null,true);
if ($is_allowed_to_edit)
{
return true;
@ -521,8 +521,8 @@ class DocumentManager {
//the given path will not end with a slash, unless it's the root '/'
//so no root -> add slash
$added_slash = ($path == '/') ? '' : '/';
//condition for the session
//condition for the session
$current_session_id = api_get_session_id();
$condition_session = " AND (id_session = '$current_session_id' OR (id_session = '0' AND insert_date <= (SELECT creation_date FROM $TABLE_COURSE WHERE code = '{$_course[id]}')))";
@ -533,10 +533,10 @@ class DocumentManager {
AND docs.path NOT LIKE '".$path.$added_slash."%/%'
AND last.tool = '".TOOL_DOCUMENT."'
AND ".$to_field." = ".$to_value."
AND last.visibility".$visibility_bit . $condition_session;
AND last.visibility".$visibility_bit . $condition_session;
$result = Database::query($sql,__FILE__,__LINE__);
if ($result && Database::num_rows($result) != 0)
{
while ($row = Database::fetch_array($result,'ASSOC'))
@ -567,7 +567,7 @@ class DocumentManager {
}
else
{
//display_error("Error getting document info from database (".mysql_error().")!");
//display_error("Error getting document info from database (".Database::error().")!");
return false;
}
}
@ -601,9 +601,9 @@ class DocumentManager {
$sql = "SELECT path
FROM ".$TABLE_ITEMPROPERTY." AS last, ".$TABLE_DOCUMENT." AS docs
WHERE docs.id = last.ref
AND docs.filetype = 'folder'
AND last.tool = '".TOOL_DOCUMENT."'
AND last.to_group_id = ".$to_group_id."
AND docs.filetype = 'folder'
AND last.tool = '".TOOL_DOCUMENT."'
AND last.to_group_id = ".$to_group_id."
AND last.visibility <> 2 $condition_session";
$result = Database::query($sql, __FILE__, __LINE__);
@ -636,9 +636,9 @@ class DocumentManager {
$visible_sql = "SELECT path
FROM ".$TABLE_ITEMPROPERTY." AS last, ".$TABLE_DOCUMENT." AS docs
WHERE docs.id = last.ref
AND docs.filetype = 'folder'
AND last.tool = '".TOOL_DOCUMENT."'
AND last.to_group_id = ".$to_group_id."
AND docs.filetype = 'folder'
AND last.tool = '".TOOL_DOCUMENT."'
AND last.to_group_id = ".$to_group_id."
AND last.visibility = 1 $condition_session";
$visibleresult = Database::query($visible_sql, __FILE__, __LINE__);
while ($all_visible_folders = Database::fetch_array($visibleresult,'ASSOC'))
@ -653,9 +653,9 @@ class DocumentManager {
$invisible_sql = "SELECT path
FROM ".$TABLE_ITEMPROPERTY." AS last, ".$TABLE_DOCUMENT." AS docs
WHERE docs.id = last.ref
AND docs.filetype = 'folder'
AND last.tool = '".TOOL_DOCUMENT."'
AND last.to_group_id = ".$to_group_id."
AND docs.filetype = 'folder'
AND last.tool = '".TOOL_DOCUMENT."'
AND last.to_group_id = ".$to_group_id."
AND last.visibility = 0 $condition_session";
$invisibleresult = Database::query($invisible_sql, __FILE__, __LINE__);
while ($invisible_folders = Database::fetch_array($invisibleresult,'ASSOC'))
@ -668,10 +668,10 @@ class DocumentManager {
$folder_in_invisible_sql = "SELECT path
FROM ".$TABLE_ITEMPROPERTY." AS last, ".$TABLE_DOCUMENT." AS docs
WHERE docs.id = last.ref
AND docs.path LIKE '".Database::escape_string($invisible_folders['path'])."/%'
AND docs.filetype = 'folder'
AND last.tool = '".TOOL_DOCUMENT."'
AND last.to_group_id = ".$to_group_id."
AND docs.path LIKE '".Database::escape_string($invisible_folders['path'])."/%'
AND docs.filetype = 'folder'
AND last.tool = '".TOOL_DOCUMENT."'
AND last.to_group_id = ".$to_group_id."
AND last.visibility = 1 $condition_session";
$folder_in_invisible_result = Database::query($folder_in_invisible_sql, __FILE__, __LINE__);
while ($folders_in_invisible_folder = Database::fetch_array($folder_in_invisible_result,'ASSOC'))
@ -848,7 +848,7 @@ class DocumentManager {
//$remove_from_item_property_sql = "DELETE FROM ".$TABLE_ITEMPROPERTY." WHERE ref = ".$row['id']." AND tool='".TOOL_DOCUMENT."'";
api_item_property_update($_course, TOOL_DOCUMENT, $row['id'], 'delete', api_get_user_id(),null,null,null,null,$current_session_id);
//query to delete from document table
$remove_from_document_sql = "DELETE FROM ".$TABLE_DOCUMENT." WHERE id = ".$row['id']."";
self::unset_document_as_template($row['id'],$_course, api_get_user_id());
@ -879,7 +879,7 @@ class DocumentManager {
else //set visibility to 2 and rename file/folder to qsdqsd_DELETED_#id
{
if (api_item_property_update($_course, TOOL_DOCUMENT, $document_id, 'delete', api_get_user_id(),null,null,null,null,$current_session_id))
{
{
//echo('item_property_update OK');
if (is_file($base_work_dir.$path) || is_dir($base_work_dir.$path) )
{
@ -1093,8 +1093,8 @@ class DocumentManager {
return false;
}
}
/**
* Gets the list of included resources as a list of absolute or relative paths from a html file or string html
* This allows for a better SCORM export or replace urls inside content html from copy course
@ -1102,7 +1102,7 @@ class DocumentManager {
* stuff included in the source of the current item. The current item is expected
* to be an HTML file or string html. If it is not, then the function will return and empty list.
* @param string source html (content or path)
* @param bool is file or string html
* @param bool is file or string html
* @param string type (one of the Dokeos tools) - optional (otherwise takes the current item's type)
* @param int level of recursivity we're in
* @return array List of file paths. An additional field containing 'local' or 'remote' helps determine if the file should be copied into the zip or just linked
@ -1113,7 +1113,7 @@ class DocumentManager {
$attributes = array();
$wanted_attributes = array('src','url','@import','href','value');
$abs_path = '';
if ($recursivity > $max) {
return array();
}
@ -1121,12 +1121,12 @@ class DocumentManager {
if (!isset($type)) {
$type = TOOL_DOCUMENT;
}
if (!$is_file) {
$attributes = DocumentManager::parse_HTML_attributes($source_html,$wanted_attributes);
} else {
if (is_file($source_html)) {
$abs_path = $source_html;
} else {
if (is_file($source_html)) {
$abs_path = $source_html;
//for now, read the whole file in one go (that's gonna be a problem when the file is too big)
$info = pathinfo($abs_path);
$ext = $info['extension'];
@ -1139,7 +1139,7 @@ class DocumentManager {
$attributes = DocumentManager::parse_HTML_attributes($file_content,$wanted_attributes);
break;
default : break;
}
}
} else {
return false;
}
@ -1153,7 +1153,7 @@ class DocumentManager {
foreach($wanted_attributes as $attr)
{
if(isset($attributes[$attr]))
{
{
//find which kind of path these are (local or remote)
$sources = $attributes[$attr];
foreach($sources as $source)
@ -1217,7 +1217,7 @@ class DocumentManager {
if(strpos($second_part,api_get_path(WEB_PATH))!==false)
{
//we found the current portal url
$files_list[] = array($second_part,'local','url');
$files_list[] = array($second_part,'local','url');
$in_files_list[] = DocumentManager::get_resources_from_source_html($second_part, true, TOOL_DOCUMENT, recursivity+1);
if(count($in_files_list)>0)
{
@ -1234,7 +1234,7 @@ class DocumentManager {
{
if(substr($second_part,0,1) === '/')
{ //link starts with a /, making it absolute (relative to DocumentRoot)
$files_list[] = array($second_part,'local','abs');
$files_list[] = array($second_part,'local','abs');
$in_files_list[] = DocumentManager::get_resources_from_source_html($second_part, true, TOOL_DOCUMENT,$recursivity+1);
if(count($in_files_list)>0)
{
@ -1250,7 +1250,7 @@ class DocumentManager {
if (!empty($abs_path)) {
$dir = dirname($abs_path).'/';
}
$new_abs_path = realpath($dir.$second_part);
$new_abs_path = realpath($dir.$second_part);
$in_files_list[] = DocumentManager::get_resources_from_source_html($new_abs_path, true, TOOL_DOCUMENT,$recursivity+1);
if(count($in_files_list)>0)
{
@ -1263,12 +1263,12 @@ class DocumentManager {
{
$second_part = substr($second_part,2);
}
$files_list[] = array($second_part,'local','rel');
$files_list[] = array($second_part,'local','rel');
$dir = '';
if (!empty($abs_path)) {
$dir = dirname($abs_path).'/';
}
$new_abs_path = realpath($dir.$second_part);
$new_abs_path = realpath($dir.$second_part);
$in_files_list[] = DocumentManager::get_resources_from_source_html($new_abs_path, true, TOOL_DOCUMENT,$recursivity+1);
if(count($in_files_list)>0)
{
@ -1283,7 +1283,7 @@ class DocumentManager {
if(strpos($source,api_get_path(WEB_PATH))!==false)
{
//we found the current portal url
$files_list[] = array($source,'local','url');
$files_list[] = array($source,'local','url');
$in_files_list[] = DocumentManager::get_resources_from_source_html($source, true, TOOL_DOCUMENT, $recursivity+1);
if(count($in_files_list)>0)
{
@ -1301,7 +1301,7 @@ class DocumentManager {
//no protocol found, make link local
if(substr($source,0,1) === '/')
{ //link starts with a /, making it absolute (relative to DocumentRoot)
$files_list[] = array($source,'local','abs');
$files_list[] = array($source,'local','abs');
$in_files_list[] = DocumentManager::get_resources_from_source_html($source, true, TOOL_DOCUMENT, $recursivity+1);
if(count($in_files_list)>0)
{
@ -1310,12 +1310,12 @@ class DocumentManager {
}
elseif(strstr($source,'..') === 0)
{ //link is relative but going back in the hierarchy
$files_list[] = array($source,'local','rel');
$files_list[] = array($source,'local','rel');
$dir = '';
if (!empty($abs_path)) {
$dir = dirname($abs_path).'/';
}
$new_abs_path = realpath($dir.$source);
$new_abs_path = realpath($dir.$source);
$in_files_list[] = DocumentManager::get_resources_from_source_html($new_abs_path, true, TOOL_DOCUMENT, $recursivity+1);
if(count($in_files_list)>0)
{
@ -1346,7 +1346,7 @@ class DocumentManager {
if(strpos($source,api_get_path(WEB_PATH))!==false)
{
//we found the current portal url
$files_list[] = array($source,'local','url');
$files_list[] = array($source,'local','url');
$in_files_list[] = DocumentManager::get_resources_from_source_html($source, true, TOOL_DOCUMENT, $recursivity+1);
if(count($in_files_list)>0)
{
@ -1373,12 +1373,12 @@ class DocumentManager {
}
elseif(strpos($source,'..') === 0)
{ //link is relative but going back in the hierarchy
$files_list[] = array($source,'local','rel');
$files_list[] = array($source,'local','rel');
$dir = '';
if (!empty($abs_path)) {
$dir = dirname($abs_path).'/';
}
$new_abs_path = realpath($dir.$source);
$new_abs_path = realpath($dir.$source);
$in_files_list[] = DocumentManager::get_resources_from_source_html($new_abs_path, true, TOOL_DOCUMENT,$recursivity+1);
if(count($in_files_list)>0)
{
@ -1388,7 +1388,7 @@ class DocumentManager {
else
{ //no starting '/', making it relative to current document's path
if(substr($source,0,2) == './')
{
{
$source = substr($source,2);
}
$files_list[] = array($source,'local','rel');
@ -1396,7 +1396,7 @@ class DocumentManager {
if (!empty($abs_path)) {
$dir = dirname($abs_path).'/';
}
$new_abs_path = realpath($dir.$source);
$new_abs_path = realpath($dir.$source);
$in_files_list[] = DocumentManager::get_resources_from_source_html($new_abs_path, true, TOOL_DOCUMENT, $recursivity+1);
if(count($in_files_list)>0)
{
@ -1414,8 +1414,8 @@ class DocumentManager {
$checked_files_list = array();
$checked_array_list = array();
if (count($files_list ) > 0) {
if (count($files_list ) > 0) {
foreach($files_list as $idx => $file)
{
if(!empty($file[0]))
@ -1523,7 +1523,7 @@ class DocumentManager {
* @return string new content html with replaced urls or return false if content is not a string
*/
function replace_urls_inside_content_html_from_copy_course($content_html, $origin_course_code, $destination_course_directory) {
if (!is_string($content_html)) {
return false;
}
@ -1533,14 +1533,14 @@ class DocumentManager {
$orig_course_path = api_get_path(SYS_PATH).'courses/'.$orig_course_info['path'].'/';
$destination_course_code = CourseManager::get_course_id_from_path ($destination_course_directory);
$dest_course_path = api_get_path(SYS_COURSE_PATH).$destination_course_directory.'/';
foreach ($orig_source_html as $source) {
//var_dump($source);
// get information about source url
$real_orig_url = $source[0]; // url
$real_orig_url = $source[0]; // url
$scope_url = $source[1]; // scope (local, remote)
$type_url = $source[2]; // tyle (rel, abs, url)
@ -1548,16 +1548,16 @@ class DocumentManager {
$orig_parse_url = parse_url($real_orig_url);
$real_orig_path = $orig_parse_url['path'];
$real_orig_query = $orig_parse_url['query'];
// replace origin course code by destination course code from origin url query
$dest_url_query = '';
if (!empty($real_orig_query)) {
$dest_url_query = '';
if (!empty($real_orig_query)) {
$dest_url_query = '?'.$real_orig_query;
if (strpos($dest_url_query,$origin_course_code) !== false) {
$dest_url_query = str_replace($origin_course_code,$destination_course_code,$dest_url_query);
}
}
}
if ($scope_url == 'local') {
if ( $type_url == 'abs' || $type_url == 'rel') {
$document_file = strstr($real_orig_path,'document');
@ -1565,7 +1565,7 @@ class DocumentManager {
$origin_filepath = $orig_course_path.$document_file;
$destination_filepath = $dest_course_path.$document_file;
// copy origin file inside destination course
if (file_exists($origin_filepath)) {
if (file_exists($origin_filepath)) {
$filepath_dir = dirname($destination_filepath);
if (!is_dir($filepath_dir)) {
$perm = api_get_setting('permissions_for_new_directories');
@ -1575,27 +1575,27 @@ class DocumentManager {
if (!file_exists($destination_filepath)) {
@copy($origin_filepath,$destination_filepath);
}
}
}
// replace origin course path by destination course path
if (strpos($content_html,$real_orig_url) !== false) {
$url_course_path = str_replace($orig_course_info['path'].'/'.$document_file,'',$real_orig_path);
$destination_url = $url_course_path.$destination_course_directory.'/'.$document_file.$dest_url_query;
$destination_url = $url_course_path.$destination_course_directory.'/'.$document_file.$dest_url_query;
$content_html = str_replace($real_orig_url,$destination_url, $content_html);
}
}
}
// replace origin course code by destination course code from origin url
if (strpos($real_orig_url,'?') === 0) {
$dest_url = str_replace($origin_course_code,$destination_course_code,$real_orig_url);
$content_html = str_replace($real_orig_url,$dest_url, $content_html);
$content_html = str_replace($real_orig_url,$dest_url, $content_html);
}
}
}
}
return $content_html;
}
return $content_html;
}
}
//end class DocumentManager
?>

@ -195,7 +195,6 @@ function backupDatabase($link, $db_name, $structure, $donnees, $format = 'SQL',
$error_no['backup'][] = '1';
return false;
}
//mysql_select_db($db_name);
Database::select_db($db_name);
$format = strtolower($format);
$filename = $whereSave.'/courseDbContent.'.$format;

@ -1149,7 +1149,7 @@ function add_document($_course,$path,$filetype,$filesize,$title,$comment=NULL, $
}
else
{
//display_error("The uploaded file could not be added to the database (".mysql_error().")!");
//display_error("The uploaded file could not be added to the database (".Database::error().")!");
return false;
}
}

@ -85,7 +85,6 @@ $TABLESTATS_REFERERS = $_configuration['statistics_database']."`.`track_c_ref
/**
* @author Sebastien Piraux <piraux_seb@hotmail.com>
* @desc uses `$TABLETRACK_OPEN` to split recorded
information, to count occurences (for os, provider,...)
@ -101,18 +100,15 @@ function decodeOpenInfos() {
ignore_user_abort(1) ;
// we take the last event id to prevent miss of some recorded event
// only processed record have to be cleaned
$sql = "SELECT open_id
FROM `$TABLETRACK_OPEN`
WHERE open_date <= NOW()
ORDER BY open_id DESC
LIMIT 1";
//$processBegin = getOneResult($sql);
$query = @mysql_query($sql);
if (mysql_errno()) {
echo "\n<!-- **** ".mysql_errno().": ".mysql_error()." In : $sql **** -->\n";
}
$res = @mysql_fetch_array($query);
$query = Database::query($sql, __FILE__, __LINE__);
$res = @Database::fetch_array($query);
$processBegin = $res[0];
// process
@ -122,8 +118,8 @@ function decodeOpenInfos() {
FROM `$TABLETRACK_OPEN`
WHERE open_remote_host != ''
AND open_id <= '".$processBegin."' ";
$query = Database::query($sql,__FILE__, __LINE__);
$query = Database::query($sql, __FILE__, __LINE__);
if(Database::num_rows($query) != 0) {
// load list of countries
$list_countries = loadCountries();
@ -197,6 +193,7 @@ function decodeOpenInfos() {
// reset to the initial value
ignore_user_abort($ignore);
}
/***************************************************************************
*
* Utils
@ -204,14 +201,13 @@ function decodeOpenInfos() {
***************************************************************************/
/**
* @author Sebastien Piraux <piraux_seb@hotmail.com>
* @param limit : all records BEFORE $limit will be affected
* @desc this function will delete the remote_host, user_agent
and referer rows from the track_open table recorded before
the date $limit. OPTIMIZE is called to get back the memory
espaces deleted
*/
*/
function cleanProcessedRecords( $limit ) {
global $TABLETRACK_OPEN;
$sql = "UPDATE `".$TABLETRACK_OPEN."`
@ -222,6 +218,7 @@ function cleanProcessedRecords( $limit ) {
$query = Database::query( $sql );
Database::query("OPTIMIZE TABLE $TABLETRACK_OPEN");
}
/***************************************************************************
*
* Provider
@ -229,13 +226,12 @@ function cleanProcessedRecords( $limit ) {
***************************************************************************/
/**
* @author Sebastien Piraux <piraux_seb@hotmail.com>
* @param remhost : must be @getHostByAddr($_SERVER['REMOTE_ADDR']
* @desc this function will extract the provider name from a given
remote host and record this occurence in the corresponding
table
*/
*/
function extractProvider($remhost) {
if($remhost == "Unknown")
return $remhost;
@ -251,7 +247,6 @@ function extractProvider($remhost) {
/**
* @author Sebastien Piraux <piraux_seb@hotmail.com>
* @param provider : name of the provider
* @param providers_array : list of providers and their counter
@ -259,7 +254,7 @@ function extractProvider($remhost) {
- if the provider is already in the array it will increment
the corresponding value
- if the provider doesn't exist it will be added and set to 1
*/
*/
function addProvider($provider,$providers_array) {
if(isset($providers_array[$provider])) {
// add one unity to this provider occurrences
@ -272,11 +267,10 @@ function addProvider($provider,$providers_array) {
}
/**
* @author Sebastien Piraux <piraux_seb@hotmail.com>
* @param providers_array : list of providers and their counter
* @desc update the providers'table with new values
*/
*/
function fillProvidersTable($providers_array) {
global $TABLESTATS_PROVIDERS;
@ -311,12 +305,11 @@ function fillProvidersTable($providers_array) {
***************************************************************************/
/**
* @author Sebastien Piraux <piraux_seb@hotmail.com>
* @return a 2D array filled with code and name of countries
* @desc This function is used to build an array containing
countries informations
*/
*/
function loadCountries() {
global $TABLESTATS_COUNTRIES;
$sql = "SELECT code, country
@ -330,18 +323,18 @@ function loadCountries() {
$i++;
}
}
mysql_free_result($res);
return $list_countries;
Database::free_result($res);
return $list_countries;
}
/**
/**
* @author Sebastien Piraux <piraux_seb@hotmail.com>
* @param remhost : must be @getHostByAddr($_SERVER['REMOTE_ADDR']
* @param list_countries : list of countries -__-
* @return Name of the country or "Unknown" if not found
* @desc this function will extract the country from a given remote
host and increment the good value in the corresponding table
*/
*/
function extractCountry($remhost,$list_countries) {
if($remhost == "Unknown")
return $remhost;
@ -353,15 +346,15 @@ function extractCountry($remhost,$list_countries) {
return $list_countries[$i][1];
}
}
/**
/**
* @author Sebastien Piraux <piraux_seb@hotmail.com>
* @param country : name of the country or 'Unknown'
* @param countries_array : list of countries and their
number of occurence
* @desc this function will increment number of occurrence
for $country in the countries' tables
*/
*/
function addCountry($country,$countries_array) {
if(isset($countries_array[$country])) {
// add one unity to this provider occurrences
@ -372,12 +365,12 @@ function addCountry($country,$countries_array) {
}
return $countries_array;
}
/**
/**
* @author Sebastien Piraux <piraux_seb@hotmail.com>
* @param countries_array : list of countries and their counter
* @desc update the countries'table with new values
*/
*/
function fillCountriesTable($countries_array) {
global $TABLESTATS_COUNTRIES;
if(is_array($countries_array)) {
@ -390,18 +383,19 @@ function fillCountriesTable($countries_array) {
}
}
}
/***************************************************************************
*
* Agent : Browser and OS
*
***************************************************************************/
/**
/**
* @author Sebastien Piraux <piraux_seb@hotmail.com>
* @return a 2D array filled with code and name of browsers
* @desc This function is used to build an array containing
browser informations
*/
*/
function loadBrowsers() {
$buffer = split ("#","Gecko|Gecko#Mozilla/3|Mozilla 3.x#Mozilla/4.0|Mozilla 4.0x#Mozilla/4.5|Mozilla 4.5x#Mozilla/4.6|Mozilla 4.6x#Mozilla/4.7|Mozilla 4.7x#Mozilla/5.0|Mozilla 5.0x#MSIE 1.2|MSIE 1.2#MSIE 3.01|MSIE 3.x#MSIE 3.02|MSIE 3.x#MSIE 4.0|MSIE 4.x#MSIE 4.01|MSIE 4.x#MSIE 4.5|MSIE 4.5#MSIE 5.0b1|MSIE 5.0x#MSIE 5.0b2|MSIE 5.0x#MSIE 5.0|MSIE 5.0x#MSIE 5.01|MSIE 5.0x#MSIE 5.1|MSIE 5.1#MSIE 5.1b1|MSIE 5.1#MSIE 5.5|MSIE 5.5#MSIE 5.5b1|MSIE 5.5#MSIE 5.5b2|MSIE 5.5#MSIE 6.0|MSIE 6#MSIE 6.0b|MSIE 6#MSIE 6.5a|MSIE 6.5#Lynx/2.8.0|Lynx 2#Lynx/2.8.1|Lynx 2#Lynx/2.8.2|Lynx 2#Lynx/2.8.3|Lynx 2#Lynx/2.8.4|Lynx 2#Lynx/2.8.5|Lynx 2#HTTrack 3.0x|HTTrack#OmniWeb/4.0.1|OmniWeb#Opera 3.60|Opera 3.60#Opera 4.0|Opera 4#Opera 4.01|Opera 4#Opera 4.02|Opera 4#Opera 5|Opera 5#Opera/3.60|Opera 3.60#Opera/4|Opera 4#Opera/5|Opera 5#Opera/6|Opera 6#Opera 6|Opera 6#Netscape6|NS 6#Netscape/6|NS 6#Netscape7|NS 7#Netscape/7|NS 7#Konqueror/2.0|Konqueror 2#Konqueror/2.0.1|Konqueror 2#Konqueror/2.1|Konqueror 2#Konqueror/2.1.1|Konqueror 2#Konqueror/2.1.2|Konqueror 2#Konqueror/2.2|Konqueror 2#Teleport Pro|Teleport Pro#WebStripper|WebStripper#WebZIP|WebZIP#Netcraft Web|NetCraft#Googlebot|Googlebot#WebCrawler|WebCrawler#InternetSeer|InternetSeer#ia_archiver|ia archiver");
@ -417,12 +411,11 @@ function loadBrowsers() {
}
/**
* @author Sebastien Piraux <piraux_seb@hotmail.com>
* @return a 2D array filled with code and name of OS
* @desc This function is used to build an array containing
OS informations
*/
*/
function loadOs() {
$buffer = split ("#","Windows 95|Win 95#Windows_95|Win 95#Windows 98|Win 98#Windows NT|Win NT#Windows NT 5.0|Win 2000#Windows NT 5.1|Win XP#Windows 2000|Win 2000#Windows XP|Win XP#Windows ME|Win Me#Win95|Win 95#Win98|Win 98#WinNT|Win NT#linux-2.2|Linux 2#Linux|Linux#Linux 2|Linux 2#Macintosh|Mac#Mac_PPC|Mac#Mac_PowerPC|Mac#SunOS 5|SunOS 5#SunOS 6|SunOS 6#FreeBSD|FreeBSD#beOS|beOS#InternetSeer|InternetSeer#Googlebot|Googlebot#Teleport Pro|Teleport Pro");
$i=0;
@ -432,6 +425,7 @@ function loadOs() {
}
return $list_os;
}
/**
* @author Sebastien Piraux <piraux_seb@hotmail.com>
* @param remhost : must be $_SERVER['HTTP_USER_AGENT']
@ -441,7 +435,7 @@ function loadOs() {
browser and OS are the 'viewable' names
* @desc this function will extract browser and OS from
$_SERVER['HTTP_USER_AGENT']
*/
*/
function extractAgent( $user_agent, $list_browsers, $list_os ) {
// default values, if nothing corresponding found
$viewable_browser = "Unknown";
@ -468,7 +462,6 @@ function extractAgent( $user_agent, $list_browsers, $list_os ) {
}
/**
* @author Sebastien Piraux <piraux_seb@hotmail.com>
* @param browser : name of the browser or 'Unknown'
* @param browsers_array :
@ -476,7 +469,7 @@ function extractAgent( $user_agent, $list_browsers, $list_os ) {
- if the browser is already in the table it will increment
the corresponding value
- if the browser doesn't exist it will be added and set to 1
*/
*/
function addBrowser($browser,$browsers_array) {
if(isset( $browsers_array[$browser])) {
// add one unity to this provider occurrences
@ -489,7 +482,6 @@ function addBrowser($browser,$browsers_array) {
}
/**
* @author Sebastien Piraux <piraux_seb@hotmail.com>
* @param os : name of the OS or 'Unknown'
* @param os_array : list of os and number of occurences
@ -497,7 +489,7 @@ function addBrowser($browser,$browsers_array) {
- if the os is already in the table it will increment
the corresponding value
- if the os doesn't exist it will be added and set to 1
*/
*/
function addOs($os,$os_array) {
if(isset($os_array[$os])) {
// add one unity to this provider occurrences
@ -510,11 +502,10 @@ function addOs($os,$os_array) {
}
/**
* @author Sebastien Piraux <piraux_seb@hotmail.com>
* @param browsers_array : list of browsers and their counter
* @desc update the browsers'table with new values
*/
*/
function fillBrowsersTable($browsers_array) {
global $TABLESTATS_BROWSERS;
if (is_array($browsers_array)) {
@ -523,7 +514,7 @@ function fillBrowsersTable($browsers_array) {
FROM `".$TABLESTATS_BROWSERS."`
WHERE `browser` = '".$browser."'";
$res = Database::query($sql,__FILE__, __LINE__);
// if this provider already exists in the DB
if($row = Database::num_rows($res)) {
// update
@ -542,11 +533,10 @@ function fillBrowsersTable($browsers_array) {
}
/**
* @author Sebastien Piraux <piraux_seb@hotmail.com>
* @param os_array : list of os and their counter
* @desc update the os'table with new values
*/
*/
function fillOsTable($os_array) {
global $TABLESTATS_OS;
if (is_array($os_array)) {
@ -555,7 +545,7 @@ function fillOsTable($os_array) {
FROM `".$TABLESTATS_OS."`
WHERE `os` = '".$os."'";
$res = Database::query($sql,__FILE__, __LINE__);
// if this provider already exists in the DB
if($row = Database::num_rows($res)) {
// update
@ -578,8 +568,8 @@ function fillOsTable($os_array) {
* Referers
*
***************************************************************************/
/**
/**
* @author Sebastien Piraux <piraux_seb@hotmail.com>
* @param referer : name of the referer
* @param referers_array : list of referer and number of occurences
@ -598,8 +588,8 @@ function addReferer($referer,$referers_array) {
}
return $referers_array;
}
/**
/**
* @author Sebastien Piraux <piraux_seb@hotmail.com>
* @param referers_array : list of referers and their counter
* @desc update the referers'table with new values
@ -629,4 +619,3 @@ function fillReferersTable($referers_array) {
}
}
}
?>

@ -37,110 +37,75 @@
*/
/**
* @author Sebastien Piraux <piraux_seb@hotmail.com>
* @param sql : a sql query (as a string)
* @desc return one result from a sql query (1 single result)
*/
function getOneResult($sql)
{
$query = @mysql_query($sql);
if (mysql_errno())
{
echo "\n<!-- **** ".mysql_errno().": ".mysql_error()." In : $sql **** -->\n";
function getOneResult($sql) {
$query = Database::query($sql, __FILE__, __LINE__);
if ($query !== false) {
$res = @Database::fetch_array($query, 'NUM');
} else {
$res = array();
}
$res = @mysql_fetch_array($query);
return $res[0];
}
/**
* @author Sebastien Piraux <piraux_seb@hotmail.com>
* @param sql : a sql query (as a string)
* @desc Return many results of a query in a 1 column tab
*/
function getManyResults1Col($sql)
{
$res = mysql_query($sql);
if (mysql_errno())
{
echo "\n<!-- **** ".mysql_errno().": ".mysql_error()." In : $sql **** -->\n";
}
else
{
function getManyResults1Col($sql) {
$res = Database::query($sql, __FILE__, __LINE__);
if ($res !== false) {
$i = 0;
while ($resA = mysql_fetch_array($res))
{
while ($resA = Database::fetch_array($res, 'NUM')) {
$resu[$i++] = $resA[0];
}
}
return $resu;
}
/**
* @author Sebastien Piraux <piraux_seb@hotmail.com>
* @param sql : a sql query (as a string)
* @desc Return many results of a query
*/
function getManyResults2Col($sql)
{
$res = mysql_query($sql);
if (mysql_errno())
{
echo "\n<!-- **** ".mysql_errno().": ".mysql_error()." In : $sql **** -->\n";
}
else
{
function getManyResults2Col($sql) {
$res = Database::query($sql, __FILE__, __LINE__);
if ($res !== false) {
$i = 0;
while ($resA = mysql_fetch_array($res))
{
while ($resA = Database::fetch_array($res, 'NUM')) {
$resu[$i][0] = $resA[0];
$resu[$i][1] = $resA[1];
$i++;
}
}
return $resu;
}
/**
* @author Sebastien Piraux <piraux_seb@hotmail.com>
* @param sql : a sql query (as a string)
* @desc Return many results of a query in a 3 column tab
in $resu[$i][0], $resu[$i][1],$resu[$i][2]
*/
function getManyResults3Col($sql)
{
$res = mysql_query($sql);
if (mysql_errno())
{
echo "\n<!-- **** ".mysql_errno().": ".mysql_error()." In : $sql **** -->\n";
}
else
{
function getManyResults3Col($sql) {
$res = Database::query($sql, __FILE__, __LINE__);
if ($res !== false) {
$i = 0;
while ($resA = mysql_fetch_array($res))
{
$resu[$i][0]=$resA[0];
$resu[$i][1]=$resA[1];
$resu[$i][2]=$resA[2];
while ($resA = Database::fetch_array($res, 'NUM')) {
$resu[$i][0] = $resA[0];
$resu[$i][1] = $resA[1];
$resu[$i][2] = $resA[2];
$i++;
}
}
return $resu;
}
/**
* @author Sebastien Piraux <piraux_seb@hotmail.com>
* @param sql : a sql query (as a string)
* @desc Return many results of a query in a X column tab
@ -150,29 +115,20 @@ function getManyResults3Col($sql)
So I encourage to use the dedicated for 1, 2 or 3
columns of results
*/
function getManyResultsXCol($sql,$X)
{
$res = mysql_query($sql);
if (mysql_errno())
{
echo "\n<!-- **** ".mysql_errno().": ".mysql_error()." In : $sql **** -->\n";
}
else
{
function getManyResultsXCol($sql, $X) {
$res = Database::query($sql, __FILE__, __LINE__);
if ($res !== false) {
$i = 0;
while ($resA = mysql_fetch_array($res))
{
for($j = 0; $j < $X ; $j++)
{
$resu[$i][$j]=$resA[$j];
while ($resA = Database::fetch_array($res, 'NUM')) {
for ($j = 0; $j < $X ; $j++) {
$resu[$i][$j] = $resA[$j];
}
$i++;
}
}
return $resu;
}
/**
* @author Sebastien Piraux <piraux_seb@hotmail.com>
@ -183,36 +139,22 @@ function getManyResultsXCol($sql,$X)
key 'total' return the sum of all number of time hours
appear
*/
function hoursTab($sql)
{
function hoursTab($sql) {
$hours_array = array('total' => 0);
$res = mysql_query($sql);
if (mysql_errno())
{
echo "\n<!-- **** ".mysql_errno().": ".mysql_error()." In : $sql **** -->\n";
}
else
{
while($row = mysql_fetch_row($res))
{
$res = Database::query($sql, __FILE__, __LINE__);
if ($res !== false) {
while ($row = Database::fetch_row($res)) {
$date_array = getdate($row[0]);
if($date_array['hours'] == $last_hours)
{
if ($date_array['hours'] == $last_hours) {
$hours_array[$date_array['hours']]++;
}
else
{
} else {
$hours_array[$date_array['hours']] = 1;
$last_hours = $date_array['hours'];
}
$hours_array['total']++;
}
mysql_free_result($res);
Database::free_result($res);
}
return $hours_array;
}
@ -226,36 +168,24 @@ function hoursTab($sql)
key "total" return the sum of all number of time days
appear
*/
function daysTab($sql)
{
$MonthsShort = array(get_lang('JanuaryShort'), get_lang('FebruaryShort'), get_lang('MarchShort'), get_lang('AprilShort'), get_lang('MayShort'), get_lang('JuneShort'), get_lang('JulyShort'), get_lang('AugustShort'), get_lang('SeptemberShort'), get_lang('OctoberShort'), get_lang('NovemberShort'), get_lang('DecemberShort'));
function daysTab($sql) {
$MonthsShort = api_get_months_short();
$days_array = array('total' => 0);
$res = mysql_query($sql);
if (mysql_errno())
{
echo "\n<!-- **** ".mysql_errno().": ".mysql_error()." In : $sql **** -->\n";
}
else
{
while($row = mysql_fetch_row($res))
{
$res = Database::query($sql, __FILE__, __LINE__);
if ($res !== false) {
while ($row = Database::fetch_row($res)) {
$date_array = getdate($row[0]);
$display_date = $date_array['mday'].' '.$MonthsShort[$date_array['mon']-1].' '.$date_array['year'];
if ($date_array['mday'] == $last_day)
{
$display_date = $date_array['mday'].' '.$MonthsShort[$date_array['mon'] - 1].' '.$date_array['year'];
if ($date_array['mday'] == $last_day) {
$days_array[$display_date]++;
}
else
{
} else {
$days_array[$display_date] = 1;
$last_day = $display_date;
}
$days_array['total']++;
}
mysql_free_result($res);
Database::free_result($res);
}
return $days_array;
}
@ -269,33 +199,22 @@ function daysTab($sql)
key "total" return the sum of all number of time days
appear
*/
function monthTab($sql)
{
$MonthsLong = array (get_lang('JanuaryLong'), get_lang('FebruaryLong'), get_lang('MarchLong'), get_lang('AprilLong'), get_lang('MayLong'), get_lang('JuneLong'), get_lang('JulyLong'), get_lang('AugustLong'), get_lang('SeptemberLong'), get_lang('OctoberLong'), get_lang('NovemberLong'), get_lang('DecemberLong'));
function monthTab($sql) {
$MonthsLong = api_get_months_long();
$month_array = array('total' => 0);
$res = mysql_query($sql);
if (mysql_errno())
{
echo "\n<!-- **** ".mysql_errno().": ".mysql_error()." In : $sql **** -->\n";
}
else
{
$res = Database::query($sql, __FILE__, __LINE__);
if ($res !== false) {
// init tab with all months
for($i = 0; $i < 12; $i++)
{
for($i = 0; $i < 12; $i++) {
$month_array[$MonthsLong[$i]] = 0;
}
while($row = mysql_fetch_row($res))
{
while ($row = Database::fetch_row($res)) {
$date_array = getdate($row[0]);
$month_array[$MonthsLong[$date_array['mon']-1]]++;
$month_array[$MonthsLong[$date_array['mon'] - 1]]++;
$month_array['total']++;
}
mysql_free_result($res);
Database::free_result($res);
}
return $month_array;
}
@ -311,8 +230,7 @@ function monthTab($sql)
next are informations
Last is total number of hits
*/
function makeHitsTable($period_array, $periodTitle, $linkOnPeriod = '???')
{
function makeHitsTable($period_array, $periodTitle, $linkOnPeriod = '???') {
echo "<table width='100%' cellpadding='0' cellspacing='1' border='0' align=center class='minitext'>";
// titles
echo "<tr bgcolor='#E6E6E6' align='center'>
@ -332,10 +250,8 @@ function makeHitsTable($period_array, $periodTitle, $linkOnPeriod = '???')
";
$factor = 4;
$maxSize = $factor * 100; //pixels
while(list($periodPiece, $cpt) = each($period_array))
{
if($periodPiece != 'total')
{
while (list($periodPiece, $cpt) = each($period_array)) {
if ($periodPiece != 'total') {
$pourcent = round(100 * $cpt / $period_array['total']);
$barwidth = $factor * $pourcent ;
echo "<tr>
@ -391,8 +307,7 @@ function makeHitsTable($period_array, $periodTitle, $linkOnPeriod = '???')
* @desc display a 2 column tab from an array
titles of columns are title1 and title2
*/
function buildTab2col($array_of_results, $title1, $title2)
{
function buildTab2col($array_of_results, $title1, $title2) {
echo "<table cellpadding='2' cellspacing='1' border='1' align='center'>\n";
echo "<tr>
<td bgcolor='#E6E6E6'>
@ -403,18 +318,14 @@ function buildTab2col($array_of_results, $title1, $title2)
</td>
</tr>\n";
if (is_array($array_of_results))
{
for($j = 0 ; $j < count($array_of_results) ; $j++)
{
if (is_array($array_of_results)) {
for ($j = 0 ; $j < count($array_of_results) ; $j++) {
echo '<tr>';
echo '<td bgcolor="#eeeeee">'.$array_of_results[$j][0].'</td>';
echo '<td align="right">'.$array_of_results[$j][1].'</td>';
echo "</tr>\n";
}
}
else
{
} else {
echo '<tr>';
echo '<td colspan="2" align="center">'.get_lang('NoResult').'</td>';
echo "</tr>\n";
@ -429,22 +340,17 @@ function buildTab2col($array_of_results, $title1, $title2)
* @desc display a 2 column tab from an array
this tab has no title
*/
function buildTab2ColNoTitle($array_of_results)
{
function buildTab2ColNoTitle($array_of_results) {
echo "<table cellpadding='3' cellspacing='1' border='0' align='center'>\n";
if (is_array($array_of_results))
{
for($j = 0 ; $j < count($array_of_results) ; $j++)
{
if (is_array($array_of_results)) {
for ($j = 0 ; $j < count($array_of_results) ; $j++) {
echo '<tr>';
echo '<td bgcolor="#eeeeee">'.$array_of_results[$j][0].'</td>';
echo '<td align="right">&nbsp;&nbsp;'.$array_of_results[$j][1].'</td>';
echo "</tr>\n";
}
}
else
{
} else {
echo '<tr>';
echo '<td colspan="2" align="center">'.get_lang('NoResult').'</td>';
echo "</tr>\n";
@ -461,25 +367,19 @@ function buildTab2ColNoTitle($array_of_results)
if array_of_results is not an array there is
no error, else errors are displayed
*/
function buildTabDefcon($array_of_results)
{
function buildTabDefcon($array_of_results) {
echo "<table width='60%' cellpadding='2' cellspacing='1' border='0' align=center class='minitext'>\n";
if (is_array($array_of_results))
{
if (is_array($array_of_results)) {
// there are some strange cases...
echo '<tr>';
echo '<td colspan="2" align="center" bgcolor="#eeeeee"><font color="#ff0000">'.get_lang('Defcon').'</font></td>';
echo "</tr>\n";
for($j = 0 ; $j < count($array_of_results) ; $j++)
{
if($array_of_results[$j][0] == "")
{
for ($j = 0 ; $j < count($array_of_results) ; $j++) {
if($array_of_results[$j][0] == "") {
$key = get_lang('NULLValue');
}
else
{
} else {
$key = $array_of_results[$j][0];
}
echo '<tr>';
@ -487,9 +387,7 @@ function buildTabDefcon($array_of_results)
echo '<td width="30%" align="right">'.$array_of_results[$j][1].'</td>';
echo "</tr>\n";
}
}
else
{
} else {
// all right
echo '<tr>';
echo '<td colspan="2" align="center"><font color="#00ff00">'.get_lang('AllRight').'</font></td>';
@ -497,4 +395,3 @@ function buildTabDefcon($array_of_results)
}
echo "</table>\n";
}
?>

File diff suppressed because it is too large Load Diff

@ -297,7 +297,7 @@ class aicc extends learnpath {
"'$prereq', 0" .
")";
$res_item = Database::query($sql_item);
if($this->debug>1){error_log('New LP - In aicc::import_aicc() - inserting item : '.$sql_item.' : '.mysql_error(),0);}
if($this->debug>1){error_log('New LP - In aicc::import_aicc() - inserting item : '.$sql_item.' : '.Database::error(),0);}
$item_id = Database::insert_id();
//now update previous item to change next_item_id
if($previous != 0){

@ -2116,7 +2116,7 @@ class learnpath {
$sql = "SELECT * FROM " . $tbl_lp_item . " as lp inner join " . $tbl_lp_item_view . " as lp_view on lp.id = lp_view.lp_item_id " .
"WHERE lp.id = '" . $_SESSION['oLP']->current . "'";
$result = Database::query($sql, __FILE__, __LINE__);
$row = mysql_fetch_assoc($result);
$row = Database::fetch_assoc($result);
$output = '';
if (!empty ($row['audio'])) {
@ -7326,7 +7326,7 @@ class learnpath {
$result = Database::query($sql, __FILE__, __LINE__);
$row = mysql_fetch_assoc($result);
$row = Database::fetch_assoc($result);
$s_title = $row['title'];
$s_title = api_convert_encoding($s_title, $charset, $this->encoding);

@ -2323,7 +2323,7 @@ function get_terms()
}
//if(!$res)
//{
// $this->error = 'Could not update item_view table...'.mysql_error();
// $this->error = 'Could not update item_view table...'.Database::error();
//}
if(is_array($this->interactions) && count($this->interactions)>0){
//save interactions

@ -127,7 +127,6 @@ if($_POST['sent'])
}
}
//mysql_close();
Database::close();
header('Location: '.api_get_self());
exit();
@ -140,7 +139,6 @@ if($action == 'delete')
$query="DELETE FROM $tbl_online_link WHERE id='$link'";
Database::query($query,__FILE__,__LINE__);
//mysql_close();
Database::close();
header('Location: '.api_get_self());
exit();

@ -72,7 +72,6 @@ if($_POST['sent'])
fclose($fp);
}
//mysql_close();
Database::close();
header('Location: online_master.php');
exit();

@ -13,14 +13,14 @@ $rights_blog=array("article_add","article_delete","article_edit","article_rate",
$course_tool_table = Database::get_course_table(TABLE_TOOL_LIST);
// Get all user
$blog_users = Blog::get_blog_users(mysql_escape_string($_GET['blog_id']));
$blog_users = Blog::get_blog_users(Database::escape_string($_GET['blog_id']));
// Remove the blog creater because he has all the rights automatically
// and we want to keep it that way.
$tbl_course_rel_user = $table=Database::get_main_table(TABLE_MAIN_COURSE_USER);
$sql = "SELECT user_id FROM $tbl_course_rel_user WHERE status = '1' AND course_code = '".$_SESSION['_cid']."'";
$result = Database::query($sql,__FILE__,__LINE__);
while ($user = mysql_fetch_assoc($result)) {
while ($user = Database::fetch_assoc($result)) {
unset($blog_users[$user['user_id']]);
}

@ -53,7 +53,7 @@ function check_download_survey($course, $invitation, $doc_url) {
Display :: display_footer();
exit;
}
$survey_invitation = mysql_fetch_assoc($result);
$survey_invitation = Database::fetch_assoc($result);
// now we check if the user already filled the survey
if ($survey_invitation['answered'] == 1)
@ -83,7 +83,7 @@ function check_download_survey($course, $invitation, $doc_url) {
{
echo '<form id="language" name="language" method="POST" action="'.api_get_self().'?course='.$_GET['course'].'&invitationcode='.$_GET['invitationcode'].'">';
echo ' <select name="language">';
while ($row=mysql_fetch_assoc($result))
while ($row = Database::fetch_assoc($result))
{
echo '<option value="'.$row['survey_id'].'">'.$row['lang'].'</option>';
}
@ -96,7 +96,7 @@ function check_download_survey($course, $invitation, $doc_url) {
}
else
{
$row=mysql_fetch_assoc($result);
$row = Database::fetch_assoc($result);
$survey_invitation['survey_id'] = $row['survey_id'];
}
$sql = "select count(*) from $table_survey where survey_id = ".$survey_invitation['survey_id']."

@ -142,7 +142,7 @@ $sql = "SELECT survey_invitation.*, user.firstname, user.lastname, user.email FR
LEFT JOIN $table_user user ON survey_invitation.user = user.user_id
WHERE survey_invitation.survey_code = '".Database::escape_string($survey_data['code'])."'";
$res = Database::query($sql, __FILE__, __LINE__);
while ($row = mysql_fetch_assoc($res))
while ($row = Database::fetch_assoc($res))
{
if (!$_GET['view'] OR $_GET['view'] == 'invited' OR ($_GET['view'] == 'answered' AND in_array($row['user'], $answered_data)) OR ($_GET['view'] == 'unanswered' AND !in_array($row['user'], $answered_data)))
{

@ -303,7 +303,7 @@ if( ( $is_allowedToTrack || $is_allowedToTrackEverybodyInCourse ) && $_configura
AND gu.group_id = '".Database::escape_string($_gid)."'
AND u.user_id = '".Database::escape_string($uInfo)."'";
$query = Database::query($sql,__FILE__,__LINE__);
$tracked_user_info = @mysql_fetch_assoc($query);
$tracked_user_info = @Database::fetch_assoc($query);
if(is_array($tracked_user_info)) $tracking_is_accepted = true;
}

@ -286,7 +286,7 @@ if( ( $is_allowedToTrack || $is_allowedToTrackEverybodyInCourse ) && $_configura
AND `gu`.`group_id` = '$_gid'
AND `u`.`user_id` = '$uInfo'";
$query = Database::query($sql,__FILE__,__LINE__);
$tracked_user_info = @mysql_fetch_assoc($query);
$tracked_user_info = @Database::fetch_assoc($query);
if(is_array($tracked_user_info)) $tracking_is_accepted = true;
$title[0] = $tracked_user_info['firstname'].'_'.$tracked_user_info['lastname'];

@ -2295,7 +2295,7 @@ if ($_GET['action']=='discuss')
$message_author=api_get_user_id();
$sql="INSERT INTO $tbl_wiki_discuss (publication_id, userc_id, comment, p_score, dtime) VALUES ('".$id."','".$message_author."','".$_POST['comment']."','".$_POST['rating']."','".$dtime."')";
$result=Database::query($sql,__FILE__,__LINE__) or die(mysql_error());
$result=Database::query($sql,__FILE__,__LINE__) or die();
check_emailcue($id, 'D', $dtime, $message_author);
@ -2306,17 +2306,17 @@ if ($_GET['action']=='discuss')
$user_table = Database :: get_main_table(TABLE_MAIN_USER);
$sql="SELECT * FROM $tbl_wiki_discuss reviews, $user_table user WHERE reviews.publication_id='".$id."' AND user.user_id='".$firstuserid."' ORDER BY id DESC";
$result=Database::query($sql,__FILE__,__LINE__) or die(mysql_error());
$result=Database::query($sql,__FILE__,__LINE__) or die();
$countWPost = Database::num_rows($result);
echo get_lang('NumComments').": ".$countWPost; //comment's numbers
$sql="SELECT SUM(p_score) as sumWPost FROM $tbl_wiki_discuss WHERE publication_id='".$id."' AND NOT p_score='-' ORDER BY id DESC";
$result2=Database::query($sql,__FILE__,__LINE__) or die(mysql_error());
$result2=Database::query($sql,__FILE__,__LINE__) or die();
$row2=Database::fetch_array($result2);
$sql="SELECT * FROM $tbl_wiki_discuss WHERE publication_id='".$id."' AND NOT p_score='-'";
$result3=Database::query($sql,__FILE__,__LINE__) or die(mysql_error());
$result3=Database::query($sql,__FILE__,__LINE__) or die();
$countWPost_score= Database::num_rows($result3);
echo ' - '.get_lang('NumCommentsScore').': '.$countWPost_score;//

@ -70,7 +70,7 @@ if (is_allowed_to_edit()) {
$query = Database::query("SELECT url FROM $tbl_student_publication AS work,$prop_table AS props WHERE props.tool='work' AND work.id=props.ref AND work.url LIKE 'work".$querypath."/%' AND work.filetype='file' AND props.visibility<>'2'",__FILE__,__LINE__);
//add tem to the zip file
while ($not_deleted_file = mysql_fetch_assoc($query)) { //var_dump($sys_course_path.$_course['path']."/".$not_deleted_file['url']);exit();
while ($not_deleted_file = Database::fetch_assoc($query)) { //var_dump($sys_course_path.$_course['path']."/".$not_deleted_file['url']);exit();
$zip_folder->add($sys_course_path.$_course['path']."/".$not_deleted_file['url'],PCLZIP_OPT_REMOVE_PATH, $sys_course_path.$_course['path']."/work".$remove_dir);
}
}
@ -89,7 +89,7 @@ else
$query = Database::query("SELECT url FROM $tbl_student_publication AS work,$prop_table AS props WHERE props.tool='work' AND work.id=props.ref AND work.url LIKE 'work".$querypath."/%' AND work.filetype='file' AND props.visibility='1' AND props.lastedit_user_id='".api_get_user_id()."'",__FILE__,__LINE__);
//add them to an array
$all_visible_files_path = array();
while ($all_visible_files = mysql_fetch_assoc($query)) {
while ($all_visible_files = Database::fetch_assoc($query)) {
$all_visible_files_path[] = $all_visible_files['url'];
}
//2nd: get all folders that are invisible in the given path
@ -98,11 +98,11 @@ else
if (Database::num_rows($query2)>0) {
//add tem to an array
while ($invisible_folders = mysql_fetch_assoc($query2)) {
while ($invisible_folders = Database::fetch_assoc($query2)) {
//3rd: get all files that are in the found invisible folder (these are "invisible" too)
$query3 = Database::query("SELECT url FROM $tbl_student_publication AS work,$prop_table AS props WHERE props.tool='work' AND work.id=props.ref AND work.url LIKE 'work".$invisible_folders['path']."/%' AND work.filetype='file' AND props.visibility='1' AND props.lastedit_user_id='".api_get_user_id()."'",__FILE__,__LINE__);
//add tem to an array
while ($files_in_invisible_folder = mysql_fetch_assoc($query3)) {
while ($files_in_invisible_folder = Database::fetch_assoc($query3)) {
$files_in_invisible_folder_path[] = $files_in_invisible_folder['url'];
}
}

Loading…
Cancel
Save