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