include("../functions/page_header.php");
include("../functions/display_messages.php");
include("../functions/imap.php");
+ include("../functions/array.php");
- $imapConnection = loginToImapServer($username, $key, $imapServerAddress);
+ include("../src/load_prefs.php");
- // switch to the mailbox, and get the number of messages in it.
- selectMailbox($imapConnection, $mailbox, $numMessages);
+ $imapConnection = loginToImapServer($username, $key, $imapServerAddress, 0);
- if ($mailbox != $trash_folder) {
- echo "ERROR -- I'm not in the trash folder!<BR>";
- exit;
- }
-
-
- /** GET FOLDER ARRAY OF TRASH SUBFOLDERS **/
- fputs($imapConnection, "1 list \"\" *\n");
- $str = imapReadData($imapConnection);
-
- for ($i = 0;$i < count($str); $i++) {
- $box = Chop($str[$i]);
- $mailbox = findMailboxName($box);
+ getFolderList($imapConnection, $boxes);
- if (strpos($box, $trash_folder) > 0) {
- $folders[$i] = $mailbox;
- } else {
- $folders[$i] = "NOPE";
+ $mailbox = $trash_folder;
+ fputs($imapConnection, "1 LIST \"$mailbox\" *\n");
+ $data = imapReadData($imapConnection , "1", false, $response, $message);
+ while (substr($data[0], strpos($data[0], " ")+1, 4) == "LIST") {
+ for ($i = 0; $i < count($boxes); $i++) {
+ if (($boxes[$i]["UNFORMATTED"] == $mailbox) ||
+ (substr($boxes[$i]["UNFORMATTED"], 0, strlen($mailbox . $dm)) == $mailbox . $dm)) {
+ removeFolder($imapConnection, $boxes[$i]["UNFORMATTED"]);
+ }
}
+ fputs($imapConnection, "1 LIST \"$mailbox\" *\n");
+ $data = imapReadData($imapConnection , "1", false, $response, $message);
}
- // mark them as deleted
- setMessageFlag($imapConnection, 1, $numMessages, "Deleted");
- expungeBox($imapConnection, $mailbox);
-
- // remove subfolders
- for ($i = 0; $i < count($folders); $i++) {
- if (($folders[$i] == "NOPE") || ($folders[$i] == "$trash_folder")) {
- } else {
- $thisfolder = getFolderNameMinusINBOX($folders[$i]);
- $thisfolder = "user.$username.$thisfolder";
- removeFolder($imapConnection, $thisfolder);
- }
- }
+ createFolder($imapConnection, "$trash_folder", "");
selectMailbox($imapConnection, $trash_folder, $numMessages);
- echo "<HTML><BODY TEXT=\"#000000\" BGCOLOR=\"#FFFFFF\" LINK=\"#0000EE\" VLINK=\"#0000EE\" ALINK=\"#0000EE\">";
- displayPageHeader($mailbox);
- messages_deleted_message($trash_folder, $sort, $startMessage);
+ echo "<HTML><BODY TEXT=\"$color[8]\" BGCOLOR=\"$color[4]\" LINK=\"$color[7]\" VLINK=\"$color[7]\" ALINK=\"$color[7]\">\n";
+ displayPageHeader($color, $mailbox);
+ messages_deleted_message($trash_folder, $sort, $startMessage, $color);
fputs($imapConnection, "1 logout");
?>