Файл: modules/forum/index.php
Строк: 113
<?php
/* Мод "Форум"
* Версия v0.0.1
* Дата последнего редактирования 27.11.2014
* Двиг DCMS Special
* Модифицировал densnet
* Автор yadalay
* Файл index.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';
mb_internal_encoding('UTF-8');
define('DIR_FORUM', '/modules/forum/');
$menu = (isset($_GET['menu'])) ? htmlspecialchars($_GET['menu']) : null;
switch ($menu) {
default:
$set['title'] = (isset($_GET['create_forum'])) ? 'Форум - создание подфорума' : 'Форум';
require_once H . 'sys/inc/thead.php';
title();
aut();
if (isset($_GET['create_forum'])) {
require_once 'action/create_forum.php'; // Создание подфорума.
} elseif (isset($_GET['edit_forum'])) {
require_once 'action/edit_forum.php'; // Редактирование подфорума.
}
if (isset($_SESSION['msg'])) {
echo $_SESSION['msg'];
unset($_SESSION['msg']);
}
#Навигация
echo "<div class = 'navigation'><a href = '/index.php'>Главная</a> > <b>Форум</b></div>";
echo "<div style = 'font-size: 18px;font-weight: bold;text-shadow: 0px 2px 2px #ffffff;color: #CCCCCC;' class = 'razd'>" . img('forum.png') . " Форум</div>";
$new_journal = ' <font color = "red">+' . mysql_result(mysql_query('SELECT COUNT(*) FROM `f_journal` WHERE `read` = "0" AND `id_user` = ' . $user['id']), 0) . "</font>";
$f_journal = mysql_result(mysql_query('SELECT COUNT(*) FROM `f_journal` WHERE `id_user` = ' . $user['id']), 0);
$new_themes = mysql_result(mysql_query('SELECT COUNT(*) FROM `forum_themes` WHERE `time` > ' . (time() - 60 * 60 * 24)), 0);
$my_themes = (isset($user)) ? mysql_result(mysql_query('SELECT COUNT(*) FROM `forum_themes` WHERE `id_user` = ' . $user['id']), 0) : NULL;
echo "<div class = 'razd'>";
echo img('zoom.png') . " <a href = '" . DIR_FORUM . "search.html'>Поиск по форуму</a><br />";
echo "</div><div class = 'razd'>";
echo "<span style = 'float:right;'><a class = 'count'>$new_themes</a></span>";
echo img('new.png') . " <a href = '" . DIR_FORUM . "new_themes.html'>Новые темы</a>";
echo "</div>";
if (isset($user)) {
echo "<div class = 'razd'>";
echo "<span style = 'float:right;'><a class = 'count'>$my_themes</a></span>";
echo img('users.png') . " <a href = '" . DIR_FORUM . "my_themes.html'>Мои темы</a>";
echo "</div>";
}
echo "<div class = 'razd'>";
echo "<span style = 'float:right;'><a class = 'count'>$f_journal$new_journal</a></span>";
echo img('book_spelling.png') . " <a href = '" . DIR_FORUM . "journal.php'>Уведомления</a>";
echo "</div>";
$k_post = mysql_result(mysql_query('SELECT COUNT(*) FROM `forum`'), 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 img('error.png') . " Нет результатов";
echo "</div>";
} else {
$forums = mysql_query('SELECT * FROM `forum` ORDER BY `number` ASC LIMIT ' . $start . ', ' . $set['p_str']);
while ($forum = mysql_fetch_object($forums)) {
if ($forum->access == 0 || ($forum->access == 1 && $user['group_access'] > 7) || ($forum->access == 2 && $user['group_access'] > 2)) {
$count_razdels = mysql_result(mysql_query('SELECT COUNT(*) FROM `forum_razdels` WHERE `id_forum` = ' . $forum->id), 0);
$count_themes = mysql_result(mysql_query('SELECT COUNT(*) FROM `forum_themes` WHERE `id_forum` = ' . $forum->id), 0);
echo "<table class = 'razd'><tr><td class = 'null'>";
echo "<span style = 'float:right;'>";
echo "<a class = 'count'>$count_razdels/$count_themes</a>";
if (user::access('forum_for_edit')) {
echo "<a class = 'count' href = '" . DIR_FORUM . "?edit_forum=$forum->id'>" . img('set.png') . "</a>";
}
echo "</span>";
echo img('folder.png') . " <a href = '" . DIR_FORUM . "$forum->id/'>" . text::toOutput($forum->name, 1, 1, 0, 0, 0) . "</a><br />";
if ($forum->description != NULL && $forum->output == 0) {
echo "<small>" . text::toOutput($forum->description, 1, 1, 0, 1, 1) . "</small>";
} elseif ($forum->output == 1 && $count_razdels > 0) {
$razdels = mysql_query('SELECT `id`, `name` FROM `forum_razdels` WHERE `id_forum` = ' . $forum->id);
while ($razdel = mysql_fetch_object($razdels)) {
echo img('folder-tree.png') . " <a href = '" . DIR_FORUM . "$forum->id/$razdel->id/'>" . text::toOutput($razdel->name) . "</a><br />";
}
}
echo "</td></tr></table>";
}
}
if ($k_page > 1) {
str('?', $k_page, $page);
}
}
if (user::access('forum_for_create')) {
echo "<div class = 'razd'>";
echo "<a class = 'count' href = '" . DIR_FORUM . "?create_forum'>" . img('1.png') . " Создать подфорум</a>";
echo "</div>";
}
break;
case 'forum':
require_once 'view/forum.php'; // Подфорум.
break;
case 'razdel':
require_once 'view/razdel.php'; // Раздел.
break;
case 'theme':
require_once 'view/theme.php'; // Тема.
break;
case 'who':
require_once 'view/who.php'; // Кто в теме.
break;
case 'files':
require_once 'view/files_theme.php'; // Файлы темы.
break;
case 'add_file':
require_once 'action/add_file_post.php'; // Добавление файла.
break;
case 'reports':
require_once 'view/reports.php'; // Жалобы на темы.
break;
case 'new_themes':
require_once 'view/new_themes.php'; // Новые темы.
break;
case 'my_themes':
require_once 'view/my_themes.php'; // Новые темы.
break;
case 'search':
require_once 'view/search.php'; // Поиск по форуму.
break;
}
require_once H . 'sys/inc/tfoot.php';