anonimize shown ip address in demo mode

This commit is contained in:
SJ 2013-07-25 13:27:56 +02:00
parent 3d8d08f2bd
commit 3f4962990d
4 changed files with 15 additions and 2 deletions

View File

@ -29,6 +29,7 @@ $config['SITE_NAME'] = 'piler.yourdomain.com';
$config['SITE_URL'] = 'http://piler.yourdomain.com/';
$config['ENABLE_SAAS'] = 0;
$config['DEMO_MODE'] = 0;
$config['TIMEZONE'] = 'Europe/Budapest';

View File

@ -92,7 +92,7 @@ class ModelAuditAudit extends Model {
'action' => $a['action'],
'email' => $a['email'],
'date' => date(AUDIT_DATE_FORMAT, $a['ts']),
'ipaddr' => $a['ipaddr'],
'ipaddr' => DEMO_MODE == 1 ? anonimize_ip_addr($a['ipaddr']) : $a['ipaddr'],
'description' => $a['description'],
'shortdescription' => make_short_string($a['description'], MAX_CGI_FROM_SUBJ_LEN)
);

View File

@ -492,6 +492,18 @@ function safe_feof($fp, &$start = NULL) {
}
function anonimize_ip_addr($ip = '') {
$ip = explode(".", $ip);
if(count($ip) == 4) {
$ip[0] = $ip[1] = 'x';
$ip = implode(".", $ip);
}
return $ip;
}
function get_ldap_attribute_names($ldap_type = '') {
$ldap_mail_attr = LDAP_MAIL_ATTR;

View File

@ -16,7 +16,7 @@
<?php foreach($users as $user) { ?>
<tr>
<td class="domaincell"><?php print $user['username']; ?></td>
<td class="domaincell"><?php print $user['ipaddr']; ?></td>
<td class="domaincell"><?php if(DEMO_MODE == 1) { print anonimize_ip_addr($user['ipaddr']); } else { print $user['ipaddr']; } ?></td>
<td class="domaincell"><?php print date("Y.m.d. G:i:s", $user['ts']); ?></td>
<td class="domaincell"><?php print date("Y.m.d. G:i:s", $user['last_activity']); ?></td>
</tr>