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 // Only cache non-ajax requests with nobody online
19 if ( 'xml' != $_SERVER['QUERY_STRING'] && $mtime < time() ) {
20 $page->cacheable
= true;
22 $page->mtime
= $mtime;
24 array_pop($user->userlinks
); // The online users link is in the middle of the page anyway
25 $page->nav
['Stats Page'] = 'stuff';
29 $onlinelist = $DB->query('SELECT `userid`, `alias` FROM `users`
30 WHERE `last_active_date` > UNIX_TIMESTAMP() - 600
31 ORDER BY `last_active_date` ASC LIMIT 30');
32 $onlineusers = $user->fillnamecache($onlinelist);
34 if ( 30 === $onlinelist->num_rows
)
35 list($count) = $DB->query('SELECT COUNT(*) FROM `users` WHERE `last_active_date` > UNIX_TIMESTAMP() - 600')->fetch_row();
37 $count = $onlinelist->num_rows
;
39 $onlinestr = ( 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 <p id
="index-stats"><?php
printf($onlinestr, $count); echo ( 0 < $count ) ?
': '.implode(', ', $onlineusers) : '.' ?
></p
>
47 switch ( $user->boardlist_layout
) {
48 case Boardlist_IRC
::ID
:
49 $bl = new Boardlist_IRC
; break;
50 case Boardlist_SO1
::ID
:
51 $bl = new Boardlist_SO1
; break;
52 case Boardlist_SO2
::ID
:
53 $bl = new Boardlist_SO2
; break;
55 $bl = new Boardlist_IRC
;
58 echo '<div id="boardlist" class="',get_class($bl),"\">\n";