added capability to detect if imap server supports searching on specific
[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 } else {
234 $end = $numMessages;
235 }
236 if ($end > $numMessages) $end = $numMessages;
237 while ($j < $end) {
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];
253
254 # fix SUBJECT-SORT to remove Re:
255 $re_abbr = # Add more here!
256 'vedr|sv|' . # Danish
257 're|aw'; # English
258 if (eregi("^($re_abbr):[ ]*(.*)$", $messages[$j]['SUBJECT-SORT'], $regs))
259 $messages[$j]['SUBJECT-SORT'] = $regs[2];
260
261 $num = 0;
262 while ($num < count($flags[$j])) {
263 if ($flags[$j][$num] == 'Deleted') {
264 $messages[$j]['FLAG_DELETED'] = true;
265 }
266 elseif ($flags[$j][$num] == 'Answered') {
267 $messages[$j]['FLAG_ANSWERED'] = true;
268 }
269 elseif ($flags[$j][$num] == 'Seen') {
270 $messages[$j]['FLAG_SEEN'] = true;
271 }
272 elseif ($flags[$j][$num] == 'Flagged') {
273 $messages[$j]['FLAG_FLAGGED'] = true;
274 }
275 $num++;
276 }
277 $j++;
278 }
279
280 /* Only ignore messages flagged as deleted if we are using a
281 * trash folder or auto_expunge */
282 if (((isset($move_to_trash) && $move_to_trash)
283 || (isset($auto_expunge) && $auto_expunge)) && $sort != 6)
284 {
285 /** Find and remove the ones that are deleted */
286 $i = 0;
287 $j = 0;
288 while ($j < $numMessages) {
289 if ($messages[$j]['FLAG_DELETED'] == true) {
290 $j++;
291 continue;
292 }
293 $msgs[$i] = $messages[$j];
294
295 $i++;
296 $j++;
297 }
298 $numMessages = $i;
299 } else {
300 if (! isset($messages))
301 $messages = array();
302 $msgs = $messages;
303 }
304 }
305
306 // There's gotta be messages in the array for it to sort them.
307 if ($numMessages > 0 && ! $use_cache) {
308 /** 0 = Date (up) 4 = Subject (up)
309 ** 1 = Date (dn) 5 = Subject (dn)
310 ** 2 = Name (up)
311 ** 3 = Name (dn)
312 **/
313 session_unregister("msgs");
314 if (($sort == 0) || ($sort == 1))
315 $msort = array_cleave ($msgs, 'TIME_STAMP');
316 if (($sort == 2) || ($sort == 3))
317 $msort = array_cleave ($msgs, 'FROM-SORT');
318 if (($sort == 4) || ($sort == 5))
319 $msort = array_cleave ($msgs, 'SUBJECT-SORT');
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 }
329 }
330 session_register('msort');
331 }
332 displayMessageArray($imapConnection, $numMessages, $startMessage, $msgs, $msort, $mailbox, $sort, $color,$show_num);
333 session_register('msgs');
334 }
335
336 // generic function to convert the msgs array into an HTML table
337 function displayMessageArray($imapConnection, $numMessages, $startMessage, &$msgs, $msort, $mailbox, $sort, $color,$show_num) {
338 global $folder_prefix, $sent_folder;
339 global $imapServerAddress;
340 global $index_order, $real_endMessage, $real_startMessage, $checkall;
341
342 // if cache isn't already set, do it now
343 if (!session_is_registered('msgs'))
344 session_register('msgs');
345 if (!session_is_registered('msort'))
346 session_register('msort');
347
348 if ($startMessage + ($show_num - 1) < $numMessages) {
349 $endMessage = $startMessage + ($show_num-1);
350 } else {
351 $endMessage = $numMessages;
352 }
353
354 if ($endMessage < $startMessage) {
355 $startMessage = $startMessage - $show_num;
356 if ($startMessage < 1)
357 $startMessage = 1;
358 }
359
360 $nextGroup = $startMessage + $show_num;
361 $prevGroup = $startMessage - $show_num;
362 $urlMailbox = urlencode($mailbox);
363
364 do_hook('mailbox_index_before');
365
366 $Message = '';
367 if ($startMessage < $endMessage) {
368 $Message = _("Viewing messages") ." <B>$startMessage</B> ". _("to") ." <B>$endMessage</B> ($numMessages " . _("total") . ")\n";
369 } elseif ($startMessage == $endMessage) {
370 $Message = _("Viewing message") ." <B>$startMessage</B> ($numMessages " . _("total") . ")\n";
371 }
372
373 $More = '';
374 if ($sort == 6) {
375 $use = 0;
376 } else {
377 $use = 1;
378 }
379 if (($nextGroup <= $numMessages) && ($prevGroup >= 0)) {
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";
382 }
383 elseif (($nextGroup > $numMessages) && ($prevGroup >= 0)) {
384 $More = "<A HREF=\"right_main.php?use_mailbox_cache=$use&startMessage=$prevGroup&mailbox=$urlMailbox\" TARGET=\"right\">". _("Previous") ."</A> | \n";
385 $More .= "<FONT COLOR=\"$color[9]\">"._("Next")."</FONT>\n";
386 }
387 elseif (($nextGroup <= $numMessages) && ($prevGroup < 0)) {
388 $More = "<FONT COLOR=\"$color[9]\">"._("Previous")."</FONT> | \n";
389 $More .= "<A HREF=\"right_main.php?use_mailbox_cache=$use&startMessage=$nextGroup&mailbox=$urlMailbox\" TARGET=\"right\">". _("Next") ."</A>\n";
390 }
391
392 if (! isset($msg))
393 $msg = "";
394 mail_message_listing_beginning($imapConnection,
395 "move_messages.php?msg=$msg&mailbox=$urlMailbox&startMessage=$startMessage",
396 $mailbox, $sort, $Message, $More, $startMessage);
397
398 $groupNum = $startMessage % ($show_num - 1);
399 $real_startMessage = $startMessage;
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
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>";
417 } else if ($startMessage == $endMessage) { // if there's only one message in the box, handle it different.
418 if ($sort != 6)
419 $i = $startMessage;
420 else
421 $i = 1;
422 reset($msort);
423 $k = 0;
424 do {
425 $key = key($msort);
426 next($msort);
427 $k++;
428 } while (isset ($key) && ($k < $i));
429 printMessageInfo($imapConnection, $t, $i, $key, $mailbox, $sort, $real_startMessage, 0, 0);
430 } else {
431 $i = $startMessage;
432
433 reset($msort);
434 $k = 0;
435 do {
436 $key = key($msort);
437 next($msort);
438 $k++;
439 } while (isset ($key) && ($k < $i));
440
441 do {
442 printMessageInfo($imapConnection, $t, $i, $key, $mailbox, $sort, $real_startMessage, 0, 0);
443 $key = key($msort);
444 $t++;
445 $i++;
446 next($msort);
447 } while ($i && $i < $endVar);
448 }
449 echo '</TABLE>';
450
451 echo "</td></tr>\n";
452
453 echo "<TR BGCOLOR=\"$color[4]\"><TD>";
454 echo '<table width="100%" cellpadding="0" cellspacing="0" border="0"><tr><td>';
455 echo "$More</td><td align=right>\n";
456 if (!$startMessage) $startMessage=1;
457 if ( $checkall == '1')
458 echo "\n<A HREF=\"right_main.php?mailbox=$urlMailbox&startMessage=$real_startMessage&sort=$sort\">" . _("Unselect All") . "</A>\n";
459 else
460 echo "\n<A HREF=\"right_main.php?mailbox=$urlMailbox&startMessage=$real_startMessage&sort=$sort&checkall=1\">" . _("Select All") . "</A>\n";
461
462 echo '</td></tr></table>';
463 echo '</td></tr>';
464 echo '</table>'; /** End of message-list table */
465
466 do_hook('mailbox_index_after');
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 */
477 function mail_message_listing_beginning($imapConnection, $moveURL,
478 $mailbox = '', $sort = -1, $Message = '', $More = '', $startMessage = 1)
479 {
480 global $color, $index_order, $auto_expunge, $move_to_trash;
481 global $checkall, $sent_folder;
482 $urlMailbox = urlencode($mailbox);
483
484 /** This is the beginning of the message list table. It wraps around all messages */
485 echo '<TABLE WIDTH="100%" BORDER="0" CELLPADDING="2" CELLSPACING="0">';
486
487 if ($Message)
488 {
489 echo "<TR BGCOLOR=\"$color[4]\"><TD align=center>$Message</td></tr>\n";
490 }
491
492 echo "<TR BGCOLOR=\"$color[4]\"><TD>";
493 echo '<table width="100%" cellpadding="0" cellspacing="0" border="0"><tr><td>';
494 echo "$More</td><td align=right>\n";
495 if ( $checkall == '1')
496 echo "\n<A HREF=\"right_main.php?mailbox=$urlMailbox&startMessage=$startMessage&sort=$sort\">" . _("Unselect All") . "</A>\n";
497 else
498 echo "\n<A HREF=\"right_main.php?mailbox=$urlMailbox&startMessage=$startMessage&sort=$sort&checkall=1\">" . _("Select All") . "</A>\n";
499
500 echo '</td></tr></table>';
501 echo '</td></tr>';
502
503 /** The delete and move options */
504 echo "<TR><TD BGCOLOR=\"$color[0]\">";
505
506 echo "\n\n\n<FORM name=messageList method=post action=\"$moveURL\">\n";
507 echo "<TABLE BGCOLOR=\"$color[0]\" COLS=2 BORDER=0 cellpadding=0 cellspacing=0 width=100%>\n";
508 echo " <TR>\n";
509 echo " <TD WIDTH=60% ALIGN=LEFT VALIGN=CENTER>\n";
510
511
512 echo ' <NOBR><SMALL>'. _("Move selected to:") .'</SMALL>';
513 echo ' <TT><SMALL><SELECT NAME="targetMailbox">';
514
515 $boxes = sqimap_mailbox_list($imapConnection);
516 for ($i = 0; $i < count($boxes); $i++) {
517 if (!in_array("noselect", $boxes[$i]["flags"])) {
518 $box = $boxes[$i]['unformatted'];
519 $box2 = replace_spaces($boxes[$i]['unformatted-disp']);
520 echo " <OPTION VALUE=\"$box\">$box2</option>\n";
521 }
522 }
523 echo ' </SELECT></SMALL></TT>';
524 echo ' <SMALL><INPUT TYPE=SUBMIT NAME="moveButton" VALUE="'. _("Move") ."\"></SMALL></NOBR>\n";
525 echo " </TD>\n";
526 echo " <TD WIDTH=40% ALIGN=RIGHT>\n";
527 if (! $auto_expunge) {
528 echo ' <NOBR><SMALL><INPUT TYPE=SUBMIT NAME="expungeButton" VALUE="'. _("Expunge") .'">&nbsp;'. _("mailbox") ."</SMALL></NOBR>&nbsp;&nbsp;\n";
529 }
530 echo " <NOBR><SMALL><INPUT TYPE=SUBMIT VALUE=\"". _("Delete") ."\">&nbsp;". _("checked messages") ."</SMALL></NOBR>\n";
531 echo " </TD>\n";
532 echo " </TR>\n";
533
534 echo "</TABLE>\n";
535 do_hook('mailbox_form_before');
536 echo '</TD></TR>';
537
538 echo "<TR><TD BGCOLOR=\"$color[0]\">";
539 echo "<TABLE WIDTH=100% BORDER=0 CELLPADDING=2 CELLSPACING=1 BGCOLOR=\"$color[0]\">";
540 echo "<TR BGCOLOR=\"$color[5]\" ALIGN=\"center\">";
541
542 $urlMailbox=urlencode($mailbox);
543
544 // Print the headers
545 for ($i=1; $i <= count($index_order); $i++) {
546 switch ($index_order[$i]) {
547 case 1: # checkbox
548 case 5: # flags
549 echo ' <TD WIDTH="1%"><B>&nbsp;</B></TD>';
550 break;
551
552 case 2: # from
553 if ($mailbox == $sent_folder)
554 echo ' <TD WIDTH="30%"><B>'. _("To") .'</B>';
555 else
556 echo ' <TD WIDTH="30%"><B>'. _("From") .'</B>';
557
558 if ($sort == 2)
559 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";
560 elseif ($sort == 3)
561 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";
562 elseif ($sort != -1)
563 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";
564 echo "</TD>";
565 break;
566
567 case 3: # date
568 echo ' <TD nowrap WIDTH="1%"><B>'. _("Date") .'</B>';
569 if ($sort == 0)
570 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";
571 elseif ($sort == 1)
572 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";
573 elseif ($sort == 6)
574 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";
575 elseif ($sort != -1)
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";
577 echo '</TD>';
578 break;
579
580 case 4: # subject
581 echo ' <TD WIDTH=%><B>'. _("Subject") ."</B>\n";
582 if ($sort == 4)
583 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";
584 elseif ($sort == 5)
585 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";
586 elseif ($sort != -1)
587 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";
588 echo "</TD>";
589 break;
590
591 case 6: # size
592 echo ' <TD WIDTH="1%"><b>' . _("Size")."</b></TD>\n";
593 break;
594 }
595 }
596 echo "</TR>\n";
597 }
598 ?>