X-Git-Url: https://vcs.fsf.org/?p=squirrelmail.git;a=blobdiff_plain;f=plugins%2Ffilters%2Fsetup.php;h=96bd4ee25b5c0c1cc9a49ad1253e228ab4e000e9;hp=2557f409adb774244efb742e01cc1204273a690a;hb=d9a8ac55c4d130846a78c35806e70811e242d6ae;hpb=15e6162eacc97158393bc75aed3afeb7b19c24a6 diff --git a/plugins/filters/setup.php b/plugins/filters/setup.php index 2557f409..96bd4ee2 100644 --- a/plugins/filters/setup.php +++ b/plugins/filters/setup.php @@ -24,70 +24,86 @@ * $Id$ */ - // Set this to true if you have problems -- check the README file - // Note: This doesn't work all of the time (No idea why) - // Seems to be related to UW - global $UseSeparateImapConnection; - $UseSeparateImapConnection = false; +/* + * Set this to true if you have problems -- check the README file + * Note: This doesn't work all of the time (No idea why) + * Seems to be related to UW + */ +global $UseSeparateImapConnection; +$UseSeparateImapConnection = false; + +/* + * Set this to false if you do not want the user to be able to enable + * spam filters + */ +global $AllowSpamFilters; +$AllowSpamFilters = true; - // Set this to false if you do not want the user to be able to enable - // spam filters - global $AllowSpamFilters; - $AllowSpamFilters = true; +/* + * Set this to a string containing something unique to the line in the + * header you want me to find IPs to scan the databases with. For example, + * All the email coming IN from the internet to my site has a line in + * the header that looks like (all on one line): + * Received: [from usw-sf-list1.sourceforge.net (usw-sf-fw2.sourceforge.net + * [216.136.171.252]) by firewall.persistence.com (SYSADMIN-antispam + * 0.2) with + * Since this line indicates the FIRST hop the email takes into my network, + * I set my SpamFilters_YourHop to 'by firewall.persistence.com' but any + * case-sensitive string will do. You can set it to something found on + * every line in the header (like ' ') if you want to scan all IPs in + * the header (lots of false alarms here tho). + */ +global $SpamFilters_YourHop; +$SpamFilters_YourHop = ' '; + +/* + * A cache of IPs we've already checked or are known bad boys or good boys + * ie. $SpamFilters_DNScache["210.54.220.18"] = true; + * would tell filters to not even bother doing the DNS queries for that + * IP and any email coming from it are SPAM - false would mean that any + * email coming from it would NOT be SPAM + */ +global $SpamFilters_DNScache; - // Set this to a string containing something unique to the line in the - // header you want me to find IPs to scan the databases with. For example, - // All the email coming IN from the internet to my site has a line in - // the header that looks like (all on one line): - // Received: [from usw-sf-list1.sourceforge.net (usw-sf-fw2.sourceforge.net - // [216.136.171.252]) by firewall.persistence.com (SYSADMIN-antispam - // 0.2) with - // Since this line indicates the FIRST hop the email takes into my network, - // I set my SpamFilters_YourHop to 'by firewall.persistence.com' but any - // case-sensitive string will do. You can set it to something found on - // every line in the header (like ' ') if you want to scan all IPs in - // the header (lots of false alarms here tho). +require_once ('../plugins/filters/filters.php'); - global $SpamFilters_YourHop; - $SpamFilters_YourHop = ' '; +function squirrelmail_plugin_init_filters() { + global $squirrelmail_plugin_hooks; + global $mailbox, $imap_stream, $imapConnection; - // A cache of IPs we've already checked or are known bad boys or good boys - // ie. $SpamFilters_DNScache["210.54.220.18"] = true; - // would tell filters to not even bother doing the DNS queries for that - // IP and any email coming from it are SPAM - false would mean that any - // email coming from it would NOT be SPAM - global $SpamFilters_DNScache; + $squirrelmail_plugin_hooks['left_main_before']['filters'] = 'start_filters'; + if ($mailbox == 'INBOX') { + $squirrelmail_plugin_hooks['right_main_after_header']['filters'] = 'start_filters'; + } + $squirrelmail_plugin_hooks['optpage_register_block']['filters'] = 'squirrelmail_plugin_optpage_register_block'; +# $squirrelmail_plugin_hooks['special_mailbox']['filters'] = 'filters_special_mailbox'; +} - require_once ('../plugins/filters/filters.php'); +function filters_special_mailbox( $mb ) { + GLOBAL $data_dir, $username; - function squirrelmail_plugin_init_filters() { - global $squirrelmail_plugin_hooks; - global $mailbox, $imap_stream, $imapConnection; + return( $mb == getPref($data_dir, $username, 'filters_spam_folder', 'na' ) ); - $squirrelmail_plugin_hooks['left_main_before']['filters'] = 'start_filters'; - if ($mailbox == 'INBOX') - $squirrelmail_plugin_hooks["right_main_after_header"]['filters'] = 'start_filters'; - $squirrelmail_plugin_hooks['optpage_register_block']['filters'] = 'squirrelmail_plugin_optpage_register_block'; - } +} - function squirrelmail_plugin_optpage_register_block() { - global $optpage_blocks; - global $AllowSpamFilters; +function squirrelmail_plugin_optpage_register_block() { + global $optpage_blocks; + global $AllowSpamFilters; - $optpage_blocks[] = array( - 'name' => _("Message Filters"), - 'url' => '../plugins/filters/options.php', - 'desc' => _("Filtering enables messages with different criteria to be automatically filtered into different folders for easier organization."), - 'js' => false - ); + $optpage_blocks[] = array( + 'name' => _("Message Filters"), + 'url' => '../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( + if ($AllowSpamFilters) { + $optpage_blocks[] = array( 'name' => _("SPAM Filters"), 'url' => '../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 - ); - } - } + ); + } +} ?>