Durcissselment des contrôles

This commit is contained in:
Fred Tempez 2023-07-04 19:03:27 +02:00
parent 38ed0dc1aa
commit 18f00cbe3c
4 changed files with 389 additions and 308 deletions

View File

@ -647,6 +647,15 @@ class config extends common
public function logReset()
{
// Action interdite
if (
$this->getUser('permission', __CLASS__, __FUNCTION__) !== true
) {
// Valeurs en sortie
$this->addOutput([
'access' => false
]);
} else {
if (file_exists(self::DATA_DIR . 'journal.log')) {
unlink(self::DATA_DIR . 'journal.log');
// Créer les en-têtes des journaux
@ -669,6 +678,7 @@ class config extends common
]);
}
}
}
@ -677,6 +687,15 @@ class config extends common
*/
public function logDownload()
{
// Action interdite
if (
$this->getUser('permission', __CLASS__, __FUNCTION__) !== true
) {
// Valeurs en sortie
$this->addOutput([
'access' => false
]);
} else {
$fileName = self::DATA_DIR . 'journal.log';
if (file_exists($fileName)) {
ob_start();
@ -698,12 +717,22 @@ class config extends common
]);
}
}
}
/**
* Tableau des IP blacklistés
*/
public function blacklistDownload()
{
// Action interdite
if (
$this->getUser('permission', __CLASS__, __FUNCTION__) !== true
) {
// Valeurs en sortie
$this->addOutput([
'access' => false
]);
} else {
ob_start();
$fileName = self::TEMP_DIR . 'blacklist.log';
$d = 'Date dernière tentative;Heure dernière tentative;Id;Adresse IP;Nombre d\'échecs' . PHP_EOL;
@ -736,6 +765,7 @@ class config extends common
]);
}
}
}
/**
* Réinitialiser les ip blacklistées
@ -743,6 +773,15 @@ class config extends common
public function blacklistReset()
{
// Action interdite
if (
$this->getUser('permission', __CLASS__, __FUNCTION__) !== true
) {
// Valeurs en sortie
$this->addOutput([
'access' => false
]);
} else {
if (file_exists(self::DATA_DIR . 'blacklist.json')) {
$this->setData(['blacklist', []]);
// Valeurs en sortie
@ -762,12 +801,22 @@ class config extends common
]);
}
}
}
/**
* Récupération des backups auto dans le gestionnaire de fichiers
*/
public function copyBackups()
{
// Action interdite
if (
$this->getUser('permission', __CLASS__, __FUNCTION__) !== true
) {
// Valeurs en sortie
$this->addOutput([
'access' => false
]);
} else {
$success = $this->copyDir(self::BACKUP_DIR, self::FILE_DIR . 'source/backup');
@ -779,12 +828,22 @@ class config extends common
'state' => $success
]);
}
}
/**
* Vider le dosser des sauvegardes automatisées
*/
public function delBackups()
{
// Action interdite
if (
$this->getUser('permission', __CLASS__, __FUNCTION__) !== true
) {
// Valeurs en sortie
$this->addOutput([
'access' => false
]);
} else {
$path = realpath(self::BACKUP_DIR);
$success = $fail = 0;
foreach (new RecursiveIteratorIterator(new RecursiveDirectoryIterator($path)) as $filename) {
@ -803,4 +862,5 @@ class config extends common
'state' => true
]);
}
}
}

View File

@ -273,6 +273,15 @@ class install extends common
*/
public function steps()
{
// Action interdite
if (
$this->getUser('permission', __CLASS__, __FUNCTION__) !== true
) {
// Valeurs en sortie
$this->addOutput([
'access' => false
]);
} else {
switch ($this->getInput('step', helper::FILTER_INT)) {
// Préparation
case 1:
@ -416,6 +425,7 @@ class install extends common
]);
}
}
}
/**
* Mise à jour

View File

@ -1016,6 +1016,15 @@ class theme extends common
public function import($zipName = '')
{
// Action interdite
if (
$this->getUser('permission', __CLASS__, __FUNCTION__) !== true
) {
// Valeurs en sortie
$this->addOutput([
'access' => false
]);
} else {
if (
$zipName !== '' &&
@ -1092,6 +1101,7 @@ class theme extends common
return (['success' => false, 'notification' => helper::translate('Archive non spécifiée ou introuvable')]);
}
}

View File

@ -1014,7 +1014,8 @@ class user extends common
else {
// Soumission du formulaire
if (
$this->getUser('permission', __CLASS__, __FUNCTION__) === true &&
// Tous les suers peuvent réinitialiser
// $this->getUser('permission', __CLASS__, __FUNCTION__) === true &&
$this->isPost()
) {
// Double vérification pour le mot de passe