r78454 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r78453‎ | r78454 | r78455 >
Date:21:37, 15 December 2010
Author:happy-melon
Status:ok
Tags:
Comment:
Follow-up r78445: don't spam a useless edit token into the URL for GET requests.
Modified paths:
  • /trunk/phase3/includes/HTMLForm.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/HTMLForm.php
@@ -42,10 +42,10 @@
4343 * 'validation-callback' -- a function name to give you the chance
4444 * to impose extra validation on the field input.
4545 * @see HTMLForm::validate()
46 - * 'name' -- By default, the 'name' attribute of the input field
47 - * is "wp{$fieldname}". If you want a different name
48 - * (eg one without the "wp" prefix), specify it here and
49 - * it will be used without modification.
 46+ * 'name' -- By default, the 'name' attribute of the input field
 47+ * is "wp{$fieldname}". If you want a different name
 48+ * (eg one without the "wp" prefix), specify it here and
 49+ * it will be used without modification.
5050 *
5151 * TODO: Document 'section' / 'subsection' stuff
5252 */
@@ -211,7 +211,7 @@
212212 $editToken = $wgRequest->getVal( 'wpEditToken' );
213213
214214 $result = false;
215 - if ( $wgUser->matchEditToken( $editToken ) ) {
 215+ if ( $this->getMethod() != 'post' || $wgUser->matchEditToken( $editToken ) ) {
216216 $result = $this->trySubmit();
217217 }
218218 return $result;
@@ -397,8 +397,11 @@
398398 global $wgUser;
399399
400400 $html = '';
401 - $html .= Html::hidden( 'wpEditToken', $wgUser->editToken(), array( 'id' => 'wpEditToken' ) ) . "\n";
402 - $html .= Html::hidden( 'title', $this->getTitle()->getPrefixedText() ) . "\n";
 401+
 402+ if( $this->getMethod() == 'post' ){
 403+ $html .= Html::hidden( 'wpEditToken', $wgUser->editToken(), array( 'id' => 'wpEditToken' ) ) . "\n";
 404+ $html .= Html::hidden( 'title', $this->getTitle()->getPrefixedText() ) . "\n";
 405+ }
403406
404407 foreach ( $this->mHiddenFields as $data ) {
405408 list( $value, $attribs ) = $data;

Follow-up revisions

RevisionCommit summaryAuthorDate
r79140MFT HTMLForm saga (r78452, r78454, r78566, r78574)platonides23:10, 28 December 2010

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r78445Allow HTMLForms to be submitted by GET requests.happy-melon19:33, 15 December 2010

Status & tagging log