';
-
- mail_message_listing_beginning($imapConnection, $mailbox, $sort,
+ }
+
+ /* This code and the next if() block check for
+ * server-side sorting methods. The $id array is
+ * formatted and $sort is set to 6 to disable
+ * SM internal sorting
+ */
+
+ if ($thread_sort_messages == 1) {
+ $mode = 'thread';
+ } elseif ($allow_server_sort == 1) {
+ $mode = 'serversort';
+ } else {
+ $mode = '';
+ }
+
+ sqsession_unregister('msort');
+ sqsession_unregister('msgs');
+ switch ($mode) {
+ case 'thread':
+ $id = get_thread_sort($imapConnection);
+ $msgs = getServerMessages($imapConnection, $start_msg, $show_num, $num_msgs, $id);
+ if ($msgs === false) {
+ echo '' .
+ _("Thread sorting is not supported by your IMAP server. Please report this to the system administrator.").
+ '';
+ $thread_sort_messages = 0;
+ $msort = $msgs = array();
+ } else {
+ $msort= $msgs;
+ $sort = 6;
+ }
+ break;
+ case 'serversort':
+ $id = sqimap_get_sort_order($imapConnection, $sort, $mbxresponse);
+ $msgs = getServerMessages($imapConnection, $start_msg, $show_num, $num_msgs, $id);
+ if ($msgs === false) {
+ echo '' .
+ _( "Server-side sorting is not supported by your IMAP server. Please report this to the system administrator.").
+ '';
+ $sort = $server_sort_order;
+ $allow_server_sort = FALSE;
+ $msort = $msgs = array();
+ $id = array();
+ } else {
+ $msort = $msgs;
+ $sort = 6;
+ }
+ break;
+ default:
+ if (!$use_cache) {
+ $msgs = getSelfSortMessages($imapConnection, $start_msg, $show_num,
+ $num_msgs, $sort, $mbxresponse);
+ $msort = calc_msort($msgs, $sort);
+ } /* !use cache */
+ break;
+ } // switch
+ sqsession_register($msort, 'msort');
+ sqsession_register($msgs, 'msgs');
+ } /* if exists > 0 */
+
+ $res = getEndMessage($start_msg, $show_num, $num_msgs);
+ $start_msg = $res[0];
+ $end_msg = $res[1];
+
+ $paginator_str = get_paginator_str($mailbox, $start_msg, $end_msg,
+ $num_msgs, $show_num, $sort);
+
+ $msg_cnt_str = get_msgcnt_str($start_msg, $end_msg, $num_msgs);
+
+ do_hook('mailbox_index_before');
+ echo '';
+ echo '';
+
+ mail_message_listing_beginning($imapConnection, $mailbox, $sort,
$msg_cnt_str, $paginator_str, $start_msg);
- echo ' | ';
- echo ' | ';
- echo '';
- echo ' ';
- echo ' ';
- echo ' ';
- echo '';
- printHeader($mailbox, $srt, $color, !$thread_sort_messages);
-
- displayMessageArray($imapConnection, $num_msgs, $start_msg,
+ echo ' | ';
+ /* line between the button area and the list */
+ echo ' | ';
+
+ echo '';
+ echo ' ';
+ echo ' ';
+ echo ' ';
+ echo '';
+ printHeader($mailbox, $srt, $color, !$thread_sort_messages);
+
+ displayMessageArray($imapConnection, $num_msgs, $start_msg,
$msort, $mailbox, $sort, $color, $show_num,0,0);
- echo ' | | ';
+ echo ' | | ';
- mail_message_listing_end($num_msgs, $paginator_str, $msg_cnt_str, $color);
- echo ' | ';
+ mail_message_listing_end($num_msgs, $paginator_str, $msg_cnt_str, $color);
+ echo ' |