- internal change on merging some data

This commit is contained in:
Uwe.Tews
2009-12-29 22:27:04 +00:00
parent 8327f57f36
commit 7a8e24cfc1
3 changed files with 8 additions and 18 deletions

View File

@@ -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

View File

@@ -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;

View File

@@ -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 = "<?php /*%%SmartyHeaderCode:{$this->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'])) {