Changeset 5b3ed54 in github


Ignore:
Timestamp:
Dec 13, 2009 1:28:47 PM (3 years ago)
Author:
alecpl <alec@…>
Branches:
master, HEAD, courier-fix, dev-browser-capabilities, pdo, release-0.6, release-0.7, release-0.8
Children:
63ffe33c
Parents:
317a7d9
Message:
  • Plugin API: added 'quota' hook
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • CHANGELOG

    rf96ffde r5b3ed54  
    22=========================== 
    33 
     4- Plugin API: added 'quota' hook 
    45- Fix parsing conditional comments in HTML messages (#1486350) 
    56- Use built-in json_encode() for proper JSON format in AJAX replies 
  • program/steps/mail/check_recent.inc

    r00a8338 r5b3ed54  
    4747 
    4848      if (!empty($_GET['_quota'])) 
    49         $OUTPUT->command('set_quota', rcmail_quota_content($IMAP->get_quota())); 
     49        $OUTPUT->command('set_quota', rcmail_quota_content()); 
    5050 
    5151      // trigger plugin hook 
  • program/steps/mail/func.inc

    r2717f9f r5b3ed54  
    516516  $OUTPUT->add_gui_object('quotadisplay', $attrib['id']); 
    517517   
    518   $quota = rcmail_quota_content(NULL, $attrib); 
     518  $quota = rcmail_quota_content($attrib); 
    519519   
    520520  if (is_array($quota)) { 
     
    528528 
    529529 
    530 function rcmail_quota_content($quota=NULL, $attrib=NULL) 
    531   { 
    532   global $IMAP, $COMM_PATH, $RCMAIL; 
     530function rcmail_quota_content($attrib=NULL) 
     531  { 
     532  global $COMM_PATH, $RCMAIL; 
    533533 
    534534  $display = isset($_SESSION['quota_display']) ? $_SESSION['quota_display'] : ''; 
    535535 
    536   if (empty($quota)) { 
    537     if (!$IMAP->get_capability('QUOTA')) 
    538       return rcube_label('unknown'); 
    539     else  
    540       $quota = $IMAP->get_quota(); 
    541     } 
    542  
    543   if ($quota && !($quota['total']==0 && $RCMAIL->config->get('quota_zero_as_unlimited'))) 
     536  $quota = $RCMAIL->imap->get_quota(); 
     537  $quota = $RCMAIL->plugins->exec_hook('quota', $quota); 
     538 
     539  if (!isset($quota['used']) || !isset($quota['total'])) 
     540    return rcube_label('unknown'); 
     541 
     542  if (!($quota['total']==0 && $RCMAIL->config->get('quota_zero_as_unlimited'))) 
    544543    { 
     544    if (!isset($quota['percent'])) 
     545      $quota['percent'] = min(100, round(($quota['used']/max(1,$quota['total']))*100)); 
     546     
    545547    $quota_result = sprintf('%s / %s (%.0f%%)', 
    546548        show_bytes($quota['used'] * 1024), show_bytes($quota['total'] * 1024), 
     
    548550 
    549551    if ($display == 'image') { 
    550       $quota_result = array(         
     552      $quota_result = array( 
    551553        'percent'       => $quota['percent'], 
    552554        'title'         => $quota_result, 
    553555        ); 
     556 
    554557      if ($attrib['width']) 
    555558        $quota_result['width'] = $attrib['width']; 
     
    734737  $html = $washer->wash($html); 
    735738  $REMOTE_OBJECTS = $washer->extlinks; 
    736    
     739 
    737740  return $html; 
    738741} 
  • program/steps/mail/move_del.inc

    rcbeea3d r5b3ed54  
    114114  } 
    115115 
    116   $OUTPUT->command('set_quota', rcmail_quota_content($IMAP->get_quota())); 
     116  $OUTPUT->command('set_quota', rcmail_quota_content()); 
    117117  $OUTPUT->command('set_rowcount', rcmail_get_messagecount_text($msg_count)); 
    118118 
Note: See TracChangeset for help on using the changeset viewer.