Thomas Bruederli
2012-12-29 b26171227804a135b8ba4fef605753ee2121be67
Merge branch 'master' of github.com:roundcube/roundcubemail
7 files modified
98 ■■■■■ changed files
CHANGELOG 1 ●●●● patch | view | raw | blame | history
program/lib/Roundcube/rcube_message.php 21 ●●●●● patch | view | raw | blame | history
program/localization/en_US/labels.inc 2 ●●●●● patch | view | raw | blame | history
program/steps/mail/compose.inc 11 ●●●●● patch | view | raw | blame | history
program/steps/mail/func.inc 37 ●●●● patch | view | raw | blame | history
program/steps/mail/get.inc 21 ●●●●● patch | view | raw | blame | history
program/steps/mail/show.inc 5 ●●●● patch | view | raw | blame | history
CHANGELOG
@@ -1,6 +1,7 @@
CHANGELOG Roundcube Webmail
===========================
- Display PGP/MIME signature attachments as "Digital Signature" (#1488570)
- Workaround UW-IMAP bug where hierarchy separator is added to the shared folder name (#1488879)
- Fix version comparisons with -stable suffix (#1488876)
- Add unsupported alternative parts to attachments list (#1488870)
program/lib/Roundcube/rcube_message.php
@@ -106,7 +106,6 @@
        if (!empty($this->headers->structure)) {
            $this->get_mime_numbers($this->headers->structure);
            $this->parse_structure($this->headers->structure);
            $this->parse_attachments();
        }
        else {
            $this->body = $this->storage->get_body($uid);
@@ -646,26 +645,6 @@
        // message is a single part non-text (without filename)
        else if (preg_match('/application\//i', $mimetype)) {
            $this->attachments[] = $structure;
        }
    }
    /**
     * Parse attachment parts
     */
    private function parse_attachments()
    {
        // Attachment must have a name
        foreach ($this->attachments as $attachment) {
            if (!$attachment->filename) {
                $ext = rcube_mime::get_mime_extensions($attachment->mimetype);
                $ext = array_shift($ext);
                $attachment->filename = 'Part_' . $attachment->mime_id;
                if ($ext) {
                    $attachment->filename .= '.' . $ext;
                }
            }
        }
    }
program/localization/en_US/labels.inc
@@ -377,6 +377,8 @@
$labels['preferhtml'] = 'Display HTML';
$labels['defaultcharset'] = 'Default Character Set';
$labels['htmlmessage'] = 'HTML Message';
$labels['messagepart'] = 'Part';
$labels['digitalsig'] = 'Digital Signature';
$labels['dateformat'] = 'Date format';
$labels['timeformat'] = 'Time format';
$labels['prettydate'] = 'Pretty dates';
program/steps/mail/compose.inc
@@ -1154,16 +1154,7 @@
  }
  $mimetype = $part->ctype_primary . '/' . $part->ctype_secondary;
  $filename = $part->filename;
  if (!strlen($filename)) {
    if ($mimetype == 'text/html') {
      $filename = rcube_label('htmlmessage');
    }
    else {
      $filename = 'Part_'.$pid;
    }
    $filename .= '.' . $part->ctype_secondary;
  }
  $filename = rcmail_attachment_name($part);
  $attachment = array(
    'group' => $COMPOSE['id'],
program/steps/mail/func.inc
@@ -1598,10 +1598,7 @@
  $part  = $MESSAGE->mime_parts[$part];
  $table = new html_table(array('cols' => 3));
  $filename = $part->filename;
  if (empty($filename) && $attach_prop->mimetype == 'text/html') {
    $filename = rcube_label('htmlmessage');
  }
  $filename = rcmail_attachment_name($part);
  if (!empty($filename)) {
    $table->add('title', Q(rcube_label('filename')));
@@ -1614,7 +1611,6 @@
  return $table->show($attrib);
}
function rcmail_message_part_frame($attrib)
@@ -1841,6 +1837,37 @@
  return $name;
}
// return attachment filename, handle empty filename case
function rcmail_attachment_name($attachment, $display = false)
{
    $filename = $attachment->filename;
    if ($filename === null || $filename === '') {
        if ($attachment->mimetype == 'text/html') {
            $filename = rcube_label('htmlmessage');
        }
        else {
            $ext      = rcube_mime::get_mime_extensions($attachment->mimetype);
            $ext      = array_shift($ext);
            $filename = rcube_label('messagepart') . ' ' . $attachment->mime_id;
            if ($ext) {
                $filename .= '.' . $ext;
            }
        }
    }
    $filename = preg_replace('[\r\n]', '', $filename);
    // Display smart names for some known mimetypes
    if ($display) {
        if (preg_match('/application\/(pgp|pkcs7)-signature/i', $attachment->mimetype)) {
            $filename = rcube_label('digitalsig');
        }
    }
    return $filename;
}
function rcmail_search_filter($attrib)
{
  global $OUTPUT, $CONFIG;
program/steps/mail/get.inc
@@ -47,13 +47,7 @@
// show part page
if (!empty($_GET['_frame'])) {
  if (($part_id = get_input_value('_part', RCUBE_INPUT_GPC)) && ($part = $MESSAGE->mime_parts[$part_id])) {
    $filename = $part->filename;
    if (empty($filename) && $part->mimetype == 'text/html') {
      $filename = rcube_label('htmlmessage');
    }
    if (!empty($filename)) {
      $OUTPUT->set_pagetitle($filename);
    }
    $OUTPUT->set_pagetitle(rcmail_attachment_name($part));
  }
  $OUTPUT->send('messagepart');
@@ -236,18 +230,7 @@
      // don't kill the connection if download takes more than 30 sec.
      @set_time_limit(0);
      if ($part->filename) {
        $filename = $part->filename;
      }
      else if ($part->mimetype == 'text/html') {
        $filename = rcube_label('htmlmessage');
      }
      else {
        $ext = '.' . ($mimetype == 'text/plain' ? 'txt' : $ctype_secondary);
        $filename = ($MESSAGE->subject ? $MESSAGE->subject : 'roundcube') . $ext;
      }
      $filename = preg_replace('[\r\n]', '', $filename);
      $filename = rcmail_attachment_name($part);
      if ($browser->ie && $browser->ver < 7)
        $filename = rawurlencode(abbreviate_string($filename, 55));
program/steps/mail/show.inc
@@ -150,10 +150,7 @@
  if (sizeof($MESSAGE->attachments)) {
    foreach ($MESSAGE->attachments as $attach_prop) {
      $filename = $attach_prop->filename;
      if (empty($filename) && $attach_prop->mimetype == 'text/html') {
        $filename = rcube_label('htmlmessage');
      }
      $filename = rcmail_attachment_name($attach_prop, true);
      if ($PRINT_MODE) {
        $size = $RCMAIL->message_part_size($attach_prop);