X-Git-Url: https://vcs.fsf.org/?p=squirrelmail.git;a=blobdiff_plain;f=src%2Fempty_trash.php;h=e4d230fea53e82c69635bc734a36647c572315a0;hp=bc554d636e71037f6b36a475387775510aeb05dd;hb=465db5d77d307359c7e4a2f526186c758db0dd50;hpb=c876cd2a68bb8e18eefe83342b11989e2f6906b8 diff --git a/src/empty_trash.php b/src/empty_trash.php index bc554d63..e4d230fe 100644 --- a/src/empty_trash.php +++ b/src/empty_trash.php @@ -5,51 +5,33 @@ include("../functions/page_header.php"); include("../functions/display_messages.php"); include("../functions/imap.php"); + include("../functions/array.php"); - $imapConnection = loginToImapServer($username, $key, $imapServerAddress); - - // switch to the mailbox, and get the number of messages in it. - selectMailbox($imapConnection, $mailbox, $numMessages); - - if ($mailbox != $trash_folder) { - echo "ERROR -- I'm not in the trash folder!
"; - exit; - } - - - /** GET FOLDER ARRAY OF TRASH SUBFOLDERS **/ - fputs($imapConnection, "1 list \"\" *\n"); - $str = imapReadData($imapConnection); + include("../src/load_prefs.php"); - for ($i = 0;$i < count($str); $i++) { - $box = Chop($str[$i]); - $mailbox = findMailboxName($box); + $imapConnection = loginToImapServer($username, $key, $imapServerAddress); - if (strpos($box, $trash_folder) > 0) { - $folders[$i] = $mailbox; - } else { - $folders[$i] = "NOPE"; + getFolderList($imapConnection, $boxes); + + $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); + createFolder($imapConnection, "$trash_folder", ""); - // 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); - } - } - // Log out this session + selectMailbox($imapConnection, $trash_folder, $numMessages); + echo "\n"; + displayPageHeader($color, $mailbox); + messages_deleted_message($trash_folder, $sort, $startMessage, $color); fputs($imapConnection, "1 logout"); - - echo ""; - displayPageHeader($mailbox); - - messages_deleted_message("INBOX", $sort, $startMessage); ?>