[imp] HEAD: More Quota oddities, patch attached

Leena Heino Leena.Heino at uta.fi
Wed Jan 15 16:12:58 PST 2003


Current Quota implementation in HEAD does not work correctly with Cyrus in
situations where quota is set to 0 or quota is unlimited (none).

Attached is patch to lib/Quota.php and lib/Quota/cyrus.php.

-- 
  -- Leena Heino (liinu at uta.fi)-------------- next part --------------
--- imp/lib/Quota.php.orig	Tue Jan  7 13:41:45 2003
+++ imp/lib/Quota.php	Wed Jan 15 14:48:07 2003
@@ -127,7 +127,7 @@
      */
     function _quotaHtml($used, $total)
     {
-        if ((!empty($used) || ($empty === 0)) && !empty($total)) {
+        if ($total !== "") {
             $used = $used / (1024 * 1024.0);
             $total = $total / (1024 * 1024.0);
             $percent = ($used * 100) / $total;
-------------- next part --------------
--- imp/lib/Quota/cyrus.php.orig	Tue Jan  7 13:38:24 2003
+++ imp/lib/Quota/cyrus.php	Wed Jan 15 15:13:52 2003
@@ -58,10 +58,14 @@
             $quota = @imap_get_quota($stream, $mbox);
             @imap_close($stream);
             if (is_array($quota)) {
-                if ($quota['limit'] != 0) {
+                if (isset($quota['limit'])) {
                     return $this->_quotaHTML($quota['usage'] * 1024, $quota['limit'] * 1024);
-                } elseif ($quota['STORAGE']['limit'] != 0) {
+                } elseif (isset($quotas['STORAGE']['limit'])) {
                     return $this->_quotaHTML($quota['STORAGE']['usage'] * 1024, $quota['STORAGE']['limit'] * 1024);
+                } elseif (empty($quota['usage']) && empty($quota['limit'])) {
+                    return $this->_quotaHTML('', '');
+                } elseif (empty($quota['STORAGE']['usage']) && empty($quota['STORAGE']['limit'])) {
+                    return $this->_quotaHTML('', '');
                 }
             }
         }


More information about the imp mailing list