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