]>
git.datanom.net - qtadmin.git/blob - message_view.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';
9 $loggedIn = $util->isLoggedIn();
10 if ($loggedIn && isset($_GET['id'])) {
14 $util->setHeading("Message ID : $id");
15 echo $util->getHeader();
16 echo $util->getHeading();
18 $mail = unserialize($_SESSION['mailInfo'][$id]);
20 $row = $DB->getMail($id);
21 $string = $row->mail_text;
23 $params['include_bodies'] = true;
24 $params['decode_bodies'] = true;
25 $params['decode_headers'] = true;
26 $params['input'] = $string;
27 $params['crlf'] = "\r\n
";
29 $structure = Mail_mimeDecode::decode($params);
30 $headers = $structure->headers;
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>';
39 $from = $headers['from'];
40 $from = str_replace("<", "<
;", $from);
41 $from = str_replace(">", ">
;", $from);
42 echo "<tr
><td
class=\"label\"
>From
</td
><td
class=\"value\"
>$from</td
></tr
>";
44 $to = str_replace("<", "<
;", $to);
45 $to = str_replace(">", ">
;", $to);
46 echo "<tr
><td
class=\"label\"
>To
</td
><td
class=\"value\"
>$to</td
></tr
>";
47 $date = $headers['date'];
48 $date = str_replace("<", "<
;", $date);
49 $date = str_replace(">", ">
;", $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);
67 if ($part->ctype_primary=="text
" and $part->ctype_secondary=="plain
") {
68 $bodytext = str_replace("\n
", "<br
/>",$part->body);
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);
81 $bodytext = str_replace("<html
>", "", $bodytext);
82 $bodytext = str_replace("</html
>", "", $bodytext);
85 $bodytext = $structure->body;
86 $bodytext = wordwrap($bodytext, 90, "<br
/>");
90 echo '</td></tr></table>';
91 echo $util->getFooter();
92 } else if ($loggedIn) {
93 header('Location: index.php');
95 header('Location: auth.php');
This page took 0.890245 seconds and 6 git commands to generate.