Przeglądaj źródła

updated some documentation, fixed minor bugs in MIME decoding, made
reply and forward work for composing messages.

Luke Ehresman 25 lat temu
rodzic
commit
8a2a0747fb
4 zmienionych plików z 46 dodań i 77 usunięć
  1. 7 4
      INSTALL
  2. 26 62
      src/compose.php
  3. 9 8
      src/msg_highlight.php
  4. 4 3
      src/read_body.php

+ 7 - 4
INSTALL

@@ -84,7 +84,7 @@ d. Running into trouble
 
 
   SquirrelMail is still under development. Therefore you should always
   SquirrelMail is still under development. Therefore you should always
   get the newest version around. Look at
   get the newest version around. Look at
-  http://squirrelmail.sourceforge.net/index.php3?page=5 to see what it
+  http://www.squirrelmail.org/index.php3?page=5 to see what it
   is. If you want to be bleeding edge you might want to consider using
   is. If you want to be bleeding edge you might want to consider using
   the latest CVS version (with the latest and most fashionable of
   the latest CVS version (with the latest and most fashionable of
   bugs).
   bugs).
@@ -145,9 +145,12 @@ c. Setting up SquirrelMail
 4. RUNNING SQUIRRELMAIL
 4. RUNNING SQUIRRELMAIL
 -----------------------
 -----------------------
 
 
-  Point your browser at the URL at which SquirrelMail is installed. It
-  should be pretty stright forward to use. Some more documentation
-  might show up onbe day or another.
+  Point your browser at the URL at which SquirrelMail is installed.  A
+  possible example of this is: 
+     http://www.yourdomain.com/squirrelmail
+     
+  It should be pretty stright forward to use. Some more documentation
+  might show up one day or another.
 
 
 
 
 5. RUSSIAN CHARSETS
 5. RUSSIAN CHARSETS

+ 26 - 62
src/compose.php

@@ -36,76 +36,40 @@
       $send_to = decodeHeader($send_to);
       $send_to = decodeHeader($send_to);
       $send_to_cc = decodeHeader($send_to_cc);
       $send_to_cc = decodeHeader($send_to_cc);
 
 
-      if ($forward_id) {
-         sqimap_mailbox_select($imapConnection, $mailbox);
-         $msg = sqimap_get_message($imapConnection, $forward_id, $mailbox);
-         
-         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++) {
-            if ($type1 == "html")
-               $tmp .= strip_tags($body_ary[$i]);
-            else
-               $tmp .= $body_ary[$i];
-            $body = "$body$tmp\n";
-            $tmp = "";
-         }
-      }
-      
-      if ($reply_id) {
+      if ($forward_id)
+         $id = $forward_id;
+      else if ($reply_id)
+         $id = $reply_id;
+
+      if ($id) {
          sqimap_mailbox_select($imapConnection, $mailbox);
          sqimap_mailbox_select($imapConnection, $mailbox);
-         $msg = sqimap_get_message($imapConnection, $reply_id, $mailbox);
-         
-         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");
-            }
+         $message = sqimap_get_message($imapConnection, $id, $mailbox);
+         $message = getEntity($message, $ent_num);
+
+         if ($message->header->type0 == "text" || $message->header->type1 == "message") {
+            $body = decodeBody(mime_fetch_body($imapConnection, $id, $message->header->entity_id), $message->header->encoding);
+         } else {
+            $body = "";
          }
          }
          
          
-         $type1 = $msg["ENTITIES"][$ent_num]["TYPE1"];
-         
+         if ($forward_id)
+            $tmp = _("-------- Original Message ---------\n");
+         if ($message->header->type1 == "html")
+            $body = strip_tags($body);
+            
          $body_ary = explode("\n", $body);
          $body_ary = explode("\n", $body);
          $body = "";
          $body = "";
