alecpl
2008-11-17 14d953befcc7e8131bac266611fb1d990f7211bc
- optimization: don't set first/last/prev/next uids in preview/print mode


1 files modified
13 ■■■■■ changed files
program/steps/mail/show.inc 13 ●●●●● patch | view | raw | blame | history
program/steps/mail/show.inc
@@ -102,9 +102,11 @@
    }
  }
  $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 @@
  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 @@
    $OUTPUT->set_env('next_uid', $next);
  if ($last > 0)
    $OUTPUT->set_env('last_uid', $last);
    }
  // mark message as read
  if (!$MESSAGE->headers->seen)