mirror of
https://github.com/smarty-php/smarty.git
synced 2025-08-06 11:24:27 +02:00
- bugfix untility compileAllConfig() did not create sha1 code for compiled template file names if template_dir was defined with no trailing DS
- bugfix on templateExists() for extends resource
This commit is contained in:
@@ -1,3 +1,7 @@
|
|||||||
|
18/09/2010
|
||||||
|
- bugfix untility compileAllConfig() did not create sha1 code for compiled template file names if template_dir was defined with no trailing DS
|
||||||
|
- bugfix on templateExists() for extends resource
|
||||||
|
|
||||||
17/09/2010
|
17/09/2010
|
||||||
- bugfix {$smarty.template} and {$smarty.current_dir} did not compile correctly within {block} tags
|
- bugfix {$smarty.template} and {$smarty.current_dir} did not compile correctly within {block} tags
|
||||||
- bugfix corrected error message on missing template files in extends resource
|
- bugfix corrected error message on missing template files in extends resource
|
||||||
|
@@ -37,11 +37,13 @@ class Smarty_Internal_Resource_Extends {
|
|||||||
*/
|
*/
|
||||||
public function isExisting($_template)
|
public function isExisting($_template)
|
||||||
{
|
{
|
||||||
if ($_template->getTemplateFilepath() === false) {
|
$_template->getTemplateFilepath();
|
||||||
|
foreach ($this->allFilepaths as $_filepath) {
|
||||||
|
if ($_filepath === false) {
|
||||||
return false;
|
return false;
|
||||||
} else {
|
}
|
||||||
return true;
|
}
|
||||||
}
|
return true;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Get filepath to template source
|
* Get filepath to template source
|
||||||
@@ -55,16 +57,13 @@ class Smarty_Internal_Resource_Extends {
|
|||||||
$_files = explode('|', $_template->resource_name);
|
$_files = explode('|', $_template->resource_name);
|
||||||
foreach ($_files as $_file) {
|
foreach ($_files as $_file) {
|
||||||
$_filepath = $_template->buildTemplateFilepath ($_file);
|
$_filepath = $_template->buildTemplateFilepath ($_file);
|
||||||
if ($_filepath === false) {
|
|
||||||
throw new SmartyException("Unable to load template 'file : {$_file}'");
|
|
||||||
}
|
|
||||||
if ($_filepath !== false) {
|
if ($_filepath !== false) {
|
||||||
if ($_template->security) {
|
if ($_template->security) {
|
||||||
$_template->smarty->security_handler->isTrustedResourceDir($_filepath);
|
$_template->smarty->security_handler->isTrustedResourceDir($_filepath);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$sha1String .= $_filepath;
|
$sha1String .= $_filepath;
|
||||||
$this->allFilepaths[] = $_filepath;
|
$this->allFilepaths[$_file] = $_filepath;
|
||||||
}
|
}
|
||||||
$_template->templateUid = sha1($sha1String);
|
$_template->templateUid = sha1($sha1String);
|
||||||
return $_filepath;
|
return $_filepath;
|
||||||
@@ -91,14 +90,19 @@ class Smarty_Internal_Resource_Extends {
|
|||||||
{
|
{
|
||||||
$this->template = $_template;
|
$this->template = $_template;
|
||||||
$_files = array_reverse($this->allFilepaths);
|
$_files = array_reverse($this->allFilepaths);
|
||||||
foreach ($_files as $_filepath) {
|
$_first = reset($_files);
|
||||||
|
$_last = end($_files);
|
||||||
|
foreach ($_files as $_file => $_filepath) {
|
||||||
|
if ($_filepath === false) {
|
||||||
|
throw new SmartyException("Unable to load template 'file : {$_file}'");
|
||||||
|
}
|
||||||
// read template file
|
// read template file
|
||||||
if ($_filepath != $_files[0]) {
|
if ($_filepath != $_first) {
|
||||||
$_template->properties['file_dependency'][sha1($_filepath)] = array($_filepath, filemtime($_filepath));
|
$_template->properties['file_dependency'][sha1($_filepath)] = array($_filepath, filemtime($_filepath));
|
||||||
}
|
}
|
||||||
$_template->template_filepath = $_filepath;
|
$_template->template_filepath = $_filepath;
|
||||||
$_content = file_get_contents($_filepath);
|
$_content = file_get_contents($_filepath);
|
||||||
if ($_filepath != $_files[count($_files)-1]) {
|
if ($_filepath != $_last) {
|
||||||
if (preg_match_all("!({$this->_ldl}block\s(.+?){$this->_rdl})!", $_content, $_open) !=
|
if (preg_match_all("!({$this->_ldl}block\s(.+?){$this->_rdl})!", $_content, $_open) !=
|
||||||
preg_match_all("!({$this->_ldl}/block(.*?){$this->_rdl})!", $_content, $_close)) {
|
preg_match_all("!({$this->_ldl}/block(.*?){$this->_rdl})!", $_content, $_close)) {
|
||||||
$this->smarty->trigger_error("unmatched {block} {/block} pairs in file '$_filepath'");
|
$this->smarty->trigger_error("unmatched {block} {/block} pairs in file '$_filepath'");
|
||||||
@@ -127,7 +131,6 @@ class Smarty_Internal_Resource_Extends {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// $_template->template_filepath = $saved_filepath;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -127,7 +127,7 @@ class Smarty_Internal_Utility {
|
|||||||
if ($_fileinfo->getPath() == substr($_dir, 0, -1)) {
|
if ($_fileinfo->getPath() == substr($_dir, 0, -1)) {
|
||||||
$_config_file = $_file;
|
$_config_file = $_file;
|
||||||
} else {
|
} else {
|
||||||
$_config_file = substr($_fileinfo->getPath(), strlen($_dir)) . DS . $_file;
|
$_config_file = substr(substr($_fileinfo->getPath(), strlen($_dir)) . DS . $_file,1);
|
||||||
}
|
}
|
||||||
echo '<br>', $_dir, '---', $_config_file;
|
echo '<br>', $_dir, '---', $_config_file;
|
||||||
flush();
|
flush();
|
||||||
|
Reference in New Issue
Block a user