Made the js work again
[specialops2.git] / index.php
bloba6369d78ae227a70cc37052dc2d50de9c7c76a17
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 list($lastpost) = $DB->query('SELECT MAX(`mtime`) FROM `messages`')->fetch_row();
14 list($lastuser) = $DB->query('SELECT MAX(`last_active_date`) FROM `users`')->fetch_row();
15 $page->last_modified = max($lastpost, $lastuser);
17 array_pop($user->userlinks); // The online users link is in the middle of the page anyway
18 $page->nav['Stats Page'] = 'stuff';
20 $user->userheader();
22 $onlinelist = $DB->query('SELECT `userid`, `alias` FROM `users`
23 WHERE `last_active_date` > UNIX_TIMESTAMP() - 600
24 ORDER BY `last_active_date` ASC LIMIT 30');
25 $onlineusers = $user->fillnamecache($onlinelist);
27 if ( 30 === $onlinelist->num_rows )
28 list($count) = $DB->query('SELECT COUNT(*) FROM `users`
29 WHERE `last_active_date` > UNIX_TIMESTAMP() - 600')->fetch_row();
30 else
31 $count = $onlinelist->num_rows;
33 $onlines = ( 1 === $count ?
34 'There is <a href="userlist?online">one user online</a>' :
35 'There are <a href="userlist?online">%d users online</a>' );
38 <div id="boardlist-stats">
39 <p>Current time (UTC<?php printf('%+d): %s', $user->timezone, $user->fdate(time())) ?></p>
40 <p><?php printf($onlines, $count); echo ( 0 < $count ) ? ': '.implode(', ', $onlineusers) : '.' ?></p>
41 </div>
43 <?php
45 switch ( $user->boardlist_layout ) {
46 case Boardlist_SO2::ID:
47 $bl = new Boardlist_SO2; break;
48 case Boardlist_SO1::ID:
49 default:
50 $bl = new Boardlist_SO1;
53 echo '<div id="boardlist" class="',get_class($bl),"\">\n";
54 $bl->display();
55 echo "</div>\n";
57 $page->pagefooter();