Browse Source

just cleaning up some stuff

Luke Ehresman 25 years ago
parent
commit
b2bc6ea821
14 changed files with 91 additions and 26 deletions
  1. 2 1
      AUTHORS
  2. 9 0
      ChangeLog
  3. 1 6
      INSTALL
  4. 7 2
      README
  5. 1 1
      config/config.php
  6. 5 1
      functions/mime.php
  7. 2 0
      functions/smtp.php
  8. 6 1
      functions/strings.php
  9. BIN
      images/logo.gif
  10. BIN
      images/sm_logo.jpg
  11. 52 8
      src/compose.php
  12. 1 1
      src/compose_send.php
  13. 4 4
      src/download.php
  14. 1 1
      src/login.php

+ 2 - 1
AUTHORS

@@ -1,2 +1,3 @@
-Nathan Ehresman
 Luke Ehresman
+Nathan Ehresman
+Sergiusz Pawlowicz

+ 9 - 0
ChangeLog

@@ -1,3 +1,12 @@
+Version 0.2.1 -- January 05, 2000
+---------------------------------
+- Rewrote how MULTIPART messages were handled and made it recursive
+- We now take into account the encoding type rather than guessing
+- Redesigned how attachments are displayed
+- Fixed the bug that wouldn't let you send messages (I hope)
+- Added a "download message" option
+- Added a plain text viewer for text messages
+
 Version 0.2 -- January 02, 2000
 -------------------------------
 - Attachment support (much better MIME support in general)

+ 1 - 6
INSTALL

@@ -8,10 +8,5 @@ overview of how to install SquirrelMail.
 
 3.  Edit the config file, config/config.php
 
-4.  Change permissions of the "data/" directory so that the web server
-    can write to it.  Here is an example from Red Hat 6.0:
-       cd <SQUIRREMAIL DIRECTORY>
-       chown nobody data
-
-5.  Point your browser to the location you specified in step 2.
+4.  Point your browser to the location you specified in step 2.
     In this example, it's:  http://YOURHOST/squirrelmail-0.1/index.html

+ 7 - 2
README

@@ -15,7 +15,7 @@ FAQ ................................................................. 4.0
   Can SquirrelMail run with PHP3? ................................... 4.1
   Why PHP4 when it's only in BETA? .................................. 4.2
   Where did you get the name "SquirrelMail?" ........................ 4.3
-
+  Is SquirrelMail stable enough to actually use? .................... 4.4
 
 
 
@@ -108,4 +108,9 @@ FAQ ................................................................. 4.0
       this year. We were playing volleyball one day, and saw a squirrel
       try to jump between trees. He failed miserably and fell 40 feet to
       the ground. So, we had squirrels on our mind the next day when we
-      were coming up with a name.
+      were coming up with a name.
+      
+   Q: Is SquirrelMail stable enough to actually use?
+      SquirrelMail is stable, however, many of the features that are 
+      usually desired from an email client have not yet been implemented.
+

+ 1 - 1
config/config.php

@@ -1,6 +1,6 @@
 <?
 //  Organization's logo picture (blank if none)
-    $org_logo = "../images/logo.gif";
+    $org_logo = "../images/sm_logo.jpg";
 
 //  Organization's name
     $org_name = "SquirrelMail";

+ 5 - 1
functions/mime.php

@@ -62,7 +62,7 @@
          /** If this isn't a multipart message **/
          $j = 0;
          $entity_body = "";
-         while ((substr(trim($body[$j]), 0, strlen("--$bound")) != "--$bound") && ($j < count($body))) {
+         while ($j < count($body)) {
             $entity_body .= $body[$j];
             $j++;
          }
@@ -144,6 +144,10 @@
          }
       }
 
+      /** If there are other types that shouldn't be formatted, add them here **/
+      if ($message["ENTITIES"][$ent_num]["TYPE1"] != "html")
+         $body = translateText($body);
+
       $body .= "<BR><SMALL><CENTER><A HREF=\"../src/download.php?absolute_dl=true&passed_id=$id&passed_ent_id=$ent_num&mailbox=$urlmailbox\">Download this as a file</A></CENTER><BR></SMALL>";
 
       /** Display the ATTACHMENTS: message if there's more than one part **/

+ 2 - 0
functions/smtp.php

