mirror of
https://github.com/smarty-php/smarty.git
synced 2025-08-05 10:54:27 +02:00
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:
@@ -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;
|
||||||
|
Reference in New Issue
Block a user