r104724 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r104723‎ | r104724 | r104725 >
Date:19:30, 30 November 2011
Author:khorn
Status:deferred
Tags:
Comment:
Modified paths:
  • /branches/fundraising/deployment/payments_1.17/extensions/DonationInterface/gateway_common/countries.i18n.php (modified) (history)
  • /branches/fundraising/deployment/payments_1.17/extensions/DonationInterface/gateway_common/gateway.adapter.php (modified) (history)
  • /branches/fundraising/deployment/payments_1.17/extensions/DonationInterface/gateway_common/interface.i18n.php (modified) (history)
  • /branches/fundraising/deployment/payments_1.17/extensions/DonationInterface/globalcollect_gateway/globalcollect_gateway.body.php (modified) (history)
  • /branches/fundraising/deployment/payments_1.17/extensions/DonationInterface/globalcollect_gateway/globalcollect_resultswitcher.body.php (modified) (history)

Diff [purge]

Index: branches/fundraising/deployment/payments_1.17/extensions/DonationInterface/globalcollect_gateway/globalcollect_resultswitcher.body.php
@@ -41,9 +41,10 @@
4242 //no longer letting people in without these things. If this is
4343 //preventing you from doing something, you almost certainly want to be
4444 //somewhere else.
 45+ $forbidden = false;
4546 if ( !isset($_GET['order_id']) || !$this->adapter->hasDonorDataInSession( 'order_id', $_GET['order_id'] ) ){
46 - //TODO: i18n, apparently.
47 - wfHttpError( 403, 'Forbidden', 'You do not have permission to access this page.' );
 47+ wfHttpError( 403, 'Forbidden', wfMsg( 'donate_interface-error-http-403' ) );
 48+ $forbidden = true;
4849 }
4950
5051 $referrer = $wgRequest->getHeader( 'referer' );
@@ -64,6 +65,23 @@
6566 $this->adapter->getGlobal( 'CSSVersion' ) );
6667
6768 $this->setHeaders();
 69+
 70+ if ( $forbidden ){
 71+ $qs_oid = 'undefined';
 72+ $message = '';
 73+ if ( !isset($_GET['order_id']) ){
 74+ $message = 'No order ID in the Querystring.';
 75+ } else {
 76+ $qs_oid = $_GET['order_id'];
 77+ }
 78+
 79+ if ( !$this->adapter->hasDonorDataInSession( 'order_id', $_GET['order_id'] ) ){
 80+ $message = 'Requested order id not present in the session';
 81+ }
 82+
 83+ $this->adapter->log("Resultswitcher: Request forbidden. " . $message . " Quersytring Oirder ID: $qs_oid");
 84+ return;
 85+ }
6886
6987
7088 // dispatch forms/handling
@@ -99,16 +117,16 @@
100118 $wgOut->addHTML( "<br>Redirecting to page $go" );
101119 $wgOut->redirect( $go );
102120 } else {
103 - $this->adapter->log("Resultswitcher: No redirect defined.");
 121+ $this->adapter->log("Resultswitcher: No redirect defined. Order ID: $oid");
104122 }
105123 } else {
106 - $this->adapter->log("Resultswitcher: No TransactionWMFStatus.");
 124+ $this->adapter->log("Resultswitcher: No TransactionWMFStatus. Order ID: $oid");
107125 }
108126 } else {
109 - $this->adapter->log("Resultswitcher: Payment method is not cc.");
 127+ $this->adapter->log("Resultswitcher: Payment method is not cc. Order ID: $oid");
110128 }
111129 } else {
112 - $this->adapter->log("Resultswitcher: Token Check Failed.");
 130+ $this->adapter->log("Resultswitcher: Token Check Failed. Order ID: $oid");
113131 }
114132 }
115133
Property changes on: branches/fundraising/deployment/payments_1.17/extensions/DonationInterface/globalcollect_gateway/globalcollect_resultswitcher.body.php
___________________________________________________________________
Modified: svn:mergeinfo
116134 Merged /trunk/extensions/DonationInterface/globalcollect_gateway/globalcollect_resultswitcher.body.php:r104717-104718
Index: branches/fundraising/deployment/payments_1.17/extensions/DonationInterface/globalcollect_gateway/globalcollect_gateway.body.php
@@ -260,22 +260,22 @@
261261
262262 $return .= Xml::tags( 'h2', array(), wfMsg( 'donate_interface-bt-information' ) );
263263
264 - $return .= Xml::openElement( 'table', array( 'id' => $id . '_table', 'width' => '50%' ) );
 264+ $return .= Xml::openElement( 'table', array( 'id' => $id . '_table', 'style' => 'width:600px; margin-left:auto; margin-right:auto;' ) );
