thomascube
2011-12-16 f94e442469deca30b39f3fa08aade83cbd0ede70
program/steps/mail/func.inc
@@ -379,6 +379,8 @@
    // make sort links
    if (in_array($col, $a_sort_cols))
      $col_name = html::a(array('href'=>"./#sort", 'onclick' => 'return '.JS_OBJECT_NAME.".command('sort','".$col."',this)", 'title' => rcube_label('sortby')), $col_name);
    else if ($col_name[0] != '<')
      $col_name = '<span class="' . $col .'">' . $col_name . '</span>';
    $sort_class = $col == $sort_col ? " sorted$sort_order" : '';
    $class_name = $col.$sort_class;
@@ -822,7 +824,7 @@
/**
 * Callback function for washtml cleaning class
 */
function rcmail_washtml_callback($tagname, $attrib, $content)
function rcmail_washtml_callback($tagname, $attrib, $content, $washtml)
{
  switch ($tagname) {
    case 'form':
@@ -834,8 +836,11 @@
      $stripped = preg_replace('/[^a-zA-Z\(:;]/', '', rcmail_xss_entity_decode($content));
      // now check for evil strings like expression, behavior or url()
      if (!preg_match('/expression|behavior|url\(|import[^a]/', $stripped)) {
        $out = html::tag('style', array('type' => 'text/css'), $content);
      if (!preg_match('/expression|behavior|javascript:|import[^a]/i', $stripped)) {
        if (!$washtml->get_config('allow_remote') && stripos($stripped, 'url('))
          $washtml->extlinks = true;
        else
          $out = html::tag('style', array('type' => 'text/css'), $content);
        break;
      }
@@ -887,6 +892,7 @@
  // show these headers
  $standard_headers = array('subject', 'from', 'to', 'cc', 'bcc', 'replyto',
    'mail-reply-to', 'mail-followup-to', 'date');
  $exclude_headers = $attrib['exclude'] ? explode(',', $attrib['exclude']) : array();
  $output_headers = array();
  foreach ($standard_headers as $hkey) {
@@ -895,6 +901,9 @@
    else if ($headers['others'][$hkey])
      $value = $headers['others'][$hkey];
    else
      continue;
    if (in_array($hkey, $exclude_headers))
      continue;
    if ($hkey == 'date') {
@@ -934,7 +943,11 @@
  }
  $plugin = $RCMAIL->plugins->exec_hook('message_headers_output',
    array('output' => $output_headers, 'headers' => $MESSAGE->headers));
    array('output' => $output_headers, 'headers' => $MESSAGE->headers, 'exclude' => $exclude_headers));
  // single header value is requested
  if (!empty($attrib['valueof']))
    return Q($plugin['output'][$attrib['valueof']]['value'], ($hkey == 'subject' ? 'strict' : 'show'));
  // compose html table
  $table = new html_table(array('cols' => 2));
@@ -1021,7 +1034,7 @@
        $body = rcmail_print_body($part, array('safe' => $safe_mode, 'plain' => !$CONFIG['prefer_html']));
        if ($part->ctype_secondary == 'html') {
          $body = rcmail_html4inline($body, $attrib['id'], 'rcmBody', $attrs);
          $body = rcmail_html4inline($body, $attrib['id'], 'rcmBody', $attrs, $safe_mode);
          $div_attr = array('class' => 'message-htmlpart');
          $style = array();
@@ -1059,6 +1072,11 @@
  // list images after mail body
  if ($CONFIG['inline_images'] && !empty($MESSAGE->attachments)) {
    foreach ($MESSAGE->attachments as $attach_prop) {
      // skip inline images
      if ($attach_prop->content_id && $attach_prop->disposition == 'inline') {
        continue;
      }
      // Content-Type: image/*...
      if (preg_match('/^image\//i', $attach_prop->mimetype) ||
        // ...or known file extension: many clients are using application/octet-stream
@@ -1104,7 +1122,7 @@
/**
 * modify a HTML message that it can be displayed inside a HTML page
 */
function rcmail_html4inline($body, $container_id, $body_id='', &$attributes=null)
function rcmail_html4inline($body, $container_id, $body_id='', &$attributes=null, $allow_remote=false)
{
  $last_style_pos = 0;
  $cont_id = $container_id.($body_id ? ' div.'.$body_id : '');
@@ -1116,7 +1134,7 @@
    // replace all css definitions with #container [def]
    $styles = rcmail_mod_css_styles(
      substr($body, $pos, $pos2-$pos), $cont_id);
      substr($body, $pos, $pos2-$pos), $cont_id, $allow_remote);
    $body = substr_replace($body, $styles, $pos, $pos2-$pos);
    $last_style_pos = $pos2;
@@ -1293,6 +1311,7 @@
            'href' => "#add",
            'onclick' => sprintf("return %s.command('add-contact','%s',this)", JS_OBJECT_NAME, urlencode($string)),
            'title' => rcube_label('addtoaddressbook'),
            'class' => 'rcmaddcontact',
          ),
          html::img(array(
            'src' => $CONFIG['skin_path'] . $addicon,
@@ -1387,7 +1406,7 @@
}
function rcmail_message_part_controls()
function rcmail_message_part_controls($attrib)
{
  global $MESSAGE;
@@ -1400,13 +1419,13 @@
  if (!empty($part->filename)) {
    $table->add('title', Q(rcube_label('filename')));
    $table->add(null, Q($part->filename));
    $table->add(null, '[' . html::a('?'.str_replace('_frame=', '_download=', $_SERVER['QUERY_STRING']), Q(rcube_label('download'))) . ']');
    $table->add('header', Q($part->filename));
    $table->add('download-link', html::a(array('href' => './?'.str_replace('_frame=', '_download=', $_SERVER['QUERY_STRING'])), Q(rcube_label('download'))));
  }
  if (!empty($part->size)) {
    $table->add('title', Q(rcube_label('filesize')));
    $table->add(null, Q(show_bytes($part->size)));
    $table->add('header', Q(show_bytes($part->size)));
  }
  return $table->show($attrib);