Support using gzip and bzip2 decompression wrappers on the prefetch XML
[lhc/web/wiklou.git] / index.php
index 3ad6f78..026f31f 100644 (file)
--- a/index.php
+++ b/index.php
@@ -20,18 +20,17 @@ if( !file_exists( 'LocalSettings.php' ) ) {
        $IP = "." ;
        require_once( 'includes/DefaultSettings.php' ); # used for printing the version
 ?>
-<!DOCTYPE html PUBLIC "-//W3C/DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 <html xmlns='http://www.w3.org/1999/xhtml' xml:lang='en' lang='en'>
        <head>
                <title>MediaWiki <?php echo $wgVersion ?></title>
                <meta http-equiv='Content-Type' content='text/html; charset=utf-8' />
-
                <style type='text/css' media='screen, projection'>
                        html, body {
                                color: #000;
                                background-color: #fff;
-                               font-family: serif;
-                               text-align:center;
+                               font-family: sans-serif;
+                               text-align: center;
                        }
 
                        h1 {
@@ -48,7 +47,7 @@ if( !file_exists( 'LocalSettings.php' ) ) {
                if ( file_exists( 'config/LocalSettings.php' ) ) {
                        echo( "To complete the installation, move <tt>config/LocalSettings.php</tt> to the parent directory." );
                } else {
-                       echo( "You'll have to <a href='config/index.php' title='setup'>set the wiki up</a> first!" );
+                       echo( "Please <a href='config/index.php' title='setup'>setup the wiki</a> first." );
                }
                ?>
 
@@ -113,6 +112,7 @@ if( !$wgDisableInternalSearch && !is_null( $search ) && $search !== '' ) {
        wfSpecialSearch();
 } else if( !$wgTitle or $wgTitle->getDBkey() == '' ) {
        $wgTitle = Title::newFromText( wfMsgForContent( 'badtitle' ) );
+       $wgOut->setStatusCode( 404 );
        $wgOut->errorpage( 'badtitle', 'badtitletext' );
 } else if ( $wgTitle->getInterwiki() != '' ) {
        if( $rdfrom = $wgRequest->getVal( 'rdfrom' ) ) {
@@ -125,6 +125,7 @@ if( !$wgDisableInternalSearch && !is_null( $search ) && $search !== '' ) {
                $wgOut->redirect( $url );
        } else {
                $wgTitle = Title::newFromText( wfMsgForContent( 'badtitle' ) );
+               $wgOut->setStatusCode( 404 );
                $wgOut->errorpage( 'badtitle', 'badtitletext' );
        }
 } else if ( ( $action == 'view' ) &&
@@ -142,16 +143,19 @@ if( !$wgDisableInternalSearch && !is_null( $search ) && $search !== '' ) {
                $wgTitle = Title::makeTitle( NS_IMAGE, $wgTitle->getDBkey() );
        }
 
+       if ( !$wgTitle->exists() ) {
+               $wgOut->setStatusCode( 404 );
+       }
+
        $ns = $wgTitle->getNamespace();
 
        // Namespace might change when using redirects
-       if($action == 'view') {
+       if($action == 'view' && !$wgRequest->getVal( 'oldid' ) ) {
                $wgArticle = new Article( $wgTitle );
                $rTitle = Title::newFromRedirect( $wgArticle->fetchContent() );
                if($rTitle) {
-                       if( $rTitle->getNamespace() == $ns ) {
-                               $wgArticle->mContentLoaded=false;
-                       }
+                       # Reload from the page pointed to later
+                       $wgArticle->mContentLoaded = false;
                        $ns = $rTitle->getNamespace();
                }
        }
@@ -168,6 +172,7 @@ if( !$wgDisableInternalSearch && !is_null( $search ) && $search !== '' ) {
        }
 
        if ( in_array( $action, $wgDisabledActions ) ) {
+               $wgOut->setStatusCode( 404 );
                $wgOut->errorpage( 'nosuchaction', 'nosuchactiontext' );
        } else {
                switch( $action ) {
@@ -256,6 +261,7 @@ if( !$wgDisableInternalSearch && !is_null( $search ) && $search !== '' ) {
                                break;
                        default:
                                if (wfRunHooks('UnknownAction', array($action, $wgArticle))) {
+                                       $wgOut->setStatusCode( 404 );
                                        $wgOut->errorpage( 'nosuchaction', 'nosuchactiontext' );
                                }
                }