Commit 090935b5 authored by tbrehm's avatar tbrehm

Fixed: FS#1520 - Customer can set webspace unlimit with a limit.

parent d01b23c3
......@@ -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' => '',
......
......@@ -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' => '',
......
......@@ -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';
?>
......@@ -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
......@@ -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<br>";
......@@ -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<br>";
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment