Changeset 2172 in subversion
- Timestamp:
- Dec 18, 2008 7:00:06 AM (4 years ago)
- Location:
- trunk/roundcubemail
- Files:
-
- 2 edited
-
CHANGELOG (modified) (1 diff)
-
program/lib/imap.inc (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/roundcubemail/CHANGELOG
r2170 r2172 5 5 ---------- 6 6 - Fix STARTTLS before AUTH in SMTP connection (#1484883) 7 - Support multiple quota values in QUOTAROOT resonse (#1485626) 7 8 8 9 2008/12/16 (thomasb) -
trunk/roundcubemail/program/lib/imap.inc
r2144 r2172 76 76 - added 4th argument to iil_Connect() 77 77 - allow setting rootdir and delimiter before connect 78 - support multiquota result 78 79 79 80 ********************************************************/ … … 2657 2658 * QUOTAROOT INBOX user/rchijiiwa1 2658 2659 * QUOTA user/rchijiiwa1 (STORAGE 654 9765) 2659 bOK Completed2660 * OK Completed 2660 2661 */ 2661 2662 $fp = $conn->fp; 2662 2663 $result = false; 2663 $quota_line = '';2664 2665 // get linecontaining quota info2664 $quota_lines = array(); 2665 2666 // get line(s) containing quota info 2666 2667 if (iil_PutLine($fp, 'QUOT1 GETQUOTAROOT "INBOX"')) { 2667 2668 do { 2668 2669 $line=chop(iil_ReadLine($fp, 5000)); 2669 2670 if (iil_StartsWith($line, '* QUOTA ')) { 2670 $quota_line = $line;2671 $quota_lines[] = $line; 2671 2672 } 2672 2673 } while (!iil_StartsWith($line, 'QUOT1', true)); 2673 2674 } 2674 2675 2675 //return false if not found, parse if found 2676 if (!empty($quota_line)) { 2676 // return false if not found, parse if found 2677 $min_free = PHP_INT_MAX; 2678 foreach ($quota_lines as $key => $quota_line) { 2677 2679 $quota_line = eregi_replace('[()]', '', $quota_line); 2678 2680 $parts = explode(' ', $quota_line); 2679 2681 $storage_part = array_search('STORAGE', $parts); 2680 if ($storage_part > 0) { 2681 $result['used'] = intval($parts[$storage_part+1]); 2682 $result['total'] = intval($parts[$storage_part+2]); 2683 $result['percent'] = min(100, round(($result['used']/max(1,$result['total']))*100)); 2682 2683 if (!$storage_part) continue; 2684 2685 $used = intval($parts[$storage_part+1]); 2686 $total = intval($parts[$storage_part+2]); 2687 $free = $total - $used; 2688 2689 // return lowest available space from all quotas 2690 if ($free < $min_free) { 2691 $min_free = $free; 2692 $result['used'] = $used; 2693 $result['total'] = $total; 2694 $result['percent'] = min(100, round(($used/max(1,$total))*100)); 2684 2695 $result['free'] = 100 - $result['percent']; 2685 2696 }
Note: See TracChangeset
for help on using the changeset viewer.
