<?php
  
$news = DB::GET_STRING("SELECT * FROM `NEWS` ORDER BY `TIME` DESC LIMIT 1");

IF (ISSET($_GET['close']) && $_GET['close'] == 'news'){
  
  SETCOOKIE('news_close', $news['ID'], TIME() + 60 * 60 * 24 * 365);
  
  SUCCESS('Новость успешно скрыта', 'session');
  REDIRECT('/');
  
}

IF ($news['MAIN_TIME'] > TIME() && COOKIE('news_close') != $news['ID']){
  
  ECHO "<div class='list-body'>";
  
  ECHO "<div class='list-menu list-menu-title'>".ICONS('feed', 15, 'fa-fw')." ".LG('Новости')." <a href='/?close=news' style='float: right;'>".LG('Скрыть')." ".ICONS('times', 17, 'fa-fw')."</a></div>";
  
  $data = DB::GET_STRING_ALL("SELECT * FROM `NEWS` ORDER BY `TIME` DESC LIMIT 1");
  
  WHILE ($list = $data->FETCH()){
    
    REQUIRE (ROOT.'/modules/news/plugins/news_list.php');
  
  }
  
  ECHO "</div>";
  
}
  
?>