From 89e4329a8068e3631d3f64f6896fa3907c687cf5 Mon Sep 17 00:00:00 2001 From: Marius Cramer <m.cramer@pixcept.de> Date: Thu, 08 Jan 2015 09:08:50 -0500 Subject: [PATCH] Layout fix: tab toggle and monitor tables --- interface/lib/classes/quota_lib.inc.php | 28 ++++++++++++++++------------ 1 files changed, 16 insertions(+), 12 deletions(-) diff --git a/interface/lib/classes/quota_lib.inc.php b/interface/lib/classes/quota_lib.inc.php index 55b2aa8..613c524 100644 --- a/interface/lib/classes/quota_lib.inc.php +++ b/interface/lib/classes/quota_lib.inc.php @@ -13,12 +13,9 @@ } //print_r($monitor_data); - if($clientid != null){ - $sql_where = " AND sys_groupid = (SELECT default_group FROM sys_user WHERE client_id=".$clientid.")"; - } + // select all websites or websites belonging to client + $sites = $app->db->queryAllRecords("SELECT * FROM web_domain WHERE active = 'y' AND type = 'vhost'".(($clientid != null)?" AND sys_groupid = (SELECT default_group FROM sys_user WHERE client_id=?)":''), $clientid); - // select websites belonging to client - $sites = $app->db->queryAllRecords("SELECT * FROM web_domain WHERE active = 'y' AND type = 'vhost'".$sql_where); //print_r($sites); if(is_array($sites) && !empty($sites)){ for($i=0;$i<sizeof($sites);$i++){ @@ -38,7 +35,13 @@ if (!is_numeric($sites[$i]['soft'])) $sites[$i]['soft']=$sites[$i]['soft'][1]; if (!is_numeric($sites[$i]['hard'])) $sites[$i]['hard']=$sites[$i]['hard'][1]; if (!is_numeric($sites[$i]['files'])) $sites[$i]['files']=$sites[$i]['files'][1]; - + + $sites[$i]['used_raw'] = $sites[$i]['used']; + $sites[$i]['soft_raw'] = $sites[$i]['soft']; + $sites[$i]['hard_raw'] = $sites[$i]['hard']; + $sites[$i]['files_raw'] = $sites[$i]['files']; + $sites[$i]['used_percentage'] = ($sites[$i]['soft'] > 0 && $sites[$i]['used'] > 0 ? round($sites[$i]['used'] * 100 / $sites[$i]['soft']) : 0); + if ($readable) { // colours $sites[$i]['display_colour'] = '#000000'; @@ -111,13 +114,9 @@ } //print_r($monitor_data); - if($clientid != null){ - $sql_where = " AND sys_groupid = (SELECT default_group FROM sys_user WHERE client_id=".$clientid.")"; - } + // select all email accounts or email accounts belonging to client + $emails = $app->db->queryAllRecords("SELECT * FROM mail_user".(($clientid != null)? " WHERE sys_groupid = (SELECT default_group FROM sys_user WHERE client_id=?)" : ''), $clientid); - - // select email accounts belonging to client - $emails = $app->db->queryAllRecords("SELECT * FROM mail_user WHERE 1".$sql_where); //print_r($emails); if(is_array($emails) && !empty($emails)){ for($i=0;$i<sizeof($emails);$i++){ @@ -127,6 +126,11 @@ if (!is_numeric($emails[$i]['used'])) $emails[$i]['used']=$emails[$i]['used'][1]; + $emails[$i]['quota_raw'] = $emails[$i]['quota']; + $emails[$i]['used_raw'] = $emails[$i]['used']; + $emails[$i]['used_percentage'] = ($emails[$i]['quota'] > 0 && $emails[$i]['used'] > 0 ? round($emails[$i]['used'] * 100 / $emails[$i]['quota']) : 0); + + if ($readable) { // colours $emails[$i]['display_colour'] = '#000000'; -- Gitblit v1.9.1