summaryrefslogtreecommitdiff
path: root/program/steps
diff options
context:
space:
mode:
Diffstat (limited to 'program/steps')
-rw-r--r--program/steps/addressbook/edit.inc4
-rw-r--r--program/steps/addressbook/func.inc36
-rw-r--r--program/steps/addressbook/import.inc19
-rw-r--r--program/steps/addressbook/save.inc10
-rw-r--r--program/steps/addressbook/show.inc3
-rw-r--r--program/steps/mail/attachments.inc8
-rw-r--r--program/steps/mail/check_recent.inc10
-rw-r--r--program/steps/mail/compose.inc210
-rw-r--r--program/steps/mail/func.inc89
-rw-r--r--program/steps/mail/get.inc108
-rw-r--r--program/steps/mail/sendmail.inc12
-rw-r--r--program/steps/mail/show.inc3
-rw-r--r--program/steps/settings/edit_identity.inc10
-rw-r--r--program/steps/settings/folders.inc7
-rw-r--r--program/steps/settings/func.inc46
-rw-r--r--program/steps/settings/identities.inc6
-rw-r--r--program/steps/settings/save_identity.inc5
-rw-r--r--program/steps/settings/save_prefs.inc28
-rw-r--r--program/steps/utils/html2text.inc4
19 files changed, 391 insertions, 227 deletions
diff --git a/program/steps/addressbook/edit.inc b/program/steps/addressbook/edit.inc
index b216a7c70..d175c05d9 100644
--- a/program/steps/addressbook/edit.inc
+++ b/program/steps/addressbook/edit.inc
@@ -52,7 +52,7 @@ else {
// find writable addressbook
if (!$CONTACTS || $CONTACTS->readonly)
- $source = rcmail_default_source(true);
+ $source = $RCMAIL->get_address_book(-1, true);
// Initialize addressbook
$CONTACTS = rcmail_contact_source($source, true);
@@ -239,7 +239,7 @@ function rcmail_source_selector($attrib)
{
global $RCMAIL, $SOURCE_ID;
- $sources_list = $RCMAIL->get_address_sources(true);
+ $sources_list = $RCMAIL->get_address_sources(true, true);
if (count($sources_list) < 2) {
$source = $sources_list[$SOURCE_ID];
diff --git a/program/steps/addressbook/func.inc b/program/steps/addressbook/func.inc
index 3a0508025..fded9a819 100644
--- a/program/steps/addressbook/func.inc
+++ b/program/steps/addressbook/func.inc
@@ -63,12 +63,6 @@ if (!$RCMAIL->action && !$OUTPUT->ajax_call) {
// add list of address sources to client env
$js_list = $RCMAIL->get_address_sources();
- $source = get_input_value('_source', RCUBE_INPUT_GPC);
-
- // use first directory by default
- if (!strlen($source) || !isset($js_list[$source]))
- $source = $js_list[key($js_list)]['id'];
-
// count all/writeable sources
$writeable = 0;
$count = 0;
@@ -93,8 +87,16 @@ if (!$RCMAIL->action && !$OUTPUT->ajax_call) {
$_SESSION['addressbooks_count'] = $count;
$_SESSION['addressbooks_count_writeable'] = $writeable;
- if (!strlen($source))
- $source = strval(key($js_list));
+ // select address book
+ $source = get_input_value('_source', RCUBE_INPUT_GPC);
+
+ // use first directory by default
+ if (!strlen($source) || !isset($js_list[$source])) {
+ $source = $RCMAIL->config->get('default_addressbook');
+ if (!strlen($source) || !isset($js_list[$source])) {
+ $source = strval(key($js_list));
+ }
+ }
$CONTACTS = rcmail_contact_source($source, true);
}
@@ -158,17 +160,6 @@ function rcmail_contact_source($source=null, $init_env=false, $writable=false)
}
-function rcmail_default_source($writable=false)
-{
- global $RCMAIL;
-
- // get list of address sources
- $first = reset($RCMAIL->get_address_sources($writable));
-
- // use first directory by default
- return $first['id'];
-}
-
function rcmail_set_sourcename($abook)
{
global $OUTPUT;
@@ -367,12 +358,7 @@ function rcmail_contact_frame($attrib)
if (!$attrib['id'])
$attrib['id'] = 'rcmcontactframe';
- $attrib['name'] = $attrib['id'];
-
- $OUTPUT->set_env('contentframe', $attrib['name']);
- $OUTPUT->set_env('blankpage', $attrib['src'] ? $OUTPUT->abs_url($attrib['src']) : 'program/resources/blank.gif');
-
- return html::iframe($attrib);
+ return $OUTPUT->frame($attrib, true);
}
diff --git a/program/steps/addressbook/import.inc b/program/steps/addressbook/import.inc
index fb2251f18..df07d64bc 100644
--- a/program/steps/addressbook/import.inc
+++ b/program/steps/addressbook/import.inc
@@ -30,7 +30,7 @@ function rcmail_import_form($attrib)
$attrib += array('id' => "rcmImportForm");
- $writable_books = $RCMAIL->get_address_sources(true);
+ $writable_books = $RCMAIL->get_address_sources(true, true);
$upload = new html_inputfield(array(
'type' => 'file',
@@ -64,7 +64,7 @@ function rcmail_import_form($attrib)
$OUTPUT->add_label('selectimportfile','importwait');
$OUTPUT->add_gui_object('importform', $attrib['id']);
- $out = html::p(null, Q(rcube_label('importtext'), 'show'));
+ $out = html::p(null, Q(rcube_label('importdesc'), 'show'));
$out .= $OUTPUT->form_tag(array(
'action' => $RCMAIL->url('import'),
@@ -159,11 +159,22 @@ if (is_array($_FILES['_file'])) {
$upload_error = $err;
}
else {
+ $file_content = file_get_contents($filepath);
+
// let rcube_vcard do the hard work :-)
$vcard_o = new rcube_vcard();
$vcard_o->extend_fieldmap($CONTACTS->vcard_map);
+ $v_list = $vcard_o->import($file_content);
+
+ if (!empty($v_list)) {
+ $vcards = array_merge($vcards, $v_list);
+ continue;
+ }
- $v_list = $vcard_o->import(file_get_contents($filepath));
+ // no vCards found, try CSV
+ $csv = new rcube_csv2vcard($_SESSION['language']);
+ $csv->import($file_content);
+ $v_list = $csv->export();
if (!empty($v_list)) {
$vcards = array_merge($vcards, $v_list);
@@ -181,7 +192,7 @@ if (is_array($_FILES['_file'])) {
$OUTPUT->show_message('fileuploaderror', 'error');
}
else {
- $OUTPUT->show_message('importerror', 'error');
+ $OUTPUT->show_message('importformaterror', 'error');
}
}
else {
diff --git a/program/steps/addressbook/save.inc b/program/steps/addressbook/save.inc
index 887e49827..901ea0190 100644
--- a/program/steps/addressbook/save.inc
+++ b/program/steps/addressbook/save.inc
@@ -179,18 +179,24 @@ else {
$insert_id = $plugin['result'];
if ($insert_id) {
+ $CONTACTS->reset();
+
// add new contact to the specified group
if ($CONTACTS->groups && $CONTACTS->group_id) {
$plugin = $RCMAIL->plugins->exec_hook('group_addmembers', array(
'group_id' => $CONTACTS->group_id, 'ids' => $insert_id, 'source' => $source));
+ $counts = $CONTACTS->count();
+
if (!$plugin['abort']) {
- if (($maxnum = $RCMAIL->config->get('max_group_members', 0)) && ($CONTACTS->count()->count + 1 > $maxnum))
+ if (($maxnum = $RCMAIL->config->get('max_group_members', 0)) && ($counts->count + 1 > $maxnum))
$OUTPUT->show_message('maxgroupmembersreached', 'warning', array('max' => $maxnum));
$CONTACTS->add_to_group($gid, $plugin['ids']);
}
}
+ else
+ $counts = $CONTACTS->count();
if ((string)$source === (string)$orig_source) {
// add contact row or jump to the page where it should appear
@@ -202,7 +208,7 @@ else {
// update record count display
$CONTACTS->reset();
- $OUTPUT->command('parent.set_rowcount', rcmail_get_rowcount_text());
+ $OUTPUT->command('parent.set_rowcount', rcmail_get_rowcount_text($counts));
}
else {
// re-set iframe
diff --git a/program/steps/addressbook/show.inc b/program/steps/addressbook/show.inc
index 48e37256d..16be89f94 100644
--- a/program/steps/addressbook/show.inc
+++ b/program/steps/addressbook/show.inc
@@ -5,7 +5,7 @@
| program/steps/addressbook/show.inc |
| |
| This file is part of the Roundcube Webmail client |
- | Copyright (C) 2005-2009, The Roundcube Dev Team |
+ | Copyright (C) 2005-2012, The Roundcube Dev Team |
| |
| Licensed under the GNU General Public License version 3 or |
| any later version with exceptions for skins & plugins. |
@@ -32,6 +32,7 @@ $SOURCE_ID = $source;
if ($cid && ($record = $CONTACTS->get_record($cid, true))) {
$OUTPUT->set_env('readonly', $CONTACTS->readonly || $record['readonly']);
$OUTPUT->set_env('cid', $record['ID']);
+ $OUTPUT->set_env('compose_extwin', $RCMAIL->config->get('compose_extwin',false));
}
// get address book name (for display)
diff --git a/program/steps/mail/attachments.inc b/program/steps/mail/attachments.inc
index 21a9f5b99..180fc0bb9 100644
--- a/program/steps/mail/attachments.inc
+++ b/program/steps/mail/attachments.inc
@@ -89,6 +89,8 @@ $OUTPUT->reset();
$uploadid = get_input_value('_uploadid', RCUBE_INPUT_GET);
if (is_array($_FILES['_attachments']['tmp_name'])) {
+ $multiple = count($_FILES['_attachments']['tmp_name']) > 1;
+
foreach ($_FILES['_attachments']['tmp_name'] as $i => $filepath) {
// Process uploaded attachment if there is no error
$err = $_FILES['_attachments']['error'][$i];
@@ -149,8 +151,10 @@ if (is_array($_FILES['_attachments']['tmp_name'])) {
$msg = rcube_label('fileuploaderror');
}
- $OUTPUT->command('display_message', $msg, 'error');
- $OUTPUT->command('remove_from_attachment_list', $uploadid);
+ if ($attachment['error'] || $err != UPLOAD_ERR_NO_FILE) {
+ $OUTPUT->command('display_message', $msg, 'error');
+ $OUTPUT->command('remove_from_attachment_list', $uploadid);
+ }
}
}
}
diff --git a/program/steps/mail/check_recent.inc b/program/steps/mail/check_recent.inc
index 1a1b08c60..90d17c15b 100644
--- a/program/steps/mail/check_recent.inc
+++ b/program/steps/mail/check_recent.inc
@@ -19,8 +19,14 @@
+-----------------------------------------------------------------------+
*/
+// If there's no folder or messages list, there's nothing to update
+// This can happen on 'refresh' request
+if (empty($_REQUEST['_folderlist']) && empty($_REQUEST['_list'])) {
+ return;
+}
+
$current = $RCMAIL->storage->get_folder();
-$check_all = !empty($_GET['_refresh']) || (bool)$RCMAIL->config->get('check_all_folders');
+$check_all = $RCMAIL->action != 'refresh' || (bool)$RCMAIL->config->get('check_all_folders');
// list of folders to check
if ($check_all) {
@@ -102,6 +108,4 @@ foreach ($a_mailboxes as $mbox_name) {
}
}
-$RCMAIL->plugins->exec_hook('keep_alive', array());
-
$OUTPUT->send();
diff --git a/program/steps/mail/compose.inc b/program/steps/mail/compose.inc
index 2d45105c2..c039e42c6 100644
--- a/program/steps/mail/compose.inc
+++ b/program/steps/mail/compose.inc
@@ -249,18 +249,7 @@ else {
$MESSAGE->compose = array();
// get user's identities
-$MESSAGE->identities = $RCMAIL->user->list_identities();
-if (count($MESSAGE->identities))
-{
- foreach ($MESSAGE->identities as $idx => $ident) {
- $ident['email'] = format_email($ident['email']);
- $email = format_email(rcube_idn_to_utf8($ident['email']));
-
- $MESSAGE->identities[$idx]['email_ascii'] = $ident['email'];
- $MESSAGE->identities[$idx]['ident'] = format_email_recipient($ident['email'], $ident['name']);
- $MESSAGE->identities[$idx]['email'] = $email;
- }
-}
+$MESSAGE->identities = $RCMAIL->user->list_identities(null, true);
// Set From field value
if (!empty($_POST['_from'])) {
@@ -270,83 +259,10 @@ else if (!empty($COMPOSE['param']['from'])) {
$MESSAGE->compose['from'] = $COMPOSE['param']['from'];
}
else if (count($MESSAGE->identities)) {
- $a_recipients = array();
- $a_names = array();
-
- // extract all recipients of the reply-message
- if (is_object($MESSAGE->headers) && in_array($compose_mode, array(RCUBE_COMPOSE_REPLY, RCUBE_COMPOSE_FORWARD)))
- {
- $a_to = rcube_mime::decode_address_list($MESSAGE->headers->to, null, true, $MESSAGE->headers->charset);
- foreach ($a_to as $addr) {
- if (!empty($addr['mailto'])) {
- $a_recipients[] = format_email($addr['mailto']);
- $a_names[] = $addr['name'];
- }
- }
-
- if (!empty($MESSAGE->headers->cc)) {
- $a_cc = rcube_mime::decode_address_list($MESSAGE->headers->cc, null, true, $MESSAGE->headers->charset);
- foreach ($a_cc as $addr) {
- if (!empty($addr['mailto'])) {
- $a_recipients[] = format_email($addr['mailto']);
- $a_names[] = $addr['name'];
- }
- }
- }
- }
-
- $from_idx = null;
- $found_idx = null;
- $default_identity = 0; // default identity is always first on the list
- $return_path = $MESSAGE->headers->others['return-path'];
-
- // Select identity
- foreach ($MESSAGE->identities as $idx => $ident) {
- // use From header
- if (in_array($compose_mode, array(RCUBE_COMPOSE_DRAFT, RCUBE_COMPOSE_EDIT))) {
- if ($MESSAGE->headers->from == $ident['ident']) {
- $from_idx = $idx;
- break;
- }
- }
- // reply to yourself
- else if ($compose_mode == RCUBE_COMPOSE_REPLY && $MESSAGE->headers->from == $ident['ident']) {
- $from_idx = $idx;
- break;
- }
- // use replied message recipients
- else if (($found = array_search($ident['email_ascii'], $a_recipients)) !== false) {
- if ($found_idx === null) {
- $found_idx = $idx;
- }
- // match identity name
- if ($a_names[$found] && $ident['name'] && $a_names[$found] == $ident['name']) {
- $from_idx = $idx;
- break;
- }
- }
- }
-
- // If matching by name+address doesn't found any amtches, get first found address (identity)
- if ($from_idx === null) {
- $from_idx = $found_idx;
- }
-
- // Fallback using Return-Path
- if ($from_idx === null && $return_path) {
- foreach ($MESSAGE->identities as $idx => $ident) {
- if (strpos($return_path, str_replace('@', '=', $ident['email_ascii']).'@') !== false) {
- $from_idx = $idx;
- break;
- }
- }
- }
-
- $ident = $MESSAGE->identities[$from_idx !== null ? $from_idx : $default_identity];
- $from_id = $ident['identity_id'];
+ $ident = rcmail_identity_select($MESSAGE, $MESSAGE->identities, $compose_mode);
$MESSAGE->compose['from_email'] = $ident['email'];
- $MESSAGE->compose['from'] = $from_id;
+ $MESSAGE->compose['from'] = $ident['identity_id'];
}
// Set other headers
@@ -463,6 +379,92 @@ $MESSAGE_BODY = rcmail_prepare_message_body();
/****** compose mode functions ********/
+function rcmail_identity_select($MESSAGE, $identities, $compose_mode)
+{
+ $a_recipients = array();
+ $a_names = array();
+
+ // extract all recipients of the reply-message
+ if (is_object($MESSAGE->headers) && in_array($compose_mode, array(RCUBE_COMPOSE_REPLY, RCUBE_COMPOSE_FORWARD))) {
+ $a_to = rcube_mime::decode_address_list($MESSAGE->headers->to, null, true, $MESSAGE->headers->charset);
+ foreach ($a_to as $addr) {
+ if (!empty($addr['mailto'])) {
+ $a_recipients[] = format_email($addr['mailto']);
+ $a_names[] = $addr['name'];
+ }
+ }
+
+ if (!empty($MESSAGE->headers->cc)) {
+ $a_cc = rcube_mime::decode_address_list($MESSAGE->headers->cc, null, true, $MESSAGE->headers->charset);
+ foreach ($a_cc as $addr) {
+ if (!empty($addr['mailto'])) {
+ $a_recipients[] = format_email($addr['mailto']);
+ $a_names[] = $addr['name'];
+ }
+ }
+ }
+ }
+
+ $from_idx = null;
+ $found_idx = null;
+ $default_identity = 0; // default identity is always first on the list
+
+ // Select identity
+ foreach ($identities as $idx => $ident) {
+ // use From header
+ if (in_array($compose_mode, array(RCUBE_COMPOSE_DRAFT, RCUBE_COMPOSE_EDIT))) {
+ if ($MESSAGE->headers->from == $ident['ident']) {
+ $from_idx = $idx;
+ break;
+ }
+ }
+ // reply to yourself
+ else if ($compose_mode == RCUBE_COMPOSE_REPLY && $MESSAGE->headers->from == $ident['ident']) {
+ $from_idx = $idx;
+ break;
+ }
+ // use replied message recipients
+ else if (($found = array_search($ident['email_ascii'], $a_recipients)) !== false) {
+ if ($found_idx === null) {
+ $found_idx = $idx;
+ }
+ // match identity name
+ if ($a_names[$found] && $ident['name'] && $a_names[$found] == $ident['name']) {
+ $from_idx = $idx;
+ break;
+ }
+ }
+ }
+
+ // If matching by name+address doesn't found any amtches, get first found address (identity)
+ if ($from_idx === null) {
+ $from_idx = $found_idx;
+ }
+
+ // Try Return-Path
+ if ($from_idx === null && ($return_path = $MESSAGE->headers->others['return-path'])) {
+ foreach ($identities as $idx => $ident) {
+ if (strpos($return_path, str_replace('@', '=', $ident['email_ascii']).'@') !== false) {
+ $from_idx = $idx;
+ break;
+ }
+ }
+ }
+
+ // Fallback using Delivered-To
+ if ($from_idx === null && ($delivered_to = $MESSAGE->headers->others['delivered-to'])) {
+ foreach ($identities as $idx => $ident) {
+ if (in_array($ident['email_ascii'], $delivered_to)) {
+ $from_idx = $idx;
+ break;
+ }
+ }
+ }
+
+ return $identities[$from_idx !== null ? $from_idx : $default_identity];
+}
+
+
function rcmail_compose_headers($attrib)
{
global $MESSAGE;
@@ -611,13 +613,13 @@ function rcmail_compose_editor_mode()
$useHtml = !empty($_POST['_is_html']);
}
else if ($compose_mode == RCUBE_COMPOSE_DRAFT || $compose_mode == RCUBE_COMPOSE_EDIT) {
- $useHtml = $MESSAGE->has_html_part(false);
+ $useHtml = $MESSAGE->has_html_part(false, true);
}
else if ($compose_mode == RCUBE_COMPOSE_REPLY) {
- $useHtml = ($html_editor == 1 || ($html_editor >= 2 && $MESSAGE->has_html_part(false)));
+ $useHtml = ($html_editor == 1 || ($html_editor >= 2 && $MESSAGE->has_html_part(false, true)));
}
else if ($compose_mode == RCUBE_COMPOSE_FORWARD) {
- $useHtml = ($html_editor == 1 || ($html_editor == 3 && $MESSAGE->has_html_part(false)));
+ $useHtml = ($html_editor == 1 || ($html_editor == 3 && $MESSAGE->has_html_part(false, true)));
}
else {
$useHtml = ($html_editor == 1);
@@ -730,6 +732,10 @@ function rcmail_compose_part_body($part, $isHtml = false)
if ($isHtml) {
if ($part->ctype_secondary == 'html') {
}
+ else if ($part->ctype_secondary == 'enriched') {
+ require_once(INSTALL_PATH . 'program/lib/enriched.inc');
+ $body = enriched_to_html($body);
+ }
else {
// try to remove the signature
if ($RCMAIL->config->get('strip_existing_sig', true)) {
@@ -743,6 +749,12 @@ function rcmail_compose_part_body($part, $isHtml = false)
}
}
else {
+ if ($part->ctype_secondary == 'enriched') {
+ require_once(INSTALL_PATH . 'program/lib/enriched.inc');
+ $body = enriched_to_html($body);
+ $part->ctype_secondary = 'html';
+ }
+
if ($part->ctype_secondary == 'html') {
// use html part if it has been used for message (pre)viewing
// decrease line length for quoting
@@ -750,6 +762,10 @@ function rcmail_compose_part_body($part, $isHtml = false)
$txt = new html2text($body, false, true, $len);
$body = $txt->get_text();
}
+ else if ($part->ctype_secondary == 'enriched') {
+ require_once(INSTALL_PATH . 'program/lib/enriched.inc');
+ $body = enriched_to_html($body);
+ }
else {
if ($part->ctype_secondary == 'plain' && $part->ctype_parameters['format'] == 'flowed') {
$body = rcube_mime::unfold_flowed($body);
@@ -906,9 +922,10 @@ function rcmail_create_reply_body($body, $bodyIsHtml)
if (!$bodyIsHtml) {
$body = preg_replace('/\r?\n/', "\n", $body);
+ $body = trim($body, "\n");
// soft-wrap and quote message text
- $body = rcmail_wrap_and_quote(rtrim($body, "\n"), $LINE_LENGTH);
+ $body = rcmail_wrap_and_quote($body, $LINE_LENGTH);
$prefix .= "\n";
$suffix = '';
@@ -953,8 +970,7 @@ function rcmail_create_forward_body($body, $bodyIsHtml)
$date = format_date($MESSAGE->headers->date, $RCMAIL->config->get('date_long'));
$charset = $RCMAIL->output->get_charset();
- if (!$bodyIsHtml)
- {
+ if (!$bodyIsHtml) {
$prefix = "\n\n\n-------- " . rcube_label('originalmessage') . " --------\n";
$prefix .= rcube_label('subject') . ': ' . $MESSAGE->subject . "\n";
$prefix .= rcube_label('date') . ': ' . $date . "\n";
@@ -967,9 +983,9 @@ function rcmail_create_forward_body($body, $bodyIsHtml)
$prefix .= rcube_label('replyto') . ': ' . $MESSAGE->get_header('replyto') . "\n";
$prefix .= "\n";
+ $body = trim($body, "\r\n");
}
- else
- {
+ else {
// set is_safe flag (we need this for html body washing)
rcmail_check_safe($MESSAGE);
// clean up html tags
@@ -1601,7 +1617,7 @@ function rcmail_addressbook_list($attrib = array())
'rel' => '%s',
'onclick' => "return ".JS_OBJECT_NAME.".command('list-adresses','%s',this)"), '%s'));
- foreach ($RCMAIL->get_address_sources() as $j => $source) {
+ foreach ($RCMAIL->get_address_sources(false, true) as $j => $source) {
$id = strval(strlen($source['id']) ? $source['id'] : $j);
$js_id = JQ($id);
@@ -1614,7 +1630,7 @@ function rcmail_addressbook_list($attrib = array())
html_identifier($id),
$class_name,
$source['id'],
- $js_id, (!empty($source['name']) ? Q($source['name']) : Q($id)));
+ $js_id, (!empty($source['name']) ? $source['name'] : $id));
}
$OUTPUT->add_gui_object('addressbookslist', $attrib['id']);
diff --git a/program/steps/mail/func.inc b/program/steps/mail/func.inc
index 47d1a484a..cb1a5ddae 100644
--- a/program/steps/mail/func.inc
+++ b/program/steps/mail/func.inc
@@ -471,7 +471,7 @@ function rcmail_messagecontent_frame($attrib)
$OUTPUT->set_env('contentframe', $attrib['id']);
$OUTPUT->set_env('blankpage', $attrib['src'] ? $OUTPUT->abs_url($attrib['src']) : 'program/resources/blank.gif');
- return html::iframe($attrib);
+ return $OUTPUT->frame($attrib, true);
}
@@ -751,9 +751,10 @@ function rcmail_print_body($part, $p = array())
}
// text/enriched
else if ($data['type'] == 'enriched') {
- $part->ctype_secondary = 'html';
require_once(INSTALL_PATH . 'program/lib/enriched.inc');
- $body = Q(enriched_to_html($data['body']), 'show');
+ $body = enriched_to_html($data['body']);
+ $body = rcmail_wash_html($body, $data, $part->replaces);
+ $part->ctype_secondary = 'html';
}
else {
// assert plaintext
@@ -789,7 +790,7 @@ function rcmail_plain_body($body, $flowed=false)
global $RCMAIL;
// make links and email-addresses clickable
- $replacer = new rcube_string_replacer;
+ $replacer = new rcmail_string_replacer;
// search for patterns like links and e-mail addresses and replace with tokens
$body = $replacer->replace($body);
@@ -801,8 +802,8 @@ function rcmail_plain_body($body, $flowed=false)
// find/mark quoted lines...
for ($n=0, $cnt=count($body); $n < $cnt; $n++) {
- if ($body[$n][0] == '>' && preg_match('/^(>+\s*)+/', $body[$n], $regs)) {
- $q = strlen(preg_replace('/\s/', '', $regs[0]));
+ if ($body[$n][0] == '>' && preg_match('/^(>+ {0,1})+/', $body[$n], $regs)) {
+ $q = substr_count($regs[0], '>');
$body[$n] = substr($body[$n], strlen($regs[0]));
if ($q > $quote_level) {
@@ -1060,10 +1061,10 @@ function rcmail_localized_priority($value)
'4' => 'low',
'5' => 'lowest',
);
-
+
if ($value && $labels_map[$value])
return rcube_label($labels_map[$value]);
-
+
return '';
}
@@ -1186,7 +1187,10 @@ function rcmail_message_body($attrib)
}
// list images after mail body
- if ($CONFIG['inline_images'] && !empty($MESSAGE->attachments)) {
+ if ($RCMAIL->config->get('inline_images', true) && !empty($MESSAGE->attachments)) {
+ $thumbnail_size = $RCMAIL->config->get('image_thumbnail_size', 240);
+ $client_mimetypes = (array)$RCMAIL->config->get('client_mimetypes');
+
foreach ($MESSAGE->attachments as $attach_prop) {
// skip inline images
if ($attach_prop->content_id && $attach_prop->disposition == 'inline') {
@@ -1194,13 +1198,47 @@ function rcmail_message_body($attrib)
}
// Content-Type: image/*...
- if (rcmail_part_image_type($attach_prop)) {
- $out .= html::tag('hr') . html::p(array('align' => "center"),
- html::img(array(
- 'src' => $MESSAGE->get_part_url($attach_prop->mime_id, true),
- 'title' => $attach_prop->filename,
- 'alt' => $attach_prop->filename,
- )));
+ if ($mimetype = rcmail_part_image_type($attach_prop)) {
+ // display thumbnails
+ if ($thumbnail_size) {
+ $show_link = array(
+ 'href' => $MESSAGE->get_part_url($attach_prop->mime_id, false),
+ 'onclick' => sprintf(
+ 'return %s.command(\'load-attachment\',{part:\'%s\', mimetype:\'%s\'},this)',
+ JS_OBJECT_NAME,
+ $attach_prop->mime_id,
+ $mimetype)
+ );
+ $out .= html::p('image-attachment',
+ html::a($show_link + array('class' => 'image-link', 'style' => sprintf('width:%dpx', $thumbnail_size)),
+ html::img(array(
+ 'class' => 'image-thumbnail',
+ 'src' => $MESSAGE->get_part_url($attach_prop->mime_id, true) . '&_thumb=1',
+ 'title' => $attach_prop->filename,
+ 'alt' => $attach_prop->filename,
+ 'style' => sprintf('max-width:%dpx; max-height:%dpx', $thumbnail_size, $thumbnail_size),
+ ))
+ ) .
+ html::span('image-filename', Q($attach_prop->filename)) .
+ html::span('image-filesize', Q($RCMAIL->message_part_size($attach_prop))) .
+ html::span('attachment-links',
+ (in_array($mimetype, $client_mimetypes) ? html::a($show_link, rcube_label('showattachment')) . '&nbsp;' : '') .
+ html::a($show_link['href'] . '&_download=1', rcube_label('download'))
+ ) .
+ html::br(array('style' => 'clear:both'))
+ );
+ }
+ else {
+ $out .= html::tag('fieldset', 'image-attachment',
+ html::tag('legend', 'image-filename', Q($attach_prop->filename)) .
+ html::p(array('align' => "center"),
+ html::img(array(
+ 'src' => $MESSAGE->get_part_url($attach_prop->mime_id, true),
+ 'title' => $attach_prop->filename,
+ 'alt' => $attach_prop->filename,
+ )))
+ );
+ }
}
}
}
@@ -1247,7 +1285,7 @@ function rcmail_part_image_type($part)
if ($part->filename
&& preg_match('/^application\/octet-stream$/i', $part->mimetype)
- && preg_match('/\.([^.])$/i', $part->filename, $m)
+ && preg_match('/\.([^.]+)$/i', $part->filename, $m)
&& ($extension = strtolower($m[1]))
&& isset($types[$extension])
) {
@@ -1294,7 +1332,7 @@ function rcmail_html4inline($body, $container_id, $body_id='', &$attributes=null
// modify HTML links to open a new window if clicked
$GLOBALS['rcmail_html_container_id'] = $container_id;
- $body = preg_replace_callback('/<(a|link)\s+([^>]+)>/Ui', 'rcmail_alter_html_link', $body);
+ $body = preg_replace_callback('/<(a|link|area)\s+([^>]+)>/Ui', 'rcmail_alter_html_link', $body);
unset($GLOBALS['rcmail_html_container_id']);
$body = preg_replace(array(
@@ -1407,7 +1445,11 @@ function rcmail_alter_html_link($matches)
$attrib['target'] = '_blank';
}
- return "<$tag" . html::attrib_string($attrib, array('href','name','target','onclick','id','class','style','title','rel','type','media')) . $end;
+ // allowed attributes for a|link|area tags
+ $allow = array('href','name','target','onclick','id','class','style','title',
+ 'rel','type','media','alt','coords','nohref','hreflang','shape');
+
+ return "<$tag" . html::attrib_string($attrib, $allow) . $end;
}
@@ -1446,7 +1488,9 @@ function rcmail_address_string($input, $max=null, $linked=false, $addicon=null,
$mailto = rcube_idn_to_utf8($mailto);
if ($PRINT_MODE) {
- $out .= sprintf('%s &lt;%s&gt;', Q($name), $mailto);
+ $out .= ($out ? ', ' : '') . sprintf('%s &lt;%s&gt;', Q($name), $mailto);
+ // for printing we display all addresses
+ continue;
}
else if (check_email($part['mailto'], false)) {
if ($linked) {
@@ -1555,7 +1599,7 @@ function rcmail_wrap_and_quote($text, $length = 72)
$out .= $line . "\n";
}
- return $out;
+ return rtrim($out, "\n");
}
@@ -1620,7 +1664,7 @@ function rcmail_message_part_frame($attrib)
$part = $MESSAGE->mime_parts[asciiwords(get_input_value('_part', RCUBE_INPUT_GPC))];
$ctype_primary = strtolower($part->ctype_primary);
- $attrib['src'] = './?' . str_replace('_frame=', ($ctype_primary=='text' ? '_show=' : '_preload='), $_SERVER['QUERY_STRING']);
+ $attrib['src'] = './?' . str_replace('_frame=', ($ctype_primary=='text' ? '_embed=' : '_preload='), $_SERVER['QUERY_STRING']);
return html::iframe($attrib);
}
@@ -1806,6 +1850,7 @@ $OUTPUT->add_handlers(array(
// register action aliases
$RCMAIL->register_action_map(array(
+ 'refresh' => 'check_recent.inc',
'preview' => 'show.inc',
'print' => 'show.inc',
'moveto' => 'move_del.inc',
diff --git a/program/steps/mail/get.inc b/program/steps/mail/get.inc
index bcd57dee0..71a5e1b02 100644
--- a/program/steps/mail/get.inc
+++ b/program/steps/mail/get.inc
@@ -60,6 +60,42 @@ if (!empty($_GET['_frame'])) {
exit;
}
+// render thumbnail of an image attachment
+else if ($_GET['_thumb']) {
+ $pid = get_input_value('_part', RCUBE_INPUT_GET);
+ if ($part = $MESSAGE->mime_parts[$pid]) {
+ $thumbnail_size = $RCMAIL->config->get('image_thumbnail_size', 240);
+ $temp_dir = $RCMAIL->config->get('temp_dir');
+ list(,$ext) = explode('/', $part->mimetype);
+ $cache_basename = $temp_dir . '/' . md5($MESSAGE->headers->messageID . $part->mime_id . ':' . $RCMAIL->user->ID . ':' . $thumbnail_size);
+ $cache_file = $cache_basename . '.' . $ext;
+ $mimetype = $part->mimetype;
+
+ // render thumbnail image if not done yet
+ if (!is_file($cache_file)) {
+ $fp = fopen(($orig_name = $cache_basename . '.orig.' . $ext), 'w');
+ $MESSAGE->get_part_content($part->mime_id, $fp);
+ fclose($fp);
+
+ $image = new rcube_image($orig_name);
+ if ($imgtype = $image->resize($RCMAIL->config->get('image_thumbnail_size', 240), $cache_file, true)) {
+ $mimetype = 'image/' . $imgtype;
+ unlink($orig_name);
+ }
+ else {
+ rename($orig_name, $cache_file);
+ }
+ }
+
+ if (is_file($cache_file)) {
+ header('Content-Type: ' . $mimetype);
+ readfile($cache_file);
+ }
+ }
+
+ exit;
+}
+
else if (strlen($pid = get_input_value('_part', RCUBE_INPUT_GET))) {
if ($part = $MESSAGE->mime_parts[$pid]) {
@@ -76,6 +112,71 @@ else if (strlen($pid = get_input_value('_part', RCUBE_INPUT_GET))) {
// overwrite modified vars from plugin
$mimetype = $plugin['mimetype'];
+ $extensions = rcube_mime::get_mime_extensions($mimetype);
+
+ if ($plugin['body'])
+ $part->body = $plugin['body'];
+
+
+ // compare file mimetype with the stated content-type headers and file extension to avoid malicious operations
+ if (!empty($_REQUEST['_embed']) && empty($_REQUEST['_nocheck'])) {
+ $file_extension = strtolower(pathinfo($part->filename, PATHINFO_EXTENSION));
+
+ // 1. compare filename suffix with expected suffix derived from mimetype
+ $valid = $file_extension && in_array($file_extension, (array)$extensions);
+
+ // 2. detect the real mimetype of the attachment part and compare it with the stated mimetype and filename extension
+ if ($valid || !$file_extension || $mimetype == 'application/octet-stream') {
+ if ($part->body) // part body is already loaded
+ $body = $part->body;
+ else if ($part->size && $part->size < 1024*1024) // load the entire part if it's small enough
+ $body = $part->body = $MESSAGE->get_part_content($part->mime_id);
+ else // fetch the first 2K of the message part
+ $body = $MESSAGE->get_part_content($part->mime_id, null, true, 2048);
+
+ // detect message part mimetype
+ $real_mimetype = rcube_mime::file_content_type($body, $part->filename, $mimetype, true, true);
+ list($real_ctype_primary, $real_ctype_secondary) = explode('/', $real_mimetype);
+
+ // ignore differences in text/* mimetypes. Filetype detection isn't very reliable here
+ if ($real_ctype_primary == 'text' && strpos($mimetype, $real_ctype_primary) === 0)
+ $real_mimetype = $mimetype;
+
+ // get valid file extensions
+ $extensions = rcube_mime::get_mime_extensions($real_mimetype);
+ $valid_extension = (!$file_extension || in_array($file_extension, (array)$extensions));
+
+ // fix mimetype for images wrongly declared as octet-stream
+ if ($mimetype == 'application/octet-stream' && strpos($real_mimetype, 'image/') === 0 && $valid_extension)
+ $mimetype = $real_mimetype;
+
+ $valid = ($real_mimetype == $mimetype && $valid_extension);
+ }
+ else {
+ $real_mimetype = $mimetype;
+ }
+
+ // show warning if validity checks failed
+ if (!$valid) {
+ $OUTPUT = new rcmail_html_page();
+ $OUTPUT->write(html::tag('html', null, html::tag('body', array('style' => 'font-family:sans-serif; margin:1em'),
+ html::div(array('class' => 'warning', 'style' => 'border:2px solid #ffdf0e; background:#fef893; padding:1em 1em 0 1em;'),
+ rcube_label(array(
+ 'name' => 'attachmentvalidationerror',
+ 'vars' => array('expected' => "$mimetype (.$file_extension)", 'detected' => "$real_mimetype (.$extensions[0])")
+ )) .
+ html::p('buttons',
+ html::tag('button', null,
+ html::a(array(
+ 'href' => $RCMAIL->url(array_merge($_GET, array('_nocheck' => 1))),
+ 'style' => 'text-decoration:none;color:#000',
+ ), rcube_label('showanyway')))
+ ))
+ )));
+ exit;
+ }
+ }
+
// TIFF to JPEG conversion, if needed
$tiff_support = !empty($_SESSION['browser_caps']) && !empty($_SESSION['browser_caps']['tif']);
@@ -87,11 +188,9 @@ else if (strlen($pid = get_input_value('_part', RCUBE_INPUT_GET))) {
$mimetype = 'image/jpeg';
}
- list($ctype_primary, $ctype_secondary) = explode('/', $mimetype);
- if ($plugin['body'])
- $part->body = $plugin['body'];
$browser = $RCMAIL->output->browser;
+ list($ctype_primary, $ctype_secondary) = explode('/', $mimetype);
// send download headers
if ($plugin['download']) {
@@ -108,6 +207,7 @@ else if (strlen($pid = get_input_value('_part', RCUBE_INPUT_GET))) {
header("Content-Transfer-Encoding: binary");
}
+
// deliver part content
if ($ctype_primary == 'text' && $ctype_secondary == 'html' && empty($plugin['download'])) {
// Check if we have enough memory to handle the message in it
@@ -130,7 +230,7 @@ else if (strlen($pid = get_input_value('_part', RCUBE_INPUT_GET))) {
check_storage_status();
}
- $OUTPUT = new rcube_output_html();
+ $OUTPUT = new rcube_html_page();
$OUTPUT->write($out);
}
else {
diff --git a/program/steps/mail/sendmail.inc b/program/steps/mail/sendmail.inc
index 4fac872d1..c26d774a2 100644
--- a/program/steps/mail/sendmail.inc
+++ b/program/steps/mail/sendmail.inc
@@ -364,7 +364,7 @@ if (!empty($mailcc)) {
if (!empty($mailbcc)) {
$headers['Bcc'] = $mailbcc;
}
-if (!empty($identity_arr['bcc'])) {
+if (!empty($identity_arr['bcc']) && stripos($headers['Bcc'], $identity_arr['bcc']) === false) {
$headers['Bcc'] = ($headers['Bcc'] ? $headers['Bcc'].', ' : '') . $identity_arr['bcc'];
$RECIPIENT_COUNT ++;
}
@@ -559,8 +559,8 @@ if ($isHtml) {
$plugin['body'] = rcmail_replace_emoticons($plugin['body']);
// add a plain text version of the e-mail as an alternative part.
- $h2t = new html2text($plugin['body'], false, true, 0);
- $plainTextPart = rc_wordwrap($h2t->get_text(), $LINE_LENGTH, "\r\n");
+ $h2t = new html2text($plugin['body'], false, true, 0, $message_charset);
+ $plainTextPart = rc_wordwrap($h2t->get_text(), $LINE_LENGTH, "\r\n", false, $message_charset);
$plainTextPart = wordwrap($plainTextPart, 998, "\r\n", true);
// make sure all line endings are CRLF (#1486712)
@@ -585,10 +585,10 @@ else {
$message_body = $plugin['body'];
// compose format=flowed content if enabled
- if ($flowed = $RCMAIL->config->get('send_format_flowed', true))
- $message_body = rcube_mime::format_flowed($message_body, min($LINE_LENGTH+2, 79));
+ if ($flowed = ($savedraft || $RCMAIL->config->get('send_format_flowed', true)))
+ $message_body = rcube_mime::format_flowed($message_body, min($LINE_LENGTH+2, 79), $message_charset);
else
- $message_body = rc_wordwrap($message_body, $LINE_LENGTH, "\r\n");
+ $message_body = rc_wordwrap($message_body, $LINE_LENGTH, "\r\n", false, $message_charset);
$message_body = wordwrap($message_body, 998, "\r\n", true);
diff --git a/program/steps/mail/show.inc b/program/steps/mail/show.inc
index f89660719..82594f3e4 100644
--- a/program/steps/mail/show.inc
+++ b/program/steps/mail/show.inc
@@ -62,8 +62,7 @@ if ($uid = get_input_value('_uid', RCUBE_INPUT_GET)) {
$OUTPUT->set_env('compose_extwin', $RCMAIL->config->get('compose_extwin',false));
// mimetypes supported by the browser (default settings)
- $mimetypes = $RCMAIL->config->get('client_mimetypes', 'text/plain,text/html,text/xml,image/jpeg,image/gif,image/png,image/bmp,image/tiff,application/x-javascript,application/pdf,application/x-shockwave-flash');
- $mimetypes = is_string($mimetypes) ? explode(',', $mimetypes) : (array)$mimetypes;
+ $mimetypes = (array)$RCMAIL->config->get('client_mimetypes');
// Remove unsupported types, which makes that attachment which cannot be
// displayed in a browser will be downloaded directly without displaying an overlay page
diff --git a/program/steps/settings/edit_identity.inc b/program/steps/settings/edit_identity.inc
index 7e7be1f83..d70a7aef7 100644
--- a/program/steps/settings/edit_identity.inc
+++ b/program/steps/settings/edit_identity.inc
@@ -42,8 +42,9 @@ else {
rcmail_overwrite_action('identities');
return;
}
- else if (IDENTITIES_LEVEL == 1)
- $IDENTITY_RECORD['email'] = $RCMAIL->user->get_username();
+ else if (IDENTITIES_LEVEL == 1) {
+ $IDENTITY_RECORD['email'] = $RCMAIL->get_user_email();
+ }
}
@@ -87,9 +88,10 @@ function rcube_identity_form($attrib)
if ($IDENTITY_RECORD['html_signature']) {
$form['signature']['content']['signature']['class'] = 'mce_editor';
$form['signature']['content']['signature']['is_escaped'] = true;
- }
- $IDENTITY_RECORD['signature'] = htmlentities($IDENTITY_RECORD['signature'], ENT_NOQUOTES, RCMAIL_CHARSET);
+ // Correctly handle HTML entities in HTML editor (#1488483)
+ $IDENTITY_RECORD['signature'] = htmlspecialchars($IDENTITY_RECORD['signature'], ENT_NOQUOTES, RCMAIL_CHARSET);
+ }
// disable some field according to access level
if (IDENTITIES_LEVEL == 1 || IDENTITIES_LEVEL == 3) {
diff --git a/program/steps/settings/folders.inc b/program/steps/settings/folders.inc
index 12e449e80..0c7d9063f 100644
--- a/program/steps/settings/folders.inc
+++ b/program/steps/settings/folders.inc
@@ -369,12 +369,7 @@ function rcmail_folder_frame($attrib)
if (!$attrib['id'])
$attrib['id'] = 'rcmfolderframe';
- $attrib['name'] = $attrib['id'];
-
- $OUTPUT->set_env('contentframe', $attrib['name']);
- $OUTPUT->set_env('blankpage', $attrib['src'] ? $OUTPUT->abs_url($attrib['src']) : 'program/resources/blank.gif');
-
- return html::iframe($attrib);
+ return $OUTPUT->frame($attrib, true);
}
function rcmail_rename_folder($oldname, $newname)
diff --git a/program/steps/settings/func.inc b/program/steps/settings/func.inc
index d5ccbb2d7..3bcca21bf 100644
--- a/program/steps/settings/func.inc
+++ b/program/steps/settings/func.inc
@@ -31,12 +31,7 @@ function rcmail_preferences_frame($attrib)
if (!$attrib['id'])
$attrib['id'] = 'rcmprefsframe';
- $attrib['name'] = $attrib['id'];
-
- $OUTPUT->set_env('contentframe', $attrib['name']);
- $OUTPUT->set_env('blankpage', $attrib['src'] ? $OUTPUT->abs_url($attrib['src']) : 'program/resources/blank.gif');
-
- return html::iframe($attrib);
+ return $OUTPUT->frame($attrib, true);
}
@@ -242,6 +237,24 @@ function rcmail_user_prefs($current=null)
);
}
+ if (!isset($no_override['refresh_interval'])) {
+ $field_id = 'rcmfd_refresh_interval';
+ $select_refresh_interval = new html_select(array('name' => '_refresh_interval', 'id' => $field_id));
+
+ $select_refresh_interval->add(rcube_label('never'), 0);
+ foreach (array(1, 3, 5, 10, 15, 30, 60) as $min) {
+ if (!$config['min_refresh_interval'] || $config['min_refresh_interval'] <= $min * 60) {
+ $label = rcube_label(array('name' => 'everynminutes', 'vars' => array('n' => $min)));
+ $select_refresh_interval->add($label, $min);
+ }
+ }
+
+ $blocks['main']['options']['refresh_interval'] = array(
+ 'title' => html::label($field_id, Q(rcube_label('refreshinterval'))),
+ 'content' => $select_refresh_interval->show($config['refresh_interval']/60),
+ );
+ }
+
// show drop-down for available skins
if (!isset($no_override['skin'])) {
$skins = rcmail_get_skins();
@@ -375,23 +388,6 @@ function rcmail_user_prefs($current=null)
'content' => $input_pagesize->show($size ? $size : 50),
);
}
-
- if (!isset($no_override['keep_alive'])) {
- $field_id = 'rcmfd_keep_alive';
- $select_keep_alive = new html_select(array('name' => '_keep_alive', 'id' => $field_id));
-
- foreach(array(1, 3, 5, 10, 15, 30, 60) as $min)
- if((!$config['min_keep_alive'] || $config['min_keep_alive'] <= $min * 60)
- && (!$config['session_lifetime'] || $config['session_lifetime'] > $min)) {
- $select_keep_alive->add(rcube_label(array('name' => 'everynminutes', 'vars' => array('n' => $min))), $min);
- }
-
- $blocks['new_message']['options']['keep_alive'] = array(
- 'title' => html::label($field_id, Q(rcube_label('keepalive'))),
- 'content' => $select_keep_alive->show($config['keep_alive']/60),
- );
- }
-
if (!isset($no_override['check_all_folders'])) {
$field_id = 'rcmfd_check_all_folders';
$input_check_all = new html_checkbox(array('name' => '_check_all_folders', 'id' => $field_id, 'value' => 1));
@@ -699,7 +695,7 @@ function rcmail_user_prefs($current=null)
);
if (!isset($no_override['default_addressbook'])
- && ($books = $RCMAIL->get_address_sources(true))
+ && ($books = $RCMAIL->get_address_sources(true, true))
) {
$field_id = 'rcmfd_default_addressbook';
$select_abook = new html_select(array('name' => '_default_addressbook', 'id' => $field_id));
@@ -709,7 +705,7 @@ function rcmail_user_prefs($current=null)
}
$blocks['main']['options']['default_addressbook'] = array(
- 'title' => html::label($field_id, Q(rcube_label('defaultaddressbook'))),
+ 'title' => html::label($field_id, Q(rcube_label('defaultabook'))),
'content' => $select_abook->show($config['default_addressbook']),
);
}
diff --git a/program/steps/settings/identities.inc b/program/steps/settings/identities.inc
index 26bd432c2..82a1841a3 100644
--- a/program/steps/settings/identities.inc
+++ b/program/steps/settings/identities.inc
@@ -33,11 +33,7 @@ function rcmail_identity_frame($attrib)
if (!$attrib['id'])
$attrib['id'] = 'rcmIdentityFrame';
- $attrib['name'] = $attrib['id'];
-
- $OUTPUT->set_env('contentframe', $attrib['name']);
-
- return html::iframe($attrib);
+ return $OUTPUT->frame($attrib, true);
}
$OUTPUT->add_handler('identityframe', 'rcmail_identity_frame');
diff --git a/program/steps/settings/save_identity.inc b/program/steps/settings/save_identity.inc
index c3b8cc4a7..88adc795e 100644
--- a/program/steps/settings/save_identity.inc
+++ b/program/steps/settings/save_identity.inc
@@ -116,8 +116,9 @@ if ($_POST['_iid'])
// insert a new identity record
else if (IDENTITIES_LEVEL < 2)
{
- if (IDENTITIES_LEVEL == 1)
- $save_data['email'] = $RCMAIL->user->get_username();
+ if (IDENTITIES_LEVEL == 1) {
+ $save_data['email'] = $RCMAIL->get_user_email();
+ }
$plugin = $RCMAIL->plugins->exec_hook('identity_create', array('record' => $save_data));
$save_data = $plugin['record'];
diff --git a/program/steps/settings/save_prefs.inc b/program/steps/settings/save_prefs.inc
index db7b134c4..5daab0d24 100644
--- a/program/steps/settings/save_prefs.inc
+++ b/program/steps/settings/save_prefs.inc
@@ -33,7 +33,8 @@ switch ($CURR_SECTION)
'date_format' => isset($_POST['_date_format']) ? get_input_value('_date_format', RCUBE_INPUT_POST) : $CONFIG['date_format'],
'time_format' => isset($_POST['_time_format']) ? get_input_value('_time_format', RCUBE_INPUT_POST) : ($CONFIG['time_format'] ? $CONFIG['time_format'] : 'H:i'),
'prettydate' => isset($_POST['_pretty_date']) ? TRUE : FALSE,
- 'skin' => isset($_POST['_skin']) ? get_input_value('_skin', RCUBE_INPUT_POST) : $CONFIG['skin'],
+ 'refresh_interval' => isset($_POST['_refresh_interval']) ? intval($_POST['_refresh_interval'])*60 : $CONFIG['refresh_interval'],
+ 'skin' => isset($_POST['_skin']) ? get_input_value('_skin', RCUBE_INPUT_POST) : $CONFIG['skin'],
);
// compose derived date/time format strings
@@ -50,7 +51,6 @@ switch ($CURR_SECTION)
'preview_pane_mark_read' => isset($_POST['_preview_pane_mark_read']) ? intval($_POST['_preview_pane_mark_read']) : $CONFIG['preview_pane_mark_read'],
'autoexpand_threads' => isset($_POST['_autoexpand_threads']) ? intval($_POST['_autoexpand_threads']) : 0,
'mdn_requests' => isset($_POST['_mdn_requests']) ? intval($_POST['_mdn_requests']) : 0,
- 'keep_alive' => isset($_POST['_keep_alive']) ? intval($_POST['_keep_alive'])*60 : $CONFIG['keep_alive'],
'check_all_folders' => isset($_POST['_check_all_folders']) ? TRUE : FALSE,
'mail_pagesize' => is_numeric($_POST['_mail_pagesize']) ? max(2, intval($_POST['_mail_pagesize'])) : $CONFIG['mail_pagesize'],
);
@@ -157,16 +157,16 @@ switch ($CURR_SECTION)
$a_user_prefs['timezone'] = (string) $a_user_prefs['timezone'];
- break;
- case 'mailbox':
-
- // force keep_alive
- if (isset($a_user_prefs['keep_alive'])) {
- $a_user_prefs['keep_alive'] = max(60, $CONFIG['min_keep_alive'], $a_user_prefs['keep_alive']);
- if (!empty($CONFIG['session_lifetime']))
- $a_user_prefs['keep_alive'] = min($CONFIG['session_lifetime']*60, $a_user_prefs['keep_alive']);
+ if (isset($a_user_prefs['refresh_interval']) && !empty($CONFIG['min_refresh_interval'])) {
+ if ($a_user_prefs['refresh_interval'] > $CONFIG['min_refresh_interval']) {
+ $a_user_prefs['refresh_interval'] = $CONFIG['min_refresh_interval'];
+ }
}
+ break;
+
+ case 'mailbox':
+
// force min size
if ($a_user_prefs['mail_pagesize'] < 1)
$a_user_prefs['mail_pagesize'] = 10;
@@ -174,7 +174,8 @@ switch ($CURR_SECTION)
if (isset($CONFIG['max_pagesize']) && ($a_user_prefs['mail_pagesize'] > $CONFIG['max_pagesize']))
$a_user_prefs['mail_pagesize'] = (int) $CONFIG['max_pagesize'];
- break;
+ break;
+
case 'addressbook':
// force min size
@@ -184,7 +185,8 @@ switch ($CURR_SECTION)
if (isset($CONFIG['max_pagesize']) && ($a_user_prefs['addressbook_pagesize'] > $CONFIG['max_pagesize']))
$a_user_prefs['addressbook_pagesize'] = (int) $CONFIG['max_pagesize'];
- break;
+ break;
+
case 'folders':
// special handling for 'default_folders'
@@ -199,7 +201,7 @@ switch ($CURR_SECTION)
}
}
- break;
+ break;
}
// Save preferences
diff --git a/program/steps/utils/html2text.inc b/program/steps/utils/html2text.inc
index 67e76c1a7..e17665fec 100644
--- a/program/steps/utils/html2text.inc
+++ b/program/steps/utils/html2text.inc
@@ -5,7 +5,7 @@
| program/steps/utils/html2text.inc |
| |
| This file is part of the Roundcube Webmail client |
- | Copyright (C) 2005-2010, The Roundcube Dev Team |
+ | Copyright (C) 2005-2012, The Roundcube Dev Team |
| |
| Licensed under the GNU General Public License version 3 or |
| any later version with exceptions for skins & plugins. |
@@ -24,7 +24,7 @@ $html = $HTTP_RAW_POST_DATA;
// Replace emoticon images with its text representation
$html = rcmail_replace_emoticons($html);
-$converter = new html2text($html);
+$converter = new html2text($html, false, true, 0);
header('Content-Type: text/plain; charset=UTF-8');
print rtrim($converter->get_text());