From 39a251df37c8d2cf3a26332af07bbdaa99125e50 Mon Sep 17 00:00:00 2001 From: SJ Date: Mon, 29 Jul 2013 22:34:44 +0200 Subject: [PATCH] audit date fix --- webui/controller/audit/helper.php | 2 +- webui/model/health/health.php | 4 +++- webui/system/misc.php | 5 +++-- webui/view/theme/default/templates/health/worker.tpl | 2 +- webui/view/theme/mobile/templates/health/worker.tpl | 2 +- 5 files changed, 9 insertions(+), 6 deletions(-) diff --git a/webui/controller/audit/helper.php b/webui/controller/audit/helper.php index 20cd43ef..b34a044f 100644 --- a/webui/controller/audit/helper.php +++ b/webui/controller/audit/helper.php @@ -103,7 +103,7 @@ class ControllerAuditHelper extends Controller { 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,}$/", $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++; $this->a["date$ndate"] = $v; } diff --git a/webui/model/health/health.php b/webui/model/health/health.php index 51c2d2e2..af52c483 100644 --- a/webui/model/health/health.php +++ b/webui/model/health/health.php @@ -90,7 +90,9 @@ class ModelHealthHealth extends Model { if(isset($p[5]) && in_array($p[5], $partitions)) { $shortinfo[] = array( '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]) ); } diff --git a/webui/system/misc.php b/webui/system/misc.php index 3e366525..457368ab 100644 --- a/webui/system/misc.php +++ b/webui/system/misc.php @@ -262,9 +262,10 @@ function my_qp_encode($s){ function nice_size($size = 0, $space = '') { 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"; } diff --git a/webui/view/theme/default/templates/health/worker.tpl b/webui/view/theme/default/templates/health/worker.tpl index 580f7d2c..2a0b5099 100644 --- a/webui/view/theme/default/templates/health/worker.tpl +++ b/webui/view/theme/default/templates/health/worker.tpl @@ -45,7 +45,7 @@ - % + => / (%)
diff --git a/webui/view/theme/mobile/templates/health/worker.tpl b/webui/view/theme/mobile/templates/health/worker.tpl index d2003c03..3cc0913c 100644 --- a/webui/view/theme/mobile/templates/health/worker.tpl +++ b/webui/view/theme/mobile/templates/health/worker.tpl @@ -72,7 +72,7 @@
-
%
+
=> / (%)