Файл: forum/new_tems.php
Строк: 47
<?php
define('ROOT','../');
define('GCMS',true);
require_once (ROOT.'system/power.php');
if ($aut == true) {
$diz -> head('Новые темы');
$diz -> title("<a href='./'>Форум</a>/<b>Новые темы</b>");
$count = $db -> dbcount('COUNT(`id`)','forum_tems');
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` order by `uptime` DESC LIMIT ".$start.",".$num);
while ($assoc = $for -> 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();
$usmin = $db -> dbcount('min(`id`)','forum_posts','`tema`='.$assoc['id'].'');
$min = $db -> query("SELECT * FROM `forum_posts` where `id`='$usmin'")-> fetch_assoc();
$user = $db -> query("SELECT * FROM `users` where `id`='".$max['user']."' ")-> fetch_assoc();
$autor = $db -> query("SELECT * FROM `users` where `id`='".$min['user']."' ")-> fetch_assoc();
$cid = $db -> dbcount('COUNT(`id`)','forum_posts'," `tema` = '".$assoc['id']."'");
$tot = intval(($cid - 1) / $num) + 1;
echo '<div class="fon">'.$status.' <a href="tema'.$assoc['id'].'">'.$assoc['name'].'</a>('.$cid.')
<a href="tema.php?id='.$assoc['id'].'&page='.$tot.'">>></a><br/>
<a href="'.ROOT.'id'.$autor['id'].'">'.$autor['login'].'</a>
/<a href="'.ROOT.'id'.$user['id'].'">'.$user['login'].'</a>
('.$func -> times(date('d m Y H:i:s',$max['time'])).')</div>';
}
$act = 'new_tems.php?';
echo ''.$func -> pagenav($act,$page,$total).'';
}else echo '<div class="fon">Тем на форуме пока нет</div>';
}else header('location: /aut.php');
echo '<div class="levo"><a href="/index.php" class="levo_tuch">'.$diz -> img('home.png').' На главную</a></div>';
#####Копирайт#######
$diz -> out($msg);
?>