Файл: action.php
Строк: 30
<?
include_once 'system/sys.php';
if(!$cms->us['id']){ header('location: /'); }
verh('Оповещения','Оповещения');
include 'system/funcs.php';
if(isSet($_GET['reset'])){
$ops = DB::$dbs->query("SELECT * FROM `action` where `us` = ?",array($cms->us['id']));
while($op = $ops->fetch()){
DB::$dbs->query("DELETE from `action` where `id` = ?",array($op['id']));
}
header('location: /action.php'); exit;
}
echo '<div class="list1"><a href="/action.php?reset">Очистка</a></div>';
$num = 10;
$posts = DB::$dbs->querySingle("SELECT count(id) FROM `action` where `us` = ?",array($cms->us['id']));
if($posts==0){echo'<div class="list1">Оповещений нет...</div>';}else{
$total = intval(($posts - 1) / $num) + 1;
$page = abs(intval($_GET['page']));
if(empty($page) or $page < 0) $page = 1;
if($page > $total) $page = $total;
$start = $page * $num - $num;
$ops = DB::$dbs->query("SELECT * FROM `action` where `us` = ? order by `id` desc limit $start,$num",array($cms->us['id']));
while($op = $ops -> fetch()){
if($op['see']==1){DB::$dbs->query("UPDATE `action` set `see` = ? where `id` = ? limit 1",array(0,$op['id']));}
echo'<div class="lst">'.$func->text($op['value']).' ['.t($op['t']).']'.($op['see']==1?'<font color="red"><b>[new!]</b></font>':NULL).'</div>';
}
echo '<div class="lst">';
$func->page('/action');
echo '</div>';
}
niz();
?>