[LON-CAPA-cvs] cvs: loncom /interface lonhtmlcommon.pm
matthew
lon-capa-cvs@mail.lon-capa.org
Fri, 17 Oct 2003 19:56:13 -0000
matthew Fri Oct 17 15:56:13 2003 EDT
Modified files:
/loncom/interface lonhtmlcommon.pm
Log:
get_date_from_form: Restrict hours to being ge 0 and lt 24, not gt 0 and lt 32
(cut and paste coding :( )
Added more error checking on the date generation. This routine is more strict
about the data it accepts and will return 'undef' if any of the date forms is
not present. This will not be an issue because the &date_setter routine makes
sure all of the form elements are generated.
Index: loncom/interface/lonhtmlcommon.pm
diff -u loncom/interface/lonhtmlcommon.pm:1.32 loncom/interface/lonhtmlcommon.pm:1.33
--- loncom/interface/lonhtmlcommon.pm:1.32 Wed Oct 15 14:01:10 2003
+++ loncom/interface/lonhtmlcommon.pm Fri Oct 17 15:56:13 2003
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# a pile of common html routines
#
-# $Id: lonhtmlcommon.pm,v 1.32 2003/10/15 18:01:10 www Exp $
+# $Id: lonhtmlcommon.pm,v 1.33 2003/10/17 19:56:13 matthew Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -288,7 +288,7 @@
}
if (defined($ENV{'form.'.$dname.'_hour'})) {
my $tmphour = $ENV{'form.'.$dname.'_hour'};
- if (($tmphour =~ /^\d+$/) && ($tmphour > 0) && ($tmphour < 32)) {
+ if (($tmphour =~ /^\d+$/) && ($tmphour >= 0) && ($tmphour < 24)) {
$hour = $tmphour;
}
}
@@ -311,7 +311,9 @@
}
}
if (($year<70) || ($year>137)) { return undef; }
- if (eval(&timelocal($sec,$min,$hour,$day,$month,$year))) {
+ if (defined($sec) && defined($min) && defined($hour) &&
+ defined($day) && defined($month) && defined($year) &&
+ eval(&timelocal($sec,$min,$hour,$day,$month,$year))) {
return &timelocal($sec,$min,$hour,$day,$month,$year);
} else {
return undef;