From a00ea993e23555380a987626d86b143bf43b73c1 Mon Sep 17 00:00:00 2001 From: hickert Date: Wed, 31 May 2006 05:35:10 +0000 Subject: [PATCH] Added quota fix, we get bytes but want kbytes git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@3571 594d385d-05f5-0310-b6e9-bd551577e9d8 --- include/class_mail-methods-kolab.inc | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/include/class_mail-methods-kolab.inc b/include/class_mail-methods-kolab.inc index acb1210b3..c6f3f22de 100644 --- a/include/class_mail-methods-kolab.inc +++ b/include/class_mail-methods-kolab.inc @@ -50,6 +50,32 @@ class mailMethodKolab extends mailMethodCyrus } + /* Get quota and divide it by 1024, because in gosa we display in Kb + but we get bytes */ + function getQuota($folder) + { + $result= array('quotaUsage' => '', 'gosaMailQuota' => ''); + + /* Load quota settings */ + $quota_value = @imap_get_quota($this->mbox, $folder); + if(is_array($quota_value)) { + if (isset($quota_value["STORAGE"]) && is_array($quota_value["STORAGE"])){ + /* use for PHP >= 4.3 */ + $result['quotaUsage']= (int) ($quota_value["STORAGE"]['usage'] / 1024); + $result['gosaMailQuota']= (int) ($quota_value["STORAGE"]['limit'] / 1024); + } else { + /* backward icompatible */ + $result['quotaUsage']= (int) ($quota_value['usage'] / 1024); + $result['gosaMailQuota']= (int) ($quota_value['limit'] / 1024); + } + }elseif(!$quota_value){ + return(false); + } + + return ($result); + } + + function fixAttributesOnLoad(&$mailObject) { /* Convert attributes and objectClasses */ -- 2.30.2