Index: trunk/phase3/index.php |
— | — | @@ -122,6 +122,8 @@ |
123 | 123 | require_once( "includes/Wiki.php" ) ; |
124 | 124 | $mediaWiki = new MediaWiki() ; |
125 | 125 | |
| 126 | +$mediaWiki->setVal( "Server", $wgServer ); |
| 127 | + |
126 | 128 | if( !$wgDisableInternalSearch && !is_null( $search ) && $search !== '' ) { |
127 | 129 | require_once( 'includes/SpecialSearch.php' ); |
128 | 130 | $wgTitle = Title::makeTitle( NS_SPECIAL, 'Search' ); |
— | — | @@ -129,20 +131,7 @@ |
130 | 132 | } else if( !$wgTitle or $wgTitle->getDBkey() == '' ) { |
131 | 133 | $wgTitle = Title::newFromText( wfMsgForContent( 'badtitle' ) ); |
132 | 134 | $wgOut->errorpage( 'badtitle', 'badtitletext' ); |
133 | | -} else if ( $wgTitle->getInterwiki() != '' ) { |
134 | | - if( $rdfrom = $wgRequest->getVal( 'rdfrom' ) ) { |
135 | | - $url = $wgTitle->getFullURL( 'rdfrom=' . urlencode( $rdfrom ) ); |
136 | | - } else { |
137 | | - $url = $wgTitle->getFullURL(); |
138 | | - } |
139 | | - # Check for a redirect loop |
140 | | - if ( !preg_match( '/^' . preg_quote( $wgServer, '/' ) . '/', $url ) && $wgTitle->isLocal() ) { |
141 | | - $wgOut->redirect( $url ); |
142 | | - } else { |
143 | | - $wgTitle = Title::newFromText( wfMsgForContent( 'badtitle' ) ); |
144 | | - $wgOut->errorpage( 'badtitle', 'badtitletext' ); |
145 | | - } |
146 | | -} else if ( $mediaWiki->initializeSpecialCases( $wgTitle , $wgOut , $action ) ) { |
| 135 | +} else if ( $mediaWiki->initializeSpecialCases( $wgTitle , $wgOut , $wgRequest , $action ) ) { |
147 | 136 | # Do nothing, everything was already done by $mediaWiki |
148 | 137 | |
149 | 138 | } else { |
Index: trunk/phase3/includes/Wiki.php |
— | — | @@ -30,8 +30,21 @@ |
31 | 31 | /** |
32 | 32 | * Initialize the object to be known as $wgArticle for special cases |
33 | 33 | */ |
34 | | - function initializeSpecialCases ( &$title , &$output , $action ) { |
35 | | - if ( ( $action == 'view' ) && |
| 34 | + function initializeSpecialCases ( &$title , &$output , $request , $action ) { |
| 35 | + if ( $title->getInterwiki() != '' ) { |
| 36 | + if( $rdfrom = $request->getVal( 'rdfrom' ) ) { |
| 37 | + $url = $title->getFullURL( 'rdfrom=' . urlencode( $rdfrom ) ); |
| 38 | + } else { |
| 39 | + $url = $title->getFullURL(); |
| 40 | + } |
| 41 | + # Check for a redirect loop |
| 42 | + if ( !preg_match( '/^' . preg_quote( $this->getVal('Server'), '/' ) . '/', $url ) && $title->isLocal() ) { |
| 43 | + $output->redirect( $url ); |
| 44 | + } else { |
| 45 | + $title = Title::newFromText( wfMsgForContent( 'badtitle' ) ); |
| 46 | + $output->errorpage( 'badtitle', 'badtitletext' ); |
| 47 | + } |
| 48 | + } else if ( ( $action == 'view' ) && |
36 | 49 | (!isset( $this->GET['title'] ) || $title->getPrefixedDBKey() != $this->GET['title'] ) && |
37 | 50 | !count( array_diff( array_keys( $this->GET ), array( 'action', 'title' ) ) ) ) |
38 | 51 | { |