]> git.donarmstrong.com Git - roundcube.git/blob - program/steps/mail/copy.inc
baebad319b41f0c70e9eeffce40d63759446beea
[roundcube.git] / program / steps / mail / copy.inc
1 <?php
2
3 /*
4  +-----------------------------------------------------------------------+
5  | program/steps/mail/copy.inc                                           |
6  |                                                                       |
7  | This file is part of the Roundcube Webmail client                     |
8  | Copyright (C) 2005-2010, Roundcube Dev. - Switzerland                 |
9  | Licensed under the GNU GPL                                            |
10  |                                                                       |
11  | PURPOSE:                                                              |
12  |   Copy the submitted messages to a specific mailbox                   |
13  |                                                                       |
14  +-----------------------------------------------------------------------+
15  | Author: Aleksander Machniak <alec@alec.pl>                            |
16  +-----------------------------------------------------------------------+
17
18  $Id: copy.inc 4321 2010-12-08 12:52:04Z alec $
19
20 */
21
22 // only process ajax requests
23 if (!$OUTPUT->ajax_call)
24   return;
25
26 // move messages
27 if (!empty($_POST['_uid']) && !empty($_POST['_target_mbox'])) {
28     $uids = get_input_value('_uid', RCUBE_INPUT_POST);
29     $target = get_input_value('_target_mbox', RCUBE_INPUT_POST, true);
30     $mbox = get_input_value('_mbox', RCUBE_INPUT_POST, true);
31
32     $copied = $IMAP->copy_message($uids, $target, $mbox);
33
34     if (!$copied) {
35         // send error message
36         rcmail_display_server_error('errorcopying');
37         $OUTPUT->send();
38         exit;
39     }
40     else {
41         $OUTPUT->show_message('messagecopied', 'confirmation');
42     }
43
44     rcmail_send_unread_count($target, true);
45
46     $OUTPUT->command('set_quota', rcmail_quota_content());
47 }
48 // unknown action or missing query param
49 else {
50     exit;
51 }
52
53 // send response
54 $OUTPUT->send();