Ok habs mir mal angeschaut, und so geändert, dass leere Kategorien auch angezeigt werden, aber in 1.1N werde ich das nicht übernehmen, da es vielleicht nicht alle wollen, gerade wenn man darüber nachdenkt, dass dann auch Kategorien sichtbar werden, in denen Foren sind, für die man kein Rechte hat.
include/contents/forum.php
<?php
# Copyright by: Manuel
# Support: www.ilch.de
defined ('main') or die ( 'no direct access' );
#Kategorien aufschlüsseln
function aktForumCats ($catAR,$trenn = 'hmenu') {
$out = '';
$i = count($catAR)-1;
if ($trenn == 'hmenu') {
while ($i > 0 ) {
$out .= '<a class="smalfont" href="index.php?forum-showcat-'.$catAR[$i]['id'].'">'.$catAR[$i]['name'].'</a><b> » </b>';
$i--;
}
$out .= '<a class="smalfont" href="index.php?forum-showcat-'.$catAR[$i]['id'].'">'.$catAR[$i]['name'].'</a>';
}
else {
while ($i > 0 ) {
$out .= $catAR[$i]['name'].' :: ';
$i--;
}
$out .= $catAR[$i]['name'];
}
return $out;
}
# variablen suchen und definieren.
if ($menu->get(1) == 'showcat') {
$cid = escape($menu->get(2), 'integer');
$aktForumAbf = "SELECT
a.id as cid, a.cid as topcid, a.name as cat
FROM prefix_forumcats a
WHERE a.id = ".$cid;
$fid = 'cat';
}
if ( $menu->get(1) == 'showtopics'
OR $menu->get(1) == 'editforum'
OR $menu->get(1) == 'savetopic'
OR $menu->get(1) == 'newtopic' ) {
$fid = escape($menu->get(2), 'integer');
}
if ( $menu->get(1) == 'showposts'
OR $menu->get(1) == 'newpost'
OR $menu->get(1) == 'editpost'
OR $menu->get(1) == 'edittopic'
OR $menu->get(1) == 'delpost'
OR $menu->get(1) == 'savepost' ) {
$tid = escape($menu->get(2), 'integer');
}
# menu
require_once('include/contents/forum/menu.php');
$forum_failure = array();
$forum_rights = array();
if ( !empty ($tid) ) {
$aktTopicAbf = "SELECT * FROM `prefix_topics` WHERE id = ".$tid;
$aktTopicErg = db_query($aktTopicAbf);
if ( db_num_rows($aktTopicErg) == 1 ) {
$aktTopicRow = db_fetch_assoc($aktTopicErg);
if (empty($fid)) {
$fid = $aktTopicRow['fid'];
}
} else {
$forum_failure[] = $lang['topicidnotfound'];
}
}
if ( !empty ($fid) ) {
if ($fid != 'cat') {
$aktForumAbf = "SELECT
a.id as cid, a.cid as topcid, a.name as cat,b.name,b.view,b.start,b.reply
FROM prefix_forumcats a
LEFT JOIN `prefix_forums` b ON a.id = b.cid
WHERE b.id = ".$fid;
}
$aktForumErg = db_query($aktForumAbf);
if ( db_num_rows($aktForumErg) > 0 ) {
$aktForumRow = db_fetch_assoc($aktForumErg);
//Unterkategorien
$topcid = $aktForumRow['topcid'];
$catsnr = 1;
$aktForumRow['kat'] = array();
while ( $topcid != 0 ) {
$tmpsql = db_fetch_object(db_query("SELECT id,cid,name FROM `prefix_forumcats` WHERE id = ".$topcid));
$topcid = $tmpsql->cid;
$aktForumRow['kat'][$catsnr] = array();
$aktForumRow['kat'][$catsnr]['id'] = $tmpsql->id;
$aktForumRow['kat'][$catsnr]['name'] = $tmpsql->name;
$catsnr++;
}
$aktForumRow['kat'][0]['id'] = $aktForumRow['cid'];
$aktForumRow['kat'][0]['name'] = $aktForumRow['cat'];
//Unterkategorien - Ende
$forum_rights = array (
'start' => has_right ($aktForumRow['start']),
'reply' => has_right (array($aktForumRow['reply'],$aktForumRow['start'])),
'view' => has_right (array($aktForumRow['view'],$aktForumRow['reply'],$aktForumRow['start'])),
'mods' => forum_user_is_mod($fid),
);
if ($forum_rights['view'] == false) {
$forum_failure[] = $lang['forumidnotfound'];
}
} else {
$forum_failure[] = $lang['forumidnotfound'];
}
}
switch ($menu->get(1)) {
default : $incdatei = 'show_forum.php'; break;
case 'showtopics' : $incdatei = 'show_topic.php'; break;
case 'editforum' : $incdatei = 'edit_forum.php'; break;
case 'showcat' : $incdatei = 'show_cat.php'; break;
case 'showposts' : $incdatei = 'show_posts.php'; break;
case 'newtopic' : $incdatei = 'new_topic.php'; break;
case 'savetopic' : $incdatei = 'save_topic.php'; break;
case 'newpost' : $incdatei = 'new_post.php'; break;
case 'savepost' : $incdatei = 'save_post.php'; break;
case 'edittopic' : $incdatei = 'edit_topic.php'; break;
case 'delpost' : $incdatei = 'del_post.php'; break;
case 'editpost' : $incdatei = 'edit_post.php'; break;
case 'privmsg' : $incdatei = 'privmsg.php'; break;
case 'aeit' :
case 'aubt' :
case 'augt' : $incdatei = 'search.php'; break;
case 'search' : $incdatei = 'suchen.php'; break;
}
if ( isset($incdatei) ) {
require_once('include/contents/forum/'.$incdatei);
}
//-----------------------------------------------------------|
?>
include/contents/forum/show_cat.php
<?php
# Copyright by: Manuel
# Support: www.ilch.de
defined ('main') or die ( 'no direct access' );
$title = $allgAr['title'].' :: Forum :: '.aktForumCats($aktForumRow['kat'],'title');
$hmenu = $extented_forum_menu.'<a class="smalfont" href="index.php?forum">Forum</a><b> » </b>'.aktForumCats($aktForumRow['kat']).$extented_forum_menu_sufix;
$design = new design ( $title , $hmenu, 1);
$design->header();
$tpl = new tpl ( 'forum/show_cat' );
$tpl->out (0);
$cid = escape($menu->get(2), 'integer');
$q = "SELECT
a.id, k.id as cid, a.name, a.besch,
a.topics, a.posts, b.name as topic,
c.id as pid, c.tid, b.rep, c.erst, c.time,
k.name as cname
FROM prefix_forumcats k
LEFT JOIN prefix_forums a ON k.id = a.cid
LEFT JOIN prefix_posts c ON a.last_post_id = c.id
LEFT JOIN prefix_topics b ON c.tid = b.id
LEFT JOIN prefix_groupusers vg ON vg.uid = ".$_SESSION['authid']." AND vg.gid = a.view
LEFT JOIN prefix_groupusers rg ON rg.uid = ".$_SESSION['authid']." AND rg.gid = a.reply
LEFT JOIN prefix_groupusers sg ON sg.uid = ".$_SESSION['authid']." AND sg.gid = a.start
WHERE ((".$_SESSION['authright']." <= a.view AND a.view < 1)
OR (".$_SESSION['authright']." <= a.reply AND a.reply < 1)
OR (".$_SESSION['authright']." <= a.start AND a.start < 1)
OR vg.fid IS NOT NULL
OR rg.fid IS NOT NULL
OR sg.fid IS NOT NULL
OR -9 >= ".$_SESSION['authright'].")
AND k.id = ".$cid."
ORDER BY k.pos, a.pos";
$erg1 = db_query($q);
$xcid = 0;
while ($r = db_fetch_assoc($erg1) ) {
debug($r);
if ($r['cid'] <> $xcid) {
$tpl->set_ar_out($r, 1);
//Unterkategorien
$sql = db_query("SELECT DISTINCT a.name as cname, a.id as cid FROM `prefix_forumcats` a WHERE a.cid = {$r['cid']} ORDER BY a.pos, a.name");
while ($ucat = db_fetch_assoc($sql)) {
$tpl->set_ar_out($ucat,2);
}
//Unterkategorien - Ende
$xcid = $r['cid'];
}
if (!is_null($r['id'])) {
$r['topicl'] = $r['topic'];
$r['topic'] = html_enc_substr($r['topic'],0,23);
$r['ORD'] = forum_get_ordner($r['time'],$r['id']);
$r['mods'] = getmods($r['id']);
$r['datum'] = date('d.m.y - H:i', $r['time']);
$r['page'] = ceil ( ($r['rep']+1) / $allgAr['Fpanz'] );
$tpl->set_ar_out ($r, 3);
}
}
$tpl->out(4);
$design->footer();
?>
include/contents/forum/show_forum.php
<?php
# Copyright by: Manuel
# Support: www.ilch.de
defined ('main') or die ( 'no direct access' );
$title = $allgAr['title'].' :: Forum';
$hmenu = $extented_forum_menu.'Forum'.$extented_forum_menu_sufix;
$design = new design ( $title , $hmenu, 1);
$design->header();
if ($menu->get(1) == 'markallasread') {
user_markallasread ();
}
$tpl = new tpl ( 'forum/showforum' );
$tpl->out (0);
$category_array = array();
$forum_array = array();
$q = "SELECT
a.id, k.id as cid, a.name, a.besch,
a.topics, a.posts, b.name as topic,
c.id as pid, c.tid, b.rep, c.erst, c.time,
k.name as cname
FROM prefix_forumcats k
LEFT JOIN prefix_forums a ON k.id = a.cid
LEFT JOIN prefix_posts c ON a.last_post_id = c.id
LEFT JOIN prefix_topics b ON c.tid = b.id
LEFT JOIN prefix_groupusers vg ON vg.uid = ".$_SESSION['authid']." AND vg.gid = a.view
LEFT JOIN prefix_groupusers rg ON rg.uid = ".$_SESSION['authid']." AND rg.gid = a.reply
LEFT JOIN prefix_groupusers sg ON sg.uid = ".$_SESSION['authid']." AND sg.gid = a.start
WHERE ((".$_SESSION['authright']." <= a.view AND a.view < 1)
OR (".$_SESSION['authright']." <= a.reply AND a.reply < 1)
OR (".$_SESSION['authright']." <= a.start AND a.start < 1)
OR vg.fid IS NOT NULL
OR rg.fid IS NOT NULL
OR sg.fid IS NOT NULL
OR -9 = ".$_SESSION['authright'].")
AND k.cid = 0
ORDER BY k.pos, a.pos";
$erg1 = db_query($q);
$xcid = 0;
while ($r = db_fetch_assoc($erg1) ) {
debug($r);
if ($r['cid'] <> $xcid) {
$tpl->set_ar_out($r, 1);
//Unterkategorien
$sql = db_query("SELECT DISTINCT a.name as cname, a.id as cid FROM `prefix_forumcats` a WHERE a.cid = {$r['cid']} ORDER BY a.pos, a.name");
while ($ucat = db_fetch_assoc($sql)) {
$tpl->set_ar_out($ucat,2);
}
//Unterkategorien - Ende
$xcid = $r['cid'];
}
if (!is_null($r['id'])) {
$r['topicl'] = $r['topic'];
$r['topic'] = html_enc_substr($r['topic'],0,23);
$r['ORD'] = forum_get_ordner($r['time'],$r['id']);
$r['mods'] = getmods($r['id']);
$r['datum'] = date('d.m.y - H:i', $r['time']);
$r['page'] = ceil ( ($r['rep']+1) / $allgAr['Fpanz'] );
$tpl->set_ar_out ($r, 3);
}
}
# statistic #
$ges_online_user = ges_online();
$stats_array = array (
'privmsgpopup' => check_for_pm_popup (),
'topics' => db_result(db_query("SELECT COUNT(ID) FROM `prefix_topics`"),0),
'posts' => db_result(db_query("SELECT COUNT(ID) FROM `prefix_posts`"),0),
'users' => db_result(db_query("SELECT COUNT(ID) FROM `prefix_user`"),0),
'istsind' => ( $ges_online_user > 1 ? 'sind' : 'ist' ),
'gesonline' => $ges_online_user,
'gastonline' => ges_gast_online(),
'useronline' => ges_user_online(),
'userliste' => user_online_liste()
);
$tpl->set_ar_out($stats_array,4);
$design->footer();
?>
Ich hoffe mir sind keine Fehler unterlaufen