Bug fixes
authorlkehresman <lkehresman@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Mon, 20 Dec 1999 19:34:26 +0000 (19:34 +0000)
committerlkehresman <lkehresman@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Mon, 20 Dec 1999 19:34:26 +0000 (19:34 +0000)
git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@89 7612ce4b-ef26-0410-bec9-ea0150e637f0

config/config.php
functions/mailbox.php
functions/mime.php
functions/smtp.php

index 753fb61d20a3337d7900fa144b1cb879d4f5cc38..5c0a933e063a1d29e9920179deafbc31e0b47c67 100644 (file)
@@ -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 <A HREF=\"mailto:nathan@usa.om.org\">Nathan</A> or <A HREF=\"mailto:luke@usa.om.org\">Luke</A>.";
 
 //  Customizable colors
+/*
+    // Standard Colors
     $color[0]   = "DCDCDC"; // Light Gray
     $color[1]   = "800000"; // Red
     $color[2]   = "CC0000"; // Light Red
     $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
index 9febb9417f4efcfc45f49ed69a07be03ba73a4ac..5e632131a2f88b8a708e2903ebbd5b8f5bdd49fa 100644 (file)
@@ -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")) {
             $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);
          }
 
          /** 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);
             $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);
             }
          }
          /** 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);
             $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]) != ")")) {
 
       $line = str_replace(" ", "&nbsp;", $line);
       $line = str_replace("\t", "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;", $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 **/
index dc9a6854058d3daadc2b76bbf7205f957bf18ead..4347fd50880dd942c796d8d3d684313703649e3f 100644 (file)
@@ -6,7 +6,7 @@
 
 
    function decodeMime($body, $bound, $type0, $type1) {
-      echo "$type0/$type1<BR>";
+//      echo "$type0/$type1<BR>";
       if ($type0 == "multipart") {
          if ($body[0] == "")
             $i = 1;
 
    /** This gets one entity's properties **/
    function getEntity($body, $bound, $type0, $type1, $encoding, $charset) {
-      echo "$type0/$type1<BR>";
+//      echo "--$type0/$type1--<BR>";
       $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] = "<B><FONT COLOR=DD0000>This is an image.  Squirrelmail currently cannot decode images.</FONT></B>";
       } else {
          $msg[0]["BODY"][0] = "<B><FONT COLOR=DD0000>This attachment is of an unknown format:  $type0/$type1</FONT></B>";
       }
                      break;
          }
       }
+
+      for ($i = 0; $i < count($message["ENTITIES"]); $i++) {
+         $pos = count($body);
+         if ($message["ENTITIES"][$i]["TYPE0"] != "text") {
+            $body[$pos] = "<BR><TT><U><B>ATTACHMENTS:</B></U></TT><BR>";
+         }
+      }
+
+      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] = "<TT>&nbsp;&nbsp;&nbsp;Image: " . strtoupper($message["ENTITIES"][$i]["TYPE1"]) . "</TT><BR>";
+            } else {
+               $body[$pos] = "<TT>&nbsp;&nbsp;&nbsp;Unknown Type: " . $message["ENTITIES"][$i]["TYPE0"] . "/" . $message["ENTITIES"][$i]["TYPE1"] . "</TT><BR>";
+            }
+         }
+      }
+
       return $body;
    }
 
index c733470ddf4e4600970a549206199ec675b343cb..6241c02f0cf5a08abdc75a26e8edf87c31a47b97 100644 (file)
@@ -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