Ignore:
Timestamp:
06/14/12 18:31:57 (12 years ago)
Author:
brunocosta
Message:

Ticket #2853 - Exibição de cotas de sub pastas IMAP.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/2.3/expressoMail1_2/inc/class.imap_functions.inc.php

    r6482 r6508  
    43464346 
    43474347            $data = array(); 
    4348             $quota_root = $this->get_quota(array('folder_id' => "INBOX")); 
    4349             $data["quota_root"] = $quota_root; 
     4348                $quota_root = $this->get_quota(array('folder_id' => "INBOX")); 
     4349                $data["quota_root"] = $quota_root; 
    43504350 
    43514351            foreach ($response_array as $idx=>$line) {  
    43524352                    $line2 = str_replace('"', "", $line);  
    43534353                    $line2 = str_replace(" /vendor/cmu/cyrus-imapd/size (value.shared ",";",str_replace("* ANNOTATION ","",$line2));  
    4354                     list($folder,$size) = explode(";",$line2);  
    4355                     $quota_used = str_replace(")","",$size);  
     4354                    list($folder,$size) = explode(";",$line2); 
     4355                    
    43564356                    $quota=$this->get_quotaroot(array('folder' => $folder)); 
     4357                    $isroot=(strpos($quota['quota_root'],$folder)!==false); 
     4358                    $quota_used = $isroot?$quota['quota_used']*1024:str_replace(")","",$size);  
    43574359                    $hasquota=($quota['quota_root']!=""); 
    4358                     $isroot=(strpos($quota['quota_root'],$folder)!==false); 
    4359                     $quotaPercent = ($hasquota?(($quota_used / 1024) / $quota['quota_limit'])*100:0);  
     4360                    $quotaPercent = ($hasquota?(($quota_used / 1024) / $quota['quota_limit'])*100:0);  
    43604361                    $folder = mb_convert_encoding($folder, "ISO_8859-1", "UTF7-IMAP");  
    43614362                    if(!preg_match('/user\\'.$this->imap_delimiter.$this->username.'\\'.$this->imap_delimiter.'/i',$folder)){  
     
    43754376            include_once("class.imapfp.inc.php");             
    43764377            $imapfp = new imapfp();  
    4377  
     4378                 
    43784379            if(!$imapfp->open($this->imap_server,$this->imap_port))  
    43794380                    return $imapfp->get_error();              
     
    43874388            $data = array(); 
    43884389 
    4389             foreach ($response_array as $idx=>$line) {  
    4390                     $line2 = str_replace('"', "", $line);  
     4390            foreach ($response_array as $idx=>$line) { 
     4391                    if($idx == 0) 
     4392                        continue; 
     4393                    $line2 = str_replace('"', "", $line);  
    43914394                    $line2 = str_replace(" /vendor/cmu/cyrus-imapd/size (value.shared ",";",str_replace("* ANNOTATION ","",$line2));  
    4392                     list($folder,$size) = explode(";",$line2);  
    4393                     $quota_used = str_replace(")","",$size);  
     4395                    list($folder,$size) = explode(";",$line2); 
    43944396                    $quota=$this->get_quotaroot(array('folder' => $folder)); 
    4395                     $hasquota=($quota['quota_limit']!=""); 
    43964397                    $isroot=(strpos($quota['quota_root'],$folder)!==false); 
    43974398                    if($isroot){ 
    4398                         $quotaPercent = ($hasquota?(($quota_used / 1024) / $quota['quota_limit'])*100:0);  
    4399                         $folder = mb_convert_encoding($folder, "ISO_8859-1", "UTF7-IMAP");  
    4400                         if(preg_match('/user\\'.$this->imap_delimiter.$this->username.'\\'.$this->imap_delimiter.'/i',$folder)){  
    4401                              $folder = preg_replace('/user\\'.$this->imap_delimiter.$this->username.'\\'.$this->imap_delimiter.'/i','', $folder);  
    4402                              $data[$folder] = array("quota_percent" => ($hasquota?sprintf("%.1f",round($quotaPercent,1)):''), "quota_used" => $quota_used, "quota_limit" => ($isroot && $folder!=$this->functions->getLang("Inbox")?$quota['quota_limit']:''));  
    4403                              return $data; 
    4404                         }  
    4405                          
     4399                        return $quota; 
    44064400                    } 
    44074401            }  
Note: See TracChangeset for help on using the changeset viewer.