@@ -3,13 +3,13 @@ discard block |
||
3 | 3 | require_once('require/class.Spotter.php'); |
4 | 4 | require_once('require/class.Language.php'); |
5 | 5 | $Spotter = new Spotter(); |
6 | -$sort = filter_input(INPUT_GET,'sort',FILTER_SANITIZE_STRING); |
|
7 | -if (isset($_GET['date'])) $spotter_array = $Spotter->getSpotterDataByDate($_GET['date'],"0,1", $sort); |
|
6 | +$sort = filter_input(INPUT_GET, 'sort', FILTER_SANITIZE_STRING); |
|
7 | +if (isset($_GET['date'])) $spotter_array = $Spotter->getSpotterDataByDate($_GET['date'], "0,1", $sort); |
|
8 | 8 | else $spotter_array = array(); |
9 | 9 | |
10 | 10 | if (!empty($spotter_array)) |
11 | 11 | { |
12 | - $title = sprintf(_("Most Common Aircraft on %s"),date("l F j, Y", strtotime($spotter_array[0]['date_iso_8601']))); |
|
12 | + $title = sprintf(_("Most Common Aircraft on %s"), date("l F j, Y", strtotime($spotter_array[0]['date_iso_8601']))); |
|
13 | 13 | require_once('header.php'); |
14 | 14 | print '<div class="select-item">'; |
15 | 15 | print '<form action="'.$globalURL.'/date" method="post">'; |
@@ -20,13 +20,13 @@ discard block |
||
20 | 20 | print '</div>'; |
21 | 21 | |
22 | 22 | print '<div class="info column">'; |
23 | - print '<h1>'.sprintf(_("Flights from %s"),date("l F j, Y", strtotime($spotter_array[0]['date_iso_8601']))).'</h1>'; |
|
23 | + print '<h1>'.sprintf(_("Flights from %s"), date("l F j, Y", strtotime($spotter_array[0]['date_iso_8601']))).'</h1>'; |
|
24 | 24 | print '</div>'; |
25 | 25 | |
26 | 26 | include('date-sub-menu.php'); |
27 | 27 | print '<div class="column">'; |
28 | 28 | print '<h2>'._("Most Common Aircraft").'</h2>'; |
29 | - print '<p>'.sprintf(_("The statistic below shows the most common aircrafts of flights on <strong>%s</strong>."),date("l F j, Y", strtotime($spotter_array[0]['date_iso_8601']))).'</p>'; |
|
29 | + print '<p>'.sprintf(_("The statistic below shows the most common aircrafts of flights on <strong>%s</strong>."), date("l F j, Y", strtotime($spotter_array[0]['date_iso_8601']))).'</p>'; |
|
30 | 30 | |
31 | 31 | $aircraft_array = $Spotter->countAllAircraftTypesByDate($_GET['date']); |
32 | 32 | if (!empty($aircraft_array)) |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | print '</thead>'; |
42 | 42 | print '<tbody>'; |
43 | 43 | $i = 1; |
44 | - foreach($aircraft_array as $aircraft_item) |
|
44 | + foreach ($aircraft_array as $aircraft_item) |
|
45 | 45 | { |
46 | 46 | print '<tr>'; |
47 | 47 | print '<td><strong>'.$i.'</strong></td>'; |
@@ -163,7 +163,7 @@ discard block |
||
163 | 163 | <script src="<?php print $globalURL; ?>/js/Marker.Rotate.js"></script> |
164 | 164 | <script src="<?php print $globalURL; ?>/js/MovingMarker.js"></script> |
165 | 165 | <script src="<?php print $globalURL; ?>/js/jquery.idle.min.js"></script> |
166 | -<script src="<?php print $globalURL; ?>/js/map.js.php?ident=<?php print $ident; ?><?php if(isset($latitude)) print '&latitude='.$latitude; ?><?php if(isset($longitude)) print '&longitude='.$longitude; ?>&<?php print time(); ?>"></script> |
|
166 | +<script src="<?php print $globalURL; ?>/js/map.js.php?ident=<?php print $ident; ?><?php if (isset($latitude)) print '&latitude='.$latitude; ?><?php if (isset($longitude)) print '&longitude='.$longitude; ?>&<?php print time(); ?>"></script> |
|
167 | 167 | <?php |
168 | 168 | } |
169 | 169 | |
@@ -179,7 +179,7 @@ discard block |
||
179 | 179 | <script src="<?php print $globalURL; ?>/js/Marker.Rotate.js"></script> |
180 | 180 | <script src="<?php print $globalURL; ?>/js/MovingMarker.js"></script> |
181 | 181 | <script src="<?php print $globalURL; ?>/js/jquery.idle.min.js"></script> |
182 | -<script src="<?php print $globalURL; ?>/js/map.js.php?flightaware_id=<?php print $flightaware_id; ?><?php if(isset($latitude)) print '&latitude='.$latitude; ?><?php if(isset($longitude)) print '&longitude='.$longitude; ?>&<?php print time(); ?>"></script> |
|
182 | +<script src="<?php print $globalURL; ?>/js/map.js.php?flightaware_id=<?php print $flightaware_id; ?><?php if (isset($latitude)) print '&latitude='.$latitude; ?><?php if (isset($longitude)) print '&longitude='.$longitude; ?>&<?php print time(); ?>"></script> |
|
183 | 183 | <?php |
184 | 184 | } |
185 | 185 | ?> |
@@ -303,7 +303,7 @@ discard block |
||
303 | 303 | ?> |
304 | 304 | <div class="search"> |
305 | 305 | <form action="<?php print $globalURL; ?>/search" method="get"> |
306 | - <input type="text" name="q" value="<?php if (isset($GET['q'])) { if ($_GET['q'] != ""){ print $_GET['q']; } else { print _("Search"); } } else { print _("Search"); } ?>" onfocus="if (this.value=='search'){this.value='';}" /><button type="submit"><i class="fa fa-search"></i></button> |
|
306 | + <input type="text" name="q" value="<?php if (isset($GET['q'])) { if ($_GET['q'] != "") { print $_GET['q']; } else { print _("Search"); } } else { print _("Search"); } ?>" onfocus="if (this.value=='search'){this.value='';}" /><button type="submit"><i class="fa fa-search"></i></button> |
|
307 | 307 | </form> |
308 | 308 | </div> |
309 | 309 | <div class="social"> |
@@ -321,14 +321,14 @@ discard block |
||
321 | 321 | print '</div>'; |
322 | 322 | } |
323 | 323 | |
324 | -if (strtolower($current_page) =='ident-detailed' || strtolower($current_page) == 'flightid-overview') { |
|
324 | +if (strtolower($current_page) == 'ident-detailed' || strtolower($current_page) == 'flightid-overview') { |
|
325 | 325 | ?> |
326 | 326 | <div class="top-header clear" role="main"> |
327 | 327 | <div id="archive-map"></div> |
328 | 328 | </div> |
329 | 329 | <?php |
330 | 330 | } |
331 | -if ((strpos(strtolower($current_page),'airport-') !== false && strpos(strtolower($current_page),'statistics-') === false) || (strpos(strtolower($current_page),'route-') !== false && strpos(strtolower($current_page),'statistics-') === false)) |
|
331 | +if ((strpos(strtolower($current_page), 'airport-') !== false && strpos(strtolower($current_page), 'statistics-') === false) || (strpos(strtolower($current_page), 'route-') !== false && strpos(strtolower($current_page), 'statistics-') === false)) |
|
332 | 332 | { |
333 | 333 | ?> |
334 | 334 | <div class="top-header clear" role="main"> |
@@ -341,15 +341,15 @@ discard block |
||
341 | 341 | var zoom = 13; |
342 | 342 | //create the map |
343 | 343 | <?php |
344 | - if (strpos(strtolower($current_page),'airport-') !== false && strpos(strtolower($current_page),'statistics-') === false && isset($airport_array[0]['latitude'])) { |
|
344 | + if (strpos(strtolower($current_page), 'airport-') !== false && strpos(strtolower($current_page), 'statistics-') === false && isset($airport_array[0]['latitude'])) { |
|
345 | 345 | ?> |
346 | 346 | map = L.map('map', { zoomControl:true }).setView([<?php print $airport_array[0]['latitude']; ?>,<?php print $airport_array[0]['longitude']; ?>], zoom); |
347 | 347 | <?php |
348 | - } elseif (strpos(strtolower($current_page),'airport-') !== false && strpos(strtolower($current_page),'statistics-') === false) { |
|
348 | + } elseif (strpos(strtolower($current_page), 'airport-') !== false && strpos(strtolower($current_page), 'statistics-') === false) { |
|
349 | 349 | ?> |
350 | 350 | map = L.map('map', { zoomControl:true }); |
351 | 351 | <?php |
352 | - } elseif (strpos(strtolower($current_page),'route-') !== false && strpos(strtolower($current_page),'statistics-') === false && isset($spotter_array[0]['departure_airport_latitude'])) { |
|
352 | + } elseif (strpos(strtolower($current_page), 'route-') !== false && strpos(strtolower($current_page), 'statistics-') === false && isset($spotter_array[0]['departure_airport_latitude'])) { |
|
353 | 353 | ?> |
354 | 354 | map = L.map('map', { zoomControl:true }).setView([<?php print $spotter_array[0]['departure_airport_latitude']; ?>,<?php print $spotter_array[0]['arrival_airport_longitude']; ?>]); |
355 | 355 | var line = L.polyline([[<?php print $spotter_array[0]['departure_airport_latitude']; ?>, <?php print $spotter_array[0]['departure_airport_longitude']; ?>],[<?php print $spotter_array[0]['arrival_airport_latitude']; ?>, <?php print $spotter_array[0]['arrival_airport_longitude']; ?>]]).addTo(map); |
@@ -357,7 +357,7 @@ discard block |
||
357 | 357 | var departure_airport = L.marker([<?php print $spotter_array[0]['departure_airport_latitude']; ?>, <?php print $spotter_array[0]['departure_airport_longitude']; ?>], {icon: L.icon({iconUrl: '<?php print $globalURL; ?>/images/departure_airport.png',iconSize: [16,18],iconAnchor: [8,16]})}).addTo(map); |
358 | 358 | var arrival_airport = L.marker([<?php print $spotter_array[0]['arrival_airport_latitude']; ?>, <?php print $spotter_array[0]['arrival_airport_longitude']; ?>], {icon: L.icon({iconUrl: '<?php print $globalURL; ?>/images/arrival_airport.png',iconSize: [16,18],iconAnchor: [8,16]})}).addTo(map); |
359 | 359 | <?php |
360 | - } elseif (strpos(strtolower($current_page),'route-') !== false && strpos(strtolower($current_page),'statistics-') === false && !isset($spotter_array[0]['departure_airport_latitude'])) { |
|
360 | + } elseif (strpos(strtolower($current_page), 'route-') !== false && strpos(strtolower($current_page), 'statistics-') === false && !isset($spotter_array[0]['departure_airport_latitude'])) { |
|
361 | 361 | ?> |
362 | 362 | map = L.map('map', { zoomControl:true }).setView([<?php print $spotter_array[0]['latitude']; ?>,<?php print $spotter_array[0]['longitude']; ?>]); |
363 | 363 | <?php |
@@ -5,14 +5,14 @@ discard block |
||
5 | 5 | $Spotter = new Spotter(); |
6 | 6 | if (isset($_GET['start_date'])) { |
7 | 7 | //for the date manipulation into the query |
8 | - if($_GET['start_date'] != "" && $_GET['end_date'] != ""){ |
|
8 | + if ($_GET['start_date'] != "" && $_GET['end_date'] != "") { |
|
9 | 9 | $start_date = $_GET['start_date'].":00"; |
10 | 10 | $end_date = $_GET['end_date'].":00"; |
11 | 11 | $sql_date = $start_date.",".$end_date; |
12 | - } else if($_GET['start_date'] != ""){ |
|
12 | + } else if ($_GET['start_date'] != "") { |
|
13 | 13 | $start_date = $_GET['start_date'].":00"; |
14 | 14 | $sql_date = $start_date; |
15 | - } else if($_GET['start_date'] == "" && $_GET['end_date'] != ""){ |
|
15 | + } else if ($_GET['start_date'] == "" && $_GET['end_date'] != "") { |
|
16 | 16 | $end_date = date("Y-m-d H:i:s", strtotime("2014-04-12")).",".$_GET['end_date'].":00"; |
17 | 17 | $sql_date = $end_date; |
18 | 18 | } else $sql_date = ''; |
@@ -20,21 +20,21 @@ discard block |
||
20 | 20 | |
21 | 21 | if (isset($_GET['highest_altitude'])) { |
22 | 22 | //for altitude manipulation |
23 | - if($_GET['highest_altitude'] != "" && $_GET['lowest_altitude'] != ""){ |
|
23 | + if ($_GET['highest_altitude'] != "" && $_GET['lowest_altitude'] != "") { |
|
24 | 24 | $end_altitude = $_GET['highest_altitude']; |
25 | 25 | $start_altitude = $_GET['lowest_altitude']; |
26 | 26 | $sql_altitude = $start_altitude.",".$end_altitude; |
27 | - } else if($_GET['highest_altitude'] != ""){ |
|
27 | + } else if ($_GET['highest_altitude'] != "") { |
|
28 | 28 | $end_altitude = $_GET['highest_altitude']; |
29 | 29 | $sql_altitude = $end_altitude; |
30 | - } else if($_GET['highest_altitude'] == "" && $_GET['lowest_altitude'] != ""){ |
|
30 | + } else if ($_GET['highest_altitude'] == "" && $_GET['lowest_altitude'] != "") { |
|
31 | 31 | $start_altitude = $_GET['lowest_altitude'].",60000"; |
32 | 32 | $sql_altitude = $start_altitude; |
33 | 33 | } else $sql_altitude = ''; |
34 | 34 | } else $sql_altitude = ''; |
35 | 35 | |
36 | 36 | //calculuation for the pagination |
37 | -if(!isset($_GET['limit'])) |
|
37 | +if (!isset($_GET['limit'])) |
|
38 | 38 | { |
39 | 39 | if (!isset($_GET['number_results'])) |
40 | 40 | { |
@@ -42,14 +42,14 @@ discard block |
||
42 | 42 | $limit_end = 25; |
43 | 43 | $absolute_difference = 25; |
44 | 44 | } else { |
45 | - if ($_GET['number_results'] > 1000){ |
|
45 | + if ($_GET['number_results'] > 1000) { |
|
46 | 46 | $_GET['number_results'] = 1000; |
47 | 47 | } |
48 | 48 | $limit_start = 0; |
49 | 49 | $limit_end = $_GET['number_results']; |
50 | 50 | $absolute_difference = $_GET['number_results']; |
51 | 51 | } |
52 | -} else { |
|
52 | +} else { |
|
53 | 53 | $limit_explode = explode(",", $_GET['limit']); |
54 | 54 | $limit_start = $limit_explode[0]; |
55 | 55 | $limit_end = $limit_explode[1]; |
@@ -69,30 +69,30 @@ discard block |
||
69 | 69 | |
70 | 70 | if (isset($_GET['sort'])) $sort = $_GET['sort']; |
71 | 71 | else $sort = ''; |
72 | -$q = filter_input(INPUT_GET,'q',FILTER_SANITIZE_STRING); |
|
73 | -$registration = filter_input(INPUT_GET,'registratrion',FILTER_SANITIZE_STRING); |
|
74 | -$aircraft = filter_input(INPUT_GET,'aircraft',FILTER_SANITIZE_STRING); |
|
75 | -$manufacturer = filter_input(INPUT_GET,'manufacturer',FILTER_SANITIZE_STRING); |
|
76 | -$highlights = filter_input(INPUT_GET,'highlights',FILTER_SANITIZE_STRING); |
|
77 | -$airline = filter_input(INPUT_GET,'airline',FILTER_SANITIZE_STRING); |
|
78 | -$airline_country = filter_input(INPUT_GET,'airline_country',FILTER_SANITIZE_STRING); |
|
79 | -$airline_type = filter_input(INPUT_GET,'airline_type',FILTER_SANITIZE_STRING); |
|
80 | -$airport = filter_input(INPUT_GET,'airport',FILTER_SANITIZE_STRING); |
|
81 | -$airport_country = filter_input(INPUT_GET,'airport_country',FILTER_SANITIZE_STRING); |
|
82 | -$callsign = filter_input(INPUT_GET,'callsign',FILTER_SANITIZE_STRING); |
|
83 | -$owner = filter_input(INPUT_GET,'owner',FILTER_SANITIZE_STRING); |
|
84 | -$pilot_id = filter_input(INPUT_GET,'pilot_id',FILTER_SANITIZE_STRING); |
|
85 | -$pilot_name = filter_input(INPUT_GET,'pilot_name',FILTER_SANITIZE_STRING); |
|
86 | -$departure_airport_route = filter_input(INPUT_GET,'departure_airport_route',FILTER_SANITIZE_STRING); |
|
87 | -$arrival_airport_route = filter_input(INPUT_GET,'arrival_airport_route',FILTER_SANITIZE_STRING); |
|
88 | -$spotter_array = $Spotter->searchSpotterData($q,$registration,$aircraft,strtolower(str_replace("-", " ", $manufacturer)),$highlights,$airline,$airline_country,$airline_type,$airport,$airport_country,$callsign,$departure_airport_route,$arrival_airport_route,$owner,$pilot_id,$pilot_name,$sql_altitude,$sql_date,$limit_start.",".$absolute_difference,$sort,''); |
|
72 | +$q = filter_input(INPUT_GET, 'q', FILTER_SANITIZE_STRING); |
|
73 | +$registration = filter_input(INPUT_GET, 'registratrion', FILTER_SANITIZE_STRING); |
|
74 | +$aircraft = filter_input(INPUT_GET, 'aircraft', FILTER_SANITIZE_STRING); |
|
75 | +$manufacturer = filter_input(INPUT_GET, 'manufacturer', FILTER_SANITIZE_STRING); |
|
76 | +$highlights = filter_input(INPUT_GET, 'highlights', FILTER_SANITIZE_STRING); |
|
77 | +$airline = filter_input(INPUT_GET, 'airline', FILTER_SANITIZE_STRING); |
|
78 | +$airline_country = filter_input(INPUT_GET, 'airline_country', FILTER_SANITIZE_STRING); |
|
79 | +$airline_type = filter_input(INPUT_GET, 'airline_type', FILTER_SANITIZE_STRING); |
|
80 | +$airport = filter_input(INPUT_GET, 'airport', FILTER_SANITIZE_STRING); |
|
81 | +$airport_country = filter_input(INPUT_GET, 'airport_country', FILTER_SANITIZE_STRING); |
|
82 | +$callsign = filter_input(INPUT_GET, 'callsign', FILTER_SANITIZE_STRING); |
|
83 | +$owner = filter_input(INPUT_GET, 'owner', FILTER_SANITIZE_STRING); |
|
84 | +$pilot_id = filter_input(INPUT_GET, 'pilot_id', FILTER_SANITIZE_STRING); |
|
85 | +$pilot_name = filter_input(INPUT_GET, 'pilot_name', FILTER_SANITIZE_STRING); |
|
86 | +$departure_airport_route = filter_input(INPUT_GET, 'departure_airport_route', FILTER_SANITIZE_STRING); |
|
87 | +$arrival_airport_route = filter_input(INPUT_GET, 'arrival_airport_route', FILTER_SANITIZE_STRING); |
|
88 | +$spotter_array = $Spotter->searchSpotterData($q, $registration, $aircraft, strtolower(str_replace("-", " ", $manufacturer)), $highlights, $airline, $airline_country, $airline_type, $airport, $airport_country, $callsign, $departure_airport_route, $arrival_airport_route, $owner, $pilot_id, $pilot_name, $sql_altitude, $sql_date, $limit_start.",".$absolute_difference, $sort, ''); |
|
89 | 89 | |
90 | 90 | $i = 1; |
91 | 91 | //$output .= "oid;Line\n"; |
92 | 92 | $output = ''; |
93 | 93 | if (!empty($spotter_array)) |
94 | 94 | { |
95 | - foreach($spotter_array as $spotter_item) |
|
95 | + foreach ($spotter_array as $spotter_item) |
|
96 | 96 | { |
97 | 97 | if ($spotter_item['waypoints'] != '') { |
98 | 98 | $waypoint_pieces = explode(' ', $spotter_item['waypoints']); |
@@ -6,14 +6,14 @@ discard block |
||
6 | 6 | header('Location: '.$globalURL.'/airport'); |
7 | 7 | die(); |
8 | 8 | } |
9 | -$airport = filter_input(INPUT_GET,'airport',FILTER_SANITIZE_STRING); |
|
9 | +$airport = filter_input(INPUT_GET, 'airport', FILTER_SANITIZE_STRING); |
|
10 | 10 | $Spotter = new Spotter(); |
11 | -$spotter_array = $Spotter->getSpotterDataByAirport($airport,"0,1",""); |
|
11 | +$spotter_array = $Spotter->getSpotterDataByAirport($airport, "0,1", ""); |
|
12 | 12 | $airport_array = $Spotter->getAllAirportInfo($airport); |
13 | 13 | |
14 | 14 | if (!empty($airport_array)) |
15 | 15 | { |
16 | - $title = sprintf(_("Most Common Routes to/from %s, %s (%s)"),$airport_array[0]['city'],$airport_array[0]['name'],$airport_array[0]['icao']); |
|
16 | + $title = sprintf(_("Most Common Routes to/from %s, %s (%s)"), $airport_array[0]['city'], $airport_array[0]['name'], $airport_array[0]['icao']); |
|
17 | 17 | |
18 | 18 | require_once('header.php'); |
19 | 19 | print '<div class="select-item">'; |
@@ -22,9 +22,9 @@ discard block |
||
22 | 22 | print '<option></option>'; |
23 | 23 | $airport_names = $Spotter->getAllAirportNames(); |
24 | 24 | ksort($airport_names); |
25 | - foreach($airport_names as $airport_name) |
|
25 | + foreach ($airport_names as $airport_name) |
|
26 | 26 | { |
27 | - if($airport == $airport_name['airport_icao']) |
|
27 | + if ($airport == $airport_name['airport_icao']) |
|
28 | 28 | { |
29 | 29 | print '<option value="'.$airport_name['airport_icao'].'" selected="selected">'.$airport_name['airport_city'].', '.$airport_name['airport_name'].', '.$airport_name['airport_country'].' ('.$airport_name['airport_icao'].')</option>'; |
30 | 30 | } else { |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | print '<div><span class="label">'._("ICAO").'</span>'.$airport_array[0]['icao'].'</div>'; |
47 | 47 | print '<div><span class="label">'._("IATA").'</span>'.$airport_array[0]['iata'].'</div>'; |
48 | 48 | print '<div><span class="label">'._("Altitude").'</span>'.$airport_array[0]['altitude'].'</div>'; |
49 | - print '<div><span class="label">'._("Coordinates");'</span><a href="http://maps.google.ca/maps?z=10&t=k&q='.$airport_array[0]['latitude'].','.$airport_array[0]['longitude'].'" target="_blank">Google Map<i class="fa fa-angle-double-right"></i></a></div>'; |
|
49 | + print '<div><span class="label">'._("Coordinates"); '</span><a href="http://maps.google.ca/maps?z=10&t=k&q='.$airport_array[0]['latitude'].','.$airport_array[0]['longitude'].'" target="_blank">Google Map<i class="fa fa-angle-double-right"></i></a></div>'; |
|
50 | 50 | print '</div>'; |
51 | 51 | } else { |
52 | 52 | print '<div class="alert alert-warning">'._("This special airport profile shows all flights that do <u>not</u> have a departure and/or arrival airport associated with them.").'</div>'; |
@@ -54,8 +54,8 @@ discard block |
||
54 | 54 | |
55 | 55 | include('airport-sub-menu.php'); |
56 | 56 | print '<div class="column">'; |
57 | - print '<h2>'._("Most Common Routes");'</h2>'; |
|
58 | - print '<p>'.sprintf(_("The statistic below shows the most common routes to/from <strong>%s, %s (%s)</strong>."),$airport_array[0]['city'],$airport_array[0]['name'],$airport_array[0]['icao']).'</p>'; |
|
57 | + print '<h2>'._("Most Common Routes"); '</h2>'; |
|
58 | + print '<p>'.sprintf(_("The statistic below shows the most common routes to/from <strong>%s, %s (%s)</strong>."), $airport_array[0]['city'], $airport_array[0]['name'], $airport_array[0]['icao']).'</p>'; |
|
59 | 59 | |
60 | 60 | $route_array = $Spotter->countAllRoutesByAirport($airport); |
61 | 61 | if (!empty($route_array)) |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | print '</thead>'; |
72 | 72 | print '<tbody>'; |
73 | 73 | $i = 1; |
74 | - foreach($route_array as $route_item) |
|
74 | + foreach ($route_array as $route_item) |
|
75 | 75 | { |
76 | 76 | print '<tr>'; |
77 | 77 | print '<td><strong>'.$i.'</strong></td>'; |
@@ -7,13 +7,13 @@ discard block |
||
7 | 7 | die(); |
8 | 8 | } |
9 | 9 | $Spotter = new Spotter(); |
10 | -$manufacturer = ucwords(str_replace("-", " ", filter_input(INPUT_GET,'aircraft_manufacturer',FILTER_SANITIZE_STRING))); |
|
11 | -$sort = filter_input(INPUT_GET,'sort',FILTER_SANITIZE_STRING); |
|
12 | -$spotter_array = $Spotter->getSpotterDataByManufacturer($manufacturer,"0,1", $sort); |
|
10 | +$manufacturer = ucwords(str_replace("-", " ", filter_input(INPUT_GET, 'aircraft_manufacturer', FILTER_SANITIZE_STRING))); |
|
11 | +$sort = filter_input(INPUT_GET, 'sort', FILTER_SANITIZE_STRING); |
|
12 | +$spotter_array = $Spotter->getSpotterDataByManufacturer($manufacturer, "0,1", $sort); |
|
13 | 13 | |
14 | 14 | if (!empty($spotter_array)) |
15 | 15 | { |
16 | - $title = sprintf(_("Most Common Departure Airports from %s"),$manufacturer); |
|
16 | + $title = sprintf(_("Most Common Departure Airports from %s"), $manufacturer); |
|
17 | 17 | |
18 | 18 | require_once('header.php'); |
19 | 19 | print '<div class="select-item">'; |
@@ -21,9 +21,9 @@ discard block |
||
21 | 21 | print '<select name="aircraft_manufacturer" class="selectpicker" data-live-search="true">'; |
22 | 22 | print '<option></option>'; |
23 | 23 | $all_manufacturers = $Spotter->getAllManufacturers(); |
24 | - foreach($all_manufacturers as $all_manufacturer) |
|
24 | + foreach ($all_manufacturers as $all_manufacturer) |
|
25 | 25 | { |
26 | - if($_GET['aircraft_manufacturer'] == strtolower(str_replace(" ", "-", $all_manufacturer['aircraft_manufacturer']))) |
|
26 | + if ($_GET['aircraft_manufacturer'] == strtolower(str_replace(" ", "-", $all_manufacturer['aircraft_manufacturer']))) |
|
27 | 27 | { |
28 | 28 | print '<option value="'.strtolower(str_replace(" ", "-", $all_manufacturer['aircraft_manufacturer'])).'" selected="selected">'.$all_manufacturer['aircraft_manufacturer'].'</option>'; |
29 | 29 | } else { |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | include('manufacturer-sub-menu.php'); |
43 | 43 | print '<div class="column">'; |
44 | 44 | print '<h2>'._("Most Common Departure Airports").'</h2>'; |
45 | - print '<p>'.sprintf(_("The statistic below shows all departure airports of flights from <strong>%s</strong>."),$manufacturer).'</p>'; |
|
45 | + print '<p>'.sprintf(_("The statistic below shows all departure airports of flights from <strong>%s</strong>."), $manufacturer).'</p>'; |
|
46 | 46 | $airport_airport_array = $Spotter->countAllDepartureAirportsByManufacturer($manufacturer); |
47 | 47 | print '<script type="text/javascript" src="https://www.google.com/jsapi"></script> |
48 | 48 | <script> |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | ["'._("Airport").'", "'._("# of times").'"],'; |
58 | 58 | |
59 | 59 | $airport_data = ''; |
60 | - foreach($airport_airport_array as $airport_item) |
|
60 | + foreach ($airport_airport_array as $airport_item) |
|
61 | 61 | { |
62 | 62 | $name = $airport_item['airport_departure_city'].', '.$airport_item['airport_departure_country'].' ('.$airport_item['airport_departure_icao'].')'; |
63 | 63 | $name = str_replace("'", "", $name); |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | print '</thead>'; |
97 | 97 | print '<tbody>'; |
98 | 98 | $i = 1; |
99 | - foreach($airport_airport_array as $airport_item) |
|
99 | + foreach ($airport_airport_array as $airport_item) |
|
100 | 100 | { |
101 | 101 | print '<tr>'; |
102 | 102 | print '<td><strong>'.$i.'</strong></td>'; |
@@ -718,20 +718,20 @@ discard block |
||
718 | 718 | try { |
719 | 719 | $sth = $this->db->prepare($query); |
720 | 720 | $sth->execute($query_values); |
721 | - } catch(PDOException $e) { |
|
721 | + } catch (PDOException $e) { |
|
722 | 722 | return "error : ".$e->getMessage(); |
723 | 723 | } |
724 | 724 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
725 | 725 | return $all; |
726 | 726 | } |
727 | 727 | |
728 | - public function addNOTAM($ref,$title,$type,$fir,$code,$rules,$scope,$lower_limit,$upper_limit,$center_latitude,$center_longitude,$radius,$date_begin,$date_end,$permanent,$text,$full_notam) { |
|
728 | + public function addNOTAM($ref, $title, $type, $fir, $code, $rules, $scope, $lower_limit, $upper_limit, $center_latitude, $center_longitude, $radius, $date_begin, $date_end, $permanent, $text, $full_notam) { |
|
729 | 729 | $query = "INSERT INTO notam (ref,title,notam_type,fir,code,rules,scope,lower_limit,upper_limit,center_latitude,center_longitude,radius,date_begin,date_end,permanent,notam_text,full_notam) VALUES (:ref,:title,:type,:fir,:code,:rules,:scope,:lower_limit,:upper_limit,:center_latitude,:center_longitude,:radius,:date_begin,:date_end,:permanent,:text,:full_notam)"; |
730 | - $query_values = array(':ref' => $ref,':title' => $title,':type' => $type,':fir' => $fir,':code' => $code,':rules' => $rules,':scope' => $scope,':lower_limit' => $lower_limit,':upper_limit' => $upper_limit,':center_latitude' => $center_latitude,':center_longitude' => $center_longitude,':radius' => $radius,':date_begin' => $date_begin,':date_end' => $date_end,':permanent' => $permanent,':text' => $text,':full_notam' => $full_notam); |
|
730 | + $query_values = array(':ref' => $ref, ':title' => $title, ':type' => $type, ':fir' => $fir, ':code' => $code, ':rules' => $rules, ':scope' => $scope, ':lower_limit' => $lower_limit, ':upper_limit' => $upper_limit, ':center_latitude' => $center_latitude, ':center_longitude' => $center_longitude, ':radius' => $radius, ':date_begin' => $date_begin, ':date_end' => $date_end, ':permanent' => $permanent, ':text' => $text, ':full_notam' => $full_notam); |
|
731 | 731 | try { |
732 | 732 | $sth = $this->db->prepare($query); |
733 | 733 | $sth->execute($query_values); |
734 | - } catch(PDOException $e) { |
|
734 | + } catch (PDOException $e) { |
|
735 | 735 | return "error : ".$e->getMessage(); |
736 | 736 | } |
737 | 737 | } |
@@ -742,7 +742,7 @@ discard block |
||
742 | 742 | try { |
743 | 743 | $sth = $this->db->prepare($query); |
744 | 744 | $sth->execute($query_values); |
745 | - } catch(PDOException $e) { |
|
745 | + } catch (PDOException $e) { |
|
746 | 746 | return "error : ".$e->getMessage(); |
747 | 747 | } |
748 | 748 | } |
@@ -751,7 +751,7 @@ discard block |
||
751 | 751 | try { |
752 | 752 | $sth = $this->db->prepare($query); |
753 | 753 | $sth->execute(); |
754 | - } catch(PDOException $e) { |
|
754 | + } catch (PDOException $e) { |
|
755 | 755 | return "error : ".$e->getMessage(); |
756 | 756 | } |
757 | 757 | } |
@@ -762,7 +762,7 @@ discard block |
||
762 | 762 | foreach ($globalNOTAMAirports as $airport) { |
763 | 763 | $data = $this->downloadNOTAM($airport); |
764 | 764 | if (count($data) > 0) { |
765 | - $this->addNOTAM($data['ref'],$data['title'],'',$data['fir'],$data['code'],'',$data['scope'],$data['lower_limit'],$data['upper_limit'],$data['latitude'],$data['longitude'],$data['radius'],$data['date_begin'],$data['date_end'],$data['permanent'],$data['text'],$data['full_notam']); |
|
765 | + $this->addNOTAM($data['ref'], $data['title'], '', $data['fir'], $data['code'], '', $data['scope'], $data['lower_limit'], $data['upper_limit'], $data['latitude'], $data['longitude'], $data['radius'], $data['date_begin'], $data['date_end'], $data['permanent'], $data['text'], $data['full_notam']); |
|
766 | 766 | } |
767 | 767 | } |
768 | 768 | } |
@@ -772,7 +772,7 @@ discard block |
||
772 | 772 | date_default_timezone_set("UTC"); |
773 | 773 | $Common = new Common(); |
774 | 774 | //$url = str_replace('{icao}',$icao,'https://pilotweb.nas.faa.gov/PilotWeb/notamRetrievalByICAOAction.do?method=displayByICAOs&reportType=RAW&formatType=DOMESTIC&retrieveLocId={icao}&actionType=notamRetrievalByICAOs'); |
775 | - $url = str_replace('{icao}',$icao,'https://pilotweb.nas.faa.gov/PilotWeb/notamRetrievalByICAOAction.do?method=displayByICAOs&reportType=RAW&formatType=ICAO&retrieveLocId={icao}&actionType=notamRetrievalByICAOs'); |
|
775 | + $url = str_replace('{icao}', $icao, 'https://pilotweb.nas.faa.gov/PilotWeb/notamRetrievalByICAOAction.do?method=displayByICAOs&reportType=RAW&formatType=ICAO&retrieveLocId={icao}&actionType=notamRetrievalByICAOs'); |
|
776 | 776 | $data = $Common->getData($url); |
777 | 777 | preg_match_all("/<pre>(.+?)<\/pre>/is", $data, $matches); |
778 | 778 | if (isset($matches[1])) return $matches[1]; |
@@ -783,14 +783,14 @@ discard block |
||
783 | 783 | $Common = new Common(); |
784 | 784 | $result = array(); |
785 | 785 | $result['full_notam'] = $data; |
786 | - $data = str_ireplace(array("\r","\n",'\r','\n'),' ',$data); |
|
787 | - $data = preg_split('#(?=([A-Z]\)\s))#',$data); |
|
786 | + $data = str_ireplace(array("\r", "\n", '\r', '\n'), ' ', $data); |
|
787 | + $data = preg_split('#(?=([A-Z]\)\s))#', $data); |
|
788 | 788 | //print_r($data); |
789 | 789 | foreach ($data as $line) { |
790 | 790 | $line = trim($line); |
791 | - if (preg_match('#Q\) (.*)#',$line,$matches)) { |
|
792 | - $line = str_replace(' ','',$line); |
|
793 | - if (preg_match('#Q\)([A-Z]{4})\/([A-Z]{5})\/(IV|I|V)\/([A-Z]{1,3})\/([A-Z]{1,2})\/([0-9]{3})\/([0-9]{3})\/([0-9]{4})(N|S)([0-9]{5})(E|W)([0-9]{3})#',$line,$matches)) { |
|
791 | + if (preg_match('#Q\) (.*)#', $line, $matches)) { |
|
792 | + $line = str_replace(' ', '', $line); |
|
793 | + if (preg_match('#Q\)([A-Z]{4})\/([A-Z]{5})\/(IV|I|V)\/([A-Z]{1,3})\/([A-Z]{1,2})\/([0-9]{3})\/([0-9]{3})\/([0-9]{4})(N|S)([0-9]{5})(E|W)([0-9]{3})#', $line, $matches)) { |
|
794 | 794 | //print_r($matches); |
795 | 795 | $result['fir'] = $matches[1]; |
796 | 796 | $result['code'] = $matches[2]; |
@@ -834,42 +834,42 @@ discard block |
||
834 | 834 | elseif ($matches[5] == 'AW') $result['scope'] = 'Airport/Navigation warning'; |
835 | 835 | $result['lower_limit'] = $matches[6]; |
836 | 836 | $result['upper_limit'] = $matches[7]; |
837 | - $latitude = $Common->convertDec($matches[8],'latitude'); |
|
837 | + $latitude = $Common->convertDec($matches[8], 'latitude'); |
|
838 | 838 | if ($matches[9] == 'S') $latitude = -$latitude; |
839 | - $longitude = $Common->convertDec($matches[10],'longitude'); |
|
839 | + $longitude = $Common->convertDec($matches[10], 'longitude'); |
|
840 | 840 | if ($matches[11] == 'W') $longitude = -$longitude; |
841 | 841 | $result['latitude'] = $latitude; |
842 | 842 | $result['longitude'] = $longitude; |
843 | 843 | $result['radius'] = intval($matches[12]); |
844 | 844 | } else echo 'ERROR : '.$line."\n"; |
845 | 845 | } |
846 | - elseif (preg_match('#A\) (.*)#',$line,$matches)) { |
|
846 | + elseif (preg_match('#A\) (.*)#', $line, $matches)) { |
|
847 | 847 | $result['icao'] = $matches[1]; |
848 | 848 | } |
849 | - elseif (preg_match('#B\) ([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})#',$line,$matches)) { |
|
849 | + elseif (preg_match('#B\) ([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})#', $line, $matches)) { |
|
850 | 850 | $result['date_begin'] = $matches[1].'/'.$matches[2].'/'.$matches[3].' '.$matches[4].':'.$matches[5]; |
851 | 851 | } |
852 | - elseif (preg_match('#C\) ([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})$#',$line,$matches)) { |
|
852 | + elseif (preg_match('#C\) ([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})$#', $line, $matches)) { |
|
853 | 853 | $result['date_finish'] = $matches[1].'/'.$matches[2].'/'.$matches[3].' '.$matches[4].':'.$matches[5]; |
854 | 854 | } |
855 | - elseif (preg_match('#C\) ([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2}) (EST|PERM)$#',$line,$matches)) { |
|
855 | + elseif (preg_match('#C\) ([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2}) (EST|PERM)$#', $line, $matches)) { |
|
856 | 856 | $result['date_finish'] = $matches[1].'/'.$matches[2].'/'.$matches[3].' '.$matches[4].':'.$matches[5]; |
857 | 857 | if ($matches[6] == 'EST') $result['estimated'] = true; |
858 | 858 | else $result['estimated'] = false; |
859 | 859 | if ($matches[6] == 'PERM') $result['permanent'] = true; |
860 | 860 | else $result['permanent'] = false; |
861 | 861 | } |
862 | - elseif (preg_match('#E\) (.*)#',$line,$matches)) { |
|
863 | - $text = explode(' ',$matches[1]); |
|
862 | + elseif (preg_match('#E\) (.*)#', $line, $matches)) { |
|
863 | + $text = explode(' ', $matches[1]); |
|
864 | 864 | foreach ($text as $word) { |
865 | 865 | if (isset($this->abbr[$word])) $rtext[] = strtoupper($this->abbr[$word]); |
866 | - elseif (ctype_digit(strval(substr($word,3))) && isset($this->abbr[substr($word,0,3)])) $rtext[] = strtoupper($this->abbr[substr($word,0,3)]).' '.substr($word,3); |
|
866 | + elseif (ctype_digit(strval(substr($word, 3))) && isset($this->abbr[substr($word, 0, 3)])) $rtext[] = strtoupper($this->abbr[substr($word, 0, 3)]).' '.substr($word, 3); |
|
867 | 867 | else $rtext[] = $word; |
868 | 868 | } |
869 | - $result['text'] = implode(' ',$rtext); |
|
870 | - } elseif (preg_match('#F\) (.*)#',$line,$matches)) { |
|
871 | - } elseif (preg_match('#G\) (.*)#',$line,$matches)) { |
|
872 | - } elseif (preg_match('#(NOTAMN|NOTAMR|NOTAMC)$#',$line,$matches)) { |
|
869 | + $result['text'] = implode(' ', $rtext); |
|
870 | + } elseif (preg_match('#F\) (.*)#', $line, $matches)) { |
|
871 | + } elseif (preg_match('#G\) (.*)#', $line, $matches)) { |
|
872 | + } elseif (preg_match('#(NOTAMN|NOTAMR|NOTAMC)$#', $line, $matches)) { |
|
873 | 873 | if ($matches[1] == 'NOTAMN') $result['type'] = 'new'; |
874 | 874 | if ($matches[1] == 'NOTAMC') $result['type'] = 'cancel'; |
875 | 875 | if ($matches[1] == 'NOTAMC') $result['type'] = 'replace'; |
@@ -31,12 +31,12 @@ discard block |
||
31 | 31 | } else return $ident; |
32 | 32 | } else return $ident; |
33 | 33 | if ($airline_icao == 'AF') { |
34 | - if (filter_var(substr($ident,2),FILTER_VALIDATE_INT,array("flags"=>FILTER_FLAG_ALLOW_OCTAL))) $icao = $ident; |
|
35 | - else $icao = 'AFR'.ltrim(substr($ident,2),'0'); |
|
34 | + if (filter_var(substr($ident, 2), FILTER_VALIDATE_INT, array("flags"=>FILTER_FLAG_ALLOW_OCTAL))) $icao = $ident; |
|
35 | + else $icao = 'AFR'.ltrim(substr($ident, 2), '0'); |
|
36 | 36 | } else { |
37 | 37 | $identicao = $Spotter->getAllAirlineInfo($airline_icao); |
38 | 38 | if (isset($identicao[0])) { |
39 | - $icao = $identicao[0]['icao'].ltrim(substr($ident,2),'0'); |
|
39 | + $icao = $identicao[0]['icao'].ltrim(substr($ident, 2), '0'); |
|
40 | 40 | } else $icao = $ident; |
41 | 41 | } |
42 | 42 | return $icao; |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | try { |
50 | 50 | $sth = $this->db->prepare($query); |
51 | 51 | $sth->execute($query_values); |
52 | - } catch(PDOException $e) { |
|
52 | + } catch (PDOException $e) { |
|
53 | 53 | return "error : ".$e->getMessage(); |
54 | 54 | } |
55 | 55 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
@@ -58,29 +58,29 @@ discard block |
||
58 | 58 | } else return $ident; |
59 | 59 | } |
60 | 60 | |
61 | - public function addOperator($ident,$correct_ident,$source) { |
|
61 | + public function addOperator($ident, $correct_ident, $source) { |
|
62 | 62 | $query = "INSERT INTO translation (Operator,Operator_correct,Source) VALUES (:ident,:correct_ident,:source)"; |
63 | - $query_values = array(':ident' => $ident,':correct_ident' => $correct_ident, ':source' => $source); |
|
63 | + $query_values = array(':ident' => $ident, ':correct_ident' => $correct_ident, ':source' => $source); |
|
64 | 64 | try { |
65 | 65 | $sth = $this->db->prepare($query); |
66 | 66 | $sth->execute($query_values); |
67 | - } catch(PDOException $e) { |
|
67 | + } catch (PDOException $e) { |
|
68 | 68 | return "error : ".$e->getMessage(); |
69 | 69 | } |
70 | 70 | } |
71 | 71 | |
72 | - public function updateOperator($ident,$correct_ident,$source) { |
|
72 | + public function updateOperator($ident, $correct_ident, $source) { |
|
73 | 73 | $query = "UPDATE translation SET Operator_correct = :correct_ident,Source = :source WHERE Operator = :ident"; |
74 | - $query_values = array(':ident' => $ident,':correct_ident' => $correct_ident, ':source' => $source); |
|
74 | + $query_values = array(':ident' => $ident, ':correct_ident' => $correct_ident, ':source' => $source); |
|
75 | 75 | try { |
76 | 76 | $sth = $this->db->prepare($query); |
77 | 77 | $sth->execute($query_values); |
78 | - } catch(PDOException $e) { |
|
78 | + } catch (PDOException $e) { |
|
79 | 79 | return "error : ".$e->getMessage(); |
80 | 80 | } |
81 | 81 | } |
82 | 82 | |
83 | - public function checkTranslation($ident,$web = false) { |
|
83 | + public function checkTranslation($ident, $web = false) { |
|
84 | 84 | global $globalTranslationSources, $globalTranslationFetch; |
85 | 85 | //if (!isset($globalTranslationSources)) $globalTranslationSources = array('planefinder'); |
86 | 86 | $globalTranslationSources = array(); |
@@ -24,24 +24,24 @@ discard block |
||
24 | 24 | |
25 | 25 | $filter_query = ''; |
26 | 26 | if (isset($filter['source']) && !empty($filter['source'])) { |
27 | - $filter_query = " AND format_source IN ('".implode("','",$filter['source'])."')"; |
|
27 | + $filter_query = " AND format_source IN ('".implode("','", $filter['source'])."')"; |
|
28 | 28 | } |
29 | 29 | if (isset($filter['airlines']) && !empty($filter['airlines'])) { |
30 | - $filter_query .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','",$filter['airlines'])."')) so ON so.flightaware_id = spotter_live.flightaware_id"; |
|
30 | + $filter_query .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','", $filter['airlines'])."')) so ON so.flightaware_id = spotter_live.flightaware_id"; |
|
31 | 31 | } |
32 | 32 | if (isset($filter['airlinestype']) && !empty($filter['airlinestype'])) { |
33 | 33 | $filter_query .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_type = '".$filter['airlinestype']."') sa ON sa.flightaware_id = spotter_live.flightaware_id "; |
34 | 34 | } |
35 | 35 | if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) { |
36 | - $filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')"; |
|
36 | + $filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','", $filter['source_aprs'])."')"; |
|
37 | 37 | } |
38 | 38 | |
39 | 39 | $limit_query = ''; |
40 | 40 | if ($limit != '') |
41 | 41 | { |
42 | 42 | $limit_array = explode(',', $limit); |
43 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
44 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
43 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
44 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
45 | 45 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
46 | 46 | { |
47 | 47 | $limit_query = ' LIMIT '.$limit_array[1].' OFFSET '.$limit_array[0]; |
@@ -79,16 +79,16 @@ discard block |
||
79 | 79 | |
80 | 80 | $filter_query = ''; |
81 | 81 | if (isset($filter['source']) && !empty($filter['source'])) { |
82 | - $filter_query .= " AND format_source IN ('".implode("','",$filter['source'])."') "; |
|
82 | + $filter_query .= " AND format_source IN ('".implode("','", $filter['source'])."') "; |
|
83 | 83 | } |
84 | 84 | if (isset($filter['airlines']) && !empty($filter['airlines'])) { |
85 | - $filter_query .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','",$filter['airlines'])."')) so ON so.flightaware_id = spotter_live.flightaware_id "; |
|
85 | + $filter_query .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','", $filter['airlines'])."')) so ON so.flightaware_id = spotter_live.flightaware_id "; |
|
86 | 86 | } |
87 | 87 | if (isset($filter['airlinestype']) && !empty($filter['airlinestype'])) { |
88 | 88 | $filter_query .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_type = '".$filter['airlinestype']."') sa ON sa.flightaware_id = spotter_live.flightaware_id "; |
89 | 89 | } |
90 | 90 | if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) { |
91 | - $filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')"; |
|
91 | + $filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','", $filter['source_aprs'])."')"; |
|
92 | 92 | } |
93 | 93 | |
94 | 94 | if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | // $query = 'SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, a.aircraft_shadow FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate INNER JOIN (SELECT * FROM aircraft) a on spotter_live.aircraft_icao = a.icao'; |
98 | 98 | // $query = 'SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate'.$filter_query; |
99 | 99 | |
100 | - $query = 'SELECT a.aircraft_shadow, spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date |
|
100 | + $query = 'SELECT a.aircraft_shadow, spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date |
|
101 | 101 | FROM spotter_live |
102 | 102 | INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate '.$filter_query.'LEFT JOIN (SELECT aircraft_shadow,icao FROM aircraft) a ON spotter_live.aircraft_icao = a.icao'; |
103 | 103 | |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | //$query = "SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE NOW() AT TIME ZONE 'UTC' - '30 SECONDS'->INTERVAL <= l.date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate"; |
109 | 109 | //$query = "SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE NOW() AT TIME ZONE 'UTC' - '".$globalLiveInterval." SECONDS'->INTERVAL <= l.date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate$orderby_query"; |
110 | 110 | //$query = 'SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, a.aircraft_shadow FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate '.$filter_query.'INNER JOIN (SELECT * FROM aircraft) a on spotter_live.aircraft_icao = a.icao'; |
111 | - $query = "SELECT a.aircraft_shadow, spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date |
|
111 | + $query = "SELECT a.aircraft_shadow, spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date |
|
112 | 112 | FROM spotter_live |
113 | 113 | INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= l.date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ".$filter_query.'LEFT JOIN (SELECT aircraft_shadow,icao FROM aircraft) a ON spotter_live.aircraft_icao = a.icao'; |
114 | 114 | } |
@@ -118,7 +118,7 @@ discard block |
||
118 | 118 | try { |
119 | 119 | $sth = $this->db->prepare($query); |
120 | 120 | $sth->execute(); |
121 | - } catch(PDOException $e) { |
|
121 | + } catch (PDOException $e) { |
|
122 | 122 | return "error"; |
123 | 123 | } |
124 | 124 | $spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -137,16 +137,16 @@ discard block |
||
137 | 137 | global $globalDBdriver, $globalLiveInterval; |
138 | 138 | $filter_query = ''; |
139 | 139 | if (isset($filter['source']) && !empty($filter['source'])) { |
140 | - $filter_query = " AND format_source IN ('".implode("','",$filter['source'])."')"; |
|
140 | + $filter_query = " AND format_source IN ('".implode("','", $filter['source'])."')"; |
|
141 | 141 | } |
142 | 142 | if (isset($filter['airlines']) && !empty($filter['airlines'])) { |
143 | - $filter_query .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','",$filter['airlines'])."')) so ON so.flightaware_id = spotter_live.flightaware_id"; |
|
143 | + $filter_query .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','", $filter['airlines'])."')) so ON so.flightaware_id = spotter_live.flightaware_id"; |
|
144 | 144 | } |
145 | 145 | if (isset($filter['airlinestype']) && !empty($filter['airlinestype'])) { |
146 | 146 | $filter_query .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_type = '".$filter['airlinestype']."') sa ON sa.flightaware_id = spotter_live.flightaware_id "; |
147 | 147 | } |
148 | 148 | if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) { |
149 | - $filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')"; |
|
149 | + $filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','", $filter['source_aprs'])."')"; |
|
150 | 150 | } |
151 | 151 | |
152 | 152 | if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
@@ -160,7 +160,7 @@ discard block |
||
160 | 160 | try { |
161 | 161 | $sth = $this->db->prepare($query); |
162 | 162 | $sth->execute(); |
163 | - } catch(PDOException $e) { |
|
163 | + } catch (PDOException $e) { |
|
164 | 164 | return "error"; |
165 | 165 | } |
166 | 166 | $result = $sth->fetch(PDO::FETCH_ASSOC); |
@@ -180,29 +180,29 @@ discard block |
||
180 | 180 | if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
181 | 181 | $filter_query = ''; |
182 | 182 | if (isset($filter['source'])) { |
183 | - $filter_query = " AND format_source IN ('".implode(',',$filter['source'])."')"; |
|
183 | + $filter_query = " AND format_source IN ('".implode(',', $filter['source'])."')"; |
|
184 | 184 | } |
185 | 185 | if (isset($filter['airlines'])) { |
186 | - $filter_query .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','",$filter['airlines'])."')) so ON so.flightaware_id = spotter_live.flightaware_id"; |
|
186 | + $filter_query .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','", $filter['airlines'])."')) so ON so.flightaware_id = spotter_live.flightaware_id"; |
|
187 | 187 | } |
188 | 188 | if (isset($filter['airlinestype']) && !empty($filter['airlinestype'])) { |
189 | 189 | $filter_query .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_type = '".$filter['airlinestype']."') sa ON sa.flightaware_id = spotter_live.flightaware_id "; |
190 | 190 | } |
191 | 191 | if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) { |
192 | - $filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')"; |
|
192 | + $filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','", $filter['source_aprs'])."')"; |
|
193 | 193 | } |
194 | 194 | |
195 | 195 | if (is_array($coord)) { |
196 | - $minlong = filter_var($coord[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
197 | - $minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
198 | - $maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
199 | - $maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
196 | + $minlong = filter_var($coord[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
197 | + $minlat = filter_var($coord[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
198 | + $maxlong = filter_var($coord[2], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
199 | + $maxlat = filter_var($coord[3], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
200 | 200 | } else return array(); |
201 | 201 | if ($globalDBdriver == 'mysql') { |
202 | 202 | //$query = "SELECT spotter_output.* FROM spotter_output WHERE spotter_output.flightaware_id IN (SELECT spotter_live.flightaware_id FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL ".$globalLiveInterval." SECOND) <= l.date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate AND spotter_live.latitude BETWEEN ".$minlat." AND ".$maxlat." AND spotter_live.longitude BETWEEN ".$minlong." AND ".$maxlong.")"; |
203 | - $query = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate AND spotter_live.latitude BETWEEN '.$minlat.' AND '.$maxlat.' AND spotter_live.longitude BETWEEN '.$minlong.' AND '.$maxlong.' GROUP BY spotter_live.flightaware_id'.$filter_query; |
|
203 | + $query = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate AND spotter_live.latitude BETWEEN '.$minlat.' AND '.$maxlat.' AND spotter_live.longitude BETWEEN '.$minlong.' AND '.$maxlong.' GROUP BY spotter_live.flightaware_id'.$filter_query; |
|
204 | 204 | } else if ($globalDBdriver == 'pgsql') { |
205 | - $query = "SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE NOW() at time zone 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= l.date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate AND spotter_live.latitude BETWEEN ".$minlat." AND ".$maxlat." AND spotter_live.longitude BETWEEN ".$minlong." AND ".$maxlong." GROUP BY spotter_live.flightaware_id".$filter_query; |
|
205 | + $query = "SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE NOW() at time zone 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= l.date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate AND spotter_live.latitude BETWEEN ".$minlat." AND ".$maxlat." AND spotter_live.longitude BETWEEN ".$minlong." AND ".$maxlong." GROUP BY spotter_live.flightaware_id".$filter_query; |
|
206 | 206 | } |
207 | 207 | $spotter_array = $Spotter->getDataFromDB($query); |
208 | 208 | return $spotter_array; |
@@ -253,7 +253,7 @@ discard block |
||
253 | 253 | if ($interval == '1m') |
254 | 254 | { |
255 | 255 | $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= spotter_live.date '; |
256 | - } else if ($interval == '15m'){ |
|
256 | + } else if ($interval == '15m') { |
|
257 | 257 | $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 15 MINUTE) <= spotter_live.date '; |
258 | 258 | } |
259 | 259 | } |
@@ -261,14 +261,14 @@ discard block |
||
261 | 261 | $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= spotter_live.date '; |
262 | 262 | } |
263 | 263 | |
264 | - $query = "SELECT spotter_live.*, ( 6371 * acos( cos( radians(:lat) ) * cos( radians( latitude ) ) * cos( radians( longitude ) - radians(:lng) ) + sin( radians(:lat) ) * sin( radians( latitude ) ) ) ) AS distance FROM spotter_live |
|
264 | + $query = "SELECT spotter_live.*, ( 6371 * acos( cos( radians(:lat) ) * cos( radians( latitude ) ) * cos( radians( longitude ) - radians(:lng) ) + sin( radians(:lat) ) * sin( radians( latitude ) ) ) ) AS distance FROM spotter_live |
|
265 | 265 | WHERE spotter_live.latitude <> '' |
266 | 266 | AND spotter_live.longitude <> '' |
267 | 267 | ".$additional_query." |
268 | 268 | HAVING distance < :radius |
269 | 269 | ORDER BY distance"; |
270 | 270 | |
271 | - $spotter_array = $Spotter->getDataFromDB($query, array(':lat' => $lat, ':lng' => $lng,':radius' => $radius),$limit_query); |
|
271 | + $spotter_array = $Spotter->getDataFromDB($query, array(':lat' => $lat, ':lng' => $lng, ':radius' => $radius), $limit_query); |
|
272 | 272 | |
273 | 273 | return $spotter_array; |
274 | 274 | } |
@@ -286,9 +286,9 @@ discard block |
||
286 | 286 | date_default_timezone_set('UTC'); |
287 | 287 | |
288 | 288 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
289 | - $query = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.ident = :ident GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC'; |
|
289 | + $query = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.ident = :ident GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC'; |
|
290 | 290 | |
291 | - $spotter_array = $Spotter->getDataFromDB($query,array(':ident' => $ident)); |
|
291 | + $spotter_array = $Spotter->getDataFromDB($query, array(':ident' => $ident)); |
|
292 | 292 | |
293 | 293 | return $spotter_array; |
294 | 294 | } |
@@ -305,9 +305,9 @@ discard block |
||
305 | 305 | date_default_timezone_set('UTC'); |
306 | 306 | |
307 | 307 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
308 | - $query = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.flightaware_id = :id GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC'; |
|
308 | + $query = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.flightaware_id = :id GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC'; |
|
309 | 309 | |
310 | - $spotter_array = $Spotter->getDataFromDB($query,array(':id' => $id)); |
|
310 | + $spotter_array = $Spotter->getDataFromDB($query, array(':id' => $id)); |
|
311 | 311 | |
312 | 312 | return $spotter_array; |
313 | 313 | } |
@@ -324,13 +324,13 @@ discard block |
||
324 | 324 | date_default_timezone_set('UTC'); |
325 | 325 | |
326 | 326 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
327 | - $query = 'SELECT spotter_live.altitude, spotter_live.date FROM spotter_live WHERE spotter_live.ident = :ident'; |
|
327 | + $query = 'SELECT spotter_live.altitude, spotter_live.date FROM spotter_live WHERE spotter_live.ident = :ident'; |
|
328 | 328 | |
329 | 329 | try { |
330 | 330 | |
331 | 331 | $sth = $this->db->prepare($query); |
332 | 332 | $sth->execute(array(':ident' => $ident)); |
333 | - } catch(PDOException $e) { |
|
333 | + } catch (PDOException $e) { |
|
334 | 334 | return "error"; |
335 | 335 | } |
336 | 336 | $spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -348,14 +348,14 @@ discard block |
||
348 | 348 | { |
349 | 349 | date_default_timezone_set('UTC'); |
350 | 350 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
351 | - $query = self::$global_query.' WHERE spotter_live.flightaware_id = :id ORDER BY date'; |
|
351 | + $query = self::$global_query.' WHERE spotter_live.flightaware_id = :id ORDER BY date'; |
|
352 | 352 | // $spotter_array = Spotter->getDataFromDB($query,array(':id' => $id)); |
353 | 353 | |
354 | 354 | try { |
355 | 355 | |
356 | 356 | $sth = $this->db->prepare($query); |
357 | 357 | $sth->execute(array(':id' => $id)); |
358 | - } catch(PDOException $e) { |
|
358 | + } catch (PDOException $e) { |
|
359 | 359 | return "error"; |
360 | 360 | } |
361 | 361 | $spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -373,12 +373,12 @@ discard block |
||
373 | 373 | { |
374 | 374 | date_default_timezone_set('UTC'); |
375 | 375 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
376 | - $query = self::$global_query.' WHERE spotter_live.ident = :ident'; |
|
376 | + $query = self::$global_query.' WHERE spotter_live.ident = :ident'; |
|
377 | 377 | try { |
378 | 378 | |
379 | 379 | $sth = $this->db->prepare($query); |
380 | 380 | $sth->execute(array(':ident' => $ident)); |
381 | - } catch(PDOException $e) { |
|
381 | + } catch (PDOException $e) { |
|
382 | 382 | return "error"; |
383 | 383 | } |
384 | 384 | $spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -397,18 +397,18 @@ discard block |
||
397 | 397 | global $globalDBdriver; |
398 | 398 | if ($globalDBdriver == 'mysql') { |
399 | 399 | //$query = "DELETE FROM spotter_live WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL 30 MINUTE) >= spotter_live.date"; |
400 | - $query = 'DELETE FROM spotter_live WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL 9 HOUR) >= spotter_live.date'; |
|
400 | + $query = 'DELETE FROM spotter_live WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL 9 HOUR) >= spotter_live.date'; |
|
401 | 401 | //$query = "DELETE FROM spotter_live WHERE spotter_live.id IN (SELECT spotter_live.id FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 HOUR) >= spotter_live.date)"; |
402 | 402 | |
403 | 403 | } elseif ($globalDBdriver == 'pgsql') { |
404 | - $query = "DELETE FROM spotter_live WHERE NOW() AT TIME ZONE 'UTC' - INTERVAL '9 HOURS' >= spotter_live.date"; |
|
404 | + $query = "DELETE FROM spotter_live WHERE NOW() AT TIME ZONE 'UTC' - INTERVAL '9 HOURS' >= spotter_live.date"; |
|
405 | 405 | } |
406 | 406 | |
407 | 407 | try { |
408 | 408 | |
409 | 409 | $sth = $this->db->prepare($query); |
410 | 410 | $sth->execute(); |
411 | - } catch(PDOException $e) { |
|
411 | + } catch (PDOException $e) { |
|
412 | 412 | return "error"; |
413 | 413 | } |
414 | 414 | |
@@ -431,14 +431,14 @@ discard block |
||
431 | 431 | |
432 | 432 | $sth = $this->db->prepare($query); |
433 | 433 | $sth->execute(); |
434 | - } catch(PDOException $e) { |
|
434 | + } catch (PDOException $e) { |
|
435 | 435 | return "error"; |
436 | 436 | } |
437 | 437 | $query_delete = 'DELETE FROM spotter_live WHERE flightaware_id IN ('; |
438 | 438 | $i = 0; |
439 | - $j =0; |
|
439 | + $j = 0; |
|
440 | 440 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
441 | - foreach($all as $row) |
|
441 | + foreach ($all as $row) |
|
442 | 442 | { |
443 | 443 | $i++; |
444 | 444 | $j++; |
@@ -446,9 +446,9 @@ discard block |
||
446 | 446 | if ($globalDebug) echo "."; |
447 | 447 | try { |
448 | 448 | |
449 | - $sth = $this->db->prepare(substr($query_delete,0,-1).")"); |
|
449 | + $sth = $this->db->prepare(substr($query_delete, 0, -1).")"); |
|
450 | 450 | $sth->execute(); |
451 | - } catch(PDOException $e) { |
|
451 | + } catch (PDOException $e) { |
|
452 | 452 | return "error"; |
453 | 453 | } |
454 | 454 | $query_delete = 'DELETE FROM spotter_live WHERE flightaware_id IN ('; |
@@ -459,9 +459,9 @@ discard block |
||
459 | 459 | if ($i > 0) { |
460 | 460 | try { |
461 | 461 | |
462 | - $sth = $this->db->prepare(substr($query_delete,0,-1).")"); |
|
462 | + $sth = $this->db->prepare(substr($query_delete, 0, -1).")"); |
|
463 | 463 | $sth->execute(); |
464 | - } catch(PDOException $e) { |
|
464 | + } catch (PDOException $e) { |
|
465 | 465 | return "error"; |
466 | 466 | } |
467 | 467 | } |
@@ -474,7 +474,7 @@ discard block |
||
474 | 474 | |
475 | 475 | $sth = $this->db->prepare($query); |
476 | 476 | $sth->execute(); |
477 | - } catch(PDOException $e) { |
|
477 | + } catch (PDOException $e) { |
|
478 | 478 | return "error"; |
479 | 479 | } |
480 | 480 | /* $query_delete = "DELETE FROM spotter_live WHERE flightaware_id IN ("; |
@@ -522,13 +522,13 @@ discard block |
||
522 | 522 | public function deleteLiveSpotterDataByIdent($ident) |
523 | 523 | { |
524 | 524 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
525 | - $query = 'DELETE FROM spotter_live WHERE ident = :ident'; |
|
525 | + $query = 'DELETE FROM spotter_live WHERE ident = :ident'; |
|
526 | 526 | |
527 | 527 | try { |
528 | 528 | |
529 | 529 | $sth = $this->db->prepare($query); |
530 | 530 | $sth->execute(array(':ident' => $ident)); |
531 | - } catch(PDOException $e) { |
|
531 | + } catch (PDOException $e) { |
|
532 | 532 | return "error"; |
533 | 533 | } |
534 | 534 | |
@@ -544,13 +544,13 @@ discard block |
||
544 | 544 | public function deleteLiveSpotterDataById($id) |
545 | 545 | { |
546 | 546 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
547 | - $query = 'DELETE FROM spotter_live WHERE flightaware_id = :id'; |
|
547 | + $query = 'DELETE FROM spotter_live WHERE flightaware_id = :id'; |
|
548 | 548 | |
549 | 549 | try { |
550 | 550 | |
551 | 551 | $sth = $this->db->prepare($query); |
552 | 552 | $sth->execute(array(':id' => $id)); |
553 | - } catch(PDOException $e) { |
|
553 | + } catch (PDOException $e) { |
|
554 | 554 | return "error"; |
555 | 555 | } |
556 | 556 | |
@@ -568,13 +568,13 @@ discard block |
||
568 | 568 | { |
569 | 569 | global $globalDBdriver, $globalTimezone; |
570 | 570 | if ($globalDBdriver == 'mysql') { |
571 | - $query = 'SELECT spotter_live.ident FROM spotter_live |
|
571 | + $query = 'SELECT spotter_live.ident FROM spotter_live |
|
572 | 572 | WHERE spotter_live.ident = :ident |
573 | 573 | AND spotter_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 HOUR) |
574 | 574 | AND spotter_live.date < UTC_TIMESTAMP()'; |
575 | 575 | $query_data = array(':ident' => $ident); |
576 | 576 | } elseif ($globalDBdriver == 'pgsql') { |
577 | - $query = "SELECT spotter_live.ident FROM spotter_live |
|
577 | + $query = "SELECT spotter_live.ident FROM spotter_live |
|
578 | 578 | WHERE spotter_live.ident = :ident |
579 | 579 | AND spotter_live.date >= now() AT TIME ZONE 'UTC' - INTERVAL '1 HOURS' |
580 | 580 | AND spotter_live.date < now() AT TIME ZONE 'UTC'"; |
@@ -583,8 +583,8 @@ discard block |
||
583 | 583 | |
584 | 584 | $sth = $this->db->prepare($query); |
585 | 585 | $sth->execute($query_data); |
586 | - $ident_result=''; |
|
587 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
586 | + $ident_result = ''; |
|
587 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
588 | 588 | { |
589 | 589 | $ident_result = $row['ident']; |
590 | 590 | } |
@@ -601,13 +601,13 @@ discard block |
||
601 | 601 | { |
602 | 602 | global $globalDBdriver, $globalTimezone; |
603 | 603 | if ($globalDBdriver == 'mysql') { |
604 | - $query = 'SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live |
|
604 | + $query = 'SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live |
|
605 | 605 | WHERE spotter_live.ident = :ident |
606 | 606 | AND spotter_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 30 MINUTE)'; |
607 | 607 | // AND spotter_live.date < UTC_TIMESTAMP()"; |
608 | 608 | $query_data = array(':ident' => $ident); |
609 | 609 | } elseif ($globalDBdriver == 'pgsql') { |
610 | - $query = "SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live |
|
610 | + $query = "SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live |
|
611 | 611 | WHERE spotter_live.ident = :ident |
612 | 612 | AND spotter_live.date >= now() AT TIME ZONE 'UTC' - INTERVAL '30 MINUTES'"; |
613 | 613 | // AND spotter_live.date < now() AT TIME ZONE 'UTC'"; |
@@ -616,8 +616,8 @@ discard block |
||
616 | 616 | |
617 | 617 | $sth = $this->db->prepare($query); |
618 | 618 | $sth->execute($query_data); |
619 | - $ident_result=''; |
|
620 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
619 | + $ident_result = ''; |
|
620 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
621 | 621 | { |
622 | 622 | $ident_result = $row['flightaware_id']; |
623 | 623 | } |
@@ -634,13 +634,13 @@ discard block |
||
634 | 634 | { |
635 | 635 | global $globalDBdriver, $globalTimezone; |
636 | 636 | if ($globalDBdriver == 'mysql') { |
637 | - $query = 'SELECT spotter_live.ModeS, spotter_live.flightaware_id FROM spotter_live |
|
637 | + $query = 'SELECT spotter_live.ModeS, spotter_live.flightaware_id FROM spotter_live |
|
638 | 638 | WHERE spotter_live.ModeS = :modes |
639 | 639 | AND spotter_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 30 MINUTE)'; |
640 | 640 | // AND spotter_live.date < UTC_TIMESTAMP()"; |
641 | 641 | $query_data = array(':modes' => $modes); |
642 | 642 | } elseif ($globalDBdriver == 'pgsql') { |
643 | - $query = "SELECT spotter_live.ModeS, spotter_live.flightaware_id FROM spotter_live |
|
643 | + $query = "SELECT spotter_live.ModeS, spotter_live.flightaware_id FROM spotter_live |
|
644 | 644 | WHERE spotter_live.ModeS = :modes |
645 | 645 | AND spotter_live.date >= CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '30 MINUTE'"; |
646 | 646 | // // AND spotter_live.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC'"; |
@@ -649,8 +649,8 @@ discard block |
||
649 | 649 | |
650 | 650 | $sth = $this->db->prepare($query); |
651 | 651 | $sth->execute($query_data); |
652 | - $ident_result=''; |
|
653 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
652 | + $ident_result = ''; |
|
653 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
654 | 654 | { |
655 | 655 | //$ident_result = $row['spotter_live_id']; |
656 | 656 | $ident_result = $row['flightaware_id']; |
@@ -669,7 +669,7 @@ discard block |
||
669 | 669 | * @return String success or false |
670 | 670 | * |
671 | 671 | */ |
672 | - public function addLiveSpotterData($flightaware_id = '', $ident = '', $aircraft_icao = '', $departure_airport_icao = '', $arrival_airport_icao = '', $latitude = '', $longitude = '', $waypoints = '', $altitude = '', $heading = '', $groundspeed = '', $date = '',$departure_airport_time = '', $arrival_airport_time = '', $squawk = '', $route_stop = '', $ModeS = '', $putinarchive = false,$registration = '',$pilot_id = '', $pilot_name = '', $verticalrate = '', $noarchive = false, $ground = false,$format_source = '', $source_name = '', $over_country = '') |
|
672 | + public function addLiveSpotterData($flightaware_id = '', $ident = '', $aircraft_icao = '', $departure_airport_icao = '', $arrival_airport_icao = '', $latitude = '', $longitude = '', $waypoints = '', $altitude = '', $heading = '', $groundspeed = '', $date = '', $departure_airport_time = '', $arrival_airport_time = '', $squawk = '', $route_stop = '', $ModeS = '', $putinarchive = false, $registration = '', $pilot_id = '', $pilot_name = '', $verticalrate = '', $noarchive = false, $ground = false, $format_source = '', $source_name = '', $over_country = '') |
|
673 | 673 | { |
674 | 674 | global $globalURL, $globalArchive, $globalDebug; |
675 | 675 | $Common = new Common(); |
@@ -827,26 +827,26 @@ discard block |
||
827 | 827 | } |
828 | 828 | */ |
829 | 829 | |
830 | - $flightaware_id = filter_var($flightaware_id,FILTER_SANITIZE_STRING); |
|
831 | - $ident = filter_var($ident,FILTER_SANITIZE_STRING); |
|
832 | - $aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING); |
|
833 | - $departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING); |
|
834 | - $arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING); |
|
835 | - $latitude = filter_var($latitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
836 | - $longitude = filter_var($longitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
837 | - $waypoints = filter_var($waypoints,FILTER_SANITIZE_STRING); |
|
838 | - $altitude = filter_var($altitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
839 | - $heading = filter_var($heading,FILTER_SANITIZE_NUMBER_INT); |
|
840 | - $groundspeed = filter_var($groundspeed,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
841 | - $squawk = filter_var($squawk,FILTER_SANITIZE_NUMBER_INT); |
|
842 | - $route_stop = filter_var($route_stop,FILTER_SANITIZE_STRING); |
|
843 | - $ModeS = filter_var($ModeS,FILTER_SANITIZE_STRING); |
|
844 | - $pilot_id = filter_var($pilot_id,FILTER_SANITIZE_STRING); |
|
845 | - $pilot_name = filter_var($pilot_name,FILTER_SANITIZE_STRING); |
|
846 | - $format_source = filter_var($format_source,FILTER_SANITIZE_STRING); |
|
847 | - $source_name = filter_var($source_name,FILTER_SANITIZE_STRING); |
|
848 | - $over_country = filter_var($over_country,FILTER_SANITIZE_STRING); |
|
849 | - $verticalrate = filter_var($verticalrate,FILTER_SANITIZE_NUMBER_INT); |
|
830 | + $flightaware_id = filter_var($flightaware_id, FILTER_SANITIZE_STRING); |
|
831 | + $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
|
832 | + $aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING); |
|
833 | + $departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING); |
|
834 | + $arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING); |
|
835 | + $latitude = filter_var($latitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
836 | + $longitude = filter_var($longitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
837 | + $waypoints = filter_var($waypoints, FILTER_SANITIZE_STRING); |
|
838 | + $altitude = filter_var($altitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
839 | + $heading = filter_var($heading, FILTER_SANITIZE_NUMBER_INT); |
|
840 | + $groundspeed = filter_var($groundspeed, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
841 | + $squawk = filter_var($squawk, FILTER_SANITIZE_NUMBER_INT); |
|
842 | + $route_stop = filter_var($route_stop, FILTER_SANITIZE_STRING); |
|
843 | + $ModeS = filter_var($ModeS, FILTER_SANITIZE_STRING); |
|
844 | + $pilot_id = filter_var($pilot_id, FILTER_SANITIZE_STRING); |
|
845 | + $pilot_name = filter_var($pilot_name, FILTER_SANITIZE_STRING); |
|
846 | + $format_source = filter_var($format_source, FILTER_SANITIZE_STRING); |
|
847 | + $source_name = filter_var($source_name, FILTER_SANITIZE_STRING); |
|
848 | + $over_country = filter_var($over_country, FILTER_SANITIZE_STRING); |
|
849 | + $verticalrate = filter_var($verticalrate, FILTER_SANITIZE_NUMBER_INT); |
|
850 | 850 | |
851 | 851 | /* |
852 | 852 | if (!isset($airline_array) || count($airline_array) == 0) { |
@@ -894,26 +894,26 @@ discard block |
||
894 | 894 | $arrival_airport_country = ''; |
895 | 895 | } |
896 | 896 | |
897 | - if ($squawk == '' || $Common->isInteger($squawk) == false ) $squawk = NULL; |
|
898 | - if ($verticalrate == '' || $Common->isInteger($verticalrate) == false ) $verticalrate = NULL; |
|
899 | - if ($groundspeed == '' || $Common->isInteger($groundspeed) == false ) $groundspeed = 0; |
|
900 | - if ($heading == '' || $Common->isInteger($heading) == false ) $heading = 0; |
|
897 | + if ($squawk == '' || $Common->isInteger($squawk) == false) $squawk = NULL; |
|
898 | + if ($verticalrate == '' || $Common->isInteger($verticalrate) == false) $verticalrate = NULL; |
|
899 | + if ($groundspeed == '' || $Common->isInteger($groundspeed) == false) $groundspeed = 0; |
|
900 | + if ($heading == '' || $Common->isInteger($heading) == false) $heading = 0; |
|
901 | 901 | |
902 | - $query = 'INSERT INTO spotter_live (flightaware_id, ident, registration, airline_name, airline_icao, airline_country, airline_type, aircraft_icao, aircraft_shadow, aircraft_name, aircraft_manufacturer, departure_airport_icao, departure_airport_name, departure_airport_city, departure_airport_country, arrival_airport_icao, arrival_airport_name, arrival_airport_city, arrival_airport_country, latitude, longitude, waypoints, altitude, heading, ground_speed, date, departure_airport_time, arrival_airport_time, squawk, route_stop, ModeS, pilot_id, pilot_name, verticalrate, ground, format_source, source_name, over_country) |
|
902 | + $query = 'INSERT INTO spotter_live (flightaware_id, ident, registration, airline_name, airline_icao, airline_country, airline_type, aircraft_icao, aircraft_shadow, aircraft_name, aircraft_manufacturer, departure_airport_icao, departure_airport_name, departure_airport_city, departure_airport_country, arrival_airport_icao, arrival_airport_name, arrival_airport_city, arrival_airport_country, latitude, longitude, waypoints, altitude, heading, ground_speed, date, departure_airport_time, arrival_airport_time, squawk, route_stop, ModeS, pilot_id, pilot_name, verticalrate, ground, format_source, source_name, over_country) |
|
903 | 903 | VALUES (:flightaware_id,:ident,:registration,:airline_name,:airline_icao,:airline_country,:airline_type,:aircraft_icao,:aircraft_shadow,:aircraft_type,:aircraft_manufacturer,:departure_airport_icao,:departure_airport_name, :departure_airport_city, :departure_airport_country, :arrival_airport_icao, :arrival_airport_name, :arrival_airport_city, :arrival_airport_country, :latitude,:longitude,:waypoints,:altitude,:heading,:groundspeed,:date,:departure_airport_time,:arrival_airport_time,:squawk,:route_stop,:ModeS, :pilot_id, :pilot_name, :verticalrate, :ground, :format_source, :source_name, :over_country)'; |
904 | 904 | |
905 | - $query_values = array(':flightaware_id' => $flightaware_id,':ident' => $ident, ':registration' => $registration,':airline_name' => $airline_name,':airline_icao' => $airline_icao,':airline_country' => $airline_country,':airline_type' => $airline_type,':aircraft_icao' => $aircraft_icao,':aircraft_shadow' => $aircraft_shadow,':aircraft_type' => $aircraft_type,':aircraft_manufacturer' => $aircraft_manufacturer,':departure_airport_icao' => $departure_airport_icao,':departure_airport_name' => $departure_airport_name,':departure_airport_city' => $departure_airport_city,':departure_airport_country' => $departure_airport_country,':arrival_airport_icao' => $arrival_airport_icao,':arrival_airport_name' => $arrival_airport_name,':arrival_airport_city' => $arrival_airport_city,':arrival_airport_country' => $arrival_airport_country,':latitude' => $latitude,':longitude' => $longitude, ':waypoints' => $waypoints,':altitude' => $altitude,':heading' => $heading,':groundspeed' => $groundspeed,':date' => $date, ':departure_airport_time' => $departure_airport_time,':arrival_airport_time' => $arrival_airport_time, ':squawk' => $squawk,':route_stop' => $route_stop,':ModeS' => $ModeS, ':pilot_id' => $pilot_id, ':pilot_name' => $pilot_name, ':verticalrate' => $verticalrate, ':format_source' => $format_source,':ground' => $ground, ':source_name' => $source_name, ':over_country' => $over_country); |
|
905 | + $query_values = array(':flightaware_id' => $flightaware_id, ':ident' => $ident, ':registration' => $registration, ':airline_name' => $airline_name, ':airline_icao' => $airline_icao, ':airline_country' => $airline_country, ':airline_type' => $airline_type, ':aircraft_icao' => $aircraft_icao, ':aircraft_shadow' => $aircraft_shadow, ':aircraft_type' => $aircraft_type, ':aircraft_manufacturer' => $aircraft_manufacturer, ':departure_airport_icao' => $departure_airport_icao, ':departure_airport_name' => $departure_airport_name, ':departure_airport_city' => $departure_airport_city, ':departure_airport_country' => $departure_airport_country, ':arrival_airport_icao' => $arrival_airport_icao, ':arrival_airport_name' => $arrival_airport_name, ':arrival_airport_city' => $arrival_airport_city, ':arrival_airport_country' => $arrival_airport_country, ':latitude' => $latitude, ':longitude' => $longitude, ':waypoints' => $waypoints, ':altitude' => $altitude, ':heading' => $heading, ':groundspeed' => $groundspeed, ':date' => $date, ':departure_airport_time' => $departure_airport_time, ':arrival_airport_time' => $arrival_airport_time, ':squawk' => $squawk, ':route_stop' => $route_stop, ':ModeS' => $ModeS, ':pilot_id' => $pilot_id, ':pilot_name' => $pilot_name, ':verticalrate' => $verticalrate, ':format_source' => $format_source, ':ground' => $ground, ':source_name' => $source_name, ':over_country' => $over_country); |
|
906 | 906 | //$query_values = array(':flightaware_id' => $flightaware_id,':ident' => $ident, ':registration' => $registration,':airline_name' => $airline_array[0]['name'],':airline_icao' => $airline_array[0]['icao'],':airline_country' => $airline_array[0]['country'],':airline_type' => $airline_array[0]['type'],':aircraft_icao' => $aircraft_icao,':aircraft_type' => $aircraft_array[0]['type'],':aircraft_manufacturer' => $aircraft_array[0]['manufacturer'],':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao,':latitude' => $latitude,':longitude' => $longitude, ':waypoints' => $waypoints,':altitude' => $altitude,':heading' => $heading,':groundspeed' => $groundspeed,':date' => $date); |
907 | 907 | try { |
908 | 908 | |
909 | 909 | $sth = $this->db->prepare($query); |
910 | 910 | $sth->execute($query_values); |
911 | - } catch(PDOException $e) { |
|
911 | + } catch (PDOException $e) { |
|
912 | 912 | return "error : ".$e->getMessage(); |
913 | 913 | } |
914 | 914 | if (isset($globalArchive) && $globalArchive && $putinarchive && !$noarchive) { |
915 | 915 | if ($globalDebug) echo '(Add to SBS archive : '; |
916 | - $result = $SpotterArchive->addSpotterArchiveData($flightaware_id, $ident, $registration, $airline_name, $airline_icao, $airline_country, $airline_type, $aircraft_icao, $aircraft_shadow, $aircraft_name, $aircraft_manufacturer, $departure_airport_icao, $departure_airport_name, $departure_airport_city, $departure_airport_country, $departure_airport_time,$arrival_airport_icao, $arrival_airport_name, $arrival_airport_city, $arrival_airport_country, $arrival_airport_time, $route_stop, $date,$latitude, $longitude, $waypoints, $altitude, $heading, $groundspeed, $squawk, $ModeS, $pilot_id, $pilot_name,$verticalrate,$format_source,$source_name, $over_country); |
|
916 | + $result = $SpotterArchive->addSpotterArchiveData($flightaware_id, $ident, $registration, $airline_name, $airline_icao, $airline_country, $airline_type, $aircraft_icao, $aircraft_shadow, $aircraft_name, $aircraft_manufacturer, $departure_airport_icao, $departure_airport_name, $departure_airport_city, $departure_airport_country, $departure_airport_time, $arrival_airport_icao, $arrival_airport_name, $arrival_airport_city, $arrival_airport_country, $arrival_airport_time, $route_stop, $date, $latitude, $longitude, $waypoints, $altitude, $heading, $groundspeed, $squawk, $ModeS, $pilot_id, $pilot_name, $verticalrate, $format_source, $source_name, $over_country); |
|
917 | 917 | if ($globalDebug) echo $result.')'; |
918 | 918 | } |
919 | 919 | return "success"; |
@@ -922,7 +922,7 @@ discard block |
||
922 | 922 | |
923 | 923 | public function getOrderBy() |
924 | 924 | { |
925 | - $orderby = array("aircraft_asc" => array("key" => "aircraft_asc", "value" => "Aircraft Type - ASC", "sql" => "ORDER BY spotter_live.aircraft_icao ASC"), "aircraft_desc" => array("key" => "aircraft_desc", "value" => "Aircraft Type - DESC", "sql" => "ORDER BY spotter_live.aircraft_icao DESC"),"manufacturer_asc" => array("key" => "manufacturer_asc", "value" => "Aircraft Manufacturer - ASC", "sql" => "ORDER BY spotter_live.aircraft_manufacturer ASC"), "manufacturer_desc" => array("key" => "manufacturer_desc", "value" => "Aircraft Manufacturer - DESC", "sql" => "ORDER BY spotter_live.aircraft_manufacturer DESC"),"airline_name_asc" => array("key" => "airline_name_asc", "value" => "Airline Name - ASC", "sql" => "ORDER BY spotter_live.airline_name ASC"), "airline_name_desc" => array("key" => "airline_name_desc", "value" => "Airline Name - DESC", "sql" => "ORDER BY spotter_live.airline_name DESC"), "ident_asc" => array("key" => "ident_asc", "value" => "Ident - ASC", "sql" => "ORDER BY spotter_live.ident ASC"), "ident_desc" => array("key" => "ident_desc", "value" => "Ident - DESC", "sql" => "ORDER BY spotter_live.ident DESC"), "airport_departure_asc" => array("key" => "airport_departure_asc", "value" => "Departure Airport - ASC", "sql" => "ORDER BY spotter_live.departure_airport_city ASC"), "airport_departure_desc" => array("key" => "airport_departure_desc", "value" => "Departure Airport - DESC", "sql" => "ORDER BY spotter_live.departure_airport_city DESC"), "airport_arrival_asc" => array("key" => "airport_arrival_asc", "value" => "Arrival Airport - ASC", "sql" => "ORDER BY spotter_live.arrival_airport_city ASC"), "airport_arrival_desc" => array("key" => "airport_arrival_desc", "value" => "Arrival Airport - DESC", "sql" => "ORDER BY spotter_live.arrival_airport_city DESC"), "date_asc" => array("key" => "date_asc", "value" => "Date - ASC", "sql" => "ORDER BY spotter_live.date ASC"), "date_desc" => array("key" => "date_desc", "value" => "Date - DESC", "sql" => "ORDER BY spotter_live.date DESC")); |
|
925 | + $orderby = array("aircraft_asc" => array("key" => "aircraft_asc", "value" => "Aircraft Type - ASC", "sql" => "ORDER BY spotter_live.aircraft_icao ASC"), "aircraft_desc" => array("key" => "aircraft_desc", "value" => "Aircraft Type - DESC", "sql" => "ORDER BY spotter_live.aircraft_icao DESC"), "manufacturer_asc" => array("key" => "manufacturer_asc", "value" => "Aircraft Manufacturer - ASC", "sql" => "ORDER BY spotter_live.aircraft_manufacturer ASC"), "manufacturer_desc" => array("key" => "manufacturer_desc", "value" => "Aircraft Manufacturer - DESC", "sql" => "ORDER BY spotter_live.aircraft_manufacturer DESC"), "airline_name_asc" => array("key" => "airline_name_asc", "value" => "Airline Name - ASC", "sql" => "ORDER BY spotter_live.airline_name ASC"), "airline_name_desc" => array("key" => "airline_name_desc", "value" => "Airline Name - DESC", "sql" => "ORDER BY spotter_live.airline_name DESC"), "ident_asc" => array("key" => "ident_asc", "value" => "Ident - ASC", "sql" => "ORDER BY spotter_live.ident ASC"), "ident_desc" => array("key" => "ident_desc", "value" => "Ident - DESC", "sql" => "ORDER BY spotter_live.ident DESC"), "airport_departure_asc" => array("key" => "airport_departure_asc", "value" => "Departure Airport - ASC", "sql" => "ORDER BY spotter_live.departure_airport_city ASC"), "airport_departure_desc" => array("key" => "airport_departure_desc", "value" => "Departure Airport - DESC", "sql" => "ORDER BY spotter_live.departure_airport_city DESC"), "airport_arrival_asc" => array("key" => "airport_arrival_asc", "value" => "Arrival Airport - ASC", "sql" => "ORDER BY spotter_live.arrival_airport_city ASC"), "airport_arrival_desc" => array("key" => "airport_arrival_desc", "value" => "Arrival Airport - DESC", "sql" => "ORDER BY spotter_live.arrival_airport_city DESC"), "date_asc" => array("key" => "date_asc", "value" => "Date - ASC", "sql" => "ORDER BY spotter_live.date ASC"), "date_desc" => array("key" => "date_desc", "value" => "Date - DESC", "sql" => "ORDER BY spotter_live.date DESC")); |
|
926 | 926 | return $orderby; |
927 | 927 | } |
928 | 928 |
@@ -13,13 +13,13 @@ discard block |
||
13 | 13 | * @param Array $headers header to submit with the form |
14 | 14 | * @return String the result |
15 | 15 | */ |
16 | - public function getData($url, $type = 'get', $data = '', $headers = '',$cookie = '',$referer = '',$timeout = '',$useragent = '') { |
|
16 | + public function getData($url, $type = 'get', $data = '', $headers = '', $cookie = '', $referer = '', $timeout = '', $useragent = '') { |
|
17 | 17 | $ch = curl_init(); |
18 | 18 | curl_setopt($ch, CURLOPT_URL, $url); |
19 | 19 | curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); |
20 | 20 | curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); |
21 | 21 | curl_setopt($ch, CURLINFO_HEADER_OUT, true); |
22 | - curl_setopt($ch,CURLOPT_ENCODING , "gzip"); |
|
22 | + curl_setopt($ch, CURLOPT_ENCODING, "gzip"); |
|
23 | 23 | //curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.1.2) Gecko/20090729 Firefox/3.5.2 GTB5'); |
24 | 24 | // curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (X11; Linux x86_64; rv:42.0) Gecko/20100101 Firefox/42.0'); |
25 | 25 | if ($useragent == '') { |
@@ -29,13 +29,13 @@ discard block |
||
29 | 29 | } |
30 | 30 | if ($timeout == '') curl_setopt($ch, CURLOPT_TIMEOUT, 10); |
31 | 31 | else curl_setopt($ch, CURLOPT_TIMEOUT, $timeout); |
32 | - curl_setopt($ch, CURLOPT_HEADERFUNCTION, array('Common',"curlResponseHeaderCallback")); |
|
32 | + curl_setopt($ch, CURLOPT_HEADERFUNCTION, array('Common', "curlResponseHeaderCallback")); |
|
33 | 33 | if ($type == 'post') { |
34 | 34 | curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST"); |
35 | 35 | if (is_array($data)) { |
36 | 36 | curl_setopt($ch, CURLOPT_POST, count($data)); |
37 | 37 | $data_string = ''; |
38 | - foreach($data as $key=>$value) { $data_string .= $key.'='.$value.'&'; } |
|
38 | + foreach ($data as $key=>$value) { $data_string .= $key.'='.$value.'&'; } |
|
39 | 39 | rtrim($data_string, '&'); |
40 | 40 | curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string); |
41 | 41 | } else { |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | } |
48 | 48 | if ($cookie != '') { |
49 | 49 | if (is_array($cookie)) { |
50 | - curl_setopt($ch, CURLOPT_COOKIE, implode($cookie,';')); |
|
50 | + curl_setopt($ch, CURLOPT_COOKIE, implode($cookie, ';')); |
|
51 | 51 | } else { |
52 | 52 | curl_setopt($ch, CURLOPT_COOKIE, $cookie); |
53 | 53 | } |
@@ -58,13 +58,13 @@ discard block |
||
58 | 58 | $result = curl_exec($ch); |
59 | 59 | $info = curl_getinfo($ch); |
60 | 60 | curl_close($ch); |
61 | - if ($info['http_code'] == '503' && strstr($result,'DDoS protection by CloudFlare')) { |
|
61 | + if ($info['http_code'] == '503' && strstr($result, 'DDoS protection by CloudFlare')) { |
|
62 | 62 | echo "Cloudflare Detected\n"; |
63 | 63 | require_once(dirname(__FILE__).'/libs/cloudflare-bypass/libraries/cloudflareClass.php'); |
64 | 64 | $useragent = UAgent::random(); |
65 | 65 | cloudflare::useUserAgent($useragent); |
66 | 66 | if ($clearanceCookie = cloudflare::bypass($url)) { |
67 | - return $this->getData($url,'get',$data,$headers,$clearanceCookie,$referer,$timeout,$useragent); |
|
67 | + return $this->getData($url, 'get', $data, $headers, $clearanceCookie, $referer, $timeout, $useragent); |
|
68 | 68 | } |
69 | 69 | } else { |
70 | 70 | return $result; |
@@ -87,27 +87,27 @@ discard block |
||
87 | 87 | if (!is_string($data)) return array(); |
88 | 88 | if ($data == '') return array(); |
89 | 89 | $html = str_get_html($data); |
90 | - $tabledata=array(); |
|
91 | - foreach($html->find('tr') as $element) |
|
90 | + $tabledata = array(); |
|
91 | + foreach ($html->find('tr') as $element) |
|
92 | 92 | { |
93 | 93 | $td = array(); |
94 | - foreach( $element->find('th') as $row) |
|
94 | + foreach ($element->find('th') as $row) |
|
95 | 95 | { |
96 | 96 | $td [] = trim($row->plaintext); |
97 | 97 | } |
98 | - $td=array_filter($td); |
|
98 | + $td = array_filter($td); |
|
99 | 99 | $tabledata[] = $td; |
100 | 100 | |
101 | 101 | $td = array(); |
102 | 102 | $tdi = array(); |
103 | - foreach( $element->find('td') as $row) |
|
103 | + foreach ($element->find('td') as $row) |
|
104 | 104 | { |
105 | 105 | $td [] = trim($row->plaintext); |
106 | 106 | $tdi [] = trim($row->innertext); |
107 | 107 | } |
108 | - $td=array_filter($td); |
|
109 | - $tdi=array_filter($tdi); |
|
110 | - $tabledata[]=array_merge($td,$tdi); |
|
108 | + $td = array_filter($td); |
|
109 | + $tdi = array_filter($tdi); |
|
110 | + $tabledata[] = array_merge($td, $tdi); |
|
111 | 111 | } |
112 | 112 | $html->clear(); |
113 | 113 | unset($html); |
@@ -121,8 +121,8 @@ discard block |
||
121 | 121 | */ |
122 | 122 | public function text2array($data) { |
123 | 123 | $html = str_get_html($data); |
124 | - $tabledata=array(); |
|
125 | - foreach($html->find('p') as $element) |
|
124 | + $tabledata = array(); |
|
125 | + foreach ($html->find('p') as $element) |
|
126 | 126 | { |
127 | 127 | $tabledata [] = trim($element->plaintext); |
128 | 128 | } |
@@ -142,11 +142,11 @@ discard block |
||
142 | 142 | */ |
143 | 143 | public function distance($lat, $lon, $latc, $lonc, $unit = 'km') { |
144 | 144 | if ($lat == $latc && $lon == $lonc) return 0; |
145 | - $dist = rad2deg(acos(sin(deg2rad(floatval($lat)))*sin(deg2rad(floatval($latc)))+ cos(deg2rad(floatval($lat)))*cos(deg2rad(floatval($latc)))*cos(deg2rad(floatval($lon)-floatval($lonc)))))*60*1.1515; |
|
145 | + $dist = rad2deg(acos(sin(deg2rad(floatval($lat)))*sin(deg2rad(floatval($latc))) + cos(deg2rad(floatval($lat)))*cos(deg2rad(floatval($latc)))*cos(deg2rad(floatval($lon) - floatval($lonc)))))*60*1.1515; |
|
146 | 146 | if ($unit == "km") { |
147 | - return round($dist * 1.609344); |
|
147 | + return round($dist*1.609344); |
|
148 | 148 | } elseif ($unit == "m") { |
149 | - return round($dist * 1.609344 * 1000); |
|
149 | + return round($dist*1.609344*1000); |
|
150 | 150 | } elseif ($unit == "mile" || $unit == "mi") { |
151 | 151 | return round($dist); |
152 | 152 | } elseif ($unit == "nm") { |
@@ -162,7 +162,7 @@ discard block |
||
162 | 162 | * @param float $distance distance covered |
163 | 163 | * @return whether distance is realistic |
164 | 164 | */ |
165 | - public function withinThreshold ($timeDifference, $distance) { |
|
165 | + public function withinThreshold($timeDifference, $distance) { |
|
166 | 166 | $x = abs($timeDifference); |
167 | 167 | $d = abs($distance); |
168 | 168 | if ($x == 0 || $d == 0) return true; |
@@ -178,12 +178,12 @@ discard block |
||
178 | 178 | return ($array !== array_values($array)); |
179 | 179 | } |
180 | 180 | |
181 | - public function isInteger($input){ |
|
181 | + public function isInteger($input) { |
|
182 | 182 | return(ctype_digit(strval($input))); |
183 | 183 | } |
184 | 184 | |
185 | 185 | |
186 | - public function convertDec($dms,$latlong) { |
|
186 | + public function convertDec($dms, $latlong) { |
|
187 | 187 | if ($latlong == 'latitude') { |
188 | 188 | $deg = substr($dms, 0, 2); |
189 | 189 | $min = substr($dms, 2, 4); |
@@ -191,7 +191,7 @@ discard block |
||
191 | 191 | $deg = substr($dms, 0, 3); |
192 | 192 | $min = substr($dms, 3, 5); |
193 | 193 | } |
194 | - return $deg+(($min*60)/3600); |
|
194 | + return $deg + (($min*60)/3600); |
|
195 | 195 | } |
196 | 196 | |
197 | 197 | /** |
@@ -203,8 +203,8 @@ discard block |
||
203 | 203 | public function xcopy($source, $dest, $permissions = 0755) |
204 | 204 | { |
205 | 205 | $files = glob($source.'*.*'); |
206 | - foreach($files as $file){ |
|
207 | - $file_to_go = str_replace($source,$dest,$file); |
|
206 | + foreach ($files as $file) { |
|
207 | + $file_to_go = str_replace($source, $dest, $file); |
|
208 | 208 | copy($file, $file_to_go); |
209 | 209 | } |
210 | 210 | return true; |
@@ -215,9 +215,9 @@ discard block |
||
215 | 215 | * @param String $url url to check |
216 | 216 | * @return bool Return true on succes false on failure |
217 | 217 | */ |
218 | - public function urlexist($url){ |
|
219 | - $headers=get_headers($url); |
|
220 | - return stripos($headers[0],"200 OK")?true:false; |
|
218 | + public function urlexist($url) { |
|
219 | + $headers = get_headers($url); |
|
220 | + return stripos($headers[0], "200 OK") ? true : false; |
|
221 | 221 | } |
222 | 222 | |
223 | 223 | /** |
@@ -228,7 +228,7 @@ discard block |
||
228 | 228 | public function hex2str($hex) { |
229 | 229 | $str = ''; |
230 | 230 | $hexln = strlen($hex); |
231 | - for($i=0;$i<$hexln;$i+=2) $str .= chr(hexdec(substr($hex,$i,2))); |
|
231 | + for ($i = 0; $i < $hexln; $i += 2) $str .= chr(hexdec(substr($hex, $i, 2))); |
|
232 | 232 | return $str; |
233 | 233 | } |
234 | 234 | |
@@ -237,33 +237,33 @@ discard block |
||
237 | 237 | //difference in longitudinal coordinates |
238 | 238 | $dLon = deg2rad($lon2) - deg2rad($lon1); |
239 | 239 | //difference in the phi of latitudinal coordinates |
240 | - $dPhi = log(tan(deg2rad($lat2) / 2 + pi() / 4) / tan(deg2rad($lat1) / 2 + pi() / 4)); |
|
240 | + $dPhi = log(tan(deg2rad($lat2)/2 + pi()/4)/tan(deg2rad($lat1)/2 + pi()/4)); |
|
241 | 241 | //we need to recalculate $dLon if it is greater than pi |
242 | - if(abs($dLon) > pi()) { |
|
243 | - if($dLon > 0) { |
|
244 | - $dLon = (2 * pi() - $dLon) * -1; |
|
242 | + if (abs($dLon) > pi()) { |
|
243 | + if ($dLon > 0) { |
|
244 | + $dLon = (2*pi() - $dLon)*-1; |
|
245 | 245 | } else { |
246 | - $dLon = 2 * pi() + $dLon; |
|
246 | + $dLon = 2*pi() + $dLon; |
|
247 | 247 | } |
248 | 248 | } |
249 | 249 | //return the angle, normalized |
250 | - return (rad2deg(atan2($dLon, $dPhi)) + 360) % 360; |
|
250 | + return (rad2deg(atan2($dLon, $dPhi)) + 360)%360; |
|
251 | 251 | } |
252 | 252 | |
253 | - public function checkLine($lat1,$lon1,$lat2,$lon2,$lat3,$lon3,$approx = 0.1) { |
|
254 | - $a = ($lon2-$lon1)*$lat3+($lat2-$lat1)*$lon3+($lat1*$lon2+$lat2*$lon1); |
|
255 | - $a = -($lon2-$lon1); |
|
253 | + public function checkLine($lat1, $lon1, $lat2, $lon2, $lat3, $lon3, $approx = 0.1) { |
|
254 | + $a = ($lon2 - $lon1)*$lat3 + ($lat2 - $lat1)*$lon3 + ($lat1*$lon2 + $lat2*$lon1); |
|
255 | + $a = -($lon2 - $lon1); |
|
256 | 256 | $b = $lat2 - $lat1; |
257 | - $c = -($a*$lat1+$b*$lon1); |
|
258 | - $d = $a*$lat3+$b*$lon3+$c; |
|
257 | + $c = -($a*$lat1 + $b*$lon1); |
|
258 | + $d = $a*$lat3 + $b*$lon3 + $c; |
|
259 | 259 | if ($d > -$approx && $d < $approx) return true; |
260 | 260 | else return false; |
261 | 261 | } |
262 | 262 | |
263 | 263 | public function array_merge_noappend() { |
264 | 264 | $output = array(); |
265 | - foreach(func_get_args() as $array) { |
|
266 | - foreach($array as $key => $value) { |
|
265 | + foreach (func_get_args() as $array) { |
|
266 | + foreach ($array as $key => $value) { |
|
267 | 267 | $output[$key] = isset($output[$key]) ? |
268 | 268 | array_merge($output[$key], $value) : $value; |
269 | 269 | } |
@@ -294,34 +294,34 @@ discard block |
||
294 | 294 | return $result; |
295 | 295 | } |
296 | 296 | |
297 | - function nextcoord($latitude, $longitude, $speed, $heading, $archivespeed = 1){ |
|
297 | + function nextcoord($latitude, $longitude, $speed, $heading, $archivespeed = 1) { |
|
298 | 298 | global $globalMapRefresh; |
299 | 299 | $distance = ($speed*0.514444*$globalMapRefresh*$archivespeed)/1000; |
300 | 300 | $r = 6378; |
301 | 301 | $latitude = deg2rad($latitude); |
302 | 302 | $longitude = deg2rad($longitude); |
303 | 303 | $bearing = deg2rad($heading); |
304 | - $latitude2 = asin( (sin($latitude) * cos($distance/$r)) + (cos($latitude) * sin($distance/$r) * cos($bearing)) ); |
|
305 | - $longitude2 = $longitude + atan2( sin($bearing)*sin($distance/$r)*cos($latitude), cos($distance/$r)-(sin($latitude)*sin($latitude2)) ); |
|
306 | - return array('latitude' => number_format(rad2deg($latitude2),5,'.',''),'longitude' => number_format(rad2deg($longitude2),5,'.','')); |
|
304 | + $latitude2 = asin((sin($latitude)*cos($distance/$r)) + (cos($latitude)*sin($distance/$r)*cos($bearing))); |
|
305 | + $longitude2 = $longitude + atan2(sin($bearing)*sin($distance/$r)*cos($latitude), cos($distance/$r) - (sin($latitude)*sin($latitude2))); |
|
306 | + return array('latitude' => number_format(rad2deg($latitude2), 5, '.', ''), 'longitude' => number_format(rad2deg($longitude2), 5, '.', '')); |
|
307 | 307 | } |
308 | 308 | |
309 | - function getCoordfromDistanceBearing($latitude,$longitude,$bearing,$distance) { |
|
309 | + function getCoordfromDistanceBearing($latitude, $longitude, $bearing, $distance) { |
|
310 | 310 | // distance in meter |
311 | 311 | $R = 6378.14; |
312 | - $latitude1 = $latitude * (M_PI/180); |
|
313 | - $longitude1 = $longitude * (M_PI/180); |
|
314 | - $brng = $bearing * (M_PI/180); |
|
312 | + $latitude1 = $latitude*(M_PI/180); |
|
313 | + $longitude1 = $longitude*(M_PI/180); |
|
314 | + $brng = $bearing*(M_PI/180); |
|
315 | 315 | $d = $distance; |
316 | 316 | |
317 | 317 | $latitude2 = asin(sin($latitude1)*cos($d/$R) + cos($latitude1)*sin($d/$R)*cos($brng)); |
318 | - $longitude2 = $longitude1 + atan2(sin($brng)*sin($d/$R)*cos($latitude1),cos($d/$R)-sin($latitude1)*sin($latitude2)); |
|
318 | + $longitude2 = $longitude1 + atan2(sin($brng)*sin($d/$R)*cos($latitude1), cos($d/$R) - sin($latitude1)*sin($latitude2)); |
|
319 | 319 | |
320 | - $latitude2 = $latitude2 * (180/M_PI); |
|
321 | - $longitude2 = $longitude2 * (180/M_PI); |
|
320 | + $latitude2 = $latitude2*(180/M_PI); |
|
321 | + $longitude2 = $longitude2*(180/M_PI); |
|
322 | 322 | |
323 | - $flat = round ($latitude2,6); |
|
324 | - $flong = round ($longitude2,6); |
|
323 | + $flat = round($latitude2, 6); |
|
324 | + $flong = round($longitude2, 6); |
|
325 | 325 | /* |
326 | 326 | $dx = $distance*cos($bearing); |
327 | 327 | $dy = $distance*sin($bearing); |
@@ -330,7 +330,7 @@ discard block |
||
330 | 330 | $flong = $longitude + $dlong; |
331 | 331 | $flat = $latitude + $dlat; |
332 | 332 | */ |
333 | - return array('latitude' => $flat,'longitude' => $flong); |
|
333 | + return array('latitude' => $flat, 'longitude' => $flong); |
|
334 | 334 | } |
335 | 335 | } |
336 | 336 | ?> |
337 | 337 | \ No newline at end of file |