Файл: forum/razdel.php
Строк: 68
<?php
define('ROOT','../');
define('GCMS',true);
require_once (ROOT.'system/power.php');
//Бан на форуме
$ban = $db -> query("SELECT * FROM `ban` WHERE `iduser` = '".$ya['id']."' and `serius` = 'forum' LIMIT 1");
if ($ban -> num_rows > 0) {
header('location: '.ROOT.'ban.php?mode=forum');
}
if ($id) {
$type = $db -> query("SELECT `id`,`name`,`forum`,`lvl` FROM `forum_razdel` WHERE `id` = '".$id."'");
if ($type -> num_rows > 0) $the = $type -> fetch_assoc(); else $the = false;
} else $the = false;
//Выводим темы
$diz -> head($the['name']);
$f_name = $db -> dbcount('name','forums',"`id` = '".$the['forum']."'");
$diz -> title($the['name']);
if ($type -> num_rows > 0){
echo '<div class="fon">
<a href="'.ROOT.'forum/">Форум</a> /
<a href="forum.php?id='.$the['forum'].'">'.$f_name.'</a> /
<b>'.$the['name'].'</b>
</div>';
if ($aut and $ya['level']>=$the['lvl']) echo '<div class="levo"><a href="'.ROOT.'/forum/newtheme.php?id='.$id.'" class="levo_tuch">'.$diz -> img('fo.png').' Новая тема</a></div>';
$count = $db -> dbcount('COUNT(`id`)','forum_tems',"`razdel` = '".$id."'");
if ($count > 0) {
$num = isset($ya['num']) ? $ya['num'] : 10;
$total = intval(($count - 1) / $num) + 1;
if (!isset($_GET['page']) || !is_numeric($_GET['page']) || $_GET['page'] < 1 )
{
$page = 1;
} elseif($_GET['page'] > $total)
{ $page = $total;
} else $page = (int)$_GET['page'];
$start = $page * $num - $num;
////выводим темы
$for = $db -> query("SELECT * FROM `forum_tems` WHERE `razdel` = '".$id."' ORDER BY `var` desc,`uptime` DESC LIMIT ".$start.",".$num);
while ($assoc = $for -> fetch_assoc()) {
$p = $db -> query("SELECT * FROM `forum_posts` WHERE `tema` = '".$assoc['id']."'")-> fetch_assoc();
///проверяем статус темы
if($assoc['status']==0)$status =$diz -> img('r.png');else $status=$diz -> img('close.png');
if($assoc['var']==1)$sta =$diz -> img('zak.png');else $sta=null;
//////
$max = $db -> query("SELECT `user`,`time` FROM `forum_posts` where `tema`='".$assoc['id']."' order by `id` desc")-> fetch_assoc();
$cid = $db -> dbcount('COUNT(`id`)','forum_posts'," `tema` = '".$assoc['id']."'");
$tot = intval(($cid - 1) / $num) + 1;
echo '<table width="100%" cellpadding=0 cellspacing=0><tr valign="top">
<td width="95%">
<a href="tema'.$assoc['id'].'" class="mail">
'.$sta.' '.$status.' '.$assoc['name'].' <span class="count">'.$cid.'</span> <br/>
'.$func->famname($assoc['user'],0).'/'.$func->famname($max['user'],0).' '.$func -> vremja($max['time']).'</div>
</a></td>
<td><div class="menu"><a href="tema.php?id='.$assoc['id'].'&page='.$tot.'" class="menutuch">>></a></div></td>
</tr></table>';
}
$act = 'razdel.php?id='.$id;
echo ''.$func -> pagenav($act,$page,$total).'';
}else echo '<div class="fon">Нет созданных тем!</div>';
}else echo '<div class="fon">Раздел не существует!</div>';
if ($aut and $ya['level']>=$the['lvl']) echo '<div class="levo"><a href="'.ROOT.'/forum/newtheme.php?id='.$id.'" class="levo_tuch">'.$diz -> img('fo.png').' Новая тема</a></div>';
echo '<div class="levo"><a href="'.ROOT.'" class="levo_tuch">'.$diz -> img('home.png').' На главную</a></div>';
#####Копирайт#######
$diz -> out($msg);
?>