From b7ee5f0edfeb64382cd7580edffe9e760b58e27f Mon Sep 17 00:00:00 2001
From: Till Brehm <tbrehm@ispconfig.org>
Date: Fri, 5 Jul 2019 12:15:57 +0200
Subject: [PATCH] Fixed #5331 Disallow 0 as website harddisk quota value

---
 interface/web/sites/lib/lang/de_web_vhost_domain.lng | 1 +
 interface/web/sites/lib/lang/en_web_vhost_domain.lng | 1 +
 interface/web/sites/web_vhost_domain_edit.php        | 5 +++++
 3 files changed, 7 insertions(+)

diff --git a/interface/web/sites/lib/lang/de_web_vhost_domain.lng b/interface/web/sites/lib/lang/de_web_vhost_domain.lng
index 1b334bb298..d95b6d47e4 100644
--- a/interface/web/sites/lib/lang/de_web_vhost_domain.lng
+++ b/interface/web/sites/lib/lang/de_web_vhost_domain.lng
@@ -152,4 +152,5 @@ $wb['https_port_error_regex'] = 'HTTPS Port invalid.';
 $wb['enable_pagespeed_txt'] = 'Enable PageSpeed';
 $wb['log_retention_txt'] = 'Log-Dateien Aufbewahrungszeit';
 $wb['log_retention_error_regex'] = 'Aufbewahrungszeit in Tagen (Erlaubte Werte: min. 0 - max. 9999)';
+$wb['limit_web_quota_not_0_txt'] = 'Harddisk Quota kann nicht 0 sein.';
 ?>
diff --git a/interface/web/sites/lib/lang/en_web_vhost_domain.lng b/interface/web/sites/lib/lang/en_web_vhost_domain.lng
index 97d1c932ca..ae546e1c4d 100644
--- a/interface/web/sites/lib/lang/en_web_vhost_domain.lng
+++ b/interface/web/sites/lib/lang/en_web_vhost_domain.lng
@@ -157,4 +157,5 @@ $wb['https_port_error_regex'] = 'HTTPS Port invalid.';
 $wb['enable_pagespeed_txt'] = 'Enable PageSpeed';
 $wb['log_retention_txt'] = 'Logfiles retention time';
 $wb['log_retention_error_regex'] = 'Retention time in days (allowed values: min. 0 - max. 9999)';
+$wb['limit_web_quota_not_0_txt'] = 'Harddisk Quota cannot be set to 0.';
 ?>
diff --git a/interface/web/sites/web_vhost_domain_edit.php b/interface/web/sites/web_vhost_domain_edit.php
index 3d6ecc6fb8..86deb5b2a5 100644
--- a/interface/web/sites/web_vhost_domain_edit.php
+++ b/interface/web/sites/web_vhost_domain_edit.php
@@ -1065,6 +1065,11 @@ class page_action extends tform_actions {
 			}
 			
 			if($this->_vhostdomain_type == 'domain') {
+				//* ensure that quota value is not 0 when vhost type = domain
+				if(isset($_POST["hd_quota"]) && $_POST["hd_quota"] == 0) {
+					$app->tform->errorMessage .= $app->tform->lng("limit_web_quota_not_0_txt")."<br>";
+				}
+				
 				//* Check the website quota of the client
 				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 != ? AND type = 'vhost' AND ".$app->tform->getAuthSQL('u'), $this->id);
-- 
GitLab