Did something with the DTD thing
[specialops2.git] / topiclist.php
blob7bf0c8f655a74da84834108da1482a04a68880ca
1 <?php
2 /**
3 * Topic List
5 * @author Anthony Parsons (xmpp:ant@specialops.ath.cx)
6 * @license file://COPYING
7 * @version $Id$
8 */
10 $prefetch = array('`topiclist_layout`', '`topics_page`');
11 require 'con.php';
13 $page->title = 'Topic List';
14 $page->cacheable = true;
16 $boardid = isset($_GET['board']) ? intval($_GET['board']) : intval($_SERVER['QUERY_STRING']);
18 $board = $DB->query('SELECT `board_name`, `view_restrict`, `post_restrict` FROM `boards` WHERE `boardid` = '.$boardid)->fetch_row();
20 if ( !is_array($board) ) {
21 $page->errorfooter('boardid');
24 $page->title .= ': '.$board[0];
27 if ( ! $user->has_priv('viewboard', $board[1]) ) { // View restriction
28 $page->errorfooter('level');
30 if ( $user->has_priv('posttopic', $board[2]) ) { // Add topic post link if they're allowed to post one
31 $user->userlinks['Post Topic'] = 'post?board='.$boardid;
34 list($page->mtime) = $DB->query('SELECT MAX(`mtime`) FROM `messages` NATURAL LEFT JOIN `topics` WHERE `boardid` = '.$boardid)->fetch_row();
36 $user->userheader();
38 $start = isset($_GET['page']) ? intval($_GET['page']) : 0;
40 $DB->query('SET @boardid = '.$boardid);
42 switch ( $user->topiclist_layout ) {
43 case 1:
44 $tlist = new Topiclist_TL($user->topics_page, $start); break;
45 default:
46 $tlist = new Topiclist_Default($user->topics_page, $start);
49 $l = $tlist->pagelist();
51 if ( $l ) {
52 echo '<dl id="pagelist-head" class="nl"><dt>Pages:</dt> '.$l."</dl>\n";
55 echo '<div id="topiclist" class="',get_class($tlist),"\">\n";
56 $tlist->display();
57 echo "</div>\n";
59 if ( $l ) {
60 echo '<dl id="pagelist-foot" class="nl"><dt>Pages:</dt> '.$l."</dl>\n";
63 if ( strpos($user->options, 'quickpost') !== false ) {
65 <form action="post?board=<?php echo $boardid ?>" method="post" id="quickpost">
66 <fieldset><legend>Quick Topic</legend>
67 <p><label>Title: <input type="text" name="topic_title" maxlength="60" size="80" tabindex="1"/></label></p>
68 <textarea rows="5" cols="60" name="message_text"><?php
69 if ( $user->sig ) {
70 echo ( strpos($_SERVER['HTTP_USER_AGENT'], 'KHTML') ? "\n\n" : "\n" ),htmlspecialchars($user->sig);
72 ?></textarea>
73 <button type="submit" accesskey="p" name="post">Post (P)</button>
74 <button type="submit" accesskey="r" name="preview">Preview (R)</button>
75 </fieldset>
76 </form>
77 <?php
80 $page->pagefooter();