From c90ca726c9a99b543545a142bee1e2b356c5e4db Mon Sep 17 00:00:00 2001 From: fredtempez Date: Mon, 11 Oct 2021 17:07:09 +0200 Subject: [PATCH] Branch init --- core/class/helper.class.php | 5 +++- core/include/update.inc.php | 9 +++++++ core/module/config/config.php | 10 +++++++ core/module/config/view/advanced/advanced.php | 27 ++++++++++++------- core/module/install/ressource/defaultdata.php | 3 ++- 5 files changed, 43 insertions(+), 11 deletions(-) diff --git a/core/class/helper.class.php b/core/class/helper.class.php index 54e49a5f..dd170082 100644 --- a/core/class/helper.class.php +++ b/core/class/helper.class.php @@ -22,11 +22,12 @@ class helper { /** * Récupérer l'adresse IP sans tenir compte du proxy + * @param integer Niveau d'anonymat 0 aucun, 1 octet à droite, etc.. * @return string IP adress * Cette fonction est utilisée par user */ - public static function getIp() { + public static function getIp($anon = 4) { if(!empty($_SERVER['HTTP_CLIENT_IP'])){ $ip=$_SERVER['HTTP_CLIENT_IP']; } @@ -36,6 +37,8 @@ class helper { else{ $ip=$_SERVER['REMOTE_ADDR']; } + + switch ($anon): return $ip; } diff --git a/core/include/update.inc.php b/core/include/update.inc.php index 1a707cdf..c0d674f6 100644 --- a/core/include/update.inc.php +++ b/core/include/update.inc.php @@ -653,4 +653,13 @@ if ($this->getData(['core', 'dataVersion']) < 11010) { $this->setData(['config', 'i18n', 'enable', $data ]); $this->setData(['core', 'dataVersion', 11010]); +} + +// Version 11.1.00 +if ($this->getData(['core', 'dataVersion']) < 11100) { + + // Anonymat des adresses iP de la journalisation + $this->setData(['config', 'connect', 'anonymousIp', 2 ]); + + $this->setData(['core', 'dataVersion', 11100]); } \ No newline at end of file diff --git a/core/module/config/config.php b/core/module/config/config.php index 7038d095..1b7262a7 100644 --- a/core/module/config/config.php +++ b/core/module/config/config.php @@ -178,6 +178,15 @@ class config extends common { 600 => '10 minutes', 900 => '15 minutes' ]; + // Anonymisation des IP du journal + public static $anonIP = [ + 0 => 'Non tronquées', + 1 => 'Niveau 1 (192.168.12.x)', + 2 => 'Niveau 2 (192.168.x.x)', + 3 => 'Niveau 3 (192.x.x.x)', + ]; + + // Langue traduite courante public static $i18nSite = 'fr'; @@ -514,6 +523,7 @@ class config extends common { 'attempt' => $this->getInput('configAdvancedConnectAttempt',helper::FILTER_INT), 'timeout' => $this->getInput('configAdvancedConnectTimeout',helper::FILTER_INT), 'log' => $this->getInput('configAdvancedConnectLog',helper::FILTER_BOOLEAN), + 'anonymousIp' => $this->getInput('configAdvancedConnectAnonymousIp',helper::FILTER_INT), 'captcha' => $this->getInput('configAdvancedConnectCaptcha',helper::FILTER_BOOLEAN), ], 'i18n' => [ diff --git a/core/module/config/view/advanced/advanced.php b/core/module/config/view/advanced/advanced.php index 4e90680d..a96b5786 100644 --- a/core/module/config/view/advanced/advanced.php +++ b/core/module/config/view/advanced/advanced.php @@ -361,23 +361,32 @@
-
+
$this->getData(['config', 'connect', 'log']) ]); ?>
+
+ 'Anonymat des adresses IP', + 'selected' => $this->getData(['config', 'connect', 'anonymousIp']), + 'help' => 'La réglementation française impose un anonymat de niveau 2' + ]); ?> +
+
+
helper::baseUrl() . 'config/logDownload', - 'value' => 'Télécharger journal', + 'value' => 'Télécharger le journal', 'ico' => 'download' ]); ?>
-
+
'buttonRed', 'href' => helper::baseUrl() . 'config/logReset', - 'value' => 'Réinitialiser journal', + 'value' => 'Réinitialiser le journal', 'ico' => 'cancel' ]); ?>
@@ -400,11 +409,11 @@
- 'Type de proxy', - 'selected' => $this->getData(['config', 'proxyType']) - ]); ?> -
+ 'Type de proxy', + 'selected' => $this->getData(['config', 'proxyType']) + ]); ?> +
'Adresse du proxy', diff --git a/core/module/install/ressource/defaultdata.php b/core/module/install/ressource/defaultdata.php index 5735a13a..72f8e33d 100644 --- a/core/module/install/ressource/defaultdata.php +++ b/core/module/install/ressource/defaultdata.php @@ -34,6 +34,7 @@ class init extends common { 'timeout' => 600, 'attempt' => 3, 'log' => false, + 'anonymousIp' => 2, 'captcha' => true ], 'i18n' => [ @@ -52,7 +53,7 @@ class init extends common { ] ], 'core' => [ - 'dataVersion' => 11010, + 'dataVersion' => 11100, 'lastBackup' => 0, 'lastClearTmp' => 0, 'lastAutoUpdate' => 0,