more debug stuff for Shane
[squirrelmail.git] / src / empty_trash.php
CommitLineData
7a783442 1<?
2 include("../config/config.php");
3 include("../functions/mailbox.php");
4 include("../functions/strings.php");
5 include("../functions/page_header.php");
6 include("../functions/display_messages.php");
2aa12d5e 7 include("../functions/imap.php");
7ce342dc 8 include("../functions/array.php");
7a783442 9
d3cdb279 10 include("../src/load_prefs.php");
11
b235d629 12 $imapConnection = loginToImapServer($username, $key, $imapServerAddress, 0);
7a783442 13
7ce342dc 14 getFolderList($imapConnection, $boxes);
d92b6f31 15
16 $mailbox = $trash_folder;
17 fputs($imapConnection, "1 LIST \"$mailbox\" *\n");
18 $data = imapReadData($imapConnection , "1", false, $response, $message);
19 while (substr($data[0], strpos($data[0], " ")+1, 4) == "LIST") {
87d0dfb5 20 echo "DEBUG - data from IMAP \"LIST\" : " . $data[0] . "<BR>\n";
7ce342dc 21 for ($i = 0; $i < count($boxes); $i++) {
22 if (($boxes[$i]["UNFORMATTED"] == $mailbox) ||
23 (substr($boxes[$i]["UNFORMATTED"], 0, strlen($mailbox . $dm)) == $mailbox . $dm)) {
24 removeFolder($imapConnection, $boxes[$i]["UNFORMATTED"]);
d92b6f31 25 }
a11899fd 26 }
d92b6f31 27 fputs($imapConnection, "1 LIST \"$mailbox\" *\n");
28 $data = imapReadData($imapConnection , "1", false, $response, $message);
a11899fd 29 }
30
d92b6f31 31 createFolder($imapConnection, "$trash_folder", "");
7a783442 32
ad6787f0 33 selectMailbox($imapConnection, $trash_folder, $numMessages);
f8f9bed9 34 echo "<HTML><BODY TEXT=\"$color[8]\" BGCOLOR=\"$color[4]\" LINK=\"$color[7]\" VLINK=\"$color[7]\" ALINK=\"$color[7]\">\n";
35 displayPageHeader($color, $mailbox);
d92b6f31 36 messages_deleted_message($trash_folder, $sort, $startMessage, $color);
ad6787f0 37 fputs($imapConnection, "1 logout");
2aa12d5e 38?>