alecpl
2010-02-05 ad18d63cc15d7b0a77a5d90dc9f8bd7476b90c8d
program/steps/mail/func.inc
@@ -458,9 +458,6 @@
    if ($header->flagged)
      $a_msg_flags['flagged'] = 1;
      
    if ($browser->ie)
      $a_msg_cols = rc_utf8_clean($a_msg_cols);
    $OUTPUT->command('add_message_row',
      $header->uid,
      $a_msg_cols,
@@ -518,11 +515,11 @@
  $OUTPUT->add_gui_object('quotadisplay', $attrib['id']);
  
  $quota = rcmail_quota_content(NULL, $attrib);
  $quota = rcmail_quota_content($attrib);
  
  if (is_array($quota)) {
    $OUTPUT->add_script('$(document).ready(function(){
   rcmail.set_quota('.json_encode($quota).')});', 'foot');
   rcmail.set_quota('.json_serialize($quota).')});', 'foot');
    $quota = '';
    }
  
@@ -530,30 +527,33 @@
  }
function rcmail_quota_content($quota=NULL, $attrib=NULL)
function rcmail_quota_content($attrib=NULL)
  {
  global $IMAP, $COMM_PATH, $RCMAIL;
  global $COMM_PATH, $RCMAIL;
  $display = isset($_SESSION['quota_display']) ? $_SESSION['quota_display'] : '';
  if (empty($quota)) {
    if (!$IMAP->get_capability('QUOTA'))
      return rcube_label('unknown');
    else
      $quota = $IMAP->get_quota();
    }
  $quota = $RCMAIL->imap->get_quota();
  $quota = $RCMAIL->plugins->exec_hook('quota', $quota);
  if ($quota && !($quota['total']==0 && $RCMAIL->config->get('quota_zero_as_unlimited')))
  if (!isset($quota['used']) || !isset($quota['total']))
    return rcube_label('unknown');
  if (!($quota['total']==0 && $RCMAIL->config->get('quota_zero_as_unlimited')))
    {
    if (!isset($quota['percent']))
      $quota['percent'] = min(100, round(($quota['used']/max(1,$quota['total']))*100));
    $quota_result = sprintf('%s / %s (%.0f%%)',
        show_bytes($quota['used'] * 1024), show_bytes($quota['total'] * 1024),
        $quota['percent']);
    if ($display == 'image') {
      $quota_result = array(
      $quota_result = array(
       'percent'    => $quota['percent'],
        'title'      => $quota_result,
   );
      if ($attrib['width'])
        $quota_result['width'] = $attrib['width'];
      if ($attrib['height'])
@@ -608,6 +608,7 @@
  return html::span($attrib, rcmail_get_mailbox_name_text());
}
function rcmail_get_mailbox_name_text()
{
  global $RCMAIL;
@@ -630,7 +631,7 @@
    
  return $unseen;
}
/**
 * Sets message is_safe flag according to 'show_images' option value
@@ -660,6 +661,7 @@
  }
}
/**
 * Cleans up the given message HTML Body (for displaying)
 *
@@ -677,7 +679,7 @@
  // special replacements (not properly handled by washtml class)
  $html_search = array(
    '/(<\/nobr>)(\s+)(<nobr>)/i',   // space(s) between <NOBR>
    '/<title>.*<\/title>/i',      // PHP bug #32547 workaround: remove title tag
    '/<title[^>]*>.*<\/title>/i',      // PHP bug #32547 workaround: remove title tag
    '/^(\0\0\xFE\xFF|\xFF\xFE\0\0|\xFE\xFF|\xFF\xFE|\xEF\xBB\xBF)/',   // byte-order mark (only outlook?)
    '/<html\s[^>]+>/i',         // washtml/DOMDocument cannot handle xml namespaces
  );
@@ -734,7 +736,7 @@
  $html = $washer->wash($html);
  $REMOTE_OBJECTS = $washer->extlinks;
  return $html;
}
@@ -790,6 +792,7 @@
  return $data['type'] == 'html' ? $data['body'] : html::tag('pre', array(), $data['body']);
}
/**
 * Handle links and citation marks in plain text message
@@ -902,8 +905,8 @@
  $tagname = $matches[2];
  $tagname = preg_replace(array(
    '/:.*$/',      // Microsoft's Smart Tags <st1:xxxx>
    '/[^a-z0-9_-]/i',   // forbidden characters
    '/:.*$/',         // Microsoft's Smart Tags <st1:xxxx>
    '/[^a-z0-9_\[\]\!-]/i',   // forbidden characters
    ), '', $tagname);
  return $matches[1].$tagname;
@@ -1145,12 +1148,12 @@
    $attrib['href'] = "./bin/modcss.php?u=" . urlencode($attrib['href']) . "&amp;c=" . urlencode($GLOBALS['rcmail_html_container_id']);
    $end = ' />';
  }
  else if (preg_match("/^mailto:$EMAIL_ADDRESS_PATTERN/i", $attrib['href'], $mailto)) {
  else if (preg_match('/^mailto:'.$EMAIL_ADDRESS_PATTERN.'(\?[^"\'>]+)?/i', $attrib['href'], $mailto)) {
    $attrib['href'] = $mailto[0];
    $attrib['onclick'] = sprintf(
      "return %s.command('compose','%s',this)",
      JS_OBJECT_NAME,
      JQ($mailto[1]));
      JQ($mailto[1].$mailto[2]));
  }
  else if (!empty($attrib['href']) && $attrib['href'][0] != '#') {
    $attrib['target'] = '_blank';