mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-12-07 01:58:09 +01:00
Scrutinizer Auto-Fixes
This commit consists of patches automatically generated for this project on https://scrutinizer-ci.com
This commit is contained in:
@@ -29,8 +29,8 @@ use OAuth\Common\Consumer\Credentials;
|
||||
use OAuth\OAuth2\Service\GitHub;
|
||||
|
||||
// Define $urlwithroot
|
||||
$urlwithouturlroot=preg_replace('/'.preg_quote(DOL_URL_ROOT, '/').'$/i', '', trim($dolibarr_main_url_root));
|
||||
$urlwithroot=$urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file
|
||||
$urlwithouturlroot = preg_replace('/'.preg_quote(DOL_URL_ROOT, '/').'$/i', '', trim($dolibarr_main_url_root));
|
||||
$urlwithroot = $urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file
|
||||
//$urlwithroot=DOL_MAIN_URL_ROOT; // This is to use same domain name than current
|
||||
|
||||
|
||||
@@ -70,8 +70,8 @@ $credentials = new Credentials(
|
||||
$currentUri->getAbsoluteUri()
|
||||
);
|
||||
|
||||
$requestedpermissionsarray=array();
|
||||
if (GETPOST('state')) $requestedpermissionsarray=explode(',', GETPOST('state')); // Example: 'user'. 'state' parameter is standard to retrieve some parameters back
|
||||
$requestedpermissionsarray = array();
|
||||
if (GETPOST('state')) $requestedpermissionsarray = explode(',', GETPOST('state')); // Example: 'user'. 'state' parameter is standard to retrieve some parameters back
|
||||
if ($action != 'delete' && empty($requestedpermissionsarray))
|
||||
{
|
||||
print 'Error, parameter state is not defined';
|
||||
@@ -99,11 +99,11 @@ if ($action == 'delete')
|
||||
|
||||
setEventMessages($langs->trans('TokenDeleted'), null, 'mesgs');
|
||||
|
||||
header('Location: ' . $backtourl);
|
||||
header('Location: '.$backtourl);
|
||||
exit();
|
||||
}
|
||||
|
||||
if (! empty($_GET['code'])) // We are coming from oauth provider page
|
||||
if (!empty($_GET['code'])) // We are coming from oauth provider page
|
||||
{
|
||||
// We should have
|
||||
//$_GET=array('code' => string 'aaaaaaaaaaaaaa' (length=20), 'state' => string 'user,public_repo' (length=16))
|
||||
@@ -132,12 +132,12 @@ if (! empty($_GET['code'])) // We are coming from oauth provider page
|
||||
// parent::__construct($credentials, $httpClient, $storage, $scopes, $baseApiUri)
|
||||
// has not the ending parameter to true like the Google class constructor.
|
||||
|
||||
setEventMessages($langs->trans('NewTokenStored'), null, 'mesgs'); // Stored into object managed by class DoliStorage so into table oauth_token
|
||||
setEventMessages($langs->trans('NewTokenStored'), null, 'mesgs'); // Stored into object managed by class DoliStorage so into table oauth_token
|
||||
|
||||
$backtourl = $_SESSION["backtourlsavedbeforeoauthjump"];
|
||||
unset($_SESSION["backtourlsavedbeforeoauthjump"]);
|
||||
|
||||
header('Location: ' . $backtourl);
|
||||
header('Location: '.$backtourl);
|
||||
exit();
|
||||
} catch (Exception $e) {
|
||||
print $e->getMessage();
|
||||
@@ -145,7 +145,7 @@ if (! empty($_GET['code'])) // We are coming from oauth provider page
|
||||
}
|
||||
else // If entry on page with no parameter, we arrive here
|
||||
{
|
||||
$_SESSION["backtourlsavedbeforeoauthjump"]=$backtourl;
|
||||
$_SESSION["backtourlsavedbeforeoauthjump"] = $backtourl;
|
||||
|
||||
// This may create record into oauth_state before the header redirect.
|
||||
// Creation of record with state in this tables depend on the Provider used (see its constructor).
|
||||
@@ -155,11 +155,11 @@ else // If entry on page with no parameter, we arrive here
|
||||
}
|
||||
else
|
||||
{
|
||||
$url = $apiService->getAuthorizationUri(); // Parameter state will be randomly generated
|
||||
$url = $apiService->getAuthorizationUri(); // Parameter state will be randomly generated
|
||||
}
|
||||
|
||||
// we go on oauth provider authorization page
|
||||
header('Location: ' . $url);
|
||||
header('Location: '.$url);
|
||||
exit();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user