Файл: modules/forum/view/forum.php
Строк: 193
<?php
/* DCMS Special
* Дата последнего редактирования 15.12.2015
* Модифицировал densnet
* Автор yadalay
*/
$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'])) ? toOutput($forum->name, 1, 1, 0, 0, 0) . ' - Создание раздела' : 'Подфорум - ' . toOutput($forum->name, 1, 1, 0, 0, 0);
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 (isset($user)) {
$new_journal = '+' . mysql_result(mysql_query('SELECT COUNT(*) FROM `f_journal` WHERE `read` = "0" AND `id_user` = ' . $user['id']), 0) . "";
$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);
$reports = mysql_result(mysql_query('SELECT COUNT(*) FROM `forum_reports`'), 0);
#Навигация
echo "<ol class='breadcrumb'>";
echo "<li><a href='/'><span class='fa fa-home fa-fw'></span></a></li>";
echo "<li><a href='" . DIR_FORUM . "'>Форум</a></li>";
echo "<li class='active'>" . toOutput($forum->name, 1, 1, 0, 0, 0) . "</li>";
echo "</ol>";
echo "<div class='list-group-item' style='color: grey;'><div class='bd-example'><span style='float: right;'>n";
#Кнопка меню действий
if (IS_WEB) {
if (access('forum_for_create')) {
echo "<a data-toggle='modal' data-target='#add_razdel' href='/?users_set'><span data-toggle='tooltip' data-placement='left' title='Создать раздел'><span class='fa fa-plus fa-fw'></span></span></a>";
}
echo "<a data-toggle='modal' data-target='#menu_forum' href='/?users_set'><span style='padding: 10px;' data-toggle='tooltip' data-placement='left' title='Выберите действие'><span class='fa fa-ellipsis-v fa-lg'></span></span></a>";
} else {
if (access('forum_for_create')) {
echo "<a data-toggle='modal' data-target='#add_razdel' href='/?users_set'><span title='Создать раздел'><span class='fa fa-plus fa-fw'></span></span></a>";
}
echo "<a data-toggle='modal' data-target='#menu_forum' href='/?users_set'><span style='padding: 10px;' title='Выберите действие'><span class='fa fa-ellipsis-v fa-lg'></span></span></a>";
}
echo "</span></div>n";
echo "Разделы</div>n";
#Всплывающее меню
echo "<div class='modal fade' id='menu_forum' tabindex='-1' role='dialog' aria-labelledby='mySmallModalLabel' aria-hidden='true'>n";
echo "<div class='modal-dialog'>n";
echo "<div class='modal-content'>n";
echo "<div class='modal-header'>n";
echo "<button type='button' class='close' data-dismiss='modal' aria-label='Close'>";
echo "<span aria-hidden='true'>×</span>";
echo "<span class='sr-only'>Close</span>";
echo "</button>";
echo "<h5 class='modal-title' id='exampleModalLabel'>Меню форума</h5>";
echo "</div>";
echo "<div class='list-group' style='margin-top: -1px;'>";
echo "<a href='" . DIR_FORUM . "search.html' class='list-group-item'><span class='fa fa-search fa-fw'></span> Поиск</a>n";
echo "<a href='" . DIR_FORUM . "new_themes.html' class='list-group-item'><span class='fa fa-asterisk fa-fw'></span> Новые темы <span class='label label-info pull-right'>$new_themes</span></a>n";
if (isset($user)) {
echo "<a href='" . DIR_FORUM . "my_themes.html' class='list-group-item'><span class='fa fa-user fa-fw'></span> Мои темы <span class='label label-info pull-right'>$my_themes</span></a>n";
echo "<a href='" . DIR_FORUM . "journal.php' class='list-group-item'><span class='fa fa-bell fa-fw'></span> Уведомления <span class='label label-info pull-right'>$f_journal $new_journal</span></a>n";
}
if (access('forum_them_edit')) {
echo "<a href='" . DIR_FORUM . "reports.html' class='list-group-item'><span class='fa fa-flag fa-fw'></span> Жалобы на темы <span class='label label-info pull-right'>$reports</span></a>n";
}
echo "</div>n";
echo "</div>n";
echo "</div>n";
echo "</div>n";
echo "<div class='modal fade' id='add_razdel' tabindex='-1' role='dialog' aria-labelledby='mySmallModalLabel' aria-hidden='true'>n";
echo "<div class='modal-dialog'>n";
echo "<div class='modal-content'>n";
echo "<div class='modal-header'>n";
echo "<button type='button' class='close' data-dismiss='modal' aria-label='Close'>";
echo "<span aria-hidden='true'>×</span>";
echo "<span class='sr-only'>Close</span>";
echo "</button>";
echo "<h5 class='modal-title' id='exampleModalLabel'>Новый раздел</h5>";
echo "</div>";
if (access('forum_for_create')) {
$next_number = mysql_result(mysql_query('SELECT MAX(`number`) FROM `forum_razdels` WHERE `id_forum` = ' . $forum->id), 0) + 1;
echo "<form action='" . DIR_FORUM . "$forum->id/create_razdel.html' style='margin-top: -1px;' class='list-group-item' method='post'>";
echo "Название раздела (40 символов):<br />";
echo "<input type='text' class='form-control' name='name' value='' />";
echo "Описание раздела (100 символов):<br />";
echo "<textarea class='form-control' name='description'></textarea>";
echo "Позиция: <br />";
echo "<input type='text' class='form-control' name='number' value='$next_number' />";
echo "<div class='hr'></div>";
echo "Могут создавать темы только:<br />";
echo "<label class='c-input c-checkbox'><input type='checkbox' name='type' value='1' /><span class='c-indicator'></span> Администраторы + модераторы</label>";
echo "<div class='hr'></div>";
echo "Вывод раздела:<br />";
echo "<label class='c-input c-checkbox'><input type='checkbox' name='output' value='1' /><span class='c-indicator'></span> Отображать посл. 3 темы вместо описания</label>";
echo "<div class='hr'></div>";
echo "<button name='create' class='btn btn-success'>Создать</button> ";
echo "<button name='cancel' class='btn btn-secondary'>Отменить</button>";
echo "</form>";
}
echo "</div>n";
echo "</div>n";
echo "</div>n";
$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='list-group-item'>";
echo "<span class='fa fa-info-circle fa-fw'></span> Нет результатов";
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='list-group-item'>";
echo "<a href='" . DIR_FORUM . "$forum->id/$razdel->id/'><span class='fa fa-folder fa-fw'></span> " . toOutput($razdel->name, 1, 1, 0, 0, 0) . "</a> " . (access('forum_for_edit') ? "<a href='" . DIR_FORUM . "$forum->id/$razdel->id/edit_razdel.html' title='Редактировать' data-toggle='tooltip' data-placement='top'><span class='fa fa-pencil-square-o fa-fw'></span></a>" : null) . " <span class='label label-info pull-right'>$count_themes</span>";
if ($razdel->description != NULL && $razdel->output == 0) {
echo "<br /><small style='color: #9197a3;'>" . 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 /><a href='" . DIR_FORUM . "$forum->id/$razdel->id/$theme->id.html'> <span class='fa fa-file-text fa-fw'></span> " . toOutput($theme->name, 1, 1, 0, 0, 0) . "</a>";
}
}
echo "</div>";
}
if ($k_page > 1) {
echo "<div class='list-group-item'>";
str(DIR_FORUM . $forum->id . '/', $k_page, $page);
echo "</div>";
}
}
}