<?php
  
ECHO "<div class='navigation'>";
ECHO "<a href='/'>".ICONS('home', 25, 'fa-fw')."</a>";
ECHO "".ICONS('angle-right', 22, 'fa-fw')."";
ECHO "<a href='/id".$account['ID']."'>".TEXT_ABSOLUTE($account['LOGIN'])."</a>";
ECHO "".ICONS('angle-right', 22, 'fa-fw')."";
ECHO "".LG('Друзья')."";
ECHO "</div>";

ECHO "<div class='tmenu_body'>";

IF ($user['ID'] == $account['ID']){
  
  ECHO "<a href='/users/profile/?path=friends&id=".$account['ID']."&section=online' class='tmenu-33 tmenu-33-o'>".LG('Онлайн')."</a>";
  ECHO "<a href='/users/profile/?path=friends&id=".$account['ID']."' class='tmenu-33'>".LG('Все')."</a>";
  ECHO "<a href='/users/profile/?path=friends&id=".$account['ID']."&section=applications' class='tmenu-33'>".LG('Заявки')."</a>";
  
}ELSE{
  
  ECHO "<a href='/users/profile/?path=friends&id=".$account['ID']."&section=online' class='tmenu-50 tmenu-50-o'>".LG('Онлайн')."</a>";
  ECHO "<a href='/users/profile/?path=friends&id=".$account['ID']."' class='tmenu-50'>".LG('Все')."</a>";

}

ECHO "</div>";

$column = DB::GET_COLUMN("SELECT COUNT(*) FROM `FRIENDS` INNER JOIN `USERS` ON `FRIENDS`.`USER_ID` = `USERS`.`ID` WHERE `FRIENDS`.`MY_ID` = '".$account['ID']."' AND `FRIENDS`.`ACT` = '0' AND `USERS`.`DATE_VISIT` > '".(TIME() - CONFIG('ONLINE_TIME_USERS'))."'");
$spage = SPAGE($column, $page_settings);
$page = PAGE($spage);
$limit = $page_settings * $page - $page_settings;

IF ($column == 0){
  
  HTML::EMPTY();
  
}ELSE{
  
  ECHO "<div class='list-body'>";
  
}

$data = DB::GET_STRING_ALL("SELECT * FROM `FRIENDS` INNER JOIN `USERS` ON `FRIENDS`.`USER_ID` = `USERS`.`ID` WHERE `FRIENDS`.`MY_ID` = '".$account['ID']."' AND `FRIENDS`.`ACT` = '0' AND `USERS`.`DATE_VISIT` > '".(TIME() - CONFIG('ONLINE_TIME_USERS'))."' ORDER BY `TIME` DESC LIMIT ".$limit.", ".$page_settings."");

WHILE ($list = $data->FETCH()){
  
  ECHO "<div class='list-menu'>";
  
  ECHO "<a href='/id".$list['USER_ID']."'><table style='width: 100%;'><tr>";
  
  ECHO "<td class='us-avatar'>";
  ECHO USER::AVATAR($list['USER_ID'], 50, 0, 1)."";
  ECHO "</td>";
  
  ECHO "<td class='us-info'>";
  ECHO "".USER::LOGIN($list['USER_ID'])."";
  ECHO "</td>";
  
  ECHO "</tr></table></a>";
  
  IF ($user['ID'] == $account['ID']){
    
    ECHO "<div id='friends".$list['ID']."'>";
    
    ECHO "<br />";
    
    REQUIRE (ROOT.'/users/profile/friends/plugins/inc.php');
    
    IF (DB::GET_COLUMN("SELECT COUNT(`ID`) FROM `FRIENDS` WHERE `MY_ID` = '".$list['MY_ID']."' AND `ACT` = '0' AND `USER_ID` = '".$list['USER_ID']."'")){
      
      ?><a class="btn" onclick="request('friends<?=$list['ID']?>', '/users/profile/?path=friends&id=<?=$account['ID']?>&section=online&id_frend=<?=$list['USER_ID']?>&id_list=<?=$list['ID']?>&get=friends_delete', '#friends<?=$list['ID']?>')" load="none"><?=ICONS('times', 15, 'fa-fw')?> <?=LG('Удалить')?></a><?
      
      }ELSE{
      
      ECHO "<font color='green'>".ICONS('check', 15, 'fa-fw')." ".LG('Пользователь удален из друзей')."</font>";
    
    }
    
    ECHO "</div>";
    
  }
  
  ECHO "</div>";
  
}

IF ($column > 0){
  
  ECHO "</div>";
  
}

IF ($spage > 1){ ECHO STR_PAGE('/users/profile/?path=friends&section=online&id='.$account['ID'].'&', $spage, $page); }

ECHO "<div class='navigation'>";
ECHO "<a href='/'>".ICONS('home', 25, 'fa-fw')."</a>";
ECHO "".ICONS('angle-right', 22, 'fa-fw')."";
ECHO "<a href='/id".$account['ID']."'>".TEXT_ABSOLUTE($account['LOGIN'])."</a>";
ECHO "".ICONS('angle-right', 22, 'fa-fw')."";
ECHO "".LG('Друзья')."";
ECHO "</div>";
  
?>