r75850 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r75849‎ | r75850 | r75851 >
Date:02:06, 2 November 2010
Author:awjrichards
Status:deferred (Comments)
Tags:
Comment:
Changed paypal redirect method to use query params in the url with wgOut->redirect rather than posting with curl
Modified paths:
  • /trunk/extensions/DonationInterface/payflowpro_gateway/payflowpro_gateway.body.php (modified) (history)

Diff [purge]

Index: trunk/extensions/DonationInterface/payflowpro_gateway/payflowpro_gateway.body.php
@@ -1161,7 +1161,7 @@
11621162 * This would make this a lot less hack-ish
11631163 */
11641164 public function paypalRedirect( &$data ) {
1165 - global $wgPayflowGatewayPaypalURL, $wgPayflowGatewayTest;
 1165+ global $wgPayflowGatewayPaypalURL, $wgOut;
11661166
11671167 // if we don't have a URL enabled throw a graceful error to the user
11681168 if ( !strlen( $wgPayflowGatewayPaypalURL ) ) {
@@ -1182,20 +1182,6 @@
11831183 $wgPayflowGatewayPaypalURL .= "/" . $data[ 'language' ] . "?gateway=paypal";
11841184
11851185 // submit the data to the paypal redirect URL
1186 - $ch = curl_init();
1187 - curl_setopt( $ch, CURLOPT_URL, $wgPayflowGatewayPaypalURL );
1188 - curl_setopt( $ch, CURLOPT_USERAGENT, 'Donation_Interface PayflowPro Gateway PayPal Redirecter 1.0' );
1189 - curl_setopt( $ch, CURLOPT_POST, count( $data ) );
1190 - curl_setopt( $ch, CURLOPT_POSTFIELDS, http_build_query( $data ) );
1191 - if ( $wgPayflowGatewayTest ) curl_setopt( $ch, CURLOPT_SSL_VERIFYHOST, false );
1192 - $curl_result = curl_exec( $ch );
1193 - $curl_error = ( !$curl_result ) ? curl_error( $ch ) : null;
1194 - curl_close( $ch );
1195 -
1196 - // throw an exception if there was a curl error
1197 - if ( !is_null( $curl_error ) ) {
1198 - throw new MWException( 'There was a cURL error submitting information to ' . $wgPayflowGatewayPaypalURL . ': ' . $curl_error );
1199 - }
1200 -
 1186+ $wgOut->redirect( $wgPayflowGatewayPaypalURL . '&' . http_build_query( $data ) );
12011187 }
12021188 } // end class

Follow-up revisions

RevisionCommit summaryAuthorDate
r75851Merging from r75840 through r75850 from trunkawjrichards02:16, 2 November 2010
r75934Merging from r75850 through r75933 from trunkawjrichards16:52, 3 November 2010

Comments

#Comment by Platonides (talk | contribs)   14:53, 2 November 2010

You should be using wfAppendQuery()

Using GET could have privacy problems, but I assume $wgPayflowGatewayPaypalURL will be a https url.

Status & tagging log