Aleksander Machniak
2013-07-01 a45f9b7bf58475ccc812e819f159638403c00419
program/steps/mail/move_del.inc
@@ -17,9 +17,6 @@
 +-----------------------------------------------------------------------+
 | Author: Thomas Bruederli <roundcube@gmail.com>                        |
 +-----------------------------------------------------------------------+
 $Id$
*/
// only process ajax requests
@@ -32,18 +29,19 @@
$old_pages = ceil($old_count / $RCMAIL->storage->get_pagesize());
// move messages
if ($RCMAIL->action=='moveto' && !empty($_POST['_uid']) && strlen($_POST['_target_mbox'])) {
    $count = sizeof(explode(',', ($uids = get_input_value('_uid', RCUBE_INPUT_POST))));
if ($RCMAIL->action == 'move' && !empty($_POST['_uid']) && strlen($_POST['_target_mbox'])) {
    $count  = sizeof(explode(',', ($uids = get_input_value('_uid', RCUBE_INPUT_POST))));
    $target = get_input_value('_target_mbox', RCUBE_INPUT_POST, true);
    $mbox = get_input_value('_mbox', RCUBE_INPUT_POST, true);
    $mbox   = get_input_value('_mbox', RCUBE_INPUT_POST, true);
    $trash  = $RCMAIL->config->get('trash_mbox');
    $moved = $RCMAIL->storage->move_message($uids, $target, $mbox);
    if (!$moved) {
        // send error message
       if ($_POST['_from'] != 'show')
        if ($_POST['_from'] != 'show')
            $OUTPUT->command('list_mailbox');
        rcmail_display_server_error('errormoving');
        rcmail_display_server_error('errormoving', null, $target == $trash ? 'delete' : '');
        $OUTPUT->send();
        exit;
    }
@@ -62,7 +60,7 @@
    if (!$del) {
        // send error message
       if ($_POST['_from'] != 'show')
        if ($_POST['_from'] != 'show')
            $OUTPUT->command('list_mailbox');
        rcmail_display_server_error('errordeleting');
        $OUTPUT->send();
@@ -76,6 +74,8 @@
}
// unknown action or missing query param
else {
    $OUTPUT->show_message('internalerror', 'error');
    $OUTPUT->send();
    exit;
}
@@ -114,6 +114,7 @@
  $OUTPUT->set_env('messagecount', $msg_count);
  $OUTPUT->set_env('current_page', $page);
  $OUTPUT->set_env('pagecount', $pages);
  $OUTPUT->set_env('exists', $RCMAIL->storage->count($mbox, 'EXISTS', true));
  // update mailboxlist
  $mbox = $RCMAIL->storage->get_folder();
@@ -125,7 +126,7 @@
    rcmail_set_unseen_count($mbox, $unseen_count);
  }
  if ($RCMAIL->action == 'moveto' && strlen($target)) {
  if ($RCMAIL->action == 'move' && strlen($target)) {
    rcmail_send_unread_count($target, true);
  }
@@ -138,11 +139,8 @@
  // add new rows from next page (if any)
  if ($addrows && $count && $uids != '*' && ($jump_back || $nextpage_count > 0)) {
    $sort_col   = isset($_SESSION['sort_col'])   ? $_SESSION['sort_col']   : $CONFIG['message_sort_col'];
    $sort_order = isset($_SESSION['sort_order']) ? $_SESSION['sort_order'] : $CONFIG['message_sort_order'];
    $a_headers = $RCMAIL->storage->list_messages($mbox, NULL, $sort_col, $sort_order,
      $jump_back ? NULL : $count);
    $a_headers = $RCMAIL->storage->list_messages($mbox, NULL,
      rcmail_sort_column(), rcmail_sort_order(), $jump_back ? NULL : $count);
    rcmail_js_message_list($a_headers, false);
  }
@@ -150,5 +148,3 @@
// send response
$OUTPUT->send();