From 48d20937553cde1c00c175f9c3cc6f5bbdc710a1 Mon Sep 17 00:00:00 2001 From: hickert Date: Tue, 4 Apr 2006 10:47:43 +0000 Subject: [PATCH] Added getQuota for kolab git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@2974 594d385d-05f5-0310-b6e9-bd551577e9d8 --- include/class_mail-methods-kolab.inc | 34 ++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/include/class_mail-methods-kolab.inc b/include/class_mail-methods-kolab.inc index 59e9aceb5..1f785a063 100644 --- a/include/class_mail-methods-kolab.inc +++ b/include/class_mail-methods-kolab.inc @@ -44,6 +44,40 @@ class mailMethodKolab extends mailMethodCyrus return (TRUE); } + function getQuota($folder) + { + $result= array('quotaUsage' => '', 'gosaMailQuota' => ''); + + /* Load quota settings */ + $folder = $folder; + + /* try to read quota with style of users + user/name@server.de + */ + $quota_value = @imap_get_quota($this->mbox, str_replace("user.","user/",$folder)); + + /* If obove method failed, try to read quota with style of users + user.name@server.de + */ + if(!is_array($quota_value)){ + $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']= ($quota_value["STORAGE"]['usage'] / 1024); + $result['gosaMailQuota']= ($quota_value["STORAGE"]['limit'] / 1024); + } else { + /* backward icompatible */ + $result['quotaUsage']= ($quota_value['usage'] / 1024); + $result['gosaMailQuota']= ($quota_value['limit'] / 1024); + } + } + return ($result); + } + + function deleteMailbox($folder) { -- 2.30.2