moved more stuff
authorMagnus Manske <magnusmanske@users.mediawiki.org>
Wed, 11 Jan 2006 13:28:23 +0000 (13:28 +0000)
committerMagnus Manske <magnusmanske@users.mediawiki.org>
Wed, 11 Jan 2006 13:28:23 +0000 (13:28 +0000)
includes/Wiki.php
index.php

index 89c7f6c..0224853 100644 (file)
@@ -30,8 +30,21 @@ class MediaWiki {
        /**
         * Initialize the object to be known as $wgArticle for special cases
         */
-       function initializeSpecialCases ( &$title , &$output , $action ) {
-               if ( ( $action == 'view' ) &&
+       function initializeSpecialCases ( &$title , &$output , $request , $action ) {
+               if ( $title->getInterwiki() != '' ) {
+                       if( $rdfrom = $request->getVal( 'rdfrom' ) ) {
+                               $url = $title->getFullURL( 'rdfrom=' . urlencode( $rdfrom ) );
+                       } else {
+                               $url = $title->getFullURL();
+                       }
+                       # Check for a redirect loop
+                       if ( !preg_match( '/^' . preg_quote( $this->getVal('Server'), '/' ) . '/', $url ) && $title->isLocal() ) {
+                               $output->redirect( $url );
+                       } else {
+                               $title = Title::newFromText( wfMsgForContent( 'badtitle' ) );
+                               $output->errorpage( 'badtitle', 'badtitletext' );
+                       }
+               } else if ( ( $action == 'view' ) &&
                        (!isset( $this->GET['title'] ) || $title->getPrefixedDBKey() != $this->GET['title'] ) &&
                        !count( array_diff( array_keys( $this->GET ), array( 'action', 'title' ) ) ) )
                {
index 540c574..90aa84f 100644 (file)
--- a/index.php
+++ b/index.php
@@ -122,6 +122,8 @@ wfProfileIn( 'main-action' );
 require_once( "includes/Wiki.php" ) ;
 $mediaWiki = new MediaWiki() ;
 
+$mediaWiki->setVal( "Server", $wgServer );
+
 if( !$wgDisableInternalSearch && !is_null( $search ) && $search !== '' ) {
        require_once( 'includes/SpecialSearch.php' );
        $wgTitle = Title::makeTitle( NS_SPECIAL, 'Search' );
@@ -129,20 +131,7 @@ if( !$wgDisableInternalSearch && !is_null( $search ) && $search !== '' ) {
 } else if( !$wgTitle or $wgTitle->getDBkey() == '' ) {
        $wgTitle = Title::newFromText( wfMsgForContent( 'badtitle' ) );
        $wgOut->errorpage( 'badtitle', 'badtitletext' );
-} else if ( $wgTitle->getInterwiki() != '' ) {
-       if( $rdfrom = $wgRequest->getVal( 'rdfrom' ) ) {
-               $url = $wgTitle->getFullURL( 'rdfrom=' . urlencode( $rdfrom ) );
-       } else {
-               $url = $wgTitle->getFullURL();
-       }
-       # Check for a redirect loop
-       if ( !preg_match( '/^' . preg_quote( $wgServer, '/' ) . '/', $url ) && $wgTitle->isLocal() ) {
-               $wgOut->redirect( $url );
-       } else {
-               $wgTitle = Title::newFromText( wfMsgForContent( 'badtitle' ) );
-               $wgOut->errorpage( 'badtitle', 'badtitletext' );
-       }
-} else if ( $mediaWiki->initializeSpecialCases( $wgTitle , $wgOut , $action ) ) {
+} else if ( $mediaWiki->initializeSpecialCases( $wgTitle , $wgOut , $wgRequest , $action ) ) {
        # Do nothing, everything was already done by $mediaWiki
 
 } else {