Special Ops 2.50
[specialops2.git] / topiclist.php
blob62a44347f0d6dfeb1f378b7d1c63ba80343e5400
1 <?php
2 /**
3 * Topic List
5 * @author Ant P <p@cpi.merseine.nu>
6 * @license file://COPYING
7 * @version 2.15
8 */
10 require 'con.php';
12 SO2::$Page->title = 'Topic List';
13 SO2::$Page->cacheable = true;
15 // Get board metadata
16 $boardid = isset($_GET['board']) ? intval($_GET['board']) : intval($_SERVER['QUERY_STRING']);
18 $b = new Board($boardid);
19 $board = $b->get_info();
21 // Or croak if it doesn't exist
22 if ( ! $board ) {
23 SO2::$Page->message(Page::ERR_NOBOARD);
26 SO2::$Page->title .= ': '.$board['board_name'];
28 if ( ! SO2::$User->has_access('viewboard', $board) ) { // View restriction
29 SO2::$Page->message(Page::ERR_ULEVEL);
31 if ( SO2::$User->has_access('posttopic', $board) ) { // Add topic post link if they're allowed to post one
32 SO2::$Page->usernav['Post Topic'] = 'post?board='.$boardid;
35 // Set the page last-modified time
36 SO2::$Page->mtime = SO2::$DB->query('SELECT MAX(mtime) FROM messages, topics WHERE messageid = lastpost AND boardid = @boardid')
37 ->fetchColumn(0);
39 SO2::$Page->pageheader();
41 // Get current page of topics
42 $start = isset($_GET['page']) ? intval($_GET['page']) : 0;
44 // Load topiclist module
45 if ( file_exists('lib/Topiclist_'.SO2::$User->topiclist_layout.'.php') ) {
46 $tmp = 'Topiclist_'.SO2::$User->topiclist_layout;
47 $tlist = new $tmp(SO2::$User->topics_page, $start);
48 } else {
49 SO2::$User->topiclist_layout = 'Default';
50 $tlist = new Topiclist_Default(SO2::$User->topics_page, $start);
53 // Output topiclist
54 if ( $l = $tlist->pagelist() ) {
55 echo '<dl id="pagelist-head" class="nl"><dt>Pages:</dt> '.$l."</dl>\n";
57 echo '<div id="topiclist" class="',get_class($tlist),"\">\n";
58 $tlist->display();
59 echo "</div>\n";
60 if ( $l ) {
61 echo '<dl id="pagelist-foot" class="nl"><dt>Pages:</dt> '.$l."</dl>\n";
64 // Quickpost thing
65 if ( SO2::$User->has_access('posttopic', $board) && SO2::$User->getopt('quickpost') ) { ?>
66 <form action="post?board=<?php echo $boardid ?>" method="post" id="quickpost">
67 <fieldset>
68 <legend>Quick Topic</legend>
69 <p><label>
70 Title:
71 <input type="text" name="topic_title" maxlength="60" size="80" tabindex="1"/>
72 </label></p>
73 <textarea rows="5" cols="60" name="message_text" tabindex="1"><?php
74 if ( SO2::$User->sig ) {
75 echo ( strpos($_SERVER['HTTP_USER_AGENT'], 'KHTML') ? "\n\n" : "\n" ),htmlspecialchars(SO2::$User->sig);
77 ?></textarea>
78 <button type="submit" accesskey="p" name="post" tabindex="1">Post (P)</button>
79 <button type="submit" accesskey="r" name="preview" tabindex="1">Preview (R)</button>
80 </fieldset>
81 </form>
82 <?php } ?>