6625684d |
1 | <HTML><BODY TEXT="#000000" BGCOLOR="#FFFFFF" LINK="#0000EE" VLINK="#0000EE" ALINK="#0000EE"> |
b40316f9 |
2 | <? |
3 | include("../config/config.php"); |
4 | include("../functions/mailbox.php"); |
5 | include("../functions/strings.php"); |
6 | include("../functions/page_header.php"); |
7 | include("../functions/display_messages.php"); |
05207a68 |
8 | include("../functions/imap.php"); |
b40316f9 |
9 | |
05207a68 |
10 | $imapConnection = loginToImapServer($username, $key, $imapServerAddress); |
b40316f9 |
11 | |
12 | // switch to the mailbox, and get the number of messages in it. |
2aa12d5e |
13 | selectMailbox($imapConnection, $mailbox, $numMessages, $imapServerAddress); |
b40316f9 |
14 | |
05207a68 |
15 | if (strtolower($move_or_delete) == "delete selected messages") { |
16 | // Marks the selected messages ad 'Deleted' |
17 | $j = 0; |
18 | $i = 0; |
2d7d3c2a |
19 | |
20 | // If they have selected nothing msg is size one still, but will be an infinite |
21 | // loop because we never increment j. so check to see if msg[0] is set or not to fix this. |
22 | while (($j < count($msg)) && ($msg[0])) { |
05207a68 |
23 | if ($msg[$i]) { |
24 | /** check if they would like to move it to the trash folder or not */ |
25 | if ($move_to_trash == true) { |
26 | $success = copyMessages($imapConnection, $msg[$i], $msg[$i], $trash_folder); |
27 | if ($success == true) |
28 | setMessageFlag($imapConnection, $msg[$i], $msg[$i], "Deleted"); |
29 | } else { |
30 | setMessageFlag($imapConnection, $msg[$i], "Deleted"); |
31 | } |
32 | $j++; |
b40316f9 |
33 | } |
05207a68 |
34 | $i++; |
b40316f9 |
35 | } |
05207a68 |
36 | if ($auto_expunge == true) |
37 | expungeBox($imapConnection, $mailbox, $numMessages); |
38 | displayPageHeader($mailbox); |
39 | messages_deleted_message($mailbox, $sort, $startMessage); |
40 | } else { |
2d7d3c2a |
41 | $j = 0; |
42 | $i = 0; |
43 | |
44 | // If they have selected nothing msg is size one still, but will be an infinite |
45 | // loop because we never increment j. so check to see if msg[0] is set or not to fix this. |
46 | while (($j < count($msg)) && ($msg[0])) { |
47 | if ($msg[$i]) { |
48 | $success = copyMessages($imapConnection, $msg[$i], $msg[$i], $trash_folder); |
49 | if ($success == true) { |
50 | setMessageFlag($imapConnection, $msg[$i], $msg[$i], "Deleted"); |
51 | displayPageHeader($mailbox); |
52 | } |
53 | if ($auto_expunge == true) |
54 | expungeBox($imapConnection, $mailbox, $numMessages); |
55 | $j++; |
56 | } |
57 | $i++; |
58 | } |
b40316f9 |
59 | } |
60 | |
b40316f9 |
61 | // Log out this session |
62 | fputs($imapConnection, "1 logout"); |
63 | |
2aa12d5e |
64 | ?> |
aa32c5e4 |
65 | </BODY></HTML> |