From abf7416f34455e12c124cff03d58e896010faf43 Mon Sep 17 00:00:00 2001 From: mohrt Date: Wed, 26 Jun 2002 15:08:35 +0000 Subject: [PATCH] update plugin search logic --- Smarty.class.php | 21 ++++++++++----------- libs/Smarty.class.php | 21 ++++++++++----------- 2 files changed, 20 insertions(+), 22 deletions(-) diff --git a/Smarty.class.php b/Smarty.class.php index ce211223..3719a7ee 100644 --- a/Smarty.class.php +++ b/Smarty.class.php @@ -1672,24 +1672,23 @@ function _run_insert_handler($args) $_plugin_filepath = $_plugin_dir . DIR_SEP . $_plugin_filename; - if (!preg_match("/^([\/\\\\]|[a-zA-Z]:[\/\\\\])/", $_plugin_dir)) { - // relative path - $_relative = true; - $_plugin_filepath = SMARTY_DIR . $_plugin_filepath; - } else { - $_relative = false; - } - if (@is_readable($_plugin_filepath)) { return $_plugin_filepath; } - // didn't find it, try include path - if($_relative) { - if ($this->_get_include_path($_plugin_dir . DIR_SEP . $_plugin_filename, $_include_filepath)) { + // didn't find it, see if path is relative + if (!preg_match("/^([\/\\\\]|[a-zA-Z]:[\/\\\\])/", $_plugin_dir)) { + // relative path, see if it is in the SMARTY_DIR + if (@is_readable(SMARTY_DIR . $_plugin_filepath)) { + return SMARTY_DIR . $_plugin_filepath; + } + // didn't find it, try include path + if ($this->_get_include_path($_plugin_filepath, $_include_filepath)) { return $_include_filepath; } } + + } return false; diff --git a/libs/Smarty.class.php b/libs/Smarty.class.php index ce211223..3719a7ee 100644 --- a/libs/Smarty.class.php +++ b/libs/Smarty.class.php @@ -1672,24 +1672,23 @@ function _run_insert_handler($args) $_plugin_filepath = $_plugin_dir . DIR_SEP . $_plugin_filename; - if (!preg_match("/^([\/\\\\]|[a-zA-Z]:[\/\\\\])/", $_plugin_dir)) { - // relative path - $_relative = true; - $_plugin_filepath = SMARTY_DIR . $_plugin_filepath; - } else { - $_relative = false; - } - if (@is_readable($_plugin_filepath)) { return $_plugin_filepath; } - // didn't find it, try include path - if($_relative) { - if ($this->_get_include_path($_plugin_dir . DIR_SEP . $_plugin_filename, $_include_filepath)) { + // didn't find it, see if path is relative + if (!preg_match("/^([\/\\\\]|[a-zA-Z]:[\/\\\\])/", $_plugin_dir)) { + // relative path, see if it is in the SMARTY_DIR + if (@is_readable(SMARTY_DIR . $_plugin_filepath)) { + return SMARTY_DIR . $_plugin_filepath; + } + // didn't find it, try include path + if ($this->_get_include_path($_plugin_filepath, $_include_filepath)) { return $_include_filepath; } } + + } return false;