diff options
Diffstat (limited to 'program/steps/mail')
-rw-r--r-- | program/steps/mail/func.inc | 3 | ||||
-rw-r--r-- | program/steps/mail/search.inc | 13 |
2 files changed, 14 insertions, 2 deletions
diff --git a/program/steps/mail/func.inc b/program/steps/mail/func.inc index 45d4242f9..fd321e294 100644 --- a/program/steps/mail/func.inc +++ b/program/steps/mail/func.inc @@ -105,6 +105,9 @@ if (empty($RCMAIL->action) || $RCMAIL->action == 'list') { } $OUTPUT->set_env('search_mods', rcmail_search_mods()); + + if (!empty($_SESSION['search_scope'])) + $OUTPUT->set_env('search_scope', $_SESSION['search_scope']); } $threading = (bool) $RCMAIL->storage->get_threading(); diff --git a/program/steps/mail/search.inc b/program/steps/mail/search.inc index b45cdc0de..88bbe6eda 100644 --- a/program/steps/mail/search.inc +++ b/program/steps/mail/search.inc @@ -35,6 +35,7 @@ $str = rcube_utils::get_input_value('_q', rcube_utils::INPUT_GET, true); $mbox = rcube_utils::get_input_value('_mbox', rcube_utils::INPUT_GET, true); $filter = rcube_utils::get_input_value('_filter', rcube_utils::INPUT_GET); $headers = rcube_utils::get_input_value('_headers', rcube_utils::INPUT_GET); +$scope = rcube_utils::get_input_value('_scope', rcube_utils::INPUT_GET); $subject = array(); $search_request = md5($mbox.$filter.$str); @@ -106,8 +107,15 @@ if (!empty($subject)) { $search_str = trim($search_str); $sort_column = rcmail_sort_column(); -// TEMPORARY: search all folders -$mboxes = $RCMAIL->storage->list_folders_subscribed('', '*', 'mail'); +// search all, current or subfolders folders +if ($scope == 'all') { + $mboxes = $RCMAIL->storage->list_folders_subscribed('', '*', 'mail'); +} +else if ($scope == 'sub') { + $mboxes = $RCMAIL->storage->list_folders_subscribed($mbox, '*', 'mail'); + if ($mbox != 'INBOX' && $mboxes[0] == 'INBOX') + array_shift($mboxes); +} // execute IMAP search if ($search_str) { @@ -128,6 +136,7 @@ if ($search_str) { $_SESSION['last_text_search'] = $str; } $_SESSION['search_request'] = $search_request; +$_SESSION['search_scope'] = $scope; // Add 'folder' column to list if ($_SESSION['search'][1]->multi) { |