Файл: 2/3020.ru/modules/news/content/show.php
Строк: 110
<?php
$news = DB::GET_STRING("SELECT * FROM `NEWS` WHERE `ID` = '".INTVAL(GET('id'))."' LIMIT 1");
$account = DB::GET_STRING("SELECT * FROM `USERS` WHERE `ID` = '".$news['USER_ID']."' LIMIT 1");
IF (!$news['ID']){
ERROR('Неверная директива', 'session');
REDIRECT('/modules/?path=news');
}
/*
---------
Просмотры
---------
*/
IF (ISSET($user)){
IF (DB::GET_COLUMN("SELECT COUNT(`ID`) FROM `NEWS_EYE` WHERE `USER_ID` = '".$user['ID']."' AND `NEWS_ID` = '".$news['ID']."' LIMIT 1") == 0){
DB::GET_ADD("INSERT INTO `NEWS_EYE` (`USER_ID`, `TIME`, `NEWS_ID`) VALUES ('".$user['ID']."', '".TIME()."', '".$news['ID']."')");
}
}
/*
-------------
Список лайков
-------------
*/
IF (GET('get') == "like_list"){
REQUIRE (ROOT.'/modules/news/plugins/like_list.php');
}
/*
---------------------
Редактирование записи
---------------------
*/
IF (GET('get') == "edit"){
IF (ACCESS('news', NULL, 1) || MANAGEMENT == 1){
REQUIRE (ROOT.'/modules/news/plugins/edit.php');
}
}
/*
---------------
Удаление записи
---------------
*/
IF (GET('get') == "news_delete_ok"){
IF (ACCESS('news', NULL, 1) || MANAGEMENT == 1){
REQUIRE (ROOT.'/modules/news/plugins/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=news'>".LG('Новости')."</a>";
ECHO "".ICONS('angle-right', 20, 'fa-fw')."";
ECHO "".TEXT_ABSOLUTE($news['NAME'])."";
ECHO "</div>";
//Редактировать комментарий
IF (MANAGEMENT == 1 || ACCESS('news', NULL, 1)){
REQUIRE (ROOT.'/modules/news/plugins/comments_edit_get.php');
}
IF (GET('get') == "news_delete"){
IF (ACCESS('news', NULL, 1) || MANAGEMENT == 1){
ECHO "<div class='list'>";
ECHO "".LG('Вы действительно хотите удалить новость')." <b>".TEXT_ABSOLUTE($news['NAME'])."</b>?<br /><br />";
ECHO "<a href='/modules/?path=news§ion=show&id=".$news['ID']."&get=news_delete_ok' class='btn'>".ICONS('trash', 15, 'fa-fw')."".LG('Удалить')."</a>";
ECHO "<a href='/modules/?path=news§ion=show&id=".$news['ID']."' class='btn-o'>".LG('Отменить')."</a>";
ECHO "</div>";
}
}
IF (ACCESS('news', NULL, 1) || MANAGEMENT == 1){
ECHO "<div class='list'>";
ECHO "<a href='/modules/?path=news§ion=show&id=".$news['ID']."&get=edit' class='btn'>".ICONS('pencil', 15, 'fa-fw')."".LG('Редактировать')."</a>";
ECHO "<a href='/modules/?path=news§ion=show&id=".$news['ID']."&get=news_delete' class='btn'>".ICONS('trash', 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($news['USER_ID'], 50);
ECHO "</td>";
ECHO "<td class='comments-info'>";
ECHO USER::LOGIN($news['USER_ID'], 0, 1);
ECHO "<br /><span class='time'>".STIME($news['TIME'])."</span>";
ECHO "</td>";
ECHO "</tr></table>";
ECHO "<div style='margin-top: 8px; margin-bottom: 8px;'><b>".TEXT_ABSOLUTE($news['NAME'])."</b></div>";
$data2 = DB::GET_STRING_ALL("SELECT * FROM `ATTACHMENTS` WHERE `ID_POST` = '".$news['ID']."' AND `NEWS` = '1' AND `ACT` = '1' ORDER BY `TIME` DESC LIMIT 3");
WHILE ($list2 = $data2->FETCH()){
REQUIRE (ROOT.'/users/attachments/plugins/inc_news_list.php');
}
ECHO "<div style='margin-top: 8px; margin-bottom: 8px;'>";
IF (STR($news['MESSAGE']) > 1000){
ECHO "<div id='news".$news['ID']."' style='margin-top: 5px;'>";
ECHO CROP_TEXT(TEXT($news['MESSAGE']), 0, 1000);
ECHO "</div>";
ECHO "<div id='news2".$news['ID']."' style='display: none; margin-top: 5px;'>";
ECHO TEXT($news['MESSAGE']);
ECHO "</div>";
?><a onclick="show_or_hide('news<?=$news['ID']?>', 'news2<?=$news['ID']?>', 'chevron<?=$news['ID']?>', 'opacity_message<?=$news['ID']?>')" load="none"><?
ECHO "<div id='chevron".$news['ID']."' class='chevron'><i class='fa fa-chevron-down fa-fw'></i></div>";
ECHO "</a>";
}ELSE{
ECHO TEXT($news['MESSAGE']);
}
ECHO "</div>";
ECHO "</div>";
//Лайки
REQUIRE (ROOT.'/modules/news/plugins/likes.php');
ECHO "</div>";
//Комментарии
REQUIRE (ROOT.'/modules/news/plugins/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=news'>".LG('Новости')."</a>";
ECHO "".ICONS('angle-right', 20, 'fa-fw')."";
ECHO "".TEXT_ABSOLUTE($news['NAME'])."";
ECHO "</div>";
?>