From d0303ab3ecb54eef2ed1b5e55839eada16748416 Mon Sep 17 00:00:00 2001 From: "lpsolit%gmail.com" <> Date: Fri, 22 Jul 2005 03:04:24 +0000 Subject: =?UTF-8?q?Bug=20301463:=20Move=20CheckFormField=20and=20CheckForm?= =?UTF-8?q?FieldDefined=20into=20Field.pm=20-=20Patch=20by=20Fr=C3=A9d?= =?UTF-8?q?=C3=A9ric=20Buclin=20=20r=3Dmkanat=20a=3Djus?= =?UTF-8?q?tdave?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CGI.pl | 43 ------------------------------------------- 1 file changed, 43 deletions(-) (limited to 'CGI.pl') diff --git a/CGI.pl b/CGI.pl index 9c65efdf2..4b7269358 100644 --- a/CGI.pl +++ b/CGI.pl @@ -52,49 +52,6 @@ require 'globals.pl'; use vars qw($template $vars); -# Implementations of several of the below were blatently stolen from CGI.pm, -# by Lincoln D. Stein. - -# check and see if a given field exists, is non-empty, and is set to a -# legal value. assume a browser bug and abort appropriately if not. -# if $legalsRef is not passed, just check to make sure the value exists and -# is non-NULL -sub CheckFormField ($$;\@) { - my ($cgi, # a CGI object - $fieldname, # the fieldname to check - $legalsRef # (optional) ref to a list of legal values - ) = @_; - - if (!defined $cgi->param($fieldname) - || trim($cgi->param($fieldname)) eq "" - || (defined($legalsRef) - && lsearch($legalsRef, $cgi->param($fieldname))<0)) - { - SendSQL("SELECT description FROM fielddefs WHERE name=" . SqlQuote($fieldname)); - my $result = FetchOneColumn(); - my $field; - if ($result) { - $field = $result; - } - else { - $field = $fieldname; - } - - ThrowCodeError("illegal_field", { field => $field }); - } -} - -# check and see if a given field is defined, and abort if not -sub CheckFormFieldDefined ($$) { - my ($cgi, # a CGI object - $fieldname, # the fieldname to check - ) = @_; - - if (!defined $cgi->param($fieldname)) { - ThrowCodeError("undefined_field", { field => $fieldname }); - } -} - sub PutHeader { ($vars->{'title'}, $vars->{'h1'}, $vars->{'h2'}) = (@_); -- cgit v1.2.1