summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoralecpl <alec@alec.pl>2008-08-28 18:04:19 +0000
committeralecpl <alec@alec.pl>2008-08-28 18:04:19 +0000
commit876b15dcceeaf5d3f5b2881c8155fcf247cac316 (patch)
treeaae78f9c08134f2c72ecaa5e291fe35d7e0e09cb
parentacbc487af0dfdc803dd33d958231fbe232bb3586 (diff)
- Added option 'quota_zero_as_unlimited' (#1484604)
-rw-r--r--CHANGELOG4
-rw-r--r--config/main.inc.php.dist3
-rw-r--r--program/lib/imap.inc11
-rw-r--r--program/steps/mail/func.inc4
4 files changed, 13 insertions, 9 deletions
diff --git a/CHANGELOG b/CHANGELOG
index 69254a6d6..6a400dc72 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,6 +1,10 @@
CHANGELOG RoundCube Webmail
---------------------------
+2008/08/28 (alec)
+----------
+- Added option 'quota_zero_as_unlimited' (#1484604)
+
2008/08/28 (robin)
----------
- Added folder hierarchy collapsing
diff --git a/config/main.inc.php.dist b/config/main.inc.php.dist
index f79232a3e..eb78f1248 100644
--- a/config/main.inc.php.dist
+++ b/config/main.inc.php.dist
@@ -175,6 +175,9 @@ $rcmail_config['create_default_folders'] = FALSE;
// protect the default folders from renames, deletes, and subscription changes
$rcmail_config['protect_default_folders'] = TRUE;
+// if in your system 0 quota means no limit set this option to TRUE
+$rcmail_config['quota_zero_as_unlimited'] = FALSE;
+
// Set TRUE if deleted messages should not be displayed
// This will make the application run slower
$rcmail_config['skip_deleted'] = FALSE;
diff --git a/program/lib/imap.inc b/program/lib/imap.inc
index c10c90101..7f2315671 100644
--- a/program/lib/imap.inc
+++ b/program/lib/imap.inc
@@ -63,6 +63,7 @@
- added iil_PutLine() wrapper for fputs()
- code cleanup and identation fixes
- removed flush() calls in iil_C_HandlePartBody() to prevent from memory leak (#1485187)
+ - don't return "??" from iil_C_GetQuota()
********************************************************/
@@ -2621,13 +2622,9 @@ function iil_C_GetQuota(&$conn) {
$parts = explode(' ', $quota_line);
$storage_part = array_search('STORAGE', $parts);
if ($storage_part > 0) {
- $result = array();
- $used = $parts[$storage_part+1];
- $total = $parts[$storage_part+2];
-
- $result['used'] = $used;
- $result['total'] = (empty($total)?"??":$total);
- $result['percent'] = (empty($total)?"??":round(($used/$total)*100));
+ $result['used'] = intval($parts[$storage_part+1]);
+ $result['total'] = intval($parts[$storage_part+2]);
+ $result['percent'] = min(100, round(($result['used']/max(1,$result['total']))*100));
$result['free'] = 100 - $result['percent'];
}
}
diff --git a/program/steps/mail/func.inc b/program/steps/mail/func.inc
index b1f359f63..7607cccd3 100644
--- a/program/steps/mail/func.inc
+++ b/program/steps/mail/func.inc
@@ -457,7 +457,7 @@ function rcmail_quota_display($attrib)
*/
function rcmail_quota_content($quota=NULL)
{
- global $IMAP, $COMM_PATH;
+ global $IMAP, $COMM_PATH, $RCMAIL;
$display = isset($_SESSION['quota_display']) ? $_SESSION['quota_display'] : '';
@@ -471,7 +471,7 @@ function rcmail_quota_content($quota=NULL)
else
$quota = $IMAP->get_quota();
- if ($quota)
+ if ($quota && !($quota['total']==0 && $RCMAIL->config->get('quota_zero_as_unlimited')))
{
$quota_text = sprintf('%s / %s (%.0f%%)',
show_bytes($quota['used'] * 1024),