thomascube
2008-02-07 6f2f2d0ffdf21ac0dce85b5dae8809a49b14a7a2
Truncate attachment filenames to 55 characters (#1484757) and fix misspelled function name

3 files modified
10 ■■■■ changed files
program/include/main.inc 4 ●●●● patch | view | raw | blame | history
program/include/rcube_shared.inc 4 ●●●● patch | view | raw | blame | history
program/steps/mail/get.inc 2 ●●● patch | view | raw | blame | history
program/include/main.inc
@@ -1712,7 +1712,7 @@
      // shorten the folder name to a given length
      if ($maxlength && $maxlength>1)
        {
        $fname = abbrevate_string($foldername, $maxlength);
        $fname = abbreviate_string($foldername, $maxlength);
        if ($fname != $foldername)
          $title = ' title="'.Q($foldername).'"';
        $foldername = $fname;
@@ -1791,7 +1791,7 @@
      
      // shorten the folder name to a given length
      if ($maxlength && $maxlength>1)
        $foldername = abbrevate_string($foldername, $maxlength);
        $foldername = abbreviate_string($foldername, $maxlength);
      }
    $out .= sprintf('<option value="%s">%s%s</option>'."\n",
program/include/rcube_shared.inc
@@ -557,9 +557,9 @@
 * @param string Input string
 * @param int    Max. length
 * @param string Replace removed chars with this
 * @return string Abbrevated string
 * @return string Abbreviated string
 */
function abbrevate_string($str, $maxlength, $place_holder='...')
function abbreviate_string($str, $maxlength, $place_holder='...')
{
  $length = rc_strlen($str);
  $first_part_length = floor($maxlength/2) - rc_strlen($place_holder);
program/steps/mail/get.inc
@@ -108,7 +108,7 @@
      {
      header(sprintf('Content-Disposition: %s; filename="%s";',
                     $_GET['_download'] ? 'attachment' : 'inline',
                     $part->filename ? $part->filename : "roundcube.$ctype_secondary"));
                     $part->filename ? abbreviate_string($part->filename, 55) : "roundcube.$ctype_secondary"));
      // turn off output buffering and print part content
      $IMAP->get_message_part($MESSAGE['UID'], $part->mime_id, $part, true);