]> scripts.mit.edu Git - autoinstalls/mediawiki.git/blobdiff - includes/SkinTemplate.php
MediaWiki 1.17.1
[autoinstalls/mediawiki.git] / includes / SkinTemplate.php
index cfb67250fa01b0ae3ec37af383e7061730b55d69..023afdd88a5dd13db1f8104c57c7e7b50cb3050d 100644 (file)
@@ -549,11 +549,22 @@ class SkinTemplate extends Skin {
 
                /* set up the default links for the personal toolbar */
                $personal_urls = array();
-               $page = $wgRequest->getVal( 'returnto', $this->thisurl );
-               $query = $wgRequest->getVal( 'returntoquery', $this->thisquery );
-               $returnto = "returnto=$page";
-               if( $this->thisquery != '' )
-                       $returnto .= "&returntoquery=$query";
+
+               # Due to bug 32276, if a user does not have read permissions, 
+               # $wgOut->getTitle() will just give Special:Badtitle, which is 
+               # not especially useful as a returnto parameter. Use the title 
+               # from the request instead, if there was one.
+               $page = Title::newFromURL( $wgRequest->getVal( 'title', '' ) );
+               $page = $wgRequest->getVal( 'returnto', $page );
+               $returnto = '';
+               if( strval( $page ) !== '' ) {
+                       $returnto = "returnto=$page";
+                       $query = $wgRequest->getVal( 'returntoquery', $this->thisquery );
+                       if( $query != '' ) {
+                               $returnto .= "&returntoquery=$query";
+                       }
+               }
+
                if( $this->loggedin ) {
                        $personal_urls['userpage'] = array(
                                'text' => $this->username,