Improved gfcss theme, edited TOS slightly, quickpost on topic list, moved the topic...
[specialops2.git] / index.php
blob01e3e662ac228b797a6c11944440a8beb9a90e03
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 // 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';
27 $user->userheader();
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`
36 WHERE `last_active_date` > UNIX_TIMESTAMP() - 600')->fetch_row();
37 else
38 $count = $onlinelist->num_rows;
40 $onlines = ( 1 === $count ?
41 'There is <a href="userlist?online">one user online</a>' :
42 'There are <a href="userlist?online">%d users online</a>' );
45 <div id="boardlist-stats">
46 <p>Current time (UTC<?php printf('%+d): %s', $user->timezone, $user->fdate(time())) ?></p>
47 <p><?php printf($onlines, $count); echo ( 0 < $count ) ? ': '.implode(', ', $onlineusers) : '.' ?></p>
48 </div>
50 <?php
52 switch ( $user->boardlist_layout ) {
53 case Boardlist_IRC::ID:
54 $bl = new Boardlist_IRC; break;
55 case Boardlist_SO1::ID:
56 $bl = new Boardlist_SO1; break;
57 case Boardlist_SO2::ID:
58 $bl = new Boardlist_SO2; break;
59 default:
60 $bl = new Boardlist_IRC;
63 echo '<div id="boardlist" class="',get_class($bl),"\">\n";
64 $bl->display();
65 echo "</div>\n";
67 $page->pagefooter();