aboutsummaryrefslogtreecommitdiffstats
path: root/includes/HTMLForm.php
diff options
context:
space:
mode:
authorAntoine Musso <hashar@users.mediawiki.org>2011-11-01 09:28:51 +0000
committerAntoine Musso <hashar@users.mediawiki.org>2011-11-01 09:28:51 +0000
commit1debab271ecdbedf7a88bfd707825a6e8b6a8543 (patch)
tree68a8e09e5de30fc889b6bfa7dbe2e3254d8eb34e /includes/HTMLForm.php
parent39ece40f466e7a9c3e9000c65533c7ddb772e60d (diff)
downloadmediawikicore-1debab271ecdbedf7a88bfd707825a6e8b6a8543.tar.gz
mediawikicore-1debab271ecdbedf7a88bfd707825a6e8b6a8543.zip
checkbox could not be checked through URL parameter
On [[Special:EmailUser]], someone ought to be able to pass the checkboxes names to overrides the default. As an example from bug 31770, the email user page has a checkbox wpCCMe which let the user as for a copy of the email being send. This is a user preference. One change that checkbox state by appending ?wpCCMe=<boolean> ie: Special:EmailUser/Hashar?wpCCMe=0 Special:EmailUser/Hashar?wpCCMe=1 The logic added in r84814 could have allowed checkboxes to be overriden for GET form. Unfortunately, HTMLForm is mostly with the default POST. Hence, when appending the query parameter, we would never honor it! The fix is to still unconditionally look at the value if the form was correctly submitted (ie has wpEditToken) and additionaly whenever there is a checkbox name appearing in the query (wherever it is false or true, hence the use of getVal()). This is a regression in REL1_18. I dont think it deserves a release notes since it is not fixing anything compared to 1.17. Bug fixed: ========== * (bug 31770) Allow URL parameter wpCCMe on Special:EmailUser * (bug 30909) URL parameters for checkboxes in Special:Block no longer work
Notes
Notes: http://mediawiki.org/wiki/Special:Code/MediaWiki/101464
Diffstat (limited to 'includes/HTMLForm.php')
-rw-r--r--includes/HTMLForm.php5
1 files changed, 4 insertions, 1 deletions
diff --git a/includes/HTMLForm.php b/includes/HTMLForm.php
index f883967159d5..b78153454931 100644
--- a/includes/HTMLForm.php
+++ b/includes/HTMLForm.php
@@ -1376,7 +1376,10 @@ class HTMLCheckField extends HTMLFormField {
}
// GetCheck won't work like we want for checks.
- if ( $request->getCheck( 'wpEditToken' ) || $this->mParent->getMethod() != 'post' ) {
+ // Fetch the value in either one of the two following case:
+ // - we have a valid token (form got posted or GET forged by the user)
+ // - checkbox name has a value (false or true), ie is not null
+ if ( $request->getCheck( 'wpEditToken' ) || $request->getVal( $this->mName )!== null ) {
// XOR has the following truth table, which is what we want
// INVERT VALUE | OUTPUT
// true true | false