Файл: modules/forum/view/theme.php
Строк: 617
<?php
/* DCMS Special
* Дата последнего редактирования 12.12.2015
* Модифицировал densnet
* Автор yadalay
*/
$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'])));
$theme = mysql_fetch_object(mysql_query('SELECT * FROM `forum_themes` WHERE `id_razdel` = ' . $razdel->id . ' AND `id` = ' . intval($_GET['theme'])));
if (!$theme || !$razdel || !$forum || ($forum->access == 1 && $user['group_access'] < 8) || ($forum->access == 2 && $user['group_access'] < 3)) {
header('Location: ' . DIR_FORUM);
exit;
} else {
$set['title'] = 'Тема - ' . toOutput($theme->name, 1, 1, 0, 0, 0);
$my_report = (isset($user)) ? mysql_result(mysql_query('SELECT COUNT(*) FROM `forum_reports` WHERE `id_theme` = ' . $theme->id . ' AND `id_user` = ' . $user['id']), 0) : 0;
$k_post = mysql_result(mysql_query('SELECT COUNT(*) FROM `forum_posts` WHERE `id_theme` = ' . $theme->id), 0);
if (mysql_result(mysql_query('SELECT COUNT(*) FROM `forum_votes` WHERE `id_theme` = ' . $theme->id), 0) != 0) {
$vote = mysql_fetch_object(mysql_query('SELECT * FROM `forum_votes` WHERE `id_theme` = ' . $theme->id));
$vars = mysql_result(mysql_query('SELECT COUNT(*) FROM `forum_votes_var` WHERE `id_theme` = ' . $theme->id), 0);
} else {
$vars = NULL;
}
if (isset($_GET['sort_0'])) {
unset($_SESSION['sort_' . $user['id']]);
header('Location: ' . DIR_FORUM . $forum->id . '/' . $razdel->id . '/' . $theme->id . '.html');
exit;
} elseif (isset($_GET['sort_1'])) {
$_SESSION['sort_' . $user['id']] = 1;
header('Location: ' . DIR_FORUM . $forum->id . '/' . $razdel->id . '/' . $theme->id . '.html');
exit;
} elseif (isset($_GET['download'])) {
$file = mysql_fetch_object(mysql_query('SELECT `id`, `id_post`, `name`, `count_downloads` FROM `forum_post_files` WHERE `id` = ' . intval($_GET['download'])));
$this_post = mysql_fetch_object(mysql_query('SELECT `hide`, `privat` FROM `forum_posts` WHERE `id` = ' . $file->id_post));
if ($this_post->privat == 0 || ($this_post->privat == $user['id'] || $this_post->id_user == $user['id']) || ($this_post->hide != 0 && access('forum_post_ed'))) {
mysql_query('UPDATE `forum_post_files` SET `count_downloads` = ' . ($file->count_downloads + 1) . ' WHERE `id` = ' . $file->id);
header('Location: ' . DIR_FORUM_FILES . $file->name);
} else {
header('Location: ' . DIR_FORUM . $forum->id . '/' . $razdel->id . '/' . $theme->id . '.html');
}
exit;
} elseif (isset($user) && isset($_GET['cleare_theme']) && access('forum_them_edit')) {
require_once 'action/clear_theme.php'; #Очистка темы.
} elseif (isset($user) && isset($_GET['edit_theme'])) {
require_once 'action/edit_theme.php'; #Редактирование темы.
} elseif (isset($user) && isset($_GET['close_theme']) && $theme->reason_close == NULL && access('forum_them_edit')) {
require_once 'action/close_theme.php'; #Закрытие темы.
} elseif (isset($user) && isset($_GET['open_theme']) && $theme->reason_close != NULL && access('forum_them_edit')) {
$_SESSION['success'] = "<div class='alert alert-success'>Тема успешно открыта.</div>";
$msg_sys = "Проблема решена. [url=/info.php?id=$user[id]]$user[nick][/url] " . ($user['sex'] ? 'открыл' : 'открыла') . " тему.";
mysql_query('INSERT INTO `forum_posts` SET `id_theme` = ' . $theme->id . ', `id_user` = "0", `id_admin` = "0", `text` = "' . mysql_real_escape_string($msg_sys) . '", `time` = ' . $time);
mysql_query('UPDATE `forum_themes` SET `reason_close` = "" WHERE `id` = ' . $theme->id);
header('Location: ' . DIR_FORUM . $forum->id . '/' . $razdel->id . '/' . $theme->id . '.html');
exit;
} elseif (isset($user) && isset($_GET['create_vote']) && ($theme->reason_close == NULL || ($theme->reason_close != NULL && access('forum_post_close'))) && $user['id'] == $theme->id_user) {
require_once 'action/create_vote.php'; #Создание голосования.
} elseif (isset($user) && isset($_GET['edit_vote']) && $theme->reason_close == NULL && $user['id'] == $theme->id_user) {
require_once 'action/edit_vote.php'; #Редактирование голосования.
} elseif (isset($user) && isset($_GET['report'])) {
if ($my_report != 0 || access('forum_them_edit') || $user['id'] == $theme->id_user || $theme->reason_close != NULL) {
header('Location: ' . DIR_FORUM . $forum->id . '/' . $razdel->id . '/' . $theme->id . '.html');
exit;
} else {
if (isset($_POST['send'])) {
$text = mysql_real_escape_string(trim($_POST['text']));
if (mb_strlen($text) < 5) {
echo "<div class='alert alert-danger'>Слишком короткая причина. Указывайте нормальную причину, если не хотите быть забаненым администрацией.</div>";
} else {
$persons = mysql_query('SELECT `id`, `group_access` FROM `user` WHERE `group_access` > "2"');
while ($person = mysql_fetch_object($persons)) {
$access = mysql_result(mysql_query('SELECT COUNT(*) FROM `user_group_access` WHERE `id_group` = ' . $person->group_access . ' AND `id_access` = "forum_them_edit"'), 0);
if ($access != 0) {
$msg = "[url=/info.php?id=$user[id]]$user[nick][/url] " . ($user['sex'] ? 'подал' : 'подала') . " жалобу на тему [url=" . DIR_FORUM . "$forum->id/$razdel->id/$theme->id.html]$theme->name[/url].
Причина указана [url=" . DIR_FORUM . "reports.html]здесь[/url]";
mysql_query('INSERT INTO `mail` SET `id_user` = "0", `id_kont` = ' . $person->id . ', `msg` = "' . mysql_real_escape_string($msg) . '", `time` = ' . $time);
}
}
mysql_query('INSERT INTO `forum_reports` SET `id_theme` = ' . $theme->id . ', `id_user` = ' . $user['id'] . ', `text` = "' . $text . '"');
$_SESSION['success'] = "<div class='alert alert-success'>Жалоба успешно отправлена на рассмотрение администрацией.</div>";
header('Location: ' . DIR_FORUM . $forum->id . '/' . $razdel->id . '/' . $theme->id . '.html');
exit;
}
}
#Навигация
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><a href='" . DIR_FORUM . "$forum->id/'>" . toOutput($forum->name, 1, 1, 0, 0, 0) . "</a></li>";
echo "<li><a href='" . DIR_FORUM . "$forum->id/$razdel->id/'>" . toOutput($razdel->name, 1, 1, 0, 0, 0) . "</a></li>";
echo "<li><a href='" . DIR_FORUM . "$forum->id/$razdel->id/$theme->id.html'>" . toOutput($theme->name, 1, 0, 0, 0, 0) . "</a></li>";
echo "<li class='active'>Жалоба</li>";
echo "</ol>";
echo "<form method='post' class='list-group-item' action='" . DIR_FORUM . "$forum->id/$razdel->id/$theme->id/report.html'>";
echo "Укажите причину:<br />";
echo "<textarea name='text' class='form-control' rows='2'></textarea><br />";
echo "<button class='btn btn-success' name='send'><span class='fa fa-flag fa-fw'></span> Отправить</button>";
echo "</form>";
require_once H . 'sys/inc/tfoot.php';
exit;
}
}
$my_voice = (isset($vote) && isset($user)) ? mysql_result(mysql_query('SELECT COUNT(*) FROM `forum_vote_voices` WHERE `id_user` = ' . $user['id'] . ' AND `id_vote` = ' . $vote->id), 0) : NULL;
if (isset($user)) {
$last_post = mysql_result(mysql_query('SELECT MAX(`id`) FROM `forum_posts` WHERE `id_theme` = ' . $theme->id), 0);
if (isset($_GET['delete_post']) && access('forum_post_ed')) {
$_SESSION['success'] = "<div class='alert alert-success'>Комментарий успешно удалён.</div>";
$files = mysql_query('SELECT `name` FROM `forum_post_files` WHERE `id_post` = ' . intval($_GET['delete_post']));
while ($file = mysql_fetch_object($files)) {
unlink(DIR_FORUM_FILES . $file->name);
}
mysql_query('DELETE FROM `forum_post_rating` WHERE `id_post` = ' . intval($_GET['delete_post']));
mysql_query('DELETE FROM `forum_posts` WHERE `id` = ' . intval($_GET['delete_post']));
if ($k_post == 0) {
mysql_query('UPDATE `forum_themes` SET `time_post` = ' . $theme->time . ' WHERE `id` = ' . $theme->id);
}
header('Location: ' . DIR_FORUM . $forum->id . '/' . $razdel->id . '/' . $theme->id . '.html');
exit;
} elseif (isset($_GET['hide']) && access('forum_post_ed')) {
$_SESSION['success'] = "<div class='alert alert-success'>Комментарий успешно скрыт.</div>";
mysql_query('UPDATE `forum_posts` SET `id_admin` = ' . $user['id'] . ', `hide` = "1" WHERE `id` = ' . intval($_GET['hide']));
header('Location: ' . DIR_FORUM . $forum->id . '/' . $razdel->id . '/' . $theme->id . '.html');
exit;
} elseif (isset($_GET['display']) && access('forum_post_ed')) {
$_SESSION['success'] = "<div class='alert alert-success'>Комментарий успешно показан вновь.</div>";
mysql_query('UPDATE `forum_posts` SET `id_admin` = "0", `hide` = "0" WHERE `id` = ' . intval($_GET['display']));
header('Location: ' . DIR_FORUM . $forum->id . '/' . $razdel->id . '/' . $theme->id . '.html');
exit;
} elseif (isset($_GET['vote']) && $my_voice == 0) {
$_SESSION['success'] = "<div class='alert alert-success'>Ваш голос успешно учтён.</div>";
mysql_query('INSERT INTO `forum_vote_voices` SET `id_vote` = ' . $vote->id . ', `id_variant` = ' . intval($_GET['vote']) . ', `id_user` = ' . $user['id']);
header('Location: ' . DIR_FORUM . $forum->id . '/' . $razdel->id . '/' . $theme->id . '.html');
exit;
} elseif (isset($_GET['del_file']) && (mysql_fetch_object(mysql_query('SELECT `id_user` FROM `forum_post_files` WHERE `id` = ' . intval($_GET['del_file'])))->id_user == $user['id'] || access('forum_post_ed'))) {
$_SESSION['success'] = "<div class='alert alert-success'>Файл успешно удалён.</div>";
$file = mysql_fetch_object(mysql_query('SELECT `id`, `id_post`, `name` FROM `forum_post_files` WHERE `id` = ' . intval($_GET['del_file'])));
unlink(DIR_FORUM_FILES . $file->name);
$id_post = $file->id_post;
unset($_SESSION['sort_' . $user['id']]);
$count = mysql_result(mysql_query('SELECT COUNT(*) FROM `forum_posts` WHERE `id_theme` = ' . $theme->id . ' AND `id` < ' . ($id_post + 1)), 0);
$count_posts = mysql_result(mysql_query('SELECT COUNT(*) FROM `forum_posts` WHERE `id_theme` = ' . $theme->id), 0);
$this_pages = k_page($count, $set['p_str']);
$pages = ($this_pages > 0) ? '/page=' . $this_pages : '.html';
mysql_query('DELETE FROM `forum_post_files` WHERE `id` = ' . $file->id);
header('Location: ' . DIR_FORUM . $forum->id . '/' . $razdel->id . '/' . $theme->id . $pages . '#' . $id_post);
exit;
}
if (isset($_POST['comment']) && ($theme->reason_close == NULL || ($theme->reason_close != NULL && access('forum_post_close')))) {
$text = mysql_real_escape_string($_POST['text']);
$mat = antimat($text);
if ($mat) {
echo "<div class='alert alert-danger'>В тексте сообщения обнаружен мат: $mat.</div>";
} elseif (mb_strlen($text) < 2) {
echo "<div class='alert alert-danger'>Комментарий слишком короткий.</div>";
} elseif (mysql_result(mysql_query('SELECT COUNT(*) FROM `forum_posts` WHERE `id_user` = ' . $user['id'] . ' AND `text` = "' . $text . '"'), 0) != 0) {
echo "<div class='alert alert-danger'>Вы уже писали это в данной теме. Будьте оригинальнее.</div>";
} else {
if (isset($_GET['cit']) && is_numeric($_GET['cit'])) {
$cit = intval($_GET['cit']);
$privat = 0;
} elseif (isset($_GET['privat']) && is_numeric($_GET['privat'])) {
$privat = intval($_GET['privat']);
$cit = 0;
} else {
$cit = 0;
$privat = 0;
}
mysql_query('UPDATE `forum_themes` SET `time_post` = ' . $time . ' WHERE `id` = ' . $theme->id);
mysql_query('INSERT INTO `forum_posts` SET `id_theme` = ' . $theme->id . ', `id_user` = ' . $user['id'] . ', `id_admin` = "0", `text` = "' . $text . '", `cit` = ' . $cit . ', `privat` = ' . $privat . ', `time` = "' . $time . '", `hide` = "0"');
$post_id = mysql_insert_id();
$count = mysql_result(mysql_query('SELECT COUNT(*) FROM `forum_posts` WHERE `id_theme` = ' . $theme->id . ' AND `id` < ' . ($post_id + 1)), 0);
$count_posts = mysql_result(mysql_query('SELECT COUNT(*) FROM `forum_posts` WHERE `id_theme` = ' . $theme->id), 0);
$this_pages = k_page($count, $set['p_str']);
$pages = ($this_pages > 0) ? '/page=' . $this_pages : '.html';
$j_f = '[url=/info.php?id=' . $user['id'] . ']' . $user['nick'] . '[/url] ' . ($user['sex'] ? "написал" : "написала") . ' в теме "[url=' . DIR_FORUM . $forum->id . '/' . $razdel->id . '/' . $theme->id . $pages . '#' . $post_id . ']' . $theme->name . '[/url]", на которую Вы подписаны.
Комментарий: [b]' . $text . '[/b]';
$forum_js = mysql_query('SELECT `id_user` FROM `forum_journal` WHERE `id_theme` = ' . $theme->id);
while ($forum_j = mysql_fetch_object($forum_js)) {
if (mysql_result(mysql_query('SELECT COUNT(*) FROM `forum_posts` WHERE `id` = ' . $post_id . ' AND `id_user` = ' . $user['id']), 0) == 0 && ((isset($_GET['answer']) && $_GET['answer'] != $forum_j->id_user) || !isset($_GET['answer']))) {
mysql_query('INSERT INTO `f_journal` SET `id_user` = ' . $forum_j->id_user . ', `type` = "themes", `text` = "' . mysql_real_escape_string($j_f) . '", `time` = "' . $time . '"');
}
}
if (!isset($_GET['cit']) && !isset($_GET['privat']) && isset($_GET['answer'])) {
$j = '[url=/info.php?id=' . $user['id'] . ']' . $user['nick'] . '[/url] ' . ($user['sex'] ? "ответил" : "ответила") . ' Вам в теме "[url=' . DIR_FORUM . $forum->id . '/' . $razdel->id . '/' . $theme->id . $pages . '#' . $post_id . ']' . $theme->name . '[/url]".
Ответ: [b]' . $text . '[/b]';
$type = 'answers';
} elseif (isset($_GET['cit']) && isset($_GET['answer'])) {
$j = '[url=/info.php?id=' . $user['id'] . ']' . $user['nick'] . '[/url] ' . ($user['sex'] ? "процитировал" : "процитировала") . ' Ваш комментарий в теме [url=' . DIR_FORUM . $forum->id . '/' . $razdel->id . '/' . $theme->id . $pages . '#' . $post_id . ']' . $theme->name . '[/url].
Цитата: [b]' . $text . '[/b]';
$type = 'quotes';
} elseif (isset($_GET['privat'])) {
$j = '[url=/info.php?id=' . $user['id'] . ']' . $user['nick'] . '[/url] ' . ($user['sex'] ? "оставил" : "оставила") . ' Вам приватное сообщение в теме [url=' . DIR_FORUM . $forum->id . '/' . $razdel->id . '/' . $theme->id . $pages . '#' . $post_id . ']' . $theme->name . '[/url].
Сообщение: [b]' . $text . '[/b]';
$type = 'privat';
}
if (isset($user) && $user['id'] != $theme->id_user && !isset($_GET['answer']) && !isset($_GET['cit']) && !isset($_GET['privat'])) {
$j_t = '[url=/info.php?id=' . $user['id'] . ']' . $user['nick'] . '[/url] ' . ($user['sex'] ? "написал" : "написала") . ' комментарий в Вашей теме "[url=' . DIR_FORUM . $forum->id . '/' . $razdel->id . '/' . $theme->id . $pages . '#' . $post_id . ']' . $theme->name . '[/url]".
Комментарий: [b]' . $text . '[/b]';
mysql_query('INSERT INTO `f_journal` SET `id_user` = ' . $theme->id_user . ', `type` = "my_themes", `text` = "' . mysql_real_escape_string($j_t) . '", `time` = "' . $time . '"');
}
if (isset($_GET['answer'])) {
mysql_query('INSERT INTO `f_journal` SET `id_user` = ' . intval($_GET['answer']) . ', `type` = "' . mysql_real_escape_string($type) . '", `text` = "' . mysql_real_escape_string($j) . '", `time` = "' . $time . '"');
} elseif (isset($_GET['privat'])) {
mysql_query('INSERT INTO `f_journal` SET `id_user` = ' . intval($_GET['privat']) . ', `type` = "' . mysql_real_escape_string($type) . '", `text` = "' . mysql_real_escape_string($j) . '", `time` = "' . $time . '"');
}
$_SESSION['success'] = "<div class='alert alert-success'>Сообщение успешно добавлено.</div>";
$post = mysql_fetch_object(mysql_query('SELECT `id` FROM `forum_posts` WHERE `id` = ' . $post_id));
if (isset($_POST['add_file']) && $post) {
header('Location: ' . DIR_FORUM . $forum->id . '/' . $razdel->id . '/' . $theme->id . '/' . $post->id . '/add_file');
} else {
header('Location: ' . DIR_FORUM . $forum->id . '/' . $razdel->id . '/' . $theme->id . '.html');
}
exit;
}
} elseif (isset($user) && isset($_POST['edit_post'])) {
$edit_post = mysql_real_escape_string(trim($_POST['post']));
$post_edit = mysql_fetch_object(mysql_query('SELECT `count_edit` FROM `forum_posts` WHERE `id` = ' . intval($_POST['id_post'])));
mysql_query('UPDATE `forum_posts` SET `text` = "' . $edit_post . '", `last_edit` = ' . $time . ', `who_edit` = "' . $user['nick'] . '", `count_edit` = ' . ($post_edit->count_edit + 1) . ' WHERE `id` = ' . intval($_POST['id_post']));
header('Location: ' . DIR_FORUM . $forum->id . '/' . $razdel->id . '/' . $theme->id . '.html#' . intval($_POST['id_post']));
exit;
} elseif (isset($_POST['cancel_edit'])) {
header('Location: ' . DIR_FORUM . $forum->id . '/' . $razdel->id . '/' . $theme->id . '.html');
exit;
} elseif (isset($user) && isset($_GET['act_posts']) && (isset($_POST['delete_posts']) || isset($_POST['hide_posts']) || isset($_POST['display_posts']))) {
include_once 'action/actions_posts.php'; #Действия над постами.
}
}
if (isset($user) && isset($vote) && mysql_result(mysql_query('SELECT COUNT(*) FROM `forum_votes_var` WHERE `variant` = "" AND `id_vote` = ' . $vote->id), 0) != 0) {
mysql_query('DELETE FROM `forum_votes_var` WHERE `id_vote` = ' . $vote->id);
mysql_query('DELETE FROM `forum_votes` WHERE `id` = ' . $vote->id);
header('Location: ' . DIR_FORUM . $forum->id . '/' . $razdel->id . '/' . $theme->id . '.html');
exit;
}
if (isset($user) && isset($_GET['journal_yes'])) {
if (mysql_result(mysql_query('SELECT COUNT(*) FROM `forum_journal` WHERE `id_theme` = ' . $theme->id . ' AND `id_user` = ' . $user['id']), 0) == 0) {
mysql_query('INSERT INTO `forum_journal` SET `id_theme` = ' . $theme->id . ', `id_user` = ' . $user['id']);
$_SESSION['success'] = "<div class='alert alert-success'>Вы успешно подписались на эту тему.</div>";
}
header('Location: ' . DIR_FORUM . $forum->id . '/' . $razdel->id . '/' . $theme->id . '.html');
exit;
} elseif (isset($user) && isset($_GET['journal_no'])) {
if (mysql_result(mysql_query('SELECT COUNT(*) FROM `forum_journal` WHERE `id_theme` = ' . $theme->id . ' AND `id_user` = ' . $user['id']), 0) != 0) {
mysql_query('DELETE FROM `forum_journal` WHERE `id_theme` = ' . $theme->id . ' AND `id_user` = ' . $user['id']);
$_SESSION['success'] = "<div class='alert alert-success'>Вы успешно отписались от этой темы.</div>";
}
header('Location: ' . DIR_FORUM . $forum->id . '/' . $razdel->id . '/' . $theme->id . '.html');
exit;
}
if (isset($_SESSION['success'])) {
echo $_SESSION['success'];
unset($_SESSION['success']);
}
#Навигация
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><a href='" . DIR_FORUM . "$forum->id/'>" . toOutput($forum->name, 1, 1, 0, 0, 0) . "</a></li>";
echo "<li><a href='" . DIR_FORUM . "$forum->id/$razdel->id/'>" . toOutput($razdel->name, 1, 1, 0, 0, 0) . "</a></li>";
echo "<li class='active'>" . toOutput($theme->name, 1, 0, 0, 0, 0) . "</li>";
echo "</ol>";
if ($theme->reason_close != NULL) {
echo "<div class='alert alert-warning'>$theme->reason_close</div>";
}
$person = mysql_fetch_object(mysql_query('SELECT `id`, `nick`, `sex` FROM `user` WHERE `id` = ' . $theme->id_user));
$k_page = k_page($k_post, $set['p_str']);
$page = page($k_page);
$start = $set['p_str'] * $page - $set['p_str'];
echo "<table class='list-group-item'><tr><td class='icon14'>";
echo avatar("$person->id", '60');
echo "</td><td class='null'>";
echo user($person->id) . " <span style='color: #9197a3;' data-toggle='tooltip' data-placement='top' title='" . date::time($theme->time) . "'>" . date::times($theme->time) . "</span><br />";
echo toOutput($theme->description);
if (isset($user) && $my_report == 0 && !access('forum_them_edit') && $user['id'] != $theme->id_user && $theme->reason_close == NULL) {
echo "<br /><a href='" . DIR_FORUM . "$forum->id/$razdel->id/$theme->id/report.html'><span class='fa fa-flag fa-fw'></span> Пожаловаться</a> ";
}
if (isset($user) && $user['id'] != $theme->id_user) {
if (isset($user) && $my_report == 0 && !access('forum_them_edit') && $user['id'] != $theme->id_user && $theme->reason_close == NULL) {
} else {
echo "<br />";
}
$journal = mysql_result(mysql_query('SELECT COUNT(*) FROM `forum_journal` WHERE `id_theme` = "' . $theme->id . '" AND `id_user` = ' . $user['id']), 0);
$theme_journal = ($journal == 0) ? "<a href='" . DIR_FORUM . "$forum->id/$razdel->id/$theme->id/journal_yes'><span class='fa fa-rss fa-fw'></span> Подписаться</a>" : "<a href='" . DIR_FORUM . "$forum->id/$razdel->id/$theme->id/journal_no'><span class='fa fa-rss fa-fw'></span> Вы подписаны</a>";
echo " $theme_journal";
}
echo "</td></tr></table>";
if (isset($vote)) {
echo "<div class='list-group-item'>";
$all_votes = mysql_result(mysql_query('SELECT COUNT(*) FROM `forum_vote_voices` WHERE `id_vote` = ' . $vote->id), 0);
$i = 0;
echo "<b>" . toOutput($vote->name) . "</b><br />";
$vars = mysql_query('SELECT `id`, `variant` FROM `forum_votes_var` WHERE `id_vote` = ' . $vote->id . ' ORDER BY `id` ASC');
while ($var = mysql_fetch_object($vars)) {
$i++;
$vote_var = mysql_result(mysql_query('SELECT COUNT(*) FROM `forum_vote_voices` WHERE `id_vote` = ' . $vote->id . ' AND `id_variant` = ' . $var->id), 0);
$procent = ($all_votes == 0) ? 0 : $vote_var / $all_votes * 100;
$procent = sprintf("%u", $procent);
echo toOutput($var->variant) . ' (' . $procent . '%) - ' . $vote_var . ' чел.';
if (isset($user) && $my_voice == 0) {
echo "<a href = '" . DIR_FORUM . "$forum->id/$razdel->id/$theme->id/vote=$var->id'>";
}
echo "<div class='votes'>";
echo "<img src='" . DIR_FORUM . "icons/votes/poll$i.gif' alt='$i' style='height: 13px; width: $procent%; " . (($procent > 0) ? 'border-right: 1px solid black;' : NULL) . " ' />";
echo "</div>";
if (isset($user) && $my_voice == 0) {
echo '</a>';
}
}
echo "<span style='color: grey;'>Начало голосования: <span title='" . date::time($vote->time) . "' data-toggle='tooltip' data-placement='top'>" . date::times($vote->time) . "</span></span><br />";
if ($vote->time_end > time()) {
echo "<span style='color: grey;'>До завершения голосования:<br /> <b>" . date::time($vote->time_end) . "</b></span><br />";
} elseif ($vote->time_end < time() && $vote->time_end != 0) {
echo "<span style='color: green;'>Голосование завершено.</span><br />";
}
echo "<span style='color: blue;'><span class='fa fa-users fa-fw'></span> Проголосовало: $all_votes чел.</span>";
echo "</div>";
}
if ($theme->time_edit != 0 && $theme->id_admin != 0) {
$admin = mysql_fetch_object(mysql_query('SELECT `id`, `nick` FROM `user` WHERE `id` = ' . $theme->id_admin));
#Показываем последнее редактирование
echo "<div class='list-group-item' style='border-bottom: 1px solid #dcdee3;color: #9197a3;'><span class='fa fa-pencil fa-fw'></span> Посл. раз редактировалось <a href='/info.php?id=$admin->id'>$admin->nick</a> <small>(<span title='" . date::time($theme->time_edit) . "' data-toggle='tooltip' data-placement='top'>" . date::timek($theme->time_edit) . "</span>)</small></div>";
}
echo "<div class='list-group-item'>";
echo "<span class='fa fa-comments fa-fw'></span> <b>" . sklon_text($k_post, array('комментарий', 'комментария', 'комментариев')) . "</b><br />";
echo "</div>";
if (isset($user)) {
echo "<div class='list-group-item'>";
$li = "<li class='nav-item'><a class='nav-link' ";
$lir = "<li class='nav-item'><a class='nav-link' ";
echo "<ul class='nav nav-tabs' style='margin-bottom: -8px;'>";
if (!isset($_SESSION['sort_' . $user['id']])) {
$lir = "<li class='nav-item'><a class='nav-link active'>Вверху</a></li> <li class='nav-item'><a class='nav-link' href='" . DIR_FORUM . "$forum->id/$razdel->id/$theme->id/sort_1'>Внизу</a></li>";
} else {
$lir = "<li class='nav-item'><a class='nav-link' href='" . DIR_FORUM . "$forum->id/$razdel->id/$theme->id/sort_0'>Вверху</a></li> <li class='nav-item'><a class='nav-link active'>Внизу</a></li>";
}
echo "$lir";
echo "</ul>";
echo "</div>";
}
if ($k_post == 0) {
echo "<div class='list-group-item'>";
echo "<span class='fa fa-info-circle'></span> Нет результатов";
echo "</div>";
}
if (isset($user) && ($theme->reason_close == NULL || ($theme->reason_close != NULL && access('forum_post_close')))) {
$cit = 0;
$privat = 0;
$text = '';
if (isset($_GET['cit'])) {
$cit = intval($_GET['cit']);
$answer = intval($_GET['answer']);
$text = mysql_fetch_object(mysql_query('SELECT `id`, `nick` FROM `user` WHERE `id` = ' . $answer))->nick . ', ';
echo "<form method='post' class='list-group-item' action='" . DIR_FORUM . "$forum->id/$razdel->id/$theme->id/cit=$cit/answer=$answer'>";
} elseif (isset($_GET['privat'])) {
$privat = intval($_GET['privat']);
$text = mysql_fetch_object(mysql_query('SELECT `id`, `nick` FROM `user` WHERE `id` = ' . $privat))->nick . ', ';
echo "<form method='post' class='list-group-item' action='" . DIR_FORUM . "$forum->id/$razdel->id/$theme->id/privat=$privat'>";
} elseif (isset($_GET['answer'])) {
$answer = intval($_GET['answer']);
$text = mysql_fetch_object(mysql_query('SELECT `id`, `nick` FROM `user` WHERE `id` = ' . $answer))->nick . ', ';
echo "<form class='list-group-item' method='post' action='" . DIR_FORUM . "$forum->id/$razdel->id/$theme->id/answer=$answer'>";
} else {
echo "<form method='post' class='list-group-item' action='" . DIR_FORUM . "$forum->id/$razdel->id/$theme->id.html'>";
}
$cit = mysql_fetch_object(mysql_query('SELECT `text` FROM `forum_posts` WHERE `id` = ' . $cit));
if (isset($_GET['cit']) && isset($_GET['answer'])) {
echo "<div class='label label-default'>Цитирование сообщения: " . toOutput($cit->text) . "</div>";
}
echo "<textarea name='text' class='form-control' rows='3'>$text</textarea>";
if ($user['set_files'] == 1) {
echo "<label class='c-input c-checkbox'><input type='checkbox' name='add_file' value='1' /><span class='c-indicator'></span><span class='fa fa-paperclip fa-fw'></span> Прикрепить файл</label>";
}
echo "<br /><button name='comment' class='btn btn-success'>Отправить</button>";
echo "</form>";
}
if (isset($_GET['act_posts'])) {
echo "<form class='list-group-item' action='" . DIR_FORUM . "$forum->id/$razdel->id/$theme->id/act_posts' method='post' style='padding: 0px'>";
}
$post_count = $start;
$sort = (!isset($_SESSION['sort_' . $user['id']])) ? 'DESC' : 'ASC';
$limit = (isset($_GET['act_posts'])) ? NULL : ' LIMIT ' . $start . ', ' . $set['p_str'];
$posts = mysql_query('SELECT * FROM `forum_posts` WHERE `id_theme` = ' . $theme->id . ' ORDER BY `id` ' . $sort . $limit);
while ($post = mysql_fetch_object($posts)) {
$man = ($post->id_user != 0) ? mysql_fetch_object(mysql_query('SELECT `id`, `nick`, `sex` FROM `user` WHERE `id` = ' . $post->id_user)) : array();
$man_id = ($post->id_user != 0) ? $man->id : 0;
$man_pol = ($post->id_user != 0) ? $man->sex : 0;
$man_nick = ($post->id_user != 0) ? $man->nick : 'Система';
$privat = ($post->privat == $user['id'] || ($post->id_user == $user['id'] && $post->privat != 0)) ? '<font color="blue"><span class="fa fa-lock fa-fw"></span></font>' : NULL;
$admin = ($post->hide == 1) ? mysql_fetch_object(mysql_query('SELECT `id`, `nick`, `sex` FROM `user` WHERE `id` = ' . $post->id_admin)) : NULL;
if ($post->privat == 0 || ($post->privat == $user['id'] || $post->id_user == $user['id']) || $user['group_access'] > 14) {
$post_count++;
echo "<a id='$post->id'></a>";
#Меняем цвет сообщения, если скрытое
if ($post->hide == 1) {
echo "<div class='list-group-item list-group-item-warning'>";
} else {
echo "<div class='list-group-item'>";
}
if (isset($_GET['act_posts'])) {
echo "<input type='checkbox' name='act[]' value='$post->id' /> ";
}
//echo "<span style = 'float:right;'>#$post_count</span>";
if (isset($user) && ((isset($_GET['edit']) && $post->id != $_GET['edit']) || !isset($_GET['edit']))) {
echo "<span style='float:right;'>";
if ($user['id'] != $post->id_user && $post->id_user != 0 && $post->hide == 0 && ($theme->reason_close == NULL || ($theme->reason_close != NULL && access('forum_post_close')))) {
echo "<a href='" . DIR_FORUM . "$forum->id/$razdel->id/$theme->id/answer=$man_id' data-toggle='tooltip' data-placement='left' title='Ответить'><span class='fa fa-pencil fa-fw'></span></a> ";
echo "<a href='" . DIR_FORUM . "$forum->id/$razdel->id/$theme->id/cit=$post->id/answer=$man_id' data-toggle='tooltip' data-placement='left' title='Цитировать'><span class='fa fa-quote-right fa-fw'></span></a> ";
echo "<a href='" . DIR_FORUM . "$forum->id/$razdel->id/$theme->id/privat=$man_id' data-toggle='tooltip' data-placement='left' title='Приватно'><span class='fa fa-user-secret fa-fw'></span></a> ";
}
if ($post->id_user != 0 && (access('forum_post_ed') || ($theme->reason_close == NULL && $user['id'] == $post->id_user && $last_post == $post->id))) {
$razd = (access('forum_post_ed') && $post->hide == 0 && $post->id_user != $user['id']) ? ' ' : NULL;
echo $razd . "<a href='" . DIR_FORUM . "$forum->id/$razdel->id/$theme->id/edit_$post->id#$post->id' data-toggle='tooltip' data-placement='left' title='Редактировать'><span class='fa fa-pencil-square-o fa-fw'></span></a> ";
}
if (access('forum_post_ed')) {
$razd = ($post->id_user == 0) ? NULL : ' ';
echo $razd;
if ($post->hide == 0) {
echo " <a href = '" . DIR_FORUM . "$forum->id/$razdel->id/$theme->id/hide=$post->id' data-toggle='tooltip' data-placement='left' title='Скрыть'><span class='fa fa-eye-slash fa-fw'></span></a> ";
} else {
echo " <a href = '" . DIR_FORUM . "$forum->id/$razdel->id/$theme->id/display=$post->id' data-toggle='tooltip' data-placement='left' title='Показать'><span class='fa fa-eye fa-fw'></span></a> ";
}
echo "<a href = '" . DIR_FORUM . "$forum->id/$razdel->id/$theme->id/delete_post=$post->id' data-toggle='tooltip' data-placement='left' title = 'Удалить'><span class='fa fa-trash-o'></span></a> ";
}
echo "</span>";
}
echo user($man_id) . " <small style='color: #9197a3;'>" . date::timek($post->time) . " $privat</small><br />";
if ($user['id'] != $post->id_user && $post->id_user != 0) {
$_post = (isset($_GET['post'])) ? mysql_fetch_object(mysql_query('SELECT `id`, `rating`, `text` FROM `forum_posts` WHERE `id` = ' . intval($_GET['post']))) : NULL;
if (isset($user) && isset($_GET['like']) && mysql_result(mysql_query('SELECT COUNT(*) FROM `forum_post_rating` WHERE `id_user` = ' . $user['id'] . ' AND `id_post` = ' . intval($_GET['post']) . ' AND `type` = "0"'), 0) == 0) {
$plus = (mysql_result(mysql_query('SELECT COUNT(*) FROM `forum_post_rating` WHERE `id_user` = ' . $user['id'] . ' AND `id_post` = ' . intval($_GET['post']) . ' AND `type` = "1"'), 0) != 0) ? 2 : 1;
if (mysql_result(mysql_query('SELECT COUNT(*) FROM `forum_post_rating` WHERE `id_user` = ' . $user['id'] . ' AND `id_post` = ' . intval($_GET['post'])), 0) != 0) {
mysql_query('UPDATE `forum_post_rating` SET `type` = "0" WHERE `id_post` = ' . intval($_GET['post']) . ' AND `id_theme` = ' . $theme->id . ' AND `id_user` = ' . $user['id']);
} else {
mysql_query('INSERT INTO `forum_post_rating` SET `id_theme` = ' . $theme->id . ', `id_user` = ' . $user['id'] . ', `type` = "0", `id_post` = ' . intval($_GET['post']));
}
mysql_query('UPDATE `forum_posts` SET `rating` = ' . ($_post->rating + $plus) . ' WHERE `id` = ' . intval($_GET['post']));
$_SESSION['success'] = "<div class='alert alert-success'>Вы успешно проголосовали за пост.</div>";
$page = (is_numeric($_GET['page'])) ? intval($_GET['page']) : mysql_real_escape_string(trim($_GET['page']));
if ($page != 'end' && !is_numeric($page)) {
header('Location: ' . DIR_FORUM . $forum->id . '/' . $razdel->id . '/' . $theme->id . '.html');
} else {
header('Location: ' . DIR_FORUM . $forum->id . '/' . $razdel->id . '/' . $theme->id . '/page=' . $page . '#' . intval($_GET['post']));
}
exit;
} elseif (isset($user) && isset($_GET['dislike']) && mysql_result(mysql_query('SELECT COUNT(*) FROM `forum_post_rating` WHERE `id_user` = ' . $user['id'] . ' AND `id_post` = ' . intval($_GET['post']) . ' AND `type` = "1"'), 0) == 0) {
$minus = (mysql_result(mysql_query('SELECT COUNT(*) FROM `forum_post_rating` WHERE `id_user` = ' . $user['id'] . ' AND `id_post` = ' . intval($_GET['post']) . ' AND `type` = "0"'), 0) != 0) ? 2 : 1;
if (mysql_result(mysql_query('SELECT COUNT(*) FROM `forum_post_rating` WHERE `id_user` = ' . $user['id'] . ' AND `id_post` = ' . intval($_GET['post'])), 0) != 0) {
mysql_query('UPDATE `forum_post_rating` SET `type` = "1" WHERE `id_post` = ' . intval($_GET['post']) . ' AND `id_theme` = ' . $theme->id . ' AND `id_user` = ' . $user['id']);
} else {
mysql_query('INSERT INTO `forum_post_rating` SET `id_theme` = ' . $theme->id . ', `id_user` = ' . $user['id'] . ', `type` = "1", `id_post` = ' . intval($_GET['post']));
}
if (($_post->rating - $minus) < -5) {
$persons = mysql_query('SELECT `id`, `group_access` FROM `user` WHERE `group_access` > "2"');
while ($person = mysql_fetch_object($persons)) {
$access = mysql_result(mysql_query('SELECT COUNT(*) FROM `user_group_access` WHERE `id_group` = ' . $person->group_access . ' AND `id_access` = "forum_post_ed"'), 0);
if ($access != 0) {
$msg = 'Комментарий в теме [url=' . DIR_FORUM . $forum->id . '/' . $razdel->id . '/' . $theme->id . '/page=' . $page . '#' . $_post->id . ']' . $theme->name . '[/url] набрал много отрицательных отзывов. Есть подозрение, что он нарушает правила форума.
[b]Сам комментарий:[/b]
' . toOutput($_post->text);
mysql_query('INSERT INTO `mail` SET `id_user` = "0", `id_kont` = ' . $person->id . ', `msg` = "' . mysql_real_escape_string($msg) . '", `time` = ' . $time);
}
}
}
mysql_query('UPDATE `forum_posts` SET `rating` = ' . ($_post->rating - $minus) . ' WHERE `id` = ' . intval($_GET['post']));
$_SESSION['success'] = "<div class='alert alert-success'>Вы успешно проголосовали за пост.</div>";
$page = (is_numeric($_GET['page'])) ? intval($_GET['page']) : mysql_real_escape_string(trim($_GET['page']));
if ($page != 'end' && !is_numeric($page)) {
header('Location: ' . DIR_FORUM . $forum->id . '/' . $razdel->id . '/' . $theme->id . '.html');
} else {
header('Location: ' . DIR_FORUM . $forum->id . '/' . $razdel->id . '/' . $theme->id . '/page=' . $page . '#' . intval($_GET['post']));
}
exit;
}
echo "<span style='float: right; padding-left: 5px'>";
if (isset($user) && mysql_result(mysql_query('SELECT COUNT(*) FROM `forum_post_rating` WHERE `id_user` = ' . $user['id'] . ' AND `id_post` = ' . $post->id . ' AND `type` = "0"'), 0) == 0) {
echo "<a href='" . DIR_FORUM . "$forum->id/$razdel->id/$theme->id/page=$page/$post->id/like' data-toggle='tooltip' data-placement='left' title='Мне нравится' style='color:#B2B2B2;'>$post->rating <span class='fa fa-heart fa-fw'></span></a>";
} else {
if (isset($user) && mysql_result(mysql_query('SELECT COUNT(*) FROM `forum_post_rating` WHERE `id_user` = ' . $user['id'] . ' AND `id_post` = ' . $post->id . ' AND `type` = "1"'), 0) == 0) {
echo "<a href='" . DIR_FORUM . "$forum->id/$razdel->id/$theme->id/page=$page/$post->id/dislike' data-toggle='tooltip' data-placement='left' title='Мне не нравится' style='color:#EA5E5E;'>$post->rating <span class='fa fa-heart fa-fw'></span></a>";
}
}
echo "</span>";
} else {
echo "<span style = 'float: right; padding-left: 5px; color:#B2B2B2;'>$post->rating <span class='fa fa-heart fa-fw'></span></span>";
}
if (isset($_GET['edit']) && $_GET['edit'] == $post->id) {
$edit_post = mysql_fetch_object(mysql_query('SELECT `id`, `id_user`, `text` FROM `forum_posts` WHERE `id` = ' . intval($_GET['edit'])));
if (isset($user) && (access('forum_post_ed') || ($theme->reason_close == NULL && $user['id'] == $edit_post->id_user && $last_post == $edit_post->id))) {
echo "<form action='" . DIR_FORUM . "$forum->id/$razdel->id/$theme->id.html' method='post'>";
echo "<input type='hidden' name='id_post' value='" . intval($_GET['edit']) . "' />";
echo "<textarea name='post' class='form-control' rows='3'>$edit_post->text</textarea><br />";
echo "<button name='edit_post' class='btn btn-success'><span class='fa fa-save fa-fw'></span> Сохранить</button> ";
echo "<button name='cancel_edit' class='btn btn-secondary'>Отмена</button>";
echo "</form>";
} else {
header('Location: ' . DIR_FORUM . $forum->id . '/' . $razdel->id . '/' . $theme->id . '.html');
exit;
}
} else {
if ($post->hide == 1) {
echo "<small style='color: #9197a3;'>Комментарий скрыл " . (($admin->sex == 0) ? 'а' : NULL) . " <a href='/info.php?id=$admin->id'>$admin->nick</a></small><br />";
if (access('forum_post_ed')) {
echo '<s>' . toOutput($post->text) . '</s><br />';
}
} else {
if (mysql_result(mysql_query('SELECT MAX(`rating`) FROM `forum_posts` WHERE `rating` > "5" AND `id_theme` = ' . $theme->id), 0) == $post->rating) {
echo "<span style = 'float: right; padding-left: 10px; color: #ffff00;'>Лучший ответ</span>";
}
if ($post->cit != 0 && mysql_result(mysql_query('SELECT COUNT(*) FROM `forum_posts` WHERE `id` = ' . $post->cit), 0) != 0) {
$cit_post = mysql_fetch_object(mysql_query('SELECT `id_user`, `text`, `time` FROM `forum_posts` WHERE `id` = ' . $post->cit));
$user_cit = mysql_fetch_object(mysql_query('SELECT `id`, `nick` FROM `user` WHERE `id` = ' . $cit_post->id_user));
echo "<div class='cit'>";
echo "<b>$user_cit->nick : " . date::times($cit_post->time) . "</b><br />";
echo toOutput($cit_post->text, 1, 0, 0, 0, 0, 0) . '<br />';
echo "</div>";
}
echo toOutput($post->text) . '<br />';
}
}
if ($post->hide == 0 || ($post->hide == 1 && access('forum_post_ed'))) {
$files = mysql_query('SELECT * FROM `forum_post_files` WHERE `id_post` = ' . $post->id);
if (mysql_num_rows($files) != 0) {
while ($file = mysql_fetch_object($files)) {
$ras = strtolower(preg_replace('#^.*.#', NULL, $file->name));
if ($ras == 'jpg' || $ras == 'jpeg' || $ras == 'gif' || $ras == 'png' || $ras == 'bmp' || $ras == 'ico') {
$r = "<span class='fa fa-file-image-o fa-fw'></span>";
} elseif ($ras == '3gp' || $ras == 'mp4' || $ras == 'avi' || $ras == 'mpeg' || $ras == 'flv' || $ras == 'wmv' || $ras == 'mkv') {
$r = "<span class='fa fa-file-video-o fa-fw'></span>";
} elseif ($ras == 'docx' || $ras == 'doc' || $ras == 'docm' || $ras == 'dotx' || $ras == 'dot' || $ras == 'dotm') {
$r = "<span class='fa fa-file-text-o fa-fw'></span>";
} elseif ($ras == 'mp1' || $ras == 'mp2' || $ras == 'mp3' || $ras == 'wav' || $ras == 'aif' || $ras == 'ape' || $ras == 'flac' || $ras == 'ogg' || $ras == 'asf' || $ras == 'wma') {
$r = "<span class='fa fa-file-audio-o fa-fw'></span>";
} elseif ($ras == 'zip' || $ras == 'rar' || $ras == 'tar' || $ras == '7-zip' || $ras == 'gzip' || $ras == 'jar' || $ras == 'jad' || $ras == 'war' || $ras == 'xar') {
$r = "<span class='fa fa-file-archive-o fa-fw'></span>";
} elseif ($ras == 'txt' || $ras == 'xml') {
$r = "<span class='fa fa-file-text-o fa-fw'></span>";
} elseif ($ras == 'pdf') {
$r = "<span class='fa fa-file-text-o fa-fw'></span>";
} elseif ($ras == 'psd') {
$r = "<span class='fa fa-file-image-o fa-fw'></span>";
} else {
$r = "<span class='fa fa-file-o fa-fw'></span>";
}
$icon = '/modules/forum/files/' . $file->name;
echo "<div class='list-group-item' style='border-bottom: 1px solid #dcdee3;'>";
if ($user['id'] == $post->id_user || access('forum_post_ed')) {
echo "<span style = 'float:right;'>";
echo "<a href = '" . DIR_FORUM . "$forum->id/$razdel->id/$theme->id/del_file=$file->id' data-toggle='tooltip' data-placement='left' title='Удалить файл'><span class='fa fa-trash-o'></span></a>";
echo "</span>";
}
echo "<img src='$icon' style='width: 40px;height: 40px;padding:3px;' class = 'avatar'/><a href='" . DIR_FORUM . "$forum->id/$razdel->id/$theme->id/download_$file->id'>$r " . toOutput($file->real_name, 1, 1, 0, 0, 0) . "</a> (" . size_file($file->size) . " ";
echo "<span style = 'color: #88C057;'><span class='fa fa-download fa-fw'></span> $file->count_downloads чел.</span>)";
echo "</div>";
}
}
}
if ($post->count_edit != 0) {
echo "<small style='color: #9197a3;'><span class='fa fa-pencil fa-fw'></span> Посл. ред. " . date::timek($post->last_edit) . " - $post->who_edit</small><br />";
}
echo "</div>";
}
}
if (isset($_GET['act_posts'])) {
echo "<button name='delete_posts' class='btn btn-success'>Удалить</button> ";
echo "<button name='hide_posts' class='btn btn-success'>Скрыть</button> ";
echo "<button name='display_posts' class='btn btn-success'>Показать</button>";
echo "</form>";
}
if ($k_page > 1) {
echo "<div class='list-group-item'>";
str(DIR_FORUM . $forum->id . '/' . $razdel->id . '/' . $theme->id . '/', $k_page, $page);
echo "</div>";
}
$who = mysql_result(mysql_query('SELECT COUNT(*) FROM `user` WHERE `date_last` > "' . (time() - 600) . '" AND `forum_url` LIKE "/modules/forum/' . $forum->id . '/' . $razdel->id . '/' . $theme->id . '%"'), 0);
$count_files = mysql_result(mysql_query('SELECT COUNT(*) FROM `forum_post_files` WHERE `id_theme` = ' . $theme->id), 0);
echo "<a href='" . DIR_FORUM . "$forum->id/$razdel->id/$theme->id/who.html' class='list-group-item'><span class='fa fa-user fa-fw'></span> Сейчас в теме <span class='label label-default pull-right'>$who</span></a>";
echo "<a href='" . DIR_FORUM . "$forum->id/$razdel->id/$theme->id/files.html' class='list-group-item'><span class='fa fa-file fa-fw'></span> Файлы в теме <span class='label label-default pull-right'>$count_files</span></a>";
if ((access('forum_them_edit') || $user['id'] == $theme->id_user) && ($theme->reason_close == NULL || ($theme->reason_close != NULL && access('forum_post_close')))) {
echo "<a href = '" . DIR_FORUM . "$forum->id/$razdel->id/$theme->id/edit_theme.html' class = 'list-group-item'><span class='fa fa-pencil-square-o fa-fw'></span> Редактировать</a>";
if (mysql_result(mysql_query('SELECT COUNT(*) FROM `forum_votes` WHERE `id_theme` = ' . $theme->id), 0) == 0 && ($theme->reason_close == NULL || ($theme->reason_close != NULL && access('forum_post_close'))) && $user['id'] == $theme->id_user) {
echo "<a href = '" . DIR_FORUM . "$forum->id/$razdel->id/$theme->id/create_vote.html' class = 'list-group-item'><span class='fa fa-pie-chart fa-fw'></span> Создать голосование</a>";
} elseif (mysql_result(mysql_query('SELECT COUNT(*) FROM `forum_votes` WHERE `id_theme` = ' . $theme->id), 0) != 0 && ($theme->reason_close == NULL || ($theme->reason_close != NULL && access('forum_post_close'))) && $user['id'] == $theme->id_user) {
echo "<a href = '" . DIR_FORUM . "$forum->id/$razdel->id/$theme->id/edit_vote.html' class = 'list-group-item'><span class='fa fa-pie-chart fa-fw'></span> Ред. голосование</a>";
}
if (access('forum_them_edit')) {
if ($theme->reason_close == NULL && access('forum_post_close')) {
echo "<a href = '" . DIR_FORUM . "$forum->id/$razdel->id/$theme->id/close_theme.html' class = 'list-group-item'><span class='fa fa-lock fa-fw'></span> Закрыть тему</a>";
} elseif ($theme->reason_close != NULL && access('forum_post_close')) {
echo "<a href = '" . DIR_FORUM . "$forum->id/$razdel->id/$theme->id/open_theme.html' class = 'list-group-item'><span class='fa fa-unlock fa-fw'></span> Открыть тему</a>";
}
if (access('forum_post_ed')) {
echo "<a href = '" . DIR_FORUM . "$forum->id/$razdel->id/$theme->id/cleare_theme.html' class = 'list-group-item'><span class='fa fa-trash fa-fw'></span> Очистить тему</a>";
}
}
if (access('forum_post_ed') && access('forum_them_edit')) {
if (!isset($_GET['act_posts'])) {
echo "<a href = '" . DIR_FORUM . "$forum->id/$razdel->id/$theme->id/act_posts' class = 'list-group-item'><span class='fa fa-location-arrow fa-fw'></span> Действия над постами</a>";
} else {
echo "<a href = '" . DIR_FORUM . "$forum->id/$razdel->id/$theme->id.html' class = 'list-group-item'><span class='fa fa-ban fa-fw'></span> Отменить действие</a>";
}
}
}
}