https://www.mediawiki.org/wiki/Special:Code/MediaWiki/102994
Revision: 102994 Author: awjrichards Date: 2011-11-14 17:19:17 +0000 (Mon, 14 Nov 2011) Log Message: ----------- MFT r102836 Modified Paths: -------------- branches/fundraising/deployment/payments_1.17/extensions/DonationInterface/gateway_common/DonationData.php branches/fundraising/deployment/payments_1.17/extensions/DonationInterface/gateway_common/gateway.adapter.php branches/fundraising/deployment/payments_1.17/extensions/DonationInterface/globalcollect_gateway/globalcollect_gateway.body.php branches/fundraising/deployment/payments_1.17/extensions/DonationInterface/globalcollect_gateway/globalcollect_resultswitcher.body.php branches/fundraising/deployment/payments_1.17/extensions/DonationInterface/payflowpro_gateway/payflowpro_gateway.body.php Property Changed: ---------------- branches/fundraising/deployment/payments_1.17/extensions/DonationInterface/ branches/fundraising/deployment/payments_1.17/extensions/DonationInterface/gateway_common/DonationData.php branches/fundraising/deployment/payments_1.17/extensions/DonationInterface/payflowpro_gateway/ Property changes on: branches/fundraising/deployment/payments_1.17/extensions/DonationInterface ___________________________________________________________________ Modified: svn:mergeinfo - /branches/fundraising/deployment/payments_1.17/extensions/DonationInterface:99568 /trunk/extensions/DonationInterface:75657-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,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,102689,102698,102700-102703,102707,102711-102712,102714,102729,102733,102736,102740,102752,102763,102805,102809,102812,102819-102824,102826,102830-102831,102833,102835,102841,102872,102878,102915,102921-102923,102926-102928,102932,102936,102938 + /branches/fundraising/deployment/payments_1.17/extensions/DonationInterface:99568 /trunk/extensions/DonationInterface:75657-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,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,102689,102698,102700-102703,102707,102711-102712,102714,102729,102733,102736,102740,102752,102763,102805,102809,102812,102819-102824,102826,102830-102831,102833,102835-102836,102841,102872,102878,102915,102921-102923,102926-102928,102932,102936,102938 Modified: branches/fundraising/deployment/payments_1.17/extensions/DonationInterface/gateway_common/DonationData.php =================================================================== --- branches/fundraising/deployment/payments_1.17/extensions/DonationInterface/gateway_common/DonationData.php 2011-11-14 17:18:26 UTC (rev 102993) +++ branches/fundraising/deployment/payments_1.17/extensions/DonationInterface/gateway_common/DonationData.php 2011-11-14 17:19:17 UTC (rev 102994) @@ -357,11 +357,16 @@ } } - + /** + * Tells us if we think we're in caching mode or not. + * @staticvar string $cache Keeps track of the mode so we don't have to + * calculate it from the data fields more than once. + * @return boolean true if we are going to be caching, false if we aren't. + */ function isCaching(){ - //I think it's safe to static this here. I don't want to calc this every - //time some outside object asks if we're caching. + static $cache = null; + if ( is_null( $cache ) ){ if ( $this->getVal( '_cache_' ) === 'true' ){ //::head. hit. keyboard.:: if ( $this->isSomething( 'utm_source_id' ) && !is_null( 'utm_source_id' ) ){ @@ -372,6 +377,13 @@ $cache = false; } } + + //this business could change at any second, and it will prevent us from + //caching, so we're going to keep asking if it's set. + if (self::sessionExists()){ + $cache = false; + } + return $cache; } @@ -654,6 +666,13 @@ static $match = null; if ( $match === null ) { + if ( $this->isCaching() ){ + //This makes sense. + //If all three conditions for caching are currently true, the + //last thing we want to do is screw it up by setting a session + //token before the page loads. + return true; + } // establish the edit token to prevent csrf $token = $this->token_getSaltedSessionToken(); Property changes on: branches/fundraising/deployment/payments_1.17/extensions/DonationInterface/gateway_common/DonationData.php ___________________________________________________________________ Modified: svn:mergeinfo - /branches/fundraising/deployment/payments_1.17/extensions/DonationInterface/gateway_common/DonationData.php:99568 /trunk/extensions/DonationInterface/gateway_common/DonationData.php:75657-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,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,102081,102085-102087,102118,102120,102124-102125,102127,102134,102140,102147,102151-102152,102155-102156,102186,102188-102241,102309,102318,102332,102341-102342,102345,102419,102424-102425,102445,102463,102467-102468,102470,102476,102479-102480,102549-102550,102576-102581,102590,102594,102611,102639,102664,102689,102698,102700-102703,102707,102711-102712,102729,102736,102752,102763,102805,102809,102812,102819-102824,102826,102830-102831,102833,102835,102841,102872 + /branches/fundraising/deployment/payments_1.17/extensions/DonationInterface/gateway_common/DonationData.php:99568 /trunk/extensions/DonationInterface/gateway_common/DonationData.php:75657-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,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,102081,102085-102087,102118,102120,102124-102125,102127,102134,102140,102147,102151-102152,102155-102156,102186,102188-102241,102309,102318,102332,102341-102342,102345,102419,102424-102425,102445,102463,102467-102468,102470,102476,102479-102480,102549-102550,102576-102581,102590,102594,102611,102639,102664,102689,102698,102700-102703,102707,102711-102712,102729,102736,102752,102763,102805,102809,102812,102819-102824,102826,102830-102831,102833,102835-102836,102841,102872 Modified: branches/fundraising/deployment/payments_1.17/extensions/DonationInterface/gateway_common/gateway.adapter.php =================================================================== --- branches/fundraising/deployment/payments_1.17/extensions/DonationInterface/gateway_common/gateway.adapter.php 2011-11-14 17:18:26 UTC (rev 102993) +++ branches/fundraising/deployment/payments_1.17/extensions/DonationInterface/gateway_common/gateway.adapter.php 2011-11-14 17:19:17 UTC (rev 102994) @@ -306,24 +306,20 @@ * @return boolean true if match, else false. */ public function checkTokens() { - if ( !$this->posted ) { - //we don't care, because we can't possibly have a good one at this - //point. - //Additional: If we try for this before we're posted, the squid log - //caching won't work. - return true; - } else { - $checkResult = $this->dataObj->token_checkTokens(); + $checkResult = $this->dataObj->token_checkTokens(); - if ( $checkResult ) { - $this->debugarray[] = 'Token Match'; + if ( $checkResult ) { + if ($this->dataObj->isCaching()){ + $this->debugarray[] = 'Token Not Checked (Caching Enabled)'; } else { - $this->debugarray[] = 'Token MISMATCH'; + $this->debugarray[] = 'Token Match'; } - - $this->refreshGatewayValueFromSource( 'token' ); - return $checkResult; + } else { + $this->debugarray[] = 'Token MISMATCH'; } + + $this->refreshGatewayValueFromSource( 'token' ); + return $checkResult; } /** Modified: branches/fundraising/deployment/payments_1.17/extensions/DonationInterface/globalcollect_gateway/globalcollect_gateway.body.php =================================================================== --- branches/fundraising/deployment/payments_1.17/extensions/DonationInterface/globalcollect_gateway/globalcollect_gateway.body.php 2011-11-14 17:18:26 UTC (rev 102993) +++ branches/fundraising/deployment/payments_1.17/extensions/DonationInterface/globalcollect_gateway/globalcollect_gateway.body.php 2011-11-14 17:19:17 UTC (rev 102994) @@ -178,11 +178,8 @@ $this->displayForm( $this->errors ); } - } else { - if ( !$this->adapter->isCaching() ) { - // if we're not caching, there's a token mismatch - $this->errors['general']['token-mismatch'] = wfMsg( 'donate_interface-token-mismatch' ); - } + } else { //token mismatch + $this->errors['general']['token-mismatch'] = wfMsg( 'donate_interface-token-mismatch' ); $this->displayForm( $this->errors ); } } Modified: branches/fundraising/deployment/payments_1.17/extensions/DonationInterface/globalcollect_gateway/globalcollect_resultswitcher.body.php =================================================================== --- branches/fundraising/deployment/payments_1.17/extensions/DonationInterface/globalcollect_gateway/globalcollect_resultswitcher.body.php 2011-11-14 17:18:26 UTC (rev 102993) +++ branches/fundraising/deployment/payments_1.17/extensions/DonationInterface/globalcollect_gateway/globalcollect_resultswitcher.body.php 2011-11-14 17:19:17 UTC (rev 102994) @@ -59,9 +59,6 @@ return; } - - - $wgOut->addExtensionStyle( $wgExtensionAssetsPath . '/DonationInterface/gateway_forms/css/gateway.css?284' . $this->adapter->getGlobal( 'CSSVersion' ) ); @@ -104,12 +101,7 @@ } //TODO: There really should be an else here. } } - } else { - if ( !$this->adapter->isCaching() ) { - // if we're not caching, there's a token mismatch - $this->errors['general']['token-mismatch'] = wfMsg( 'donate_interface-token-mismatch' ); - } - } + } } /** Property changes on: branches/fundraising/deployment/payments_1.17/extensions/DonationInterface/payflowpro_gateway ___________________________________________________________________ Modified: svn:mergeinfo - /branches/fundraising/deployment/payments_1.17/extensions/DonationInterface/payflowpro_gateway:99568 /trunk/extensions/DonationInterface/payflowpro_gateway:75657-77440,77442-79147,79149-79286,79288-79296,79298-79299,79301-79303,79305-86440,90286,92825,96120-96121,96125,96127-97926,97945-99042,99045-99408,99503,99555,99568,99570-101026,101060,101063-101064,101073,101076,101109,101180,101207,101335,101441,101502,101553,101557,101561,101576,101676,101679,101757,101785-101786,101823,101826,101837,101852,101870-101872,101882,101890,101910,101929,101947,101949-101951,101955-101960,101962,101964-101966,101996,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,102258-102259,102267,102269,102307,102313,102318,102332,102341-102342,102345,102424-102425,102445,102463,102467-102468,102470,102476,102479-102480,102549-102550,102576-102581,102590,102594,102611,102639,102664,102689,102698,102700-102703,102707,102711-102712,102729,102736,102752,102763,102805,102809,102812,102819-102824,102826,102830-102831,102833,102835,102841,102872,102936,102938 + /branches/fundraising/deployment/payments_1.17/extensions/DonationInterface/payflowpro_gateway:99568 /trunk/extensions/DonationInterface/payflowpro_gateway:75657-77440,77442-79147,79149-79286,79288-79296,79298-79299,79301-79303,79305-86440,90286,92825,96120-96121,96125,96127-97926,97945-99042,99045-99408,99503,99555,99568,99570-101026,101060,101063-101064,101073,101076,101109,101180,101207,101335,101441,101502,101553,101557,101561,101576,101676,101679,101757,101785-101786,101823,101826,101837,101852,101870-101872,101882,101890,101910,101929,101947,101949-101951,101955-101960,101962,101964-101966,101996,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,102258-102259,102267,102269,102307,102313,102318,102332,102341-102342,102345,102424-102425,102445,102463,102467-102468,102470,102476,102479-102480,102549-102550,102576-102581,102590,102594,102611,102639,102664,102689,102698,102700-102703,102707,102711-102712,102729,102736,102752,102763,102805,102809,102812,102819-102824,102826,102830-102831,102833,102835-102836,102841,102872,102936,102938 Modified: branches/fundraising/deployment/payments_1.17/extensions/DonationInterface/payflowpro_gateway/payflowpro_gateway.body.php =================================================================== --- branches/fundraising/deployment/payments_1.17/extensions/DonationInterface/payflowpro_gateway/payflowpro_gateway.body.php 2011-11-14 17:18:26 UTC (rev 102993) +++ branches/fundraising/deployment/payments_1.17/extensions/DonationInterface/payflowpro_gateway/payflowpro_gateway.body.php 2011-11-14 17:19:17 UTC (rev 102994) @@ -64,11 +64,8 @@ // Display form for the first time $this->displayForm( $this->errors ); } - } else { - if ( !$this->adapter->isCaching() ) { - // if we're not caching, there's a token mismatch - $this->errors['general']['token-mismatch'] = wfMsg( 'donate_interface-token-mismatch' ); - } + } else {//token mismatch + $this->errors['general']['token-mismatch'] = wfMsg( 'donate_interface-token-mismatch' ); $this->displayForm( $this->errors ); } } _______________________________________________ MediaWiki-CVS mailing list MediaWiki-CVS@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs