SO 1-final
[specialops1.git] / index.php
blob281ba0149fc0667f4bd6c670453cff9b3ada0b77
1 <?php
2 $title_name = 'Board List';
3 $page_name = '';
4 require 'config.php';
5 require 'top.inc.php';
7 echo '<table style="clear:both">
8 <thead>
9 <tr>
10 <th style="width:35%">Board</th>
11 <th style="width:10%">Posts</th>
12 <th style="width:10%">Topics</th>
13 <th style="width:45%">Last Post</th>
14 </tr>
15 </thead>',"\n";
17 $sql = mysql_query('SELECT `group`, `name` FROM `board-groups` ORDER BY `group` ASC');
18 while ( list($cat_id, $cat_name) = mysql_fetch_row($sql) ) {
19 echo "<tbody>\n",
20 '<tr id="cat'.$cat_id.'"><th colspan="4"><a href="#cat',$cat_id,'">',$cat_name,"</a></th></tr>\n";
22 $list = mysql_query('SELECT `board`, `name`, `caption`, `view_level` FROM `boards`
23 WHERE `group` = '.$cat_id.' ORDER BY `board` ASC');
25 while ( $board = mysql_fetch_assoc($list) ) {
27 if ( $userinfo['level'] < $board['view_level'] ) {
28 echo '<tr class="c2"><td>',$board['name'],"<br/>\n",
29 "\t<small>",$board['caption'],"</small></td>\n",
30 '<td colspan="3">-</td></tr>',"\n";
31 continue;
34 $topic_ids = null;
35 $tmp = mysql_query('SELECT `topic` FROM `topics` WHERE `board` = '.$board['board']);
36 while ( $topic_id = mysql_fetch_row($tmp) )
37 $topic_ids[] = $topic_id[0];
39 list($messages) = count($topic_ids) ?
40 mysql_fetch_row(mysql_query('SELECT COUNT(*) FROM `messages`
41 WHERE `visible` >= 0 AND `topic` IN ('.implode(',', $topic_ids).')'))
42 : array(0); /*</tabwhoring>*/
44 echo '<tr class="c1">',"\n",
45 '<td><a href="viewboard?b=',$board['board'],'">',$board['name'],"</a><br/>\n",
46 "\t<small>",$board['caption'],"</small></td>\n",
47 '<td>',$messages,"</td>\n",
48 '<td>',count($topic_ids),"</td>\n";
50 if ( $messages ) {
51 $lastmsg = mysql_fetch_row(mysql_unbuffered_query(
52 'SELECT UNIX_TIMESTAMP(`time`), `messages`.`user`, `topics`.`topic`, `title`
53 FROM `messages` LEFT JOIN `topics` USING (`topic`)
54 WHERE `board` = '.$board['board'].'
55 AND `messages`.`visible` >= 0
56 ORDER BY `message` DESC LIMIT 1'));
57 echo '<td>',date2($lastmsg[0]),' <small>by ',userlink($lastmsg[1]),"<br/>\n",
58 'in <a href="viewtopic?b=',$board['board'],';t=',$lastmsg[2],'">',strip_tags($lastmsg[3]),"</a></small></td>\n";
59 } else
60 echo '<td>none</td>';
62 echo "</tr>\n";
64 echo "</tbody>\n";
67 mysql_free_result($sql);
69 // Start of info panel
70 $list = mysql_query('SELECT `user` FROM `users`
71 WHERE `last_active` > (NOW() - 600)
72 AND `level` > '.INACTIVE_USER.'
73 ORDER BY `last_active` DESC LIMIT 20');
75 for ( $online_count = 0, $online_list = ''; list($tmp) = mysql_fetch_row($list); $online_count++ )
76 $online_list .= '<li>'.userlink($tmp)."</li>\n";
78 mysql_free_result($list);
80 list($total_users) = mysql_fetch_row(mysql_query('SELECT COUNT(*) FROM `users`'));
82 echo '</table>
84 <div class="c3"><a href="stuff" accesskey="s">Stats and other stuff</a></div>
85 <p class="c2">';
86 if ( isset($userinfo['user']) )
87 echo '<a href="userdir?list=online">',$online_count,' ',ngettext('user', 'users', $online_count),
88 ' online</a> out of <a href="userdir">',$total_users,' total</a>';
89 else
90 echo $online_count,' ',ngettext('user', 'users', $online_count),' online out of ',$total_users,' total';
91 echo "</p>\n",
92 ( $online_count ? '<ul class="inline-list c2">'.$online_list.'</ul>' : '' ).'
94 <ul class="plain-list c1" style="clear:both">
95 <li><a href="prefs" title="Click here to change settings">Current time</a> is '.date2 (time()),"</li>\n";
97 $tmp = mysql_query('SELECT UNIX_TIMESTAMP(`time`), `messages`.`topic`, `board`, `title`, `messages`.`user`
98 FROM `messages`
99 LEFT JOIN `topics` USING (`topic`)
100 WHERE `messages`.`visible` >= 0
101 ORDER BY `message` DESC LIMIT 1');
103 if ( mysql_num_rows($tmp) ) {
104 $lastmsg = mysql_fetch_row($tmp);
105 echo '<li><a href="viewtopic?b=',$lastmsg[2],';t=',$lastmsg[1],
106 '" accesskey="p" title="Go to most recent post">Last Post</a> was at ',date2($lastmsg[0]),"</li>\n";
109 mysql_free_result($tmp);
111 echo '</ul>';
113 footer();