summaryrefslogtreecommitdiff
path: root/includes/SkinTemplate.php
diff options
context:
space:
mode:
authorPierre Schmitz <pierre@archlinux.de>2011-12-03 09:20:55 +0100
committerPierre Schmitz <pierre@archlinux.de>2011-12-03 09:20:55 +0100
commita22fbfc60f36f5f7ee10d5ae6fe347340c2ee67c (patch)
tree31882fdc36540fecfd62e5011fc38515e504a3db /includes/SkinTemplate.php
parent6ca0c5e0a943b64b4e3d0a11a80c5679f7252e64 (diff)
Update to MediaWiki 1.17.1
Diffstat (limited to 'includes/SkinTemplate.php')
-rw-r--r--includes/SkinTemplate.php21
1 files changed, 16 insertions, 5 deletions
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,