From: hickert Date: Wed, 31 May 2006 11:31:22 +0000 (+0000) Subject: Fixed groupMail-getQuota to display an error message if imap_get_quota failed X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=1981d136dcb7e79c7a89c70131b97561b8d76974;p=gosa.git Fixed groupMail-getQuota to display an error message if imap_get_quota failed Updated this->uid via mailMethodKolab to match typical folder names like 'shared.abc@server.de', else we can't get account quota etc. git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@3581 594d385d-05f5-0310-b6e9-bd551577e9d8 --- diff --git a/include/class_mail-methods-kolab.inc b/include/class_mail-methods-kolab.inc index 3b5045d5f..95ba9e5ee 100644 --- a/include/class_mail-methods-kolab.inc +++ b/include/class_mail-methods-kolab.inc @@ -55,7 +55,7 @@ class mailMethodKolab extends mailMethodCyrus function getQuota($folder) { $result= array('quotaUsage' => '', 'gosaMailQuota' => ''); - + error_reporting(0); /* Load quota settings */ @@ -82,6 +82,11 @@ class mailMethodKolab extends mailMethodCyrus function fixAttributesOnLoad(&$mailObject) { + /* Kolab shared folder names are like ' shared.uid@server.de ' + So overwrite uid to match these folder names. Else we can't read quota settings etc. + #FIXME is there a better way to detect if it is 'shared.' or 'shared+' or 'kolab+shared.' or what ever ?*/ + $mailObject->uid = "shared.".$mailObject->uid."@".preg_replace("/^.*@/","",$mailObject->mail); + /* Convert attributes and objectClasses */ foreach ($this->attribute_map as $dest => $source){ /* Hickert 11.11.05 : Alternate email addresses were saved, but not displayed again. @@ -196,6 +201,14 @@ class mailMethodKolab extends mailMethodCyrus } } } + + /* Save shared folder target */ + $mailObject->attrs['gosaSharedFolderTarget']= "kolab+shared.".$mailObject->uid; + + /* Kolab shared folder names are like ' shared.uid@server.de ' + So overwrite uid to match these folder names. Else we can't read quota settings etc. + #FIXME is there a better way to detect if it is 'shared.' or 'shared+' or 'kolab+shared.' or what ever ?*/ + $mailObject->uid = "shared.".$mailObject->uid."@".preg_replace("/^.*@/","",$mailObject->mail); /* Assign new acls */ $mailObject->attrs['acl']= array(); diff --git a/plugins/admin/groups/class_groupMail.inc b/plugins/admin/groups/class_groupMail.inc index abde8634b..9bd73c3df 100644 --- a/plugins/admin/groups/class_groupMail.inc +++ b/plugins/admin/groups/class_groupMail.inc @@ -112,10 +112,7 @@ class mailgroup extends plugin $method= new $this->method($this->config); if ($method->connect($this->attrs["gosaMailServer"][0])){ - - /* get Quota - */ - $quota= $method->getQuota($this->uid); + /* Maybe the entry is not saved in new style, get permissions from IMAP and convert them to acl attributes */ @@ -154,21 +151,30 @@ class mailgroup extends plugin } } // ENDE ! isset ($this->attrs['acl']) + + /* Adapt attributes if needed */ + $method->fixAttributesOnLoad($this); + + /* get Quota */ + $quota= $method->getQuota($this->uid); /* Update quota values */ - if ($quota['gosaMailQuota'] == 2147483647){ - $this->quotaUsage= ""; - $this->gosaMailQuota= ""; - } else { - $this->quotaUsage= $quota['quotaUsage']; - $this->gosaMailQuota= $quota['gosaMailQuota']; + if(is_array($quota)){ + if ($quota['gosaMailQuota'] == 2147483647){ + $this->quotaUsage= ""; + $this->gosaMailQuota= ""; + } else { + $this->quotaUsage= $quota['quotaUsage']; + $this->gosaMailQuota= $quota['gosaMailQuota']; + } + }else{ + $this->quotaUsage = ""; + $this->gosaMailQuota = ""; + print_red(sprintf(_("Can't get quota for for '%s'."),$this->uid)); } $method->disconnect(); } // ENDE $method->connect($this->attrs["gosaMailServer"][0])){ - /* Adapt attributes if needed */ - $method->fixAttributesOnLoad($this); - } // ENDE gosaMailServer } // ENDE dn != "new" @@ -690,15 +696,7 @@ I: Only insider delivery */ /* Save arrays */ $this->attrs['gosaMailAlternateAddress'] = $this->gosaMailAlternateAddress; $this->attrs['gosaMailForwardingAddress'] = $this->gosaMailForwardingAddress; - - /* Save shared folder target */ - if(preg_match("/kolab/i",$this->mmethod)){ - /* Kolab style */ - $this->attrs['gosaSharedFolderTarget']= "kolab+shared.".$this->uid; - }else { - /* GOsa style */ - $this->attrs['gosaSharedFolderTarget']= "share+".$this->uid; - } + $this->attrs['gosaSharedFolderTarget'] = "share+".$this->uid; if(preg_match("/kolab/i",$this->mmethod)){ /* Save acl's */