Fix multi-folder search issues in "this and subfolders" scope (#5282, #5259)

- Fix bug where multi-folder search could choose a wrong folder
- Fix bug where multi-folder search didn't work for unsubscribed INBOX
pull/5754/head
Aleksander Machniak 8 years ago
parent 6987153469
commit e660f157c0

@ -8,6 +8,8 @@ CHANGELOG Roundcube Webmail
- Fix PHP warning when password_hosts is set, but is not an array (#5260)
- Fix redundant keep-alive requests when session_lifetime is greater than ~20000 (#5273)
- Fix so subfolders of INBOX can be set as Archive (#5274)
- Fix bug where multi-folder search could choose a wrong folder in "this and subfolders" scope (#5282)
- Fix bug where multi-folder search didn't work for unsubscribed INBOX (#5259)
RELEASE 1.2.0
-------------

@ -2811,7 +2811,9 @@ class rcube_imap extends rcube_storage
}
// INBOX should always be available
if (!strlen($root) && (!$filter || $filter == 'mail') && !in_array('INBOX', $a_mboxes)) {
if (in_array_nocase($root . $name, array('*', '%', 'INBOX', 'INBOX*'))
&& (!$filter || $filter == 'mail') && !in_array('INBOX', $a_mboxes)
) {
array_unshift($a_mboxes, 'INBOX');
}
@ -2942,7 +2944,9 @@ class rcube_imap extends rcube_storage
}
// INBOX should always be available
if (!strlen($root) && (!$filter || $filter == 'mail') && !in_array('INBOX', $a_mboxes)) {
if (in_array_nocase($root . $name, array('*', '%', 'INBOX', 'INBOX*'))
&& (!$filter || $filter == 'mail') && !in_array('INBOX', $a_mboxes)
) {
array_unshift($a_mboxes, 'INBOX');
}

@ -129,10 +129,9 @@ if ($search_str) {
natcasesort($mboxes); // we want natural alphabetic sorting of folders in the result set
}
else if ($scope == 'sub') {
$mboxes = $RCMAIL->storage->list_folders_subscribed($mbox, '*', 'mail');
if ($mbox != 'INBOX' && $mboxes[0] == 'INBOX') {
array_shift($mboxes);
}
$delim = $RCMAIL->storage->get_hierarchy_delimiter();
$mboxes = $RCMAIL->storage->list_folders_subscribed($mbox . $delim, '*', 'mail');
array_unshift($mboxes, $mbox);
}
$result = $RCMAIL->storage->search($mboxes, $search_str, $imap_charset, $sort_column);

Loading…
Cancel
Save