<?php
define('ROOT','../');
define('GCMS',true);
require_once (ROOT.'system/power.php');
if ($aut == true) {
$diz -> head("Новые посты");
require_once (ROOT.'/new_mail.php');
$count = $db -> dbcount('COUNT(`id`)','forum_posts');
$diz -> title("<a href='./'>Форум</a>/<b>Новые посты</b>");
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_posts` ORDER BY `id` DESC LIMIT ".$start.",".$num);
while ($assoc = $for -> fetch_assoc()) {
$tname = $db -> dbcount('name','forum_tems',"`id` = '".$assoc['tema']."'");
$msg .= '<div class="top"><a href="tema'.$assoc['tema'].'">'.$tname.'</a> ('.$func -> times(date('d m Y H:i:s',$assoc['time'])).')'.$dop.'</div>';
$msg.='<div class="fon">'.$func -> smiles($func -> tags($assoc['text'])).'</div>';

}
$act = 'new_posts.php?';
$msg .= ''.$func -> pagenav($act,$page,$total).'';
} else {
$msg.='<div class="fon">Постов на форуме пока нет!</div>';
}
}else {header('location: ../aut.php');}
$msg .= '<div class="levo">'.$diz -> img('home.png').'<a href="/index.php">На главную</a></div>';
#####Копирайт#######
require_once (ROOT.'system/kopy.php');
$diz -> out($msg);
?>