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