* Copyright (C) 2017-2018 Laurent Destailleur * Copyright (C) 2024 Frédéric France * * 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 * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ /** * \file htdocs/blockedlog/admin/blockedlog.php * \ingroup blockedlog * \brief Page setup for blockedlog module */ // Load Dolibarr environment require '../../main.inc.php'; /** * @var Conf $conf * @var DoliDB $db * @var HookManager $hookmanager * @var Societe $mysoc * @var Translate $langs * @var User $user */ require_once DOL_DOCUMENT_ROOT.'/blockedlog/lib/blockedlog.lib.php'; require_once DOL_DOCUMENT_ROOT.'/blockedlog/class/blockedlog.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; // Load translation files required by the page $langs->loadLangs(array('admin', 'blockedlog', 'other')); // Access Control if (!$user->admin || empty($conf->blockedlog->enabled)) { accessforbidden(); } // Get Parameters $action = GETPOST('action', 'aZ09'); $backtopage = GETPOST('backtopage', 'alpha'); $withtab = GETPOSTINT('withtab'); /* * Actions */ $reg = array(); if (preg_match('/set_(.*)/', $action, $reg)) { $code = $reg[1]; $values = GETPOST($code); if (is_array($values)) { $values = implode(',', $values); } if (dolibarr_set_const($db, $code, $values, 'chaine', 0, '', $conf->entity) > 0) { header("Location: ".$_SERVER["PHP_SELF"].($withtab ? '?withtab='.$withtab : '')); exit; } else { dol_print_error($db); } } if (preg_match('/del_(.*)/', $action, $reg)) { $code = $reg[1]; if (dolibarr_del_const($db, $code, 0) > 0) { header("Location: ".$_SERVER["PHP_SELF"].($withtab ? '?withtab='.$withtab : '')); exit; } else { dol_print_error($db); } } /* * View */ $form = new Form($db); $block_static = new BlockedLog($db); $block_static->loadTrackedEvents(); $title = $langs->trans("ModuleSetup").' '.$langs->trans('BlockedLog'); $help_url="EN:Module_Unalterable_Archives_-_Logs|FR:Module_Archives_-_Logs_Inaltérable"; llxHeader('', $title, $help_url, '', 0, 0, '', '', '', 'mod-blockedlog page-admin_blockedlog'); $linkback = ''; if ($withtab) { $linkback = ''.img_picto($langs->trans("BackToModuleList"), 'back', 'class="pictofixedwidth"').''.$langs->trans("BackToModuleList").''; } $morehtmlcenter = ''; $registrationnumber = getHashUniqueIdOfRegistration(); $texttop = ''.$langs->trans("RegistrationNumber").': '.dol_trunc($registrationnumber, 10).''; print load_fiche_titre($title, $linkback, 'blockedlog', 0, '', '', $morehtmlcenter); if ($withtab) { $head = blockedlogadmin_prepare_head(GETPOST('withtab', 'alpha')); print dol_get_fiche_head($head, 'blockedlog', '', -1); } print $texttop; print '

'; print ''.$langs->trans("BlockedLogDesc")."
\n"; if ($mysoc->country_code == 'FR') { $htmltext = $langs->trans("UnalterableLogTool1FR").'
'; print info_admin($htmltext, 0, 0, 'warning'); } print '
'; print '
'; // You can use div-table-responsive-no-min if you don't need reserved height for your table print ''; print ''; print ''; print ''; print "\n"; print ''; print ''; /* if (getDolGlobalString('BLOCKEDLOG_USE_REMOTE_AUTHORITY')) { // Example with a yes / no select print ''; print ''; print ''; } */ // Show the input of countries not allowed for disabling print ''; print ''; print ''; print ''; print ''; print ''; print '
'.$langs->trans("Key").''.$langs->trans("Value").'
'; print $langs->trans("CompanyInitialKey").''; print $block_static->getOrInitFirstSignature(); print '
'.$langs->trans("BlockedLogAuthorityUrl").img_info($langs->trans('BlockedLogAuthorityNeededToStoreYouFingerprintsInNonAlterableRemote')).''; print '
'; print ''; print ''; print ''; print ''; print ''; print '
'; print '
'.$langs->trans("BlockedLogDisableNotAllowedForCountry").''; print '
'; print ''; print ''; print ''; $sql = "SELECT rowid, code as code_iso, code_iso as code_iso3, label, favorite"; $sql .= " FROM ".MAIN_DB_PREFIX."c_country"; $sql .= " WHERE active > 0"; $countryArray = array(); $resql = $db->query($sql); if ($resql) { while ($obj = $db->fetch_object($resql)) { $countryArray[$obj->code_iso] = ($obj->code_iso && $langs->transnoentitiesnoconv("Country".$obj->code_iso) != "Country".$obj->code_iso ? $langs->transnoentitiesnoconv("Country".$obj->code_iso) : ($obj->label != '-' ? $obj->label : '')); } } $selected = !getDolGlobalString('BLOCKEDLOG_DISABLE_NOT_ALLOWED_FOR_COUNTRY') ? array() : explode(',', getDolGlobalString('BLOCKEDLOG_DISABLE_NOT_ALLOWED_FOR_COUNTRY')); print $form->multiselectarray('BLOCKEDLOG_DISABLE_NOT_ALLOWED_FOR_COUNTRY', $countryArray, $selected); print ''; print '
'; print '
'; print $langs->trans("ListOfTrackedEvents").''; $arrayoftrackedevents = $block_static->trackedevents; foreach ($arrayoftrackedevents as $key => $val) { if (preg_match('/^separator/i', $key)) { continue; } print $key.' - '; if (is_array($val)) { print $langs->trans($val['labelhtml']).'
'; } else { print $langs->trans($val).'
'; } } print '
'; print '
'; if ($withtab) { print dol_get_fiche_end(); } print '

'; // End of page llxFooter(); $db->close();