X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=src%2Fmove_messages.php;h=c5f4c837d9bc53913160a24f89604c368755d9df;hb=8061a3fb7663a4e8edf2f415e5547fc81bcdbcb6;hp=93c48ec2b1bfa2dbc563096dc38d2a4b3860addb;hpb=f8f9bed9bb69ef0432fbc67741f82071b6582b4d;p=squirrelmail.git diff --git a/src/move_messages.php b/src/move_messages.php index 93c48ec2..c5f4c837 100644 --- a/src/move_messages.php +++ b/src/move_messages.php @@ -1,20 +1,27 @@ - - include("../config/config.php"); - include("../functions/mailbox.php"); - include("../functions/strings.php"); - include("../functions/page_header.php"); +
\n"; - function putSelectedMessagesIntoString($msg) { $j = 0; $i = 0; $firstLoop = true; - // If they have selected nothing msg is size one still, but will be an infinite - // loop because we never increment j. so check to see if msg[0] is set or not to fix this. + // If they have selected nothing msg is size one still, but will + // be an infinite loop because we never increment j. so check to + // see if msg[0] is set or not to fix this. while (($j < count($msg)) && ($msg[0])) { if ($msg[$i]) { if ($firstLoop != true) @@ -30,35 +37,74 @@ } } - $imapConnection = loginToImapServer($username, $key, $imapServerAddress); + $imapConnection = sqimap_login($username, $key, $imapServerAddress, $imapPort, 0); + sqimap_mailbox_select($imapConnection, $mailbox); - // switch to the mailbox, and get the number of messages in it. - selectMailbox($imapConnection, $mailbox, $numMessages, $imapServerAddress); + // expunge-on-demand if user isn't using move_to_trash or auto_expunge + if(isset($expungeButton)) { + sqimap_mailbox_expunge($imapConnection, $mailbox, true); + $location = get_location(); + if ($where && $what) + header ("Location: $location/search.php?mailbox=".urlencode($mailbox)."&what=".urlencode($what)."&where=".urlencode($where)); + else + header ("Location: $location/right_main.php?sort=$sort&startMessage=$startMessage&mailbox=". urlencode($mailbox)); + } + // undelete messages if user isn't using move_to_trash or auto_expunge + elseif(isset($undeleteButton)) { + if (is_array($msg) == 1) { + // Removes \Deleted flag from selected messages + $j = 0; + $i = 0; + + // If they have selected nothing msg is size one still, but will be an infinite + // loop because we never increment j. so check to see if msg[0] is set or not to fix this. + while ($j < count($msg)) { + if ($msg[$i]) { + sqimap_messages_remove_flag ($imapConnection, $msg[$i], $msg[$i], "Deleted"); + $j++; + } + $i++; + } + $location = get_location(); + if ($where && $what) + header ("Location: $location/search.php?mailbox=".urlencode($mailbox)."&what=".urlencode($what)."&where=".urlencode($where)); + else + header ("Location: $location/right_main.php?sort=$sort&startMessage=$startMessage&mailbox=". urlencode($mailbox)); + } else { + displayPageHeader($color, $mailbox); + error_message(_("No messages were selected."), $mailbox, $sort, $startMessage, $color); + } + } // If the delete button was pressed, the moveButton variable will not be set. - if (!$moveButton) { - displayPageHeader($color, $mailbox); + elseif (!isset($moveButton)) { if (is_array($msg) == 1) { - // Marks the selected messages ad 'Deleted' + // Marks the selected messages as 'Deleted' $j = 0; $i = 0; // If they have selected nothing msg is size one still, but will be an infinite // loop because we never increment j. so check to see if msg[0] is set or not to fix this. while ($j < count($msg)) { - if ($msg[$i]) { - echo "MSG: $msg[$i]