Размер файла: 2.1Kb
<?php
/*
*Manag-Develop BolCmS-Suptesat
*Syte- bolcms.cf
*/
$title = 'Форум';
require("../system/core.php");
switch($_GET['act']){
default:
echo '<div class="phdr"> ' .$lng ['forum'] . ' </div><div class="bmenu">';
$result = mysql_query("SELECT * FROM `forum_cats`");
while($row = mysql_fetch_assoc($result)){
$topics = mysql_result(mysql_query("SELECT COUNT(*) FROM `forum_topics` WHERE `id_cat` = ".$row['id'].""), 0);
$msg = mysql_result(mysql_query("SELECT COUNT(*) FROM `forum_msg` WHERE `id_cat` = ".$row['id'].""), 0);
echo '<div class="menu"><li><a href="index.php?act=cat_view&id='.$row['id'].'">'.$row['name'].'</a> ('.$topics.'/'.$msg.')<br/></div>';
}
echo '</div>';
nav();
break;
case 'cat_view':
$id = intval($_REQUEST['id']);
$row = mysql_fetch_assoc(mysql_query("SELECT * FROM `forum_cats` WHERE `id` = '$id'"));
if(isset($row['id'])){
echo '<div class="phdr">'.$row['name'].'</div><div class="menu">';
$count = mysql_result(mysql_query("SELECT COUNT(*) FROM `forum_topics` WHERE `id_cat` = '$id'"), 0);
if($count > 0){
$pages = ceil($count/$config['onpage']);
$page = abs(intval(@$_REQUEST['page']));
if($page == 0) $page = 1;
$from = ($page-1)*$config['onpage'];
$result = mysql_query("SELECT * FROM `forum_topics` WHERE `id_cat` = '$id' ORDER BY `time` DESC LIMIT $from, ".$config['onpage']."");
while($row = mysql_fetch_assoc($result)){
$forum_msg = mysql_result(mysql_query("SELECT COUNT(`id`) FROM `forum_msg` WHERE `id` = '".$row['id']."'"), 0);
echo '<div class="menu"><li><a href="topic.php?id='.$row['id'].'">'.$row['title'].'</a>['.$forum_msg.'] '.$row['authour'].'<br/></div>';
}
}else{
echo ' ' .$lng ['not'] . ' <br/>';
}
echo '<br/><a href="posting.php?act=add_topic&id='.$id.'" class="button"> ' .$lng ['newt'] . ' </a></div>';
echo '</div><div class="phdr"></div><div class="bmenu">';
navig($page, 'index.php?act=cat_view&id='.$id.'&', $pages);
echo '<a href="./index.php"> ' .$lng ['forum'] . ' </a><br/><a href="../"> ' .$lng ['niz'] . ' </a></div>';
}else{
error(' ' .$lng ['ertr'] . ' !');
}
break;
}
require("../system/end.php");
?>