| | |
| | | // 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'); |
| | |
| | | 'vars' => array('expected' => "$mimetype (.$file_extension)", 'detected' => "$real_mimetype (.$extensions[0])") |
| | | )) . |
| | | html::p('buttons', |
| | | html::tag('button', null, |
| | | html::a(array( |
| | | 'href' => $RCMAIL->url(array_merge($_GET, array('_nocheck' => 1))), |
| | | 'style' => 'text-decoration:none;color:#000', |
| | | ), rcube_label('showanyway'))) |
| | | )) |
| | | html::tag('button', |
| | | array('onclick' => "location.href='" . $RCMAIL->url(array_merge($_GET, array('_nocheck' => 1))) . "'"), |
| | | rcube_label('showanyway'))) |
| | | ) |
| | | ))); |
| | | exit; |
| | | } |
| | |
| | | // 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)); |
| | |
| | | $filename = str_ireplace('attachment', 'attach', $filename); |
| | | } |
| | | |
| | | // add filename extension if missing |
| | | if (!pathinfo($filename, PATHINFO_EXTENSION) && ($extensions = rcube_mime::get_mime_extensions($mimetype))) { |
| | | $filename .= '.' . $extensions[0]; |
| | | } |
| | | |
| | | header("Content-Disposition: $disposition; filename=\"$filename\""); |
| | | |
| | | // handle tiff to jpeg conversion |