* (bug 19693) User name is now escaped in "Contributions for ..." link on
Special:BlockIP
* (bug 19571) Override buildConcat for SQLite.
+* Log in and log out links no longer return to page view when clicked from
+ history view, edit page, or something similar
== API changes in 1.16 ==
* Add a "return to" link pointing to a specified title
*
* @param Title $title Title to link
+ * @param string $query Query string
*/
- public function addReturnTo( $title ) {
+ public function addReturnTo( $title, $query ) {
global $wgUser;
$this->addLink( array( 'rel' => 'next', 'href' => $title->getFullUrl() ) );
- $link = wfMsgHtml( 'returnto', $wgUser->getSkin()->link( $title ) );
+ $link = wfMsgHtml( 'returnto', $wgUser->getSkin()->link(
+ $title, null, array(), $query ) );
$this->addHTML( "<p id=\"mw-returnto\">{$link}</p>\n" );
}
* @param null $unused No longer used
* @param Title $returnto Title to return to
*/
- public function returnToMain( $unused = null, $returnto = NULL ) {
+ public function returnToMain( $unused = null, $returnto = null, $returntoquery = null ) {
global $wgRequest;
- if ( $returnto == NULL ) {
+ if ( $returnto == null ) {
$returnto = $wgRequest->getText( 'returnto' );
}
+
+ if ( $returntoquery == null ) {
+ $returntoquery = $wgRequest->getText( 'returntoquery' );
+ }
if ( '' === $returnto ) {
$returnto = Title::newMainPage();
$titleObj = Title::newMainPage();
}
- $this->addReturnTo( $titleObj );
+ $this->addReturnTo( $titleObj, $returntoquery );
}
/**
wfProfileIn( __METHOD__ . '-stuff' );
$this->thispage = $this->mTitle->getPrefixedDBkey();
$this->thisurl = $this->mTitle->getPrefixedURL();
+ $query = $wgRequest->data;
+ unset( $query['title'] );
+ $this->thisquery = wfArrayToCGI( $query );
$this->loggedin = $wgUser->isLoggedIn();
$this->iscontent = ( $this->mTitle->getNamespace() != NS_SPECIAL );
$this->iseditable = ( $this->iscontent and !( $action == 'edit' or $action == 'submit' ) );
$personal_urls['logout'] = array(
'text' => wfMsg( 'userlogout' ),
'href' => self::makeSpecialUrl( 'Userlogout',
- $title->isSpecial( 'Preferences' ) ? '' : "returnto={$this->thisurl}"
+ $title->isSpecial( 'Preferences' ) ? '' : "returnto={$this->thisurl}&returntoquery={$this->thisquery}"
),
'active' => false
);
);
$personal_urls['anonlogin'] = array(
'text' => wfMsg( $loginlink ),
- 'href' => self::makeSpecialUrl( 'Userlogin', 'returnto=' . $this->thisurl ),
+ 'href' => self::makeSpecialUrl( 'Userlogin', "returnto={$this->thisurl}&returntoquery={$this->thisquery}" ),
'active' => $title->isSpecial( 'Userlogin' )
);
} else {
$personal_urls['login'] = array(
'text' => wfMsg( $loginlink ),
- 'href' => self::makeSpecialUrl( 'Userlogin', 'returnto=' . $this->thisurl ),
+ 'href' => self::makeSpecialUrl( 'Userlogin', "returnto={$this->thisurl}&returntoquery={$this->thisquery}" ),
'active' => $title->isSpecial( 'Userlogin' )
);
}
*/
public function getLinkUrl( $query = array(), $variant = false ) {
wfProfileIn( __METHOD__ );
- if( !is_array( $query ) ) {
- wfProfileOut( __METHOD__ );
- throw new MWException( 'Title::getLinkUrl passed a non-array for '.
- '$query' );
- }
if( $this->isExternal() ) {
$ret = $this->getFullURL( $query );
} elseif( $this->getPrefixedText() === '' && $this->getFragment() !== '' ) {
var $mName, $mPassword, $mRetype, $mReturnTo, $mCookieCheck, $mPosted;
var $mAction, $mCreateaccount, $mCreateaccountMail, $mMailmypassword;
- var $mLoginattempt, $mRemember, $mEmail, $mDomain, $mLanguage, $mSkipCookieCheck;
+ var $mLoginattempt, $mRemember, $mEmail, $mDomain, $mLanguage;
+ var $mSkipCookieCheck, $mReturnToQuery;
/**
* Constructor
$this->mRetype = $request->getText( 'wpRetype' );
$this->mDomain = $request->getText( 'wpDomain' );
$this->mReturnTo = $request->getVal( 'returnto' );
+ $this->mReturnToQuery = $request->getVal( 'returntoquery' );
$this->mCookieCheck = $request->getVal( 'wpCookieCheck' );
$this->mPosted = $request->wasPosted();
$this->mCreateaccount = $request->getCheck( 'wpCreateaccount' );
if ( $wgRedirectOnLogin ) {
$this->mReturnTo = $wgRedirectOnLogin;
+ $this->mReturnToQuery = '';
}
if( $wgEnableEmail ) {
# When switching accounts, it sucks to get automatically logged out
if( $this->mReturnTo == $wgLang->specialPage( 'Userlogout' ) ) {
$this->mReturnTo = '';
+ $this->mReturnToQuery = '';
}
}
if ( !$titleObj instanceof Title ) {
$titleObj = Title::newMainPage();
}
-
- $wgOut->redirect( $titleObj->getFullURL() );
+ $wgOut->redirect( $titleObj->getFullURL( $this->mReturnToQuery ) );
}
}
$wgOut->addHTML( $injected_html );
if ( !empty( $this->mReturnTo ) ) {
- $wgOut->returnToMain( null, $this->mReturnTo );
+ $wgOut->returnToMain( null, $this->mReturnTo, $this->mReturnToQuery );
} else {
$wgOut->returnToMain( null );
}
if ( !empty( $this->mReturnTo ) ) {
$returnto = '&returnto=' . wfUrlencode( $this->mReturnTo );
+ if ( !empty( $this->mReturnToQuery ) )
+ $returnto .= '&returntoquery=' .
+ wfUrlencode( $this->mReturnToQuery );
$q .= $returnto;
$linkq .= $returnto;
}