commit | author | age
|
15a9d1
|
1 |
<?php |
T |
2 |
|
|
3 |
/* |
|
4 |
+-----------------------------------------------------------------------+ |
|
5 |
| program/steps/mail/folders.inc | |
|
6 |
| | |
|
7 |
| This file is part of the RoundCube Webmail client | |
5349b7
|
8 |
| Copyright (C) 2005-2007, RoundCube Dev. - Switzerland | |
15a9d1
|
9 |
| Licensed under the GNU GPL | |
T |
10 |
| | |
|
11 |
| PURPOSE: | |
|
12 |
| Implement folder operations line EXPUNGE and Clear | |
|
13 |
| | |
|
14 |
+-----------------------------------------------------------------------+ |
|
15 |
| Author: Thomas Bruederli <roundcube@gmail.com> | |
|
16 |
+-----------------------------------------------------------------------+ |
|
17 |
|
|
18 |
$Id$ |
|
19 |
*/ |
|
20 |
|
c5ac07
|
21 |
$mbox_name = $IMAP->get_mailbox_name(); |
15a9d1
|
22 |
|
T |
23 |
// send EXPUNGE command |
197601
|
24 |
if ($RCMAIL->action=='expunge' && ($mbox = get_input_value('_mbox', RCUBE_INPUT_POST))) |
f11541
|
25 |
{ |
8d0758
|
26 |
$success = $IMAP->expunge($mbox); |
15a9d1
|
27 |
|
T |
28 |
// reload message list if current mailbox |
8d0758
|
29 |
if ($success && !empty($_REQUEST['_reload'])) |
f11541
|
30 |
{ |
T |
31 |
$OUTPUT->command('message_list.clear'); |
197601
|
32 |
$RCMAIL->action = 'list'; |
15a9d1
|
33 |
return; |
f11541
|
34 |
} |
15a9d1
|
35 |
else |
T |
36 |
$commands = "// expunged: $success\n"; |
f11541
|
37 |
} |
15a9d1
|
38 |
|
T |
39 |
// clear mailbox |
197601
|
40 |
else if ($RCMAIL->action=='purge' && ($mbox = get_input_value('_mbox', RCUBE_INPUT_POST))) |
f11541
|
41 |
{ |
a02d48
|
42 |
// we should only be purging trash and junk |
T |
43 |
if($mbox == $CONFIG['trash_mbox'] || $mbox == $CONFIG['junk_mbox']) |
f11541
|
44 |
{ |
a02d48
|
45 |
$success = $IMAP->clear_mailbox($mbox); |
T |
46 |
|
|
47 |
if ($success && !empty($_REQUEST['_reload'])) |
|
48 |
{ |
|
49 |
$OUTPUT->set_env('messagecount', 0); |
|
50 |
$OUTPUT->set_env('pagecount', 0); |
|
51 |
$OUTPUT->command('message_list.clear'); |
|
52 |
$OUTPUT->command('set_rowcount', rcmail_get_messagecount_text()); |
|
53 |
$OUTPUT->command('set_unread_count', $mbox_name, 0); |
|
54 |
} |
|
55 |
else |
|
56 |
$commands = "// purged: $success"; |
f11541
|
57 |
} |
T |
58 |
} |
15a9d1
|
59 |
|
f11541
|
60 |
$OUTPUT->send($commands); |
5349b7
|
61 |
?> |