Fix r53270: drop &returntoquery parameter if empty, and prevent Special:Userlogin...
authorRoan Kattouw <catrope@users.mediawiki.org>
Sun, 26 Jul 2009 10:34:03 +0000 (10:34 +0000)
committerRoan Kattouw <catrope@users.mediawiki.org>
Sun, 26 Jul 2009 10:34:03 +0000 (10:34 +0000)
includes/SkinTemplate.php

index c47b5c3..0a4fb4e 100644 (file)
@@ -164,6 +164,8 @@ class SkinTemplate extends Skin {
                $this->thisurl = $this->mTitle->getPrefixedURL();
                $query = $wgRequest->getValues();
                unset( $query['title'] );
+               unset( $query['returnto'] );
+               unset( $query['returntoquery'] );
                $this->thisquery = wfUrlencode( wfArrayToCGI( $query ) );
                $this->loggedin = $wgUser->isLoggedIn();
                $this->iscontent = ( $this->mTitle->getNamespace() != NS_SPECIAL );
@@ -516,6 +518,11 @@ 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";
                if( $this->loggedin ) {
                        $personal_urls['userpage'] = array(
                                'text' => $this->username,
@@ -568,7 +575,7 @@ class SkinTemplate extends Skin {
                        $personal_urls['logout'] = array(
                                'text' => wfMsg( 'userlogout' ),
                                'href' => self::makeSpecialUrl( 'Userlogout',
-                                       $title->isSpecial( 'Preferences' ) ? '' : "returnto={$this->thisurl}&returntoquery={$this->thisquery}"
+                                       $title->isSpecial( 'Preferences' ) ? '' : $returnto
                                ),
                                'active' => false
                        );
@@ -595,13 +602,13 @@ class SkinTemplate extends Skin {
                                );
                                $personal_urls['anonlogin'] = array(
                                        'text' => wfMsg( $loginlink ),
-                                       'href' => self::makeSpecialUrl( 'Userlogin', "returnto={$this->thisurl}&returntoquery={$this->thisquery}" ),
+                                       'href' => self::makeSpecialUrl( 'Userlogin', $returnto ),
                                        'active' => $title->isSpecial( 'Userlogin' )
                                );
                        } else {
                                $personal_urls['login'] = array(
                                        'text' => wfMsg( $loginlink ),
-                                       'href' => self::makeSpecialUrl( 'Userlogin', "returnto={$this->thisurl}&returntoquery={$this->thisquery}" ),
+                                       'href' => self::makeSpecialUrl( 'Userlogin', $returnto ),
                                        'active' => $title->isSpecial( 'Userlogin' )
                                );
                        }