comparison program/steps/mail/copy.inc @ 0:4681f974d28b

vanilla 1.3.3 distro, I hope
author Charlie Root
date Thu, 04 Jan 2018 15:52:31 -0500
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:4681f974d28b
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-2014, The Roundcube Dev Team |
9 | |
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. |
13 | |
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
23 if (!$OUTPUT->ajax_call) {
24 return;
25 }
26
27 // copy messages
28 if (!empty($_POST['_uid']) && strlen($_POST['_target_mbox'])) {
29 $target = rcube_utils::get_input_value('_target_mbox', rcube_utils::INPUT_POST, true);
30 $sources = array();
31
32 foreach (rcmail::get_uids(null, null, $multifolder) as $mbox => $uids) {
33 if ($mbox === $target) {
34 $copied++;
35 }
36 else {
37 $copied += (int)$RCMAIL->storage->copy_message($uids, $target, $mbox);
38 $sources[] = $mbox;
39 }
40 }
41
42 if (!$copied) {
43 // send error message
44 $RCMAIL->display_server_error('errorcopying');
45 $OUTPUT->send();
46 exit;
47 }
48 else {
49 $OUTPUT->show_message('messagecopied', 'confirmation');
50 }
51
52 rcmail_send_unread_count($target, true);
53
54 $OUTPUT->command('set_quota', $RCMAIL->quota_content(null, $multifolder ? $sources[0] : 'INBOX'));
55 }
56 // unknown action or missing query param
57 else {
58 $OUTPUT->show_message('internalerror', 'error');
59 }
60
61 // send response
62 $OUTPUT->send();