@@ -96,8 +96,11 @@ |
||
96 | 96 | } elseif (isset($_GET['marine'])) { |
97 | 97 | readfile(dirname(__FILE__).DIRECTORY_SEPARATOR.'images/vehicules/'.$filename); |
98 | 98 | } else { |
99 | - if ($color == 'FF0000') readfile(dirname(__FILE__).DIRECTORY_SEPARATOR.'images/aircrafts/selected/'.$filename); |
|
100 | - else readfile(dirname(__FILE__).DIRECTORY_SEPARATOR.'images/aircrafts/'.$filename); |
|
99 | + if ($color == 'FF0000') { |
|
100 | + readfile(dirname(__FILE__).DIRECTORY_SEPARATOR.'images/aircrafts/selected/'.$filename); |
|
101 | + } else { |
|
102 | + readfile(dirname(__FILE__).DIRECTORY_SEPARATOR.'images/aircrafts/'.$filename); |
|
103 | + } |
|
101 | 104 | } |
102 | 105 | } |
103 | 106 | ?> |
104 | 107 | \ No newline at end of file |
@@ -47,27 +47,52 @@ discard block |
||
47 | 47 | } |
48 | 48 | header('Content-Type: text/javascript'); |
49 | 49 | |
50 | -if (!isset($globalJsonCompress)) $compress = true; |
|
51 | -else $compress = $globalJsonCompress; |
|
50 | +if (!isset($globalJsonCompress)) { |
|
51 | + $compress = true; |
|
52 | +} else { |
|
53 | + $compress = $globalJsonCompress; |
|
54 | +} |
|
52 | 55 | |
53 | 56 | $from_archive = false; |
54 | 57 | $min = true; |
55 | 58 | $allhistory = false; |
56 | 59 | $filter['source'] = array(); |
57 | -if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') $filter['source'] = array_merge($filter['source'],array('vatsimtxt')); |
|
58 | -if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') $filter['source'] = array_merge($filter['source'],array('whazzup')); |
|
59 | -if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') $filter['source'] = array_merge($filter['source'],array('phpvmacars')); |
|
60 | -if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') $filter['source'] = array_merge($filter['source'],array('sbs')); |
|
61 | -if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') $filter['source'] = array_merge($filter['source'],array('aprs')); |
|
62 | -if (isset($_COOKIE['filter_ident']) && $_COOKIE['filter_ident'] != '') $filter['ident'] = filter_var($_COOKIE['filter_ident'],FILTER_SANITIZE_STRING); |
|
63 | -if (isset($_COOKIE['filter_Airlines']) && $_COOKIE['filter_Airlines'] != '') $filter['airlines'] = filter_var_array(explode(',',$_COOKIE['filter_Airlines']),FILTER_SANITIZE_STRING); |
|
64 | -if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') $filter['source_aprs'] = filter_var_array(explode(',',$_COOKIE['filter_Sources']),FILTER_SANITIZE_STRING); |
|
65 | -if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') $filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'],FILTER_SANITIZE_STRING); |
|
66 | -if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] != 'all') $filter['alliance'] = filter_var($_COOKIE['filter_alliance'],FILTER_SANITIZE_STRING); |
|
60 | +if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') { |
|
61 | + $filter['source'] = array_merge($filter['source'],array('vatsimtxt')); |
|
62 | +} |
|
63 | +if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') { |
|
64 | + $filter['source'] = array_merge($filter['source'],array('whazzup')); |
|
65 | +} |
|
66 | +if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') { |
|
67 | + $filter['source'] = array_merge($filter['source'],array('phpvmacars')); |
|
68 | +} |
|
69 | +if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') { |
|
70 | + $filter['source'] = array_merge($filter['source'],array('sbs')); |
|
71 | +} |
|
72 | +if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') { |
|
73 | + $filter['source'] = array_merge($filter['source'],array('aprs')); |
|
74 | +} |
|
75 | +if (isset($_COOKIE['filter_ident']) && $_COOKIE['filter_ident'] != '') { |
|
76 | + $filter['ident'] = filter_var($_COOKIE['filter_ident'],FILTER_SANITIZE_STRING); |
|
77 | +} |
|
78 | +if (isset($_COOKIE['filter_Airlines']) && $_COOKIE['filter_Airlines'] != '') { |
|
79 | + $filter['airlines'] = filter_var_array(explode(',',$_COOKIE['filter_Airlines']),FILTER_SANITIZE_STRING); |
|
80 | +} |
|
81 | +if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') { |
|
82 | + $filter['source_aprs'] = filter_var_array(explode(',',$_COOKIE['filter_Sources']),FILTER_SANITIZE_STRING); |
|
83 | +} |
|
84 | +if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') { |
|
85 | + $filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'],FILTER_SANITIZE_STRING); |
|
86 | +} |
|
87 | +if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] != 'all') { |
|
88 | + $filter['alliance'] = filter_var($_COOKIE['filter_alliance'],FILTER_SANITIZE_STRING); |
|
89 | +} |
|
67 | 90 | |
68 | 91 | if (isset($globalMapPopup) && !$globalMapPopup && !(isset($_COOKIE['flightpopup']) && $_COOKIE['flightpopup'] == 'true')) { |
69 | 92 | $min = true; |
70 | -} else $min = false; |
|
93 | +} else { |
|
94 | + $min = false; |
|
95 | +} |
|
71 | 96 | |
72 | 97 | if (isset($_GET['ident'])) { |
73 | 98 | $ident = filter_input(INPUT_GET,'ident',FILTER_SANITIZE_STRING); |
@@ -149,20 +174,30 @@ discard block |
||
149 | 174 | } |
150 | 175 | */ |
151 | 176 | $flightcnt = count($spotter_array); |
152 | - if ($flightcnt == '') $flightcnt = 0; |
|
153 | -} else $flightcnt = 0; |
|
177 | + if ($flightcnt == '') { |
|
178 | + $flightcnt = 0; |
|
179 | + } |
|
180 | + } else { |
|
181 | + $flightcnt = 0; |
|
182 | +} |
|
154 | 183 | |
155 | 184 | $sqltime = round(microtime(true)-$begintime,2); |
156 | 185 | |
157 | -if ((!isset($_COOKIE['flightestimation']) && isset($globalMapEstimation) && $globalMapEstimation == FALSE) || (isset($_COOKIE['flightestimation']) && $_COOKIE['flightestimation'] == 'false')) $usenextlatlon = false; |
|
158 | -else $usenextlatlon = true; |
|
186 | +if ((!isset($_COOKIE['flightestimation']) && isset($globalMapEstimation) && $globalMapEstimation == FALSE) || (isset($_COOKIE['flightestimation']) && $_COOKIE['flightestimation'] == 'false')) { |
|
187 | + $usenextlatlon = false; |
|
188 | +} else { |
|
189 | + $usenextlatlon = true; |
|
190 | +} |
|
159 | 191 | $j = 0; |
160 | 192 | $prev_flightaware_id = ''; |
161 | 193 | $aircrafts_shadow = array(); |
162 | 194 | $output = '{'; |
163 | 195 | $output .= '"type": "FeatureCollection",'; |
164 | - if ($min) $output .= '"minimal": "true",'; |
|
165 | - else $output .= '"minimal": "false",'; |
|
196 | + if ($min) { |
|
197 | + $output .= '"minimal": "true",'; |
|
198 | + } else { |
|
199 | + $output .= '"minimal": "false",'; |
|
200 | + } |
|
166 | 201 | $output .= '"fc": "'.$flightcnt.'",'; |
167 | 202 | $output .= '"sqt": "'.$sqltime.'",'; |
168 | 203 | |
@@ -206,18 +241,29 @@ discard block |
||
206 | 241 | } |
207 | 242 | $output .= '"properties": {'; |
208 | 243 | if (isset($spotter_item['flightaware_id'])) { |
209 | - if ($compress) $output .= '"fi": "'.$spotter_item['flightaware_id'].'",'; |
|
210 | - else $output .= '"flightaware_id": "'.$spotter_item['flightaware_id'].'",'; |
|
244 | + if ($compress) { |
|
245 | + $output .= '"fi": "'.$spotter_item['flightaware_id'].'",'; |
|
246 | + } else { |
|
247 | + $output .= '"flightaware_id": "'.$spotter_item['flightaware_id'].'",'; |
|
248 | + } |
|
211 | 249 | } elseif (isset($spotter_item['famtrackid'])) { |
212 | - if ($compress) $output .= '"fti": "'.$spotter_item['famtrackid'].'",'; |
|
213 | - else $output .= '"famtrackid": "'.$spotter_item['famtrackid'].'",'; |
|
250 | + if ($compress) { |
|
251 | + $output .= '"fti": "'.$spotter_item['famtrackid'].'",'; |
|
252 | + } else { |
|
253 | + $output .= '"famtrackid": "'.$spotter_item['famtrackid'].'",'; |
|
254 | + } |
|
214 | 255 | } elseif (isset($spotter_item['fammarine_id'])) { |
215 | - if ($compress) $output .= '"fmi": "'.$spotter_item['fammarine_id'].'",'; |
|
216 | - else $output .= '"fammarineid": "'.$spotter_item['fammarine_id'].'",'; |
|
256 | + if ($compress) { |
|
257 | + $output .= '"fmi": "'.$spotter_item['fammarine_id'].'",'; |
|
258 | + } else { |
|
259 | + $output .= '"fammarineid": "'.$spotter_item['fammarine_id'].'",'; |
|
260 | + } |
|
217 | 261 | } |
218 | 262 | $output .= '"fc": "'.$flightcnt.'",'; |
219 | 263 | $output .= '"sqt": "'.$sqltime.'",'; |
220 | - if (isset($begindate)) $output .= '"archive_date": "'.$begindate.'",'; |
|
264 | + if (isset($begindate)) { |
|
265 | + $output .= '"archive_date": "'.$begindate.'",'; |
|
266 | + } |
|
221 | 267 | |
222 | 268 | /* |
223 | 269 | if ($min) $output .= '"minimal": "true",'; |
@@ -225,13 +271,21 @@ discard block |
||
225 | 271 | */ |
226 | 272 | //$output .= '"fc": "'.$spotter_item['nb'].'",'; |
227 | 273 | if (isset($spotter_item['ident']) && $spotter_item['ident'] != '') { |
228 | - if ($compress) $output .= '"c": "'.$spotter_item['ident'].'",'; |
|
229 | - else $output .= '"callsign": "'.$spotter_item['ident'].'",'; |
|
274 | + if ($compress) { |
|
275 | + $output .= '"c": "'.$spotter_item['ident'].'",'; |
|
276 | + } else { |
|
277 | + $output .= '"callsign": "'.$spotter_item['ident'].'",'; |
|
278 | + } |
|
230 | 279 | } else { |
231 | - if ($compress) $output .= '"c": "NA",'; |
|
232 | - else $output .= '"callsign": "NA",'; |
|
280 | + if ($compress) { |
|
281 | + $output .= '"c": "NA",'; |
|
282 | + } else { |
|
283 | + $output .= '"callsign": "NA",'; |
|
284 | + } |
|
285 | + } |
|
286 | + if (isset($spotter_item['registration'])) { |
|
287 | + $output .= '"registration": "'.$spotter_item['registration'].'",'; |
|
233 | 288 | } |
234 | - if (isset($spotter_item['registration'])) $output .= '"registration": "'.$spotter_item['registration'].'",'; |
|
235 | 289 | if (isset($spotter_item['aircraft_name']) && isset($spotter_item['aircraft_type'])) { |
236 | 290 | $output .= '"aircraft_name": "'.$spotter_item['aircraft_name'].' ('.$spotter_item['aircraft_type'].')",'; |
237 | 291 | $output .= '"aircraft_wiki": "http://'.strtolower($globalLanguage).'.wikipedia.org/wiki/'.urlencode(str_replace(' ','_',$spotter_item['aircraft_name'])).'",'; |
@@ -244,15 +298,21 @@ discard block |
||
244 | 298 | $output .= '"aircraft_icao": "'.$spotter_item['aircraft_icao'].'",'; |
245 | 299 | } |
246 | 300 | if (!isset($spotter_item['aircraft_shadow']) && !$tracker) { |
247 | - if (!isset($spotter_item['aircraft_icao']) || $spotter_item['aircraft_icao'] == '') $spotter_item['aircraft_shadow'] = ''; |
|
248 | - else { |
|
301 | + if (!isset($spotter_item['aircraft_icao']) || $spotter_item['aircraft_icao'] == '') { |
|
302 | + $spotter_item['aircraft_shadow'] = ''; |
|
303 | + } else { |
|
249 | 304 | $aircraft_icao = $spotter_item['aircraft_icao']; |
250 | - if (isset($aircrafts_shadow[$aircraft_icao])) $spotter_item['aircraft_shadow'] = $aircrafts_shadow[$aircraft_icao]; |
|
251 | - else { |
|
305 | + if (isset($aircrafts_shadow[$aircraft_icao])) { |
|
306 | + $spotter_item['aircraft_shadow'] = $aircrafts_shadow[$aircraft_icao]; |
|
307 | + } else { |
|
252 | 308 | $aircraft_info = $Spotter->getAllAircraftInfo($spotter_item['aircraft_icao']); |
253 | - if (count($aircraft_info) > 0) $spotter_item['aircraft_shadow'] = $aircraft_info[0]['aircraft_shadow']; |
|
254 | - elseif (isset($spotter_item['format_source']) && $spotter_item['format_source'] == 'aprs') $spotter_item['aircraft_shadow'] = 'PA18.png'; |
|
255 | - else $spotter_item['aircraft_shadow'] = ''; |
|
309 | + if (count($aircraft_info) > 0) { |
|
310 | + $spotter_item['aircraft_shadow'] = $aircraft_info[0]['aircraft_shadow']; |
|
311 | + } elseif (isset($spotter_item['format_source']) && $spotter_item['format_source'] == 'aprs') { |
|
312 | + $spotter_item['aircraft_shadow'] = 'PA18.png'; |
|
313 | + } else { |
|
314 | + $spotter_item['aircraft_shadow'] = ''; |
|
315 | + } |
|
256 | 316 | $aircrafts_shadow[$aircraft_icao] = $spotter_item['aircraft_shadow']; |
257 | 317 | } |
258 | 318 | } |
@@ -260,73 +320,139 @@ discard block |
||
260 | 320 | if (!isset($spotter_item['aircraft_shadow']) || $spotter_item['aircraft_shadow'] == '') { |
261 | 321 | if ($tracker) { |
262 | 322 | if (isset($spotter_item['type']) && $spotter_item['type'] == 'Ambulance') { |
263 | - if ($compress) $output .= '"as": "ambulance.png",'; |
|
264 | - else $output .= '"aircraft_shadow": "ambulance.png",'; |
|
323 | + if ($compress) { |
|
324 | + $output .= '"as": "ambulance.png",'; |
|
325 | + } else { |
|
326 | + $output .= '"aircraft_shadow": "ambulance.png",'; |
|
327 | + } |
|
265 | 328 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Police') { |
266 | - if ($compress) $output .= '"as": "police.png",'; |
|
267 | - else $output .= '"aircraft_shadow": "police.png",'; |
|
329 | + if ($compress) { |
|
330 | + $output .= '"as": "police.png",'; |
|
331 | + } else { |
|
332 | + $output .= '"aircraft_shadow": "police.png",'; |
|
333 | + } |
|
268 | 334 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Yacht (Sail)') { |
269 | - if ($compress) $output .= '"as": "ship.png",'; |
|
270 | - else $output .= '"aircraft_shadow": "ship.png",'; |
|
335 | + if ($compress) { |
|
336 | + $output .= '"as": "ship.png",'; |
|
337 | + } else { |
|
338 | + $output .= '"aircraft_shadow": "ship.png",'; |
|
339 | + } |
|
271 | 340 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Ship (Power Boat)') { |
272 | - if ($compress) $output .= '"as": "ship.png",'; |
|
273 | - else $output .= '"aircraft_shadow": "ship.png",'; |
|
341 | + if ($compress) { |
|
342 | + $output .= '"as": "ship.png",'; |
|
343 | + } else { |
|
344 | + $output .= '"aircraft_shadow": "ship.png",'; |
|
345 | + } |
|
274 | 346 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Shuttle') { |
275 | - if ($compress) $output .= '"as": "ship.png",'; |
|
276 | - else $output .= '"aircraft_shadow": "ship.png",'; |
|
347 | + if ($compress) { |
|
348 | + $output .= '"as": "ship.png",'; |
|
349 | + } else { |
|
350 | + $output .= '"aircraft_shadow": "ship.png",'; |
|
351 | + } |
|
277 | 352 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Truck') { |
278 | - if ($compress) $output .= '"as": "truck.png",'; |
|
279 | - else $output .= '"aircraft_shadow": "truck.png",'; |
|
353 | + if ($compress) { |
|
354 | + $output .= '"as": "truck.png",'; |
|
355 | + } else { |
|
356 | + $output .= '"aircraft_shadow": "truck.png",'; |
|
357 | + } |
|
280 | 358 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Truck (18 Wheeler)') { |
281 | - if ($compress) $output .= '"as": "truck.png",'; |
|
282 | - else $output .= '"aircraft_shadow": "truck.png",'; |
|
359 | + if ($compress) { |
|
360 | + $output .= '"as": "truck.png",'; |
|
361 | + } else { |
|
362 | + $output .= '"aircraft_shadow": "truck.png",'; |
|
363 | + } |
|
283 | 364 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Aircraft (small)') { |
284 | - if ($compress) $output .= '"as": "aircraft.png",'; |
|
285 | - else $output .= '"aircraft_shadow": "aircraft.png",'; |
|
365 | + if ($compress) { |
|
366 | + $output .= '"as": "aircraft.png",'; |
|
367 | + } else { |
|
368 | + $output .= '"aircraft_shadow": "aircraft.png",'; |
|
369 | + } |
|
286 | 370 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Large Aircraft') { |
287 | - if ($compress) $output .= '"as": "aircraft.png",'; |
|
288 | - else $output .= '"aircraft_shadow": "aircraft.png",'; |
|
371 | + if ($compress) { |
|
372 | + $output .= '"as": "aircraft.png",'; |
|
373 | + } else { |
|
374 | + $output .= '"aircraft_shadow": "aircraft.png",'; |
|
375 | + } |
|
289 | 376 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Helicopter') { |
290 | - if ($compress) $output .= '"as": "helico.png",'; |
|
291 | - else $output .= '"aircraft_shadow": "helico.png",'; |
|
377 | + if ($compress) { |
|
378 | + $output .= '"as": "helico.png",'; |
|
379 | + } else { |
|
380 | + $output .= '"aircraft_shadow": "helico.png",'; |
|
381 | + } |
|
292 | 382 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Railroad Engine') { |
293 | - if ($compress) $output .= '"as": "rail.png",'; |
|
294 | - else $output .= '"aircraft_shadow": "rail.png",'; |
|
383 | + if ($compress) { |
|
384 | + $output .= '"as": "rail.png",'; |
|
385 | + } else { |
|
386 | + $output .= '"aircraft_shadow": "rail.png",'; |
|
387 | + } |
|
295 | 388 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Firetruck') { |
296 | - if ($compress) $output .= '"as": "firetruck.png",'; |
|
297 | - else $output .= '"aircraft_shadow": "firetruck.png",'; |
|
389 | + if ($compress) { |
|
390 | + $output .= '"as": "firetruck.png",'; |
|
391 | + } else { |
|
392 | + $output .= '"aircraft_shadow": "firetruck.png",'; |
|
393 | + } |
|
298 | 394 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Bus') { |
299 | - if ($compress) $output .= '"as": "bus.png",'; |
|
300 | - else $output .= '"aircraft_shadow": "bus.png",'; |
|
395 | + if ($compress) { |
|
396 | + $output .= '"as": "bus.png",'; |
|
397 | + } else { |
|
398 | + $output .= '"aircraft_shadow": "bus.png",'; |
|
399 | + } |
|
301 | 400 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Phone') { |
302 | - if ($compress) $output .= '"as": "phone.png",'; |
|
303 | - else $output .= '"aircraft_shadow": "phone.png",'; |
|
401 | + if ($compress) { |
|
402 | + $output .= '"as": "phone.png",'; |
|
403 | + } else { |
|
404 | + $output .= '"aircraft_shadow": "phone.png",'; |
|
405 | + } |
|
304 | 406 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Jogger') { |
305 | - if ($compress) $output .= '"as": "jogger.png",'; |
|
306 | - else $output .= '"aircraft_shadow": "jogger.png",'; |
|
407 | + if ($compress) { |
|
408 | + $output .= '"as": "jogger.png",'; |
|
409 | + } else { |
|
410 | + $output .= '"aircraft_shadow": "jogger.png",'; |
|
411 | + } |
|
307 | 412 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Bike') { |
308 | - if ($compress) $output .= '"as": "bike.png",'; |
|
309 | - else $output .= '"aircraft_shadow": "bike.png",'; |
|
413 | + if ($compress) { |
|
414 | + $output .= '"as": "bike.png",'; |
|
415 | + } else { |
|
416 | + $output .= '"aircraft_shadow": "bike.png",'; |
|
417 | + } |
|
310 | 418 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Motorcycle') { |
311 | - if ($compress) $output .= '"as": "motorcycle.png",'; |
|
312 | - else $output .= '"aircraft_shadow": "motorcycle.png",'; |
|
419 | + if ($compress) { |
|
420 | + $output .= '"as": "motorcycle.png",'; |
|
421 | + } else { |
|
422 | + $output .= '"aircraft_shadow": "motorcycle.png",'; |
|
423 | + } |
|
313 | 424 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Balloon') { |
314 | - if ($compress) $output .= '"as": "balloon.png",'; |
|
315 | - else $output .= '"aircraft_shadow": "balloon.png",'; |
|
425 | + if ($compress) { |
|
426 | + $output .= '"as": "balloon.png",'; |
|
427 | + } else { |
|
428 | + $output .= '"aircraft_shadow": "balloon.png",'; |
|
429 | + } |
|
316 | 430 | } else { |
317 | - if ($compress) $output .= '"as": "car.png",'; |
|
318 | - else $output .= '"aircraft_shadow": "car.png",'; |
|
431 | + if ($compress) { |
|
432 | + $output .= '"as": "car.png",'; |
|
433 | + } else { |
|
434 | + $output .= '"aircraft_shadow": "car.png",'; |
|
435 | + } |
|
319 | 436 | } |
320 | 437 | } elseif ($marine) { |
321 | - if ($compress) $output .= '"as": "ship.png",'; |
|
322 | - else $output .= '"aircraft_shadow": "ship.png",'; |
|
438 | + if ($compress) { |
|
439 | + $output .= '"as": "ship.png",'; |
|
440 | + } else { |
|
441 | + $output .= '"aircraft_shadow": "ship.png",'; |
|
442 | + } |
|
323 | 443 | } else { |
324 | - if ($compress) $output .= '"as": "default.png",'; |
|
325 | - else $output .= '"aircraft_shadow": "default.png",'; |
|
444 | + if ($compress) { |
|
445 | + $output .= '"as": "default.png",'; |
|
446 | + } else { |
|
447 | + $output .= '"aircraft_shadow": "default.png",'; |
|
448 | + } |
|
326 | 449 | } |
327 | 450 | } else { |
328 | - if ($compress) $output .= '"as": "'.$spotter_item['aircraft_shadow'].'",'; |
|
329 | - else $output .= '"aircraft_shadow": "'.$spotter_item['aircraft_shadow'].'",'; |
|
451 | + if ($compress) { |
|
452 | + $output .= '"as": "'.$spotter_item['aircraft_shadow'].'",'; |
|
453 | + } else { |
|
454 | + $output .= '"aircraft_shadow": "'.$spotter_item['aircraft_shadow'].'",'; |
|
455 | + } |
|
330 | 456 | } |
331 | 457 | if (isset($spotter_item['airline_name'])) { |
332 | 458 | $output .= '"airline_name": "'.$spotter_item['airline_name'].'",'; |
@@ -334,8 +460,11 @@ discard block |
||
334 | 460 | $output .= '"airline_name": "NA",'; |
335 | 461 | } |
336 | 462 | if (isset($spotter_item['departure_airport'])) { |
337 | - if ($compress) $output .= '"dac": "'.$spotter_item['departure_airport'].'",'; |
|
338 | - else $output .= '"departure_airport_code": "'.$spotter_item['departure_airport'].'",'; |
|
463 | + if ($compress) { |
|
464 | + $output .= '"dac": "'.$spotter_item['departure_airport'].'",'; |
|
465 | + } else { |
|
466 | + $output .= '"departure_airport_code": "'.$spotter_item['departure_airport'].'",'; |
|
467 | + } |
|
339 | 468 | } |
340 | 469 | if (isset($spotter_item['departure_airport_city'])) { |
341 | 470 | $output .= '"departure_airport": "'.$spotter_item['departure_airport_city'].', '.$spotter_item['departure_airport_country'].'",'; |
@@ -347,8 +476,11 @@ discard block |
||
347 | 476 | $output .= '"arrival_airport_time": "'.$spotter_item['arrival_airport_time'].'",'; |
348 | 477 | } |
349 | 478 | if (isset($spotter_item['arrival_airport'])) { |
350 | - if ($compress) $output .= '"aac": "'.$spotter_item['arrival_airport'].'",'; |
|
351 | - else $output .= '"arrival_airport_code": "'.$spotter_item['arrival_airport'].'",'; |
|
479 | + if ($compress) { |
|
480 | + $output .= '"aac": "'.$spotter_item['arrival_airport'].'",'; |
|
481 | + } else { |
|
482 | + $output .= '"arrival_airport_code": "'.$spotter_item['arrival_airport'].'",'; |
|
483 | + } |
|
352 | 484 | } |
353 | 485 | if (isset($spotter_item['arrival_airport_city'])) { |
354 | 486 | $output .= '"arrival_airport": "'.$spotter_item['arrival_airport_city'].', '.$spotter_item['arrival_airport_country'].'",'; |
@@ -367,11 +499,17 @@ discard block |
||
367 | 499 | } |
368 | 500 | |
369 | 501 | if (isset($spotter_item['altitude'])) { |
370 | - if ($compress) $output .= '"a": "'.$spotter_item['altitude'].'",'; |
|
371 | - else $output .= '"altitude": "'.$spotter_item['altitude'].'",'; |
|
502 | + if ($compress) { |
|
503 | + $output .= '"a": "'.$spotter_item['altitude'].'",'; |
|
504 | + } else { |
|
505 | + $output .= '"altitude": "'.$spotter_item['altitude'].'",'; |
|
506 | + } |
|
507 | + } |
|
508 | + if ($compress) { |
|
509 | + $output .= '"h": "'.$spotter_item['heading'].'",'; |
|
510 | + } else { |
|
511 | + $output .= '"heading": "'.$spotter_item['heading'].'",'; |
|
372 | 512 | } |
373 | - if ($compress)$output .= '"h": "'.$spotter_item['heading'].'",'; |
|
374 | - else $output .= '"heading": "'.$spotter_item['heading'].'",'; |
|
375 | 513 | |
376 | 514 | if (isset($archivespeed)) { |
377 | 515 | $nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$spotter_item['heading'],$archivespeed); |
@@ -381,7 +519,9 @@ discard block |
||
381 | 519 | $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],'; |
382 | 520 | } |
383 | 521 | |
384 | - if (!$min) $output .= '"image": "'.$image.'",'; |
|
522 | + if (!$min) { |
|
523 | + $output .= '"image": "'.$image.'",'; |
|
524 | + } |
|
385 | 525 | if (isset($spotter_item['image_copyright']) && $spotter_item['image_copyright'] != '') { |
386 | 526 | $output .= '"image_copyright": "'.str_replace('"',"'",trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'',$spotter_item['image_copyright']))).'",'; |
387 | 527 | } |
@@ -389,8 +529,11 @@ discard block |
||
389 | 529 | $output .= '"image_source_website": "'.urlencode($spotter_item['image_source_website']).'",'; |
390 | 530 | } |
391 | 531 | if (isset($spotter_item['squawk'])) { |
392 | - if ($compress) $output .= '"sq": "'.$spotter_item['squawk'].'",'; |
|
393 | - else $output .= '"squawk": "'.$spotter_item['squawk'].'",'; |
|
532 | + if ($compress) { |
|
533 | + $output .= '"sq": "'.$spotter_item['squawk'].'",'; |
|
534 | + } else { |
|
535 | + $output .= '"squawk": "'.$spotter_item['squawk'].'",'; |
|
536 | + } |
|
394 | 537 | } |
395 | 538 | if (isset($spotter_item['squawk_usage'])) { |
396 | 539 | $output .= '"squawk_usage": "'.$spotter_item['squawk_usage'].'",'; |
@@ -409,14 +552,23 @@ discard block |
||
409 | 552 | } |
410 | 553 | // type when not aircraft ? |
411 | 554 | if (isset($spotter_item['type'])) { |
412 | - if ($compress) $output .= '"t": "'.$spotter_item['type'].'"'; |
|
413 | - else $output .= '"type": "'.$spotter_item['type'].'"'; |
|
555 | + if ($compress) { |
|
556 | + $output .= '"t": "'.$spotter_item['type'].'"'; |
|
557 | + } else { |
|
558 | + $output .= '"type": "'.$spotter_item['type'].'"'; |
|
559 | + } |
|
414 | 560 | } elseif ($marine) { |
415 | - if ($compress) $output .= '"t": "ship"'; |
|
416 | - else $output .= '"type": "ship"'; |
|
561 | + if ($compress) { |
|
562 | + $output .= '"t": "ship"'; |
|
563 | + } else { |
|
564 | + $output .= '"type": "ship"'; |
|
565 | + } |
|
417 | 566 | } else { |
418 | - if ($compress) $output .= '"t": "aircraft"'; |
|
419 | - else $output .= '"type": "aircraft"'; |
|
567 | + if ($compress) { |
|
568 | + $output .= '"t": "aircraft"'; |
|
569 | + } else { |
|
570 | + $output .= '"type": "aircraft"'; |
|
571 | + } |
|
420 | 572 | } |
421 | 573 | $output .= '},'; |
422 | 574 | $output .= '"geometry": {'; |
@@ -484,7 +636,9 @@ discard block |
||
484 | 636 | } |
485 | 637 | */ |
486 | 638 | $history = filter_input(INPUT_GET,'history',FILTER_SANITIZE_STRING); |
487 | - if ($history == '' && isset($_COOKIE['history'])) $history = $_COOKIE['history']; |
|
639 | + if ($history == '' && isset($_COOKIE['history'])) { |
|
640 | + $history = $_COOKIE['history']; |
|
641 | + } |
|
488 | 642 | |
489 | 643 | if ((isset($_COOKIE['flightpath']) && $_COOKIE['flightpath'] == 'true') |
490 | 644 | || (!isset($_COOKIE['flightpath']) |
@@ -513,8 +667,11 @@ discard block |
||
513 | 667 | $output_history .= ']}},'; |
514 | 668 | $output .= $output_history; |
515 | 669 | } |
516 | - if ($compress) $output_history = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "history","a": "'.$alt.'"},"geometry": {"type": "LineString","coordinates": ['; |
|
517 | - else $output_history = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "history","altitude": "'.$alt.'"},"geometry": {"type": "LineString","coordinates": ['; |
|
670 | + if ($compress) { |
|
671 | + $output_history = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "history","a": "'.$alt.'"},"geometry": {"type": "LineString","coordinates": ['; |
|
672 | + } else { |
|
673 | + $output_history = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "history","altitude": "'.$alt.'"},"geometry": {"type": "LineString","coordinates": ['; |
|
674 | + } |
|
518 | 675 | } |
519 | 676 | $output_history .= '['; |
520 | 677 | $output_history .= $spotter_history['longitude'].', '; |
@@ -524,9 +681,14 @@ discard block |
||
524 | 681 | $prev_alt = $alt; |
525 | 682 | } else { |
526 | 683 | if ($d == false) { |
527 | - if ($compress) $output_history = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "history"},"geometry": {"type": "LineString","coordinates": ['; |
|
528 | - else $output_history = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "history"},"geometry": {"type": "LineString","coordinates": ['; |
|
529 | - } else $d = true; |
|
684 | + if ($compress) { |
|
685 | + $output_history = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "history"},"geometry": {"type": "LineString","coordinates": ['; |
|
686 | + } else { |
|
687 | + $output_history = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "history"},"geometry": {"type": "LineString","coordinates": ['; |
|
688 | + } |
|
689 | + } else { |
|
690 | + $d = true; |
|
691 | + } |
|
530 | 692 | $output_history .= '['; |
531 | 693 | $output_history .= $spotter_history['longitude'].', '; |
532 | 694 | $output_history .= $spotter_history['latitude']; |
@@ -570,7 +732,9 @@ discard block |
||
570 | 732 | $output .= ']'; |
571 | 733 | $output .= ',"initial_sqltime": "'.$sqltime.'",'; |
572 | 734 | $output .= '"totaltime": "'.round(microtime(true)-$begintime,2).'",'; |
573 | - if (isset($begindate)) $output .= '"archive_date": "'.$begindate.'",'; |
|
735 | + if (isset($begindate)) { |
|
736 | + $output .= '"archive_date": "'.$begindate.'",'; |
|
737 | + } |
|
574 | 738 | $output .= '"fc": "'.$j.'"'; |
575 | 739 | } else { |
576 | 740 | $output .= '"features": '; |
@@ -55,7 +55,9 @@ discard block |
||
55 | 55 | { |
56 | 56 | if ($spotter_item['image_source'] == 'flickr' || $spotter_item['image_source'] == 'wikimedia' || $spotter_item['image_source'] == 'devianart') { |
57 | 57 | $image = preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']); |
58 | - } else $image = $spotter_item['image_thumbnail']; |
|
58 | + } else { |
|
59 | + $image = $spotter_item['image_thumbnail']; |
|
60 | + } |
|
59 | 61 | |
60 | 62 | } |
61 | 63 | /* else { |
@@ -67,7 +69,9 @@ discard block |
||
67 | 69 | print '<div class="left"><img src="'.$image.'" alt="'.$spotter_item['registration'].' '.$spotter_item['aircraft_name'].'" title="'.$spotter_item['registration'].' '.$spotter_item['aircraft_name'].' Image © '.$spotter_item['image_copyright'].'"/><br />Image © '.$spotter_item['image_copyright'].'</div>'; |
68 | 70 | } |
69 | 71 | print '<div class="right"><div class="callsign-details"><div class="callsign"><a href="'.$globalURL.'/redirect/'.$spotter_item['flightaware_id'].'" target="_blank">'.$spotter_item['ident'].'</a></div>'; |
70 | -if (isset($spotter_item['airline_name'])) print '<div class="airline">'.$spotter_item['airline_name'].'</div>'; |
|
72 | +if (isset($spotter_item['airline_name'])) { |
|
73 | + print '<div class="airline">'.$spotter_item['airline_name'].'</div>'; |
|
74 | +} |
|
71 | 75 | print '</div>'; |
72 | 76 | print '<div class="nomobile airports"><div class="airport"><span class="code"><a href="'.$globalURL.'/airport/'.$spotter_item['departure_airport'].'" target="_blank">'.$spotter_item['departure_airport'].'</a></span>'.$spotter_item['departure_airport_city'].' '.$spotter_item['departure_airport_country']; |
73 | 77 | if (isset($spotter_item['departure_airport_time'])) { |
@@ -95,9 +99,14 @@ discard block |
||
95 | 99 | print '<span class="code"><a href="'.$globalURL.'/airport/'.$spotter_item['arrival_airport'].'" target="_blank">'.$spotter_item['arrival_airport'].'</a></span>'.$spotter_item['arrival_airport_city'].' '.$spotter_item['arrival_airport_country']; |
96 | 100 | print '</div></div><div>'; |
97 | 101 | print '<span>'._("Aircraft").'</span>'; |
98 | -if (isset($spotter_item['aircraft_wiki'])) print '<a href="'.$spotter_item['aircraft_wiki'].'">'.$spotter_item['aircraft_name'].'</a>'; |
|
99 | -if (isset($spotter_item['aircraft_type'])) print '<a href="'.$globalURL.'/aircraft/'.$spotter_item['aircraft_type'].'">'.$spotter_item['aircraft_manufacturer'].' '.$spotter_item['aircraft_name'].' ('.$spotter_item['aircraft_type'].')</a>'; |
|
100 | -else print $spotter_item['aircraft_manufacturer'].' '.$spotter_item['aircraft_name']; |
|
102 | +if (isset($spotter_item['aircraft_wiki'])) { |
|
103 | + print '<a href="'.$spotter_item['aircraft_wiki'].'">'.$spotter_item['aircraft_name'].'</a>'; |
|
104 | +} |
|
105 | +if (isset($spotter_item['aircraft_type'])) { |
|
106 | + print '<a href="'.$globalURL.'/aircraft/'.$spotter_item['aircraft_type'].'">'.$spotter_item['aircraft_manufacturer'].' '.$spotter_item['aircraft_name'].' ('.$spotter_item['aircraft_type'].')</a>'; |
|
107 | +} else { |
|
108 | + print $spotter_item['aircraft_manufacturer'].' '.$spotter_item['aircraft_name']; |
|
109 | +} |
|
101 | 110 | print '</div>'; |
102 | 111 | print '<div><span>'._("Altitude").'</span>'; |
103 | 112 | if ((!isset($_COOKIE['unitaltitude']) && isset($globalUnitAltitude) && $globalUnitAltitude == 'feet') || (isset($_COOKIE['unitaltitude']) && $_COOKIE['unitaltitude'] == 'feet')) { |
@@ -106,7 +115,9 @@ discard block |
||
106 | 115 | print round($spotter_item['altitude']*30.48).' m (FL'.$spotter_item['altitude'].')'; |
107 | 116 | } |
108 | 117 | print '</div>'; |
109 | -if (isset($spotter_item['registration']) && $spotter_item['registration'] != '') print '<div><span>'._("Registration").'</span><a href="'.$globalURL.'/registration/'.$spotter_item['registration'].'" target="_blank">'.$spotter_item['registration'].'</a></div>'; |
|
118 | +if (isset($spotter_item['registration']) && $spotter_item['registration'] != '') { |
|
119 | + print '<div><span>'._("Registration").'</span><a href="'.$globalURL.'/registration/'.$spotter_item['registration'].'" target="_blank">'.$spotter_item['registration'].'</a></div>'; |
|
120 | +} |
|
110 | 121 | print '<div><span>'._("Speed").'</span>'; |
111 | 122 | if ((!isset($_COOKIE['unitspeed']) && isset($globalUnitSpeed) && $globalUnitSpeed == 'mph') || (isset($_COOKIE['unitspeed']) && $_COOKIE['unitspeed'] == 'mph')) { |
112 | 123 | print round($spotter_item['ground_speed']*1.15078).' mph'; |
@@ -120,8 +131,11 @@ discard block |
||
120 | 131 | print '<div><span>'._("Heading").'</span>'.$spotter_item['heading'].'°</div>'; |
121 | 132 | if (isset($spotter_item['pilot_name']) && $spotter_item['pilot_name'] != '') { |
122 | 133 | print '<div><span>'._("Pilot").'</span>'; |
123 | - if (isset($spotter_item['pilot_id'])) print $spotter_item['pilot_name'].' ('.$spotter_item['pilot_id'].')'; |
|
124 | - else print $spotter_item['pilot_name']; |
|
134 | + if (isset($spotter_item['pilot_id'])) { |
|
135 | + print $spotter_item['pilot_name'].' ('.$spotter_item['pilot_id'].')'; |
|
136 | + } else { |
|
137 | + print $spotter_item['pilot_name']; |
|
138 | + } |
|
125 | 139 | print '</div>'; |
126 | 140 | } |
127 | 141 | |
@@ -147,10 +161,18 @@ discard block |
||
147 | 161 | } |
148 | 162 | print '</div>'; |
149 | 163 | |
150 | -if (isset($globalphpVMS) && $globalphpVMS && isset($globalVATSIM) && $globalVATSIM && isset($globalIVAO) && $globalIVAO && isset($spotter_item['format_source']) && $spotter_item['format_source'] != '' && $spotter_item['format_source'] != 'pireps') print '<div class="waypoints"><span>'._("Source").'</span>'.$spotter_item['format_source'].'</div>'; |
|
151 | -if (isset($spotter_item['waypoints']) && $spotter_item['waypoints'] != '') print '<div class="waypoints"><span>'._("Route").'</span>'.$spotter_item['waypoints'].'</div>'; |
|
152 | -if (isset($spotter_item['acars']['message'])) print '<div class="acars"><span>'._("Latest ACARS message").'</span>'.trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'<br/>',$spotter_item['acars']['message'])).'</div>'; |
|
153 | -if (isset($spotter_item['squawk']) && $spotter_item['squawk'] != '' && $spotter_item['squawk'] != 0) print '<div class="bottom">'._("Squawk:").' '.$spotter_item['squawk'].' - '.$spotter_item['squawk_usage'].'</div>'; |
|
164 | +if (isset($globalphpVMS) && $globalphpVMS && isset($globalVATSIM) && $globalVATSIM && isset($globalIVAO) && $globalIVAO && isset($spotter_item['format_source']) && $spotter_item['format_source'] != '' && $spotter_item['format_source'] != 'pireps') { |
|
165 | + print '<div class="waypoints"><span>'._("Source").'</span>'.$spotter_item['format_source'].'</div>'; |
|
166 | +} |
|
167 | +if (isset($spotter_item['waypoints']) && $spotter_item['waypoints'] != '') { |
|
168 | + print '<div class="waypoints"><span>'._("Route").'</span>'.$spotter_item['waypoints'].'</div>'; |
|
169 | +} |
|
170 | +if (isset($spotter_item['acars']['message'])) { |
|
171 | + print '<div class="acars"><span>'._("Latest ACARS message").'</span>'.trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'<br/>',$spotter_item['acars']['message'])).'</div>'; |
|
172 | +} |
|
173 | +if (isset($spotter_item['squawk']) && $spotter_item['squawk'] != '' && $spotter_item['squawk'] != 0) { |
|
174 | + print '<div class="bottom">'._("Squawk:").' '.$spotter_item['squawk'].' - '.$spotter_item['squawk_usage'].'</div>'; |
|
175 | +} |
|
154 | 176 | print '</div>'; |
155 | 177 | ?> |
156 | 178 | </div> |
157 | 179 | \ No newline at end of file |
@@ -63,7 +63,9 @@ |
||
63 | 63 | { |
64 | 64 | if ($spotter_item['image_source'] == 'flickr' || $spotter_item['image_source'] == 'wikimedia' || $spotter_item['image_source'] == 'devianart') { |
65 | 65 | $image = preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']); |
66 | - } else $image = $spotter_item['image_thumbnail']; |
|
66 | + } else { |
|
67 | + $image = $spotter_item['image_thumbnail']; |
|
68 | + } |
|
67 | 69 | |
68 | 70 | } |
69 | 71 | /* else { |
@@ -72,7 +72,9 @@ discard block |
||
72 | 72 | if (isset($filter[0]['source'])) { |
73 | 73 | $filters = array_merge($filters,$filter); |
74 | 74 | } |
75 | - if (is_array($globalFilter)) $filter = array_merge($filter,$globalFilter); |
|
75 | + if (is_array($globalFilter)) { |
|
76 | + $filter = array_merge($filter,$globalFilter); |
|
77 | + } |
|
76 | 78 | $filter_query_join = ''; |
77 | 79 | $filter_query_where = ''; |
78 | 80 | foreach($filters as $flt) { |
@@ -156,8 +158,11 @@ discard block |
||
156 | 158 | $filter_query_where .= " AND EXTRACT(DAY FROM spotter_output.date) = '".$filter['day']."'"; |
157 | 159 | } |
158 | 160 | } |
159 | - if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE'; |
|
160 | - elseif ($filter_query_where != '' && $and) $filter_query_where .= ' AND'; |
|
161 | + if ($filter_query_where == '' && $where) { |
|
162 | + $filter_query_where = ' WHERE'; |
|
163 | + } elseif ($filter_query_where != '' && $and) { |
|
164 | + $filter_query_where .= ' AND'; |
|
165 | + } |
|
161 | 166 | if ($filter_query_where != '') { |
162 | 167 | $filter_query_where = preg_replace('/^ AND/',' WHERE',$filter_query_where); |
163 | 168 | } |
@@ -180,10 +185,18 @@ discard block |
||
180 | 185 | $Image = new Image($this->db); |
181 | 186 | $Schedule = new Schedule($this->db); |
182 | 187 | $ACARS = new ACARS($this->db); |
183 | - if (!isset($globalIVAO)) $globalIVAO = FALSE; |
|
184 | - if (!isset($globalVATSIM)) $globalVATSIM = FALSE; |
|
185 | - if (!isset($globalphpVMS)) $globalphpVMS = FALSE; |
|
186 | - if (!isset($globalVAM)) $globalVAM = FALSE; |
|
188 | + if (!isset($globalIVAO)) { |
|
189 | + $globalIVAO = FALSE; |
|
190 | + } |
|
191 | + if (!isset($globalVATSIM)) { |
|
192 | + $globalVATSIM = FALSE; |
|
193 | + } |
|
194 | + if (!isset($globalphpVMS)) { |
|
195 | + $globalphpVMS = FALSE; |
|
196 | + } |
|
197 | + if (!isset($globalVAM)) { |
|
198 | + $globalVAM = FALSE; |
|
199 | + } |
|
187 | 200 | date_default_timezone_set('UTC'); |
188 | 201 | |
189 | 202 | if (!is_string($query)) |
@@ -230,21 +243,35 @@ discard block |
||
230 | 243 | } else { |
231 | 244 | $temp_array['spotter_id'] = ''; |
232 | 245 | } |
233 | - if (isset($row['flightaware_id'])) $temp_array['flightaware_id'] = $row['flightaware_id']; |
|
234 | - if (isset($row['modes'])) $temp_array['modes'] = $row['modes']; |
|
246 | + if (isset($row['flightaware_id'])) { |
|
247 | + $temp_array['flightaware_id'] = $row['flightaware_id']; |
|
248 | + } |
|
249 | + if (isset($row['modes'])) { |
|
250 | + $temp_array['modes'] = $row['modes']; |
|
251 | + } |
|
235 | 252 | $temp_array['ident'] = $row['ident']; |
236 | 253 | if (isset($row['registration']) && $row['registration'] != '') { |
237 | 254 | $temp_array['registration'] = $row['registration']; |
238 | 255 | } elseif (isset($temp_array['modes'])) { |
239 | 256 | $temp_array['registration'] = $this->getAircraftRegistrationBymodeS($temp_array['modes']); |
240 | - } else $temp_array['registration'] = ''; |
|
241 | - if (isset($row['aircraft_icao'])) $temp_array['aircraft_type'] = $row['aircraft_icao']; |
|
257 | + } else { |
|
258 | + $temp_array['registration'] = ''; |
|
259 | + } |
|
260 | + if (isset($row['aircraft_icao'])) { |
|
261 | + $temp_array['aircraft_type'] = $row['aircraft_icao']; |
|
262 | + } |
|
242 | 263 | |
243 | 264 | $temp_array['departure_airport'] = $row['departure_airport_icao']; |
244 | 265 | $temp_array['arrival_airport'] = $row['arrival_airport_icao']; |
245 | - if (isset($row['real_arrival_airport_icao']) && $row['real_arrival_airport_icao'] != NULL) $temp_array['real_arrival_airport'] = $row['real_arrival_airport_icao']; |
|
246 | - if (isset($row['latitude'])) $temp_array['latitude'] = $row['latitude']; |
|
247 | - if (isset($row['longitude'])) $temp_array['longitude'] = $row['longitude']; |
|
266 | + if (isset($row['real_arrival_airport_icao']) && $row['real_arrival_airport_icao'] != NULL) { |
|
267 | + $temp_array['real_arrival_airport'] = $row['real_arrival_airport_icao']; |
|
268 | + } |
|
269 | + if (isset($row['latitude'])) { |
|
270 | + $temp_array['latitude'] = $row['latitude']; |
|
271 | + } |
|
272 | + if (isset($row['longitude'])) { |
|
273 | + $temp_array['longitude'] = $row['longitude']; |
|
274 | + } |
|
248 | 275 | /* |
249 | 276 | if (Connection->tableExists('countries')) { |
250 | 277 | $country_info = $this->getCountryFromLatitudeLongitude($temp_array['latitude'],$temp_array['longitude']); |
@@ -254,8 +281,12 @@ discard block |
||
254 | 281 | } |
255 | 282 | } |
256 | 283 | */ |
257 | - if (isset($row['waypoints'])) $temp_array['waypoints'] = $row['waypoints']; |
|
258 | - if (isset($row['format_source'])) $temp_array['format_source'] = $row['format_source']; |
|
284 | + if (isset($row['waypoints'])) { |
|
285 | + $temp_array['waypoints'] = $row['waypoints']; |
|
286 | + } |
|
287 | + if (isset($row['format_source'])) { |
|
288 | + $temp_array['format_source'] = $row['format_source']; |
|
289 | + } |
|
259 | 290 | if (isset($row['route_stop']) && $row['route_stop'] != '') { |
260 | 291 | $temp_array['route_stop'] = $row['route_stop']; |
261 | 292 | $allroute = explode(' ',$row['route_stop']); |
@@ -271,13 +302,19 @@ discard block |
||
271 | 302 | } |
272 | 303 | } |
273 | 304 | } |
274 | - if (isset($row['altitude'])) $temp_array['altitude'] = $row['altitude']; |
|
305 | + if (isset($row['altitude'])) { |
|
306 | + $temp_array['altitude'] = $row['altitude']; |
|
307 | + } |
|
275 | 308 | if (isset($row['heading'])) { |
276 | 309 | $temp_array['heading'] = $row['heading']; |
277 | 310 | $heading_direction = $this->parseDirection($row['heading']); |
278 | - if (isset($heading_direction[0]['direction_fullname'])) $temp_array['heading_name'] = $heading_direction[0]['direction_fullname']; |
|
311 | + if (isset($heading_direction[0]['direction_fullname'])) { |
|
312 | + $temp_array['heading_name'] = $heading_direction[0]['direction_fullname']; |
|
313 | + } |
|
314 | + } |
|
315 | + if (isset($row['ground_speed'])) { |
|
316 | + $temp_array['ground_speed'] = $row['ground_speed']; |
|
279 | 317 | } |
280 | - if (isset($row['ground_speed'])) $temp_array['ground_speed'] = $row['ground_speed']; |
|
281 | 318 | $temp_array['image'] = ""; |
282 | 319 | $temp_array['image_thumbnail'] = ""; |
283 | 320 | $temp_array['image_source'] = ""; |
@@ -285,7 +322,9 @@ discard block |
||
285 | 322 | |
286 | 323 | if (isset($row['highlight'])) { |
287 | 324 | $temp_array['highlight'] = $row['highlight']; |
288 | - } else $temp_array['highlight'] = ''; |
|
325 | + } else { |
|
326 | + $temp_array['highlight'] = ''; |
|
327 | + } |
|
289 | 328 | |
290 | 329 | if (isset($row['date'])) { |
291 | 330 | $dateArray = $this->parseDateString($row['date']); |
@@ -341,7 +380,9 @@ discard block |
||
341 | 380 | |
342 | 381 | if ($aircraft_array[0]['aircraft_shadow'] != NULL) { |
343 | 382 | $temp_array['aircraft_shadow'] = $aircraft_array[0]['aircraft_shadow']; |
344 | - } else $temp_array['aircraft_shadow'] = 'default.png'; |
|
383 | + } else { |
|
384 | + $temp_array['aircraft_shadow'] = 'default.png'; |
|
385 | + } |
|
345 | 386 | } else { |
346 | 387 | $temp_array['aircraft_shadow'] = 'default.png'; |
347 | 388 | $temp_array['aircraft_name'] = 'N/A'; |
@@ -349,11 +390,17 @@ discard block |
||
349 | 390 | } |
350 | 391 | } |
351 | 392 | $fromsource = NULL; |
352 | - if (isset($globalAirlinesSource) && $globalAirlinesSource != '') $fromsource = $globalAirlinesSource; |
|
353 | - elseif (isset($row['format_source']) && $row['format_source'] == 'vatsimtxt') $fromsource = 'vatsim'; |
|
354 | - elseif (isset($row['format_source']) && $row['format_source'] == 'whazzup') $fromsource = 'ivao'; |
|
355 | - elseif (isset($globalVATSIM) && $globalVATSIM) $fromsource = 'vatsim'; |
|
356 | - elseif (isset($globalIVAO) && $globalIVAO) $fromsource = 'ivao'; |
|
393 | + if (isset($globalAirlinesSource) && $globalAirlinesSource != '') { |
|
394 | + $fromsource = $globalAirlinesSource; |
|
395 | + } elseif (isset($row['format_source']) && $row['format_source'] == 'vatsimtxt') { |
|
396 | + $fromsource = 'vatsim'; |
|
397 | + } elseif (isset($row['format_source']) && $row['format_source'] == 'whazzup') { |
|
398 | + $fromsource = 'ivao'; |
|
399 | + } elseif (isset($globalVATSIM) && $globalVATSIM) { |
|
400 | + $fromsource = 'vatsim'; |
|
401 | + } elseif (isset($globalIVAO) && $globalIVAO) { |
|
402 | + $fromsource = 'ivao'; |
|
403 | + } |
|
357 | 404 | if (!isset($row['airline_name']) || $row['airline_name'] == '') { |
358 | 405 | if (!is_numeric(substr($row['ident'], 0, 3))) { |
359 | 406 | if (is_numeric(substr($row['ident'], 2, 1))) { |
@@ -376,12 +423,18 @@ discard block |
||
376 | 423 | } |
377 | 424 | } else { |
378 | 425 | $temp_array['airline_icao'] = $row['airline_icao']; |
379 | - if (isset($row['airline_iata'])) $temp_array['airline_iata'] = $row['airline_iata']; |
|
380 | - else $temp_array['airline_iata'] = 'N/A'; |
|
426 | + if (isset($row['airline_iata'])) { |
|
427 | + $temp_array['airline_iata'] = $row['airline_iata']; |
|
428 | + } else { |
|
429 | + $temp_array['airline_iata'] = 'N/A'; |
|
430 | + } |
|
381 | 431 | $temp_array['airline_name'] = $row['airline_name']; |
382 | 432 | $temp_array['airline_country'] = $row['airline_country']; |
383 | - if (isset($row['airline_callsign'])) $temp_array['airline_callsign'] = $row['airline_callsign']; |
|
384 | - else $temp_array['airline_callsign'] = 'N/A'; |
|
433 | + if (isset($row['airline_callsign'])) { |
|
434 | + $temp_array['airline_callsign'] = $row['airline_callsign']; |
|
435 | + } else { |
|
436 | + $temp_array['airline_callsign'] = 'N/A'; |
|
437 | + } |
|
385 | 438 | $temp_array['airline_type'] = $row['airline_type']; |
386 | 439 | if ($temp_array['airline_icao'] != '' && $temp_array['airline_iata'] == 'N/A') { |
387 | 440 | $airline_array = $this->getAllAirlineInfo($temp_array['airline_icao']); |
@@ -408,7 +461,9 @@ discard block |
||
408 | 461 | } |
409 | 462 | if ($temp_array['registration'] != "" && !$globalIVAO && !$globalVATSIM && !$globalphpVMS && !$globalVAM && !isset($temp_array['aircraft_owner'])) { |
410 | 463 | $owner_info = $this->getAircraftOwnerByRegistration($temp_array['registration']); |
411 | - if ($owner_info['owner'] != '') $temp_array['aircraft_owner'] = ucwords(strtolower($owner_info['owner'])); |
|
464 | + if ($owner_info['owner'] != '') { |
|
465 | + $temp_array['aircraft_owner'] = ucwords(strtolower($owner_info['owner'])); |
|
466 | + } |
|
412 | 467 | $temp_array['aircraft_base'] = $owner_info['base']; |
413 | 468 | $temp_array['aircraft_date_first_reg'] = $owner_info['date_first_reg']; |
414 | 469 | } |
@@ -416,9 +471,14 @@ discard block |
||
416 | 471 | if($temp_array['registration'] != "" || ($globalIVAO && isset($temp_array['aircraft_type']) && $temp_array['aircraft_type'] != '')) |
417 | 472 | { |
418 | 473 | if ($globalIVAO) { |
419 | - if (isset($temp_array['airline_icao'])) $image_array = $Image->getSpotterImage('',$temp_array['aircraft_type'],$temp_array['airline_icao']); |
|
420 | - else $image_array = $Image->getSpotterImage('',$temp_array['aircraft_type']); |
|
421 | - } else $image_array = $Image->getSpotterImage($temp_array['registration']); |
|
474 | + if (isset($temp_array['airline_icao'])) { |
|
475 | + $image_array = $Image->getSpotterImage('',$temp_array['aircraft_type'],$temp_array['airline_icao']); |
|
476 | + } else { |
|
477 | + $image_array = $Image->getSpotterImage('',$temp_array['aircraft_type']); |
|
478 | + } |
|
479 | + } else { |
|
480 | + $image_array = $Image->getSpotterImage($temp_array['registration']); |
|
481 | + } |
|
422 | 482 | if (count($image_array) > 0) { |
423 | 483 | $temp_array['image'] = $image_array[0]['image']; |
424 | 484 | $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
@@ -470,7 +530,9 @@ discard block |
||
470 | 530 | //if ($row['departure_airport_icao'] != '' && $row['departure_airport_name'] == '') { |
471 | 531 | if ($row['departure_airport_icao'] != '') { |
472 | 532 | $departure_airport_array = $this->getAllAirportInfo($row['departure_airport_icao']); |
473 | - if (!isset($departure_airport_array[0]['name'])) $departure_airport_array = $this->getAllAirportInfo('NA'); |
|
533 | + if (!isset($departure_airport_array[0]['name'])) { |
|
534 | + $departure_airport_array = $this->getAllAirportInfo('NA'); |
|
535 | + } |
|
474 | 536 | /* |
475 | 537 | } elseif ($row['departure_airport_name'] != '') { |
476 | 538 | $temp_array['departure_airport_name'] = $row['departure_airport_name']; |
@@ -478,7 +540,9 @@ discard block |
||
478 | 540 | $temp_array['departure_airport_country'] = $row['departure_airport_country']; |
479 | 541 | $temp_array['departure_airport_icao'] = $row['departure_airport_icao']; |
480 | 542 | */ |
481 | - } else $departure_airport_array = $this->getAllAirportInfo('NA'); |
|
543 | + } else { |
|
544 | + $departure_airport_array = $this->getAllAirportInfo('NA'); |
|
545 | + } |
|
482 | 546 | if (isset($departure_airport_array[0]['name'])) { |
483 | 547 | $temp_array['departure_airport_name'] = $departure_airport_array[0]['name']; |
484 | 548 | $temp_array['departure_airport_city'] = $departure_airport_array[0]['city']; |
@@ -498,8 +562,12 @@ discard block |
||
498 | 562 | |
499 | 563 | if ($row['arrival_airport_icao'] != '') { |
500 | 564 | $arrival_airport_array = $this->getAllAirportInfo($row['arrival_airport_icao']); |
501 | - if (count($arrival_airport_array) == 0) $arrival_airport_array = $this->getAllAirportInfo('NA'); |
|
502 | - } else $arrival_airport_array = $this->getAllAirportInfo('NA'); |
|
565 | + if (count($arrival_airport_array) == 0) { |
|
566 | + $arrival_airport_array = $this->getAllAirportInfo('NA'); |
|
567 | + } |
|
568 | + } else { |
|
569 | + $arrival_airport_array = $this->getAllAirportInfo('NA'); |
|
570 | + } |
|
503 | 571 | if (isset($arrival_airport_array[0]['name'])) { |
504 | 572 | $temp_array['arrival_airport_name'] = $arrival_airport_array[0]['name']; |
505 | 573 | $temp_array['arrival_airport_city'] = $arrival_airport_array[0]['city']; |
@@ -515,27 +583,45 @@ discard block |
||
515 | 583 | $temp_array['arrival_airport_time'] = $row['arrival_airport_time']; |
516 | 584 | } |
517 | 585 | */ |
518 | - if (isset($row['pilot_id']) && $row['pilot_id'] != '') $temp_array['pilot_id'] = $row['pilot_id']; |
|
519 | - if (isset($row['pilot_name']) && $row['pilot_name'] != '') $temp_array['pilot_name'] = $row['pilot_name']; |
|
520 | - if (isset($row['source_name']) && $row['source_name'] != '') $temp_array['source_name'] = $row['source_name']; |
|
521 | - if (isset($row['over_country']) && $row['over_country'] != '') $temp_array['over_country'] = $row['over_country']; |
|
522 | - if (isset($row['distance']) && $row['distance'] != '') $temp_array['distance'] = $row['distance']; |
|
586 | + if (isset($row['pilot_id']) && $row['pilot_id'] != '') { |
|
587 | + $temp_array['pilot_id'] = $row['pilot_id']; |
|
588 | + } |
|
589 | + if (isset($row['pilot_name']) && $row['pilot_name'] != '') { |
|
590 | + $temp_array['pilot_name'] = $row['pilot_name']; |
|
591 | + } |
|
592 | + if (isset($row['source_name']) && $row['source_name'] != '') { |
|
593 | + $temp_array['source_name'] = $row['source_name']; |
|
594 | + } |
|
595 | + if (isset($row['over_country']) && $row['over_country'] != '') { |
|
596 | + $temp_array['over_country'] = $row['over_country']; |
|
597 | + } |
|
598 | + if (isset($row['distance']) && $row['distance'] != '') { |
|
599 | + $temp_array['distance'] = $row['distance']; |
|
600 | + } |
|
523 | 601 | if (isset($row['squawk'])) { |
524 | 602 | $temp_array['squawk'] = $row['squawk']; |
525 | 603 | if ($row['squawk'] != '' && isset($temp_array['country_iso2'])) { |
526 | 604 | $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$temp_array['country_iso2']); |
527 | - if ($temp_array['squawk_usage'] == '' && isset($globalSquawkCountry)) $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry); |
|
605 | + if ($temp_array['squawk_usage'] == '' && isset($globalSquawkCountry)) { |
|
606 | + $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry); |
|
607 | + } |
|
528 | 608 | } elseif ($row['squawk'] != '' && isset($temp_array['over_country'])) { |
529 | 609 | $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$temp_array['over_country']); |
530 | - if ($temp_array['squawk_usage'] == '' && isset($globalSquawkCountry)) $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry); |
|
531 | - } elseif ($row['squawk'] != '' && isset($globalSquawkCountry)) $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry); |
|
610 | + if ($temp_array['squawk_usage'] == '' && isset($globalSquawkCountry)) { |
|
611 | + $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry); |
|
612 | + } |
|
613 | + } elseif ($row['squawk'] != '' && isset($globalSquawkCountry)) { |
|
614 | + $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry); |
|
615 | + } |
|
532 | 616 | } |
533 | 617 | |
534 | 618 | $temp_array['query_number_rows'] = $num_rows; |
535 | 619 | |
536 | 620 | $spotter_array[] = $temp_array; |
537 | 621 | } |
538 | - if ($num_rows == 0) return array(); |
|
622 | + if ($num_rows == 0) { |
|
623 | + return array(); |
|
624 | + } |
|
539 | 625 | $spotter_array[0]['query_number_rows'] = $num_rows; |
540 | 626 | return $spotter_array; |
541 | 627 | } |
@@ -568,7 +654,9 @@ discard block |
||
568 | 654 | foreach ($q_array as $q_item){ |
569 | 655 | $q_item = filter_var($q_item,FILTER_SANITIZE_STRING); |
570 | 656 | $additional_query .= " AND ("; |
571 | - if (is_int($q_item)) $additional_query .= "(spotter_output.spotter_id like '%".$q_item."%') OR "; |
|
657 | + if (is_int($q_item)) { |
|
658 | + $additional_query .= "(spotter_output.spotter_id like '%".$q_item."%') OR "; |
|
659 | + } |
|
572 | 660 | $additional_query .= "(spotter_output.aircraft_icao like '%".$q_item."%') OR "; |
573 | 661 | $additional_query .= "(spotter_output.aircraft_name like '%".$q_item."%') OR "; |
574 | 662 | $additional_query .= "(spotter_output.aircraft_manufacturer like '%".$q_item."%') OR "; |
@@ -589,7 +677,9 @@ discard block |
||
589 | 677 | $additional_query .= "(spotter_output.pilot_name like '%".$q_item."%') OR "; |
590 | 678 | $additional_query .= "(spotter_output.ident like '%".$q_item."%') OR "; |
591 | 679 | $translate = $Translation->ident2icao($q_item); |
592 | - if ($translate != $q_item) $additional_query .= "(spotter_output.ident like '%".$translate."%') OR "; |
|
680 | + if ($translate != $q_item) { |
|
681 | + $additional_query .= "(spotter_output.ident like '%".$translate."%') OR "; |
|
682 | + } |
|
593 | 683 | $additional_query .= "(spotter_output.highlight like '%".$q_item."%')"; |
594 | 684 | $additional_query .= ")"; |
595 | 685 | } |
@@ -816,7 +906,9 @@ discard block |
||
816 | 906 | date_default_timezone_set($globalTimezone); |
817 | 907 | $datetime = new DateTime(); |
818 | 908 | $offset = $datetime->format('P'); |
819 | - } else $offset = '+00:00'; |
|
909 | + } else { |
|
910 | + $offset = '+00:00'; |
|
911 | + } |
|
820 | 912 | |
821 | 913 | if ($date_array[1] != "") |
822 | 914 | { |
@@ -848,8 +940,12 @@ discard block |
||
848 | 940 | { |
849 | 941 | //$limit_query = " LIMIT ".$limit_array[0].",".$limit_array[1]; |
850 | 942 | $limit_query = " LIMIT ".$limit_array[1]." OFFSET ".$limit_array[0]; |
851 | - } else $limit_query = ""; |
|
852 | - } else $limit_query = ""; |
|
943 | + } else { |
|
944 | + $limit_query = ""; |
|
945 | + } |
|
946 | + } else { |
|
947 | + $limit_query = ""; |
|
948 | + } |
|
853 | 949 | |
854 | 950 | |
855 | 951 | if ($sort != "") |
@@ -917,8 +1013,12 @@ discard block |
||
917 | 1013 | { |
918 | 1014 | //$limit_query = " LIMIT ".$limit_array[0].",".$limit_array[1]; |
919 | 1015 | $limit_query = " LIMIT ".$limit_array[1]." OFFSET ".$limit_array[0]; |
920 | - } else $limit_query = ""; |
|
921 | - } else $limit_query = ""; |
|
1016 | + } else { |
|
1017 | + $limit_query = ""; |
|
1018 | + } |
|
1019 | + } else { |
|
1020 | + $limit_query = ""; |
|
1021 | + } |
|
922 | 1022 | |
923 | 1023 | if ($sort != "") |
924 | 1024 | { |
@@ -1242,7 +1342,9 @@ discard block |
||
1242 | 1342 | global $global_query; |
1243 | 1343 | |
1244 | 1344 | date_default_timezone_set('UTC'); |
1245 | - if ($id == '') return array(); |
|
1345 | + if ($id == '') { |
|
1346 | + return array(); |
|
1347 | + } |
|
1246 | 1348 | $additional_query = "spotter_output.spotter_id = :id"; |
1247 | 1349 | $query_values = array(':id' => $id); |
1248 | 1350 | |
@@ -1357,8 +1459,11 @@ discard block |
||
1357 | 1459 | if ($sort != "") |
1358 | 1460 | { |
1359 | 1461 | $search_orderby_array = $this->getOrderBy(); |
1360 | - if (isset($search_orderby_array[$sort]['sql'])) $orderby_query = $search_orderby_array[$sort]['sql']; |
|
1361 | - else $orderby_query = " ORDER BY spotter_output.date DESC"; |
|
1462 | + if (isset($search_orderby_array[$sort]['sql'])) { |
|
1463 | + $orderby_query = $search_orderby_array[$sort]['sql']; |
|
1464 | + } else { |
|
1465 | + $orderby_query = " ORDER BY spotter_output.date DESC"; |
|
1466 | + } |
|
1362 | 1467 | } else { |
1363 | 1468 | $orderby_query = " ORDER BY spotter_output.date DESC"; |
1364 | 1469 | } |
@@ -1983,7 +2088,9 @@ discard block |
||
1983 | 2088 | { |
1984 | 2089 | $highlight = $row['highlight']; |
1985 | 2090 | } |
1986 | - if (isset($highlight)) return $highlight; |
|
2091 | + if (isset($highlight)) { |
|
2092 | + return $highlight; |
|
2093 | + } |
|
1987 | 2094 | } |
1988 | 2095 | |
1989 | 2096 | |
@@ -2011,7 +2118,9 @@ discard block |
||
2011 | 2118 | $sth->closeCursor(); |
2012 | 2119 | if (count($row) > 0) { |
2013 | 2120 | return $row['usage']; |
2014 | - } else return ''; |
|
2121 | + } else { |
|
2122 | + return ''; |
|
2123 | + } |
|
2015 | 2124 | } |
2016 | 2125 | |
2017 | 2126 | /** |
@@ -2036,7 +2145,9 @@ discard block |
||
2036 | 2145 | $sth->closeCursor(); |
2037 | 2146 | if (count($row) > 0) { |
2038 | 2147 | return $row['icao']; |
2039 | - } else return ''; |
|
2148 | + } else { |
|
2149 | + return ''; |
|
2150 | + } |
|
2040 | 2151 | } |
2041 | 2152 | |
2042 | 2153 | /** |
@@ -2064,7 +2175,9 @@ discard block |
||
2064 | 2175 | $airport_longitude = $row['longitude']; |
2065 | 2176 | $Common = new Common(); |
2066 | 2177 | return $Common->distance($latitude,$longitude,$airport_latitude,$airport_longitude); |
2067 | - } else return ''; |
|
2178 | + } else { |
|
2179 | + return ''; |
|
2180 | + } |
|
2068 | 2181 | } |
2069 | 2182 | |
2070 | 2183 | /** |
@@ -2176,7 +2289,9 @@ discard block |
||
2176 | 2289 | $minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
2177 | 2290 | $maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
2178 | 2291 | $maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
2179 | - } else return array(); |
|
2292 | + } else { |
|
2293 | + return array(); |
|
2294 | + } |
|
2180 | 2295 | if ($globalDBdriver == 'mysql') { |
2181 | 2296 | $query = "SELECT airport.* FROM airport WHERE airport.latitude BETWEEN ".$minlat." AND ".$maxlat." AND airport.longitude BETWEEN ".$minlong." AND ".$maxlong." AND airport.type != 'closed'"; |
2182 | 2297 | } else { |
@@ -2211,7 +2326,9 @@ discard block |
||
2211 | 2326 | $minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
2212 | 2327 | $maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
2213 | 2328 | $maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
2214 | - } else return array(); |
|
2329 | + } else { |
|
2330 | + return array(); |
|
2331 | + } |
|
2215 | 2332 | //$query = "SELECT waypoints.* FROM waypoints WHERE waypoints.latitude_begin BETWEEN ".$minlat." AND ".$maxlat." AND waypoints.longitude_begin BETWEEN ".$minlong." AND ".$maxlong; |
2216 | 2333 | $query = "SELECT waypoints.* FROM waypoints WHERE (waypoints.latitude_begin BETWEEN ".$minlat." AND ".$maxlat." AND waypoints.longitude_begin BETWEEN ".$minlong." AND ".$maxlong.") OR (waypoints.latitude_end BETWEEN ".$minlat." AND ".$maxlat." AND waypoints.longitude_end BETWEEN ".$minlong." AND ".$maxlong.")"; |
2217 | 2334 | //$query = "SELECT waypoints.* FROM waypoints"; |
@@ -2246,7 +2363,9 @@ discard block |
||
2246 | 2363 | public function getAllAirlineInfo($airline_icao, $fromsource = NULL) |
2247 | 2364 | { |
2248 | 2365 | global $globalUseRealAirlines; |
2249 | - if (isset($globalUseRealAirlines) && $globalUseRealAirlines) $fromsource = NULL; |
|
2366 | + if (isset($globalUseRealAirlines) && $globalUseRealAirlines) { |
|
2367 | + $fromsource = NULL; |
|
2368 | + } |
|
2250 | 2369 | $airline_icao = strtoupper(filter_var($airline_icao,FILTER_SANITIZE_STRING)); |
2251 | 2370 | if ($airline_icao == 'NA') { |
2252 | 2371 | $airline_array = array(); |
@@ -2315,7 +2434,9 @@ discard block |
||
2315 | 2434 | public function getAllAirlineInfoByName($airline_name, $fromsource = NULL) |
2316 | 2435 | { |
2317 | 2436 | global $globalUseRealAirlines; |
2318 | - if (isset($globalUseRealAirlines) && $globalUseRealAirlines) $fromsource = NULL; |
|
2437 | + if (isset($globalUseRealAirlines) && $globalUseRealAirlines) { |
|
2438 | + $fromsource = NULL; |
|
2439 | + } |
|
2319 | 2440 | $airline_name = strtolower(filter_var($airline_name,FILTER_SANITIZE_STRING)); |
2320 | 2441 | $query = "SELECT airlines.name, airlines.iata, airlines.icao, airlines.callsign, airlines.country, airlines.type FROM airlines WHERE lower(airlines.name) = :airline_name AND airlines.active = 'Y' AND airlines.forsource IS NULL LIMIT 1"; |
2321 | 2442 | $sth = $this->db->prepare($query); |
@@ -2331,7 +2452,9 @@ discard block |
||
2331 | 2452 | $sth->execute(array(':fromsource' => $fromsource)); |
2332 | 2453 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
2333 | 2454 | $sth->closeCursor(); |
2334 | - if ($row['nb'] == 0) $result = $this->getAllAirlineInfoByName($airline_name); |
|
2455 | + if ($row['nb'] == 0) { |
|
2456 | + $result = $this->getAllAirlineInfoByName($airline_name); |
|
2457 | + } |
|
2335 | 2458 | } |
2336 | 2459 | return $result; |
2337 | 2460 | } |
@@ -2394,15 +2517,20 @@ discard block |
||
2394 | 2517 | 'A320-211' => 'A320', |
2395 | 2518 | '747-8i' => 'B748', |
2396 | 2519 | 'A380' => 'A388'); |
2397 | - if (isset($all_aircraft[$aircraft_type])) return $all_aircraft[$aircraft_type]; |
|
2520 | + if (isset($all_aircraft[$aircraft_type])) { |
|
2521 | + return $all_aircraft[$aircraft_type]; |
|
2522 | + } |
|
2398 | 2523 | |
2399 | 2524 | $query = "SELECT aircraft.icao FROM aircraft WHERE aircraft.type LIKE :saircraft_type OR aircraft.type = :aircraft_type OR aircraft.icao = :aircraft_type LIMIT 1"; |
2400 | 2525 | $aircraft_type = strtoupper($aircraft_type); |
2401 | 2526 | $sth = $this->db->prepare($query); |
2402 | 2527 | $sth->execute(array(':saircraft_type' => '%'.$aircraft_type.'%',':aircraft_type' => $aircraft_type,)); |
2403 | 2528 | $result = $sth->fetchAll(PDO::FETCH_ASSOC); |
2404 | - if (isset($result[0]['icao'])) return $result[0]['icao']; |
|
2405 | - else return ''; |
|
2529 | + if (isset($result[0]['icao'])) { |
|
2530 | + return $result[0]['icao']; |
|
2531 | + } else { |
|
2532 | + return ''; |
|
2533 | + } |
|
2406 | 2534 | } |
2407 | 2535 | |
2408 | 2536 | /** |
@@ -2430,11 +2558,15 @@ discard block |
||
2430 | 2558 | $sth->closeCursor(); |
2431 | 2559 | if (isset($row['icaotypecode'])) { |
2432 | 2560 | $icao = $row['icaotypecode']; |
2433 | - if (isset($this->aircraft_correct_icaotype[$icao])) $icao = $this->aircraft_correct_icaotype[$icao]; |
|
2561 | + if (isset($this->aircraft_correct_icaotype[$icao])) { |
|
2562 | + $icao = $this->aircraft_correct_icaotype[$icao]; |
|
2563 | + } |
|
2434 | 2564 | return $icao; |
2435 | 2565 | } elseif ($source_type == 'flarm') { |
2436 | 2566 | return $this->getAllAircraftType($aircraft_modes); |
2437 | - } else return ''; |
|
2567 | + } else { |
|
2568 | + return ''; |
|
2569 | + } |
|
2438 | 2570 | } |
2439 | 2571 | |
2440 | 2572 | /** |
@@ -2457,7 +2589,9 @@ discard block |
||
2457 | 2589 | $sth->closeCursor(); |
2458 | 2590 | if (isset($row['icaotypecode'])) { |
2459 | 2591 | return $row['icaotypecode']; |
2460 | - } else return ''; |
|
2592 | + } else { |
|
2593 | + return ''; |
|
2594 | + } |
|
2461 | 2595 | } |
2462 | 2596 | |
2463 | 2597 | /** |
@@ -2503,7 +2637,9 @@ discard block |
||
2503 | 2637 | $sth->closeCursor(); |
2504 | 2638 | if (isset($row['operator_correct'])) { |
2505 | 2639 | return $row['operator_correct']; |
2506 | - } else return $operator; |
|
2640 | + } else { |
|
2641 | + return $operator; |
|
2642 | + } |
|
2507 | 2643 | } |
2508 | 2644 | |
2509 | 2645 | /** |
@@ -2516,7 +2652,9 @@ discard block |
||
2516 | 2652 | public function getRouteInfo($callsign) |
2517 | 2653 | { |
2518 | 2654 | $callsign = filter_var($callsign,FILTER_SANITIZE_STRING); |
2519 | - if ($callsign == '') return array(); |
|
2655 | + if ($callsign == '') { |
|
2656 | + return array(); |
|
2657 | + } |
|
2520 | 2658 | $query = "SELECT routes.Operator_ICAO, routes.FromAirport_ICAO, routes.ToAirport_ICAO, routes.RouteStop, routes.FromAirport_Time, routes.ToAirport_Time FROM routes WHERE CallSign = :callsign LIMIT 1"; |
2521 | 2659 | |
2522 | 2660 | $sth = $this->db->prepare($query); |
@@ -2526,7 +2664,9 @@ discard block |
||
2526 | 2664 | $sth->closeCursor(); |
2527 | 2665 | if (count($row) > 0) { |
2528 | 2666 | return $row; |
2529 | - } else return array(); |
|
2667 | + } else { |
|
2668 | + return array(); |
|
2669 | + } |
|
2530 | 2670 | } |
2531 | 2671 | |
2532 | 2672 | /** |
@@ -2579,7 +2719,9 @@ discard block |
||
2579 | 2719 | $result = $sth->fetch(PDO::FETCH_ASSOC); |
2580 | 2720 | $sth->closeCursor(); |
2581 | 2721 | return $result; |
2582 | - } else return array(); |
|
2722 | + } else { |
|
2723 | + return array(); |
|
2724 | + } |
|
2583 | 2725 | } |
2584 | 2726 | |
2585 | 2727 | |
@@ -2738,8 +2880,11 @@ discard block |
||
2738 | 2880 | $query .= " ORDER BY spotter_output.source_name ASC"; |
2739 | 2881 | |
2740 | 2882 | $sth = $this->db->prepare($query); |
2741 | - if (!empty($query_values)) $sth->execute($query_values); |
|
2742 | - else $sth->execute(); |
|
2883 | + if (!empty($query_values)) { |
|
2884 | + $sth->execute($query_values); |
|
2885 | + } else { |
|
2886 | + $sth->execute(); |
|
2887 | + } |
|
2743 | 2888 | |
2744 | 2889 | $source_array = array(); |
2745 | 2890 | $temp_array = array(); |
@@ -2772,9 +2917,13 @@ discard block |
||
2772 | 2917 | WHERE spotter_output.airline_icao <> '' |
2773 | 2918 | ORDER BY spotter_output.airline_name ASC"; |
2774 | 2919 | */ |
2775 | - if (isset($globalAirlinesSource) && $globalAirlinesSource != '') $forsource = $globalAirlinesSource; |
|
2776 | - elseif (isset($globalVATSIM) && $globalVATSIM) $forsource = 'vatsim'; |
|
2777 | - elseif (isset($globalIVAO) && $globalIVAO) $forsource = 'ivao'; |
|
2920 | + if (isset($globalAirlinesSource) && $globalAirlinesSource != '') { |
|
2921 | + $forsource = $globalAirlinesSource; |
|
2922 | + } elseif (isset($globalVATSIM) && $globalVATSIM) { |
|
2923 | + $forsource = 'vatsim'; |
|
2924 | + } elseif (isset($globalIVAO) && $globalIVAO) { |
|
2925 | + $forsource = 'ivao'; |
|
2926 | + } |
|
2778 | 2927 | if ($forsource === NULL) { |
2779 | 2928 | $query = "SELECT DISTINCT icao AS airline_icao, name AS airline_name, type AS airline_type FROM airlines WHERE forsource IS NULL ORDER BY name ASC"; |
2780 | 2929 | $query_data = array(); |
@@ -2817,9 +2966,13 @@ discard block |
||
2817 | 2966 | { |
2818 | 2967 | global $globalAirlinesSource,$globalVATSIM, $globalIVAO; |
2819 | 2968 | $filter_query = $this->getFilter($filters,true,true); |
2820 | - if (isset($globalAirlinesSource) && $globalAirlinesSource != '') $forsource = $globalAirlinesSource; |
|
2821 | - elseif (isset($globalVATSIM) && $globalVATSIM) $forsource = 'vatsim'; |
|
2822 | - elseif (isset($globalIVAO) && $globalIVAO) $forsource = 'ivao'; |
|
2969 | + if (isset($globalAirlinesSource) && $globalAirlinesSource != '') { |
|
2970 | + $forsource = $globalAirlinesSource; |
|
2971 | + } elseif (isset($globalVATSIM) && $globalVATSIM) { |
|
2972 | + $forsource = 'vatsim'; |
|
2973 | + } elseif (isset($globalIVAO) && $globalIVAO) { |
|
2974 | + $forsource = 'ivao'; |
|
2975 | + } |
|
2823 | 2976 | if ($forsource === NULL) { |
2824 | 2977 | $query = "SELECT DISTINCT alliance FROM airlines WHERE alliance IS NOT NULL AND forsource IS NULL ORDER BY alliance ASC"; |
2825 | 2978 | $query_data = array(); |
@@ -3130,7 +3283,9 @@ discard block |
||
3130 | 3283 | date_default_timezone_set($globalTimezone); |
3131 | 3284 | $datetime = new DateTime(); |
3132 | 3285 | $offset = $datetime->format('P'); |
3133 | - } else $offset = '+00:00'; |
|
3286 | + } else { |
|
3287 | + $offset = '+00:00'; |
|
3288 | + } |
|
3134 | 3289 | if ($airport_icao == '') { |
3135 | 3290 | if ($globalDBdriver == 'mysql') { |
3136 | 3291 | $query = "SELECT COUNT(departure_airport_icao) AS departure_airport_count, departure_airport_icao, departure_airport_name, departure_airport_city, departure_airport_country, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d') as date FROM `spotter_output`".$filter_query." spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(), INTERVAL 7 DAY) AND departure_airport_icao <> 'NA' AND departure_airport_icao <> '' GROUP BY departure_airport_icao, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d'), departure_airport_name, departure_airport_city, departure_airport_country ORDER BY departure_airport_count DESC"; |
@@ -3162,7 +3317,9 @@ discard block |
||
3162 | 3317 | date_default_timezone_set($globalTimezone); |
3163 | 3318 | $datetime = new DateTime(); |
3164 | 3319 | $offset = $datetime->format('P'); |
3165 | - } else $offset = '+00:00'; |
|
3320 | + } else { |
|
3321 | + $offset = '+00:00'; |
|
3322 | + } |
|
3166 | 3323 | if ($airport_icao == '') { |
3167 | 3324 | if ($globalDBdriver == 'mysql') { |
3168 | 3325 | $query = "SELECT spotter_output.airline_icao, COUNT(departure_airport_icao) AS departure_airport_count, departure_airport_icao, departure_airport_name, departure_airport_city, departure_airport_country, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d') as date FROM `spotter_output` WHERE spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(), INTERVAL 7 DAY) AND departure_airport_icao <> 'NA' AND departure_airport_icao <> '' AND spotter_output.airline_icao <> '' GROUP BY spotter_output.airline_icao, departure_airport_icao, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d'), departure_airport_name, departure_airport_city, departure_airport_country ORDER BY departure_airport_count DESC"; |
@@ -3195,7 +3352,9 @@ discard block |
||
3195 | 3352 | date_default_timezone_set($globalTimezone); |
3196 | 3353 | $datetime = new DateTime(); |
3197 | 3354 | $offset = $datetime->format('P'); |
3198 | - } else $offset = '+00:00'; |
|
3355 | + } else { |
|
3356 | + $offset = '+00:00'; |
|
3357 | + } |
|
3199 | 3358 | if ($airport_icao == '') { |
3200 | 3359 | if ($globalDBdriver == 'mysql') { |
3201 | 3360 | $query = "SELECT COUNT(real_departure_airport_icao) AS departure_airport_count, real_departure_airport_icao AS departure_airport_icao, airport.name AS departure_airport_name, airport.city AS departure_airport_city, airport.country AS departure_airport_country, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d') as date |
@@ -3234,7 +3393,9 @@ discard block |
||
3234 | 3393 | date_default_timezone_set($globalTimezone); |
3235 | 3394 | $datetime = new DateTime(); |
3236 | 3395 | $offset = $datetime->format('P'); |
3237 | - } else $offset = '+00:00'; |
|
3396 | + } else { |
|
3397 | + $offset = '+00:00'; |
|
3398 | + } |
|
3238 | 3399 | if ($airport_icao == '') { |
3239 | 3400 | if ($globalDBdriver == 'mysql') { |
3240 | 3401 | $query = "SELECT spotter_output.airline_icao, COUNT(real_departure_airport_icao) AS departure_airport_count, real_departure_airport_icao AS departure_airport_icao, airport.name AS departure_airport_name, airport.city AS departure_airport_city, airport.country AS departure_airport_country, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d') as date |
@@ -3279,7 +3440,9 @@ discard block |
||
3279 | 3440 | date_default_timezone_set($globalTimezone); |
3280 | 3441 | $datetime = new DateTime(); |
3281 | 3442 | $offset = $datetime->format('P'); |
3282 | - } else $offset = '+00:00'; |
|
3443 | + } else { |
|
3444 | + $offset = '+00:00'; |
|
3445 | + } |
|
3283 | 3446 | if ($airport_icao == '') { |
3284 | 3447 | if ($globalDBdriver == 'mysql') { |
3285 | 3448 | $query = "SELECT COUNT(arrival_airport_icao) AS arrival_airport_count, arrival_airport_icao, arrival_airport_name, arrival_airport_city, arrival_airport_country, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d') as date FROM `spotter_output`".$filter_query." spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(), INTERVAL 7 DAY) AND arrival_airport_icao <> 'NA' AND arrival_airport_icao <> '' GROUP BY arrival_airport_icao, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d'), arrival_airport_name, arrival_airport_city, arrival_airport_country ORDER BY arrival_airport_count DESC"; |
@@ -3314,7 +3477,9 @@ discard block |
||
3314 | 3477 | date_default_timezone_set($globalTimezone); |
3315 | 3478 | $datetime = new DateTime(); |
3316 | 3479 | $offset = $datetime->format('P'); |
3317 | - } else $offset = '+00:00'; |
|
3480 | + } else { |
|
3481 | + $offset = '+00:00'; |
|
3482 | + } |
|
3318 | 3483 | if ($airport_icao == '') { |
3319 | 3484 | if ($globalDBdriver == 'mysql') { |
3320 | 3485 | $query = "SELECT COUNT(real_arrival_airport_icao) AS arrival_airport_count, real_arrival_airport_icao AS arrival_airport_icao, airport.name AS arrival_airport_name, airport.city AS arrival_airport_city, airport.country AS arrival_airport_country, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d') as date |
@@ -3356,7 +3521,9 @@ discard block |
||
3356 | 3521 | date_default_timezone_set($globalTimezone); |
3357 | 3522 | $datetime = new DateTime(); |
3358 | 3523 | $offset = $datetime->format('P'); |
3359 | - } else $offset = '+00:00'; |
|
3524 | + } else { |
|
3525 | + $offset = '+00:00'; |
|
3526 | + } |
|
3360 | 3527 | if ($airport_icao == '') { |
3361 | 3528 | if ($globalDBdriver == 'mysql') { |
3362 | 3529 | $query = "SELECT spotter_output.airline_icao, COUNT(arrival_airport_icao) AS arrival_airport_count, arrival_airport_icao, arrival_airport_name, arrival_airport_city, arrival_airport_country, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d') as date FROM `spotter_output` WHERE spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(), INTERVAL 7 DAY) AND arrival_airport_icao <> 'NA' AND arrival_airport_icao <> '' AND spotter_output.airline_icao <> '' GROUP BY spotter_output.airline_icao, arrival_airport_icao, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d'), arrival_airport_name, arrival_airport_city, arrival_airport_country ORDER BY arrival_airport_count DESC"; |
@@ -3390,7 +3557,9 @@ discard block |
||
3390 | 3557 | date_default_timezone_set($globalTimezone); |
3391 | 3558 | $datetime = new DateTime(); |
3392 | 3559 | $offset = $datetime->format('P'); |
3393 | - } else $offset = '+00:00'; |
|
3560 | + } else { |
|
3561 | + $offset = '+00:00'; |
|
3562 | + } |
|
3394 | 3563 | if ($airport_icao == '') { |
3395 | 3564 | if ($globalDBdriver == 'mysql') { |
3396 | 3565 | $query = "SELECT spotter_output.airline_icao, COUNT(real_arrival_airport_icao) AS arrival_airport_count, real_arrival_airport_icao AS arrival_airport_icao, airport.name AS arrival_airport_name, airport.city AS arrival_airport_city, airport.country AS arrival_airport_country, DATE_FORMAT(DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)),'%Y-%m-%d') as date |
@@ -3438,7 +3607,9 @@ discard block |
||
3438 | 3607 | date_default_timezone_set($globalTimezone); |
3439 | 3608 | $datetime = new DateTime(); |
3440 | 3609 | $offset = $datetime->format('P'); |
3441 | - } else $offset = '+00:00'; |
|
3610 | + } else { |
|
3611 | + $offset = '+00:00'; |
|
3612 | + } |
|
3442 | 3613 | |
3443 | 3614 | if ($globalDBdriver == 'mysql') { |
3444 | 3615 | $query = "SELECT DISTINCT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) as date |
@@ -3558,7 +3729,9 @@ discard block |
||
3558 | 3729 | */ |
3559 | 3730 | public function updateLatestSpotterData($flightaware_id = '', $ident = '', $latitude = '', $longitude = '', $altitude = '', $ground = false, $groundspeed = NULL, $date = '', $arrival_airport_icao = '',$arrival_airport_time = '') |
3560 | 3731 | { |
3561 | - if ($groundspeed == '') $groundspeed = NULL; |
|
3732 | + if ($groundspeed == '') { |
|
3733 | + $groundspeed = NULL; |
|
3734 | + } |
|
3562 | 3735 | $query = 'UPDATE spotter_output SET ident = :ident, last_latitude = :last_latitude, last_longitude = :last_longitude, last_altitude = :last_altitude, last_ground = :last_ground, last_seen = :last_seen, real_arrival_airport_icao = :real_arrival_airport_icao, real_arrival_airport_time = :real_arrival_airport_time, last_ground_speed = :last_ground_speed WHERE flightaware_id = :flightaware_id'; |
3563 | 3736 | $query_values = array(':flightaware_id' => $flightaware_id,':real_arrival_airport_icao' => $arrival_airport_icao,':last_latitude' => $latitude,':last_longitude' => $longitude, ':last_altitude' => $altitude,':last_ground_speed' => $groundspeed,':last_seen' => $date,':real_arrival_airport_time' => $arrival_airport_time, ':last_ground' => $ground, ':ident' => $ident); |
3564 | 3737 | |
@@ -3608,10 +3781,18 @@ discard block |
||
3608 | 3781 | $Image = new Image($this->db); |
3609 | 3782 | $Common = new Common(); |
3610 | 3783 | |
3611 | - if (!isset($globalIVAO)) $globalIVAO = FALSE; |
|
3612 | - if (!isset($globalVATSIM)) $globalVATSIM = FALSE; |
|
3613 | - if (!isset($globalphpVMS)) $globalphpVMS = FALSE; |
|
3614 | - if (!isset($globalVAM)) $globalVAM = FALSE; |
|
3784 | + if (!isset($globalIVAO)) { |
|
3785 | + $globalIVAO = FALSE; |
|
3786 | + } |
|
3787 | + if (!isset($globalVATSIM)) { |
|
3788 | + $globalVATSIM = FALSE; |
|
3789 | + } |
|
3790 | + if (!isset($globalphpVMS)) { |
|
3791 | + $globalphpVMS = FALSE; |
|
3792 | + } |
|
3793 | + if (!isset($globalVAM)) { |
|
3794 | + $globalVAM = FALSE; |
|
3795 | + } |
|
3615 | 3796 | date_default_timezone_set('UTC'); |
3616 | 3797 | |
3617 | 3798 | //getting the registration |
@@ -3624,23 +3805,33 @@ discard block |
||
3624 | 3805 | if ($ModeS != '') { |
3625 | 3806 | $timeelapsed = microtime(true); |
3626 | 3807 | $registration = $this->getAircraftRegistrationBymodeS($ModeS,$source_type); |
3627 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
3808 | + if ($globalDebugTimeElapsed) { |
|
3809 | + echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
3810 | + } |
|
3628 | 3811 | } else { |
3629 | 3812 | $myhex = explode('-',$flightaware_id); |
3630 | 3813 | if (count($myhex) > 0) { |
3631 | 3814 | $timeelapsed = microtime(true); |
3632 | 3815 | $registration = $this->getAircraftRegistrationBymodeS($myhex[0],$source_type); |
3633 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
3816 | + if ($globalDebugTimeElapsed) { |
|
3817 | + echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
3818 | + } |
|
3634 | 3819 | } |
3635 | 3820 | } |
3636 | 3821 | } |
3637 | 3822 | } |
3638 | 3823 | $fromsource = NULL; |
3639 | - if (isset($globalAirlinesSource) && $globalAirlinesSource != '') $fromsource = $globalAirlinesSource; |
|
3640 | - elseif ($format_source == 'vatsimtxt') $fromsource = 'vatsim'; |
|
3641 | - elseif ($format_source == 'whazzup') $fromsource = 'ivao'; |
|
3642 | - elseif (isset($globalVATSIM) && $globalVATSIM) $fromsource = 'vatsim'; |
|
3643 | - elseif (isset($globalIVAO) && $globalIVAO) $fromsource = 'ivao'; |
|
3824 | + if (isset($globalAirlinesSource) && $globalAirlinesSource != '') { |
|
3825 | + $fromsource = $globalAirlinesSource; |
|
3826 | + } elseif ($format_source == 'vatsimtxt') { |
|
3827 | + $fromsource = 'vatsim'; |
|
3828 | + } elseif ($format_source == 'whazzup') { |
|
3829 | + $fromsource = 'ivao'; |
|
3830 | + } elseif (isset($globalVATSIM) && $globalVATSIM) { |
|
3831 | + $fromsource = 'vatsim'; |
|
3832 | + } elseif (isset($globalIVAO) && $globalIVAO) { |
|
3833 | + $fromsource = 'ivao'; |
|
3834 | + } |
|
3644 | 3835 | //getting the airline information |
3645 | 3836 | if ($ident != "") |
3646 | 3837 | { |
@@ -3664,15 +3855,21 @@ discard block |
||
3664 | 3855 | if (!isset($airline_array[0]['icao']) || $airline_array[0]['icao'] == ""){ |
3665 | 3856 | $airline_array = $this->getAllAirlineInfo("NA"); |
3666 | 3857 | } |
3667 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
3858 | + if ($globalDebugTimeElapsed) { |
|
3859 | + echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
3860 | + } |
|
3668 | 3861 | |
3669 | 3862 | } else { |
3670 | 3863 | $timeelapsed = microtime(true); |
3671 | 3864 | $airline_array = $this->getAllAirlineInfo("NA"); |
3672 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
3865 | + if ($globalDebugTimeElapsed) { |
|
3866 | + echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
3867 | + } |
|
3673 | 3868 | } |
3674 | 3869 | } |
3675 | - } else $airline_array = array(); |
|
3870 | + } else { |
|
3871 | + $airline_array = array(); |
|
3872 | + } |
|
3676 | 3873 | |
3677 | 3874 | //getting the aircraft information |
3678 | 3875 | $aircraft_array = array(); |
@@ -3686,27 +3883,37 @@ discard block |
||
3686 | 3883 | { |
3687 | 3884 | $timeelapsed = microtime(true); |
3688 | 3885 | $aircraft_array = $this->getAllAircraftInfo("NA"); |
3689 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
3886 | + if ($globalDebugTimeElapsed) { |
|
3887 | + echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
3888 | + } |
|
3690 | 3889 | } else { |
3691 | 3890 | $timeelapsed = microtime(true); |
3692 | 3891 | $aircraft_array = $this->getAllAircraftInfo($aircraft_icao); |
3693 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
3892 | + if ($globalDebugTimeElapsed) { |
|
3893 | + echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
3894 | + } |
|
3694 | 3895 | } |
3695 | 3896 | } |
3696 | 3897 | } else { |
3697 | 3898 | if ($ModeS != '') { |
3698 | 3899 | $timeelapsed = microtime(true); |
3699 | 3900 | $aircraft_icao = $this->getAllAircraftType($ModeS,$source_type); |
3700 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAircraftType : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
3901 | + if ($globalDebugTimeElapsed) { |
|
3902 | + echo 'ADD SPOTTER DATA : Time elapsed for getAllAircraftType : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
3903 | + } |
|
3701 | 3904 | if ($aircraft_icao == "" || $aircraft_icao == "XXXX") |
3702 | 3905 | { |
3703 | 3906 | $timeelapsed = microtime(true); |
3704 | 3907 | $aircraft_array = $this->getAllAircraftInfo("NA"); |
3705 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
3908 | + if ($globalDebugTimeElapsed) { |
|
3909 | + echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
3910 | + } |
|
3706 | 3911 | } else { |
3707 | 3912 | $timeelapsed = microtime(true); |
3708 | 3913 | $aircraft_array = $this->getAllAircraftInfo($aircraft_icao); |
3709 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
3914 | + if ($globalDebugTimeElapsed) { |
|
3915 | + echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
3916 | + } |
|
3710 | 3917 | } |
3711 | 3918 | } |
3712 | 3919 | } |
@@ -3722,7 +3929,9 @@ discard block |
||
3722 | 3929 | } else { |
3723 | 3930 | $timeelapsed = microtime(true); |
3724 | 3931 | $departure_airport_array = $this->getAllAirportInfo($departure_airport_icao); |
3725 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
3932 | + if ($globalDebugTimeElapsed) { |
|
3933 | + echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
3934 | + } |
|
3726 | 3935 | } |
3727 | 3936 | } |
3728 | 3937 | |
@@ -3737,7 +3946,9 @@ discard block |
||
3737 | 3946 | } else { |
3738 | 3947 | $timeelapsed = microtime(true); |
3739 | 3948 | $arrival_airport_array = $this->getAllAirportInfo($arrival_airport_icao); |
3740 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
3949 | + if ($globalDebugTimeElapsed) { |
|
3950 | + echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
3951 | + } |
|
3741 | 3952 | } |
3742 | 3953 | } |
3743 | 3954 | |
@@ -3771,7 +3982,9 @@ discard block |
||
3771 | 3982 | { |
3772 | 3983 | return false; |
3773 | 3984 | } |
3774 | - } else $altitude = 0; |
|
3985 | + } else { |
|
3986 | + $altitude = 0; |
|
3987 | + } |
|
3775 | 3988 | |
3776 | 3989 | if ($heading != "") |
3777 | 3990 | { |
@@ -3800,7 +4013,9 @@ discard block |
||
3800 | 4013 | { |
3801 | 4014 | $timeelapsed = microtime(true); |
3802 | 4015 | $image_array = $Image->getSpotterImage($registration); |
3803 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getSpotterImage : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
4016 | + if ($globalDebugTimeElapsed) { |
|
4017 | + echo 'ADD SPOTTER DATA : Time elapsed for getSpotterImage : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
4018 | + } |
|
3804 | 4019 | if (!isset($image_array[0]['registration'])) |
3805 | 4020 | { |
3806 | 4021 | //echo "Add image !!!! \n"; |
@@ -3808,14 +4023,21 @@ discard block |
||
3808 | 4023 | } |
3809 | 4024 | $timeelapsed = microtime(true); |
3810 | 4025 | $owner_info = $this->getAircraftOwnerByRegistration($registration); |
3811 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftOwnerByRegistration : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
3812 | - if ($owner_info['owner'] != '') $aircraft_owner = ucwords(strtolower($owner_info['owner'])); |
|
4026 | + if ($globalDebugTimeElapsed) { |
|
4027 | + echo 'ADD SPOTTER DATA : Time elapsed for getAircraftOwnerByRegistration : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
4028 | + } |
|
4029 | + if ($owner_info['owner'] != '') { |
|
4030 | + $aircraft_owner = ucwords(strtolower($owner_info['owner'])); |
|
4031 | + } |
|
3813 | 4032 | } |
3814 | 4033 | |
3815 | 4034 | if ($globalIVAO && $aircraft_icao != '') |
3816 | 4035 | { |
3817 | - if (isset($airline_array[0]['icao'])) $airline_icao = $airline_array[0]['icao']; |
|
3818 | - else $airline_icao = ''; |
|
4036 | + if (isset($airline_array[0]['icao'])) { |
|
4037 | + $airline_icao = $airline_array[0]['icao']; |
|
4038 | + } else { |
|
4039 | + $airline_icao = ''; |
|
4040 | + } |
|
3819 | 4041 | $image_array = $Image->getSpotterImage('',$aircraft_icao,$airline_icao); |
3820 | 4042 | if (!isset($image_array[0]['registration'])) |
3821 | 4043 | { |
@@ -3860,16 +4082,28 @@ discard block |
||
3860 | 4082 | { |
3861 | 4083 | $arrival_airport_array = $this->getAllAirportInfo('NA'); |
3862 | 4084 | } |
3863 | - if ($registration == '') $registration = 'NA'; |
|
4085 | + if ($registration == '') { |
|
4086 | + $registration = 'NA'; |
|
4087 | + } |
|
3864 | 4088 | if ($latitude == '' && $longitude == '') { |
3865 | 4089 | $latitude = 0; |
3866 | 4090 | $longitude = 0; |
3867 | 4091 | } |
3868 | - if ($squawk == '' || $Common->isInteger($squawk) === false) $squawk = NULL; |
|
3869 | - if ($verticalrate == '' || $Common->isInteger($verticalrate) === false) $verticalrate = NULL; |
|
3870 | - if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0; |
|
3871 | - if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0; |
|
3872 | - if (!isset($aircraft_owner)) $aircraft_owner = NULL; |
|
4092 | + if ($squawk == '' || $Common->isInteger($squawk) === false) { |
|
4093 | + $squawk = NULL; |
|
4094 | + } |
|
4095 | + if ($verticalrate == '' || $Common->isInteger($verticalrate) === false) { |
|
4096 | + $verticalrate = NULL; |
|
4097 | + } |
|
4098 | + if ($heading == '' || $Common->isInteger($heading) === false) { |
|
4099 | + $heading = 0; |
|
4100 | + } |
|
4101 | + if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) { |
|
4102 | + $groundspeed = 0; |
|
4103 | + } |
|
4104 | + if (!isset($aircraft_owner)) { |
|
4105 | + $aircraft_owner = NULL; |
|
4106 | + } |
|
3873 | 4107 | $query = "INSERT INTO spotter_output (flightaware_id, ident, registration, airline_name, airline_icao, airline_country, airline_type, aircraft_icao, 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,highlight,ModeS, pilot_id, pilot_name, verticalrate, owner_name, ground, format_source, source_name) |
3874 | 4108 | VALUES (:flightaware_id,:ident,:registration,:airline_name,:airline_icao,:airline_country,:airline_type,:aircraft_icao,: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, :highlight, :ModeS, :pilot_id, :pilot_name, :verticalrate, :owner_name,:ground, :format_source, :source_name)"; |
3875 | 4109 | |
@@ -3880,9 +4114,13 @@ discard block |
||
3880 | 4114 | if ($airline_type == '') { |
3881 | 4115 | $timeelapsed = microtime(true); |
3882 | 4116 | $airline_type = $this->getAircraftTypeBymodeS($ModeS); |
3883 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftTypeBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
4117 | + if ($globalDebugTimeElapsed) { |
|
4118 | + echo 'ADD SPOTTER DATA : Time elapsed for getAircraftTypeBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
4119 | + } |
|
4120 | + } |
|
4121 | + if ($airline_type == null) { |
|
4122 | + $airline_type = ''; |
|
3884 | 4123 | } |
3885 | - if ($airline_type == null) $airline_type = ''; |
|
3886 | 4124 | $aircraft_type = $aircraft_array[0]['type']; |
3887 | 4125 | $aircraft_manufacturer = $aircraft_array[0]['manufacturer']; |
3888 | 4126 | $departure_airport_name = $departure_airport_array[0]['name']; |
@@ -4046,7 +4284,9 @@ discard block |
||
4046 | 4284 | } |
4047 | 4285 | } |
4048 | 4286 | $query .= " GROUP BY spotter_output.airline_name,spotter_output.airline_icao, spotter_output.airline_country ORDER BY airline_count DESC"; |
4049 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
4287 | + if ($limit) { |
|
4288 | + $query .= " LIMIT 10 OFFSET 0"; |
|
4289 | + } |
|
4050 | 4290 | |
4051 | 4291 | $sth = $this->db->prepare($query); |
4052 | 4292 | $sth->execute($query_values); |
@@ -4119,7 +4359,9 @@ discard block |
||
4119 | 4359 | } |
4120 | 4360 | |
4121 | 4361 | $query .= " GROUP BY spotter_output.pilot_id,s.pilot_name,spotter_output.format_source ORDER BY pilot_count DESC"; |
4122 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
4362 | + if ($limit) { |
|
4363 | + $query .= " LIMIT 10 OFFSET 0"; |
|
4364 | + } |
|
4123 | 4365 | |
4124 | 4366 | |
4125 | 4367 | $sth = $this->db->prepare($query); |
@@ -4163,7 +4405,9 @@ discard block |
||
4163 | 4405 | } |
4164 | 4406 | } |
4165 | 4407 | $query .= "GROUP BY spotter_output.airline_icao, spotter_output.pilot_id,spotter_output.pilot_name,spotter_output.format_source ORDER BY pilot_count DESC"; |
4166 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
4408 | + if ($limit) { |
|
4409 | + $query .= " LIMIT 10 OFFSET 0"; |
|
4410 | + } |
|
4167 | 4411 | |
4168 | 4412 | |
4169 | 4413 | $sth = $this->db->prepare($query); |
@@ -4239,7 +4483,9 @@ discard block |
||
4239 | 4483 | } |
4240 | 4484 | } |
4241 | 4485 | $query .= " GROUP BY spotter_output.owner_name ORDER BY owner_count DESC"; |
4242 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
4486 | + if ($limit) { |
|
4487 | + $query .= " LIMIT 10 OFFSET 0"; |
|
4488 | + } |
|
4243 | 4489 | |
4244 | 4490 | $sth = $this->db->prepare($query); |
4245 | 4491 | $sth->execute($query_values); |
@@ -4281,7 +4527,9 @@ discard block |
||
4281 | 4527 | } |
4282 | 4528 | } |
4283 | 4529 | $query .= "GROUP BY spotter_output.airline_icao, spotter_output.owner_name ORDER BY owner_count DESC"; |
4284 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
4530 | + if ($limit) { |
|
4531 | + $query .= " LIMIT 10 OFFSET 0"; |
|
4532 | + } |
|
4285 | 4533 | |
4286 | 4534 | |
4287 | 4535 | $sth = $this->db->prepare($query); |
@@ -4524,7 +4772,9 @@ discard block |
||
4524 | 4772 | date_default_timezone_set($globalTimezone); |
4525 | 4773 | $datetime = new DateTime($date); |
4526 | 4774 | $offset = $datetime->format('P'); |
4527 | - } else $offset = '+00:00'; |
|
4775 | + } else { |
|
4776 | + $offset = '+00:00'; |
|
4777 | + } |
|
4528 | 4778 | |
4529 | 4779 | if ($globalDBdriver == 'mysql') { |
4530 | 4780 | $query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count |
@@ -4572,7 +4822,9 @@ discard block |
||
4572 | 4822 | date_default_timezone_set($globalTimezone); |
4573 | 4823 | $datetime = new DateTime($date); |
4574 | 4824 | $offset = $datetime->format('P'); |
4575 | - } else $offset = '+00:00'; |
|
4825 | + } else { |
|
4826 | + $offset = '+00:00'; |
|
4827 | + } |
|
4576 | 4828 | |
4577 | 4829 | if ($globalDBdriver == 'mysql') { |
4578 | 4830 | $query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count |
@@ -4692,9 +4944,13 @@ discard block |
||
4692 | 4944 | $sth = $this->db->prepare($query); |
4693 | 4945 | $sth->execute($query_values); |
4694 | 4946 | $result = $sth->fetchAll(PDO::FETCH_ASSOC); |
4695 | - if (is_numeric($result[0]['duration'])) return gmdate('H:i:s',$result[0]['duration']); |
|
4696 | - elseif ($result[0]['duration'] == '') return 0; |
|
4697 | - else return $result[0]['duration']; |
|
4947 | + if (is_numeric($result[0]['duration'])) { |
|
4948 | + return gmdate('H:i:s',$result[0]['duration']); |
|
4949 | + } elseif ($result[0]['duration'] == '') { |
|
4950 | + return 0; |
|
4951 | + } else { |
|
4952 | + return $result[0]['duration']; |
|
4953 | + } |
|
4698 | 4954 | } |
4699 | 4955 | |
4700 | 4956 | /** |
@@ -4783,8 +5039,11 @@ discard block |
||
4783 | 5039 | $sth = $this->db->prepare($query); |
4784 | 5040 | $sth->execute($query_values); |
4785 | 5041 | $result = $sth->fetchAll(PDO::FETCH_ASSOC); |
4786 | - if (is_int($result[0]['duration'])) return gmdate('H:i:s',$result[0]['duration']); |
|
4787 | - else return $result[0]['duration']; |
|
5042 | + if (is_int($result[0]['duration'])) { |
|
5043 | + return gmdate('H:i:s',$result[0]['duration']); |
|
5044 | + } else { |
|
5045 | + return $result[0]['duration']; |
|
5046 | + } |
|
4788 | 5047 | } |
4789 | 5048 | |
4790 | 5049 | /** |
@@ -4989,7 +5248,9 @@ discard block |
||
4989 | 5248 | } |
4990 | 5249 | $query .= " GROUP BY spotter_output.airline_country |
4991 | 5250 | ORDER BY airline_country_count DESC"; |
4992 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
5251 | + if ($limit) { |
|
5252 | + $query .= " LIMIT 10 OFFSET 0"; |
|
5253 | + } |
|
4993 | 5254 | |
4994 | 5255 | $sth = $this->db->prepare($query); |
4995 | 5256 | $sth->execute($query_values); |
@@ -5017,7 +5278,9 @@ discard block |
||
5017 | 5278 | global $globalDBdriver; |
5018 | 5279 | //$filter_query = $this->getFilter($filters,true,true); |
5019 | 5280 | $Connection= new Connection($this->db); |
5020 | - if (!$Connection->tableExists('countries')) return array(); |
|
5281 | + if (!$Connection->tableExists('countries')) { |
|
5282 | + return array(); |
|
5283 | + } |
|
5021 | 5284 | /* |
5022 | 5285 | $query = "SELECT c.name, c.iso3, c.iso2, count(c.name) as nb |
5023 | 5286 | FROM countries c, spotter_output s |
@@ -5049,7 +5312,9 @@ discard block |
||
5049 | 5312 | } |
5050 | 5313 | $query = "SELECT c.name, c.iso3, c.iso2, count(c.name) as nb FROM countries c INNER JOIN (SELECT DISTINCT flightaware_id,over_country FROM spotter_live".$filter_query.") l ON c.iso2 = l.over_country "; |
5051 | 5314 | $query .= "GROUP BY c.name,c.iso3,c.iso2 ORDER BY nb DESC"; |
5052 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
5315 | + if ($limit) { |
|
5316 | + $query .= " LIMIT 10 OFFSET 0"; |
|
5317 | + } |
|
5053 | 5318 | |
5054 | 5319 | |
5055 | 5320 | $sth = $this->db->prepare($query); |
@@ -5126,7 +5391,9 @@ discard block |
||
5126 | 5391 | } |
5127 | 5392 | |
5128 | 5393 | $query .= " GROUP BY spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer ORDER BY aircraft_icao_count DESC"; |
5129 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
5394 | + if ($limit) { |
|
5395 | + $query .= " LIMIT 10 OFFSET 0"; |
|
5396 | + } |
|
5130 | 5397 | |
5131 | 5398 | $sth = $this->db->prepare($query); |
5132 | 5399 | $sth->execute($query_values); |
@@ -5200,7 +5467,9 @@ discard block |
||
5200 | 5467 | } |
5201 | 5468 | |
5202 | 5469 | $query .= " GROUP BY spotter_output.airline_icao, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer ORDER BY aircraft_icao_count DESC"; |
5203 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
5470 | + if ($limit) { |
|
5471 | + $query .= " LIMIT 10 OFFSET 0"; |
|
5472 | + } |
|
5204 | 5473 | |
5205 | 5474 | $sth = $this->db->prepare($query); |
5206 | 5475 | $sth->execute($query_values); |
@@ -5247,7 +5516,9 @@ discard block |
||
5247 | 5516 | } |
5248 | 5517 | |
5249 | 5518 | $query .= "GROUP BY EXTRACT(month from spotter_output.date), EXTRACT(year from spotter_output.date), spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer ORDER BY aircraft_icao_count DESC"; |
5250 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
5519 | + if ($limit) { |
|
5520 | + $query .= " LIMIT 10 OFFSET 0"; |
|
5521 | + } |
|
5251 | 5522 | |
5252 | 5523 | $sth = $this->db->prepare($query); |
5253 | 5524 | $sth->execute(); |
@@ -5300,7 +5571,9 @@ discard block |
||
5300 | 5571 | if($row['registration'] != "") |
5301 | 5572 | { |
5302 | 5573 | $image_array = $Image->getSpotterImage($row['registration']); |
5303 | - if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
5574 | + if (isset($image_array[0]['image_thumbnail'])) { |
|
5575 | + $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
5576 | + } |
|
5304 | 5577 | } |
5305 | 5578 | $temp_array['registration_count'] = $row['registration_count']; |
5306 | 5579 | |
@@ -5375,7 +5648,9 @@ discard block |
||
5375 | 5648 | if($row['registration'] != "") |
5376 | 5649 | { |
5377 | 5650 | $image_array = $Image->getSpotterImage($row['registration']); |
5378 | - if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
5651 | + if (isset($image_array[0]['image_thumbnail'])) { |
|
5652 | + $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
5653 | + } |
|
5379 | 5654 | } |
5380 | 5655 | $temp_array['registration_count'] = $row['registration_count']; |
5381 | 5656 | |
@@ -5482,7 +5757,9 @@ discard block |
||
5482 | 5757 | if($row['registration'] != "") |
5483 | 5758 | { |
5484 | 5759 | $image_array = $Image->getSpotterImage($row['registration']); |
5485 | - if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
5760 | + if (isset($image_array[0]['image_thumbnail'])) { |
|
5761 | + $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
5762 | + } |
|
5486 | 5763 | } |
5487 | 5764 | $temp_array['registration_count'] = $row['registration_count']; |
5488 | 5765 | $aircraft_array[] = $temp_array; |
@@ -5607,7 +5884,9 @@ discard block |
||
5607 | 5884 | date_default_timezone_set($globalTimezone); |
5608 | 5885 | $datetime = new DateTime($date); |
5609 | 5886 | $offset = $datetime->format('P'); |
5610 | - } else $offset = '+00:00'; |
|
5887 | + } else { |
|
5888 | + $offset = '+00:00'; |
|
5889 | + } |
|
5611 | 5890 | |
5612 | 5891 | if ($globalDBdriver == 'mysql') { |
5613 | 5892 | $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name |
@@ -5654,7 +5933,9 @@ discard block |
||
5654 | 5933 | date_default_timezone_set($globalTimezone); |
5655 | 5934 | $datetime = new DateTime($date); |
5656 | 5935 | $offset = $datetime->format('P'); |
5657 | - } else $offset = '+00:00'; |
|
5936 | + } else { |
|
5937 | + $offset = '+00:00'; |
|
5938 | + } |
|
5658 | 5939 | |
5659 | 5940 | if ($globalDBdriver == 'mysql') { |
5660 | 5941 | $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name |
@@ -5683,7 +5964,9 @@ discard block |
||
5683 | 5964 | if($row['registration'] != "") |
5684 | 5965 | { |
5685 | 5966 | $image_array = $Image->getSpotterImage($row['registration']); |
5686 | - if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
5967 | + if (isset($image_array[0]['image_thumbnail'])) { |
|
5968 | + $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
5969 | + } |
|
5687 | 5970 | } |
5688 | 5971 | $temp_array['registration_count'] = $row['registration_count']; |
5689 | 5972 | |
@@ -5708,7 +5991,9 @@ discard block |
||
5708 | 5991 | date_default_timezone_set($globalTimezone); |
5709 | 5992 | $datetime = new DateTime($date); |
5710 | 5993 | $offset = $datetime->format('P'); |
5711 | - } else $offset = '+00:00'; |
|
5994 | + } else { |
|
5995 | + $offset = '+00:00'; |
|
5996 | + } |
|
5712 | 5997 | |
5713 | 5998 | if ($globalDBdriver == 'mysql') { |
5714 | 5999 | $query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count |
@@ -5904,8 +6189,11 @@ discard block |
||
5904 | 6189 | if($row['registration'] != "") |
5905 | 6190 | { |
5906 | 6191 | $image_array = $Image->getSpotterImage($row['registration']); |
5907 | - if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
5908 | - else $temp_array['image_thumbnail'] = ''; |
|
6192 | + if (isset($image_array[0]['image_thumbnail'])) { |
|
6193 | + $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
6194 | + } else { |
|
6195 | + $temp_array['image_thumbnail'] = ''; |
|
6196 | + } |
|
5909 | 6197 | } |
5910 | 6198 | $temp_array['registration_count'] = $row['registration_count']; |
5911 | 6199 | $aircraft_array[] = $temp_array; |
@@ -5979,8 +6267,11 @@ discard block |
||
5979 | 6267 | if($row['registration'] != "") |
5980 | 6268 | { |
5981 | 6269 | $image_array = $Image->getSpotterImage($row['registration']); |
5982 | - if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
5983 | - else $temp_array['image_thumbnail'] = ''; |
|
6270 | + if (isset($image_array[0]['image_thumbnail'])) { |
|
6271 | + $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
6272 | + } else { |
|
6273 | + $temp_array['image_thumbnail'] = ''; |
|
6274 | + } |
|
5984 | 6275 | } |
5985 | 6276 | $temp_array['registration_count'] = $row['registration_count']; |
5986 | 6277 | $aircraft_array[] = $temp_array; |
@@ -6054,8 +6345,11 @@ discard block |
||
6054 | 6345 | if($row['registration'] != "") |
6055 | 6346 | { |
6056 | 6347 | $image_array = $Image->getSpotterImage($row['registration']); |
6057 | - if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
6058 | - else $temp_array['image_thumbnail'] = ''; |
|
6348 | + if (isset($image_array[0]['image_thumbnail'])) { |
|
6349 | + $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
6350 | + } else { |
|
6351 | + $temp_array['image_thumbnail'] = ''; |
|
6352 | + } |
|
6059 | 6353 | } |
6060 | 6354 | $temp_array['registration_count'] = $row['registration_count']; |
6061 | 6355 | $aircraft_array[] = $temp_array; |
@@ -6266,7 +6560,9 @@ discard block |
||
6266 | 6560 | if($row['registration'] != "") |
6267 | 6561 | { |
6268 | 6562 | $image_array = $Image->getSpotterImage($row['registration']); |
6269 | - if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
6563 | + if (isset($image_array[0]['image_thumbnail'])) { |
|
6564 | + $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
6565 | + } |
|
6270 | 6566 | } |
6271 | 6567 | $temp_array['registration_count'] = $row['registration_count']; |
6272 | 6568 | |
@@ -6383,7 +6679,9 @@ discard block |
||
6383 | 6679 | if($row['registration'] != "") |
6384 | 6680 | { |
6385 | 6681 | $image_array = $Image->getSpotterImage($row['registration']); |
6386 | - if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
6682 | + if (isset($image_array[0]['image_thumbnail'])) { |
|
6683 | + $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
6684 | + } |
|
6387 | 6685 | } |
6388 | 6686 | $temp_array['registration_count'] = $row['registration_count']; |
6389 | 6687 | |
@@ -6549,7 +6847,9 @@ discard block |
||
6549 | 6847 | } |
6550 | 6848 | } |
6551 | 6849 | $query .= " GROUP BY spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name ORDER BY aircraft_registration_count DESC"; |
6552 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
6850 | + if ($limit) { |
|
6851 | + $query .= " LIMIT 10 OFFSET 0"; |
|
6852 | + } |
|
6553 | 6853 | |
6554 | 6854 | $sth = $this->db->prepare($query); |
6555 | 6855 | $sth->execute($query_values); |
@@ -6568,7 +6868,9 @@ discard block |
||
6568 | 6868 | if($row['registration'] != "") |
6569 | 6869 | { |
6570 | 6870 | $image_array = $Image->getSpotterImage($row['registration']); |
6571 | - if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
6871 | + if (isset($image_array[0]['image_thumbnail'])) { |
|
6872 | + $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
6873 | + } |
|
6572 | 6874 | } |
6573 | 6875 | |
6574 | 6876 | $aircraft_array[] = $temp_array; |
@@ -6609,7 +6911,9 @@ discard block |
||
6609 | 6911 | // if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) '; |
6610 | 6912 | //if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
6611 | 6913 | $query .= "GROUP BY spotter_output.airline_icao, spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name ORDER BY aircraft_registration_count DESC"; |
6612 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
6914 | + if ($limit) { |
|
6915 | + $query .= " LIMIT 10 OFFSET 0"; |
|
6916 | + } |
|
6613 | 6917 | |
6614 | 6918 | $sth = $this->db->prepare($query); |
6615 | 6919 | $sth->execute(); |
@@ -6629,7 +6933,9 @@ discard block |
||
6629 | 6933 | if($row['registration'] != "") |
6630 | 6934 | { |
6631 | 6935 | $image_array = $Image->getSpotterImage($row['registration']); |
6632 | - if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
6936 | + if (isset($image_array[0]['image_thumbnail'])) { |
|
6937 | + $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
|
6938 | + } |
|
6633 | 6939 | } |
6634 | 6940 | |
6635 | 6941 | $aircraft_array[] = $temp_array; |
@@ -6695,7 +7001,9 @@ discard block |
||
6695 | 7001 | } |
6696 | 7002 | $query .= " GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country |
6697 | 7003 | ORDER BY airport_departure_icao_count DESC"; |
6698 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
7004 | + if ($limit) { |
|
7005 | + $query .= " LIMIT 10 OFFSET 0"; |
|
7006 | + } |
|
6699 | 7007 | |
6700 | 7008 | $sth = $this->db->prepare($query); |
6701 | 7009 | $sth->execute($query_values); |
@@ -6746,7 +7054,9 @@ discard block |
||
6746 | 7054 | //if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
6747 | 7055 | $query .= "GROUP BY spotter_output.airline_icao, spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country |
6748 | 7056 | ORDER BY airport_departure_icao_count DESC"; |
6749 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
7057 | + if ($limit) { |
|
7058 | + $query .= " LIMIT 10 OFFSET 0"; |
|
7059 | + } |
|
6750 | 7060 | |
6751 | 7061 | $sth = $this->db->prepare($query); |
6752 | 7062 | $sth->execute(); |
@@ -6824,7 +7134,9 @@ discard block |
||
6824 | 7134 | } |
6825 | 7135 | $query .= " GROUP BY spotter_output.real_departure_airport_icao, airport.name, airport.city, airport.country |
6826 | 7136 | ORDER BY airport_departure_icao_count DESC"; |
6827 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
7137 | + if ($limit) { |
|
7138 | + $query .= " LIMIT 10 OFFSET 0"; |
|
7139 | + } |
|
6828 | 7140 | //echo $query; |
6829 | 7141 | $sth = $this->db->prepare($query); |
6830 | 7142 | $sth->execute($query_values); |
@@ -6876,7 +7188,9 @@ discard block |
||
6876 | 7188 | //if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
6877 | 7189 | $query .= "GROUP BY spotter_output.airline_icao, spotter_output.real_departure_airport_icao, airport.name, airport.city, airport.country |
6878 | 7190 | ORDER BY airport_departure_icao_count DESC"; |
6879 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
7191 | + if ($limit) { |
|
7192 | + $query .= " LIMIT 10 OFFSET 0"; |
|
7193 | + } |
|
6880 | 7194 | |
6881 | 7195 | $sth = $this->db->prepare($query); |
6882 | 7196 | $sth->execute(); |
@@ -7271,7 +7585,9 @@ discard block |
||
7271 | 7585 | date_default_timezone_set($globalTimezone); |
7272 | 7586 | $datetime = new DateTime($date); |
7273 | 7587 | $offset = $datetime->format('P'); |
7274 | - } else $offset = '+00:00'; |
|
7588 | + } else { |
|
7589 | + $offset = '+00:00'; |
|
7590 | + } |
|
7275 | 7591 | |
7276 | 7592 | if ($globalDBdriver == 'mysql') { |
7277 | 7593 | $query = "SELECT DISTINCT spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country |
@@ -7321,7 +7637,9 @@ discard block |
||
7321 | 7637 | date_default_timezone_set($globalTimezone); |
7322 | 7638 | $datetime = new DateTime($date); |
7323 | 7639 | $offset = $datetime->format('P'); |
7324 | - } else $offset = '+00:00'; |
|
7640 | + } else { |
|
7641 | + $offset = '+00:00'; |
|
7642 | + } |
|
7325 | 7643 | |
7326 | 7644 | if ($globalDBdriver == 'mysql') { |
7327 | 7645 | $query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count |
@@ -7670,7 +7988,9 @@ discard block |
||
7670 | 7988 | } |
7671 | 7989 | $query .= " GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
7672 | 7990 | ORDER BY airport_arrival_icao_count DESC"; |
7673 | - if ($limit) $query .= " LIMIT 10"; |
|
7991 | + if ($limit) { |
|
7992 | + $query .= " LIMIT 10"; |
|
7993 | + } |
|
7674 | 7994 | |
7675 | 7995 | |
7676 | 7996 | $sth = $this->db->prepare($query); |
@@ -7690,7 +8010,9 @@ discard block |
||
7690 | 8010 | if ($icaoaskey) { |
7691 | 8011 | $icao = $row['arrival_airport_icao']; |
7692 | 8012 | $airport_array[$icao] = $temp_array; |
7693 | - } else $airport_array[] = $temp_array; |
|
8013 | + } else { |
|
8014 | + $airport_array[] = $temp_array; |
|
8015 | + } |
|
7694 | 8016 | } |
7695 | 8017 | |
7696 | 8018 | return $airport_array; |
@@ -7727,7 +8049,9 @@ discard block |
||
7727 | 8049 | //if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
7728 | 8050 | $query .= "GROUP BY spotter_output.airline_icao,spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
7729 | 8051 | ORDER BY airport_arrival_icao_count DESC"; |
7730 | - if ($limit) $query .= " LIMIT 10"; |
|
8052 | + if ($limit) { |
|
8053 | + $query .= " LIMIT 10"; |
|
8054 | + } |
|
7731 | 8055 | |
7732 | 8056 | |
7733 | 8057 | $sth = $this->db->prepare($query); |
@@ -7748,7 +8072,9 @@ discard block |
||
7748 | 8072 | if ($icaoaskey) { |
7749 | 8073 | $icao = $row['arrival_airport_icao']; |
7750 | 8074 | $airport_array[$icao] = $temp_array; |
7751 | - } else $airport_array[] = $temp_array; |
|
8075 | + } else { |
|
8076 | + $airport_array[] = $temp_array; |
|
8077 | + } |
|
7752 | 8078 | } |
7753 | 8079 | |
7754 | 8080 | return $airport_array; |
@@ -7811,7 +8137,9 @@ discard block |
||
7811 | 8137 | } |
7812 | 8138 | $query .= " GROUP BY spotter_output.real_arrival_airport_icao, airport.name, airport.city, airport.country |
7813 | 8139 | ORDER BY airport_arrival_icao_count DESC"; |
7814 | - if ($limit) $query .= " LIMIT 10"; |
|
8140 | + if ($limit) { |
|
8141 | + $query .= " LIMIT 10"; |
|
8142 | + } |
|
7815 | 8143 | |
7816 | 8144 | |
7817 | 8145 | $sth = $this->db->prepare($query); |
@@ -7830,7 +8158,9 @@ discard block |
||
7830 | 8158 | if ($icaoaskey) { |
7831 | 8159 | $icao = $row['arrival_airport_icao']; |
7832 | 8160 | $airport_array[$icao] = $temp_array; |
7833 | - } else $airport_array[] = $temp_array; |
|
8161 | + } else { |
|
8162 | + $airport_array[] = $temp_array; |
|
8163 | + } |
|
7834 | 8164 | } |
7835 | 8165 | |
7836 | 8166 | return $airport_array; |
@@ -7867,7 +8197,9 @@ discard block |
||
7867 | 8197 | //if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
7868 | 8198 | $query .= "GROUP BY spotter_output.airline_icao, spotter_output.real_arrival_airport_icao, airport.name, airport.city, airport.country |
7869 | 8199 | ORDER BY airport_arrival_icao_count DESC"; |
7870 | - if ($limit) $query .= " LIMIT 10"; |
|
8200 | + if ($limit) { |
|
8201 | + $query .= " LIMIT 10"; |
|
8202 | + } |
|
7871 | 8203 | |
7872 | 8204 | |
7873 | 8205 | $sth = $this->db->prepare($query); |
@@ -7888,7 +8220,9 @@ discard block |
||
7888 | 8220 | if ($icaoaskey) { |
7889 | 8221 | $icao = $row['arrival_airport_icao']; |
7890 | 8222 | $airport_array[$icao] = $temp_array; |
7891 | - } else $airport_array[] = $temp_array; |
|
8223 | + } else { |
|
8224 | + $airport_array[] = $temp_array; |
|
8225 | + } |
|
7892 | 8226 | } |
7893 | 8227 | |
7894 | 8228 | return $airport_array; |
@@ -8269,7 +8603,9 @@ discard block |
||
8269 | 8603 | date_default_timezone_set($globalTimezone); |
8270 | 8604 | $datetime = new DateTime($date); |
8271 | 8605 | $offset = $datetime->format('P'); |
8272 | - } else $offset = '+00:00'; |
|
8606 | + } else { |
|
8607 | + $offset = '+00:00'; |
|
8608 | + } |
|
8273 | 8609 | |
8274 | 8610 | if ($globalDBdriver == 'mysql') { |
8275 | 8611 | $query = "SELECT DISTINCT spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
@@ -8319,7 +8655,9 @@ discard block |
||
8319 | 8655 | date_default_timezone_set($globalTimezone); |
8320 | 8656 | $datetime = new DateTime($date); |
8321 | 8657 | $offset = $datetime->format('P'); |
8322 | - } else $offset = '+00:00'; |
|
8658 | + } else { |
|
8659 | + $offset = '+00:00'; |
|
8660 | + } |
|
8323 | 8661 | |
8324 | 8662 | if ($globalDBdriver == 'mysql') { |
8325 | 8663 | $query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count |
@@ -8710,7 +9048,9 @@ discard block |
||
8710 | 9048 | } |
8711 | 9049 | $query .= " GROUP BY spotter_output.arrival_airport_country |
8712 | 9050 | ORDER BY airport_arrival_country_count DESC"; |
8713 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
9051 | + if ($limit) { |
|
9052 | + $query .= " LIMIT 10 OFFSET 0"; |
|
9053 | + } |
|
8714 | 9054 | |
8715 | 9055 | |
8716 | 9056 | $sth = $this->db->prepare($query); |
@@ -8997,7 +9337,9 @@ discard block |
||
8997 | 9337 | date_default_timezone_set($globalTimezone); |
8998 | 9338 | $datetime = new DateTime($date); |
8999 | 9339 | $offset = $datetime->format('P'); |
9000 | - } else $offset = '+00:00'; |
|
9340 | + } else { |
|
9341 | + $offset = '+00:00'; |
|
9342 | + } |
|
9001 | 9343 | |
9002 | 9344 | if ($globalDBdriver == 'mysql') { |
9003 | 9345 | $query = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country |
@@ -9253,12 +9595,18 @@ discard block |
||
9253 | 9595 | $query = "SELECT DISTINCT spotter_output.ident, COUNT(spotter_output.ident) AS callsign_icao_count, spotter_output.airline_name, spotter_output.airline_icao |
9254 | 9596 | FROM spotter_output".$filter_query." spotter_output.ident <> ''"; |
9255 | 9597 | if ($olderthanmonths > 0) { |
9256 | - if ($globalDBdriver == 'mysql') $query .= ' AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH)'; |
|
9257 | - else $query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'"; |
|
9598 | + if ($globalDBdriver == 'mysql') { |
|
9599 | + $query .= ' AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH)'; |
|
9600 | + } else { |
|
9601 | + $query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'"; |
|
9602 | + } |
|
9258 | 9603 | } |
9259 | 9604 | if ($sincedate != '') { |
9260 | - if ($globalDBdriver == 'mysql') $query .= " AND spotter_output.date > '".$sincedate."'"; |
|
9261 | - else $query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)"; |
|
9605 | + if ($globalDBdriver == 'mysql') { |
|
9606 | + $query .= " AND spotter_output.date > '".$sincedate."'"; |
|
9607 | + } else { |
|
9608 | + $query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)"; |
|
9609 | + } |
|
9262 | 9610 | } |
9263 | 9611 | $query_values = array(); |
9264 | 9612 | if ($year != '') { |
@@ -9289,7 +9637,9 @@ discard block |
||
9289 | 9637 | } |
9290 | 9638 | } |
9291 | 9639 | $query .= " GROUP BY spotter_output.ident, spotter_output.airline_name, spotter_output.airline_icao ORDER BY callsign_icao_count DESC"; |
9292 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
9640 | + if ($limit) { |
|
9641 | + $query .= " LIMIT 10 OFFSET 0"; |
|
9642 | + } |
|
9293 | 9643 | |
9294 | 9644 | $sth = $this->db->prepare($query); |
9295 | 9645 | $sth->execute($query_values); |
@@ -9323,15 +9673,23 @@ discard block |
||
9323 | 9673 | $query = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.ident, COUNT(spotter_output.ident) AS callsign_icao_count, spotter_output.airline_name |
9324 | 9674 | FROM spotter_output".$filter_query." spotter_output.ident <> '' AND spotter_output.airline_icao <> '' "; |
9325 | 9675 | if ($olderthanmonths > 0) { |
9326 | - if ($globalDBdriver == 'mysql') $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) '; |
|
9327 | - else $query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' "; |
|
9676 | + if ($globalDBdriver == 'mysql') { |
|
9677 | + $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) '; |
|
9678 | + } else { |
|
9679 | + $query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' "; |
|
9680 | + } |
|
9328 | 9681 | } |
9329 | 9682 | if ($sincedate != '') { |
9330 | - if ($globalDBdriver == 'mysql') $query .= "AND spotter_output.date > '".$sincedate."' "; |
|
9331 | - else $query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP) "; |
|
9683 | + if ($globalDBdriver == 'mysql') { |
|
9684 | + $query .= "AND spotter_output.date > '".$sincedate."' "; |
|
9685 | + } else { |
|
9686 | + $query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP) "; |
|
9687 | + } |
|
9332 | 9688 | } |
9333 | 9689 | $query .= "GROUP BY spotter_output.airline_icao, spotter_output.ident, spotter_output.airline_name, spotter_output.airline_icao ORDER BY callsign_icao_count DESC"; |
9334 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
9690 | + if ($limit) { |
|
9691 | + $query .= " LIMIT 10 OFFSET 0"; |
|
9692 | + } |
|
9335 | 9693 | |
9336 | 9694 | $sth = $this->db->prepare($query); |
9337 | 9695 | $sth->execute(); |
@@ -9368,7 +9726,9 @@ discard block |
||
9368 | 9726 | date_default_timezone_set($globalTimezone); |
9369 | 9727 | $datetime = new DateTime(); |
9370 | 9728 | $offset = $datetime->format('P'); |
9371 | - } else $offset = '+00:00'; |
|
9729 | + } else { |
|
9730 | + $offset = '+00:00'; |
|
9731 | + } |
|
9372 | 9732 | |
9373 | 9733 | if ($globalDBdriver == 'mysql') { |
9374 | 9734 | $query = "SELECT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count |
@@ -9417,7 +9777,9 @@ discard block |
||
9417 | 9777 | date_default_timezone_set($globalTimezone); |
9418 | 9778 | $datetime = new DateTime(); |
9419 | 9779 | $offset = $datetime->format('P'); |
9420 | - } else $offset = '+00:00'; |
|
9780 | + } else { |
|
9781 | + $offset = '+00:00'; |
|
9782 | + } |
|
9421 | 9783 | $filter_query = $this->getFilter($filters,true,true); |
9422 | 9784 | if ($globalDBdriver == 'mysql') { |
9423 | 9785 | $query = "SELECT spotter_output.airline_icao, DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count |
@@ -9466,7 +9828,9 @@ discard block |
||
9466 | 9828 | date_default_timezone_set($globalTimezone); |
9467 | 9829 | $datetime = new DateTime(); |
9468 | 9830 | $offset = $datetime->format('P'); |
9469 | - } else $offset = '+00:00'; |
|
9831 | + } else { |
|
9832 | + $offset = '+00:00'; |
|
9833 | + } |
|
9470 | 9834 | $filter_query = $this->getFilter($filters,true,true); |
9471 | 9835 | if ($globalDBdriver == 'mysql') { |
9472 | 9836 | $query = "SELECT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count |
@@ -9512,7 +9876,9 @@ discard block |
||
9512 | 9876 | date_default_timezone_set($globalTimezone); |
9513 | 9877 | $datetime = new DateTime(); |
9514 | 9878 | $offset = $datetime->format('P'); |
9515 | - } else $offset = '+00:00'; |
|
9879 | + } else { |
|
9880 | + $offset = '+00:00'; |
|
9881 | + } |
|
9516 | 9882 | $filter_query = $this->getFilter($filters,true,true); |
9517 | 9883 | if ($globalDBdriver == 'mysql') { |
9518 | 9884 | $query = "SELECT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count |
@@ -9560,7 +9926,9 @@ discard block |
||
9560 | 9926 | date_default_timezone_set($globalTimezone); |
9561 | 9927 | $datetime = new DateTime(); |
9562 | 9928 | $offset = $datetime->format('P'); |
9563 | - } else $offset = '+00:00'; |
|
9929 | + } else { |
|
9930 | + $offset = '+00:00'; |
|
9931 | + } |
|
9564 | 9932 | |
9565 | 9933 | if ($globalDBdriver == 'mysql') { |
9566 | 9934 | $query = "SELECT spotter_output.airline_icao, DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count |
@@ -9608,7 +9976,9 @@ discard block |
||
9608 | 9976 | date_default_timezone_set($globalTimezone); |
9609 | 9977 | $datetime = new DateTime(); |
9610 | 9978 | $offset = $datetime->format('P'); |
9611 | - } else $offset = '+00:00'; |
|
9979 | + } else { |
|
9980 | + $offset = '+00:00'; |
|
9981 | + } |
|
9612 | 9982 | |
9613 | 9983 | if ($globalDBdriver == 'mysql') { |
9614 | 9984 | $query = "SELECT YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(*) as date_count |
@@ -9655,7 +10025,9 @@ discard block |
||
9655 | 10025 | date_default_timezone_set($globalTimezone); |
9656 | 10026 | $datetime = new DateTime(); |
9657 | 10027 | $offset = $datetime->format('P'); |
9658 | - } else $offset = '+00:00'; |
|
10028 | + } else { |
|
10029 | + $offset = '+00:00'; |
|
10030 | + } |
|
9659 | 10031 | |
9660 | 10032 | if ($globalDBdriver == 'mysql') { |
9661 | 10033 | $query = "SELECT spotter_output.airline_icao, YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(*) as date_count |
@@ -9703,7 +10075,9 @@ discard block |
||
9703 | 10075 | date_default_timezone_set($globalTimezone); |
9704 | 10076 | $datetime = new DateTime(); |
9705 | 10077 | $offset = $datetime->format('P'); |
9706 | - } else $offset = '+00:00'; |
|
10078 | + } else { |
|
10079 | + $offset = '+00:00'; |
|
10080 | + } |
|
9707 | 10081 | $filter_query = $this->getFilter($filters,true,true); |
9708 | 10082 | if ($globalDBdriver == 'mysql') { |
9709 | 10083 | $query = "SELECT YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(*) as date_count |
@@ -9748,7 +10122,9 @@ discard block |
||
9748 | 10122 | date_default_timezone_set($globalTimezone); |
9749 | 10123 | $datetime = new DateTime(); |
9750 | 10124 | $offset = $datetime->format('P'); |
9751 | - } else $offset = '+00:00'; |
|
10125 | + } else { |
|
10126 | + $offset = '+00:00'; |
|
10127 | + } |
|
9752 | 10128 | $filter_query = $this->getFilter($filters,true,true); |
9753 | 10129 | |
9754 | 10130 | if ($globalDBdriver == 'mysql') { |
@@ -9795,7 +10171,9 @@ discard block |
||
9795 | 10171 | date_default_timezone_set($globalTimezone); |
9796 | 10172 | $datetime = new DateTime(); |
9797 | 10173 | $offset = $datetime->format('P'); |
9798 | - } else $offset = '+00:00'; |
|
10174 | + } else { |
|
10175 | + $offset = '+00:00'; |
|
10176 | + } |
|
9799 | 10177 | |
9800 | 10178 | if ($globalDBdriver == 'mysql') { |
9801 | 10179 | $query = "SELECT spotter_output.airline_icao, YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct owner_name) as date_count |
@@ -9841,7 +10219,9 @@ discard block |
||
9841 | 10219 | date_default_timezone_set($globalTimezone); |
9842 | 10220 | $datetime = new DateTime(); |
9843 | 10221 | $offset = $datetime->format('P'); |
9844 | - } else $offset = '+00:00'; |
|
10222 | + } else { |
|
10223 | + $offset = '+00:00'; |
|
10224 | + } |
|
9845 | 10225 | $filter_query = $this->getFilter($filters,true,true); |
9846 | 10226 | |
9847 | 10227 | if ($globalDBdriver == 'mysql') { |
@@ -9888,7 +10268,9 @@ discard block |
||
9888 | 10268 | date_default_timezone_set($globalTimezone); |
9889 | 10269 | $datetime = new DateTime(); |
9890 | 10270 | $offset = $datetime->format('P'); |
9891 | - } else $offset = '+00:00'; |
|
10271 | + } else { |
|
10272 | + $offset = '+00:00'; |
|
10273 | + } |
|
9892 | 10274 | |
9893 | 10275 | if ($globalDBdriver == 'mysql') { |
9894 | 10276 | $query = "SELECT spotter_output.airline_icao, YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct pilot_id) as date_count |
@@ -9935,7 +10317,9 @@ discard block |
||
9935 | 10317 | date_default_timezone_set($globalTimezone); |
9936 | 10318 | $datetime = new DateTime(); |
9937 | 10319 | $offset = $datetime->format('P'); |
9938 | - } else $offset = '+00:00'; |
|
10320 | + } else { |
|
10321 | + $offset = '+00:00'; |
|
10322 | + } |
|
9939 | 10323 | |
9940 | 10324 | if ($globalDBdriver == 'mysql') { |
9941 | 10325 | $query = "SELECT YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct airline_icao) as date_count |
@@ -9980,7 +10364,9 @@ discard block |
||
9980 | 10364 | date_default_timezone_set($globalTimezone); |
9981 | 10365 | $datetime = new DateTime(); |
9982 | 10366 | $offset = $datetime->format('P'); |
9983 | - } else $offset = '+00:00'; |
|
10367 | + } else { |
|
10368 | + $offset = '+00:00'; |
|
10369 | + } |
|
9984 | 10370 | $filter_query = $this->getFilter($filters,true,true); |
9985 | 10371 | |
9986 | 10372 | if ($globalDBdriver == 'mysql') { |
@@ -10028,7 +10414,9 @@ discard block |
||
10028 | 10414 | date_default_timezone_set($globalTimezone); |
10029 | 10415 | $datetime = new DateTime(); |
10030 | 10416 | $offset = $datetime->format('P'); |
10031 | - } else $offset = '+00:00'; |
|
10417 | + } else { |
|
10418 | + $offset = '+00:00'; |
|
10419 | + } |
|
10032 | 10420 | |
10033 | 10421 | if ($globalDBdriver == 'mysql') { |
10034 | 10422 | $query = "SELECT spotter_output.airline_icao,YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct aircraft_icao) as date_count |
@@ -10074,7 +10462,9 @@ discard block |
||
10074 | 10462 | date_default_timezone_set($globalTimezone); |
10075 | 10463 | $datetime = new DateTime(); |
10076 | 10464 | $offset = $datetime->format('P'); |
10077 | - } else $offset = '+00:00'; |
|
10465 | + } else { |
|
10466 | + $offset = '+00:00'; |
|
10467 | + } |
|
10078 | 10468 | $filter_query = $this->getFilter($filters,true,true); |
10079 | 10469 | |
10080 | 10470 | if ($globalDBdriver == 'mysql') { |
@@ -10122,7 +10512,9 @@ discard block |
||
10122 | 10512 | date_default_timezone_set($globalTimezone); |
10123 | 10513 | $datetime = new DateTime(); |
10124 | 10514 | $offset = $datetime->format('P'); |
10125 | - } else $offset = '+00:00'; |
|
10515 | + } else { |
|
10516 | + $offset = '+00:00'; |
|
10517 | + } |
|
10126 | 10518 | |
10127 | 10519 | if ($globalDBdriver == 'mysql') { |
10128 | 10520 | $query = "SELECT spotter_output.airline_icao, YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(real_arrival_airport_icao) as date_count |
@@ -10169,7 +10561,9 @@ discard block |
||
10169 | 10561 | date_default_timezone_set($globalTimezone); |
10170 | 10562 | $datetime = new DateTime(); |
10171 | 10563 | $offset = $datetime->format('P'); |
10172 | - } else $offset = '+00:00'; |
|
10564 | + } else { |
|
10565 | + $offset = '+00:00'; |
|
10566 | + } |
|
10173 | 10567 | $filter_query = $this->getFilter($filters,true,true); |
10174 | 10568 | if ($globalDBdriver == 'mysql') { |
10175 | 10569 | $query = "SELECT MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name, count(*) as date_count |
@@ -10218,7 +10612,9 @@ discard block |
||
10218 | 10612 | date_default_timezone_set($globalTimezone); |
10219 | 10613 | $datetime = new DateTime(); |
10220 | 10614 | $offset = $datetime->format('P'); |
10221 | - } else $offset = '+00:00'; |
|
10615 | + } else { |
|
10616 | + $offset = '+00:00'; |
|
10617 | + } |
|
10222 | 10618 | |
10223 | 10619 | $orderby_sql = ''; |
10224 | 10620 | if ($orderby == "hour") |
@@ -10284,7 +10680,9 @@ discard block |
||
10284 | 10680 | date_default_timezone_set($globalTimezone); |
10285 | 10681 | $datetime = new DateTime(); |
10286 | 10682 | $offset = $datetime->format('P'); |
10287 | - } else $offset = '+00:00'; |
|
10683 | + } else { |
|
10684 | + $offset = '+00:00'; |
|
10685 | + } |
|
10288 | 10686 | |
10289 | 10687 | $orderby_sql = ''; |
10290 | 10688 | if ($orderby == "hour") |
@@ -10351,7 +10749,9 @@ discard block |
||
10351 | 10749 | date_default_timezone_set($globalTimezone); |
10352 | 10750 | $datetime = new DateTime(); |
10353 | 10751 | $offset = $datetime->format('P'); |
10354 | - } else $offset = '+00:00'; |
|
10752 | + } else { |
|
10753 | + $offset = '+00:00'; |
|
10754 | + } |
|
10355 | 10755 | |
10356 | 10756 | $airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING); |
10357 | 10757 | |
@@ -10402,7 +10802,9 @@ discard block |
||
10402 | 10802 | date_default_timezone_set($globalTimezone); |
10403 | 10803 | $datetime = new DateTime(); |
10404 | 10804 | $offset = $datetime->format('P'); |
10405 | - } else $offset = '+00:00'; |
|
10805 | + } else { |
|
10806 | + $offset = '+00:00'; |
|
10807 | + } |
|
10406 | 10808 | |
10407 | 10809 | if ($globalDBdriver == 'mysql') { |
10408 | 10810 | $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
@@ -10449,7 +10851,9 @@ discard block |
||
10449 | 10851 | date_default_timezone_set($globalTimezone); |
10450 | 10852 | $datetime = new DateTime(); |
10451 | 10853 | $offset = $datetime->format('P'); |
10452 | - } else $offset = '+00:00'; |
|
10854 | + } else { |
|
10855 | + $offset = '+00:00'; |
|
10856 | + } |
|
10453 | 10857 | |
10454 | 10858 | if ($globalDBdriver == 'mysql') { |
10455 | 10859 | $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
@@ -10496,7 +10900,9 @@ discard block |
||
10496 | 10900 | date_default_timezone_set($globalTimezone); |
10497 | 10901 | $datetime = new DateTime(); |
10498 | 10902 | $offset = $datetime->format('P'); |
10499 | - } else $offset = '+00:00'; |
|
10903 | + } else { |
|
10904 | + $offset = '+00:00'; |
|
10905 | + } |
|
10500 | 10906 | |
10501 | 10907 | if ($globalDBdriver == 'mysql') { |
10502 | 10908 | $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
@@ -10544,7 +10950,9 @@ discard block |
||
10544 | 10950 | date_default_timezone_set($globalTimezone); |
10545 | 10951 | $datetime = new DateTime(); |
10546 | 10952 | $offset = $datetime->format('P'); |
10547 | - } else $offset = '+00:00'; |
|
10953 | + } else { |
|
10954 | + $offset = '+00:00'; |
|
10955 | + } |
|
10548 | 10956 | |
10549 | 10957 | if ($globalDBdriver == 'mysql') { |
10550 | 10958 | $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
@@ -10592,7 +11000,9 @@ discard block |
||
10592 | 11000 | date_default_timezone_set($globalTimezone); |
10593 | 11001 | $datetime = new DateTime($date); |
10594 | 11002 | $offset = $datetime->format('P'); |
10595 | - } else $offset = '+00:00'; |
|
11003 | + } else { |
|
11004 | + $offset = '+00:00'; |
|
11005 | + } |
|
10596 | 11006 | |
10597 | 11007 | if ($globalDBdriver == 'mysql') { |
10598 | 11008 | $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
@@ -10640,7 +11050,9 @@ discard block |
||
10640 | 11050 | date_default_timezone_set($globalTimezone); |
10641 | 11051 | $datetime = new DateTime(); |
10642 | 11052 | $offset = $datetime->format('P'); |
10643 | - } else $offset = '+00:00'; |
|
11053 | + } else { |
|
11054 | + $offset = '+00:00'; |
|
11055 | + } |
|
10644 | 11056 | |
10645 | 11057 | if ($globalDBdriver == 'mysql') { |
10646 | 11058 | $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
@@ -10687,7 +11099,9 @@ discard block |
||
10687 | 11099 | date_default_timezone_set($globalTimezone); |
10688 | 11100 | $datetime = new DateTime(); |
10689 | 11101 | $offset = $datetime->format('P'); |
10690 | - } else $offset = '+00:00'; |
|
11102 | + } else { |
|
11103 | + $offset = '+00:00'; |
|
11104 | + } |
|
10691 | 11105 | |
10692 | 11106 | if ($globalDBdriver == 'mysql') { |
10693 | 11107 | $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
@@ -10734,7 +11148,9 @@ discard block |
||
10734 | 11148 | date_default_timezone_set($globalTimezone); |
10735 | 11149 | $datetime = new DateTime(); |
10736 | 11150 | $offset = $datetime->format('P'); |
10737 | - } else $offset = '+00:00'; |
|
11151 | + } else { |
|
11152 | + $offset = '+00:00'; |
|
11153 | + } |
|
10738 | 11154 | |
10739 | 11155 | if ($globalDBdriver == 'mysql') { |
10740 | 11156 | $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
@@ -10784,7 +11200,9 @@ discard block |
||
10784 | 11200 | date_default_timezone_set($globalTimezone); |
10785 | 11201 | $datetime = new DateTime(); |
10786 | 11202 | $offset = $datetime->format('P'); |
10787 | - } else $offset = '+00:00'; |
|
11203 | + } else { |
|
11204 | + $offset = '+00:00'; |
|
11205 | + } |
|
10788 | 11206 | |
10789 | 11207 | if ($globalDBdriver == 'mysql') { |
10790 | 11208 | $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
@@ -10831,7 +11249,9 @@ discard block |
||
10831 | 11249 | date_default_timezone_set($globalTimezone); |
10832 | 11250 | $datetime = new DateTime(); |
10833 | 11251 | $offset = $datetime->format('P'); |
10834 | - } else $offset = '+00:00'; |
|
11252 | + } else { |
|
11253 | + $offset = '+00:00'; |
|
11254 | + } |
|
10835 | 11255 | |
10836 | 11256 | if ($globalDBdriver == 'mysql') { |
10837 | 11257 | $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
@@ -11042,8 +11462,11 @@ discard block |
||
11042 | 11462 | $query_values = array_merge($query_values,array(':month' => $month)); |
11043 | 11463 | } |
11044 | 11464 | } |
11045 | - if (empty($query_values)) $queryi .= $this->getFilter($filters); |
|
11046 | - else $queryi .= $this->getFilter($filters,true,true).substr($query,4); |
|
11465 | + if (empty($query_values)) { |
|
11466 | + $queryi .= $this->getFilter($filters); |
|
11467 | + } else { |
|
11468 | + $queryi .= $this->getFilter($filters,true,true).substr($query,4); |
|
11469 | + } |
|
11047 | 11470 | |
11048 | 11471 | $sth = $this->db->prepare($queryi); |
11049 | 11472 | $sth->execute($query_values); |
@@ -11121,8 +11544,11 @@ discard block |
||
11121 | 11544 | $query_values = array_merge($query_values,array(':month' => $month)); |
11122 | 11545 | } |
11123 | 11546 | } |
11124 | - if ($query == '') $queryi .= $this->getFilter($filters); |
|
11125 | - else $queryi .= $this->getFilter($filters,true,true).substr($query,4); |
|
11547 | + if ($query == '') { |
|
11548 | + $queryi .= $this->getFilter($filters); |
|
11549 | + } else { |
|
11550 | + $queryi .= $this->getFilter($filters,true,true).substr($query,4); |
|
11551 | + } |
|
11126 | 11552 | |
11127 | 11553 | |
11128 | 11554 | $sth = $this->db->prepare($queryi); |
@@ -11145,7 +11571,9 @@ discard block |
||
11145 | 11571 | date_default_timezone_set($globalTimezone); |
11146 | 11572 | $datetime = new DateTime(); |
11147 | 11573 | $offset = $datetime->format('P'); |
11148 | - } else $offset = '+00:00'; |
|
11574 | + } else { |
|
11575 | + $offset = '+00:00'; |
|
11576 | + } |
|
11149 | 11577 | |
11150 | 11578 | if ($globalDBdriver == 'mysql') { |
11151 | 11579 | $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
@@ -11331,7 +11759,9 @@ discard block |
||
11331 | 11759 | */ |
11332 | 11760 | public function parseDirection($direction = 0) |
11333 | 11761 | { |
11334 | - if ($direction == '') $direction = 0; |
|
11762 | + if ($direction == '') { |
|
11763 | + $direction = 0; |
|
11764 | + } |
|
11335 | 11765 | $direction_array = array(); |
11336 | 11766 | $temp_array = array(); |
11337 | 11767 | |
@@ -11432,7 +11862,9 @@ discard block |
||
11432 | 11862 | if (isset($result->AirlineFlightInfoResult)) |
11433 | 11863 | { |
11434 | 11864 | $registration = $result->AirlineFlightInfoResult->tailnumber; |
11435 | - } else return ''; |
|
11865 | + } else { |
|
11866 | + return ''; |
|
11867 | + } |
|
11436 | 11868 | |
11437 | 11869 | $registration = $this->convertAircraftRegistration($registration); |
11438 | 11870 | |
@@ -11466,7 +11898,9 @@ discard block |
||
11466 | 11898 | return $row['registration']; |
11467 | 11899 | } elseif ($source_type == 'flarm') { |
11468 | 11900 | return $this->getAircraftRegistrationBymodeS($aircraft_modes); |
11469 | - } else return ''; |
|
11901 | + } else { |
|
11902 | + return ''; |
|
11903 | + } |
|
11470 | 11904 | |
11471 | 11905 | } |
11472 | 11906 | |
@@ -11493,11 +11927,16 @@ discard block |
||
11493 | 11927 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
11494 | 11928 | $sth->closeCursor(); |
11495 | 11929 | if (count($row) > 0) { |
11496 | - if ($row['type_flight'] == null) return ''; |
|
11497 | - else return $row['type_flight']; |
|
11930 | + if ($row['type_flight'] == null) { |
|
11931 | + return ''; |
|
11932 | + } else { |
|
11933 | + return $row['type_flight']; |
|
11934 | + } |
|
11498 | 11935 | } elseif ($source_type == 'flarm') { |
11499 | 11936 | return $this->getAircraftTypeBymodeS($aircraft_modes); |
11500 | - } else return ''; |
|
11937 | + } else { |
|
11938 | + return ''; |
|
11939 | + } |
|
11501 | 11940 | |
11502 | 11941 | } |
11503 | 11942 | |
@@ -11515,7 +11954,9 @@ discard block |
||
11515 | 11954 | $longitude = filter_var($longitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
11516 | 11955 | |
11517 | 11956 | $Connection = new Connection($this->db); |
11518 | - if (!$Connection->tableExists('countries')) return ''; |
|
11957 | + if (!$Connection->tableExists('countries')) { |
|
11958 | + return ''; |
|
11959 | + } |
|
11519 | 11960 | |
11520 | 11961 | try { |
11521 | 11962 | /* |
@@ -11535,9 +11976,13 @@ discard block |
||
11535 | 11976 | $sth->closeCursor(); |
11536 | 11977 | if (count($row) > 0) { |
11537 | 11978 | return $row; |
11538 | - } else return ''; |
|
11979 | + } else { |
|
11980 | + return ''; |
|
11981 | + } |
|
11539 | 11982 | } catch (PDOException $e) { |
11540 | - if (isset($globalDebug) && $globalDebug) echo 'Error : '.$e->getMessage()."\n"; |
|
11983 | + if (isset($globalDebug) && $globalDebug) { |
|
11984 | + echo 'Error : '.$e->getMessage()."\n"; |
|
11985 | + } |
|
11541 | 11986 | return ''; |
11542 | 11987 | } |
11543 | 11988 | |
@@ -11555,7 +12000,9 @@ discard block |
||
11555 | 12000 | $iso2 = filter_var($iso2,FILTER_SANITIZE_STRING); |
11556 | 12001 | |
11557 | 12002 | $Connection = new Connection($this->db); |
11558 | - if (!$Connection->tableExists('countries')) return ''; |
|
12003 | + if (!$Connection->tableExists('countries')) { |
|
12004 | + return ''; |
|
12005 | + } |
|
11559 | 12006 | |
11560 | 12007 | try { |
11561 | 12008 | $query = "SELECT name,iso2,iso3 FROM countries WHERE iso2 = :iso2 LIMIT 1"; |
@@ -11567,9 +12014,13 @@ discard block |
||
11567 | 12014 | $sth->closeCursor(); |
11568 | 12015 | if (count($row) > 0) { |
11569 | 12016 | return $row; |
11570 | - } else return ''; |
|
12017 | + } else { |
|
12018 | + return ''; |
|
12019 | + } |
|
11571 | 12020 | } catch (PDOException $e) { |
11572 | - if (isset($globalDebug) && $globalDebug) echo 'Error : '.$e->getMessage()."\n"; |
|
12021 | + if (isset($globalDebug) && $globalDebug) { |
|
12022 | + echo 'Error : '.$e->getMessage()."\n"; |
|
12023 | + } |
|
11573 | 12024 | return ''; |
11574 | 12025 | } |
11575 | 12026 | |
@@ -11819,7 +12270,9 @@ discard block |
||
11819 | 12270 | { |
11820 | 12271 | global $globalBitlyAccessToken; |
11821 | 12272 | |
11822 | - if ($globalBitlyAccessToken == '') return $url; |
|
12273 | + if ($globalBitlyAccessToken == '') { |
|
12274 | + return $url; |
|
12275 | + } |
|
11823 | 12276 | |
11824 | 12277 | $google_url = 'https://api-ssl.bitly.com/v3/shorten?access_token='.$globalBitlyAccessToken.'&longUrl='.$url; |
11825 | 12278 | |
@@ -11968,7 +12421,9 @@ discard block |
||
11968 | 12421 | |
11969 | 12422 | |
11970 | 12423 | // routes |
11971 | - if ($globalDebug) print "Routes...\n"; |
|
12424 | + if ($globalDebug) { |
|
12425 | + print "Routes...\n"; |
|
12426 | + } |
|
11972 | 12427 | if ($globalDBdriver == 'mysql') { |
11973 | 12428 | $query = "SELECT spotter_output.spotter_id, routes.FromAirport_ICAO, routes.ToAirport_ICAO FROM spotter_output, routes WHERE spotter_output.ident = routes.CallSign AND ( spotter_output.departure_airport_icao != routes.FromAirport_ICAO OR spotter_output.arrival_airport_icao != routes.ToAirport_ICAO) AND routes.FromAirport_ICAO != '' AND spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 15 DAY)"; |
11974 | 12429 | } else { |
@@ -11987,7 +12442,9 @@ discard block |
||
11987 | 12442 | } |
11988 | 12443 | } |
11989 | 12444 | |
11990 | - if ($globalDebug) print "Airlines...\n"; |
|
12445 | + if ($globalDebug) { |
|
12446 | + print "Airlines...\n"; |
|
12447 | + } |
|
11991 | 12448 | //airlines |
11992 | 12449 | if ($globalDBdriver == 'mysql') { |
11993 | 12450 | $query = "SELECT spotter_output.spotter_id, spotter_output.ident FROM spotter_output WHERE (spotter_output.airline_name = '' OR spotter_output.airline_name = 'Not Available') AND spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 15 DAY)"; |
@@ -12001,10 +12458,15 @@ discard block |
||
12001 | 12458 | if (is_numeric(substr($row['ident'], -1, 1))) |
12002 | 12459 | { |
12003 | 12460 | $fromsource = NULL; |
12004 | - if (isset($row['format_source']) && $row['format_source'] == 'vatsimtxt') $fromsource = 'vatsim'; |
|
12005 | - elseif (isset($row['format_source']) && $row['format_source'] == 'whazzup') $fromsource = 'ivao'; |
|
12006 | - elseif (isset($globalVATSIM) && $globalVATSIM) $fromsource = 'vatsim'; |
|
12007 | - elseif (isset($globalIVAO) && $globalIVAO) $fromsource = 'ivao'; |
|
12461 | + if (isset($row['format_source']) && $row['format_source'] == 'vatsimtxt') { |
|
12462 | + $fromsource = 'vatsim'; |
|
12463 | + } elseif (isset($row['format_source']) && $row['format_source'] == 'whazzup') { |
|
12464 | + $fromsource = 'ivao'; |
|
12465 | + } elseif (isset($globalVATSIM) && $globalVATSIM) { |
|
12466 | + $fromsource = 'vatsim'; |
|
12467 | + } elseif (isset($globalIVAO) && $globalIVAO) { |
|
12468 | + $fromsource = 'ivao'; |
|
12469 | + } |
|
12008 | 12470 | $airline_array = $this->getAllAirlineInfo(substr($row['ident'], 0, 3),$fromsource); |
12009 | 12471 | if (isset($airline_array[0]['name'])) { |
12010 | 12472 | $update_query = "UPDATE spotter_output SET spotter_output.airline_name = :airline_name, spotter_output.airline_icao = :airline_icao, spotter_output.airline_country = :airline_country, spotter_output.airline_type = :airline_type WHERE spotter_output.spotter_id = :spotter_id"; |
@@ -12014,13 +12476,17 @@ discard block |
||
12014 | 12476 | } |
12015 | 12477 | } |
12016 | 12478 | |
12017 | - if ($globalDebug) print "Remove Duplicate in aircraft_modes...\n"; |
|
12479 | + if ($globalDebug) { |
|
12480 | + print "Remove Duplicate in aircraft_modes...\n"; |
|
12481 | + } |
|
12018 | 12482 | //duplicate modes |
12019 | 12483 | $query = "DELETE aircraft_modes FROM aircraft_modes LEFT OUTER JOIN (SELECT max(`AircraftID`) as `AircraftID`,`ModeS` FROM `aircraft_modes` group by ModeS) as KeepRows ON aircraft_modes.AircraftID = KeepRows.AircraftID WHERE KeepRows.AircraftID IS NULL"; |
12020 | 12484 | $sth = $this->db->prepare($query); |
12021 | 12485 | $sth->execute(); |
12022 | 12486 | |
12023 | - if ($globalDebug) print "Aircraft...\n"; |
|
12487 | + if ($globalDebug) { |
|
12488 | + print "Aircraft...\n"; |
|
12489 | + } |
|
12024 | 12490 | //aircraft |
12025 | 12491 | if ($globalDBdriver == 'mysql') { |
12026 | 12492 | $query = "SELECT spotter_output.spotter_id, spotter_output.aircraft_icao, spotter_output.registration FROM spotter_output WHERE (spotter_output.aircraft_name = '' OR spotter_output.aircraft_name = 'Not Available') AND spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 7 DAY)"; |
@@ -12063,26 +12529,38 @@ discard block |
||
12063 | 12529 | if (isset($closestAirports[0])) { |
12064 | 12530 | if ($row['arrival_airport_icao'] == $closestAirports[0]['icao']) { |
12065 | 12531 | $airport_icao = $closestAirports[0]['icao']; |
12066 | - if ($globalDebug) echo "\o/ 1st ---++ Find arrival airport. airport_icao : ".$airport_icao."\n"; |
|
12532 | + if ($globalDebug) { |
|
12533 | + echo "\o/ 1st ---++ Find arrival airport. airport_icao : ".$airport_icao."\n"; |
|
12534 | + } |
|
12067 | 12535 | } elseif (count($closestAirports > 1) && $row['arrival_airport_icao'] != '' && $row['arrival_airport_icao'] != 'NA') { |
12068 | 12536 | foreach ($closestAirports as $airport) { |
12069 | 12537 | if ($row['arrival_airport_icao'] == $airport['icao']) { |
12070 | 12538 | $airport_icao = $airport['icao']; |
12071 | - if ($globalDebug) echo "\o/ try --++ Find arrival airport. airport_icao : ".$airport_icao."\n"; |
|
12539 | + if ($globalDebug) { |
|
12540 | + echo "\o/ try --++ Find arrival airport. airport_icao : ".$airport_icao."\n"; |
|
12541 | + } |
|
12072 | 12542 | break; |
12073 | 12543 | } |
12074 | 12544 | } |
12075 | 12545 | } elseif ($row['last_altitude'] == 0 || ($row['last_altitude'] != '' && ($closestAirports[0]['altitude'] <= $row['last_altitude']*100+1000 && $row['last_altitude']*100 < $closestAirports[0]['altitude']+5000))) { |
12076 | 12546 | $airport_icao = $closestAirports[0]['icao']; |
12077 | - if ($globalDebug) echo "\o/ NP --++ Find arrival airport. Airport ICAO : ".$airport_icao." ! Latitude : ".$row['last_latitude'].' - Longitude : '.$row['last_longitude'].' - MinDist : '.$globalClosestMinDist." - Airport altitude : ".$closestAirports[0]['altitude'].' - flight altitude : '.($row['last_altitude']*100)."\n"; |
|
12547 | + if ($globalDebug) { |
|
12548 | + echo "\o/ NP --++ Find arrival airport. Airport ICAO : ".$airport_icao." ! Latitude : ".$row['last_latitude'].' - Longitude : '.$row['last_longitude'].' - MinDist : '.$globalClosestMinDist." - Airport altitude : ".$closestAirports[0]['altitude'].' - flight altitude : '.($row['last_altitude']*100)."\n"; |
|
12549 | + } |
|
12078 | 12550 | } else { |
12079 | - if ($globalDebug) echo "----- Can't find arrival airport. Latitude : ".$row['last_latitude'].' - Longitude : '.$row['last_longitude'].' - MinDist : '.$globalClosestMinDist." - Airport altitude : ".$closestAirports[0]['altitude'].' - flight altitude : '.($row['last_altitude']*100)."\n"; |
|
12551 | + if ($globalDebug) { |
|
12552 | + echo "----- Can't find arrival airport. Latitude : ".$row['last_latitude'].' - Longitude : '.$row['last_longitude'].' - MinDist : '.$globalClosestMinDist." - Airport altitude : ".$closestAirports[0]['altitude'].' - flight altitude : '.($row['last_altitude']*100)."\n"; |
|
12553 | + } |
|
12080 | 12554 | } |
12081 | 12555 | } else { |
12082 | - if ($globalDebug) echo "----- No Airport near last coord. Latitude : ".$row['last_latitude'].' - Longitude : '.$row['last_longitude'].' - MinDist : '.$globalClosestMinDist."\n"; |
|
12556 | + if ($globalDebug) { |
|
12557 | + echo "----- No Airport near last coord. Latitude : ".$row['last_latitude'].' - Longitude : '.$row['last_longitude'].' - MinDist : '.$globalClosestMinDist."\n"; |
|
12558 | + } |
|
12083 | 12559 | } |
12084 | 12560 | if ($row['real_arrival_airport_icao'] != $airport_icao) { |
12085 | - if ($globalDebug) echo "Updating airport to ".$airport_icao."...\n"; |
|
12561 | + if ($globalDebug) { |
|
12562 | + echo "Updating airport to ".$airport_icao."...\n"; |
|
12563 | + } |
|
12086 | 12564 | $update_query="UPDATE spotter_output SET real_arrival_airport_icao = :airport_icao WHERE spotter_id = :spotter_id"; |
12087 | 12565 | $sthu = $this->db->prepare($update_query); |
12088 | 12566 | $sthu->execute(array(':airport_icao' => $airport_icao,':spotter_id' => $row['spotter_id'])); |
@@ -31,7 +31,9 @@ discard block |
||
31 | 31 | if (isset($filter[0]['source'])) { |
32 | 32 | $filters = array_merge($filters,$filter); |
33 | 33 | } |
34 | - if (is_array($globalFilter)) $filter = array_merge($filter,$globalFilter); |
|
34 | + if (is_array($globalFilter)) { |
|
35 | + $filter = array_merge($filter,$globalFilter); |
|
36 | + } |
|
35 | 37 | $filter_query_join = ''; |
36 | 38 | $filter_query_where = ''; |
37 | 39 | foreach($filters as $flt) { |
@@ -70,8 +72,11 @@ discard block |
||
70 | 72 | $filter_query_where .= " AND EXTRACT(DAY FROM tracker_output.date) = '".$filter['day']."'"; |
71 | 73 | } |
72 | 74 | } |
73 | - if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE'; |
|
74 | - elseif ($filter_query_where != '' && $and) $filter_query_where .= ' AND'; |
|
75 | + if ($filter_query_where == '' && $where) { |
|
76 | + $filter_query_where = ' WHERE'; |
|
77 | + } elseif ($filter_query_where != '' && $and) { |
|
78 | + $filter_query_where .= ' AND'; |
|
79 | + } |
|
75 | 80 | if ($filter_query_where != '') { |
76 | 81 | $filter_query_where = preg_replace('/^ AND/',' WHERE',$filter_query_where); |
77 | 82 | } |
@@ -125,26 +130,43 @@ discard block |
||
125 | 130 | $temp_array['spotter_id'] = $row['spotter_archive_id']; |
126 | 131 | } elseif (isset($row['spotter_archive_output_id'])) { |
127 | 132 | $temp_array['spotter_id'] = $row['spotter_archive_output_id']; |
128 | - */} |
|
129 | - elseif (isset($row['trackerid'])) { |
|
133 | + */} elseif (isset($row['trackerid'])) { |
|
130 | 134 | $temp_array['trackerid'] = $row['trackerid']; |
131 | 135 | } else { |
132 | 136 | $temp_array['trackerid'] = ''; |
133 | 137 | } |
134 | - if (isset($row['famtrackid'])) $temp_array['famtrackid'] = $row['famtrackid']; |
|
135 | - if (isset($row['type'])) $temp_array['type'] = $row['type']; |
|
136 | - if (isset($row['comment'])) $temp_array['comment'] = $row['comment']; |
|
138 | + if (isset($row['famtrackid'])) { |
|
139 | + $temp_array['famtrackid'] = $row['famtrackid']; |
|
140 | + } |
|
141 | + if (isset($row['type'])) { |
|
142 | + $temp_array['type'] = $row['type']; |
|
143 | + } |
|
144 | + if (isset($row['comment'])) { |
|
145 | + $temp_array['comment'] = $row['comment']; |
|
146 | + } |
|
137 | 147 | $temp_array['ident'] = $row['ident']; |
138 | - if (isset($row['latitude'])) $temp_array['latitude'] = $row['latitude']; |
|
139 | - if (isset($row['longitude'])) $temp_array['longitude'] = $row['longitude']; |
|
140 | - if (isset($row['format_source'])) $temp_array['format_source'] = $row['format_source']; |
|
141 | - if (isset($row['altitude'])) $temp_array['altitude'] = $row['altitude']; |
|
148 | + if (isset($row['latitude'])) { |
|
149 | + $temp_array['latitude'] = $row['latitude']; |
|
150 | + } |
|
151 | + if (isset($row['longitude'])) { |
|
152 | + $temp_array['longitude'] = $row['longitude']; |
|
153 | + } |
|
154 | + if (isset($row['format_source'])) { |
|
155 | + $temp_array['format_source'] = $row['format_source']; |
|
156 | + } |
|
157 | + if (isset($row['altitude'])) { |
|
158 | + $temp_array['altitude'] = $row['altitude']; |
|
159 | + } |
|
142 | 160 | if (isset($row['heading'])) { |
143 | 161 | $temp_array['heading'] = $row['heading']; |
144 | 162 | $heading_direction = $this->parseDirection($row['heading']); |
145 | - if (isset($heading_direction[0]['direction_fullname'])) $temp_array['heading_name'] = $heading_direction[0]['direction_fullname']; |
|
163 | + if (isset($heading_direction[0]['direction_fullname'])) { |
|
164 | + $temp_array['heading_name'] = $heading_direction[0]['direction_fullname']; |
|
165 | + } |
|
166 | + } |
|
167 | + if (isset($row['ground_speed'])) { |
|
168 | + $temp_array['ground_speed'] = $row['ground_speed']; |
|
146 | 169 | } |
147 | - if (isset($row['ground_speed'])) $temp_array['ground_speed'] = $row['ground_speed']; |
|
148 | 170 | |
149 | 171 | if (isset($row['date'])) { |
150 | 172 | $dateArray = $this->parseDateString($row['date']); |
@@ -187,13 +209,21 @@ discard block |
||
187 | 209 | } |
188 | 210 | |
189 | 211 | $fromsource = NULL; |
190 | - if (isset($row['source_name']) && $row['source_name'] != '') $temp_array['source_name'] = $row['source_name']; |
|
191 | - if (isset($row['over_country']) && $row['over_country'] != '') $temp_array['over_country'] = $row['over_country']; |
|
192 | - if (isset($row['distance']) && $row['distance'] != '') $temp_array['distance'] = $row['distance']; |
|
212 | + if (isset($row['source_name']) && $row['source_name'] != '') { |
|
213 | + $temp_array['source_name'] = $row['source_name']; |
|
214 | + } |
|
215 | + if (isset($row['over_country']) && $row['over_country'] != '') { |
|
216 | + $temp_array['over_country'] = $row['over_country']; |
|
217 | + } |
|
218 | + if (isset($row['distance']) && $row['distance'] != '') { |
|
219 | + $temp_array['distance'] = $row['distance']; |
|
220 | + } |
|
193 | 221 | $temp_array['query_number_rows'] = $num_rows; |
194 | 222 | $spotter_array[] = $temp_array; |
195 | 223 | } |
196 | - if ($num_rows == 0) return array(); |
|
224 | + if ($num_rows == 0) { |
|
225 | + return array(); |
|
226 | + } |
|
197 | 227 | $spotter_array[0]['query_number_rows'] = $num_rows; |
198 | 228 | return $spotter_array; |
199 | 229 | } |
@@ -224,8 +254,12 @@ discard block |
||
224 | 254 | { |
225 | 255 | //$limit_query = " LIMIT ".$limit_array[0].",".$limit_array[1]; |
226 | 256 | $limit_query = " LIMIT ".$limit_array[1]." OFFSET ".$limit_array[0]; |
227 | - } else $limit_query = ""; |
|
228 | - } else $limit_query = ""; |
|
257 | + } else { |
|
258 | + $limit_query = ""; |
|
259 | + } |
|
260 | + } else { |
|
261 | + $limit_query = ""; |
|
262 | + } |
|
229 | 263 | |
230 | 264 | if ($sort != "") |
231 | 265 | { |
@@ -253,7 +287,9 @@ discard block |
||
253 | 287 | global $global_query; |
254 | 288 | |
255 | 289 | date_default_timezone_set('UTC'); |
256 | - if ($id == '') return array(); |
|
290 | + if ($id == '') { |
|
291 | + return array(); |
|
292 | + } |
|
257 | 293 | $additional_query = "tracker_output.famtrackid = :id"; |
258 | 294 | $query_values = array(':id' => $id); |
259 | 295 | $query = $global_query." WHERE ".$additional_query." "; |
@@ -396,8 +432,11 @@ discard block |
||
396 | 432 | $query .= " ORDER BY tracker_output.source_name ASC"; |
397 | 433 | |
398 | 434 | $sth = $this->db->prepare($query); |
399 | - if (!empty($query_values)) $sth->execute($query_values); |
|
400 | - else $sth->execute(); |
|
435 | + if (!empty($query_values)) { |
|
436 | + $sth->execute($query_values); |
|
437 | + } else { |
|
438 | + $sth->execute(); |
|
439 | + } |
|
401 | 440 | |
402 | 441 | $source_array = array(); |
403 | 442 | $temp_array = array(); |
@@ -452,7 +491,9 @@ discard block |
||
452 | 491 | date_default_timezone_set($globalTimezone); |
453 | 492 | $datetime = new DateTime(); |
454 | 493 | $offset = $datetime->format('P'); |
455 | - } else $offset = '+00:00'; |
|
494 | + } else { |
|
495 | + $offset = '+00:00'; |
|
496 | + } |
|
456 | 497 | |
457 | 498 | if ($globalDBdriver == 'mysql') { |
458 | 499 | $query = "SELECT DISTINCT DATE(CONVERT_TZ(tracker_output.date,'+00:00', :offset)) as date |
@@ -608,7 +649,9 @@ discard block |
||
608 | 649 | { |
609 | 650 | return false; |
610 | 651 | } |
611 | - } else $altitude = 0; |
|
652 | + } else { |
|
653 | + $altitude = 0; |
|
654 | + } |
|
612 | 655 | |
613 | 656 | if ($heading != "") |
614 | 657 | { |
@@ -647,8 +690,12 @@ discard block |
||
647 | 690 | $latitude = 0; |
648 | 691 | $longitude = 0; |
649 | 692 | } |
650 | - if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0; |
|
651 | - if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0; |
|
693 | + if ($heading == '' || $Common->isInteger($heading) === false) { |
|
694 | + $heading = 0; |
|
695 | + } |
|
696 | + if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) { |
|
697 | + $groundspeed = 0; |
|
698 | + } |
|
652 | 699 | $query = "INSERT INTO tracker_output (famtrackid, ident, latitude, longitude, altitude, heading, ground_speed, date, format_source, source_name, comment, type) |
653 | 700 | VALUES (:famtrackid,:ident,:latitude,:longitude,:altitude,:heading,:speed,:date,:format_source, :source_name,:comment,:type)"; |
654 | 701 | |
@@ -813,12 +860,18 @@ discard block |
||
813 | 860 | $query = "SELECT DISTINCT tracker_output.ident, COUNT(tracker_output.ident) AS callsign_icao_count |
814 | 861 | FROM tracker_output".$filter_query." tracker_output.ident <> ''"; |
815 | 862 | if ($olderthanmonths > 0) { |
816 | - if ($globalDBdriver == 'mysql') $query .= ' AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH)'; |
|
817 | - else $query .= " AND tracker_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'"; |
|
863 | + if ($globalDBdriver == 'mysql') { |
|
864 | + $query .= ' AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH)'; |
|
865 | + } else { |
|
866 | + $query .= " AND tracker_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'"; |
|
867 | + } |
|
818 | 868 | } |
819 | 869 | if ($sincedate != '') { |
820 | - if ($globalDBdriver == 'mysql') $query .= " AND tracker_output.date > '".$sincedate."'"; |
|
821 | - else $query .= " AND tracker_output.date > CAST('".$sincedate."' AS TIMESTAMP)"; |
|
870 | + if ($globalDBdriver == 'mysql') { |
|
871 | + $query .= " AND tracker_output.date > '".$sincedate."'"; |
|
872 | + } else { |
|
873 | + $query .= " AND tracker_output.date > CAST('".$sincedate."' AS TIMESTAMP)"; |
|
874 | + } |
|
822 | 875 | } |
823 | 876 | $query_values = array(); |
824 | 877 | if ($year != '') { |
@@ -849,7 +902,9 @@ discard block |
||
849 | 902 | } |
850 | 903 | } |
851 | 904 | $query .= " GROUP BY tracker_output.ident ORDER BY callsign_icao_count DESC"; |
852 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
905 | + if ($limit) { |
|
906 | + $query .= " LIMIT 10 OFFSET 0"; |
|
907 | + } |
|
853 | 908 | |
854 | 909 | $sth = $this->db->prepare($query); |
855 | 910 | $sth->execute($query_values); |
@@ -884,7 +939,9 @@ discard block |
||
884 | 939 | date_default_timezone_set($globalTimezone); |
885 | 940 | $datetime = new DateTime(); |
886 | 941 | $offset = $datetime->format('P'); |
887 | - } else $offset = '+00:00'; |
|
942 | + } else { |
|
943 | + $offset = '+00:00'; |
|
944 | + } |
|
888 | 945 | |
889 | 946 | if ($globalDBdriver == 'mysql') { |
890 | 947 | $query = "SELECT DATE(CONVERT_TZ(tracker_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count |
@@ -934,7 +991,9 @@ discard block |
||
934 | 991 | date_default_timezone_set($globalTimezone); |
935 | 992 | $datetime = new DateTime(); |
936 | 993 | $offset = $datetime->format('P'); |
937 | - } else $offset = '+00:00'; |
|
994 | + } else { |
|
995 | + $offset = '+00:00'; |
|
996 | + } |
|
938 | 997 | $filter_query = $this->getFilter($filters,true,true); |
939 | 998 | if ($globalDBdriver == 'mysql') { |
940 | 999 | $query = "SELECT DATE(CONVERT_TZ(tracker_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count |
@@ -980,7 +1039,9 @@ discard block |
||
980 | 1039 | date_default_timezone_set($globalTimezone); |
981 | 1040 | $datetime = new DateTime(); |
982 | 1041 | $offset = $datetime->format('P'); |
983 | - } else $offset = '+00:00'; |
|
1042 | + } else { |
|
1043 | + $offset = '+00:00'; |
|
1044 | + } |
|
984 | 1045 | $filter_query = $this->getFilter($filters,true,true); |
985 | 1046 | if ($globalDBdriver == 'mysql') { |
986 | 1047 | $query = "SELECT DATE(CONVERT_TZ(tracker_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count |
@@ -1028,7 +1089,9 @@ discard block |
||
1028 | 1089 | date_default_timezone_set($globalTimezone); |
1029 | 1090 | $datetime = new DateTime(); |
1030 | 1091 | $offset = $datetime->format('P'); |
1031 | - } else $offset = '+00:00'; |
|
1092 | + } else { |
|
1093 | + $offset = '+00:00'; |
|
1094 | + } |
|
1032 | 1095 | |
1033 | 1096 | if ($globalDBdriver == 'mysql') { |
1034 | 1097 | $query = "SELECT YEAR(CONVERT_TZ(tracker_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(tracker_output.date,'+00:00', :offset)) AS month_name, count(*) as date_count |
@@ -1077,7 +1140,9 @@ discard block |
||
1077 | 1140 | date_default_timezone_set($globalTimezone); |
1078 | 1141 | $datetime = new DateTime(); |
1079 | 1142 | $offset = $datetime->format('P'); |
1080 | - } else $offset = '+00:00'; |
|
1143 | + } else { |
|
1144 | + $offset = '+00:00'; |
|
1145 | + } |
|
1081 | 1146 | $filter_query = $this->getFilter($filters,true,true); |
1082 | 1147 | if ($globalDBdriver == 'mysql') { |
1083 | 1148 | $query = "SELECT MONTH(CONVERT_TZ(tracker_output.date,'+00:00', :offset)) AS month_name, YEAR(CONVERT_TZ(tracker_output.date,'+00:00', :offset)) AS year_name, count(*) as date_count |
@@ -1126,7 +1191,9 @@ discard block |
||
1126 | 1191 | date_default_timezone_set($globalTimezone); |
1127 | 1192 | $datetime = new DateTime(); |
1128 | 1193 | $offset = $datetime->format('P'); |
1129 | - } else $offset = '+00:00'; |
|
1194 | + } else { |
|
1195 | + $offset = '+00:00'; |
|
1196 | + } |
|
1130 | 1197 | |
1131 | 1198 | $orderby_sql = ''; |
1132 | 1199 | if ($orderby == "hour") |
@@ -1195,7 +1262,9 @@ discard block |
||
1195 | 1262 | date_default_timezone_set($globalTimezone); |
1196 | 1263 | $datetime = new DateTime($date); |
1197 | 1264 | $offset = $datetime->format('P'); |
1198 | - } else $offset = '+00:00'; |
|
1265 | + } else { |
|
1266 | + $offset = '+00:00'; |
|
1267 | + } |
|
1199 | 1268 | |
1200 | 1269 | if ($globalDBdriver == 'mysql') { |
1201 | 1270 | $query = "SELECT HOUR(CONVERT_TZ(tracker_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
@@ -1243,7 +1312,9 @@ discard block |
||
1243 | 1312 | date_default_timezone_set($globalTimezone); |
1244 | 1313 | $datetime = new DateTime(); |
1245 | 1314 | $offset = $datetime->format('P'); |
1246 | - } else $offset = '+00:00'; |
|
1315 | + } else { |
|
1316 | + $offset = '+00:00'; |
|
1317 | + } |
|
1247 | 1318 | |
1248 | 1319 | if ($globalDBdriver == 'mysql') { |
1249 | 1320 | $query = "SELECT HOUR(CONVERT_TZ(tracker_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
@@ -1307,8 +1378,11 @@ discard block |
||
1307 | 1378 | $query_values = array_merge($query_values,array(':month' => $month)); |
1308 | 1379 | } |
1309 | 1380 | } |
1310 | - if (empty($query_values)) $queryi .= $this->getFilter($filters); |
|
1311 | - else $queryi .= $this->getFilter($filters,true,true).substr($query,4); |
|
1381 | + if (empty($query_values)) { |
|
1382 | + $queryi .= $this->getFilter($filters); |
|
1383 | + } else { |
|
1384 | + $queryi .= $this->getFilter($filters,true,true).substr($query,4); |
|
1385 | + } |
|
1312 | 1386 | |
1313 | 1387 | $sth = $this->db->prepare($queryi); |
1314 | 1388 | $sth->execute($query_values); |
@@ -1330,7 +1404,9 @@ discard block |
||
1330 | 1404 | date_default_timezone_set($globalTimezone); |
1331 | 1405 | $datetime = new DateTime(); |
1332 | 1406 | $offset = $datetime->format('P'); |
1333 | - } else $offset = '+00:00'; |
|
1407 | + } else { |
|
1408 | + $offset = '+00:00'; |
|
1409 | + } |
|
1334 | 1410 | |
1335 | 1411 | if ($globalDBdriver == 'mysql') { |
1336 | 1412 | $query = "SELECT HOUR(CONVERT_TZ(tracker_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
@@ -1434,7 +1510,9 @@ discard block |
||
1434 | 1510 | */ |
1435 | 1511 | public function parseDirection($direction = 0) |
1436 | 1512 | { |
1437 | - if ($direction == '') $direction = 0; |
|
1513 | + if ($direction == '') { |
|
1514 | + $direction = 0; |
|
1515 | + } |
|
1438 | 1516 | $direction_array = array(); |
1439 | 1517 | $temp_array = array(); |
1440 | 1518 | |
@@ -1523,7 +1601,9 @@ discard block |
||
1523 | 1601 | $longitude = filter_var($longitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
1524 | 1602 | |
1525 | 1603 | $Connection = new Connection($this->db); |
1526 | - if (!$Connection->tableExists('countries')) return ''; |
|
1604 | + if (!$Connection->tableExists('countries')) { |
|
1605 | + return ''; |
|
1606 | + } |
|
1527 | 1607 | |
1528 | 1608 | try { |
1529 | 1609 | /* |
@@ -1543,9 +1623,13 @@ discard block |
||
1543 | 1623 | $sth->closeCursor(); |
1544 | 1624 | if (count($row) > 0) { |
1545 | 1625 | return $row; |
1546 | - } else return ''; |
|
1626 | + } else { |
|
1627 | + return ''; |
|
1628 | + } |
|
1547 | 1629 | } catch (PDOException $e) { |
1548 | - if (isset($globalDebug) && $globalDebug) echo 'Error : '.$e->getMessage()."\n"; |
|
1630 | + if (isset($globalDebug) && $globalDebug) { |
|
1631 | + echo 'Error : '.$e->getMessage()."\n"; |
|
1632 | + } |
|
1549 | 1633 | return ''; |
1550 | 1634 | } |
1551 | 1635 | |
@@ -1563,7 +1647,9 @@ discard block |
||
1563 | 1647 | $iso2 = filter_var($iso2,FILTER_SANITIZE_STRING); |
1564 | 1648 | |
1565 | 1649 | $Connection = new Connection($this->db); |
1566 | - if (!$Connection->tableExists('countries')) return ''; |
|
1650 | + if (!$Connection->tableExists('countries')) { |
|
1651 | + return ''; |
|
1652 | + } |
|
1567 | 1653 | |
1568 | 1654 | try { |
1569 | 1655 | $query = "SELECT name,iso2,iso3 FROM countries WHERE iso2 = :iso2 LIMIT 1"; |
@@ -1575,9 +1661,13 @@ discard block |
||
1575 | 1661 | $sth->closeCursor(); |
1576 | 1662 | if (count($row) > 0) { |
1577 | 1663 | return $row; |
1578 | - } else return ''; |
|
1664 | + } else { |
|
1665 | + return ''; |
|
1666 | + } |
|
1579 | 1667 | } catch (PDOException $e) { |
1580 | - if (isset($globalDebug) && $globalDebug) echo 'Error : '.$e->getMessage()."\n"; |
|
1668 | + if (isset($globalDebug) && $globalDebug) { |
|
1669 | + echo 'Error : '.$e->getMessage()."\n"; |
|
1670 | + } |
|
1581 | 1671 | return ''; |
1582 | 1672 | } |
1583 | 1673 | |
@@ -1595,7 +1685,9 @@ discard block |
||
1595 | 1685 | { |
1596 | 1686 | global $globalBitlyAccessToken; |
1597 | 1687 | |
1598 | - if ($globalBitlyAccessToken == '') return $url; |
|
1688 | + if ($globalBitlyAccessToken == '') { |
|
1689 | + return $url; |
|
1690 | + } |
|
1599 | 1691 | |
1600 | 1692 | $google_url = 'https://api-ssl.bitly.com/v3/shorten?access_token='.$globalBitlyAccessToken.'&longUrl='.$url; |
1601 | 1693 |
@@ -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) { |
@@ -76,8 +78,11 @@ discard block |
||
76 | 78 | if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) { |
77 | 79 | $filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')"; |
78 | 80 | } |
79 | - if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE'; |
|
80 | - elseif ($filter_query_where != '' && $and) $filter_query_where .= ' AND'; |
|
81 | + if ($filter_query_where == '' && $where) { |
|
82 | + $filter_query_where = ' WHERE'; |
|
83 | + } elseif ($filter_query_where != '' && $and) { |
|
84 | + $filter_query_where .= ' AND'; |
|
85 | + } |
|
81 | 86 | if ($filter_query_where != '') { |
82 | 87 | $filter_query_where = preg_replace('/^ AND/',' WHERE',$filter_query_where); |
83 | 88 | } |
@@ -119,7 +124,9 @@ discard block |
||
119 | 124 | } |
120 | 125 | } |
121 | 126 | |
122 | - if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
|
127 | + if (!isset($globalLiveInterval)) { |
|
128 | + $globalLiveInterval = '200'; |
|
129 | + } |
|
123 | 130 | if ($globalDBdriver == 'mysql') { |
124 | 131 | //$query = "SELECT tracker_live.* FROM tracker_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL 30 SECOND) <= l.date GROUP BY l.famtrackid) s on tracker_live.famtrackid = s.famtrackid AND tracker_live.date = s.maxdate"; |
125 | 132 | $query = 'SELECT tracker_live.* FROM tracker_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.famtrackid) s on tracker_live.famtrackid = s.famtrackid AND tracker_live.date = s.maxdate'.$filter_query.$orderby_query; |
@@ -144,7 +151,9 @@ discard block |
||
144 | 151 | |
145 | 152 | $filter_query = $this->getFilter($filter,true,true); |
146 | 153 | |
147 | - if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
|
154 | + if (!isset($globalLiveInterval)) { |
|
155 | + $globalLiveInterval = '200'; |
|
156 | + } |
|
148 | 157 | if ($globalDBdriver == 'mysql') { |
149 | 158 | $query = 'SELECT tracker_live.ident, tracker_live.type,tracker_live.famtrackid, tracker_live.latitude, tracker_live.longitude, tracker_live.altitude, tracker_live.heading, tracker_live.ground_speed, tracker_live.date, tracker_live.format_source |
150 | 159 | FROM tracker_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.famtrackid) s on tracker_live.famtrackid = s.famtrackid AND tracker_live.date = s.maxdate'.$filter_query." tracker_live.latitude <> 0 AND tracker_live.longitude <> 0"; |
@@ -182,7 +191,9 @@ discard block |
||
182 | 191 | |
183 | 192 | $filter_query = $this->getFilter($filter,true,true); |
184 | 193 | |
185 | - if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
|
194 | + if (!isset($globalLiveInterval)) { |
|
195 | + $globalLiveInterval = '200'; |
|
196 | + } |
|
186 | 197 | if ($globalDBdriver == 'mysql') { |
187 | 198 | $query = 'SELECT tracker_live.ident, tracker_live.famtrackid,tracker_live.type, tracker_live.latitude, tracker_live.longitude, tracker_live.altitude, tracker_live.heading, tracker_live.ground_speed, tracker_live.date, tracker_live.format_source |
188 | 199 | FROM tracker_live'.$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval." SECOND) <= tracker_live.date AND tracker_live.latitude <> '0' AND tracker_live.longitude <> '0' |
@@ -215,7 +226,9 @@ discard block |
||
215 | 226 | global $globalDBdriver, $globalLiveInterval; |
216 | 227 | $filter_query = $this->getFilter($filter,true,true); |
217 | 228 | |
218 | - if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
|
229 | + if (!isset($globalLiveInterval)) { |
|
230 | + $globalLiveInterval = '200'; |
|
231 | + } |
|
219 | 232 | if ($globalDBdriver == 'mysql') { |
220 | 233 | $query = 'SELECT COUNT(DISTINCT tracker_live.famtrackid) as nb FROM tracker_live'.$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= date'; |
221 | 234 | } else { |
@@ -243,7 +256,9 @@ discard block |
||
243 | 256 | { |
244 | 257 | global $globalDBdriver, $globalLiveInterval; |
245 | 258 | $Spotter = new Spotter($this->db); |
246 | - if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
|
259 | + if (!isset($globalLiveInterval)) { |
|
260 | + $globalLiveInterval = '200'; |
|
261 | + } |
|
247 | 262 | $filter_query = $this->getFilter($filter); |
248 | 263 | |
249 | 264 | if (is_array($coord)) { |
@@ -251,7 +266,9 @@ discard block |
||
251 | 266 | $minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
252 | 267 | $maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
253 | 268 | $maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
254 | - } else return array(); |
|
269 | + } else { |
|
270 | + return array(); |
|
271 | + } |
|
255 | 272 | if ($globalDBdriver == 'mysql') { |
256 | 273 | $query = 'SELECT tracker_live.* FROM tracker_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.famtrackid) s on tracker_live.famtrackid = s.famtrackid AND tracker_live.date = s.maxdate AND tracker_live.latitude BETWEEN '.$minlat.' AND '.$maxlat.' AND tracker_live.longitude BETWEEN '.$minlong.' AND '.$maxlong.' GROUP BY tracker_live.famtrackid'.$filter_query; |
257 | 274 | } else { |
@@ -441,11 +458,15 @@ discard block |
||
441 | 458 | //$query = self::$global_query.' WHERE tracker_live.famtrackid = :id ORDER BY date'; |
442 | 459 | if ($globalDBdriver == 'mysql') { |
443 | 460 | $query = 'SELECT tracker_live.* FROM tracker_live WHERE tracker_live.famtrackid = :id'; |
444 | - if ($liveinterval) $query .= ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= date'; |
|
461 | + if ($liveinterval) { |
|
462 | + $query .= ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= date'; |
|
463 | + } |
|
445 | 464 | $query .= ' ORDER BY date'; |
446 | 465 | } else { |
447 | 466 | $query = 'SELECT tracker_live.* FROM tracker_live WHERE tracker_live.famtrackid = :id'; |
448 | - if ($liveinterval) $query .= " AND CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= date"; |
|
467 | + if ($liveinterval) { |
|
468 | + $query .= " AND CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= date"; |
|
469 | + } |
|
449 | 470 | $query .= ' ORDER BY date'; |
450 | 471 | } |
451 | 472 | |
@@ -540,7 +561,9 @@ discard block |
||
540 | 561 | $i++; |
541 | 562 | $j++; |
542 | 563 | if ($j == 30) { |
543 | - if ($globalDebug) echo "."; |
|
564 | + if ($globalDebug) { |
|
565 | + echo "."; |
|
566 | + } |
|
544 | 567 | try { |
545 | 568 | |
546 | 569 | $sth = $this->db->prepare(substr($query_delete,0,-1).")"); |
@@ -787,7 +810,9 @@ discard block |
||
787 | 810 | { |
788 | 811 | return false; |
789 | 812 | } |
790 | - } else return ''; |
|
813 | + } else { |
|
814 | + return ''; |
|
815 | + } |
|
791 | 816 | |
792 | 817 | if ($longitude != '') |
793 | 818 | { |
@@ -795,7 +820,9 @@ discard block |
||
795 | 820 | { |
796 | 821 | return false; |
797 | 822 | } |
798 | - } else return ''; |
|
823 | + } else { |
|
824 | + return ''; |
|
825 | + } |
|
799 | 826 | |
800 | 827 | if ($altitude != '') |
801 | 828 | { |
@@ -803,7 +830,9 @@ discard block |
||
803 | 830 | { |
804 | 831 | return false; |
805 | 832 | } |
806 | - } else $altitude = 0; |
|
833 | + } else { |
|
834 | + $altitude = 0; |
|
835 | + } |
|
807 | 836 | |
808 | 837 | if ($heading != '') |
809 | 838 | { |
@@ -811,7 +840,9 @@ discard block |
||
811 | 840 | { |
812 | 841 | return false; |
813 | 842 | } |
814 | - } else $heading = 0; |
|
843 | + } else { |
|
844 | + $heading = 0; |
|
845 | + } |
|
815 | 846 | |
816 | 847 | if ($groundspeed != '') |
817 | 848 | { |
@@ -819,9 +850,13 @@ discard block |
||
819 | 850 | { |
820 | 851 | return false; |
821 | 852 | } |
822 | - } else $groundspeed = 0; |
|
853 | + } else { |
|
854 | + $groundspeed = 0; |
|
855 | + } |
|
823 | 856 | date_default_timezone_set('UTC'); |
824 | - if ($date == '') $date = date("Y-m-d H:i:s", time()); |
|
857 | + if ($date == '') { |
|
858 | + $date = date("Y-m-d H:i:s", time()); |
|
859 | + } |
|
825 | 860 | |
826 | 861 | |
827 | 862 | $famtrackid = filter_var($famtrackid,FILTER_SANITIZE_STRING); |
@@ -837,8 +872,12 @@ discard block |
||
837 | 872 | $comment = filter_var($comment,FILTER_SANITIZE_STRING); |
838 | 873 | $type = filter_var($type,FILTER_SANITIZE_STRING); |
839 | 874 | |
840 | - if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) $groundspeed = 0; |
|
841 | - if ($heading == '' || $Common->isInteger($heading) === false ) $heading = 0; |
|
875 | + if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) { |
|
876 | + $groundspeed = 0; |
|
877 | + } |
|
878 | + if ($heading == '' || $Common->isInteger($heading) === false ) { |
|
879 | + $heading = 0; |
|
880 | + } |
|
842 | 881 | |
843 | 882 | $query = 'INSERT INTO tracker_live (famtrackid, ident, latitude, longitude, altitude, heading, ground_speed, date, format_source, source_name, over_country, comment, type) |
844 | 883 | VALUES (:famtrackid,:ident,:latitude,:longitude,:altitude,:heading,:groundspeed,:date,:format_source, :source_name, :over_country,:comment,:type)'; |
@@ -44,7 +44,9 @@ discard block |
||
44 | 44 | |
45 | 45 | public function checkAll() { |
46 | 46 | global $globalDebug; |
47 | - if ($globalDebug) echo "Update last seen tracked data...\n"; |
|
47 | + if ($globalDebug) { |
|
48 | + echo "Update last seen tracked data...\n"; |
|
49 | + } |
|
48 | 50 | foreach ($this->all_tracked as $key => $flight) { |
49 | 51 | if (isset($this->all_tracked[$key]['id'])) { |
50 | 52 | //echo $this->all_tracked[$key]['id'].' - '.$this->all_tracked[$key]['latitude'].' '.$this->all_tracked[$key]['longitude']."\n"; |
@@ -57,12 +59,16 @@ discard block |
||
57 | 59 | public function del() { |
58 | 60 | global $globalDebug; |
59 | 61 | // Delete old infos |
60 | - if ($globalDebug) echo 'Delete old values and update latest data...'."\n"; |
|
62 | + if ($globalDebug) { |
|
63 | + echo 'Delete old values and update latest data...'."\n"; |
|
64 | + } |
|
61 | 65 | foreach ($this->all_tracked as $key => $flight) { |
62 | 66 | if (isset($flight['lastupdate'])) { |
63 | 67 | if ($flight['lastupdate'] < (time()-3000)) { |
64 | 68 | if (isset($this->all_tracked[$key]['id'])) { |
65 | - if ($globalDebug) echo "--- Delete old values with id ".$this->all_tracked[$key]['id']."\n"; |
|
69 | + if ($globalDebug) { |
|
70 | + echo "--- Delete old values with id ".$this->all_tracked[$key]['id']."\n"; |
|
71 | + } |
|
66 | 72 | /* |
67 | 73 | $TrackerLive = new TrackerLive(); |
68 | 74 | $TrackerLive->deleteLiveTrackerDataById($this->all_tracked[$key]['id']); |
@@ -72,7 +78,9 @@ discard block |
||
72 | 78 | $Tracker = new Tracker($this->db); |
73 | 79 | if ($this->all_tracked[$key]['latitude'] != '' && $this->all_tracked[$key]['longitude'] != '') { |
74 | 80 | $result = $Tracker->updateLatestTrackerData($this->all_tracked[$key]['id'],$this->all_tracked[$key]['ident'],$this->all_tracked[$key]['latitude'],$this->all_tracked[$key]['longitude'],$this->all_tracked[$key]['altitude'],$this->all_tracked[$key]['speed']); |
75 | - if ($globalDebug && $result != 'success') echo '!!! ERROR : '.$result."\n"; |
|
81 | + if ($globalDebug && $result != 'success') { |
|
82 | + echo '!!! ERROR : '.$result."\n"; |
|
83 | + } |
|
76 | 84 | } |
77 | 85 | // Put in archive |
78 | 86 | // $Tracker->db = null; |
@@ -85,7 +93,9 @@ discard block |
||
85 | 93 | |
86 | 94 | public function add($line) { |
87 | 95 | global $globalFork, $globalDistanceIgnore, $globalDaemon, $globalDebug, $globalCoordMinChange, $globalDebugTimeElapsed, $globalCenterLatitude, $globalCenterLongitude, $globalBeta, $globalSourcesupdate, $globalAllTracked; |
88 | - if (!isset($globalCoordMinChange) || $globalCoordMinChange == '') $globalCoordMinChange = '0.02'; |
|
96 | + if (!isset($globalCoordMinChange) || $globalCoordMinChange == '') { |
|
97 | + $globalCoordMinChange = '0.02'; |
|
98 | + } |
|
89 | 99 | date_default_timezone_set('UTC'); |
90 | 100 | $dataFound = false; |
91 | 101 | $send = false; |
@@ -109,8 +119,11 @@ discard block |
||
109 | 119 | */ |
110 | 120 | |
111 | 121 | $Common = new Common(); |
112 | - if (!isset($line['id'])) $id = trim($line['ident']); |
|
113 | - else $id = trim($line['id']); |
|
122 | + if (!isset($line['id'])) { |
|
123 | + $id = trim($line['ident']); |
|
124 | + } else { |
|
125 | + $id = trim($line['id']); |
|
126 | + } |
|
114 | 127 | |
115 | 128 | if (!isset($this->all_tracked[$id])) { |
116 | 129 | $this->all_tracked[$id] = array(); |
@@ -118,18 +131,27 @@ discard block |
||
118 | 131 | $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('ident' => '','latitude' => '', 'longitude' => '', 'speed' => '', 'altitude' => '', 'heading' => '', 'format_source' => '','source_name' => '','comment'=> '','type' => '','noarchive' => false,'putinarchive' => true,'over_country' => '')); |
119 | 132 | $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('lastupdate' => time())); |
120 | 133 | if (!isset($line['id'])) { |
121 | - if (!isset($globalDaemon)) $globalDaemon = TRUE; |
|
134 | + if (!isset($globalDaemon)) { |
|
135 | + $globalDaemon = TRUE; |
|
136 | + } |
|
122 | 137 | $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $id.'-'.date('YmdHi'))); |
123 | - } else $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $line['id'])); |
|
124 | - if ($globalAllTracked !== FALSE) $dataFound = true; |
|
138 | + } else { |
|
139 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $line['id'])); |
|
140 | + } |
|
141 | + if ($globalAllTracked !== FALSE) { |
|
142 | + $dataFound = true; |
|
143 | + } |
|
125 | 144 | } |
126 | 145 | |
127 | 146 | if (isset($line['datetime']) && strtotime($line['datetime']) > time()-20*60) { |
128 | 147 | if (!isset($this->all_tracked[$id]['datetime']) || strtotime($line['datetime']) >= strtotime($this->all_tracked[$id]['datetime'])) { |
129 | 148 | $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('datetime' => $line['datetime'])); |
130 | 149 | } else { |
131 | - if (strtotime($line['datetime']) == strtotime($this->all_tracked[$id]['datetime']) && $globalDebug) echo "!!! Date is the same as previous data for ".$this->all_tracked[$id]['hex']." - format : ".$line['format_source']."\n"; |
|
132 | - elseif (strtotime($line['datetime']) > strtotime($this->all_tracked[$id]['datetime']) && $globalDebug) echo "!!! Date previous latest data (".$line['datetime']." > ".$this->all_tracked[$id]['datetime'].") !!! for ".$this->all_tracked[$id]['hex']." - format : ".$line['format_source']."\n"; |
|
150 | + if (strtotime($line['datetime']) == strtotime($this->all_tracked[$id]['datetime']) && $globalDebug) { |
|
151 | + echo "!!! Date is the same as previous data for ".$this->all_tracked[$id]['hex']." - format : ".$line['format_source']."\n"; |
|
152 | + } elseif (strtotime($line['datetime']) > strtotime($this->all_tracked[$id]['datetime']) && $globalDebug) { |
|
153 | + echo "!!! Date previous latest data (".$line['datetime']." > ".$this->all_tracked[$id]['datetime'].") !!! for ".$this->all_tracked[$id]['hex']." - format : ".$line['format_source']."\n"; |
|
154 | + } |
|
133 | 155 | return ''; |
134 | 156 | } |
135 | 157 | } else { |
@@ -145,11 +167,17 @@ discard block |
||
145 | 167 | $Tracker = new Tracker($this->db); |
146 | 168 | $fromsource = NULL; |
147 | 169 | $result = $Tracker->updateIdentTrackerData($this->all_tracked[$id]['id'],$this->all_tracked[$id]['ident'],$fromsource); |
148 | - if ($globalDebug && $result != 'success') echo '!!! ERROR : '.$result."\n"; |
|
170 | + if ($globalDebug && $result != 'success') { |
|
171 | + echo '!!! ERROR : '.$result."\n"; |
|
172 | + } |
|
149 | 173 | $Tracker->db = null; |
150 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update identspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
174 | + if ($globalDebugTimeElapsed) { |
|
175 | + echo 'Time elapsed for update identspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
176 | + } |
|
177 | + } |
|
178 | + if (!isset($this->all_tracked[$id]['id'])) { |
|
179 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $this->all_tracked[$id]['ident'])); |
|
151 | 180 | } |
152 | - if (!isset($this->all_tracked[$id]['id'])) $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $this->all_tracked[$id]['ident'])); |
|
153 | 181 | } |
154 | 182 | |
155 | 183 | if (isset($line['speed']) && $line['speed'] != '') { |
@@ -160,14 +188,21 @@ discard block |
||
160 | 188 | if ($distance > 1000 && $distance < 10000) { |
161 | 189 | $speed = $distance/(time() - $this->all_tracked[$id]['time_last_coord']); |
162 | 190 | $speed = $speed*3.6; |
163 | - if ($speed < 1000) $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('speed' => round($speed))); |
|
164 | - if ($globalDebug) echo "ø Calculated Speed for ".$this->all_tracked[$id]['hex']." : ".$speed." - distance : ".$distance."\n"; |
|
191 | + if ($speed < 1000) { |
|
192 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('speed' => round($speed))); |
|
193 | + } |
|
194 | + if ($globalDebug) { |
|
195 | + echo "ø Calculated Speed for ".$this->all_tracked[$id]['hex']." : ".$speed." - distance : ".$distance."\n"; |
|
196 | + } |
|
165 | 197 | } |
166 | 198 | } |
167 | 199 | |
168 | 200 | if (isset($line['latitude']) && isset($line['longitude']) && $line['latitude'] != '' && $line['longitude'] != '' && is_numeric($line['latitude']) && is_numeric($line['longitude'])) { |
169 | - if (isset($this->all_tracked[$id]['time_last_coord'])) $timediff = round(time()-$this->all_tracked[$id]['time_last_coord']); |
|
170 | - else unset($timediff); |
|
201 | + if (isset($this->all_tracked[$id]['time_last_coord'])) { |
|
202 | + $timediff = round(time()-$this->all_tracked[$id]['time_last_coord']); |
|
203 | + } else { |
|
204 | + unset($timediff); |
|
205 | + } |
|
171 | 206 | if ($this->tmd > 5 || !isset($timediff) || $timediff > 2000 || ($timediff > 30 && isset($this->all_tracked[$id]['latitude']) && isset($this->all_tracked[$id]['longitude']) && $Common->withinThreshold($timediff,$Common->distance($line['latitude'],$line['longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],'m')))) { |
172 | 207 | if (isset($this->all_tracked[$id]['archive_latitude']) && isset($this->all_tracked[$id]['archive_longitude']) && isset($this->all_tracked[$id]['livedb_latitude']) && isset($this->all_tracked[$id]['livedb_longitude'])) { |
173 | 208 | if (!$Common->checkLine($this->all_tracked[$id]['archive_latitude'],$this->all_tracked[$id]['archive_longitude'],$this->all_tracked[$id]['livedb_latitude'],$this->all_tracked[$id]['livedb_longitude'],$line['latitude'],$line['longitude'])) { |
@@ -175,20 +210,30 @@ discard block |
||
175 | 210 | $this->all_tracked[$id]['archive_longitude'] = $line['longitude']; |
176 | 211 | $this->all_tracked[$id]['putinarchive'] = true; |
177 | 212 | |
178 | - if ($globalDebug) echo "\n".' ------- Check Country for '.$this->all_tracked[$id]['ident'].' with latitude : '.$line['latitude'].' and longitude : '.$line['longitude'].'.... '; |
|
213 | + if ($globalDebug) { |
|
214 | + echo "\n".' ------- Check Country for '.$this->all_tracked[$id]['ident'].' with latitude : '.$line['latitude'].' and longitude : '.$line['longitude'].'.... '; |
|
215 | + } |
|
179 | 216 | $timeelapsed = microtime(true); |
180 | 217 | $Tracker = new Tracker($this->db); |
181 | 218 | $all_country = $Tracker->getCountryFromLatitudeLongitude($line['latitude'],$line['longitude']); |
182 | - if (!empty($all_country)) $this->all_tracked[$id]['over_country'] = $all_country['iso2']; |
|
219 | + if (!empty($all_country)) { |
|
220 | + $this->all_tracked[$id]['over_country'] = $all_country['iso2']; |
|
221 | + } |
|
183 | 222 | $Tracker->db = null; |
184 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update getCountryFromlatitudeLongitude : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
223 | + if ($globalDebugTimeElapsed) { |
|
224 | + echo 'Time elapsed for update getCountryFromlatitudeLongitude : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
225 | + } |
|
185 | 226 | $this->tmd = 0; |
186 | - if ($globalDebug) echo 'FOUND : '.$this->all_tracked[$id]['over_country'].' ---------------'."\n"; |
|
227 | + if ($globalDebug) { |
|
228 | + echo 'FOUND : '.$this->all_tracked[$id]['over_country'].' ---------------'."\n"; |
|
229 | + } |
|
187 | 230 | } |
188 | 231 | } |
189 | 232 | |
190 | 233 | if (isset($line['latitude']) && $line['latitude'] != '' && $line['latitude'] != 0 && $line['latitude'] < 91 && $line['latitude'] > -90) { |
191 | - if (!isset($this->all_tracked[$id]['archive_latitude'])) $this->all_tracked[$id]['archive_latitude'] = $line['latitude']; |
|
234 | + if (!isset($this->all_tracked[$id]['archive_latitude'])) { |
|
235 | + $this->all_tracked[$id]['archive_latitude'] = $line['latitude']; |
|
236 | + } |
|
192 | 237 | if (!isset($this->all_tracked[$id]['livedb_latitude']) || abs($this->all_tracked[$id]['livedb_latitude']-$line['latitude']) > $globalCoordMinChange || $this->all_tracked[$id]['format_source'] == 'aprs') { |
193 | 238 | $this->all_tracked[$id]['livedb_latitude'] = $line['latitude']; |
194 | 239 | $dataFound = true; |
@@ -197,8 +242,12 @@ discard block |
||
197 | 242 | $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('latitude' => $line['latitude'])); |
198 | 243 | } |
199 | 244 | if (isset($line['longitude']) && $line['longitude'] != '' && $line['longitude'] != 0 && $line['longitude'] < 360 && $line['longitude'] > -180) { |
200 | - if ($line['longitude'] > 180) $line['longitude'] = $line['longitude'] - 360; |
|
201 | - if (!isset($this->all_tracked[$id]['archive_longitude'])) $this->all_tracked[$id]['archive_longitude'] = $line['longitude']; |
|
245 | + if ($line['longitude'] > 180) { |
|
246 | + $line['longitude'] = $line['longitude'] - 360; |
|
247 | + } |
|
248 | + if (!isset($this->all_tracked[$id]['archive_longitude'])) { |
|
249 | + $this->all_tracked[$id]['archive_longitude'] = $line['longitude']; |
|
250 | + } |
|
202 | 251 | if (!isset($this->all_tracked[$id]['livedb_longitude']) || abs($this->all_tracked[$id]['livedb_longitude']-$line['longitude']) > $globalCoordMinChange || $this->all_tracked[$id]['format_source'] == 'aprs') { |
203 | 252 | $this->all_tracked[$id]['livedb_longitude'] = $line['longitude']; |
204 | 253 | $dataFound = true; |
@@ -216,7 +265,9 @@ discard block |
||
216 | 265 | } |
217 | 266 | } |
218 | 267 | if (isset($line['last_update']) && $line['last_update'] != '') { |
219 | - if (isset($this->all_tracked[$id]['last_update']) && $this->all_tracked[$id]['last_update'] != $line['last_update']) $dataFound = true; |
|
268 | + if (isset($this->all_tracked[$id]['last_update']) && $this->all_tracked[$id]['last_update'] != $line['last_update']) { |
|
269 | + $dataFound = true; |
|
270 | + } |
|
220 | 271 | $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('last_update' => $line['last_update'])); |
221 | 272 | } |
222 | 273 | if (isset($line['format_source']) && $line['format_source'] != '') { |
@@ -236,7 +287,9 @@ discard block |
||
236 | 287 | |
237 | 288 | if (isset($line['altitude']) && $line['altitude'] != '') { |
238 | 289 | //if (!isset($this->all_tracked[$id]['altitude']) || $this->all_tracked[$id]['altitude'] == '' || ($this->all_tracked[$id]['altitude'] > 0 && $line['altitude'] != 0)) { |
239 | - if (is_int($this->all_tracked[$id]['altitude']) && abs(round($line['altitude']/100)-$this->all_tracked[$id]['altitude']) > 3) $this->all_tracked[$id]['putinarchive'] = true; |
|
290 | + if (is_int($this->all_tracked[$id]['altitude']) && abs(round($line['altitude']/100)-$this->all_tracked[$id]['altitude']) > 3) { |
|
291 | + $this->all_tracked[$id]['putinarchive'] = true; |
|
292 | + } |
|
240 | 293 | $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('altitude' => round($line['altitude']/100))); |
241 | 294 | $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('altitude_real' => $line['altitude'])); |
242 | 295 | //$dataFound = true; |
@@ -248,15 +301,21 @@ discard block |
||
248 | 301 | } |
249 | 302 | |
250 | 303 | if (isset($line['heading']) && $line['heading'] != '') { |
251 | - if (is_int($this->all_tracked[$id]['heading']) && abs($this->all_tracked[$id]['heading']-round($line['heading'])) > 10) $this->all_tracked[$id]['putinarchive'] = true; |
|
304 | + if (is_int($this->all_tracked[$id]['heading']) && abs($this->all_tracked[$id]['heading']-round($line['heading'])) > 10) { |
|
305 | + $this->all_tracked[$id]['putinarchive'] = true; |
|
306 | + } |
|
252 | 307 | $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('heading' => round($line['heading']))); |
253 | 308 | $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('heading_fromsrc' => true)); |
254 | 309 | //$dataFound = true; |
255 | 310 | } elseif (!isset($this->all_tracked[$id]['heading_fromsrc']) && isset($this->all_tracked[$id]['archive_latitude']) && $this->all_tracked[$id]['archive_latitude'] != $this->all_tracked[$id]['latitude'] && isset($this->all_tracked[$id]['archive_longitude']) && $this->all_tracked[$id]['archive_longitude'] != $this->all_tracked[$id]['longitude']) { |
256 | 311 | $heading = $Common->getHeading($this->all_tracked[$id]['archive_latitude'],$this->all_tracked[$id]['archive_longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude']); |
257 | 312 | $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('heading' => round($heading))); |
258 | - if (abs($this->all_tracked[$id]['heading']-round($heading)) > 10) $this->all_tracked[$id]['putinarchive'] = true; |
|
259 | - if ($globalDebug) echo "ø Calculated Heading for ".$this->all_tracked[$id]['ident']." : ".$heading."\n"; |
|
313 | + if (abs($this->all_tracked[$id]['heading']-round($heading)) > 10) { |
|
314 | + $this->all_tracked[$id]['putinarchive'] = true; |
|
315 | + } |
|
316 | + if ($globalDebug) { |
|
317 | + echo "ø Calculated Heading for ".$this->all_tracked[$id]['ident']." : ".$heading."\n"; |
|
318 | + } |
|
260 | 319 | } |
261 | 320 | //if (isset($globalSourcesupdate) && $globalSourcesupdate != '' && isset($this->all_tracked[$id]['lastupdate']) && time()-$this->all_tracked[$id]['lastupdate'] < $globalSourcesupdate) $dataFound = false; |
262 | 321 | |
@@ -265,20 +324,31 @@ discard block |
||
265 | 324 | if ($this->all_tracked[$id]['addedTracker'] == 0) { |
266 | 325 | if (!isset($globalDistanceIgnore['latitude']) || $this->all_tracked[$id]['longitude'] == '' || $this->all_tracked[$id]['latitude'] == '' || (isset($globalDistanceIgnore['latitude']) && $Common->distance($this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude']) < $globalDistanceIgnore['distance'])) { |
267 | 326 | if (!isset($this->all_tracked[$id]['forcenew']) || $this->all_tracked[$id]['forcenew'] == 0) { |
268 | - if ($globalDebug) echo "Check if aircraft is already in DB..."; |
|
327 | + if ($globalDebug) { |
|
328 | + echo "Check if aircraft is already in DB..."; |
|
329 | + } |
|
269 | 330 | $timeelapsed = microtime(true); |
270 | 331 | $TrackerLive = new TrackerLive($this->db); |
271 | 332 | if (isset($line['id'])) { |
272 | 333 | $recent_ident = $TrackerLive->checkIdRecent($line['id']); |
273 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
334 | + if ($globalDebugTimeElapsed) { |
|
335 | + echo 'Time elapsed for update checkIdRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
336 | + } |
|
274 | 337 | } elseif (isset($this->all_tracked[$id]['ident']) && $this->all_tracked[$id]['ident'] != '') { |
275 | 338 | $recent_ident = $TrackerLive->checkIdentRecent($this->all_tracked[$id]['ident']); |
276 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdentRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
277 | - } else $recent_ident = ''; |
|
339 | + if ($globalDebugTimeElapsed) { |
|
340 | + echo 'Time elapsed for update checkIdentRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
341 | + } |
|
342 | + } else { |
|
343 | + $recent_ident = ''; |
|
344 | + } |
|
278 | 345 | $TrackerLive->db=null; |
279 | 346 | |
280 | - if ($globalDebug && $recent_ident == '') echo " Not in DB.\n"; |
|
281 | - elseif ($globalDebug && $recent_ident != '') echo " Already in DB.\n"; |
|
347 | + if ($globalDebug && $recent_ident == '') { |
|
348 | + echo " Not in DB.\n"; |
|
349 | + } elseif ($globalDebug && $recent_ident != '') { |
|
350 | + echo " Already in DB.\n"; |
|
351 | + } |
|
282 | 352 | } else { |
283 | 353 | $recent_ident = ''; |
284 | 354 | $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('forcenew' => 0)); |
@@ -286,16 +356,24 @@ discard block |
||
286 | 356 | //if there was no aircraft with the same callsign within the last hour and go post it into the archive |
287 | 357 | if($recent_ident == "") |
288 | 358 | { |
289 | - if ($globalDebug) echo "\o/ Add ".$this->all_tracked[$id]['ident']." in archive DB : "; |
|
359 | + if ($globalDebug) { |
|
360 | + echo "\o/ Add ".$this->all_tracked[$id]['ident']." in archive DB : "; |
|
361 | + } |
|
290 | 362 | //adds the spotter data for the archive |
291 | 363 | $highlight = ''; |
292 | - if (!isset($this->all_tracked[$id]['id'])) $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $this->all_tracked[$id]['ident'].'-'.date('YmdHi'))); |
|
364 | + if (!isset($this->all_tracked[$id]['id'])) { |
|
365 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $this->all_tracked[$id]['ident'].'-'.date('YmdHi'))); |
|
366 | + } |
|
293 | 367 | $timeelapsed = microtime(true); |
294 | 368 | $Tracker = new Tracker($this->db); |
295 | 369 | $result = $Tracker->addTrackerData($this->all_tracked[$id]['id'], $this->all_tracked[$id]['ident'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], $this->all_tracked[$id]['altitude'], $this->all_tracked[$id]['heading'], $this->all_tracked[$id]['speed'], $this->all_tracked[$id]['datetime'], $this->all_tracked[$id]['comment'],$this->all_tracked[$id]['type'],$this->all_tracked[$id]['format_source'],$this->all_tracked[$id]['source_name']); |
296 | 370 | $Tracker->db = null; |
297 | - if ($globalDebug && isset($result)) echo $result."\n"; |
|
298 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update addspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
371 | + if ($globalDebug && isset($result)) { |
|
372 | + echo $result."\n"; |
|
373 | + } |
|
374 | + if ($globalDebugTimeElapsed) { |
|
375 | + echo 'Time elapsed for update addspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
376 | + } |
|
299 | 377 | |
300 | 378 | /* |
301 | 379 | // Add source stat in DB |
@@ -329,12 +407,16 @@ discard block |
||
329 | 407 | $this->all_tracked[$id]['addedTracker'] = 1; |
330 | 408 | //print_r($this->all_tracked[$id]); |
331 | 409 | if ($this->last_delete == 0 || time() - $this->last_delete > 1800) { |
332 | - if ($globalDebug) echo "---- Deleting Live Tracker data older than 9 hours..."; |
|
410 | + if ($globalDebug) { |
|
411 | + echo "---- Deleting Live Tracker data older than 9 hours..."; |
|
412 | + } |
|
333 | 413 | //TrackerLive->deleteLiveTrackerDataNotUpdated(); |
334 | 414 | $TrackerLive = new TrackerLive($this->db); |
335 | 415 | $TrackerLive->deleteLiveTrackerData(); |
336 | 416 | $TrackerLive->db=null; |
337 | - if ($globalDebug) echo " Done\n"; |
|
417 | + if ($globalDebug) { |
|
418 | + echo " Done\n"; |
|
419 | + } |
|
338 | 420 | $this->last_delete = time(); |
339 | 421 | } |
340 | 422 | } else { |
@@ -357,13 +439,17 @@ discard block |
||
357 | 439 | |
358 | 440 | if (!$ignoreImport) { |
359 | 441 | if (!isset($globalDistanceIgnore['latitude']) || (isset($globalDistanceIgnore['latitude']) && $Common->distance($this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude']) < $globalDistanceIgnore['distance'])) { |
360 | - if ($globalDebug) echo "\o/ Add ".$this->all_tracked[$id]['ident']." from ".$this->all_tracked[$id]['format_source']." in Live DB : "; |
|
442 | + if ($globalDebug) { |
|
443 | + echo "\o/ Add ".$this->all_tracked[$id]['ident']." from ".$this->all_tracked[$id]['format_source']." in Live DB : "; |
|
444 | + } |
|
361 | 445 | $timeelapsed = microtime(true); |
362 | 446 | $TrackerLive = new TrackerLive($this->db); |
363 | 447 | $result = $TrackerLive->addLiveTrackerData($this->all_tracked[$id]['id'], $this->all_tracked[$id]['ident'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], $this->all_tracked[$id]['altitude'], $this->all_tracked[$id]['heading'], $this->all_tracked[$id]['speed'],$this->all_tracked[$id]['datetime'], $this->all_tracked[$id]['putinarchive'],$this->all_tracked[$id]['comment'],$this->all_tracked[$id]['type'],$this->all_tracked[$id]['noarchive'],$this->all_tracked[$id]['format_source'],$this->all_tracked[$id]['source_name'],$this->all_tracked[$id]['over_country']); |
364 | 448 | $TrackerLive->db = null; |
365 | 449 | $this->all_tracked[$id]['putinarchive'] = false; |
366 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update addlivespotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
450 | + if ($globalDebugTimeElapsed) { |
|
451 | + echo 'Time elapsed for update addlivespotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
452 | + } |
|
367 | 453 | |
368 | 454 | // Put statistics in $this->stats variable |
369 | 455 | /* |
@@ -420,19 +506,29 @@ discard block |
||
420 | 506 | */ |
421 | 507 | |
422 | 508 | $this->all_tracked[$id]['lastupdate'] = time(); |
423 | - if ($this->all_tracked[$id]['putinarchive']) $send = true; |
|
424 | - if ($globalDebug) echo $result."\n"; |
|
425 | - } elseif (isset($this->all_tracked[$id]['latitude']) && isset($globalDistanceIgnore['latitude']) && $globalDebug) echo "!! Too far -> Distance : ".$Common->distance($this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude'])."\n"; |
|
509 | + if ($this->all_tracked[$id]['putinarchive']) { |
|
510 | + $send = true; |
|
511 | + } |
|
512 | + if ($globalDebug) { |
|
513 | + echo $result."\n"; |
|
514 | + } |
|
515 | + } elseif (isset($this->all_tracked[$id]['latitude']) && isset($globalDistanceIgnore['latitude']) && $globalDebug) { |
|
516 | + echo "!! Too far -> Distance : ".$Common->distance($this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude'])."\n"; |
|
517 | + } |
|
426 | 518 | //$this->del(); |
427 | 519 | |
428 | 520 | |
429 | 521 | if ($this->last_delete_hourly == 0 || time() - $this->last_delete_hourly > 900) { |
430 | - if ($globalDebug) echo "---- Deleting Live Tracker data Not updated since 2 hour..."; |
|
522 | + if ($globalDebug) { |
|
523 | + echo "---- Deleting Live Tracker data Not updated since 2 hour..."; |
|
524 | + } |
|
431 | 525 | $TrackerLive = new TrackerLive($this->db); |
432 | 526 | $TrackerLive->deleteLiveTrackerDataNotUpdated(); |
433 | 527 | $TrackerLive->db = null; |
434 | 528 | //TrackerLive->deleteLiveTrackerData(); |
435 | - if ($globalDebug) echo " Done\n"; |
|
529 | + if ($globalDebug) { |
|
530 | + echo " Done\n"; |
|
531 | + } |
|
436 | 532 | $this->last_delete_hourly = time(); |
437 | 533 | } |
438 | 534 | |
@@ -440,7 +536,9 @@ discard block |
||
440 | 536 | //$ignoreImport = false; |
441 | 537 | } |
442 | 538 | //if (function_exists('pcntl_fork') && $globalFork) pcntl_signal(SIGCHLD, SIG_IGN); |
443 | - if ($send) return $this->all_tracked[$id]; |
|
539 | + if ($send) { |
|
540 | + return $this->all_tracked[$id]; |
|
541 | + } |
|
444 | 542 | } |
445 | 543 | } |
446 | 544 | } |
@@ -63,7 +63,9 @@ |
||
63 | 63 | { |
64 | 64 | if ($spotter_item['image_source'] == 'flickr' || $spotter_item['image_source'] == 'wikimedia' || $spotter_item['image_source'] == 'devianart') { |
65 | 65 | $image = preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']); |
66 | - } else $image = $spotter_item['image_thumbnail']; |
|
66 | + } else { |
|
67 | + $image = $spotter_item['image_thumbnail']; |
|
68 | + } |
|
67 | 69 | |
68 | 70 | } |
69 | 71 | /* else { |