<?php
defined('WikyBlog') or die("Not an entry point...");
class forumListing{
var $parent;
var $category;
function forumListing($parent){
global $page;
$this->parent = $parent;
$this->category = false;
if( isset($_GET['cat']) && is_numeric($_GET['cat']) ){
$this->category = $_GET['cat'];
$link = $parent->uniqLink.'?cat='.$this->category;
}else{
$link = $parent->uniqLink;
}
ob_start();
$this->getList();
$this->parent->forumFooter(true);
$page->contentB[$link] = wb::get_clean();
}
function getList(){
global $wbTables,$langA,$dbObject,$pageOwner,$page;
pluginIncludeFile('themes/default/template.php');
$query = 'SELECT '.$wbTables['bb_forums'].'.*, '.$wbTables['bb_categories'].'.`title` as `cat_title` ';
$query .= ' FROM '.$wbTables['bb_forums'];
$query .= ' LEFT JOIN '.$wbTables['bb_categories'].' USING (`cat_id`) ';
if( $this->category !== false ){
$query .= ' WHERE '.$wbTables['bb_forums'].'.`cat_id` = "'. wbDB::escape($this->category) .'" ';
}
$query .= ' ORDER BY `cat_position` , '.$wbTables['bb_forums'].'.`position` ';
$result = wbDB::runQuery($query);
echo '<table width="100%" cellpadding="3">';
$currentCat = false;
while($row = mysql_fetch_assoc($result)){
$catLink = $page->regLink(toDisplay($row['cat_title']), $this->parent->uniqLink.'?cat='.$row['cat_id']);
if( $currentCat != $row['cat_id'] ){
forumTemplate::forumHeader($row);
$currentCat = $row['cat_id'];
}
forumTemplate::forumDisplay($row);
}
if( $currentCat !== false){
echo '<tr class="sm" style="background-color:#f1f1f1;line-height:100%;">';
echo '<td colspan="4"> </td>';
echo '</tr>';
}
echo '</table>';
}
}