Set default value of YourHop
[squirrelmail.git] / plugins / filters / filters.php
CommitLineData
849bdf42 1<?php
4eee5968 2
3 /**
4 ** Message and Spam Filter Plugin
5 **
6 ** Copyright (c) 1999-2001 The Squirrelmail Development Team
7 ** Licensed under the GNU GPL. For full terms see the file 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 function filters_sqimap_read_data ($imap_stream, $pre, $handle_errors, &$response, &$message) {
28 global $color, $squirrelmail_language, $imap_general_debug;
29
30 $data = array();
31 $size = 0;
32
33 do {
34 $read = fgets($imap_stream, 9096);
35 if (ereg("^$pre (OK|BAD|NO)(.*)$", $read, $regs)) {
36 break; // found end of reply
37 }
38
39 // Continue if needed for this single line
40 while (strpos($read, "\n") === false) {
41 $read .= fgets($imap_stream, 9096);
42 }
43
44 $data[] = $read;
45
46 if (ereg("^\\* [0-9]+ FETCH.*\\{([0-9]+)\\}", $read, $regs)) {
47 $size = $regs[1];
48 if ($imap_general_debug) {
49 echo "<small><tt><font color=\"#CC0000\">Size is $size</font></tt></small><br>\n";
50 }
51
52 $total_size = 0;
53 do {
54 $read = fgets($imap_stream, 9096);
55 if ($imap_general_debug) {
56 echo "<small><tt><font color=\"#CC0000\">$read</font></tt></small><br>\n";
57 flush();
58 }
59 $data[] = $read;
60 $total_size += strlen($read);
61 } while ($total_size < $size);
62
63 $size = 0;
64 }
65 // For debugging purposes
66 if ($imap_general_debug) {
67 echo "<small><tt><font color=\"#CC0000\">$read</font></tt></small><br>\n";
68 flush();
69 }
70 } while (true);
71
72 $response = $regs[1];
73 $message = trim($regs[2]);
74
75 if ($imap_general_debug) echo '--<br>';
76
77 if ($handle_errors == false)
78 return $data;
79
80 if ($response == 'NO') {
81 // ignore this error from m$ exchange, it is not fatal (aka bug)
82 if (strstr($message, 'command resulted in') === false) {
83 set_up_language($squirrelmail_language);
84 echo "<br><b><font color=$color[2]>\n";
85 echo _("ERROR : Could not complete request.");
86 echo "</b><br>\n";
87 echo _("Reason Given: ");
88 echo $message . "</font><br>\n";
89 exit;
90 }
91 } else if ($response == 'BAD') {
92 set_up_language($squirrelmail_language);
93 echo "<br><b><font color=$color[2]>\n";
94 echo _("ERROR : Bad or malformed request.");
95 echo "</b><br>\n";
96 echo _("Server responded: ");
97 echo $message . "</font><br>\n";
98 exit;
99 }
100
101 return $data;
102 }
103
104
105 function start_filters() {
106 global $mailbox, $username, $key, $imapServerAddress, $imapPort, $imap,
107 $imap_general, $filters, $imap_stream, $imapConnection,
108 $UseSeparateImapConnection, $AllowSpamFilters;
109
110 if ($mailbox == 'INBOX') {
111 // Detect if we have already connected to IMAP or not.
112 // Also check if we are forced to use a separate IMAP connection
113 if ((!isset($imap_stream) && !isset($imapConnection)) ||
114 $UseSeparateImapConnection) {
115 $stream = sqimap_login($username, $key, $imapServerAddress,
116 $imapPort, 10);
117 $previously_connected = false;
118 } elseif (isset($imapConnection)) {
119 $stream = $imapConnection;
120 $previously_connected = true;
121 } else {
122 $previously_connected = true;
123 $stream = $imap_stream;
124 }
125
126 if (sqimap_get_num_messages($stream, 'INBOX') > 0) {
127 // Filter spam from inbox before we sort them into folders
128 if ($AllowSpamFilters)
129 spam_filters($stream);
130
131 // Sort into folders
132 user_filters($stream);
133 }
134
135 if (!$previously_connected)
136 sqimap_logout($stream);
137 }
138 }
139
140
141 function user_filters($imap_stream) {
142 $filters = load_filters();
143 if (! $filters) return;
144
145 sqimap_mailbox_select($imap_stream, 'INBOX');
146
147 // For every rule
148 for ($i=0; $i < count($filters); $i++) {
149 // If it is the "combo" rule
150 if ($filters[$i]['where'] == 'To or Cc') {
151 /*
152 * If it's "TO OR CC", we have to do two searches, one for TO
153 * and the other for CC.
154 */
155 filter_search_and_delete($imap_stream, 'TO',
156 $filters[$i]['what'], $filters[$i]['folder']);
157 filter_search_and_delete($imap_stream, 'CC',
158 $filters[$i]['what'], $filters[$i]['folder']);
159 } else {
160 /*
161 * If it's a normal TO, CC, SUBJECT, or FROM, then handle it
162 * normally.
163 */
164 filter_search_and_delete($imap_stream, $filters[$i]['where'],
165 $filters[$i]['what'], $filters[$i]['folder']);
166 }
167 }
168 // Clean out the mailbox whether or not auto_expunge is on
169 // That way it looks like it was redirected properly
170 sqimap_mailbox_expunge($imap_stream, 'INBOX');
171 }
172
173 function filter_search_and_delete($imap, $where, $what, $where_to) {
174 // Don't mess with the " characters on this fputs line!
175 fputs ($imap, 'a001 SEARCH ALL ' . $where . ' "' . addslashes($what) .
176 "\"\r\n");
177 $read = filters_sqimap_read_data ($imap, 'a001', true, $response, $message);
178
179 // This may have problems with EIMS due to it being goofy
180
181 for ($r=0; $r < count($read) &&
182 substr($read[$r], 0, 8) != '* SEARCH'; $r++) {}
183 if ($response == 'OK') {
184 $ids = explode(' ', $read[$r]);
185 if (sqimap_mailbox_exists($imap, $where_to)) {
186 for ($j=2; $j < count($ids); $j++) {
187 $id = trim($ids[$j]);
188 sqimap_messages_copy ($imap, $id, $id, $where_to);
189 sqimap_messages_flag ($imap, $id, $id, 'Deleted');
190 }
191 }
192 }
193 }
194
195 // These are the spam filters
196 function spam_filters($imap_stream) {
197 global $data_dir, $username;
198 global $SpamFilters_YourHop;
199 global $SpamFilters_DNScache;
200
201 $filters_spam_scan = getPref($data_dir, $username, 'filters_spam_scan');
202 $filters_spam_folder = getPref($data_dir, $username, 'filters_spam_folder');
203 $filters = load_spam_filters();
204
205 $run = 0;
206
207 foreach ($filters as $Key=> $Value) {
208 if ($Value['enabled'])
209 $run ++;
210 }
211
212 // short-circuit
213 if ($run == 0) {
214 return;
215 }
216
217 sqimap_mailbox_select($imap_stream, 'INBOX');
218
219 // Ask for a big list of all "Received" headers in the inbox with
220 // flags for each message. Kinda big.
221 fputs($imap_stream, 'A3999 FETCH 1:* (FLAGS BODY.PEEK[HEADER.FIELDS ' .
222 "(RECEIVED)])\r\n");
223
224 $read = filters_sqimap_read_data ($imap_stream, 'A3999', true, $response, $message);
225
226 if ($response != 'OK')
227 return;
228
229 $i = 0;
230 while ($i < count($read)) {
231 // EIMS will give funky results
232 $Chunks = explode(' ', $read[$i]);
233 if ($Chunks[0] != '*') {
234 $i ++;
235 continue;
849bdf42 236 }
4eee5968 237 $MsgNum = $Chunks[1];
238
239 $IPs = array();
240 $i ++;
241 $IsSpam = 0;
242 $Scan = 1;
243
244 // Check for normal IMAP servers
245 if ($filters_spam_scan == 'new') {
246 if (is_int(strpos($Chunks[4], '\Seen'))) {
247 $Scan = 0;
248 }
249 }
250
251 // Look through all of the Received headers for IP addresses
252 // Stop when I get ")" on a line
253 // Stop if I get "*" on a line (don't advance)
254 // and above all, stop if $i is bigger than the total # of lines
255 while (($i < count($read)) &&
256 ($read[$i][0] != ')' && $read[$i][0] != '*' &&
257 $read[$i][0] != "\n") && (! $IsSpam))
258 {
259 // Check to see if this line is the right "Received from" line
260 // to check
261 if (is_int(strpos($read[$i], $SpamFilters_YourHop))) {
849bdf42 262
a9aa7ab7 263 // short-circuit and skip work if we don't scan this one
4eee5968 264 if ($Scan) {
265 $read[$i] = ereg_replace('[^0-9\.]', ' ', $read[$i]);
266 $elements = explode(' ', $read[$i]);
267 foreach ($elements as $value) {
268 if ($value != '' &&
269 ereg('[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}',
270 $value, $regs)) {
271 $Chunks = explode('.', $value);
272 if (filters_spam_check_site($Chunks[0], $Chunks[1],
273 $Chunks[2], $Chunks[3], $filters)) {
274 $IsSpam ++;
275 break; // no sense in checking more IPs
276 }
5e2e3895 277 // If we've checked one IP and YourHop is just a space
278 if ($SpamFilters_YourHop == ' ') {
279 break; // don't check any more
280 }
a9aa7ab7 281 }
a9aa7ab7 282 }
a9aa7ab7 283 }
4eee5968 284 }
285 $i ++;
286 }
287
288 // Lookie! It's spam! Yum!
289 if ($IsSpam) {
290 if (sqimap_mailbox_exists ($imap_stream, $filters_spam_folder)) {
291 sqimap_messages_copy ($imap_stream, $MsgNum, $MsgNum,
292 $filters_spam_folder);
293 sqimap_messages_flag ($imap_stream, $MsgNum, $MsgNum,
294 'Deleted');
295 }
296 } else {
297 }
298 }
299
300 sqimap_mailbox_expunge($imap_stream, 'INBOX');
301
302 session_register('SpamFilters_DNScache');
303 }
304
305
306 // Does the loop through each enabled filter for the specified IP address.
307 // IP format: $a.$b.$c.$d
308 function filters_spam_check_site($a, $b, $c, $d, &$filters) {
309 global $SpamFilters_DNScache;
310 foreach ($filters as $key => $value) {
311 if ($filters[$key]['enabled']) {
312 if ($filters[$key]['dns']) {
313 $filter_revip = $d . '.' . $c . '.' . $b . '.' . $a . '.' .
314 $filters[$key]['dns'];
315 if (strlen($SpamFilters_DNScache[$filter_revip]) == 0) {
316 $SpamFilters_DNScache[$filter_revip]=gethostbyname($filter_revip);
317 }
318 if ($SpamFilters_DNScache[$filter_revip] ==
319 $filters[$key]['result']) {
320 return 1;
321 }
322 }
323 }
324 }
325 return 0;
326 }
327
328 function load_filters() {
329 global $data_dir, $username;
330 $filters = array();
331 for ($i=0; $fltr = getPref($data_dir, $username, 'filter' . $i); $i++) {
332 $ary = explode(',', $fltr);
333 $filters[$i]['where'] = $ary[0];
334 $filters[$i]['what'] = $ary[1];
335 $filters[$i]['folder'] = $ary[2];
336 }
337 return $filters;
338 }
339
340 function load_spam_filters() {
341 global $data_dir, $username;
342
343 $filters['MAPS RBL']['prefname'] = 'filters_spam_maps_rbl';
344 $filters['MAPS RBL']['name'] = 'MAPS Realtime Blackhole List';
345 $filters['MAPS RBL']['link'] = 'http://www.mail-abuse.org/rbl/';
346 $filters['MAPS RBL']['dns'] = 'blackholes.mail-abuse.org';
347 $filters['MAPS RBL']['result'] = '127.0.0.2';
348 $filters['MAPS RBL']['comment'] =
349 _("COMMERCIAL - This list contains servers that are verified spam senders. It is a pretty reliable list to scan spam from.");
350
351 $filters['MAPS RSS']['prefname'] = 'filters_spam_maps_rss';
352 $filters['MAPS RSS']['name'] = 'MAPS Relay Spam Stopper';
353 $filters['MAPS RSS']['link'] = 'http://www.mail-abuse.org/rss/';
354 $filters['MAPS RSS']['dns'] = 'relays.mail-abuse.org';
355 $filters['MAPS RSS']['result'] = '127.0.0.2';
356 $filters['MAPS RSS']['comment'] =
357 _("COMMERCIAL - Servers that are configured (or misconfigured) to allow spam to be relayed through their system will be banned with this. Another good one to use.");
358
359 $filters['MAPS DUL']['prefname'] = 'filters_spam_maps_dul';
360 $filters['MAPS DUL']['name'] = 'MAPS Dial-Up List';
361 $filters['MAPS DUL']['link'] = 'http://www.mail-abuse.org/dul/';
362 $filters['MAPS DUL']['dns'] = 'dialups.mail-abuse.org';
363 $filters['MAPS DUL']['result'] = '127.0.0.3';
364 $filters['MAPS DUL']['comment'] =
365 _("COMMERCIAL - Dial-up users are often filtered out since they should use their ISP's mail servers to send mail. Spammers typically get a dial-up account and send spam directly from there.");
366
367 $filters['MAPS RBLplus-RBL']['prefname'] = 'filters_spam_maps_rblplus_rbl';
368 $filters['MAPS RBLplus-RBL']['name'] = 'MAPS RBL+ RBL List';
369 $filters['MAPS RBLplus-RBL']['link'] = 'http://www.mail-abuse.org/';
370 $filters['MAPS RBLplus-RBL']['dns'] = 'rbl-plus.mail-abuse.org';
371 $filters['MAPS RBLplus-RBL']['result'] = '127.0.0.2';
372 $filters['MAPS RBLplus-RBL']['comment'] =
373 _("COMMERCIAL - RBL+ Blackhole entries.");
374
375 $filters['MAPS RBLplus-RSS']['prefname'] = 'filters_spam_maps_rblplus_rss';
376 $filters['MAPS RBLplus-RSS']['name'] = 'MAPS RBL+ List RSS entries';
377 $filters['MAPS RBLplus-RSS']['link'] = 'http://www.mail-abuse.org/';
378 $filters['MAPS RBLplus-RSS']['dns'] = 'rbl-plus.mail-abuse.org';
379 $filters['MAPS RBLplus-RSS']['result'] = '127.0.0.2';
380 $filters['MAPS RBLplus-RSS']['comment'] =
381 _("COMMERCIAL - RBL+ OpenRelay entries.");
382
383 $filters['MAPS RBLplus-DUL']['prefname'] = 'filters_spam_maps_rblplus_dul';
384 $filters['MAPS RBLplus-DUL']['name'] = 'MAPS RBL+ List DUL entries';
385 $filters['MAPS RBLplus-DUL']['link'] = 'http://www.mail-abuse.org/';
386 $filters['MAPS RBLplus-DUL']['dns'] = 'rbl-plus.mail-abuse.org';
387 $filters['MAPS RBLplus-DUL']['result'] = '127.0.0.3';
388 $filters['MAPS RBLplus-DUL']['comment'] =
389 _("COMMERCIAL - RBL+ Dial-up entries.");
390
391 $filters['Osirusoft Relays']['prefname'] = 'filters_spam_maps_osirusoft_relay';
392 $filters['Osirusoft Relays']['name'] = 'Osirusoft Relay List';
393 $filters['Osirusoft Relays']['link'] = 'http://relays.osirusoft.com/';
394 $filters['Osirusoft Relays']['dns'] = 'relays.osirusoft.com';
395 $filters['Osirusoft Relays']['result'] = '127.0.0.2';
396 $filters['Osirusoft Relays']['comment'] =
397 _("FREE - Osirusoft Relays - Osirusofts list of verified open relays. Seems to include servers used by abuse@uunet.net auto-replies too.");
398
399 $filters['Osirusoft DUL']['prefname'] = 'filters_spam_maps_osirusoft_dul';
400 $filters['Osirusoft DUL']['name'] = 'Osirusoft Dialup List';
401 $filters['Osirusoft DUL']['link'] = 'http://relays.osirusoft.com/';
402 $filters['Osirusoft DUL']['dns'] = 'relays.osirusoft.com';
403 $filters['Osirusoft DUL']['result'] = '127.0.0.3';
404 $filters['Osirusoft DUL']['comment'] =
405 _("FREE - Osirusoft Dialups - Osirusofts Dialup Spam Source list.");
406
407 $filters['Osirusoft Spam Source']['prefname'] = 'filters_spam_maps_osirusoft_rc';
408 $filters['Osirusoft Spam Source']['name'] = 'Osirusoft Confirmed Spam Source List';
409 $filters['Osirusoft Spam Source']['link'] = 'http://relays.osirusoft.com/';
410 $filters['Osirusoft Spam Source']['dns'] = 'relays.osirusoft.com';
411 $filters['Osirusoft Spam Source']['result'] = '127.0.0.4';
412 $filters['Osirusoft Spam Source']['comment'] =
413 _("FREE - Osirusoft Confirmed Spam Source - Sites that continually spam and have been manually added after multiple nominations. Use with caution. Seems to catch abuse auto-replies from some ISPs.");
414
415 $filters['Osirusoft Smart Host']['prefname'] = 'filters_spam_maps_osirusoft_sh';
416 $filters['Osirusoft Smart Host']['name'] = 'Osirusoft Smart Host List';
417 $filters['Osirusoft Smart Host']['link'] = 'http://relays.osirusoft.com/';
418 $filters['Osirusoft Smart Host']['dns'] = 'relays.osirusoft.com';
419 $filters['Osirusoft Smart Host']['result'] = '127.0.0.5';
420 $filters['Osirusoft Smart Host']['comment'] =
421 _("FREE - Osirusoft Smart Hosts - List of hosts that are secure but relay for other mail servers that are not secure.");
422
423 $filters['Osirusoft SPAMware']['prefname'] = 'filters_spam_maps_osirusoft_ss';
424 $filters['Osirusoft SPAMware']['name'] = 'Osirusoft Spamware Developers List';
425 $filters['Osirusoft SPAMware']['link'] = 'http://relays.osirusoft.com/';
426 $filters['Osirusoft SPAMware']['dns'] = 'relays.osirusoft.com';
427 $filters['Osirusoft SPAMware']['result'] = '127.0.0.6';
428 $filters['Osirusoft SPAMware']['comment'] =
429 _("FREE - Osirusoft Spamware Developers - It is believed that these are IP ranges of companies that are known to produce spam software. Seems to catch abuse auto-replies from some ISPs.");
430
431 $filters['Osirusoft Unc. OptIn']['prefname'] = 'filters_spam_maps_osirusoft_sl';
432 $filters['Osirusoft Unc. OptIn']['name'] = 'Osirusoft Unconfirmed OptIn Server List';
433 $filters['Osirusoft Unc. OptIn']['link'] = 'http://relays.osirusoft.com/';
434 $filters['Osirusoft Unc. OptIn']['dns'] = 'relays.osirusoft.com';
435 $filters['Osirusoft Unc. OptIn']['result'] = '127.0.0.7';
436 $filters['Osirusoft Unc. OptIn']['comment'] =
437 _("FREE - Osirusoft Unconfirmed OptIn Servers - List of listservers that opt users in without confirmation.");
438
439 $filters['ORDB']['prefname'] = 'filters_spam_ordb';
440 $filters['ORDB']['name'] = 'Open Relay Database List';
441 $filters['ORDB']['link'] = 'http://www.ordb.org/';
442 $filters['ORDB']['dns'] = 'relays.ordb.org';
443 $filters['ORDB']['result'] = '127.0.0.2';
444 $filters['ORDB']['comment'] =
445 _("FREE - ORDB was born when ORBS went off the air. It seems to have fewer false positives than ORBS did though.");
446
447 $filters['ORBZ Inputs']['prefname'] = 'filters_spam_orbz';
448 $filters['ORBZ Inputs']['name'] = 'ORBZ Inputs List';
449 $filters['ORBZ Inputs']['link'] = 'http://www.orbz.org/';
450 $filters['ORBZ Inputs']['dns'] = 'inputs.orbz.org';
451 $filters['ORBZ Inputs']['result'] = '127.0.0.2';
452 $filters['ORBZ Inputs']['comment'] =
453 _("FREE - Another ORBS replacement (just the INPUTS database used here).");
454
455 $filters['ORBZ Outputs']['prefname'] = 'filters_spam_orbz_outputs';
456 $filters['ORBZ Outputs']['name'] = 'ORBZ Outputs List';
457 $filters['ORBZ Outputs']['link'] = 'http://www.orbz.org/';
458 $filters['ORBZ Outputs']['dns'] = 'outputs.orbz.org';
459 $filters['ORBZ Outputs']['result'] = '127.0.0.2';
460 $filters['ORBZ Outputs']['comment'] =
461 _("FREE - Another ORBS replacement (just the OUTPUTS database used here).");
462
463 $filters['FiveTen Direct']['prefname'] = 'filters_spam_fiveten_src';
464 $filters['FiveTen Direct']['name'] = 'Five-Ten-sg.com Direct SPAM Sources';
465 $filters['FiveTen Direct']['link'] = 'http://www.five-ten-sg.com/blackhole.php';
466 $filters['FiveTen Direct']['dns'] = 'blackholes.five-ten-sg.com';
467 $filters['FiveTen Direct']['result'] = '127.0.0.2';
468 $filters['FiveTen Direct']['comment'] =
469 _("FREE - Five-Ten-sg.com - Direct SPAM sources.");
470
471 $filters['FiveTen DUL']['prefname'] = 'filters_spam_fiveten_dul';
472 $filters['FiveTen DUL']['name'] = 'Five-Ten-sg.com DUL Lists';
473 $filters['FiveTen DUL']['link'] = 'http://www.five-ten-sg.com/blackhole.php';
474 $filters['FiveTen DUL']['dns'] = 'blackholes.five-ten-sg.com';
475 $filters['FiveTen DUL']['result'] = '127.0.0.3';
476 $filters['FiveTen DUL']['comment'] =
477 _("FREE - Five-Ten-sg.com - Dial-up lists - includes some DSL IPs.");
478
479 $filters['FiveTen Unc. OptIn']['prefname'] = 'filters_spam_fiveten_oi';
480 $filters['FiveTen Unc. OptIn']['name'] = 'Five-Ten-sg.com Unconfirmed OptIn Lists';
481 $filters['FiveTen Unc. OptIn']['link'] = 'http://www.five-ten-sg.com/blackhole.php';
482 $filters['FiveTen Unc. OptIn']['dns'] = 'blackholes.five-ten-sg.com';
483 $filters['FiveTen Unc. OptIn']['result'] = '127.0.0.4';
484 $filters['FiveTen Unc. OptIn']['comment'] =
485 _("FREE - Five-Ten-sg.com - Bulk mailers that do not use confirmed opt-in.");
486
487 $filters['FiveTen Others']['prefname'] = 'filters_spam_fiveten_oth';
488 $filters['FiveTen Others']['name'] = 'Five-Ten-sg.com Other Misc. Servers';
489 $filters['FiveTen Others']['link'] = 'http://www.five-ten-sg.com/blackhole.php';
490 $filters['FiveTen Others']['dns'] = 'blackholes.five-ten-sg.com';
491 $filters['FiveTen Others']['result'] = '127.0.0.5';
492 $filters['FiveTen Others']['comment'] =
b053d723 493 _("FREE - Five-Ten-sg.com - Other misc. servers.");
4eee5968 494
cb2ccf4b 495 $filters['FiveTen Single Stage']['prefname'] = 'filters_spam_fiveten_ss';
496 $filters['FiveTen Single Stage']['name'] = 'Five-Ten-sg.com Single Stage Servers';
497 $filters['FiveTen Single Stage']['link'] = 'http://www.five-ten-sg.com/blackhole.php';
498 $filters['FiveTen Single Stage']['dns'] = 'blackholes.five-ten-sg.com';
499 $filters['FiveTen Single Stage']['result'] = '127.0.0.6';
500 $filters['FiveTen Single Stage']['comment'] =
7dc31c07 501 _("FREE - Five-Ten-sg.com - Single Stage servers.");
cdbecc9e 502
cb2ccf4b 503 $filters['FiveTen SPAM Support']['prefname'] = 'filters_spam_fiveten_supp';
504 $filters['FiveTen SPAM Support']['name'] = 'Five-Ten-sg.com SPAM Support Servers';
505 $filters['FiveTen SPAM Support']['link'] = 'http://www.five-ten-sg.com/blackhole.php';
506 $filters['FiveTen SPAM Support']['dns'] = 'blackholes.five-ten-sg.com';
507 $filters['FiveTen SPAM Support']['result'] = '127.0.0.7';
508 $filters['FiveTen SPAM Support']['comment'] =
7dc31c07 509 _("FREE - Five-Ten-sg.com - SPAM Support servers.");
cdbecc9e 510
cb2ccf4b 511 $filters['FiveTen Web forms']['prefname'] = 'filters_spam_fiveten_wf';
512 $filters['FiveTen Web forms']['name'] = 'Five-Ten-sg.com Web Form IPs';
513 $filters['FiveTen Web forms']['link'] = 'http://www.five-ten-sg.com/blackhole.php';
514 $filters['FiveTen Web forms']['dns'] = 'blackholes.five-ten-sg.com';
515 $filters['FiveTen Web forms']['result'] = '127.0.0.8';
516 $filters['FiveTen Web forms']['comment'] =
7dc31c07 517 _("FREE - Five-Ten-sg.com - Web Form IPs.");
cdbecc9e 518
4eee5968 519 $filters['Dorkslayers']['prefname'] = 'filters_spam_dorks';
520 $filters['Dorkslayers']['name'] = 'Dorkslayers Lists';
521 $filters['Dorkslayers']['link'] = 'http://www.dorkslayers.com';
522 $filters['Dorkslayers']['dns'] = 'orbs.dorkslayers.com';
523 $filters['Dorkslayers']['result'] = '127.0.0.2';
524 $filters['Dorkslayers']['comment'] =
525 _("FREE - Dorkslayers appears to include only really bad open relays outside the US to avoid being sued. Interestingly enough, their website recommends you NOT use their service.");
526
527 $filters['ORBL']['prefname'] = 'filters_spam_orbl';
528 $filters['ORBL']['name'] = 'ORBL Lists';
529 $filters['ORBL']['link'] = 'http://www.orbl.org';
530 $filters['ORBL']['dns'] = 'or.orbl.org';
531 $filters['ORBL']['result'] = '127.0.0.2';
532 $filters['ORBL']['comment'] =
533 _("FREE - ORBL is another ORBS spinoff formed after ORBS shut down. May be SLOOOOOOW!");
534
535 $filters['ORBZ-UK Inputs']['prefname'] = 'filters_spam_orbzuk_in';
536 $filters['ORBZ-UK Inputs']['name'] = 'ORBZ-UK Inputs Lists';
537 $filters['ORBZ-UK Inputs']['link'] = 'http://orbz.gst-group.co.uk';
538 $filters['ORBZ-UK Inputs']['dns'] = 'orbz.gst-group.co.uk';
539 $filters['ORBZ-UK Inputs']['result'] = '127.0.0.3';
540 $filters['ORBZ-UK Inputs']['comment'] =
541 _("FREE - orbz.gst-group.co.uk - Inputs only.");
542
543 $filters['ORBZ-UK Outputs']['prefname'] = 'filters_spam_orbzuk_out';
544 $filters['ORBZ-UK Outputs']['name'] = 'ORBZ-UK Outputs Lists';
545 $filters['ORBZ-UK Outputs']['link'] = 'http://orbz.gst-group.co.uk';
546 $filters['ORBZ-UK Outputs']['dns'] = 'orbz.gst-group.co.uk';
547 $filters['ORBZ-UK Outputs']['result'] = '127.0.0.2';
548 $filters['ORBZ-UK Outputs']['comment'] =
549 _("FREE - orbz.gst-group.co.uk - Outputs only.");
550
551 $filters['ORBZ-UK Postmaster']['prefname'] = 'filters_spam_orbzuk_pst';
552 $filters['ORBZ-UK Postmaster']['name'] = 'ORBZ-UK Postmaster Bouncer Lists';
553 $filters['ORBZ-UK Postmaster']['link'] = 'http://orbz.gst-group.co.uk';
554 $filters['ORBZ-UK Postmaster']['dns'] = 'orbz.gst-group.co.uk';
555 $filters['ORBZ-UK Postmaster']['result'] = '127.0.0.9';
556 $filters['ORBZ-UK Postmaster']['comment'] =
557 _("FREE - orbz.gst-group.co.uk - mailservers that refuse or bounce email addressed to postmaster@<theirdomain>.");
558
559 $filters['SPAMcop']['prefname'] = 'filters_spam_spamcop';
560 $filters['SPAMcop']['name'] = 'SPAM Cop Lists';
561 $filters['SPAMcop']['link'] = 'http://spamcop.net/bl.shtml';
562 $filters['SPAMcop']['dns'] = 'bl.spamcop.net';
563 $filters['SPAMcop']['result'] = '127.0.0.2';
564 $filters['SPAMcop']['comment'] =
565 _("FREE, for now - SPAMCOP - An interesting solution that lists servers that have a very high spam to legit email ratio (85% or more).");
566
567 foreach ($filters as $Key => $Value) {
568 $filters[$Key]['enabled'] = getPref($data_dir, $username,
569 $filters[$Key]['prefname']);
570 }
571
572 return $filters;
573 }
574
575 function remove_filter ($id) {
576 global $data_dir, $username;
577
578 while ($nextFilter = getPref($data_dir, $username, 'filter' .
579 ($id + 1))) {
580 setPref($data_dir, $username, 'filter' . $id, $nextFilter);
581 $id ++;
582 }
583
584 removePref($data_dir, $username, 'filter' . $id);
585 }
586
587 function filter_swap($id1, $id2) {
588 global $data_dir, $username;
589
590 $FirstFilter = getPref($data_dir, $username, 'filter' . $id1);
591 $SecondFilter = getPref($data_dir, $username, 'filter' . $id2);
592
593 if ($FirstFilter && $SecondFilter) {
594 setPref($data_dir, $username, 'filter' . $id2, $FirstFilter);
595 setPref($data_dir, $username, 'filter' . $id1, $SecondFilter);
596 }
597 }
849bdf42 598?>