X-Git-Url: https://vcs.fsf.org/?p=squirrelmail.git;a=blobdiff_plain;f=src%2Fread_body.php;h=f0c2c6ae63abdf4cd43120d08d9115c050d9a678;hp=05462549a88987a26c702247754b207f4e615640;hb=e788294eb201e85116fb8cb9d79a09c1a856ecba;hpb=5c54e435cf4a3ee9ecdaf2305205a2fbc7af4662
diff --git a/src/read_body.php b/src/read_body.php
index 05462549..f0c2c6ae 100644
--- a/src/read_body.php
+++ b/src/read_body.php
@@ -7,14 +7,16 @@
**
** 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($config_php))
+ include("../config/config.php");
if (!isset($page_header_php))
include("../functions/page_header.php");
if (!isset($imap_php))
@@ -23,6 +25,8 @@
include("../functions/mime.php");
if (!isset($date_php))
include("../functions/date.php");
+ if (!isset($url_parser_php))
+ include("../functions/url_parser.php");
include("../src/load_prefs.php");
$imapConnection = sqimap_login($username, $key, $imapServerAddress, $imapPort, 0);
@@ -30,14 +34,14 @@
do_hook("html_top");
displayPageHeader($color, $mailbox);
- if ($view_hdr) {
+ if (isset($view_hdr)) {
fputs ($imapConnection, "a003 FETCH $passed_id BODY[HEADER]\r\n");
$read = sqimap_read_data ($imapConnection, "a003", true, $a, $b);
echo "
";
echo "
\n";
echo " " . _("Viewing full header") . " - ";
- if ($where && $what) {
+ if (isset($where) && isset($what)) {
// Got here from a search
echo "";
} else {
@@ -47,28 +51,40 @@
echo "\n";
echo "";
- echo "";
+ $cnum = 0;
for ($i=1; $i < count($read)-1; $i++) {
$line = htmlspecialchars($read[$i]);
- if (eregi("^[ |\t]", $line)) {
- $second = $line;
- $first = "";
- } else if (eregi("^([^:|^\s]+):(.+)", $line, $regs)) {
- $first = $regs[1];
- $second = $regs[2];
+ 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 = trim($line);
- $first = "";
+ $second[$i] = trim($line);
+ $first[$i] = "";
}
- echo "";
- if ($first) echo "$first:";
- else echo " ";
- echo " | $second | ";
+ }
+ 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 " ";
echo " | \n";
echo " |