moved setting of a default resource_base_path from

Smarty::_parse_resource_name() to Smarty::_fetch_resource_info()

this shouldn't affect anything, since all calls to
_parse_resource_name() that are not done from within
_fetch_resource_info() all pass their own resource_base_path
This commit is contained in:
messju
2004-03-18 07:05:29 +00:00
parent b49b367ca3
commit 5a37e025ae

View File

@@ -1535,6 +1535,8 @@ class Smarty
$_params = array('resource_name' => $params['resource_name']) ; $_params = array('resource_name' => $params['resource_name']) ;
if (isset($params['resource_base_path'])) if (isset($params['resource_base_path']))
$_params['resource_base_path'] = $params['resource_base_path']; $_params['resource_base_path'] = $params['resource_base_path'];
else
$_params['resource_base_path'] = $this->template_dir;
if ($this->_parse_resource_name($_params)) { if ($this->_parse_resource_name($_params)) {
$_resource_type = $_params['resource_type']; $_resource_type = $_params['resource_type'];
@@ -1633,12 +1635,7 @@ class Smarty
if (!preg_match("/^([\/\\\\]|[a-zA-Z]:[\/\\\\])/", $params['resource_name'])) { if (!preg_match("/^([\/\\\\]|[a-zA-Z]:[\/\\\\])/", $params['resource_name'])) {
// relative pathname to $params['resource_base_path'] // relative pathname to $params['resource_base_path']
// use the first directory where the file is found // use the first directory where the file is found
if (isset($params['resource_base_path'])) { foreach ((array)$params['resource_base_path'] as $_curr_path) {
$_resource_base_path = (array)$params['resource_base_path'];
} else {
$_resource_base_path = (array)$this->template_dir;
}
foreach ($_resource_base_path as $_curr_path) {
$_fullpath = $_curr_path . DIRECTORY_SEPARATOR . $params['resource_name']; $_fullpath = $_curr_path . DIRECTORY_SEPARATOR . $params['resource_name'];
if (file_exists($_fullpath) && is_file($_fullpath)) { if (file_exists($_fullpath) && is_file($_fullpath)) {
$params['resource_name'] = $_fullpath; $params['resource_name'] = $_fullpath;