commit | author | age
|
9b3fdc
|
1 |
<?php |
A |
2 |
|
|
3 |
/* |
|
4 |
+-----------------------------------------------------------------------+ |
|
5 |
| program/steps/mail/copy.inc | |
|
6 |
| | |
e019f2
|
7 |
| This file is part of the Roundcube Webmail client | |
188247
|
8 |
| Copyright (C) 2005-2014, The Roundcube Dev Team | |
7fe381
|
9 |
| | |
T |
10 |
| Licensed under the GNU General Public License version 3 or | |
|
11 |
| any later version with exceptions for skins & plugins. | |
|
12 |
| See the README file for a full license statement. | |
9b3fdc
|
13 |
| | |
A |
14 |
| PURPOSE: | |
|
15 |
| Copy the submitted messages to a specific mailbox | |
|
16 |
| | |
|
17 |
+-----------------------------------------------------------------------+ |
|
18 |
| Author: Aleksander Machniak <alec@alec.pl> | |
|
19 |
+-----------------------------------------------------------------------+ |
|
20 |
*/ |
|
21 |
|
|
22 |
// only process ajax requests |
c97625
|
23 |
if (!$OUTPUT->ajax_call) { |
AM |
24 |
return; |
|
25 |
} |
9b3fdc
|
26 |
|
A |
27 |
// move messages |
4dfae9
|
28 |
if (!empty($_POST['_uid']) && strlen($_POST['_target_mbox'])) { |
6b2b2e
|
29 |
$target = rcube_utils::get_input_value('_target_mbox', rcube_utils::INPUT_POST, true); |
9b3fdc
|
30 |
|
0456f7
|
31 |
foreach (rcmail::get_uids() as $mbox => $uids) { |
24e63e
|
32 |
if ($mbox === $target) |
188247
|
33 |
$copied++; |
TB |
34 |
else |
|
35 |
$copied += (int)$RCMAIL->storage->copy_message($uids, $target, $mbox); |
9684dc
|
36 |
} |
c50d88
|
37 |
|
9b3fdc
|
38 |
if (!$copied) { |
A |
39 |
// send error message |
6b2b2e
|
40 |
$RCMAIL->display_server_error('errorcopying'); |
9b3fdc
|
41 |
$OUTPUT->send(); |
A |
42 |
exit; |
|
43 |
} |
c50d88
|
44 |
else { |
A |
45 |
$OUTPUT->show_message('messagecopied', 'confirmation'); |
|
46 |
} |
9b3fdc
|
47 |
|
A |
48 |
rcmail_send_unread_count($target, true); |
|
49 |
|
6b2b2e
|
50 |
$OUTPUT->command('set_quota', $RCMAIL->quota_content()); |
9b3fdc
|
51 |
} |
A |
52 |
// unknown action or missing query param |
|
53 |
else { |
4dfae9
|
54 |
$OUTPUT->show_message('internalerror', 'error'); |
9b3fdc
|
55 |
} |
A |
56 |
|
|
57 |
// send response |
|
58 |
$OUTPUT->send(); |