- added more hooks
[squirrelmail.git] / src / compose.php
index e0a7ca74c0041f3a295689ce90cfd09658a7aa23..afc4652203ee303c62c704a62d67dff46738d005 100644 (file)
@@ -33,6 +33,8 @@
       include("../functions/display_messages.php");
    if (!isset($auth_php))
       include ("../functions/auth.php");
+   if (!isset($plugin_php))
+      include ("../functions/plugin.php");
 
    include("../src/load_prefs.php");
 
@@ -41,8 +43,8 @@
       global $forward_id, $imapConnection, $msg, $ent_num, $body_ary, $body,
          $reply_id, $send_to, $send_to_cc, $mailbox, $send_to_bcc;
 
-      $send_to = decodeHeader($send_to);
-      $send_to_cc = decodeHeader($send_to_cc);
+      $send_to = stripslashes(decodeHeader($send_to));
+      $send_to_cc = stripslashes(decodeHeader($send_to_cc));
 
       if ($forward_id)
          $id = $forward_id;
@@ -73,7 +75,7 @@
          $body = "";
          for ($i=0; $i < count($body_ary); $i++) {
             if ($i==0 && $forward_id) {
-               $tmp = _("-------- Original Message ---------\n");
+               $tmp = "-------- " . _("Original Message") . " --------\n";
                $tmp .= _("Subject") . ": " . $orig_header->subject . "\n"; 
                $tmp .= "   " . _("From") . ": " . $orig_header->from . "\n"; 
                $tmp .= "     " . _("To") . ": " . $orig_header->to[0] . "\n"; 
          return $body;   
       }
 
+      $send_to = stripslashes($send_to);
+      
       if (!$send_to) {
          $send_to = sqimap_find_email($send_to);
       }
 
-//      $send_to = ereg_replace("\"", "", $send_to);
-      $send_to = stripslashes($send_to);
-      
       /** This formats a CC string if they hit "reply all" **/
       if ($send_to_cc != "") {
+         $send_to_cc = ereg_replace( '"[^"]*"', "", $send_to_cc);
          $send_to_cc = ereg_replace(";", ",", $send_to_cc);
          $sendcc = explode(",", $send_to_cc);
          $send_to_cc = "";
       }
 
       echo "\n<FORM name=compose action=\"compose.php\" METHOD=POST ENCTYPE=\"multipart/form-data\">\n";
+      //echo "\n<FORM name=compose action=\"compose.php\" METHOD=POST>\n";
       if ($reply_id) {
          echo "<input type=hidden name=reply_id value=$reply_id>\n";
       }                 
          echo "      <input type=submit name=\"html_addr_search\" value=\""._("Addresses")."\">";
       }   
       echo "\n    <INPUT TYPE=SUBMIT NAME=send VALUE=\"". _("Send") . "\">\n";
+      
+      do_hook("compose_button_row");
+
       echo "   </TD>\n";
       echo "   </TR>\n\n";
 
       //      echo "      <INPUT TYPE=\"hidden\" name=\"MAX_FILE_SIZE\"\n";
       //      echo "      value=\"10000\">\n";
       echo "      <INPUT NAME=\"attachfile\" TYPE=\"file\">\n";
-      echo "      &nbsp;&nbsp;<input type=\"submit\" name=\"attach\"\n";
-      echo "      value=\"" . _("Add") ."\">\n";
+      echo "      &nbsp;&nbsp;<input type=\"submit\" name=\"attach\"";
+      echo " value=\"" . _("Add") ."\">\n";
       echo "     </td>\n";
       echo "   </tr>\n";
       if (isset($attachments) && count($attachments)>0) {
 
       echo "</TABLE>\n";
       echo "</FORM>";
+      do_hook("compose_bottom");
    }
 
    function showSentForm () {
           error message, show=true **/
       global $body, $send_to, $subject, $color;
 
-      if ($body == "" && $subject == "") {
-         if ($show)
-            plain_error_message(_("You have not entered a message body or a subject."), $color);
-         return false;
-      } else if ($send_to == "") {
+      if ($send_to == "") {
          if ($show)
             plain_error_message(_("You have not filled in the \"To:\" field."), $color);
          return false;