- optimization: don't set first/last/prev/next uids in preview/print mode

release-0.6
alecpl 16 years ago
parent 14de18d5f4
commit 14d953befc

@ -102,9 +102,11 @@ if ($_GET['_uid']) {
}
}
$next = $prev = $first = $last = -1;
// get previous, first, next and last message UID
if ($RCMAIL->action != 'preview' && $RCMAIL->action != 'print')
{
$next = $prev = $first = $last = -1;
if ((!($_SESSION['sort_col'] == 'date' && $_SESSION['sort_order'] == 'DESC') &&
$IMAP->get_capability('sort')) || !empty($_REQUEST['_search']))
{
@ -121,12 +123,14 @@ if ($_GET['_uid']) {
else
{
// this assumes that we are sorted by date_DESC
$cnt = $IMAP->messagecount();
$seq = $IMAP->get_id($MESSAGE->uid);
$MESSAGE->index = $cnt - $seq;
$prev = $IMAP->get_uid($seq + 1);
$first = $IMAP->get_uid($IMAP->messagecount());
$first = $IMAP->get_uid($cnt);
$next = $IMAP->get_uid($seq - 1);
$last = $IMAP->get_uid(1);
$MESSAGE->index = $IMAP->messagecount() - $seq;
}
if ($prev > 0)
@ -137,6 +141,7 @@ if ($_GET['_uid']) {
$OUTPUT->set_env('next_uid', $next);
if ($last > 0)
$OUTPUT->set_env('last_uid', $last);
}
// mark message as read
if (!$MESSAGE->headers->seen)

Loading…
Cancel
Save