mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-12-07 18:18:18 +01:00
53 lines
2.4 KiB
PHP
53 lines
2.4 KiB
PHP
<?php
|
|
/* Copyright (C) 2001-2002 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
|
* Copyright (C) 2006-2017 Laurent Destailleur <eldy@users.sourceforge.net>
|
|
* Copyright (C) 2009-2012 Regis Houssin <regis.houssin@capnetworks.com>
|
|
*
|
|
* This program is free software; you can redistribute it and/or modify
|
|
* it under the terms of the GNU General Public License as published by
|
|
* the Free Software Foundation; either version 3 of the License, or
|
|
* (at your option) any later version.
|
|
*
|
|
* This program is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
* GNU General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU General Public License
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
*
|
|
* For paypal test: https://developer.paypal.com/
|
|
* For paybox test: ???
|
|
*/
|
|
|
|
/**
|
|
* \file htdocs/public/paypal/newpayment.php
|
|
* \ingroup paypal
|
|
* \brief File to offer a way to make a payment for a particular Dolibarr entity
|
|
*/
|
|
|
|
define("NOLOGIN",1); // This means this output page does not require to be logged.
|
|
define("NOCSRFCHECK",1); // We accept to go on this page from external web site.
|
|
|
|
// For MultiCompany module.
|
|
// Do not use GETPOST here, function is not defined and define must be done before including main.inc.php
|
|
// TODO This should be useless. Because entity must be retreive from object ref and not from url.
|
|
$entity=(! empty($_GET['entity']) ? (int) $_GET['entity'] : (! empty($_POST['entity']) ? (int) $_POST['entity'] : 1));
|
|
if (is_numeric($entity)) define("DOLENTITY", $entity);
|
|
|
|
require '../../main.inc.php';
|
|
require_once DOL_DOCUMENT_ROOT.'/paypal/lib/paypal.lib.php';
|
|
require_once DOL_DOCUMENT_ROOT.'/paypal/lib/paypalfunctions.lib.php';
|
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/company.lib.php';
|
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/payments.lib.php';
|
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
|
|
require_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php';
|
|
|
|
// Security check
|
|
if (empty($conf->paypal->enabled)) accessforbidden('',0,0,1);
|
|
|
|
$newurl = $_SERVER['REQUEST_URI'];
|
|
$newurl = preg_replace('/\/paypal\/newpayment/', '/payment/newpayment', $newurl);
|
|
header("Location: ".$newurl.(preg_match('/\?/', $newurl)?'&':'?').'paymentmethod=paypal');
|
|
exit;
|