<?php
  
$fthem = DB::GET_STRING("SELECT `ID`,`NAME`,`USER_ID`,`SUB_SECTION_ID`,`MESSAGE` FROM `FORUM_THEM` WHERE `ID` = '".$list['OBJECT_ID']."' LIMIT 1");
$account = DB::GET_STRING("SELECT `ID`,`SEX` FROM `USERS` WHERE `ID` = '".$list['OBJECT_ID_LIST']."' LIMIT 1");

USER::LOGIN($account['ID'], 1, 1);

IF ($account['SEX'] == 2){
  
  ECHO " ".LG('добавила тему в форум')."";
  
}ELSE{
  
  ECHO " ".LG('добавил тему в форум')."";
  
}

ECHO "<br /><span class='time'>".STIME($list['TIME'])."</span></br /></br />";

IF (!ISSET($fthem['ID'])){
  
  ECHO "<font color='red'>".LG('Объект был удален')."</font>";
  
}ELSE{
  
  ECHO "<div style='margin-top: 8px; margin-bottom: 8px;'><a href='/modules/?path=forum&section=show&id=".$fthem['ID']."'><b>".CROP_TEXT(TEXT_ABSOLUTE($fthem['NAME']), 0, 80)."</b></a></div>";

ECHO "<div style='margin-top: 8px; margin-bottom: 8px;'>";

IF (STR($fthem['MESSAGE']) > 120){
  
  ECHO "<div id='forum".$fthem['ID']."' style='margin-top: 5px;'>";
    
  ECHO CROP_TEXT(TEXT($fthem['MESSAGE'], 1, 1, 1, 0, 0), 0, 120);
  
  ECHO "</div>";
    
  ECHO "<div id='forum2".$fthem['ID']."' style='display: none; margin-top: 5px;'>";
    
  ECHO CROP_TEXT(TEXT($fthem['MESSAGE'], 1, 1, 1, 0, 0), 0, 1500);
    
  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'], 1, 1, 1, 0, 0);

}

ECHO "</div>";
  
$count_like = DB::GET_COLUMN("SELECT COUNT(*) FROM `FORUM_THEM_LIKES` WHERE `THEM_ID` = '".$fthem['ID']."'");
$count_eye = DB::GET_COLUMN("SELECT COUNT(*) FROM `FORUM_THEM_EYE` WHERE `THEM_ID` = '".$fthem['ID']."'");
$count_comments = DB::GET_COLUMN("SELECT COUNT(*) FROM `FORUM_THEM_COMMENTS` WHERE `THEM_ID` = '".$fthem['ID']."'");
  
ECHO "<a href='/modules/?path=forum&section=show&id=".$fthem['ID']."' class='btn-o'>".ICONS('heart', 15, 'fa-fw')." ".$count_like."</a>";
  
ECHO "<a href='/modules/?path=forum&section=show&id=".$fthem['ID']."' class='btn-o'>".ICONS('comment', 15, 'fa-fw')." ".$count_comments."</a>";
  
ECHO "<a href='/modules/?path=forum&section=show&id=".$fthem['ID']."' class='btn-o' style='float: right;'>".ICONS('eye', 15, 'fa-fw')." ".$count_eye."</a>";
  
}
  
?>