Fix the save message button, using new functionality marc introduced yesterday.
[squirrelmail.git] / src / compose.php
index d97a1048359eaa43da05484a38229c6be8fbccf3..fd7e07cc1ea25c3290a70cd5dd10ef8f010891ff 100644 (file)
@@ -219,7 +219,6 @@ if (sqsession_is_registered('session_expired_post')) {
     if (!isset($mailbox)) {
         $mailbox = '';
     }
-
     if ($compose_new_win == '1') {
         compose_Header($color, $mailbox);
     } else {
@@ -298,6 +297,10 @@ if ($send) {
         $AttachFailure = saveAttachedFiles($session);
     }
     if (checkInput(false) && !isset($AttachFailure)) {
+               if ($mailbox == "All Folders") {
+                       /* We entered compose via the search results page */
+                       $mailbox="INBOX"; /* Send 'em to INBOX, that's safe enough */
+               }
         $urlMailbox = urlencode (trim($mailbox));
         if (! isset($passed_id)) {
             $passed_id = 0;
@@ -1173,17 +1176,10 @@ function saveAttachedFiles($session) {
         $full_localfilename = "$hashed_attachment_dir/$localfilename";
     }
 
-    if (!@rename($_FILES['attachfile']['tmp_name'], $full_localfilename)) {
-       if (function_exists("move_uploaded_file")) {
-            if (!@move_uploaded_file($_FILES['attachfile']['tmp_name'],$full_localfilename)) {
-               return true;
-           }
-       } else {
-           if (!@copy($_FILES['attachfile']['tmp_name'], $full_localfilename)) {
-                return true;
-            }
-       }
+    if (!@move_uploaded_file($_FILES['attachfile']['tmp_name'],$full_localfilename)) {
+        return true;
     }
+
     $message = $compose_messages[$session];
     $type = strtolower($_FILES['attachfile']['type']);
     $name = $_FILES['attachfile']['name'];
@@ -1391,7 +1387,9 @@ function deliverMessage($composeMessage, $draft=false) {
        $succes = $deliver->finalizeStream($stream);
     }
     if (!$succes) {
-        $msg  = $deliver->dlv_msg . '<br>Server replied: '.$deliver->dlv_ret_nr;
+        $msg  = $deliver->dlv_msg . '<br>' .
+                _("Server replied: ") . $deliver->dlv_ret_nr . ' '.
+                $deliver->dlv_server_msg;
         plain_error_message($msg, $color);
     } else {
         unset ($deliver);