Added some preference options, and debugged many bugs
authorlkehresman <lkehresman@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Fri, 7 Jan 2000 15:54:53 +0000 (15:54 +0000)
committerlkehresman <lkehresman@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Fri, 7 Jan 2000 15:54:53 +0000 (15:54 +0000)
git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@121 7612ce4b-ef26-0410-bec9-ea0150e637f0

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

index e89546791fdf2552c239e82cf82cfde712b7eb24..90b02c3b4d6b770f06794e2c244617814d0b6875 100644 (file)
@@ -37,7 +37,9 @@
 //  To add a new theme to the options that users can choose from, just add
 //  a new number to the array at the bottom, and follow the pattern.
 
-    $theme[0]["PATH"] = "../config/default_theme.php"; // This is your default theme.  Can be theme.
+    // The first one HAS to be here, and is your system's default theme.
+    // It can be any theme you want
+    $theme[0]["PATH"] = "../config/default_theme.php";
     $theme[0]["NAME"] = "Default";
 
     $theme[1]["PATH"] = "../config/sandstorm_theme.php";
@@ -69,9 +71,9 @@
  *           will get expunged, removing all messages marked "Deleted".
  */
 
-    $move_to_trash = true;
+    $default_move_to_trash = true;
     $trash_folder = "INBOX.Trash";
-    $auto_expunge = true;
+    $default_auto_expunge = true;
 
 //  Special Folders are folders that can't be manipulated like normal user created
 //  folders can.  A couple of examples would be "INBOX.Trash", "INBOX.Drafts".  We have
index 4cfec18484f13443d32e1ed059121f6c9b32b97f..1f9a5024dfcc3eb58a0fae92ed8694f404b103ac 100644 (file)
       $read = $entity;
    }
 
-   function parseHTMLMessage($line) {
-      /** Add any parsing you want to in here **/
-      return $line;
-   }
-
-   function parsePlainTextMessage($line) {
-      /** Add any parsing you want to in here */
-
-      $line = "^^$line";
-
-      if ((strpos(strtolower($line), "<!") == false) &&
-          (strpos(strtolower($line), "<html>") == false) &&
-          (strpos(strtolower($line), "</html>") == false)) {
-         $line = str_replace("<", "&lt;", $line);
-         $line = str_replace(">", "&gt;", $line);
-      }
-
-      $wrap_at = 86; // Make this configurable int the config file some time
-      if (strlen($line) - 2 >= $wrap_at) // -2 because of the ^^ at the beginning
-         $line = wordWrap($line, $wrap_at);
-
-      $line = str_replace(" ", "&nbsp;", $line);
-      $line = str_replace("\t", "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;", $line);
-      $line = str_replace("\n", "", $line);
-
-      if (strpos(trim(str_replace("&nbsp;", "", $line)), "&gt;&gt;") == 2) {
-         $line = substr($line, 2, strlen($line));
-         $line = "<TT><FONT COLOR=FF0000>$line</FONT></TT><BR>\n";
-      } else if (strpos(trim(str_replace("&nbsp;", "", $line)), "&gt;") == 2) {
-         $line = substr($line, 2, strlen($line));
-         $line = "<TT><FONT COLOR=800000>$line</FONT></TT><BR>\n";
-      } else {
-         $line = substr($line, 2, strlen($line));
-         $line = "<TT><FONT COLOR=000000>$line</FONT></TT><BR>\n";
-      }
-
-      if (strpos(strtolower($line), "http://") != false) {
-         $line = ereg_replace("<BR>", "", $line);
-         $start = strpos(strtolower($line), "http://");
-         $link = substr($line, $start, strlen($line));
-
-         if (strpos($link, " ")) {
-            $end = strpos($link, " ")-1;
-         }
-         else if (strpos($link, "&nbsp;")) {
-            $end = strpos($link, "&nbsp;")-1;
-         }
-         else if (strpos($link, "<")) {
-            $end = strpos($link, "<");
-         }
-         else if (strpos($link, ">")) {
-            $end = strpos($link, ">");
-         }
-         else if (strpos($link, "(")) {
-            $end = strpos($link, "(")-1;
-         }
-         else if (strpos($link, ")")) {
-            $end = strpos($link, ")")-1;
-         }
-         else if (strpos($link, "{")) {
-            $end = strpos($link, "{")-1;
-         }
-         else if (strpos($link, "}")) {
-            $end = strpos($link, "}")-1;
-         }
-         else
-            $end = strlen($link);
-
-         $link = substr($line, $start, $end);
-         $end = $end + $start;
-         $before = substr($line, 0, $start);
-         $after  = substr($line, $end, strlen($line));
-
-         $line = "$before<A HREF=\"$link\" TARGET=_top>$link</A>$after<BR>";
-      }
-
-      return $line;
-   }
 ?>
index 6bd52f036129422d86b51c937c5365afe9a0e800..f61322bf1f30b9d2e6f91323bdf3334e11748e6b 100644 (file)
        as the actual message in the HTML.   It contains everything needed, including
        HTML Tags, Attachments at the bottom, etc.
     **/
