Merge pull request #32331 from frederic34/public_payment_phpstan
fix phpstan
This commit is contained in:
commit
baf926dbb2
7 changed files with 51 additions and 105 deletions
|
|
@ -28440,42 +28440,6 @@ parameters:
|
|||
count: 1
|
||||
path: ../../htdocs/public/payment/newpayment.php
|
||||
|
||||
-
|
||||
message: '#^Variable \$PAYPAL_API_KO might not be defined\.$#'
|
||||
identifier: variable.undefined
|
||||
count: 2
|
||||
path: ../../htdocs/public/payment/newpayment.php
|
||||
|
||||
-
|
||||
message: '#^Variable \$PAYPAL_API_OK might not be defined\.$#'
|
||||
identifier: variable.undefined
|
||||
count: 2
|
||||
path: ../../htdocs/public/payment/newpayment.php
|
||||
|
||||
-
|
||||
message: '#^Variable \$PAYPAL_API_PASSWORD might not be defined\.$#'
|
||||
identifier: variable.undefined
|
||||
count: 1
|
||||
path: ../../htdocs/public/payment/newpayment.php
|
||||
|
||||
-
|
||||
message: '#^Variable \$PAYPAL_API_SANDBOX might not be defined\.$#'
|
||||
identifier: variable.undefined
|
||||
count: 1
|
||||
path: ../../htdocs/public/payment/newpayment.php
|
||||
|
||||
-
|
||||
message: '#^Variable \$PAYPAL_API_SIGNATURE might not be defined\.$#'
|
||||
identifier: variable.undefined
|
||||
count: 1
|
||||
path: ../../htdocs/public/payment/newpayment.php
|
||||
|
||||
-
|
||||
message: '#^Variable \$PAYPAL_API_USER might not be defined\.$#'
|
||||
identifier: variable.undefined
|
||||
count: 1
|
||||
path: ../../htdocs/public/payment/newpayment.php
|
||||
|
||||
-
|
||||
message: '#^Variable \$attendee might not be defined\.$#'
|
||||
identifier: variable.undefined
|
||||
|
|
|
|||
|
|
@ -267,7 +267,7 @@ if (isModEnabled("bank")) {
|
|||
print '<tr class="oddeven"><td>';
|
||||
print $langs->trans("CSSUrlForPaymentForm").'</td><td>';
|
||||
print '<input size="64" type="text" name="ONLINE_PAYMENT_CSS_URL" value="'.getDolGlobalString('ONLINE_PAYMENT_CSS_URL').'">';
|
||||
print ' <span class="opacitymedium">'.$langs->trans("Example").': http://mysite/mycss.css</span>';
|
||||
print ' <span class="opacitymedium">'.$langs->trans("Example").': https://mysite/mycss.css</span>';
|
||||
print '</td></tr>';
|
||||
|
||||
|
||||
|
|
@ -374,17 +374,19 @@ print 'Your API authentication information can be found with following steps. We
|
|||
print '</div>';
|
||||
|
||||
if (!empty($conf->use_javascript_ajax)) {
|
||||
print "\n".'<script type="text/javascript">';
|
||||
print '$(document).ready(function () {
|
||||
$("#apidoc").hide();
|
||||
$("#apidoca").click(function() {
|
||||
console.log("We click on apidoca so we show/hide");
|
||||
$("#apidoc").show();
|
||||
$("#apidoca").hide();
|
||||
return false;
|
||||
})
|
||||
});';
|
||||
print '</script>';
|
||||
print '
|
||||
<script type="text/javascript">
|
||||
$(document).ready(function () {
|
||||
$("#apidoc").hide();
|
||||
$("#apidoca").click(function() {
|
||||
console.log("We click on apidoca so we show/hide");
|
||||
$("#apidoc").show();
|
||||
$("#apidoca").hide();
|
||||
return false;
|
||||
})
|
||||
});
|
||||
</script>
|
||||
';
|
||||
}
|
||||
|
||||
print '<br><br>';
|
||||
|
|
|
|||
|
|
@ -1,7 +1,8 @@
|
|||
<?php
|
||||
/* Copyright (C) 2008-2012 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2011-2012 Regis Houssin <regis.houssin@inodbox.com>
|
||||
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
|
||||
/* Copyright (C) 2008-2012 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2011-2012 Regis Houssin <regis.houssin@inodbox.com>
|
||||
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
|
||||
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
|
||||
*
|
||||
* 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
|
||||
|
|
@ -467,22 +468,10 @@ function hash_call($methodName, $nvpStr)
|
|||
}
|
||||
|
||||
// Clean parameters
|
||||
$PAYPAL_API_USER = "";
|
||||
if (getDolGlobalString('PAYPAL_API_USER')) {
|
||||
$PAYPAL_API_USER = getDolGlobalString('PAYPAL_API_USER');
|
||||
}
|
||||
$PAYPAL_API_PASSWORD = "";
|
||||
if (getDolGlobalString('PAYPAL_API_PASSWORD')) {
|
||||
$PAYPAL_API_PASSWORD = getDolGlobalString('PAYPAL_API_PASSWORD');
|
||||
}
|
||||
$PAYPAL_API_SIGNATURE = "";
|
||||
if (getDolGlobalString('PAYPAL_API_SIGNATURE')) {
|
||||
$PAYPAL_API_SIGNATURE = getDolGlobalString('PAYPAL_API_SIGNATURE');
|
||||
}
|
||||
$PAYPAL_API_SANDBOX = "";
|
||||
if (getDolGlobalString('PAYPAL_API_SANDBOX')) {
|
||||
$PAYPAL_API_SANDBOX = getDolGlobalString('PAYPAL_API_SANDBOX');
|
||||
}
|
||||
$PAYPAL_API_USER = getDolGlobalString('PAYPAL_API_USER');
|
||||
$PAYPAL_API_PASSWORD = getDolGlobalString('PAYPAL_API_PASSWORD');
|
||||
$PAYPAL_API_SIGNATURE = getDolGlobalString('PAYPAL_API_SIGNATURE');
|
||||
$PAYPAL_API_SANDBOX = getDolGlobalString('PAYPAL_API_SANDBOX');
|
||||
// TODO END problem with triggers
|
||||
|
||||
dol_syslog("Paypal API endpoint ".$API_Endpoint);
|
||||
|
|
@ -514,8 +503,8 @@ function hash_call($methodName, $nvpStr)
|
|||
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, ($ssl_verifypeer ? true : false));
|
||||
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, ($ssl_verifypeer ? true : false));
|
||||
|
||||
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, !getDolGlobalString('MAIN_USE_CONNECT_TIMEOUT') ? 5 : $conf->global->MAIN_USE_CONNECT_TIMEOUT);
|
||||
curl_setopt($ch, CURLOPT_TIMEOUT, !getDolGlobalString('MAIN_USE_RESPONSE_TIMEOUT') ? 30 : $conf->global->MAIN_USE_RESPONSE_TIMEOUT);
|
||||
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, getDolGlobalInt('MAIN_USE_CONNECT_TIMEOUT', 5));
|
||||
curl_setopt($ch, CURLOPT_TIMEOUT, getDolGlobalInt('MAIN_USE_RESPONSE_TIMEOUT', 30));
|
||||
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
|
||||
curl_setopt($ch, CURLOPT_POST, 1);
|
||||
|
|
|
|||
|
|
@ -1,7 +1,8 @@
|
|||
<?php
|
||||
/* Copyright (C) 2010-2011 Laurent Destailleur <eldy@users.sourceforge.org>
|
||||
* Copyright (C) 2011 Regis Houssin <regis.houssin@inodbox.com>
|
||||
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
|
||||
/* Copyright (C) 2010-2011 Laurent Destailleur <eldy@users.sourceforge.org>
|
||||
* Copyright (C) 2011 Regis Houssin <regis.houssin@inodbox.com>
|
||||
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
|
||||
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
|
||||
*
|
||||
* 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
|
||||
|
|
@ -57,22 +58,10 @@ if (getDolGlobalString('PAYPAL_API_SANDBOX') || GETPOST('forcesandbox', 'alpha')
|
|||
}
|
||||
|
||||
// Clean parameters
|
||||
$PAYPAL_API_USER = "";
|
||||
if (getDolGlobalString('PAYPAL_API_USER')) {
|
||||
$PAYPAL_API_USER = getDolGlobalString('PAYPAL_API_USER');
|
||||
}
|
||||
$PAYPAL_API_PASSWORD = "";
|
||||
if (getDolGlobalString('PAYPAL_API_PASSWORD')) {
|
||||
$PAYPAL_API_PASSWORD = getDolGlobalString('PAYPAL_API_PASSWORD');
|
||||
}
|
||||
$PAYPAL_API_SIGNATURE = "";
|
||||
if (getDolGlobalString('PAYPAL_API_SIGNATURE')) {
|
||||
$PAYPAL_API_SIGNATURE = getDolGlobalString('PAYPAL_API_SIGNATURE');
|
||||
}
|
||||
$PAYPAL_API_SANDBOX = "";
|
||||
if (getDolGlobalString('PAYPAL_API_SANDBOX')) {
|
||||
$PAYPAL_API_SANDBOX = getDolGlobalString('PAYPAL_API_SANDBOX');
|
||||
}
|
||||
$PAYPAL_API_USER = getDolGlobalString('PAYPAL_API_USER');
|
||||
$PAYPAL_API_PASSWORD = getDolGlobalString('PAYPAL_API_PASSWORD');
|
||||
$PAYPAL_API_SIGNATURE = getDolGlobalString('PAYPAL_API_SIGNATURE');
|
||||
$PAYPAL_API_SANDBOX = getDolGlobalString('PAYPAL_API_SANDBOX');
|
||||
|
||||
// Proxy
|
||||
$PROXY_HOST = getDolGlobalString('MAIN_PROXY_HOST');
|
||||
|
|
|
|||
|
|
@ -231,6 +231,12 @@ $ref = $REF = GETPOST('ref', 'alpha');
|
|||
$TAG = GETPOST("tag", 'alpha');
|
||||
$FULLTAG = GETPOST("fulltag", 'alpha'); // fulltag is tag with more information
|
||||
$SECUREKEY = GETPOST("securekey"); // Secure key
|
||||
$PAYPAL_API_OK = "";
|
||||
$PAYPAL_API_KO = "";
|
||||
$PAYPAL_API_SANDBOX = "";
|
||||
$PAYPAL_API_USER = "";
|
||||
$PAYPAL_API_PASSWORD = "";
|
||||
$PAYPAL_API_SIGNATURE = "";
|
||||
|
||||
if ($paymentmethod && !preg_match('/'.preg_quote('PM='.$paymentmethod, '/').'/', $FULLTAG)) {
|
||||
$FULLTAG .= ($FULLTAG ? '.' : '').'PM='.$paymentmethod;
|
||||
|
|
@ -286,6 +292,7 @@ $urlko = preg_replace('/&$/', '', $urlko); // Remove last &
|
|||
';
|
||||
|
||||
if ((empty($paymentmethod) || $paymentmethod == 'paypal') && isModEnabled('paypal')) {
|
||||
global $PAYPAL_API_SANDBOX, $PAYPAL_API_OK, $PAYPAL_API_KO, $PAYPAL_API_USER, $PAYPAL_API_PASSWORD, $PAYPAL_API_SIGNATURE;
|
||||
require_once DOL_DOCUMENT_ROOT.'/paypal/lib/paypal.lib.php';
|
||||
require_once DOL_DOCUMENT_ROOT.'/paypal/lib/paypalfunctions.lib.php';
|
||||
|
||||
|
|
|
|||
|
|
@ -71,7 +71,8 @@ if (isModEnabled('paypal')) {
|
|||
*/
|
||||
|
||||
$langs->loadLangs(array("main", "other", "dict", "bills", "companies", "paybox", "paypal", "stripe"));
|
||||
|
||||
$PAYPALTOKEN = "";
|
||||
$PAYPALPAYERID = "";
|
||||
if (isModEnabled('paypal')) {
|
||||
$PAYPALTOKEN = GETPOST('TOKEN');
|
||||
if (empty($PAYPALTOKEN)) {
|
||||
|
|
|
|||
|
|
@ -77,23 +77,17 @@ $hookmanager->initHooks(array('newpayment'));
|
|||
$langs->loadLangs(array("main", "other", "dict", "bills", "companies", "paybox", "paypal", "stripe"));
|
||||
|
||||
// Clean parameters
|
||||
$PAYPAL_API_USER = "";
|
||||
$PAYPAL_API_PASSWORD = "";
|
||||
$PAYPAL_API_SIGNATURE = "";
|
||||
$PAYPAL_API_SANDBOX = "";
|
||||
$PAYPALTOKEN = "";
|
||||
$PAYPALPAYERID = "";
|
||||
if (isModEnabled('paypal')) {
|
||||
$PAYPAL_API_USER = "";
|
||||
if (getDolGlobalString('PAYPAL_API_USER')) {
|
||||
$PAYPAL_API_USER = getDolGlobalString('PAYPAL_API_USER');
|
||||
}
|
||||
$PAYPAL_API_PASSWORD = "";
|
||||
if (getDolGlobalString('PAYPAL_API_PASSWORD')) {
|
||||
$PAYPAL_API_PASSWORD = getDolGlobalString('PAYPAL_API_PASSWORD');
|
||||
}
|
||||
$PAYPAL_API_SIGNATURE = "";
|
||||
if (getDolGlobalString('PAYPAL_API_SIGNATURE')) {
|
||||
$PAYPAL_API_SIGNATURE = getDolGlobalString('PAYPAL_API_SIGNATURE');
|
||||
}
|
||||
$PAYPAL_API_SANDBOX = "";
|
||||
if (getDolGlobalString('PAYPAL_API_SANDBOX')) {
|
||||
$PAYPAL_API_SANDBOX = getDolGlobalString('PAYPAL_API_SANDBOX');
|
||||
}
|
||||
$PAYPAL_API_USER = getDolGlobalString('PAYPAL_API_USER');
|
||||
$PAYPAL_API_PASSWORD = getDolGlobalString('PAYPAL_API_PASSWORD');
|
||||
$PAYPAL_API_SIGNATURE = getDolGlobalString('PAYPAL_API_SIGNATURE');
|
||||
$PAYPAL_API_SANDBOX = getDolGlobalString('PAYPAL_API_SANDBOX');
|
||||
/*$PAYPAL_API_OK = "";
|
||||
if ($urlok) {
|
||||
$PAYPAL_API_OK = $urlok;
|
||||
|
|
|
|||
Loading…
Reference in a new issue