Allow 'uselang', 'useskin', 'debug' as query parameters in RedirectSpecialPages
authorGlaisher <glaisher.wiki@gmail.com>
Tue, 9 Jun 2015 17:24:44 +0000 (22:24 +0500)
committerGlaisher <glaisher.wiki@gmail.com>
Wed, 10 Jun 2015 04:56:20 +0000 (09:56 +0500)
These are special cases which can be used in all these
special pages so whitelist them.

Also fixed error in documentation.

Bug: T90390
Change-Id: Icc5e181533dc9825c877ccade4c80ea86ba19642

includes/specialpage/RedirectSpecialPage.php

index a866ba7..df1fa61 100644 (file)
@@ -70,13 +70,15 @@ abstract class RedirectSpecialPage extends UnlistedSpecialPage {
         * Return part of the request string for a special redirect page
         * This allows passing, e.g. action=history to Special:Mypage, etc.
         *
         * Return part of the request string for a special redirect page
         * This allows passing, e.g. action=history to Special:Mypage, etc.
         *
-        * @return string
+        * @return array|bool
         */
        public function getRedirectQuery() {
                $params = array();
                $request = $this->getRequest();
 
         */
        public function getRedirectQuery() {
                $params = array();
                $request = $this->getRequest();
 
-               foreach ( $this->mAllowedRedirectParams as $arg ) {
+               foreach ( array_merge( $this->mAllowedRedirectParams,
+                               array( 'uselang', 'useskin', 'debug' ) // parameters which can be passed to all pages
+                       ) as $arg ) {
                        if ( $request->getVal( $arg, null ) !== null ) {
                                $params[$arg] = $request->getVal( $arg );
                        } elseif ( $request->getArray( $arg, null ) !== null ) {
                        if ( $request->getVal( $arg, null ) !== null ) {
                                $params[$arg] = $request->getVal( $arg );
                        } elseif ( $request->getArray( $arg, null ) !== null ) {
@@ -205,7 +207,7 @@ abstract class RedirectSpecialArticle extends RedirectSpecialPage {
                        'section', 'oldid', 'diff', 'dir',
                        'limit', 'offset', 'feed',
                        # Misc options
                        'section', 'oldid', 'diff', 'dir',
                        'limit', 'offset', 'feed',
                        # Misc options
-                       'redlink', 'debug',
+                       'redlink',
                        # Options for action=raw; missing ctype can break JS or CSS in some browsers
                        'ctype', 'maxage', 'smaxage',
                );
                        # Options for action=raw; missing ctype can break JS or CSS in some browsers
                        'ctype', 'maxage', 'smaxage',
                );