@@ -14,7 +14,7 @@ |
||
14 | 14 | /** |
15 | 15 | * Get SQL query part for filter used |
16 | 16 | * @param Array $filter the filter |
17 | - * @return Array the SQL part |
|
17 | + * @return string the SQL part |
|
18 | 18 | */ |
19 | 19 | public function getFilter($filter = array(),$where = false,$and = false) { |
20 | 20 | global $globalFilter, $globalStatsFilters, $globalFilterName, $globalDBdriver; |
@@ -8,7 +8,9 @@ discard block |
||
8 | 8 | public function __construct($dbc = null) { |
9 | 9 | $Connection = new Connection($dbc); |
10 | 10 | $this->db = $Connection->db(); |
11 | - if ($this->db === null) die('Error: No DB connection. (SpotterLive)'); |
|
11 | + if ($this->db === null) { |
|
12 | + die('Error: No DB connection. (SpotterLive)'); |
|
13 | + } |
|
12 | 14 | } |
13 | 15 | |
14 | 16 | |
@@ -30,7 +32,9 @@ discard block |
||
30 | 32 | if (isset($filter[0]['source'])) { |
31 | 33 | $filters = array_merge($filters,$filter); |
32 | 34 | } |
33 | - if (is_array($globalFilter)) $filter = array_merge($filter,$globalFilter); |
|
35 | + if (is_array($globalFilter)) { |
|
36 | + $filter = array_merge($filter,$globalFilter); |
|
37 | + } |
|
34 | 38 | $filter_query_join = ''; |
35 | 39 | $filter_query_where = ''; |
36 | 40 | foreach($filters as $flt) { |
@@ -123,8 +127,11 @@ discard block |
||
123 | 127 | if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) { |
124 | 128 | $filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')"; |
125 | 129 | } |
126 | - if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE'; |
|
127 | - elseif ($filter_query_where != '' && $and) $filter_query_where .= ' AND'; |
|
130 | + if ($filter_query_where == '' && $where) { |
|
131 | + $filter_query_where = ' WHERE'; |
|
132 | + } elseif ($filter_query_where != '' && $and) { |
|
133 | + $filter_query_where .= ' AND'; |
|
134 | + } |
|
128 | 135 | if ($filter_query_where != '') { |
129 | 136 | $filter_query_where = preg_replace('/^ AND/',' WHERE',$filter_query_where); |
130 | 137 | } |
@@ -165,9 +172,13 @@ discard block |
||
165 | 172 | $orderby_query = ' '.$search_orderby_array[$sort]['sql']; |
166 | 173 | } |
167 | 174 | } |
168 | - if ($orderby_query == '') $orderby_query = ' ORDER BY date DESC'; |
|
175 | + if ($orderby_query == '') { |
|
176 | + $orderby_query = ' ORDER BY date DESC'; |
|
177 | + } |
|
169 | 178 | |
170 | - if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
|
179 | + if (!isset($globalLiveInterval)) { |
|
180 | + $globalLiveInterval = '200'; |
|
181 | + } |
|
171 | 182 | if ($globalDBdriver == 'mysql') { |
172 | 183 | //$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 30 SECOND) <= l.date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate"; |
173 | 184 | $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'.$filter_query.$orderby_query; |
@@ -190,7 +201,9 @@ discard block |
||
190 | 201 | global $globalDBdriver, $globalLiveInterval, $globalArchive; |
191 | 202 | date_default_timezone_set('UTC'); |
192 | 203 | $filter_query = $this->getFilter($filter,true,true); |
193 | - if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
|
204 | + if (!isset($globalLiveInterval)) { |
|
205 | + $globalLiveInterval = '200'; |
|
206 | + } |
|
194 | 207 | if ($globalDBdriver == 'mysql') { |
195 | 208 | if (isset($globalArchive) && $globalArchive === TRUE) { |
196 | 209 | $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, spotter_live.date, spotter_live.format_source |
@@ -240,8 +253,12 @@ discard block |
||
240 | 253 | } |
241 | 254 | $filter_query = $this->getFilter($filter,true,true); |
242 | 255 | |
243 | - if (!isset($globalLiveInterval) || $globalLiveInterval == '') $globalLiveInterval = '200'; |
|
244 | - if (!isset($globalMap3DAircraftsLimit) || $globalMap3DAircraftsLimit == '') $globalMap3DAircraftsLimit = '300'; |
|
256 | + if (!isset($globalLiveInterval) || $globalLiveInterval == '') { |
|
257 | + $globalLiveInterval = '200'; |
|
258 | + } |
|
259 | + if (!isset($globalMap3DAircraftsLimit) || $globalMap3DAircraftsLimit == '') { |
|
260 | + $globalMap3DAircraftsLimit = '300'; |
|
261 | + } |
|
245 | 262 | if ($globalDBdriver == 'mysql') { |
246 | 263 | if (isset($globalArchive) && $globalArchive === TRUE) { |
247 | 264 | /* |
@@ -252,22 +269,32 @@ discard block |
||
252 | 269 | */ |
253 | 270 | $query = 'SELECT * FROM (SELECT spotter_archive.ident, spotter_archive.flightaware_id, 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, spotter_archive.date, spotter_archive.format_source |
254 | 271 | FROM spotter_archive INNER JOIN (SELECT flightaware_id FROM spotter_live'.$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval." SECOND) <= spotter_live.date) l ON l.flightaware_id = spotter_archive.flightaware_id "; |
255 | - if ($usecoord) $query .= "AND spotter_archive.latitude BETWEEN ".$minlat." AND ".$maxlat." AND spotter_archive.longitude BETWEEN ".$minlong." AND ".$maxlong." "; |
|
272 | + if ($usecoord) { |
|
273 | + $query .= "AND spotter_archive.latitude BETWEEN ".$minlat." AND ".$maxlat." AND spotter_archive.longitude BETWEEN ".$minlong." AND ".$maxlong." "; |
|
274 | + } |
|
256 | 275 | $query .= "UNION |
257 | 276 | 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, spotter_live.date, spotter_live.format_source |
258 | 277 | FROM spotter_live".$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval." SECOND) <= spotter_live.date"; |
259 | - if ($usecoord) $query .= " AND spotter_live.latitude BETWEEN ".$minlat." AND ".$maxlat." AND spotter_live.longitude BETWEEN ".$minlong." AND ".$maxlong; |
|
278 | + if ($usecoord) { |
|
279 | + $query .= " AND spotter_live.latitude BETWEEN ".$minlat." AND ".$maxlat." AND spotter_live.longitude BETWEEN ".$minlong." AND ".$maxlong; |
|
280 | + } |
|
260 | 281 | $query .= ") AS spotter |
261 | 282 | WHERE latitude <> '0' AND longitude <> '0' |
262 | 283 | ORDER BY flightaware_id, date"; |
263 | - if ($limit) $query .= " LIMIT ".$globalMap3DAircraftsLimit; |
|
284 | + if ($limit) { |
|
285 | + $query .= " LIMIT ".$globalMap3DAircraftsLimit; |
|
286 | + } |
|
264 | 287 | } else { |
265 | 288 | $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, spotter_live.date, spotter_live.format_source |
266 | 289 | FROM spotter_live'.$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval." SECOND) <= spotter_live.date "; |
267 | - if ($usecoord) $query .= "AND spotter_live.latitude BETWEEN ".$minlat." AND ".$maxlat." AND spotter_live.longitude BETWEEN ".$minlong." AND ".$maxlong." "; |
|
290 | + if ($usecoord) { |
|
291 | + $query .= "AND spotter_live.latitude BETWEEN ".$minlat." AND ".$maxlat." AND spotter_live.longitude BETWEEN ".$minlong." AND ".$maxlong." "; |
|
292 | + } |
|
268 | 293 | $query .= "AND spotter_live.latitude <> '0' AND spotter_live.longitude <> '0' |
269 | 294 | ORDER BY spotter_live.flightaware_id, spotter_live.date"; |
270 | - if ($limit) $query .= " LIMIT ".$globalMap3DAircraftsLimit; |
|
295 | + if ($limit) { |
|
296 | + $query .= " LIMIT ".$globalMap3DAircraftsLimit; |
|
297 | + } |
|
271 | 298 | } |
272 | 299 | } else { |
273 | 300 | if (isset($globalArchive) && $globalArchive === TRUE) { |
@@ -279,21 +306,31 @@ discard block |
||
279 | 306 | */ |
280 | 307 | $query = "SELECT * FROM (SELECT spotter_archive.ident, spotter_archive.flightaware_id, 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, spotter_archive.date, spotter_archive.format_source |
281 | 308 | FROM spotter_archive INNER JOIN (SELECT flightaware_id FROM spotter_live".$filter_query." CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= spotter_live.date) l ON l.flightaware_id = spotter_archive.flightaware_id "; |
282 | - if ($usecoord) $query .= "AND spotter_archive.latitude BETWEEN ".$minlat." AND ".$maxlat." AND spotter_archive.longitude BETWEEN ".$minlong." AND ".$maxlong." "; |
|
309 | + if ($usecoord) { |
|
310 | + $query .= "AND spotter_archive.latitude BETWEEN ".$minlat." AND ".$maxlat." AND spotter_archive.longitude BETWEEN ".$minlong." AND ".$maxlong." "; |
|
311 | + } |
|
283 | 312 | $query .= "UNION |
284 | 313 | 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, spotter_live.date, spotter_live.format_source |
285 | 314 | FROM spotter_live".$filter_query." CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= spotter_live.date"; |
286 | - if ($usecoord) $query .= " AND spotter_live.latitude BETWEEN ".$minlat." AND ".$maxlat." AND spotter_live.longitude BETWEEN ".$minlong." AND ".$maxlong; |
|
315 | + if ($usecoord) { |
|
316 | + $query .= " AND spotter_live.latitude BETWEEN ".$minlat." AND ".$maxlat." AND spotter_live.longitude BETWEEN ".$minlong." AND ".$maxlong; |
|
317 | + } |
|
287 | 318 | $query .= ") AS spotter WHERE latitude <> '0' AND longitude <> '0' "; |
288 | 319 | $query .= "ORDER BY flightaware_id, date"; |
289 | - if ($limit) $query .= " LIMIT ".$globalMap3DAircraftsLimit; |
|
320 | + if ($limit) { |
|
321 | + $query .= " LIMIT ".$globalMap3DAircraftsLimit; |
|
322 | + } |
|
290 | 323 | } else { |
291 | 324 | $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, spotter_live.date, spotter_live.format_source |
292 | 325 | FROM spotter_live".$filter_query." CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= spotter_live.date "; |
293 | - if ($usecoord) $query .= "AND spotter_live.latitude BETWEEN ".$minlat." AND ".$maxlat." AND spotter_live.longitude BETWEEN ".$minlong." AND ".$maxlong." "; |
|
326 | + if ($usecoord) { |
|
327 | + $query .= "AND spotter_live.latitude BETWEEN ".$minlat." AND ".$maxlat." AND spotter_live.longitude BETWEEN ".$minlong." AND ".$maxlong." "; |
|
328 | + } |
|
294 | 329 | $query .= "AND spotter_live.latitude <> '0' AND spotter_live.longitude <> '0' |
295 | 330 | ORDER BY spotter_live.flightaware_id, spotter_live.date"; |
296 | - if ($limit) $query .= " LIMIT ".$globalMap3DAircraftsLimit; |
|
331 | + if ($limit) { |
|
332 | + $query .= " LIMIT ".$globalMap3DAircraftsLimit; |
|
333 | + } |
|
297 | 334 | } |
298 | 335 | } |
299 | 336 | try { |
@@ -318,7 +355,9 @@ discard block |
||
318 | 355 | global $globalDBdriver, $globalLiveInterval; |
319 | 356 | $filter_query = $this->getFilter($filter,true,true); |
320 | 357 | |
321 | - if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
|
358 | + if (!isset($globalLiveInterval)) { |
|
359 | + $globalLiveInterval = '200'; |
|
360 | + } |
|
322 | 361 | if ($globalDBdriver == 'mysql') { |
323 | 362 | //$query = 'SELECT COUNT(*) as nb 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; |
324 | 363 | $query = 'SELECT COUNT(DISTINCT spotter_live.flightaware_id) as nb FROM spotter_live'.$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= date'; |
@@ -348,7 +387,9 @@ discard block |
||
348 | 387 | { |
349 | 388 | global $globalDBdriver, $globalLiveInterval; |
350 | 389 | $Spotter = new Spotter($this->db); |
351 | - if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
|
390 | + if (!isset($globalLiveInterval)) { |
|
391 | + $globalLiveInterval = '200'; |
|
392 | + } |
|
352 | 393 | $filter_query = $this->getFilter($filter); |
353 | 394 | |
354 | 395 | if (is_array($coord)) { |
@@ -356,7 +397,9 @@ discard block |
||
356 | 397 | $minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
357 | 398 | $maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
358 | 399 | $maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
359 | - } else return array(); |
|
400 | + } else { |
|
401 | + return array(); |
|
402 | + } |
|
360 | 403 | if ($globalDBdriver == 'mysql') { |
361 | 404 | $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; |
362 | 405 | } else { |
@@ -377,7 +420,9 @@ discard block |
||
377 | 420 | { |
378 | 421 | global $globalDBdriver, $globalLiveInterval, $globalArchive; |
379 | 422 | $Spotter = new Spotter($this->db); |
380 | - if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
|
423 | + if (!isset($globalLiveInterval)) { |
|
424 | + $globalLiveInterval = '200'; |
|
425 | + } |
|
381 | 426 | $filter_query = $this->getFilter($filter,true,true); |
382 | 427 | |
383 | 428 | if (is_array($coord)) { |
@@ -385,7 +430,9 @@ discard block |
||
385 | 430 | $minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
386 | 431 | $maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
387 | 432 | $maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
388 | - } else return array(); |
|
433 | + } else { |
|
434 | + return array(); |
|
435 | + } |
|
389 | 436 | if ($globalDBdriver == 'mysql') { |
390 | 437 | if (isset($globalArchive) && $globalArchive === TRUE) { |
391 | 438 | $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, spotter_live.date, spotter_live.format_source |
@@ -612,11 +659,15 @@ discard block |
||
612 | 659 | //$query = self::$global_query.' WHERE spotter_live.flightaware_id = :id ORDER BY date'; |
613 | 660 | if ($globalDBdriver == 'mysql') { |
614 | 661 | $query = 'SELECT spotter_live.* FROM spotter_live WHERE spotter_live.flightaware_id = :id'; |
615 | - if ($liveinterval) $query .= ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= date'; |
|
662 | + if ($liveinterval) { |
|
663 | + $query .= ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= date'; |
|
664 | + } |
|
616 | 665 | $query .= ' ORDER BY date'; |
617 | 666 | } else { |
618 | 667 | $query = 'SELECT spotter_live.* FROM spotter_live WHERE spotter_live.flightaware_id = :id'; |
619 | - if ($liveinterval) $query .= " AND CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= date"; |
|
668 | + if ($liveinterval) { |
|
669 | + $query .= " AND CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= date"; |
|
670 | + } |
|
620 | 671 | $query .= ' ORDER BY date'; |
621 | 672 | } |
622 | 673 | |
@@ -711,7 +762,9 @@ discard block |
||
711 | 762 | $i++; |
712 | 763 | $j++; |
713 | 764 | if ($j == 30) { |
714 | - if ($globalDebug) echo "."; |
|
765 | + if ($globalDebug) { |
|
766 | + echo "."; |
|
767 | + } |
|
715 | 768 | try { |
716 | 769 | |
717 | 770 | $sth = $this->db->prepare(substr($query_delete,0,-1).")"); |
@@ -1018,7 +1071,9 @@ discard block |
||
1018 | 1071 | { |
1019 | 1072 | return false; |
1020 | 1073 | } |
1021 | - } else return ''; |
|
1074 | + } else { |
|
1075 | + return ''; |
|
1076 | + } |
|
1022 | 1077 | |
1023 | 1078 | if ($longitude != '') |
1024 | 1079 | { |
@@ -1026,7 +1081,9 @@ discard block |
||
1026 | 1081 | { |
1027 | 1082 | return false; |
1028 | 1083 | } |
1029 | - } else return ''; |
|
1084 | + } else { |
|
1085 | + return ''; |
|
1086 | + } |
|
1030 | 1087 | |
1031 | 1088 | if ($waypoints != '') |
1032 | 1089 | { |
@@ -1042,14 +1099,18 @@ discard block |
||
1042 | 1099 | { |
1043 | 1100 | return false; |
1044 | 1101 | } |
1045 | - } else $altitude = 0; |
|
1102 | + } else { |
|
1103 | + $altitude = 0; |
|
1104 | + } |
|
1046 | 1105 | if ($altitude_real != '') |
1047 | 1106 | { |
1048 | 1107 | if (!is_numeric($altitude_real)) |
1049 | 1108 | { |
1050 | 1109 | return false; |
1051 | 1110 | } |
1052 | - } else $altitude_real = 0; |
|
1111 | + } else { |
|
1112 | + $altitude_real = 0; |
|
1113 | + } |
|
1053 | 1114 | |
1054 | 1115 | if ($heading != '') |
1055 | 1116 | { |
@@ -1057,7 +1118,9 @@ discard block |
||
1057 | 1118 | { |
1058 | 1119 | return false; |
1059 | 1120 | } |
1060 | - } else $heading = 0; |
|
1121 | + } else { |
|
1122 | + $heading = 0; |
|
1123 | + } |
|
1061 | 1124 | |
1062 | 1125 | if ($groundspeed != '') |
1063 | 1126 | { |
@@ -1065,9 +1128,13 @@ discard block |
||
1065 | 1128 | { |
1066 | 1129 | return false; |
1067 | 1130 | } |
1068 | - } else $groundspeed = 0; |
|
1131 | + } else { |
|
1132 | + $groundspeed = 0; |
|
1133 | + } |
|
1069 | 1134 | date_default_timezone_set('UTC'); |
1070 | - if ($date == '') $date = date("Y-m-d H:i:s", time()); |
|
1135 | + if ($date == '') { |
|
1136 | + $date = date("Y-m-d H:i:s", time()); |
|
1137 | + } |
|
1071 | 1138 | |
1072 | 1139 | |
1073 | 1140 | $flightaware_id = filter_var($flightaware_id,FILTER_SANITIZE_STRING); |
@@ -1112,14 +1179,24 @@ discard block |
||
1112 | 1179 | $arrival_airport_country = ''; |
1113 | 1180 | |
1114 | 1181 | |
1115 | - if ($squawk == '' || $Common->isInteger($squawk) === false ) $squawk = NULL; |
|
1116 | - if ($verticalrate == '' || $Common->isInteger($verticalrate) === false ) $verticalrate = NULL; |
|
1117 | - if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) $groundspeed = 0; |
|
1118 | - if ($heading == '' || $Common->isInteger($heading) === false ) $heading = 0; |
|
1182 | + if ($squawk == '' || $Common->isInteger($squawk) === false ) { |
|
1183 | + $squawk = NULL; |
|
1184 | + } |
|
1185 | + if ($verticalrate == '' || $Common->isInteger($verticalrate) === false ) { |
|
1186 | + $verticalrate = NULL; |
|
1187 | + } |
|
1188 | + if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) { |
|
1189 | + $groundspeed = 0; |
|
1190 | + } |
|
1191 | + if ($heading == '' || $Common->isInteger($heading) === false ) { |
|
1192 | + $heading = 0; |
|
1193 | + } |
|
1119 | 1194 | |
1120 | 1195 | $query = ''; |
1121 | 1196 | if ($globalArchive) { |
1122 | - if ($globalDebug) echo '-- Delete previous data -- '; |
|
1197 | + if ($globalDebug) { |
|
1198 | + echo '-- Delete previous data -- '; |
|
1199 | + } |
|
1123 | 1200 | $query .= 'DELETE FROM spotter_live WHERE flightaware_id = :flightaware_id;'; |
1124 | 1201 | } |
1125 | 1202 | |
@@ -1136,10 +1213,14 @@ discard block |
||
1136 | 1213 | return "error : ".$e->getMessage(); |
1137 | 1214 | } |
1138 | 1215 | if (isset($globalArchive) && $globalArchive && $putinarchive && $noarchive !== true) { |
1139 | - if ($globalDebug) echo '(Add to SBS archive : '; |
|
1216 | + if ($globalDebug) { |
|
1217 | + echo '(Add to SBS archive : '; |
|
1218 | + } |
|
1140 | 1219 | $SpotterArchive = new SpotterArchive($this->db); |
1141 | 1220 | $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, $altitude_real,$heading, $groundspeed, $squawk, $ModeS, $pilot_id, $pilot_name,$verticalrate,$format_source,$source_name, $over_country); |
1142 | - if ($globalDebug) echo $result.')'; |
|
1221 | + if ($globalDebug) { |
|
1222 | + echo $result.')'; |
|
1223 | + } |
|
1143 | 1224 | } elseif ($globalDebug && $putinarchive !== true) { |
1144 | 1225 | echo '(Not adding to archive)'; |
1145 | 1226 | } elseif ($globalDebug && $noarchive === true) { |
@@ -13,10 +13,10 @@ discard block |
||
13 | 13 | |
14 | 14 | |
15 | 15 | /** |
16 | - * Get SQL query part for filter used |
|
17 | - * @param Array $filter the filter |
|
18 | - * @return Array the SQL part |
|
19 | - */ |
|
16 | + * Get SQL query part for filter used |
|
17 | + * @param Array $filter the filter |
|
18 | + * @return Array the SQL part |
|
19 | + */ |
|
20 | 20 | public function getFilter($filter = array(),$where = false,$and = false) { |
21 | 21 | global $globalFilter, $globalStatsFilters, $globalFilterName, $globalDBdriver; |
22 | 22 | $filters = array(); |
@@ -133,11 +133,11 @@ discard block |
||
133 | 133 | } |
134 | 134 | |
135 | 135 | /** |
136 | - * Gets all the spotter information based on the latest data entry |
|
137 | - * |
|
138 | - * @return Array the spotter information |
|
139 | - * |
|
140 | - */ |
|
136 | + * Gets all the spotter information based on the latest data entry |
|
137 | + * |
|
138 | + * @return Array the spotter information |
|
139 | + * |
|
140 | + */ |
|
141 | 141 | public function getLiveSpotterData($limit = '', $sort = '', $filter = array()) |
142 | 142 | { |
143 | 143 | global $globalDBdriver, $globalLiveInterval; |
@@ -180,11 +180,11 @@ discard block |
||
180 | 180 | } |
181 | 181 | |
182 | 182 | /** |
183 | - * Gets Minimal Live Spotter data |
|
184 | - * |
|
185 | - * @return Array the spotter information |
|
186 | - * |
|
187 | - */ |
|
183 | + * Gets Minimal Live Spotter data |
|
184 | + * |
|
185 | + * @return Array the spotter information |
|
186 | + * |
|
187 | + */ |
|
188 | 188 | public function getMinLiveSpotterData($filter = array()) |
189 | 189 | { |
190 | 190 | global $globalDBdriver, $globalLiveInterval, $globalArchive; |
@@ -221,11 +221,11 @@ discard block |
||
221 | 221 | } |
222 | 222 | |
223 | 223 | /** |
224 | - * Gets Minimal Live Spotter data since xx seconds |
|
225 | - * |
|
226 | - * @return Array the spotter information |
|
227 | - * |
|
228 | - */ |
|
224 | + * Gets Minimal Live Spotter data since xx seconds |
|
225 | + * |
|
226 | + * @return Array the spotter information |
|
227 | + * |
|
228 | + */ |
|
229 | 229 | public function getMinLastLiveSpotterData($coord = array(),$filter = array(), $limit = false) |
230 | 230 | { |
231 | 231 | global $globalDBdriver, $globalLiveInterval, $globalArchive, $globalMap3DAircraftsLimit; |
@@ -308,11 +308,11 @@ discard block |
||
308 | 308 | } |
309 | 309 | |
310 | 310 | /** |
311 | - * Gets number of latest data entry |
|
312 | - * |
|
313 | - * @return String number of entry |
|
314 | - * |
|
315 | - */ |
|
311 | + * Gets number of latest data entry |
|
312 | + * |
|
313 | + * @return String number of entry |
|
314 | + * |
|
315 | + */ |
|
316 | 316 | public function getLiveSpotterCount($filter = array()) |
317 | 317 | { |
318 | 318 | global $globalDBdriver, $globalLiveInterval; |
@@ -339,11 +339,11 @@ discard block |
||
339 | 339 | } |
340 | 340 | |
341 | 341 | /** |
342 | - * Gets all the spotter information based on the latest data entry and coord |
|
343 | - * |
|
344 | - * @return Array the spotter information |
|
345 | - * |
|
346 | - */ |
|
342 | + * Gets all the spotter information based on the latest data entry and coord |
|
343 | + * |
|
344 | + * @return Array the spotter information |
|
345 | + * |
|
346 | + */ |
|
347 | 347 | public function getLiveSpotterDatabyCoord($coord, $filter = array()) |
348 | 348 | { |
349 | 349 | global $globalDBdriver, $globalLiveInterval; |
@@ -368,11 +368,11 @@ discard block |
||
368 | 368 | } |
369 | 369 | |
370 | 370 | /** |
371 | - * Gets all the spotter information based on the latest data entry and coord |
|
372 | - * |
|
373 | - * @return Array the spotter information |
|
374 | - * |
|
375 | - */ |
|
371 | + * Gets all the spotter information based on the latest data entry and coord |
|
372 | + * |
|
373 | + * @return Array the spotter information |
|
374 | + * |
|
375 | + */ |
|
376 | 376 | public function getMinLiveSpotterDatabyCoord($coord, $filter = array()) |
377 | 377 | { |
378 | 378 | global $globalDBdriver, $globalLiveInterval, $globalArchive; |
@@ -437,11 +437,11 @@ discard block |
||
437 | 437 | } |
438 | 438 | |
439 | 439 | /** |
440 | - * Gets all the spotter information based on a user's latitude and longitude |
|
441 | - * |
|
442 | - * @return Array the spotter information |
|
443 | - * |
|
444 | - */ |
|
440 | + * Gets all the spotter information based on a user's latitude and longitude |
|
441 | + * |
|
442 | + * @return Array the spotter information |
|
443 | + * |
|
444 | + */ |
|
445 | 445 | public function getLatestSpotterForLayar($lat, $lng, $radius, $interval) |
446 | 446 | { |
447 | 447 | $Spotter = new Spotter($this->db); |
@@ -451,98 +451,98 @@ discard block |
||
451 | 451 | return false; |
452 | 452 | } |
453 | 453 | } |
454 | - if ($lng != '') |
|
455 | - { |
|
456 | - if (!is_numeric($lng)) |
|
457 | - { |
|
458 | - return false; |
|
459 | - } |
|
460 | - } |
|
461 | - |
|
462 | - if ($radius != '') |
|
463 | - { |
|
464 | - if (!is_numeric($radius)) |
|
465 | - { |
|
466 | - return false; |
|
467 | - } |
|
468 | - } |
|
454 | + if ($lng != '') |
|
455 | + { |
|
456 | + if (!is_numeric($lng)) |
|
457 | + { |
|
458 | + return false; |
|
459 | + } |
|
460 | + } |
|
461 | + |
|
462 | + if ($radius != '') |
|
463 | + { |
|
464 | + if (!is_numeric($radius)) |
|
465 | + { |
|
466 | + return false; |
|
467 | + } |
|
468 | + } |
|
469 | 469 | $additional_query = ''; |
470 | - if ($interval != '') |
|
471 | - { |
|
472 | - if (!is_string($interval)) |
|
473 | - { |
|
474 | - //$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= spotter_live.date '; |
|
475 | - return false; |
|
476 | - } else { |
|
477 | - if ($interval == '1m') |
|
478 | - { |
|
479 | - $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= spotter_live.date '; |
|
480 | - } else if ($interval == '15m'){ |
|
481 | - $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 15 MINUTE) <= spotter_live.date '; |
|
482 | - } |
|
483 | - } |
|
484 | - } else { |
|
485 | - $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= spotter_live.date '; |
|
486 | - } |
|
487 | - |
|
488 | - $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 |
|
470 | + if ($interval != '') |
|
471 | + { |
|
472 | + if (!is_string($interval)) |
|
473 | + { |
|
474 | + //$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= spotter_live.date '; |
|
475 | + return false; |
|
476 | + } else { |
|
477 | + if ($interval == '1m') |
|
478 | + { |
|
479 | + $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= spotter_live.date '; |
|
480 | + } else if ($interval == '15m'){ |
|
481 | + $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 15 MINUTE) <= spotter_live.date '; |
|
482 | + } |
|
483 | + } |
|
484 | + } else { |
|
485 | + $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= spotter_live.date '; |
|
486 | + } |
|
487 | + |
|
488 | + $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 |
|
489 | 489 | WHERE spotter_live.latitude <> '' |
490 | 490 | AND spotter_live.longitude <> '' |
491 | 491 | ".$additional_query." |
492 | 492 | HAVING distance < :radius |
493 | 493 | ORDER BY distance"; |
494 | 494 | |
495 | - $spotter_array = $Spotter->getDataFromDB($query, array(':lat' => $lat, ':lng' => $lng,':radius' => $radius)); |
|
495 | + $spotter_array = $Spotter->getDataFromDB($query, array(':lat' => $lat, ':lng' => $lng,':radius' => $radius)); |
|
496 | 496 | |
497 | - return $spotter_array; |
|
498 | - } |
|
497 | + return $spotter_array; |
|
498 | + } |
|
499 | 499 | |
500 | 500 | |
501 | - /** |
|
502 | - * Gets all the spotter information based on a particular callsign |
|
503 | - * |
|
504 | - * @return Array the spotter information |
|
505 | - * |
|
506 | - */ |
|
501 | + /** |
|
502 | + * Gets all the spotter information based on a particular callsign |
|
503 | + * |
|
504 | + * @return Array the spotter information |
|
505 | + * |
|
506 | + */ |
|
507 | 507 | public function getLastLiveSpotterDataByIdent($ident) |
508 | 508 | { |
509 | 509 | $Spotter = new Spotter($this->db); |
510 | 510 | date_default_timezone_set('UTC'); |
511 | 511 | |
512 | 512 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
513 | - $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'; |
|
513 | + $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'; |
|
514 | 514 | |
515 | 515 | $spotter_array = $Spotter->getDataFromDB($query,array(':ident' => $ident),'',true); |
516 | 516 | |
517 | 517 | return $spotter_array; |
518 | 518 | } |
519 | 519 | |
520 | - /** |
|
521 | - * Gets all the spotter information based on a particular callsign |
|
522 | - * |
|
523 | - * @return Array the spotter information |
|
524 | - * |
|
525 | - */ |
|
520 | + /** |
|
521 | + * Gets all the spotter information based on a particular callsign |
|
522 | + * |
|
523 | + * @return Array the spotter information |
|
524 | + * |
|
525 | + */ |
|
526 | 526 | public function getDateLiveSpotterDataByIdent($ident,$date) |
527 | 527 | { |
528 | 528 | $Spotter = new Spotter($this->db); |
529 | 529 | date_default_timezone_set('UTC'); |
530 | 530 | |
531 | 531 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
532 | - $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.date <= :date 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'; |
|
532 | + $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.date <= :date 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'; |
|
533 | 533 | |
534 | - $date = date('c',$date); |
|
534 | + $date = date('c',$date); |
|
535 | 535 | $spotter_array = $Spotter->getDataFromDB($query,array(':ident' => $ident,':date' => $date)); |
536 | 536 | |
537 | 537 | return $spotter_array; |
538 | 538 | } |
539 | 539 | |
540 | - /** |
|
541 | - * Gets last spotter information based on a particular callsign |
|
542 | - * |
|
543 | - * @return Array the spotter information |
|
544 | - * |
|
545 | - */ |
|
540 | + /** |
|
541 | + * Gets last spotter information based on a particular callsign |
|
542 | + * |
|
543 | + * @return Array the spotter information |
|
544 | + * |
|
545 | + */ |
|
546 | 546 | public function getLastLiveSpotterDataById($id) |
547 | 547 | { |
548 | 548 | $Spotter = new Spotter($this->db); |
@@ -553,12 +553,12 @@ discard block |
||
553 | 553 | return $spotter_array; |
554 | 554 | } |
555 | 555 | |
556 | - /** |
|
557 | - * Gets last spotter information based on a particular callsign |
|
558 | - * |
|
559 | - * @return Array the spotter information |
|
560 | - * |
|
561 | - */ |
|
556 | + /** |
|
557 | + * Gets last spotter information based on a particular callsign |
|
558 | + * |
|
559 | + * @return Array the spotter information |
|
560 | + * |
|
561 | + */ |
|
562 | 562 | public function getDateLiveSpotterDataById($id,$date) |
563 | 563 | { |
564 | 564 | $Spotter = new Spotter($this->db); |
@@ -571,21 +571,21 @@ discard block |
||
571 | 571 | return $spotter_array; |
572 | 572 | } |
573 | 573 | |
574 | - /** |
|
575 | - * Gets altitude information based on a particular callsign |
|
576 | - * |
|
577 | - * @return Array the spotter information |
|
578 | - * |
|
579 | - */ |
|
574 | + /** |
|
575 | + * Gets altitude information based on a particular callsign |
|
576 | + * |
|
577 | + * @return Array the spotter information |
|
578 | + * |
|
579 | + */ |
|
580 | 580 | public function getAltitudeLiveSpotterDataByIdent($ident) |
581 | 581 | { |
582 | 582 | |
583 | 583 | date_default_timezone_set('UTC'); |
584 | 584 | |
585 | 585 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
586 | - $query = 'SELECT spotter_live.altitude, spotter_live.date FROM spotter_live WHERE spotter_live.ident = :ident'; |
|
586 | + $query = 'SELECT spotter_live.altitude, spotter_live.date FROM spotter_live WHERE spotter_live.ident = :ident'; |
|
587 | 587 | |
588 | - try { |
|
588 | + try { |
|
589 | 589 | |
590 | 590 | $sth = $this->db->prepare($query); |
591 | 591 | $sth->execute(array(':ident' => $ident)); |
@@ -598,12 +598,12 @@ discard block |
||
598 | 598 | return $spotter_array; |
599 | 599 | } |
600 | 600 | |
601 | - /** |
|
602 | - * Gets all the spotter information based on a particular id |
|
603 | - * |
|
604 | - * @return Array the spotter information |
|
605 | - * |
|
606 | - */ |
|
601 | + /** |
|
602 | + * Gets all the spotter information based on a particular id |
|
603 | + * |
|
604 | + * @return Array the spotter information |
|
605 | + * |
|
606 | + */ |
|
607 | 607 | public function getAllLiveSpotterDataById($id,$liveinterval = false) |
608 | 608 | { |
609 | 609 | global $globalDBdriver, $globalLiveInterval; |
@@ -631,18 +631,18 @@ discard block |
||
631 | 631 | return $spotter_array; |
632 | 632 | } |
633 | 633 | |
634 | - /** |
|
635 | - * Gets all the spotter information based on a particular ident |
|
636 | - * |
|
637 | - * @return Array the spotter information |
|
638 | - * |
|
639 | - */ |
|
634 | + /** |
|
635 | + * Gets all the spotter information based on a particular ident |
|
636 | + * |
|
637 | + * @return Array the spotter information |
|
638 | + * |
|
639 | + */ |
|
640 | 640 | public function getAllLiveSpotterDataByIdent($ident) |
641 | 641 | { |
642 | 642 | date_default_timezone_set('UTC'); |
643 | 643 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
644 | 644 | $query = self::$global_query.' WHERE spotter_live.ident = :ident'; |
645 | - try { |
|
645 | + try { |
|
646 | 646 | |
647 | 647 | $sth = $this->db->prepare($query); |
648 | 648 | $sth->execute(array(':ident' => $ident)); |
@@ -656,23 +656,23 @@ discard block |
||
656 | 656 | |
657 | 657 | |
658 | 658 | /** |
659 | - * Deletes all info in the table |
|
660 | - * |
|
661 | - * @return String success or false |
|
662 | - * |
|
663 | - */ |
|
659 | + * Deletes all info in the table |
|
660 | + * |
|
661 | + * @return String success or false |
|
662 | + * |
|
663 | + */ |
|
664 | 664 | public function deleteLiveSpotterData() |
665 | 665 | { |
666 | 666 | global $globalDBdriver; |
667 | 667 | if ($globalDBdriver == 'mysql') { |
668 | 668 | //$query = "DELETE FROM spotter_live WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL 30 MINUTE) >= spotter_live.date"; |
669 | 669 | $query = 'DELETE FROM spotter_live WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL 9 HOUR) >= spotter_live.date'; |
670 | - //$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)"; |
|
670 | + //$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)"; |
|
671 | 671 | } else { |
672 | 672 | $query = "DELETE FROM spotter_live WHERE NOW() AT TIME ZONE 'UTC' - INTERVAL '9 HOURS' >= spotter_live.date"; |
673 | 673 | } |
674 | 674 | |
675 | - try { |
|
675 | + try { |
|
676 | 676 | |
677 | 677 | $sth = $this->db->prepare($query); |
678 | 678 | $sth->execute(); |
@@ -684,18 +684,18 @@ discard block |
||
684 | 684 | } |
685 | 685 | |
686 | 686 | /** |
687 | - * Deletes all info in the table for aircraft not seen since 2 HOUR |
|
688 | - * |
|
689 | - * @return String success or false |
|
690 | - * |
|
691 | - */ |
|
687 | + * Deletes all info in the table for aircraft not seen since 2 HOUR |
|
688 | + * |
|
689 | + * @return String success or false |
|
690 | + * |
|
691 | + */ |
|
692 | 692 | public function deleteLiveSpotterDataNotUpdated() |
693 | 693 | { |
694 | 694 | global $globalDBdriver, $globalDebug; |
695 | 695 | if ($globalDBdriver == 'mysql') { |
696 | 696 | //$query = 'SELECT flightaware_id FROM spotter_live WHERE DATE_SUB(UTC_TIMESTAMP(), INTERVAL 1 HOUR) >= spotter_live.date AND spotter_live.flightaware_id NOT IN (SELECT flightaware_id FROM spotter_live WHERE DATE_SUB(UTC_TIMESTAMP(), INTERVAL 1 HOUR) < spotter_live.date) LIMIT 800 OFFSET 0'; |
697 | - $query = "SELECT spotter_live.flightaware_id FROM spotter_live INNER JOIN (SELECT flightaware_id,MAX(date) as max_date FROM spotter_live GROUP BY flightaware_id) s ON s.flightaware_id = spotter_live.flightaware_id AND DATE_SUB(UTC_TIMESTAMP(), INTERVAL 2 HOUR) >= s.max_date LIMIT 2000 OFFSET 0"; |
|
698 | - try { |
|
697 | + $query = "SELECT spotter_live.flightaware_id FROM spotter_live INNER JOIN (SELECT flightaware_id,MAX(date) as max_date FROM spotter_live GROUP BY flightaware_id) s ON s.flightaware_id = spotter_live.flightaware_id AND DATE_SUB(UTC_TIMESTAMP(), INTERVAL 2 HOUR) >= s.max_date LIMIT 2000 OFFSET 0"; |
|
698 | + try { |
|
699 | 699 | |
700 | 700 | $sth = $this->db->prepare($query); |
701 | 701 | $sth->execute(); |
@@ -703,8 +703,8 @@ discard block |
||
703 | 703 | return "error"; |
704 | 704 | } |
705 | 705 | $query_delete = 'DELETE FROM spotter_live WHERE flightaware_id IN ('; |
706 | - $i = 0; |
|
707 | - $j =0; |
|
706 | + $i = 0; |
|
707 | + $j =0; |
|
708 | 708 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
709 | 709 | foreach($all as $row) |
710 | 710 | { |
@@ -712,20 +712,20 @@ discard block |
||
712 | 712 | $j++; |
713 | 713 | if ($j == 30) { |
714 | 714 | if ($globalDebug) echo "."; |
715 | - try { |
|
715 | + try { |
|
716 | 716 | |
717 | 717 | $sth = $this->db->prepare(substr($query_delete,0,-1).")"); |
718 | 718 | $sth->execute(); |
719 | 719 | } catch(PDOException $e) { |
720 | 720 | return "error"; |
721 | 721 | } |
722 | - $query_delete = 'DELETE FROM spotter_live WHERE flightaware_id IN ('; |
|
723 | - $j = 0; |
|
722 | + $query_delete = 'DELETE FROM spotter_live WHERE flightaware_id IN ('; |
|
723 | + $j = 0; |
|
724 | 724 | } |
725 | 725 | $query_delete .= "'".$row['flightaware_id']."',"; |
726 | 726 | } |
727 | 727 | if ($i > 0) { |
728 | - try { |
|
728 | + try { |
|
729 | 729 | |
730 | 730 | $sth = $this->db->prepare(substr($query_delete,0,-1).")"); |
731 | 731 | $sth->execute(); |
@@ -736,9 +736,9 @@ discard block |
||
736 | 736 | return "success"; |
737 | 737 | } elseif ($globalDBdriver == 'pgsql') { |
738 | 738 | //$query = "SELECT flightaware_id FROM spotter_live WHERE NOW() AT TIME ZONE 'UTC' - INTERVAL '9 HOURS' >= spotter_live.date AND spotter_live.flightaware_id NOT IN (SELECT flightaware_id FROM spotter_live WHERE NOW() AT TIME ZONE 'UTC' - INTERVAL '9 HOURS' < spotter_live.date) LIMIT 800 OFFSET 0"; |
739 | - //$query = "SELECT spotter_live.flightaware_id FROM spotter_live INNER JOIN (SELECT flightaware_id,MAX(date) as max_date FROM spotter_live GROUP BY flightaware_id) s ON s.flightaware_id = spotter_live.flightaware_id AND NOW() AT TIME ZONE 'UTC' - INTERVAL '2 HOURS' >= s.max_date LIMIT 800 OFFSET 0"; |
|
740 | - $query = "DELETE FROM spotter_live WHERE flightaware_id IN (SELECT spotter_live.flightaware_id FROM spotter_live INNER JOIN (SELECT flightaware_id,MAX(date) as max_date FROM spotter_live GROUP BY flightaware_id) s ON s.flightaware_id = spotter_live.flightaware_id AND NOW() AT TIME ZONE 'UTC' - INTERVAL '2 HOURS' >= s.max_date LIMIT 2000 OFFSET 0)"; |
|
741 | - try { |
|
739 | + //$query = "SELECT spotter_live.flightaware_id FROM spotter_live INNER JOIN (SELECT flightaware_id,MAX(date) as max_date FROM spotter_live GROUP BY flightaware_id) s ON s.flightaware_id = spotter_live.flightaware_id AND NOW() AT TIME ZONE 'UTC' - INTERVAL '2 HOURS' >= s.max_date LIMIT 800 OFFSET 0"; |
|
740 | + $query = "DELETE FROM spotter_live WHERE flightaware_id IN (SELECT spotter_live.flightaware_id FROM spotter_live INNER JOIN (SELECT flightaware_id,MAX(date) as max_date FROM spotter_live GROUP BY flightaware_id) s ON s.flightaware_id = spotter_live.flightaware_id AND NOW() AT TIME ZONE 'UTC' - INTERVAL '2 HOURS' >= s.max_date LIMIT 2000 OFFSET 0)"; |
|
741 | + try { |
|
742 | 742 | |
743 | 743 | $sth = $this->db->prepare($query); |
744 | 744 | $sth->execute(); |
@@ -782,17 +782,17 @@ discard block |
||
782 | 782 | } |
783 | 783 | |
784 | 784 | /** |
785 | - * Deletes all info in the table for an ident |
|
786 | - * |
|
787 | - * @return String success or false |
|
788 | - * |
|
789 | - */ |
|
785 | + * Deletes all info in the table for an ident |
|
786 | + * |
|
787 | + * @return String success or false |
|
788 | + * |
|
789 | + */ |
|
790 | 790 | public function deleteLiveSpotterDataByIdent($ident) |
791 | 791 | { |
792 | 792 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
793 | 793 | $query = 'DELETE FROM spotter_live WHERE ident = :ident'; |
794 | 794 | |
795 | - try { |
|
795 | + try { |
|
796 | 796 | |
797 | 797 | $sth = $this->db->prepare($query); |
798 | 798 | $sth->execute(array(':ident' => $ident)); |
@@ -804,17 +804,17 @@ discard block |
||
804 | 804 | } |
805 | 805 | |
806 | 806 | /** |
807 | - * Deletes all info in the table for an id |
|
808 | - * |
|
809 | - * @return String success or false |
|
810 | - * |
|
811 | - */ |
|
807 | + * Deletes all info in the table for an id |
|
808 | + * |
|
809 | + * @return String success or false |
|
810 | + * |
|
811 | + */ |
|
812 | 812 | public function deleteLiveSpotterDataById($id) |
813 | 813 | { |
814 | 814 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
815 | 815 | $query = 'DELETE FROM spotter_live WHERE flightaware_id = :id'; |
816 | 816 | |
817 | - try { |
|
817 | + try { |
|
818 | 818 | |
819 | 819 | $sth = $this->db->prepare($query); |
820 | 820 | $sth->execute(array(':id' => $id)); |
@@ -827,11 +827,11 @@ discard block |
||
827 | 827 | |
828 | 828 | |
829 | 829 | /** |
830 | - * Gets the aircraft ident within the last hour |
|
831 | - * |
|
832 | - * @return String the ident |
|
833 | - * |
|
834 | - */ |
|
830 | + * Gets the aircraft ident within the last hour |
|
831 | + * |
|
832 | + * @return String the ident |
|
833 | + * |
|
834 | + */ |
|
835 | 835 | public function getIdentFromLastHour($ident) |
836 | 836 | { |
837 | 837 | global $globalDBdriver, $globalTimezone; |
@@ -857,14 +857,14 @@ discard block |
||
857 | 857 | $ident_result = $row['ident']; |
858 | 858 | } |
859 | 859 | return $ident_result; |
860 | - } |
|
860 | + } |
|
861 | 861 | |
862 | 862 | /** |
863 | - * Check recent aircraft |
|
864 | - * |
|
865 | - * @return String the ident |
|
866 | - * |
|
867 | - */ |
|
863 | + * Check recent aircraft |
|
864 | + * |
|
865 | + * @return String the ident |
|
866 | + * |
|
867 | + */ |
|
868 | 868 | public function checkIdentRecent($ident) |
869 | 869 | { |
870 | 870 | global $globalDBdriver, $globalTimezone; |
@@ -890,14 +890,14 @@ discard block |
||
890 | 890 | $ident_result = $row['flightaware_id']; |
891 | 891 | } |
892 | 892 | return $ident_result; |
893 | - } |
|
893 | + } |
|
894 | 894 | |
895 | 895 | /** |
896 | - * Check recent aircraft by id |
|
897 | - * |
|
898 | - * @return String the ident |
|
899 | - * |
|
900 | - */ |
|
896 | + * Check recent aircraft by id |
|
897 | + * |
|
898 | + * @return String the ident |
|
899 | + * |
|
900 | + */ |
|
901 | 901 | public function checkIdRecent($id) |
902 | 902 | { |
903 | 903 | global $globalDBdriver, $globalTimezone; |
@@ -923,14 +923,14 @@ discard block |
||
923 | 923 | $ident_result = $row['flightaware_id']; |
924 | 924 | } |
925 | 925 | return $ident_result; |
926 | - } |
|
926 | + } |
|
927 | 927 | |
928 | 928 | /** |
929 | - * Check recent aircraft by ModeS |
|
930 | - * |
|
931 | - * @return String the ModeS |
|
932 | - * |
|
933 | - */ |
|
929 | + * Check recent aircraft by ModeS |
|
930 | + * |
|
931 | + * @return String the ModeS |
|
932 | + * |
|
933 | + */ |
|
934 | 934 | public function checkModeSRecent($modes) |
935 | 935 | { |
936 | 936 | global $globalDBdriver, $globalTimezone; |
@@ -960,11 +960,11 @@ discard block |
||
960 | 960 | } |
961 | 961 | |
962 | 962 | /** |
963 | - * Gets the aircraft data from the last 20 seconds |
|
964 | - * |
|
965 | - * @return Array the spotter data |
|
966 | - * |
|
967 | - */ |
|
963 | + * Gets the aircraft data from the last 20 seconds |
|
964 | + * |
|
965 | + * @return Array the spotter data |
|
966 | + * |
|
967 | + */ |
|
968 | 968 | public function getRealTimeData($q = '') |
969 | 969 | { |
970 | 970 | global $globalDBdriver; |
@@ -1006,16 +1006,16 @@ discard block |
||
1006 | 1006 | } |
1007 | 1007 | |
1008 | 1008 | /** |
1009 | - * Adds a new spotter data |
|
1010 | - * |
|
1011 | - * @param String $flightaware_id the ID from flightaware |
|
1012 | - * @param String $ident the flight ident |
|
1013 | - * @param String $aircraft_icao the aircraft type |
|
1014 | - * @param String $departure_airport_icao the departure airport |
|
1015 | - * @param String $arrival_airport_icao the arrival airport |
|
1016 | - * @return String success or false |
|
1017 | - * |
|
1018 | - */ |
|
1009 | + * Adds a new spotter data |
|
1010 | + * |
|
1011 | + * @param String $flightaware_id the ID from flightaware |
|
1012 | + * @param String $ident the flight ident |
|
1013 | + * @param String $aircraft_icao the aircraft type |
|
1014 | + * @param String $departure_airport_icao the departure airport |
|
1015 | + * @param String $arrival_airport_icao the arrival airport |
|
1016 | + * @return String success or false |
|
1017 | + * |
|
1018 | + */ |
|
1019 | 1019 | public function addLiveSpotterData($flightaware_id = '', $ident = '', $aircraft_icao = '', $departure_airport_icao = '', $arrival_airport_icao = '', $latitude = '', $longitude = '', $waypoints = '', $altitude = '', $altitude_real = '',$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 = '') |
1020 | 1020 | { |
1021 | 1021 | global $globalURL, $globalArchive, $globalDebug; |
@@ -1158,10 +1158,10 @@ discard block |
||
1158 | 1158 | $arrival_airport_country = ''; |
1159 | 1159 | |
1160 | 1160 | |
1161 | - if ($squawk == '' || $Common->isInteger($squawk) === false ) $squawk = NULL; |
|
1162 | - if ($verticalrate == '' || $Common->isInteger($verticalrate) === false ) $verticalrate = NULL; |
|
1163 | - if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) $groundspeed = 0; |
|
1164 | - if ($heading == '' || $Common->isInteger($heading) === false ) $heading = 0; |
|
1161 | + if ($squawk == '' || $Common->isInteger($squawk) === false ) $squawk = NULL; |
|
1162 | + if ($verticalrate == '' || $Common->isInteger($verticalrate) === false ) $verticalrate = NULL; |
|
1163 | + if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) $groundspeed = 0; |
|
1164 | + if ($heading == '' || $Common->isInteger($heading) === false ) $heading = 0; |
|
1165 | 1165 | |
1166 | 1166 | $query = ''; |
1167 | 1167 | if ($globalArchive) { |
@@ -1182,10 +1182,10 @@ discard block |
||
1182 | 1182 | return "error : ".$e->getMessage(); |
1183 | 1183 | } |
1184 | 1184 | if (isset($globalArchive) && $globalArchive && $putinarchive && $noarchive !== true) { |
1185 | - if ($globalDebug) echo '(Add to SBS archive : '; |
|
1186 | - $SpotterArchive = new SpotterArchive($this->db); |
|
1187 | - $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, $altitude_real,$heading, $groundspeed, $squawk, $ModeS, $pilot_id, $pilot_name,$verticalrate,$format_source,$source_name, $over_country); |
|
1188 | - if ($globalDebug) echo $result.')'; |
|
1185 | + if ($globalDebug) echo '(Add to SBS archive : '; |
|
1186 | + $SpotterArchive = new SpotterArchive($this->db); |
|
1187 | + $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, $altitude_real,$heading, $groundspeed, $squawk, $ModeS, $pilot_id, $pilot_name,$verticalrate,$format_source,$source_name, $over_country); |
|
1188 | + if ($globalDebug) echo $result.')'; |
|
1189 | 1189 | } elseif ($globalDebug && $putinarchive !== true) { |
1190 | 1190 | echo '(Not adding to archive)'; |
1191 | 1191 | } elseif ($globalDebug && $noarchive === true) { |
@@ -17,62 +17,62 @@ discard block |
||
17 | 17 | * @param Array $filter the filter |
18 | 18 | * @return Array the SQL part |
19 | 19 | */ |
20 | - public function getFilter($filter = array(),$where = false,$and = false) { |
|
20 | + public function getFilter($filter = array(), $where = false, $and = false) { |
|
21 | 21 | global $globalFilter, $globalStatsFilters, $globalFilterName, $globalDBdriver; |
22 | 22 | $filters = array(); |
23 | 23 | if (is_array($globalStatsFilters) && isset($globalStatsFilters[$globalFilterName])) { |
24 | 24 | if (isset($globalStatsFilters[$globalFilterName][0]['source'])) { |
25 | 25 | $filters = $globalStatsFilters[$globalFilterName]; |
26 | 26 | } else { |
27 | - $filter = array_merge($filter,$globalStatsFilters[$globalFilterName]); |
|
27 | + $filter = array_merge($filter, $globalStatsFilters[$globalFilterName]); |
|
28 | 28 | } |
29 | 29 | } |
30 | 30 | if (isset($filter[0]['source'])) { |
31 | - $filters = array_merge($filters,$filter); |
|
31 | + $filters = array_merge($filters, $filter); |
|
32 | 32 | } |
33 | - if (is_array($globalFilter)) $filter = array_merge($filter,$globalFilter); |
|
33 | + if (is_array($globalFilter)) $filter = array_merge($filter, $globalFilter); |
|
34 | 34 | $filter_query_join = ''; |
35 | 35 | $filter_query_where = ''; |
36 | - foreach($filters as $flt) { |
|
36 | + foreach ($filters as $flt) { |
|
37 | 37 | if (isset($flt['airlines']) && !empty($flt['airlines'])) { |
38 | 38 | if ($flt['airlines'][0] != '') { |
39 | 39 | if (isset($flt['source'])) { |
40 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','",$flt['airlines'])."') AND spotter_output.format_source IN ('".implode("','",$flt['source'])."')) saf ON saf.flightaware_id = spotter_live.flightaware_id"; |
|
40 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','", $flt['airlines'])."') AND spotter_output.format_source IN ('".implode("','", $flt['source'])."')) saf ON saf.flightaware_id = spotter_live.flightaware_id"; |
|
41 | 41 | } else { |
42 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','",$flt['airlines'])."')) saf ON saf.flightaware_id = spotter_live.flightaware_id"; |
|
42 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','", $flt['airlines'])."')) saf ON saf.flightaware_id = spotter_live.flightaware_id"; |
|
43 | 43 | } |
44 | 44 | } |
45 | 45 | } |
46 | 46 | if (isset($flt['pilots_id']) && !empty($flt['pilots_id'])) { |
47 | 47 | if (isset($flt['source'])) { |
48 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','",$flt['pilots_id'])."') AND spotter_output.format_source IN ('".implode("','",$flt['source'])."')) spi ON spi.flightaware_id = spotter_live.flightaware_id"; |
|
48 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','", $flt['pilots_id'])."') AND spotter_output.format_source IN ('".implode("','", $flt['source'])."')) spi ON spi.flightaware_id = spotter_live.flightaware_id"; |
|
49 | 49 | } else { |
50 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','",$flt['pilots_id'])."')) spi ON spi.flightaware_id = spotter_live.flightaware_id"; |
|
50 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','", $flt['pilots_id'])."')) spi ON spi.flightaware_id = spotter_live.flightaware_id"; |
|
51 | 51 | } |
52 | 52 | } |
53 | 53 | if (isset($flt['idents']) && !empty($flt['idents'])) { |
54 | 54 | if (isset($flt['source'])) { |
55 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.ident IN ('".implode("','",$flt['idents'])."') AND spotter_output.format_source IN ('".implode("','",$flt['source'])."')) spid ON spid.flightaware_id = spotter_live.flightaware_id"; |
|
55 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.ident IN ('".implode("','", $flt['idents'])."') AND spotter_output.format_source IN ('".implode("','", $flt['source'])."')) spid ON spid.flightaware_id = spotter_live.flightaware_id"; |
|
56 | 56 | } else { |
57 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.ident IN ('".implode("','",$flt['idents'])."')) spid ON spid.flightaware_id = spotter_live.flightaware_id"; |
|
57 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.ident IN ('".implode("','", $flt['idents'])."')) spid ON spid.flightaware_id = spotter_live.flightaware_id"; |
|
58 | 58 | } |
59 | 59 | } |
60 | 60 | if (isset($flt['registrations']) && !empty($flt['registrations'])) { |
61 | 61 | if (isset($flt['source'])) { |
62 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.registration IN ('".implode("','",$flt['registrations'])."') AND spotter_output.format_source IN ('".implode("','",$flt['source'])."')) sre ON sre.flightaware_id = spotter_live.flightaware_id"; |
|
62 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.registration IN ('".implode("','", $flt['registrations'])."') AND spotter_output.format_source IN ('".implode("','", $flt['source'])."')) sre ON sre.flightaware_id = spotter_live.flightaware_id"; |
|
63 | 63 | } else { |
64 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.registration IN ('".implode("','",$flt['registrations'])."')) sre ON sre.flightaware_id = spotter_live.flightaware_id"; |
|
64 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.registration IN ('".implode("','", $flt['registrations'])."')) sre ON sre.flightaware_id = spotter_live.flightaware_id"; |
|
65 | 65 | } |
66 | 66 | } |
67 | 67 | if ((isset($flt['airlines']) && empty($flt['airlines']) && isset($flt['pilots_id']) && empty($flt['pilots_id']) && isset($flt['idents']) && empty($flt['idents'])) || (!isset($flt['airlines']) && !isset($flt['pilots_id']) && !isset($flt['idents']) && !isset($flt['registrations']))) { |
68 | 68 | if (isset($flt['source'])) { |
69 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.format_source IN ('".implode("','",$flt['source'])."')) ssf ON ssf.flightaware_id = spotter_live.flightaware_id"; |
|
69 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.format_source IN ('".implode("','", $flt['source'])."')) ssf ON ssf.flightaware_id = spotter_live.flightaware_id"; |
|
70 | 70 | } |
71 | 71 | } |
72 | 72 | } |
73 | 73 | if (isset($filter['airlines']) && !empty($filter['airlines'])) { |
74 | 74 | if ($filter['airlines'][0] != '') { |
75 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','",$filter['airlines'])."')) sai ON sai.flightaware_id = spotter_live.flightaware_id"; |
|
75 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','", $filter['airlines'])."')) sai ON sai.flightaware_id = spotter_live.flightaware_id"; |
|
76 | 76 | } |
77 | 77 | } |
78 | 78 | if (isset($filter['alliance']) && !empty($filter['alliance'])) { |
@@ -82,13 +82,13 @@ discard block |
||
82 | 82 | $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_type = '".$filter['airlinestype']."') sa ON sa.flightaware_id = spotter_live.flightaware_id "; |
83 | 83 | } |
84 | 84 | if (isset($filter['pilots_id']) && !empty($filter['pilots_id'])) { |
85 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','",$filter['pilots_id'])."')) sp ON sp.flightaware_id = spotter_live.flightaware_id"; |
|
85 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','", $filter['pilots_id'])."')) sp ON sp.flightaware_id = spotter_live.flightaware_id"; |
|
86 | 86 | } |
87 | 87 | if (isset($filter['source']) && !empty($filter['source'])) { |
88 | 88 | if (count($filter['source']) == 1) { |
89 | 89 | $filter_query_where .= " AND format_source = '".$filter['source'][0]."'"; |
90 | 90 | } else { |
91 | - $filter_query_where .= " AND format_source IN ('".implode("','",$filter['source'])."')"; |
|
91 | + $filter_query_where .= " AND format_source IN ('".implode("','", $filter['source'])."')"; |
|
92 | 92 | } |
93 | 93 | } |
94 | 94 | if (isset($filter['ident']) && !empty($filter['ident'])) { |
@@ -118,15 +118,15 @@ discard block |
||
118 | 118 | $filter_query_date .= " AND EXTRACT(DAY FROM spotter_output.date) = '".$filter['day']."'"; |
119 | 119 | } |
120 | 120 | } |
121 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output".preg_replace('/^ AND/',' WHERE',$filter_query_date).") sd ON sd.flightaware_id = spotter_live.flightaware_id"; |
|
121 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output".preg_replace('/^ AND/', ' WHERE', $filter_query_date).") sd ON sd.flightaware_id = spotter_live.flightaware_id"; |
|
122 | 122 | } |
123 | 123 | if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) { |
124 | - $filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')"; |
|
124 | + $filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','", $filter['source_aprs'])."')"; |
|
125 | 125 | } |
126 | 126 | if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE'; |
127 | 127 | elseif ($filter_query_where != '' && $and) $filter_query_where .= ' AND'; |
128 | 128 | if ($filter_query_where != '') { |
129 | - $filter_query_where = preg_replace('/^ AND/',' WHERE',$filter_query_where); |
|
129 | + $filter_query_where = preg_replace('/^ AND/', ' WHERE', $filter_query_where); |
|
130 | 130 | } |
131 | 131 | $filter_query = $filter_query_join.$filter_query_where; |
132 | 132 | return $filter_query; |
@@ -149,8 +149,8 @@ discard block |
||
149 | 149 | if ($limit != '') |
150 | 150 | { |
151 | 151 | $limit_array = explode(',', $limit); |
152 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
153 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
152 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
153 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
154 | 154 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
155 | 155 | { |
156 | 156 | $limit_query = ' LIMIT '.$limit_array[1].' OFFSET '.$limit_array[0]; |
@@ -174,7 +174,7 @@ discard block |
||
174 | 174 | } else { |
175 | 175 | $query = "SELECT spotter_live.* FROM spotter_live 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.$orderby_query; |
176 | 176 | } |
177 | - $spotter_array = $Spotter->getDataFromDB($query.$limit_query,array(),'',true); |
|
177 | + $spotter_array = $Spotter->getDataFromDB($query.$limit_query, array(), '', true); |
|
178 | 178 | |
179 | 179 | return $spotter_array; |
180 | 180 | } |
@@ -189,7 +189,7 @@ discard block |
||
189 | 189 | { |
190 | 190 | global $globalDBdriver, $globalLiveInterval, $globalArchive; |
191 | 191 | date_default_timezone_set('UTC'); |
192 | - $filter_query = $this->getFilter($filter,true,true); |
|
192 | + $filter_query = $this->getFilter($filter, true, true); |
|
193 | 193 | if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
194 | 194 | if ($globalDBdriver == 'mysql') { |
195 | 195 | if (isset($globalArchive) && $globalArchive === TRUE) { |
@@ -212,7 +212,7 @@ discard block |
||
212 | 212 | try { |
213 | 213 | $sth = $this->db->prepare($query); |
214 | 214 | $sth->execute(); |
215 | - } catch(PDOException $e) { |
|
215 | + } catch (PDOException $e) { |
|
216 | 216 | echo $e->getMessage(); |
217 | 217 | die; |
218 | 218 | } |
@@ -226,19 +226,19 @@ discard block |
||
226 | 226 | * @return Array the spotter information |
227 | 227 | * |
228 | 228 | */ |
229 | - public function getMinLastLiveSpotterData($coord = array(),$filter = array(), $limit = false) |
|
229 | + public function getMinLastLiveSpotterData($coord = array(), $filter = array(), $limit = false) |
|
230 | 230 | { |
231 | 231 | global $globalDBdriver, $globalLiveInterval, $globalArchive, $globalMap3DAircraftsLimit; |
232 | 232 | date_default_timezone_set('UTC'); |
233 | 233 | $usecoord = false; |
234 | 234 | if (is_array($coord) && !empty($coord)) { |
235 | - $minlong = filter_var($coord[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
236 | - $minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
237 | - $maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
238 | - $maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
235 | + $minlong = filter_var($coord[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
236 | + $minlat = filter_var($coord[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
237 | + $maxlong = filter_var($coord[2], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
238 | + $maxlat = filter_var($coord[3], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
239 | 239 | $usecoord = true; |
240 | 240 | } |
241 | - $filter_query = $this->getFilter($filter,true,true); |
|
241 | + $filter_query = $this->getFilter($filter, true, true); |
|
242 | 242 | |
243 | 243 | if (!isset($globalLiveInterval) || $globalLiveInterval == '') $globalLiveInterval = '200'; |
244 | 244 | if (!isset($globalMap3DAircraftsLimit) || $globalMap3DAircraftsLimit == '') $globalMap3DAircraftsLimit = '300'; |
@@ -299,7 +299,7 @@ discard block |
||
299 | 299 | try { |
300 | 300 | $sth = $this->db->prepare($query); |
301 | 301 | $sth->execute(); |
302 | - } catch(PDOException $e) { |
|
302 | + } catch (PDOException $e) { |
|
303 | 303 | echo $e->getMessage(); |
304 | 304 | die; |
305 | 305 | } |
@@ -316,7 +316,7 @@ discard block |
||
316 | 316 | public function getLiveSpotterCount($filter = array()) |
317 | 317 | { |
318 | 318 | global $globalDBdriver, $globalLiveInterval; |
319 | - $filter_query = $this->getFilter($filter,true,true); |
|
319 | + $filter_query = $this->getFilter($filter, true, true); |
|
320 | 320 | |
321 | 321 | if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
322 | 322 | if ($globalDBdriver == 'mysql') { |
@@ -329,7 +329,7 @@ discard block |
||
329 | 329 | try { |
330 | 330 | $sth = $this->db->prepare($query); |
331 | 331 | $sth->execute(); |
332 | - } catch(PDOException $e) { |
|
332 | + } catch (PDOException $e) { |
|
333 | 333 | echo $e->getMessage(); |
334 | 334 | die; |
335 | 335 | } |
@@ -352,10 +352,10 @@ discard block |
||
352 | 352 | $filter_query = $this->getFilter($filter); |
353 | 353 | |
354 | 354 | if (is_array($coord)) { |
355 | - $minlong = filter_var($coord[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
356 | - $minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
357 | - $maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
358 | - $maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
355 | + $minlong = filter_var($coord[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
356 | + $minlat = filter_var($coord[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
357 | + $maxlong = filter_var($coord[2], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
358 | + $maxlat = filter_var($coord[3], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
359 | 359 | } else return array(); |
360 | 360 | if ($globalDBdriver == 'mysql') { |
361 | 361 | $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; |
@@ -378,23 +378,23 @@ discard block |
||
378 | 378 | global $globalDBdriver, $globalLiveInterval, $globalArchive; |
379 | 379 | $Spotter = new Spotter($this->db); |
380 | 380 | if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
381 | - $filter_query = $this->getFilter($filter,true,true); |
|
381 | + $filter_query = $this->getFilter($filter, true, true); |
|
382 | 382 | |
383 | 383 | if (is_array($coord)) { |
384 | - $minlong = filter_var($coord[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
385 | - $minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
386 | - $maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
387 | - $maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
384 | + $minlong = filter_var($coord[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
385 | + $minlat = filter_var($coord[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
386 | + $maxlong = filter_var($coord[2], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
387 | + $maxlat = filter_var($coord[3], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
388 | 388 | } else return array(); |
389 | 389 | if ($globalDBdriver == 'mysql') { |
390 | 390 | if (isset($globalArchive) && $globalArchive === TRUE) { |
391 | - $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, spotter_live.date, spotter_live.format_source |
|
391 | + $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, spotter_live.date, spotter_live.format_source |
|
392 | 392 | FROM spotter_live |
393 | 393 | '.$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= spotter_live.date |
394 | 394 | AND spotter_live.latitude BETWEEN '.$minlat.' AND '.$maxlat.' AND spotter_live.longitude BETWEEN '.$minlong.' AND '.$maxlong.' |
395 | 395 | AND spotter_live.latitude <> 0 AND spotter_live.longitude <> 0'; |
396 | 396 | } else { |
397 | - $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, spotter_live.date, spotter_live.format_source |
|
397 | + $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, spotter_live.date, spotter_live.format_source |
|
398 | 398 | FROM spotter_live |
399 | 399 | INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate |
400 | 400 | FROM spotter_live l |
@@ -406,14 +406,14 @@ discard block |
||
406 | 406 | } |
407 | 407 | } else { |
408 | 408 | if (isset($globalArchive) && $globalArchive === TRUE) { |
409 | - $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, spotter_live.date, spotter_live.format_source |
|
409 | + $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, spotter_live.date, spotter_live.format_source |
|
410 | 410 | FROM spotter_live |
411 | 411 | ".$filter_query." CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= spotter_live.date |
412 | 412 | AND spotter_live.latitude BETWEEN ".$minlat." AND ".$maxlat." |
413 | 413 | AND spotter_live.longitude BETWEEN ".$minlong." AND ".$maxlong." |
414 | 414 | AND spotter_live.latitude <> '0' AND spotter_live.longitude <> '0'"; |
415 | 415 | } else { |
416 | - $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, spotter_live.date, spotter_live.format_source |
|
416 | + $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, spotter_live.date, spotter_live.format_source |
|
417 | 417 | FROM spotter_live |
418 | 418 | INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate |
419 | 419 | FROM spotter_live l |
@@ -428,7 +428,7 @@ discard block |
||
428 | 428 | try { |
429 | 429 | $sth = $this->db->prepare($query); |
430 | 430 | $sth->execute(); |
431 | - } catch(PDOException $e) { |
|
431 | + } catch (PDOException $e) { |
|
432 | 432 | echo $e->getMessage(); |
433 | 433 | die; |
434 | 434 | } |
@@ -477,7 +477,7 @@ discard block |
||
477 | 477 | if ($interval == '1m') |
478 | 478 | { |
479 | 479 | $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= spotter_live.date '; |
480 | - } else if ($interval == '15m'){ |
|
480 | + } else if ($interval == '15m') { |
|
481 | 481 | $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 15 MINUTE) <= spotter_live.date '; |
482 | 482 | } |
483 | 483 | } |
@@ -485,14 +485,14 @@ discard block |
||
485 | 485 | $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= spotter_live.date '; |
486 | 486 | } |
487 | 487 | |
488 | - $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 |
|
488 | + $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 |
|
489 | 489 | WHERE spotter_live.latitude <> '' |
490 | 490 | AND spotter_live.longitude <> '' |
491 | 491 | ".$additional_query." |
492 | 492 | HAVING distance < :radius |
493 | 493 | ORDER BY distance"; |
494 | 494 | |
495 | - $spotter_array = $Spotter->getDataFromDB($query, array(':lat' => $lat, ':lng' => $lng,':radius' => $radius)); |
|
495 | + $spotter_array = $Spotter->getDataFromDB($query, array(':lat' => $lat, ':lng' => $lng, ':radius' => $radius)); |
|
496 | 496 | |
497 | 497 | return $spotter_array; |
498 | 498 | } |
@@ -510,9 +510,9 @@ discard block |
||
510 | 510 | date_default_timezone_set('UTC'); |
511 | 511 | |
512 | 512 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
513 | - $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'; |
|
513 | + $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'; |
|
514 | 514 | |
515 | - $spotter_array = $Spotter->getDataFromDB($query,array(':ident' => $ident),'',true); |
|
515 | + $spotter_array = $Spotter->getDataFromDB($query, array(':ident' => $ident), '', true); |
|
516 | 516 | |
517 | 517 | return $spotter_array; |
518 | 518 | } |
@@ -523,16 +523,16 @@ discard block |
||
523 | 523 | * @return Array the spotter information |
524 | 524 | * |
525 | 525 | */ |
526 | - public function getDateLiveSpotterDataByIdent($ident,$date) |
|
526 | + public function getDateLiveSpotterDataByIdent($ident, $date) |
|
527 | 527 | { |
528 | 528 | $Spotter = new Spotter($this->db); |
529 | 529 | date_default_timezone_set('UTC'); |
530 | 530 | |
531 | 531 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
532 | - $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.date <= :date 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'; |
|
532 | + $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.date <= :date 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'; |
|
533 | 533 | |
534 | - $date = date('c',$date); |
|
535 | - $spotter_array = $Spotter->getDataFromDB($query,array(':ident' => $ident,':date' => $date)); |
|
534 | + $date = date('c', $date); |
|
535 | + $spotter_array = $Spotter->getDataFromDB($query, array(':ident' => $ident, ':date' => $date)); |
|
536 | 536 | |
537 | 537 | return $spotter_array; |
538 | 538 | } |
@@ -548,8 +548,8 @@ discard block |
||
548 | 548 | $Spotter = new Spotter($this->db); |
549 | 549 | date_default_timezone_set('UTC'); |
550 | 550 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
551 | - $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'; |
|
552 | - $spotter_array = $Spotter->getDataFromDB($query,array(':id' => $id),'',true); |
|
551 | + $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'; |
|
552 | + $spotter_array = $Spotter->getDataFromDB($query, array(':id' => $id), '', true); |
|
553 | 553 | return $spotter_array; |
554 | 554 | } |
555 | 555 | |
@@ -559,15 +559,15 @@ discard block |
||
559 | 559 | * @return Array the spotter information |
560 | 560 | * |
561 | 561 | */ |
562 | - public function getDateLiveSpotterDataById($id,$date) |
|
562 | + public function getDateLiveSpotterDataById($id, $date) |
|
563 | 563 | { |
564 | 564 | $Spotter = new Spotter($this->db); |
565 | 565 | date_default_timezone_set('UTC'); |
566 | 566 | |
567 | 567 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
568 | - $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 AND l.date <= :date 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'; |
|
569 | - $date = date('c',$date); |
|
570 | - $spotter_array = $Spotter->getDataFromDB($query,array(':id' => $id,':date' => $date),'',true); |
|
568 | + $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 AND l.date <= :date 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'; |
|
569 | + $date = date('c', $date); |
|
570 | + $spotter_array = $Spotter->getDataFromDB($query, array(':id' => $id, ':date' => $date), '', true); |
|
571 | 571 | return $spotter_array; |
572 | 572 | } |
573 | 573 | |
@@ -583,13 +583,13 @@ discard block |
||
583 | 583 | date_default_timezone_set('UTC'); |
584 | 584 | |
585 | 585 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
586 | - $query = 'SELECT spotter_live.altitude, spotter_live.date FROM spotter_live WHERE spotter_live.ident = :ident'; |
|
586 | + $query = 'SELECT spotter_live.altitude, spotter_live.date FROM spotter_live WHERE spotter_live.ident = :ident'; |
|
587 | 587 | |
588 | 588 | try { |
589 | 589 | |
590 | 590 | $sth = $this->db->prepare($query); |
591 | 591 | $sth->execute(array(':ident' => $ident)); |
592 | - } catch(PDOException $e) { |
|
592 | + } catch (PDOException $e) { |
|
593 | 593 | echo $e->getMessage(); |
594 | 594 | die; |
595 | 595 | } |
@@ -604,7 +604,7 @@ discard block |
||
604 | 604 | * @return Array the spotter information |
605 | 605 | * |
606 | 606 | */ |
607 | - public function getAllLiveSpotterDataById($id,$liveinterval = false) |
|
607 | + public function getAllLiveSpotterDataById($id, $liveinterval = false) |
|
608 | 608 | { |
609 | 609 | global $globalDBdriver, $globalLiveInterval; |
610 | 610 | date_default_timezone_set('UTC'); |
@@ -623,7 +623,7 @@ discard block |
||
623 | 623 | try { |
624 | 624 | $sth = $this->db->prepare($query); |
625 | 625 | $sth->execute(array(':id' => $id)); |
626 | - } catch(PDOException $e) { |
|
626 | + } catch (PDOException $e) { |
|
627 | 627 | echo $e->getMessage(); |
628 | 628 | die; |
629 | 629 | } |
@@ -641,12 +641,12 @@ discard block |
||
641 | 641 | { |
642 | 642 | date_default_timezone_set('UTC'); |
643 | 643 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
644 | - $query = self::$global_query.' WHERE spotter_live.ident = :ident'; |
|
644 | + $query = self::$global_query.' WHERE spotter_live.ident = :ident'; |
|
645 | 645 | try { |
646 | 646 | |
647 | 647 | $sth = $this->db->prepare($query); |
648 | 648 | $sth->execute(array(':ident' => $ident)); |
649 | - } catch(PDOException $e) { |
|
649 | + } catch (PDOException $e) { |
|
650 | 650 | echo $e->getMessage(); |
651 | 651 | die; |
652 | 652 | } |
@@ -676,7 +676,7 @@ discard block |
||
676 | 676 | |
677 | 677 | $sth = $this->db->prepare($query); |
678 | 678 | $sth->execute(); |
679 | - } catch(PDOException $e) { |
|
679 | + } catch (PDOException $e) { |
|
680 | 680 | return "error"; |
681 | 681 | } |
682 | 682 | |
@@ -699,14 +699,14 @@ discard block |
||
699 | 699 | |
700 | 700 | $sth = $this->db->prepare($query); |
701 | 701 | $sth->execute(); |
702 | - } catch(PDOException $e) { |
|
702 | + } catch (PDOException $e) { |
|
703 | 703 | return "error"; |
704 | 704 | } |
705 | 705 | $query_delete = 'DELETE FROM spotter_live WHERE flightaware_id IN ('; |
706 | 706 | $i = 0; |
707 | - $j =0; |
|
707 | + $j = 0; |
|
708 | 708 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
709 | - foreach($all as $row) |
|
709 | + foreach ($all as $row) |
|
710 | 710 | { |
711 | 711 | $i++; |
712 | 712 | $j++; |
@@ -714,9 +714,9 @@ discard block |
||
714 | 714 | if ($globalDebug) echo "."; |
715 | 715 | try { |
716 | 716 | |
717 | - $sth = $this->db->prepare(substr($query_delete,0,-1).")"); |
|
717 | + $sth = $this->db->prepare(substr($query_delete, 0, -1).")"); |
|
718 | 718 | $sth->execute(); |
719 | - } catch(PDOException $e) { |
|
719 | + } catch (PDOException $e) { |
|
720 | 720 | return "error"; |
721 | 721 | } |
722 | 722 | $query_delete = 'DELETE FROM spotter_live WHERE flightaware_id IN ('; |
@@ -727,9 +727,9 @@ discard block |
||
727 | 727 | if ($i > 0) { |
728 | 728 | try { |
729 | 729 | |
730 | - $sth = $this->db->prepare(substr($query_delete,0,-1).")"); |
|
730 | + $sth = $this->db->prepare(substr($query_delete, 0, -1).")"); |
|
731 | 731 | $sth->execute(); |
732 | - } catch(PDOException $e) { |
|
732 | + } catch (PDOException $e) { |
|
733 | 733 | return "error"; |
734 | 734 | } |
735 | 735 | } |
@@ -742,7 +742,7 @@ discard block |
||
742 | 742 | |
743 | 743 | $sth = $this->db->prepare($query); |
744 | 744 | $sth->execute(); |
745 | - } catch(PDOException $e) { |
|
745 | + } catch (PDOException $e) { |
|
746 | 746 | return "error"; |
747 | 747 | } |
748 | 748 | /* $query_delete = "DELETE FROM spotter_live WHERE flightaware_id IN ("; |
@@ -790,13 +790,13 @@ discard block |
||
790 | 790 | public function deleteLiveSpotterDataByIdent($ident) |
791 | 791 | { |
792 | 792 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
793 | - $query = 'DELETE FROM spotter_live WHERE ident = :ident'; |
|
793 | + $query = 'DELETE FROM spotter_live WHERE ident = :ident'; |
|
794 | 794 | |
795 | 795 | try { |
796 | 796 | |
797 | 797 | $sth = $this->db->prepare($query); |
798 | 798 | $sth->execute(array(':ident' => $ident)); |
799 | - } catch(PDOException $e) { |
|
799 | + } catch (PDOException $e) { |
|
800 | 800 | return "error"; |
801 | 801 | } |
802 | 802 | |
@@ -812,13 +812,13 @@ discard block |
||
812 | 812 | public function deleteLiveSpotterDataById($id) |
813 | 813 | { |
814 | 814 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
815 | - $query = 'DELETE FROM spotter_live WHERE flightaware_id = :id'; |
|
815 | + $query = 'DELETE FROM spotter_live WHERE flightaware_id = :id'; |
|
816 | 816 | |
817 | 817 | try { |
818 | 818 | |
819 | 819 | $sth = $this->db->prepare($query); |
820 | 820 | $sth->execute(array(':id' => $id)); |
821 | - } catch(PDOException $e) { |
|
821 | + } catch (PDOException $e) { |
|
822 | 822 | return "error"; |
823 | 823 | } |
824 | 824 | |
@@ -836,13 +836,13 @@ discard block |
||
836 | 836 | { |
837 | 837 | global $globalDBdriver, $globalTimezone; |
838 | 838 | if ($globalDBdriver == 'mysql') { |
839 | - $query = 'SELECT spotter_live.ident FROM spotter_live |
|
839 | + $query = 'SELECT spotter_live.ident FROM spotter_live |
|
840 | 840 | WHERE spotter_live.ident = :ident |
841 | 841 | AND spotter_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 HOUR) |
842 | 842 | AND spotter_live.date < UTC_TIMESTAMP()'; |
843 | 843 | $query_data = array(':ident' => $ident); |
844 | 844 | } else { |
845 | - $query = "SELECT spotter_live.ident FROM spotter_live |
|
845 | + $query = "SELECT spotter_live.ident FROM spotter_live |
|
846 | 846 | WHERE spotter_live.ident = :ident |
847 | 847 | AND spotter_live.date >= now() AT TIME ZONE 'UTC' - INTERVAL '1 HOURS' |
848 | 848 | AND spotter_live.date < now() AT TIME ZONE 'UTC'"; |
@@ -851,8 +851,8 @@ discard block |
||
851 | 851 | |
852 | 852 | $sth = $this->db->prepare($query); |
853 | 853 | $sth->execute($query_data); |
854 | - $ident_result=''; |
|
855 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
854 | + $ident_result = ''; |
|
855 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
856 | 856 | { |
857 | 857 | $ident_result = $row['ident']; |
858 | 858 | } |
@@ -869,13 +869,13 @@ discard block |
||
869 | 869 | { |
870 | 870 | global $globalDBdriver, $globalTimezone; |
871 | 871 | if ($globalDBdriver == 'mysql') { |
872 | - $query = 'SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live |
|
872 | + $query = 'SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live |
|
873 | 873 | WHERE spotter_live.ident = :ident |
874 | 874 | AND spotter_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 30 MINUTE)'; |
875 | 875 | // AND spotter_live.date < UTC_TIMESTAMP()"; |
876 | 876 | $query_data = array(':ident' => $ident); |
877 | 877 | } else { |
878 | - $query = "SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live |
|
878 | + $query = "SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live |
|
879 | 879 | WHERE spotter_live.ident = :ident |
880 | 880 | AND spotter_live.date >= now() AT TIME ZONE 'UTC' - INTERVAL '30 MINUTES'"; |
881 | 881 | // AND spotter_live.date < now() AT TIME ZONE 'UTC'"; |
@@ -884,8 +884,8 @@ discard block |
||
884 | 884 | |
885 | 885 | $sth = $this->db->prepare($query); |
886 | 886 | $sth->execute($query_data); |
887 | - $ident_result=''; |
|
888 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
887 | + $ident_result = ''; |
|
888 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
889 | 889 | { |
890 | 890 | $ident_result = $row['flightaware_id']; |
891 | 891 | } |
@@ -902,13 +902,13 @@ discard block |
||
902 | 902 | { |
903 | 903 | global $globalDBdriver, $globalTimezone; |
904 | 904 | if ($globalDBdriver == 'mysql') { |
905 | - $query = 'SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live |
|
905 | + $query = 'SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live |
|
906 | 906 | WHERE spotter_live.flightaware_id = :id |
907 | 907 | AND spotter_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 10 HOUR)'; |
908 | 908 | // AND spotter_live.date < UTC_TIMESTAMP()"; |
909 | 909 | $query_data = array(':id' => $id); |
910 | 910 | } else { |
911 | - $query = "SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live |
|
911 | + $query = "SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live |
|
912 | 912 | WHERE spotter_live.flightaware_id = :id |
913 | 913 | AND spotter_live.date >= now() AT TIME ZONE 'UTC' - INTERVAL '10 HOUR'"; |
914 | 914 | // AND spotter_live.date < now() AT TIME ZONE 'UTC'"; |
@@ -917,8 +917,8 @@ discard block |
||
917 | 917 | |
918 | 918 | $sth = $this->db->prepare($query); |
919 | 919 | $sth->execute($query_data); |
920 | - $ident_result=''; |
|
921 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
920 | + $ident_result = ''; |
|
921 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
922 | 922 | { |
923 | 923 | $ident_result = $row['flightaware_id']; |
924 | 924 | } |
@@ -935,13 +935,13 @@ discard block |
||
935 | 935 | { |
936 | 936 | global $globalDBdriver, $globalTimezone; |
937 | 937 | if ($globalDBdriver == 'mysql') { |
938 | - $query = 'SELECT spotter_live.ModeS, spotter_live.flightaware_id FROM spotter_live |
|
938 | + $query = 'SELECT spotter_live.ModeS, spotter_live.flightaware_id FROM spotter_live |
|
939 | 939 | WHERE spotter_live.ModeS = :modes |
940 | 940 | AND spotter_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 30 MINUTE)'; |
941 | 941 | // AND spotter_live.date < UTC_TIMESTAMP()"; |
942 | 942 | $query_data = array(':modes' => $modes); |
943 | 943 | } else { |
944 | - $query = "SELECT spotter_live.ModeS, spotter_live.flightaware_id FROM spotter_live |
|
944 | + $query = "SELECT spotter_live.ModeS, spotter_live.flightaware_id FROM spotter_live |
|
945 | 945 | WHERE spotter_live.ModeS = :modes |
946 | 946 | AND spotter_live.date >= CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '30 MINUTE'"; |
947 | 947 | // // AND spotter_live.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC'"; |
@@ -950,8 +950,8 @@ discard block |
||
950 | 950 | |
951 | 951 | $sth = $this->db->prepare($query); |
952 | 952 | $sth->execute($query_data); |
953 | - $ident_result=''; |
|
954 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
953 | + $ident_result = ''; |
|
954 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
955 | 955 | { |
956 | 956 | //$ident_result = $row['spotter_live_id']; |
957 | 957 | $ident_result = $row['flightaware_id']; |
@@ -976,8 +976,8 @@ discard block |
||
976 | 976 | return array(); |
977 | 977 | } else { |
978 | 978 | $q_array = explode(" ", $q); |
979 | - foreach ($q_array as $q_item){ |
|
980 | - $q_item = filter_var($q_item,FILTER_SANITIZE_STRING); |
|
979 | + foreach ($q_array as $q_item) { |
|
980 | + $q_item = filter_var($q_item, FILTER_SANITIZE_STRING); |
|
981 | 981 | $additional_query .= " AND ("; |
982 | 982 | $additional_query .= "(spotter_live.aircraft_icao like '%".$q_item."%') OR "; |
983 | 983 | $additional_query .= "(spotter_live.aircraft_name like '%".$q_item."%') OR "; |
@@ -992,11 +992,11 @@ discard block |
||
992 | 992 | } |
993 | 993 | } |
994 | 994 | if ($globalDBdriver == 'mysql') { |
995 | - $query = "SELECT spotter_live.* FROM spotter_live |
|
995 | + $query = "SELECT spotter_live.* FROM spotter_live |
|
996 | 996 | WHERE spotter_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 20 SECOND) ".$additional_query." |
997 | 997 | AND spotter_live.date < UTC_TIMESTAMP()"; |
998 | 998 | } else { |
999 | - $query = "SELECT spotter_live.* FROM spotter_live |
|
999 | + $query = "SELECT spotter_live.* FROM spotter_live |
|
1000 | 1000 | WHERE spotter_live.date::timestamp >= CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '20 SECONDS' ".$additional_query." |
1001 | 1001 | AND spotter_live.date::timestamp < CURRENT_TIMESTAMP AT TIME ZONE 'UTC'"; |
1002 | 1002 | } |
@@ -1016,7 +1016,7 @@ discard block |
||
1016 | 1016 | * @return String success or false |
1017 | 1017 | * |
1018 | 1018 | */ |
1019 | - public function addLiveSpotterData($flightaware_id = '', $ident = '', $aircraft_icao = '', $departure_airport_icao = '', $arrival_airport_icao = '', $latitude = '', $longitude = '', $waypoints = '', $altitude = '', $altitude_real = '',$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 = '') |
|
1019 | + public function addLiveSpotterData($flightaware_id = '', $ident = '', $aircraft_icao = '', $departure_airport_icao = '', $arrival_airport_icao = '', $latitude = '', $longitude = '', $waypoints = '', $altitude = '', $altitude_real = '', $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 = '') |
|
1020 | 1020 | { |
1021 | 1021 | global $globalURL, $globalArchive, $globalDebug; |
1022 | 1022 | $Common = new Common(); |
@@ -1116,27 +1116,27 @@ discard block |
||
1116 | 1116 | if ($date == '') $date = date("Y-m-d H:i:s", time()); |
1117 | 1117 | |
1118 | 1118 | |
1119 | - $flightaware_id = filter_var($flightaware_id,FILTER_SANITIZE_STRING); |
|
1120 | - $ident = filter_var($ident,FILTER_SANITIZE_STRING); |
|
1121 | - $aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING); |
|
1122 | - $departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING); |
|
1123 | - $arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING); |
|
1124 | - $latitude = filter_var($latitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
1125 | - $longitude = filter_var($longitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
1126 | - $waypoints = filter_var($waypoints,FILTER_SANITIZE_STRING); |
|
1127 | - $altitude = filter_var($altitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
1128 | - $altitude_real = filter_var($altitude_real,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
1129 | - $heading = filter_var($heading,FILTER_SANITIZE_NUMBER_INT); |
|
1130 | - $groundspeed = filter_var($groundspeed,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
1131 | - $squawk = filter_var($squawk,FILTER_SANITIZE_NUMBER_INT); |
|
1132 | - $route_stop = filter_var($route_stop,FILTER_SANITIZE_STRING); |
|
1133 | - $ModeS = filter_var($ModeS,FILTER_SANITIZE_STRING); |
|
1134 | - $pilot_id = filter_var($pilot_id,FILTER_SANITIZE_STRING); |
|
1135 | - $pilot_name = filter_var($pilot_name,FILTER_SANITIZE_STRING); |
|
1136 | - $format_source = filter_var($format_source,FILTER_SANITIZE_STRING); |
|
1137 | - $source_name = filter_var($source_name,FILTER_SANITIZE_STRING); |
|
1138 | - $over_country = filter_var($over_country,FILTER_SANITIZE_STRING); |
|
1139 | - $verticalrate = filter_var($verticalrate,FILTER_SANITIZE_NUMBER_INT); |
|
1119 | + $flightaware_id = filter_var($flightaware_id, FILTER_SANITIZE_STRING); |
|
1120 | + $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
|
1121 | + $aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING); |
|
1122 | + $departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING); |
|
1123 | + $arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING); |
|
1124 | + $latitude = filter_var($latitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
1125 | + $longitude = filter_var($longitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
1126 | + $waypoints = filter_var($waypoints, FILTER_SANITIZE_STRING); |
|
1127 | + $altitude = filter_var($altitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
1128 | + $altitude_real = filter_var($altitude_real, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
1129 | + $heading = filter_var($heading, FILTER_SANITIZE_NUMBER_INT); |
|
1130 | + $groundspeed = filter_var($groundspeed, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
1131 | + $squawk = filter_var($squawk, FILTER_SANITIZE_NUMBER_INT); |
|
1132 | + $route_stop = filter_var($route_stop, FILTER_SANITIZE_STRING); |
|
1133 | + $ModeS = filter_var($ModeS, FILTER_SANITIZE_STRING); |
|
1134 | + $pilot_id = filter_var($pilot_id, FILTER_SANITIZE_STRING); |
|
1135 | + $pilot_name = filter_var($pilot_name, FILTER_SANITIZE_STRING); |
|
1136 | + $format_source = filter_var($format_source, FILTER_SANITIZE_STRING); |
|
1137 | + $source_name = filter_var($source_name, FILTER_SANITIZE_STRING); |
|
1138 | + $over_country = filter_var($over_country, FILTER_SANITIZE_STRING); |
|
1139 | + $verticalrate = filter_var($verticalrate, FILTER_SANITIZE_NUMBER_INT); |
|
1140 | 1140 | |
1141 | 1141 | $airline_name = ''; |
1142 | 1142 | $airline_icao = ''; |
@@ -1158,10 +1158,10 @@ discard block |
||
1158 | 1158 | $arrival_airport_country = ''; |
1159 | 1159 | |
1160 | 1160 | |
1161 | - if ($squawk == '' || $Common->isInteger($squawk) === false ) $squawk = NULL; |
|
1162 | - if ($verticalrate == '' || $Common->isInteger($verticalrate) === false ) $verticalrate = NULL; |
|
1163 | - if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) $groundspeed = 0; |
|
1164 | - if ($heading == '' || $Common->isInteger($heading) === false ) $heading = 0; |
|
1161 | + if ($squawk == '' || $Common->isInteger($squawk) === false) $squawk = NULL; |
|
1162 | + if ($verticalrate == '' || $Common->isInteger($verticalrate) === false) $verticalrate = NULL; |
|
1163 | + if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0; |
|
1164 | + if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0; |
|
1165 | 1165 | |
1166 | 1166 | $query = ''; |
1167 | 1167 | if ($globalArchive) { |
@@ -1172,19 +1172,19 @@ discard block |
||
1172 | 1172 | $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, real_altitude) |
1173 | 1173 | 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, :real_altitude)'; |
1174 | 1174 | |
1175 | - $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,':real_altitude' => $altitude_real); |
|
1175 | + $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, ':real_altitude' => $altitude_real); |
|
1176 | 1176 | try { |
1177 | 1177 | |
1178 | 1178 | $sth = $this->db->prepare($query); |
1179 | 1179 | $sth->execute($query_values); |
1180 | 1180 | $sth->closeCursor(); |
1181 | - } catch(PDOException $e) { |
|
1181 | + } catch (PDOException $e) { |
|
1182 | 1182 | return "error : ".$e->getMessage(); |
1183 | 1183 | } |
1184 | 1184 | if (isset($globalArchive) && $globalArchive && $putinarchive && $noarchive !== true) { |
1185 | 1185 | if ($globalDebug) echo '(Add to SBS archive : '; |
1186 | 1186 | $SpotterArchive = new SpotterArchive($this->db); |
1187 | - $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, $altitude_real,$heading, $groundspeed, $squawk, $ModeS, $pilot_id, $pilot_name,$verticalrate,$format_source,$source_name, $over_country); |
|
1187 | + $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, $altitude_real, $heading, $groundspeed, $squawk, $ModeS, $pilot_id, $pilot_name, $verticalrate, $format_source, $source_name, $over_country); |
|
1188 | 1188 | if ($globalDebug) echo $result.')'; |
1189 | 1189 | } elseif ($globalDebug && $putinarchive !== true) { |
1190 | 1190 | echo '(Not adding to archive)'; |
@@ -1197,7 +1197,7 @@ discard block |
||
1197 | 1197 | |
1198 | 1198 | public function getOrderBy() |
1199 | 1199 | { |
1200 | - $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")); |
|
1200 | + $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")); |
|
1201 | 1201 | return $orderby; |
1202 | 1202 | } |
1203 | 1203 |
@@ -40,8 +40,12 @@ discard block |
||
40 | 40 | $year = filter_input(INPUT_GET,'year',FILTER_SANITIZE_NUMBER_INT); |
41 | 41 | $month = filter_input(INPUT_GET,'month',FILTER_SANITIZE_NUMBER_INT); |
42 | 42 | $filter = array(); |
43 | - if ($year != '') $filter = array_merge($filter,array('year' => $year)); |
|
44 | - if ($month != '') $filter = array_merge($filter,array('month' => $month)); |
|
43 | + if ($year != '') { |
|
44 | + $filter = array_merge($filter,array('year' => $year)); |
|
45 | + } |
|
46 | + if ($month != '') { |
|
47 | + $filter = array_merge($filter,array('month' => $month)); |
|
48 | + } |
|
45 | 49 | if ($sort != '') |
46 | 50 | { |
47 | 51 | $spotter_array = $Spotter->getSpotterDataByOwner($owner,$limit_start.",".$absolute_difference, $sort,$filter); |
@@ -59,8 +63,12 @@ discard block |
||
59 | 63 | { |
60 | 64 | $title = sprintf(_("Detailed View for %s"),$spotter_array[0]['aircraft_owner']); |
61 | 65 | //$ident = $spotter_array[0]['ident']; |
62 | - if (isset($spotter_array[0]['latitude'])) $latitude = $spotter_array[0]['latitude']; |
|
63 | - if (isset($spotter_array[0]['longitude'])) $longitude = $spotter_array[0]['longitude']; |
|
66 | + if (isset($spotter_array[0]['latitude'])) { |
|
67 | + $latitude = $spotter_array[0]['latitude']; |
|
68 | + } |
|
69 | + if (isset($spotter_array[0]['longitude'])) { |
|
70 | + $longitude = $spotter_array[0]['longitude']; |
|
71 | + } |
|
64 | 72 | require_once('header.php'); |
65 | 73 | /* |
66 | 74 | if (isset($globalArchive) && $globalArchive) { |
@@ -115,9 +123,14 @@ discard block |
||
115 | 123 | print '<h1>'.$spotter_array[0]['aircraft_owner'].'</h1>'; |
116 | 124 | //print '<div><span class="label">'._("Owner").'</span>'.$spotter_array[0]['aircraft_owner'].'</div>'; |
117 | 125 | $Stats = new Stats(); |
118 | - if ($year == '' && $month == '') $flights = $Stats->getStatsOwner($owner); |
|
119 | - else $flights = 0; |
|
120 | - if ($flights == 0) $flights = $Spotter->countFlightsByOwner($owner,$filter); |
|
126 | + if ($year == '' && $month == '') { |
|
127 | + $flights = $Stats->getStatsOwner($owner); |
|
128 | + } else { |
|
129 | + $flights = 0; |
|
130 | + } |
|
131 | + if ($flights == 0) { |
|
132 | + $flights = $Spotter->countFlightsByOwner($owner,$filter); |
|
133 | + } |
|
121 | 134 | print '<div><span class="label">'._("Flights").'</span>'.$flights.'</div>'; |
122 | 135 | $aircraft_type = count($Spotter->countAllAircraftTypesByOwner($owner,$filter)); |
123 | 136 | print '<div><span class="label">'._("Aircrafts type").'</span>'.$aircraft_type.'</div>'; |
@@ -128,7 +141,9 @@ discard block |
||
128 | 141 | $airlines = count($Spotter->countAllAirlinesByOwner($owner,$filter)); |
129 | 142 | print '<div><span class="label">'._("Airlines").'</span>'.$airlines.'</div>'; |
130 | 143 | $duration = $Spotter->getFlightDurationByOwner($owner,$filter); |
131 | - if ($duration != '0') print '<div><span class="label">'._("Total flights spotted duration").'</span>'.$duration.'</div>'; |
|
144 | + if ($duration != '0') { |
|
145 | + print '<div><span class="label">'._("Total flights spotted duration").'</span>'.$duration.'</div>'; |
|
146 | + } |
|
132 | 147 | print '</div>'; |
133 | 148 | |
134 | 149 | include('owner-sub-menu.php'); |
@@ -7,14 +7,14 @@ discard block |
||
7 | 7 | //require_once('require/class.SpotterLive.php'); |
8 | 8 | require_once('require/class.SpotterArchive.php'); |
9 | 9 | |
10 | -if (!isset($_GET['owner'])){ |
|
10 | +if (!isset($_GET['owner'])) { |
|
11 | 11 | header('Location: '.$globalURL.''); |
12 | 12 | } else { |
13 | 13 | $Spotter = new Spotter(); |
14 | 14 | $SpotterArchive = new SpotterArchive(); |
15 | 15 | //$Translation = new Translation(); |
16 | 16 | //calculuation for the pagination |
17 | - if(!isset($_GET['limit'])) |
|
17 | + if (!isset($_GET['limit'])) |
|
18 | 18 | { |
19 | 19 | $limit_start = 0; |
20 | 20 | $limit_end = 25; |
@@ -22,8 +22,8 @@ discard block |
||
22 | 22 | } else { |
23 | 23 | $limit_explode = explode(",", $_GET['limit']); |
24 | 24 | if (isset($limit_explode[1])) { |
25 | - $limit_start = filter_var($limit_explode[0],FILTER_SANITIZE_NUMBER_INT); |
|
26 | - $limit_end = filter_var($limit_explode[1],FILTER_SANITIZE_NUMBER_INT); |
|
25 | + $limit_start = filter_var($limit_explode[0], FILTER_SANITIZE_NUMBER_INT); |
|
26 | + $limit_end = filter_var($limit_explode[1], FILTER_SANITIZE_NUMBER_INT); |
|
27 | 27 | } else { |
28 | 28 | $limit_start = 0; |
29 | 29 | $limit_end = 25; |
@@ -40,29 +40,29 @@ discard block |
||
40 | 40 | |
41 | 41 | $page_url = $globalURL.'/owner/'.$_GET['owner']; |
42 | 42 | |
43 | - $owner = urldecode(filter_input(INPUT_GET,'owner',FILTER_SANITIZE_STRING)); |
|
44 | - $sort = filter_input(INPUT_GET,'sort',FILTER_SANITIZE_STRING); |
|
45 | - $year = filter_input(INPUT_GET,'year',FILTER_SANITIZE_NUMBER_INT); |
|
46 | - $month = filter_input(INPUT_GET,'month',FILTER_SANITIZE_NUMBER_INT); |
|
43 | + $owner = urldecode(filter_input(INPUT_GET, 'owner', FILTER_SANITIZE_STRING)); |
|
44 | + $sort = filter_input(INPUT_GET, 'sort', FILTER_SANITIZE_STRING); |
|
45 | + $year = filter_input(INPUT_GET, 'year', FILTER_SANITIZE_NUMBER_INT); |
|
46 | + $month = filter_input(INPUT_GET, 'month', FILTER_SANITIZE_NUMBER_INT); |
|
47 | 47 | $filter = array(); |
48 | - if ($year != '') $filter = array_merge($filter,array('year' => $year)); |
|
49 | - if ($month != '') $filter = array_merge($filter,array('month' => $month)); |
|
48 | + if ($year != '') $filter = array_merge($filter, array('year' => $year)); |
|
49 | + if ($month != '') $filter = array_merge($filter, array('month' => $month)); |
|
50 | 50 | if ($sort != '') |
51 | 51 | { |
52 | - $spotter_array = $Spotter->getSpotterDataByOwner($owner,$limit_start.",".$absolute_difference, $sort,$filter); |
|
52 | + $spotter_array = $Spotter->getSpotterDataByOwner($owner, $limit_start.",".$absolute_difference, $sort, $filter); |
|
53 | 53 | if (empty($spotter_array) && isset($globalArchiveResults) && $globalArchiveResults) { |
54 | - $spotter_array = $SpotterArchive->getSpotterDataByOwner($owner,$limit_start.",".$absolute_difference, $sort,$filter); |
|
54 | + $spotter_array = $SpotterArchive->getSpotterDataByOwner($owner, $limit_start.",".$absolute_difference, $sort, $filter); |
|
55 | 55 | } |
56 | 56 | } else { |
57 | - $spotter_array = $Spotter->getSpotterDataByOwner($owner,$limit_start.",".$absolute_difference,'',$filter); |
|
57 | + $spotter_array = $Spotter->getSpotterDataByOwner($owner, $limit_start.",".$absolute_difference, '', $filter); |
|
58 | 58 | if (empty($spotter_array) && isset($globalArchiveResults) && $globalArchiveResults) { |
59 | - $spotter_array = $SpotterArchive->getSpotterDataByOwner($owner,$limit_start.",".$absolute_difference,'',$filter); |
|
59 | + $spotter_array = $SpotterArchive->getSpotterDataByOwner($owner, $limit_start.",".$absolute_difference, '', $filter); |
|
60 | 60 | } |
61 | 61 | } |
62 | 62 | |
63 | 63 | if (!empty($spotter_array)) |
64 | 64 | { |
65 | - $title = sprintf(_("Detailed View for %s"),$spotter_array[0]['aircraft_owner']); |
|
65 | + $title = sprintf(_("Detailed View for %s"), $spotter_array[0]['aircraft_owner']); |
|
66 | 66 | //$ident = $spotter_array[0]['ident']; |
67 | 67 | if (isset($spotter_array[0]['latitude'])) $latitude = $spotter_array[0]['latitude']; |
68 | 68 | if (isset($spotter_array[0]['longitude'])) $longitude = $spotter_array[0]['longitude']; |
@@ -122,23 +122,23 @@ discard block |
||
122 | 122 | $Stats = new Stats(); |
123 | 123 | if ($year == '' && $month == '') $flights = $Stats->getStatsOwner($owner); |
124 | 124 | else $flights = 0; |
125 | - if ($flights == 0) $flights = $Spotter->countFlightsByOwner($owner,$filter); |
|
125 | + if ($flights == 0) $flights = $Spotter->countFlightsByOwner($owner, $filter); |
|
126 | 126 | print '<div><span class="label">'._("Flights").'</span>'.$flights.'</div>'; |
127 | - $aircraft_type = count($Spotter->countAllAircraftTypesByOwner($owner,$filter)); |
|
127 | + $aircraft_type = count($Spotter->countAllAircraftTypesByOwner($owner, $filter)); |
|
128 | 128 | print '<div><span class="label">'._("Aircrafts type").'</span>'.$aircraft_type.'</div>'; |
129 | - $aircraft_registration = count($Spotter->countAllAircraftRegistrationByOwner($owner,$filter)); |
|
129 | + $aircraft_registration = count($Spotter->countAllAircraftRegistrationByOwner($owner, $filter)); |
|
130 | 130 | print '<div><span class="label">'._("Aircrafts").'</span>'.$aircraft_registration.'</div>'; |
131 | - $aircraft_manufacturer = count($Spotter->countAllAircraftManufacturerByOwner($owner,$filter)); |
|
131 | + $aircraft_manufacturer = count($Spotter->countAllAircraftManufacturerByOwner($owner, $filter)); |
|
132 | 132 | print '<div><span class="label">'._("Manufacturers").'</span>'.$aircraft_manufacturer.'</div>'; |
133 | - $airlines = count($Spotter->countAllAirlinesByOwner($owner,$filter)); |
|
133 | + $airlines = count($Spotter->countAllAirlinesByOwner($owner, $filter)); |
|
134 | 134 | print '<div><span class="label">'._("Airlines").'</span>'.$airlines.'</div>'; |
135 | - $duration = $Spotter->getFlightDurationByOwner($owner,$filter); |
|
135 | + $duration = $Spotter->getFlightDurationByOwner($owner, $filter); |
|
136 | 136 | if ($duration != '0') print '<div><span class="label">'._("Total flights spotted duration").'</span>'.$duration.'</div>'; |
137 | 137 | print '</div>'; |
138 | 138 | |
139 | 139 | include('owner-sub-menu.php'); |
140 | 140 | print '<div class="table column">'; |
141 | - print '<p>'.sprintf(_("The table below shows the detailed information of all flights with the owner <strong>%s</strong>."),$spotter_array[0]['aircraft_owner']).'</p>'; |
|
141 | + print '<p>'.sprintf(_("The table below shows the detailed information of all flights with the owner <strong>%s</strong>."), $spotter_array[0]['aircraft_owner']).'</p>'; |
|
142 | 142 | |
143 | 143 | include('table-output.php'); |
144 | 144 | print '<div class="pagination">'; |
@@ -3,7 +3,7 @@ |
||
3 | 3 | </span> |
4 | 4 | <div class="sub-menu sub-menu-container"> |
5 | 5 | <ul class="nav nav-pills"> |
6 | - <li><a href="<?php print $globalURL; ?>/flightid/<?php print $id; ?>" <?php if (strtolower($current_page) == "flightid-overview"){ print 'class="active"'; } ?>><?php echo _("Detailed"); ?></a></li> |
|
6 | + <li><a href="<?php print $globalURL; ?>/flightid/<?php print $id; ?>" <?php if (strtolower($current_page) == "flightid-overview") { print 'class="active"'; } ?>><?php echo _("Detailed"); ?></a></li> |
|
7 | 7 | <?php if ($globalFlightAware) { ?> |
8 | 8 | <li><a href="http://flightaware.com/live/flight/id/<?php print $spotter_array[0]['flightaware_id']; ?>" target="_blank"><?php echo _("Flight Status"); ?>»</a></li> |
9 | 9 | <li><a href="http://flightaware.com/live/flight/id/<?php print $spotter_array[0]['flightaware_id']; ?>/tracklog" target="_blank"><?php echo _("Flight Log"); ?>»</a></li> |
@@ -3,10 +3,10 @@ discard block |
||
3 | 3 | </span> |
4 | 4 | <div class="sub-menu sub-menu-container"> |
5 | 5 | <ul class="nav nav-pills"> |
6 | - <li><a href="<?php print $globalURL; ?>/aircraft/<?php print $aircraft_type; ?>" <?php if (strtolower($current_page) == "aircraft-detailed"){ print 'class="active"'; } ?>><?php echo _("Detailed"); ?></a></li> |
|
7 | - <li><a href="<?php print $globalURL; ?>/aircraft/statistics/registration/<?php print $aircraft_type; ?>" <?php if (strtolower($current_page) == "aircraft-statistics-registration"){ print 'class="active"'; } ?>><?php echo _("Registration"); ?></a></li> |
|
6 | + <li><a href="<?php print $globalURL; ?>/aircraft/<?php print $aircraft_type; ?>" <?php if (strtolower($current_page) == "aircraft-detailed") { print 'class="active"'; } ?>><?php echo _("Detailed"); ?></a></li> |
|
7 | + <li><a href="<?php print $globalURL; ?>/aircraft/statistics/registration/<?php print $aircraft_type; ?>" <?php if (strtolower($current_page) == "aircraft-statistics-registration") { print 'class="active"'; } ?>><?php echo _("Registration"); ?></a></li> |
|
8 | 8 | <li class="dropdown"> |
9 | - <a class="dropdown-toggle <?php if(strtolower($current_page) == "aircraft-statistics-airline" || strtolower($current_page) == "aircraft-statistics-airline-country"){ print 'active'; } ?>" data-toggle="dropdown" href="#"> |
|
9 | + <a class="dropdown-toggle <?php if (strtolower($current_page) == "aircraft-statistics-airline" || strtolower($current_page) == "aircraft-statistics-airline-country") { print 'active'; } ?>" data-toggle="dropdown" href="#"> |
|
10 | 10 | <?php echo _("Airline"); ?> <span class="caret"></span> |
11 | 11 | </a> |
12 | 12 | <ul class="dropdown-menu" role="menu"> |
@@ -15,7 +15,7 @@ discard block |
||
15 | 15 | </ul> |
16 | 16 | </li> |
17 | 17 | <li class="dropdown"> |
18 | - <a class="dropdown-toggle <?php if(strtolower($current_page) == "aircraft-statistics-departure-airport" || strtolower($current_page) == "aircraft-statistics-departure-airport-country" || strtolower($current_page) == "aircraft-statistics-arrival-airport" || strtolower($current_page) == "aircraft-statistics-arrival-airport-country"){ print 'active'; } ?>" data-toggle="dropdown" href="#"> |
|
18 | + <a class="dropdown-toggle <?php if (strtolower($current_page) == "aircraft-statistics-departure-airport" || strtolower($current_page) == "aircraft-statistics-departure-airport-country" || strtolower($current_page) == "aircraft-statistics-arrival-airport" || strtolower($current_page) == "aircraft-statistics-arrival-airport-country") { print 'active'; } ?>" data-toggle="dropdown" href="#"> |
|
19 | 19 | <?php echo _("Airport"); ?> <span class="caret"></span> |
20 | 20 | </a> |
21 | 21 | <ul class="dropdown-menu" role="menu"> |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | <li><a href="<?php print $globalURL; ?>/aircraft/statistics/arrival-airport-country/<?php print $aircraft_type; ?>"><?php echo _("Arrival Airport by Country"); ?></a></li> |
26 | 26 | </ul> |
27 | 27 | </li> |
28 | - <li><a href="<?php print $globalURL; ?>/aircraft/statistics/route/<?php print $aircraft_type; ?>" <?php if (strtolower($current_page) == "aircraft-statistics-route"){ print 'class="active"'; } ?>><?php echo _("Route"); ?></a></li> |
|
29 | - <li><a href="<?php print $globalURL; ?>/aircraft/statistics/time/<?php print $aircraft_type; ?>" <?php if (strtolower($current_page) == "aircraft-statistics-time"){ print 'class="active"'; } ?>><?php echo ("Time"); ?></a></li> |
|
28 | + <li><a href="<?php print $globalURL; ?>/aircraft/statistics/route/<?php print $aircraft_type; ?>" <?php if (strtolower($current_page) == "aircraft-statistics-route") { print 'class="active"'; } ?>><?php echo _("Route"); ?></a></li> |
|
29 | + <li><a href="<?php print $globalURL; ?>/aircraft/statistics/time/<?php print $aircraft_type; ?>" <?php if (strtolower($current_page) == "aircraft-statistics-time") { print 'class="active"'; } ?>><?php echo ("Time"); ?></a></li> |
|
30 | 30 | </ul> |
31 | 31 | </div> |
32 | 32 | \ No newline at end of file |
@@ -7,15 +7,15 @@ discard block |
||
7 | 7 | require_once('require/class.Connection.php'); |
8 | 8 | require_once('require/class.Spotter.php'); |
9 | 9 | require_once('require/class.Language.php'); |
10 | -$sort = filter_input(INPUT_GET,'sort',FILTER_SANITIZE_STRING); |
|
11 | -$departure_airport = filter_input(INPUT_GET,'departure_airport',FILTER_SANITIZE_STRING); |
|
12 | -$arrival_airport = filter_input(INPUT_GET,'arrival_airport',FILTER_SANITIZE_STRING); |
|
10 | +$sort = filter_input(INPUT_GET, 'sort', FILTER_SANITIZE_STRING); |
|
11 | +$departure_airport = filter_input(INPUT_GET, 'departure_airport', FILTER_SANITIZE_STRING); |
|
12 | +$arrival_airport = filter_input(INPUT_GET, 'arrival_airport', FILTER_SANITIZE_STRING); |
|
13 | 13 | $Spotter = new Spotter(); |
14 | 14 | $spotter_array = $Spotter->getSpotterDataByRoute($departure_airport, $arrival_airport, "0,1", $sort); |
15 | 15 | |
16 | 16 | if (!empty($spotter_array)) |
17 | 17 | { |
18 | - $title = sprintf(_("Most Common Aircraft between %s (%s), %s - %s (%s), %s"),$spotter_array[0]['departure_airport_name'],$spotter_array[0]['departure_airport_icao'],$spotter_array[0]['departure_airport_country'],$spotter_array[0]['arrival_airport_name'],$spotter_array[0]['arrival_airport_icao'],$spotter_array[0]['arrival_airport_country']); |
|
18 | + $title = sprintf(_("Most Common Aircraft between %s (%s), %s - %s (%s), %s"), $spotter_array[0]['departure_airport_name'], $spotter_array[0]['departure_airport_icao'], $spotter_array[0]['departure_airport_country'], $spotter_array[0]['arrival_airport_name'], $spotter_array[0]['arrival_airport_icao'], $spotter_array[0]['arrival_airport_country']); |
|
19 | 19 | require_once('header.php'); |
20 | 20 | print '<div class="info column">'; |
21 | 21 | print '<h1>'._("Flights between").' '.$spotter_array[0]['departure_airport_name'].' ('.$spotter_array[0]['departure_airport_icao'].'), '.$spotter_array[0]['departure_airport_country'].' - '.$spotter_array[0]['arrival_airport_name'].' ('.$spotter_array[0]['arrival_airport_icao'].'), '.$spotter_array[0]['arrival_airport_country'].'</h1>'; |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | include('route-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 between <strong>%s (%s), %s</strong> and <strong>%s (%s), %s</strong>."),$spotter_array[0]['departure_airport_name'],$spotter_array[0]['departure_airport_icao'],$spotter_array[0]['departure_airport_country'],$spotter_array[0]['arrival_airport_name'],$spotter_array[0]['arrival_airport_icao'],$spotter_array[0]['arrival_airport_country']).'</p>'; |
|
29 | + print '<p>'.sprintf(_("The statistic below shows the most common aircrafts of flights between <strong>%s (%s), %s</strong> and <strong>%s (%s), %s</strong>."), $spotter_array[0]['departure_airport_name'], $spotter_array[0]['departure_airport_icao'], $spotter_array[0]['departure_airport_country'], $spotter_array[0]['arrival_airport_name'], $spotter_array[0]['arrival_airport_icao'], $spotter_array[0]['arrival_airport_country']).'</p>'; |
|
30 | 30 | |
31 | 31 | $aircraft_array = $Spotter->countAllAircraftTypesByRoute($departure_airport, $arrival_airport); |
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>'; |
@@ -9,16 +9,16 @@ discard block |
||
9 | 9 | require_once('require/class.Language.php'); |
10 | 10 | |
11 | 11 | $Spotter = new Spotter(); |
12 | -$sort = filter_input(INPUT_GET,'sort',FILTER_SANITIZE_STRING); |
|
13 | -$departure_airport = filter_input(INPUT_GET,'departure_airport',FILTER_SANITIZE_STRING); |
|
14 | -$arrival_airport = filter_input(INPUT_GET,'arrival_airport',FILTER_SANITIZE_STRING); |
|
12 | +$sort = filter_input(INPUT_GET, 'sort', FILTER_SANITIZE_STRING); |
|
13 | +$departure_airport = filter_input(INPUT_GET, 'departure_airport', FILTER_SANITIZE_STRING); |
|
14 | +$arrival_airport = filter_input(INPUT_GET, 'arrival_airport', FILTER_SANITIZE_STRING); |
|
15 | 15 | if (isset($_GET['departure_airport']) && isset($_GET['arrival_airport'])) { |
16 | 16 | $spotter_array = $Spotter->getSpotterDataByRoute($departure_airport, $arrival_airport, "0,1", $sort); |
17 | 17 | } else $spotter_array = array(); |
18 | 18 | |
19 | 19 | if (!empty($spotter_array)) |
20 | 20 | { |
21 | - $title = sprintf(_("Most Common Aircraft Manufacturer between %s (%s), %s - %s (%s), %s"),$spotter_array[0]['departure_airport_name'],$spotter_array[0]['departure_airport_icao'],$spotter_array[0]['departure_airport_country'],$spotter_array[0]['arrival_airport_name'],$spotter_array[0]['arrival_airport_icao'],$spotter_array[0]['arrival_airport_country']); |
|
21 | + $title = sprintf(_("Most Common Aircraft Manufacturer between %s (%s), %s - %s (%s), %s"), $spotter_array[0]['departure_airport_name'], $spotter_array[0]['departure_airport_icao'], $spotter_array[0]['departure_airport_country'], $spotter_array[0]['arrival_airport_name'], $spotter_array[0]['arrival_airport_icao'], $spotter_array[0]['arrival_airport_country']); |
|
22 | 22 | require_once('header.php'); |
23 | 23 | print '<div class="info column">'; |
24 | 24 | print '<h1>'._("Flights between").' '.$spotter_array[0]['departure_airport_name'].' ('.$spotter_array[0]['departure_airport_icao'].'), '.$spotter_array[0]['departure_airport_country'].' - '.$spotter_array[0]['arrival_airport_name'].' ('.$spotter_array[0]['arrival_airport_icao'].'), '.$spotter_array[0]['arrival_airport_country'].'</h1>'; |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | include('route-sub-menu.php'); |
30 | 30 | print '<div class="column">'; |
31 | 31 | print '<h2>'._("Most Common Aircraft Manufacturer").'</h2>'; |
32 | - print '<p>'.sprintf(_("The statistic below shows the most common Aircraft Manufacturer of flights between <strong>%s (%s), %s</strong> and <strong>%s (%s), %s</strong>."),$spotter_array[0]['departure_airport_name'],$spotter_array[0]['departure_airport_icao'],$spotter_array[0]['departure_airport_country'],$spotter_array[0]['arrival_airport_name'],$spotter_array[0]['arrival_airport_icao'],$spotter_array[0]['arrival_airport_country']).'</p>'; |
|
32 | + print '<p>'.sprintf(_("The statistic below shows the most common Aircraft Manufacturer of flights between <strong>%s (%s), %s</strong> and <strong>%s (%s), %s</strong>."), $spotter_array[0]['departure_airport_name'], $spotter_array[0]['departure_airport_icao'], $spotter_array[0]['departure_airport_country'], $spotter_array[0]['arrival_airport_name'], $spotter_array[0]['arrival_airport_icao'], $spotter_array[0]['arrival_airport_country']).'</p>'; |
|
33 | 33 | |
34 | 34 | $manufacturers_array = $Spotter->countAllAircraftManufacturerByRoute($departure_airport, $arrival_airport); |
35 | 35 | if (!empty($manufacturers_array)) |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | print '</thead>'; |
45 | 45 | print '<tbody>'; |
46 | 46 | $i = 1; |
47 | - foreach($manufacturers_array as $manufacturer_item) |
|
47 | + foreach ($manufacturers_array as $manufacturer_item) |
|
48 | 48 | { |
49 | 49 | print '<tr>'; |
50 | 50 | print '<td><strong>'.$i.'</strong></td>'; |
@@ -14,7 +14,9 @@ |
||
14 | 14 | $arrival_airport = filter_input(INPUT_GET,'arrival_airport',FILTER_SANITIZE_STRING); |
15 | 15 | if (isset($_GET['departure_airport']) && isset($_GET['arrival_airport'])) { |
16 | 16 | $spotter_array = $Spotter->getSpotterDataByRoute($departure_airport, $arrival_airport, "0,1", $sort); |
17 | -} else $spotter_array = array(); |
|
17 | +} else { |
|
18 | + $spotter_array = array(); |
|
19 | +} |
|
18 | 20 | |
19 | 21 | if (!empty($spotter_array)) |
20 | 22 | { |
@@ -3,9 +3,9 @@ discard block |
||
3 | 3 | </span> |
4 | 4 | <div class="sub-menu sub-menu-container"> |
5 | 5 | <ul class="nav nav-pills"> |
6 | - <li><a href="<?php print $globalURL; ?>/pilot/<?php print $pilot; ?><?php if (isset($year) && $year != '') echo '/'.$year; ?><?php if (isset($month) && $month != '') echo '/'.$month; ?>" <?php if (strtolower($current_page) == "pilot-detailed"){ print 'class="active"'; } ?>><?php echo _("Detailed"); ?></a></li> |
|
6 | + <li><a href="<?php print $globalURL; ?>/pilot/<?php print $pilot; ?><?php if (isset($year) && $year != '') echo '/'.$year; ?><?php if (isset($month) && $month != '') echo '/'.$month; ?>" <?php if (strtolower($current_page) == "pilot-detailed") { print 'class="active"'; } ?>><?php echo _("Detailed"); ?></a></li> |
|
7 | 7 | <li class="dropdown"> |
8 | - <a class="dropdown-toggle <?php if(strtolower($current_page) == "pilot-statistics-aircraft" || strtolower($current_page) == "pilot-statistics-registration" || strtolower($current_page) == "pilot-statistics-manufacturer"){ print 'active'; } ?>" data-toggle="dropdown" href="#"> |
|
8 | + <a class="dropdown-toggle <?php if (strtolower($current_page) == "pilot-statistics-aircraft" || strtolower($current_page) == "pilot-statistics-registration" || strtolower($current_page) == "pilot-statistics-manufacturer") { print 'active'; } ?>" data-toggle="dropdown" href="#"> |
|
9 | 9 | <?php echo _("Aircraft"); ?> <span class="caret"></span> |
10 | 10 | </a> |
11 | 11 | <ul class="dropdown-menu" role="menu"> |
@@ -15,7 +15,7 @@ discard block |
||
15 | 15 | </ul> |
16 | 16 | </li> |
17 | 17 | <li class="dropdown"> |
18 | - <a class="dropdown-toggle <?php if(strtolower($current_page) == "pilot-statistics-departure-airport" || strtolower($current_page) == "pilot-statistics-departure-airport-country" || strtolower($current_page) == "pilot-statistics-arrival-airport" || strtolower($current_page) == "pilot-statistics-arrival-airport-country"){ print 'active'; } ?>" data-toggle="dropdown" href="#"> |
|
18 | + <a class="dropdown-toggle <?php if (strtolower($current_page) == "pilot-statistics-departure-airport" || strtolower($current_page) == "pilot-statistics-departure-airport-country" || strtolower($current_page) == "pilot-statistics-arrival-airport" || strtolower($current_page) == "pilot-statistics-arrival-airport-country") { print 'active'; } ?>" data-toggle="dropdown" href="#"> |
|
19 | 19 | <?php echo _("Airport"); ?> <span class="caret"></span> |
20 | 20 | </a> |
21 | 21 | <ul class="dropdown-menu" role="menu"> |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | <li><a href="<?php print $globalURL; ?>/pilot/statistics/arrival-airport-country/<?php print $pilot; ?><?php if (isset($year) && $year != '') echo '/'.$year; ?><?php if (isset($month) && $month != '') echo '/'.$month; ?>"><?php echo _("Arrival Airport by Country"); ?></a></li> |
26 | 26 | </ul> |
27 | 27 | </li> |
28 | - <li><a href="<?php print $globalURL; ?>/pilot/statistics/route/<?php print $pilot; ?><?php if (isset($year) && $year != '') echo '/'.$year; ?><?php if (isset($month) && $month != '') echo '/'.$month; ?>" <?php if (strtolower($current_page) == "pilot-statistics-route"){ print 'class="active"'; } ?>><?php echo _("Route"); ?></a></li> |
|
29 | - <li><a href="<?php print $globalURL; ?>/pilot/statistics/time/<?php print $pilot; ?><?php if (isset($year) && $year != '') echo '/'.$year; ?><?php if (isset($month) && $month != '') echo '/'.$month; ?>" <?php if (strtolower($current_page) == "pilot-statistics-time"){ print 'class="active"'; } ?>><?php echo _("Time"); ?></a></li> |
|
28 | + <li><a href="<?php print $globalURL; ?>/pilot/statistics/route/<?php print $pilot; ?><?php if (isset($year) && $year != '') echo '/'.$year; ?><?php if (isset($month) && $month != '') echo '/'.$month; ?>" <?php if (strtolower($current_page) == "pilot-statistics-route") { print 'class="active"'; } ?>><?php echo _("Route"); ?></a></li> |
|
29 | + <li><a href="<?php print $globalURL; ?>/pilot/statistics/time/<?php print $pilot; ?><?php if (isset($year) && $year != '') echo '/'.$year; ?><?php if (isset($month) && $month != '') echo '/'.$month; ?>" <?php if (strtolower($current_page) == "pilot-statistics-time") { print 'class="active"'; } ?>><?php echo _("Time"); ?></a></li> |
|
30 | 30 | </ul> |
31 | 31 | </div> |
32 | 32 | \ No newline at end of file |
@@ -3,15 +3,39 @@ discard block |
||
3 | 3 | </span> |
4 | 4 | <div class="sub-menu sub-menu-container"> |
5 | 5 | <ul class="nav nav-pills"> |
6 | - <li><a href="<?php print $globalURL; ?>/pilot/<?php print $pilot; ?><?php if (isset($year) && $year != '') echo '/'.$year; ?><?php if (isset($month) && $month != '') echo '/'.$month; ?>" <?php if (strtolower($current_page) == "pilot-detailed"){ print 'class="active"'; } ?>><?php echo _("Detailed"); ?></a></li> |
|
6 | + <li><a href="<?php print $globalURL; ?>/pilot/<?php print $pilot; ?><?php if (isset($year) && $year != '') { |
|
7 | + echo '/'.$year; |
|
8 | +} |
|
9 | +?><?php if (isset($month) && $month != '') { |
|
10 | + echo '/'.$month; |
|
11 | +} |
|
12 | +?>" <?php if (strtolower($current_page) == "pilot-detailed"){ print 'class="active"'; } ?>><?php echo _("Detailed"); ?></a></li> |
|
7 | 13 | <li class="dropdown"> |
8 | 14 | <a class="dropdown-toggle <?php if(strtolower($current_page) == "pilot-statistics-aircraft" || strtolower($current_page) == "pilot-statistics-registration" || strtolower($current_page) == "pilot-statistics-manufacturer"){ print 'active'; } ?>" data-toggle="dropdown" href="#"> |
9 | 15 | <?php echo _("Aircraft"); ?> <span class="caret"></span> |
10 | 16 | </a> |
11 | 17 | <ul class="dropdown-menu" role="menu"> |
12 | - <li><a href="<?php print $globalURL; ?>/pilot/statistics/aircraft/<?php print $pilot; ?><?php if (isset($year) && $year != '') echo '/'.$year; ?><?php if (isset($month) && $month != '') echo '/'.$month; ?>"><?php echo _("Aircraft Type"); ?></a></li> |
|
13 | - <li><a href="<?php print $globalURL; ?>/pilot/statistics/registration/<?php print $pilot; ?><?php if (isset($year) && $year != '') echo '/'.$year; ?><?php if (isset($month) && $month != '') echo '/'.$month; ?>"><?php echo _("Registration"); ?></a></li> |
|
14 | - <li><a href="<?php print $globalURL; ?>/pilot/statistics/manufacturer/<?php print $pilot; ?><?php if (isset($year) && $year != '') echo '/'.$year; ?><?php if (isset($month) && $month != '') echo '/'.$month; ?>"><?php echo _("Manufacturer"); ?></a></li> |
|
18 | + <li><a href="<?php print $globalURL; ?>/pilot/statistics/aircraft/<?php print $pilot; ?><?php if (isset($year) && $year != '') { |
|
19 | + echo '/'.$year; |
|
20 | +} |
|
21 | +?><?php if (isset($month) && $month != '') { |
|
22 | + echo '/'.$month; |
|
23 | +} |
|
24 | +?>"><?php echo _("Aircraft Type"); ?></a></li> |
|
25 | + <li><a href="<?php print $globalURL; ?>/pilot/statistics/registration/<?php print $pilot; ?><?php if (isset($year) && $year != '') { |
|
26 | + echo '/'.$year; |
|
27 | +} |
|
28 | +?><?php if (isset($month) && $month != '') { |
|
29 | + echo '/'.$month; |
|
30 | +} |
|
31 | +?>"><?php echo _("Registration"); ?></a></li> |
|
32 | + <li><a href="<?php print $globalURL; ?>/pilot/statistics/manufacturer/<?php print $pilot; ?><?php if (isset($year) && $year != '') { |
|
33 | + echo '/'.$year; |
|
34 | +} |
|
35 | +?><?php if (isset($month) && $month != '') { |
|
36 | + echo '/'.$month; |
|
37 | +} |
|
38 | +?>"><?php echo _("Manufacturer"); ?></a></li> |
|
15 | 39 | </ul> |
16 | 40 | </li> |
17 | 41 | <li class="dropdown"> |
@@ -19,13 +43,49 @@ discard block |
||
19 | 43 | <?php echo _("Airport"); ?> <span class="caret"></span> |
20 | 44 | </a> |
21 | 45 | <ul class="dropdown-menu" role="menu"> |
22 | - <li><a href="<?php print $globalURL; ?>/pilot/statistics/departure-airport/<?php print $pilot; ?><?php if (isset($year) && $year != '') echo '/'.$year; ?><?php if (isset($month) && $month != '') echo '/'.$month; ?>"><?php echo _("Departure Airport"); ?></a></li> |
|
23 | - <li><a href="<?php print $globalURL; ?>/pilot/statistics/departure-airport-country/<?php print $pilot; ?><?php if (isset($year) && $year != '') echo '/'.$year; ?><?php if (isset($month) && $month != '') echo '/'.$month; ?>"><?php echo _("Departure Airport by Country"); ?></a></li> |
|
24 | - <li><a href="<?php print $globalURL; ?>/pilot/statistics/arrival-airport/<?php print $pilot; ?><?php if (isset($year) && $year != '') echo '/'.$year; ?><?php if (isset($month) && $month != '') echo '/'.$month; ?>"><?php echo _("Arrival Airport"); ?></a></li> |
|
25 | - <li><a href="<?php print $globalURL; ?>/pilot/statistics/arrival-airport-country/<?php print $pilot; ?><?php if (isset($year) && $year != '') echo '/'.$year; ?><?php if (isset($month) && $month != '') echo '/'.$month; ?>"><?php echo _("Arrival Airport by Country"); ?></a></li> |
|
46 | + <li><a href="<?php print $globalURL; ?>/pilot/statistics/departure-airport/<?php print $pilot; ?><?php if (isset($year) && $year != '') { |
|
47 | + echo '/'.$year; |
|
48 | +} |
|
49 | +?><?php if (isset($month) && $month != '') { |
|
50 | + echo '/'.$month; |
|
51 | +} |
|
52 | +?>"><?php echo _("Departure Airport"); ?></a></li> |
|
53 | + <li><a href="<?php print $globalURL; ?>/pilot/statistics/departure-airport-country/<?php print $pilot; ?><?php if (isset($year) && $year != '') { |
|
54 | + echo '/'.$year; |
|
55 | +} |
|
56 | +?><?php if (isset($month) && $month != '') { |
|
57 | + echo '/'.$month; |
|
58 | +} |
|
59 | +?>"><?php echo _("Departure Airport by Country"); ?></a></li> |
|
60 | + <li><a href="<?php print $globalURL; ?>/pilot/statistics/arrival-airport/<?php print $pilot; ?><?php if (isset($year) && $year != '') { |
|
61 | + echo '/'.$year; |
|
62 | +} |
|
63 | +?><?php if (isset($month) && $month != '') { |
|
64 | + echo '/'.$month; |
|
65 | +} |
|
66 | +?>"><?php echo _("Arrival Airport"); ?></a></li> |
|
67 | + <li><a href="<?php print $globalURL; ?>/pilot/statistics/arrival-airport-country/<?php print $pilot; ?><?php if (isset($year) && $year != '') { |
|
68 | + echo '/'.$year; |
|
69 | +} |
|
70 | +?><?php if (isset($month) && $month != '') { |
|
71 | + echo '/'.$month; |
|
72 | +} |
|
73 | +?>"><?php echo _("Arrival Airport by Country"); ?></a></li> |
|
26 | 74 | </ul> |
27 | 75 | </li> |
28 | - <li><a href="<?php print $globalURL; ?>/pilot/statistics/route/<?php print $pilot; ?><?php if (isset($year) && $year != '') echo '/'.$year; ?><?php if (isset($month) && $month != '') echo '/'.$month; ?>" <?php if (strtolower($current_page) == "pilot-statistics-route"){ print 'class="active"'; } ?>><?php echo _("Route"); ?></a></li> |
|
29 | - <li><a href="<?php print $globalURL; ?>/pilot/statistics/time/<?php print $pilot; ?><?php if (isset($year) && $year != '') echo '/'.$year; ?><?php if (isset($month) && $month != '') echo '/'.$month; ?>" <?php if (strtolower($current_page) == "pilot-statistics-time"){ print 'class="active"'; } ?>><?php echo _("Time"); ?></a></li> |
|
76 | + <li><a href="<?php print $globalURL; ?>/pilot/statistics/route/<?php print $pilot; ?><?php if (isset($year) && $year != '') { |
|
77 | + echo '/'.$year; |
|
78 | +} |
|
79 | +?><?php if (isset($month) && $month != '') { |
|
80 | + echo '/'.$month; |
|
81 | +} |
|
82 | +?>" <?php if (strtolower($current_page) == "pilot-statistics-route"){ print 'class="active"'; } ?>><?php echo _("Route"); ?></a></li> |
|
83 | + <li><a href="<?php print $globalURL; ?>/pilot/statistics/time/<?php print $pilot; ?><?php if (isset($year) && $year != '') { |
|
84 | + echo '/'.$year; |
|
85 | +} |
|
86 | +?><?php if (isset($month) && $month != '') { |
|
87 | + echo '/'.$month; |
|
88 | +} |
|
89 | +?>" <?php if (strtolower($current_page) == "pilot-statistics-time"){ print 'class="active"'; } ?>><?php echo _("Time"); ?></a></li> |
|
30 | 90 | </ul> |
31 | 91 | </div> |
32 | 92 | \ No newline at end of file |
@@ -9,16 +9,16 @@ discard block |
||
9 | 9 | require_once('require/class.Language.php'); |
10 | 10 | |
11 | 11 | $Spotter = new Spotter(); |
12 | -$sort = filter_input(INPUT_GET,'sort',FILTER_SANITIZE_STRING); |
|
13 | -$departure_airport = filter_input(INPUT_GET,'departure_airport',FILTER_SANITIZE_STRING); |
|
14 | -$arrival_airport = filter_input(INPUT_GET,'arrival_airport',FILTER_SANITIZE_STRING); |
|
12 | +$sort = filter_input(INPUT_GET, 'sort', FILTER_SANITIZE_STRING); |
|
13 | +$departure_airport = filter_input(INPUT_GET, 'departure_airport', FILTER_SANITIZE_STRING); |
|
14 | +$arrival_airport = filter_input(INPUT_GET, 'arrival_airport', FILTER_SANITIZE_STRING); |
|
15 | 15 | if (isset($_GET['departure_airport']) && isset($_GET['arrival_airport'])) { |
16 | 16 | $spotter_array = $Spotter->getSpotterDataByRoute($departure_airport, $arrival_airport, "0,1", $sort); |
17 | 17 | } else $spotter_array = array(); |
18 | 18 | |
19 | 19 | if (!empty($spotter_array)) |
20 | 20 | { |
21 | - $title = sprintf(_("Most Common Aircraft by Registration between %s (%s), %s - %s (%s), %s"),$spotter_array[0]['departure_airport_name'],$spotter_array[0]['departure_airport_icao'],$spotter_array[0]['departure_airport_country'],$spotter_array[0]['arrival_airport_name'],$spotter_array[0]['arrival_airport_icao'],$spotter_array[0]['arrival_airport_country']); |
|
21 | + $title = sprintf(_("Most Common Aircraft by Registration between %s (%s), %s - %s (%s), %s"), $spotter_array[0]['departure_airport_name'], $spotter_array[0]['departure_airport_icao'], $spotter_array[0]['departure_airport_country'], $spotter_array[0]['arrival_airport_name'], $spotter_array[0]['arrival_airport_icao'], $spotter_array[0]['arrival_airport_country']); |
|
22 | 22 | require_once('header.php'); |
23 | 23 | print '<div class="info column">'; |
24 | 24 | print '<h1>'._("Flights between").' '.$spotter_array[0]['departure_airport_name'].' ('.$spotter_array[0]['departure_airport_icao'].'), '.$spotter_array[0]['departure_airport_country'].' - '.$spotter_array[0]['arrival_airport_name'].' ('.$spotter_array[0]['arrival_airport_icao'].'), '.$spotter_array[0]['arrival_airport_country'].'</h1>'; |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | include('route-sub-menu.php'); |
30 | 30 | print '<div class="column">'; |
31 | 31 | print '<h2>'._("Most Common Aircraft by Registration").'</h2>'; |
32 | - print '<p>'.sprintf(_("The statistic below shows the most common aircraft by registration of flights between <strong>%s (%s), %s</strong> and <strong>%s (%s), %s</strong>."),$spotter_array[0]['departure_airport_name'],$spotter_array[0]['departure_airport_icao'],$spotter_array[0]['departure_airport_country'],$spotter_array[0]['arrival_airport_name'],$spotter_array[0]['arrival_airport_icao'],$spotter_array[0]['arrival_airport_country']).'</p>'; |
|
32 | + print '<p>'.sprintf(_("The statistic below shows the most common aircraft by registration of flights between <strong>%s (%s), %s</strong> and <strong>%s (%s), %s</strong>."), $spotter_array[0]['departure_airport_name'], $spotter_array[0]['departure_airport_icao'], $spotter_array[0]['departure_airport_country'], $spotter_array[0]['arrival_airport_name'], $spotter_array[0]['arrival_airport_icao'], $spotter_array[0]['arrival_airport_country']).'</p>'; |
|
33 | 33 | |
34 | 34 | $aircraft_array = $Spotter->countAllAircraftRegistrationByRoute($departure_airport, $arrival_airport); |
35 | 35 | if (!empty($aircraft_array)) |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | print '</thead>'; |
47 | 47 | print '<tbody>'; |
48 | 48 | $i = 1; |
49 | - foreach($aircraft_array as $aircraft_item) |
|
49 | + foreach ($aircraft_array as $aircraft_item) |
|
50 | 50 | { |
51 | 51 | print '<tr>'; |
52 | 52 | print '<td><strong>'.$i.'</strong></td>'; |
@@ -14,7 +14,9 @@ |
||
14 | 14 | $arrival_airport = filter_input(INPUT_GET,'arrival_airport',FILTER_SANITIZE_STRING); |
15 | 15 | if (isset($_GET['departure_airport']) && isset($_GET['arrival_airport'])) { |
16 | 16 | $spotter_array = $Spotter->getSpotterDataByRoute($departure_airport, $arrival_airport, "0,1", $sort); |
17 | -} else $spotter_array = array(); |
|
17 | +} else { |
|
18 | + $spotter_array = array(); |
|
19 | +} |
|
18 | 20 | |
19 | 21 | if (!empty($spotter_array)) |
20 | 22 | { |
@@ -3,9 +3,9 @@ discard block |
||
3 | 3 | </span> |
4 | 4 | <div class="sub-menu sub-menu-container"> |
5 | 5 | <ul class="nav nav-pills"> |
6 | - <li><a href="<?php print $globalURL; ?>/airport/<?php print $airport; ?>" <?php if (strtolower($current_page) == "airport-detailed"){ print 'class="active"'; } ?>><?php echo _("Detailed"); ?></a></li> |
|
6 | + <li><a href="<?php print $globalURL; ?>/airport/<?php print $airport; ?>" <?php if (strtolower($current_page) == "airport-detailed") { print 'class="active"'; } ?>><?php echo _("Detailed"); ?></a></li> |
|
7 | 7 | <li class="dropdown"> |
8 | - <a class="dropdown-toggle <?php if(strtolower($current_page) == "airport-statistics-aircraft" || strtolower($current_page) == "airport-statistics-registration" || strtolower($current_page) == "airport-statistics-manufacturer"){ print 'active'; } ?>" data-toggle="dropdown" href="#"> |
|
8 | + <a class="dropdown-toggle <?php if (strtolower($current_page) == "airport-statistics-aircraft" || strtolower($current_page) == "airport-statistics-registration" || strtolower($current_page) == "airport-statistics-manufacturer") { print 'active'; } ?>" data-toggle="dropdown" href="#"> |
|
9 | 9 | <?php echo _("Aircraft"); ?> <span class="caret"></span> |
10 | 10 | </a> |
11 | 11 | <ul class="dropdown-menu" role="menu"> |
@@ -15,7 +15,7 @@ discard block |
||
15 | 15 | </ul> |
16 | 16 | </li> |
17 | 17 | <li class="dropdown"> |
18 | - <a class="dropdown-toggle <?php if(strtolower($current_page) == "airport-statistics-airline" || strtolower($current_page) == "airport-statistics-airline-country"){ print 'active'; } ?>" data-toggle="dropdown" href="#"> |
|
18 | + <a class="dropdown-toggle <?php if (strtolower($current_page) == "airport-statistics-airline" || strtolower($current_page) == "airport-statistics-airline-country") { print 'active'; } ?>" data-toggle="dropdown" href="#"> |
|
19 | 19 | <?php echo _("Airline"); ?> <span class="caret"></span> |
20 | 20 | </a> |
21 | 21 | <ul class="dropdown-menu" role="menu"> |
@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | </ul> |
25 | 25 | </li> |
26 | 26 | <li class="dropdown"> |
27 | - <a class="dropdown-toggle <?php if(strtolower($current_page) == "airport-statistics-departure-airport" || strtolower($current_page) == "airport-statistics-departure-airport-country" || strtolower($current_page) == "airport-statistics-arrival-airport" || strtolower($current_page) == "airport-statistics-arrival-airport-country"){ print 'active'; } ?>" data-toggle="dropdown" href="#"> |
|
27 | + <a class="dropdown-toggle <?php if (strtolower($current_page) == "airport-statistics-departure-airport" || strtolower($current_page) == "airport-statistics-departure-airport-country" || strtolower($current_page) == "airport-statistics-arrival-airport" || strtolower($current_page) == "airport-statistics-arrival-airport-country") { print 'active'; } ?>" data-toggle="dropdown" href="#"> |
|
28 | 28 | <?php echo _("Airport"); ?> <span class="caret"></span> |
29 | 29 | </a> |
30 | 30 | <ul class="dropdown-menu" role="menu"> |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | <li><a href="<?php print $globalURL; ?>/airport/statistics/arrival-airport-country/<?php print $airport; ?>"><?php echo _("Arrival Airport by Country"); ?></a></li> |
35 | 35 | </ul> |
36 | 36 | </li> |
37 | - <li><a href="<?php print $globalURL; ?>/airport/statistics/route/<?php print $airport; ?>" <?php if (strtolower($current_page) == "airport-statistics-route"){ print 'class="active"'; } ?>><?php echo _("Route"); ?></a></li> |
|
38 | - <li><a href="<?php print $globalURL; ?>/airport/statistics/time/<?php print $airport; ?>" <?php if (strtolower($current_page) == "airport-statistics-time"){ print 'class="active"'; } ?>><?php echo _("Time"); ?></a></li> |
|
37 | + <li><a href="<?php print $globalURL; ?>/airport/statistics/route/<?php print $airport; ?>" <?php if (strtolower($current_page) == "airport-statistics-route") { print 'class="active"'; } ?>><?php echo _("Route"); ?></a></li> |
|
38 | + <li><a href="<?php print $globalURL; ?>/airport/statistics/time/<?php print $airport; ?>" <?php if (strtolower($current_page) == "airport-statistics-time") { print 'class="active"'; } ?>><?php echo _("Time"); ?></a></li> |
|
39 | 39 | </ul> |
40 | 40 | </div> |
41 | 41 | \ No newline at end of file |