$ID = IntVal($ID);
        switch ($_REQUEST['action']) {
            case "delete":
                @set_time_limit(0);
                $DB->StartTransaction();
                if (!CMailFilter::Delete($ID)) {
                    $DB->Rollback();
                    $e = $APPLICATION->GetException();
                    $lAdmin->AddGroupError($e->GetString(), $ID);
                }
                $DB->Commit();
                break;
            case "activate":
            case "deactivate":
                $arFields = array("ACTIVE" => $_REQUEST['action'] == "activate" ? "Y" : "N");
                if (!CMailFilter::Update($ID, $arFields)) {
                    if ($e = $APPLICATION->GetException()) {
                        $lAdmin->AddGroupError(GetMessage("MAIL_SAVE_ERROR") . " #" . $ID . ": " . $e->GetString(), $ID);
                    }
                }
                break;
        }
    }
}
$rsData = CMailFilter::GetList(array($by => $order), $arFilter);
$rsData = new CAdminResult($rsData, $sTableID);
$rsData->NavStart();
// установка строки навигации
$lAdmin->NavText($rsData->GetNavPrint(GetMessage("MAIL_FILT_ADM_NAVIGATION")));
$arHeaders = array();
$arHeaders[] = array("id" => "ID", "content" => "ID", "default" => true, "sort" => "id");
    $arModFilter = $res->Fetch();
}
$ID = intval($ID);
if ($REQUEST_METHOD == "POST" && (strlen($save) > 0 || strlen($apply) > 0) && $MOD_RIGHT >= "W" && check_bitrix_sessid()) {
    $arFields = array("ACTIVE" => $ACTIVE, "MAILBOX_ID" => $MAILBOX_ID, "PARENT_FILTER_ID" => false, "NAME" => $NAME, "SORT" => $SORT, "WHEN_MAIL_RECEIVED" => $WHEN_MAIL_RECEIVED, "WHEN_MANUALLY_RUN" => $WHEN_MANUALLY_RUN, "SPAM_RATING" => $SPAM_RATING, "SPAM_RATING_TYPE" => $SPAM_RATING_TYPE, "MESSAGE_SIZE" => $MESSAGE_SIZE, "MESSAGE_SIZE_TYPE" => $MESSAGE_SIZE_TYPE, "MESSAGE_SIZE_UNIT" => $MESSAGE_SIZE_UNIT, "DESCRIPTION" => $DESCRIPTION, "CONDITIONS" => $CONDITIONS, "ACTION_STOP_EXEC" => $ACTION_STOP_EXEC, "ACTION_DELETE_MESSAGE" => $ACTION_DELETE_MESSAGE, "ACTION_READ" => $ACTION_READ, "ACTION_SPAM" => $ACTION_SPAM, "ACTION_TYPE" => "");
    if ($USER->IsAdmin()) {
        $arFields["PHP_CONDITION"] = $PHP_CONDITION;
        $arFields["ACTION_PHP"] = $ACTION_PHP;
    }
    if ($arModFilter) {
        $arFields["ACTION_TYPE"] = $arModFilter["ID"];
        $ACTION_VARS = call_user_func($arModFilter["PREPARE_RESULT_FUNC"]);
        $arFields["ACTION_VARS"] = $ACTION_VARS;
    }
    if ($ID > 0) {
        $res = CMailFilter::Update($ID, $arFields);
    } else {
        $ID = CMailFilter::Add($arFields);
        $res = $ID > 0;
    }
    if (!$res) {
        if ($e = $APPLICATION->GetException()) {
            $message = new CAdminMessage(GetMessage("MAIL_FLT_EDT_ERROR"), $e);
        }
    } else {
        //$strError .= CMailError::GetErrorsText();
        //if(strlen($strError)<=0)
        //{
        if (strlen($save) > 0) {
            LocalRedirect("mail_filter_admin.php?lang=" . LANG);
        } else {
Beispiel #3
0
     } else {
         $arMailFilter = array_merge($arMailFilter, $arMailFilterData);
     }
 }
 if (isset($arMailFilter['ID'])) {
     unset($arMailFilter['ID']);
 }
 if ($mailFilterID <= 0) {
     $mailFilterID = intval(CMailFilter::Add($arMailFilter));
     if ($mailFilterID <= 0) {
         $ex = $GLOBALS['APPLICATION']->GetException();
         $errorMsg = $ex->GetString();
         $GLOBALS['APPLICATION']->ResetException();
     }
 } else {
     if (!CMailFilter::Update($mailFilterID, $arMailFilter)) {
         $ex = $GLOBALS['APPLICATION']->GetException();
         $errorMsg = $ex->GetString();
         $GLOBALS['APPLICATION']->ResetException();
     }
 }
 if ($errorMsg === '' && $mailFilterID > 0) {
     // Deleting other crm related filters (only one active crm filter is allowed)
     $rsMailFilter = CMailFilter::GetList(array(), array('ACTION_TYPE' => 'crm'));
     while ($arMailFilter = $rsMailFilter->Fetch()) {
         $curMailFilterID = intval($arMailFilter['ID']);
         if ($curMailFilterID !== $mailFilterID) {
             CMailFilter::Delete($curMailFilterID);
         }
     }
 }