\n";
+}
+
+/*
+ * This function loops through a group of messages in the mailbox
+ * and shows them to the user.
+ */
+function showMessagesForMailbox($imapConnection, $mailbox, $num_msgs,
+ $start_msg, $sort, $color, $show_num,
+ $use_cache) {
+ global $msgs, $msort,
+ $sent_folder, $draft_folder,
+ $message_highlight_list,
+ $auto_expunge, $thread_sort_messages, $allow_server_sort,
+ $data_dir, $username, $server_sort_order;
+
+ /* if $start_msg is lower than $num_msgs, we probably deleted all messages
+ * in the last page. We need to re-adjust the start_msg
+ */
- for ($i=0; $i < count($message_highlight_list); $i++) {
- if (trim($message_highlight_list[$i]['value']) != '') {
- if ($message_highlight_list[$i]['match_type'] == 'to_cc') {
- if (strpos('^^'.strtolower($msg['TO']), strtolower($message_highlight_list[$i]['value'])) || strpos('^^'.strtolower($msg['CC']), strtolower($message_highlight_list[$i]['value']))) {
- $hlt_color = $message_highlight_list[$i]['color'];
- continue;
- }
- } else if (strpos('^^'.strtolower($msg[strtoupper($message_highlight_list[$i]['match_type'])]),strtolower($message_highlight_list[$i]['value']))) {
- $hlt_color = $message_highlight_list[$i]['color'];
- continue;
- }
- }
- }
+ if($start_msg > $num_msgs) {
+ $start_msg -= $show_num;
+ if($start_msg < 1) {
+ $start_msg = 1;
+ }
+ }
- if (!isset($hlt_color)) {
- $hlt_color = $color_string;
+ /* 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) {
+ $id = get_thread_sort($imapConnection);
+ if ($id == 'no') {
+ echo '
Thread sorting is not'.
+ ' supported by your IMAP server. Please report this'.
+ ' to the system administrator.
";
- /** End of message-list table */
-
- do_hook('mailbox_index_after');
- echo "\n";
- }
-
- /**
- * Displays the standard message list header. To finish the table,
- * you need to do a "";
- *
- * $moveURL is the URL to submit the delete/move form to
- * $mailbox is the current mailbox
- * $sort is the current sorting method (-1 for no sorting available [searches])
- * $Message is a message that is centered on top of the list
- * $More is a second line that is left aligned
- */
- function mail_message_listing_beginning
- ($imapConnection, $moveURL, $mailbox = '', $sort = -1,
- $msg_cnt_str = '', $paginator = '', $start_msg = 1) {
- global $color, $index_order, $auto_expunge, $move_to_trash;
- global $checkall, $sent_folder, $draft_folder;
- $urlMailbox = urlencode($mailbox);
-
- /****************************************************
- * This is the beginning of the message list table. *
- * It wraps around all messages *
- ****************************************************/
- echo "
\n";
-
- echo "
";
- echo "
\n";
- echo "
$paginator
\n";
- echo '
' . get_selectall_link($start_msg, $sort) . "
\n";
- echo "
$msg_cnt_str
\n";
- echo "
\n";
- echo "
";
-
- /** The delete and move options */
- echo "
";
-
- echo "\n
";
+ /* End of message-list table */
+
+ do_hook('mailbox_index_after');
+ echo "\n";
+}
+
+/*
+ * Displays the standard message list header. To finish the table,
+ * you need to do a "";
+ *
+ * $moveURL is the URL to submit the delete/move form to
+ * $mailbox is the current mailbox
+ * $sort is the current sorting method (-1 for no sorting available [searches])
+ * $Message is a message that is centered on top of the list
+ * $More is a second line that is left aligned
+ */
+
+function mail_message_listing_beginning ($imapConnection, $moveURL,
+ $mailbox = '', $sort = -1,
+ $msg_cnt_str = '',
+ $paginator = ' ',
+ $start_msg = 1) {
+ global $color, $index_order, $auto_expunge, $move_to_trash, $base_uri,
+ $checkall, $sent_folder, $draft_folder, $thread_sort_messages,
+ $allow_thread_sort, $allow_server_sort, $server_sort_order,
+ $lastTargetMailbox;
+
+ $urlMailbox = urlencode($mailbox);
+
+ /*
+ * This is the beginning of the message list table.
+ * It wraps around all messages
+ */
+ echo "