r12607 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r12606‎ | r12607 | r12608 >
Date:13:28, 11 January 2006
Author:magnus_manske
Status:old
Tags:
Comment:
moved more stuff
Modified paths:
  • /trunk/phase3/includes/Wiki.php (modified) (history)
  • /trunk/phase3/index.php (modified) (history)

Diff [purge]

Index: trunk/phase3/index.php
@@ -122,6 +122,8 @@
123123 require_once( "includes/Wiki.php" ) ;
124124 $mediaWiki = new MediaWiki() ;
125125
 126+$mediaWiki->setVal( "Server", $wgServer );
 127+
126128 if( !$wgDisableInternalSearch && !is_null( $search ) && $search !== '' ) {
127129 require_once( 'includes/SpecialSearch.php' );
128130 $wgTitle = Title::makeTitle( NS_SPECIAL, 'Search' );
@@ -129,20 +131,7 @@
130132 } else if( !$wgTitle or $wgTitle->getDBkey() == '' ) {
131133 $wgTitle = Title::newFromText( wfMsgForContent( 'badtitle' ) );
132134 $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 ) ) {
147136 # Do nothing, everything was already done by $mediaWiki
148137
149138 } else {
Index: trunk/phase3/includes/Wiki.php
@@ -30,8 +30,21 @@
3131 /**
3232 * Initialize the object to be known as $wgArticle for special cases
3333 */
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' ) &&
3649 (!isset( $this->GET['title'] ) || $title->getPrefixedDBKey() != $this->GET['title'] ) &&
3750 !count( array_diff( array_keys( $this->GET ), array( 'action', 'title' ) ) ) )
3851 {

Status & tagging log