From 7fbd6b1c0b76b9d83d8055953938da39f73bd4d6 Mon Sep 17 00:00:00 2001 From: moodler Date: Wed, 2 Oct 2002 02:05:29 +0000 Subject: [PATCH] Don't use getenv anywhere - not necessary and breaks PHP under ISAPI --- lib/weblib.php | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/lib/weblib.php b/lib/weblib.php index 5e99405f550..6eb20cea4ac 100644 --- a/lib/weblib.php +++ b/lib/weblib.php @@ -39,7 +39,7 @@ function strip_querystring($url) { function get_referer() { // returns the URL of the HTTP_REFERER, less the querystring portion - $HTTP_REFERER = getenv("HTTP_REFERER"); + global $HTTP_REFERER; return strip_querystring(nvl($HTTP_REFERER)); } @@ -49,17 +49,17 @@ function me() { // return different things depending on a lot of things like your OS, Web // server, and the way PHP is compiled (ie. as a CGI, module, ISAPI, etc.) - if (getenv("REQUEST_URI")) { - $me = getenv("REQUEST_URI"); + global $REQUEST_URI, $PATH_INFO, $PHP_SELF; - } elseif (getenv("PATH_INFO")) { - $me = getenv("PATH_INFO"); - - } elseif ($GLOBALS["PHP_SELF"]) { - $me = $GLOBALS["PHP_SELF"]; - } - - return $me; + if ($REQUEST_URI) { + return $REQUEST_URI; + } else if ($PATH_INFO) { + return $PATH_INFO; + } else if ($PHP_SELF) { + return $PHP_SELF; + } else { + return ""; + } } @@ -67,9 +67,7 @@ function me() { function qualified_me() { // like me() but returns a full URL - $HTTPS = getenv("HTTPS"); - $SERVER_PROTOCOL = getenv("SERVER_PROTOCOL"); - $HTTP_HOST = getenv("HTTP_HOST"); + global $HTTPS, $SERVER_PROTOCOL, $HTTP_HOST; $protocol = (isset($HTTPS) && $HTTPS == "on") ? "https://" : "http://"; $url_prefix = "$protocol$HTTP_HOST";