From 7a8e24cfc19f55c400c017fa10e51de213b397a2 Mon Sep 17 00:00:00 2001 From: "Uwe.Tews" Date: Tue, 29 Dec 2009 22:27:04 +0000 Subject: [PATCH] - internal change on merging some data --- change_log.txt | 3 ++- .../smarty_internal_compile_block.php | 3 ++- libs/sysplugins/smarty_internal_template.php | 20 ++++--------------- 3 files changed, 8 insertions(+), 18 deletions(-) diff --git a/change_log.txt b/change_log.txt index f14efdfd..71c32d7f 100644 --- a/change_log.txt +++ b/change_log.txt @@ -1,6 +1,7 @@ 12/29/2009 - use sha1() for filepath encoding -- updates on nocache_hash handling +- updates on nocache_hash handling +- internal change on merging some data 12/28/2009 - update for security fixes diff --git a/libs/sysplugins/smarty_internal_compile_block.php b/libs/sysplugins/smarty_internal_compile_block.php index bb99755b..d884fd89 100644 --- a/libs/sysplugins/smarty_internal_compile_block.php +++ b/libs/sysplugins/smarty_internal_compile_block.php @@ -79,7 +79,8 @@ class Smarty_Internal_Compile_Blockclose extends Smarty_Internal_CompileBase { } $compiler->template->properties['file_dependency'] = array_merge($compiler->template->properties['file_dependency'], $_tpl->properties['file_dependency']); $compiler->template->properties['function'] = array_merge($compiler->template->properties['function'], $_tpl->properties['function']); - $compiler->template->required_plugins = array_merge_recursive($compiler->template->required_plugins, $_tpl->required_plugins); + $compiler->template->required_plugins['compiled'] = array_merge($compiler->template->required_plugins['compiled'], $_tpl->required_plugins['compiled']); + $compiler->template->required_plugins['cache'] = array_merge($compiler->template->required_plugins['cache'], $_tpl->required_plugins['cache']); unset($_tpl); } else { $_output = $compiler->template->extracted_compiled_code; diff --git a/libs/sysplugins/smarty_internal_template.php b/libs/sysplugins/smarty_internal_template.php index 773de21e..0531c96a 100644 --- a/libs/sysplugins/smarty_internal_template.php +++ b/libs/sysplugins/smarty_internal_template.php @@ -68,7 +68,7 @@ class Smarty_Internal_Template extends Smarty_Internal_Data { // storage for block data public $block_data = array(); // required plugins - public $required_plugins = array(); + public $required_plugins = array('compiled' => array(), 'cache' => array()); /** * Create template data object @@ -360,10 +360,10 @@ class Smarty_Internal_Template extends Smarty_Internal_Data { public function isCached () { if ($this->isCached === null) { + $this->isCached = false; if (($this->caching == 1 || $this->caching == 2) && !$this->resource_object->isEvaluated && !$this->force_compile && !$this->force_cache) { $cachedTimestamp = $this->getCachedTimestamp(); if ($cachedTimestamp === false) { - $this->isCached = false; return $this->isCached; } if ($this->caching === SMARTY_CACHING_LIFETIME_SAVED || ($this->caching == SMARTY_CACHING_LIFETIME_CURRENT && (time() <= ($cachedTimestamp + $this->cache_lifetime) || $this->cache_lifetime < 0))) { @@ -374,9 +374,6 @@ class Smarty_Internal_Template extends Smarty_Internal_Data { if ($this->smarty->debugging) { Smarty_Internal_Debug::end_cache($this); } - if ($this->isCached === false) { - return $this->isCached; - } if ($this->cacheFileChecked) { $this->isCached = true; return $this->isCached; @@ -384,7 +381,6 @@ class Smarty_Internal_Template extends Smarty_Internal_Data { $this->cacheFileChecked = true; if ($this->caching === SMARTY_CACHING_LIFETIME_SAVED && $this->properties['cache_lifetime'] > 0 && (time() > ($this->getCachedTimestamp() + $this->properties['cache_lifetime']))) { $this->rendered_content = null; - $this->isCached = false; return $this->isCached; } if (!empty($this->properties['file_dependency']) && $this->smarty->compile_check) { @@ -399,7 +395,6 @@ class Smarty_Internal_Template extends Smarty_Internal_Data { // If ($mtime > $this->getCachedTimestamp()) { If ($mtime > $_file_to_check[1]) { $this->rendered_content = null; - $this->isCached = false; return $this->isCached; } } @@ -408,9 +403,6 @@ class Smarty_Internal_Template extends Smarty_Internal_Data { } } } - if ($this->isCached === null) { - $this->isCached = false; - } return $this->isCached; } @@ -481,7 +473,8 @@ class Smarty_Internal_Template extends Smarty_Internal_Data { } if ($this->parent instanceof Smarty_Template or $this->parent instanceof Smarty_Internal_Template) { $this->parent->properties['file_dependency'] = array_merge($this->parent->properties['file_dependency'], $this->properties['file_dependency']); - $this->parent->required_plugins = array_merge_recursive($this->parent->required_plugins, $this->required_plugins); + $this->parent->required_plugins['compiled'] = array_merge($this->parent->required_plugins['compiled'], $this->required_plugins['compiled']); + $this->parent->required_plugins['cache'] = array_merge($this->parent->required_plugins['cache'], $this->required_plugins['cache']); } if ($this->smarty->debugging) { Smarty_Internal_Debug::end_render($this); @@ -751,7 +744,6 @@ class Smarty_Internal_Template extends Smarty_Internal_Data { } } // build property code - $this->properties['fullpath'] = realpath($this->resource_object->getTemplateFilepath($this)); $this->properties['has_nocache_code'] = $this->has_nocache_code; $properties_string = "properties['nocache_hash']}%%*/" ; if ($this->smarty->direct_access_security) { @@ -779,10 +771,6 @@ class Smarty_Internal_Template extends Smarty_Internal_Data { */ public function decodeProperties ($properties) { - if ($properties['fullpath'] != realpath($this->resource_object->getTemplateFilepath($this))) { - $this->isCached = false; - $this->mustCompile = true; - } ; $this->has_nocache_code = $properties['has_nocache_code']; $this->properties['nocache_hash'] = $properties['nocache_hash']; if (isset($properties['cache_lifetime'])) {