diff options
author | alecpl <alec@alec.pl> | 2009-06-10 12:07:55 +0000 |
---|---|---|
committer | alecpl <alec@alec.pl> | 2009-06-10 12:07:55 +0000 |
commit | 2dd7ee346fdc014b536de8cbbfe7630bac73a43b (patch) | |
tree | 3c91450eb41baadc858599713fabd3fa2b65c963 /program/steps/mail/show.inc | |
parent | 737f0da348f78b02eafa9607fb2a1d9adc8e569b (diff) |
- Fixed many 'skip_deleted' issues (#1485634)
- Fixed messages list sorting on servers without SORT capability
- some preformance improvements
Diffstat (limited to 'program/steps/mail/show.inc')
-rw-r--r-- | program/steps/mail/show.inc | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/program/steps/mail/show.inc b/program/steps/mail/show.inc index 9beb42521..6ab5ba86a 100644 --- a/program/steps/mail/show.inc +++ b/program/steps/mail/show.inc @@ -98,20 +98,8 @@ if ($_GET['_uid']) { { $next = $prev = $first = $last = -1; - if ((!($_SESSION['sort_col'] == 'date' && $_SESSION['sort_order'] == 'DESC') && - $IMAP->get_capability('sort')) || !empty($_REQUEST['_search'])) - { - // Only if we use custom sorting - $a_msg_index = $IMAP->message_index(NULL, $_SESSION['sort_col'], $_SESSION['sort_order']); - - $MESSAGE->index = array_search($IMAP->get_id($MESSAGE->uid), $a_msg_index); - - $prev = isset($a_msg_index[$MESSAGE->index-1]) ? $IMAP->get_uid($a_msg_index[$MESSAGE->index-1]) : -1 ; - $first = count($a_msg_index)>0 ? $IMAP->get_uid($a_msg_index[0]) : -1; - $next = isset($a_msg_index[$MESSAGE->index+1]) ? $IMAP->get_uid($a_msg_index[$MESSAGE->index+1]) : -1 ; - $last = count($a_msg_index)>0 ? $IMAP->get_uid($a_msg_index[count($a_msg_index)-1]) : -1; - } - else + if ($_SESSION['sort_col'] == 'date' && $_SESSION['sort_order'] != 'DESC' + && empty($_REQUEST['_search']) && !$IMAP->skip_deleted) { // this assumes that we are sorted by date_DESC $cnt = $IMAP->messagecount(); @@ -123,6 +111,18 @@ if ($_GET['_uid']) { $next = $IMAP->get_uid($seq - 1); $last = $IMAP->get_uid(1); } + else + { + // Only if we use custom sorting + $a_msg_index = $IMAP->message_index(NULL, $_SESSION['sort_col'], $_SESSION['sort_order']); + + $MESSAGE->index = array_search($IMAP->get_id($MESSAGE->uid), $a_msg_index); + + $prev = isset($a_msg_index[$MESSAGE->index-1]) ? $IMAP->get_uid($a_msg_index[$MESSAGE->index-1]) : -1 ; + $first = count($a_msg_index)>0 ? $IMAP->get_uid($a_msg_index[0]) : -1; + $next = isset($a_msg_index[$MESSAGE->index+1]) ? $IMAP->get_uid($a_msg_index[$MESSAGE->index+1]) : -1 ; + $last = count($a_msg_index)>0 ? $IMAP->get_uid($a_msg_index[count($a_msg_index)-1]) : -1; + } if ($prev > 0) $OUTPUT->set_env('prev_uid', $prev); |