thomascube
2006-01-25 c9d09bbe43f268c11cadc9846652ff33521edf6c
program/steps/mail/list.inc
@@ -24,35 +24,23 @@
$unseen = $IMAP->messagecount($mbox, 'UNSEEN', !empty($_GET['_refresh']) ? TRUE : FALSE);
$count = $IMAP->messagecount();
$sort = isset($_GET['_sort']) ? $_GET['_sort'] : false;
// is there a sort type for this request?
if ($sort = isset($_GET['_sort']) ? $_GET['_sort'] : false)
if ($sort)
  {
  // yes, so set the sort vars
  list($sort_col, $sort_order) = explode('_', $sort);
  // iloha mail sort func doesn't know about a 'Sender' col
  $sort_col = $sort_col == 'Sender' ? 'From' : $sort_col;
  // set session vars for sort (so next page and task switch know how to sort)
  $_SESSION['sort_col'] = $sort_col;
  $_SESSION['sort_order'] = $sort_order;
  }
else
  {
  // if switching folder, use default sorting
  if ($_GET['_refresh'] == '1')
    {
    $sort_col   = 'date';
    $sort_order = 'desc';
    unset($_SESSION['sort_col'], $_SESSION['sort_order']);
    }
  else
    {
    // use session settings if set, defaults if not
    $sort_col   = isset($_SESSION['sort_col'])   ? $_SESSION['sort_col']   : 'date';
    $sort_order = isset($_SESSION['sort_order']) ? $_SESSION['sort_order'] : 'desc';
    }
  {
  // use session settings if set, defaults if not
  $sort_col   = isset($_SESSION['sort_col'])   ? $_SESSION['sort_col']   : $CONFIG['message_sort_col'];
  $sort_order = isset($_SESSION['sort_order']) ? $_SESSION['sort_order'] : $CONFIG['message_sort_order'];
  }