diff --git a/data/web/edit.php b/data/web/edit.php index c44464df..9aa79269 100644 --- a/data/web/edit.php +++ b/data/web/edit.php @@ -521,7 +521,8 @@ if (isset($_SESSION['mailcow_cc_role'])) {
max. MiB
- + + 0 = ∞
diff --git a/data/web/inc/functions.inc.php b/data/web/inc/functions.inc.php index c869c122..ebce5819 100644 --- a/data/web/inc/functions.inc.php +++ b/data/web/inc/functions.inc.php @@ -1,4 +1,12 @@ '), '<'); - $quota_m = filter_var($_data['quota'], FILTER_SANITIZE_NUMBER_FLOAT); + $quota_m = intval($_data['quota']); if (empty($name)) { $name = $local_part; } @@ -844,14 +844,6 @@ function mailbox($_action, $_type, $_data = null, $_extra = null) { ); return false; } - if (!is_numeric($quota_m) || $quota_m == "0") { - $_SESSION['return'][] = array( - 'type' => 'danger', - 'log' => array(__FUNCTION__, $_action, $_type, $_data_log, $_attr), - 'msg' => 'quota_not_0_not_numeric' - ); - return false; - } if (!empty($password) && !empty($password2)) { if (!preg_match('/' . $GLOBALS['PASSWD_REGEP'] . '/', $password)) { $_SESSION['return'][] = array( @@ -1993,9 +1985,9 @@ function mailbox($_action, $_type, $_data = null, $_extra = null) { $active = (isset($_data['active'])) ? intval($_data['active']) : $is_now['active_int']; (int)$force_pw_update = (isset($_data['force_pw_update'])) ? intval($_data['force_pw_update']) : intval($is_now['attributes']['force_pw_update']); (int)$sogo_access = (isset($_data['sogo_access'])) ? intval($_data['sogo_access']) : intval($is_now['attributes']['sogo_access']); + (int)$quota_m = (isset_has_content($_data['quota'])) ? intval($_data['quota']) : ($is_now['quota'] / 1048576); $name = (!empty($_data['name'])) ? ltrim(rtrim($_data['name'], '>'), '<') : $is_now['name']; $domain = $is_now['domain']; - $quota_m = (!empty($_data['quota'])) ? $_data['quota'] : ($is_now['quota'] / 1048576); $quota_b = $quota_m * 1048576; $password = (!empty($_data['password'])) ? $_data['password'] : null; $password2 = (!empty($_data['password2'])) ? $_data['password2'] : null; @@ -2021,14 +2013,6 @@ function mailbox($_action, $_type, $_data = null, $_extra = null) { ); continue; } - if (!is_numeric($quota_m) || $quota_m == "0") { - $_SESSION['return'][] = array( - 'type' => 'danger', - 'log' => array(__FUNCTION__, $_action, $_type, $_data_log, $_attr), - 'msg' => array('quota_not_0_not_numeric', htmlspecialchars($quota_m)) - ); - continue; - } if ($quota_m > $DomainData['maxquota']) { $_SESSION['return'][] = array( 'type' => 'danger', @@ -3016,15 +3000,18 @@ function mailbox($_action, $_type, $_data = null, $_extra = null) { $mailboxdata['quota'] = $row['quota']; $mailboxdata['attributes'] = json_decode($row['attributes'], true); $mailboxdata['quota_used'] = intval($row['bytes']); - $mailboxdata['percent_in_use'] = round((intval($row['bytes']) / intval($row['quota'])) * 100); + $mailboxdata['percent_in_use'] = ($row['quota'] == 0) ? '- ' : round((intval($row['bytes']) / intval($row['quota'])) * 100); $mailboxdata['messages'] = $row['messages']; $mailboxdata['spam_aliases'] = $SpamaliasUsage['sa_count']; - if ($mailboxdata['percent_in_use'] >= 90) { - $mailboxdata['percent_class'] = "danger"; + if ($mailboxdata['percent_in_use'] === '- ') { + $mailboxdata['percent_class'] = "info"; } elseif ($mailboxdata['percent_in_use'] >= 75) { $mailboxdata['percent_class'] = "warning"; } + elseif ($mailboxdata['percent_in_use'] >= 90) { + $mailboxdata['percent_class'] = "danger"; + } else { $mailboxdata['percent_class'] = "success"; } diff --git a/data/web/js/site/mailbox.js b/data/web/js/site/mailbox.js index f8aacac7..ba49892c 100644 --- a/data/web/js/site/mailbox.js +++ b/data/web/js/site/mailbox.js @@ -312,7 +312,8 @@ jQuery(function($){ {"name":"domain","title":lang.domain,"breakpoints":"xs sm"}, {"name":"quota","style":{"whiteSpace":"nowrap"},"title":lang.domain_quota,"formatter": function(value){ res = value.split("/"); - return humanFileSize(res[0]) + " / " + humanFileSize(res[1]); + var of_q = (res[1] == 0 ? "∞" : humanFileSize(res[1])); + return humanFileSize(res[0]) + " / " + of_q; }, "sortValue": function(value){ res = value.split("/"); diff --git a/data/web/modals/mailbox.php b/data/web/modals/mailbox.php index 11abbc58..aeb88cca 100644 --- a/data/web/modals/mailbox.php +++ b/data/web/modals/mailbox.php @@ -43,8 +43,8 @@ if (!isset($_SESSION['mailcow_cc_role'])) {
max. - MiB
- - min. 1 + + 0 = ∞