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