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