Файл: 4mast/profmas.ru/data/jurnal/jurnal.index.php
Строк: 63
<?php
require_once('../../includes/Headers.php');
require_once('../../includes/PDO_func.php');
$o = DB :: $dbs -> querySingle ("SELECT COUNT(id) FROM `action` WHERE `us` = ? AND `razd` = ? AND `see` = ? ",array($us['id'],other,1));
$c = DB :: $dbs -> querySingle ("SELECT COUNT(id) FROM `action` WHERE `us` = ? AND `razd` = ? AND `see` = ?",array($us['id'],comm,1));
$r = DB :: $dbs -> querySingle ("SELECT COUNT(id) FROM `action` WHERE `us` = ? AND `razd` = ? AND `see` = ?",array($us['id'],rate,1));
$f = DB :: $dbs -> querySingle ("SELECT COUNT(id) FROM `action` WHERE `us` = ? AND `razd` = ? AND `see` = ? ",array($us['id'],forum,1));
$z = DB :: $dbs -> querySingle ("SELECT COUNT(id) FROM `action` WHERE `us` = ? AND `razd` = ? AND `see` = ?",array($us['id'],zc,1));
$a = DB :: $dbs -> querySingle ("SELECT COUNT(id) FROM `action` WHERE `us` = ? AND `razd` = ? AND `see` = ?",array($us['id'],adm,1));
switch($do){
case 'forum':
$dotitle = 'Форум';
$do = 'forum';
break;
case 'rate':
$dotitle = 'Рейтинг';
$do = 'rate';
break;
case 'comm':
$dotitle = 'Ответы';
$do = 'comm';
break;
case 'other':
$dotitle = 'Прочее';
$do = 'other';
break;
case 'bill':
$dotitle = 'Биллинг';
$do = 'bill';
break;
case 'zc':
$dotitle = 'Файлы';
$do = 'zc';
break;
case 'adm':
if($us['level']==2) {
header('location: /jurnal/forum/page1');
}
$dotitle = 'Прочее | Админ-журнал';
$do = 'adm';
break;
default:
header('location: /jurnal/forum/page1');
break;
}
$dot = (isset($dotitle) AND !empty($dotitle)) ? htmlspecialchars($dotitle) : false;
H('Журнал' , $dot);
if (isset ($_GET['reset'])) {
$query = DB :: $dbs -> query ("SELECT * FROM `action` WHERE (`us`='" . $us['id'] . "')");
while ($action = $query -> fetch()) {
DB :: $dbs -> query ("DELETE FROM `action` WHERE (`id`='" . $action['id'] . "')");
}
header ('location: /action.php');
exit;
}
echo '<div class="menu2">» '.($do == 'forum' ? 'Форум' : '<a href="/jurnal/forum/page1">Форум</a>').' <font color="red">'.($f>=1?'+'.$f.'':NULL).'</font> :: '.($do == 'comm' ? 'Ответы' : '<a href="/jurnal/comm/page1">Ответы</a>').' <font color="red"> '.($c>=1?'+'.$c.'':NULL).'</font> :: '.($do == 'rate' ? 'Рейтинг' : '<a href="/jurnal/rate/page1">Рейтинг</a>').' <font color="red">'.($r>=1?'+'.$r.'':NULL).'</font> :: '.($do == 'other' ? 'Прочее' : '<a href="/jurnal/other/page1">Прочее</a>').' <font color="red">'.($o>=1?'+'.$o.'':NULL).'</font> :: '.($do == 'zc' ? 'Файлы' : '<a href="/jurnal/zc/page1">Файлы</a>').' <font color="red">'.($z>=1?'+'.$z.'':NULL).'</font>';
if($us['level'] > 1){ echo ' :: '.($do == 'adm' ? 'Админ-журнал' : '<a href="/jurnal/adm/page1">Админ-журнал</a>').' <font color="red">'.($a>=1?'+'.$a.'':NULL).'</font>'; } echo ' </div>';
$items = DB :: $dbs -> querySingle ("SELECT COUNT(id) FROM `action` WHERE `us` = ? AND `razd` = ?",array($us['id'],$do));
$items_per_page = 10;
$pages = ceil ( $items / $items_per_page );
if ($page < 1) {
$page = 1;
}
if ($page > $pages) {
$page = $pages;
}
$start = $page * $items_per_page - $items_per_page;
if($items==0) {
echo '<div class="block">Оповещений нет..</div>';
}
else
{
$query = DB :: $dbs -> query ("SELECT * FROM `action` WHERE `us`= ? AND `razd` = ? ORDER BY `id` DESC LIMIT $start, $items_per_page",array($us['id'],$do));
while ($action = $query -> fetch()) {
echo '<div class="block">'.($action['see'] == 1 ? ' <b style="color:red;">' . datef ($action['t']) . ' </b> ':' ' . datef ($action['t']) . ' ').'</div>';
echo '<div class="lst">'.tag($action['value']).'</div>';
if ($action['see']==1) {DB :: $dbs -> query ("UPDATE `action` SET `see` = ? WHERE `id` = ? and `razd` = ? ",array(0,$action['id'],$do));}
}
if($items>10) page('/jurnal/'.$do);
}
echo '<div class="error"><a href="/jurnal/?reset">Очистка уведомлений</a></div>';
require_once('../../includes/Footers.php');
?>