Skip to content

Commit 78e231a

Browse files
committed
combined sql-queries
1 parent b454796 commit 78e231a

File tree

1 file changed

+2
-12
lines changed

1 file changed

+2
-12
lines changed

interface/lib/classes/quota_lib.inc.php

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,7 @@ public function get_quota_data($clientid = null, $readable = true) {
1414
//print_r($monitor_data);
1515

1616
// select all websites or websites belonging to client
17-
if($clientid != null){
18-
$sites = $app->db->queryAllRecords("SELECT * FROM web_domain WHERE active = 'y' AND type = 'vhost' AND sys_groupid = (SELECT default_group FROM sys_user WHERE client_id=?)", $app->functions->intval($client_id));
19-
}
20-
else {
21-
$sites = $app->db->queryAllRecords("SELECT * FROM web_domain WHERE active = 'y' AND type = 'vhost'");
22-
}
17+
$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=?)":''), $app->functions->intval($client_id));
2318

2419
//print_r($sites);
2520
if(is_array($sites) && !empty($sites)){
@@ -114,12 +109,7 @@ public function get_mailquota_data($clientid = null, $readable = true) {
114109
//print_r($monitor_data);
115110

116111
// select all email accounts or email accounts belonging to client
117-
if($clientid != null){
118-
$emails = $app->db->queryAllRecords("SELECT * FROM mail_user WHERE sys_groupid = (SELECT default_group FROM sys_user WHERE client_id=?)", $app->functions->intval($client_id));
119-
}
120-
else {
121-
$emails = $app->db->queryAllRecords("SELECT * FROM mail_user");
122-
}
112+
$emails = $app->db->queryAllRecords("SELECT * FROM mail_user".(($clientid != null)? " WHERE sys_groupid = (SELECT default_group FROM sys_user WHERE client_id=?)" : ''), $app->functions->intval($client_id));
123113

124114
//print_r($emails);
125115
if(is_array($emails) && !empty($emails)){

0 commit comments

Comments
 (0)