Aleksander Machniak
2015-01-03 10f133bae8499d493a3cc17e10adc7399e6e3b39
program/steps/mail/sendmail.inc
@@ -77,7 +77,7 @@
$mailcc  = rcmail_email_input_format(rcube_utils::get_input_value('_cc', rcube_utils::INPUT_POST, TRUE, $message_charset), true);
$mailbcc = rcmail_email_input_format(rcube_utils::get_input_value('_bcc', rcube_utils::INPUT_POST, TRUE, $message_charset), true);
if ($EMAIL_FORMAT_ERROR) {
if ($EMAIL_FORMAT_ERROR && !$savedraft) {
    $OUTPUT->show_message('emailformaterror', 'error', array('email' => $EMAIL_FORMAT_ERROR));
    $OUTPUT->send('iframe');
}
@@ -273,9 +273,10 @@
    }
    // append doctype and html/body wrappers
    $message_body = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN">'
        . "\r\n<html><body" . (!empty($bstyle) ? " style='" . implode($bstyle, '; ') . "'" : '') . ">\r\n"
        . $message_body;
    $bstyle       = !empty($bstyle) ? (" style='" . implode($bstyle, '; ') . "'") : '';
    $message_body = '<html><head>'
        . '<meta http-equiv="Content-Type" content="text/html; charset=' . $message_charset . '" /></head>'
        . "<body" . $bstyle . ">\r\n" . $message_body;
}
if (!$savedraft) {
@@ -310,10 +311,16 @@
        $COMPOSE['spell_checked'] = true;
        if (!$spell_result) {
            $result = $isHtml ? $spellchecker->get_words() : $spellchecker->get_xml();
            if ($isHtml) {
                $result['words']      = $spellchecker->get();
                $result['dictionary'] = (bool) $RCMAIL->config->get('spellcheck_dictionary');
            }
            else {
                $result = $spellchecker->get_xml();
            }
            $OUTPUT->show_message('mispellingsfound', 'error');
            $OUTPUT->command('spellcheck_resume', $isHtml, $result);
            $OUTPUT->command('spellcheck_resume', $result);
            $OUTPUT->send('iframe');
        }
    }
@@ -421,8 +428,7 @@
        $attachment = $RCMAIL->plugins->exec_hook('attachment_get', $attachment);
        if ($isHtml) {
            $dispurl      = '/\ssrc\s*=\s*[\'"]*\S+display-attachment\S+file=rcmfile'
                . preg_quote($attachment['id']) . '[\s\'"]*/';
            $dispurl      = '/[\'"]\S+display-attachment\S+file=rcmfile' . preg_quote($attachment['id']) . '[\'"]/';
            $message_body = $MAIL_MIME->getHTMLBody();
            $is_inline    = preg_match($dispurl, $message_body);
        }
@@ -442,7 +448,7 @@
                $cid .= '@localhost';
            }
            $message_body = preg_replace($dispurl, ' src="cid:' . $cid . '" ', $message_body);
            $message_body = preg_replace($dispurl, '"cid:' . $cid . '"', $message_body);
            $MAIL_MIME->setHTMLBody($message_body);
@@ -462,7 +468,8 @@
                $attachment['data'] ? false : true,
                $ctype == 'message/rfc822' ? '8bit' : 'base64',
                'attachment',
                '', '', '',
                $attachment['charset'],
                '', '',
                $folding ? 'quoted-printable' : NULL,
                $folding == 2 ? 'quoted-printable' : NULL,
                '', RCUBE_CHARSET
@@ -477,15 +484,11 @@
    $transfer_encoding = $RCMAIL->config->get('force_7bit') ? 'quoted-printable' : '8bit';
}
else {
    $text_charset      = '';
    $text_charset      = 'US-ASCII';
    $transfer_encoding = '7bit';
}
if ($flowed) {
    if (!$text_charset) {
        $text_charset = 'US-ASCII';
    }
    $text_charset .= ";\r\n format=flowed";
}
@@ -561,9 +564,11 @@
    $store_target = $drafts_mbox;
}
else if (!$RCMAIL->config->get('no_save_sent_messages')) {
    $store_target = rcube_utils::get_input_value('_store_target', rcube_utils::INPUT_POST);
    if (!strlen($store_target)) {
        $sore_target = $RCMAIL->config->get('sent_mbox');
    if (isset($_POST['_store_target'])) {
        $store_target = rcube_utils::get_input_value('_store_target', rcube_utils::INPUT_POST);
    }
    else {
        $store_target = $RCMAIL->config->get('sent_mbox');
    }
}
@@ -738,11 +743,11 @@
/**
 * go from this:
 * <img src="http[s]://.../tiny_mce/plugins/emotions/images/smiley-cool.gif" border="0" alt="Cool" title="Cool" />
 * <img src="http[s]://.../tinymce/plugins/emoticons/img/smiley-cool.gif" border="0" alt="Cool" title="Cool" />
 *
 * to this:
 *
 * <img src="/path/on/server/.../tiny_mce/plugins/emotions/images/smiley-cool.gif" border="0" alt="Cool" title="Cool" />
 * <img src="/path/on/server/.../tinymce/plugins/emoticons/img/smiley-cool.gif" border="0" alt="Cool" title="Cool" />
 */
function rcmail_fix_emoticon_paths($mime_message)
{
@@ -753,7 +758,7 @@
    // remove any null-byte characters before parsing
    $body = preg_replace('/\x00/', '', $body);
    $searchstr = 'program/js/tiny_mce/plugins/emotions/img/';
    $searchstr = 'program/js/tinymce/plugins/emoticons/img/';
    $offset = 0;
    // keep track of added images, so they're only added once