preview status in page title
[lhc/web/wiklou.git] / includes / Setup.php
index d7fc9da..df37cd7 100644 (file)
@@ -5,6 +5,8 @@
 # setting up a few globals.
 #
 
+global $wgProfiling, $wgProfileSampleRate, $wgIP, $wgUseSquid;
+
 if( !isset( $wgProfiling ) )
        $wgProfiling = false;
 
@@ -17,13 +19,11 @@ 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 = split(', ', $_SERVER['HTTP_X_FORWARDED_FOR'] );
+       $hopips = array_map( "trim", explode( ',', $_SERVER['HTTP_X_FORWARDED_FOR'] ) );
 
        while(in_array(trim(end($hopips)), $wgSquidServers)){
                array_pop($hopips);
@@ -71,7 +71,9 @@ global $wgMsgCacheExpiry, $wgDBname, $wgCommandLineMode;
 global $wgBlockCache, $wgParserCache, $wgParser;
 
 # Useful debug output
-if ( function_exists( "getallheaders" ) ) {
+if ( $wgCommandLineMode ) {
+       # wfDebug( '"' . implode( '"  "', $argv ) . '"' );
+} elseif ( function_exists( "getallheaders" ) ) {
        wfDebug( "\nStart request\n" );
        wfDebug( $_SERVER['REQUEST_METHOD'] . ' ' . $_SERVER['REQUEST_URI'] . "\n" );
        $headers = getallheaders();
@@ -158,7 +160,7 @@ if ( $wgUseDynamicDates ) {
        $wgDateFormatter = new DateFormatter;
 }
 
-if( !$wgCommandLineMode && isset( $_COOKIE[ini_get("session.name")] )  ) {
+if( !$wgCommandLineMode && ( isset( $_COOKIE[ini_get("session.name")] ) || isset( $_COOKIE["{$wgDBname}Password"] ) ) ) {
        User::SetupSession();
 }