Made logins apply to whole site instead of boards.
[specialops2.git] / topiclist.php
blobd75d831951ef740fb67c80342f3a7b323d90e6b3
1 <?php
2 // $Id$
4 $prefetch = array('`topiclist_layout`', '`topics_page`');
5 require 'con.php';
6 $page->title = 'Topic List';
8 $boardid = isset($_GET['board']) ? intval($_GET['board']) : intval($_SERVER['QUERY_STRING']);
10 $board = $DB->query('SELECT `board_name`, `restrict` FROM `boards`
11 WHERE `boardid` = '.$boardid)->fetch_row();
13 if ( !is_array($board) )
14 $page->errorfooter('boardid');
16 $DB->query('SET @boardid = '.$boardid);
18 $page->title .= ': '.$board[0];
20 // Check whether or not users can view this board
21 if ( $board[1] >= 3 && !defined('DEVELOPER') )
22 $page->errorfooter('level', $board[1]);
23 // Check whether they're allowed to post a topic
24 if ( ($board[1] <= 0 || defined('DEVELOPER')) && $user instanceof authuser )
25 $user->userlinks['Post Topic'] = 'post?board='.$boardid;
27 $user->userheader();
29 if ( $user instanceof authuser ) {
30 $start = isset($_GET['page']) ? intval($_GET['page']) : 0;
31 } else {
32 $start = 0;
35 switch ( $user->topiclist_layout ) {
36 case 0:
37 $tlist = new topiclist_default($user->topics_page, $start); break;
38 case 1:
39 $tlist = new topiclist_tl($user->topics_page, $start); break;
40 default:
41 throw new OutOfBoundsException('user->topiclist_layout is out of valid range');
44 $l = $tlist->pagelist();
46 if ( $user instanceof authuser && $l )
47 echo '<dl id="pagelist-head" class="nl"><dt>Pages:</dt> '.$l."</dl>\n";
49 echo '<div id="',get_class($tlist),"\">\n";
50 $tlist->display();
51 echo "</div>\n";
53 if ( $user instanceof authuser && $l )
54 echo '<dl id="pagelist-foot" class="nl"><dt>Pages:</dt> '.$l."</dl>\n";
56 $page->pagefooter();