<?php
  
ECHO "<span id='friends".$list['ID']."'>";

/*
------
Дружба
------
*/
  
REQUIRE (ROOT.'/users/profile/friends/plugins/inc.php');

IF (DB::GET_COLUMN("SELECT COUNT(*) FROM `FRIENDS` WHERE `MY_ID` = '".$list['ID']."' AND `USER_ID` = '".$list['ID']."' AND `ACT` = '1'") == 1){ 
  
  ?><a class="btn-o" onclick="request('friends<?=$list['ID']?>', '/modules/?path=users<?=$url?>&page=<?=$page?>&id_frend=<?=$list['ID']?>&get=friends_ok<?=$url?>', '#friends<?=$list['ID']?>')" load="none"><?=ICONS('user', 15, 'fa-fw')?> <?=LG('Принять заявку')?></a><?
  
}ELSE{
  
  IF ($user['ID'] != $list['ID'] && DB::GET_COLUMN("SELECT COUNT(*) FROM `FRIENDS` WHERE `MY_ID` = '".$user['ID']."' AND `USER_ID` = '".$list['ID']."' AND `ACT` = '1'") == 1){
    
  ?><a class="btn-o" onclick="request('friends<?=$list['ID']?>', '/modules/?path=users<?=$url?>&page=<?=$page?>&id_frend=<?=$list['ID']?>&get=friends_cancel<?=$url?>', '#friends<?=$list['ID']?>')" load="none"><?=ICONS('user', 15, 'fa-fw')?> <?=LG('Отменить')?></a><?
    
  }ELSE{
    
    IF ($account_settings['FRIENDS_PRIVATE_ADD'] == 1 && $user['ID'] != $list['ID'] && DB::GET_COLUMN("SELECT COUNT(*) FROM `FRIENDS` WHERE `MY_ID` = '".$user['ID']."' AND `USER_ID` = '".$list['ID']."' AND `ACT` = '0'") == 0){
      
      ?><a class="btn" onclick="request('friends<?=$list['ID']?>', '/modules/?path=users<?=$url?>&page=<?=$page?>&id_frend=<?=$list['ID']?>&get=friends_add<?=$url?>', '#friends<?=$list['ID']?>')" load="none"><?=ICONS('user', 15, 'fa-fw')?> <?=LG('Дружить')?></a><?
      
    }
  
  }
  
  IF (DB::GET_COLUMN("SELECT COUNT(*) FROM `FRIENDS` WHERE (`USER_ID` = '".$user['ID']."' AND `MY_ID` = '".$list['ID']."' OR `USER_ID` = '".$list['ID']."' AND `MY_ID` = '".$user['ID']."') AND `ACT` = '0'")){
    
    ?><a class="btn-o" onclick="request('friends<?=$list['ID']?>', '/id<?=$list['ID']?>?id_frend=<?=$list['ID']?>&get=friends_delete<?=$url?>', '#friends<?=$list['ID']?>')" load="none"><?=ICONS('check', 15, 'fa-fw')?> <?=LG('Дружите')?></a><?
    
  }

}

/*
--------
Подписка
--------
*/

REQUIRE (ROOT.'/users/profile/subscribers/plugins/inc.php');

IF ($user['ID'] != $list['ID'] && DB::GET_COLUMN("SELECT COUNT(*) FROM `SUBSCRIBERS` WHERE `MY_ID` = '".$user['ID']."' AND `USER_ID` = '".$list['ID']."'") == 1){
  
  ?><a class="btn-o" onclick="request('friends<?=$list['ID']?>', '/modules/?path=users<?=$url?>&page=<?=$page?>&id_subscribe=<?=$list['ID']?>&get=subscribe_delete<?=$url?>', '#friends<?=$list['ID']?>')" load="none"><?=ICONS('check', 15, 'fa-fw')?> <?=LG('Подписаны')?></a><?
  
}ELSE{
  
  ?><a class="btn" onclick="request('friends<?=$list['ID']?>', '/modules/?path=users<?=$url?>&page=<?=$page?>&id_subscribe=<?=$list['ID']?>&get=subscribe_ok<?=$url?>', '#friends<?=$list['ID']?>')" load="none"><?=ICONS('feed', 15, 'fa-fw')?> <?=LG('Подписаться')?></a><?
  
}

ECHO "</span>";
  
?>