summaryrefslogtreecommitdiff
path: root/program/steps/mail
diff options
context:
space:
mode:
authorAleksander Machniak <alec@alec.pl>2014-05-28 15:52:30 +0200
committerAleksander Machniak <alec@alec.pl>2014-05-28 15:52:30 +0200
commit731d190fecb1976d845f6bd18768ee528b007232 (patch)
tree323c63555256ad7e5faa6a9d3c10f957295d0ce1 /program/steps/mail
parent586ed69aa8f9df34076f4e3bb5e1ecf0cfc6581a (diff)
parent8763170d224408bb01998d0a3393d2eacfc781ad (diff)
Merge branch 'tinymce4'
Conflicts: program/js/app.js program/js/editor.js program/js/tiny_mce/tiny_mce.js program/steps/utils/spell_html.inc
Diffstat (limited to 'program/steps/mail')
-rw-r--r--program/steps/mail/attachments.inc43
-rw-r--r--program/steps/mail/compose.inc2
-rw-r--r--program/steps/mail/sendmail.inc21
3 files changed, 57 insertions, 9 deletions
diff --git a/program/steps/mail/attachments.inc b/program/steps/mail/attachments.inc
index 85bc36cac..c8b7f9517 100644
--- a/program/steps/mail/attachments.inc
+++ b/program/steps/mail/attachments.inc
@@ -60,7 +60,7 @@ if ($RCMAIL->action=='remove-attachment') {
exit;
}
-if ($RCMAIL->action=='display-attachment') {
+if ($RCMAIL->action == 'display-attachment') {
$id = 'undefined';
if (preg_match('/^rcmfile(\w+)$/', $_GET['_file'], $regs)) {
@@ -76,6 +76,47 @@ if ($RCMAIL->action=='display-attachment') {
$attachment['size'] = $attachment['data'] ? strlen($attachment['data']) : @filesize($attachment['path']);
}
+ // generate image thumbnail for file browser in HTML editor
+ if (!empty($_GET['_thumbnail'])) {
+ $temp_dir = $RCMAIL->config->get('temp_dir');
+ $thumbnail_size = 80;
+ list(,$ext) = explode('/', $attachment['mimetype']);
+ $mimetype = $attachment['mimetype'];
+ $file_ident = $attachment['id'] . ':' . $attachment['mimetype'] . ':' . $attachment['size'];
+ $cache_basename = $temp_dir . '/' . md5($file_ident . ':' . $RCMAIL->user->ID . ':' . $thumbnail_size);
+ $cache_file = $cache_basename . '.' . $ext;
+
+ // render thumbnail image if not done yet
+ if (!is_file($cache_file)) {
+ if (!$attachment['path']) {
+ $orig_name = $filename = $cache_basename . '.orig.' . $ext;
+ file_put_contents($orig_name, $attachment['data']);
+ }
+ else {
+ $filename = $attachment['path'];
+ }
+
+ $image = new rcube_image($filename);
+ if ($imgtype = $image->resize($thumbnail_size, $cache_file, true)) {
+ $mimetype = 'image/' . $imgtype;
+
+ if ($orig_name) {
+ unlink($orig_name);
+ }
+ }
+ }
+
+ if (is_file($cache_file)) {
+ // cache for 1h
+ $RCMAIL->output->future_expire_header(3600);
+ header('Content-Type: ' . $mimetype);
+ header('Content-Length: ' . filesize($cache_file));
+
+ readfile($cache_file);
+ exit;
+ }
+ }
+
header('Content-Type: ' . $attachment['mimetype']);
header('Content-Length: ' . $attachment['size']);
diff --git a/program/steps/mail/compose.inc b/program/steps/mail/compose.inc
index a3eb4b8a3..6a0139d72 100644
--- a/program/steps/mail/compose.inc
+++ b/program/steps/mail/compose.inc
@@ -1701,7 +1701,7 @@ function rcmail_editor_selector($attrib)
if (empty($attrib['name']))
$attrib['name'] = 'editorSelect';
- $attrib['onchange'] = "return rcmail_toggle_editor(this, '".$attrib['editorid']."', '_is_html')";
+ $attrib['onchange'] = "return rcmail_toggle_editor(this, '".$attrib['editorid']."')";
$select = new html_select($attrib);
diff --git a/program/steps/mail/sendmail.inc b/program/steps/mail/sendmail.inc
index baecbd118..7ae03e522 100644
--- a/program/steps/mail/sendmail.inc
+++ b/program/steps/mail/sendmail.inc
@@ -273,9 +273,10 @@ if ($isHtml) {
}
// 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,7 +311,13 @@ if (!$savedraft) {
$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);
@@ -738,11 +745,11 @@ function rcmail_get_identity($id)
/**
* 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 +760,7 @@ function rcmail_fix_emoticon_paths($mime_message)
// 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