blob: 515d2de61d0e71d734545fca771e0e18439921f6 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
|
<?php
/**
* This is just a wrapper/router for OneClick.class.php
*/
// Fire up CiviCRM
require_once '../civicrm.config.php';
require_once 'CRM/Core/Config.php';
$config =& CRM_Core_Config::singleton();
// Only allow this to run one at a time to avoid overlap of database operations
// if IPN come in at nearly the same time. This is mostly here because of
// PayPal recurring contributions and the fact that subscr_payment and
// subscr_signup IPN come in at virtually the same time.
require_once 'CRM/Core/Lock.php';
while ( ! $lock = new CRM_Core_Lock('OneClick') ) {
// Sleep for 1 second, then try again.
sleep(1);
}
require 'OneClick.class.php';
$oc = new OneClick($_REQUEST);
// What are we doing?
switch ( $_REQUEST['oc_action'] ) {
case 'donate':
if ( isset($_REQUEST['premium']) && ! isset($_REQUEST['size']) ) {
// Javascript should prevent this, but as a failsafe send them back
// if for some reason there is a premium set yet no shirt size.
$err_msg = "You must select a shirt size.";
$err_msg = urlencode($err_msg);
header("Location: {$oc->_cancel_return}?{$_SERVER['QUERY_STRING']}&error=$err_msg");
} else {
$oc->oc_donate();
}
break;
case 'paypalipn':
$oc->oc_ipn('paypal');
break;
case 'googleipn':
$oc->oc_ipn('google');
break;
default:
$err_msg = "Unknown oc_action.";
$err_msg = urlencode($err_msg);
header("Location: {$oc->_cancel_return}?{$_SERVER['QUERY_STRING']}&error=$err_msg");
}
$lock->release();
?>
|