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/5278/merge
Aleksander Machniak 9 years ago
parent 4cfe230e56
commit 0ce7c493a8

@ -15,6 +15,8 @@ CHANGELOG Roundcube Webmail
- Fix PHP warning when password_hosts is set, but is not an array (#5260) - 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 redundant keep-alive requests when session_lifetime is greater than ~20000 (#5273)
- Fix so subfolders of INBOX can be set as Archive (#5274) - 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 RELEASE 1.2.0
------------- -------------

@ -2815,7 +2815,9 @@ class rcube_imap extends rcube_storage
} }
// INBOX should always be available // 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'); array_unshift($a_mboxes, 'INBOX');
} }
@ -2946,7 +2948,9 @@ class rcube_imap extends rcube_storage
} }
// INBOX should always be available // 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'); 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 natcasesort($mboxes); // we want natural alphabetic sorting of folders in the result set
} }
else if ($scope == 'sub') { else if ($scope == 'sub') {
$mboxes = $RCMAIL->storage->list_folders_subscribed($mbox, '*', 'mail'); $delim = $RCMAIL->storage->get_hierarchy_delimiter();
if ($mbox != 'INBOX' && $mboxes[0] == 'INBOX') { $mboxes = $RCMAIL->storage->list_folders_subscribed($mbox . $delim, '*', 'mail');
array_shift($mboxes); array_unshift($mboxes, $mbox);
}
} }
$result = $RCMAIL->storage->search($mboxes, $search_str, $imap_charset, $sort_column); $result = $RCMAIL->storage->search($mboxes, $search_str, $imap_charset, $sort_column);

Loading…
Cancel
Save