]> git.datanom.net - qtadmin.git/blob - show_headers.php
add more debug info
[qtadmin.git] / show_headers.php
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 = new Utils;
9 $loggedIn = $util->isLoggedIn();
10 if ($loggedIn && isset($_GET['id'])) {
11 $id = $_GET['id'];
12 $mail = unserialize($_SESSION['mailInfo'][$id]);
13
14 if (! is_object($mail) || false == $util->authorized($mail->recipient)) {
15 header('Location: qtadmin.php');
16 exit;
17 }
18
19 $util->setHeading('Full Headers Report');
20 echo $util->getHeader();
21 echo $util->getHeading();
22
23 $row = $DB->getMail($id);
24 $string = $row->mail_text;
25 $sa_tests = null;
26 $params['include_bodies'] = false;
27 $params['decode_bodies'] = true;
28 $params['decode_headers'] = true;
29 $params['input'] = $string;
30 $params['crlf'] = "\r\n";
31
32 $structure = Mail_mimeDecode::decode($params);
33 $headers = $structure->headers;
34 $output = '<table><tr><th>Header</th><th>Value</th></tr>';
35 foreach ($headers as $header => $value) {
36 if (is_array($value)) {
37 $text = '';
38 foreach ($value as $val) {
39 if ($text == '') {
40 $text = $val;
41 } else {
42 $text .= "<br/><br/>$val";
43 }
44 }
45 } else {
46 $text = $value;
47 }
48 $output .= "<tr><td class=\"label\">$header</td><td class=\"value\">$text</td></tr>";
49 }
50 $output .= '</table>';
51 echo '<table class="button-menu">';
52 echo '<tr class="button-row">';
53 echo '<td class="button"><input class="btn-input" type="button" value="Return"
54 onclick="javascript: history.back();"/></td>';
55 echo '</tr></table>';
56 echo $output;
57 echo $util->getFooter();
58 } else if ($loggedIn) {
59 header('Location: qtadmin.php');
60 } else {
61 header('Location: auth.php');
62 }
63
64 ?>
This page took 0.063019 seconds and 6 git commands to generate.