last_user_id, $obj->user_count) = db_saq('SELECT MAX(id), count(*)-1 FROM fud30_users'); $obj->online_users_anon = q_singleval('SELECT count(*) FROM fud30_ses s WHERE time_sec>'. $tm_expire .' AND user_id>2000000000'); $obj->online_users_hidden = q_singleval('SELECT count(*) FROM fud30_ses s INNER JOIN fud30_users u ON u.id=s.user_id WHERE s.time_sec>'. $tm_expire .' AND '. q_bitand('u.users_opt', 32768) .'>0'); $obj->online_users_reg = q_singleval('SELECT count(*) FROM fud30_ses s INNER JOIN fud30_users u ON u.id=s.user_id WHERE s.time_sec>'. $tm_expire .' AND '. q_bitand('u.users_opt', 32768) .'=0'); $c = uq(q_limit('SELECT u.id, u.alias, u.users_opt, u.custom_color FROM fud30_ses s INNER JOIN fud30_users u ON u.id=s.user_id WHERE s.time_sec>'. $tm_expire .' AND '. q_bitand('u.users_opt', 32768) .'=0 ORDER BY s.time_sec DESC', $GLOBALS['MAX_LOGGEDIN_USERS'])); $obj->online_users_text = array(); while ($r = db_rowarr($c)) { $obj->online_users_text[$r[0]] = draw_user_link($r[1], $r[2], $r[3]); } unset($c); q('UPDATE fud30_stats_cache SET cache_age='. __request_timestamp__ .', last_user_id='. (int)$obj->last_user_id .', user_count='. (int)$obj->user_count .', online_users_anon='. (int)$obj->online_users_anon .', online_users_hidden='. (int)$obj->online_users_hidden .', online_users_reg='. (int)$obj->online_users_reg .', online_users_text='. ssn(serialize($obj->online_users_text))); $obj->last_user_alias = q_singleval('SELECT alias FROM fud30_users WHERE id='. $obj->last_user_id); $obj->last_msg_subject = q_singleval('SELECT subject FROM fud30_msg WHERE id='. $last_msg_id); list($obj->most_online,$obj->most_online_time) = db_saq('SELECT most_online, most_online_time FROM fud30_stats_cache'); /* Update most online users stats if needed. */ if (($obj->online_users_reg + $obj->online_users_hidden + $obj->online_users_anon) > $obj->most_online) { $obj->most_online = $obj->online_users_reg + $obj->online_users_hidden + $obj->online_users_anon; $obj->most_online_time = __request_timestamp__; q('UPDATE fud30_stats_cache SET most_online='. $obj->most_online .', most_online_time='. $obj->most_online_time); } else if (!$obj->most_online_time) { $obj->most_online_time = __request_timestamp__; } return $obj; } $logedin = $forum_info = ''; if ($FUD_OPT_1 & 1073741824 || $FUD_OPT_2 & 16) { if (!($st_obj = db_sab('SELECT sc.*, m.subject AS last_msg_subject, u.alias AS last_user_alias FROM fud30_stats_cache sc INNER JOIN fud30_users u ON u.id=sc.last_user_id LEFT JOIN fud30_msg m ON m.id='. $last_msg_id .' WHERE sc.cache_age>'. (__request_timestamp__ - $STATS_CACHE_AGE)))) { $st_obj = rebuild_stats_cache($last_msg_id); } else if ($st_obj->online_users_text && (_uid || !($FUD_OPT_3 & 262144))) { $st_obj->online_users_text = unserialize($st_obj->online_users_text); } if (!$st_obj->most_online_time) { $st_obj->most_online_time = __request_timestamp__; } if ($FUD_OPT_1 & 1073741824 && (_uid || !($FUD_OPT_3 & 262144))) { if (!empty($st_obj->online_users_text)) { foreach($st_obj->online_users_text as $k => $v) { $logedin .= ''.$v.' '; } } $logedin = ' Logged in users list '.(($FUD_OPT_1 & 536870912) ? ''.(_uid || !($FUD_OPT_3 & 131072) ? '[ User Activity ]' : '' ) .' '.(_uid || !($FUD_OPT_3 & 262144) ? '[ Today's Visitors ]' : '' ) .'' : '' ) .' There are '.convertPlural($st_obj->online_users_reg, array(''.$st_obj->online_users_reg.' member',''.$st_obj->online_users_reg.' members')).', '.convertPlural($st_obj->online_users_hidden, array(''.$st_obj->online_users_hidden.' invisible member',''.$st_obj->online_users_hidden.' invisible members')).' and '.convertPlural($st_obj->online_users_anon, array(''.$st_obj->online_users_anon.' guest',''.$st_obj->online_users_anon.' guests')).' visiting this board.    [Administrator]   [Moderator]
'.$logedin.' '; } if ($FUD_OPT_2 & 16) { $forum_info = ' Our users have posted a total of '.convertPlural($post_count, array(''.$post_count.' message',''.$post_count.' messages')).' inside '.convertPlural($thread_count, array(''.$thread_count.' topic',''.$thread_count.' topics')).'.
Most users ever online was '.$st_obj->most_online.' on '.print_date('%a, %d %B %Y %H:%M', $st_obj->most_online_time).'
We have '.$st_obj->user_count.' registered '.convertPlural($st_obj->user_count, array('user','users')).'.
The newest registered user is '.htmlspecialchars($st_obj->last_user_alias, ENT_QUOTES | ENT_SUBSTITUTE | ENT_HTML5, null, false).' '.($last_msg_id ? '
Last message on the forum: '.htmlspecialchars($st_obj->last_msg_subject, ENT_QUOTES | ENT_SUBSTITUTE | ENT_HTML5, null, false).'' : '' ) .' '; } } ?>