- }
- }
-
- if (!isset($hlt_color)) {
- $hlt_color = $color_string;
- }
-
- if ($where && $what) {
- $search_stuff = '&where='.urlencode($where).'&what='.urlencode($what);
- }
-
- $checked = ($checkall == 1 ?' checked' : '');
-
- for ($i=1; $i <= count($index_order); $i++) {
- switch ($index_order[$i]) {
- case 1: /* checkbox */
- echo " <td bgcolor=$hlt_color align=center><input type=checkbox name=\"msg[$t]\" value=".$msg["ID"]."$checked></TD>\n";
- break;
- case 2: /* from */
- echo " <td bgcolor=$hlt_color>$italic$bold$flag$fontstr$senderName$fontstr_end$flag_end$bold_end$italic_end</td>\n";
- break;
- case 3: /* date */
- echo " <td nowrap bgcolor=$hlt_color><center>$bold$flag$fontstr".$msg["DATE_STRING"]."$fontstr_end$flag_end$bold_end</center></td>\n";
- break;
- case 4: /* subject */
- echo " <td bgcolor=$hlt_color>$bold";
- if (! isset($search_stuff)) { $search_stuff = ''; }
- echo "<a href=\"read_body.php?mailbox=$urlMailbox&passed_id=".$msg["ID"]."&startMessage=$start_msg&show_more=0$search_stuff\"";
- do_hook("subject_link");
-
- if ($subject != $msg['SUBJECT']) {
- $title = get_html_translation_table(HTML_SPECIALCHARS);
- $title = array_flip($title);
- $title = strtr($msg['SUBJECT'], $title);
- $title = str_replace('"', "''", $title);
- echo " title=\"$title\"";
- }
- echo ">$flag$subject$flag_end</a>$bold_end</td>\n";
- break;
- case 5: /* flags */
- $stuff = false;
- echo " <td bgcolor=$hlt_color align=center nowrap><b><small>\n";
- if (isset($msg['FLAG_ANSWERED']) &&
- $msg['FLAG_ANSWERED'] == true) {
- echo "A\n";
- $stuff = true;
- }
- if ($msg['TYPE0'] == 'multipart') {
- echo "+\n";
- $stuff = true;
- }
- if ($default_use_priority) {
- if (ereg('(1|2)',substr($msg['PRIORITY'],0,1))) {
- echo "<font color=$color[1]>!</font>\n";
- $stuff = true;
- }
- if (ereg('(5)',substr($msg['PRIORITY'],0,1))) {
- echo "<font color=$color[8]>?</font>\n";
- $stuff = true;
- }
- }
- if (isset($msg['FLAG_DELETED']) && $msg['FLAG_DELETED']) {
- echo "<font color=\"$color[1]\">D</font>\n";
- $stuff = true;
- }
-
- if (!$stuff) echo " \n";
- echo "</small></b></td>\n";
- break;
- case 6: /* size */
- echo " <td bgcolor=$hlt_color>$bold$fontstr".show_readable_size($msg['SIZE'])."$fontstr_end$bold_end</td>\n";
- break;
- }
- }
- echo "</tr>\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;
- global $sent_folder, $draft_folder;
- global $message_highlight_list;
- global $auto_expunge;
-
- /* If autoexpunge is turned on, then do it now. */
- if ($auto_expunge == true) {
- sqimap_mailbox_expunge($imapConnection, $mailbox, false);
- }
- sqimap_mailbox_select($imapConnection, $mailbox);
-
- $issent = (($mailbox == $sent_folder) || ($mailbox == $draft_folder));
- if (!$use_cache) {
- /* If it is sorted... */
- if ($num_msgs >= 1) {
+ }
+ }
+
+ if (!isset($hlt_color)) {
+ $hlt_color = $color_string;
+ }
+
+ if ($where && $what) {
+ if( !isset( $pos ) || $pos == '' ) {
+ $pos = '0';
+ }
+ $search_stuff = "&pos=" . urlencode( $pos ) . "&where=".urlencode($where).'&what='.urlencode($what);
+ }
+
+ $checked = ($checkall == 1 ?' checked' : '');
+
+ for ($i=1; $i <= count($index_order); $i++) {
+ switch ($index_order[$i]) {
+ case 1: /* checkbox */
+ echo " <td bgcolor=\"$hlt_color\" align=center><input type=checkbox name=\"msg[$t]\" value=".$msg["ID"]."$checked></TD>\n";
+ break;
+ case 2: /* from */
+ echo " <td bgcolor=\"$hlt_color\">$italic$bold$flag$fontstr$senderName$fontstr_end$flag_end$bold_end$italic_end</td>\n";
+ break;
+ case 3: /* date */
+ echo " <td nowrap bgcolor=\"$hlt_color\"><center>$bold$flag$fontstr".$msg["DATE_STRING"]."$fontstr_end$flag_end$bold_end</center></td>\n";
+ break;
+ case 4: /* subject */
+ echo " <td bgcolor=\"$hlt_color\">$bold";
+ if (! isset($search_stuff)) { $search_stuff = ''; }
+ echo "<a href=\"read_body.php?mailbox=$urlMailbox&passed_id=".$msg["ID"]."&startMessage=$start_msg&show_more=0$search_stuff\"";
+ do_hook("subject_link");
+
+ if ($subject != $msg['SUBJECT']) {
+ $title = get_html_translation_table(HTML_SPECIALCHARS);
+ $title = array_flip($title);
+ $title = strtr($msg['SUBJECT'], $title);
+ $title = str_replace('"', "''", $title);
+ echo " title=\"$title\"";
+ }
+ echo ">$flag$subject$flag_end</a>$bold_end</td>\n";
+ break;
+ case 5: /* flags */
+ $stuff = false;
+ echo " <td bgcolor=\"$hlt_color\" align=center nowrap><b><small>\n";
+ if (isset($msg['FLAG_ANSWERED']) &&
+ $msg['FLAG_ANSWERED'] == true) {
+ echo _("A") . "\n";
+ $stuff = true;
+ }
+ if ($msg['TYPE0'] == 'multipart') {
+ echo "+\n";
+ $stuff = true;
+ }
+ if ($default_use_priority) {
+ if (ereg('(1|2)',substr($msg['PRIORITY'],0,1))) {
+ echo "<font color=\"$color[1]\">!</font>\n";
+ $stuff = true;
+ }
+ if (ereg('(5)',substr($msg['PRIORITY'],0,1))) {
+ echo "<font color=\"$color[8]\">?</font>\n";
+ $stuff = true;
+ }
+ }
+ if (isset($msg['FLAG_DELETED']) && $msg['FLAG_DELETED']) {
+ echo "<font color=\"$color[1]\">D</font>\n";
+ $stuff = true;
+ }
+
+ if (!$stuff) {
+ echo " \n";
+ }
+ echo "</small></b></td>\n";
+ break;
+ case 6: /* size */
+ echo " <td bgcolor=\"$hlt_color\">$bold$fontstr" .
+ show_readable_size($msg['SIZE']) .
+ "$fontstr_end$bold_end</td>\n";
+ break;
+ }
+ }
+ echo "</tr>\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;
+ global $sent_folder, $draft_folder;
+ global $message_highlight_list;
+ global $auto_expunge;
+
+ /* If autoexpunge is turned on, then do it now. */
+ if ($auto_expunge == true) {
+ sqimap_mailbox_expunge($imapConnection, $mailbox, false);
+ }
+ sqimap_mailbox_select($imapConnection, $mailbox);
+
+ $issent = handleAsSent($mailbox);
+ if (!$use_cache) {
+ /* If it is sorted... */
+ if ($num_msgs >= 1) {