From: ndparker <> Date: Sat, 16 Jun 2001 16:18:11 +0000 (+0000) Subject: added version check X-Git-Url: https://git.p6c8.net/selfforum.git/commitdiff_plain/12cb924004788df3066c77db8a723b32235bccf0?ds=inline;hp=125e2cfe77eefc87a828ef617664ee3d98da8461 added version check --- diff --git a/selfforum-cgi/user/fo_posting.pl b/selfforum-cgi/user/fo_posting.pl index 1fe42a9..3126881 100644 --- a/selfforum-cgi/user/fo_posting.pl +++ b/selfforum-cgi/user/fo_posting.pl @@ -16,6 +16,7 @@ use vars qw( $Shared $Script $Config + $VERSION ); # locate the script @@ -27,13 +28,17 @@ BEGIN { $Config = "$Bin/config"; $Script = ($null =~ /^.*\/(.*)$/)? $1 : $null; -# my $null = $0; #$null =~ s/\\/\//g; # for win :-( +# my $null = $0; # $Bin = ($null =~ /^(.*)\/.*$/)? $1 : '.'; -# $Config = "$Bin/../../../cgi-config/devforum"; -# $Shared = "$Bin/../../../cgi-shared"; +# $Config = "$Bin/../../daten/forum/config"; +# $Shared = "$Bin/../../cgi-shared"; # $Script = ($null =~ /^.*\/(.*)$/)? $1 : $null; } +# setting umask, remove or comment it, if you don't need +# +umask 006; + use lib "$Shared"; use CGI::Carp qw(fatalsToBrowser); @@ -41,6 +46,10 @@ use Conf; use Conf::Admin; use Posting::Cache; +# Version check +# +$VERSION = do { my @r =(q$Revision$ =~ /\d+/g); sprintf "%d."."%02d" x $#r, @r }; + # load script configuration and admin default conf. # my $conf = read_script_conf ($Config, $Shared, $Script); @@ -837,8 +846,28 @@ sub check_cgi { # (my $val_ww = $val) =~ s/\s+//g; - $val_ww =~ y/a-zA-Z//cd - if (exists ($formdata -> {$name {$_}} -> {type}) and $formdata -> {$name {$_}} -> {type} eq 'name'); + if (exists ($formdata -> {$name {$_}} -> {type}) and $formdata -> {$name {$_}} -> {type} eq 'name') { + $val_ww =~ y/a-zA-Z//cd; + + my @badlist = map {qr/\Q$_/i} qw ( + # insert badmatchlist here + ); + + push @badlist => map {qr/\b\Q$_\E\b/i} qw( + # insert badwordlist here + ); + + for (@badlist) { + if ($val_ww =~ /$_/) { + $self -> {error} = { + spec => 'undesired', + desc => $name{$_}, + type => 'fatal' + }; + return; + } + } + } if (length $val_ww < $formdata -> {$name {$_}} -> {minlength}) { $self -> {error} = {