Line 941 | Line 941 |
---|
} else if ($topic_id) {
|
} else if ($topic_id) {
|
$sql = 'SELECT f.parent_id, f.forum_parents, f.left_id, f.right_id, f.forum_type, f.forum_name, f.forum_id, f.forum_desc, f.forum_desc_uid, f.forum_desc_bitfield, f.forum_desc_options, f.forum_options, t.topic_title FROM ' . FORUMS_TABLE . ' as f, ' . TOPICS_TABLE . ' as t WHERE t.forum_id = f.forum_id';
| // Generate the navlinks based on the selected topic $navlinks_sql_array = [ 'SELECT' => 'f.parent_id, f.forum_parents, f.left_id, f.right_id, f.forum_type, f.forum_name, f.forum_id, f.forum_desc, f.forum_desc_uid, f.forum_desc_bitfield, f.forum_desc_options, f.forum_options, t.topic_title', 'FROM' => [ FORUMS_TABLE => 'f', TOPICS_TABLE => 't', ], 'WHERE' => 't.forum_id = f.forum_id AND t.topic_id = ' . (int) $topic_id, ];
$sql = $db->sql_build_query('SELECT', $navlinks_sql_array);
|
$result = $db->sql_query($sql); $topic_data = $db->sql_fetchrow($result); $db->sql_freeresult($result);
| $result = $db->sql_query($sql); $topic_data = $db->sql_fetchrow($result); $db->sql_freeresult($result);
|
Line 1036 | Line 1045 |
---|
if ($auth->acl_get('u_viewonline')) { $sort_key_text['l'] = $user->lang['SORT_LAST_ACTIVE'];
|
if ($auth->acl_get('u_viewonline')) { $sort_key_text['l'] = $user->lang['SORT_LAST_ACTIVE'];
|
$sort_key_sql['l'] = 'u.user_lastvisit';
| $sort_key_sql['l'] = 'u.user_last_active';
|
}
$sort_key_text['m'] = $user->lang['SORT_RANK'];
| }
$sort_key_text['m'] = $user->lang['SORT_RANK'];
|
Line 1138 | Line 1147 |
---|
{ if ($active_select === 'lt' && (int) $active[0] == 0 && (int) $active[1] == 0 && (int) $active[2] == 0) {
|
{ if ($active_select === 'lt' && (int) $active[0] == 0 && (int) $active[1] == 0 && (int) $active[2] == 0) {
|
$sql_where .= ' AND u.user_lastvisit = 0';
| $sql_where .= ' AND u.user_last_active = 0';
|
} else if ($active_select === 'gt') {
|
} else if ($active_select === 'gt') {
|
$sql_where .= ' AND u.user_lastvisit ' . $find_key_match[$active_select] . ' ' . $active_time;
| $sql_where .= ' AND u.user_last_active ' . $find_key_match[$active_select] . ' ' . $active_time;
|
} else {
|
} else {
|
$sql_where .= ' AND (u.user_lastvisit > 0 AND u.user_lastvisit < ' . $active_time . ')';
| $sql_where .= ' AND (u.user_last_active > 0 AND u.user_last_active < ' . $active_time . ')';
|
} } }
| } } }
|
Line 1634 | Line 1643 |
---|
if (count($user_list)) { // Session time?! Session time...
|
if (count($user_list)) { // Session time?! Session time...
|
$sql = 'SELECT session_user_id, MAX(session_time) AS session_time
| $sql = 'SELECT session_user_id, MAX(session_time) AS session_time, MIN(session_viewonline) AS session_viewonline
|
FROM ' . SESSIONS_TABLE . ' WHERE session_time >= ' . (time() - $config['session_length']) . ' AND ' . $db->sql_in_set('session_user_id', $user_list) . ' GROUP BY session_user_id'; $result = $db->sql_query($sql);
|
FROM ' . SESSIONS_TABLE . ' WHERE session_time >= ' . (time() - $config['session_length']) . ' AND ' . $db->sql_in_set('session_user_id', $user_list) . ' GROUP BY session_user_id'; $result = $db->sql_query($sql);
|
$session_times = array();
| $session_ary = [];
|
while ($row = $db->sql_fetchrow($result)) {
|
while ($row = $db->sql_fetchrow($result)) {
|
$session_times[$row['session_user_id']] = $row['session_time'];
| $session_ary[$row['session_user_id']] = [ 'session_time' => $row['session_time'], 'session_viewonline' => $row['session_viewonline'], ];
|
} $db->sql_freeresult($result);
| } $db->sql_freeresult($result);
|
Line 1708 | Line 1720 |
---|
$id_cache = array(); while ($row = $db->sql_fetchrow($result)) {
|
$id_cache = array(); while ($row = $db->sql_fetchrow($result)) {
|
$row['session_time'] = (!empty($session_times[$row['user_id']])) ? $session_times[$row['user_id']] : 0; $row['last_visit'] = (!empty($row['session_time'])) ? $row['session_time'] : $row['user_lastvisit'];
| $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'] = $row['user_last_active'] ?: $row['session_time'];
|
$id_cache[$row['user_id']] = $row; }
| $id_cache[$row['user_id']] = $row; }
|