Файл: modules/forum/journal.php
Строк: 60
<?php
/* Мод "Форум"
* Версия v0.0.1
* Дата последнего редактирования 15.01.2015
* Двиг DCMS Special
* Модифицировал densnet
* Автор yadalay
* Файл journal.php
* Описание: журнал уведомлений
*/
require_once '../../sys/inc/start.php';
require_once H . 'sys/inc/compress.php';
require_once H . 'sys/inc/sess.php';
require_once H . 'sys/inc/settings.php';
require_once H . 'sys/inc/db_connect.php';
require_once H . 'sys/inc/ipua.php';
require_once H . 'sys/inc/fnc.php';
require_once H . 'sys/inc/user.php';
$set['title'] = 'Журнал форума';
require_once H . 'sys/inc/thead.php';
title();
aut();
user::only_reg();
if (!isset($_GET['all']) && !isset($_GET['new'])) {
header('Location: journal.php?new');
exit;
}
$isset = (isset($_GET['type'])) ? '?type=' . mysql_real_escape_string($_GET['type']) . '&' : '?';
$type = (isset($_GET['all'])) ? 'all' : 'new';
$read = (isset($_GET['all'])) ? NULL : 'AND `read` = "0"';
echo "<div class = 'razd'>";
if (isset($_GET['all'])) {
echo "<a href = 'journal.php{$isset}all' class = 'activ'>Все</a>";
echo "<a href = 'journal.php{$isset}new' class = 'noactiv'>Новые</a>";
}
if (isset($_GET['new'])) {
echo "<a href = 'journal.php{$isset}all' class = 'noactiv'>Все</a>";
echo "<a href = 'journal.php{$isset}new' class = 'activ'>Новые</a>";
}
echo "</div><div class = 'razd'>";
if (isset($_GET['type'])) {
echo "<a href = 'journal.php'>Все</a> | ";
} else {
echo "<b>Все</b> | ";
}
if (isset($_GET['type']) && $_GET['type'] == 'my_themes') {
echo "<a href = 'journal.php?type=my_themes&$type'>Мои темы</a> | ";
} else {
echo "<b>Мои темы</b> | ";
}
if (isset($_GET['type']) && $_GET['type'] == 'themes') {
echo "<a href = 'journal.php?type=themes&$type'>Темы</a> | ";
} else {
echo "<b>Темы</b> | ";
}
if (isset($_GET['type']) && $_GET['type'] == 'answers') {
echo "<a href = 'journal.php?type=answers&$type'>Ответы</a> | ";
} else {
echo "<b>Ответы</b> | ";
}
if (isset($_GET['type']) && $_GET['type'] == 'quotes') {
echo "<a href = 'journal.php?type=quotes&$type'>Цитаты</a> | ";
} else {
echo "<b>Цитаты</b> | ";
}
if (isset($_GET['type']) && $_GET['type'] == 'privat') {
echo "<a href = 'journal.php?type=privat&$type'>Приват</a>";
} else {
echo "<b>Приват</b>";
}
echo "</div>";
$type_j = (isset($_GET['type'])) ? '`type` = "' . mysql_real_escape_string($_GET['type']) . '" AND' : NULL;
$k_post = mysql_result(mysql_query('SELECT COUNT(*) FROM `f_journal` WHERE ' . $type_j . ' `id_user` = ' . $user['id'] . ' ' . $read), 0);
$k_page = k_page($k_post, $set['p_str']);
$page = page($k_page);
$start = $set['p_str'] * $page - $set['p_str'];
if ($k_post == 0) {
echo "<div class = 'errs'>";
echo img16('error.png') . " Нет результатов";
echo "</div>";
} else {
$js = mysql_query('SELECT * FROM `f_journal` WHERE ' . $type_j . ' `id_user` = ' . $user['id'] . ' ' . $read . ' ORDER BY `id` DESC LIMIT ' . $start . ', ' . $set['p_str']);
while ($j = mysql_fetch_object($js)) {
echo "<div class = 'razd'>";
echo text::toOutput($j->text) . "<br />";
echo "<b>Время отправки:</b> " . date::time($j->time);
echo "</div>";
}
if ($k_page > 1) {
str('journal.php' . $isset . $type, $k_page, $page);
}
if (isset($_GET['new'])) {
mysql_query('UPDATE `f_journal` SET `read` = "1" WHERE `id_user` = ' . $user['id']);
}
}
echo "<div class = 'razd'><a class = 'add' href = '/modules/forum/'>" . img16('left.png') . " Вернуться в форум</a></div>";
require_once H . 'sys/inc/tfoot.php';