-   function formatBody($message, $color) {
+   function formatBody($message, $color, $wrap_at) {
 
       /** this if statement checks for the entity to show as the primary message.  To
           add more of them, just put them in the order that is their priority.
        **/
       $id = $message["INFO"]["ID"];
       $urlmailbox = urlencode($message["INFO"]["MAILBOX"]);
-      $body = "";
 
       if (containsType($message, "text", "html", $ent_num)) {
-         $body .= decodeBody($message["ENTITIES"][$ent_num]["BODY"], $message["ENTITIES"][$ent_num]["ENCODING"]);
+         $body = decodeBody($message["ENTITIES"][$ent_num]["BODY"], $message["ENTITIES"][$ent_num]["ENCODING"]);
       } else if (containsType($message, "text", "plain", $ent_num)) {
-         $tmpbody = decodeBody($message["ENTITIES"][$ent_num]["BODY"], $message["ENTITIES"][$ent_num]["ENCODING"]);
-         $body .= "<TT>" . nl2br(trim($tmpbody)) . "</TT>";
+         $body = decodeBody($message["ENTITIES"][$ent_num]["BODY"], $message["ENTITIES"][$ent_num]["ENCODING"]);
       }
       // add other primary displaying message types here
       else {
          // find any type that's displayable
          if (containsType($message, "text", "any_type", $ent_num)) {
-            $tmpbody = decodeBody($message["ENTITIES"][$ent_num]["BODY"], $message["ENTITIES"][$ent_num]["ENCODING"]);
-            $body .= "<TT>" . nl2br(trim($tmpbody)) . "</TT>";
+            $body = decodeBody($message["ENTITIES"][$ent_num]["BODY"], $message["ENTITIES"][$ent_num]["ENCODING"]);
          } else if (containsType($message, "message", "any_type", $ent_num)) {
-            $tmpbody = decodeBody($message["ENTITIES"][$ent_num]["BODY"], $message["ENTITIES"][$ent_num]["ENCODING"]);
-            $body .= "<TT>" . nl2br(trim($tmpbody)) . "</TT>";
+            $body = decodeBody($message["ENTITIES"][$ent_num]["BODY"], $message["ENTITIES"][$ent_num]["ENCODING"]);
          }
       }
 
       /** If there are other types that shouldn't be formatted, add them here **/
       if ($message["ENTITIES"][$ent_num]["TYPE1"] != "html")
-         $body = translateText($body);
+         $body = translateText($body, $wrap_at);
+
 
       $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>";
 
index 0bfaf93506fe66af7a0fc54382749b8c6b297904..4c28318ed890968598073ef9491ed158da16a783 100644 (file)
       if ($reply_to != "")
          fputs($smtpConnection, "Reply-To: $reply_to\n");
 
+
+      $body_ary = explode("\n", trim($body));
+      $body = "";
+      for ($i = 0; $i < count($body_ary); $i++) {
+         if ($body_ary[$i] == ".")
+            $body_ary[$i] = ".";
+         $body .= $body_ary[$i] . "\n";
+      }
       fputs($smtpConnection, "$body\n"); // send the body of the message
 
       fputs($smtpConnection, ".\n"); // end the DATA part
index 38c8e7b0c4959d8e5a9f49a06682096b840d3a77..5c633d444bec5cac7b5a8d1979034d9a94d7f7a3 100644 (file)
 
    // Wraps text at $wrap characters
    function wordWrap($passed, $wrap) {
+      $passed = str_replace("&gt;", ">", $passed);
+      $passed = str_replace("&lt;", "<", $passed);
+
       $words = explode(" ", trim($passed));
       $i = 0;
       $line_len = strlen($words[$i])+1;
       $line = "";
       while ($i < count($words)) {
          while ($line_len < $wrap) {
-            $line = "$line$words[$i]&nbsp;";
+            $line = "$line$words[$i] ";
             $i++;
             $line_len = $line_len + strlen($words[$i])+1;
          }
          $line_len = strlen($words[$i])+1;
          if ($line_len < $wrap) {
             if ($i < count($words)) // don't <BR> the last line
-               $line = "$line<BR>";
+               $line = "$line\n";
          } else {
             $endline = $words[$i];
             while ($line_len >= $wrap) {
@@ -54,6 +57,9 @@
             $i++;
          }
       }
+
+      $line = str_replace(">", "&gt;", $line);
+      $line = str_replace("<", "&lt;", $line);
       return $line;
    }
 
       return $to_line;
    }
 
-   function translateText($body) {
-      $body = ereg_replace(" ", "&nbsp;", $body);
-      return $body;
+   function translateText($body, $wrap_at) {
+      /** Add any parsing you want to in here */
+      $body = trim($body);
+      $body_ary = explode("\n", $body);
+
+      for ($i = 0; $i < count($body_ary); $i++) {
+         $line = $body_ary[$i];
+         $line = "^^$line";
+
+         $line = str_replace(">", "&gt;", $line);
+         $line = str_replace("<", "&lt;", $line);
+
+         if (strlen($line) >= $wrap_at) // -2 because of the ^^ at the beginning
+            $line = wordWrap($line, $wrap_at);
+
+         $line = str_replace(" ", "&nbsp;", $line);
+         $line = str_replace("\t", "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;", $line);
+         $line = nl2br($line);
+
+         if (strpos(trim(str_replace("&nbsp;", "", $line)), "&gt;&gt;") == 2) {
+            $line = substr($line, 2, strlen($line));
+            $line = "<TT><FONT COLOR=FF0000>$line</FONT></TT><BR>\n";
+         } else if (strpos(trim(str_replace("&nbsp;", "", $line)), "&gt;") == 2) {
+            $line = substr($line, 2, strlen($line));
+            $line = "<TT><FONT COLOR=800000>$line</FONT></TT><BR>\n";
+         } else {
+            $line = substr($line, 2, strlen($line));
+            $line = "<TT><FONT COLOR=000000>$line</FONT></TT><BR>\n";
+         }
+
+         $new_body[$i] = "$line";
+      }
+      $bdy = implode("\n", $new_body);
+      return $bdy;
    }
 
    /* SquirrelMail version number -- DO NOT CHANGE */