diff --git a/main/exercice/exercise.class.php b/main/exercice/exercise.class.php index 4edd6f9876a..ff264a5b5d9 100755 --- a/main/exercice/exercise.class.php +++ b/main/exercice/exercise.class.php @@ -790,13 +790,13 @@ public function save($type_e = '') if ($id) { // we prepare date in the database using the api_get_utc_datetime() function if (!empty($this->start_time) && $this->start_time != '0000-00-00 00:00:00') { - $start_time = Database::escape_string($this->start_time); + $start_time = $this->start_time; } else { $start_time = '0000-00-00 00:00:00'; } if (!empty($this->end_time) && $this->end_time != '0000-00-00 00:00:00') { - $end_time = Database::escape_string($this->end_time); + $end_time = $this->end_time; } else { $end_time = '0000-00-00 00:00:00'; } diff --git a/main/inc/lib/course.lib.php b/main/inc/lib/course.lib.php index 68d3c8098aa..6f9a04752bd 100755 --- a/main/inc/lib/course.lib.php +++ b/main/inc/lib/course.lib.php @@ -4368,6 +4368,8 @@ public static function update_course_ranking( 'session_id' => $session_id, 'url_id' => $url_id, 'creation_date' => $now, + 'total_score' => 0, + 'users' => 0 ); $result = Database::select( diff --git a/main/inc/lib/document.lib.php b/main/inc/lib/document.lib.php index d4c57417287..1cc253ea868 100755 --- a/main/inc/lib/document.lib.php +++ b/main/inc/lib/document.lib.php @@ -4666,7 +4666,7 @@ public static function generateDefaultCertificate($courseData, $fromBaseCourse = $fileFullPath = "{$filePath}/{$fileName}.html"; $fileSize = 0; $fileType = 'file'; - $templateContent = file_get_contents(api_get_path(SYS_CODE_PATH) . 'gradebook/certificate_template/template.html'); + $templateContent = file_get_contents(api_get_path(SYS_CODE_PATH).'gradebook/certificate_template/template.html'); $search = array('{CSS}', '{IMG_DIR}', '{REL_CODE_PATH}', '{COURSE_DIR}'); $replace = array($css.$js, $img_dir, $codePath, $default_course_dir); diff --git a/main/inc/lib/events.lib.php b/main/inc/lib/events.lib.php index 063f8b0e1c6..ac57c14990d 100644 --- a/main/inc/lib/events.lib.php +++ b/main/inc/lib/events.lib.php @@ -174,21 +174,17 @@ public static function event_access_tool($tool, $id_session = 0) $pos2 = isset($_SERVER['HTTP_REFERER']) ? strpos(strtolower($_SERVER['HTTP_REFERER']), strtolower(api_get_path(WEB_PATH)."index")) : false; // end "what's new" notification if ($pos !== false || $pos2 !== false) { - $sql = "INSERT INTO ".$TABLETRACK_ACCESS." - (access_user_id, - c_id, - access_tool, - access_date, - access_session_id - ) - VALUES - (".$user_id.",".// Don't add ' ' around value, it's already done. - "'".$courseId."' , - '".$tool."', - '".$reallyNow."', - '".$id_session."')"; - Database::query($sql); + $params = [ + 'access_user_id' => $user_id, + 'c_id' => $courseId, + 'access_tool' => $tool, + 'access_date' => $reallyNow, + 'access_session_id' => $id_session, + 'user_ip' => api_get_real_ip() + ]; + Database::insert($TABLETRACK_ACCESS, $params); } + // "what's new" notification $sql = "UPDATE $TABLETRACK_LASTACCESS SET access_date = '$reallyNow' diff --git a/main/inc/lib/fileUpload.lib.php b/main/inc/lib/fileUpload.lib.php index 60eb80110dc..6f9b0ffe55d 100755 --- a/main/inc/lib/fileUpload.lib.php +++ b/main/inc/lib/fileUpload.lib.php @@ -1226,7 +1226,6 @@ function add_document( $table_document = Database::get_course_table(TABLE_DOCUMENT); $params = [ - 'id' => '', 'c_id' => $c_id, 'path' => $path, 'filetype' => $filetype,