- Timestamp:
- 08/13/10 11:18:42 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2.2/expressoMail1_2/inc/class.imap_functions.inc.php
r3138 r3157 3783 3783 return $exporteml->download_all_attachments($params); 3784 3784 } 3785 function get_quota_folders(){ 3786 3787 // Additional Imap Class for not-implemented functions into PHP-IMAP extension. 3788 include_once("class.imapfp.inc.php"); 3789 $imapfp = new imapfp(); 3790 3791 if(!$imapfp->open($this->imap_server,$this->imap_port)) 3792 return $imapfp->get_error(); 3793 if (!$imapfp->login( $this->username,$this->password )) 3794 return $imapfp->get_error(); 3795 3796 $response_array = $imapfp->get_mailboxes_size(); 3797 if ($imapfp->error) 3798 return $imapfp->get_error(); 3799 3800 $data = array(); 3801 $quota_root = $this->get_quota(array('folder_id' => "INBOX")); 3802 $data["quota_root"] = $quota_root; 3803 3804 foreach ($response_array as $idx=>$line) { 3805 $line2 = str_replace('"', "", $line); 3806 $line2 = str_replace(" /vendor/cmu/cyrus-imapd/size (value.shared ",";",str_replace("* ANNOTATION ","",$line2)); 3807 list($folder,$size) = explode(";",$line2); 3808 $size = str_replace(")","",$size); 3809 $quotaPercent = (($size / 1048576) / $data["quota_root"]["quota_limit"])*100; 3810 if ($size < 1048576 && $size > 1024) 3811 $quota_used = round($size / 1024, 0).' Kb'; 3812 else if($size > 1024) 3813 $quota_used = round($size / (1024*1024), 1).' Mb'; 3814 else 3815 $quota_used = $size." b"; 3816 $folder = mb_convert_encoding($folder, "ISO_8859-1", "UTF7-IMAP"); 3817 if(!preg_match('/user\\'.$this->imap_delimiter.$this->username.'\\'.$this->imap_delimiter.'/i',$folder)){ 3818 $folder = $this->functions->getLang("Inbox"); 3819 } 3820 else 3821 $folder = preg_replace('/user\\'.$this->imap_delimiter.$this->username.'\\'.$this->imap_delimiter.'/i','', $folder); 3822 3823 $data[$folder] = array("quota_percent" => sprintf("%.1f",round($quotaPercent,1)), "quota_used" => $quota_used); 3824 } 3825 $imapfp->close(); 3826 return $data; 3827 } 3785 3828 } 3786 3829 ?>
Note: See TracChangeset
for help on using the changeset viewer.