Файл: news/index.php
Строк: 42
<?php
define('ROOT','../');
define('GCMS',true);
require_once (ROOT.'system/power.php');
$diz -> head('Новости');
$diz -> title('Новости');
$count = $db -> dbcount('COUNT(`id`)','news');
if($ya['level']>4)echo '<div class="levo"><a href="func.php?mode=new" class="levo_tuch">'.$diz -> img('news.png').' Добавить новость</a></div>';
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 `news` ORDER BY `id` DESC LIMIT ".$start.",".$num);
while ($assoc = $for -> fetch_assoc()) {
echo '<a href="./new'.$assoc['id'].'" class="mail"><table width=100%>
<tr valign="top"><td width=5%>'.$func->avatar($assoc['user']).'</td>
<td>'.$assoc['name'].'<br/>'.$func->famname($assoc['user']).' '.$func->online($assoc['user']).' ('.$func -> vremja($assoc['time']).') </br>';
$pob = $db -> dbcount('COUNT(*)','comes','`where`="news" and `idwh` = '.$assoc['id'].'');
echo '<a href="comments'.$assoc['id'].'">Комментарии</a> ('.$pob.')';
echo '</td></tr></table></a></div>';
}
$act = './?id='.$id;
echo ''.$func -> pagenav($act,$page,$total).'';
}else echo '<div class="fon">Новостей пока нет!</div>';
echo '<div class="levo"><a href="/" class="levo_tuch">'.$diz -> img('home.png').' На главную</a></div>';
#####Копирайт#######
$diz -> out($msg);
?>