10.2.dev25 en-têtes des logs + permissions des nouveaux fichiers

This commit is contained in:
Fred Tempez 2020-06-03 10:06:11 +02:00
parent 508cd838df
commit 5151f64beb
4 changed files with 63 additions and 37 deletions

View File

@ -39,7 +39,7 @@ class common {
const ACCESS_TIMER = 1800;
// Numéro de version
const ZWII_VERSION = '10.2.00.dev24';
const ZWII_VERSION = '10.2.00.dev25';
const ZWII_UPDATE_CHANNEL = "v10";
public static $actions = [];
@ -1313,6 +1313,9 @@ class common {
if (file_exists(self::DATA_DIR . 'theme.css')) {
unlink(self::DATA_DIR . 'theme.css');
}
// Créer les en-têtes du journal
$d = 'Date;Heure;Id;Action' . PHP_EOL;
file_put_contents(self::DATA_DIR . 'journal.log',$d);
$this->setData(['core', 'dataVersion', 10200]);
}
}
@ -1586,7 +1589,7 @@ class core extends common {
}
// Journalisation
$dataLog = strftime('%d/%m/%y',time()) . ';' . strftime('%R',time()) . ';' ;
$dataLog .= $this->getUser('id') ? $this->getUser('id') . ';' : 'visiteur' . ';';
$dataLog .= $this->getUser('id') ? $this->getUser('id') . ';' : 'anonyme' . ';';
$dataLog .= $this->getUrl();
$dataLog .= PHP_EOL;
if ($this->getData(['config','connect','log'])) {

View File

@ -608,6 +608,9 @@ class config extends common {
public function logReset() {
if ( file_exists(self::DATA_DIR . 'journal.log') ) {
unlink(self::DATA_DIR . 'journal.log');
// Créer les en-têtes des journaux
$d = 'Date;Heure;Id;Action' . PHP_EOL;
file_put_contents(self::DATA_DIR . 'journal.log',$d);
// Valeurs en sortie
$this->addOutput([
'redirect' => helper::baseUrl() . 'config',
@ -618,7 +621,7 @@ class config extends common {
// Valeurs en sortie
$this->addOutput([
'redirect' => helper::baseUrl() . 'config',
'notification' => 'Pas de journal à effacer',
'notification' => 'Aucun journal à effacer',
'state' => false
]);
}
@ -632,47 +635,67 @@ class config extends common {
*/
public function logDownload() {
$fileName = self::DATA_DIR . 'journal.log';
header('Content-Type: application/octet-stream');
header('Content-Disposition: attachment; filename="' . $fileName . '"');
header('Content-Length: ' . filesize($fileName));
readfile( $fileName);
// Valeurs en sortie
$this->addOutput([
'display' => self::DISPLAY_RAW
]);
// Valeurs en sortie
$this->addOutput([
'title' => 'Configuration',
'view' => 'index'
]);
if (file_exists($fileName)) {
header('Content-Type: application/octet-stream');
header('Content-Disposition: attachment; filename="' . $fileName . '"');
header('Content-Length: ' . filesize($fileName));
readfile( $fileName);
// Valeurs en sortie
$this->addOutput([
'display' => self::DISPLAY_RAW
]);
// Valeurs en sortie
$this->addOutput([
'title' => 'Configuration',
'view' => 'index'
]);
} else {
// Valeurs en sortie
$this->addOutput([
'redirect' => helper::baseUrl() . 'config',
'notification' => 'Aucun fichier journal à télécharger',
'state' => false
]);
}
}
/**
* Tableau des IP blacklistés
*/
public function blacklistDownload () {
$d = $this->getData(['blacklist']);
$data = '';
foreach ($d as $key => $item) {
$data .= $key . ';' . $item['ip'] . ';' . strftime('%d/%m/%y',$item['lastFail']) . ';' ;
$data .= strftime('%R',$item['lastFail']) . ';' . $item['connectFail'] . PHP_EOL;
}
$fileName = self::TEMP_DIR . 'blacklist.log';
file_put_contents($fileName,$data);
header('Content-Type: application/octet-stream');
header('Content-Disposition: attachment; filename="' . $fileName . '"');
header('Content-Length: ' . filesize($fileName));
readfile( $fileName);
// Valeurs en sortie
$this->addOutput([
'display' => self::DISPLAY_RAW
]);
unlink(self::TEMP_DIR . 'blacklist.log');
// Valeurs en sortie
$this->addOutput([
'title' => 'Configuration',
'view' => 'index'
]);
$d = 'Date dernière tentative;Heure dernière tentative;Id;Adresse IP;Nombre d\'échecs' . PHP_EOL;
file_put_contents($fileName,$d);
if ( file_exists($fileName) ) {
$d = $this->getData(['blacklist']);
$data = '';
foreach ($d as $key => $item) {
$data .= strftime('%d/%m/%y',$item['lastFail']) . strftime('%R',$item['lastFail']) . ';' ;
$data .= $key . ';' . $item['ip'] . ';' . $item['connectFail'] . PHP_EOL;
}
file_put_contents($fileName,$data,FILE_APPEND);
header('Content-Type: application/octet-stream');
header('Content-Disposition: attachment; filename="' . $fileName . '"');
header('Content-Length: ' . filesize($fileName));
readfile( $fileName);
// Valeurs en sortie
$this->addOutput([
'display' => self::DISPLAY_RAW
]);
unlink(self::TEMP_DIR . 'blacklist.log');
// Valeurs en sortie
$this->addOutput([
'title' => 'Configuration',
'view' => 'index'
]);
} else {
// Valeurs en sortie
$this->addOutput([
'redirect' => helper::baseUrl() . 'config',
'notification' => 'Aucune liste noire à télécharger',
'state' => false
]);
}
}
/**

0
core/vendor/filemanager/dialog.php vendored Normal file → Executable file
View File

0
core/vendor/jquery/jquery.min.js vendored Normal file → Executable file
View File