Browse Source

Branch init

master
Fred Tempez 9 months ago
parent
commit
c90ca726c9
  1. 5
      core/class/helper.class.php
  2. 9
      core/include/update.inc.php
  3. 10
      core/module/config/config.php
  4. 27
      core/module/config/view/advanced/advanced.php
  5. 3
      core/module/install/ressource/defaultdata.php

5
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;
}

9
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]);
}

10
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' => [

27
core/module/config/view/advanced/advanced.php

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

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

Loading…
Cancel
Save