mirror of
https://github.com/smarty-php/smarty.git
synced 2025-10-17 22:45:20 +02:00
started moving from $this to $smarty in core.*.php
This commit is contained in:
@@ -15,12 +15,12 @@
|
||||
* @return boolean
|
||||
*/
|
||||
|
||||
function smarty_core_get_php_resource(&$params, &$this)
|
||||
function smarty_core_get_php_resource(&$params, &$smarty)
|
||||
{
|
||||
|
||||
$params['resource_base_path'] = $this->trusted_dir;
|
||||
$params['resource_base_path'] = $smarty->trusted_dir;
|
||||
require_once(SMARTY_DIR . 'core' . DIRECTORY_SEPARATOR . 'core.parse_resource_name.php');
|
||||
smarty_core_parse_resource_name($params, $this);
|
||||
smarty_core_parse_resource_name($params, $smarty);
|
||||
|
||||
/*
|
||||
* Find out if the resource exists.
|
||||
@@ -34,37 +34,37 @@ function smarty_core_get_php_resource(&$params, &$this)
|
||||
// test for file in include_path
|
||||
$_params = array('file_path' => $params['resource_name']);
|
||||
require_once(SMARTY_DIR . 'core' . DIRECTORY_SEPARATOR . 'core.get_include_path.php');
|
||||
if(smarty_core_get_include_path($_params, $this)) {
|
||||
if(smarty_core_get_include_path($_params, $smarty)) {
|
||||
$_include_path = $_params['new_file_path'];
|
||||
$_readable = true;
|
||||
}
|
||||
}
|
||||
} else if ($params['resource_type'] != 'file') {
|
||||
$_template_source = null;
|
||||
$_readable = $this->_plugin_implementation_exists($this->_plugins['resource'][$params['resource_type']][0][0])
|
||||
&& call_user_func_array($this->_plugins['resource'][$params['resource_type']][0][0],
|
||||
array($params['resource_name'], &$_template_source, &$this));
|
||||
$_readable = $smarty->_plugin_implementation_exists($smarty->_plugins['resource'][$params['resource_type']][0][0])
|
||||
&& call_user_func_array($smarty->_plugins['resource'][$params['resource_type']][0][0],
|
||||
array($params['resource_name'], &$_template_source, &$smarty));
|
||||
}
|
||||
|
||||
/*
|
||||
* Set the error function, depending on which class calls us.
|
||||
*/
|
||||
if (method_exists($this, '_syntax_error')) {
|
||||
if (method_exists($smarty, '_syntax_error')) {
|
||||
$_error_funcc = '_syntax_error';
|
||||
} else {
|
||||
$_error_funcc = 'trigger_error';
|
||||
}
|
||||
|
||||
if ($_readable) {
|
||||
if ($this->security) {
|
||||
if ($smarty->security) {
|
||||
require_once(SMARTY_DIR . 'core' . DIRECTORY_SEPARATOR . 'core.is_trusted.php');
|
||||
if (!smarty_core_is_trusted($params, $this)) {
|
||||
$this->$_error_funcc('(secure mode) ' . $params['resource_type'] . ':' . $params['resource_name'] . ' is not trusted');
|
||||
if (!smarty_core_is_trusted($params, $smarty)) {
|
||||
$smarty->$_error_funcc('(secure mode) ' . $params['resource_type'] . ':' . $params['resource_name'] . ' is not trusted');
|
||||
return false;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$this->$_error_funcc($params['resource_type'] . ':' . $params['resource_name'] . ' is not readable');
|
||||
$smarty->$_error_funcc($params['resource_type'] . ':' . $params['resource_name'] . ' is not readable');
|
||||
return false;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user