Файл: user/notification.php
Строк: 167
<?php
require_once '../sys/inc/start.php';
require_once '../sys/inc/compress.php';
require_once '../sys/inc/sess.php';
require_once '../sys/inc/settings.php';
require_once '../sys/inc/db_connect.php';
require_once '../sys/inc/ipua.php';
require_once '../sys/inc/fnc.php';
require_once '../sys/inc/user.php';
only_reg();
$set['title'] = 'Уведомления';
require_once '../sys/inc/thead.php';
if (isset($_GET['delete']) && $_GET['delete'] == 'all') {
if (isset($user)) {
mysql_query("DELETE FROM `notification` WHERE `id_kont` = '$user[id]'");
header("Location: ?");
exit;
}
}
if (isset($_GET['del'])) {
if (isset($_GET['del']) && mysql_result(mysql_query("SELECT COUNT(*) FROM `notification` WHERE `id` = '" . intval($_GET['del']) . "'"), 0) == 1) {
$post = mysql_fetch_assoc(mysql_query("SELECT * FROM `notification` WHERE `id` = '" . intval($_GET['del']) . "' LIMIT 1"));
mysql_query("DELETE FROM `notification` WHERE `id` = '$post[id]'");
}
}
if (isset($_GET['settings'])) {
$tape_set = mysql_fetch_array(mysql_query("SELECT * FROM `notification_set` WHERE `id_user` = '" . $user['id'] . "' LIMIT 1"));
if (isset($_POST['save'])) {
if (isset($_POST['lenta_foto']) && ($_POST['lenta_foto'] == 0 || $_POST['lenta_foto'] == 1)) {
mysql_query("UPDATE `notification_set` SET `lenta_foto` = '" . intval($_POST['lenta_foto']) . "' WHERE `id_user` = '$user[id]'");
}
if (isset($_POST['lenta_avatar']) && ($_POST['lenta_avatar'] == 0 || $_POST['lenta_avatar'] == 1)) {
mysql_query("UPDATE `notification_set` SET `lenta_avatar` = '" . intval($_POST['lenta_avatar']) . "' WHERE `id_user` = '$user[id]'");
}
if (isset($_POST['lenta_friends']) && ($_POST['lenta_friends'] == 0 || $_POST['lenta_friends'] == 1)) {
mysql_query("UPDATE `notification_set` SET `lenta_friends` = '" . intval($_POST['lenta_friends']) . "' WHERE `id_user` = '$user[id]'");
}
if (isset($_POST['lenta_forum']) && ($_POST['lenta_forum'] == 0 || $_POST['lenta_forum'] == 1)) {
mysql_query("UPDATE `notification_set` SET `lenta_forum` = '" . intval($_POST['lenta_forum']) . "' WHERE `id_user` = '$user[id]'");
}
msg('Изменения успешно приняты');
header('Location: ?');
exit;
}
err();
aut();
echo "<form class = 'blok' action = '?' method = 'POST'>";
echo "Уведомления о новых друзьях<br />";
echo "<input name='lenta_friends' type='radio' " . ($tape_set['lenta_friends'] == 1 ? ' checked="checked"' : null) . " value='1' /> Да ";
echo "<input name='lenta_friends' type='radio' " . ($tape_set['lenta_friends'] == 0 ? ' checked="checked"' : null) . " value='0' /> Нет <br />";
echo "Уведомления о новых темах в форуме<br />";
echo "<input name='lenta_forum' type='radio' " . ($tape_set['lenta_forum'] == 1 ? ' checked="checked"' : null) . " value='1' /> Да ";
echo "<input name='lenta_forum' type='radio' " . ($tape_set['lenta_forum'] == 0 ? ' checked="checked"' : null) . " value='0' /> Нет <br />";
echo "Уведомления о новых фото<br />";
echo "<input name='lenta_foto' type='radio' " . ($tape_set['lenta_foto'] == 1 ? ' checked="checked"' : null) . " value='1' /> Да ";
echo "<input name='lenta_foto' type='radio' " . ($tape_set['lenta_foto'] == 0 ? ' checked="checked"' : null) . " value='0' /> Нет <br />";
echo "Уведомления о смене аватаров<br />";
echo "<input name='lenta_avatar' type='radio' " . ($tape_set['lenta_avatar'] == 1 ? ' checked="checked"' : null) . " value='1' /> Да ";
echo "<input name='lenta_avatar' type='radio' " . ($tape_set['lenta_avatar'] == 0 ? ' checked="checked"' : null) . " value='0' /> Нет <br />";
echo "<button class = 'btn' name = 'save'>";
echo "<img src = '/style/icons/save.png' /> Сохранить изменения";
echo "</button></form>";
echo "<a href = '?'><div class = 'blok'><img src = '/style/icons/left.png' /> Вернуться</div></a>";
require_once '../sys/inc/tfoot.php';
exit();
}
err();
aut();
$k_post = mysql_result(mysql_query("SELECT COUNT(*) FROM `notification` WHERE `id_kont` = '$user[id]' "), 0);
$k_page = k_page($k_post, $set['p_str']);
$page = page($k_page);
$start = $set['p_str'] * $page - $set['p_str'];
$q = mysql_query("SELECT * FROM `notification` WHERE `id_kont` = '$user[id]' ORDER BY `id` DESC LIMIT $start, $set[p_str]");
if ($k_post == 0) {
echo "<table class = 'blok'><tr><td class = 'null'>";
echo "<img src = '/style/icons/bullet_error.png' /> Нет результатов";
echo "</td></tr></table>";
}
while ($post = mysql_fetch_assoc($q)) {
$ank = get_user($post['id_user']);
if ($post['read'] == 0) {
mysql_query("UPDATE `notification_set` SET `read` = '1' WHERE `id` = '$post[id]'");
}
echo "<table class = 'razd'><tr><td class = 'icon14'>";
avatar($ank['id'], '30');
echo "</td><td class = 'null'>";
echo "<div class = 'right'><font color = 'grey'>" . vremja($post['time'])."</font></div>";
user($ank['id']);
echo "<br />";
echo "<div class = 'right' id = 'hide'>";
echo "<a href = 'tape_user_settings.php?id=$ank[id]' title = 'Настроить'><img src = '/style/icons/set.png' /></a>";
echo "<a href = '?del=$post[id]' title = 'Удалить'><img src = '/style/icons/cross.png' /></a>";
echo "</div>";
echo output_text($post['msg']);
echo "</td></tr></table>";
}
if ($k_page > 1) {
str("?id=$user[id]&", $k_page, $page);
}
if ($k_post == 0) {
echo "<div class = 'razd'>";
echo "<img src = '/style/icons/set.png' /> <a href = '?settings'>Настройки</a>";
echo "</div>";
} else {
echo "<div class = 'blok'>";
echo "<img src = '/style/icons/set.png' /> <a href = '?settings'>Настройки</a><br/>";
echo "<img src = '/style/icons/bin(2).png' /> <a href = '?page=$page&delete=all'>Очистить ленту</a>";
echo "</div>";
}
require_once '../sys/inc/tfoot.php';