29require
'../../main.inc.php';
39require_once DOL_DOCUMENT_ROOT.
'/core/lib/admin.lib.php';
40require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
41require_once DOL_DOCUMENT_ROOT.
'/core/lib/geturl.lib.php';
42require_once DOL_DOCUMENT_ROOT.
'/blockedlog/lib/blockedlog.lib.php';
48if (!$user->admin && !$user->hasRight(
'blockedlog',
'read')) {
55$versionbadge =
'<span class="badge-text badge-secondary">'.getBlockedLogVersionToShow();
56if (
$mysoc->country_code ==
'FR' && !constant(
'CERTIF_LNE')) {
58 $langs->load(
"blockedlog");
59 $versionbadge .=
' - '.$langs->trans(
"NeedAThirdPartyStatement");
61$versionbadge .=
'</span>';
70llxHeader(
'',
'',
'',
'', 0, 0,
'',
'',
'',
'mod-admin page-system_filecheck');
72print
load_fiche_titre($langs->trans(
"FileCheckDolibarr"),
'',
'title_setup');
74print
'<div class="opacitymedium hideonsmartphone justify">'.$langs->trans(
"FileCheckDesc").
'</div>';
76 print
'<span class="opacitymedium">';
77 print $langs->trans(
"DataIntegrityDesc").
': ';
79 print
'<a href="'.DOL_URL_ROOT.
'/blockedlog/admin/blockedlog_list.php">'.img_picto(
'',
'url',
'class="pictofixedwidth"').$langs->trans(
"BlockedLog").
'</a><br>';
85print
'<div class="div-table-responsive-no-min">';
86print
'<table class="noborder centpercent">';
87print
'<tr class="liste_titre"><td>'.$langs->trans(
"Version").
'</td><td></td></tr>'.
"\n";
89$htmltooltip .= $langs->trans(
"VersionLastInstall").
': '.
getDolGlobalString(
'MAIN_VERSION_LAST_INSTALL').
'<br>'.
"\n";
90$htmltooltip .= $langs->trans(
"VersionLastUpgrade").
': '.
getDolGlobalString(
'MAIN_VERSION_LAST_UPGRADE').
'<br>'.
"\n";
92print
'<tr class="oddeven nohover">';
93print
'<td width="300">'.$langs->trans(
"VersionProgram").
'</td><td>';
94print
'<span class="badge-text badge-secondary valignmiddle">'.DOL_VERSION.
'</span>';
99 print
' '.img_warning($langs->trans(
"RunningUpdateProcessMayBeRequired", DOL_VERSION,
getDolGlobalString(
'MAIN_VERSION_LAST_INSTALL')));
104 print
' '.img_warning($langs->trans(
"RunningUpdateProcessMayBeRequired", DOL_VERSION,
getDolGlobalString(
'MAIN_VERSION_LAST_UPGRADE')));
107print
' '.$form->textwithpicto(
'', $htmltooltip);
108print
'</td></tr>'.
"\n";
110$showblockedlogversion = 0;
111if (
$mysoc->country_code ==
'FR') {
112 $showblockedlogversion = 1;
115 $showblockedlogversion = 1;
118if ($showblockedlogversion) {
119 print
'<tr class="oddeven nohover">';
120 print
'<td width="300">'.$langs->trans(
"VersionOfModule", $langs->transnoentitiesnoconv(
"BlockedLog")).
'</td><td>';
131if (
$mysoc->country_code ==
'FR') {
152$file_list = array(
'missing' => array(),
'updated' => array());
157$xmlfile = DOL_DOCUMENT_ROOT.
'/install/'.$xmlshortfile;
158if (!preg_match(
'/\.zip$/i', $xmlfile) &&
dol_is_file($xmlfile.
'.zip')) {
163$xmlremote =
GETPOST(
'xmlremote',
'alphanohtml');
167$param =
'MAIN_FILECHECK_URL_'.DOL_VERSION;
171if (empty($xmlremote)) {
172 $xmlremote =
'https://www.dolibarr.org/files/stable/signatures/filelist-'.DOL_VERSION.
'.xml';
174if (!preg_match(
'/^https?:\/\//', $xmlremote)) {
175 $langs->load(
"errors");
176 setEventMessages($langs->trans(
"ErrorURLMustStartWithHttp", $xmlremote),
null,
'errors');
178} elseif ($xmlremote && !preg_match(
'/\.xml$/', $xmlremote)) {
179 $langs->load(
"errors");
180 setEventMessages($langs->trans(
"ErrorURLMustEndWith", $xmlremote,
'.xml'),
null,
'errors');
185$enableremotecheck =
true;
186if (preg_match(
'/beta|alpha|rc/i', DOL_VERSION) ||
getDolGlobalString(
'MAIN_ALLOW_INTEGRITY_CHECK_ON_UNSTABLE')) {
187 $enableremotecheck =
false;
190print
'<form name="check" action="'.dolBuildUrl($_SERVER[
"PHP_SELF"]).
'">';
191print
'<input type="hidden" name="token" value="'.newToken().
'">';
192print img_picto(
'',
'search',
'class="pictofixedwidth"').$langs->trans(
"MakeIntegrityAnalysisFrom").
'...<br><br>';
194print
'<div class="divsection">';
195print
'<!-- for a local check target=local&xmlshortfile=... -->'.
"\n";
197 print
'<input type="radio" name="target" id="checkboxlocal" value="local"'.((!
GETPOST(
'target') ||
GETPOST(
'target') ==
'local') ?
'checked="checked"' :
'').
'"> <label for="checkboxlocal">'.$langs->trans(
"LocalSignature").
'</label> = ';
198 print
'<input name="xmlshortfile" class="flat minwidth400" value="'.dol_escape_htmltag($xmlshortfile).
'" spellcheck="false">';
201 print
'<input type="radio" name="target" id="checkboxlocal" value="local"> <label for="checkboxlocal">'.$langs->trans(
"LocalSignature").
' = ';
202 print
'<input name="xmlshortfile" class="flat minwidth400" value="'.dol_escape_htmltag($xmlshortfile).
'" spellcheck="false">';
203 print
'<br><span class="warning paddingtop inline-block">'.$langs->trans(
"AvailableOnlyOnPackagedVersions").
'</span></label>';
209print
'<!-- for a remote target=remote&xmlremote=... -->'.
"\n";
210if ($enableremotecheck) {
211 print
'<input type="radio" name="target" id="checkboxremote" value="remote"'.(GETPOST(
'target') ==
'remote' ?
'checked="checked"' :
'').
'> <label for="checkboxremote">'.$langs->trans(
"RemoteSignature").
'</label> = ';
212 print
'<input name="xmlremote" class="flat minwidth500" value="'.dol_escape_htmltag($xmlremote).
'" spellcheck="false"><br>';
214 print
'<input type="radio" name="target" id="checkboxremote" value="remote" disabled="disabled"> '.$langs->trans(
"RemoteSignature").
' = '.
dol_escape_htmltag($xmlremote);
216 print
' <span class="warning">('.$langs->trans(
"FeatureAvailableOnlyOnStable").
')</span>';
223print
'<div class="center">';
224if (
$mysoc->country_code ==
'FR') {
225 print
'<input type="checkbox" name="mode" id="mode" value="unalterable"'.($mode ==
'unalterable' ?
' checked="checked"' :
'').
'>';
226 print
'<label for="mode" class="opacitymedium">'.$langs->trans(
"AnalyzeUnalterableScopeOnly", $langs->transnoentitiesnoconv(
"BlockedLog")).
'</label><br>';
228print
'<input type="submit" name="check" class="button" value="'.$langs->trans(
"Check").
'">';
234if (
GETPOST(
'target') ==
'local') {
237 if (preg_match(
'/\.zip$/i', $xmlfile)) {
239 $xmlfilenew = preg_replace(
'/\.zip$/i',
'', $xmlfile);
241 if (empty($result[
'error'])) {
242 $xmlfile =
$conf->admin->dir_temp.
'/'.basename($xmlfilenew);
244 print $langs->trans(
'FailedToUncompressFile').
': '.$xmlfile;
248 $xml = simplexml_load_file($xmlfile);
249 if ($xml ===
false) {
250 print
'<div class="warning">'.$langs->trans(
'XmlCorrupted').
': '.$xmlfile.
'</span>';
254 print
'<div class="warning">'.$langs->trans(
'XmlNotFound').
': '.$xmlfile.
'</span>';
258if (
GETPOST(
'target') ==
'remote') {
259 $xmlarray =
getURLContent($xmlremote,
'GET',
'', 1, array(), array(
'http',
'https'), 0);
262 if (!$xmlarray[
'curl_error_no'] && $xmlarray[
'http_code'] != 400 && $xmlarray[
'http_code'] != 404) {
263 $xmlfile = $xmlarray[
'content'];
265 if (LIBXML_VERSION < 20900) {
269 libxml_disable_entity_loader(
true);
272 $xml = simplexml_load_string($xmlfile,
'SimpleXMLElement', LIBXML_NOCDATA | LIBXML_NONET);
274 $errormsg = $langs->trans(
'XmlNotFound').
': '.$xmlremote.
' - '.$xmlarray[
'http_code'].(($xmlarray[
'http_code'] == 400 && $xmlarray[
'content']) ?
' '.$xmlarray[
'content'] :
'').
' '.$xmlarray[
'curl_error_no'].
' '.$xmlarray[
'curl_error_msg'];
275 setEventMessages($errormsg,
null,
'errors');
281if (empty($error) && !empty($xml)) {
282 $checksumconcat = array();
283 $file_list = array();
286 $algo = (string) $xml[
'algo'];
293 if (is_object($xml->dolibarr_constants[0]) || $mode ==
'unalterable') {
296 $out .=
'<div class="div-table-responsive-no-min">';
297 $out .=
'<table class="noborder">';
298 $out .=
'<tr class="liste_titre">';
299 $out .=
'<td>#</td>';
300 $out .=
'<td>'.$langs->trans(
"Parameter").
'</td>';
301 $out .=
'<td class="center">'.$langs->trans(
"ExpectedValue").
'</td>';
302 $out .=
'<td class="center">'.$langs->trans(
"CurrentValue").
'</td>';
303 $out .=
'</tr>'.
"\n";
307 if ($mode ==
'unalterable') {
310 $out .=
'<tr class="oddeven">';
311 $out .=
'<td>'.$i.
'</td>'.
"\n";
312 $out .=
'<td>'.$langs->trans(
"Country").
'</td>'.
"\n";
313 $out .=
'<td class="center"><span class="opacitymedium">'.$langs->trans(
"YourCountryCode").
'</span></td>'.
"\n";
314 $out .=
'<td class="center">'.$mysoc->country_code.
'</td>'.
"\n";
319 $out .=
'<tr class="oddeven">';
320 $out .=
'<td>'.$i.
'</td>'.
"\n";
321 $out .=
'<td>'.$langs->trans(
"StatusOfModule", $langs->transnoentitiesnoconv(
"BlockedLog")).
'</td>'.
"\n";
322 $out .=
'<td class="center">'.$langs->trans(
"Enabled").
'</td>'.
"\n";
323 $out .=
'<td class="center">';
324 $out .=
isModEnabled(
'blockedlog') ?
'<span class="ok">'.$langs->trans(
"Enabled").
'</span>' :
'<span class="warning">'.$langs->trans(
"Disabled").
'</span>';
326 include_once DOL_DOCUMENT_ROOT.
'/core/modules/modBlockedLog.class.php';
332 $const_name =
'MAIN_MODULE_'.strtoupper(preg_replace(
'/^mod/i',
'', get_class($objMod)));
334 $htmltooltip =
'<span class="opacitymedium">'.$langs->trans(
"LastActivationDate").
':</span> ';
336 $htmltooltip .=
dol_print_date($objMod->getLastActivationDate(),
'dayhour');
338 $htmltooltip .= $langs->trans(
"Disabled");
340 $tmp = $objMod->getLastActivationInfo();
341 $authorid = (empty($tmp[
'authorid']) ?
'' : $tmp[
'authorid']);
343 $tmpuser =
new User($db);
344 $tmpuser->fetch($authorid);
345 $htmltooltip .=
'<br><span class="opacitymedium">'.$langs->trans(
"LastActivationAuthor").
':</span> ';
346 $htmltooltip .= $tmpuser->getNomUrl(0,
'nolink', -1, 1);
348 $ip = (empty($tmp[
'ip']) ?
'' : $tmp[
'ip']);
350 $htmltooltip .=
'<br><span class="opacitymedium">'.$langs->trans(
"LastActivationIP").
':</span> ';
353 $lastactivationversion = (empty($tmp[
'lastactivationversion']) ?
'' : $tmp[
'lastactivationversion']);
354 if ($lastactivationversion && $lastactivationversion !=
'dolibarr') {
355 $htmltooltip .=
'<br><span class="opacitymedium">'.$langs->trans(
"LastActivationVersion").
':</span> ';
356 $htmltooltip .= $lastactivationversion;
359 $out .= $form->textwithpicto(
'', $htmltooltip);
365 foreach ($xml->dolibarr_constants[0]->constant as $constant) {
366 $constname = (string) $constant[
'name'];
367 $constvalue = (string) $constant;
369 $constvalue = (empty($constvalue) ?
'0' : $constvalue);
375 $valueforchecksum = (empty($value) ?
'0' : $value);
377 $checksumconcat[$constname] = $valueforchecksum;
381 $out .=
'<tr class="oddeven">';
382 $out .=
'<td>'.$i.
'</td>'.
"\n";
383 $out .=
'<td>'.dol_escape_htmltag($constname).
'</td>'.
"\n";
384 $out .=
'<td class="center">'.dol_escape_htmltag($constvalue).
'</td>'.
"\n";
385 $out .=
'<td class="center">'.dol_escape_htmltag($valueforchecksum).
'</td>'.
"\n";
389 if ($i == 0 && $mode !=
'unalterable') {
390 $out .=
'<tr class="oddeven"><td colspan="4"><span class="opacitymedium">'.$langs->trans(
"None").
'</span></td></tr>';
399 $onlymodifiedorremoved = 0;
400 if ($mode ==
'unalterable') {
401 $listoffilestoanalyze = $xml->dolibarr_unalterable_files[0];
402 $onlymodifiedorremoved = 1;
404 $listoffilestoanalyze = $xml->dolibarr_htdocs_dir[0];
405 $onlymodifiedorremoved = 0;
410 if (is_object($listoffilestoanalyze)) {
412 $includecustom = (empty($listoffilestoanalyze[
'includecustom']) ? 0 : $listoffilestoanalyze[
'includecustom']);
415 $regextoinclude =
'\.(php|php3|php4|php5|phtml|phps|phar|inc|css|scss|html|xml|js|json|tpl|jpg|jpeg|png|gif|ico|sql|lang|txt|yml|bak|md|mp3|mp4|wav|mkv|z|gz|zip|rar|tar|less|svg|eot|woff|woff2|ttf|manifest)$';
416 $regextoexclude =
'('.($includecustom ?
'' :
'custom|').
'documents|conf|install|dejavu-fonts-ttf-.*|public\/test|sabre\/sabre\/.*\/tests|Shared\/PCLZip|nusoap\/lib\/Mail|php\/example|php\/test|geoip\/sample.*\.php|ckeditor\/samples|ckeditor\/adapters)$';
417 $scanfiles =
dol_dir_list(DOL_DOCUMENT_ROOT,
'files', 1, $regextoinclude, $regextoexclude);
420 getFilesUpdated($file_list, $listoffilestoanalyze,
'', DOL_DOCUMENT_ROOT, $checksumconcat);
421 '@phan-var-force array{insignature:string[],missing?:array<array{filename:string,expectedhash:string,expectedsize:string,algo:string}>,updated:array<array{filename:string,expectedhash:string,expectedsize:string,hash:string,algo:string}>} $file_list';
424 if (empty($onlymodifiedorremoved)) {
425 foreach ($scanfiles as $valfile) {
426 $tmprelativefilename = preg_replace(
'/^'.preg_quote(DOL_DOCUMENT_ROOT,
'/').
'/',
'', $valfile[
'fullname']);
427 if (!in_array($tmprelativefilename, $file_list[
'insignature'])) {
428 $hashnewfile = @hash_file($algo, $valfile[
'fullname']);
429 $file_list[
'added'][] = array(
'filename' => $tmprelativefilename,
'hash' => $hashnewfile,
'algo' => $algo);
437 $out .=
'<div class="div-table-responsive-no-min">';
438 $out .=
'<table class="noborder">';
439 $out .=
'<tr class="liste_titre">';
440 $out .=
'<td>#</td>';
441 $out .=
'<td>'.$langs->trans(
"Filename").
'</td>';
442 $out .=
'<td class="right">'.$langs->trans(
"ExpectedSize").
'</td>';
443 $out .=
'<td class="center">'.$langs->trans(
"ExpectedChecksum").
'</td>';
444 $out .=
'</tr>'.
"\n";
446 if (is_array($tmpfilelist) && count($tmpfilelist)) {
448 foreach ($tmpfilelist as $file) {
450 $out .=
'<tr class="oddeven">';
451 $out .=
'<td>'.$i.
'</td>'.
"\n";
452 $out .=
'<td>'.dol_escape_htmltag($file[
'filename']).
'</td>'.
"\n";
453 $out .=
'<td class="right">';
454 if (!empty($file[
'expectedsize'])) {
457 $out .=
'</td>'.
"\n";
458 $out .=
'<td class="center">'.dol_escape_htmltag($file[
'expectedhash']).
'</td>'.
"\n";
462 $out .=
'<tr class="oddeven"><td colspan="4"><span class="opacitymedium">'.$langs->trans(
"None").
'</span></td></tr>';
473 $out .=
'<div class="div-table-responsive-no-min">';
474 $out .=
'<table class="noborder">';
475 $out .=
'<tr class="liste_titre">';
476 $out .=
'<td>#</td>';
477 $out .=
'<td>'.$langs->trans(
"Filename").
'</td>';
478 $out .=
'<td class="center">'.$langs->trans(
"ExpectedChecksum").
'</td>';
479 $out .=
'<td class="center">'.$langs->trans(
"CurrentChecksum").
'</td>';
480 $out .=
'<td class="right">'.$langs->trans(
"ExpectedSize").
'</td>';
481 $out .=
'<td class="right">'.$langs->trans(
"CurrentSize").
'</td>';
482 $out .=
'<td class="right">'.$langs->trans(
"DateModification").
'</td>';
483 $out .=
'</tr>'.
"\n";
484 $tmpfilelist2 =
dol_sort_array($file_list[
'updated'],
'filename');
485 if (is_array($tmpfilelist2) && count($tmpfilelist2)) {
487 foreach ($tmpfilelist2 as $file) {
489 $out .=
'<tr class="oddeven">';
490 $out .=
'<td>'.$i.
'</td>'.
"\n";
491 $out .=
'<td>'.dol_escape_htmltag($file[
'filename']);
492 $out .=
' <a href="#" class="showfilediff" data-file="'.dol_escape_htmltag($file[
'filename']).
'" data-algo="'.
dol_escape_htmltag($file[
'algo']).
'" data-hash="'.
dol_escape_htmltag($file[
'expectedhash']).
'">';
493 $out .= img_picto($langs->trans(
"ShowDiffWithOriginal"),
'split',
'class="paddingleft"');
495 $out .=
'</td>'.
"\n";
496 $out .=
'<td class="center" title="'.dol_escape_htmltag($file[
'expectedhash']).
'">'.
dol_escape_htmltag(
dol_trunc($file[
'expectedhash'], 16)).
'</td>'.
"\n";
497 $out .=
'<td class="center" title="'.dol_escape_htmltag($file[
'hash']).
'">'.
dol_escape_htmltag(
dol_trunc($file[
'hash'], 16)).
'</td>'.
"\n";
498 $out .=
'<td class="right">';
499 if ($file[
'expectedsize']) {
502 $out .=
'</td>'.
"\n";
503 $size =
dol_filesize(DOL_DOCUMENT_ROOT.
'/'.$file[
'filename']);
505 $out .=
'<td class="right">'.dol_print_size($size).
'</td>'.
"\n";
506 $out .=
'<td class="right">'.dol_print_date(
dol_filemtime(DOL_DOCUMENT_ROOT.
'/'.$file[
'filename']),
'dayhour').
'</td>'.
"\n";
509 $out .=
'<tr class="liste_total">';
510 $out .=
'<td></td>'.
"\n";
511 $out .=
'<td>'.$langs->trans(
"Total").
'</td>'.
"\n";
512 $out .=
'<td class="center"></td>'.
"\n";
513 $out .=
'<td class="center"></td>'.
"\n";
514 $out .=
'<td class="center"></td>'.
"\n";
515 $out .=
'<td class="right">'.dol_print_size($totalsize).
'</td>'.
"\n";
516 $out .=
'<td class="right"></td>'.
"\n";
519 $out .=
'<tr class="oddeven"><td colspan="7"><span class="opacitymedium">'.$langs->trans(
"None").
'</span></td></tr>';
525 $out .=
"<script>\n";
526 $out .=
"jQuery(document).ready(function() {\n";
527 $out .=
" jQuery(\".showfilediff\").on(\"click\", function(e) {\n";
528 $out .=
" e.preventDefault();\n";
529 $out .=
" var link = jQuery(this);\n";
530 $out .=
" var row = link.closest(\"tr\");\n";
531 $out .=
" var existing = row.next(\".filediffrow\");\n";
532 $out .=
" if (existing.length) { existing.toggle(); return false; }\n";
533 $out .=
" var colspan = row.children(\"td\").length;\n";
534 $out .=
" var newrowstring = '';\n";
535 $out .=
" newrowstring = newrowstring + '<tr class=\"filediffrow\"><td colspan=\"'+colspan+'\"><div class=\"filediffcontent opacitymedium\">';\n";
536 $out .=
" newrowstring = newrowstring + '".dol_escape_js($langs->trans(
"Loading").
"...").
"';\n";
537 $out .=
" newrowstring = newrowstring + '</div></td></tr>';\n";
538 $out .=
" newrow = jQuery(newrowstring);\n";
539 $out .=
" row.after(newrow);\n";
540 $out .=
" jQuery.get('".dol_escape_js(DOL_URL_ROOT.
'/blockedlog/admin/filecheck_diff.php').
"', ";
541 $out .=
' { file: link.attr("data-file"), algo: link.attr("data-algo"), expectedhash: link.attr("data-hash"), token: \''.newToken().
'\' },
function(data) {
'."\n";
542 $out .= " newrow.find(\".filediffcontent\").removeClass(\"opacitymedium\").html(data);\n";
543 $out .= " }).fail(function() {\n";
544 $out .= " newrow.find(\".filediffcontent\").html('".dol_escape_js($langs->trans("Error
"))."');\n";
546 $out .= " return false;\n";
549 $out .= "</script>\n";
554 if (empty($onlymodifiedorremoved)) {
555 $out .= load_fiche_titre($langs->trans("FilesAdded"));
558 $out .= '<div
class=
"div-table-responsive-no-min">
';
559 $out .= '<
table class=
"noborder">
';
560 $out .= '<tr
class=
"liste_titre">
';
561 $out .= '<td>#</td>
';
562 $out .= '<td>
'.$langs->trans("Filename").'</td>
';
563 $out .= '<td
class=
"center">
'.$langs->trans("ExpectedChecksum").'</td>
';
564 $out .= '<td
class=
"center">
'.$langs->trans("CurrentChecksum").'</td>
';
565 $out .= '<td
class=
"right">
'.$langs->trans("Size").'</td>
';
566 $out .= '<td
class=
"right">
'.$langs->trans("DateModification").'</td>
';
567 $out .= '</tr>
'."\n";
568 $tmpfilelist3 = dol_sort_array($file_list['added
'], 'filename
');
569 if (is_array($tmpfilelist3) && count($tmpfilelist3)) {
571 foreach ($tmpfilelist3 as $file) {
573 $out .= '<tr
class=
"oddeven">
';
574 $out .= '<td>
'.$i.'</td>
'."\n";
575 $out .= '<td>
'.dol_escape_htmltag($file['filename
']);
576 if (!preg_match('/^win/i
', PHP_OS)) {
577 $htmltext = $langs->trans("YouCanDeleteFileOnServerWith", 'rm
'.DOL_DOCUMENT_ROOT.$file['filename
']); // The slash is included int file['filename
']
578 $out .= ' '.$form->textwithpicto('', $htmltext, 1, 'help
', '', 0, 2, 'helprm
'.$i);
580 $out .= '</td>
'."\n";
581 $out .= '<td
class=
"center" title=
"'.dol_escape_htmltag((string) $file['expectedhash']).'">
'.dol_escape_htmltag(dol_trunc((string) $file['expectedhash
'], 16)).'</td>
'."\n"; // @phan-suppress-current-line PhanTypeInvalidDimOffset
582 $out .= '<td
class=
"center" title=
"'.dol_escape_htmltag((string) $file['hash']).'">
'.dol_escape_htmltag(dol_trunc($file['hash
'], 16)).'</td>
'."\n";
583 $size = dol_filesize(DOL_DOCUMENT_ROOT.'/
'.$file['filename
']);
585 $out .= '<td
class=
"right">
'.dol_print_size($size).'</td>
'."\n";
586 $out .= '<td
class=
"right nowraponall">
'.dol_print_date(dol_filemtime(DOL_DOCUMENT_ROOT.'/
'.$file['filename
']), 'dayhour
').'</td>
'."\n";
589 $out .= '<tr
class=
"liste_total">
';
590 $out .= '<td></td>
'."\n";
591 $out .= '<td>
'.$langs->trans("Total").'</td>
'."\n";
592 $out .= '<td
class=
"center"></td>
'."\n";
593 $out .= '<td
class=
"center"></td>
'."\n";
594 $out .= '<td
class=
"right">
'.dol_print_size($totalsize).'</td>
'."\n";
595 $out .= '<td
class=
"right"></td>
'."\n";
598 $out .= '<tr
class=
"oddeven"><td colspan=
"6"><span
class=
"opacitymedium">
'.$langs->trans("None").'</span></td></tr>
';
604 print '<div
class=
"error">
';
605 print 'Error: Failed to found <b>dolibarr_htdocs_dir</b> into content of XML file:<br>
'.dol_escape_htmltag(dol_trunc($xmlfile, 500));
613 if (is_object($xml->dolibarr_scripts_dir[0])) {
614 $file_list = array();
615 $ret = getFilesUpdated($file_list, $xml->dolibarr_htdocs_dir[0], '', ???, $checksumconcat); // Fill array $file_list
616 '@phan-var-force array{insignature:
string[],missing?:array<array{filename:string,expectedhash:string,expectedsize:string,algo:
string}>,updated:array<array{filename:string,expectedhash:string,expectedsize:string,hash:string,algo:
string}>} $file_list
';
620 // Section Globalchecksum
621 asort($checksumconcat); // Sort list of checksum
623 $checksumget = hash($algo, implode(',
', $checksumconcat));
625 if ($mode == 'unalterable
') {
626 $nameofsection = 'dolibarr_unalterable_files_checksum
';
627 $checksumtoget = trim((string) $xml->dolibarr_unalterable_files_checksum);
629 $nameofsection = 'dolibarr_htdocs_dir_checksum
';
630 $checksumtoget = trim((string) $xml->dolibarr_htdocs_dir_checksum);
635 $outexpectedchecksum = ($checksumtoget ? $checksumtoget : $langs->trans("Unknown"));
636 $outcurrentchecksumtext = '';
637 if ($checksumget == $checksumtoget) {
638 if (empty($onlymodifiedorremoved) && !empty($file_list['added
'])) {
639 $resultcode = 'warning
';
640 $resultcomment = 'FileIntegrityIsOkButFilesWereAdded
';
641 $outcurrentchecksum = $checksumget;
642 $outcurrentchecksumtext .= img_picto('', 'tick
').' <span
class=
"'.$resultcode.'">
'.$langs->trans($resultcomment).'</span>
';
645 $resultcomment = 'Success
';
646 $outcurrentchecksum = '<span
class=
"'.$resultcode.'" title=
"Checksum of all current checksums concatenated separated by a comma">
'.$checksumget.'</span>
';
647 $outcurrentchecksumtext.= img_picto('', 'tick
').' <span
class=
"badge badge-status4 badge-status '.$resultcode.'">
'.$langs->trans($resultcomment).'</span>
';
650 $resultcode = 'error
';
651 $resultcomment = 'FileIntegrityIsKO
';
652 $outcurrentchecksum = '<span
class=
"'.$resultcode.'" title=
"Checksum of all current checksums concatenated separated by a comma">
'.$checksumget.'</span>
';
653 $outcurrentchecksumtext .= img_picto('', 'error
').' <span
class=
"'.$resultcode.'">
'.$langs->trans($resultcomment).'</span>
';
657 if (empty($tmpfilelist) && empty($tmpfilelist2) && empty($tmpfilelist3) && $resultcode == 'ok
') {
658 setEventMessages($langs->trans("FileIntegrityIsStrictlyConformedWithReference"), null, 'mesgs
');
660 if ($resultcode == 'warning
') {
661 setEventMessages($langs->trans($resultcomment), null, 'warnings
');
663 setEventMessages($langs->trans("FileIntegritySomeFilesWereRemovedOrModified"), null, 'errors
');
667 $outforlistoffiles = '';
668 if ($mode == 'unalterable
') {
669 print load_fiche_titre($langs->trans("UnalterableFilesChecksum"));
671 // Print list of files
672 $outforlistoffiles = '<a href=
"#" onclick=
"console.log(\'Click\'); jQuery(\'#listofunalterablefiles\').toggle(); return false;">
'.$langs->trans("ShowListOfFiles").'</a><br>
';
673 $outforlistoffiles .= '<textarea
id=
"listofunalterablefiles" class=
"hideobject quatrevingtpercent" rows=
"12" spellcheck=
"false">
';
675 foreach ($listoffilestoanalyze as $dirtoanalyze) {
677 if (!empty($dirtoanalyze->md5file)) {
678 $entry = $dirtoanalyze->md5file;
680 } elseif (!empty($dirtoanalyze->sha256file)) {
681 $entry = $dirtoanalyze->sha256file;
685 foreach ($entry as $filetoanalyze) {
687 $outforlistoffiles .= "\n";
689 $outforlistoffiles .= (string) $dirtoanalyze['name'];
690 $outforlistoffiles .= '/
';
691 $outforlistoffiles .= (string) $filetoanalyze['name'];
695 $outforlistoffiles .= '</textarea>
';
696 $outforlistoffiles .= '<br>
';
698 print load_fiche_titre($langs->trans("GlobalChecksum"));
702 print '<div
class=
"div-table-responsive-no-min">
';
703 print '<
table class=
"noborder">
';
704 print '<tr
class=
"liste_titre">
';
705 print '<td>
'.$langs->trans("ExpectedChecksum").' <span
class=
"opacitymedium">(
'.$algo.')</span></td>
';
706 print '<td>
'.$langs->trans("CurrentChecksum").' <span
class=
"opacitymedium">(
'.$algo.')</span></td>
';
710 print '<span title=
"Checksum of all checksums in file separated by a comma and saved into '.$nameofsection.'">
';
711 print $outexpectedchecksum;
714 print $outcurrentchecksum;
718 print $outcurrentchecksumtext.'<br>
';
721 print $outforlistoffiles;
versiondolibarrarray()
Return version Dolibarr.
versioncompare($versionarray1, $versionarray2)
Compare 2 versions (stored into 2 arrays), to know if a version (a,b,c) is lower than (x,...
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...
isALNERunningVersion($blockedlogusagealreadychecked=0, $blockedlogmoduleonalreadychecked=0)
Return if the application is executed with the LNE requirements on.
Class to manage Dolibarr users.
Class to describe a BlockedLog module.
getFilesUpdated(&$file_list, SimpleXMLElement $dir, $path='', $pathref='', &$checksumconcat=array())
Function to get list of updated or modified files.
dol_filemtime($pathoffile)
Return time of a file.
dol_filesize($pathoffile)
Return size of a file.
dol_uncompress($inputfile, $outputdir)
Uncompress a file.
dol_is_file($pathoffile)
Return if path is a file.
dol_dir_list($utf8_path, $types="all", $recursive=0, $filter="", $excludefilter=null, $sortcriteria="name", $sortorder=SORT_ASC, $mode=0, $nohook=0, $relativename="", $donotfollowsymlinks=0, $nbsecondsold=0)
Scan a directory and return a list of files/directories.
dol_print_size($size, $shortvalue=0, $shortunit=0)
Return string with formatted size.
dol_sanitizeFileName($str, $newstr='_', $unaccent=1, $includequotes=0, $allowdash=0)
Clean a string to use it as a file name.
dol_sort_array(&$array, $index, $order='asc', $natsort=0, $case_sensitive=0, $keepindex=0)
Advanced sort array by the value of a given key, which produces ascending (default) or descending out...
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0, $nodefault=0)
Return value of a param into GET or POST supervariable.
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs=null, $encodetooutput=false, $decorate=0)
Output date in a string format according to outputlangs (or langs if not defined).
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.
dol_mkdir($dir, $dataroot='', $newmask='')
Creation of a directory (this can create recursive subdir)
getURLContent($url, $postorget='GET', $param='', $followlocation=1, $addheaders=array(), $allowedschemes=array('http', 'https'), $localurl=0, $ssl_verifypeer=-1, $timeoutconnect=0, $timeoutresponse=0, $otherCurlOptions=array(), $morelogsuffix='')
Function to get a content from an URL (use proxy if proxy defined).
treeview li table
No Email.
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='', $morecssonpicto='widthpictotitle')
Load a title with picto.
info_admin($text, $infoonimgalt=0, $nodiv=0, $admin='1', $morecss='hideonsmartphone', $textfordropdown='', $picto='', $textonpictotooltip='', $cssfordropdown='info_admin')
Show information in HTML for admin users or standard users.
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $noescapetags='', $escapeonlyhtmltags=0, $cleanalsojavascript=0)
$conf db name
Only used if Module[ID]Name translation string is not found.
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.