r64389 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r64388‎ | r64389 | r64390 >
Date:15:36, 30 March 2010
Author:gurch
Status:ok
Tags:
Comment:
(bug 22910) Add Special:Unblock as an alias for the unblock form

Links of the form [[Special:Unblock/Username]] also work.
Modified paths:
  • /trunk/phase3/includes/SpecialPage.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/SpecialPage.php
@@ -70,6 +70,10 @@
7171 */
7272 var $mAllowedRedirectParams = array();
7373 /**
 74+ * Query parameteres added by redirects
 75+ */
 76+ var $mAddedRedirectParams = array();
 77+ /**
7478 * List of special pages, followed by parameters.
7579 * If the only parameter is a string, that is the page name.
7680 * Otherwise, it is an array. The format is one of:
@@ -118,6 +122,7 @@
119123 # Users and rights
120124 'Blockip' => array( 'SpecialPage', 'Blockip', 'block' ),
121125 'Ipblocklist' => array( 'SpecialPage', 'Ipblocklist' ),
 126+ 'Unblock' => array( 'SpecialRedirectToSpecial', 'Unblock', 'Ipblocklist', false, array( 'uselang', 'ip', 'id' ), array( 'action' => 'unblock' ) ),
122127 'Resetpass' => 'SpecialResetpass',
123128 'DeletedContributions' => 'DeletedContributionsPage',
124129 'Preferences' => 'SpecialPreferences',
@@ -883,7 +888,11 @@
884889 if( ( $val = $wgRequest->getVal( $arg, null ) ) !== null )
885890 $params[] = $arg . '=' . $val;
886891 }
887 -
 892+
 893+ foreach( $this->mAddedRedirectParams as $arg => $val ) {
 894+ $params[] = $arg . '=' . $val;
 895+ }
 896+
888897 return count( $params ) ? implode( '&', $params ) : false;
889898 }
890899 }
@@ -917,11 +926,12 @@
918927 class SpecialRedirectToSpecial extends UnlistedSpecialPage {
919928 var $redirName, $redirSubpage;
920929
921 - function __construct( $name, $redirName, $redirSubpage = false, $redirectParams = array() ) {
 930+ function __construct( $name, $redirName, $redirSubpage = false, $allowedRedirectParams = array(), $addedRedirectParams = array() ) {
922931 parent::__construct( $name );
923932 $this->redirName = $redirName;
924933 $this->redirSubpage = $redirSubpage;
925 - $this->mAllowedRedirectParams = $redirectParams;
 934+ $this->mAllowedRedirectParams = $allowedRedirectParams;
 935+ $this->mAddedRedirectParams = $addedRedirectParams;
926936 }
927937
928938 function getRedirect( $subpage ) {

Follow-up revisions

RevisionCommit summaryAuthorDate
r64395Follow-up r64389: Add new special page to $specialPageAliasesraymond16:18, 30 March 2010

Status & tagging log