<?php
if ($user['prava'] < 4 && $parent['private_post'] == '1') {
header('Location: /forum');
exit();
}
$k_post = mysql_result(mysql_query("SELECT COUNT(*) FROM `forum_topic` WHERE `id_razdel` = '$parent[id]'"),0);
$k_sub = mysql_result(mysql_query("SELECT COUNT(*) FROM `forum_razdel` WHERE `attached_to` = '$parent[id]'"),0);
$k_page = k_page($k_post,$set['p_str']);
$page = page($k_page);
$start = $set['p_str']*$page-$set['p_str'];
$forum_sub_1 = mysql_query("SELECT * FROM `forum_razdel` WHERE `sub_forum` = '1' and `attached_to` = '$parent[id]' ");
$q = mysql_query("SELECT * FROM `forum_topic` WHERE `id_razdel` = '$parent[id]' AND `verh` = '0' ORDER BY `last_msg_time` DESC LIMIT $start, $set[p_str]");
$p = mysql_query("SELECT * FROM `forum_topic` WHERE `id_razdel` = '$parent[id]' AND `verh` = '1' ORDER BY `last_msg_time` DESC LIMIT $start, $set[p_str]");
if($k_sub == 0)echo "";
if($k_post == 0 && $parent[clan_forum] != '1' || $k_post == 0 && $parent[sub_forum] == '1')echo "<div class='center player grey'>В этом разделе нет топиков!</div><div class='mini-line'></div>";
echo "<div class='player menuList'>";
While($forum_sub = mysql_fetch_assoc($forum_sub_1)) {
if($user['level']>=0 && ($forum_sub['private_post']==1 && $user['prava'] >=4 || $forum_sub['private_post']==0))echo "<li><a href='/forum?id=$forum_sub[id]'><img src='/images/icon/section.png'>$forum_sub[name]</a></li><div class='dot-line'></div>";
}
while($post2 = mysql_fetch_assoc($p)) {
echo '<li><a style="font-weight:bold;" href="/topic?id='.$post2[id].'"><img src="/images/icon/section_new.png">'.rawuridecode($post2[name]).'</a></li>';
echo '<div class="dot-line"></div>';
}
while($post = mysql_fetch_assoc($q)) {
echo '<li><a href="/topic?id='.$post[id].'"><img src="/images/icon/section_new.png">';
if($post[close] == 1){
echo '<span class="grey">'.$post['name'].'</span></a></li>';
}else{
echo ''.$post['name'].'</a></li>';
}
echo "<div class='dot-line'></div>";
} 
echo "</div>";
if ($k_page>1){
str('?',$k_page,$page); // Вывод страниц
echo "<div class='mini-line'></div>";
}
echo "<div class='player menuList'>";
if($parent['read_only'] == '1' && $user['prava'] >= '4' || $parent['read_only'] == '0') {
echo "<li><a href='/create_topic?id=$parent[id]'><img src='/images/icon/section_new.png'>Создать новый топик</a></li>";
}
if ($user['prava'] >= '5') {
echo "<li><a href='/moder_tools/add_forum?parent_id=$parent[id]'><img src='/images/icon/section_new.png'>Создать суб-раздел</a></li>";
}
echo '<li><a href="/moderators?forum='.$parent_id['id'].'"><img src="/images/icon/user.png">Список Модераторов</a></li>'";
Include 'forum_e_d_panel.php';
echo "<li><a href='/forum'><img src='/images/icon/section.png'>Вернуться в форум</a></li>";
echo "</div>";
?>