]> git.datanom.net - qtadmin.git/blame - message_view.php
Center summary text
[qtadmin.git] / message_view.php
CommitLineData
6df4b805 1<?php
6b3d5ba9 2/* vim: set ts=4 tw=0 sw=4 noet: */
b95d1cdb
MR
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';
6df4b805 7
3056d117 8 $util = new Utils;
b95d1cdb
MR
9 $loggedIn = $util->isLoggedIn();
10 if ($loggedIn && isset($_GET['id'])) {
6df4b805
MR
11 $id = $_GET['id'];
12 $id = urldecode($id);
13
b95d1cdb
MR
14 $util->setHeading("Message ID : $id");
15 echo $util->getHeader();
16 echo $util->getHeading();
6df4b805 17
b95d1cdb 18 $mail = unserialize($_SESSION['mailInfo'][$id]);
6df4b805 19
b95d1cdb
MR
20 $row = $DB->getMail($id);
21 $string = $row->mail_text;
22 $sa_tests = null;
23 $params['include_bodies'] = true;
24 $params['decode_bodies'] = true;
25 $params['decode_headers'] = true;
26 $params['input'] = $string;
27 $params['crlf'] = "\r\n";
6df4b805 28
b95d1cdb
MR
29 $structure = Mail_mimeDecode::decode($params);
30 $headers = $structure->headers;
6df4b805 31
b95d1cdb
MR
32 echo '<table class="button-menu">';
33 echo '<tr class="button-row">';
34 echo '<td class="button"><input class="btn-input" type="button" value="Return"
35 onclick="javascript: history.back();"/></td>';
36 echo '</tr></table>';
6df4b805 37
b95d1cdb
MR
38 echo '<table><tr>';
39 $from = $headers['from'];
40 $from = str_replace("<", "&lt;", $from);
41 $from = str_replace(">", "&gt;", $from);
42 echo "<tr><td class=\"label\">From</td><td class=\"value\">$from</td></tr>";
43 $to = $headers['to'];
44 $to = str_replace("<", "&lt;", $to);
45 $to = str_replace(">", "&gt;", $to);
46 echo "<tr><td class=\"label\">To</td><td class=\"value\">$to</td></tr>";
47 $date = $headers['date'];
48 $date = str_replace("<", "&lt;", $date);
49 $date = str_replace(">", "&gt;", $date);
50 echo "<tr><td class=\"label\">Date</td><td class=\"value\">$date</td></tr>";
51 echo "<tr><td class=\"label\">Subject</td><td class=\"value\">".$headers['subject']."</td></tr>";
52 echo '<tr><td class="label">Body</td><td class="value">';
53 if (isset($structure->parts)) {
54 foreach ($structure->parts as $part) {
55 if ($_GET['format'] == 'html') {
56 if ($part->ctype_primary=="text" and $part->ctype_secondary=="html") {
57 $bodytext = str_replace("\n", " ",$part->body);
58 $bodytext = str_replace("<body>", "", $bodytext);
59 $bodytext = str_replace("</body>", "", $bodytext);
60 $bodytext = str_replace("<head>", "", $bodytext);
61 $bodytext = str_replace("</head>", "", $bodytext);
62 $bodytext = str_replace("<html>", "", $bodytext);
63 $bodytext = str_replace("</html>", "", $bodytext);
64 echo $bodytext;
65 }
66 } else {
67 if ($part->ctype_primary=="text" and $part->ctype_secondary=="plain") {
68 $bodytext = str_replace("\n", "<br />",$part->body);
69 echo $bodytext;
70 }
71 }
72 }
73 } else {
74 if ($_GET['format'] == 'html') {
75 $bodytext = str_replace("\n", " ",$structure->body);
76 $bodytext = str_replace("<body>", "", $bodytext);
77 $bodytext = str_replace("</body>", "", $bodytext);
78 $bodytext = str_replace("<head>", "", $bodytext);
79 $bodytext = str_replace("</head>", "", $bodytext);
80
81 $bodytext = str_replace("<html>", "", $bodytext);
82 $bodytext = str_replace("</html>", "", $bodytext);
83 echo $bodytext;
84 } else {
85 $bodytext = $structure->body;
86 $bodytext = wordwrap($bodytext, 90, "<br/>");
87 echo $bodytext;
88 }
89 }
90 echo '</td></tr></table>';
91 echo $util->getFooter();
6df4b805
MR
92 } else if ($loggedIn) {
93 header('Location: index.php');
94 } else {
95 header('Location: auth.php');
96 }
97
98?>
99
This page took 0.050526 seconds and 5 git commands to generate.