alecpl
2008-12-09 de2e0bfeb8bf6884ae4185b94d495a55322348ae
program/steps/mail/func.inc
@@ -22,8 +22,23 @@
require_once('lib/enriched.inc');
require_once('include/rcube_smtp.inc');
$EMAIL_ADDRESS_PATTERN = '/([a-z0-9][a-z0-9\-\.\+\_]*@[a-z0-9]([a-z0-9\-][.]?)*[a-z0-9]\\.[a-z]{2,5})/i';
// actions that do not require imap connection
$NOIMAP_ACTIONS = array('spell', 'addcontact', 'autocomplete', 'upload', 'display-attachment', 'remove-attachment');
// log in to imap server
if (!in_array($RCMAIL->action, $NOIMAP_ACTIONS) && !$RCMAIL->imap_connect()) {
  $RCMAIL->kill_session();
  if ($OUTPUT->ajax_call)
    $OUTPUT->redirect(array(), 2000);
  $OUTPUT->set_env('task', 'login');
  $OUTPUT->send('login');
}
// set imap properties and session vars
if ($mbox = get_input_value('_mbox', RCUBE_INPUT_GPC))
@@ -64,6 +79,9 @@
      $_SESSION['search'][$search_request] = $IMAP->get_search_set();
      $OUTPUT->set_env('search_request', $search_request);
      }
      // make sure the message count is refreshed (for default view)
      $IMAP->messagecount($mbox_name, 'ALL', true);
    }
   
  // set current mailbox in client environment
@@ -264,7 +282,7 @@
      $flagged_icon = $attrib['unflaggedicon'];
    
    // set attachment icon
    if ($attrib['attachmenticon'] && preg_match("/multipart\/[mr]/i", $header->ctype))
    if ($attrib['attachmenticon'] && preg_match("/multipart\/m/i", $header->ctype))
      $attach_icon = $attrib['attachmenticon'];
        
    $out .= sprintf('<tr id="rcmrow%d" class="message%s%s%s%s">'."\n",
@@ -305,7 +323,7 @@
      if ($col!='attachment')
        $out .= '<td class="'.$col.'">' . $cont . "</td>\n";
      else
        $out .= sprintf("<td class=\"icon\">%s</td>\n", $attach_icon ? sprintf($image_tag, $skin_path, $attach_icon, '') : '');
        $out .= sprintf("<td class=\"icon\">%s</td>\n", $attach_icon ? sprintf($image_tag, $skin_path, $attach_icon, '') : '&nbsp;');
      }
    $out .= "</tr>\n";
@@ -649,7 +667,7 @@
      // add head for malformed messages, washtml cannot work without that
      if (!preg_match('/<head[^>]*>(.*)<\/head>/Uims', $html))
        $html = '<head></head>'. $html;
      $html = substr_replace($html, '<meta http-equiv="Content-Type" content="text/html; charset='.RCMAIL_CHARSET.'" />', intval(stripos($html, '</head>')), 0);
      $html = substr_replace($html, '<meta http-equiv="content-type" content="text/html; charset='.RCMAIL_CHARSET.'" />', intval(stripos($html, '<head>')+6), 0);
    }
    // clean HTML with washhtml by Frederic Motte