http://www.mediawiki.org/wiki/Special:Code/MediaWiki/96053
Revision: 96053
Author: awjrichards
Date: 2011-09-01 22:32:07 +0000 (Thu, 01 Sep 2011)
Log Message:
-----------
* Fixed incorrect tokens in globalcollect_test.html
* Added an 'action' token to dynamically create proper form action
* Changed how str_replace works for form data - now performing str_replace on
each individual field rather than passing in the arrays. This is not very
performant, but a quick a hack to make this work ASAP. will fix in the future.
Modified Paths:
--------------
trunk/extensions/DonationInterface/payflowpro_gateway/forms/RapidHtml.php
trunk/extensions/DonationInterface/payflowpro_gateway/forms/html/globalcollect_test.html
Modified:
trunk/extensions/DonationInterface/payflowpro_gateway/forms/RapidHtml.php
===================================================================
--- trunk/extensions/DonationInterface/payflowpro_gateway/forms/RapidHtml.php
2011-09-01 22:19:16 UTC (rev 96052)
+++ trunk/extensions/DonationInterface/payflowpro_gateway/forms/RapidHtml.php
2011-09-01 22:32:07 UTC (rev 96053)
@@ -55,6 +55,7 @@
// Not actually data tokens, but available to you in html form:
// @captcha -> the captcha form
// @script_path -> maps to $wgScriptPath
+ // @action -> generate correct form action for this form
);
/**
@@ -121,10 +122,22 @@
*/
public function add_data( $html ) {
global $wgScriptPath;
+
+ /**
+ * This is a hack and should be replaced with something more
performant.
+ */
+ $form = $html;
+ // handle form action
+ $form = str_replace( "@action", $this->getNoCacheAction(),
$form );
+
// replace data
- $form = str_replace( $this->data_tokens, $this->form_data,
$html );
-
+ foreach ( $this->data_tokens as $token ) {
+ $key = substr( $token, 1, strlen( $token )); //get the
token string w/o the '@'
+ if ( $key == 'emailAdd' ) $key = 'email';
+ $form = str_replace( $token, $this->form_data[ $key ],
$form );
+ }
+
// replace errors
$form = str_replace( $this->error_tokens, $this->form_errors,
$form );
Modified:
trunk/extensions/DonationInterface/payflowpro_gateway/forms/html/globalcollect_test.html
===================================================================
---
trunk/extensions/DonationInterface/payflowpro_gateway/forms/html/globalcollect_test.html
2011-09-01 22:19:16 UTC (rev 96052)
+++
trunk/extensions/DonationInterface/payflowpro_gateway/forms/html/globalcollect_test.html
2011-09-01 22:32:07 UTC (rev 96053)
@@ -53,7 +53,7 @@
<p class='creditcard-error-msg'></p>
<form name="payment" method="post"
-
action="/index.php/Special:PayflowProGateway?uselang=en&masthead=none&form_name=TwoStepTwoColumnLetter3&text_template=2010%2FJimmyQuote"
+ action="@action"
onsubmit="return formCheck(this)" autocomplete="off">
<div id="payflowpro_gateway-personal-info">
<table id="payflow-table-">
@@ -157,10 +157,10 @@
<input type="hidden" value="@comment" name="comment"/>
<input type="hidden" value="@comment-option"
name="comment-option"/>
<input type="hidden" value="@email-opt" name="email-opt"/>
- <input type="hidden" value="@payment_method"
name="payment_method"/>
+ <input type="hidden" value="processed"
name="payment_method"/>
<input type="hidden" value="@token"
name="token"/>
<input type="hidden" value="@order_id"
name="order_id"/>
- <input type="hidden" value="@num_attempt"
name="numAttempt"/>
+ <input type="hidden" value="@numAttempt"
name="numAttempt"/>
<input type="hidden"
value="@contribution_tracking_id" name="contribution_tracking_id"/>
<input type="hidden" value="@data_hash"
name="data_hash"/>
<input type="hidden" value="@action"
name="action"/>
_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs