From 27d0841c44f7ceb6903014a97fe3db7ea3d3151f Mon Sep 17 00:00:00 2001 From: ebullient Date: Sat, 4 Jan 2003 05:02:40 +0000 Subject: [PATCH] added constants to fetch COOKIE and SERVER values git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@4374 7612ce4b-ef26-0410-bec9-ea0150e637f0 --- functions/global.php | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/functions/global.php b/functions/global.php index ef63d5a9..1286b980 100644 --- a/functions/global.php +++ b/functions/global.php @@ -162,10 +162,12 @@ define('SQ_INORDER',0); define('SQ_GET',1); define('SQ_POST',2); define('SQ_SESSION',3); +define('SQ_COOKIE',4); +define('SQ_SERVER',5); /** - * Search for the var $name in $_SESSION, $_POST, $_GET - * and set it in provided var. + * Search for the var $name in $_SESSION, $_POST, $_GET, + * $_COOKIE, or $_SERVER and set it in provided var. * If $search is not provided, or == SQ_INORDER, it will search * $_SESSION, then $_POST, then $_GET. Otherwise, * use one of the defined constants to look for @@ -175,7 +177,7 @@ define('SQ_SESSION',3); */ function sqgetGlobalVar($name, &$value, $search = SQ_INORDER) { if ( !check_php_version(4,1) ) { - global $_SESSION, $_GET, $_POST; + global $_SESSION, $_GET, $_POST, $_COOKIE, $_SERVER; } switch ($search) { @@ -202,9 +204,21 @@ function sqgetGlobalVar($name, &$value, $search = SQ_INORDER) { if ( isset($_GET[$name]) ) { $value = $_GET[$name]; return TRUE; - } elseif ( $search == SQ_GET ) { - break; - } + } + /* NO IF HERE. FOR DEFAULT CASE, EXIT after GET */ + break; + case SQ_COOKIE: + if ( isset($_COOKIE[$name]) ) { + $value = $_COOKIE[$name]; + return TRUE; + } + break; + case SQ_SERVER: + if ( isset($_SERVER[$name]) ) { + $value = $_SERVER[$name]; + return TRUE; + } + break; } return FALSE; } -- 2.25.1