/**
* 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' ) ) ) )
{
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' );
} 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 {