Added some class="" to pagelist code
[specialops2.git] / index.php
blob26c59250de83fde10197687eb5122332109f5c8d
1 <?php
2 /**
3 * Board List
5 * @author Anthony Parsons (xmpp:ant@specialops.ath.cx)
6 * @license file://COPYING
7 * @version $Id$
8 */
10 $prefetch = array('`boardlist_layout`');
11 require 'con.php';
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';
26 $user->userheader();
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();
36 else
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>
47 </div>
49 <?php
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:
57 $bl = new Boardlist_SO2; break;
58 default:
59 $bl = new Boardlist_IRC;
62 echo '<div id="boardlist" class="',get_class($bl),"\">\n";
63 $bl->display();
64 echo "</div>\n";
66 $page->pagefooter();