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
* @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;
}

View File

@ -654,3 +654,12 @@ if ($this->getData(['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',
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' => [

View File

@ -361,23 +361,32 @@
</h4>
<div class="blockContainer">
<div class="row">
<div class="col4 verticalAlignBottom">
<div class="col4 offset2">
<?php echo template::checkbox('configAdvancedConnectLog', true, 'Activer la journalisation', [
'checked' => $this->getData(['config', 'connect', 'log'])
]); ?>
</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">
<?php echo template::button('configAdvancedLogDownload', [
'href' => helper::baseUrl() . 'config/logDownload',
'value' => 'Télécharger journal',
'value' => 'Télécharger le journal',
'ico' => 'download'
]); ?>
</div>
<div class="col3">
<div class="col3 offset1">
<?php echo template::button('configAdvancedLogReset', [
'class' => 'buttonRed',
'href' => helper::baseUrl() . 'config/logReset',
'value' => 'Réinitialiser journal',
'value' => 'Réinitialiser le journal',
'ico' => 'cancel'
]); ?>
</div>
@ -400,11 +409,11 @@
<div class="blockContainer">
<div class="row">
<div class="col2">
<?php echo template::select('configAdvancedProxyType', $module::$proxyType, [
'label' => 'Type de proxy',
'selected' => $this->getData(['config', 'proxyType'])
]); ?>
</div>
<?php echo template::select('configAdvancedProxyType', $module::$proxyType, [
'label' => 'Type de proxy',
'selected' => $this->getData(['config', 'proxyType'])
]); ?>
</div>
<div class="col8">
<?php echo template::text('configAdvancedProxyUrl', [
'label' => 'Adresse du proxy',

View File

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