diff --git a/phpBB/includes/acp/acp_users.php b/phpBB/includes/acp/acp_users.php index db429e4f36d..75b1cde0d81 100644 --- a/phpBB/includes/acp/acp_users.php +++ b/phpBB/includes/acp/acp_users.php @@ -1094,7 +1094,7 @@ function main($id, $mode) $s_action_options .= ''; } - $last_active = (!empty($user_row['session_time'])) ? $user_row['session_time'] : $user_row['user_last_active']; + $last_active = $user_row['user_last_active'] ?: ($user_row['session_time'] ?? 0); $inactive_reason = ''; if ($user_row['user_type'] == USER_INACTIVE) diff --git a/phpBB/includes/functions_display.php b/phpBB/includes/functions_display.php index 67affce13d2..7a4e70f944f 100644 --- a/phpBB/includes/functions_display.php +++ b/phpBB/includes/functions_display.php @@ -1595,7 +1595,7 @@ function phpbb_show_profile($data, $user_notes_enabled = false, $warn_user_enabl if ($data['user_allow_viewonline'] || $auth->acl_get('u_viewonline')) { - $last_active = (!empty($data['session_time'])) ? $data['session_time'] : $data['user_last_active']; + $last_active = $data['user_last_active'] ?: ($data['session_time'] ?? 0); } else { diff --git a/phpBB/memberlist.php b/phpBB/memberlist.php index ea7fd03afed..7521cca1df1 100644 --- a/phpBB/memberlist.php +++ b/phpBB/memberlist.php @@ -1724,7 +1724,7 @@ { $row['session_time'] = $session_ary[$row['user_id']]['session_time'] ?? 0; $row['session_viewonline'] = $session_ary[$row['user_id']]['session_viewonline'] ?? 0; - $row['last_visit'] = (!empty($row['session_time'])) ? $row['session_time'] : $row['user_last_active']; + $row['last_visit'] = $row['user_last_active'] ?: $row['session_time']; $id_cache[$row['user_id']] = $row; } diff --git a/phpBB/phpbb/session.php b/phpBB/phpbb/session.php index 5cfe3d91f34..1e5d0c4f171 100644 --- a/phpBB/phpbb/session.php +++ b/phpBB/phpbb/session.php @@ -451,7 +451,7 @@ function session_begin($update_session_page = true) $this->check_ban_for_current_session($config); // Update user last active time accordingly, but in a minute or so - if ((int) $this->data['session_time'] - (int) $this->data['user_last_active'] > 60) + if ($this->time_now - (int) $this->data['user_last_active'] > 60) { $this->update_last_active_time(); } @@ -1718,7 +1718,7 @@ public function update_user_lastvisit() { $sql = 'UPDATE ' . USERS_TABLE . ' SET user_lastvisit = ' . (int) $this->data['session_time'] . ', - user_last_active = ' . (int) $this->data['session_time'] . ' + user_last_active = ' . $this->time_now . ' WHERE user_id = ' . (int) $this->data['user_id']; $db->sql_query($sql); } @@ -1733,10 +1733,10 @@ public function update_last_active_time() { global $db; - if (isset($this->data['session_time'], $this->data['user_id'])) + if (isset($this->time_now, $this->data['user_id'])) { $sql = 'UPDATE ' . USERS_TABLE . ' - SET user_last_active = ' . (int) $this->data['session_time'] . ' + SET user_last_active = ' . $this->time_now . ' WHERE user_id = ' . (int) $this->data['user_id']; $db->sql_query($sql); }