Ejemplo n.º 1
0
        ?>
</td>
		</tr>
		</table>
	</td>
</tr>
<?php 
    }
    ?>
<tr class="heading">
	<td colspan="2"><?php 
    echo GetMessage("MAIN_OPTION_HTML_CACHE_OPT");
    ?>
</td>
	<?php 
    $arHTMLCacheOptions = CHTMLPagesCache::GetOptions();
    ?>
</tr>
<tr>
	<td><?php 
    echo GetMessage("MAIN_OPTION_HTML_CACHE_INC_MASK");
    ?>
:</td>
	<td>
		<input type="text" size="45" name="html_cache_include_mask" value="<?php 
    echo htmlspecialcharsbx($arHTMLCacheOptions["INCLUDE_MASK"]);
    ?>
">
	</td>
</tr>
<tr>
Ejemplo n.º 2
0
	public static function OnUserLogin()
	{
		global $APPLICATION, $USER;
		if (self::IsOn())
		{
			$arHTMLCacheOptions = CHTMLPagesCache::GetOptions();
			$arHTMLCacheOptions["GROUPS"][] = "2";
			$diff = array_diff($USER->GetUserGroupArray(), $arHTMLCacheOptions["GROUPS"]);

			if ($diff)
			{
				$APPLICATION->set_cookie("NCC", "Y");
				$APPLICATION->set_cookie("CC", "", 0);
			}
			else
			{
				$APPLICATION->set_cookie("CC", "Y");
				$APPLICATION->set_cookie("NCC", "", 0);
			}
		}
	}
Ejemplo n.º 3
0
 /**
  * OnBeforeEndBufferContent handler
  */
 public function onBeforeEndBufferContent()
 {
     global $APPLICATION;
     $frame = self::getInstance();
     $params = array();
     if ($frame->getUseAppCache()) {
         $manifest = \Bitrix\Main\Data\AppCacheManifest::getInstance();
         $params = $manifest->OnBeforeEndBufferContent();
         $params["CACHE_MODE"] = "APPCACHE";
         $params["PAGE_URL"] = \Bitrix\Main\Context::getCurrent()->getServer()->getRequestUri();
     } elseif ($frame->getUseHTMLCache()) {
         $staticHTMLCache = \Bitrix\Main\Data\StaticHtmlCache::getInstance();
         if ($staticHTMLCache->isCacheable()) {
             $params["CACHE_MODE"] = "HTMLCACHE";
             if (\Bitrix\Main\Config\Option::get("main", "~show_composite_banner", "Y") == "Y") {
                 $options = \CHTMLPagesCache::GetOptions();
                 $params["banner"] = array("url" => GetMessage("COMPOSITE_BANNER_URL"), "text" => GetMessage("COMPOSITE_BANNER_TEXT"), "bgcolor" => isset($options["BANNER_BGCOLOR"]) ? $options["BANNER_BGCOLOR"] : "", "style" => isset($options["BANNER_STYLE"]) ? $options["BANNER_STYLE"] : "");
             }
         } else {
             return;
         }
     }
     $params["storageBlocks"] = array();
     foreach ($frame->dynamicIDs as $id => $dynamicData) {
         if ($dynamicData["use_browser_storage"]) {
             $realId = isset($this->containers[$id]) ? $this->containers[$id] : "bxdynamic_" . $id;
             $params["storageBlocks"][] = $realId;
         }
     }
     $frame->injectedJS = $frame->getInjectedJs($params);
     $APPLICATION->AddHeadString($this->injectedJS["start"], false, "BEFORE_CSS");
     //When dynamic hit we'll throw spread cookies away
     if ($frame->getUseHTMLCache() && $staticHTMLCache->isCacheable()) {
         $APPLICATION->GetSpreadCookieHTML();
         \CJSCore::GetCoreMessagesScript();
     }
 }
Ejemplo n.º 4
0
 function SetEnabled($status)
 {
     $file_name = $_SERVER["DOCUMENT_ROOT"] . BX_PERSONAL_ROOT . "/html_pages/.enabled";
     if ($status) {
         RegisterModuleDependences("main", "OnEpilog", "main", "CHTMLPagesCache", "OnEpilog");
         RegisterModuleDependences("main", "OnLocalRedirect", "main", "CHTMLPagesCache", "OnEpilog");
         //For very first run we have to fall into defaults
         CHTMLPagesCache::SetOptions(CHTMLPagesCache::GetOptions());
         if (!file_exists($file_name)) {
             $f = fopen($file_name, "w");
             fwrite($f, "0,0,0,0,0");
             fclose($f);
             @chmod($file_name, defined("BX_FILE_PERMISSIONS") ? BX_FILE_PERMISSIONS : 0664);
         }
     } else {
         UnRegisterModuleDependences("main", "OnEpilog", "main", "CHTMLPagesCache", "OnEpilog");
         UnRegisterModuleDependences("main", "OnLocalRedirect", "main", "CHTMLPagesCache", "OnEpilog");
         if (file_exists($file_name)) {
             unlink($file_name);
         }
     }
 }