mirror of
https://github.com/smarty-php/smarty.git
synced 2025-08-04 10:24:26 +02:00
only loop through relative paths for PHP include_path, remove $_relative variable
This commit is contained in:
@@ -1674,14 +1674,11 @@ function _run_insert_handler($args)
|
|||||||
|
|
||||||
// see if path is relative
|
// see if path is relative
|
||||||
if (!preg_match("/^([\/\\\\]|[a-zA-Z]:[\/\\\\])/", $_plugin_dir)) {
|
if (!preg_match("/^([\/\\\\]|[a-zA-Z]:[\/\\\\])/", $_plugin_dir)) {
|
||||||
$_relative = true;
|
$_relative_paths[] = $_plugin_dir;
|
||||||
// relative path, see if it is in the SMARTY_DIR
|
// relative path, see if it is in the SMARTY_DIR
|
||||||
if (@is_readable(SMARTY_DIR . $_plugin_filepath)) {
|
if (@is_readable(SMARTY_DIR . $_plugin_filepath)) {
|
||||||
return SMARTY_DIR . $_plugin_filepath;
|
return SMARTY_DIR . $_plugin_filepath;
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
// absolute path
|
|
||||||
$_relative = false;
|
|
||||||
}
|
}
|
||||||
// try relative to cwd (or absolute)
|
// try relative to cwd (or absolute)
|
||||||
if (@is_readable($_plugin_filepath)) {
|
if (@is_readable($_plugin_filepath)) {
|
||||||
@@ -1690,8 +1687,8 @@ function _run_insert_handler($args)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// still not found, try PHP include_path
|
// still not found, try PHP include_path
|
||||||
if($_relative) {
|
if(isset($_relative_paths)) {
|
||||||
foreach ((array)$this->plugins_dir as $_plugin_dir) {
|
foreach ((array)$_relative_paths as $_plugin_dir) {
|
||||||
|
|
||||||
$_plugin_filepath = $_plugin_dir . DIR_SEP . $_plugin_filename;
|
$_plugin_filepath = $_plugin_dir . DIR_SEP . $_plugin_filename;
|
||||||
|
|
||||||
|
@@ -1674,14 +1674,11 @@ function _run_insert_handler($args)
|
|||||||
|
|
||||||
// see if path is relative
|
// see if path is relative
|
||||||
if (!preg_match("/^([\/\\\\]|[a-zA-Z]:[\/\\\\])/", $_plugin_dir)) {
|
if (!preg_match("/^([\/\\\\]|[a-zA-Z]:[\/\\\\])/", $_plugin_dir)) {
|
||||||
$_relative = true;
|
$_relative_paths[] = $_plugin_dir;
|
||||||
// relative path, see if it is in the SMARTY_DIR
|
// relative path, see if it is in the SMARTY_DIR
|
||||||
if (@is_readable(SMARTY_DIR . $_plugin_filepath)) {
|
if (@is_readable(SMARTY_DIR . $_plugin_filepath)) {
|
||||||
return SMARTY_DIR . $_plugin_filepath;
|
return SMARTY_DIR . $_plugin_filepath;
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
// absolute path
|
|
||||||
$_relative = false;
|
|
||||||
}
|
}
|
||||||
// try relative to cwd (or absolute)
|
// try relative to cwd (or absolute)
|
||||||
if (@is_readable($_plugin_filepath)) {
|
if (@is_readable($_plugin_filepath)) {
|
||||||
@@ -1690,8 +1687,8 @@ function _run_insert_handler($args)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// still not found, try PHP include_path
|
// still not found, try PHP include_path
|
||||||
if($_relative) {
|
if(isset($_relative_paths)) {
|
||||||
foreach ((array)$this->plugins_dir as $_plugin_dir) {
|
foreach ((array)$_relative_paths as $_plugin_dir) {
|
||||||
|
|
||||||
$_plugin_filepath = $_plugin_dir . DIR_SEP . $_plugin_filename;
|
$_plugin_filepath = $_plugin_dir . DIR_SEP . $_plugin_filename;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user