source: subversion/trunk/roundcubemail/program/steps/mail/list.inc @ 1735

Last change on this file since 1735 was 1735, checked in by thomasb, 5 years ago

Killed one more global var + log logins to a separate file (not console)

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 2.5 KB
Line 
1<?php
2
3/*
4 +-----------------------------------------------------------------------+
5 | program/steps/mail/list.inc                                           |
6 |                                                                       |
7 | This file is part of the RoundCube Webmail client                     |
8 | Copyright (C) 2005-2007, RoundCube Dev. - Switzerland                 |
9 | Licensed under the GNU GPL                                            |
10 |                                                                       |
11 | PURPOSE:                                                              |
12 |   Send message list to client (as remote response)                    |
13 |                                                                       |
14 +-----------------------------------------------------------------------+
15 | Author: Thomas Bruederli <roundcube@gmail.com>                        |
16 +-----------------------------------------------------------------------+
17
18 $Id$
19
20*/
21
22// is there a sort type for this request?
23if ($sort = get_input_value('_sort', RCUBE_INPUT_GET))
24{
25  // yes, so set the sort vars
26  list($sort_col, $sort_order) = explode('_', $sort);
27
28  // set session vars for sort (so next page and task switch know how to sort)
29  $_SESSION['sort_col'] = $sort_col;
30  $_SESSION['sort_order'] = $sort_order;
31}
32else
33{
34  // use session settings if set, defaults if not
35  $sort_col   = isset($_SESSION['sort_col'])   ? $_SESSION['sort_col']   : $CONFIG['message_sort_col'];
36  $sort_order = isset($_SESSION['sort_order']) ? $_SESSION['sort_order'] : $CONFIG['message_sort_order'];
37}
38
39$mbox_name = $IMAP->get_mailbox_name();
40
41// fetch message headers
42if ($IMAP->messagecount($mbox_name, 'ALL', !empty($_REQUEST['_refresh'])))
43  $a_headers = $IMAP->list_headers($mbox_name, NULL, $sort_col, $sort_order);
44
45$count = $IMAP->messagecount($mbox_name);
46$unseen = $IMAP->messagecount($mbox_name, 'UNSEEN', !empty($_REQUEST['_refresh']));
47
48// update message count display
49$pages = ceil($count/$IMAP->page_size);
50$OUTPUT->set_env('messagecount', $count);
51$OUTPUT->set_env('pagecount', $pages);
52$OUTPUT->command('set_rowcount', rcmail_get_messagecount_text($count));
53$OUTPUT->command('set_mailboxname', rcmail_get_mailbox_name_text());
54
55
56
57// add message rows
58if (isset($a_headers) && count($a_headers))
59  rcmail_js_message_list($a_headers);
60else
61  $OUTPUT->show_message('nomessagesfound', 'notice');
62 
63// update mailboxlist
64$OUTPUT->command('set_unread_count', $mbox_name, $unseen, ($mbox_name == 'INBOX'));
65
66// send response
67$OUTPUT->send();
68
69?>
Note: See TracBrowser for help on using the repository browser.