#
# Movable Type Comment Spam Neutralizer Macro
#
# VERSION: 1.2
# DATE: 10/01/2003
# AUTHOR: Jay Allen (http://www.jayallen.org)
# INFO: http://www.jayallen.org/journey/2003/09/killing_comment_spam_dead
#
# Note: You should probably leave all of these lines so you know what version you are running
#
# VERSION HISTORY:
# 1.2 - Fixed a bug where forward slashes in the ban list would render it useless
# Provided for regex mode which is off by default. See below to enable it.
# 1.1 - Provided for perl style comments in Comment URL Ban list
# Removed a loophole where someone could use HTML comments to circumvent the macro
# 1.0 - Initial release
#
# If you want to enable regex matching, uncomment the line below
# If you do so, you MUST quote metacharacters (e.g. / )
#$enable_regex = 1;
my $list = <<'END_OF_TEXT';
END_OF_TEXT
chomp $list;
my @lines = split /\r?\n/, $list;
$counter = 0;
foreach $line (@lines) {
$line =~ s/\#.*//; # Strip out comments
my ($banned_url) = $line =~ m/^\s*(\S+)/;
next if !$banned_url;
if ($enable_regex) {
print '[[COMMENT SPAM]]' ;
} else {
print '[[COMMENT SPAM]]';
}
}
<$MTInclude module="Comment Spam Banned URL List"$>