5 ** Copyright (c) 1999-2000 The SquirrelMail development team
6 ** Licensed under the GNU GPL. For full terms see the file COPYING.
8 ** Handles deleting messages from the trash folder without
9 ** deleting subfolders.
14 include('../src/validate.php');
15 include("../functions/page_header.php");
16 include("../functions/display_messages.php");
17 include("../functions/imap.php");
18 include("../functions/array.php");
19 include("../functions/tree.php");
20 include("../src/load_prefs.php");
22 $imap_stream = sqimap_login($username, $key, $imapServerAddress, $imapPort, 0);
24 sqimap_mailbox_list($imap_stream);
26 $mailbox = $trash_folder;
27 $boxes = sqimap_mailbox_list($imap_stream);
28 $dm = sqimap_get_delimiter($imap_stream);
30 // According to RFC2060, a DELETE command should NOT remove inferiors (sub folders)
31 // so lets go through the list of subfolders and remove them before removing the
34 /** First create the top node in the tree **/
35 for ($i = 0;$i < count($boxes);$i++
) {
36 if (($boxes[$i]["unformatted"] == $mailbox) && (strlen($boxes[$i]["unformatted"]) == strlen($mailbox))) {
37 $foldersTree[0]["value"] = $mailbox;
38 $foldersTree[0]["doIHaveChildren"] = false;
42 // Now create the nodes for subfolders of the parent folder
43 // You can tell that it is a subfolder by tacking the mailbox delimiter
44 // on the end of the $mailbox string, and compare to that.
46 for ($i = 0;$i < count($boxes);$i++
) {
47 if (substr($boxes[$i]["unformatted"], 0, strlen($mailbox . $dm)) == ($mailbox . $dm)) {
48 addChildNodeToTree($boxes[$i]["unformatted"], $boxes[$i]["unformatted-dm"], $foldersTree);
52 // now lets go through the tree and delete the folders
53 walkTreeInPreOrderEmptyTrash(0, $imap_stream, $foldersTree);
55 $location = get_location();
56 header ("Location: $location/left_main.php");
58 sqimap_logout($imap_stream);