<?php
if (!defined('BB_ROOT')) die(basename(__FILE__));
function get_visit_list ()
{
global $db, $bb_cache, $lang, $bb_cfg, $phpEx, $userdata;
$sql = "SELECT *
FROM " . USERS_TABLE . "
WHERE user_id > 0
AND user_id NOT IN(" . EXCLUDED_USERS_CSV . ")
ORDER BY IF(user_level = 1,23,user_level) DESC, username ASC";
if( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Could not obtain user/day information', '', __LINE__, __FILE__, $sql);
}
$day_userlist = '';
$day_users = 0;
$not_day_userlist = '';
$not_day_users = 0;
while( $row = $db->sql_fetchrow($result) )
{
$style_color = '';
if ( $row['user_level'] == ADMIN )
{
$row['username'] = '<b>' . $row['username'] . '</b>';
$style_color = 'class="colorAdmin small"';
}
else if ( $row['user_level'] == MOD )
{
$row['username'] = '<b>' . $row['username'] . '</b>';
$style_color = 'class="colorMod small"';
}
else if ( $row['user_level'] == USER )
{
$row['username'] = $row['username'];
$style_color = 'class="colorNick small"';
}
else if ( $row['user_level'] == GROUP_MEMBER )
{
$row['username'] = $row['username'];
$style_color = 'class="colorGroup small"';
}
if ( $row['user_allow_viewonline'] )
{
$user_day_link = '<a href="' . append_sid("profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . "=" . $row['user_id']) . '"' . $style_color .'>' . $row['username'] . '</a>';
}
else
{
$user_day_link = '<a href="' . append_sid("profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . "=" . $row['user_id']) . '"' . $style_color .'><i>' . $row['username'] . '</i></a>';
}
if ( $row['user_allow_viewonline'] || $userdata['user_level'] == ADMIN )
{
if ( $row['user_session_time'] >= ( time() - $bb_cfg['users_list_delay'] * 3600 ) )
// if ( $row['user_session_time'] >= ( time() - strtotime('now 00:00:00') ) )
{
$day_userlist .= ( $day_userlist != '' ) ? ', ' . $user_day_link : $user_day_link;
$day_users++;
}
else
{
$not_day_userlist .= ( $not_day_userlist != '' ) ? ', ' . $user_day_link : $user_day_link;
$not_day_users++;
}
}
}
$day_userlist = sprintf($lang['Day_users'], $day_users, $bb_cfg['users_list_delay']) ) . ' <div class="w100" style="max-height: 100px; overflow: auto; border: 1px solid #B7C0C5; padding: 0 2px 0 2px;">' . $day_userlist . '</div>';
$not_day_userlist = sprintf($lang['Not_day_users'], $not_day_users, $bb_cfg['users_list_delay']) ) . ' <div class="w100" style="max-height: 100px; overflow: auto; border: 1px solid #B7C0C5; padding: 0 2px 0 2px;">' . $not_day_userlist . '</div>';
if ( $bb_cfg['display_not_day_userlist'] )
{
$day_userlist .= '<br />' . $not_day_userlist;
}
$bb_cache->set('day_userlist', $day_userlist, 7200);
return $day_userlist;
}