fix: Check lat/lng are numeric rather than !empty #5585 (#5657)

This commit is contained in:
Neil Lathwood
2017-01-31 08:07:27 +00:00
committed by GitHub
parent 94bdff3b86
commit 981e974a70
2 changed files with 2 additions and 2 deletions

View File

@@ -177,7 +177,7 @@ var greenMarker = L.AwesomeMarkers.icon({
$icon = 'greenMarker';
$z_offset = 0;
$tmp_loc = parse_location($map_devices['location']);
if (!empty($tmp_loc['lat']) && !empty($tmp_loc['lng'])) {
if (is_numeric($tmp_loc['lat']) && is_numeric($tmp_loc['lng'])) {
$map_devices['lat'] = $tmp_loc['lat'];
$map_devices['lng'] = $tmp_loc['lng'];
}

View File

@@ -1073,7 +1073,7 @@ function ceph_rrd($gtype)
function parse_location($location)
{
preg_match('/(\[)(-?[0-9\. ]+),[ ]*(-?[0-9\. ]+)(\])/', $location, $tmp_loc);
if (!empty($tmp_loc[2]) && !empty($tmp_loc[3])) {
if (is_numeric($tmp_loc[2]) && is_numeric($tmp_loc[3])) {
return array('lat' => $tmp_loc[2], 'lng' => $tmp_loc[3]);
}
}//end parse_location()