ee460ba4e0b37d93aeaf46246b9c0a22960e90eb
[squirrelmail.git] / src / empty_trash.php
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");
7
8 $imapConnection = fsockopen($imapServerAddress, 143, &$errorNumber, &$errorString);
9 if (!$imapConnection) {
10 echo "Error connecting to IMAP Server.<br>";
11 echo "$errorNumber : $errorString<br>";
12 exit;
13 }
14 $serverInfo = fgets($imapConnection, 256);
15
16 // login
17 fputs($imapConnection, "1 login $username $key\n");
18 $read = fgets($imapConnection, 1024);
19
20 if (strpos($read, "NO")) {
21 error_username_password_incorrect();
22 exit;
23 }
24
25 // switch to the mailbox, and get the number of messages in it.
26 selectMailbox($imapConnection, $mailbox, $numMessages);
27
28 if ($mailbox != $trash_folder) {
29 echo "ERROR -- I'm not in the trash folder!<BR>";
30 exit;
31 }
32
33 // mark them as deleted
34 setMessageFlag($imapConnection, 1, $numMessages, "Deleted");
35 expungeBox($imapConnection, $mailbox);
36
37 // Log out this session
38 fputs($imapConnection, "1 logout");
39
40 echo "<HTML><BODY TEXT=\"#000000\" BGCOLOR=\"#FFFFFF\" LINK=\"#0000EE\" VLINK=\"#0000EE\" ALINK=\"#0000EE\">";
41 displayPageHeader($mailbox);
42
43 messages_deleted_message($mailbox, $sort, $startMessage);
44 ?>