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