Basic mailto: support.
[squirrelmail.git] / src / compose.php
index 8387d69d79e7aa624fbd65fbdb8c34851c647e91..9b1b242022858871f2486012cd27014e1617590d 100644 (file)
@@ -195,7 +195,7 @@ function getforwardHeader($orig_header) {
    $subject = decodeHeader($orig_header->subject,false,false);
    $subject = str_replace(' ',' ',$subject);
    $bodyTop =  str_pad(' '._("Original Message").' ',$editor_size -2,'-',STR_PAD_BOTH) .
-               "\n\n". $display[_("Subject")] . $subject . "\n" .
+               "\n". $display[_("Subject")] . $subject . "\n" .
                $display[_("From")] . $from . "\n" .
                $display[_("Date")] . getLongDateString( $orig_header->date ). "\n" .
                $display[_("To")] . $to . "\n";
@@ -553,6 +553,7 @@ function newMail ($mailbox='', $passed_id='', $passed_ent_id='', $action='', $se
            $use_signature, $composesession, $data_dir, $username,
            $username, $key, $imapServerAddress, $imapPort, $compose_messages,
            $composeMessage;
+       global $languages, $squirrelmail_language;
 
     $send_to = $send_to_cc = $send_to_bcc = $subject = $identity = '';
     $mailprio = 3;
@@ -603,6 +604,12 @@ function newMail ($mailbox='', $passed_id='', $passed_ent_id='', $action='', $se
                 $bodypart = str_replace(array('&nbsp;','&gt','&lt'),array(' ','<','>'),$bodypart);
                 $bodypart = strip_tags($bodypart);
             }
+            if (isset($languages[$squirrelmail_language]['XTRA_CODE']) &&
+                function_exists($languages[$squirrelmail_language]['XTRA_CODE'])) {
+                if (mb_detect_encoding($bodypart) != 'ASCII') {
+                    $bodypart = $languages[$squirrelmail_language]['XTRA_CODE']('decode', $bodypart);
+                }
+            }
             $body .= $bodypart;
         }
         if ($default_use_priority) {
@@ -818,7 +825,7 @@ function getMessage_RFC822_Attachment($message, $composeMessage, $passed_id,
                                      TRUE, $response, $readmessage, $uid_support);
         $message = $message->parent;
     }
-    if ($response = 'OK') {
+    if ($response == 'OK') {
         $subject = encodeHeader($message->rfc822_header->subject);
         array_shift($body_a);
         $body = implode('', $body_a) . "\r\n";
@@ -1312,7 +1319,7 @@ function deliverMessage($composeMessage, $draft=false) {
     global $send_to, $send_to_cc, $send_to_bcc, $mailprio, $subject, $body,
            $username, $popuser, $usernamedata, $identity, $data_dir,
            $request_mdn, $request_dr, $default_charset, $color, $useSendmail,
-           $domain, $action;
+           $domain, $action, $default_move_to_sent, $move_to_sent;
     global $imapServerAddress, $imapPort, $sent_folder, $key;
 
     $rfc822_header = $composeMessage->rfc822_header;
@@ -1462,9 +1469,10 @@ function deliverMessage($composeMessage, $draft=false) {
         plain_error_message($msg, $color);
     } else {
         unset ($deliver);
-        $imap_stream = sqimap_login($username, $key, $imapServerAddress,
-        $imapPort, 0);
-        if (sqimap_mailbox_exists ($imap_stream, $sent_folder)) {
+        $move_to_sent = getPref($data_dir,$username,'move_to_sent');
+        $imap_stream = sqimap_login($username, $key, $imapServerAddress, $imapPort, 0);
+        if (sqimap_mailbox_exists ($imap_stream, $sent_folder) && ((isset($move_to_sent) && $move_to_sent) ||
+           (isset($default_move_to_sent) && $default_move_to_sent))) {
                 sqimap_append ($imap_stream, $sent_folder, $length);
             require_once(SM_PATH . 'class/deliver/Deliver_IMAP.class.php');
             $imap_deliver = new Deliver_IMAP();