5 * @author Anthony Parsons (xmpp:ant@specialops.ath.cx)
6 * @license file://COPYING
10 $prefetch = array('`points`', '`msglist_layout`', '`msglist_style`', '`msgs_page`');
13 $page->title
= 'Message List';
14 $page->cacheable
= true;
16 if ( is_numeric($_SERVER['QUERY_STRING']) ) {
17 $topicid = intval($_SERVER['QUERY_STRING']);
18 } elseif ( isset($_GET['topic']) ) {
19 $topicid = intval($_GET['topic']);
23 if ( isset($topicid) ) {
24 $topic = $DB->query('SELECT `board_name`, `boards`.`boardid`, `topic_title`, `view_restrict`, `post_restrict`
25 FROM `boards` NATURAL LEFT JOIN `topics` WHERE `topicid` = '.$topicid)->fetch_row();
26 list($firstmsg, $page->mtime
) = $DB->query('SELECT MIN(`messageid`), MAX(`mtime`) FROM `messages` WHERE `topicid` = '.$topicid)->fetch_row();
28 $page->errorfooter('topicid');
33 if ( !is_array($topic) ) { // Check for valid topic ID
34 $page->errorfooter('topicid');
36 if ( ! $user->has_priv('viewboard', $topic[3]) ) { // Check whether or not they can view this board
37 $page->errorfooter('level', $topic[3]);
40 $page->title
.= ': '.$topic[2];
41 $page->nav
['Topic List: '.$topic[0]] = 'topiclist?'.$topic[1];
42 $page->nav
['Reply'] = 'post?message='.$firstmsg;
44 $mpp = isset($_GET['length']) && ($_GET['length'] <= 100) ?
intval($_GET['length']) : $user->msgs_page
;
45 $pagenum = isset($_GET['page']) ?
intval($_GET['page']) : 0;
47 define('HERE', 'messagelist?topic='.$topicid.';page='.$pagenum.';length='.$mpp);
49 switch ( $user->msglist_style
) {
50 case Messagestyle_Frozenoven
::ID
:
51 $style = 'Messagestyle_Frozenoven'; break;
52 case Messagestyle_IRC
::ID
:
53 $style = 'Messagestyle_IRC'; break;
54 case Messagestyle_Plain
::ID
:
56 $style = 'Messagestyle_Plain'; break;
59 switch ( $user->msglist_layout
) {
60 case Messagelist_Threaded
::ID
:
61 $mlist = new Messagelist_Threaded($topicid, new $style, $mpp, $pagenum); break;
62 case Messagelist_Flat
::ID
:
64 $mlist = new Messagelist_Flat($topicid, new $style, $mpp, $pagenum); break;
69 $l = $mlist->pagelist();
72 echo '<dl id="pagelist-head" class="nl"><dt>Pages:</dt> ',$l,"</dl>\n";
75 echo '<div id="messagelist" class="',get_class($mlist)," $style\">\n";
80 echo '<dl id="pagelist-foot" class="nl"><dt>Pages:</dt> '.$l."</dl>\n";