]>
Commit | Line | Data |
---|---|---|
1 | <?php | |
2 | /* vim: set ts=4 tw=0 sw=4 noet: */ | |
3 | require_once 'Mail/mimeDecode.php'; | |
4 | require_once 'config.php'; | |
5 | require_once $CFG->root . 'lib/db_factory.php'; | |
6 | require_once $CFG->root . 'lib/utils.inc.php'; | |
7 | ||
8 | $util = Utils::getInstance(); | |
9 | $loggedIn = $util->isLoggedIn(); | |
10 | if ($loggedIn && isset($_GET['id'])) { | |
11 | $util->setHeading('Full Headers Report'); | |
12 | echo $util->getHeader(); | |
13 | echo $util->getHeading(); | |
14 | ||
15 | $id = $_GET['id']; | |
16 | $mail = unserialize($_SESSION['mailInfo'][$id]); | |
17 | ||
18 | $row = $DB->getMail($id); | |
19 | $string = $row->mail_text; | |
20 | $sa_tests = null; | |
21 | $params['include_bodies'] = false; | |
22 | $params['decode_bodies'] = true; | |
23 | $params['decode_headers'] = true; | |
24 | $params['input'] = $string; | |
25 | $params['crlf'] = "\r\n"; | |
26 | ||
27 | $structure = Mail_mimeDecode::decode($params); | |
28 | $headers = $structure->headers; | |
29 | $output = '<table><tr><th>Header</th><th>Value</th></tr>'; | |
30 | foreach ($headers as $header => $value) { | |
31 | if (is_array($value)) { | |
32 | $text = ''; | |
33 | foreach ($value as $val) { | |
34 | if ($text == '') { | |
35 | $text = $val; | |
36 | } else { | |
37 | $text .= "<br/><br/>$val"; | |
38 | } | |
39 | } | |
40 | } else { | |
41 | $text = $value; | |
42 | } | |
43 | $output .= "<tr><td class=\"label\">$header</td><td class=\"value\">$text</td></tr>"; | |
44 | } | |
45 | $output .= '</table>'; | |
46 | echo '<table class="button-menu">'; | |
47 | echo '<tr class="button-row">'; | |
48 | echo '<td class="button"><input class="btn-input" type="button" value="Return" | |
49 | onclick="javascript: history.back();"/></td>'; | |
50 | echo '</tr></table>'; | |
51 | echo $output; | |
52 | echo $util->getFooter(); | |
53 | } else if ($loggedIn) { | |
54 | header('Location: index.php'); | |
55 | } else { | |
56 | header('Location: auth.php'); | |
57 | } | |
58 | ||
59 | ?> |