4 $prefetch = array('`points`', '`msglist_layout`', '`msgs_page`');
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`
17 NATURAL LEFT JOIN `topics`
18 WHERE `topicid` = '.$topicid)->fetch_row();
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;
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
;
43 $posts = $user->msgs_page
;
46 switch ( $user->msglist_layout
) {
48 $mlist = new messagelist_flat($topicid, $posts, $start); break;
50 $mlist = new messagelist_threaded($topicid, $posts, $start); break;
52 $mlist = new messagelist_irc($topicid, $posts, $start); break;
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";
66 if ( $user instanceof authuser
&& $l )
67 echo '<dl id="pagelist-foot" class="nl"><dt>Pages:</dt> '.$l."</dl>\n";