From 8405ee3548225c00d3cdb2ba7e298f4585680316 Mon Sep 17 00:00:00 2001 From: lkehresman Date: Mon, 20 Dec 1999 19:34:26 +0000 Subject: [PATCH] Bug fixes git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@89 7612ce4b-ef26-0410-bec9-ea0150e637f0 --- config/config.php | 17 +++++++++++++++++ functions/mailbox.php | 33 ++++++++++++++++++++++----------- functions/mime.php | 29 +++++++++++++++++++++++++---- functions/smtp.php | 3 ++- 4 files changed, 66 insertions(+), 16 deletions(-) diff --git a/config/config.php b/config/config.php index 753fb61d..5c0a933e 100644 --- a/config/config.php +++ b/config/config.php @@ -27,6 +27,8 @@ $motd = " Welcome to OM's webmail system, SquirrelMail. We are currently in beta, and have not yet released a full version of SquirrelMail. Please feel free to look around, and please report any bugs to Nathan or Luke."; // Customizable colors +/* + // Standard Colors $color[0] = "DCDCDC"; // Light Gray $color[1] = "800000"; // Red $color[2] = "CC0000"; // Light Red @@ -39,6 +41,21 @@ $color[9] = "ABABAB"; // Darker light gray $color[10] = "666666"; // Darker light gray $color[11] = "770000"; // Special folder color +*/ + // TAN THEME + $color[0] = "C7B289"; // Light Gray + $color[1] = "800000"; // Red + $color[2] = "CC0000"; // Light Red + $color[3] = "B79878"; // Left Background + $color[4] = "FBE1BC"; // Background + $color[5] = "FFFFCC"; // Light Yellow + $color[6] = "000000"; // Left Text + $color[7] = "AF5523"; // Link + $color[8] = "000000"; // Text + $color[9] = "ABABAB"; // Darker light gray + $color[10] = "666666"; // Darker light gray + $color[11] = "770000"; // Special folder color + // Whether or not to use $color[11] for special folders. If not, special // folders will be the same color as the other folders diff --git a/functions/mailbox.php b/functions/mailbox.php index 9febb941..5e632131 100644 --- a/functions/mailbox.php +++ b/functions/mailbox.php @@ -60,7 +60,7 @@ } else { $rel_end = $end; } - fputs($imapConnection, "messageFetch FETCH $rel_start:$rel_end RFC822.HEADER.LINES (From Subject Date To Cc)\n"); + fputs($imapConnection, "messageFetch FETCH $rel_start:$rel_end RFC822.HEADER.LINES (From Subject Date)\n"); $read = fgets($imapConnection, 1024); while ((substr($read, 0, 15) != "messageFetch OK") && (substr($read, 0, 16) != "messageFetch BAD")) { @@ -272,8 +272,13 @@ $cont = strtolower(trim(substr($read, 13))); if (strpos($cont, ";")) $cont = substr($cont, 0, strpos($cont, ";")); - $header["TYPE0"] = substr($cont, 0, strpos($cont, "/")); - $header["TYPE1"] = substr($cont, strpos($cont, "/")+1); + + if (strpos($cont, "/")) { + $header["TYPE0"] = substr($cont, 0, strpos($cont, "/")); + $header["TYPE1"] = substr($cont, strpos($cont, "/")+1); + } else { + $header["TYPE0"] = $cont; + } $line = $read; $read = fgets($imapConnection, 1024); @@ -315,20 +320,20 @@ } /** REPLY-TO **/ - else if (substr($read, 0, 9) == "Reply-To:") { + else if (strtolower(substr($read, 0, 9)) == "reply-to:") { $header["REPLYTO"] = trim(substr($read, 9, strlen($read))); $read = fgets($imapConnection, 1024); } /** FROM **/ - else if (substr($read, 0, 5) == "From:") { + else if (strtolower(substr($read, 0, 5)) == "from:") { $header["FROM"] = trim(substr($read, 5, strlen($read) - 6)); if ($header["REPLYTO"] == "") $header["REPLYTO"] = $header["FROM"]; $read = fgets($imapConnection, 1024); } /** DATE **/ - else if (substr($read, 0, 5) == "Date:") { + else if (strtolower(substr($read, 0, 5)) == "date:") { $d = substr($read, 5, strlen($read) - 6); $d = trim($d); $d = ereg_replace(" ", " ", $d); @@ -337,14 +342,14 @@ $read = fgets($imapConnection, 1024); } /** SUBJECT **/ - else if (substr($read, 0, 8) == "Subject:") { + else if (strtolower(substr($read, 0, 8)) == "subject:") { $header["SUBJECT"] = trim(substr($read, 8, strlen($read) - 9)); if (strlen(Chop($header["SUBJECT"])) == 0) $header["SUBJECT"] = "(no subject)"; $read = fgets($imapConnection, 1024); } /** CC **/ - else if (substr($read, 0, 3) == "CC:") { + else if (strtolower(substr($read, 0, 3)) == "cc:") { $pos = 0; $header["CC"][$pos] = trim(substr($read, 4)); $read = fgets($imapConnection, 1024); @@ -355,7 +360,7 @@ } } /** TO **/ - else if (substr($read, 0, 3) == "To:") { + else if (strtolower(substr($read, 0, 3)) == "to:") { $pos = 0; $header["TO"][$pos] = trim(substr($read, 4)); $read = fgets($imapConnection, 1024); @@ -429,8 +434,13 @@ $cont = strtolower(trim(substr($read[$i], 13))); if (strpos($cont, ";")) $cont = substr($cont, 0, strpos($cont, ";")); - $type0 = substr($cont, 0, strpos($cont, "/")); - $type1 = substr($cont, strpos($cont, "/")+1); + + if (strpos($cont, "/")) { + $type0 = substr($cont, 0, strpos($cont, "/")); + $type1 = substr($cont, strpos($cont, "/")+1); + } else { + $type0 = $cont; + } $line = $read[$i]; while ( (substr(substr($read[$i], 0, strpos($read[$i], " ")), -1) != ":") && (trim($read[$i]) != "") && (trim($read[$i]) != ")")) { @@ -498,6 +508,7 @@ $line = str_replace(" ", " ", $line); $line = str_replace("\t", "        ", $line); + $line = str_replace("\n", "", $line); /** if >> or > are found at the beginning of a line, I'll assume that was replied text, so make it different colors **/ diff --git a/functions/mime.php b/functions/mime.php index dc9a6854..4347fd50 100644 --- a/functions/mime.php +++ b/functions/mime.php @@ -6,7 +6,7 @@ function decodeMime($body, $bound, $type0, $type1) { - echo "$type0/$type1
"; +// echo "$type0/$type1
"; if ($type0 == "multipart") { if ($body[0] == "") $i = 1; @@ -42,13 +42,17 @@ /** This gets one entity's properties **/ function getEntity($body, $bound, $type0, $type1, $encoding, $charset) { - echo "$type0/$type1
"; +// echo "--$type0/$type1--
"; $msg[0]["TYPE0"] = $type0; $msg[0]["TYPE1"] = $type1; $msg[0]["ENCODING"] = $encoding; $msg[0]["CHARSET"] = $charset; if ($type0 == "text") { + // error correcting if they didn't follow RFC standards + if (trim($type1) == "") + $type1 = "plain"; + if ($type1 == "plain") { $msg[0]["PRIORITY"] = 10; for ($p = 0;$p < count($body);$p++) { @@ -65,8 +69,6 @@ $msg[0]["BODY"][$p] = $body[$q]; } } - } else if ($type0 == "image") { - $msg[0]["BODY"][0] = "This is an image. Squirrelmail currently cannot decode images."; } else { $msg[0]["BODY"][0] = "This attachment is of an unknown format: $type0/$type1"; } @@ -111,6 +113,25 @@ break; } } + + for ($i = 0; $i < count($message["ENTITIES"]); $i++) { + $pos = count($body); + if ($message["ENTITIES"][$i]["TYPE0"] != "text") { + $body[$pos] = "
ATTACHMENTS:
"; + } + } + + for ($i = 0; $i < count($message["ENTITIES"]); $i++) { + $pos = count($body); + if ($message["ENTITIES"][$i]["TYPE0"] != "text") { + if ($message["ENTITIES"][$i]["TYPE0"] == "image") { + $body[$pos] = "   Image: " . strtoupper($message["ENTITIES"][$i]["TYPE1"]) . "
"; + } else { + $body[$pos] = "   Unknown Type: " . $message["ENTITIES"][$i]["TYPE0"] . "/" . $message["ENTITIES"][$i]["TYPE1"] . "
"; + } + } + } + return $body; } diff --git a/functions/smtp.php b/functions/smtp.php index c733470d..6241c02f 100644 --- a/functions/smtp.php +++ b/functions/smtp.php @@ -53,6 +53,7 @@ /** Lets start sending the actual message */ fputs($smtpConnection, "DATA\n"); fputs($smtpConnection, "Subject: $subject\n"); // Subject + fputs($smtpConnection, "From: <$from>\n"); // Subject fputs($smtpConnection, "To: <$to_list>\n"); // Who it's TO if ($cc_list) { fputs($smtpConnection, "Cc: <$cc_list>\n"); // Who the CCs are @@ -60,7 +61,7 @@ fputs($smtpConnection, "X-Mailer: SquirrelMail (version $version)\n"); // Identify SquirrelMail fputs($smtpConnection, "Reply-To: $from\n"); fputs($smtpConnection, "MIME-Version: 1.0\n"); - fputs($smtpConnection, "Content-Type: text/plain; charset=us-ascii\n"); + fputs($smtpConnection, "Content-Type: text\n"); fputs($smtpConnection, "$body\n"); // send the body of the message fputs($smtpConnection, ".\n"); // end the DATA part -- 2.25.1