Remove &amp usage from Location headers
[squirrelmail.git] / src / compose.php
index e0b50bbd3e4bcc60129a0ec16693c9734722dc15..82fa2392e550dfd8fc52f2c79f6d14a55603b0c8 100644 (file)
@@ -39,8 +39,8 @@ if (isset($draft)) {
     if (! isset($reply_id)) {
          $reply_id = 0;
     }
-       if (! isset($MDN)) {
-            $MDN = 'False';
+    if (! isset($MDN)) {
+        $MDN = 'False';
     }
     if (!saveMessageAsDraft($send_to, $send_to_cc, $send_to_bcc, $subject, $body, $reply_id, $MDN)) {
         showInputForm();
@@ -49,10 +49,10 @@ if (isset($draft)) {
         $draft_message = _("Draft Email Saved");
         /* If this is a resumed draft, then delete the original */
         if(isset($delete_draft)) {
-            Header("Location: delete_message.php?mailbox=$draft_folder".
+            Header("Location: delete_message.php?mailbox=" . urlencode($draft_folder) .
                    "&message=$delete_draft&sort=$sort&startMessage=1&saved_draft=yes");
             exit();
-        } 
+        }
         else {
             if ($compose_new_win == '1') {
                 Header("Location: compose.php?saved_draft=yes");
@@ -80,13 +80,13 @@ if (isset($send)) {
         }
         /*
          * Set $default_charset to correspond with the user's selection
-         * of language interface. 
+         * of language interface.
          */
         set_my_charset();
 
         /*
          * This is to change all newlines to \n
-         * We'll change them to \r\n later (in the sendMessage function) 
+         * We'll change them to \r\n later (in the sendMessage function)
          */
         $body = str_replace("\r\n", "\n", $body);
         $body = str_replace("\r", "\n", $body);
@@ -95,7 +95,7 @@ if (isset($send)) {
          * Rewrap $body so that no line is bigger than $editor_size
          * This should only really kick in the sqWordWrap function
          * if the browser doesn't support "HARD" as the wrap type
-         * Or, in Opera's case, something goes wrong. 
+         * Or, in Opera's case, something goes wrong.
          */
         $body = explode("\n", $body);
         $newBody = '';
@@ -112,8 +112,8 @@ if (isset($send)) {
         }
         $body = $newBody;
 
-        do_hook("compose_send");
-  
+        do_hook('compose_send');
+
         $MDN = False;  // we are not sending a mdn response
         if (! isset($mailprio)) {
             $Result = sendMessage($send_to, $send_to_cc, $send_to_bcc,
@@ -127,7 +127,7 @@ if (isset($send)) {
             exit();
         }
         if ( isset($delete_draft)) {
-            Header("Location: delete_message.php?mailbox=$draft_folder".
+            Header("Location: delete_message.php?mailbox=" . urlencode( $draft_folder ).
                    "&message=$delete_draft&sort=$sort&startMessage=1&mail_sent=yes");
             exit();
         }
@@ -158,8 +158,7 @@ if (isset($send)) {
         showInputForm();
         /* sqimap_logout($imapConnection); */
     }
-}
-elseif (isset($html_addr_search_done)) {
+} elseif (isset($html_addr_search_done)) {
         if ($compose_new_win == '1') {
             compose_Header($color, $mailbox);
         }
@@ -190,8 +189,7 @@ elseif (isset($html_addr_search_done)) {
         }
     }
     showInputForm();
-}
-elseif (isset($html_addr_search)) {
+} elseif (isset($html_addr_search)) {
     if (isset($HTTP_POST_FILES['attachfile']) &&
         $HTTP_POST_FILES['attachfile']['tmp_name'] &&
         $HTTP_POST_FILES['attachfile']['tmp_name'] != 'none') {
@@ -204,8 +202,7 @@ elseif (isset($html_addr_search)) {
      * click.  If you can think of a better way, please implement it.
      */
     include_once('./addrbook_search_html.php');
-}
-elseif (isset($attach)) {
+} elseif (isset($attach)) {
     if (saveAttachedFiles()) {
         plain_error_message(_("Could not move/copy file. File not attached"), $color);
     }
@@ -217,7 +214,24 @@ elseif (isset($attach)) {
         }
     showInputForm();
 }
-elseif (isset($do_delete)) {
+elseif (isset($sigappend)) {
+    $idents = getPref($data_dir, $username, 'identities', 0);
+    if ($idents > 1) {
+       if ($identity == 'default') {
+          $no = 'g';
+       } else {
+          $no = $identity;
+       }
+       $signature = getSig($data_dir, $username, $no);
+    }
+    $body .= "\n\n".($prefix_sig==true? "-- \n":'').$signature;
+    if ($compose_new_win == '1') {
+         compose_Header($color, $mailbox);
+    } else {
+        displayPageHeader($color, $mailbox);
+    }
+    showInputForm();
+} elseif (isset($do_delete)) {
         if ($compose_new_win == '1') {
             compose_Header($color, $mailbox);
         }
@@ -482,7 +496,7 @@ function showInputForm () {
     echo "\n" . '<FORM name=compose action="compose.php" METHOD=POST ' .
          'ENCTYPE="multipart/form-data"';
     do_hook("compose_form");
-  
+
     
     echo ">\n";
 
@@ -678,6 +692,7 @@ function showComposeButtonRow() {
     }
 
     echo "   <TR><td>\n   </td><td>\n";
+    echo "\n    <INPUT TYPE=SUBMIT NAME=\"sigappend\" VALUE=\"". _("Signature") . "\">\n";
     if ($use_javascript_addr_book) {
         echo "      <SCRIPT LANGUAGE=JavaScript><!--\n document.write(\"".
              "         <input type=button value=\\\""._("Addresses").