summaryrefslogtreecommitdiff
path: root/program/steps
diff options
context:
space:
mode:
Diffstat (limited to 'program/steps')
-rw-r--r--program/steps/mail/check_recent.inc6
-rw-r--r--program/steps/mail/func.inc25
-rw-r--r--program/steps/mail/list.inc15
-rw-r--r--program/steps/mail/mark.inc2
-rw-r--r--program/steps/mail/move_del.inc2
-rw-r--r--program/steps/mail/search.inc9
6 files changed, 34 insertions, 25 deletions
diff --git a/program/steps/mail/check_recent.inc b/program/steps/mail/check_recent.inc
index dfb58224d..aef5df7e1 100644
--- a/program/steps/mail/check_recent.inc
+++ b/program/steps/mail/check_recent.inc
@@ -40,8 +40,10 @@ foreach ($a_mailboxes as $mbox_name) {
// refresh saved search set
$search_request = get_input_value('_search', RCUBE_INPUT_GPC);
- if ($search_request && isset($_SESSION['search'][$search_request])) {
- $_SESSION['search'][$search_request] = $IMAP->refresh_search();
+ if ($search_request && isset($_SESSION['search'])
+ && $_SESSION['search_request'] == $search_request
+ ) {
+ $_SESSION['search'] = $IMAP->refresh_search();
}
if (!empty($_GET['_quota']))
diff --git a/program/steps/mail/func.inc b/program/steps/mail/func.inc
index 9a24a97c0..678dc0494 100644
--- a/program/steps/mail/func.inc
+++ b/program/steps/mail/func.inc
@@ -72,33 +72,32 @@ if (isset($_GET['_threads'])) {
$IMAP->set_threading($a_threading[$_SESSION['mbox']]);
// set message set for search result
-if (!empty($_REQUEST['_search']) && isset($_SESSION['search'][$_REQUEST['_search']]))
- {
- $IMAP->set_search_set($_SESSION['search'][$_REQUEST['_search']]);
+if (!empty($_REQUEST['_search']) && isset($_SESSION['search'])
+ && $_SESSION['search_request'] == $_REQUEST['_search']
+) {
+ $IMAP->set_search_set($_SESSION['search']);
$OUTPUT->set_env('search_request', $_REQUEST['_search']);
$OUTPUT->set_env('search_text', $_SESSION['last_text_search']);
- }
+}
// set main env variables, labels and page title
-if (empty($RCMAIL->action) || $RCMAIL->action == 'list')
- {
+if (empty($RCMAIL->action) || $RCMAIL->action == 'list') {
$mbox_name = $IMAP->get_mailbox_name();
- if (empty($RCMAIL->action))
- {
+ if (empty($RCMAIL->action)) {
// initialize searching result if search_filter is used
- if ($_SESSION['search_filter'] && $_SESSION['search_filter'] != 'ALL')
- {
+ if ($_SESSION['search_filter'] && $_SESSION['search_filter'] != 'ALL') {
$search_request = md5($mbox_name.$_SESSION['search_filter']);
$IMAP->search($mbox_name, $_SESSION['search_filter'], RCMAIL_CHARSET, $_SESSION['sort_col']);
- $_SESSION['search'][$search_request] = $IMAP->get_search_set();
+ $_SESSION['search'] = $IMAP->get_search_set();
+ $_SESSION['search_request'] = $search_request;
$OUTPUT->set_env('search_request', $search_request);
}
$search_mods = $RCMAIL->config->get('search_mods', $SEARCH_MODS_DEFAULT);
$OUTPUT->set_env('search_mods', $search_mods);
- }
+ }
// set current mailbox and some other vars in client environment
$OUTPUT->set_env('mailbox', $mbox_name);
@@ -135,7 +134,7 @@ if (empty($RCMAIL->action) || $RCMAIL->action == 'list')
'movingmessage', 'copyingmessage', 'copy', 'move', 'quota');
$OUTPUT->set_pagetitle(rcmail_localize_foldername($mbox_name));
- }
+}
/**
diff --git a/program/steps/mail/list.inc b/program/steps/mail/list.inc
index b5ee1b646..f5fc44bd4 100644
--- a/program/steps/mail/list.inc
+++ b/program/steps/mail/list.inc
@@ -58,7 +58,8 @@ if ($_SESSION['search_filter'] && $_SESSION['search_filter'] != 'ALL')
{
$search_request = md5($mbox_name.$_SESSION['search_filter']);
$IMAP->search($mbox_name, $_SESSION['search_filter'], RCMAIL_CHARSET, $sort_col);
- $_SESSION['search'][$search_request] = $IMAP->get_search_set();
+ $_SESSION['search'] = $IMAP->get_search_set();
+ $_SESSION['search_request'] = $search_request;
$OUTPUT->set_env('search_request', $search_request);
}
@@ -67,8 +68,16 @@ if ($count = $IMAP->messagecount($mbox_name, $IMAP->threading ? 'THREADS' : 'ALL
$a_headers = $IMAP->list_headers($mbox_name, NULL, $sort_col, $sort_order);
// update search set (possible change of threading mode)
-if (!empty($_REQUEST['_search']) && isset($_SESSION['search'][$_REQUEST['_search']]))
- $_SESSION['search'][$_REQUEST['_search']] = $IMAP->get_search_set();
+if (!empty($_REQUEST['_search']) && isset($_SESSION['search'])
+ && $_SESSION['search_request'] == $_REQUEST['_search']
+) {
+ $_SESSION['search'] = $IMAP->get_search_set();
+}
+// remove old search data
+else if (empty($_REQUEST['_search']) && isset($_SESSION['search'])) {
+ $RCMAIL->session->remove('search');
+}
+
// empty result? we'll skip UNSEEN counting in rcmail_send_unread_count()
if (empty($search_request) && empty($a_headers)) {
diff --git a/program/steps/mail/mark.inc b/program/steps/mail/mark.inc
index a24714e3a..9266cf404 100644
--- a/program/steps/mail/mark.inc
+++ b/program/steps/mail/mark.inc
@@ -72,7 +72,7 @@ if (($uids = get_input_value('_uid', RCUBE_INPUT_POST)) && ($flag = get_input_va
} else {
// refresh saved search set after moving some messages
if (($search_request = get_input_value('_search', RCUBE_INPUT_GPC)) && $IMAP->search_set) {
- $_SESSION['search'][$search_request] = $IMAP->refresh_search();
+ $_SESSION['search'] = $IMAP->refresh_search();
}
$msg_count = $IMAP->messagecount(NULL, $IMAP->threading ? 'THREADS' : 'ALL');
diff --git a/program/steps/mail/move_del.inc b/program/steps/mail/move_del.inc
index 365078283..5078fb02c 100644
--- a/program/steps/mail/move_del.inc
+++ b/program/steps/mail/move_del.inc
@@ -71,7 +71,7 @@ else {
// refresh saved search set after moving some messages
if (($search_request = get_input_value('_search', RCUBE_INPUT_GPC)) && $IMAP->search_set) {
- $_SESSION['search'][$search_request] = $IMAP->refresh_search();
+ $_SESSION['search'] = $IMAP->refresh_search();
}
if ($_POST['_from'] == 'show')
diff --git a/program/steps/mail/search.inc b/program/steps/mail/search.inc
index 1fc74dfe5..db46ce428 100644
--- a/program/steps/mail/search.inc
+++ b/program/steps/mail/search.inc
@@ -111,19 +111,18 @@ if (!is_array($_SESSION['search']))
$_SESSION['search'] = array();
if ($search_str) {
- $_SESSION['search'][$search_request] = $IMAP->get_search_set();
+ $_SESSION['search'] = $IMAP->get_search_set();
$_SESSION['last_text_search'] = $str;
}
+$_SESSION['search_request'] = $search_request;
// Make sure we got the headers
-if (!empty($result_h))
-{
+if (!empty($result_h)) {
rcmail_js_message_list($result_h);
if ($search_str)
$OUTPUT->show_message('searchsuccessful', 'confirmation', array('nr' => $IMAP->messagecount(NULL, 'ALL')));
}
-else
-{
+else {
$OUTPUT->show_message('searchnomatch', 'notice');
}