Update flavourpathinfo to use Blosxom::Debug.
[blosxom-plugins.git] / general / antispam
blob2f305446cee7d7b551600fb74b506251f0dae0d9
1 #Bloxsom Plugin:AntiSpam
2 #Author: Fletcher T. Penney
3 #Version: 0.1
5 package antispam;
7 # --- Configurable variables ----
11 # -------------------------------
13 $ignore = 0;
14 $email = '[\w\.]+@\w+(\.\w+)+';
16 sub start {
17         1;
20 sub story {
21         my ($pkg, $path, $filename, $story_ref, $title_ref, $body_ref) = @_;
23         if ($$story_ref =~ m/<!-- noantispam -->/gi || $$body_ref =~ m/<!-- 
24 noantispam -->/gi) {
25                 $ignore = 1;
26         }
28         if ($ignore == 0) {
29                 while ($$body_ref =~ /($email)/ig) {
30                         $original=$1;
31                         $masked="";
32                         @decimal = unpack('C*', $original);
33                         foreach $i (@decimal) {
34                                 $masked.="&#".$i.";";
35                         }
36                         $$body_ref =~ s/$original/$masked/ig;
37                 }
38         }
39         1;
45 __END__
47 =head1 NAME
49 Blosxom Plug-in: antispam
51 =head1 DESCRIPTION
53 This plugin converts any email addresses in your stories into ascii code.  It 
54 has no visible or functional effect, other than to change the html source code.  
55 So something like this:
56         fletcher@hidden.domain
58 Looks like this:
59 &#102;&#108;&#101;&#116;&#99;&#104;&#101;&#114;&#64;&#97;&#108;&#117;&#109;&#110;&#105;&#46;&#100;&#117;&#107;&#101;&#46;&#101;&#100;&#117;
61 But when viewed with a web browser, it is translated back into the expected 
62 human readable string.  The idea is that some of the spambots can't read this.  
63 Though as this technique becomes more popular, I am sure that the spambots will 
64 catch on.  But it can't hurt, right?
66 =head1 TODO
68 Figure out how to get this work with writebacks as well to hide email addresses 
69 that are submitted. 
71 =head1 BUGS
73 None known; please send bug reports and feedback to the Blosxom
74 development mailing list <blosxom-devel@lists.sourceforge.net>.
76 =head1 AUTHOR
78 Fletcher T. Penney  http://fletcher.freeshell.org
80 This plugin is now maintained by the Blosxom Sourceforge Team,
81 <blosxom-devel@lists.sourceforge.net>.
83 =head1 LICENSE
85 This source is submitted to the public domain.  Feel free to use and modify it.  
86 If you like, a comment in your modified source attributing credit to myself for 
87 my work would be appreciated.
89 THIS SOFTWARE IS PROVIDED AS IS AND WITHOUT ANY WARRANTY OF ANY KIND.  USE AT 
90 YOUR OWN RISK!