Database rewrite, first half
[specialops2.git] / messagelist.php
blobd9d5a9b32d310c5e0b536efd4140608eef6a0848
1 <?php
2 // $Id$
4 $prefetch = array('`u_points`', '`u_mlist_view`');
5 require 'con.php';
7 $page->title = _('Message List');
9 if ( isset($_GET['topic']) ) {
10 $topicid = intval($_GET['topic']);
11 $topic = $DB->query('SELECT `b_name`, `boardid`, `b_view_level`, `b_view_points`, `b_topic_level`, `t_name`
12 FROM `boards`, `topics`
13 WHERE `boardid` = `t_board` AND `topicid` = '.$topicid)->fetch_row();
16 if ( !is_array($topic) )
17 $page->errorfooter('topicid');
19 if ( $topic[2] > $user->u_level || $topic[3] > $user->u_points )
20 $page->errorfooter('levelpoints', $topic[2], $topic[3]);
22 $page->title .= ': '.$topic[5];
24 $page->nav[_('Topic List').': '.$topic[0]] = 'topiclist?board='.$topic[1];
25 if ( $user instanceof authuser )
26 $user->userlinks[_('Post Message')] = 'post?topic='.$topicid;
28 $user->userheader();
30 switch ( $user->u_mlist_view ) {
31 case 0:
32 new messagelist_flat($topicid); break;
33 case 1:
34 new messagelist_threaded($topicid); break;
35 case 2:
36 new messagelist_irc($topicid); break;
39 $page->pagefooter();