3 * Board List layout similar to old Special Ops 1 one
5 * @author Anthony Parsons (xmpp:ant@specialops.ath.cx)
6 * @license file://../COPYING
9 require_once 'iface.Boardlist.php';
11 class Boardlist_SO1
implements Boardlist
20 $boards = $DB->query('SELECT `group_name`, `boardid`, `board_name` AS `name`, `caption`, `view_restrict`
21 FROM `boards` LEFT JOIN `board-groups` USING(`groupid`)
22 ORDER BY `groupid` ASC, `boardid` ASC', MYSQLI_USE_RESULT
);
24 // Really bad multidimensional array hack
25 while ( $tmp = $boards->fetch_assoc() ) {
26 $groups[array_shift($tmp)][array_shift($tmp)] = $tmp;
31 <col
/><col
/><col
/><col
/>
34 <th scope
="col">Board
</th
>
35 <th scope
="col">Posts
</th
>
36 <th scope
="col">Topics
</th
>
37 <th scope
="col">Last Post
</th
>
41 foreach ( $groups as $groupname => $boards ) {
42 echo '<tbody class="boardgroup">',"\n",
43 '<tr><th scope="rowgroup" colspan="4">',$groupname,"</th></tr>\n";
45 foreach ( $boards as $boardid => $board ) {
46 $DB->query('SET @boardid = '.$boardid);
48 list($postcount, $lastpost) = $DB->query('SELECT COUNT(*), MAX(`messageid`) FROM `messages` WHERE `topicid` IN
49 (SELECT `topicid` FROM `topics` WHERE `boardid` = @boardid)')->fetch_row();
50 list($topiccount) = $DB->query('SELECT COUNT(*) FROM `topics` WHERE `boardid` = @boardid')->fetch_row();
53 $postinfo = $DB->query('SELECT `messages`.`userid`, `alias`, `mtime`, `topics`.`topicid`, `topic_title`
55 LEFT JOIN `topics` USING(`topicid`)
56 LEFT JOIN `users` ON `messages`.`userid` = `users`.`userid`
57 WHERE `messageid` = '.$lastpost)->fetch_assoc();
62 echo '<tr class="content">',"\n",
64 $user->has_priv('viewboard', $board['view_restrict']) ?
65 '<a href="topiclist?'.$boardid.'">'.$board['name'].'</a>' : $board['name']
67 ' <small style="margin-left:1em">',$board['caption'],"</small></td>\n",
68 ' <td>',$postcount,"</td>\n",
69 ' <td>',$topiccount,"</td>\n";
71 if ( $postinfo && $user->has_priv('viewboard', $board['view_restrict']) ) {
74 " <strong>From:</strong> %s\n".
75 " <strong>at</strong> %s<br/>\n".
76 ' <strong>in topic:</strong> <a class="topic" href="messagelist?%d">%s</a></small></td>'."\n".
78 $user->namelink($postinfo['userid'],
80 $user->fdate($postinfo['mtime']),
82 $postinfo['topic_title']
85 echo "\t<td>N/A</td>\n</tr>\n";