Ejemplo n.º 1
0
            if (!in_array($arRelation["FIRST_USER_ID"], $arFriendID) && !in_array($arRelation["SECOND_USER_ID"], $arFriendID)) {
                continue;
            }
            $arRelationID[] = $arRelation["ID"];
            $arRelationUserID[] = $arRelation[($user_id == $arRelation["FIRST_USER_ID"] ? "SECOND" : "FIRST") . "_USER_ID"];
        }
        if (count(array_diff($arFriendID, $arRelationUserID)) > 0) {
            echo CUtil::PhpToJsObject(array('ERROR' => 'FRIEND_ID_INCORRECT_2'));
            die;
        }
        if ($_POST['ACTION'] == "BAN") {
            foreach ($arRelationUserID as $relation_user_id) {
                if (!CSocNetUserRelations::BanUser($user_id, $relation_user_id)) {
                    echo CUtil::PhpToJsObject(array('ERROR' => 'USER_ACTION_FAILED: ' . (($e = $APPLICATION->GetException()) ? $e->GetString() : "")));
                    die;
                }
            }
        } else {
            foreach ($arRelationID as $relation_id) {
                if ($_POST['ACTION'] == "EX" && !CSocNetUserRelations::Delete($relation_id) || $_POST['ACTION'] == "UNBAN" && !CSocNetUserRelations::UnBanMember($user_id, $relation_id)) {
                    echo CUtil::PhpToJsObject(array('ERROR' => 'USER_ACTION_FAILED: ' . (($e = $APPLICATION->GetException()) ? $e->GetString() : "")));
                    die;
                }
            }
        }
    }
    echo CUtil::PhpToJsObject(array('SUCCESS' => 'Y'));
} else {
    echo CUtil::PhpToJsObject(array('ERROR' => 'SESSION_ERROR'));
}
require $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/include/epilog_after.php";
Ejemplo n.º 2
0
 } elseif ($_SERVER["REQUEST_METHOD"] == "POST" && strlen($_POST["delete"]) > 0 && check_bitrix_sessid()) {
     $errorMessage = "";
     $arIDs = array();
     if (strlen($errorMessage) <= 0) {
         for ($i = 0; $i <= IntVal($_POST["max_count"]); $i++) {
             if ($_POST["checked_" . $i] == "Y") {
                 $arIDs[] = IntVal($_POST["id_" . $i]);
             }
         }
         if (count($arIDs) <= 0) {
             $errorMessage .= GetMessage("SONET_C32_NOT_SELECTED") . ". ";
         }
     }
     if (strlen($errorMessage) <= 0) {
         foreach ($arIDs as $ban_id) {
             if (!CSocNetUserRelations::UnBanMember($GLOBALS["USER"]->GetID(), $ban_id)) {
                 if ($e = $APPLICATION->GetException()) {
                     $errorMessage .= $e->GetString();
                 }
             }
         }
     }
     if (strlen($errorMessage) > 0) {
         $arResult["ErrorMessage"] = $errorMessage;
     }
 }
 /*********************  END ACTIONS  *****************************/
 if ($arParams["SET_TITLE"] == "Y") {
     $APPLICATION->SetTitle(GetMessage("SONET_C32_PAGE_TITLE"));
 }
 if ($arParams["SET_NAV_CHAIN"] != "N") {