Файл: modules/forum/view/razdel.php
Строк: 48
<?php
/* Мод "Форум"
* Версия v0.0.1
* Дата последнего редактирования 27.11.2014
* Двиг DCMS Special
* Модифицировал densnet
* Автор yadalay
* Файл razdel.php
* Описание: Выводит темы раздела
*/
$forum = mysql_fetch_object(mysql_query('SELECT * FROM `forum` WHERE `id` = ' . intval($_GET['forum'])));
$razdel = mysql_fetch_object(mysql_query('SELECT * FROM `forum_razdels` WHERE `id_forum` = ' . $forum->id . ' AND `id` = ' . intval($_GET['razdel'])));
if (!$razdel || !$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_theme'])) ? text::toOutput($razdel->name, 1, 1, 0, 0, 0) . ' - создание темы' : 'Раздел - ' . text::toOutput($razdel->name, 1, 1, 0, 0, 0);
require_once H . 'sys/inc/thead.php';
title() . aut();
if (isset($user) && isset($_GET['create_theme'])) {
require_once 'action/create_theme.php'; // Создание темы.
}
#Навигация
echo "<div class = 'navigation'><a href = '/index.php'>Главная</a> > <a href = '" . DIR_FORUM . "'>Форум</a> > <a href = '" . DIR_FORUM . "$forum->id/'>" . text::toOutput($forum->name, 1, 1, 0, 0, 0) . "</a> > <b><a href = '" . DIR_FORUM . "$forum->id/$razdel->id/'>" . text::toOutput($razdel->name, 1, 1, 0, 0, 0) . "</a></b></div>";
if (isset($_SESSION['msg'])) {
echo $_SESSION['msg'];
unset($_SESSION['msg']);
}
if (isset($user) && $razdel->type == 0 || ($razdel->type == 1) && $user['group_access'] > 2) {
echo "<div class = 'razd'>";
echo "<a class = 'count' href = '" . DIR_FORUM . "$forum->id/$razdel->id/create_theme.html'>" . img('1.png') . " Создать тему</a>";
echo "</div>";
}
$k_post = mysql_result(mysql_query('SELECT COUNT(*) FROM `forum_themes` WHERE `id_razdel` = ' . $razdel->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 {
$themes = mysql_query('SELECT * FROM `forum_themes` WHERE `id_razdel` = ' . $razdel->id . ' ORDER BY `type` DESC, `time_post` DESC LIMIT ' . $start . ', ' . $set['p_str']);
while ($theme = mysql_fetch_object($themes)) {
$creater = mysql_fetch_object(mysql_query('SELECT `id`, `nick` FROM `user` WHERE `id` = ' . $theme->id_user));
$count_posts = mysql_result(mysql_query('SELECT COUNT(*) FROM `forum_posts` WHERE `id_theme` = ' . $theme->id), 0);
$hide = (user::access('forum_post_ed')) ? NULL : '`hide` = "0" AND';
$last_post = mysql_fetch_object(mysql_query('SELECT `id`, `hide`, `id_user`, `time` FROM `forum_posts` WHERE ' . $hide . ' `id_theme` = ' . $theme->id . ' ORDER BY `id` DESC'));
if ($last_post && $last_post->id_user != 0) {
$who = mysql_fetch_object(mysql_query('SELECT `id`, `nick` FROM `user` WHERE `id` = ' . $last_post->id_user));
$who_id = $who->id;
$who_nick = $who->nick;
} elseif ($last_post && $last_post->id_user == 0) {
$who_id = 0;
$who_nick = 'Система';
}
if ($theme->reason_close != NULL) {
$type = '_close';
} elseif ($theme->type == 1) {
$type = '_up';
} else {
$type = NULL;
}
echo "<table class = 'razd'><tr><td class = 'null'>";
echo "<span style = 'float:right;'>";
echo "<a class = 'count'>" . img('comment_white.png') . " $count_posts</a>";
echo "</span>";
echo "<img src = '/style/img/theme$type.png' />";
echo "<a href = '" . DIR_FORUM . "$forum->id/$razdel->id/$theme->id.html'>" . text::toOutput($theme->name, 1, 1, 0, 0, 0) . "</a> (" . date::time($theme->time) . ")<br />";
if ($last_post) {
echo "<b>Автор: <a href = '/info.php?id=$theme->id_user'>$creater->nick</a> | Посл.:</b> <a href = '/info.php?id=$who_id'>$who_nick</a> (" . date::time($last_post->time) . ")";
} else {
$continue = (mb_strlen($theme->description) > 150) ? '...' : NULL;
echo text::toOutput(mb_substr($theme->description, 0, 150), 1, 1, 0, 1, 1) . $continue;
}
echo "</td></tr></table>";
}
if ($k_page > 1) {
str('/modules/forum/' . $forum->id . '/' . $razdel->id . '/', $k_page, $page);
}
}
}