File size: 3.99Kb
<?
include_once $_SERVER['DOCUMENT_ROOT'] . '/sys/inc/home.php';
include_once H.'sys/inc/start.php';
include_once H.'sys/inc/compress.php';
include_once H.'sys/inc/sess.php';
include_once H.'sys/inc/settings.php';
include_once H.'sys/inc/db_connect.php';
include_once H.'sys/inc/ipua.php';
include_once H.'sys/inc/fnc.php';
include_once H.'sys/inc/user.php';
only_reg();
// Размер подарков при выводе в браузер
$width = ($webbrowser == 'web' ? '100' : '70');
if (isset($_GET['delete']) && $_GET['delete'] == 'all') {
if (isset($user)) {
query("DELETE FROM `notification` WHERE `id_user` = '$user[id]'");
$_SESSION['message'] = 'Уведомления очищены';
header('Location: ?');
exit;
}
}
if (isset($_GET['del'])) {
if (isset($user)) {
$id = (int) $_GET['del'];
if (mysql_result(query("SELECT COUNT(*) FROM `notification` WHERE `id_user` = '$user[id]' AND `id` = '$id'"),0) == 1) {
query("DELETE FROM `notification` WHERE `id_user` = '$user[id]' AND `id` = '$id' LIMIT 1");
$_SESSION['message'] = 'Уведомление удалено';
header('Location: ?page=' . $id);
exit;
}
}
}
$set['title'] = __('Уведомления');
include_once H.'sys/inc/thead.php';
?>
<link type="text/css" rel="stylesheet" href="/style/notifications.css?835">
<?
title();
aut();
$k_notif = mysql_result(query("SELECT COUNT(`read`) FROM `notification` WHERE `id_user` = '$user[id]' AND `read` = '0'"), 0);
if ($k_notif > 0)
$k_notif = '<em class="Tw1nGo7">' . $k_notif . '</em>';
else
$k_notif = null;
$discuss = mysql_result(query("SELECT COUNT(`count`) FROM `discussions` WHERE `id_user` = '$user[id]' AND `count` > '0' "), 0);
if ($discuss > 0)
$discuss = '<em class="Tw1nGo7">' . $discuss . '</em>';
else
$discuss = null;
$lenta = mysql_result(query("SELECT COUNT(`read`) FROM `tape` WHERE `id_user` = '$user[id]' AND `read` = '0' "), 0);
if ($lenta > 0)
$lenta = '<em class="Tw1nGo7">' . $lenta . '</em>';
else
$lenta = null;
?>
<div class="Tw1nGo1">
<div class="Tw1nGo2 Tw1nGo3">
<ul class="Tw1nGo4">
<li><a class="Tw1nGo5 al_tab" href="/user/tape/" data-header="Лента">Лента <?= $lenta?></a></li>
<li><a class="Tw1nGo5 al_tab" href="/user/discussions/" data-header="Обсуждения">Обсуждения <?= $discuss?></a></li>
<li><a class="Tw1nGo5 Tw1nGo6 al_tab" href="/user/notification/" data-header="Уведомления">Уведомления <?= $k_notif?></a></li>
</ul>
</div>
</div>
<div class="basisDefault">
<div class="basisDefault__row">
<div class="notificationList notificationList_type_viewed Tw1nGo8" data-id="viewed">
<?
$k_post = mysql_result(query("SELECT COUNT(*) FROM `notification` WHERE `id_user` = '$user[id]'"), 0);
if ($k_post > 0) {
?>
<div class="Pad__header Row">
<h3 class="Pad__title">Уведомлений: <b><?= $k_post?></b></h3>
<a class="Pad__corner" href="settings.php">Настройки</a>
</div>
<?
}
?>
<div class="Pad__content notificationList__items">
<?
$set['p_str'] = '10';
$k_page = k_page($k_post,$set['p_str']);
$page = page($k_page);
$start = $set['p_str'] * $page - $set['p_str'];
$q = query("SELECT * FROM `notification` WHERE `id_user` = '$user[id]' ORDER BY `time` DESC LIMIT $start, $set[p_str]");
if ($k_post == 0) {
?><div class='mess'><?= __('Нет новых уведомлений')?></div><?
}
while ($post = mysql_fetch_assoc($q)) {
$num++;
$type = $post['type'];
$avtor = user::get_user($post['avtor'], 1);
if (is_file('inc/' . $type . '.php')) {
require 'inc/' . $type . '.php';
} else {
echo __('К сожалению плагин уведомления не найден, пожалуйста сообщите об этом администрации.');
?>
<br />Error: <?= $type?>
<?
}
if ($post['read'] == 0) {
query("UPDATE `notification` SET `read` = '1' WHERE `id` = '$post[id]' LIMIT 1");
}
}
?>
</div>
</div></div>
</div>
<?
if ($k_page > 1) {
str('?', $k_page, $page);
}
include_once H.'sys/inc/tfoot.php';
?>