X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=program%2Fsteps%2Fmail%2Fviewsource.inc;h=62992cbb7a3812d532aac49f9893c93cc6fef3a0;hb=a2dd2e41259a5e90016efcd7d083020b95e25527;hp=76046db03b0a367184f3179660e4f9eb0f4e23eb;hpb=0af63e79917234f76cfa7ec74e9d97b24fbf9b55;p=roundcube.git diff --git a/program/steps/mail/viewsource.inc b/program/steps/mail/viewsource.inc index 76046db..62992cb 100644 --- a/program/steps/mail/viewsource.inc +++ b/program/steps/mail/viewsource.inc @@ -4,8 +4,8 @@ +-----------------------------------------------------------------------+ | program/steps/mail/viewsource.inc | | | - | This file is part of the RoundCube Webmail client | - | Copyright (C) 2005, RoundCube Dev. - Switzerland | + | This file is part of the Roundcube Webmail client | + | Copyright (C) 2005-2009, The Roundcube Dev Team | | Licensed under the GNU GPL | | | | PURPOSE: | @@ -15,25 +15,45 @@ | Author: Thomas Bruederli | +-----------------------------------------------------------------------+ - $Id: viewsource.inc 8 2005-09-28 22:28:05Z roundcube $ + $Id: viewsource.inc 4410 2011-01-12 18:25:02Z thomasb $ */ +ob_end_clean(); // similar code as in program/steps/mail/get.inc -if ($_GET['_uid']) - { - header('Content-Type: text/plain'); - print rcmail_message_source($_GET['_uid']); +if ($uid = get_input_value('_uid', RCUBE_INPUT_GET)) +{ + $headers = $IMAP->get_headers($uid); + $charset = $headers->charset ? $headers->charset : $CONFIG['default_charset']; + header("Content-Type: text/plain; charset={$charset}"); + + if (!empty($_GET['_save'])) { + $filename = ($headers->subject ? $IMAP->decode_header($headers->subject) : 'roundcube') . '.eml'; + $browser = $RCMAIL->output->browser; + + if ($browser->ie && $browser->ver < 7) + $filename = rawurlencode(abbreviate_string($filename, 55)); + else if ($browser->ie) + $filename = rawurlencode($filename); + else + $filename = addcslashes($filename, '"'); + + header("Content-Length: {$headers->size}"); + header("Content-Disposition: attachment; filename=\"$filename\""); } + + $IMAP->print_raw_body($uid); +} else - { - raise_error(array('code' => 500, - 'type' => 'php', - 'message' => 'Message UID '.$_GET['_uid'].' not found'), - TRUE, - TRUE); - } +{ + raise_error(array( + 'code' => 500, + 'type' => 'php', + 'file' => __FILE__, 'line' => __LINE__, + 'message' => 'Message UID '.$uid.' not found'), + true, true); +} exit; -?> \ No newline at end of file +