Файл: forum/razdel.php
Строк: 103
<?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('Форум');
$f_name = $db -> dbcount('name','forums',"`id` = '".$the['forum']."'");
$diz -> title("<a href='./'>Форум</a>/<a href='forum.php?id=$the[forum]'>".$f_name."</a>/<b>".$the['name']."</b>");
if ($type -> num_rows > 0){
if ($aut and $ya['level']>=$the['lvl']) echo '<div class="levo"><a href="newtheme.php?id='.$id.'" class="levo_tuch">Новая тема</a></div>';
$count = $db -> dbcount('COUNT(`id`)','forum_tems',"`razdel` = '".$id."' and `var`=0");
$countall = $db -> dbcount('COUNT(`id`)','forum_tems',"`razdel` = '".$id."'");
if ($countall > 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."' and `var`=1 ORDER BY `uptime` DESC");
while ($assoc = $for -> fetch_assoc()) {
$p = $db -> query("SELECT * FROM `forum_posts` WHERE `tema` = '".$assoc['id']."'")-> fetch_assoc();
$col = $db -> dbcount('COUNT(`id`)','golos',"`where`='forum' and `id_w` = '".$assoc['id']."'");
if($col>0){$st=$diz -> img('golos.png');}else{$st=null;}
if($assoc['status']==0){$status =''.$diz -> img('r.png').' '.$st.'';}
elseif($assoc['status']==1){$status=''.$sta.''.$diz -> img('close.png').''.$st.'';}
$usmax = $db -> dbcount('max(`id`)','forum_posts','`tema`='.$assoc['id'].'');
$max = $db -> query("SELECT * FROM `forum_posts` where `id`='$usmax'")-> fetch_assoc();
$user = $db -> query("SELECT * FROM `users` where `id`='".$max['user']."' ")-> 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%"><div class="menu"><a href="tema'.$assoc['id'].'" class="menutuch">'.$diz -> img('zak.png').' '.$status.' '.$assoc['name'].'<span class="count"/>'.$cid.'</span> <br/>
'.$func->nick($assoc['user'],0).'/'.$func->nick($user['id'],0).' '.$func -> vremja($max['time']).'</a></div></td>
<td><div class="menu"><a href="tema.php?id='.$assoc['id'].'&page='.$tot.'" class="menutuch">>></a></div></td>
</tr></table>';
}
$for = $db -> query("SELECT * FROM `forum_tems` WHERE `razdel` = '".$id."' and `var`=0 ORDER BY `uptime` DESC LIMIT ".$start.",".$num);
while ($assoc = $for -> fetch_assoc()) {
$p = $db -> query("SELECT * FROM `forum_posts` WHERE `tema` = '".$assoc['id']."'")-> fetch_assoc();
$col = $db -> dbcount('COUNT(`id`)','golos',"`where`='forum' and `id_w` = '".$assoc['id']."'");
if($col>0){$st=$diz -> img('golos.png');}else{$st=null;}
if($assoc['status']==0){$status =''.$diz -> img('r.png').' '.$st.'';}
if($assoc['var']==1){$sta =''.$diz -> img('zak.png').'';}
elseif($assoc['status']==1){$status=''.$sta.''.$diz -> img('close.png').''.$st.'';}
$usmax = $db -> dbcount('max(`id`)','forum_posts','`tema`='.$assoc['id'].'');
$max = $db -> query("SELECT * FROM `forum_posts` where `id`='$usmax'")-> fetch_assoc();
$user = $db -> query("SELECT * FROM `users` where `id`='".$max['user']."' ")-> 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%"><div class="menu"><a href="tema'.$assoc['id'].'" class="menutuch">'.$status.' '.$assoc['name'].'<span class="count"/>'.$cid.'</span> <br/>
'.$func->nick($assoc['user'],0).'/'.$func->nick($user['id'],0).' '.$func -> vremja($max['time']).'</a></div></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="newtheme.php?id='.$id.'" class="levo_tuch">Новая тема</a></div>';
require_once ('foot.php');
echo '<div class="levo"><a href="/index.php" class="levo_tuch">'.$diz -> img('home.png').' На главную</a></div>';
#####Копирайт#######
$diz -> out($msg);
?>