http://www.mediawiki.org/wiki/Special:Code/MediaWiki/64389

Revision: 64389
Author:   gurch
Date:     2010-03-30 15:36:53 +0000 (Tue, 30 Mar 2010)

Log Message:
-----------
(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: trunk/phase3/includes/SpecialPage.php
===================================================================
--- trunk/phase3/includes/SpecialPage.php       2010-03-30 14:29:40 UTC (rev 
64388)
+++ trunk/phase3/includes/SpecialPage.php       2010-03-30 15:36:53 UTC (rev 
64389)
@@ -70,6 +70,10 @@
         */
        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.
         * Otherwise, it is an array. The format is one of:
@@ -118,6 +122,7 @@
                # 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 @@
                        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 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 ) {



_______________________________________________
MediaWiki-CVS mailing list
MediaWiki-CVS@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs

Reply via email to