tree functionality
[squirrelmail.git] / src / empty_trash.php
CommitLineData
7a783442 1<?
2 include("../config/config.php");
7a783442 3 include("../functions/strings.php");
4 include("../functions/page_header.php");
5 include("../functions/display_messages.php");
2aa12d5e 6 include("../functions/imap.php");
7ce342dc 7 include("../functions/array.php");
7a783442 8
d3cdb279 9 include("../src/load_prefs.php");
10
813eba2f 11 $imapConnection = sqimap_login($username, $key, $imapServerAddress, 0);
7a783442 12
813eba2f 13 sqimap_mailbox_list($imapConnection, $boxes);
d92b6f31 14
15 $mailbox = $trash_folder;
16 fputs($imapConnection, "1 LIST \"$mailbox\" *\n");
813eba2f 17 $data = sqimap_read_data($imapConnection , "1", false, $response, $message);
0a1d5f3a 18
813eba2f 19 $dm = sqimap_get_delimiter($imapConnection);
7cad6205 20
0a1d5f3a 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
7cad6205 28// for ($i = 0; $i < count($boxes); $i++) {
0a1d5f3a 29// if (($boxes[$i]["UNFORMATTED"] == $mailbox) ||
30// (substr($boxes[$i]["UNFORMATTED"], 0, strlen($mailbox . $dm)) == $mailbox . $dm)) {
7cad6205 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
813eba2f 37// sqimap_mailbox_delete($imapConnection, $mailbox, $dm);
38 sqimap_mailbox_create($imapConnection, "$trash_folder", "");
a11899fd 39
813eba2f 40 sqimap_mailbox_select($imapConnection, $trash_folder, $numMessages);
f8f9bed9 41 echo "<HTML><BODY TEXT=\"$color[8]\" BGCOLOR=\"$color[4]\" LINK=\"$color[7]\" VLINK=\"$color[7]\" ALINK=\"$color[7]\">\n";
42 displayPageHeader($color, $mailbox);
d92b6f31 43 messages_deleted_message($trash_folder, $sort, $startMessage, $color);
813eba2f 44 sqimap_logout($imapConnection);
2aa12d5e 45?>