From 9a63aa57ae2a30d8d84b111f3ef3a97614dff3bc Mon Sep 17 00:00:00 2001 From: skeeter Date: Thu, 28 Feb 2002 03:46:34 +0000 Subject: [PATCH] Adding the new get_var(). --- phpgwapi/inc/functions.inc.php | 52 ++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) diff --git a/phpgwapi/inc/functions.inc.php b/phpgwapi/inc/functions.inc.php index bc06566b54..1962721309 100644 --- a/phpgwapi/inc/functions.inc.php +++ b/phpgwapi/inc/functions.inc.php @@ -253,6 +253,9 @@ case 'get': $posttype = 'HTTP_GET_VARS'; break; + case 'cookie': + $posttype = 'HTTP_COOKIE_VARS'; + break; default : $posttype = 'HTTP_POST_VARS'; } @@ -326,6 +329,55 @@ } } + + /*! + @function get_var + @abstract retrieve a value from either a POST, GET, COOKIE, or from a class variable. + @author skeeter + @discussion This function is used to retrieve a value from a user defined order of methods. + @syntax get_var('id',array('HTTP_POST_VARS'||'POST','HTTP_GET_VARS'||'GET','HTTP_COOKIE_VARS'||'COOKIE','GLOBAL','DEFAULT')); + @example $this->id = get_var('id',array('HTTP_POST_VARS'||'POST','HTTP_GET_VARS'||'GET','HTTP_COOKIE_VARS'||'COOKIE','GLOBAL','DEFAULT')); + @param $variable name + @param $method ordered array of methods to search for supplied variable + @param $default_value (optional) + */ + function get_var($variable,$method,$default_value='') + { + for($i=0;$i