Removed double hook explanation AfterFinalPageOutput
[lhc/web/wiklou.git] / includes / WebRequest.php
index ac8e159..391b49e 100644 (file)
@@ -1123,6 +1123,7 @@ HTML;
                # Append XFF
                $forwardedFor = $this->getHeader( 'X-Forwarded-For' );
                if ( $forwardedFor !== false ) {
+                       $isConfigured = IP::isConfiguredProxy( $ip );
                        $ipchain = array_map( 'trim', explode( ',', $forwardedFor ) );
                        $ipchain = array_reverse( $ipchain );
                        if ( $ip ) {
@@ -1139,13 +1140,13 @@ HTML;
                                        continue;
                                }
                                $curIP = IP::sanitizeIP( IP::canonicalize( $curIP ) );
-                               if ( wfIsTrustedProxy( $curIP ) && isset( $ipchain[$i + 1] ) ) {
-                                       if ( wfIsConfiguredProxy( $curIP ) || // bug 48919; treat IP as sane
+                               if ( IP::isTrustedProxy( $curIP ) && isset( $ipchain[$i + 1] ) ) {
+                                       if ( IP::isConfiguredProxy( $curIP ) || // bug 48919; treat IP as sane
                                                IP::isPublic( $ipchain[$i + 1] ) ||
                                                $wgUsePrivateIPs
                                        ) {
                                                $nextIP = IP::canonicalize( $ipchain[$i + 1] );
-                                               if ( !$nextIP && wfIsConfiguredProxy( $ip ) ) {
+                                               if ( !$nextIP && $isConfigured ) {
                                                        // We have not yet made it past CDN/proxy servers of this site,
                                                        // so either they are misconfigured or there is some IP spoofing.
                                                        throw new MWException( "Invalid IP given in XFF '$forwardedFor'." );