source: github/program/steps/mail/viewsource.inc @ 8209f77

HEADcourier-fixdev-browser-capabilitiespdorelease-0.6release-0.7release-0.8
Last change on this file since 8209f77 was 8209f77, checked in by alecpl <alec@…>, 4 years ago
  • decode message subject for 'save' action (#1485902)
  • Property mode set to 100644
File size: 2.0 KB
Line 
1<?php
2
3/*
4 +-----------------------------------------------------------------------+
5 | program/steps/mail/viewsource.inc                                     |
6 |                                                                       |
7 | This file is part of the RoundCube Webmail client                     |
8 | Copyright (C) 2005-2009, RoundCube Dev. - Switzerland                 |
9 | Licensed under the GNU GPL                                            |
10 |                                                                       |
11 | PURPOSE:                                                              |
12 |   Display a mail message similar as a usual mail application does     |
13 |                                                                       |
14 +-----------------------------------------------------------------------+
15 | Author: Thomas Bruederli <roundcube@gmail.com>                        |
16 +-----------------------------------------------------------------------+
17
18 $Id$
19
20*/
21
22ob_end_clean();
23
24// similar code as in program/steps/mail/get.inc
25if ($uid = get_input_value('_uid', RCUBE_INPUT_GET))
26{
27  $headers = $IMAP->get_headers($uid);
28  $charset = $headers->charset ? $headers->charset : $IMAP->default_charset;
29  header("Content-Type: text/plain; charset={$charset}");
30
31  if (!empty($_GET['_save'])) {
32    $filename = ($headers->subject ? $IMAP->decode_header($headers->subject) : 'roundcube') . '.eml';
33    $browser = new rcube_browser;
34   
35    if ($browser->ie && $browser->ver < 7)
36      $filename = rawurlencode(abbreviate_string($filename, 55));
37    else if ($browser->ie)
38      $filename = rawurlencode($filename);
39    else
40      $filename = addcslashes($filename, '"');
41
42    header("Content-Length: {$headers->size}");
43    header("Content-Disposition: attachment; filename=\"$filename\"");
44  }
45 
46  $IMAP->print_raw_body($uid);
47}
48else
49{
50  raise_error(array(
51      'code' => 500,
52      'type' => 'php',
53      'message' => 'Message UID '.$uid.' not found'),
54    true,
55    true);
56}
57
58exit;
59?>
Note: See TracBrowser for help on using the repository browser.