265265
266266 foreach ( $fields as $field => $meta ) {
267267
268268 if ( isset( $results['data'][ $field ] ) ) {
269269 $return .= Xml::openElement( 'tr', array() );
270270
271 - $return .= Xml::tags( 'th', array(), wfMsg( $meta['translation'] ) );
272 - $return .= Xml::tags( 'td', array(), $results['data'][ $field ] );
 271+ $return .= Xml::tags( 'td', array( 'style' => 'text-align:right; font-weight:bold; padding-right:0.5em;' ), wfMsg( $meta['translation'] ) );
 272+ $return .= Xml::tags( 'td', array( 'style' => 'padding-left:0.5em;' ), $results['data'][ $field ] );
273273
274274 $return .= Xml::closeElement( 'tr' );
275275 }
276276 }
277277
278278 $return .= Xml::openElement( 'tr', array() );
279 - $return .= Xml::tags( 'td', array('style' => 'font-weight:bold', 'colspan' => '2'), wfMsg( 'donate_interface-bank_transfer_message' ) );
 279+ $return .= Xml::tags( 'td', array( 'style' => 'font-weight:bold;', 'colspan' => '2' ), wfMsg( 'donate_interface-bank_transfer_message' ) );
280280 $return .= Xml::closeElement( 'tr' );
281281
282282 $return .= Xml::closeElement( 'table' ); // close $id . '_table'
@@ -284,9 +284,9 @@
285285
286286 $url = $this->adapter->getThankYouPage() . $queryString;
287287
288 - $link = HTML::input('MyButton', 'finished', 'button', array( 'onclick' => "window.location = '$url'" ) );
 288+ $link = HTML::input('MyButton', wfMsg( 'donate_interface-bt-finished') , 'button', array( 'onclick' => "window.location = '$url'" ) );
289289
290 - $return .= Xml::tags( 'p', array(), $link );
 290+ $return .= Xml::tags( 'p', array( 'style' => 'text-align:center;' ), $link );
291291
292292 $return .= Xml::closeElement( 'div' ); // $id
293293
Property changes on: branches/fundraising/deployment/payments_1.17/extensions/DonationInterface/globalcollect_gateway/globalcollect_gateway.body.php
___________________________________________________________________
Added: svn:mergeinfo
294294 Merged /trunk/extensions/DonationInterface/globalcollect_gateway/globalcollect_gateway.body.php:r75657-77440,77442-79147,79149-79286,79288-79296,79298-79299,79301-79303,79305-86440,90286,92825,96120-96121,96125,97945-99042,99045-99408,99503,99555,99568,99570-101026,101056,101060,101063-101064,101071-101074,101076,101099,101109,101112,101163,101180,101192,101200,101205,101207,101217,101230,101232,101236,101335,101382,101399,101441,101501-101504,101512,101541,101547,101549,101553-101555,101557,101559,101561,101563,101576,101578-101579,101631,101633,101638,101669,101676,101679,101689,101700,101706,101719,101740,101747,101757,101764,101778-101779,101781,101785-101789,101798,101823,101826,101837,101846,101852,101870-101872,101878,101882,101890,101892,101910,101917,101929,101947,101949-101951,101955-101960,101962,101964-101966,101996,102003,102011-102012,102030,102032-102033,102047,102050-102052,102054,102056,102058,102065,102076,102081,102085-102087,102118,102120,102123-102127,102130,102134,102140,102147,102151-102152,102155-102156,102186,102188-102242,102252,102258-102261,102263,102267,102269,102307-102309,102313,102318,102332,102338,102341-102342,102345,102364,102419,102424-102425,102445,102463,102467-102468,102470,102476,102479-102480,102549-102550,102576-102581,102590,102594,102596,102611,102639,102664,102681-102682,102685,102689,102698,102700-102703,102707,102711-102712,102714,102729,102733,102736,102740,102752,102763,102805,102807,102809-102810,102812,102819-102824,102826,102828-102833,102835-102836,102841,102872,102878,102915,102921-102923,102926-102928,102932,102936,102938,102942-102943,102946,102953,102960-102961,103009,103023-103024,103026-103027,103032,103036-103038,103040,103044,103050,103058,103067,103077,103080,103130,103219,103223,103229,103235,103237-103239,103243-103247,103253,103255,103259,103261-103262,103264,103275,103278,103284,103289-103291,103325,103371,103397,103399,103401,103411,103413,103421,103434-103435,103481,103500,103503,103515,103519,103537,103541,103548,103591,103607-103608,103633,103680,103775,103784,103837,103839,103863,103866,104065,104071,104194,104210,104243,104298,104362,104485,104587,104611
295295 Merged /branches/fundraising/deployment/payments_1.17/extensions/DonationInterface/globalcollect_gateway/globalcollect_gateway.body.php:r99568
Index: branches/fundraising/deployment/payments_1.17/extensions/DonationInterface/gateway_common/countries.i18n.php
@@ -253,6 +253,26 @@
254254 "donate_interface-country-dropdown-ZW" => "Zimbabwe",
255255 );
256256
 257+/** Arabic (العربية) */
 258+$messages['ar'] = array(
 259+ 'donate_interface-country-dropdown-SA' => 'السعودية',
 260+);
 261+
 262+/** Bulgarian (Български) */
 263+$messages['bg'] = array(
 264+ 'donate_interface-country-dropdown-BG' => 'България',
 265+);
 266+
 267+/** Czech (Česky) */
 268+$messages['cs'] = array(
 269+ 'donate_interface-country-dropdown-CZ' => 'Česko',
 270+);
 271+
 272+/** Danish (Dansk) */
 273+$messages['da'] = array(
 274+ 'donate_interface-country-dropdown-DK' => 'Danmark',
 275+);
 276+
