4 +-----------------------------------------------------------------------+
5 | program/steps/mail/folders.inc |
7 | This file is part of the Roundcube Webmail client |
8 | Copyright (C) 2005-2009, Roundcube Dev. - Switzerland |
9 | Licensed under the GNU GPL |
12 | Implement folder operations line EXPUNGE and Clear |
14 +-----------------------------------------------------------------------+
15 | Author: Thomas Bruederli <roundcube@gmail.com> |
16 +-----------------------------------------------------------------------+
18 $Id: folders.inc 4321 2010-12-08 12:52:04Z alec $
21 // only process ajax requests
22 if (!$OUTPUT->ajax_call)
25 $mbox = get_input_value('_mbox', RCUBE_INPUT_POST, true);
27 // send EXPUNGE command
28 if ($RCMAIL->action == 'expunge') {
30 $success = $IMAP->expunge($mbox);
32 // reload message list if current mailbox
34 $OUTPUT->show_message('folderexpunged', 'confirmation');
36 if (!empty($_REQUEST['_reload'])) {
37 $OUTPUT->command('set_quota', rcmail_quota_content());
38 $OUTPUT->command('message_list.clear');
39 $RCMAIL->action = 'list';
44 rcmail_display_server_error();
49 else if ($RCMAIL->action == 'purge')
51 $delimiter = $IMAP->get_hierarchy_delimiter();
52 $trash_regexp = '/^' . preg_quote($CONFIG['trash_mbox'] . $delimiter, '/') . '/';
53 $junk_regexp = '/^' . preg_quote($CONFIG['junk_mbox'] . $delimiter, '/') . '/';
55 // we should only be purging trash and junk (or their subfolders)
56 if ($mbox == $CONFIG['trash_mbox'] || $mbox == $CONFIG['junk_mbox']
57 || preg_match($trash_regexp, $mbox) || preg_match($junk_regexp, $mbox)
59 $success = $IMAP->clear_mailbox($mbox);
62 $OUTPUT->show_message('folderpurged', 'confirmation');
64 if (!empty($_REQUEST['_reload'])) {
65 $OUTPUT->set_env('messagecount', 0);
66 $OUTPUT->set_env('pagecount', 0);
67 $OUTPUT->command('message_list.clear');
68 $OUTPUT->command('set_rowcount', rcmail_get_messagecount_text());
69 $OUTPUT->command('set_unread_count', $mbox, 0);
70 $OUTPUT->command('set_quota', rcmail_quota_content());
71 rcmail_set_unseen_count($mbox, 0);
75 rcmail_display_server_error();