From bd82526e41e54fa001c851d48b4e7823aa5e7bcd Mon Sep 17 00:00:00 2001 From: Aleksander Machniak Date: Sun, 22 Feb 2015 10:43:48 +0100 Subject: Fix missing or not up-to-date CATEGORIES entry in vCard export (#1490277) --- program/steps/addressbook/export.inc | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) (limited to 'program/steps') diff --git a/program/steps/addressbook/export.inc b/program/steps/addressbook/export.inc index c2f22cbe2..9fbdb9663 100644 --- a/program/steps/addressbook/export.inc +++ b/program/steps/addressbook/export.inc @@ -121,14 +121,11 @@ exit; */ function prepare_for_export(&$record, $source = null) { - $groups = $source && $source->groups && $source->export_groups ? $source->get_record_groups($record['ID']) : null; + $groups = $source && $source->groups && $source->export_groups ? $source->get_record_groups($record['ID']) : null; + $fieldmap = $source ? $source->vcard_map : null; if (empty($record['vcard'])) { - $vcard = new rcube_vcard(); - if ($source) { - $vcard->extend_fieldmap($source->vcard_map); - } - $vcard->load($record['vcard']); + $vcard = new rcube_vcard($record['vcard'], RCUBE_CHARSET, false, $fieldmap); $vcard->reset(); foreach ($record as $key => $values) { @@ -151,11 +148,19 @@ function prepare_for_export(&$record, $source = null) $vcard->set('groups', join(',', $groups), null); } - $record['vcard'] = $vcard->export(true); + $record['vcard'] = $vcard->export(); } // patch categories to alread existing vcard block - else if ($record['vcard'] && !empty($groups) && !strpos($record['vcard'], 'CATEGORIES:')) { - $vgroups = 'CATEGORIES:' . rcube_vcard::vcard_quote(join(',', $groups)); - $record['vcard'] = str_replace('END:VCARD', $vgroups . rcube_vcard::$eol . 'END:VCARD', $record['vcard']); + else if ($record['vcard']) { + $vcard = new rcube_vcard($record['vcard'], RCUBE_CHARSET, false, $fieldmap); + + // unset CATEGORIES entry, it might be not up-to-date (#1490277) + $vcard->set('groups', null); + $record['vcard'] = $vcard->export(); + + if (!empty($groups)) { + $vgroups = 'CATEGORIES:' . rcube_vcard::vcard_quote($groups, ','); + $record['vcard'] = str_replace('END:VCARD', $vgroups . rcube_vcard::$eol . 'END:VCARD', $record['vcard']); + } } } -- cgit v1.2.3 From 216b31dd99b54e7be3df8feebeafae72e423bb1c Mon Sep 17 00:00:00 2001 From: Aleksander Machniak Date: Wed, 25 Feb 2015 05:24:05 -0500 Subject: Fix so "over quota" errors are displayed also in message compose page This also fixes over quota responses on cyrus imap which uses "Over quota" string and no error identifier. --- CHANGELOG | 1 + program/include/rcmail.php | 17 +++++++++++++---- program/steps/mail/sendmail.inc | 5 +++-- 3 files changed, 17 insertions(+), 6 deletions(-) (limited to 'program/steps') diff --git a/CHANGELOG b/CHANGELOG index 064023187..9c6e2b99a 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -14,6 +14,7 @@ CHANGELOG Roundcube Webmail - Fix missing or not up-to-date CATEGORIES entry in vCard export (#1490277) - Fix fatal errors on systems without mbstring extension or mb_regex_encoding() function (#1490280) - Fix cursor position on reply below the quote in HTML mode (#1490263) +- Fix so "over quota" errors are displayed also in message compose page RELEASE 1.1.0 ------------- diff --git a/program/include/rcmail.php b/program/include/rcmail.php index 6e74560cb..2a154d9de 100644 --- a/program/include/rcmail.php +++ b/program/include/rcmail.php @@ -1793,8 +1793,9 @@ class rcmail extends rcube * @param string $fallback Fallback message label * @param array $fallback_args Fallback message label arguments * @param string $suffix Message label suffix + * @param array $params Additional parameters (type, prefix) */ - public function display_server_error($fallback = null, $fallback_args = null, $suffix = '') + public function display_server_error($fallback = null, $fallback_args = null, $suffix = '', $params = array()) { $err_code = $this->storage->get_error_code(); $res_code = $this->storage->get_response_code(); @@ -1815,8 +1816,8 @@ class rcmail extends rcube $error = 'errornoperm'; } // try to detect full mailbox problem and display appropriate message - // there can be e.g. "Quota exceeded" or "quotum would exceed" - else if (stripos($err_str, 'quot') !== false && stripos($err_str, 'exceed') !== false) { + // there can be e.g. "Quota exceeded" / "quotum would exceed" / "Over quota" + else if (stripos($err_str, 'quot') !== false && preg_match('/exceed|over/i', $err_str)) { $error = 'erroroverquota'; } else { @@ -1830,13 +1831,21 @@ class rcmail extends rcube else if ($fallback) { $error = $fallback; $args = $fallback_args; + $params['prefix'] = false; } if ($error) { if ($suffix && $this->text_exists($error . $suffix)) { $error .= $suffix; } - $this->output->show_message($error, 'error', $args); + + $msg = $this->gettext(array('name' => $error, 'vars' => $args)); + + if ($params['prefix'] && $fallback) { + $msg = $this->gettext(array('name' => $fallback, 'vars' => $fallback_args)) . ' ' . $msg; + } + + $this->output->show_message($msg, $params['type'] ?: 'error'); } } diff --git a/program/steps/mail/sendmail.inc b/program/steps/mail/sendmail.inc index 5843de43f..4f672ac8b 100644 --- a/program/steps/mail/sendmail.inc +++ b/program/steps/mail/sendmail.inc @@ -635,7 +635,8 @@ if ($store_target) { 'message' => "Could not save message in $store_target"), true, false); if ($savedraft) { - $OUTPUT->show_message('errorsaving', 'error'); + $RCMAIL->display_server_error('errorsaving'); + // start the auto-save timer again $OUTPUT->command('auto_save_start'); $OUTPUT->send('iframe'); @@ -699,7 +700,7 @@ else { $OUTPUT->command('remove_compose_data', $COMPOSE_ID); if ($store_folder && !$saved) { - $OUTPUT->command('sent_successfully', 'error', $RCMAIL->gettext('errorsavingsent'), $folders); + $RCMAIL->display_server_error('errorsavingsent', null, null, array('prefix' => true)); } else if ($store_folder) { $folders[] = $store_target; -- cgit v1.2.3 From c5c8e73351c38ece1b3814a8c82a0439e7424fc4 Mon Sep 17 00:00:00 2001 From: Aleksander Machniak Date: Wed, 25 Feb 2015 08:07:11 -0500 Subject: Improved handling of storage errors after message is sent After sending a message it is stored in Sent folder, this operation may fail, e.g. because of "over quota" error. In such a case we'll not close the compose window, but display the error and, if user clicks Send/Save button, we'll display a dialog informing about the situation and providing an option to try the save operation again. --- CHANGELOG | 1 + program/js/app.js | 45 +++++++++++++++++++++++++++------ program/localization/en_US/messages.inc | 1 + program/steps/mail/compose.inc | 3 ++- program/steps/mail/sendmail.inc | 39 ++++++++++++++++++---------- 5 files changed, 67 insertions(+), 22 deletions(-) (limited to 'program/steps') diff --git a/CHANGELOG b/CHANGELOG index 9c6e2b99a..8e31bc914 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -4,6 +4,7 @@ CHANGELOG Roundcube Webmail - Plugin API: Add special onload() method to execute plugin actions before startup (session and GUI initialization) - Add possibility to print contact information (of a single contact) - Add possibility to configure max_allowed_packet value for all database engines (#1490283) +- Improved handling of storage errors after message is sent - Fix refreshing of drafts list when sending a message which was saved in meantime (#1490238) - Fix saving/sending emoticon images when assets_dir is set - Fix PHP fatal error when visiting Vacation interface and there's no sieve script yet diff --git a/program/js/app.js b/program/js/app.js index e818955bd..56d07f37e 100644 --- a/program/js/app.js +++ b/program/js/app.js @@ -654,7 +654,7 @@ function rcube_webmail() // check input before leaving compose step if (this.task == 'mail' && this.env.action == 'compose' && $.inArray(command, this.env.compose_commands) < 0 && !this.env.server_error) { - if (this.cmp_hash != this.compose_field_hash() && !confirm(this.get_label('notsentwarning'))) + if (!this.env.is_sent && this.cmp_hash != this.compose_field_hash() && !confirm(this.get_label('notsentwarning'))) return false; // remove copy from local storage if compose screen is left intentionally @@ -1115,7 +1115,7 @@ function rcube_webmail() break; case 'send': - if (!props.nocheck && !this.check_compose_input(command)) + if (!props.nocheck && !this.env.is_sent && !this.check_compose_input(command)) break; // Reset the auto-save timer @@ -3489,15 +3489,35 @@ function rcube_webmail() .attr({ 'autocomplete': 'off', 'aria-autocomplete': 'list', 'aria-expanded': 'false', 'role': 'combobox' }); }; - this.submit_messageform = function(draft) + this.submit_messageform = function(draft, saveonly) { var form = this.gui_objects.messageform; if (!form) return; + // the message has been sent but not saved, ask the user what to do + if (!saveonly && this.env.is_sent) { + return this.show_popup_dialog(this.get_label('messageissent'), '', + [{ + text: this.get_label('save'), + 'class': 'mainaction', + click: function() { + ref.submit_messageform(false, true); + $(this).dialog('close'); + } + }, + { + text: this.get_label('cancel'), + click: function() { + $(this).dialog('close'); + } + }] + ); + } + // all checks passed, send message - var msgid = this.set_busy(true, draft ? 'savingmessage' : 'sendingmessage'), + var msgid = this.set_busy(true, draft || saveonly ? 'savingmessage' : 'sendingmessage'), lang = this.spellcheck_lang(), files = []; @@ -3511,6 +3531,10 @@ function rcube_webmail() form.action = this.add_url(form.action, '_lang', lang); form.action = this.add_url(form.action, '_framed', 1); + if (saveonly) { + form.action = this.add_url(form.action, '_saveonly', 1); + } + // register timer to notify about connection timeout this.submit_timer = setTimeout(function(){ ref.set_busy(false, null, msgid); @@ -4358,13 +4382,14 @@ function rcube_webmail() }; // action executed after mail is sent - this.sent_successfully = function(type, msg, folders) + this.sent_successfully = function(type, msg, folders, save_error) { this.display_message(msg, type); this.compose_skip_unsavedcheck = true; if (this.env.extwin) { - this.lock_form(this.gui_objects.messageform); + if (!save_error) + this.lock_form(this.gui_objects.messageform); var filter = {task: 'mail', action: ''}, rc = this.opener(false, filter) || this.opener(true, filter); @@ -4377,12 +4402,16 @@ function rcube_webmail() } } - setTimeout(function() { window.close(); }, 1000); + if (!save_error) + setTimeout(function() { window.close(); }, 1000); } - else { + else if (!save_error) { // before redirect we need to wait some time for Chrome (#1486177) setTimeout(function() { ref.list_mailbox(); }, 500); } + + if (save_error) + this.env.is_sent = true; }; diff --git a/program/localization/en_US/messages.inc b/program/localization/en_US/messages.inc index e5b368f22..e0de3654e 100644 --- a/program/localization/en_US/messages.inc +++ b/program/localization/en_US/messages.inc @@ -179,5 +179,6 @@ $messages['parentnotwritable'] = 'Unable to create/move folder into selected par $messages['messagetoobig'] = 'The message part is too big to process it.'; $messages['attachmentvalidationerror'] = 'WARNING! This attachment is suspicious because its type doesn\'t match the type declared in the message. If you do not trust the sender, you shouldn\'t open it in the browser because it may contain malicious contents.

Expected: $expected; found: $detected'; $messages['noscriptwarning'] = 'Warning: This webmail service requires Javascript! In order to use it please enable Javascript in your browser\'s settings.'; +$messages['messageissent'] = 'The message was already sent, but not saved yet. Do you want to save it now?'; ?> diff --git a/program/steps/mail/compose.inc b/program/steps/mail/compose.inc index db4efc7ce..4c3ecfbc0 100644 --- a/program/steps/mail/compose.inc +++ b/program/steps/mail/compose.inc @@ -83,7 +83,7 @@ $OUTPUT->add_label('nosubject', 'nosenderwarning', 'norecipientwarning', 'nosubj 'messagesaved', 'converting', 'editorwarning', 'searching', 'uploading', 'uploadingmany', 'fileuploaderror', 'sendmessage', 'newresponse', 'responsename', 'responsetext', 'save', 'savingresponse', 'restoresavedcomposedata', 'restoremessage', 'delete', 'restore', 'ignore', - 'selectimportfile'); + 'selectimportfile', 'messageissent'); $OUTPUT->set_pagetitle($RCMAIL->gettext('compose')); @@ -93,6 +93,7 @@ $OUTPUT->set_env('mailbox', $RCMAIL->storage->get_folder()); $OUTPUT->set_env('top_posting', intval($RCMAIL->config->get('reply_mode')) > 0); $OUTPUT->set_env('recipients_separator', trim($RCMAIL->config->get('recipients_separator', ','))); $OUTPUT->set_env('save_localstorage', (bool)$RCMAIL->config->get('compose_save_localstorage')); +$OUTPUT->set_env('is_sent', false); $drafts_mbox = $RCMAIL->config->get('drafts_mbox'); $config_show_sig = $RCMAIL->config->get('show_sig', 1); diff --git a/program/steps/mail/sendmail.inc b/program/steps/mail/sendmail.inc index 4f672ac8b..e90b0ef61 100644 --- a/program/steps/mail/sendmail.inc +++ b/program/steps/mail/sendmail.inc @@ -24,7 +24,8 @@ $OUTPUT->reset(); $OUTPUT->framed = TRUE; -$savedraft = !empty($_POST['_draft']) ? true : false; +$saveonly = !empty($_GET['_saveonly']); +$savedraft = !empty($_POST['_draft']) && !$saveonly; $sendmail_delay = (int) $RCMAIL->config->get('sendmail_delay'); $drafts_mbox = $RCMAIL->config->get('drafts_mbox'); @@ -689,24 +690,36 @@ else { // we'll refresh the list if currently opened folder is one of them (#1490238) $folders = array(); - if (in_array($COMPOSE['mode'], array('reply', 'forward', 'draft'))) { - $folders[] = $COMPOSE['mailbox']; - } - if (!empty($COMPOSE['param']['draft_uid']) && $drafts_mbox) { - $folders[] = $drafts_mbox; + if (!$saveonly) { + 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); - if ($store_folder && !$saved) { - $RCMAIL->display_server_error('errorsavingsent', null, null, array('prefix' => true)); + $params = $saveonly ? null : array('prefix' => true); + $RCMAIL->display_server_error('errorsavingsent', null, null, $params); + if ($saveonly) { + $OUTPUT->send('iframe'); + } + + $save_error = true; } - else if ($store_folder) { - $folders[] = $store_target; + else { + rcmail_compose_cleanup($COMPOSE_ID); + $OUTPUT->command('remove_compose_data', $COMPOSE_ID); + + if ($store_folder) { + $folders[] = $store_target; + } } - $OUTPUT->command('sent_successfully', 'confirmation', $RCMAIL->gettext('messagesent'), $folders); + $msg = $RCMAIL->gettext($saveonly ? 'successfullysaved' : 'messagesent'); + + $OUTPUT->command('sent_successfully', 'confirmation', $msg, $folders, $save_error); } $OUTPUT->send('iframe'); -- cgit v1.2.3 From 97ee4c40c1e575efb7193fabd32a9d897673f8e2 Mon Sep 17 00:00:00 2001 From: Aleksander Machniak Date: Wed, 25 Feb 2015 08:23:55 -0500 Subject: Don't sent the message again in saveonly mode --- program/steps/mail/sendmail.inc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'program/steps') diff --git a/program/steps/mail/sendmail.inc b/program/steps/mail/sendmail.inc index e90b0ef61..08b085c88 100644 --- a/program/steps/mail/sendmail.inc +++ b/program/steps/mail/sendmail.inc @@ -517,7 +517,7 @@ if (function_exists('mb_encode_mimeheader')) { $MAIL_MIME->headers($headers); // Begin SMTP Delivery Block -if (!$savedraft) { +if (!$savedraft && !$saveonly) { // check 'From' address (identity may be incomplete) if (empty($from)) { $OUTPUT->show_message('nofromaddress', 'error'); -- cgit v1.2.3 From e1c8fe5c4a0f30cd36069e3460ac937282fb8e1a Mon Sep 17 00:00:00 2001 From: Aleksander Machniak Date: Wed, 25 Feb 2015 09:45:57 -0500 Subject: Fix duplicate entries supression in autocomplete result (#1490290) --- CHANGELOG | 1 + program/steps/mail/autocomplete.inc | 54 +++++++++++++++++++++---------------- 2 files changed, 32 insertions(+), 23 deletions(-) (limited to 'program/steps') diff --git a/CHANGELOG b/CHANGELOG index 8e31bc914..72ccf7043 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -16,6 +16,7 @@ CHANGELOG Roundcube Webmail - Fix fatal errors on systems without mbstring extension or mb_regex_encoding() function (#1490280) - Fix cursor position on reply below the quote in HTML mode (#1490263) - Fix so "over quota" errors are displayed also in message compose page +- Fix duplicate entries supression in autocomplete result (#1490290) RELEASE 1.1.0 ------------- diff --git a/program/steps/mail/autocomplete.inc b/program/steps/mail/autocomplete.inc index 30b8f2299..38501eb9d 100644 --- a/program/steps/mail/autocomplete.inc +++ b/program/steps/mail/autocomplete.inc @@ -88,16 +88,18 @@ if (!empty($book_types) && strlen($search)) { continue; } + $index = $contact; + // skip duplicates - if (!in_array($contact, $contacts)) { + if (empty($contacts[$index])) { $contact = array('name' => $contact, 'type' => $sql_arr['_type']); if (($display = rcube_addressbook::compose_search_name($sql_arr, $email, $name)) && $display != $contact['name']) { $contact['display'] = $display; } - $contacts[] = $contact; - $sort_keys[] = sprintf('%s %03d', $contact['display'] ?: $name, $idx++); + $contacts[$index] = $contact; + $sort_keys[$index] = sprintf('%s %03d', $contact['display'] ?: $name, $idx++); if (count($contacts) >= $MAXNUM) { break 2; @@ -124,34 +126,40 @@ if (!empty($book_types) && strlen($search)) { if ($group_prop['email']) { $idx = 0; foreach ((array)$group_prop['email'] as $email) { - $contacts[] = array( - 'name' => format_email_recipient($email, $group['name']), - 'email' => $email, + $index = format_email_recipient($email, $group['name']); + + if (empty($contacts[$index])) { + $sort_keys[$index] = sprintf('%s %03d', $group['name'] , $idx++); + $contacts[$index] = array( + 'name' => $index, + 'email' => $email, + 'type' => 'group', + 'id' => $group['ID'], + 'source' => $id, + ); + + if (count($contacts) >= $MAXNUM) { + break 2; + } + } + } + } + // show group with count + else if (($result = $abook->count()) && $result->count) { + if (empty($contacts[$group['name']])) { + $sort_keys[$group['name']] = $group['name']; + $contacts[$group['name']] = array( + 'name' => $group['name'] . ' (' . intval($result->count) . ')', 'type' => 'group', 'id' => $group['ID'], - 'source' => $id, + 'source' => $id ); - $sort_keys[] = sprintf('%s %03d', $group['name'] , $idx++); if (count($contacts) >= $MAXNUM) { - break 2; + break; } } } - // show group with count - else if (($result = $abook->count()) && $result->count) { - $sort_keys[] = $group['name']; - $contacts[] = array( - 'name' => $group['name'] . ' (' . intval($result->count) . ')', - 'type' => 'group', - 'id' => $group['ID'], - 'source' => $id - ); - - if (count($contacts) >= $MAXNUM) { - break; - } - } } } } -- cgit v1.2.3 From b59b72cc3028cc0514e951f135d8bfe7efcaaa6f Mon Sep 17 00:00:00 2001 From: Aleksander Machniak Date: Thu, 26 Feb 2015 18:04:03 +0100 Subject: Fix "Non-static method PEAR::isError() should not be called statically" errors (#1490281) --- CHANGELOG | 1 + plugins/managesieve/lib/Roundcube/rcube_sieve.php | 93 +++++++++++++++------- .../lib/Roundcube/rcube_sieve_engine.php | 5 +- plugins/password/drivers/ldap.php | 6 +- plugins/password/drivers/poppassd.php | 2 +- plugins/password/drivers/vpopmaild.php | 9 ++- program/lib/Roundcube/rcube.php | 15 ++-- program/lib/Roundcube/rcube_smtp.php | 14 ++-- program/steps/mail/sendmail.inc | 7 +- 9 files changed, 99 insertions(+), 53 deletions(-) (limited to 'program/steps') diff --git a/CHANGELOG b/CHANGELOG index 72ccf7043..4855f2c31 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -17,6 +17,7 @@ CHANGELOG Roundcube Webmail - Fix cursor position on reply below the quote in HTML mode (#1490263) - Fix so "over quota" errors are displayed also in message compose page - Fix duplicate entries supression in autocomplete result (#1490290) +- Fix "Non-static method PEAR::isError() should not be called statically" errors (#1490281) RELEASE 1.1.0 ------------- diff --git a/plugins/managesieve/lib/Roundcube/rcube_sieve.php b/plugins/managesieve/lib/Roundcube/rcube_sieve.php index 389c85012..59a7bc134 100644 --- a/plugins/managesieve/lib/Roundcube/rcube_sieve.php +++ b/plugins/managesieve/lib/Roundcube/rcube_sieve.php @@ -68,7 +68,9 @@ class rcube_sieve $this->sieve->setDebug(true, array($this, 'debug_handler')); } - if (PEAR::isError($this->sieve->connect($host, $port, $options, $usetls))) { + $result = $this->sieve->connect($host, $port, $options, $usetls); + + if (is_a($result, 'PEAR_Error')) { return $this->_set_error(self::ERROR_CONNECTION); } @@ -78,9 +80,9 @@ class rcube_sieve $password = $auth_pw; } - if (PEAR::isError($this->sieve->login($username, $password, - $auth_type ? strtoupper($auth_type) : null, $authz)) - ) { + $result = $this->sieve->login($username, $password, $auth_type ? strtoupper($auth_type) : null, $authz); + + if (is_a($result, 'PEAR_Error')) { return $this->_set_error(self::ERROR_LOGIN); } @@ -115,22 +117,28 @@ class rcube_sieve */ public function save($name = null) { - if (!$this->sieve) + if (!$this->sieve) { return $this->_set_error(self::ERROR_INTERNAL); + } - if (!$this->script) + if (!$this->script) { return $this->_set_error(self::ERROR_INTERNAL); + } - if (!$name) + if (!$name) { $name = $this->current; + } $script = $this->script->as_text(); - if (!$script) + if (!$script) { $script = '/* empty script */'; + } - if (PEAR::isError($this->sieve->installScript($name, $script))) + $result = $this->sieve->installScript($name, $script); + if (is_a($result, 'PEAR_Error')) { return $this->_set_error(self::ERROR_INSTALL); + } return true; } @@ -140,14 +148,19 @@ class rcube_sieve */ public function save_script($name, $content = null) { - if (!$this->sieve) + if (!$this->sieve) { return $this->_set_error(self::ERROR_INTERNAL); + } - if (!$content) + if (!$content) { $content = '/* empty script */'; + } + + $result = $this->sieve->installScript($name, $content); - if (PEAR::isError($this->sieve->installScript($name, $content))) + if (is_a($result, 'PEAR_Error')) { return $this->_set_error(self::ERROR_INSTALL); + } return true; } @@ -157,14 +170,19 @@ class rcube_sieve */ public function activate($name = null) { - if (!$this->sieve) + if (!$this->sieve) { return $this->_set_error(self::ERROR_INTERNAL); + } - if (!$name) + if (!$name) { $name = $this->current; + } - if (PEAR::isError($this->sieve->setActive($name))) + $result = $this->sieve->setActive($name); + + if (is_a($result, 'PEAR_Error')) { return $this->_set_error(self::ERROR_ACTIVATE); + } return true; } @@ -174,11 +192,15 @@ class rcube_sieve */ public function deactivate() { - if (!$this->sieve) + if (!$this->sieve) { return $this->_set_error(self::ERROR_INTERNAL); + } + + $result = $this->sieve->setActive(''); - if (PEAR::isError($this->sieve->setActive(''))) + if (is_a($result, 'PEAR_Error')) { return $this->_set_error(self::ERROR_DEACTIVATE); + } return true; } @@ -188,22 +210,32 @@ class rcube_sieve */ public function remove($name = null) { - if (!$this->sieve) + if (!$this->sieve) { return $this->_set_error(self::ERROR_INTERNAL); + } - if (!$name) + if (!$name) { $name = $this->current; + } // script must be deactivated first - if ($name == $this->sieve->getActive()) - if (PEAR::isError($this->sieve->setActive(''))) + if ($name == $this->sieve->getActive()) { + $result = $this->sieve->setActive(''); + + if (is_a($result, 'PEAR_Error')) { return $this->_set_error(self::ERROR_DELETE); + } + } + + $result = $this->sieve->removeScript($name); - if (PEAR::isError($this->sieve->removeScript($name))) + if (is_a($result, 'PEAR_Error')) { return $this->_set_error(self::ERROR_DELETE); + } - if ($name == $this->current) + if ($name == $this->current) { $this->current = null; + } return true; } @@ -221,7 +253,7 @@ class rcube_sieve $ext = $this->sieve->getExtensions(); - if (PEAR::isError($ext)) { + if (is_a($ext, 'PEAR_Error')) { return array(); } @@ -250,8 +282,9 @@ class rcube_sieve $list = $this->sieve->listScripts(); - if (PEAR::isError($list)) + if (is_a($list, 'PEAR_Error')) { return $this->_set_error(self::ERROR_OTHER); + } $this->list = $list; } @@ -283,8 +316,9 @@ class rcube_sieve $script = $this->sieve->getScript($name); - if (PEAR::isError($script)) + if (is_a($script, 'PEAR_Error')) { return $this->_set_error(self::ERROR_OTHER); + } // try to parse from Roundcube format $this->script = $this->_parse($script); @@ -349,8 +383,9 @@ class rcube_sieve $content = $this->sieve->getScript($name); - if (PEAR::isError($content)) + if (is_a($content, 'PEAR_Error')) { return $this->_set_error(self::ERROR_OTHER); + } return $content; } @@ -366,10 +401,12 @@ class rcube_sieve if ($copy) { $content = $this->sieve->getScript($copy); - if (PEAR::isError($content)) + if (is_a($content, 'PEAR_Error')) { return $this->_set_error(self::ERROR_OTHER); + } } + return $this->save_script($name, $content); } diff --git a/plugins/managesieve/lib/Roundcube/rcube_sieve_engine.php b/plugins/managesieve/lib/Roundcube/rcube_sieve_engine.php index 69ae4b8a6..98c4c952c 100644 --- a/plugins/managesieve/lib/Roundcube/rcube_sieve_engine.php +++ b/plugins/managesieve/lib/Roundcube/rcube_sieve_engine.php @@ -390,10 +390,11 @@ class rcube_sieve_engine } else if ($action == 'setget') { $script_name = rcube_utils::get_input_value('_set', rcube_utils::INPUT_GPC, true); - $script = $this->sieve->get_script($script_name); + $script = $this->sieve->get_script($script_name); - if (PEAR::isError($script)) + if (is_a($script, 'PEAR_Error')) { exit; + } $browser = new rcube_browser; diff --git a/plugins/password/drivers/ldap.php b/plugins/password/drivers/ldap.php index c18ff0f06..a11c38d17 100644 --- a/plugins/password/drivers/ldap.php +++ b/plugins/password/drivers/ldap.php @@ -75,7 +75,7 @@ class rcube_ldap_password $ldap = Net_LDAP2::connect($ldapConfig); // Checking for connection error - if (PEAR::isError($ldap)) { + if (is_a($ldap, 'PEAR_Error')) { return PASSWORD_CONNECT_ERROR; } @@ -176,7 +176,7 @@ class rcube_ldap_password $ldap = Net_LDAP2::connect($ldapConfig); - if (PEAR::isError($ldap)) { + if (is_a($ldap, 'PEAR_Error')) { return ''; } @@ -189,7 +189,7 @@ class rcube_ldap_password $result = $ldap->search($base, $filter, $options); $ldap->done(); - if (PEAR::isError($result) || ($result->count() != 1)) { + if (is_a($result, 'PEAR_Error') || ($result->count() != 1)) { return ''; } diff --git a/plugins/password/drivers/poppassd.php b/plugins/password/drivers/poppassd.php index 8ddbef5d3..7a2821083 100644 --- a/plugins/password/drivers/poppassd.php +++ b/plugins/password/drivers/poppassd.php @@ -42,7 +42,7 @@ class rcube_poppassd_password $poppassd = new Net_Socket(); $result = $poppassd->connect($rcmail->config->get('password_pop_host'), $rcmail->config->get('password_pop_port'), null); - if (PEAR::isError($result)) { + if (is_a($result, 'PEAR_Error')) { return $this->format_error_result(PASSWORD_CONNECT_ERROR, $result->getMessage()); } else { diff --git a/plugins/password/drivers/vpopmaild.php b/plugins/password/drivers/vpopmaild.php index a7644fc21..90fce02c5 100644 --- a/plugins/password/drivers/vpopmaild.php +++ b/plugins/password/drivers/vpopmaild.php @@ -28,12 +28,13 @@ class rcube_vpopmaild_password { function save($curpass, $passwd) { - $rcmail = rcmail::get_instance(); - // include('Net/Socket.php'); + $rcmail = rcmail::get_instance(); $vpopmaild = new Net_Socket(); + $host = $rcmail->config->get('password_vpopmaild_host'); + $port = $rcmail->config->get('password_vpopmaild_port'); - if (PEAR::isError($vpopmaild->connect($rcmail->config->get('password_vpopmaild_host'), - $rcmail->config->get('password_vpopmaild_port'), null))) { + $result = $vpopmaild->connect($hostname, $port, null); + if (is_a($result, 'PEAR_Error')) { return PASSWORD_CONNECT_ERROR; } diff --git a/program/lib/Roundcube/rcube.php b/program/lib/Roundcube/rcube.php index 3aca88843..20f509e3d 100644 --- a/program/lib/Roundcube/rcube.php +++ b/program/lib/Roundcube/rcube.php @@ -1681,15 +1681,18 @@ class rcube if ($message->getParam('delay_file_io')) { // use common temp dir - $temp_dir = $this->config->get('temp_dir'); - $body_file = tempnam($temp_dir, 'rcmMsg'); - if (PEAR::isError($mime_result = $message->saveMessageBody($body_file))) { + $temp_dir = $this->config->get('temp_dir'); + $body_file = tempnam($temp_dir, 'rcmMsg'); + $mime_result = $message->saveMessageBody($body_file); + + if (is_a($mime_result, 'PEAR_Error')) { self::raise_error(array('code' => 650, 'type' => 'php', 'file' => __FILE__, 'line' => __LINE__, 'message' => "Could not create message: ".$mime_result->getMessage()), - TRUE, FALSE); + true, false); return false; } + $msg_body = fopen($body_file, 'r'); } else { @@ -1732,11 +1735,11 @@ class rcube $msg_body = $message->get(); - if (PEAR::isError($msg_body)) { + if (is_a($msg_body, 'PEAR_Error')) { self::raise_error(array('code' => 650, 'type' => 'php', 'file' => __FILE__, 'line' => __LINE__, 'message' => "Could not create message: ".$msg_body->getMessage()), - TRUE, FALSE); + true, false); } else { $delim = $this->config->header_delimiter(); diff --git a/program/lib/Roundcube/rcube_smtp.php b/program/lib/Roundcube/rcube_smtp.php index b37b44426..0322a0d46 100644 --- a/program/lib/Roundcube/rcube_smtp.php +++ b/program/lib/Roundcube/rcube_smtp.php @@ -126,7 +126,7 @@ class rcube_smtp // try to connect to server and exit on failure $result = $this->conn->connect($CONFIG['smtp_timeout']); - if (PEAR::isError($result)) { + if (is_a($result, 'PEAR_Error')) { $this->response[] = "Connection failed: ".$result->getMessage(); $this->error = array('label' => 'smtpconnerror', 'vars' => array('code' => $this->conn->_code)); $this->conn = null; @@ -159,7 +159,7 @@ class rcube_smtp $result = $this->conn->auth($smtp_user, $smtp_pass, $smtp_auth_type, $use_tls, $smtp_authz); - if (PEAR::isError($result)) { + if (is_a($result, 'PEAR_Error')) { $this->error = array('label' => 'smtpautherror', 'vars' => array('code' => $this->conn->_code)); $this->response[] .= 'Authentication failure: ' . $result->getMessage() . ' (Code: ' . $result->getCode() . ')'; $this->reset(); @@ -240,7 +240,8 @@ class rcube_smtp } // set From: address - if (PEAR::isError($this->conn->mailFrom($from, $from_params))) { + $result = $this->conn->mailFrom($from, $from_params); + if (is_a($result, 'PEAR_Error')) { $err = $this->conn->getResponse(); $this->error = array('label' => 'smtpfromerror', 'vars' => array( 'from' => $from, 'code' => $err[0], 'msg' => $err[1])); @@ -252,7 +253,7 @@ class rcube_smtp // prepare list of recipients $recipients = $this->_parse_rfc822($recipients); - if (PEAR::isError($recipients)) { + if (is_a($recipients, 'PEAR_Error')) { $this->error = array('label' => 'smtprecipientserror'); $this->reset(); return false; @@ -260,7 +261,8 @@ class rcube_smtp // set mail recipients foreach ($recipients as $recipient) { - if (PEAR::isError($this->conn->rcptTo($recipient, $recipient_params))) { + $result = $this->conn->rcptTo($recipient, $recipient_params); + if (is_a($result, 'PEAR_Error')) { $err = $this->conn->getResponse(); $this->error = array('label' => 'smtptoerror', 'vars' => array( 'to' => $recipient, 'code' => $err[0], 'msg' => $err[1])); @@ -289,7 +291,7 @@ class rcube_smtp // Send the message's headers and the body as SMTP data. $result = $this->conn->data($data, $text_headers); - if (PEAR::isError($result)) { + if (is_a($result, 'PEAR_Error')) { $err = $this->conn->getResponse(); if (!in_array($err[0], array(354, 250, 221))) { $msg = sprintf('[%d] %s', $err[0], $err[1]); diff --git a/program/steps/mail/sendmail.inc b/program/steps/mail/sendmail.inc index 08b085c88..9e674f773 100644 --- a/program/steps/mail/sendmail.inc +++ b/program/steps/mail/sendmail.inc @@ -601,8 +601,9 @@ if ($store_target) { else { $temp_dir = $RCMAIL->config->get('temp_dir'); $mailbody_file = tempnam($temp_dir, 'rcmMsg'); + $msg = $MAIL_MIME->saveMessageBody($mailbody_file); - if (!PEAR::isError($msg = $MAIL_MIME->saveMessageBody($mailbody_file))) { + if (!is_a($msg, 'PEAR_Error')) { $msg = $mailbody_file; } } @@ -612,7 +613,7 @@ if ($store_target) { $headers = ''; } - if (PEAR::isError($msg)) { + if (is_a($msg, 'PEAR_Error')) { rcube::raise_error(array('code' => 650, 'type' => 'php', 'file' => __FILE__, 'line' => __LINE__, 'message' => "Could not create message: ".$msg->getMessage()), @@ -800,7 +801,7 @@ function rcmail_fix_emoticon_paths($mime_message) if (!in_array($image_name, $included_images)) { // add the image to the MIME message $res = $mime_message->addHTMLImage($img_file, 'image/gif', '', true, $image_name); - if (PEAR::isError($res)) { + if (is_a($res, 'PEAR_Error')) { $RCMAIL->output->show_message("emoticonerror", 'error'); continue; } -- cgit v1.2.3 From 7981575a616b4486531562bfd5fe727de7ab8d6a Mon Sep 17 00:00:00 2001 From: Aleksander Machniak Date: Mon, 2 Mar 2015 12:59:07 +0100 Subject: Fix so localized folder name is displayed in multi-folder search result (#1490243) --- CHANGELOG | 1 + program/steps/mail/func.inc | 13 +++++++++++-- 2 files changed, 12 insertions(+), 2 deletions(-) (limited to 'program/steps') diff --git a/CHANGELOG b/CHANGELOG index 94f0a982d..47ff57340 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -22,6 +22,7 @@ CHANGELOG Roundcube Webmail - Fix "Non-static method PEAR::isError() should not be called statically" errors (#1490281) - Fix parsing invalid HTML messages with BOM after (#1490291) - Fix duplicate entry on timezones list in rcube_config::timezone_name_from_abbr() (#1490293) +- Fix so localized folder name is displayed in multi-folder search result (#1490243) RELEASE 1.1.0 ------------- diff --git a/program/steps/mail/func.inc b/program/steps/mail/func.inc index c45fd2f97..341c14bc8 100644 --- a/program/steps/mail/func.inc +++ b/program/steps/mail/func.inc @@ -399,6 +399,7 @@ function rcmail_js_message_list($a_headers, $insert_top=false, $a_show_cols=null $head_replace = true; } + $delimiter = $RCMAIL->storage->get_hierarchy_delimiter(); $search_set = $RCMAIL->storage->get_search_set(); $multifolder = $search_set && $search_set[1]->multi; @@ -489,8 +490,16 @@ function rcmail_js_message_list($a_headers, $insert_top=false, $a_show_cols=null $cont = show_bytes($header->$col); else if ($col == 'date') $cont = $RCMAIL->format_date($header->date); - else if ($col == 'folder') - $cont = rcube::Q(rcube_charset::convert($header->folder, 'UTF7-IMAP')); + else if ($col == 'folder') { + if ($last_folder !== $header->folder) { + $last_folder = $header->folder; + $last_folder_name = rcube_charset::convert($last_folder, 'UTF7-IMAP'); + $last_folder_name = $RCMAIL->localize_foldername($last_folder_name, true); + $last_folder_name = str_replace($delimiter, " \xC2\xBB ", $last_folder_name); + } + + $cont = rcube::Q($last_folder_name); + } else $cont = rcube::Q($header->$col); -- cgit v1.2.3 From 9ad0fc489ff3c32face845989a8f5f311208b4f9 Mon Sep 17 00:00:00 2001 From: Aleksander Machniak Date: Mon, 2 Mar 2015 13:51:51 +0100 Subject: Fix javascript error after creating a folder which is a subfolder of another one (#1490297) --- CHANGELOG | 1 + program/js/app.js | 6 ++++-- program/steps/settings/folders.inc | 2 +- 3 files changed, 6 insertions(+), 3 deletions(-) (limited to 'program/steps') diff --git a/CHANGELOG b/CHANGELOG index 47ff57340..1a3b412cf 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -23,6 +23,7 @@ CHANGELOG Roundcube Webmail - Fix parsing invalid HTML messages with BOM after (#1490291) - Fix duplicate entry on timezones list in rcube_config::timezone_name_from_abbr() (#1490293) - Fix so localized folder name is displayed in multi-folder search result (#1490243) +- Fix javascript error after creating a folder which is a subfolder of another one (#1490297) RELEASE 1.1.0 ------------- diff --git a/program/js/app.js b/program/js/app.js index 56d07f37e..7d3f0c55d 100644 --- a/program/js/app.js +++ b/program/js/app.js @@ -1608,7 +1608,8 @@ function rcube_webmail() this.folder_collapsed = function(node) { - var prefname = this.env.task == 'addressbook' ? 'collapsed_abooks' : 'collapsed_folders'; + var prefname = this.env.task == 'addressbook' ? 'collapsed_abooks' : 'collapsed_folders', + old = this.env[prefname]; if (node.collapsed) { this.env[prefname] = this.env[prefname] + '&'+urlencode(node.id)+'&'; @@ -1624,7 +1625,8 @@ function rcube_webmail() } if (!this.drag_active) { - this.command('save-pref', { name: prefname, value: this.env[prefname] }); + if (old !== this.env[prefname]) + this.command('save-pref', { name: prefname, value: this.env[prefname] }); if (this.env.unread_counts) this.set_unread_count_display(node.id, false); diff --git a/program/steps/settings/folders.inc b/program/steps/settings/folders.inc index 6db0b17e8..443635fae 100644 --- a/program/steps/settings/folders.inc +++ b/program/steps/settings/folders.inc @@ -265,7 +265,7 @@ function rcmail_subscription_form($attrib) $js_folders = array(); $folders = array(); - $collapsed = $RCMAIL->config->get('collapsed_folders'); + $collapsed = (string) $RCMAIL->config->get('collapsed_folders'); // create list of available folders foreach ($list_folders as $i => $folder) { -- cgit v1.2.3 From f02fe3c3444a5ed7736ea532071269bb8f488fb8 Mon Sep 17 00:00:00 2001 From: Aleksander Machniak Date: Wed, 4 Mar 2015 12:28:33 -0500 Subject: Remove redundant encoding of message subject with mb_encode_mimeheader() (#1490295) --- program/steps/mail/sendmail.inc | 8 -------- 1 file changed, 8 deletions(-) (limited to 'program/steps') diff --git a/program/steps/mail/sendmail.inc b/program/steps/mail/sendmail.inc index 9e674f773..5326d6452 100644 --- a/program/steps/mail/sendmail.inc +++ b/program/steps/mail/sendmail.inc @@ -505,14 +505,6 @@ $MAIL_MIME->setParam('head_charset', $message_charset); $MAIL_MIME->setParam('html_charset', $message_charset); $MAIL_MIME->setParam('text_charset', $text_charset); -// encoding subject header with mb_encode provides better results with asian characters -if (function_exists('mb_encode_mimeheader')) { - mb_internal_encoding($message_charset); - $headers['Subject'] = mb_encode_mimeheader($headers['Subject'], - $message_charset, 'Q', "\r\n", 8); - mb_internal_encoding(RCUBE_CHARSET); -} - // pass headers to message object $MAIL_MIME->headers($headers); -- cgit v1.2.3 From 7ff227eb3eda915bf40a596f7ab727e3d0e0861b Mon Sep 17 00:00:00 2001 From: Aleksander Machniak Date: Sun, 8 Mar 2015 10:48:30 +0100 Subject: get_part_content() -> get_part_body() --- program/steps/mail/get.inc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'program/steps') diff --git a/program/steps/mail/get.inc b/program/steps/mail/get.inc index 5803e0c5a..cb4f58027 100644 --- a/program/steps/mail/get.inc +++ b/program/steps/mail/get.inc @@ -85,7 +85,7 @@ else if ($_GET['_thumb']) { // render thumbnail image if not done yet if (!is_file($cache_file)) { if ($fp = fopen(($orig_name = $cache_basename . '.orig.' . $ext), 'w')) { - $MESSAGE->get_part_content($part->mime_id, $fp); + $MESSAGE->get_part_body($part->mime_id, false, 0, $fp); fclose($fp); $image = new rcube_image($orig_name); -- cgit v1.2.3 From 1ec105c6855c99f4f2a12038d6f9598067fdf205 Mon Sep 17 00:00:00 2001 From: Aleksander Machniak Date: Mon, 9 Mar 2015 07:44:11 -0400 Subject: Fix so search filter, scope and fields are reset on folder change --- CHANGELOG | 1 + program/js/app.js | 19 ++++++++++++++----- program/steps/mail/func.inc | 13 +------------ program/steps/mail/list.inc | 14 -------------- 4 files changed, 16 insertions(+), 31 deletions(-) (limited to 'program/steps') diff --git a/CHANGELOG b/CHANGELOG index 94f4829a8..19c5ed469 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -30,6 +30,7 @@ CHANGELOG Roundcube Webmail - Fix missing vcard_attachment icon on messages list (#1490303) - Fix storing signatures with big images in MySQL database (#1490306) - Fix Opera browser detection in javascript (#1490307) +- Fix so search filter, scope and fields are reset on folder change RELEASE 1.1.0 ------------- diff --git a/program/js/app.js b/program/js/app.js index 7d3f0c55d..223606e45 100644 --- a/program/js/app.js +++ b/program/js/app.js @@ -2378,6 +2378,9 @@ function rcube_webmail() // list messages of a specific mailbox using filter this.filter_mailbox = function(filter) { + if (this.filter_disabled) + return; + var lock = this.set_busy(true, 'searching'); this.clear_message_list(); @@ -2411,16 +2414,22 @@ function rcube_webmail() if (sort) url._sort = sort; - // also send search request to get the right messages - if (this.env.search_request) - url._search = this.env.search_request; - - // set page=1 if changeing to another mailbox + // folder change, reset page, search scope, etc. if (this.env.mailbox != mbox) { page = 1; this.env.current_page = page; + this.env.search_scope = 'base'; this.select_all_mode = false; + + // reset search filter + this.filter_disabled = true; + if (this.gui_objects.search_filter) + $(this.gui_objects.search_filter).val('ALL').change(); + this.filter_disabled = false; } + // also send search request to get the right messages + else if (this.env.search_request) + url._search = this.env.search_request; if (!update_only) { // unselect selected messages and clear the list and message data diff --git a/program/steps/mail/func.inc b/program/steps/mail/func.inc index 341c14bc8..684cdf933 100644 --- a/program/steps/mail/func.inc +++ b/program/steps/mail/func.inc @@ -64,17 +64,6 @@ if (empty($RCMAIL->action) || $RCMAIL->action == 'list') { $mbox_name = $RCMAIL->storage->get_folder(); if (empty($RCMAIL->action)) { - // initialize searching result if search_filter is used - if ($_SESSION['search_filter'] && $_SESSION['search_filter'] != 'ALL') { - $RCMAIL->storage->search($mbox_name, $_SESSION['search_filter'], RCUBE_CHARSET, rcmail_sort_column()); - - $search_request = md5($mbox_name.$_SESSION['search_filter']); - $_SESSION['search'] = $RCMAIL->storage->get_search_set(); - $_SESSION['search_request'] = $search_request; - - $OUTPUT->set_env('search_request', $search_request); - } - $OUTPUT->set_env('search_mods', rcmail_search_mods()); if (!empty($_SESSION['search_scope'])) @@ -2056,7 +2045,7 @@ function rcmail_search_filter($attrib) $select_filter->add($RCMAIL->gettext('priority').': '.$RCMAIL->gettext('low'), 'HEADER X-PRIORITY 4'); $select_filter->add($RCMAIL->gettext('priority').': '.$RCMAIL->gettext('lowest'), 'HEADER X-PRIORITY 5'); - $out = $select_filter->show($_SESSION['search_filter']); + $out = $select_filter->show($_REQUEST['_search'] ? $_SESSION['search_filter'] : 'ALL'); $RCMAIL->output->add_gui_object('search_filter', $attrib['id']); diff --git a/program/steps/mail/list.inc b/program/steps/mail/list.inc index 32197bde3..4f2b73c53 100644 --- a/program/steps/mail/list.inc +++ b/program/steps/mail/list.inc @@ -58,20 +58,6 @@ $threading = (bool) $RCMAIL->storage->get_threading(); // Synchronize mailbox cache, handle flag changes $RCMAIL->storage->folder_sync($mbox_name); -// initialize searching result if search_filter is used -if ($_SESSION['search_filter'] && $_SESSION['search_filter'] != 'ALL') { - $search_request = md5($mbox_name.$_SESSION['search_scope'].$_SESSION['search_filter']); - $RCMAIL->storage->search($mbox_name, $_SESSION['search_filter'], RCUBE_CHARSET, rcmail_sort_column()); - - $_SESSION['search'] = $RCMAIL->storage->get_search_set(); - $_SESSION['search_request'] = $search_request; - - $OUTPUT->set_env('search_request', $search_request); - $OUTPUT->set_env('search_filter', $_SESSION['search_filter']); - - $multifolder = is_a($_SESSION['search'][1], 'rcube_result_multifolder'); -} - // fetch message headers if ($count = $RCMAIL->storage->count($mbox_name, $threading ? 'THREADS' : 'ALL', !empty($_REQUEST['_refresh']))) { $a_headers = $RCMAIL->storage->list_messages($mbox_name, NULL, rcmail_sort_column(), rcmail_sort_order()); -- cgit v1.2.3 From 10934dcd2a6bdd8253cd0784b4da189e9d3ac7c6 Mon Sep 17 00:00:00 2001 From: Aleksander Machniak Date: Tue, 10 Mar 2015 10:35:48 +0100 Subject: Fix rows count when messages search fails (#1490266) --- CHANGELOG | 1 + program/steps/mail/search.inc | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) (limited to 'program/steps') diff --git a/CHANGELOG b/CHANGELOG index 1ae0a3a0e..62c402560 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -32,6 +32,7 @@ CHANGELOG Roundcube Webmail - Fix storing signatures with big images in MySQL database (#1490306) - Fix Opera browser detection in javascript (#1490307) - Fix so search filter, scope and fields are reset on folder change +- Fix rows count when messages search fails (#1490266) RELEASE 1.1.0 ------------- diff --git a/program/steps/mail/search.inc b/program/steps/mail/search.inc index d88e57568..02281e610 100644 --- a/program/steps/mail/search.inc +++ b/program/steps/mail/search.inc @@ -151,12 +151,14 @@ $_SESSION['search_scope'] = $scope; // Get the headers if (!$result->incomplete) { $result_h = $RCMAIL->storage->list_messages($mbox, 1, $sort_column, rcmail_sort_order()); - $count = $RCMAIL->storage->count($mbox, $RCMAIL->storage->get_threading() ? 'THREADS' : 'ALL'); } // Make sure we got the headers if (!empty($result_h)) { + $count = $RCMAIL->storage->count($mbox, $RCMAIL->storage->get_threading() ? 'THREADS' : 'ALL'); + rcmail_js_message_list($result_h, false); + if ($search_str) { $OUTPUT->show_message('searchsuccessful', 'confirmation', array('nr' => $RCMAIL->storage->count(NULL, 'ALL'))); } @@ -172,6 +174,7 @@ if (!empty($result_h)) { } // handle IMAP errors (e.g. #1486905) else if ($err_code = $RCMAIL->storage->get_error_code()) { + $count = 0; $RCMAIL->display_server_error(); } // advice the client to re-send the (cross-folder) search request @@ -180,6 +183,7 @@ else if ($result->incomplete) { $OUTPUT->command('continue_search', $search_request); } else { + $count = 0; $OUTPUT->show_message('searchnomatch', 'notice'); $OUTPUT->set_env('multifolder_listing', (bool)$result->multi); if ($result->multi && $scope == 'all') { -- cgit v1.2.3 From b1d13e8bd5c550fff9f3e0768fa33a2b3b3668f3 Mon Sep 17 00:00:00 2001 From: Thomas Bruederli Date: Thu, 12 Mar 2015 16:27:14 +0100 Subject: Fix redirct URL for attachments loaded in an iframe (#1490191) --- program/steps/mail/get.inc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'program/steps') diff --git a/program/steps/mail/get.inc b/program/steps/mail/get.inc index cb4f58027..831026eb7 100644 --- a/program/steps/mail/get.inc +++ b/program/steps/mail/get.inc @@ -22,7 +22,9 @@ // show loading page if (!empty($_GET['_preload'])) { - $url = preg_replace('/([&?]+)_preload=/', '\\1_mimewarning=1&_embed=', $_SERVER['REQUEST_URI']); + $_get = $_GET + array('_mimewarning' => 1, '_embed' => 1); + unset($_get['_preload']); + $url = $RCMAIL->url($_get); $message = $RCMAIL->gettext('loadingdata'); header('Content-Type: text/html; charset=' . RCUBE_CHARSET); -- cgit v1.2.3 From 0bd99db08d1660e02e3b7589c78785ab6be0794d Mon Sep 17 00:00:00 2001 From: Thomas Bruederli Date: Mon, 23 Mar 2015 18:33:40 +0100 Subject: Localize common error messages; improve explanation for CSRF check failures --- program/include/rcmail_output_html.php | 2 +- program/localization/en_US/messages.inc | 9 +++++++ program/steps/utils/error.inc | 46 ++++++++++++++++++++------------- 3 files changed, 38 insertions(+), 19 deletions(-) (limited to 'program/steps') diff --git a/program/include/rcmail_output_html.php b/program/include/rcmail_output_html.php index c6c43b532..365c403e4 100644 --- a/program/include/rcmail_output_html.php +++ b/program/include/rcmail_output_html.php @@ -584,7 +584,7 @@ EOF; // read template file if (!$path || ($templ = @file_get_contents($path)) === false) { rcube::raise_error(array( - 'code' => 501, + 'code' => 404, 'type' => 'php', 'line' => __LINE__, 'file' => __FILE__, diff --git a/program/localization/en_US/messages.inc b/program/localization/en_US/messages.inc index e0de3654e..bcf89a441 100644 --- a/program/localization/en_US/messages.inc +++ b/program/localization/en_US/messages.inc @@ -180,5 +180,14 @@ $messages['messagetoobig'] = 'The message part is too big to process it.'; $messages['attachmentvalidationerror'] = 'WARNING! This attachment is suspicious because its type doesn\'t match the type declared in the message. If you do not trust the sender, you shouldn\'t open it in the browser because it may contain malicious contents.

Expected: $expected; found: $detected'; $messages['noscriptwarning'] = 'Warning: This webmail service requires Javascript! In order to use it please enable Javascript in your browser\'s settings.'; $messages['messageissent'] = 'The message was already sent, but not saved yet. Do you want to save it now?'; +$messages['errnotfound'] = 'File Not Found'; +$messages['errnotfoundexplain'] = 'The requested resource was not found!'; +$messages['errfailedrequest'] = 'Failed request'; +$messages['errauthorizationfailed'] = 'Authorization Failed'; +$messages['errunauthorizedexplain'] = 'Could not verify that you are authorized to access this service!'; +$messages['errrequestcheckfailed'] = 'Request Check Failed'; +$messages['errcsrfprotectionexplain'] = "For your protection, access to this resource is secured against CSRF.\nYou probably didn't log out before leaving the web application.\n\nHuman interaction is now required to continue."; +$messages['errcontactserveradmin'] = 'Please contact your server-administrator.'; +$messages['clicktoresumesession'] = 'Click here to resume your previous session'; ?> diff --git a/program/steps/utils/error.inc b/program/steps/utils/error.inc index 6bbc57fda..16fbb03d9 100644 --- a/program/steps/utils/error.inc +++ b/program/steps/utils/error.inc @@ -5,7 +5,7 @@ | program/steps/utils/error.inc | | | | This file is part of the Roundcube Webmail client | - | Copyright (C) 2005-2013, The Roundcube Dev Team | + | Copyright (C) 2005-2015, The Roundcube Dev Team | | | | Licensed under the GNU General Public License version 3 or | | any later version with exceptions for skins & plugins. | @@ -43,37 +43,33 @@ EOF; // authorization error else if ($ERROR_CODE == 401) { - $__error_title = "AUTHORIZATION FAILED"; - $__error_text = "Could not verify that you are authorized to access this service!
\n" - . "Please contact your server-administrator."; + $__error_title = strtoupper($rcmail->gettext('errauthorizationfailed')); + $__error_text = nl2br($rcmail->gettext('errunauthorizedexplain') . "\n" . + $rcmail->gettext('errcontactserveradmin')); } // forbidden due to request check else if ($ERROR_CODE == 403) { if ($_SERVER['REQUEST_METHOD'] == 'GET' && $rcmail->request_status == rcube::REQUEST_ERROR_URL) { - parse_str($_SERVER['QUERY_STRING'], $url); - $url = $rcmail->url($url, true, false, true); - $add = "
Click here to try again."; + $url = $rcmail->url($_GET, true, false, true); + $add = html::a($url, $rcmail->gettext('clicktoresumesession')); } else { - $add = "Please contact your server-administrator."; + $add = $rcmail->gettext('errcontactserveradmin'); } - $__error_title = "REQUEST CHECK FAILED"; - $__error_text = "Access to this service was denied due to failing security checks!
\n$add"; + $__error_title = strtoupper($rcmail->gettext('errrequestcheckfailed')); + $__error_text = nl2br($rcmail->gettext('errcsrfprotectionexplain')) . '

' . $add . '

'; } // failed request (wrong step in URL) else if ($ERROR_CODE == 404) { $request_url = htmlentities($_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']); - $__error_title = "REQUEST FAILED/FILE NOT FOUND"; - $__error_text = << -Please contact your server-administrator. + $__error_title = strtoupper($rcmail->gettext('errnotfound')); + $__error_text = nl2br($rcmail->gettext('errnotfoundexplain') . "\n" . + $rcmail->gettext('errcontactserveradmin')); -

Failed request:
-http://$request_url

-EOF; + $__error_text .= '

' . $rcmail->gettext('errfailedrequest') . ":
\n//$request_url

"; } // database connection error @@ -101,6 +97,20 @@ else { } } +// inform plugins +if ($rcmail && $rcmail->plugins) { + $plugin = $rcmail->plugins->exec_hook('error_page', array( + 'code' => $ERROR_CODE, + 'title' => $__error_title, + 'text' => $__error_text, + )); + + if (!empty($plugin['title'])) + $__error_title = $plugin['title']; + if (!empty($plugin['text'])) + $__error_text = $plugin['text']; +} + $HTTP_ERR_CODE = $ERROR_CODE && $ERROR_CODE < 600 ? $ERROR_CODE : 500; // Ajax request @@ -113,7 +123,7 @@ if ($rcmail->output && $rcmail->output->type == 'js') { $__page_content = <<

$__error_title

-

$__error_text

+
$__error_text
EOF; -- cgit v1.2.3 From 1a7e668977ebdcc799c656dfbc11dd31a991282b Mon Sep 17 00:00:00 2001 From: Aleksander Machniak Date: Mon, 30 Mar 2015 10:56:23 -0400 Subject: Fix handling of %-encoded entities in mailto: URLs (#1490346) --- CHANGELOG | 1 + program/steps/mail/compose.inc | 2 ++ 2 files changed, 3 insertions(+) (limited to 'program/steps') diff --git a/CHANGELOG b/CHANGELOG index 9877a086a..be9ac2195 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -5,6 +5,7 @@ CHANGELOG Roundcube Webmail - Add initdb.sh to create database from initial.sql script with prefix support (#1490188) - Plugin API: Added message_part_body hook - Plugin API: Add special onload() method to execute plugin actions before startup (session and GUI initialization) +- Fix handling of %-encoded entities in mailto: URLs (#1490346) RELEASE 1.1.1 ------------- diff --git a/program/steps/mail/compose.inc b/program/steps/mail/compose.inc index 4c3ecfbc0..007efc5f3 100644 --- a/program/steps/mail/compose.inc +++ b/program/steps/mail/compose.inc @@ -448,6 +448,8 @@ function rcmail_process_compose_params(&$COMPOSE) // #1486037: remove "mailto:" prefix $COMPOSE['param']['to'] = preg_replace('/^mailto:/i', '', $mailto[0]); + // #1490346: decode the recipient address + $COMPOSE['param']['to'] = urldecode($COMPOSE['param']['to']); // Supported case-insensitive tokens in mailto URL $url_tokens = array('to', 'cc', 'bcc', 'reply-to', 'in-reply-to', 'references', 'subject', 'body'); -- cgit v1.2.3 From 0a4e0921d3c4e4e1e485f43dc05bf0447fbc846a Mon Sep 17 00:00:00 2001 From: Aleksander Machniak Date: Tue, 31 Mar 2015 16:07:51 +0200 Subject: Plugin API: Added message_ready hook - the last chance to modify Mail_Mime object before saving or sending the message --- CHANGELOG | 1 + program/steps/mail/sendmail.inc | 16 ++++++++++------ 2 files changed, 11 insertions(+), 6 deletions(-) (limited to 'program/steps') diff --git a/CHANGELOG b/CHANGELOG index d14566ddf..41cd629de 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -4,6 +4,7 @@ CHANGELOG Roundcube Webmail - Password plugin: Added 'kpasswd' driver by Peter Allgeyer - Add initdb.sh to create database from initial.sql script with prefix support (#1490188) - Plugin API: Added message_part_body hook +- Plugin API: Added message_ready hook - Plugin API: Add special onload() method to execute plugin actions before startup (session and GUI initialization) - Fix handling of %-encoded entities in mailto: URLs (#1490346) - Fix zipped messages downloads after selecting all messages in a folder (#1490339) diff --git a/program/steps/mail/sendmail.inc b/program/steps/mail/sendmail.inc index 5326d6452..b3034f57d 100644 --- a/program/steps/mail/sendmail.inc +++ b/program/steps/mail/sendmail.inc @@ -113,6 +113,12 @@ else if ($from_string = rcmail_email_input_format($from)) { $from = null; } +// check 'From' address (identity may be incomplete) +if (!$savedraft && !$saveonly && empty($from)) { + $OUTPUT->show_message('nofromaddress', 'error'); + $OUTPUT->send('iframe'); +} + if (!$from_string && $from) { $from_string = $from; } @@ -508,14 +514,12 @@ $MAIL_MIME->setParam('text_charset', $text_charset); // pass headers to message object $MAIL_MIME->headers($headers); +// This hook allows to modify the message before send or save action +$plugin = $RCMAIL->plugins->exec_hook('message_ready', array('message' => $MAIL_MIME)); +$MAIL_MIME = $plugin['message']; + // Begin SMTP Delivery Block if (!$savedraft && !$saveonly) { - // check 'From' address (identity may be incomplete) - if (empty($from)) { - $OUTPUT->show_message('nofromaddress', 'error'); - $OUTPUT->send('iframe'); - } - // Handle Delivery Status Notification request $smtp_opts['dsn'] = $dsn_enabled; -- cgit v1.2.3 From d9c22ab66d0580cf03523c989d75e43850d0555a Mon Sep 17 00:00:00 2001 From: corbosman Date: Fri, 3 Apr 2015 09:43:05 +0200 Subject: move header block inside loop --- program/steps/settings/func.inc | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'program/steps') diff --git a/program/steps/settings/func.inc b/program/steps/settings/func.inc index 087b23610..46aed3019 100644 --- a/program/steps/settings/func.inc +++ b/program/steps/settings/func.inc @@ -1261,13 +1261,14 @@ function rcmail_user_prefs($current = null) unset($sections[$idx]); else $sections[$idx]['blocks'] = $data['blocks']; - } - $data = $RCMAIL->plugins->exec_hook('preferences_section_header', - array('section' => $sect['id'], 'header' => '', 'current' => $current)); + // allow plugins to add a header to each section + $data = $RCMAIL->plugins->exec_hook('preferences_section_header', + array('section' => $sect['id'], 'header' => '', 'current' => $current)); - if(!empty($data['header'])) { - $sections[$idx]['header'] = $data['header']; + if(!empty($data['header'])) { + $sections[$idx]['header'] = $data['header']; + } } return array($sections, $plugin['cols']); -- cgit v1.2.3 From aa38c512fb7634f51bfa168476105dd071f4bd35 Mon Sep 17 00:00:00 2001 From: Aleksander Machniak Date: Wed, 8 Apr 2015 21:04:04 +0200 Subject: Fix lack of signature separator for plain text signatures in html mode (#1490352) --- CHANGELOG | 1 + program/steps/mail/compose.inc | 10 +++------- 2 files changed, 4 insertions(+), 7 deletions(-) (limited to 'program/steps') diff --git a/CHANGELOG b/CHANGELOG index 6dbbecf7a..37c41b134 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -14,6 +14,7 @@ CHANGELOG Roundcube Webmail - Fix message list header in classic skin on window resize in Internet Explorer (#1490213) - Fix so text/calendar parts are listed as attachments even if not marked as such (#1490325) - Fix so unrecognized TNEF attachments are displayed on the list of attachments (#1490351) +- Fix lack of signature separator for plain text signatures in html mode (#1490352) RELEASE 1.1.1 ------------- diff --git a/program/steps/mail/compose.inc b/program/steps/mail/compose.inc index 007efc5f3..ba6f334c9 100644 --- a/program/steps/mail/compose.inc +++ b/program/steps/mail/compose.inc @@ -628,11 +628,12 @@ function rcmail_compose_header_from($attrib) $text = $html = $sql_arr['signature']; if ($sql_arr['html_signature']) { - $h2t = new rcube_html2text($sql_arr['signature'], false, true); + $h2t = new rcube_html2text($html, false, true); $text = trim($h2t->get_text()); } else { - $html = htmlentities($html, ENT_NOQUOTES, RCUBE_CHARSET); + $t2h = new rcube_text2html($text, false); + $html = $t2h->get_html(); } if (!preg_match('/^--[ -]\r?\n/m', $text)) { @@ -640,11 +641,6 @@ function rcmail_compose_header_from($attrib) $html = $separator . "
" . $html; } - if (!$sql_arr['html_signature']) { - $t2h = new rcube_text2html($sql_arr['signature'], false); - $html = $t2h->get_html(); - } - $a_signatures[$identity_id]['text'] = $text; $a_signatures[$identity_id]['html'] = $html; } -- cgit v1.2.3 From 09225a41ec7135031a4c0304b8dcdccd45904939 Mon Sep 17 00:00:00 2001 From: Aleksander Machniak Date: Thu, 16 Apr 2015 10:55:32 +0200 Subject: Add option to place signature at bottom of the quoted text even in top-posting mode [sig_below] --- CHANGELOG | 1 + config/defaults.inc.php | 5 ++++ program/js/app.js | 6 +++-- program/js/editor.js | 51 +++++++++++++++++------------------ program/localization/en_US/labels.inc | 1 + program/steps/mail/compose.inc | 7 +++-- program/steps/settings/func.inc | 14 ++++++++++ program/steps/settings/save_prefs.inc | 1 + 8 files changed, 56 insertions(+), 30 deletions(-) (limited to 'program/steps') diff --git a/CHANGELOG b/CHANGELOG index 6c584fce1..c3049eb73 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -7,6 +7,7 @@ CHANGELOG Roundcube Webmail - Plugin API: Added message_part_body hook - Plugin API: Added message_ready hook - Plugin API: Add special onload() method to execute plugin actions before startup (session and GUI initialization) +- Add option to place signature at bottom of the quoted text even in top-posting mode [sig_below] - Fix handling of %-encoded entities in mailto: URLs (#1490346) - Fix zipped messages downloads after selecting all messages in a folder (#1490339) - Fix vpopmaild driver of password plugin diff --git a/config/defaults.inc.php b/config/defaults.inc.php index 50ae71ed9..df8b612ea 100644 --- a/config/defaults.inc.php +++ b/config/defaults.inc.php @@ -1086,6 +1086,11 @@ $config['strip_existing_sig'] = true; // 3 - Forwards and Replies only $config['show_sig'] = 1; +// By default the signature is placed depending on cursor position (reply_mode). +// Sometimes it might be convenient to start the reply on top but keep +// the signature below the quoted text (sig_below = true). +$config['sig_below'] = false; + // Use MIME encoding (quoted-printable) for 8bit characters in message body $config['force_7bit'] = false; diff --git a/program/js/app.js b/program/js/app.js index 64fd548c9..b6b4d319c 100644 --- a/program/js/app.js +++ b/program/js/app.js @@ -3384,14 +3384,16 @@ function rcube_webmail() if (!html_mode) { pos = this.env.top_posting ? 0 : input_message.value.length; - this.set_caret_pos(input_message, pos); // add signature according to selected identity - // if we have HTML editor, signature is added in callback + // if we have HTML editor, signature is added in a callback if (input_from.prop('type') == 'select-one') { this.change_identity(input_from[0]); } + // set initial cursor position + this.set_caret_pos(input_message, pos); + // scroll to the bottom of the textarea (#1490114) if (pos) { $(input_message).scrollTop(input_message.scrollHeight); diff --git a/program/js/editor.js b/program/js/editor.js index 296a161ca..abd800ca3 100644 --- a/program/js/editor.js +++ b/program/js/editor.js @@ -485,32 +485,37 @@ function rcube_text_editor(config, id) sig = rcmail.env.signatures[id].text; sig = sig.replace(/\r\n/g, '\n'); - if (rcmail.env.top_posting) { - if (p >= 0) { // in place of removed signature - message = message.substring(0, p) + sig + message.substring(p, message.length); - cursor_pos = p - 1; - } - else if (!message) { // empty message - cursor_pos = 0; - message = '\n\n' + sig; - } - else if (pos = rcmail.get_caret_pos(input_message.get(0))) { // at cursor position + // in place of removed signature + if (p >= 0) { + message = message.substring(0, p) + sig + message.substring(p, message.length); + cursor_pos = p - 1; + } + // empty message + else if (!message) { + message = '\n\n' + sig; + cursor_pos = 0; + } + else if (rcmail.env.top_posting && !rcmail.env.sig_below) { + // at cursor position + if (pos = rcmail.get_caret_pos(input_message.get(0))) { message = message.substring(0, pos) + '\n' + sig + '\n\n' + message.substring(pos, message.length); cursor_pos = pos; } - else { // on top - cursor_pos = 0; + // on top + else { message = '\n\n' + sig + '\n\n' + message.replace(/^[\r\n]+/, ''); + cursor_pos = 0; } } else { message = message.replace(/[\r\n]+$/, ''); - cursor_pos = !rcmail.env.top_posting && message.length ? message.length+1 : 0; + cursor_pos = !rcmail.env.top_posting && message.length ? message.length + 1 : 0; message += '\n\n' + sig; } } - else + else { cursor_pos = rcmail.env.top_posting ? 0 : message.length; + } input_message.val(message); @@ -528,24 +533,18 @@ function rcube_text_editor(config, id) sigElem = doc.createElement('div'); sigElem.setAttribute('id', '_rc_sig'); - if (rcmail.env.top_posting) { - // if no existing sig and top posting then insert at caret pos + if (rcmail.env.top_posting && !rcmail.env.sig_below) { this.editor.getWin().focus(); // correct focus in IE & Chrome var node = this.editor.selection.getNode(); - if (node.nodeName == 'BODY') { - // no real focus, insert at start - body.insertBefore(sigElem, body.firstChild); - body.insertBefore(doc.createElement('br'), body.firstChild); - } - else { - body.insertBefore(sigElem, node.nextSibling); - body.insertBefore(doc.createElement('br'), node.nextSibling); - } + + // insert at start or at cursor position if found + body.insertBefore(sigElem, node.nodeName == 'BODY' ? body.firstChild : node.nextSibling); + body.insertBefore(doc.createElement('p'), sigElem); } else { body.appendChild(sigElem); - position_element = $(sigElem).prev(); + position_element = rcmail.env.top_posting ? body.firstChild : $(sigElem).prev(); } } diff --git a/program/localization/en_US/labels.inc b/program/localization/en_US/labels.inc index fac52ba1e..8202b140d 100644 --- a/program/localization/en_US/labels.inc +++ b/program/localization/en_US/labels.inc @@ -509,6 +509,7 @@ $labels['autoaddsignature'] = 'Automatically add signature'; $labels['newmessageonly'] = 'new message only'; $labels['replyandforwardonly'] = 'replies and forwards only'; $labels['insertsignature'] = 'Insert signature'; +$labels['sigbelow'] = 'Place signature below the quoted message'; $labels['previewpanemarkread'] = 'Mark previewed messages as read'; $labels['afternseconds'] = 'after $n seconds'; $labels['reqmdn'] = 'Always request a return receipt'; diff --git a/program/steps/mail/compose.inc b/program/steps/mail/compose.inc index ba6f334c9..5009c525a 100644 --- a/program/steps/mail/compose.inc +++ b/program/steps/mail/compose.inc @@ -91,6 +91,7 @@ $OUTPUT->set_env('compose_id', $COMPOSE['id']); $OUTPUT->set_env('session_id', session_id()); $OUTPUT->set_env('mailbox', $RCMAIL->storage->get_folder()); $OUTPUT->set_env('top_posting', intval($RCMAIL->config->get('reply_mode')) > 0); +$OUTPUT->set_env('sig_below', $RCMAIL->config->get('sig_below')); $OUTPUT->set_env('recipients_separator', trim($RCMAIL->config->get('recipients_separator', ','))); $OUTPUT->set_env('save_localstorage', (bool)$RCMAIL->config->get('compose_save_localstorage')); $OUTPUT->set_env('is_sent', false); @@ -612,8 +613,10 @@ function rcmail_compose_header_from($attrib) if (count($MESSAGE->identities)) { $a_signatures = array(); $identities = array(); - $separator = intval($RCMAIL->config->get('reply_mode')) > 0 - && ($compose_mode == RCUBE_COMPOSE_REPLY || $compose_mode == RCUBE_COMPOSE_FORWARD) ? '---' : '-- '; + $top_posting = intval($RCMAIL->config->get('reply_mode')) > 0 + && !$RCMAIL->config->get('sig_below') + && ($compose_mode == RCUBE_COMPOSE_REPLY || $compose_mode == RCUBE_COMPOSE_FORWARD); + $separator = $top_posting ? '---' : '-- '; $field_attrib['onchange'] = rcmail_output::JS_OBJECT_NAME.".change_identity(this)"; $select_from = new html_select($field_attrib); diff --git a/program/steps/settings/func.inc b/program/steps/settings/func.inc index 46aed3019..c763dd39a 100644 --- a/program/steps/settings/func.inc +++ b/program/steps/settings/func.inc @@ -845,6 +845,20 @@ function rcmail_user_prefs($current = null) ); } + if (!isset($no_override['sig_below'])) { + if (!$current) { + continue 2; + } + + $field_id = 'rcmfd_sig_below'; + $input = new html_checkbox(array('name' => '_sig_below', 'id' => $field_id, 'value' => 1)); + + $blocks['sig']['options']['sig_below'] = array( + 'title' => html::label($field_id, rcube::Q($RCMAIL->gettext('sigbelow'))), + 'content' => $input->show($RCMAIL->config->get('sig_below') ? 1 : 0), + ); + } + if (!isset($no_override['strip_existing_sig'])) { if (!$current) { continue 2; diff --git a/program/steps/settings/save_prefs.inc b/program/steps/settings/save_prefs.inc index f0ce9c9a3..4ecaa70e6 100644 --- a/program/steps/settings/save_prefs.inc +++ b/program/steps/settings/save_prefs.inc @@ -85,6 +85,7 @@ case 'compose': 'spellcheck_ignore_caps' => isset($_POST['_spellcheck_ignore_caps']) ? true : false, 'show_sig' => isset($_POST['_show_sig']) ? intval($_POST['_show_sig']) : 1, 'reply_mode' => isset($_POST['_reply_mode']) ? intval($_POST['_reply_mode']) : 0, + 'sig_below' => isset($_POST['_sig_below']) ? true : false, 'strip_existing_sig' => isset($_POST['_strip_existing_sig']), 'default_font' => rcube_utils::get_input_value('_default_font', rcube_utils::INPUT_POST), 'default_font_size' => rcube_utils::get_input_value('_default_font_size', rcube_utils::INPUT_POST), -- cgit v1.2.3 From 1aa0c8ad66595d17bc70757fe35d5130d7783a20 Mon Sep 17 00:00:00 2001 From: Aleksander Machniak Date: Sun, 19 Apr 2015 19:17:51 +0200 Subject: Fix bug where preview_pane setting wasn't always saved into user preferences (#1490362) --- CHANGELOG | 1 + program/steps/mail/show.inc | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) (limited to 'program/steps') diff --git a/CHANGELOG b/CHANGELOG index 39c6071aa..0a2412569 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -21,6 +21,7 @@ CHANGELOG Roundcube Webmail - Fix bug where forced extwin page reload could exit from the extwin mode (#1490350) - Fix bug where some unrelated attachments in multipart/related message were not listed (#1490355) - Fix mouseup event handling when dragging a list record (#1490359) +- Fix bug where preview_pane setting wasn't always saved into user preferences (#1490362) RELEASE 1.1.1 ------------- diff --git a/program/steps/mail/show.inc b/program/steps/mail/show.inc index 747cbc2a0..a09a690f2 100644 --- a/program/steps/mail/show.inc +++ b/program/steps/mail/show.inc @@ -185,8 +185,12 @@ if (!empty($set_seen_flag)) { } } -exit; +// Save preview_pane preference, if not set yet (#1490362) +if ($RCMAIL->action == 'preview' && !$RCMAIL->config->get('preview_pane')) { + $RCMAIL->user->save_prefs(array('preview_pane' => true)); +} +exit; function rcmail_message_attachments($attrib) -- cgit v1.2.3