diff --git a/install/sql/ispconfig3.sql b/install/sql/ispconfig3.sql index de421b7408b0925a13232c34cd7e170c30bbe820..09384519c32058cafc062ad9bcfc2cd5eab767c8 100644 --- a/install/sql/ispconfig3.sql +++ b/install/sql/ispconfig3.sql @@ -82,6 +82,7 @@ CREATE TABLE `client` ( `default_webserver` int(11) unsigned NOT NULL default '1', `limit_web_ip` text, `limit_web_domain` int(11) NOT NULL default '-1', + `limit_web_quota` int(11) NOT NULL default '-1', `web_php_options` varchar(255) NOT NULL default 'no,fast-cgi,cgi,mod,suphp', `limit_web_subdomain` int(11) NOT NULL default '-1', `limit_web_aliasdomain` int(11) NOT NULL default '-1', @@ -138,6 +139,7 @@ CREATE TABLE `client_template` ( `limit_spamfilter_policy` int(11) NOT NULL default '0', `limit_web_ip` text, `limit_web_domain` int(11) NOT NULL default '-1', + `limit_web_quota` int(11) NOT NULL default '-1', `limit_web_subdomain` int(11) NOT NULL default '-1', `limit_web_aliasdomain` int(11) NOT NULL default '-1', `limit_ftp_user` int(11) NOT NULL default '-1', diff --git a/interface/web/client/form/client.tform.php b/interface/web/client/form/client.tform.php index 9a7b6e0884d2e8072e4888337792a1acd3ff2569..cd599dfa1e61dcdcb47414959675ee45e8369c06 100644 --- a/interface/web/client/form/client.tform.php +++ b/interface/web/client/form/client.tform.php @@ -529,6 +529,20 @@ $form["tabs"]['limits'] = array ( 'rows' => '', 'cols' => '' ), + 'limit_web_quota' => array ( + 'datatype' => 'INTEGER', + 'formtype' => 'TEXT', + 'validators' => array ( 0 => array ( 'type' => 'ISINT', + 'errmsg'=> 'limit_web_quota_error_notint'), + ), + 'default' => '-1', + 'value' => '', + 'separator' => '', + 'width' => '10', + 'maxlength' => '10', + 'rows' => '', + 'cols' => '' + ), 'web_php_options' => array ( 'datatype' => 'VARCHAR', 'formtype' => 'CHECKBOXARRAY', diff --git a/interface/web/client/form/client_template.tform.php b/interface/web/client/form/client_template.tform.php index e26f037e30085c8b75db3535e7303dea227a0ea3..6f924501f32c5d538cde84202eca861b56c7a179 100644 --- a/interface/web/client/form/client_template.tform.php +++ b/interface/web/client/form/client_template.tform.php @@ -297,6 +297,20 @@ $form["tabs"]['limits'] = array ( 'rows' => '', 'cols' => '' ), + 'limit_web_quota' => array ( + 'datatype' => 'INTEGER', + 'formtype' => 'TEXT', + 'validators' => array ( 0 => array ( 'type' => 'ISINT', + 'errmsg'=> 'limit_web_quota_error_notint'), + ), + 'default' => '-1', + 'value' => '', + 'separator' => '', + 'width' => '10', + 'maxlength' => '10', + 'rows' => '', + 'cols' => '' + ), 'limit_web_aliasdomain' => array ( 'datatype' => 'INTEGER', 'formtype' => 'TEXT', diff --git a/interface/web/client/form/reseller.tform.php b/interface/web/client/form/reseller.tform.php index d069e00ef8e99ec45784957ea4bd118c1134419d..a7c5ea6b080476fa8e1a7f1139e5d86b2251de5f 100644 --- a/interface/web/client/form/reseller.tform.php +++ b/interface/web/client/form/reseller.tform.php @@ -515,6 +515,20 @@ $form["tabs"]['limits'] = array ( 'rows' => '', 'cols' => '' ), + 'limit_web_quota' => array ( + 'datatype' => 'INTEGER', + 'formtype' => 'TEXT', + 'validators' => array ( 0 => array ( 'type' => 'ISINT', + 'errmsg'=> 'limit_web_quota_error_notint'), + ), + 'default' => '-1', + 'value' => '', + 'separator' => '', + 'width' => '10', + 'maxlength' => '10', + 'rows' => '', + 'cols' => '' + ), 'web_php_options' => array ( 'datatype' => 'VARCHAR', 'formtype' => 'CHECKBOXARRAY', diff --git a/interface/web/client/lib/lang/en_client.lng b/interface/web/client/lib/lang/en_client.lng index 4be403341d84a8410b602d3d32b4a38fcbcd4dc6..4c0332cc6c0db73a813c3fa3b698a78e75715658 100644 --- a/interface/web/client/lib/lang/en_client.lng +++ b/interface/web/client/lib/lang/en_client.lng @@ -91,4 +91,5 @@ $wb["template_additional_txt"] = 'Addon template'; $wb["ssh_chroot_txt"] = 'SSH-Chroot Options'; $wb["web_php_options_txt"] = 'PHP Options'; $wb["limit_client_error"] = 'The max. number of clients is reached.'; +$wb["limit_web_quota_txt"] = 'Web Quota'; ?> diff --git a/interface/web/client/lib/lang/en_client_template.lng b/interface/web/client/lib/lang/en_client_template.lng index d403dfda503eccd5dd1f73dabaf28739f60048c7..f7299744a84b0022e6506824c697bcf28773d9a8 100644 --- a/interface/web/client/lib/lang/en_client_template.lng +++ b/interface/web/client/lib/lang/en_client_template.lng @@ -54,4 +54,5 @@ $wb["limit_database_error_notint"] = 'The database limit must be a number.'; $wb["limit_cron_error_notint"] = 'The cron limit must be a number.'; $wb["limit_cron_error_frequency"] = 'The cron frequency limit must be a number.'; $wb["error_template_name_empty"] = 'Please enter a Template name'; +$wb["limit_web_quota_txt"] = 'Web Quota'; ?> \ No newline at end of file diff --git a/interface/web/client/lib/lang/en_reseller.lng b/interface/web/client/lib/lang/en_reseller.lng index 906fd44bcbf6afea2d4ca47692cf513d4630537f..e3e7e30704ac3e7526035e17c97fd9760ef2fb93 100644 --- a/interface/web/client/lib/lang/en_reseller.lng +++ b/interface/web/client/lib/lang/en_reseller.lng @@ -90,4 +90,5 @@ $wb["ssh_chroot_txt"] = 'SSH-Chroot Options'; $wb["web_php_options_txt"] = 'PHP Options'; $wb["limit_client_error"] = 'The max. number of clients is reached.'; $wb["limit_client_error_positive"] = 'The number of clients must be > 0'; +$wb["limit_web_quota_txt"] = 'Web Quota'; ?> diff --git a/interface/web/client/templates/client_edit_limits.htm b/interface/web/client/templates/client_edit_limits.htm index 2927ca4d087acc9dfa842ad3aa57338ddd212a89..1acad9d36d88280228c2aa1d76d9392536f6257e 100644 --- a/interface/web/client/templates/client_edit_limits.htm +++ b/interface/web/client/templates/client_edit_limits.htm @@ -103,6 +103,10 @@ +
+ +  MB +

{tmpl_var name='web_php_options_txt'}

diff --git a/interface/web/client/templates/client_template_edit_limits.htm b/interface/web/client/templates/client_template_edit_limits.htm index 81f2595425117d1136a27bf4b9eb9841c1623b65..8f5d3d2655e7432968225556f8a0c1dc49416c82 100644 --- a/interface/web/client/templates/client_template_edit_limits.htm +++ b/interface/web/client/templates/client_template_edit_limits.htm @@ -61,6 +61,10 @@
+
+ +  MB +
diff --git a/interface/web/client/templates/reseller_edit_limits.htm b/interface/web/client/templates/reseller_edit_limits.htm index 7e027e44e05f3a5965b499feaa8e4f67944209f9..d413eb5dc7341cc248b35189496a2064ea1a50ff 100644 --- a/interface/web/client/templates/reseller_edit_limits.htm +++ b/interface/web/client/templates/reseller_edit_limits.htm @@ -88,6 +88,10 @@
+
+ +  MB +

{tmpl_var name='web_php_options_txt'}

diff --git a/interface/web/sites/lib/lang/en_web_domain.lng b/interface/web/sites/lib/lang/en_web_domain.lng index 109d8e7af4fc13fa684eeb572bc558991ed3cd29..ecda409b20c10b4dc731191b7bf608f28b4cf67c 100644 --- a/interface/web/sites/lib/lang/en_web_domain.lng +++ b/interface/web/sites/lib/lang/en_web_domain.lng @@ -48,4 +48,5 @@ $wb['error_ssl_country_empty'] = 'SSL Country is empty.'; $wb["client_group_id_txt"] = 'Client'; $wb["stats_password_txt"] = 'Webstatistics password'; $wb["allow_override_txt"] = 'Allow Override'; +$wb["limit_web_quota_free_txt"] = 'Max. available Harddisk Quota'; ?> diff --git a/interface/web/sites/web_domain_edit.php b/interface/web/sites/web_domain_edit.php index 51ce0985917c939462b40c12603cdabc86248c2a..93911c8de484e0bab36e18dfe6619de512899a7e 100644 --- a/interface/web/sites/web_domain_edit.php +++ b/interface/web/sites/web_domain_edit.php @@ -214,7 +214,22 @@ class page_action extends tform_actions { if($_SESSION["s"]["user"]["typ"] != 'admin') { // Get the limits of the client $client_group_id = $_SESSION["s"]["user"]["default_group"]; - $client = $app->db->queryOneRecord("SELECT limit_web_domain, default_webserver, parent_client_id FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = $client_group_id"); + $client = $app->db->queryOneRecord("SELECT limit_web_domain, default_webserver, parent_client_id, limit_web_quota FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = $client_group_id"); + + //* Check the website quota + if(isset($_POST["hd_quota"]) && $client["limit_web_quota"] >= 0) { + $tmp = $app->db->queryOneRecord("SELECT sum(hd_quota) as webquota FROM web_domain WHERE domain_id != ".intval($this->id)." AND sys_groupid = $client_group_id"); + $webquota = $tmp["webquota"] / 1024 / 1024; + $new_web_quota = intval($this->dataRecord["hd_quota"]); + if(($webquota + $new_web_quota > $client["limit_web_quota"]) || ($new_web_quota == -1 && $client["limit_web_quota"] != -1)) { + $max_free_quota = floor($client["limit_web_quota"] - $webquota); + $app->tform->errorMessage .= $app->tform->lng("limit_web_quota_free_txt").": ".$max_free_quota."
"; + // Set the quota field to the max free space + $this->dataRecord["hd_quota"] = $max_free_quota; + } + unset($tmp); + unset($tmp_quota); + } // When the record is updated if($this->id > 0) {