| 1 | <HTML><BODY TEXT="#000000" BGCOLOR="#FFFFFF" LINK="#0000EE" VLINK="#0000EE" ALINK="#0000EE"> |
| 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"); |
| 8 | include("../functions/imap.php"); |
| 9 | |
| 10 | for ($i = 0; $i < count($msg); $i++) { |
| 11 | echo "MSG: $msg[$i]<BR>"; |
| 12 | } |
| 13 | |
| 14 | function putSelectedMessagesIntoString($msg) { |
| 15 | $j = 0; |
| 16 | $i = 0; |
| 17 | $firstLoop = true; |
| 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])) { |
| 22 | if ($msg[$i]) { |
| 23 | if ($firstLoop != true) |
| 24 | $selectedMessages .= "&"; |
| 25 | else |
| 26 | $firstLoop = false; |
| 27 | |
| 28 | $selectedMessages .= "selMsg[$j]=$msg[$i]"; |
| 29 | |
| 30 | $j++; |
| 31 | } |
| 32 | $i++; |
| 33 | } |
| 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) { |
| 44 | displayPageHeader($mailbox); |
| 45 | if (is_array($msg) == 1) { |
| 46 | // Marks the selected messages ad 'Deleted' |
| 47 | $j = 0; |
| 48 | $i = 0; |
| 49 | |
| 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]) { |
| 54 | deleteMessages($imapConnection, $msg[$i], $msg[$i], $numMessages, $trash_folder, $move_to_trash, $auto_expunge, $mailbox); |
| 55 | $j++; |
| 56 | } |
| 57 | $i++; |
| 58 | } |
| 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); |
| 84 | |
| 85 | messages_moved_message($mailbox, $sort, $startMessage); |
| 86 | } else { |
| 87 | error_message("No messages were selected.", $mailbox, $sort, $startMessage); |
| 88 | } |
| 89 | } |
| 90 | |
| 91 | // Log out this session |
| 92 | fputs($imapConnection, "1 logout"); |
| 93 | |
| 94 | ?> |
| 95 | </BODY></HTML> |