diff --git a/interface/web/sites/form/ftp_user.tform.php b/interface/web/sites/form/ftp_user.tform.php index 91dc0809aee0fc895f956a42357978d897c60ef6..3450764ff55474654c82b392402deec840b3e70a 100644 --- a/interface/web/sites/form/ftp_user.tform.php +++ b/interface/web/sites/form/ftp_user.tform.php @@ -108,6 +108,9 @@ $form["tabs"]['ftp'] = array ( 'formtype' => 'TEXT', 'validators' => array ( 0 => array ( 'type' => 'NOTEMPTY', 'errmsg'=> 'quota_size_error_empty'), + 1 => array ( 'type' => 'REGEX', + 'regex' => '/^(\-1|[0-9]{1,10})$/', + 'errmsg'=> 'quota_size_error_regex'), ), 'default' => '-1', 'value' => '', diff --git a/interface/web/sites/form/web_domain.tform.php b/interface/web/sites/form/web_domain.tform.php index 277a3a4bc43a9cdec01ff6b7d4e3c430b2cc1131..29852058fa12d9056535e3e4ea50e069df71f7bc 100644 --- a/interface/web/sites/form/web_domain.tform.php +++ b/interface/web/sites/form/web_domain.tform.php @@ -133,6 +133,9 @@ $form["tabs"]['domain'] = array ( 'formtype' => 'TEXT', 'validators' => array ( 0 => array ( 'type' => 'NOTEMPTY', 'errmsg'=> 'hd_quota_error_empty'), + 1 => array ( 'type' => 'REGEX', + 'regex' => '/^(\-1|[0-9]{1,10})$/', + 'errmsg'=> 'hd_quota_error_regex'), ), 'default' => '-1', 'value' => '', @@ -144,6 +147,9 @@ $form["tabs"]['domain'] = array ( 'formtype' => 'TEXT', 'validators' => array ( 0 => array ( 'type' => 'NOTEMPTY', 'errmsg'=> 'traffic_quota_error_empty'), + 1 => array ( 'type' => 'REGEX', + 'regex' => '/^(\-1|[0-9]{1,10})$/', + 'errmsg'=> 'traffic_quota_error_regex'), ), 'default' => '-1', 'value' => '', diff --git a/interface/web/sites/lib/lang/en_ftp_user.lng b/interface/web/sites/lib/lang/en_ftp_user.lng index f5b111639ec1170b0b87bf47fd950e2a20425a61..88c644ee740563bc36ab64264879b918c7dfe5f6 100644 --- a/interface/web/sites/lib/lang/en_ftp_user.lng +++ b/interface/web/sites/lib/lang/en_ftp_user.lng @@ -25,4 +25,5 @@ $wb["uid_error_empty"] = 'GID empty.'; $wb["directory_error_empty"] = 'Directory empty.'; $wb['directory_error_notinweb'] = 'Directory not inside of web root directory.'; $wb["parent_domain_id_error_empty"] = 'No website selected.'; +$wb["quota_size_error_regex"] = 'Quota: enter a -1 for unlimited or a number > 0'; ?> diff --git a/interface/web/sites/lib/lang/en_web_domain.lng b/interface/web/sites/lib/lang/en_web_domain.lng index 47d42150f8d024330d9a225aa6d702d5639593f3..ae022528c1bc926f09190d77338cbd3c2cf2237b 100644 --- a/interface/web/sites/lib/lang/en_web_domain.lng +++ b/interface/web/sites/lib/lang/en_web_domain.lng @@ -65,4 +65,6 @@ $wb["ruby_txt"] = 'Ruby'; $wb["stats_user_txt"] = 'Webstatistics username'; $wb["stats_type_txt"] = 'Webstatistics program'; $wb["custom_php_ini_txt"] = 'Custom php.ini settings'; +$wb["hd_quota_error_regex"] = 'Harddisk quota: enter a -1 for unlimited or a number > 0'; +$wb["traffic_quota_error_regex"] = 'Traffic quota: enter a -1 for unlimited or a number > 0'; ?> \ No newline at end of file diff --git a/interface/web/sites/web_domain_edit.php b/interface/web/sites/web_domain_edit.php index 0b47a3f9e3031a4ee778431b68ca62aa642e4887..2f25ddbf0086f4f6ac70d1dce1f66043f2cf1e6c 100644 --- a/interface/web/sites/web_domain_edit.php +++ b/interface/web/sites/web_domain_edit.php @@ -283,7 +283,7 @@ class page_action extends tform_actions { $tmp = $app->db->queryOneRecord("SELECT sum(hd_quota) as webquota FROM web_domain WHERE domain_id != ".intval($this->id)." AND ".$app->tform->getAuthSQL('u')); $webquota = $tmp["webquota"]; $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)) { + if(($webquota + $new_web_quota > $client["limit_web_quota"]) || ($new_web_quota < 0 && $client["limit_web_quota"] >= 0)) { $max_free_quota = floor($client["limit_web_quota"] - $webquota); if($max_free_quota < 0) $max_free_quota = 0; $app->tform->errorMessage .= $app->tform->lng("limit_web_quota_free_txt").": ".$max_free_quota." MB
"; @@ -299,7 +299,7 @@ class page_action extends tform_actions { $tmp = $app->db->queryOneRecord("SELECT sum(traffic_quota) as trafficquota FROM web_domain WHERE domain_id != ".intval($this->id)." AND ".$app->tform->getAuthSQL('u')); $trafficquota = $tmp["trafficquota"]; $new_traffic_quota = intval($this->dataRecord["traffic_quota"]); - if(($trafficquota + $new_traffic_quota > $client["limit_traffic_quota"]) || ($new_traffic_quota == -1 && $client["limit_traffic_quota"] != -1)) { + if(($trafficquota + $new_traffic_quota > $client["limit_traffic_quota"]) || ($new_traffic_quota < 0 && $client["limit_traffic_quota"] >= 0)) { $max_free_quota = floor($client["limit_traffic_quota"] - $trafficquota); if($max_free_quota < 0) $max_free_quota = 0; $app->tform->errorMessage .= $app->tform->lng("limit_traffic_quota_free_txt").": ".$max_free_quota." MB
";