From 507ceed577cea16cf7ee701dcf897252fb1d017b Mon Sep 17 00:00:00 2001 From: Darryl Quinn Date: Sun, 19 Mar 2017 14:55:13 -0500 Subject: [PATCH] bugfix: invalid lat/lon values when dragging marker across wrapped boundry refs AREDN->ticket:221 Change-Id: Id60213e72428c86f51b17c9c137785e340bca3eb --- files/www/cgi-bin/setup | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/files/www/cgi-bin/setup b/files/www/cgi-bin/setup index ff098f09..cbfa67f3 100755 --- a/files/www/cgi-bin/setup +++ b/files/www/cgi-bin/setup @@ -224,14 +224,18 @@ if($parms{button_updatelocation}) { # validate values if($parms{latitude} =~ /^([-+]?\d{1,2}([.]\d+)?)$/ and $parms{longitude} =~ /^([-+]?\d{1,3}([.]\d+)?)$/) { - # delete/define file - unlink("/etc/latlon") if(-f "/etc/latlon"); - $rcgood=open(my $ll, ">", "/etc/latlon"); - push @errors, "Cannot open lat/lon file" unless $rcgood; - print $ll "$parms{latitude}\n"; - print $ll "$parms{longitude}\n"; - close($ll); - push @output, "Lat/lon updated.\n"; + if($parms{latitude} >= -90 and $parms{latitude} <= 90 and $parms{longitude} >= -180 and $parms{longitude} <= 180) { + # delete/define file + unlink("/etc/latlon") if(-f "/etc/latlon"); + $rcgood=open(my $ll, ">", "/etc/latlon"); + push @errors, "Cannot open lat/lon file" unless $rcgood; + print $ll "$parms{latitude}\n"; + print $ll "$parms{longitude}\n"; + close($ll); + push @output, "Lat/lon updated.\n"; + } else { + push @errors, "ERROR: Lat/lon values must be between -90/90 and -180/180, respectively.\n"; + } } else { push @errors, "ERROR: Lat/lon format is decimal: (ex. 30.121456 or -95.911154)\n"; } @@ -965,10 +969,10 @@ print <