pulled out all the login stuff and error checking from each individual php file
[squirrelmail.git] / src / move_messages.php
CommitLineData
b40316f9 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
2aa12d5e 8 $imapConnection = loginToImapServer($username, $key);
b40316f9 9
10 // switch to the mailbox, and get the number of messages in it.
2aa12d5e 11 selectMailbox($imapConnection, $mailbox, $numMessages, $imapServerAddress);
b40316f9 12
13 // Marks the selected messages ad 'Deleted'
14 $j = 0;
15 $i = 0;
16
17 while ($j < count($msg)) {
18 if ($msg[$i]) {
19 /** check if they would like to move it to the trash folder or not */
20 if ($move_to_trash == true) {
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);
34
35 // Log out this session
36 fputs($imapConnection, "1 logout");
37
38 echo "<HTML><BODY TEXT=\"#000000\" BGCOLOR=\"#FFFFFF\" LINK=\"#0000EE\" VLINK=\"#0000EE\" ALINK=\"#0000EE\">";
39 displayPageHeader($mailbox);
40
41 messages_deleted_message($mailbox, $sort, $startMessage);
2aa12d5e 42?>