GetGroupRight("subscribe"); if($POST_RIGHT=="D") $APPLICATION->AuthForm(GetMessage("ACCESS_DENIED")); $ID = intval($_REQUEST["ID"]); $sTableID = "tbl_posting"; if($_REQUEST["action"]=="js_send" && check_bitrix_sessid()) { require_once($_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/main/include/prolog_admin_js.php"); $cPosting = new CPosting; $rsPosting = CPosting::GetByID($ID); $arPosting = $rsPosting->Fetch(); if($arPosting) { if($arPosting["STATUS"]=="D" || $arPosting["STATUS"]=="W") { if($cPosting->ChangeStatus($ID, "P")) { if($arPosting["AUTO_SEND_TIME"]!="") { if(COption::GetOptionString("subscribe", "subscribe_auto_method")!=="cron") { $rsAgents = CAgent::GetList(array("ID"=>"DESC"), array( "MODULE_ID" => "subscribe", "NAME" => "CPosting::AutoSend(".$ID.",%", )); while($arAgent = $rsAgents->Fetch()) CAgent::Delete($arAgent["ID"]); CAgent::AddAgent("CPosting::AutoSend(".$ID.",true);", "subscribe", "N", 0, $arPosting["AUTO_SEND_TIME"], "Y", $arPosting["AUTO_SEND_TIME"]); CAdminMessage::ShowMessage(array("MESSAGE"=>GetMessage("posting_agent_submitted"), "TYPE"=>"OK")); } else { CAdminMessage::ShowMessage(array("MESSAGE"=>GetMessage("posting_cron_setup"), "TYPE"=>"OK")); } ?>