Файл: modules/forum/view/forum.php
Строк: 40
<?php
/* Мод "Форум"
* Версия v0.0.1
* Дата последнего редактирования 27.11.2014
* Двиг DCMS Special
* Модифицировал densnet
* Автор yadalay
* Файл forum.php
* Описание: подфорумы
*/
$forum = mysql_fetch_object(mysql_query('SELECT * FROM `forum` WHERE `id` = ' . intval($_GET['forum'])));
if (!$forum || ($forum->access == 1 && $user['group_access'] < 8) || ($forum->access == 2 && $user['group_access'] < 3)) {
header('Location: ' . DIR_FORUM);
exit;
} else {
$set['title'] = (isset($_GET['create_razdel'])) ? text::toOutput($forum->name, 1, 1, 0, 0, 0) . ' - создание раздела' : 'Подфорум - ' . text::toOutput($forum->name, 1, 1, 0, 0, 0);
require_once H . 'sys/inc/thead.php';
title() . aut();
if (isset($_GET['create_razdel'])) {
require_once 'action/create_razdel.php'; // Создание раздела.
} elseif (isset($_GET['edit_razdel'])) {
require_once 'action/edit_razdel.php'; // Редактирование раздела.
} else {
#Навигация
echo "<div class = 'navigation'><a href = '/index.php'>Главная</a> > <a href = '" . DIR_FORUM . "'>Форум</a> > <b><a href = '/forum/$forum->id/'>" . text::toOutput($forum->name, 1, 1, 0, 0, 0) . "</a></b></div>";
}
if (isset($_SESSION['msg'])) {
echo $_SESSION['msg'];
unset($_SESSION['msg']);
}
if (user::access('forum_razd_create')) {
echo "<div class = 'razd'>";
echo "<a class = 'count' href = '" . DIR_FORUM . "$forum->id/create_razdel.html'>" . img('1.png') . " Создать раздел</a>";
echo "</div>";
}
$k_post = mysql_result(mysql_query('SELECT COUNT(*) FROM `forum_razdels` WHERE `id_forum` = ' . $forum->id), 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 {
$razdels = mysql_query('SELECT * FROM `forum_razdels` WHERE `id_forum` = ' . $forum->id . ' ORDER BY `number` ASC LIMIT ' . $start . ', ' . $set['p_str']);
while ($razdel = mysql_fetch_object($razdels)) {
$count_themes = mysql_result(mysql_query('SELECT COUNT(*) FROM `forum_themes` WHERE `id_razdel` = ' . $razdel->id), 0);
echo "<table class = 'razd'><tr><td class = 'null'>";
echo "<span style = 'float:right;'>";
echo "<a class = 'count'>$count_themes</a>";
if (user::access('forum_razd_edit')) {
echo "<a class = 'count' href = '" . DIR_FORUM . "$forum->id/$razdel->id/edit_razdel.html'>" . img('set.png') . "</a>";
}
echo "</span>";
echo img('folder.png') . " <a href = '" . DIR_FORUM . "$forum->id/$razdel->id/'>" . text::toOutput($razdel->name, 1, 1, 0, 0, 0) . "</a>";
if ($razdel->description != NULL && $razdel->output == 0) {
echo "<br /><small>" . text::toOutput($razdel->description, 1, 1, 0, 1, 1) . "</small>";
} elseif ($razdel->output == 1 && $count_themes > 0) {
$themes = mysql_query('SELECT `id`, `name`, `reason_close`, `type` FROM `forum_themes` WHERE `id_razdel` = ' . $razdel->id . ' ORDER BY `time` DESC LIMIT 3');
while ($theme = mysql_fetch_object($themes)) {
if ($theme->type == 1) {
$type = '_up';
} elseif ($theme->reason_close != NULL) {
$type = '_close';
} else {
$type = NULL;
}
echo img('folder-tree.png') . " <a href = '" . DIR_FORUM . "$forum->id/$razdel->id/$theme->id.html'>" . text::toOutput($theme->name, 1, 1, 0, 0, 0) . "</a><br />";
}
}
echo "</td></tr></table>";
}
if ($k_page > 1) {
str('/modules/forum/' . $forum->id . '/', $k_page, $page);
}
}
}