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