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 | |
dd88d31f |
10 | function putSelectedMessagesIntoString($msg) { |
05207a68 |
11 | $j = 0; |
12 | $i = 0; |
dd88d31f |
13 | $firstLoop = true; |
2d7d3c2a |
14 | |
15 | // If they have selected nothing msg is size one still, but will be an infinite |
16 | // loop because we never increment j. so check to see if msg[0] is set or not to fix this. |
17 | while (($j < count($msg)) && ($msg[0])) { |
05207a68 |
18 | if ($msg[$i]) { |
dd88d31f |
19 | if ($firstLoop != true) |
20 | $selectedMessages .= "&"; |
21 | else |
22 | $firstLoop = false; |
23 | |
24 | $selectedMessages .= "selMsg[$j]=$msg[$i]"; |
25 | |
05207a68 |
26 | $j++; |
b40316f9 |
27 | } |
05207a68 |
28 | $i++; |
b40316f9 |
29 | } |
dd88d31f |
30 | } |
31 | |
32 | |
33 | $imapConnection = loginToImapServer($username, $key, $imapServerAddress); |
34 | |
35 | // switch to the mailbox, and get the number of messages in it. |
36 | selectMailbox($imapConnection, $mailbox, $numMessages, $imapServerAddress); |
37 | |
38 | // If the delete button was pressed, the moveButton variable will not be set. |
39 | if (!$moveButton) { |
05207a68 |
40 | displayPageHeader($mailbox); |
dd88d31f |
41 | if (is_array($msg) == 1) { |
42 | // Marks the selected messages ad 'Deleted' |
43 | $j = 0; |
44 | $i = 0; |
2d7d3c2a |
45 | |
dd88d31f |
46 | // If they have selected nothing msg is size one still, but will be an infinite |
47 | // loop because we never increment j. so check to see if msg[0] is set or not to fix this. |
48 | while ($j < count($msg)) { |
49 | if ($msg[$i]) { |
de80e95e |
50 | deleteMessages($imapConnection, $msg[$i], $msg[$i], $numMessages, $trash_folder, $move_to_trash, $auto_expunge, $mailbox); |
dd88d31f |
51 | $j++; |
2d7d3c2a |
52 | } |
dd88d31f |
53 | $i++; |
2d7d3c2a |
54 | } |
dd88d31f |
55 | messages_deleted_message($mailbox, $sort, $startMessage); |
56 | } else { |
57 | echo "<BR><BR><CENTER>No messages selected.</CENTER>"; |
58 | } |
59 | } else { // Move messages |
60 | displayPageHeader($mailbox); |
61 | // lets check to see if they selected any messages |
62 | if (is_array($msg) == 1) { |
63 | $j = 0; |
64 | $i = 0; |
65 | |
66 | // If they have selected nothing msg is size one still, but will be an infinite |
67 | // loop because we never increment j. so check to see if msg[0] is set or not to fix this. |
68 | while ($j < count($msg)) { |
69 | if ($msg[$i]) { |
70 | /** check if they would like to move it to the trash folder or not */ |
71 | $success = copyMessages($imapConnection, $msg[$i], $msg[$i], $targetMailbox); |
72 | if ($success == true) |
73 | setMessageFlag($imapConnection, $msg[$i], $msg[$i], "Deleted"); |
74 | $j++; |
75 | } |
76 | $i++; |
77 | } |
78 | if ($auto_expunge == true) |
79 | expungeBox($imapConnection, $mailbox, $numMessages); |
de80e95e |
80 | |
81 | messages_moved_message($mailbox, $sort, $startMessage); |
dd88d31f |
82 | } else { |
de80e95e |
83 | error_message("No messages were selected.", $mailbox, $sort, $startMessage); |
2d7d3c2a |
84 | } |
b40316f9 |
85 | } |
86 | |
b40316f9 |
87 | // Log out this session |
88 | fputs($imapConnection, "1 logout"); |
89 | |
2aa12d5e |
90 | ?> |
aa32c5e4 |
91 | </BODY></HTML> |