From a22fbfc60f36f5f7ee10d5ae6fe347340c2ee67c Mon Sep 17 00:00:00 2001 From: Pierre Schmitz Date: Sat, 3 Dec 2011 09:20:55 +0100 Subject: Update to MediaWiki 1.17.1 --- includes/SkinTemplate.php | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) (limited to 'includes/SkinTemplate.php') diff --git a/includes/SkinTemplate.php b/includes/SkinTemplate.php index cfb67250..023afdd8 100644 --- a/includes/SkinTemplate.php +++ b/includes/SkinTemplate.php @@ -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, -- cgit v1.2.3-54-g00ecf