Fix PHP 8.0 errors

pull/3844/head
Julio Montoya 4 years ago
parent 2256963baf
commit fca9bc0e7d
  1. 21
      public/main/forum/forumfunction.inc.php
  2. 12
      public/main/inc/lib/events.lib.php

@ -3070,7 +3070,7 @@ function newThread(CForumForum $forum, $form_values = '', $showPreview = true)
* @param int $qualify_time * @param int $qualify_time
* @param int $session_id * @param int $session_id
* *
* @return array optional * @return string
* *
* @author Isaac Flores <isaac.flores@dokeos.com>, U.N.A.S University * @author Isaac Flores <isaac.flores@dokeos.com>, U.N.A.S University
* *
@ -3080,20 +3080,20 @@ function saveThreadScore(
CForumThread $threadEntity, CForumThread $threadEntity,
$user_id, $user_id,
$thread_id, $thread_id,
$thread_qualify = 0, $thread_qualify,
$qualify_time, $qualify_time,
$session_id = 0 $session_id
) { ) {
$table_threads_qualify = Database::get_course_table(TABLE_FORUM_THREAD_QUALIFY); $table_threads_qualify = Database::get_course_table(TABLE_FORUM_THREAD_QUALIFY);
$course_id = api_get_course_int_id(); $course_id = api_get_course_int_id();
$session_id = (int) $session_id; $session_id = (int) $session_id;
$thread_id = (int) $thread_id;
$user_id = (int) $user_id;
$thread_qualify = (float) $thread_qualify;
$currentUserId = api_get_user_id(); $currentUserId = api_get_user_id();
$qualify_time = Database::escape_string($qualify_time);
if ($user_id == (string) ((int) $user_id) &&
$thread_id == (string) ((int) $thread_id) &&
$thread_qualify == (string) ((float) $thread_qualify)
) {
$max = $threadEntity->getThreadQualifyMax(); $max = $threadEntity->getThreadQualifyMax();
if ($thread_qualify <= $max) { if ($thread_qualify <= $max) {
if ($threadEntity->isThreadPeerQualify()) { if ($threadEntity->isThreadPeerQualify()) {
@ -3143,10 +3143,9 @@ function saveThreadScore(
return 'update'; return 'update';
} }
} else {
return null;
}
} }
return '';
} }
/** /**
@ -3277,7 +3276,9 @@ function saveThreadScoreHistory(
$table_threads_qualify = Database::get_course_table(TABLE_FORUM_THREAD_QUALIFY); $table_threads_qualify = Database::get_course_table(TABLE_FORUM_THREAD_QUALIFY);
$table_threads_qualify_log = Database::get_course_table(TABLE_FORUM_THREAD_QUALIFY_LOG); $table_threads_qualify_log = Database::get_course_table(TABLE_FORUM_THREAD_QUALIFY_LOG);
$thread_id = (int) $thread_id;
$course_id = (int) $course_id; $course_id = (int) $course_id;
$user_id = (int) $user_id;
$qualify_user_id = api_get_user_id(); $qualify_user_id = api_get_user_id();
if ($user_id == (string) ((int) $user_id) && if ($user_id == (string) ((int) $user_id) &&

@ -2243,7 +2243,7 @@ class Event
public static function eventRemoveVirtualCourseTime( public static function eventRemoveVirtualCourseTime(
$courseId, $courseId,
$userId, $userId,
$sessionId = 0, $sessionId,
$virtualTime, $virtualTime,
$workId $workId
) { ) {
@ -2251,13 +2251,15 @@ class Event
return false; return false;
} }
$originalVirtualTime = $virtualTime;
$courseTrackingTable = Database::get_main_table(TABLE_STATISTIC_TRACK_E_COURSE_ACCESS);
$platformTrackingTable = Database::get_main_table(TABLE_STATISTIC_TRACK_E_LOGIN);
$courseId = (int) $courseId; $courseId = (int) $courseId;
$userId = (int) $userId; $userId = (int) $userId;
$sessionId = (int) $sessionId; $sessionId = (int) $sessionId;
$originalVirtualTime = Database::escape_string($virtualTime);
$workId = (int) $workId;
$courseTrackingTable = Database::get_main_table(TABLE_STATISTIC_TRACK_E_COURSE_ACCESS);
$platformTrackingTable = Database::get_main_table(TABLE_STATISTIC_TRACK_E_LOGIN);
// Change $virtualTime format from hh:mm:ss to hhmmss which is the // Change $virtualTime format from hh:mm:ss to hhmmss which is the
// format returned by SQL for a subtraction of two datetime values // format returned by SQL for a subtraction of two datetime values
// @todo make sure this is portable between DBMSes // @todo make sure this is portable between DBMSes

Loading…
Cancel
Save