@@ -48,27 +48,52 @@ discard block |
||
48 | 48 | } |
49 | 49 | header('Content-Type: text/javascript'); |
50 | 50 | |
51 | -if (!isset($globalJsonCompress)) $compress = true; |
|
52 | -else $compress = $globalJsonCompress; |
|
51 | +if (!isset($globalJsonCompress)) { |
|
52 | + $compress = true; |
|
53 | +} else { |
|
54 | + $compress = $globalJsonCompress; |
|
55 | +} |
|
53 | 56 | |
54 | 57 | $from_archive = false; |
55 | 58 | $min = true; |
56 | 59 | $allhistory = false; |
57 | 60 | $filter['source'] = array(); |
58 | -if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') $filter['source'] = array_merge($filter['source'],array('vatsimtxt')); |
|
59 | -if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') $filter['source'] = array_merge($filter['source'],array('whazzup')); |
|
60 | -if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') $filter['source'] = array_merge($filter['source'],array('phpvmacars')); |
|
61 | -if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') $filter['source'] = array_merge($filter['source'],array('sbs','famaprs')); |
|
62 | -if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') $filter['source'] = array_merge($filter['source'],array('aprs')); |
|
63 | -if (isset($_COOKIE['filter_ident']) && $_COOKIE['filter_ident'] != '') $filter['ident'] = filter_var($_COOKIE['filter_ident'],FILTER_SANITIZE_STRING); |
|
64 | -if (isset($_COOKIE['filter_Airlines']) && $_COOKIE['filter_Airlines'] != '') $filter['airlines'] = filter_var_array(explode(',',$_COOKIE['filter_Airlines']),FILTER_SANITIZE_STRING); |
|
65 | -if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') $filter['source_aprs'] = filter_var_array(explode(',',$_COOKIE['filter_Sources']),FILTER_SANITIZE_STRING); |
|
66 | -if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') $filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'],FILTER_SANITIZE_STRING); |
|
67 | -if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] != 'all') $filter['alliance'] = filter_var($_COOKIE['filter_alliance'],FILTER_SANITIZE_STRING); |
|
61 | +if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') { |
|
62 | + $filter['source'] = array_merge($filter['source'],array('vatsimtxt')); |
|
63 | +} |
|
64 | +if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') { |
|
65 | + $filter['source'] = array_merge($filter['source'],array('whazzup')); |
|
66 | +} |
|
67 | +if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') { |
|
68 | + $filter['source'] = array_merge($filter['source'],array('phpvmacars')); |
|
69 | +} |
|
70 | +if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') { |
|
71 | + $filter['source'] = array_merge($filter['source'],array('sbs','famaprs')); |
|
72 | +} |
|
73 | +if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') { |
|
74 | + $filter['source'] = array_merge($filter['source'],array('aprs')); |
|
75 | +} |
|
76 | +if (isset($_COOKIE['filter_ident']) && $_COOKIE['filter_ident'] != '') { |
|
77 | + $filter['ident'] = filter_var($_COOKIE['filter_ident'],FILTER_SANITIZE_STRING); |
|
78 | +} |
|
79 | +if (isset($_COOKIE['filter_Airlines']) && $_COOKIE['filter_Airlines'] != '') { |
|
80 | + $filter['airlines'] = filter_var_array(explode(',',$_COOKIE['filter_Airlines']),FILTER_SANITIZE_STRING); |
|
81 | +} |
|
82 | +if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') { |
|
83 | + $filter['source_aprs'] = filter_var_array(explode(',',$_COOKIE['filter_Sources']),FILTER_SANITIZE_STRING); |
|
84 | +} |
|
85 | +if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') { |
|
86 | + $filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'],FILTER_SANITIZE_STRING); |
|
87 | +} |
|
88 | +if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] != 'all') { |
|
89 | + $filter['alliance'] = filter_var($_COOKIE['filter_alliance'],FILTER_SANITIZE_STRING); |
|
90 | +} |
|
68 | 91 | |
69 | 92 | if (isset($globalMapPopup) && !$globalMapPopup && !(isset($_COOKIE['flightpopup']) && $_COOKIE['flightpopup'] == 'true')) { |
70 | 93 | $min = true; |
71 | -} else $min = false; |
|
94 | +} else { |
|
95 | + $min = false; |
|
96 | +} |
|
72 | 97 | |
73 | 98 | if (isset($_GET['ident'])) { |
74 | 99 | $ident = filter_input(INPUT_GET,'ident',FILTER_SANITIZE_STRING); |
@@ -157,21 +182,33 @@ discard block |
||
157 | 182 | } else { |
158 | 183 | $flightcnt = $SpotterLive->getLiveSpotterCount($filter); |
159 | 184 | } |
160 | - } else $flightcnt = count($spotter_array); |
|
161 | - if ($flightcnt == '') $flightcnt = 0; |
|
162 | -} else $flightcnt = 0; |
|
185 | + } else { |
|
186 | + $flightcnt = count($spotter_array); |
|
187 | + } |
|
188 | + if ($flightcnt == '') { |
|
189 | + $flightcnt = 0; |
|
190 | + } |
|
191 | + } else { |
|
192 | + $flightcnt = 0; |
|
193 | +} |
|
163 | 194 | |
164 | 195 | $sqltime = round(microtime(true)-$begintime,2); |
165 | 196 | |
166 | -if ((!isset($_COOKIE['flightestimation']) && isset($globalMapEstimation) && $globalMapEstimation == FALSE) || (isset($_COOKIE['flightestimation']) && $_COOKIE['flightestimation'] == 'false')) $usenextlatlon = false; |
|
167 | -else $usenextlatlon = true; |
|
197 | +if ((!isset($_COOKIE['flightestimation']) && isset($globalMapEstimation) && $globalMapEstimation == FALSE) || (isset($_COOKIE['flightestimation']) && $_COOKIE['flightestimation'] == 'false')) { |
|
198 | + $usenextlatlon = false; |
|
199 | +} else { |
|
200 | + $usenextlatlon = true; |
|
201 | +} |
|
168 | 202 | $j = 0; |
169 | 203 | $prev_flightaware_id = ''; |
170 | 204 | $aircrafts_shadow = array(); |
171 | 205 | $output = '{'; |
172 | 206 | $output .= '"type": "FeatureCollection",'; |
173 | - if ($min) $output .= '"minimal": "true",'; |
|
174 | - else $output .= '"minimal": "false",'; |
|
207 | + if ($min) { |
|
208 | + $output .= '"minimal": "true",'; |
|
209 | + } else { |
|
210 | + $output .= '"minimal": "false",'; |
|
211 | + } |
|
175 | 212 | $output .= '"fc": "'.$flightcnt.'",'; |
176 | 213 | $output .= '"sqt": "'.$sqltime.'",'; |
177 | 214 | |
@@ -215,18 +252,29 @@ discard block |
||
215 | 252 | } |
216 | 253 | $output .= '"properties": {'; |
217 | 254 | if (isset($spotter_item['flightaware_id'])) { |
218 | - if ($compress) $output .= '"fi": "'.$spotter_item['flightaware_id'].'",'; |
|
219 | - else $output .= '"flightaware_id": "'.$spotter_item['flightaware_id'].'",'; |
|
255 | + if ($compress) { |
|
256 | + $output .= '"fi": "'.$spotter_item['flightaware_id'].'",'; |
|
257 | + } else { |
|
258 | + $output .= '"flightaware_id": "'.$spotter_item['flightaware_id'].'",'; |
|
259 | + } |
|
220 | 260 | } elseif (isset($spotter_item['famtrackid'])) { |
221 | - if ($compress) $output .= '"fti": "'.$spotter_item['famtrackid'].'",'; |
|
222 | - else $output .= '"famtrackid": "'.$spotter_item['famtrackid'].'",'; |
|
261 | + if ($compress) { |
|
262 | + $output .= '"fti": "'.$spotter_item['famtrackid'].'",'; |
|
263 | + } else { |
|
264 | + $output .= '"famtrackid": "'.$spotter_item['famtrackid'].'",'; |
|
265 | + } |
|
223 | 266 | } elseif (isset($spotter_item['fammarine_id'])) { |
224 | - if ($compress) $output .= '"fmi": "'.$spotter_item['fammarine_id'].'",'; |
|
225 | - else $output .= '"fammarineid": "'.$spotter_item['fammarine_id'].'",'; |
|
267 | + if ($compress) { |
|
268 | + $output .= '"fmi": "'.$spotter_item['fammarine_id'].'",'; |
|
269 | + } else { |
|
270 | + $output .= '"fammarineid": "'.$spotter_item['fammarine_id'].'",'; |
|
271 | + } |
|
226 | 272 | } |
227 | 273 | $output .= '"fc": "'.$flightcnt.'",'; |
228 | 274 | $output .= '"sqt": "'.$sqltime.'",'; |
229 | - if (isset($begindate)) $output .= '"archive_date": "'.$begindate.'",'; |
|
275 | + if (isset($begindate)) { |
|
276 | + $output .= '"archive_date": "'.$begindate.'",'; |
|
277 | + } |
|
230 | 278 | |
231 | 279 | /* |
232 | 280 | if ($min) $output .= '"minimal": "true",'; |
@@ -234,14 +282,22 @@ discard block |
||
234 | 282 | */ |
235 | 283 | //$output .= '"fc": "'.$spotter_item['nb'].'",'; |
236 | 284 | if (isset($spotter_item['ident']) && $spotter_item['ident'] != '') { |
237 | - if ($compress) $output .= '"c": "'.str_replace('\\','',$spotter_item['ident']).'",'; |
|
238 | - else $output .= '"callsign": "'.str_replace('\\','',$spotter_item['ident']).'",'; |
|
285 | + if ($compress) { |
|
286 | + $output .= '"c": "'.str_replace('\\','',$spotter_item['ident']).'",'; |
|
287 | + } else { |
|
288 | + $output .= '"callsign": "'.str_replace('\\','',$spotter_item['ident']).'",'; |
|
289 | + } |
|
239 | 290 | //" |
240 | 291 | } else { |
241 | - if ($compress) $output .= '"c": "NA",'; |
|
242 | - else $output .= '"callsign": "NA",'; |
|
292 | + if ($compress) { |
|
293 | + $output .= '"c": "NA",'; |
|
294 | + } else { |
|
295 | + $output .= '"callsign": "NA",'; |
|
296 | + } |
|
297 | + } |
|
298 | + if (isset($spotter_item['registration'])) { |
|
299 | + $output .= '"registration": "'.$spotter_item['registration'].'",'; |
|
243 | 300 | } |
244 | - if (isset($spotter_item['registration'])) $output .= '"registration": "'.$spotter_item['registration'].'",'; |
|
245 | 301 | if (isset($spotter_item['aircraft_name']) && isset($spotter_item['aircraft_type'])) { |
246 | 302 | $output .= '"aircraft_name": "'.$spotter_item['aircraft_name'].' ('.$spotter_item['aircraft_type'].')",'; |
247 | 303 | $output .= '"aircraft_wiki": "http://'.strtolower($globalLanguage).'.wikipedia.org/wiki/'.urlencode(str_replace(' ','_',$spotter_item['aircraft_name'])).'",'; |
@@ -254,15 +310,21 @@ discard block |
||
254 | 310 | $output .= '"aircraft_icao": "'.$spotter_item['aircraft_icao'].'",'; |
255 | 311 | } |
256 | 312 | if (!isset($spotter_item['aircraft_shadow']) && !$tracker) { |
257 | - if (!isset($spotter_item['aircraft_icao']) || $spotter_item['aircraft_icao'] == '') $spotter_item['aircraft_shadow'] = ''; |
|
258 | - else { |
|
313 | + if (!isset($spotter_item['aircraft_icao']) || $spotter_item['aircraft_icao'] == '') { |
|
314 | + $spotter_item['aircraft_shadow'] = ''; |
|
315 | + } else { |
|
259 | 316 | $aircraft_icao = $spotter_item['aircraft_icao']; |
260 | - if (isset($aircrafts_shadow[$aircraft_icao])) $spotter_item['aircraft_shadow'] = $aircrafts_shadow[$aircraft_icao]; |
|
261 | - else { |
|
317 | + if (isset($aircrafts_shadow[$aircraft_icao])) { |
|
318 | + $spotter_item['aircraft_shadow'] = $aircrafts_shadow[$aircraft_icao]; |
|
319 | + } else { |
|
262 | 320 | $aircraft_info = $Spotter->getAllAircraftInfo($spotter_item['aircraft_icao']); |
263 | - if (count($aircraft_info) > 0) $spotter_item['aircraft_shadow'] = $aircraft_info[0]['aircraft_shadow']; |
|
264 | - elseif (isset($spotter_item['format_source']) && $spotter_item['format_source'] == 'aprs') $spotter_item['aircraft_shadow'] = 'PA18.png'; |
|
265 | - else $spotter_item['aircraft_shadow'] = ''; |
|
321 | + if (count($aircraft_info) > 0) { |
|
322 | + $spotter_item['aircraft_shadow'] = $aircraft_info[0]['aircraft_shadow']; |
|
323 | + } elseif (isset($spotter_item['format_source']) && $spotter_item['format_source'] == 'aprs') { |
|
324 | + $spotter_item['aircraft_shadow'] = 'PA18.png'; |
|
325 | + } else { |
|
326 | + $spotter_item['aircraft_shadow'] = ''; |
|
327 | + } |
|
266 | 328 | $aircrafts_shadow[$aircraft_icao] = $spotter_item['aircraft_shadow']; |
267 | 329 | } |
268 | 330 | } |
@@ -270,73 +332,139 @@ discard block |
||
270 | 332 | if (!isset($spotter_item['aircraft_shadow']) || $spotter_item['aircraft_shadow'] == '') { |
271 | 333 | if ($tracker) { |
272 | 334 | if (isset($spotter_item['type']) && $spotter_item['type'] == 'Ambulance') { |
273 | - if ($compress) $output .= '"as": "ambulance.png",'; |
|
274 | - else $output .= '"aircraft_shadow": "ambulance.png",'; |
|
335 | + if ($compress) { |
|
336 | + $output .= '"as": "ambulance.png",'; |
|
337 | + } else { |
|
338 | + $output .= '"aircraft_shadow": "ambulance.png",'; |
|
339 | + } |
|
275 | 340 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Police') { |
276 | - if ($compress) $output .= '"as": "police.png",'; |
|
277 | - else $output .= '"aircraft_shadow": "police.png",'; |
|
341 | + if ($compress) { |
|
342 | + $output .= '"as": "police.png",'; |
|
343 | + } else { |
|
344 | + $output .= '"aircraft_shadow": "police.png",'; |
|
345 | + } |
|
278 | 346 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Yacht (Sail)') { |
279 | - if ($compress) $output .= '"as": "ship.png",'; |
|
280 | - else $output .= '"aircraft_shadow": "ship.png",'; |
|
347 | + if ($compress) { |
|
348 | + $output .= '"as": "ship.png",'; |
|
349 | + } else { |
|
350 | + $output .= '"aircraft_shadow": "ship.png",'; |
|
351 | + } |
|
281 | 352 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Ship (Power Boat)') { |
282 | - if ($compress) $output .= '"as": "ship.png",'; |
|
283 | - else $output .= '"aircraft_shadow": "ship.png",'; |
|
353 | + if ($compress) { |
|
354 | + $output .= '"as": "ship.png",'; |
|
355 | + } else { |
|
356 | + $output .= '"aircraft_shadow": "ship.png",'; |
|
357 | + } |
|
284 | 358 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Shuttle') { |
285 | - if ($compress) $output .= '"as": "ship.png",'; |
|
286 | - else $output .= '"aircraft_shadow": "ship.png",'; |
|
359 | + if ($compress) { |
|
360 | + $output .= '"as": "ship.png",'; |
|
361 | + } else { |
|
362 | + $output .= '"aircraft_shadow": "ship.png",'; |
|
363 | + } |
|
287 | 364 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Truck') { |
288 | - if ($compress) $output .= '"as": "truck.png",'; |
|
289 | - else $output .= '"aircraft_shadow": "truck.png",'; |
|
365 | + if ($compress) { |
|
366 | + $output .= '"as": "truck.png",'; |
|
367 | + } else { |
|
368 | + $output .= '"aircraft_shadow": "truck.png",'; |
|
369 | + } |
|
290 | 370 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Truck (18 Wheeler)') { |
291 | - if ($compress) $output .= '"as": "truck.png",'; |
|
292 | - else $output .= '"aircraft_shadow": "truck.png",'; |
|
371 | + if ($compress) { |
|
372 | + $output .= '"as": "truck.png",'; |
|
373 | + } else { |
|
374 | + $output .= '"aircraft_shadow": "truck.png",'; |
|
375 | + } |
|
293 | 376 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Aircraft (small)') { |
294 | - if ($compress) $output .= '"as": "aircraft.png",'; |
|
295 | - else $output .= '"aircraft_shadow": "aircraft.png",'; |
|
377 | + if ($compress) { |
|
378 | + $output .= '"as": "aircraft.png",'; |
|
379 | + } else { |
|
380 | + $output .= '"aircraft_shadow": "aircraft.png",'; |
|
381 | + } |
|
296 | 382 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Large Aircraft') { |
297 | - if ($compress) $output .= '"as": "aircraft.png",'; |
|
298 | - else $output .= '"aircraft_shadow": "aircraft.png",'; |
|
383 | + if ($compress) { |
|
384 | + $output .= '"as": "aircraft.png",'; |
|
385 | + } else { |
|
386 | + $output .= '"aircraft_shadow": "aircraft.png",'; |
|
387 | + } |
|
299 | 388 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Helicopter') { |
300 | - if ($compress) $output .= '"as": "helico.png",'; |
|
301 | - else $output .= '"aircraft_shadow": "helico.png",'; |
|
389 | + if ($compress) { |
|
390 | + $output .= '"as": "helico.png",'; |
|
391 | + } else { |
|
392 | + $output .= '"aircraft_shadow": "helico.png",'; |
|
393 | + } |
|
302 | 394 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Railroad Engine') { |
303 | - if ($compress) $output .= '"as": "rail.png",'; |
|
304 | - else $output .= '"aircraft_shadow": "rail.png",'; |
|
395 | + if ($compress) { |
|
396 | + $output .= '"as": "rail.png",'; |
|
397 | + } else { |
|
398 | + $output .= '"aircraft_shadow": "rail.png",'; |
|
399 | + } |
|
305 | 400 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Firetruck') { |
306 | - if ($compress) $output .= '"as": "firetruck.png",'; |
|
307 | - else $output .= '"aircraft_shadow": "firetruck.png",'; |
|
401 | + if ($compress) { |
|
402 | + $output .= '"as": "firetruck.png",'; |
|
403 | + } else { |
|
404 | + $output .= '"aircraft_shadow": "firetruck.png",'; |
|
405 | + } |
|
308 | 406 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Bus') { |
309 | - if ($compress) $output .= '"as": "bus.png",'; |
|
310 | - else $output .= '"aircraft_shadow": "bus.png",'; |
|
407 | + if ($compress) { |
|
408 | + $output .= '"as": "bus.png",'; |
|
409 | + } else { |
|
410 | + $output .= '"aircraft_shadow": "bus.png",'; |
|
411 | + } |
|
311 | 412 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Phone') { |
312 | - if ($compress) $output .= '"as": "phone.png",'; |
|
313 | - else $output .= '"aircraft_shadow": "phone.png",'; |
|
413 | + if ($compress) { |
|
414 | + $output .= '"as": "phone.png",'; |
|
415 | + } else { |
|
416 | + $output .= '"aircraft_shadow": "phone.png",'; |
|
417 | + } |
|
314 | 418 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Jogger') { |
315 | - if ($compress) $output .= '"as": "jogger.png",'; |
|
316 | - else $output .= '"aircraft_shadow": "jogger.png",'; |
|
419 | + if ($compress) { |
|
420 | + $output .= '"as": "jogger.png",'; |
|
421 | + } else { |
|
422 | + $output .= '"aircraft_shadow": "jogger.png",'; |
|
423 | + } |
|
317 | 424 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Bike') { |
318 | - if ($compress) $output .= '"as": "bike.png",'; |
|
319 | - else $output .= '"aircraft_shadow": "bike.png",'; |
|
425 | + if ($compress) { |
|
426 | + $output .= '"as": "bike.png",'; |
|
427 | + } else { |
|
428 | + $output .= '"aircraft_shadow": "bike.png",'; |
|
429 | + } |
|
320 | 430 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Motorcycle') { |
321 | - if ($compress) $output .= '"as": "motorcycle.png",'; |
|
322 | - else $output .= '"aircraft_shadow": "motorcycle.png",'; |
|
431 | + if ($compress) { |
|
432 | + $output .= '"as": "motorcycle.png",'; |
|
433 | + } else { |
|
434 | + $output .= '"aircraft_shadow": "motorcycle.png",'; |
|
435 | + } |
|
323 | 436 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Balloon') { |
324 | - if ($compress) $output .= '"as": "balloon.png",'; |
|
325 | - else $output .= '"aircraft_shadow": "balloon.png",'; |
|
437 | + if ($compress) { |
|
438 | + $output .= '"as": "balloon.png",'; |
|
439 | + } else { |
|
440 | + $output .= '"aircraft_shadow": "balloon.png",'; |
|
441 | + } |
|
326 | 442 | } else { |
327 | - if ($compress) $output .= '"as": "car.png",'; |
|
328 | - else $output .= '"aircraft_shadow": "car.png",'; |
|
443 | + if ($compress) { |
|
444 | + $output .= '"as": "car.png",'; |
|
445 | + } else { |
|
446 | + $output .= '"aircraft_shadow": "car.png",'; |
|
447 | + } |
|
329 | 448 | } |
330 | 449 | } elseif ($marine) { |
331 | - if ($compress) $output .= '"as": "ship.png",'; |
|
332 | - else $output .= '"aircraft_shadow": "ship.png",'; |
|
450 | + if ($compress) { |
|
451 | + $output .= '"as": "ship.png",'; |
|
452 | + } else { |
|
453 | + $output .= '"aircraft_shadow": "ship.png",'; |
|
454 | + } |
|
333 | 455 | } else { |
334 | - if ($compress) $output .= '"as": "default.png",'; |
|
335 | - else $output .= '"aircraft_shadow": "default.png",'; |
|
456 | + if ($compress) { |
|
457 | + $output .= '"as": "default.png",'; |
|
458 | + } else { |
|
459 | + $output .= '"aircraft_shadow": "default.png",'; |
|
460 | + } |
|
336 | 461 | } |
337 | 462 | } else { |
338 | - if ($compress) $output .= '"as": "'.$spotter_item['aircraft_shadow'].'",'; |
|
339 | - else $output .= '"aircraft_shadow": "'.$spotter_item['aircraft_shadow'].'",'; |
|
463 | + if ($compress) { |
|
464 | + $output .= '"as": "'.$spotter_item['aircraft_shadow'].'",'; |
|
465 | + } else { |
|
466 | + $output .= '"aircraft_shadow": "'.$spotter_item['aircraft_shadow'].'",'; |
|
467 | + } |
|
340 | 468 | } |
341 | 469 | if (isset($spotter_item['airline_name'])) { |
342 | 470 | $output .= '"airline_name": "'.$spotter_item['airline_name'].'",'; |
@@ -344,8 +472,11 @@ discard block |
||
344 | 472 | $output .= '"airline_name": "NA",'; |
345 | 473 | } |
346 | 474 | if (isset($spotter_item['departure_airport'])) { |
347 | - if ($compress) $output .= '"dac": "'.$spotter_item['departure_airport'].'",'; |
|
348 | - else $output .= '"departure_airport_code": "'.$spotter_item['departure_airport'].'",'; |
|
475 | + if ($compress) { |
|
476 | + $output .= '"dac": "'.$spotter_item['departure_airport'].'",'; |
|
477 | + } else { |
|
478 | + $output .= '"departure_airport_code": "'.$spotter_item['departure_airport'].'",'; |
|
479 | + } |
|
349 | 480 | } |
350 | 481 | if (isset($spotter_item['departure_airport_city'])) { |
351 | 482 | $output .= '"departure_airport": "'.$spotter_item['departure_airport_city'].', '.$spotter_item['departure_airport_country'].'",'; |
@@ -357,8 +488,11 @@ discard block |
||
357 | 488 | $output .= '"arrival_airport_time": "'.$spotter_item['arrival_airport_time'].'",'; |
358 | 489 | } |
359 | 490 | if (isset($spotter_item['arrival_airport'])) { |
360 | - if ($compress) $output .= '"aac": "'.$spotter_item['arrival_airport'].'",'; |
|
361 | - else $output .= '"arrival_airport_code": "'.$spotter_item['arrival_airport'].'",'; |
|
491 | + if ($compress) { |
|
492 | + $output .= '"aac": "'.$spotter_item['arrival_airport'].'",'; |
|
493 | + } else { |
|
494 | + $output .= '"arrival_airport_code": "'.$spotter_item['arrival_airport'].'",'; |
|
495 | + } |
|
362 | 496 | } |
363 | 497 | if (isset($spotter_item['arrival_airport_city'])) { |
364 | 498 | $output .= '"arrival_airport": "'.$spotter_item['arrival_airport_city'].', '.$spotter_item['arrival_airport_country'].'",'; |
@@ -377,11 +511,17 @@ discard block |
||
377 | 511 | } |
378 | 512 | |
379 | 513 | if (isset($spotter_item['altitude'])) { |
380 | - if ($compress) $output .= '"a": "'.$spotter_item['altitude'].'",'; |
|
381 | - else $output .= '"altitude": "'.$spotter_item['altitude'].'",'; |
|
514 | + if ($compress) { |
|
515 | + $output .= '"a": "'.$spotter_item['altitude'].'",'; |
|
516 | + } else { |
|
517 | + $output .= '"altitude": "'.$spotter_item['altitude'].'",'; |
|
518 | + } |
|
519 | + } |
|
520 | + if ($compress) { |
|
521 | + $output .= '"h": "'.$spotter_item['heading'].'",'; |
|
522 | + } else { |
|
523 | + $output .= '"heading": "'.$spotter_item['heading'].'",'; |
|
382 | 524 | } |
383 | - if ($compress)$output .= '"h": "'.$spotter_item['heading'].'",'; |
|
384 | - else $output .= '"heading": "'.$spotter_item['heading'].'",'; |
|
385 | 525 | |
386 | 526 | if (isset($archivespeed)) { |
387 | 527 | $nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$spotter_item['heading'],$archivespeed); |
@@ -391,7 +531,9 @@ discard block |
||
391 | 531 | $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],'; |
392 | 532 | } |
393 | 533 | |
394 | - if (!$min) $output .= '"image": "'.$image.'",'; |
|
534 | + if (!$min) { |
|
535 | + $output .= '"image": "'.$image.'",'; |
|
536 | + } |
|
395 | 537 | if (isset($spotter_item['image_copyright']) && $spotter_item['image_copyright'] != '') { |
396 | 538 | $output .= '"image_copyright": "'.str_replace('"',"'",trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'',$spotter_item['image_copyright']))).'",'; |
397 | 539 | } |
@@ -399,8 +541,11 @@ discard block |
||
399 | 541 | $output .= '"image_source_website": "'.urlencode($spotter_item['image_source_website']).'",'; |
400 | 542 | } |
401 | 543 | if (isset($spotter_item['squawk'])) { |
402 | - if ($compress) $output .= '"sq": "'.$spotter_item['squawk'].'",'; |
|
403 | - else $output .= '"squawk": "'.$spotter_item['squawk'].'",'; |
|
544 | + if ($compress) { |
|
545 | + $output .= '"sq": "'.$spotter_item['squawk'].'",'; |
|
546 | + } else { |
|
547 | + $output .= '"squawk": "'.$spotter_item['squawk'].'",'; |
|
548 | + } |
|
404 | 549 | } |
405 | 550 | if (isset($spotter_item['squawk_usage'])) { |
406 | 551 | $output .= '"squawk_usage": "'.$spotter_item['squawk_usage'].'",'; |
@@ -419,14 +564,23 @@ discard block |
||
419 | 564 | } |
420 | 565 | // type when not aircraft ? |
421 | 566 | if (isset($spotter_item['type'])) { |
422 | - if ($compress) $output .= '"t": "'.$spotter_item['type'].'"'; |
|
423 | - else $output .= '"type": "'.$spotter_item['type'].'"'; |
|
567 | + if ($compress) { |
|
568 | + $output .= '"t": "'.$spotter_item['type'].'"'; |
|
569 | + } else { |
|
570 | + $output .= '"type": "'.$spotter_item['type'].'"'; |
|
571 | + } |
|
424 | 572 | } elseif ($marine) { |
425 | - if ($compress) $output .= '"t": "ship"'; |
|
426 | - else $output .= '"type": "ship"'; |
|
573 | + if ($compress) { |
|
574 | + $output .= '"t": "ship"'; |
|
575 | + } else { |
|
576 | + $output .= '"type": "ship"'; |
|
577 | + } |
|
427 | 578 | } else { |
428 | - if ($compress) $output .= '"t": "aircraft"'; |
|
429 | - else $output .= '"type": "aircraft"'; |
|
579 | + if ($compress) { |
|
580 | + $output .= '"t": "aircraft"'; |
|
581 | + } else { |
|
582 | + $output .= '"type": "aircraft"'; |
|
583 | + } |
|
430 | 584 | } |
431 | 585 | $output .= '},'; |
432 | 586 | $output .= '"geometry": {'; |
@@ -494,7 +648,9 @@ discard block |
||
494 | 648 | } |
495 | 649 | */ |
496 | 650 | $history = filter_input(INPUT_GET,'history',FILTER_SANITIZE_STRING); |
497 | - if ($history == '' && isset($_COOKIE['history'])) $history = $_COOKIE['history']; |
|
651 | + if ($history == '' && isset($_COOKIE['history'])) { |
|
652 | + $history = $_COOKIE['history']; |
|
653 | + } |
|
498 | 654 | |
499 | 655 | if ( |
500 | 656 | (isset($_COOKIE['flightpath']) && $_COOKIE['flightpath'] == 'true') |
@@ -534,8 +690,11 @@ discard block |
||
534 | 690 | $output_history .= ']}},'; |
535 | 691 | $output .= $output_history; |
536 | 692 | } |
537 | - if ($compress) $output_history = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "history","a": "'.$alt.'"},"geometry": {"type": "LineString","coordinates": ['; |
|
538 | - else $output_history = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "history","altitude": "'.$alt.'"},"geometry": {"type": "LineString","coordinates": ['; |
|
693 | + if ($compress) { |
|
694 | + $output_history = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "history","a": "'.$alt.'"},"geometry": {"type": "LineString","coordinates": ['; |
|
695 | + } else { |
|
696 | + $output_history = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "history","altitude": "'.$alt.'"},"geometry": {"type": "LineString","coordinates": ['; |
|
697 | + } |
|
539 | 698 | } |
540 | 699 | $output_history .= '['; |
541 | 700 | $output_history .= $spotter_history['longitude'].', '; |
@@ -554,9 +713,14 @@ discard block |
||
554 | 713 | $prev_alt = $alt; |
555 | 714 | } else { |
556 | 715 | if ($d == false) { |
557 | - if ($compress) $output_history = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "history"},"geometry": {"type": "LineString","coordinates": ['; |
|
558 | - else $output_history = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "history"},"geometry": {"type": "LineString","coordinates": ['; |
|
559 | - } else $d = true; |
|
716 | + if ($compress) { |
|
717 | + $output_history = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "history"},"geometry": {"type": "LineString","coordinates": ['; |
|
718 | + } else { |
|
719 | + $output_history = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "history"},"geometry": {"type": "LineString","coordinates": ['; |
|
720 | + } |
|
721 | + } else { |
|
722 | + $d = true; |
|
723 | + } |
|
560 | 724 | $output_history .= '['; |
561 | 725 | $output_history .= $spotter_history['longitude'].', '; |
562 | 726 | $output_history .= $spotter_history['latitude']; |
@@ -577,7 +741,9 @@ discard block |
||
577 | 741 | $output_historyd = '['; |
578 | 742 | $output_historyd .= $spotter_item['longitude'].', '; |
579 | 743 | $output_historyd .= $spotter_item['latitude']; |
580 | - if (isset($spotter_history['altitude'])) $output_historyd .= ','.$spotter_item['altitude']*30.48; |
|
744 | + if (isset($spotter_history['altitude'])) { |
|
745 | + $output_historyd .= ','.$spotter_item['altitude']*30.48; |
|
746 | + } |
|
581 | 747 | $output_historyd .= '],'; |
582 | 748 | //$output_history = $output_historyd.$output_history; |
583 | 749 | $output_history = $output_history.$output_historyd; |
@@ -618,7 +784,9 @@ discard block |
||
618 | 784 | $output .= ']'; |
619 | 785 | $output .= ',"initial_sqltime": "'.$sqltime.'",'; |
620 | 786 | $output .= '"totaltime": "'.round(microtime(true)-$begintime,2).'",'; |
621 | - if (isset($begindate)) $output .= '"archive_date": "'.$begindate.'",'; |
|
787 | + if (isset($begindate)) { |
|
788 | + $output .= '"archive_date": "'.$begindate.'",'; |
|
789 | + } |
|
622 | 790 | $output .= '"fc": "'.$j.'"'; |
623 | 791 | } else { |
624 | 792 | $output .= '"features": '; |
@@ -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 marine_live.* FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL 30 SECOND) <= l.date GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate"; |
125 | 132 | $query = 'SELECT marine_live.* FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_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 marine_live.mmsi, marine_live.ident, marine_live.type,marine_live.fammarine_id, marine_live.latitude, marine_live.longitude, marine_live.heading, marine_live.ground_speed, marine_live.date, marine_live.format_source |
150 | 159 | FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate'.$filter_query." marine_live.latitude <> 0 AND marine_live.longitude <> 0"; |
@@ -178,7 +187,9 @@ discard block |
||
178 | 187 | |
179 | 188 | $filter_query = $this->getFilter($filter,true,true); |
180 | 189 | |
181 | - if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
|
190 | + if (!isset($globalLiveInterval)) { |
|
191 | + $globalLiveInterval = '200'; |
|
192 | + } |
|
182 | 193 | if ($globalDBdriver == 'mysql') { |
183 | 194 | $query = 'SELECT marine_live.ident, marine_live.fammarine_id,marine_live.type, marine_live.latitude, marine_live.longitude, marine_live.heading, marine_live.ground_speed, marine_live.date, marine_live.format_source |
184 | 195 | FROM marine_live'.$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval." SECOND) <= marine_live.date AND marine_live.latitude <> '0' AND marine_live.longitude <> '0' |
@@ -211,7 +222,9 @@ discard block |
||
211 | 222 | global $globalDBdriver, $globalLiveInterval; |
212 | 223 | $filter_query = $this->getFilter($filter,true,true); |
213 | 224 | |
214 | - if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
|
225 | + if (!isset($globalLiveInterval)) { |
|
226 | + $globalLiveInterval = '200'; |
|
227 | + } |
|
215 | 228 | if ($globalDBdriver == 'mysql') { |
216 | 229 | $query = 'SELECT COUNT(DISTINCT marine_live.fammarine_id) as nb FROM marine_live'.$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= date'; |
217 | 230 | } else { |
@@ -239,7 +252,9 @@ discard block |
||
239 | 252 | { |
240 | 253 | global $globalDBdriver, $globalLiveInterval; |
241 | 254 | $Spotter = new Spotter($this->db); |
242 | - if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
|
255 | + if (!isset($globalLiveInterval)) { |
|
256 | + $globalLiveInterval = '200'; |
|
257 | + } |
|
243 | 258 | $filter_query = $this->getFilter($filter); |
244 | 259 | |
245 | 260 | if (is_array($coord)) { |
@@ -247,7 +262,9 @@ discard block |
||
247 | 262 | $minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
248 | 263 | $maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
249 | 264 | $maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
250 | - } else return array(); |
|
265 | + } else { |
|
266 | + return array(); |
|
267 | + } |
|
251 | 268 | if ($globalDBdriver == 'mysql') { |
252 | 269 | $query = 'SELECT marine_live.* FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate AND marine_live.latitude BETWEEN '.$minlat.' AND '.$maxlat.' AND marine_live.longitude BETWEEN '.$minlong.' AND '.$maxlong.' GROUP BY marine_live.fammarine_id'.$filter_query; |
253 | 270 | } else { |
@@ -267,7 +284,9 @@ discard block |
||
267 | 284 | { |
268 | 285 | global $globalDBdriver, $globalLiveInterval; |
269 | 286 | $Spotter = new Spotter($this->db); |
270 | - if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
|
287 | + if (!isset($globalLiveInterval)) { |
|
288 | + $globalLiveInterval = '200'; |
|
289 | + } |
|
271 | 290 | $filter_query = $this->getFilter($filter); |
272 | 291 | |
273 | 292 | if (is_array($coord)) { |
@@ -275,7 +294,9 @@ discard block |
||
275 | 294 | $minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
276 | 295 | $maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
277 | 296 | $maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
278 | - } else return array(); |
|
297 | + } else { |
|
298 | + return array(); |
|
299 | + } |
|
279 | 300 | if ($globalDBdriver == 'mysql') { |
280 | 301 | $query = 'SELECT marine_live.ident, marine_live.fammarine_id,marine_live.type, marine_live.latitude, marine_live.longitude, marine_live.heading, marine_live.ground_speed, marine_live.date, marine_live.format_source |
281 | 302 | FROM marine_live'.$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval." SECOND) <= marine_live.date AND marine_live.latitude <> '0' AND marine_live.longitude <> '0' AND marine_live.latitude BETWEEN ".$minlat.' AND '.$maxlat.' AND marine_live.longitude BETWEEN '.$minlong.' AND '.$maxlong." |
@@ -443,11 +464,15 @@ discard block |
||
443 | 464 | //$query = self::$global_query.' WHERE marine_live.fammarine_id = :id ORDER BY date'; |
444 | 465 | if ($globalDBdriver == 'mysql') { |
445 | 466 | $query = 'SELECT marine_live.* FROM marine_live WHERE marine_live.fammarine_id = :id'; |
446 | - if ($liveinterval) $query .= ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= date'; |
|
467 | + if ($liveinterval) { |
|
468 | + $query .= ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= date'; |
|
469 | + } |
|
447 | 470 | $query .= ' ORDER BY date'; |
448 | 471 | } else { |
449 | 472 | $query = 'SELECT marine_live.* FROM marine_live WHERE marine_live.fammarine_id = :id'; |
450 | - if ($liveinterval) $query .= " AND CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= date"; |
|
473 | + if ($liveinterval) { |
|
474 | + $query .= " AND CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= date"; |
|
475 | + } |
|
451 | 476 | $query .= ' ORDER BY date'; |
452 | 477 | } |
453 | 478 | |
@@ -542,7 +567,9 @@ discard block |
||
542 | 567 | $i++; |
543 | 568 | $j++; |
544 | 569 | if ($j == 30) { |
545 | - if ($globalDebug) echo "."; |
|
570 | + if ($globalDebug) { |
|
571 | + echo "."; |
|
572 | + } |
|
546 | 573 | try { |
547 | 574 | |
548 | 575 | $sth = $this->db->prepare(substr($query_delete,0,-1).")"); |
@@ -822,7 +849,9 @@ discard block |
||
822 | 849 | { |
823 | 850 | return false; |
824 | 851 | } |
825 | - } else return ''; |
|
852 | + } else { |
|
853 | + return ''; |
|
854 | + } |
|
826 | 855 | |
827 | 856 | if ($longitude != '') |
828 | 857 | { |
@@ -830,7 +859,9 @@ discard block |
||
830 | 859 | { |
831 | 860 | return false; |
832 | 861 | } |
833 | - } else return ''; |
|
862 | + } else { |
|
863 | + return ''; |
|
864 | + } |
|
834 | 865 | |
835 | 866 | |
836 | 867 | if ($heading != '') |
@@ -839,7 +870,9 @@ discard block |
||
839 | 870 | { |
840 | 871 | return false; |
841 | 872 | } |
842 | - } else $heading = 0; |
|
873 | + } else { |
|
874 | + $heading = 0; |
|
875 | + } |
|
843 | 876 | |
844 | 877 | if ($groundspeed != '') |
845 | 878 | { |
@@ -847,9 +880,13 @@ discard block |
||
847 | 880 | { |
848 | 881 | return false; |
849 | 882 | } |
850 | - } else $groundspeed = 0; |
|
883 | + } else { |
|
884 | + $groundspeed = 0; |
|
885 | + } |
|
851 | 886 | date_default_timezone_set('UTC'); |
852 | - if ($date == '') $date = date("Y-m-d H:i:s", time()); |
|
887 | + if ($date == '') { |
|
888 | + $date = date("Y-m-d H:i:s", time()); |
|
889 | + } |
|
853 | 890 | |
854 | 891 | |
855 | 892 | $fammarine_id = filter_var($fammarine_id,FILTER_SANITIZE_STRING); |
@@ -870,12 +907,20 @@ discard block |
||
870 | 907 | $arrival_date = filter_var($arrival_date,FILTER_SANITIZE_STRING); |
871 | 908 | |
872 | 909 | |
873 | - if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) $groundspeed = 0; |
|
874 | - if ($heading == '' || $Common->isInteger($heading) === false ) $heading = 0; |
|
875 | - if ($arrival_date == '') $arrival_date = NULL; |
|
910 | + if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) { |
|
911 | + $groundspeed = 0; |
|
912 | + } |
|
913 | + if ($heading == '' || $Common->isInteger($heading) === false ) { |
|
914 | + $heading = 0; |
|
915 | + } |
|
916 | + if ($arrival_date == '') { |
|
917 | + $arrival_date = NULL; |
|
918 | + } |
|
876 | 919 | $query = ''; |
877 | 920 | if ($globalArchive) { |
878 | - if ($globalDebug) echo '-- Delete previous data -- '; |
|
921 | + if ($globalDebug) { |
|
922 | + echo '-- Delete previous data -- '; |
|
923 | + } |
|
879 | 924 | $query .= 'DELETE FROM marine_live WHERE fammarine_id = :fammarine_id;'; |
880 | 925 | } |
881 | 926 | $query .= 'INSERT INTO marine_live (fammarine_id, ident, latitude, longitude, heading, ground_speed, date, format_source, source_name, over_country, mmsi, type,status,imo,arrival_port_name,arrival_port_date) |
@@ -890,10 +935,14 @@ discard block |
||
890 | 935 | } |
891 | 936 | |
892 | 937 | if (isset($globalArchive) && $globalArchive && $putinarchive && $noarchive !== true) { |
893 | - if ($globalDebug) echo '(Add to Marine archive : '; |
|
938 | + if ($globalDebug) { |
|
939 | + echo '(Add to Marine archive : '; |
|
940 | + } |
|
894 | 941 | $MarineArchive = new MarineArchive($this->db); |
895 | 942 | $result = $MarineArchive->addMarineArchiveData($fammarine_id, $ident, $latitude, $longitude, $heading, $groundspeed, $date, $putinarchive, $mmsi,$type,$typeid,$imo, $callsign,$arrival_code,$arrival_date,$status,$noarchive,$format_source, $source_name, $over_country); |
896 | - if ($globalDebug) echo $result.')'; |
|
943 | + if ($globalDebug) { |
|
944 | + echo $result.')'; |
|
945 | + } |
|
897 | 946 | } |
898 | 947 | return "success"; |
899 | 948 | } |
@@ -605,7 +605,9 @@ discard block |
||
605 | 605 | $additional_query .= "(marine_archive_output.pilot_name like '%".$q_item."%') OR "; |
606 | 606 | $additional_query .= "(marine_archive_output.ident like '%".$q_item."%') OR "; |
607 | 607 | $translate = $Translation->ident2icao($q_item); |
608 | - if ($translate != $q_item) $additional_query .= "(marine_archive_output.ident like '%".$translate."%') OR "; |
|
608 | + if ($translate != $q_item) { |
|
609 | + $additional_query .= "(marine_archive_output.ident like '%".$translate."%') OR "; |
|
610 | + } |
|
609 | 611 | $additional_query .= "(marine_archive_output.highlight like '%".$q_item."%')"; |
610 | 612 | $additional_query .= ")"; |
611 | 613 | } |
@@ -823,7 +825,9 @@ discard block |
||
823 | 825 | date_default_timezone_set($globalTimezone); |
824 | 826 | $datetime = new DateTime(); |
825 | 827 | $offset = $datetime->format('P'); |
826 | - } else $offset = '+00:00'; |
|
828 | + } else { |
|
829 | + $offset = '+00:00'; |
|
830 | + } |
|
827 | 831 | |
828 | 832 | |
829 | 833 | if ($date_array[1] != "") |
@@ -1099,9 +1103,13 @@ discard block |
||
1099 | 1103 | $query .= "AND date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'"; |
1100 | 1104 | } |
1101 | 1105 | } |
1102 | - if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
|
1106 | + if ($sincedate != '') { |
|
1107 | + $query .= "AND date > '".$sincedate."' "; |
|
1108 | + } |
|
1103 | 1109 | $query .= "GROUP BY c.name, c.iso3, c.iso2 ORDER BY nb DESC"; |
1104 | - if ($limit) $query .= " LIMIT 0,10"; |
|
1110 | + if ($limit) { |
|
1111 | + $query .= " LIMIT 0,10"; |
|
1112 | + } |
|
1105 | 1113 | |
1106 | 1114 | |
1107 | 1115 | $sth = $this->db->prepare($query); |
@@ -1145,9 +1153,13 @@ discard block |
||
1145 | 1153 | $query .= "AND s.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'"; |
1146 | 1154 | } |
1147 | 1155 | } |
1148 | - if ($sincedate != '') $query .= "AND s.date > '".$sincedate."' "; |
|
1156 | + if ($sincedate != '') { |
|
1157 | + $query .= "AND s.date > '".$sincedate."' "; |
|
1158 | + } |
|
1149 | 1159 | $query .= "GROUP BY o.airline_icao,c.name, c.iso3, c.iso2 ORDER BY nb DESC"; |
1150 | - if ($limit) $query .= " LIMIT 0,10"; |
|
1160 | + if ($limit) { |
|
1161 | + $query .= " LIMIT 0,10"; |
|
1162 | + } |
|
1151 | 1163 | |
1152 | 1164 | |
1153 | 1165 | $sth = $this->db->prepare($query); |