index a8e563b604c06349afc0b33902e21a60df0bae02..1c361877b8e18009fb6074399c9644ef078d8b52 100644 (file)
if(is_array($quota_value)) {
if (isset($quota_value["STORAGE"]) && is_array($quota_value["STORAGE"])){
/* use for PHP >= 4.3 */
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'];
- $result['gosaMailQuota']= $quota_value["STORAGE"]['limit'];
+ if($quota_value["STORAGE"]['limit'] == 2147483647){
+ $result['quotaUsage']= (int) ($quota_value["STORAGE"]['usage'] / 1024);
+ $result['gosaMailQuota']= (int) ($quota_value["STORAGE"]['limit'] );
+ }else{
+ $result['quotaUsage']= (int) ($quota_value["STORAGE"]['usage'] / 1024);
+ $result['gosaMailQuota']= (int) ($quota_value["STORAGE"]['limit'] / 1024);
+ }
} else {
/* backward icompatible */
} else {
/* backward icompatible */
- $result['quotaUsage']= $quota_value['usage'];
- $result['gosaMailQuota']= $quota_value['limit'];
+ if($quota_value['usage'] == 2147483647){
+ $result['quotaUsage']= (int) ($quota_value['usage'] / 1024);
+ $result['gosaMailQuota']= (int) ($quota_value['limit'] );
+ }else{
+ $result['quotaUsage']= (int) ($quota_value['usage'] / 1024);
+ $result['gosaMailQuota']= (int) ($quota_value['limit'] / 1024);
+ }
}
}
+ }elseif(!$quota_value){
+
+ /* If there is no quota defined for this account, the function imap_get_quota returns false. */
+ return(array("quotaUsage"=>"","gosaMailQuota"=>""));
}
}
+
error_reporting (E_ALL);
error_reporting (E_ALL);
-
return ($result);
}
return ($result);
}
function setQuota($folder, $gosaMailQuota)
{
/* Workaround for the php imap extension */
function setQuota($folder, $gosaMailQuota)
{
/* Workaround for the php imap extension */
- if ($gosaMailQuota == ""){
+ if (($gosaMailQuota == "") || ($gosaMailQuota== "2147483647")){
$gosaMailQuota= "2147483647";
$gosaMailQuota= "2147483647";
+ }elseif($gosaMailQuota > 0){
+ $gosaMailQuota = $gosaMailQuota *1024;
}
}
-
+
+
/* Write mail quota */
if (!imap_set_quota($this->mbox, $folder, $gosaMailQuota)){
print_red(sprintf(_("Can't write IMAP quota. Server says '%s'."), imap_last_error()));
/* Write mail quota */
if (!imap_set_quota($this->mbox, $folder, $gosaMailQuota)){
print_red(sprintf(_("Can't write IMAP quota. Server says '%s'."), imap_last_error()));