<?php if (!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED !== true) { die; } ?> <div class="subscribe-edit"> <?php foreach ($arResult["MESSAGE"] as $itemID => $itemValue) { echo ShowMessage(array("MESSAGE" => $itemValue, "TYPE" => "OK")); } foreach ($arResult["ERROR"] as $itemID => $itemValue) { echo ShowMessage(array("MESSAGE" => $itemValue, "TYPE" => "ERROR")); } //whether to show the forms if ($arResult["ID"] == 0 && empty($_REQUEST["action"]) || CSubscription::IsAuthorized($arResult["ID"])) { //show confirmation form if ($arResult["ID"] > 0 && $arResult["SUBSCRIPTION"]["CONFIRMED"] != "Y") { include "confirmation.php"; } //show current authorization section if ($USER->IsAuthorized() && ($arResult["ID"] == 0 || $arResult["SUBSCRIPTION"]["USER_ID"] == 0)) { include "authorization.php"; } //show authorization section for new subscription /*if($arResult["ID"]==0 && !$USER->IsAuthorized()) { if($arResult["ALLOW_ANONYMOUS"]=="N" || ($arResult["ALLOW_ANONYMOUS"]=="Y" && $arResult["SHOW_AUTH_LINKS"]=="Y")) { include("authorization_new.php"); }
ShowError(GetMessage("SUBSCR_NO_RUBRIC_FOUND")); return; } $arResult["FORM_ACTION"] = htmlspecialcharsbx(str_replace("#SITE_DIR#", LANG_DIR, $arParams["PAGE"])); $arResult["SHOW_COUNT"] = $arParams["SHOW_COUNT"]; if (strlen($arSubscription["EMAIL"]) > 0) { $arResult["EMAIL"] = htmlspecialcharsbx($arSubscription["EMAIL"]); } else { $arResult["EMAIL"] = htmlspecialcharsbx($USER->GetParam("EMAIL")); } //check whether already authorized $arResult["SHOW_PASS"] = true; if ($arSubscription["ID"] > 0) { //try to authorize user account's subscription if ($arSubscription["USER_ID"] > 0 && !CSubscription::IsAuthorized($arSubscription["ID"])) { CSubscription::Authorize($arSubscription["ID"], ""); } //check authorization if (CSubscription::IsAuthorized($arSubscription["ID"])) { $arResult["SHOW_PASS"] = false; } } $arResult["RUBRICS"] = array(); foreach ($arRubrics as $arRubric) { $bChecked = !is_array($_REQUEST["sf_RUB_ID"]) && in_array($arRubric["ID"], $arSubscriptionRubrics) || !is_array($_REQUEST["sf_RUB_ID"]) && intval($arSubscription["ID"]) == 0 || is_array($_REQUEST["sf_RUB_ID"]) && in_array($arRubric["ID"], $_REQUEST["sf_RUB_ID"]); $arResult["RUBRICS"][] = array("ID" => $arRubric["ID"], "NAME" => $arRubric["NAME"], "DESCRIPTION" => $arRubric["DESCRIPTION"], "CHECKED" => $bChecked, "SUBSCRIBER_COUNT" => $arRubric["SUBSCRIBER_COUNT"]); } if ($arParams["SET_TITLE"] == "Y") { $APPLICATION->SetTitle(GetMessage("SUBSCR_PAGE_TITLE"), array('COMPONENT_NAME' => $this->GetName())); } $this->IncludeComponentTemplate();
} //initialize variables from POST on error if ($bVarsFromForm) { $arSubscription["FORMAT"] = $_REQUEST["FORMAT"] == "html" ? "html" : "text"; $arSubscription["EMAIL"] = htmlspecialcharsbx($_REQUEST["EMAIL"]); } //page title if ($arParams["SET_TITLE"] == "Y") { if ($ID > 0) { $APPLICATION->SetTitle(GetMessage("subscr_title_edit"), array('COMPONENT_NAME' => $this->GetName())); } else { $APPLICATION->SetTitle(GetMessage("subscr_title_add"), array('COMPONENT_NAME' => $this->GetName())); } } //if the subscription belongs to USER_ID then authorization is required if ($ID > 0 && intval($arSubscription["USER_ID"]) > 0 && !CSubscription::IsAuthorized($ID)) { unset($HTTP_GET_VARS["mess_code"]); $APPLICATION->AuthForm("", false); } //get site's newsletter categories $obCache = new CPHPCache(); $strCacheID = LANG . $arParams["SHOW_HIDDEN"] . $this->GetRelativePath(); if ($obCache->StartDataCache($arParams["CACHE_TIME"], $strCacheID, "/" . SITE_ID . $this->GetRelativePath())) { $arFilter = array("ACTIVE" => "Y", "LID" => LANG); if ($arParams["SHOW_HIDDEN"] != "Y") { $arFilter["VISIBLE"] = "Y"; } $rsRubric = CRubric::GetList(array("SORT" => "ASC", "NAME" => "ASC"), $arFilter); $arRubrics = array(); while ($arRubric = $rsRubric->GetNext()) { $arRubrics[] = $arRubric;
'" onclick="if (this.value=='<?php echo GetMessage("CT_BSE_CONFIRMATION"); ?> ')this.value=''" /> <input type="submit" name="confirm" value="<?php echo GetMessage("CT_BSE_BTN_CONF"); ?> " /> </div> <?php } ?> </form> <?php if (!CSubscription::IsAuthorized($arResult["ID"])) { ?> <form action="<?php echo $arResult["FORM_ACTION"]; ?> " method="post"> <?php echo bitrix_sessid_post(); ?> <input type="hidden" name="action" value="sendcode" /> <div class="subscription-utility"> <p><?php echo GetMessage("CT_BSE_SEND_NOTE"); ?> </p>
} ?> <?php echo ShowMessage(array("MESSAGE" => $aMsg[$iMsg], "TYPE" => "OK")); echo ShowMessage(array("MESSAGE" => $strWarning, "TYPE" => "ERROR")); ?> <?php //if the subscription belongs to USER_ID then authorization is required if ($ID > 0 && (int) $str_USER_ID > 0 && !CSubscription::IsAuthorized($ID)) { unset($HTTP_GET_VARS["mess_code"]); $APPLICATION->AuthForm("", false); } //whether to show the forms if ($ID == 0 && empty($_REQUEST["action"]) || CSubscription::IsAuthorized($ID)) { if ($ID > 0 && $str_CONFIRMED != "Y") { //************************************* //show confirmation form //************************************* ?> <form action="<?php echo $APPLICATION->GetCurPage(); ?> " method="GET"> <h4><?php echo GetMessage("subscr_title_confirm"); ?> </h4> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr valign="top">