/** * Terminates controller and application. * This method replaces "die()" or "exit()" and ensures life cycle of application. * @return void */ protected function end() { $this->logDebugInfo(); /** @noinspection PhpUndefinedClassInspection */ \CMain::finalActions(); die; }
protected function end($terminate = true) { Diag::getInstance()->logDebugInfo($this->getName()); if ($terminate) { /** @noinspection PhpUndefinedClassInspection */ \CMain::finalActions(); die; } }
protected function showJsonAnswer($result) { if (!defined("PUBLIC_AJAX_MODE")) { define("PUBLIC_AJAX_MODE", true); } if (!defined("NO_KEEP_STATISTIC")) { define("NO_KEEP_STATISTIC", "Y"); } if (!defined("NO_AGENT_STATISTIC")) { define("NO_AGENT_STATISTIC", "Y"); } if (!defined("NO_AGENT_CHECK")) { define("NO_AGENT_CHECK", true); } if (!defined("DisableEventsCheck")) { define("DisableEventsCheck", true); } require_once $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/include/prolog_before.php"; $GLOBALS["APPLICATION"]->RestartBuffer(); while (ob_end_clean()) { } $version = IsIE(); if (!(0 < $version && $version < 10)) { header('Content-Type:application/json; charset=UTF-8'); } echo Json::encode($result); \CMain::finalActions(); die; }
$arRes = CSocNetLogComponent::getCommentByRequest($comment_id, $post_id, "edit"); if ($arRes) { $arResult["id"] = intval($arRes["ID"]); $arResult["message"] = str_replace("<br />", "\n", $arRes["MESSAGE"]); $arResult["sourceId"] = intval($arRes["SOURCE_ID"]) > 0 ? intval($arRes["SOURCE_ID"]) : intval($arRes["ID"]); $arResult["UF"] = !empty($arRes["UF"]) ? $arRes["UF"] : array(); } } } elseif ($action == "delete_comment") { $arResult = false; $comment_id = intval($_REQUEST["delete_comment_id"]); $post_id = intval($_REQUEST["post_id"]); if ($comment_id > 0 && $post_id > 0) { $arRes = CSocNetLogComponent::getCommentByRequest($comment_id, $post_id, "delete"); if ($arRes) { $bSuccess = CSocNetLogComments::Delete($arRes["ID"], true); if (!$bSuccess && ($e = $GLOBALS["APPLICATION"]->GetException())) { $errorMessage = $e->GetString(); } $APPLICATION->IncludeComponent("bitrix:main.post.list", "", array("ENTITY_XML_ID" => $_REQUEST["ENTITY_XML_ID"], "PUSH&PULL" => array("ID" => $bSuccess ? $arRes["SOURCE_ID"] > 0 ? $arRes["SOURCE_ID"] : $arRes["ID"] : false, "ACTION" => "DELETE"), "OK_MESSAGE" => $bSuccess ? GetMessage('SONET_LOG_COMMENT_DELETED') : '', "ERROR_MESSAGE" => !$bSuccess ? $errorMessage : '')); } } } header('Content-Type:application/json; charset=UTF-8'); echo \Bitrix\Main\Web\Json::encode($arResult); /** @noinspection PhpUndefinedClassInspection */ \CMain::finalActions(); die; } define('PUBLIC_AJAX_MODE', true); require_once $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/include/epilog_after.php";
protected function sendJsonResponse($response) { $this->getApplication()->restartBuffer(); while (ob_end_clean()) { } header('Content-Type:application/json; charset=UTF-8'); echo Json::encode($response); /** @noinspection PhpUndefinedClassInspection */ \CMain::finalActions(); die; }
protected function end($terminate = true) { if (IsModuleInstalled("disk")) { \Bitrix\Disk\Internals\Diag::getInstance()->logDebugInfo($this->getName()); } if ($terminate) { /** @noinspection PhpUndefinedClassInspection */ \CMain::finalActions(); die; } }