@@ -9,18 +9,18 @@ |
||
| 9 | 9 | header('Content-disposition: attachment; filename="weather.json"'); |
| 10 | 10 | } |
| 11 | 11 | header('Content-Type: text/javascript'); |
| 12 | -$latitude = filter_input(INPUT_GET,'latitude',FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 13 | -$longitude = filter_input(INPUT_GET,'longitude',FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 12 | +$latitude = filter_input(INPUT_GET, 'latitude', FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 13 | +$longitude = filter_input(INPUT_GET, 'longitude', FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 14 | 14 | if ($latitude == '' || $longitude == '') return ''; |
| 15 | 15 | //echo 'latitude : '.$latitude.' - longitude : '.$longitude."\n"; |
| 16 | -$airports = $Spotter->closestAirports($latitude,$longitude,500); |
|
| 16 | +$airports = $Spotter->closestAirports($latitude, $longitude, 500); |
|
| 17 | 17 | //print_r($airports); |
| 18 | 18 | $METAR = new METAR(); |
| 19 | 19 | $Weather = new Weather(); |
| 20 | 20 | $i = 0; |
| 21 | 21 | $ew = true; |
| 22 | 22 | if (empty($airports)) return ''; |
| 23 | -while($ew) { |
|
| 23 | +while ($ew) { |
|
| 24 | 24 | $met = $METAR->getMETAR($airports[$i]['icao']); |
| 25 | 25 | //print_r($met); |
| 26 | 26 | if (!empty($met)) { |
@@ -11,7 +11,9 @@ discard block |
||
| 11 | 11 | header('Content-Type: text/javascript'); |
| 12 | 12 | $latitude = filter_input(INPUT_GET,'latitude',FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
| 13 | 13 | $longitude = filter_input(INPUT_GET,'longitude',FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
| 14 | -if ($latitude == '' || $longitude == '') return ''; |
|
| 14 | +if ($latitude == '' || $longitude == '') { |
|
| 15 | + return ''; |
|
| 16 | +} |
|
| 15 | 17 | //echo 'latitude : '.$latitude.' - longitude : '.$longitude."\n"; |
| 16 | 18 | $airports = $Spotter->closestAirports($latitude,$longitude,500); |
| 17 | 19 | //print_r($airports); |
@@ -19,7 +21,9 @@ discard block |
||
| 19 | 21 | $Weather = new Weather(); |
| 20 | 22 | $i = 0; |
| 21 | 23 | $ew = true; |
| 22 | -if (empty($airports)) return ''; |
|
| 24 | +if (empty($airports)) { |
|
| 25 | + return ''; |
|
| 26 | +} |
|
| 23 | 27 | while($ew) { |
| 24 | 28 | $met = $METAR->getMETAR($airports[$i]['icao']); |
| 25 | 29 | //print_r($met); |
@@ -39,7 +43,9 @@ discard block |
||
| 39 | 43 | } |
| 40 | 44 | } |
| 41 | 45 | $i++; |
| 42 | - if ($i >= count($airports)) $ew = false; |
|
| 43 | -} |
|
| 46 | + if ($i >= count($airports)) { |
|
| 47 | + $ew = false; |
|
| 48 | + } |
|
| 49 | + } |
|
| 44 | 50 | |
| 45 | 51 | ?> |
| 46 | 52 | \ No newline at end of file |