added error reporting line
[specialops2.git] / messagelist.php
blob14e22a21d9da63cd7b820a0fbedce2d828d3a239
1 <?php
2 // $Id$
4 $prefetch = array('`points`', '`msglist_layout`');
5 require 'con.php';
7 $page->title = 'Message List';
9 if ( isset($_GET['topic']) ) {
10 $topicid = intval($_GET['topic']);
11 $topic = $DB->query('SELECT `board_name`, `boards`.`boardid`, `view_level`, `post_level`, `topic_level`, `topic_title`
12 FROM `boards` NATURAL LEFT JOIN `topics` WHERE `topicid` = '.$topicid)->fetch_row();
15 if ( !is_array($topic) )
16 $page->errorfooter('topicid');
18 if ( $topic[2] > $user->level )
19 $page->errorfooter('level', $topic[2]);
21 $page->title .= ': '.$topic[5];
23 $page->nav['Topic List: '.$topic[0]] = 'topiclist?board='.$topic[1];
24 if ( $user instanceof authuser && $user->level >= $topic[3] )
25 $user->userlinks['Post Message'] = 'post?topic='.$topicid;
27 $user->userheader();
29 $start = 0;
30 $posts = $user->msgs_page;
32 if ( $user instanceof authuser ) {
33 $start = isset($_GET['page']) ? intval($_GET['page']) : 0;
34 $posts = isset($_GET['length']) && ($_GET['length'] <= 100) ? intval($_GET['length']) : $user->msgs_page;
37 switch ( $user->msglist_layout ) {
38 case 0:
39 $mlist = new messagelist_flat($topicid, $posts, $start); break;
40 case 1:
41 $mlist = new messagelist_threaded($topicid, $posts, $start); break;
42 case 2:
43 $mlist = new messagelist_irc($topicid, $posts, $start); break;
46 $l = $mlist->pagelist();
48 if ( $user instanceof authuser && $l )
49 echo '<div id="pagelist-head" class="nl">Pages: <ul>',"\n$l</ul></div>\n";
50 $mlist->display();
51 if ( $user instanceof authuser && $l )
52 echo '<div id="pagelist-foot" class="nl">Pages: <ul>',"\n$l</ul></div>\n";
54 $page->pagefooter();