r64081 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r64080‎ | r64081 | r64082 >
Date:17:38, 23 March 2010
Author:platonides
Status:deferred
Tags:
Comment:
Style changes, $_POST references removed, a few tabs changed to spaces te be at least consistent within the file, if it is not with code conventions.
Modified paths:
  • /trunk/extensions/DonationInterface/donate_interface/donate_interface.php (modified) (history)

Diff [purge]

Index: trunk/extensions/DonationInterface/donate_interface/donate_interface.php
@@ -41,8 +41,8 @@
4242
4343 $parser->setHook( 'donate', 'efDonateRender' );
4444
45 - //process form
46 - wfRunHooks( 'DonationInterface_DisplayForm' );
 45+ //process form
 46+ wfRunHooks( 'DonationInterface_DisplayForm' );
4747
4848 return true;
4949 }
@@ -113,9 +113,9 @@
114114
115115 $gatewayMenu = '';
116116
117 - foreach($values as $current) {
 117+ foreach($values as $current) {
118118 $gatewayMenu .= Xml::option($current['display_name'], $current['form_value']);
119 - }
 119+ }
120120
121121 //get available currencies
122122
@@ -322,12 +322,17 @@
323323 'email' => '',
324324 );
325325
326 - // if form has been submitted, assign data and redirect user to chosen payment gateway
327 - if ($_POST['process'] == "_yes_") {
 326+ // Checking that it was posted is not enough, donate_interface-amount-error
 327+ // would be shown on previews, anon purges... (bug 22640)
 328+ if ( ( !$wgRequest->wasPosted() ) || ( $wgRequest->getVal('process') != "_yes_" ) ) {
 329+ return true;
 330+ }
 331+ // if form has been submitted, assign data and redirect user to chosen payment gateway
 332+
328333 //find out which amount option was chosen for amount, redefined buttons or text box
329 - if ( isset($_POST['amount']) && preg_match('/^\d+(\.(\d+)?)?$/', $wgRequest->getText('amount')) ) {
 334+ if ( preg_match( '/^\d+(\.(\d+)?)?$/', $wgRequest->getText('amount') ) ) {
330335 $amount = number_format( $wgRequest->getText('amount'), 2 );
331 - } elseif ( preg_match('/^\d+(\.(\d+)?)?$/', $wgRequest->getText('amountGiven') )) {
 336+ } elseif ( preg_match( '/^\d+(\.(\d+)?)?$/', $wgRequest->getText('amountGiven') ) ) {
332337 $amount = number_format( $wgRequest->getText('amountGiven'), 2, '.', '' );
333338 } else {
334339 $wgOut->addHTML( wfMsg( 'donate_interface-amount-error' ) );
@@ -353,15 +358,11 @@
354359 $url = '';
355360
356361 if ( wfRunHooks('DonationInterface_Page', array(&$url)) ) {
357 -
358 - // send user to correct page for payment
359 - fnDonateRedirectToProcessorPage( $userInput, $url );
360 -
 362+ // send user to correct page for payment
 363+ fnDonateRedirectToProcessorPage( $userInput, $url );
361364 } else {
362365 $wgOut->addHTML( wfMsg( 'donate_interface-processing-error' ) );
363 - }
364 -
365 - }// end if form has been submitted
 366+ }
366367
367368 return true;
368369 }

Status & tagging log