tree functionality
[squirrelmail.git] / src / empty_trash.php
1 <?
2 include("../config/config.php");
3 include("../functions/strings.php");
4 include("../functions/page_header.php");
5 include("../functions/display_messages.php");
6 include("../functions/imap.php");
7 include("../functions/array.php");
8
9 include("../src/load_prefs.php");
10
11 $imapConnection = sqimap_login($username, $key, $imapServerAddress, 0);
12
13 sqimap_mailbox_list($imapConnection, $boxes);
14
15 $mailbox = $trash_folder;
16 fputs($imapConnection, "1 LIST \"$mailbox\" *\n");
17 $data = sqimap_read_data($imapConnection , "1", false, $response, $message);
18
19 $dm = sqimap_get_delimiter($imapConnection);
20
21 // According to RFC2060, a DELETE command should NOT remove inferiors (sub folders)
22 // so lets go through the list of subfolders and remove them before removing the
23 // parent.
24 // BUG??? - what if a subfolder has a subfolder?? need to start at lowest level
25 // and work up.
26
27
28 // for ($i = 0; $i < count($boxes); $i++) {
29 // if (($boxes[$i]["UNFORMATTED"] == $mailbox) ||
30 // (substr($boxes[$i]["UNFORMATTED"], 0, strlen($mailbox . $dm)) == $mailbox . $dm)) {
31 // if (($boxes[$i]["UNFORMATTED"] != $mailbox) && (substr($boxes[$i]["UNFORMATTED"], 0, strlen($mailbox . $dm)) == $mailbox . $dm)) {
32 // removeFolder($imapConnection, $boxes[$i]["UNFORMATTED"], $dm);
33 // }
34 // }
35
36 // lets remove the trash folder
37 // sqimap_mailbox_delete($imapConnection, $mailbox, $dm);
38 sqimap_mailbox_create($imapConnection, "$trash_folder", "");
39
40 sqimap_mailbox_select($imapConnection, $trash_folder, $numMessages);
41 echo "<HTML><BODY TEXT=\"$color[8]\" BGCOLOR=\"$color[4]\" LINK=\"$color[7]\" VLINK=\"$color[7]\" ALINK=\"$color[7]\">\n";
42 displayPageHeader($color, $mailbox);
43 messages_deleted_message($trash_folder, $sort, $startMessage, $color);
44 sqimap_logout($imapConnection);
45 ?>