Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. <?php
  2. /**
  3. +-----------------------------------------------------------------------+
  4. | program/steps/mail/getunread.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. | Check all mailboxes for unread messages and update GUI |
  15. | |
  16. +-----------------------------------------------------------------------+
  17. | Author: Thomas Bruederli <roundcube@gmail.com> |
  18. +-----------------------------------------------------------------------+
  19. */
  20. $a_folders = $RCMAIL->storage->list_folders_subscribed('', '*', 'mail');
  21. if (!empty($a_folders)) {
  22. $current = $RCMAIL->storage->get_folder();
  23. $inbox = ($current == 'INBOX');
  24. $trash = $RCMAIL->config->get('trash_mbox');
  25. $check_all = (bool)$RCMAIL->config->get('check_all_folders');
  26. foreach ($a_folders as $mbox) {
  27. $unseen_old = rcmail_get_unseen_count($mbox);
  28. if (!$check_all && $unseen_old !== null && $mbox != $current) {
  29. $unseen = $unseen_old;
  30. }
  31. else {
  32. $unseen = $RCMAIL->storage->count($mbox, 'UNSEEN', $unseen_old === null);
  33. }
  34. // call it always for current folder, so it can update counter
  35. // after possible message status change when opening a message
  36. // not in preview frame
  37. if ($unseen || $unseen_old === null || $mbox == $current) {
  38. $OUTPUT->command('set_unread_count', $mbox, $unseen, $inbox && $mbox_row == 'INBOX');
  39. }
  40. rcmail_set_unseen_count($mbox, $unseen);
  41. // set trash folder state
  42. if ($mbox === $trash) {
  43. $OUTPUT->command('set_trash_count', $RCMAIL->storage->count($mbox, 'EXISTS'));
  44. }
  45. }
  46. }
  47. $OUTPUT->send();