1 | <?php |
||
2 | /* |
||
3 | * ipn.php |
||
4 | * |
||
5 | * PHP Toolkit for PayPal v0.51 |
||
6 | * http://www.paypal.com/pdn |
||
7 | * |
||
8 | * Copyright (c) 2004 PayPal Inc |
||
9 | * |
||
10 | * Released under Common Public License 1.0 |
||
11 | * http://opensource.org/licenses/cpl.php |
||
12 | * |
||
13 | */ |
||
14 | include __DIR__ . '/header.php'; |
||
15 | require_once XOOPS_ROOT_PATH . '/class/module.errorhandler.php'; |
||
16 | $myts = MyTextSanitizer::getInstance();// MyTextSanitizer object |
||
17 | |||
18 | require_once __DIR__ . '/class/class.subscription.php'; |
||
19 | |||
20 | $eh = new ErrorHandler; |
||
21 | //get global configuration information |
||
22 | require_once __DIR__ . '/paypal_includes/global_config.inc.php'; |
||
23 | |||
24 | //get pay pal configuration file |
||
25 | require_once __DIR__ . '/paypal_includes/config.inc.php'; |
||
26 | |||
27 | //decide which post method to use |
||
28 | View Code Duplication | switch ($paypal['post_method']) { |
|
0 ignored issues
–
show
|
|||
29 | |||
30 | case 'libCurl': //php compiled with libCurl support |
||
31 | |||
32 | $result = libCurlPost($paypal['url'], $_POST); |
||
33 | |||
34 | break; |
||
35 | |||
36 | case 'curl': //cURL via command line |
||
37 | |||
38 | $result = curlPost($paypal['url'], $_POST); |
||
39 | //print_r($result); |
||
40 | break; |
||
41 | |||
42 | case 'fso': //php fsockopen(); |
||
43 | |||
44 | $result = fsockPost($paypal['url'], $_POST); |
||
45 | //print_r($result); |
||
46 | break; |
||
47 | |||
48 | default: //use the fsockopen method as default post method |
||
49 | |||
50 | $result = fsockPost($paypal['url'], $_POST); |
||
51 | //print_r($result); |
||
52 | break; |
||
53 | |||
54 | } |
||
55 | |||
56 | //check the ipn result received back from paypal |
||
57 | |||
58 | if (eregi('VERIFIED', $result)) { |
||
59 | // Automatic update of the subscription is not yet included in the success page. |
||
60 | // This will need to be done manually. |
||
61 | require_once __DIR__ . '/ipn/ipn_success.php'; |
||
62 | } else { |
||
63 | require_once __DIR__ . '/ipn/ipn_error.php'; |
||
64 | } |
||
65 |
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.
You can also find more detailed suggestions in the “Code” section of your repository.