Файл: modules/forum/index.php
Строк: 94
<?php
/* Мод "Форум"
* Версия v0.0.1
* Дата последнего редактирования 14.01.2015
* Двиг 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']);
}
if (isset($user)) {
$new_journal = ' <font color = "Chartreuse">+' . 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);
$my_themes = (isset($user)) ? mysql_result(mysql_query('SELECT COUNT(*) FROM `forum_themes` WHERE `id_user` = ' . $user['id']), 0) : NULL;
}
$new_themes = mysql_result(mysql_query('SELECT COUNT(*) FROM `forum_themes` WHERE `time` > ' . (time() - 60 * 60 * 24)), 0);
echo "<div class = 'razd'>";
echo "<a href = '" . DIR_FORUM . "search.html' class = 'add'>".img16('search.png')." Поиск по форуму</a><br /><br />";
echo "<a href = '" . DIR_FORUM . "new_themes.html' class = 'add'>".img16('flag.png')." Новые темы</a> <a class = 'add'>$new_themes</a><br /><br />";
if (isset($user)) {
echo "<a href = '" . DIR_FORUM . "my_themes.html' class = 'add'>".img16('001.png')." Мои темы</a> <a class = 'add'>$my_themes</a><br /><br />";
echo "<a href = '" . DIR_FORUM . "journal.php' class = 'add'>".img16('not.png')." Уведомления</a> <a class = 'add'>$f_journal$new_journal</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 img16('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 = 'add'>$count_razdels/$count_themes</a> ";
if (user::access('forum_for_edit')) {
echo "<a class = 'add' href = '" . DIR_FORUM . "?edit_forum=$forum->id'>" . img16('set.png') . "</a>";
}
echo "</span>";
echo img16('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 = 'add' href = '" . DIR_FORUM . "?create_forum'>" . img16('plus.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';