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 $session_id
*
* @return array optional
* @return string
*
* @author Isaac Flores <isaac.flores@dokeos.com>, U.N.A.S University
*
@ -3080,20 +3080,20 @@ function saveThreadScore(
CForumThread $threadEntity,
$user_id,
$thread_id,
$thread_qualify = 0,
$thread_qualify,
$qualify_time,
$session_id = 0
$session_id
) {
$table_threads_qualify = Database::get_course_table(TABLE_FORUM_THREAD_QUALIFY);
$course_id = api_get_course_int_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();
$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();
if ($thread_qualify <= $max) {
if ($threadEntity->isThreadPeerQualify()) {
@ -3143,10 +3143,9 @@ function saveThreadScore(
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_log = Database::get_course_table(TABLE_FORUM_THREAD_QUALIFY_LOG);
$thread_id = (int) $thread_id;
$course_id = (int) $course_id;
$user_id = (int) $user_id;
$qualify_user_id = api_get_user_id();
if ($user_id == (string) ((int) $user_id) &&

@ -2243,7 +2243,7 @@ class Event
public static function eventRemoveVirtualCourseTime(
$courseId,
$userId,
$sessionId = 0,
$sessionId,
$virtualTime,
$workId
) {
@ -2251,13 +2251,15 @@ class Event
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;
$userId = (int) $userId;
$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
// format returned by SQL for a subtraction of two datetime values
// @todo make sure this is portable between DBMSes

Loading…
Cancel
Save