Reinstating fix for the "to" addresses. Hopefully won't need them for CC
[squirrelmail.git] / functions / mailbox_display.php
CommitLineData
59177427 1<?php
7c1b84d9 2
3302d0d4 3 /**
a09387f4 4 ** mailbox_display.php
3302d0d4 5 **
6 ** This contains functions that display mailbox information, such as the
7 ** table row that has sender, date, subject, etc...
8 **
245a6892 9 ** $Id$
3302d0d4 10 **/
a4c2cd49 11
266fe275 12 $mailbox_display_php = true;
d068c0ec 13
1809bad8 14 function printMessageInfo($imapConnection, $t, $i, $key, $mailbox, $sort, $startMessage, $where, $what) {
66289791 15 global $checkall;
af9404d7 16 global $color, $msgs, $msort;
f9b3e5d9 17 global $sent_folder;
9d157cec 18 global $message_highlight_list;
8e265988 19 global $index_order;
cbdc5621 20
0d455368 21 $msg = $msgs[$key];
d92b6f31 22
90bc0b93 23 $senderName = sqimap_find_displayable_name($msg['FROM']);
05207a68 24 $urlMailbox = urlencode($mailbox);
90bc0b93 25 $subject = trim($msg['SUBJECT']);
26 if ($subject == '')
8fca0a65 27 $subject = _("(no subject)");
b60b58f9 28
926da13e 29 echo "<TR>\n";
b60b58f9 30
90bc0b93 31 if (isset($msg['FLAG_FLAGGED']) && $msg['FLAG_FLAGGED'] == true)
245a6892 32 {
33 $flag = "<font color=$color[2]>";
90bc0b93 34 $flag_end = '</font>';
245a6892 35 }
36 else
37 {
90bc0b93 38 $flag = '';
39 $flag_end = '';
245a6892 40 }
90bc0b93 41 if (!isset($msg['FLAG_SEEN']) && $msg['FLAG_SEEN'] == false)
245a6892 42 {
90bc0b93 43 $bold = '<b>';
44 $bold_end = '</b>';
245a6892 45 }
46 else
47 {
90bc0b93 48 $bold = '';
49 $bold_end = '';
245a6892 50 }
51 if ($mailbox == $sent_folder)
52 {
90bc0b93 53 $italic = '<i>';
54 $italic_end = '</i>';
245a6892 55 }
56 else
57 {
90bc0b93 58 $italic = '';
59 $italic_end = '';
245a6892 60 }
90bc0b93 61 if (isset($msg['FLAG_DELETED']) && $msg['FLAG_DELETED'])
245a6892 62 {
63 $fontstr = "<font color=\"$color[9]\">";
90bc0b93 64 $fontstr_end = '</font>';
245a6892 65 }
66 else
67 {
90bc0b93 68 $fontstr = '';
69 $fontstr_end = '';
245a6892 70 }
b60b58f9 71
9d157cec 72 for ($i=0; $i < count($message_highlight_list); $i++) {
90bc0b93 73 if (trim($message_highlight_list[$i]['value']) != '') {
74 if ($message_highlight_list[$i]['match_type'] == 'to_cc') {
75 if (strpos('^^'.strtolower($msg['TO']), strtolower($message_highlight_list[$i]['value'])) || strpos('^^'.strtolower($msg['CC']), strtolower($message_highlight_list[$i]['value']))) {
76 $hlt_color = $message_highlight_list[$i]['color'];
d059be8f 77 continue;
78 }
90bc0b93 79 } else if (strpos('^^'.strtolower($msg[strtoupper($message_highlight_list[$i]['match_type'])]),strtolower($message_highlight_list[$i]['value']))) {
80 $hlt_color = $message_highlight_list[$i]['color'];
1195c340 81 continue;
b60b58f9 82 }
d059be8f 83 }
b60b58f9 84 }
85
245a6892 86 if (!isset($hlt_color))
9d157cec 87 $hlt_color = $color[4];
1809bad8 88
89 if ($where && $what) {
90bc0b93 90 $search_stuff = '&where='.urlencode($where).'&what='.urlencode($what);
1809bad8 91 }
66289791 92
eca500d0 93 if ($checkall == 1)
90bc0b93 94 $checked = ' checked';
eca500d0 95 else
90bc0b93 96 $checked = '';
3d48999d 97
8e265988 98 for ($i=1; $i <= count($index_order); $i++) {
99 switch ($index_order[$i]) {
100 case 1: # checkbox
101 echo " <td width=1% bgcolor=$hlt_color align=center><input type=checkbox name=\"msg[$t]\" value=".$msg["ID"]."$checked></TD>\n";
102 break;
103 case 2: # from
eca500d0 104 echo " <td width=30% bgcolor=$hlt_color>$italic$bold$flag$fontstr$senderName$fontstr_end$flag_end$bold_end$italic_end</td>\n";
8e265988 105 break;
106 case 3: # date
eca500d0 107 echo " <td nowrap width=1% bgcolor=$hlt_color><center>$bold$flag$fontstr".$msg["DATE_STRING"]."$fontstr_end$flag_end$bold_end</center></td>\n";
8e265988 108 break;
109 case 4: # subject
7e73c6be 110 echo " <td bgcolor=$hlt_color>$bold";
23fd3c8e 111 if (! isset($search_stuff)) { $search_stuff = ''; }
112 echo "<a href=\"read_body.php?mailbox=$urlMailbox&passed_id=".$msg["ID"]."&startMessage=$startMessage&show_more=0$search_stuff\"";
113 do_hook("subject_link");
114 echo ">$flag";
115 if (strlen($subject) > 55)
116 echo substr($subject, 0, 50) . '...';
117 else
118 echo $subject;
119 echo "$flag_end</a>$bold_end</td>\n";
8e265988 120 break;
121 case 5: # flags
9db5f5fc 122 $stuff = false;
44e227c2 123 echo " <td bgcolor=$hlt_color align=center width=1% nowrap><b><small>\n";
245a6892 124 if (isset($msg['FLAG_ANSWERED']) &&
90bc0b93 125 $msg['FLAG_ANSWERED'] == true) {
9db5f5fc 126 echo "A\n";
127 $stuff = true;
8ae331c2 128 }
90bc0b93 129 if ($msg['TYPE0'] == 'multipart') {
9db5f5fc 130 echo "+\n";
131 $stuff = true;
8ae331c2 132 }
90bc0b93 133 if (ereg('(1|2)',substr($msg['PRIORITY'],0,1))) {
9db5f5fc 134 echo "<font color=$color[1]>!</font>\n";
135 $stuff = true;
136 }
90bc0b93 137 if (isset($msg['FLAG_DELETED']) && $msg['FLAG_DELETED']) {
f9b3e5d9 138 echo "<font color=\"$color[1]\">D</font>\n";
139 $stuff = true;
140 }
8ae331c2 141
9db5f5fc 142 if (!$stuff) echo "&nbsp;\n";
143 echo "</small></b></td>\n";
8e265988 144 break;
8ae331c2 145 case 6: # size
eca500d0 146 echo " <td bgcolor=$hlt_color width=1%>$bold$fontstr".show_readable_size($msg['SIZE'])."$fontstr_end$bold_end</td>\n";
8e265988 147 break;
148 }
149 }
150
7151188f 151
152 echo "</tr>\n";
926da13e 153 }
154
155 /**
156 ** This function loops through a group of messages in the mailbox and shows them
157 **/
5b6ae78a 158 function showMessagesForMailbox($imapConnection, $mailbox, $numMessages, $startMessage, $sort, $color,$show_num, $use_cache) {
159 global $msgs, $msort;
f9b3e5d9 160 global $sent_folder;
9d157cec 161 global $message_highlight_list;
a3432f47 162 global $auto_expunge;
163
eca500d0 164 if ($auto_expunge == true) sqimap_mailbox_expunge($imapConnection, $mailbox, false);
0d455368 165 sqimap_mailbox_select($imapConnection, $mailbox);
61a4ac35 166
5b6ae78a 167 if (!$use_cache) {
0d455368 168 // if it's sorted
5b6ae78a 169 if ($numMessages >= 1) {
0d455368 170 if ($sort < 6) {
171 for ($q = 0; $q < $numMessages; $q++) {
172 if($mailbox == $sent_folder)
173 $hdr = sqimap_get_small_header ($imapConnection, $q+1, true);
174 else
175 $hdr = sqimap_get_small_header ($imapConnection, $q+1, false);
176
177 $from[$q] = $hdr->from;
178 $date[$q] = $hdr->date;
179 $subject[$q] = $hdr->subject;
180 $to[$q] = $hdr->to;
181 $priority[$q] = $hdr->priority;
182 $cc[$q] = $hdr->cc;
183 $size[$q] = $hdr->size;
184 $type[$q] = $hdr->type0;
185 $flags[$q] = sqimap_get_flags ($imapConnection, $q+1);
a3d65705 186 $id[$q] = $q + 1;
0d455368 187 }
188 } else {
189 // if it's not sorted
190 if ($startMessage + ($show_num - 1) < $numMessages) {
191 $endMessage = $startMessage + ($show_num-1);
192 } else {
193 $endMessage = $numMessages;
194 }
b60b58f9 195
0d455368 196 if ($endMessage < $startMessage) {
197 $startMessage = $startMessage - $show_num;
198 if ($startMessage < 1)
199 $startMessage = 1;
200 }
201
a3d65705 202
203 $real_startMessage = $numMessages - $startMessage + 1;
204 $real_endMessage = $numMessages - $startMessage - $show_num;
b60b58f9 205 if ($real_endMessage <= 0)
206 $real_endMessage = 1;
207
a3d65705 208 $j = 0;
209 for ($q = $real_startMessage; $q >= $real_endMessage; $q--) {
0d455368 210 if($mailbox == $sent_folder)
211 $hdr = sqimap_get_small_header ($imapConnection, $q, true);
212 else
213 $hdr = sqimap_get_small_header ($imapConnection, $q, false);
b60b58f9 214
0d455368 215 $from[$j] = $hdr->from;
216 $date[$j] = $hdr->date;
217 $subject[$j] = $hdr->subject;
218 $to[$j] = $hdr->to;
219 $priority[$j] = $hdr->priority;
220 $cc[$j] = $hdr->cc;
221 $size[$j] = $hdr->size;
222 $type[$j] = $hdr->type0;
223 $flags[$j] = sqimap_get_flags ($imapConnection, $q);
a3d65705 224 $id[$j] = $q;
0d455368 225 $j++;
226 }
b60b58f9 227 }
5b6ae78a 228 }
b60b58f9 229
5b6ae78a 230 $j = 0;
0d455368 231 if ($sort == 6) {
232 $end = $startMessage + $show_num - 1;
233 } else {
234 $end = $numMessages;
235 }
245a6892 236 if ($end > $numMessages) $end = $numMessages;
0d455368 237 while ($j < $end) {
90bc0b93 238 $date[$j] = ereg_replace(' ', ' ', $date[$j]);
239 $tmpdate = explode(' ', trim($date[$j]));
240
241 $messages[$j]['TIME_STAMP'] = getTimeStamp($tmpdate);
242 $messages[$j]['DATE_STRING'] = getDateString($messages[$j]['TIME_STAMP']);
243 $messages[$j]['ID'] = $id[$j];
244 $messages[$j]['FROM'] = decodeHeader($from[$j]);
245 $messages[$j]['FROM-SORT'] = strtolower(sqimap_find_displayable_name(decodeHeader($from[$j])));
246 $messages[$j]['SUBJECT'] = decodeHeader($subject[$j]);
247 $messages[$j]['SUBJECT-SORT'] = strtolower(decodeHeader($subject[$j]));
248 $messages[$j]['TO'] = decodeHeader($to[$j]);
249 $messages[$j]['PRIORITY'] = $priority[$j];
250 $messages[$j]['CC'] = $cc[$j];
251 $messages[$j]['SIZE'] = $size[$j];
252 $messages[$j]['TYPE0'] = $type[$j];
e9f8ea4e 253
254 # fix SUBJECT-SORT to remove Re:
0d455368 255 $re_abbr = # Add more here!
90bc0b93 256 'vedr|sv|' . # Danish
257 're|aw'; # English
0d455368 258 if (eregi("^($re_abbr):[ ]*(.*)$", $messages[$j]['SUBJECT-SORT'], $regs))
259 $messages[$j]['SUBJECT-SORT'] = $regs[2];
b60b58f9 260
5b6ae78a 261 $num = 0;
262 while ($num < count($flags[$j])) {
90bc0b93 263 if ($flags[$j][$num] == 'Deleted') {
264 $messages[$j]['FLAG_DELETED'] = true;
5b6ae78a 265 }
90bc0b93 266 elseif ($flags[$j][$num] == 'Answered') {
267 $messages[$j]['FLAG_ANSWERED'] = true;
5b6ae78a 268 }
90bc0b93 269 elseif ($flags[$j][$num] == 'Seen') {
270 $messages[$j]['FLAG_SEEN'] = true;
5b6ae78a 271 }
90bc0b93 272 elseif ($flags[$j][$num] == 'Flagged') {
273 $messages[$j]['FLAG_FLAGGED'] = true;
5b6ae78a 274 }
275 $num++;
7151188f 276 }
5b6ae78a 277 $j++;
3302d0d4 278 }
f9b3e5d9 279
280 /* Only ignore messages flagged as deleted if we are using a
281 * trash folder or auto_expunge */
245a6892 282 if (((isset($move_to_trash) && $move_to_trash)
283 || (isset($auto_expunge) && $auto_expunge)) && $sort != 6)
b60b58f9 284 {
f9b3e5d9 285 /** Find and remove the ones that are deleted */
286 $i = 0;
287 $j = 0;
288 while ($j < $numMessages) {
90bc0b93 289 if ($messages[$j]['FLAG_DELETED'] == true) {
f9b3e5d9 290 $j++;
291 continue;
292 }
293 $msgs[$i] = $messages[$j];
b60b58f9 294
f9b3e5d9 295 $i++;
5b6ae78a 296 $j++;
5b6ae78a 297 }
f9b3e5d9 298 $numMessages = $i;
0d455368 299 } else {
245a6892 300 if (! isset($messages))
301 $messages = array();
0d455368 302 $msgs = $messages;
5b10f02a 303 }
5b6ae78a 304 }
926da13e 305
4c2d69ac 306 // There's gotta be messages in the array for it to sort them.
f9b3e5d9 307 if ($numMessages > 0 && ! $use_cache) {
0e919368 308 /** 0 = Date (up) 4 = Subject (up)
309 ** 1 = Date (dn) 5 = Subject (dn)
310 ** 2 = Name (up)
311 ** 3 = Name (dn)
312 **/
09856735 313 session_unregister("msgs");
1c292c82 314 if (($sort == 0) || ($sort == 1))
90bc0b93 315 $msort = array_cleave ($msgs, 'TIME_STAMP');
1c292c82 316 if (($sort == 2) || ($sort == 3))
90bc0b93 317 $msort = array_cleave ($msgs, 'FROM-SORT');
1c292c82 318 if (($sort == 4) || ($sort == 5))
90bc0b93 319 $msort = array_cleave ($msgs, 'SUBJECT-SORT');
0d455368 320 if ($sort == 6)
321 $msort = $msgs;
322
323 if ($sort < 6) {
324 if($sort % 2) {
325 asort($msort);
326 } else {
327 arsort($msort);
328 }
0e919368 329 }
90bc0b93 330 session_register('msort');
4c2d69ac 331 }
5b6ae78a 332 displayMessageArray($imapConnection, $numMessages, $startMessage, $msgs, $msort, $mailbox, $sort, $color,$show_num);
90bc0b93 333 session_register('msgs');
9f2215a1 334 }
335
336 // generic function to convert the msgs array into an HTML table
5b6ae78a 337 function displayMessageArray($imapConnection, $numMessages, $startMessage, &$msgs, $msort, $mailbox, $sort, $color,$show_num) {
cbdc5621 338 global $folder_prefix, $sent_folder;
f9b3e5d9 339 global $imapServerAddress;
21fafac8 340 global $index_order, $real_endMessage, $real_startMessage, $checkall;
72b0f272 341
9f2215a1 342 // if cache isn't already set, do it now
90bc0b93 343 if (!session_is_registered('msgs'))
344 session_register('msgs');
345 if (!session_is_registered('msort'))
346 session_register('msort');
90033b64 347
9c83f905 348 if ($startMessage + ($show_num - 1) < $numMessages) {
349 $endMessage = $startMessage + ($show_num-1);
926da13e 350 } else {
926da13e 351 $endMessage = $numMessages;
352 }
b60b58f9 353
8442ac08 354 if ($endMessage < $startMessage) {
355 $startMessage = $startMessage - $show_num;
356 if ($startMessage < 1)
357 $startMessage = 1;
358 }
b60b58f9 359
9c83f905 360 $nextGroup = $startMessage + $show_num;
361 $prevGroup = $startMessage - $show_num;
20db5033 362 $urlMailbox = urlencode($mailbox);
926da13e 363
90bc0b93 364 do_hook('mailbox_index_before');
926da13e 365
14eb705c 366 $Message = '';
0d1b4832 367 if ($startMessage < $endMessage) {
14eb705c 368 $Message = _("Viewing messages") ." <B>$startMessage</B> ". _("to") ." <B>$endMessage</B> ($numMessages " . _("total") . ")\n";
f9b3e5d9 369 } elseif ($startMessage == $endMessage) {
14eb705c 370 $Message = _("Viewing message") ." <B>$startMessage</B> ($numMessages " . _("total") . ")\n";
0d1b4832 371 }
26b6c99c 372
14eb705c 373 $More = '';
0d455368 374 if ($sort == 6) {
375 $use = 0;
376 } else {
377 $use = 1;
378 }
5b10f02a 379 if (($nextGroup <= $numMessages) && ($prevGroup >= 0)) {
0d455368 380 $More = "<A HREF=\"right_main.php?use_mailbox_cache=$use&startMessage=$prevGroup&mailbox=$urlMailbox\" TARGET=\"right\">". _("Previous") ."</A> | \n";
381 $More .= "<A HREF=\"right_main.php?use_mailbox_cache=$use&&startMessage=$nextGroup&mailbox=$urlMailbox\" TARGET=\"right\">". _("Next") ."</A>\n";
926da13e 382 }
f9b3e5d9 383 elseif (($nextGroup > $numMessages) && ($prevGroup >= 0)) {
0d455368 384 $More = "<A HREF=\"right_main.php?use_mailbox_cache=$use&startMessage=$prevGroup&mailbox=$urlMailbox\" TARGET=\"right\">". _("Previous") ."</A> | \n";
14eb705c 385 $More .= "<FONT COLOR=\"$color[9]\">"._("Next")."</FONT>\n";
3302d0d4 386 }
f9b3e5d9 387 elseif (($nextGroup <= $numMessages) && ($prevGroup < 0)) {
14eb705c 388 $More = "<FONT COLOR=\"$color[9]\">"._("Previous")."</FONT> | \n";
0d455368 389 $More .= "<A HREF=\"right_main.php?use_mailbox_cache=$use&startMessage=$nextGroup&mailbox=$urlMailbox\" TARGET=\"right\">". _("Next") ."</A>\n";
14eb705c 390 }
391
245a6892 392 if (! isset($msg))
393 $msg = "";
b60b58f9 394 mail_message_listing_beginning($imapConnection,
14eb705c 395 "move_messages.php?msg=$msg&mailbox=$urlMailbox&startMessage=$startMessage",
66289791 396 $mailbox, $sort, $Message, $More, $startMessage);
14eb705c 397
8ae331c2 398 $groupNum = $startMessage % ($show_num - 1);
72b0f272 399 $real_startMessage = $startMessage;
b60b58f9 400 if ($sort == 6) {
401 if ($endMessage - $startMessage < $show_num - 1) {
402 $endMessage = $endMessage - $startMessage + 1;
403 $startMessage = 1;
404 } else if ($startMessage > $show_num) {
405 $endMessage = $show_num;
406 $startMessage = 1;
407 }
408 }
409
410 $endVar = $endMessage + 1;
411
14eb705c 412 // loop through and display the info for each message.
413 $t = 0; // $t is used for the checkbox number
414 if ($numMessages == 0) { // if there's no messages in this folder
415 echo "<TR><TD BGCOLOR=\"$color[4]\" COLSPAN=" . count($index_order);
416 echo "><CENTER><BR><B>". _("THIS FOLDER IS EMPTY") ."</B><BR>&nbsp;</CENTER></TD></TR>";
b60b58f9 417 } else if ($startMessage == $endMessage) { // if there's only one message in the box, handle it different.
a3d65705 418 if ($sort != 6)
419 $i = $startMessage;
420 else
421 $i = 1;
14eb705c 422 reset($msort);
245a6892 423 $k = 0;
14eb705c 424 do {
425 $key = key($msort);
426 next($msort);
427 $k++;
428 } while (isset ($key) && ($k < $i));
72b0f272 429 printMessageInfo($imapConnection, $t, $i, $key, $mailbox, $sort, $real_startMessage, 0, 0);
14eb705c 430 } else {
b60b58f9 431 $i = $startMessage;
432
14eb705c 433 reset($msort);
6b8a49c9 434 $k = 0;
14eb705c 435 do {
436 $key = key($msort);
437 next($msort);
438 $k++;
439 } while (isset ($key) && ($k < $i));
440
0d455368 441 do {
72b0f272 442 printMessageInfo($imapConnection, $t, $i, $key, $mailbox, $sort, $real_startMessage, 0, 0);
14eb705c 443 $key = key($msort);
444 $t++;
445 $i++;
446 next($msort);
b60b58f9 447 } while ($i && $i < $endVar);
14eb705c 448 }
90bc0b93 449 echo '</TABLE>';
14eb705c 450
451 echo "</td></tr>\n";
452
66289791 453 echo "<TR BGCOLOR=\"$color[4]\"><TD>";
90bc0b93 454 echo '<table width="100%" cellpadding="0" cellspacing="0" border="0"><tr><td>';
eca500d0 455 echo "$More</td><td align=right>\n";
456 if (!$startMessage) $startMessage=1;
90bc0b93 457 if ( $checkall == '1')
4d334045 458 echo "\n<A HREF=\"right_main.php?mailbox=$urlMailbox&startMessage=$real_startMessage&sort=$sort\">" . _("Unselect All") . "</A>\n";
66289791 459 else
4d334045 460 echo "\n<A HREF=\"right_main.php?mailbox=$urlMailbox&startMessage=$real_startMessage&sort=$sort&checkall=1\">" . _("Select All") . "</A>\n";
66289791 461
90bc0b93 462 echo '</td></tr></table>';
463 echo '</td></tr>';
464 echo '</table>'; /** End of message-list table */
14eb705c 465
90bc0b93 466 do_hook('mailbox_index_after');
14eb705c 467 }
468
469 /* Displays the standard message list header.
470 * To finish the table, you need to do a "</table></table>";
471 * $moveURL is the URL to submit the delete/move form to
472 * $mailbox is the current mailbox
473 * $sort is the current sorting method (-1 for no sorting available [searches])
474 * $Message is a message that is centered on top of the list
475 * $More is a second line that is left aligned
476 */
8ae331c2 477 function mail_message_listing_beginning($imapConnection, $moveURL,
5252447e 478 $mailbox = '', $sort = -1, $Message = '', $More = '', $startMessage = 1)
14eb705c 479 {
f9b3e5d9 480 global $color, $index_order, $auto_expunge, $move_to_trash;
58da09bd 481 global $checkall, $sent_folder;
eca500d0 482 $urlMailbox = urlencode($mailbox);
8ae331c2 483
14eb705c 484 /** This is the beginning of the message list table. It wraps around all messages */
90bc0b93 485 echo '<TABLE WIDTH="100%" BORDER="0" CELLPADDING="2" CELLSPACING="0">';
8ae331c2 486
14eb705c 487 if ($Message)
488 {
489 echo "<TR BGCOLOR=\"$color[4]\"><TD align=center>$Message</td></tr>\n";
490 }
8ae331c2 491
66289791 492 echo "<TR BGCOLOR=\"$color[4]\"><TD>";
90bc0b93 493 echo '<table width="100%" cellpadding="0" cellspacing="0" border="0"><tr><td>';
eca500d0 494 echo "$More</td><td align=right>\n";
90bc0b93 495 if ( $checkall == '1')
4d334045 496 echo "\n<A HREF=\"right_main.php?mailbox=$urlMailbox&startMessage=$startMessage&sort=$sort\">" . _("Unselect All") . "</A>\n";
66289791 497 else
4d334045 498 echo "\n<A HREF=\"right_main.php?mailbox=$urlMailbox&startMessage=$startMessage&sort=$sort&checkall=1\">" . _("Select All") . "</A>\n";
66289791 499
90bc0b93 500 echo '</td></tr></table>';
501 echo '</td></tr>';
926da13e 502
68347a84 503 /** The delete and move options */
f8f9bed9 504 echo "<TR><TD BGCOLOR=\"$color[0]\">";
ed4332d1 505
14eb705c 506 echo "\n\n\n<FORM name=messageList method=post action=\"$moveURL\">\n";
4f313fcf 507 echo "<TABLE BGCOLOR=\"$color[0]\" COLS=2 BORDER=0 cellpadding=0 cellspacing=0 width=100%>\n";
ed4332d1 508 echo " <TR>\n";
98fe1e9f 509 echo " <TD WIDTH=60% ALIGN=LEFT VALIGN=CENTER>\n";
66289791 510
511
90bc0b93 512 echo ' <NOBR><SMALL>'. _("Move selected to:") .'</SMALL>';
513 echo ' <TT><SMALL><SELECT NAME="targetMailbox">';
7ce342dc 514
9f2215a1 515 $boxes = sqimap_mailbox_list($imapConnection);
7ce342dc 516 for ($i = 0; $i < count($boxes); $i++) {
90bc0b93 517 if ($boxes[$i]['flags'][0] != 'noselect' &&
518 $boxes[$i]['flags'][1] != 'noselect' &&
519 $boxes[$i]['flags'][2] != 'noselect') {
520 $box = $boxes[$i]['unformatted'];
521 $box2 = replace_spaces($boxes[$i]['unformatted-disp']);
14eb705c 522 echo " <OPTION VALUE=\"$box\">$box2</option>\n";
0d455368 523 }
dd88d31f 524 }
90bc0b93 525 echo ' </SELECT></SMALL></TT>';
526 echo ' <SMALL><INPUT TYPE=SUBMIT NAME="moveButton" VALUE="'. _("Move") ."\"></SMALL></NOBR>\n";
ed4332d1 527 echo " </TD>\n";
7ce342dc 528 echo " <TD WIDTH=40% ALIGN=RIGHT>\n";
02ad7ce1 529 if (! $auto_expunge) {
90bc0b93 530 echo ' <NOBR><SMALL><INPUT TYPE=SUBMIT NAME="expungeButton" VALUE="'. _("Expunge") .'">&nbsp;'. _("mailbox") ."</SMALL></NOBR>&nbsp;&nbsp;\n";
f9b3e5d9 531 }
aae41ae9 532 echo " <NOBR><SMALL><INPUT TYPE=SUBMIT VALUE=\"". _("Delete") ."\">&nbsp;". _("checked messages") ."</SMALL></NOBR>\n";
14eb705c 533 echo " </TD>\n";
ed4332d1 534 echo " </TR>\n";
535
70b455e0 536 echo "</TABLE>\n";
90bc0b93 537 do_hook('mailbox_form_before');
538 echo '</TD></TR>';
aa4c3749 539
f8f9bed9 540 echo "<TR><TD BGCOLOR=\"$color[0]\">";
98fe1e9f 541 echo "<TABLE WIDTH=100% BORDER=0 CELLPADDING=2 CELLSPACING=1 BGCOLOR=\"$color[0]\">";
f8f9bed9 542 echo "<TR BGCOLOR=\"$color[5]\" ALIGN=\"center\">";
be8e07f8 543
74bb7ddc 544 $urlMailbox=urlencode($mailbox);
8ae331c2 545
14eb705c 546 // Print the headers
8e265988 547 for ($i=1; $i <= count($index_order); $i++) {
548 switch ($index_order[$i]) {
549 case 1: # checkbox
14eb705c 550 case 5: # flags
90bc0b93 551 echo ' <TD WIDTH="1%"><B>&nbsp;</B></TD>';
8e265988 552 break;
14eb705c 553
8e265988 554 case 2: # from
14eb705c 555 if ($mailbox == $sent_folder)
90bc0b93 556 echo ' <TD WIDTH="30%"><B>'. _("To") .'</B>';
14eb705c 557 else
90bc0b93 558 echo ' <TD WIDTH="30%"><B>'. _("From") .'</B>';
8e265988 559
560 if ($sort == 2)
561 echo " <A HREF=\"right_main.php?newsort=3&startMessage=1&mailbox=$urlMailbox\" TARGET=\"right\"><IMG SRC=\"../images/up_pointer.gif\" BORDER=0></A></TD>\n";
f9b3e5d9 562 elseif ($sort == 3)
8e265988 563 echo " <A HREF=\"right_main.php?newsort=2&startMessage=1&mailbox=$urlMailbox\" TARGET=\"right\"><IMG SRC=\"../images/down_pointer.gif\" BORDER=0></A></TD>\n";
f9b3e5d9 564 elseif ($sort != -1)
8e265988 565 echo " <A HREF=\"right_main.php?newsort=3&startMessage=1&mailbox=$urlMailbox\" TARGET=\"right\"><IMG SRC=\"../images/sort_none.gif\" BORDER=0></A></TD>\n";
eca500d0 566 echo "</TD>";
8e265988 567 break;
14eb705c 568
8e265988 569 case 3: # date
90bc0b93 570 echo ' <TD nowrap WIDTH="1%"><B>'. _("Date") .'</B>';
8e265988 571 if ($sort == 0)
572 echo " <A HREF=\"right_main.php?newsort=1&startMessage=1&mailbox=$urlMailbox\" TARGET=\"right\"><IMG SRC=\"../images/up_pointer.gif\" BORDER=0></A></TD>\n";
f9b3e5d9 573 elseif ($sort == 1)
0d455368 574 echo " <A HREF=\"right_main.php?newsort=6&startMessage=1&mailbox=$urlMailbox\" TARGET=\"right\"><IMG SRC=\"../images/down_pointer.gif\" BORDER=0></A></TD>\n";
8ae331c2 575 elseif ($sort == 6)
0d455368 576 echo " <A HREF=\"right_main.php?newsort=0&startMessage=1&mailbox=$urlMailbox\" TARGET=\"right\"><IMG SRC=\"../images/sort_none.gif\" BORDER=0></A></TD>\n";
f9b3e5d9 577 elseif ($sort != -1)
8e265988 578 echo " <A HREF=\"right_main.php?newsort=0&startMessage=1&mailbox=$urlMailbox\" TARGET=\"right\"><IMG SRC=\"../images/sort_none.gif\" BORDER=0></A></TD>\n";
90bc0b93 579 echo '</TD>';
8e265988 580 break;
14eb705c 581
8e265988 582 case 4: # subject
90bc0b93 583 echo ' <TD WIDTH=%><B>'. _("Subject") ."</B>\n";
8e265988 584 if ($sort == 4)
585 echo " <A HREF=\"right_main.php?newsort=5&startMessage=1&mailbox=$urlMailbox\" TARGET=\"right\"><IMG SRC=\"../images/up_pointer.gif\" BORDER=0></A></TD>\n";
f9b3e5d9 586 elseif ($sort == 5)
8e265988 587 echo " <A HREF=\"right_main.php?newsort=4&startMessage=1&mailbox=$urlMailbox\" TARGET=\"right\"><IMG SRC=\"../images/down_pointer.gif\" BORDER=0></A></TD>\n";
f9b3e5d9 588 elseif ($sort != -1)
8e265988 589 echo " <A HREF=\"right_main.php?newsort=5&startMessage=1&mailbox=$urlMailbox\" TARGET=\"right\"><IMG SRC=\"../images/sort_none.gif\" BORDER=0></A></TD>\n";
eca500d0 590 echo "</TD>";
8e265988 591 break;
14eb705c 592
8e265988 593 case 6: # size
90bc0b93 594 echo ' <TD WIDTH="1%"><b>' . _("Size")."</b></TD>\n";
8e265988 595 break;
596 }
597 }
14eb705c 598 echo "</TR>\n";
3302d0d4 599 }
26b6c99c 600?>