Fix form submission on Special:RandomInCategory
authorMatmaRex <matma.rex@gmail.com>
Sat, 24 Aug 2013 16:30:29 +0000 (18:30 +0200)
committerMatmaRex <matma.rex@gmail.com>
Sat, 24 Aug 2013 16:30:29 +0000 (18:30 +0200)
You can't have parameters in the action for GET forms, browsers are
going to trim them off.

This is the way passing title in handled on other special pages,
e.g. Special:Contributions.

Change-Id: I00728a085641b8a6cda50a55ad1e9b1de68b97bc

includes/specials/SpecialRandomInCategory.php

index fd554e6..d7f56ed 100644 (file)
@@ -68,6 +68,8 @@ class SpecialRandomInCategory extends SpecialPage {
        }
 
        public function execute( $par ) {
+               global $wgScript;
+
                $cat = false;
 
                $categoryStr = $this->getRequest()->getText( 'category', $par );
@@ -99,7 +101,8 @@ class SpecialRandomInCategory extends SpecialPage {
                        $submit = Html::input( '', $submitText, 'submit' );
 
                        $msg = $this->msg( 'randomincategory-selectcategory' );
-                       $form = Html::rawElement( 'form', array( 'action' => $this->getTitle()->getLocalUrl() ),
+                       $form = Html::rawElement( 'form', array( 'action' => $wgScript ),
+                               Html::hidden( 'title', $this->getTitle()->getPrefixedText() ) .
                                $msg->rawParams( $input, $submit )->parse()
                        );
                        $this->getOutput()->addHtml( $form );