@@ -75,5 +75,7 @@
       fputs($smtpConnection, ".\n"); // end the DATA part
       fputs($smtpConnection, "QUIT\n"); // log off
       echo "</FONT>";
+
+      fclose($smtpConnection);
    }
 ?>

+ 6 - 1
functions/strings.php

@@ -80,6 +80,11 @@
       return $to_line;
    }
 
+   function translateText($body) {
+      $body = ereg_replace(" ", "&nbsp;", $body);
+      return $body;
+   }
+
    /* SquirrelMail version number -- DO NOT CHANGE */
-   $version = "0.2";
+   $version = "0.2.1";
 ?>

BIN
images/logo.gif


BIN
images/sm_logo.jpg


+ 52 - 8
src/compose.php

@@ -16,12 +16,34 @@
       selectMailbox($imapConnection, $mailbox, $numMessages);
       $msg = fetchMessage($imapConnection, $forward_id, $mailbox);
 
-      $body_ary = formatBody($msg);
+      if (containsType($msg, "text", "html", $ent_num)) {
+         $body = decodeBody($msg["ENTITIES"][$ent_num]["BODY"], $msg["ENTITIES"][$ent_num]["ENCODING"]);
+      } else if (containsType($msg, "text", "plain", $ent_num)) {
+         $body = decodeBody($msg["ENTITIES"][$ent_num]["BODY"], $msg["ENTITIES"][$ent_num]["ENCODING"]);
+      }
+      // add other primary displaying msg types here
+      else {
+         // find any type that's displayable
+         if (containsType($msg, "text", "any_type", $ent_num)) {
+            $body = decodeBody($msg["ENTITIES"][$ent_num]["BODY"], $msg["ENTITIES"][$ent_num]["ENCODING"]);
+         } else if (containsType($msg, "msg", "any_type", $ent_num)) {
+            $body = decodeBody($msg["ENTITIES"][$ent_num]["BODY"], $msg["ENTITIES"][$ent_num]["ENCODING"]);
+         } else {
+            $body = "No Message";
+         }
+      }
+
+      $type1 = $msg["ENTITIES"][$ent_num]["TYPE1"];
+
       $tmp = "-------- Original Message ---------\n";
+      $body_ary = explode("\n", $body);
+      $body = "";
       for ($i=0;$i < count($body_ary);$i++) {
-         $tmp .= strip_tags($body_ary[$i]);
-         $tmp = substr($tmp, 0, strlen($tmp) -1);
-         $body = "$body$tmp";
+         if ($type1 == "html")
+            $tmp .= strip_tags($body_ary[$i]);
+         else
+            $tmp .= $body_ary[$i];
+         $body = "$body$tmp\n";
          $tmp = "";
       }
    }
@@ -30,11 +52,33 @@
       selectMailbox($imapConnection, $mailbox, $numMessages);
       $msg = fetchMessage($imapConnection, $reply_id, $mailbox);
 
-      $body_ary = formatBody($msg);
+      if (containsType($msg, "text", "html", $ent_num)) {
+         $body = decodeBody($msg["ENTITIES"][$ent_num]["BODY"], $msg["ENTITIES"][$ent_num]["ENCODING"], false);
+      } else if (containsType($msg, "text", "plain", $ent_num)) {
+         $body = decodeBody($msg["ENTITIES"][$ent_num]["BODY"], $msg["ENTITIES"][$ent_num]["ENCODING"], false);
+      }
+      // add other primary displaying msg types here
+      else {
+         // find any type that's displayable
+         if (containsType($msg, "text", "any_type", $ent_num)) {
+            $body = decodeBody($msg["ENTITIES"][$ent_num]["BODY"], $msg["ENTITIES"][$ent_num]["ENCODING"], false);
+         } else if (containsType($msg, "msg", "any_type", $ent_num)) {
+            $body = decodeBody($msg["ENTITIES"][$ent_num]["BODY"], $msg["ENTITIES"][$ent_num]["ENCODING"], false);
+         } else {
+            $body = "No Message";
+         }
+      }
+
+      $type1 = $msg["ENTITIES"][$ent_num]["TYPE1"];
+
+      $body_ary = explode("\n", $body);
+      $body = "";
       for ($i=0;$i < count($body_ary);$i++) {
-         $tmp = strip_tags($body_ary[$i]);
-         $tmp = substr($tmp, 0, strlen($tmp) -1);
-         $body = "$body> $tmp";
+         if ($type1 == "html")
+            $tmp = strip_tags($body_ary[$i]);
+         else
+            $tmp = $body_ary[$i];
+         $body = "$body> $tmp\n";
       }
    }
 