257277 /** German (Deutsch) */
258278 $messages['de'] = array(
259279 'donate_interface-country-dropdown-US' => 'USA',
@@ -275,3 +295,126 @@
276296 'donate_interface-country-dropdown-GB' => 'Großbritannien',
277297 );
278298
 299+/** Greek (Ελληνικά) */
 300+$messages['el'] = array(
 301+ 'donate_interface-country-dropdown-CY' => 'Κύπρος',
 302+ 'donate_interface-country-dropdown-GR' => 'Ελλάδα',
 303+);
 304+
 305+/** Spanish (Español) */
 306+$messages['es'] = array(
 307+ 'donate_interface-country-dropdown-ES' => 'España',
 308+ 'donate_interface-country-dropdown-MX' => 'México',
 309+);
 310+
 311+/** Finnish (Suomi) */
 312+$messages['fi'] = array(
 313+ 'donate_interface-country-dropdown-FI' => 'Suomi',
 314+);
 315+
 316+/** French (Français) */
 317+$messages['fr'] = array(
 318+ 'donate_interface-country-dropdown-BE' => 'Belgique',
 319+ 'donate_interface-country-dropdown-CA' => 'Canada',
 320+ 'donate_interface-country-dropdown-CH' => 'Suisse',
 321+ 'donate_interface-country-dropdown-FR' => 'France',
 322+);
 323+
 324+/** Hebrew (עברית) */
 325+$messages['he'] = array(
 326+ 'donate_interface-country-dropdown-IL' => 'ישראל',
 327+);
 328+
 329+/** Hungarian (Magyar) */
 330+$messages['hu'] = array(
 331+ 'donate_interface-country-dropdown-HU' => 'Magyarország',
 332+);
 333+
 334+/** Italian (Italiano) */
 335+$messages['it'] = array(
 336+ 'donate_interface-country-dropdown-CH' => 'Svizzera',
 337+ 'donate_interface-country-dropdown-IT' => 'Italia',
 338+ 'donate_interface-country-dropdown-SM' => 'San Marino',
 339+ 'donate_interface-country-dropdown-VA' => 'Città del Vaticano',
 340+);
 341+
 342+/** Japanese (日本語) */
 343+$messages['ja'] = array(
 344+ 'donate_interface-country-dropdown-JP' => '日本',
 345+);
 346+
 347+/** Norwegian (Nynorsk) (Norsk (nynorsk)) */
 348+$messages['nn'] = array(
 349+ 'donate_interface-country-dropdown-NO' => 'Noreg',
 350+);
 351+
 352+/** Norwegian (Bokmål) (Norsk (bokmål)) */
 353+$messages['no'] = array(
 354+ 'donate_interface-country-dropdown-NO' => 'Norge',
 355+);
 356+
 357+/** Dutch (Nederlands) */
 358+$messages['nl'] = array(
 359+ 'donate_interface-country-dropdown-BE' => 'België',
 360+ 'donate_interface-country-dropdown-NL' => 'Nederland',
 361+);
 362+
 363+/** Polish (Polski) */
 364+$messages['pl'] = array(
 365+ 'donate_interface-country-dropdown-PL' => 'Polska',
 366+);
 367+
 368+/** Portuguese (Português) */
 369+$messages['pt'] = array(
 370+ 'donate_interface-country-dropdown-BR' => 'Brasil',
 371+);
 372+
 373+/** Brazilian Portuguese (Português do Brasil) */
 374+$messages['pt-br'] = array(
 375+ 'donate_interface-country-dropdown-BR' => 'Brasil',
 376+);
 377+
 378+/** Romanian (Română) */
 379+$messages['ro'] = array(
 380+ 'donate_interface-country-dropdown-RO' => 'România',
 381+);
 382+
 383+/** Russian (Русский) */
 384+$messages['ru'] = array(
 385+ 'donate_interface-country-dropdown-BY' => 'Белоруссия',
 386+ 'donate_interface-country-dropdown-IL' => 'Израиль',
 387+ 'donate_interface-country-dropdown-RU' => 'Россия',
 388+);
 389+
 390+/** Slovak (Slovenčina) */
 391+$messages['sk'] = array(
 392+ 'donate_interface-country-dropdown-SK' => 'Slovensko',
 393+);
 394+
 395+/** Swedish (Svenska) */
 396+$messages['sv'] = array(
 397+ 'donate_interface-country-dropdown-FI' => 'Finland',
 398+ 'donate_interface-country-dropdown-SE' => 'Sverige',
 399+);
 400+
 401+/** Turkish (Türkçe) */
 402+$messages['tr'] = array(
 403+ 'donate_interface-country-dropdown-TR' => 'Türkiye',
 404+);
 405+
 406+/** Chinese (Hant) */
 407+$messages['zh-hant'] = array(
 408+ 'donate_interface-country-dropdown-HK' => '香港',
 409+ 'donate_interface-country-dropdown-TW' => '台灣',
 410+);
 411+
 412+
 413+
 414+
 415+
 416+
 417+
 418+
 419+
 420+
 421+
