Replace NOW() by api_get_utc_datetime()

1.10.x
Yannick Warnier 10 years ago
parent b568eb4e67
commit 3b8a26f363
  1. 3
      main/metadata/phpdig/phpdig_functions.php
  2. 3
      main/newscorm/lp_comm.server.php
  3. 5
      main/tracking/personnalLog.php
  4. 5
      main/tracking/userLog.php
  5. 5
      main/tracking/userlogCSV.php

@ -268,8 +268,9 @@ function phpdigAddLog ($id_connect,$option='start',$includes=array(),$excludes=a
$includes = array();
}
sort($includes);
$now = api_get_utc_datetime();
$query = 'INSERT INTO '.PHPDIG_DB_PREFIX.'logs (l_num,l_mode,l_ts,l_includes,l_excludes,l_time) '
.'VALUES ('.$num_results.',\''.substr($option,0,1).'\',NOW(),'
.'VALUES ('.$num_results.',\''.substr($option,0,1).'\',"' . $now . '",'
.'\''.implode(' ',$includes).'\',\''.implode(' ',$excludes).'\','.(double)$time.')';
mysql_query($query,$id_connect);
return mysql_insert_id($id_connect);

@ -152,7 +152,8 @@ function save_item($lp_id, $user_id, $view_id, $item_id, $score = -1, $max = -1,
if (Database::num_rows($q_last_connection) > 0) {
$row = Database::fetch_array($q_last_connection);
$i_id_last_connection = $row['login_id'];
$s_sql_update_logout_date = "UPDATE $tbl_track_login SET logout_date=NOW() WHERE login_id='$i_id_last_connection'";
$now = api_get_utc_datetime();
$s_sql_update_logout_date = "UPDATE $tbl_track_login SET logout_date = '$now' WHERE login_id='$i_id_last_connection'";
Database::query($s_sql_update_logout_date);
}

@ -115,9 +115,8 @@ api_display_tool_title($nameTools);
</td>
</tr>";
if(!isset($previousDate)) {
$sql = "SELECT NOW()";
$previousDate = StatsUtils::getOneResult($sql);
if (!isset($previousDate)) {
$previousDate = api_get_utc_datetime();
}
$sql = "SELECT access_tool, count(access_tool), c_id

@ -71,13 +71,14 @@ $TABLEUSER = Database::get_main_table(TABLE_MAIN_USER);
$tbl_session_course_user = Database::get_main_table(TABLE_MAIN_SESSION_COURSE_USER);
$tbl_session = Database::get_main_table(TABLE_MAIN_SESSION);
$TABLECOURSE_GROUPSUSER = Database::get_course_table(TABLE_GROUP_USER);
$now = api_get_utc_datetime();
$sql = "SELECT 1
FROM $tbl_session_course_user AS session_course_user
INNER JOIN $tbl_session AS session
ON session_course_user.id_session = session.id
AND ((date_start<=NOW()
AND date_end>=NOW())
AND ((date_start <= '$now'
AND date_end >= '$now')
OR (date_start='0000-00-00' AND date_end='0000-00-00'))
WHERE id_session='".api_get_session_id()."' AND course_code='$_cid'";
//echo $sql;

@ -73,13 +73,14 @@ $tbl_session_course_user = Database::get_main_table(
$tbl_session = Database::get_main_table(TABLE_MAIN_SESSION);
$TABLECOURSE_GROUPSUSER = Database::get_course_table(TABLE_GROUP_USER);
$now = api_get_utc_datetime();
$sql = "SELECT 1
FROM $tbl_session_course_user AS session_course_user
INNER JOIN $tbl_session AS session
ON session_course_user.id_session = session.id
AND ((date_start<=NOW()
AND date_end>=NOW())
AND ((date_start <= '$now'
AND date_end >= '$now')
OR (date_start='0000-00-00' AND date_end='0000-00-00'))
WHERE id_session='" . $_SESSION['id_session'] . "' AND course_code='$_cid'";
//echo $sql;

Loading…
Cancel
Save