From 1e9a59ab89ed69d4bf3cd2d306e1c3f8821f4018 Mon Sep 17 00:00:00 2001 From: Thomas Bruederli Date: Tue, 8 Apr 2014 14:38:54 +0200 Subject: Don't remove messages from list when moving to another folder in multi-folder search mode, just update the list --- program/lib/Roundcube/rcube_ldap.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'program/lib') diff --git a/program/lib/Roundcube/rcube_ldap.php b/program/lib/Roundcube/rcube_ldap.php index 55a64acec..64fa45bc2 100644 --- a/program/lib/Roundcube/rcube_ldap.php +++ b/program/lib/Roundcube/rcube_ldap.php @@ -377,10 +377,11 @@ class rcube_ldap extends rcube_addressbook // replace placeholders in filter settings if (!empty($this->prop['filter'])) $this->prop['filter'] = strtr($this->prop['filter'], $replaces); - if (!empty($this->prop['groups']['filter'])) - $this->prop['groups']['filter'] = strtr($this->prop['groups']['filter'], $replaces); - if (!empty($this->prop['groups']['member_filter'])) - $this->prop['groups']['member_filter'] = strtr($this->prop['groups']['member_filter'], $replaces); + + foreach (array('base_dn','filter','member_filter') as $k) { + if (!empty($this->prop['groups'][$k])) + $this->prop['groups'][$k] = strtr($this->prop['groups'][$k], $replaces); + } if (!empty($this->prop['group_filters'])) { foreach ($this->prop['group_filters'] as $i => $gf) { -- cgit v1.2.3 From 94e797c1fbc5ae1ce3c57bdc5cdaabd3a9f8f911 Mon Sep 17 00:00:00 2001 From: Thomas Bruederli Date: Tue, 8 Apr 2014 15:17:19 +0200 Subject: Consider sort order in UID sort mode of multi-folder search results --- program/lib/Roundcube/rcube_imap.php | 4 ++++ program/lib/Roundcube/rcube_result_multifolder.php | 11 +++++++++++ 2 files changed, 15 insertions(+) (limited to 'program/lib') diff --git a/program/lib/Roundcube/rcube_imap.php b/program/lib/Roundcube/rcube_imap.php index 23cacd4d2..a2f610a0a 100644 --- a/program/lib/Roundcube/rcube_imap.php +++ b/program/lib/Roundcube/rcube_imap.php @@ -988,6 +988,10 @@ class rcube_imap extends rcube_storage $a_msg_headers = array_slice(array_values($a_msg_headers), $from, $slice_length); } else { + if ($this->sort_order != $search_set->get_parameters('ORDER')) { + $search_set->revert(); + } + // slice resultset first... $fetch = array(); foreach (array_slice($search_set->get(), $from, $slice_length) as $msg_id) { diff --git a/program/lib/Roundcube/rcube_result_multifolder.php b/program/lib/Roundcube/rcube_result_multifolder.php index 74a3d7805..b5473b841 100644 --- a/program/lib/Roundcube/rcube_result_multifolder.php +++ b/program/lib/Roundcube/rcube_result_multifolder.php @@ -130,6 +130,17 @@ class rcube_result_multifolder public function revert() { $this->order = $this->order == 'ASC' ? 'DESC' : 'ASC'; + $this->index = array(); + + // revert order in all sub-sets + foreach ($this->sets as $set) { + if ($this->order != $set->get_parameters('ORDER')) { + $set->revert(); + } + $folder = $set->get_parameters('MAILBOX'); + $index = array_map(function($uid) use ($folder) { return $uid . '-' . $folder; }, $set->get()); + $this->index = array_merge($this->index, $index); + } } -- cgit v1.2.3 From 188247894f6aff3a11f68bbdf94626b8bf58b852 Mon Sep 17 00:00:00 2001 From: Thomas Bruederli Date: Tue, 8 Apr 2014 19:11:12 +0200 Subject: Make multi-folder message identifiers work with folders containing commas --- program/include/rcmail.php | 10 +++++++--- program/js/app.js | 5 +++-- program/lib/Roundcube/rcube_imap.php | 4 ++-- program/lib/Roundcube/rcube_message.php | 2 +- program/steps/mail/copy.inc | 7 +++++-- program/steps/mail/func.inc | 2 +- program/steps/mail/mark.inc | 4 +++- 7 files changed, 22 insertions(+), 12 deletions(-) (limited to 'program/lib') diff --git a/program/include/rcmail.php b/program/include/rcmail.php index 2ccad03c6..5da181438 100644 --- a/program/include/rcmail.php +++ b/program/include/rcmail.php @@ -2025,8 +2025,9 @@ class rcmail extends rcube $_uid = $uids ?: rcube_utils::get_input_value('_uid', RCUBE_INPUT_GPC); $_mbox = $mbox ?: (string)rcube_utils::get_input_value('_mbox', RCUBE_INPUT_GPC); - if (is_array($uid)) { - return $uid; + // already a hash array + if (is_array($_uid) && !isset($_uid[0])) { + return $_uid; } $result = array(); @@ -2040,8 +2041,11 @@ class rcmail extends rcube } } else { + if (is_string($_uid)) + $_uid = explode(',', $_uid); + // create a per-folder UIDs array - foreach (explode(',', $_uid) as $uid) { + foreach ((array)$_uid as $uid) { list($uid, $mbox) = explode('-', $uid, 2); if (empty($mbox)) $mbox = $_mbox; diff --git a/program/js/app.js b/program/js/app.js index 952c542a0..7f19382e0 100644 --- a/program/js/app.js +++ b/program/js/app.js @@ -3014,7 +3014,8 @@ function rcube_webmail() var icn_src, uid, i, len, rows = this.message_list ? this.message_list.rows : {}; - uids = String(uids).split(','); + if (typeof uids == 'string') + uids = String(uids).split(','); for (i=0, len=uids.length; i $uids) { - $copied += (int)$RCMAIL->storage->copy_message($uids, $target, $mbox); + if ($mbox == $target) + $copied++; + else + $copied += (int)$RCMAIL->storage->copy_message($uids, $target, $mbox); } if (!$copied) { diff --git a/program/steps/mail/func.inc b/program/steps/mail/func.inc index 630086a68..f711da3e1 100644 --- a/program/steps/mail/func.inc +++ b/program/steps/mail/func.inc @@ -69,7 +69,7 @@ if (!empty($_REQUEST['_search']) && isset($_SESSION['search']) } // remove mbox part from _uid -if (($_uid = get_input_value('_uid', RCUBE_INPUT_GPC)) && preg_match('/^\d+-[^,]+$/', $_uid)) { +if (($_uid = rcube_utils::get_input_value('_uid', RCUBE_INPUT_GPC)) && !is_array($_uid) && preg_match('/^\d+-.+/', $_uid)) { list($_uid, $mbox) = explode('-', $_uid, 2); if (isset($_GET['_uid'])) $_GET['_uid'] = $_uid; if (isset($_POST['_uid'])) $_POST['_uid'] = $_uid; diff --git a/program/steps/mail/mark.inc b/program/steps/mail/mark.inc index e81f6c9f5..4e83f975c 100644 --- a/program/steps/mail/mark.inc +++ b/program/steps/mail/mark.inc @@ -68,7 +68,9 @@ if (($_uids = rcube_utils::get_input_value('_uid', rcube_utils::INPUT_POST)) if ($flag == 'DELETED' && $read_deleted && !empty($_POST['_ruid'])) { $ruids = rcube_utils::get_input_value('_ruid', rcube_utils::INPUT_POST); - $read = $RCMAIL->storage->set_flag($ruids, 'SEEN'); + foreach (rcmail::get_uids($ruids) as $mbox => $uids) { + $read += (int)$RCMAIL->storage->set_flag($uids, 'SEEN', $mbox); + } if ($read && !$skip_deleted) { $OUTPUT->command('flag_deleted_as_read', $ruids); -- cgit v1.2.3 From bc088fdc907d1d88982429608e7d75507feee784 Mon Sep 17 00:00:00 2001 From: Aleksander Machniak Date: Tue, 8 Apr 2014 20:10:54 +0200 Subject: Hide PHP Warning: substr_compare() The length cannot exceed initial string length --- program/lib/Roundcube/html.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'program/lib') diff --git a/program/lib/Roundcube/html.php b/program/lib/Roundcube/html.php index 64324dd8e..f47ef299a 100644 --- a/program/lib/Roundcube/html.php +++ b/program/lib/Roundcube/html.php @@ -285,7 +285,7 @@ class html // ignore not allowed attributes if (!empty($allowed)) { - $is_data_attr = substr_compare($key, 'data-', 0, 5) === 0; + $is_data_attr = @substr_compare($key, 'data-', 0, 5) === 0; if (!isset($allowed_f[$key]) && (!$is_data_attr || !isset($allowed_f['data-*']))) { continue; } -- cgit v1.2.3 From a2cf7c41b97a587d90188b83e4d15da1567a54b4 Mon Sep 17 00:00:00 2001 From: Thomas Bruederli Date: Wed, 9 Apr 2014 08:48:28 +0200 Subject: Fix accidental key replacements --- program/lib/Roundcube/rcube_ldap.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'program/lib') diff --git a/program/lib/Roundcube/rcube_ldap.php b/program/lib/Roundcube/rcube_ldap.php index 64fa45bc2..5a4b9dd61 100644 --- a/program/lib/Roundcube/rcube_ldap.php +++ b/program/lib/Roundcube/rcube_ldap.php @@ -95,8 +95,8 @@ class rcube_ldap extends rcube_addressbook if (empty($this->prop['groups']['scope'])) $this->prop['groups']['scope'] = 'sub'; // extend group objectclass => member attribute mapping - if (!empty($this->prop['groups']['event-panel-summary'])) - $this->group_types = array_merge($this->group_types, $this->prop['groups']['event-panel-summary']); + if (!empty($this->prop['groups']['class_member_attr'])) + $this->group_types = array_merge($this->group_types, $this->prop['groups']['class_member_attr']); // add group name attrib to the list of attributes to be fetched $fetch_attributes[] = $this->prop['groups']['name_attr']; -- cgit v1.2.3