forked from bentglasstube/blosxom-plugins
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathantispam-v0i1
86 lines (58 loc) · 2 KB
/
antispam-v0i1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
#Bloxsom Plugin:AntiSpam
#Author: Fletcher T. Penney
#Version: 0.1
package antispam;
# --- Configurable variables ----
# -------------------------------
$ignore = 0;
$email = '[\w\.]+@\w+(\.\w+)+';
sub start {
1;
}
sub story {
my ($pkg, $path, $filename, $story_ref, $title_ref, $body_ref) = @_;
if ($$story_ref =~ m/<!-- noantispam -->/gi || $$body_ref =~ m/<!--
noantispam -->/gi) {
$ignore = 1;
}
if ($ignore == 0) {
while ($$body_ref =~ /($email)/ig) {
$original=$1;
$masked="";
@decimal = unpack('C*', $original);
foreach $i (@decimal) {
$masked.="&#".$i.";";
}
$$body_ref =~ s/$original/$masked/ig;
}
}
1;
}
1;
__END__
=head1 NAME
Blosxom Plug-in: antispam
=head1 DESCRIPTION
This plugin converts any email addresses in your stories into ascii code. It
has no visible or functional effect, other than to change the html source code.
So something like this:
Looks like this:
fletcher@alumni.duke.edu
But when viewed with a web browser, it is translated back into the expected
human readable string. The idea is that some of the spambots can't read this.
Though as this technique becomes more popular, I am sure that the spambots will
catch on. But it can't hurt, right?
I would like to figure out how to get this work with Writebacks as well to hide
email address that are submitted, but haven't gotten around to it. If someone
wants to modify the code and let me know, I can distribute the modified version
and give you credit.
Let me know of any bugs!!
=head1 AUTHOR
Fletcher T. Penney http://fletcher.freeshell.org
=head1 LICENSE
This source is submitted to the public domain. Feel free to use and modify it.
If you like, a comment in your modified source attributing credit to myself for
my work would be appreciated.
THIS SOFTWARE IS PROVIDED AS IS AND WITHOUT ANY WARRANTY OF ANY KIND. USE AT
YOUR OWN RISK!