X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=functions%2Fglobal.php;h=2903511a7e6b7f8d64ec8c244f916bb6b6083593;hb=1f270d3ccac30fd2e794923ff9aa0e0f07f59772;hp=18da5f5fcd5aedea95fb3d7c76dc40ab1fc7892a;hpb=5123154f9cc2f6ba636a5ef41ded52f59ed5b885;p=squirrelmail.git diff --git a/functions/global.php b/functions/global.php index 18da5f5f..2903511a 100644 --- a/functions/global.php +++ b/functions/global.php @@ -1,64 +1,75 @@ = ($a.$b.$c); + global $SQM_INTERNAL_VERSION; + if ( !isset($SQM_INTERNAL_VERSION) || + $SQM_INTERNAL_VERSION[0] < $a || + ( $SQM_INTERNAL_VERSION[0] == $a && + $SQM_INTERNAL_VERSION[1] < $b) || + ( $SQM_INTERNAL_VERSION[0] == $a && + $SQM_INTERNAL_VERSION[1] == $b && + $SQM_INTERNAL_VERSION[2] < $c ) ) { + return FALSE; + } + return TRUE; } -/* recursively strip slashes from the values of an array */ + +/** + * Recursively strip slashes from the values of an array. + * @param array array the array to strip, passed by reference + * @return void + */ function sqstripslashes(&$array) { if(count($array) > 0) { foreach ($array as $index=>$value) { @@ -72,88 +83,916 @@ function sqstripslashes(&$array) { } } +/** + * Add a variable to the session. + * @param mixed $var the variable to register + * @param string $name the name to refer to this variable + * @return void + */ function sqsession_register ($var, $name) { - if ( !check_php_version(4,1) ) { - global $HTTP_SESSION_VARS; - $HTTP_SESSION_VARS[$name] = $var; - } - else { - $_SESSION["$name"] = $var; - } + + sqsession_is_active(); + + $_SESSION[$name] = $var; } +/** + * Delete a variable from the session. + * @param string $name the name of the var to delete + * @return void + */ function sqsession_unregister ($name) { - if ( !check_php_version(4,1) ) { - global $HTTP_SESSION_VARS; - unset($HTTP_SESSION_VARS[$name]); - } - else { - unset($_SESSION[$name]); - } + + sqsession_is_active(); + + unset($_SESSION[$name]); + + session_unregister("$name"); } +/** + * Checks to see if a variable has already been registered + * in the session. + * @param string $name the name of the var to check + * @return bool whether the var has been registered + */ function sqsession_is_registered ($name) { $test_name = &$name; $result = false; - if ( !check_php_version(4,1) ) { - global $HTTP_SESSION_VARS; - if (isset($HTTP_SESSION_VARS[$test_name])) { - $result = true; + + if (isset($_SESSION[$test_name])) { + $result = true; + } + + return $result; +} + + +/** + * Retrieves a form variable, from a set of possible similarly named + * form variables, based on finding a different, single field. This + * is intended to allow more than one same-named inputs in a single + *