fixed some bugs in email address finding
authorlkehresman <lkehresman@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Wed, 8 Dec 1999 21:09:18 +0000 (21:09 +0000)
committerlkehresman <lkehresman@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Wed, 8 Dec 1999 21:09:18 +0000 (21:09 +0000)
git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@72 7612ce4b-ef26-0410-bec9-ea0150e637f0

functions/mailbox.php
src/compose.php

index eb7607a..f96eb52 100644 (file)
 
    function decodeEmailAddr($sender) {
       $emailAddr = getEmailAddr($sender);
-      $emailStart = strpos($emailAddr, "EMAILSTART--");
-      $emailEnd = strpos($emailAddr, "--EMAILEND") - 10;
+      if (strpos($emailAddr, "EMAILSTART--")) {
 
-      $emailAddr = ereg_replace("EMAILSTART--", "", $emailAddr);
-      $emailAddr = ereg_replace("--EMAILEND", "", $emailAddr);
+         $emailAddr = ereg_replace("EMAILSTART--", "", $emailAddr);
+         $emailAddr = ereg_replace("--EMAILEND", "", $emailAddr);
+      } else {
+         $emailAddr = $emailAddr;
+      }
       return $emailAddr;
    }
 
    function getEmailAddr($sender) {
       if (strpos($sender, "EMAILSTART--") == false)
-         return "";
+         return "$sender";
 
-      $start = strpos($sender, "EMAILSTART--");
-      $emailAddr = substr($sender, $start, strlen($sender));
+      $emailStart = strpos($sender, "EMAILSTART--") + 12;
+      $emailAddr = substr($sender, $emailStart, strlen($sender));
+      $emailAddr = substr($emailAddr, 0, strpos($emailAddr, "--EMAILEND"));
 
       return $emailAddr;
    }
 
    function getSender($sender) {
       if (strpos($sender, "EMAILSTART--") == false)
-         return "";
+         return "$sender";
 
       $first = substr($sender, 0, strpos($sender, "EMAILSTART--"));
       $second = substr($sender, strpos($sender, "--EMAILEND") +10, strlen($sender));
-      return "$first$second";
+      return "$first $second";
    }
 
    function getSenderName($sender) {
index db405d0..1be7a42 100644 (file)
    echo "      <TD WIDTH=15% BGCOLOR=FFFFFF ALIGN=RIGHT>\n";
    echo "         <FONT FACE=\"Arial,Helvetica\">Subject:</FONT>\n";
    echo "      </TD><TD WIDTH=85% BGCOLOR=FFFFFF ALIGN=LEFT>\n";
-   if ($reply_subj)
+   if ($reply_subj) {
+      $reply_subj = str_replace("\"", "'", $reply_subj);
+      $reply_subj = stripslashes($reply_subj);
       echo "         <INPUT TYPE=TEXT NAME=passed_subject SIZE=60 VALUE=\"Re: $reply_subj\"><BR>";
-   else if ($forward_subj)
+   } else if ($forward_subj) {
+      $forward_subj = stripquotes($forward_subj);
       echo "         <INPUT TYPE=TEXT NAME=passed_subject SIZE=60 VALUE=\"[Fwd: $forward_subj]\"><BR>";
-   else
+   } else {
       echo "         <INPUT TYPE=TEXT NAME=passed_subject SIZE=60>";
+   }
    echo "&nbsp;&nbsp;<INPUT TYPE=SUBMIT VALUE=\"Send\"><BR>";
    echo "      </TD>\n";
    echo "   </TR>\n";