audit date fix

This commit is contained in:
SJ 2013-07-29 22:34:44 +02:00
parent bd0de9f6e9
commit 39a251df37
5 changed files with 9 additions and 6 deletions

View File

@ -103,7 +103,7 @@ class ControllerAuditHelper extends Controller {
if(preg_match("/\@/", $v)) { $this->a['user'] .= '*' . $v; } if(preg_match("/\@/", $v)) { $this->a['user'] .= '*' . $v; }
if(preg_match("/\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}/", $v)) { $this->a['ipaddr'] .= '*' . $v; } if(preg_match("/\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}/", $v)) { $this->a['ipaddr'] .= '*' . $v; }
if(preg_match("/^\d{1,}$/", $v)) { $this->a['ref'] .= '*' . $v; } if(preg_match("/^\d{1,}$/", $v)) { $this->a['ref'] .= '*' . $v; }
if(preg_match("/\d{4}\-\d{1,2}\-\d{1,2}/", $v) || preg_match("/\d{4}\.\d{1,2}\.\d{1,2}/", $v)) { if(preg_match("/\d{4}(\-|\.)\d{1,2}(\-|\.)\d{1,2}/", $v) || preg_match("/\d{1,2}\/\d{1,2}\/\d{4}/", $v)) {
$ndate++; $ndate++;
$this->a["date$ndate"] = $v; $this->a["date$ndate"] = $v;
} }

View File

@ -90,7 +90,9 @@ class ModelHealthHealth extends Model {
if(isset($p[5]) && in_array($p[5], $partitions)) { if(isset($p[5]) && in_array($p[5], $partitions)) {
$shortinfo[] = array( $shortinfo[] = array(
'partition' => $p[5], 'partition' => $p[5],
'freespace' => $p[3], 'freespace' => nice_size(1000*$p[3]),
'total' => nice_size(1000*$p[1]),
'used' => nice_size(1000*$p[2]),
'utilization' => preg_replace("/\%/", "", $p[4]) 'utilization' => preg_replace("/\%/", "", $p[4])
); );
} }

View File

@ -262,9 +262,10 @@ function my_qp_encode($s){
function nice_size($size = 0, $space = '') { function nice_size($size = 0, $space = '') {
if($size < 1000) return "1k"; if($size < 1000) return "1k";
if($size < 100000) return round($size/1000) . $space . "k"; if($size < 1000000) return round($size/1000) . $space . "k";
if($size < 1000000000) return round($size/1000000) . $space . "M";
return sprintf("%.1f", $size/1000000) . $space . "M"; return sprintf("%.1f", $size/1000000000) . $space . "G";
} }

View File

@ -45,7 +45,7 @@
<tr> <tr>
<th><?php print $text_disk_usage; ?></th> <th><?php print $text_disk_usage; ?></th>
<td><?php foreach($shortdiskinfo as $partition) { ?><span class="<?php if($partition['utilization'] < HEALTH_RATIO) { ?>text-success<?php } else { ?>text-error<?php } ?>"><?php print $partition['partition']; ?> <?php print $partition['utilization']; ?>%</span> <?php } ?></td> <td><?php foreach($shortdiskinfo as $partition) { ?><span class="<?php if($partition['utilization'] < HEALTH_RATIO) { ?>text-success<?php } else { ?>text-error<?php } ?>"><?php print $partition['partition']; ?> =&gt; <?php print $partition['used']; ?> / <?php print $partition['total']; ?> (<?php print $partition['utilization']; ?>%</span>)<br /> <?php } ?></td>
</tr> </tr>
<tr> <tr>

View File

@ -72,7 +72,7 @@
<div class="row"> <div class="row">
<div class="cellhealthleft"><?php print $text_disk_usage; ?></div> <div class="cellhealthleft"><?php print $text_disk_usage; ?></div>
<div class="cellhealthright"><?php foreach($shortdiskinfo as $partition) { ?><span class="bold <?php if($partition['utilization'] < HEALTH_RATIO) { ?>text-success<?php } else { ?>text-error<?php } ?>"><?php print $partition['partition']; ?> <?php print $partition['utilization']; ?>%</span> <?php } ?></div> <div class="cellhealthright"><?php foreach($shortdiskinfo as $partition) { ?><span class="bold <?php if($partition['utilization'] < HEALTH_RATIO) { ?>text-success<?php } else { ?>text-error<?php } ?>"><?php print $partition['partition']; ?> =&gt; <?php print $partition['used']; ?> / <?php print $partition['total']; ?> (<?php print $partition['utilization']; ?>%</span>) <?php } ?></div>
</div> </div>
<div class="row"> <div class="row">