chagenbu Wed Jan 31 10:34:39 2001 EDT Modified files: /php4/pear HTTP.php Log: use $HTTP_SERVER_VARS, in case register_globals is Off, and use !empty() instead of just if () to avoid errors. Index: php4/pear/HTTP.php diff -u php4/pear/HTTP.php:1.5 php4/pear/HTTP.php:1.6 --- php4/pear/HTTP.php:1.5 Tue Jan 9 17:01:52 2001 +++ php4/pear/HTTP.php Wed Jan 31 10:34:39 2001 @@ -17,7 +17,7 @@ // | | // +----------------------------------------------------------------------+ // -// $Id: HTTP.php,v 1.5 2001/01/10 01:01:52 ssb Exp $ +// $Id: HTTP.php,v 1.6 2001/01/31 18:34:39 chagenbu Exp $ // // HTTP utility functions. // @@ -67,12 +67,12 @@ * @author Stig Bakken <[EMAIL PROTECTED]> */ function negotiateLanguage(&$supported, $default = 'en_US') { - global $HTTP_ACCEPT_LANGUAGE; + global $HTTP_SERVER_VARS; /* If the client has sent an Accept-Language: header, see if * it contains a language we support. */ - if ($HTTP_ACCEPT_LANGUAGE) { + if (isset($HTTP_SERVER_VARS['HTTP_ACCEPT_LANGUAGE'])) { $accepted = split(',[[:space:]]*', $HTTP_ACCEPT_LANGUAGE); for ($i = 0; $i < count($accepted); $i++) { if (eregi('^([a-z]+);[[:space:]]*q=([0-9\.]+)', $accepted[$i], &$arr)) { @@ -82,7 +82,7 @@ $q = 42; $l = $accepted[$i]; } - if ($supported[$l] && $q > 0.0) { + if (!empty($supported[$l]) && ($q > 0.0)) { if ($q == 42) { return $l; } @@ -99,9 +99,9 @@ /* Check for a valid language code in the top-level domain of * the client's host address. */ - if (eregi("\.[^\.]+$", $REMOTE_HOST, &$arr)) { + if (ereg("\.[^\.]+$", $HTTP_SERVER_VARS['REMOTE_HOST'], &$arr)) { $lang = strtolower($arr[1]); - if ($supported[$lang]) { + if (!empty($supported[$lang])) { return $lang; } } @@ -109,5 +109,4 @@ return $default; } } - ?> -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]