@@ -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; |
@@ -29,7 +29,9 @@ discard block |
||
29 | 29 | if (isset($filter[0]['source'])) { |
30 | 30 | $filters = array_merge($filters,$filter); |
31 | 31 | } |
32 | - if (is_array($globalFilter)) $filter = array_merge($filter,$globalFilter); |
|
32 | + if (is_array($globalFilter)) { |
|
33 | + $filter = array_merge($filter,$globalFilter); |
|
34 | + } |
|
33 | 35 | $filter_query_join = ''; |
34 | 36 | $filter_query_where = ''; |
35 | 37 | foreach($filters as $flt) { |
@@ -118,8 +120,11 @@ discard block |
||
118 | 120 | if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) { |
119 | 121 | $filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')"; |
120 | 122 | } |
121 | - if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE'; |
|
122 | - elseif ($filter_query_where != '' && $and) $filter_query_where .= ' AND'; |
|
123 | + if ($filter_query_where == '' && $where) { |
|
124 | + $filter_query_where = ' WHERE'; |
|
125 | + } elseif ($filter_query_where != '' && $and) { |
|
126 | + $filter_query_where .= ' AND'; |
|
127 | + } |
|
123 | 128 | if ($filter_query_where != '') { |
124 | 129 | $filter_query_where = preg_replace('/^ AND/',' WHERE',$filter_query_where); |
125 | 130 | } |
@@ -160,9 +165,13 @@ discard block |
||
160 | 165 | $orderby_query = ' '.$search_orderby_array[$sort]['sql']; |
161 | 166 | } |
162 | 167 | } |
163 | - if ($orderby_query == '') $orderby_query = ' ORDER BY date DESC'; |
|
168 | + if ($orderby_query == '') { |
|
169 | + $orderby_query = ' ORDER BY date DESC'; |
|
170 | + } |
|
164 | 171 | |
165 | - if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
|
172 | + if (!isset($globalLiveInterval)) { |
|
173 | + $globalLiveInterval = '200'; |
|
174 | + } |
|
166 | 175 | if ($globalDBdriver == 'mysql') { |
167 | 176 | //$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"; |
168 | 177 | $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; |
@@ -185,7 +194,9 @@ discard block |
||
185 | 194 | global $globalDBdriver, $globalLiveInterval, $globalArchive; |
186 | 195 | date_default_timezone_set('UTC'); |
187 | 196 | $filter_query = $this->getFilter($filter,true,true); |
188 | - if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
|
197 | + if (!isset($globalLiveInterval)) { |
|
198 | + $globalLiveInterval = '200'; |
|
199 | + } |
|
189 | 200 | if ($globalDBdriver == 'mysql') { |
190 | 201 | if (isset($globalArchive) && $globalArchive === TRUE) { |
191 | 202 | $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 |
@@ -228,7 +239,9 @@ discard block |
||
228 | 239 | |
229 | 240 | $filter_query = $this->getFilter($filter,true,true); |
230 | 241 | |
231 | - if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
|
242 | + if (!isset($globalLiveInterval)) { |
|
243 | + $globalLiveInterval = '200'; |
|
244 | + } |
|
232 | 245 | if ($globalDBdriver == 'mysql') { |
233 | 246 | if (isset($globalArchive) && $globalArchive === TRUE) { |
234 | 247 | /* |
@@ -296,7 +309,9 @@ discard block |
||
296 | 309 | global $globalDBdriver, $globalLiveInterval; |
297 | 310 | $filter_query = $this->getFilter($filter,true,true); |
298 | 311 | |
299 | - if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
|
312 | + if (!isset($globalLiveInterval)) { |
|
313 | + $globalLiveInterval = '200'; |
|
314 | + } |
|
300 | 315 | if ($globalDBdriver == 'mysql') { |
301 | 316 | //$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; |
302 | 317 | $query = 'SELECT COUNT(DISTINCT spotter_live.flightaware_id) as nb FROM spotter_live'.$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= date'; |
@@ -326,7 +341,9 @@ discard block |
||
326 | 341 | { |
327 | 342 | global $globalDBdriver, $globalLiveInterval; |
328 | 343 | $Spotter = new Spotter($this->db); |
329 | - if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
|
344 | + if (!isset($globalLiveInterval)) { |
|
345 | + $globalLiveInterval = '200'; |
|
346 | + } |
|
330 | 347 | $filter_query = $this->getFilter($filter); |
331 | 348 | |
332 | 349 | if (is_array($coord)) { |
@@ -334,7 +351,9 @@ discard block |
||
334 | 351 | $minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
335 | 352 | $maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
336 | 353 | $maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
337 | - } else return array(); |
|
354 | + } else { |
|
355 | + return array(); |
|
356 | + } |
|
338 | 357 | if ($globalDBdriver == 'mysql') { |
339 | 358 | $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; |
340 | 359 | } else { |
@@ -355,7 +374,9 @@ discard block |
||
355 | 374 | { |
356 | 375 | global $globalDBdriver, $globalLiveInterval, $globalArchive; |
357 | 376 | $Spotter = new Spotter($this->db); |
358 | - if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
|
377 | + if (!isset($globalLiveInterval)) { |
|
378 | + $globalLiveInterval = '200'; |
|
379 | + } |
|
359 | 380 | $filter_query = $this->getFilter($filter,true,true); |
360 | 381 | |
361 | 382 | if (is_array($coord)) { |
@@ -363,7 +384,9 @@ discard block |
||
363 | 384 | $minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
364 | 385 | $maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
365 | 386 | $maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
366 | - } else return array(); |
|
387 | + } else { |
|
388 | + return array(); |
|
389 | + } |
|
367 | 390 | if ($globalDBdriver == 'mysql') { |
368 | 391 | if (isset($globalArchive) && $globalArchive === TRUE) { |
369 | 392 | $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 |
@@ -593,11 +616,15 @@ discard block |
||
593 | 616 | //$query = self::$global_query.' WHERE spotter_live.flightaware_id = :id ORDER BY date'; |
594 | 617 | if ($globalDBdriver == 'mysql') { |
595 | 618 | $query = 'SELECT spotter_live.* FROM spotter_live WHERE spotter_live.flightaware_id = :id'; |
596 | - if ($liveinterval) $query .= ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= date'; |
|
619 | + if ($liveinterval) { |
|
620 | + $query .= ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= date'; |
|
621 | + } |
|
597 | 622 | $query .= ' ORDER BY date'; |
598 | 623 | } else { |
599 | 624 | $query = 'SELECT spotter_live.* FROM spotter_live WHERE spotter_live.flightaware_id = :id'; |
600 | - if ($liveinterval) $query .= " AND CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= date"; |
|
625 | + if ($liveinterval) { |
|
626 | + $query .= " AND CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= date"; |
|
627 | + } |
|
601 | 628 | $query .= ' ORDER BY date'; |
602 | 629 | } |
603 | 630 | |
@@ -692,7 +719,9 @@ discard block |
||
692 | 719 | $i++; |
693 | 720 | $j++; |
694 | 721 | if ($j == 30) { |
695 | - if ($globalDebug) echo "."; |
|
722 | + if ($globalDebug) { |
|
723 | + echo "."; |
|
724 | + } |
|
696 | 725 | try { |
697 | 726 | |
698 | 727 | $sth = $this->db->prepare(substr($query_delete,0,-1).")"); |
@@ -999,7 +1028,9 @@ discard block |
||
999 | 1028 | { |
1000 | 1029 | return false; |
1001 | 1030 | } |
1002 | - } else return ''; |
|
1031 | + } else { |
|
1032 | + return ''; |
|
1033 | + } |
|
1003 | 1034 | |
1004 | 1035 | if ($longitude != '') |
1005 | 1036 | { |
@@ -1007,7 +1038,9 @@ discard block |
||
1007 | 1038 | { |
1008 | 1039 | return false; |
1009 | 1040 | } |
1010 | - } else return ''; |
|
1041 | + } else { |
|
1042 | + return ''; |
|
1043 | + } |
|
1011 | 1044 | |
1012 | 1045 | if ($waypoints != '') |
1013 | 1046 | { |
@@ -1023,14 +1056,18 @@ discard block |
||
1023 | 1056 | { |
1024 | 1057 | return false; |
1025 | 1058 | } |
1026 | - } else $altitude = 0; |
|
1059 | + } else { |
|
1060 | + $altitude = 0; |
|
1061 | + } |
|
1027 | 1062 | if ($altitude_real != '') |
1028 | 1063 | { |
1029 | 1064 | if (!is_numeric($altitude_real)) |
1030 | 1065 | { |
1031 | 1066 | return false; |
1032 | 1067 | } |
1033 | - } else $altitude_real = 0; |
|
1068 | + } else { |
|
1069 | + $altitude_real = 0; |
|
1070 | + } |
|
1034 | 1071 | |
1035 | 1072 | if ($heading != '') |
1036 | 1073 | { |
@@ -1038,7 +1075,9 @@ discard block |
||
1038 | 1075 | { |
1039 | 1076 | return false; |
1040 | 1077 | } |
1041 | - } else $heading = 0; |
|
1078 | + } else { |
|
1079 | + $heading = 0; |
|
1080 | + } |
|
1042 | 1081 | |
1043 | 1082 | if ($groundspeed != '') |
1044 | 1083 | { |
@@ -1046,9 +1085,13 @@ discard block |
||
1046 | 1085 | { |
1047 | 1086 | return false; |
1048 | 1087 | } |
1049 | - } else $groundspeed = 0; |
|
1088 | + } else { |
|
1089 | + $groundspeed = 0; |
|
1090 | + } |
|
1050 | 1091 | date_default_timezone_set('UTC'); |
1051 | - if ($date == '') $date = date("Y-m-d H:i:s", time()); |
|
1092 | + if ($date == '') { |
|
1093 | + $date = date("Y-m-d H:i:s", time()); |
|
1094 | + } |
|
1052 | 1095 | |
1053 | 1096 | |
1054 | 1097 | $flightaware_id = filter_var($flightaware_id,FILTER_SANITIZE_STRING); |
@@ -1093,14 +1136,24 @@ discard block |
||
1093 | 1136 | $arrival_airport_country = ''; |
1094 | 1137 | |
1095 | 1138 | |
1096 | - if ($squawk == '' || $Common->isInteger($squawk) === false ) $squawk = NULL; |
|
1097 | - if ($verticalrate == '' || $Common->isInteger($verticalrate) === false ) $verticalrate = NULL; |
|
1098 | - if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) $groundspeed = 0; |
|
1099 | - if ($heading == '' || $Common->isInteger($heading) === false ) $heading = 0; |
|
1139 | + if ($squawk == '' || $Common->isInteger($squawk) === false ) { |
|
1140 | + $squawk = NULL; |
|
1141 | + } |
|
1142 | + if ($verticalrate == '' || $Common->isInteger($verticalrate) === false ) { |
|
1143 | + $verticalrate = NULL; |
|
1144 | + } |
|
1145 | + if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) { |
|
1146 | + $groundspeed = 0; |
|
1147 | + } |
|
1148 | + if ($heading == '' || $Common->isInteger($heading) === false ) { |
|
1149 | + $heading = 0; |
|
1150 | + } |
|
1100 | 1151 | |
1101 | 1152 | $query = ''; |
1102 | 1153 | if ($globalArchive) { |
1103 | - if ($globalDebug) echo '-- Delete previous data -- '; |
|
1154 | + if ($globalDebug) { |
|
1155 | + echo '-- Delete previous data -- '; |
|
1156 | + } |
|
1104 | 1157 | $query .= 'DELETE FROM spotter_live WHERE flightaware_id = :flightaware_id;'; |
1105 | 1158 | } |
1106 | 1159 | |
@@ -1117,10 +1170,14 @@ discard block |
||
1117 | 1170 | return "error : ".$e->getMessage(); |
1118 | 1171 | } |
1119 | 1172 | if (isset($globalArchive) && $globalArchive && $putinarchive && $noarchive !== true) { |
1120 | - if ($globalDebug) echo '(Add to SBS archive : '; |
|
1173 | + if ($globalDebug) { |
|
1174 | + echo '(Add to SBS archive : '; |
|
1175 | + } |
|
1121 | 1176 | $SpotterArchive = new SpotterArchive($this->db); |
1122 | 1177 | $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); |
1123 | - if ($globalDebug) echo $result.')'; |
|
1178 | + if ($globalDebug) { |
|
1179 | + echo $result.')'; |
|
1180 | + } |
|
1124 | 1181 | } elseif ($globalDebug && $putinarchive !== true) { |
1125 | 1182 | echo '(Not adding to archive)'; |
1126 | 1183 | } elseif ($globalDebug && $noarchive === true) { |
@@ -12,10 +12,10 @@ discard block |
||
12 | 12 | |
13 | 13 | |
14 | 14 | /** |
15 | - * Get SQL query part for filter used |
|
16 | - * @param Array $filter the filter |
|
17 | - * @return Array the SQL part |
|
18 | - */ |
|
15 | + * Get SQL query part for filter used |
|
16 | + * @param Array $filter the filter |
|
17 | + * @return Array the SQL part |
|
18 | + */ |
|
19 | 19 | public function getFilter($filter = array(),$where = false,$and = false) { |
20 | 20 | global $globalFilter, $globalStatsFilters, $globalFilterName, $globalDBdriver; |
21 | 21 | $filters = array(); |
@@ -128,11 +128,11 @@ discard block |
||
128 | 128 | } |
129 | 129 | |
130 | 130 | /** |
131 | - * Gets all the spotter information based on the latest data entry |
|
132 | - * |
|
133 | - * @return Array the spotter information |
|
134 | - * |
|
135 | - */ |
|
131 | + * Gets all the spotter information based on the latest data entry |
|
132 | + * |
|
133 | + * @return Array the spotter information |
|
134 | + * |
|
135 | + */ |
|
136 | 136 | public function getLiveSpotterData($limit = '', $sort = '', $filter = array()) |
137 | 137 | { |
138 | 138 | global $globalDBdriver, $globalLiveInterval; |
@@ -175,11 +175,11 @@ discard block |
||
175 | 175 | } |
176 | 176 | |
177 | 177 | /** |
178 | - * Gets Minimal Live Spotter data |
|
179 | - * |
|
180 | - * @return Array the spotter information |
|
181 | - * |
|
182 | - */ |
|
178 | + * Gets Minimal Live Spotter data |
|
179 | + * |
|
180 | + * @return Array the spotter information |
|
181 | + * |
|
182 | + */ |
|
183 | 183 | public function getMinLiveSpotterData($filter = array()) |
184 | 184 | { |
185 | 185 | global $globalDBdriver, $globalLiveInterval, $globalArchive; |
@@ -216,11 +216,11 @@ discard block |
||
216 | 216 | } |
217 | 217 | |
218 | 218 | /** |
219 | - * Gets Minimal Live Spotter data since xx seconds |
|
220 | - * |
|
221 | - * @return Array the spotter information |
|
222 | - * |
|
223 | - */ |
|
219 | + * Gets Minimal Live Spotter data since xx seconds |
|
220 | + * |
|
221 | + * @return Array the spotter information |
|
222 | + * |
|
223 | + */ |
|
224 | 224 | public function getMinLastLiveSpotterData($filter = array()) |
225 | 225 | { |
226 | 226 | global $globalDBdriver, $globalLiveInterval, $globalArchive; |
@@ -250,7 +250,7 @@ discard block |
||
250 | 250 | AND spotter_live.latitude <> '0' AND spotter_live.longitude <> '0' |
251 | 251 | ORDER BY spotter_live.flightaware_id, spotter_live.date"; |
252 | 252 | } |
253 | - } else { |
|
253 | + } else { |
|
254 | 254 | if (isset($globalArchive) && $globalArchive === TRUE) { |
255 | 255 | /* |
256 | 256 | $query = "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 |
@@ -274,7 +274,7 @@ discard block |
||
274 | 274 | ORDER BY spotter_live.flightaware_id, spotter_live.date"; |
275 | 275 | } |
276 | 276 | } |
277 | - try { |
|
277 | + try { |
|
278 | 278 | $sth = $this->db->prepare($query); |
279 | 279 | $sth->execute(); |
280 | 280 | } catch(PDOException $e) { |
@@ -286,11 +286,11 @@ discard block |
||
286 | 286 | } |
287 | 287 | |
288 | 288 | /** |
289 | - * Gets number of latest data entry |
|
290 | - * |
|
291 | - * @return String number of entry |
|
292 | - * |
|
293 | - */ |
|
289 | + * Gets number of latest data entry |
|
290 | + * |
|
291 | + * @return String number of entry |
|
292 | + * |
|
293 | + */ |
|
294 | 294 | public function getLiveSpotterCount($filter = array()) |
295 | 295 | { |
296 | 296 | global $globalDBdriver, $globalLiveInterval; |
@@ -317,11 +317,11 @@ discard block |
||
317 | 317 | } |
318 | 318 | |
319 | 319 | /** |
320 | - * Gets all the spotter information based on the latest data entry and coord |
|
321 | - * |
|
322 | - * @return Array the spotter information |
|
323 | - * |
|
324 | - */ |
|
320 | + * Gets all the spotter information based on the latest data entry and coord |
|
321 | + * |
|
322 | + * @return Array the spotter information |
|
323 | + * |
|
324 | + */ |
|
325 | 325 | public function getLiveSpotterDatabyCoord($coord, $filter = array()) |
326 | 326 | { |
327 | 327 | global $globalDBdriver, $globalLiveInterval; |
@@ -346,11 +346,11 @@ discard block |
||
346 | 346 | } |
347 | 347 | |
348 | 348 | /** |
349 | - * Gets all the spotter information based on the latest data entry and coord |
|
350 | - * |
|
351 | - * @return Array the spotter information |
|
352 | - * |
|
353 | - */ |
|
349 | + * Gets all the spotter information based on the latest data entry and coord |
|
350 | + * |
|
351 | + * @return Array the spotter information |
|
352 | + * |
|
353 | + */ |
|
354 | 354 | public function getMinLiveSpotterDatabyCoord($coord, $filter = array()) |
355 | 355 | { |
356 | 356 | global $globalDBdriver, $globalLiveInterval, $globalArchive; |
@@ -415,11 +415,11 @@ discard block |
||
415 | 415 | } |
416 | 416 | |
417 | 417 | /** |
418 | - * Gets all the spotter information based on a user's latitude and longitude |
|
419 | - * |
|
420 | - * @return Array the spotter information |
|
421 | - * |
|
422 | - */ |
|
418 | + * Gets all the spotter information based on a user's latitude and longitude |
|
419 | + * |
|
420 | + * @return Array the spotter information |
|
421 | + * |
|
422 | + */ |
|
423 | 423 | public function getLatestSpotterForLayar($lat, $lng, $radius, $interval) |
424 | 424 | { |
425 | 425 | $Spotter = new Spotter($this->db); |
@@ -429,98 +429,98 @@ discard block |
||
429 | 429 | return false; |
430 | 430 | } |
431 | 431 | } |
432 | - if ($lng != '') |
|
433 | - { |
|
434 | - if (!is_numeric($lng)) |
|
435 | - { |
|
436 | - return false; |
|
437 | - } |
|
438 | - } |
|
439 | - |
|
440 | - if ($radius != '') |
|
441 | - { |
|
442 | - if (!is_numeric($radius)) |
|
443 | - { |
|
444 | - return false; |
|
445 | - } |
|
446 | - } |
|
432 | + if ($lng != '') |
|
433 | + { |
|
434 | + if (!is_numeric($lng)) |
|
435 | + { |
|
436 | + return false; |
|
437 | + } |
|
438 | + } |
|
439 | + |
|
440 | + if ($radius != '') |
|
441 | + { |
|
442 | + if (!is_numeric($radius)) |
|
443 | + { |
|
444 | + return false; |
|
445 | + } |
|
446 | + } |
|
447 | 447 | $additional_query = ''; |
448 | - if ($interval != '') |
|
449 | - { |
|
450 | - if (!is_string($interval)) |
|
451 | - { |
|
452 | - //$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= spotter_live.date '; |
|
453 | - return false; |
|
454 | - } else { |
|
455 | - if ($interval == '1m') |
|
456 | - { |
|
457 | - $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= spotter_live.date '; |
|
458 | - } else if ($interval == '15m'){ |
|
459 | - $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 15 MINUTE) <= spotter_live.date '; |
|
460 | - } |
|
461 | - } |
|
462 | - } else { |
|
463 | - $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= spotter_live.date '; |
|
464 | - } |
|
465 | - |
|
466 | - $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 |
|
448 | + if ($interval != '') |
|
449 | + { |
|
450 | + if (!is_string($interval)) |
|
451 | + { |
|
452 | + //$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= spotter_live.date '; |
|
453 | + return false; |
|
454 | + } else { |
|
455 | + if ($interval == '1m') |
|
456 | + { |
|
457 | + $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= spotter_live.date '; |
|
458 | + } else if ($interval == '15m'){ |
|
459 | + $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 15 MINUTE) <= spotter_live.date '; |
|
460 | + } |
|
461 | + } |
|
462 | + } else { |
|
463 | + $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= spotter_live.date '; |
|
464 | + } |
|
465 | + |
|
466 | + $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 |
|
467 | 467 | WHERE spotter_live.latitude <> '' |
468 | 468 | AND spotter_live.longitude <> '' |
469 | 469 | ".$additional_query." |
470 | 470 | HAVING distance < :radius |
471 | 471 | ORDER BY distance"; |
472 | 472 | |
473 | - $spotter_array = $Spotter->getDataFromDB($query, array(':lat' => $lat, ':lng' => $lng,':radius' => $radius)); |
|
473 | + $spotter_array = $Spotter->getDataFromDB($query, array(':lat' => $lat, ':lng' => $lng,':radius' => $radius)); |
|
474 | 474 | |
475 | - return $spotter_array; |
|
476 | - } |
|
475 | + return $spotter_array; |
|
476 | + } |
|
477 | 477 | |
478 | 478 | |
479 | - /** |
|
480 | - * Gets all the spotter information based on a particular callsign |
|
481 | - * |
|
482 | - * @return Array the spotter information |
|
483 | - * |
|
484 | - */ |
|
479 | + /** |
|
480 | + * Gets all the spotter information based on a particular callsign |
|
481 | + * |
|
482 | + * @return Array the spotter information |
|
483 | + * |
|
484 | + */ |
|
485 | 485 | public function getLastLiveSpotterDataByIdent($ident) |
486 | 486 | { |
487 | 487 | $Spotter = new Spotter($this->db); |
488 | 488 | date_default_timezone_set('UTC'); |
489 | 489 | |
490 | 490 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
491 | - $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'; |
|
491 | + $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'; |
|
492 | 492 | |
493 | 493 | $spotter_array = $Spotter->getDataFromDB($query,array(':ident' => $ident),'',true); |
494 | 494 | |
495 | 495 | return $spotter_array; |
496 | 496 | } |
497 | 497 | |
498 | - /** |
|
499 | - * Gets all the spotter information based on a particular callsign |
|
500 | - * |
|
501 | - * @return Array the spotter information |
|
502 | - * |
|
503 | - */ |
|
498 | + /** |
|
499 | + * Gets all the spotter information based on a particular callsign |
|
500 | + * |
|
501 | + * @return Array the spotter information |
|
502 | + * |
|
503 | + */ |
|
504 | 504 | public function getDateLiveSpotterDataByIdent($ident,$date) |
505 | 505 | { |
506 | 506 | $Spotter = new Spotter($this->db); |
507 | 507 | date_default_timezone_set('UTC'); |
508 | 508 | |
509 | 509 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
510 | - $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'; |
|
510 | + $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'; |
|
511 | 511 | |
512 | - $date = date('c',$date); |
|
512 | + $date = date('c',$date); |
|
513 | 513 | $spotter_array = $Spotter->getDataFromDB($query,array(':ident' => $ident,':date' => $date)); |
514 | 514 | |
515 | 515 | return $spotter_array; |
516 | 516 | } |
517 | 517 | |
518 | - /** |
|
519 | - * Gets last spotter information based on a particular callsign |
|
520 | - * |
|
521 | - * @return Array the spotter information |
|
522 | - * |
|
523 | - */ |
|
518 | + /** |
|
519 | + * Gets last spotter information based on a particular callsign |
|
520 | + * |
|
521 | + * @return Array the spotter information |
|
522 | + * |
|
523 | + */ |
|
524 | 524 | public function getLastLiveSpotterDataById($id) |
525 | 525 | { |
526 | 526 | $Spotter = new Spotter($this->db); |
@@ -531,12 +531,12 @@ discard block |
||
531 | 531 | return $spotter_array; |
532 | 532 | } |
533 | 533 | |
534 | - /** |
|
535 | - * Gets last spotter information based on a particular callsign |
|
536 | - * |
|
537 | - * @return Array the spotter information |
|
538 | - * |
|
539 | - */ |
|
534 | + /** |
|
535 | + * Gets last spotter information based on a particular callsign |
|
536 | + * |
|
537 | + * @return Array the spotter information |
|
538 | + * |
|
539 | + */ |
|
540 | 540 | public function getDateLiveSpotterDataById($id,$date) |
541 | 541 | { |
542 | 542 | $Spotter = new Spotter($this->db); |
@@ -549,21 +549,21 @@ discard block |
||
549 | 549 | return $spotter_array; |
550 | 550 | } |
551 | 551 | |
552 | - /** |
|
553 | - * Gets altitude information based on a particular callsign |
|
554 | - * |
|
555 | - * @return Array the spotter information |
|
556 | - * |
|
557 | - */ |
|
552 | + /** |
|
553 | + * Gets altitude information based on a particular callsign |
|
554 | + * |
|
555 | + * @return Array the spotter information |
|
556 | + * |
|
557 | + */ |
|
558 | 558 | public function getAltitudeLiveSpotterDataByIdent($ident) |
559 | 559 | { |
560 | 560 | |
561 | 561 | date_default_timezone_set('UTC'); |
562 | 562 | |
563 | 563 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
564 | - $query = 'SELECT spotter_live.altitude, spotter_live.date FROM spotter_live WHERE spotter_live.ident = :ident'; |
|
564 | + $query = 'SELECT spotter_live.altitude, spotter_live.date FROM spotter_live WHERE spotter_live.ident = :ident'; |
|
565 | 565 | |
566 | - try { |
|
566 | + try { |
|
567 | 567 | |
568 | 568 | $sth = $this->db->prepare($query); |
569 | 569 | $sth->execute(array(':ident' => $ident)); |
@@ -576,12 +576,12 @@ discard block |
||
576 | 576 | return $spotter_array; |
577 | 577 | } |
578 | 578 | |
579 | - /** |
|
580 | - * Gets all the spotter information based on a particular id |
|
581 | - * |
|
582 | - * @return Array the spotter information |
|
583 | - * |
|
584 | - */ |
|
579 | + /** |
|
580 | + * Gets all the spotter information based on a particular id |
|
581 | + * |
|
582 | + * @return Array the spotter information |
|
583 | + * |
|
584 | + */ |
|
585 | 585 | public function getAllLiveSpotterDataById($id,$liveinterval = false) |
586 | 586 | { |
587 | 587 | global $globalDBdriver, $globalLiveInterval; |
@@ -609,18 +609,18 @@ discard block |
||
609 | 609 | return $spotter_array; |
610 | 610 | } |
611 | 611 | |
612 | - /** |
|
613 | - * Gets all the spotter information based on a particular ident |
|
614 | - * |
|
615 | - * @return Array the spotter information |
|
616 | - * |
|
617 | - */ |
|
612 | + /** |
|
613 | + * Gets all the spotter information based on a particular ident |
|
614 | + * |
|
615 | + * @return Array the spotter information |
|
616 | + * |
|
617 | + */ |
|
618 | 618 | public function getAllLiveSpotterDataByIdent($ident) |
619 | 619 | { |
620 | 620 | date_default_timezone_set('UTC'); |
621 | 621 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
622 | 622 | $query = self::$global_query.' WHERE spotter_live.ident = :ident'; |
623 | - try { |
|
623 | + try { |
|
624 | 624 | |
625 | 625 | $sth = $this->db->prepare($query); |
626 | 626 | $sth->execute(array(':ident' => $ident)); |
@@ -634,23 +634,23 @@ discard block |
||
634 | 634 | |
635 | 635 | |
636 | 636 | /** |
637 | - * Deletes all info in the table |
|
638 | - * |
|
639 | - * @return String success or false |
|
640 | - * |
|
641 | - */ |
|
637 | + * Deletes all info in the table |
|
638 | + * |
|
639 | + * @return String success or false |
|
640 | + * |
|
641 | + */ |
|
642 | 642 | public function deleteLiveSpotterData() |
643 | 643 | { |
644 | 644 | global $globalDBdriver; |
645 | 645 | if ($globalDBdriver == 'mysql') { |
646 | 646 | //$query = "DELETE FROM spotter_live WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL 30 MINUTE) >= spotter_live.date"; |
647 | 647 | $query = 'DELETE FROM spotter_live WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL 9 HOUR) >= spotter_live.date'; |
648 | - //$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)"; |
|
648 | + //$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)"; |
|
649 | 649 | } else { |
650 | 650 | $query = "DELETE FROM spotter_live WHERE NOW() AT TIME ZONE 'UTC' - INTERVAL '9 HOURS' >= spotter_live.date"; |
651 | 651 | } |
652 | 652 | |
653 | - try { |
|
653 | + try { |
|
654 | 654 | |
655 | 655 | $sth = $this->db->prepare($query); |
656 | 656 | $sth->execute(); |
@@ -662,18 +662,18 @@ discard block |
||
662 | 662 | } |
663 | 663 | |
664 | 664 | /** |
665 | - * Deletes all info in the table for aircraft not seen since 2 HOUR |
|
666 | - * |
|
667 | - * @return String success or false |
|
668 | - * |
|
669 | - */ |
|
665 | + * Deletes all info in the table for aircraft not seen since 2 HOUR |
|
666 | + * |
|
667 | + * @return String success or false |
|
668 | + * |
|
669 | + */ |
|
670 | 670 | public function deleteLiveSpotterDataNotUpdated() |
671 | 671 | { |
672 | 672 | global $globalDBdriver, $globalDebug; |
673 | 673 | if ($globalDBdriver == 'mysql') { |
674 | 674 | //$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'; |
675 | - $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"; |
|
676 | - try { |
|
675 | + $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"; |
|
676 | + try { |
|
677 | 677 | |
678 | 678 | $sth = $this->db->prepare($query); |
679 | 679 | $sth->execute(); |
@@ -681,8 +681,8 @@ discard block |
||
681 | 681 | return "error"; |
682 | 682 | } |
683 | 683 | $query_delete = 'DELETE FROM spotter_live WHERE flightaware_id IN ('; |
684 | - $i = 0; |
|
685 | - $j =0; |
|
684 | + $i = 0; |
|
685 | + $j =0; |
|
686 | 686 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
687 | 687 | foreach($all as $row) |
688 | 688 | { |
@@ -690,20 +690,20 @@ discard block |
||
690 | 690 | $j++; |
691 | 691 | if ($j == 30) { |
692 | 692 | if ($globalDebug) echo "."; |
693 | - try { |
|
693 | + try { |
|
694 | 694 | |
695 | 695 | $sth = $this->db->prepare(substr($query_delete,0,-1).")"); |
696 | 696 | $sth->execute(); |
697 | 697 | } catch(PDOException $e) { |
698 | 698 | return "error"; |
699 | 699 | } |
700 | - $query_delete = 'DELETE FROM spotter_live WHERE flightaware_id IN ('; |
|
701 | - $j = 0; |
|
700 | + $query_delete = 'DELETE FROM spotter_live WHERE flightaware_id IN ('; |
|
701 | + $j = 0; |
|
702 | 702 | } |
703 | 703 | $query_delete .= "'".$row['flightaware_id']."',"; |
704 | 704 | } |
705 | 705 | if ($i > 0) { |
706 | - try { |
|
706 | + try { |
|
707 | 707 | |
708 | 708 | $sth = $this->db->prepare(substr($query_delete,0,-1).")"); |
709 | 709 | $sth->execute(); |
@@ -714,9 +714,9 @@ discard block |
||
714 | 714 | return "success"; |
715 | 715 | } elseif ($globalDBdriver == 'pgsql') { |
716 | 716 | //$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"; |
717 | - //$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"; |
|
718 | - $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)"; |
|
719 | - try { |
|
717 | + //$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"; |
|
718 | + $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)"; |
|
719 | + try { |
|
720 | 720 | |
721 | 721 | $sth = $this->db->prepare($query); |
722 | 722 | $sth->execute(); |
@@ -760,17 +760,17 @@ discard block |
||
760 | 760 | } |
761 | 761 | |
762 | 762 | /** |
763 | - * Deletes all info in the table for an ident |
|
764 | - * |
|
765 | - * @return String success or false |
|
766 | - * |
|
767 | - */ |
|
763 | + * Deletes all info in the table for an ident |
|
764 | + * |
|
765 | + * @return String success or false |
|
766 | + * |
|
767 | + */ |
|
768 | 768 | public function deleteLiveSpotterDataByIdent($ident) |
769 | 769 | { |
770 | 770 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
771 | 771 | $query = 'DELETE FROM spotter_live WHERE ident = :ident'; |
772 | 772 | |
773 | - try { |
|
773 | + try { |
|
774 | 774 | |
775 | 775 | $sth = $this->db->prepare($query); |
776 | 776 | $sth->execute(array(':ident' => $ident)); |
@@ -782,17 +782,17 @@ discard block |
||
782 | 782 | } |
783 | 783 | |
784 | 784 | /** |
785 | - * Deletes all info in the table for an id |
|
786 | - * |
|
787 | - * @return String success or false |
|
788 | - * |
|
789 | - */ |
|
785 | + * Deletes all info in the table for an id |
|
786 | + * |
|
787 | + * @return String success or false |
|
788 | + * |
|
789 | + */ |
|
790 | 790 | public function deleteLiveSpotterDataById($id) |
791 | 791 | { |
792 | 792 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
793 | 793 | $query = 'DELETE FROM spotter_live WHERE flightaware_id = :id'; |
794 | 794 | |
795 | - try { |
|
795 | + try { |
|
796 | 796 | |
797 | 797 | $sth = $this->db->prepare($query); |
798 | 798 | $sth->execute(array(':id' => $id)); |
@@ -805,11 +805,11 @@ discard block |
||
805 | 805 | |
806 | 806 | |
807 | 807 | /** |
808 | - * Gets the aircraft ident within the last hour |
|
809 | - * |
|
810 | - * @return String the ident |
|
811 | - * |
|
812 | - */ |
|
808 | + * Gets the aircraft ident within the last hour |
|
809 | + * |
|
810 | + * @return String the ident |
|
811 | + * |
|
812 | + */ |
|
813 | 813 | public function getIdentFromLastHour($ident) |
814 | 814 | { |
815 | 815 | global $globalDBdriver, $globalTimezone; |
@@ -835,14 +835,14 @@ discard block |
||
835 | 835 | $ident_result = $row['ident']; |
836 | 836 | } |
837 | 837 | return $ident_result; |
838 | - } |
|
838 | + } |
|
839 | 839 | |
840 | 840 | /** |
841 | - * Check recent aircraft |
|
842 | - * |
|
843 | - * @return String the ident |
|
844 | - * |
|
845 | - */ |
|
841 | + * Check recent aircraft |
|
842 | + * |
|
843 | + * @return String the ident |
|
844 | + * |
|
845 | + */ |
|
846 | 846 | public function checkIdentRecent($ident) |
847 | 847 | { |
848 | 848 | global $globalDBdriver, $globalTimezone; |
@@ -868,14 +868,14 @@ discard block |
||
868 | 868 | $ident_result = $row['flightaware_id']; |
869 | 869 | } |
870 | 870 | return $ident_result; |
871 | - } |
|
871 | + } |
|
872 | 872 | |
873 | 873 | /** |
874 | - * Check recent aircraft by id |
|
875 | - * |
|
876 | - * @return String the ident |
|
877 | - * |
|
878 | - */ |
|
874 | + * Check recent aircraft by id |
|
875 | + * |
|
876 | + * @return String the ident |
|
877 | + * |
|
878 | + */ |
|
879 | 879 | public function checkIdRecent($id) |
880 | 880 | { |
881 | 881 | global $globalDBdriver, $globalTimezone; |
@@ -901,14 +901,14 @@ discard block |
||
901 | 901 | $ident_result = $row['flightaware_id']; |
902 | 902 | } |
903 | 903 | return $ident_result; |
904 | - } |
|
904 | + } |
|
905 | 905 | |
906 | 906 | /** |
907 | - * Check recent aircraft by ModeS |
|
908 | - * |
|
909 | - * @return String the ModeS |
|
910 | - * |
|
911 | - */ |
|
907 | + * Check recent aircraft by ModeS |
|
908 | + * |
|
909 | + * @return String the ModeS |
|
910 | + * |
|
911 | + */ |
|
912 | 912 | public function checkModeSRecent($modes) |
913 | 913 | { |
914 | 914 | global $globalDBdriver, $globalTimezone; |
@@ -935,19 +935,19 @@ discard block |
||
935 | 935 | $ident_result = $row['flightaware_id']; |
936 | 936 | } |
937 | 937 | return $ident_result; |
938 | - } |
|
938 | + } |
|
939 | 939 | |
940 | 940 | /** |
941 | - * Adds a new spotter data |
|
942 | - * |
|
943 | - * @param String $flightaware_id the ID from flightaware |
|
944 | - * @param String $ident the flight ident |
|
945 | - * @param String $aircraft_icao the aircraft type |
|
946 | - * @param String $departure_airport_icao the departure airport |
|
947 | - * @param String $arrival_airport_icao the arrival airport |
|
948 | - * @return String success or false |
|
949 | - * |
|
950 | - */ |
|
941 | + * Adds a new spotter data |
|
942 | + * |
|
943 | + * @param String $flightaware_id the ID from flightaware |
|
944 | + * @param String $ident the flight ident |
|
945 | + * @param String $aircraft_icao the aircraft type |
|
946 | + * @param String $departure_airport_icao the departure airport |
|
947 | + * @param String $arrival_airport_icao the arrival airport |
|
948 | + * @return String success or false |
|
949 | + * |
|
950 | + */ |
|
951 | 951 | 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 = '') |
952 | 952 | { |
953 | 953 | global $globalURL, $globalArchive, $globalDebug; |
@@ -1090,10 +1090,10 @@ discard block |
||
1090 | 1090 | $arrival_airport_country = ''; |
1091 | 1091 | |
1092 | 1092 | |
1093 | - if ($squawk == '' || $Common->isInteger($squawk) === false ) $squawk = NULL; |
|
1094 | - if ($verticalrate == '' || $Common->isInteger($verticalrate) === false ) $verticalrate = NULL; |
|
1095 | - if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) $groundspeed = 0; |
|
1096 | - if ($heading == '' || $Common->isInteger($heading) === false ) $heading = 0; |
|
1093 | + if ($squawk == '' || $Common->isInteger($squawk) === false ) $squawk = NULL; |
|
1094 | + if ($verticalrate == '' || $Common->isInteger($verticalrate) === false ) $verticalrate = NULL; |
|
1095 | + if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) $groundspeed = 0; |
|
1096 | + if ($heading == '' || $Common->isInteger($heading) === false ) $heading = 0; |
|
1097 | 1097 | |
1098 | 1098 | $query = ''; |
1099 | 1099 | if ($globalArchive) { |
@@ -1114,10 +1114,10 @@ discard block |
||
1114 | 1114 | return "error : ".$e->getMessage(); |
1115 | 1115 | } |
1116 | 1116 | if (isset($globalArchive) && $globalArchive && $putinarchive && $noarchive !== true) { |
1117 | - if ($globalDebug) echo '(Add to SBS archive : '; |
|
1118 | - $SpotterArchive = new SpotterArchive($this->db); |
|
1119 | - $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); |
|
1120 | - if ($globalDebug) echo $result.')'; |
|
1117 | + if ($globalDebug) echo '(Add to SBS archive : '; |
|
1118 | + $SpotterArchive = new SpotterArchive($this->db); |
|
1119 | + $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); |
|
1120 | + if ($globalDebug) echo $result.')'; |
|
1121 | 1121 | } elseif ($globalDebug && $putinarchive !== true) { |
1122 | 1122 | echo '(Not adding to archive)'; |
1123 | 1123 | } elseif ($globalDebug && $noarchive === true) { |
@@ -16,62 +16,62 @@ discard block |
||
16 | 16 | * @param Array $filter the filter |
17 | 17 | * @return Array the SQL part |
18 | 18 | */ |
19 | - public function getFilter($filter = array(),$where = false,$and = false) { |
|
19 | + public function getFilter($filter = array(), $where = false, $and = false) { |
|
20 | 20 | global $globalFilter, $globalStatsFilters, $globalFilterName, $globalDBdriver; |
21 | 21 | $filters = array(); |
22 | 22 | if (is_array($globalStatsFilters) && isset($globalStatsFilters[$globalFilterName])) { |
23 | 23 | if (isset($globalStatsFilters[$globalFilterName][0]['source'])) { |
24 | 24 | $filters = $globalStatsFilters[$globalFilterName]; |
25 | 25 | } else { |
26 | - $filter = array_merge($filter,$globalStatsFilters[$globalFilterName]); |
|
26 | + $filter = array_merge($filter, $globalStatsFilters[$globalFilterName]); |
|
27 | 27 | } |
28 | 28 | } |
29 | 29 | if (isset($filter[0]['source'])) { |
30 | - $filters = array_merge($filters,$filter); |
|
30 | + $filters = array_merge($filters, $filter); |
|
31 | 31 | } |
32 | - if (is_array($globalFilter)) $filter = array_merge($filter,$globalFilter); |
|
32 | + if (is_array($globalFilter)) $filter = array_merge($filter, $globalFilter); |
|
33 | 33 | $filter_query_join = ''; |
34 | 34 | $filter_query_where = ''; |
35 | - foreach($filters as $flt) { |
|
35 | + foreach ($filters as $flt) { |
|
36 | 36 | if (isset($flt['airlines']) && !empty($flt['airlines'])) { |
37 | 37 | if ($flt['airlines'][0] != '') { |
38 | 38 | if (isset($flt['source'])) { |
39 | - $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"; |
|
39 | + $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 | 40 | } else { |
41 | - $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"; |
|
41 | + $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 | 42 | } |
43 | 43 | } |
44 | 44 | } |
45 | 45 | if (isset($flt['pilots_id']) && !empty($flt['pilots_id'])) { |
46 | 46 | if (isset($flt['source'])) { |
47 | - $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"; |
|
47 | + $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 | 48 | } else { |
49 | - $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"; |
|
49 | + $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 | 50 | } |
51 | 51 | } |
52 | 52 | if (isset($flt['idents']) && !empty($flt['idents'])) { |
53 | 53 | if (isset($flt['source'])) { |
54 | - $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"; |
|
54 | + $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 | 55 | } else { |
56 | - $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"; |
|
56 | + $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 | 57 | } |
58 | 58 | } |
59 | 59 | if (isset($flt['registrations']) && !empty($flt['registrations'])) { |
60 | 60 | if (isset($flt['source'])) { |
61 | - $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"; |
|
61 | + $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 | 62 | } else { |
63 | - $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"; |
|
63 | + $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 | 64 | } |
65 | 65 | } |
66 | 66 | 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']))) { |
67 | 67 | if (isset($flt['source'])) { |
68 | - $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"; |
|
68 | + $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 | 69 | } |
70 | 70 | } |
71 | 71 | } |
72 | 72 | if (isset($filter['airlines']) && !empty($filter['airlines'])) { |
73 | 73 | if ($filter['airlines'][0] != '') { |
74 | - $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"; |
|
74 | + $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 | 75 | } |
76 | 76 | } |
77 | 77 | if (isset($filter['alliance']) && !empty($filter['alliance'])) { |
@@ -81,10 +81,10 @@ discard block |
||
81 | 81 | $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 "; |
82 | 82 | } |
83 | 83 | if (isset($filter['pilots_id']) && !empty($filter['pilots_id'])) { |
84 | - $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"; |
|
84 | + $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 | 85 | } |
86 | 86 | if (isset($filter['source']) && !empty($filter['source'])) { |
87 | - $filter_query_where .= " AND format_source IN ('".implode("','",$filter['source'])."')"; |
|
87 | + $filter_query_where .= " AND format_source IN ('".implode("','", $filter['source'])."')"; |
|
88 | 88 | } |
89 | 89 | if (isset($filter['ident']) && !empty($filter['ident'])) { |
90 | 90 | $filter_query_where .= " AND ident = '".$filter['ident']."'"; |
@@ -113,15 +113,15 @@ discard block |
||
113 | 113 | $filter_query_date .= " AND EXTRACT(DAY FROM spotter_output.date) = '".$filter['day']."'"; |
114 | 114 | } |
115 | 115 | } |
116 | - $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"; |
|
116 | + $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"; |
|
117 | 117 | } |
118 | 118 | if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) { |
119 | - $filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')"; |
|
119 | + $filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','", $filter['source_aprs'])."')"; |
|
120 | 120 | } |
121 | 121 | if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE'; |
122 | 122 | elseif ($filter_query_where != '' && $and) $filter_query_where .= ' AND'; |
123 | 123 | if ($filter_query_where != '') { |
124 | - $filter_query_where = preg_replace('/^ AND/',' WHERE',$filter_query_where); |
|
124 | + $filter_query_where = preg_replace('/^ AND/', ' WHERE', $filter_query_where); |
|
125 | 125 | } |
126 | 126 | $filter_query = $filter_query_join.$filter_query_where; |
127 | 127 | return $filter_query; |
@@ -144,8 +144,8 @@ discard block |
||
144 | 144 | if ($limit != '') |
145 | 145 | { |
146 | 146 | $limit_array = explode(',', $limit); |
147 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
148 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
147 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
148 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
149 | 149 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
150 | 150 | { |
151 | 151 | $limit_query = ' LIMIT '.$limit_array[1].' OFFSET '.$limit_array[0]; |
@@ -169,7 +169,7 @@ discard block |
||
169 | 169 | } else { |
170 | 170 | $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; |
171 | 171 | } |
172 | - $spotter_array = $Spotter->getDataFromDB($query.$limit_query,array(),'',true); |
|
172 | + $spotter_array = $Spotter->getDataFromDB($query.$limit_query, array(), '', true); |
|
173 | 173 | |
174 | 174 | return $spotter_array; |
175 | 175 | } |
@@ -184,7 +184,7 @@ discard block |
||
184 | 184 | { |
185 | 185 | global $globalDBdriver, $globalLiveInterval, $globalArchive; |
186 | 186 | date_default_timezone_set('UTC'); |
187 | - $filter_query = $this->getFilter($filter,true,true); |
|
187 | + $filter_query = $this->getFilter($filter, true, true); |
|
188 | 188 | if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
189 | 189 | if ($globalDBdriver == 'mysql') { |
190 | 190 | if (isset($globalArchive) && $globalArchive === TRUE) { |
@@ -207,7 +207,7 @@ discard block |
||
207 | 207 | try { |
208 | 208 | $sth = $this->db->prepare($query); |
209 | 209 | $sth->execute(); |
210 | - } catch(PDOException $e) { |
|
210 | + } catch (PDOException $e) { |
|
211 | 211 | echo $e->getMessage(); |
212 | 212 | die; |
213 | 213 | } |
@@ -226,7 +226,7 @@ discard block |
||
226 | 226 | global $globalDBdriver, $globalLiveInterval, $globalArchive; |
227 | 227 | date_default_timezone_set('UTC'); |
228 | 228 | |
229 | - $filter_query = $this->getFilter($filter,true,true); |
|
229 | + $filter_query = $this->getFilter($filter, true, true); |
|
230 | 230 | |
231 | 231 | if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
232 | 232 | if ($globalDBdriver == 'mysql') { |
@@ -237,7 +237,7 @@ discard block |
||
237 | 237 | WHERE spotter_archive.latitude <> '0' AND spotter_archive.longitude <> '0' |
238 | 238 | ORDER BY spotter_archive.flightaware_id, spotter_archive.date"; |
239 | 239 | */ |
240 | - $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 |
|
240 | + $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 |
|
241 | 241 | 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 |
242 | 242 | UNION |
243 | 243 | 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 |
@@ -245,7 +245,7 @@ discard block |
||
245 | 245 | WHERE latitude <> '0' AND longitude <> '0' |
246 | 246 | ORDER BY flightaware_id, date"; |
247 | 247 | } else { |
248 | - $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 |
|
248 | + $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 |
|
249 | 249 | FROM spotter_live'.$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval." SECOND) <= spotter_live.date |
250 | 250 | AND spotter_live.latitude <> '0' AND spotter_live.longitude <> '0' |
251 | 251 | ORDER BY spotter_live.flightaware_id, spotter_live.date"; |
@@ -258,7 +258,7 @@ discard block |
||
258 | 258 | WHERE spotter_archive.latitude <> '0' AND spotter_archive.longitude <> '0' |
259 | 259 | ORDER BY spotter_archive.flightaware_id, spotter_archive.date"; |
260 | 260 | */ |
261 | - $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 |
|
261 | + $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 |
|
262 | 262 | 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 |
263 | 263 | UNION |
264 | 264 | 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 |
@@ -268,7 +268,7 @@ discard block |
||
268 | 268 | ORDER BY flightaware_id, date"; |
269 | 269 | //AND CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".round($globalLiveInterval*1000)." SECONDS' <= spotter_archive.date |
270 | 270 | } else { |
271 | - $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 |
|
271 | + $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 |
|
272 | 272 | FROM spotter_live".$filter_query." CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= spotter_live.date |
273 | 273 | AND spotter_live.latitude <> '0' AND spotter_live.longitude <> '0' |
274 | 274 | ORDER BY spotter_live.flightaware_id, spotter_live.date"; |
@@ -277,7 +277,7 @@ discard block |
||
277 | 277 | try { |
278 | 278 | $sth = $this->db->prepare($query); |
279 | 279 | $sth->execute(); |
280 | - } catch(PDOException $e) { |
|
280 | + } catch (PDOException $e) { |
|
281 | 281 | echo $e->getMessage(); |
282 | 282 | die; |
283 | 283 | } |
@@ -294,7 +294,7 @@ discard block |
||
294 | 294 | public function getLiveSpotterCount($filter = array()) |
295 | 295 | { |
296 | 296 | global $globalDBdriver, $globalLiveInterval; |
297 | - $filter_query = $this->getFilter($filter,true,true); |
|
297 | + $filter_query = $this->getFilter($filter, true, true); |
|
298 | 298 | |
299 | 299 | if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
300 | 300 | if ($globalDBdriver == 'mysql') { |
@@ -307,7 +307,7 @@ discard block |
||
307 | 307 | try { |
308 | 308 | $sth = $this->db->prepare($query); |
309 | 309 | $sth->execute(); |
310 | - } catch(PDOException $e) { |
|
310 | + } catch (PDOException $e) { |
|
311 | 311 | echo $e->getMessage(); |
312 | 312 | die; |
313 | 313 | } |
@@ -330,10 +330,10 @@ discard block |
||
330 | 330 | $filter_query = $this->getFilter($filter); |
331 | 331 | |
332 | 332 | if (is_array($coord)) { |
333 | - $minlong = filter_var($coord[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
334 | - $minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
335 | - $maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
336 | - $maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
333 | + $minlong = filter_var($coord[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
334 | + $minlat = filter_var($coord[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
335 | + $maxlong = filter_var($coord[2], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
336 | + $maxlat = filter_var($coord[3], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
337 | 337 | } else return array(); |
338 | 338 | if ($globalDBdriver == 'mysql') { |
339 | 339 | $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; |
@@ -356,23 +356,23 @@ discard block |
||
356 | 356 | global $globalDBdriver, $globalLiveInterval, $globalArchive; |
357 | 357 | $Spotter = new Spotter($this->db); |
358 | 358 | if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
359 | - $filter_query = $this->getFilter($filter,true,true); |
|
359 | + $filter_query = $this->getFilter($filter, true, true); |
|
360 | 360 | |
361 | 361 | if (is_array($coord)) { |
362 | - $minlong = filter_var($coord[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
363 | - $minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
364 | - $maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
365 | - $maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
362 | + $minlong = filter_var($coord[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
363 | + $minlat = filter_var($coord[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
364 | + $maxlong = filter_var($coord[2], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
365 | + $maxlat = filter_var($coord[3], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
366 | 366 | } else return array(); |
367 | 367 | if ($globalDBdriver == 'mysql') { |
368 | 368 | if (isset($globalArchive) && $globalArchive === TRUE) { |
369 | - $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 |
|
369 | + $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 |
|
370 | 370 | FROM spotter_live |
371 | 371 | '.$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= spotter_live.date |
372 | 372 | AND spotter_live.latitude BETWEEN '.$minlat.' AND '.$maxlat.' AND spotter_live.longitude BETWEEN '.$minlong.' AND '.$maxlong.' |
373 | 373 | AND spotter_live.latitude <> 0 AND spotter_live.longitude <> 0'; |
374 | 374 | } else { |
375 | - $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 |
|
375 | + $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 |
|
376 | 376 | FROM spotter_live |
377 | 377 | INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate |
378 | 378 | FROM spotter_live l |
@@ -384,14 +384,14 @@ discard block |
||
384 | 384 | } |
385 | 385 | } else { |
386 | 386 | if (isset($globalArchive) && $globalArchive === TRUE) { |
387 | - $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 |
|
387 | + $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 |
|
388 | 388 | FROM spotter_live |
389 | 389 | ".$filter_query." CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= spotter_live.date |
390 | 390 | AND spotter_live.latitude BETWEEN ".$minlat." AND ".$maxlat." |
391 | 391 | AND spotter_live.longitude BETWEEN ".$minlong." AND ".$maxlong." |
392 | 392 | AND spotter_live.latitude <> '0' AND spotter_live.longitude <> '0'"; |
393 | 393 | } else { |
394 | - $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 |
|
394 | + $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 |
|
395 | 395 | FROM spotter_live |
396 | 396 | INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate |
397 | 397 | FROM spotter_live l |
@@ -406,7 +406,7 @@ discard block |
||
406 | 406 | try { |
407 | 407 | $sth = $this->db->prepare($query); |
408 | 408 | $sth->execute(); |
409 | - } catch(PDOException $e) { |
|
409 | + } catch (PDOException $e) { |
|
410 | 410 | echo $e->getMessage(); |
411 | 411 | die; |
412 | 412 | } |
@@ -455,7 +455,7 @@ discard block |
||
455 | 455 | if ($interval == '1m') |
456 | 456 | { |
457 | 457 | $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= spotter_live.date '; |
458 | - } else if ($interval == '15m'){ |
|
458 | + } else if ($interval == '15m') { |
|
459 | 459 | $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 15 MINUTE) <= spotter_live.date '; |
460 | 460 | } |
461 | 461 | } |
@@ -463,14 +463,14 @@ discard block |
||
463 | 463 | $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= spotter_live.date '; |
464 | 464 | } |
465 | 465 | |
466 | - $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 |
|
466 | + $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 |
|
467 | 467 | WHERE spotter_live.latitude <> '' |
468 | 468 | AND spotter_live.longitude <> '' |
469 | 469 | ".$additional_query." |
470 | 470 | HAVING distance < :radius |
471 | 471 | ORDER BY distance"; |
472 | 472 | |
473 | - $spotter_array = $Spotter->getDataFromDB($query, array(':lat' => $lat, ':lng' => $lng,':radius' => $radius)); |
|
473 | + $spotter_array = $Spotter->getDataFromDB($query, array(':lat' => $lat, ':lng' => $lng, ':radius' => $radius)); |
|
474 | 474 | |
475 | 475 | return $spotter_array; |
476 | 476 | } |
@@ -488,9 +488,9 @@ discard block |
||
488 | 488 | date_default_timezone_set('UTC'); |
489 | 489 | |
490 | 490 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
491 | - $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'; |
|
491 | + $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'; |
|
492 | 492 | |
493 | - $spotter_array = $Spotter->getDataFromDB($query,array(':ident' => $ident),'',true); |
|
493 | + $spotter_array = $Spotter->getDataFromDB($query, array(':ident' => $ident), '', true); |
|
494 | 494 | |
495 | 495 | return $spotter_array; |
496 | 496 | } |
@@ -501,16 +501,16 @@ discard block |
||
501 | 501 | * @return Array the spotter information |
502 | 502 | * |
503 | 503 | */ |
504 | - public function getDateLiveSpotterDataByIdent($ident,$date) |
|
504 | + public function getDateLiveSpotterDataByIdent($ident, $date) |
|
505 | 505 | { |
506 | 506 | $Spotter = new Spotter($this->db); |
507 | 507 | date_default_timezone_set('UTC'); |
508 | 508 | |
509 | 509 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
510 | - $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'; |
|
510 | + $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'; |
|
511 | 511 | |
512 | - $date = date('c',$date); |
|
513 | - $spotter_array = $Spotter->getDataFromDB($query,array(':ident' => $ident,':date' => $date)); |
|
512 | + $date = date('c', $date); |
|
513 | + $spotter_array = $Spotter->getDataFromDB($query, array(':ident' => $ident, ':date' => $date)); |
|
514 | 514 | |
515 | 515 | return $spotter_array; |
516 | 516 | } |
@@ -526,8 +526,8 @@ discard block |
||
526 | 526 | $Spotter = new Spotter($this->db); |
527 | 527 | date_default_timezone_set('UTC'); |
528 | 528 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
529 | - $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'; |
|
530 | - $spotter_array = $Spotter->getDataFromDB($query,array(':id' => $id),'',true); |
|
529 | + $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'; |
|
530 | + $spotter_array = $Spotter->getDataFromDB($query, array(':id' => $id), '', true); |
|
531 | 531 | return $spotter_array; |
532 | 532 | } |
533 | 533 | |
@@ -537,15 +537,15 @@ discard block |
||
537 | 537 | * @return Array the spotter information |
538 | 538 | * |
539 | 539 | */ |
540 | - public function getDateLiveSpotterDataById($id,$date) |
|
540 | + public function getDateLiveSpotterDataById($id, $date) |
|
541 | 541 | { |
542 | 542 | $Spotter = new Spotter($this->db); |
543 | 543 | date_default_timezone_set('UTC'); |
544 | 544 | |
545 | 545 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
546 | - $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'; |
|
547 | - $date = date('c',$date); |
|
548 | - $spotter_array = $Spotter->getDataFromDB($query,array(':id' => $id,':date' => $date),'',true); |
|
546 | + $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'; |
|
547 | + $date = date('c', $date); |
|
548 | + $spotter_array = $Spotter->getDataFromDB($query, array(':id' => $id, ':date' => $date), '', true); |
|
549 | 549 | return $spotter_array; |
550 | 550 | } |
551 | 551 | |
@@ -561,13 +561,13 @@ discard block |
||
561 | 561 | date_default_timezone_set('UTC'); |
562 | 562 | |
563 | 563 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
564 | - $query = 'SELECT spotter_live.altitude, spotter_live.date FROM spotter_live WHERE spotter_live.ident = :ident'; |
|
564 | + $query = 'SELECT spotter_live.altitude, spotter_live.date FROM spotter_live WHERE spotter_live.ident = :ident'; |
|
565 | 565 | |
566 | 566 | try { |
567 | 567 | |
568 | 568 | $sth = $this->db->prepare($query); |
569 | 569 | $sth->execute(array(':ident' => $ident)); |
570 | - } catch(PDOException $e) { |
|
570 | + } catch (PDOException $e) { |
|
571 | 571 | echo $e->getMessage(); |
572 | 572 | die; |
573 | 573 | } |
@@ -582,7 +582,7 @@ discard block |
||
582 | 582 | * @return Array the spotter information |
583 | 583 | * |
584 | 584 | */ |
585 | - public function getAllLiveSpotterDataById($id,$liveinterval = false) |
|
585 | + public function getAllLiveSpotterDataById($id, $liveinterval = false) |
|
586 | 586 | { |
587 | 587 | global $globalDBdriver, $globalLiveInterval; |
588 | 588 | date_default_timezone_set('UTC'); |
@@ -601,7 +601,7 @@ discard block |
||
601 | 601 | try { |
602 | 602 | $sth = $this->db->prepare($query); |
603 | 603 | $sth->execute(array(':id' => $id)); |
604 | - } catch(PDOException $e) { |
|
604 | + } catch (PDOException $e) { |
|
605 | 605 | echo $e->getMessage(); |
606 | 606 | die; |
607 | 607 | } |
@@ -619,12 +619,12 @@ discard block |
||
619 | 619 | { |
620 | 620 | date_default_timezone_set('UTC'); |
621 | 621 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
622 | - $query = self::$global_query.' WHERE spotter_live.ident = :ident'; |
|
622 | + $query = self::$global_query.' WHERE spotter_live.ident = :ident'; |
|
623 | 623 | try { |
624 | 624 | |
625 | 625 | $sth = $this->db->prepare($query); |
626 | 626 | $sth->execute(array(':ident' => $ident)); |
627 | - } catch(PDOException $e) { |
|
627 | + } catch (PDOException $e) { |
|
628 | 628 | echo $e->getMessage(); |
629 | 629 | die; |
630 | 630 | } |
@@ -654,7 +654,7 @@ discard block |
||
654 | 654 | |
655 | 655 | $sth = $this->db->prepare($query); |
656 | 656 | $sth->execute(); |
657 | - } catch(PDOException $e) { |
|
657 | + } catch (PDOException $e) { |
|
658 | 658 | return "error"; |
659 | 659 | } |
660 | 660 | |
@@ -677,14 +677,14 @@ discard block |
||
677 | 677 | |
678 | 678 | $sth = $this->db->prepare($query); |
679 | 679 | $sth->execute(); |
680 | - } catch(PDOException $e) { |
|
680 | + } catch (PDOException $e) { |
|
681 | 681 | return "error"; |
682 | 682 | } |
683 | 683 | $query_delete = 'DELETE FROM spotter_live WHERE flightaware_id IN ('; |
684 | 684 | $i = 0; |
685 | - $j =0; |
|
685 | + $j = 0; |
|
686 | 686 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
687 | - foreach($all as $row) |
|
687 | + foreach ($all as $row) |
|
688 | 688 | { |
689 | 689 | $i++; |
690 | 690 | $j++; |
@@ -692,9 +692,9 @@ discard block |
||
692 | 692 | if ($globalDebug) echo "."; |
693 | 693 | try { |
694 | 694 | |
695 | - $sth = $this->db->prepare(substr($query_delete,0,-1).")"); |
|
695 | + $sth = $this->db->prepare(substr($query_delete, 0, -1).")"); |
|
696 | 696 | $sth->execute(); |
697 | - } catch(PDOException $e) { |
|
697 | + } catch (PDOException $e) { |
|
698 | 698 | return "error"; |
699 | 699 | } |
700 | 700 | $query_delete = 'DELETE FROM spotter_live WHERE flightaware_id IN ('; |
@@ -705,9 +705,9 @@ discard block |
||
705 | 705 | if ($i > 0) { |
706 | 706 | try { |
707 | 707 | |
708 | - $sth = $this->db->prepare(substr($query_delete,0,-1).")"); |
|
708 | + $sth = $this->db->prepare(substr($query_delete, 0, -1).")"); |
|
709 | 709 | $sth->execute(); |
710 | - } catch(PDOException $e) { |
|
710 | + } catch (PDOException $e) { |
|
711 | 711 | return "error"; |
712 | 712 | } |
713 | 713 | } |
@@ -720,7 +720,7 @@ discard block |
||
720 | 720 | |
721 | 721 | $sth = $this->db->prepare($query); |
722 | 722 | $sth->execute(); |
723 | - } catch(PDOException $e) { |
|
723 | + } catch (PDOException $e) { |
|
724 | 724 | return "error"; |
725 | 725 | } |
726 | 726 | /* $query_delete = "DELETE FROM spotter_live WHERE flightaware_id IN ("; |
@@ -768,13 +768,13 @@ discard block |
||
768 | 768 | public function deleteLiveSpotterDataByIdent($ident) |
769 | 769 | { |
770 | 770 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
771 | - $query = 'DELETE FROM spotter_live WHERE ident = :ident'; |
|
771 | + $query = 'DELETE FROM spotter_live WHERE ident = :ident'; |
|
772 | 772 | |
773 | 773 | try { |
774 | 774 | |
775 | 775 | $sth = $this->db->prepare($query); |
776 | 776 | $sth->execute(array(':ident' => $ident)); |
777 | - } catch(PDOException $e) { |
|
777 | + } catch (PDOException $e) { |
|
778 | 778 | return "error"; |
779 | 779 | } |
780 | 780 | |
@@ -790,13 +790,13 @@ discard block |
||
790 | 790 | public function deleteLiveSpotterDataById($id) |
791 | 791 | { |
792 | 792 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
793 | - $query = 'DELETE FROM spotter_live WHERE flightaware_id = :id'; |
|
793 | + $query = 'DELETE FROM spotter_live WHERE flightaware_id = :id'; |
|
794 | 794 | |
795 | 795 | try { |
796 | 796 | |
797 | 797 | $sth = $this->db->prepare($query); |
798 | 798 | $sth->execute(array(':id' => $id)); |
799 | - } catch(PDOException $e) { |
|
799 | + } catch (PDOException $e) { |
|
800 | 800 | return "error"; |
801 | 801 | } |
802 | 802 | |
@@ -814,13 +814,13 @@ discard block |
||
814 | 814 | { |
815 | 815 | global $globalDBdriver, $globalTimezone; |
816 | 816 | if ($globalDBdriver == 'mysql') { |
817 | - $query = 'SELECT spotter_live.ident FROM spotter_live |
|
817 | + $query = 'SELECT spotter_live.ident FROM spotter_live |
|
818 | 818 | WHERE spotter_live.ident = :ident |
819 | 819 | AND spotter_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 HOUR) |
820 | 820 | AND spotter_live.date < UTC_TIMESTAMP()'; |
821 | 821 | $query_data = array(':ident' => $ident); |
822 | 822 | } else { |
823 | - $query = "SELECT spotter_live.ident FROM spotter_live |
|
823 | + $query = "SELECT spotter_live.ident FROM spotter_live |
|
824 | 824 | WHERE spotter_live.ident = :ident |
825 | 825 | AND spotter_live.date >= now() AT TIME ZONE 'UTC' - INTERVAL '1 HOURS' |
826 | 826 | AND spotter_live.date < now() AT TIME ZONE 'UTC'"; |
@@ -829,8 +829,8 @@ discard block |
||
829 | 829 | |
830 | 830 | $sth = $this->db->prepare($query); |
831 | 831 | $sth->execute($query_data); |
832 | - $ident_result=''; |
|
833 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
832 | + $ident_result = ''; |
|
833 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
834 | 834 | { |
835 | 835 | $ident_result = $row['ident']; |
836 | 836 | } |
@@ -847,13 +847,13 @@ discard block |
||
847 | 847 | { |
848 | 848 | global $globalDBdriver, $globalTimezone; |
849 | 849 | if ($globalDBdriver == 'mysql') { |
850 | - $query = 'SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live |
|
850 | + $query = 'SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live |
|
851 | 851 | WHERE spotter_live.ident = :ident |
852 | 852 | AND spotter_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 30 MINUTE)'; |
853 | 853 | // AND spotter_live.date < UTC_TIMESTAMP()"; |
854 | 854 | $query_data = array(':ident' => $ident); |
855 | 855 | } else { |
856 | - $query = "SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live |
|
856 | + $query = "SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live |
|
857 | 857 | WHERE spotter_live.ident = :ident |
858 | 858 | AND spotter_live.date >= now() AT TIME ZONE 'UTC' - INTERVAL '30 MINUTES'"; |
859 | 859 | // AND spotter_live.date < now() AT TIME ZONE 'UTC'"; |
@@ -862,8 +862,8 @@ discard block |
||
862 | 862 | |
863 | 863 | $sth = $this->db->prepare($query); |
864 | 864 | $sth->execute($query_data); |
865 | - $ident_result=''; |
|
866 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
865 | + $ident_result = ''; |
|
866 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
867 | 867 | { |
868 | 868 | $ident_result = $row['flightaware_id']; |
869 | 869 | } |
@@ -880,13 +880,13 @@ discard block |
||
880 | 880 | { |
881 | 881 | global $globalDBdriver, $globalTimezone; |
882 | 882 | if ($globalDBdriver == 'mysql') { |
883 | - $query = 'SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live |
|
883 | + $query = 'SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live |
|
884 | 884 | WHERE spotter_live.flightaware_id = :id |
885 | 885 | AND spotter_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 10 HOUR)'; |
886 | 886 | // AND spotter_live.date < UTC_TIMESTAMP()"; |
887 | 887 | $query_data = array(':id' => $id); |
888 | 888 | } else { |
889 | - $query = "SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live |
|
889 | + $query = "SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live |
|
890 | 890 | WHERE spotter_live.flightaware_id = :id |
891 | 891 | AND spotter_live.date >= now() AT TIME ZONE 'UTC' - INTERVAL '10 HOUR'"; |
892 | 892 | // AND spotter_live.date < now() AT TIME ZONE 'UTC'"; |
@@ -895,8 +895,8 @@ discard block |
||
895 | 895 | |
896 | 896 | $sth = $this->db->prepare($query); |
897 | 897 | $sth->execute($query_data); |
898 | - $ident_result=''; |
|
899 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
898 | + $ident_result = ''; |
|
899 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
900 | 900 | { |
901 | 901 | $ident_result = $row['flightaware_id']; |
902 | 902 | } |
@@ -913,13 +913,13 @@ discard block |
||
913 | 913 | { |
914 | 914 | global $globalDBdriver, $globalTimezone; |
915 | 915 | if ($globalDBdriver == 'mysql') { |
916 | - $query = 'SELECT spotter_live.ModeS, spotter_live.flightaware_id FROM spotter_live |
|
916 | + $query = 'SELECT spotter_live.ModeS, spotter_live.flightaware_id FROM spotter_live |
|
917 | 917 | WHERE spotter_live.ModeS = :modes |
918 | 918 | AND spotter_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 30 MINUTE)'; |
919 | 919 | // AND spotter_live.date < UTC_TIMESTAMP()"; |
920 | 920 | $query_data = array(':modes' => $modes); |
921 | 921 | } else { |
922 | - $query = "SELECT spotter_live.ModeS, spotter_live.flightaware_id FROM spotter_live |
|
922 | + $query = "SELECT spotter_live.ModeS, spotter_live.flightaware_id FROM spotter_live |
|
923 | 923 | WHERE spotter_live.ModeS = :modes |
924 | 924 | AND spotter_live.date >= CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '30 MINUTE'"; |
925 | 925 | // // AND spotter_live.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC'"; |
@@ -928,8 +928,8 @@ discard block |
||
928 | 928 | |
929 | 929 | $sth = $this->db->prepare($query); |
930 | 930 | $sth->execute($query_data); |
931 | - $ident_result=''; |
|
932 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
931 | + $ident_result = ''; |
|
932 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
933 | 933 | { |
934 | 934 | //$ident_result = $row['spotter_live_id']; |
935 | 935 | $ident_result = $row['flightaware_id']; |
@@ -948,7 +948,7 @@ discard block |
||
948 | 948 | * @return String success or false |
949 | 949 | * |
950 | 950 | */ |
951 | - 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 = '') |
|
951 | + 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 = '') |
|
952 | 952 | { |
953 | 953 | global $globalURL, $globalArchive, $globalDebug; |
954 | 954 | $Common = new Common(); |
@@ -1048,27 +1048,27 @@ discard block |
||
1048 | 1048 | if ($date == '') $date = date("Y-m-d H:i:s", time()); |
1049 | 1049 | |
1050 | 1050 | |
1051 | - $flightaware_id = filter_var($flightaware_id,FILTER_SANITIZE_STRING); |
|
1052 | - $ident = filter_var($ident,FILTER_SANITIZE_STRING); |
|
1053 | - $aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING); |
|
1054 | - $departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING); |
|
1055 | - $arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING); |
|
1056 | - $latitude = filter_var($latitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
1057 | - $longitude = filter_var($longitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
1058 | - $waypoints = filter_var($waypoints,FILTER_SANITIZE_STRING); |
|
1059 | - $altitude = filter_var($altitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
1060 | - $altitude_real = filter_var($altitude_real,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
1061 | - $heading = filter_var($heading,FILTER_SANITIZE_NUMBER_INT); |
|
1062 | - $groundspeed = filter_var($groundspeed,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
1063 | - $squawk = filter_var($squawk,FILTER_SANITIZE_NUMBER_INT); |
|
1064 | - $route_stop = filter_var($route_stop,FILTER_SANITIZE_STRING); |
|
1065 | - $ModeS = filter_var($ModeS,FILTER_SANITIZE_STRING); |
|
1066 | - $pilot_id = filter_var($pilot_id,FILTER_SANITIZE_STRING); |
|
1067 | - $pilot_name = filter_var($pilot_name,FILTER_SANITIZE_STRING); |
|
1068 | - $format_source = filter_var($format_source,FILTER_SANITIZE_STRING); |
|
1069 | - $source_name = filter_var($source_name,FILTER_SANITIZE_STRING); |
|
1070 | - $over_country = filter_var($over_country,FILTER_SANITIZE_STRING); |
|
1071 | - $verticalrate = filter_var($verticalrate,FILTER_SANITIZE_NUMBER_INT); |
|
1051 | + $flightaware_id = filter_var($flightaware_id, FILTER_SANITIZE_STRING); |
|
1052 | + $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
|
1053 | + $aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING); |
|
1054 | + $departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING); |
|
1055 | + $arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING); |
|
1056 | + $latitude = filter_var($latitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
1057 | + $longitude = filter_var($longitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
1058 | + $waypoints = filter_var($waypoints, FILTER_SANITIZE_STRING); |
|
1059 | + $altitude = filter_var($altitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
1060 | + $altitude_real = filter_var($altitude_real, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
1061 | + $heading = filter_var($heading, FILTER_SANITIZE_NUMBER_INT); |
|
1062 | + $groundspeed = filter_var($groundspeed, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
1063 | + $squawk = filter_var($squawk, FILTER_SANITIZE_NUMBER_INT); |
|
1064 | + $route_stop = filter_var($route_stop, FILTER_SANITIZE_STRING); |
|
1065 | + $ModeS = filter_var($ModeS, FILTER_SANITIZE_STRING); |
|
1066 | + $pilot_id = filter_var($pilot_id, FILTER_SANITIZE_STRING); |
|
1067 | + $pilot_name = filter_var($pilot_name, FILTER_SANITIZE_STRING); |
|
1068 | + $format_source = filter_var($format_source, FILTER_SANITIZE_STRING); |
|
1069 | + $source_name = filter_var($source_name, FILTER_SANITIZE_STRING); |
|
1070 | + $over_country = filter_var($over_country, FILTER_SANITIZE_STRING); |
|
1071 | + $verticalrate = filter_var($verticalrate, FILTER_SANITIZE_NUMBER_INT); |
|
1072 | 1072 | |
1073 | 1073 | $airline_name = ''; |
1074 | 1074 | $airline_icao = ''; |
@@ -1090,10 +1090,10 @@ discard block |
||
1090 | 1090 | $arrival_airport_country = ''; |
1091 | 1091 | |
1092 | 1092 | |
1093 | - if ($squawk == '' || $Common->isInteger($squawk) === false ) $squawk = NULL; |
|
1094 | - if ($verticalrate == '' || $Common->isInteger($verticalrate) === false ) $verticalrate = NULL; |
|
1095 | - if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) $groundspeed = 0; |
|
1096 | - if ($heading == '' || $Common->isInteger($heading) === false ) $heading = 0; |
|
1093 | + if ($squawk == '' || $Common->isInteger($squawk) === false) $squawk = NULL; |
|
1094 | + if ($verticalrate == '' || $Common->isInteger($verticalrate) === false) $verticalrate = NULL; |
|
1095 | + if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0; |
|
1096 | + if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0; |
|
1097 | 1097 | |
1098 | 1098 | $query = ''; |
1099 | 1099 | if ($globalArchive) { |
@@ -1104,19 +1104,19 @@ discard block |
||
1104 | 1104 | $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) |
1105 | 1105 | 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)'; |
1106 | 1106 | |
1107 | - $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); |
|
1107 | + $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); |
|
1108 | 1108 | try { |
1109 | 1109 | |
1110 | 1110 | $sth = $this->db->prepare($query); |
1111 | 1111 | $sth->execute($query_values); |
1112 | 1112 | $sth->closeCursor(); |
1113 | - } catch(PDOException $e) { |
|
1113 | + } catch (PDOException $e) { |
|
1114 | 1114 | return "error : ".$e->getMessage(); |
1115 | 1115 | } |
1116 | 1116 | if (isset($globalArchive) && $globalArchive && $putinarchive && $noarchive !== true) { |
1117 | 1117 | if ($globalDebug) echo '(Add to SBS archive : '; |
1118 | 1118 | $SpotterArchive = new SpotterArchive($this->db); |
1119 | - $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); |
|
1119 | + $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); |
|
1120 | 1120 | if ($globalDebug) echo $result.')'; |
1121 | 1121 | } elseif ($globalDebug && $putinarchive !== true) { |
1122 | 1122 | echo '(Not adding to archive)'; |
@@ -1129,7 +1129,7 @@ discard block |
||
1129 | 1129 | |
1130 | 1130 | public function getOrderBy() |
1131 | 1131 | { |
1132 | - $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")); |
|
1132 | + $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")); |
|
1133 | 1133 | return $orderby; |
1134 | 1134 | } |
1135 | 1135 |
@@ -11,7 +11,7 @@ |
||
11 | 11 | /** |
12 | 12 | * Get SQL query part for filter used |
13 | 13 | * @param Array $filter the filter |
14 | - * @return Array the SQL part |
|
14 | + * @return string the SQL part |
|
15 | 15 | */ |
16 | 16 | public function getFilter($filter = array(),$where = false,$and = false) { |
17 | 17 | global $globalFilter, $globalStatsFilters, $globalFilterName, $globalDBdriver; |
@@ -26,7 +26,9 @@ discard block |
||
26 | 26 | if (isset($filter[0]['source'])) { |
27 | 27 | $filters = array_merge($filters,$filter); |
28 | 28 | } |
29 | - if (is_array($globalFilter)) $filter = array_merge($filter,$globalFilter); |
|
29 | + if (is_array($globalFilter)) { |
|
30 | + $filter = array_merge($filter,$globalFilter); |
|
31 | + } |
|
30 | 32 | $filter_query_join = ''; |
31 | 33 | $filter_query_where = ''; |
32 | 34 | foreach($filters as $flt) { |
@@ -99,8 +101,11 @@ discard block |
||
99 | 101 | } |
100 | 102 | $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output".preg_replace('/^ AND/',' WHERE',$filter_query_date).") sd ON sd.flightaware_id = spotter_archive_output.flightaware_id"; |
101 | 103 | } |
102 | - if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE'; |
|
103 | - elseif ($filter_query_where != '' && $and) $filter_query_where .= ' AND'; |
|
104 | + if ($filter_query_where == '' && $where) { |
|
105 | + $filter_query_where = ' WHERE'; |
|
106 | + } elseif ($filter_query_where != '' && $and) { |
|
107 | + $filter_query_where .= ' AND'; |
|
108 | + } |
|
104 | 109 | if ($filter_query_where != '') { |
105 | 110 | $filter_query_where = preg_replace('/^ AND/',' WHERE',$filter_query_where); |
106 | 111 | } |
@@ -114,10 +119,17 @@ discard block |
||
114 | 119 | if ($over_country == '') { |
115 | 120 | $Spotter = new Spotter($this->db); |
116 | 121 | $data_country = $Spotter->getCountryFromLatitudeLongitude($latitude,$longitude); |
117 | - if (!empty($data_country)) $country = $data_country['iso2']; |
|
118 | - else $country = ''; |
|
119 | - } else $country = $over_country; |
|
120 | - if ($airline_type === NULL) $airline_type =''; |
|
122 | + if (!empty($data_country)) { |
|
123 | + $country = $data_country['iso2']; |
|
124 | + } else { |
|
125 | + $country = ''; |
|
126 | + } |
|
127 | + } else { |
|
128 | + $country = $over_country; |
|
129 | + } |
|
130 | + if ($airline_type === NULL) { |
|
131 | + $airline_type =''; |
|
132 | + } |
|
121 | 133 | |
122 | 134 | //if ($country == '') echo "\n".'************ UNKNOW COUNTRY ****************'."\n"; |
123 | 135 | //else echo "\n".'*/*/*/*/*/*/*/ Country : '.$country.' */*/*/*/*/*/*/*/*/'."\n"; |
@@ -620,7 +632,9 @@ discard block |
||
620 | 632 | $additional_query .= "(spotter_archive_output.pilot_name like '%".$q_item."%') OR "; |
621 | 633 | $additional_query .= "(spotter_archive_output.ident like '%".$q_item."%') OR "; |
622 | 634 | $translate = $Translation->ident2icao($q_item); |
623 | - if ($translate != $q_item) $additional_query .= "(spotter_archive_output.ident like '%".$translate."%') OR "; |
|
635 | + if ($translate != $q_item) { |
|
636 | + $additional_query .= "(spotter_archive_output.ident like '%".$translate."%') OR "; |
|
637 | + } |
|
624 | 638 | $additional_query .= "(spotter_archive_output.highlight like '%".$q_item."%')"; |
625 | 639 | $additional_query .= ")"; |
626 | 640 | } |
@@ -838,7 +852,9 @@ discard block |
||
838 | 852 | date_default_timezone_set($globalTimezone); |
839 | 853 | $datetime = new DateTime(); |
840 | 854 | $offset = $datetime->format('P'); |
841 | - } else $offset = '+00:00'; |
|
855 | + } else { |
|
856 | + $offset = '+00:00'; |
|
857 | + } |
|
842 | 858 | |
843 | 859 | |
844 | 860 | if ($date_array[1] != "") |
@@ -1114,9 +1130,13 @@ discard block |
||
1114 | 1130 | $query .= "AND date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'"; |
1115 | 1131 | } |
1116 | 1132 | } |
1117 | - if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
|
1133 | + if ($sincedate != '') { |
|
1134 | + $query .= "AND date > '".$sincedate."' "; |
|
1135 | + } |
|
1118 | 1136 | $query .= "GROUP BY c.name, c.iso3, c.iso2 ORDER BY nb DESC"; |
1119 | - if ($limit) $query .= " LIMIT 0,10"; |
|
1137 | + if ($limit) { |
|
1138 | + $query .= " LIMIT 0,10"; |
|
1139 | + } |
|
1120 | 1140 | |
1121 | 1141 | |
1122 | 1142 | $sth = $this->db->prepare($query); |
@@ -1160,9 +1180,13 @@ discard block |
||
1160 | 1180 | $query .= "AND s.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'"; |
1161 | 1181 | } |
1162 | 1182 | } |
1163 | - if ($sincedate != '') $query .= "AND s.date > '".$sincedate."' "; |
|
1183 | + if ($sincedate != '') { |
|
1184 | + $query .= "AND s.date > '".$sincedate."' "; |
|
1185 | + } |
|
1164 | 1186 | $query .= "GROUP BY o.airline_icao,c.name, c.iso3, c.iso2 ORDER BY nb DESC"; |
1165 | - if ($limit) $query .= " LIMIT 0,10"; |
|
1187 | + if ($limit) { |
|
1188 | + $query .= " LIMIT 0,10"; |
|
1189 | + } |
|
1166 | 1190 | |
1167 | 1191 | |
1168 | 1192 | $sth = $this->db->prepare($query); |
@@ -8,12 +8,12 @@ discard block |
||
8 | 8 | $this->db = $Connection->db; |
9 | 9 | } |
10 | 10 | |
11 | - /** |
|
12 | - * Get SQL query part for filter used |
|
13 | - * @param Array $filter the filter |
|
14 | - * @return Array the SQL part |
|
15 | - */ |
|
16 | - public function getFilter($filter = array(),$where = false,$and = false) { |
|
11 | + /** |
|
12 | + * Get SQL query part for filter used |
|
13 | + * @param Array $filter the filter |
|
14 | + * @return Array the SQL part |
|
15 | + */ |
|
16 | + public function getFilter($filter = array(),$where = false,$and = false) { |
|
17 | 17 | global $globalFilter, $globalStatsFilters, $globalFilterName, $globalDBdriver; |
18 | 18 | $filters = array(); |
19 | 19 | if (is_array($globalStatsFilters) && isset($globalStatsFilters[$globalFilterName])) { |
@@ -30,88 +30,88 @@ discard block |
||
30 | 30 | $filter_query_join = ''; |
31 | 31 | $filter_query_where = ''; |
32 | 32 | foreach($filters as $flt) { |
33 | - if (isset($flt['airlines']) && !empty($flt['airlines'])) { |
|
33 | + if (isset($flt['airlines']) && !empty($flt['airlines'])) { |
|
34 | 34 | if ($flt['airlines'][0] != '') { |
35 | - if (isset($flt['source'])) { |
|
35 | + if (isset($flt['source'])) { |
|
36 | 36 | $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.airline_icao IN ('".implode("','",$flt['airlines'])."') AND spotter_archive_output.format_source IN ('".implode("','",$flt['source'])."')) saff ON saff.flightaware_id = spotter_archive_output.flightaware_id"; |
37 | - } else { |
|
37 | + } else { |
|
38 | 38 | $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.airline_icao IN ('".implode("','",$flt['airlines'])."')) saff ON saff.flightaware_id = spotter_archive_output.flightaware_id"; |
39 | - } |
|
39 | + } |
|
40 | + } |
|
40 | 41 | } |
41 | - } |
|
42 | - if (isset($flt['pilots_id']) && !empty($flt['pilots_id'])) { |
|
42 | + if (isset($flt['pilots_id']) && !empty($flt['pilots_id'])) { |
|
43 | 43 | if (isset($flt['source'])) { |
44 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.pilot_id IN ('".implode("','",$flt['pilots_id'])."') AND spotter_archive_output.format_source IN ('".implode("','",$flt['source'])."')) sp ON sp.flightaware_id = spotter_archive_output.flightaware_id"; |
|
44 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.pilot_id IN ('".implode("','",$flt['pilots_id'])."') AND spotter_archive_output.format_source IN ('".implode("','",$flt['source'])."')) sp ON sp.flightaware_id = spotter_archive_output.flightaware_id"; |
|
45 | 45 | } else { |
46 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.pilot_id IN ('".implode("','",$flt['pilots_id'])."')) sp ON sp.flightaware_id = spotter_archive_output.flightaware_id"; |
|
46 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.pilot_id IN ('".implode("','",$flt['pilots_id'])."')) sp ON sp.flightaware_id = spotter_archive_output.flightaware_id"; |
|
47 | 47 | } |
48 | - } |
|
49 | - if (isset($flt['idents']) && !empty($flt['idents'])) { |
|
48 | + } |
|
49 | + if (isset($flt['idents']) && !empty($flt['idents'])) { |
|
50 | 50 | if (isset($flt['source'])) { |
51 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.ident IN ('".implode("','",$flt['idents'])."') AND spotter_archive_output.format_source IN ('".implode("','",$flt['source'])."')) spi ON spi.flightaware_id = spotter_archive_output.flightaware_id"; |
|
51 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.ident IN ('".implode("','",$flt['idents'])."') AND spotter_archive_output.format_source IN ('".implode("','",$flt['source'])."')) spi ON spi.flightaware_id = spotter_archive_output.flightaware_id"; |
|
52 | 52 | } else { |
53 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.ident IN ('".implode("','",$flt['idents'])."')) spi ON spi.flightaware_id = spotter_archive_output.flightaware_id"; |
|
53 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.ident IN ('".implode("','",$flt['idents'])."')) spi ON spi.flightaware_id = spotter_archive_output.flightaware_id"; |
|
54 | + } |
|
54 | 55 | } |
55 | - } |
|
56 | - if (isset($flt['registrations']) && !empty($flt['registrations'])) { |
|
56 | + if (isset($flt['registrations']) && !empty($flt['registrations'])) { |
|
57 | 57 | if (isset($flt['source'])) { |
58 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.registration IN ('".implode("','",$flt['registrations'])."') AND spotter_archive_output.format_source IN ('".implode("','",$flt['source'])."')) sre ON sre.flightaware_id = spotter_archive_output.flightaware_id"; |
|
58 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.registration IN ('".implode("','",$flt['registrations'])."') AND spotter_archive_output.format_source IN ('".implode("','",$flt['source'])."')) sre ON sre.flightaware_id = spotter_archive_output.flightaware_id"; |
|
59 | 59 | } else { |
60 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.registration IN ('".implode("','",$flt['registrations'])."')) sre ON sre.flightaware_id = spotter_archive_output.flightaware_id"; |
|
60 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.registration IN ('".implode("','",$flt['registrations'])."')) sre ON sre.flightaware_id = spotter_archive_output.flightaware_id"; |
|
61 | + } |
|
61 | 62 | } |
62 | - } |
|
63 | - if ((isset($flt['airlines']) && empty($flt['airlines']) && isset($flt['pilots_id']) && empty($flt['pilots_id']) && isset($flt['idents']) && empty($flt['idents']) && isset($flt['registrations']) && empty($flt['registrations'])) || (!isset($flt['airlines']) && !isset($flt['pilots_id']) && !isset($flt['idents']) && !isset($flt['registrations']))) { |
|
63 | + if ((isset($flt['airlines']) && empty($flt['airlines']) && isset($flt['pilots_id']) && empty($flt['pilots_id']) && isset($flt['idents']) && empty($flt['idents']) && isset($flt['registrations']) && empty($flt['registrations'])) || (!isset($flt['airlines']) && !isset($flt['pilots_id']) && !isset($flt['idents']) && !isset($flt['registrations']))) { |
|
64 | 64 | if (isset($flt['source'])) { |
65 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_output.format_source IN ('".implode("','",$flt['source'])."')) saa ON saa.flightaware_id = spotter_archive_output.flightaware_id"; |
|
65 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_output.format_source IN ('".implode("','",$flt['source'])."')) saa ON saa.flightaware_id = spotter_archive_output.flightaware_id"; |
|
66 | + } |
|
66 | 67 | } |
67 | - } |
|
68 | 68 | } |
69 | 69 | if (isset($filter['airlines']) && !empty($filter['airlines'])) { |
70 | - if ($filter['airlines'][0] != '') { |
|
70 | + if ($filter['airlines'][0] != '') { |
|
71 | 71 | $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.airline_icao IN ('".implode("','",$filter['airlines'])."')) saf ON saf.flightaware_id = spotter_archive_output.flightaware_id"; |
72 | - } |
|
72 | + } |
|
73 | 73 | } |
74 | 74 | |
75 | 75 | if (isset($filter['airlinestype']) && !empty($filter['airlinestype'])) { |
76 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.airline_type = '".$filter['airlinestype']."') sa ON sa.flightaware_id = spotter_archive_output.flightaware_id "; |
|
76 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.airline_type = '".$filter['airlinestype']."') sa ON sa.flightaware_id = spotter_archive_output.flightaware_id "; |
|
77 | 77 | } |
78 | 78 | if (isset($filter['pilots_id']) && !empty($filter['pilots_id'])) { |
79 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.pilot_id IN ('".implode("','",$filter['pilots_id'])."')) spi ON spi.flightaware_id = spotter_archive_output.flightaware_id"; |
|
79 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.pilot_id IN ('".implode("','",$filter['pilots_id'])."')) spi ON spi.flightaware_id = spotter_archive_output.flightaware_id"; |
|
80 | 80 | } |
81 | 81 | if (isset($filter['source']) && !empty($filter['source'])) { |
82 | - $filter_query_where .= " AND format_source IN ('".implode("','",$filter['source'])."')"; |
|
82 | + $filter_query_where .= " AND format_source IN ('".implode("','",$filter['source'])."')"; |
|
83 | 83 | } |
84 | 84 | if (isset($filter['ident']) && !empty($filter['ident'])) { |
85 | - $filter_query_where .= " AND ident = '".$filter['ident']."'"; |
|
85 | + $filter_query_where .= " AND ident = '".$filter['ident']."'"; |
|
86 | 86 | } |
87 | 87 | if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) { |
88 | 88 | $filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')"; |
89 | 89 | } |
90 | 90 | if ((isset($filter['year']) && $filter['year'] != '') || (isset($filter['month']) && $filter['month'] != '') || (isset($filter['day']) && $filter['day'] != '')) { |
91 | - $filter_query_date = ''; |
|
91 | + $filter_query_date = ''; |
|
92 | 92 | |
93 | - if (isset($filter['year']) && $filter['year'] != '') { |
|
93 | + if (isset($filter['year']) && $filter['year'] != '') { |
|
94 | 94 | if ($globalDBdriver == 'mysql') { |
95 | - $filter_query_date .= " AND YEAR(spotter_archive_output.date) = '".$filter['year']."'"; |
|
95 | + $filter_query_date .= " AND YEAR(spotter_archive_output.date) = '".$filter['year']."'"; |
|
96 | 96 | } else { |
97 | - $filter_query_date .= " AND EXTRACT(YEAR FROM spotter_archive_output.date) = '".$filter['year']."'"; |
|
97 | + $filter_query_date .= " AND EXTRACT(YEAR FROM spotter_archive_output.date) = '".$filter['year']."'"; |
|
98 | + } |
|
98 | 99 | } |
99 | - } |
|
100 | - if (isset($filter['month']) && $filter['month'] != '') { |
|
100 | + if (isset($filter['month']) && $filter['month'] != '') { |
|
101 | 101 | if ($globalDBdriver == 'mysql') { |
102 | - $filter_query_date .= " AND MONTH(spotter_archive_output.date) = '".$filter['month']."'"; |
|
102 | + $filter_query_date .= " AND MONTH(spotter_archive_output.date) = '".$filter['month']."'"; |
|
103 | 103 | } else { |
104 | - $filter_query_date .= " AND EXTRACT(MONTH FROM spotter_archive_output.date) = '".$filter['month']."'"; |
|
104 | + $filter_query_date .= " AND EXTRACT(MONTH FROM spotter_archive_output.date) = '".$filter['month']."'"; |
|
105 | 105 | } |
106 | - } |
|
107 | - if (isset($filter['day']) && $filter['day'] != '') { |
|
106 | + } |
|
107 | + if (isset($filter['day']) && $filter['day'] != '') { |
|
108 | 108 | if ($globalDBdriver == 'mysql') { |
109 | - $filter_query_date .= " AND DAY(spotter_archive_output.date) = '".$filter['day']."'"; |
|
109 | + $filter_query_date .= " AND DAY(spotter_archive_output.date) = '".$filter['day']."'"; |
|
110 | 110 | } else { |
111 | - $filter_query_date .= " AND EXTRACT(DAY FROM spotter_archive_output.date) = '".$filter['day']."'"; |
|
111 | + $filter_query_date .= " AND EXTRACT(DAY FROM spotter_archive_output.date) = '".$filter['day']."'"; |
|
112 | + } |
|
112 | 113 | } |
113 | - } |
|
114 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output".preg_replace('/^ AND/',' WHERE',$filter_query_date).") sd ON sd.flightaware_id = spotter_archive_output.flightaware_id"; |
|
114 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output".preg_replace('/^ AND/',' WHERE',$filter_query_date).") sd ON sd.flightaware_id = spotter_archive_output.flightaware_id"; |
|
115 | 115 | } |
116 | 116 | if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE'; |
117 | 117 | elseif ($filter_query_where != '' && $and) $filter_query_where .= ' AND'; |
@@ -120,7 +120,7 @@ discard block |
||
120 | 120 | } |
121 | 121 | $filter_query = $filter_query_join.$filter_query_where; |
122 | 122 | return $filter_query; |
123 | - } |
|
123 | + } |
|
124 | 124 | |
125 | 125 | // Spotter_archive |
126 | 126 | public function addSpotterArchiveData($flightaware_id = '', $ident = '', $registration = '', $airline_name = '', $airline_icao = '', $airline_country = '', $airline_type = '', $aircraft_icao = '', $aircraft_shadow = '', $aircraft_name = '', $aircraft_manufacturer = '', $departure_airport_icao = '', $departure_airport_name = '', $departure_airport_city = '', $departure_airport_country = '', $departure_airport_time = '',$arrival_airport_icao = '', $arrival_airport_name = '', $arrival_airport_city ='', $arrival_airport_country = '', $arrival_airport_time = '', $route_stop = '', $date = '',$latitude = '', $longitude = '', $waypoints = '', $altitude = '', $real_altitude = '',$heading = '', $ground_speed = '', $squawk = '', $ModeS = '', $pilot_id = '', $pilot_name = '',$verticalrate = '',$format_source = '', $source_name = '', $over_country = '') { |
@@ -152,44 +152,44 @@ discard block |
||
152 | 152 | } |
153 | 153 | |
154 | 154 | |
155 | - /** |
|
156 | - * Gets all the spotter information based on a particular callsign |
|
157 | - * |
|
158 | - * @return Array the spotter information |
|
159 | - * |
|
160 | - */ |
|
161 | - public function getLastArchiveSpotterDataByIdent($ident) |
|
162 | - { |
|
155 | + /** |
|
156 | + * Gets all the spotter information based on a particular callsign |
|
157 | + * |
|
158 | + * @return Array the spotter information |
|
159 | + * |
|
160 | + */ |
|
161 | + public function getLastArchiveSpotterDataByIdent($ident) |
|
162 | + { |
|
163 | 163 | $Spotter = new Spotter($this->db); |
164 | - date_default_timezone_set('UTC'); |
|
164 | + date_default_timezone_set('UTC'); |
|
165 | 165 | |
166 | - $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
|
167 | - //$query = "SELECT spotter_archive.* FROM spotter_archive INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_archive l WHERE l.ident = :ident GROUP BY l.flightaware_id) s on spotter_archive.flightaware_id = s.flightaware_id AND spotter_archive.date = s.maxdate LIMIT 1"; |
|
168 | - $query = "SELECT spotter_archive.* FROM spotter_archive WHERE ident = :ident ORDER BY date DESC LIMIT 1"; |
|
166 | + $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
|
167 | + //$query = "SELECT spotter_archive.* FROM spotter_archive INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_archive l WHERE l.ident = :ident GROUP BY l.flightaware_id) s on spotter_archive.flightaware_id = s.flightaware_id AND spotter_archive.date = s.maxdate LIMIT 1"; |
|
168 | + $query = "SELECT spotter_archive.* FROM spotter_archive WHERE ident = :ident ORDER BY date DESC LIMIT 1"; |
|
169 | 169 | |
170 | - $spotter_array = $Spotter->getDataFromDB($query,array(':ident' => $ident)); |
|
170 | + $spotter_array = $Spotter->getDataFromDB($query,array(':ident' => $ident)); |
|
171 | 171 | |
172 | - return $spotter_array; |
|
173 | - } |
|
172 | + return $spotter_array; |
|
173 | + } |
|
174 | 174 | |
175 | 175 | |
176 | - /** |
|
177 | - * Gets last the spotter information based on a particular id |
|
178 | - * |
|
179 | - * @return Array the spotter information |
|
180 | - * |
|
181 | - */ |
|
182 | - public function getLastArchiveSpotterDataById($id) |
|
183 | - { |
|
184 | - $Spotter = new Spotter($this->db); |
|
185 | - date_default_timezone_set('UTC'); |
|
186 | - $id = filter_var($id, FILTER_SANITIZE_STRING); |
|
187 | - //$query = SpotterArchive->$global_query." WHERE spotter_archive.flightaware_id = :id"; |
|
188 | - //$query = "SELECT spotter_archive.* FROM spotter_archive INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_archive l WHERE l.flightaware_id = :id GROUP BY l.flightaware_id) s on spotter_archive.flightaware_id = s.flightaware_id AND spotter_archive.date = s.maxdate LIMIT 1"; |
|
189 | - $query = "SELECT * FROM spotter_archive WHERE flightaware_id = :id ORDER BY date DESC LIMIT 1"; |
|
176 | + /** |
|
177 | + * Gets last the spotter information based on a particular id |
|
178 | + * |
|
179 | + * @return Array the spotter information |
|
180 | + * |
|
181 | + */ |
|
182 | + public function getLastArchiveSpotterDataById($id) |
|
183 | + { |
|
184 | + $Spotter = new Spotter($this->db); |
|
185 | + date_default_timezone_set('UTC'); |
|
186 | + $id = filter_var($id, FILTER_SANITIZE_STRING); |
|
187 | + //$query = SpotterArchive->$global_query." WHERE spotter_archive.flightaware_id = :id"; |
|
188 | + //$query = "SELECT spotter_archive.* FROM spotter_archive INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_archive l WHERE l.flightaware_id = :id GROUP BY l.flightaware_id) s on spotter_archive.flightaware_id = s.flightaware_id AND spotter_archive.date = s.maxdate LIMIT 1"; |
|
189 | + $query = "SELECT * FROM spotter_archive WHERE flightaware_id = :id ORDER BY date DESC LIMIT 1"; |
|
190 | 190 | |
191 | 191 | // $spotter_array = Spotter->getDataFromDB($query,array(':id' => $id)); |
192 | - /* |
|
192 | + /* |
|
193 | 193 | try { |
194 | 194 | $Connection = new Connection(); |
195 | 195 | $sth = Connection->$db->prepare($query); |
@@ -199,235 +199,235 @@ discard block |
||
199 | 199 | } |
200 | 200 | $spotter_array = $sth->fetchAll(PDO->FETCH_ASSOC); |
201 | 201 | */ |
202 | - $spotter_array = $Spotter->getDataFromDB($query,array(':id' => $id)); |
|
203 | - |
|
204 | - return $spotter_array; |
|
205 | - } |
|
206 | - |
|
207 | - /** |
|
208 | - * Gets all the spotter information based on a particular id |
|
209 | - * |
|
210 | - * @return Array the spotter information |
|
211 | - * |
|
212 | - */ |
|
213 | - public function getAllArchiveSpotterDataById($id) |
|
202 | + $spotter_array = $Spotter->getDataFromDB($query,array(':id' => $id)); |
|
203 | + |
|
204 | + return $spotter_array; |
|
205 | + } |
|
206 | + |
|
207 | + /** |
|
208 | + * Gets all the spotter information based on a particular id |
|
209 | + * |
|
210 | + * @return Array the spotter information |
|
211 | + * |
|
212 | + */ |
|
213 | + public function getAllArchiveSpotterDataById($id) |
|
214 | 214 | { |
215 | - date_default_timezone_set('UTC'); |
|
216 | - $id = filter_var($id, FILTER_SANITIZE_STRING); |
|
217 | - $query = $this->global_query." WHERE spotter_archive.flightaware_id = :id ORDER BY date"; |
|
215 | + date_default_timezone_set('UTC'); |
|
216 | + $id = filter_var($id, FILTER_SANITIZE_STRING); |
|
217 | + $query = $this->global_query." WHERE spotter_archive.flightaware_id = :id ORDER BY date"; |
|
218 | 218 | |
219 | 219 | // $spotter_array = Spotter->getDataFromDB($query,array(':id' => $id)); |
220 | 220 | |
221 | - try { |
|
222 | - $sth = $this->db->prepare($query); |
|
223 | - $sth->execute(array(':id' => $id)); |
|
224 | - } catch(PDOException $e) { |
|
225 | - echo $e->getMessage(); |
|
226 | - die; |
|
227 | - } |
|
228 | - $spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
229 | - |
|
230 | - return $spotter_array; |
|
231 | - } |
|
232 | - |
|
233 | - /** |
|
234 | - * Gets coordinate & time spotter information based on a particular id |
|
235 | - * |
|
236 | - * @return Array the spotter information |
|
237 | - * |
|
238 | - */ |
|
239 | - public function getCoordArchiveSpotterDataById($id) |
|
240 | - { |
|
241 | - date_default_timezone_set('UTC'); |
|
242 | - $id = filter_var($id, FILTER_SANITIZE_STRING); |
|
243 | - $query = "SELECT spotter_archive.latitude, spotter_archive.longitude, spotter_archive.date FROM spotter_archive WHERE spotter_archive.flightaware_id = :id"; |
|
221 | + try { |
|
222 | + $sth = $this->db->prepare($query); |
|
223 | + $sth->execute(array(':id' => $id)); |
|
224 | + } catch(PDOException $e) { |
|
225 | + echo $e->getMessage(); |
|
226 | + die; |
|
227 | + } |
|
228 | + $spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
229 | + |
|
230 | + return $spotter_array; |
|
231 | + } |
|
232 | + |
|
233 | + /** |
|
234 | + * Gets coordinate & time spotter information based on a particular id |
|
235 | + * |
|
236 | + * @return Array the spotter information |
|
237 | + * |
|
238 | + */ |
|
239 | + public function getCoordArchiveSpotterDataById($id) |
|
240 | + { |
|
241 | + date_default_timezone_set('UTC'); |
|
242 | + $id = filter_var($id, FILTER_SANITIZE_STRING); |
|
243 | + $query = "SELECT spotter_archive.latitude, spotter_archive.longitude, spotter_archive.date FROM spotter_archive WHERE spotter_archive.flightaware_id = :id"; |
|
244 | 244 | |
245 | 245 | // $spotter_array = Spotter->getDataFromDB($query,array(':id' => $id)); |
246 | 246 | |
247 | - try { |
|
248 | - $sth = $this->db->prepare($query); |
|
249 | - $sth->execute(array(':id' => $id)); |
|
250 | - } catch(PDOException $e) { |
|
251 | - echo $e->getMessage(); |
|
252 | - die; |
|
253 | - } |
|
254 | - $spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
247 | + try { |
|
248 | + $sth = $this->db->prepare($query); |
|
249 | + $sth->execute(array(':id' => $id)); |
|
250 | + } catch(PDOException $e) { |
|
251 | + echo $e->getMessage(); |
|
252 | + die; |
|
253 | + } |
|
254 | + $spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
255 | 255 | |
256 | - return $spotter_array; |
|
257 | - } |
|
256 | + return $spotter_array; |
|
257 | + } |
|
258 | 258 | |
259 | 259 | |
260 | - /** |
|
261 | - * Gets altitude information based on a particular callsign |
|
262 | - * |
|
263 | - * @return Array the spotter information |
|
264 | - * |
|
265 | - */ |
|
266 | - public function getAltitudeArchiveSpotterDataByIdent($ident) |
|
267 | - { |
|
260 | + /** |
|
261 | + * Gets altitude information based on a particular callsign |
|
262 | + * |
|
263 | + * @return Array the spotter information |
|
264 | + * |
|
265 | + */ |
|
266 | + public function getAltitudeArchiveSpotterDataByIdent($ident) |
|
267 | + { |
|
268 | 268 | |
269 | - date_default_timezone_set('UTC'); |
|
269 | + date_default_timezone_set('UTC'); |
|
270 | 270 | |
271 | - $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
|
272 | - $query = "SELECT spotter_archive.altitude, spotter_archive.date FROM spotter_archive WHERE spotter_archive.ident = :ident AND spotter_archive.latitude <> 0 AND spotter_archive.longitude <> 0 ORDER BY date"; |
|
271 | + $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
|
272 | + $query = "SELECT spotter_archive.altitude, spotter_archive.date FROM spotter_archive WHERE spotter_archive.ident = :ident AND spotter_archive.latitude <> 0 AND spotter_archive.longitude <> 0 ORDER BY date"; |
|
273 | 273 | |
274 | - try { |
|
275 | - $sth = $this->db->prepare($query); |
|
276 | - $sth->execute(array(':ident' => $ident)); |
|
277 | - } catch(PDOException $e) { |
|
278 | - echo $e->getMessage(); |
|
279 | - die; |
|
280 | - } |
|
281 | - $spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
274 | + try { |
|
275 | + $sth = $this->db->prepare($query); |
|
276 | + $sth->execute(array(':ident' => $ident)); |
|
277 | + } catch(PDOException $e) { |
|
278 | + echo $e->getMessage(); |
|
279 | + die; |
|
280 | + } |
|
281 | + $spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
282 | 282 | |
283 | - return $spotter_array; |
|
284 | - } |
|
283 | + return $spotter_array; |
|
284 | + } |
|
285 | 285 | |
286 | - /** |
|
287 | - * Gets altitude information based on a particular id |
|
288 | - * |
|
289 | - * @return Array the spotter information |
|
290 | - * |
|
291 | - */ |
|
292 | - public function getAltitudeArchiveSpotterDataById($id) |
|
293 | - { |
|
286 | + /** |
|
287 | + * Gets altitude information based on a particular id |
|
288 | + * |
|
289 | + * @return Array the spotter information |
|
290 | + * |
|
291 | + */ |
|
292 | + public function getAltitudeArchiveSpotterDataById($id) |
|
293 | + { |
|
294 | 294 | |
295 | - date_default_timezone_set('UTC'); |
|
295 | + date_default_timezone_set('UTC'); |
|
296 | 296 | |
297 | - $id = filter_var($id, FILTER_SANITIZE_STRING); |
|
298 | - $query = "SELECT spotter_archive.altitude, spotter_archive.date FROM spotter_archive WHERE spotter_archive.flightaware_id = :id AND spotter_archive.latitude <> 0 AND spotter_archive.longitude <> 0 ORDER BY date"; |
|
297 | + $id = filter_var($id, FILTER_SANITIZE_STRING); |
|
298 | + $query = "SELECT spotter_archive.altitude, spotter_archive.date FROM spotter_archive WHERE spotter_archive.flightaware_id = :id AND spotter_archive.latitude <> 0 AND spotter_archive.longitude <> 0 ORDER BY date"; |
|
299 | 299 | |
300 | - try { |
|
301 | - $sth = $this->db->prepare($query); |
|
302 | - $sth->execute(array(':id' => $id)); |
|
303 | - } catch(PDOException $e) { |
|
304 | - echo $e->getMessage(); |
|
305 | - die; |
|
306 | - } |
|
307 | - $spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
300 | + try { |
|
301 | + $sth = $this->db->prepare($query); |
|
302 | + $sth->execute(array(':id' => $id)); |
|
303 | + } catch(PDOException $e) { |
|
304 | + echo $e->getMessage(); |
|
305 | + die; |
|
306 | + } |
|
307 | + $spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
308 | 308 | |
309 | - return $spotter_array; |
|
310 | - } |
|
309 | + return $spotter_array; |
|
310 | + } |
|
311 | 311 | |
312 | - /** |
|
313 | - * Gets altitude & speed information based on a particular id |
|
314 | - * |
|
315 | - * @return Array the spotter information |
|
316 | - * |
|
317 | - */ |
|
318 | - public function getAltitudeSpeedArchiveSpotterDataById($id) |
|
319 | - { |
|
312 | + /** |
|
313 | + * Gets altitude & speed information based on a particular id |
|
314 | + * |
|
315 | + * @return Array the spotter information |
|
316 | + * |
|
317 | + */ |
|
318 | + public function getAltitudeSpeedArchiveSpotterDataById($id) |
|
319 | + { |
|
320 | 320 | |
321 | - date_default_timezone_set('UTC'); |
|
321 | + date_default_timezone_set('UTC'); |
|
322 | 322 | |
323 | - $id = filter_var($id, FILTER_SANITIZE_STRING); |
|
324 | - $query = "SELECT spotter_archive.altitude, spotter_archive.real_altitude,spotter_archive.ground_speed, spotter_archive.date FROM spotter_archive WHERE spotter_archive.flightaware_id = :id ORDER BY date"; |
|
323 | + $id = filter_var($id, FILTER_SANITIZE_STRING); |
|
324 | + $query = "SELECT spotter_archive.altitude, spotter_archive.real_altitude,spotter_archive.ground_speed, spotter_archive.date FROM spotter_archive WHERE spotter_archive.flightaware_id = :id ORDER BY date"; |
|
325 | 325 | |
326 | - try { |
|
327 | - $sth = $this->db->prepare($query); |
|
328 | - $sth->execute(array(':id' => $id)); |
|
329 | - } catch(PDOException $e) { |
|
330 | - echo $e->getMessage(); |
|
331 | - die; |
|
332 | - } |
|
333 | - $spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
326 | + try { |
|
327 | + $sth = $this->db->prepare($query); |
|
328 | + $sth->execute(array(':id' => $id)); |
|
329 | + } catch(PDOException $e) { |
|
330 | + echo $e->getMessage(); |
|
331 | + die; |
|
332 | + } |
|
333 | + $spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
334 | 334 | |
335 | - return $spotter_array; |
|
336 | - } |
|
335 | + return $spotter_array; |
|
336 | + } |
|
337 | 337 | |
338 | 338 | |
339 | - /** |
|
340 | - * Gets altitude information based on a particular callsign |
|
341 | - * |
|
342 | - * @return Array the spotter information |
|
343 | - * |
|
344 | - */ |
|
345 | - public function getLastAltitudeArchiveSpotterDataByIdent($ident) |
|
346 | - { |
|
339 | + /** |
|
340 | + * Gets altitude information based on a particular callsign |
|
341 | + * |
|
342 | + * @return Array the spotter information |
|
343 | + * |
|
344 | + */ |
|
345 | + public function getLastAltitudeArchiveSpotterDataByIdent($ident) |
|
346 | + { |
|
347 | 347 | |
348 | - date_default_timezone_set('UTC'); |
|
348 | + date_default_timezone_set('UTC'); |
|
349 | 349 | |
350 | - $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
|
351 | - $query = "SELECT spotter_archive.altitude, spotter_archive.date FROM spotter_archive INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_archive l WHERE l.ident = :ident GROUP BY l.flightaware_id) s on spotter_archive.flightaware_id = s.flightaware_id AND spotter_archive.date = s.maxdate LIMIT 1"; |
|
350 | + $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
|
351 | + $query = "SELECT spotter_archive.altitude, spotter_archive.date FROM spotter_archive INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_archive l WHERE l.ident = :ident GROUP BY l.flightaware_id) s on spotter_archive.flightaware_id = s.flightaware_id AND spotter_archive.date = s.maxdate LIMIT 1"; |
|
352 | 352 | // $query = "SELECT spotter_archive.altitude, spotter_archive.date FROM spotter_archive WHERE spotter_archive.ident = :ident"; |
353 | 353 | |
354 | - try { |
|
355 | - $sth = $this->db->prepare($query); |
|
356 | - $sth->execute(array(':ident' => $ident)); |
|
357 | - } catch(PDOException $e) { |
|
358 | - echo $e->getMessage(); |
|
359 | - die; |
|
360 | - } |
|
361 | - $spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
354 | + try { |
|
355 | + $sth = $this->db->prepare($query); |
|
356 | + $sth->execute(array(':ident' => $ident)); |
|
357 | + } catch(PDOException $e) { |
|
358 | + echo $e->getMessage(); |
|
359 | + die; |
|
360 | + } |
|
361 | + $spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
362 | 362 | |
363 | - return $spotter_array; |
|
364 | - } |
|
363 | + return $spotter_array; |
|
364 | + } |
|
365 | 365 | |
366 | 366 | |
367 | 367 | |
368 | - /** |
|
369 | - * Gets all the archive spotter information |
|
370 | - * |
|
371 | - * @return Array the spotter information |
|
372 | - * |
|
373 | - */ |
|
374 | - public function getSpotterArchiveData($ident,$flightaware_id,$date) |
|
375 | - { |
|
376 | - $Spotter = new Spotter($this->db); |
|
377 | - $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
|
378 | - $query = "SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.ident = :ident AND l.flightaware_id = :flightaware_id AND l.date LIKE :date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate"; |
|
368 | + /** |
|
369 | + * Gets all the archive spotter information |
|
370 | + * |
|
371 | + * @return Array the spotter information |
|
372 | + * |
|
373 | + */ |
|
374 | + public function getSpotterArchiveData($ident,$flightaware_id,$date) |
|
375 | + { |
|
376 | + $Spotter = new Spotter($this->db); |
|
377 | + $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
|
378 | + $query = "SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.ident = :ident AND l.flightaware_id = :flightaware_id AND l.date LIKE :date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate"; |
|
379 | 379 | |
380 | - $spotter_array = $Spotter->getDataFromDB($query,array(':ident' => $ident,':flightaware_id' => $flightaware_id,':date' => $date.'%')); |
|
380 | + $spotter_array = $Spotter->getDataFromDB($query,array(':ident' => $ident,':flightaware_id' => $flightaware_id,':date' => $date.'%')); |
|
381 | 381 | |
382 | - return $spotter_array; |
|
383 | - } |
|
382 | + return $spotter_array; |
|
383 | + } |
|
384 | 384 | |
385 | - public function deleteSpotterArchiveTrackData() |
|
386 | - { |
|
385 | + public function deleteSpotterArchiveTrackData() |
|
386 | + { |
|
387 | 387 | global $globalArchiveKeepTrackMonths, $globalDBdriver; |
388 | 388 | if ($globalDBdriver == 'mysql') { |
389 | 389 | $query = 'DELETE FROM spotter_archive WHERE spotter_archive.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$globalArchiveKeepTrackMonths.' MONTH)'; |
390 | 390 | } else { |
391 | 391 | $query = "DELETE FROM spotter_archive WHERE spotter_archive.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalArchiveKeepTrackMonths." MONTH'"; |
392 | 392 | } |
393 | - try { |
|
394 | - $sth = $this->db->prepare($query); |
|
395 | - $sth->execute(); |
|
396 | - } catch(PDOException $e) { |
|
397 | - echo $e->getMessage(); |
|
398 | - die; |
|
399 | - } |
|
393 | + try { |
|
394 | + $sth = $this->db->prepare($query); |
|
395 | + $sth->execute(); |
|
396 | + } catch(PDOException $e) { |
|
397 | + echo $e->getMessage(); |
|
398 | + die; |
|
399 | + } |
|
400 | 400 | } |
401 | 401 | |
402 | 402 | /** |
403 | - * Gets Minimal Live Spotter data |
|
404 | - * |
|
405 | - * @return Array the spotter information |
|
406 | - * |
|
407 | - */ |
|
408 | - public function getMinLiveSpotterData($begindate,$enddate,$filter = array()) |
|
409 | - { |
|
410 | - global $globalDBdriver, $globalLiveInterval; |
|
411 | - date_default_timezone_set('UTC'); |
|
412 | - |
|
413 | - $filter_query = ''; |
|
414 | - if (isset($filter['source']) && !empty($filter['source'])) { |
|
415 | - $filter_query .= " AND format_source IN ('".implode("','",$filter['source'])."') "; |
|
416 | - } |
|
417 | - // Use spotter_output also ? |
|
418 | - if (isset($filter['airlines']) && !empty($filter['airlines'])) { |
|
419 | - $filter_query .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.airline_icao IN ('".implode("','",$filter['airlines'])."')) so ON so.flightaware_id = spotter_archive.flightaware_id "; |
|
420 | - } |
|
421 | - if (isset($filter['airlinestype']) && !empty($filter['airlinestype'])) { |
|
422 | - $filter_query .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.airline_type = '".$filter['airlinestype']."') sa ON sa.flightaware_id = spotter_archive.flightaware_id "; |
|
423 | - } |
|
424 | - if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) { |
|
425 | - $filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')"; |
|
426 | - } |
|
427 | - |
|
428 | - //if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
|
429 | - if ($globalDBdriver == 'mysql') { |
|
430 | - /* |
|
403 | + * Gets Minimal Live Spotter data |
|
404 | + * |
|
405 | + * @return Array the spotter information |
|
406 | + * |
|
407 | + */ |
|
408 | + public function getMinLiveSpotterData($begindate,$enddate,$filter = array()) |
|
409 | + { |
|
410 | + global $globalDBdriver, $globalLiveInterval; |
|
411 | + date_default_timezone_set('UTC'); |
|
412 | + |
|
413 | + $filter_query = ''; |
|
414 | + if (isset($filter['source']) && !empty($filter['source'])) { |
|
415 | + $filter_query .= " AND format_source IN ('".implode("','",$filter['source'])."') "; |
|
416 | + } |
|
417 | + // Use spotter_output also ? |
|
418 | + if (isset($filter['airlines']) && !empty($filter['airlines'])) { |
|
419 | + $filter_query .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.airline_icao IN ('".implode("','",$filter['airlines'])."')) so ON so.flightaware_id = spotter_archive.flightaware_id "; |
|
420 | + } |
|
421 | + if (isset($filter['airlinestype']) && !empty($filter['airlinestype'])) { |
|
422 | + $filter_query .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.airline_type = '".$filter['airlinestype']."') sa ON sa.flightaware_id = spotter_archive.flightaware_id "; |
|
423 | + } |
|
424 | + if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) { |
|
425 | + $filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')"; |
|
426 | + } |
|
427 | + |
|
428 | + //if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
|
429 | + if ($globalDBdriver == 'mysql') { |
|
430 | + /* |
|
431 | 431 | $query = 'SELECT a.aircraft_shadow, 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 |
432 | 432 | FROM spotter_archive |
433 | 433 | INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_archive l WHERE (l.date BETWEEN '."'".$begindate."'".' AND '."'".$enddate."'".') GROUP BY l.flightaware_id) s on spotter_archive.flightaware_id = s.flightaware_id AND spotter_archive.date = s.maxdate '.$filter_query.'LEFT JOIN (SELECT aircraft_shadow,icao FROM aircraft) a ON spotter_archive.aircraft_icao = a.icao'; |
@@ -446,56 +446,56 @@ discard block |
||
446 | 446 | INNER JOIN (SELECT * FROM aircraft) a on spotter_archive.aircraft_icao = a.icao |
447 | 447 | WHERE spotter_archive.date BETWEEN '."'".$begindate."'".' AND '."'".$begindate."'".' |
448 | 448 | '.$filter_query.' ORDER BY flightaware_id'; |
449 | - } else { |
|
450 | - //$query = '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, a.aircraft_shadow FROM spotter_archive INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_archive l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.flightaware_id) s on spotter_archive.flightaware_id = s.flightaware_id AND spotter_archive.date = s.maxdate '.$filter_query.'INNER JOIN (SELECT * FROM aircraft) a on spotter_archive.aircraft_icao = a.icao'; |
|
451 | - $query = 'SELECT spotter_archive.date,spotter_archive.flightaware_id, spotter_archive.ident, spotter_archive.aircraft_icao, spotter_archive.departure_airport_icao as departure_airport, spotter_archive.arrival_airport_icao as arrival_airport, spotter_archive.latitude, spotter_archive.longitude, spotter_archive.altitude, spotter_archive.heading, spotter_archive.ground_speed, spotter_archive.squawk, a.aircraft_shadow,a.engine_type, a.engine_count, a.wake_category |
|
449 | + } else { |
|
450 | + //$query = '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, a.aircraft_shadow FROM spotter_archive INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_archive l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.flightaware_id) s on spotter_archive.flightaware_id = s.flightaware_id AND spotter_archive.date = s.maxdate '.$filter_query.'INNER JOIN (SELECT * FROM aircraft) a on spotter_archive.aircraft_icao = a.icao'; |
|
451 | + $query = 'SELECT spotter_archive.date,spotter_archive.flightaware_id, spotter_archive.ident, spotter_archive.aircraft_icao, spotter_archive.departure_airport_icao as departure_airport, spotter_archive.arrival_airport_icao as arrival_airport, spotter_archive.latitude, spotter_archive.longitude, spotter_archive.altitude, spotter_archive.heading, spotter_archive.ground_speed, spotter_archive.squawk, a.aircraft_shadow,a.engine_type, a.engine_count, a.wake_category |
|
452 | 452 | FROM spotter_archive |
453 | 453 | INNER JOIN (SELECT * FROM aircraft) a on spotter_archive.aircraft_icao = a.icao |
454 | 454 | WHERE spotter_archive.date >= '."'".$begindate."'".' AND spotter_archive.date <= '."'".$enddate."'".' |
455 | 455 | '.$filter_query.' ORDER BY flightaware_id'; |
456 | - } |
|
457 | - //echo $query; |
|
458 | - try { |
|
459 | - $sth = $this->db->prepare($query); |
|
460 | - $sth->execute(); |
|
461 | - } catch(PDOException $e) { |
|
462 | - echo $e->getMessage(); |
|
463 | - die; |
|
464 | - } |
|
465 | - $spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
466 | - |
|
467 | - return $spotter_array; |
|
468 | - } |
|
456 | + } |
|
457 | + //echo $query; |
|
458 | + try { |
|
459 | + $sth = $this->db->prepare($query); |
|
460 | + $sth->execute(); |
|
461 | + } catch(PDOException $e) { |
|
462 | + echo $e->getMessage(); |
|
463 | + die; |
|
464 | + } |
|
465 | + $spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
466 | + |
|
467 | + return $spotter_array; |
|
468 | + } |
|
469 | 469 | |
470 | 470 | /** |
471 | - * Gets Minimal Live Spotter data |
|
472 | - * |
|
473 | - * @return Array the spotter information |
|
474 | - * |
|
475 | - */ |
|
476 | - public function getMinLiveSpotterDataPlayback($begindate,$enddate,$filter = array()) |
|
477 | - { |
|
478 | - global $globalDBdriver, $globalLiveInterval; |
|
479 | - date_default_timezone_set('UTC'); |
|
480 | - |
|
481 | - $filter_query = ''; |
|
482 | - if (isset($filter['source']) && !empty($filter['source'])) { |
|
483 | - $filter_query .= " AND format_source IN ('".implode("','",$filter['source'])."') "; |
|
484 | - } |
|
485 | - // Should use spotter_output also ? |
|
486 | - if (isset($filter['airlines']) && !empty($filter['airlines'])) { |
|
487 | - $filter_query .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.airline_icao IN ('".implode("','",$filter['airlines'])."')) so ON so.flightaware_id = spotter_archive.flightaware_id "; |
|
488 | - } |
|
489 | - if (isset($filter['airlinestype']) && !empty($filter['airlinestype'])) { |
|
490 | - $filter_query .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.airline_type = '".$filter['airlinestype']."') sa ON sa.flightaware_id = spotter_archive.flightaware_id "; |
|
491 | - } |
|
492 | - if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) { |
|
493 | - $filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')"; |
|
494 | - } |
|
495 | - |
|
496 | - //if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
|
497 | - if ($globalDBdriver == 'mysql') { |
|
498 | - /* |
|
471 | + * Gets Minimal Live Spotter data |
|
472 | + * |
|
473 | + * @return Array the spotter information |
|
474 | + * |
|
475 | + */ |
|
476 | + public function getMinLiveSpotterDataPlayback($begindate,$enddate,$filter = array()) |
|
477 | + { |
|
478 | + global $globalDBdriver, $globalLiveInterval; |
|
479 | + date_default_timezone_set('UTC'); |
|
480 | + |
|
481 | + $filter_query = ''; |
|
482 | + if (isset($filter['source']) && !empty($filter['source'])) { |
|
483 | + $filter_query .= " AND format_source IN ('".implode("','",$filter['source'])."') "; |
|
484 | + } |
|
485 | + // Should use spotter_output also ? |
|
486 | + if (isset($filter['airlines']) && !empty($filter['airlines'])) { |
|
487 | + $filter_query .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.airline_icao IN ('".implode("','",$filter['airlines'])."')) so ON so.flightaware_id = spotter_archive.flightaware_id "; |
|
488 | + } |
|
489 | + if (isset($filter['airlinestype']) && !empty($filter['airlinestype'])) { |
|
490 | + $filter_query .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.airline_type = '".$filter['airlinestype']."') sa ON sa.flightaware_id = spotter_archive.flightaware_id "; |
|
491 | + } |
|
492 | + if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) { |
|
493 | + $filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')"; |
|
494 | + } |
|
495 | + |
|
496 | + //if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
|
497 | + if ($globalDBdriver == 'mysql') { |
|
498 | + /* |
|
499 | 499 | $query = 'SELECT a.aircraft_shadow, 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 |
500 | 500 | FROM spotter_archive |
501 | 501 | INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_archive l WHERE (l.date BETWEEN '."'".$begindate."'".' AND '."'".$enddate."'".') GROUP BY l.flightaware_id) s on spotter_archive.flightaware_id = s.flightaware_id AND spotter_archive.date = s.maxdate '.$filter_query.'LEFT JOIN (SELECT aircraft_shadow,icao FROM aircraft) a ON spotter_archive.aircraft_icao = a.icao'; |
@@ -506,95 +506,95 @@ discard block |
||
506 | 506 | WHERE (spotter_archive_output.date BETWEEN '."'".$begindate."'".' AND '."'".$enddate."'".') |
507 | 507 | '.$filter_query.' GROUP BY spotter_archive_output.flightaware_id, spotter_archive_output.ident, spotter_archive_output.aircraft_icao, spotter_archive_output.departure_airport_icao, spotter_archive_output.arrival_airport_icao, spotter_archive_output.latitude, spotter_archive_output.longitude, spotter_archive_output.altitude, spotter_archive_output.heading, spotter_archive_output.ground_speed, spotter_archive_output.squawk, a.aircraft_shadow'; |
508 | 508 | |
509 | - } else { |
|
510 | - //$query = 'SELECT spotter_archive_output.ident, spotter_archive_output.flightaware_id, spotter_archive_output.aircraft_icao, spotter_archive_output.departure_airport_icao as departure_airport, spotter_archive_output.arrival_airport_icao as arrival_airport, spotter_archive_output.latitude, spotter_archive_output.longitude, spotter_archive_output.altitude, spotter_archive_output.heading, spotter_archive_output.ground_speed, spotter_archive_output.squawk, a.aircraft_shadow FROM spotter_archive_output INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_archive_output l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.flightaware_id) s on spotter_archive_output.flightaware_id = s.flightaware_id AND spotter_archive_output.date = s.maxdate '.$filter_query.'INNER JOIN (SELECT * FROM aircraft) a on spotter_archive_output.aircraft_icao = a.icao'; |
|
511 | - /* |
|
509 | + } else { |
|
510 | + //$query = 'SELECT spotter_archive_output.ident, spotter_archive_output.flightaware_id, spotter_archive_output.aircraft_icao, spotter_archive_output.departure_airport_icao as departure_airport, spotter_archive_output.arrival_airport_icao as arrival_airport, spotter_archive_output.latitude, spotter_archive_output.longitude, spotter_archive_output.altitude, spotter_archive_output.heading, spotter_archive_output.ground_speed, spotter_archive_output.squawk, a.aircraft_shadow FROM spotter_archive_output INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_archive_output l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.flightaware_id) s on spotter_archive_output.flightaware_id = s.flightaware_id AND spotter_archive_output.date = s.maxdate '.$filter_query.'INNER JOIN (SELECT * FROM aircraft) a on spotter_archive_output.aircraft_icao = a.icao'; |
|
511 | + /* |
|
512 | 512 | $query = 'SELECT spotter_archive_output.ident, spotter_archive_output.flightaware_id, spotter_archive_output.aircraft_icao, spotter_archive_output.departure_airport_icao as departure_airport, spotter_archive_output.arrival_airport_icao as arrival_airport, spotter_archive_output.latitude, spotter_archive_output.longitude, spotter_archive_output.altitude, spotter_archive_output.heading, spotter_archive_output.ground_speed, spotter_archive_output.squawk, a.aircraft_shadow |
513 | 513 | FROM spotter_archive_output |
514 | 514 | INNER JOIN (SELECT * FROM aircraft) a on spotter_archive_output.aircraft_icao = a.icao |
515 | 515 | WHERE spotter_archive_output.date >= '."'".$begindate."'".' AND spotter_archive_output.date <= '."'".$enddate."'".' |
516 | 516 | '.$filter_query.' GROUP BY spotter_archive_output.flightaware_id, spotter_archive_output.ident, spotter_archive_output.aircraft_icao, spotter_archive_output.departure_airport_icao, spotter_archive_output.arrival_airport_icao, spotter_archive_output.latitude, spotter_archive_output.longitude, spotter_archive_output.altitude, spotter_archive_output.heading, spotter_archive_output.ground_speed, spotter_archive_output.squawk, a.aircraft_shadow'; |
517 | 517 | */ |
518 | - $query = 'SELECT DISTINCT spotter_archive_output.flightaware_id, spotter_archive_output.ident, spotter_archive_output.aircraft_icao, spotter_archive_output.departure_airport_icao as departure_airport, spotter_archive_output.arrival_airport_icao as arrival_airport, spotter_archive_output.latitude, spotter_archive_output.longitude, spotter_archive_output.altitude, spotter_archive_output.heading, spotter_archive_output.ground_speed, spotter_archive_output.squawk, a.aircraft_shadow |
|
518 | + $query = 'SELECT DISTINCT spotter_archive_output.flightaware_id, spotter_archive_output.ident, spotter_archive_output.aircraft_icao, spotter_archive_output.departure_airport_icao as departure_airport, spotter_archive_output.arrival_airport_icao as arrival_airport, spotter_archive_output.latitude, spotter_archive_output.longitude, spotter_archive_output.altitude, spotter_archive_output.heading, spotter_archive_output.ground_speed, spotter_archive_output.squawk, a.aircraft_shadow |
|
519 | 519 | FROM spotter_archive_output |
520 | 520 | INNER JOIN (SELECT * FROM aircraft) a on spotter_archive_output.aircraft_icao = a.icao |
521 | 521 | WHERE spotter_archive_output.date >= '."'".$begindate."'".' AND spotter_archive_output.date <= '."'".$enddate."'".' |
522 | 522 | '.$filter_query.' LIMIT 200 OFFSET 0'; |
523 | 523 | // .' GROUP BY spotter_output.flightaware_id, spotter_output.ident, spotter_output.aircraft_icao, spotter_output.departure_airport_icao, spotter_output.arrival_airport_icao, spotter_output.latitude, spotter_output.longitude, spotter_output.altitude, spotter_output.heading, spotter_output.ground_speed, spotter_output.squawk, a.aircraft_shadow'; |
524 | 524 | |
525 | - } |
|
526 | - //echo $query; |
|
527 | - try { |
|
528 | - $sth = $this->db->prepare($query); |
|
529 | - $sth->execute(); |
|
530 | - } catch(PDOException $e) { |
|
531 | - echo $e->getMessage(); |
|
532 | - die; |
|
533 | - } |
|
534 | - $spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
535 | - |
|
536 | - return $spotter_array; |
|
537 | - } |
|
525 | + } |
|
526 | + //echo $query; |
|
527 | + try { |
|
528 | + $sth = $this->db->prepare($query); |
|
529 | + $sth->execute(); |
|
530 | + } catch(PDOException $e) { |
|
531 | + echo $e->getMessage(); |
|
532 | + die; |
|
533 | + } |
|
534 | + $spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
535 | + |
|
536 | + return $spotter_array; |
|
537 | + } |
|
538 | 538 | |
539 | 539 | /** |
540 | - * Gets count Live Spotter data |
|
541 | - * |
|
542 | - * @return Array the spotter information |
|
543 | - * |
|
544 | - */ |
|
545 | - public function getLiveSpotterCount($begindate,$enddate,$filter = array()) |
|
546 | - { |
|
547 | - global $globalDBdriver, $globalLiveInterval; |
|
548 | - date_default_timezone_set('UTC'); |
|
549 | - |
|
550 | - $filter_query = ''; |
|
551 | - if (isset($filter['source']) && !empty($filter['source'])) { |
|
552 | - $filter_query .= " AND format_source IN ('".implode("','",$filter['source'])."') "; |
|
553 | - } |
|
554 | - if (isset($filter['airlines']) && !empty($filter['airlines'])) { |
|
555 | - $filter_query .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','",$filter['airlines'])."')) so ON so.flightaware_id = spotter_archive.flightaware_id "; |
|
556 | - } |
|
557 | - if (isset($filter['airlinestype']) && !empty($filter['airlinestype'])) { |
|
558 | - $filter_query .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_type = '".$filter['airlinestype']."') sa ON sa.flightaware_id = spotter_archive.flightaware_id "; |
|
559 | - } |
|
560 | - if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) { |
|
561 | - $filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')"; |
|
562 | - } |
|
563 | - |
|
564 | - //if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
|
565 | - if ($globalDBdriver == 'mysql') { |
|
540 | + * Gets count Live Spotter data |
|
541 | + * |
|
542 | + * @return Array the spotter information |
|
543 | + * |
|
544 | + */ |
|
545 | + public function getLiveSpotterCount($begindate,$enddate,$filter = array()) |
|
546 | + { |
|
547 | + global $globalDBdriver, $globalLiveInterval; |
|
548 | + date_default_timezone_set('UTC'); |
|
549 | + |
|
550 | + $filter_query = ''; |
|
551 | + if (isset($filter['source']) && !empty($filter['source'])) { |
|
552 | + $filter_query .= " AND format_source IN ('".implode("','",$filter['source'])."') "; |
|
553 | + } |
|
554 | + if (isset($filter['airlines']) && !empty($filter['airlines'])) { |
|
555 | + $filter_query .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','",$filter['airlines'])."')) so ON so.flightaware_id = spotter_archive.flightaware_id "; |
|
556 | + } |
|
557 | + if (isset($filter['airlinestype']) && !empty($filter['airlinestype'])) { |
|
558 | + $filter_query .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_type = '".$filter['airlinestype']."') sa ON sa.flightaware_id = spotter_archive.flightaware_id "; |
|
559 | + } |
|
560 | + if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) { |
|
561 | + $filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')"; |
|
562 | + } |
|
563 | + |
|
564 | + //if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
|
565 | + if ($globalDBdriver == 'mysql') { |
|
566 | 566 | $query = 'SELECT COUNT(DISTINCT flightaware_id) as nb |
567 | 567 | FROM spotter_archive l |
568 | 568 | WHERE (l.date BETWEEN DATE_SUB('."'".$begindate."'".',INTERVAL '.$globalLiveInterval.' SECOND) AND '."'".$begindate."'".')'.$filter_query; |
569 | - } else { |
|
569 | + } else { |
|
570 | 570 | $query = 'SELECT COUNT(DISTINCT flightaware_id) as nb FROM spotter_archive l WHERE (l.date BETWEEN '."'".$begindate."' - INTERVAL '".$globalLiveInterval." SECONDS' AND "."'".$enddate."'".')'.$filter_query; |
571 | - } |
|
572 | - //echo $query; |
|
573 | - try { |
|
574 | - $sth = $this->db->prepare($query); |
|
575 | - $sth->execute(); |
|
576 | - } catch(PDOException $e) { |
|
577 | - echo $e->getMessage(); |
|
578 | - die; |
|
579 | - } |
|
571 | + } |
|
572 | + //echo $query; |
|
573 | + try { |
|
574 | + $sth = $this->db->prepare($query); |
|
575 | + $sth->execute(); |
|
576 | + } catch(PDOException $e) { |
|
577 | + echo $e->getMessage(); |
|
578 | + die; |
|
579 | + } |
|
580 | 580 | $result = $sth->fetch(PDO::FETCH_ASSOC); |
581 | 581 | $sth->closeCursor(); |
582 | - return $result['nb']; |
|
582 | + return $result['nb']; |
|
583 | 583 | |
584 | - } |
|
584 | + } |
|
585 | 585 | |
586 | 586 | |
587 | 587 | |
588 | 588 | // Spotter_Archive_output |
589 | 589 | |
590 | - /** |
|
591 | - * Gets all the spotter information |
|
592 | - * |
|
593 | - * @return Array the spotter information |
|
594 | - * |
|
595 | - */ |
|
596 | - public function searchSpotterData($q = '', $registration = '', $aircraft_icao = '', $aircraft_manufacturer = '', $highlights = '', $airline_icao = '', $airline_country = '', $airline_type = '', $airport = '', $airport_country = '', $callsign = '', $departure_airport_route = '', $arrival_airport_route = '', $owner = '',$pilot_id = '',$pilot_name = '',$altitude = '', $date_posted = '', $limit = '', $sort = '', $includegeodata = '',$origLat = '',$origLon = '',$dist = '', $filters=array()) |
|
597 | - { |
|
590 | + /** |
|
591 | + * Gets all the spotter information |
|
592 | + * |
|
593 | + * @return Array the spotter information |
|
594 | + * |
|
595 | + */ |
|
596 | + public function searchSpotterData($q = '', $registration = '', $aircraft_icao = '', $aircraft_manufacturer = '', $highlights = '', $airline_icao = '', $airline_country = '', $airline_type = '', $airport = '', $airport_country = '', $callsign = '', $departure_airport_route = '', $arrival_airport_route = '', $owner = '',$pilot_id = '',$pilot_name = '',$altitude = '', $date_posted = '', $limit = '', $sort = '', $includegeodata = '',$origLat = '',$origLon = '',$dist = '', $filters=array()) |
|
597 | + { |
|
598 | 598 | global $globalTimezone, $globalDBdriver; |
599 | 599 | require_once(dirname(__FILE__).'/class.Translation.php'); |
600 | 600 | $Translation = new Translation(); |
@@ -608,159 +608,159 @@ discard block |
||
608 | 608 | $filter_query = $this->getFilter($filters); |
609 | 609 | if ($q != "") |
610 | 610 | { |
611 | - if (!is_string($q)) |
|
612 | - { |
|
611 | + if (!is_string($q)) |
|
612 | + { |
|
613 | 613 | return false; |
614 | - } else { |
|
614 | + } else { |
|
615 | 615 | |
616 | 616 | $q_array = explode(" ", $q); |
617 | 617 | |
618 | 618 | foreach ($q_array as $q_item){ |
619 | - $additional_query .= " AND ("; |
|
620 | - $additional_query .= "(spotter_archive_output.spotter_id like '%".$q_item."%') OR "; |
|
621 | - $additional_query .= "(spotter_archive_output.aircraft_icao like '%".$q_item."%') OR "; |
|
622 | - $additional_query .= "(spotter_archive_output.aircraft_name like '%".$q_item."%') OR "; |
|
623 | - $additional_query .= "(spotter_archive_output.aircraft_manufacturer like '%".$q_item."%') OR "; |
|
624 | - $additional_query .= "(spotter_archive_output.airline_icao like '%".$q_item."%') OR "; |
|
625 | - $additional_query .= "(spotter_archive_output.airline_name like '%".$q_item."%') OR "; |
|
626 | - $additional_query .= "(spotter_archive_output.airline_country like '%".$q_item."%') OR "; |
|
627 | - $additional_query .= "(spotter_archive_output.departure_airport_icao like '%".$q_item."%') OR "; |
|
628 | - $additional_query .= "(spotter_archive_output.departure_airport_name like '%".$q_item."%') OR "; |
|
629 | - $additional_query .= "(spotter_archive_output.departure_airport_city like '%".$q_item."%') OR "; |
|
630 | - $additional_query .= "(spotter_archive_output.departure_airport_country like '%".$q_item."%') OR "; |
|
631 | - $additional_query .= "(spotter_archive_output.arrival_airport_icao like '%".$q_item."%') OR "; |
|
632 | - $additional_query .= "(spotter_archive_output.arrival_airport_name like '%".$q_item."%') OR "; |
|
633 | - $additional_query .= "(spotter_archive_output.arrival_airport_city like '%".$q_item."%') OR "; |
|
634 | - $additional_query .= "(spotter_archive_output.arrival_airport_country like '%".$q_item."%') OR "; |
|
635 | - $additional_query .= "(spotter_archive_output.registration like '%".$q_item."%') OR "; |
|
636 | - $additional_query .= "(spotter_archive_output.owner_name like '%".$q_item."%') OR "; |
|
637 | - $additional_query .= "(spotter_archive_output.pilot_id like '%".$q_item."%') OR "; |
|
638 | - $additional_query .= "(spotter_archive_output.pilot_name like '%".$q_item."%') OR "; |
|
639 | - $additional_query .= "(spotter_archive_output.ident like '%".$q_item."%') OR "; |
|
640 | - $translate = $Translation->ident2icao($q_item); |
|
641 | - if ($translate != $q_item) $additional_query .= "(spotter_archive_output.ident like '%".$translate."%') OR "; |
|
642 | - $additional_query .= "(spotter_archive_output.highlight like '%".$q_item."%')"; |
|
643 | - $additional_query .= ")"; |
|
644 | - } |
|
645 | - } |
|
619 | + $additional_query .= " AND ("; |
|
620 | + $additional_query .= "(spotter_archive_output.spotter_id like '%".$q_item."%') OR "; |
|
621 | + $additional_query .= "(spotter_archive_output.aircraft_icao like '%".$q_item."%') OR "; |
|
622 | + $additional_query .= "(spotter_archive_output.aircraft_name like '%".$q_item."%') OR "; |
|
623 | + $additional_query .= "(spotter_archive_output.aircraft_manufacturer like '%".$q_item."%') OR "; |
|
624 | + $additional_query .= "(spotter_archive_output.airline_icao like '%".$q_item."%') OR "; |
|
625 | + $additional_query .= "(spotter_archive_output.airline_name like '%".$q_item."%') OR "; |
|
626 | + $additional_query .= "(spotter_archive_output.airline_country like '%".$q_item."%') OR "; |
|
627 | + $additional_query .= "(spotter_archive_output.departure_airport_icao like '%".$q_item."%') OR "; |
|
628 | + $additional_query .= "(spotter_archive_output.departure_airport_name like '%".$q_item."%') OR "; |
|
629 | + $additional_query .= "(spotter_archive_output.departure_airport_city like '%".$q_item."%') OR "; |
|
630 | + $additional_query .= "(spotter_archive_output.departure_airport_country like '%".$q_item."%') OR "; |
|
631 | + $additional_query .= "(spotter_archive_output.arrival_airport_icao like '%".$q_item."%') OR "; |
|
632 | + $additional_query .= "(spotter_archive_output.arrival_airport_name like '%".$q_item."%') OR "; |
|
633 | + $additional_query .= "(spotter_archive_output.arrival_airport_city like '%".$q_item."%') OR "; |
|
634 | + $additional_query .= "(spotter_archive_output.arrival_airport_country like '%".$q_item."%') OR "; |
|
635 | + $additional_query .= "(spotter_archive_output.registration like '%".$q_item."%') OR "; |
|
636 | + $additional_query .= "(spotter_archive_output.owner_name like '%".$q_item."%') OR "; |
|
637 | + $additional_query .= "(spotter_archive_output.pilot_id like '%".$q_item."%') OR "; |
|
638 | + $additional_query .= "(spotter_archive_output.pilot_name like '%".$q_item."%') OR "; |
|
639 | + $additional_query .= "(spotter_archive_output.ident like '%".$q_item."%') OR "; |
|
640 | + $translate = $Translation->ident2icao($q_item); |
|
641 | + if ($translate != $q_item) $additional_query .= "(spotter_archive_output.ident like '%".$translate."%') OR "; |
|
642 | + $additional_query .= "(spotter_archive_output.highlight like '%".$q_item."%')"; |
|
643 | + $additional_query .= ")"; |
|
644 | + } |
|
645 | + } |
|
646 | 646 | } |
647 | 647 | |
648 | 648 | if ($registration != "") |
649 | 649 | { |
650 | - $registration = filter_var($registration,FILTER_SANITIZE_STRING); |
|
651 | - if (!is_string($registration)) |
|
652 | - { |
|
650 | + $registration = filter_var($registration,FILTER_SANITIZE_STRING); |
|
651 | + if (!is_string($registration)) |
|
652 | + { |
|
653 | 653 | return false; |
654 | - } else { |
|
654 | + } else { |
|
655 | 655 | $additional_query .= " AND (spotter_archive_output.registration = '".$registration."')"; |
656 | - } |
|
656 | + } |
|
657 | 657 | } |
658 | 658 | |
659 | 659 | if ($aircraft_icao != "") |
660 | 660 | { |
661 | - $aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING); |
|
662 | - if (!is_string($aircraft_icao)) |
|
663 | - { |
|
661 | + $aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING); |
|
662 | + if (!is_string($aircraft_icao)) |
|
663 | + { |
|
664 | 664 | return false; |
665 | - } else { |
|
665 | + } else { |
|
666 | 666 | $additional_query .= " AND (spotter_archive_output.aircraft_icao = '".$aircraft_icao."')"; |
667 | - } |
|
667 | + } |
|
668 | 668 | } |
669 | 669 | |
670 | 670 | if ($aircraft_manufacturer != "") |
671 | 671 | { |
672 | - $aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING); |
|
673 | - if (!is_string($aircraft_manufacturer)) |
|
674 | - { |
|
672 | + $aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING); |
|
673 | + if (!is_string($aircraft_manufacturer)) |
|
674 | + { |
|
675 | 675 | return false; |
676 | - } else { |
|
676 | + } else { |
|
677 | 677 | $additional_query .= " AND (spotter_archive_output.aircraft_manufacturer = '".$aircraft_manufacturer."')"; |
678 | - } |
|
678 | + } |
|
679 | 679 | } |
680 | 680 | |
681 | 681 | if ($highlights == "true") |
682 | 682 | { |
683 | - if (!is_string($highlights)) |
|
684 | - { |
|
683 | + if (!is_string($highlights)) |
|
684 | + { |
|
685 | 685 | return false; |
686 | - } else { |
|
686 | + } else { |
|
687 | 687 | $additional_query .= " AND (spotter_archive_output.highlight <> '')"; |
688 | - } |
|
688 | + } |
|
689 | 689 | } |
690 | 690 | |
691 | 691 | if ($airline_icao != "") |
692 | 692 | { |
693 | - $airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING); |
|
694 | - if (!is_string($airline_icao)) |
|
695 | - { |
|
693 | + $airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING); |
|
694 | + if (!is_string($airline_icao)) |
|
695 | + { |
|
696 | 696 | return false; |
697 | - } else { |
|
697 | + } else { |
|
698 | 698 | $additional_query .= " AND (spotter_archive_output.airline_icao = '".$airline_icao."')"; |
699 | - } |
|
699 | + } |
|
700 | 700 | } |
701 | 701 | |
702 | 702 | if ($airline_country != "") |
703 | 703 | { |
704 | - $airline_country = filter_var($airline_country,FILTER_SANITIZE_STRING); |
|
705 | - if (!is_string($airline_country)) |
|
706 | - { |
|
704 | + $airline_country = filter_var($airline_country,FILTER_SANITIZE_STRING); |
|
705 | + if (!is_string($airline_country)) |
|
706 | + { |
|
707 | 707 | return false; |
708 | - } else { |
|
708 | + } else { |
|
709 | 709 | $additional_query .= " AND (spotter_archive_output.airline_country = '".$airline_country."')"; |
710 | - } |
|
710 | + } |
|
711 | 711 | } |
712 | 712 | |
713 | 713 | if ($airline_type != "") |
714 | 714 | { |
715 | - $airline_type = filter_var($airline_type,FILTER_SANITIZE_STRING); |
|
716 | - if (!is_string($airline_type)) |
|
717 | - { |
|
715 | + $airline_type = filter_var($airline_type,FILTER_SANITIZE_STRING); |
|
716 | + if (!is_string($airline_type)) |
|
717 | + { |
|
718 | 718 | return false; |
719 | - } else { |
|
719 | + } else { |
|
720 | 720 | if ($airline_type == "passenger") |
721 | 721 | { |
722 | - $additional_query .= " AND (spotter_archive_output.airline_type = 'passenger')"; |
|
722 | + $additional_query .= " AND (spotter_archive_output.airline_type = 'passenger')"; |
|
723 | 723 | } |
724 | 724 | if ($airline_type == "cargo") |
725 | 725 | { |
726 | - $additional_query .= " AND (spotter_archive_output.airline_type = 'cargo')"; |
|
726 | + $additional_query .= " AND (spotter_archive_output.airline_type = 'cargo')"; |
|
727 | 727 | } |
728 | 728 | if ($airline_type == "military") |
729 | 729 | { |
730 | - $additional_query .= " AND (spotter_archive_output.airline_type = 'military')"; |
|
730 | + $additional_query .= " AND (spotter_archive_output.airline_type = 'military')"; |
|
731 | + } |
|
731 | 732 | } |
732 | - } |
|
733 | 733 | } |
734 | 734 | |
735 | 735 | if ($airport != "") |
736 | 736 | { |
737 | - $airport = filter_var($airport,FILTER_SANITIZE_STRING); |
|
738 | - if (!is_string($airport)) |
|
739 | - { |
|
737 | + $airport = filter_var($airport,FILTER_SANITIZE_STRING); |
|
738 | + if (!is_string($airport)) |
|
739 | + { |
|
740 | 740 | return false; |
741 | - } else { |
|
741 | + } else { |
|
742 | 742 | $additional_query .= " AND ((spotter_archive_output.departure_airport_icao = '".$airport."') OR (spotter_archive_output.arrival_airport_icao = '".$airport."'))"; |
743 | - } |
|
743 | + } |
|
744 | 744 | } |
745 | 745 | |
746 | 746 | if ($airport_country != "") |
747 | 747 | { |
748 | - $airport_country = filter_var($airport_country,FILTER_SANITIZE_STRING); |
|
749 | - if (!is_string($airport_country)) |
|
750 | - { |
|
748 | + $airport_country = filter_var($airport_country,FILTER_SANITIZE_STRING); |
|
749 | + if (!is_string($airport_country)) |
|
750 | + { |
|
751 | 751 | return false; |
752 | - } else { |
|
752 | + } else { |
|
753 | 753 | $additional_query .= " AND ((spotter_archive_output.departure_airport_country = '".$airport_country."') OR (spotter_archive_output.arrival_airport_country = '".$airport_country."'))"; |
754 | - } |
|
754 | + } |
|
755 | 755 | } |
756 | 756 | |
757 | 757 | if ($callsign != "") |
758 | 758 | { |
759 | - $callsign = filter_var($callsign,FILTER_SANITIZE_STRING); |
|
760 | - if (!is_string($callsign)) |
|
761 | - { |
|
759 | + $callsign = filter_var($callsign,FILTER_SANITIZE_STRING); |
|
760 | + if (!is_string($callsign)) |
|
761 | + { |
|
762 | 762 | return false; |
763 | - } else { |
|
763 | + } else { |
|
764 | 764 | $translate = $Translation->ident2icao($callsign); |
765 | 765 | if ($translate != $callsign) { |
766 | 766 | $additional_query .= " AND (spotter_archive_output.ident = :callsign OR spotter_archive_output.ident = :translate)"; |
@@ -768,99 +768,99 @@ discard block |
||
768 | 768 | } else { |
769 | 769 | $additional_query .= " AND (spotter_archive_output.ident = '".$callsign."')"; |
770 | 770 | } |
771 | - } |
|
771 | + } |
|
772 | 772 | } |
773 | 773 | |
774 | 774 | if ($owner != "") |
775 | 775 | { |
776 | - $owner = filter_var($owner,FILTER_SANITIZE_STRING); |
|
777 | - if (!is_string($owner)) |
|
778 | - { |
|
776 | + $owner = filter_var($owner,FILTER_SANITIZE_STRING); |
|
777 | + if (!is_string($owner)) |
|
778 | + { |
|
779 | 779 | return false; |
780 | - } else { |
|
780 | + } else { |
|
781 | 781 | $additional_query .= " AND (spotter_archive_output.owner_name = '".$owner."')"; |
782 | - } |
|
782 | + } |
|
783 | 783 | } |
784 | 784 | |
785 | 785 | if ($pilot_name != "") |
786 | 786 | { |
787 | - $pilot_name = filter_var($pilot_name,FILTER_SANITIZE_STRING); |
|
788 | - if (!is_string($pilot_name)) |
|
789 | - { |
|
787 | + $pilot_name = filter_var($pilot_name,FILTER_SANITIZE_STRING); |
|
788 | + if (!is_string($pilot_name)) |
|
789 | + { |
|
790 | 790 | return false; |
791 | - } else { |
|
791 | + } else { |
|
792 | 792 | $additional_query .= " AND (spotter_archive_output.pilot_name = '".$pilot_name."')"; |
793 | - } |
|
793 | + } |
|
794 | 794 | } |
795 | 795 | |
796 | 796 | if ($pilot_id != "") |
797 | 797 | { |
798 | - $pilot_id = filter_var($pilot_id,FILTER_SANITIZE_NUMBER_INT); |
|
799 | - if (!is_string($pilot_id)) |
|
800 | - { |
|
798 | + $pilot_id = filter_var($pilot_id,FILTER_SANITIZE_NUMBER_INT); |
|
799 | + if (!is_string($pilot_id)) |
|
800 | + { |
|
801 | 801 | return false; |
802 | - } else { |
|
802 | + } else { |
|
803 | 803 | $additional_query .= " AND (spotter_archive_output.pilot_id = '".$pilot_id."')"; |
804 | - } |
|
804 | + } |
|
805 | 805 | } |
806 | 806 | |
807 | 807 | if ($departure_airport_route != "") |
808 | 808 | { |
809 | - $departure_airport_route = filter_var($departure_airport_route,FILTER_SANITIZE_STRING); |
|
810 | - if (!is_string($departure_airport_route)) |
|
811 | - { |
|
809 | + $departure_airport_route = filter_var($departure_airport_route,FILTER_SANITIZE_STRING); |
|
810 | + if (!is_string($departure_airport_route)) |
|
811 | + { |
|
812 | 812 | return false; |
813 | - } else { |
|
813 | + } else { |
|
814 | 814 | $additional_query .= " AND (spotter_archive_output.departure_airport_icao = '".$departure_airport_route."')"; |
815 | - } |
|
815 | + } |
|
816 | 816 | } |
817 | 817 | |
818 | 818 | if ($arrival_airport_route != "") |
819 | 819 | { |
820 | - $arrival_airport_route = filter_var($arrival_airport_route,FILTER_SANITIZE_STRING); |
|
821 | - if (!is_string($arrival_airport_route)) |
|
822 | - { |
|
820 | + $arrival_airport_route = filter_var($arrival_airport_route,FILTER_SANITIZE_STRING); |
|
821 | + if (!is_string($arrival_airport_route)) |
|
822 | + { |
|
823 | 823 | return false; |
824 | - } else { |
|
824 | + } else { |
|
825 | 825 | $additional_query .= " AND (spotter_archive_output.arrival_airport_icao = '".$arrival_airport_route."')"; |
826 | - } |
|
826 | + } |
|
827 | 827 | } |
828 | 828 | |
829 | 829 | if ($altitude != "") |
830 | 830 | { |
831 | - $altitude_array = explode(",", $altitude); |
|
831 | + $altitude_array = explode(",", $altitude); |
|
832 | 832 | |
833 | - $altitude_array[0] = filter_var($altitude_array[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
834 | - $altitude_array[1] = filter_var($altitude_array[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
833 | + $altitude_array[0] = filter_var($altitude_array[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
834 | + $altitude_array[1] = filter_var($altitude_array[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
835 | 835 | |
836 | 836 | |
837 | - if ($altitude_array[1] != "") |
|
838 | - { |
|
837 | + if ($altitude_array[1] != "") |
|
838 | + { |
|
839 | 839 | $altitude_array[0] = substr($altitude_array[0], 0, -2); |
840 | 840 | $altitude_array[1] = substr($altitude_array[1], 0, -2); |
841 | 841 | $additional_query .= " AND altitude BETWEEN '".$altitude_array[0]."' AND '".$altitude_array[1]."' "; |
842 | - } else { |
|
842 | + } else { |
|
843 | 843 | $altitude_array[0] = substr($altitude_array[0], 0, -2); |
844 | 844 | $additional_query .= " AND altitude <= '".$altitude_array[0]."' "; |
845 | - } |
|
845 | + } |
|
846 | 846 | } |
847 | 847 | |
848 | 848 | if ($date_posted != "") |
849 | 849 | { |
850 | - $date_array = explode(",", $date_posted); |
|
850 | + $date_array = explode(",", $date_posted); |
|
851 | 851 | |
852 | - $date_array[0] = filter_var($date_array[0],FILTER_SANITIZE_STRING); |
|
853 | - $date_array[1] = filter_var($date_array[1],FILTER_SANITIZE_STRING); |
|
852 | + $date_array[0] = filter_var($date_array[0],FILTER_SANITIZE_STRING); |
|
853 | + $date_array[1] = filter_var($date_array[1],FILTER_SANITIZE_STRING); |
|
854 | 854 | |
855 | - if ($globalTimezone != '') { |
|
855 | + if ($globalTimezone != '') { |
|
856 | 856 | date_default_timezone_set($globalTimezone); |
857 | 857 | $datetime = new DateTime(); |
858 | 858 | $offset = $datetime->format('P'); |
859 | - } else $offset = '+00:00'; |
|
859 | + } else $offset = '+00:00'; |
|
860 | 860 | |
861 | 861 | |
862 | - if ($date_array[1] != "") |
|
863 | - { |
|
862 | + if ($date_array[1] != "") |
|
863 | + { |
|
864 | 864 | $date_array[0] = date("Y-m-d H:i:s", strtotime($date_array[0])); |
865 | 865 | $date_array[1] = date("Y-m-d H:i:s", strtotime($date_array[1])); |
866 | 866 | if ($globalDBdriver == 'mysql') { |
@@ -868,28 +868,28 @@ discard block |
||
868 | 868 | } else { |
869 | 869 | $additional_query .= " AND spotter_archive_output.date::timestamp AT TIME ZONE INTERVAL ".$offset." >= CAST('".$date_array[0]."' AS TIMESTAMP) AND spotter_archive_output.date::timestamp AT TIME ZONE INTERVAL ".$offset." <= CAST('".$date_array[1]."' AS TIMESTAMP) "; |
870 | 870 | } |
871 | - } else { |
|
871 | + } else { |
|
872 | 872 | $date_array[0] = date("Y-m-d H:i:s", strtotime($date_array[0])); |
873 | - if ($globalDBdriver == 'mysql') { |
|
873 | + if ($globalDBdriver == 'mysql') { |
|
874 | 874 | $additional_query .= " AND TIMESTAMP(CONVERT_TZ(spotter_archive_output.date,'+00:00', '".$offset."')) >= '".$date_array[0]."' "; |
875 | 875 | } else { |
876 | 876 | $additional_query .= " AND spotter_archive_output.date::timestamp AT TIME ZONE INTERVAL ".$offset." >= CAST('".$date_array[0]."' AS TIMESTAMP) "; |
877 | 877 | } |
878 | - } |
|
878 | + } |
|
879 | 879 | } |
880 | 880 | |
881 | 881 | if ($limit != "") |
882 | 882 | { |
883 | - $limit_array = explode(",", $limit); |
|
883 | + $limit_array = explode(",", $limit); |
|
884 | 884 | |
885 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
886 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
885 | + $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
886 | + $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
887 | 887 | |
888 | - if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
|
889 | - { |
|
888 | + if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
|
889 | + { |
|
890 | 890 | //$limit_query = " LIMIT ".$limit_array[0].",".$limit_array[1]; |
891 | 891 | $limit_query = " LIMIT ".$limit_array[1]." OFFSET ".$limit_array[0]; |
892 | - } |
|
892 | + } |
|
893 | 893 | } |
894 | 894 | |
895 | 895 | |
@@ -920,33 +920,33 @@ discard block |
||
920 | 920 | $spotter_array = $Spotter->getDataFromDB($query, $query_values,$limit_query); |
921 | 921 | |
922 | 922 | return $spotter_array; |
923 | - } |
|
923 | + } |
|
924 | 924 | |
925 | - public function deleteSpotterArchiveData() |
|
926 | - { |
|
925 | + public function deleteSpotterArchiveData() |
|
926 | + { |
|
927 | 927 | global $globalArchiveKeepMonths, $globalDBdriver; |
928 | - date_default_timezone_set('UTC'); |
|
929 | - if ($globalDBdriver == 'mysql') { |
|
928 | + date_default_timezone_set('UTC'); |
|
929 | + if ($globalDBdriver == 'mysql') { |
|
930 | 930 | $query = 'DELETE FROM spotter_archive_output WHERE spotter_archive_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$globalArchiveKeepMonths.' MONTH)'; |
931 | 931 | } else { |
932 | 932 | $query = "DELETE FROM spotter_archive_output WHERE spotter_archive_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalArchiveKeepMonths." MONTH'"; |
933 | 933 | } |
934 | - try { |
|
935 | - $sth = $this->db->prepare($query); |
|
936 | - $sth->execute(); |
|
937 | - } catch(PDOException $e) { |
|
938 | - return "error"; |
|
939 | - } |
|
934 | + try { |
|
935 | + $sth = $this->db->prepare($query); |
|
936 | + $sth->execute(); |
|
937 | + } catch(PDOException $e) { |
|
938 | + return "error"; |
|
939 | + } |
|
940 | 940 | } |
941 | 941 | |
942 | - /** |
|
943 | - * Gets all the spotter information based on the callsign |
|
944 | - * |
|
945 | - * @return Array the spotter information |
|
946 | - * |
|
947 | - */ |
|
948 | - public function getSpotterDataByIdent($ident = '', $limit = '', $sort = '') |
|
949 | - { |
|
942 | + /** |
|
943 | + * Gets all the spotter information based on the callsign |
|
944 | + * |
|
945 | + * @return Array the spotter information |
|
946 | + * |
|
947 | + */ |
|
948 | + public function getSpotterDataByIdent($ident = '', $limit = '', $sort = '') |
|
949 | + { |
|
950 | 950 | $global_query = "SELECT spotter_archive_output.* FROM spotter_archive_output"; |
951 | 951 | |
952 | 952 | date_default_timezone_set('UTC'); |
@@ -958,35 +958,35 @@ discard block |
||
958 | 958 | |
959 | 959 | if ($ident != "") |
960 | 960 | { |
961 | - if (!is_string($ident)) |
|
962 | - { |
|
961 | + if (!is_string($ident)) |
|
962 | + { |
|
963 | 963 | return false; |
964 | - } else { |
|
964 | + } else { |
|
965 | 965 | $additional_query = " AND (spotter_archive_output.ident = :ident)"; |
966 | 966 | $query_values = array(':ident' => $ident); |
967 | - } |
|
967 | + } |
|
968 | 968 | } |
969 | 969 | |
970 | 970 | if ($limit != "") |
971 | 971 | { |
972 | - $limit_array = explode(",", $limit); |
|
972 | + $limit_array = explode(",", $limit); |
|
973 | 973 | |
974 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
975 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
974 | + $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
975 | + $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
976 | 976 | |
977 | - if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
|
978 | - { |
|
977 | + if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
|
978 | + { |
|
979 | 979 | //$limit_query = " LIMIT ".$limit_array[0].",".$limit_array[1]; |
980 | 980 | $limit_query = " LIMIT ".$limit_array[1]." OFFSET ".$limit_array[0]; |
981 | - } |
|
981 | + } |
|
982 | 982 | } |
983 | 983 | |
984 | 984 | if ($sort != "") |
985 | 985 | { |
986 | - $search_orderby_array = $Spotter->getOrderBy(); |
|
987 | - $orderby_query = $search_orderby_array[$sort]['sql']; |
|
986 | + $search_orderby_array = $Spotter->getOrderBy(); |
|
987 | + $orderby_query = $search_orderby_array[$sort]['sql']; |
|
988 | 988 | } else { |
989 | - $orderby_query = " ORDER BY spotter_archive_output.date DESC"; |
|
989 | + $orderby_query = " ORDER BY spotter_archive_output.date DESC"; |
|
990 | 990 | } |
991 | 991 | |
992 | 992 | $query = $global_query." WHERE spotter_archive_output.ident <> '' ".$additional_query." ".$orderby_query; |
@@ -994,17 +994,17 @@ discard block |
||
994 | 994 | $spotter_array = $Spotter->getDataFromDB($query, $query_values, $limit_query); |
995 | 995 | |
996 | 996 | return $spotter_array; |
997 | - } |
|
997 | + } |
|
998 | 998 | |
999 | 999 | |
1000 | - /** |
|
1001 | - * Gets all the spotter information based on the owner |
|
1002 | - * |
|
1003 | - * @return Array the spotter information |
|
1004 | - * |
|
1005 | - */ |
|
1006 | - public function getSpotterDataByOwner($owner = '', $limit = '', $sort = '', $filter = array()) |
|
1007 | - { |
|
1000 | + /** |
|
1001 | + * Gets all the spotter information based on the owner |
|
1002 | + * |
|
1003 | + * @return Array the spotter information |
|
1004 | + * |
|
1005 | + */ |
|
1006 | + public function getSpotterDataByOwner($owner = '', $limit = '', $sort = '', $filter = array()) |
|
1007 | + { |
|
1008 | 1008 | $global_query = "SELECT spotter_archive_output.* FROM spotter_archive_output"; |
1009 | 1009 | |
1010 | 1010 | date_default_timezone_set('UTC'); |
@@ -1017,35 +1017,35 @@ discard block |
||
1017 | 1017 | |
1018 | 1018 | if ($owner != "") |
1019 | 1019 | { |
1020 | - if (!is_string($owner)) |
|
1021 | - { |
|
1020 | + if (!is_string($owner)) |
|
1021 | + { |
|
1022 | 1022 | return false; |
1023 | - } else { |
|
1023 | + } else { |
|
1024 | 1024 | $additional_query = " AND (spotter_archive_output.owner_name = :owner)"; |
1025 | 1025 | $query_values = array(':owner' => $owner); |
1026 | - } |
|
1026 | + } |
|
1027 | 1027 | } |
1028 | 1028 | |
1029 | 1029 | if ($limit != "") |
1030 | 1030 | { |
1031 | - $limit_array = explode(",", $limit); |
|
1031 | + $limit_array = explode(",", $limit); |
|
1032 | 1032 | |
1033 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
1034 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
1033 | + $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
1034 | + $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
1035 | 1035 | |
1036 | - if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
|
1037 | - { |
|
1036 | + if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
|
1037 | + { |
|
1038 | 1038 | //$limit_query = " LIMIT ".$limit_array[0].",".$limit_array[1]; |
1039 | 1039 | $limit_query = " LIMIT ".$limit_array[1]." OFFSET ".$limit_array[0]; |
1040 | - } |
|
1040 | + } |
|
1041 | 1041 | } |
1042 | 1042 | |
1043 | 1043 | if ($sort != "") |
1044 | 1044 | { |
1045 | - $search_orderby_array = $Spotter->getOrderBy(); |
|
1046 | - $orderby_query = $search_orderby_array[$sort]['sql']; |
|
1045 | + $search_orderby_array = $Spotter->getOrderBy(); |
|
1046 | + $orderby_query = $search_orderby_array[$sort]['sql']; |
|
1047 | 1047 | } else { |
1048 | - $orderby_query = " ORDER BY spotter_archive_output.date DESC"; |
|
1048 | + $orderby_query = " ORDER BY spotter_archive_output.date DESC"; |
|
1049 | 1049 | } |
1050 | 1050 | |
1051 | 1051 | $query = $global_query.$filter_query." spotter_archive_output.owner_name <> '' ".$additional_query." ".$orderby_query; |
@@ -1053,16 +1053,16 @@ discard block |
||
1053 | 1053 | $spotter_array = $Spotter->getDataFromDB($query, $query_values, $limit_query); |
1054 | 1054 | |
1055 | 1055 | return $spotter_array; |
1056 | - } |
|
1057 | - |
|
1058 | - /** |
|
1059 | - * Gets all the spotter information based on the pilot |
|
1060 | - * |
|
1061 | - * @return Array the spotter information |
|
1062 | - * |
|
1063 | - */ |
|
1064 | - public function getSpotterDataByPilot($pilot = '', $limit = '', $sort = '', $filter = array()) |
|
1065 | - { |
|
1056 | + } |
|
1057 | + |
|
1058 | + /** |
|
1059 | + * Gets all the spotter information based on the pilot |
|
1060 | + * |
|
1061 | + * @return Array the spotter information |
|
1062 | + * |
|
1063 | + */ |
|
1064 | + public function getSpotterDataByPilot($pilot = '', $limit = '', $sort = '', $filter = array()) |
|
1065 | + { |
|
1066 | 1066 | $global_query = "SELECT spotter_archive_output.* FROM spotter_archive_output"; |
1067 | 1067 | |
1068 | 1068 | date_default_timezone_set('UTC'); |
@@ -1081,24 +1081,24 @@ discard block |
||
1081 | 1081 | |
1082 | 1082 | if ($limit != "") |
1083 | 1083 | { |
1084 | - $limit_array = explode(",", $limit); |
|
1084 | + $limit_array = explode(",", $limit); |
|
1085 | 1085 | |
1086 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
1087 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
1086 | + $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
1087 | + $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
1088 | 1088 | |
1089 | - if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
|
1090 | - { |
|
1089 | + if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
|
1090 | + { |
|
1091 | 1091 | //$limit_query = " LIMIT ".$limit_array[0].",".$limit_array[1]; |
1092 | 1092 | $limit_query = " LIMIT ".$limit_array[1]." OFFSET ".$limit_array[0]; |
1093 | - } |
|
1093 | + } |
|
1094 | 1094 | } |
1095 | 1095 | |
1096 | 1096 | if ($sort != "") |
1097 | 1097 | { |
1098 | - $search_orderby_array = $Spotter->getOrderBy(); |
|
1099 | - $orderby_query = $search_orderby_array[$sort]['sql']; |
|
1098 | + $search_orderby_array = $Spotter->getOrderBy(); |
|
1099 | + $orderby_query = $search_orderby_array[$sort]['sql']; |
|
1100 | 1100 | } else { |
1101 | - $orderby_query = " ORDER BY spotter_archive_output.date DESC"; |
|
1101 | + $orderby_query = " ORDER BY spotter_archive_output.date DESC"; |
|
1102 | 1102 | } |
1103 | 1103 | |
1104 | 1104 | $query = $global_query.$filter_query." spotter_archive_output.pilot_name <> '' ".$additional_query." ".$orderby_query; |
@@ -1106,16 +1106,16 @@ discard block |
||
1106 | 1106 | $spotter_array = $Spotter->getDataFromDB($query, $query_values, $limit_query); |
1107 | 1107 | |
1108 | 1108 | return $spotter_array; |
1109 | - } |
|
1110 | - |
|
1111 | - /** |
|
1112 | - * Gets all number of flight over countries |
|
1113 | - * |
|
1114 | - * @return Array the airline country list |
|
1115 | - * |
|
1116 | - */ |
|
1117 | - public function countAllFlightOverCountries($limit = true,$olderthanmonths = 0,$sincedate = '') |
|
1118 | - { |
|
1109 | + } |
|
1110 | + |
|
1111 | + /** |
|
1112 | + * Gets all number of flight over countries |
|
1113 | + * |
|
1114 | + * @return Array the airline country list |
|
1115 | + * |
|
1116 | + */ |
|
1117 | + public function countAllFlightOverCountries($limit = true,$olderthanmonths = 0,$sincedate = '') |
|
1118 | + { |
|
1119 | 1119 | global $globalDBdriver; |
1120 | 1120 | /* |
1121 | 1121 | $query = "SELECT c.name, c.iso3, c.iso2, count(c.name) as nb |
@@ -1125,14 +1125,14 @@ discard block |
||
1125 | 1125 | $query = "SELECT c.name, c.iso3, c.iso2, count(c.name) as nb |
1126 | 1126 | FROM countries c, spotter_archive s |
1127 | 1127 | WHERE c.iso2 = s.over_country "; |
1128 | - if ($olderthanmonths > 0) { |
|
1129 | - if ($globalDBdriver == 'mysql') { |
|
1128 | + if ($olderthanmonths > 0) { |
|
1129 | + if ($globalDBdriver == 'mysql') { |
|
1130 | 1130 | $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) '; |
1131 | 1131 | } else { |
1132 | 1132 | $query .= "AND date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'"; |
1133 | 1133 | } |
1134 | 1134 | } |
1135 | - if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
|
1135 | + if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
|
1136 | 1136 | $query .= "GROUP BY c.name, c.iso3, c.iso2 ORDER BY nb DESC"; |
1137 | 1137 | if ($limit) $query .= " LIMIT 0,10"; |
1138 | 1138 | |
@@ -1145,23 +1145,23 @@ discard block |
||
1145 | 1145 | |
1146 | 1146 | while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
1147 | 1147 | { |
1148 | - $temp_array['flight_count'] = $row['nb']; |
|
1149 | - $temp_array['flight_country'] = $row['name']; |
|
1150 | - $temp_array['flight_country_iso3'] = $row['iso3']; |
|
1151 | - $temp_array['flight_country_iso2'] = $row['iso2']; |
|
1152 | - $flight_array[] = $temp_array; |
|
1148 | + $temp_array['flight_count'] = $row['nb']; |
|
1149 | + $temp_array['flight_country'] = $row['name']; |
|
1150 | + $temp_array['flight_country_iso3'] = $row['iso3']; |
|
1151 | + $temp_array['flight_country_iso2'] = $row['iso2']; |
|
1152 | + $flight_array[] = $temp_array; |
|
1153 | 1153 | } |
1154 | 1154 | return $flight_array; |
1155 | - } |
|
1156 | - |
|
1157 | - /** |
|
1158 | - * Gets all number of flight over countries |
|
1159 | - * |
|
1160 | - * @return Array the airline country list |
|
1161 | - * |
|
1162 | - */ |
|
1163 | - public function countAllFlightOverCountriesByAirlines($limit = true,$olderthanmonths = 0,$sincedate = '') |
|
1164 | - { |
|
1155 | + } |
|
1156 | + |
|
1157 | + /** |
|
1158 | + * Gets all number of flight over countries |
|
1159 | + * |
|
1160 | + * @return Array the airline country list |
|
1161 | + * |
|
1162 | + */ |
|
1163 | + public function countAllFlightOverCountriesByAirlines($limit = true,$olderthanmonths = 0,$sincedate = '') |
|
1164 | + { |
|
1165 | 1165 | global $globalDBdriver; |
1166 | 1166 | /* |
1167 | 1167 | $query = "SELECT c.name, c.iso3, c.iso2, count(c.name) as nb |
@@ -1171,14 +1171,14 @@ discard block |
||
1171 | 1171 | $query = "SELECT o.airline_icao,c.name, c.iso3, c.iso2, count(c.name) as nb |
1172 | 1172 | FROM countries c, spotter_archive s, spotter_output o |
1173 | 1173 | WHERE c.iso2 = s.over_country AND o.airline_icao <> '' AND o.flightaware_id = s.flightaware_id "; |
1174 | - if ($olderthanmonths > 0) { |
|
1175 | - if ($globalDBdriver == 'mysql') { |
|
1174 | + if ($olderthanmonths > 0) { |
|
1175 | + if ($globalDBdriver == 'mysql') { |
|
1176 | 1176 | $query .= 'AND s.date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) '; |
1177 | 1177 | } else { |
1178 | 1178 | $query .= "AND s.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'"; |
1179 | 1179 | } |
1180 | 1180 | } |
1181 | - if ($sincedate != '') $query .= "AND s.date > '".$sincedate."' "; |
|
1181 | + if ($sincedate != '') $query .= "AND s.date > '".$sincedate."' "; |
|
1182 | 1182 | $query .= "GROUP BY o.airline_icao,c.name, c.iso3, c.iso2 ORDER BY nb DESC"; |
1183 | 1183 | if ($limit) $query .= " LIMIT 0,10"; |
1184 | 1184 | |
@@ -1191,24 +1191,24 @@ discard block |
||
1191 | 1191 | |
1192 | 1192 | while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
1193 | 1193 | { |
1194 | - $temp_array['airline_icao'] = $row['airline_icao']; |
|
1195 | - $temp_array['flight_count'] = $row['nb']; |
|
1196 | - $temp_array['flight_country'] = $row['name']; |
|
1197 | - $temp_array['flight_country_iso3'] = $row['iso3']; |
|
1198 | - $temp_array['flight_country_iso2'] = $row['iso2']; |
|
1199 | - $flight_array[] = $temp_array; |
|
1194 | + $temp_array['airline_icao'] = $row['airline_icao']; |
|
1195 | + $temp_array['flight_count'] = $row['nb']; |
|
1196 | + $temp_array['flight_country'] = $row['name']; |
|
1197 | + $temp_array['flight_country_iso3'] = $row['iso3']; |
|
1198 | + $temp_array['flight_country_iso2'] = $row['iso2']; |
|
1199 | + $flight_array[] = $temp_array; |
|
1200 | 1200 | } |
1201 | 1201 | return $flight_array; |
1202 | - } |
|
1203 | - |
|
1204 | - /** |
|
1205 | - * Gets last spotter information based on a particular callsign |
|
1206 | - * |
|
1207 | - * @return Array the spotter information |
|
1208 | - * |
|
1209 | - */ |
|
1210 | - public function getDateArchiveSpotterDataById($id,$date) |
|
1211 | - { |
|
1202 | + } |
|
1203 | + |
|
1204 | + /** |
|
1205 | + * Gets last spotter information based on a particular callsign |
|
1206 | + * |
|
1207 | + * @return Array the spotter information |
|
1208 | + * |
|
1209 | + */ |
|
1210 | + public function getDateArchiveSpotterDataById($id,$date) |
|
1211 | + { |
|
1212 | 1212 | $Spotter = new Spotter($this->db); |
1213 | 1213 | date_default_timezone_set('UTC'); |
1214 | 1214 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
@@ -1216,16 +1216,16 @@ discard block |
||
1216 | 1216 | $date = date('c',$date); |
1217 | 1217 | $spotter_array = $Spotter->getDataFromDB($query,array(':id' => $id,':date' => $date)); |
1218 | 1218 | return $spotter_array; |
1219 | - } |
|
1220 | - |
|
1221 | - /** |
|
1222 | - * Gets all the spotter information based on a particular callsign |
|
1223 | - * |
|
1224 | - * @return Array the spotter information |
|
1225 | - * |
|
1226 | - */ |
|
1227 | - public function getDateArchiveSpotterDataByIdent($ident,$date) |
|
1228 | - { |
|
1219 | + } |
|
1220 | + |
|
1221 | + /** |
|
1222 | + * Gets all the spotter information based on a particular callsign |
|
1223 | + * |
|
1224 | + * @return Array the spotter information |
|
1225 | + * |
|
1226 | + */ |
|
1227 | + public function getDateArchiveSpotterDataByIdent($ident,$date) |
|
1228 | + { |
|
1229 | 1229 | $Spotter = new Spotter($this->db); |
1230 | 1230 | date_default_timezone_set('UTC'); |
1231 | 1231 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
@@ -1233,16 +1233,16 @@ discard block |
||
1233 | 1233 | $date = date('c',$date); |
1234 | 1234 | $spotter_array = $Spotter->getDataFromDB($query,array(':ident' => $ident,':date' => $date)); |
1235 | 1235 | return $spotter_array; |
1236 | - } |
|
1237 | - |
|
1238 | - /** |
|
1239 | - * Gets all the spotter information based on the airport |
|
1240 | - * |
|
1241 | - * @return Array the spotter information |
|
1242 | - * |
|
1243 | - */ |
|
1244 | - public function getSpotterDataByAirport($airport = '', $limit = '', $sort = '',$filters = array()) |
|
1245 | - { |
|
1236 | + } |
|
1237 | + |
|
1238 | + /** |
|
1239 | + * Gets all the spotter information based on the airport |
|
1240 | + * |
|
1241 | + * @return Array the spotter information |
|
1242 | + * |
|
1243 | + */ |
|
1244 | + public function getSpotterDataByAirport($airport = '', $limit = '', $sort = '',$filters = array()) |
|
1245 | + { |
|
1246 | 1246 | global $global_query; |
1247 | 1247 | $Spotter = new Spotter(); |
1248 | 1248 | date_default_timezone_set('UTC'); |
@@ -1253,35 +1253,35 @@ discard block |
||
1253 | 1253 | |
1254 | 1254 | if ($airport != "") |
1255 | 1255 | { |
1256 | - if (!is_string($airport)) |
|
1257 | - { |
|
1256 | + if (!is_string($airport)) |
|
1257 | + { |
|
1258 | 1258 | return false; |
1259 | - } else { |
|
1259 | + } else { |
|
1260 | 1260 | $additional_query .= " AND ((spotter_archive_output.departure_airport_icao = :airport) OR (spotter_archive_output.arrival_airport_icao = :airport))"; |
1261 | 1261 | $query_values = array(':airport' => $airport); |
1262 | - } |
|
1262 | + } |
|
1263 | 1263 | } |
1264 | 1264 | |
1265 | 1265 | if ($limit != "") |
1266 | 1266 | { |
1267 | - $limit_array = explode(",", $limit); |
|
1267 | + $limit_array = explode(",", $limit); |
|
1268 | 1268 | |
1269 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
1270 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
1269 | + $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
1270 | + $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
1271 | 1271 | |
1272 | - if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
|
1273 | - { |
|
1272 | + if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
|
1273 | + { |
|
1274 | 1274 | //$limit_query = " LIMIT ".$limit_array[0].",".$limit_array[1]; |
1275 | 1275 | $limit_query = " LIMIT ".$limit_array[1]." OFFSET ".$limit_array[0]; |
1276 | - } |
|
1276 | + } |
|
1277 | 1277 | } |
1278 | 1278 | |
1279 | 1279 | if ($sort != "") |
1280 | 1280 | { |
1281 | - $search_orderby_array = $Spotter->getOrderBy(); |
|
1282 | - $orderby_query = $search_orderby_array[$sort]['sql']; |
|
1281 | + $search_orderby_array = $Spotter->getOrderBy(); |
|
1282 | + $orderby_query = $search_orderby_array[$sort]['sql']; |
|
1283 | 1283 | } else { |
1284 | - $orderby_query = " ORDER BY spotter_archive_output.date DESC"; |
|
1284 | + $orderby_query = " ORDER BY spotter_archive_output.date DESC"; |
|
1285 | 1285 | } |
1286 | 1286 | |
1287 | 1287 | $query = $global_query.$filter_query." spotter_archive_output.ident <> '' ".$additional_query." AND ((spotter_archive_output.departure_airport_icao <> 'NA') AND (spotter_archive_output.arrival_airport_icao <> 'NA')) ".$orderby_query; |
@@ -1289,6 +1289,6 @@ discard block |
||
1289 | 1289 | $spotter_array = $Spotter->getDataFromDB($query, $query_values, $limit_query); |
1290 | 1290 | |
1291 | 1291 | return $spotter_array; |
1292 | - } |
|
1292 | + } |
|
1293 | 1293 | } |
1294 | 1294 | ?> |
1295 | 1295 | \ No newline at end of file |
@@ -13,62 +13,62 @@ discard block |
||
13 | 13 | * @param Array $filter the filter |
14 | 14 | * @return Array the SQL part |
15 | 15 | */ |
16 | - public function getFilter($filter = array(),$where = false,$and = false) { |
|
16 | + public function getFilter($filter = array(), $where = false, $and = false) { |
|
17 | 17 | global $globalFilter, $globalStatsFilters, $globalFilterName, $globalDBdriver; |
18 | 18 | $filters = array(); |
19 | 19 | if (is_array($globalStatsFilters) && isset($globalStatsFilters[$globalFilterName])) { |
20 | 20 | if (isset($globalStatsFilters[$globalFilterName][0]['source'])) { |
21 | 21 | $filters = $globalStatsFilters[$globalFilterName]; |
22 | 22 | } else { |
23 | - $filter = array_merge($filter,$globalStatsFilters[$globalFilterName]); |
|
23 | + $filter = array_merge($filter, $globalStatsFilters[$globalFilterName]); |
|
24 | 24 | } |
25 | 25 | } |
26 | 26 | if (isset($filter[0]['source'])) { |
27 | - $filters = array_merge($filters,$filter); |
|
27 | + $filters = array_merge($filters, $filter); |
|
28 | 28 | } |
29 | - if (is_array($globalFilter)) $filter = array_merge($filter,$globalFilter); |
|
29 | + if (is_array($globalFilter)) $filter = array_merge($filter, $globalFilter); |
|
30 | 30 | $filter_query_join = ''; |
31 | 31 | $filter_query_where = ''; |
32 | - foreach($filters as $flt) { |
|
32 | + foreach ($filters as $flt) { |
|
33 | 33 | if (isset($flt['airlines']) && !empty($flt['airlines'])) { |
34 | 34 | if ($flt['airlines'][0] != '') { |
35 | 35 | if (isset($flt['source'])) { |
36 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.airline_icao IN ('".implode("','",$flt['airlines'])."') AND spotter_archive_output.format_source IN ('".implode("','",$flt['source'])."')) saff ON saff.flightaware_id = spotter_archive_output.flightaware_id"; |
|
36 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.airline_icao IN ('".implode("','", $flt['airlines'])."') AND spotter_archive_output.format_source IN ('".implode("','", $flt['source'])."')) saff ON saff.flightaware_id = spotter_archive_output.flightaware_id"; |
|
37 | 37 | } else { |
38 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.airline_icao IN ('".implode("','",$flt['airlines'])."')) saff ON saff.flightaware_id = spotter_archive_output.flightaware_id"; |
|
38 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.airline_icao IN ('".implode("','", $flt['airlines'])."')) saff ON saff.flightaware_id = spotter_archive_output.flightaware_id"; |
|
39 | 39 | } |
40 | 40 | } |
41 | 41 | } |
42 | 42 | if (isset($flt['pilots_id']) && !empty($flt['pilots_id'])) { |
43 | 43 | if (isset($flt['source'])) { |
44 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.pilot_id IN ('".implode("','",$flt['pilots_id'])."') AND spotter_archive_output.format_source IN ('".implode("','",$flt['source'])."')) sp ON sp.flightaware_id = spotter_archive_output.flightaware_id"; |
|
44 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.pilot_id IN ('".implode("','", $flt['pilots_id'])."') AND spotter_archive_output.format_source IN ('".implode("','", $flt['source'])."')) sp ON sp.flightaware_id = spotter_archive_output.flightaware_id"; |
|
45 | 45 | } else { |
46 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.pilot_id IN ('".implode("','",$flt['pilots_id'])."')) sp ON sp.flightaware_id = spotter_archive_output.flightaware_id"; |
|
46 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.pilot_id IN ('".implode("','", $flt['pilots_id'])."')) sp ON sp.flightaware_id = spotter_archive_output.flightaware_id"; |
|
47 | 47 | } |
48 | 48 | } |
49 | 49 | if (isset($flt['idents']) && !empty($flt['idents'])) { |
50 | 50 | if (isset($flt['source'])) { |
51 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.ident IN ('".implode("','",$flt['idents'])."') AND spotter_archive_output.format_source IN ('".implode("','",$flt['source'])."')) spi ON spi.flightaware_id = spotter_archive_output.flightaware_id"; |
|
51 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.ident IN ('".implode("','", $flt['idents'])."') AND spotter_archive_output.format_source IN ('".implode("','", $flt['source'])."')) spi ON spi.flightaware_id = spotter_archive_output.flightaware_id"; |
|
52 | 52 | } else { |
53 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.ident IN ('".implode("','",$flt['idents'])."')) spi ON spi.flightaware_id = spotter_archive_output.flightaware_id"; |
|
53 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.ident IN ('".implode("','", $flt['idents'])."')) spi ON spi.flightaware_id = spotter_archive_output.flightaware_id"; |
|
54 | 54 | } |
55 | 55 | } |
56 | 56 | if (isset($flt['registrations']) && !empty($flt['registrations'])) { |
57 | 57 | if (isset($flt['source'])) { |
58 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.registration IN ('".implode("','",$flt['registrations'])."') AND spotter_archive_output.format_source IN ('".implode("','",$flt['source'])."')) sre ON sre.flightaware_id = spotter_archive_output.flightaware_id"; |
|
58 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.registration IN ('".implode("','", $flt['registrations'])."') AND spotter_archive_output.format_source IN ('".implode("','", $flt['source'])."')) sre ON sre.flightaware_id = spotter_archive_output.flightaware_id"; |
|
59 | 59 | } else { |
60 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.registration IN ('".implode("','",$flt['registrations'])."')) sre ON sre.flightaware_id = spotter_archive_output.flightaware_id"; |
|
60 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.registration IN ('".implode("','", $flt['registrations'])."')) sre ON sre.flightaware_id = spotter_archive_output.flightaware_id"; |
|
61 | 61 | } |
62 | 62 | } |
63 | 63 | if ((isset($flt['airlines']) && empty($flt['airlines']) && isset($flt['pilots_id']) && empty($flt['pilots_id']) && isset($flt['idents']) && empty($flt['idents']) && isset($flt['registrations']) && empty($flt['registrations'])) || (!isset($flt['airlines']) && !isset($flt['pilots_id']) && !isset($flt['idents']) && !isset($flt['registrations']))) { |
64 | 64 | if (isset($flt['source'])) { |
65 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_output.format_source IN ('".implode("','",$flt['source'])."')) saa ON saa.flightaware_id = spotter_archive_output.flightaware_id"; |
|
65 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_output.format_source IN ('".implode("','", $flt['source'])."')) saa ON saa.flightaware_id = spotter_archive_output.flightaware_id"; |
|
66 | 66 | } |
67 | 67 | } |
68 | 68 | } |
69 | 69 | if (isset($filter['airlines']) && !empty($filter['airlines'])) { |
70 | 70 | if ($filter['airlines'][0] != '') { |
71 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.airline_icao IN ('".implode("','",$filter['airlines'])."')) saf ON saf.flightaware_id = spotter_archive_output.flightaware_id"; |
|
71 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.airline_icao IN ('".implode("','", $filter['airlines'])."')) saf ON saf.flightaware_id = spotter_archive_output.flightaware_id"; |
|
72 | 72 | } |
73 | 73 | } |
74 | 74 | |
@@ -76,16 +76,16 @@ discard block |
||
76 | 76 | $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.airline_type = '".$filter['airlinestype']."') sa ON sa.flightaware_id = spotter_archive_output.flightaware_id "; |
77 | 77 | } |
78 | 78 | if (isset($filter['pilots_id']) && !empty($filter['pilots_id'])) { |
79 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.pilot_id IN ('".implode("','",$filter['pilots_id'])."')) spi ON spi.flightaware_id = spotter_archive_output.flightaware_id"; |
|
79 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.pilot_id IN ('".implode("','", $filter['pilots_id'])."')) spi ON spi.flightaware_id = spotter_archive_output.flightaware_id"; |
|
80 | 80 | } |
81 | 81 | if (isset($filter['source']) && !empty($filter['source'])) { |
82 | - $filter_query_where .= " AND format_source IN ('".implode("','",$filter['source'])."')"; |
|
82 | + $filter_query_where .= " AND format_source IN ('".implode("','", $filter['source'])."')"; |
|
83 | 83 | } |
84 | 84 | if (isset($filter['ident']) && !empty($filter['ident'])) { |
85 | 85 | $filter_query_where .= " AND ident = '".$filter['ident']."'"; |
86 | 86 | } |
87 | 87 | if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) { |
88 | - $filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')"; |
|
88 | + $filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','", $filter['source_aprs'])."')"; |
|
89 | 89 | } |
90 | 90 | if ((isset($filter['year']) && $filter['year'] != '') || (isset($filter['month']) && $filter['month'] != '') || (isset($filter['day']) && $filter['day'] != '')) { |
91 | 91 | $filter_query_date = ''; |
@@ -111,41 +111,41 @@ discard block |
||
111 | 111 | $filter_query_date .= " AND EXTRACT(DAY FROM spotter_archive_output.date) = '".$filter['day']."'"; |
112 | 112 | } |
113 | 113 | } |
114 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output".preg_replace('/^ AND/',' WHERE',$filter_query_date).") sd ON sd.flightaware_id = spotter_archive_output.flightaware_id"; |
|
114 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output".preg_replace('/^ AND/', ' WHERE', $filter_query_date).") sd ON sd.flightaware_id = spotter_archive_output.flightaware_id"; |
|
115 | 115 | } |
116 | 116 | if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE'; |
117 | 117 | elseif ($filter_query_where != '' && $and) $filter_query_where .= ' AND'; |
118 | 118 | if ($filter_query_where != '') { |
119 | - $filter_query_where = preg_replace('/^ AND/',' WHERE',$filter_query_where); |
|
119 | + $filter_query_where = preg_replace('/^ AND/', ' WHERE', $filter_query_where); |
|
120 | 120 | } |
121 | 121 | $filter_query = $filter_query_join.$filter_query_where; |
122 | 122 | return $filter_query; |
123 | 123 | } |
124 | 124 | |
125 | 125 | // Spotter_archive |
126 | - public function addSpotterArchiveData($flightaware_id = '', $ident = '', $registration = '', $airline_name = '', $airline_icao = '', $airline_country = '', $airline_type = '', $aircraft_icao = '', $aircraft_shadow = '', $aircraft_name = '', $aircraft_manufacturer = '', $departure_airport_icao = '', $departure_airport_name = '', $departure_airport_city = '', $departure_airport_country = '', $departure_airport_time = '',$arrival_airport_icao = '', $arrival_airport_name = '', $arrival_airport_city ='', $arrival_airport_country = '', $arrival_airport_time = '', $route_stop = '', $date = '',$latitude = '', $longitude = '', $waypoints = '', $altitude = '', $real_altitude = '',$heading = '', $ground_speed = '', $squawk = '', $ModeS = '', $pilot_id = '', $pilot_name = '',$verticalrate = '',$format_source = '', $source_name = '', $over_country = '') { |
|
126 | + public function addSpotterArchiveData($flightaware_id = '', $ident = '', $registration = '', $airline_name = '', $airline_icao = '', $airline_country = '', $airline_type = '', $aircraft_icao = '', $aircraft_shadow = '', $aircraft_name = '', $aircraft_manufacturer = '', $departure_airport_icao = '', $departure_airport_name = '', $departure_airport_city = '', $departure_airport_country = '', $departure_airport_time = '', $arrival_airport_icao = '', $arrival_airport_name = '', $arrival_airport_city = '', $arrival_airport_country = '', $arrival_airport_time = '', $route_stop = '', $date = '', $latitude = '', $longitude = '', $waypoints = '', $altitude = '', $real_altitude = '', $heading = '', $ground_speed = '', $squawk = '', $ModeS = '', $pilot_id = '', $pilot_name = '', $verticalrate = '', $format_source = '', $source_name = '', $over_country = '') { |
|
127 | 127 | require_once(dirname(__FILE__).'/class.Spotter.php'); |
128 | 128 | if ($over_country == '') { |
129 | 129 | $Spotter = new Spotter($this->db); |
130 | - $data_country = $Spotter->getCountryFromLatitudeLongitude($latitude,$longitude); |
|
130 | + $data_country = $Spotter->getCountryFromLatitudeLongitude($latitude, $longitude); |
|
131 | 131 | if (!empty($data_country)) $country = $data_country['iso2']; |
132 | 132 | else $country = ''; |
133 | 133 | } else $country = $over_country; |
134 | - if ($airline_type === NULL) $airline_type =''; |
|
134 | + if ($airline_type === NULL) $airline_type = ''; |
|
135 | 135 | |
136 | 136 | //if ($country == '') echo "\n".'************ UNKNOW COUNTRY ****************'."\n"; |
137 | 137 | //else echo "\n".'*/*/*/*/*/*/*/ Country : '.$country.' */*/*/*/*/*/*/*/*/'."\n"; |
138 | 138 | |
139 | 139 | // Route is not added in spotter_archive |
140 | - $query = "INSERT INTO spotter_archive (flightaware_id, ident, registration, airline_name, airline_icao, airline_country, airline_type, aircraft_icao, aircraft_shadow, aircraft_name, aircraft_manufacturer, departure_airport_icao, departure_airport_name, departure_airport_city, departure_airport_country, departure_airport_time,arrival_airport_icao, arrival_airport_name, arrival_airport_city, arrival_airport_country, arrival_airport_time, route_stop, date,latitude, longitude, waypoints, altitude, heading, ground_speed, squawk, ModeS, pilot_id, pilot_name, verticalrate,format_source,over_country,source_name,real_altitude) |
|
140 | + $query = "INSERT INTO spotter_archive (flightaware_id, ident, registration, airline_name, airline_icao, airline_country, airline_type, aircraft_icao, aircraft_shadow, aircraft_name, aircraft_manufacturer, departure_airport_icao, departure_airport_name, departure_airport_city, departure_airport_country, departure_airport_time,arrival_airport_icao, arrival_airport_name, arrival_airport_city, arrival_airport_country, arrival_airport_time, route_stop, date,latitude, longitude, waypoints, altitude, heading, ground_speed, squawk, ModeS, pilot_id, pilot_name, verticalrate,format_source,over_country,source_name,real_altitude) |
|
141 | 141 | VALUES (:flightaware_id, :ident, :registration, :airline_name, :airline_icao, :airline_country, :airline_type, :aircraft_icao, :aircraft_shadow, :aircraft_name, :aircraft_manufacturer, :departure_airport_icao, :departure_airport_name, :departure_airport_city, :departure_airport_country, :departure_airport_time,:arrival_airport_icao, :arrival_airport_name, :arrival_airport_city, :arrival_airport_country, :arrival_airport_time, :route_stop, :date,:latitude, :longitude, :waypoints, :altitude, :heading, :ground_speed, :squawk, :ModeS, :pilot_id, :pilot_name, :verticalrate, :format_source, :over_country, :source_name,:real_altitude)"; |
142 | 142 | |
143 | - $query_values = array(':flightaware_id' => $flightaware_id, ':ident' => $ident, ':registration' => $registration, ':airline_name' => $airline_name, ':airline_icao' => $airline_icao, ':airline_country' => $airline_country, ':airline_type' => $airline_type, ':aircraft_icao' => $aircraft_icao, ':aircraft_shadow' => $aircraft_shadow, ':aircraft_name' => $aircraft_name, ':aircraft_manufacturer' => $aircraft_manufacturer, ':departure_airport_icao' => $departure_airport_icao, ':departure_airport_name' => $departure_airport_name, ':departure_airport_city' => $departure_airport_city, ':departure_airport_country' => $departure_airport_country, ':departure_airport_time' => $departure_airport_time,':arrival_airport_icao' => $arrival_airport_icao, ':arrival_airport_name' => $arrival_airport_name, ':arrival_airport_city' => $arrival_airport_city, ':arrival_airport_country' => $arrival_airport_country, ':arrival_airport_time' => $arrival_airport_time, ':route_stop' => $route_stop, ':date' => $date,':latitude' => $latitude, ':longitude' => $longitude, ':waypoints' => $waypoints, ':altitude' => $altitude, ':heading' => $heading, ':ground_speed' => $ground_speed, ':squawk' => $squawk, ':ModeS' => $ModeS, ':pilot_id' => $pilot_id, ':pilot_name' => $pilot_name, ':verticalrate' => $verticalrate, ':format_source' => $format_source, ':over_country' => $country, ':source_name' => $source_name,':real_altitude' => $real_altitude); |
|
143 | + $query_values = array(':flightaware_id' => $flightaware_id, ':ident' => $ident, ':registration' => $registration, ':airline_name' => $airline_name, ':airline_icao' => $airline_icao, ':airline_country' => $airline_country, ':airline_type' => $airline_type, ':aircraft_icao' => $aircraft_icao, ':aircraft_shadow' => $aircraft_shadow, ':aircraft_name' => $aircraft_name, ':aircraft_manufacturer' => $aircraft_manufacturer, ':departure_airport_icao' => $departure_airport_icao, ':departure_airport_name' => $departure_airport_name, ':departure_airport_city' => $departure_airport_city, ':departure_airport_country' => $departure_airport_country, ':departure_airport_time' => $departure_airport_time, ':arrival_airport_icao' => $arrival_airport_icao, ':arrival_airport_name' => $arrival_airport_name, ':arrival_airport_city' => $arrival_airport_city, ':arrival_airport_country' => $arrival_airport_country, ':arrival_airport_time' => $arrival_airport_time, ':route_stop' => $route_stop, ':date' => $date, ':latitude' => $latitude, ':longitude' => $longitude, ':waypoints' => $waypoints, ':altitude' => $altitude, ':heading' => $heading, ':ground_speed' => $ground_speed, ':squawk' => $squawk, ':ModeS' => $ModeS, ':pilot_id' => $pilot_id, ':pilot_name' => $pilot_name, ':verticalrate' => $verticalrate, ':format_source' => $format_source, ':over_country' => $country, ':source_name' => $source_name, ':real_altitude' => $real_altitude); |
|
144 | 144 | try { |
145 | 145 | $sth = $this->db->prepare($query); |
146 | 146 | $sth->execute($query_values); |
147 | 147 | $sth->closeCursor(); |
148 | - } catch(PDOException $e) { |
|
148 | + } catch (PDOException $e) { |
|
149 | 149 | return "error : ".$e->getMessage(); |
150 | 150 | } |
151 | 151 | return "success"; |
@@ -165,9 +165,9 @@ discard block |
||
165 | 165 | |
166 | 166 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
167 | 167 | //$query = "SELECT spotter_archive.* FROM spotter_archive INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_archive l WHERE l.ident = :ident GROUP BY l.flightaware_id) s on spotter_archive.flightaware_id = s.flightaware_id AND spotter_archive.date = s.maxdate LIMIT 1"; |
168 | - $query = "SELECT spotter_archive.* FROM spotter_archive WHERE ident = :ident ORDER BY date DESC LIMIT 1"; |
|
168 | + $query = "SELECT spotter_archive.* FROM spotter_archive WHERE ident = :ident ORDER BY date DESC LIMIT 1"; |
|
169 | 169 | |
170 | - $spotter_array = $Spotter->getDataFromDB($query,array(':ident' => $ident)); |
|
170 | + $spotter_array = $Spotter->getDataFromDB($query, array(':ident' => $ident)); |
|
171 | 171 | |
172 | 172 | return $spotter_array; |
173 | 173 | } |
@@ -186,7 +186,7 @@ discard block |
||
186 | 186 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
187 | 187 | //$query = SpotterArchive->$global_query." WHERE spotter_archive.flightaware_id = :id"; |
188 | 188 | //$query = "SELECT spotter_archive.* FROM spotter_archive INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_archive l WHERE l.flightaware_id = :id GROUP BY l.flightaware_id) s on spotter_archive.flightaware_id = s.flightaware_id AND spotter_archive.date = s.maxdate LIMIT 1"; |
189 | - $query = "SELECT * FROM spotter_archive WHERE flightaware_id = :id ORDER BY date DESC LIMIT 1"; |
|
189 | + $query = "SELECT * FROM spotter_archive WHERE flightaware_id = :id ORDER BY date DESC LIMIT 1"; |
|
190 | 190 | |
191 | 191 | // $spotter_array = Spotter->getDataFromDB($query,array(':id' => $id)); |
192 | 192 | /* |
@@ -199,7 +199,7 @@ discard block |
||
199 | 199 | } |
200 | 200 | $spotter_array = $sth->fetchAll(PDO->FETCH_ASSOC); |
201 | 201 | */ |
202 | - $spotter_array = $Spotter->getDataFromDB($query,array(':id' => $id)); |
|
202 | + $spotter_array = $Spotter->getDataFromDB($query, array(':id' => $id)); |
|
203 | 203 | |
204 | 204 | return $spotter_array; |
205 | 205 | } |
@@ -214,14 +214,14 @@ discard block |
||
214 | 214 | { |
215 | 215 | date_default_timezone_set('UTC'); |
216 | 216 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
217 | - $query = $this->global_query." WHERE spotter_archive.flightaware_id = :id ORDER BY date"; |
|
217 | + $query = $this->global_query." WHERE spotter_archive.flightaware_id = :id ORDER BY date"; |
|
218 | 218 | |
219 | 219 | // $spotter_array = Spotter->getDataFromDB($query,array(':id' => $id)); |
220 | 220 | |
221 | 221 | try { |
222 | 222 | $sth = $this->db->prepare($query); |
223 | 223 | $sth->execute(array(':id' => $id)); |
224 | - } catch(PDOException $e) { |
|
224 | + } catch (PDOException $e) { |
|
225 | 225 | echo $e->getMessage(); |
226 | 226 | die; |
227 | 227 | } |
@@ -240,14 +240,14 @@ discard block |
||
240 | 240 | { |
241 | 241 | date_default_timezone_set('UTC'); |
242 | 242 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
243 | - $query = "SELECT spotter_archive.latitude, spotter_archive.longitude, spotter_archive.date FROM spotter_archive WHERE spotter_archive.flightaware_id = :id"; |
|
243 | + $query = "SELECT spotter_archive.latitude, spotter_archive.longitude, spotter_archive.date FROM spotter_archive WHERE spotter_archive.flightaware_id = :id"; |
|
244 | 244 | |
245 | 245 | // $spotter_array = Spotter->getDataFromDB($query,array(':id' => $id)); |
246 | 246 | |
247 | 247 | try { |
248 | 248 | $sth = $this->db->prepare($query); |
249 | 249 | $sth->execute(array(':id' => $id)); |
250 | - } catch(PDOException $e) { |
|
250 | + } catch (PDOException $e) { |
|
251 | 251 | echo $e->getMessage(); |
252 | 252 | die; |
253 | 253 | } |
@@ -269,12 +269,12 @@ discard block |
||
269 | 269 | date_default_timezone_set('UTC'); |
270 | 270 | |
271 | 271 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
272 | - $query = "SELECT spotter_archive.altitude, spotter_archive.date FROM spotter_archive WHERE spotter_archive.ident = :ident AND spotter_archive.latitude <> 0 AND spotter_archive.longitude <> 0 ORDER BY date"; |
|
272 | + $query = "SELECT spotter_archive.altitude, spotter_archive.date FROM spotter_archive WHERE spotter_archive.ident = :ident AND spotter_archive.latitude <> 0 AND spotter_archive.longitude <> 0 ORDER BY date"; |
|
273 | 273 | |
274 | 274 | try { |
275 | 275 | $sth = $this->db->prepare($query); |
276 | 276 | $sth->execute(array(':ident' => $ident)); |
277 | - } catch(PDOException $e) { |
|
277 | + } catch (PDOException $e) { |
|
278 | 278 | echo $e->getMessage(); |
279 | 279 | die; |
280 | 280 | } |
@@ -295,12 +295,12 @@ discard block |
||
295 | 295 | date_default_timezone_set('UTC'); |
296 | 296 | |
297 | 297 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
298 | - $query = "SELECT spotter_archive.altitude, spotter_archive.date FROM spotter_archive WHERE spotter_archive.flightaware_id = :id AND spotter_archive.latitude <> 0 AND spotter_archive.longitude <> 0 ORDER BY date"; |
|
298 | + $query = "SELECT spotter_archive.altitude, spotter_archive.date FROM spotter_archive WHERE spotter_archive.flightaware_id = :id AND spotter_archive.latitude <> 0 AND spotter_archive.longitude <> 0 ORDER BY date"; |
|
299 | 299 | |
300 | 300 | try { |
301 | 301 | $sth = $this->db->prepare($query); |
302 | 302 | $sth->execute(array(':id' => $id)); |
303 | - } catch(PDOException $e) { |
|
303 | + } catch (PDOException $e) { |
|
304 | 304 | echo $e->getMessage(); |
305 | 305 | die; |
306 | 306 | } |
@@ -321,12 +321,12 @@ discard block |
||
321 | 321 | date_default_timezone_set('UTC'); |
322 | 322 | |
323 | 323 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
324 | - $query = "SELECT spotter_archive.altitude, spotter_archive.real_altitude,spotter_archive.ground_speed, spotter_archive.date FROM spotter_archive WHERE spotter_archive.flightaware_id = :id ORDER BY date"; |
|
324 | + $query = "SELECT spotter_archive.altitude, spotter_archive.real_altitude,spotter_archive.ground_speed, spotter_archive.date FROM spotter_archive WHERE spotter_archive.flightaware_id = :id ORDER BY date"; |
|
325 | 325 | |
326 | 326 | try { |
327 | 327 | $sth = $this->db->prepare($query); |
328 | 328 | $sth->execute(array(':id' => $id)); |
329 | - } catch(PDOException $e) { |
|
329 | + } catch (PDOException $e) { |
|
330 | 330 | echo $e->getMessage(); |
331 | 331 | die; |
332 | 332 | } |
@@ -348,13 +348,13 @@ discard block |
||
348 | 348 | date_default_timezone_set('UTC'); |
349 | 349 | |
350 | 350 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
351 | - $query = "SELECT spotter_archive.altitude, spotter_archive.date FROM spotter_archive INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_archive l WHERE l.ident = :ident GROUP BY l.flightaware_id) s on spotter_archive.flightaware_id = s.flightaware_id AND spotter_archive.date = s.maxdate LIMIT 1"; |
|
351 | + $query = "SELECT spotter_archive.altitude, spotter_archive.date FROM spotter_archive INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_archive l WHERE l.ident = :ident GROUP BY l.flightaware_id) s on spotter_archive.flightaware_id = s.flightaware_id AND spotter_archive.date = s.maxdate LIMIT 1"; |
|
352 | 352 | // $query = "SELECT spotter_archive.altitude, spotter_archive.date FROM spotter_archive WHERE spotter_archive.ident = :ident"; |
353 | 353 | |
354 | 354 | try { |
355 | 355 | $sth = $this->db->prepare($query); |
356 | 356 | $sth->execute(array(':ident' => $ident)); |
357 | - } catch(PDOException $e) { |
|
357 | + } catch (PDOException $e) { |
|
358 | 358 | echo $e->getMessage(); |
359 | 359 | die; |
360 | 360 | } |
@@ -371,13 +371,13 @@ discard block |
||
371 | 371 | * @return Array the spotter information |
372 | 372 | * |
373 | 373 | */ |
374 | - public function getSpotterArchiveData($ident,$flightaware_id,$date) |
|
374 | + public function getSpotterArchiveData($ident, $flightaware_id, $date) |
|
375 | 375 | { |
376 | 376 | $Spotter = new Spotter($this->db); |
377 | 377 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
378 | - $query = "SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.ident = :ident AND l.flightaware_id = :flightaware_id AND l.date LIKE :date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate"; |
|
378 | + $query = "SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.ident = :ident AND l.flightaware_id = :flightaware_id AND l.date LIKE :date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate"; |
|
379 | 379 | |
380 | - $spotter_array = $Spotter->getDataFromDB($query,array(':ident' => $ident,':flightaware_id' => $flightaware_id,':date' => $date.'%')); |
|
380 | + $spotter_array = $Spotter->getDataFromDB($query, array(':ident' => $ident, ':flightaware_id' => $flightaware_id, ':date' => $date.'%')); |
|
381 | 381 | |
382 | 382 | return $spotter_array; |
383 | 383 | } |
@@ -393,7 +393,7 @@ discard block |
||
393 | 393 | try { |
394 | 394 | $sth = $this->db->prepare($query); |
395 | 395 | $sth->execute(); |
396 | - } catch(PDOException $e) { |
|
396 | + } catch (PDOException $e) { |
|
397 | 397 | echo $e->getMessage(); |
398 | 398 | die; |
399 | 399 | } |
@@ -405,24 +405,24 @@ discard block |
||
405 | 405 | * @return Array the spotter information |
406 | 406 | * |
407 | 407 | */ |
408 | - public function getMinLiveSpotterData($begindate,$enddate,$filter = array()) |
|
408 | + public function getMinLiveSpotterData($begindate, $enddate, $filter = array()) |
|
409 | 409 | { |
410 | 410 | global $globalDBdriver, $globalLiveInterval; |
411 | 411 | date_default_timezone_set('UTC'); |
412 | 412 | |
413 | 413 | $filter_query = ''; |
414 | 414 | if (isset($filter['source']) && !empty($filter['source'])) { |
415 | - $filter_query .= " AND format_source IN ('".implode("','",$filter['source'])."') "; |
|
415 | + $filter_query .= " AND format_source IN ('".implode("','", $filter['source'])."') "; |
|
416 | 416 | } |
417 | 417 | // Use spotter_output also ? |
418 | 418 | if (isset($filter['airlines']) && !empty($filter['airlines'])) { |
419 | - $filter_query .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.airline_icao IN ('".implode("','",$filter['airlines'])."')) so ON so.flightaware_id = spotter_archive.flightaware_id "; |
|
419 | + $filter_query .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.airline_icao IN ('".implode("','", $filter['airlines'])."')) so ON so.flightaware_id = spotter_archive.flightaware_id "; |
|
420 | 420 | } |
421 | 421 | if (isset($filter['airlinestype']) && !empty($filter['airlinestype'])) { |
422 | 422 | $filter_query .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.airline_type = '".$filter['airlinestype']."') sa ON sa.flightaware_id = spotter_archive.flightaware_id "; |
423 | 423 | } |
424 | 424 | if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) { |
425 | - $filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')"; |
|
425 | + $filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','", $filter['source_aprs'])."')"; |
|
426 | 426 | } |
427 | 427 | |
428 | 428 | //if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
@@ -441,14 +441,14 @@ discard block |
||
441 | 441 | GROUP BY l.flightaware_id) s on spotter_archive.flightaware_id = s.flightaware_id |
442 | 442 | AND spotter_archive.date = s.maxdate '.$filter_query.'LEFT JOIN (SELECT aircraft_shadow,icao FROM aircraft) a ON spotter_archive.aircraft_icao = a.icao'; |
443 | 443 | */ |
444 | - $query = 'SELECT spotter_archive.date,spotter_archive.flightaware_id, spotter_archive.ident, spotter_archive.aircraft_icao, spotter_archive.departure_airport_icao as departure_airport, spotter_archive.arrival_airport_icao as arrival_airport, spotter_archive.latitude, spotter_archive.longitude, spotter_archive.altitude, spotter_archive.heading, spotter_archive.ground_speed, spotter_archive.squawk, a.aircraft_shadow,a.engine_type, a.engine_count, a.wake_category |
|
444 | + $query = 'SELECT spotter_archive.date,spotter_archive.flightaware_id, spotter_archive.ident, spotter_archive.aircraft_icao, spotter_archive.departure_airport_icao as departure_airport, spotter_archive.arrival_airport_icao as arrival_airport, spotter_archive.latitude, spotter_archive.longitude, spotter_archive.altitude, spotter_archive.heading, spotter_archive.ground_speed, spotter_archive.squawk, a.aircraft_shadow,a.engine_type, a.engine_count, a.wake_category |
|
445 | 445 | FROM spotter_archive |
446 | 446 | INNER JOIN (SELECT * FROM aircraft) a on spotter_archive.aircraft_icao = a.icao |
447 | 447 | WHERE spotter_archive.date BETWEEN '."'".$begindate."'".' AND '."'".$begindate."'".' |
448 | 448 | '.$filter_query.' ORDER BY flightaware_id'; |
449 | 449 | } else { |
450 | 450 | //$query = '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, a.aircraft_shadow FROM spotter_archive INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_archive l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.flightaware_id) s on spotter_archive.flightaware_id = s.flightaware_id AND spotter_archive.date = s.maxdate '.$filter_query.'INNER JOIN (SELECT * FROM aircraft) a on spotter_archive.aircraft_icao = a.icao'; |
451 | - $query = 'SELECT spotter_archive.date,spotter_archive.flightaware_id, spotter_archive.ident, spotter_archive.aircraft_icao, spotter_archive.departure_airport_icao as departure_airport, spotter_archive.arrival_airport_icao as arrival_airport, spotter_archive.latitude, spotter_archive.longitude, spotter_archive.altitude, spotter_archive.heading, spotter_archive.ground_speed, spotter_archive.squawk, a.aircraft_shadow,a.engine_type, a.engine_count, a.wake_category |
|
451 | + $query = 'SELECT spotter_archive.date,spotter_archive.flightaware_id, spotter_archive.ident, spotter_archive.aircraft_icao, spotter_archive.departure_airport_icao as departure_airport, spotter_archive.arrival_airport_icao as arrival_airport, spotter_archive.latitude, spotter_archive.longitude, spotter_archive.altitude, spotter_archive.heading, spotter_archive.ground_speed, spotter_archive.squawk, a.aircraft_shadow,a.engine_type, a.engine_count, a.wake_category |
|
452 | 452 | FROM spotter_archive |
453 | 453 | INNER JOIN (SELECT * FROM aircraft) a on spotter_archive.aircraft_icao = a.icao |
454 | 454 | WHERE spotter_archive.date >= '."'".$begindate."'".' AND spotter_archive.date <= '."'".$enddate."'".' |
@@ -458,7 +458,7 @@ discard block |
||
458 | 458 | try { |
459 | 459 | $sth = $this->db->prepare($query); |
460 | 460 | $sth->execute(); |
461 | - } catch(PDOException $e) { |
|
461 | + } catch (PDOException $e) { |
|
462 | 462 | echo $e->getMessage(); |
463 | 463 | die; |
464 | 464 | } |
@@ -473,24 +473,24 @@ discard block |
||
473 | 473 | * @return Array the spotter information |
474 | 474 | * |
475 | 475 | */ |
476 | - public function getMinLiveSpotterDataPlayback($begindate,$enddate,$filter = array()) |
|
476 | + public function getMinLiveSpotterDataPlayback($begindate, $enddate, $filter = array()) |
|
477 | 477 | { |
478 | 478 | global $globalDBdriver, $globalLiveInterval; |
479 | 479 | date_default_timezone_set('UTC'); |
480 | 480 | |
481 | 481 | $filter_query = ''; |
482 | 482 | if (isset($filter['source']) && !empty($filter['source'])) { |
483 | - $filter_query .= " AND format_source IN ('".implode("','",$filter['source'])."') "; |
|
483 | + $filter_query .= " AND format_source IN ('".implode("','", $filter['source'])."') "; |
|
484 | 484 | } |
485 | 485 | // Should use spotter_output also ? |
486 | 486 | if (isset($filter['airlines']) && !empty($filter['airlines'])) { |
487 | - $filter_query .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.airline_icao IN ('".implode("','",$filter['airlines'])."')) so ON so.flightaware_id = spotter_archive.flightaware_id "; |
|
487 | + $filter_query .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.airline_icao IN ('".implode("','", $filter['airlines'])."')) so ON so.flightaware_id = spotter_archive.flightaware_id "; |
|
488 | 488 | } |
489 | 489 | if (isset($filter['airlinestype']) && !empty($filter['airlinestype'])) { |
490 | 490 | $filter_query .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.airline_type = '".$filter['airlinestype']."') sa ON sa.flightaware_id = spotter_archive.flightaware_id "; |
491 | 491 | } |
492 | 492 | if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) { |
493 | - $filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')"; |
|
493 | + $filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','", $filter['source_aprs'])."')"; |
|
494 | 494 | } |
495 | 495 | |
496 | 496 | //if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
@@ -500,7 +500,7 @@ discard block |
||
500 | 500 | FROM spotter_archive |
501 | 501 | INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_archive l WHERE (l.date BETWEEN '."'".$begindate."'".' AND '."'".$enddate."'".') GROUP BY l.flightaware_id) s on spotter_archive.flightaware_id = s.flightaware_id AND spotter_archive.date = s.maxdate '.$filter_query.'LEFT JOIN (SELECT aircraft_shadow,icao FROM aircraft) a ON spotter_archive.aircraft_icao = a.icao'; |
502 | 502 | */ |
503 | - $query = 'SELECT a.aircraft_shadow, spotter_archive_output.ident, spotter_archive_output.flightaware_id, spotter_archive_output.aircraft_icao, spotter_archive_output.departure_airport_icao as departure_airport, spotter_archive_output.arrival_airport_icao as arrival_airport, spotter_archive_output.latitude, spotter_archive_output.longitude, spotter_archive_output.altitude, spotter_archive_output.heading, spotter_archive_output.ground_speed, spotter_archive_output.squawk |
|
503 | + $query = 'SELECT a.aircraft_shadow, spotter_archive_output.ident, spotter_archive_output.flightaware_id, spotter_archive_output.aircraft_icao, spotter_archive_output.departure_airport_icao as departure_airport, spotter_archive_output.arrival_airport_icao as arrival_airport, spotter_archive_output.latitude, spotter_archive_output.longitude, spotter_archive_output.altitude, spotter_archive_output.heading, spotter_archive_output.ground_speed, spotter_archive_output.squawk |
|
504 | 504 | FROM spotter_archive_output |
505 | 505 | LEFT JOIN (SELECT aircraft_shadow,icao FROM aircraft) a ON spotter_archive_output.aircraft_icao = a.icao |
506 | 506 | WHERE (spotter_archive_output.date BETWEEN '."'".$begindate."'".' AND '."'".$enddate."'".') |
@@ -515,7 +515,7 @@ discard block |
||
515 | 515 | WHERE spotter_archive_output.date >= '."'".$begindate."'".' AND spotter_archive_output.date <= '."'".$enddate."'".' |
516 | 516 | '.$filter_query.' GROUP BY spotter_archive_output.flightaware_id, spotter_archive_output.ident, spotter_archive_output.aircraft_icao, spotter_archive_output.departure_airport_icao, spotter_archive_output.arrival_airport_icao, spotter_archive_output.latitude, spotter_archive_output.longitude, spotter_archive_output.altitude, spotter_archive_output.heading, spotter_archive_output.ground_speed, spotter_archive_output.squawk, a.aircraft_shadow'; |
517 | 517 | */ |
518 | - $query = 'SELECT DISTINCT spotter_archive_output.flightaware_id, spotter_archive_output.ident, spotter_archive_output.aircraft_icao, spotter_archive_output.departure_airport_icao as departure_airport, spotter_archive_output.arrival_airport_icao as arrival_airport, spotter_archive_output.latitude, spotter_archive_output.longitude, spotter_archive_output.altitude, spotter_archive_output.heading, spotter_archive_output.ground_speed, spotter_archive_output.squawk, a.aircraft_shadow |
|
518 | + $query = 'SELECT DISTINCT spotter_archive_output.flightaware_id, spotter_archive_output.ident, spotter_archive_output.aircraft_icao, spotter_archive_output.departure_airport_icao as departure_airport, spotter_archive_output.arrival_airport_icao as arrival_airport, spotter_archive_output.latitude, spotter_archive_output.longitude, spotter_archive_output.altitude, spotter_archive_output.heading, spotter_archive_output.ground_speed, spotter_archive_output.squawk, a.aircraft_shadow |
|
519 | 519 | FROM spotter_archive_output |
520 | 520 | INNER JOIN (SELECT * FROM aircraft) a on spotter_archive_output.aircraft_icao = a.icao |
521 | 521 | WHERE spotter_archive_output.date >= '."'".$begindate."'".' AND spotter_archive_output.date <= '."'".$enddate."'".' |
@@ -527,7 +527,7 @@ discard block |
||
527 | 527 | try { |
528 | 528 | $sth = $this->db->prepare($query); |
529 | 529 | $sth->execute(); |
530 | - } catch(PDOException $e) { |
|
530 | + } catch (PDOException $e) { |
|
531 | 531 | echo $e->getMessage(); |
532 | 532 | die; |
533 | 533 | } |
@@ -542,23 +542,23 @@ discard block |
||
542 | 542 | * @return Array the spotter information |
543 | 543 | * |
544 | 544 | */ |
545 | - public function getLiveSpotterCount($begindate,$enddate,$filter = array()) |
|
545 | + public function getLiveSpotterCount($begindate, $enddate, $filter = array()) |
|
546 | 546 | { |
547 | 547 | global $globalDBdriver, $globalLiveInterval; |
548 | 548 | date_default_timezone_set('UTC'); |
549 | 549 | |
550 | 550 | $filter_query = ''; |
551 | 551 | if (isset($filter['source']) && !empty($filter['source'])) { |
552 | - $filter_query .= " AND format_source IN ('".implode("','",$filter['source'])."') "; |
|
552 | + $filter_query .= " AND format_source IN ('".implode("','", $filter['source'])."') "; |
|
553 | 553 | } |
554 | 554 | if (isset($filter['airlines']) && !empty($filter['airlines'])) { |
555 | - $filter_query .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','",$filter['airlines'])."')) so ON so.flightaware_id = spotter_archive.flightaware_id "; |
|
555 | + $filter_query .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','", $filter['airlines'])."')) so ON so.flightaware_id = spotter_archive.flightaware_id "; |
|
556 | 556 | } |
557 | 557 | if (isset($filter['airlinestype']) && !empty($filter['airlinestype'])) { |
558 | 558 | $filter_query .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_type = '".$filter['airlinestype']."') sa ON sa.flightaware_id = spotter_archive.flightaware_id "; |
559 | 559 | } |
560 | 560 | if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) { |
561 | - $filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')"; |
|
561 | + $filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','", $filter['source_aprs'])."')"; |
|
562 | 562 | } |
563 | 563 | |
564 | 564 | //if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
@@ -573,7 +573,7 @@ discard block |
||
573 | 573 | try { |
574 | 574 | $sth = $this->db->prepare($query); |
575 | 575 | $sth->execute(); |
576 | - } catch(PDOException $e) { |
|
576 | + } catch (PDOException $e) { |
|
577 | 577 | echo $e->getMessage(); |
578 | 578 | die; |
579 | 579 | } |
@@ -593,7 +593,7 @@ discard block |
||
593 | 593 | * @return Array the spotter information |
594 | 594 | * |
595 | 595 | */ |
596 | - public function searchSpotterData($q = '', $registration = '', $aircraft_icao = '', $aircraft_manufacturer = '', $highlights = '', $airline_icao = '', $airline_country = '', $airline_type = '', $airport = '', $airport_country = '', $callsign = '', $departure_airport_route = '', $arrival_airport_route = '', $owner = '',$pilot_id = '',$pilot_name = '',$altitude = '', $date_posted = '', $limit = '', $sort = '', $includegeodata = '',$origLat = '',$origLon = '',$dist = '', $filters=array()) |
|
596 | + public function searchSpotterData($q = '', $registration = '', $aircraft_icao = '', $aircraft_manufacturer = '', $highlights = '', $airline_icao = '', $airline_country = '', $airline_type = '', $airport = '', $airport_country = '', $callsign = '', $departure_airport_route = '', $arrival_airport_route = '', $owner = '', $pilot_id = '', $pilot_name = '', $altitude = '', $date_posted = '', $limit = '', $sort = '', $includegeodata = '', $origLat = '', $origLon = '', $dist = '', $filters = array()) |
|
597 | 597 | { |
598 | 598 | global $globalTimezone, $globalDBdriver; |
599 | 599 | require_once(dirname(__FILE__).'/class.Translation.php'); |
@@ -615,7 +615,7 @@ discard block |
||
615 | 615 | |
616 | 616 | $q_array = explode(" ", $q); |
617 | 617 | |
618 | - foreach ($q_array as $q_item){ |
|
618 | + foreach ($q_array as $q_item) { |
|
619 | 619 | $additional_query .= " AND ("; |
620 | 620 | $additional_query .= "(spotter_archive_output.spotter_id like '%".$q_item."%') OR "; |
621 | 621 | $additional_query .= "(spotter_archive_output.aircraft_icao like '%".$q_item."%') OR "; |
@@ -647,7 +647,7 @@ discard block |
||
647 | 647 | |
648 | 648 | if ($registration != "") |
649 | 649 | { |
650 | - $registration = filter_var($registration,FILTER_SANITIZE_STRING); |
|
650 | + $registration = filter_var($registration, FILTER_SANITIZE_STRING); |
|
651 | 651 | if (!is_string($registration)) |
652 | 652 | { |
653 | 653 | return false; |
@@ -658,7 +658,7 @@ discard block |
||
658 | 658 | |
659 | 659 | if ($aircraft_icao != "") |
660 | 660 | { |
661 | - $aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING); |
|
661 | + $aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING); |
|
662 | 662 | if (!is_string($aircraft_icao)) |
663 | 663 | { |
664 | 664 | return false; |
@@ -669,7 +669,7 @@ discard block |
||
669 | 669 | |
670 | 670 | if ($aircraft_manufacturer != "") |
671 | 671 | { |
672 | - $aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING); |
|
672 | + $aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING); |
|
673 | 673 | if (!is_string($aircraft_manufacturer)) |
674 | 674 | { |
675 | 675 | return false; |
@@ -690,7 +690,7 @@ discard block |
||
690 | 690 | |
691 | 691 | if ($airline_icao != "") |
692 | 692 | { |
693 | - $airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING); |
|
693 | + $airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING); |
|
694 | 694 | if (!is_string($airline_icao)) |
695 | 695 | { |
696 | 696 | return false; |
@@ -701,7 +701,7 @@ discard block |
||
701 | 701 | |
702 | 702 | if ($airline_country != "") |
703 | 703 | { |
704 | - $airline_country = filter_var($airline_country,FILTER_SANITIZE_STRING); |
|
704 | + $airline_country = filter_var($airline_country, FILTER_SANITIZE_STRING); |
|
705 | 705 | if (!is_string($airline_country)) |
706 | 706 | { |
707 | 707 | return false; |
@@ -712,7 +712,7 @@ discard block |
||
712 | 712 | |
713 | 713 | if ($airline_type != "") |
714 | 714 | { |
715 | - $airline_type = filter_var($airline_type,FILTER_SANITIZE_STRING); |
|
715 | + $airline_type = filter_var($airline_type, FILTER_SANITIZE_STRING); |
|
716 | 716 | if (!is_string($airline_type)) |
717 | 717 | { |
718 | 718 | return false; |
@@ -734,7 +734,7 @@ discard block |
||
734 | 734 | |
735 | 735 | if ($airport != "") |
736 | 736 | { |
737 | - $airport = filter_var($airport,FILTER_SANITIZE_STRING); |
|
737 | + $airport = filter_var($airport, FILTER_SANITIZE_STRING); |
|
738 | 738 | if (!is_string($airport)) |
739 | 739 | { |
740 | 740 | return false; |
@@ -745,7 +745,7 @@ discard block |
||
745 | 745 | |
746 | 746 | if ($airport_country != "") |
747 | 747 | { |
748 | - $airport_country = filter_var($airport_country,FILTER_SANITIZE_STRING); |
|
748 | + $airport_country = filter_var($airport_country, FILTER_SANITIZE_STRING); |
|
749 | 749 | if (!is_string($airport_country)) |
750 | 750 | { |
751 | 751 | return false; |
@@ -756,7 +756,7 @@ discard block |
||
756 | 756 | |
757 | 757 | if ($callsign != "") |
758 | 758 | { |
759 | - $callsign = filter_var($callsign,FILTER_SANITIZE_STRING); |
|
759 | + $callsign = filter_var($callsign, FILTER_SANITIZE_STRING); |
|
760 | 760 | if (!is_string($callsign)) |
761 | 761 | { |
762 | 762 | return false; |
@@ -764,7 +764,7 @@ discard block |
||
764 | 764 | $translate = $Translation->ident2icao($callsign); |
765 | 765 | if ($translate != $callsign) { |
766 | 766 | $additional_query .= " AND (spotter_archive_output.ident = :callsign OR spotter_archive_output.ident = :translate)"; |
767 | - $query_values = array_merge($query_values,array(':callsign' => $callsign,':translate' => $translate)); |
|
767 | + $query_values = array_merge($query_values, array(':callsign' => $callsign, ':translate' => $translate)); |
|
768 | 768 | } else { |
769 | 769 | $additional_query .= " AND (spotter_archive_output.ident = '".$callsign."')"; |
770 | 770 | } |
@@ -773,7 +773,7 @@ discard block |
||
773 | 773 | |
774 | 774 | if ($owner != "") |
775 | 775 | { |
776 | - $owner = filter_var($owner,FILTER_SANITIZE_STRING); |
|
776 | + $owner = filter_var($owner, FILTER_SANITIZE_STRING); |
|
777 | 777 | if (!is_string($owner)) |
778 | 778 | { |
779 | 779 | return false; |
@@ -784,7 +784,7 @@ discard block |
||
784 | 784 | |
785 | 785 | if ($pilot_name != "") |
786 | 786 | { |
787 | - $pilot_name = filter_var($pilot_name,FILTER_SANITIZE_STRING); |
|
787 | + $pilot_name = filter_var($pilot_name, FILTER_SANITIZE_STRING); |
|
788 | 788 | if (!is_string($pilot_name)) |
789 | 789 | { |
790 | 790 | return false; |
@@ -795,7 +795,7 @@ discard block |
||
795 | 795 | |
796 | 796 | if ($pilot_id != "") |
797 | 797 | { |
798 | - $pilot_id = filter_var($pilot_id,FILTER_SANITIZE_NUMBER_INT); |
|
798 | + $pilot_id = filter_var($pilot_id, FILTER_SANITIZE_NUMBER_INT); |
|
799 | 799 | if (!is_string($pilot_id)) |
800 | 800 | { |
801 | 801 | return false; |
@@ -806,7 +806,7 @@ discard block |
||
806 | 806 | |
807 | 807 | if ($departure_airport_route != "") |
808 | 808 | { |
809 | - $departure_airport_route = filter_var($departure_airport_route,FILTER_SANITIZE_STRING); |
|
809 | + $departure_airport_route = filter_var($departure_airport_route, FILTER_SANITIZE_STRING); |
|
810 | 810 | if (!is_string($departure_airport_route)) |
811 | 811 | { |
812 | 812 | return false; |
@@ -817,7 +817,7 @@ discard block |
||
817 | 817 | |
818 | 818 | if ($arrival_airport_route != "") |
819 | 819 | { |
820 | - $arrival_airport_route = filter_var($arrival_airport_route,FILTER_SANITIZE_STRING); |
|
820 | + $arrival_airport_route = filter_var($arrival_airport_route, FILTER_SANITIZE_STRING); |
|
821 | 821 | if (!is_string($arrival_airport_route)) |
822 | 822 | { |
823 | 823 | return false; |
@@ -830,8 +830,8 @@ discard block |
||
830 | 830 | { |
831 | 831 | $altitude_array = explode(",", $altitude); |
832 | 832 | |
833 | - $altitude_array[0] = filter_var($altitude_array[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
834 | - $altitude_array[1] = filter_var($altitude_array[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
833 | + $altitude_array[0] = filter_var($altitude_array[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
834 | + $altitude_array[1] = filter_var($altitude_array[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
835 | 835 | |
836 | 836 | |
837 | 837 | if ($altitude_array[1] != "") |
@@ -849,8 +849,8 @@ discard block |
||
849 | 849 | { |
850 | 850 | $date_array = explode(",", $date_posted); |
851 | 851 | |
852 | - $date_array[0] = filter_var($date_array[0],FILTER_SANITIZE_STRING); |
|
853 | - $date_array[1] = filter_var($date_array[1],FILTER_SANITIZE_STRING); |
|
852 | + $date_array[0] = filter_var($date_array[0], FILTER_SANITIZE_STRING); |
|
853 | + $date_array[1] = filter_var($date_array[1], FILTER_SANITIZE_STRING); |
|
854 | 854 | |
855 | 855 | if ($globalTimezone != '') { |
856 | 856 | date_default_timezone_set($globalTimezone); |
@@ -882,8 +882,8 @@ discard block |
||
882 | 882 | { |
883 | 883 | $limit_array = explode(",", $limit); |
884 | 884 | |
885 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
886 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
885 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
886 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
887 | 887 | |
888 | 888 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
889 | 889 | { |
@@ -894,8 +894,8 @@ discard block |
||
894 | 894 | |
895 | 895 | |
896 | 896 | if ($origLat != "" && $origLon != "" && $dist != "") { |
897 | - $dist = number_format($dist*0.621371,2,'.',''); |
|
898 | - $query="SELECT spotter_archive_output.*, 3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - ABS(CAST(spotter_archive.latitude as double precision)))*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(ABS(CAST(spotter_archive.latitude as double precision))*pi()/180)*POWER(SIN(($origLon-CAST(spotter_archive.longitude as double precision))*pi()/180/2),2))) as distance |
|
897 | + $dist = number_format($dist*0.621371, 2, '.', ''); |
|
898 | + $query = "SELECT spotter_archive_output.*, 3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - ABS(CAST(spotter_archive.latitude as double precision)))*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(ABS(CAST(spotter_archive.latitude as double precision))*pi()/180)*POWER(SIN(($origLon-CAST(spotter_archive.longitude as double precision))*pi()/180/2),2))) as distance |
|
899 | 899 | FROM spotter_archive_output, spotter_archive WHERE spotter_output_archive.flightaware_id = spotter_archive.flightaware_id AND spotter_output.ident <> '' ".$additional_query."AND CAST(spotter_archive.longitude as double precision) between ($origLon-$dist/ABS(cos(radians($origLat))*69)) and ($origLon+$dist/ABS(cos(radians($origLat))*69)) and CAST(spotter_archive.latitude as double precision) between ($origLat-($dist/69)) and ($origLat+($dist/69)) |
900 | 900 | AND (3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - ABS(CAST(spotter_archive.latitude as double precision)))*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(ABS(CAST(spotter_archive.latitude as double precision))*pi()/180)*POWER(SIN(($origLon-CAST(spotter_archive.longitude as double precision))*pi()/180/2),2)))) < $dist".$filter_query." ORDER BY distance"; |
901 | 901 | } else { |
@@ -912,12 +912,12 @@ discard block |
||
912 | 912 | $additional_query .= " AND (spotter_archive_output.waypoints <> '')"; |
913 | 913 | } |
914 | 914 | |
915 | - $query = "SELECT spotter_archive_output.* FROM spotter_archive_output |
|
915 | + $query = "SELECT spotter_archive_output.* FROM spotter_archive_output |
|
916 | 916 | WHERE spotter_archive_output.ident <> '' |
917 | 917 | ".$additional_query." |
918 | 918 | ".$filter_query.$orderby_query; |
919 | 919 | } |
920 | - $spotter_array = $Spotter->getDataFromDB($query, $query_values,$limit_query); |
|
920 | + $spotter_array = $Spotter->getDataFromDB($query, $query_values, $limit_query); |
|
921 | 921 | |
922 | 922 | return $spotter_array; |
923 | 923 | } |
@@ -934,7 +934,7 @@ discard block |
||
934 | 934 | try { |
935 | 935 | $sth = $this->db->prepare($query); |
936 | 936 | $sth->execute(); |
937 | - } catch(PDOException $e) { |
|
937 | + } catch (PDOException $e) { |
|
938 | 938 | return "error"; |
939 | 939 | } |
940 | 940 | } |
@@ -971,8 +971,8 @@ discard block |
||
971 | 971 | { |
972 | 972 | $limit_array = explode(",", $limit); |
973 | 973 | |
974 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
975 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
974 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
975 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
976 | 976 | |
977 | 977 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
978 | 978 | { |
@@ -1013,7 +1013,7 @@ discard block |
||
1013 | 1013 | $query_values = array(); |
1014 | 1014 | $limit_query = ''; |
1015 | 1015 | $additional_query = ''; |
1016 | - $filter_query = $this->getFilter($filter,true,true); |
|
1016 | + $filter_query = $this->getFilter($filter, true, true); |
|
1017 | 1017 | |
1018 | 1018 | if ($owner != "") |
1019 | 1019 | { |
@@ -1030,8 +1030,8 @@ discard block |
||
1030 | 1030 | { |
1031 | 1031 | $limit_array = explode(",", $limit); |
1032 | 1032 | |
1033 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
1034 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
1033 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
1034 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
1035 | 1035 | |
1036 | 1036 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
1037 | 1037 | { |
@@ -1071,7 +1071,7 @@ discard block |
||
1071 | 1071 | $query_values = array(); |
1072 | 1072 | $limit_query = ''; |
1073 | 1073 | $additional_query = ''; |
1074 | - $filter_query = $this->getFilter($filter,true,true); |
|
1074 | + $filter_query = $this->getFilter($filter, true, true); |
|
1075 | 1075 | |
1076 | 1076 | if ($pilot != "") |
1077 | 1077 | { |
@@ -1083,8 +1083,8 @@ discard block |
||
1083 | 1083 | { |
1084 | 1084 | $limit_array = explode(",", $limit); |
1085 | 1085 | |
1086 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
1087 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
1086 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
1087 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
1088 | 1088 | |
1089 | 1089 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
1090 | 1090 | { |
@@ -1114,7 +1114,7 @@ discard block |
||
1114 | 1114 | * @return Array the airline country list |
1115 | 1115 | * |
1116 | 1116 | */ |
1117 | - public function countAllFlightOverCountries($limit = true,$olderthanmonths = 0,$sincedate = '') |
|
1117 | + public function countAllFlightOverCountries($limit = true, $olderthanmonths = 0, $sincedate = '') |
|
1118 | 1118 | { |
1119 | 1119 | global $globalDBdriver; |
1120 | 1120 | /* |
@@ -1143,7 +1143,7 @@ discard block |
||
1143 | 1143 | $flight_array = array(); |
1144 | 1144 | $temp_array = array(); |
1145 | 1145 | |
1146 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1146 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1147 | 1147 | { |
1148 | 1148 | $temp_array['flight_count'] = $row['nb']; |
1149 | 1149 | $temp_array['flight_country'] = $row['name']; |
@@ -1160,7 +1160,7 @@ discard block |
||
1160 | 1160 | * @return Array the airline country list |
1161 | 1161 | * |
1162 | 1162 | */ |
1163 | - public function countAllFlightOverCountriesByAirlines($limit = true,$olderthanmonths = 0,$sincedate = '') |
|
1163 | + public function countAllFlightOverCountriesByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '') |
|
1164 | 1164 | { |
1165 | 1165 | global $globalDBdriver; |
1166 | 1166 | /* |
@@ -1189,7 +1189,7 @@ discard block |
||
1189 | 1189 | $flight_array = array(); |
1190 | 1190 | $temp_array = array(); |
1191 | 1191 | |
1192 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1192 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1193 | 1193 | { |
1194 | 1194 | $temp_array['airline_icao'] = $row['airline_icao']; |
1195 | 1195 | $temp_array['flight_count'] = $row['nb']; |
@@ -1207,14 +1207,14 @@ discard block |
||
1207 | 1207 | * @return Array the spotter information |
1208 | 1208 | * |
1209 | 1209 | */ |
1210 | - public function getDateArchiveSpotterDataById($id,$date) |
|
1210 | + public function getDateArchiveSpotterDataById($id, $date) |
|
1211 | 1211 | { |
1212 | 1212 | $Spotter = new Spotter($this->db); |
1213 | 1213 | date_default_timezone_set('UTC'); |
1214 | 1214 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
1215 | - $query = 'SELECT spotter_archive.* FROM spotter_archive INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_archive l WHERE l.flightaware_id = :id AND l.date <= :date GROUP BY l.flightaware_id) s on spotter_archive.flightaware_id = s.flightaware_id AND spotter_archive.date = s.maxdate ORDER BY spotter_archive.date DESC'; |
|
1216 | - $date = date('c',$date); |
|
1217 | - $spotter_array = $Spotter->getDataFromDB($query,array(':id' => $id,':date' => $date)); |
|
1215 | + $query = 'SELECT spotter_archive.* FROM spotter_archive INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_archive l WHERE l.flightaware_id = :id AND l.date <= :date GROUP BY l.flightaware_id) s on spotter_archive.flightaware_id = s.flightaware_id AND spotter_archive.date = s.maxdate ORDER BY spotter_archive.date DESC'; |
|
1216 | + $date = date('c', $date); |
|
1217 | + $spotter_array = $Spotter->getDataFromDB($query, array(':id' => $id, ':date' => $date)); |
|
1218 | 1218 | return $spotter_array; |
1219 | 1219 | } |
1220 | 1220 | |
@@ -1224,14 +1224,14 @@ discard block |
||
1224 | 1224 | * @return Array the spotter information |
1225 | 1225 | * |
1226 | 1226 | */ |
1227 | - public function getDateArchiveSpotterDataByIdent($ident,$date) |
|
1227 | + public function getDateArchiveSpotterDataByIdent($ident, $date) |
|
1228 | 1228 | { |
1229 | 1229 | $Spotter = new Spotter($this->db); |
1230 | 1230 | date_default_timezone_set('UTC'); |
1231 | 1231 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
1232 | - $query = 'SELECT spotter_archive.* FROM spotter_archive INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_archive l WHERE l.ident = :ident AND l.date <= :date GROUP BY l.flightaware_id) s on spotter_archive.flightaware_id = s.flightaware_id AND spotter_archive.date = s.maxdate ORDER BY spotter_archive.date DESC'; |
|
1233 | - $date = date('c',$date); |
|
1234 | - $spotter_array = $Spotter->getDataFromDB($query,array(':ident' => $ident,':date' => $date)); |
|
1232 | + $query = 'SELECT spotter_archive.* FROM spotter_archive INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_archive l WHERE l.ident = :ident AND l.date <= :date GROUP BY l.flightaware_id) s on spotter_archive.flightaware_id = s.flightaware_id AND spotter_archive.date = s.maxdate ORDER BY spotter_archive.date DESC'; |
|
1233 | + $date = date('c', $date); |
|
1234 | + $spotter_array = $Spotter->getDataFromDB($query, array(':ident' => $ident, ':date' => $date)); |
|
1235 | 1235 | return $spotter_array; |
1236 | 1236 | } |
1237 | 1237 | |
@@ -1241,7 +1241,7 @@ discard block |
||
1241 | 1241 | * @return Array the spotter information |
1242 | 1242 | * |
1243 | 1243 | */ |
1244 | - public function getSpotterDataByAirport($airport = '', $limit = '', $sort = '',$filters = array()) |
|
1244 | + public function getSpotterDataByAirport($airport = '', $limit = '', $sort = '', $filters = array()) |
|
1245 | 1245 | { |
1246 | 1246 | global $global_query; |
1247 | 1247 | $Spotter = new Spotter(); |
@@ -1249,7 +1249,7 @@ discard block |
||
1249 | 1249 | $query_values = array(); |
1250 | 1250 | $limit_query = ''; |
1251 | 1251 | $additional_query = ''; |
1252 | - $filter_query = $this->getFilter($filters,true,true); |
|
1252 | + $filter_query = $this->getFilter($filters, true, true); |
|
1253 | 1253 | |
1254 | 1254 | if ($airport != "") |
1255 | 1255 | { |
@@ -1266,8 +1266,8 @@ discard block |
||
1266 | 1266 | { |
1267 | 1267 | $limit_array = explode(",", $limit); |
1268 | 1268 | |
1269 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
1270 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
1269 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
1270 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
1271 | 1271 | |
1272 | 1272 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
1273 | 1273 | { |
@@ -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; |
@@ -35,29 +35,29 @@ discard block |
||
35 | 35 | |
36 | 36 | $page_url = $globalURL.'/owner/'.$_GET['owner']; |
37 | 37 | |
38 | - $owner = filter_input(INPUT_GET,'owner',FILTER_SANITIZE_STRING); |
|
39 | - $sort = filter_input(INPUT_GET,'sort',FILTER_SANITIZE_STRING); |
|
40 | - $year = filter_input(INPUT_GET,'year',FILTER_SANITIZE_NUMBER_INT); |
|
41 | - $month = filter_input(INPUT_GET,'month',FILTER_SANITIZE_NUMBER_INT); |
|
38 | + $owner = filter_input(INPUT_GET, 'owner', FILTER_SANITIZE_STRING); |
|
39 | + $sort = filter_input(INPUT_GET, 'sort', FILTER_SANITIZE_STRING); |
|
40 | + $year = filter_input(INPUT_GET, 'year', FILTER_SANITIZE_NUMBER_INT); |
|
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 != '') $filter = array_merge($filter, array('year' => $year)); |
|
44 | + if ($month != '') $filter = array_merge($filter, array('month' => $month)); |
|
45 | 45 | if ($sort != '') |
46 | 46 | { |
47 | - $spotter_array = $Spotter->getSpotterDataByOwner($owner,$limit_start.",".$absolute_difference, $sort,$filter); |
|
47 | + $spotter_array = $Spotter->getSpotterDataByOwner($owner, $limit_start.",".$absolute_difference, $sort, $filter); |
|
48 | 48 | if (empty($spotter_array)) { |
49 | - $spotter_array = $SpotterArchive->getSpotterDataByOwner($owner,$limit_start.",".$absolute_difference, $sort,$filter); |
|
49 | + $spotter_array = $SpotterArchive->getSpotterDataByOwner($owner, $limit_start.",".$absolute_difference, $sort, $filter); |
|
50 | 50 | } |
51 | 51 | } else { |
52 | - $spotter_array = $Spotter->getSpotterDataByOwner($owner,$limit_start.",".$absolute_difference,'',$filter); |
|
52 | + $spotter_array = $Spotter->getSpotterDataByOwner($owner, $limit_start.",".$absolute_difference, '', $filter); |
|
53 | 53 | if (empty($spotter_array)) { |
54 | - $spotter_array = $SpotterArchive->getSpotterDataByOwner($owner,$limit_start.",".$absolute_difference,'',$filter); |
|
54 | + $spotter_array = $SpotterArchive->getSpotterDataByOwner($owner, $limit_start.",".$absolute_difference, '', $filter); |
|
55 | 55 | } |
56 | 56 | } |
57 | 57 | |
58 | 58 | if (!empty($spotter_array)) |
59 | 59 | { |
60 | - $title = sprintf(_("Detailed View for %s"),$spotter_array[0]['aircraft_owner']); |
|
60 | + $title = sprintf(_("Detailed View for %s"), $spotter_array[0]['aircraft_owner']); |
|
61 | 61 | //$ident = $spotter_array[0]['ident']; |
62 | 62 | if (isset($spotter_array[0]['latitude'])) $latitude = $spotter_array[0]['latitude']; |
63 | 63 | if (isset($spotter_array[0]['longitude'])) $longitude = $spotter_array[0]['longitude']; |
@@ -117,23 +117,23 @@ discard block |
||
117 | 117 | $Stats = new Stats(); |
118 | 118 | if ($year == '' && $month == '') $flights = $Stats->getStatsOwner($owner); |
119 | 119 | else $flights = 0; |
120 | - if ($flights == 0) $flights = $Spotter->countFlightsByOwner($owner,$filter); |
|
120 | + if ($flights == 0) $flights = $Spotter->countFlightsByOwner($owner, $filter); |
|
121 | 121 | print '<div><span class="label">'._("Flights").'</span>'.$flights.'</div>'; |
122 | - $aircraft_type = count($Spotter->countAllAircraftTypesByOwner($owner,$filter)); |
|
122 | + $aircraft_type = count($Spotter->countAllAircraftTypesByOwner($owner, $filter)); |
|
123 | 123 | print '<div><span class="label">'._("Aircrafts type").'</span>'.$aircraft_type.'</div>'; |
124 | - $aircraft_registration = count($Spotter->countAllAircraftRegistrationByOwner($owner,$filter)); |
|
124 | + $aircraft_registration = count($Spotter->countAllAircraftRegistrationByOwner($owner, $filter)); |
|
125 | 125 | print '<div><span class="label">'._("Aircrafts").'</span>'.$aircraft_registration.'</div>'; |
126 | - $aircraft_manufacturer = count($Spotter->countAllAircraftManufacturerByOwner($owner,$filter)); |
|
126 | + $aircraft_manufacturer = count($Spotter->countAllAircraftManufacturerByOwner($owner, $filter)); |
|
127 | 127 | print '<div><span class="label">'._("Manufacturers").'</span>'.$aircraft_manufacturer.'</div>'; |
128 | - $airlines = count($Spotter->countAllAirlinesByOwner($owner,$filter)); |
|
128 | + $airlines = count($Spotter->countAllAirlinesByOwner($owner, $filter)); |
|
129 | 129 | print '<div><span class="label">'._("Airlines").'</span>'.$airlines.'</div>'; |
130 | - $duration = $Spotter->getFlightDurationByOwner($owner,$filter); |
|
130 | + $duration = $Spotter->getFlightDurationByOwner($owner, $filter); |
|
131 | 131 | if ($duration != '0') print '<div><span class="label">'._("Total flights spotted duration").'</span>'.$duration.'</div>'; |
132 | 132 | print '</div>'; |
133 | 133 | |
134 | 134 | include('owner-sub-menu.php'); |
135 | 135 | print '<div class="table column">'; |
136 | - 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>'; |
|
136 | + 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>'; |
|
137 | 137 | |
138 | 138 | include('table-output.php'); |
139 | 139 | print '<div class="pagination">'; |
@@ -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'); |
@@ -16,40 +16,40 @@ discard block |
||
16 | 16 | |
17 | 17 | if (isset($_GET['start_date'])) { |
18 | 18 | //for the date manipulation into the query |
19 | - if($_GET['start_date'] != "" && $_GET['end_date'] != ""){ |
|
19 | + if ($_GET['start_date'] != "" && $_GET['end_date'] != "") { |
|
20 | 20 | //$start_date = $_GET['start_date']." 00:00:00"; |
21 | - $start_date = date("Y-m-d",strtotime($_GET['start_date']))." 00:00:00"; |
|
21 | + $start_date = date("Y-m-d", strtotime($_GET['start_date']))." 00:00:00"; |
|
22 | 22 | //$end_date = $_GET['end_date']." 00:00:00"; |
23 | - $end_date = date("Y-m-d",strtotime($_GET['end_date']))." 00:00:00"; |
|
23 | + $end_date = date("Y-m-d", strtotime($_GET['end_date']))." 00:00:00"; |
|
24 | 24 | $sql_date = $start_date.",".$end_date; |
25 | - } else if($_GET['start_date'] != ""){ |
|
25 | + } else if ($_GET['start_date'] != "") { |
|
26 | 26 | //$start_date = $_GET['start_date']." 00:00:00"; |
27 | - $start_date = date("Y-m-d",strtotime($_GET['start_date']))." 00:00:00"; |
|
27 | + $start_date = date("Y-m-d", strtotime($_GET['start_date']))." 00:00:00"; |
|
28 | 28 | $sql_date = $start_date; |
29 | - } else if($_GET['start_date'] == "" && $_GET['end_date'] != ""){ |
|
29 | + } else if ($_GET['start_date'] == "" && $_GET['end_date'] != "") { |
|
30 | 30 | //$end_date = date("Y-m-d H:i:s", strtotime("2014-04-12")).",".$_GET['end_date']." 00:00:00"; |
31 | - $end_date = date("Y-m-d H:i:s", strtotime("2014-04-12")).",".date("Y-m-d",strtotime($_GET['end_date']))." 00:00:00"; |
|
31 | + $end_date = date("Y-m-d H:i:s", strtotime("2014-04-12")).",".date("Y-m-d", strtotime($_GET['end_date']))." 00:00:00"; |
|
32 | 32 | $sql_date = $end_date; |
33 | 33 | } else $sql_date = ''; |
34 | 34 | } else $sql_date = ''; |
35 | 35 | |
36 | 36 | if (isset($_GET['highest_altitude'])) { |
37 | 37 | //for altitude manipulation |
38 | - if($_GET['highest_altitude'] != "" && $_GET['lowest_altitude'] != ""){ |
|
39 | - $end_altitude = filter_input(INPUT_GET,'highest_altitude',FILTER_SANITIZE_NUMBER_INT); |
|
40 | - $start_altitude = filter_input(INPUT_GET,'lowest_altitude',FILTER_SANITIZE_NUMBER_INT); |
|
38 | + if ($_GET['highest_altitude'] != "" && $_GET['lowest_altitude'] != "") { |
|
39 | + $end_altitude = filter_input(INPUT_GET, 'highest_altitude', FILTER_SANITIZE_NUMBER_INT); |
|
40 | + $start_altitude = filter_input(INPUT_GET, 'lowest_altitude', FILTER_SANITIZE_NUMBER_INT); |
|
41 | 41 | $sql_altitude = $start_altitude.",".$end_altitude; |
42 | - } else if($_GET['highest_altitude'] != ""){ |
|
43 | - $end_altitude = filter_input(INPUT_GET,'highest_altitude',FILTER_SANITIZE_NUMBER_INT); |
|
42 | + } else if ($_GET['highest_altitude'] != "") { |
|
43 | + $end_altitude = filter_input(INPUT_GET, 'highest_altitude', FILTER_SANITIZE_NUMBER_INT); |
|
44 | 44 | $sql_altitude = $end_altitude; |
45 | - } else if($_GET['highest_altitude'] == "" && $_GET['lowest_altitude'] != ""){ |
|
46 | - $start_altitude = filter_input(INPUT_GET,'lowest_altitude',FILTER_SANITIZE_NUMBER_INT).",60000"; |
|
45 | + } else if ($_GET['highest_altitude'] == "" && $_GET['lowest_altitude'] != "") { |
|
46 | + $start_altitude = filter_input(INPUT_GET, 'lowest_altitude', FILTER_SANITIZE_NUMBER_INT).",60000"; |
|
47 | 47 | $sql_altitude = $start_altitude; |
48 | 48 | } else $sql_altitude = ''; |
49 | 49 | } else $sql_altitude = ''; |
50 | 50 | |
51 | 51 | //calculuation for the pagination |
52 | -if(!isset($_GET['limit'])) |
|
52 | +if (!isset($_GET['limit'])) |
|
53 | 53 | { |
54 | 54 | if (!isset($_GET['number_results'])) |
55 | 55 | { |
@@ -57,45 +57,45 @@ discard block |
||
57 | 57 | $limit_end = 25; |
58 | 58 | $absolute_difference = 25; |
59 | 59 | } else { |
60 | - if ($_GET['number_results'] > 1000){ |
|
60 | + if ($_GET['number_results'] > 1000) { |
|
61 | 61 | $_GET['number_results'] = 1000; |
62 | 62 | } |
63 | 63 | $limit_start = 0; |
64 | - $limit_end = filter_input(INPUT_GET,'number_results',FILTER_SANITIZE_NUMBER_INT); |
|
65 | - $absolute_difference = filter_input(INPUT_GET,'number_results',FILTER_SANITIZE_NUMBER_INT); |
|
64 | + $limit_end = filter_input(INPUT_GET, 'number_results', FILTER_SANITIZE_NUMBER_INT); |
|
65 | + $absolute_difference = filter_input(INPUT_GET, 'number_results', FILTER_SANITIZE_NUMBER_INT); |
|
66 | 66 | } |
67 | -} else { |
|
67 | +} else { |
|
68 | 68 | $limit_explode = explode(",", $_GET['limit']); |
69 | - $limit_start = filter_var($limit_explode[0],FILTER_SANITIZE_NUMBER_INT); |
|
70 | - $limit_end = filter_var($limit_explode[1],FILTER_SANITIZE_NUMBER_INT); |
|
69 | + $limit_start = filter_var($limit_explode[0], FILTER_SANITIZE_NUMBER_INT); |
|
70 | + $limit_end = filter_var($limit_explode[1], FILTER_SANITIZE_NUMBER_INT); |
|
71 | 71 | } |
72 | 72 | $absolute_difference = abs($limit_start - $limit_end); |
73 | 73 | $limit_next = $limit_end + $absolute_difference; |
74 | 74 | $limit_previous_1 = $limit_start - $absolute_difference; |
75 | 75 | $limit_previous_2 = $limit_end - $absolute_difference; |
76 | 76 | |
77 | -if (!empty($_GET)){ |
|
78 | - $q = filter_input(INPUT_GET, 'q',FILTER_SANITIZE_STRING); |
|
79 | - $registration = filter_input(INPUT_GET, 'registration',FILTER_SANITIZE_STRING); |
|
80 | - $aircraft = filter_input(INPUT_GET, 'aircraft',FILTER_SANITIZE_STRING); |
|
81 | - $manufacturer = filter_input(INPUT_GET, 'manufacturer',FILTER_SANITIZE_STRING); |
|
82 | - $highlights = filter_input(INPUT_GET, 'highlights',FILTER_SANITIZE_STRING); |
|
83 | - $airline = filter_input(INPUT_GET, 'airline',FILTER_SANITIZE_STRING); |
|
84 | - $airline_country = filter_input(INPUT_GET, 'airline_country',FILTER_SANITIZE_STRING); |
|
85 | - $airline_type = filter_input(INPUT_GET, 'airline_type',FILTER_SANITIZE_STRING); |
|
86 | - $airport = filter_input(INPUT_GET, 'airport',FILTER_SANITIZE_STRING); |
|
87 | - $airport_country = filter_input(INPUT_GET, 'airport_country',FILTER_SANITIZE_STRING); |
|
88 | - $callsign = filter_input(INPUT_GET, 'callsign',FILTER_SANITIZE_STRING); |
|
89 | - $owner = filter_input(INPUT_GET, 'owner',FILTER_SANITIZE_STRING); |
|
90 | - $pilot_name = filter_input(INPUT_GET, 'pilot_name',FILTER_SANITIZE_STRING); |
|
91 | - $pilot_id = filter_input(INPUT_GET, 'pilot_id',FILTER_SANITIZE_STRING); |
|
92 | - $departure_airport_route = filter_input(INPUT_GET, 'departure_airport_route',FILTER_SANITIZE_STRING); |
|
93 | - $arrival_airport_route = filter_input(INPUT_GET, 'arrival_airport_route',FILTER_SANITIZE_STRING); |
|
94 | - $sort = filter_input(INPUT_GET,'sort',FILTER_SANITIZE_STRING); |
|
95 | - $archive = filter_input(INPUT_GET,'archive',FILTER_SANITIZE_NUMBER_INT); |
|
96 | - $origlat = filter_input(INPUT_GET,'origlat',FILTER_SANITIZE_STRING); |
|
97 | - $origlon = filter_input(INPUT_GET,'origlon',FILTER_SANITIZE_STRING); |
|
98 | - $dist = filter_input(INPUT_GET,'dist',FILTER_SANITIZE_NUMBER_INT); |
|
77 | +if (!empty($_GET)) { |
|
78 | + $q = filter_input(INPUT_GET, 'q', FILTER_SANITIZE_STRING); |
|
79 | + $registration = filter_input(INPUT_GET, 'registration', FILTER_SANITIZE_STRING); |
|
80 | + $aircraft = filter_input(INPUT_GET, 'aircraft', FILTER_SANITIZE_STRING); |
|
81 | + $manufacturer = filter_input(INPUT_GET, 'manufacturer', FILTER_SANITIZE_STRING); |
|
82 | + $highlights = filter_input(INPUT_GET, 'highlights', FILTER_SANITIZE_STRING); |
|
83 | + $airline = filter_input(INPUT_GET, 'airline', FILTER_SANITIZE_STRING); |
|
84 | + $airline_country = filter_input(INPUT_GET, 'airline_country', FILTER_SANITIZE_STRING); |
|
85 | + $airline_type = filter_input(INPUT_GET, 'airline_type', FILTER_SANITIZE_STRING); |
|
86 | + $airport = filter_input(INPUT_GET, 'airport', FILTER_SANITIZE_STRING); |
|
87 | + $airport_country = filter_input(INPUT_GET, 'airport_country', FILTER_SANITIZE_STRING); |
|
88 | + $callsign = filter_input(INPUT_GET, 'callsign', FILTER_SANITIZE_STRING); |
|
89 | + $owner = filter_input(INPUT_GET, 'owner', FILTER_SANITIZE_STRING); |
|
90 | + $pilot_name = filter_input(INPUT_GET, 'pilot_name', FILTER_SANITIZE_STRING); |
|
91 | + $pilot_id = filter_input(INPUT_GET, 'pilot_id', FILTER_SANITIZE_STRING); |
|
92 | + $departure_airport_route = filter_input(INPUT_GET, 'departure_airport_route', FILTER_SANITIZE_STRING); |
|
93 | + $arrival_airport_route = filter_input(INPUT_GET, 'arrival_airport_route', FILTER_SANITIZE_STRING); |
|
94 | + $sort = filter_input(INPUT_GET, 'sort', FILTER_SANITIZE_STRING); |
|
95 | + $archive = filter_input(INPUT_GET, 'archive', FILTER_SANITIZE_NUMBER_INT); |
|
96 | + $origlat = filter_input(INPUT_GET, 'origlat', FILTER_SANITIZE_STRING); |
|
97 | + $origlon = filter_input(INPUT_GET, 'origlon', FILTER_SANITIZE_STRING); |
|
98 | + $dist = filter_input(INPUT_GET, 'dist', FILTER_SANITIZE_NUMBER_INT); |
|
99 | 99 | if ($dist != '') { |
100 | 100 | if (isset($globalDistanceUnit) && $globalDistanceUnit == 'mi') $dist = $dist*1.60934; |
101 | 101 | elseif (isset($globalDistanceUnit) && $globalDistanceUnit == 'nm') $dist = $dist*1.852; |
@@ -103,9 +103,9 @@ discard block |
||
103 | 103 | if (!isset($sql_date)) $sql_date = ''; |
104 | 104 | if ($archive == 1) { |
105 | 105 | $SpotterArchive = new SpotterArchive(); |
106 | - $spotter_array = $SpotterArchive->searchSpotterData($q,$registration,$aircraft,strtolower(str_replace("-", " ", $manufacturer)),$highlights,$airline,$airline_country,$airline_type,$airport,$airport_country,$callsign,$departure_airport_route,$arrival_airport_route,$owner,$pilot_id,$pilot_name,$sql_altitude,$sql_date,$limit_start.",".$absolute_difference,$sort,'',$origlat,$origlon,$dist); |
|
106 | + $spotter_array = $SpotterArchive->searchSpotterData($q, $registration, $aircraft, strtolower(str_replace("-", " ", $manufacturer)), $highlights, $airline, $airline_country, $airline_type, $airport, $airport_country, $callsign, $departure_airport_route, $arrival_airport_route, $owner, $pilot_id, $pilot_name, $sql_altitude, $sql_date, $limit_start.",".$absolute_difference, $sort, '', $origlat, $origlon, $dist); |
|
107 | 107 | } else { |
108 | - $spotter_array = $Spotter->searchSpotterData($q,$registration,$aircraft,strtolower(str_replace("-", " ", $manufacturer)),$highlights,$airline,$airline_country,$airline_type,$airport,$airport_country,$callsign,$departure_airport_route,$arrival_airport_route,$owner,$pilot_id,$pilot_name,$sql_altitude,$sql_date,$limit_start.",".$absolute_difference,$sort,'',$origlat,$origlon,$dist); |
|
108 | + $spotter_array = $Spotter->searchSpotterData($q, $registration, $aircraft, strtolower(str_replace("-", " ", $manufacturer)), $highlights, $airline, $airline_country, $airline_type, $airport, $airport_country, $callsign, $departure_airport_route, $arrival_airport_route, $owner, $pilot_id, $pilot_name, $sql_altitude, $sql_date, $limit_start.",".$absolute_difference, $sort, '', $origlat, $origlon, $dist); |
|
109 | 109 | } |
110 | 110 | |
111 | 111 | print '<span class="sub-menu-statistic column mobile">'; |
@@ -138,12 +138,12 @@ discard block |
||
138 | 138 | //remove 3D=true parameter |
139 | 139 | $no3D = str_replace("&3D=true", "", $_SERVER['QUERY_STRING']); |
140 | 140 | $kmlURL = str_replace("http://", "kml://", $globalURL); |
141 | - if (!isset($_GET['3D'])){ |
|
141 | + if (!isset($_GET['3D'])) { |
|
142 | 142 | print '<li><a href="'.$globalURL.'/search?'.$no3D.'" class="active"><i class="fa fa-table"></i> '._("Table").'</a></li>'; |
143 | 143 | } else { |
144 | 144 | print '<li><span class="notablet"><a href="'.$globalURL.'/search?'.$no3D.'"><i class="fa fa-table"></i> '._("Table").'</a></span></li>'; |
145 | 145 | } |
146 | - if (isset($_GET['3D'])){ |
|
146 | + if (isset($_GET['3D'])) { |
|
147 | 147 | print '<li><a href="'.$globalURL.'/search?'.$no3D.'&3D=true" class="active"><i class="fa fa-globe"></i> '._("3D Map").'</a></li>'; |
148 | 148 | } else { |
149 | 149 | print '<li ><a href="'.$globalURL.'/search?'.$no3D.'&3D=true" class="notablet nomobile"><i class="fa fa-globe"></i> '._("3D Map").'</a><a href="'.$kmlURL.'/search/kml?'.htmlentities($_SERVER['QUERY_STRING']).'" class="tablet mobile"><i class="fa fa-globe"></i> 3D Map</a></li>'; |
@@ -164,30 +164,30 @@ discard block |
||
164 | 164 | print '<div class="column">'; |
165 | 165 | print '<div class="info">'; |
166 | 166 | print '<h1>'._("Search Results for").' '; |
167 | - if (isset($_GET['q']) && $_GET['q'] != ""){ print _("Keyword:").' <span>'.$q.'</span> '; } |
|
168 | - if (isset($_GET['aircraft']) && $_GET['aircraft'] != ""){ print _("Aircraft:").' <span>'.$aircraft.'</span> '; } |
|
169 | - if (isset($_GET['manufacturer']) && $_GET['manufacturer'] != ""){ print _("Manufacturer:").' <span>'.$manufacturer.'</span> '; } |
|
170 | - if (isset($_GET['registration']) && $_GET['registration'] != ""){ print _("Registration:").' <span>'.$registration.'</span> '; } |
|
171 | - if (isset($_GET['highlights'])) if ($_GET['highlights'] == "true"){ print _("Highlights:").' <span>'.$highlights.'</span> '; } |
|
172 | - if (isset($_GET['airline']) && $_GET['airline'] != ""){ print _("Airline:").' <span>'.$airline.'</span> '; } |
|
173 | - if (isset($_GET['airline_country']) && $_GET['airline_country'] != ""){ print _("Airline country:").' <span>'.$airline_country.'</span> '; } |
|
174 | - if (isset($_GET['airline_type']) && $_GET['airline_type'] != ""){ print _("Airline type:").' <span>'.$airline_type.'</span> '; } |
|
175 | - if (isset($_GET['airport']) && $_GET['airport'] != ""){ print _("Airport:").' <span>'.$airport.'</span> '; } |
|
176 | - if (isset($_GET['airport_country']) && $_GET['airport_country'] != ""){ print _("Airport country:").' <span>'.$airport_country.'</span> '; } |
|
177 | - if (isset($_GET['callsign']) && $_GET['callsign'] != ""){ print _("Callsign:").' <span>'.$callsign.'</span> '; } |
|
178 | - if (isset($_GET['owner']) && $_GET['owner'] != ""){ print _("Owner:").' <span>'.$owner.'</span> '; } |
|
179 | - if (isset($_GET['pilot_id']) && $_GET['pilot_id'] != ""){ print _("Pilot id:").' <span>'.$pilot_id.'</span> '; } |
|
180 | - if (isset($_GET['pilot_name']) && $_GET['pilot_name'] != ""){ print _("Pilot name:").' <span>'.$pilot_name.'</span> '; } |
|
181 | - if (isset($_GET['departure_airport_route']) && $_GET['departure_airport_route'] != "" && (!isset($_GET['arrival_airport_route']) || $_GET['arrival_airport_route'] == "")){ print _("Route out of:").' <span>'.$departure_airport_route.'</span> '; } |
|
182 | - if (isset($_GET['departure_airport_route']) && $_GET['departure_airport_route'] == "" && isset($_GET['arrival_airport_route']) && $_GET['arrival_airport_route'] != ""){ print _("Route into:").' <span>'.$arrival_airport_route.'</span> '; } |
|
183 | - if (isset($_GET['departure_airport_route']) && $_GET['departure_airport_route'] != "" && isset($_GET['arrival_airport_route']) && $_GET['arrival_airport_route'] != ""){ print _("Route between:").' <span>'.$departure_airport_route.'</span> and <span>'.$_GET['arrival_airport_route'].'</span> '; } |
|
184 | - if (isset($_GET['start_date']) && $_GET['start_date'] != "" && isset($_GET['end_date']) && $_GET['end_date'] == ""){ print _("Date starting at:").' <span>'.$start_date.'</span> '; } |
|
185 | - if (isset($_GET['start_date']) && $_GET['start_date'] == "" && isset($_GET['end_date']) && $_GET['end_date'] != ""){ print _("Date ending at:").' <span>'.$end_date.'</span> '; } |
|
186 | - if (isset($_GET['start_date']) && $_GET['start_date'] != "" && isset($_GET['end_date']) && $_GET['end_date'] != ""){ print _("Date between:").' <span>'.$start_date.'</span> and <span>'.$end_date.'</span> '; } |
|
187 | - if (isset($_GET['lowest_altitude']) && $_GET['lowest_altitude'] != "" && isset($_GET['highest_altitude']) && $_GET['highest_altitude'] == ""){ print _("Altitude starting at:").' <span>'.number_format($lowest_altitude).' feet</span> '; } |
|
188 | - if (isset($_GET['lowest_altitude']) && $_GET['lowest_altitude'] == "" && isset($_GET['highest_altitude']) && $_GET['highest_altitude'] != ""){ print _("Altitude ending at:").' <span>'.number_format($highest_altitude).' feet</span> '; } |
|
189 | - if (isset($_GET['lowest_altitude']) && $_GET['lowest_altitude'] != "" && isset($_GET['highest_altitude']) && $_GET['highest_altitude'] != ""){ print _("Altitude between:").' <span>'.number_format($lowest_altitude).' feet</span> '._("and").' <span>'.number_format($highest_altitude).' feet</span> '; } |
|
190 | - if (isset($_GET['number_results']) && $_GET['number_results'] != ""){ print _("limit per page:").' <span>'.$number_results.'</span> '; } |
|
167 | + if (isset($_GET['q']) && $_GET['q'] != "") { print _("Keyword:").' <span>'.$q.'</span> '; } |
|
168 | + if (isset($_GET['aircraft']) && $_GET['aircraft'] != "") { print _("Aircraft:").' <span>'.$aircraft.'</span> '; } |
|
169 | + if (isset($_GET['manufacturer']) && $_GET['manufacturer'] != "") { print _("Manufacturer:").' <span>'.$manufacturer.'</span> '; } |
|
170 | + if (isset($_GET['registration']) && $_GET['registration'] != "") { print _("Registration:").' <span>'.$registration.'</span> '; } |
|
171 | + if (isset($_GET['highlights'])) if ($_GET['highlights'] == "true") { print _("Highlights:").' <span>'.$highlights.'</span> '; } |
|
172 | + if (isset($_GET['airline']) && $_GET['airline'] != "") { print _("Airline:").' <span>'.$airline.'</span> '; } |
|
173 | + if (isset($_GET['airline_country']) && $_GET['airline_country'] != "") { print _("Airline country:").' <span>'.$airline_country.'</span> '; } |
|
174 | + if (isset($_GET['airline_type']) && $_GET['airline_type'] != "") { print _("Airline type:").' <span>'.$airline_type.'</span> '; } |
|
175 | + if (isset($_GET['airport']) && $_GET['airport'] != "") { print _("Airport:").' <span>'.$airport.'</span> '; } |
|
176 | + if (isset($_GET['airport_country']) && $_GET['airport_country'] != "") { print _("Airport country:").' <span>'.$airport_country.'</span> '; } |
|
177 | + if (isset($_GET['callsign']) && $_GET['callsign'] != "") { print _("Callsign:").' <span>'.$callsign.'</span> '; } |
|
178 | + if (isset($_GET['owner']) && $_GET['owner'] != "") { print _("Owner:").' <span>'.$owner.'</span> '; } |
|
179 | + if (isset($_GET['pilot_id']) && $_GET['pilot_id'] != "") { print _("Pilot id:").' <span>'.$pilot_id.'</span> '; } |
|
180 | + if (isset($_GET['pilot_name']) && $_GET['pilot_name'] != "") { print _("Pilot name:").' <span>'.$pilot_name.'</span> '; } |
|
181 | + if (isset($_GET['departure_airport_route']) && $_GET['departure_airport_route'] != "" && (!isset($_GET['arrival_airport_route']) || $_GET['arrival_airport_route'] == "")) { print _("Route out of:").' <span>'.$departure_airport_route.'</span> '; } |
|
182 | + if (isset($_GET['departure_airport_route']) && $_GET['departure_airport_route'] == "" && isset($_GET['arrival_airport_route']) && $_GET['arrival_airport_route'] != "") { print _("Route into:").' <span>'.$arrival_airport_route.'</span> '; } |
|
183 | + if (isset($_GET['departure_airport_route']) && $_GET['departure_airport_route'] != "" && isset($_GET['arrival_airport_route']) && $_GET['arrival_airport_route'] != "") { print _("Route between:").' <span>'.$departure_airport_route.'</span> and <span>'.$_GET['arrival_airport_route'].'</span> '; } |
|
184 | + if (isset($_GET['start_date']) && $_GET['start_date'] != "" && isset($_GET['end_date']) && $_GET['end_date'] == "") { print _("Date starting at:").' <span>'.$start_date.'</span> '; } |
|
185 | + if (isset($_GET['start_date']) && $_GET['start_date'] == "" && isset($_GET['end_date']) && $_GET['end_date'] != "") { print _("Date ending at:").' <span>'.$end_date.'</span> '; } |
|
186 | + if (isset($_GET['start_date']) && $_GET['start_date'] != "" && isset($_GET['end_date']) && $_GET['end_date'] != "") { print _("Date between:").' <span>'.$start_date.'</span> and <span>'.$end_date.'</span> '; } |
|
187 | + if (isset($_GET['lowest_altitude']) && $_GET['lowest_altitude'] != "" && isset($_GET['highest_altitude']) && $_GET['highest_altitude'] == "") { print _("Altitude starting at:").' <span>'.number_format($lowest_altitude).' feet</span> '; } |
|
188 | + if (isset($_GET['lowest_altitude']) && $_GET['lowest_altitude'] == "" && isset($_GET['highest_altitude']) && $_GET['highest_altitude'] != "") { print _("Altitude ending at:").' <span>'.number_format($highest_altitude).' feet</span> '; } |
|
189 | + if (isset($_GET['lowest_altitude']) && $_GET['lowest_altitude'] != "" && isset($_GET['highest_altitude']) && $_GET['highest_altitude'] != "") { print _("Altitude between:").' <span>'.number_format($lowest_altitude).' feet</span> '._("and").' <span>'.number_format($highest_altitude).' feet</span> '; } |
|
190 | + if (isset($_GET['number_results']) && $_GET['number_results'] != "") { print _("limit per page:").' <span>'.$number_results.'</span> '; } |
|
191 | 191 | print '</h1>'; |
192 | 192 | print '</div>'; |
193 | 193 | |
@@ -294,7 +294,7 @@ discard block |
||
294 | 294 | </select> |
295 | 295 | </div> |
296 | 296 | </div> |
297 | - <script type="text/javascript">getSelect('manufacturer','<?php if(isset($_GET['manufacturer'])) print $manufacturer; ?>')</script> |
|
297 | + <script type="text/javascript">getSelect('manufacturer','<?php if (isset($_GET['manufacturer'])) print $manufacturer; ?>')</script> |
|
298 | 298 | <div class="form-group"> |
299 | 299 | <label class="control-label col-sm-2"><?php echo _("Type"); ?></label> |
300 | 300 | <div class="col-sm-10"> |
@@ -303,7 +303,7 @@ discard block |
||
303 | 303 | </select> |
304 | 304 | </div> |
305 | 305 | </div> |
306 | - <script type="text/javascript">getSelect('aircrafttypes','<?php if(isset($_GET['aircraft_icao'])) print $aircraft_icao; ?>');</script> |
|
306 | + <script type="text/javascript">getSelect('aircrafttypes','<?php if (isset($_GET['aircraft_icao'])) print $aircraft_icao; ?>');</script> |
|
307 | 307 | <div class="form-group"> |
308 | 308 | <label class="control-label col-sm-2"><?php echo _("Registration"); ?></label> |
309 | 309 | <div class="col-sm-10"> |
@@ -326,7 +326,7 @@ discard block |
||
326 | 326 | </div> |
327 | 327 | </div> |
328 | 328 | <?php |
329 | -}else { |
|
329 | +} else { |
|
330 | 330 | ?> |
331 | 331 | <div class="form-group"> |
332 | 332 | <label class="control-label col-sm-2"><?php echo _("Owner name"); ?></label> |
@@ -339,8 +339,8 @@ discard block |
||
339 | 339 | ?> |
340 | 340 | <div class="form-group"> |
341 | 341 | <div class="col-sm-offset-2 col-sm-10"> |
342 | - <!--<div><input type="checkbox" class="form-control" name="highlights" value="true" id="highlights" <?php if (isset($_GET['highlights'])) if ($_GET['highlights'] == "true"){ print 'checked="checked"'; } ?>> <label for="highlights"><?php echo _("Include only aircrafts with special highlights (unique liveries, destinations etc.)"); ?></label></div>--> |
|
343 | - <label class="checkbox-inline"><input type="checkbox" name="highlights" value="true" id="highlights" <?php if (isset($_GET['highlights'])) if ($_GET['highlights'] == "true"){ print 'checked="checked"'; } ?>> <?php echo _("Include only aircrafts with special highlights (unique liveries, destinations etc.)"); ?></label> |
|
342 | + <!--<div><input type="checkbox" class="form-control" name="highlights" value="true" id="highlights" <?php if (isset($_GET['highlights'])) if ($_GET['highlights'] == "true") { print 'checked="checked"'; } ?>> <label for="highlights"><?php echo _("Include only aircrafts with special highlights (unique liveries, destinations etc.)"); ?></label></div>--> |
|
343 | + <label class="checkbox-inline"><input type="checkbox" name="highlights" value="true" id="highlights" <?php if (isset($_GET['highlights'])) if ($_GET['highlights'] == "true") { print 'checked="checked"'; } ?>> <?php echo _("Include only aircrafts with special highlights (unique liveries, destinations etc.)"); ?></label> |
|
344 | 344 | </div> |
345 | 345 | </div> |
346 | 346 | </fieldset> |
@@ -354,7 +354,7 @@ discard block |
||
354 | 354 | </select> |
355 | 355 | </div> |
356 | 356 | </div> |
357 | - <script type="text/javascript">getSelect('airlinenames','<?php if(isset($_GET['airline'])) print $airline; ?>');</script> |
|
357 | + <script type="text/javascript">getSelect('airlinenames','<?php if (isset($_GET['airline'])) print $airline; ?>');</script> |
|
358 | 358 | <div class="form-group"> |
359 | 359 | <label class="control-label col-sm-2"><?php echo _("Country"); ?></label> |
360 | 360 | <div class="col-sm-10"> |
@@ -363,7 +363,7 @@ discard block |
||
363 | 363 | </select> |
364 | 364 | </div> |
365 | 365 | </div> |
366 | - <script type="text/javascript">getSelect('airlinecountries','<?php if(isset($_GET['airline_country'])) print $airline_country; ?>');</script> |
|
366 | + <script type="text/javascript">getSelect('airlinecountries','<?php if (isset($_GET['airline_country'])) print $airline_country; ?>');</script> |
|
367 | 367 | <div class="form-group"> |
368 | 368 | <label class="control-label col-sm-2"><?php echo _("Callsign"); ?></label> |
369 | 369 | <div class="col-sm-10"> |
@@ -372,10 +372,10 @@ discard block |
||
372 | 372 | </div> |
373 | 373 | <div class="form-group"> |
374 | 374 | <div class="col-sm-offset-2 col-sm-10"> |
375 | - <label class="radio-inline"><input type="radio" name="airline_type" value="all" id="airline_type_all" <?php if (!isset($_GET['airline_type']) || $_GET['airline_type'] == "all"){ print 'checked="checked"'; } ?>> <?php echo _("All airlines types"); ?></label> |
|
376 | - <label class="radio-inline"><input type="radio" name="airline_type" value="passenger" id="airline_type_passenger" <?php if (isset($_GET['airline_type'])) if ($_GET['airline_type'] == "passenger"){ print 'checked="checked"'; } ?>> <?php echo _("Only Passenger airlines"); ?></label> |
|
377 | - <label class="radio-inline"><input type="radio" name="airline_type" value="cargo" id="airline_type_cargo" <?php if (isset($_GET['airline_type'])) if ( $_GET['airline_type'] == "cargo"){ print 'checked="checked"'; } ?>> <?php echo _("Only Cargo airlines"); ?></label> |
|
378 | - <label class="radio-inline"><input type="radio" name="airline_type" value="military" id="airline_type_military" <?php if (isset($_GET['airline_type'])) if ( $_GET['airline_type'] == "military"){ print 'checked="checked"'; } ?>> <?php echo _("Only Military airlines"); ?></label> |
|
375 | + <label class="radio-inline"><input type="radio" name="airline_type" value="all" id="airline_type_all" <?php if (!isset($_GET['airline_type']) || $_GET['airline_type'] == "all") { print 'checked="checked"'; } ?>> <?php echo _("All airlines types"); ?></label> |
|
376 | + <label class="radio-inline"><input type="radio" name="airline_type" value="passenger" id="airline_type_passenger" <?php if (isset($_GET['airline_type'])) if ($_GET['airline_type'] == "passenger") { print 'checked="checked"'; } ?>> <?php echo _("Only Passenger airlines"); ?></label> |
|
377 | + <label class="radio-inline"><input type="radio" name="airline_type" value="cargo" id="airline_type_cargo" <?php if (isset($_GET['airline_type'])) if ($_GET['airline_type'] == "cargo") { print 'checked="checked"'; } ?>> <?php echo _("Only Cargo airlines"); ?></label> |
|
378 | + <label class="radio-inline"><input type="radio" name="airline_type" value="military" id="airline_type_military" <?php if (isset($_GET['airline_type'])) if ($_GET['airline_type'] == "military") { print 'checked="checked"'; } ?>> <?php echo _("Only Military airlines"); ?></label> |
|
379 | 379 | </div> |
380 | 380 | </div> |
381 | 381 | </fieldset> |
@@ -389,7 +389,7 @@ discard block |
||
389 | 389 | </select> |
390 | 390 | </div> |
391 | 391 | </div> |
392 | - <script type="text/javascript">getSelect('airportnames','<?php if(isset($_GET['airport_icao'])) print $airport_icao; ?>');</script> |
|
392 | + <script type="text/javascript">getSelect('airportnames','<?php if (isset($_GET['airport_icao'])) print $airport_icao; ?>');</script> |
|
393 | 393 | <div class="form-group"> |
394 | 394 | <label class="control-label col-sm-2"><?php echo _("Country"); ?></label> |
395 | 395 | <div class="col-sm-10"> |
@@ -398,7 +398,7 @@ discard block |
||
398 | 398 | </select> |
399 | 399 | </div> |
400 | 400 | </div> |
401 | - <script type="text/javascript">getSelect('airportcountries','<?php if(isset($_GET['airport_country'])) print $airport_country; ?>');</script> |
|
401 | + <script type="text/javascript">getSelect('airportcountries','<?php if (isset($_GET['airport_country'])) print $airport_country; ?>');</script> |
|
402 | 402 | </fieldset> |
403 | 403 | <fieldset> |
404 | 404 | <legend><?php echo _("Route"); ?></legend> |
@@ -410,7 +410,7 @@ discard block |
||
410 | 410 | </select> |
411 | 411 | </div> |
412 | 412 | </div> |
413 | - <script type="text/javascript">getSelect('departureairportnames','<?php if(isset($_GET['departure_airport_route'])) print $departure_airport_route; ?>');</script> |
|
413 | + <script type="text/javascript">getSelect('departureairportnames','<?php if (isset($_GET['departure_airport_route'])) print $departure_airport_route; ?>');</script> |
|
414 | 414 | <div class="form-group"> |
415 | 415 | <label class="control-label col-sm-2"><?php echo _("Arrival Airport"); ?></label> |
416 | 416 | <div class="col-sm-10"> |
@@ -419,7 +419,7 @@ discard block |
||
419 | 419 | </select> |
420 | 420 | </div> |
421 | 421 | </div> |
422 | - <script type="text/javascript">getSelect('arrivalairportnames','<?php if(isset($_GET['arrival_airport_route'])) print $arrival_airport_route; ?>');</script> |
|
422 | + <script type="text/javascript">getSelect('arrivalairportnames','<?php if (isset($_GET['arrival_airport_route'])) print $arrival_airport_route; ?>');</script> |
|
423 | 423 | </fieldset> |
424 | 424 | <fieldset> |
425 | 425 | <legend><?php echo _("Date"); ?></legend> |
@@ -473,9 +473,9 @@ discard block |
||
473 | 473 | <option></option> |
474 | 474 | <?php |
475 | 475 | $altitude_array = Array(1000, 5000, 10000, 15000, 20000, 25000, 30000, 35000, 40000, 45000, 50000); |
476 | -foreach($altitude_array as $altitude) |
|
476 | +foreach ($altitude_array as $altitude) |
|
477 | 477 | { |
478 | - if(isset($_GET['lowest_altitude']) && $_GET['lowest_altitude'] == $altitude) |
|
478 | + if (isset($_GET['lowest_altitude']) && $_GET['lowest_altitude'] == $altitude) |
|
479 | 479 | { |
480 | 480 | print '<option value="'.$altitude.'" selected="selected">'.number_format($altitude).' feet</option>'; |
481 | 481 | } else { |
@@ -493,9 +493,9 @@ discard block |
||
493 | 493 | <option></option> |
494 | 494 | <?php |
495 | 495 | $altitude_array = Array(1000, 5000, 10000, 15000, 20000, 25000, 30000, 35000, 40000, 45000, 50000); |
496 | -foreach($altitude_array as $altitude) |
|
496 | +foreach ($altitude_array as $altitude) |
|
497 | 497 | { |
498 | - if(isset($_GET['highest_altitude']) && $_GET['highest_altitude'] == $altitude) |
|
498 | + if (isset($_GET['highest_altitude']) && $_GET['highest_altitude'] == $altitude) |
|
499 | 499 | { |
500 | 500 | print '<option value="'.$altitude.'" selected="selected">'.number_format($altitude).' feet</option>'; |
501 | 501 | } else { |
@@ -534,10 +534,10 @@ discard block |
||
534 | 534 | <div class="col-sm-10"> |
535 | 535 | <select class="form-control" name="number_results"> |
536 | 536 | <?php |
537 | -$number_results_array = Array(25, 50, 100, 150, 200, 250, 300, 400, 500, 600, 700, 800, 900, 1000); |
|
538 | -foreach($number_results_array as $number) |
|
537 | +$number_results_array = Array(25, 50, 100, 150, 200, 250, 300, 400, 500, 600, 700, 800, 900, 1000); |
|
538 | +foreach ($number_results_array as $number) |
|
539 | 539 | { |
540 | - if(isset($_GET['number_results']) && $_GET['number_results'] == $number) |
|
540 | + if (isset($_GET['number_results']) && $_GET['number_results'] == $number) |
|
541 | 541 | { |
542 | 542 | print '<option value="'.$number.'" selected="selected">'.$number.'</option>'; |
543 | 543 | } else { |
@@ -555,7 +555,7 @@ discard block |
||
555 | 555 | <fieldset> |
556 | 556 | <div class="form-group"> |
557 | 557 | <div class="col-sm-offset-2 col-sm-10"> |
558 | - <label class="checkbox-inline"><input type="checkbox" name="archive" value="1" /><?php echo sprintf(_("Search in archive (older than %s months)"),$globalArchiveKeepMonths); ?></label> |
|
558 | + <label class="checkbox-inline"><input type="checkbox" name="archive" value="1" /><?php echo sprintf(_("Search in archive (older than %s months)"), $globalArchiveKeepMonths); ?></label> |
|
559 | 559 | </div> |
560 | 560 | </div> |
561 | 561 | </fieldset> |
@@ -30,8 +30,12 @@ discard block |
||
30 | 30 | //$end_date = date("Y-m-d H:i:s", strtotime("2014-04-12")).",".$_GET['end_date']." 00:00:00"; |
31 | 31 | $end_date = date("Y-m-d H:i:s", strtotime("2014-04-12")).",".date("Y-m-d",strtotime($_GET['end_date']))." 00:00:00"; |
32 | 32 | $sql_date = $end_date; |
33 | - } else $sql_date = ''; |
|
34 | -} else $sql_date = ''; |
|
33 | + } else { |
|
34 | + $sql_date = ''; |
|
35 | + } |
|
36 | + } else { |
|
37 | + $sql_date = ''; |
|
38 | +} |
|
35 | 39 | |
36 | 40 | if (isset($_GET['highest_altitude'])) { |
37 | 41 | //for altitude manipulation |
@@ -45,8 +49,12 @@ discard block |
||
45 | 49 | } else if($_GET['highest_altitude'] == "" && $_GET['lowest_altitude'] != ""){ |
46 | 50 | $start_altitude = filter_input(INPUT_GET,'lowest_altitude',FILTER_SANITIZE_NUMBER_INT).",60000"; |
47 | 51 | $sql_altitude = $start_altitude; |
48 | - } else $sql_altitude = ''; |
|
49 | -} else $sql_altitude = ''; |
|
52 | + } else { |
|
53 | + $sql_altitude = ''; |
|
54 | + } |
|
55 | + } else { |
|
56 | + $sql_altitude = ''; |
|
57 | +} |
|
50 | 58 | |
51 | 59 | //calculuation for the pagination |
52 | 60 | if(!isset($_GET['limit'])) |
@@ -64,7 +72,7 @@ discard block |
||
64 | 72 | $limit_end = filter_input(INPUT_GET,'number_results',FILTER_SANITIZE_NUMBER_INT); |
65 | 73 | $absolute_difference = filter_input(INPUT_GET,'number_results',FILTER_SANITIZE_NUMBER_INT); |
66 | 74 | } |
67 | -} else { |
|
75 | +} else { |
|
68 | 76 | $limit_explode = explode(",", $_GET['limit']); |
69 | 77 | $limit_start = filter_var($limit_explode[0],FILTER_SANITIZE_NUMBER_INT); |
70 | 78 | $limit_end = filter_var($limit_explode[1],FILTER_SANITIZE_NUMBER_INT); |
@@ -97,10 +105,15 @@ discard block |
||
97 | 105 | $origlon = filter_input(INPUT_GET,'origlon',FILTER_SANITIZE_STRING); |
98 | 106 | $dist = filter_input(INPUT_GET,'dist',FILTER_SANITIZE_NUMBER_INT); |
99 | 107 | if ($dist != '') { |
100 | - if (isset($globalDistanceUnit) && $globalDistanceUnit == 'mi') $dist = $dist*1.60934; |
|
101 | - elseif (isset($globalDistanceUnit) && $globalDistanceUnit == 'nm') $dist = $dist*1.852; |
|
108 | + if (isset($globalDistanceUnit) && $globalDistanceUnit == 'mi') { |
|
109 | + $dist = $dist*1.60934; |
|
110 | + } elseif (isset($globalDistanceUnit) && $globalDistanceUnit == 'nm') { |
|
111 | + $dist = $dist*1.852; |
|
112 | + } |
|
113 | + } |
|
114 | + if (!isset($sql_date)) { |
|
115 | + $sql_date = ''; |
|
102 | 116 | } |
103 | - if (!isset($sql_date)) $sql_date = ''; |
|
104 | 117 | if ($archive == 1) { |
105 | 118 | $SpotterArchive = new SpotterArchive(); |
106 | 119 | $spotter_array = $SpotterArchive->searchSpotterData($q,$registration,$aircraft,strtolower(str_replace("-", " ", $manufacturer)),$highlights,$airline,$airline_country,$airline_type,$airport,$airport_country,$callsign,$departure_airport_route,$arrival_airport_route,$owner,$pilot_id,$pilot_name,$sql_altitude,$sql_date,$limit_start.",".$absolute_difference,$sort,'',$origlat,$origlon,$dist); |
@@ -168,7 +181,10 @@ discard block |
||
168 | 181 | if (isset($_GET['aircraft']) && $_GET['aircraft'] != ""){ print _("Aircraft:").' <span>'.$aircraft.'</span> '; } |
169 | 182 | if (isset($_GET['manufacturer']) && $_GET['manufacturer'] != ""){ print _("Manufacturer:").' <span>'.$manufacturer.'</span> '; } |
170 | 183 | if (isset($_GET['registration']) && $_GET['registration'] != ""){ print _("Registration:").' <span>'.$registration.'</span> '; } |
171 | - if (isset($_GET['highlights'])) if ($_GET['highlights'] == "true"){ print _("Highlights:").' <span>'.$highlights.'</span> '; } |
|
184 | + if (isset($_GET['highlights'])) { |
|
185 | + if ($_GET['highlights'] == "true"){ print _("Highlights:").' <span>'.$highlights.'</span> '; |
|
186 | + } |
|
187 | + } |
|
172 | 188 | if (isset($_GET['airline']) && $_GET['airline'] != ""){ print _("Airline:").' <span>'.$airline.'</span> '; } |
173 | 189 | if (isset($_GET['airline_country']) && $_GET['airline_country'] != ""){ print _("Airline country:").' <span>'.$airline_country.'</span> '; } |
174 | 190 | if (isset($_GET['airline_type']) && $_GET['airline_type'] != ""){ print _("Airline type:").' <span>'.$airline_type.'</span> '; } |
@@ -279,7 +295,10 @@ discard block |
||
279 | 295 | <div class="form-group"> |
280 | 296 | <label class="control-label col-sm-2"><?php echo _("Keywords"); ?></label> |
281 | 297 | <div class="col-sm-10"> |
282 | - <input type="text" class="form-control" id="q" name="q" value="<?php if (isset($_GET['q'])) print $q; ?>" size="10" placeholder="<?php echo _("Keywords"); ?>" /> |
|
298 | + <input type="text" class="form-control" id="q" name="q" value="<?php if (isset($_GET['q'])) { |
|
299 | + print $q; |
|
300 | +} |
|
301 | +?>" size="10" placeholder="<?php echo _("Keywords"); ?>" /> |
|
283 | 302 | </div> |
284 | 303 | </div> |
285 | 304 | </fieldset> |
@@ -294,7 +313,10 @@ discard block |
||
294 | 313 | </select> |
295 | 314 | </div> |
296 | 315 | </div> |
297 | - <script type="text/javascript">getSelect('manufacturer','<?php if(isset($_GET['manufacturer'])) print $manufacturer; ?>')</script> |
|
316 | + <script type="text/javascript">getSelect('manufacturer','<?php if(isset($_GET['manufacturer'])) { |
|
317 | + print $manufacturer; |
|
318 | +} |
|
319 | +?>')</script> |
|
298 | 320 | <div class="form-group"> |
299 | 321 | <label class="control-label col-sm-2"><?php echo _("Type"); ?></label> |
300 | 322 | <div class="col-sm-10"> |
@@ -303,11 +325,17 @@ discard block |
||
303 | 325 | </select> |
304 | 326 | </div> |
305 | 327 | </div> |
306 | - <script type="text/javascript">getSelect('aircrafttypes','<?php if(isset($_GET['aircraft_icao'])) print $aircraft_icao; ?>');</script> |
|
328 | + <script type="text/javascript">getSelect('aircrafttypes','<?php if(isset($_GET['aircraft_icao'])) { |
|
329 | + print $aircraft_icao; |
|
330 | +} |
|
331 | +?>');</script> |
|
307 | 332 | <div class="form-group"> |
308 | 333 | <label class="control-label col-sm-2"><?php echo _("Registration"); ?></label> |
309 | 334 | <div class="col-sm-10"> |
310 | - <input type="text" class="form-control" name="registration" value="<?php if (isset($_GET['registration'])) print $registration; ?>" size="8" placeholder="<?php echo _("Registration"); ?>" /> |
|
335 | + <input type="text" class="form-control" name="registration" value="<?php if (isset($_GET['registration'])) { |
|
336 | + print $registration; |
|
337 | +} |
|
338 | +?>" size="8" placeholder="<?php echo _("Registration"); ?>" /> |
|
311 | 339 | </div> |
312 | 340 | </div> |
313 | 341 | <?php |
@@ -316,22 +344,31 @@ discard block |
||
316 | 344 | <div class="form-group"> |
317 | 345 | <label class="control-label col-sm-2"><?php echo _("Pilot id"); ?></label> |
318 | 346 | <div class="col-sm-10"> |
319 | - <input type="text" class="form-control" name="pilot_id" value="<?php if (isset($_GET['pilot_id'])) print $pilot_id; ?>" size="15" placeholder="<?php echo _("Pilot id"); ?>" /> |
|
347 | + <input type="text" class="form-control" name="pilot_id" value="<?php if (isset($_GET['pilot_id'])) { |
|
348 | + print $pilot_id; |
|
349 | +} |
|
350 | +?>" size="15" placeholder="<?php echo _("Pilot id"); ?>" /> |
|
320 | 351 | </div> |
321 | 352 | </div> |
322 | 353 | <div class="form-group"> |
323 | 354 | <label class="control-label col-sm-2"><?php echo _("Pilot name"); ?></label> |
324 | 355 | <div class="col-sm-10"> |
325 | - <input type="text" class="form-control" name="pilot_name" value="<?php if (isset($_GET['pilot_name'])) print $pilot_name; ?>" size="15" placeholder="<?php echo _("Pilot name"); ?>" /> |
|
356 | + <input type="text" class="form-control" name="pilot_name" value="<?php if (isset($_GET['pilot_name'])) { |
|
357 | + print $pilot_name; |
|
358 | +} |
|
359 | +?>" size="15" placeholder="<?php echo _("Pilot name"); ?>" /> |
|
326 | 360 | </div> |
327 | 361 | </div> |
328 | 362 | <?php |
329 | -}else { |
|
363 | +} else { |
|
330 | 364 | ?> |
331 | 365 | <div class="form-group"> |
332 | 366 | <label class="control-label col-sm-2"><?php echo _("Owner name"); ?></label> |
333 | 367 | <div class="col-sm-10"> |
334 | - <input type="text" class="form-control" name="owner" value="<?php if (isset($_GET['owner'])) print $owner; ?>" size="15" placeholder="<?php echo _("Owner name"); ?>" /> |
|
368 | + <input type="text" class="form-control" name="owner" value="<?php if (isset($_GET['owner'])) { |
|
369 | + print $owner; |
|
370 | +} |
|
371 | +?>" size="15" placeholder="<?php echo _("Owner name"); ?>" /> |
|
335 | 372 | </div> |
336 | 373 | </div> |
337 | 374 | <?php |
@@ -339,8 +376,14 @@ discard block |
||
339 | 376 | ?> |
340 | 377 | <div class="form-group"> |
341 | 378 | <div class="col-sm-offset-2 col-sm-10"> |
342 | - <!--<div><input type="checkbox" class="form-control" name="highlights" value="true" id="highlights" <?php if (isset($_GET['highlights'])) if ($_GET['highlights'] == "true"){ print 'checked="checked"'; } ?>> <label for="highlights"><?php echo _("Include only aircrafts with special highlights (unique liveries, destinations etc.)"); ?></label></div>--> |
|
343 | - <label class="checkbox-inline"><input type="checkbox" name="highlights" value="true" id="highlights" <?php if (isset($_GET['highlights'])) if ($_GET['highlights'] == "true"){ print 'checked="checked"'; } ?>> <?php echo _("Include only aircrafts with special highlights (unique liveries, destinations etc.)"); ?></label> |
|
379 | + <!--<div><input type="checkbox" class="form-control" name="highlights" value="true" id="highlights" <?php if (isset($_GET['highlights'])) { |
|
380 | + if ($_GET['highlights'] == "true"){ print 'checked="checked"'; |
|
381 | +} |
|
382 | +} ?>> <label for="highlights"><?php echo _("Include only aircrafts with special highlights (unique liveries, destinations etc.)"); ?></label></div>--> |
|
383 | + <label class="checkbox-inline"><input type="checkbox" name="highlights" value="true" id="highlights" <?php if (isset($_GET['highlights'])) { |
|
384 | + if ($_GET['highlights'] == "true"){ print 'checked="checked"'; |
|
385 | +} |
|
386 | +} ?>> <?php echo _("Include only aircrafts with special highlights (unique liveries, destinations etc.)"); ?></label> |
|
344 | 387 | </div> |
345 | 388 | </div> |
346 | 389 | </fieldset> |
@@ -354,7 +397,10 @@ discard block |
||
354 | 397 | </select> |
355 | 398 | </div> |
356 | 399 | </div> |
357 | - <script type="text/javascript">getSelect('airlinenames','<?php if(isset($_GET['airline'])) print $airline; ?>');</script> |
|
400 | + <script type="text/javascript">getSelect('airlinenames','<?php if(isset($_GET['airline'])) { |
|
401 | + print $airline; |
|
402 | +} |
|
403 | +?>');</script> |
|
358 | 404 | <div class="form-group"> |
359 | 405 | <label class="control-label col-sm-2"><?php echo _("Country"); ?></label> |
360 | 406 | <div class="col-sm-10"> |
@@ -363,19 +409,34 @@ discard block |
||
363 | 409 | </select> |
364 | 410 | </div> |
365 | 411 | </div> |
366 | - <script type="text/javascript">getSelect('airlinecountries','<?php if(isset($_GET['airline_country'])) print $airline_country; ?>');</script> |
|
412 | + <script type="text/javascript">getSelect('airlinecountries','<?php if(isset($_GET['airline_country'])) { |
|
413 | + print $airline_country; |
|
414 | +} |
|
415 | +?>');</script> |
|
367 | 416 | <div class="form-group"> |
368 | 417 | <label class="control-label col-sm-2"><?php echo _("Callsign"); ?></label> |
369 | 418 | <div class="col-sm-10"> |
370 | - <input type="text" name="callsign" class="form-control" value="<?php if (isset($_GET['callsign'])) print $callsign; ?>" size="8" placeholder="<?php echo _("Callsign"); ?>" /> |
|
419 | + <input type="text" name="callsign" class="form-control" value="<?php if (isset($_GET['callsign'])) { |
|
420 | + print $callsign; |
|
421 | +} |
|
422 | +?>" size="8" placeholder="<?php echo _("Callsign"); ?>" /> |
|
371 | 423 | </div> |
372 | 424 | </div> |
373 | 425 | <div class="form-group"> |
374 | 426 | <div class="col-sm-offset-2 col-sm-10"> |
375 | 427 | <label class="radio-inline"><input type="radio" name="airline_type" value="all" id="airline_type_all" <?php if (!isset($_GET['airline_type']) || $_GET['airline_type'] == "all"){ print 'checked="checked"'; } ?>> <?php echo _("All airlines types"); ?></label> |
376 | - <label class="radio-inline"><input type="radio" name="airline_type" value="passenger" id="airline_type_passenger" <?php if (isset($_GET['airline_type'])) if ($_GET['airline_type'] == "passenger"){ print 'checked="checked"'; } ?>> <?php echo _("Only Passenger airlines"); ?></label> |
|
377 | - <label class="radio-inline"><input type="radio" name="airline_type" value="cargo" id="airline_type_cargo" <?php if (isset($_GET['airline_type'])) if ( $_GET['airline_type'] == "cargo"){ print 'checked="checked"'; } ?>> <?php echo _("Only Cargo airlines"); ?></label> |
|
378 | - <label class="radio-inline"><input type="radio" name="airline_type" value="military" id="airline_type_military" <?php if (isset($_GET['airline_type'])) if ( $_GET['airline_type'] == "military"){ print 'checked="checked"'; } ?>> <?php echo _("Only Military airlines"); ?></label> |
|
428 | + <label class="radio-inline"><input type="radio" name="airline_type" value="passenger" id="airline_type_passenger" <?php if (isset($_GET['airline_type'])) { |
|
429 | + if ($_GET['airline_type'] == "passenger"){ print 'checked="checked"'; |
|
430 | +} |
|
431 | +} ?>> <?php echo _("Only Passenger airlines"); ?></label> |
|
432 | + <label class="radio-inline"><input type="radio" name="airline_type" value="cargo" id="airline_type_cargo" <?php if (isset($_GET['airline_type'])) { |
|
433 | + if ( $_GET['airline_type'] == "cargo"){ print 'checked="checked"'; |
|
434 | +} |
|
435 | +} ?>> <?php echo _("Only Cargo airlines"); ?></label> |
|
436 | + <label class="radio-inline"><input type="radio" name="airline_type" value="military" id="airline_type_military" <?php if (isset($_GET['airline_type'])) { |
|
437 | + if ( $_GET['airline_type'] == "military"){ print 'checked="checked"'; |
|
438 | +} |
|
439 | +} ?>> <?php echo _("Only Military airlines"); ?></label> |
|
379 | 440 | </div> |
380 | 441 | </div> |
381 | 442 | </fieldset> |
@@ -389,7 +450,10 @@ discard block |
||
389 | 450 | </select> |
390 | 451 | </div> |
391 | 452 | </div> |
392 | - <script type="text/javascript">getSelect('airportnames','<?php if(isset($_GET['airport_icao'])) print $airport_icao; ?>');</script> |
|
453 | + <script type="text/javascript">getSelect('airportnames','<?php if(isset($_GET['airport_icao'])) { |
|
454 | + print $airport_icao; |
|
455 | +} |
|
456 | +?>');</script> |
|
393 | 457 | <div class="form-group"> |
394 | 458 | <label class="control-label col-sm-2"><?php echo _("Country"); ?></label> |
395 | 459 | <div class="col-sm-10"> |
@@ -398,7 +462,10 @@ discard block |
||
398 | 462 | </select> |
399 | 463 | </div> |
400 | 464 | </div> |
401 | - <script type="text/javascript">getSelect('airportcountries','<?php if(isset($_GET['airport_country'])) print $airport_country; ?>');</script> |
|
465 | + <script type="text/javascript">getSelect('airportcountries','<?php if(isset($_GET['airport_country'])) { |
|
466 | + print $airport_country; |
|
467 | +} |
|
468 | +?>');</script> |
|
402 | 469 | </fieldset> |
403 | 470 | <fieldset> |
404 | 471 | <legend><?php echo _("Route"); ?></legend> |
@@ -410,7 +477,10 @@ discard block |
||
410 | 477 | </select> |
411 | 478 | </div> |
412 | 479 | </div> |
413 | - <script type="text/javascript">getSelect('departureairportnames','<?php if(isset($_GET['departure_airport_route'])) print $departure_airport_route; ?>');</script> |
|
480 | + <script type="text/javascript">getSelect('departureairportnames','<?php if(isset($_GET['departure_airport_route'])) { |
|
481 | + print $departure_airport_route; |
|
482 | +} |
|
483 | +?>');</script> |
|
414 | 484 | <div class="form-group"> |
415 | 485 | <label class="control-label col-sm-2"><?php echo _("Arrival Airport"); ?></label> |
416 | 486 | <div class="col-sm-10"> |
@@ -419,7 +489,10 @@ discard block |
||
419 | 489 | </select> |
420 | 490 | </div> |
421 | 491 | </div> |
422 | - <script type="text/javascript">getSelect('arrivalairportnames','<?php if(isset($_GET['arrival_airport_route'])) print $arrival_airport_route; ?>');</script> |
|
492 | + <script type="text/javascript">getSelect('arrivalairportnames','<?php if(isset($_GET['arrival_airport_route'])) { |
|
493 | + print $arrival_airport_route; |
|
494 | +} |
|
495 | +?>');</script> |
|
423 | 496 | </fieldset> |
424 | 497 | <fieldset> |
425 | 498 | <legend><?php echo _("Date"); ?></legend> |
@@ -427,7 +500,10 @@ discard block |
||
427 | 500 | <label class="control-label col-sm-2"><?php echo _("Start Date"); ?></label> |
428 | 501 | <div class="col-sm-10"> |
429 | 502 | <div class='input-group date' id='datetimepicker1'> |
430 | - <input type='text' name="start_date" class="form-control" value="<?php if (isset($_GET['start_date'])) print $start_date; ?>" placeholder="<?php echo _("Start Date/Time"); ?>" /> |
|
503 | + <input type='text' name="start_date" class="form-control" value="<?php if (isset($_GET['start_date'])) { |
|
504 | + print $start_date; |
|
505 | +} |
|
506 | +?>" placeholder="<?php echo _("Start Date/Time"); ?>" /> |
|
431 | 507 | <span class="input-group-addon"> |
432 | 508 | <span class="glyphicon glyphicon-calendar"></span> |
433 | 509 | </span> |
@@ -438,7 +514,10 @@ discard block |
||
438 | 514 | <label class="control-label col-sm-2"><?php echo _("End Date"); ?></label> |
439 | 515 | <div class="col-sm-10"> |
440 | 516 | <div class='input-group date' id='datetimepicker2'> |
441 | - <input type='text' name="end_date" class="form-control" value="<?php if (isset($_GET['end_date'])) print $end_date; ?>" placeholder="<?php echo _("End Date/Time"); ?>" /> |
|
517 | + <input type='text' name="end_date" class="form-control" value="<?php if (isset($_GET['end_date'])) { |
|
518 | + print $end_date; |
|
519 | +} |
|
520 | +?>" placeholder="<?php echo _("End Date/Time"); ?>" /> |
|
442 | 521 | <span class="input-group-addon"> |
443 | 522 | <span class="glyphicon glyphicon-calendar"></span> |
444 | 523 | </span> |
@@ -511,19 +590,33 @@ discard block |
||
511 | 590 | <div class="form-group"> |
512 | 591 | <label class="control-label col-sm-2"><?php echo _("Latitude"); ?></label> |
513 | 592 | <div class="col-sm-10"> |
514 | - <input type="text" name="origlat" class="form-control" placeholder="<?php echo _("Center point latitude"); ?>" value="<?php if (isset($_GET['origlat'])) print $origlat; ?>" /> |
|
593 | + <input type="text" name="origlat" class="form-control" placeholder="<?php echo _("Center point latitude"); ?>" value="<?php if (isset($_GET['origlat'])) { |
|
594 | + print $origlat; |
|
595 | +} |
|
596 | +?>" /> |
|
515 | 597 | </div> |
516 | 598 | </div> |
517 | 599 | <div class="form-group"> |
518 | 600 | <label class="control-label col-sm-2"><?php echo _("Longitude"); ?></label> |
519 | 601 | <div class="col-sm-10"> |
520 | - <input type="text" name="origlon" class="form-control" placeholder="<?php echo _("Center point longitude"); ?>" value="<?php if (isset($_GET['origlon'])) print $origlon; ?>" /> |
|
602 | + <input type="text" name="origlon" class="form-control" placeholder="<?php echo _("Center point longitude"); ?>" value="<?php if (isset($_GET['origlon'])) { |
|
603 | + print $origlon; |
|
604 | +} |
|
605 | +?>" /> |
|
521 | 606 | </div> |
522 | 607 | </div> |
523 | 608 | <div class="form-group"> |
524 | - <label class="control-label col-sm-2"><?php echo _("Distance").' ('; if (isset($globalDistanceUnit)) print $globalDistanceUnit; else print 'km'; print ')'; ?></label> |
|
609 | + <label class="control-label col-sm-2"><?php echo _("Distance").' ('; if (isset($globalDistanceUnit)) { |
|
610 | + print $globalDistanceUnit; |
|
611 | +} else { |
|
612 | + print 'km'; |
|
613 | +} |
|
614 | +print ')'; ?></label> |
|
525 | 615 | <div class="col-sm-10"> |
526 | - <input type="text" name="dist" class="form-control" placeholder="<?php echo _("Distance from center point"); ?>" value="<?php if (isset($_GET['distance'])) print $distance; ?>" /> |
|
616 | + <input type="text" name="dist" class="form-control" placeholder="<?php echo _("Distance from center point"); ?>" value="<?php if (isset($_GET['distance'])) { |
|
617 | + print $distance; |
|
618 | +} |
|
619 | +?>" /> |
|
527 | 620 | </div> |
528 | 621 | </div> |
529 | 622 | </fieldset> |
@@ -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 |