diff --git a/main/calendar/agenda.inc.php b/main/calendar/agenda.inc.php
index 1bdbca07ef..eabe784d41 100755
--- a/main/calendar/agenda.inc.php
+++ b/main/calendar/agenda.inc.php
@@ -4449,7 +4449,7 @@ function delete_attachment_file($id_attach) {
$id_attach=Database::escape_string($id_attach);
$sql="DELETE FROM $agenda_table_attachment WHERE id = ".(int)$id_attach;
- $result=Database::query($sql, __LINE__, __FILE__);
+ $result=Database::query($sql);
$last_id_file=Database::insert_id();
// update item_property
api_item_property_update($_course, 'calendar_event_attachment', $id_attach ,'AgendaAttachmentDeleted', api_get_user_id());
@@ -4497,7 +4497,7 @@ function add_agenda_attachment_file($file_comment,$last_id) {
if ($result) {
$sql='INSERT INTO '.$agenda_table_attachment.'(filename,comment, path,agenda_id,size) '.
"VALUES ( '".$safe_file_name."', '".$safe_file_comment."', '".$safe_new_file_name."' , '".$last_id."', '".$_FILES['user_upload']['size']."' )";
- $result=Database::query($sql, __LINE__, __FILE__);
+ $result=Database::query($sql);
$message.=' / '.get_lang('FileUploadSucces').'
';
$last_id_file=Database::insert_id();
@@ -4548,7 +4548,7 @@ function edit_agenda_attachment_file($file_comment,$agenda_id,$id_attach) {
if ($result) {
$sql="UPDATE $agenda_table_attachment SET filename = '$safe_file_name', comment = '$safe_file_comment', path = '$safe_new_file_name', agenda_id = '$safe_agenda_id', size ='".$_FILES['user_upload']['size']."'
WHERE id = '$safe_id_attach'";
- $result=Database::query($sql, __LINE__, __FILE__);
+ $result=Database::query($sql);
api_item_property_update($_course, 'calendar_event_attachment', $safe_id_attach ,'AgendaAttachmentUpdated', api_get_user_id());
diff --git a/main/course_info/infocours.php b/main/course_info/infocours.php
index 0fea980409..cd58d99054 100755
--- a/main/course_info/infocours.php
+++ b/main/course_info/infocours.php
@@ -107,19 +107,19 @@ $tbl_course = Database :: get_main_table(TABLE_MAIN_COURSE);
// Get all course categories
$sql = "SELECT code,name FROM ".$table_course_category." WHERE auth_course_child ='TRUE' OR code = '".Database::escape_string($_course['categoryCode'])."' ORDER BY tree_pos";
-$res = Database::query($sql, __FILE__, __LINE__);
+$res = Database::query($sql);
$s_select_course_tutor_name="SELECT tutor_name FROM $tbl_course WHERE code='$course_code'";
-$q_tutor=Database::query($s_select_course_tutor_name, __FILE__, __LINE__);
+$q_tutor=Database::query($s_select_course_tutor_name);
$s_tutor=Database::result($q_tutor,0,"tutor_name");
$s_sql_course_titular="SELECT DISTINCT username, lastname, firstname FROM $tbl_user as user, $tbl_course_user as course_rel_user WHERE (course_rel_user.status='1') AND user.user_id=course_rel_user.user_id AND course_code='".$course_code."'";
-$q_result_titulars=Database::query($s_sql_course_titular, __FILE__, __LINE__);
+$q_result_titulars=Database::query($s_sql_course_titular);
$target_name = api_sort_by_first_name() ? 'firstname' : 'lastname';
if(Database::num_rows($q_result_titulars)==0){
$sql="SELECT username, lastname, firstname FROM $tbl_user as user, $tbl_admin as admin WHERE admin.user_id=user.user_id ORDER BY ".$target_name." ASC";
- $q_result_titulars=Database::query($sql, __FILE__, __LINE__);
+ $q_result_titulars=Database::query($sql);
}
$a_profs[0] = '-- '.get_lang('NoManager').' --';
@@ -336,49 +336,49 @@ if ($form->validate() && is_settings_editable()) {
tutor_name = '".$update_values['tutor_name']."',
registration_code = '".$update_values['course_registration_password']."'
WHERE code = '".$course_code."'";
- Database::query($sql, __FILE__, __LINE__);
+ Database::query($sql);
//update course_settings table - this assumes those records exist, otherwise triggers an error
$table_course_setting = Database::get_course_table(TABLE_COURSE_SETTING);
if($update_values['email_alert_to_teacher_on_new_user_in_course'] != $values['email_alert_to_teacher_on_new_user_in_course']){
$sql = "UPDATE $table_course_setting SET value = ".(int)$update_values['email_alert_to_teacher_on_new_user_in_course']." WHERE variable = 'email_alert_to_teacher_on_new_user_in_course' ";
- Database::query($sql,__FILE__,__LINE__);
+ Database::query($sql);
}
if($update_values['email_alert_manager_on_new_doc'] != $values['email_alert_manager_on_new_doc']){
$sql = "UPDATE $table_course_setting SET value = ".(int)$update_values['email_alert_manager_on_new_doc']." WHERE variable = 'email_alert_manager_on_new_doc' ";
- Database::query($sql,__FILE__,__LINE__);
+ Database::query($sql);
}
if($update_values['email_alert_on_new_doc_dropbox'] != $values['email_alert_on_new_doc_dropbox']){
$sql = "UPDATE $table_course_setting SET value = ".(int)$update_values['email_alert_on_new_doc_dropbox']." WHERE variable = 'email_alert_on_new_doc_dropbox' ";
- Database::query($sql,__FILE__,__LINE__);
+ Database::query($sql);
}
if($update_values['email_alert_manager_on_new_quiz'] != $values['email_alert_manager_on_new_quiz']){
$sql = "UPDATE $table_course_setting SET value = ".(int)$update_values['email_alert_manager_on_new_quiz']." WHERE variable = 'email_alert_manager_on_new_quiz' ";
- Database::query($sql,__FILE__,__LINE__);
+ Database::query($sql);
}
if($update_values['allow_user_edit_agenda'] != $values['allow_user_edit_agenda']){
$sql = "UPDATE $table_course_setting SET value = ".(int)$update_values['allow_user_edit_agenda']." WHERE variable = 'allow_user_edit_agenda' ";
- Database::query($sql,__FILE__,__LINE__);
+ Database::query($sql);
}
if($update_values['allow_user_edit_announcement'] != $values['allow_user_edit_announcement']){
$sql = "UPDATE $table_course_setting SET value = ".(int)$update_values['allow_user_edit_announcement']." WHERE variable = 'allow_user_edit_announcement' ";
- Database::query($sql,__FILE__,__LINE__);
+ Database::query($sql);
}
if($update_values['allow_user_image_forum'] != $values['allow_user_image_forum']){
$sql = "UPDATE $table_course_setting SET value = ".(int)$update_values['allow_user_image_forum']." WHERE variable = 'allow_user_image_forum' ";
- Database::query($sql,__FILE__,__LINE__);
+ Database::query($sql);
}
if($update_values['allow_open_chat_window'] != $values['allow_open_chat_window']){
$sql = "UPDATE $table_course_setting SET value = ".(int)$update_values['allow_open_chat_window']." WHERE variable = 'allow_open_chat_window' ";
- Database::query($sql,__FILE__,__LINE__);
+ Database::query($sql);
}
if($update_values['course_theme'] != $values['course_theme']){
$sql = "UPDATE $table_course_setting SET value = '".$update_values['course_theme']."' WHERE variable = 'course_theme' ";
- Database::query($sql,__FILE__,__LINE__);
+ Database::query($sql);
}
if($update_values['allow_learningpath_theme'] != $values['allow_learning_path_theme']){
$sql = "UPDATE $table_course_setting SET value = ".(int)$update_values['allow_learning_path_theme']." WHERE variable = 'allow_learning_path_theme' ";
- Database::query($sql,__FILE__,__LINE__);
+ Database::query($sql);
}
diff --git a/main/course_info/postpone.php b/main/course_info/postpone.php
index 44c7b9acd3..f40cb433d1 100755
--- a/main/course_info/postpone.php
+++ b/main/course_info/postpone.php
@@ -76,7 +76,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__);
+$resultCourseExtention = Database::query($sqlCourseExtention);
$currentCourseExtentionData = Database::fetch_array($resultCourseExtention);
$currentCourseLastVisit = $currentCourseExtentionData["last_visit"];
$currentCourseLastEdit = $currentCourseExtentionData["last_edit"];
diff --git a/main/coursecopy/classes/CourseBuilder.class.php b/main/coursecopy/classes/CourseBuilder.class.php
index 2720db584c..24447921ca 100755
--- a/main/coursecopy/classes/CourseBuilder.class.php
+++ b/main/coursecopy/classes/CourseBuilder.class.php
@@ -97,7 +97,7 @@ class CourseBuilder
foreach ($this->course->resources as $type => $resources) {
foreach ($resources as $id => $resource) {
$sql = "SELECT * FROM ".$table_link." WHERE source_type = '".$resource->get_type()."' AND source_id = '".$resource->get_id()."'";
- $res = Database::query($sql, __FILE__, __LINE__);
+ $res = Database::query($sql);
while ($link = Database::fetch_object($res)) {
$this->course->resources[$type][$id]->add_linked_resource($link->resource_type, $link->resource_id);
}
@@ -112,7 +112,7 @@ class CourseBuilder
if ($tool != null)
{
$sql = "SELECT * FROM $table_properties WHERE TOOL = '".$tool."' AND ref='".$resource->get_id()."'";
- $res = Database::query($sql,__FILE__,__LINE__);
+ $res = Database::query($sql);
$all_properties = array ();
while ($item_property = Database::fetch_array($res))
{
@@ -143,7 +143,7 @@ class CourseBuilder
$sql = 'SELECT * FROM '.$table_doc.' d, '.$table_prop.' p WHERE tool = \''.TOOL_DOCUMENT.'\' AND p.ref = d.id AND p.visibility != 2 AND session_id = '.$session_id.' ORDER BY path';
}
- $db_result = Database::query($sql, __FILE__, __LINE__);
+ $db_result = Database::query($sql);
while ($obj = Database::fetch_object($db_result))
{
$doc = new Document($obj->id, $obj->path, $obj->comment, $obj->title, $obj->filetype, $obj->size);
@@ -159,7 +159,7 @@ class CourseBuilder
else
$sql = 'SELECT * FROM '.$table_doc.' d, '.$table_prop.' p WHERE tool = \''.TOOL_DOCUMENT.'\' AND p.ref = d.id AND p.visibility != 2 AND d.session_id = 0 ORDER BY path';
- $db_result = Database::query($sql, __FILE__, __LINE__);
+ $db_result = Database::query($sql);
while ($obj = Database::fetch_object($db_result))
{
$doc = new Document($obj->id, $obj->path, $obj->comment, $obj->title, $obj->filetype, $obj->size);
@@ -176,7 +176,7 @@ class CourseBuilder
{
$table = Database :: get_course_table(TABLE_FORUM);
$sql = 'SELECT * FROM '.$table;
- $db_result = Database::query($sql, __FILE__, __LINE__);
+ $db_result = Database::query($sql);
while ($obj = Database::fetch_object($db_result))
{
$forum = new Forum($obj->forum_id, $obj->forum_title, $obj->forum_comment, $obj->forum_category, $obj->forum_last_post, $obj->forum_threads, $obj->forum_posts, $obj->allow_anonymous, $obj->allow_edit, $obj->approval_direct_post, $obj->allow_attachements, $obj->allow_new_threads, $obj->default_view, $obj->forum_of_group, $obj->forum_group_public_private, $obj->forum_order, $obj->locked, $obj->session_id, $obj->forum_image);
@@ -193,7 +193,7 @@ class CourseBuilder
{
$table = Database :: get_course_table(TABLE_FORUM_CATEGORY);
$sql = 'SELECT * FROM '.$table.' WHERE cat_id = '.$id;
- $db_result = Database::query($sql, __FILE__, __LINE__);
+ $db_result = Database::query($sql);
while ($obj = Database::fetch_object($db_result))
{
$forum_category = new ForumCategory($obj->cat_id, $obj->cat_title, $obj->cat_comment, $obj->cat_order, $obj->locked, $obj->session_id);
@@ -207,7 +207,7 @@ class CourseBuilder
{
$table = Database :: get_course_table(TABLE_FORUM_THREAD);
$sql = 'SELECT * FROM '.$table;
- $db_result = Database::query($sql, __FILE__, __LINE__);
+ $db_result = Database::query($sql);
while ($obj = Database::fetch_object($db_result))
{
$forum_topic = new ForumTopic($obj->thread_id, $obj->thread_title, $obj->thread_date, $obj->thread_poster_id, $obj->thread_poster_name, $obj->forum_id, $obj->thread_last_post, $obj->thread_replies, $obj->thread_views, $obj->thread_sticky, $obj->locked, $obj->thread_close_date, $obj->thread_weight, $obj->thread_title_qualify, $obj->thread_qualify_max);
@@ -222,7 +222,7 @@ class CourseBuilder
{
$table_post = Database :: get_course_table(TABLE_FORUM_POST);
$sql = 'SELECT * FROM '.$table_post;
- $db_result = Database::query($sql, __FILE__, __LINE__);
+ $db_result = Database::query($sql);
while ($obj = Database::fetch_object($db_result))
{
$forum_post = new ForumPost($obj->post_id, $obj->post_title, $obj->post_text, $obj->post_date, $obj->poster_id, $obj->poster_name, $obj->post_notification, $obj->post_parent_id, $obj->thread_id, $obj->forum_id, $obj->visible);
@@ -247,7 +247,7 @@ class CourseBuilder
$sql = "SELECT * FROM $table l, $table_prop p WHERE p.ref=l.id AND p.tool = '".TOOL_LINK."' AND p.visibility != 2 AND l.session_id = 0 ORDER BY l.display_order";
}
- $db_result = Database::query($sql, __FILE__, __LINE__);
+ $db_result = Database::query($sql);
while ($obj = Database::fetch_object($db_result))
{
$link = new Link($obj->id, $obj->title, $obj->url, $obj->description, $obj->category_id, $obj->on_homepage);
@@ -272,7 +272,7 @@ class CourseBuilder
{
$table = Database :: get_course_table(TABLE_TOOL_INTRO);
$sql = 'SELECT * FROM '.$table;
- $db_result = Database::query($sql, __FILE__, __LINE__);
+ $db_result = Database::query($sql);
while ($obj = Database::fetch_object($db_result))
{
$tool_intro = new ToolIntro($obj->id, $obj->intro_text);
@@ -292,7 +292,7 @@ class CourseBuilder
}
$sql = 'SELECT * FROM '.$link_cat_table.' WHERE id = '.$id;
- $db_result = Database::query($sql, __FILE__, __LINE__);
+ $db_result = Database::query($sql);
while ($obj = Database::fetch_object($db_result))
{
$link_category = new LinkCategory($obj->id, $obj->category_title, $obj->description, $obj->display_order);
@@ -320,7 +320,7 @@ class CourseBuilder
$sql = 'SELECT * FROM '.$table_qui.' WHERE active >=0 AND session_id = 0'; //select only quizzes with active = 0 or 1 (not -1 which is for deleted quizzes)
}
- $db_result = Database::query($sql, __FILE__, __LINE__);
+ $db_result = Database::query($sql);
while ($obj = Database::fetch_object($db_result))
{
if (strlen($obj->sound) > 0)
@@ -330,7 +330,7 @@ class CourseBuilder
}
$quiz = new Quiz($obj->id, $obj->title, $obj->description, $obj->random, $obj->type, $obj->active, $obj->sound, $obj->max_attempt, $obj->results_disabled, $obj->access_condition, $obj->start_time, $obj->end_time, $obj->feedback_type, $obj->random_answers, $obj->expired_time);
$sql = 'SELECT * FROM '.$table_rel.' WHERE exercice_id = '.$obj->id;
- $db_result2 = Database::query($sql, __FILE__, __LINE__);
+ $db_result2 = Database::query($sql);
while ($obj2 = Database::fetch_object($db_result2))
{
$quiz->add_question($obj2->question_id, $obj2->question_order);
@@ -367,12 +367,12 @@ class CourseBuilder
// Building normal tests.
$sql = 'SELECT * FROM '.$table_que;
- $db_result = Database::query($sql, __FILE__, __LINE__);
+ $db_result = Database::query($sql);
while ($obj = Database::fetch_object($db_result))
{
$question = new QuizQuestion($obj->id, $obj->question, $obj->description, $obj->ponderation, $obj->type, $obj->position, $obj->picture,$obj->level);
$sql = 'SELECT * FROM '.$table_ans.' WHERE question_id = '.$obj->id;
- $db_result2 = Database::query($sql, __FILE__, __LINE__);
+ $db_result2 = Database::query($sql);
while ($obj2 = Database::fetch_object($db_result2))
{
$question->add_answer($obj2->id, $obj2->answer, $obj2->correct, $obj2->comment, $obj2->ponderation, $obj2->position, $obj2->hotspot_coordinates, $obj2->hotspot_type);
@@ -385,7 +385,7 @@ class CourseBuilder
$sql = 'SELECT * FROM '.$table_que.
' as questions LEFT JOIN '.$table_rel.' as quizz_questions ON questions.id=quizz_questions.question_id LEFT JOIN '.$table_qui.
' as exercices ON exercice_id=exercices.id WHERE quizz_questions.exercice_id IS NULL OR exercices.active = -1'; // active = -1 means "deleted" test.
- $db_result = Database::query($sql, __FILE__, __LINE__);
+ $db_result = Database::query($sql);
if (Database::num_rows($db_result) > 0)
{
$build_orphan_questions = true;
@@ -393,7 +393,7 @@ class CourseBuilder
{
$question = new QuizQuestion($obj->id, $obj->question, $obj->description, $obj->ponderation, $obj->type, $obj->position, $obj->picture,$obj->level);
$sql = 'SELECT * FROM '.$table_ans.' WHERE question_id = '.(int)$obj->id;
- $db_result2 = Database::query($sql, __FILE__, __LINE__);
+ $db_result2 = Database::query($sql);
while ($obj2 = Database::fetch_object($db_result2))
{
$question->add_answer($obj2->id, $obj2->answer, $obj2->correct, $obj2->comment, $obj2->ponderation, $obj2->position, $obj2->hotspot_coordinates, $obj2->hotspot_type);
@@ -419,7 +419,7 @@ class CourseBuilder
$sql = 'SELECT * FROM '.$table_que.
' as questions LEFT JOIN '.$table_rel.' as quizz_questions ON questions.id=quizz_questions.question_id LEFT JOIN '.$table_qui.
' as exercices ON exercice_id=exercices.id WHERE quizz_questions.exercice_id IS NULL OR exercices.active = -1';
- $db_result = Database::query($sql, __FILE__, __LINE__);
+ $db_result = Database::query($sql);
if (Database::num_rows($db_result) > 0)
{
$orphan_questions = new Quiz(-1, get_lang('OrphanQuestions', ''), '', 0, 0, 1, '', 0); // Tjis is the fictional test for collecting orphan questions.
@@ -428,7 +428,7 @@ class CourseBuilder
{
$question = new QuizQuestion($obj->id, $obj->question, $obj->description, $obj->ponderation, $obj->type, $obj->position, $obj->picture,$obj->level);
$sql = 'SELECT * FROM '.$table_ans.' WHERE question_id = '.$obj->id;
- $db_result2 = Database::query($sql, __FILE__, __LINE__);
+ $db_result2 = Database::query($sql);
while ($obj2 = Database::fetch_object($db_result2))
{
$question->add_answer($obj2->id, $obj2->answer, $obj2->correct, $obj2->comment, $obj2->ponderation, $obj2->position, $obj2->hotspot_coordinates, $obj2->hotspot_type);
@@ -445,7 +445,7 @@ class CourseBuilder
$table_survey = Database :: get_course_table(TABLE_SURVEY);
$table_question = Database :: get_course_table(TABLE_SURVEY_QUESTION);
$sql = 'SELECT * FROM '.$table_survey.' WHERE session_id = 0 ';
- $db_result = Database::query($sql, __FILE__, __LINE__);
+ $db_result = Database::query($sql);
while ($obj = Database::fetch_object($db_result))
{
$survey = new Survey($obj->survey_id, $obj->code,$obj->title,
@@ -455,7 +455,7 @@ class CourseBuilder
$obj->creation_date, $obj->invited, $obj->answered,
$obj->invite_mail, $obj->reminder_mail);
$sql = 'SELECT * FROM '.$table_question.' WHERE survey_id = '.$obj->survey_id;
- $db_result2 = Database::query($sql, __FILE__, __LINE__);
+ $db_result2 = Database::query($sql);
while ($obj2 = Database::fetch_object($db_result2))
{
$survey->add_question($obj2->question_id);
@@ -472,7 +472,7 @@ class CourseBuilder
$table_que = Database :: get_course_table(TABLE_SURVEY_QUESTION);
$table_opt = Database :: get_course_table(TABLE_SURVEY_QUESTION_OPTION);
$sql = 'SELECT * FROM '.$table_que;
- $db_result = Database::query($sql, __FILE__, __LINE__);
+ $db_result = Database::query($sql);
while ($obj = Database::fetch_object($db_result))
{
$question = new SurveyQuestion($obj->question_id, $obj->survey_id,
@@ -480,7 +480,7 @@ class CourseBuilder
$obj->type, $obj->display, $obj->sort,
$obj->shared_question_id, $obj->max_value);
$sql = 'SELECT * FROM '.$table_opt.' WHERE question_id = '."'".$obj->question_id."'";
- $db_result2 = Database::query($sql, __FILE__, __LINE__);
+ $db_result2 = Database::query($sql);
while ($obj2 = Database::fetch_object($db_result2))
{
$question->add_answer($obj2->option_text, $obj2->sort);
@@ -495,7 +495,7 @@ class CourseBuilder
{
$table = Database :: get_course_table(TABLE_ANNOUNCEMENT);
$sql = 'SELECT * FROM '.$table.' WHERE session_id = 0';
- $db_result = Database::query($sql, __FILE__, __LINE__);
+ $db_result = Database::query($sql);
while ($obj = Database::fetch_object($db_result))
{
$announcement = new Announcement($obj->id, $obj->title, $obj->content, $obj->end_date,$obj->display_order,$obj->email_sent);
@@ -509,7 +509,7 @@ class CourseBuilder
{
$table = Database :: get_course_table(TABLE_AGENDA);
$sql = 'SELECT * FROM '.$table.' WHERE session_id = 0';
- $db_result = Database::query($sql, __FILE__, __LINE__);
+ $db_result = Database::query($sql);
while ($obj = Database::fetch_object($db_result))
{
$event = new Event($obj->id, $obj->title, $obj->content, $obj->start_date, $obj->end_date);
@@ -531,7 +531,7 @@ class CourseBuilder
$sql = 'SELECT * FROM '.$table. ' WHERE session_id = 0';
}
- $db_result = Database::query($sql, __FILE__, __LINE__);
+ $db_result = Database::query($sql);
while ($obj = Database::fetch_object($db_result))
{
$cd = new CourseDescription($obj->id, $obj->title, $obj->content, $obj->description_type);
@@ -559,7 +559,7 @@ class CourseBuilder
$sql = 'SELECT * FROM '.$table_main.' WHERE session_id = 0';
}
- $db_result = Database::query($sql, __FILE__, __LINE__);
+ $db_result = Database::query($sql);
while ($obj = Database::fetch_object($db_result))
{
@@ -661,7 +661,7 @@ class CourseBuilder
}
}
- $db_result = Database::query($sql, __FILE__, __LINE__);
+ $db_result = Database::query($sql);
while ($obj = Database::fetch_object($db_result))
{
$doc = new Glossary($obj->glossary_id, $obj->name, $obj->description, $obj->display_order);
@@ -688,7 +688,7 @@ class CourseBuilder
$sql_session = "SELECT id, name, course_code FROM $tbl_session_course
INNER JOIN $tbl_session ON id_session = id
WHERE course_code = '$code_course' ";
- $query_session = Database::query($sql_session, __FILE__, __LINE__);
+ $query_session = Database::query($sql_session);
while ($rows_session = Database::fetch_assoc($query_session)) {
$session = new CourseSession($rows_session['id'], $rows_session['name']);
$this->course->add_resource($session);
@@ -709,7 +709,7 @@ class CourseBuilder
$tbl_wiki = Database::get_course_table(TABLE_WIKI);
$sql = 'SELECT * FROM ' . $tbl_wiki . ' WHERE session_id = 0';
}
- $db_result = api_sql_query($sql, __FILE__, __LINE__);
+ $db_result = api_sql_query($sql);
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);
diff --git a/main/coursecopy/classes/CourseRecycler.class.php b/main/coursecopy/classes/CourseRecycler.class.php
index e0273546ba..306c8b8937 100755
--- a/main/coursecopy/classes/CourseRecycler.class.php
+++ b/main/coursecopy/classes/CourseRecycler.class.php
@@ -61,16 +61,16 @@ class CourseRecycler
foreach ($resources as $id => $resource)
{
$sql = "DELETE FROM ".$table_linked_resources." WHERE (source_type = '".$type."' AND source_id = '".$id."') OR (resource_type = '".$type."' AND resource_id = '".$id."') ";
- Database::query($sql,__FILE__,__LINE__);
+ Database::query($sql);
if(is_numeric($id))
{
$sql = "DELETE FROM ".$table_item_properties." WHERE tool ='".$resource->get_tool()."' AND ref=".$id;
- Database::query($sql, __FILE__, __LINE__);
+ Database::query($sql);
}
elseif ($type == RESOURCE_TOOL_INTRO)
{
$sql = "DELETE FROM $table_tool_intro WHERE id='$id'";
- Database::query($sql, __FILE__, __LINE__);
+ Database::query($sql);
}
}
}
@@ -102,10 +102,10 @@ class CourseRecycler
}
$ids = implode(',', (array_keys($this->course->resources[RESOURCE_DOCUMENT])));
$sql = "DELETE FROM ".$table." WHERE id IN(".$ids.")";
- Database::query($sql,__FILE__,__LINE__);
+ Database::query($sql);
}
}
-
+
/**
* Delete wiki
*/
@@ -118,18 +118,18 @@ class CourseRecycler
$pages = array();
foreach ($this->course->resources[RESOURCE_WIKI] as $resource) {
- $pages[] = $resource->page_id;
+ $pages[] = $resource->page_id;
}
$wiki_ids = implode(',', (array_keys($this->course->resources[RESOURCE_WIKI])));
$page_ids = implode(',', $pages);
$sql = "DELETE FROM ".$table_wiki." WHERE id IN(".$wiki_ids.")";
- Database::query($sql,__FILE__,__LINE__);
+ Database::query($sql);
$sql = "DELETE FROM ".$table_wiki_conf." WHERE page_id IN(".$page_ids.")";
- Database::query($sql,__FILE__,__LINE__);
- }
+ Database::query($sql);
+ }
}
-
+
/**
* Delete glossary
*/
@@ -138,10 +138,10 @@ class CourseRecycler
$table_glossary = Database::get_course_table(TABLE_GLOSSARY);
$ids = implode(',', (array_keys($this->course->resources[RESOURCE_GLOSSARY])));
$sql = "DELETE FROM ".$table_glossary." WHERE glossary_id IN(".$ids.")";
- Database::query($sql,__FILE__,__LINE__);
+ Database::query($sql);
}
}
-
+
/**
* Delete links
*/
@@ -152,7 +152,7 @@ class CourseRecycler
$table = Database :: get_course_table(TABLE_LINK);
$ids = implode(',', (array_keys($this->course->resources[RESOURCE_LINK])));
$sql = "DELETE FROM ".$table." WHERE id IN(".$ids.")";
- Database::query($sql,__FILE__,__LINE__);
+ Database::query($sql);
}
}
/**
@@ -178,44 +178,44 @@ class CourseRecycler
" USING ".$table_attachment." INNER JOIN ".$table_post.
" WHERE ".$table_attachment.".post_id = ".$table_post.".post_id".
" AND ".$table_post.".forum_id IN(".$forum_ids.");";
- Database::query($sql,__FILE__,__LINE__);
+ Database::query($sql);
$sql = "DELETE FROM ".$table_mail_queue.
" USING ".$table_mail_queue." INNER JOIN ".$table_post.
" WHERE ".$table_mail_queue.".post_id = ".$table_post.".post_id".
" AND ".$table_post.".forum_id IN(".$forum_ids.");";
- Database::query($sql,__FILE__,__LINE__);
+ Database::query($sql);
// Just in case, deleting in the same table using thread_id as record-linker.
$sql = "DELETE FROM ".$table_mail_queue.
" USING ".$table_mail_queue." INNER JOIN ".$table_thread.
" WHERE ".$table_mail_queue.".thread_id = ".$table_thread.".thread_id".
" AND ".$table_thread.".forum_id IN(".$forum_ids.");";
- Database::query($sql,__FILE__,__LINE__);
+ Database::query($sql);
$sql = "DELETE FROM ".$table_thread_qualify.
" USING ".$table_thread_qualify." INNER JOIN ".$table_thread.
" WHERE ".$table_thread_qualify.".thread_id = ".$table_thread.".thread_id".
" AND ".$table_thread.".forum_id IN(".$forum_ids.");";
- Database::query($sql,__FILE__,__LINE__);
+ Database::query($sql);
$sql = "DELETE FROM ".$table_thread_qualify_log.
" USING ".$table_thread_qualify_log." INNER JOIN ".$table_thread.
" WHERE ".$table_thread_qualify_log.".thread_id = ".$table_thread.".thread_id".
" AND ".$table_thread.".forum_id IN(".$forum_ids.");";
- Database::query($sql,__FILE__,__LINE__);
+ Database::query($sql);
$sql = "DELETE FROM ".$table_notification." WHERE forum_id IN(".$forum_ids.")";
- Database::query($sql,__FILE__,__LINE__);
+ Database::query($sql);
$sql = "DELETE FROM ".$table_post." WHERE forum_id IN(".$forum_ids.")";
- Database::query($sql,__FILE__,__LINE__);
+ Database::query($sql);
$sql = "DELETE FROM ".$table_thread." WHERE forum_id IN(".$forum_ids.")";
- Database::query($sql,__FILE__,__LINE__);
+ Database::query($sql);
$sql = "DELETE FROM ".$table_forum." WHERE forum_id IN(".$forum_ids.")";
- Database::query($sql,__FILE__,__LINE__);
+ Database::query($sql);
}
}
/**
@@ -227,11 +227,11 @@ class CourseRecycler
$table_forum = Database :: get_course_table(TABLE_FORUM);
$table_forumcat = Database :: get_course_table(TABLE_FORUM_CATEGORY);
$sql = "SELECT fc.cat_id FROM ".$table_forumcat." fc LEFT JOIN ".$table_forum." f ON fc.cat_id=f.forum_category WHERE f.forum_id IS NULL";
- $res = Database::query($sql,__FILE__,__LINE__);
+ $res = Database::query($sql);
while ($obj = Database::fetch_object($res))
{
$sql = "DELETE FROM ".$table_forumcat." WHERE cat_id = ".$obj->cat_id;
- Database::query($sql,__FILE__,__LINE__);
+ Database::query($sql);
}
}
/**
@@ -243,11 +243,11 @@ class CourseRecycler
$link_cat_table = Database :: get_course_table(TABLE_LINK_CATEGORY);
$link_table = Database :: get_course_table(TABLE_LINK);
$sql = "SELECT lc.id FROM ".$link_cat_table." lc LEFT JOIN ".$link_table." l ON lc.id=l.category_id WHERE l.id IS NULL";
- $res = Database::query($sql,__FILE__,__LINE__);
+ $res = Database::query($sql);
while ($obj = Database::fetch_object($res))
{
$sql = "DELETE FROM ".$link_cat_table." WHERE id = ".$obj->id;
- Database::query($sql,__FILE__,__LINE__);
+ Database::query($sql);
}
}
/**
@@ -260,7 +260,7 @@ class CourseRecycler
$table = Database :: get_course_table(TABLE_AGENDA);
$ids = implode(',', (array_keys($this->course->resources[RESOURCE_EVENT])));
$sql = "DELETE FROM ".$table." WHERE id IN(".$ids.")";
- Database::query($sql,__FILE__,__LINE__);
+ Database::query($sql);
}
}
/**
@@ -273,7 +273,7 @@ class CourseRecycler
$table = Database :: get_course_table(TABLE_ANNOUNCEMENT);
$ids = implode(',', (array_keys($this->course->resources[RESOURCE_ANNOUNCEMENT])));
$sql = "DELETE FROM ".$table." WHERE id IN(".$ids.")";
- Database::query($sql,__FILE__,__LINE__);
+ Database::query($sql);
}
}
/**
@@ -294,9 +294,9 @@ class CourseRecycler
// Deletion of the normal tests, questions in them are not deleted, they become orphan at this moment.
$sql = "DELETE FROM ".$table_qui." WHERE id <> -1 AND id IN(".$ids.")";
- Database::query($sql,__FILE__,__LINE__);
+ Database::query($sql);
$sql = "DELETE FROM ".$table_rel." WHERE exercice_id <> -1 AND exercice_id IN(".$ids.")";
- Database::query($sql,__FILE__,__LINE__);
+ Database::query($sql);
// Identifying again and deletion of the orphan questions, if it was desired.
if ($delete_orphan_questions)
@@ -304,7 +304,7 @@ class CourseRecycler
$sql = 'SELECT questions.id FROM '.$table_qui_que.
' as questions LEFT JOIN '.$table_rel.' as quizz_questions ON questions.id=quizz_questions.question_id LEFT JOIN '.$table_qui.
' as exercices ON exercice_id=exercices.id WHERE quizz_questions.exercice_id IS NULL OR exercices.active = -1'; // active = -1 means "deleted" test.
- $db_result = Database::query($sql, __FILE__, __LINE__);
+ $db_result = Database::query($sql);
if (Database::num_rows($db_result) > 0)
{
$orphan_ids = array();
@@ -314,18 +314,18 @@ class CourseRecycler
}
$orphan_ids = implode(',', $orphan_ids);
$sql = "DELETE FROM ".$table_rel." WHERE question_id IN(".$orphan_ids.")";
- Database::query($sql,__FILE__,__LINE__);
+ Database::query($sql);
$sql = "DELETE FROM ".$table_qui_ans." WHERE question_id IN(".$orphan_ids.")";
- Database::query($sql,__FILE__,__LINE__);
+ Database::query($sql);
$sql = "DELETE FROM ".$table_qui_que." WHERE id IN(".$orphan_ids.")";
- Database::query($sql,__FILE__,__LINE__);
+ Database::query($sql);
}
}
}
// Purge "deleted" tests (active = -1).
$sql = "DELETE FROM ".$table_qui." WHERE active = -1";
- Database::query($sql,__FILE__,__LINE__);
+ Database::query($sql);
}
/**
* Recycle surveys - removes everything
@@ -341,15 +341,15 @@ class CourseRecycler
$table_survey_i = Database :: get_course_table(TABLE_SURVEY_INVITATION);
$ids = implode(',', (array_keys($this->course->resources[RESOURCE_SURVEY])));
$sql = "DELETE FROM ".$table_survey_i." ";
- Database::query($sql,__FILE__,__LINE__);
+ Database::query($sql);
$sql = "DELETE FROM ".$table_survey_a." WHERE survey_id IN(".$ids.")";
- Database::query($sql,__FILE__,__LINE__);
+ Database::query($sql);
$sql = "DELETE FROM ".$table_survey_q_o." WHERE survey_id IN(".$ids.")";
- Database::query($sql,__FILE__,__LINE__);
+ Database::query($sql);
$sql = "DELETE FROM ".$table_survey_q." WHERE survey_id IN(".$ids.")";
- Database::query($sql,__FILE__,__LINE__);
+ Database::query($sql);
$sql = "DELETE FROM ".$table_survey." WHERE survey_id IN(".$ids.")";
- Database::query($sql,__FILE__,__LINE__);
+ Database::query($sql);
}
}
/**
@@ -369,34 +369,34 @@ class CourseRecycler
{
//remove links from course homepage
$sql = "DELETE FROM $table_tool WHERE link LIKE '%lp_controller.php%lp_id=$id%' AND image='scormbuilder.gif'";
- Database::query($sql,__FILE__,__LINE__);
+ Database::query($sql);
//remove elements from lp_* tables (from bottom-up) by removing interactions, then item_view, then views and items, then paths
$sql_items = "SELECT id FROM $table_item WHERE lp_id=$id";
- $res_items = Database::query($sql_items,__FILE__,__LINE__);
+ $res_items = Database::query($sql_items);
while ($row_item = Database::fetch_array($res_items))
{
//get item views
$sql_iv = "SELECT id FROM $table_iv WHERE lp_item_id=".$row_item['id'];
- $res_iv = Database::query($sql_iv,__FILE__,__LINE__);
+ $res_iv = Database::query($sql_iv);
while ($row_iv = Database::fetch_array($res_iv))
{
//delete interactions
$sql_iv_int_del = "DELETE FROM $table_iv_int WHERE lp_iv_id = ".$row_iv['id'];
- $res_iv_int_del = Database::query($sql_iv_int_del,__FILE__,__LINE__);
+ $res_iv_int_del = Database::query($sql_iv_int_del);
}
//delete item views
$sql_iv_del = "DELETE FROM $table_iv WHERE lp_item_id=".$row_item['id'];
- $res_iv_del = Database::query($sql_iv_del,__FILE__,__LINE__);
+ $res_iv_del = Database::query($sql_iv_del);
}
//delete items
$sql_items_del = "DELETE FROM $table_item WHERE lp_id=$id";
- $res_items_del = Database::query($sql_items_del,__FILE__,__LINE__);
+ $res_items_del = Database::query($sql_items_del);
//delete views
$sql_views_del = "DELETE FROM $table_view WHERE lp_id=$id";
- $res_views_del = Database::query($sql_views_del,__FILE__,__LINE__);
+ $res_views_del = Database::query($sql_views_del);
//delete lps
$sql_del = "DELETE FROM $table_main WHERE id = $id";
- $res_del = Database::query($sql_del,__FILE__,__LINE__);
+ $res_del = Database::query($sql_del);
}
}
}
@@ -410,7 +410,7 @@ class CourseRecycler
$table = Database :: get_course_table(TABLE_COURSE_DESCRIPTION);
$ids = implode(',', (array_keys($this->course->resources[RESOURCE_COURSEDESCRIPTION])));
$sql = "DELETE FROM ".$table." WHERE id IN(".$ids.")";
- Database::query($sql,__FILE__,__LINE__);
+ Database::query($sql);
}
}
}
diff --git a/main/coursecopy/classes/CourseRestorer.class.php b/main/coursecopy/classes/CourseRestorer.class.php
index 53cafaefca..656cecb5d3 100755
--- a/main/coursecopy/classes/CourseRestorer.class.php
+++ b/main/coursecopy/classes/CourseRestorer.class.php
@@ -158,7 +158,7 @@ class CourseRestorer
// First check if there isn't allready a record for this resource
$sql = "SELECT * FROM $table WHERE tool = '".$property['tool']."' AND ref = '".$resource->destination_id."'";
- $res = Database::query($sql,__FILE__,__LINE__);
+ $res = Database::query($sql);
if( Database::num_rows($res) == 0) {
// The to_group_id and to_user_id are set to default values as users/groups possibly not exist in the target course
$sql = "INSERT INTO $table SET
@@ -175,7 +175,7 @@ class CourseRestorer
to_user_id = '".Database::escape_string($property['to_user_id'])."',
to_group_id = '0' $condition_session" ;
;
- Database::query($sql, __FILE__, __LINE__);
+ Database::query($sql);
}
}
}
@@ -195,7 +195,7 @@ class CourseRestorer
{
$to_resource = $this->course->resources[$to_type][$to_id];
$sql = "INSERT INTO ".$table." SET source_type = '".$type."', source_id = '".$resource->destination_id."', resource_type='".$to_type."', resource_id='".$to_resource->destination_id."' ";
- Database::query($sql, __FILE__, __LINE__);
+ Database::query($sql);
}
}
}
@@ -225,7 +225,7 @@ class CourseRestorer
$new = substr($document->path, 8);
if (!is_dir($path.'document/'.$new)) {
$sql = "SELECT id FROM ".$table." WHERE path='/".Database::escape_string($new)."'";
- $res = Database::query($sql, __FILE__, __LINE__);
+ $res = Database::query($sql);
$num_result = Database::num_rows($res);
if ($num_result==0) {
$created_dir = create_unexisting_directory($destination_course,api_get_user_id(),0, 0 ,$path.'document',$new,basename($new),$visibility);
@@ -241,7 +241,7 @@ class CourseRestorer
$my_temp .= $dirs[$i];
if (!is_dir($path.'document/'.$my_temp)) {
$sql = "SELECT id FROM ".$table." WHERE path='/".Database::escape_string($my_temp)."'";
- $res = Database::query($sql, __FILE__, __LINE__);
+ $res = Database::query($sql);
$num_result = Database::num_rows($res);
if ($num_result==0) {
$created_dir = create_unexisting_directory($destination_course,api_get_user_id(),0, 0 ,$path.'document','/'.$my_temp,basename($my_temp));
@@ -271,15 +271,15 @@ class CourseRestorer
copy($origin_path, $path.$document->path);
}
$sql = "SELECT id FROM ".$table." WHERE path='/".substr($document->path, 9)."'";
- $res = Database::query($sql, __FILE__, __LINE__);
+ $res = Database::query($sql);
$obj = Database::fetch_object($res);
$this->course->resources[RESOURCE_DOCUMENT][$id]->destination_id = $obj->id;
$sql = "UPDATE ".$table." SET comment = '".Database::escape_string($document->comment)."', title='".Database::escape_string($document->title)."', size='".$document->size."' WHERE id = '".$obj->id."'";
- Database::query($sql, __FILE__, __LINE__);
+ Database::query($sql);
break;
case FILE_SKIP :
$sql = "SELECT id FROM ".$table." WHERE path='/".Database::escape_string(substr($document->path, 9))."'";
- $res = Database::query($sql, __FILE__, __LINE__);
+ $res = Database::query($sql);
$obj = Database::fetch_object($res);
$this->course->resources[RESOURCE_DOCUMENT][$id]->destination_id = $obj->id;
break;
@@ -353,20 +353,20 @@ class CourseRestorer
copy($course_path.$document->path, $dest_document_path);
$sql = "INSERT INTO $table SET path = '$path_title', comment = '".Database::escape_string($document->comment)."', title = '".Database::escape_string(basename($path_title))."' ,filetype='".$document->file_type."', size= '".$document->size."', session_id = '$session_id'";
- Database::query($sql, __FILE__, __LINE__);
+ Database::query($sql);
$this->course->resources[RESOURCE_DOCUMENT][$id]->destination_id = Database::insert_id();
} else {
copy($path.$document->path, $path.$new_file_name);
$sql = "INSERT INTO ".$table." SET path = '/".Database::escape_string(substr($new_file_name, 9))."', comment = '".Database::escape_string($document->comment)."', title = '".Database::escape_string($document->title)."' ,filetype='".$document->file_type."', size= '".$document->size."', session_id = '$session_id'";
- Database::query($sql, __FILE__, __LINE__);
+ Database::query($sql);
$this->course->resources[RESOURCE_DOCUMENT][$id]->destination_id = Database::insert_id();
}
} else {
copy($this->course->backup_path.'/'.$document->path, $path.$new_file_name);
$sql = "INSERT INTO ".$table." SET path = '/".Database::escape_string(substr($new_file_name, 9))."', comment = '".Database::escape_string($document->comment)."', title = '".Database::escape_string($document->title)."' ,filetype='".$document->file_type."', size= '".$document->size."'";
- Database::query($sql, __FILE__, __LINE__);
+ Database::query($sql);
$this->course->resources[RESOURCE_DOCUMENT][$id]->destination_id = Database::insert_id();
}
break;
@@ -381,7 +381,7 @@ class CourseRestorer
{
copy($this->course->backup_path.'/'.$document->path, $path.$document->path);
$sql = "INSERT INTO ".$table." SET path = '/".substr($document->path, 9)."', comment = '".Database::escape_string($document->comment)."', title = '".Database::escape_string($document->title)."' ,filetype='".$document->file_type."', size= '".$document->size."'";
- Database::query($sql, __FILE__, __LINE__);
+ Database::query($sql);
$this->course->resources[RESOURCE_DOCUMENT][$id]->destination_id = Database::insert_id();
}
else
@@ -404,7 +404,7 @@ class CourseRestorer
else
{
/*$sql = "SELECT id FROM ".$table." WHERE path = '/".Database::escape_string(substr($document->path, 9))."'";
- $res = Database::query($sql,__FILE__,__LINE__);
+ $res = Database::query($sql);
if( Database::num_rows($res)> 0)
{
$obj = Database::fetch_object($res);
@@ -413,7 +413,7 @@ class CourseRestorer
else
{
$sql = "INSERT INTO ".$table." SET path = '/".Database::escape_string(substr($document->path, 9))."', comment = '".Database::escape_string($document->comment)."', title = '".Database::escape_string($document->title)."' ,filetype='".$document->file_type."', size= '".$document->size."'";
- Database::query($sql, __FILE__, __LINE__);
+ Database::query($sql);
$this->course->resources[RESOURCE_DOCUMENT][$id]->destination_id = Database::insert_id();
}*/
} // end folder
@@ -532,7 +532,7 @@ class CourseRestorer
", locked = ".(int)Database::escape_string($forum->locked).
", session_id = ".(int)Database::escape_string($forum->session_id).
", forum_image = '".Database::escape_string($forum->image)."'";
- Database::query($sql, __FILE__, __LINE__);
+ Database::query($sql);
$new_id = Database::insert_id();
$this->course->resources[RESOURCE_FORUM][$id]->destination_id = $new_id;
$forum_topics = 0;
@@ -551,7 +551,7 @@ class CourseRestorer
{
$last_post = $this->course->resources[RESOURCE_FORUMPOST][$forum->last_post];
$sql = "UPDATE ".$table_forum." SET forum_threads = ".$forum_topics.", forum_last_post = ".(int)$last_post->destination_id." WHERE forum_id = ".(int)$new_id;
- Database::query($sql, __FILE__, __LINE__);
+ Database::query($sql);
}
}
}
@@ -580,7 +580,7 @@ class CourseRestorer
"', cat_order = ".(int)Database::escape_string($forum_cat->order).
", locked = ".(int)Database::escape_string($forum_cat->locked).
", session_id = ".(int)Database::escape_string($forum_cat->session_id);
- Database::query($sql, __FILE__, __LINE__);
+ Database::query($sql);
$new_id = Database::insert_id();
$this->course->resources[RESOURCE_FORUMCATEGORY][$id]->destination_id = $new_id;
return $new_id;
@@ -608,7 +608,7 @@ class CourseRestorer
"', thread_weight = ".(float)Database::escape_string($topic->weight).
", thread_title_qualify = '".Database::escape_string($topic->title_qualify).
"', thread_qualify_max = ".(float)Database::escape_string($topic->qualify_max);
- Database::query($sql, __FILE__, __LINE__);
+ Database::query($sql);
$new_id = Database::insert_id();
$this->course->resources[RESOURCE_FORUMTOPIC][$id]->destination_id = $new_id;
$topic_replies = -1;
@@ -624,12 +624,12 @@ class CourseRestorer
if (is_object($last_post))
{
$sql = "UPDATE ".$table." SET thread_last_post = ".(int)$last_post->destination_id;
- Database::query($sql, __FILE__, __LINE__);
+ Database::query($sql);
}
if ($topic_replies >= 0)
{
$sql = "UPDATE ".$table." SET thread_replies = ".$topic_replies;
- Database::query($sql, __FILE__, __LINE__);
+ Database::query($sql);
}
return $new_id;
}
@@ -653,7 +653,7 @@ class CourseRestorer
"', post_notification = ".(int)Database::escape_string($post->topic_notify).
", post_parent_id = ".(int)Database::escape_string($post->parent_post_id).
", visible = ".(int)Database::escape_string($post->visible);
- Database::query($sql, __FILE__, __LINE__);
+ Database::query($sql);
$new_id = Database::insert_id();
$this->course->resources[RESOURCE_FORUMPOST][$id]->destination_id = $new_id;
return $new_id;
@@ -671,7 +671,7 @@ class CourseRestorer
{
$cat_id = $this->restore_link_category($link->category_id,$session_id);
$sql = "SELECT MAX(display_order) FROM $link_table WHERE category_id='" . Database::escape_string($cat_id). "'";
- $result = Database::query($sql, __FILE__, __LINE__);
+ $result = Database::query($sql);
list($max_order) = Database::fetch_array($result);
$condition_session = "";
@@ -681,7 +681,7 @@ class CourseRestorer
$sql = "INSERT INTO ".$link_table." SET url = '".Database::escape_string($link->url)."', title = '".Database::escape_string($link->title)."', description = '".Database::escape_string($link->description)."', category_id='".$cat_id."', on_homepage = '".$link->on_homepage."', display_order='".($max_order+1)."' $condition_session";
- Database::query($sql, __FILE__, __LINE__);
+ Database::query($sql);
$this->course->resources[RESOURCE_LINK][$id]->destination_id = Database::insert_id();
}
}
@@ -698,10 +698,10 @@ class CourseRestorer
foreach ($resources[RESOURCE_TOOL_INTRO] as $id => $tool_intro)
{
$sql = "DELETE FROM ".$tool_intro_table." WHERE id='".Database::escape_string($tool_intro->id)."'";
- Database::query($sql, __FILE__, __LINE__);
+ Database::query($sql);
$sql = "INSERT INTO ".$tool_intro_table." SET id='".Database::escape_string($tool_intro->id)."', intro_text = '".Database::escape_string($tool_intro->intro_text)."'";
- Database::query($sql, __FILE__, __LINE__);
+ Database::query($sql);
$this->course->resources[RESOURCE_TOOL_INTRO][$id]->destination_id = Database::insert_id();
}
@@ -726,11 +726,11 @@ class CourseRestorer
if (is_object($link_cat) && !$link_cat->is_restored())
{
$sql = "SELECT MAX(display_order) FROM $link_cat_table";
- $result=Database::query($sql,__FILE__,__LINE__);
+ $result=Database::query($sql);
list($orderMax)=Database::fetch_array($result,'NUM');
$display_order=$orderMax+1;
$sql = "INSERT INTO ".$link_cat_table." SET category_title = '".Database::escape_string($link_cat->title)."', description='".Database::escape_string($link_cat->description)."', display_order='".$display_order."' $condition_session ";
- Database::query($sql, __FILE__, __LINE__);
+ Database::query($sql);
$new_id = Database::insert_id();
$this->course->resources[RESOURCE_LINKCATEGORY][$id]->destination_id = $new_id;
return $new_id;
@@ -748,11 +748,11 @@ class CourseRestorer
$resources = $this->course->resources;
foreach ($resources[RESOURCE_EVENT] as $id => $event)
{
- // check resources inside html from fckeditor tool and copy correct urls into recipient course
+ // check resources inside html from fckeditor tool and copy correct urls into recipient course
$event->content = DocumentManager::replace_urls_inside_content_html_from_copy_course($event->content, $this->course->code, $this->course->destination_path);
-
+
$sql = "INSERT INTO ".$table." SET title = '".Database::escape_string($event->title)."', content = '".Database::escape_string($event->content)."', start_date = '".$event->start_date."', end_date = '".$event->end_date."'";
- Database::query($sql, __FILE__, __LINE__);
+ Database::query($sql);
$this->course->resources[RESOURCE_EVENT][$id]->destination_id = Database::insert_id();
}
}
@@ -776,7 +776,7 @@ class CourseRestorer
$course_destination=$this->course->destination_path;
}
- // check resources inside html from fckeditor tool and copy correct urls into recipient course
+ // check resources inside html from fckeditor tool and copy correct urls into recipient course
$description_content = DocumentManager::replace_urls_inside_content_html_from_copy_course($cd->content, $this->course->code, $this->course->destination_path);
$condition_session = "";
@@ -785,7 +785,7 @@ class CourseRestorer
$condition_session = " , session_id = '$session_id' ";
}
$sql = "INSERT INTO ".$table." SET description_type = '".Database::escape_string($cd->description_type)."',title = '".Database::escape_string($cd->title)."', content = '".Database::escape_string($description_content)."' $condition_session";
- Database::query($sql, __FILE__, __LINE__);
+ Database::query($sql);
$this->course->resources[RESOURCE_COURSEDESCRIPTION][$id]->destination_id = Database::insert_id();
}
}
@@ -801,17 +801,17 @@ class CourseRestorer
$resources = $this->course->resources;
foreach ($resources[RESOURCE_ANNOUNCEMENT] as $id => $announcement)
{
-
- // check resources inside html from fckeditor tool and copy correct urls into recipient course
+
+ // check resources inside html from fckeditor tool and copy correct urls into recipient course
$announcement->content = DocumentManager::replace_urls_inside_content_html_from_copy_course($announcement->content, $this->course->code, $this->course->destination_path);
-
+
$sql = "INSERT INTO ".$table." " .
"SET title = '".Database::escape_string($announcement->title)."'," .
"content = '".Database::escape_string($announcement->content)."', " .
"end_date = '".$announcement->date."', " .
"display_order = '".$announcement->display_order."', " .
"email_sent = '".$announcement->email_sent."'";
- Database::query($sql, __FILE__, __LINE__);
+ Database::query($sql);
$this->course->resources[RESOURCE_ANNOUNCEMENT][$id]->destination_id = Database::insert_id();
}
}
@@ -835,7 +835,7 @@ class CourseRestorer
if ($this->course->resources[RESOURCE_DOCUMENT][$quiz->media]->is_restored())
{
$sql = "SELECT path FROM ".$table_doc." WHERE id = ".$resources[RESOURCE_DOCUMENT][$quiz->media]->destination_id;
- $doc = Database::query($sql, __FILE__, __LINE__);
+ $doc = Database::query($sql);
$doc = Database::fetch_object($doc);
$doc = str_replace('/audio/', '', $doc->path);
}
@@ -849,7 +849,7 @@ class CourseRestorer
$condition_session = " , session_id = '$session_id' ";
}
- // check resources inside html from fckeditor tool and copy correct urls into recipient course
+ // check resources inside html from fckeditor tool and copy correct urls into recipient course
$quiz->description = DocumentManager::replace_urls_inside_content_html_from_copy_course($quiz->description, $this->course->code, $this->course->destination_path);
// Normal tests are stored in the database.
@@ -869,7 +869,7 @@ class CourseRestorer
", random_answers = ".(int)$quiz->random_answers.
", expired_time = ".(int)$quiz->expired_time.
$condition_session;
- Database::query($sql, __FILE__, __LINE__);
+ Database::query($sql);
$new_id = Database::insert_id();
} else {
// $id = -1 identifies the fictionary test for collecting orphan questions. We do not store it in the database.
@@ -879,7 +879,7 @@ class CourseRestorer
foreach ($quiz->question_ids as $index => $question_id) {
$qid = $this->restore_quiz_question($question_id);
$sql = "INSERT IGNORE INTO ".$table_rel." SET question_id = ".$qid.", exercice_id = ".$new_id.", question_order = ".$quiz->question_orders[$index]."";
- Database::query($sql, __FILE__, __LINE__);
+ Database::query($sql);
}
}
}
@@ -902,29 +902,29 @@ class CourseRestorer
}
$table_que = Database :: get_course_table(TABLE_QUIZ_QUESTION, $this->course->destination_db);
$table_ans = Database :: get_course_table(TABLE_QUIZ_ANSWER, $this->course->destination_db);
-
- // check resources inside html from fckeditor tool and copy correct urls into recipient course
+
+ // check resources inside html from fckeditor tool and copy correct urls into recipient course
$question->description = DocumentManager::replace_urls_inside_content_html_from_copy_course($question->description, $this->course->code, $this->course->destination_path);
-
+
$sql = "INSERT INTO ".$table_que." SET question = '".addslashes($question->question)."', description = '".addslashes($question->description)."', ponderation = '".addslashes($question->ponderation)."', position = '".addslashes($question->position)."', type='".addslashes($question->quiz_type)."', picture='".addslashes($question->picture)."', level='".addslashes($question->level)."'";
- Database::query($sql, __FILE__, __LINE__);
+ Database::query($sql);
$new_id = Database::insert_id();
if ($question->quiz_type == 4) { // for answer type matching
foreach ($question->answers as $index => $answer) {
$sql = "INSERT INTO ".$table_ans." SET id= '".$answer['id']."',question_id = '".$new_id."', answer = '".Database::escape_string($answer['answer'])."', correct = '".$answer['correct']."', comment = '".Database::escape_string($answer['comment'])."', ponderation='".$answer['ponderation']."', position = '".$answer['position']."', hotspot_coordinates = '".$answer['hotspot_coordinates']."', hotspot_type = '".$answer['hotspot_type']."'";
- Database::query($sql, __FILE__, __LINE__);
+ Database::query($sql);
}
} else {
foreach ($question->answers as $index => $answer) {
-
- // check resources inside html from fckeditor tool and copy correct urls into recipient course
+
+ // check resources inside html from fckeditor tool and copy correct urls into recipient course
$answer['answer'] = DocumentManager::replace_urls_inside_content_html_from_copy_course($answer['answer'], $this->course->code, $this->course->destination_path);
$answer['comment'] = DocumentManager::replace_urls_inside_content_html_from_copy_course($answer['comment'], $this->course->code, $this->course->destination_path);
-
+
$sql = "INSERT INTO ".$table_ans." SET id= '". ($index +1)."',question_id = '".$new_id."', answer = '".Database::escape_string($answer['answer'])."', correct = '".$answer['correct']."', comment = '".Database::escape_string($answer['comment'])."', ponderation='".$answer['ponderation']."', position = '".$answer['position']."', hotspot_coordinates = '".$answer['hotspot_coordinates']."', hotspot_type = '".$answer['hotspot_type']."'";
- Database::query($sql, __FILE__, __LINE__);
+ Database::query($sql);
}
}
$this->course->resources[RESOURCE_QUIZQUESTION][$id]->destination_id = $new_id;
@@ -950,9 +950,9 @@ class CourseRestorer
AND lang="'.Database::escape_string($survey->lang).'"
';
- $result_check = Database::query($sql_check, __FILE__, __LINE__);
+ $result_check = Database::query($sql_check);
- // check resources inside html from fckeditor tool and copy correct urls into recipient course
+ // check resources inside html from fckeditor tool and copy correct urls into recipient course
$survey->title = DocumentManager::replace_urls_inside_content_html_from_copy_course($survey->title, $this->course->code, $this->course->destination_path);
$survey->subtitle = DocumentManager::replace_urls_inside_content_html_from_copy_course($survey->subtitle, $this->course->code, $this->course->destination_path);
$survey->intro = DocumentManager::replace_urls_inside_content_html_from_copy_course($survey->intro, $this->course->code, $this->course->destination_path);
@@ -1017,7 +1017,7 @@ class CourseRestorer
"reminder_mail = '".Database::escape_string($survey->reminder_mail)."'";
//Insert the new source survey
- Database::query($sql, __FILE__, __LINE__);
+ Database::query($sql);
$new_id = Database::insert_id();
$this->course->resources[RESOURCE_SURVEY][$id]->destination_id = $new_id;
@@ -1027,11 +1027,11 @@ class CourseRestorer
$sql = "UPDATE ".$table_que." " .
"SET survey_id = ".$new_id." WHERE " .
"question_id = ".$qid."";
- Database::query($sql, __FILE__, __LINE__);
+ Database::query($sql);
$sql = "UPDATE ".$table_ans." ".
"SET survey_id = ".$new_id." WHERE " .
"question_id = ".$qid."";
- Database::query($sql, __FILE__, __LINE__);
+ Database::query($sql);
}
break;
@@ -1044,7 +1044,7 @@ class CourseRestorer
require_once(api_get_path(SYS_CODE_PATH).'survey/survey.lib.php');
$sql_select_existing_survey = "SELECT * FROM $table_sur WHERE survey_id='".Database::escape_string(Database::result($result_check,0,0))."'";
- $result = Database::query($sql_select_existing_survey, __FILE__, __LINE__);
+ $result = Database::query($sql_select_existing_survey);
$survey_data = Database::fetch_array($result,'ASSOC');
// if the survey is shared => also delete the shared content
@@ -1055,7 +1055,7 @@ class CourseRestorer
$return = survey_manager :: delete_survey($survey_data['survey_id'],false,$this->course->destination_db);
//Insert the new source survey
- Database::query($sql, __FILE__, __LINE__);
+ Database::query($sql);
$new_id = Database::insert_id();
$this->course->resources[RESOURCE_SURVEY][$id]->destination_id = $new_id;
@@ -1065,11 +1065,11 @@ class CourseRestorer
$sql = "UPDATE ".$table_que." " .
"SET survey_id = ".$new_id." WHERE " .
"question_id = ".$qid."";
- Database::query($sql, __FILE__, __LINE__);
+ Database::query($sql);
$sql = "UPDATE ".$table_ans." ".
"SET survey_id = ".$new_id." WHERE " .
"question_id = ".$qid."";
- Database::query($sql, __FILE__, __LINE__);
+ Database::query($sql);
}
break;
@@ -1083,7 +1083,7 @@ class CourseRestorer
//No existing survey with the same language and the same code, we just copy the survey
else
{
- Database::query($sql, __FILE__, __LINE__);
+ Database::query($sql);
$new_id = Database::insert_id();
$this->course->resources[RESOURCE_SURVEY][$id]->destination_id = $new_id;
foreach ($survey->question_ids as $index => $question_id)
@@ -1092,11 +1092,11 @@ class CourseRestorer
$sql = "UPDATE ".$table_que." " .
"SET survey_id = ".$new_id." WHERE " .
"question_id = ".$qid."";
- Database::query($sql, __FILE__, __LINE__);
+ Database::query($sql);
$sql = "UPDATE ".$table_ans." ".
"SET survey_id = ".$new_id." WHERE " .
"question_id = ".$qid."";
- Database::query($sql, __FILE__, __LINE__);
+ Database::query($sql);
}
}
@@ -1111,7 +1111,7 @@ class CourseRestorer
{
$table_sur = Database :: get_course_table(TABLE_SURVEY, $this->course->destination_db);
$sql = "SELECT * FROM $table_sur WHERE code='".Database::escape_string($survey_code)."'";
- $result = Database::query($sql, __FILE__, __LINE__);
+ $result = Database::query($sql);
if(Database::num_rows($result) > 0) return false; else return true;
}
@@ -1135,7 +1135,7 @@ class CourseRestorer
$table_que = Database :: get_course_table(TABLE_SURVEY_QUESTION, $this->course->destination_db);
$table_ans = Database :: get_course_table(TABLE_SURVEY_QUESTION_OPTION, $this->course->destination_db);
- // check resources inside html from fckeditor tool and copy correct urls into recipient course
+ // check resources inside html from fckeditor tool and copy correct urls into recipient course
$question->survey_question = DocumentManager::replace_urls_inside_content_html_from_copy_course($question->survey_question, $this->course->code, $this->course->destination_path);
$sql = "INSERT INTO ".$table_que." " .
@@ -1147,14 +1147,14 @@ class CourseRestorer
"sort = '".Database::escape_string($question->sort)."', " .
"shared_question_id = '".Database::escape_string($question->shared_question_id)."', " .
"max_value = '".Database::escape_string($question->max_value)."' ";
- Database::query($sql, __FILE__, __LINE__);
+ Database::query($sql);
$new_id = Database::insert_id();
foreach ($question->answers as $index => $answer) {
-
- // check resources inside html from fckeditor tool and copy correct urls into recipient course
+
+ // check resources inside html from fckeditor tool and copy correct urls into recipient course
$answer['option_text'] = DocumentManager::replace_urls_inside_content_html_from_copy_course($answer['option_text'], $this->course->code, $this->course->destination_path);
-
+
$sql = "INSERT INTO ".$table_ans." " .
"SET " .
"question_id = '".Database::escape_string($new_id)."', " .
@@ -1162,7 +1162,7 @@ class CourseRestorer
"sort = '".Database::escape_string($answer['sort'])."', " .
"survey_id = '".Database::escape_string($question->survey_id)."'";
- Database::query($sql, __FILE__, __LINE__);
+ Database::query($sql);
}
$this->course->resources[RESOURCE_SURVEYQUESTION][$id]->destination_id = $new_id;
}
@@ -1205,13 +1205,13 @@ class CourseRestorer
"js_lib= '".Database::escape_string($lp->js_lib)."', " .
"content_license= '".Database::escape_string($lp->content_license)."', " .
"debug= '".Database::escape_string($lp->debug)."' $condition_session ";
- Database::query($sql, __FILE__, __LINE__);
+ Database::query($sql);
$new_lp_id = Database::insert_id();
if($lp->visibility) {
$sql = "INSERT INTO $table_tool SET name='".Database::escape_string($lp->name)."', link='newscorm/lp_controller.php?action=view&lp_id=$new_lp_id', image='scormbuilder.gif', visibility='1', admin='0', address='squaregrey.gif'";
- Database::query($sql, __FILE__, __LINE__);
+ Database::query($sql);
}
$new_item_ids = array();
@@ -1272,7 +1272,7 @@ class CourseRestorer
"parameters='".Database::escape_string($item['parameters'])."', " .
"launch_data = '".Database::escape_string($item['launch_dataprereq_type'])."'";
- Database::query($sql, __FILE__, __LINE__);
+ Database::query($sql);
$new_item_id = Database::insert_id();
//save a link between old and new item IDs
$new_item_ids[$item['id']] = $new_item_id;
@@ -1308,7 +1308,7 @@ class CourseRestorer
foreach ($old_prerequisite as $key=>$my_old_prerequisite) {
if($my_old_prerequisite != ''){
$sql = "UPDATE ".$table_item." SET prerequisite = '".$my_old_prerequisite."' WHERE id = '".$key."' ";
- Database::query($sql, __FILE__, __LINE__);
+ Database::query($sql);
}
}
@@ -1316,7 +1316,7 @@ class CourseRestorer
foreach ($old_refs as $key=>$my_old_ref) {
if ($my_old_ref != '') {
$sql = "UPDATE ".$table_item." SET ref = '".$my_old_ref."' WHERE id = '".$key."' ";
- Database::query($sql, __FILE__, __LINE__);
+ Database::query($sql);
}
}
@@ -1326,7 +1326,7 @@ class CourseRestorer
$parent_new_id = $new_item_ids[$parent_item_old_id];
}
$sql = "UPDATE ".$table_item." SET parent_item_id = '".$parent_new_id."' WHERE id = '".$new_item_id."'";
- Database::query($sql, __FILE__, __LINE__);
+ Database::query($sql);
}
foreach ($previous_item_ids as $new_item_id => $previous_item_old_id) {
$previous_new_id = 0;
@@ -1334,7 +1334,7 @@ class CourseRestorer
$previous_new_id = $new_item_ids[$previous_item_old_id];
}
$sql = "UPDATE ".$table_item." SET previous_item_id = '".$previous_new_id."' WHERE id = '".$new_item_id."'";
- Database::query($sql, __FILE__, __LINE__);
+ Database::query($sql);
}
foreach ($next_item_ids as $new_item_id => $next_item_old_id) {
@@ -1343,7 +1343,7 @@ class CourseRestorer
$next_new_id = $new_item_ids[$next_item_old_id];
}
$sql = "UPDATE ".$table_item." SET next_item_id = '".$next_new_id."' WHERE id = '".$new_item_id."'";
- Database::query($sql, __FILE__, __LINE__);
+ Database::query($sql);
}
foreach ($prerequisite_ids as $new_item_id => $prerequisite_old_id)
@@ -1353,7 +1353,7 @@ class CourseRestorer
$prerequisite_new_id = $new_item_ids[$prerequisite_old_id];
}
$sql = "UPDATE ".$table_item." SET prerequisite = '".$prerequisite_new_id."' WHERE id = '".$new_item_id."'";
- Database::query($sql, __FILE__, __LINE__);
+ Database::query($sql);
}
$this->course->resources[RESOURCE_LEARNPATH][$id]->destination_id = $new_lp_id;
@@ -1417,9 +1417,9 @@ class CourseRestorer
$query_sql_ip = $query_sql_fin_ip.$query_sql_ini_ip;
$query_sql_sa = $query_sql_fin_sa.$query_sql_ini_sa;
- Database::query($query_sql_sp,__FILE__,__LINE__);
- Database::query($query_sql_ip,__FILE__,__LINE__);
- Database::query($query_sql_sa,__FILE__,__LINE__);
+ Database::query($query_sql_sp);
+ Database::query($query_sql_ip);
+ Database::query($query_sql_sa);
}
@@ -1488,11 +1488,11 @@ class CourseRestorer
$condition_session = " , session_id = '$session_id' ";
}
- // check resources inside html from fckeditor tool and copy correct urls into recipient course
+ // check resources inside html from fckeditor tool and copy correct urls into recipient course
$glossary->description = DocumentManager::replace_urls_inside_content_html_from_copy_course($glossary->description, $this->course->code, $this->course->destination_path);
$sql = "INSERT INTO ".$table_glossary." SET name = '".Database::escape_string($glossary->name)."', description = '".Database::escape_string($glossary->description)."', display_order='".Database::escape_string($glossary->display_order)."' $condition_session ";
- Database::query($sql, __FILE__, __LINE__);
+ Database::query($sql);
$this->course->resources[RESOURCE_GLOSSARY][$id]->destination_id = Database::insert_id();
}
@@ -1515,7 +1515,7 @@ class CourseRestorer
//$wiki = new Wiki($obj->page_id, $obj->reflink, $obj->title, $obj->content, $obj->user_id, $obj->group_id, $obj->dtime);
// the sql statement to insert the groups from the old course to the new course
- // check resources inside html from fckeditor tool and copy correct urls into recipient course
+ // check resources inside html from fckeditor tool and copy correct urls into recipient course
$wiki->content = DocumentManager::replace_urls_inside_content_html_from_copy_course($wiki->content, $this->course->code, $this->course->destination_path);
$sql = "INSERT INTO $table_wiki (page_id, reflink, title, content, user_id, group_id, dtime, progress, version, session_id)
@@ -1530,18 +1530,18 @@ class CourseRestorer
'".Database::escape_string($wiki->progress)."',
'".intval($wiki->version)."',
'".(!empty($session_id)?intval($session_id):0)."')";
- $rs2 = Database::query($sql, __FILE__, __LINE__);
+ $rs2 = Database::query($sql);
$new_id = Database::insert_id();
$this->course->resources[RESOURCE_WIKI][$id]->destination_id = $new_id;
$sql = "UPDATE $table_wiki set page_id = '$new_id' WHERE id = '$new_id'";
- Database::query($sql, __FILE__, __LINE__);
+ Database::query($sql);
// we also add an entry in wiki_conf
$sql = "INSERT INTO $table_wiki_conf
(page_id, task, feedback1, feedback2, feedback3, fprogress1, fprogress2, fprogress3, max_size, max_text, max_version, startdate_assig, enddate_assig, delayedsubmit)
VALUES
('".intval($new_id)."', '', '', '', '', '', '', '', NULL, 0, 0, '0000-00-00 00:00:00', '0000-00-00 00:00:00', 0)";
- $rs1 = Database::query($sql, __FILE__, __LINE__);
+ $rs1 = Database::query($sql);
}
}
}
diff --git a/main/coursecopy/classes/CourseSelectForm.class.php b/main/coursecopy/classes/CourseSelectForm.class.php
index 09b72e47b8..63151804ef 100755
--- a/main/coursecopy/classes/CourseSelectForm.class.php
+++ b/main/coursecopy/classes/CourseSelectForm.class.php
@@ -53,7 +53,7 @@ class CourseSelectForm
$resource_titles[RESOURCE_SURVEY] = get_lang('Survey');
$resource_titles[RESOURCE_GLOSSARY] = get_lang('Glossary');
$resource_titles[RESOURCE_WIKI] = get_lang('Wiki');
-
+
?>
';
echo '