pulled out all the login stuff and error checking from each individual php file
[squirrelmail.git] / src / folders_delete.php
CommitLineData
b40316f9 1<?
2 include("../config/config.php");
3 include("../functions/strings.php");
4 include("../functions/page_header.php");
5 include("../functions/imap.php");
6
2aa12d5e 7 $imapConnection = loginToImapServer($username, $key, $imapServerAddress);
8c7dfc99 8
9 // switch to the mailbox, and get the number of messages in it.
10 selectMailbox($imapConnection, $mailbox, $numMessages);
11
12 // Marks the selected messages ad 'Deleted'
13 $j = 0;
14 $i = 0;
15
16 while ($j < count($msg)) {
17 if ($msg[$i]) {
18 /** check if they would like to move it to the trash folder or not */
19 if ($move_to_trash == true) {
20 createFolder($imapConnection, "user.$username.$folder");
21 $success = copyMessages($imapConnection, $msg[$i], $msg[$i], $trash_folder);
22 if ($success == true)
23 setMessageFlag($imapConnection, $msg[$i], $msg[$i], "Deleted");
24 } else {
25 setMessageFlag($imapConnection, $msg[$i], "Deleted");
26 }
27 $j++;
28 }
29 $i++;
30 }
31
32 if ($auto_expunge == true)
33 expungeBox($imapConnection, $mailbox, $numMessages);
b40316f9 34
8c7dfc99 35 // Log out this session
36 fputs($imapConnection, "1 logout");
b40316f9 37
38 echo "<BR><BR><A HREF=\"folders.php\">Return</A>";
39?>
40
41