예제 #1
0
     if ($ID > 0) {
         $res = $ob->Update($ID, $arFields);
     } else {
         $res = $ob->Add($arFields);
     }
     if ($res > 0 && $_POST["ENTITY_TYPE"] == SONET_SUBSCRIBE_ENTITY_PROVIDER) {
         $ob->Update($res, array("ENTITY_ID" => $res));
     }
 } else {
     $e = new CAdminException($arError);
     $GLOBALS["APPLICATION"]->ThrowException($e);
 }
 if ($res > 0) {
     if ($_POST["ENTITY_TYPE"] == SONET_SUBSCRIBE_ENTITY_PROVIDER && $arUserRights) {
         $obSchemeRights = new CXDILFSchemeRights();
         $obSchemeRights->Set($res, $arUserRights, array("ENTITY_TYPE" => SONET_SUBSCRIBE_ENTITY_PROVIDER, "ENTITY_ID" => $res, "EVENT_ID" => $arFields["EVENT_ID"]));
     } elseif (in_array($_POST["ENTITY_TYPE"], array(SONET_SUBSCRIBE_ENTITY_GROUP, SONET_SUBSCRIBE_ENTITY_USER))) {
         CXDILFSchemeRights::DeleteBySchemeID($res);
     }
     if (isset($_REQUEST["apply"])) {
         LocalRedirect("/bitrix/admin/xdi_lf_scheme_edit.php?ID=" . $res . "&lang=" . LANGUAGE_ID);
     } else {
         LocalRedirect("/bitrix/admin/xdi_lf_scheme_list.php?lang=" . LANGUAGE_ID);
     }
 } else {
     $e = $APPLICATION->GetException();
     if (is_object($e)) {
         $message = new CAdminMessage(GetMessage("LFP_SCHEME_EDIT_SAVE_ERROR"), $e);
     }
     $bVarsFromForm = true;
 }
예제 #2
0
}
$strWarning = "";
$bVarsFromForm = false;
$ob = new CXDILFScheme();
$rsXDILFScheme = CXDILFScheme::GetList(array(), array("TYPE" => "RSS"));
$arXDILFScheme = $rsXDILFScheme->Fetch();
if (empty($arXDILFScheme)) {
    switch (LANGUAGE_ID) {
        case "ru":
            $host = "www.1c-bitrix.ru";
            $page = "/upload/xdimport/xdimport_rss_ru.xml";
            break;
        case "de":
            $host = "www.bitrix.de";
            $page = "/upload/xdimport/xdimport_rss_de.xml";
            break;
        default:
            $host = "www.bitrixsoft.com";
            $page = "/upload/xdimport/xdimport_rss_en.xml";
            break;
    }
    $arFields = array("ACTIVE" => "Y", "ENABLE_COMMENTS" => "Y", "SORT" => "100", "NAME" => GetMessage("XDI_SCHEME_NAME"), "TYPE" => "RSS", "LID" => WIZARD_SITE_ID, "DAYS_OF_WEEK" => "1,2,3,4,5,6,7", "TIMES_OF_DAY" => "8:00", "ENTITY_TYPE" => "P", "EVENT_ID" => "data", "HOST" => $host, "PAGE" => $page, "LAST_EXECUTED" => ConvertTimeStamp(time() - 86400, "FULL"));
    $res = $ob->Add($arFields);
    if ($res > 0) {
        $res = $ob->Update($res, array("ENTITY_ID" => $res));
    }
    if ($res > 0) {
        $obSchemeRights = new CXDILFSchemeRights();
        $obSchemeRights->Set($res, array("U" => array(1)), array("ENTITY_TYPE" => SONET_SUBSCRIBE_ENTITY_PROVIDER, "ENTITY_ID" => $res, "EVENT_ID" => "data"));
    }
}