Файл: news/index.php
Строк: 46
<?php
define('ROOT','../');
define('GCMS',true);
require_once (ROOT.'system/power.php');
$diz -> head('Новости');
$diz -> title('Новости');
$db -> query("UPDATE `online` SET `online` = 'news' WHERE `session` = '".SID."'");
$count = $db -> dbcount('COUNT(`id`)','news');
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 '<div class="menu"><a href="./new'.$assoc['id'].'"><table width=100%>
<tr valign="top"><td width=5%>'.$func->avatar($assoc['user']).'</td>
<td>'.$assoc['name'].'<br/>'.$func->user($assoc['user']).' ('.$func -> vremja($assoc['time']).') </br>';
if ($assoc['temaonf'] > 0){
$pob = $db -> dbcount('COUNT(*)','forum_posts','`tema` = '.$assoc['temaonf'].'');
if ($pob==0)$pob=0;
else $pob=''.$pob;
echo '<a href="../forum/tema'.$assoc['temaonf'].'">Обсудить на форуме</a> ('.$pob.')';
}elseif($assoc['onf']==2){
$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);
?>