Merge "Added CAS logic to User::addAutopromoteOnceGroups"
[lhc/web/wiklou.git] / includes / specialpage / RedirectSpecialPage.php
index cd41a1c..a866ba7 100644 (file)
@@ -33,8 +33,11 @@ abstract class RedirectSpecialPage extends UnlistedSpecialPage {
        // Query parameters added by redirects
        protected $mAddedRedirectParams = array();
 
-       public function execute( $par ) {
-               $redirect = $this->getRedirect( $par );
+       /**
+        * @param string|null $subpage
+        */
+       public function execute( $subpage ) {
+               $redirect = $this->getRedirect( $subpage );
                $query = $this->getRedirectQuery();
                // Redirect to a page title with possible query parameters
                if ( $redirect instanceof Title ) {
@@ -58,10 +61,10 @@ abstract class RedirectSpecialPage extends UnlistedSpecialPage {
         * If the special page is a redirect, then get the Title object it redirects to.
         * False otherwise.
         *
-        * @param string $par Subpage string
+        * @param string|null $subpage
         * @return Title|bool
         */
-       abstract public function getRedirect( $par );
+       abstract public function getRedirect( $subpage );
 
        /**
         * Return part of the request string for a special redirect page
@@ -71,10 +74,13 @@ abstract class RedirectSpecialPage extends UnlistedSpecialPage {
         */
        public function getRedirectQuery() {
                $params = array();
+               $request = $this->getRequest();
 
                foreach ( $this->mAllowedRedirectParams as $arg ) {
-                       if ( $this->getRequest()->getVal( $arg, null ) !== null ) {
-                               $params[$arg] = $this->getRequest()->getVal( $arg );
+                       if ( $request->getVal( $arg, null ) !== null ) {
+                               $params[$arg] = $request->getVal( $arg );
+                       } elseif ( $request->getArray( $arg, null ) !== null ) {
+                               $params[$arg] = $request->getArray( $arg );
                        }
                }
 
@@ -109,12 +115,16 @@ abstract class SpecialRedirectToSpecial extends RedirectSpecialPage {
                $this->mAddedRedirectParams = $addedRedirectParams;
        }
 
+       /**
+        * @param string|null $subpage
+        * @return Title|bool
+        */
        public function getRedirect( $subpage ) {
                if ( $this->redirSubpage === false ) {
                        return SpecialPage::getTitleFor( $this->redirName, $subpage );
-               } else {
-                       return SpecialPage::getTitleFor( $this->redirName, $this->redirSubpage );
                }
+
+               return SpecialPage::getTitleFor( $this->redirName, $this->redirSubpage );
        }
 }
 
@@ -188,7 +198,7 @@ abstract class RedirectSpecialArticle extends RedirectSpecialPage {
                        'action',
                        'redirect', 'rdfrom',
                        # Options for preloaded edits
-                       'preload', 'editintro', 'preloadtitle', 'summary', 'nosummary',
+                       'preload', 'preloadparams', 'editintro', 'preloadtitle', 'summary', 'nosummary',
                        # Options for overriding user settings
                        'preview', 'minor', 'watchthis',
                        # Options for history/diffs
@@ -200,7 +210,7 @@ abstract class RedirectSpecialArticle extends RedirectSpecialPage {
                        'ctype', 'maxage', 'smaxage',
                );
 
-               wfRunHooks( "RedirectSpecialArticleRedirectParams", array( &$redirectParams ) );
+               Hooks::run( "RedirectSpecialArticleRedirectParams", array( &$redirectParams ) );
                $this->mAllowedRedirectParams = $redirectParams;
        }
 }