diff --git a/main/metadata/phpdig/phpdig_functions.php b/main/metadata/phpdig/phpdig_functions.php index 634a837681..515ec7d384 100755 --- a/main/metadata/phpdig/phpdig_functions.php +++ b/main/metadata/phpdig/phpdig_functions.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); diff --git a/main/newscorm/lp_comm.server.php b/main/newscorm/lp_comm.server.php index 1b26e2a352..be3941f13a 100755 --- a/main/newscorm/lp_comm.server.php +++ b/main/newscorm/lp_comm.server.php @@ -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); } diff --git a/main/tracking/personnalLog.php b/main/tracking/personnalLog.php index 479ea71487..f8e62f78f4 100755 --- a/main/tracking/personnalLog.php +++ b/main/tracking/personnalLog.php @@ -115,9 +115,8 @@ api_display_tool_title($nameTools); "; - 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 diff --git a/main/tracking/userLog.php b/main/tracking/userLog.php index d56d99f795..d2c0929306 100755 --- a/main/tracking/userLog.php +++ b/main/tracking/userLog.php @@ -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; diff --git a/main/tracking/userlogCSV.php b/main/tracking/userlogCSV.php index 06b0a2cf41..1b2289918b 100755 --- a/main/tracking/userlogCSV.php +++ b/main/tracking/userlogCSV.php @@ -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;