fsf changes, meant to be rebased on upstream
[squirrelmail.git] / plugins / filters / setup.php
CommitLineData
849bdf42 1<?php
4b4abf93 2
15e6162e 3/**
15d98101 4 * Message and Spam Filter Plugin - Setup
5 *
77a1e3d1 6 * @copyright 1999-2022 The SquirrelMail Project Team
b2d8bc6c 7 * @license http://opensource.org/licenses/gpl-license.php GNU Public License
4b4abf93 8 * @version $Id$
ea5f4b8e 9 * @package plugins
10 * @subpackage filters
15e6162e 11 */
849bdf42 12
0a1dc88e 13/**
14 * Init plugin
15 * @access private
16 */
10a26cea 17function squirrelmail_plugin_init_filters() {
b2f4cdad 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';
6e515418 25 $squirrelmail_plugin_hooks['template_construct_login_webmail.tpl']['filters'] = 'start_filters_hook';
b2f4cdad 26 $squirrelmail_plugin_hooks['folder_status']['filters'] = 'filters_folder_status';
10a26cea 27}
a2a566eb 28
0a1dc88e 29/**
0d725b45 30 * Report spam folder as special mailbox
0a1dc88e 31 * @param string $mb variable used by hook
32 * @return string spam folder name
91e0dccc 33 * @access private
0a1dc88e 34 */
10a26cea 35function filters_special_mailbox( $mb ) {
0a1dc88e 36 global $data_dir, $username;
10a26cea 37 return( $mb == getPref($data_dir, $username, 'filters_spam_folder', 'na' ) );
10a26cea 38}
849bdf42 39
0a1dc88e 40/**
9c655416 41 * Called by hook to Register option blocks
0a1dc88e 42 * @access private
43 */
9c655416 44function filters_optpage_register_block_hook() {
8510adf2 45 include_once(SM_PATH . 'plugins/filters/filters.php');
9c655416 46 filters_optpage_register_block ();
47}
849bdf42 48
9c655416 49/**
50 * Called by hook to Start Filtering
51 * @param mixed $args optional variable passed by hook
52 * @access private
53 */
54function start_filters_hook($args) {
8510adf2 55 include_once(SM_PATH . 'plugins/filters/filters.php');
b2f4cdad 56 start_filters ($args);
9c655416 57}
eec81600 58
9c655416 59/**
60 * Called by hook to Update filters when Folders Change
61 * @access private
62 */
6921d585 63function update_for_folder_hook($args) {
8510adf2 64 include_once(SM_PATH . 'plugins/filters/filters.php');
6921d585 65 update_for_folder ($args);
10a26cea 66}