Localisation updates for core and extension messages from translatewiki.net (2010...
[lhc/web/wiklou.git] / includes / Wiki.php
index 7845f8f..feebcde 100644 (file)
@@ -108,8 +108,9 @@ class MediaWiki {
                if( $wgRequest->getVal( 'printable' ) === 'yes' ) {
                        $wgOut->setPrintable();
                }
-
-               if( $curid = $wgRequest->getInt( 'curid' ) ) {
+               $ret = null;
+               $curid = $wgRequest->getInt( 'curid' );
+               if( $curid ) {
                        // URLs like this are generated by RC, because rc_title isn't always accurate
                        $ret = Title::newFromID( $curid );
                } elseif( $title == '' && $action != 'delete' ) {
@@ -179,7 +180,7 @@ class MediaWiki {
         */
        function handleSpecialCases( &$title, &$output, $request ) {
                wfProfileIn( __METHOD__ );
-               global $wgContLang, $wgUser;
+
                $action = $this->getVal( 'Action' );
 
                // Invalid titles. Bug 21776: The interwikis must redirect even if the page name is empty.
@@ -191,7 +192,8 @@ class MediaWiki {
 
                // Interwiki redirects
                } else if( $title->getInterwiki() != '' ) {
-                       if( $rdfrom = $request->getVal( 'rdfrom' ) ) {
+                       $rdfrom = $request->getVal( 'rdfrom' );
+                       if( $rdfrom ) {
                                $url = $title->getFullURL( 'rdfrom=' . urlencode( $rdfrom ) );
                        } else {
                                $query = $request->getValues();
@@ -209,9 +211,15 @@ class MediaWiki {
                        }
                // Redirect loops, no title in URL, $wgUsePathInfo URLs, and URLs with a variant
                } else if ( $action == 'view' && !$request->wasPosted()
-                       && ( !$request->getVal( 'title' ) || $title->getPrefixedDBKey() != $request->getText( 'title' ) )
+                       && ( $request->getVal( 'title' ) === null || $title->getPrefixedDBKey() != $request->getText( 'title' ) )
                        && !count( array_diff( array_keys( $request->getValues() ), array( 'action', 'title' ) ) ) )
                {
+                       if ( $title->getNamespace() == NS_SPECIAL ) {
+                               list( $name, $subpage ) = SpecialPage::resolveAliasWithSubpage( $title->getDBkey() );
+                               if ( $name ) {
+                                       $title = SpecialPage::getTitleFor( $name, $subpage );
+                               }
+                       }
                        $targetUrl = $title->getFullURL();
                        // Redirect to canonical url, make it a 301 to allow caching
                        if( $targetUrl == $request->getFullRequestURL() ) {