From 46b1e71185ff1362cce2738a815123b49fa6d9b0 Mon Sep 17 00:00:00 2001 From: Julio Montoya Date: Wed, 5 Sep 2012 16:23:16 +0200 Subject: [PATCH] Should fix wrong date convertion see #5418 --- main/inc/lib/online.inc.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/main/inc/lib/online.inc.php b/main/inc/lib/online.inc.php index 9f996df466..2f5d55bce3 100644 --- a/main/inc/lib/online.inc.php +++ b/main/inc/lib/online.inc.php @@ -234,11 +234,11 @@ function who_is_online($from, $number_of_items, $column = null, $direction = nul if ($result) { $valid_date_time = new DateTime(); $diff = "PT".$time_limit.'M'; - $valid_date_time->sub(new DateInterval($diff)); + $valid_date_time->sub(new DateInterval($diff)); $users_online = array(); while(list($login_user_id, $login_date) = Database::fetch_row($result)) { $user_login_date = new DateTime($login_date); - if ($user_login_date > $valid_date_time) { + if ($user_login_date > $valid_date_time->format('Y-m-d H:i:s')) { $users_online[] = $login_user_id; } } @@ -333,14 +333,14 @@ function who_is_online_in_this_course($from, $number_of_items, $uid, $time_limit $result = Database::query($query); if ($result) { - $valid_date_time = new DateTime(); + $valid_date_time = new DateTime(); $diff = "PT".$time_limit.'M'; $valid_date_time->sub(new DateInterval($diff)); $users_online = array(); while(list($login_user_id, $login_date) = Database::fetch_row($result)) { $user_login_date = new DateTime($login_date); - if ($user_login_date > $valid_date_time) { + if ($user_login_date > $valid_date_time->format('Y-m-d H:i:s')) { $users_online[] = $login_user_id; } }