Index: trunk/extensions/DonationInterface/gateway_forms/TwoColumnLetter2.php |
— | — | @@ -1,7 +1,6 @@ |
2 | 2 | <?php |
3 | 3 | |
4 | 4 | class Gateway_Form_TwoColumnLetter2 extends Gateway_Form_OneStepTwoColumn { |
5 | | - public $paypal = false; // true for paypal only version |
6 | 5 | |
7 | 6 | public function __construct( &$gateway, &$form_errors ) { |
8 | 7 | global $wgScriptPath; |
— | — | @@ -15,23 +14,13 @@ |
16 | 15 | } |
17 | 16 | |
18 | 17 | public function generateFormStart() { |
19 | | - global $wgOut, $wgRequest; |
20 | | - |
21 | | - $this->paypal = $wgRequest->getBool( 'paypal', false ); |
22 | | - |
23 | 18 | $form = parent::generateBannerHeader(); |
24 | 19 | |
25 | 20 | $form .= Xml::openElement( 'table', array( 'width' => '100%', 'cellspacing' => 0, 'cellpadding' => 0, 'border' => 0 ) ); |
26 | 21 | $form .= Xml::openElement( 'tr' ); |
27 | 22 | $form .= Xml::openElement( 'td', array( 'id' => 'appeal', 'valign' => 'top' ) ); |
28 | 23 | |
29 | | - $text_template = $wgRequest->getText( 'text_template', '2010/JimmyAppealLong' ); |
30 | | - // if the user has uselang set, honor that, otherwise default to the language set for the form defined by 'language' in the query string |
31 | | - if ( $wgRequest->getText( 'language' ) ) $text_template .= '/' . $this->form_data[ 'language' ]; |
32 | | - |
33 | | - $template = ( strlen( $text_template ) ) ? $wgOut->parse( '{{' . $text_template . '}}' ) : ''; |
34 | | - // if the template doesn't exist, prevent the display of the red link |
35 | | - if ( preg_match( '/redlink\=1/', $template ) ) $template = NULL; |
| 24 | + $template = self::generateTextTemplate(); |
36 | 25 | $form .= $template; |
37 | 26 | |
38 | 27 | $form .= Xml::closeElement( 'td' ); |
— | — | @@ -145,7 +134,7 @@ |
146 | 135 | } |
147 | 136 | |
148 | 137 | // anonymous |
149 | | - $comment_opt_value = ( $wgRequest->wasPosted() ) ? $this->form_data[ 'comment-option' ] : true; |
| 138 | + $comment_opt_value = ( $wgRequest->wasPosted() ) ? $this->getEscapedValue( 'comment-option' ) : true; |
150 | 139 | $form .= '<tr>'; |
151 | 140 | $form .= '<td class="check-option" colspan="2">' . Xml::check( 'comment-option', $comment_opt_value ); |
152 | 141 | $form .= ' ' . Xml::label( wfMsg( 'donate_interface-anon-message' ), 'comment-option' ) . '</td>'; |
Index: trunk/extensions/DonationInterface/gateway_forms/TwoColumnLetter3.php |
— | — | @@ -1,7 +1,6 @@ |
2 | 2 | <?php |
3 | 3 | |
4 | 4 | class Gateway_Form_TwoColumnLetter3 extends Gateway_Form_OneStepTwoColumn { |
5 | | - public $paypal = false; // true for paypal only version |
6 | 5 | |
7 | 6 | public function __construct( &$gateway, &$form_errors ) { |
8 | 7 | global $wgScriptPath; |
— | — | @@ -15,23 +14,13 @@ |
16 | 15 | } |
17 | 16 | |
18 | 17 | public function generateFormStart() { |
19 | | - global $wgOut, $wgRequest; |
20 | | - |
21 | | - $this->paypal = $wgRequest->getBool( 'paypal', false ); |
22 | | - |
23 | 18 | $form = parent::generateBannerHeader(); |
24 | 19 | |
25 | 20 | $form .= Xml::openElement( 'table', array( 'width' => '100%', 'cellspacing' => 0, 'cellpadding' => 0, 'border' => 0 ) ); |
26 | 21 | $form .= Xml::openElement( 'tr' ); |
27 | 22 | $form .= Xml::openElement( 'td', array( 'id' => 'appeal', 'valign' => 'top' ) ); |
28 | 23 | |
29 | | - $text_template = $wgRequest->getText( 'text_template', '2010/JimmyAppealLong' ); |
30 | | - // if the user has uselang set, honor that, otherwise default to the language set for the form defined by 'language' in the query string |
31 | | - if ( $wgRequest->getText( 'language' ) ) $text_template .= '/' . $this->form_data[ 'language' ]; |
32 | | - |
33 | | - $template = ( strlen( $text_template ) ) ? $wgOut->parse( '{{' . $text_template . '}}' ) : ''; |
34 | | - // if the template doesn't exist, prevent the display of the red link |
35 | | - if ( preg_match( '/redlink\=1/', $template ) ) $template = NULL; |
| 24 | + $template = self::generateTextTemplate(); |
36 | 25 | $form .= $template; |
37 | 26 | |
38 | 27 | $form .= Xml::closeElement( 'td' ); |
— | — | @@ -145,7 +134,7 @@ |
146 | 135 | } |
147 | 136 | |
148 | 137 | // anonymous |
149 | | - $comment_opt_value = ( $wgRequest->wasPosted() ) ? $this->form_data[ 'comment-option' ] : true; |
| 138 | + $comment_opt_value = ( $wgRequest->wasPosted() ) ? $this->getEscapedValue( 'comment-option' ) : true; |
150 | 139 | $form .= '<tr>'; |
151 | 140 | $form .= '<td class="check-option" colspan="2">' . Xml::check( 'comment-option', $comment_opt_value ); |
152 | 141 | $form .= ' ' . Xml::label( wfMsg( 'donate_interface-anon-message' ), 'comment-option' ) . '</td>'; |
Index: trunk/extensions/DonationInterface/gateway_forms/TwoColumnLetter4.php |
— | — | @@ -1,7 +1,6 @@ |
2 | 2 | <?php |
3 | 3 | |
4 | 4 | class Gateway_Form_TwoColumnLetter4 extends Gateway_Form_OneStepTwoColumn { |
5 | | - public $paypal = false; // true for paypal only version |
6 | 5 | |
7 | 6 | public function __construct( &$gateway, &$form_errors ) { |
8 | 7 | global $wgScriptPath; |
— | — | @@ -15,23 +14,13 @@ |
16 | 15 | } |
17 | 16 | |
18 | 17 | public function generateFormStart() { |
19 | | - global $wgOut, $wgRequest; |
20 | | - |
21 | | - $this->paypal = $wgRequest->getBool( 'paypal', false ); |
22 | | - |
23 | 18 | $form = parent::generateBannerHeader(); |
24 | 19 | |
25 | 20 | $form .= Xml::openElement( 'table', array( 'width' => '100%', 'cellspacing' => 0, 'cellpadding' => 0, 'border' => 0 ) ); |
26 | 21 | $form .= Xml::openElement( 'tr' ); |
27 | 22 | $form .= Xml::openElement( 'td', array( 'id' => 'appeal', 'valign' => 'top' ) ); |
28 | 23 | |
29 | | - $text_template = $wgRequest->getText( 'text_template', '2010/JimmyAppealLong' ); |
30 | | - // if the user has uselang set, honor that, otherwise default to the language set for the form defined by 'language' in the query string |
31 | | - if ( $wgRequest->getText( 'language' ) ) $text_template .= '/' . $this->form_data[ 'language' ]; |
32 | | - |
33 | | - $template = ( strlen( $text_template ) ) ? $wgOut->parse( '{{' . $text_template . '}}' ) : ''; |
34 | | - // if the template doesn't exist, prevent the display of the red link |
35 | | - if ( preg_match( '/redlink\=1/', $template ) ) $template = NULL; |
| 24 | + $template = self::generateTextTemplate(); |
36 | 25 | $form .= $template; |
37 | 26 | |
38 | 27 | $form .= Xml::closeElement( 'td' ); |
— | — | @@ -145,7 +134,7 @@ |
146 | 135 | } |
147 | 136 | |
148 | 137 | // anonymous |
149 | | - $comment_opt_value = ( $wgRequest->wasPosted() ) ? $this->form_data[ 'comment-option' ] : true; |
| 138 | + $comment_opt_value = ( $wgRequest->wasPosted() ) ? $this->getEscapedValue( 'comment-option' ) : true; |
150 | 139 | $form .= '<tr>'; |
151 | 140 | $form .= '<td class="check-option" colspan="2">' . Xml::check( 'comment-option', $comment_opt_value ); |
152 | 141 | $form .= ' ' . Xml::label( wfMsg( 'donate_interface-anon-message' ), 'comment-option' ) . '</td>'; |
Index: trunk/extensions/DonationInterface/gateway_forms/TwoColumnLetter5.php |
— | — | @@ -14,7 +14,7 @@ |
15 | 15 | } |
16 | 16 | |
17 | 17 | public function generateFormStart() { |
18 | | - global $wgOut, $wgRequest; |
| 18 | + global $wgOut; |
19 | 19 | |
20 | 20 | $form = parent::generateBannerHeader(); |
21 | 21 | |
— | — | @@ -22,13 +22,7 @@ |
23 | 23 | $form .= Xml::openElement( 'tr' ); |
24 | 24 | $form .= Xml::openElement( 'td', array( 'id' => 'appeal', 'valign' => 'top' ) ); |
25 | 25 | |
26 | | - $text_template = $wgRequest->getText( 'text_template', '2010/JimmyAppealLong' ); |
27 | | - // if the user has uselang set, honor that, otherwise default to the language set for the form defined by 'language' in the query string |
28 | | - if ( $wgRequest->getText( 'language' ) ) $text_template .= '/' . $this->form_data[ 'language' ]; |
29 | | - |
30 | | - $template = ( strlen( $text_template ) ) ? $wgOut->parse( '{{' . $text_template . '}}' ) : ''; |
31 | | - // if the template doesn't exist, prevent the display of the red link |
32 | | - if ( preg_match( '/redlink\=1/', $template ) ) $template = NULL; |
| 26 | + $template = self::generateTextTemplate(); |
33 | 27 | $form .= $template; |
34 | 28 | |
35 | 29 | $form .= Xml::closeElement( 'td' ); |
— | — | @@ -93,24 +87,24 @@ |
94 | 88 | // amount |
95 | 89 | $otherChecked = false; |
96 | 90 | $amount = -1; |
97 | | - if ( $this->form_data['amount'] != 100 && $this->form_data['amount'] != 50 && $this->form_data['amount'] != 35 && $this->form_data['amount'] != 20 && $this->form_data['amountOther'] > 0 ) { |
| 91 | + if ( $this->getEscapedValue( 'amount' ) != 100 && $this->getEscapedValue( 'amount' ) != 50 && $this->getEscapedValue( 'amount' ) != 35 && $this->getEscapedValue( 'amount' ) != 20 && $this->getEscapedValue( 'amountOther' ) > 0 ) { |
98 | 92 | $otherChecked = true; |
99 | | - $amount = $this->form_data['amountOther']; |
| 93 | + $amount = $this->getEscapedValue( 'amountOther' ); |
100 | 94 | } |
101 | 95 | $form .= '<tr>'; |
102 | 96 | $form .= '<td colspan="2"><span class="creditcard-error-msg">' . $this->form_errors['invalidamount'] . '</span></td>'; |
103 | 97 | $form .= '</tr>'; |
104 | 98 | $form .= '<tr>'; |
105 | 99 | $form .= '<td class="label">' . Xml::label( wfMsg( 'donate_interface-donor-amount' ), 'amount' ) . '</td>'; |
106 | | - $form .= '<td>' . Xml::radio( 'amount', 100, $this->form_data['amount'] == 100, array( 'onfocus' => 'clearField2( document.getElementById(\'amountOther\'), "Other" )' ) ) . '100 ' . |
107 | | - Xml::radio( 'amount', 50, $this->form_data['amount'] == 50, array( 'onfocus' => 'clearField2( document.getElementById(\'amountOther\'), "Other" )' ) ) . '50 ' . |
108 | | - Xml::radio( 'amount', 35, $this->form_data['amount'] == 35, array( 'onfocus' => 'clearField2( document.getElementById(\'amountOther\'), "Other" )' ) ) . '35 ' . |
109 | | - Xml::radio( 'amount', 20, $this->form_data['amount'] == 20, array( 'onfocus' => 'clearField2( document.getElementById(\'amountOther\'), "Other" )' ) ) . '20 ' . |
| 100 | + $form .= '<td>' . Xml::radio( 'amount', 100, $this->getEscapedValue( 'amount' ) == 100, array( 'onfocus' => 'clearField2( document.getElementById(\'amountOther\'), "Other" )' ) ) . '100 ' . |
| 101 | + Xml::radio( 'amount', 50, $this->getEscapedValue( 'amount' ) == 50, array( 'onfocus' => 'clearField2( document.getElementById(\'amountOther\'), "Other" )' ) ) . '50 ' . |
| 102 | + Xml::radio( 'amount', 35, $this->getEscapedValue( 'amount' ) == 35, array( 'onfocus' => 'clearField2( document.getElementById(\'amountOther\'), "Other" )' ) ) . '35 ' . |
| 103 | + Xml::radio( 'amount', 20, $this->getEscapedValue( 'amount' ) == 20, array( 'onfocus' => 'clearField2( document.getElementById(\'amountOther\'), "Other" )' ) ) . '20 ' . |
110 | 104 | '</td>'; |
111 | 105 | $form .= '</tr>'; |
112 | 106 | $form .= '<tr>'; |
113 | 107 | $form .= '<td class="label"></td>'; |
114 | | - $form .= '<td>' . Xml::radio( 'amount', $amount, $otherChecked, array( 'id' => 'otherRadio' ) ) . Xml::input( 'amountOther', '7', $this->form_data['amountOther'], array( 'type' => 'text', 'onfocus' => 'clearField(this, "Other");document.getElementById("otherRadio").checked=true;', 'maxlength' => '10', 'onblur' => 'document.getElementById("otherRadio").value = this.value;', 'id' => 'amountOther' ) ) . |
| 108 | + $form .= '<td>' . Xml::radio( 'amount', $amount, $otherChecked, array( 'id' => 'otherRadio' ) ) . Xml::input( 'amountOther', '7', $this->getEscapedValue( 'amountOther' ), array( 'type' => 'text', 'onfocus' => 'clearField(this, "Other");document.getElementById("otherRadio").checked=true;', 'maxlength' => '10', 'onblur' => 'document.getElementById("otherRadio").value = this.value;', 'id' => 'amountOther' ) ) . |
115 | 109 | ' ' . $this->generateCurrencyDropdown() . '</td>'; |
116 | 110 | $form .= '</tr>'; |
117 | 111 | |
— | — | @@ -121,7 +115,7 @@ |
122 | 116 | $form .= $this->getEmailField(); |
123 | 117 | |
124 | 118 | // email opt-in |
125 | | - $email_opt_value = ( $wgRequest->wasPosted() ) ? $this->form_data[ 'email-opt' ] : true; |
| 119 | + $email_opt_value = ( $wgRequest->wasPosted() ) ? $this->getEscapedValue( 'email-opt' ) : true; |
126 | 120 | $form .= '<tr>'; |
127 | 121 | $form .= '<td class="label"> </td>'; |
128 | 122 | $form .= '<td class="check-option">' . Xml::check( 'email-opt', $email_opt_value ); |
— | — | @@ -136,11 +130,11 @@ |
137 | 131 | $form .= '<tr>'; |
138 | 132 | $form .= '<td class="label">' . wfMsg( 'donate_interface-payment-type' ) . '</td>'; |
139 | 133 | $form .= '<td>' . |
140 | | - Xml::radio( 'card_type', 'cc1', $this->form_data['card_type'] == 'cc1', array( 'id' => 'cc1radio', 'onclick' => 'switchToCreditCard()' ) ) . '<label for="cc1radio">' . Xml::element( 'img', array( 'src' => $wgScriptPath . "/extensions/DonationInterface/gateway_forms/includes/card-visa.png" ) ). '</label>' . |
141 | | - Xml::radio( 'card_type', 'cc2', $this->form_data['card_type'] == 'cc2', array( 'id' => 'cc2radio', 'onclick' => 'switchToCreditCard()' ) ) . '<label for="cc2radio">' . Xml::element( 'img', array( 'src' => $wgScriptPath . "/extensions/DonationInterface/gateway_forms/includes/card-mastercard.png" ) ). '</label>' . |
142 | | - Xml::radio( 'card_type', 'cc3', $this->form_data['card_type'] == 'cc3', array( 'id' => 'cc3radio', 'onclick' => 'switchToCreditCard()' ) ) . '<label for="cc3radio">' . Xml::element( 'img', array( 'src' => $wgScriptPath . "/extensions/DonationInterface/gateway_forms/includes/card-amex.png" ) ). '</label>' . |
143 | | - Xml::radio( 'card_type', 'cc4', $this->form_data['card_type'] == 'cc4', array( 'id' => 'cc4radio', 'onclick' => 'switchToCreditCard()' ) ) . '<label for="cc4radio">' . Xml::element( 'img', array( 'src' => $wgScriptPath . "/extensions/DonationInterface/gateway_forms/includes/card-discover.png" ) ). '</label>' . |
144 | | - Xml::radio( 'card_type', 'pp', $this->form_data['card_type'] == 'pp', array( 'id' => 'ppradio', 'onclick' => 'switchToPayPal()' ) ) . '<label for="ppradio">' . Xml::element( 'img', array( 'src' => $wgScriptPath . "/extensions/DonationInterface/gateway_forms/includes/card-paypal.png" ) ) . '</label>' . |
| 134 | + Xml::radio( 'card_type', 'cc1', $this->getEscapedValue( 'card_type' ) == 'cc1', array( 'id' => 'cc1radio', 'onclick' => 'switchToCreditCard()' ) ) . '<label for="cc1radio">' . Xml::element( 'img', array( 'src' => $wgScriptPath . "/extensions/DonationInterface/gateway_forms/includes/card-visa.png" ) ). '</label>' . |
| 135 | + Xml::radio( 'card_type', 'cc2', $this->getEscapedValue( 'card_type' ) == 'cc2', array( 'id' => 'cc2radio', 'onclick' => 'switchToCreditCard()' ) ) . '<label for="cc2radio">' . Xml::element( 'img', array( 'src' => $wgScriptPath . "/extensions/DonationInterface/gateway_forms/includes/card-mastercard.png" ) ). '</label>' . |
| 136 | + Xml::radio( 'card_type', 'cc3', $this->getEscapedValue( 'card_type' ) == 'cc3', array( 'id' => 'cc3radio', 'onclick' => 'switchToCreditCard()' ) ) . '<label for="cc3radio">' . Xml::element( 'img', array( 'src' => $wgScriptPath . "/extensions/DonationInterface/gateway_forms/includes/card-amex.png" ) ). '</label>' . |
| 137 | + Xml::radio( 'card_type', 'cc4', $this->getEscapedValue( 'card_type' ) == 'cc4', array( 'id' => 'cc4radio', 'onclick' => 'switchToCreditCard()' ) ) . '<label for="cc4radio">' . Xml::element( 'img', array( 'src' => $wgScriptPath . "/extensions/DonationInterface/gateway_forms/includes/card-discover.png" ) ). '</label>' . |
| 138 | + Xml::radio( 'card_type', 'pp', $this->getEscapedValue( 'card_type' ) == 'pp', array( 'id' => 'ppradio', 'onclick' => 'switchToPayPal()' ) ) . '<label for="ppradio">' . Xml::element( 'img', array( 'src' => $wgScriptPath . "/extensions/DonationInterface/gateway_forms/includes/card-paypal.png" ) ) . '</label>' . |
145 | 139 | '</td>'; |
146 | 140 | $form .= '</tr>'; |
147 | 141 | |
— | — | @@ -172,14 +166,14 @@ |
173 | 167 | $form .= '</tr>'; |
174 | 168 | $form .= '<tr>'; |
175 | 169 | $form .= '<td class="label">' . Xml::label( wfMsg( 'donate_interface-donor-postal' ), 'zip' ) . '</td>'; |
176 | | - $form .= '<td>' . Xml::input( 'zip', '15', $this->form_data['zip'], array( 'type' => 'text', 'maxlength' => '15', 'id' => 'zip' ) ) . |
| 170 | + $form .= '<td>' . Xml::input( 'zip', '15', $this->getEscapedValue( 'zip' ), array( 'type' => 'text', 'maxlength' => '15', 'id' => 'zip' ) ) . |
177 | 171 | '</td>'; |
178 | 172 | $form .= '</tr>'; |
179 | 173 | // country |
180 | 174 | $form .= $this->getCountryField(); |
181 | 175 | |
182 | 176 | /* |
183 | | - $comment_opt_value = ( $wgRequest->wasPosted() ) ? $this->form_data[ 'comment-option' ] : true; |
| 177 | + $comment_opt_value = ( $wgRequest->wasPosted() ) ? $this->getEscapedValue( 'comment-option' ) : true; |
184 | 178 | $form .= '<tr>'; |
185 | 179 | $form .= '<td class="check-option" colspan="2">' . Xml::check( 'comment-option', $comment_opt_value ); |
186 | 180 | $form .= ' ' . Xml::label( wfMsg( 'donate_interface-anon-message' ), 'comment-option' ) . '</td>'; |
Index: trunk/extensions/DonationInterface/gateway_forms/TwoColumnLetter6.php |
— | — | @@ -14,7 +14,7 @@ |
15 | 15 | } |
16 | 16 | |
17 | 17 | public function generateFormStart() { |
18 | | - global $wgOut, $wgRequest; |
| 18 | + global $wgOut; |
19 | 19 | |
20 | 20 | $form = parent::generateBannerHeader(); |
21 | 21 | |
— | — | @@ -22,13 +22,7 @@ |
23 | 23 | $form .= Xml::openElement( 'tr' ); |
24 | 24 | $form .= Xml::openElement( 'td', array( 'id' => 'appeal', 'valign' => 'top' ) ); |
25 | 25 | |
26 | | - $text_template = $wgRequest->getText( 'text_template', '2010/JimmyAppealLong' ); |
27 | | - // if the user has uselang set, honor that, otherwise default to the language set for the form defined by 'language' in the query string |
28 | | - if ( $wgRequest->getText( 'language' ) ) $text_template .= '/' . $this->form_data[ 'language' ]; |
29 | | - |
30 | | - $template = ( strlen( $text_template ) ) ? $wgOut->parse( '{{' . $text_template . '}}' ) : ''; |
31 | | - // if the template doesn't exist, prevent the display of the red link |
32 | | - if ( preg_match( '/redlink\=1/', $template ) ) $template = NULL; |
| 26 | + $template = self::generateTextTemplate(); |
33 | 27 | $form .= $template; |
34 | 28 | |
35 | 29 | $form .= Xml::closeElement( 'td' ); |
— | — | @@ -93,29 +87,29 @@ |
94 | 88 | // amount |
95 | 89 | $otherChecked = false; |
96 | 90 | $amount = -1; |
97 | | - if ( $this->form_data['amount'] != 100 && $this->form_data['amount'] != 50 && $this->form_data['amount'] != 35 && $this->form_data['amount'] != 20 && $this->form_data['amountOther'] > 0 ) { |
| 91 | + if ( $this->getEscapedValue( 'amount' ) != 100 && $this->getEscapedValue( 'amount' ) != 50 && $this->getEscapedValue( 'amount' ) != 35 && $this->getEscapedValue( 'amount' ) != 20 && $this->getEscapedValue( 'amountOther' ) > 0 ) { |
98 | 92 | $otherChecked = true; |
99 | | - $amount = $this->form_data['amountOther']; |
| 93 | + $amount = $this->getEscapedValue( 'amountOther' ); |
100 | 94 | } |
101 | 95 | $form .= '<tr>'; |
102 | 96 | $form .= '<td colspan="2"><span class="creditcard-error-msg">' . $this->form_errors['invalidamount'] . '</span></td>'; |
103 | 97 | $form .= '</tr>'; |
104 | 98 | $form .= '<tr>'; |
105 | 99 | $form .= '<td class="label">' . Xml::label( wfMsg( 'donate_interface-donor-amount' ), 'amount' ) . '</td>'; |
106 | | - $form .= '<td>' . Xml::radio( 'amount', 100, $this->form_data['amount'] == 100, array( 'onfocus' => 'clearField2( document.getElementById(\'amountOther\'), "Other" )' ) ) . '100 ' . |
107 | | - Xml::radio( 'amount', 50, $this->form_data['amount'] == 50, array( 'onfocus' => 'clearField2( document.getElementById(\'amountOther\'), "Other" )' ) ) . '50 ' . |
108 | | - Xml::radio( 'amount', 35, $this->form_data['amount'] == 35, array( 'onfocus' => 'clearField2( document.getElementById(\'amountOther\'), "Other" )' ) ) . '35 ' . |
109 | | - Xml::radio( 'amount', 20, $this->form_data['amount'] == 20, array( 'onfocus' => 'clearField2( document.getElementById(\'amountOther\'), "Other" )' ) ) . '20 ' . |
| 100 | + $form .= '<td>' . Xml::radio( 'amount', 100, $this->getEscapedValue( 'amount' ) == 100, array( 'onfocus' => 'clearField2( document.getElementById(\'amountOther\'), "Other" )' ) ) . '100 ' . |
| 101 | + Xml::radio( 'amount', 50, $this->getEscapedValue( 'amount' ) == 50, array( 'onfocus' => 'clearField2( document.getElementById(\'amountOther\'), "Other" )' ) ) . '50 ' . |
| 102 | + Xml::radio( 'amount', 35, $this->getEscapedValue( 'amount' ) == 35, array( 'onfocus' => 'clearField2( document.getElementById(\'amountOther\'), "Other" )' ) ) . '35 ' . |
| 103 | + Xml::radio( 'amount', 20, $this->getEscapedValue( 'amount' ) == 20, array( 'onfocus' => 'clearField2( document.getElementById(\'amountOther\'), "Other" )' ) ) . '20 ' . |
110 | 104 | '</td>'; |
111 | 105 | $form .= '</tr>'; |
112 | 106 | $form .= '<tr>'; |
113 | 107 | $form .= '<td class="label"></td>'; |
114 | | - $form .= '<td>' . Xml::radio( 'amount', $amount, $otherChecked, array( 'id' => 'otherRadio' ) ) . Xml::input( 'amountOther', '7', $this->form_data['amountOther'], array( 'type' => 'text', 'onfocus' => 'clearField(this, "Other");document.getElementById("otherRadio").checked=true;', 'maxlength' => '10', 'onblur' => 'document.getElementById("otherRadio").value = this.value;', 'id' => 'amountOther' ) ) . |
| 108 | + $form .= '<td>' . Xml::radio( 'amount', $amount, $otherChecked, array( 'id' => 'otherRadio' ) ) . Xml::input( 'amountOther', '7', $this->getEscapedValue( 'amountOther' ), array( 'type' => 'text', 'onfocus' => 'clearField(this, "Other");document.getElementById("otherRadio").checked=true;', 'maxlength' => '10', 'onblur' => 'document.getElementById("otherRadio").value = this.value;', 'id' => 'amountOther' ) ) . |
115 | 109 | ' ' . $this->generateCurrencyDropdown() . '</td>'; |
116 | 110 | $form .= '</tr>'; |
117 | 111 | |
118 | 112 | // email opt-in |
119 | | - $email_opt_value = ( $wgRequest->wasPosted() ) ? $this->form_data[ 'email-opt' ] : true; |
| 113 | + $email_opt_value = ( $wgRequest->wasPosted() ) ? $this->getEscapedValue( 'email-opt' ) : true; |
120 | 114 | $form .= '<tr>'; |
121 | 115 | $form .= '<td class="label"> </td>'; |
122 | 116 | $form .= '<td class="check-option">' . Xml::check( 'email-opt', $email_opt_value ); |
— | — | @@ -130,17 +124,17 @@ |
131 | 125 | $form .= '<tr>'; |
132 | 126 | $form .= '<td class="label">' . wfMsg( 'donate_interface-payment-type' ) . '</td>'; |
133 | 127 | $form .= '<td>' . |
134 | | - Xml::radio( 'card_type', 'cc1', $this->form_data['card_type'] == 'cc1', array( 'id' => 'cc1radio', 'onclick' => 'switchToCreditCard()' ) ) . '<label for="cc1radio">' . Xml::element( 'img', array( 'src' => $wgScriptPath . "/extensions/DonationInterface/gateway_forms/includes/card-visa.png" ) ). '</label>' . |
135 | | - Xml::radio( 'card_type', 'cc2', $this->form_data['card_type'] == 'cc2', array( 'id' => 'cc2radio', 'onclick' => 'switchToCreditCard()' ) ) . '<label for="cc2radio">' . Xml::element( 'img', array( 'src' => $wgScriptPath . "/extensions/DonationInterface/gateway_forms/includes/card-mastercard.png" ) ). '</label>' . |
136 | | - Xml::radio( 'card_type', 'cc3', $this->form_data['card_type'] == 'cc3', array( 'id' => 'cc3radio', 'onclick' => 'switchToCreditCard()' ) ) . '<label for="cc3radio">' . Xml::element( 'img', array( 'src' => $wgScriptPath . "/extensions/DonationInterface/gateway_forms/includes/card-amex.png" ) ). '</label>' . |
137 | | - Xml::radio( 'card_type', 'cc4', $this->form_data['card_type'] == 'cc4', array( 'id' => 'cc4radio', 'onclick' => 'switchToCreditCard()' ) ) . '<label for="cc4radio">' . Xml::element( 'img', array( 'src' => $wgScriptPath . "/extensions/DonationInterface/gateway_forms/includes/card-discover.png" ) ). '</label>' . |
138 | | - Xml::radio( 'card_type', 'pp', $this->form_data['card_type'] == 'pp', array( 'id' => 'ppradio', 'onclick' => 'switchToPayPal()' ) ) . '<label for="ppradio">' . Xml::element( 'img', array( 'src' => $wgScriptPath . "/extensions/DonationInterface/gateway_forms/includes/card-paypal.png" ) ) . '</label>' . |
| 128 | + Xml::radio( 'card_type', 'cc1', $this->getEscapedValue( 'card_type' ) == 'cc1', array( 'id' => 'cc1radio', 'onclick' => 'switchToCreditCard()' ) ) . '<label for="cc1radio">' . Xml::element( 'img', array( 'src' => $wgScriptPath . "/extensions/DonationInterface/gateway_forms/includes/card-visa.png" ) ). '</label>' . |
| 129 | + Xml::radio( 'card_type', 'cc2', $this->getEscapedValue( 'card_type' ) == 'cc2', array( 'id' => 'cc2radio', 'onclick' => 'switchToCreditCard()' ) ) . '<label for="cc2radio">' . Xml::element( 'img', array( 'src' => $wgScriptPath . "/extensions/DonationInterface/gateway_forms/includes/card-mastercard.png" ) ). '</label>' . |
| 130 | + Xml::radio( 'card_type', 'cc3', $this->getEscapedValue( 'card_type' ) == 'cc3', array( 'id' => 'cc3radio', 'onclick' => 'switchToCreditCard()' ) ) . '<label for="cc3radio">' . Xml::element( 'img', array( 'src' => $wgScriptPath . "/extensions/DonationInterface/gateway_forms/includes/card-amex.png" ) ). '</label>' . |
| 131 | + Xml::radio( 'card_type', 'cc4', $this->getEscapedValue( 'card_type' ) == 'cc4', array( 'id' => 'cc4radio', 'onclick' => 'switchToCreditCard()' ) ) . '<label for="cc4radio">' . Xml::element( 'img', array( 'src' => $wgScriptPath . "/extensions/DonationInterface/gateway_forms/includes/card-discover.png" ) ). '</label>' . |
| 132 | + Xml::radio( 'card_type', 'pp', $this->getEscapedValue( 'card_type' ) == 'pp', array( 'id' => 'ppradio', 'onclick' => 'switchToPayPal()' ) ) . '<label for="ppradio">' . Xml::element( 'img', array( 'src' => $wgScriptPath . "/extensions/DonationInterface/gateway_forms/includes/card-paypal.png" ) ) . '</label>' . |
139 | 133 | '</td>'; |
140 | 134 | $form .= '</tr>'; |
141 | 135 | |
142 | 136 | $form .= '</table>'; |
143 | 137 | |
144 | | - if ( $this->form_data['card_type'] == 'cc1' || $this->form_data['card_type'] == 'cc2' || $this->form_data['card_type'] == 'cc3' || $this->form_data['card_type'] == 'cc4' ) { |
| 138 | + if ( $this->getEscapedValue( 'card_type' ) == 'cc1' || $this->getEscapedValue( 'card_type' ) == 'cc2' || $this->getEscapedValue( 'card_type' ) == 'cc3' || $this->getEscapedValue( 'card_type' ) == 'cc4' ) { |
145 | 139 | $form .= Xml::openElement( 'table', array( 'id' => 'payflow-table-cc' ) ); |
146 | 140 | } else { |
147 | 141 | $form .= Xml::openElement( 'table', array( 'id' => 'payflow-table-cc', 'style' => 'display: none;' ) ); |
— | — | @@ -180,14 +174,14 @@ |
181 | 175 | $form .= '</tr>'; |
182 | 176 | $form .= '<tr>'; |
183 | 177 | $form .= '<td class="label">' . Xml::label( wfMsg( 'donate_interface-donor-postal' ), 'zip' ) . '</td>'; |
184 | | - $form .= '<td>' . Xml::input( 'zip', '15', $this->form_data['zip'], array( 'type' => 'text', 'maxlength' => '15', 'id' => 'zip' ) ) . |
| 178 | + $form .= '<td>' . Xml::input( 'zip', '15', $this->getEscapedValue( 'zip' ), array( 'type' => 'text', 'maxlength' => '15', 'id' => 'zip' ) ) . |
185 | 179 | '</td>'; |
186 | 180 | $form .= '</tr>'; |
187 | 181 | // country |
188 | 182 | $form .= $this->getCountryField(); |
189 | 183 | |
190 | 184 | /* |
191 | | - $comment_opt_value = ( $wgRequest->wasPosted() ) ? $this->form_data[ 'comment-option' ] : true; |
| 185 | + $comment_opt_value = ( $wgRequest->wasPosted() ) ? $this->getEscapedValue( 'comment-option' ) : true; |
192 | 186 | $form .= '<tr>'; |
193 | 187 | $form .= '<td class="check-option" colspan="2">' . Xml::check( 'comment-option', $comment_opt_value ); |
194 | 188 | $form .= ' ' . Xml::label( wfMsg( 'donate_interface-anon-message' ), 'comment-option' ) . '</td>'; |
— | — | @@ -202,7 +196,7 @@ |
203 | 197 | public function generateFormSubmit() { |
204 | 198 | |
205 | 199 | // cc submit button |
206 | | - if ( $this->form_data['card_type'] == 'cc1' || $this->form_data['card_type'] == 'cc2' || $this->form_data['card_type'] == 'cc3' || $this->form_data['card_type'] == 'cc4' ) { |
| 200 | + if ( $this->getEscapedValue( 'card_type' ) == 'cc1' || $this->getEscapedValue( 'card_type' ) == 'cc2' || $this->getEscapedValue( 'card_type' ) == 'cc3' || $this->getEscapedValue( 'card_type' ) == 'cc4' ) { |
207 | 201 | $form = Xml::openElement( 'div', array( 'id' => 'payflowpro_gateway-form-submit' ) ); |
208 | 202 | } else { |
209 | 203 | $form = Xml::openElement( 'div', array( 'id' => 'payflowpro_gateway-form-submit', 'style' => 'display: none;' ) ); |
— | — | @@ -216,7 +210,7 @@ |
217 | 211 | $form .= Xml::closeElement( 'div' ); // close div#payflowpro_gateway-form-submit |
218 | 212 | |
219 | 213 | // paypal submit button |
220 | | - if ( $this->form_data['card_type'] == 'cc1' || $this->form_data['card_type'] == 'cc2' || $this->form_data['card_type'] == 'cc3' || $this->form_data['card_type'] == 'cc4' ) { |
| 214 | + if ( $this->getEscapedValue( 'card_type' ) == 'cc1' || $this->getEscapedValue( 'card_type' ) == 'cc2' || $this->getEscapedValue( 'card_type' ) == 'cc3' || $this->getEscapedValue( 'card_type' ) == 'cc4' ) { |
221 | 215 | $form .= Xml::openElement( 'div', array( 'id' => 'payflowpro_gateway-form-submit-paypal', 'style' => 'display: none;' ) ); |
222 | 216 | } else { |
223 | 217 | $form .= Xml::openElement( 'div', array( 'id' => 'payflowpro_gateway-form-submit-paypal' ) ); |
Index: trunk/extensions/DonationInterface/gateway_forms/TwoStepTwoColumnLetter.php |
— | — | @@ -13,7 +13,7 @@ |
14 | 14 | } |
15 | 15 | |
16 | 16 | public function generateFormStart() { |
17 | | - global $wgOut, $wgRequest; |
| 17 | + global $wgOut; |
18 | 18 | |
19 | 19 | $form = parent::generateBannerHeader(); |
20 | 20 | |
— | — | @@ -21,13 +21,7 @@ |
22 | 22 | $form .= Xml::openElement( 'tr' ); |
23 | 23 | $form .= Xml::openElement( 'td', array( 'id' => 'appeal', 'valign' => 'top' ) ); |
24 | 24 | |
25 | | - $text_template = $wgRequest->getText( 'text_template', '2010/JimmyAppealLong' ); |
26 | | - // if the user has uselang set, honor that, otherwise default to the language set for the form defined by 'language' in the query string |
27 | | - if ( $wgRequest->getText( 'language' ) ) $text_template .= '/' . $this->form_data[ 'language' ]; |
28 | | - |
29 | | - $template = ( strlen( $text_template ) ) ? $wgOut->parse( '{{' . $text_template . '}}' ) : ''; |
30 | | - // if the template doesn't exist, prevent the display of the red link |
31 | | - if ( preg_match( '/redlink\=1/', $template ) ) $template = NULL; |
| 25 | + $template = self::generateTextTemplate(); |
32 | 26 | $form .= $template; |
33 | 27 | |
34 | 28 | $form .= Xml::closeElement( 'td' ); |
— | — | @@ -94,12 +88,12 @@ |
95 | 89 | $form .= '</tr>'; |
96 | 90 | $form .= '<tr>'; |
97 | 91 | $form .= '<td class="label">' . Xml::label( wfMsg( 'donate_interface-donor-amount' ), 'amount' ) . '</td>'; |
98 | | - $form .= '<td>' . Xml::input( 'amount', '7', $this->form_data['amount'], array( 'type' => 'text', 'maxlength' => '10', 'id' => 'amount' ) ) . |
| 92 | + $form .= '<td>' . Xml::input( 'amount', '7', $this->getEscapedValue( 'amount' ), array( 'type' => 'text', 'maxlength' => '10', 'id' => 'amount' ) ) . |
99 | 93 | ' ' . $this->generateCurrencyDropdown() . '</td>'; |
100 | 94 | $form .= '</tr>'; |
101 | 95 | |
102 | 96 | // card logos |
103 | | - if ( $this->form_data[ 'currency_code' ] == 'USD' ) { |
| 97 | + if ( $this->getEscapedValue( 'currency_code' ) == 'USD' ) { |
104 | 98 | $form .= '<tr id="four_cards" style="display:table-row;">'; |
105 | 99 | $form .= '<td class="label"> </td><td>' . Xml::element( 'img', array( 'src' => $wgScriptPath . "/extensions/DonationInterface/gateway_forms/includes/credit_card_logos.gif" ) ) . '</td>'; |
106 | 100 | $form .= '</tr>'; |
Index: trunk/extensions/DonationInterface/gateway_forms/TwoColumnLetter7.php |
— | — | @@ -143,13 +143,7 @@ |
144 | 144 | $form .= Xml::openElement( 'tr' ); |
145 | 145 | $form .= Xml::openElement( 'td', array( 'id' => 'appeal', 'valign' => 'top' ) ); |
146 | 146 | |
147 | | - $text_template = $wgRequest->getText( 'text_template', '2010/JimmyAppealLong' ); |
148 | | - // if the user has uselang set, honor that, otherwise default to the language set for the form defined by 'language' in the query string |
149 | | - if ( $wgRequest->getText( 'language' ) ) $text_template .= '/' . $this->form_data[ 'language' ]; |
150 | | - |
151 | | - $template = ( strlen( $text_template ) ) ? $wgOut->parse( '{{' . $text_template . '}}' ) : ''; |
152 | | - // if the template doesn't exist, prevent the display of the red link |
153 | | - if ( preg_match( '/redlink\=1/', $template ) ) $template = NULL; |
| 147 | + $template = self::generateTextTemplate(); |
154 | 148 | $form .= $template; |
155 | 149 | |
156 | 150 | $form .= Xml::closeElement( 'td' ); |
— | — | @@ -214,9 +208,9 @@ |
215 | 209 | // amount |
216 | 210 | $otherChecked = false; |
217 | 211 | $amount = -1; |
218 | | - if ( $this->form_data['amount'] != 250 && $this->form_data['amount'] != 150 && $this->form_data['amount'] != 100 && $this->form_data['amount'] != 75 && $this->form_data['amount'] != 50 && $this->form_data['amount'] != 35 && $this->form_data['amount'] != 20 && $this->form_data['amountOther'] > 0 ) { |
| 212 | + if ( $this->getEscapedValue( 'amount' ) != 250 && $this->getEscapedValue( 'amount' ) != 150 && $this->getEscapedValue( 'amount' ) != 100 && $this->getEscapedValue( 'amount' ) != 75 && $this->getEscapedValue( 'amount' ) != 50 && $this->getEscapedValue( 'amount' ) != 35 && $this->getEscapedValue( 'amount' ) != 20 && $this->getEscapedValue( 'amountOther' ) > 0 ) { |
219 | 213 | $otherChecked = true; |
220 | | - $amount = $this->form_data['amountOther']; |
| 214 | + $amount = $this->getEscapedValue( 'amountOther' ); |
221 | 215 | } |
222 | 216 | $form .= '<tr>'; |
223 | 217 | $form .= '<td colspan="2"><span class="creditcard-error-msg">' . $this->form_errors['invalidamount'] . '</span></td>'; |
— | — | @@ -225,22 +219,22 @@ |
226 | 220 | $form .= '<td class="label"><div style="padding-top:4px;">' . Xml::label( wfMsg( 'donate_interface-donor-amount' ), 'amount' ) . '</div></td>'; |
227 | 221 | $form .= '<td>' . |
228 | 222 | '<table cellspacing="3" cellpadding="0" border="0" style="margin-bottom:0.2em;"><tr>' . |
229 | | - '<td>'.Xml::radio( 'amount', 20, $this->form_data['amount'] == 20, array( 'onfocus' => 'clearField2( document.getElementById(\'amountOther\'), "Other" )' ) ) . '$20 '.'</td>'. |
230 | | - '<td>'.Xml::radio( 'amount', 35, $this->form_data['amount'] == 35, array( 'onfocus' => 'clearField2( document.getElementById(\'amountOther\'), "Other" )' ) ) . '$35 '.'</td>'. |
231 | | - '<td>'.Xml::radio( 'amount', 50, $this->form_data['amount'] == 50, array( 'onfocus' => 'clearField2( document.getElementById(\'amountOther\'), "Other" )' ) ) . '$50 '.'</td>'. |
232 | | - '<td>'.Xml::radio( 'amount', 75, $this->form_data['amount'] == 75, array( 'onfocus' => 'clearField2( document.getElementById(\'amountOther\'), "Other" )' ) ) . '$75 '.'</td>'. |
| 223 | + '<td>'.Xml::radio( 'amount', 20, $this->getEscapedValue( 'amount' ) == 20, array( 'onfocus' => 'clearField2( document.getElementById(\'amountOther\'), "Other" )' ) ) . '$20 '.'</td>'. |
| 224 | + '<td>'.Xml::radio( 'amount', 35, $this->getEscapedValue( 'amount' ) == 35, array( 'onfocus' => 'clearField2( document.getElementById(\'amountOther\'), "Other" )' ) ) . '$35 '.'</td>'. |
| 225 | + '<td>'.Xml::radio( 'amount', 50, $this->getEscapedValue( 'amount' ) == 50, array( 'onfocus' => 'clearField2( document.getElementById(\'amountOther\'), "Other" )' ) ) . '$50 '.'</td>'. |
| 226 | + '<td>'.Xml::radio( 'amount', 75, $this->getEscapedValue( 'amount' ) == 75, array( 'onfocus' => 'clearField2( document.getElementById(\'amountOther\'), "Other" )' ) ) . '$75 '.'</td>'. |
233 | 227 | '</tr><tr>' . |
234 | | - '<td>'.Xml::radio( 'amount', 100, $this->form_data['amount'] == 100, array( 'onfocus' => 'clearField2( document.getElementById(\'amountOther\'), "Other" )' ) ) . '$100 '.'</td>'. |
235 | | - '<td>'.Xml::radio( 'amount', 150, $this->form_data['amount'] == 150, array( 'onfocus' => 'clearField2( document.getElementById(\'amountOther\'), "Other" )' ) ) . '$150 '.'</td>'. |
236 | | - '<td>'.Xml::radio( 'amount', 250, $this->form_data['amount'] == 250, array( 'onfocus' => 'clearField2( document.getElementById(\'amountOther\'), "Other" )' ) ) . '$250 '.'</td>'. |
237 | | - '<td>'.Xml::radio( 'amount', $amount, $otherChecked, array( 'id' => 'otherRadio' ) ) . Xml::input( 'amountOther', '7', $this->form_data['amountOther'], array( 'type' => 'text', 'onfocus' => 'clearField(this, "Other");document.getElementById("otherRadio").checked=true;', 'maxlength' => '10', 'onblur' => 'document.getElementById("otherRadio").value = this.value;', 'id' => 'amountOther' ) ).Html::hidden( 'currency_code', 'USD' ).'</td>'. |
| 228 | + '<td>'.Xml::radio( 'amount', 100, $this->getEscapedValue( 'amount' ) == 100, array( 'onfocus' => 'clearField2( document.getElementById(\'amountOther\'), "Other" )' ) ) . '$100 '.'</td>'. |
| 229 | + '<td>'.Xml::radio( 'amount', 150, $this->getEscapedValue( 'amount' ) == 150, array( 'onfocus' => 'clearField2( document.getElementById(\'amountOther\'), "Other" )' ) ) . '$150 '.'</td>'. |
| 230 | + '<td>'.Xml::radio( 'amount', 250, $this->getEscapedValue( 'amount' ) == 250, array( 'onfocus' => 'clearField2( document.getElementById(\'amountOther\'), "Other" )' ) ) . '$250 '.'</td>'. |
| 231 | + '<td>'.Xml::radio( 'amount', $amount, $otherChecked, array( 'id' => 'otherRadio' ) ) . Xml::input( 'amountOther', '7', $this->getEscapedValue( 'amountOther' ), array( 'type' => 'text', 'onfocus' => 'clearField(this, "Other");document.getElementById("otherRadio").checked=true;', 'maxlength' => '10', 'onblur' => 'document.getElementById("otherRadio").value = this.value;', 'id' => 'amountOther' ) ).Html::hidden( 'currency_code', 'USD' ).'</td>'. |
238 | 232 | '</tr></table>' . |
239 | 233 | '</td>'; |
240 | 234 | $form .= '</tr>'; |
241 | 235 | |
242 | 236 | // email opt-in |
243 | 237 | /* |
244 | | - $email_opt_value = ( $wgRequest->wasPosted() ) ? $this->form_data[ 'email-opt' ] : true; |
| 238 | + $email_opt_value = ( $wgRequest->wasPosted() ) ? $this->getEscapedValue( 'email-opt' ) : true; |
245 | 239 | $form .= '<tr>'; |
246 | 240 | $form .= '<td class="label"> </td>'; |
247 | 241 | $form .= '<td class="check-option">' . Xml::check( 'email-opt', $email_opt_value ); |
— | — | @@ -257,20 +251,20 @@ |
258 | 252 | $form .= '<td class="label""><div style="padding-top:9px;">' . wfMsg( 'donate_interface-payment-type' ) . '</div></td>'; |
259 | 253 | $form .= '<td>' . |
260 | 254 | '<p style="border: 1px solid rgb(187, 187, 187); float: left; -moz-border-radius: 5px 5px 5px 5px; margin: 0 8px 0 0; padding: 5px 5px 5px 3px; white-space: nowrap;">'. |
261 | | - Xml::radio( 'card_type', 'cc1', $this->form_data['card_type'] == 'cc1', array( 'id' => 'cc1radio', 'onclick' => 'switchToCreditCard()' ) ) . '<label for="cc1radio">' . Xml::element( 'img', array( 'src' => $wgScriptPath . "/extensions/DonationInterface/gateway_forms/includes/card-visa.png" ) ). '</label>' . |
| 255 | + Xml::radio( 'card_type', 'cc1', $this->getEscapedValue( 'card_type' ) == 'cc1', array( 'id' => 'cc1radio', 'onclick' => 'switchToCreditCard()' ) ) . '<label for="cc1radio">' . Xml::element( 'img', array( 'src' => $wgScriptPath . "/extensions/DonationInterface/gateway_forms/includes/card-visa.png" ) ). '</label>' . |
262 | 256 | ' <label for="cc1radio">' . Xml::element( 'img', array( 'src' => $wgScriptPath . "/extensions/DonationInterface/gateway_forms/includes/card-mastercard.png" ) ). '</label>' . |
263 | 257 | ' <label for="cc1radio">' . Xml::element( 'img', array( 'src' => $wgScriptPath . "/extensions/DonationInterface/gateway_forms/includes/card-amex.png" ) ). '</label>' . |
264 | 258 | ' <label for="cc1radio">' . Xml::element( 'img', array( 'src' => $wgScriptPath . "/extensions/DonationInterface/gateway_forms/includes/card-discover.png" ) ). '</label>' . |
265 | 259 | '</p>'. |
266 | 260 | '<p style="border: 1px solid transparent; float: left; -moz-border-radius: 5px 5px 5px 5px; margin: 0; padding: 5px 5px 5px 3px; white-space: nowrap;">'. |
267 | | - Xml::radio( 'card_type', 'pp', $this->form_data['card_type'] == 'pp', array( 'id' => 'ppradio', 'onclick' => 'switchToPayPal()' ) ) . '<label for="ppradio">' . Xml::element( 'img', array( 'src' => $wgScriptPath . "/extensions/DonationInterface/gateway_forms/includes/card-paypal.png" ) ) . '</label>' . |
| 261 | + Xml::radio( 'card_type', 'pp', $this->getEscapedValue( 'card_type' ) == 'pp', array( 'id' => 'ppradio', 'onclick' => 'switchToPayPal()' ) ) . '<label for="ppradio">' . Xml::element( 'img', array( 'src' => $wgScriptPath . "/extensions/DonationInterface/gateway_forms/includes/card-paypal.png" ) ) . '</label>' . |
268 | 262 | '</p>'. |
269 | 263 | '</td>'; |
270 | 264 | $form .= '</tr>'; |
271 | 265 | |
272 | 266 | $form .= '</table>'; |
273 | 267 | |
274 | | - if ( $this->form_data['card_type'] == 'cc1' || $this->form_data['card_type'] == 'cc2' || $this->form_data['card_type'] == 'cc3' || $this->form_data['card_type'] == 'cc4' ) { |
| 268 | + if ( $this->getEscapedValue( 'card_type' ) == 'cc1' || $this->getEscapedValue( 'card_type' ) == 'cc2' || $this->getEscapedValue( 'card_type' ) == 'cc3' || $this->getEscapedValue( 'card_type' ) == 'cc4' ) { |
275 | 269 | $form .= Xml::openElement( 'table', array( 'id' => 'payflow-table-cc' ) ); |
276 | 270 | } else { |
277 | 271 | $form .= Xml::openElement( 'table', array( 'id' => 'payflow-table-cc', 'style' => 'display: none;' ) ); |
— | — | @@ -302,8 +296,8 @@ |
303 | 297 | $form .= '</tr>'; |
304 | 298 | $form .= '<tr>'; |
305 | 299 | $form .= '<td class="label">' . Xml::label( wfMsg( 'donate_interface-name-on-card' ), 'fname' ) . '</td>'; |
306 | | - $form .= '<td>' . Xml::input( 'fname', '30', $this->form_data['fname'], array( 'type' => 'text', 'onfocus' => 'clearField( this, \''.wfMsg( 'donate_interface-donor-fname' ).'\' )', 'maxlength' => '25', 'class' => 'required', 'id' => 'fname' ) ) . |
307 | | - Xml::input( 'lname', '30', $this->form_data['lname'], array( 'type' => 'text', 'onfocus' => 'clearField( this, \''.wfMsg( 'donate_interface-donor-lname' ).'\' )', 'maxlength' => '25', 'id' => 'lname' ) ) . '</td>'; |
| 300 | + $form .= '<td>' . Xml::input( 'fname', '30', $this->getEscapedValue( 'fname' ), array( 'type' => 'text', 'onfocus' => 'clearField( this, \''.wfMsg( 'donate_interface-donor-fname' ).'\' )', 'maxlength' => '25', 'class' => 'required', 'id' => 'fname' ) ) . |
| 301 | + Xml::input( 'lname', '30', $this->getEscapedValue( 'lname' ), array( 'type' => 'text', 'onfocus' => 'clearField( this, \''.wfMsg( 'donate_interface-donor-lname' ).'\' )', 'maxlength' => '25', 'id' => 'lname' ) ) . '</td>'; |
308 | 302 | $form .= "</tr>"; |
309 | 303 | |
310 | 304 | // street |
— | — | @@ -312,7 +306,7 @@ |
313 | 307 | $form .= '</tr>'; |
314 | 308 | $form .= '<tr>'; |
315 | 309 | $form .= '<td class="label">' . Xml::label( wfMsg( 'donate_interface-billing-address' ), 'street' ) . '</td>'; |
316 | | - $form .= '<td>' . Xml::input( 'street', '30', $this->form_data['street'], array( 'type' => 'text', 'onfocus' => 'clearField( this, \''.wfMsg( 'donate_interface-donor-street' ).'\' )', 'maxlength' => '100', 'id' => 'street', 'class' => 'fullwidth' ) ) . |
| 310 | + $form .= '<td>' . Xml::input( 'street', '30', $this->getEscapedValue( 'street' ), array( 'type' => 'text', 'onfocus' => 'clearField( this, \''.wfMsg( 'donate_interface-donor-street' ).'\' )', 'maxlength' => '100', 'id' => 'street', 'class' => 'fullwidth' ) ) . |
317 | 311 | '</td>'; |
318 | 312 | $form .= '</tr>'; |
319 | 313 | |
— | — | @@ -322,9 +316,9 @@ |
323 | 317 | $form .= '</tr>'; |
324 | 318 | $form .= '<tr>'; |
325 | 319 | $form .= '<td class="label"> </td>'; |
326 | | - $form .= '<td>' . Xml::input( 'city', '18', $this->form_data['city'], array( 'type' => 'text', 'onfocus' => 'clearField( this, \''.wfMsg( 'donate_interface-donor-city' ).'\' )', 'maxlength' => '40', 'id' => 'city' ) ) . ' ' . |
| 320 | + $form .= '<td>' . Xml::input( 'city', '18', $this->getEscapedValue( 'city' ), array( 'type' => 'text', 'onfocus' => 'clearField( this, \''.wfMsg( 'donate_interface-donor-city' ).'\' )', 'maxlength' => '40', 'id' => 'city' ) ) . ' ' . |
327 | 321 | $this->generateStateDropdown() . ' ' . |
328 | | - Xml::input( 'zip', '5', $this->form_data['zip'], array( 'type' => 'text', 'onfocus' => 'clearField( this, \''.wfMsg( 'donate_interface-zip-code' ).'\' )', 'maxlength' => '10', 'id' => 'zip' ) ) . |
| 322 | + Xml::input( 'zip', '5', $this->getEscapedValue( 'zip' ), array( 'type' => 'text', 'onfocus' => 'clearField( this, \''.wfMsg( 'donate_interface-zip-code' ).'\' )', 'maxlength' => '10', 'id' => 'zip' ) ) . |
329 | 323 | Html::hidden( 'country', 'US' ) . |
330 | 324 | '</td>'; |
331 | 325 | $form .= '</tr>'; |
— | — | @@ -346,13 +340,13 @@ |
347 | 341 | $form .= '</tr>'; |
348 | 342 | $form .= '<tr>'; |
349 | 343 | $form .= '<td class="label">' . Xml::label( wfMsg( 'donate_interface-email-receipt' ), 'emailAdd' ) . '</td>'; |
350 | | - $form .= '<td>' . Xml::input( 'emailAdd', '30', $this->form_data['email'], array( 'type' => 'text', 'onfocus' => 'clearField( this, \''.wfMsg( 'donate_interface-donor-email' ).'\' )', 'maxlength' => '64', 'id' => 'emailAdd', 'class' => 'fullwidth' ) ) . |
| 344 | + $form .= '<td>' . Xml::input( 'emailAdd', '30', $this->getEscapedValue( 'email' ), array( 'type' => 'text', 'onfocus' => 'clearField( this, \''.wfMsg( 'donate_interface-donor-email' ).'\' )', 'maxlength' => '64', 'id' => 'emailAdd', 'class' => 'fullwidth' ) ) . |
351 | 345 | Html::hidden( 'email-opt', 1 ) . |
352 | 346 | '</td>'; |
353 | 347 | $form .= '</tr>'; |
354 | 348 | |
355 | 349 | /* |
356 | | - $comment_opt_value = ( $wgRequest->wasPosted() ) ? $this->form_data[ 'comment-option' ] : true; |
| 350 | + $comment_opt_value = ( $wgRequest->wasPosted() ) ? $this->getEscapedValue( 'comment-option' ) : true; |
357 | 351 | $form .= '<tr>'; |
358 | 352 | $form .= '<td class="check-option" colspan="2">' . Xml::check( 'comment-option', $comment_opt_value ); |
359 | 353 | $form .= ' ' . Xml::label( wfMsg( 'donate_interface-anon-message' ), 'comment-option' ) . '</td>'; |
— | — | @@ -368,7 +362,7 @@ |
369 | 363 | global $wgScriptPath; |
370 | 364 | |
371 | 365 | // cc submit button |
372 | | - if ( $this->form_data['card_type'] == 'cc1' || $this->form_data['card_type'] == 'cc2' || $this->form_data['card_type'] == 'cc3' || $this->form_data['card_type'] == 'cc4' ) { |
| 366 | + if ( $this->getEscapedValue( 'card_type' ) == 'cc1' || $this->getEscapedValue( 'card_type' ) == 'cc2' || $this->getEscapedValue( 'card_type' ) == 'cc3' || $this->getEscapedValue( 'card_type' ) == 'cc4' ) { |
373 | 367 | $form = Xml::openElement( 'div', array( 'id' => 'payflowpro_gateway-form-submit' ) ); |
374 | 368 | } else { |
375 | 369 | $form = Xml::openElement( 'div', array( 'id' => 'payflowpro_gateway-form-submit', 'style' => 'display: none;' ) ); |
— | — | @@ -382,7 +376,7 @@ |
383 | 377 | $form .= Xml::closeElement( 'div' ); // close div#payflowpro_gateway-form-submit |
384 | 378 | |
385 | 379 | // paypal submit button |
386 | | - if ( $this->form_data['card_type'] == 'cc1' || $this->form_data['card_type'] == 'cc2' || $this->form_data['card_type'] == 'cc3' || $this->form_data['card_type'] == 'cc4' ) { |
| 380 | + if ( $this->getEscapedValue( 'card_type' ) == 'cc1' || $this->getEscapedValue( 'card_type' ) == 'cc2' || $this->getEscapedValue( 'card_type' ) == 'cc3' || $this->getEscapedValue( 'card_type' ) == 'cc4' ) { |
387 | 381 | $form .= Xml::openElement( 'div', array( 'id' => 'payflowpro_gateway-form-submit-paypal', 'style' => 'display: none;' ) ); |
388 | 382 | } else { |
389 | 383 | $form .= Xml::openElement( 'div', array( 'id' => 'payflowpro_gateway-form-submit-paypal' ) ); |
— | — | @@ -439,7 +433,7 @@ |
440 | 434 | // generate dropdown of state opts |
441 | 435 | foreach ( $states as $value => $state_name ) { |
442 | 436 | if ( $value !== 'YY' && $value !== 'XX' ) { |
443 | | - $selected = ( $this->form_data[ 'state' ] == $value ) ? true : false; |
| 437 | + $selected = ( $this->getEscapedValue( 'state' ) == $value ) ? true : false; |
444 | 438 | $state_opts .= Xml::option( $value, $value, $selected ); |
445 | 439 | } |
446 | 440 | } |
Index: trunk/extensions/DonationInterface/gateway_forms/TwoStepTwoColumnLetterCA.php |
— | — | @@ -13,7 +13,7 @@ |
14 | 14 | } |
15 | 15 | |
16 | 16 | public function generateFormStart() { |
17 | | - global $wgOut, $wgRequest; |
| 17 | + global $wgOut; |
18 | 18 | |
19 | 19 | $form = parent::generateBannerHeader(); |
20 | 20 | |
— | — | @@ -21,13 +21,7 @@ |
22 | 22 | $form .= Xml::openElement( 'tr' ); |
23 | 23 | $form .= Xml::openElement( 'td', array( 'id' => 'appeal', 'valign' => 'top' ) ); |
24 | 24 | |
25 | | - $text_template = $wgRequest->getText( 'text_template', '2010/JimmyAppealLong' ); |
26 | | - // if the user has uselang set, honor that, otherwise default to the language set for the form defined by 'language' in the query string |
27 | | - if ( $wgRequest->getText( 'language' ) ) $text_template .= '/' . $this->form_data[ 'language' ]; |
28 | | - |
29 | | - $template = ( strlen( $text_template ) ) ? $wgOut->parse( '{{' . $text_template . '}}' ) : ''; |
30 | | - // if the template doesn't exist, prevent the display of the red link |
31 | | - if ( preg_match( '/redlink\=1/', $template ) ) $template = NULL; |
| 25 | + $template = self::generateTextTemplate(); |
32 | 26 | $form .= $template; |
33 | 27 | |
34 | 28 | $form .= Xml::closeElement( 'td' ); |
— | — | @@ -94,12 +88,12 @@ |
95 | 89 | $form .= '</tr>'; |
96 | 90 | $form .= '<tr>'; |
97 | 91 | $form .= '<td class="label">' . Xml::label( wfMsg( 'donate_interface-donor-amount' ), 'amount' ) . '</td>'; |
98 | | - $form .= '<td>' . Xml::input( 'amount', '7', $this->form_data['amount'], array( 'type' => 'text', 'maxlength' => '10', 'id' => 'amount' ) ) . |
| 92 | + $form .= '<td>' . Xml::input( 'amount', '7', $this->getEscapedValue( 'amount' ), array( 'type' => 'text', 'maxlength' => '10', 'id' => 'amount' ) ) . |
99 | 93 | ' ' . $this->generateCurrencyDropdown( 'CAD' ) . '</td>'; |
100 | 94 | $form .= '</tr>'; |
101 | 95 | |
102 | 96 | // card logos |
103 | | - if ( $this->form_data[ 'currency_code' ] == 'USD' ) { |
| 97 | + if ( $this->getEscapedValue( 'currency_code' ) == 'USD' ) { |
104 | 98 | $form .= '<tr id="four_cards" style="display:table-row;">'; |
105 | 99 | $form .= '<td class="label"> </td><td>' . Xml::element( 'img', array( 'src' => $wgScriptPath . "/extensions/DonationInterface/gateway_forms/includes/credit_card_logos.gif" ) ) . '</td>'; |
106 | 100 | $form .= '</tr>'; |
— | — | @@ -182,7 +176,7 @@ |
183 | 177 | |
184 | 178 | // generate dropdown of state opts |
185 | 179 | foreach ( $states as $value => $state_name ) { |
186 | | - $selected = ( $this->form_data[ 'state' ] == $value ) ? true : false; |
| 180 | + $selected = ( $this->getEscapedValue( 'state' ) == $value ) ? true : false; |
187 | 181 | $state_opts .= Xml::option( wfMsg( 'donate_interface-province-dropdown-' . $value ), $value, $selected ); |
188 | 182 | } |
189 | 183 | |
Index: trunk/extensions/DonationInterface/gateway_forms/Form.php |
— | — | @@ -15,12 +15,6 @@ |
16 | 16 | public $hidden_fields; |
17 | 17 | |
18 | 18 | /** |
19 | | - * An array of form data, collected from the gateway parameter. |
20 | | - * @var array |
21 | | - */ |
22 | | - public $form_data; |
23 | | - |
24 | | - /** |
25 | 19 | * The id of the form. |
26 | 20 | * |
27 | 21 | * This should also be the name of the form |
— | — | @@ -67,6 +61,12 @@ |
68 | 62 | * @var string |
69 | 63 | */ |
70 | 64 | protected $payment_submethod = ''; |
| 65 | + |
| 66 | + /** |
| 67 | + * Tells us if we're paypal only or not. |
| 68 | + * @var boolean |
| 69 | + */ |
| 70 | + public $paypal = false; // true for paypal only version |
71 | 71 | |
72 | 72 | /** |
73 | 73 | * Required method for returning the full HTML for a form. |
— | — | @@ -80,12 +80,12 @@ |
81 | 81 | abstract function getForm(); |
82 | 82 | |
83 | 83 | public function __construct( &$gateway, &$error ) { |
84 | | - global $wgOut; |
| 84 | + global $wgOut, $wgRequest; |
85 | 85 | |
86 | 86 | $this->gateway = & $gateway; |
87 | 87 | $this->test = $this->gateway->getGlobal( "Test" ); |
88 | | - $this->form_data = $this->gateway->getData_Unstaged_Escaped(); |
89 | 88 | $this->form_errors = & $error; |
| 89 | + $this->paypal = $wgRequest->getBool( 'paypal', false ); |
90 | 90 | |
91 | 91 | /** |
92 | 92 | * add form-specific css - the path can be set in child classes |
— | — | @@ -202,10 +202,10 @@ |
203 | 203 | |
204 | 204 | // generate a dropdown option for each country |
205 | 205 | foreach ( $countries as $iso_value => $full_name ) { |
206 | | - // Note: If the server has the php5-geoip package, $this->form_data['country'] will |
| 206 | + // Note: If the server has the php5-geoip package, $this->getEscapedValue( 'country' ) will |
207 | 207 | // always have a value. |
208 | | - if ( $this->form_data['country'] ) { |
209 | | - $selected = ( $iso_value == $this->form_data['country'] ) ? true : false; |
| 208 | + if ( $this->getEscapedValue( 'country' ) ) { |
| 209 | + $selected = ( $iso_value == $this->getEscapedValue( 'country' ) ) ? true : false; |
210 | 210 | } else { |
211 | 211 | $selected = ( $iso_value == $defaultCountry ) ? true : false; // Select default |
212 | 212 | } |
— | — | @@ -245,7 +245,7 @@ |
246 | 246 | // generate a dropdown opt for each card |
247 | 247 | foreach ( $available_cards as $value => $card_name ) { |
248 | 248 | // only load the card value if we're in testing mode |
249 | | - $selected = ( $value == $this->form_data['card_type'] && $this->test ) ? true : false; |
| 249 | + $selected = ( $value == $this->getEscapedValue( 'card_type' ) && $this->test ) ? true : false; |
250 | 250 | $card_options .= Xml::option( $card_name, $value, $selected ); |
251 | 251 | } |
252 | 252 | |
— | — | @@ -267,8 +267,8 @@ |
268 | 268 | |
269 | 269 | // derive the previously set expiry month, if set |
270 | 270 | $month = NULL; |
271 | | - if ( $this->form_data['expiration'] ) { |
272 | | - $month = substr( $this->form_data['expiration'], 0, 2 ); |
| 271 | + if ( $this->getEscapedValue( 'expiration' ) ) { |
| 272 | + $month = substr( $this->getEscapedValue( 'expiration' ), 0, 2 ); |
273 | 273 | } |
274 | 274 | |
275 | 275 | $expiry_months = ''; |
— | — | @@ -296,8 +296,8 @@ |
297 | 297 | public function generateExpiryYearDropdown() { |
298 | 298 | // derive the previously set expiry year, if set |
299 | 299 | $year = NULL; |
300 | | - if ( $this->form_data['expiration'] ) { |
301 | | - $year = substr( $this->form_data['expiration'], 2, 2 ); |
| 300 | + if ( $this->getEscapedValue( 'expiration' ) ) { |
| 301 | + $year = substr( $this->getEscapedValue( 'expiration' ), 2, 2 ); |
302 | 302 | } |
303 | 303 | |
304 | 304 | $expiry_years = ''; |
— | — | @@ -335,7 +335,7 @@ |
336 | 336 | |
337 | 337 | // generate dropdown of state opts |
338 | 338 | foreach ( $states as $value => $state_name ) { |
339 | | - $selected = ( $this->form_data['state'] == $value ) ? true : false; |
| 339 | + $selected = ( $this->getEscapedValue( 'state' ) == $value ) ? true : false; |
340 | 340 | $state_opts .= Xml::option( wfMsg( 'donate_interface-state-dropdown-' . $value ), $value, $selected ); |
341 | 341 | } |
342 | 342 | |
— | — | @@ -368,8 +368,8 @@ |
369 | 369 | $availableCurrencies = $this->gateway->getCurrencies(); |
370 | 370 | |
371 | 371 | // If a currency has already been posted, use that, otherwise use the default. |
372 | | - if ( $this->form_data['currency_code'] ) { |
373 | | - $selectedCurrency = $this->form_data['currency_code']; |
| 372 | + if ( $this->getEscapedValue( 'currency_code' ) ) { |
| 373 | + $selectedCurrency = $this->getEscapedValue( 'currency_code' ); |
374 | 374 | } else { |
375 | 375 | $selectedCurrency = $defaultCurrencyCode; |
376 | 376 | } |
— | — | @@ -430,7 +430,7 @@ |
431 | 431 | $setCurrency = isset( $setCurrency ) ? (string) $setCurrency : ''; |
432 | 432 | $displayCurrencyDropdown = empty( $setCurrency ) ? $displayCurrencyDropdown : false; |
433 | 433 | |
434 | | - $amount = isset( $this->form_data['amount'] ) ? (string) $this->form_data['amount'] : '0'; |
| 434 | + $amount = !is_null( $this->getEscapedValue( 'amount' ) ) ? (string) $this->getEscapedValue( 'amount' ) : '0'; |
435 | 435 | |
436 | 436 | // Treat values as string for comparison |
437 | 437 | $amountValues = array('5', '10', '20', '35', '50', '100', '250',); |
— | — | @@ -490,31 +490,31 @@ |
491 | 491 | public function setHiddenFields( $hidden_fields = NULL ) { |
492 | 492 | if ( !$hidden_fields ) { |
493 | 493 | $hidden_fields = array( |
494 | | - 'utm_source' => $this->form_data['utm_source'], |
495 | | - 'utm_medium' => $this->form_data['utm_medium'], |
496 | | - 'utm_campaign' => $this->form_data['utm_campaign'], |
497 | | - 'language' => $this->form_data['language'], |
498 | | - 'referrer' => $this->form_data['referrer'], |
499 | | - 'comment' => $this->form_data['comment'], |
500 | | - 'comment-option' => $this->form_data['comment-option'], |
501 | | - 'email-opt' => $this->form_data['email-opt'], |
502 | | - 'size' => $this->form_data['size'], |
503 | | - 'premium_language' => $this->form_data['premium_language'], |
| 494 | + 'utm_source' => $this->getEscapedValue( 'utm_source' ), |
| 495 | + 'utm_medium' => $this->getEscapedValue( 'utm_medium' ), |
| 496 | + 'utm_campaign' => $this->getEscapedValue( 'utm_campaign' ), |
| 497 | + 'language' => $this->getEscapedValue( 'language' ), |
| 498 | + 'referrer' => $this->getEscapedValue( 'referrer' ), |
| 499 | + 'comment' => $this->getEscapedValue( 'comment' ), |
| 500 | + 'comment-option' => $this->getEscapedValue( 'comment-option' ), |
| 501 | + 'email-opt' => $this->getEscapedValue( 'email-opt' ), |
| 502 | + 'size' => $this->getEscapedValue( 'size' ), |
| 503 | + 'premium_language' => $this->getEscapedValue( 'premium_language' ), |
504 | 504 | // process has been disabled - may no longer be needed. |
505 | | - //'process' => isset( $this->form_data['process'] ) ? $this->form_data['process'] : 'CreditCard', |
| 505 | + //'process' => !is_null( $this->getEscapedValue( 'process' ) ) ? $this->getEscapedValue( 'process' ) : 'CreditCard', |
506 | 506 | // payment_method is no longer set to: processed |
507 | | - 'payment_method' => isset( $this->form_data['payment_method'] ) ? $this->form_data['payment_method'] : '', |
508 | | - 'payment_submethod' => isset( $this->form_data['payment_submethod'] ) ? $this->form_data['payment_submethod'] : '', |
509 | | - 'token' => $this->form_data['token'], |
510 | | - 'order_id' => $this->form_data['order_id'], |
511 | | - 'i_order_id' => $this->form_data['i_order_id'], |
512 | | - 'numAttempt' => $this->form_data['numAttempt'], |
513 | | - 'contribution_tracking_id' => $this->form_data['contribution_tracking_id'], |
514 | | - 'data_hash' => $this->form_data['data_hash'], |
515 | | - 'action' => $this->form_data['action'], |
516 | | - 'owa_session' => $this->form_data['owa_session'], |
517 | | - 'owa_ref' => $this->form_data['owa_ref'], |
518 | | - 'gateway' => $this->form_data['gateway'], |
| 507 | + 'payment_method' => !is_null( $this->getEscapedValue( 'payment_method' ) ) ? $this->getEscapedValue( 'payment_method' ) : '', |
| 508 | + 'payment_submethod' => !is_null( $this->getEscapedValue( 'payment_submethod' ) ) ? $this->getEscapedValue( 'payment_submethod' ) : '', |
| 509 | + 'token' => $this->getEscapedValue( 'token' ), |
| 510 | + 'order_id' => $this->getEscapedValue( 'order_id' ), |
| 511 | + 'i_order_id' => $this->getEscapedValue( 'i_order_id' ), |
| 512 | + 'numAttempt' => $this->getEscapedValue( 'numAttempt' ), |
| 513 | + 'contribution_tracking_id' => $this->getEscapedValue( 'contribution_tracking_id' ), |
| 514 | + 'data_hash' => $this->getEscapedValue( 'data_hash' ), |
| 515 | + 'action' => $this->getEscapedValue( 'action' ), |
| 516 | + 'owa_session' => $this->getEscapedValue( 'owa_session' ), |
| 517 | + 'owa_ref' => $this->getEscapedValue( 'owa_ref' ), |
| 518 | + 'gateway' => $this->getEscapedValue( 'gateway' ), |
519 | 519 | ); |
520 | 520 | } |
521 | 521 | |
— | — | @@ -568,9 +568,9 @@ |
569 | 569 | |
570 | 570 | // intro text |
571 | 571 | if ( $wgRequest->getText( 'masthead', false ) ) { |
572 | | - $template = $wgOut->parse( '{{' . $wgRequest->getText( 'masthead' ) . '/' . $this->form_data['language'] . '}}' ); |
| 572 | + $template = $wgOut->parse( '{{' . $wgRequest->getText( 'masthead' ) . '/' . $this->getEscapedValue( 'language' ) . '}}' ); |
573 | 573 | } elseif ( $header ) { |
574 | | - $header = str_replace( '@language', $this->form_data['language'], $header ); |
| 574 | + $header = str_replace( '@language', $this->getEscapedValue( 'language' ), $header ); |
575 | 575 | $template = $wgOut->parse( $header ); |
576 | 576 | } |
577 | 577 | |
— | — | @@ -579,6 +579,20 @@ |
580 | 580 | $wgOut->addHtml( $template ); |
581 | 581 | } |
582 | 582 | } |
| 583 | + |
| 584 | + protected function generateTextTemplate() { |
| 585 | + global $wgOut, $wgRequest; |
| 586 | + $text_template = $wgRequest->getText( 'text_template', '2010/JimmyAppealLong' ); |
| 587 | + |
| 588 | + //TODO: determine if this next line is really as silly as it looks. I don't think we should be using $wgRequest here at all. |
| 589 | + //(See DonationData::setLanguage()) |
| 590 | + if ( $wgRequest->getText( 'language' ) ) $text_template .= '/' . $this->getEscapedValue( 'language' ); |
| 591 | + |
| 592 | + $template = ( strlen( $text_template ) ) ? $wgOut->parse( '{{' . htmlspecialchars( $text_template, ENT_COMPAT, 'UTF-8', false ) . '}}' ) : ''; |
| 593 | + // if the template doesn't exist, prevent the display of the red link |
| 594 | + if ( preg_match( '/redlink\=1/', $template ) ) $template = NULL; |
| 595 | + return $template; |
| 596 | + } |
583 | 597 | |
584 | 598 | protected function getEmailField() { |
585 | 599 | // email |
— | — | @@ -587,7 +601,7 @@ |
588 | 602 | $form .= '</tr>'; |
589 | 603 | $form .= '<tr>'; |
590 | 604 | $form .= '<td class="label">' . Xml::label( wfMsg( 'donate_interface-donor-email' ), 'emailAdd' ) . '</td>'; |
591 | | - $form .= '<td>' . Xml::input( 'emailAdd', '30', $this->form_data['email'], array( 'type' => 'text', 'maxlength' => '64', 'id' => 'emailAdd', 'class' => 'fullwidth' ) ) . |
| 605 | + $form .= '<td>' . Xml::input( 'emailAdd', '30', $this->getEscapedValue( 'email' ), array( 'type' => 'text', 'maxlength' => '64', 'id' => 'emailAdd', 'class' => 'fullwidth' ) ) . |
592 | 606 | '</td>'; |
593 | 607 | $form .= '</tr>'; |
594 | 608 | return $form; |
— | — | @@ -596,31 +610,31 @@ |
597 | 611 | protected function getAmountField() { |
598 | 612 | $otherChecked = false; |
599 | 613 | $amount = -1; |
600 | | - if ( $this->form_data['amount'] != 100 && $this->form_data['amount'] != 50 && $this->form_data['amount'] != 35 && $this->form_data['amount'] != 20 && $this->form_data['amountOther'] > 0 ) { |
| 614 | + if ( $this->getEscapedValue( 'amount' ) != 100 && $this->getEscapedValue( 'amount' ) != 50 && $this->getEscapedValue( 'amount' ) != 35 && $this->getEscapedValue( 'amount' ) != 20 && $this->getEscapedValue( 'amountOther' ) > 0 ) { |
601 | 615 | $otherChecked = true; |
602 | | - $amount = $this->form_data['amountOther']; |
| 616 | + $amount = $this->getEscapedValue( 'amountOther' ); |
603 | 617 | } |
604 | 618 | $form = '<tr>'; |
605 | 619 | $form .= '<td colspan="2"><span class="creditcard-error-msg">' . $this->form_errors['invalidamount'] . '</span></td>'; |
606 | 620 | $form .= '</tr>'; |
607 | 621 | $form .= '<tr>'; |
608 | 622 | $form .= '<td class="label">' . Xml::label( wfMsg( 'donate_interface-donor-amount' ), 'amount' ) . '</td>'; |
609 | | - $form .= '<td>' . Xml::radio( 'amount', 100, $this->form_data['amount'] == 100 ) . '100 ' . |
610 | | - Xml::radio( 'amount', 50, $this->form_data['amount'] == 50 ) . '50 ' . |
611 | | - Xml::radio( 'amount', 35, $this->form_data['amount'] == 35 ) . '35 ' . |
612 | | - Xml::radio( 'amount', 20, $this->form_data['amount'] == 20 ) . '20 ' . |
| 623 | + $form .= '<td>' . Xml::radio( 'amount', 100, $this->getEscapedValue( 'amount' ) == 100 ) . '100 ' . |
| 624 | + Xml::radio( 'amount', 50, $this->getEscapedValue( 'amount' ) == 50 ) . '50 ' . |
| 625 | + Xml::radio( 'amount', 35, $this->getEscapedValue( 'amount' ) == 35 ) . '35 ' . |
| 626 | + Xml::radio( 'amount', 20, $this->getEscapedValue( 'amount' ) == 20 ) . '20 ' . |
613 | 627 | '</td>'; |
614 | 628 | $form .= '</tr>'; |
615 | 629 | $form .= '<tr>'; |
616 | 630 | $form .= '<td class="label"></td>'; |
617 | | - $form .= '<td>' . Xml::radio( 'amount', $amount, $otherChecked, array( 'id' => 'otherRadio' ) ) . Xml::input( 'amountOther', '7', $this->form_data['amountOther'], array( 'type' => 'text', 'onfocus' => 'clearField( this, \'' . wfMsg( 'donate_interface-other' ) . '\' )', 'onblur' => 'document.getElementById("otherRadio").value = this.value;if (this.value > 0) document.getElementById("otherRadio").checked=true;', 'maxlength' => '10', 'id' => 'amountOther' ) ) . |
| 631 | + $form .= '<td>' . Xml::radio( 'amount', $amount, $otherChecked, array( 'id' => 'otherRadio' ) ) . Xml::input( 'amountOther', '7', $this->getEscapedValue( 'amountOther' ), array( 'type' => 'text', 'onfocus' => 'clearField( this, \'' . wfMsg( 'donate_interface-other' ) . '\' )', 'onblur' => 'document.getElementById("otherRadio").value = this.value;if (this.value > 0) document.getElementById("otherRadio").checked=true;', 'maxlength' => '10', 'id' => 'amountOther' ) ) . |
618 | 632 | ' ' . $this->generateCurrencyDropdown() . '</td>'; |
619 | 633 | $form .= '</tr>'; |
620 | 634 | return $form; |
621 | 635 | } |
622 | 636 | |
623 | 637 | protected function getCardnumberField() { |
624 | | - $card_num = ( $this->gateway->getGlobal( "Test" ) ) ? $this->form_data['card_num'] : ''; |
| 638 | + $card_num = ( $this->gateway->getGlobal( "Test" ) ) ? $this->getEscapedValue( 'card_num' ) : ''; |
625 | 639 | $form = ''; |
626 | 640 | if ( $this->form_errors['card_num'] ) { |
627 | 641 | $form .= '<tr>'; |
— | — | @@ -641,7 +655,7 @@ |
642 | 656 | } |
643 | 657 | |
644 | 658 | protected function getCvvField() { |
645 | | - $cvv = ( $this->gateway->getGlobal( "Test" ) ) ? $this->form_data['cvv'] : ''; |
| 659 | + $cvv = ( $this->gateway->getGlobal( "Test" ) ) ? $this->getEscapedValue( 'cvv' ) : ''; |
646 | 660 | |
647 | 661 | $form = '<tr>'; |
648 | 662 | $form .= '<td colspan=2><span class="creditcard-error-msg">' . $this->form_errors['cvv'] . '</span></td>'; |
— | — | @@ -660,7 +674,7 @@ |
661 | 675 | $form .= '</tr>'; |
662 | 676 | $form .= '<tr>'; |
663 | 677 | $form .= '<td class="label">' . Xml::label( wfMsg( 'donate_interface-donor-street' ), 'street' ) . '</td>'; |
664 | | - $form .= '<td>' . Xml::input( 'street', '30', $this->form_data['street'], array( 'type' => 'text', 'maxlength' => '100', 'id' => 'street', 'class' => 'fullwidth' ) ) . |
| 678 | + $form .= '<td>' . Xml::input( 'street', '30', $this->getEscapedValue( 'street' ), array( 'type' => 'text', 'maxlength' => '100', 'id' => 'street', 'class' => 'fullwidth' ) ) . |
665 | 679 | '</td>'; |
666 | 680 | $form .= '</tr>'; |
667 | 681 | return $form; |
— | — | @@ -672,7 +686,7 @@ |
673 | 687 | $form .= '</tr>'; |
674 | 688 | $form .= '<tr>'; |
675 | 689 | $form .= '<td class="label">' . Xml::label( wfMsg( 'donate_interface-donor-city' ), 'city' ) . '</td>'; |
676 | | - $form .= '<td>' . Xml::input( 'city', '30', $this->form_data['city'], array( 'type' => 'text', 'maxlength' => '40', 'id' => 'city', 'class' => 'fullwidth' ) ) . |
| 690 | + $form .= '<td>' . Xml::input( 'city', '30', $this->getEscapedValue( 'city' ), array( 'type' => 'text', 'maxlength' => '40', 'id' => 'city', 'class' => 'fullwidth' ) ) . |
677 | 691 | '</td>'; |
678 | 692 | $form .= '</tr>'; |
679 | 693 | return $form; |
— | — | @@ -684,7 +698,7 @@ |
685 | 699 | $form .= '</tr>'; |
686 | 700 | $form .= '<tr>'; |
687 | 701 | $form .= '<td class="label">' . Xml::label( wfMsg( 'donate_interface-donor-postal' ), 'zip' ) . '</td>'; |
688 | | - $form .= '<td>' . Xml::input( 'zip', '30', $this->form_data['zip'], array( 'type' => 'text', 'maxlength' => '9', 'id' => 'zip', 'class' => 'fullwidth' ) ) . |
| 702 | + $form .= '<td>' . Xml::input( 'zip', '30', $this->getEscapedValue( 'zip' ), array( 'type' => 'text', 'maxlength' => '9', 'id' => 'zip', 'class' => 'fullwidth' ) ) . |
689 | 703 | '</td>'; |
690 | 704 | $form .= '</tr>'; |
691 | 705 | return $form; |
— | — | @@ -699,8 +713,8 @@ |
700 | 714 | $form .= '</tr>'; |
701 | 715 | $form .= '<tr>'; |
702 | 716 | $form .= '<td class="label">' . Xml::label( wfMsg( 'donate_interface-donor-name' ), 'fname' ) . '</td>'; |
703 | | - $form .= '<td>' . Xml::input( 'fname', '30', $this->form_data['fname'], array( 'type' => 'text', 'onfocus' => 'clearField( this, \'' . wfMsg( 'donate_interface-donor-fname' ) . '\' )', 'maxlength' => '25', 'class' => 'required', 'id' => 'fname' ) ) . |
704 | | - Xml::input( 'lname', '30', $this->form_data['lname'], array( 'type' => 'text', 'onfocus' => 'clearField( this, \'' . wfMsg( 'donate_interface-donor-lname' ) . '\' )', 'maxlength' => '25', 'id' => 'lname' ) ) . '</td>'; |
| 717 | + $form .= '<td>' . Xml::input( 'fname', '30', $this->getEscapedValue( 'fname' ), array( 'type' => 'text', 'onfocus' => 'clearField( this, \'' . wfMsg( 'donate_interface-donor-fname' ) . '\' )', 'maxlength' => '25', 'class' => 'required', 'id' => 'fname' ) ) . |
| 718 | + Xml::input( 'lname', '30', $this->getEscapedValue( 'lname' ), array( 'type' => 'text', 'onfocus' => 'clearField( this, \'' . wfMsg( 'donate_interface-donor-lname' ) . '\' )', 'maxlength' => '25', 'id' => 'lname' ) ) . '</td>'; |
705 | 719 | $form .= "</tr>"; |
706 | 720 | return $form; |
707 | 721 | } |
— | — | @@ -717,14 +731,14 @@ |
718 | 732 | protected function getCommentField() { |
719 | 733 | $form = '<tr>'; |
720 | 734 | $form .= '<td class="label">' . Xml::label( wfMsg( 'donate_interface-comment' ), 'comment' ) . '</td>'; |
721 | | - $form .= '<td>' . Xml::input( 'comment', '30', $this->form_data['comment'], array( 'type' => 'text', 'maxlength' => '200', 'class' => 'fullwidth' ) ) . '</td>'; |
| 735 | + $form .= '<td>' . Xml::input( 'comment', '30', $this->getEscapedValue( 'comment' ), array( 'type' => 'text', 'maxlength' => '200', 'class' => 'fullwidth' ) ) . '</td>'; |
722 | 736 | $form .= '</tr>'; |
723 | 737 | return $form; |
724 | 738 | } |
725 | 739 | |
726 | 740 | protected function getCommentOptionField() { |
727 | 741 | global $wgRequest; |
728 | | - $comment_opt_value = ( $wgRequest->wasPosted() ) ? $this->form_data['comment-option'] : true; |
| 742 | + $comment_opt_value = ( $wgRequest->wasPosted() ) ? $this->getEscapedValue( 'comment-option' ) : true; |
729 | 743 | $form = '<tr>'; |
730 | 744 | $form .= '<td class="check-option" colspan="2">' . Xml::check( 'comment-option', $comment_opt_value ); |
731 | 745 | $form .= ' ' . Xml::label( wfMsg( 'donate_interface-anon-message' ), 'comment-option' ) . '</td>'; |
— | — | @@ -734,7 +748,7 @@ |
735 | 749 | |
736 | 750 | protected function getEmailOptField() { |
737 | 751 | global $wgRequest; |
738 | | - $email_opt_value = ( $wgRequest->wasPosted() ) ? $this->form_data['email-opt'] : true; |
| 752 | + $email_opt_value = ( $wgRequest->wasPosted() ) ? $this->getEscapedValue( 'email-opt' ) : true; |
739 | 753 | $form = '<tr>'; |
740 | 754 | $form .= '<td class="check-option" colspan="2">' . Xml::check( 'email-opt', $email_opt_value ); |
741 | 755 | $form .= ' '; |
— | — | @@ -865,7 +879,9 @@ |
866 | 880 | unset( $query_array['_cache_'] ); |
867 | 881 | |
868 | 882 | // make sure no other data that might overwrite posted data makes it into the URL |
869 | | - foreach ( $this->form_data as $key => $value ) { |
| 883 | + |
| 884 | + $all_form_data = $this->gateway->getData_Unstaged_Escaped(); |
| 885 | + foreach ( $all_form_data as $key => $value ) { |
870 | 886 | unset( $query_array[$key] ); |
871 | 887 | } |
872 | 888 | |
— | — | @@ -966,5 +982,17 @@ |
967 | 983 | $form .= '</table>'; |
968 | 984 | return $form; |
969 | 985 | } |
| 986 | + |
| 987 | + /** |
| 988 | + * Pulls normalized and escaped data from the $gateway object. |
| 989 | + * For more information, see GatewayAdapter::getData_Unstaged_Escaped in |
| 990 | + * $IP/extensions/DonationData/gateway_common/gateway.adapter.php |
| 991 | + * @param string $key The value to fetch from the adapter. |
| 992 | + * @return mixed The escaped value in the adapter, or null if none exists. |
| 993 | + * Note: The value could still be a blank string in some cases. |
| 994 | + */ |
| 995 | + protected function getEscapedValue( $key ) { |
| 996 | + return $this->gateway->getData_Unstaged_Escaped( $key ); |
| 997 | + } |
970 | 998 | } |
971 | 999 | |
Index: trunk/extensions/DonationInterface/gateway_forms/TwoColumnLetter.php |
— | — | @@ -1,7 +1,6 @@ |
2 | 2 | <?php |
3 | 3 | |
4 | 4 | class Gateway_Form_TwoColumnLetter extends Gateway_Form_OneStepTwoColumn { |
5 | | - public $paypal = false; // true for paypal only version |
6 | 5 | |
7 | 6 | public function __construct( &$gateway, &$form_errors ) { |
8 | 7 | global $wgScriptPath; |
— | — | @@ -15,23 +14,13 @@ |
16 | 15 | } |
17 | 16 | |
18 | 17 | public function generateFormStart() { |
19 | | - global $wgOut, $wgRequest; |
20 | | - |
21 | | - $this->paypal = $wgRequest->getBool( 'paypal', false ); |
22 | | - |
23 | 18 | $form = parent::generateBannerHeader(); |
24 | 19 | |
25 | 20 | $form .= Xml::openElement( 'table', array( 'width' => '100%', 'cellspacing' => 0, 'cellpadding' => 0, 'border' => 0 ) ); |
26 | 21 | $form .= Xml::openElement( 'tr' ); |
27 | 22 | $form .= Xml::openElement( 'td', array( 'id' => 'appeal', 'valign' => 'top' ) ); |
28 | 23 | |
29 | | - $text_template = $wgRequest->getText( 'text_template', '2010/JimmyAppealLong' ); |
30 | | - // if the user has uselang set, honor that, otherwise default to the language set for the form defined by 'language' in the query string |
31 | | - if ( $wgRequest->getText( 'language' ) ) $text_template .= '/' . $this->form_data[ 'language' ]; |
32 | | - |
33 | | - $template = ( strlen( $text_template ) ) ? $wgOut->parse( '{{' . $text_template . '}}' ) : ''; |
34 | | - // if the template doesn't exist, prevent the display of the red link |
35 | | - if ( preg_match( '/redlink\=1/', $template ) ) $template = NULL; |
| 24 | + $template = self::generateTextTemplate(); |
36 | 25 | $form .= $template; |
37 | 26 | |
38 | 27 | $form .= Xml::closeElement( 'td' ); |
Index: trunk/extensions/DonationInterface/gateway_forms/TwoStepTwoColumnPremium.php |
— | — | @@ -13,7 +13,7 @@ |
14 | 14 | } |
15 | 15 | |
16 | 16 | public function generateFormStart() { |
17 | | - global $wgRequest, $wgScriptPath; |
| 17 | + global $wgScriptPath; |
18 | 18 | |
19 | 19 | $form = parent::generateBannerHeader(); |
20 | 20 | |
— | — | @@ -26,12 +26,12 @@ |
27 | 27 | $form .= Xml::element( 'img', array( 'src' => $wgScriptPath . "/extensions/DonationInterface/gateway_forms/includes/wikipedia-ten-tshirt-front.png", 'width' => '300', 'height' => '280' ) ) . "<br/>"; |
28 | 28 | $form .= Xml::openElement( 'div', array( 'id' => 'premium-values' ) ); |
29 | 29 | $form .= Xml::openElement( 'div', array( 'id' => 'premium-size' ) ); |
30 | | - $sizeDisplay = '<span id="size-display">'.$wgRequest->getText( 'size' ).'</span>'; |
| 30 | + $sizeDisplay = '<span id="size-display">'.$this->getEscapedValue( 'size' ).'</span>'; |
31 | 31 | $form .= wfMsg( 'donate_interface-shirt-size-2', $sizeDisplay ); |
32 | 32 | $form .= Xml::closeElement( 'div' ); // close div#premium-size |
33 | 33 | $form .= wfMsg( 'donate_interface-on-the-back' ) . "<br/>"; |
34 | 34 | $form .= Xml::openElement( 'div', array( 'id' => 'premium-language' ) ); |
35 | | - $form .= Xml::element( 'img', array( 'src' => $wgScriptPath . "/extensions/DonationInterface/gateway_forms/includes/wordmarks/".$wgRequest->getText( 'premium_language' )."-wordmark.png", 'width' => '200', 'height' => '92' ) ); |
| 35 | + $form .= Xml::element( 'img', array( 'src' => $wgScriptPath . "/extensions/DonationInterface/gateway_forms/includes/wordmarks/".$this->getEscapedValue( 'premium_language' )."-wordmark.png", 'width' => '200', 'height' => '92' ) ); |
36 | 36 | $form .= Xml::closeElement( 'div' ); // close div#premium-language |
37 | 37 | $form .= Xml::closeElement( 'div' ); // close div#premium-values |
38 | 38 | $form .= Xml::closeElement( 'div' ); // close div#premium-confirmation |
— | — | @@ -100,12 +100,12 @@ |
101 | 101 | $form .= '</tr>'; |
102 | 102 | $form .= '<tr>'; |
103 | 103 | $form .= '<td class="label">' . Xml::label( wfMsg( 'donate_interface-donor-amount' ), 'amount' ) . '</td>'; |
104 | | - $form .= '<td>' . Xml::input( 'amount', '7', $this->form_data['amount'], array( 'type' => 'text', 'maxlength' => '10', 'id' => 'amount' ) ) . |
| 104 | + $form .= '<td>' . Xml::input( 'amount', '7', $this->getEscapedValue( 'amount' ), array( 'type' => 'text', 'maxlength' => '10', 'id' => 'amount' ) ) . |
105 | 105 | ' ' . $this->generateCurrencyDropdown() . '</td>'; |
106 | 106 | $form .= '</tr>'; |
107 | 107 | |
108 | 108 | // card logos |
109 | | - if ( $this->form_data[ 'currency_code' ] == 'USD' ) { |
| 109 | + if ( $this->getEscapedValue( 'currency_code' ) == 'USD' ) { |
110 | 110 | $form .= '<tr id="four_cards" style="display:table-row;">'; |
111 | 111 | $form .= '<td class="label"> </td><td>' . Xml::element( 'img', array( 'src' => $wgScriptPath . "/extensions/DonationInterface/gateway_forms/includes/credit_card_logos.gif" ) ) . '</td>'; |
112 | 112 | $form .= '</tr>'; |
— | — | @@ -142,7 +142,7 @@ |
143 | 143 | $form .= $this->getZipField(); |
144 | 144 | |
145 | 145 | // country |
146 | | - $form .= $this->getCountryField( $this->form_data[ 'country2' ] ); |
| 146 | + $form .= $this->getCountryField( $this->getEscapedValue( 'country2' ) ); |
147 | 147 | |
148 | 148 | /* |
149 | 149 | $form .= '<tr>'; |
— | — | @@ -176,7 +176,7 @@ |
177 | 177 | } |
178 | 178 | |
179 | 179 | // Temporary |
180 | | - $form .= Html::hidden( 'country2', $this->form_data[ 'country2' ] ); |
| 180 | + $form .= Html::hidden( 'country2', $this->getEscapedValue( 'country2' ) ); |
181 | 181 | |
182 | 182 | $form .= Xml::closeElement( 'form' ); // close form 'payment' |
183 | 183 | $form .= $this->generateDonationFooter(); |
Index: trunk/extensions/DonationInterface/gateway_forms/TwoStepTwoColumn.php |
— | — | @@ -170,7 +170,7 @@ |
171 | 171 | $form .= '</tr>'; |
172 | 172 | $form .= '<tr>'; |
173 | 173 | $form .= '<td class="label">' . Xml::label( wfMsg( 'donate_interface-donor-amount' ), 'amount' ) . '</td>'; |
174 | | - $form .= '<td>' . Xml::input( 'amount', '7', $this->form_data['amount'], array( 'type' => 'text', 'maxlength' => '10', 'id' => 'amount' ) ) . |
| 174 | + $form .= '<td>' . Xml::input( 'amount', '7', $this->getEscapedValue( 'amount' ), array( 'type' => 'text', 'maxlength' => '10', 'id' => 'amount' ) ) . |
175 | 175 | ' ' . $this->generateCurrencyDropdown() . '</td>'; |
176 | 176 | $form .= '</tr>'; |
177 | 177 | |
Index: trunk/extensions/DonationInterface/gateway_forms/TwoStepTwoColumnLetter3.php |
— | — | @@ -115,7 +115,7 @@ |
116 | 116 | } |
117 | 117 | |
118 | 118 | public function generateFormStart() { |
119 | | - global $wgOut, $wgRequest; |
| 119 | + global $wgOut; |
120 | 120 | |
121 | 121 | $form = parent::generateBannerHeader(); |
122 | 122 | |
— | — | @@ -123,13 +123,7 @@ |
124 | 124 | $form .= Xml::openElement( 'tr' ); |
125 | 125 | $form .= Xml::openElement( 'td', array( 'id' => 'appeal', 'valign' => 'top' ) ); |
126 | 126 | |
127 | | - $text_template = $wgRequest->getText( 'text_template', '2010/JimmyAppealLong' ); |
128 | | - // if the user has uselang set, honor that, otherwise default to the language set for the form defined by 'language' in the query string |
129 | | - if ( $wgRequest->getText( 'language' ) ) $text_template .= '/' . $this->form_data[ 'language' ]; |
130 | | - |
131 | | - $template = ( strlen( $text_template ) ) ? $wgOut->parse( '{{' . $text_template . '}}' ) : ''; |
132 | | - // if the template doesn't exist, prevent the display of the red link |
133 | | - if ( preg_match( '/redlink\=1/', $template ) ) $template = NULL; |
| 127 | + $template = self::generateTextTemplate(); |
134 | 128 | $form .= $template; |
135 | 129 | |
136 | 130 | $form .= Xml::closeElement( 'td' ); |
— | — | @@ -213,11 +207,11 @@ |
214 | 208 | $form .= '</tr>'; |
215 | 209 | $form .= '<tr>'; |
216 | 210 | $form .= '<td class="amount_data">'.wfMsg( 'donate_interface-donation' ).'</td>'; |
217 | | - $form .= '<td class="amount_data" style="text-align:right;width:75px;">'.$this->form_data['amount'] . |
218 | | - Html::hidden( 'amount', $this->form_data['amount'] ) . |
| 211 | + $form .= '<td class="amount_data" style="text-align:right;width:75px;">'.$this->getEscapedValue( 'amount' ) . |
| 212 | + Html::hidden( 'amount', $this->getEscapedValue( 'amount' ) ) . |
219 | 213 | '</td>'; |
220 | | - $form .= '<td class="amount_data" style="text-align:right;width:75px;">'.$this->form_data[ 'currency_code' ] . |
221 | | - Html::hidden( 'currency_code', $this->form_data['currency_code'] ) . |
| 214 | + $form .= '<td class="amount_data" style="text-align:right;width:75px;">'.$this->getEscapedValue( 'currency_code' ) . |
| 215 | + Html::hidden( 'currency_code', $this->getEscapedValue( 'currency_code' ) ) . |
222 | 216 | '</td>'; |
223 | 217 | $form .= '</tr>'; |
224 | 218 | $form .= '</table>'; |
— | — | @@ -232,7 +226,7 @@ |
233 | 227 | // card logos |
234 | 228 | $form .= '<tr>'; |
235 | 229 | $form .= '<td class="label"> </td>'; |
236 | | - if ( $this->form_data[ 'currency_code' ] == 'USD' ) { |
| 230 | + if ( $this->getEscapedValue( 'currency_code' ) == 'USD' ) { |
237 | 231 | $form .= '<td>' . Xml::element( 'img', array( 'src' => $wgScriptPath . "/extensions/DonationInterface/gateway_forms/includes/credit_card_logos.gif" ) ) . '</td>'; |
238 | 232 | } else { |
239 | 233 | $form .= '<td>' . Xml::element( 'img', array( 'src' => $wgScriptPath . "/extensions/DonationInterface/gateway_forms/includes/credit_card_logos3.gif" ) ) . '</td>'; |
— | — | @@ -240,7 +234,7 @@ |
241 | 235 | $form .= '</tr>'; |
242 | 236 | |
243 | 237 | // card number |
244 | | - $card_num = ( $this->gateway->getGlobal( "Test" ) ) ? $this->form_data[ 'card_num' ] : ''; |
| 238 | + $card_num = ( $this->gateway->getGlobal( "Test" ) ) ? $this->getEscapedValue( 'card_num' ) : ''; |
245 | 239 | $form .= ''; |
246 | 240 | if ( $this->form_errors['card_num'] ) { |
247 | 241 | $form .= '<tr>'; |
— | — | @@ -276,8 +270,8 @@ |
277 | 271 | $form .= '</tr>'; |
278 | 272 | $form .= '<tr>'; |
279 | 273 | $form .= '<td class="label">' . Xml::label( wfMsg( 'donate_interface-name-on-card' ), 'fname' ) . '</td>'; |
280 | | - $form .= '<td>' . Xml::input( 'fname', '30', $this->form_data['fname'], array( 'type' => 'text', 'onfocus' => 'clearField( this, \''.wfMsg( 'donate_interface-donor-fname' ).'\' )', 'maxlength' => '25', 'class' => 'required', 'id' => 'fname' ) ) . |
281 | | - Xml::input( 'lname', '30', $this->form_data['lname'], array( 'type' => 'text', 'onfocus' => 'clearField( this, \''.wfMsg( 'donate_interface-donor-lname' ).'\' )', 'maxlength' => '25', 'id' => 'lname' ) ) . '</td>'; |
| 274 | + $form .= '<td>' . Xml::input( 'fname', '30', $this->getEscapedValue( 'fname' ), array( 'type' => 'text', 'onfocus' => 'clearField( this, \''.wfMsg( 'donate_interface-donor-fname' ).'\' )', 'maxlength' => '25', 'class' => 'required', 'id' => 'fname' ) ) . |
| 275 | + Xml::input( 'lname', '30', $this->getEscapedValue( 'lname' ), array( 'type' => 'text', 'onfocus' => 'clearField( this, \''.wfMsg( 'donate_interface-donor-lname' ).'\' )', 'maxlength' => '25', 'id' => 'lname' ) ) . '</td>'; |
282 | 276 | $form .= "</tr>"; |
283 | 277 | |
284 | 278 | // street |
— | — | @@ -286,7 +280,7 @@ |
287 | 281 | $form .= '</tr>'; |
288 | 282 | $form .= '<tr>'; |
289 | 283 | $form .= '<td class="label">' . Xml::label( wfMsg( 'donate_interface-billing-address' ), 'street' ) . '</td>'; |
290 | | - $form .= '<td>' . Xml::input( 'street', '30', $this->form_data['street'], array( 'type' => 'text', 'onfocus' => 'clearField( this, \''.wfMsg( 'donate_interface-donor-street' ).'\' )', 'maxlength' => '100', 'id' => 'street', 'class' => 'fullwidth' ) ) . |
| 284 | + $form .= '<td>' . Xml::input( 'street', '30', $this->getEscapedValue( 'street' ), array( 'type' => 'text', 'onfocus' => 'clearField( this, \''.wfMsg( 'donate_interface-donor-street' ).'\' )', 'maxlength' => '100', 'id' => 'street', 'class' => 'fullwidth' ) ) . |
291 | 285 | '</td>'; |
292 | 286 | $form .= '</tr>'; |
293 | 287 | |
— | — | @@ -296,9 +290,9 @@ |
297 | 291 | $form .= '</tr>'; |
298 | 292 | $form .= '<tr>'; |
299 | 293 | $form .= '<td class="label"> </td>'; |
300 | | - $form .= '<td>' . Xml::input( 'city', '18', $this->form_data['city'], array( 'type' => 'text', 'onfocus' => 'clearField( this, \''.wfMsg( 'donate_interface-donor-city' ).'\' )', 'maxlength' => '40', 'id' => 'city' ) ) . ' ' . |
| 294 | + $form .= '<td>' . Xml::input( 'city', '18', $this->getEscapedValue( 'city' ), array( 'type' => 'text', 'onfocus' => 'clearField( this, \''.wfMsg( 'donate_interface-donor-city' ).'\' )', 'maxlength' => '40', 'id' => 'city' ) ) . ' ' . |
301 | 295 | $this->generateStateDropdown() . ' ' . |
302 | | - Xml::input( 'zip', '5', $this->form_data['zip'], array( 'type' => 'text', 'onfocus' => 'clearField( this, \''.wfMsg( 'donate_interface-zip-code' ).'\' )', 'maxlength' => '10', 'id' => 'zip' ) ) . |
| 296 | + Xml::input( 'zip', '5', $this->getEscapedValue( 'zip' ), array( 'type' => 'text', 'onfocus' => 'clearField( this, \''.wfMsg( 'donate_interface-zip-code' ).'\' )', 'maxlength' => '10', 'id' => 'zip' ) ) . |
303 | 297 | Html::hidden( 'country', 'US' ) . |
304 | 298 | '</td>'; |
305 | 299 | $form .= '</tr>'; |
— | — | @@ -320,7 +314,7 @@ |
321 | 315 | $form .= '</tr>'; |
322 | 316 | $form .= '<tr>'; |
323 | 317 | $form .= '<td class="label">' . Xml::label( wfMsg( 'donate_interface-email-receipt' ), 'emailAdd' ) . '</td>'; |
324 | | - $form .= '<td>' . Xml::input( 'emailAdd', '30', $this->form_data['email'], array( 'type' => 'text', 'onfocus' => 'clearField( this, \''.wfMsg( 'donate_interface-donor-email' ).'\' )', 'maxlength' => '64', 'id' => 'emailAdd', 'class' => 'fullwidth' ) ) . |
| 318 | + $form .= '<td>' . Xml::input( 'emailAdd', '30', $this->getEscapedValue( 'email' ), array( 'type' => 'text', 'onfocus' => 'clearField( this, \''.wfMsg( 'donate_interface-donor-email' ).'\' )', 'maxlength' => '64', 'id' => 'emailAdd', 'class' => 'fullwidth' ) ) . |
325 | 319 | '</td>'; |
326 | 320 | $form .= '</tr>'; |
327 | 321 | |
— | — | @@ -368,7 +362,7 @@ |
369 | 363 | // generate dropdown of state opts |
370 | 364 | foreach ( $states as $value => $state_name ) { |
371 | 365 | if ( $value !== 'YY' && $value !== 'XX' ) { |
372 | | - $selected = ( $this->form_data[ 'state' ] == $value ) ? true : false; |
| 366 | + $selected = ( $this->getEscapedValue( 'state' ) == $value ) ? true : false; |
373 | 367 | $state_opts .= Xml::option( $value, $value, $selected ); |
374 | 368 | } |
375 | 369 | } |
Index: trunk/extensions/DonationInterface/gateway_forms/RapidHtml.php |
— | — | @@ -178,8 +178,8 @@ |
179 | 179 | foreach ( $this->data_tokens as $token ) { |
180 | 180 | $key = substr( $token, 1, strlen( $token )); //get the token string w/o the '@' |
181 | 181 | if ( $key == 'emailAdd' ) $key = 'email'; |
182 | | - if ( array_key_exists( $key, $this->form_data )) { |
183 | | - $replace = $this->form_data[ $key ]; |
| 182 | + if ( $this->getEscapedValue( $key ) ) { |
| 183 | + $replace = $this->getEscapedValue( $key ); |
184 | 184 | } else { |
185 | 185 | $replace = ''; |
186 | 186 | } |
— | — | @@ -249,7 +249,7 @@ |
250 | 250 | } else { |
251 | 251 | $params[ $k ] .= '?'; |
252 | 252 | } |
253 | | - $params[ $k ] .= "language=" . $this->form_data['language']. "&country=" . $this->form_data['country']; |
| 253 | + $params[ $k ] .= "language=" . $this->getEscapedValue( 'language' ) . "&country=" . $this->getEscapedValue( 'country' ); |
254 | 254 | } |
255 | 255 | } |
256 | 256 | $html = str_replace( $matches[ 0 ][ $i ], wfMsg( $msg_key, $params ), $html ); |
— | — | @@ -277,7 +277,7 @@ |
278 | 278 | * @return string The HTML form containing translated messages |
279 | 279 | */ |
280 | 280 | public function replace_blocks( $html ){ |
281 | | - global $wgRequest, $wgGlobalCollectGatewayHtmlFormDir; |
| 281 | + global $wgRequest; |
282 | 282 | if( $wgRequest->getText( 'debug', 'false' ) == 'true' ){ |
283 | 283 | # do not replace tokens |
284 | 284 | return $html; |
— | — | @@ -291,14 +291,15 @@ |
292 | 292 | |
293 | 293 | foreach( $matches[ 1 ] as $i => $key ){ |
294 | 294 | # $matches[ 1 ] is specified in the code, not user input |
295 | | - $filepath = $wgGlobalCollectGatewayHtmlFormDir . '/_' . $matches[ 1 ][ $i ] . '/'; |
| 295 | + $filepath = $this->gateway->getGlobal('HtmlFormDir') . '/_' . $matches[ 1 ][ $i ] . '/'; |
296 | 296 | |
297 | 297 | $var = 'default'; |
298 | 298 | |
299 | | - # check to see if the parameter is, in fact, an element of form_data |
300 | | - if( array_key_exists( $matches[ 2 ][ $i ], $this->form_data ) ){ |
| 299 | + # check to see if the parameter is, in fact, an element in DonationData |
| 300 | + $param = $this->getEscapedValue( $matches[ 2 ][ $i ] ); |
| 301 | + if( $param ){ |
301 | 302 | # get the value of the element and super-escape |
302 | | - $var = $this->make_safe( $this->form_data[ $matches[ 2 ][ $i ] ], 'default' ); |
| 303 | + $var = $this->make_safe( $param, 'default' ); |
303 | 304 | } |
304 | 305 | |
305 | 306 | # oh, and we only allow with the extension .html |
— | — | @@ -332,7 +333,7 @@ |
333 | 334 | // currency code |
334 | 335 | $start = strpos( $html, 'name="currency_code"' ); |
335 | 336 | if ( $start ) { |
336 | | - $currency_code = $this->form_data['currency_code']; |
| 337 | + $currency_code = $this->getEscapedValue( 'currency_code' ); |
337 | 338 | $end = strpos( $html, '</select>', $start ); |
338 | 339 | $str = substr( $html, $start, ( $end - $start ) ); |
339 | 340 | $str = str_replace( 'value="' . $currency_code . '"', 'value="' . $currency_code . '" selected="selected"', $str ); |
— | — | @@ -340,7 +341,7 @@ |
341 | 342 | } |
342 | 343 | |
343 | 344 | // mos |
344 | | - $month = substr( $this->form_data['expiration'], 0, 2 ); |
| 345 | + $month = substr( $this->getEscapedValue( 'expiration' ), 0, 2 ); |
345 | 346 | $start = strpos( $html, 'name="mos"' ); |
346 | 347 | if ( $start ) { |
347 | 348 | $end = strpos( $html, '</select>', $start ); |
— | — | @@ -350,7 +351,7 @@ |
351 | 352 | } |
352 | 353 | |
353 | 354 | // year |
354 | | - $year = substr( $this->form_data['expiration'], 2, 2 ); |
| 355 | + $year = substr( $this->getEscapedValue( 'expiration' ), 2, 2 ); |
355 | 356 | $start = strpos( $html, 'name="year"' ); |
356 | 357 | if ( $start ) { |
357 | 358 | $end = strpos( $html, '</select>', $start ); |
— | — | @@ -361,7 +362,7 @@ |
362 | 363 | } |
363 | 364 | |
364 | 365 | // state |
365 | | - $state = $this->form_data['state']; |
| 366 | + $state = $this->getEscapedValue( 'state' ); |
366 | 367 | $start = strpos( $html, 'name="state"' ); |
367 | 368 | if ( $start ) { |
368 | 369 | $end = strpos( $html, '</select>', $start ); |
— | — | @@ -371,7 +372,7 @@ |
372 | 373 | } |
373 | 374 | |
374 | 375 | //country |
375 | | - $country = $this->form_data['country']; |
| 376 | + $country = $this->getEscapedValue( 'country' ); |
376 | 377 | $start = strpos( $html, 'name="country"' ); |
377 | 378 | if ( $start ) { |
378 | 379 | $end = strpos( $html, '</select>', $start ); |
— | — | @@ -408,7 +409,7 @@ |
409 | 410 | global $wgRequest; |
410 | 411 | if ( $wgRequest->getText( '_cache_', false )) { |
411 | 412 | $this->loadApiJs(); |
412 | | -} |
| 413 | + } |
413 | 414 | } |
414 | 415 | |
415 | 416 | /** |
Index: trunk/extensions/DonationInterface/gateway_forms/TwoStepTwoColumnPremiumUS.php |
— | — | @@ -121,7 +121,7 @@ |
122 | 122 | } |
123 | 123 | |
124 | 124 | public function generateFormStart() { |
125 | | - global $wgRequest, $wgScriptPath; |
| 125 | + global $wgScriptPath; |
126 | 126 | |
127 | 127 | $form = parent::generateBannerHeader(); |
128 | 128 | |
— | — | @@ -131,7 +131,7 @@ |
132 | 132 | |
133 | 133 | $form .= Xml::openElement( 'div', array( 'id' => 'premium-confirmation' ) ); |
134 | 134 | $form .= Xml::element( 'img', array( 'src' => $wgScriptPath . "/extensions/DonationInterface/gateway_forms/includes/Wikipedia-ten-tshirt-back.jpg", 'width' => '300', 'height' => '300' ) ); |
135 | | - $form .= wfMsg( 'donate_interface-shirt-size-2', $wgRequest->getText( 'size' ) ); |
| 135 | + $form .= wfMsg( 'donate_interface-shirt-size-2', $this->getEscapedValue( 'size' ) ); |
136 | 136 | $form .= Xml::closeElement( 'div' ); // close div#premium-confirmation |
137 | 137 | |
138 | 138 | $form .= Xml::closeElement( 'td' ); |
— | — | @@ -197,11 +197,11 @@ |
198 | 198 | $form .= '</tr>'; |
199 | 199 | $form .= '<tr>'; |
200 | 200 | $form .= '<td class="amount_data">'.wfMsg( 'donate_interface-donation' ).'</td>'; |
201 | | - $form .= '<td class="amount_data" style="text-align:right;width:75px;">'.$this->form_data['amount'] . |
202 | | - Html::hidden( 'amount', $this->form_data['amount'] ) . |
| 201 | + $form .= '<td class="amount_data" style="text-align:right;width:75px;">'.$this->getEscapedValue( 'amount' ) . |
| 202 | + Html::hidden( 'amount', $this->getEscapedValue( 'amount' ) ) . |
203 | 203 | '</td>'; |
204 | | - $form .= '<td class="amount_data" style="text-align:right;width:75px;">'.$this->form_data[ 'currency_code' ] . |
205 | | - Html::hidden( 'currency_code', $this->form_data['currency_code'] ) . |
| 204 | + $form .= '<td class="amount_data" style="text-align:right;width:75px;">'.$this->getEscapedValue( 'currency_code' ) . |
| 205 | + Html::hidden( 'currency_code', $this->getEscapedValue( 'currency_code' ) ) . |
206 | 206 | '</td>'; |
207 | 207 | $form .= '</tr>'; |
208 | 208 | $form .= '</table>'; |
— | — | @@ -216,7 +216,7 @@ |
217 | 217 | // card logos |
218 | 218 | $form .= '<tr>'; |
219 | 219 | $form .= '<td class="label"> </td>'; |
220 | | - if ( $this->form_data[ 'currency_code' ] == 'USD' ) { |
| 220 | + if ( $this->getEscapedValue( 'currency_code' ) == 'USD' ) { |
221 | 221 | $form .= '<td>' . Xml::element( 'img', array( 'src' => $wgScriptPath . "/extensions/DonationInterface/gateway_forms/includes/credit_card_logos.gif" ) ) . '</td>'; |
222 | 222 | } else { |
223 | 223 | $form .= '<td>' . Xml::element( 'img', array( 'src' => $wgScriptPath . "/extensions/DonationInterface/gateway_forms/includes/credit_card_logos3.gif" ) ) . '</td>'; |
— | — | @@ -224,7 +224,7 @@ |
225 | 225 | $form .= '</tr>'; |
226 | 226 | |
227 | 227 | // card number |
228 | | - $card_num = ( $this->gateway->getGlobal( "Test" ) ) ? $this->form_data[ 'card_num' ] : ''; |
| 228 | + $card_num = ( $this->gateway->getGlobal( "Test" ) ) ? $this->getEscapedValue( 'card_num' ) : ''; |
229 | 229 | $form .= ''; |
230 | 230 | if ( $this->form_errors['card_num'] ) { |
231 | 231 | $form .= '<tr>'; |
— | — | @@ -260,8 +260,8 @@ |
261 | 261 | $form .= '</tr>'; |
262 | 262 | $form .= '<tr>'; |
263 | 263 | $form .= '<td class="label">' . Xml::label( wfMsg( 'donate_interface-name-on-card' ), 'fname' ) . '</td>'; |
264 | | - $form .= '<td>' . Xml::input( 'fname', '30', $this->form_data['fname'], array( 'type' => 'text', 'onfocus' => 'clearField( this, \''.wfMsg( 'donate_interface-donor-fname' ).'\' )', 'maxlength' => '25', 'class' => 'required', 'id' => 'fname' ) ) . |
265 | | - Xml::input( 'lname', '30', $this->form_data['lname'], array( 'type' => 'text', 'onfocus' => 'clearField( this, \''.wfMsg( 'donate_interface-donor-lname' ).'\' )', 'maxlength' => '25', 'id' => 'lname' ) ) . '</td>'; |
| 264 | + $form .= '<td>' . Xml::input( 'fname', '30', $this->getEscapedValue( 'fname' ), array( 'type' => 'text', 'onfocus' => 'clearField( this, \''.wfMsg( 'donate_interface-donor-fname' ).'\' )', 'maxlength' => '25', 'class' => 'required', 'id' => 'fname' ) ) . |
| 265 | + Xml::input( 'lname', '30', $this->getEscapedValue( 'lname' ), array( 'type' => 'text', 'onfocus' => 'clearField( this, \''.wfMsg( 'donate_interface-donor-lname' ).'\' )', 'maxlength' => '25', 'id' => 'lname' ) ) . '</td>'; |
266 | 266 | $form .= "</tr>"; |
267 | 267 | |
268 | 268 | // street |
— | — | @@ -270,7 +270,7 @@ |
271 | 271 | $form .= '</tr>'; |
272 | 272 | $form .= '<tr>'; |
273 | 273 | $form .= '<td class="label">' . Xml::label( wfMsg( 'donate_interface-billing-address' ), 'street' ) . '</td>'; |
274 | | - $form .= '<td>' . Xml::input( 'street', '30', $this->form_data['street'], array( 'type' => 'text', 'onfocus' => 'clearField( this, \''.wfMsg( 'donate_interface-donor-street' ).'\' )', 'maxlength' => '100', 'id' => 'street', 'class' => 'fullwidth' ) ) . |
| 274 | + $form .= '<td>' . Xml::input( 'street', '30', $this->getEscapedValue( 'street' ), array( 'type' => 'text', 'onfocus' => 'clearField( this, \''.wfMsg( 'donate_interface-donor-street' ).'\' )', 'maxlength' => '100', 'id' => 'street', 'class' => 'fullwidth' ) ) . |
275 | 275 | '</td>'; |
276 | 276 | $form .= '</tr>'; |
277 | 277 | |
— | — | @@ -280,9 +280,9 @@ |
281 | 281 | $form .= '</tr>'; |
282 | 282 | $form .= '<tr>'; |
283 | 283 | $form .= '<td class="label"> </td>'; |
284 | | - $form .= '<td>' . Xml::input( 'city', '18', $this->form_data['city'], array( 'type' => 'text', 'onfocus' => 'clearField( this, \''.wfMsg( 'donate_interface-donor-city' ).'\' )', 'maxlength' => '40', 'id' => 'city' ) ) . ' ' . |
| 284 | + $form .= '<td>' . Xml::input( 'city', '18', $this->getEscapedValue( 'city' ), array( 'type' => 'text', 'onfocus' => 'clearField( this, \''.wfMsg( 'donate_interface-donor-city' ).'\' )', 'maxlength' => '40', 'id' => 'city' ) ) . ' ' . |
285 | 285 | $this->generateStateDropdown() . ' ' . |
286 | | - Xml::input( 'zip', '5', $this->form_data['zip'], array( 'type' => 'text', 'onfocus' => 'clearField( this, \''.wfMsg( 'donate_interface-zip-code' ).'\' )', 'maxlength' => '10', 'id' => 'zip' ) ) . |
| 286 | + Xml::input( 'zip', '5', $this->getEscapedValue( 'zip' ), array( 'type' => 'text', 'onfocus' => 'clearField( this, \''.wfMsg( 'donate_interface-zip-code' ).'\' )', 'maxlength' => '10', 'id' => 'zip' ) ) . |
287 | 287 | Html::hidden( 'country', 'US' ) . |
288 | 288 | '</td>'; |
289 | 289 | $form .= '</tr>'; |
— | — | @@ -293,7 +293,7 @@ |
294 | 294 | $form .= '</tr>'; |
295 | 295 | $form .= '<tr>'; |
296 | 296 | $form .= '<td class="label"> </td>'; |
297 | | - $form .= '<td>' . $this->generateCountryDropdown( $this->form_data['country2'] ) . '</td>'; |
| 297 | + $form .= '<td>' . $this->generateCountryDropdown( $this->getEscapedValue( 'country2' ) ) . '</td>'; |
298 | 298 | $form .= '</tr>'; |
299 | 299 | |
300 | 300 | // email |
— | — | @@ -302,7 +302,7 @@ |
303 | 303 | $form .= '</tr>'; |
304 | 304 | $form .= '<tr>'; |
305 | 305 | $form .= '<td class="label">' . Xml::label( wfMsg( 'donate_interface-email-receipt' ), 'emailAdd' ) . '</td>'; |
306 | | - $form .= '<td>' . Xml::input( 'emailAdd', '30', $this->form_data['email'], array( 'type' => 'text', 'onfocus' => 'clearField( this, \''.wfMsg( 'donate_interface-donor-email' ).'\' )', 'maxlength' => '64', 'id' => 'emailAdd', 'class' => 'fullwidth' ) ) . |
| 306 | + $form .= '<td>' . Xml::input( 'emailAdd', '30', $this->getEscapedValue( 'email' ), array( 'type' => 'text', 'onfocus' => 'clearField( this, \''.wfMsg( 'donate_interface-donor-email' ).'\' )', 'maxlength' => '64', 'id' => 'emailAdd', 'class' => 'fullwidth' ) ) . |
307 | 307 | '</td>'; |
308 | 308 | $form .= '</tr>'; |
309 | 309 | |
— | — | @@ -350,7 +350,7 @@ |
351 | 351 | // generate dropdown of state opts |
352 | 352 | foreach ( $states as $value => $state_name ) { |
353 | 353 | if ( $value !== 'YY' && $value !== 'XX' ) { |
354 | | - $selected = ( $this->form_data[ 'state' ] == $value ) ? true : false; |
| 354 | + $selected = ( $this->getEscapedValue( 'state' ) == $value ) ? true : false; |
355 | 355 | $state_opts .= Xml::option( $value, $value, $selected ); |
356 | 356 | } |
357 | 357 | } |
Index: trunk/extensions/DonationInterface/gateway_forms/OneStepTwoColumn.php |
— | — | @@ -1,7 +1,6 @@ |
2 | 2 | <?php |
3 | 3 | |
4 | 4 | class Gateway_Form_OneStepTwoColumn extends Gateway_Form { |
5 | | - public $paypal = false; // true for paypal only version |
6 | 5 | |
7 | 6 | public function __construct( &$gateway, &$form_errors ) { |
8 | 7 | parent::__construct( $gateway, $form_errors ); |
— | — | @@ -120,10 +119,6 @@ |
121 | 120 | } |
122 | 121 | |
123 | 122 | public function generateFormStart() { |
124 | | - global $wgRequest; |
125 | | - |
126 | | - $this->paypal = $wgRequest->getBool( 'paypal', false ); |
127 | | - |
128 | 123 | $form = $this->generateBannerHeader(); |
129 | 124 | |
130 | 125 | $form .= Xml::openElement( 'div', array( 'id' => 'mw-creditcard' ) ); |
— | — | @@ -203,9 +198,9 @@ |
204 | 199 | |
205 | 200 | // intro text |
206 | 201 | if ( $wgRequest->getText( 'masthead', false ) ) { |
207 | | - $template = $wgOut->parse( '{{' . $wgRequest->getText( 'masthead' ) . '/' . $this->form_data[ 'language' ] . '}}' ); |
| 202 | + $template = $wgOut->parse( '{{' . $wgRequest->getText( 'masthead' ) . '/' . $this->getEscapedValue( 'language' ) . '}}' ); |
208 | 203 | } elseif ( $this->gateway->getGlobal( "Header" ) ) { |
209 | | - $header = str_replace( '@language', $this->form_data[ 'language' ], $this->gateway->getGlobal( "Header" ) ); |
| 204 | + $header = str_replace( '@language', $this->getEscapedValue( 'language' ), $this->gateway->getGlobal( "Header" ) ); |
210 | 205 | $template = $wgOut->parse( $header ); |
211 | 206 | } |
212 | 207 | |
— | — | @@ -216,15 +211,15 @@ |
217 | 212 | } |
218 | 213 | |
219 | 214 | protected function generatePersonalContainer() { |
220 | | - global $wgRequest, $wgScriptPath; |
| 215 | + global $wgScriptPath; |
221 | 216 | $form = ''; |
222 | 217 | $form .= Xml::openElement( 'div', array( 'id' => 'payflowpro_gateway-personal-info' ) ); |
223 | 218 | $form .= Xml::tags( 'h3', array( 'class' => 'payflow-cc-form-header', 'id' => 'payflow-cc-form-header-personal' ), wfMsg( 'donate_interface-make-your-donation' ) ); |
224 | 219 | if ( !$this->paypal ) { |
225 | | - $source = htmlspecialchars( $wgRequest->getText( 'utm_source' ) ); |
226 | | - $medium = htmlspecialchars( $wgRequest->getText( 'utm_medium' ) ); |
227 | | - $campaign = htmlspecialchars( $wgRequest->getText( 'utm_campaign' ) ); |
228 | | - $formname = htmlspecialchars( $wgRequest->getText( 'form_name' ) ); |
| 220 | + $source = $this->getEscapedValue( 'utm_source' ); |
| 221 | + $medium = $this->getEscapedValue( 'utm_medium' ); |
| 222 | + $campaign = $this->getEscapedValue( 'utm_campaign' ); |
| 223 | + $formname = $this->getEscapedValue( 'form_name' ); |
229 | 224 | $form .= Xml::Tags( 'p', array( 'id' => 'payflowpro_gateway-cc_otherways' ), wfMsg( 'donate_interface-paypal', $wgScriptPath, $formname, $source, $medium, $campaign ) ); |
230 | 225 | } |
231 | 226 | $form .= Xml::openElement( 'table', array( 'id' => 'payflow-table-donor' ) ); |
Index: trunk/extensions/DonationInterface/globalcollect_gateway/forms/TwoStepAmount.php |
— | — | @@ -43,21 +43,21 @@ |
44 | 44 | * The default appeal |
45 | 45 | * |
46 | 46 | */ |
47 | | - const DEFAULT_APPEAL = <<<HTML |
48 | | - <h2 id="appeal-head"> <span class="mw-headline" id="From_Wikipedia_programmer_Brandon_Harris">From Wikipedia programmer Brandon Harris</span></h2> |
49 | | - <div id="appeal-body" class="plainlinks"> |
50 | | - <p>I feel like I'm living the first line of my obituary.</p> |
51 | | - <p>I don't think there will be anything else that I do in my life as important as what I do now for Wikipedia. We're not just building an encyclopedia, we're working to make people free. When we have access to free knowledge, we are better people. We understand the world is bigger than us, and we become infected with tolerance and understanding.</p> |
52 | | - <p>Wikipedia is the 5th largest website in the world. I work at the small non-profit that keeps it on the web. We don't run ads because doing so would sacrifice our independence. The site is not and should never be a propaganda tool.</p> |
53 | | - <p>Our work is possible because of donations from our readers. Will you help protect Wikipedia by donating $5, $10, $20 or whatever you can afford?</p> |
54 | | - <p>I work at the Wikimedia Foundation because everything in my soul tells me it's the right thing to do. I've worked at huge tech companies, doing some job to build some crappy thing that's designed to steal money from some kid who doesn't know it. I would come home from work crushed.</p> |
55 | | - <p>You might not know this, but the Wikimedia Foundation operates with a very small staff. Most other top-ten sites have tens of thousands of people and massive budgets. But they produce a fraction of what we pull off with sticks and wire.</p> |
56 | | - <p>When you give to Wikipedia, you're supporting free knowledge around the world. You're not only leaving a legacy for your children and for their children, you're elevating people around the world who have access to this treasure. You're assuring that one day everyone else will too.</p> |
57 | | - <p>Thank you,</p> |
58 | | - <p><strong>Brandon Harris</strong><br /></p> |
59 | | - <p>Programmer, Wikimedia Foundation</p> |
60 | | - </div> |
61 | | -HTML; |
| 47 | +// const DEFAULT_APPEAL = <<<HTML |
| 48 | +// <h2 id="appeal-head"> <span class="mw-headline" id="From_Wikipedia_programmer_Brandon_Harris">From Wikipedia programmer Brandon Harris</span></h2> |
| 49 | +// <div id="appeal-body" class="plainlinks"> |
| 50 | +// <p>I feel like I'm living the first line of my obituary.</p> |
| 51 | +// <p>I don't think there will be anything else that I do in my life as important as what I do now for Wikipedia. We're not just building an encyclopedia, we're working to make people free. When we have access to free knowledge, we are better people. We understand the world is bigger than us, and we become infected with tolerance and understanding.</p> |
| 52 | +// <p>Wikipedia is the 5th largest website in the world. I work at the small non-profit that keeps it on the web. We don't run ads because doing so would sacrifice our independence. The site is not and should never be a propaganda tool.</p> |
| 53 | +// <p>Our work is possible because of donations from our readers. Will you help protect Wikipedia by donating $5, $10, $20 or whatever you can afford?</p> |
| 54 | +// <p>I work at the Wikimedia Foundation because everything in my soul tells me it's the right thing to do. I've worked at huge tech companies, doing some job to build some crappy thing that's designed to steal money from some kid who doesn't know it. I would come home from work crushed.</p> |
| 55 | +// <p>You might not know this, but the Wikimedia Foundation operates with a very small staff. Most other top-ten sites have tens of thousands of people and massive budgets. But they produce a fraction of what we pull off with sticks and wire.</p> |
| 56 | +// <p>When you give to Wikipedia, you're supporting free knowledge around the world. You're not only leaving a legacy for your children and for their children, you're elevating people around the world who have access to this treasure. You're assuring that one day everyone else will too.</p> |
| 57 | +// <p>Thank you,</p> |
| 58 | +// <p><strong>Brandon Harris</strong><br /></p> |
| 59 | +// <p>Programmer, Wikimedia Foundation</p> |
| 60 | +// </div> |
| 61 | +//HTML; |
62 | 62 | |
63 | 63 | //////////////////////////////////////////////////////////////////////////// |
64 | 64 | // |
— | — | @@ -73,11 +73,11 @@ |
74 | 74 | */ |
75 | 75 | protected function init() { |
76 | 76 | |
77 | | - $this->setPaymentMethod( $this->form_data['payment_method'] ); |
78 | | - $this->setPaymentSubmethod( $this->form_data['payment_submethod'] ); |
| 77 | + $this->setPaymentMethod( $this->getEscapedValue( 'payment_method' ) ); |
| 78 | + $this->setPaymentSubmethod( $this->getEscapedValue( 'payment_submethod' ) ); |
79 | 79 | |
80 | 80 | // Should process be deprecated? |
81 | | - $this->form_data['process'] = 'other'; |
| 81 | + $this->getEscapedValue( 'process' ) = 'other'; |
82 | 82 | |
83 | 83 | // Initialize the appeal |
84 | 84 | $this->appeal = self::DEFAULT_APPEAL; |
— | — | @@ -356,7 +356,7 @@ |
357 | 357 | 'iban' => array( 'required' => true, ), |
358 | 358 | ); |
359 | 359 | |
360 | | - $country = isset( $this->form_data['country'] ) ? $this->form_data['country'] : ''; |
| 360 | + $country = !is_null( $this->getEscapedValue( 'country' ) ) ? $this->getEscapedValue( 'country' ) : ''; |
361 | 361 | |
362 | 362 | if ( $country == 'AT' ) { |
363 | 363 | |
— | — | @@ -403,7 +403,7 @@ |
404 | 404 | $elementClass .= $required ? ' required ' : '' ; |
405 | 405 | $elementClass = trim( $elementClass ); |
406 | 406 | |
407 | | - $return .= Xml::input( $field, '', $this->form_data[ $field ], array( 'class' => $elementClass, 'type' => 'text', 'maxlength' => '32', 'id' => $field ) ); |
| 407 | + $return .= Xml::input( $field, '', $this->getEscapedValue( $field ), array( 'class' => $elementClass, 'type' => 'text', 'maxlength' => '32', 'id' => $field ) ); |
408 | 408 | $return .= '</td>'; |
409 | 409 | $return .= '</tr>'; |
410 | 410 | } |
— | — | @@ -561,7 +561,7 @@ |
562 | 562 | |
563 | 563 | // generate dropdown of issuer_ids |
564 | 564 | foreach ( $payment_submethod['issuerids'] as $issuer_id => $issuer_id_label ) { |
565 | | - $selected = ( $this->form_data['issuer_id'] == $issuer_id ) ? true : false; |
| 565 | + $selected = ( $this->getEscapedValue( 'issuer_id' ) == $issuer_id ) ? true : false; |
566 | 566 | //$selectOptions .= Xml::option( wfMsg( 'donate_interface-rtbt-' . $issuer_id ), $issuer_id_label, $selected ); |
567 | 567 | $selectOptions .= Xml::option( $issuer_id_label, $issuer_id, $selected ); |
568 | 568 | } |
— | — | @@ -619,7 +619,7 @@ |
620 | 620 | $radioOptions = array(); |
621 | 621 | $radioOptions['showCardsOnCurrencyChange'] = false; |
622 | 622 | |
623 | | - $country = isset( $this->form_data['country'] ) ? $this->form_data['country'] : ''; |
| 623 | + $country = !is_null( $this->getEscapedValue( 'country' ) ) ? $this->getEscapedValue( 'country' ) : ''; |
624 | 624 | |
625 | 625 | if ( $country == 'SG' ) { |
626 | 626 | $radioOptions['setCurrency'] = 'SGD'; |
— | — | @@ -769,8 +769,8 @@ |
770 | 770 | $form .= Xml::tags( 'li', array(), 'payment_method: ' . $this->getPaymentMethod() ); |
771 | 771 | $form .= Xml::tags( 'li', array(), 'payment_submethod: ' . $this->getPaymentSubmethod() ); |
772 | 772 | |
773 | | - if ( isset( $this->form_data['issuer_id'] ) ) { |
774 | | - $form .= Xml::tags( 'li', array(), 'issuer_id: ' . $this->form_data['issuer_id'] ); |
| 773 | + if ( !is_null( $this->getEscapedValue( 'issuer_id' ) ) ) { |
| 774 | + $form .= Xml::tags( 'li', array(), 'issuer_id: ' . $this->getEscapedValue( 'issuer_id' ) ); |
775 | 775 | } |
776 | 776 | |
777 | 777 | $form .= Xml::closeElement( 'ul' ); // close div#mw-payment-information ul |
— | — | @@ -828,7 +828,7 @@ |
829 | 829 | |
830 | 830 | // generate dropdown of issuer_ids |
831 | 831 | foreach ( $payment_submethod['issuerids'] as $issuer_id => $issuer_id_label ) { |
832 | | - $selected = ( $this->form_data['issuer_id'] == $issuer_id ) ? true : false; |
| 832 | + $selected = ( $this->getEscapedValue( 'issuer_id' ) == $issuer_id ) ? true : false; |
833 | 833 | //$selectOptions .= Xml::option( wfMsg( 'donate_interface-rtbt-' . $issuer_id ), $issuer_id_label, $selected ); |
834 | 834 | $selectOptions .= Xml::option( $issuer_id_label, $issuer_id, $selected ); |
835 | 835 | } |
Index: trunk/extensions/DonationInterface/gateway_common/gateway.adapter.php |
— | — | @@ -387,6 +387,13 @@ |
388 | 388 | /** |
389 | 389 | * This is the ONLY getData type function anything should be using |
390 | 390 | * outside the adapter. |
| 391 | + * Short explanation of the data population up to now: |
| 392 | + * *) When the gateway adapter is constructed, it constructs a DonationData |
| 393 | + * object. |
| 394 | + * *) On construction, the DonationData object pulls donation data from an |
| 395 | + * appropriate source, and normalizes the entire data set for storage. |
| 396 | + * *) The gateway adapter pulls normalized, html escaped data out of the |
| 397 | + * DonationData object, as the base of its own data set. |
391 | 398 | * @param string $val The specific key you're looking for (if any) |
392 | 399 | * @return mixed An array of all the raw, unstaged (but normalized and |
393 | 400 | * sanitized) data sent to the adapter, or if $val was set, either the |
Index: trunk/extensions/DonationInterface/gateway_common/DonationData.php |
— | — | @@ -101,6 +101,8 @@ |
102 | 102 | 'direct_debit_text' => $wgRequest->getText( 'direct_debit_text', null ), |
103 | 103 | 'iban' => $wgRequest->getText( 'iban', null ), |
104 | 104 | 'transaction_type' => $wgRequest->getText( 'transaction_type', null ), |
| 105 | + 'form_name' => $wgRequest->getText( 'form_name', null ), |
| 106 | + 'ffname' => $wgRequest->getText( 'ffname', null ), |
105 | 107 | ); |
106 | 108 | if ( !$this->wasPosted() ) { |
107 | 109 | $this->setVal( 'posted', false ); |
Index: trunk/extensions/DonationInterface/gateway_common/GatewayForm.php |
— | — | @@ -326,9 +326,13 @@ |
327 | 327 | */ |
328 | 328 | public function setFormClass( $class_name = NULL ) { |
329 | 329 | if ( !$class_name ) { |
330 | | - global $wgRequest; |
| 330 | + //TODO: This is the sort of thing we really ought to be handled in |
| 331 | + //DonationData instead of all the way out here. |
331 | 332 | $defaultForm = $this->adapter->getGlobal( 'DefaultForm' ); |
332 | | - $form_class = $wgRequest->getText( 'form_name', $defaultForm ); |
| 333 | + $form_class = $this->adapter->getData_Unstaged_Escaped( 'form_name' ); |
| 334 | + if ( is_null( $form_class ) ){ |
| 335 | + $form_class = $defaultForm; |
| 336 | + } |
333 | 337 | |
334 | 338 | // make sure our form class exists before going on, if not try loading default form class |
335 | 339 | $class_name = "Gateway_Form_" . $form_class; |
— | — | @@ -342,7 +346,8 @@ |
343 | 347 | } |
344 | 348 | $this->form_class = $class_name; |
345 | 349 | |
346 | | - //this should... maybe replace the other thing? I need it in the adapter so reCaptcha can get to it. |
| 350 | + //...this is just dumb now. |
| 351 | + //TODO: Check who's using this get/set combo, and maybe nuke it all. |
347 | 352 | $this->adapter->setFormClass( $class_name ); |
348 | 353 | } |
349 | 354 | |