Файл: forum/section.php
Строк: 41
<?
require_once('../core/index.php');
require_once('../core/func.php');
avt();
$razd = $db->query("SELECT * FROM `section` WHERE `id`='".$_GET['id']."'")->fetch();
$title='Раздел - '.$razd['name'];
require_once('../design/head.php');
$count=$db->query("SELECT id FROM `them` where `section`='".$razd['id']."'")->rowCount();
if($count==0){echo '<div class="h1">Тем нет.</div>';}
require '../core/pagination.php';
$pagination = new Pagination;
$pagination->sett($count, 10, true);
$time_sort=$razd['id']==1 ? 'time' : 'time_ob';
$res = $db->query("SELECT * FROM `them` where `section`='".$razd['id']."' ORDER by `z` DESC, `".$time_sort."` DESC " . $pagination->limit());
foreach($res as $post){
echo '<div class="h2"><a class="link540" href=/forum/them/'.$post['id'].'>'.them($post['id']).' '.filter($post['name']).'</a></div>';
}
echo "<div class='pg'>";
echo $pagination->get();
echo "</div>";
if($razd['lvl']<=$user['admin']){echo '<div class="h2"><a class="link540" href=/forum/create/'.$razd['id'].'><img src="/design/ico/png/theme.png"> Создать тему</a></div>';}
echo '<div class="h2"> <a class="link540" href=/forum/><img src="/design/ico/png/left.png"> К разделам</a></div>';
require_once('../design/foot.php');
?>