Property changes on: branches/fundraising/deployment/payments_1.17/extensions/DonationInterface/gateway_common/countries.i18n.php
___________________________________________________________________
Added: svn:mergeinfo
279422 Merged /trunk/extensions/DonationInterface/gateway_common/countries.i18n.php:r75657-77440,77442-79147,79149-79286,79288-79296,79298-79299,79301-79303,79305-86440,90286,92825,96120-96121,96125,97945-99042,99045-99408,99503,99555,99568,99570-101026,101056,101060,101063-101064,101071-101074,101076,101099,101109,101112,101163,101180,101192,101200,101205,101207,101217,101230,101232,101236,101335,101382,101399,101441,101501-101504,101512,101541,101547,101549,101553-101555,101557,101559,101561,101563,101576,101578-101579,101631,101633,101638,101669,101676,101679,101689,101700,101706,101719,101740,101747,101757,101764,101778-101779,101781,101785-101789,101798,101823,101826,101837,101846,101852,101870-101872,101878,101882,101890,101892,101910,101917,101929,101947,101949-101951,101955-101960,101962,101964-101966,101996,102003,102011-102012,102030,102032-102033,102047,102050-102052,102054,102056,102058,102065,102076,102081,102085-102087,102118,102120,102123-102127,102130,102134,102140,102147,102151-102152,102155-102156,102186,102188-102242,102252,102258-102261,102263,102267,102269,102307-102309,102313,102318,102332,102338,102341-102342,102345,102364,102419,102424-102425,102445,102463,102467-102468,102470,102476,102479-102480,102549-102550,102576-102581,102590,102594,102596,102611,102639,102664,102681-102682,102685,102689,102698,102700-102703,102707,102711-102712,102714,102729,102733,102736,102740,102752,102763,102805,102807,102809-102810,102812,102819-102824,102826,102828-102833,102835-102836,102841,102872,102878,102915,102921-102923,102926-102928,102932,102936,102938,102942-102943,102946,102953,102960-102961,103009,103023-103024,103026-103027,103032,103036-103038,103040,103044,103050,103058,103067,103077,103080,103130,103219,103223,103229,103235,103237-103239,103243-103247,103253,103255,103259,103261-103262,103264,103275,103278,103284,103289-103291,103325,103371,103397,103399,103401,103411,103413,103421,103434-103435,103481,103500,103503,103515,103519,103537,103541,103548,103591,103607-103608,103633,103680,103775,103784,103837,103839,103863,103866,104065,104194,104210,104224,104243,104298,104362,104485,104587,104611
280423 Merged /branches/fundraising/deployment/payments_1.17/extensions/DonationInterface/gateway_common/countries.i18n.php:r99568
Index: branches/fundraising/deployment/payments_1.17/extensions/DonationInterface/gateway_common/interface.i18n.php
@@ -408,7 +408,8 @@
409409 'donate_interface-securelogo-title' => 'Click to Verify - This site chose VeriSign SSL for secure e-commerce and confidential communications.',
410410 'donate_interface-secureLogo-text' => 'About SSL Certificates',
411411
412 -
 412+ // HTTP errors
 413+ 'donate_interface-error-http-403' => 'You do not have permission to access this page.',
