Fix unalterable logs

This commit is contained in:
Laurent Destailleur 2020-11-24 14:54:26 +01:00
parent d502125975
commit 1be9789c33

View File

@ -35,6 +35,8 @@ if (!$user->admin || empty($conf->blockedlog->enabled)) accessforbidden();
$action = GETPOST('action', 'aZ09'); $action = GETPOST('action', 'aZ09');
$backtopage = GETPOST('backtopage', 'alpha'); $backtopage = GETPOST('backtopage', 'alpha');
$withtab = GETPOST('withtab', 'int');
/* /*
* Actions * Actions
@ -49,7 +51,7 @@ if (preg_match('/set_(.*)/', $action, $reg))
if (dolibarr_set_const($db, $code, $values, 'chaine', 0, '', $conf->entity) > 0) if (dolibarr_set_const($db, $code, $values, 'chaine', 0, '', $conf->entity) > 0)
{ {
header("Location: ".$_SERVER["PHP_SELF"]); header("Location: ".$_SERVER["PHP_SELF"].($withtab ? '?withtab='.$withtab : ''));
exit; exit;
} else { } else {
dol_print_error($db); dol_print_error($db);
@ -61,7 +63,7 @@ if (preg_match('/del_(.*)/', $action, $reg))
$code = $reg[1]; $code = $reg[1];
if (dolibarr_del_const($db, $code, 0) > 0) if (dolibarr_del_const($db, $code, 0) > 0)
{ {
Header("Location: ".$_SERVER["PHP_SELF"]); Header("Location: ".$_SERVER["PHP_SELF"].($withtab ? '?withtab='.$withtab : ''));
exit; exit;
} else { } else {
dol_print_error($db); dol_print_error($db);
@ -79,15 +81,13 @@ $block_static = new BlockedLog($db);
llxHeader('', $langs->trans("BlockedLogSetup")); llxHeader('', $langs->trans("BlockedLogSetup"));
$linkback = ''; $linkback = '';
if (GETPOST('withtab', 'alpha')) if ($withtab) {
{
$linkback = '<a href="'.($backtopage ? $backtopage : DOL_URL_ROOT.'/admin/modules.php').'">'.$langs->trans("BackToModuleList").'</a>'; $linkback = '<a href="'.($backtopage ? $backtopage : DOL_URL_ROOT.'/admin/modules.php').'">'.$langs->trans("BackToModuleList").'</a>';
} }
print load_fiche_titre($langs->trans("ModuleSetup").' '.$langs->trans('BlockedLog'), $linkback); print load_fiche_titre($langs->trans("ModuleSetup").' '.$langs->trans('BlockedLog'), $linkback);
if (GETPOST('withtab', 'alpha')) if ($withtab) {
{
$head = blockedlogadmin_prepare_head(); $head = blockedlogadmin_prepare_head();
print dol_get_fiche_head($head, 'blockedlog', '', -1); print dol_get_fiche_head($head, 'blockedlog', '', -1);
} }
@ -114,21 +114,26 @@ if (!empty($conf->global->BLOCKEDLOG_USE_REMOTE_AUTHORITY)) {
print '<tr class="oddeven">'; print '<tr class="oddeven">';
print '<td>'.$langs->trans("BlockedLogAuthorityUrl").img_info($langs->trans('BlockedLogAuthorityNeededToStoreYouFingerprintsInNonAlterableRemote')).'</td>'; print '<td>'.$langs->trans("BlockedLogAuthorityUrl").img_info($langs->trans('BlockedLogAuthorityNeededToStoreYouFingerprintsInNonAlterableRemote')).'</td>';
print '<td class="right" width="300">'; print '<td class="right" width="300">';
print '<form method="POST" action="'.$_SERVER['PHP_SELF'].'">'; print '<form method="POST" action="'.$_SERVER['PHP_SELF'].'">';
print '<input type="hidden" name="token" value="'.newToken().'">'; print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="action" value="set_BLOCKEDLOG_AUTHORITY_URL">'; print '<input type="hidden" name="action" value="set_BLOCKEDLOG_AUTHORITY_URL">';
print '<input type="hidden" name="withtab" value="'.$withtab.'">';
print '<input type="text" name="BLOCKEDLOG_AUTHORITY_URL" value="'.$conf->global->BLOCKEDLOG_AUTHORITY_URL.'" size="40" />'; print '<input type="text" name="BLOCKEDLOG_AUTHORITY_URL" value="'.$conf->global->BLOCKEDLOG_AUTHORITY_URL.'" size="40" />';
print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">'; print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">';
print '</form>'; print '</form>';
print '</td></tr>'; print '</td></tr>';
} }
print '<tr class="oddeven">'; print '<tr class="oddeven">';
print '<td>'.$langs->trans("BlockedLogDisableNotAllowedForCountry").'</td>'; print '<td>'.$langs->trans("BlockedLogDisableNotAllowedForCountry").'</td>';
print '<td>'; print '<td>';
print '<form method="POST" action="'.$_SERVER['PHP_SELF'].'">'; print '<form method="POST" action="'.$_SERVER['PHP_SELF'].'">';
print '<input type="hidden" name="token" value="'.newToken().'">'; print '<input type="hidden" name="token" value="'.newToken().'">';
print '<input type="hidden" name="action" value="set_BLOCKEDLOG_DISABLE_NOT_ALLOWED_FOR_COUNTRY">'; print '<input type="hidden" name="action" value="set_BLOCKEDLOG_DISABLE_NOT_ALLOWED_FOR_COUNTRY">';
print '<input type="hidden" name="withtab" value="'.$withtab.'">';
$sql = "SELECT rowid, code as code_iso, code_iso as code_iso3, label, favorite"; $sql = "SELECT rowid, code as code_iso, code_iso as code_iso3, label, favorite";
$sql .= " FROM ".MAIN_DB_PREFIX."c_country"; $sql .= " FROM ".MAIN_DB_PREFIX."c_country";
@ -168,7 +173,7 @@ print '</tr>';
print '</table>'; print '</table>';
if (GETPOST('withtab', 'alpha')) if ($withtab)
{ {
print dol_get_fiche_end(); print dol_get_fiche_end();
} }