Finish removing HTTP_SERVER_VARS in favor of _SERVER; fix notifications for the paranoid
authorBrion Vibber <brion@users.mediawiki.org>
Tue, 18 Nov 2003 02:39:38 +0000 (02:39 +0000)
committerBrion Vibber <brion@users.mediawiki.org>
Tue, 18 Nov 2003 02:39:38 +0000 (02:39 +0000)
includes/OutputPage.php
includes/Skin.php
includes/Title.php

index e72c0d1..37379c8 100644 (file)
@@ -260,7 +260,7 @@ class OutputPage {
 
        function setEncodings()
        {
-               global $HTTP_SERVER_VARS, $wgInputEncoding, $wgOutputEncoding;
+               global $wgInputEncoding, $wgOutputEncoding;
                global $wgUser, $wgLang;
 
                $wgInputEncoding = strtolower( $wgInputEncoding );
@@ -308,7 +308,7 @@ class OutputPage {
 
        function reportTime()
        {
-               global $wgRequestTime, $wgDebugLogFile, $HTTP_SERVER_VARS;
+               global $wgRequestTime, $wgDebugLogFile;
                global $wgProfiling, $wgProfileStack, $wgProfileLimit, $wgUser;
 
                list( $usec, $sec ) = explode( " ", microtime() );
@@ -320,19 +320,19 @@ class OutputPage {
 
                if ( "" != $wgDebugLogFile ) {
                        $prof = wfGetProfilingOutput( $start, $elapsed );
-                       if( $forward = $HTTP_SERVER_VARS['HTTP_X_FORWARDED_FOR'] )
-                               $forward = " forwarded for $forward";
-                       if( $client = $HTTP_SERVER_VARS['HTTP_CLIENT_IP'] )
-                               $forward .= " client IP $client";
-                       if( $from = $HTTP_SERVER_VARS['HTTP_FROM'] )
-                               $forward .= " from $from";
+                       if( !empty( $_SERVER['HTTP_X_FORWARDED_FOR'] ) )
+                               $forward = " forwarded for " . $_SERVER['HTTP_X_FORWARDED_FOR'];
+                       if( !empty( $_SERVER['HTTP_CLIENT_IP'] ) )
+                               $forward .= " client IP " . $_SERVER['HTTP_CLIENT_IP'];
+                       if( !empty( $_SERVER['HTTP_FROM'] ) )
+                               $forward .= " from " . $_SERVER['HTTP_FROM'];
                        if( $forward )
-                               $forward = "\t(proxied via {$HTTP_SERVER_VARS['REMOTE_ADDR']}{$forward})";
+                               $forward = "\t(proxied via {$_SERVER['REMOTE_ADDR']}{$forward})";
                        if($wgUser->getId() == 0)
                                $forward .= " anon";
                        $log = sprintf( "%s\t%04.3f\t%s\n",
                          gmdate( "YmdHis" ), $elapsed,
-                         urldecode( $HTTP_SERVER_VARS['REQUEST_URI'] . $forward ) );
+                         urldecode( $_SERVER['REQUEST_URI'] . $forward ) );
                        error_log( $log . $prof, 3, $wgDebugLogFile );
                }
                $com = sprintf( "<!-- Time since request: %01.2f secs. -->",
index fa156be..1b4db04 100644 (file)
@@ -331,7 +331,7 @@ class Skin {
        #
        function afterContent()
        {
-               global $wgUser, $wgOut, $wgServer, $HTTP_SERVER_VARS;
+               global $wgUser, $wgOut, $wgServer;
                global $wgTitle;
                
                if ( $wgOut->isPrintable() ) {
index 1031187..2480679 100644 (file)
@@ -56,7 +56,7 @@ class Title {
 
        function newFromURL( $url )
        {
-               global $wgLang, $wgServer, $HTTP_SERVER_VARS;
+               global $wgLang, $wgServer;
                
                $t = new Title();
                $s = urldecode( $url ); # This is technically wrong, as anything