From 7d9d598ef8afec2df32120eac5b60e0f947f8f9f Mon Sep 17 00:00:00 2001 From: Magnus Manske Date: Wed, 11 Jan 2006 13:28:23 +0000 Subject: [PATCH] moved more stuff --- includes/Wiki.php | 17 +++++++++++++++-- index.php | 17 +++-------------- 2 files changed, 18 insertions(+), 16 deletions(-) diff --git a/includes/Wiki.php b/includes/Wiki.php index 89c7f6c831..0224853b51 100644 --- a/includes/Wiki.php +++ b/includes/Wiki.php @@ -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' ) ) ) ) { diff --git a/index.php b/index.php index 540c57400e..90aa84f865 100644 --- 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 { -- 2.20.1