diff --git a/www/plugins/function.html_options_multiple.php b/www/plugins/function.html_options_multiple.php index 3446dd9a3..240a584e4 100755 --- a/www/plugins/function.html_options_multiple.php +++ b/www/plugins/function.html_options_multiple.php @@ -5,6 +5,11 @@ * @package Smarty * @subpackage PluginsFunction */ + +// Fix by nZEDb +require_once 'load_plugin_dependency.php'; +// End fix by nZEDb. + /** * Smarty {html_options_multiple} function plugin * @@ -34,7 +39,7 @@ */ function smarty_function_html_options_multiple($params, $template) { - require_once(SMARTY_PLUGINS_DIR . 'shared.escape_special_chars.php'); + load_plugin_dependency('shared.escape_special_chars.php'); $name = null; $values = null; $options = null; @@ -95,7 +100,7 @@ function smarty_function_html_options_multiple($params, $template) } break; } - // omit break; to fall through! + // omit break; to fall through! default: if (!is_array($_val)) { $extra .= ' ' . $_key . '="' . smarty_function_escape_special_chars($_val) . '"'; @@ -171,4 +176,4 @@ function smarty_function_html_options_multiple_optgroup($key, $values, $selected $optgroup_html .= "\n"; return $optgroup_html; } -?> \ No newline at end of file +?> diff --git a/www/plugins/load_plugin_dependency.php b/www/plugins/load_plugin_dependency.php new file mode 100644 index 000000000..4a610b6a9 --- /dev/null +++ b/www/plugins/load_plugin_dependency.php @@ -0,0 +1,38 @@ +plugins_dir) && is_dir($smarty->plugins_dir): + $plugins_dir = $smarty->plugins_dir; + require_once $plugins_dir . DIRECTORY_SEPARATOR . $filename; + break; + case is_array($smarty->plugins_dir): + $plugins_dir = ''; + foreach ($smarty->plugins_dir as $dir) { + if (is_string($dir) && is_dir($dir)) { + $file = $dir . DIRECTORY_SEPARATOR . $filename; + if (file_exists($file) && is_readable($file)) { + $plugins_dir = $dir; + require_once $file; + break; + } + } + } + break; + default: + $plugins_dir = ''; + } + + if (!is_dir($plugins_dir)) { + exit('Fatal: Unable to find smarty plugins directory.' . PHP_EOL); + } +} + +?>