From 5b691d264035eac793167a2005fbfd99ec9d1436 Mon Sep 17 00:00:00 2001 From: Matthew Britton Date: Tue, 30 Mar 2010 15:36:53 +0000 Subject: [PATCH] (bug 22910) Add Special:Unblock as an alias for the unblock form Links of the form [[Special:Unblock/Username]] also work. --- includes/SpecialPage.php | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/includes/SpecialPage.php b/includes/SpecialPage.php index 91764441e8..443d44e507 100644 --- a/includes/SpecialPage.php +++ b/includes/SpecialPage.php @@ -69,6 +69,10 @@ class SpecialPage { * Query parameters that can be passed through redirects */ var $mAllowedRedirectParams = array(); + /** + * Query parameteres added by redirects + */ + var $mAddedRedirectParams = array(); /** * List of special pages, followed by parameters. * If the only parameter is a string, that is the page name. @@ -118,6 +122,7 @@ class SpecialPage { # Users and rights 'Blockip' => array( 'SpecialPage', 'Blockip', 'block' ), 'Ipblocklist' => array( 'SpecialPage', 'Ipblocklist' ), + 'Unblock' => array( 'SpecialRedirectToSpecial', 'Unblock', 'Ipblocklist', false, array( 'uselang', 'ip', 'id' ), array( 'action' => 'unblock' ) ), 'Resetpass' => 'SpecialResetpass', 'DeletedContributions' => 'DeletedContributionsPage', 'Preferences' => 'SpecialPreferences', @@ -883,7 +888,11 @@ Perhaps no page aliases are defined for it?" ); if( ( $val = $wgRequest->getVal( $arg, null ) ) !== null ) $params[] = $arg . '=' . $val; } - + + foreach( $this->mAddedRedirectParams as $arg => $val ) { + $params[] = $arg . '=' . $val; + } + return count( $params ) ? implode( '&', $params ) : false; } } @@ -917,11 +926,12 @@ class IncludableSpecialPage extends SpecialPage class SpecialRedirectToSpecial extends UnlistedSpecialPage { var $redirName, $redirSubpage; - function __construct( $name, $redirName, $redirSubpage = false, $redirectParams = array() ) { + function __construct( $name, $redirName, $redirSubpage = false, $allowedRedirectParams = array(), $addedRedirectParams = array() ) { parent::__construct( $name ); $this->redirName = $redirName; $this->redirSubpage = $redirSubpage; - $this->mAllowedRedirectParams = $redirectParams; + $this->mAllowedRedirectParams = $allowedRedirectParams; + $this->mAddedRedirectParams = $addedRedirectParams; } function getRedirect( $subpage ) { -- 2.20.1