Fix for resume on draft breaking From: being a different identity.
[squirrelmail.git] / src / compose.php
index 5e094f27ddbb715f366d44eacb5d1d443d225f7a..7f1d6809b9b2654037e7f77feb5356a3edf2bfb8 100644 (file)
@@ -98,6 +98,8 @@ if ( !sqgetGlobalVar('smaction',$action) )
   if ( sqgetGlobalVar('smaction_reply_all',$tmp) )  $action = 'reply_all';
   if ( sqgetGlobalVar('smaction_forward',$tmp) )    $action = 'forward';
   if ( sqgetGlobalVar('smaction_attache',$tmp) )    $action = 'forward_as_attachment';
+  if ( sqgetGlobalVar('smaction_draft',$tmp) )      $action = 'draft';
+  if ( sqgetGlobalVar('smaction_edit_new',$tmp) )   $action = 'edit_as_new';
 }
 
 /* Location (For HTTP 1.1 Header("Location: ...") redirects) */
@@ -661,6 +663,11 @@ function newMail ($mailbox='', $passed_id='', $passed_ent_id='', $action='', $se
 
         $identity = '';
         $from_o = $orig_header->from;
+        if (is_array($from_o)) {
+            if (isset($from_o[0])) {
+                $from_o = $from_o[0];
+            }
+        }
         if (is_object($from_o)) {
             $orig_from = $from_o->getAddress();
         } else {
@@ -682,8 +689,6 @@ function newMail ($mailbox='', $passed_id='', $passed_ent_id='', $action='', $se
             if ($identity_match) {
                 $identity = $identity_match;
             }
-        // we need identiy here fore draft case #845290
-        // echo $identity."leer";
         }
 
         switch ($action) {
@@ -987,12 +992,13 @@ function showInputForm ($session, $values=false) {
                     html_tag( 'td', '', 'right', $color[4], 'width="10%"' ) .
                     _("From:") . '</td>' . "\n" .
                     html_tag( 'td', '', 'left', $color[4], 'width="90%"' ) .
-             '         '.
-            addSelect('identitiy', $ident_list, $identity, TRUE);
+              '         '.
+              addSelect('identity', $ident_list, $identity, TRUE);
 
         echo '      </td>' . "\n" .
              '   </tr>' . "\n";
     }
+
     echo '   <tr>' . "\n" .
                 html_tag( 'td', '', 'right', $color[4], 'width="10%"' ) .
                 _("To:") . '</TD>' . "\n" .
@@ -1132,7 +1138,7 @@ function showInputForm ($session, $values=false) {
 
                 $s_a[] = '<table bgcolor="'.$color[0].
                 '" border="0"><tr><td>'.
-               addCheckBox('delete[]', $key).
+               addCheckBox('delete[]', FALSE, $key).
                    "</td><td>\n" . $attached_filename .
                     '</td><td>-</td><td> ' . $type . '</td><td>('.
                     show_readable_size( filesize( $attached_file ) ) . ')</td></tr></table>'."\n";
@@ -1490,7 +1496,7 @@ function deliverMessage($composeMessage, $draft=false) {
            unset ($imap_deliver);
            return $length;
         } else {
-           $msg  = '<br>Error: '._("Draft folder")." $draft_folder" . ' does not exist.';
+           $msg  = '<br />'.sprintf(_("Error: Draft folder %s does not exist."), $draft_folder);
            plain_error_message($msg, $color);
            return false;
         }
@@ -1501,7 +1507,7 @@ function deliverMessage($composeMessage, $draft=false) {
         $succes = $deliver->finalizeStream($stream);
     }
     if (!$succes) {
-        $msg  = $deliver->dlv_msg . '<br>' .
+        $msg  = $deliver->dlv_msg . '<br />' .
                 _("Server replied: ") . $deliver->dlv_ret_nr . ' '.
                 $deliver->dlv_server_msg;
         plain_error_message($msg, $color);