Project

General

Profile

« Previous | Next » 

Revision 2152

Added by sgarg over 20 years ago

Fixed bug# 1309. Also put a regex check on ending year and beginning year.

View differences:

src/perl/register-dataset.cgi
600 600
	}
601 601
    }
602 602

  
603
    if (hasContent($FORM::beginningYear) && !($FORM::beginningYear =~ /[0-9][0-9][0-9][0-9]/)){
604
	push(@invalidParams, "Invalid beginning year specified.")
605
    }
606

  
607
    if (hasContent($FORM::endingYear) && !($FORM::endingYear =~ /[0-9][0-9][0-9][0-9]/)){
608
	push(@invalidParams, "Invalid ending year specified.")
609
    }
610
    
603 611
    # If the "use site" coord. box is checked and if the site is in 
604 612
    # the longitude hash ...  && ($siteLatDMS{$FORM::site})
605 613
    
......
626 634
	    $longSec1 = $FORM::longSec1;
627 635
	    $hemisphLong1 = $FORM::hemisphLong1;
628 636
	}
637

  
638
	if($latDeg1 > 90 || $latDeg1 < 0){
639
	    push(@invalidParams, "Invalid first latitude degrees specified.");
640
	}
641
	if($latMin1 > 59 || $latMin1 < 0){
642
	    push(@invalidParams, "Invalid first latitude minutes specified.");
643
	}
644
	if($latSec1 > 59 || $latSec1 < 0){
645
	    push(@invalidParams, "Invalid first latitude seconds specified.");
646
	}
647
	if($longDeg1 > 180 || $longDeg1 < 0){
648
	    push(@invalidParams, "Invalid first longitude degrees specified.");
649
	}
650
	if($longMin1 > 59 || $longMin1 < 0){
651
	    push(@invalidParams, "Invalid first longitude minutes specified.");
652
	}
653
	if($longSec1 > 59 || $longSec1 < 0){
654
	    push(@invalidParams, "Invalid first longitude seconds specified.");
655
	}
656

  
657
	if(hasContent($FORM::latDeg2) && ($FORM::latDeg2 > 90 || $FORM::latDeg2 < 0)){
658
	    push(@invalidParams, "Invalid second latitude degrees specified.");
659
	}
660
	if(hasContent($FORM::latMin2) && ($FORM::latMin2 > 59 || $FORM::latMin2 < 0)){
661
	    push(@invalidParams, "Invalid second latitude minutes specified.");
662
	}
663
	if(hasContent($FORM::latSec2) && ($FORM::latSec2 > 59 || $FORM::latSec2 < 0)){
664
	    push(@invalidParams, "Invalid second latitude seconds specified.");
665
	}
666
	if(hasContent($FORM::latDeg2) && ($FORM::longDeg2 > 180 || $FORM::longDeg2 < 0)){
667
	    push(@invalidParams, "Invalid second longitude degrees specified.");
668
	}
669
	if(hasContent($FORM::latMin2) && ($FORM::longMin2 > 59 || $FORM::longMin2 < 0)){
670
	    push(@invalidParams, "Invalid second longitude minutes specified.");
671
	}
672
	if(hasContent($FORM::latSec2) && ($FORM::longSec2 > 59 || $FORM::longSec2 < 0)){
673
	    push(@invalidParams, "Invalid second longitude seconds specified.");
674
	}
629 675
    }
630 676
    
631 677
    # Check if latDeg1 and longDeg1 has values if useSiteCoord is used. 
......
1166 1212
	    my $hemisph;
1167 1213
	    $hemisph = ($hemisphLong1 eq "W") ? -1 : 1;
1168 1214
	    $cov .= "<westBoundingCoordinate>";
1169
	    $cov .= $hemisph * ($longDeg1 + (60*$longMin1+$longSec1)/3600);
1215
	    my $var = $hemisph * ($longDeg1 + (60*$longMin1+$longSec1)/3600);
1216
	    $cov .= sprintf("%.4f\n", $var);
1170 1217
	    $cov .= "</westBoundingCoordinate>\n";
1171 1218
	    
1172 1219
	    $hemisph = ($hemisphLong2 eq "W") ? -1 : 1;
1173 1220
	    $cov .= "<eastBoundingCoordinate>";
1174
	    $cov .= $hemisph * ($longDeg2 + (60*$longMin2+$longSec2)/3600);
1221
	    $var = $hemisph * ($longDeg2 + (60*$longMin2+$longSec2)/3600);
1222
	    $cov .= sprintf("%.4f\n", $var);
1175 1223
	    $cov .= "</eastBoundingCoordinate>\n";
1176 1224
	    
1177 1225
	    $hemisph = ($hemisphLat1 eq "S") ? -1 : 1;
1178 1226
	    $cov .= "<northBoundingCoordinate>";
1179
	    $cov .= $hemisph * ($latDeg1 + (60*$latMin1+$latSec1)/3600);
1227
	    $var = $hemisph * ($latDeg1 + (60*$latMin1+$latSec1)/3600);
1228
	    $cov .= sprintf("%.4f\n", $var);	   
1180 1229
	    $cov .= "</northBoundingCoordinate>\n";
1181 1230
	    
1182 1231
	    $hemisph = ($hemisphLat2 eq "S") ? -1 : 1;
1183 1232
	    $cov .= "<southBoundingCoordinate>";
1184
	    $cov .= $hemisph * ($latDeg2 + (60*$latMin2+$latSec2)/3600);
1233
	    $var = $hemisph * ($latDeg2 + (60*$latMin2+$latSec2)/3600);
1234
	    $cov .= sprintf("%.4f\n", $var);
1185 1235
	    $cov .= "</southBoundingCoordinate>\n";
1186 1236
	    
1187 1237
	    $cov .= "</boundingCoordinates>\n";

Also available in: Unified diff