diff options
Diffstat (limited to 'program/steps')
-rw-r--r-- | program/steps/mail/list.inc | 3 | ||||
-rw-r--r-- | program/steps/mail/search.inc | 20 |
2 files changed, 14 insertions, 9 deletions
diff --git a/program/steps/mail/list.inc b/program/steps/mail/list.inc index 36c79fb29..c4a6df57b 100644 --- a/program/steps/mail/list.inc +++ b/program/steps/mail/list.inc @@ -60,11 +60,12 @@ $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_filter']); + $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']); } // fetch message headers diff --git a/program/steps/mail/search.inc b/program/steps/mail/search.inc index c97e3ac5a..813e8c492 100644 --- a/program/steps/mail/search.inc +++ b/program/steps/mail/search.inc @@ -41,7 +41,7 @@ $scope = rcube_utils::get_input_value('_scope', rcube_utils::INPUT_GET); $subject = array(); $filter = trim($filter); -$search_request = md5($mbox.$filter.$str); +$search_request = md5($mbox.$scope.$filter.$str); // add list filter string $search_str = $filter && $filter != 'ALL' ? $filter : ''; @@ -105,7 +105,13 @@ if (!empty($subject)) { foreach ($subject as $sub) { $search_str .= ' ' . $sub . ' ' . rcube_imap_generic::escape($search); } +} + +$search_str = trim($search_str); +$sort_column = rcmail_sort_column(); +// execute IMAP search +if ($search_str) { // search all, current or subfolders folders if ($scope == 'all') { $mboxes = $RCMAIL->storage->list_folders_subscribed('', '*', 'mail', null, true); @@ -116,14 +122,8 @@ if (!empty($subject)) { if ($mbox != 'INBOX' && $mboxes[0] == 'INBOX') array_shift($mboxes); } -} - -$search_str = trim($search_str); -$sort_column = rcmail_sort_column(); -// execute IMAP search -if ($search_str) { - $RCMAIL->storage->search($mboxes, $search_str, $imap_charset, $sort_column); + $result = $RCMAIL->storage->search($mboxes, $search_str, $imap_charset, $sort_column); } // Get the headers @@ -162,10 +162,14 @@ else if ($err_code = $RCMAIL->storage->get_error_code()) { } else { $OUTPUT->show_message('searchnomatch', 'notice'); + $OUTPUT->set_env('multifolder_listing', (bool)$result->multi); + if ($result->multi && $scope == 'all') + $OUTPUT->command('select_folder', ''); } // update message count display $OUTPUT->set_env('search_request', $search_str ? $search_request : ''); +$OUTPUT->set_env('search_filter', $_SESSION['search_filter']); $OUTPUT->set_env('threading', $RCMAIL->storage->get_threading()); $OUTPUT->set_env('messagecount', $count); $OUTPUT->set_env('pagecount', ceil($count/$RCMAIL->storage->get_pagesize())); |