413414 );
414415
415416 /** Message documentation (Message documentation)
Property changes on: branches/fundraising/deployment/payments_1.17/extensions/DonationInterface/gateway_common/interface.i18n.php
___________________________________________________________________
Modified: svn:mergeinfo
416417 Merged /trunk/extensions/DonationInterface/gateway_common/interface.i18n.php:r104718
Index: branches/fundraising/deployment/payments_1.17/extensions/DonationInterface/gateway_common/gateway.adapter.php
@@ -1380,18 +1380,41 @@
13811381 }
13821382 }
13831383
1384 - function findCodeAction( $transaction, $key, $code ) {
 1384+ /**
 1385+ * findCodeAction
 1386+ *
 1387+ * @param string $transaction
 1388+ * @param string $key The key to lookup in the transaction such as STATUSID
 1389+ * @param integer|string $code This gets converted to an integer if the values is numeric.
 1390+ *
 1391+ * @return null|string Returns the code action if a valid code is supplied. Otherwise, the return is null.
 1392+ */
 1393+ public function findCodeAction( $transaction, $key, $code ) {
 1394+
13851395 $this->getStopwatch( __FUNCTION__, true );
1386 - if ( !array_key_exists( $transaction, $this->return_value_map ) || !array_key_exists( $key, $this->return_value_map[$transaction] ) ) {
 1396+
 1397+ // Do not allow anything that is not numeric
 1398+ if ( !is_numeric( $code ) ) {
13871399 return null;
13881400 }
1389 - if ( !is_array( $this->return_value_map[$transaction][$key] ) ) {
 1401+
 1402+ // Cast the code as an integer
 1403+ settype( $code, 'integer');
 1404+
 1405+ // Check to see if the transaction is defined
 1406+ if ( !array_key_exists( $transaction, $this->return_value_map ) ) {
13901407 return null;
13911408 }
 1409+
 1410+ // Verify the key exists within the transaction
 1411+ if ( !array_key_exists( $key, $this->return_value_map[ $transaction ] ) || !is_array( $this->return_value_map[ $transaction ][ $key ] ) ) {
 1412+ return null;
 1413+ }
 1414+
13921415 //sort the array so we can do this quickly.
1393 - ksort( $this->return_value_map[$transaction][$key], SORT_NUMERIC );
 1416+ ksort( $this->return_value_map[ $transaction ][ $key ], SORT_NUMERIC );
13941417
1395 - $ranges = $this->return_value_map[$transaction][$key];
 1418+ $ranges = $this->return_value_map[ $transaction ][ $key ];
13961419 //so, you have a code, which is a number. You also have a numerically sorted array.
13971420 //loop through until you find an upper >= your code.
13981421 //make sure it's in the range, and return the action.
Property changes on: branches/fundraising/deployment/payments_1.17/extensions/DonationInterface/gateway_common/gateway.adapter.php
___________________________________________________________________
Modified: svn:mergeinfo
13991422 Merged /trunk/extensions/DonationInterface/gateway_common/gateway.adapter.php:r103970

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r103970Converting $code to an integer if it is numeric in findCodeAction().jpostlethwaite22:48, 22 November 2011
r104071prettifying the bt tablekaldari19:37, 23 November 2011
r104224Adding names of countries for countries where languages are official to Donat...jhsoby07:57, 25 November 2011
r104717followup r104707...khorn19:00, 30 November 2011
r104718Followup r102819, adding http 403 error text to i18nawjrichards19:13, 30 November 2011

Status & tagging log