mirror of
https://github.com/smarty-php/smarty.git
synced 2025-08-05 10:54:27 +02:00
rename file, commit
This commit is contained in:
@@ -9,11 +9,11 @@
|
|||||||
* fetch the template info. Gets timestamp, and source
|
* fetch the template info. Gets timestamp, and source
|
||||||
* if get_source is true
|
* if get_source is true
|
||||||
*
|
*
|
||||||
* sets $template_source to the source of the template, and
|
* sets $file_source to the source of the template, and
|
||||||
* $template_timestamp to its time stamp
|
* $file_timestamp to its time stamp
|
||||||
* @param string $tpl_path
|
* @param string $file_path
|
||||||
* @param string $template_source
|
* @param string $file_source
|
||||||
* @param integer $template_timestamp
|
* @param integer $file_timestamp
|
||||||
* @param boolean $get_source
|
* @param boolean $get_source
|
||||||
* @param boolean $quiet
|
* @param boolean $quiet
|
||||||
* @return boolean
|
* @return boolean
|
||||||
@@ -21,14 +21,14 @@
|
|||||||
|
|
||||||
// $tpl_path, &$template_source, &$template_timestamp, $get_source = true, $quiet = false
|
// $tpl_path, &$template_source, &$template_timestamp, $get_source = true, $quiet = false
|
||||||
|
|
||||||
function smarty_core_fetch_template_info(&$params, &$this)
|
function smarty_core_fetch_file_info(&$params, &$this)
|
||||||
{
|
{
|
||||||
|
|
||||||
if(!isset($params['get_source'])) { $params['get_source'] = true; }
|
if(!isset($params['get_source'])) { $params['get_source'] = true; }
|
||||||
if(!isset($params['quiet'])) { $params['quiet'] = false; }
|
if(!isset($params['quiet'])) { $params['quiet'] = false; }
|
||||||
|
|
||||||
$_return = false;
|
$_return = false;
|
||||||
$_params = array('file_base_path' => $this->template_dir,
|
$_params = array('file_path' => $params['file_path']) ;
|
||||||
'file_path' => $params['tpl_path']) ;
|
|
||||||
require_once(SMARTY_DIR . 'core/core.parse_file_path.php');
|
require_once(SMARTY_DIR . 'core/core.parse_file_path.php');
|
||||||
if (smarty_core_parse_file_path($_params, $this)) {
|
if (smarty_core_parse_file_path($_params, $this)) {
|
||||||
$_resource_type = $_params['resource_type'];
|
$_resource_type = $_params['resource_type'];
|
||||||
@@ -36,9 +36,9 @@ function smarty_core_fetch_template_info(&$params, &$this)
|
|||||||
switch ($_resource_type) {
|
switch ($_resource_type) {
|
||||||
case 'file':
|
case 'file':
|
||||||
if ($params['get_source']) {
|
if ($params['get_source']) {
|
||||||
$params['template_source'] = $this->_read_file($_resource_name);
|
$params['file_source'] = $this->_read_file($_resource_name);
|
||||||
}
|
}
|
||||||
$params['template_timestamp'] = filemtime($_resource_name);
|
$params['file_timestamp'] = filemtime($_resource_name);
|
||||||
$_return = true;
|
$_return = true;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -47,14 +47,14 @@ function smarty_core_fetch_template_info(&$params, &$this)
|
|||||||
if ($params['get_source']) {
|
if ($params['get_source']) {
|
||||||
$_source_return = isset($this->_plugins['resource'][$_resource_type]) &&
|
$_source_return = isset($this->_plugins['resource'][$_resource_type]) &&
|
||||||
call_user_func_array($this->_plugins['resource'][$_resource_type][0][0],
|
call_user_func_array($this->_plugins['resource'][$_resource_type][0][0],
|
||||||
array($_resource_name, &$params['template_source'], &$this));
|
array($_resource_name, &$params['file_source'], &$this));
|
||||||
} else {
|
} else {
|
||||||
$_source_return = true;
|
$_source_return = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
$_timestamp_return = isset($this->_plugins['resource'][$_resource_type]) &&
|
$_timestamp_return = isset($this->_plugins['resource'][$_resource_type]) &&
|
||||||
call_user_func_array($this->_plugins['resource'][$_resource_type][0][1],
|
call_user_func_array($this->_plugins['resource'][$_resource_type][0][1],
|
||||||
array($_resource_name, &$params['template_timestamp'], &$this));
|
array($_resource_name, &$params['file_timestamp'], &$this));
|
||||||
|
|
||||||
$_return = $_source_return && $_timestamp_return;
|
$_return = $_source_return && $_timestamp_return;
|
||||||
break;
|
break;
|
||||||
@@ -69,7 +69,7 @@ function smarty_core_fetch_template_info(&$params, &$this)
|
|||||||
} else {
|
} else {
|
||||||
$_return = call_user_func_array(
|
$_return = call_user_func_array(
|
||||||
$this->default_template_handler_func,
|
$this->default_template_handler_func,
|
||||||
array($_resource_type, $_resource_name, &$params['template_source'], &$params['template_timestamp'], &$this));
|
array($_resource_type, $_resource_name, &$params['file_source'], &$params['file_timestamp'], &$this));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -77,13 +77,13 @@ function smarty_core_fetch_template_info(&$params, &$this)
|
|||||||
require_once(SMARTY_DIR . 'core/core.is_secure.php');
|
require_once(SMARTY_DIR . 'core/core.is_secure.php');
|
||||||
if (!$_return) {
|
if (!$_return) {
|
||||||
if (!$params['quiet']) {
|
if (!$params['quiet']) {
|
||||||
$this->trigger_error('unable to read template resource: "' . $params['tpl_path'] . '"');
|
$this->trigger_error('unable to read template resource: "' . $params['file_path'] . '"');
|
||||||
}
|
}
|
||||||
} else if ($_return && $this->security && !smarty_core_is_secure($_params, $this)) {
|
} else if ($_return && $this->security && !smarty_core_is_secure($_params, $this)) {
|
||||||
if (!$params['quiet'])
|
if (!$params['quiet'])
|
||||||
$this->trigger_error('(secure mode) accessing "' . $params['tpl_path'] . '" is not allowed');
|
$this->trigger_error('(secure mode) accessing "' . $params['file_path'] . '" is not allowed');
|
||||||
$params['template_source'] = null;
|
$params['file_source'] = null;
|
||||||
$params['template_timestamp'] = null;
|
$params['file_timestamp'] = null;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return $_return;
|
return $_return;
|
Reference in New Issue
Block a user