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