Compare commits
3 Commits
a172f67598
...
2f88a3bd41
Author | SHA1 | Date |
---|---|---|
Fred Tempez | 2f88a3bd41 | |
Fred Tempez | 79df051d08 | |
Fred Tempez | c90ca726c9 |
|
@ -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,13 @@ class helper {
|
||||||
else{
|
else{
|
||||||
$ip=$_SERVER['REMOTE_ADDR'];
|
$ip=$_SERVER['REMOTE_ADDR'];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Anonymiser l'adresse IP v4
|
||||||
|
$d = array_slice(explode('.', $ip), 0, $anon);
|
||||||
|
$d = implode ('.', $d);
|
||||||
|
$j = array_fill(0, 4 - $anon, 'x');
|
||||||
|
$k = implode ('.', $j);
|
||||||
|
$ip = count($j) == 0 ? $d : $d . '.' . $k;
|
||||||
return $ip;
|
return $ip;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2260,7 +2260,7 @@ class core extends common {
|
||||||
$dataLog = mb_detect_encoding(strftime('%d/%m/%y',time()), 'UTF-8', true)
|
$dataLog = mb_detect_encoding(strftime('%d/%m/%y',time()), 'UTF-8', true)
|
||||||
? strftime('%d/%m/%y',time()) . ';' . strftime('%R',time()) . ';'
|
? strftime('%d/%m/%y',time()) . ';' . strftime('%R',time()) . ';'
|
||||||
: utf8_encode(strftime('%d/%m/%y',time())) . ';' . utf8_encode(strftime('%R',time())) . ';' ;
|
: utf8_encode(strftime('%d/%m/%y',time())) . ';' . utf8_encode(strftime('%R',time())) . ';' ;
|
||||||
$dataLog .= helper::getIp() . ';';
|
$dataLog .= helper::getIp($this->getData(['config','connect','anonymousIp'])) . ';';
|
||||||
$dataLog .= $this->getUser('id') ? $this->getUser('id') . ';' : 'anonyme' . ';';
|
$dataLog .= $this->getUser('id') ? $this->getUser('id') . ';' : 'anonyme' . ';';
|
||||||
$dataLog .= $this->getUrl();
|
$dataLog .= $this->getUrl();
|
||||||
$dataLog .= PHP_EOL;
|
$dataLog .= PHP_EOL;
|
||||||
|
|
|
@ -654,3 +654,12 @@ if ($this->getData(['core', 'dataVersion']) < 11010) {
|
||||||
|
|
||||||
$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]);
|
||||||
|
}
|
|
@ -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 = [
|
||||||
|
4 => 'Non tronquées',
|
||||||
|
3 => 'Niveau 1 (192.168.12.x)',
|
||||||
|
2 => 'Niveau 2 (192.168.x.x)',
|
||||||
|
1 => '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' => [
|
||||||
|
|
|
@ -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>
|
||||||
|
|
|
@ -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,
|
||||||
|
|
|
@ -490,7 +490,7 @@ class user extends common {
|
||||||
$dataLog = mb_detect_encoding(strftime('%d/%m/%y',time()), 'UTF-8', true)
|
$dataLog = mb_detect_encoding(strftime('%d/%m/%y',time()), 'UTF-8', true)
|
||||||
? strftime('%d/%m/%y',time()) . ';' . strftime('%R',time()) . ';'
|
? strftime('%d/%m/%y',time()) . ';' . strftime('%R',time()) . ';'
|
||||||
: utf8_encode(strftime('%d/%m/%y',time())) . ';' . utf8_encode(strftime('%R',time())) . ';' ;
|
: utf8_encode(strftime('%d/%m/%y',time())) . ';' . utf8_encode(strftime('%R',time())) . ';' ;
|
||||||
$dataLog .= helper::getIp() . ';';
|
$dataLog .= helper::getIp($this->getData(['config','connect','anonymousIp'])) . ';';
|
||||||
$dataLog .= $this->getInput('userLoginId', helper::FILTER_ID) . ';' ;
|
$dataLog .= $this->getInput('userLoginId', helper::FILTER_ID) . ';' ;
|
||||||
$dataLog .= $this->getUrl() .';' ;
|
$dataLog .= $this->getUrl() .';' ;
|
||||||
$dataLog .= $logStatus ;
|
$dataLog .= $logStatus ;
|
||||||
|
|
Loading…
Reference in New Issue