@@ -14,75 +14,75 @@ discard block |
||
14 | 14 | * @param Array $filter the filter |
15 | 15 | * @return Array the SQL part |
16 | 16 | */ |
17 | - public function getFilter($filter = array(),$where = false,$and = false) { |
|
17 | + public function getFilter($filter = array(), $where = false, $and = false) { |
|
18 | 18 | global $globalFilter, $globalStatsFilters, $globalFilterName, $globalDBdriver; |
19 | 19 | $filters = array(); |
20 | 20 | if (is_array($globalStatsFilters) && isset($globalStatsFilters[$globalFilterName])) { |
21 | 21 | if (isset($globalStatsFilters[$globalFilterName][0]['source'])) { |
22 | 22 | $filters = $globalStatsFilters[$globalFilterName]; |
23 | 23 | } else { |
24 | - $filter = array_merge($filter,$globalStatsFilters[$globalFilterName]); |
|
24 | + $filter = array_merge($filter, $globalStatsFilters[$globalFilterName]); |
|
25 | 25 | } |
26 | 26 | } |
27 | 27 | if (isset($filter[0]['source'])) { |
28 | - $filters = array_merge($filters,$filter); |
|
28 | + $filters = array_merge($filters, $filter); |
|
29 | 29 | } |
30 | - if (is_array($globalFilter)) $filter = array_merge($filter,$globalFilter); |
|
30 | + if (is_array($globalFilter)) $filter = array_merge($filter, $globalFilter); |
|
31 | 31 | $filter_query_join = ''; |
32 | 32 | $filter_query_where = ''; |
33 | - foreach($filters as $flt) { |
|
33 | + foreach ($filters as $flt) { |
|
34 | 34 | if (isset($flt['airlines']) && !empty($flt['airlines'])) { |
35 | 35 | if ($flt['airlines'][0] != '' && $flt['airlines'][0] != 'all') { |
36 | 36 | if (isset($flt['source'])) { |
37 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.airline_icao IN ('".implode("','",$flt['airlines'])."') AND spotter_archive_output.format_source IN ('".implode("','",$flt['source'])."')) saff ON saff.flightaware_id = spotter_archive_output.flightaware_id"; |
|
37 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.airline_icao IN ('".implode("','", $flt['airlines'])."') AND spotter_archive_output.format_source IN ('".implode("','", $flt['source'])."')) saff ON saff.flightaware_id = spotter_archive_output.flightaware_id"; |
|
38 | 38 | } else { |
39 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.airline_icao IN ('".implode("','",$flt['airlines'])."')) saff ON saff.flightaware_id = spotter_archive_output.flightaware_id"; |
|
39 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.airline_icao IN ('".implode("','", $flt['airlines'])."')) saff ON saff.flightaware_id = spotter_archive_output.flightaware_id"; |
|
40 | 40 | } |
41 | 41 | } |
42 | 42 | } |
43 | 43 | if (isset($flt['pilots_id']) && !empty($flt['pilots_id'])) { |
44 | 44 | if (isset($flt['source'])) { |
45 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.pilot_id IN ('".implode("','",$flt['pilots_id'])."') AND spotter_archive_output.format_source IN ('".implode("','",$flt['source'])."')) sp ON sp.flightaware_id = spotter_archive_output.flightaware_id"; |
|
45 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.pilot_id IN ('".implode("','", $flt['pilots_id'])."') AND spotter_archive_output.format_source IN ('".implode("','", $flt['source'])."')) sp ON sp.flightaware_id = spotter_archive_output.flightaware_id"; |
|
46 | 46 | } else { |
47 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.pilot_id IN ('".implode("','",$flt['pilots_id'])."')) sp ON sp.flightaware_id = spotter_archive_output.flightaware_id"; |
|
47 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.pilot_id IN ('".implode("','", $flt['pilots_id'])."')) sp ON sp.flightaware_id = spotter_archive_output.flightaware_id"; |
|
48 | 48 | } |
49 | 49 | } |
50 | 50 | if (isset($flt['idents']) && !empty($flt['idents'])) { |
51 | 51 | if (isset($flt['source'])) { |
52 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.ident IN ('".implode("','",$flt['idents'])."') AND spotter_archive_output.format_source IN ('".implode("','",$flt['source'])."')) spi ON spi.flightaware_id = spotter_archive_output.flightaware_id"; |
|
52 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.ident IN ('".implode("','", $flt['idents'])."') AND spotter_archive_output.format_source IN ('".implode("','", $flt['source'])."')) spi ON spi.flightaware_id = spotter_archive_output.flightaware_id"; |
|
53 | 53 | } else { |
54 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.ident IN ('".implode("','",$flt['idents'])."')) spi ON spi.flightaware_id = spotter_archive_output.flightaware_id"; |
|
54 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.ident IN ('".implode("','", $flt['idents'])."')) spi ON spi.flightaware_id = spotter_archive_output.flightaware_id"; |
|
55 | 55 | } |
56 | 56 | } |
57 | 57 | if (isset($flt['registrations']) && !empty($flt['registrations'])) { |
58 | 58 | if (isset($flt['source'])) { |
59 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.registration IN ('".implode("','",$flt['registrations'])."') AND spotter_archive_output.format_source IN ('".implode("','",$flt['source'])."')) sre ON sre.flightaware_id = spotter_archive_output.flightaware_id"; |
|
59 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.registration IN ('".implode("','", $flt['registrations'])."') AND spotter_archive_output.format_source IN ('".implode("','", $flt['source'])."')) sre ON sre.flightaware_id = spotter_archive_output.flightaware_id"; |
|
60 | 60 | } else { |
61 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.registration IN ('".implode("','",$flt['registrations'])."')) sre ON sre.flightaware_id = spotter_archive_output.flightaware_id"; |
|
61 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.registration IN ('".implode("','", $flt['registrations'])."')) sre ON sre.flightaware_id = spotter_archive_output.flightaware_id"; |
|
62 | 62 | } |
63 | 63 | } |
64 | 64 | if ((isset($flt['airlines']) && empty($flt['airlines']) && isset($flt['pilots_id']) && empty($flt['pilots_id']) && isset($flt['idents']) && empty($flt['idents']) && isset($flt['registrations']) && empty($flt['registrations'])) || (!isset($flt['airlines']) && !isset($flt['pilots_id']) && !isset($flt['idents']) && !isset($flt['registrations']))) { |
65 | 65 | if (isset($flt['source'])) { |
66 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_output.format_source IN ('".implode("','",$flt['source'])."')) saa ON saa.flightaware_id = spotter_archive_output.flightaware_id"; |
|
66 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_output.format_source IN ('".implode("','", $flt['source'])."')) saa ON saa.flightaware_id = spotter_archive_output.flightaware_id"; |
|
67 | 67 | } |
68 | 68 | } |
69 | 69 | } |
70 | 70 | if (isset($filter['airlines']) && !empty($filter['airlines'])) { |
71 | 71 | if ($filter['airlines'][0] != '' && $filter['airlines'][0] != 'all') { |
72 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.airline_icao IN ('".implode("','",$filter['airlines'])."')) saf ON saf.flightaware_id = spotter_archive_output.flightaware_id"; |
|
72 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.airline_icao IN ('".implode("','", $filter['airlines'])."')) saf ON saf.flightaware_id = spotter_archive_output.flightaware_id"; |
|
73 | 73 | } |
74 | 74 | } |
75 | 75 | if (isset($filter['airlinestype']) && !empty($filter['airlinestype'])) { |
76 | 76 | $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.airline_type = '".$filter['airlinestype']."') sa ON sa.flightaware_id = spotter_archive_output.flightaware_id "; |
77 | 77 | } |
78 | 78 | if (isset($filter['pilots_id']) && !empty($filter['pilots_id'])) { |
79 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.pilot_id IN ('".implode("','",$filter['pilots_id'])."')) spi ON spi.flightaware_id = spotter_archive_output.flightaware_id"; |
|
79 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.pilot_id IN ('".implode("','", $filter['pilots_id'])."')) spi ON spi.flightaware_id = spotter_archive_output.flightaware_id"; |
|
80 | 80 | } |
81 | 81 | if (isset($filter['source']) && !empty($filter['source'])) { |
82 | 82 | if (count($filter['source']) == 1) { |
83 | 83 | $filter_query_where .= " AND format_source = '".$filter['source'][0]."'"; |
84 | 84 | } else { |
85 | - $filter_query_where .= " AND format_source IN ('".implode("','",$filter['source'])."')"; |
|
85 | + $filter_query_where .= " AND format_source IN ('".implode("','", $filter['source'])."')"; |
|
86 | 86 | } |
87 | 87 | } |
88 | 88 | if (isset($filter['ident']) && !empty($filter['ident'])) { |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | $filter_query_where .= " AND flightaware_id = '".$filter['id']."'"; |
93 | 93 | } |
94 | 94 | if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) { |
95 | - $filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')"; |
|
95 | + $filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','", $filter['source_aprs'])."')"; |
|
96 | 96 | } |
97 | 97 | if ((isset($filter['year']) && $filter['year'] != '') || (isset($filter['month']) && $filter['month'] != '') || (isset($filter['day']) && $filter['day'] != '')) { |
98 | 98 | $filter_query_date = ''; |
@@ -117,41 +117,41 @@ discard block |
||
117 | 117 | $filter_query_date .= " AND EXTRACT(DAY FROM spotter_archive_output.date) = '".$filter['day']."'"; |
118 | 118 | } |
119 | 119 | } |
120 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output".preg_replace('/^ AND/',' WHERE',$filter_query_date).") sd ON sd.flightaware_id = spotter_archive_output.flightaware_id"; |
|
120 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output".preg_replace('/^ AND/', ' WHERE', $filter_query_date).") sd ON sd.flightaware_id = spotter_archive_output.flightaware_id"; |
|
121 | 121 | } |
122 | 122 | if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE'; |
123 | 123 | elseif ($filter_query_where != '' && $and) $filter_query_where .= ' AND'; |
124 | 124 | if ($filter_query_where != '') { |
125 | - $filter_query_where = preg_replace('/^ AND/',' WHERE',$filter_query_where); |
|
125 | + $filter_query_where = preg_replace('/^ AND/', ' WHERE', $filter_query_where); |
|
126 | 126 | } |
127 | 127 | $filter_query = $filter_query_join.$filter_query_where; |
128 | 128 | return $filter_query; |
129 | 129 | } |
130 | 130 | |
131 | 131 | // Spotter_archive |
132 | - public function 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 = '', $real_altitude = '',$heading = '', $ground_speed = '', $squawk = '', $ModeS = '', $pilot_id = '', $pilot_name = '',$verticalrate = '',$format_source = '', $source_name = '', $over_country = '') { |
|
132 | + public function 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 = '', $real_altitude = '', $heading = '', $ground_speed = '', $squawk = '', $ModeS = '', $pilot_id = '', $pilot_name = '', $verticalrate = '', $format_source = '', $source_name = '', $over_country = '') { |
|
133 | 133 | require_once(dirname(__FILE__).'/class.Spotter.php'); |
134 | 134 | if ($over_country == '') { |
135 | 135 | $Spotter = new Spotter($this->db); |
136 | - $data_country = $Spotter->getCountryFromLatitudeLongitude($latitude,$longitude); |
|
136 | + $data_country = $Spotter->getCountryFromLatitudeLongitude($latitude, $longitude); |
|
137 | 137 | if (!empty($data_country)) $country = $data_country['iso2']; |
138 | 138 | else $country = ''; |
139 | 139 | } else $country = $over_country; |
140 | - if ($airline_type === NULL) $airline_type =''; |
|
140 | + if ($airline_type === NULL) $airline_type = ''; |
|
141 | 141 | |
142 | 142 | //if ($country == '') echo "\n".'************ UNKNOW COUNTRY ****************'."\n"; |
143 | 143 | //else echo "\n".'*/*/*/*/*/*/*/ Country : '.$country.' */*/*/*/*/*/*/*/*/'."\n"; |
144 | 144 | |
145 | 145 | // Route is not added in spotter_archive |
146 | - $query = "INSERT INTO spotter_archive (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, ground_speed, squawk, ModeS, pilot_id, pilot_name, verticalrate,format_source,over_country,source_name,real_altitude) |
|
146 | + $query = "INSERT INTO spotter_archive (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, ground_speed, squawk, ModeS, pilot_id, pilot_name, verticalrate,format_source,over_country,source_name,real_altitude) |
|
147 | 147 | VALUES (: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, :ground_speed, :squawk, :ModeS, :pilot_id, :pilot_name, :verticalrate, :format_source, :over_country, :source_name,:real_altitude)"; |
148 | 148 | |
149 | - $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_name' => $aircraft_name, ':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, ':departure_airport_time' => $departure_airport_time,':arrival_airport_icao' => $arrival_airport_icao, ':arrival_airport_name' => $arrival_airport_name, ':arrival_airport_city' => $arrival_airport_city, ':arrival_airport_country' => $arrival_airport_country, ':arrival_airport_time' => $arrival_airport_time, ':route_stop' => $route_stop, ':date' => $date,':latitude' => $latitude, ':longitude' => $longitude, ':waypoints' => $waypoints, ':altitude' => $altitude, ':heading' => $heading, ':ground_speed' => $ground_speed, ':squawk' => $squawk, ':ModeS' => $ModeS, ':pilot_id' => $pilot_id, ':pilot_name' => $pilot_name, ':verticalrate' => $verticalrate, ':format_source' => $format_source, ':over_country' => $country, ':source_name' => $source_name,':real_altitude' => $real_altitude); |
|
149 | + $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_name' => $aircraft_name, ':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, ':departure_airport_time' => $departure_airport_time, ':arrival_airport_icao' => $arrival_airport_icao, ':arrival_airport_name' => $arrival_airport_name, ':arrival_airport_city' => $arrival_airport_city, ':arrival_airport_country' => $arrival_airport_country, ':arrival_airport_time' => $arrival_airport_time, ':route_stop' => $route_stop, ':date' => $date, ':latitude' => $latitude, ':longitude' => $longitude, ':waypoints' => $waypoints, ':altitude' => $altitude, ':heading' => $heading, ':ground_speed' => $ground_speed, ':squawk' => $squawk, ':ModeS' => $ModeS, ':pilot_id' => $pilot_id, ':pilot_name' => $pilot_name, ':verticalrate' => $verticalrate, ':format_source' => $format_source, ':over_country' => $country, ':source_name' => $source_name, ':real_altitude' => $real_altitude); |
|
150 | 150 | try { |
151 | 151 | $sth = $this->db->prepare($query); |
152 | 152 | $sth->execute($query_values); |
153 | 153 | $sth->closeCursor(); |
154 | - } catch(PDOException $e) { |
|
154 | + } catch (PDOException $e) { |
|
155 | 155 | return "error : ".$e->getMessage(); |
156 | 156 | } |
157 | 157 | return "success"; |
@@ -170,9 +170,9 @@ discard block |
||
170 | 170 | |
171 | 171 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
172 | 172 | //$query = "SELECT spotter_archive.* FROM spotter_archive INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_archive l WHERE l.ident = :ident GROUP BY l.flightaware_id) s on spotter_archive.flightaware_id = s.flightaware_id AND spotter_archive.date = s.maxdate LIMIT 1"; |
173 | - $query = "SELECT spotter_archive.* FROM spotter_archive WHERE ident = :ident ORDER BY date DESC LIMIT 1"; |
|
173 | + $query = "SELECT spotter_archive.* FROM spotter_archive WHERE ident = :ident ORDER BY date DESC LIMIT 1"; |
|
174 | 174 | |
175 | - $spotter_array = $Spotter->getDataFromDB($query,array(':ident' => $ident)); |
|
175 | + $spotter_array = $Spotter->getDataFromDB($query, array(':ident' => $ident)); |
|
176 | 176 | |
177 | 177 | return $spotter_array; |
178 | 178 | } |
@@ -190,7 +190,7 @@ discard block |
||
190 | 190 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
191 | 191 | //$query = SpotterArchive->$global_query." WHERE spotter_archive.flightaware_id = :id"; |
192 | 192 | //$query = "SELECT spotter_archive.* FROM spotter_archive INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_archive l WHERE l.flightaware_id = :id GROUP BY l.flightaware_id) s on spotter_archive.flightaware_id = s.flightaware_id AND spotter_archive.date = s.maxdate LIMIT 1"; |
193 | - $query = "SELECT * FROM spotter_archive WHERE flightaware_id = :id ORDER BY date DESC LIMIT 1"; |
|
193 | + $query = "SELECT * FROM spotter_archive WHERE flightaware_id = :id ORDER BY date DESC LIMIT 1"; |
|
194 | 194 | |
195 | 195 | // $spotter_array = Spotter->getDataFromDB($query,array(':id' => $id)); |
196 | 196 | /* |
@@ -203,7 +203,7 @@ discard block |
||
203 | 203 | } |
204 | 204 | $spotter_array = $sth->fetchAll(PDO->FETCH_ASSOC); |
205 | 205 | */ |
206 | - $spotter_array = $Spotter->getDataFromDB($query,array(':id' => $id)); |
|
206 | + $spotter_array = $Spotter->getDataFromDB($query, array(':id' => $id)); |
|
207 | 207 | |
208 | 208 | return $spotter_array; |
209 | 209 | } |
@@ -217,14 +217,14 @@ discard block |
||
217 | 217 | public function getAllArchiveSpotterDataById($id) { |
218 | 218 | date_default_timezone_set('UTC'); |
219 | 219 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
220 | - $query = $this->global_query." WHERE spotter_archive.flightaware_id = :id ORDER BY date"; |
|
220 | + $query = $this->global_query." WHERE spotter_archive.flightaware_id = :id ORDER BY date"; |
|
221 | 221 | |
222 | 222 | // $spotter_array = Spotter->getDataFromDB($query,array(':id' => $id)); |
223 | 223 | |
224 | 224 | try { |
225 | 225 | $sth = $this->db->prepare($query); |
226 | 226 | $sth->execute(array(':id' => $id)); |
227 | - } catch(PDOException $e) { |
|
227 | + } catch (PDOException $e) { |
|
228 | 228 | echo $e->getMessage(); |
229 | 229 | die; |
230 | 230 | } |
@@ -242,11 +242,11 @@ discard block |
||
242 | 242 | public function getCoordArchiveSpotterDataById($id) { |
243 | 243 | date_default_timezone_set('UTC'); |
244 | 244 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
245 | - $query = "SELECT spotter_archive.latitude, spotter_archive.longitude, spotter_archive.date FROM spotter_archive WHERE spotter_archive.flightaware_id = :id ORDER by spotter_archive.date ASC"; |
|
245 | + $query = "SELECT spotter_archive.latitude, spotter_archive.longitude, spotter_archive.date FROM spotter_archive WHERE spotter_archive.flightaware_id = :id ORDER by spotter_archive.date ASC"; |
|
246 | 246 | try { |
247 | 247 | $sth = $this->db->prepare($query); |
248 | 248 | $sth->execute(array(':id' => $id)); |
249 | - } catch(PDOException $e) { |
|
249 | + } catch (PDOException $e) { |
|
250 | 250 | echo $e->getMessage(); |
251 | 251 | die; |
252 | 252 | } |
@@ -266,12 +266,12 @@ discard block |
||
266 | 266 | date_default_timezone_set('UTC'); |
267 | 267 | |
268 | 268 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
269 | - $query = "SELECT spotter_archive.altitude, spotter_archive.date FROM spotter_archive WHERE spotter_archive.ident = :ident AND spotter_archive.latitude <> 0 AND spotter_archive.longitude <> 0 ORDER BY date"; |
|
269 | + $query = "SELECT spotter_archive.altitude, spotter_archive.date FROM spotter_archive WHERE spotter_archive.ident = :ident AND spotter_archive.latitude <> 0 AND spotter_archive.longitude <> 0 ORDER BY date"; |
|
270 | 270 | |
271 | 271 | try { |
272 | 272 | $sth = $this->db->prepare($query); |
273 | 273 | $sth->execute(array(':ident' => $ident)); |
274 | - } catch(PDOException $e) { |
|
274 | + } catch (PDOException $e) { |
|
275 | 275 | echo $e->getMessage(); |
276 | 276 | die; |
277 | 277 | } |
@@ -291,12 +291,12 @@ discard block |
||
291 | 291 | date_default_timezone_set('UTC'); |
292 | 292 | |
293 | 293 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
294 | - $query = "SELECT spotter_archive.altitude, spotter_archive.date FROM spotter_archive WHERE spotter_archive.flightaware_id = :id AND spotter_archive.latitude <> 0 AND spotter_archive.longitude <> 0 ORDER BY date"; |
|
294 | + $query = "SELECT spotter_archive.altitude, spotter_archive.date FROM spotter_archive WHERE spotter_archive.flightaware_id = :id AND spotter_archive.latitude <> 0 AND spotter_archive.longitude <> 0 ORDER BY date"; |
|
295 | 295 | |
296 | 296 | try { |
297 | 297 | $sth = $this->db->prepare($query); |
298 | 298 | $sth->execute(array(':id' => $id)); |
299 | - } catch(PDOException $e) { |
|
299 | + } catch (PDOException $e) { |
|
300 | 300 | echo $e->getMessage(); |
301 | 301 | die; |
302 | 302 | } |
@@ -314,11 +314,11 @@ discard block |
||
314 | 314 | public function getAltitudeSpeedArchiveSpotterDataById($id) { |
315 | 315 | date_default_timezone_set('UTC'); |
316 | 316 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
317 | - $query = "SELECT spotter_archive.altitude, spotter_archive.real_altitude,spotter_archive.ground_speed, spotter_archive.date FROM spotter_archive WHERE spotter_archive.flightaware_id = :id ORDER BY date"; |
|
317 | + $query = "SELECT spotter_archive.altitude, spotter_archive.real_altitude,spotter_archive.ground_speed, spotter_archive.date FROM spotter_archive WHERE spotter_archive.flightaware_id = :id ORDER BY date"; |
|
318 | 318 | try { |
319 | 319 | $sth = $this->db->prepare($query); |
320 | 320 | $sth->execute(array(':id' => $id)); |
321 | - } catch(PDOException $e) { |
|
321 | + } catch (PDOException $e) { |
|
322 | 322 | echo $e->getMessage(); |
323 | 323 | die; |
324 | 324 | } |
@@ -335,12 +335,12 @@ discard block |
||
335 | 335 | public function getLastAltitudeArchiveSpotterDataByIdent($ident) { |
336 | 336 | date_default_timezone_set('UTC'); |
337 | 337 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
338 | - $query = "SELECT spotter_archive.altitude, spotter_archive.date FROM spotter_archive INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_archive l WHERE l.ident = :ident GROUP BY l.flightaware_id) s on spotter_archive.flightaware_id = s.flightaware_id AND spotter_archive.date = s.maxdate LIMIT 1"; |
|
338 | + $query = "SELECT spotter_archive.altitude, spotter_archive.date FROM spotter_archive INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_archive l WHERE l.ident = :ident GROUP BY l.flightaware_id) s on spotter_archive.flightaware_id = s.flightaware_id AND spotter_archive.date = s.maxdate LIMIT 1"; |
|
339 | 339 | // $query = "SELECT spotter_archive.altitude, spotter_archive.date FROM spotter_archive WHERE spotter_archive.ident = :ident"; |
340 | 340 | try { |
341 | 341 | $sth = $this->db->prepare($query); |
342 | 342 | $sth->execute(array(':ident' => $ident)); |
343 | - } catch(PDOException $e) { |
|
343 | + } catch (PDOException $e) { |
|
344 | 344 | echo $e->getMessage(); |
345 | 345 | die; |
346 | 346 | } |
@@ -356,11 +356,11 @@ discard block |
||
356 | 356 | * @return Array the spotter information |
357 | 357 | * |
358 | 358 | */ |
359 | - public function getSpotterArchiveData($ident,$flightaware_id,$date) { |
|
359 | + public function getSpotterArchiveData($ident, $flightaware_id, $date) { |
|
360 | 360 | $Spotter = new Spotter($this->db); |
361 | 361 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
362 | - $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 AND l.flightaware_id = :flightaware_id AND l.date LIKE :date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate"; |
|
363 | - $spotter_array = $Spotter->getDataFromDB($query,array(':ident' => $ident,':flightaware_id' => $flightaware_id,':date' => $date.'%')); |
|
362 | + $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 AND l.flightaware_id = :flightaware_id AND l.date LIKE :date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate"; |
|
363 | + $spotter_array = $Spotter->getDataFromDB($query, array(':ident' => $ident, ':flightaware_id' => $flightaware_id, ':date' => $date.'%')); |
|
364 | 364 | return $spotter_array; |
365 | 365 | } |
366 | 366 | |
@@ -374,7 +374,7 @@ discard block |
||
374 | 374 | try { |
375 | 375 | $sth = $this->db->prepare($query); |
376 | 376 | $sth->execute(); |
377 | - } catch(PDOException $e) { |
|
377 | + } catch (PDOException $e) { |
|
378 | 378 | echo $e->getMessage(); |
379 | 379 | die; |
380 | 380 | } |
@@ -386,34 +386,34 @@ discard block |
||
386 | 386 | * @return Array the spotter information |
387 | 387 | * |
388 | 388 | */ |
389 | - public function getMinLiveSpotterData($begindate,$enddate,$filter = array()) { |
|
389 | + public function getMinLiveSpotterData($begindate, $enddate, $filter = array()) { |
|
390 | 390 | global $globalDBdriver, $globalLiveInterval; |
391 | 391 | date_default_timezone_set('UTC'); |
392 | 392 | |
393 | 393 | $filter_query = ''; |
394 | 394 | if (isset($filter['source']) && !empty($filter['source'])) { |
395 | - $filter_query .= " AND format_source IN ('".implode("','",$filter['source'])."') "; |
|
395 | + $filter_query .= " AND format_source IN ('".implode("','", $filter['source'])."') "; |
|
396 | 396 | } |
397 | 397 | // Use spotter_output also ? |
398 | 398 | if (isset($filter['airlines']) && !empty($filter['airlines'])) { |
399 | - $filter_query .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.airline_icao IN ('".implode("','",$filter['airlines'])."')) so ON so.flightaware_id = spotter_archive.flightaware_id "; |
|
399 | + $filter_query .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.airline_icao IN ('".implode("','", $filter['airlines'])."')) so ON so.flightaware_id = spotter_archive.flightaware_id "; |
|
400 | 400 | } |
401 | 401 | if (isset($filter['airlinestype']) && !empty($filter['airlinestype'])) { |
402 | 402 | $filter_query .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.airline_type = '".$filter['airlinestype']."') sa ON sa.flightaware_id = spotter_archive.flightaware_id "; |
403 | 403 | } |
404 | 404 | if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) { |
405 | - $filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')"; |
|
405 | + $filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','", $filter['source_aprs'])."')"; |
|
406 | 406 | } |
407 | 407 | |
408 | 408 | //if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
409 | 409 | if ($globalDBdriver == 'mysql') { |
410 | - $query = 'SELECT spotter_archive.date,spotter_archive.flightaware_id, spotter_archive.ident, spotter_archive.aircraft_icao, spotter_archive.departure_airport_icao as departure_airport, spotter_archive.arrival_airport_icao as arrival_airport, spotter_archive.latitude, spotter_archive.longitude, spotter_archive.altitude, spotter_archive.heading, spotter_archive.ground_speed, spotter_archive.squawk, a.aircraft_shadow,a.engine_type, a.engine_count, a.wake_category |
|
410 | + $query = 'SELECT spotter_archive.date,spotter_archive.flightaware_id, spotter_archive.ident, spotter_archive.aircraft_icao, spotter_archive.departure_airport_icao as departure_airport, spotter_archive.arrival_airport_icao as arrival_airport, spotter_archive.latitude, spotter_archive.longitude, spotter_archive.altitude, spotter_archive.heading, spotter_archive.ground_speed, spotter_archive.squawk, a.aircraft_shadow,a.engine_type, a.engine_count, a.wake_category |
|
411 | 411 | FROM spotter_archive |
412 | 412 | INNER JOIN (SELECT * FROM aircraft) a on spotter_archive.aircraft_icao = a.icao |
413 | 413 | WHERE spotter_archive.date BETWEEN '."'".$begindate."'".' AND '."'".$begindate."'".' |
414 | 414 | '.$filter_query.' ORDER BY flightaware_id'; |
415 | 415 | } else { |
416 | - $query = 'SELECT spotter_archive.flightaware_id, spotter_archive.date, spotter_archive.ident, spotter_archive.aircraft_icao, spotter_archive.departure_airport_icao as departure_airport, spotter_archive.arrival_airport_icao as arrival_airport, spotter_archive.latitude, spotter_archive.longitude, spotter_archive.altitude, spotter_archive.heading, spotter_archive.ground_speed, spotter_archive.squawk, a.aircraft_shadow,a.engine_type, a.engine_count, a.wake_category |
|
416 | + $query = 'SELECT spotter_archive.flightaware_id, spotter_archive.date, spotter_archive.ident, spotter_archive.aircraft_icao, spotter_archive.departure_airport_icao as departure_airport, spotter_archive.arrival_airport_icao as arrival_airport, spotter_archive.latitude, spotter_archive.longitude, spotter_archive.altitude, spotter_archive.heading, spotter_archive.ground_speed, spotter_archive.squawk, a.aircraft_shadow,a.engine_type, a.engine_count, a.wake_category |
|
417 | 417 | FROM spotter_archive |
418 | 418 | INNER JOIN (SELECT * FROM aircraft) a on spotter_archive.aircraft_icao = a.icao |
419 | 419 | WHERE spotter_archive.date BETWEEN '."'".$begindate."'".' AND '."'".$enddate."'".' |
@@ -423,7 +423,7 @@ discard block |
||
423 | 423 | try { |
424 | 424 | $sth = $this->db->prepare($query); |
425 | 425 | $sth->execute(); |
426 | - } catch(PDOException $e) { |
|
426 | + } catch (PDOException $e) { |
|
427 | 427 | echo $e->getMessage(); |
428 | 428 | die; |
429 | 429 | } |
@@ -438,23 +438,23 @@ discard block |
||
438 | 438 | * @return Array the spotter information |
439 | 439 | * |
440 | 440 | */ |
441 | - public function getMinLiveSpotterDataPlayback($begindate,$enddate,$filter = array()) { |
|
441 | + public function getMinLiveSpotterDataPlayback($begindate, $enddate, $filter = array()) { |
|
442 | 442 | global $globalDBdriver, $globalLiveInterval; |
443 | 443 | date_default_timezone_set('UTC'); |
444 | 444 | |
445 | 445 | $filter_query = ''; |
446 | 446 | if (isset($filter['source']) && !empty($filter['source'])) { |
447 | - $filter_query .= " AND format_source IN ('".implode("','",$filter['source'])."') "; |
|
447 | + $filter_query .= " AND format_source IN ('".implode("','", $filter['source'])."') "; |
|
448 | 448 | } |
449 | 449 | // Should use spotter_output also ? |
450 | 450 | if (isset($filter['airlines']) && !empty($filter['airlines'])) { |
451 | - $filter_query .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.airline_icao IN ('".implode("','",$filter['airlines'])."')) so ON so.flightaware_id = spotter_archive.flightaware_id "; |
|
451 | + $filter_query .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.airline_icao IN ('".implode("','", $filter['airlines'])."')) so ON so.flightaware_id = spotter_archive.flightaware_id "; |
|
452 | 452 | } |
453 | 453 | if (isset($filter['airlinestype']) && !empty($filter['airlinestype'])) { |
454 | 454 | $filter_query .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.airline_type = '".$filter['airlinestype']."') sa ON sa.flightaware_id = spotter_archive.flightaware_id "; |
455 | 455 | } |
456 | 456 | if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) { |
457 | - $filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')"; |
|
457 | + $filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','", $filter['source_aprs'])."')"; |
|
458 | 458 | } |
459 | 459 | |
460 | 460 | //if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
@@ -464,7 +464,7 @@ discard block |
||
464 | 464 | FROM spotter_archive |
465 | 465 | INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_archive l WHERE (l.date BETWEEN '."'".$begindate."'".' AND '."'".$enddate."'".') GROUP BY l.flightaware_id) s on spotter_archive.flightaware_id = s.flightaware_id AND spotter_archive.date = s.maxdate '.$filter_query.'LEFT JOIN (SELECT aircraft_shadow,icao FROM aircraft) a ON spotter_archive.aircraft_icao = a.icao'; |
466 | 466 | */ |
467 | - $query = 'SELECT a.aircraft_shadow, spotter_archive_output.ident, spotter_archive_output.flightaware_id, spotter_archive_output.aircraft_icao, spotter_archive_output.departure_airport_icao as departure_airport, spotter_archive_output.arrival_airport_icao as arrival_airport, spotter_archive_output.latitude, spotter_archive_output.longitude, spotter_archive_output.altitude, spotter_archive_output.heading, spotter_archive_output.ground_speed, spotter_archive_output.squawk |
|
467 | + $query = 'SELECT a.aircraft_shadow, spotter_archive_output.ident, spotter_archive_output.flightaware_id, spotter_archive_output.aircraft_icao, spotter_archive_output.departure_airport_icao as departure_airport, spotter_archive_output.arrival_airport_icao as arrival_airport, spotter_archive_output.latitude, spotter_archive_output.longitude, spotter_archive_output.altitude, spotter_archive_output.heading, spotter_archive_output.ground_speed, spotter_archive_output.squawk |
|
468 | 468 | FROM spotter_archive_output |
469 | 469 | LEFT JOIN (SELECT aircraft_shadow,icao FROM aircraft) a ON spotter_archive_output.aircraft_icao = a.icao |
470 | 470 | WHERE (spotter_archive_output.date BETWEEN '."'".$begindate."'".' AND '."'".$enddate."'".') |
@@ -479,7 +479,7 @@ discard block |
||
479 | 479 | WHERE spotter_archive_output.date >= '."'".$begindate."'".' AND spotter_archive_output.date <= '."'".$enddate."'".' |
480 | 480 | '.$filter_query.' GROUP BY spotter_archive_output.flightaware_id, spotter_archive_output.ident, spotter_archive_output.aircraft_icao, spotter_archive_output.departure_airport_icao, spotter_archive_output.arrival_airport_icao, spotter_archive_output.latitude, spotter_archive_output.longitude, spotter_archive_output.altitude, spotter_archive_output.heading, spotter_archive_output.ground_speed, spotter_archive_output.squawk, a.aircraft_shadow'; |
481 | 481 | */ |
482 | - $query = 'SELECT DISTINCT spotter_archive_output.flightaware_id, spotter_archive_output.ident, spotter_archive_output.aircraft_icao, spotter_archive_output.departure_airport_icao as departure_airport, spotter_archive_output.arrival_airport_icao as arrival_airport, spotter_archive_output.latitude, spotter_archive_output.longitude, spotter_archive_output.altitude, spotter_archive_output.heading, spotter_archive_output.ground_speed, spotter_archive_output.squawk, a.aircraft_shadow |
|
482 | + $query = 'SELECT DISTINCT spotter_archive_output.flightaware_id, spotter_archive_output.ident, spotter_archive_output.aircraft_icao, spotter_archive_output.departure_airport_icao as departure_airport, spotter_archive_output.arrival_airport_icao as arrival_airport, spotter_archive_output.latitude, spotter_archive_output.longitude, spotter_archive_output.altitude, spotter_archive_output.heading, spotter_archive_output.ground_speed, spotter_archive_output.squawk, a.aircraft_shadow |
|
483 | 483 | FROM spotter_archive_output |
484 | 484 | INNER JOIN (SELECT * FROM aircraft) a on spotter_archive_output.aircraft_icao = a.icao |
485 | 485 | WHERE spotter_archive_output.date >= '."'".$begindate."'".' AND spotter_archive_output.date <= '."'".$enddate."'".' |
@@ -491,7 +491,7 @@ discard block |
||
491 | 491 | try { |
492 | 492 | $sth = $this->db->prepare($query); |
493 | 493 | $sth->execute(); |
494 | - } catch(PDOException $e) { |
|
494 | + } catch (PDOException $e) { |
|
495 | 495 | echo $e->getMessage(); |
496 | 496 | die; |
497 | 497 | } |
@@ -506,22 +506,22 @@ discard block |
||
506 | 506 | * @return Array the spotter information |
507 | 507 | * |
508 | 508 | */ |
509 | - public function getLiveSpotterCount($begindate,$enddate,$filter = array()) { |
|
509 | + public function getLiveSpotterCount($begindate, $enddate, $filter = array()) { |
|
510 | 510 | global $globalDBdriver, $globalLiveInterval; |
511 | 511 | date_default_timezone_set('UTC'); |
512 | 512 | |
513 | 513 | $filter_query = ''; |
514 | 514 | if (isset($filter['source']) && !empty($filter['source'])) { |
515 | - $filter_query .= " AND format_source IN ('".implode("','",$filter['source'])."') "; |
|
515 | + $filter_query .= " AND format_source IN ('".implode("','", $filter['source'])."') "; |
|
516 | 516 | } |
517 | 517 | if (isset($filter['airlines']) && !empty($filter['airlines'])) { |
518 | - $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_archive.flightaware_id "; |
|
518 | + $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_archive.flightaware_id "; |
|
519 | 519 | } |
520 | 520 | if (isset($filter['airlinestype']) && !empty($filter['airlinestype'])) { |
521 | 521 | $filter_query .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_type = '".$filter['airlinestype']."') sa ON sa.flightaware_id = spotter_archive.flightaware_id "; |
522 | 522 | } |
523 | 523 | if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) { |
524 | - $filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')"; |
|
524 | + $filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','", $filter['source_aprs'])."')"; |
|
525 | 525 | } |
526 | 526 | |
527 | 527 | //if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
@@ -536,7 +536,7 @@ discard block |
||
536 | 536 | try { |
537 | 537 | $sth = $this->db->prepare($query); |
538 | 538 | $sth->execute(); |
539 | - } catch(PDOException $e) { |
|
539 | + } catch (PDOException $e) { |
|
540 | 540 | echo $e->getMessage(); |
541 | 541 | die; |
542 | 542 | } |
@@ -556,7 +556,7 @@ discard block |
||
556 | 556 | * @return Array the spotter information |
557 | 557 | * |
558 | 558 | */ |
559 | - public function searchSpotterData($q = '', $registration = '', $aircraft_icao = '', $aircraft_manufacturer = '', $highlights = '', $airline_icao = '', $airline_country = '', $airline_type = '', $airport = '', $airport_country = '', $callsign = '', $departure_airport_route = '', $arrival_airport_route = '', $owner = '',$pilot_id = '',$pilot_name = '',$altitude = '', $date_posted = '', $limit = '', $sort = '', $includegeodata = '',$origLat = '',$origLon = '',$dist = '', $filters=array()) { |
|
559 | + public function searchSpotterData($q = '', $registration = '', $aircraft_icao = '', $aircraft_manufacturer = '', $highlights = '', $airline_icao = '', $airline_country = '', $airline_type = '', $airport = '', $airport_country = '', $callsign = '', $departure_airport_route = '', $arrival_airport_route = '', $owner = '', $pilot_id = '', $pilot_name = '', $altitude = '', $date_posted = '', $limit = '', $sort = '', $includegeodata = '', $origLat = '', $origLon = '', $dist = '', $filters = array()) { |
|
560 | 560 | global $globalTimezone, $globalDBdriver; |
561 | 561 | require_once(dirname(__FILE__).'/class.Translation.php'); |
562 | 562 | $Translation = new Translation($this->db); |
@@ -606,7 +606,7 @@ discard block |
||
606 | 606 | } |
607 | 607 | |
608 | 608 | if ($registration != "") { |
609 | - $registration = filter_var($registration,FILTER_SANITIZE_STRING); |
|
609 | + $registration = filter_var($registration, FILTER_SANITIZE_STRING); |
|
610 | 610 | if (!is_string($registration)) { |
611 | 611 | return array(); |
612 | 612 | } else { |
@@ -615,7 +615,7 @@ discard block |
||
615 | 615 | } |
616 | 616 | |
617 | 617 | if ($aircraft_icao != "") { |
618 | - $aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING); |
|
618 | + $aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING); |
|
619 | 619 | if (!is_string($aircraft_icao)) { |
620 | 620 | return array(); |
621 | 621 | } else { |
@@ -624,7 +624,7 @@ discard block |
||
624 | 624 | } |
625 | 625 | |
626 | 626 | if ($aircraft_manufacturer != "") { |
627 | - $aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING); |
|
627 | + $aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING); |
|
628 | 628 | if (!is_string($aircraft_manufacturer)) { |
629 | 629 | return array(); |
630 | 630 | } else { |
@@ -641,7 +641,7 @@ discard block |
||
641 | 641 | } |
642 | 642 | |
643 | 643 | if ($airline_icao != "") { |
644 | - $airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING); |
|
644 | + $airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING); |
|
645 | 645 | if (!is_string($airline_icao)) { |
646 | 646 | return array(); |
647 | 647 | } else { |
@@ -650,7 +650,7 @@ discard block |
||
650 | 650 | } |
651 | 651 | |
652 | 652 | if ($airline_country != "") { |
653 | - $airline_country = filter_var($airline_country,FILTER_SANITIZE_STRING); |
|
653 | + $airline_country = filter_var($airline_country, FILTER_SANITIZE_STRING); |
|
654 | 654 | if (!is_string($airline_country)) { |
655 | 655 | return array(); |
656 | 656 | } else { |
@@ -659,7 +659,7 @@ discard block |
||
659 | 659 | } |
660 | 660 | |
661 | 661 | if ($airline_type != "") { |
662 | - $airline_type = filter_var($airline_type,FILTER_SANITIZE_STRING); |
|
662 | + $airline_type = filter_var($airline_type, FILTER_SANITIZE_STRING); |
|
663 | 663 | if (!is_string($airline_type)) { |
664 | 664 | return array(); |
665 | 665 | } else { |
@@ -676,7 +676,7 @@ discard block |
||
676 | 676 | } |
677 | 677 | |
678 | 678 | if ($airport != "") { |
679 | - $airport = filter_var($airport,FILTER_SANITIZE_STRING); |
|
679 | + $airport = filter_var($airport, FILTER_SANITIZE_STRING); |
|
680 | 680 | if (!is_string($airport)) { |
681 | 681 | return array(); |
682 | 682 | } else { |
@@ -685,7 +685,7 @@ discard block |
||
685 | 685 | } |
686 | 686 | |
687 | 687 | if ($airport_country != "") { |
688 | - $airport_country = filter_var($airport_country,FILTER_SANITIZE_STRING); |
|
688 | + $airport_country = filter_var($airport_country, FILTER_SANITIZE_STRING); |
|
689 | 689 | if (!is_string($airport_country)) { |
690 | 690 | return array(); |
691 | 691 | } else { |
@@ -694,14 +694,14 @@ discard block |
||
694 | 694 | } |
695 | 695 | |
696 | 696 | if ($callsign != "") { |
697 | - $callsign = filter_var($callsign,FILTER_SANITIZE_STRING); |
|
697 | + $callsign = filter_var($callsign, FILTER_SANITIZE_STRING); |
|
698 | 698 | if (!is_string($callsign)) { |
699 | 699 | return array(); |
700 | 700 | } else { |
701 | 701 | $translate = $Translation->ident2icao($callsign); |
702 | 702 | if ($translate != $callsign) { |
703 | 703 | $additional_query .= " AND (spotter_archive_output.ident = :callsign OR spotter_archive_output.ident = :translate)"; |
704 | - $query_values = array_merge($query_values,array(':callsign' => $callsign,':translate' => $translate)); |
|
704 | + $query_values = array_merge($query_values, array(':callsign' => $callsign, ':translate' => $translate)); |
|
705 | 705 | } else { |
706 | 706 | $additional_query .= " AND (spotter_archive_output.ident = '".$callsign."')"; |
707 | 707 | } |
@@ -709,7 +709,7 @@ discard block |
||
709 | 709 | } |
710 | 710 | |
711 | 711 | if ($owner != "") { |
712 | - $owner = filter_var($owner,FILTER_SANITIZE_STRING); |
|
712 | + $owner = filter_var($owner, FILTER_SANITIZE_STRING); |
|
713 | 713 | if (!is_string($owner)) { |
714 | 714 | return array(); |
715 | 715 | } else { |
@@ -718,7 +718,7 @@ discard block |
||
718 | 718 | } |
719 | 719 | |
720 | 720 | if ($pilot_name != "") { |
721 | - $pilot_name = filter_var($pilot_name,FILTER_SANITIZE_STRING); |
|
721 | + $pilot_name = filter_var($pilot_name, FILTER_SANITIZE_STRING); |
|
722 | 722 | if (!is_string($pilot_name)) { |
723 | 723 | return array(); |
724 | 724 | } else { |
@@ -727,7 +727,7 @@ discard block |
||
727 | 727 | } |
728 | 728 | |
729 | 729 | if ($pilot_id != "") { |
730 | - $pilot_id = filter_var($pilot_id,FILTER_SANITIZE_NUMBER_INT); |
|
730 | + $pilot_id = filter_var($pilot_id, FILTER_SANITIZE_NUMBER_INT); |
|
731 | 731 | if (!is_string($pilot_id)) { |
732 | 732 | return array(); |
733 | 733 | } else { |
@@ -736,7 +736,7 @@ discard block |
||
736 | 736 | } |
737 | 737 | |
738 | 738 | if ($departure_airport_route != "") { |
739 | - $departure_airport_route = filter_var($departure_airport_route,FILTER_SANITIZE_STRING); |
|
739 | + $departure_airport_route = filter_var($departure_airport_route, FILTER_SANITIZE_STRING); |
|
740 | 740 | if (!is_string($departure_airport_route)) { |
741 | 741 | return array(); |
742 | 742 | } else { |
@@ -745,7 +745,7 @@ discard block |
||
745 | 745 | } |
746 | 746 | |
747 | 747 | if ($arrival_airport_route != "") { |
748 | - $arrival_airport_route = filter_var($arrival_airport_route,FILTER_SANITIZE_STRING); |
|
748 | + $arrival_airport_route = filter_var($arrival_airport_route, FILTER_SANITIZE_STRING); |
|
749 | 749 | if (!is_string($arrival_airport_route)) { |
750 | 750 | return array(); |
751 | 751 | } else { |
@@ -756,8 +756,8 @@ discard block |
||
756 | 756 | if ($altitude != "") { |
757 | 757 | $altitude_array = explode(",", $altitude); |
758 | 758 | |
759 | - $altitude_array[0] = filter_var($altitude_array[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
760 | - $altitude_array[1] = filter_var($altitude_array[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
759 | + $altitude_array[0] = filter_var($altitude_array[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
760 | + $altitude_array[1] = filter_var($altitude_array[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
761 | 761 | |
762 | 762 | |
763 | 763 | if ($altitude_array[1] != "") { |
@@ -772,8 +772,8 @@ discard block |
||
772 | 772 | |
773 | 773 | if ($date_posted != "") { |
774 | 774 | $date_array = explode(",", $date_posted); |
775 | - $date_array[0] = filter_var($date_array[0],FILTER_SANITIZE_STRING); |
|
776 | - $date_array[1] = filter_var($date_array[1],FILTER_SANITIZE_STRING); |
|
775 | + $date_array[0] = filter_var($date_array[0], FILTER_SANITIZE_STRING); |
|
776 | + $date_array[1] = filter_var($date_array[1], FILTER_SANITIZE_STRING); |
|
777 | 777 | if ($globalTimezone != '') { |
778 | 778 | date_default_timezone_set($globalTimezone); |
779 | 779 | $datetime = new DateTime(); |
@@ -798,16 +798,16 @@ discard block |
||
798 | 798 | } |
799 | 799 | if ($limit != "") { |
800 | 800 | $limit_array = explode(",", $limit); |
801 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
802 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
801 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
802 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
803 | 803 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) { |
804 | 804 | //$limit_query = " LIMIT ".$limit_array[0].",".$limit_array[1]; |
805 | 805 | $limit_query = " LIMIT ".$limit_array[1]." OFFSET ".$limit_array[0]; |
806 | 806 | } |
807 | 807 | } |
808 | 808 | if ($origLat != "" && $origLon != "" && $dist != "") { |
809 | - $dist = number_format($dist*0.621371,2,'.',''); |
|
810 | - $query="SELECT spotter_archive_output.*, 3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - ABS(CAST(spotter_archive.latitude as double precision)))*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(ABS(CAST(spotter_archive.latitude as double precision))*pi()/180)*POWER(SIN(($origLon-CAST(spotter_archive.longitude as double precision))*pi()/180/2),2))) as distance |
|
809 | + $dist = number_format($dist*0.621371, 2, '.', ''); |
|
810 | + $query = "SELECT spotter_archive_output.*, 3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - ABS(CAST(spotter_archive.latitude as double precision)))*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(ABS(CAST(spotter_archive.latitude as double precision))*pi()/180)*POWER(SIN(($origLon-CAST(spotter_archive.longitude as double precision))*pi()/180/2),2))) as distance |
|
811 | 811 | FROM spotter_archive_output, spotter_archive WHERE spotter_output_archive.flightaware_id = spotter_archive.flightaware_id AND spotter_output.ident <> '' ".$additional_query."AND CAST(spotter_archive.longitude as double precision) between ($origLon-$dist/ABS(cos(radians($origLat))*69)) and ($origLon+$dist/ABS(cos(radians($origLat))*69)) and CAST(spotter_archive.latitude as double precision) between ($origLat-($dist/69)) and ($origLat+($dist/69)) |
812 | 812 | AND (3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - ABS(CAST(spotter_archive.latitude as double precision)))*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(ABS(CAST(spotter_archive.latitude as double precision))*pi()/180)*POWER(SIN(($origLon-CAST(spotter_archive.longitude as double precision))*pi()/180/2),2)))) < $dist".$filter_query." ORDER BY distance"; |
813 | 813 | } else { |
@@ -821,12 +821,12 @@ discard block |
||
821 | 821 | $additional_query .= " AND (spotter_archive_output.waypoints <> '')"; |
822 | 822 | } |
823 | 823 | |
824 | - $query = "SELECT spotter_archive_output.* FROM spotter_archive_output |
|
824 | + $query = "SELECT spotter_archive_output.* FROM spotter_archive_output |
|
825 | 825 | WHERE spotter_archive_output.ident <> '' |
826 | 826 | ".$additional_query." |
827 | 827 | ".$filter_query.$orderby_query; |
828 | 828 | } |
829 | - $spotter_array = $Spotter->getDataFromDB($query, $query_values,$limit_query); |
|
829 | + $spotter_array = $Spotter->getDataFromDB($query, $query_values, $limit_query); |
|
830 | 830 | return $spotter_array; |
831 | 831 | } |
832 | 832 | |
@@ -841,7 +841,7 @@ discard block |
||
841 | 841 | try { |
842 | 842 | $sth = $this->db->prepare($query); |
843 | 843 | $sth->execute(); |
844 | - } catch(PDOException $e) { |
|
844 | + } catch (PDOException $e) { |
|
845 | 845 | return "error"; |
846 | 846 | } |
847 | 847 | } |
@@ -874,8 +874,8 @@ discard block |
||
874 | 874 | if ($limit != "") { |
875 | 875 | $limit_array = explode(",", $limit); |
876 | 876 | |
877 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
878 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
877 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
878 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
879 | 879 | |
880 | 880 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) { |
881 | 881 | //$limit_query = " LIMIT ".$limit_array[0].",".$limit_array[1]; |
@@ -913,7 +913,7 @@ discard block |
||
913 | 913 | $query_values = array(); |
914 | 914 | $limit_query = ''; |
915 | 915 | $additional_query = ''; |
916 | - $filter_query = $this->getFilter($filter,true,true); |
|
916 | + $filter_query = $this->getFilter($filter, true, true); |
|
917 | 917 | |
918 | 918 | if ($owner != "") { |
919 | 919 | if (!is_string($owner)) { |
@@ -927,8 +927,8 @@ discard block |
||
927 | 927 | if ($limit != "") { |
928 | 928 | $limit_array = explode(",", $limit); |
929 | 929 | |
930 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
931 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
930 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
931 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
932 | 932 | |
933 | 933 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) { |
934 | 934 | //$limit_query = " LIMIT ".$limit_array[0].",".$limit_array[1]; |
@@ -965,7 +965,7 @@ discard block |
||
965 | 965 | $query_values = array(); |
966 | 966 | $limit_query = ''; |
967 | 967 | $additional_query = ''; |
968 | - $filter_query = $this->getFilter($filter,true,true); |
|
968 | + $filter_query = $this->getFilter($filter, true, true); |
|
969 | 969 | |
970 | 970 | if ($pilot != "") { |
971 | 971 | $additional_query = " AND (spotter_archive_output.pilot_id = :pilot OR spotter_archive_output.pilot_name = :pilot)"; |
@@ -975,8 +975,8 @@ discard block |
||
975 | 975 | if ($limit != "") { |
976 | 976 | $limit_array = explode(",", $limit); |
977 | 977 | |
978 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
979 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
978 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
979 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
980 | 980 | |
981 | 981 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) { |
982 | 982 | //$limit_query = " LIMIT ".$limit_array[0].",".$limit_array[1]; |
@@ -1004,7 +1004,7 @@ discard block |
||
1004 | 1004 | * @return Array the airline country list |
1005 | 1005 | * |
1006 | 1006 | */ |
1007 | - public function countAllFlightOverCountries($limit = true,$olderthanmonths = 0,$sincedate = '') { |
|
1007 | + public function countAllFlightOverCountries($limit = true, $olderthanmonths = 0, $sincedate = '') { |
|
1008 | 1008 | global $globalDBdriver; |
1009 | 1009 | /* |
1010 | 1010 | $query = "SELECT c.name, c.iso3, c.iso2, count(c.name) as nb |
@@ -1032,7 +1032,7 @@ discard block |
||
1032 | 1032 | $flight_array = array(); |
1033 | 1033 | $temp_array = array(); |
1034 | 1034 | |
1035 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) { |
|
1035 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) { |
|
1036 | 1036 | $temp_array['flight_count'] = $row['nb']; |
1037 | 1037 | $temp_array['flight_country'] = $row['name']; |
1038 | 1038 | $temp_array['flight_country_iso3'] = $row['iso3']; |
@@ -1048,7 +1048,7 @@ discard block |
||
1048 | 1048 | * @return Array the airline country list |
1049 | 1049 | * |
1050 | 1050 | */ |
1051 | - public function countAllFlightOverCountriesByAirlines($limit = true,$olderthanmonths = 0,$sincedate = '') { |
|
1051 | + public function countAllFlightOverCountriesByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '') { |
|
1052 | 1052 | global $globalDBdriver; |
1053 | 1053 | /* |
1054 | 1054 | $query = "SELECT c.name, c.iso3, c.iso2, count(c.name) as nb |
@@ -1076,7 +1076,7 @@ discard block |
||
1076 | 1076 | $flight_array = array(); |
1077 | 1077 | $temp_array = array(); |
1078 | 1078 | |
1079 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) { |
|
1079 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) { |
|
1080 | 1080 | $temp_array['airline_icao'] = $row['airline_icao']; |
1081 | 1081 | $temp_array['flight_count'] = $row['nb']; |
1082 | 1082 | $temp_array['flight_country'] = $row['name']; |
@@ -1093,13 +1093,13 @@ discard block |
||
1093 | 1093 | * @return Array the spotter information |
1094 | 1094 | * |
1095 | 1095 | */ |
1096 | - public function getDateArchiveSpotterDataById($id,$date) { |
|
1096 | + public function getDateArchiveSpotterDataById($id, $date) { |
|
1097 | 1097 | $Spotter = new Spotter($this->db); |
1098 | 1098 | date_default_timezone_set('UTC'); |
1099 | 1099 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
1100 | - $query = 'SELECT spotter_archive.* FROM spotter_archive INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_archive l WHERE l.flightaware_id = :id AND l.date <= :date GROUP BY l.flightaware_id) s on spotter_archive.flightaware_id = s.flightaware_id AND spotter_archive.date = s.maxdate ORDER BY spotter_archive.date DESC'; |
|
1101 | - $date = date('c',$date); |
|
1102 | - $spotter_array = $Spotter->getDataFromDB($query,array(':id' => $id,':date' => $date)); |
|
1100 | + $query = 'SELECT spotter_archive.* FROM spotter_archive INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_archive l WHERE l.flightaware_id = :id AND l.date <= :date GROUP BY l.flightaware_id) s on spotter_archive.flightaware_id = s.flightaware_id AND spotter_archive.date = s.maxdate ORDER BY spotter_archive.date DESC'; |
|
1101 | + $date = date('c', $date); |
|
1102 | + $spotter_array = $Spotter->getDataFromDB($query, array(':id' => $id, ':date' => $date)); |
|
1103 | 1103 | return $spotter_array; |
1104 | 1104 | } |
1105 | 1105 | |
@@ -1109,13 +1109,13 @@ discard block |
||
1109 | 1109 | * @return Array the spotter information |
1110 | 1110 | * |
1111 | 1111 | */ |
1112 | - public function getDateArchiveSpotterDataByIdent($ident,$date) { |
|
1112 | + public function getDateArchiveSpotterDataByIdent($ident, $date) { |
|
1113 | 1113 | $Spotter = new Spotter($this->db); |
1114 | 1114 | date_default_timezone_set('UTC'); |
1115 | 1115 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
1116 | - $query = 'SELECT spotter_archive.* FROM spotter_archive INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_archive l WHERE l.ident = :ident AND l.date <= :date GROUP BY l.flightaware_id) s on spotter_archive.flightaware_id = s.flightaware_id AND spotter_archive.date = s.maxdate ORDER BY spotter_archive.date DESC'; |
|
1117 | - $date = date('c',$date); |
|
1118 | - $spotter_array = $Spotter->getDataFromDB($query,array(':ident' => $ident,':date' => $date)); |
|
1116 | + $query = 'SELECT spotter_archive.* FROM spotter_archive INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_archive l WHERE l.ident = :ident AND l.date <= :date GROUP BY l.flightaware_id) s on spotter_archive.flightaware_id = s.flightaware_id AND spotter_archive.date = s.maxdate ORDER BY spotter_archive.date DESC'; |
|
1117 | + $date = date('c', $date); |
|
1118 | + $spotter_array = $Spotter->getDataFromDB($query, array(':ident' => $ident, ':date' => $date)); |
|
1119 | 1119 | return $spotter_array; |
1120 | 1120 | } |
1121 | 1121 | |
@@ -1125,14 +1125,14 @@ discard block |
||
1125 | 1125 | * @return Array the spotter information |
1126 | 1126 | * |
1127 | 1127 | */ |
1128 | - public function getSpotterDataByAirport($airport = '', $limit = '', $sort = '',$filters = array()) { |
|
1128 | + public function getSpotterDataByAirport($airport = '', $limit = '', $sort = '', $filters = array()) { |
|
1129 | 1129 | global $global_query; |
1130 | 1130 | $Spotter = new Spotter($this->db); |
1131 | 1131 | date_default_timezone_set('UTC'); |
1132 | 1132 | $query_values = array(); |
1133 | 1133 | $limit_query = ''; |
1134 | 1134 | $additional_query = ''; |
1135 | - $filter_query = $this->getFilter($filters,true,true); |
|
1135 | + $filter_query = $this->getFilter($filters, true, true); |
|
1136 | 1136 | |
1137 | 1137 | if ($airport != "") { |
1138 | 1138 | if (!is_string($airport)) { |
@@ -1146,8 +1146,8 @@ discard block |
||
1146 | 1146 | if ($limit != "") { |
1147 | 1147 | $limit_array = explode(",", $limit); |
1148 | 1148 | |
1149 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
1150 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
1149 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
1150 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
1151 | 1151 | |
1152 | 1152 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) { |
1153 | 1153 | //$limit_query = " LIMIT ".$limit_array[0].",".$limit_array[1]; |
@@ -59,11 +59,11 @@ discard block |
||
59 | 59 | $s3 = sin($bank/2); |
60 | 60 | $c1c2 = $c1*$c2; |
61 | 61 | $s1s2 = $s1*$s2; |
62 | - $w =$c1c2*$c3 - $s1s2*$s3; |
|
63 | - $x =$c1c2*$s3 + $s1s2*$c3; |
|
64 | - $y =$s1*$c2*$c3 + $c1*$s2*$s3; |
|
65 | - $z =$c1*$s2*$c3 - $s1*$c2*$s3; |
|
66 | - return array('x' => $x,'y' => $y,'z' => $z,'w' => $w); |
|
62 | + $w = $c1c2*$c3 - $s1s2*$s3; |
|
63 | + $x = $c1c2*$s3 + $s1s2*$c3; |
|
64 | + $y = $s1*$c2*$c3 + $c1*$s2*$s3; |
|
65 | + $z = $c1*$s2*$c3 - $s1*$c2*$s3; |
|
66 | + return array('x' => $x, 'y' => $y, 'z' => $z, 'w' => $w); |
|
67 | 67 | // return array('x' => '0.0','y' => '-0.931','z' => '0.0','w' => '0.365'); |
68 | 68 | |
69 | 69 | } |
@@ -84,17 +84,17 @@ discard block |
||
84 | 84 | $min = false; |
85 | 85 | $allhistory = false; |
86 | 86 | $filter['source'] = array(); |
87 | -if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') $filter['source'] = array_merge($filter['source'],array('vatsimtxt')); |
|
88 | -if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') $filter['source'] = array_merge($filter['source'],array('whazzup')); |
|
89 | -if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') $filter['source'] = array_merge($filter['source'],array('phpvmacars')); |
|
90 | -if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') $filter['source'] = array_merge($filter['source'],array('sbs','famaprs')); |
|
91 | -if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') $filter['source'] = array_merge($filter['source'],array('aprs')); |
|
92 | -if (isset($_COOKIE['filter_ident']) && $_COOKIE['filter_ident'] != '') $filter['ident'] = filter_var($_COOKIE['filter_ident'],FILTER_SANITIZE_STRING); |
|
93 | -if (isset($_COOKIE['filter_mmsi']) && $_COOKIE['filter_mmsi'] != '') $filter['mmsi'] = filter_var($_COOKIE['filter_mmsi'],FILTER_SANITIZE_STRING); |
|
94 | -if (isset($_COOKIE['filter_Airlines']) && $_COOKIE['filter_Airlines'] != '') $filter['airlines'] = filter_var_array(explode(',',$_COOKIE['filter_Airlines']),FILTER_SANITIZE_STRING); |
|
95 | -if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') $filter['source_aprs'] = filter_var_array(explode(',',$_COOKIE['filter_Sources']),FILTER_SANITIZE_STRING); |
|
96 | -if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') $filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'],FILTER_SANITIZE_STRING); |
|
97 | -if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] != 'all') $filter['alliance'] = filter_var($_COOKIE['filter_alliance'],FILTER_SANITIZE_STRING); |
|
87 | +if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') $filter['source'] = array_merge($filter['source'], array('vatsimtxt')); |
|
88 | +if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') $filter['source'] = array_merge($filter['source'], array('whazzup')); |
|
89 | +if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') $filter['source'] = array_merge($filter['source'], array('phpvmacars')); |
|
90 | +if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') $filter['source'] = array_merge($filter['source'], array('sbs', 'famaprs')); |
|
91 | +if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') $filter['source'] = array_merge($filter['source'], array('aprs')); |
|
92 | +if (isset($_COOKIE['filter_ident']) && $_COOKIE['filter_ident'] != '') $filter['ident'] = filter_var($_COOKIE['filter_ident'], FILTER_SANITIZE_STRING); |
|
93 | +if (isset($_COOKIE['filter_mmsi']) && $_COOKIE['filter_mmsi'] != '') $filter['mmsi'] = filter_var($_COOKIE['filter_mmsi'], FILTER_SANITIZE_STRING); |
|
94 | +if (isset($_COOKIE['filter_Airlines']) && $_COOKIE['filter_Airlines'] != '') $filter['airlines'] = filter_var_array(explode(',', $_COOKIE['filter_Airlines']), FILTER_SANITIZE_STRING); |
|
95 | +if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') $filter['source_aprs'] = filter_var_array(explode(',', $_COOKIE['filter_Sources']), FILTER_SANITIZE_STRING); |
|
96 | +if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') $filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'], FILTER_SANITIZE_STRING); |
|
97 | +if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] != 'all') $filter['alliance'] = filter_var($_COOKIE['filter_alliance'], FILTER_SANITIZE_STRING); |
|
98 | 98 | /* |
99 | 99 | if (isset($globalMapPopup) && !$globalMapPopup && !(isset($_COOKIE['flightpopup']) && $_COOKIE['flightpopup'] == 'true')) { |
100 | 100 | $min = true; |
@@ -141,12 +141,12 @@ discard block |
||
141 | 141 | $from_archive = true; |
142 | 142 | // $begindate = filter_input(INPUT_GET,'begindate',FILTER_VALIDATE_REGEXP,array("options"=>array("regexp"=>'~^\d{4}/\d{2}/\d{2}$~'))); |
143 | 143 | // $enddate = filter_input(INPUT_GET,'enddate',FILTER_VALIDATE_REGEXP,array("options"=>array("regexp"=>'~^\d{4}/\d{2}/\d{2}$~'))); |
144 | - $begindate = filter_input(INPUT_GET,'begindate',FILTER_SANITIZE_NUMBER_INT); |
|
145 | - $enddate = filter_input(INPUT_GET,'enddate',FILTER_SANITIZE_NUMBER_INT); |
|
146 | - $archivespeed = filter_input(INPUT_GET,'speed',FILTER_SANITIZE_NUMBER_INT); |
|
147 | - $begindate = date('Y-m-d H:i:s',$begindate); |
|
148 | - $enddate = date('Y-m-d H:i:s',$enddate); |
|
149 | - $spotter_array = $SpotterArchive->getMinLiveSpotterDataPlayback($begindate,$enddate,$filter); |
|
144 | + $begindate = filter_input(INPUT_GET, 'begindate', FILTER_SANITIZE_NUMBER_INT); |
|
145 | + $enddate = filter_input(INPUT_GET, 'enddate', FILTER_SANITIZE_NUMBER_INT); |
|
146 | + $archivespeed = filter_input(INPUT_GET, 'speed', FILTER_SANITIZE_NUMBER_INT); |
|
147 | + $begindate = date('Y-m-d H:i:s', $begindate); |
|
148 | + $enddate = date('Y-m-d H:i:s', $enddate); |
|
149 | + $spotter_array = $SpotterArchive->getMinLiveSpotterDataPlayback($begindate, $enddate, $filter); |
|
150 | 150 | } elseif (isset($_COOKIE['archive']) && isset($_COOKIE['archive_begin']) && isset($_COOKIE['archive_end']) && isset($_COOKIE['archive_speed'])) { |
151 | 151 | $from_archive = true; |
152 | 152 | // $begindate = filter_input(INPUT_GET,'begindate',FILTER_VALIDATE_REGEXP,array("options"=>array("regexp"=>'~^\d{4}/\d{2}/\d{2}$~'))); |
@@ -156,55 +156,55 @@ discard block |
||
156 | 156 | $begindate = $_COOKIE['archive_begin']; |
157 | 157 | $enddate = $_COOKIE['archive_end']; |
158 | 158 | |
159 | - $archivespeed = filter_var($_COOKIE['archive_speed'],FILTER_SANITIZE_NUMBER_INT); |
|
160 | - $begindate = date('Y-m-d H:i:s',$begindate); |
|
161 | - $enddate = date('Y-m-d H:i:s',$enddate); |
|
159 | + $archivespeed = filter_var($_COOKIE['archive_speed'], FILTER_SANITIZE_NUMBER_INT); |
|
160 | + $begindate = date('Y-m-d H:i:s', $begindate); |
|
161 | + $enddate = date('Y-m-d H:i:s', $enddate); |
|
162 | 162 | //echo 'Begin : '.$begindate.' - End : '.$enddate."\n"; |
163 | - $spotter_array = $SpotterArchive->getMinLiveSpotterData($begindate,$enddate,$filter); |
|
163 | + $spotter_array = $SpotterArchive->getMinLiveSpotterData($begindate, $enddate, $filter); |
|
164 | 164 | } elseif ($tracker) { |
165 | 165 | $coord = array(); |
166 | 166 | if (isset($_GET['coord']) && $_GET['coord'] != '') { |
167 | - $coord = explode(',',$_GET['coord']); |
|
168 | - if (!(filter_var($coord[0],FILTER_VALIDATE_FLOAT) && filter_var($coord[1],FILTER_VALIDATE_FLOAT) && filter_var($coord[2],FILTER_VALIDATE_FLOAT) && filter_var($coord[3],FILTER_VALIDATE_FLOAT) |
|
167 | + $coord = explode(',', $_GET['coord']); |
|
168 | + if (!(filter_var($coord[0], FILTER_VALIDATE_FLOAT) && filter_var($coord[1], FILTER_VALIDATE_FLOAT) && filter_var($coord[2], FILTER_VALIDATE_FLOAT) && filter_var($coord[3], FILTER_VALIDATE_FLOAT) |
|
169 | 169 | && $coord[0] > -180.0 && $coord[0] < 180.0 && $coord[1] > -90.0 && $coord[1] < 90.0 && $coord[2] > -180.0 && $coord[2] < 180.0 && $coord[3] > -90.0 && $coord[3] < 90.0)) { |
170 | 170 | $coord = array(); |
171 | 171 | } |
172 | 172 | } |
173 | - $spotter_array = $TrackerLive->getMinLastLiveTrackerData($coord,$filter,true); |
|
173 | + $spotter_array = $TrackerLive->getMinLastLiveTrackerData($coord, $filter, true); |
|
174 | 174 | } elseif ($marine) { |
175 | 175 | $coord = array(); |
176 | 176 | if (isset($_GET['coord']) && $_GET['coord'] != '') { |
177 | - $coord = explode(',',$_GET['coord']); |
|
178 | - if (!(filter_var($coord[0],FILTER_VALIDATE_FLOAT) && filter_var($coord[1],FILTER_VALIDATE_FLOAT) && filter_var($coord[2],FILTER_VALIDATE_FLOAT) && filter_var($coord[3],FILTER_VALIDATE_FLOAT) |
|
177 | + $coord = explode(',', $_GET['coord']); |
|
178 | + if (!(filter_var($coord[0], FILTER_VALIDATE_FLOAT) && filter_var($coord[1], FILTER_VALIDATE_FLOAT) && filter_var($coord[2], FILTER_VALIDATE_FLOAT) && filter_var($coord[3], FILTER_VALIDATE_FLOAT) |
|
179 | 179 | && $coord[0] > -180.0 && $coord[0] < 180.0 && $coord[1] > -90.0 && $coord[1] < 90.0 && $coord[2] > -180.0 && $coord[2] < 180.0 && $coord[3] > -90.0 && $coord[3] < 90.0)) { |
180 | 180 | $coord = array(); |
181 | 181 | } |
182 | 182 | } |
183 | - $spotter_array = $MarineLive->getMinLastLiveMarineData($coord,$filter,true); |
|
183 | + $spotter_array = $MarineLive->getMinLastLiveMarineData($coord, $filter, true); |
|
184 | 184 | } else { |
185 | 185 | $coord = array(); |
186 | 186 | if (!((isset($_COOKIE['singlemodel']) && $_COOKIE['singlemodel'] == 'true') && (isset($_COOKIE['MapTrack']) && $_COOKIE['MapTrack'] != '')) && isset($_GET['coord']) && $_GET['coord'] != '') { |
187 | - $coord = explode(',',$_GET['coord']); |
|
188 | - if (!(filter_var($coord[0],FILTER_VALIDATE_FLOAT) && filter_var($coord[1],FILTER_VALIDATE_FLOAT) && filter_var($coord[2],FILTER_VALIDATE_FLOAT) && filter_var($coord[3],FILTER_VALIDATE_FLOAT) |
|
187 | + $coord = explode(',', $_GET['coord']); |
|
188 | + if (!(filter_var($coord[0], FILTER_VALIDATE_FLOAT) && filter_var($coord[1], FILTER_VALIDATE_FLOAT) && filter_var($coord[2], FILTER_VALIDATE_FLOAT) && filter_var($coord[3], FILTER_VALIDATE_FLOAT) |
|
189 | 189 | && $coord[0] > -180.0 && $coord[0] < 180.0 && $coord[1] > -90.0 && $coord[1] < 90.0 && $coord[2] > -180.0 && $coord[2] < 180.0 && $coord[3] > -90.0 && $coord[3] < 90.0)) { |
190 | 190 | $coord = array(); |
191 | 191 | } |
192 | 192 | } |
193 | 193 | $previous_filter = $filter; |
194 | 194 | if ((isset($_COOKIE['singlemodel']) && $_COOKIE['singlemodel'] == 'true') && (isset($_COOKIE['MapTrack']) && $_COOKIE['MapTrack'] != '')) { |
195 | - $filter = array_merge($filter,array('id' => $_COOKIE['MapTrack'])); |
|
196 | - $spotter_array = $SpotterLive->getMinLastLiveSpotterData($coord,$filter,true); |
|
195 | + $filter = array_merge($filter, array('id' => $_COOKIE['MapTrack'])); |
|
196 | + $spotter_array = $SpotterLive->getMinLastLiveSpotterData($coord, $filter, true); |
|
197 | 197 | } elseif (isset($_COOKIE['MapTrack']) && $_COOKIE['MapTrack'] != '' && !empty($coord)) { |
198 | - $spotter_array = $SpotterLive->getMinLastLiveSpotterData($coord,$filter,true,$_COOKIE['MapTrack']); |
|
198 | + $spotter_array = $SpotterLive->getMinLastLiveSpotterData($coord, $filter, true, $_COOKIE['MapTrack']); |
|
199 | 199 | } else { |
200 | - $spotter_array = $SpotterLive->getMinLastLiveSpotterData($coord,$filter,true); |
|
200 | + $spotter_array = $SpotterLive->getMinLastLiveSpotterData($coord, $filter, true); |
|
201 | 201 | } |
202 | 202 | $filter = $previous_filter; |
203 | 203 | } |
204 | 204 | //print_r($spotter_array); |
205 | 205 | if (!empty($spotter_array) && isset($coord)) { |
206 | 206 | if (isset($_GET['archive'])) { |
207 | - $flightcnt = $SpotterArchive->getLiveSpotterCount($begindate,$enddate,$filter); |
|
207 | + $flightcnt = $SpotterArchive->getLiveSpotterCount($begindate, $enddate, $filter); |
|
208 | 208 | } elseif ($tracker) { |
209 | 209 | $flightcnt = $TrackerLive->getLiveTrackerCount($filter); |
210 | 210 | } elseif ($marine) { |
@@ -215,17 +215,17 @@ discard block |
||
215 | 215 | if ($flightcnt == '') $flightcnt = 0; |
216 | 216 | } else $flightcnt = 0; |
217 | 217 | |
218 | -$sqltime = round(microtime(true)-$begintime,2); |
|
218 | +$sqltime = round(microtime(true) - $begintime, 2); |
|
219 | 219 | $minitime = time(); |
220 | 220 | $minitracktime_begin = time(); |
221 | 221 | $minitracktime = $minitracktime_begin; |
222 | 222 | $maxitime = 0; |
223 | -$lastupdate = filter_input(INPUT_GET,'update',FILTER_SANITIZE_NUMBER_INT); |
|
223 | +$lastupdate = filter_input(INPUT_GET, 'update', FILTER_SANITIZE_NUMBER_INT); |
|
224 | 224 | $modelsdb = array(); |
225 | 225 | if (file_exists(dirname(__FILE__).'/models/modelsdb')) { |
226 | - if (($handle = fopen(dirname(__FILE__).'/models/modelsdb','r')) !== FALSE) { |
|
227 | - while (($row = fgetcsv($handle,1000)) !== FALSE) { |
|
228 | - if (isset($row[1]) ){ |
|
226 | + if (($handle = fopen(dirname(__FILE__).'/models/modelsdb', 'r')) !== FALSE) { |
|
227 | + while (($row = fgetcsv($handle, 1000)) !== FALSE) { |
|
228 | + if (isset($row[1])) { |
|
229 | 229 | $model = $row[0]; |
230 | 230 | $modelsdb[$model] = $row[1]; |
231 | 231 | } |
@@ -235,9 +235,9 @@ discard block |
||
235 | 235 | } |
236 | 236 | $modelsdb2 = array(); |
237 | 237 | if (file_exists(dirname(__FILE__).'/models/gltf2/modelsdb')) { |
238 | - if (($handle = fopen(dirname(__FILE__).'/models/gltf2/modelsdb','r')) !== FALSE) { |
|
239 | - while (($row = fgetcsv($handle,1000)) !== FALSE) { |
|
240 | - if (isset($row[1]) ){ |
|
238 | + if (($handle = fopen(dirname(__FILE__).'/models/gltf2/modelsdb', 'r')) !== FALSE) { |
|
239 | + while (($row = fgetcsv($handle, 1000)) !== FALSE) { |
|
240 | + if (isset($row[1])) { |
|
241 | 241 | $model = $row[0]; |
242 | 242 | $glb = $row[1]; |
243 | 243 | if (isset($row[2])) { |
@@ -281,7 +281,7 @@ discard block |
||
281 | 281 | if (!empty($spotter_array) && is_array($spotter_array)) |
282 | 282 | { |
283 | 283 | $nblatlong = 0; |
284 | - foreach($spotter_array as $spotter_item) |
|
284 | + foreach ($spotter_array as $spotter_item) |
|
285 | 285 | { |
286 | 286 | $j++; |
287 | 287 | //if (isset($spotter_item['format_source']) && $spotter_item['format_source'] == 'airwhere') $heightrelative = 'RELATIVE_TO_GROUND'; |
@@ -323,9 +323,9 @@ discard block |
||
323 | 323 | $output .= '"lastupdate": "'.$lastupdate.'",'; |
324 | 324 | if (isset($spotter_item['format_source'])) $output .= '"format": "'.$spotter_item['format_source'].'",'; |
325 | 325 | if ($tracker) { |
326 | - $output.= '"type": "tracker"'; |
|
326 | + $output .= '"type": "tracker"'; |
|
327 | 327 | } elseif ($marine) { |
328 | - $output.= '"type": "marine"'; |
|
328 | + $output .= '"type": "marine"'; |
|
329 | 329 | } else { |
330 | 330 | if ($one3dmodel === false && isset($globalMap3DLiveries) && $globalMap3DLiveries) { |
331 | 331 | $aircraft_icao = $spotter_item['aircraft_icao']; |
@@ -339,14 +339,14 @@ discard block |
||
339 | 339 | if (isset($airline_icao)) { |
340 | 340 | $imagefile = $aircraft_icao.'-'.$airline_icao.'.png'; |
341 | 341 | if (file_exists(dirname(__FILE__).'/models/gltf2/liveries/'.$imagefile)) { |
342 | - $output.= '"liveries": "'.$globalURL.'/models/gltf2/liveries/'.$imagefile.'",'; |
|
342 | + $output .= '"liveries": "'.$globalURL.'/models/gltf2/liveries/'.$imagefile.'",'; |
|
343 | 343 | } |
344 | 344 | } |
345 | 345 | } |
346 | - if ($ident != '') $output.= '"ident": "'.$ident.'",'; |
|
346 | + if ($ident != '') $output .= '"ident": "'.$ident.'",'; |
|
347 | 347 | } |
348 | - $output.= '"gltf2": %gltf2%,'; |
|
349 | - $output.= '"type": "flight"'; |
|
348 | + $output .= '"gltf2": %gltf2%,'; |
|
349 | + $output .= '"type": "flight"'; |
|
350 | 350 | } |
351 | 351 | $output .= '},'; |
352 | 352 | |
@@ -717,8 +717,8 @@ discard block |
||
717 | 717 | $output .= '},'; |
718 | 718 | } |
719 | 719 | } |
720 | - if (isset($onground) && $onground) $output = str_replace('%onground%','true',$output); |
|
721 | - else $output = str_replace('%onground%','false',$output); |
|
720 | + if (isset($onground) && $onground) $output = str_replace('%onground%', 'true', $output); |
|
721 | + else $output = str_replace('%onground%', 'false', $output); |
|
722 | 722 | |
723 | 723 | // $output .= '"heightReference": "CLAMP_TO_GROUND",'; |
724 | 724 | //$output .= '"heightReference": "'.$heightrelative.'",'; |
@@ -734,7 +734,7 @@ discard block |
||
734 | 734 | if ($minitime > strtotime($spotter_item['date'])) $minitime = strtotime($spotter_item['date']); |
735 | 735 | if (isset($_COOKIE['MapTrack']) && $id == $_COOKIE['MapTrack'] && $minitracktime > strtotime($spotter_item['date'])) $minitracktime = strtotime($spotter_item['date']); |
736 | 736 | if ($maxitime < strtotime($spotter_item['date'])) $maxitime = strtotime($spotter_item['date']); |
737 | - $output .= '"'.date("c",strtotime($spotter_item['date'])).'", '; |
|
737 | + $output .= '"'.date("c", strtotime($spotter_item['date'])).'", '; |
|
738 | 738 | $output .= $spotter_item['longitude'].', '; |
739 | 739 | $output .= $spotter_item['latitude']; |
740 | 740 | $prevlong = $spotter_item['longitude']; |
@@ -762,8 +762,8 @@ discard block |
||
762 | 762 | //$quat = quaternionrotate(deg2rad($spotter_item['heading']),deg2rad(0),deg2rad(0)); |
763 | 763 | //$orientation .= '"'.date("c",strtotime($spotter_item['date'])).'",'.$quat['x'].','.$quat['y'].','.$quat['z'].','.$quat['w']; |
764 | 764 | } else { |
765 | - $nblatlong = $nblatlong+1; |
|
766 | - $output .= ',"'.date("c",strtotime($spotter_item['date'])).'", '; |
|
765 | + $nblatlong = $nblatlong + 1; |
|
766 | + $output .= ',"'.date("c", strtotime($spotter_item['date'])).'", '; |
|
767 | 767 | if ($maxitime < strtotime($spotter_item['date'])) $maxitime = strtotime($spotter_item['date']); |
768 | 768 | if ($spotter_item['ground_speed'] == 0) { |
769 | 769 | $output .= $prevlong.', '; |
@@ -803,21 +803,21 @@ discard block |
||
803 | 803 | } |
804 | 804 | $output .= ']'; |
805 | 805 | if (isset($globalArchive) && $globalArchive === TRUE) { |
806 | - if ((time()-$globalLiveInterval) > $minitime) { |
|
807 | - if (time()-$globalLiveInterval > $maxitime) { |
|
808 | - $output = str_replace('%minitime%',date("c",$maxitime),$output); |
|
806 | + if ((time() - $globalLiveInterval) > $minitime) { |
|
807 | + if (time() - $globalLiveInterval > $maxitime) { |
|
808 | + $output = str_replace('%minitime%', date("c", $maxitime), $output); |
|
809 | 809 | } else { |
810 | - $output = str_replace('%minitime%',date("c",time()-$globalLiveInterval),$output); |
|
810 | + $output = str_replace('%minitime%', date("c", time() - $globalLiveInterval), $output); |
|
811 | 811 | } |
812 | 812 | } |
813 | - else $output = str_replace('%minitime%',date("c",$minitime),$output); |
|
813 | + else $output = str_replace('%minitime%', date("c", $minitime), $output); |
|
814 | 814 | } elseif (isset($_COOKIE['MapTrack']) && $_COOKIE['MapTrack'] != '' && $minitracktime != $minitracktime_begin) { |
815 | - $output = str_replace('%minitime%',date("c",$minitracktime),$output); |
|
815 | + $output = str_replace('%minitime%', date("c", $minitracktime), $output); |
|
816 | 816 | } else { |
817 | - $output = str_replace('%minitime%',date("c",$minitime),$output); |
|
817 | + $output = str_replace('%minitime%', date("c", $minitime), $output); |
|
818 | 818 | } |
819 | -$output = str_replace('%maxitime%',date("c",$maxitime),$output); |
|
820 | -if ($gltf2) $output = str_replace('%gltf2%','true',$output); |
|
821 | -else $output = str_replace('%gltf2%','false',$output); |
|
819 | +$output = str_replace('%maxitime%', date("c", $maxitime), $output); |
|
820 | +if ($gltf2) $output = str_replace('%gltf2%', 'true', $output); |
|
821 | +else $output = str_replace('%gltf2%', 'false', $output); |
|
822 | 822 | print $output; |
823 | 823 | ?> |