<?php
/**###########################################
# ProPortal 2.6.2
# ab MyBB Version 1.8.4
# von MrBrechreiz
# Datum: 25.02.2018
###########################################*/
if (!defined("IN_PORTAL")) {
die("<div style=\"border:1px solid #CC0000; padding:3px; margin:0; font-family:Tahoma; width:250px; font-size:12px;\"><strong>Error:</strong> This file cannot be viewed directly!</div>");
}
$time_search = TIME_NOW - $mybb->settings['wolcutoff'];
$comma = '';
$guest_count = 0;
$member_count = 0;
$online_members = '';
$no_online = '';
$onlinequery = $db->query("
SELECT s.sid, s.ip, s.uid, s.time, s.location, u.username, u.invisible, u.usergroup, u.displaygroup
FROM ".TABLE_PREFIX."sessions s
LEFT JOIN ".TABLE_PREFIX."users u ON (s.uid=u.uid)
WHERE s.time>'{$time_search}' AND u.usergroup != '5'
ORDER BY u.username ASC, s.time DESC
");
while($user = $db->fetch_array($onlinequery))
{
// Create a key to test if this user is a search bot.
$bot_key = my_strtolower(str_replace("bot=", '', $user['sid']));
if($user['uid'] == "0")
{
++$guest_count;
}
elseif(my_strpos($user['sid'], "bot=") !== false && $session->bots[$bot_key])
{
// The user is a search bot.
$online_members .= $comma.format_name($session->bots[$bot_key], $session->botgroup);
$comma = $lang->comma;
++$bot_count;
}
else
{
if($done_users[$user['uid']] < $user['time'] || !$done_users[$user['uid']])
{
++$member_count;
$done_users[$user['uid']] = $user['time'];
// If the user is logged in anonymously, update the count for that.
if($user['invisible'] == 1)
{
++$anon_count;
}
$invisiblemark = ($user['invisible'] == 1) ? "*" : "";
if(($user['invisible'] == 1 && ($mybb->usergroup['canviewwolinvis'] == 1 || $user['uid'] == $mybb->user['uid'])) || $user['invisible'] != 1)
{
$groupcolor_global = $proportal->settings['groupcolor_global'];
if($groupcolor_global == 1 && $proportal->settings['gcolor_whosonline'] == 1)
{
$user['username'] = format_name(htmlspecialchars_uni($user['username']), $user['usergroup'], $user['displaygroup']);
$user['profilelink'] = get_profile_link($user['uid']);
$user['username'] = str_replace(array('<b>', '</b>', '<strong>', '</strong>', '<em>', '</em>'), array('', '', '', '', '', ''), $user['username']);
eval("\$online_members .= \"".$templates->get("pro_portal_whoisonline_online_members")."\";");
$comma = $lang->comma;
}
else
{
$user['profilelink'] = get_profile_link(htmlspecialchars_uni($user['username']), $user['uid']);
eval("\$online_members .= \"".$templates->get("pro_portal_whoisonline_online_members")."\";");
$comma = $lang->comma;
}
}
}
}
}
$online_count = $member_count + $guest_count + $bot_count;
// If we can see invisible users add them to the count
if($mybb->usergroup['canviewwolinvis'] == 1)
{
$online_count += $anon_count;
}
// If we can't see invisible users but the user is an invisible user incriment the count by one
if($mybb->usergroup['canviewwolinvis'] != 1 && $mybb->user['invisible'] == 1)
{
++$online_count;
}
// Most users online
$mostonline = $cache->read("mostonline");
if($online_count > $mostonline['numusers'])
{
$time = TIME_NOW;
$mostonline['numusers'] = $online_count;
$mostonline['time'] = $time;
$cache->update("mostonline", $mostonline);
}
$recordcount = $mostonline['numusers'];
$recorddate = my_date($mybb->settings['dateformat'], $mostonline['time']);
$recordtime = my_date($mybb->settings['timeformat'], $mostonline['time']);
if($online_count == 1)
{
$lang->online_users = $lang->sprintf($lang->online_user, $online_members, $no_online);
}
else
{
$lang->online_users = $lang->sprintf($lang->online_users, $online_count);
}
$memberbit = ($member_count != 1) ? $member_count." ".$lang->online_member_plural : $member_count." ".$lang->online_member_singular;
$guestbit = ($guest_count != 1) ? $guest_count." ".$lang->online_guest_plural : $guest_count." ".$lang->online_guest_singular;
$lang->online_counts = $lang->sprintf($lang->online_counts, $memberbit, $guestbit);
if(!$result_blocks['title'] == 1)
{
$result_blocks['title'] = $lang->who_online;
}
if(isset($result_blocks['title']))
{
$result_blocks['title'] = $result_blocks['title'];
}
if($proportal->settings['responsive'] == 1 && $mybb->user['uid'] == 0)
{
eval("\$whoisonline = \"".$templates->get("pro_portal_whoisonline_responsive")."\";");
}
else if($mybb->user['portalresonsive'] == 1)
{
eval("\$whoisonline = \"".$templates->get("pro_portal_whoisonline_responsive")."\";");
}
else if($mybb->user['portalresonsive'] == 0)
{
eval("\$whoisonline = \"".$templates->get("pro_portal_whoisonline")."\";");
}
else if($proportal->settings['responsive'] == 0 && $mybb->user['uid'] == 0)
{
eval("\$whoisonline = \"".$templates->get("pro_portal_whoisonline")."\";");
}
echo $whoisonline;