]> scripts.mit.edu Git - autoinstallsdev/mediawiki.git/blobdiff - includes/OutputPage.php
MediaWiki 1.17.2
[autoinstallsdev/mediawiki.git] / includes / OutputPage.php
index 6ecc2754636b7b85303f0796f25e43b15b561dff..3a0be7bc3fbe186ea063342a946d79d1a5efa130 100644 (file)
@@ -1940,7 +1940,7 @@ class OutputPage {
         * Produce the stock "please login to use the wiki" page
         */
        public function loginToUse() {
-               global $wgUser;
+               global $wgUser, $wgRequest;
 
                if( $wgUser->isLoggedIn() ) {
                        $this->permissionRequired( 'read' );
@@ -1954,12 +1954,18 @@ class OutputPage {
                $this->setRobotPolicy( 'noindex,nofollow' );
                $this->setArticleFlag( false );
 
+               $returnto = Title::newFromURL( $wgRequest->getVal( 'title', '' ) );
+               $returntoquery = array();
+               if( $returnto ) {
+                       $returntoquery = array( 'returnto' => $returnto->getPrefixedText() );
+               }
+
                $loginTitle = SpecialPage::getTitleFor( 'Userlogin' );
                $loginLink = $skin->link(
                        $loginTitle,
                        wfMsgHtml( 'loginreqlink' ),
                        array(),
-                       array( 'returnto' => $this->getTitle()->getPrefixedText() ),
+                       $returntoquery,
                        array( 'known', 'noclasses' )
                );
                $this->addHTML( wfMsgWikiHtml( 'loginreqpagetext', $loginLink ) );