当前位置: 首页>>代码示例>>PHP>>正文


PHP CTimeZone::SetAutoCookie方法代码示例

本文整理汇总了PHP中CTimeZone::SetAutoCookie方法的典型用法代码示例。如果您正苦于以下问题:PHP CTimeZone::SetAutoCookie方法的具体用法?PHP CTimeZone::SetAutoCookie怎么用?PHP CTimeZone::SetAutoCookie使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CTimeZone的用法示例。


在下文中一共展示了CTimeZone::SetAutoCookie方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: PrologActions

 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);
     }
 }
开发者ID:k-kalashnikov,项目名称:geekcon_new,代码行数:65,代码来源:main.php

示例2: PrologActions

 public static function PrologActions()
 {
     /** @global CMain $APPLICATION */
     global $APPLICATION, $USER;
     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(function () {
             // define("BX_BUFFER_SHUTDOWN", true);
             for ($i = 0, $n = ob_get_level(); $i < $n; $i++) {
                 ob_end_flush();
             }
         });
     }
     //session expander
     if (COption::GetOptionString("main", "session_expand", "Y") != "N" && (!defined("BX_SKIP_SESSION_EXPAND") || BX_SKIP_SESSION_EXPAND === false)) {
         //only for authorized
         if (COption::GetOptionString("main", "session_auth_only", "Y") != "Y" || $USER->IsAuthorized()) {
             $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'] . "|" . $USER->GetID() . "|" . $_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";
             CUtil::InitJSCore(array('ajax', 'ls'));
             $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>';
             $APPLICATION->AddHeadScript('/bitrix/js/main/session.js');
             $APPLICATION->AddAdditionalJS($jsMsg);
             $_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() && (!defined("BX_SKIP_TIMEZONE_COOKIE") || BX_SKIP_TIMEZONE_COOKIE === false)) {
         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);
         }
     }
     foreach (GetModuleEvents("main", "OnProlog", true) as $arEvent) {
         ExecuteModuleEventEx($arEvent);
     }
 }
开发者ID:andy-profi,项目名称:bxApiDocs,代码行数:55,代码来源:main.php


注:本文中的CTimeZone::SetAutoCookie方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。