Пример #1
0
 /**
  * Function ends the caching block of the component execution.
  *
  * <p>Note: automaticly called by includeComponentTemplate.</p>
  * @return void
  *
  */
 public final function endResultCache()
 {
     global $NavNum, $CACHE_MANAGER;
     if (!$this->__bInited) {
         return null;
     }
     if (!$this->__cache) {
         if ($this->__parent) {
             foreach ($this->__children_css as $cssPath) {
                 $this->__parent->addChildCSS($cssPath);
             }
             foreach ($this->__children_js as $jsPath) {
                 $this->__parent->addChildJS($jsPath);
             }
             foreach ($this->__children_epilogs as $epilogFile) {
                 $this->__parent->addChildEpilog($epilogFile);
             }
         }
         return null;
     }
     $arCache = array("arResult" => $this->arResult);
     if ($this->__template) {
         $arCache["templateCachedData"] =& $this->__template->getCachedData();
         if ($this->__component_epilog) {
             $arCache["templateCachedData"]["component_epilog"] = $this->__component_epilog;
         }
     } else {
         $arCache["templateCachedData"] = array();
     }
     if ($this->__NavNum !== false && $this->__NavNum !== $NavNum) {
         $arCache["templateCachedData"]["__NavNum"] = $NavNum - $this->__NavNum;
     }
     if (!empty($this->__children_css)) {
         $arCache["templateCachedData"]["__children_css"] = $this->__children_css;
         if ($this->__parent) {
             foreach ($this->__children_css as $cssPath) {
                 $this->__parent->addChildCSS($cssPath);
             }
         }
     }
     if (!empty($this->__children_js)) {
         $arCache["templateCachedData"]["__children_js"] = $this->__children_js;
         if ($this->__parent) {
             foreach ($this->__children_js as $jsPath) {
                 $this->__parent->addChildJS($jsPath);
             }
         }
     }
     if (!empty($this->__children_epilogs)) {
         $arCache["templateCachedData"]["__children_epilogs"] = $this->__children_epilogs;
         if ($this->__parent) {
             foreach ($this->__children_epilogs as $epilogFile) {
                 $this->__parent->addChildEpilog($epilogFile);
             }
         }
     }
     if (!empty($this->__view)) {
         $arCache["templateCachedData"]["__view"] = $this->__view;
     }
     if (!empty($this->__editButtons)) {
         $arCache["templateCachedData"]["__editButtons"] = $this->__editButtons;
     }
     $cacheWasStarted = $this->__cache->isStarted();
     $this->__cache->endDataCache($arCache);
     if (defined("FX_COMP_MANAGED_CACHE") && $cacheWasStarted) {
         $CACHE_MANAGER->endTagCache();
     }
     $this->__cache = null;
 }
Пример #2
0
	for ($i = 0, $cnt = count($arTemplatesList); $i < $cnt; $i++)
	{
		if($arComponent["DATA"]["TEMPLATE_NAME"]<>"" && $arTemplatesList[$i]["NAME"] == $arComponent["DATA"]["TEMPLATE_NAME"]
			|| $arComponent["DATA"]["TEMPLATE_NAME"]=="" && $arTemplatesList[$i]["NAME"] == ".default")
		{
			$templateSiteTemplate = $arTemplatesList[$i]["TEMPLATE"];
			break;
		}
	}

	/* save parameters to file */
	if($_SERVER["REQUEST_METHOD"] == "POST" && $_REQUEST["action"] == "save" && $arComponent !== false && $arComponentDescription !== false && check_freetrix_sessid())
	{
		//check template name
		$sTemplateName = trim($_POST["TEMPLATE_NAME"]);
		if($sTemplateName == '' || !CFreetrixComponentTemplate::CheckName($sTemplateName))
			$sTemplateName = '.default';

		if ($_POST["SITE_TEMPLATE"] != $_GET["template_id"] && $_POST["SITE_TEMPLATE"] != ".default")
			$_POST["USE_TEMPLATE"] = "N";

		if (CComponentUtil::CopyTemplate($arComponent["DATA"]["COMPONENT_NAME"], $arComponent["DATA"]["TEMPLATE_NAME"], ((strlen($templateSiteTemplate) > 0) ? $templateSiteTemplate : false), $_POST["SITE_TEMPLATE"], $sTemplateName, false))
		{
			if ($_POST["USE_TEMPLATE"] == "Y")
			{
				$code = ($arComponent["DATA"]["VARIABLE"]?$arComponent["DATA"]["VARIABLE"]."=":"").
					"\$APPLICATION->IncludeComponent(\"".$arComponent["DATA"]["COMPONENT_NAME"]."\", ".
					"\"".$sTemplateName."\", ".
					"Array(\n\t".PHPParser::ReturnPHPStr2($arComponent["DATA"]["PARAMS"], $arParameters)."\n\t)".
					",\n\t".(strlen($arComponent["DATA"]["PARENT_COMP"]) > 0? $arComponent["DATA"]["PARENT_COMP"] : "false").
					(!empty($arComponent["DATA"]["FUNCTION_PARAMS"])? ",\n\t"."array(\n\t".PHPParser::ReturnPHPStr2($arComponent["DATA"]["FUNCTION_PARAMS"])."\n\t)" : "").