Clean code

This commit is contained in:
Laurent Destailleur 2023-03-03 18:02:56 +01:00
parent 511b19d27b
commit 4616d2b9e6
2 changed files with 10 additions and 4 deletions

View File

@ -1125,6 +1125,7 @@ function dol_buildpath($path, $type = 0, $returnemptyifnotfound = 0)
}
continue;
}
$regs = array();
preg_match('/^([^\?]+(\.css\.php|\.css|\.js\.php|\.js|\.png|\.jpg|\.php)?)/i', $path, $regs); // Take part before '?'
if (!empty($regs[1])) {
//print $key.'-'.$dirroot.'/'.$path.'-'.$conf->file->dol_url_root[$type].'<br>'."\n";

View File

@ -232,8 +232,11 @@ if (empty($conf->stripeconnect->enabled)) {
print '<br>';
}
print '<input class="minwidth300" type="text" name="STRIPE_TEST_WEBHOOK_KEY" value="'.getDolGlobalString('STRIPE_TEST_WEBHOOK_KEY').'" placeholder="'.$langs->trans("Example").': whsec_xxxxxxxxxxxxxxxxxxxxxxxx">';
$out = img_picto('', 'globe').' <span class="opacitymedium">'.$langs->trans("ToOfferALinkForTestWebhook").'</span> ';
$url = dol_buildpath('/public/stripe/ipn.php?test', 3);
$out = img_picto('', 'globe').' <span class="opacitymedium">'.$langs->trans("ToOfferALinkForTestWebhook").'</span> ';
$url = dol_buildpath('/public/stripe/ipn.php', 3);
$url .= '?test=1';
//global $dolibarr_main_instance_unique_id;
//$url .= '&securitykey='.dol_hash('stripeipn-'.$dolibarr_main_instance_unique_id.'-'.$conf->global->STRIPE_TEST_PUBLISHABLE_KEY, 'md5');
$out .= '<input type="text" id="onlinetestwebhookurl" class="minwidth500" value="'.$url.'" disabled>';
$out .= ajax_autoselect("onlinetestwebhookurl", 0);
print '<br>'.$out;
@ -250,7 +253,7 @@ if (empty($conf->stripeconnect->enabled)) {
$endpoint->disabled = false;
}
}
$endpoint->url = dol_buildpath('/public/stripe/ipn.php?test', 3);
$endpoint->url = $url;
$endpoint->save();
if ($endpoint->status == 'enabled') {
print '<a class="reposition" href="'.$_SERVER['PHP_SELF'].'?action=ipn&webhook='.$endpoint->id.'&status=0">';
@ -296,6 +299,8 @@ if (empty($conf->stripeconnect->enabled)) {
print '<input class="minwidth300" type="text" name="STRIPE_LIVE_WEBHOOK_KEY" value="'.getDolGlobalString('STRIPE_LIVE_WEBHOOK_KEY').'" placeholder="'.$langs->trans("Example").': whsec_xxxxxxxxxxxxxxxxxxxxxxxx">';
$out = img_picto('', 'globe', 'class="pictofixedwidth"').' <span class="opacitymedium">'.$langs->trans("ToOfferALinkForLiveWebhook").'</span> ';
$url = dol_buildpath('/public/stripe/ipn.php', 3);
//global $dolibarr_main_instance_unique_id;
//$url .= '?securitykey='.dol_hash('stripeipn-'.$dolibarr_main_instance_unique_id.'-'.$conf->global->STRIPE_LIVE_PUBLISHABLE_KEY, 'md5');
$out .= '<input type="text" id="onlinelivewebhookurl" class="minwidth500" value="'.$url.'" disabled>';
$out .= ajax_autoselect("onlinelivewebhookurl", 0);
print '<br>'.$out;
@ -312,7 +317,7 @@ if (empty($conf->stripeconnect->enabled)) {
$endpoint->disabled = false;
}
}
$endpoint->url = dol_buildpath('/public/stripe/ipn.php', 3);
$endpoint->url = $url;
$endpoint->save();
if ($endpoint->status == 'enabled') {
print '<a class="reposition" href="'.$_SERVER['PHP_SELF'].'?action=ipn&webhook='.$endpoint->id.'&status=0">';