<?php
  
ECHO "<div class='right-optimize'>";

ECHO "<div class='right-title'>".LG('Интересные блоги')."</div>";

$column = DB::GET_COLUMN("SELECT COUNT(*) FROM `BLOGS` WHERE `PRIVATE` = '0' AND `PASSWORD` = '".NULL."'");

IF ($column == 0){
  
  ECHO "<div class='list-menu'>";
  ECHO "".LG('Пока пусто')."";
  ECHO "</div>";
  
}

$data = DB::GET_STRING_ALL("SELECT * FROM `BLOGS` WHERE `PRIVATE` = '0' AND `PASSWORD` = '".NULL."' ORDER BY `TIME` DESC LIMIT 5");

WHILE ($list = $data->FETCH())
{
  
  ECHO "<div class='list-menu'>";
  
  ECHO "<table style='width: 100%;'><tr>";

  ECHO "<td class='comments-avatar'>";
  ECHO USER::AVATAR($list['USER_ID'], 40);
  ECHO "</td>";
  
  ECHO "<td class='comments-info'>";
  ECHO USER::LOGIN($list['USER_ID'], 0, 1);
  
  ECHO "<br /><span class='time'>".STIME($list['TIME'])."</span>";
  ECHO "</td>";
  
  ECHO "</tr></table>";
  
  ECHO "<span class='icons'>".ICONS('pencil', 15, 'fa-fw')."</span> <a href='/modules/?path=blogs&section=show&id=".$list['ID']."'>".CROP_TEXT(TEXT_ABSOLUTE($list['NAME']), 0, 80)."</a>";
  
  ECHO "</div>";

}

ECHO "<div class='list-menu'>";
ECHO "<a href='/modules/?path=blogs'>".ICONS('arrow-right', 15, 'fa-fw')." ".LG('Весь список')."</a>";
ECHO "</div>";

ECHO "</div>";
  
?>