5 * @author Anthony Parsons (xmpp:ant@specialops.ath.cx)
6 * @license file://COPYING
10 $prefetch = array('`boardlist_layout`');
13 /* Set the page mtime to be at least 10 minutes after the last online user so it doesn't cache a screen saying people are on who aren't */
14 list($lastpost) = $DB->query('SELECT MAX(`mtime`) FROM `messages`')->fetch_row();
15 list($lastuser) = $DB->query('SELECT MAX(`last_active_date`) FROM `users`')->fetch_row();
16 $mtime = max($lastpost, $lastuser+
600);
18 if ( 'xml' != $_SERVER['QUERY_STRING'] && $mtime < time() ) {
19 $page->cacheable
= true;
21 $page->mtime
= $mtime;
23 array_pop($user->userlinks
); // The online users link is in the middle of the page anyway
24 $page->nav
['Stats Page'] = 'stuff';
28 $onlinelist = $DB->query('SELECT `userid`, `alias` FROM `users`
29 WHERE `last_active_date` > UNIX_TIMESTAMP() - 600
30 ORDER BY `last_active_date` ASC LIMIT 30');
31 $onlineusers = $user->fillnamecache($onlinelist);
33 if ( 30 === $onlinelist->num_rows
)
34 list($count) = $DB->query('SELECT COUNT(*) FROM `users`
35 WHERE `last_active_date` > UNIX_TIMESTAMP() - 600')->fetch_row();
37 $count = $onlinelist->num_rows
;
39 $onlines = ( 1 === $count ?
40 'There is <a href="userlist?online">one user online</a>' :
41 'There are <a href="userlist?online">%d users online</a>' );
44 <div id
="boardlist-stats">
45 <p
>Current
time (UTC
<?php
printf('%+d): %s', $user->timezone
, $user->fdate(time())) ?
></p
>
46 <p
><?php
printf($onlines, $count); echo ( 0 < $count ) ?
': '.implode(', ', $onlineusers) : '.' ?
></p
>
51 switch ( $user->boardlist_layout
) {
52 case Boardlist_IRC
::ID
:
53 $bl = new Boardlist_IRC
; break;
54 case Boardlist_SO1
::ID
:
55 $bl = new Boardlist_SO1
; break;
56 case Boardlist_SO2
::ID
:
58 $bl = new Boardlist_SO2
;
61 echo '<div id="boardlist" class="',get_class($bl),"\">\n";