commit | author | age
|
15a9d1
|
1 |
<?php |
T |
2 |
|
|
3 |
/* |
|
4 |
+-----------------------------------------------------------------------+ |
|
5 |
| program/steps/mail/folders.inc | |
|
6 |
| | |
e019f2
|
7 |
| This file is part of the Roundcube Webmail client | |
f5e7b3
|
8 |
| Copyright (C) 2005-2009, 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. | |
15a9d1
|
13 |
| | |
T |
14 |
| PURPOSE: | |
|
15 |
| Implement folder operations line EXPUNGE and Clear | |
|
16 |
| | |
|
17 |
+-----------------------------------------------------------------------+ |
|
18 |
| Author: Thomas Bruederli <roundcube@gmail.com> | |
|
19 |
+-----------------------------------------------------------------------+ |
|
20 |
*/ |
|
21 |
|
881217
|
22 |
// only process ajax requests |
T |
23 |
if (!$OUTPUT->ajax_call) |
90f81a
|
24 |
return; |
881217
|
25 |
|
b72e2f
|
26 |
$mbox = get_input_value('_mbox', RCUBE_INPUT_POST, true); |
15a9d1
|
27 |
|
T |
28 |
// send EXPUNGE command |
90f81a
|
29 |
if ($RCMAIL->action == 'expunge') { |
15a9d1
|
30 |
|
c321a9
|
31 |
$success = $RCMAIL->storage->expunge_folder($mbox); |
90f81a
|
32 |
|
A |
33 |
// reload message list if current mailbox |
|
34 |
if ($success) { |
|
35 |
$OUTPUT->show_message('folderexpunged', 'confirmation'); |
|
36 |
|
|
37 |
if (!empty($_REQUEST['_reload'])) { |
|
38 |
$OUTPUT->command('set_quota', rcmail_quota_content()); |
|
39 |
$OUTPUT->command('message_list.clear'); |
|
40 |
$RCMAIL->action = 'list'; |
|
41 |
return; |
|
42 |
} |
|
43 |
} |
|
44 |
else { |
|
45 |
rcmail_display_server_error(); |
|
46 |
} |
f11541
|
47 |
} |
15a9d1
|
48 |
|
T |
49 |
// clear mailbox |
90f81a
|
50 |
else if ($RCMAIL->action == 'purge') |
f11541
|
51 |
{ |
c321a9
|
52 |
$delimiter = $RCMAIL->storage->get_hierarchy_delimiter(); |
90f81a
|
53 |
$trash_regexp = '/^' . preg_quote($CONFIG['trash_mbox'] . $delimiter, '/') . '/'; |
A |
54 |
$junk_regexp = '/^' . preg_quote($CONFIG['junk_mbox'] . $delimiter, '/') . '/'; |
ddd776
|
55 |
|
90f81a
|
56 |
// we should only be purging trash and junk (or their subfolders) |
A |
57 |
if ($mbox == $CONFIG['trash_mbox'] || $mbox == $CONFIG['junk_mbox'] |
|
58 |
|| preg_match($trash_regexp, $mbox) || preg_match($junk_regexp, $mbox) |
|
59 |
) { |
c321a9
|
60 |
$success = $RCMAIL->storage->clear_folder($mbox); |
b46edc
|
61 |
|
90f81a
|
62 |
if ($success) { |
A |
63 |
$OUTPUT->show_message('folderpurged', 'confirmation'); |
|
64 |
|
|
65 |
if (!empty($_REQUEST['_reload'])) { |
|
66 |
$OUTPUT->set_env('messagecount', 0); |
|
67 |
$OUTPUT->set_env('pagecount', 0); |
04689f
|
68 |
$OUTPUT->set_env('exists', 0); |
90f81a
|
69 |
$OUTPUT->command('message_list.clear'); |
bba252
|
70 |
$OUTPUT->command('set_rowcount', rcmail_get_messagecount_text(), $mbox); |
90f81a
|
71 |
$OUTPUT->command('set_unread_count', $mbox, 0); |
A |
72 |
$OUTPUT->command('set_quota', rcmail_quota_content()); |
|
73 |
rcmail_set_unseen_count($mbox, 0); |
|
74 |
} |
|
75 |
} |
|
76 |
else { |
|
77 |
rcmail_display_server_error(); |
|
78 |
} |
a02d48
|
79 |
} |
f11541
|
80 |
} |
15a9d1
|
81 |
|
90f81a
|
82 |
$OUTPUT->send(); |