* Word Wrapping works good
[squirrelmail.git] / src / move_messages.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 include("../functions/imap.php");
8
9 echo "<HTML><BODY TEXT=\"#000000\" BGCOLOR=\"#FFFFFF\" LINK=\"#0000EE\" VLINK=\"#0000EE\" ALINK=\"#0000EE\">";
10 $imapConnection = loginToImapServer($username, $key, $imapServerAddress);
11
12 // switch to the mailbox, and get the number of messages in it.
13 selectMailbox($imapConnection, $mailbox, $numMessages, $imapServerAddress);
14
15 if (strtolower($move_or_delete) == "delete selected messages") {
16 // Marks the selected messages ad 'Deleted'
17 $j = 0;
18 $i = 0;
19 while ($j < count($msg)) {
20 if ($msg[$i]) {
21 /** check if they would like to move it to the trash folder or not */
22 if ($move_to_trash == true) {
23 $success = copyMessages($imapConnection, $msg[$i], $msg[$i], $trash_folder);
24 if ($success == true)
25 setMessageFlag($imapConnection, $msg[$i], $msg[$i], "Deleted");
26 } else {
27 setMessageFlag($imapConnection, $msg[$i], "Deleted");
28 }
29 $j++;
30 }
31 $i++;
32 }
33 if ($auto_expunge == true)
34 expungeBox($imapConnection, $mailbox, $numMessages);
35 displayPageHeader($mailbox);
36 messages_deleted_message($mailbox, $sort, $startMessage);
37 } else {
38 echo "Move";
39 }
40
41 // Log out this session
42 fputs($imapConnection, "1 logout");
43
44 ?>