X-Git-Url: http://git.datanom.net/qtadmin.git/blobdiff_plain/eda4e624d212be8beb7d3d5764103082f7ecdd03..8b713e6bb0c26f75c7add6f8847e5ddcfee8b1b4:/message_view.php?ds=inline diff --git a/message_view.php b/message_view.php index aeaa496..c65a0f5 100644 --- a/message_view.php +++ b/message_view.php @@ -1,94 +1,94 @@ root . 'lib/db_factory.php'; - require_once $CFG->root . 'lib/utils.inc.php'; +/* vim: set ts=4 tw=4 sw=4 noet: */ + require_once 'Mail/mimeDecode.php'; + require_once 'config.php'; + require_once $CFG->root . 'lib/db_factory.php'; + require_once $CFG->root . 'lib/utils.inc.php'; - $util = Utils::getInstance(); - $loggedIn = $util->isLoggedIn(); - if ($loggedIn && isset($_GET['id'])) { + $util = new Utils; + $loggedIn = $util->isLoggedIn(); + if ($loggedIn && isset($_GET['id'])) { $id = $_GET['id']; $id = urldecode($id); - $util->setHeading("Message ID : $id"); - echo $util->getHeader(); - echo $util->getHeading(); + $util->setHeading("Message ID : $id"); + echo $util->getHeader(); + echo $util->getHeading(); - $mail = unserialize($_SESSION['mailInfo'][$id]); + $mail = unserialize($_SESSION['mailInfo'][$id]); - $row = $DB->getMail($id); - $string = $row->mail_text; - $sa_tests = null; - $params['include_bodies'] = true; - $params['decode_bodies'] = true; - $params['decode_headers'] = true; - $params['input'] = $string; - $params['crlf'] = "\r\n"; - - $structure = Mail_mimeDecode::decode($params); - $headers = $structure->headers; + $row = $DB->getMail($id); + $string = $row->mail_text; + $sa_tests = null; + $params['include_bodies'] = true; + $params['decode_bodies'] = true; + $params['decode_headers'] = true; + $params['input'] = $string; + $params['crlf'] = "\r\n"; - echo ''; - echo ''; - echo ''; - echo '
'; + $structure = Mail_mimeDecode::decode($params); + $headers = $structure->headers; - echo ''; - $from = $headers['from']; - $from = str_replace("<", "<", $from); - $from = str_replace(">", ">", $from); - echo ""; - $to = $headers['to']; - $to = str_replace("<", "<", $to); - $to = str_replace(">", ">", $to); - echo ""; - $date = $headers['date']; - $date = str_replace("<", "<", $date); - $date = str_replace(">", ">", $date); - echo ""; - echo ""; - echo '
From$from
To$to
Date$date
Subject".$headers['subject']."
Body'; - if (isset($structure->parts)) { - foreach ($structure->parts as $part) { - if ($_GET['format'] == 'html') { - if ($part->ctype_primary=="text" and $part->ctype_secondary=="html") { - $bodytext = str_replace("\n", " ",$part->body); - $bodytext = str_replace("", "", $bodytext); - $bodytext = str_replace("", "", $bodytext); - $bodytext = str_replace("", "", $bodytext); - $bodytext = str_replace("", "", $bodytext); - $bodytext = str_replace("", "", $bodytext); - $bodytext = str_replace("", "", $bodytext); - echo $bodytext; - } - } else { - if ($part->ctype_primary=="text" and $part->ctype_secondary=="plain") { - $bodytext = str_replace("\n", "
",$part->body); - echo $bodytext; - } - } - } - } else { - if ($_GET['format'] == 'html') { - $bodytext = str_replace("\n", " ",$structure->body); - $bodytext = str_replace("", "", $bodytext); - $bodytext = str_replace("", "", $bodytext); - $bodytext = str_replace("", "", $bodytext); - $bodytext = str_replace("", "", $bodytext); + echo ''; + echo ''; + echo ''; + echo '
'; - $bodytext = str_replace("", "", $bodytext); - $bodytext = str_replace("", "", $bodytext); - echo $bodytext; - } else { - $bodytext = $structure->body; - $bodytext = wordwrap($bodytext, 90, "
"); - echo $bodytext; - } - } - echo '
'; - echo $util->getFooter(); + echo ''; + $from = $headers['from']; + $from = str_replace("<", "<", $from); + $from = str_replace(">", ">", $from); + echo ""; + $to = $headers['to']; + $to = str_replace("<", "<", $to); + $to = str_replace(">", ">", $to); + echo ""; + $date = $headers['date']; + $date = str_replace("<", "<", $date); + $date = str_replace(">", ">", $date); + echo ""; + echo ""; + echo '
From$from
To$to
Date$date
Subject".$headers['subject']."
Body'; + if (isset($structure->parts)) { + foreach ($structure->parts as $part) { + if ($_GET['format'] == 'html') { + if ($part->ctype_primary=="text" and $part->ctype_secondary=="html") { + $bodytext = str_replace("\n", " ",$part->body); + $bodytext = str_replace("", "", $bodytext); + $bodytext = str_replace("", "", $bodytext); + $bodytext = str_replace("", "", $bodytext); + $bodytext = str_replace("", "", $bodytext); + $bodytext = str_replace("", "", $bodytext); + $bodytext = str_replace("", "", $bodytext); + echo $bodytext; + } + } else { + if ($part->ctype_primary=="text" and $part->ctype_secondary=="plain") { + $bodytext = str_replace("\n", "
",$part->body); + echo $bodytext; + } + } + } + } else { + if ($_GET['format'] == 'html') { + $bodytext = str_replace("\n", " ",$structure->body); + $bodytext = str_replace("", "", $bodytext); + $bodytext = str_replace("", "", $bodytext); + $bodytext = str_replace("", "", $bodytext); + $bodytext = str_replace("", "", $bodytext); + + $bodytext = str_replace("", "", $bodytext); + $bodytext = str_replace("", "", $bodytext); + echo $bodytext; + } else { + $bodytext = $structure->body; + $bodytext = wordwrap($bodytext, 90, "
"); + echo $bodytext; + } + } + echo '
'; + echo $util->getFooter(); } else if ($loggedIn) { header('Location: index.php'); } else {