r53777 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r53776‎ | r53777 | r53778 >
Date:10:34, 26 July 2009
Author:catrope
Status:ok
Tags:
Comment:
Fix r53270: drop &returntoquery parameter if empty, and prevent Special:Userlogin from returning to itself, creating very long looplike URLs
Modified paths:
  • /trunk/phase3/includes/SkinTemplate.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/SkinTemplate.php
@@ -164,6 +164,8 @@
165165 $this->thisurl = $this->mTitle->getPrefixedURL();
166166 $query = $wgRequest->getValues();
167167 unset( $query['title'] );
 168+ unset( $query['returnto'] );
 169+ unset( $query['returntoquery'] );
168170 $this->thisquery = wfUrlencode( wfArrayToCGI( $query ) );
169171 $this->loggedin = $wgUser->isLoggedIn();
170172 $this->iscontent = ( $this->mTitle->getNamespace() != NS_SPECIAL );
@@ -516,6 +518,11 @@
517519
518520 /* set up the default links for the personal toolbar */
519521 $personal_urls = array();
 522+ $page = $wgRequest->getVal( 'returnto', $this->thisurl );
 523+ $query = $wgRequest->getVal( 'returntoquery', $this->thisquery );
 524+ $returnto = "returnto=$page";
 525+ if( $this->thisquery != '' )
 526+ $returnto .= "&returntoquery=$query";
520527 if( $this->loggedin ) {
521528 $personal_urls['userpage'] = array(
522529 'text' => $this->username,
@@ -568,7 +575,7 @@
569576 $personal_urls['logout'] = array(
570577 'text' => wfMsg( 'userlogout' ),
571578 'href' => self::makeSpecialUrl( 'Userlogout',
572 - $title->isSpecial( 'Preferences' ) ? '' : "returnto={$this->thisurl}&returntoquery={$this->thisquery}"
 579+ $title->isSpecial( 'Preferences' ) ? '' : $returnto
573580 ),
574581 'active' => false
575582 );
@@ -595,13 +602,13 @@
596603 );
597604 $personal_urls['anonlogin'] = array(
598605 'text' => wfMsg( $loginlink ),
599 - 'href' => self::makeSpecialUrl( 'Userlogin', "returnto={$this->thisurl}&returntoquery={$this->thisquery}" ),
 606+ 'href' => self::makeSpecialUrl( 'Userlogin', $returnto ),
600607 'active' => $title->isSpecial( 'Userlogin' )
601608 );
602609 } else {
603610 $personal_urls['login'] = array(
604611 'text' => wfMsg( $loginlink ),
605 - 'href' => self::makeSpecialUrl( 'Userlogin', "returnto={$this->thisurl}&returntoquery={$this->thisquery}" ),
 612+ 'href' => self::makeSpecialUrl( 'Userlogin', $returnto ),
606613 'active' => $title->isSpecial( 'Userlogin' )
607614 );
608615 }

Follow-up revisions

RevisionCommit summaryAuthorDate
r54535Merge trunk fixes to support returnto query params, needed for OptIn smoothness...brion18:15, 6 August 2009

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r53270Add returntoquery= parameter to Special:Userlogin which adds a query string t...catrope21:25, 14 July 2009

Status & tagging log