diff --git a/Smarty.class.php b/Smarty.class.php index af0d8a88..963d548c 100644 --- a/Smarty.class.php +++ b/Smarty.class.php @@ -616,43 +616,31 @@ class Smarty \*======================================================================*/ function _assign_smarty_interface() { - $smarty = array('get' => $GLOBALS['HTTP_GET_VARS'], - 'post' => $GLOBALS['HTTP_POST_VARS'], - 'cookies' => $GLOBALS['HTTP_COOKIE_VARS'], - 'session' => $GLOBALS['HTTP_SESSION_VARS'], - 'server' => $GLOBALS['HTTP_SERVER_VARS'], - 'env' => $GLOBALS['HTTP_ENV_VARS']); + $egpcs = array('e' => 'env', + 'g' => 'get', + 'p' => 'post', + 'c' => 'cookie', + 's' => 'server'); + $globals_map = array('get' => 'HTTP_GET_VARS', + 'post' => 'HTTP_POST_VARS', + 'cookies' => 'HTTP_COOKIE_VARS', + 'session' => 'HTTP_SESSION_VARS', + 'server' => 'HTTP_SERVER_VARS', + 'env' => 'HTTP_ENV_VARS'); - $smarty['request'] = array(); - foreach (preg_split('!!', $this->request_vars_order) as $c) { - switch (strtolower($c)) { - case 'p': - $smarty['request'] = array_merge($smarty['request'], - $GLOBALS['HTTP_POST_VARS']); - break; + $smarty = array('request' => array()); - case 'c': - $smarty['request'] = array_merge($smarty['request'], - $GLOBALS['HTTP_COOKIE_VARS']); - break; + foreach ($globals_map as $key => $array) { + $smarty[$key] = isset($GLOBALS[$array]) ? $GLOBALS[$array] : array(); + } - case 'g': - $smarty['request'] = array_merge($smarty['request'], - $GLOBALS['HTTP_GET_VARS']); - break; - - case 'e': - $smarty['request'] = array_merge($smarty['request'], - $GLOBALS['HTTP_ENV_VARS']); - break; - - case 's': - $smarty['request'] = array_merge($smarty['request'], - $GLOBALS['HTTP_SERVER_VARS']); - break; + foreach (preg_split('!!', strtolower($this->request_vars_order)) as $c) { + if (isset($egpcs[$c])) { + $smarty['request'] = array_merge($smarty['request'], $smarty[$egpcs[$c]]); } } - + $smarty['request'] = array_merge($smarty['request'], $smarty['session']); + $this->assign('smarty', $smarty); } diff --git a/Smarty_Compiler.class.php b/Smarty_Compiler.class.php index 22983a5a..a18ecca0 100644 --- a/Smarty_Compiler.class.php +++ b/Smarty_Compiler.class.php @@ -305,6 +305,7 @@ class Smarty_Compiler extends Smarty { return; } + $arg_list = array(); $attrs = $this->_parse_attrs($tag_args); foreach ($attrs as $arg_name => $arg_value) { if (is_bool($arg_value)) @@ -355,7 +356,7 @@ class Smarty_Compiler extends Smarty { $attrs['section'] = 'null'; } - $scope = $this->_dequote($attrs['scope']); + @$scope = $this->_dequote($attrs['scope']); if (!empty($scope)) { if ($scope != 'local' && $scope != 'parent' && @@ -412,6 +413,7 @@ class Smarty_Compiler extends Smarty { function _compile_section_start($tag_args) { $attrs = $this->_parse_attrs($tag_args); + $arg_list = array(); $output = "custom_mods[$modifier_name]; + @$mod_func_name = $this->custom_mods[$modifier_name]; /* * If we don't find that modifier there, we assume it's just a PHP diff --git a/libs/Smarty.class.php b/libs/Smarty.class.php index af0d8a88..963d548c 100644 --- a/libs/Smarty.class.php +++ b/libs/Smarty.class.php @@ -616,43 +616,31 @@ class Smarty \*======================================================================*/ function _assign_smarty_interface() { - $smarty = array('get' => $GLOBALS['HTTP_GET_VARS'], - 'post' => $GLOBALS['HTTP_POST_VARS'], - 'cookies' => $GLOBALS['HTTP_COOKIE_VARS'], - 'session' => $GLOBALS['HTTP_SESSION_VARS'], - 'server' => $GLOBALS['HTTP_SERVER_VARS'], - 'env' => $GLOBALS['HTTP_ENV_VARS']); + $egpcs = array('e' => 'env', + 'g' => 'get', + 'p' => 'post', + 'c' => 'cookie', + 's' => 'server'); + $globals_map = array('get' => 'HTTP_GET_VARS', + 'post' => 'HTTP_POST_VARS', + 'cookies' => 'HTTP_COOKIE_VARS', + 'session' => 'HTTP_SESSION_VARS', + 'server' => 'HTTP_SERVER_VARS', + 'env' => 'HTTP_ENV_VARS'); - $smarty['request'] = array(); - foreach (preg_split('!!', $this->request_vars_order) as $c) { - switch (strtolower($c)) { - case 'p': - $smarty['request'] = array_merge($smarty['request'], - $GLOBALS['HTTP_POST_VARS']); - break; + $smarty = array('request' => array()); - case 'c': - $smarty['request'] = array_merge($smarty['request'], - $GLOBALS['HTTP_COOKIE_VARS']); - break; + foreach ($globals_map as $key => $array) { + $smarty[$key] = isset($GLOBALS[$array]) ? $GLOBALS[$array] : array(); + } - case 'g': - $smarty['request'] = array_merge($smarty['request'], - $GLOBALS['HTTP_GET_VARS']); - break; - - case 'e': - $smarty['request'] = array_merge($smarty['request'], - $GLOBALS['HTTP_ENV_VARS']); - break; - - case 's': - $smarty['request'] = array_merge($smarty['request'], - $GLOBALS['HTTP_SERVER_VARS']); - break; + foreach (preg_split('!!', strtolower($this->request_vars_order)) as $c) { + if (isset($egpcs[$c])) { + $smarty['request'] = array_merge($smarty['request'], $smarty[$egpcs[$c]]); } } - + $smarty['request'] = array_merge($smarty['request'], $smarty['session']); + $this->assign('smarty', $smarty); } diff --git a/libs/Smarty_Compiler.class.php b/libs/Smarty_Compiler.class.php index 22983a5a..a18ecca0 100644 --- a/libs/Smarty_Compiler.class.php +++ b/libs/Smarty_Compiler.class.php @@ -305,6 +305,7 @@ class Smarty_Compiler extends Smarty { return; } + $arg_list = array(); $attrs = $this->_parse_attrs($tag_args); foreach ($attrs as $arg_name => $arg_value) { if (is_bool($arg_value)) @@ -355,7 +356,7 @@ class Smarty_Compiler extends Smarty { $attrs['section'] = 'null'; } - $scope = $this->_dequote($attrs['scope']); + @$scope = $this->_dequote($attrs['scope']); if (!empty($scope)) { if ($scope != 'local' && $scope != 'parent' && @@ -412,6 +413,7 @@ class Smarty_Compiler extends Smarty { function _compile_section_start($tag_args) { $attrs = $this->_parse_attrs($tag_args); + $arg_list = array(); $output = "custom_mods[$modifier_name]; + @$mod_func_name = $this->custom_mods[$modifier_name]; /* * If we don't find that modifier there, we assume it's just a PHP