";
- echo "";
- echo "";
- echo " | ";
- /** FROM HEADER **/
- if ($mailbox == $sent_folder)
- echo " ". _("To") ."";
- else
- echo " | ". _("From") ."";
-
- if ($sort == 2)
- echo " | \n";
- else if ($sort == 3)
- echo " \n";
- else
- echo " \n";
- /** DATE HEADER **/
- echo " ". _("Date") ."";
- if ($sort == 0)
- echo " | \n";
- else if ($sort == 1)
- echo " \n";
- else
- echo " \n";
- echo " | \n";
- /** SUBJECT HEADER **/
- echo " ". _("Subject") ."\n";
- if ($sort == 4)
- echo " | \n";
- else if ($sort == 5)
- echo " \n";
- else
- echo " \n";
-
- echo " ";
-
-
- // loop through and display the info for each message.
- $t = 0; // $t is used for the checkbox number
- if ($numMessages == 0) { // if there's no messages in this folder
- echo " ". _("THIS FOLDER IS EMPTY") ." | ";
- } else if ($startMessage == $endMessage) { // if there's only one message in the box, handle it different.
- $i = $startMessage - 1;
- reset($msort);
- do {
+ }
+ }
+ return $msort;
+}
+
+function fillMessageArray($imapConnection, $id, $count) {
+ return sqimap_get_small_header_list($imapConnection, $id);
+}
+
+
+/* Generic function to convert the msgs array into an HTML table. */
+function displayMessageArray($imapConnection, $num_msgs, $start_msg,
+ $msort, $mailbox, $sort, $color,
+ $show_num, $where=0, $what=0) {
+ global $imapServerAddress, $use_mailbox_cache, $index_order,
+ $indent_array, $thread_sort_messages, $allow_server_sort,
+ $server_sort_order, $PHP_SELF;
+
+ $res = getEndMessage($start_msg, $show_num, $num_msgs);
+ $start_msg = $res[0];
+ $end_msg = $res[1];
+
+ $urlMailbox = urlencode($mailbox);
+
+ /* get indent level for subject display */
+ if ($thread_sort_messages == 1 && $num_msgs) {
+ $indent_array = get_parent_level($imapConnection);
+ }
+
+ $real_startMessage = $start_msg;
+ if ($sort == 6) {
+ if ($end_msg - $start_msg < $show_num - 1) {
+ $end_msg = $end_msg - $start_msg + 1;
+ $start_msg = 1;
+ } else if ($start_msg > $show_num) {
+ $end_msg = $show_num;
+ $start_msg = 1;
+ }
+ }
+ $endVar = $end_msg + 1;
+
+ /*
+ * Loop through and display the info for each message.
+ * ($t is used for the checkbox number)
+ */
+ $t = 0;
+
+ /* messages display */
+
+ if (!$num_msgs) {
+ /* if there's no messages in this folder */
+ echo html_tag( 'tr',
+ html_tag( 'td',
+ " " . _("THIS FOLDER IS EMPTY") . " ",
+ 'center',
+ $color[4],
+ 'COLSPAN="' . count($index_order) . '"'
+ )
+ );
+ } elseif ($start_msg == $end_msg) {
+ /* if there's only one message in the box, handle it differently. */
+ if ($sort != 6) {
+ $i = $start_msg;
+ } else {
+ $i = 1;
+ }
+ reset($msort);
+ $k = 0;
+ do {
$key = key($msort);
next($msort);
$k++;
- } while (isset ($key) && ($k < $i));
- printMessageInfo($imapConnection, $t, $i, $key, $mailbox, $sort, $startMessage);
- } else {
- $i = $startMessage;
- reset($msort);
- do {
+ } while (isset ($key) && ($k < $i));
+ printMessageInfo($imapConnection, $t, true, $key, $mailbox,
+ $real_startMessage, $where, $what);
+ } else {
+ $i = $start_msg;
+ reset($msort);
+ $k = 0;
+ do {
$key = key($msort);
next($msort);
$k++;
- } while (isset ($key) && ($k < $i));
-
- do {
- printMessageInfo($imapConnection, $t, $i, $key, $mailbox, $sort, $startMessage);
+ } while (isset ($key) && ($k < $i));
+ $not_last = true;
+ do {
+ if (!$i || $i == $endVar-1) $not_last = false;
+ printMessageInfo($imapConnection, $t, $not_last, $key, $mailbox,
+ $real_startMessage, $where, $what);
$key = key($msort);
$t++;
$i++;
next($msort);
- } while ($i < ($endMessage+1));
- }
- echo " ";
-
- echo " |