added compose_form plugin hook
[squirrelmail.git] / src / compose.php
index a8d4045e322ebec342f6a6d798f010843be8f2a6..4655e3818059d05e84b83b087d3106b9ce4ed7cb 100644 (file)
@@ -49,7 +49,7 @@
 
       if ($forward_id)
          $id = $forward_id;
-      else if ($reply_id)
+      elseif ($reply_id)
          $id = $reply_id;
 
 
          
          $body = ereg_replace('\\\\', '\\\\', $body);
 
-         sqimap_mailbox_close($imapConnection);
          return;
       }
 
         // Write Attachment to file
         $fp = fopen ($attachment_dir.$localfilename, "w");
       fputs ($fp, decodeBody(mime_fetch_body($imapConnection, $forward_id, $message->header->entity_id), $message->header->encoding));
-        fgets($imapConnection, 256);
-        fgets($imapConnection, 256);
-      fclose ($fp);
+      
+//      Don't know why these lines were included
+//        fgets($imapConnection, 256);
+//        fgets($imapConnection, 256);
 
+      fclose ($fp);
+      
       $attachments[$localfilename] = $filename;
       
       }
          echo "// --></SCRIPT>\n\n";
       }
 
-      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";
+      echo "\n<FORM name=compose action=\"compose.php\" METHOD=POST ENCTYPE=\"multipart/form-data\"";
+      do_hook("compose_form");
+         echo ">\n";
       if ($reply_id) {
          echo "<input type=hidden name=reply_id value=$reply_id>\n";
       }                 
    } else if (isset($attach)) {
       if (saveAttachedFiles())
             plain_error_message(_("Could not move/copy file. File not attached"), $color);
+      displayPageHeader($color, $mailbox);
       showInputForm();
    } else if (isset($do_delete)) {
       is_logged_in();
       }
 
       showInputForm();
+       } else if ($smtpErrors) {
+      $imapConnection = sqimap_login($username, $key, $imapServerAddress, $imapPort, 0);
+      displayPageHeader($color, $mailbox);
+
+      $newmail = true;
+      if ($forward_id && $ent_num)  getAttachments(0);
+              
+      newMail();
+      showInputForm();
+      sqimap_logout($imapConnection);
    } else {
       $imapConnection = sqimap_login($username, $key, $imapServerAddress, $imapPort, 0);
       displayPageHeader($color, $mailbox);
 
       $newmail = true;
+               
       if ($forward_id && $ent_num)  getAttachments(0);
               
       newMail();