]>
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 $mail = unserialize($_SESSION['mailInfo'][$id]);
16 if (! is_object($mail) || false == $util->authorized($mail->recipient
)) {
17 header('Location: index.php');
21 $util->setHeading("Message ID : $id");
22 echo $util->getHeader();
23 echo $util->getHeading();
25 $row = $DB->getMail($id);
26 $string = $row->mail_text;
28 $params['include_bodies'] = true;
29 $params['decode_bodies'] = true;
30 $params['decode_headers'] = true;
31 $params['input'] = $string;
32 $params['crlf'] = "\r\n
";
34 $structure = Mail_mimeDecode::decode($params);
35 $headers = $structure->headers;
37 echo '<table class="button
-menu
">';
38 echo '<tr class="button
-row
">';
39 echo '<td class="button
"><input class="btn
-input
" type="button
" value="Return"
40 onclick="javascript
: history
.back();"/></td>';
44 $from = $headers['from'];
45 $from = str_replace("<", "<
;", $from);
46 $from = str_replace(">", ">
;", $from);
47 echo "<tr
><td
class=\"label\"
>From
</td
><td
class=\"value\"
>$from</td
></tr
>";
49 $to = str_replace("<", "<
;", $to);
50 $to = str_replace(">", ">
;", $to);
51 echo "<tr
><td
class=\"label\"
>To
</td
><td
class=\"value\"
>$to</td
></tr
>";
52 $date = $headers['date'];
53 $date = str_replace("<", "<
;", $date);
54 $date = str_replace(">", ">
;", $date);
55 echo "<tr
><td
class=\"label\"
>Date
</td
><td
class=\"value\"
>$date</td
></tr
>";
56 echo "<tr
><td
class=\"label\"
>Subject
</td
><td
class=\"value\"
>".$headers['subject']."</td
></tr
>";
57 echo '<tr><td class="label
">Body</td><td class="value
">';
58 if (isset($structure->parts)) {
59 foreach ($structure->parts as $part) {
60 if ($_GET['format'] == 'html') {
61 if ($part->ctype_primary=="text
" and $part->ctype_secondary=="html
") {
62 $bodytext = str_replace("\n
", " ",$part->body);
63 $bodytext = str_replace("<body
>", "", $bodytext);
64 $bodytext = str_replace("</body
>", "", $bodytext);
65 $bodytext = str_replace("<head
>", "", $bodytext);
66 $bodytext = str_replace("</head
>", "", $bodytext);
67 $bodytext = str_replace("<html
>", "", $bodytext);
68 $bodytext = str_replace("</html
>", "", $bodytext);
72 if ($part->ctype_primary=="text
" and $part->ctype_secondary=="plain
") {
73 $bodytext = str_replace("\n
", "<br
/>",$part->body);
79 if ($_GET['format'] == 'html') {
80 $bodytext = str_replace("\n
", " ",$structure->body);
81 $bodytext = str_replace("<body
>", "", $bodytext);
82 $bodytext = str_replace("</body
>", "", $bodytext);
83 $bodytext = str_replace("<head
>", "", $bodytext);
84 $bodytext = str_replace("</head
>", "", $bodytext);
86 $bodytext = str_replace("<html
>", "", $bodytext);
87 $bodytext = str_replace("</html
>", "", $bodytext);
90 $bodytext = $structure->body;
91 $bodytext = wordwrap($bodytext, 90, "<br
/>");
95 echo '</td></tr></table>';
96 echo $util->getFooter();
97 } else if ($loggedIn) {
98 header('Location: index.php');
100 header('Location: auth.php');
This page took 0.694362 seconds and 6 git commands to generate.