cvs: smarty / NEWS /libs Smarty.class.php Smarty_Compiler.class.php
| From: | Messju Mohr | Date: | Wed, 11 Jun 2003 22:17:52 +0000 |
| Subject: | cvs: smarty / NEWS /libs Smarty.class.php Smarty_Compiler.class.php | ||
| Groups: | php.smarty.cvs | ||
| Request: | Send a blank email to php-smarty-cvs+get-643@lists.php.net to get a copy of this message | ||
messju Wed Jun 11 18:17:52 2003 EDT
Modified files:
/smarty NEWS
/smarty/libs Smarty.class.php Smarty_Compiler.class.php
Log:
added config-option "request_use_auto_globals" to make auto-globals be
used as request vars instead of HTTP_*_VARS
Index: smarty/NEWS
diff -u smarty/NEWS:1.375 smarty/NEWS:1.376
--- smarty/NEWS:1.375 Wed Jun 11 17:52:09 2003
+++ smarty/NEWS Wed Jun 11 18:17:52 2003
@@ -1,3 +1,5 @@
+ - added config-option "request_use_auto_globals" to make auto-globals be
+ used as request vars instead of HTTP_*_VARS (messju)
- make config vars compile statically (Monte)
- added block-methods for registered objects (Bharat Mediratta, messju)
- ignore one char resource names like c:foo.tpl (Monte)
Index: smarty/libs/Smarty.class.php
diff -u smarty/libs/Smarty.class.php:1.401 smarty/libs/Smarty.class.php:1.402
--- smarty/libs/Smarty.class.php:1.401 Wed Jun 11 17:52:09 2003
+++ smarty/libs/Smarty.class.php Wed Jun 11 18:17:52 2003
@@ -42,7 +42,7 @@
* @version 2.5.0
*/
-/* $Id: Smarty.class.php,v 1.401 2003/06/11 21:52:09 mohrt Exp $ */
+/* $Id: Smarty.class.php,v 1.402 2003/06/11 22:17:52 messju Exp $ */
/**
* DIR_SEP isn't used anymore, but third party apps might
@@ -92,7 +92,7 @@
/**
* The directory where config files are located.
*
- * @var string
+reques * @var string
*/
var $config_dir = 'configs';
@@ -272,6 +272,16 @@
var $request_vars_order = "EGPCS";
/**
+ * Indicates wether $HTTP_*_VARS[] (request_use_auto_globals=false)
+ * are uses as request-vars or $_*[]-vars. note: if
+ * request_use_auto_globals is true, then $request_vars_order has
+ * no effect, but the php-ini-value "gpc_order"
+ *
+ * @var boolean
+ */
+ var $request_use_auto_globals = false;
+
+ /**
* Set this if you want different sets of compiled files for the same
* templates. This is useful for things like different languages.
* Instead of creating separate sets of templates per language, you
@@ -1483,7 +1493,9 @@
$smarty_compiler->_tpl_vars = &$this->_tpl_vars;
$smarty_compiler->default_modifiers = $this->default_modifiers;
$smarty_compiler->compile_id = $this->_compile_id;
- $smarty_compiler->_config = $this->_config;
+ $smarty_compiler->_config = $this->_config;
+
+ $smarty_compiler->request_use_auto_globals = $this->request_use_auto_globals;
if ($smarty_compiler->_compile_file($tpl_file, $template_source, $template_compiled)) {
return true;
Index: smarty/libs/Smarty_Compiler.class.php
diff -u smarty/libs/Smarty_Compiler.class.php:1.235 smarty/libs/Smarty_Compiler.class.php:1.236
--- smarty/libs/Smarty_Compiler.class.php:1.235 Wed Jun 11 17:52:09 2003
+++ smarty/libs/Smarty_Compiler.class.php Wed Jun 11 18:17:52 2003
@@ -39,7 +39,7 @@
* @package Smarty
*/
-/* $Id: Smarty_Compiler.class.php,v 1.235 2003/06/11 21:52:09 mohrt Exp $ */
+/* $Id: Smarty_Compiler.class.php,v 1.236 2003/06/11 22:17:52 messju Exp $ */
/**
* Template compiling class
* @package Smarty
@@ -1766,27 +1766,26 @@
break;
case 'get':
- $compiled_ref = "\$GLOBALS['HTTP_GET_VARS']";
- break;
+ $compiled_ref = ($this->request_use_auto_globals) ? '$_GET' :
"\$GLOBALS['HTTP_GET_VARS']";
case 'post':
- $compiled_ref = "\$GLOBALS['HTTP_POST_VARS']";
+ $compiled_ref = ($this->request_use_auto_globals) ? '$_POST' :
"\$GLOBALS['HTTP_POST_VARS']";
break;
case 'cookies':
- $compiled_ref = "\$GLOBALS['HTTP_COOKIE_VARS']";
+ $compiled_ref = ($this->request_use_auto_globals) ? '$_COOKIE' :
"\$GLOBALS['HTTP_COOKIE_VARS']";
break;
case 'env':
- $compiled_ref = "\$GLOBALS['HTTP_ENV_VARS']";
+ $compiled_ref = ($this->request_use_auto_globals) ? '$_ENV' :
"\$GLOBALS['HTTP_ENV_VARS']";
break;
case 'server':
- $compiled_ref = "\$GLOBALS['HTTP_SERVER_VARS']";
+ $compiled_ref = ($this->request_use_auto_globals) ? '$_SERVER' :
"\$GLOBALS['HTTP_SERVER_VARS']";
break;
case 'session':
- $compiled_ref = "\$GLOBALS['HTTP_SESSION_VARS']";
+ $compiled_ref = ($this->request_use_auto_globals) ? '$_SESSION' :
"\$GLOBALS['HTTP_SESSION_VARS']";
break;
/*
@@ -1794,7 +1793,12 @@
* compiler.
*/
case 'request':
- $this->_init_smarty_vars = true;
+ if ($this->request_use_auto_globals) {
+ $compiled_ref = '$_REQUEST';
+ break;
+ } else {
+ $this->_init_smarty_vars = true;
+ }
return null;
case 'capture':