setup.php 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. <?php
  2. /**
  3. * Message and Spam Filter Plugin - Setup
  4. *
  5. * @copyright 1999-2025 The SquirrelMail Project Team
  6. * @license http://opensource.org/licenses/gpl-license.php GNU Public License
  7. * @version $Id$
  8. * @package plugins
  9. * @subpackage filters
  10. */
  11. /**
  12. * Init plugin
  13. * @access private
  14. */
  15. function squirrelmail_plugin_init_filters() {
  16. global $squirrelmail_plugin_hooks;
  17. $squirrelmail_plugin_hooks['left_main_before']['filters'] = 'start_filters_hook';
  18. $squirrelmail_plugin_hooks['right_main_after_header']['filters'] = 'start_filters_hook';
  19. $squirrelmail_plugin_hooks['optpage_register_block']['filters'] = 'filters_optpage_register_block_hook';
  20. $squirrelmail_plugin_hooks['special_mailbox']['filters'] = 'filters_special_mailbox';
  21. $squirrelmail_plugin_hooks['rename_or_delete_folder']['filters'] = 'update_for_folder_hook';
  22. $squirrelmail_plugin_hooks['template_construct_login_webmail.tpl']['filters'] = 'start_filters_hook';
  23. $squirrelmail_plugin_hooks['folder_status']['filters'] = 'filters_folder_status';
  24. }
  25. /**
  26. * Report spam folder as special mailbox
  27. * @param string $mb variable used by hook
  28. * @return string spam folder name
  29. * @access private
  30. */
  31. function filters_special_mailbox( $mb ) {
  32. global $data_dir, $username;
  33. return( $mb == getPref($data_dir, $username, 'filters_spam_folder', 'na' ) );
  34. }
  35. /**
  36. * Called by hook to Register option blocks
  37. * @access private
  38. */
  39. function filters_optpage_register_block_hook() {
  40. include_once(SM_PATH . 'plugins/filters/filters.php');
  41. filters_optpage_register_block ();
  42. }
  43. /**
  44. * Called by hook to Start Filtering
  45. * @param mixed $args optional variable passed by hook
  46. * @access private
  47. */
  48. function start_filters_hook($args) {
  49. include_once(SM_PATH . 'plugins/filters/filters.php');
  50. start_filters ($args);
  51. }
  52. /**
  53. * Called by hook to Update filters when Folders Change
  54. * @access private
  55. */
  56. function update_for_folder_hook($args) {
  57. include_once(SM_PATH . 'plugins/filters/filters.php');
  58. update_for_folder ($args);
  59. }