+ 1 - 1
src/compose_send.php

@@ -45,7 +45,7 @@
 
    sendMessage($smtpServerAddress, $smtpPort, $username, $domain, $passed_to, $passed_cc, $passed_bcc, $passed_subject, $passed_body, $version);
 
-   if ($auto_forwarding == true)
+   if ($auto_forward == true)
       echo "<META HTTP-EQUIV=\"REFRESH\" CONTENT=\"0;URL=right_main.php\">";
    echo "<BODY TEXT=\"$color[8]\" BGCOLOR=\"$color[4]\" LINK=\"$color[7]\" VLINK=\"$color[7]\" ALINK=\"$color[7]\">\n";
 

+ 4 - 4
src/download.php

@@ -15,7 +15,7 @@
       echo "<B><CENTER>Viewing a plain text attachment</CENTER></B>";
       echo "</TD></TR><TR><TD BGCOLOR=\"$color[4]\">";
       $urlmailbox = urlencode($mailbox);
-      echo "<FONT FACE=\"Arial, Helvetica\"><A HREF=\"../src/download.php?absolute_dl=true&passed_id=$id&passed_ent_id=$entid&mailbox=$urlmailbox\">Download this as a file</A><BR><BR></FONT><TT>";
+      echo "<FONT FACE=\"Arial, Helvetica\"><CENTER><A HREF=\"../src/download.php?absolute_dl=true&passed_id=$id&passed_ent_id=$entid&mailbox=$urlmailbox\">Download this as a file</A></CENTER><BR><BR></FONT><TT>";
       echo nl2br($body);
       echo "</TT></TD></TR></TABLE>";
    }
@@ -39,13 +39,13 @@
       switch($type0) {
          case "text":
             $body = decodeBody($message["ENTITIES"][$passed_ent_id]["BODY"], $message["ENTITIES"][$passed_ent_id]["ENCODING"]);
-            header("Content-type: $type0/$type1");
+            header("Content-type: $type0/$type1; name=\"$filename\"");
             header("Content-Disposition: attachment; filename=\"$filename\"");
             echo $body;
             break;
          default:
             $body = decodeBody($message["ENTITIES"][$passed_ent_id]["BODY"], $message["ENTITIES"][$passed_ent_id]["ENCODING"]);
-            header("Content-type: $type0/$type1");
+            header("Content-type: $type0/$type1; name=\"$filename\"");
             header("Content-Disposition: attachment; filename=\"$filename\"");
             echo $body;
             break;
@@ -62,7 +62,7 @@
             break;
          default:
             $body = decodeBody($message["ENTITIES"][$passed_ent_id]["BODY"], $message["ENTITIES"][$passed_ent_id]["ENCODING"]);
-            header("Content-type: $type0/$type1");
+            header("Content-type: $type0/$type1; name=\"$filename\"");
             header("Content-Disposition: attachment; filename=\"$filename\"");
             echo $body;
             break;

+ 1 - 1
src/login.php

@@ -18,7 +18,7 @@
    echo "<BODY TEXT=\"$color[8]\" BGCOLOR=\"$color[4]\" LINK=\"$color[7]\" VLINK=\"$color[7]\" ALINK=\"$color[7]\">\n";
    echo "<FORM ACTION=webmail.php METHOD=\"POST\" NAME=f>\n";
    echo "<CENTER><IMG SRC=\"$org_logo\"</CENTER>\n";
-   echo "<CENTER><FONT FACE=\"Arial,Helvetica\" SIZE=-2>SquirrelMail version $version<BR>By Nathan and Luke Ehresman<BR></FONT><CENTER>\n";
+   echo "<CENTER><FONT FACE=\"Arial,Helvetica\" SIZE=-2>SquirrelMail version $version<BR>By the SquirrelMail Development Team<BR></FONT><CENTER>\n";
    echo "<TABLE COLS=1 WIDTH=350>\n";
    echo "   <TR>\n";
    echo "      <TD BGCOLOR=\"$color[0]\">\n";