Blocklist3

Summary: Block vandals or spammers by IP, word, phrase, or regular expressions.
Version: 2006-04-28 3.0
Prerequisites: PmWiki 2.0.x or newer
Status: beta
Maintainer: Crisses XES
Categories: Obsolete

This recipe is deprecated, and will no longer be supported. Please see the built-in blocklist features that come pre-packaged in PmWiki. Thank you!!

This recipe lets you block wiki vandals and spammers who are spamming every webform they can find. The "blocklist" is like a blacklist for IP numbers or phrases. New additions to the Blocklist include optional advanced features for more complicated situations.

Until more people have tested this recipe, consider it to be "beta" status. blocklist3.phpΔ. There is a basic (and real) Attach:sampleblocklist.txt Δ (note that the file contains content for blocking purposes that may be unsuitable for children) that you can open in a text editor and copy to your Site.Blocklist wiki page. The file is rather long, and you may want or need to pare it down. Blocklist3 is based on Blocklist2. While it's a major revision to the code organization and flow, it allows all the functionality of Blocklist2 with the addition of "unblocklisting" (see below).

Blocklist3 allows the creation of a list of words, phrases, regular expressions (advanced text pattern matching), and IP addresses to be blocked from posts to the site. See BlocklistHelperScripts for scripts that will help parse emails or blocked content for relevant terminology you may want to block on your site.

Installation on an individual wiki

  1. copy blocklist3.php into the cookbook/ directory
  2. add the following line to your "local/config.php" file, preferably near the top.
    if ($action=='edit') include_once('cookbook/blocklist3.php');
(Note that people using the CommentBox cookbook module should use
if ($action == 'edit' || $action == 'comment') {
  include_once("cookbook/blocklist3.php"); }
instead).
  1. create a page called Site.Blocklist (see the item below about Main.Blocklist) on your site, and seed it with some of the words, phrases or IP addresses from the posts that have been plaguing you. (format is: "block:phrase", without quotes).
  2. if you like it, take a look at the file attachment Attach:sampleblocklist.txt Δ and decide how much of that you would like to add to your blocklist. It is a list of obscure drug names, known words and phrases in-use by vandals, IP addresses of repeat offenders, etc.
  3. decide whether you would like any of the Options listed below to be added to your configuration. In particular, you should check the Blocklist Security items.

Installation on a wiki farm

  • copy blocklist3.php into the farm's cookbook/ directory
  • add the following line to the farm's "local/farmconfig.php" file, preferably near the top
    if ($action=='edit') include_once($FarmD.'/cookbook/blocklist3.php');

(Note that people using the CommentBox cookbook module should use

if ($action == 'edit' || $action == 'comment') {
  include_once($FarmD.'/cookbook/blocklist2.php'); }

instead).

  • create a page called Site.Blocklist on each wiki in your farm you want to protect - each wiki can have its own entries
  • seed Site.Blocklist with some of the words, phrases or IP addresses from the posts that have been plaguing you

Spelling counts

Be careful when typing the page name "Blocklist". On some `OSes (Windows) you can use the wrong case but still get the Blocklist page displayed. However, when you try to save your edits, the script will reject them because the page name has the wrong case.

Site.Blocklist versus Main.Blocklist

The original version of the Blocklist script looked up the blocklist terms on a page called Main.Blocklist. If you want to continue using Main.Blocklist or if you want to use custom blocklist pages, set the following variable in either your config.php or farmconfig.php file before you include the blocklist3.php script:

$BlocklistPages[] = "Main.Blocklist";
$BlocklistPages[] = "Group.AnotherBlocklist";

If you do this, Site.Blocklist will be ignored, so you may also want to add:

$BlocklistPages[] = "Site.Blocklist";

Use Notes

All of the former Blocklist2 functionality is the same.

Additional Options

For the many additional options in Blocklist3, see also Blocklist2.

UnBlocklisting

Blocklist3 allows the admin to explicitly remove entries from the blocklist. In the event that a WikiFarm is sharing blocklists, the admins may choose to have entries in the shared blocklist that need to be removed on individual wikis.

The setting

$EnableUnBlocklist = 1;

before the include statement allows

unblock:pattern

Unblock removes items that are "block:"ed.

If $EnableUnBlocklist is used with $EnableBlocklistRegex = 1; Blocklist3 allows

unregex:pattern

unregex removes items that are "regex:"ed -- but you must use the exact same pattern to unblock a regex (it uses a string match, not a regex match, to unblock the regexes). For example, if you have:

regex:/\bcialis\b/

in one of your blocklists, you can only unregex it in another blocklist file by entering:

unregex:/\bcialis\b/

There are currently no provisions for unblocking IP addresses.

"unblock:" is not compatible with Blocklist2. Items that are "unblock:"ed will end up blocked. If you need to revert back to Blocklist2 after using the unblock feature, remove all unblocked items from the blocklist.

Release Notes

  • 2006-04-28 - version 3.0 - Reorganized the Blocklist2 code to add unblock features.

Comments

I am using Commentbox-Styled. It doesn't work with it! Also if I remove the input-box, spammers still spams my site (with edit password and blocklist3 is launched before commentbox-styled). What could e the reason? Thanks flox August 17, 2006, at 04:18 AM

I: I noticed a new type of type SPAM (see http://adacl.sourceforge.net/pmwiki.php/Main/CommonGatewayInterface?action=diff - History spamming! The spammer just fills the Summary Field. Completely ineffective of course - but SPAMmers never cared about the effectiveness of there dirty deeds. ~~~~~

See Also

Contributors

XES

User notes? : If you use, used or reviewed this recipe, you can add your name. These statistics appear in the Cookbook listings and will help newcomers browsing through the wiki.