Branch init

This commit is contained in:
Fred Tempez 2021-10-11 17:07:09 +02:00
parent a172f67598
commit c90ca726c9
5 changed files with 43 additions and 11 deletions

View File

@ -22,11 +22,12 @@ class helper {
/** /**
* Récupérer l'adresse IP sans tenir compte du proxy * 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 * @return string IP adress
* Cette fonction est utilisée par user * Cette fonction est utilisée par user
*/ */
public static function getIp() { public static function getIp($anon = 4) {
if(!empty($_SERVER['HTTP_CLIENT_IP'])){ if(!empty($_SERVER['HTTP_CLIENT_IP'])){
$ip=$_SERVER['HTTP_CLIENT_IP']; $ip=$_SERVER['HTTP_CLIENT_IP'];
} }
@ -36,6 +37,8 @@ class helper {
else{ else{
$ip=$_SERVER['REMOTE_ADDR']; $ip=$_SERVER['REMOTE_ADDR'];
} }
switch ($anon):
return $ip; return $ip;
} }

View File

@ -653,4 +653,13 @@ if ($this->getData(['core', 'dataVersion']) < 11010) {
$this->setData(['config', 'i18n', 'enable', $data ]); $this->setData(['config', 'i18n', 'enable', $data ]);
$this->setData(['core', 'dataVersion', 11010]); $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]);
} }

View File

@ -178,6 +178,15 @@ class config extends common {
600 => '10 minutes', 600 => '10 minutes',
900 => '15 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 // Langue traduite courante
public static $i18nSite = 'fr'; public static $i18nSite = 'fr';
@ -514,6 +523,7 @@ class config extends common {
'attempt' => $this->getInput('configAdvancedConnectAttempt',helper::FILTER_INT), 'attempt' => $this->getInput('configAdvancedConnectAttempt',helper::FILTER_INT),
'timeout' => $this->getInput('configAdvancedConnectTimeout',helper::FILTER_INT), 'timeout' => $this->getInput('configAdvancedConnectTimeout',helper::FILTER_INT),
'log' => $this->getInput('configAdvancedConnectLog',helper::FILTER_BOOLEAN), 'log' => $this->getInput('configAdvancedConnectLog',helper::FILTER_BOOLEAN),
'anonymousIp' => $this->getInput('configAdvancedConnectAnonymousIp',helper::FILTER_INT),
'captcha' => $this->getInput('configAdvancedConnectCaptcha',helper::FILTER_BOOLEAN), 'captcha' => $this->getInput('configAdvancedConnectCaptcha',helper::FILTER_BOOLEAN),
], ],
'i18n' => [ 'i18n' => [

View File

@ -361,23 +361,32 @@
</h4> </h4>
<div class="blockContainer"> <div class="blockContainer">
<div class="row"> <div class="row">
<div class="col4 verticalAlignBottom"> <div class="col4 offset2">
<?php echo template::checkbox('configAdvancedConnectLog', true, 'Activer la journalisation', [ <?php echo template::checkbox('configAdvancedConnectLog', true, 'Activer la journalisation', [
'checked' => $this->getData(['config', 'connect', 'log']) 'checked' => $this->getData(['config', 'connect', 'log'])
]); ?> ]); ?>
</div> </div>
<div class="col4">
<?php echo template::select('configAdvancedConnectAnonymousIp', $module::$anonIP, [
'label' => 'Anonymat des adresses IP',
'selected' => $this->getData(['config', 'connect', 'anonymousIp']),
'help' => 'La réglementation française impose un anonymat de niveau 2'
]); ?>
</div>
</div>
<div class="row">
<div class="col3 offset2"> <div class="col3 offset2">
<?php echo template::button('configAdvancedLogDownload', [ <?php echo template::button('configAdvancedLogDownload', [
'href' => helper::baseUrl() . 'config/logDownload', 'href' => helper::baseUrl() . 'config/logDownload',
'value' => 'Télécharger journal', 'value' => 'Télécharger le journal',
'ico' => 'download' 'ico' => 'download'
]); ?> ]); ?>
</div> </div>
<div class="col3"> <div class="col3 offset1">
<?php echo template::button('configAdvancedLogReset', [ <?php echo template::button('configAdvancedLogReset', [
'class' => 'buttonRed', 'class' => 'buttonRed',
'href' => helper::baseUrl() . 'config/logReset', 'href' => helper::baseUrl() . 'config/logReset',
'value' => 'Réinitialiser journal', 'value' => 'Réinitialiser le journal',
'ico' => 'cancel' 'ico' => 'cancel'
]); ?> ]); ?>
</div> </div>
@ -400,11 +409,11 @@
<div class="blockContainer"> <div class="blockContainer">
<div class="row"> <div class="row">
<div class="col2"> <div class="col2">
<?php echo template::select('configAdvancedProxyType', $module::$proxyType, [ <?php echo template::select('configAdvancedProxyType', $module::$proxyType, [
'label' => 'Type de proxy', 'label' => 'Type de proxy',
'selected' => $this->getData(['config', 'proxyType']) 'selected' => $this->getData(['config', 'proxyType'])
]); ?> ]); ?>
</div> </div>
<div class="col8"> <div class="col8">
<?php echo template::text('configAdvancedProxyUrl', [ <?php echo template::text('configAdvancedProxyUrl', [
'label' => 'Adresse du proxy', 'label' => 'Adresse du proxy',

View File

@ -34,6 +34,7 @@ class init extends common {
'timeout' => 600, 'timeout' => 600,
'attempt' => 3, 'attempt' => 3,
'log' => false, 'log' => false,
'anonymousIp' => 2,
'captcha' => true 'captcha' => true
], ],
'i18n' => [ 'i18n' => [
@ -52,7 +53,7 @@ class init extends common {
] ]
], ],
'core' => [ 'core' => [
'dataVersion' => 11010, 'dataVersion' => 11100,
'lastBackup' => 0, 'lastBackup' => 0,
'lastClearTmp' => 0, 'lastClearTmp' => 0,
'lastAutoUpdate' => 0, 'lastAutoUpdate' => 0,