From dcd2c0ed1a9094c064e1adc606262c8a6906bc71 Mon Sep 17 00:00:00 2001 From: Sergio Cambra <sergio@programatica.es> Date: Tue, 8 Jul 2014 13:53:39 +0200 Subject: [PATCH] include every domain from client's reseller when checking reseller quota --- interface/web/sites/web_vhost_domain_edit.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/interface/web/sites/web_vhost_domain_edit.php b/interface/web/sites/web_vhost_domain_edit.php index de731bd644..ee65753021 100644 --- a/interface/web/sites/web_vhost_domain_edit.php +++ b/interface/web/sites/web_vhost_domain_edit.php @@ -835,7 +835,8 @@ class page_action extends tform_actions { if($this->_vhostdomain_type == 'domain') { //* Check the website quota of the client if(isset($_POST["hd_quota"]) && $reseller["limit_web_quota"] >= 0 && $_POST["hd_quota"] != $old_web_values["hd_quota"]) { - $tmp = $app->db->queryOneRecord("SELECT sum(hd_quota) as webquota FROM web_domain WHERE domain_id != ".$app->functions->intval($this->id)." AND type = 'vhost' AND ".$app->tform->getAuthSQL('u')); + $tmp = $app->db->queryOneRecord("SELECT sum(hd_quota) as webquota FROM web_domain, sys_group, client WHERE web_domain.sys_groupid=sys_group.groupid AND sys_group.client_id=client.client_id AND ".$client['parent_client_id']." IN (client.parent_client_id, client.client_id) AND domain_id != ".$app->functions->intval($this->id)." AND type = 'vhost'"); + $webquota = $tmp["webquota"]; $new_web_quota = $app->functions->intval($this->dataRecord["hd_quota"]); if(($webquota + $new_web_quota > $reseller["limit_web_quota"]) || ($new_web_quota < 0 && $reseller["limit_web_quota"] >= 0)) { @@ -852,7 +853,7 @@ class page_action extends tform_actions { //* Check the traffic quota of the client if(isset($_POST["traffic_quota"]) && $reseller["limit_traffic_quota"] > 0 && $_POST["traffic_quota"] != $old_web_values["traffic_quota"]) { - $tmp = $app->db->queryOneRecord("SELECT sum(traffic_quota) as trafficquota FROM web_domain WHERE domain_id != ".$app->functions->intval($this->id)." AND ".$app->tform->getAuthSQL('u')); + $tmp = $app->db->queryOneRecord("SELECT sum(traffic_quota) as trafficquota FROM web_domain, sys_group, client WHERE web_domain.sys_groupid=sys_group.groupid AND sys_group.client_id=client.client_id AND ".$client['parent_client_id']." IN (client.parent_client_id, client.client_id) AND domain_id != ".$app->functions->intval($this->id)." AND type = 'vhost'"); $trafficquota = $tmp["trafficquota"]; $new_traffic_quota = $app->functions->intval($this->dataRecord["traffic_quota"]); if(($trafficquota + $new_traffic_quota > $reseller["limit_traffic_quota"]) || ($new_traffic_quota < 0 && $reseller["limit_traffic_quota"] >= 0)) { -- GitLab