Файл: modules/forum/view/forum.php
Строк: 32
<?php
/* Мод "Форум"
* Версия v0.0.1
* Дата последнего редактирования 15.01.2015
* Двиг 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'; // Редактирование раздела.
}
if (isset($_SESSION['msg'])) {
echo $_SESSION['msg'];
unset($_SESSION['msg']);
}
if (user::access('forum_razd_create')) {
echo "<div class = 'razd'>";
echo "<a class = 'add' href = '" . DIR_FORUM . "$forum->id/create_razdel.html'>" . img16('plus.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 img16('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 "<div class = 'razd'>";
echo "<span style = 'float:right;'>";
echo "<a class = 'add'>$count_themes</a> ";
if (user::access('forum_razd_edit')) {
echo "<a class = 'add' href = '" . DIR_FORUM . "$forum->id/$razdel->id/edit_razdel.html'>" . img16('set.png') . "</a>";
}
echo "</span>";
echo img16('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 "<br />";
echo img16('folder-tree.png') . " <a href = '" . DIR_FORUM . "$forum->id/$razdel->id/$theme->id.html'>" . text::toOutput($theme->name, 1, 1, 0, 0, 0) . "</a>";
}
}
echo "</div>";
}
if ($k_page > 1) {
str('/modules/forum/' . $forum->id . '/', $k_page, $page);
}
}
}