| | |
| | | | program/steps/mail/move_del.inc | |
| | | | | |
| | | | This file is part of the Roundcube Webmail client | |
| | | | Copyright (C) 2005-2013, The Roundcube Dev Team | |
| | | | Copyright (C) 2005-2014, The Roundcube Dev Team | |
| | | | | |
| | | | Licensed under the GNU General Public License version 3 or | |
| | | | any later version with exceptions for skins & plugins. | |
| | |
| | | $threading = (bool) $RCMAIL->storage->get_threading(); |
| | | $old_count = $RCMAIL->storage->count(NULL, $threading ? 'THREADS' : 'ALL'); |
| | | $old_pages = ceil($old_count / $RCMAIL->storage->get_pagesize()); |
| | | $sources = array(); |
| | | |
| | | $trash = $RCMAIL->config->get('trash_mbox'); |
| | | |
| | | // move messages |
| | | if ($RCMAIL->action == 'move' && !empty($_POST['_uid']) && strlen($_POST['_target_mbox'])) { |
| | | <<<<<<< HEAD |
| | | $target = rcube_utils::get_input_value('_target_mbox', rcube_utils::INPUT_POST, true); |
| | | ======= |
| | | $target = get_input_value('_target_mbox', RCUBE_INPUT_POST, true); |
| | | >>>>>>> 010a350715f1a36eab666fe26d3118ed025133c1 |
| | | $trash = $RCMAIL->config->get('trash_mbox'); |
| | | |
| | | foreach (rcmail_get_uids() as $mbox => $uids) { |
| | | $moved += (int)$RCMAIL->storage->move_message($uids, $target, $mbox); |
| | | $count += count($uids); |
| | | $success = true; |
| | | foreach (rcmail::get_uids(null, null, $multifolder) as $mbox => $uids) { |
| | | if ($mbox === $target) { |
| | | $count += count($uids); |
| | | } |
| | | else if ($RCMAIL->storage->move_message($uids, $target, $mbox)) { |
| | | $count += count($uids); |
| | | $sources[] = $mbox; |
| | | } |
| | | else { |
| | | $success = false; |
| | | } |
| | | } |
| | | |
| | | if (!$moved) { |
| | | if (!$success) { |
| | | // send error message |
| | | if ($_POST['_from'] != 'show') |
| | | $OUTPUT->command('list_mailbox'); |
| | |
| | | $OUTPUT->show_message('messagemoved', 'confirmation'); |
| | | } |
| | | |
| | | $addrows = true; |
| | | if (!empty($_POST['_refresh'])) { |
| | | // FIXME: send updated message rows instead of releading the entire list |
| | | $OUTPUT->command('refresh_list'); |
| | | } |
| | | else { |
| | | $addrows = true; |
| | | } |
| | | } |
| | | // delete messages |
| | | else if ($RCMAIL->action=='delete' && !empty($_POST['_uid'])) { |
| | | foreach (rcmail_get_uids() as $mbox => $uids) { |
| | | $del += (int)$RCMAIL->storage->delete_message($uids, $mbox); |
| | | $count += count($uids); |
| | | else if ($RCMAIL->action == 'delete' && !empty($_POST['_uid'])) { |
| | | foreach (rcmail::get_uids(null, null, $multifolder) as $mbox => $uids) { |
| | | $del += (int)$RCMAIL->storage->delete_message($uids, $mbox); |
| | | $count += count($uids); |
| | | $sources[] = $mbox; |
| | | } |
| | | |
| | | if (!$del) { |
| | |
| | | rcmail_send_unread_count($target, true); |
| | | } |
| | | |
| | | $OUTPUT->command('set_quota', $RCMAIL->quota_content()); |
| | | $OUTPUT->command('set_quota', $RCMAIL->quota_content(null, $multifolder ? $sources[0] : 'INBOX')); |
| | | $OUTPUT->command('set_rowcount', rcmail_get_messagecount_text($msg_count), $mbox); |
| | | |
| | | if ($threading) { |
| | |
| | | $OUTPUT->command('set_trash_count', $exists); |
| | | } |
| | | else if ($target !== null && $target === $trash) { |
| | | $OUTPUT->command('set_trash_count', $RCMAIL->storage->count($trash, 'EXISTS')); |
| | | $OUTPUT->command('set_trash_count', $RCMAIL->storage->count($trash, 'EXISTS', true)); |
| | | } |
| | | } |
| | | |