X-Git-Url: https://vcs.fsf.org/?p=squirrelmail.git;a=blobdiff_plain;f=src%2Fread_body.php;h=503eca2b4c0d2eb1d06378cc404651c67ce98aeb;hp=59e6f0d32a288c2561c95135e86e562d0d1e7c02;hb=f226cba750d5d3330126b17f9b8dc928a97e76fa;hpb=99fa2b21527197e185f1fbb3b51aca57ddd079eb
diff --git a/src/read_body.php b/src/read_body.php
index 59e6f0d3..503eca2b 100644
--- a/src/read_body.php
+++ b/src/read_body.php
@@ -7,57 +7,73 @@
**
** This file is used for reading the msgs array and displaying
** the resulting emails in the right frame.
+ **
+ ** $Id$
**/
- session_start();
-
- if (!isset($config_php))
- include("../config/config.php");
- if (!isset($strings_php))
- include("../functions/strings.php");
- if (!isset($page_header_php))
- include("../functions/page_header.php");
- if (!isset($imap_php))
- include("../functions/imap.php");
- if (!isset($mime_php))
- include("../functions/mime.php");
- if (!isset($date_php))
- include("../functions/date.php");
-
- include("../src/load_prefs.php");
+ require_once('../src/validate.php');
+ require_once('../functions/imap.php');
+ require_once('../functions/mime.php');
+ require_once('../functions/date.php');
+ require_once('../functions/url_parser.php');
+
$imapConnection = sqimap_login($username, $key, $imapServerAddress, $imapPort, 0);
sqimap_mailbox_select($imapConnection, $mailbox);
+ do_hook('html_top');
displayPageHeader($color, $mailbox);
- if ($view_hdr) {
- fputs ($imapConnection, "a003 FETCH $passed_id BODY[HEADER]\r\n");
- $read = sqimap_read_data ($imapConnection, "a003", true, $a, $b);
+ if (isset($view_hdr)) {
+ fputs ($imapConnection, sqimap_session_id() . " FETCH $passed_id BODY[HEADER]\r\n");
+ $read = sqimap_read_data ($imapConnection, sqimap_session_id(), true, $a, $b);
- echo "
";
- echo "
\n";
- echo " " . _("Viewing full header") . " - ";
- if ($where && $what) {
+ echo ' ' .
+ '\n";
- echo "\n";
- echo "";
- for ($i=1; $i < count($read)-1; $i++) {
- $read[$i] = htmlspecialchars($read[$i]);
- if (substr($read[$i], 0, 1) != "\t" &&
- substr($read[$i], 0, 1) != " " &&
- substr($read[$i], 0, 1) != "&" &&
- trim($read[$i])) {
- $pre = substr($read[$i], 0, strpos($read[$i], ":"));
- $read[$i] = str_replace("$pre", "$pre", decodeHeader($read[$i]));
+ echo ''._("View message") . " | \n" .
+ "\n" .
+ '';
+
+ $cnum = 0;
+ for ($i=1; $i < count($read); $i++) {
+ $line = htmlspecialchars($read[$i]);
+ if (eregi("^>", $line)) {
+ $second[$i] = $line;
+ $first[$i] = ' ';
+ $cnum++;
+ } else if (eregi("^[ |\t]", $line)) {
+ $second[$i] = $line;
+ $first[$i] = '';
+ } else if (eregi("^([^:]+):(.+)", $line, $regs)) {
+ $first[$i] = $regs[1] . ':';
+ $second[$i] = $regs[2];
+ $cnum++;
+ } else {
+ $second[$i] = trim($line);
+ $first[$i] = '';
}
- echo "$read[$i]";
+ }
+ for ($i=0; $i < count($second); $i = $j) {
+ if (isset($first[$i]))
+ $f = $first[$i];
+ if (isset($second[$i]))
+ $s = nl2br($second[$i]);
+ $j = $i + 1;
+ while ($first[$j] == '' && $j < count($first)) {
+ $s .= ' ' . nl2br($second[$j]);
+ $j++;
+ }
+ parseEmail($s);
+ if (isset($f)) echo "$f$s";
}
- echo " | \n";
- echo " |