From e615265d3b51e27f0f664cea193b6353975d6f7d Mon Sep 17 00:00:00 2001
From: tbrehm <t.brehm@ispconfig.org>
Date: Mon, 29 Aug 2011 04:25:44 -0400
Subject: [PATCH] Fixed php notice in session library.

---
 interface/web/sites/user_quota_stats.php |   46 ++++++++++++++++++++++++++++++++++++++++++----
 1 files changed, 42 insertions(+), 4 deletions(-)

diff --git a/interface/web/sites/user_quota_stats.php b/interface/web/sites/user_quota_stats.php
index ce2c3bc..8b88d84 100644
--- a/interface/web/sites/user_quota_stats.php
+++ b/interface/web/sites/user_quota_stats.php
@@ -17,8 +17,16 @@
 
 $app->load('listform_actions');
 
-$tmp_rec = $app->db->queryOneRecord("SELECT data from monitor_data WHERE type = 'harddisk_quota' ORDER BY created DESC");
-$monitor_data = unserialize($app->db->unquote($tmp_rec['data']));
+// $tmp_rec = $app->db->queryOneRecord("SELECT data from monitor_data WHERE type = 'harddisk_quota' ORDER BY created DESC");
+// $monitor_data = unserialize($app->db->unquote($tmp_rec['data']));
+$tmp_rec =  $app->db->queryAllRecords("SELECT data from monitor_data WHERE type = 'harddisk_quota' ORDER BY created DESC");
+$monitor_data = array();
+if(is_array($tmp_rec)) {
+	foreach ($tmp_rec as $tmp_mon) {
+		$monitor_data = array_merge_recursive($monitor_data,unserialize($app->db->unquote($tmp_mon['data'])));
+	}
+}
+
 
 class list_action extends listform_actions {
 	
@@ -37,8 +45,38 @@
 		$rec['soft'] = $monitor_data['user'][$username]['soft'];
 		$rec['hard'] = $monitor_data['user'][$username]['hard'];
 		
-		if($rec['soft'] == '0K') $rec['soft'] = $app->lng('unlimited');
-		if($rec['hard'] == '0K') $rec['hard'] = $app->lng('unlimited');
+		if (!is_numeric($rec['used'])) $rec['used']=$rec['used'][1];
+		if (!is_numeric($rec['soft'])) $rec['soft']=$rec['soft'][1];
+		if (!is_numeric($rec['hard'])) $rec['hard']=$rec['hard'][1];
+		
+		if($rec['used'] > 1024) {
+			$rec['used'] = round($rec['used'] / 1024,2).' MB';
+		} else {
+			$rec['used'] .= ' KB';
+		}
+		
+		if($rec['soft'] > 1024) {
+			$rec['soft'] = round($rec['soft'] / 1024,2).' MB';
+		} else {
+			$rec['soft'] .= ' KB';
+		}
+		
+		if($rec['hard'] > 1024) {
+			$rec['hard'] = round($rec['hard'] / 1024,2).' MB';
+		} else {
+			$rec['hard'] .= ' KB';
+		}
+		
+		
+		
+		/*
+		if(!strstr($rec['used'],'M') && !strstr($rec['used'],'K')) $rec['used'].= ' B';
+		if(!strstr($rec['soft'],'M') && !strstr($rec['soft'],'K')) $rec['soft'].= ' B';
+		if(!strstr($rec['hard'],'M') && !strstr($rec['hard'],'K')) $rec['hard'].= ' B';
+		*/
+		
+		if($rec['soft'] == '0 B' || $rec['soft'] == '0 KB' || $rec['soft'] == '0') $rec['soft'] = $app->lng('unlimited');
+		if($rec['hard'] == '0 B' || $rec['hard'] == '0 KB' || $rec['hard'] == '0') $rec['hard'] = $app->lng('unlimited');
 		
 		//* The variable "id" contains always the index variable
 		$rec['id'] = $rec[$this->idx_key];

--
Gitblit v1.9.1