<?php
/**
*
*
* @version $Id: showForum.inc.php,v 1.4 2004/09/29 17:27:45 cb_fog Exp $
* @copyright 2003
**/
/* Settings auf default Werte setzen */
$_writeable = 0;
/*
$additionalSQL = array(
"field" => ", COUNT(thread.categoryID) AS threadCount, SUM(msg.rightID) AS messagesRight, MAX(thread.lastModified) AS messageLastEntry",
"join" => "LEFT JOIN ".TABLE."_forum_thread AS thread, ".TABLE."_forum_message AS msg ON n.categoryID = thread.categoryID AND thread.rootID = msg.messageID",
"orderby" => "GROUP BY n.categoryID, msg.rootID"
);
*/
$additionalSQL = array(
"field" => ", COUNT(thread.categoryID) AS threadCount, MAX(thread.lastModified) AS messageLastEntry",
"join" => "LEFT JOIN ".TABLE."_forum_thread AS thread ON n.categoryID = thread.categoryID",
"orderby" => "GROUP BY n.categoryID"
);
/* aktuelles Forum abrufen */
$actualForum = $nestedSet_category->getNode($_REQUEST[forumID], true);
if($actualForum != false) {
if(FORUM_CATEGORY_WRITEABLE & $actualForum[options]) {
$_writeable = 1;
}
$categoryPathQuery = true;
$categoryQuery = $nestedSet_category->getChildren($_REQUEST[forumID], true, $additionalSQL);
} else {
/*
* wenn Abfrage nach aktuellem Forum fehlschlägt, dann Abfrage, ob man
* im Top Level posten darf
*/
if($forum_option->getSingleOption("allow_top_level_posting") == 1) {
$_writeable = 1;
}
$categoryPathQuery = false;
$categoryQuery = $nestedSet_category->getRootNodes(true, $additionalSQL);
}
/*
* Zuweisung der Optionen ans template
*/
$tpl->assign("forum_settings",
array ( "writeable" => $_writeable )
);
$categorySet = 0;
if($categoryQuery != false) {
$categorySet = 1;
foreach($categoryQuery as $v) {
$categoryLastModified[] = $v[messageLastEntry];
$categoryMessageAmount[] = $v[messagesRight] / 2;
$categoryThreadAmount[] = $v[threadCount];
$categoryName[] = stripslashes($v[name]);
$categoryDescription[] = stripslashes($v[description]);
$categoryID[] = $v[id];
$categoryDatetime[] = $v[datetime];
}
}
/*
* Pfad Menu aufbauen
*/
$_pathID = false;
if($categoryPathQuery != false) {
$_pathID = $_REQUEST[forumID];
}
$categoryPath = $forumObj->getForumPath($_pathID);
$tpl->assign( "categoryPath",
array ( "categoryID" => $categoryPath['id'],
"categoryName" => $categoryPath['name']
)
);
/*
* Ans Template senden
*/
$tpl->assign(
array ( "categorySet" => $categorySet,
"categoryID" => $categoryID,
"categoryName" => $categoryName,
"categoryDescription" => $categoryDescription,
"categoryDatetime" => $categoryDatetime,
"categoryThreadAmount" => $categoryThreadAmount,
"categoryMessageAmount" => $categoryMessageAmount
)
);
/*
* Template ausgeben
*/
$forum_content[] = $tpl->fetch("forumOverview.template");
/*
* Threads des aktuellen Forums anzeigen
*/
include_once(dirname(__FILE__)."/showThreads.inc.php");
?>