# ================================================================== # Plugins::Filter_Words - Auto Generated Program Module # # Plugins::Filter_Words # Author : Andy Newby # Version : 1 # Updated : Mon Oct 14 02:57:03 2002 # # ================================================================== # package Plugins::Filter_Words; # ================================================================== use strict; use GT::Base; use GT::Plugins qw/STOP CONTINUE/; use Links qw/$CFG $IN $DB/; use Links::Plugins; # Inherit from base class for debug and error methods @Plugins::Filter_Words::ISA = qw(GT::Base); # Your code begins here! Good Luck! # PLUGIN HOOKS # =================================================================== sub check_words { # ------------------------------------------------------------------- # This subroutine will get called whenever the hook 'user_add_link' # is run. You should call GT::Plugins->action ( STOP ) if you don't # want the regular code to run, otherwise the code will continue as # normal. # my (@args) = @_; my $opts = Links::Plugins->get_plugin_user_cfg('Filter_Words'); my $words = $opts->{List}; my @words = split(/ /, $words); # grab the words, by slicing where spaces are... my $do_t = $opts->{Check_Title}; my $do_d = $opts->{Check_Description}; my $do_u = $opts->{Check_URL}; my $categorytmp = $IN->param('CatLinks.CategoryID'); my $categoryname = $DB->table('Category')->select( ['Full_Name'], { ID => $categorytmp } )->fetchrow; my $categoryhidden = qq|$categoryname|; # if they want us to check the title, then do it! if ($do_t) { foreach (@words) { if ($IN->param('Title') =~ /\b$_\b/i) { print $IN->header(); print Links::SiteHTML::display('add', { error => "Bad word ($_) was found in your title!", Category => $categoryhidden }); exit; } } } # if they want us to check the description, then do it! if ($do_d) { foreach (@words) { if ($IN->param('Description') =~ /\b$_\b/i) { print $IN->header(); print Links::SiteHTML::display('add', { error => "Bad word ($_) was found in your description!", Category => $categoryhidden }); exit; } } } # if they want us to check the title, then do it! if ($do_t) { foreach (@words) { if ($IN->param('URL') =~ /\b$_\b/i) { print $IN->header(); print Links::SiteHTML::display('add', { error => "Bad word ($_) was found in your URL!", Category => $categoryhidden }); exit; } } } return @args; } # ADMIN MENU OPTIONS # =================================================================== sub Readme { # ------------------------------------------------------------------- # This subroutine will get called whenever the user clicks # on 'Readme' in the admin menu. Remember, you need to print # your own content-type headers; you should use # print $IN->header(); print qq| Readme

Filter_Words

Author: Andy Newby
WWW: http://www.ace-installer.com
Email: webmaster\@ace-installer.com

Please send a donation HERE if you can afford it, this will encourage me to release new plugins!

ABOUT

Someone asked me to write a plugin that would allow the webmaster to filter out specific bad words. So, here it is :) Basically, you can set what variables you want to be checked for bad words (Title/URL/Description), and also set the words you want to check. To edit these options, go to Plugin Manager and then click on 'Edit' next to the Filter_Words listing.

Well, enjoy :)

 

 

|; } sub Donate { # ------------------------------------------------------------------- # This subroutine will get called whenever the user clicks # on 'Donate' in the admin menu. Remember, you need to print # your own content-type headers; you should use # # print $IN->header(); # print "Location: http://www.ace-installer.com/php/modules.php?name=Content&pa=showpage&pid=9\n\n"; } # Always end with a 1. 1;