* Redundant parenthesis
[lhc/web/wiklou.git] / index.php
index 7ae4a8a..026f31f 100644 (file)
--- a/index.php
+++ b/index.php
@@ -112,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' ) ) {
@@ -124,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' ) &&
@@ -141,6 +143,10 @@ 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
@@ -166,6 +172,7 @@ if( !$wgDisableInternalSearch && !is_null( $search ) && $search !== '' ) {
        }
 
        if ( in_array( $action, $wgDisabledActions ) ) {
+               $wgOut->setStatusCode( 404 );
                $wgOut->errorpage( 'nosuchaction', 'nosuchactiontext' );
        } else {
                switch( $action ) {
@@ -254,6 +261,7 @@ if( !$wgDisableInternalSearch && !is_null( $search ) && $search !== '' ) {
                                break;
                        default:
                                if (wfRunHooks('UnknownAction', array($action, $wgArticle))) {
+                                       $wgOut->setStatusCode( 404 );
                                        $wgOut->errorpage( 'nosuchaction', 'nosuchactiontext' );
                                }
                }