29require
'../../main.inc.php';
38require_once DOL_DOCUMENT_ROOT.
'/blockedlog/lib/blockedlog.lib.php';
39require_once DOL_DOCUMENT_ROOT.
'/blockedlog/class/blockedlog.class.php';
40require_once DOL_DOCUMENT_ROOT.
'/core/lib/admin.lib.php';
43$langs->loadLangs(array(
'admin',
'blockedlog',
'other'));
46$action =
GETPOST(
'action',
'aZ09');
47$backtopage =
GETPOST(
'backtopage',
'alpha');
51$withtab = GETPOSTISSET(
'withtab') ?
GETPOSTINT(
'withtab') : 1;
64if (preg_match(
'/set_(.*)/', $action, $reg)) {
67 if (is_array($values)) {
68 $values = implode(
',', $values);
72 header(
"Location: ".$_SERVER[
"PHP_SELF"].($withtab ?
'?withtab='.$withtab :
''));
79if (preg_match(
'/del_(.*)/', $action, $reg)) {
82 header(
"Location: ".$_SERVER[
"PHP_SELF"].($withtab ?
'?withtab='.$withtab :
''));
96$block_static->loadTrackedEvents();
98$title = $langs->trans(
"ModuleSetup").
' '.$langs->trans(
'BlockedLog');
99$help_url=
"EN:Module_Unalterable_Archives_-_Logs|FR:Module_Archives_-_Logs_Inaltérable";
101llxHeader(
'', $title, $help_url,
'', 0, 0,
'',
'',
'',
'mod-blockedlog page-admin_blockedlog');
105 $linkback =
'<a href="'.dolBuildUrl($backtopage ? $backtopage : DOL_URL_ROOT.
'/admin/modules.php', [
'restore_lastsearch_values' => 1]).
'">'.
img_picto($langs->trans(
"BackToModuleList"),
'back',
'class="pictofixedwidth"').
'<span class="hideonsmartphone">'.$langs->trans(
"BackToModuleList").
'</span></a>';
111$texttop =
'<small class="opacitymedium">'.$langs->trans(
"RegistrationNumber").
':</small> <small>'.
dol_trunc($registrationnumber, 10).
'</small>';
116print
load_fiche_titre($title.
'<br>'.$texttop, $linkback,
'blockedlog', 0,
'',
'', $morehtmlcenter);
123print
'<span class="opacitymedium">'.$langs->trans(
"BlockedLogDesc").
"</span><br>\n";
125$versionbadge =
'<span class="badge-text badge-secondary">'.getBlockedLogVersionToShow().
'</span>';
130if (
$mysoc->country_code ==
'FR') {
135 $infotoshow = $langs->trans(
"LNECandidateVersionForCertificationFR", $versionbadge);
137 $infotoshow = $langs->trans(
"LNECertifiedVersionFR", $versionbadge);
140 $infotoshow = $langs->trans(
"NotCertifiedVersionFR", $versionbadge);
143 $infotoshow .=
' - <a href="'.DOL_URL_ROOT.
'/blockedlog/admin/filecheck.php">'.
img_picto(
'',
'url',
'class="pictofixedwidth"').$langs->trans(
"FileCheck").
'</a>';
147if (in_array(
$mysoc->country_code, array(
'FR'))) {
148 $organization_for_ping =
getDolGlobalString(
'MAIN_ORGANIZATION_FOR_PING',
"Association Dolibarr");
149 $dataprivacy_url =
getDolGlobalString(
'MAIN_ORGANIZATION_URL_PRIVACY',
"https://www.dolibarr.org/legal-privacy-gdpr.php");
164 $htmltext = ($infotoshow ? $infotoshow.
'<br>' :
'');
165 $htmltext .= $langs->trans(
"ApplicationHasBeenRegistered");
166 $htmltext .=
' '.$langs->trans(
"RegistrationNumber").
': <span class="badge-text badge-secondary" title="Flag stored into MAIN_FIRST_REGISTRATION_OK_DATE. Registered data saved into BLOCKEDLOG_REGISTRATION_...">'.
dol_trunc($registrationnumber, 10).
'</span>';
168 $htmltext .= $langs->trans(
"LastRegistrationDate").
' : ';
185print
'<div class="div-table-responsive">';
186print
'<table class="noborder centpercent">';
188print
'<tr class="liste_titre">';
189print
'<td>'.$langs->trans(
"Parameters").
'</td>';
195print
'<tr class="oddeven">';
196print
'<td class="titlefieldmiddle" title="Parameter BLOCKEDLOG_ENTITY_FINGERPRINT">';
197print $langs->trans(
"CompanyInitialKey").
'</td><td title="Parameter BLOCKEDLOG_ENTITY_FINGERPRINT">';
198print $block_static->getOrInitFirstSignature();
246 print
'<tr class="oddeven">';
248 print $form->textwithpicto($langs->transnoentitiesnoconv(
"BlockedLogDisableNotAllowedForCountry"), $langs->transnoentitiesnoconv(
"BlockedLogDisableNotAllowedForCountry2"));
252 print
'<form method="POST" action="'.$_SERVER[
'PHP_SELF'].
'">';
253 print
'<input type="hidden" name="token" value="'.newToken().
'">';
254 print
'<input type="hidden" name="action" value="set_BLOCKEDLOG_DISABLE_NOT_ALLOWED_FOR_COUNTRY">';
255 print
'<input type="hidden" name="withtab" value="'.$withtab.
'">';
257 $sql =
"SELECT rowid, code as code_iso, code_iso as code_iso3, label, favorite";
258 $sql .=
" FROM ".MAIN_DB_PREFIX.
"c_country";
259 $sql .=
" WHERE active > 0";
261 $countryArray = array();
262 $resql =
$db->query($sql);
264 while ($obj =
$db->fetch_object($resql)) {
265 $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 :
''));
272 $canbedisabled = $block_static->canBeDisabled();
274 print $form->multiselectarray(
'BLOCKEDLOG_DISABLE_NOT_ALLOWED_FOR_COUNTRY', $countryArray, $selected, 0, 0,
'', 0, 0, $canbedisabled ?
'' :
'disabled');
275 print
'<input type="submit" class="button button-edit" value="'.$langs->trans(
"Modify").
'"'.($canbedisabled ?
'' :
' disabled').
'>';
282print
'<tr class="oddeven">';
283print
'<td class="">';
284print $langs->trans(
"ListOfTrackedEvents").
'</td><td>';
285$arrayoftrackedevents = $block_static->trackedevents;
286foreach ($arrayoftrackedevents as $key => $val) {
287 if (preg_match(
'/^separator/i', $key)) {
291 if (is_array($val)) {
292 print $langs->trans($val[
'labelhtml']).
'<br>';
294 print $langs->trans($val).
'<br>';
309print
'<!-- Link to pay -->';
310print
'<span class="fas fa-external-link-alt" style=""></span> <span class="opacitymedium">'.$langs->trans(
"DebugTools").
'</span><br>';
313$urlforceregistration = DOL_MAIN_URL_ROOT.
'/index.php?forceregistration=1';
314print $langs->trans(
"URLToForceRegistration").
'<br>';
315print
'<div class="urllink"><input type="text" id="forceregistration" spellcheck="false" class="quatrevingtpercentminusx" value="'.$urlforceregistration.
'"><a class="" href="'.$urlforceregistration.
'" target="_blank" rel="noopener noreferrer"><span class="fas fa-external-link-alt paddingleft" style=""></span></a></div>';
316print ajax_autoselect(
'forceregistration');
327$urltogetkeyobfuscation = DOL_MAIN_URL_ROOT.
'/blockedlog/admin/blockedlog.php?forcegetkeyobfuscation=1&token='.newToken();
328print $langs->trans(
"URLToGetObfuscationkey").
'<br>';
329print
'<div class="urllink"><input type="text" id="forcegetkeyobfuscation" spellcheck="false" class="quatrevingtpercentminusx" value="'.$urltogetkeyobfuscation.
'"><a class="reposition" href="'.$urltogetkeyobfuscation.
'" target="_blank" rel="noopener noreferrer"><span class="fas fa-external-link-alt paddingleft" style=""></span></a></div>';
330print ajax_autoselect(
'forcegetkeyobfuscation');
332if (
GETPOST(
'forcegetkeyobfuscation')) {
333 unset($_SESSION[
'hmac_secret_key']);
334 unset(
$conf->cache[
'hmac_secret_key']);
336 $block_static->entity =
$conf->entity;
339 $hmac_encoded_secret_key = $block_static->getEncodedHMACSecretKey();
340 print
"\n<!-- READ TO GET HMAC KEY RETURNED result: ".$hmac_encoded_secret_key.
" -->\n";
342 print
'<div class="error">'.$e->getMessage().
'</div>';
345 $obfuscationkey =
'';
347 $obfuscationkey = $block_static->getObfuscationKey();
348 print
"\n<!-- API TO GET REMOTE OBFUSCATION KEY RETURNED result: ".$obfuscationkey.
" -->\n";
350 print
'<div class="error">'.$e->getMessage().
'</div>';
356 $hmac_secret_key =
dolDecrypt($hmac_encoded_secret_key, $obfuscationkey);
358 if (!preg_match(
'/^BLOCKEDLOGHMAC/', (
string) $hmac_secret_key)) {
359 print
'<!-- Failed to decode the encoded HMAC key using the remote obfuscation key -->';
367 $oldobfuscationkey = !empty(
$conf->file->instance_unique_id) ?
$conf->file->instance_unique_id :
"";
369 $hmac_secret_key =
dolDecrypt($hmac_encoded_secret_key, $oldobfuscationkey);
371 if (!preg_match(
'/^BLOCKEDLOGHMAC/', (
string) $hmac_secret_key)) {
373 print
'<!-- HMAC key can t be decoded -->';
375 print
'<!-- Success to decode HMAC key. It is encrypted with an old obfuscation method, we migrate it. -->';
376 print
'<!-- '.$hmac_secret_key.
' -->';
377 if ($obfuscationkey) {
378 $result = $block_static->saveHMACSecretKey($hmac_secret_key,
'dolobfuscationv1-'.
$mysoc->idprof1, $obfuscationkey);
379 print
'<!-- Result to save the new HMAC key: '.$result.
' -->';
383 print
'<!-- Success to decode HMAC key from the remote obfuscation key, nothing to do more -->';
dolibarr_set_const($db, $name, $value, $type='chaine', $visible=0, $note='', $entity=1)
Insert a parameter (key,value) into database (delete old key then insert it again).
dolibarr_del_const($db, $name, $entity=1)
Delete a constant.
llxFooter($comment='', $zone='private', $disabledoutputofmessages=0)
Empty footer.
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader($head='', $title='', $help_url='', $target='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='', $morequerystring='', $morecssonbody='', $replacemainareaby='', $disablenofollow=0, $disablenoindex=0)
Empty header.
getBlockedLogVersionToShow()
Define head array for tabs of blockedlog tools setup pages.
isALNEQualifiedVersion($ignoredev=0, $ignoremodule=0)
Return if the version is a candidate version to get the LNE certification and if the prerequisites ar...
blockedlogadmin_prepare_head($withtabsetup)
Define head array for tabs of blockedlog tools setup pages.
isRegistrationDataSavedAndPushed()
Return if the KYC mandatory parameters are set AND pushed/registered centralized server.
getHashUniqueIdOfRegistration($algo='sha256')
Return a hash unique identifier of the registration (used to identify the registration of instance wi...
isALNERunningVersion($blockedlogtestalreadydone=0, $blockedlogmodulealreadydone=0)
Return if the application is executed with the LNE requirements on.
Class to manage Blocked Log.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2, $allowothertags=array())
Show picto whatever it's its name (generic function)
info_admin($text, $infoonimgalt=0, $nodiv=0, $admin='1', $morecss='hideonsmartphone', $textfordropdown='', $picto='', $textonpictotooltip='')
Show information in HTML for admin users or standard users.
GETPOSTINT($paramname, $method=0)
Return the value of a $_GET or $_POST supervariable, converted into integer.
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='', $dragdropfile=0, $morecssdiv='')
Show tabs of a record.
dol_get_fiche_end($notab=0)
Return tab footer of a card.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
dol_print_error($db=null, $error='', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='', $morecssonpicto='widthpictotitle')
Load a title with picto.
dol_trunc($string, $size=40, $trunc='right', $stringencoding='UTF-8', $nodot=0, $display=0)
Truncate a string to a particular length adding '…' if string larger than length.
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
isModEnabled($module)
Is Dolibarr module enabled.
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.
dolDecrypt($chain, $key='', $patterntotest='')
Decode a string with a symmetric encryption.