Aleksander Machniak
2016-05-02 9796cd2063770a8562d58d6492fd6904cdeb4627
commit | author | age
e5686f 1 <?php
041c93 2
a95874 3 /**
e5686f 4  +-----------------------------------------------------------------------+
A 5  | program/steps/mail/headers.inc                                        |
6  |                                                                       |
e019f2 7  | This file is part of the Roundcube Webmail client                     |
323fa2 8  | Copyright (C) 2005-2016, The Roundcube Dev Team                       |
7fe381 9  |                                                                       |
T 10  | Licensed under the GNU General Public License version 3 or            |
11  | any later version with exceptions for skins & plugins.                |
12  | See the README file for a full license statement.                     |
e5686f 13  |                                                                       |
A 14  | PURPOSE:                                                              |
15  |   Fetch message headers in raw format for display                     |
16  |                                                                       |
17  +-----------------------------------------------------------------------+
18  | Author: Aleksander Machniak <alec@alec.pl>                            |
19  +-----------------------------------------------------------------------+
20 */
21
c97625 22 if ($uid = rcube_utils::get_input_value('_uid', rcube_utils::INPUT_POST)) {
323fa2 23     if ($pos = strpos($uid, '.')) {
AM 24         $message = new rcube_message($uid);
e8b6e7 25         $source  = $message->get_part_body(substr($uid, $pos + 1));
323fa2 26         $source  = substr($source, 0, strpos($source, "\r\n\r\n"));
AM 27     }
28     else {
29         $source = $RCMAIL->storage->get_raw_headers($uid);
30     }
e5686f 31
64e3e8 32     if ($source !== false) {
10141c 33         $source = trim(rcube_charset::clean($source));
AM 34         $source = htmlspecialchars($source);
64e3e8 35         $source = preg_replace(
A 36             array(
37                 '/\n[\t\s]+/',
38                 '/^([a-z0-9_:-]+)/im',
39                 '/\r?\n/'
40             ),
41             array(
42                 "\n&nbsp;&nbsp;&nbsp;&nbsp;",
43                 '<font class="bold">\1</font>',
44                 '<br />'
45             ), $source);
46
47         $OUTPUT->command('set_headers', $source);
e5686f 48     }
64e3e8 49     else {
A 50         $RCMAIL->output->show_message('messageopenerror', 'error');
51     }
52
53     $OUTPUT->send();
e5686f 54 }
64e3e8 55
e5686f 56 exit;