2 # Search for bad words in strings
4 # Copyright (c) 2000 Dirk Koopman
18 use vars qw($badword);
20 my $oldfn = "$main::data/badwords";
21 $badword = new DXHash "badword";
23 use vars qw($VERSION $BRANCH);
24 $VERSION = sprintf( "%d.%03d", q$Revision$ =~ /(\d+)\.(\d+)/ );
25 $BRANCH = sprintf( "%d.%03d", q$Revision$ =~ /\d+\.\d+\.(\d+)\.(\d+)/ ) || 0;
26 $main::build += $VERSION;
27 $main::branch += $BRANCH;
29 # load the badwords file
33 return unless -e $oldfn;
34 my $fh = new IO::File $oldfn;
49 my $l = "can't open $oldfn $!";
56 # check the text against the badwords list
61 for (split(/\s+/, $s)) {
63 return $_ if $badword->in($_);
65 return $_ if $badword->in($_);
68 # look for a few of the common ones with spaces and stuff
69 if ($s =~ /F[\s\W]*U[\s\W]*C[\s\W]*K/) {
71 } elsif ($s =~ /C[\s\W]*U[\s\W]*N[\s\W]*T/) {
73 } elsif ($s =~ /W[\s\W]*A[\s\W]*N[\s\W]*K/) {
75 } elsif ($s =~ /C[\s\W]*[0O][\s\W]*C[\s\W]*K/) {
77 } elsif ($s =~ /S[\s\W]*H[\s\W]*[I1][\s\W]*T/) {