commit | author | age
|
4e17e6
|
1 |
<?php |
T |
2 |
|
|
3 |
/* |
|
4 |
+-----------------------------------------------------------------------+ |
|
5 |
| program/steps/mail/viewsource.inc | |
|
6 |
| | |
|
7 |
| This file is part of the RoundCube Webmail client | |
cbbef3
|
8 |
| Copyright (C) 2005-2009, RoundCube Dev. - Switzerland | |
30233b
|
9 |
| Licensed under the GNU GPL | |
4e17e6
|
10 |
| | |
T |
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 |
|
d51c93
|
22 |
ob_end_clean(); |
4e17e6
|
23 |
|
T |
24 |
// similar code as in program/steps/mail/get.inc |
8d4bcd
|
25 |
if ($uid = get_input_value('_uid', RCUBE_INPUT_GET)) |
17b5fb
|
26 |
{ |
T |
27 |
$headers = $IMAP->get_headers($uid); |
f52c93
|
28 |
$charset = $headers->charset ? $headers->charset : $CONFIG['default_charset']; |
17b5fb
|
29 |
header("Content-Type: text/plain; charset={$charset}"); |
49dfb0
|
30 |
|
A |
31 |
if (!empty($_GET['_save'])) { |
8209f7
|
32 |
$filename = ($headers->subject ? $IMAP->decode_header($headers->subject) : 'roundcube') . '.eml'; |
49dfb0
|
33 |
$browser = new rcube_browser; |
A |
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, '"'); |
7ef05f
|
41 |
|
A |
42 |
header("Content-Length: {$headers->size}"); |
49dfb0
|
43 |
header("Content-Disposition: attachment; filename=\"$filename\""); |
A |
44 |
} |
|
45 |
|
8d4bcd
|
46 |
$IMAP->print_raw_body($uid); |
17b5fb
|
47 |
} |
4e17e6
|
48 |
else |
17b5fb
|
49 |
{ |
T |
50 |
raise_error(array( |
|
51 |
'code' => 500, |
|
52 |
'type' => 'php', |
10eedb
|
53 |
'file' => __FILE__, 'line' => __LINE__, |
17b5fb
|
54 |
'message' => 'Message UID '.$uid.' not found'), |
10eedb
|
55 |
true, true); |
17b5fb
|
56 |
} |
4e17e6
|
57 |
|
T |
58 |
exit; |
5349b7
|
59 |
?> |