diff --git a/libs/Smarty.class.php b/libs/Smarty.class.php index d920df91..a288217a 100644 --- a/libs/Smarty.class.php +++ b/libs/Smarty.class.php @@ -2034,8 +2034,11 @@ class Smarty * wrapper for include() retaining $this * @return mixed */ - function _include($filename, $once=false) + function _include($filename, $once=false, $vars=null) { + if (is_array($vars)) + extract($vars, EXTR_PREFIX_SAME, 'include_php_'); + if ($once) { return include_once($filename); } else { @@ -2048,8 +2051,11 @@ class Smarty * wrapper for eval() retaining $this * @return mixed */ - function _eval($code) + function _eval($code, $vars=null) { + if (is_array($vars)) + extract($vars, EXTR_PREFIX_SAME, 'include_php_'); + return eval($code); } /**#@-*/ diff --git a/libs/core/core.smarty_include_php.php b/libs/core/core.smarty_include_php.php index ba423af8..83692e18 100644 --- a/libs/core/core.smarty_include_php.php +++ b/libs/core/core.smarty_include_php.php @@ -26,22 +26,20 @@ function smarty_core_smarty_include_php($params, &$smarty) $_smarty_resource_type = $_params['resource_type']; $_smarty_php_resource = $_params['php_resource']; - extract($params['smarty_include_vars'], EXTR_PREFIX_SAME, 'include_php_'); - if (!empty($params['smarty_assign'])) { ob_start(); if ($_smarty_resource_type == 'file') { - $smarty->_include($_smarty_php_resource, $params['smarty_once']); + $smarty->_include($_smarty_php_resource, $params['smarty_once'], $params['smarty_include_vars']); } else { - $smarty->_eval($_smarty_php_resource); + $smarty->_eval($_smarty_php_resource, $params['smarty_include_vars']); } $smarty->assign($params['smarty_assign'], ob_get_contents()); ob_end_clean(); } else { if ($_smarty_resource_type == 'file') { - $smarty->_include($_smarty_php_resource, $params['smarty_once']); + $smarty->_include($_smarty_php_resource, $params['smarty_once'], $params['smarty_include_vars']); } else { - $smarty->_eval($_smarty_php_resource); + $smarty->_eval($_smarty_php_resource, $params['smarty_include_vars']); } } }