Remove noheaderfooter and isembed parameters from the newpayment page (#29554)

* remove noheaderfooter and isembed

* Update paymentok.php

* Update paymentko.php

---------

Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
This commit is contained in:
Mohamed DAOUD 2024-05-01 17:27:56 +02:00 committed by GitHub
parent 1b84a61963
commit 8f1823827a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 10 additions and 45 deletions

View file

@ -96,9 +96,7 @@ if (!GETPOST("currency", 'alpha')) {
}
$source = GETPOST("s", 'aZ09') ? GETPOST("s", 'aZ09') : GETPOST("source", 'aZ09');
$getpostlang = GETPOST('lang', 'aZ09');
$noheaderfooter = GETPOSTINT("noheaderfooter");
$isembed = GETPOSTINT("isembed");
$ws = GETPOSTINT("ws");
$ws = GETPOSTINT("ws"); // Website reference where the newpayment page is embedded
if (!$action) {
if (!GETPOST("amount", 'alpha') && !$source) {
@ -217,10 +215,6 @@ if ($paymentmethod && !preg_match('/'.preg_quote('PM='.$paymentmethod, '/').'/',
$FULLTAG .= ($FULLTAG ? '.' : '').'PM='.$paymentmethod;
}
if ($isembed) {
$FULLTAG .= ($FULLTAG ? '.' : '').'EMB='.$isembed;
}
if ($ws) {
$FULLTAG .= ($FULLTAG ? '.' : '').'WS='.$ws;
}
@ -895,8 +889,6 @@ print '<input type="hidden" name="e" value="'.$entity.'" />';
print '<input type="hidden" name="forcesandbox" value="'.GETPOSTINT('forcesandbox').'" />';
print '<input type="hidden" name="lang" value="'.$getpostlang.'">';
print '<input type="hidden" name="ws" value="'.$ws.'">';
print '<input type="hidden" name="isembed" value="'.$isembed.'">';
print '<input type="hidden" name="noheaderfooter" value="'.$noheaderfooter.'">';
print "\n";
@ -923,7 +915,7 @@ if (!empty($logosmall) && is_readable($conf->mycompany->dir_output.'/logos/thumb
}
// Output html code for logo
if ($urllogo && !$noheaderfooter) {
if ($urllogo && !$ws) {
print '<div class="backgreypublicpayment">';
print '<div class="logopublicpayment">';
print '<img id="dolpaymentlogo" src="'.$urllogo.'"';
@ -933,7 +925,7 @@ if ($urllogo && !$noheaderfooter) {
print '<div class="poweredbypublicpayment opacitymedium right"><a class="poweredbyhref" href="https://www.dolibarr.org?utm_medium=website&utm_source=poweredby" target="dolibarr" rel="noopener">'.$langs->trans("PoweredBy").'<br><img class="poweredbyimg" src="'.DOL_URL_ROOT.'/theme/dolibarr_logo.svg" width="80px"></a></div>';
}
print '</div>';
} elseif ($creditor && !$noheaderfooter) {
} elseif ($creditor && !$ws) {
print '<div class="backgreypublicpayment">';
print '<div class="logopublicpayment">';
print $creditor;
@ -2723,7 +2715,7 @@ if (preg_match('/^dopayment/', $action)) { // If we chose/clicked on the payme
}
}
if (!$noheaderfooter) {
if (!$ws) {
htmlPrintOnlineFooter($mysoc, $langs, 1, $suffix, $object);
}

View file

@ -96,12 +96,6 @@ if (empty($paymentmethod)) {
dol_syslog("paymentmethod=".$paymentmethod);
}
// Detect $isembed
$isembed = preg_match('/EMB=([^\.]+)/', $FULLTAG, $reg_emb) ? $reg_emb[1] : 0;
if ($isembed) {
dol_syslog("paymentko.php page is called into an iframe.", LOG_DEBUG, 0, '_payment');
}
// Detect $ws
$ws = preg_match('/WS=([^\.]+)/', $FULLTAG, $reg_ws) ? $reg_ws[1] : 0;
if ($ws) {
@ -321,11 +315,6 @@ $db->close();
if (!empty($doactionsthenredirect)) {
// Redirect to an error page
// Paymentko page must be created for the specific website
$ext_urlko = DOL_URL_ROOT.'/public/website/index.php?website='.$ws.'&pageref=paymentko&fulltag='.$FULLTAG;
if (!empty($isembed)) {
print "<script>window.top.location.href = \"". $ext_urlko ."\";</script>";
} else {
header("Location: ".$ext_urlko);
exit;
}
$ext_urlko = DOL_URL_ROOT.'/public/website/index.php?website='.urlencode($ws).'&pageref=paymentko&fulltag='.$FULLTAG;
print "<script>window.top.location.href = '".dol_escape_js($ext_urlko)."';</script>";
}

View file

@ -128,12 +128,6 @@ if (empty($paymentmethod)) {
dol_syslog("***** paymentok.php is called paymentmethod=".$paymentmethod." FULLTAG=".$FULLTAG." REQUEST_URI=".$_SERVER["REQUEST_URI"], LOG_DEBUG, 0, '_payment');
// Detect $isembed
$isembed = preg_match('/EMB=([^\.]+)/', $FULLTAG, $reg_emb) ? $reg_emb[1] : 0;
if ($isembed) {
dol_syslog("paymentok.php page is called into an iframe.", LOG_DEBUG, 0, '_payment');
}
// Detect $ws
$ws = preg_match('/WS=([^\.]+)/', $FULLTAG, $reg_ws) ? $reg_ws[1] : 0;
if ($ws) {
@ -2080,22 +2074,12 @@ if (!empty($doactionsthenredirect)) {
if ($ispaymentok) {
// Redirect to a success page
// Paymentok page must be created for the specific website
$ext_urlok = DOL_URL_ROOT.'/public/website/index.php?website='.$ws.'&pageref=paymentok&fulltag='.$FULLTAG;
if (!empty($isembed)) {
print "<script>window.top.location.href = \"". $ext_urlok ."\";</script>";
} else {
header("Location: ".$ext_urlok);
exit;
}
$ext_urlok = DOL_URL_ROOT.'/public/website/index.php?website='.urlencode($ws).'&pageref=paymentok&fulltag='.$FULLTAG;
print "<script>window.top.location.href = '".dol_escape_js($ext_urlok) ."';</script>";
} else {
// Redirect to an error page
// Paymentko page must be created for the specific website
$ext_urlko = DOL_URL_ROOT.'/public/website/index.php?website='.$ws.'&pageref=paymentko&fulltag='.$FULLTAG;
if (!empty($isembed)) {
print "<script>window.top.location.href = \"". $ext_urlko ."\";</script>";
} else {
header("Location: ".$ext_urlko);
exit;
}
$ext_urlko = DOL_URL_ROOT.'/public/website/index.php?website='.urlencode($ws).'&pageref=paymentko&fulltag='.$FULLTAG;
print "<script>window.top.location.href = '".dol_escape_js($ext_urlko)."';</script>";
}
}