+/** load config */
+if (file_exists(SM_PATH . 'plugins/filters/config.php'))
+ include_once (SM_PATH . 'plugins/filters/config.php');
+
+/**
+ * Init Hooks
+ * @access private
+ */
+function filters_init_hooks () {
+ global $squirrelmail_plugin_hooks;
+ if (!file_exists(SM_PATH . 'plugins/filters/config.php')) return;
+ if (sqgetGlobalVar('mailbox',$mailbox,SQ_FORM)) {
+ sqgetGlobalVar('mailbox',$mailbox,SQ_FORM);
+ } else {
+ $mailbox = 'INBOX';
+ }
+
+ $squirrelmail_plugin_hooks['left_main_before']['filters'] = 'start_filters_hook';
+ if (isset($mailbox) && $mailbox == 'INBOX') {
+ $squirrelmail_plugin_hooks['right_main_after_header']['filters'] = 'start_filters_hook';
+ }
+ $squirrelmail_plugin_hooks['optpage_register_block']['filters'] = 'filters_optpage_register_block_hook';
+ $squirrelmail_plugin_hooks['special_mailbox']['filters'] = 'filters_special_mailbox';
+ $squirrelmail_plugin_hooks['rename_or_delete_folder']['filters'] = 'update_for_folder_hook';
+ $squirrelmail_plugin_hooks['webmail_bottom']['filters'] = 'start_filters_hook';
+}
+
+/**
+ * Register option blocks
+ * @access private
+ */
+function filters_optpage_register_block() {
+ global $optpage_blocks, $AllowSpamFilters;
+ if (!file_exists(SM_PATH . 'plugins/filters/config.php')) return;
+
+ $optpage_blocks[] = array(
+ 'name' => _("Message Filters"),
+ 'url' => SM_PATH . 'plugins/filters/options.php',
+ 'desc' => _("Filtering enables messages with different criteria to be automatically filtered into different folders for easier organization."),
+ 'js' => false
+ );
+
+ if ($AllowSpamFilters) {
+ $optpage_blocks[] = array(
+ 'name' => _("SPAM Filters"),
+ 'url' => SM_PATH . 'plugins/filters/spamoptions.php',
+ 'desc' => _("SPAM filters allow you to select from various DNS based blacklists to detect junk email in your INBOX and move it to another folder (like Trash)."),
+ 'js' => false
+ );
+ }
+}
+
+/**
+ * Saves the DNS Cache to disk
+ * @access private
+ */