- // If the delete button was pressed, the moveButton variable will not be set.
- if (is_array($msg)) {
- // Marks the selected messages as 'Deleted'
- $j = $i = $cnt = 0;
- $id = array();
- // 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 (isset($msg[$i])) {
- $id[] = $msg[$i];
- $j++;
+ if ($num_ids) {
+ if (!isset($attache)) {
+ if (isset($markRead)) {
+ sqimap_toggle_flag($imapConnection, $id, '\\Seen',true,true);
+ } else if (isset($markUnread)) {
+ sqimap_toggle_flag($imapConnection, $id, '\\Seen',false,true);
+ } else if (isset($markFlagged)) {
+ sqimap_toggle_flag($imapConnection, $id, '\\Flagged', true, true);
+ } else if (isset($markUnflagged)) {
+ sqimap_toggle_flag($imapConnection, $id, '\\Flagged', false, true);
+ } else { // Delete messages
+ if (!boolean_hook_function('move_messages_button_action', NULL, 1)) {
+ sqimap_msgs_list_delete($imapConnection, $mailbox, $id,$bypass_trash);
+ if ($auto_expunge) {
+ $num_ids = sqimap_mailbox_expunge($imapConnection, $mailbox, true);
+ }
+ $change = true;
+ }
+ }
+ } else {
+ $composesession = attachSelectedMessages($id, $imapConnection);
+ $location = set_url_var($location, 'session', $composesession, false);
+ if ($compose_new_win) {
+ $location = set_url_var($location, 'composenew', 1, false);
+ } else {
+ $location = str_replace('search.php','compose.php',$location);
+ $location = str_replace('right_main.php','compose.php',$location);