$lAdmin = new CAdminList($sTableID, $oSort);
$FilterArr = array("find", "find_type", "find_rule_type", "find_active", "find_admin_section", "find_site_id", "find_name", "find_ip", "find_path");
$lAdmin->InitFilter($FilterArr);
$arFilter = array("=RULE_TYPE" => $find_rule_type, "=ACTIVE" => $find_active, "=ADMIN_SECTION" => $find_admin_section, "=SITE_ID" => $find_site_id, "%NAME" => $find != "" && $find_type == "name" ? $find : $find_name, "IP" => $find != "" && $find_type == "ip" ? $find : $find_ip, "PATH" => $find != "" && $find_type == "path" ? $find : $find_path);
foreach ($arFilter as $key => $value) {
    if (!$value) {
        unset($arFilter[$key]);
    }
}
if ($lAdmin->EditAction() && $RIGHT_W) {
    foreach ($FIELDS as $ID => $arFields) {
        if (!$lAdmin->IsUpdated($ID)) {
            continue;
        }
        $cData = new CSecurityIPRule();
        if (!$cData->Update($ID, $arFields)) {
            $lAdmin->AddGroupError(GetMessage("SEC_IP_LIST_UPDATE_ERROR") . " " . $cData->LAST_ERROR, $ID);
        }
    }
}
if (($arID = $lAdmin->GroupAction()) && $RIGHT_W) {
    if ($_REQUEST['action_target'] == 'selected') {
        $cData = new CSecurityIPRule();
        $rsData = $cData->GetList(array('ID'), $arFilter, array());
        while ($arRes = $rsData->Fetch()) {
            $arID[] = $arRes['ID'];
        }
    }
    foreach ($arID as $ID) {
        if (strlen($ID) <= 0) {
            continue;
     $bVarsFromForm = true;
 } elseif ($selfBlock && COption::GetOptionString("security", "ipcheck_allow_self_block") !== "Y") {
     if ($e = $APPLICATION->GetException()) {
         $message = new CAdminMessage(GetMessage("SEC_IPRULE_ADMIN_SAVE_ERROR"), $e);
     }
     $bVarsFromForm = true;
 } elseif ($selfBlock && $_POST["USE_THE_FORCE_LUK"] !== "Y") {
     if ($e = $APPLICATION->GetException()) {
         $message = new CAdminMessage(GetMessage("SEC_IPRULE_ADMIN_SAVE_ERROR"), $e);
     }
     $bVarsFromForm = true;
     $bShowForce = true;
 } else {
     $arFields = array("RULE_TYPE" => "A", "ACTIVE" => $activate_iprule ? "Y" : ($deactivate_iprule ? "N" : $ACTIVE), "ADMIN_SECTION" => "Y", "SITE_ID" => false, "SORT" => 10, "NAME" => GetMessage("SEC_IPRULE_ADMIN_RULE_NAME"), "ACTIVE_FROM" => false, "ACTIVE_TO" => false, "INCL_IPS" => $INCL_IPS, "EXCL_IPS" => $_POST["EXCL_IPS"], "INCL_MASKS" => array("/bitrix/admin/*"), "EXCL_MASKS" => $exclMasks);
     if ($ID > 0) {
         $res = $ob->Update($ID, $arFields);
     } else {
         $ID = $ob->Add($arFields);
         $res = $ID > 0;
     }
     if ($res) {
         if ($save != "" && $_GET["return_url"] != "") {
             LocalRedirect($_GET["return_url"]);
         }
         LocalRedirect("/bitrix/admin/security_iprule_admin.php?lang=" . LANGUAGE_ID . ($return_url ? "&return_url=" . urlencode($_GET["return_url"]) : "") . "&" . $tabControl->ActiveTabParam());
     } else {
         if ($e = $APPLICATION->GetException()) {
             $message = new CAdminMessage(GetMessage("SEC_IPRULE_ADMIN_SAVE_ERROR"), $e);
         }
         $bVarsFromForm = true;
     }