849bdf42 |
1 | <?php |
2 | /* |
3fd1252d |
3 | * Message and Spam Filter Plugin |
849bdf42 |
4 | * By Luke Ehresman <luke@squirrelmail.org> |
5 | * Tyler Akins |
6 | * Brent Bice |
7 | * (c) 2000 (GNU GPL - see ../../COPYING) |
8 | * |
9 | * This plugin filters your inbox into different folders based upon given |
10 | * criteria. It is most useful for people who are subscibed to mailing lists |
11 | * to help organize their messages. The argument stands that filtering is |
12 | * not the place of the client, which is why this has been made a plugin for |
13 | * SquirrelMail. You may be better off using products such as Sieve or |
14 | * Procmail to do your filtering so it happens even when SquirrelMail isn't |
15 | * running. |
16 | * |
17 | * If you need help with this, or see improvements that can be made, please |
18 | * email me directly at the address above. I definately welcome suggestions |
19 | * and comments. This plugin, as is the case with all SquirrelMail plugins, |
20 | * is not directly supported by the developers. Please come to me off the |
21 | * mailing list if you have trouble with it. |
22 | * |
23 | * Also view plugins/README.plugins for more information. |
24 | * |
25 | */ |
26 | |
27 | // Set this to true if you have problems -- check the README file |
28 | // Note: This doesn't work all of the time (No idea why) |
29 | // Seems to be related to UW |
30 | global $UseSeparateImapConnection; |
31 | $UseSeparateImapConnection = false; |
3fd1252d |
32 | |
849bdf42 |
33 | // Set this to false if you do not want the user to be able to enable |
34 | // spam filters |
35 | global $AllowSpamFilters; |
36 | $AllowSpamFilters = true; |
3fd1252d |
37 | |
849bdf42 |
38 | // Set this to a string containing something unique to the line in the |
39 | // header you want me to find IPs to scan the databases with. For example, |
40 | // All the email coming IN from the internet to my site has a line in |
41 | // the header that looks like (all on one line): |
42 | // Received: [from usw-sf-list1.sourceforge.net (usw-sf-fw2.sourceforge.net |
43 | // [216.136.171.252]) by firewall.persistence.com (SYSADMIN-antispam |
44 | // 0.2) with |
45 | // Since this line indicates the FIRST hop the email takes into my network, |
46 | // I set my SpamFilters_YourHop to 'by firewall.persistence.com' but any |
47 | // case-sensitive string will do. You can set it to something found on |
48 | // every line in the header (like ' ') if you want to scan all IPs in |
49 | // the header (lots of false alarms here tho). |
50 | |
51 | global $SpamFilters_YourHop; |
52 | $SpamFilters_YourHop = 'by firewall.persistence.com'; |
53 | |
54 | // A cache of IPs we've already checked or are known bad boys or good boys |
3fd1252d |
55 | // ie. $SpamFilters_DNScache["210.54.220.18"] = true; |
849bdf42 |
56 | // would tell filters to not even bother doing the DNS queries for that |
57 | // IP and any email coming from it are SPAM - false would mean that any |
58 | // email coming from it would NOT be SPAM |
59 | global $SpamFilters_DNScache; |
60 | |
3fd1252d |
61 | require_once ('../plugins/filters/filters.php'); |
849bdf42 |
62 | |
63 | function squirrelmail_plugin_init_filters() { |
64 | global $squirrelmail_plugin_hooks; |
65 | global $mailbox, $imap_stream, $imapConnection; |
66 | |
3fd1252d |
67 | $squirrelmail_plugin_hooks['left_main_before']['filters'] = 'start_filters'; |
68 | if ($mailbox == 'INBOX') |
69 | $squirrelmail_plugin_hooks["right_main_after_header"]['filters'] = 'start_filters'; |
70 | $squirrelmail_plugin_hooks['options_register']['filters'] = 'squirrelmail_plugin_register'; |
849bdf42 |
71 | } |
72 | |
73 | function squirrelmail_plugin_register() { |
74 | global $optionpages; |
75 | |
76 | $optionpages[] = array( |
3fd1252d |
77 | 'name' => _("Message Filters"), |
849bdf42 |
78 | 'url' => '../plugins/filters/options.php', |
3fd1252d |
79 | 'desc' => _("Filtering enables messages with different criteria to be automatically filtered into different folders for easier organization."), |
849bdf42 |
80 | 'js' => false |
81 | ); |
82 | } |
3fd1252d |
83 | ?> |