2020-08-03 15:29:19 +02:00
|
|
|
<?php
|
2020-09-07 15:04:06 +02:00
|
|
|
/*
|
|
|
|
* OpenSTAManager: il software gestionale open source per l'assistenza tecnica e la fatturazione
|
2021-01-20 15:08:51 +01:00
|
|
|
* Copyright (C) DevCode s.r.l.
|
2020-09-07 15:04:06 +02:00
|
|
|
*
|
|
|
|
* 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 <https://www.gnu.org/licenses/>.
|
|
|
|
*/
|
2024-03-03 17:52:50 +01:00
|
|
|
use Models\OperationLog;
|
2020-08-03 15:29:19 +02:00
|
|
|
|
|
|
|
include_once __DIR__.'/../../core.php';
|
|
|
|
|
|
|
|
$file = basename(__FILE__);
|
|
|
|
$effettua_controllo = filter('effettua_controllo');
|
|
|
|
|
|
|
|
// Schermata di caricamento delle informazioni
|
|
|
|
if (empty($effettua_controllo)) {
|
|
|
|
echo '
|
|
|
|
<div id="righe_controlli">
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="alert alert-info" id="box-loading">
|
|
|
|
<i class="fa fa-spinner fa-spin"></i> '.tr('Caricamento in corso').'...
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
var content = $("#righe_controlli");
|
|
|
|
var loader = $("#box-loading");
|
|
|
|
$(document).ready(function () {
|
|
|
|
loader.show();
|
|
|
|
|
|
|
|
content.html("");
|
2024-03-03 17:52:50 +01:00
|
|
|
content.load("'.$structure->fileurl($file).'?effettua_controllo=1&id_module='.$id_module.'", function() {
|
2020-08-03 15:29:19 +02:00
|
|
|
loader.hide();
|
|
|
|
});
|
|
|
|
})
|
|
|
|
</script>';
|
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2020-09-23 13:36:37 +02:00
|
|
|
$contents = file_get_contents(base_dir().'/checksum.json');
|
2020-08-03 15:29:19 +02:00
|
|
|
$checksum = json_decode($contents);
|
|
|
|
|
|
|
|
if (empty($checksum)) {
|
|
|
|
echo '
|
|
|
|
<div class="alert alert-warning">
|
|
|
|
<i class="fa fa-warning"></i> '.tr('Impossibile effettuare controlli di integrità in assenza del file _FILE_', [
|
|
|
|
'_FILE_' => '<b>checksum.json</b>',
|
|
|
|
]).'.
|
|
|
|
</div>';
|
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Controllo degli errori
|
|
|
|
$errors = [];
|
|
|
|
foreach ($checksum as $file => $md5) {
|
2020-09-23 13:36:37 +02:00
|
|
|
$verifica = md5_file(base_dir().'/'.$file);
|
2020-08-03 15:29:19 +02:00
|
|
|
if ($verifica != $md5) {
|
|
|
|
$errors[] = $file;
|
|
|
|
}
|
|
|
|
}
|
2024-03-03 17:52:50 +01:00
|
|
|
OperationLog::setInfo('id_module', $id_module);
|
2020-08-03 15:29:19 +02:00
|
|
|
|
|
|
|
// Schermata di visualizzazione degli errori
|
|
|
|
if (!empty($errors)) {
|
2024-03-03 17:52:50 +01:00
|
|
|
OperationLog::setInfo('options', 'KO');
|
2020-08-03 15:29:19 +02:00
|
|
|
echo '
|
2020-08-28 11:20:20 +02:00
|
|
|
<p>'.tr("Segue l'elenco dei file che presentano checksum diverso rispetto a quello registrato nella versione ufficiale").'.</p>
|
2020-08-03 15:29:19 +02:00
|
|
|
<div class="alert alert-warning">
|
|
|
|
<i class="fa fa-warning"></i>
|
|
|
|
'.tr('Attenzione: questa funzionalità può presentare dei risultati falsamente positivi, sulla base del contenuto del file _FILE_', [
|
2024-03-22 15:52:24 +01:00
|
|
|
'_FILE_' => '<b>checksum.json</b>',
|
|
|
|
]).'.
|
2020-08-03 15:29:19 +02:00
|
|
|
</div>
|
|
|
|
|
|
|
|
<table class="table table-bordered table-striped">
|
|
|
|
<thead>
|
|
|
|
<tr>
|
|
|
|
<th>'.tr('File con integrità errata').'</th>
|
|
|
|
</tr>
|
|
|
|
</thead>
|
|
|
|
|
|
|
|
<tbody>';
|
|
|
|
|
|
|
|
foreach ($errors as $error) {
|
|
|
|
echo '
|
|
|
|
<tr>
|
|
|
|
<td>
|
|
|
|
'.$error.'
|
|
|
|
</td>
|
|
|
|
</tr>';
|
|
|
|
}
|
|
|
|
|
|
|
|
echo '
|
|
|
|
</tbody>
|
|
|
|
</table>';
|
|
|
|
} else {
|
2024-03-03 17:52:50 +01:00
|
|
|
OperationLog::setInfo('options', 'OK');
|
|
|
|
|
2020-08-03 15:29:19 +02:00
|
|
|
echo '
|
|
|
|
<div class="alert alert-info">
|
|
|
|
<i class="fa fa-info-circle"></i> '.tr('Nessun file con problemi di integrità').'.
|
|
|
|
</div>';
|
|
|
|
}
|
2024-03-22 15:52:24 +01:00
|
|
|
OperationLog::build('effettua_controllo');
|