| 1 | <?php |
|---|
| 2 | |
|---|
| 3 | /* |
|---|
| 4 | +-----------------------------------------------------------------------+ |
|---|
| 5 | | program/steps/mail/folders.inc | |
|---|
| 6 | | | |
|---|
| 7 | | This file is part of the RoundCube Webmail client | |
|---|
| 8 | | Copyright (C) 2005, RoundCube Dev. - Switzerland | |
|---|
| 9 | | Licensed under the GNU GPL | |
|---|
| 10 | | | |
|---|
| 11 | | PURPOSE: | |
|---|
| 12 | | Implement folder operations line EXPUNGE and Clear | |
|---|
| 13 | | | |
|---|
| 14 | +-----------------------------------------------------------------------+ |
|---|
| 15 | | Author: Thomas Bruederli <roundcube@gmail.com> | |
|---|
| 16 | +-----------------------------------------------------------------------+ |
|---|
| 17 | |
|---|
| 18 | $Id: folders.inc 573 2007-05-18 11:29:25Z thomasb $ |
|---|
| 19 | */ |
|---|
| 20 | $registry = rc_registry::getInstance(); |
|---|
| 21 | $IMAP = $registry->get('IMAP', 'core'); |
|---|
| 22 | $mbox_name = $IMAP->get_mailbox_name(); |
|---|
| 23 | |
|---|
| 24 | // send EXPUNGE command |
|---|
| 25 | if ($_action=='expunge' && ($mbox = rc_main::get_input_value('_mbox', RCUBE_INPUT_POST))) { |
|---|
| 26 | $success = $IMAP->expunge($mbox); |
|---|
| 27 | |
|---|
| 28 | rc_main::tfk_debug('Expung: ' . $mbox); |
|---|
| 29 | |
|---|
| 30 | // reload message list if current mailbox |
|---|
| 31 | if ($success && empty($_REQUEST['_reload']) === false) { |
|---|
| 32 | $OUTPUT->command('message_list.clear'); |
|---|
| 33 | $_action = 'list'; |
|---|
| 34 | |
|---|
| 35 | rc_main::tfk_debug('Trying to reload list.'); |
|---|
| 36 | |
|---|
| 37 | $_file = dirname(__FILE__); |
|---|
| 38 | $_file.= '/list.inc'; |
|---|
| 39 | include $_file; |
|---|
| 40 | |
|---|
| 41 | //$OUTPUT->send($_task); |
|---|
| 42 | |
|---|
| 43 | return; |
|---|
| 44 | } |
|---|
| 45 | else { |
|---|
| 46 | $commands = "// expunged: $success\n"; |
|---|
| 47 | } |
|---|
| 48 | } |
|---|
| 49 | // clear mailbox |
|---|
| 50 | elseif ($_action=='purge' && ($mbox = rc_main::get_input_value('_mbox', RCUBE_INPUT_POST))) { |
|---|
| 51 | $success = $IMAP->clear_mailbox($mbox); |
|---|
| 52 | |
|---|
| 53 | if ($success && !empty($_REQUEST['_reload'])) { |
|---|
| 54 | $OUTPUT->set_env('messagecount', 0); |
|---|
| 55 | $OUTPUT->set_env('pagecount', 0); |
|---|
| 56 | $OUTPUT->command('message_list.clear'); |
|---|
| 57 | $OUTPUT->command('set_rowcount', rcmail_get_messagecount_text()); |
|---|
| 58 | $OUTPUT->command('set_unread_count', $mbox_name, 0); |
|---|
| 59 | } |
|---|
| 60 | else { |
|---|
| 61 | $commands = "// purged: $success"; |
|---|
| 62 | } |
|---|
| 63 | } |
|---|
| 64 | $OUTPUT->send($commands); |
|---|
| 65 | ?> |
|---|