/htdocs/paypal/lib/paypalfunctions.lib.php

https://bitbucket.org/speedealing/speedealing · PHP · 79 lines · 37 code · 8 blank · 34 comment · 9 complexity · aba22686038e477354f27728798e78ad MD5 · raw file

  1. <?php
  2. /* Copyright (C) 2010-2011 Laurent Destailleur <eldy@users.sourceforge.org>
  3. * Copyright (C) 2011 Regis Houssin <regis.houssin@capnetworks.com>
  4. *
  5. * This program is free software; you can redistribute it and/or modify
  6. * it under the terms of the GNU General Public License as published by
  7. * the Free Software Foundation; either version 3 of the License, or
  8. * (at your option) any later version.
  9. *
  10. * This program is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU General Public License
  16. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  17. */
  18. /**
  19. * \file htdocs/paypal/lib/paypalfunctions.lib.php
  20. * \ingroup paypal
  21. * \brief Page with Paypal init var.
  22. */
  23. if (session_id() == "")
  24. {
  25. session_start();
  26. if (ini_get('register_globals')) // To solve bug in using $_SESSION
  27. {
  28. foreach ($_SESSION as $key=>$value)
  29. {
  30. if (isset($GLOBALS[$key])) unset($GLOBALS[$key]);
  31. }
  32. }
  33. }
  34. // ==================================
  35. // PayPal Express Checkout Module
  36. // ==================================
  37. $API_version="56";
  38. /*
  39. ' Define the PayPal Redirect URLs.
  40. ' This is the URL that the buyer is first sent to do authorize payment with their paypal account
  41. ' change the URL depending if you are testing on the sandbox or the live PayPal site
  42. '
  43. ' For the sandbox, the URL is https://www.sandbox.paypal.com/webscr&cmd=_express-checkout&token=
  44. ' For the live site, the URL is https://www.paypal.com/webscr&cmd=_express-checkout&token=
  45. */
  46. if (! empty($conf->global->PAYPAL_API_SANDBOX))
  47. {
  48. $API_Endpoint = "https://api-3t.sandbox.paypal.com/nvp";
  49. $API_Url = "https://www.sandbox.paypal.com/webscr?cmd=_express-checkout&token=";
  50. }
  51. else
  52. {
  53. $API_Endpoint = "https://api-3t.paypal.com/nvp";
  54. $API_Url = "https://www.paypal.com/cgi-bin/webscr?cmd=_express-checkout&token=";
  55. }
  56. // Clean parameters
  57. $PAYPAL_API_USER="";
  58. if (! empty($conf->global->PAYPAL_API_USER)) $PAYPAL_API_USER=$conf->global->PAYPAL_API_USER;
  59. $PAYPAL_API_PASSWORD="";
  60. if (! empty($conf->global->PAYPAL_API_PASSWORD)) $PAYPAL_API_PASSWORD=$conf->global->PAYPAL_API_PASSWORD;
  61. $PAYPAL_API_SIGNATURE="";
  62. if (! empty($conf->global->PAYPAL_API_SIGNATURE)) $PAYPAL_API_SIGNATURE=$conf->global->PAYPAL_API_SIGNATURE;
  63. $PAYPAL_API_SANDBOX="";
  64. if (! empty($conf->global->PAYPAL_API_SANDBOX)) $PAYPAL_API_SANDBOX=$conf->global->PAYPAL_API_SANDBOX;
  65. // Proxy
  66. $PROXY_HOST = $conf->global->MAIN_PROXY_HOST;
  67. $PROXY_PORT = $conf->global->MAIN_PROXY_PORT;
  68. $PROXY_USER = $conf->global->MAIN_PROXY_USER;
  69. $PROXY_PASS = $conf->global->MAIN_PROXY_PASS;
  70. $USE_PROXY = empty($conf->global->MAIN_PROXY_USE)?false:true;
  71. ?>