10.2.dev25 en-têtes des logs + permissions des nouveaux fichiers
This commit is contained in:
parent
508cd838df
commit
5151f64beb
|
@ -39,7 +39,7 @@ class common {
|
||||||
const ACCESS_TIMER = 1800;
|
const ACCESS_TIMER = 1800;
|
||||||
|
|
||||||
// Numéro de version
|
// Numéro de version
|
||||||
const ZWII_VERSION = '10.2.00.dev24';
|
const ZWII_VERSION = '10.2.00.dev25';
|
||||||
const ZWII_UPDATE_CHANNEL = "v10";
|
const ZWII_UPDATE_CHANNEL = "v10";
|
||||||
|
|
||||||
public static $actions = [];
|
public static $actions = [];
|
||||||
|
@ -1313,6 +1313,9 @@ class common {
|
||||||
if (file_exists(self::DATA_DIR . 'theme.css')) {
|
if (file_exists(self::DATA_DIR . 'theme.css')) {
|
||||||
unlink(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]);
|
$this->setData(['core', 'dataVersion', 10200]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1586,7 +1589,7 @@ class core extends common {
|
||||||
}
|
}
|
||||||
// Journalisation
|
// Journalisation
|
||||||
$dataLog = strftime('%d/%m/%y',time()) . ';' . strftime('%R',time()) . ';' ;
|
$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 .= $this->getUrl();
|
||||||
$dataLog .= PHP_EOL;
|
$dataLog .= PHP_EOL;
|
||||||
if ($this->getData(['config','connect','log'])) {
|
if ($this->getData(['config','connect','log'])) {
|
||||||
|
|
|
@ -608,6 +608,9 @@ class config extends common {
|
||||||
public function logReset() {
|
public function logReset() {
|
||||||
if ( file_exists(self::DATA_DIR . 'journal.log') ) {
|
if ( file_exists(self::DATA_DIR . 'journal.log') ) {
|
||||||
unlink(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
|
// Valeurs en sortie
|
||||||
$this->addOutput([
|
$this->addOutput([
|
||||||
'redirect' => helper::baseUrl() . 'config',
|
'redirect' => helper::baseUrl() . 'config',
|
||||||
|
@ -618,7 +621,7 @@ class config extends common {
|
||||||
// Valeurs en sortie
|
// Valeurs en sortie
|
||||||
$this->addOutput([
|
$this->addOutput([
|
||||||
'redirect' => helper::baseUrl() . 'config',
|
'redirect' => helper::baseUrl() . 'config',
|
||||||
'notification' => 'Pas de journal à effacer',
|
'notification' => 'Aucun journal à effacer',
|
||||||
'state' => false
|
'state' => false
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
@ -632,6 +635,7 @@ class config extends common {
|
||||||
*/
|
*/
|
||||||
public function logDownload() {
|
public function logDownload() {
|
||||||
$fileName = self::DATA_DIR . 'journal.log';
|
$fileName = self::DATA_DIR . 'journal.log';
|
||||||
|
if (file_exists($fileName)) {
|
||||||
header('Content-Type: application/octet-stream');
|
header('Content-Type: application/octet-stream');
|
||||||
header('Content-Disposition: attachment; filename="' . $fileName . '"');
|
header('Content-Disposition: attachment; filename="' . $fileName . '"');
|
||||||
header('Content-Length: ' . filesize($fileName));
|
header('Content-Length: ' . filesize($fileName));
|
||||||
|
@ -645,20 +649,31 @@ class config extends common {
|
||||||
'title' => 'Configuration',
|
'title' => 'Configuration',
|
||||||
'view' => 'index'
|
'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
|
* Tableau des IP blacklistés
|
||||||
*/
|
*/
|
||||||
public function blacklistDownload () {
|
public function blacklistDownload () {
|
||||||
|
$fileName = self::TEMP_DIR . 'blacklist.log';
|
||||||
|
$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']);
|
$d = $this->getData(['blacklist']);
|
||||||
$data = '';
|
$data = '';
|
||||||
foreach ($d as $key => $item) {
|
foreach ($d as $key => $item) {
|
||||||
$data .= $key . ';' . $item['ip'] . ';' . strftime('%d/%m/%y',$item['lastFail']) . ';' ;
|
$data .= strftime('%d/%m/%y',$item['lastFail']) . strftime('%R',$item['lastFail']) . ';' ;
|
||||||
$data .= strftime('%R',$item['lastFail']) . ';' . $item['connectFail'] . PHP_EOL;
|
$data .= $key . ';' . $item['ip'] . ';' . $item['connectFail'] . PHP_EOL;
|
||||||
}
|
}
|
||||||
$fileName = self::TEMP_DIR . 'blacklist.log';
|
file_put_contents($fileName,$data,FILE_APPEND);
|
||||||
file_put_contents($fileName,$data);
|
|
||||||
header('Content-Type: application/octet-stream');
|
header('Content-Type: application/octet-stream');
|
||||||
header('Content-Disposition: attachment; filename="' . $fileName . '"');
|
header('Content-Disposition: attachment; filename="' . $fileName . '"');
|
||||||
header('Content-Length: ' . filesize($fileName));
|
header('Content-Length: ' . filesize($fileName));
|
||||||
|
@ -673,6 +688,14 @@ class config extends common {
|
||||||
'title' => 'Configuration',
|
'title' => 'Configuration',
|
||||||
'view' => 'index'
|
'view' => 'index'
|
||||||
]);
|
]);
|
||||||
|
} else {
|
||||||
|
// Valeurs en sortie
|
||||||
|
$this->addOutput([
|
||||||
|
'redirect' => helper::baseUrl() . 'config',
|
||||||
|
'notification' => 'Aucune liste noire à télécharger',
|
||||||
|
'state' => false
|
||||||
|
]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue