Got reply and forward working
authorlkehresman <lkehresman@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Mon, 6 Dec 1999 20:47:08 +0000 (20:47 +0000)
committerlkehresman <lkehresman@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Mon, 6 Dec 1999 20:47:08 +0000 (20:47 +0000)
git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@64 7612ce4b-ef26-0410-bec9-ea0150e637f0

functions/mailbox.php
src/compose.php
src/read_body.php

index f3ea7db..9092744 100644 (file)
       }
    }
 
+   function decodeEmailAddr($sender) {
+      $emailAddr = getEmailAddr($sender);
+      $emailStart = strpos($emailAddr, "EMAILSTART--");
+      $emailEnd = strpos($emailAddr, "--EMAILEND") - 10;
+
+      $emailAddr = ereg_replace("EMAILSTART--", "", $emailAddr);
+      $emailAddr = ereg_replace("--EMAILEND", "", $emailAddr);
+      return $emailAddr;
+   }
+
    function getEmailAddr($sender) {
       if (strpos($sender, "EMAILSTART--") == false)
          return "";
index d88e087..f2383bf 100644 (file)
@@ -9,6 +9,23 @@
    echo "<HTML><BODY TEXT=\"#000000\" BGCOLOR=\"#FFFFFF\" LINK=\"#0000EE\" VLINK=\"#0000EE\" ALINK=\"#0000EE\">\n";
    $imapConnection = loginToImapServer($username, $key, $imapServerAddress);
    displayPageHeader($mailbox);
+   selectMailbox($imapConnection, $mailbox, $numMessages);
+
+   if ($reply_id) {
+      $body_ary = fetchBody($imapConnection, $reply_id);
+      for ($i=0;$i < count($body_ary);$i++) {
+         $tmp = strip_tags($body_ary[$i]);
+         $tmp = substr($tmp, 0, strlen($tmp) -1);
+         $body = "$body> $tmp";
+      }
+   } else if ($forward_id) {
+      $body_ary = fetchBody($imapConnection, $forward_id);
+      for ($i=0;$i < count($body_ary);$i++) {
+         $tmp = strip_tags($body_ary[$i]);
+         $tmp = substr($tmp, 0, strlen($tmp) -1);
+         $body = "$body> $tmp";
+      }
+   }
 
    echo "<FORM action=\"compose_send.php\" METHOD=POST>\n";
    echo "<CENTER>";
    echo "      <TD WIDTH=15% BGCOLOR=FFFFFF ALIGN=RIGHT>\n";
    echo "         <FONT FACE=\"Arial,Helvetica\">To: </FONT>\n";
    echo "      </TD><TD WIDTH=85% BGCOLOR=FFFFFF ALIGN=LEFT>\n";
-   echo "         <INPUT TYPE=TEXT NAME=passed_to SIZE=60><BR>";
+   if ($send_to)
+      echo "         <INPUT TYPE=TEXT NAME=passed_to VALUE=\"$send_to\" SIZE=60><BR>";
+   else
+      echo "         <INPUT TYPE=TEXT NAME=passed_to SIZE=60><BR>";
    echo "      </TD>\n";
    echo "   </TR>\n";
    echo "   <TR>\n";
    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";
-   echo "         <INPUT TYPE=TEXT NAME=passed_subject SIZE=60><BR>";
+   if ($reply_subj)
+      echo "         <INPUT TYPE=TEXT NAME=passed_subject SIZE=60 VALUE=\"Re: $reply_subj\"><BR>";
+   else if ($forward_subj)
+      echo "         <INPUT TYPE=TEXT NAME=passed_subject SIZE=60 VALUE=\"Fwd: $forward_subj\"><BR>";
+   else
+      echo "         <INPUT TYPE=TEXT NAME=passed_subject SIZE=60><BR>";
    echo "      </TD>\n";
    echo "   </TR>\n";
    echo "</TABLE>\n";
 
-   echo "<TEXTAREA NAME=passed_body ROWS=20 COLS=72 WRAP=HARD></TEXTAREA><BR>";
+   echo "<TEXTAREA NAME=passed_body ROWS=20 COLS=76 WRAP=HARD>$body</TEXTAREA><BR>";
    echo "<INPUT TYPE=SUBMIT VALUE=\"Send\">";
    echo "</CENTER>";
    echo "</FORM>";
index 84f7855..053bcb3 100644 (file)
    displayPageHeader($mailbox);
    $body = fetchBody($imapConnection, $passed_id);
    getMessageHeaders($imapConnection, $passed_id, $passed_id, $f, $s, $d);
-//   setMessageFlag($imapConnection, $passed_id, $passed_id, "Seen");
 
    $subject = $s[0];
+   $url_subj = urlencode(trim($subject));
+
    $d[0] = ereg_replace("  ", " ", $d[0]);
-//   $date = explode(" ", trim($d[0]));
-//   $date = getDateString($date);
    $date = $d[0];
    $from_name = getSenderName($f[0]);
    $urlMailbox = urlencode($mailbox);
 
+   $url_from = trim(decodeEmailAddr($f[0]));
+   $url_from = urlencode($url_from);
+
    echo "<BR>";
    echo "<TABLE COLS=1 WIDTH=95% BORDER=0 ALIGN=CENTER CELLPADDING=2>\n";
    echo "   <TR><TD BGCOLOR=DCDCDC WIDTH=100%>";
-   echo "      <FONT FACE=\"Arial,Helvetica\" SIZE=2>";
-   echo "      <A HREF=\"right_main.php?sort=$sort&startMessage=$startMessage&mailbox=$urlMailbox\">Message List</A>&nbsp;&nbsp;";
-   echo "      <A HREF=\"delete_message.php?mailbox=$urlMailbox&message=$passed_id&sort=$sort&startMessage=1\">Delete</A>&nbsp;&nbsp;";
-   echo "      </FONT>";
+   echo "      <TABLE WIDTH=100% BORDER=0 COLS=2>";
+   echo "         <TR>";
+   echo "            <TD ALIGN=LEFT WIDTH=50%>";
+   echo "               <FONT FACE=\"Arial,Helvetica\" SIZE=2>";
+   echo "               <A HREF=\"right_main.php?sort=$sort&startMessage=$startMessage&mailbox=$urlMailbox\">Message List</A>&nbsp;&nbsp;";
+   echo "               <A HREF=\"delete_message.php?mailbox=$urlMailbox&message=$passed_id&sort=$sort&startMessage=1\">Delete</A>&nbsp;&nbsp;";
+   echo "               </FONT>";
+   echo "            </TD><TD WIDTH=50% ALIGN=RIGHT>";
+   echo "               <FONT FACE=\"Arial,Helvetica\" SIZE=2>";
+   echo "               <A HREF=\"compose.php?forward_id=$passed_id&forward_subj=$url_subj&mailbox=$urlMailbox\">Forward</A>&nbsp;&nbsp;";
+   echo "               <A HREF=\"compose.php?send_to=$url_from&reply_subj=$url_subj&reply_id=$passed_id&mailbox=$urlMailbox\">Reply</A>&nbsp;&nbsp;";
+   echo "               </FONT>";
+   echo "            </TD>";
+   echo "         </TR>";
+   echo "      </TABLE>";
    echo "   </TD></TR>";
    echo "   <TR><TD BGCOLOR=FFFFFF WIDTH=100%>";
    echo "   <TABLE COLS=2 WIDTH=100% BORDER=0 CELLSPACING=0 CELLPADDING=2>\n";