-         for ($i=0;$i < count($body_ary);$i++) {
-            if ($type1 == "html")
-               $tmp = strip_tags($body_ary[$i]);
+         for ($i=0; $i < count($body_ary); $i++) {
+            $tmp = $body_ary[$i];
+            
+            if ($forward_id)
+               $body = "$body$tmp\n";
             else
             else
-               $tmp = $body_ary[$i];
-            $body = "$body> $tmp\n";
+               $body = "$body> $tmp\n";
          }
          }
+            
       }
       }
-      
+
       if (!$send_to) {
       if (!$send_to) {
          $send_to = sqimap_find_email($send_to);
          $send_to = sqimap_find_email($send_to);
       }
       }

+ 9 - 8
src/msg_highlight.php

@@ -88,19 +88,19 @@
       echo "<input type=\"hidden\" value=\"$id\" name=\"id\">\n";
       echo "<input type=\"hidden\" value=\"$id\" name=\"id\">\n";
       echo "<table width=80% align=center cellpadding=2 cellspacing=0 border=0>\n";
       echo "<table width=80% align=center cellpadding=2 cellspacing=0 border=0>\n";
       echo "   <tr>\n";
       echo "   <tr>\n";
-      echo "      <td align=right width=40%>\n";
+      echo "      <td align=right width=25%>\n";
       echo _("Identifying name") . ":";
       echo _("Identifying name") . ":";
       echo "      </td>\n";
       echo "      </td>\n";
-      echo "      <td width=60%>\n";
+      echo "      <td width=75%>\n";
       echo "         <input type=\"text\" value=\"".$message_highlight_list[$id]["name"]."\" name=\"name\">";
       echo "         <input type=\"text\" value=\"".$message_highlight_list[$id]["name"]."\" name=\"name\">";
       echo "      </td>\n";
       echo "      </td>\n";
       echo "   </tr>\n";
       echo "   </tr>\n";
       echo "   <tr><td><br><br></td></tr>\n";
       echo "   <tr><td><br><br></td></tr>\n";
       echo "   <tr>\n";
       echo "   <tr>\n";
-      echo "      <td align=right width=40%>\n";
+      echo "      <td align=right width=25%>\n";
       echo _("Color") . ":";
       echo _("Color") . ":";
       echo "      </td>\n";
       echo "      </td>\n";
-      echo "      <td width=60%>\n";
+      echo "      <td width=75%>\n";
       echo "         <input type=\"radio\" name=color_type value=1$selected_choose> &nbsp;<select name=newcolor_choose>\n";
       echo "         <input type=\"radio\" name=color_type value=1$selected_choose> &nbsp;<select name=newcolor_choose>\n";
       echo "            <option value=\"$color_list[0]\"$selected0>" . _("Dark Blue") . "\n";
       echo "            <option value=\"$color_list[0]\"$selected0>" . _("Dark Blue") . "\n";
       echo "            <option value=\"$color_list[1]\"$selected1>" . _("Dark Green") . "\n";
       echo "            <option value=\"$color_list[1]\"$selected1>" . _("Dark Green") . "\n";
@@ -124,10 +124,10 @@
       echo "   </tr>\n";
       echo "   </tr>\n";
       echo "   <tr><td><br><br></td></tr>\n";
       echo "   <tr><td><br><br></td></tr>\n";
       echo "   <tr>\n";
       echo "   <tr>\n";
-      echo "      <td align=right width=40%>\n";
+      echo "      <td align=right width=25%>\n";
       echo _("Match") . ":";
       echo _("Match") . ":";
       echo "      </td>\n";
       echo "      </td>\n";
-      echo "      <td width=60%>\n";
+      echo "      <td width=75%>\n";
       echo "         <select name=match_type>\n";
       echo "         <select name=match_type>\n";
       if ($message_highlight_list[$id]["match_type"] == "from")    echo "            <option value=\"from\" selected>From\n"; 
       if ($message_highlight_list[$id]["match_type"] == "from")    echo "            <option value=\"from\" selected>From\n"; 
       else                                                         echo "            <option value=\"from\">From\n"; 
       else                                                         echo "            <option value=\"from\">From\n"; 
