function removeFriend($sUser, $sPwd, $sNick)
 {
     $iIdProfile = BxDolXMLRPCUtil::getIdByNickname($sNick);
     if (!$iIdProfile || !($iId = BxDolXMLRPCUtil::checkLogin($sUser, $sPwd))) {
         return new xmlrpcresp(new xmlrpcval(array('error' => new xmlrpcval(1, "int")), "struct"));
     }
     bx_import('BxTemplCommunicator');
     $aCommunicatorSettings = array('member_id' => $iId);
     $aMembersList = array($iIdProfile);
     $oCommunicator = new BxTemplCommunicator($aCommunicatorSettings);
     $oCommunicator->execFunction('_deleteRequest', 'sys_friend_list', $aMembersList, array(1, 1));
     return new xmlrpcval('ok');
 }
// create BxTemplCommunicator object ;
$oCommunicator = new BxTemplCommunicator($aCommunicatorSettings);
//-- ajax request processing --//
if (isset($_SERVER['HTTP_X_REQUESTED_WITH']) && $_SERVER['HTTP_X_REQUESTED_WITH'] == 'XMLHttpRequest' && false !== bx_get('action')) {
    // contain all the available callback functions ;
    $aCallbackFunctions = array('getProcessingRows');
    switch (bx_get('action')) {
        // just return the processed requests;
        case 'get_page':
            $sOutputHtml = $oCommunicator->getProcessingRows();
            break;
            // function will set 'accept' mode for received members list ;
        // function will set 'accept' mode for received members list ;
        case 'accept_friends_request':
            if ($aMembersList) {
                $oCommunicator->execFunction('_acceptFriendInvite', 'sys_friend_list', $aMembersList);
            }
            break;
            // function will set 'reject' mode for received members list ;
        // function will set 'reject' mode for received members list ;
        case 'reject_friends_request':
            if ($aMembersList) {
                if ($aCommunicatorSettings['person_switcher'] == 'from') {
                    $oCommunicator->execFunction('_deleteRequest', 'sys_friend_list', $aMembersList, array(1));
                } else {
                    $oCommunicator->execFunction('_deleteRequest', 'sys_friend_list', $aMembersList, array(0, 1));
                }
            }
            break;
            // function will delete friends list ;
        // function will delete friends list ;
Exemple #3
0
/**
 * Delete from friends list
 *
 * @param $iProfileId integer
 * @param $iMemberId integer
 * @return text - html presentation data
 */
function PageListFriendRemove($iProfileId, $iMemberId = 0)
{
    $sOutputCode = '';
    $iProfileId = (int) $iProfileId;
    $iMemberId = (int) $iMemberId;
    if (!$iMemberId || !getProfileInfo($iMemberId)) {
        return MsgBox(_t('_Failed to apply changes'));
    }
    bx_import('BxTemplCommunicator');
    $oCommunicator = new BxTemplCommunicator(array('member_id' => $iProfileId));
    $aParams = array($iMemberId);
    $oCommunicator->execFunction('_deleteRequest', 'sys_friend_list', $aParams, array(1, 1));
    return MsgBox(_t('_Friend was removed'));
}