Added some class="" to pagelist code
[specialops2.git] / messagelist.php
blobc39252d85dac30624a49e452b0a30ea4bcadf4a6
1 <?php
2 /**
3 * Message List
5 * @author Anthony Parsons (xmpp:ant@specialops.ath.cx)
6 * @license file://COPYING
7 * @version $Id$
8 */
10 $prefetch = array('`points`', '`msglist_layout`', '`msglist_style`', '`msgs_page`');
11 require 'con.php';
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();
27 } else {
28 $page->errorfooter('topicid');
32 /* Error checks */
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:
55 default:
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:
63 default:
64 $mlist = new Messagelist_Flat($topicid, new $style, $mpp, $pagenum); break;
67 $user->userheader();
69 $l = $mlist->pagelist();
71 if ( $l ) {
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";
76 $mlist->display();
77 echo "</div>\n";
79 if ( $l ) {
80 echo '<dl id="pagelist-foot" class="nl"><dt>Pages:</dt> '.$l."</dl>\n";
83 $page->pagefooter();