b40316f9 |
1 | <? |
2 | include("../config/config.php"); |
3 | include("../functions/mailbox.php"); |
4 | include("../functions/strings.php"); |
5 | include("../functions/page_header.php"); |
6 | include("../functions/display_messages.php"); |
7 | |
8 | $imapConnection = fsockopen($imapServerAddress, 143, &$errorNumber, &$errorString); |
9 | if (!$imapConnection) { |
10 | echo "Error connecting to IMAP Server.<br>"; |
11 | echo "$errorNumber : $errorString<br>"; |
12 | exit; |
13 | } |
14 | $serverInfo = fgets($imapConnection, 256); |
15 | |
16 | // login |
17 | fputs($imapConnection, "1 login $username $key\n"); |
18 | $read = fgets($imapConnection, 1024); |
19 | |
20 | if (strpos($read, "NO")) { |
21 | error_username_password_incorrect(); |
22 | exit; |
23 | } |
24 | |
25 | // switch to the mailbox, and get the number of messages in it. |
26 | selectMailbox($imapConnection, $mailbox, $numMessages); |
27 | |
28 | // Marks the selected messages ad 'Deleted' |
29 | $j = 0; |
30 | $i = 0; |
31 | |
32 | while ($j < count($msg)) { |
33 | if ($msg[$i]) { |
34 | /** check if they would like to move it to the trash folder or not */ |
35 | if ($move_to_trash == true) { |
36 | $success = copyMessages($imapConnection, $msg[$i], $msg[$i], $trash_folder); |
37 | if ($success == true) |
38 | setMessageFlag($imapConnection, $msg[$i], $msg[$i], "Deleted"); |
39 | } else { |
40 | setMessageFlag($imapConnection, $msg[$i], "Deleted"); |
41 | } |
42 | $j++; |
43 | } |
44 | $i++; |
45 | } |
46 | |
47 | if ($auto_expunge == true) |
48 | expungeBox($imapConnection, $mailbox, $numMessages); |
49 | |
50 | // Log out this session |
51 | fputs($imapConnection, "1 logout"); |
52 | |
53 | echo "<HTML><BODY TEXT=\"#000000\" BGCOLOR=\"#FFFFFF\" LINK=\"#0000EE\" VLINK=\"#0000EE\" ALINK=\"#0000EE\">"; |
54 | displayPageHeader($mailbox); |
55 | |
56 | messages_deleted_message($mailbox, $sort, $startMessage); |
57 | ?> |