Index: branches/preferences-work/phase3/includes/HTMLForm.php |
— | — | @@ -99,7 +99,12 @@ |
100 | 100 | $this->loadData(); |
101 | 101 | |
102 | 102 | // 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(); |
104 | 109 | |
105 | 110 | if ($result === true) |
106 | 111 | return $result; |
— | — | @@ -114,14 +119,6 @@ |
115 | 120 | * Anything else == Error to display. |
116 | 121 | */ |
117 | 122 | function trySubmit() { |
118 | | - global $wgRequest, $wgUser; |
119 | | - |
120 | | - $editToken = $wgRequest->getVal( 'wpEditToken' ); |
121 | | - |
122 | | - if ( !$wgUser->matchEditToken( $editToken ) ) { |
123 | | - return false; |
124 | | - } |
125 | | - |
126 | 123 | // Check for validation |
127 | 124 | foreach( $this->mFlatFields as $fieldname => $field ) { |
128 | 125 | if ( !empty($field->mParams['nodata']) ) continue; |