4 $prefetch = array('`points`', '`msglist_layout`', '`msgs_page`');
7 $page->title
= 'Message List';
9 if ( isset($_GET['topic']) ) {
10 $topicid = intval($_GET['topic']);
11 $topic = $DB->query('SELECT `board_name`, `boards`.`boardid`,
12 `view_level`, `post_level`, `topic_level`, `topic_title`
14 NATURAL LEFT JOIN `topics`
15 WHERE `topicid` = '.$topicid)->fetch_row();
18 // Check for valid topic ID
19 if ( !is_array($topic) )
20 $page->errorfooter('topicid');
23 if ( $topic[2] > $user->level
)
24 $page->errorfooter('level', $topic[2]);
26 $page->title
.= ': '.$topic[5];
28 $page->nav
['Topic List: '.$topic[0]] = 'topiclist?board='.$topic[1];
29 if ( $user instanceof authuser
&& $user->level
>= $topic[3] )
30 $user->userlinks
['Post Message'] = 'post?topic='.$topicid;
34 if ( $user instanceof authuser
) {
35 $start = isset($_GET['page']) ?
intval($_GET['page']) : 0;
36 $posts = isset($_GET['length']) && ($_GET['length'] <= 100) ?
intval($_GET['length']) : $user->msgs_page
;
39 $posts = $user->msgs_page
;
42 switch ( $user->msglist_layout
) {
44 $mlist = new messagelist_flat($topicid, $posts, $start); break;
46 $mlist = new messagelist_threaded($topicid, $posts, $start); break;
48 $mlist = new messagelist_irc($topicid, $posts, $start); break;
51 $l = $mlist->pagelist();
53 if ( $user instanceof authuser
&& $l )
54 echo '<div id="pagelist-head" class="nl">Pages: <ul>',"\n$l</ul></div>\n";
56 echo '<div id="',get_class($mlist),"\">\n";
60 if ( $user instanceof authuser
&& $l )
61 echo '<div id="pagelist-foot" class="nl">Pages: <ul>',"\n$l</ul></div>\n";