mirror of
https://github.com/smarty-php/smarty.git
synced 2025-08-05 10:54:27 +02:00
unrolled call to the is_compiled()-check to be able to supply the
correct resource_base_path for config_load. this avoids errors when config-files are accessed where security is enabled. thanks to shuther for pointing out this bug.
This commit is contained in:
1
NEWS
1
NEWS
@@ -1,3 +1,4 @@
|
|||||||
|
- fix permission handling with security and config_load (messju)
|
||||||
- removed '.' from the list of default template locations in
|
- removed '.' from the list of default template locations in
|
||||||
_parse_resource_name() (messju)
|
_parse_resource_name() (messju)
|
||||||
- fix avoid warning with template_exists() on an absolute paths (messju)
|
- fix avoid warning with template_exists() on an absolute paths (messju)
|
||||||
|
@@ -53,7 +53,9 @@ function smarty_function_config_load($params, &$smarty)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$_params = array('resource_name' => $_file, 'resource_base_path' => $smarty->config_dir);
|
$_params = array('resource_name' => $_file,
|
||||||
|
'resource_base_path' => $smarty->config_dir,
|
||||||
|
'get_source' => false);
|
||||||
$smarty->_parse_resource_name($_params);
|
$smarty->_parse_resource_name($_params);
|
||||||
$_file_path = $_params['resource_type'] . ':' . $_params['resource_name'];
|
$_file_path = $_params['resource_type'] . ':' . $_params['resource_name'];
|
||||||
if (isset($_section))
|
if (isset($_section))
|
||||||
@@ -61,10 +63,19 @@ function smarty_function_config_load($params, &$smarty)
|
|||||||
else
|
else
|
||||||
$_compile_file = $smarty->_get_compile_path($_file_path);
|
$_compile_file = $smarty->_get_compile_path($_file_path);
|
||||||
|
|
||||||
if($smarty->force_compile
|
if($smarty->force_compile || !file_exists($_compile_file)) {
|
||||||
|| !file_exists($_compile_file)
|
$_compile = true;
|
||||||
|| ($smarty->compile_check
|
} elseif ($smarty->compile_check) {
|
||||||
&& !$smarty->_is_compiled($_file_path, $_compile_file))) {
|
$_params = array('resource_name' => $_file,
|
||||||
|
'resource_base_path' => $smarty->config_dir,
|
||||||
|
'get_source' => false);
|
||||||
|
$_compile = $smarty->_fetch_resource_info($_params) &&
|
||||||
|
$_params['resource_timestamp'] > filemtime($_compile_file);
|
||||||
|
} else {
|
||||||
|
$_compile = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if($_compile) {
|
||||||
// compile config file
|
// compile config file
|
||||||
if(!is_object($smarty->_conf_obj)) {
|
if(!is_object($smarty->_conf_obj)) {
|
||||||
require_once SMARTY_DIR . $smarty->config_class . '.class.php';
|
require_once SMARTY_DIR . $smarty->config_class . '.class.php';
|
||||||
@@ -74,7 +85,10 @@ function smarty_function_config_load($params, &$smarty)
|
|||||||
$smarty->_conf_obj->read_hidden = $smarty->config_read_hidden;
|
$smarty->_conf_obj->read_hidden = $smarty->config_read_hidden;
|
||||||
$smarty->_conf_obj->fix_newlines = $smarty->config_fix_newlines;
|
$smarty->_conf_obj->fix_newlines = $smarty->config_fix_newlines;
|
||||||
}
|
}
|
||||||
$_params = array('resource_name' => $_file, 'resource_base_path' => $smarty->config_dir);
|
|
||||||
|
$_params = array('resource_name' => $_file,
|
||||||
|
'resource_base_path' => $smarty->config_dir,
|
||||||
|
$_params['get_source'] = true);
|
||||||
if (!$smarty->_fetch_resource_info($_params)) {
|
if (!$smarty->_fetch_resource_info($_params)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user