* Indenting and formatting.
[lhc/web/wiklou.git] / includes / Setup.php
index a43cfc3..45fd9cd 100644 (file)
@@ -16,7 +16,7 @@ if( defined( 'MEDIAWIKI' ) ) {
 # setting up a few globals.
 #
 
-global $wgProfiling, $wgProfileSampleRate, $wgIP, $wgUseSquid, $IP;
+global $wgProfiling, $wgProfileSampleRate, $wgIP, $IP;
 
 if( !isset( $wgProfiling ) )
        $wgProfiling = false;
@@ -41,26 +41,6 @@ if ( $wgProfiling and (0 == rand() % $wgProfileSampleRate ) ) {
         function wfProfileClose() {}
 }
 
-
-
-/* collect the originating ips */
-if( $wgUseSquid && isset( $_SERVER['HTTP_X_FORWARDED_FOR'] ) ) {
-       # If the web server is behind a reverse proxy, we need to find
-       # out where our requests are really coming from.
-       $hopips = array_map( 'trim', explode( ',', $_SERVER['HTTP_X_FORWARDED_FOR'] ) );
-
-       $allsquids = array_merge($wgSquidServers, $wgSquidServersNoPurge);
-       while(in_array(trim(end($hopips)), $allsquids)){
-               array_pop($hopips);
-       }
-       $wgIP = trim(end($hopips));
-} elseif( isset( $_SERVER['REMOTE_ADDR'] ) ) {
-       $wgIP = $_SERVER['REMOTE_ADDR'];
-} else {
-       # Running on CLI?
-       $wgIP = '127.0.0.1';
-}
-
 $fname = 'Setup.php';
 wfProfileIn( $fname );
 global $wgUseDynamicDates;
@@ -86,8 +66,7 @@ require_once( 'ParserCache.php' );
 require_once( 'WebRequest.php' );
 require_once( 'LoadBalancer.php' );
 require_once( 'HistoryBlob.php' );
-
-$wgRequest = new WebRequest();
+require_once( 'ProxyTools.php' );
 
 wfProfileOut( $fname.'-includes' );
 wfProfileIn( $fname.'-misc1' );
@@ -104,6 +83,9 @@ global $wgUseOldExistenceCheck, $wgEnablePersistentLC, $wgMasterWaitTimeout;
 
 global $wgFullyInitialised;
 
+$wgIP = wfGetIP();
+$wgRequest = new WebRequest();
+
 # Useful debug output
 if ( $wgCommandLineMode ) {
        # wfDebug( '"' . implode( '"  "', $argv ) . '"' );
@@ -384,29 +366,6 @@ wfSeedRandom();
 $wgTitle = Title::makeTitle( NS_SPECIAL, 'Error' );
 $wgArticle = new Article($wgTitle);
 
-# Site notice
-# FIXME: This is an ugly hack, which wastes runtime on cache hits
-# and raw page views by forcing initialization of the message cache.
-# Try to fake around it for raw at least:
-if( !isset( $_REQUEST['action'] ) || $_REQUEST['action'] != 'raw' ) {
-       $notice = wfMsg( 'sitenotice' );
-       if($notice == '<sitenotice>') $notice = '';
-       # Allow individual wikis to turn it off
-       if ( $notice == '-' ) {
-               $wgSiteNotice = '';
-       } else {
-               # if($wgSiteNotice) $notice .= $wgSiteNotice;
-               if ($notice == '') {
-                       $notice = $wgSiteNotice;
-               }
-               if($notice != '-' && $notice != '') {
-                       $specialparser = new Parser();
-                       $parserOutput = $specialparser->parse( $notice, $wgTitle, $wgOut->mParserOptions, false );
-                       $wgSiteNotice = $parserOutput->getText();
-               }
-       }
-}
-
 wfProfileOut( $fname.'-misc2' );
 wfProfileIn( $fname.'-extensions' );