1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117
|
<?php
/*////////////////////////////////////////////////////////////////////
* Displays Who's Online Today On Board Statistics On The Forum Index
* Displays who was online today on the forum index.
*////////////////////////////////////////////////////////////////////
$plugins->add_hook('index_start', 'who_online');
function who_online_info()
{
return array(
'name' => 'Who Was Online Today ?',
'description' => 'Displays who was online today on forum index (Board Stats',
'website' => 'http://mybbextras.com',
'author' => 'Janota',
'authorsite' => 'http://mybbextras.com',
'version' => '1.0',
"compatibility" => "16*"
);
}
function who_online_activate()
{
global $db;
}
function who_online()
{
global $db,$ontoday,$lang,$theme, $mybb, $templates;
$lang->load("online");
$todaycount = 0;
$stime = TIME_NOW-(60*60*24);
$todayrows = '';
$query = $db->query("
SELECT u.*
FROM ".TABLE_PREFIX."users u
LEFT JOIN ".TABLE_PREFIX."usergroups g ON (g.gid=u.usergroup)
WHERE u.lastactive > $stime
ORDER BY u.lastactive DESC
");
$total=$db->num_rows($query);
$i=1;
$x=0;
while($online = $db->fetch_array($query))
{
if($online['invisible'] != 1 || $mybb->usergroup['canviewwolinvis'] == 1 || $online['uid'] == $mybb->user['uid'])
{
if($online['invisible'] == 1)
{
$invisiblemark = "*";
}
else
{
$invisiblemark = "";
}
$username = $online['username'];
$username = format_name($username, $online['usergroup'], $online['displaygroup']);
$online['profilelink'] = build_profile_link($username, $online['uid']);
$onlinetime = my_date($mybb->settings['timeformat'], $online['lastactive']);
$onToday.=$online['profilelink'];
}
if ($i != $total)
{
$onToday.=", ";
}
if ($x == 14)
{
$onToday.="<br/>";
$x=0;
}
$x++;
$i++;
++$todaycount;
}
if($todaycount == 1)
{
$who_online = $lang->member_online_today;
}
else
{
$who_online = $lang->sprintf($lang->members_were_online_today, $todaycount);
}
if(in_array($GLOBALS['mybb']->user['usergroup'], array(3,4,6)))
{
$ontoday=<<<HERE
<td class="trow1"><a href="/forum/online.php?action=today" target="_blank"><img src="./images/oll.png" title="" class="statistics" style="float:left; height:38px; margin-right:5px; padding:8px; width:38px;"/></a>
<span class="smalltext">{$who_online}</span><br />$onToday
</td>
</tr>
HERE;
}
else
{
$ontoday=<<<HERE
<td class="trow1"><img src="./images/oll.png" title="" class="statistics" style="float:left; height:38px; margin-right:5px; padding:8px; width:38px;"/>
<span class="smalltext">{$who_online}</span><br />$onToday
</td>
</tr>
HERE;
}
}
function who_online_deactivate()
{
}
?>
|