Falko Timme
2013-10-16 936c11949d425f39b8445fabc902ab6b0ace4aa2
- Websites and Vhostsubdomains: When editing a web, show quota and traffic errors to client/reseller only if he has changed those values; don't show errors for unchanged values.
2 files modified
26 ■■■■ changed files
interface/web/sites/web_domain_edit.php 15 ●●●● patch | view | raw | blame | history
interface/web/sites/web_vhost_subdomain_edit.php 11 ●●●● patch | view | raw | blame | history
interface/web/sites/web_domain_edit.php
@@ -526,8 +526,15 @@
            if($client['limit_wildcard'] != 'y' && $this->dataRecord['subdomain'] == '*') $this->dataRecord['subdomain'] = '-';
            if($client['limit_ssl'] != 'y') $this->dataRecord['ssl'] = '-';
            
            // only generate quota and traffic warnings if value has changed
            if($this->id > 0) {
                $old_web_values = $app->db->queryOneRecord("SELECT * FROM web_domain WHERE domain_id = ".$app->functions->intval($this->id));
            } else {
                $old_web_values = $_POST;
            }
            //* Check the website quota of the client
            if(isset($_POST["hd_quota"]) && $client["limit_web_quota"] >= 0) {
            if(isset($_POST["hd_quota"]) && $client["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'));
                $webquota = $tmp["webquota"];
                $new_web_quota = $app->functions->intval($this->dataRecord["hd_quota"]);
@@ -543,7 +550,7 @@
            }
            //* Check the traffic quota of the client
            if(isset($_POST["traffic_quota"]) && $client["limit_traffic_quota"] > 0) {
            if(isset($_POST["traffic_quota"]) && $client["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'));
                $trafficquota = $tmp["trafficquota"];
                $new_traffic_quota = $app->functions->intval($this->dataRecord["traffic_quota"]);
@@ -563,7 +570,7 @@
                $reseller = $app->db->queryOneRecord("SELECT limit_traffic_quota, limit_web_domain, default_webserver, limit_web_quota FROM client WHERE client_id = ".$client['parent_client_id']);
                //* Check the website quota of the client
                if(isset($_POST["hd_quota"]) && $reseller["limit_web_quota"] >= 0) {
                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'));
                    $webquota = $tmp["webquota"];
                    $new_web_quota = $app->functions->intval($this->dataRecord["hd_quota"]);
@@ -579,7 +586,7 @@
                }
                //* Check the traffic quota of the client
                if(isset($_POST["traffic_quota"]) && $reseller["limit_traffic_quota"] > 0) {
                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'));
                    $trafficquota = $tmp["trafficquota"];
                    $new_traffic_quota = $app->functions->intval($this->dataRecord["traffic_quota"]);
interface/web/sites/web_vhost_subdomain_edit.php
@@ -394,8 +394,15 @@
            if($client['limit_wildcard'] != 'y' && $this->dataRecord['subdomain'] == '*') $this->dataRecord['subdomain'] = '-';
            if($client['limit_ssl'] != 'y') $this->dataRecord['ssl'] = '-';
            // only generate quota and traffic warnings if value has changed
            if($this->id > 0) {
                $old_web_values = $app->db->queryOneRecord("SELECT * FROM web_domain WHERE domain_id = ".$app->functions->intval($this->id));
            } else {
                $old_web_values = $_POST;
            }
            //* Check the traffic quota of the client
            if(isset($_POST["traffic_quota"]) && $client["limit_traffic_quota"] > 0) {
            if(isset($_POST["traffic_quota"]) && $client["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'));
                $trafficquota = $tmp["trafficquota"];
                $new_traffic_quota = $app->functions->intval($this->dataRecord["traffic_quota"]);
@@ -415,7 +422,7 @@
                $reseller = $app->db->queryOneRecord("SELECT limit_traffic_quota, limit_web_subdomain, default_webserver, limit_web_quota FROM client WHERE client_id = ".$client['parent_client_id']);
                //* Check the traffic quota of the client
                if(isset($_POST["traffic_quota"]) && $reseller["limit_traffic_quota"] > 0) {
                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'));
                    $trafficquota = $tmp["trafficquota"];
                    $new_traffic_quota = $app->functions->intval($this->dataRecord["traffic_quota"]);