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 @@