function PrologActions() { /** @global CMain $APPLICATION */ global $APPLICATION, $USER; if (defined("BX_CHECK_SHORT_URI") && BX_CHECK_SHORT_URI) { if ($arUri = CBXShortUri::GetUri($_SERVER["REQUEST_URI"])) { CBXShortUri::SetLastUsed($arUri["ID"]); if (CModule::IncludeModule("statistic")) { CStatEvent::AddCurrent("short_uri_redirect", "", "", "", "", $arUri["URI"], "N", SITE_ID); } LocalRedirect($arUri["URI"], true, CBXShortUri::GetHttpStatusCodeText($arUri["STATUS"])); die; } } //session expander if (COption::GetOptionString("main", "session_expand", "Y") != "N" && (!defined("BX_SKIP_SESSION_EXPAND") || BX_SKIP_SESSION_EXPAND == false)) { $arPolicy = $USER->GetSecurityPolicy(); $phpSessTimeout = ini_get("session.gc_maxlifetime"); if ($arPolicy["SESSION_TIMEOUT"] > 0) { $sessTimeout = min($arPolicy["SESSION_TIMEOUT"] * 60, $phpSessTimeout); } else { $sessTimeout = $phpSessTimeout; } $cookie_prefix = COption::GetOptionString('main', 'cookie_name', 'BITRIX_SM'); $salt = $_COOKIE[$cookie_prefix . '_UIDH'] . "|" . $_SERVER["REMOTE_ADDR"] . "|" . @filemtime($_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/classes/general/version.php") . "|" . LICENSE_KEY . "|" . CMain::GetServerUniqID(); $key = md5(bitrix_sessid() . $salt); $bShowMess = $USER->IsAuthorized() && COption::GetOptionString("main", "session_show_message", "Y") != "N"; $ext = array('ajax'); if ($bShowMess) { $ext[] = "fx"; } CUtil::InitJSCore($ext); $jsMsg = '<script type="text/javascript">' . "\n" . ($bShowMess ? 'bxSession.mess.messSessExpired = \'' . CUtil::JSEscape(GetMessage("MAIN_SESS_MESS", array("#TIMEOUT#" => round($sessTimeout / 60)))) . '\';' . "\n" : '') . 'bxSession.Expand(' . $sessTimeout . ', \'' . bitrix_sessid() . '\', ' . ($bShowMess ? 'true' : 'false') . ', \'' . $key . '\');' . "\n" . '</script>'; if ($APPLICATION->IsJSOptimized()) { $APPLICATION->AddHeadScript('/bitrix/js/main/session.js'); $APPLICATION->AddAdditionalJS($jsMsg); } else { $APPLICATION->AddHeadString('<script type="text/javascript" src="' . CUtil::GetAdditionalFileURL('/bitrix/js/main/session.js') . '"></script>' . "\n" . $jsMsg, true); } $_SESSION["BX_SESSION_COUNTER"] = intval($_SESSION["BX_SESSION_COUNTER"]) + 1; if (!defined("BX_SKIP_SESSION_TERMINATE_TIME")) { $_SESSION["BX_SESSION_TERMINATE_TIME"] = time() + $sessTimeout; } } //user auto time zone via js cookies if (CTimeZone::Enabled()) { CTimeZone::SetAutoCookie(); } // check user options set via cookie if ($USER->IsAuthorized()) { $cookieName = COption::GetOptionString("main", "cookie_name", "BITRIX_SM") . "_LAST_SETTINGS"; if (!empty($_COOKIE[$cookieName])) { CUserOptions::SetCookieOptions($cookieName); } } if (COption::GetOptionString("main", "buffer_content", "Y") == "Y" && (!defined("BX_BUFFER_USED") || BX_BUFFER_USED !== true)) { ob_start(array(&$APPLICATION, "EndBufferContent")); $APPLICATION->buffered = true; define("BX_BUFFER_USED", true); register_shutdown_function(create_function('', 'while(@ob_end_flush());')); } foreach (GetModuleEvents("main", "OnProlog", true) as $arEvent) { ExecuteModuleEventEx($arEvent); } }
/** * Unfolds internal short url. If url is not classified as a short link, returns input $url. * @param string $shortUrl Short URL. * @return string Full URL. */ protected static function unfoldShortLink($shortUrl) { $result = $shortUrl; if ($shortUri = \CBXShortUri::GetUri($shortUrl)) { $result = $shortUri['URI']; } return $result; }