r49768 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r49767‎ | r49768 | r49769 >
Date:09:37, 23 April 2009
Author:werdna
Status:deferred
Tags:
Comment:
Move UI logic from trySubmit() to show()
Modified paths:
  • /branches/preferences-work/phase3/includes/HTMLForm.php (modified) (history)

Diff [purge]

Index: branches/preferences-work/phase3/includes/HTMLForm.php
@@ -99,7 +99,12 @@
100100 $this->loadData();
101101
102102 // Try a submission
103 - $result = $this->trySubmit();
 103+ global $wgUser, $wgRequest;
 104+ $editToken = $wgRequest->getVal( 'wpEditToken' );
 105+
 106+ $result = false;
 107+ if ( $wgUser->matchEditToken( $editToken ) )
 108+ $result = $this->trySubmit();
104109
105110 if ($result === true)
106111 return $result;
@@ -114,14 +119,6 @@
115120 * Anything else == Error to display.
116121 */
117122 function trySubmit() {
118 - global $wgRequest, $wgUser;
119 -
120 - $editToken = $wgRequest->getVal( 'wpEditToken' );
121 -
122 - if ( !$wgUser->matchEditToken( $editToken ) ) {
123 - return false;
124 - }
125 -
126123 // Check for validation
127124 foreach( $this->mFlatFields as $fieldname => $field ) {
128125 if ( !empty($field->mParams['nodata']) ) continue;

Status & tagging log