Made it a bit more obvious the $$'s are meant to be there.
[specialops2.git] / messagelist.php
blobefcac0cabfb581fa8228c3d5c089b77264874fd0
1 <?php
2 // $Id$
4 $prefetch = array('`points`', '`msglist_layout`', '`msgs_page`');
5 require 'con.php';
7 $page->title = 'Message List';
9 if ( is_numeric($_SERVER['QUERY_STRING']) )
10 $topicid = intval($_SERVER['QUERY_STRING']);
11 elseif ( isset($_GET['topic']) )
12 $topicid = intval($_GET['topic']);
14 if ( isset($topicid) ) {
15 $topic = $DB->query('SELECT `board_name`, `boards`.`boardid`, `topic_title`, `restrict`
16 FROM `boards`
17 NATURAL LEFT JOIN `topics`
18 WHERE `topicid` = '.$topicid)->fetch_row();
19 } else
20 $page->errorfooter('topicid');
22 // Check for valid topic ID
23 if ( !is_array($topic) )
24 $page->errorfooter('topicid');
26 // Check whether or not they can view this board
27 if ( $topic[3] >= 3 && !defined('DEVELOPER') )
28 $page->errorfooter('level', $topic[2]);
30 $page->title .= ': '.$topic[2];
32 $page->nav['Topic List: '.$topic[0]] = 'topiclist?'.$topic[1];
33 if ( $user instanceof authuser && ($topic[3] <= 1 || defined('DEVELOPER')) )
34 $user->userlinks['Post Message'] = 'post?topic='.$topicid;
36 $user->userheader();
38 if ( $user instanceof authuser ) {
39 $start = isset($_GET['page']) ? intval($_GET['page']) : 0;
40 $posts = isset($_GET['length']) && ($_GET['length'] <= 100) ? intval($_GET['length']) : $user->msgs_page;
41 } else {
42 $start = 0;
43 $posts = $user->msgs_page;
46 switch ( $user->msglist_layout ) {
47 case 0:
48 $mlist = new messagelist_flat($topicid, $posts, $start); break;
49 case 1:
50 $mlist = new messagelist_threaded($topicid, $posts, $start); break;
51 case 2:
52 $mlist = new messagelist_irc($topicid, $posts, $start); break;
53 default:
54 throw new OutOfBoundsException('user->msglist_layout is out of valid range');
57 $l = $mlist->pagelist();
59 if ( $user instanceof authuser && $l )
60 echo '<dl id="pagelist-head" class="nl"><dt>Pages:</dt> '.$l."</dl>\n";
62 echo '<div id="',get_class($mlist),"\">\n";
63 $mlist->display();
64 echo "</div>\n";
66 if ( $user instanceof authuser && $l )
67 echo '<dl id="pagelist-foot" class="nl"><dt>Pages:</dt> '.$l."</dl>\n";
69 $page->pagefooter();