summaryrefslogtreecommitdiff
path: root/program/steps
diff options
context:
space:
mode:
Diffstat (limited to 'program/steps')
-rw-r--r--program/steps/addressbook/export.inc10
-rw-r--r--program/steps/addressbook/func.inc75
-rw-r--r--program/steps/addressbook/print.inc138
-rw-r--r--program/steps/addressbook/save.inc14
-rw-r--r--program/steps/addressbook/show.inc15
-rw-r--r--program/steps/mail/compose.inc55
-rw-r--r--program/steps/mail/func.inc2
-rw-r--r--program/steps/mail/get.inc24
-rw-r--r--program/steps/mail/sendmail.inc35
-rw-r--r--program/steps/settings/edit_identity.inc5
-rw-r--r--program/steps/settings/save_identity.inc5
11 files changed, 300 insertions, 78 deletions
diff --git a/program/steps/addressbook/export.inc b/program/steps/addressbook/export.inc
index a6d3af978..c2f22cbe2 100644
--- a/program/steps/addressbook/export.inc
+++ b/program/steps/addressbook/export.inc
@@ -133,8 +133,14 @@ function prepare_for_export(&$record, $source = null)
foreach ($record as $key => $values) {
list($field, $section) = explode(':', $key);
- foreach ((array)$values as $value) {
- if (is_array($value) || @strlen($value)) {
+ // avoid unwanted casting of DateTime objects to an array
+ // (same as in rcube_contacts::convert_save_data())
+ if (is_object($values) && is_a($values, 'DateTime')) {
+ $values = array($values);
+ }
+
+ foreach ((array) $values as $value) {
+ if (is_array($value) || is_a($value, 'DateTime') || @strlen($value)) {
$vcard->set($field, $value, strtoupper($section));
}
}
diff --git a/program/steps/addressbook/func.inc b/program/steps/addressbook/func.inc
index c40b517dc..594c2a695 100644
--- a/program/steps/addressbook/func.inc
+++ b/program/steps/addressbook/func.inc
@@ -518,12 +518,13 @@ function rcmail_contact_form($form, $record, $attrib = null)
$plugin = $RCMAIL->plugins->exec_hook('contact_form', array(
'form' => $form, 'record' => $record));
- $form = $plugin['form'];
- $record = $plugin['record'];
- $edit_mode = $RCMAIL->action != 'show';
+ $form = $plugin['form'];
+ $record = $plugin['record'];
+ $edit_mode = $RCMAIL->action != 'show' && $RCMAIL->action != 'print';
$del_button = $attrib['deleteicon'] ? html::img(array('src' => $RCMAIL->output->get_skin_file($attrib['deleteicon']), 'alt' => $RCMAIL->gettext('delete'))) : $RCMAIL->gettext('delete');
+ $out = '';
+
unset($attrib['deleteicon']);
- $out = '';
// get default coltypes
$coltypes = $GLOBALS['CONTACT_COLTYPES'];
@@ -544,8 +545,9 @@ function rcmail_contact_form($form, $record, $attrib = null)
foreach ($form as $section => $fieldset) {
// skip empty sections
- if (empty($fieldset['content']))
+ if (empty($fieldset['content'])) {
continue;
+ }
$select_add = new html_select(array('class' => 'addfieldmenu', 'rel' => $section));
$select_add->add($RCMAIL->gettext('addfield'), '');
@@ -555,18 +557,20 @@ function rcmail_contact_form($form, $record, $attrib = null)
$content = '';
// unset display name if it is composed from name parts
- if ($record['name'] == rcube_addressbook::compose_display_name(array('name' => '') + (array)$record))
- unset($record['name']);
+ if ($record['name'] == rcube_addressbook::compose_display_name(array('name' => '') + (array)$record)) {
+ unset($record['name']);
+ }
// group fields
$field_blocks = array(
- 'names' => array('prefix','firstname','middlename','surname','suffix'),
- 'displayname' => array('name'),
- 'nickname' => array('nickname'),
+ 'names' => array('prefix','firstname','middlename','surname','suffix'),
+ 'displayname' => array('name'),
+ 'nickname' => array('nickname'),
'organization' => array('organization'),
- 'department' => array('department'),
- 'jobtitle' => array('jobtitle'),
+ 'department' => array('department'),
+ 'jobtitle' => array('jobtitle'),
);
+
foreach ($field_blocks as $blockname => $colnames) {
$fields = '';
foreach ($colnames as $col) {
@@ -574,11 +578,16 @@ function rcmail_contact_form($form, $record, $attrib = null)
if (!$coltypes[$col])
continue;
+ // skip cols not listed in the form definition
+ if (is_array($fieldset['content']) && !in_array($col, array_keys($fieldset['content']))) {
+ continue;
+ }
+
// only string values are expected here
if (is_array($record[$col]))
$record[$col] = join(' ', $record[$col]);
- if ($RCMAIL->action == 'show') {
+ if (!$edit_mode) {
if (!empty($record[$col]))
$fields .= html::span('namefield ' . $col, rcube::Q($record[$col])) . " ";
}
@@ -611,11 +620,15 @@ function rcmail_contact_form($form, $record, $attrib = null)
$fullkey = $col.':'.$subtype;
// skip cols unknown to the backend
- if (!$coltypes[$field])
+ if (!$coltypes[$field] && empty($colprop['value'])) {
continue;
+ }
// merge colprop with global coltype configuration
- $colprop += $coltypes[$field];
+ if ($coltypes[$field]) {
+ $colprop += $coltypes[$field];
+ }
+
$label = isset($colprop['label']) ? $colprop['label'] : $RCMAIL->gettext($col);
// prepare subtype selector in edit mode
@@ -624,8 +637,9 @@ function rcmail_contact_form($form, $record, $attrib = null)
$select_subtype = new html_select(array('name' => '_subtype_'.$col.'[]', 'class' => 'contactselectsubtype', 'title' => $colprop['label'] . ' ' . $RCMAIL->gettext('type')));
$select_subtype->add($subtype_names, $colprop['subtypes']);
}
- else
+ else {
$select_subtype = null;
+ }
if (!empty($colprop['value'])) {
$values = (array)$colprop['value'];
@@ -729,12 +743,21 @@ function rcmail_contact_form($form, $record, $attrib = null)
// display row with label
if ($label) {
+ if ($RCMAIL->action == 'print') {
+ $_label = rcube::Q($colprop['label'] . ($label != $colprop['label'] ? ' (' . $label . ')' : ''));
+ }
+ else {
+ $_label = $select_subtype ? $select_subtype->show($subtype) : html::label($colprop['id'], rcube::Q($label));
+ }
+
$rows .= html::div('row',
- html::div('contactfieldlabel label', $select_subtype ? $select_subtype->show($subtype) : html::label($colprop['id'], rcube::Q($label))) .
+ html::div('contactfieldlabel label', $_label) .
html::div('contactfieldcontent '.$colprop['type'], $val));
}
- else // row without label
+ // row without label
+ else {
$rows .= html::div('row', html::div('contactfield', $val));
+ }
}
// add option to the add-field menu
@@ -745,9 +768,13 @@ function rcmail_contact_form($form, $record, $attrib = null)
// wrap rows in fieldgroup container
if ($rows) {
- $content .= html::tag('fieldset', array('class' => 'contactfieldgroup ' . ($colprop['subtypes'] ? 'contactfieldgroupmulti ' : '') . 'contactcontroller' . $col, 'style' => ($rows ? null : 'display:none')),
- ($colprop['subtypes'] ? html::tag('legend', null, rcube::Q($colprop['label'])) : ' ') .
- $rows);
+ $c_class = 'contactfieldgroup ' . ($colprop['subtypes'] ? 'contactfieldgroupmulti ' : '') . 'contactcontroller' . $col;
+ $with_label = $colprop['subtypes'] && $RCMAIL->action != 'print';
+ $content .= html::tag(
+ 'fieldset',
+ array('class' => $c_class, 'style' => ($rows ? null : 'display:none')),
+ ($with_label ? html::tag('legend', null, rcube::Q($colprop['label'])) : ' ') . $rows
+ );
}
}
@@ -769,9 +796,9 @@ function rcmail_contact_form($form, $record, $attrib = null)
}
if ($edit_mode) {
- $RCMAIL->output->set_env('coltypes', $coltypes + $coltype_labels);
- $RCMAIL->output->set_env('delbutton', $del_button);
- $RCMAIL->output->add_label('delete');
+ $RCMAIL->output->set_env('coltypes', $coltypes + $coltype_labels);
+ $RCMAIL->output->set_env('delbutton', $del_button);
+ $RCMAIL->output->add_label('delete');
}
return $out;
diff --git a/program/steps/addressbook/print.inc b/program/steps/addressbook/print.inc
new file mode 100644
index 000000000..c9460d44f
--- /dev/null
+++ b/program/steps/addressbook/print.inc
@@ -0,0 +1,138 @@
+<?php
+
+/*
+ +-----------------------------------------------------------------------+
+ | program/steps/addressbook/print.inc |
+ | |
+ | This file is part of the Roundcube Webmail client |
+ | Copyright (C) 2005-2015, The Roundcube Dev Team |
+ | Copyright (C) 2011-2015, Kolab Systems AG |
+ | |
+ | Licensed under the GNU General Public License version 3 or |
+ | any later version with exceptions for skins & plugins. |
+ | See the README file for a full license statement. |
+ | |
+ | PURPOSE: |
+ | Print contact details |
+ | |
+ +-----------------------------------------------------------------------+
+ | Author: Thomas Bruederli <roundcube@gmail.com> |
+ | Author: Aleksander Machniak <machniak@kolabsys.com> |
+ +-----------------------------------------------------------------------+
+*/
+
+// Get contact ID and source ID from request
+$cids = rcmail_get_cids();
+$source = key($cids);
+$cid = $cids ? array_shift($cids[$source]) : null;
+
+// Initialize addressbook source
+$CONTACTS = rcmail_contact_source($source, true);
+$SOURCE_ID = $source;
+
+// read contact record
+if ($cid && $CONTACTS) {
+ $record = $CONTACTS->get_record($cid, true);
+}
+
+$OUTPUT->add_handlers(array(
+ 'contacthead' => 'rcmail_contact_head',
+ 'contactdetails' => 'rcmail_contact_details',
+ 'contactphoto' => 'rcmail_contact_photo',
+));
+
+$OUTPUT->send('contactprint');
+
+
+
+function rcmail_contact_head($attrib)
+{
+ global $CONTACTS, $RCMAIL;
+
+ // check if we have a valid result
+ if (!(($result = $CONTACTS->get_result()) && ($record = $result->first()))) {
+ $RCMAIL->output->show_message('contactnotfound', 'error');
+ return false;
+ }
+
+ $form = array(
+ 'head' => array( // section 'head' is magic!
+ 'name' => $RCMAIL->gettext('contactnameandorg'),
+ 'content' => array(
+ 'prefix' => array(),
+ 'name' => array(),
+ 'firstname' => array(),
+ 'middlename' => array(),
+ 'surname' => array(),
+ 'suffix' => array(),
+ ),
+ ),
+ );
+
+ unset($attrib['name']);
+ return rcmail_contact_form($form, $record, $attrib);
+}
+
+
+function rcmail_contact_details($attrib)
+{
+ global $CONTACTS, $RCMAIL, $CONTACT_COLTYPES;
+
+ // check if we have a valid result
+ if (!(($result = $CONTACTS->get_result()) && ($record = $result->first()))) {
+ return false;
+ }
+
+ $i_size = !empty($attrib['size']) ? $attrib['size'] : 40;
+
+ $form = array(
+ 'contact' => array(
+ 'name' => $RCMAIL->gettext('properties'),
+ 'content' => array(
+ 'organization' => array(),
+ 'department' => array(),
+ 'jobtitle' => array(),
+ 'email' => array(),
+ 'phone' => array(),
+ 'address' => array(),
+ 'website' => array(),
+ 'im' => array(),
+ 'groups' => array('value' => 'sdfsdfs', 'label' => $RCMAIL->gettext('groups')),
+ ),
+ ),
+ 'personal' => array(
+ 'name' => $RCMAIL->gettext('personalinfo'),
+ 'content' => array(
+ 'nickname' => array(),
+ 'gender' => array(),
+ 'maidenname' => array(),
+ 'birthday' => array(),
+ 'anniversary' => array(),
+ 'manager' => array(),
+ 'assistant' => array(),
+ 'spouse' => array(),
+ ),
+ ),
+ );
+
+ if (isset($CONTACT_COLTYPES['notes'])) {
+ $form['notes'] = array(
+ 'name' => $RCMAIL->gettext('notes'),
+ 'content' => array(
+ 'notes' => array('type' => 'textarea', 'label' => false),
+ ),
+ );
+ }
+
+ if ($CONTACTS->groups) {
+ $groups = $CONTACTS->get_record_groups($record['ID']);
+ if (!empty($groups)) {
+ $form['contact']['content']['groups'] = array(
+ 'value' => rcube::Q(implode(', ', $groups)),
+ 'label' => $RCMAIL->gettext('groups')
+ );
+ }
+ }
+
+ return rcmail_contact_form($form, $record);
+}
diff --git a/program/steps/addressbook/save.inc b/program/steps/addressbook/save.inc
index 4f30fd4b7..518625cb5 100644
--- a/program/steps/addressbook/save.inc
+++ b/program/steps/addressbook/save.inc
@@ -226,13 +226,15 @@ else {
$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)) && ($counts->count + 1 > $maxnum))
- $OUTPUT->show_message('maxgroupmembersreached', 'warning', array('max' => $maxnum));
-
- $CONTACTS->add_to_group($plugin['group_id'], $plugin['ids']);
+ if (($maxnum = $RCMAIL->config->get('max_group_members', 0)) && ($CONTACTS->count()->count + 1 > $maxnum)) {
+ // @FIXME: should we remove the contact?
+ $msgtext = $RCMAIL->gettext(array('name' => 'maxgroupmembersreached', 'vars' => array('max' => $maxnum)));
+ $OUTPUT->command('parent.display_message', $msgtext, 'warning');
+ }
+ else {
+ $CONTACTS->add_to_group($plugin['group_id'], $plugin['ids']);
+ }
}
}
diff --git a/program/steps/addressbook/show.inc b/program/steps/addressbook/show.inc
index 5835ce7e5..d1bc8594d 100644
--- a/program/steps/addressbook/show.inc
+++ b/program/steps/addressbook/show.inc
@@ -66,11 +66,16 @@ function rcmail_contact_head($attrib)
'head' => array( // section 'head' is magic!
'name' => $RCMAIL->gettext('contactnameandorg'),
'content' => array(
- 'prefix' => array('type' => 'text'),
- 'firstname' => array('type' => 'text'),
- 'middlename' => array('type' => 'text'),
- 'surname' => array('type' => 'text'),
- 'suffix' => array('type' => 'text'),
+ 'prefix' => array('type' => 'text'),
+ 'firstname' => array('type' => 'text'),
+ 'middlename' => array('type' => 'text'),
+ 'surname' => array('type' => 'text'),
+ 'suffix' => array('type' => 'text'),
+ 'name' => array('type' => 'text'),
+ 'nickname' => array('type' => 'text'),
+ 'organization' => array('type' => 'text'),
+ 'department' => array('type' => 'text'),
+ 'jobtitle' => array('type' => 'text'),
),
),
);
diff --git a/program/steps/mail/compose.inc b/program/steps/mail/compose.inc
index 92296e525..db4efc7ce 100644
--- a/program/steps/mail/compose.inc
+++ b/program/steps/mail/compose.inc
@@ -53,13 +53,14 @@ if (!is_array($COMPOSE)) {
}
$COMPOSE_ID = uniqid(mt_rand());
+ $params = rcube_utils::request2param(rcube_utils::INPUT_GET, 'task|action', true);
+
$_SESSION['compose_data_'.$COMPOSE_ID] = array(
'id' => $COMPOSE_ID,
- 'param' => rcube_utils::request2param(rcube_utils::INPUT_GET, 'task|action', true),
- 'mailbox' => $RCMAIL->storage->get_folder(),
+ 'param' => $params,
+ 'mailbox' => $params['mbox'] ?: $RCMAIL->storage->get_folder(),
);
$COMPOSE =& $_SESSION['compose_data_'.$COMPOSE_ID];
-
rcmail_process_compose_params($COMPOSE);
// check if folder for saving sent messages exists and is subscribed (#1486802)
@@ -322,13 +323,18 @@ foreach ($parts as $header) {
$fvalue = $mailfollowup;
else if ($mailreplyto)
$fvalue = $mailreplyto;
- else if (!empty($MESSAGE->headers->replyto))
- $fvalue = $MESSAGE->headers->replyto;
+ else if (!empty($MESSAGE->headers->replyto)) {
+ $fvalue = $MESSAGE->headers->replyto;
+ $replyto = true;
+ }
else if (!empty($MESSAGE->headers->from))
$fvalue = $MESSAGE->headers->from;
// Reply to message sent by yourself (#1487074, #1489230)
- if (!empty($ident) && in_array($ident['ident'], array($fvalue, $MESSAGE->headers->from))) {
+ // Reply-To address need to be unset (#1490233)
+ if (!empty($ident) && empty($replyto)
+ && in_array($ident['ident'], array($fvalue, $MESSAGE->headers->from))
+ ) {
$fvalue = $MESSAGE->headers->to;
}
}
@@ -419,7 +425,8 @@ $OUTPUT->add_handlers(array(
'filedroparea' => 'compose_file_drop_area',
'priorityselector' => 'rcmail_priority_selector',
'editorselector' => 'rcmail_editor_selector',
- 'receiptcheckbox' => 'rcmail_receipt_checkbox',
+ 'receiptcheckbox' => 'rcmail_mdn_checkbox', // deprecated
+ 'mdncheckbox' => 'rcmail_mdn_checkbox',
'dsncheckbox' => 'rcmail_dsn_checkbox',
'storetarget' => 'rcmail_store_target_selection',
'addressbooks' => 'rcmail_addressbook_list',
@@ -780,12 +787,13 @@ function rcmail_prepare_message_body()
unset($plugin);
// add blocked.gif attachment (#1486516)
- if ($isHtml && preg_match('#<img src="\./program/resources/blocked\.gif"#', $body)) {
- if ($attachment = rcmail_save_image('program/resources/blocked.gif', 'image/gif')) {
+ if ($isHtml && preg_match('#<img src="program/resources/blocked\.gif"#', $body)) {
+ $content = $RCMAIL->get_resource_content('blocked.gif');
+ if ($content && ($attachment = rcmail_save_image('blocked.gif', 'image/gif', $content))) {
$COMPOSE['attachments'][$attachment['id']] = $attachment;
$url = sprintf('%s&_id=%s&_action=display-attachment&_file=rcmfile%s',
$RCMAIL->comm_path, $COMPOSE['id'], $attachment['id']);
- $body = preg_replace('#\./program/resources/blocked\.gif#', $url, $body);
+ $body = preg_replace('#program/resources/blocked\.gif#', $url, $body);
}
}
@@ -1399,18 +1407,31 @@ function rcmail_save_attachment(&$message, $pid)
return false;
}
-function rcmail_save_image($path, $mimetype='')
+function rcmail_save_image($path, $mimetype = '', $data = null)
{
global $COMPOSE;
// handle attachments in memory
- $data = file_get_contents($path);
+ if (empty($data)) {
+ $data = file_get_contents($path);
+ $is_file = true;
+ }
+
$name = rcmail_basename($path);
+ if (empty($mimetype)) {
+ if ($is_file) {
+ $mimetype = rcube_mime::file_content_type($path, $name);
+ }
+ else {
+ $mimetype = rcube_mime::file_content_type($data, $name, 'application/octet-stream', true);
+ }
+ }
+
$attachment = array(
'group' => $COMPOSE['id'],
'name' => $name,
- 'mimetype' => $mimetype ? $mimetype : rcube_mime::file_content_type($path, $name),
+ 'mimetype' => $mimetype,
'data' => $data,
'size' => strlen($data),
);
@@ -1642,7 +1663,7 @@ function rcmail_priority_selector($attrib)
}
-function rcmail_receipt_checkbox($attrib)
+function rcmail_mdn_checkbox($attrib)
{
global $RCMAIL, $MESSAGE, $compose_mode;
@@ -1652,13 +1673,13 @@ function rcmail_receipt_checkbox($attrib)
if (!isset($attrib['id']))
$attrib['id'] = 'receipt';
- $attrib['name'] = '_receipt';
+ $attrib['name'] = '_mdn';
$attrib['value'] = '1';
$checkbox = new html_checkbox($attrib);
- if (isset($_POST['_receipt']))
- $mdn_default = $_POST['_receipt'];
+ if (isset($_POST['_mdn']))
+ $mdn_default = $_POST['_mdn'];
else if (in_array($compose_mode, array(RCUBE_COMPOSE_DRAFT, RCUBE_COMPOSE_EDIT)))
$mdn_default = (bool) $MESSAGE->headers->mdn_to;
else
diff --git a/program/steps/mail/func.inc b/program/steps/mail/func.inc
index 6423636f0..48d989954 100644
--- a/program/steps/mail/func.inc
+++ b/program/steps/mail/func.inc
@@ -815,7 +815,7 @@ function rcmail_wash_html($html, $p, $cid_replaces)
$wash_opts = array(
'show_washed' => false,
'allow_remote' => $p['safe'],
- 'blocked_src' => "./program/resources/blocked.gif",
+ 'blocked_src' => 'program/resources/blocked.gif',
'charset' => RCUBE_CHARSET,
'cid_map' => $cid_replaces,
'html_elements' => array('body'),
diff --git a/program/steps/mail/get.inc b/program/steps/mail/get.inc
index 775349d1c..256af52b7 100644
--- a/program/steps/mail/get.inc
+++ b/program/steps/mail/get.inc
@@ -150,22 +150,22 @@ else if (strlen($part_id)) {
// accept text/plain with any extension
if ($real_mimetype == 'text/plain' && $real_mimetype == $mimetype) {
- $file_extension = 'txt';
+ $valid_extension = true;
}
-
// 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;
+ else if ($real_ctype_primary == 'text' && strpos($mimetype, $real_ctype_primary) === 0) {
+ $real_mimetype = $mimetype;
+ $valid_extension = true;
}
-
- // get valid file extensions
- $extensions = rcube_mime::get_mime_extensions($real_mimetype);
- $valid_extension = (!$file_extension || in_array($file_extension, (array)$extensions));
-
// ignore filename extension if mimeclass matches (#1489029)
- if (!empty($_REQUEST['_mimeclass']) && $real_ctype_primary == $_REQUEST['_mimeclass']) {
+ else if (!empty($_REQUEST['_mimeclass']) && $real_ctype_primary == $_REQUEST['_mimeclass']) {
$valid_extension = true;
}
+ else {
+ // 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) {
@@ -183,10 +183,12 @@ else if (strlen($part_id)) {
// send blocked.gif for expected images
if (empty($_REQUEST['_mimewarning']) && strpos($mimetype, 'image/') === 0) {
// Do not cache. Failure might be the result of a misconfiguration, thus real content should be returned once fixed.
+ $content = $RCMAIL->get_resource_content('blocked.gif');
$OUTPUT->nocacheing_headers();
header("Content-Type: image/gif");
header("Content-Transfer-Encoding: binary");
- readfile(INSTALL_PATH . 'program/resources/blocked.gif');
+ header("Content-Length: " . strlen($content));
+ echo $content;
}
else { // html warning with a button to load the file anyway
$OUTPUT = new rcmail_html_page();
diff --git a/program/steps/mail/sendmail.inc b/program/steps/mail/sendmail.inc
index c55e40064..5843de43f 100644
--- a/program/steps/mail/sendmail.inc
+++ b/program/steps/mail/sendmail.inc
@@ -144,7 +144,7 @@ if ($RCMAIL->config->get('http_received_header')) {
$http_header .= $nldlm . ' via ';
}
- $host = $_SERVER['REMOTE_ADDR'];
+ $host = $_SERVER['REMOTE_ADDR'];
$hostname = gethostbyaddr($host);
if ($encrypt) {
@@ -171,7 +171,7 @@ if ($RCMAIL->config->get('http_received_header')) {
$headers['Date'] = $RCMAIL->user_date();
$headers['From'] = rcube_charset::convert($from_string, RCUBE_CHARSET, $message_charset);
-$headers['To'] = $mailto;
+$headers['To'] = $mailto;
// additional recipients
if (!empty($mailcc)) {
@@ -188,6 +188,10 @@ if (($max_recipients = (int) $RCMAIL->config->get('max_recipients')) > 0) {
}
}
+$dont_override = (array) $RCMAIL->config->get('dont_override');
+$mdn_enabled = in_array('mdn_default', $dont_override) ? $RCMAIL->config->get('mdn_default') : !empty($_POST['_mdn']);
+$dsn_enabled = in_array('dsn_default', $dont_override) ? $RCMAIL->config->get('dsn_default') : !empty($_POST['_dsn']);
+
// add subject
$headers['Subject'] = trim(rcube_utils::get_input_value('_subject', rcube_utils::INPUT_POST, TRUE, $message_charset));
@@ -228,7 +232,7 @@ if (!empty($_POST['_priority'])) {
}
}
-if (!empty($_POST['_receipt'])) {
+if ($mdn_enabled) {
$headers['Return-Receipt-To'] = $from_string;
$headers['Disposition-Notification-To'] = $from_string;
}
@@ -520,9 +524,7 @@ if (!$savedraft) {
}
// Handle Delivery Status Notification request
- if (!empty($_POST['_dsn'])) {
- $smtp_opts['dsn'] = true;
- }
+ $smtp_opts['dsn'] = $dsn_enabled;
$sent = $RCMAIL->deliver_message($MAIL_MIME, $from, $mailto,
$smtp_error, $mailbody_file, $smtp_opts);
@@ -682,11 +684,16 @@ if ($savedraft) {
$OUTPUT->command('auto_save_start');
}
else {
+ // Collect folders which could contain the composed message,
+ // we'll refresh the list if currently opened folder is one of them (#1490238)
$folders = array();
- if ($COMPOSE['mode'] == 'reply' || $COMPOSE['mode'] == 'forward') {
+ if (in_array($COMPOSE['mode'], array('reply', 'forward', 'draft'))) {
$folders[] = $COMPOSE['mailbox'];
}
+ if (!empty($COMPOSE['param']['draft_uid']) && $drafts_mbox) {
+ $folders[] = $drafts_mbox;
+ }
rcmail_compose_cleanup($COMPOSE_ID);
$OUTPUT->command('remove_compose_data', $COMPOSE_ID);
@@ -758,8 +765,10 @@ function rcmail_fix_emoticon_paths($mime_message)
// remove any null-byte characters before parsing
$body = preg_replace('/\x00/', '', $body);
- $searchstr = 'program/js/tinymce/plugins/emoticons/img/';
- $offset = 0;
+ $searchstr = 'program/js/tinymce/plugins/emoticons/img/';
+ $assets_dir = $RCMAIL->config->get('assets_dir');
+ $path = ($assets_dir ?: INSTALL_PATH) . '/' . $searchstr;
+ $offset = 0;
// keep track of added images, so they're only added once
$included_images = array();
@@ -772,12 +781,14 @@ function rcmail_fix_emoticon_paths($mime_message)
// sanitize image name so resulting attachment doesn't leave images dir
$image_name = preg_replace('/[^a-zA-Z0-9_\.\-]/i', '', $image_name);
- $img_file = INSTALL_PATH . '/' . $searchstr . $image_name;
+ $img_file = $path . $image_name;
- if (! in_array($image_name, $included_images)) {
+ if (!in_array($image_name, $included_images)) {
// add the image to the MIME message
- if (!$mime_message->addHTMLImage($img_file, 'image/gif', '', true, $image_name)) {
+ $res = $mime_message->addHTMLImage($img_file, 'image/gif', '', true, $image_name);
+ if (PEAR::isError($res)) {
$RCMAIL->output->show_message("emoticonerror", 'error');
+ continue;
}
array_push($included_images, $image_name);
diff --git a/program/steps/settings/edit_identity.inc b/program/steps/settings/edit_identity.inc
index cd7ba5fa6..298822d66 100644
--- a/program/steps/settings/edit_identity.inc
+++ b/program/steps/settings/edit_identity.inc
@@ -109,6 +109,11 @@ function rcube_identity_form($attrib)
$IDENTITY_RECORD['signature'] = htmlspecialchars($IDENTITY_RECORD['signature'], ENT_NOQUOTES, RCUBE_CHARSET);
}
+ // hide "default" checkbox if only one identity is allowed
+ if (IDENTITIES_LEVEL > 1) {
+ unset($form['addressing']['content']['standard']);
+ }
+
// disable some field according to access level
if (IDENTITIES_LEVEL == 1 || IDENTITIES_LEVEL == 3) {
$form['addressing']['content']['email']['disabled'] = true;
diff --git a/program/steps/settings/save_identity.inc b/program/steps/settings/save_identity.inc
index de0c84c91..ac7ef8708 100644
--- a/program/steps/settings/save_identity.inc
+++ b/program/steps/settings/save_identity.inc
@@ -49,6 +49,11 @@ foreach ($a_boolean_cols as $col) {
}
}
+// make the identity a "default" if only one identity is allowed
+if (IDENTITIES_LEVEL > 1) {
+ $save_data['standard'] = 1;
+}
+
// unset email address if user has no rights to change it
if (IDENTITIES_LEVEL == 1 || IDENTITIES_LEVEL == 3) {
unset($save_data['email']);