@@ -136,8 +136,9 @@
       if ($message_highlight_list[$id]["match_type"] == "subject") echo "            <option value=\"subject\" selected>Subject\n"; 
       if ($message_highlight_list[$id]["match_type"] == "subject") echo "            <option value=\"subject\" selected>Subject\n"; 
       else                                                         echo "            <option value=\"subject\">Subject\n"; 
       else                                                         echo "            <option value=\"subject\">Subject\n"; 
       echo "         </select>\n";
       echo "         </select>\n";
-      echo "         <input type=\"text\" value=\"".$message_highlight_list[$id]["value"]."\" name=\"value\">";
-      echo "      </td>\n";
+      echo "         <nobr><input type=\"text\" value=\"".$message_highlight_list[$id]["value"]."\" name=\"value\"> &nbsp;(";
+      echo _("Regular Expression");
+      echo ")\n      <nobr></td>\n";
       echo "   </tr>\n";
       echo "   </tr>\n";
       echo "</table>\n";
       echo "</table>\n";
       echo "<center><input type=\"submit\" value=\"" . _("Submit") . "\"></center>\n";
       echo "<center><input type=\"submit\" value=\"" . _("Submit") . "\"></center>\n";

+ 4 - 3
src/read_body.php

@@ -83,6 +83,7 @@
    $url_replytoallcc = urlencode(getLineOfAddrs($message->header->to) . ", " . getLineOfAddrs($message->header->cc));
    $url_replytoallcc = urlencode(getLineOfAddrs($message->header->to) . ", " . getLineOfAddrs($message->header->cc));
 
 
    $dateString = getLongDateString($message->header->date);
    $dateString = getLongDateString($message->header->date);
+   $ent_num = findDisplayEntity($message);
 
 
    /** TEXT STRINGS DEFINITIONS **/
    /** TEXT STRINGS DEFINITIONS **/
    $echo_more = _("more");
    $echo_more = _("more");
@@ -174,13 +175,13 @@
    echo "               </SMALL>\n";
    echo "               </SMALL>\n";
    echo "            </TD><TD WIDTH=33% ALIGN=RIGHT>";
    echo "            </TD><TD WIDTH=33% ALIGN=RIGHT>";
    echo "               <SMALL>";
    echo "               <SMALL>";
-   echo "               <A HREF=\"compose.php?forward_id=$passed_id&forward_subj=$url_subj&mailbox=$urlMailbox\">";
+   echo "               <A HREF=\"compose.php?forward_id=$passed_id&forward_subj=$url_subj&mailbox=$urlMailbox&ent_num=$ent_num\">";
    echo _("Forward");
    echo _("Forward");
    echo "</A>&nbsp;|&nbsp;";
    echo "</A>&nbsp;|&nbsp;";
-   echo "               <A HREF=\"compose.php?send_to=$url_replyto&reply_subj=$url_subj&reply_id=$passed_id&mailbox=$urlMailbox\">";
+   echo "               <A HREF=\"compose.php?send_to=$url_replyto&reply_subj=$url_subj&reply_id=$passed_id&mailbox=$urlMailbox&ent_num=$ent_num\">";
    echo _("Reply");
    echo _("Reply");
    echo "</A>&nbsp;|&nbsp;";
    echo "</A>&nbsp;|&nbsp;";
-   echo "               <A HREF=\"compose.php?send_to=$url_replytoall&send_to_cc=$url_replytoallcc&reply_subj=$url_subj&reply_id=$passed_id&mailbox=$urlMailbox\">";
+   echo "               <A HREF=\"compose.php?send_to=$url_replytoall&send_to_cc=$url_replytoallcc&reply_subj=$url_subj&reply_id=$passed_id&mailbox=$urlMailbox&ent_num=$ent_num\">";
    echo _("Reply All");
    echo _("Reply All");
    echo "</A>&nbsp;&nbsp;";
    echo "</A>&nbsp;&nbsp;";
    echo "               </SMALL>";
    echo "               </SMALL>";