r105072 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r105071‎ | r105072 | r105073 >
Date:18:46, 3 December 2011
Author:khorn
Status:deferred
Tags:
Comment:
Modified paths:
  • /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
@@ -37,24 +37,46 @@
3838 */
3939 public function execute( $par ) {
4040 global $wgRequest, $wgOut, $wgExtensionAssetsPath;
41 -
 41+
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.
4545 $forbidden = false;
46 - if ( !isset($_GET['order_id']) || !$this->adapter->hasDonorDataInSession( 'order_id', $_GET['order_id'] ) ){
47 - wfHttpError( 403, 'Forbidden', wfMsg( 'donate_interface-error-http-403' ) );
 46+ $qs_oid = 'undefined';
 47+ if ( !isset( $_GET['order_id'] ) ){
4848 $forbidden = true;
 49+ $f_message = 'No order ID in the Querystring.';
 50+ } else {
 51+ $qs_oid = $_GET['order_id'];
 52+ if ( !$this->adapter->hasDonorDataInSession( 'order_id', $_GET['order_id'] ) ){
 53+ $forbidden = true;
 54+ $f_message = 'Requested order id not present in the session';
 55+ }
4956 }
 57+
 58+ if ( $forbidden ){
 59+ wfHttpError( 403, 'Forbidden', wfMsg( 'donate_interface-error-http-403' ) );
 60+ }
5061
5162 $referrer = $wgRequest->getHeader( 'referer' );
 63+ $liberated = false;
 64+ if ( array_key_exists( 'order_status', $_SESSION ) && array_key_exists( $qs_oid, $_SESSION['order_status'] ) ){
 65+ $liberated = true;
 66+ }
5267
5368 global $wgServer;
5469 //TODO: Whitelist! We only want to do this for servers we are configured to like!
5570 //I didn't do this already, because this may turn out to be backwards anyway. It might be good to do the work in the iframe,
5671 //and then pop out. Maybe. We're probably going to have to test it a couple different ways, for user experience.
5772 //However, we're _definitely_ going to need to pop out _before_ we redirect to the thank you or fail pages.
58 - if ( strpos( $referrer, $wgServer ) === false ) {
 73+ if ( ( strpos( $referrer, $wgServer ) === false ) && !$liberated ) {
 74+ $_SESSION['order_status'][$qs_oid] = 'liberated';
 75+ $this->adapter->log("Resultswitcher: Popping out of iframe for Order ID " . $qs_oid);
 76+ //TODO: Move the $forbidden check back to the beginning of this if block, once we know this doesn't happen a lot.
 77+ //TODO: If we get a lot of these messages, we need to redirect to something more friendly than FORBIDDEN, RAR RAR RAR.
 78+ if ( $forbidden ) {
 79+ $this->adapter->log("Resultswitcher: " . $qs_oid . "SHOULD BE FORBIDDEN. Reason: $f_message");
 80+ }
5981 $wgOut->allowClickjacking();
6082 $wgOut->addModules( 'iframe.liberator' );
6183 return;
@@ -67,23 +89,12 @@
6890 $this->setHeaders();
6991
7092 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");
 93+ $this->adapter->log( "Resultswitcher: Request forbidden. " . $f_message . " Querystring Order ID: $qs_oid Adapter Order ID: " . $this->adapter->getData_Raw( 'order_id' ) );
8494 return;
 95+ } else {
 96+ $this->adapter->log( "Resultswitcher: OK to process Order ID: " . $qs_oid );
8597 }
8698
87 -
8899 // dispatch forms/handling
89100 if ( $this->adapter->checkTokens() ) {
90101 // Display form for the first time
@@ -91,7 +102,7 @@
92103
93104 //this next block is for credit card coming back from GC. Only that. Nothing else, ever.
94105 if ( $this->adapter->getData_Raw( 'payment_method') === 'cc' ) {
95 - if ( !array_key_exists( 'order_status', $_SESSION ) || !array_key_exists( $oid, $_SESSION['order_status'] ) ) {
 106+ if ( !array_key_exists( 'order_status', $_SESSION ) || !array_key_exists( $oid, $_SESSION['order_status'] ) || !is_array( $_SESSION['order_status'][$oid] ) ) {
96107 $_SESSION['order_status'][$oid] = $this->adapter->do_transaction( 'Confirm_CreditCard' );
97108 $_SESSION['order_status'][$oid]['data']['count'] = 0;
98109 } else {
Property changes on: branches/fundraising/deployment/payments_1.17/extensions/DonationInterface/globalcollect_gateway/globalcollect_resultswitcher.body.php
___________________________________________________________________
Modified: svn:mergeinfo
99110 Merged /trunk/extensions/DonationInterface/globalcollect_gateway/globalcollect_resultswitcher.body.php:r104932,105032

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r104932followup r104717...khorn00:49, 2 December 2011
r105032Yet another stab at the whitescreen mystery. Adds more logging, and a check t...khorn00:43, 3 December 2011

Status & tagging log