added config-option "request_use_auto_globals" to make auto-globals be

used as request vars instead of HTTP_*_VARS
This commit is contained in:
messju
2003-06-11 22:17:52 +00:00
parent 621629cd44
commit 15c968fb27
3 changed files with 28 additions and 10 deletions

2
NEWS
View File

@@ -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)

View File

@@ -92,7 +92,7 @@ class Smarty
/**
* The directory where config files are located.
*
* @var string
reques * @var string
*/
var $config_dir = 'configs';
@@ -271,6 +271,16 @@ class Smarty
*/
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.
@@ -1483,7 +1493,9 @@ class Smarty
$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;

View File

@@ -1766,27 +1766,26 @@ class Smarty_Compiler extends Smarty {
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 @@ class Smarty_Compiler extends Smarty {
* 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':