You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

142 lines
3.4 KiB

<?php
if(!defined('DATALIFEENGINE'))
{
die("Hacking attempt!");
}
if (intval($cid))
{
if ($forum_config['hide_forum'])
{
$access_hide = "and access_read regexp '[[:<:]](".$member_id['user_group'].")[[:>:]]'";
}
else
{
$access_hide = "";
}
$category_name = stripslashes($cats_array[$cid]['cat_name']);
if ($category_name)
{
$result = $db->query("SELECT * FROM ". PREFIX ."_forum_forums WHERE main_id = $cid and parentid = 0 {$access_hide} ORDER by position");
while ($row = $db->get_row($result))
{
if (!$fcache->open('sub-'.$row['id']))
{
if ($sub_forums_array != 'empty')
{
foreach ($sub_forums_array as $value)
{
if ($row['id'] == $value['parentid'])
{
$symbol_count++;
if ($symbol_count > 1) $symbol = ", ";
$sub_forums .= link_forum($value['id'], $value['name'], $symbol);
}
}
}
$fcache->save('sub-'.$row['id'], $sub_forums);
}
else { $sub_forums = $fcache->open('sub-'.$row['id']); }
if (!$fcache->open('moder-'.$row['id']))
{
foreach ($forum_moderators as $moderators)
{
if ($moderators['forum_id'] == $row['id'] and $moderators['member_name'])
{
$mod_count++;
if ($mod_count > 1) $mod_symbol = ", ";
$moderators_list .= $mod_symbol . link_user($moderators['member_name']);
}
}
$fcache->save('moder-'.$row['id'], $moderators_list);
}
else { $moderators_list = $fcache->open('moder-'.$row['id']); }
$tpl->load_template($tpl_dir.'forums.tpl');
$tpl->set('{status}', forum_status ($row['f_last_date'], $row['password'], $row['icon']));
$tpl->set('{name}', link_forum($row['id'], $row['name']));
$tpl->set('{description}', stripslashes($row['description']));
if ($sub_forums)
{
$tpl->set('{forums}', '<br />'.$forum_config['forum_pr_sub'].' '.$sub_forums);
}
else { $tpl->set('{forums}', ''); }
if ($moderators_list)
{
$tpl->set('{moderators}', '<br />' . $f_lang['moderators'] . ' ' . $moderators_list);
}
else { $tpl->set('{moderators}', ''); }
$tpl->set('{topics}', $row['topics']);
$tpl->set('{post}', $row['posts']);
$tpl->set('{forum_id_rss}', $forum_url."/rss/forum_".$row['id'].".xml");
$tpl->set('{last}', forum_last ($row['f_last_tid'], $row['f_last_title'], $row['f_last_poster_name'], $row['f_last_date'], $row['password'], $row['id'], $row['access_read'], $row['last_post_id']));
$tpl->compile('forums');
$tpl->clear();
unset ($sub_forums);
unset ($symbol_count);
unset ($symbol);
unset ($moderators_list);
unset ($mod_count);
unset ($mod_symbol);
}
$tpl->load_template($tpl_dir.'category.tpl');
$tpl->set('{category}', $category_name);
$tpl->set('{forums}', $tpl->result['forums']);
$tpl->compile('dle_forum');
$tpl->clear();
$metatags['title'] = $forum_config['forum_title'].' &raquo; '.$category_name;
if ($forum_config['forum_bar'])
{
$bbr_cid = $cid;
$bbr_name = $category_name;
}
}
else
{
@header("HTTP/1.0 404 Not Found");
forum_msg($f_lang['f_msg'], $f_lang['f_404']);
}
}
else
{
@header("HTTP/1.0 404 Not Found");
forum_msg($f_lang['f_msg'], $f_lang['f_404']);
}
?>