diff --git a/CHANGELOG b/CHANGELOG index 07a20304a..d2a5c5223 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -15,6 +15,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 ------------- diff --git a/program/lib/Roundcube/rcube_imap.php b/program/lib/Roundcube/rcube_imap.php index 0d9227307..6379ee40a 100644 --- a/program/lib/Roundcube/rcube_imap.php +++ b/program/lib/Roundcube/rcube_imap.php @@ -2815,7 +2815,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'); } @@ -2946,7 +2948,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'); } diff --git a/program/steps/mail/search.inc b/program/steps/mail/search.inc index ee6ba8816..64763d928 100644 --- a/program/steps/mail/search.inc +++ b/program/steps/mail/search.inc @@ -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);