<?php
  
ECHO "<span id='friends'>";

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

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

}

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

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

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

ECHO "</span>";
  
?>