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