Файл: modules/forum/journal.php
Строк: 143
<?php
/* DCMS Special
* Дата последнего редактирования 16.12.2015
* Модифицировал densnet
*/
foreach (array('start', 'compress', 'sess', 'settings', 'db_connect', 'ipua', 'fnc', 'user') as $inc) {
require_once "../../sys/inc/{$inc}.php";
}
$set['title'] = 'Журнал форума';
require_once H . 'sys/inc/thead.php';
aut() . only_reg();
if (!isset($_GET['all']) && !isset($_GET['new'])) {
header('Location: journal.php?new');
exit;
}
define('DIR_FORUM', '/modules/forum/');
$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"';
$new_j = mysql_result(mysql_query('SELECT COUNT(*) FROM `f_journal` WHERE `read` = "0" AND `id_user` = ' . $user['id']), 0) . "";
$new_n = mysql_result(mysql_query("SELECT COUNT(*) FROM `notification` WHERE `id_kont` = '$user[id]' AND `read` = '0'"), 0);
$new_ns = mysql_result(mysql_query("SELECT COUNT(*) FROM `notifications` WHERE `id_kont` = '$user[id]' AND `read` = '0'"), 0);
if ($new_j > 0) {
$new_j = '+' . mysql_result(mysql_query('SELECT COUNT(*) FROM `f_journal` WHERE `read` = "0" AND `id_user` = ' . $user['id']), 0);
} else {
$new_j = null;
}
if ($new_n > 0) {
$new_n = '+' . mysql_result(mysql_query("SELECT COUNT(*) FROM `notification` WHERE `id_kont` = '$user[id]' AND `read` = '0'"), 0);
} else {
$new_n = null;
}
if ($new_ns > 0) {
$new_ns = '+' . mysql_result(mysql_query("SELECT COUNT(*) FROM `notifications` WHERE `id_kont` = '$user[id]' AND `read` = '0'"), 0);
} else {
$new_ns = null;
}
#Навигация
echo "<nav class='navbar navbar-light' style='background-color: #607D8B; color: #fff;'>";
echo "<ul class='nav navbar-nav'>";
echo "<li class='nav-item' style='margin-left: 1px;'><a class='nav-link' href='/'><i class='material-icons'>home</i></a></li>";
echo "<li class='nav-item' style='margin-left: 1px;'><a class='nav-link'><i class='material-icons'>keyboard_arrow_right</i></a></li>";
echo "<li class='nav-item' style='margin-left: 1px;'><a class='nav-link' href='" . DIR_FORUM . "'>Форум</a></li>";
echo "<li class='nav-item' style='margin-left: 1px;'><a class='nav-link'><i class='material-icons'>keyboard_arrow_right</i></a></li>";
echo "<li class='nav-item' style='margin-left: 1px;'><a class='nav-link'>Уведомления</a></li>";
echo "</ul>";
echo "</nav>";
echo "<div class='card'>";
echo "<div class='card-header'>Уведомления</div>";
echo "<div class='card-block'>";
echo "<ul class='nav nav-tabs'>";
echo "<li class='nav-item'><a class='nav-link' href='/user/notification/'>Ответы $new_n</a></li>";
echo "<li class='nav-item'><a class='nav-link' href='/user/notification/index.php?act=feed'>Новости $new_ns</a></li>";
echo "<li class='nav-item'><a class='nav-link active'>Форум $new_j</a></li>";
echo "</ul>";
echo '</div>';
echo '<div class="card-block">';
if (isset($_GET['all'])) {
echo "<ul class='nav nav-pills'>";
echo "<li class='nav-item'><a class='nav-link active' href='journal.php{$isset}all'>Все</a></li>";
echo "<li class='nav-item'><a class='nav-link' href='journal.php{$isset}new'>Новые</a></li>";
echo "</ul>";
}
if (isset($_GET['new'])) {
echo "<ul class='nav nav-pills'>";
echo "<li class='nav-item'><a class='nav-link' href='journal.php{$isset}all'>Все</a></li>";
echo "<li class='nav-item'><a class='nav-link active' href='journal.php{$isset}new'>Новые</a></li>";
echo "</ul>";
}
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='card-block'>";
echo "<i class='fa fa-info-circle fa-fw'></i> Нет результатов";
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='list-group-item' style='margin: -1px;'>";
echo toOutput($j->text) . "<br />";
echo date::times($j->time);
echo "</div>";
}
if ($k_page > 1) {
echo "<div class='card-block'>";
str('journal.php' . $isset . $type, $k_page, $page);
echo "</div>";
}
if (isset($_GET['new'])) {
mysql_query('UPDATE `f_journal` SET `read` = "1" WHERE `id_user` = ' . $user['id']);
}
}
echo "</div>";
require_once H . 'sys/inc/tfoot.php';