dolibarr 21.0.3
filecheck.php
Go to the documentation of this file.
1<?php
2/* Copyright (C) 2005-2020 Laurent Destailleur <eldy@users.sourceforge.net>
3 * Copyright (C) 2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
4 * Copyright (C) 2007-2012 Regis Houssin <regis.houssin@inodbox.com>
5 * Copyright (C) 2015-2024 Frédéric France <frederic.france@free.fr>
6 * Copyright (C) 2017 Nicolas ZABOURI <info@inovea-conseil.com>
7 * Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 3 of the License, or
12 * (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program. If not, see <https://www.gnu.org/licenses/>.
21 */
22
28// Load Dolibarr environment
29require '../../main.inc.php';
30require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
31require_once DOL_DOCUMENT_ROOT.'/core/lib/geturl.lib.php';
32
42$langs->load("admin");
43
44if (!$user->admin) {
46}
47
48$error = 0;
49
50
51/*
52 * View
53 */
54
55@set_time_limit(300);
56
57llxHeader('', '', '', '', 0, 0, '', '', '', 'mod-admin page-system_filecheck');
58
59print load_fiche_titre($langs->trans("FileCheckDolibarr"), '', 'title_setup');
60
61print '<div class="opacitymedium justify">'.$langs->trans("FileCheckDesc").'</div><br><br>';
62
63// Version
64print '<div class="div-table-responsive-no-min">';
65print '<table class="noborder centpercent">';
66print '<tr class="liste_titre"><td>'.$langs->trans("Version").'</td><td></td></tr>'."\n";
67print '<tr class="oddeven"><td width="300">'.$langs->trans("VersionLastInstall").'</td><td>'.getDolGlobalString('MAIN_VERSION_LAST_INSTALL').'</td></tr>'."\n";
68print '<tr class="oddeven"><td width="300">'.$langs->trans("VersionLastUpgrade").'</td><td>'.getDolGlobalString('MAIN_VERSION_LAST_UPGRADE').'</td></tr>'."\n";
69print '<tr class="oddeven"><td width="300">'.$langs->trans("VersionProgram").'</td><td>'.DOL_VERSION;
70// If current version differs from last upgrade
71if (!getDolGlobalString('MAIN_VERSION_LAST_UPGRADE')) {
72 // Compare version with last install database version (upgrades never occurred)
73 if (DOL_VERSION != getDolGlobalString('MAIN_VERSION_LAST_INSTALL')) {
74 print ' '.img_warning($langs->trans("RunningUpdateProcessMayBeRequired", DOL_VERSION, getDolGlobalString('MAIN_VERSION_LAST_INSTALL')));
75 }
76} else {
77 // Compare version with last upgrade database version
78 if (DOL_VERSION != $conf->global->MAIN_VERSION_LAST_UPGRADE) {
79 print ' '.img_warning($langs->trans("RunningUpdateProcessMayBeRequired", DOL_VERSION, getDolGlobalString('MAIN_VERSION_LAST_UPGRADE')));
80 }
81}
82print '</td></tr>'."\n";
83print '</table>';
84print '</div>';
85print '<br>';
86
87
88// Modified or missing files
89$file_list = array('missing' => array(), 'updated' => array());
90
91// Local file to compare to
92$xmlshortfile = dol_sanitizeFileName(GETPOST('xmlshortfile', 'alpha') ? GETPOST('xmlshortfile', 'alpha') : 'filelist-'.DOL_VERSION.getDolGlobalString('MAIN_FILECHECK_LOCAL_SUFFIX').'.xml'.getDolGlobalString('MAIN_FILECHECK_LOCAL_EXT'));
93
94$xmlfile = DOL_DOCUMENT_ROOT.'/install/'.$xmlshortfile;
95if (!preg_match('/\.zip$/i', $xmlfile) && dol_is_file($xmlfile.'.zip')) {
96 $xmlfile .= '.zip';
97}
98
99// Remote file to compare to
100$xmlremote = GETPOST('xmlremote', 'alphanohtml');
101if (empty($xmlremote) && getDolGlobalString('MAIN_FILECHECK_URL')) {
102 $xmlremote = getDolGlobalString('MAIN_FILECHECK_URL');
103}
104$param = 'MAIN_FILECHECK_URL_'.DOL_VERSION;
105if (empty($xmlremote) && getDolGlobalString($param)) {
106 $xmlremote = getDolGlobalString($param);
107}
108if (empty($xmlremote)) {
109 $xmlremote = 'https://www.dolibarr.org/files/stable/signatures/filelist-'.DOL_VERSION.'.xml';
110}
111if ($xmlremote && !preg_match('/^https?:\/\//', $xmlremote)) {
112 $langs->load("errors");
113 setEventMessages($langs->trans("ErrorURLMustStartWithHttp", $xmlremote), null, 'errors');
114 $error++;
115} elseif ($xmlremote && !preg_match('/\.xml$/', $xmlremote)) {
116 $langs->load("errors");
117 setEventMessages($langs->trans("ErrorURLMustEndWith", $xmlremote, '.xml'), null, 'errors');
118 $error++;
119}
120
121// Test if remote test is ok
122$enableremotecheck = true;
123if (preg_match('/beta|alpha|rc/i', DOL_VERSION) || getDolGlobalString('MAIN_ALLOW_INTEGRITY_CHECK_ON_UNSTABLE')) {
124 $enableremotecheck = false;
125}
126$enableremotecheck = true;
127
128print '<form name="check" action="'.$_SERVER["PHP_SELF"].'">';
129print '<input type="hidden" name="token" value="'.newToken().'">';
130print $langs->trans("MakeIntegrityAnalysisFrom").':<br>';
131
132print '<div class="divsection">';
133print '<!-- for a local check target=local&xmlshortfile=... -->'."\n";
134if (dol_is_file($xmlfile)) {
135 print '<input type="radio" name="target" id="checkboxlocal" value="local"'.((!GETPOST('target') || GETPOST('target') == 'local') ? 'checked="checked"' : '').'"> <label for="checkboxlocal">'.$langs->trans("LocalSignature").'</label> = ';
136 print '<input name="xmlshortfile" class="flat minwidth400" value="'.dol_escape_htmltag($xmlshortfile).'" spellcheck="false">';
137 print '<br>';
138} else {
139 print '<input type="radio" name="target" id="checkboxlocal" value="local"> <label for="checkboxlocal">'.$langs->trans("LocalSignature").' = ';
140 print '<input name="xmlshortfile" class="flat minwidth400" value="'.dol_escape_htmltag($xmlshortfile).'" spellcheck="false">';
141 print ' <span class="warning">('.$langs->trans("AvailableOnlyOnPackagedVersions").')</span></label>';
142 print '<br>';
143}
144print '<br>';
145print '<!-- for a remote target=remote&xmlremote=... -->'."\n";
146if ($enableremotecheck) {
147 print '<input type="radio" name="target" id="checkboxremote" value="remote"'.(GETPOST('target') == 'remote' ? 'checked="checked"' : '').'> <label for="checkboxremote">'.$langs->trans("RemoteSignature").'</label> = ';
148 print '<input name="xmlremote" class="flat minwidth500" value="'.dol_escape_htmltag($xmlremote).'" spellcheck="false"><br>';
149} else {
150 print '<input type="radio" name="target" id="checkboxremote" value="remote" disabled="disabled"> '.$langs->trans("RemoteSignature").' = '.dol_escape_htmltag($xmlremote);
151 if (!GETPOST('xmlremote')) {
152 print ' <span class="warning">('.$langs->trans("FeatureAvailableOnlyOnStable").')</span>';
153 }
154 print '<br>';
155}
156print '</div>';
157
158print '<div class="center"><input type="submit" name="check" class="button" value="'.$langs->trans("Check").'"></div>';
159print '</form>';
160print '<br>';
161print '<br>';
162
163if (GETPOST('target') == 'local') {
164 if (dol_is_file($xmlfile)) {
165 // If file is a zip file (.../filelist-x.y.z.xml.zip), we uncompress it before
166 if (preg_match('/\.zip$/i', $xmlfile)) {
167 dol_mkdir($conf->admin->dir_temp);
168 $xmlfilenew = preg_replace('/\.zip$/i', '', $xmlfile);
169 $result = dol_uncompress($xmlfile, $conf->admin->dir_temp);
170 if (empty($result['error'])) {
171 $xmlfile = $conf->admin->dir_temp.'/'.basename($xmlfilenew);
172 } else {
173 print $langs->trans('FailedToUncompressFile').': '.$xmlfile;
174 $error++;
175 }
176 }
177 $xml = simplexml_load_file($xmlfile);
178 if ($xml === false) {
179 print '<div class="warning">'.$langs->trans('XmlCorrupted').': '.$xmlfile.'</span>';
180 $error++;
181 }
182 } else {
183 print '<div class="warning">'.$langs->trans('XmlNotFound').': '.$xmlfile.'</span>';
184 $error++;
185 }
186}
187if (GETPOST('target') == 'remote') {
188 $xmlarray = getURLContent($xmlremote, 'GET', '', 1, array(), array('http', 'https'), 0); // Accept http or https links on external remote server only. Same is used into api_setup.class.php.
189
190 // Return array('content'=>response,'curl_error_no'=>errno,'curl_error_msg'=>errmsg...)
191 if (!$xmlarray['curl_error_no'] && $xmlarray['http_code'] != '400' && $xmlarray['http_code'] != '404') {
192 $xmlfile = $xmlarray['content'];
193 //print "xmlfilestart".$xmlfile."xmlfileend";
194 if (LIBXML_VERSION < 20900) {
195 // Avoid load of external entities (security problem).
196 // Required only if LIBXML_VERSION < 20900
197 // @phan-suppress-next-line PhanDeprecatedFunctionInternal
198 libxml_disable_entity_loader(true);
199 }
200
201 $xml = simplexml_load_string($xmlfile, 'SimpleXMLElement', LIBXML_NOCDATA | LIBXML_NONET);
202 } else {
203 $errormsg = $langs->trans('XmlNotFound').': '.$xmlremote.' - '.$xmlarray['http_code'].(($xmlarray['http_code'] == 400 && $xmlarray['content']) ? ' '.$xmlarray['content'] : '').' '.$xmlarray['curl_error_no'].' '.$xmlarray['curl_error_msg'];
204 setEventMessages($errormsg, null, 'errors');
205 $error++;
206 }
207}
208
209
210if (empty($error) && !empty($xml)) {
211 $checksumconcat = array();
212 $file_list = array();
213 $out = '';
214
215 // Forced constants
216 if (is_object($xml->dolibarr_constants[0])) {
217 $out .= load_fiche_titre($langs->trans("ForcedConstants"));
218
219 $out .= '<div class="div-table-responsive-no-min">';
220 $out .= '<table class="noborder">';
221 $out .= '<tr class="liste_titre">';
222 $out .= '<td>#</td>';
223 $out .= '<td>'.$langs->trans("Constant").'</td>';
224 $out .= '<td class="center">'.$langs->trans("ExpectedValue").'</td>';
225 $out .= '<td class="center">'.$langs->trans("Value").'</td>';
226 $out .= '</tr>'."\n";
227
228 $i = 0;
229 foreach ($xml->dolibarr_constants[0]->constant as $constant) { // $constant is a simpleXMLElement
230 $constname = $constant['name'];
231 $constvalue = (string) $constant;
232 $constvalue = (empty($constvalue) ? '0' : $constvalue);
233 // Value found
234 $value = '';
235 if ($constname && getDolGlobalString($constname) != '') {
236 $value = getDolGlobalString($constname);
237 }
238 $valueforchecksum = (empty($value) ? '0' : $value);
239
240 $checksumconcat[] = $valueforchecksum;
241
242 $i++;
243 $out .= '<tr class="oddeven">';
244 $out .= '<td>'.$i.'</td>'."\n";
245 $out .= '<td>'.dol_escape_htmltag($constname).'</td>'."\n";
246 $out .= '<td class="center">'.dol_escape_htmltag($constvalue).'</td>'."\n";
247 $out .= '<td class="center">'.dol_escape_htmltag($valueforchecksum).'</td>'."\n";
248 $out .= "</tr>\n";
249 }
250
251 if ($i == 0) {
252 $out .= '<tr class="oddeven"><td colspan="4"><span class="opacitymedium">'.$langs->trans("None").'</span></td></tr>';
253 }
254 $out .= '</table>';
255 $out .= '</div>';
256
257 $out .= '<br>';
258 }
259
260 // Scan htdocs
261 if (is_object($xml->dolibarr_htdocs_dir[0])) {
262 //var_dump($xml->dolibarr_htdocs_dir[0]['includecustom']);exit;
263 $includecustom = (empty($xml->dolibarr_htdocs_dir[0]['includecustom']) ? 0 : $xml->dolibarr_htdocs_dir[0]['includecustom']);
264
265 // Define qualified files (must be same than into generate_filelist_xml.php and in api_setup.class.php)
266 $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)$';
267 $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)$'; // Exclude dirs
268 $scanfiles = dol_dir_list(DOL_DOCUMENT_ROOT, 'files', 1, $regextoinclude, $regextoexclude);
269
270 // Fill file_list with files in signature, new files, modified files
271 $ret = getFilesUpdated($file_list, $xml->dolibarr_htdocs_dir[0], '', DOL_DOCUMENT_ROOT, $checksumconcat); // Fill array $file_list
272 '@phan-var-force array{insignature:string[],missing?:array<array{filename:string,expectedmd5:string,expectedsize:string}>,updated:array<array{filename:string,expectedmd5:string,expectedsize:string,md5:string}>} $file_list';
273 // Complete with list of new files
274 foreach ($scanfiles as $keyfile => $valfile) {
275 $tmprelativefilename = preg_replace('/^'.preg_quote(DOL_DOCUMENT_ROOT, '/').'/', '', $valfile['fullname']);
276 if (!in_array($tmprelativefilename, $file_list['insignature'])) {
277 $md5newfile = @md5_file($valfile['fullname']); // Can fails if we don't have permission to open/read file
278 $file_list['added'][] = array('filename' => $tmprelativefilename, 'md5' => $md5newfile);
279 }
280 }
281
282 // Files missing
283 $out .= load_fiche_titre($langs->trans("FilesMissing"));
284
285 $out .= '<div class="div-table-responsive-no-min">';
286 $out .= '<table class="noborder">';
287 $out .= '<tr class="liste_titre">';
288 $out .= '<td>#</td>';
289 $out .= '<td>'.$langs->trans("Filename").'</td>';
290 $out .= '<td class="right">'.$langs->trans("ExpectedSize").'</td>';
291 $out .= '<td class="center">'.$langs->trans("ExpectedChecksum").'</td>';
292 $out .= '</tr>'."\n";
293 $tmpfilelist = dol_sort_array($file_list['missing'], 'filename');
294 if (is_array($tmpfilelist) && count($tmpfilelist)) {
295 $i = 0;
296 foreach ($tmpfilelist as $file) {
297 $i++;
298 $out .= '<tr class="oddeven">';
299 $out .= '<td>'.$i.'</td>'."\n";
300 $out .= '<td>'.dol_escape_htmltag($file['filename']).'</td>'."\n";
301 $out .= '<td class="right">';
302 if (!empty($file['expectedsize'])) {
303 $out .= dol_print_size($file['expectedsize']);
304 }
305 $out .= '</td>'."\n";
306 $out .= '<td class="center">'.dol_escape_htmltag($file['expectedmd5']).'</td>'."\n";
307 $out .= "</tr>\n";
308 }
309 } else {
310 $out .= '<tr class="oddeven"><td colspan="4"><span class="opacitymedium">'.$langs->trans("None").'</span></td></tr>';
311 }
312 $out .= '</table>';
313 $out .= '</div>';
314
315 $out .= '<br>';
316
317 // Files modified
318 $out .= load_fiche_titre($langs->trans("FilesModified"));
319
320 $totalsize = 0;
321 $out .= '<div class="div-table-responsive-no-min">';
322 $out .= '<table class="noborder">';
323 $out .= '<tr class="liste_titre">';
324 $out .= '<td>#</td>';
325 $out .= '<td>'.$langs->trans("Filename").'</td>';
326 $out .= '<td class="center">'.$langs->trans("ExpectedChecksum").'</td>';
327 $out .= '<td class="center">'.$langs->trans("CurrentChecksum").'</td>';
328 $out .= '<td class="right">'.$langs->trans("ExpectedSize").'</td>';
329 $out .= '<td class="right">'.$langs->trans("CurrentSize").'</td>';
330 $out .= '<td class="right">'.$langs->trans("DateModification").'</td>';
331 $out .= '</tr>'."\n";
332 $tmpfilelist2 = dol_sort_array($file_list['updated'], 'filename');
333 if (is_array($tmpfilelist2) && count($tmpfilelist2)) {
334 $i = 0;
335 foreach ($tmpfilelist2 as $file) {
336 $i++;
337 $out .= '<tr class="oddeven">';
338 $out .= '<td>'.$i.'</td>'."\n";
339 $out .= '<td>'.dol_escape_htmltag($file['filename']).'</td>'."\n";
340 $out .= '<td class="center">'.dol_escape_htmltag($file['expectedmd5']).'</td>'."\n";
341 $out .= '<td class="center">'.dol_escape_htmltag($file['md5']).'</td>'."\n";
342 $out .= '<td class="right">';
343 if ($file['expectedsize']) {
344 $out .= dol_print_size($file['expectedsize']);
345 }
346 $out .= '</td>'."\n";
347 $size = dol_filesize(DOL_DOCUMENT_ROOT.'/'.$file['filename']);
348 $totalsize += $size;
349 $out .= '<td class="right">'.dol_print_size($size).'</td>'."\n";
350 $out .= '<td class="right">'.dol_print_date(dol_filemtime(DOL_DOCUMENT_ROOT.'/'.$file['filename']), 'dayhour').'</td>'."\n";
351 $out .= "</tr>\n";
352 }
353 $out .= '<tr class="liste_total">';
354 $out .= '<td></td>'."\n";
355 $out .= '<td>'.$langs->trans("Total").'</td>'."\n";
356 $out .= '<td class="center"></td>'."\n";
357 $out .= '<td class="center"></td>'."\n";
358 $out .= '<td class="center"></td>'."\n";
359 $out .= '<td class="right">'.dol_print_size($totalsize).'</td>'."\n";
360 $out .= '<td class="right"></td>'."\n";
361 $out .= "</tr>\n";
362 } else {
363 $out .= '<tr class="oddeven"><td colspan="7"><span class="opacitymedium">'.$langs->trans("None").'</span></td></tr>';
364 }
365 $out .= '</table>';
366 $out .= '</div>';
367
368 $out .= '<br>';
369
370 // Files added
371 $out .= load_fiche_titre($langs->trans("FilesAdded"));
372
373 $totalsize = 0;
374 $out .= '<div class="div-table-responsive-no-min">';
375 $out .= '<table class="noborder">';
376 $out .= '<tr class="liste_titre">';
377 $out .= '<td>#</td>';
378 $out .= '<td>'.$langs->trans("Filename").'</td>';
379 $out .= '<td class="center">'.$langs->trans("ExpectedChecksum").'</td>';
380 $out .= '<td class="center">'.$langs->trans("CurrentChecksum").'</td>';
381 $out .= '<td class="right">'.$langs->trans("Size").'</td>';
382 $out .= '<td class="right">'.$langs->trans("DateModification").'</td>';
383 $out .= '</tr>'."\n";
384 $tmpfilelist3 = dol_sort_array($file_list['added'], 'filename');
385 if (is_array($tmpfilelist3) && count($tmpfilelist3)) {
386 $i = 0;
387 foreach ($tmpfilelist3 as $file) {
388 $i++;
389 $out .= '<tr class="oddeven">';
390 $out .= '<td>'.$i.'</td>'."\n";
391 $out .= '<td>'.dol_escape_htmltag($file['filename']);
392 if (!preg_match('/^win/i', PHP_OS)) {
393 $htmltext = $langs->trans("YouCanDeleteFileOnServerWith", 'rm '.DOL_DOCUMENT_ROOT.$file['filename']); // The slash is included int file['filename']
394 $out .= ' '.$form->textwithpicto('', $htmltext, 1, 'help', '', 0, 2, 'helprm'.$i);
395 }
396 $out .= '</td>'."\n";
397 $out .= '<td class="center">'.dol_escape_htmltag($file['expectedmd5']).'</td>'."\n"; // @phan-suppress-current-line PhanTypeInvalidDimOffset
398 $out .= '<td class="center">'.dol_escape_htmltag($file['md5']).'</td>'."\n";
399 $size = dol_filesize(DOL_DOCUMENT_ROOT.'/'.$file['filename']);
400 $totalsize += $size;
401 $out .= '<td class="right">'.dol_print_size($size).'</td>'."\n";
402 $out .= '<td class="right nowraponall">'.dol_print_date(dol_filemtime(DOL_DOCUMENT_ROOT.'/'.$file['filename']), 'dayhour').'</td>'."\n";
403 $out .= "</tr>\n";
404 }
405 $out .= '<tr class="liste_total">';
406 $out .= '<td></td>'."\n";
407 $out .= '<td>'.$langs->trans("Total").'</td>'."\n";
408 $out .= '<td class="center"></td>'."\n";
409 $out .= '<td class="center"></td>'."\n";
410 $out .= '<td class="right">'.dol_print_size($totalsize).'</td>'."\n";
411 $out .= '<td class="right"></td>'."\n";
412 $out .= "</tr>\n";
413 } else {
414 $out .= '<tr class="oddeven"><td colspan="6"><span class="opacitymedium">'.$langs->trans("None").'</span></td></tr>';
415 }
416 $out .= '</table>';
417 $out .= '</div>';
418 } else {
419 print '<div class="error">';
420 print 'Error: Failed to found <b>dolibarr_htdocs_dir</b> into content of XML file:<br>'.dol_escape_htmltag(dol_trunc($xmlfile, 500));
421 print '</div><br>';
422 $error++;
423 }
424
425
426 // Scan scripts
427 /*
428 if (is_object($xml->dolibarr_script_dir[0]))
429 {
430 $file_list = array();
431 $ret = getFilesUpdated($file_list, $xml->dolibarr_htdocs_dir[0], '', ???, $checksumconcat); // Fill array $file_list
432 '@phan-var-force array{insignature:string[],missing?:array<array{filename:string,expectedmd5:string,expectedsize:string}>,updated:array<array{filename:string,expectedmd5:string,expectedsize:string,md5:string}>} $file_list';
433 }*/
434
435
436 asort($checksumconcat); // Sort list of checksum
437 //var_dump($checksumconcat);
438 $checksumget = md5(implode(',', $checksumconcat));
439 $checksumtoget = trim((string) $xml->dolibarr_htdocs_dir_checksum);
440
441 //var_dump(count($file_list['added']));
442 //var_dump($checksumget);
443 //var_dump($checksumtoget);
444 //var_dump($checksumget == $checksumtoget);
445
446 $resultcomment = '';
447
448 $outexpectedchecksum = ($checksumtoget ? $checksumtoget : $langs->trans("Unknown"));
449 if ($checksumget == $checksumtoget) {
450 if (is_array($file_list['added']) && count($file_list['added'])) {
451 $resultcode = 'warning';
452 $resultcomment = 'FileIntegrityIsOkButFilesWereAdded';
453 $outcurrentchecksum = $checksumget.' - <span class="'.$resultcode.'">'.$langs->trans($resultcomment).'</span>';
454 } else {
455 $resultcode = 'ok';
456 $resultcomment = 'Success';
457 $outcurrentchecksum = '<span class="'.$resultcode.'">'.$checksumget.'</span>';
458 }
459 } else {
460 $resultcode = 'error';
461 $resultcomment = 'Error';
462 $outcurrentchecksum = '<span class="'.$resultcode.'">'.$checksumget.'</span>';
463 }
464
465 // Show warning
466 if (empty($tmpfilelist) && empty($tmpfilelist2) && empty($tmpfilelist3) && $resultcode == 'ok') {
467 setEventMessages($langs->trans("FileIntegrityIsStrictlyConformedWithReference"), null, 'mesgs');
468 } else {
469 if ($resultcode == 'warning') {
470 setEventMessages($langs->trans($resultcomment), null, 'warnings');
471 } else {
472 setEventMessages($langs->trans("FileIntegritySomeFilesWereRemovedOrModified"), null, 'errors');
473 }
474 }
475
476 print load_fiche_titre($langs->trans("GlobalChecksum"));
477 print $langs->trans("ExpectedChecksum").' = '.$outexpectedchecksum.'<br>';
478 print $langs->trans("CurrentChecksum").' = '.$outcurrentchecksum;
479
480 print '<br>';
481 print '<br>';
482
483 // Output detail
484 print $out;
485}
486
487// End of page
488llxFooter();
489$db->close();
490
491exit($error);
llxFooter($comment='', $zone='private', $disabledoutputofmessages=0)
Empty footer.
Definition wrapper.php:87
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.
Definition wrapper.php:71
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.
Definition files.lib.php:63
dol_print_size($size, $shortvalue=0, $shortunit=0)
Return string with formatted size.
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0, $attop=0)
Set event messages in dol_events session object.
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)
Return value of a param into GET or POST supervariable.
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.
dol_sanitizeFileName($str, $newstr='_', $unaccent=1, $includequotes=0)
Clean a string to use it as a file name.
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
dol_mkdir($dir, $dataroot='', $newmask='')
Creation of a directory (this can create recursive subdir)
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0, $noescapetags='', $escapeonlyhtmltags=0, $cleanalsojavascript=0)
Returns text escaped for inclusion in HTML alt or title or value tags, or into values of HTML input f...
getURLContent($url, $postorget='GET', $param='', $followlocation=1, $addheaders=array(), $allowedschemes=array('http', 'https'), $localurl=0, $ssl_verifypeer=-1)
Function to get a content from an URL (use proxy if proxy defined).
global $conf
The following vars must be defined: $type2label $form $conf, $lang, The following vars may also be de...
Definition member.php:79
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.