Файл: 2/3020.ru/modules/communities/content/forum_them_show.php
Строк: 126
<?php
$fthem = DB::GET_STRING("SELECT * FROM `COMMUNITIES_FORUM_THEM` WHERE `ID` = '".INTVAL(GET('id'))."' LIMIT 1");
$section = DB::GET_STRING("SELECT * FROM `COMMUNITIES_FORUM_SECTION` WHERE `ID` = '".$fthem['SECTION_ID']."' LIMIT 1");
$comm = DB::GET_STRING("SELECT * FROM `COMMUNITIES` WHERE `ID` = '".$section['COMMUNITY_ID']."' LIMIT 1");
$par = DB::GET_STRING("SELECT `ADMINISTRATION`,`USER_ID`,`ID`,`ACT` FROM `COMMUNITIES_PAR` WHERE `COMMUNITY_ID` = '".$comm['ID']."' AND `USER_ID` = '".$user['ID']."' AND `ACT` = '1' LIMIT 1");
$account = DB::GET_STRING("SELECT * FROM `USERS` WHERE `ID` = '".$fthem['USER_ID']."' LIMIT 1");
IF (!$fthem['ID']){
ERROR('Неверная директива', 'session');
REDIRECT('/modules/?path=communities');
}
/*
---------
Просмотры
---------
*/
IF (ISSET($user)){
IF (DB::GET_COLUMN("SELECT COUNT(`ID`) FROM `COMMUNITIES_FORUM_THEM_EYE` WHERE `USER_ID` = '".$user['ID']."' AND `THEM_ID` = '".$fthem['ID']."' LIMIT 1") == 0){
DB::GET_ADD("INSERT INTO `COMMUNITIES_FORUM_THEM_EYE` (`USER_ID`, `TIME`, `THEM_ID`) VALUES ('".$user['ID']."', '".TIME()."', '".$fthem['ID']."')");
}
}
/*
-------------
Список лайков
-------------
*/
IF (GET('get') == "like_list"){
REQUIRE (ROOT.'/modules/communities/plugins/forum_like_list.php');
}
/*
----------------------
Закрытие/открытие темы
----------------------
*/
IF (ISSET($par['ID']) && $par['ADMINISTRATION'] != 0 || MANAGEMENT == 1 || ACCESS('communities', NULL, 1)){
IF (GET('them') == 'off' || GET('them') == 'on'){
CSRF::GET_CHECK_VALID(GET('them'));
REQUIRE (ROOT.'/modules/communities/plugins/forum_them_on_off.php');
}
}
/*
-------------------
Редактирование темы
-------------------
*/
IF (GET('get') == "edit" && $fthem['BAN'] == 0){
IF (ISSET($par['ID']) && $par['ADMINISTRATION'] != 0 || MANAGEMENT == 1 || ACCESS('communities', NULL, 1) || $account['ID'] == $user['ID']){
REQUIRE (ROOT.'/modules/communities/plugins/forum_them_edit.php');
}
}
/*
-------------
Удаление темы
-------------
*/
IF (GET('get') == "delete_ok"){
IF (ISSET($par['ID']) && $par['ADMINISTRATION'] != 0 || MANAGEMENT == 1 || ACCESS('communities', NULL, 1)){
REQUIRE (ROOT.'/modules/communities/plugins/forum_them_delete.php');
}
}
//Навигация
ECHO "<div class='navigation'>";
ECHO "<a href='/'>".ICONS('home', 25, 'fa-fw')."</a>";
ECHO "".ICONS('angle-right', 20, 'fa-fw')."";
ECHO "<a href='/modules/?path=communities'>".LG('Сообщества')."</a>";
ECHO "".ICONS('angle-right', 20, 'fa-fw')."";
ECHO "<a href='/modules/?path=communities§ion=show&id=".$comm['ID']."'>".TEXT_ABSOLUTE($comm['NAME'])."</a>";
ECHO "".ICONS('angle-right', 20, 'fa-fw')."";
ECHO "<a href='/modules/?path=communities§ion=forum_section&id=".$comm['ID']."'>".LG('Форум')."</a>";
ECHO "".ICONS('angle-right', 20, 'fa-fw')."";
ECHO "<a href='/modules/?path=communities§ion=forum_section_themes&id=".$section['ID']."'>";
ECHO TEXT_ABSOLUTE($section['NAME'])."</a>";
ECHO "".ICONS('angle-right', 20, 'fa-fw')."";
ECHO TEXT_ABSOLUTE($fthem['NAME']);
ECHO "</div>";
//Редактировать комментарий
$comment = DB::GET_STRING("SELECT * FROM `COMMUNITIES_FORUM_THEM_COMMENTS` WHERE `ID` = '".INTVAL(GET('comment_edit'))."' LIMIT 1");
IF ($comment['USER_ID'] == $user['ID'] || MANAGEMENT == 1 || ACCESS('communities', NULL, 1) || ISSET($par['ID']) && $par['ADMINISTRATION'] != 0){
REQUIRE (ROOT.'/modules/communities/plugins/forum_comments_edit_get.php');
}
IF (GET('get') == "delete"){
IF (ISSET($par['ID']) && $par['ADMINISTRATION'] != 0 || MANAGEMENT == 1 || ACCESS('communities', NULL, 1)){
ECHO "<div class='list'>";
ECHO "".LG('Вы действительно хотите удалить тему')." <b>".TEXT_ABSOLUTE($fthem['NAME'])."</b>?<br /><br />";
ECHO "<a href='/modules/?path=communities§ion=forum_them_show&id=".$fthem['ID']."&get=delete_ok' class='btn'>".ICONS('trash', 15, 'fa-fw')."".LG('Удалить')."</a>";
ECHO "<a href='/modules/?path=communities§ion=forum_them_show&id=".$fthem['ID']."' class='btn-o'>".LG('Отменить')."</a>";
ECHO "</div>";
}
}
IF (ISSET($par['ID']) && $par['ADMINISTRATION'] != 0 || MANAGEMENT == 1 || ACCESS('communities', NULL, 1) || $account['ID'] == $user['ID']){
ECHO "<div class='list'>";
ECHO "<a href='/modules/?path=communities§ion=forum_them_show&id=".$fthem['ID']."&get=edit' class='btn'>".ICONS('pencil', 15, 'fa-fw')." ".LG('Редактировать')."</a>";
IF (ISSET($par['ID']) && $par['ADMINISTRATION'] != 0 || MANAGEMENT == 1 || ACCESS('communities', NULL, 1)){
ECHO "<a href='/modules/?path=communities§ion=forum_them_show&id=".$fthem['ID']."&get=delete' class='btn'>".ICONS('trash', 15, 'fa-fw')." ".LG('Удалить')."</a>";
IF ($fthem['ACTIVE'] == 1){
ECHO "<a href='/modules/?path=communities§ion=forum_them_show&id=".$fthem['ID']."&them=off&".$token_url."' class='btn'>".ICONS('lock', 15, 'fa-fw')." ".LG('Закрыть')."</a>";
}ELSE{
ECHO "<a href='/modules/?path=communities§ion=forum_them_show&id=".$fthem['ID']."&them=on&".$token_url."' class='btn'>".ICONS('unlock', 15, 'fa-fw')." ".LG('Открыть')."</a>";
}
}
ECHO "</div>";
}
ECHO "<div class='list-body' style='position: relative; z-index: 0;'>";
ECHO "<div class='list-menu'>";
ECHO "<table style='width: 100%;'><tr>";
ECHO "<td class='comments-avatar'>";
ECHO USER::AVATAR($fthem['USER_ID'], 50);
ECHO "</td>";
ECHO "<td class='comments-info'>";
ECHO USER::LOGIN($fthem['USER_ID'], 0, 1);
ECHO "<br /><span class='time'>".STIME($fthem['TIME'])."</span>";
ECHO "</td>";
ECHO "</tr></table>";
ECHO "<div style='margin-top: 8px; margin-bottom: 8px;'>";
IF ($fthem['ACTIVE'] == 0){
ECHO "".ICONS('lock', 17, 'fa-fw')." ";
}
ECHO "<b>".TEXT_ABSOLUTE($fthem['NAME'])."</b></div>";
ECHO "<div style='margin-top: 8px; margin-bottom: 8px;'>";
IF (STR($fthem['MESSAGE']) > 1000){
ECHO "<div id='forum".$fthem['ID']."' style='margin-top: 5px;'>";
ECHO CROP_TEXT(TEXT($fthem['MESSAGE']), 0, 1000);
ECHO "</div>";
ECHO "<div id='forum2".$fthem['ID']."' style='display: none; margin-top: 5px;'>";
ECHO TEXT($fthem['MESSAGE']);
ECHO "</div>";
?><a onclick="show_or_hide('forum<?=$fthem['ID']?>', 'forum2<?=$fthem['ID']?>', 'chevron<?=$fthem['ID']?>', 'opacity_message<?=$fthem['ID']?>')" load="none"><?
ECHO "<div id='chevron".$fthem['ID']."' class='chevron'><i class='fa fa-chevron-down fa-fw'></i></div>";
ECHO "</a>";
}ELSE{
ECHO TEXT($fthem['MESSAGE']);
}
ECHO "</div>";
ECHO "</div>";
IF ($fthem['ACTIVE'] == 0 || $fthem['EDIT_TIME'] > 0){
ECHO "<div class='list-menu'><small>";
IF ($fthem['EDIT_TIME'] > 0){
$account2 = DB::GET_STRING("SELECT * FROM `USERS` WHERE `ID` = '".$fthem['EDIT_USER_ID']."' LIMIT 1");
ECHO "".LG('Последний раз тему редактировал')." <a href='/id".$account2['ID']."'>".$account2['LOGIN']."</a>";
ECHO " - ".FTIME($fthem['EDIT_TIME'])."<br />";
}
IF ($fthem['ACTIVE'] == 0){
$account2 = DB::GET_STRING("SELECT * FROM `USERS` WHERE `ID` = '".$fthem['ACTIVE_USER_ID']."' LIMIT 1");
ECHO "".LG('Тема закрыта пользователем')." <a href='/id".$account2['ID']."'>".$account2['LOGIN']."</a>";
ECHO " - ".FTIME($fthem['ACTIVE_TIME'])."<br />";
}
ECHO "</small></div>";
}
//Лайки
REQUIRE (ROOT.'/modules/communities/plugins/forum_likes.php');
ECHO "</div>";
//Комментарии
REQUIRE (ROOT.'/modules/communities/plugins/forum_comments.php');
//Навигация
ECHO "<div class='navigation'>";
ECHO "<a href='/'>".ICONS('home', 25, 'fa-fw')."</a>";
ECHO "".ICONS('angle-right', 20, 'fa-fw')."";
ECHO "<a href='/modules/?path=communities'>".LG('Сообщества')."</a>";
ECHO "".ICONS('angle-right', 20, 'fa-fw')."";
ECHO "<a href='/modules/?path=communities§ion=show&id=".$comm['ID']."'>".TEXT_ABSOLUTE($comm['NAME'])."</a>";
ECHO "".ICONS('angle-right', 20, 'fa-fw')."";
ECHO "<a href='/modules/?path=communities§ion=forum_section&id=".$comm['ID']."'>".LG('Форум')."</a>";
ECHO "".ICONS('angle-right', 20, 'fa-fw')."";
ECHO "<a href='/modules/?path=communities§ion=forum_section_themes&id=".$section['ID']."'>";
ECHO TEXT_ABSOLUTE($section['NAME'])."</a>";
ECHO "".ICONS('angle-right', 20, 'fa-fw')."";
ECHO TEXT_ABSOLUTE($fthem['NAME']);
ECHO "</div>";
?>