Added a counter pref and a fix for the imapid
[squirrelmail.git] / src / compose.php
index 8c5fc0ac4459316adac529b5353cd5dc8bee979f..5dc425d63be4903da135422e1ddcaf82efa1cfed 100644 (file)
@@ -1,19 +1,20 @@
 <?php
+
    /**
-    * compose.php
-    *
-    * Copyright (c) 1999-2000 The SquirrelMail development team
-    * Licensed under the GNU GPL. For full terms see the file COPYING.
-    *
-    * This code sends a mail.
-    *
-    * There are 4 modes of operation:
-    *    - Start new mail
-    *    - Add an attachment
-    *    - Send mail
-    *    - Save As Draft
-    *  
-    * $Id$
+    * compose.php
+    **
+    **  Copyright (c) 1999-2001 The SquirrelMail development team
+    * Licensed under the GNU GPL. For full terms see the file COPYING.
+    **
+    * This code sends a mail.
+    **
+    * There are 4 modes of operation:
+    *    - Start new mail
+    *    - Add an attachment
+    *    - Send mail
+    *    - Save As Draft
+    **
+    * $Id$
     **/
 
    require_once('../src/validate.php');
          $editor_size, $attachments, $subject, $newmail,
          $use_javascript_addr_book, $send_to_bcc, $reply_id, $mailbox,
          $from_htmladdr_search, $location_of_buttons, $attachment_dir,
-         $username, $data_dir, $identity, $draft_id, $delete_draft;
+         $username, $data_dir, $identity, $draft_id, $delete_draft,
+        $mailprio;
 
       $subject = decodeHeader($subject);
       $reply_subj = decodeHeader($reply_subj);
 
       // This code is for attachments
       echo "   <tr>\n";
-      echo "     <TD BGCOLOR=\"$color[0]\" VALIGN=TOP ALIGN=RIGHT>\n";
-      echo "      <SMALL><BR></SMALL>"._("Attach:");
+      echo "     <TD BGCOLOR=\"$color[0]\" VALIGN=MIDDLE ALIGN=RIGHT>\n";
+      echo        _("Attach:");
       echo "      </td><td ALIGN=left BGCOLOR=\"$color[0]\">\n";
       echo "      <INPUT NAME=\"attachfile\" SIZE=48 TYPE=\"file\">\n";
       echo "      &nbsp;&nbsp;<input type=\"submit\" name=\"attach\"";
    }
 
    function showComposeButtonRow() {
-      global $use_javascript_addr_book, $save_as_draft;
+      global $use_javascript_addr_book, $save_as_draft, 
+             $default_use_priority, $mailprio;
 
       echo "   <TR><td>\n   </td><td>\n";
       if ($use_javascript_addr_book) {
       echo "\n    <INPUT TYPE=SUBMIT NAME=send VALUE=\"". _("Send") . "\">\n";
 
       if ($save_as_draft) {
-          echo "<input type=\"submit\" name =\"draft\" value=\"Save Draft\">\n";
+          echo '<input type="submit" name ="draft" value="' . _("Save Draft") . "\">\n";
+      }
+      if ($default_use_priority) {
+        if(!isset($mailprio)) {
+         $mailprio = "3";
+       }
+       echo "\n\t". _("Priority") .":<select name=\"mailprio\">".
+         "\n\t\t<option value=1".($mailprio=="1"?" selected":"").">". _("High") ."</option>".
+         "\n\t\t<option value=3".($mailprio=="3"?" selected":"").">". _("Normal") ."</option>".
+         "\n\t\t<option value=5".($mailprio=="5"?" selected":"").">". _("Low")."</option>".
+         "\n\t</select>";
       }
 
       do_hook("compose_button_row");
    // True if FAILURE
    function saveAttachedFiles() {
       global $HTTP_POST_FILES, $attachment_dir, $attachments;
-
+      
       $localfilename = GenerateRandomString(32, '', 7);
       while (file_exists($attachment_dir . $localfilename))
           $localfilename = GenerateRandomString(32, '', 7);
       $attachments[] = $newAttachment;
     }
 
-   if (!isset($mailbox) || $mailbox == "" || ($mailbox == "None"))
+   if (!isset($mailbox) || $mailbox == '' || ($mailbox == 'None'))
       $mailbox = "INBOX";
 
    if (isset($draft)) {
 
          do_hook("compose_send");
 
-         if (! sendMessage($send_to, $send_to_cc, $send_to_bcc, $subject, $body, $reply_id)) {
+         if (! isset($mailprio))
+           $Result = sendMessage($send_to, $send_to_cc, $send_to_bcc, 
+                                 $subject, $body, $reply_id);
+        else
+           $Result = sendMessage($send_to, $send_to_cc, $send_to_bcc,
+                                 $subject, $body, $reply_id, $mailprio);
+         if (! $Result) {
             showInputForm();
             exit();
          }