Du kannst nicht mehr als 25 Themen auswählen Themen müssen mit entweder einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

folders.inc 3.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. <?php
  2. /**
  3. +-----------------------------------------------------------------------+
  4. | program/steps/mail/folders.inc |
  5. | |
  6. | This file is part of the Roundcube Webmail client |
  7. | Copyright (C) 2005-2013, The Roundcube Dev Team |
  8. | |
  9. | Licensed under the GNU General Public License version 3 or |
  10. | any later version with exceptions for skins & plugins. |
  11. | See the README file for a full license statement. |
  12. | |
  13. | PURPOSE: |
  14. | Implement folder operations line EXPUNGE and Clear |
  15. | |
  16. +-----------------------------------------------------------------------+
  17. | Author: Thomas Bruederli <roundcube@gmail.com> |
  18. +-----------------------------------------------------------------------+
  19. */
  20. // only process ajax requests
  21. if (!$OUTPUT->ajax_call) {
  22. return;
  23. }
  24. $mbox = rcube_utils::get_input_value('_mbox', rcube_utils::INPUT_POST, true);
  25. // send EXPUNGE command
  26. if ($RCMAIL->action == 'expunge') {
  27. $success = $RCMAIL->storage->expunge_folder($mbox);
  28. // reload message list if current mailbox
  29. if ($success) {
  30. $OUTPUT->show_message('folderexpunged', 'confirmation');
  31. if (!empty($_REQUEST['_reload'])) {
  32. $OUTPUT->command('set_quota', $RCMAIL->quota_content(null, $mbox));
  33. $OUTPUT->command('message_list.clear');
  34. $RCMAIL->action = 'list';
  35. return;
  36. }
  37. }
  38. else {
  39. $RCMAIL->display_server_error();
  40. }
  41. }
  42. // clear mailbox
  43. else if ($RCMAIL->action == 'purge') {
  44. $delimiter = $RCMAIL->storage->get_hierarchy_delimiter();
  45. $trash_mbox = $RCMAIL->config->get('trash_mbox');
  46. $junk_mbox = $RCMAIL->config->get('junk_mbox');
  47. $trash_regexp = '/^' . preg_quote($trash_mbox . $delimiter, '/') . '/';
  48. $junk_regexp = '/^' . preg_quote($junk_mbox . $delimiter, '/') . '/';
  49. // we should only be purging trash and junk (or their subfolders)
  50. if ($mbox == $trash_mbox || $mbox == $junk_mbox
  51. || preg_match($trash_regexp, $mbox) || preg_match($junk_regexp, $mbox)
  52. ) {
  53. $success = $RCMAIL->storage->clear_folder($mbox);
  54. if ($success) {
  55. $OUTPUT->show_message('folderpurged', 'confirmation');
  56. if (!empty($_REQUEST['_reload'])) {
  57. $OUTPUT->set_env('messagecount', 0);
  58. $OUTPUT->set_env('pagecount', 0);
  59. $OUTPUT->set_env('exists', 0);
  60. $OUTPUT->command('message_list.clear');
  61. $OUTPUT->command('set_rowcount', rcmail_get_messagecount_text(), $mbox);
  62. $OUTPUT->command('set_unread_count', $mbox, 0);
  63. $OUTPUT->command('set_quota', $RCMAIL->quota_content(null, $mbox));
  64. rcmail_set_unseen_count($mbox, 0);
  65. // set trash folder state
  66. if ($mbox === $trash_mbox) {
  67. $OUTPUT->command('set_trash_count', 0);
  68. }
  69. }
  70. }
  71. else {
  72. $RCMAIL->display_server_error();
  73. }
  74. }
  75. }
  76. $OUTPUT->send();