Файл: moduls/notice.php
Строк: 29
<?php
include_once'../system/xcms_core.php';$title='Оповещения';
if($_COOKIE['style']=='web')require_once '../system/web_head.php'; else require_once '../system/head.php';
if($user){
    switch($act){
        case 'clear':
        if($_GET['yes']==1){
            $db->exec("delete from `notice` where `to`='$user[id]'");
            echo'<div class="menu">Уведомления почищены → <a href="/notice">Далее</a></div>';
        }else{
            echo'<div class="menu" style="text-align:center;"><b>Точно удалить?</b><br />
            <a href="/notice/clear/yes">ДА</a>|<a href="/notice">НЕТ</a></div>';
        }
        break;
        
        default:
        $total=$db->query("select `id` from `notice` where `to`='$user[id]'")->rowCount();
        if($total){
            echo'<div class="touch">
            <div class="menu" style="text-align:center;">
            <a href="/notice/clear">Очистка оповещений</a>
            </div>
            </div>';
            $k_page=k_page($total,$set['p_str']);$page=page($k_page);$start=$set['p_str']*$page-$set['p_str'];
            $sql=$db->query("select * from `notice` where `to`='$user[id]' order by `time` desc limit $start, $set[p_str]");
            while($res=$sql->fetch(PDO::FETCH_ASSOC)){
                $w=$db->query("select `avatar` from `user` where `id`='$res[user]'")->fetch(PDO::FETCH_ASSOC);
                echo '<div class="menu">'.avatar($w['avatar']).' '.clock($res['time']);
                if($res['status']==1){echo' <span style="color:red;">НОВОЕ</span>';$db->prepare("update `notice` set `status`='0' where `id`='$res[id]'")->execute();}
                echo'<br />'.$res['text'].'</div>';
            }
            if ($k_page>1){str('/notice/',$k_page,$page);}
        }else{echo'<div class="menu">У вас нет оповещений</div>';}
    }
}else{echo'<div class="menu">Авторизуйтесь, чтобы просматривать эту страницу</div>';}
if($_COOKIE['style']=='web')require_once '../system/web_foot.php'; else require_once '../system/foot.php';
?>