From d9bcf68e395d6156645a7974b1a992aa6e6c00aa Mon Sep 17 00:00:00 2001
From: Marius Cramer <m.cramer@pixcept.de>
Date: Mon, 14 Oct 2013 08:57:25 -0400
Subject: [PATCH] Added missing empty directories from svn import

---
 interface/web/sites/user_quota_stats.php |   67 +++++++++++++++++++++++++++++----
 1 files changed, 58 insertions(+), 9 deletions(-)

diff --git a/interface/web/sites/user_quota_stats.php b/interface/web/sites/user_quota_stats.php
index 2e28d0d..32aa706 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 {
 	
@@ -33,12 +41,53 @@
 		$rec['bgcolor'] = $this->DataRowColor;
 		$username = $rec['system_user'];
 		
-		$rec['used'] = (is_numeric($monitor_data['user'][$username]['used'])) ? round($monitor_data['user'][$username]['used']/1024) .'MB' : $monitor_data['user'][$username]['used'].'B';
-		$rec['soft'] = $monitor_data['user'][$username]['soft'].'B';
-		$rec['hard'] = $monitor_data['user'][$username]['hard'].'B';
+		$rec['used'] = $monitor_data['user'][$username]['used'];
+		$rec['used_sort'] = $rec['used'];
+		$rec['soft'] = $monitor_data['user'][$username]['soft'];
+		$rec['hard'] = $monitor_data['user'][$username]['hard'];
+		$rec['files'] = $monitor_data['user'][$username]['files'];
 		
-		if($rec['soft'] == '0K') $rec['soft'] = $app->lng('unlimited');
-		if($rec['hard'] == '0K') $rec['hard'] = $app->lng('unlimited');
+		if (!is_numeric($rec['used'])){
+			if ($rec['used'][0] > $rec['used'][1]){
+				$rec['used'] = $rec['used'][0];
+			} else {
+				$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 (!is_numeric($rec['files'])) $rec['files']=$rec['files'][1];
+		
+		if($rec['used'] > 1024) {
+			$rec['used'] = round($rec['used'] / 1024,2).' MB';
+		} else {
+			if ($rec['used'] != '') $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($rec['soft'] == " KB") $rec['soft'] = $app->lng('unlimited');
+		if($rec['hard'] == " KB") $rec['hard'] = $app->lng('unlimited');
+		
+		
+		/*
+		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];
@@ -47,8 +96,8 @@
 }
 
 $list = new list_action;
-$list->SQLExtWhere = "type = 'vhost'";
-
+$list->SQLExtWhere = "web_domain.type = 'vhost'";
+$list->SQLOrderBy = 'ORDER BY web_domain.domain';
 $list->onLoad();
 
 

--
Gitblit v1.9.1