@@ -50,30 +50,30 @@ discard block |
||
50 | 50 | |
51 | 51 | |
52 | 52 | function quaternionrotate($heading, $attitude = 0, $bank = 0) { |
53 | - // Assuming the angles are in radians. |
|
54 | - $c1 = cos($heading/2); |
|
55 | - $s1 = sin($heading/2); |
|
56 | - $c2 = cos($attitude/2); |
|
57 | - $s2 = sin($attitude/2); |
|
58 | - $c3 = cos($bank/2); |
|
59 | - $s3 = sin($bank/2); |
|
60 | - $c1c2 = $c1*$c2; |
|
61 | - $s1s2 = $s1*$s2; |
|
62 | - $w =$c1c2*$c3 - $s1s2*$s3; |
|
63 | - $x =$c1c2*$s3 + $s1s2*$c3; |
|
64 | - $y =$s1*$c2*$c3 + $c1*$s2*$s3; |
|
65 | - $z =$c1*$s2*$c3 - $s1*$c2*$s3; |
|
66 | - return array('x' => $x,'y' => $y,'z' => $z,'w' => $w); |
|
53 | + // Assuming the angles are in radians. |
|
54 | + $c1 = cos($heading/2); |
|
55 | + $s1 = sin($heading/2); |
|
56 | + $c2 = cos($attitude/2); |
|
57 | + $s2 = sin($attitude/2); |
|
58 | + $c3 = cos($bank/2); |
|
59 | + $s3 = sin($bank/2); |
|
60 | + $c1c2 = $c1*$c2; |
|
61 | + $s1s2 = $s1*$s2; |
|
62 | + $w =$c1c2*$c3 - $s1s2*$s3; |
|
63 | + $x =$c1c2*$s3 + $s1s2*$c3; |
|
64 | + $y =$s1*$c2*$c3 + $c1*$s2*$s3; |
|
65 | + $z =$c1*$s2*$c3 - $s1*$c2*$s3; |
|
66 | + return array('x' => $x,'y' => $y,'z' => $z,'w' => $w); |
|
67 | 67 | // return array('x' => '0.0','y' => '-0.931','z' => '0.0','w' => '0.365'); |
68 | 68 | |
69 | 69 | } |
70 | 70 | |
71 | 71 | |
72 | 72 | if (isset($_GET['download'])) { |
73 | - if ($_GET['download'] == "true") |
|
74 | - { |
|
73 | + if ($_GET['download'] == "true") |
|
74 | + { |
|
75 | 75 | header('Content-disposition: attachment; filename="flightairmap.json"'); |
76 | - } |
|
76 | + } |
|
77 | 77 | } |
78 | 78 | header('Content-Type: text/javascript'); |
79 | 79 | |
@@ -172,7 +172,7 @@ discard block |
||
172 | 172 | if (isset($_GET['coord']) && $_GET['coord'] != '') { |
173 | 173 | $coord = explode(',',$_GET['coord']); |
174 | 174 | if (!(filter_var($coord[0],FILTER_VALIDATE_FLOAT) && filter_var($coord[1],FILTER_VALIDATE_FLOAT) && filter_var($coord[2],FILTER_VALIDATE_FLOAT) && filter_var($coord[3],FILTER_VALIDATE_FLOAT) |
175 | - && $coord[0] > -180.0 && $coord[0] < 180.0 && $coord[1] > -90.0 && $coord[1] < 90.0 && $coord[2] > -180.0 && $coord[2] < 180.0 && $coord[3] > -90.0 && $coord[3] < 90.0)) { |
|
175 | + && $coord[0] > -180.0 && $coord[0] < 180.0 && $coord[1] > -90.0 && $coord[1] < 90.0 && $coord[2] > -180.0 && $coord[2] < 180.0 && $coord[3] > -90.0 && $coord[3] < 90.0)) { |
|
176 | 176 | $coord = array(); |
177 | 177 | } |
178 | 178 | } |
@@ -182,7 +182,7 @@ discard block |
||
182 | 182 | if (isset($_GET['coord']) && $_GET['coord'] != '') { |
183 | 183 | $coord = explode(',',$_GET['coord']); |
184 | 184 | if (!(filter_var($coord[0],FILTER_VALIDATE_FLOAT) && filter_var($coord[1],FILTER_VALIDATE_FLOAT) && filter_var($coord[2],FILTER_VALIDATE_FLOAT) && filter_var($coord[3],FILTER_VALIDATE_FLOAT) |
185 | - && $coord[0] > -180.0 && $coord[0] < 180.0 && $coord[1] > -90.0 && $coord[1] < 90.0 && $coord[2] > -180.0 && $coord[2] < 180.0 && $coord[3] > -90.0 && $coord[3] < 90.0)) { |
|
185 | + && $coord[0] > -180.0 && $coord[0] < 180.0 && $coord[1] > -90.0 && $coord[1] < 90.0 && $coord[2] > -180.0 && $coord[2] < 180.0 && $coord[3] > -90.0 && $coord[3] < 90.0)) { |
|
186 | 186 | $coord = array(); |
187 | 187 | } |
188 | 188 | } |
@@ -192,7 +192,7 @@ discard block |
||
192 | 192 | if (!((isset($_COOKIE['singlemodel']) && $_COOKIE['singlemodel'] == 'true') && (isset($_COOKIE['MapTrack']) && $_COOKIE['MapTrack'] != '')) && isset($_GET['coord']) && $_GET['coord'] != '') { |
193 | 193 | $coord = explode(',',$_GET['coord']); |
194 | 194 | if (!(filter_var($coord[0],FILTER_VALIDATE_FLOAT) && filter_var($coord[1],FILTER_VALIDATE_FLOAT) && filter_var($coord[2],FILTER_VALIDATE_FLOAT) && filter_var($coord[3],FILTER_VALIDATE_FLOAT) |
195 | - && $coord[0] > -180.0 && $coord[0] < 180.0 && $coord[1] > -90.0 && $coord[1] < 90.0 && $coord[2] > -180.0 && $coord[2] < 180.0 && $coord[3] > -90.0 && $coord[3] < 90.0)) { |
|
195 | + && $coord[0] > -180.0 && $coord[0] < 180.0 && $coord[1] > -90.0 && $coord[1] < 90.0 && $coord[2] > -180.0 && $coord[2] < 180.0 && $coord[3] > -90.0 && $coord[3] < 90.0)) { |
|
196 | 196 | $coord = array(); |
197 | 197 | } |
198 | 198 | } |
@@ -301,10 +301,10 @@ discard block |
||
301 | 301 | $image = "images/placeholder_thumb.png"; |
302 | 302 | } |
303 | 303 | |
304 | - if (isset($spotter_item['flightaware_id'])) $id = $spotter_item['flightaware_id']; |
|
305 | - elseif (isset($spotter_item['famtrackid'])) $id = $spotter_item['famtrackid']; |
|
306 | - elseif (isset($spotter_item['fammarine_id'])) $id = $spotter_item['fammarine_id']; |
|
307 | - if ($prev_flightaware_id != $id) { |
|
304 | + if (isset($spotter_item['flightaware_id'])) $id = $spotter_item['flightaware_id']; |
|
305 | + elseif (isset($spotter_item['famtrackid'])) $id = $spotter_item['famtrackid']; |
|
306 | + elseif (isset($spotter_item['fammarine_id'])) $id = $spotter_item['fammarine_id']; |
|
307 | + if ($prev_flightaware_id != $id) { |
|
308 | 308 | if ($prev_flightaware_id != '') { |
309 | 309 | /* |
310 | 310 | if ($nblatlong == 1) { |
@@ -384,7 +384,7 @@ discard block |
||
384 | 384 | $spotter_item['wake_category'] = $aircraft_info[0]['wake_category']; |
385 | 385 | $spotter_item['engine_count'] = $aircraft_info[0]['engine_count']; |
386 | 386 | } else $aircraft_shadow = ''; |
387 | - $output .= ' "billboard" : {"image" : "'.$globalURL.'/images/aircrafts/new/'.$aircraft_shadow.'","scale" : 0.5'; |
|
387 | + $output .= ' "billboard" : {"image" : "'.$globalURL.'/images/aircrafts/new/'.$aircraft_shadow.'","scale" : 0.5'; |
|
388 | 388 | if (isset($_COOKIE['IconColorForce']) && $_COOKIE['IconColorForce'] == 'true' && isset($_COOKIE['IconColor'])) { |
389 | 389 | $rgb = $Common->hex2rgb($_COOKIE['IconColor']); |
390 | 390 | $output .= ',"color": {"rgba" : ['.$rgb[0].','.$rgb[1].','.$rgb[2].',255]}'; |
@@ -415,7 +415,7 @@ discard block |
||
415 | 415 | $rgb = $Common->hex2rgb($_COOKIE['IconColor']); |
416 | 416 | $output .= ',"color": {"rgba" : ['.$rgb[0].','.$rgb[1].','.$rgb[2].',255]}'; |
417 | 417 | } |
418 | - $output .= '},'; |
|
418 | + $output .= '},'; |
|
419 | 419 | } elseif (isset($modelsdb[$aircraft_icao]) && $aircraft_icao != '') { |
420 | 420 | $output .= '"model": {"gltf" : "'.$globalURL.'/models/'.$modelsdb[$aircraft_icao].'","scale" : '.$scale.',"minimumPixelSize": '.$minimumpixelsize.''; |
421 | 421 | $output .= ',"heightReference": "'.$heightrelative.'"'; |
@@ -423,7 +423,7 @@ discard block |
||
423 | 423 | $rgb = $Common->hex2rgb($_COOKIE['IconColor']); |
424 | 424 | $output .= ',"color": {"rgba" : ['.$rgb[0].','.$rgb[1].','.$rgb[2].',255]}'; |
425 | 425 | } |
426 | - $output .= '},'; |
|
426 | + $output .= '},'; |
|
427 | 427 | } elseif ($aircraft_icao != '') { |
428 | 428 | $aircraft_info = $Spotter->getAllAircraftInfo($aircraft_icao); |
429 | 429 | if (isset($aircraft_info[0]['engine_type'])) { |
@@ -19,8 +19,12 @@ discard block |
||
19 | 19 | } |
20 | 20 | $tracker = false; |
21 | 21 | $marine = false; |
22 | -if (isset($_GET['tracker'])) $tracker = true; |
|
23 | -if (isset($_GET['marine'])) $marine = true; |
|
22 | +if (isset($_GET['tracker'])) { |
|
23 | + $tracker = true; |
|
24 | +} |
|
25 | +if (isset($_GET['marine'])) { |
|
26 | + $marine = true; |
|
27 | +} |
|
24 | 28 | if ($tracker) { |
25 | 29 | require_once('require/class.Tracker.php'); |
26 | 30 | require_once('require/class.TrackerLive.php'); |
@@ -77,24 +81,49 @@ discard block |
||
77 | 81 | } |
78 | 82 | header('Content-Type: text/javascript'); |
79 | 83 | |
80 | -if (!isset($globalJsonCompress)) $compress = true; |
|
81 | -else $compress = $globalJsonCompress; |
|
84 | +if (!isset($globalJsonCompress)) { |
|
85 | + $compress = true; |
|
86 | +} else { |
|
87 | + $compress = $globalJsonCompress; |
|
88 | +} |
|
82 | 89 | |
83 | 90 | $from_archive = false; |
84 | 91 | $min = false; |
85 | 92 | $allhistory = false; |
86 | 93 | $filter['source'] = array(); |
87 | -if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') $filter['source'] = array_merge($filter['source'],array('vatsimtxt')); |
|
88 | -if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') $filter['source'] = array_merge($filter['source'],array('whazzup')); |
|
89 | -if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') $filter['source'] = array_merge($filter['source'],array('phpvmacars')); |
|
90 | -if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') $filter['source'] = array_merge($filter['source'],array('sbs','famaprs')); |
|
91 | -if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') $filter['source'] = array_merge($filter['source'],array('aprs')); |
|
92 | -if (isset($_COOKIE['filter_ident']) && $_COOKIE['filter_ident'] != '') $filter['ident'] = filter_var($_COOKIE['filter_ident'],FILTER_SANITIZE_STRING); |
|
93 | -if (isset($_COOKIE['filter_mmsi']) && $_COOKIE['filter_mmsi'] != '') $filter['mmsi'] = filter_var($_COOKIE['filter_mmsi'],FILTER_SANITIZE_STRING); |
|
94 | -if (isset($_COOKIE['filter_Airlines']) && $_COOKIE['filter_Airlines'] != '') $filter['airlines'] = filter_var_array(explode(',',$_COOKIE['filter_Airlines']),FILTER_SANITIZE_STRING); |
|
95 | -if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') $filter['source_aprs'] = filter_var_array(explode(',',$_COOKIE['filter_Sources']),FILTER_SANITIZE_STRING); |
|
96 | -if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') $filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'],FILTER_SANITIZE_STRING); |
|
97 | -if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] != 'all') $filter['alliance'] = filter_var($_COOKIE['filter_alliance'],FILTER_SANITIZE_STRING); |
|
94 | +if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') { |
|
95 | + $filter['source'] = array_merge($filter['source'],array('vatsimtxt')); |
|
96 | +} |
|
97 | +if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') { |
|
98 | + $filter['source'] = array_merge($filter['source'],array('whazzup')); |
|
99 | +} |
|
100 | +if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') { |
|
101 | + $filter['source'] = array_merge($filter['source'],array('phpvmacars')); |
|
102 | +} |
|
103 | +if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') { |
|
104 | + $filter['source'] = array_merge($filter['source'],array('sbs','famaprs')); |
|
105 | +} |
|
106 | +if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') { |
|
107 | + $filter['source'] = array_merge($filter['source'],array('aprs')); |
|
108 | +} |
|
109 | +if (isset($_COOKIE['filter_ident']) && $_COOKIE['filter_ident'] != '') { |
|
110 | + $filter['ident'] = filter_var($_COOKIE['filter_ident'],FILTER_SANITIZE_STRING); |
|
111 | +} |
|
112 | +if (isset($_COOKIE['filter_mmsi']) && $_COOKIE['filter_mmsi'] != '') { |
|
113 | + $filter['mmsi'] = filter_var($_COOKIE['filter_mmsi'],FILTER_SANITIZE_STRING); |
|
114 | +} |
|
115 | +if (isset($_COOKIE['filter_Airlines']) && $_COOKIE['filter_Airlines'] != '') { |
|
116 | + $filter['airlines'] = filter_var_array(explode(',',$_COOKIE['filter_Airlines']),FILTER_SANITIZE_STRING); |
|
117 | +} |
|
118 | +if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') { |
|
119 | + $filter['source_aprs'] = filter_var_array(explode(',',$_COOKIE['filter_Sources']),FILTER_SANITIZE_STRING); |
|
120 | +} |
|
121 | +if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') { |
|
122 | + $filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'],FILTER_SANITIZE_STRING); |
|
123 | +} |
|
124 | +if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] != 'all') { |
|
125 | + $filter['alliance'] = filter_var($_COOKIE['filter_alliance'],FILTER_SANITIZE_STRING); |
|
126 | +} |
|
98 | 127 | /* |
99 | 128 | if (isset($globalMapPopup) && !$globalMapPopup && !(isset($_COOKIE['flightpopup']) && $_COOKIE['flightpopup'] == 'true')) { |
100 | 129 | $min = true; |
@@ -268,8 +297,12 @@ discard block |
||
268 | 297 | $flightcnt = $SpotterLive->getLiveSpotterCount($filter); |
269 | 298 | } |
270 | 299 | } |
271 | - if ($flightcnt == '') $flightcnt = 0; |
|
272 | -} else $flightcnt = 0; |
|
300 | + if ($flightcnt == '') { |
|
301 | + $flightcnt = 0; |
|
302 | + } |
|
303 | + } else { |
|
304 | + $flightcnt = 0; |
|
305 | +} |
|
273 | 306 | |
274 | 307 | $sqltime = round(microtime(true)-$begintime,2); |
275 | 308 | $minitime = time(); |
@@ -315,7 +348,9 @@ discard block |
||
315 | 348 | $gltf2 = false; |
316 | 349 | $scale = 1.0; |
317 | 350 | $minimumpixelsize = 20; |
318 | -if (isset($archivespeed)) $speed = $archivespeed; |
|
351 | +if (isset($archivespeed)) { |
|
352 | + $speed = $archivespeed; |
|
353 | +} |
|
319 | 354 | $output = '['; |
320 | 355 | if ($tracker) { |
321 | 356 | $output .= '{"id" : "document", "name" : "tracker","version" : "1.0"'; |
@@ -351,9 +386,13 @@ discard block |
||
351 | 386 | $image = "images/placeholder_thumb.png"; |
352 | 387 | } |
353 | 388 | |
354 | - if (isset($spotter_item['flightaware_id'])) $id = $spotter_item['flightaware_id']; |
|
355 | - elseif (isset($spotter_item['famtrackid'])) $id = $spotter_item['famtrackid']; |
|
356 | - elseif (isset($spotter_item['fammarine_id'])) $id = $spotter_item['fammarine_id']; |
|
389 | + if (isset($spotter_item['flightaware_id'])) { |
|
390 | + $id = $spotter_item['flightaware_id']; |
|
391 | + } elseif (isset($spotter_item['famtrackid'])) { |
|
392 | + $id = $spotter_item['famtrackid']; |
|
393 | + } elseif (isset($spotter_item['fammarine_id'])) { |
|
394 | + $id = $spotter_item['fammarine_id']; |
|
395 | + } |
|
357 | 396 | if ($prev_flightaware_id != $id) { |
358 | 397 | if ($prev_flightaware_id != '') { |
359 | 398 | /* |
@@ -391,14 +430,24 @@ discard block |
||
391 | 430 | if (isset($spotter_item['squawk'])) { |
392 | 431 | $output .= '"squawk": "'.$spotter_item['squawk'].'",'; |
393 | 432 | } |
394 | - if (isset($spotter_item['registration'])) $output .= '"registration": "'.$spotter_item['registration'].'",'; |
|
395 | - if (isset($spotter_item['format_source'])) $output .= '"format": "'.$spotter_item['format_source'].'",'; |
|
396 | - if (isset($spotter_item['ident'])) $output.= '"ident": "'.$spotter_item['ident'].'",'; |
|
433 | + if (isset($spotter_item['registration'])) { |
|
434 | + $output .= '"registration": "'.$spotter_item['registration'].'",'; |
|
435 | + } |
|
436 | + if (isset($spotter_item['format_source'])) { |
|
437 | + $output .= '"format": "'.$spotter_item['format_source'].'",'; |
|
438 | + } |
|
439 | + if (isset($spotter_item['ident'])) { |
|
440 | + $output.= '"ident": "'.$spotter_item['ident'].'",'; |
|
441 | + } |
|
397 | 442 | if ($tracker) { |
398 | - if (isset($spotter_item['type'])) $output .= '"tracker_type": "'.$spotter_item['type'].'",'; |
|
443 | + if (isset($spotter_item['type'])) { |
|
444 | + $output .= '"tracker_type": "'.$spotter_item['type'].'",'; |
|
445 | + } |
|
399 | 446 | $output.= '"type": "tracker"'; |
400 | 447 | } elseif ($marine) { |
401 | - if (isset($spotter_item['type'])) $output .= '"marine_type": "'.$spotter_item['type'].'",'; |
|
448 | + if (isset($spotter_item['type'])) { |
|
449 | + $output .= '"marine_type": "'.$spotter_item['type'].'",'; |
|
450 | + } |
|
402 | 451 | $output.= '"type": "marine"'; |
403 | 452 | } else { |
404 | 453 | if ($one3dmodel === false && isset($globalMap3DLiveries) && $globalMap3DLiveries) { |
@@ -449,7 +498,9 @@ discard block |
||
449 | 498 | $spotter_item['engine_type'] = $aircraft_info[0]['engine_type']; |
450 | 499 | $spotter_item['wake_category'] = $aircraft_info[0]['wake_category']; |
451 | 500 | $spotter_item['engine_count'] = $aircraft_info[0]['engine_count']; |
452 | - } else $aircraft_shadow = ''; |
|
501 | + } else { |
|
502 | + $aircraft_shadow = ''; |
|
503 | + } |
|
453 | 504 | $output .= ' "billboard" : {"image" : "'.$globalURL.'/images/aircrafts/new/'.$aircraft_shadow.'","scale" : 0.5'; |
454 | 505 | if (isset($_COOKIE['IconColorForce']) && $_COOKIE['IconColorForce'] == 'true' && isset($_COOKIE['IconColor'])) { |
455 | 506 | $rgb = $Common->hex2rgb($_COOKIE['IconColor']); |
@@ -457,7 +508,9 @@ discard block |
||
457 | 508 | } |
458 | 509 | $output .= '},'; |
459 | 510 | } |
460 | - } else $output .= ' "billboard" : {"image" : "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACgAAAAfCAYAAACVgY94AAAACXBIWXMAAC4jAAAuIwF4pT92AAAKT2lDQ1BQaG90b3Nob3AgSUNDIHByb2ZpbGUAAHjanVNnVFPpFj333vRCS4iAlEtvUhUIIFJCi4AUkSYqIQkQSoghodkVUcERRUUEG8igiAOOjoCMFVEsDIoK2AfkIaKOg6OIisr74Xuja9a89+bN/rXXPues852zzwfACAyWSDNRNYAMqUIeEeCDx8TG4eQuQIEKJHAAEAizZCFz/SMBAPh+PDwrIsAHvgABeNMLCADATZvAMByH/w/qQplcAYCEAcB0kThLCIAUAEB6jkKmAEBGAYCdmCZTAKAEAGDLY2LjAFAtAGAnf+bTAICd+Jl7AQBblCEVAaCRACATZYhEAGg7AKzPVopFAFgwABRmS8Q5ANgtADBJV2ZIALC3AMDOEAuyAAgMADBRiIUpAAR7AGDIIyN4AISZABRG8lc88SuuEOcqAAB4mbI8uSQ5RYFbCC1xB1dXLh4ozkkXKxQ2YQJhmkAuwnmZGTKBNA/g88wAAKCRFRHgg/P9eM4Ors7ONo62Dl8t6r8G/yJiYuP+5c+rcEAAAOF0ftH+LC+zGoA7BoBt/qIl7gRoXgugdfeLZrIPQLUAoOnaV/Nw+H48PEWhkLnZ2eXk5NhKxEJbYcpXff5nwl/AV/1s+X48/Pf14L7iJIEyXYFHBPjgwsz0TKUcz5IJhGLc5o9H/LcL//wd0yLESWK5WCoU41EScY5EmozzMqUiiUKSKcUl0v9k4t8s+wM+3zUAsGo+AXuRLahdYwP2SycQWHTA4vcAAPK7b8HUKAgDgGiD4c93/+8//UegJQCAZkmScQAAXkQkLlTKsz/HCAAARKCBKrBBG/TBGCzABhzBBdzBC/xgNoRCJMTCQhBCCmSAHHJgKayCQiiGzbAdKmAv1EAdNMBRaIaTcA4uwlW4Dj1wD/phCJ7BKLyBCQRByAgTYSHaiAFiilgjjggXmYX4IcFIBBKLJCDJiBRRIkuRNUgxUopUIFVIHfI9cgI5h1xGupE7yAAygvyGvEcxlIGyUT3UDLVDuag3GoRGogvQZHQxmo8WoJvQcrQaPYw2oefQq2gP2o8+Q8cwwOgYBzPEbDAuxsNCsTgsCZNjy7EirAyrxhqwVqwDu4n1Y8+xdwQSgUXACTYEd0IgYR5BSFhMWE7YSKggHCQ0EdoJNwkDhFHCJyKTqEu0JroR+cQYYjIxh1hILCPWEo8TLxB7iEPENyQSiUMyJ7mQAkmxpFTSEtJG0m5SI+ksqZs0SBojk8naZGuyBzmULCAryIXkneTD5DPkG+Qh8lsKnWJAcaT4U+IoUspqShnlEOU05QZlmDJBVaOaUt2ooVQRNY9aQq2htlKvUYeoEzR1mjnNgxZJS6WtopXTGmgXaPdpr+h0uhHdlR5Ol9BX0svpR+iX6AP0dwwNhhWDx4hnKBmbGAcYZxl3GK+YTKYZ04sZx1QwNzHrmOeZD5lvVVgqtip8FZHKCpVKlSaVGyovVKmqpqreqgtV81XLVI+pXlN9rkZVM1PjqQnUlqtVqp1Q61MbU2epO6iHqmeob1Q/pH5Z/YkGWcNMw09DpFGgsV/jvMYgC2MZs3gsIWsNq4Z1gTXEJrHN2Xx2KruY/R27iz2qqaE5QzNKM1ezUvOUZj8H45hx+Jx0TgnnKKeX836K3hTvKeIpG6Y0TLkxZVxrqpaXllirSKtRq0frvTau7aedpr1Fu1n7gQ5Bx0onXCdHZ4/OBZ3nU9lT3acKpxZNPTr1ri6qa6UbobtEd79up+6Ynr5egJ5Mb6feeb3n+hx9L/1U/W36p/VHDFgGswwkBtsMzhg8xTVxbzwdL8fb8VFDXcNAQ6VhlWGX4YSRudE8o9VGjUYPjGnGXOMk423GbcajJgYmISZLTepN7ppSTbmmKaY7TDtMx83MzaLN1pk1mz0x1zLnm+eb15vft2BaeFostqi2uGVJsuRaplnutrxuhVo5WaVYVVpds0atna0l1rutu6cRp7lOk06rntZnw7Dxtsm2qbcZsOXYBtuutm22fWFnYhdnt8Wuw+6TvZN9un2N/T0HDYfZDqsdWh1+c7RyFDpWOt6azpzuP33F9JbpL2dYzxDP2DPjthPLKcRpnVOb00dnF2e5c4PziIuJS4LLLpc+Lpsbxt3IveRKdPVxXeF60vWdm7Obwu2o26/uNu5p7ofcn8w0nymeWTNz0MPIQ+BR5dE/C5+VMGvfrH5PQ0+BZ7XnIy9jL5FXrdewt6V3qvdh7xc+9j5yn+M+4zw33jLeWV/MN8C3yLfLT8Nvnl+F30N/I/9k/3r/0QCngCUBZwOJgUGBWwL7+Hp8Ib+OPzrbZfay2e1BjKC5QRVBj4KtguXBrSFoyOyQrSH355jOkc5pDoVQfujW0Adh5mGLw34MJ4WHhVeGP45wiFga0TGXNXfR3ENz30T6RJZE3ptnMU85ry1KNSo+qi5qPNo3ujS6P8YuZlnM1VidWElsSxw5LiquNm5svt/87fOH4p3iC+N7F5gvyF1weaHOwvSFpxapLhIsOpZATIhOOJTwQRAqqBaMJfITdyWOCnnCHcJnIi/RNtGI2ENcKh5O8kgqTXqS7JG8NXkkxTOlLOW5hCepkLxMDUzdmzqeFpp2IG0yPTq9MYOSkZBxQqohTZO2Z+pn5mZ2y6xlhbL+xW6Lty8elQfJa7OQrAVZLQq2QqboVFoo1yoHsmdlV2a/zYnKOZarnivN7cyzytuQN5zvn//tEsIS4ZK2pYZLVy0dWOa9rGo5sjxxedsK4xUFK4ZWBqw8uIq2Km3VT6vtV5eufr0mek1rgV7ByoLBtQFr6wtVCuWFfevc1+1dT1gvWd+1YfqGnRs+FYmKrhTbF5cVf9go3HjlG4dvyr+Z3JS0qavEuWTPZtJm6ebeLZ5bDpaql+aXDm4N2dq0Dd9WtO319kXbL5fNKNu7g7ZDuaO/PLi8ZafJzs07P1SkVPRU+lQ27tLdtWHX+G7R7ht7vPY07NXbW7z3/T7JvttVAVVN1WbVZftJ+7P3P66Jqun4lvttXa1ObXHtxwPSA/0HIw6217nU1R3SPVRSj9Yr60cOxx++/p3vdy0NNg1VjZzG4iNwRHnk6fcJ3/ceDTradox7rOEH0x92HWcdL2pCmvKaRptTmvtbYlu6T8w+0dbq3nr8R9sfD5w0PFl5SvNUyWna6YLTk2fyz4ydlZ19fi753GDborZ752PO32oPb++6EHTh0kX/i+c7vDvOXPK4dPKy2+UTV7hXmq86X23qdOo8/pPTT8e7nLuarrlca7nuer21e2b36RueN87d9L158Rb/1tWeOT3dvfN6b/fF9/XfFt1+cif9zsu72Xcn7q28T7xf9EDtQdlD3YfVP1v+3Njv3H9qwHeg89HcR/cGhYPP/pH1jw9DBY+Zj8uGDYbrnjg+OTniP3L96fynQ89kzyaeF/6i/suuFxYvfvjV69fO0ZjRoZfyl5O/bXyl/erA6xmv28bCxh6+yXgzMV70VvvtwXfcdx3vo98PT+R8IH8o/2j5sfVT0Kf7kxmTk/8EA5jz/GMzLdsAAAAgY0hSTQAAeiUAAICDAAD5/wAAgOkAAHUwAADqYAAAOpgAABdvkl/FRgAAA7VJREFUeNrEl2uIlWUQx39nXUu0m2uQbZYrbabdLKMs/VBkmHQjioqFIhBS+hKEQpQRgVAf2u5RQkGBRUllRH4I2e5ZUBJlEZVt5i0tTfHStrZ6fn35L70d9n7Obg88vOedmWfmf2bmmZkXlRrtq9V16mZ1iVqqhd5agXvQf1c5zw/V8dXqrqO6dQKwBrgdWApsCb0VqAc2AnOrMVANwIsD4BLgTOBPYB2wHJgEzAG+ANqAu4ZsZYiuX5QwfqI2hvaNulA9J7zLQn8o76vUuuHOwXHqSzH4aIF+TWjnBkSH+nCBf716SP1KPWO4AJ6ltgfIjRW8p9U/1KPz/ry6RT2mIDNF3Zjz19Ya4G1R/J16dgWvQd2pPlXhMdVZPUTgxfCW1wJgXUJpQlvfg8zs8K8r0Caom9QHetG7NGfa1ElDBThRXRtFd/Qh16puKIS3e7+clBjdy7kL1b3q4fzJQQGck5z6Nb97kxujblWf64HXov7Vl/E4YXWccP9AAd6dAx+ox/WTArNzY1t64B0f8K0DyLXuUvRGZfcpCo1VX4tg6wB76WMB0dALf526foAX8cqUot2pGP8B2Kz+krBeNYjS8636dh/8Beo2deoA9TWp76pd6g0q9cDNwKvAD8A84EfglLRBe2g+JWAfcEF68bPABOCoAl/gIPA5MA64FVgGnNhP292W3r0SeB1YVlJXAjcBP8XwyQUj9AKwAzg2+/fQSsBhoJxBAaALaIzenZGnD911wA7gEDAD2FFSpwOzgDHZ5T7+ZSlGd2d6AXgi5+qAn+O5U0PbBVwKtAD3AHuB8f3YGBUdncCGoQ4LE9XtGRqK9LnduVPRIu2BPqwD65IYbS7Qpql7Ql9YoJcy9bwzkgPrfOCj5G33+h54E/g0PAr5thq4ApgyEgNrc27aWwVaPTA1QJ4BjgTGFvhteV40EgPrgvTP7qlmZqFnl9WD+b2posN83E/NrEkOjlI/U1fkfUYa/pe5IE3qZPW8jFOqiyN7p3pAPX04c7AxYSoDDcAjKT2LgLXA6IR2M3Bviv59wDTgQGTPH84Qd8+HXfHcoUws2zM0HMjuUPep+xP2PWpnwtw0GJsldbBpewQwE/gbeDyt7H1gcW53O7AC+A3Yn6+/W+Ld9SnWA15DAVhc8xK2TuA9YHrCuhV4EngFuBx4YagG6qv8cF+T52kB2Zy+e1I8taUacNV+uBdXO7ABmJwJpwx8XQvF9TUCWM64tiQhbq/oMv+7BwFWpQzNT8vbVQul/wwAGzzdmXU1xuUAAAAASUVORK5CYII=","scale" : 0.5},'; |
|
511 | + } else { |
|
512 | + $output .= ' "billboard" : {"image" : "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACgAAAAfCAYAAACVgY94AAAACXBIWXMAAC4jAAAuIwF4pT92AAAKT2lDQ1BQaG90b3Nob3AgSUNDIHByb2ZpbGUAAHjanVNnVFPpFj333vRCS4iAlEtvUhUIIFJCi4AUkSYqIQkQSoghodkVUcERRUUEG8igiAOOjoCMFVEsDIoK2AfkIaKOg6OIisr74Xuja9a89+bN/rXXPues852zzwfACAyWSDNRNYAMqUIeEeCDx8TG4eQuQIEKJHAAEAizZCFz/SMBAPh+PDwrIsAHvgABeNMLCADATZvAMByH/w/qQplcAYCEAcB0kThLCIAUAEB6jkKmAEBGAYCdmCZTAKAEAGDLY2LjAFAtAGAnf+bTAICd+Jl7AQBblCEVAaCRACATZYhEAGg7AKzPVopFAFgwABRmS8Q5ANgtADBJV2ZIALC3AMDOEAuyAAgMADBRiIUpAAR7AGDIIyN4AISZABRG8lc88SuuEOcqAAB4mbI8uSQ5RYFbCC1xB1dXLh4ozkkXKxQ2YQJhmkAuwnmZGTKBNA/g88wAAKCRFRHgg/P9eM4Ors7ONo62Dl8t6r8G/yJiYuP+5c+rcEAAAOF0ftH+LC+zGoA7BoBt/qIl7gRoXgugdfeLZrIPQLUAoOnaV/Nw+H48PEWhkLnZ2eXk5NhKxEJbYcpXff5nwl/AV/1s+X48/Pf14L7iJIEyXYFHBPjgwsz0TKUcz5IJhGLc5o9H/LcL//wd0yLESWK5WCoU41EScY5EmozzMqUiiUKSKcUl0v9k4t8s+wM+3zUAsGo+AXuRLahdYwP2SycQWHTA4vcAAPK7b8HUKAgDgGiD4c93/+8//UegJQCAZkmScQAAXkQkLlTKsz/HCAAARKCBKrBBG/TBGCzABhzBBdzBC/xgNoRCJMTCQhBCCmSAHHJgKayCQiiGzbAdKmAv1EAdNMBRaIaTcA4uwlW4Dj1wD/phCJ7BKLyBCQRByAgTYSHaiAFiilgjjggXmYX4IcFIBBKLJCDJiBRRIkuRNUgxUopUIFVIHfI9cgI5h1xGupE7yAAygvyGvEcxlIGyUT3UDLVDuag3GoRGogvQZHQxmo8WoJvQcrQaPYw2oefQq2gP2o8+Q8cwwOgYBzPEbDAuxsNCsTgsCZNjy7EirAyrxhqwVqwDu4n1Y8+xdwQSgUXACTYEd0IgYR5BSFhMWE7YSKggHCQ0EdoJNwkDhFHCJyKTqEu0JroR+cQYYjIxh1hILCPWEo8TLxB7iEPENyQSiUMyJ7mQAkmxpFTSEtJG0m5SI+ksqZs0SBojk8naZGuyBzmULCAryIXkneTD5DPkG+Qh8lsKnWJAcaT4U+IoUspqShnlEOU05QZlmDJBVaOaUt2ooVQRNY9aQq2htlKvUYeoEzR1mjnNgxZJS6WtopXTGmgXaPdpr+h0uhHdlR5Ol9BX0svpR+iX6AP0dwwNhhWDx4hnKBmbGAcYZxl3GK+YTKYZ04sZx1QwNzHrmOeZD5lvVVgqtip8FZHKCpVKlSaVGyovVKmqpqreqgtV81XLVI+pXlN9rkZVM1PjqQnUlqtVqp1Q61MbU2epO6iHqmeob1Q/pH5Z/YkGWcNMw09DpFGgsV/jvMYgC2MZs3gsIWsNq4Z1gTXEJrHN2Xx2KruY/R27iz2qqaE5QzNKM1ezUvOUZj8H45hx+Jx0TgnnKKeX836K3hTvKeIpG6Y0TLkxZVxrqpaXllirSKtRq0frvTau7aedpr1Fu1n7gQ5Bx0onXCdHZ4/OBZ3nU9lT3acKpxZNPTr1ri6qa6UbobtEd79up+6Ynr5egJ5Mb6feeb3n+hx9L/1U/W36p/VHDFgGswwkBtsMzhg8xTVxbzwdL8fb8VFDXcNAQ6VhlWGX4YSRudE8o9VGjUYPjGnGXOMk423GbcajJgYmISZLTepN7ppSTbmmKaY7TDtMx83MzaLN1pk1mz0x1zLnm+eb15vft2BaeFostqi2uGVJsuRaplnutrxuhVo5WaVYVVpds0atna0l1rutu6cRp7lOk06rntZnw7Dxtsm2qbcZsOXYBtuutm22fWFnYhdnt8Wuw+6TvZN9un2N/T0HDYfZDqsdWh1+c7RyFDpWOt6azpzuP33F9JbpL2dYzxDP2DPjthPLKcRpnVOb00dnF2e5c4PziIuJS4LLLpc+Lpsbxt3IveRKdPVxXeF60vWdm7Obwu2o26/uNu5p7ofcn8w0nymeWTNz0MPIQ+BR5dE/C5+VMGvfrH5PQ0+BZ7XnIy9jL5FXrdewt6V3qvdh7xc+9j5yn+M+4zw33jLeWV/MN8C3yLfLT8Nvnl+F30N/I/9k/3r/0QCngCUBZwOJgUGBWwL7+Hp8Ib+OPzrbZfay2e1BjKC5QRVBj4KtguXBrSFoyOyQrSH355jOkc5pDoVQfujW0Adh5mGLw34MJ4WHhVeGP45wiFga0TGXNXfR3ENz30T6RJZE3ptnMU85ry1KNSo+qi5qPNo3ujS6P8YuZlnM1VidWElsSxw5LiquNm5svt/87fOH4p3iC+N7F5gvyF1weaHOwvSFpxapLhIsOpZATIhOOJTwQRAqqBaMJfITdyWOCnnCHcJnIi/RNtGI2ENcKh5O8kgqTXqS7JG8NXkkxTOlLOW5hCepkLxMDUzdmzqeFpp2IG0yPTq9MYOSkZBxQqohTZO2Z+pn5mZ2y6xlhbL+xW6Lty8elQfJa7OQrAVZLQq2QqboVFoo1yoHsmdlV2a/zYnKOZarnivN7cyzytuQN5zvn//tEsIS4ZK2pYZLVy0dWOa9rGo5sjxxedsK4xUFK4ZWBqw8uIq2Km3VT6vtV5eufr0mek1rgV7ByoLBtQFr6wtVCuWFfevc1+1dT1gvWd+1YfqGnRs+FYmKrhTbF5cVf9go3HjlG4dvyr+Z3JS0qavEuWTPZtJm6ebeLZ5bDpaql+aXDm4N2dq0Dd9WtO319kXbL5fNKNu7g7ZDuaO/PLi8ZafJzs07P1SkVPRU+lQ27tLdtWHX+G7R7ht7vPY07NXbW7z3/T7JvttVAVVN1WbVZftJ+7P3P66Jqun4lvttXa1ObXHtxwPSA/0HIw6217nU1R3SPVRSj9Yr60cOxx++/p3vdy0NNg1VjZzG4iNwRHnk6fcJ3/ceDTradox7rOEH0x92HWcdL2pCmvKaRptTmvtbYlu6T8w+0dbq3nr8R9sfD5w0PFl5SvNUyWna6YLTk2fyz4ydlZ19fi753GDborZ752PO32oPb++6EHTh0kX/i+c7vDvOXPK4dPKy2+UTV7hXmq86X23qdOo8/pPTT8e7nLuarrlca7nuer21e2b36RueN87d9L158Rb/1tWeOT3dvfN6b/fF9/XfFt1+cif9zsu72Xcn7q28T7xf9EDtQdlD3YfVP1v+3Njv3H9qwHeg89HcR/cGhYPP/pH1jw9DBY+Zj8uGDYbrnjg+OTniP3L96fynQ89kzyaeF/6i/suuFxYvfvjV69fO0ZjRoZfyl5O/bXyl/erA6xmv28bCxh6+yXgzMV70VvvtwXfcdx3vo98PT+R8IH8o/2j5sfVT0Kf7kxmTk/8EA5jz/GMzLdsAAAAgY0hSTQAAeiUAAICDAAD5/wAAgOkAAHUwAADqYAAAOpgAABdvkl/FRgAAA7VJREFUeNrEl2uIlWUQx39nXUu0m2uQbZYrbabdLKMs/VBkmHQjioqFIhBS+hKEQpQRgVAf2u5RQkGBRUllRH4I2e5ZUBJlEZVt5i0tTfHStrZ6fn35L70d9n7Obg88vOedmWfmf2bmmZkXlRrtq9V16mZ1iVqqhd5agXvQf1c5zw/V8dXqrqO6dQKwBrgdWApsCb0VqAc2AnOrMVANwIsD4BLgTOBPYB2wHJgEzAG+ANqAu4ZsZYiuX5QwfqI2hvaNulA9J7zLQn8o76vUuuHOwXHqSzH4aIF+TWjnBkSH+nCBf716SP1KPWO4AJ6ltgfIjRW8p9U/1KPz/ry6RT2mIDNF3Zjz19Ya4G1R/J16dgWvQd2pPlXhMdVZPUTgxfCW1wJgXUJpQlvfg8zs8K8r0Caom9QHetG7NGfa1ElDBThRXRtFd/Qh16puKIS3e7+clBjdy7kL1b3q4fzJQQGck5z6Nb97kxujblWf64HXov7Vl/E4YXWccP9AAd6dAx+ox/WTArNzY1t64B0f8K0DyLXuUvRGZfcpCo1VX4tg6wB76WMB0dALf526foAX8cqUot2pGP8B2Kz+krBeNYjS8636dh/8Beo2deoA9TWp76pd6g0q9cDNwKvAD8A84EfglLRBe2g+JWAfcEF68bPABOCoAl/gIPA5MA64FVgGnNhP292W3r0SeB1YVlJXAjcBP8XwyQUj9AKwAzg2+/fQSsBhoJxBAaALaIzenZGnD911wA7gEDAD2FFSpwOzgDHZ5T7+ZSlGd2d6AXgi5+qAn+O5U0PbBVwKtAD3AHuB8f3YGBUdncCGoQ4LE9XtGRqK9LnduVPRIu2BPqwD65IYbS7Qpql7Ql9YoJcy9bwzkgPrfOCj5G33+h54E/g0PAr5thq4ApgyEgNrc27aWwVaPTA1QJ4BjgTGFvhteV40EgPrgvTP7qlmZqFnl9WD+b2posN83E/NrEkOjlI/U1fkfUYa/pe5IE3qZPW8jFOqiyN7p3pAPX04c7AxYSoDDcAjKT2LgLXA6IR2M3Bviv59wDTgQGTPH84Qd8+HXfHcoUws2zM0HMjuUPep+xP2PWpnwtw0GJsldbBpewQwE/gbeDyt7H1gcW53O7AC+A3Yn6+/W+Ld9SnWA15DAVhc8xK2TuA9YHrCuhV4EngFuBx4YagG6qv8cF+T52kB2Zy+e1I8taUacNV+uBdXO7ABmJwJpwx8XQvF9TUCWM64tiQhbq/oMv+7BwFWpQzNT8vbVQul/wwAGzzdmXU1xuUAAAAASUVORK5CYII=","scale" : 0.5},'; |
|
513 | + } |
|
461 | 514 | } elseif ($one3dmodel) { |
462 | 515 | if (isset($globalMap3DForceModel) && $globalMap3DForceModel != '') { |
463 | 516 | $output .= '"model": {"gltf" : "'.$globalURL.'/models/'.$globalMap3DForceModel.'","scale" : '.$scale.',"minimumPixelSize": '.$minimumpixelsize.''; |
@@ -497,7 +550,9 @@ discard block |
||
497 | 550 | $spotter_item['engine_type'] = $aircraft_info[0]['engine_type']; |
498 | 551 | $spotter_item['wake_category'] = $aircraft_info[0]['wake_category']; |
499 | 552 | $spotter_item['engine_count'] = $aircraft_info[0]['engine_count']; |
500 | - } else $aircraft_shadow = ''; |
|
553 | + } else { |
|
554 | + $aircraft_shadow = ''; |
|
555 | + } |
|
501 | 556 | if ($aircraft_shadow != '') { |
502 | 557 | if (isset($modelsdb2[$aircraft_shadow])) { |
503 | 558 | $output .= '"model": {"gltf" : "'.$globalURL.'/models/gltf2/'.$modelsdb2[$aircraft_shadow]['glb'].'","scale" : '.$scale.',"minimumPixelSize": '.$modelsdb2[$aircraft_shadow]['size']; |
@@ -652,7 +707,9 @@ discard block |
||
652 | 707 | } |
653 | 708 | $output .= '},'; |
654 | 709 | //if ($spotter_item['aircraft_shadow'] != '') $output .= '"aircraft_shadow": "'.$spotter_item['aircraft_shadow'].'",'; |
655 | - if ($spotter_item['aircraft_icao'] != '') $output .= '"aircraft_icao": "'.$spotter_item['aircraft_icao'].'",'; |
|
710 | + if ($spotter_item['aircraft_icao'] != '') { |
|
711 | + $output .= '"aircraft_icao": "'.$spotter_item['aircraft_icao'].'",'; |
|
712 | + } |
|
656 | 713 | $modelsdb[$aircraft_icao] = 'Cesium_Air.glb'; |
657 | 714 | } |
658 | 715 | } elseif (isset($spotter_item['format_source']) && $spotter_item['format_source'] == 'aprs') { |
@@ -674,7 +731,9 @@ discard block |
||
674 | 731 | } |
675 | 732 | $output .= '},'; |
676 | 733 | //if ($spotter_item['aircraft_shadow'] != '') $output .= '"aircraft_shadow": "'.$spotter_item['aircraft_shadow'].'",'; |
677 | - if ($spotter_item['aircraft_icao'] != '') $output .= '"aircraft_icao": "'.$spotter_item['aircraft_icao'].'",'; |
|
734 | + if ($spotter_item['aircraft_icao'] != '') { |
|
735 | + $output .= '"aircraft_icao": "'.$spotter_item['aircraft_icao'].'",'; |
|
736 | + } |
|
678 | 737 | $modelsdb[$aircraft_icao] = 'Cesium_Air.glb'; |
679 | 738 | } |
680 | 739 | } else { |
@@ -687,7 +746,9 @@ discard block |
||
687 | 746 | } |
688 | 747 | $output .= '},'; |
689 | 748 | //if ($spotter_item['aircraft_shadow'] != '') $output .= '"aircraft_shadow": "'.$spotter_item['aircraft_shadow'].'",'; |
690 | - if ($spotter_item['aircraft_icao'] != '') $output .= '"aircraft_icao": "'.$spotter_item['aircraft_icao'].'",'; |
|
749 | + if ($spotter_item['aircraft_icao'] != '') { |
|
750 | + $output .= '"aircraft_icao": "'.$spotter_item['aircraft_icao'].'",'; |
|
751 | + } |
|
691 | 752 | $modelsdb[$aircraft_icao] = 'Cesium_Air.glb'; |
692 | 753 | } |
693 | 754 | } elseif ($tracker && isset($spotter_item['type'])) { |
@@ -791,8 +852,11 @@ discard block |
||
791 | 852 | $output .= '},'; |
792 | 853 | } |
793 | 854 | } |
794 | - if (isset($onground) && $onground) $output = str_replace('%onground%','true',$output); |
|
795 | - else $output = str_replace('%onground%','false',$output); |
|
855 | + if (isset($onground) && $onground) { |
|
856 | + $output = str_replace('%onground%','true',$output); |
|
857 | + } else { |
|
858 | + $output = str_replace('%onground%','false',$output); |
|
859 | + } |
|
796 | 860 | |
797 | 861 | // $output .= '"heightReference": "CLAMP_TO_GROUND",'; |
798 | 862 | //$output .= '"heightReference": "'.$heightrelative.'",'; |
@@ -805,9 +869,15 @@ discard block |
||
805 | 869 | // $output .= '"interpolationDegree" : 5,'; |
806 | 870 | // $output .= '"epoch" : "'.date("c",strtotime($spotter_item['date'])).'", '; |
807 | 871 | $output .= '"cartographicDegrees": ['; |
808 | - if ($minitime > strtotime($spotter_item['date'])) $minitime = strtotime($spotter_item['date']); |
|
809 | - if (isset($_COOKIE['MapTrack']) && $id == $_COOKIE['MapTrack'] && $minitracktime > strtotime($spotter_item['date'])) $minitracktime = strtotime($spotter_item['date']); |
|
810 | - if ($maxitime < strtotime($spotter_item['date'])) $maxitime = strtotime($spotter_item['date']); |
|
872 | + if ($minitime > strtotime($spotter_item['date'])) { |
|
873 | + $minitime = strtotime($spotter_item['date']); |
|
874 | + } |
|
875 | + if (isset($_COOKIE['MapTrack']) && $id == $_COOKIE['MapTrack'] && $minitracktime > strtotime($spotter_item['date'])) { |
|
876 | + $minitracktime = strtotime($spotter_item['date']); |
|
877 | + } |
|
878 | + if ($maxitime < strtotime($spotter_item['date'])) { |
|
879 | + $maxitime = strtotime($spotter_item['date']); |
|
880 | + } |
|
811 | 881 | $output .= '"'.date("c",strtotime($spotter_item['date'])).'", '; |
812 | 882 | $output .= $spotter_item['longitude'].', '; |
813 | 883 | $output .= $spotter_item['latitude']; |
@@ -830,7 +900,9 @@ discard block |
||
830 | 900 | $output .= ', '.round($spotter_item['altitude']*30.48); |
831 | 901 | $prevalt = round($spotter_item['altitude']*30.48); |
832 | 902 | } |
833 | - } else $output .= ', 0'; |
|
903 | + } else { |
|
904 | + $output .= ', 0'; |
|
905 | + } |
|
834 | 906 | //$orientation = '"orientation" : { '; |
835 | 907 | //$orientation .= '"unitQuaternion": ['; |
836 | 908 | //$quat = quaternionrotate(deg2rad($spotter_item['heading']),deg2rad(0),deg2rad(0)); |
@@ -838,13 +910,18 @@ discard block |
||
838 | 910 | } else { |
839 | 911 | $nblatlong = $nblatlong+1; |
840 | 912 | $output .= ',"'.date("c",strtotime($spotter_item['date'])).'", '; |
841 | - if ($maxitime < strtotime($spotter_item['date'])) $maxitime = strtotime($spotter_item['date']); |
|
913 | + if ($maxitime < strtotime($spotter_item['date'])) { |
|
914 | + $maxitime = strtotime($spotter_item['date']); |
|
915 | + } |
|
842 | 916 | if ($spotter_item['ground_speed'] == 0) { |
843 | 917 | $output .= $prevlong.', '; |
844 | 918 | $output .= $prevlat; |
845 | 919 | //if (!$marine && (!isset($onground) || !$onground)) $output .= ', '.$prevalt; |
846 | - if (!$marine) $output .= ', '.$prevalt; |
|
847 | - else $output .= ', 0'; |
|
920 | + if (!$marine) { |
|
921 | + $output .= ', '.$prevalt; |
|
922 | + } else { |
|
923 | + $output .= ', 0'; |
|
924 | + } |
|
848 | 925 | } else { |
849 | 926 | $output .= $spotter_item['longitude'].', '; |
850 | 927 | $output .= $spotter_item['latitude']; |
@@ -857,14 +934,17 @@ discard block |
||
857 | 934 | $output .= ', 0'; |
858 | 935 | } |
859 | 936 | } else { |
860 | - if (isset($spotter_item['real_altitude']) && $spotter_item['real_altitude'] != '') $output .= ', '.round($spotter_item['real_altitude']*0.3048); |
|
861 | - elseif ($tracker) { |
|
937 | + if (isset($spotter_item['real_altitude']) && $spotter_item['real_altitude'] != '') { |
|
938 | + $output .= ', '.round($spotter_item['real_altitude']*0.3048); |
|
939 | + } elseif ($tracker) { |
|
862 | 940 | $output .= ', '.round($spotter_item['altitude']*0.3048); |
863 | 941 | } else { |
864 | 942 | $output .= ', '.round($spotter_item['altitude']*30.48); |
865 | 943 | } |
866 | 944 | } |
867 | - } else $output .= ', 0'; |
|
945 | + } else { |
|
946 | + $output .= ', 0'; |
|
947 | + } |
|
868 | 948 | } |
869 | 949 | //$quat = quaternionrotate(deg2rad($spotter_item['heading']),deg2rad(0),deg2rad(0)); |
870 | 950 | //$orientation .= ',"'.date("c",strtotime($spotter_item['date'])).'",'.$quat['x'].','.$quat['y'].','.$quat['z'].','.$quat['w']; |
@@ -885,9 +965,10 @@ discard block |
||
885 | 965 | } else { |
886 | 966 | $output = str_replace('%minitime%',date("c",time()-$globalLiveInterval),$output); |
887 | 967 | } |
968 | + } else { |
|
969 | + $output = str_replace('%minitime%',date("c",$minitime),$output); |
|
888 | 970 | } |
889 | - else $output = str_replace('%minitime%',date("c",$minitime),$output); |
|
890 | -} elseif (isset($_COOKIE['MapTrack']) && $_COOKIE['MapTrack'] != '' && $minitracktime != $minitracktime_begin) { |
|
971 | + } elseif (isset($_COOKIE['MapTrack']) && $_COOKIE['MapTrack'] != '' && $minitracktime != $minitracktime_begin) { |
|
891 | 972 | $output = str_replace('%minitime%',date("c",$minitracktime),$output); |
892 | 973 | } else { |
893 | 974 | $output = str_replace('%minitime%',date("c",$minitime),$output); |
@@ -897,7 +978,10 @@ discard block |
||
897 | 978 | } else { |
898 | 979 | $output = str_replace('%maxitime%',date("c",$maxitime),$output); |
899 | 980 | } |
900 | -if ($gltf2) $output = str_replace('%gltf2%','true',$output); |
|
901 | -else $output = str_replace('%gltf2%','false',$output); |
|
981 | +if ($gltf2) { |
|
982 | + $output = str_replace('%gltf2%','true',$output); |
|
983 | +} else { |
|
984 | + $output = str_replace('%gltf2%','false',$output); |
|
985 | +} |
|
902 | 986 | print $output; |
903 | 987 | ?> |
@@ -59,11 +59,11 @@ discard block |
||
59 | 59 | $s3 = sin($bank/2); |
60 | 60 | $c1c2 = $c1*$c2; |
61 | 61 | $s1s2 = $s1*$s2; |
62 | - $w =$c1c2*$c3 - $s1s2*$s3; |
|
63 | - $x =$c1c2*$s3 + $s1s2*$c3; |
|
64 | - $y =$s1*$c2*$c3 + $c1*$s2*$s3; |
|
65 | - $z =$c1*$s2*$c3 - $s1*$c2*$s3; |
|
66 | - return array('x' => $x,'y' => $y,'z' => $z,'w' => $w); |
|
62 | + $w = $c1c2*$c3 - $s1s2*$s3; |
|
63 | + $x = $c1c2*$s3 + $s1s2*$c3; |
|
64 | + $y = $s1*$c2*$c3 + $c1*$s2*$s3; |
|
65 | + $z = $c1*$s2*$c3 - $s1*$c2*$s3; |
|
66 | + return array('x' => $x, 'y' => $y, 'z' => $z, 'w' => $w); |
|
67 | 67 | // return array('x' => '0.0','y' => '-0.931','z' => '0.0','w' => '0.365'); |
68 | 68 | |
69 | 69 | } |
@@ -84,17 +84,17 @@ discard block |
||
84 | 84 | $min = false; |
85 | 85 | $allhistory = false; |
86 | 86 | $filter['source'] = array(); |
87 | -if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') $filter['source'] = array_merge($filter['source'],array('vatsimtxt')); |
|
88 | -if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') $filter['source'] = array_merge($filter['source'],array('whazzup')); |
|
89 | -if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') $filter['source'] = array_merge($filter['source'],array('phpvmacars')); |
|
90 | -if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') $filter['source'] = array_merge($filter['source'],array('sbs','famaprs')); |
|
91 | -if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') $filter['source'] = array_merge($filter['source'],array('aprs')); |
|
92 | -if (isset($_COOKIE['filter_ident']) && $_COOKIE['filter_ident'] != '') $filter['ident'] = filter_var($_COOKIE['filter_ident'],FILTER_SANITIZE_STRING); |
|
93 | -if (isset($_COOKIE['filter_mmsi']) && $_COOKIE['filter_mmsi'] != '') $filter['mmsi'] = filter_var($_COOKIE['filter_mmsi'],FILTER_SANITIZE_STRING); |
|
94 | -if (isset($_COOKIE['filter_Airlines']) && $_COOKIE['filter_Airlines'] != '') $filter['airlines'] = filter_var_array(explode(',',$_COOKIE['filter_Airlines']),FILTER_SANITIZE_STRING); |
|
95 | -if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') $filter['source_aprs'] = filter_var_array(explode(',',$_COOKIE['filter_Sources']),FILTER_SANITIZE_STRING); |
|
96 | -if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') $filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'],FILTER_SANITIZE_STRING); |
|
97 | -if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] != 'all') $filter['alliance'] = filter_var($_COOKIE['filter_alliance'],FILTER_SANITIZE_STRING); |
|
87 | +if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') $filter['source'] = array_merge($filter['source'], array('vatsimtxt')); |
|
88 | +if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') $filter['source'] = array_merge($filter['source'], array('whazzup')); |
|
89 | +if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') $filter['source'] = array_merge($filter['source'], array('phpvmacars')); |
|
90 | +if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') $filter['source'] = array_merge($filter['source'], array('sbs', 'famaprs')); |
|
91 | +if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') $filter['source'] = array_merge($filter['source'], array('aprs')); |
|
92 | +if (isset($_COOKIE['filter_ident']) && $_COOKIE['filter_ident'] != '') $filter['ident'] = filter_var($_COOKIE['filter_ident'], FILTER_SANITIZE_STRING); |
|
93 | +if (isset($_COOKIE['filter_mmsi']) && $_COOKIE['filter_mmsi'] != '') $filter['mmsi'] = filter_var($_COOKIE['filter_mmsi'], FILTER_SANITIZE_STRING); |
|
94 | +if (isset($_COOKIE['filter_Airlines']) && $_COOKIE['filter_Airlines'] != '') $filter['airlines'] = filter_var_array(explode(',', $_COOKIE['filter_Airlines']), FILTER_SANITIZE_STRING); |
|
95 | +if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') $filter['source_aprs'] = filter_var_array(explode(',', $_COOKIE['filter_Sources']), FILTER_SANITIZE_STRING); |
|
96 | +if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') $filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'], FILTER_SANITIZE_STRING); |
|
97 | +if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] != 'all') $filter['alliance'] = filter_var($_COOKIE['filter_alliance'], FILTER_SANITIZE_STRING); |
|
98 | 98 | /* |
99 | 99 | if (isset($globalMapPopup) && !$globalMapPopup && !(isset($_COOKIE['flightpopup']) && $_COOKIE['flightpopup'] == 'true')) { |
100 | 100 | $min = true; |
@@ -141,17 +141,17 @@ discard block |
||
141 | 141 | $from_archive = true; |
142 | 142 | // $begindate = filter_input(INPUT_GET,'begindate',FILTER_VALIDATE_REGEXP,array("options"=>array("regexp"=>'~^\d{4}/\d{2}/\d{2}$~'))); |
143 | 143 | // $enddate = filter_input(INPUT_GET,'enddate',FILTER_VALIDATE_REGEXP,array("options"=>array("regexp"=>'~^\d{4}/\d{2}/\d{2}$~'))); |
144 | - $begindate = filter_input(INPUT_GET,'begindate',FILTER_SANITIZE_NUMBER_INT); |
|
145 | - $enddate = filter_input(INPUT_GET,'enddate',FILTER_SANITIZE_NUMBER_INT); |
|
146 | - $archivespeed = filter_input(INPUT_GET,'speed',FILTER_SANITIZE_NUMBER_INT); |
|
147 | - $begindate = date('Y-m-d H:i:s',$begindate); |
|
148 | - $enddate = date('Y-m-d H:i:s',$enddate); |
|
144 | + $begindate = filter_input(INPUT_GET, 'begindate', FILTER_SANITIZE_NUMBER_INT); |
|
145 | + $enddate = filter_input(INPUT_GET, 'enddate', FILTER_SANITIZE_NUMBER_INT); |
|
146 | + $archivespeed = filter_input(INPUT_GET, 'speed', FILTER_SANITIZE_NUMBER_INT); |
|
147 | + $begindate = date('Y-m-d H:i:s', $begindate); |
|
148 | + $enddate = date('Y-m-d H:i:s', $enddate); |
|
149 | 149 | if ($tracker) { |
150 | - $spotter_array = $TrackerArchive->getMinLiveTrackerDataPlayback($begindate,$enddate,$filter); |
|
150 | + $spotter_array = $TrackerArchive->getMinLiveTrackerDataPlayback($begindate, $enddate, $filter); |
|
151 | 151 | } elseif ($marine) { |
152 | - $spotter_array = $MarineArchive->getMinLiveMarineDataPlayback($begindate,$enddate,$filter); |
|
152 | + $spotter_array = $MarineArchive->getMinLiveMarineDataPlayback($begindate, $enddate, $filter); |
|
153 | 153 | } else { |
154 | - $spotter_array = $SpotterArchive->getMinLiveSpotterDataPlayback($begindate,$enddate,$filter); |
|
154 | + $spotter_array = $SpotterArchive->getMinLiveSpotterDataPlayback($begindate, $enddate, $filter); |
|
155 | 155 | } |
156 | 156 | } elseif (isset($_COOKIE['archive']) && isset($_COOKIE['archive_begin']) && isset($_COOKIE['archive_end']) && isset($_COOKIE['archive_speed'])) { |
157 | 157 | $from_archive = true; |
@@ -168,36 +168,36 @@ discard block |
||
168 | 168 | } |
169 | 169 | $enddate = $_COOKIE['archive_end']; |
170 | 170 | $enddateinitial = $_COOKIE['archive_end']; |
171 | - $archivespeed = filter_var($_COOKIE['archive_speed'],FILTER_SANITIZE_NUMBER_INT); |
|
172 | - $begindate = date('Y-m-d H:i:s',$begindate); |
|
173 | - $enddate = date('Y-m-d H:i:s',$enddate); |
|
171 | + $archivespeed = filter_var($_COOKIE['archive_speed'], FILTER_SANITIZE_NUMBER_INT); |
|
172 | + $begindate = date('Y-m-d H:i:s', $begindate); |
|
173 | + $enddate = date('Y-m-d H:i:s', $enddate); |
|
174 | 174 | //echo 'Begin : '.$begindate.' - End : '.$enddate."\n"; |
175 | 175 | if ($tracker) { |
176 | - $spotter_array = $TrackerArchive->getMinLiveTrackerData($begindate,$enddate,$filter); |
|
176 | + $spotter_array = $TrackerArchive->getMinLiveTrackerData($begindate, $enddate, $filter); |
|
177 | 177 | } elseif ($marine) { |
178 | - $spotter_array = $MarineArchive->getMinLiveMarineData($begindate,$enddate,$filter); |
|
178 | + $spotter_array = $MarineArchive->getMinLiveMarineData($begindate, $enddate, $filter); |
|
179 | 179 | } else { |
180 | - $spotter_array = $SpotterArchive->getMinLiveSpotterData($begindate,$enddate,$filter); |
|
180 | + $spotter_array = $SpotterArchive->getMinLiveSpotterData($begindate, $enddate, $filter); |
|
181 | 181 | } |
182 | 182 | } elseif ($tracker) { |
183 | 183 | $coord = array(); |
184 | 184 | if (isset($_GET['coord']) && $_GET['coord'] != '') { |
185 | - $coord = explode(',',$_GET['coord']); |
|
186 | - if (!(filter_var($coord[0],FILTER_VALIDATE_FLOAT) && filter_var($coord[1],FILTER_VALIDATE_FLOAT) && filter_var($coord[2],FILTER_VALIDATE_FLOAT) && filter_var($coord[3],FILTER_VALIDATE_FLOAT) |
|
185 | + $coord = explode(',', $_GET['coord']); |
|
186 | + if (!(filter_var($coord[0], FILTER_VALIDATE_FLOAT) && filter_var($coord[1], FILTER_VALIDATE_FLOAT) && filter_var($coord[2], FILTER_VALIDATE_FLOAT) && filter_var($coord[3], FILTER_VALIDATE_FLOAT) |
|
187 | 187 | && $coord[0] > -180.0 && $coord[0] < 180.0 && $coord[1] > -90.0 && $coord[1] < 90.0 && $coord[2] > -180.0 && $coord[2] < 180.0 && $coord[3] > -90.0 && $coord[3] < 90.0)) { |
188 | 188 | $coord = array(); |
189 | 189 | } |
190 | 190 | } |
191 | 191 | $previous_filter = $filter; |
192 | 192 | if ((isset($_COOKIE['singlemodel']) && $_COOKIE['singlemodel'] == 'true') && (isset($_COOKIE['MapTrackTracker']) && $_COOKIE['MapTrackTracker'] != '')) { |
193 | - $filter = array_merge($filter,array('id' => $_COOKIE['MapTrackTracker'])); |
|
194 | - $spotter_array = $TrackerLive->getMinLastLiveTrackerData($coord,$filter,true); |
|
193 | + $filter = array_merge($filter, array('id' => $_COOKIE['MapTrackTracker'])); |
|
194 | + $spotter_array = $TrackerLive->getMinLastLiveTrackerData($coord, $filter, true); |
|
195 | 195 | /* |
196 | 196 | } elseif (isset($_COOKIE['MapTrack']) && $_COOKIE['MapTrack'] != '' && !empty($coord)) { |
197 | 197 | $spotter_array = $TrackerLive->getMinLastLiveTrackerData($coord,$filter,true,$_COOKIE['MapTrack']); |
198 | 198 | */ |
199 | 199 | } elseif (!isset($_COOKIE['singlemodel']) || $_COOKIE['singlemodel'] == 'false') { |
200 | - $spotter_array = $TrackerLive->getMinLastLiveTrackerData($coord,$filter,true); |
|
200 | + $spotter_array = $TrackerLive->getMinLastLiveTrackerData($coord, $filter, true); |
|
201 | 201 | } else { |
202 | 202 | $spotter_array = array(); |
203 | 203 | } |
@@ -205,22 +205,22 @@ discard block |
||
205 | 205 | } elseif ($marine) { |
206 | 206 | $coord = array(); |
207 | 207 | if (isset($_GET['coord']) && $_GET['coord'] != '') { |
208 | - $coord = explode(',',$_GET['coord']); |
|
209 | - if (!(filter_var($coord[0],FILTER_VALIDATE_FLOAT) && filter_var($coord[1],FILTER_VALIDATE_FLOAT) && filter_var($coord[2],FILTER_VALIDATE_FLOAT) && filter_var($coord[3],FILTER_VALIDATE_FLOAT) |
|
208 | + $coord = explode(',', $_GET['coord']); |
|
209 | + if (!(filter_var($coord[0], FILTER_VALIDATE_FLOAT) && filter_var($coord[1], FILTER_VALIDATE_FLOAT) && filter_var($coord[2], FILTER_VALIDATE_FLOAT) && filter_var($coord[3], FILTER_VALIDATE_FLOAT) |
|
210 | 210 | && $coord[0] > -180.0 && $coord[0] < 180.0 && $coord[1] > -90.0 && $coord[1] < 90.0 && $coord[2] > -180.0 && $coord[2] < 180.0 && $coord[3] > -90.0 && $coord[3] < 90.0)) { |
211 | 211 | $coord = array(); |
212 | 212 | } |
213 | 213 | } |
214 | 214 | $previous_filter = $filter; |
215 | 215 | if ((isset($_COOKIE['singlemodel']) && $_COOKIE['singlemodel'] == 'true') && (isset($_COOKIE['MapTrackMarine']) && $_COOKIE['MapTrackMarine'] != '')) { |
216 | - $filter = array_merge($filter,array('id' => $_COOKIE['MapTrackMarine'])); |
|
217 | - $spotter_array = $MarineLive->getMinLastLiveMarineData($coord,$filter,true); |
|
216 | + $filter = array_merge($filter, array('id' => $_COOKIE['MapTrackMarine'])); |
|
217 | + $spotter_array = $MarineLive->getMinLastLiveMarineData($coord, $filter, true); |
|
218 | 218 | /* |
219 | 219 | } elseif (isset($_COOKIE['MapTrack']) && $_COOKIE['MapTrack'] != '' && !empty($coord)) { |
220 | 220 | $spotter_array = $MarineLive->getMinLastLiveMarineData($coord,$filter,true,$_COOKIE['MapTrack']); |
221 | 221 | */ |
222 | 222 | } elseif (!isset($_COOKIE['singlemodel']) || $_COOKIE['singlemodel'] == 'false') { |
223 | - $spotter_array = $MarineLive->getMinLastLiveMarineData($coord,$filter,true); |
|
223 | + $spotter_array = $MarineLive->getMinLastLiveMarineData($coord, $filter, true); |
|
224 | 224 | } else { |
225 | 225 | $spotter_array = array(); |
226 | 226 | } |
@@ -228,20 +228,20 @@ discard block |
||
228 | 228 | } else { |
229 | 229 | $coord = array(); |
230 | 230 | if (!((isset($_COOKIE['singlemodel']) && $_COOKIE['singlemodel'] == 'true') && (isset($_COOKIE['MapTrack']) && $_COOKIE['MapTrack'] != '')) && isset($_GET['coord']) && $_GET['coord'] != '') { |
231 | - $coord = explode(',',$_GET['coord']); |
|
232 | - if (!(filter_var($coord[0],FILTER_VALIDATE_FLOAT) && filter_var($coord[1],FILTER_VALIDATE_FLOAT) && filter_var($coord[2],FILTER_VALIDATE_FLOAT) && filter_var($coord[3],FILTER_VALIDATE_FLOAT) |
|
231 | + $coord = explode(',', $_GET['coord']); |
|
232 | + if (!(filter_var($coord[0], FILTER_VALIDATE_FLOAT) && filter_var($coord[1], FILTER_VALIDATE_FLOAT) && filter_var($coord[2], FILTER_VALIDATE_FLOAT) && filter_var($coord[3], FILTER_VALIDATE_FLOAT) |
|
233 | 233 | && $coord[0] > -180.0 && $coord[0] < 180.0 && $coord[1] > -90.0 && $coord[1] < 90.0 && $coord[2] > -180.0 && $coord[2] < 180.0 && $coord[3] > -90.0 && $coord[3] < 90.0)) { |
234 | 234 | $coord = array(); |
235 | 235 | } |
236 | 236 | } |
237 | 237 | $previous_filter = $filter; |
238 | 238 | if ((isset($_COOKIE['singlemodel']) && $_COOKIE['singlemodel'] == 'true') && (isset($_COOKIE['MapTrack']) && $_COOKIE['MapTrack'] != '')) { |
239 | - $filter = array_merge($filter,array('id' => $_COOKIE['MapTrack'])); |
|
240 | - $spotter_array = $SpotterLive->getMinLastLiveSpotterData($coord,$filter,true); |
|
239 | + $filter = array_merge($filter, array('id' => $_COOKIE['MapTrack'])); |
|
240 | + $spotter_array = $SpotterLive->getMinLastLiveSpotterData($coord, $filter, true); |
|
241 | 241 | } elseif (isset($_COOKIE['MapTrack']) && $_COOKIE['MapTrack'] != '' && !empty($coord)) { |
242 | - $spotter_array = $SpotterLive->getMinLastLiveSpotterData($coord,$filter,true,$_COOKIE['MapTrack']); |
|
242 | + $spotter_array = $SpotterLive->getMinLastLiveSpotterData($coord, $filter, true, $_COOKIE['MapTrack']); |
|
243 | 243 | } elseif (!isset($_COOKIE['singlemodel']) || $_COOKIE['singlemodel'] == 'false') { |
244 | - $spotter_array = $SpotterLive->getMinLastLiveSpotterData($coord,$filter,true); |
|
244 | + $spotter_array = $SpotterLive->getMinLastLiveSpotterData($coord, $filter, true); |
|
245 | 245 | } else { |
246 | 246 | $spotter_array = array(); |
247 | 247 | } |
@@ -251,19 +251,19 @@ discard block |
||
251 | 251 | if (!empty($spotter_array) && isset($coord)) { |
252 | 252 | if ($tracker) { |
253 | 253 | if (isset($_GET['archive'])) { |
254 | - $flightcnt = $TrackerArchive->getLiveTrackerCount($begindate,$enddate,$filter); |
|
254 | + $flightcnt = $TrackerArchive->getLiveTrackerCount($begindate, $enddate, $filter); |
|
255 | 255 | } else { |
256 | 256 | $flightcnt = $TrackerLive->getLiveTrackerCount($filter); |
257 | 257 | } |
258 | 258 | } elseif ($marine) { |
259 | 259 | if (isset($_GET['archive'])) { |
260 | - $flightcnt = $MarineArchive->getLiveMarineCount($begindate,$enddate,$filter); |
|
260 | + $flightcnt = $MarineArchive->getLiveMarineCount($begindate, $enddate, $filter); |
|
261 | 261 | } else { |
262 | 262 | $flightcnt = $MarineLive->getLiveMarineCount($filter); |
263 | 263 | } |
264 | 264 | } else { |
265 | 265 | if (isset($_GET['archive'])) { |
266 | - $flightcnt = $SpotterArchive->getLiveSpotterCount($begindate,$enddate,$filter); |
|
266 | + $flightcnt = $SpotterArchive->getLiveSpotterCount($begindate, $enddate, $filter); |
|
267 | 267 | } else { |
268 | 268 | $flightcnt = $SpotterLive->getLiveSpotterCount($filter); |
269 | 269 | } |
@@ -271,17 +271,17 @@ discard block |
||
271 | 271 | if ($flightcnt == '') $flightcnt = 0; |
272 | 272 | } else $flightcnt = 0; |
273 | 273 | |
274 | -$sqltime = round(microtime(true)-$begintime,2); |
|
274 | +$sqltime = round(microtime(true) - $begintime, 2); |
|
275 | 275 | $minitime = time(); |
276 | 276 | $minitracktime_begin = time(); |
277 | 277 | $minitracktime = $minitracktime_begin; |
278 | 278 | $maxitime = 0; |
279 | -$lastupdate = filter_input(INPUT_GET,'update',FILTER_SANITIZE_NUMBER_INT); |
|
279 | +$lastupdate = filter_input(INPUT_GET, 'update', FILTER_SANITIZE_NUMBER_INT); |
|
280 | 280 | $modelsdb = array(); |
281 | 281 | if (file_exists(dirname(__FILE__).'/models/modelsdb')) { |
282 | - if (($handle = fopen(dirname(__FILE__).'/models/modelsdb','r')) !== FALSE) { |
|
283 | - while (($row = fgetcsv($handle,1000)) !== FALSE) { |
|
284 | - if (isset($row[1]) ){ |
|
282 | + if (($handle = fopen(dirname(__FILE__).'/models/modelsdb', 'r')) !== FALSE) { |
|
283 | + while (($row = fgetcsv($handle, 1000)) !== FALSE) { |
|
284 | + if (isset($row[1])) { |
|
285 | 285 | $model = $row[0]; |
286 | 286 | $modelsdb[$model] = $row[1]; |
287 | 287 | } |
@@ -291,9 +291,9 @@ discard block |
||
291 | 291 | } |
292 | 292 | $modelsdb2 = array(); |
293 | 293 | if (file_exists(dirname(__FILE__).'/models/gltf2/modelsdb')) { |
294 | - if (($handle = fopen(dirname(__FILE__).'/models/gltf2/modelsdb','r')) !== FALSE) { |
|
295 | - while (($row = fgetcsv($handle,1000)) !== FALSE) { |
|
296 | - if (isset($row[1]) ){ |
|
294 | + if (($handle = fopen(dirname(__FILE__).'/models/gltf2/modelsdb', 'r')) !== FALSE) { |
|
295 | + while (($row = fgetcsv($handle, 1000)) !== FALSE) { |
|
296 | + if (isset($row[1])) { |
|
297 | 297 | $model = $row[0]; |
298 | 298 | $glb = $row[1]; |
299 | 299 | if (isset($row[2])) { |
@@ -339,7 +339,7 @@ discard block |
||
339 | 339 | if (!empty($spotter_array) && is_array($spotter_array)) |
340 | 340 | { |
341 | 341 | $nblatlong = 0; |
342 | - foreach($spotter_array as $spotter_item) |
|
342 | + foreach ($spotter_array as $spotter_item) |
|
343 | 343 | { |
344 | 344 | $j++; |
345 | 345 | //if (isset($spotter_item['format_source']) && $spotter_item['format_source'] == 'airwhere') $heightrelative = 'RELATIVE_TO_GROUND'; |
@@ -393,13 +393,13 @@ discard block |
||
393 | 393 | } |
394 | 394 | if (isset($spotter_item['registration'])) $output .= '"registration": "'.$spotter_item['registration'].'",'; |
395 | 395 | if (isset($spotter_item['format_source'])) $output .= '"format": "'.$spotter_item['format_source'].'",'; |
396 | - if (isset($spotter_item['ident'])) $output.= '"ident": "'.$spotter_item['ident'].'",'; |
|
396 | + if (isset($spotter_item['ident'])) $output .= '"ident": "'.$spotter_item['ident'].'",'; |
|
397 | 397 | if ($tracker) { |
398 | 398 | if (isset($spotter_item['type'])) $output .= '"tracker_type": "'.$spotter_item['type'].'",'; |
399 | - $output.= '"type": "tracker"'; |
|
399 | + $output .= '"type": "tracker"'; |
|
400 | 400 | } elseif ($marine) { |
401 | 401 | if (isset($spotter_item['type'])) $output .= '"marine_type": "'.$spotter_item['type'].'",'; |
402 | - $output.= '"type": "marine"'; |
|
402 | + $output .= '"type": "marine"'; |
|
403 | 403 | } else { |
404 | 404 | if ($one3dmodel === false && isset($globalMap3DLiveries) && $globalMap3DLiveries) { |
405 | 405 | $aircraft_icao = $spotter_item['aircraft_icao']; |
@@ -413,14 +413,14 @@ discard block |
||
413 | 413 | if (isset($airline_icao)) { |
414 | 414 | $imagefile = $aircraft_icao.'-'.$airline_icao.'.png'; |
415 | 415 | if (file_exists(dirname(__FILE__).'/models/gltf2/liveries/'.$imagefile)) { |
416 | - $output.= '"liveries": "'.$globalURL.'/models/gltf2/liveries/'.$imagefile.'",'; |
|
416 | + $output .= '"liveries": "'.$globalURL.'/models/gltf2/liveries/'.$imagefile.'",'; |
|
417 | 417 | } |
418 | 418 | } |
419 | 419 | } |
420 | 420 | //if ($ident != '') $output.= '"ident": "'.$ident.'",'; |
421 | 421 | } |
422 | - $output.= '"gltf2": %gltf2%,'; |
|
423 | - $output.= '"type": "flight"'; |
|
422 | + $output .= '"gltf2": %gltf2%,'; |
|
423 | + $output .= '"type": "flight"'; |
|
424 | 424 | } |
425 | 425 | $output .= '},'; |
426 | 426 | |
@@ -791,8 +791,8 @@ discard block |
||
791 | 791 | $output .= '},'; |
792 | 792 | } |
793 | 793 | } |
794 | - if (isset($onground) && $onground) $output = str_replace('%onground%','true',$output); |
|
795 | - else $output = str_replace('%onground%','false',$output); |
|
794 | + if (isset($onground) && $onground) $output = str_replace('%onground%', 'true', $output); |
|
795 | + else $output = str_replace('%onground%', 'false', $output); |
|
796 | 796 | |
797 | 797 | // $output .= '"heightReference": "CLAMP_TO_GROUND",'; |
798 | 798 | //$output .= '"heightReference": "'.$heightrelative.'",'; |
@@ -808,7 +808,7 @@ discard block |
||
808 | 808 | if ($minitime > strtotime($spotter_item['date'])) $minitime = strtotime($spotter_item['date']); |
809 | 809 | if (isset($_COOKIE['MapTrack']) && $id == $_COOKIE['MapTrack'] && $minitracktime > strtotime($spotter_item['date'])) $minitracktime = strtotime($spotter_item['date']); |
810 | 810 | if ($maxitime < strtotime($spotter_item['date'])) $maxitime = strtotime($spotter_item['date']); |
811 | - $output .= '"'.date("c",strtotime($spotter_item['date'])).'", '; |
|
811 | + $output .= '"'.date("c", strtotime($spotter_item['date'])).'", '; |
|
812 | 812 | $output .= $spotter_item['longitude'].', '; |
813 | 813 | $output .= $spotter_item['latitude']; |
814 | 814 | $prevlong = $spotter_item['longitude']; |
@@ -836,8 +836,8 @@ discard block |
||
836 | 836 | //$quat = quaternionrotate(deg2rad($spotter_item['heading']),deg2rad(0),deg2rad(0)); |
837 | 837 | //$orientation .= '"'.date("c",strtotime($spotter_item['date'])).'",'.$quat['x'].','.$quat['y'].','.$quat['z'].','.$quat['w']; |
838 | 838 | } else { |
839 | - $nblatlong = $nblatlong+1; |
|
840 | - $output .= ',"'.date("c",strtotime($spotter_item['date'])).'", '; |
|
839 | + $nblatlong = $nblatlong + 1; |
|
840 | + $output .= ',"'.date("c", strtotime($spotter_item['date'])).'", '; |
|
841 | 841 | if ($maxitime < strtotime($spotter_item['date'])) $maxitime = strtotime($spotter_item['date']); |
842 | 842 | if ($spotter_item['ground_speed'] == 0) { |
843 | 843 | $output .= $prevlong.', '; |
@@ -878,26 +878,26 @@ discard block |
||
878 | 878 | $output .= ']'; |
879 | 879 | if (isset($globalArchive) && $globalArchive === TRUE) { |
880 | 880 | if (isset($begindateinitial)) { |
881 | - $output = str_replace('%minitime%',date("c",$begindateinitial),$output); |
|
882 | - } elseif ((time()-$globalLiveInterval) > $minitime) { |
|
883 | - if (time()-$globalLiveInterval > $maxitime) { |
|
884 | - $output = str_replace('%minitime%',date("c",$maxitime),$output); |
|
881 | + $output = str_replace('%minitime%', date("c", $begindateinitial), $output); |
|
882 | + } elseif ((time() - $globalLiveInterval) > $minitime) { |
|
883 | + if (time() - $globalLiveInterval > $maxitime) { |
|
884 | + $output = str_replace('%minitime%', date("c", $maxitime), $output); |
|
885 | 885 | } else { |
886 | - $output = str_replace('%minitime%',date("c",time()-$globalLiveInterval),$output); |
|
886 | + $output = str_replace('%minitime%', date("c", time() - $globalLiveInterval), $output); |
|
887 | 887 | } |
888 | 888 | } |
889 | - else $output = str_replace('%minitime%',date("c",$minitime),$output); |
|
889 | + else $output = str_replace('%minitime%', date("c", $minitime), $output); |
|
890 | 890 | } elseif (isset($_COOKIE['MapTrack']) && $_COOKIE['MapTrack'] != '' && $minitracktime != $minitracktime_begin) { |
891 | - $output = str_replace('%minitime%',date("c",$minitracktime),$output); |
|
891 | + $output = str_replace('%minitime%', date("c", $minitracktime), $output); |
|
892 | 892 | } else { |
893 | - $output = str_replace('%minitime%',date("c",$minitime),$output); |
|
893 | + $output = str_replace('%minitime%', date("c", $minitime), $output); |
|
894 | 894 | } |
895 | 895 | if (isset($enddateinitial)) { |
896 | - $output = str_replace('%maxitime%',date("c",$enddateinitial),$output); |
|
896 | + $output = str_replace('%maxitime%', date("c", $enddateinitial), $output); |
|
897 | 897 | } else { |
898 | - $output = str_replace('%maxitime%',date("c",$maxitime),$output); |
|
898 | + $output = str_replace('%maxitime%', date("c", $maxitime), $output); |
|
899 | 899 | } |
900 | -if ($gltf2) $output = str_replace('%gltf2%','true',$output); |
|
901 | -else $output = str_replace('%gltf2%','false',$output); |
|
900 | +if ($gltf2) $output = str_replace('%gltf2%', 'true', $output); |
|
901 | +else $output = str_replace('%gltf2%', 'false', $output); |
|
902 | 902 | print $output; |
903 | 903 | ?> |
@@ -1,7 +1,7 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | // This script can be slow... |
3 | 3 | set_time_limit(0); |
4 | -ini_set('max_execution_time',6000); |
|
4 | +ini_set('max_execution_time', 6000); |
|
5 | 5 | require_once('require/class.Connection.php'); |
6 | 6 | require_once('require/class.Common.php'); |
7 | 7 | |
@@ -63,24 +63,24 @@ discard block |
||
63 | 63 | $min = false; |
64 | 64 | $allhistory = false; |
65 | 65 | $filter['source'] = array(); |
66 | -if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') $filter['source'] = array_merge($filter['source'],array('vatsimtxt')); |
|
67 | -if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') $filter['source'] = array_merge($filter['source'],array('whazzup')); |
|
68 | -if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') $filter['source'] = array_merge($filter['source'],array('phpvmacars')); |
|
69 | -if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') $filter['source'] = array_merge($filter['source'],array('sbs','famaprs')); |
|
70 | -if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') $filter['source'] = array_merge($filter['source'],array('aprs')); |
|
71 | -if (isset($_COOKIE['filter_ident']) && $_COOKIE['filter_ident'] != '') $filter['ident'] = filter_var($_COOKIE['filter_ident'],FILTER_SANITIZE_STRING); |
|
72 | -if (isset($_COOKIE['filter_mmsi']) && $_COOKIE['filter_mmsi'] != '') $filter['mmsi'] = filter_var($_COOKIE['filter_mmsi'],FILTER_SANITIZE_STRING); |
|
73 | -if (isset($_COOKIE['filter_Airlines']) && $_COOKIE['filter_Airlines'] != '') $filter['airlines'] = filter_var_array(explode(',',$_COOKIE['filter_Airlines']),FILTER_SANITIZE_STRING); |
|
74 | -if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') $filter['source_aprs'] = filter_var_array(explode(',',$_COOKIE['filter_Sources']),FILTER_SANITIZE_STRING); |
|
75 | -if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') $filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'],FILTER_SANITIZE_STRING); |
|
76 | -if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] != 'all') $filter['alliance'] = filter_var($_COOKIE['filter_alliance'],FILTER_SANITIZE_STRING); |
|
66 | +if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') $filter['source'] = array_merge($filter['source'], array('vatsimtxt')); |
|
67 | +if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') $filter['source'] = array_merge($filter['source'], array('whazzup')); |
|
68 | +if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') $filter['source'] = array_merge($filter['source'], array('phpvmacars')); |
|
69 | +if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') $filter['source'] = array_merge($filter['source'], array('sbs', 'famaprs')); |
|
70 | +if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') $filter['source'] = array_merge($filter['source'], array('aprs')); |
|
71 | +if (isset($_COOKIE['filter_ident']) && $_COOKIE['filter_ident'] != '') $filter['ident'] = filter_var($_COOKIE['filter_ident'], FILTER_SANITIZE_STRING); |
|
72 | +if (isset($_COOKIE['filter_mmsi']) && $_COOKIE['filter_mmsi'] != '') $filter['mmsi'] = filter_var($_COOKIE['filter_mmsi'], FILTER_SANITIZE_STRING); |
|
73 | +if (isset($_COOKIE['filter_Airlines']) && $_COOKIE['filter_Airlines'] != '') $filter['airlines'] = filter_var_array(explode(',', $_COOKIE['filter_Airlines']), FILTER_SANITIZE_STRING); |
|
74 | +if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') $filter['source_aprs'] = filter_var_array(explode(',', $_COOKIE['filter_Sources']), FILTER_SANITIZE_STRING); |
|
75 | +if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') $filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'], FILTER_SANITIZE_STRING); |
|
76 | +if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] != 'all') $filter['alliance'] = filter_var($_COOKIE['filter_alliance'], FILTER_SANITIZE_STRING); |
|
77 | 77 | |
78 | 78 | if (isset($globalMapPopup) && !$globalMapPopup && !(isset($_COOKIE['flightpopup']) && $_COOKIE['flightpopup'] == 'true')) { |
79 | 79 | $min = true; |
80 | 80 | } else $min = false; |
81 | 81 | |
82 | 82 | if (isset($_GET['ident'])) { |
83 | - $ident = filter_input(INPUT_GET,'ident',FILTER_SANITIZE_STRING); |
|
83 | + $ident = filter_input(INPUT_GET, 'ident', FILTER_SANITIZE_STRING); |
|
84 | 84 | $from_archive = true; |
85 | 85 | if ($tracker) { |
86 | 86 | $spotter_array = $TrackerArchive->getLastArchiveTrackerDataByIdent($ident); |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | $allhistory = true; |
95 | 95 | } |
96 | 96 | elseif (isset($_GET['flightaware_id'])) { |
97 | - $flightaware_id = filter_input(INPUT_GET,'flightaware_id',FILTER_SANITIZE_STRING); |
|
97 | + $flightaware_id = filter_input(INPUT_GET, 'flightaware_id', FILTER_SANITIZE_STRING); |
|
98 | 98 | $from_archive = true; |
99 | 99 | if ($tracker) { |
100 | 100 | $spotter_array = $TrackerArchive->getLastArchiveTrackerDataById($flightaware_id); |
@@ -109,26 +109,26 @@ discard block |
||
109 | 109 | } |
110 | 110 | elseif (isset($_GET['archive']) && isset($_GET['begindate']) && isset($_GET['enddate']) && isset($_GET['speed'])) { |
111 | 111 | $from_archive = true; |
112 | - $begindate = filter_input(INPUT_GET,'begindate',FILTER_SANITIZE_NUMBER_INT); |
|
112 | + $begindate = filter_input(INPUT_GET, 'begindate', FILTER_SANITIZE_NUMBER_INT); |
|
113 | 113 | if (isset($globalAircraftMaxUpdate)) $begindate = $begindate - $globalAircraftMaxUpdate; |
114 | 114 | else $begindate = $begindate - 3000; |
115 | - $enddate = filter_input(INPUT_GET,'enddate',FILTER_SANITIZE_NUMBER_INT); |
|
116 | - $archivespeed = filter_input(INPUT_GET,'speed',FILTER_SANITIZE_NUMBER_INT); |
|
117 | - $part = filter_input(INPUT_GET,'part',FILTER_SANITIZE_NUMBER_INT); |
|
115 | + $enddate = filter_input(INPUT_GET, 'enddate', FILTER_SANITIZE_NUMBER_INT); |
|
116 | + $archivespeed = filter_input(INPUT_GET, 'speed', FILTER_SANITIZE_NUMBER_INT); |
|
117 | + $part = filter_input(INPUT_GET, 'part', FILTER_SANITIZE_NUMBER_INT); |
|
118 | 118 | if ($part == '') $part = 0; |
119 | 119 | |
120 | 120 | if ($begindate != '' && $enddate != '') { |
121 | - $begindate = date('Y-m-d H:i:s',$begindate); |
|
122 | - $enddate = date('Y-m-d H:i:s',$enddate); |
|
121 | + $begindate = date('Y-m-d H:i:s', $begindate); |
|
122 | + $enddate = date('Y-m-d H:i:s', $enddate); |
|
123 | 123 | //$spotter_array = $SpotterArchive->getMinLiveSpotterDataPlayback($begindate,$enddate,$filter); |
124 | 124 | if ($tracker) { |
125 | - $spotter_array = $TrackerArchive->getMinLiveTrackerData($begindate,$enddate,$filter); |
|
125 | + $spotter_array = $TrackerArchive->getMinLiveTrackerData($begindate, $enddate, $filter); |
|
126 | 126 | } |
127 | 127 | elseif ($marine) { |
128 | - $spotter_array = $MarineArchive->getMinLiveMarineData($begindate,$enddate,$filter); |
|
128 | + $spotter_array = $MarineArchive->getMinLiveMarineData($begindate, $enddate, $filter); |
|
129 | 129 | } |
130 | 130 | else { |
131 | - $spotter_array = $SpotterArchive->getMinLiveSpotterData($begindate,$enddate,$filter,$part); |
|
131 | + $spotter_array = $SpotterArchive->getMinLiveSpotterData($begindate, $enddate, $filter, $part); |
|
132 | 132 | } |
133 | 133 | } |
134 | 134 | } |
@@ -139,7 +139,7 @@ discard block |
||
139 | 139 | if ($flightcnt == '') $flightcnt = 0; |
140 | 140 | } else $flightcnt = 0; |
141 | 141 | |
142 | -$sqltime = round(microtime(true)-$begintime,2); |
|
142 | +$sqltime = round(microtime(true) - $begintime, 2); |
|
143 | 143 | |
144 | 144 | $pfi = ''; |
145 | 145 | //var_dump($spotter_array); |
@@ -154,7 +154,7 @@ discard block |
||
154 | 154 | $begin = true; |
155 | 155 | if (!empty($spotter_array) && is_array($spotter_array)) { |
156 | 156 | $output .= '"features": ['; |
157 | - foreach($spotter_array as $spotter_item) { |
|
157 | + foreach ($spotter_array as $spotter_item) { |
|
158 | 158 | $j++; |
159 | 159 | date_default_timezone_set('UTC'); |
160 | 160 | if ($tracker) { |
@@ -178,7 +178,7 @@ discard block |
||
178 | 178 | if ($begin) { |
179 | 179 | if ($j > 1) { |
180 | 180 | if (isset($output_time)) { |
181 | - $output_time = substr($output_time, 0, -1); |
|
181 | + $output_time = substr($output_time, 0, -1); |
|
182 | 182 | $output .= '"time": ['.$output_time.']'; |
183 | 183 | } |
184 | 184 | $output .= '},'; |
@@ -187,7 +187,7 @@ discard block |
||
187 | 187 | $output .= '"type": "LineString",'; |
188 | 188 | $output .= '"coordinates": ['; |
189 | 189 | if (isset($output_history)) { |
190 | - $output_history = substr($output_history, 0, -1); |
|
190 | + $output_history = substr($output_history, 0, -1); |
|
191 | 191 | $output .= $output_history; |
192 | 192 | } |
193 | 193 | $output .= ']}},'; |
@@ -218,7 +218,7 @@ discard block |
||
218 | 218 | $output .= '"fi": "'.$pfi.'",'; |
219 | 219 | if (isset($begindate)) $output .= '"archive_date": "'.$begindate.'",'; |
220 | 220 | if (isset($spotter_item['ident']) && $spotter_item['ident'] != '') { |
221 | - $output .= '"c": "'.str_replace('\\','',$spotter_item['ident']).'",'; |
|
221 | + $output .= '"c": "'.str_replace('\\', '', $spotter_item['ident']).'",'; |
|
222 | 222 | //" |
223 | 223 | } else { |
224 | 224 | $output .= '"c": "NA",'; |
@@ -352,7 +352,7 @@ discard block |
||
352 | 352 | |
353 | 353 | if ($j > 1) { |
354 | 354 | if (isset($output_time)) { |
355 | - $output_time = substr($output_time, 0, -1); |
|
355 | + $output_time = substr($output_time, 0, -1); |
|
356 | 356 | $output .= '"time": ['.$output_time.']'; |
357 | 357 | } |
358 | 358 | $output .= '},'; |
@@ -361,7 +361,7 @@ discard block |
||
361 | 361 | $output .= '"type": "LineString",'; |
362 | 362 | $output .= '"coordinates": ['; |
363 | 363 | if (isset($output_history)) { |
364 | - $output_history = substr($output_history, 0, -1); |
|
364 | + $output_history = substr($output_history, 0, -1); |
|
365 | 365 | $output .= $output_history; |
366 | 366 | } |
367 | 367 | $output .= ']'; |
@@ -372,7 +372,7 @@ discard block |
||
372 | 372 | $output = substr($output, 0, -1); |
373 | 373 | $output .= ']'; |
374 | 374 | $output .= ',"initial_sqltime": "'.$sqltime.'",'; |
375 | - $output .= '"totaltime": "'.round(microtime(true)-$begintime,2).'",'; |
|
375 | + $output .= '"totaltime": "'.round(microtime(true) - $begintime, 2).'",'; |
|
376 | 376 | if (isset($begindate)) $output .= '"archive_date": "'.$begindate.'",'; |
377 | 377 | $output .= '"fc": "'.$flightcnt.'"'; |
378 | 378 | } else { |
@@ -25,12 +25,10 @@ discard block |
||
25 | 25 | if ($tracker) { |
26 | 26 | require_once('require/class.Tracker.php'); |
27 | 27 | require_once('require/class.TrackerArchive.php'); |
28 | -} |
|
29 | -elseif ($marine) { |
|
28 | +} elseif ($marine) { |
|
30 | 29 | require_once('require/class.Marine.php'); |
31 | 30 | require_once('require/class.MarineArchive.php'); |
32 | -} |
|
33 | -else { |
|
31 | +} else { |
|
34 | 32 | require_once('require/class.Spotter.php'); |
35 | 33 | require_once('require/class.SpotterArchive.php'); |
36 | 34 | } |
@@ -38,12 +36,10 @@ discard block |
||
38 | 36 | if ($tracker) { |
39 | 37 | $Tracker = new Tracker(); |
40 | 38 | $TrackerArchive = new TrackerArchive(); |
41 | -} |
|
42 | -elseif ($marine) { |
|
39 | +} elseif ($marine) { |
|
43 | 40 | $Marine = new Marine(); |
44 | 41 | $MarineArchive = new MarineArchive(); |
45 | -} |
|
46 | -else { |
|
42 | +} else { |
|
47 | 43 | $Spotter = new Spotter(); |
48 | 44 | $SpotterArchive = new SpotterArchive(); |
49 | 45 | } |
@@ -56,66 +52,92 @@ discard block |
||
56 | 52 | } |
57 | 53 | header('Content-Type: text/javascript'); |
58 | 54 | |
59 | -if (!isset($globalJsonCompress)) $compress = true; |
|
60 | -else $compress = $globalJsonCompress; |
|
55 | +if (!isset($globalJsonCompress)) { |
|
56 | + $compress = true; |
|
57 | +} else { |
|
58 | + $compress = $globalJsonCompress; |
|
59 | +} |
|
61 | 60 | |
62 | 61 | $from_archive = false; |
63 | 62 | $min = false; |
64 | 63 | $allhistory = false; |
65 | 64 | $filter['source'] = array(); |
66 | -if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') $filter['source'] = array_merge($filter['source'],array('vatsimtxt')); |
|
67 | -if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') $filter['source'] = array_merge($filter['source'],array('whazzup')); |
|
68 | -if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') $filter['source'] = array_merge($filter['source'],array('phpvmacars')); |
|
69 | -if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') $filter['source'] = array_merge($filter['source'],array('sbs','famaprs')); |
|
70 | -if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') $filter['source'] = array_merge($filter['source'],array('aprs')); |
|
71 | -if (isset($_COOKIE['filter_ident']) && $_COOKIE['filter_ident'] != '') $filter['ident'] = filter_var($_COOKIE['filter_ident'],FILTER_SANITIZE_STRING); |
|
72 | -if (isset($_COOKIE['filter_mmsi']) && $_COOKIE['filter_mmsi'] != '') $filter['mmsi'] = filter_var($_COOKIE['filter_mmsi'],FILTER_SANITIZE_STRING); |
|
73 | -if (isset($_COOKIE['filter_Airlines']) && $_COOKIE['filter_Airlines'] != '') $filter['airlines'] = filter_var_array(explode(',',$_COOKIE['filter_Airlines']),FILTER_SANITIZE_STRING); |
|
74 | -if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') $filter['source_aprs'] = filter_var_array(explode(',',$_COOKIE['filter_Sources']),FILTER_SANITIZE_STRING); |
|
75 | -if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') $filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'],FILTER_SANITIZE_STRING); |
|
76 | -if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] != 'all') $filter['alliance'] = filter_var($_COOKIE['filter_alliance'],FILTER_SANITIZE_STRING); |
|
65 | +if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') { |
|
66 | + $filter['source'] = array_merge($filter['source'],array('vatsimtxt')); |
|
67 | +} |
|
68 | +if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') { |
|
69 | + $filter['source'] = array_merge($filter['source'],array('whazzup')); |
|
70 | +} |
|
71 | +if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') { |
|
72 | + $filter['source'] = array_merge($filter['source'],array('phpvmacars')); |
|
73 | +} |
|
74 | +if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') { |
|
75 | + $filter['source'] = array_merge($filter['source'],array('sbs','famaprs')); |
|
76 | +} |
|
77 | +if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') { |
|
78 | + $filter['source'] = array_merge($filter['source'],array('aprs')); |
|
79 | +} |
|
80 | +if (isset($_COOKIE['filter_ident']) && $_COOKIE['filter_ident'] != '') { |
|
81 | + $filter['ident'] = filter_var($_COOKIE['filter_ident'],FILTER_SANITIZE_STRING); |
|
82 | +} |
|
83 | +if (isset($_COOKIE['filter_mmsi']) && $_COOKIE['filter_mmsi'] != '') { |
|
84 | + $filter['mmsi'] = filter_var($_COOKIE['filter_mmsi'],FILTER_SANITIZE_STRING); |
|
85 | +} |
|
86 | +if (isset($_COOKIE['filter_Airlines']) && $_COOKIE['filter_Airlines'] != '') { |
|
87 | + $filter['airlines'] = filter_var_array(explode(',',$_COOKIE['filter_Airlines']),FILTER_SANITIZE_STRING); |
|
88 | +} |
|
89 | +if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') { |
|
90 | + $filter['source_aprs'] = filter_var_array(explode(',',$_COOKIE['filter_Sources']),FILTER_SANITIZE_STRING); |
|
91 | +} |
|
92 | +if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') { |
|
93 | + $filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'],FILTER_SANITIZE_STRING); |
|
94 | +} |
|
95 | +if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] != 'all') { |
|
96 | + $filter['alliance'] = filter_var($_COOKIE['filter_alliance'],FILTER_SANITIZE_STRING); |
|
97 | +} |
|
77 | 98 | |
78 | 99 | if (isset($globalMapPopup) && !$globalMapPopup && !(isset($_COOKIE['flightpopup']) && $_COOKIE['flightpopup'] == 'true')) { |
79 | 100 | $min = true; |
80 | -} else $min = false; |
|
101 | +} else { |
|
102 | + $min = false; |
|
103 | +} |
|
81 | 104 | |
82 | 105 | if (isset($_GET['ident'])) { |
83 | 106 | $ident = filter_input(INPUT_GET,'ident',FILTER_SANITIZE_STRING); |
84 | 107 | $from_archive = true; |
85 | 108 | if ($tracker) { |
86 | 109 | $spotter_array = $TrackerArchive->getLastArchiveTrackerDataByIdent($ident); |
87 | - } |
|
88 | - elseif ($marine) { |
|
110 | + } elseif ($marine) { |
|
89 | 111 | $spotter_array = $MarineArchive->getLastArchiveMarineDataByIdent($ident); |
90 | - } |
|
91 | - else { |
|
112 | + } else { |
|
92 | 113 | $spotter_array = $SpotterArchive->getLastArchiveSpotterDataByIdent($ident); |
93 | 114 | } |
94 | 115 | $allhistory = true; |
95 | -} |
|
96 | -elseif (isset($_GET['flightaware_id'])) { |
|
116 | +} elseif (isset($_GET['flightaware_id'])) { |
|
97 | 117 | $flightaware_id = filter_input(INPUT_GET,'flightaware_id',FILTER_SANITIZE_STRING); |
98 | 118 | $from_archive = true; |
99 | 119 | if ($tracker) { |
100 | 120 | $spotter_array = $TrackerArchive->getLastArchiveTrackerDataById($flightaware_id); |
101 | - } |
|
102 | - elseif ($marine) { |
|
121 | + } elseif ($marine) { |
|
103 | 122 | $spotter_array = $MarineArchive->getLastArchiveMarineDataById($flightaware_id); |
104 | - } |
|
105 | - else { |
|
123 | + } else { |
|
106 | 124 | $spotter_array = $SpotterArchive->getLastArchiveSpotterDataById($flightaware_id); |
107 | 125 | } |
108 | 126 | $allhistory = true; |
109 | -} |
|
110 | -elseif (isset($_GET['archive']) && isset($_GET['begindate']) && isset($_GET['enddate']) && isset($_GET['speed'])) { |
|
127 | +} elseif (isset($_GET['archive']) && isset($_GET['begindate']) && isset($_GET['enddate']) && isset($_GET['speed'])) { |
|
111 | 128 | $from_archive = true; |
112 | 129 | $begindate = filter_input(INPUT_GET,'begindate',FILTER_SANITIZE_NUMBER_INT); |
113 | - if (isset($globalAircraftMaxUpdate)) $begindate = $begindate - $globalAircraftMaxUpdate; |
|
114 | - else $begindate = $begindate - 3000; |
|
130 | + if (isset($globalAircraftMaxUpdate)) { |
|
131 | + $begindate = $begindate - $globalAircraftMaxUpdate; |
|
132 | + } else { |
|
133 | + $begindate = $begindate - 3000; |
|
134 | + } |
|
115 | 135 | $enddate = filter_input(INPUT_GET,'enddate',FILTER_SANITIZE_NUMBER_INT); |
116 | 136 | $archivespeed = filter_input(INPUT_GET,'speed',FILTER_SANITIZE_NUMBER_INT); |
117 | 137 | $part = filter_input(INPUT_GET,'part',FILTER_SANITIZE_NUMBER_INT); |
118 | - if ($part == '') $part = 0; |
|
138 | + if ($part == '') { |
|
139 | + $part = 0; |
|
140 | + } |
|
119 | 141 | |
120 | 142 | if ($begindate != '' && $enddate != '') { |
121 | 143 | $begindate = date('Y-m-d H:i:s',$begindate); |
@@ -123,11 +145,9 @@ discard block |
||
123 | 145 | //$spotter_array = $SpotterArchive->getMinLiveSpotterDataPlayback($begindate,$enddate,$filter); |
124 | 146 | if ($tracker) { |
125 | 147 | $spotter_array = $TrackerArchive->getMinLiveTrackerData($begindate,$enddate,$filter); |
126 | - } |
|
127 | - elseif ($marine) { |
|
148 | + } elseif ($marine) { |
|
128 | 149 | $spotter_array = $MarineArchive->getMinLiveMarineData($begindate,$enddate,$filter); |
129 | - } |
|
130 | - else { |
|
150 | + } else { |
|
131 | 151 | $spotter_array = $SpotterArchive->getMinLiveSpotterData($begindate,$enddate,$filter,$part); |
132 | 152 | } |
133 | 153 | } |
@@ -136,8 +156,12 @@ discard block |
||
136 | 156 | if (!empty($spotter_array)) { |
137 | 157 | //$flightcnt = $SpotterArchive->getLiveSpotterCount($begindate,$enddate,$filter); |
138 | 158 | $flightcnt = 0; |
139 | - if ($flightcnt == '') $flightcnt = 0; |
|
140 | -} else $flightcnt = 0; |
|
159 | + if ($flightcnt == '') { |
|
160 | + $flightcnt = 0; |
|
161 | + } |
|
162 | + } else { |
|
163 | + $flightcnt = 0; |
|
164 | +} |
|
141 | 165 | |
142 | 166 | $sqltime = round(microtime(true)-$begintime,2); |
143 | 167 | |
@@ -147,8 +171,11 @@ discard block |
||
147 | 171 | $aircrafts_shadow = array(); |
148 | 172 | $output = '{'; |
149 | 173 | $output .= '"type": "FeatureCollection",'; |
150 | -if ($min) $output .= '"minimal": "true",'; |
|
151 | -else $output .= '"minimal": "false",'; |
|
174 | +if ($min) { |
|
175 | + $output .= '"minimal": "true",'; |
|
176 | +} else { |
|
177 | + $output .= '"minimal": "false",'; |
|
178 | +} |
|
152 | 179 | $output .= '"fc": "'.$flightcnt.'",'; |
153 | 180 | $output .= '"sqt": "'.$sqltime.'",'; |
154 | 181 | $begin = true; |
@@ -161,15 +188,17 @@ discard block |
||
161 | 188 | if ($pfi != $spotter_item['famtrackid']) { |
162 | 189 | $pfi = $spotter_item['famtrackid']; |
163 | 190 | $begin = true; |
164 | - } else $spotter_history_array = 0; |
|
165 | - } |
|
166 | - elseif ($marine) { |
|
191 | + } else { |
|
192 | + $spotter_history_array = 0; |
|
193 | + } |
|
194 | + } elseif ($marine) { |
|
167 | 195 | if ($pfi != $spotter_item['fammarine_d']) { |
168 | 196 | $pfi = $spotter_item['fammarine_id']; |
169 | 197 | $begin = true; |
170 | - } else $spotter_history_array = 0; |
|
171 | - } |
|
172 | - else { |
|
198 | + } else { |
|
199 | + $spotter_history_array = 0; |
|
200 | + } |
|
201 | + } else { |
|
173 | 202 | if ($pfi != $spotter_item['flightaware_id']) { |
174 | 203 | $pfi = $spotter_item['flightaware_id']; |
175 | 204 | $begin = true; |
@@ -206,7 +235,9 @@ discard block |
||
206 | 235 | $output_history .= '['.$spotter_item['longitude'].', '.$spotter_item['latitude'].'],'; |
207 | 236 | $output_time .= (strtotime($spotter_item['date'])*1000).','; |
208 | 237 | $previousts = strtotime($spotter_item['date']); |
209 | - if ($k > 1 && (strtotime($spotter_item['date'])*1000 > $enddate)) $end = true; |
|
238 | + if ($k > 1 && (strtotime($spotter_item['date'])*1000 > $enddate)) { |
|
239 | + $end = true; |
|
240 | + } |
|
210 | 241 | } |
211 | 242 | |
212 | 243 | if ($begin) { |
@@ -216,7 +247,9 @@ discard block |
||
216 | 247 | $output .= '"type": "Feature",'; |
217 | 248 | $output .= '"properties": {'; |
218 | 249 | $output .= '"fi": "'.$pfi.'",'; |
219 | - if (isset($begindate)) $output .= '"archive_date": "'.$begindate.'",'; |
|
250 | + if (isset($begindate)) { |
|
251 | + $output .= '"archive_date": "'.$begindate.'",'; |
|
252 | + } |
|
220 | 253 | if (isset($spotter_item['ident']) && $spotter_item['ident'] != '') { |
221 | 254 | $output .= '"c": "'.str_replace('\\','',$spotter_item['ident']).'",'; |
222 | 255 | //" |
@@ -224,14 +257,20 @@ discard block |
||
224 | 257 | $output .= '"c": "NA",'; |
225 | 258 | } |
226 | 259 | if (!isset($spotter_item['aircraft_shadow']) && !$tracker && !$marine) { |
227 | - if (!isset($spotter_item['aircraft_icao']) || $spotter_item['aircraft_icao'] == '') $spotter_item['aircraft_shadow'] = ''; |
|
228 | - else { |
|
260 | + if (!isset($spotter_item['aircraft_icao']) || $spotter_item['aircraft_icao'] == '') { |
|
261 | + $spotter_item['aircraft_shadow'] = ''; |
|
262 | + } else { |
|
229 | 263 | $aircraft_icao = $spotter_item['aircraft_icao']; |
230 | 264 | $aircraft_info = $Spotter->getAllAircraftInfo($spotter_item['aircraft_icao']); |
231 | - if (count($aircraft_info) > 0) $spotter_item['aircraft_shadow'] = $aircraft_info[0]['aircraft_shadow']; |
|
232 | - elseif (isset($spotter_item['format_source']) && $spotter_item['format_source'] == 'aprs') $spotter_item['aircraft_shadow'] = 'PA18.png'; |
|
233 | - elseif ($aircraft_icao == 'PARAGLIDER') $spotter_item['aircraft_shadow'] = 'PARAGLIDER.png'; |
|
234 | - else $spotter_item['aircraft_shadow'] = ''; |
|
265 | + if (count($aircraft_info) > 0) { |
|
266 | + $spotter_item['aircraft_shadow'] = $aircraft_info[0]['aircraft_shadow']; |
|
267 | + } elseif (isset($spotter_item['format_source']) && $spotter_item['format_source'] == 'aprs') { |
|
268 | + $spotter_item['aircraft_shadow'] = 'PA18.png'; |
|
269 | + } elseif ($aircraft_icao == 'PARAGLIDER') { |
|
270 | + $spotter_item['aircraft_shadow'] = 'PARAGLIDER.png'; |
|
271 | + } else { |
|
272 | + $spotter_item['aircraft_shadow'] = ''; |
|
273 | + } |
|
235 | 274 | $aircrafts_shadow[$aircraft_icao] = $spotter_item['aircraft_shadow']; |
236 | 275 | } |
237 | 276 | } |
@@ -239,93 +278,139 @@ discard block |
||
239 | 278 | if (!isset($spotter_item['aircraft_shadow']) || $spotter_item['aircraft_shadow'] == '') { |
240 | 279 | if ($tracker) { |
241 | 280 | if (isset($spotter_item['type']) && $spotter_item['type'] == 'Ambulance') { |
242 | - if ($compress) $output .= '"as": "ambulance.png",'; |
|
243 | - else $output .= '"aircraft_shadow": "ambulance.png",'; |
|
244 | - } |
|
245 | - elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Police') { |
|
246 | - if ($compress) $output .= '"as": "police.png",'; |
|
247 | - else $output .= '"aircraft_shadow": "police.png",'; |
|
248 | - } |
|
249 | - elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Yacht (Sail)') { |
|
250 | - if ($compress) $output .= '"as": "ship.png",'; |
|
251 | - else $output .= '"aircraft_shadow": "ship.png",'; |
|
252 | - } |
|
253 | - elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Ship (Power Boat)') { |
|
254 | - if ($compress) $output .= '"as": "ship.png",'; |
|
255 | - else $output .= '"aircraft_shadow": "ship.png",'; |
|
256 | - } |
|
257 | - elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Shuttle') { |
|
258 | - if ($compress) $output .= '"as": "ship.png",'; |
|
259 | - else $output .= '"aircraft_shadow": "ship.png",'; |
|
281 | + if ($compress) { |
|
282 | + $output .= '"as": "ambulance.png",'; |
|
283 | + } else { |
|
284 | + $output .= '"aircraft_shadow": "ambulance.png",'; |
|
285 | + } |
|
286 | + } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Police') { |
|
287 | + if ($compress) { |
|
288 | + $output .= '"as": "police.png",'; |
|
289 | + } else { |
|
290 | + $output .= '"aircraft_shadow": "police.png",'; |
|
291 | + } |
|
292 | + } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Yacht (Sail)') { |
|
293 | + if ($compress) { |
|
294 | + $output .= '"as": "ship.png",'; |
|
295 | + } else { |
|
296 | + $output .= '"aircraft_shadow": "ship.png",'; |
|
297 | + } |
|
298 | + } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Ship (Power Boat)') { |
|
299 | + if ($compress) { |
|
300 | + $output .= '"as": "ship.png",'; |
|
301 | + } else { |
|
302 | + $output .= '"aircraft_shadow": "ship.png",'; |
|
303 | + } |
|
304 | + } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Shuttle') { |
|
305 | + if ($compress) { |
|
306 | + $output .= '"as": "ship.png",'; |
|
307 | + } else { |
|
308 | + $output .= '"aircraft_shadow": "ship.png",'; |
|
309 | + } |
|
310 | + } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Truck') { |
|
311 | + if ($compress) { |
|
312 | + $output .= '"as": "truck.png",'; |
|
313 | + } else { |
|
314 | + $output .= '"aircraft_shadow": "truck.png",'; |
|
315 | + } |
|
316 | + } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Truck (18 Wheeler)') { |
|
317 | + if ($compress) { |
|
318 | + $output .= '"as": "truck.png",'; |
|
319 | + } else { |
|
320 | + $output .= '"aircraft_shadow": "truck.png",'; |
|
321 | + } |
|
322 | + } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Aircraft (small)') { |
|
323 | + if ($compress) { |
|
324 | + $output .= '"as": "aircraft.png",'; |
|
325 | + } else { |
|
326 | + $output .= '"aircraft_shadow": "aircraft.png",'; |
|
327 | + } |
|
328 | + } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Large Aircraft') { |
|
329 | + if ($compress) { |
|
330 | + $output .= '"as": "aircraft.png",'; |
|
331 | + } else { |
|
332 | + $output .= '"aircraft_shadow": "aircraft.png",'; |
|
333 | + } |
|
334 | + } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Helicopter') { |
|
335 | + if ($compress) { |
|
336 | + $output .= '"as": "helico.png",'; |
|
337 | + } else { |
|
338 | + $output .= '"aircraft_shadow": "helico.png",'; |
|
339 | + } |
|
340 | + } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Railroad Engine') { |
|
341 | + if ($compress) { |
|
342 | + $output .= '"as": "rail.png",'; |
|
343 | + } else { |
|
344 | + $output .= '"aircraft_shadow": "rail.png",'; |
|
345 | + } |
|
346 | + } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Firetruck') { |
|
347 | + if ($compress) { |
|
348 | + $output .= '"as": "firetruck.png",'; |
|
349 | + } else { |
|
350 | + $output .= '"aircraft_shadow": "firetruck.png",'; |
|
351 | + } |
|
352 | + } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Bus') { |
|
353 | + if ($compress) { |
|
354 | + $output .= '"as": "bus.png",'; |
|
355 | + } else { |
|
356 | + $output .= '"aircraft_shadow": "bus.png",'; |
|
357 | + } |
|
358 | + } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Phone') { |
|
359 | + if ($compress) { |
|
360 | + $output .= '"as": "phone.png",'; |
|
361 | + } else { |
|
362 | + $output .= '"aircraft_shadow": "phone.png",'; |
|
363 | + } |
|
364 | + } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Jogger') { |
|
365 | + if ($compress) { |
|
366 | + $output .= '"as": "jogger.png",'; |
|
367 | + } else { |
|
368 | + $output .= '"aircraft_shadow": "jogger.png",'; |
|
369 | + } |
|
370 | + } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Bike') { |
|
371 | + if ($compress) { |
|
372 | + $output .= '"as": "bike.png",'; |
|
373 | + } else { |
|
374 | + $output .= '"aircraft_shadow": "bike.png",'; |
|
375 | + } |
|
376 | + } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Motorcycle') { |
|
377 | + if ($compress) { |
|
378 | + $output .= '"as": "motorcycle.png",'; |
|
379 | + } else { |
|
380 | + $output .= '"aircraft_shadow": "motorcycle.png",'; |
|
381 | + } |
|
382 | + } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Balloon') { |
|
383 | + if ($compress) { |
|
384 | + $output .= '"as": "balloon.png",'; |
|
385 | + } else { |
|
386 | + $output .= '"aircraft_shadow": "balloon.png",'; |
|
387 | + } |
|
388 | + } else { |
|
389 | + if ($compress) { |
|
390 | + $output .= '"as": "car.png",'; |
|
391 | + } else { |
|
392 | + $output .= '"aircraft_shadow": "car.png",'; |
|
393 | + } |
|
260 | 394 | } |
261 | - elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Truck') { |
|
262 | - if ($compress) $output .= '"as": "truck.png",'; |
|
263 | - else $output .= '"aircraft_shadow": "truck.png",'; |
|
395 | + } elseif ($marine) { |
|
396 | + if ($compress) { |
|
397 | + $output .= '"as": "ship.png",'; |
|
398 | + } else { |
|
399 | + $output .= '"aircraft_shadow": "ship.png",'; |
|
264 | 400 | } |
265 | - elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Truck (18 Wheeler)') { |
|
266 | - if ($compress) $output .= '"as": "truck.png",'; |
|
267 | - else $output .= '"aircraft_shadow": "truck.png",'; |
|
268 | - } |
|
269 | - elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Aircraft (small)') { |
|
270 | - if ($compress) $output .= '"as": "aircraft.png",'; |
|
271 | - else $output .= '"aircraft_shadow": "aircraft.png",'; |
|
272 | - } |
|
273 | - elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Large Aircraft') { |
|
274 | - if ($compress) $output .= '"as": "aircraft.png",'; |
|
275 | - else $output .= '"aircraft_shadow": "aircraft.png",'; |
|
276 | - } |
|
277 | - elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Helicopter') { |
|
278 | - if ($compress) $output .= '"as": "helico.png",'; |
|
279 | - else $output .= '"aircraft_shadow": "helico.png",'; |
|
280 | - } |
|
281 | - elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Railroad Engine') { |
|
282 | - if ($compress) $output .= '"as": "rail.png",'; |
|
283 | - else $output .= '"aircraft_shadow": "rail.png",'; |
|
284 | - } |
|
285 | - elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Firetruck') { |
|
286 | - if ($compress) $output .= '"as": "firetruck.png",'; |
|
287 | - else $output .= '"aircraft_shadow": "firetruck.png",'; |
|
288 | - } |
|
289 | - elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Bus') { |
|
290 | - if ($compress) $output .= '"as": "bus.png",'; |
|
291 | - else $output .= '"aircraft_shadow": "bus.png",'; |
|
292 | - } |
|
293 | - elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Phone') { |
|
294 | - if ($compress) $output .= '"as": "phone.png",'; |
|
295 | - else $output .= '"aircraft_shadow": "phone.png",'; |
|
296 | - } |
|
297 | - elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Jogger') { |
|
298 | - if ($compress) $output .= '"as": "jogger.png",'; |
|
299 | - else $output .= '"aircraft_shadow": "jogger.png",'; |
|
300 | - } |
|
301 | - elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Bike') { |
|
302 | - if ($compress) $output .= '"as": "bike.png",'; |
|
303 | - else $output .= '"aircraft_shadow": "bike.png",'; |
|
304 | - } |
|
305 | - elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Motorcycle') { |
|
306 | - if ($compress) $output .= '"as": "motorcycle.png",'; |
|
307 | - else $output .= '"aircraft_shadow": "motorcycle.png",'; |
|
308 | - } |
|
309 | - elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Balloon') { |
|
310 | - if ($compress) $output .= '"as": "balloon.png",'; |
|
311 | - else $output .= '"aircraft_shadow": "balloon.png",'; |
|
312 | - } |
|
313 | - else { |
|
314 | - if ($compress) $output .= '"as": "car.png",'; |
|
315 | - else $output .= '"aircraft_shadow": "car.png",'; |
|
401 | + } else { |
|
402 | + if ($compress) { |
|
403 | + $output .= '"as": "default.png",'; |
|
404 | + } else { |
|
405 | + $output .= '"aircraft_shadow": "default.png",'; |
|
316 | 406 | } |
317 | 407 | } |
318 | - elseif ($marine) { |
|
319 | - if ($compress) $output .= '"as": "ship.png",'; |
|
320 | - else $output .= '"aircraft_shadow": "ship.png",'; |
|
321 | - } |
|
322 | - else { |
|
323 | - if ($compress) $output .= '"as": "default.png",'; |
|
324 | - else $output .= '"aircraft_shadow": "default.png",'; |
|
325 | - } |
|
326 | 408 | } else { |
327 | - if ($compress) $output .= '"as": "'.$spotter_item['aircraft_shadow'].'",'; |
|
328 | - else $output .= '"aircraft_shadow": "'.$spotter_item['aircraft_shadow'].'",'; |
|
409 | + if ($compress) { |
|
410 | + $output .= '"as": "'.$spotter_item['aircraft_shadow'].'",'; |
|
411 | + } else { |
|
412 | + $output .= '"aircraft_shadow": "'.$spotter_item['aircraft_shadow'].'",'; |
|
413 | + } |
|
329 | 414 | } |
330 | 415 | |
331 | 416 | if (isset($spotter_item['date_iso_8601'])) { |
@@ -373,7 +458,9 @@ discard block |
||
373 | 458 | $output .= ']'; |
374 | 459 | $output .= ',"initial_sqltime": "'.$sqltime.'",'; |
375 | 460 | $output .= '"totaltime": "'.round(microtime(true)-$begintime,2).'",'; |
376 | - if (isset($begindate)) $output .= '"archive_date": "'.$begindate.'",'; |
|
461 | + if (isset($begindate)) { |
|
462 | + $output .= '"archive_date": "'.$begindate.'",'; |
|
463 | + } |
|
377 | 464 | $output .= '"fc": "'.$flightcnt.'"'; |
378 | 465 | } else { |
379 | 466 | $output .= '"features": '; |
@@ -6,8 +6,8 @@ discard block |
||
6 | 6 | if (!isset($globalJsonCompress)) $compress = true; |
7 | 7 | else $compress = $globalJsonCompress; |
8 | 8 | |
9 | -if (isset($_GET['ident'])) $ident = filter_input(INPUT_GET,'ident',FILTER_SANITIZE_STRING); |
|
10 | -if (isset($_GET['flightaware_id'])) $flightaware_id = filter_input(INPUT_GET,'flightaware_id',FILTER_SANITIZE_STRING); |
|
9 | +if (isset($_GET['ident'])) $ident = filter_input(INPUT_GET, 'ident', FILTER_SANITIZE_STRING); |
|
10 | +if (isset($_GET['flightaware_id'])) $flightaware_id = filter_input(INPUT_GET, 'flightaware_id', FILTER_SANITIZE_STRING); |
|
11 | 11 | ?> |
12 | 12 | <?php |
13 | 13 | if (isset($_COOKIE['IconColor'])) $IconColor = $_COOKIE['IconColor']; |
@@ -226,7 +226,7 @@ discard block |
||
226 | 226 | if (typeof props != 'undefined') { |
227 | 227 | var thedate = new Date(props); |
228 | 228 | $("#thedate").html(thedate.toUTCString()); |
229 | - // $("#archivebox").html('<h4><?php echo str_replace("'","\'",_("Archive Date & Time")); ?></h4>' + '<b><i class="fa fa-spinner fa-pulse fa-2x fa-fw margin-bottom"></i></b>'); |
|
229 | + // $("#archivebox").html('<h4><?php echo str_replace("'", "\'", _("Archive Date & Time")); ?></h4>' + '<b><i class="fa fa-spinner fa-pulse fa-2x fa-fw margin-bottom"></i></b>'); |
|
230 | 230 | } |
231 | 231 | } |
232 | 232 | } |
@@ -373,7 +373,7 @@ discard block |
||
373 | 373 | <?php |
374 | 374 | } else { |
375 | 375 | ?> |
376 | - var movingtime = Math.round(<?php if (isset($archiveupdatetime)) print $archiveupdatetime*1000; else print $globalMapRefresh*1000+20000; ?>+feature.properties.sqt*1000); |
|
376 | + var movingtime = Math.round(<?php if (isset($archiveupdatetime)) print $archiveupdatetime*1000; else print $globalMapRefresh*1000 + 20000; ?>+feature.properties.sqt*1000); |
|
377 | 377 | return new L.Marker.movingMarker([latLng, feature.properties.nextlatlon],[movingtime],{ |
378 | 378 | <?php |
379 | 379 | } |
@@ -390,7 +390,7 @@ discard block |
||
390 | 390 | /* |
391 | 391 | shadowUrl: iconURLShadowpath, |
392 | 392 | shadowSize: [<?php print $globalAircraftSize; ?>, <?php print $globalAircraftSize; ?>], |
393 | - shadowAnchor: [<?php print ($globalAircraftSize/2)+1; ?>, <?php print $globalAircraftSize; ?>] |
|
393 | + shadowAnchor: [<?php print ($globalAircraftSize/2) + 1; ?>, <?php print $globalAircraftSize; ?>] |
|
394 | 394 | */ |
395 | 395 | }) |
396 | 396 | }) |
@@ -424,7 +424,7 @@ discard block |
||
424 | 424 | <?php |
425 | 425 | } else { |
426 | 426 | ?> |
427 | - var movingtime = Math.round(<?php if (isset($archiveupdatetime)) print $archiveupdatetime*1000; else print $globalMapRefresh*1000+20000; ?>+feature.properties.sqt*1000); |
|
427 | + var movingtime = Math.round(<?php if (isset($archiveupdatetime)) print $archiveupdatetime*1000; else print $globalMapRefresh*1000 + 20000; ?>+feature.properties.sqt*1000); |
|
428 | 428 | return new L.Marker.movingMarker([latLng, feature.properties.nextlatlon],[movingtime],{ |
429 | 429 | <?php |
430 | 430 | } |
@@ -472,7 +472,7 @@ discard block |
||
472 | 472 | <?php |
473 | 473 | } else { |
474 | 474 | ?> |
475 | - var movingtime = Math.round(<?php if (isset($archiveupdatetime)) print $archiveupdatetime*1000; else print $globalMapRefresh*1000+20000; ?>+feature.properties.sqt*1000); |
|
475 | + var movingtime = Math.round(<?php if (isset($archiveupdatetime)) print $archiveupdatetime*1000; else print $globalMapRefresh*1000 + 20000; ?>+feature.properties.sqt*1000); |
|
476 | 476 | return new L.Marker.movingMarker([latLng, feature.properties.nextlatlon],[movingtime],{ |
477 | 477 | <?php |
478 | 478 | } |
@@ -3,16 +3,27 @@ discard block |
||
3 | 3 | require_once('../require/class.Language.php'); |
4 | 4 | |
5 | 5 | // Compressed GeoJson is used if true |
6 | -if (!isset($globalJsonCompress)) $compress = true; |
|
7 | -else $compress = $globalJsonCompress; |
|
6 | +if (!isset($globalJsonCompress)) { |
|
7 | + $compress = true; |
|
8 | +} else { |
|
9 | + $compress = $globalJsonCompress; |
|
10 | +} |
|
8 | 11 | |
9 | -if (isset($_GET['ident'])) $ident = filter_input(INPUT_GET,'ident',FILTER_SANITIZE_STRING); |
|
10 | -if (isset($_GET['flightaware_id'])) $flightaware_id = filter_input(INPUT_GET,'flightaware_id',FILTER_SANITIZE_STRING); |
|
12 | +if (isset($_GET['ident'])) { |
|
13 | + $ident = filter_input(INPUT_GET,'ident',FILTER_SANITIZE_STRING); |
|
14 | +} |
|
15 | +if (isset($_GET['flightaware_id'])) { |
|
16 | + $flightaware_id = filter_input(INPUT_GET,'flightaware_id',FILTER_SANITIZE_STRING); |
|
17 | +} |
|
11 | 18 | ?> |
12 | 19 | <?php |
13 | -if (isset($_COOKIE['IconColor'])) $IconColor = $_COOKIE['IconColor']; |
|
14 | -elseif (isset($globalAircraftIconColor)) $IconColor = $globalAircraftIconColor; |
|
15 | -else $IconColor = '1a3151'; |
|
20 | +if (isset($_COOKIE['IconColor'])) { |
|
21 | + $IconColor = $_COOKIE['IconColor']; |
|
22 | +} elseif (isset($globalAircraftIconColor)) { |
|
23 | + $IconColor = $globalAircraftIconColor; |
|
24 | +} else { |
|
25 | + $IconColor = '1a3151'; |
|
26 | +} |
|
16 | 27 | ?> |
17 | 28 | <?php |
18 | 29 | if (isset($globalDebug) && $globalDebug === TRUE) { |
@@ -90,9 +101,12 @@ discard block |
||
90 | 101 | |
91 | 102 | function update_airportsLayer() { |
92 | 103 | <?php |
93 | - if (isset($_COOKIE['AirportZoom'])) $getZoom = $_COOKIE['AirportZoom']; |
|
94 | - else $getZoom = '7'; |
|
95 | -?> |
|
104 | + if (isset($_COOKIE['AirportZoom'])) { |
|
105 | + $getZoom = $_COOKIE['AirportZoom']; |
|
106 | + } else { |
|
107 | + $getZoom = '7'; |
|
108 | + } |
|
109 | + ?> |
|
96 | 110 | if (typeof airportsLayer != 'undefined') { |
97 | 111 | if (map.hasLayer(airportsLayer) == true) { |
98 | 112 | map.removeLayer(airportsLayer); |
@@ -373,7 +387,12 @@ discard block |
||
373 | 387 | <?php |
374 | 388 | } else { |
375 | 389 | ?> |
376 | - var movingtime = Math.round(<?php if (isset($archiveupdatetime)) print $archiveupdatetime*1000; else print $globalMapRefresh*1000+20000; ?>+feature.properties.sqt*1000); |
|
390 | + var movingtime = Math.round(<?php if (isset($archiveupdatetime)) { |
|
391 | + print $archiveupdatetime*1000; |
|
392 | +} else { |
|
393 | + print $globalMapRefresh*1000+20000; |
|
394 | +} |
|
395 | +?>+feature.properties.sqt*1000); |
|
377 | 396 | return new L.Marker.movingMarker([latLng, feature.properties.nextlatlon],[movingtime],{ |
378 | 397 | <?php |
379 | 398 | } |
@@ -424,7 +443,12 @@ discard block |
||
424 | 443 | <?php |
425 | 444 | } else { |
426 | 445 | ?> |
427 | - var movingtime = Math.round(<?php if (isset($archiveupdatetime)) print $archiveupdatetime*1000; else print $globalMapRefresh*1000+20000; ?>+feature.properties.sqt*1000); |
|
446 | + var movingtime = Math.round(<?php if (isset($archiveupdatetime)) { |
|
447 | + print $archiveupdatetime*1000; |
|
448 | +} else { |
|
449 | + print $globalMapRefresh*1000+20000; |
|
450 | +} |
|
451 | +?>+feature.properties.sqt*1000); |
|
428 | 452 | return new L.Marker.movingMarker([latLng, feature.properties.nextlatlon],[movingtime],{ |
429 | 453 | <?php |
430 | 454 | } |
@@ -472,7 +496,12 @@ discard block |
||
472 | 496 | <?php |
473 | 497 | } else { |
474 | 498 | ?> |
475 | - var movingtime = Math.round(<?php if (isset($archiveupdatetime)) print $archiveupdatetime*1000; else print $globalMapRefresh*1000+20000; ?>+feature.properties.sqt*1000); |
|
499 | + var movingtime = Math.round(<?php if (isset($archiveupdatetime)) { |
|
500 | + print $archiveupdatetime*1000; |
|
501 | +} else { |
|
502 | + print $globalMapRefresh*1000+20000; |
|
503 | +} |
|
504 | +?>+feature.properties.sqt*1000); |
|
476 | 505 | return new L.Marker.movingMarker([latLng, feature.properties.nextlatlon],[movingtime],{ |
477 | 506 | <?php |
478 | 507 | } |
@@ -975,7 +1004,12 @@ discard block |
||
975 | 1004 | update_archiveLayer(0); |
976 | 1005 | } else { |
977 | 1006 | //then load it again every 30 seconds |
978 | - reloadPage = setInterval(function(){if (noTimeout) getLiveData(0)},<?php if (isset($globalMapRefresh)) print $globalMapRefresh*1000; else print '30000'; ?>); |
|
1007 | + reloadPage = setInterval(function(){if (noTimeout) getLiveData(0)},<?php if (isset($globalMapRefresh)) { |
|
1008 | + print $globalMapRefresh*1000; |
|
1009 | +} else { |
|
1010 | + print '30000'; |
|
1011 | +} |
|
1012 | +?>); |
|
979 | 1013 | var currentdate = new Date(); |
980 | 1014 | var currentyear = new Date().getFullYear(); |
981 | 1015 | var begindate = new Date(Date.UTC(currentyear,11,24,2,0,0,0)); |
@@ -987,7 +1021,12 @@ discard block |
||
987 | 1021 | if (!((isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS)) && (isset($_COOKIE['polar']) && $_COOKIE['polar'] == 'true')) { |
988 | 1022 | ?> |
989 | 1023 | update_polarLayer(); |
990 | - setInterval(function(){map.removeLayer(polarLayer);update_polarLayer()},<?php if (isset($globalMapRefresh)) print $globalMapRefresh*1000*2; else print '60000'; ?>); |
|
1024 | + setInterval(function(){map.removeLayer(polarLayer);update_polarLayer()},<?php if (isset($globalMapRefresh)) { |
|
1025 | + print $globalMapRefresh*1000*2; |
|
1026 | +} else { |
|
1027 | + print '60000'; |
|
1028 | +} |
|
1029 | +?>); |
|
991 | 1030 | <?php |
992 | 1031 | } |
993 | 1032 | ?> |
@@ -1000,7 +1039,12 @@ discard block |
||
1000 | 1039 | if ((isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM)) { |
1001 | 1040 | ?> |
1002 | 1041 | update_atcLayer(); |
1003 | - setInterval(function(){map.removeLayer(atcLayer);update_atcLayer()},<?php if (isset($globalMapRefresh)) print $globalMapRefresh*1000*2; else print '60000'; ?>); |
|
1042 | + setInterval(function(){map.removeLayer(atcLayer);update_atcLayer()},<?php if (isset($globalMapRefresh)) { |
|
1043 | + print $globalMapRefresh*1000*2; |
|
1044 | +} else { |
|
1045 | + print '60000'; |
|
1046 | +} |
|
1047 | +?>); |
|
1004 | 1048 | <?php |
1005 | 1049 | } |
1006 | 1050 | ?> |
@@ -11,14 +11,14 @@ discard block |
||
11 | 11 | |
12 | 12 | $from_archive = false; |
13 | 13 | if (isset($_GET['ident'])) { |
14 | - $ident = filter_input(INPUT_GET,'ident',FILTER_SANITIZE_STRING); |
|
14 | + $ident = filter_input(INPUT_GET, 'ident', FILTER_SANITIZE_STRING); |
|
15 | 15 | if (isset($_GET['currenttime'])) { |
16 | - $currenttime = filter_input(INPUT_GET,'currenttime',FILTER_SANITIZE_NUMBER_INT); |
|
16 | + $currenttime = filter_input(INPUT_GET, 'currenttime', FILTER_SANITIZE_NUMBER_INT); |
|
17 | 17 | $currenttime = round($currenttime/1000); |
18 | - $spotter_array = $SpotterLive->getDateLiveSpotterDataByIdent($ident,$currenttime); |
|
18 | + $spotter_array = $SpotterLive->getDateLiveSpotterDataByIdent($ident, $currenttime); |
|
19 | 19 | if (empty($spotter_array) && isset($globalArchiveResults) && $globalArchiveResults) { |
20 | 20 | $from_archive = true; |
21 | - $spotter_array = $SpotterArchive->getDateArchiveSpotterDataByIdent($ident,$currenttime); |
|
21 | + $spotter_array = $SpotterArchive->getDateArchiveSpotterDataByIdent($ident, $currenttime); |
|
22 | 22 | } |
23 | 23 | } else { |
24 | 24 | $spotter_array = $SpotterLive->getLastLiveSpotterDataByIdent($ident); |
@@ -29,15 +29,15 @@ discard block |
||
29 | 29 | } |
30 | 30 | } |
31 | 31 | if (isset($_GET['flightaware_id'])) { |
32 | - $flightaware_id = filter_input(INPUT_GET,'flightaware_id',FILTER_SANITIZE_STRING); |
|
32 | + $flightaware_id = filter_input(INPUT_GET, 'flightaware_id', FILTER_SANITIZE_STRING); |
|
33 | 33 | if (isset($_GET['currenttime'])) { |
34 | - $currenttime = filter_input(INPUT_GET,'currenttime',FILTER_SANITIZE_NUMBER_INT); |
|
34 | + $currenttime = filter_input(INPUT_GET, 'currenttime', FILTER_SANITIZE_NUMBER_INT); |
|
35 | 35 | $currenttime = round($currenttime/1000); |
36 | - $spotter_array = $SpotterLive->getDateLiveSpotterDataById($flightaware_id,$currenttime); |
|
36 | + $spotter_array = $SpotterLive->getDateLiveSpotterDataById($flightaware_id, $currenttime); |
|
37 | 37 | if (empty($spotter_array) && isset($globalArchiveResults) && $globalArchiveResults) { |
38 | 38 | $from_archive = true; |
39 | 39 | // $spotter_array = $SpotterArchive->getLastArchiveSpotterDataById($flightaware_id); |
40 | - $spotter_array = $SpotterArchive->getDateArchiveSpotterDataById($flightaware_id,$currenttime); |
|
40 | + $spotter_array = $SpotterArchive->getDateArchiveSpotterDataById($flightaware_id, $currenttime); |
|
41 | 41 | } |
42 | 42 | } else { |
43 | 43 | $spotter_array = $SpotterLive->getLastLiveSpotterDataById($flightaware_id); |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | if (isset($spotter_item['image_thumbnail']) && $spotter_item['image_thumbnail'] != "") |
58 | 58 | { |
59 | 59 | if ($spotter_item['image_source'] == 'flickr' || $spotter_item['image_source'] == 'wikimedia' || $spotter_item['image_source'] == 'devianart') { |
60 | - $image = preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']); |
|
60 | + $image = preg_replace("/^http:/i", "https:", $spotter_item['image_thumbnail']); |
|
61 | 61 | } else $image = $spotter_item['image_thumbnail']; |
62 | 62 | } |
63 | 63 | /* else { |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | 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']; |
85 | 85 | if (isset($spotter_item['departure_airport_time']) && $spotter_item['departure_airport_time'] != 'NULL') { |
86 | 86 | if ($spotter_item['departure_airport_time'] > 2460) { |
87 | - print '<br /><span class="time">'.date('H:m',$spotter_item['departure_airport_time']).'</span>'; |
|
87 | + print '<br /><span class="time">'.date('H:m', $spotter_item['departure_airport_time']).'</span>'; |
|
88 | 88 | } else { |
89 | 89 | print '<br /><span class="time">'.$spotter_item['departure_airport_time'].'</span>'; |
90 | 90 | } |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | 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']; |
94 | 94 | if (isset($spotter_item['arrival_airport_time']) && $spotter_item['arrival_airport_time'] != 'NULL') { |
95 | 95 | if ($spotter_item['arrival_airport_time'] > 2460) { |
96 | - print '<br /><span class="time">'.date('H:m',$spotter_item['arrival_airport_time']).'</span>'; |
|
96 | + print '<br /><span class="time">'.date('H:m', $spotter_item['arrival_airport_time']).'</span>'; |
|
97 | 97 | } else { |
98 | 98 | print '<br /><span class="time">'.$spotter_item['arrival_airport_time'].'</span>'; |
99 | 99 | } |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | print '<span>'._("Aircraft").'</span>'; |
113 | 113 | if (isset($spotter_item['aircraft_wiki'])) print '<a href="'.$spotter_item['aircraft_wiki'].'">'.$spotter_item['aircraft_name'].'</a>'; |
114 | 114 | if (isset($spotter_item['aircraft_type']) && isset($spotter_item['aircraft_manufacturer']) && $spotter_item['aircraft_manufacturer'] != 'N/A' && isset($spotter_item['aircraft_name']) && $spotter_item['aircraft_name'] != 'N/A') { |
115 | - $aircraft_names = explode('/',$spotter_item['aircraft_name']); |
|
115 | + $aircraft_names = explode('/', $spotter_item['aircraft_name']); |
|
116 | 116 | if (count($aircraft_names) == 1) print '<a href="'.$globalURL.'/aircraft/'.$spotter_item['aircraft_type'].'">'.$spotter_item['aircraft_manufacturer'].' '.$spotter_item['aircraft_name'].' ('.$spotter_item['aircraft_type'].')</a>'; |
117 | 117 | else print '<a href="'.$globalURL.'/aircraft/'.$spotter_item['aircraft_type'].'" title="'.$spotter_item['aircraft_name'].'">'.$spotter_item['aircraft_manufacturer'].' '.$aircraft_names[0].' ('.$spotter_item['aircraft_type'].')</a>'; |
118 | 118 | } elseif (isset($spotter_item['aircraft_type'])) print '<a href="'.$globalURL.'/aircraft/'.$spotter_item['aircraft_type'].'">'.$spotter_item['aircraft_type'].'</a>'; |
@@ -122,8 +122,8 @@ discard block |
||
122 | 122 | print '<div id="altitude"><span>'._("Altitude").'</span>'; |
123 | 123 | if (isset($globalGroundAltitude) && $globalGroundAltitude) { |
124 | 124 | try { |
125 | - $groundAltitude = $Elevation->getElevation($spotter_item['latitude'],$spotter_item['longitude']); |
|
126 | - } catch(Exception $e) { |
|
125 | + $groundAltitude = $Elevation->getElevation($spotter_item['latitude'], $spotter_item['longitude']); |
|
126 | + } catch (Exception $e) { |
|
127 | 127 | // If catched not exist |
128 | 128 | } |
129 | 129 | } |
@@ -167,9 +167,9 @@ discard block |
||
167 | 167 | if (isset($globalCam) && $globalCam) { |
168 | 168 | require_once(dirname(__FILE__).'/require/class.Common.php'); |
169 | 169 | $Common = new Common(); |
170 | - $azimuth = round($Common->azimuth($globalCenterLatitude,$globalCenterLongitude,$spotter_item['latitude'],$spotter_item['longitude'])); |
|
171 | - $distance = $Common->distance($globalCenterLatitude,$globalCenterLongitude,$spotter_item['latitude'],$spotter_item['longitude'],'m'); |
|
172 | - $plunge = round($Common->plunge($globalCenterAltitude,$spotter_item['real_altitude'],$distance)); |
|
170 | + $azimuth = round($Common->azimuth($globalCenterLatitude, $globalCenterLongitude, $spotter_item['latitude'], $spotter_item['longitude'])); |
|
171 | + $distance = $Common->distance($globalCenterLatitude, $globalCenterLongitude, $spotter_item['latitude'], $spotter_item['longitude'], 'm'); |
|
172 | + $plunge = round($Common->plunge($globalCenterAltitude, $spotter_item['real_altitude'], $distance)); |
|
173 | 173 | print '<div id="camcoordinates"><span>'._("Cam Coordinates").'</span>'; |
174 | 174 | print 'azimuth: '.$azimuth; |
175 | 175 | print ' / '; |
@@ -179,16 +179,16 @@ discard block |
||
179 | 179 | print '</div>'; |
180 | 180 | //echo $Common->getData('http://127.0.0.1/camera.php?azimuth='.$azimuth.'&plunge='.$plunge,'get','','','','','','',false,true); |
181 | 181 | //echo $Common->getData('file://'.dirname(__FILE__).'/camera.php?azimuth='.$azimuth.'&plunge='.$plunge,'get','','','','','','',false,true); |
182 | - echo $Common->getData('http://'.$_SERVER['SERVER_NAME'].'/camera.php?azimuth='.$azimuth.'&plunge='.$plunge,'get','','','','','','',false,true); |
|
182 | + echo $Common->getData('http://'.$_SERVER['SERVER_NAME'].'/camera.php?azimuth='.$azimuth.'&plunge='.$plunge, 'get', '', '', '', '', '', '', false, true); |
|
183 | 183 | } |
184 | 184 | |
185 | 185 | print '<div id="heading"><span>'._("Heading").'</span><span class="heading">'.$spotter_item['heading'].'</span>°</div>'; |
186 | 186 | if (isset($spotter_item['verticalrate']) && $spotter_item['verticalrate'] != '') { |
187 | 187 | print '<div id="verticalrate"><span>'._("Vertical rate").'</span>'; |
188 | 188 | if ((!isset($_COOKIE['unitaltitude']) && isset($globalUnitAltitude) && $globalUnitAltitude == 'feet') || (isset($_COOKIE['unitaltitude']) && $_COOKIE['unitaltitude'] == 'feet')) { |
189 | - print $spotter_item['verticalrate']. ' ft/min'; |
|
189 | + print $spotter_item['verticalrate'].' ft/min'; |
|
190 | 190 | } else { |
191 | - print round($spotter_item['verticalrate']*0.3048). ' m/min'; |
|
191 | + print round($spotter_item['verticalrate']*0.3048).' m/min'; |
|
192 | 192 | } |
193 | 193 | print '</div>'; |
194 | 194 | } |
@@ -223,7 +223,7 @@ discard block |
||
223 | 223 | print '</div>'; |
224 | 224 | if (isset($globalVA) && $globalVA && 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>'; |
225 | 225 | if (isset($spotter_item['waypoints']) && $spotter_item['waypoints'] != '') print '<div class="waypoints"><span>'._("Route").'</span>'.$spotter_item['waypoints'].'</div>'; |
226 | - 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>'; |
|
226 | + 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>'; |
|
227 | 227 | 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>'; |
228 | 228 | print '</div>'; |
229 | 229 | } |
@@ -58,7 +58,9 @@ discard block |
||
58 | 58 | { |
59 | 59 | if ($spotter_item['image_source'] == 'flickr' || $spotter_item['image_source'] == 'wikimedia' || $spotter_item['image_source'] == 'devianart') { |
60 | 60 | $image = preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']); |
61 | - } else $image = $spotter_item['image_thumbnail']; |
|
61 | + } else { |
|
62 | + $image = $spotter_item['image_thumbnail']; |
|
63 | + } |
|
62 | 64 | } |
63 | 65 | /* else { |
64 | 66 | $image = "images/placeholder_thumb.png"; |
@@ -75,10 +77,14 @@ discard block |
||
75 | 77 | print '<div class="callsign-details">'; |
76 | 78 | if ($spotter_item['ident'] != 'Not Available') { |
77 | 79 | print '<div class="callsign"><a href="'.$globalURL.'/redirect/'.$spotter_item['flightaware_id'].'" target="_blank">'.$spotter_item['ident'].'</a>'; |
78 | - if (isset($spotter_item['blocked']) && $spotter_item['blocked'] === true) print '<img src="'.$globalURL.'/images/forbidden.png" title="'._("Callsign is in blocked FAA list").'" class="blocked" />'; |
|
80 | + if (isset($spotter_item['blocked']) && $spotter_item['blocked'] === true) { |
|
81 | + print '<img src="'.$globalURL.'/images/forbidden.png" title="'._("Callsign is in blocked FAA list").'" class="blocked" />'; |
|
82 | + } |
|
79 | 83 | print '</div>'; |
80 | 84 | } |
81 | - if (isset($spotter_item['airline_name']) && $spotter_item['airline_name'] != 'Not Available') print '<div class="airline">'.$spotter_item['airline_name'].'</div>'; |
|
85 | + if (isset($spotter_item['airline_name']) && $spotter_item['airline_name'] != 'Not Available') { |
|
86 | + print '<div class="airline">'.$spotter_item['airline_name'].'</div>'; |
|
87 | + } |
|
82 | 88 | print '</div>'; |
83 | 89 | if ($spotter_item['departure_airport'] != 'NA' && $spotter_item['arrival_airport'] != 'NA') { |
84 | 90 | 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']; |
@@ -110,15 +116,25 @@ discard block |
||
110 | 116 | print '</div>'; |
111 | 117 | print '<div id="aircraft">'; |
112 | 118 | print '<span>'._("Aircraft").'</span>'; |
113 | - if (isset($spotter_item['aircraft_wiki'])) print '<a href="'.$spotter_item['aircraft_wiki'].'">'.$spotter_item['aircraft_name'].'</a>'; |
|
119 | + if (isset($spotter_item['aircraft_wiki'])) { |
|
120 | + print '<a href="'.$spotter_item['aircraft_wiki'].'">'.$spotter_item['aircraft_name'].'</a>'; |
|
121 | + } |
|
114 | 122 | if (isset($spotter_item['aircraft_type']) && isset($spotter_item['aircraft_manufacturer']) && $spotter_item['aircraft_manufacturer'] != 'N/A' && isset($spotter_item['aircraft_name']) && $spotter_item['aircraft_name'] != 'N/A') { |
115 | 123 | $aircraft_names = explode('/',$spotter_item['aircraft_name']); |
116 | - if (count($aircraft_names) == 1) print '<a href="'.$globalURL.'/aircraft/'.$spotter_item['aircraft_type'].'">'.$spotter_item['aircraft_manufacturer'].' '.$spotter_item['aircraft_name'].' ('.$spotter_item['aircraft_type'].')</a>'; |
|
117 | - else print '<a href="'.$globalURL.'/aircraft/'.$spotter_item['aircraft_type'].'" title="'.$spotter_item['aircraft_name'].'">'.$spotter_item['aircraft_manufacturer'].' '.$aircraft_names[0].' ('.$spotter_item['aircraft_type'].')</a>'; |
|
118 | - } elseif (isset($spotter_item['aircraft_type'])) print '<a href="'.$globalURL.'/aircraft/'.$spotter_item['aircraft_type'].'">'.$spotter_item['aircraft_type'].'</a>'; |
|
119 | - else print $spotter_item['aircraft_manufacturer'].' '.$spotter_item['aircraft_name']; |
|
124 | + if (count($aircraft_names) == 1) { |
|
125 | + print '<a href="'.$globalURL.'/aircraft/'.$spotter_item['aircraft_type'].'">'.$spotter_item['aircraft_manufacturer'].' '.$spotter_item['aircraft_name'].' ('.$spotter_item['aircraft_type'].')</a>'; |
|
126 | + } else { |
|
127 | + print '<a href="'.$globalURL.'/aircraft/'.$spotter_item['aircraft_type'].'" title="'.$spotter_item['aircraft_name'].'">'.$spotter_item['aircraft_manufacturer'].' '.$aircraft_names[0].' ('.$spotter_item['aircraft_type'].')</a>'; |
|
128 | + } |
|
129 | + } elseif (isset($spotter_item['aircraft_type'])) { |
|
130 | + print '<a href="'.$globalURL.'/aircraft/'.$spotter_item['aircraft_type'].'">'.$spotter_item['aircraft_type'].'</a>'; |
|
131 | + } else { |
|
132 | + print $spotter_item['aircraft_manufacturer'].' '.$spotter_item['aircraft_name']; |
|
133 | + } |
|
120 | 134 | print '</div>'; |
121 | - 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>'; |
|
135 | + if (isset($spotter_item['registration']) && $spotter_item['registration'] != '') { |
|
136 | + print '<div><span>'._("Registration").'</span><a href="'.$globalURL.'/registration/'.$spotter_item['registration'].'" target="_blank">'.$spotter_item['registration'].'</a></div>'; |
|
137 | + } |
|
122 | 138 | |
123 | 139 | print '<div id="altitude"><span>'._("Altitude").'</span>'; |
124 | 140 | if (isset($globalGroundAltitude) && $globalGroundAltitude) { |
@@ -131,11 +147,17 @@ discard block |
||
131 | 147 | |
132 | 148 | print '<span class="altitude">'; |
133 | 149 | if ((!isset($_COOKIE['unitaltitude']) && isset($globalUnitAltitude) && $globalUnitAltitude == 'feet') || (isset($_COOKIE['unitaltitude']) && $_COOKIE['unitaltitude'] == 'feet')) { |
134 | - if (isset($spotter_item['real_altitude']) && $spotter_item['real_altitude'] != '') print $spotter_item['real_altitude'].' feet (FL'.$spotter_item['altitude'].')'; |
|
135 | - else print $spotter_item['altitude'].'00 feet (FL'.$spotter_item['altitude'].')'; |
|
150 | + if (isset($spotter_item['real_altitude']) && $spotter_item['real_altitude'] != '') { |
|
151 | + print $spotter_item['real_altitude'].' feet (FL'.$spotter_item['altitude'].')'; |
|
152 | + } else { |
|
153 | + print $spotter_item['altitude'].'00 feet (FL'.$spotter_item['altitude'].')'; |
|
154 | + } |
|
136 | 155 | } else { |
137 | - if (isset($spotter_item['real_altitude']) && $spotter_item['real_altitude'] != '') print round($spotter_item['real_altitude']*0.3048).' m (FL'.$spotter_item['altitude'].')'; |
|
138 | - else print round($spotter_item['altitude']*30.48).' m (FL'.$spotter_item['altitude'].')'; |
|
156 | + if (isset($spotter_item['real_altitude']) && $spotter_item['real_altitude'] != '') { |
|
157 | + print round($spotter_item['real_altitude']*0.3048).' m (FL'.$spotter_item['altitude'].')'; |
|
158 | + } else { |
|
159 | + print round($spotter_item['altitude']*30.48).' m (FL'.$spotter_item['altitude'].')'; |
|
160 | + } |
|
139 | 161 | } |
140 | 162 | print '</span>'; |
141 | 163 | |
@@ -200,8 +222,11 @@ discard block |
||
200 | 222 | } |
201 | 223 | if (isset($spotter_item['pilot_name']) && $spotter_item['pilot_name'] != '') { |
202 | 224 | print '<div id="pilot"><span>'._("Pilot").'</span>'; |
203 | - if (isset($spotter_item['pilot_id'])) print $spotter_item['pilot_name'].' ('.$spotter_item['pilot_id'].')'; |
|
204 | - else print $spotter_item['pilot_name']; |
|
225 | + if (isset($spotter_item['pilot_id'])) { |
|
226 | + print $spotter_item['pilot_name'].' ('.$spotter_item['pilot_id'].')'; |
|
227 | + } else { |
|
228 | + print $spotter_item['pilot_name']; |
|
229 | + } |
|
205 | 230 | print '</div>'; |
206 | 231 | } |
207 | 232 | if (isset($spotter_item['aircraft_owner']) && $spotter_item['aircraft_owner'] != '') { |
@@ -227,10 +252,18 @@ discard block |
||
227 | 252 | } |
228 | 253 | print '</div>'; |
229 | 254 | print '</div>'; |
230 | - if (isset($globalVA) && $globalVA && 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>'; |
|
231 | - if (isset($spotter_item['waypoints']) && $spotter_item['waypoints'] != '') print '<div class="waypoints"><span>'._("Route").'</span>'.$spotter_item['waypoints'].'</div>'; |
|
232 | - 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>'; |
|
233 | - 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>'; |
|
255 | + if (isset($globalVA) && $globalVA && isset($globalphpVMS) && $globalphpVMS && isset($globalVATSIM) && $globalVATSIM && isset($globalIVAO) && $globalIVAO && isset($spotter_item['format_source']) && $spotter_item['format_source'] != '' && $spotter_item['format_source'] != 'pireps') { |
|
256 | + print '<div class="waypoints"><span>'._("Source").'</span>'.$spotter_item['format_source'].'</div>'; |
|
257 | + } |
|
258 | + if (isset($spotter_item['waypoints']) && $spotter_item['waypoints'] != '') { |
|
259 | + print '<div class="waypoints"><span>'._("Route").'</span>'.$spotter_item['waypoints'].'</div>'; |
|
260 | + } |
|
261 | + if (isset($spotter_item['acars']['message'])) { |
|
262 | + 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>'; |
|
263 | + } |
|
264 | + if (isset($spotter_item['squawk']) && $spotter_item['squawk'] != '' && $spotter_item['squawk'] != 0) { |
|
265 | + print '<div class="bottom">'._("Squawk:").' '.$spotter_item['squawk'].' - '.$spotter_item['squawk_usage'].'</div>'; |
|
266 | + } |
|
234 | 267 | print '</div>'; |
235 | 268 | } |
236 | 269 | ?> |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | date_default_timezone_set('UTC'); |
28 | 28 | //waypoint plotting |
29 | 29 | $output .= '{"type": "Feature",'; |
30 | - $output .= '"properties": {'; |
|
30 | + $output .= '"properties": {'; |
|
31 | 31 | $output .= '"name": '.json_encode(str_replace('"',"'",$spotter_item['name'])).','; |
32 | 32 | $output .= '"city": '.json_encode(str_replace('"',"'",$spotter_item['city'])).','; |
33 | 33 | $output .= '"country": "'.$spotter_item['country'].'",'; |
@@ -50,13 +50,13 @@ discard block |
||
50 | 50 | $output .= '"homepage": "'.$spotter_item['home_link'].'",'; |
51 | 51 | $output .= '"image_thumb": "'.$spotter_item['image_thumb'].'"'; |
52 | 52 | // $output .= '"photo": "'.$spotter_item['image_thumbnail'].'",'; |
53 | - $output .= '},'; |
|
54 | - $output .= '"geometry": {'; |
|
53 | + $output .= '},'; |
|
54 | + $output .= '"geometry": {'; |
|
55 | 55 | $output .= '"type": "Point",'; |
56 | 56 | $output .= '"coordinates": ['; |
57 | - $output .= $spotter_item['longitude'].', '.$spotter_item['latitude']; |
|
57 | + $output .= $spotter_item['longitude'].', '.$spotter_item['latitude']; |
|
58 | 58 | $output .= ']'; |
59 | - $output .= '}'; |
|
59 | + $output .= '}'; |
|
60 | 60 | $output .= '},'; |
61 | 61 | } |
62 | 62 | $output = substr($output, 0, -1); |
@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | |
12 | 12 | if (isset($_GET['coord'])) |
13 | 13 | { |
14 | - $coords = explode(',',$_GET['coord']); |
|
14 | + $coords = explode(',', $_GET['coord']); |
|
15 | 15 | $spotter_array = $Spotter->getAllAirportInfobyCoord($coords); |
16 | 16 | } else { |
17 | 17 | $spotter_array = $Spotter->getAllAirportInfo(); |
@@ -22,17 +22,17 @@ discard block |
||
22 | 22 | |
23 | 23 | if (!empty($spotter_array)) |
24 | 24 | { |
25 | - foreach($spotter_array as $spotter_item) |
|
25 | + foreach ($spotter_array as $spotter_item) |
|
26 | 26 | { |
27 | 27 | date_default_timezone_set('UTC'); |
28 | 28 | //waypoint plotting |
29 | 29 | $output .= '{"type": "Feature",'; |
30 | 30 | $output .= '"properties": {'; |
31 | - $output .= '"name": '.json_encode(str_replace('"',"'",$spotter_item['name'])).','; |
|
32 | - $output .= '"city": '.json_encode(str_replace('"',"'",$spotter_item['city'])).','; |
|
31 | + $output .= '"name": '.json_encode(str_replace('"', "'", $spotter_item['name'])).','; |
|
32 | + $output .= '"city": '.json_encode(str_replace('"', "'", $spotter_item['city'])).','; |
|
33 | 33 | $output .= '"country": "'.$spotter_item['country'].'",'; |
34 | 34 | $output .= '"altitude": "'.$spotter_item['altitude'].'",'; |
35 | - $output .= '"popupContent": '.json_encode(str_replace('"',"'",$spotter_item['name']).' : '.str_replace('"',"'",$spotter_item['city']).', '.$spotter_item['country']).','; |
|
35 | + $output .= '"popupContent": '.json_encode(str_replace('"', "'", $spotter_item['name']).' : '.str_replace('"', "'", $spotter_item['city']).', '.$spotter_item['country']).','; |
|
36 | 36 | if ($spotter_item['type'] == 'large_airport') { |
37 | 37 | $output .= '"icon": "'.$globalURL.'/images/airport.png",'; |
38 | 38 | } elseif ($spotter_item['type'] == 'heliport') { |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | $output .= '}'; |
60 | 60 | $output .= '},'; |
61 | 61 | } |
62 | - $output = substr($output, 0, -1); |
|
62 | + $output = substr($output, 0, -1); |
|
63 | 63 | } |
64 | 64 | $output .= ']}'; |
65 | 65 | print $output; |
@@ -9,17 +9,17 @@ |
||
9 | 9 | header('Content-disposition: attachment; filename="weather.json"'); |
10 | 10 | } |
11 | 11 | header('Content-Type: text/javascript'); |
12 | -$latitude = filter_input(INPUT_GET,'latitude',FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
13 | -$longitude = filter_input(INPUT_GET,'longitude',FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
12 | +$latitude = filter_input(INPUT_GET, 'latitude', FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
13 | +$longitude = filter_input(INPUT_GET, 'longitude', FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
14 | 14 | if ($latitude == '' || $longitude == '') return ''; |
15 | 15 | //echo 'latitude : '.$latitude.' - longitude : '.$longitude."\n"; |
16 | -$airports = $Spotter->closestAirports($latitude,$longitude,200); |
|
16 | +$airports = $Spotter->closestAirports($latitude, $longitude, 200); |
|
17 | 17 | //print_r($airports); |
18 | 18 | $METAR = new METAR(); |
19 | 19 | $Weather = new Weather(); |
20 | 20 | $i = 0; |
21 | 21 | $ew = true; |
22 | -while($ew) { |
|
22 | +while ($ew) { |
|
23 | 23 | $met = $METAR->getMETAR($airports[$i]['icao']); |
24 | 24 | //print_r($met); |
25 | 25 | if (!empty($met)) { |
@@ -11,7 +11,9 @@ discard block |
||
11 | 11 | header('Content-Type: text/javascript'); |
12 | 12 | $latitude = filter_input(INPUT_GET,'latitude',FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
13 | 13 | $longitude = filter_input(INPUT_GET,'longitude',FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
14 | -if ($latitude == '' || $longitude == '') return ''; |
|
14 | +if ($latitude == '' || $longitude == '') { |
|
15 | + return ''; |
|
16 | +} |
|
15 | 17 | //echo 'latitude : '.$latitude.' - longitude : '.$longitude."\n"; |
16 | 18 | $airports = $Spotter->closestAirports($latitude,$longitude,200); |
17 | 19 | //print_r($airports); |
@@ -36,7 +38,9 @@ discard block |
||
36 | 38 | } |
37 | 39 | } |
38 | 40 | $i++; |
39 | - if ($i >= count($airports)) $ew = false; |
|
40 | -} |
|
41 | + if ($i >= count($airports)) { |
|
42 | + $ew = false; |
|
43 | + } |
|
44 | + } |
|
41 | 45 | |
42 | 46 | ?> |
43 | 47 | \ No newline at end of file |
@@ -4,7 +4,7 @@ discard block |
||
4 | 4 | require_once('require/class.Language.php'); |
5 | 5 | require_once('require/class.Satellite.php'); |
6 | 6 | |
7 | -$trackident = filter_input(INPUT_GET,'trackid',FILTER_SANITIZE_STRING); |
|
7 | +$trackident = filter_input(INPUT_GET, 'trackid', FILTER_SANITIZE_STRING); |
|
8 | 8 | if ($trackident != '') { |
9 | 9 | require_once('require/class.SpotterLive.php'); |
10 | 10 | $SpotterLive = new SpotterLive(); |
@@ -14,7 +14,7 @@ discard block |
||
14 | 14 | $spotterid = $Spotter->getSpotterIDBasedOnFlightAwareID($trackident); |
15 | 15 | header('Location: '.$globalURL.'/flightid/'.$spotterid); |
16 | 16 | } else { |
17 | - setcookie('MapTrack',$resulttrackident[0]['flightaware_id']); |
|
17 | + setcookie('MapTrack', $resulttrackident[0]['flightaware_id']); |
|
18 | 18 | } |
19 | 19 | /* |
20 | 20 | } else { |
@@ -201,7 +201,7 @@ discard block |
||
201 | 201 | <div class="form-group"> |
202 | 202 | <label><?php echo _("From:"); ?></label> |
203 | 203 | <div class='input-group date' id='datetimepicker1'> |
204 | - <input type='text' id="start_date" name="start_date" class="form-control" autocomplete="off" value="<?php if (isset($_COOKIE['archive_begin']) && $_COOKIE['archive_begin'] != '') print date("Y-m-d H:i",$_COOKIE['archive_begin']).' UTC'; ?>" required /> |
|
204 | + <input type='text' id="start_date" name="start_date" class="form-control" autocomplete="off" value="<?php if (isset($_COOKIE['archive_begin']) && $_COOKIE['archive_begin'] != '') print date("Y-m-d H:i", $_COOKIE['archive_begin']).' UTC'; ?>" required /> |
|
205 | 205 | <span class="input-group-addon"> |
206 | 206 | <span class="glyphicon glyphicon-calendar"></span> |
207 | 207 | </span> |
@@ -210,7 +210,7 @@ discard block |
||
210 | 210 | <div class="form-group"> |
211 | 211 | <label><?php echo _("To:"); ?></label> |
212 | 212 | <div class='input-group date' id='datetimepicker2'> |
213 | - <input type='text' id="end_date" name="end_date" class="form-control" autocomplete="off" value="<?php if (isset($_COOKIE['archive_end']) && $_COOKIE['archive_end'] != '') print date("Y-m-d H:i",$_COOKIE['archive_end']).' UTC'; ?>" /> |
|
213 | + <input type='text' id="end_date" name="end_date" class="form-control" autocomplete="off" value="<?php if (isset($_COOKIE['archive_end']) && $_COOKIE['archive_end'] != '') print date("Y-m-d H:i", $_COOKIE['archive_end']).' UTC'; ?>" /> |
|
214 | 214 | <span class="input-group-addon"> |
215 | 215 | <span class="glyphicon glyphicon-calendar"></span> |
216 | 216 | </span> |
@@ -378,9 +378,9 @@ discard block |
||
378 | 378 | <li><?php echo _("Type of Terrain:"); ?> |
379 | 379 | <select class="selectpicker" onchange="terrainType(this);"> |
380 | 380 | <option value="stk"<?php if (!isset($_COOKIE['MapTerrain']) || $_COOKIE['MapTerrain'] == 'stk') print ' selected'; ?>>stk terrain</option> |
381 | - <option value="ellipsoid"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'ellipsoid') print ' selected';?>>ellipsoid</option> |
|
382 | - <option value="vrterrain"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'vrterrain') print ' selected';?>>vr terrain</option> |
|
383 | - <option value="articdem"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'articdem') print ' selected';?>>ArticDEM</option> |
|
381 | + <option value="ellipsoid"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'ellipsoid') print ' selected'; ?>>ellipsoid</option> |
|
382 | + <option value="vrterrain"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'vrterrain') print ' selected'; ?>>vr terrain</option> |
|
383 | + <option value="articdem"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'articdem') print ' selected'; ?>>ArticDEM</option> |
|
384 | 384 | </select> |
385 | 385 | </li> |
386 | 386 | <?php |
@@ -452,7 +452,7 @@ discard block |
||
452 | 452 | <li><div class="checkbox"><label><input type="checkbox" name="updaterealtime" value="1" onclick="clickUpdateRealtime(this)" <?php if ((isset($_COOKIE['updaterealtime']) && $_COOKIE['updaterealtime'] == 'true') || !isset($_COOKIE['updaterealtime'])) print 'checked'; ?> ><?php echo _("Display realtime data in infobox"); ?></label></div></li> |
453 | 453 | <?php |
454 | 454 | } |
455 | - if (time() > mktime(0,0,0,12,1,date("Y")) && time() < mktime(0,0,0,12,31,date("Y"))) { |
|
455 | + if (time() > mktime(0, 0, 0, 12, 1, date("Y")) && time() < mktime(0, 0, 0, 12, 31, date("Y"))) { |
|
456 | 456 | ?> |
457 | 457 | <li><div class="checkbox"><label><input type="checkbox" name="displaysanta" value="1" onclick="clickSanta(this)"><i class="fa fa-snowflake-o" aria-hidden="true"></i> <?php echo _("Show Santa Claus now"); ?> <i class="fa fa-snowflake-o" aria-hidden="true"></i></label></div></li> |
458 | 458 | <?php |
@@ -633,10 +633,10 @@ discard block |
||
633 | 633 | $Spotter = new Spotter(); |
634 | 634 | $allairlinenames = $Spotter->getAllAirlineNames(); |
635 | 635 | } |
636 | - foreach($allairlinenames as $airline) { |
|
636 | + foreach ($allairlinenames as $airline) { |
|
637 | 637 | $airline_name = $airline['airline_name']; |
638 | - if (strlen($airline_name) > 30) $airline_name = substr($airline_name,0,30).'...'; |
|
639 | - if (isset($_COOKIE['filter_Airlines']) && in_array($airline['airline_icao'],explode(',',$_COOKIE['filter_Airlines']))) { |
|
638 | + if (strlen($airline_name) > 30) $airline_name = substr($airline_name, 0, 30).'...'; |
|
639 | + if (isset($_COOKIE['filter_Airlines']) && in_array($airline['airline_icao'], explode(',', $_COOKIE['filter_Airlines']))) { |
|
640 | 640 | echo '<option value="'.$airline['airline_icao'].'" selected>'.$airline_name.'</option>'; |
641 | 641 | } else { |
642 | 642 | echo '<option value="'.$airline['airline_icao'].'">'.$airline_name.'</option>'; |
@@ -655,7 +655,7 @@ discard block |
||
655 | 655 | <select class="selectpicker" onchange="alliance(this);" id="display_alliance"> |
656 | 656 | <option value="all"<?php if (!isset($_COOKIE['filter_alliance']) || $_COOKIE['filter_alliance'] == 'all' || $_COOKIE['filter_alliance'] == '') echo ' selected'; ?>><?php echo _("All"); ?></option> |
657 | 657 | <?php |
658 | - foreach($allalliancenames as $alliance) { |
|
658 | + foreach ($allalliancenames as $alliance) { |
|
659 | 659 | $alliance_name = $alliance['alliance']; |
660 | 660 | if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] == $alliance_name) { |
661 | 661 | echo '<option value="'.$alliance_name.'" selected>'.$alliance_name.'</option>'; |
@@ -691,8 +691,8 @@ discard block |
||
691 | 691 | */ |
692 | 692 | $Source = new Source(); |
693 | 693 | $datasource = $Source->getLocationInfoByType('gs'); |
694 | - foreach($datasource as $src) { |
|
695 | - if (isset($_COOKIE['filter_Sources']) && in_array($src['name'],explode(',',$_COOKIE['filter_Sources']))) { |
|
694 | + foreach ($datasource as $src) { |
|
695 | + if (isset($_COOKIE['filter_Sources']) && in_array($src['name'], explode(',', $_COOKIE['filter_Sources']))) { |
|
696 | 696 | echo '<option value="'.$src['name'].'" selected>'.$src['name'].'</option>'; |
697 | 697 | } else { |
698 | 698 | echo '<option value="'.$src['name'].'">'.$src['name'].'</option>'; |
@@ -780,7 +780,7 @@ discard block |
||
780 | 780 | else if ($type_name == 'radar') $type_name = 'Radar Calibration'; |
781 | 781 | else if ($type_name == 'tle-new') $type_name = 'Last 30 days launches'; |
782 | 782 | |
783 | - if (isset($_COOKIE['sattypes']) && in_array($type['tle_type'],explode(',',$_COOKIE['sattypes']))) { |
|
783 | + if (isset($_COOKIE['sattypes']) && in_array($type['tle_type'], explode(',', $_COOKIE['sattypes']))) { |
|
784 | 784 | print '<option value="'.$type['tle_type'].'" selected>'.$type_name.'</option>'; |
785 | 785 | } else { |
786 | 786 | print '<option value="'.$type['tle_type'].'">'.$type_name.'</option>'; |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | <?php }; if (isset($globalSatellite) && $globalSatellite) { ?><td><div id="ibxsatellite"><h4><?php echo _("Satellites Displayed"); ?></h4><br /><i class="fa fa-spinner fa-pulse fa-fw"></i></div></td><?php } ?> |
51 | 51 | </tr></table></div> |
52 | 52 | <?php |
53 | - if ((!isset($_COOKIE['MapFormat']) && isset($globalMap3Ddefault) && $globalMap3Ddefault) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d')) { |
|
53 | + if ((!isset($_COOKIE['MapFormat']) && isset($globalMap3Ddefault) && $globalMap3Ddefault) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d')) { |
|
54 | 54 | ?> |
55 | 55 | <script src="<?php echo $globalURL; ?>/js/map.3d.js.php<?php if (isset($tsk)) print '?tsk='.$tsk; ?>"></script> |
56 | 56 | <?php |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | <script src="<?php echo $globalURL; ?>/js/map-marine.3d.js.php"></script> |
75 | 75 | <?php |
76 | 76 | } |
77 | - } |
|
77 | + } |
|
78 | 78 | ?> |
79 | 79 | |
80 | 80 | <div id="sidebar" class="sidebar collapsed"> |
@@ -85,13 +85,13 @@ discard block |
||
85 | 85 | <li><a href="" onclick="getUserLocation(); return false;" title="<?php echo _("Plot your Location"); ?>"><i class="fa fa-map-marker"></i></a></li> |
86 | 86 | <li><a href="" onclick="getCompassDirection(); return false;" title="<?php echo _("Compass Mode"); ?>"><i class="fa fa-compass"></i></a></li> |
87 | 87 | <?php |
88 | - //if ((isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d') || (isset($globalBeta) && $globalBeta === TRUE)) { |
|
88 | + //if ((isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d') || (isset($globalBeta) && $globalBeta === TRUE)) { |
|
89 | 89 | if (isset($globalArchive) && $globalArchive == TRUE && (!isset($globalAircraft) || $globalAircraft === TRUE)) { |
90 | 90 | ?> |
91 | 91 | <li><a href="#archive" role="tab" title="<?php echo _("Archive"); ?>"><i class="fa fa-archive"></i></a></li> |
92 | 92 | <?php |
93 | 93 | } |
94 | - //} |
|
94 | + //} |
|
95 | 95 | ?> |
96 | 96 | <li><a href="#home" role="tab" title="<?php echo _("Layers"); ?>"><i class="fa fa-map"></i></a></li> |
97 | 97 | <li><a href="#filters" role="tab" title="<?php echo _("Filters"); ?>"><i class="fa fa-filter"></i></a></li> |
@@ -105,7 +105,7 @@ discard block |
||
105 | 105 | ?> |
106 | 106 | |
107 | 107 | <?php |
108 | - if (isset($globalMap3D) && $globalMap3D) { |
|
108 | + if (isset($globalMap3D) && $globalMap3D) { |
|
109 | 109 | if ((!isset($_COOKIE['MapFormat']) && (!isset($globalMap3Ddefault) || !$globalMap3Ddefault)) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] != '3d')) { |
110 | 110 | ?> |
111 | 111 | <li><a href="" onclick="show3D(); return false;" role="tab" title="3D"><b>3D</b></a></li> |
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | <li><a href="" onclick="show2D(); return false;" role="tab" title="2D"><b>2D</b></a></li> |
116 | 116 | <?php |
117 | 117 | } |
118 | - } |
|
118 | + } |
|
119 | 119 | ?> |
120 | 120 | </ul> |
121 | 121 | |
@@ -264,15 +264,15 @@ discard block |
||
264 | 264 | </div> |
265 | 265 | </li> |
266 | 266 | <?php |
267 | - if (isset($globalDemo) && $globalDemo) { |
|
267 | + if (isset($globalDemo) && $globalDemo) { |
|
268 | 268 | ?> |
269 | 269 | <li><button type="button" class="btn btn-primary disabled"><?php echo _("Show archive"); ?></button> Disabled in Demo mode</li> |
270 | 270 | <?php |
271 | - } else { |
|
271 | + } else { |
|
272 | 272 | ?> |
273 | 273 | <li><button type="button" onclick="addarchive(begindate,enddate);" class="btn btn-primary"><?php echo _("Show archive"); ?></button></li> |
274 | 274 | <?php |
275 | - } |
|
275 | + } |
|
276 | 276 | ?> |
277 | 277 | </ul> |
278 | 278 | <ul> |
@@ -291,83 +291,83 @@ discard block |
||
291 | 291 | if ((!isset($_COOKIE['MapFormat']) && (!isset($globalMap3Ddefault) || !$globalMap3Ddefault)) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] != '3d')) { |
292 | 292 | if (!isset($_COOKIE['MapType']) || $_COOKIE['MapType'] == '') $MapType = $globalMapProvider; |
293 | 293 | else $MapType = $_COOKIE['MapType']; |
294 | - ?> |
|
294 | + ?> |
|
295 | 295 | <select class="selectpicker" onchange="mapType(this);"> |
296 | 296 | <?php |
297 | 297 | } else { |
298 | 298 | if (!isset($_COOKIE['MapType3D']) || $_COOKIE['MapType3D'] == '') $MapType = $globalMapProvider; |
299 | 299 | else $MapType = $_COOKIE['MapType3D']; |
300 | - ?> |
|
300 | + ?> |
|
301 | 301 | <select class="selectpicker" onchange="mapType3D(this);"> |
302 | 302 | <?php |
303 | 303 | } |
304 | - ?> |
|
304 | + ?> |
|
305 | 305 | <?php |
306 | 306 | if (isset($globalMapOffline) && $globalMapOffline === TRUE) { |
307 | - ?> |
|
307 | + ?> |
|
308 | 308 | <option value="offline"<?php if ($MapType == 'offline') print ' selected'; ?>>Natural Earth (local)</option> |
309 | 309 | <?php |
310 | 310 | } else { |
311 | - if (file_exists(dirname(__FILE__).'/js/Cesium/Assets/Textures/NaturalEarthII/tilemapresource.xml')) { |
|
312 | - ?> |
|
311 | + if (file_exists(dirname(__FILE__).'/js/Cesium/Assets/Textures/NaturalEarthII/tilemapresource.xml')) { |
|
312 | + ?> |
|
313 | 313 | <option value="offline"<?php if ($MapType == 'offline') print ' selected'; ?>>Natural Earth (local)</option> |
314 | 314 | <?php |
315 | - } |
|
316 | - ?> |
|
315 | + } |
|
316 | + ?> |
|
317 | 317 | <option value="ArcGIS-Streetmap"<?php if ($MapType == 'ArcGIS-Streetmap') print ' selected'; ?>>ArcGIS Streetmap</option> |
318 | 318 | <option value="ArcGIS-Satellite"<?php if ($MapType == 'ArcGIS-Satellite') print ' selected'; ?>>ArcGIS Satellite</option> |
319 | 319 | <option value="ArcGIS-Satellite"<?php if ($MapType == 'ArcGIS-Ocean') print ' selected'; ?>>ArcGIS Ocean</option> |
320 | 320 | <?php |
321 | - if (isset($globalBingMapKey) && $globalBingMapKey != '') { |
|
322 | - ?> |
|
321 | + if (isset($globalBingMapKey) && $globalBingMapKey != '') { |
|
322 | + ?> |
|
323 | 323 | <option value="Bing-Aerial"<?php if ($MapType == 'Bing-Aerial') print ' selected'; ?>>Bing-Aerial</option> |
324 | 324 | <option value="Bing-Hybrid"<?php if ($MapType == 'Bing-Hybrid') print ' selected'; ?>>Bing-Hybrid</option> |
325 | 325 | <option value="Bing-Road"<?php if ($MapType == 'Bing-Road') print ' selected'; ?>>Bing-Road</option> |
326 | 326 | <?php |
327 | - } |
|
328 | - ?> |
|
327 | + } |
|
328 | + ?> |
|
329 | 329 | <?php |
330 | - if ((!isset($_COOKIE['MapFormat']) && (!isset($globalMap3Ddefault) || !$globalMap3Ddefault)) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] != '3d')) { |
|
331 | - ?> |
|
330 | + if ((!isset($_COOKIE['MapFormat']) && (!isset($globalMap3Ddefault) || !$globalMap3Ddefault)) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] != '3d')) { |
|
331 | + ?> |
|
332 | 332 | <?php |
333 | 333 | if (isset($globalHereappId) && $globalHereappId != '' && isset($globalHereappCode) && $globalHereappCode != '') { |
334 | - ?> |
|
334 | + ?> |
|
335 | 335 | <option value="Here-Aerial"<?php if ($MapType == 'Here') print ' selected'; ?>>Here-Aerial</option> |
336 | 336 | <option value="Here-Hybrid"<?php if ($MapType == 'Here') print ' selected'; ?>>Here-Hybrid</option> |
337 | 337 | <option value="Here-Road"<?php if ($MapType == 'Here') print ' selected'; ?>>Here-Road</option> |
338 | 338 | <?php |
339 | 339 | } |
340 | - ?> |
|
340 | + ?> |
|
341 | 341 | <?php |
342 | 342 | if (isset($globalGoogleAPIKey) && $globalGoogleAPIKey != '') { |
343 | - ?> |
|
343 | + ?> |
|
344 | 344 | <option value="Google-Roadmap"<?php if ($MapType == 'Google-Roadmap') print ' selected'; ?>>Google Roadmap</option> |
345 | 345 | <option value="Google-Satellite"<?php if ($MapType == 'Google-Satellite') print ' selected'; ?>>Google Satellite</option> |
346 | 346 | <option value="Google-Hybrid"<?php if ($MapType == 'Google-Hybrid') print ' selected'; ?>>Google Hybrid</option> |
347 | 347 | <option value="Google-Terrain"<?php if ($MapType == 'Google-Terrain') print ' selected'; ?>>Google Terrain</option> |
348 | 348 | <?php |
349 | 349 | } |
350 | - ?> |
|
350 | + ?> |
|
351 | 351 | <?php |
352 | 352 | if (isset($globalMapQuestKey) && $globalMapQuestKey != '') { |
353 | - ?> |
|
353 | + ?> |
|
354 | 354 | <option value="MapQuest-OSM"<?php if ($MapType == 'MapQuest-OSM') print ' selected'; ?>>MapQuest-OSM</option> |
355 | 355 | <option value="MapQuest-Aerial"<?php if ($MapType == 'MapQuest-Aerial') print ' selected'; ?>>MapQuest-Aerial</option> |
356 | 356 | <option value="MapQuest-Hybrid"<?php if ($MapType == 'MapQuest-Hybrid') print ' selected'; ?>>MapQuest-Hybrid</option> |
357 | 357 | <?php |
358 | 358 | } |
359 | - ?> |
|
359 | + ?> |
|
360 | 360 | <option value="Yandex"<?php if ($MapType == 'Yandex') print ' selected'; ?>>Yandex</option> |
361 | 361 | <option value="offline"<?php if ($MapType == 'offline') print ' selected'; ?>>Natural Earth</option> |
362 | 362 | <?php |
363 | - } |
|
364 | - ?> |
|
363 | + } |
|
364 | + ?> |
|
365 | 365 | <option value="NatGeo-Street"<?php if ($MapType == 'NatGeo-Street') print ' selected'; ?>>National Geographic Street</option> |
366 | 366 | <?php |
367 | - if (isset($globalMapboxToken) && $globalMapboxToken != '') { |
|
367 | + if (isset($globalMapboxToken) && $globalMapboxToken != '') { |
|
368 | 368 | if (!isset($_COOKIE['MapTypeId'])) $MapBoxId = 'default'; |
369 | 369 | else $MapBoxId = $_COOKIE['MapTypeId']; |
370 | - ?> |
|
370 | + ?> |
|
371 | 371 | <option value="MapboxGL"<?php if ($MapType == 'MapboxGL') print ' selected'; ?>>Mapbox GL</option> |
372 | 372 | <option value="Mapbox-default"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'default') print ' selected'; ?>>Mapbox default</option> |
373 | 373 | <option value="Mapbox-mapbox.streets"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.streets') print ' selected'; ?>>Mapbox streets</option> |
@@ -382,17 +382,17 @@ discard block |
||
382 | 382 | <option value="Mapbox-mapbox.pirates"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.pirates') print ' selected'; ?>>Mapbox pirates</option> |
383 | 383 | <option value="Mapbox-mapbox.emerald"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.emerald') print ' selected'; ?>>Mapbox emerald</option> |
384 | 384 | <?php |
385 | - } |
|
386 | - ?> |
|
385 | + } |
|
386 | + ?> |
|
387 | 387 | <!--<option value="OpenSeaMap"<?php if ($MapType == 'OpenSeaMap') print ' selected'; ?>>OpenSeaMap</option>--> |
388 | 388 | <option value="OpenStreetMap"<?php if ($MapType == 'OpenStreetMap') print ' selected'; ?>>OpenStreetMap</option> |
389 | 389 | <?php |
390 | 390 | } |
391 | - ?> |
|
391 | + ?> |
|
392 | 392 | </select> |
393 | 393 | </li> |
394 | 394 | <?php |
395 | - if (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d' && (!isset($globalMapOffline) || $globalMapOffline === FALSE)) { |
|
395 | + if (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d' && (!isset($globalMapOffline) || $globalMapOffline === FALSE)) { |
|
396 | 396 | ?> |
397 | 397 | <li><?php echo _("Type of Terrain:"); ?> |
398 | 398 | <select class="selectpicker" onchange="terrainType(this);"> |
@@ -403,18 +403,18 @@ discard block |
||
403 | 403 | </select> |
404 | 404 | </li> |
405 | 405 | <?php |
406 | - } |
|
406 | + } |
|
407 | 407 | ?> |
408 | 408 | |
409 | 409 | <?php |
410 | - if (isset($globalMap3D) && $globalMap3D) { |
|
410 | + if (isset($globalMap3D) && $globalMap3D) { |
|
411 | 411 | ?> |
412 | 412 | <li><div class="checkbox"><label><input type="checkbox" name="synchro2d3d" value="1" onclick="clickSyncMap2D3D(this)" <?php if (isset($_COOKIE['Map2D3DSync']) && $_COOKIE['Map2D3DSync'] == 'true') print 'checked'; ?> ><?php echo _("Use same type of map for 2D & 3D"); ?></label></div></li> |
413 | 413 | <?php |
414 | - } |
|
414 | + } |
|
415 | 415 | ?> |
416 | 416 | <?php |
417 | - if (!isset($_COOKIE['MapFormat']) || $_COOKIE['MapFormat'] != '3d') { |
|
417 | + if (!isset($_COOKIE['MapFormat']) || $_COOKIE['MapFormat'] != '3d') { |
|
418 | 418 | ?> |
419 | 419 | <li><div class="checkbox"><label><input type="checkbox" name="display2dbuildings" value="1" onclick="clickDisplay2DBuildings(this)" <?php if (isset($_COOKIE['Map2DBuildings']) && $_COOKIE['Map2DBuildings'] == 'true') print 'checked'; ?> ><?php echo _("Display 2.5D buidings on map"); ?></label></div></li> |
420 | 420 | |
@@ -437,17 +437,17 @@ discard block |
||
437 | 437 | <li><div class="checkbox"><label><input type="checkbox" name="satelliteestimation" value="1" onclick="clickSatelliteEstimation(this)" <?php if ((isset($_COOKIE['satelliteestimation']) && $_COOKIE['satelliteestimation'] == 'true') || (!isset($_COOKIE['satelliteestimation']) && !isset($globalMapEstimation)) || (!isset($_COOKIE['satelliteestimation']) && isset($globalMapEstimation) && $globalMapEstimation)) print 'checked'; ?> ><?php echo _("Satellites animate between updates"); ?></label></div></li> |
438 | 438 | <?php |
439 | 439 | } |
440 | - } |
|
440 | + } |
|
441 | 441 | ?> |
442 | 442 | <li><div class="checkbox"><label><input type="checkbox" name="displayairports" value="1" onclick="clickDisplayAirports(this)" <?php if (isset($_COOKIE['displayairports']) && $_COOKIE['displayairports'] == 'true' || !isset($_COOKIE['displayairports'])) print 'checked'; ?> ><?php echo _("Display airports on map"); ?></label></div></li> |
443 | 443 | <li><div class="checkbox"><label><input type="checkbox" name="displaygroundstation" value="1" onclick="clickDisplayGroundStation(this)" <?php if ((isset($_COOKIE['show_GroundStation']) && $_COOKIE['show_GroundStation'] == 'true') || (!isset($_COOKIE['show_GroundStation']) && (isset($globalMapGroundStation) && $globalMapGroundStation === TRUE))) print 'checked'; ?> ><?php echo _("Display ground station on map"); ?></label></div></li> |
444 | 444 | <li><div class="checkbox"><label><input type="checkbox" name="displayweatherstation" value="1" onclick="clickDisplayWeatherStation(this)" <?php if ((isset($_COOKIE['show_WeatherStation']) && $_COOKIE['show_WeatherStation'] == 'true') || (!isset($_COOKIE['show_WeatherStation']) && (isset($globalMapWeatherStation) && $globalMapWeatherStation === TRUE))) print 'checked'; ?> ><?php echo _("Display weather station on map"); ?></label></div></li> |
445 | 445 | <?php |
446 | - if (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d' && isset($globalMETAR) && isset($globalMETARcycle) && $globalMETAR && $globalMETARcycle) { |
|
446 | + if (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d' && isset($globalMETAR) && isset($globalMETARcycle) && $globalMETAR && $globalMETARcycle) { |
|
447 | 447 | ?> |
448 | 448 | <li><div class="checkbox"><label><input type="checkbox" name="displayweather" value="1" onclick="clickDisplayWeather(this)" <?php if ((isset($_COOKIE['show_Weather']) && $_COOKIE['show_Weather'] == 'true') || (!isset($_COOKIE['show_Weather']) && (isset($globalMapWeather) && $globalMapWeather === TRUE))) print 'checked'; ?> ><?php echo _("Display weather on 3D map"); ?></label></div></li> |
449 | 449 | <?php |
450 | - } |
|
450 | + } |
|
451 | 451 | ?> |
452 | 452 | <li><div class="checkbox"><label><input type="checkbox" name="displaylightning" value="1" onclick="clickDisplayLightning(this)" <?php if ((isset($_COOKIE['show_Lightning']) && $_COOKIE['show_Lightning'] == 'true') || (!isset($_COOKIE['show_Lightning']) && (isset($globalMapLightning) && $globalMapLightning === TRUE))) print 'checked'; ?> ><?php echo _("Display lightning on map"); ?></label></div></li> |
453 | 453 | <?php |
@@ -463,82 +463,82 @@ discard block |
||
463 | 463 | } |
464 | 464 | ?> |
465 | 465 | <?php |
466 | - if (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d') { |
|
466 | + if (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d') { |
|
467 | 467 | ?> |
468 | 468 | <li><div class="checkbox"><label><input type="checkbox" name="displayminimap" value="1" onclick="clickDisplayMinimap(this)" <?php if (!isset($_COOKIE['displayminimap']) || (isset($_COOKIE['displayminimap']) && $_COOKIE['displayminimap'] == 'true')) print 'checked'; ?> ><?php echo _("Show mini-map"); ?></label></div></li> |
469 | 469 | <li><div class="checkbox"><label><input type="checkbox" name="shadows" value="1" onclick="clickShadows(this)" <?php if ((!isset($_COOKIE['map3dnoshadows']) && (!isset($globalMap3DShadows) || $globalMap3DShadows)) || (isset($_COOKIE['map3dnoshadows']) && $_COOKIE['map3dnoshadows'] == 'false')) print 'checked'; ?> ><?php echo _("Use shadows"); ?></label></div></li> |
470 | 470 | <li><div class="checkbox"><label><input type="checkbox" name="one3dmodel" value="1" onclick="useOne3Dmodel(this)" <?php if ((isset($_COOKIE['one3dmodel']) && $_COOKIE['one3dmodel'] == 'true') || (!isset($_COOKIE['one3dmodel']) && isset($globalMap3DOneModel) && $globalMap3DOneModel)) print 'checked'; ?> ><?php echo _("Use same 3D model for all aircraft (use fewer resources)"); ?></label></div></li> |
471 | 471 | <li><div class="checkbox"><label><input type="checkbox" name="updaterealtime" value="1" onclick="clickUpdateRealtime(this)" <?php if ((isset($_COOKIE['updaterealtime']) && $_COOKIE['updaterealtime'] == 'true') || !isset($_COOKIE['updaterealtime'])) print 'checked'; ?> ><?php echo _("Display realtime data in infobox"); ?></label></div></li> |
472 | 472 | <?php |
473 | - } |
|
474 | - if (time() > mktime(0,0,0,12,1,date("Y")) && time() < mktime(0,0,0,12,31,date("Y"))) { |
|
473 | + } |
|
474 | + if (time() > mktime(0,0,0,12,1,date("Y")) && time() < mktime(0,0,0,12,31,date("Y"))) { |
|
475 | 475 | ?> |
476 | 476 | <li><div class="checkbox"><label><input type="checkbox" name="displaysanta" value="1" onclick="clickSanta(this)"><i class="fa fa-snowflake-o" aria-hidden="true"></i> <?php echo _("Show Santa Claus now"); ?> <i class="fa fa-snowflake-o" aria-hidden="true"></i></label></div></li> |
477 | 477 | <?php |
478 | - } |
|
478 | + } |
|
479 | 479 | ?> |
480 | 480 | <?php |
481 | 481 | if (function_exists('array_column')) { |
482 | - if (array_search(TRUE, array_column($globalSources, 'sourcestats')) !== FALSE) { |
|
483 | - ?> |
|
482 | + if (array_search(TRUE, array_column($globalSources, 'sourcestats')) !== FALSE) { |
|
483 | + ?> |
|
484 | 484 | <li><div class="checkbox"><label><input type="checkbox" name="flightpolar" value="1" onclick="clickPolar(this)" <?php if ((isset($_COOKIE['polar']) && $_COOKIE['polar'] == 'true')) print 'checked'; ?> ><?php echo _("Display polar on map"); ?></label></div></li> |
485 | 485 | <?php |
486 | - } |
|
486 | + } |
|
487 | 487 | } elseif (isset($globalSources)) { |
488 | - $dispolar = false; |
|
489 | - foreach ($globalSources as $testsource) { |
|
490 | - if (isset($globalSources['sourcestats']) && $globalSources['sourcestats'] !== FALSE) $dispolar = true; |
|
491 | - } |
|
492 | - if ($dispolar) { |
|
493 | - ?> |
|
488 | + $dispolar = false; |
|
489 | + foreach ($globalSources as $testsource) { |
|
490 | + if (isset($globalSources['sourcestats']) && $globalSources['sourcestats'] !== FALSE) $dispolar = true; |
|
491 | + } |
|
492 | + if ($dispolar) { |
|
493 | + ?> |
|
494 | 494 | <li><div class="checkbox"><label><input type="checkbox" name="flightpolar" value="1" onclick="clickPolar(this)" <?php if ((isset($_COOKIE['polar']) && $_COOKIE['polar'] == 'true')) print 'checked'; ?> ><?php echo _("Display polar on map"); ?></label></div></li> |
495 | 495 | <?php |
496 | - } |
|
497 | - } |
|
498 | - ?> |
|
496 | + } |
|
497 | + } |
|
498 | + ?> |
|
499 | 499 | <?php |
500 | - if (!isset($_COOKIE['MapFormat']) || $_COOKIE['MapFormat'] != '3d') { |
|
500 | + if (!isset($_COOKIE['MapFormat']) || $_COOKIE['MapFormat'] != '3d') { |
|
501 | 501 | ?> |
502 | 502 | |
503 | 503 | <?php |
504 | 504 | if (!isset($globalAircraft) || $globalAircraft === TRUE) { |
505 | - if (extension_loaded('gd') && function_exists('gd_info')) { |
|
506 | - ?> |
|
505 | + if (extension_loaded('gd') && function_exists('gd_info')) { |
|
506 | + ?> |
|
507 | 507 | <li><input type="checkbox" name="aircraftcoloraltitude" value="1" onclick="iconColorAltitude(this)" <?php if (isset($_COOKIE['IconColorAltitude']) && $_COOKIE['IconColorAltitude'] == 'true') print 'checked'; ?> ><?php echo _("Aircraft icon color based on altitude"); ?></li> |
508 | 508 | <?php |
509 | 509 | if (!isset($_COOKIE['IconColorAltitude']) || $_COOKIE['IconColorAltitude'] == 'false') { |
510 | - ?> |
|
510 | + ?> |
|
511 | 511 | <li><?php echo _("Aircraft icon color:"); ?><input type="color" name="aircraftcolor" id="html5colorpicker" onchange="iconColor(aircraftcolor.value);" value="#<?php if (isset($_COOKIE['IconColor'])) print $_COOKIE['IconColor']; elseif (isset($globalAircraftIconColor)) print $globalAircraftIconColor; else print '1a3151'; ?>"></li> |
512 | 512 | <?php |
513 | 513 | } |
514 | - } |
|
515 | - } |
|
516 | - ?> |
|
514 | + } |
|
515 | + } |
|
516 | + ?> |
|
517 | 517 | <?php |
518 | 518 | if (isset($globalMarine) && $globalMarine === TRUE) { |
519 | - if (extension_loaded('gd') && function_exists('gd_info')) { |
|
520 | - ?> |
|
519 | + if (extension_loaded('gd') && function_exists('gd_info')) { |
|
520 | + ?> |
|
521 | 521 | <li><?php echo _("Marine icon color:"); ?> |
522 | 522 | <input type="color" name="marinecolor" id="html5colorpicker" onchange="MarineiconColor(marinecolor.value);" value="#<?php if (isset($_COOKIE['MarineIconColor'])) print $_COOKIE['MarineIconColor']; elseif (isset($globalMarineIconColor)) print $globalMarineIconColor; else print '1a3151'; ?>"> |
523 | 523 | </li> |
524 | 524 | <?php |
525 | - } |
|
526 | - } |
|
527 | - ?> |
|
525 | + } |
|
526 | + } |
|
527 | + ?> |
|
528 | 528 | <?php |
529 | 529 | if (isset($globalTracker) && $globalTracker === TRUE) { |
530 | - if (extension_loaded('gd') && function_exists('gd_info')) { |
|
531 | - ?> |
|
530 | + if (extension_loaded('gd') && function_exists('gd_info')) { |
|
531 | + ?> |
|
532 | 532 | <li><?php echo _("Tracker icon color:"); ?> |
533 | 533 | <input type="color" name="trackercolor" id="html5colorpicker" onchange="TrackericonColor(trackercolor.value);" value="#<?php if (isset($_COOKIE['TrackerIconColor'])) print $_COOKIE['TrackerIconColor']; elseif (isset($globalTrackerIconColor)) print $globalTrackerIconColor; else print '1a3151'; ?>"> |
534 | 534 | </li> |
535 | 535 | <?php |
536 | - } |
|
537 | - } |
|
538 | - ?> |
|
536 | + } |
|
537 | + } |
|
538 | + ?> |
|
539 | 539 | <?php |
540 | 540 | if (!isset($globalAircraft) || $globalAircraft === TRUE) { |
541 | - ?> |
|
541 | + ?> |
|
542 | 542 | <li><?php echo _("Show airport icon at zoom level:"); ?> |
543 | 543 | <div class="range"> |
544 | 544 | <input type="range" min="0" max="19" step="1" name="airportzoom" onchange="range.value=value;airportDisplayZoom(airportzoom.value);" value="<?php if (isset($_COOKIE['AirportZoom'])) print $_COOKIE['AirportZoom']; elseif (isset($globalAirportZoom)) print $globalAirportZoom; else print '7'; ?>"> |
@@ -547,9 +547,9 @@ discard block |
||
547 | 547 | </li> |
548 | 548 | <?php |
549 | 549 | } |
550 | - ?> |
|
550 | + ?> |
|
551 | 551 | <?php |
552 | - } elseif (isset($_COOKIE['MapFormat']) || $_COOKIE['MapFOrmat'] == '3d') { |
|
552 | + } elseif (isset($_COOKIE['MapFormat']) || $_COOKIE['MapFOrmat'] == '3d') { |
|
553 | 553 | ?> |
554 | 554 | <li><?php echo _("Set scaling factor for rendering resolution:"); ?> |
555 | 555 | <div class="range"> |
@@ -587,7 +587,7 @@ discard block |
||
587 | 587 | </li> |
588 | 588 | <?php |
589 | 589 | } |
590 | - } |
|
590 | + } |
|
591 | 591 | ?> |
592 | 592 | <li><?php echo _("Distance unit:"); ?> |
593 | 593 | <select class="selectpicker" onchange="unitdistance(this);"> |
@@ -620,19 +620,19 @@ discard block |
||
620 | 620 | <ul> |
621 | 621 | <?php |
622 | 622 | if (!isset($globalAircraft) || $globalAircraft) { |
623 | - ?> |
|
623 | + ?> |
|
624 | 624 | <?php |
625 | 625 | if (((isset($globalVATSIM) && $globalVATSIM) || isset($globalIVAO) && $globalIVAO || isset($globalphpVMS) && $globalphpVMS) && (!isset($globalMapVAchoose) || $globalMapVAchoose)) { |
626 | - ?> |
|
626 | + ?> |
|
627 | 627 | <?php if (isset($globalVATSIM) && $globalVATSIM) { ?><li><input type="checkbox" name="vatsim" value="1" onclick="clickVATSIM(this)" <?php if ((isset($_COOKIE['ShowVATSIM']) && $_COOKIE['ShowVATSIM'] == 'true') || !isset($_COOKIE['ShowVATSIM'])) print 'checked'; ?> ><?php echo _("Display VATSIM data"); ?></li><?php } ?> |
628 | 628 | <?php if (isset($globalIVAO) && $globalIVAO) { ?><li><input type="checkbox" name="ivao" value="1" onclick="clickIVAO(this)" <?php if ((isset($_COOKIE['ShowIVAO']) && $_COOKIE['ShowIVAO'] == 'true') || !isset($_COOKIE['ShowIVAO'])) print 'checked'; ?> ><?php echo _("Display IVAO data"); ?></li><?php } ?> |
629 | 629 | <?php if (isset($globalphpVMS) && $globalphpVMS) { ?><li><input type="checkbox" name="phpvms" value="1" onclick="clickphpVMS(this)" <?php if ((isset($_COOKIE['ShowVMS']) && $_COOKIE['ShowVMS'] == 'true') || !isset($_COOKIE['ShowVMS'])) print 'checked'; ?> ><?php echo _("Display phpVMS data"); ?></li><?php } ?> |
630 | 630 | <?php |
631 | 631 | } |
632 | - ?> |
|
632 | + ?> |
|
633 | 633 | <?php |
634 | 634 | if (!(isset($globalVA) && $globalVA) && !(isset($globalVATSIM) && $globalVATSIM) && !(isset($globalIVAO) && $globalIVAO) && !(isset($globalphpVMS) && $globalphpVMS) && isset($globalSBS1) && $globalSBS1 && isset($globalAPRS) && $globalAPRS && (!isset($globalMapchoose) || $globalMapchoose)) { |
635 | - ?> |
|
635 | + ?> |
|
636 | 636 | <?php if (isset($globalSBS1) && $globalSBS1) { ?> |
637 | 637 | <li><div class="checkbox"><label><input type="checkbox" name="sbs" value="1" onclick="clickSBS1(this)" <?php if ((isset($_COOKIE['ShowSBS1']) && $_COOKIE['ShowSBS1'] == 'true') || !isset($_COOKIE['ShowSBS1'])) print 'checked'; ?> ><?php echo _("Display ADS-B data"); ?></label></div></li> |
638 | 638 | <?php } ?> |
@@ -641,7 +641,7 @@ discard block |
||
641 | 641 | <?php } ?> |
642 | 642 | <?php |
643 | 643 | } |
644 | - ?> |
|
644 | + ?> |
|
645 | 645 | <li><?php echo _("Display airlines:"); ?> |
646 | 646 | <br/> |
647 | 647 | <select class="selectpicker" multiple onchange="airlines(this);" id="display_airlines"> |
@@ -661,14 +661,14 @@ discard block |
||
661 | 661 | echo '<option value="'.$airline['airline_icao'].'">'.$airline_name.'</option>'; |
662 | 662 | } |
663 | 663 | } |
664 | - ?> |
|
664 | + ?> |
|
665 | 665 | </select> |
666 | 666 | </li> |
667 | 667 | <?php |
668 | 668 | $Spotter = new Spotter(); |
669 | 669 | $allalliancenames = $Spotter->getAllAllianceNames(); |
670 | 670 | if (!empty($allalliancenames)) { |
671 | - ?> |
|
671 | + ?> |
|
672 | 672 | <li><?php echo _("Display alliance:"); ?> |
673 | 673 | <br/> |
674 | 674 | <select class="selectpicker" onchange="alliance(this);" id="display_alliance"> |
@@ -682,18 +682,18 @@ discard block |
||
682 | 682 | echo '<option value="'.$alliance_name.'">'.$alliance_name.'</option>'; |
683 | 683 | } |
684 | 684 | } |
685 | - ?> |
|
685 | + ?> |
|
686 | 686 | </select> |
687 | 687 | </li> |
688 | 688 | <?php |
689 | 689 | } |
690 | - ?> |
|
690 | + ?> |
|
691 | 691 | <?php |
692 | 692 | } |
693 | - ?> |
|
693 | + ?> |
|
694 | 694 | <?php |
695 | 695 | if (isset($globalAPRS) && $globalAPRS) { |
696 | - ?> |
|
696 | + ?> |
|
697 | 697 | <li><?php echo _("Display APRS sources name:"); ?> |
698 | 698 | <select class="selectpicker" multiple onchange="sources(this);"> |
699 | 699 | <?php |
@@ -717,18 +717,18 @@ discard block |
||
717 | 717 | echo '<option value="'.$src['name'].'">'.$src['name'].'</option>'; |
718 | 718 | } |
719 | 719 | } |
720 | - ?> |
|
720 | + ?> |
|
721 | 721 | </select> |
722 | 722 | </li> |
723 | 723 | <?php |
724 | 724 | } |
725 | - ?> |
|
725 | + ?> |
|
726 | 726 | <?php |
727 | 727 | if (!isset($globalAircraft) || $globalAircraft) { |
728 | - ?> |
|
728 | + ?> |
|
729 | 729 | <?php |
730 | - if (!(isset($globalVATSIM) && $globalVATSIM) && !(isset($globalIVAO) && $globalIVAO) && !(isset($globalphpVMS) && $globalphpVMS)) { |
|
731 | - ?> |
|
730 | + if (!(isset($globalVATSIM) && $globalVATSIM) && !(isset($globalIVAO) && $globalIVAO) && !(isset($globalphpVMS) && $globalphpVMS)) { |
|
731 | + ?> |
|
732 | 732 | <li><?php echo _("Display airlines of type:"); ?><br/> |
733 | 733 | <select class="selectpicker" onchange="airlinestype(this);"> |
734 | 734 | <option value="all"<?php if (!isset($_COOKIE['filter_airlinestype']) || $_COOKIE['filter_airlinestype'] == 'all' || $_COOKIE['filter_airlinestype'] == '') echo ' selected'; ?>><?php echo _("All"); ?></option> |
@@ -738,14 +738,14 @@ discard block |
||
738 | 738 | </select> |
739 | 739 | </li> |
740 | 740 | <?php |
741 | - } |
|
742 | - ?> |
|
741 | + } |
|
742 | + ?> |
|
743 | 743 | <?php |
744 | 744 | } |
745 | - ?> |
|
745 | + ?> |
|
746 | 746 | <?php |
747 | 747 | if (isset($globalMarine) && $globalMarine) { |
748 | - ?> |
|
748 | + ?> |
|
749 | 749 | <li> |
750 | 750 | <?php echo _("Display vessels with MMSI:"); ?> |
751 | 751 | <input type="text" name="mmsifilter" onchange="mmsifilter();" id="mmsifilter" value="<?php if (isset($_COOKIE['filter_mmsi'])) print $_COOKIE['filter_mmsi']; ?>" /> |
@@ -764,7 +764,7 @@ discard block |
||
764 | 764 | foreach ($races as $race) { |
765 | 765 | print '<option value="'.$race['race_id'].'">'.$race['race_name'].'</option>'; |
766 | 766 | } |
767 | - ?> |
|
767 | + ?> |
|
768 | 768 | </select> |
769 | 769 | </li> |
770 | 770 | |
@@ -772,7 +772,7 @@ discard block |
||
772 | 772 | } |
773 | 773 | } |
774 | 774 | } |
775 | - ?> |
|
775 | + ?> |
|
776 | 776 | <li> |
777 | 777 | <?php echo _("Display with ident:"); ?> |
778 | 778 | <input type="text" name="identfilter" onchange="identfilter();" id="identfilter" value="<?php if (isset($_COOKIE['filter_ident'])) print $_COOKIE['filter_ident']; ?>" /> |
@@ -785,7 +785,7 @@ discard block |
||
785 | 785 | </form> |
786 | 786 | </div> |
787 | 787 | <?php |
788 | - if (isset($globalSatellite) && $globalSatellite) { |
|
788 | + if (isset($globalSatellite) && $globalSatellite) { |
|
789 | 789 | ?> |
790 | 790 | <div class="sidebar-pane" id="satellites"> |
791 | 791 | <h1 class="sidebar-header"><?php echo _("Satellites"); ?><span class="sidebar-close"><i class="fa fa-caret-left"></i></span></h1> |
@@ -825,14 +825,14 @@ discard block |
||
825 | 825 | print '<option value="'.$type['tle_type'].'">'.$type_name.'</option>'; |
826 | 826 | } |
827 | 827 | } |
828 | - ?> |
|
828 | + ?> |
|
829 | 829 | </select> |
830 | 830 | </li> |
831 | 831 | </ul> |
832 | 832 | </form> |
833 | 833 | </div> |
834 | 834 | <?php |
835 | - } |
|
835 | + } |
|
836 | 836 | ?> |
837 | 837 | </div> |
838 | 838 | </div> |
@@ -52,7 +52,10 @@ discard block |
||
52 | 52 | <?php |
53 | 53 | if ((!isset($_COOKIE['MapFormat']) && isset($globalMap3Ddefault) && $globalMap3Ddefault) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d')) { |
54 | 54 | ?> |
55 | -<script src="<?php echo $globalURL; ?>/js/map.3d.js.php<?php if (isset($tsk)) print '?tsk='.$tsk; ?>"></script> |
|
55 | +<script src="<?php echo $globalURL; ?>/js/map.3d.js.php<?php if (isset($tsk)) { |
|
56 | + print '?tsk='.$tsk; |
|
57 | +} |
|
58 | +?>"></script> |
|
56 | 59 | <?php |
57 | 60 | if (!isset($globalAircraft) || $globalAircraft) { |
58 | 61 | ?> |
@@ -148,13 +151,22 @@ discard block |
||
148 | 151 | <?php |
149 | 152 | if (!isset($globalAircraft) || $globalAircraft) { |
150 | 153 | ?> |
151 | - <li><div class="checkbox"><label><input type="checkbox" name="waypoints" value="1" onclick="showWaypoints(this);" <?php if (isset($_COOKIE['waypoints']) && $_COOKIE['waypoints'] == 'true') print 'checked'; ?> /><?php echo _("Display waypoints"); ?></label></div></li> |
|
152 | - <li><div class="checkbox"><label><input type="checkbox" name="airspace" value="1" onclick="showAirspace(this);" <?php if (isset($_COOKIE['airspace']) && $_COOKIE['airspace'] == 'true') print 'checked'; ?> /><?php echo _("Display airspace"); ?></label></div></li> |
|
154 | + <li><div class="checkbox"><label><input type="checkbox" name="waypoints" value="1" onclick="showWaypoints(this);" <?php if (isset($_COOKIE['waypoints']) && $_COOKIE['waypoints'] == 'true') { |
|
155 | + print 'checked'; |
|
156 | +} |
|
157 | +?> /><?php echo _("Display waypoints"); ?></label></div></li> |
|
158 | + <li><div class="checkbox"><label><input type="checkbox" name="airspace" value="1" onclick="showAirspace(this);" <?php if (isset($_COOKIE['airspace']) && $_COOKIE['airspace'] == 'true') { |
|
159 | + print 'checked'; |
|
160 | +} |
|
161 | +?> /><?php echo _("Display airspace"); ?></label></div></li> |
|
153 | 162 | <?php |
154 | 163 | } |
155 | 164 | if (isset($globalMarine) && $globalMarine) { |
156 | 165 | ?> |
157 | - <li><div class="checkbox"><label><input type="checkbox" name="openseamap" value="1" onclick="loadOpenSeaMap(this);" <?php if (isset($_COOKIE['openseamap']) && $_COOKIE['openseamap'] == 'true') print 'checked'; ?> /><?php echo _("Display OpenSeaMap"); ?></label></div></li> |
|
166 | + <li><div class="checkbox"><label><input type="checkbox" name="openseamap" value="1" onclick="loadOpenSeaMap(this);" <?php if (isset($_COOKIE['openseamap']) && $_COOKIE['openseamap'] == 'true') { |
|
167 | + print 'checked'; |
|
168 | +} |
|
169 | +?> /><?php echo _("Display OpenSeaMap"); ?></label></div></li> |
|
158 | 170 | <?php |
159 | 171 | } |
160 | 172 | ?> |
@@ -168,8 +180,14 @@ discard block |
||
168 | 180 | <?php |
169 | 181 | if (!isset($globalAircraft) || $globalAircraft) { |
170 | 182 | ?> |
171 | - <li><div class="checkbox"><label><input type="checkbox" name="waypoints" value="1" onclick="showWaypoints(this);" <?php if (isset($_COOKIE['waypoints']) && $_COOKIE['waypoints'] == 'true') print 'checked'; ?> /><?php echo _("Display waypoints"); ?> Beta</label></div></li> |
|
172 | - <li><div class="checkbox"><label><input type="checkbox" name="airspace" value="1" onclick="showAirspace(this);" <?php if (isset($_COOKIE['airspace']) && $_COOKIE['airspace'] == 'true') print 'checked'; ?> /><?php echo _("Display airspace"); ?> Beta</label></div></li> |
|
183 | + <li><div class="checkbox"><label><input type="checkbox" name="waypoints" value="1" onclick="showWaypoints(this);" <?php if (isset($_COOKIE['waypoints']) && $_COOKIE['waypoints'] == 'true') { |
|
184 | + print 'checked'; |
|
185 | +} |
|
186 | +?> /><?php echo _("Display waypoints"); ?> Beta</label></div></li> |
|
187 | + <li><div class="checkbox"><label><input type="checkbox" name="airspace" value="1" onclick="showAirspace(this);" <?php if (isset($_COOKIE['airspace']) && $_COOKIE['airspace'] == 'true') { |
|
188 | + print 'checked'; |
|
189 | +} |
|
190 | +?> /><?php echo _("Display airspace"); ?> Beta</label></div></li> |
|
173 | 191 | <?php |
174 | 192 | } |
175 | 193 | ?> |
@@ -183,14 +201,32 @@ discard block |
||
183 | 201 | <h1>NOTAM</h1> |
184 | 202 | <form> |
185 | 203 | <ul> |
186 | - <li><div class="checkbox"><label><input type="checkbox" name="notamcb" value="1" onclick="showNotam(this);" <?php if (isset($_COOKIE['notam']) && $_COOKIE['notam'] == 'true') print 'checked'; ?> /><?php echo _("Display NOTAM"); ?></label></div></li> |
|
204 | + <li><div class="checkbox"><label><input type="checkbox" name="notamcb" value="1" onclick="showNotam(this);" <?php if (isset($_COOKIE['notam']) && $_COOKIE['notam'] == 'true') { |
|
205 | + print 'checked'; |
|
206 | +} |
|
207 | +?> /><?php echo _("Display NOTAM"); ?></label></div></li> |
|
187 | 208 | <li><?php echo _("NOTAM scope:"); ?> |
188 | 209 | <select class="selectpicker" onchange="notamscope(this);"> |
189 | - <option<?php if (!isset($_COOKIE['notamscope']) || $_COOKIE['notamscope'] == 'All') print ' selected'; ?>>All</option> |
|
190 | - <option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Airport/Enroute warning') print ' selected'; ?>>Airport/Enroute warning</option> |
|
191 | - <option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Airport warning') print ' selected'; ?>>Airport warning</option> |
|
192 | - <option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Navigation warning') print ' selected'; ?>>Navigation warning</option> |
|
193 | - <option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Enroute warning') print ' selected'; ?>>Enroute warning</option> |
|
210 | + <option<?php if (!isset($_COOKIE['notamscope']) || $_COOKIE['notamscope'] == 'All') { |
|
211 | + print ' selected'; |
|
212 | +} |
|
213 | +?>>All</option> |
|
214 | + <option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Airport/Enroute warning') { |
|
215 | + print ' selected'; |
|
216 | +} |
|
217 | +?>>Airport/Enroute warning</option> |
|
218 | + <option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Airport warning') { |
|
219 | + print ' selected'; |
|
220 | +} |
|
221 | +?>>Airport warning</option> |
|
222 | + <option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Navigation warning') { |
|
223 | + print ' selected'; |
|
224 | +} |
|
225 | +?>>Navigation warning</option> |
|
226 | + <option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Enroute warning') { |
|
227 | + print ' selected'; |
|
228 | +} |
|
229 | +?>>Enroute warning</option> |
|
194 | 230 | </select |
195 | 231 | </li> |
196 | 232 | </ul> |
@@ -218,7 +254,10 @@ discard block |
||
218 | 254 | <div class="form-group"> |
219 | 255 | <label><?php echo _("From:"); ?></label> |
220 | 256 | <div class='input-group date' id='datetimepicker1'> |
221 | - <input type='text' id="start_date" name="start_date" class="form-control" autocomplete="off" value="<?php if (isset($_COOKIE['archive_begin']) && $_COOKIE['archive_begin'] != '') print date("Y-m-d H:i",$_COOKIE['archive_begin']).' UTC'; ?>" required /> |
|
257 | + <input type='text' id="start_date" name="start_date" class="form-control" autocomplete="off" value="<?php if (isset($_COOKIE['archive_begin']) && $_COOKIE['archive_begin'] != '') { |
|
258 | + print date("Y-m-d H:i",$_COOKIE['archive_begin']).' UTC'; |
|
259 | +} |
|
260 | +?>" required /> |
|
222 | 261 | <span class="input-group-addon"> |
223 | 262 | <span class="glyphicon glyphicon-calendar"></span> |
224 | 263 | </span> |
@@ -227,7 +266,10 @@ discard block |
||
227 | 266 | <div class="form-group"> |
228 | 267 | <label><?php echo _("To:"); ?></label> |
229 | 268 | <div class='input-group date' id='datetimepicker2'> |
230 | - <input type='text' id="end_date" name="end_date" class="form-control" autocomplete="off" value="<?php if (isset($_COOKIE['archive_end']) && $_COOKIE['archive_end'] != '') print date("Y-m-d H:i",$_COOKIE['archive_end']).' UTC'; ?>" /> |
|
269 | + <input type='text' id="end_date" name="end_date" class="form-control" autocomplete="off" value="<?php if (isset($_COOKIE['archive_end']) && $_COOKIE['archive_end'] != '') { |
|
270 | + print date("Y-m-d H:i",$_COOKIE['archive_end']).' UTC'; |
|
271 | +} |
|
272 | +?>" /> |
|
231 | 273 | <span class="input-group-addon"> |
232 | 274 | <span class="glyphicon glyphicon-calendar"></span> |
233 | 275 | </span> |
@@ -259,8 +301,20 @@ discard block |
||
259 | 301 | </script> |
260 | 302 | <li><?php echo _("Playback speed:"); ?> |
261 | 303 | <div class="range"> |
262 | - <input type="range" min="0" max="50" step="1" id="archivespeed" name="archivespeed" onChange="archivespeedrange.value=value;" value="<?php if (isset($_POST['archivespeed'])) print $_POST['archivespeed']; elseif (isset($_COOKIE['archive_speed'])) print $_COOKIE['archive_speed']; else print '1'; ?>"> |
|
263 | - <output id="archivespeedrange"><?php if (isset($_COOKIE['archive_speed'])) print $_COOKIE['archive_speed']; else print '1'; ?></output> |
|
304 | + <input type="range" min="0" max="50" step="1" id="archivespeed" name="archivespeed" onChange="archivespeedrange.value=value;" value="<?php if (isset($_POST['archivespeed'])) { |
|
305 | + print $_POST['archivespeed']; |
|
306 | +} elseif (isset($_COOKIE['archive_speed'])) { |
|
307 | + print $_COOKIE['archive_speed']; |
|
308 | +} else { |
|
309 | + print '1'; |
|
310 | +} |
|
311 | +?>"> |
|
312 | + <output id="archivespeedrange"><?php if (isset($_COOKIE['archive_speed'])) { |
|
313 | + print $_COOKIE['archive_speed']; |
|
314 | +} else { |
|
315 | + print '1'; |
|
316 | +} |
|
317 | +?></output> |
|
264 | 318 | </div> |
265 | 319 | </li> |
266 | 320 | <?php |
@@ -289,14 +343,20 @@ discard block |
||
289 | 343 | <li><?php echo _("Type of Map:"); ?> |
290 | 344 | <?php |
291 | 345 | if ((!isset($_COOKIE['MapFormat']) && (!isset($globalMap3Ddefault) || !$globalMap3Ddefault)) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] != '3d')) { |
292 | - if (!isset($_COOKIE['MapType']) || $_COOKIE['MapType'] == '') $MapType = $globalMapProvider; |
|
293 | - else $MapType = $_COOKIE['MapType']; |
|
346 | + if (!isset($_COOKIE['MapType']) || $_COOKIE['MapType'] == '') { |
|
347 | + $MapType = $globalMapProvider; |
|
348 | + } else { |
|
349 | + $MapType = $_COOKIE['MapType']; |
|
350 | + } |
|
294 | 351 | ?> |
295 | 352 | <select class="selectpicker" onchange="mapType(this);"> |
296 | 353 | <?php |
297 | 354 | } else { |
298 | - if (!isset($_COOKIE['MapType3D']) || $_COOKIE['MapType3D'] == '') $MapType = $globalMapProvider; |
|
299 | - else $MapType = $_COOKIE['MapType3D']; |
|
355 | + if (!isset($_COOKIE['MapType3D']) || $_COOKIE['MapType3D'] == '') { |
|
356 | + $MapType = $globalMapProvider; |
|
357 | + } else { |
|
358 | + $MapType = $_COOKIE['MapType3D']; |
|
359 | + } |
|
300 | 360 | ?> |
301 | 361 | <select class="selectpicker" onchange="mapType3D(this);"> |
302 | 362 | <?php |
@@ -305,24 +365,48 @@ discard block |
||
305 | 365 | <?php |
306 | 366 | if (isset($globalMapOffline) && $globalMapOffline === TRUE) { |
307 | 367 | ?> |
308 | - <option value="offline"<?php if ($MapType == 'offline') print ' selected'; ?>>Natural Earth (local)</option> |
|
368 | + <option value="offline"<?php if ($MapType == 'offline') { |
|
369 | + print ' selected'; |
|
370 | +} |
|
371 | +?>>Natural Earth (local)</option> |
|
309 | 372 | <?php |
310 | 373 | } else { |
311 | 374 | if (file_exists(dirname(__FILE__).'/js/Cesium/Assets/Textures/NaturalEarthII/tilemapresource.xml')) { |
312 | 375 | ?> |
313 | - <option value="offline"<?php if ($MapType == 'offline') print ' selected'; ?>>Natural Earth (local)</option> |
|
376 | + <option value="offline"<?php if ($MapType == 'offline') { |
|
377 | + print ' selected'; |
|
378 | +} |
|
379 | +?>>Natural Earth (local)</option> |
|
314 | 380 | <?php |
315 | 381 | } |
316 | 382 | ?> |
317 | - <option value="ArcGIS-Streetmap"<?php if ($MapType == 'ArcGIS-Streetmap') print ' selected'; ?>>ArcGIS Streetmap</option> |
|
318 | - <option value="ArcGIS-Satellite"<?php if ($MapType == 'ArcGIS-Satellite') print ' selected'; ?>>ArcGIS Satellite</option> |
|
319 | - <option value="ArcGIS-Satellite"<?php if ($MapType == 'ArcGIS-Ocean') print ' selected'; ?>>ArcGIS Ocean</option> |
|
383 | + <option value="ArcGIS-Streetmap"<?php if ($MapType == 'ArcGIS-Streetmap') { |
|
384 | + print ' selected'; |
|
385 | +} |
|
386 | +?>>ArcGIS Streetmap</option> |
|
387 | + <option value="ArcGIS-Satellite"<?php if ($MapType == 'ArcGIS-Satellite') { |
|
388 | + print ' selected'; |
|
389 | +} |
|
390 | +?>>ArcGIS Satellite</option> |
|
391 | + <option value="ArcGIS-Satellite"<?php if ($MapType == 'ArcGIS-Ocean') { |
|
392 | + print ' selected'; |
|
393 | +} |
|
394 | +?>>ArcGIS Ocean</option> |
|
320 | 395 | <?php |
321 | 396 | if (isset($globalBingMapKey) && $globalBingMapKey != '') { |
322 | 397 | ?> |
323 | - <option value="Bing-Aerial"<?php if ($MapType == 'Bing-Aerial') print ' selected'; ?>>Bing-Aerial</option> |
|
324 | - <option value="Bing-Hybrid"<?php if ($MapType == 'Bing-Hybrid') print ' selected'; ?>>Bing-Hybrid</option> |
|
325 | - <option value="Bing-Road"<?php if ($MapType == 'Bing-Road') print ' selected'; ?>>Bing-Road</option> |
|
398 | + <option value="Bing-Aerial"<?php if ($MapType == 'Bing-Aerial') { |
|
399 | + print ' selected'; |
|
400 | +} |
|
401 | +?>>Bing-Aerial</option> |
|
402 | + <option value="Bing-Hybrid"<?php if ($MapType == 'Bing-Hybrid') { |
|
403 | + print ' selected'; |
|
404 | +} |
|
405 | +?>>Bing-Hybrid</option> |
|
406 | + <option value="Bing-Road"<?php if ($MapType == 'Bing-Road') { |
|
407 | + print ' selected'; |
|
408 | +} |
|
409 | +?>>Bing-Road</option> |
|
326 | 410 | <?php |
327 | 411 | } |
328 | 412 | ?> |
@@ -332,60 +416,147 @@ discard block |
||
332 | 416 | <?php |
333 | 417 | if (isset($globalHereappId) && $globalHereappId != '' && isset($globalHereappCode) && $globalHereappCode != '') { |
334 | 418 | ?> |
335 | - <option value="Here-Aerial"<?php if ($MapType == 'Here') print ' selected'; ?>>Here-Aerial</option> |
|
336 | - <option value="Here-Hybrid"<?php if ($MapType == 'Here') print ' selected'; ?>>Here-Hybrid</option> |
|
337 | - <option value="Here-Road"<?php if ($MapType == 'Here') print ' selected'; ?>>Here-Road</option> |
|
419 | + <option value="Here-Aerial"<?php if ($MapType == 'Here') { |
|
420 | + print ' selected'; |
|
421 | +} |
|
422 | +?>>Here-Aerial</option> |
|
423 | + <option value="Here-Hybrid"<?php if ($MapType == 'Here') { |
|
424 | + print ' selected'; |
|
425 | +} |
|
426 | +?>>Here-Hybrid</option> |
|
427 | + <option value="Here-Road"<?php if ($MapType == 'Here') { |
|
428 | + print ' selected'; |
|
429 | +} |
|
430 | +?>>Here-Road</option> |
|
338 | 431 | <?php |
339 | 432 | } |
340 | 433 | ?> |
341 | 434 | <?php |
342 | 435 | if (isset($globalGoogleAPIKey) && $globalGoogleAPIKey != '') { |
343 | 436 | ?> |
344 | - <option value="Google-Roadmap"<?php if ($MapType == 'Google-Roadmap') print ' selected'; ?>>Google Roadmap</option> |
|
345 | - <option value="Google-Satellite"<?php if ($MapType == 'Google-Satellite') print ' selected'; ?>>Google Satellite</option> |
|
346 | - <option value="Google-Hybrid"<?php if ($MapType == 'Google-Hybrid') print ' selected'; ?>>Google Hybrid</option> |
|
347 | - <option value="Google-Terrain"<?php if ($MapType == 'Google-Terrain') print ' selected'; ?>>Google Terrain</option> |
|
437 | + <option value="Google-Roadmap"<?php if ($MapType == 'Google-Roadmap') { |
|
438 | + print ' selected'; |
|
439 | +} |
|
440 | +?>>Google Roadmap</option> |
|
441 | + <option value="Google-Satellite"<?php if ($MapType == 'Google-Satellite') { |
|
442 | + print ' selected'; |
|
443 | +} |
|
444 | +?>>Google Satellite</option> |
|
445 | + <option value="Google-Hybrid"<?php if ($MapType == 'Google-Hybrid') { |
|
446 | + print ' selected'; |
|
447 | +} |
|
448 | +?>>Google Hybrid</option> |
|
449 | + <option value="Google-Terrain"<?php if ($MapType == 'Google-Terrain') { |
|
450 | + print ' selected'; |
|
451 | +} |
|
452 | +?>>Google Terrain</option> |
|
348 | 453 | <?php |
349 | 454 | } |
350 | 455 | ?> |
351 | 456 | <?php |
352 | 457 | if (isset($globalMapQuestKey) && $globalMapQuestKey != '') { |
353 | 458 | ?> |
354 | - <option value="MapQuest-OSM"<?php if ($MapType == 'MapQuest-OSM') print ' selected'; ?>>MapQuest-OSM</option> |
|
355 | - <option value="MapQuest-Aerial"<?php if ($MapType == 'MapQuest-Aerial') print ' selected'; ?>>MapQuest-Aerial</option> |
|
356 | - <option value="MapQuest-Hybrid"<?php if ($MapType == 'MapQuest-Hybrid') print ' selected'; ?>>MapQuest-Hybrid</option> |
|
459 | + <option value="MapQuest-OSM"<?php if ($MapType == 'MapQuest-OSM') { |
|
460 | + print ' selected'; |
|
461 | +} |
|
462 | +?>>MapQuest-OSM</option> |
|
463 | + <option value="MapQuest-Aerial"<?php if ($MapType == 'MapQuest-Aerial') { |
|
464 | + print ' selected'; |
|
465 | +} |
|
466 | +?>>MapQuest-Aerial</option> |
|
467 | + <option value="MapQuest-Hybrid"<?php if ($MapType == 'MapQuest-Hybrid') { |
|
468 | + print ' selected'; |
|
469 | +} |
|
470 | +?>>MapQuest-Hybrid</option> |
|
357 | 471 | <?php |
358 | 472 | } |
359 | 473 | ?> |
360 | - <option value="Yandex"<?php if ($MapType == 'Yandex') print ' selected'; ?>>Yandex</option> |
|
361 | - <option value="offline"<?php if ($MapType == 'offline') print ' selected'; ?>>Natural Earth</option> |
|
474 | + <option value="Yandex"<?php if ($MapType == 'Yandex') { |
|
475 | + print ' selected'; |
|
476 | +} |
|
477 | +?>>Yandex</option> |
|
478 | + <option value="offline"<?php if ($MapType == 'offline') { |
|
479 | + print ' selected'; |
|
480 | +} |
|
481 | +?>>Natural Earth</option> |
|
362 | 482 | <?php |
363 | 483 | } |
364 | 484 | ?> |
365 | - <option value="NatGeo-Street"<?php if ($MapType == 'NatGeo-Street') print ' selected'; ?>>National Geographic Street</option> |
|
485 | + <option value="NatGeo-Street"<?php if ($MapType == 'NatGeo-Street') { |
|
486 | + print ' selected'; |
|
487 | +} |
|
488 | +?>>National Geographic Street</option> |
|
366 | 489 | <?php |
367 | 490 | if (isset($globalMapboxToken) && $globalMapboxToken != '') { |
368 | - if (!isset($_COOKIE['MapTypeId'])) $MapBoxId = 'default'; |
|
369 | - else $MapBoxId = $_COOKIE['MapTypeId']; |
|
491 | + if (!isset($_COOKIE['MapTypeId'])) { |
|
492 | + $MapBoxId = 'default'; |
|
493 | + } else { |
|
494 | + $MapBoxId = $_COOKIE['MapTypeId']; |
|
495 | + } |
|
370 | 496 | ?> |
371 | - <option value="MapboxGL"<?php if ($MapType == 'MapboxGL') print ' selected'; ?>>Mapbox GL</option> |
|
372 | - <option value="Mapbox-default"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'default') print ' selected'; ?>>Mapbox default</option> |
|
373 | - <option value="Mapbox-mapbox.streets"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.streets') print ' selected'; ?>>Mapbox streets</option> |
|
374 | - <option value="Mapbox-mapbox.light"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.light') print ' selected'; ?>>Mapbox light</option> |
|
375 | - <option value="Mapbox-mapbox.dark"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.dark') print ' selected'; ?>>Mapbox dark</option> |
|
376 | - <option value="Mapbox-mapbox.satellite"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.satellite') print ' selected'; ?>>Mapbox satellite</option> |
|
377 | - <option value="Mapbox-mapbox.streets-satellite"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.streets-satellite') print ' selected'; ?>>Mapbox streets-satellite</option> |
|
378 | - <option value="Mapbox-mapbox.streets-basic"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.streets-basic') print ' selected'; ?>>Mapbox streets-basic</option> |
|
379 | - <option value="Mapbox-mapbox.comic"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.comic') print ' selected'; ?>>Mapbox comic</option> |
|
380 | - <option value="Mapbox-mapbox.outdoors"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.outdoors') print ' selected'; ?>>Mapbox outdoors</option> |
|
381 | - <option value="Mapbox-mapbox.pencil"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.pencil') print ' selected'; ?>>Mapbox pencil</option> |
|
382 | - <option value="Mapbox-mapbox.pirates"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.pirates') print ' selected'; ?>>Mapbox pirates</option> |
|
383 | - <option value="Mapbox-mapbox.emerald"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.emerald') print ' selected'; ?>>Mapbox emerald</option> |
|
497 | + <option value="MapboxGL"<?php if ($MapType == 'MapboxGL') { |
|
498 | + print ' selected'; |
|
499 | +} |
|
500 | +?>>Mapbox GL</option> |
|
501 | + <option value="Mapbox-default"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'default') { |
|
502 | + print ' selected'; |
|
503 | +} |
|
504 | +?>>Mapbox default</option> |
|
505 | + <option value="Mapbox-mapbox.streets"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.streets') { |
|
506 | + print ' selected'; |
|
507 | +} |
|
508 | +?>>Mapbox streets</option> |
|
509 | + <option value="Mapbox-mapbox.light"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.light') { |
|
510 | + print ' selected'; |
|
511 | +} |
|
512 | +?>>Mapbox light</option> |
|
513 | + <option value="Mapbox-mapbox.dark"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.dark') { |
|
514 | + print ' selected'; |
|
515 | +} |
|
516 | +?>>Mapbox dark</option> |
|
517 | + <option value="Mapbox-mapbox.satellite"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.satellite') { |
|
518 | + print ' selected'; |
|
519 | +} |
|
520 | +?>>Mapbox satellite</option> |
|
521 | + <option value="Mapbox-mapbox.streets-satellite"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.streets-satellite') { |
|
522 | + print ' selected'; |
|
523 | +} |
|
524 | +?>>Mapbox streets-satellite</option> |
|
525 | + <option value="Mapbox-mapbox.streets-basic"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.streets-basic') { |
|
526 | + print ' selected'; |
|
527 | +} |
|
528 | +?>>Mapbox streets-basic</option> |
|
529 | + <option value="Mapbox-mapbox.comic"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.comic') { |
|
530 | + print ' selected'; |
|
531 | +} |
|
532 | +?>>Mapbox comic</option> |
|
533 | + <option value="Mapbox-mapbox.outdoors"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.outdoors') { |
|
534 | + print ' selected'; |
|
535 | +} |
|
536 | +?>>Mapbox outdoors</option> |
|
537 | + <option value="Mapbox-mapbox.pencil"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.pencil') { |
|
538 | + print ' selected'; |
|
539 | +} |
|
540 | +?>>Mapbox pencil</option> |
|
541 | + <option value="Mapbox-mapbox.pirates"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.pirates') { |
|
542 | + print ' selected'; |
|
543 | +} |
|
544 | +?>>Mapbox pirates</option> |
|
545 | + <option value="Mapbox-mapbox.emerald"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.emerald') { |
|
546 | + print ' selected'; |
|
547 | +} |
|
548 | +?>>Mapbox emerald</option> |
|
384 | 549 | <?php |
385 | 550 | } |
386 | 551 | ?> |
387 | - <!--<option value="OpenSeaMap"<?php if ($MapType == 'OpenSeaMap') print ' selected'; ?>>OpenSeaMap</option>--> |
|
388 | - <option value="OpenStreetMap"<?php if ($MapType == 'OpenStreetMap') print ' selected'; ?>>OpenStreetMap</option> |
|
552 | + <!--<option value="OpenSeaMap"<?php if ($MapType == 'OpenSeaMap') { |
|
553 | + print ' selected'; |
|
554 | +} |
|
555 | +?>>OpenSeaMap</option>--> |
|
556 | + <option value="OpenStreetMap"<?php if ($MapType == 'OpenStreetMap') { |
|
557 | + print ' selected'; |
|
558 | +} |
|
559 | +?>>OpenStreetMap</option> |
|
389 | 560 | <?php |
390 | 561 | } |
391 | 562 | ?> |
@@ -396,10 +567,22 @@ discard block |
||
396 | 567 | ?> |
397 | 568 | <li><?php echo _("Type of Terrain:"); ?> |
398 | 569 | <select class="selectpicker" onchange="terrainType(this);"> |
399 | - <option value="stk"<?php if (!isset($_COOKIE['MapTerrain']) || $_COOKIE['MapTerrain'] == 'stk') print ' selected'; ?>>stk terrain</option> |
|
400 | - <option value="ellipsoid"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'ellipsoid') print ' selected';?>>ellipsoid</option> |
|
401 | - <option value="vrterrain"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'vrterrain') print ' selected';?>>vr terrain</option> |
|
402 | - <option value="articdem"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'articdem') print ' selected';?>>ArticDEM</option> |
|
570 | + <option value="stk"<?php if (!isset($_COOKIE['MapTerrain']) || $_COOKIE['MapTerrain'] == 'stk') { |
|
571 | + print ' selected'; |
|
572 | +} |
|
573 | +?>>stk terrain</option> |
|
574 | + <option value="ellipsoid"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'ellipsoid') { |
|
575 | + print ' selected'; |
|
576 | +} |
|
577 | +?>>ellipsoid</option> |
|
578 | + <option value="vrterrain"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'vrterrain') { |
|
579 | + print ' selected'; |
|
580 | +} |
|
581 | +?>>vr terrain</option> |
|
582 | + <option value="articdem"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'articdem') { |
|
583 | + print ' selected'; |
|
584 | +} |
|
585 | +?>>ArticDEM</option> |
|
403 | 586 | </select> |
404 | 587 | </li> |
405 | 588 | <?php |
@@ -409,66 +592,126 @@ discard block |
||
409 | 592 | <?php |
410 | 593 | if (isset($globalMap3D) && $globalMap3D) { |
411 | 594 | ?> |
412 | - <li><div class="checkbox"><label><input type="checkbox" name="synchro2d3d" value="1" onclick="clickSyncMap2D3D(this)" <?php if (isset($_COOKIE['Map2D3DSync']) && $_COOKIE['Map2D3DSync'] == 'true') print 'checked'; ?> ><?php echo _("Use same type of map for 2D & 3D"); ?></label></div></li> |
|
595 | + <li><div class="checkbox"><label><input type="checkbox" name="synchro2d3d" value="1" onclick="clickSyncMap2D3D(this)" <?php if (isset($_COOKIE['Map2D3DSync']) && $_COOKIE['Map2D3DSync'] == 'true') { |
|
596 | + print 'checked'; |
|
597 | +} |
|
598 | +?> ><?php echo _("Use same type of map for 2D & 3D"); ?></label></div></li> |
|
413 | 599 | <?php |
414 | 600 | } |
415 | 601 | ?> |
416 | 602 | <?php |
417 | 603 | if (!isset($_COOKIE['MapFormat']) || $_COOKIE['MapFormat'] != '3d') { |
418 | 604 | ?> |
419 | - <li><div class="checkbox"><label><input type="checkbox" name="display2dbuildings" value="1" onclick="clickDisplay2DBuildings(this)" <?php if (isset($_COOKIE['Map2DBuildings']) && $_COOKIE['Map2DBuildings'] == 'true') print 'checked'; ?> ><?php echo _("Display 2.5D buidings on map"); ?></label></div></li> |
|
605 | + <li><div class="checkbox"><label><input type="checkbox" name="display2dbuildings" value="1" onclick="clickDisplay2DBuildings(this)" <?php if (isset($_COOKIE['Map2DBuildings']) && $_COOKIE['Map2DBuildings'] == 'true') { |
|
606 | + print 'checked'; |
|
607 | +} |
|
608 | +?> ><?php echo _("Display 2.5D buidings on map"); ?></label></div></li> |
|
420 | 609 | |
421 | 610 | <?php |
422 | 611 | if (!isset($globalAircraft) || $globalAircraft === TRUE) { |
423 | 612 | ?> |
424 | - <!--<li><div class="checkbox"><label><input type="checkbox" name="flightpopup" value="1" onclick="clickFlightPopup(this)" <?php if (isset($_COOKIE['flightpopup']) && $_COOKIE['flightpopup'] == 'true') print 'checked'; ?> ><?php echo _("Display flight info as popup"); ?></label></div></li>--> |
|
425 | - <li><div class="checkbox"><label><input type="checkbox" name="flightpath" value="1" onclick="clickFlightPath(this)" <?php if ((isset($_COOKIE['flightpath']) && $_COOKIE['flightpath'] == 'true')) print 'checked'; ?> ><?php echo _("Display flight path"); ?></label></div></li> |
|
426 | - <li><div class="checkbox"><label><input type="checkbox" name="flightroute" value="1" onclick="clickFlightRoute(this)" <?php if ((isset($_COOKIE['MapRoute']) && $_COOKIE['MapRoute'] == 'true') || (!isset($_COOKIE['MapRoute']) && isset($globalMapRoute) && $globalMapRoute)) print 'checked'; ?> ><?php echo _("Display flight route on click"); ?></label></div></li> |
|
427 | - <li><div class="checkbox"><label><input type="checkbox" name="flightremainingroute" value="1" onclick="clickFlightRemainingRoute(this)" <?php if ((isset($_COOKIE['MapRemainingRoute']) && $_COOKIE['MapRemainingRoute'] == 'true') || (!isset($_COOKIE['MapRemainingRoute']) && isset($globalMapRemainingRoute) && $globalMapRemainingRoute)) print 'checked'; ?> ><?php echo _("Display flight remaining route on click"); ?></label></div></li> |
|
428 | - <li><div class="checkbox"><label><input type="checkbox" name="flightestimation" value="1" onclick="clickFlightEstimation(this)" <?php if ((isset($_COOKIE['flightestimation']) && $_COOKIE['flightestimation'] == 'true') || (!isset($_COOKIE['flightestimation']) && !isset($globalMapEstimation)) || (!isset($_COOKIE['flightestimation']) && isset($globalMapEstimation) && $globalMapEstimation)) print 'checked'; ?> ><?php echo _("Planes animate between updates"); ?></label></div></li> |
|
613 | + <!--<li><div class="checkbox"><label><input type="checkbox" name="flightpopup" value="1" onclick="clickFlightPopup(this)" <?php if (isset($_COOKIE['flightpopup']) && $_COOKIE['flightpopup'] == 'true') { |
|
614 | + print 'checked'; |
|
615 | +} |
|
616 | +?> ><?php echo _("Display flight info as popup"); ?></label></div></li>--> |
|
617 | + <li><div class="checkbox"><label><input type="checkbox" name="flightpath" value="1" onclick="clickFlightPath(this)" <?php if ((isset($_COOKIE['flightpath']) && $_COOKIE['flightpath'] == 'true')) { |
|
618 | + print 'checked'; |
|
619 | +} |
|
620 | +?> ><?php echo _("Display flight path"); ?></label></div></li> |
|
621 | + <li><div class="checkbox"><label><input type="checkbox" name="flightroute" value="1" onclick="clickFlightRoute(this)" <?php if ((isset($_COOKIE['MapRoute']) && $_COOKIE['MapRoute'] == 'true') || (!isset($_COOKIE['MapRoute']) && isset($globalMapRoute) && $globalMapRoute)) { |
|
622 | + print 'checked'; |
|
623 | +} |
|
624 | +?> ><?php echo _("Display flight route on click"); ?></label></div></li> |
|
625 | + <li><div class="checkbox"><label><input type="checkbox" name="flightremainingroute" value="1" onclick="clickFlightRemainingRoute(this)" <?php if ((isset($_COOKIE['MapRemainingRoute']) && $_COOKIE['MapRemainingRoute'] == 'true') || (!isset($_COOKIE['MapRemainingRoute']) && isset($globalMapRemainingRoute) && $globalMapRemainingRoute)) { |
|
626 | + print 'checked'; |
|
627 | +} |
|
628 | +?> ><?php echo _("Display flight remaining route on click"); ?></label></div></li> |
|
629 | + <li><div class="checkbox"><label><input type="checkbox" name="flightestimation" value="1" onclick="clickFlightEstimation(this)" <?php if ((isset($_COOKIE['flightestimation']) && $_COOKIE['flightestimation'] == 'true') || (!isset($_COOKIE['flightestimation']) && !isset($globalMapEstimation)) || (!isset($_COOKIE['flightestimation']) && isset($globalMapEstimation) && $globalMapEstimation)) { |
|
630 | + print 'checked'; |
|
631 | +} |
|
632 | +?> ><?php echo _("Planes animate between updates"); ?></label></div></li> |
|
429 | 633 | <?php |
430 | 634 | } elseif (!isset($globalTracker) || $globalTracker === TRUE) { |
431 | 635 | ?> |
432 | - <li><div class="checkbox"><label><input type="checkbox" name="mapmatching" value="1" onclick="clickMapMatching(this)" <?php if ((isset($_COOKIE['mapmatching']) && $_COOKIE['mapmatching'] == 'true') || (!isset($_COOKIE['mapmatching']) && isset($globalMapMatching) && $globalMapMatching)) print 'checked'; ?> ><?php echo _("Enable map matching"); ?></label></div></li> |
|
636 | + <li><div class="checkbox"><label><input type="checkbox" name="mapmatching" value="1" onclick="clickMapMatching(this)" <?php if ((isset($_COOKIE['mapmatching']) && $_COOKIE['mapmatching'] == 'true') || (!isset($_COOKIE['mapmatching']) && isset($globalMapMatching) && $globalMapMatching)) { |
|
637 | + print 'checked'; |
|
638 | +} |
|
639 | +?> ><?php echo _("Enable map matching"); ?></label></div></li> |
|
433 | 640 | <?php |
434 | 641 | } |
435 | 642 | if (isset($globalSatellite) && $globalSatellite === TRUE) { |
436 | 643 | ?> |
437 | - <li><div class="checkbox"><label><input type="checkbox" name="satelliteestimation" value="1" onclick="clickSatelliteEstimation(this)" <?php if ((isset($_COOKIE['satelliteestimation']) && $_COOKIE['satelliteestimation'] == 'true') || (!isset($_COOKIE['satelliteestimation']) && !isset($globalMapEstimation)) || (!isset($_COOKIE['satelliteestimation']) && isset($globalMapEstimation) && $globalMapEstimation)) print 'checked'; ?> ><?php echo _("Satellites animate between updates"); ?></label></div></li> |
|
644 | + <li><div class="checkbox"><label><input type="checkbox" name="satelliteestimation" value="1" onclick="clickSatelliteEstimation(this)" <?php if ((isset($_COOKIE['satelliteestimation']) && $_COOKIE['satelliteestimation'] == 'true') || (!isset($_COOKIE['satelliteestimation']) && !isset($globalMapEstimation)) || (!isset($_COOKIE['satelliteestimation']) && isset($globalMapEstimation) && $globalMapEstimation)) { |
|
645 | + print 'checked'; |
|
646 | +} |
|
647 | +?> ><?php echo _("Satellites animate between updates"); ?></label></div></li> |
|
438 | 648 | <?php |
439 | 649 | } |
440 | 650 | } |
441 | 651 | ?> |
442 | - <li><div class="checkbox"><label><input type="checkbox" name="displayairports" value="1" onclick="clickDisplayAirports(this)" <?php if (isset($_COOKIE['displayairports']) && $_COOKIE['displayairports'] == 'true' || !isset($_COOKIE['displayairports'])) print 'checked'; ?> ><?php echo _("Display airports on map"); ?></label></div></li> |
|
443 | - <li><div class="checkbox"><label><input type="checkbox" name="displaygroundstation" value="1" onclick="clickDisplayGroundStation(this)" <?php if ((isset($_COOKIE['show_GroundStation']) && $_COOKIE['show_GroundStation'] == 'true') || (!isset($_COOKIE['show_GroundStation']) && (isset($globalMapGroundStation) && $globalMapGroundStation === TRUE))) print 'checked'; ?> ><?php echo _("Display ground station on map"); ?></label></div></li> |
|
444 | - <li><div class="checkbox"><label><input type="checkbox" name="displayweatherstation" value="1" onclick="clickDisplayWeatherStation(this)" <?php if ((isset($_COOKIE['show_WeatherStation']) && $_COOKIE['show_WeatherStation'] == 'true') || (!isset($_COOKIE['show_WeatherStation']) && (isset($globalMapWeatherStation) && $globalMapWeatherStation === TRUE))) print 'checked'; ?> ><?php echo _("Display weather station on map"); ?></label></div></li> |
|
652 | + <li><div class="checkbox"><label><input type="checkbox" name="displayairports" value="1" onclick="clickDisplayAirports(this)" <?php if (isset($_COOKIE['displayairports']) && $_COOKIE['displayairports'] == 'true' || !isset($_COOKIE['displayairports'])) { |
|
653 | + print 'checked'; |
|
654 | +} |
|
655 | +?> ><?php echo _("Display airports on map"); ?></label></div></li> |
|
656 | + <li><div class="checkbox"><label><input type="checkbox" name="displaygroundstation" value="1" onclick="clickDisplayGroundStation(this)" <?php if ((isset($_COOKIE['show_GroundStation']) && $_COOKIE['show_GroundStation'] == 'true') || (!isset($_COOKIE['show_GroundStation']) && (isset($globalMapGroundStation) && $globalMapGroundStation === TRUE))) { |
|
657 | + print 'checked'; |
|
658 | +} |
|
659 | +?> ><?php echo _("Display ground station on map"); ?></label></div></li> |
|
660 | + <li><div class="checkbox"><label><input type="checkbox" name="displayweatherstation" value="1" onclick="clickDisplayWeatherStation(this)" <?php if ((isset($_COOKIE['show_WeatherStation']) && $_COOKIE['show_WeatherStation'] == 'true') || (!isset($_COOKIE['show_WeatherStation']) && (isset($globalMapWeatherStation) && $globalMapWeatherStation === TRUE))) { |
|
661 | + print 'checked'; |
|
662 | +} |
|
663 | +?> ><?php echo _("Display weather station on map"); ?></label></div></li> |
|
445 | 664 | <?php |
446 | 665 | if (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d' && isset($globalMETAR) && isset($globalMETARcycle) && $globalMETAR && $globalMETARcycle) { |
447 | 666 | ?> |
448 | - <li><div class="checkbox"><label><input type="checkbox" name="displayweather" value="1" onclick="clickDisplayWeather(this)" <?php if ((isset($_COOKIE['show_Weather']) && $_COOKIE['show_Weather'] == 'true') || (!isset($_COOKIE['show_Weather']) && (isset($globalMapWeather) && $globalMapWeather === TRUE))) print 'checked'; ?> ><?php echo _("Display weather on 3D map"); ?></label></div></li> |
|
667 | + <li><div class="checkbox"><label><input type="checkbox" name="displayweather" value="1" onclick="clickDisplayWeather(this)" <?php if ((isset($_COOKIE['show_Weather']) && $_COOKIE['show_Weather'] == 'true') || (!isset($_COOKIE['show_Weather']) && (isset($globalMapWeather) && $globalMapWeather === TRUE))) { |
|
668 | + print 'checked'; |
|
669 | +} |
|
670 | +?> ><?php echo _("Display weather on 3D map"); ?></label></div></li> |
|
449 | 671 | <?php |
450 | 672 | } |
451 | 673 | ?> |
452 | - <li><div class="checkbox"><label><input type="checkbox" name="displaylightning" value="1" onclick="clickDisplayLightning(this)" <?php if ((isset($_COOKIE['show_Lightning']) && $_COOKIE['show_Lightning'] == 'true') || (!isset($_COOKIE['show_Lightning']) && (isset($globalMapLightning) && $globalMapLightning === TRUE))) print 'checked'; ?> ><?php echo _("Display lightning on map"); ?></label></div></li> |
|
674 | + <li><div class="checkbox"><label><input type="checkbox" name="displaylightning" value="1" onclick="clickDisplayLightning(this)" <?php if ((isset($_COOKIE['show_Lightning']) && $_COOKIE['show_Lightning'] == 'true') || (!isset($_COOKIE['show_Lightning']) && (isset($globalMapLightning) && $globalMapLightning === TRUE))) { |
|
675 | + print 'checked'; |
|
676 | +} |
|
677 | +?> ><?php echo _("Display lightning on map"); ?></label></div></li> |
|
453 | 678 | <?php |
454 | 679 | if (isset($globalFires)) { |
455 | 680 | ?> |
456 | - <li><div class="checkbox"><label><input type="checkbox" name="displayfires" value="1" onclick="clickDisplayFires(this)" <?php if ((isset($_COOKIE['show_Fires']) && $_COOKIE['show_Fires'] == 'true') || (!isset($_COOKIE['show_Fires']) && (isset($globalMapFires) && $globalMapFires === TRUE))) print 'checked'; ?> ><?php echo _("Display fires on map"); ?></label></div></li> |
|
681 | + <li><div class="checkbox"><label><input type="checkbox" name="displayfires" value="1" onclick="clickDisplayFires(this)" <?php if ((isset($_COOKIE['show_Fires']) && $_COOKIE['show_Fires'] == 'true') || (!isset($_COOKIE['show_Fires']) && (isset($globalMapFires) && $globalMapFires === TRUE))) { |
|
682 | + print 'checked'; |
|
683 | +} |
|
684 | +?> ><?php echo _("Display fires on map"); ?></label></div></li> |
|
457 | 685 | <?php |
458 | 686 | } |
459 | 687 | if (isset($globalMap3D) && $globalMap3D) { |
460 | 688 | ?> |
461 | - <li><div class="checkbox"><label><input type="checkbox" name="singlemodel" value="1" onclick="clickSingleModel(this)" <?php if (isset($_COOKIE['singlemodel']) && $_COOKIE['singlemodel'] == 'true') print 'checked'; ?> ><?php echo _("Only display selected flight on 3D mode"); ?></label></div></li> |
|
689 | + <li><div class="checkbox"><label><input type="checkbox" name="singlemodel" value="1" onclick="clickSingleModel(this)" <?php if (isset($_COOKIE['singlemodel']) && $_COOKIE['singlemodel'] == 'true') { |
|
690 | + print 'checked'; |
|
691 | +} |
|
692 | +?> ><?php echo _("Only display selected flight on 3D mode"); ?></label></div></li> |
|
462 | 693 | <?php |
463 | 694 | } |
464 | 695 | ?> |
465 | 696 | <?php |
466 | 697 | if (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d') { |
467 | 698 | ?> |
468 | - <li><div class="checkbox"><label><input type="checkbox" name="displayminimap" value="1" onclick="clickDisplayMinimap(this)" <?php if (!isset($_COOKIE['displayminimap']) || (isset($_COOKIE['displayminimap']) && $_COOKIE['displayminimap'] == 'true')) print 'checked'; ?> ><?php echo _("Show mini-map"); ?></label></div></li> |
|
469 | - <li><div class="checkbox"><label><input type="checkbox" name="shadows" value="1" onclick="clickShadows(this)" <?php if ((!isset($_COOKIE['map3dnoshadows']) && (!isset($globalMap3DShadows) || $globalMap3DShadows)) || (isset($_COOKIE['map3dnoshadows']) && $_COOKIE['map3dnoshadows'] == 'false')) print 'checked'; ?> ><?php echo _("Use shadows"); ?></label></div></li> |
|
470 | - <li><div class="checkbox"><label><input type="checkbox" name="one3dmodel" value="1" onclick="useOne3Dmodel(this)" <?php if ((isset($_COOKIE['one3dmodel']) && $_COOKIE['one3dmodel'] == 'true') || (!isset($_COOKIE['one3dmodel']) && isset($globalMap3DOneModel) && $globalMap3DOneModel)) print 'checked'; ?> ><?php echo _("Use same 3D model for all aircraft (use fewer resources)"); ?></label></div></li> |
|
471 | - <li><div class="checkbox"><label><input type="checkbox" name="updaterealtime" value="1" onclick="clickUpdateRealtime(this)" <?php if ((isset($_COOKIE['updaterealtime']) && $_COOKIE['updaterealtime'] == 'true') || !isset($_COOKIE['updaterealtime'])) print 'checked'; ?> ><?php echo _("Display realtime data in infobox"); ?></label></div></li> |
|
699 | + <li><div class="checkbox"><label><input type="checkbox" name="displayminimap" value="1" onclick="clickDisplayMinimap(this)" <?php if (!isset($_COOKIE['displayminimap']) || (isset($_COOKIE['displayminimap']) && $_COOKIE['displayminimap'] == 'true')) { |
|
700 | + print 'checked'; |
|
701 | +} |
|
702 | +?> ><?php echo _("Show mini-map"); ?></label></div></li> |
|
703 | + <li><div class="checkbox"><label><input type="checkbox" name="shadows" value="1" onclick="clickShadows(this)" <?php if ((!isset($_COOKIE['map3dnoshadows']) && (!isset($globalMap3DShadows) || $globalMap3DShadows)) || (isset($_COOKIE['map3dnoshadows']) && $_COOKIE['map3dnoshadows'] == 'false')) { |
|
704 | + print 'checked'; |
|
705 | +} |
|
706 | +?> ><?php echo _("Use shadows"); ?></label></div></li> |
|
707 | + <li><div class="checkbox"><label><input type="checkbox" name="one3dmodel" value="1" onclick="useOne3Dmodel(this)" <?php if ((isset($_COOKIE['one3dmodel']) && $_COOKIE['one3dmodel'] == 'true') || (!isset($_COOKIE['one3dmodel']) && isset($globalMap3DOneModel) && $globalMap3DOneModel)) { |
|
708 | + print 'checked'; |
|
709 | +} |
|
710 | +?> ><?php echo _("Use same 3D model for all aircraft (use fewer resources)"); ?></label></div></li> |
|
711 | + <li><div class="checkbox"><label><input type="checkbox" name="updaterealtime" value="1" onclick="clickUpdateRealtime(this)" <?php if ((isset($_COOKIE['updaterealtime']) && $_COOKIE['updaterealtime'] == 'true') || !isset($_COOKIE['updaterealtime'])) { |
|
712 | + print 'checked'; |
|
713 | +} |
|
714 | +?> ><?php echo _("Display realtime data in infobox"); ?></label></div></li> |
|
472 | 715 | <?php |
473 | 716 | } |
474 | 717 | if (time() > mktime(0,0,0,12,1,date("Y")) && time() < mktime(0,0,0,12,31,date("Y"))) { |
@@ -481,17 +724,25 @@ discard block |
||
481 | 724 | if (function_exists('array_column')) { |
482 | 725 | if (array_search(TRUE, array_column($globalSources, 'sourcestats')) !== FALSE) { |
483 | 726 | ?> |
484 | - <li><div class="checkbox"><label><input type="checkbox" name="flightpolar" value="1" onclick="clickPolar(this)" <?php if ((isset($_COOKIE['polar']) && $_COOKIE['polar'] == 'true')) print 'checked'; ?> ><?php echo _("Display polar on map"); ?></label></div></li> |
|
727 | + <li><div class="checkbox"><label><input type="checkbox" name="flightpolar" value="1" onclick="clickPolar(this)" <?php if ((isset($_COOKIE['polar']) && $_COOKIE['polar'] == 'true')) { |
|
728 | + print 'checked'; |
|
729 | +} |
|
730 | +?> ><?php echo _("Display polar on map"); ?></label></div></li> |
|
485 | 731 | <?php |
486 | 732 | } |
487 | 733 | } elseif (isset($globalSources)) { |
488 | 734 | $dispolar = false; |
489 | 735 | foreach ($globalSources as $testsource) { |
490 | - if (isset($globalSources['sourcestats']) && $globalSources['sourcestats'] !== FALSE) $dispolar = true; |
|
736 | + if (isset($globalSources['sourcestats']) && $globalSources['sourcestats'] !== FALSE) { |
|
737 | + $dispolar = true; |
|
738 | + } |
|
491 | 739 | } |
492 | 740 | if ($dispolar) { |
493 | 741 | ?> |
494 | - <li><div class="checkbox"><label><input type="checkbox" name="flightpolar" value="1" onclick="clickPolar(this)" <?php if ((isset($_COOKIE['polar']) && $_COOKIE['polar'] == 'true')) print 'checked'; ?> ><?php echo _("Display polar on map"); ?></label></div></li> |
|
742 | + <li><div class="checkbox"><label><input type="checkbox" name="flightpolar" value="1" onclick="clickPolar(this)" <?php if ((isset($_COOKIE['polar']) && $_COOKIE['polar'] == 'true')) { |
|
743 | + print 'checked'; |
|
744 | +} |
|
745 | +?> ><?php echo _("Display polar on map"); ?></label></div></li> |
|
495 | 746 | <?php |
496 | 747 | } |
497 | 748 | } |
@@ -504,11 +755,21 @@ discard block |
||
504 | 755 | if (!isset($globalAircraft) || $globalAircraft === TRUE) { |
505 | 756 | if (extension_loaded('gd') && function_exists('gd_info')) { |
506 | 757 | ?> |
507 | - <li><input type="checkbox" name="aircraftcoloraltitude" value="1" onclick="iconColorAltitude(this)" <?php if (isset($_COOKIE['IconColorAltitude']) && $_COOKIE['IconColorAltitude'] == 'true') print 'checked'; ?> ><?php echo _("Aircraft icon color based on altitude"); ?></li> |
|
758 | + <li><input type="checkbox" name="aircraftcoloraltitude" value="1" onclick="iconColorAltitude(this)" <?php if (isset($_COOKIE['IconColorAltitude']) && $_COOKIE['IconColorAltitude'] == 'true') { |
|
759 | + print 'checked'; |
|
760 | +} |
|
761 | +?> ><?php echo _("Aircraft icon color based on altitude"); ?></li> |
|
508 | 762 | <?php |
509 | 763 | if (!isset($_COOKIE['IconColorAltitude']) || $_COOKIE['IconColorAltitude'] == 'false') { |
510 | 764 | ?> |
511 | - <li><?php echo _("Aircraft icon color:"); ?><input type="color" name="aircraftcolor" id="html5colorpicker" onchange="iconColor(aircraftcolor.value);" value="#<?php if (isset($_COOKIE['IconColor'])) print $_COOKIE['IconColor']; elseif (isset($globalAircraftIconColor)) print $globalAircraftIconColor; else print '1a3151'; ?>"></li> |
|
765 | + <li><?php echo _("Aircraft icon color:"); ?><input type="color" name="aircraftcolor" id="html5colorpicker" onchange="iconColor(aircraftcolor.value);" value="#<?php if (isset($_COOKIE['IconColor'])) { |
|
766 | + print $_COOKIE['IconColor']; |
|
767 | +} elseif (isset($globalAircraftIconColor)) { |
|
768 | + print $globalAircraftIconColor; |
|
769 | +} else { |
|
770 | + print '1a3151'; |
|
771 | +} |
|
772 | +?>"></li> |
|
512 | 773 | <?php |
513 | 774 | } |
514 | 775 | } |
@@ -519,7 +780,14 @@ discard block |
||
519 | 780 | if (extension_loaded('gd') && function_exists('gd_info')) { |
520 | 781 | ?> |
521 | 782 | <li><?php echo _("Marine icon color:"); ?> |
522 | - <input type="color" name="marinecolor" id="html5colorpicker" onchange="MarineiconColor(marinecolor.value);" value="#<?php if (isset($_COOKIE['MarineIconColor'])) print $_COOKIE['MarineIconColor']; elseif (isset($globalMarineIconColor)) print $globalMarineIconColor; else print '1a3151'; ?>"> |
|
783 | + <input type="color" name="marinecolor" id="html5colorpicker" onchange="MarineiconColor(marinecolor.value);" value="#<?php if (isset($_COOKIE['MarineIconColor'])) { |
|
784 | + print $_COOKIE['MarineIconColor']; |
|
785 | +} elseif (isset($globalMarineIconColor)) { |
|
786 | + print $globalMarineIconColor; |
|
787 | +} else { |
|
788 | + print '1a3151'; |
|
789 | +} |
|
790 | +?>"> |
|
523 | 791 | </li> |
524 | 792 | <?php |
525 | 793 | } |
@@ -530,7 +798,14 @@ discard block |
||
530 | 798 | if (extension_loaded('gd') && function_exists('gd_info')) { |
531 | 799 | ?> |
532 | 800 | <li><?php echo _("Tracker icon color:"); ?> |
533 | - <input type="color" name="trackercolor" id="html5colorpicker" onchange="TrackericonColor(trackercolor.value);" value="#<?php if (isset($_COOKIE['TrackerIconColor'])) print $_COOKIE['TrackerIconColor']; elseif (isset($globalTrackerIconColor)) print $globalTrackerIconColor; else print '1a3151'; ?>"> |
|
801 | + <input type="color" name="trackercolor" id="html5colorpicker" onchange="TrackericonColor(trackercolor.value);" value="#<?php if (isset($_COOKIE['TrackerIconColor'])) { |
|
802 | + print $_COOKIE['TrackerIconColor']; |
|
803 | +} elseif (isset($globalTrackerIconColor)) { |
|
804 | + print $globalTrackerIconColor; |
|
805 | +} else { |
|
806 | + print '1a3151'; |
|
807 | +} |
|
808 | +?>"> |
|
534 | 809 | </li> |
535 | 810 | <?php |
536 | 811 | } |
@@ -541,8 +816,22 @@ discard block |
||
541 | 816 | ?> |
542 | 817 | <li><?php echo _("Show airport icon at zoom level:"); ?> |
543 | 818 | <div class="range"> |
544 | - <input type="range" min="0" max="19" step="1" name="airportzoom" onchange="range.value=value;airportDisplayZoom(airportzoom.value);" value="<?php if (isset($_COOKIE['AirportZoom'])) print $_COOKIE['AirportZoom']; elseif (isset($globalAirportZoom)) print $globalAirportZoom; else print '7'; ?>"> |
|
545 | - <output id="range"><?php if (isset($_COOKIE['AirportZoom'])) print $_COOKIE['AirportZoom']; elseif (isset($globalAirportZoom)) print $globalAirportZoom; else print '7'; ?></output> |
|
819 | + <input type="range" min="0" max="19" step="1" name="airportzoom" onchange="range.value=value;airportDisplayZoom(airportzoom.value);" value="<?php if (isset($_COOKIE['AirportZoom'])) { |
|
820 | + print $_COOKIE['AirportZoom']; |
|
821 | +} elseif (isset($globalAirportZoom)) { |
|
822 | + print $globalAirportZoom; |
|
823 | +} else { |
|
824 | + print '7'; |
|
825 | +} |
|
826 | +?>"> |
|
827 | + <output id="range"><?php if (isset($_COOKIE['AirportZoom'])) { |
|
828 | + print $_COOKIE['AirportZoom']; |
|
829 | +} elseif (isset($globalAirportZoom)) { |
|
830 | + print $globalAirportZoom; |
|
831 | +} else { |
|
832 | + print '7'; |
|
833 | +} |
|
834 | +?></output> |
|
546 | 835 | </div> |
547 | 836 | </li> |
548 | 837 | <?php |
@@ -553,17 +842,40 @@ discard block |
||
553 | 842 | ?> |
554 | 843 | <li><?php echo _("Set scaling factor for rendering resolution:"); ?> |
555 | 844 | <div class="range"> |
556 | - <input type="range" min="0.5" max="2" step="0.5" name="resolutionscale" onchange="scale.value=value;resolutionScale(resolutionscale.value);" value="<?php if (isset($_COOKIE['resolutionScale'])) print $_COOKIE['resolutionScale']; else print '1'; ?>"> |
|
557 | - <output id="scale"><?php if (isset($_COOKIE['resolutionScale'])) print $_COOKIE['resolutionScale']; else print '1'; ?></output> |
|
845 | + <input type="range" min="0.5" max="2" step="0.5" name="resolutionscale" onchange="scale.value=value;resolutionScale(resolutionscale.value);" value="<?php if (isset($_COOKIE['resolutionScale'])) { |
|
846 | + print $_COOKIE['resolutionScale']; |
|
847 | +} else { |
|
848 | + print '1'; |
|
849 | +} |
|
850 | +?>"> |
|
851 | + <output id="scale"><?php if (isset($_COOKIE['resolutionScale'])) { |
|
852 | + print $_COOKIE['resolutionScale']; |
|
853 | +} else { |
|
854 | + print '1'; |
|
855 | +} |
|
856 | +?></output> |
|
558 | 857 | </div> |
559 | 858 | </li> |
560 | 859 | <?php |
561 | 860 | if (!isset($globalAircraft) || $globalAircraft === TRUE) { |
562 | 861 | ?> |
563 | - <li><input type="checkbox" name="useliveries" value="1" onclick="useLiveries(this)" <?php if (isset($_COOKIE['UseLiveries']) && $_COOKIE['UseLiveries'] == 'true') print 'checked'; ?> > <?php echo _("Use airlines liveries"); ?></li> |
|
564 | - <li><input type="checkbox" name="aircraftcolorforce" value="1" onclick="iconColorForce(this)" <?php if (isset($_COOKIE['IconColorForce']) && $_COOKIE['IconColorForce'] == 'true') print 'checked'; ?> > <?php echo _("Force Aircraft color"); ?> |
|
862 | + <li><input type="checkbox" name="useliveries" value="1" onclick="useLiveries(this)" <?php if (isset($_COOKIE['UseLiveries']) && $_COOKIE['UseLiveries'] == 'true') { |
|
863 | + print 'checked'; |
|
864 | +} |
|
865 | +?> > <?php echo _("Use airlines liveries"); ?></li> |
|
866 | + <li><input type="checkbox" name="aircraftcolorforce" value="1" onclick="iconColorForce(this)" <?php if (isset($_COOKIE['IconColorForce']) && $_COOKIE['IconColorForce'] == 'true') { |
|
867 | + print 'checked'; |
|
868 | +} |
|
869 | +?> > <?php echo _("Force Aircraft color"); ?> |
|
565 | 870 | <!--<li><?php echo _("Aircraft icon color:"); ?>--> |
566 | - <input type="color" name="aircraftcolor" id="html5colorpicker" onchange="iconColor(aircraftcolor.value);" value="#<?php if (isset($_COOKIE['IconColor'])) print $_COOKIE['IconColor']; elseif (isset($globalAircraftIconColor)) print $globalAircraftIconColor; else print 'ff0000'; ?>"> |
|
871 | + <input type="color" name="aircraftcolor" id="html5colorpicker" onchange="iconColor(aircraftcolor.value);" value="#<?php if (isset($_COOKIE['IconColor'])) { |
|
872 | + print $_COOKIE['IconColor']; |
|
873 | +} elseif (isset($globalAircraftIconColor)) { |
|
874 | + print $globalAircraftIconColor; |
|
875 | +} else { |
|
876 | + print 'ff0000'; |
|
877 | +} |
|
878 | +?>"> |
|
567 | 879 | </li> |
568 | 880 | <?php |
569 | 881 | } |
@@ -571,9 +883,19 @@ discard block |
||
571 | 883 | <?php |
572 | 884 | if (isset($globalMarine) && $globalMarine === TRUE) { |
573 | 885 | ?> |
574 | - <li><input type="checkbox" name="marinecolorforce" value="1" onclick="MarineiconColorForce(this)" <?php if (isset($_COOKIE['MarineIconColorForce']) && $_COOKIE['MarineIconColorForce'] == 'true') print 'checked'; ?> ><?php echo _("Force Marine color"); ?> |
|
886 | + <li><input type="checkbox" name="marinecolorforce" value="1" onclick="MarineiconColorForce(this)" <?php if (isset($_COOKIE['MarineIconColorForce']) && $_COOKIE['MarineIconColorForce'] == 'true') { |
|
887 | + print 'checked'; |
|
888 | +} |
|
889 | +?> ><?php echo _("Force Marine color"); ?> |
|
575 | 890 | <!--<li><?php echo _("Marine icon color:"); ?>--> |
576 | - <input type="color" name="marinecolor" id="html5colorpicker" onchange="MarineiconColor(marinecolor.value);" value="#<?php if (isset($_COOKIE['MarineIconColor'])) print $_COOKIE['MarineIconColor']; elseif (isset($globalMarineIconColor)) print $globalMarineIconColor; else print 'ff0000'; ?>"> |
|
891 | + <input type="color" name="marinecolor" id="html5colorpicker" onchange="MarineiconColor(marinecolor.value);" value="#<?php if (isset($_COOKIE['MarineIconColor'])) { |
|
892 | + print $_COOKIE['MarineIconColor']; |
|
893 | +} elseif (isset($globalMarineIconColor)) { |
|
894 | + print $globalMarineIconColor; |
|
895 | +} else { |
|
896 | + print 'ff0000'; |
|
897 | +} |
|
898 | +?>"> |
|
577 | 899 | </li> |
578 | 900 | <?php |
579 | 901 | } |
@@ -581,9 +903,19 @@ discard block |
||
581 | 903 | <?php |
582 | 904 | if (isset($globalTracker) && $globalTracker === TRUE) { |
583 | 905 | ?> |
584 | - <li><input type="checkbox" name="trackercolorforce" value="1" onclick="TrackericonColorForce(this)" <?php if (isset($_COOKIE['TrackerIconColorForce']) && $_COOKIE['TrackerIconColorForce'] == 'true') print 'checked'; ?> ><?php echo _("Force Tracker color"); ?> |
|
906 | + <li><input type="checkbox" name="trackercolorforce" value="1" onclick="TrackericonColorForce(this)" <?php if (isset($_COOKIE['TrackerIconColorForce']) && $_COOKIE['TrackerIconColorForce'] == 'true') { |
|
907 | + print 'checked'; |
|
908 | +} |
|
909 | +?> ><?php echo _("Force Tracker color"); ?> |
|
585 | 910 | <!--<li><?php echo _("Tracker icon color:"); ?>--> |
586 | - <input type="color" name="trackercolor" id="html5colorpicker" onchange="TrackericonColor(trackercolor.value);" value="#<?php if (isset($_COOKIE['TrackerIconColor'])) print $_COOKIE['TrackerIconColor']; elseif (isset($globalTrackerIconColor)) print $globalTrackerIconColor; else print 'ff0000'; ?>"> |
|
911 | + <input type="color" name="trackercolor" id="html5colorpicker" onchange="TrackericonColor(trackercolor.value);" value="#<?php if (isset($_COOKIE['TrackerIconColor'])) { |
|
912 | + print $_COOKIE['TrackerIconColor']; |
|
913 | +} elseif (isset($globalTrackerIconColor)) { |
|
914 | + print $globalTrackerIconColor; |
|
915 | +} else { |
|
916 | + print 'ff0000'; |
|
917 | +} |
|
918 | +?>"> |
|
587 | 919 | </li> |
588 | 920 | <?php |
589 | 921 | } |
@@ -591,22 +923,46 @@ discard block |
||
591 | 923 | ?> |
592 | 924 | <li><?php echo _("Distance unit:"); ?> |
593 | 925 | <select class="selectpicker" onchange="unitdistance(this);"> |
594 | - <option value="km"<?php if ((!isset($_COOKIE['unitdistance']) && (!isset($globalUnitDistance) || (isset($globalUnitDistance) && $globalUnitDistance == 'km'))) || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'km')) echo ' selected'; ?>>km</option> |
|
595 | - <option value="nm"<?php if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'nm') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'nm')) echo ' selected'; ?>>nm</option> |
|
596 | - <option value="mi"<?php if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'mi') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'mi')) echo ' selected'; ?>>mi</option> |
|
926 | + <option value="km"<?php if ((!isset($_COOKIE['unitdistance']) && (!isset($globalUnitDistance) || (isset($globalUnitDistance) && $globalUnitDistance == 'km'))) || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'km')) { |
|
927 | + echo ' selected'; |
|
928 | +} |
|
929 | +?>>km</option> |
|
930 | + <option value="nm"<?php if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'nm') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'nm')) { |
|
931 | + echo ' selected'; |
|
932 | +} |
|
933 | +?>>nm</option> |
|
934 | + <option value="mi"<?php if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'mi') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'mi')) { |
|
935 | + echo ' selected'; |
|
936 | +} |
|
937 | +?>>mi</option> |
|
597 | 938 | </select> |
598 | 939 | </li> |
599 | 940 | <li><?php echo _("Altitude unit:"); ?> |
600 | 941 | <select class="selectpicker" onchange="unitaltitude(this);"> |
601 | - <option value="m"<?php if ((!isset($_COOKIE['unitaltitude']) && (!isset($globalUnitAltitude) || (isset($globalUnitAltitude) && $globalUnitAltitude == 'm'))) || (isset($_COOKIE['unitaltitude']) && $_COOKIE['unitaltitude'] == 'm')) echo ' selected'; ?>>m</option> |
|
602 | - <option value="feet"<?php if ((!isset($_COOKIE['unitaltitude']) && isset($globalUnitAltitude) && $globalUnitAltitude == 'feet') || (isset($_COOKIE['unitaltitude']) && $_COOKIE['unitaltitude'] == 'feet')) echo ' selected'; ?>>feet</option> |
|
942 | + <option value="m"<?php if ((!isset($_COOKIE['unitaltitude']) && (!isset($globalUnitAltitude) || (isset($globalUnitAltitude) && $globalUnitAltitude == 'm'))) || (isset($_COOKIE['unitaltitude']) && $_COOKIE['unitaltitude'] == 'm')) { |
|
943 | + echo ' selected'; |
|
944 | +} |
|
945 | +?>>m</option> |
|
946 | + <option value="feet"<?php if ((!isset($_COOKIE['unitaltitude']) && isset($globalUnitAltitude) && $globalUnitAltitude == 'feet') || (isset($_COOKIE['unitaltitude']) && $_COOKIE['unitaltitude'] == 'feet')) { |
|
947 | + echo ' selected'; |
|
948 | +} |
|
949 | +?>>feet</option> |
|
603 | 950 | </select> |
604 | 951 | </li> |
605 | 952 | <li><?php echo _("Speed unit:"); ?> |
606 | 953 | <select class="selectpicker" onchange="unitspeed(this);"> |
607 | - <option value="kmh"<?php if ((!isset($_COOKIE['unitspeed']) && (!isset($globalUnitSpeed) || (isset($globalUnitSpeed) && $globalUnitSpeed == 'kmh'))) || (isset($_COOKIE['unitspeed']) && $_COOKIE['unitspeed'] == 'kmh')) echo ' selected'; ?>>km/h</option> |
|
608 | - <option value="mph"<?php if ((!isset($_COOKIE['unitspeed']) && isset($globalUnitSpeed) && $globalUnitSpeed == 'mph') || (isset($_COOKIE['unitspeed']) && $_COOKIE['unitspeed'] == 'mph')) echo ' selected'; ?>>mph</option> |
|
609 | - <option value="knots"<?php if ((!isset($_COOKIE['unitspeed']) && isset($globalUnitSpeed) && $globalUnitSpeed == 'knots') || (isset($_COOKIE['unitspeed']) && $_COOKIE['unitspeed'] == 'knots')) echo ' selected'; ?>>knots</option> |
|
954 | + <option value="kmh"<?php if ((!isset($_COOKIE['unitspeed']) && (!isset($globalUnitSpeed) || (isset($globalUnitSpeed) && $globalUnitSpeed == 'kmh'))) || (isset($_COOKIE['unitspeed']) && $_COOKIE['unitspeed'] == 'kmh')) { |
|
955 | + echo ' selected'; |
|
956 | +} |
|
957 | +?>>km/h</option> |
|
958 | + <option value="mph"<?php if ((!isset($_COOKIE['unitspeed']) && isset($globalUnitSpeed) && $globalUnitSpeed == 'mph') || (isset($_COOKIE['unitspeed']) && $_COOKIE['unitspeed'] == 'mph')) { |
|
959 | + echo ' selected'; |
|
960 | +} |
|
961 | +?>>mph</option> |
|
962 | + <option value="knots"<?php if ((!isset($_COOKIE['unitspeed']) && isset($globalUnitSpeed) && $globalUnitSpeed == 'knots') || (isset($_COOKIE['unitspeed']) && $_COOKIE['unitspeed'] == 'knots')) { |
|
963 | + echo ' selected'; |
|
964 | +} |
|
965 | +?>>knots</option> |
|
610 | 966 | </select> |
611 | 967 | </li> |
612 | 968 | |
@@ -624,9 +980,18 @@ discard block |
||
624 | 980 | <?php |
625 | 981 | if (((isset($globalVATSIM) && $globalVATSIM) || isset($globalIVAO) && $globalIVAO || isset($globalphpVMS) && $globalphpVMS) && (!isset($globalMapVAchoose) || $globalMapVAchoose)) { |
626 | 982 | ?> |
627 | - <?php if (isset($globalVATSIM) && $globalVATSIM) { ?><li><input type="checkbox" name="vatsim" value="1" onclick="clickVATSIM(this)" <?php if ((isset($_COOKIE['ShowVATSIM']) && $_COOKIE['ShowVATSIM'] == 'true') || !isset($_COOKIE['ShowVATSIM'])) print 'checked'; ?> ><?php echo _("Display VATSIM data"); ?></li><?php } ?> |
|
628 | - <?php if (isset($globalIVAO) && $globalIVAO) { ?><li><input type="checkbox" name="ivao" value="1" onclick="clickIVAO(this)" <?php if ((isset($_COOKIE['ShowIVAO']) && $_COOKIE['ShowIVAO'] == 'true') || !isset($_COOKIE['ShowIVAO'])) print 'checked'; ?> ><?php echo _("Display IVAO data"); ?></li><?php } ?> |
|
629 | - <?php if (isset($globalphpVMS) && $globalphpVMS) { ?><li><input type="checkbox" name="phpvms" value="1" onclick="clickphpVMS(this)" <?php if ((isset($_COOKIE['ShowVMS']) && $_COOKIE['ShowVMS'] == 'true') || !isset($_COOKIE['ShowVMS'])) print 'checked'; ?> ><?php echo _("Display phpVMS data"); ?></li><?php } ?> |
|
983 | + <?php if (isset($globalVATSIM) && $globalVATSIM) { ?><li><input type="checkbox" name="vatsim" value="1" onclick="clickVATSIM(this)" <?php if ((isset($_COOKIE['ShowVATSIM']) && $_COOKIE['ShowVATSIM'] == 'true') || !isset($_COOKIE['ShowVATSIM'])) { |
|
984 | + print 'checked'; |
|
985 | +} |
|
986 | +?> ><?php echo _("Display VATSIM data"); ?></li><?php } ?> |
|
987 | + <?php if (isset($globalIVAO) && $globalIVAO) { ?><li><input type="checkbox" name="ivao" value="1" onclick="clickIVAO(this)" <?php if ((isset($_COOKIE['ShowIVAO']) && $_COOKIE['ShowIVAO'] == 'true') || !isset($_COOKIE['ShowIVAO'])) { |
|
988 | + print 'checked'; |
|
989 | +} |
|
990 | +?> ><?php echo _("Display IVAO data"); ?></li><?php } ?> |
|
991 | + <?php if (isset($globalphpVMS) && $globalphpVMS) { ?><li><input type="checkbox" name="phpvms" value="1" onclick="clickphpVMS(this)" <?php if ((isset($_COOKIE['ShowVMS']) && $_COOKIE['ShowVMS'] == 'true') || !isset($_COOKIE['ShowVMS'])) { |
|
992 | + print 'checked'; |
|
993 | +} |
|
994 | +?> ><?php echo _("Display phpVMS data"); ?></li><?php } ?> |
|
630 | 995 | <?php |
631 | 996 | } |
632 | 997 | ?> |
@@ -634,10 +999,16 @@ discard block |
||
634 | 999 | if (!(isset($globalVA) && $globalVA) && !(isset($globalVATSIM) && $globalVATSIM) && !(isset($globalIVAO) && $globalIVAO) && !(isset($globalphpVMS) && $globalphpVMS) && isset($globalSBS1) && $globalSBS1 && isset($globalAPRS) && $globalAPRS && (!isset($globalMapchoose) || $globalMapchoose)) { |
635 | 1000 | ?> |
636 | 1001 | <?php if (isset($globalSBS1) && $globalSBS1) { ?> |
637 | - <li><div class="checkbox"><label><input type="checkbox" name="sbs" value="1" onclick="clickSBS1(this)" <?php if ((isset($_COOKIE['ShowSBS1']) && $_COOKIE['ShowSBS1'] == 'true') || !isset($_COOKIE['ShowSBS1'])) print 'checked'; ?> ><?php echo _("Display ADS-B data"); ?></label></div></li> |
|
1002 | + <li><div class="checkbox"><label><input type="checkbox" name="sbs" value="1" onclick="clickSBS1(this)" <?php if ((isset($_COOKIE['ShowSBS1']) && $_COOKIE['ShowSBS1'] == 'true') || !isset($_COOKIE['ShowSBS1'])) { |
|
1003 | + print 'checked'; |
|
1004 | +} |
|
1005 | +?> ><?php echo _("Display ADS-B data"); ?></label></div></li> |
|
638 | 1006 | <?php } ?> |
639 | 1007 | <?php if (isset($globalAPRS) && $globalAPRS) { ?> |
640 | - <li><div class="checkbox"><label><input type="checkbox" name="aprs" value="1" onclick="clickAPRS(this)" <?php if ((isset($_COOKIE['ShowAPRS']) && $_COOKIE['ShowAPRS'] == 'true') || !isset($_COOKIE['ShowAPRS'])) print 'checked'; ?> ><?php echo _("Display APRS data"); ?></label></div></li> |
|
1008 | + <li><div class="checkbox"><label><input type="checkbox" name="aprs" value="1" onclick="clickAPRS(this)" <?php if ((isset($_COOKIE['ShowAPRS']) && $_COOKIE['ShowAPRS'] == 'true') || !isset($_COOKIE['ShowAPRS'])) { |
|
1009 | + print 'checked'; |
|
1010 | +} |
|
1011 | +?> ><?php echo _("Display APRS data"); ?></label></div></li> |
|
641 | 1012 | <?php } ?> |
642 | 1013 | <?php |
643 | 1014 | } |
@@ -654,7 +1025,9 @@ discard block |
||
654 | 1025 | } |
655 | 1026 | foreach($allairlinenames as $airline) { |
656 | 1027 | $airline_name = $airline['airline_name']; |
657 | - if (strlen($airline_name) > 30) $airline_name = substr($airline_name,0,30).'...'; |
|
1028 | + if (strlen($airline_name) > 30) { |
|
1029 | + $airline_name = substr($airline_name,0,30).'...'; |
|
1030 | + } |
|
658 | 1031 | if (isset($_COOKIE['filter_Airlines']) && in_array($airline['airline_icao'],explode(',',$_COOKIE['filter_Airlines']))) { |
659 | 1032 | echo '<option value="'.$airline['airline_icao'].'" selected>'.$airline_name.'</option>'; |
660 | 1033 | } else { |
@@ -672,7 +1045,10 @@ discard block |
||
672 | 1045 | <li><?php echo _("Display alliance:"); ?> |
673 | 1046 | <br/> |
674 | 1047 | <select class="selectpicker" onchange="alliance(this);" id="display_alliance"> |
675 | - <option value="all"<?php if (!isset($_COOKIE['filter_alliance']) || $_COOKIE['filter_alliance'] == 'all' || $_COOKIE['filter_alliance'] == '') echo ' selected'; ?>><?php echo _("All"); ?></option> |
|
1048 | + <option value="all"<?php if (!isset($_COOKIE['filter_alliance']) || $_COOKIE['filter_alliance'] == 'all' || $_COOKIE['filter_alliance'] == '') { |
|
1049 | + echo ' selected'; |
|
1050 | +} |
|
1051 | +?>><?php echo _("All"); ?></option> |
|
676 | 1052 | <?php |
677 | 1053 | foreach($allalliancenames as $alliance) { |
678 | 1054 | $alliance_name = $alliance['alliance']; |
@@ -731,10 +1107,22 @@ discard block |
||
731 | 1107 | ?> |
732 | 1108 | <li><?php echo _("Display airlines of type:"); ?><br/> |
733 | 1109 | <select class="selectpicker" onchange="airlinestype(this);"> |
734 | - <option value="all"<?php if (!isset($_COOKIE['filter_airlinestype']) || $_COOKIE['filter_airlinestype'] == 'all' || $_COOKIE['filter_airlinestype'] == '') echo ' selected'; ?>><?php echo _("All"); ?></option> |
|
735 | - <option value="passenger"<?php if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] == 'passenger') echo ' selected'; ?>><?php echo _("Passenger"); ?></option> |
|
736 | - <option value="cargo"<?php if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] == 'cargo') echo ' selected'; ?>><?php echo _("Cargo"); ?></option> |
|
737 | - <option value="military"<?php if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] == 'military') echo ' selected'; ?>><?php echo _("Military"); ?></option> |
|
1110 | + <option value="all"<?php if (!isset($_COOKIE['filter_airlinestype']) || $_COOKIE['filter_airlinestype'] == 'all' || $_COOKIE['filter_airlinestype'] == '') { |
|
1111 | + echo ' selected'; |
|
1112 | +} |
|
1113 | +?>><?php echo _("All"); ?></option> |
|
1114 | + <option value="passenger"<?php if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] == 'passenger') { |
|
1115 | + echo ' selected'; |
|
1116 | +} |
|
1117 | +?>><?php echo _("Passenger"); ?></option> |
|
1118 | + <option value="cargo"<?php if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] == 'cargo') { |
|
1119 | + echo ' selected'; |
|
1120 | +} |
|
1121 | +?>><?php echo _("Cargo"); ?></option> |
|
1122 | + <option value="military"<?php if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] == 'military') { |
|
1123 | + echo ' selected'; |
|
1124 | +} |
|
1125 | +?>><?php echo _("Military"); ?></option> |
|
738 | 1126 | </select> |
739 | 1127 | </li> |
740 | 1128 | <?php |
@@ -748,7 +1136,10 @@ discard block |
||
748 | 1136 | ?> |
749 | 1137 | <li> |
750 | 1138 | <?php echo _("Display vessels with MMSI:"); ?> |
751 | - <input type="text" name="mmsifilter" onchange="mmsifilter();" id="mmsifilter" value="<?php if (isset($_COOKIE['filter_mmsi'])) print $_COOKIE['filter_mmsi']; ?>" /> |
|
1139 | + <input type="text" name="mmsifilter" onchange="mmsifilter();" id="mmsifilter" value="<?php if (isset($_COOKIE['filter_mmsi'])) { |
|
1140 | + print $_COOKIE['filter_mmsi']; |
|
1141 | +} |
|
1142 | +?>" /> |
|
752 | 1143 | </li> |
753 | 1144 | <?php |
754 | 1145 | if (isset($globalVM) && $globalVM) { |
@@ -775,7 +1166,10 @@ discard block |
||
775 | 1166 | ?> |
776 | 1167 | <li> |
777 | 1168 | <?php echo _("Display with ident:"); ?> |
778 | - <input type="text" name="identfilter" onchange="identfilter();" id="identfilter" value="<?php if (isset($_COOKIE['filter_ident'])) print $_COOKIE['filter_ident']; ?>" /> |
|
1169 | + <input type="text" name="identfilter" onchange="identfilter();" id="identfilter" value="<?php if (isset($_COOKIE['filter_ident'])) { |
|
1170 | + print $_COOKIE['filter_ident']; |
|
1171 | +} |
|
1172 | +?>" /> |
|
779 | 1173 | </li> |
780 | 1174 | </ul> |
781 | 1175 | </form> |
@@ -791,7 +1185,10 @@ discard block |
||
791 | 1185 | <h1 class="sidebar-header"><?php echo _("Satellites"); ?><span class="sidebar-close"><i class="fa fa-caret-left"></i></span></h1> |
792 | 1186 | <form> |
793 | 1187 | <ul> |
794 | - <li><div class="checkbox"><label><input type="checkbox" name="displayiss" value="1" onclick="clickDisplayISS(this)" <?php if ((isset($_COOKIE['displayiss']) && $_COOKIE['displayiss'] == 'true') || !isset($_COOKIE['displayiss'])) print 'checked'; ?> ><?php echo _("Show ISS, Tiangong-1 and Tiangong-2 on map"); ?></label></div></li> |
|
1188 | + <li><div class="checkbox"><label><input type="checkbox" name="displayiss" value="1" onclick="clickDisplayISS(this)" <?php if ((isset($_COOKIE['displayiss']) && $_COOKIE['displayiss'] == 'true') || !isset($_COOKIE['displayiss'])) { |
|
1189 | + print 'checked'; |
|
1190 | +} |
|
1191 | +?> ><?php echo _("Show ISS, Tiangong-1 and Tiangong-2 on map"); ?></label></div></li> |
|
795 | 1192 | <li><?php echo _("Type:"); ?> |
796 | 1193 | <select class="selectpicker" multiple onchange="sattypes(this);"> |
797 | 1194 | <?php |
@@ -799,25 +1196,45 @@ discard block |
||
799 | 1196 | $types = $Satellite->get_tle_types(); |
800 | 1197 | foreach ($types as $type) { |
801 | 1198 | $type_name = $type['tle_type']; |
802 | - if ($type_name == 'musson') $type_name = 'Russian LEO Navigation'; |
|
803 | - else if ($type_name == 'nnss') $type_name = 'Navi Navigation Satellite System'; |
|
804 | - else if ($type_name == 'sbas') $type_name = 'Satellite-Based Augmentation System'; |
|
805 | - else if ($type_name == 'glo-ops') $type_name = 'Glonass Operational'; |
|
806 | - else if ($type_name == 'gps-ops') $type_name = 'GPS Operational'; |
|
807 | - else if ($type_name == 'argos') $type_name = 'ARGOS Data Collection System'; |
|
808 | - else if ($type_name == 'tdrss') $type_name = 'Tracking and Data Relay Satellite System'; |
|
809 | - else if ($type_name == 'sarsat') $type_name = 'Search & Rescue'; |
|
810 | - else if ($type_name == 'dmc') $type_name = 'Disaster Monitoring'; |
|
811 | - else if ($type_name == 'resource') $type_name = 'Earth Resources'; |
|
812 | - else if ($type_name == 'stations') $type_name = 'Space Stations'; |
|
813 | - else if ($type_name == 'geo') $type_name = 'Geostationary'; |
|
814 | - else if ($type_name == 'amateur') $type_name = 'Amateur Radio'; |
|
815 | - else if ($type_name == 'x-comm') $type_name = 'Experimental'; |
|
816 | - else if ($type_name == 'other-comm') $type_name = 'Other Comm'; |
|
817 | - else if ($type_name == 'science') $type_name = 'Space & Earth Science'; |
|
818 | - else if ($type_name == 'military') $type_name = 'Miscellaneous Military'; |
|
819 | - else if ($type_name == 'radar') $type_name = 'Radar Calibration'; |
|
820 | - else if ($type_name == 'tle-new') $type_name = 'Last 30 days launches'; |
|
1199 | + if ($type_name == 'musson') { |
|
1200 | + $type_name = 'Russian LEO Navigation'; |
|
1201 | + } else if ($type_name == 'nnss') { |
|
1202 | + $type_name = 'Navi Navigation Satellite System'; |
|
1203 | + } else if ($type_name == 'sbas') { |
|
1204 | + $type_name = 'Satellite-Based Augmentation System'; |
|
1205 | + } else if ($type_name == 'glo-ops') { |
|
1206 | + $type_name = 'Glonass Operational'; |
|
1207 | + } else if ($type_name == 'gps-ops') { |
|
1208 | + $type_name = 'GPS Operational'; |
|
1209 | + } else if ($type_name == 'argos') { |
|
1210 | + $type_name = 'ARGOS Data Collection System'; |
|
1211 | + } else if ($type_name == 'tdrss') { |
|
1212 | + $type_name = 'Tracking and Data Relay Satellite System'; |
|
1213 | + } else if ($type_name == 'sarsat') { |
|
1214 | + $type_name = 'Search & Rescue'; |
|
1215 | + } else if ($type_name == 'dmc') { |
|
1216 | + $type_name = 'Disaster Monitoring'; |
|
1217 | + } else if ($type_name == 'resource') { |
|
1218 | + $type_name = 'Earth Resources'; |
|
1219 | + } else if ($type_name == 'stations') { |
|
1220 | + $type_name = 'Space Stations'; |
|
1221 | + } else if ($type_name == 'geo') { |
|
1222 | + $type_name = 'Geostationary'; |
|
1223 | + } else if ($type_name == 'amateur') { |
|
1224 | + $type_name = 'Amateur Radio'; |
|
1225 | + } else if ($type_name == 'x-comm') { |
|
1226 | + $type_name = 'Experimental'; |
|
1227 | + } else if ($type_name == 'other-comm') { |
|
1228 | + $type_name = 'Other Comm'; |
|
1229 | + } else if ($type_name == 'science') { |
|
1230 | + $type_name = 'Space & Earth Science'; |
|
1231 | + } else if ($type_name == 'military') { |
|
1232 | + $type_name = 'Miscellaneous Military'; |
|
1233 | + } else if ($type_name == 'radar') { |
|
1234 | + $type_name = 'Radar Calibration'; |
|
1235 | + } else if ($type_name == 'tle-new') { |
|
1236 | + $type_name = 'Last 30 days launches'; |
|
1237 | + } |
|
821 | 1238 | |
822 | 1239 | if (isset($_COOKIE['sattypes']) && in_array($type['tle_type'],explode(',',$_COOKIE['sattypes']))) { |
823 | 1240 | print '<option value="'.$type['tle_type'].'" selected>'.$type_name.'</option>'; |
@@ -14,7 +14,7 @@ discard block |
||
14 | 14 | /** |
15 | 15 | * Get SQL query part for filter used |
16 | 16 | * @param Array $filter the filter |
17 | - * @return Array the SQL part |
|
17 | + * @return string the SQL part |
|
18 | 18 | */ |
19 | 19 | |
20 | 20 | public function getFilter($filter = array(),$where = false,$and = false) { |
@@ -694,25 +694,6 @@ discard block |
||
694 | 694 | * |
695 | 695 | * @param String $fammarine_id the ID |
696 | 696 | * @param String $ident the marine ident |
697 | - * @param String $departure_airport_icao the departure airport |
|
698 | - * @param String $arrival_airport_icao the arrival airport |
|
699 | - * @param String $latitude latitude of flight |
|
700 | - * @param String $longitude latitude of flight |
|
701 | - * @param String $waypoints waypoints of flight |
|
702 | - * @param String $heading heading of flight |
|
703 | - * @param String $groundspeed speed of flight |
|
704 | - * @param String $date date of flight |
|
705 | - * @param String $departure_airport_time departure time of flight |
|
706 | - * @param String $arrival_airport_time arrival time of flight |
|
707 | - * @param String $squawk squawk code of flight |
|
708 | - * @param String $route_stop route stop of flight |
|
709 | - * @param String $highlight highlight or not |
|
710 | - * @param String $ModeS ModesS code of flight |
|
711 | - * @param String $registration registration code of flight |
|
712 | - * @param String $pilot_id pilot id of flight (for virtual airlines) |
|
713 | - * @param String $pilot_name pilot name of flight (for virtual airlines) |
|
714 | - * @param String $verticalrate vertival rate of flight |
|
715 | - * @return String success or false |
|
716 | 697 | */ |
717 | 698 | public function addMarineData($fammarine_id = '', $ident = '', $latitude = '', $longitude = '', $heading = '', $groundspeed = '', $date = '', $mmsi = '',$type = '',$typeid = '',$imo = '',$callsign = '',$arrival_code = '',$arrival_date = '',$status = '',$statusid = '',$format_source = '', $source_name = '', $captain_id = '',$captain_name = '',$race_id = '', $race_name = '') |
718 | 699 | { |
@@ -1310,6 +1291,7 @@ discard block |
||
1310 | 1291 | /** |
1311 | 1292 | * Counts all hours |
1312 | 1293 | * |
1294 | + * @param string $orderby |
|
1313 | 1295 | * @return Array the hour list |
1314 | 1296 | * |
1315 | 1297 | */ |
@@ -1661,7 +1643,7 @@ discard block |
||
1661 | 1643 | /** |
1662 | 1644 | * Parses the direction degrees to working |
1663 | 1645 | * |
1664 | - * @param Float $direction the direction in degrees |
|
1646 | + * @param integer $direction the direction in degrees |
|
1665 | 1647 | * @return Array the direction information |
1666 | 1648 | * |
1667 | 1649 | */ |
@@ -12,10 +12,10 @@ discard block |
||
12 | 12 | } |
13 | 13 | |
14 | 14 | /** |
15 | - * Get SQL query part for filter used |
|
16 | - * @param Array $filter the filter |
|
17 | - * @return Array the SQL part |
|
18 | - */ |
|
15 | + * Get SQL query part for filter used |
|
16 | + * @param Array $filter the filter |
|
17 | + * @return Array the SQL part |
|
18 | + */ |
|
19 | 19 | |
20 | 20 | public function getFilter($filter = array(),$where = false,$and = false) { |
21 | 21 | global $globalFilter, $globalStatsFilters, $globalFilterName, $globalDBdriver; |
@@ -88,14 +88,14 @@ discard block |
||
88 | 88 | } |
89 | 89 | |
90 | 90 | /** |
91 | - * Executes the SQL statements to get the spotter information |
|
92 | - * |
|
93 | - * @param String $query the SQL query |
|
94 | - * @param Array $params parameter of the query |
|
95 | - * @param String $limitQuery the limit query |
|
96 | - * @return Array the spotter information |
|
97 | - * |
|
98 | - */ |
|
91 | + * Executes the SQL statements to get the spotter information |
|
92 | + * |
|
93 | + * @param String $query the SQL query |
|
94 | + * @param Array $params parameter of the query |
|
95 | + * @param String $limitQuery the limit query |
|
96 | + * @return Array the spotter information |
|
97 | + * |
|
98 | + */ |
|
99 | 99 | public function getDataFromDB($query, $params = array(), $limitQuery = '',$schedules = false) |
100 | 100 | { |
101 | 101 | date_default_timezone_set('UTC'); |
@@ -230,11 +230,11 @@ discard block |
||
230 | 230 | |
231 | 231 | |
232 | 232 | /** |
233 | - * Gets all the spotter information based on the latest data entry |
|
234 | - * |
|
235 | - * @return Array the spotter information |
|
236 | - * |
|
237 | - */ |
|
233 | + * Gets all the spotter information based on the latest data entry |
|
234 | + * |
|
235 | + * @return Array the spotter information |
|
236 | + * |
|
237 | + */ |
|
238 | 238 | public function getLatestMarineData($limit = '', $sort = '', $filter = array()) |
239 | 239 | { |
240 | 240 | global $global_query; |
@@ -283,11 +283,11 @@ discard block |
||
283 | 283 | } |
284 | 284 | |
285 | 285 | /** |
286 | - * Gets all the spotter information based on the callsign |
|
287 | - * |
|
288 | - * @return Array the spotter information |
|
289 | - * |
|
290 | - */ |
|
286 | + * Gets all the spotter information based on the callsign |
|
287 | + * |
|
288 | + * @return Array the spotter information |
|
289 | + * |
|
290 | + */ |
|
291 | 291 | public function getMarineDataByIdent($ident = '', $limit = '', $sort = '', $filter = array()) |
292 | 292 | { |
293 | 293 | global $global_query; |
@@ -339,11 +339,11 @@ discard block |
||
339 | 339 | } |
340 | 340 | |
341 | 341 | /** |
342 | - * Gets all the marine information based on the type |
|
343 | - * |
|
344 | - * @return Array the marine information |
|
345 | - * |
|
346 | - */ |
|
342 | + * Gets all the marine information based on the type |
|
343 | + * |
|
344 | + * @return Array the marine information |
|
345 | + * |
|
346 | + */ |
|
347 | 347 | public function getMarineDataByType($type = '', $limit = '', $sort = '', $filter = array()) |
348 | 348 | { |
349 | 349 | global $global_query; |
@@ -451,12 +451,12 @@ discard block |
||
451 | 451 | |
452 | 452 | |
453 | 453 | /** |
454 | - * Gets all source name |
|
455 | - * |
|
456 | - * @param String type format of source |
|
457 | - * @return Array list of source name |
|
458 | - * |
|
459 | - */ |
|
454 | + * Gets all source name |
|
455 | + * |
|
456 | + * @param String type format of source |
|
457 | + * @return Array list of source name |
|
458 | + * |
|
459 | + */ |
|
460 | 460 | public function getAllSourceName($type = '',$filters = array()) |
461 | 461 | { |
462 | 462 | $filter_query = $this->getFilter($filters,true,true); |
@@ -486,11 +486,11 @@ discard block |
||
486 | 486 | |
487 | 487 | |
488 | 488 | /** |
489 | - * Gets a list of all idents/callsigns |
|
490 | - * |
|
491 | - * @return Array list of ident/callsign names |
|
492 | - * |
|
493 | - */ |
|
489 | + * Gets a list of all idents/callsigns |
|
490 | + * |
|
491 | + * @return Array list of ident/callsign names |
|
492 | + * |
|
493 | + */ |
|
494 | 494 | public function getAllIdents($filters = array()) |
495 | 495 | { |
496 | 496 | $filter_query = $this->getFilter($filters,true,true); |
@@ -514,11 +514,11 @@ discard block |
||
514 | 514 | } |
515 | 515 | |
516 | 516 | /** |
517 | - * Gets all info from a mmsi |
|
518 | - * |
|
519 | - * @return Array ident |
|
520 | - * |
|
521 | - */ |
|
517 | + * Gets all info from a mmsi |
|
518 | + * |
|
519 | + * @return Array ident |
|
520 | + * |
|
521 | + */ |
|
522 | 522 | public function getIdentity($mmsi) |
523 | 523 | { |
524 | 524 | $mmsi = filter_var($mmsi,FILTER_SANITIZE_NUMBER_INT); |
@@ -531,9 +531,9 @@ discard block |
||
531 | 531 | } |
532 | 532 | |
533 | 533 | /** |
534 | - * Add identity |
|
535 | - * |
|
536 | - */ |
|
534 | + * Add identity |
|
535 | + * |
|
536 | + */ |
|
537 | 537 | public function addIdentity($mmsi,$imo,$ident,$callsign,$type) |
538 | 538 | { |
539 | 539 | $mmsi = filter_var($mmsi,FILTER_SANITIZE_NUMBER_INT); |
@@ -599,13 +599,13 @@ discard block |
||
599 | 599 | } |
600 | 600 | |
601 | 601 | /** |
602 | - * Update ident tracker data |
|
603 | - * |
|
604 | - * @param String $fammarine_id the ID |
|
605 | - * @param String $ident the marine ident |
|
606 | - * @return String success or false |
|
607 | - * |
|
608 | - */ |
|
602 | + * Update ident tracker data |
|
603 | + * |
|
604 | + * @param String $fammarine_id the ID |
|
605 | + * @param String $ident the marine ident |
|
606 | + * @return String success or false |
|
607 | + * |
|
608 | + */ |
|
609 | 609 | public function updateIdentMarineData($fammarine_id = '', $ident = '',$fromsource = NULL) |
610 | 610 | { |
611 | 611 | $query = 'UPDATE marine_output SET ident = :ident WHERE fammarine_id = :fammarine_id'; |
@@ -620,13 +620,13 @@ discard block |
||
620 | 620 | } |
621 | 621 | |
622 | 622 | /** |
623 | - * Update arrival marine data |
|
624 | - * |
|
625 | - * @param String $fammarine_id the ID |
|
626 | - * @param String $arrival_code the marine ident |
|
627 | - * @return String success or false |
|
628 | - * |
|
629 | - */ |
|
623 | + * Update arrival marine data |
|
624 | + * |
|
625 | + * @param String $fammarine_id the ID |
|
626 | + * @param String $arrival_code the marine ident |
|
627 | + * @return String success or false |
|
628 | + * |
|
629 | + */ |
|
630 | 630 | public function updateArrivalPortNameMarineData($fammarine_id = '', $arrival_code = '',$fromsource = NULL) |
631 | 631 | { |
632 | 632 | $query = 'UPDATE marine_output SET arrival_port_name = :arrival_code WHERE fammarine_id = :fammarine_id'; |
@@ -641,19 +641,19 @@ discard block |
||
641 | 641 | } |
642 | 642 | |
643 | 643 | /** |
644 | - * Update Status data |
|
645 | - * |
|
646 | - * @param String $fammarine_id the ID |
|
647 | - * @param String $status_id the marine status id |
|
648 | - * @param String $status the marine status |
|
649 | - * @return String success or false |
|
650 | - * |
|
651 | - */ |
|
644 | + * Update Status data |
|
645 | + * |
|
646 | + * @param String $fammarine_id the ID |
|
647 | + * @param String $status_id the marine status id |
|
648 | + * @param String $status the marine status |
|
649 | + * @return String success or false |
|
650 | + * |
|
651 | + */ |
|
652 | 652 | public function updateStatusMarineData($fammarine_id = '', $status_id = '',$status = '') |
653 | 653 | { |
654 | 654 | |
655 | 655 | $query = 'UPDATE marine_output SET status = :status, status_id = :status_id WHERE fammarine_id = :fammarine_id'; |
656 | - $query_values = array(':fammarine_id' => $fammarine_id,':status' => $status,':status_id' => $status_id); |
|
656 | + $query_values = array(':fammarine_id' => $fammarine_id,':status' => $status,':status_id' => $status_id); |
|
657 | 657 | |
658 | 658 | try { |
659 | 659 | $sth = $this->db->prepare($query); |
@@ -666,17 +666,17 @@ discard block |
||
666 | 666 | |
667 | 667 | } |
668 | 668 | /** |
669 | - * Update latest marine data |
|
670 | - * |
|
671 | - * @param String $fammarine_id the ID |
|
672 | - * @param String $ident the marine ident |
|
673 | - * @return String success or false |
|
674 | - * |
|
675 | - */ |
|
669 | + * Update latest marine data |
|
670 | + * |
|
671 | + * @param String $fammarine_id the ID |
|
672 | + * @param String $ident the marine ident |
|
673 | + * @return String success or false |
|
674 | + * |
|
675 | + */ |
|
676 | 676 | public function updateLatestMarineData($fammarine_id = '', $ident = '', $latitude = '', $longitude = '', $groundspeed = NULL, $date = '') |
677 | 677 | { |
678 | 678 | $query = 'UPDATE marine_output SET ident = :ident, last_latitude = :last_latitude, last_longitude = :last_longitude, last_seen = :last_seen, last_ground_speed = :last_ground_speed WHERE fammarine_id = :fammarine_id'; |
679 | - $query_values = array(':fammarine_id' => $fammarine_id,':last_latitude' => $latitude,':last_longitude' => $longitude, ':last_ground_speed' => $groundspeed,':last_seen' => $date,':ident' => $ident); |
|
679 | + $query_values = array(':fammarine_id' => $fammarine_id,':last_latitude' => $latitude,':last_longitude' => $longitude, ':last_ground_speed' => $groundspeed,':last_seen' => $date,':ident' => $ident); |
|
680 | 680 | |
681 | 681 | try { |
682 | 682 | $sth = $this->db->prepare($query); |
@@ -690,30 +690,30 @@ discard block |
||
690 | 690 | } |
691 | 691 | |
692 | 692 | /** |
693 | - * Adds a new spotter data |
|
694 | - * |
|
695 | - * @param String $fammarine_id the ID |
|
696 | - * @param String $ident the marine ident |
|
697 | - * @param String $departure_airport_icao the departure airport |
|
698 | - * @param String $arrival_airport_icao the arrival airport |
|
699 | - * @param String $latitude latitude of flight |
|
700 | - * @param String $longitude latitude of flight |
|
701 | - * @param String $waypoints waypoints of flight |
|
702 | - * @param String $heading heading of flight |
|
703 | - * @param String $groundspeed speed of flight |
|
704 | - * @param String $date date of flight |
|
705 | - * @param String $departure_airport_time departure time of flight |
|
706 | - * @param String $arrival_airport_time arrival time of flight |
|
707 | - * @param String $squawk squawk code of flight |
|
708 | - * @param String $route_stop route stop of flight |
|
709 | - * @param String $highlight highlight or not |
|
710 | - * @param String $ModeS ModesS code of flight |
|
711 | - * @param String $registration registration code of flight |
|
712 | - * @param String $pilot_id pilot id of flight (for virtual airlines) |
|
713 | - * @param String $pilot_name pilot name of flight (for virtual airlines) |
|
714 | - * @param String $verticalrate vertival rate of flight |
|
715 | - * @return String success or false |
|
716 | - */ |
|
693 | + * Adds a new spotter data |
|
694 | + * |
|
695 | + * @param String $fammarine_id the ID |
|
696 | + * @param String $ident the marine ident |
|
697 | + * @param String $departure_airport_icao the departure airport |
|
698 | + * @param String $arrival_airport_icao the arrival airport |
|
699 | + * @param String $latitude latitude of flight |
|
700 | + * @param String $longitude latitude of flight |
|
701 | + * @param String $waypoints waypoints of flight |
|
702 | + * @param String $heading heading of flight |
|
703 | + * @param String $groundspeed speed of flight |
|
704 | + * @param String $date date of flight |
|
705 | + * @param String $departure_airport_time departure time of flight |
|
706 | + * @param String $arrival_airport_time arrival time of flight |
|
707 | + * @param String $squawk squawk code of flight |
|
708 | + * @param String $route_stop route stop of flight |
|
709 | + * @param String $highlight highlight or not |
|
710 | + * @param String $ModeS ModesS code of flight |
|
711 | + * @param String $registration registration code of flight |
|
712 | + * @param String $pilot_id pilot id of flight (for virtual airlines) |
|
713 | + * @param String $pilot_name pilot name of flight (for virtual airlines) |
|
714 | + * @param String $verticalrate vertival rate of flight |
|
715 | + * @return String success or false |
|
716 | + */ |
|
717 | 717 | public function addMarineData($fammarine_id = '', $ident = '', $latitude = '', $longitude = '', $heading = '', $groundspeed = '', $date = '', $mmsi = '',$type = '',$typeid = '',$imo = '',$callsign = '',$arrival_code = '',$arrival_date = '',$status = '',$statusid = '',$format_source = '', $source_name = '', $captain_id = '',$captain_name = '',$race_id = '', $race_name = '') |
718 | 718 | { |
719 | 719 | global $globalURL, $globalMarineImageFetch; |
@@ -832,7 +832,7 @@ discard block |
||
832 | 832 | $sth->execute($query_values); |
833 | 833 | $this->db = null; |
834 | 834 | } catch (PDOException $e) { |
835 | - return "error : ".$e->getMessage(); |
|
835 | + return "error : ".$e->getMessage(); |
|
836 | 836 | } |
837 | 837 | |
838 | 838 | return "success"; |
@@ -841,11 +841,11 @@ discard block |
||
841 | 841 | |
842 | 842 | |
843 | 843 | /** |
844 | - * Gets the aircraft ident within the last hour |
|
845 | - * |
|
846 | - * @return String the ident |
|
847 | - * |
|
848 | - */ |
|
844 | + * Gets the aircraft ident within the last hour |
|
845 | + * |
|
846 | + * @return String the ident |
|
847 | + * |
|
848 | + */ |
|
849 | 849 | public function getIdentFromLastHour($ident) |
850 | 850 | { |
851 | 851 | global $globalDBdriver, $globalTimezone; |
@@ -861,11 +861,11 @@ discard block |
||
861 | 861 | AND marine_output.date >= now() AT TIME ZONE 'UTC' - INTERVAL '1 HOURS' |
862 | 862 | AND marine_output.date < now() AT TIME ZONE 'UTC'"; |
863 | 863 | $query_data = array(':ident' => $ident); |
864 | - } |
|
864 | + } |
|
865 | 865 | |
866 | 866 | $sth = $this->db->prepare($query); |
867 | 867 | $sth->execute($query_data); |
868 | - $ident_result=''; |
|
868 | + $ident_result=''; |
|
869 | 869 | while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
870 | 870 | { |
871 | 871 | $ident_result = $row['ident']; |
@@ -876,11 +876,11 @@ discard block |
||
876 | 876 | |
877 | 877 | |
878 | 878 | /** |
879 | - * Gets the aircraft data from the last 20 seconds |
|
880 | - * |
|
881 | - * @return Array the spotter data |
|
882 | - * |
|
883 | - */ |
|
879 | + * Gets the aircraft data from the last 20 seconds |
|
880 | + * |
|
881 | + * @return Array the spotter data |
|
882 | + * |
|
883 | + */ |
|
884 | 884 | public function getRealTimeData($q = '') |
885 | 885 | { |
886 | 886 | global $globalDBdriver; |
@@ -918,11 +918,11 @@ discard block |
||
918 | 918 | |
919 | 919 | |
920 | 920 | /** |
921 | - * Gets all number of flight over countries |
|
922 | - * |
|
923 | - * @return Array the airline country list |
|
924 | - * |
|
925 | - */ |
|
921 | + * Gets all number of flight over countries |
|
922 | + * |
|
923 | + * @return Array the airline country list |
|
924 | + * |
|
925 | + */ |
|
926 | 926 | |
927 | 927 | public function countAllMarineOverCountries($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array()) |
928 | 928 | { |
@@ -995,11 +995,11 @@ discard block |
||
995 | 995 | |
996 | 996 | |
997 | 997 | /** |
998 | - * Gets all callsigns that have flown over |
|
999 | - * |
|
1000 | - * @return Array the callsign list |
|
1001 | - * |
|
1002 | - */ |
|
998 | + * Gets all callsigns that have flown over |
|
999 | + * |
|
1000 | + * @return Array the callsign list |
|
1001 | + * |
|
1002 | + */ |
|
1003 | 1003 | public function countAllCallsigns($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array(),$year = '', $month = '', $day = '') |
1004 | 1004 | { |
1005 | 1005 | global $globalDBdriver; |
@@ -1066,11 +1066,11 @@ discard block |
||
1066 | 1066 | |
1067 | 1067 | |
1068 | 1068 | /** |
1069 | - * Counts all dates |
|
1070 | - * |
|
1071 | - * @return Array the date list |
|
1072 | - * |
|
1073 | - */ |
|
1069 | + * Counts all dates |
|
1070 | + * |
|
1071 | + * @return Array the date list |
|
1072 | + * |
|
1073 | + */ |
|
1074 | 1074 | public function countAllDates($filters = array()) |
1075 | 1075 | { |
1076 | 1076 | global $globalTimezone, $globalDBdriver; |
@@ -1116,11 +1116,11 @@ discard block |
||
1116 | 1116 | |
1117 | 1117 | |
1118 | 1118 | /** |
1119 | - * Counts all dates during the last 7 days |
|
1120 | - * |
|
1121 | - * @return Array the date list |
|
1122 | - * |
|
1123 | - */ |
|
1119 | + * Counts all dates during the last 7 days |
|
1120 | + * |
|
1121 | + * @return Array the date list |
|
1122 | + * |
|
1123 | + */ |
|
1124 | 1124 | public function countAllDatesLast7Days($filters = array()) |
1125 | 1125 | { |
1126 | 1126 | global $globalTimezone, $globalDBdriver; |
@@ -1142,7 +1142,7 @@ discard block |
||
1142 | 1142 | $query .= " GROUP BY date_name |
1143 | 1143 | ORDER BY date_name ASC"; |
1144 | 1144 | $query_data = array(':offset' => $offset); |
1145 | - } |
|
1145 | + } |
|
1146 | 1146 | |
1147 | 1147 | $sth = $this->db->prepare($query); |
1148 | 1148 | $sth->execute($query_data); |
@@ -1162,11 +1162,11 @@ discard block |
||
1162 | 1162 | } |
1163 | 1163 | |
1164 | 1164 | /** |
1165 | - * Counts all dates during the last month |
|
1166 | - * |
|
1167 | - * @return Array the date list |
|
1168 | - * |
|
1169 | - */ |
|
1165 | + * Counts all dates during the last month |
|
1166 | + * |
|
1167 | + * @return Array the date list |
|
1168 | + * |
|
1169 | + */ |
|
1170 | 1170 | public function countAllDatesLastMonth($filters = array()) |
1171 | 1171 | { |
1172 | 1172 | global $globalTimezone, $globalDBdriver; |
@@ -1188,7 +1188,7 @@ discard block |
||
1188 | 1188 | $query .= " GROUP BY date_name |
1189 | 1189 | ORDER BY date_name ASC"; |
1190 | 1190 | $query_data = array(':offset' => $offset); |
1191 | - } |
|
1191 | + } |
|
1192 | 1192 | |
1193 | 1193 | $sth = $this->db->prepare($query); |
1194 | 1194 | $sth->execute($query_data); |
@@ -1210,11 +1210,11 @@ discard block |
||
1210 | 1210 | |
1211 | 1211 | |
1212 | 1212 | /** |
1213 | - * Counts all month |
|
1214 | - * |
|
1215 | - * @return Array the month list |
|
1216 | - * |
|
1217 | - */ |
|
1213 | + * Counts all month |
|
1214 | + * |
|
1215 | + * @return Array the month list |
|
1216 | + * |
|
1217 | + */ |
|
1218 | 1218 | public function countAllMonths($filters = array()) |
1219 | 1219 | { |
1220 | 1220 | global $globalTimezone, $globalDBdriver; |
@@ -1259,11 +1259,11 @@ discard block |
||
1259 | 1259 | |
1260 | 1260 | |
1261 | 1261 | /** |
1262 | - * Counts all dates during the last year |
|
1263 | - * |
|
1264 | - * @return Array the date list |
|
1265 | - * |
|
1266 | - */ |
|
1262 | + * Counts all dates during the last year |
|
1263 | + * |
|
1264 | + * @return Array the date list |
|
1265 | + * |
|
1266 | + */ |
|
1267 | 1267 | public function countAllMonthsLastYear($filters) |
1268 | 1268 | { |
1269 | 1269 | global $globalTimezone, $globalDBdriver; |
@@ -1285,7 +1285,7 @@ discard block |
||
1285 | 1285 | $query .= " GROUP BY year_name, month_name |
1286 | 1286 | ORDER BY year_name, month_name ASC"; |
1287 | 1287 | $query_data = array(':offset' => $offset); |
1288 | - } |
|
1288 | + } |
|
1289 | 1289 | |
1290 | 1290 | $sth = $this->db->prepare($query); |
1291 | 1291 | $sth->execute($query_data); |
@@ -1308,11 +1308,11 @@ discard block |
||
1308 | 1308 | |
1309 | 1309 | |
1310 | 1310 | /** |
1311 | - * Counts all hours |
|
1312 | - * |
|
1313 | - * @return Array the hour list |
|
1314 | - * |
|
1315 | - */ |
|
1311 | + * Counts all hours |
|
1312 | + * |
|
1313 | + * @return Array the hour list |
|
1314 | + * |
|
1315 | + */ |
|
1316 | 1316 | public function countAllHours($orderby,$filters = array()) |
1317 | 1317 | { |
1318 | 1318 | global $globalTimezone, $globalDBdriver; |
@@ -1375,11 +1375,11 @@ discard block |
||
1375 | 1375 | |
1376 | 1376 | |
1377 | 1377 | /** |
1378 | - * Counts all hours by date |
|
1379 | - * |
|
1380 | - * @return Array the hour list |
|
1381 | - * |
|
1382 | - */ |
|
1378 | + * Counts all hours by date |
|
1379 | + * |
|
1380 | + * @return Array the hour list |
|
1381 | + * |
|
1382 | + */ |
|
1383 | 1383 | public function countAllHoursByDate($date, $filters = array()) |
1384 | 1384 | { |
1385 | 1385 | global $globalTimezone, $globalDBdriver; |
@@ -1423,11 +1423,11 @@ discard block |
||
1423 | 1423 | |
1424 | 1424 | |
1425 | 1425 | /** |
1426 | - * Counts all hours by a ident/callsign |
|
1427 | - * |
|
1428 | - * @return Array the hour list |
|
1429 | - * |
|
1430 | - */ |
|
1426 | + * Counts all hours by a ident/callsign |
|
1427 | + * |
|
1428 | + * @return Array the hour list |
|
1429 | + * |
|
1430 | + */ |
|
1431 | 1431 | public function countAllHoursByIdent($ident, $filters = array()) |
1432 | 1432 | { |
1433 | 1433 | global $globalTimezone, $globalDBdriver; |
@@ -1472,11 +1472,11 @@ discard block |
||
1472 | 1472 | |
1473 | 1473 | |
1474 | 1474 | /** |
1475 | - * Counts all vessels |
|
1476 | - * |
|
1477 | - * @return Integer the number of vessels |
|
1478 | - * |
|
1479 | - */ |
|
1475 | + * Counts all vessels |
|
1476 | + * |
|
1477 | + * @return Integer the number of vessels |
|
1478 | + * |
|
1479 | + */ |
|
1480 | 1480 | public function countOverallMarine($filters = array(),$year = '',$month = '') |
1481 | 1481 | { |
1482 | 1482 | global $globalDBdriver; |
@@ -1511,11 +1511,11 @@ discard block |
||
1511 | 1511 | } |
1512 | 1512 | |
1513 | 1513 | /** |
1514 | - * Counts all vessel type |
|
1515 | - * |
|
1516 | - * @return Integer the number of vessels |
|
1517 | - * |
|
1518 | - */ |
|
1514 | + * Counts all vessel type |
|
1515 | + * |
|
1516 | + * @return Integer the number of vessels |
|
1517 | + * |
|
1518 | + */ |
|
1519 | 1519 | public function countOverallMarineTypes($filters = array(),$year = '',$month = '') |
1520 | 1520 | { |
1521 | 1521 | global $globalDBdriver; |
@@ -1550,11 +1550,11 @@ discard block |
||
1550 | 1550 | |
1551 | 1551 | |
1552 | 1552 | /** |
1553 | - * Counts all hours of today |
|
1554 | - * |
|
1555 | - * @return Array the hour list |
|
1556 | - * |
|
1557 | - */ |
|
1553 | + * Counts all hours of today |
|
1554 | + * |
|
1555 | + * @return Array the hour list |
|
1556 | + * |
|
1557 | + */ |
|
1558 | 1558 | public function countAllHoursFromToday($filters = array()) |
1559 | 1559 | { |
1560 | 1560 | global $globalTimezone, $globalDBdriver; |
@@ -1594,12 +1594,12 @@ discard block |
||
1594 | 1594 | } |
1595 | 1595 | |
1596 | 1596 | |
1597 | - /** |
|
1598 | - * Gets the Barrie Spotter ID based on the FlightAware ID |
|
1599 | - * |
|
1600 | - * @return Integer the Barrie Spotter ID |
|
1597 | + /** |
|
1598 | + * Gets the Barrie Spotter ID based on the FlightAware ID |
|
1599 | + * |
|
1600 | + * @return Integer the Barrie Spotter ID |
|
1601 | 1601 | q * |
1602 | - */ |
|
1602 | + */ |
|
1603 | 1603 | public function getMarineIDBasedOnFamMarineID($fammarine_id) |
1604 | 1604 | { |
1605 | 1605 | $fammarine_id = filter_var($fammarine_id,FILTER_SANITIZE_STRING); |
@@ -1620,13 +1620,13 @@ discard block |
||
1620 | 1620 | |
1621 | 1621 | |
1622 | 1622 | /** |
1623 | - * Parses a date string |
|
1624 | - * |
|
1625 | - * @param String $dateString the date string |
|
1626 | - * @param String $timezone the timezone of a user |
|
1627 | - * @return Array the time information |
|
1628 | - * |
|
1629 | - */ |
|
1623 | + * Parses a date string |
|
1624 | + * |
|
1625 | + * @param String $dateString the date string |
|
1626 | + * @param String $timezone the timezone of a user |
|
1627 | + * @return Array the time information |
|
1628 | + * |
|
1629 | + */ |
|
1630 | 1630 | public function parseDateString($dateString, $timezone = '') |
1631 | 1631 | { |
1632 | 1632 | $time_array = array(); |
@@ -1659,12 +1659,12 @@ discard block |
||
1659 | 1659 | } |
1660 | 1660 | |
1661 | 1661 | /** |
1662 | - * Parses the direction degrees to working |
|
1663 | - * |
|
1664 | - * @param Float $direction the direction in degrees |
|
1665 | - * @return Array the direction information |
|
1666 | - * |
|
1667 | - */ |
|
1662 | + * Parses the direction degrees to working |
|
1663 | + * |
|
1664 | + * @param Float $direction the direction in degrees |
|
1665 | + * @return Array the direction information |
|
1666 | + * |
|
1667 | + */ |
|
1668 | 1668 | public function parseDirection($direction = 0) |
1669 | 1669 | { |
1670 | 1670 | if ($direction == '') $direction = 0; |
@@ -1743,12 +1743,12 @@ discard block |
||
1743 | 1743 | |
1744 | 1744 | |
1745 | 1745 | /** |
1746 | - * Gets Country from latitude/longitude |
|
1747 | - * |
|
1748 | - * @param Float $latitude latitute of the flight |
|
1749 | - * @param Float $longitude longitute of the flight |
|
1750 | - * @return String the countrie |
|
1751 | - */ |
|
1746 | + * Gets Country from latitude/longitude |
|
1747 | + * |
|
1748 | + * @param Float $latitude latitute of the flight |
|
1749 | + * @param Float $longitude longitute of the flight |
|
1750 | + * @return String the countrie |
|
1751 | + */ |
|
1752 | 1752 | public function getCountryFromLatitudeLongitude($latitude,$longitude) |
1753 | 1753 | { |
1754 | 1754 | global $globalDBdriver, $globalDebug; |
@@ -1785,11 +1785,11 @@ discard block |
||
1785 | 1785 | } |
1786 | 1786 | |
1787 | 1787 | /** |
1788 | - * Gets Country from iso2 |
|
1789 | - * |
|
1790 | - * @param String $iso2 ISO2 country code |
|
1791 | - * @return String the countrie |
|
1792 | - */ |
|
1788 | + * Gets Country from iso2 |
|
1789 | + * |
|
1790 | + * @param String $iso2 ISO2 country code |
|
1791 | + * @return String the countrie |
|
1792 | + */ |
|
1793 | 1793 | public function getCountryFromISO2($iso2) |
1794 | 1794 | { |
1795 | 1795 | global $globalDBdriver, $globalDebug; |
@@ -1818,12 +1818,12 @@ discard block |
||
1818 | 1818 | |
1819 | 1819 | |
1820 | 1820 | /** |
1821 | - * Gets the short url from bit.ly |
|
1822 | - * |
|
1823 | - * @param String $url the full url |
|
1824 | - * @return String the bit.ly url |
|
1825 | - * |
|
1826 | - */ |
|
1821 | + * Gets the short url from bit.ly |
|
1822 | + * |
|
1823 | + * @param String $url the full url |
|
1824 | + * @return String the bit.ly url |
|
1825 | + * |
|
1826 | + */ |
|
1827 | 1827 | public function getBitlyURL($url) |
1828 | 1828 | { |
1829 | 1829 | global $globalBitlyAccessToken; |
@@ -1850,11 +1850,11 @@ discard block |
||
1850 | 1850 | |
1851 | 1851 | |
1852 | 1852 | /** |
1853 | - * Gets all vessels types that have flown over |
|
1854 | - * |
|
1855 | - * @return Array the vessel type list |
|
1856 | - * |
|
1857 | - */ |
|
1853 | + * Gets all vessels types that have flown over |
|
1854 | + * |
|
1855 | + * @return Array the vessel type list |
|
1856 | + * |
|
1857 | + */ |
|
1858 | 1858 | public function countAllMarineTypes($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array(),$year = '',$month = '',$day = '') |
1859 | 1859 | { |
1860 | 1860 | global $globalDBdriver; |
@@ -1920,11 +1920,11 @@ discard block |
||
1920 | 1920 | } |
1921 | 1921 | |
1922 | 1922 | /** |
1923 | - * Gets all the tracker information |
|
1924 | - * |
|
1925 | - * @return Array the tracker information |
|
1926 | - * |
|
1927 | - */ |
|
1923 | + * Gets all the tracker information |
|
1924 | + * |
|
1925 | + * @return Array the tracker information |
|
1926 | + * |
|
1927 | + */ |
|
1928 | 1928 | public function searchMarineData($q = '', $callsign = '',$mmsi = '', $imo = '', $date_posted = '', $limit = '', $sort = '', $includegeodata = '',$origLat = '',$origLon = '',$dist = '',$filters = array()) |
1929 | 1929 | { |
1930 | 1930 | global $globalTimezone, $globalDBdriver; |
@@ -2,7 +2,7 @@ discard block |
||
2 | 2 | require_once(dirname(__FILE__).'/class.Image.php'); |
3 | 3 | $global_query = "SELECT marine_output.* FROM marine_output"; |
4 | 4 | |
5 | -class Marine{ |
|
5 | +class Marine { |
|
6 | 6 | public $db; |
7 | 7 | |
8 | 8 | public function __construct($dbc = null) { |
@@ -17,33 +17,33 @@ discard block |
||
17 | 17 | * @return Array the SQL part |
18 | 18 | */ |
19 | 19 | |
20 | - public function getFilter($filter = array(),$where = false,$and = false) { |
|
20 | + public function getFilter($filter = array(), $where = false, $and = false) { |
|
21 | 21 | global $globalFilter, $globalStatsFilters, $globalFilterName, $globalDBdriver; |
22 | 22 | $filters = array(); |
23 | 23 | if (is_array($globalStatsFilters) && isset($globalStatsFilters[$globalFilterName])) { |
24 | 24 | if (isset($globalStatsFilters[$globalFilterName][0]['source'])) { |
25 | 25 | $filters = $globalStatsFilters[$globalFilterName]; |
26 | 26 | } else { |
27 | - $filter = array_merge($filter,$globalStatsFilters[$globalFilterName]); |
|
27 | + $filter = array_merge($filter, $globalStatsFilters[$globalFilterName]); |
|
28 | 28 | } |
29 | 29 | } |
30 | 30 | if (isset($filter[0]['source'])) { |
31 | - $filters = array_merge($filters,$filter); |
|
31 | + $filters = array_merge($filters, $filter); |
|
32 | 32 | } |
33 | - if (is_array($globalFilter)) $filter = array_merge($filter,$globalFilter); |
|
33 | + if (is_array($globalFilter)) $filter = array_merge($filter, $globalFilter); |
|
34 | 34 | $filter_query_join = ''; |
35 | 35 | $filter_query_where = ''; |
36 | - foreach($filters as $flt) { |
|
36 | + foreach ($filters as $flt) { |
|
37 | 37 | if (isset($flt['idents']) && !empty($flt['idents'])) { |
38 | 38 | if (isset($flt['source'])) { |
39 | - $filter_query_join .= " INNER JOIN (SELECT fammarine_id FROM marine_output WHERE marine_output.ident IN ('".implode("','",$flt['idents'])."') AND spotter_output.format_source IN ('".implode("','",$flt['source'])."')) spfi ON spfi.fammarine_id = marine_output.fammarine_id"; |
|
39 | + $filter_query_join .= " INNER JOIN (SELECT fammarine_id FROM marine_output WHERE marine_output.ident IN ('".implode("','", $flt['idents'])."') AND spotter_output.format_source IN ('".implode("','", $flt['source'])."')) spfi ON spfi.fammarine_id = marine_output.fammarine_id"; |
|
40 | 40 | } else { |
41 | - $filter_query_join .= " INNER JOIN (SELECT fammarine_id FROM marine_output WHERE marine_output.ident IN ('".implode("','",$flt['idents'])."')) spfi ON spfi.fammarine_id = marine_output.fammarine_id"; |
|
41 | + $filter_query_join .= " INNER JOIN (SELECT fammarine_id FROM marine_output WHERE marine_output.ident IN ('".implode("','", $flt['idents'])."')) spfi ON spfi.fammarine_id = marine_output.fammarine_id"; |
|
42 | 42 | } |
43 | 43 | } |
44 | 44 | } |
45 | 45 | if (isset($filter['source']) && !empty($filter['source'])) { |
46 | - $filter_query_where .= " AND format_source IN ('".implode("','",$filter['source'])."')"; |
|
46 | + $filter_query_where .= " AND format_source IN ('".implode("','", $filter['source'])."')"; |
|
47 | 47 | } |
48 | 48 | if (isset($filter['ident']) && !empty($filter['ident'])) { |
49 | 49 | $filter_query_where .= " AND ident = '".$filter['ident']."'"; |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE'; |
82 | 82 | elseif ($filter_query_where != '' && $and) $filter_query_where .= ' AND'; |
83 | 83 | if ($filter_query_where != '') { |
84 | - $filter_query_where = preg_replace('/^ AND/',' WHERE',$filter_query_where); |
|
84 | + $filter_query_where = preg_replace('/^ AND/', ' WHERE', $filter_query_where); |
|
85 | 85 | } |
86 | 86 | $filter_query = $filter_query_join.$filter_query_where; |
87 | 87 | return $filter_query; |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | * @return Array the spotter information |
97 | 97 | * |
98 | 98 | */ |
99 | - public function getDataFromDB($query, $params = array(), $limitQuery = '',$schedules = false) |
|
99 | + public function getDataFromDB($query, $params = array(), $limitQuery = '', $schedules = false) |
|
100 | 100 | { |
101 | 101 | date_default_timezone_set('UTC'); |
102 | 102 | if (!is_string($query)) |
@@ -116,13 +116,13 @@ discard block |
||
116 | 116 | $sth = $this->db->prepare($query.$limitQuery); |
117 | 117 | $sth->execute($params); |
118 | 118 | } catch (PDOException $e) { |
119 | - printf("Invalid query : %s\nWhole query: %s\n",$e->getMessage(), $query.$limitQuery); |
|
119 | + printf("Invalid query : %s\nWhole query: %s\n", $e->getMessage(), $query.$limitQuery); |
|
120 | 120 | exit(); |
121 | 121 | } |
122 | 122 | |
123 | 123 | $num_rows = 0; |
124 | 124 | $spotter_array = array(); |
125 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
125 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
126 | 126 | { |
127 | 127 | $num_rows++; |
128 | 128 | $temp_array = array(); |
@@ -161,10 +161,10 @@ discard block |
||
161 | 161 | } |
162 | 162 | if (isset($row['ground_speed'])) $temp_array['ground_speed'] = $row['ground_speed']; |
163 | 163 | |
164 | - if(isset($temp_array['mmsi']) && $temp_array['mmsi'] != "") |
|
164 | + if (isset($temp_array['mmsi']) && $temp_array['mmsi'] != "") |
|
165 | 165 | { |
166 | 166 | $Image = new Image($this->db); |
167 | - if (isset($temp_array['ident']) && $temp_array['ident'] != '') $image_array = $Image->getMarineImage($temp_array['mmsi'],'',$temp_array['ident']); |
|
167 | + if (isset($temp_array['ident']) && $temp_array['ident'] != '') $image_array = $Image->getMarineImage($temp_array['mmsi'], '', $temp_array['ident']); |
|
168 | 168 | else $image_array = $Image->getMarineImage($temp_array['mmsi']); |
169 | 169 | unset($Image); |
170 | 170 | if (count($image_array) > 0) { |
@@ -200,17 +200,17 @@ discard block |
||
200 | 200 | { |
201 | 201 | $temp_array['date'] = "about ".$dateArray['hours']." hours ago"; |
202 | 202 | } else { |
203 | - $temp_array['date'] = date("M j Y, g:i a",strtotime($row['date']." UTC")); |
|
203 | + $temp_array['date'] = date("M j Y, g:i a", strtotime($row['date']." UTC")); |
|
204 | 204 | } |
205 | 205 | $temp_array['date_minutes_past'] = $dateArray['minutes']; |
206 | - $temp_array['date_iso_8601'] = date("c",strtotime($row['date']." UTC")); |
|
207 | - $temp_array['date_rfc_2822'] = date("r",strtotime($row['date']." UTC")); |
|
206 | + $temp_array['date_iso_8601'] = date("c", strtotime($row['date']." UTC")); |
|
207 | + $temp_array['date_rfc_2822'] = date("r", strtotime($row['date']." UTC")); |
|
208 | 208 | $temp_array['date_unix'] = strtotime($row['date']." UTC"); |
209 | 209 | if (isset($row['last_seen']) && $row['last_seen'] != '') { |
210 | 210 | if (strtotime($row['last_seen']) > strtotime($row['date'])) { |
211 | 211 | $temp_array['duration'] = strtotime($row['last_seen']) - strtotime($row['date']); |
212 | - $temp_array['last_seen_date_iso_8601'] = date("c",strtotime($row['last_seen']." UTC")); |
|
213 | - $temp_array['last_seen_date_rfc_2822'] = date("r",strtotime($row['last_seen']." UTC")); |
|
212 | + $temp_array['last_seen_date_iso_8601'] = date("c", strtotime($row['last_seen']." UTC")); |
|
213 | + $temp_array['last_seen_date_rfc_2822'] = date("r", strtotime($row['last_seen']." UTC")); |
|
214 | 214 | $temp_array['last_seen_date_unix'] = strtotime($row['last_seen']." UTC"); |
215 | 215 | } |
216 | 216 | } |
@@ -243,8 +243,8 @@ discard block |
||
243 | 243 | if ($limit != "") |
244 | 244 | { |
245 | 245 | $limit_array = explode(",", $limit); |
246 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
247 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
246 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
247 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
248 | 248 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
249 | 249 | { |
250 | 250 | //$limit_query = " LIMIT ".$limit_array[0].",".$limit_array[1]; |
@@ -258,8 +258,8 @@ discard block |
||
258 | 258 | } else { |
259 | 259 | $orderby_query = " ORDER BY marine_output.date DESC"; |
260 | 260 | } |
261 | - $query = $global_query.$filter_query." ".$orderby_query; |
|
262 | - $spotter_array = $this->getDataFromDB($query, array(),$limit_query,true); |
|
261 | + $query = $global_query.$filter_query." ".$orderby_query; |
|
262 | + $spotter_array = $this->getDataFromDB($query, array(), $limit_query, true); |
|
263 | 263 | return $spotter_array; |
264 | 264 | } |
265 | 265 | |
@@ -277,8 +277,8 @@ discard block |
||
277 | 277 | if ($id == '') return array(); |
278 | 278 | $additional_query = "marine_output.fammarine_id = :id"; |
279 | 279 | $query_values = array(':id' => $id); |
280 | - $query = $global_query." WHERE ".$additional_query." "; |
|
281 | - $spotter_array = $this->getDataFromDB($query,$query_values); |
|
280 | + $query = $global_query." WHERE ".$additional_query." "; |
|
281 | + $spotter_array = $this->getDataFromDB($query, $query_values); |
|
282 | 282 | return $spotter_array; |
283 | 283 | } |
284 | 284 | |
@@ -297,7 +297,7 @@ discard block |
||
297 | 297 | $query_values = array(); |
298 | 298 | $limit_query = ''; |
299 | 299 | $additional_query = ''; |
300 | - $filter_query = $this->getFilter($filter,true,true); |
|
300 | + $filter_query = $this->getFilter($filter, true, true); |
|
301 | 301 | if ($ident != "") |
302 | 302 | { |
303 | 303 | if (!is_string($ident)) |
@@ -313,8 +313,8 @@ discard block |
||
313 | 313 | { |
314 | 314 | $limit_array = explode(",", $limit); |
315 | 315 | |
316 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
317 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
316 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
317 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
318 | 318 | |
319 | 319 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
320 | 320 | { |
@@ -353,7 +353,7 @@ discard block |
||
353 | 353 | $query_values = array(); |
354 | 354 | $limit_query = ''; |
355 | 355 | $additional_query = ''; |
356 | - $filter_query = $this->getFilter($filter,true,true); |
|
356 | + $filter_query = $this->getFilter($filter, true, true); |
|
357 | 357 | if (!is_string($type)) |
358 | 358 | { |
359 | 359 | return false; |
@@ -366,8 +366,8 @@ discard block |
||
366 | 366 | { |
367 | 367 | $limit_array = explode(",", $limit); |
368 | 368 | |
369 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
370 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
369 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
370 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
371 | 371 | |
372 | 372 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
373 | 373 | { |
@@ -391,7 +391,7 @@ discard block |
||
391 | 391 | return $spotter_array; |
392 | 392 | } |
393 | 393 | |
394 | - public function getMarineDataByDate($date = '', $limit = '', $sort = '',$filter = array()) |
|
394 | + public function getMarineDataByDate($date = '', $limit = '', $sort = '', $filter = array()) |
|
395 | 395 | { |
396 | 396 | global $global_query, $globalTimezone, $globalDBdriver; |
397 | 397 | |
@@ -399,7 +399,7 @@ discard block |
||
399 | 399 | $limit_query = ''; |
400 | 400 | $additional_query = ''; |
401 | 401 | |
402 | - $filter_query = $this->getFilter($filter,true,true); |
|
402 | + $filter_query = $this->getFilter($filter, true, true); |
|
403 | 403 | |
404 | 404 | if ($date != "") |
405 | 405 | { |
@@ -425,8 +425,8 @@ discard block |
||
425 | 425 | { |
426 | 426 | $limit_array = explode(",", $limit); |
427 | 427 | |
428 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
429 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
428 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
429 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
430 | 430 | |
431 | 431 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
432 | 432 | { |
@@ -457,11 +457,11 @@ discard block |
||
457 | 457 | * @return Array list of source name |
458 | 458 | * |
459 | 459 | */ |
460 | - public function getAllSourceName($type = '',$filters = array()) |
|
460 | + public function getAllSourceName($type = '', $filters = array()) |
|
461 | 461 | { |
462 | - $filter_query = $this->getFilter($filters,true,true); |
|
462 | + $filter_query = $this->getFilter($filters, true, true); |
|
463 | 463 | $query_values = array(); |
464 | - $query = "SELECT DISTINCT marine_output.source_name |
|
464 | + $query = "SELECT DISTINCT marine_output.source_name |
|
465 | 465 | FROM marine_output".$filter_query." marine_output.source_name <> ''"; |
466 | 466 | if ($type != '') { |
467 | 467 | $query_values = array(':type' => $type); |
@@ -476,7 +476,7 @@ discard block |
||
476 | 476 | $source_array = array(); |
477 | 477 | $temp_array = array(); |
478 | 478 | |
479 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
479 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
480 | 480 | { |
481 | 481 | $temp_array['source_name'] = $row['source_name']; |
482 | 482 | $source_array[] = $temp_array; |
@@ -493,8 +493,8 @@ discard block |
||
493 | 493 | */ |
494 | 494 | public function getAllIdents($filters = array()) |
495 | 495 | { |
496 | - $filter_query = $this->getFilter($filters,true,true); |
|
497 | - $query = "SELECT DISTINCT marine_output.ident |
|
496 | + $filter_query = $this->getFilter($filters, true, true); |
|
497 | + $query = "SELECT DISTINCT marine_output.ident |
|
498 | 498 | FROM marine_output".$filter_query." marine_output.ident <> '' |
499 | 499 | ORDER BY marine_output.date ASC LIMIT 700 OFFSET 0"; |
500 | 500 | |
@@ -504,7 +504,7 @@ discard block |
||
504 | 504 | $ident_array = array(); |
505 | 505 | $temp_array = array(); |
506 | 506 | |
507 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
507 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
508 | 508 | { |
509 | 509 | $temp_array['ident'] = $row['ident']; |
510 | 510 | $ident_array[] = $temp_array; |
@@ -521,7 +521,7 @@ discard block |
||
521 | 521 | */ |
522 | 522 | public function getIdentity($mmsi) |
523 | 523 | { |
524 | - $mmsi = filter_var($mmsi,FILTER_SANITIZE_NUMBER_INT); |
|
524 | + $mmsi = filter_var($mmsi, FILTER_SANITIZE_NUMBER_INT); |
|
525 | 525 | $query = "SELECT * FROM marine_identity WHERE mmsi = :mmsi LIMIT 1"; |
526 | 526 | $sth = $this->db->prepare($query); |
527 | 527 | $sth->execute(array(':mmsi' => $mmsi)); |
@@ -534,23 +534,23 @@ discard block |
||
534 | 534 | * Add identity |
535 | 535 | * |
536 | 536 | */ |
537 | - public function addIdentity($mmsi,$imo,$ident,$callsign,$type) |
|
537 | + public function addIdentity($mmsi, $imo, $ident, $callsign, $type) |
|
538 | 538 | { |
539 | - $mmsi = filter_var($mmsi,FILTER_SANITIZE_NUMBER_INT); |
|
539 | + $mmsi = filter_var($mmsi, FILTER_SANITIZE_NUMBER_INT); |
|
540 | 540 | if ($mmsi != '') { |
541 | - $imo = filter_var($imo,FILTER_SANITIZE_NUMBER_INT); |
|
542 | - $ident = filter_var($ident,FILTER_SANITIZE_STRING); |
|
543 | - $callsign = filter_var($callsign,FILTER_SANITIZE_STRING); |
|
544 | - $type = filter_var($type,FILTER_SANITIZE_STRING); |
|
541 | + $imo = filter_var($imo, FILTER_SANITIZE_NUMBER_INT); |
|
542 | + $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
|
543 | + $callsign = filter_var($callsign, FILTER_SANITIZE_STRING); |
|
544 | + $type = filter_var($type, FILTER_SANITIZE_STRING); |
|
545 | 545 | $identinfo = $this->getIdentity($mmsi); |
546 | 546 | if (empty($identinfo)) { |
547 | - $query = "INSERT INTO marine_identity (mmsi,imo,call_sign,ship_name,type) VALUES (:mmsi,:imo,:call_sign,:ship_name,:type)"; |
|
547 | + $query = "INSERT INTO marine_identity (mmsi,imo,call_sign,ship_name,type) VALUES (:mmsi,:imo,:call_sign,:ship_name,:type)"; |
|
548 | 548 | $sth = $this->db->prepare($query); |
549 | - $sth->execute(array(':mmsi' => $mmsi,':imo' => $imo,':call_sign' => $callsign,':ship_name' => $ident,':type' => $type)); |
|
549 | + $sth->execute(array(':mmsi' => $mmsi, ':imo' => $imo, ':call_sign' => $callsign, ':ship_name' => $ident, ':type' => $type)); |
|
550 | 550 | } elseif ($ident != '' && $identinfo['ship_name'] != $ident) { |
551 | - $query = "UPDATE marine_identity SET ship_name = :ship_name,type = :type WHERE mmsi = :mmsi"; |
|
551 | + $query = "UPDATE marine_identity SET ship_name = :ship_name,type = :type WHERE mmsi = :mmsi"; |
|
552 | 552 | $sth = $this->db->prepare($query); |
553 | - $sth->execute(array(':mmsi' => $mmsi,':ship_name' => $ident,':type' => $type)); |
|
553 | + $sth->execute(array(':mmsi' => $mmsi, ':ship_name' => $ident, ':type' => $type)); |
|
554 | 554 | } |
555 | 555 | } |
556 | 556 | } |
@@ -571,12 +571,12 @@ discard block |
||
571 | 571 | } else $offset = '+00:00'; |
572 | 572 | |
573 | 573 | if ($globalDBdriver == 'mysql') { |
574 | - $query = "SELECT DISTINCT DATE(CONVERT_TZ(marine_output.date,'+00:00', :offset)) as date |
|
574 | + $query = "SELECT DISTINCT DATE(CONVERT_TZ(marine_output.date,'+00:00', :offset)) as date |
|
575 | 575 | FROM marine_output |
576 | 576 | WHERE marine_output.date <> '' |
577 | 577 | ORDER BY marine_output.date ASC LIMIT 0,100"; |
578 | 578 | } else { |
579 | - $query = "SELECT DISTINCT to_char(marine_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') as date |
|
579 | + $query = "SELECT DISTINCT to_char(marine_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') as date |
|
580 | 580 | FROM marine_output |
581 | 581 | WHERE marine_output.date <> '' |
582 | 582 | ORDER BY marine_output.date ASC LIMIT 0,100"; |
@@ -588,7 +588,7 @@ discard block |
||
588 | 588 | $date_array = array(); |
589 | 589 | $temp_array = array(); |
590 | 590 | |
591 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
591 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
592 | 592 | { |
593 | 593 | $temp_array['date'] = $row['date']; |
594 | 594 | |
@@ -606,10 +606,10 @@ discard block |
||
606 | 606 | * @return String success or false |
607 | 607 | * |
608 | 608 | */ |
609 | - public function updateIdentMarineData($fammarine_id = '', $ident = '',$fromsource = NULL) |
|
609 | + public function updateIdentMarineData($fammarine_id = '', $ident = '', $fromsource = NULL) |
|
610 | 610 | { |
611 | 611 | $query = 'UPDATE marine_output SET ident = :ident WHERE fammarine_id = :fammarine_id'; |
612 | - $query_values = array(':fammarine_id' => $fammarine_id,':ident' => $ident); |
|
612 | + $query_values = array(':fammarine_id' => $fammarine_id, ':ident' => $ident); |
|
613 | 613 | try { |
614 | 614 | $sth = $this->db->prepare($query); |
615 | 615 | $sth->execute($query_values); |
@@ -627,10 +627,10 @@ discard block |
||
627 | 627 | * @return String success or false |
628 | 628 | * |
629 | 629 | */ |
630 | - public function updateArrivalPortNameMarineData($fammarine_id = '', $arrival_code = '',$fromsource = NULL) |
|
630 | + public function updateArrivalPortNameMarineData($fammarine_id = '', $arrival_code = '', $fromsource = NULL) |
|
631 | 631 | { |
632 | 632 | $query = 'UPDATE marine_output SET arrival_port_name = :arrival_code WHERE fammarine_id = :fammarine_id'; |
633 | - $query_values = array(':fammarine_id' => $fammarine_id,':arrival_code' => $arrival_code); |
|
633 | + $query_values = array(':fammarine_id' => $fammarine_id, ':arrival_code' => $arrival_code); |
|
634 | 634 | try { |
635 | 635 | $sth = $this->db->prepare($query); |
636 | 636 | $sth->execute($query_values); |
@@ -649,11 +649,11 @@ discard block |
||
649 | 649 | * @return String success or false |
650 | 650 | * |
651 | 651 | */ |
652 | - public function updateStatusMarineData($fammarine_id = '', $status_id = '',$status = '') |
|
652 | + public function updateStatusMarineData($fammarine_id = '', $status_id = '', $status = '') |
|
653 | 653 | { |
654 | 654 | |
655 | 655 | $query = 'UPDATE marine_output SET status = :status, status_id = :status_id WHERE fammarine_id = :fammarine_id'; |
656 | - $query_values = array(':fammarine_id' => $fammarine_id,':status' => $status,':status_id' => $status_id); |
|
656 | + $query_values = array(':fammarine_id' => $fammarine_id, ':status' => $status, ':status_id' => $status_id); |
|
657 | 657 | |
658 | 658 | try { |
659 | 659 | $sth = $this->db->prepare($query); |
@@ -676,7 +676,7 @@ discard block |
||
676 | 676 | public function updateLatestMarineData($fammarine_id = '', $ident = '', $latitude = '', $longitude = '', $groundspeed = NULL, $date = '') |
677 | 677 | { |
678 | 678 | $query = 'UPDATE marine_output SET ident = :ident, last_latitude = :last_latitude, last_longitude = :last_longitude, last_seen = :last_seen, last_ground_speed = :last_ground_speed WHERE fammarine_id = :fammarine_id'; |
679 | - $query_values = array(':fammarine_id' => $fammarine_id,':last_latitude' => $latitude,':last_longitude' => $longitude, ':last_ground_speed' => $groundspeed,':last_seen' => $date,':ident' => $ident); |
|
679 | + $query_values = array(':fammarine_id' => $fammarine_id, ':last_latitude' => $latitude, ':last_longitude' => $longitude, ':last_ground_speed' => $groundspeed, ':last_seen' => $date, ':ident' => $ident); |
|
680 | 680 | |
681 | 681 | try { |
682 | 682 | $sth = $this->db->prepare($query); |
@@ -714,7 +714,7 @@ discard block |
||
714 | 714 | * @param String $verticalrate vertival rate of flight |
715 | 715 | * @return String success or false |
716 | 716 | */ |
717 | - public function addMarineData($fammarine_id = '', $ident = '', $latitude = '', $longitude = '', $heading = '', $groundspeed = '', $date = '', $mmsi = '',$type = '',$typeid = '',$imo = '',$callsign = '',$arrival_code = '',$arrival_date = '',$status = '',$statusid = '',$format_source = '', $source_name = '', $captain_id = '',$captain_name = '',$race_id = '', $race_name = '') |
|
717 | + public function addMarineData($fammarine_id = '', $ident = '', $latitude = '', $longitude = '', $heading = '', $groundspeed = '', $date = '', $mmsi = '', $type = '', $typeid = '', $imo = '', $callsign = '', $arrival_code = '', $arrival_date = '', $status = '', $statusid = '', $format_source = '', $source_name = '', $captain_id = '', $captain_name = '', $race_id = '', $race_name = '') |
|
718 | 718 | { |
719 | 719 | global $globalURL, $globalMarineImageFetch; |
720 | 720 | |
@@ -781,36 +781,36 @@ discard block |
||
781 | 781 | } |
782 | 782 | |
783 | 783 | |
784 | - if ($date == "" || strtotime($date) < time()-20*60) |
|
784 | + if ($date == "" || strtotime($date) < time() - 20*60) |
|
785 | 785 | { |
786 | 786 | $date = date("Y-m-d H:i:s", time()); |
787 | 787 | } |
788 | 788 | |
789 | - $fammarine_id = filter_var($fammarine_id,FILTER_SANITIZE_STRING); |
|
790 | - $ident = filter_var($ident,FILTER_SANITIZE_STRING); |
|
791 | - $latitude = filter_var($latitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
792 | - $longitude = filter_var($longitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
793 | - $heading = filter_var($heading,FILTER_SANITIZE_NUMBER_INT); |
|
794 | - $groundspeed = filter_var($groundspeed,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
795 | - $format_source = filter_var($format_source,FILTER_SANITIZE_STRING); |
|
796 | - $mmsi = filter_var($mmsi,FILTER_SANITIZE_STRING); |
|
797 | - $type = filter_var($type,FILTER_SANITIZE_STRING); |
|
798 | - $status = filter_var($status,FILTER_SANITIZE_STRING); |
|
799 | - $type_id = filter_var($typeid,FILTER_SANITIZE_NUMBER_INT); |
|
800 | - $status_id = filter_var($statusid,FILTER_SANITIZE_NUMBER_INT); |
|
801 | - $imo = filter_var($imo,FILTER_SANITIZE_STRING); |
|
802 | - $callsign = filter_var($callsign,FILTER_SANITIZE_STRING); |
|
803 | - $arrival_code = filter_var($arrival_code,FILTER_SANITIZE_STRING); |
|
804 | - $arrival_date = filter_var($arrival_date,FILTER_SANITIZE_STRING); |
|
805 | - $captain_id = filter_var($captain_id,FILTER_SANITIZE_STRING); |
|
806 | - $captain_name = filter_var($captain_name,FILTER_SANITIZE_STRING); |
|
807 | - $race_id = filter_var($race_id,FILTER_SANITIZE_STRING); |
|
808 | - $race_name = filter_var($race_name,FILTER_SANITIZE_STRING); |
|
789 | + $fammarine_id = filter_var($fammarine_id, FILTER_SANITIZE_STRING); |
|
790 | + $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
|
791 | + $latitude = filter_var($latitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
792 | + $longitude = filter_var($longitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
793 | + $heading = filter_var($heading, FILTER_SANITIZE_NUMBER_INT); |
|
794 | + $groundspeed = filter_var($groundspeed, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
795 | + $format_source = filter_var($format_source, FILTER_SANITIZE_STRING); |
|
796 | + $mmsi = filter_var($mmsi, FILTER_SANITIZE_STRING); |
|
797 | + $type = filter_var($type, FILTER_SANITIZE_STRING); |
|
798 | + $status = filter_var($status, FILTER_SANITIZE_STRING); |
|
799 | + $type_id = filter_var($typeid, FILTER_SANITIZE_NUMBER_INT); |
|
800 | + $status_id = filter_var($statusid, FILTER_SANITIZE_NUMBER_INT); |
|
801 | + $imo = filter_var($imo, FILTER_SANITIZE_STRING); |
|
802 | + $callsign = filter_var($callsign, FILTER_SANITIZE_STRING); |
|
803 | + $arrival_code = filter_var($arrival_code, FILTER_SANITIZE_STRING); |
|
804 | + $arrival_date = filter_var($arrival_date, FILTER_SANITIZE_STRING); |
|
805 | + $captain_id = filter_var($captain_id, FILTER_SANITIZE_STRING); |
|
806 | + $captain_name = filter_var($captain_name, FILTER_SANITIZE_STRING); |
|
807 | + $race_id = filter_var($race_id, FILTER_SANITIZE_STRING); |
|
808 | + $race_name = filter_var($race_name, FILTER_SANITIZE_STRING); |
|
809 | 809 | if (isset($globalMarineImageFetch) && $globalMarineImageFetch === TRUE) { |
810 | 810 | $Image = new Image($this->db); |
811 | - $image_array = $Image->getMarineImage($mmsi,$imo,$ident); |
|
811 | + $image_array = $Image->getMarineImage($mmsi, $imo, $ident); |
|
812 | 812 | if (!isset($image_array[0]['mmsi'])) { |
813 | - $Image->addMarineImage($mmsi,$imo,$ident); |
|
813 | + $Image->addMarineImage($mmsi, $imo, $ident); |
|
814 | 814 | } |
815 | 815 | unset($Image); |
816 | 816 | } |
@@ -823,10 +823,10 @@ discard block |
||
823 | 823 | if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0; |
824 | 824 | if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0; |
825 | 825 | if ($arrival_date == '') $arrival_date = NULL; |
826 | - $query = "INSERT INTO marine_output (fammarine_id, ident, latitude, longitude, heading, ground_speed, date, format_source, source_name, mmsi, type, type_id, status,status_id,imo,arrival_port_name,arrival_port_date,captain_id,captain_name,race_id,race_name) |
|
826 | + $query = "INSERT INTO marine_output (fammarine_id, ident, latitude, longitude, heading, ground_speed, date, format_source, source_name, mmsi, type, type_id, status,status_id,imo,arrival_port_name,arrival_port_date,captain_id,captain_name,race_id,race_name) |
|
827 | 827 | VALUES (:fammarine_id,:ident,:latitude,:longitude,:heading,:speed,:date,:format_source, :source_name,:mmsi,:type,:type_id,:status,:status_id,:imo,:arrival_port_name,:arrival_port_date,:captain_id,:captain_name,:race_id,:race_name)"; |
828 | 828 | |
829 | - $query_values = array(':fammarine_id' => $fammarine_id,':ident' => $ident,':latitude' => $latitude,':longitude' => $longitude,':heading' => $heading,':speed' => $groundspeed,':date' => $date,':format_source' => $format_source, ':source_name' => $source_name,':mmsi' => $mmsi,':type' => $type,':type_id' => $type_id,':status' => $status,':status_id' => $status_id,':imo' => $imo,':arrival_port_name' => $arrival_code,':arrival_port_date' => $arrival_date,':captain_id' => $captain_id,':captain_name' => $captain_name,':race_id' => $race_id,':race_name' => $race_name); |
|
829 | + $query_values = array(':fammarine_id' => $fammarine_id, ':ident' => $ident, ':latitude' => $latitude, ':longitude' => $longitude, ':heading' => $heading, ':speed' => $groundspeed, ':date' => $date, ':format_source' => $format_source, ':source_name' => $source_name, ':mmsi' => $mmsi, ':type' => $type, ':type_id' => $type_id, ':status' => $status, ':status_id' => $status_id, ':imo' => $imo, ':arrival_port_name' => $arrival_code, ':arrival_port_date' => $arrival_date, ':captain_id' => $captain_id, ':captain_name' => $captain_name, ':race_id' => $race_id, ':race_name' => $race_name); |
|
830 | 830 | try { |
831 | 831 | $sth = $this->db->prepare($query); |
832 | 832 | $sth->execute($query_values); |
@@ -850,13 +850,13 @@ discard block |
||
850 | 850 | { |
851 | 851 | global $globalDBdriver, $globalTimezone; |
852 | 852 | if ($globalDBdriver == 'mysql') { |
853 | - $query = "SELECT marine_output.ident FROM marine_output |
|
853 | + $query = "SELECT marine_output.ident FROM marine_output |
|
854 | 854 | WHERE marine_output.ident = :ident |
855 | 855 | AND marine_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 HOUR) |
856 | 856 | AND marine_output.date < UTC_TIMESTAMP()"; |
857 | 857 | $query_data = array(':ident' => $ident); |
858 | 858 | } else { |
859 | - $query = "SELECT marine_output.ident FROM marine_output |
|
859 | + $query = "SELECT marine_output.ident FROM marine_output |
|
860 | 860 | WHERE marine_output.ident = :ident |
861 | 861 | AND marine_output.date >= now() AT TIME ZONE 'UTC' - INTERVAL '1 HOURS' |
862 | 862 | AND marine_output.date < now() AT TIME ZONE 'UTC'"; |
@@ -865,8 +865,8 @@ discard block |
||
865 | 865 | |
866 | 866 | $sth = $this->db->prepare($query); |
867 | 867 | $sth->execute($query_data); |
868 | - $ident_result=''; |
|
869 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
868 | + $ident_result = ''; |
|
869 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
870 | 870 | { |
871 | 871 | $ident_result = $row['ident']; |
872 | 872 | } |
@@ -892,8 +892,8 @@ discard block |
||
892 | 892 | return false; |
893 | 893 | } else { |
894 | 894 | $q_array = explode(" ", $q); |
895 | - foreach ($q_array as $q_item){ |
|
896 | - $q_item = filter_var($q_item,FILTER_SANITIZE_STRING); |
|
895 | + foreach ($q_array as $q_item) { |
|
896 | + $q_item = filter_var($q_item, FILTER_SANITIZE_STRING); |
|
897 | 897 | $additional_query .= " AND ("; |
898 | 898 | $additional_query .= "(marine_output.ident like '%".$q_item."%')"; |
899 | 899 | $additional_query .= ")"; |
@@ -901,11 +901,11 @@ discard block |
||
901 | 901 | } |
902 | 902 | } |
903 | 903 | if ($globalDBdriver == 'mysql') { |
904 | - $query = "SELECT marine_output.* FROM marine_output |
|
904 | + $query = "SELECT marine_output.* FROM marine_output |
|
905 | 905 | WHERE marine_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 20 SECOND) ".$additional_query." |
906 | 906 | AND marine_output.date < UTC_TIMESTAMP()"; |
907 | 907 | } else { |
908 | - $query = "SELECT marine_output.* FROM marine_output |
|
908 | + $query = "SELECT marine_output.* FROM marine_output |
|
909 | 909 | WHERE marine_output.date::timestamp >= CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '20 SECONDS' ".$additional_query." |
910 | 910 | AND marine_output.date::timestamp < CURRENT_TIMESTAMP AT TIME ZONE 'UTC'"; |
911 | 911 | } |
@@ -924,16 +924,16 @@ discard block |
||
924 | 924 | * |
925 | 925 | */ |
926 | 926 | |
927 | - public function countAllMarineOverCountries($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array()) |
|
927 | + public function countAllMarineOverCountries($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array()) |
|
928 | 928 | { |
929 | 929 | global $globalDBdriver, $globalArchive; |
930 | 930 | //$filter_query = $this->getFilter($filters,true,true); |
931 | - $Connection= new Connection($this->db); |
|
931 | + $Connection = new Connection($this->db); |
|
932 | 932 | if (!$Connection->tableExists('countries')) return array(); |
933 | 933 | require_once('class.SpotterLive.php'); |
934 | 934 | if (!isset($globalArchive) || $globalArchive !== TRUE) { |
935 | 935 | $MarineLive = new MarineLive($this->db); |
936 | - $filter_query = $MarineLive->getFilter($filters,true,true); |
|
936 | + $filter_query = $MarineLive->getFilter($filters, true, true); |
|
937 | 937 | $filter_query .= " over_country IS NOT NULL AND over_country <> ''"; |
938 | 938 | if ($olderthanmonths > 0) { |
939 | 939 | if ($globalDBdriver == 'mysql') { |
@@ -953,7 +953,7 @@ discard block |
||
953 | 953 | } else { |
954 | 954 | require_once(dirname(__FILE__)."/class.MarineArchive.php"); |
955 | 955 | $MarineArchive = new MarineArchive($this->db); |
956 | - $filter_query = $MarineArchive->getFilter($filters,true,true); |
|
956 | + $filter_query = $MarineArchive->getFilter($filters, true, true); |
|
957 | 957 | $filter_query .= " over_country <> ''"; |
958 | 958 | if ($olderthanmonths > 0) { |
959 | 959 | if ($globalDBdriver == 'mysql') { |
@@ -981,7 +981,7 @@ discard block |
||
981 | 981 | $flight_array = array(); |
982 | 982 | $temp_array = array(); |
983 | 983 | |
984 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
984 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
985 | 985 | { |
986 | 986 | $temp_array['marine_count'] = $row['nb']; |
987 | 987 | $temp_array['marine_country'] = $row['name']; |
@@ -1000,11 +1000,11 @@ discard block |
||
1000 | 1000 | * @return Array the callsign list |
1001 | 1001 | * |
1002 | 1002 | */ |
1003 | - public function countAllCallsigns($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array(),$year = '', $month = '', $day = '') |
|
1003 | + public function countAllCallsigns($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array(), $year = '', $month = '', $day = '') |
|
1004 | 1004 | { |
1005 | 1005 | global $globalDBdriver; |
1006 | - $filter_query = $this->getFilter($filters,true,true); |
|
1007 | - $query = "SELECT DISTINCT marine_output.ident, COUNT(marine_output.ident) AS callsign_icao_count |
|
1006 | + $filter_query = $this->getFilter($filters, true, true); |
|
1007 | + $query = "SELECT DISTINCT marine_output.ident, COUNT(marine_output.ident) AS callsign_icao_count |
|
1008 | 1008 | FROM marine_output".$filter_query." marine_output.ident <> ''"; |
1009 | 1009 | if ($olderthanmonths > 0) { |
1010 | 1010 | if ($globalDBdriver == 'mysql') $query .= ' AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH)'; |
@@ -1018,28 +1018,28 @@ discard block |
||
1018 | 1018 | if ($year != '') { |
1019 | 1019 | if ($globalDBdriver == 'mysql') { |
1020 | 1020 | $query .= " AND YEAR(marine_output.date) = :year"; |
1021 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
1021 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
1022 | 1022 | } else { |
1023 | 1023 | $query .= " AND EXTRACT(YEAR FROM marine_output.date) = :year"; |
1024 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
1024 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
1025 | 1025 | } |
1026 | 1026 | } |
1027 | 1027 | if ($month != '') { |
1028 | 1028 | if ($globalDBdriver == 'mysql') { |
1029 | 1029 | $query .= " AND MONTH(marine_output.date) = :month"; |
1030 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
1030 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
1031 | 1031 | } else { |
1032 | 1032 | $query .= " AND EXTRACT(MONTH FROM marine_output.date) = :month"; |
1033 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
1033 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
1034 | 1034 | } |
1035 | 1035 | } |
1036 | 1036 | if ($day != '') { |
1037 | 1037 | if ($globalDBdriver == 'mysql') { |
1038 | 1038 | $query .= " AND DAY(marine_output.date) = :day"; |
1039 | - $query_values = array_merge($query_values,array(':day' => $day)); |
|
1039 | + $query_values = array_merge($query_values, array(':day' => $day)); |
|
1040 | 1040 | } else { |
1041 | 1041 | $query .= " AND EXTRACT(DAY FROM marine_output.date) = :day"; |
1042 | - $query_values = array_merge($query_values,array(':day' => $day)); |
|
1042 | + $query_values = array_merge($query_values, array(':day' => $day)); |
|
1043 | 1043 | } |
1044 | 1044 | } |
1045 | 1045 | $query .= " GROUP BY marine_output.ident ORDER BY callsign_icao_count DESC"; |
@@ -1051,7 +1051,7 @@ discard block |
||
1051 | 1051 | $callsign_array = array(); |
1052 | 1052 | $temp_array = array(); |
1053 | 1053 | |
1054 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1054 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1055 | 1055 | { |
1056 | 1056 | $temp_array['callsign_icao'] = $row['ident']; |
1057 | 1057 | $temp_array['airline_name'] = $row['airline_name']; |
@@ -1103,7 +1103,7 @@ discard block |
||
1103 | 1103 | $date_array = array(); |
1104 | 1104 | $temp_array = array(); |
1105 | 1105 | |
1106 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1106 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1107 | 1107 | { |
1108 | 1108 | $temp_array['date_name'] = $row['date_name']; |
1109 | 1109 | $temp_array['date_count'] = $row['date_count']; |
@@ -1129,7 +1129,7 @@ discard block |
||
1129 | 1129 | $datetime = new DateTime(); |
1130 | 1130 | $offset = $datetime->format('P'); |
1131 | 1131 | } else $offset = '+00:00'; |
1132 | - $filter_query = $this->getFilter($filters,true,true); |
|
1132 | + $filter_query = $this->getFilter($filters, true, true); |
|
1133 | 1133 | if ($globalDBdriver == 'mysql') { |
1134 | 1134 | $query = "SELECT DATE(CONVERT_TZ(marine_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count |
1135 | 1135 | FROM marine_output".$filter_query." marine_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 7 DAY)"; |
@@ -1150,7 +1150,7 @@ discard block |
||
1150 | 1150 | $date_array = array(); |
1151 | 1151 | $temp_array = array(); |
1152 | 1152 | |
1153 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1153 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1154 | 1154 | { |
1155 | 1155 | $temp_array['date_name'] = $row['date_name']; |
1156 | 1156 | $temp_array['date_count'] = $row['date_count']; |
@@ -1175,7 +1175,7 @@ discard block |
||
1175 | 1175 | $datetime = new DateTime(); |
1176 | 1176 | $offset = $datetime->format('P'); |
1177 | 1177 | } else $offset = '+00:00'; |
1178 | - $filter_query = $this->getFilter($filters,true,true); |
|
1178 | + $filter_query = $this->getFilter($filters, true, true); |
|
1179 | 1179 | if ($globalDBdriver == 'mysql') { |
1180 | 1180 | $query = "SELECT DATE(CONVERT_TZ(marine_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count |
1181 | 1181 | FROM marine_output".$filter_query." marine_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MONTH)"; |
@@ -1196,7 +1196,7 @@ discard block |
||
1196 | 1196 | $date_array = array(); |
1197 | 1197 | $temp_array = array(); |
1198 | 1198 | |
1199 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1199 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1200 | 1200 | { |
1201 | 1201 | $temp_array['date_name'] = $row['date_name']; |
1202 | 1202 | $temp_array['date_count'] = $row['date_count']; |
@@ -1243,7 +1243,7 @@ discard block |
||
1243 | 1243 | $date_array = array(); |
1244 | 1244 | $temp_array = array(); |
1245 | 1245 | |
1246 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1246 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1247 | 1247 | { |
1248 | 1248 | $temp_array['month_name'] = $row['month_name']; |
1249 | 1249 | $temp_array['year_name'] = $row['year_name']; |
@@ -1272,7 +1272,7 @@ discard block |
||
1272 | 1272 | $datetime = new DateTime(); |
1273 | 1273 | $offset = $datetime->format('P'); |
1274 | 1274 | } else $offset = '+00:00'; |
1275 | - $filter_query = $this->getFilter($filters,true,true); |
|
1275 | + $filter_query = $this->getFilter($filters, true, true); |
|
1276 | 1276 | if ($globalDBdriver == 'mysql') { |
1277 | 1277 | $query = "SELECT MONTH(CONVERT_TZ(marine_output.date,'+00:00', :offset)) AS month_name, YEAR(CONVERT_TZ(marine_output.date,'+00:00', :offset)) AS year_name, count(*) as date_count |
1278 | 1278 | FROM marine_output".$filter_query." marine_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 YEAR)"; |
@@ -1293,7 +1293,7 @@ discard block |
||
1293 | 1293 | $date_array = array(); |
1294 | 1294 | $temp_array = array(); |
1295 | 1295 | |
1296 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1296 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1297 | 1297 | { |
1298 | 1298 | $temp_array['year_name'] = $row['year_name']; |
1299 | 1299 | $temp_array['month_name'] = $row['month_name']; |
@@ -1313,7 +1313,7 @@ discard block |
||
1313 | 1313 | * @return Array the hour list |
1314 | 1314 | * |
1315 | 1315 | */ |
1316 | - public function countAllHours($orderby,$filters = array()) |
|
1316 | + public function countAllHours($orderby, $filters = array()) |
|
1317 | 1317 | { |
1318 | 1318 | global $globalTimezone, $globalDBdriver; |
1319 | 1319 | if ($globalTimezone != '') { |
@@ -1361,7 +1361,7 @@ discard block |
||
1361 | 1361 | $hour_array = array(); |
1362 | 1362 | $temp_array = array(); |
1363 | 1363 | |
1364 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1364 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1365 | 1365 | { |
1366 | 1366 | $temp_array['hour_name'] = $row['hour_name']; |
1367 | 1367 | $temp_array['hour_count'] = $row['hour_count']; |
@@ -1383,8 +1383,8 @@ discard block |
||
1383 | 1383 | public function countAllHoursByDate($date, $filters = array()) |
1384 | 1384 | { |
1385 | 1385 | global $globalTimezone, $globalDBdriver; |
1386 | - $filter_query = $this->getFilter($filters,true,true); |
|
1387 | - $date = filter_var($date,FILTER_SANITIZE_STRING); |
|
1386 | + $filter_query = $this->getFilter($filters, true, true); |
|
1387 | + $date = filter_var($date, FILTER_SANITIZE_STRING); |
|
1388 | 1388 | if ($globalTimezone != '') { |
1389 | 1389 | date_default_timezone_set($globalTimezone); |
1390 | 1390 | $datetime = new DateTime($date); |
@@ -1392,12 +1392,12 @@ discard block |
||
1392 | 1392 | } else $offset = '+00:00'; |
1393 | 1393 | |
1394 | 1394 | if ($globalDBdriver == 'mysql') { |
1395 | - $query = "SELECT HOUR(CONVERT_TZ(marine_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
1395 | + $query = "SELECT HOUR(CONVERT_TZ(marine_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
1396 | 1396 | FROM marine_output".$filter_query." DATE(CONVERT_TZ(marine_output.date,'+00:00', :offset)) = :date |
1397 | 1397 | GROUP BY hour_name |
1398 | 1398 | ORDER BY hour_name ASC"; |
1399 | 1399 | } else { |
1400 | - $query = "SELECT EXTRACT(HOUR FROM marine_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
1400 | + $query = "SELECT EXTRACT(HOUR FROM marine_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
1401 | 1401 | FROM marine_output".$filter_query." to_char(marine_output.date AT TIME ZONE INTERVAL :offset, 'YYYY-mm-dd') = :date |
1402 | 1402 | GROUP BY hour_name |
1403 | 1403 | ORDER BY hour_name ASC"; |
@@ -1409,7 +1409,7 @@ discard block |
||
1409 | 1409 | $hour_array = array(); |
1410 | 1410 | $temp_array = array(); |
1411 | 1411 | |
1412 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1412 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1413 | 1413 | { |
1414 | 1414 | $temp_array['hour_name'] = $row['hour_name']; |
1415 | 1415 | $temp_array['hour_count'] = $row['hour_count']; |
@@ -1431,8 +1431,8 @@ discard block |
||
1431 | 1431 | public function countAllHoursByIdent($ident, $filters = array()) |
1432 | 1432 | { |
1433 | 1433 | global $globalTimezone, $globalDBdriver; |
1434 | - $filter_query = $this->getFilter($filters,true,true); |
|
1435 | - $ident = filter_var($ident,FILTER_SANITIZE_STRING); |
|
1434 | + $filter_query = $this->getFilter($filters, true, true); |
|
1435 | + $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
|
1436 | 1436 | if ($globalTimezone != '') { |
1437 | 1437 | date_default_timezone_set($globalTimezone); |
1438 | 1438 | $datetime = new DateTime(); |
@@ -1440,12 +1440,12 @@ discard block |
||
1440 | 1440 | } else $offset = '+00:00'; |
1441 | 1441 | |
1442 | 1442 | if ($globalDBdriver == 'mysql') { |
1443 | - $query = "SELECT HOUR(CONVERT_TZ(marine_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
1443 | + $query = "SELECT HOUR(CONVERT_TZ(marine_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
1444 | 1444 | FROM marine_output".$filter_query." marine_output.ident = :ident |
1445 | 1445 | GROUP BY hour_name |
1446 | 1446 | ORDER BY hour_name ASC"; |
1447 | 1447 | } else { |
1448 | - $query = "SELECT EXTRACT(HOUR FROM marine_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
1448 | + $query = "SELECT EXTRACT(HOUR FROM marine_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
1449 | 1449 | FROM marine_output".$filter_query." marine_output.ident = :ident |
1450 | 1450 | GROUP BY hour_name |
1451 | 1451 | ORDER BY hour_name ASC"; |
@@ -1453,12 +1453,12 @@ discard block |
||
1453 | 1453 | |
1454 | 1454 | |
1455 | 1455 | $sth = $this->db->prepare($query); |
1456 | - $sth->execute(array(':ident' => $ident,':offset' => $offset)); |
|
1456 | + $sth->execute(array(':ident' => $ident, ':offset' => $offset)); |
|
1457 | 1457 | |
1458 | 1458 | $hour_array = array(); |
1459 | 1459 | $temp_array = array(); |
1460 | 1460 | |
1461 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1461 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1462 | 1462 | { |
1463 | 1463 | $temp_array['hour_name'] = $row['hour_name']; |
1464 | 1464 | $temp_array['hour_count'] = $row['hour_count']; |
@@ -1477,33 +1477,33 @@ discard block |
||
1477 | 1477 | * @return Integer the number of vessels |
1478 | 1478 | * |
1479 | 1479 | */ |
1480 | - public function countOverallMarine($filters = array(),$year = '',$month = '') |
|
1480 | + public function countOverallMarine($filters = array(), $year = '', $month = '') |
|
1481 | 1481 | { |
1482 | 1482 | global $globalDBdriver; |
1483 | 1483 | //$queryi = "SELECT COUNT(marine_output.marine_id) AS flight_count FROM marine_output"; |
1484 | - $queryi = "SELECT COUNT(DISTINCT marine_output.mmsi) AS flight_count FROM marine_output"; |
|
1484 | + $queryi = "SELECT COUNT(DISTINCT marine_output.mmsi) AS flight_count FROM marine_output"; |
|
1485 | 1485 | $query_values = array(); |
1486 | 1486 | $query = ''; |
1487 | 1487 | if ($year != '') { |
1488 | 1488 | if ($globalDBdriver == 'mysql') { |
1489 | 1489 | $query .= " AND YEAR(marine_output.date) = :year"; |
1490 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
1490 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
1491 | 1491 | } else { |
1492 | 1492 | $query .= " AND EXTRACT(YEAR FROM marine_output.date) = :year"; |
1493 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
1493 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
1494 | 1494 | } |
1495 | 1495 | } |
1496 | 1496 | if ($month != '') { |
1497 | 1497 | if ($globalDBdriver == 'mysql') { |
1498 | 1498 | $query .= " AND MONTH(marine_output.date) = :month"; |
1499 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
1499 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
1500 | 1500 | } else { |
1501 | 1501 | $query .= " AND EXTRACT(MONTH FROM marine_output.date) = :month"; |
1502 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
1502 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
1503 | 1503 | } |
1504 | 1504 | } |
1505 | 1505 | if (empty($query_values)) $queryi .= $this->getFilter($filters); |
1506 | - else $queryi .= $this->getFilter($filters,true,true).substr($query,4); |
|
1506 | + else $queryi .= $this->getFilter($filters, true, true).substr($query, 4); |
|
1507 | 1507 | |
1508 | 1508 | $sth = $this->db->prepare($queryi); |
1509 | 1509 | $sth->execute($query_values); |
@@ -1516,32 +1516,32 @@ discard block |
||
1516 | 1516 | * @return Integer the number of vessels |
1517 | 1517 | * |
1518 | 1518 | */ |
1519 | - public function countOverallMarineTypes($filters = array(),$year = '',$month = '') |
|
1519 | + public function countOverallMarineTypes($filters = array(), $year = '', $month = '') |
|
1520 | 1520 | { |
1521 | 1521 | global $globalDBdriver; |
1522 | - $queryi = "SELECT COUNT(DISTINCT marine_output.type) AS marine_count FROM marine_output"; |
|
1522 | + $queryi = "SELECT COUNT(DISTINCT marine_output.type) AS marine_count FROM marine_output"; |
|
1523 | 1523 | $query_values = array(); |
1524 | 1524 | $query = ''; |
1525 | 1525 | if ($year != '') { |
1526 | 1526 | if ($globalDBdriver == 'mysql') { |
1527 | 1527 | $query .= " AND YEAR(marine_output.date) = :year"; |
1528 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
1528 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
1529 | 1529 | } else { |
1530 | 1530 | $query .= " AND EXTRACT(YEAR FROM marine_output.date) = :year"; |
1531 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
1531 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
1532 | 1532 | } |
1533 | 1533 | } |
1534 | 1534 | if ($month != '') { |
1535 | 1535 | if ($globalDBdriver == 'mysql') { |
1536 | 1536 | $query .= " AND MONTH(marine_output.date) = :month"; |
1537 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
1537 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
1538 | 1538 | } else { |
1539 | 1539 | $query .= " AND EXTRACT(MONTH FROM marine_output.date) = :month"; |
1540 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
1540 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
1541 | 1541 | } |
1542 | 1542 | } |
1543 | 1543 | if (empty($query_values)) $queryi .= $this->getFilter($filters); |
1544 | - else $queryi .= $this->getFilter($filters,true,true).substr($query,4); |
|
1544 | + else $queryi .= $this->getFilter($filters, true, true).substr($query, 4); |
|
1545 | 1545 | |
1546 | 1546 | $sth = $this->db->prepare($queryi); |
1547 | 1547 | $sth->execute($query_values); |
@@ -1558,7 +1558,7 @@ discard block |
||
1558 | 1558 | public function countAllHoursFromToday($filters = array()) |
1559 | 1559 | { |
1560 | 1560 | global $globalTimezone, $globalDBdriver; |
1561 | - $filter_query = $this->getFilter($filters,true,true); |
|
1561 | + $filter_query = $this->getFilter($filters, true, true); |
|
1562 | 1562 | if ($globalTimezone != '') { |
1563 | 1563 | date_default_timezone_set($globalTimezone); |
1564 | 1564 | $datetime = new DateTime(); |
@@ -1566,12 +1566,12 @@ discard block |
||
1566 | 1566 | } else $offset = '+00:00'; |
1567 | 1567 | |
1568 | 1568 | if ($globalDBdriver == 'mysql') { |
1569 | - $query = "SELECT HOUR(CONVERT_TZ(marine_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
1569 | + $query = "SELECT HOUR(CONVERT_TZ(marine_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
1570 | 1570 | FROM marine_output".$filter_query." DATE(CONVERT_TZ(marine_output.date,'+00:00', :offset)) = CURDATE() |
1571 | 1571 | GROUP BY hour_name |
1572 | 1572 | ORDER BY hour_name ASC"; |
1573 | 1573 | } else { |
1574 | - $query = "SELECT EXTRACT(HOUR FROM marine_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
1574 | + $query = "SELECT EXTRACT(HOUR FROM marine_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
1575 | 1575 | FROM marine_output".$filter_query." to_char(marine_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = CAST(NOW() AS date) |
1576 | 1576 | GROUP BY hour_name |
1577 | 1577 | ORDER BY hour_name ASC"; |
@@ -1583,7 +1583,7 @@ discard block |
||
1583 | 1583 | $hour_array = array(); |
1584 | 1584 | $temp_array = array(); |
1585 | 1585 | |
1586 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1586 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1587 | 1587 | { |
1588 | 1588 | $temp_array['hour_name'] = $row['hour_name']; |
1589 | 1589 | $temp_array['hour_count'] = $row['hour_count']; |
@@ -1602,9 +1602,9 @@ discard block |
||
1602 | 1602 | */ |
1603 | 1603 | public function getMarineIDBasedOnFamMarineID($fammarine_id) |
1604 | 1604 | { |
1605 | - $fammarine_id = filter_var($fammarine_id,FILTER_SANITIZE_STRING); |
|
1605 | + $fammarine_id = filter_var($fammarine_id, FILTER_SANITIZE_STRING); |
|
1606 | 1606 | |
1607 | - $query = "SELECT marine_output.marine_id |
|
1607 | + $query = "SELECT marine_output.marine_id |
|
1608 | 1608 | FROM marine_output |
1609 | 1609 | WHERE marine_output.fammarine_id = '".$fammarine_id."'"; |
1610 | 1610 | |
@@ -1612,7 +1612,7 @@ discard block |
||
1612 | 1612 | $sth = $this->db->prepare($query); |
1613 | 1613 | $sth->execute(); |
1614 | 1614 | |
1615 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1615 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1616 | 1616 | { |
1617 | 1617 | return $row['marine_id']; |
1618 | 1618 | } |
@@ -1637,23 +1637,23 @@ discard block |
||
1637 | 1637 | } |
1638 | 1638 | |
1639 | 1639 | $current_date = date("Y-m-d H:i:s"); |
1640 | - $date = date("Y-m-d H:i:s",strtotime($dateString." UTC")); |
|
1640 | + $date = date("Y-m-d H:i:s", strtotime($dateString." UTC")); |
|
1641 | 1641 | |
1642 | 1642 | $diff = abs(strtotime($current_date) - strtotime($date)); |
1643 | 1643 | |
1644 | - $time_array['years'] = floor($diff / (365*60*60*24)); |
|
1644 | + $time_array['years'] = floor($diff/(365*60*60*24)); |
|
1645 | 1645 | $years = $time_array['years']; |
1646 | 1646 | |
1647 | - $time_array['months'] = floor(($diff - $years * 365*60*60*24) / (30*60*60*24)); |
|
1647 | + $time_array['months'] = floor(($diff - $years*365*60*60*24)/(30*60*60*24)); |
|
1648 | 1648 | $months = $time_array['months']; |
1649 | 1649 | |
1650 | - $time_array['days'] = floor(($diff - $years * 365*60*60*24 - $months*30*60*60*24)/ (60*60*24)); |
|
1650 | + $time_array['days'] = floor(($diff - $years*365*60*60*24 - $months*30*60*60*24)/(60*60*24)); |
|
1651 | 1651 | $days = $time_array['days']; |
1652 | - $time_array['hours'] = floor(($diff - $years * 365*60*60*24 - $months*30*60*60*24 - $days*60*60*24)/ (60*60)); |
|
1652 | + $time_array['hours'] = floor(($diff - $years*365*60*60*24 - $months*30*60*60*24 - $days*60*60*24)/(60*60)); |
|
1653 | 1653 | $hours = $time_array['hours']; |
1654 | - $time_array['minutes'] = floor(($diff - $years * 365*60*60*24 - $months*30*60*60*24 - $days*60*60*24 - $hours*60*60)/ 60); |
|
1654 | + $time_array['minutes'] = floor(($diff - $years*365*60*60*24 - $months*30*60*60*24 - $days*60*60*24 - $hours*60*60)/60); |
|
1655 | 1655 | $minutes = $time_array['minutes']; |
1656 | - $time_array['seconds'] = floor(($diff - $years * 365*60*60*24 - $months*30*60*60*24 - $days*60*60*24 - $hours*60*60 - $minutes*60)); |
|
1656 | + $time_array['seconds'] = floor(($diff - $years*365*60*60*24 - $months*30*60*60*24 - $days*60*60*24 - $hours*60*60 - $minutes*60)); |
|
1657 | 1657 | |
1658 | 1658 | return $time_array; |
1659 | 1659 | } |
@@ -1676,63 +1676,63 @@ discard block |
||
1676 | 1676 | $temp_array['direction_degree'] = $direction; |
1677 | 1677 | $temp_array['direction_shortname'] = "N"; |
1678 | 1678 | $temp_array['direction_fullname'] = "North"; |
1679 | - } elseif ($direction >= 22.5 && $direction < 45){ |
|
1679 | + } elseif ($direction >= 22.5 && $direction < 45) { |
|
1680 | 1680 | $temp_array['direction_degree'] = $direction; |
1681 | 1681 | $temp_array['direction_shortname'] = "NNE"; |
1682 | 1682 | $temp_array['direction_fullname'] = "North-Northeast"; |
1683 | - } elseif ($direction >= 45 && $direction < 67.5){ |
|
1683 | + } elseif ($direction >= 45 && $direction < 67.5) { |
|
1684 | 1684 | $temp_array['direction_degree'] = $direction; |
1685 | 1685 | $temp_array['direction_shortname'] = "NE"; |
1686 | 1686 | $temp_array['direction_fullname'] = "Northeast"; |
1687 | - } elseif ($direction >= 67.5 && $direction < 90){ |
|
1687 | + } elseif ($direction >= 67.5 && $direction < 90) { |
|
1688 | 1688 | $temp_array['direction_degree'] = $direction; |
1689 | 1689 | $temp_array['direction_shortname'] = "ENE"; |
1690 | 1690 | $temp_array['direction_fullname'] = "East-Northeast"; |
1691 | - } elseif ($direction >= 90 && $direction < 112.5){ |
|
1691 | + } elseif ($direction >= 90 && $direction < 112.5) { |
|
1692 | 1692 | $temp_array['direction_degree'] = $direction; |
1693 | 1693 | $temp_array['direction_shortname'] = "E"; |
1694 | 1694 | $temp_array['direction_fullname'] = "East"; |
1695 | - } elseif ($direction >= 112.5 && $direction < 135){ |
|
1695 | + } elseif ($direction >= 112.5 && $direction < 135) { |
|
1696 | 1696 | $temp_array['direction_degree'] = $direction; |
1697 | 1697 | $temp_array['direction_shortname'] = "ESE"; |
1698 | 1698 | $temp_array['direction_fullname'] = "East-Southeast"; |
1699 | - } elseif ($direction >= 135 && $direction < 157.5){ |
|
1699 | + } elseif ($direction >= 135 && $direction < 157.5) { |
|
1700 | 1700 | $temp_array['direction_degree'] = $direction; |
1701 | 1701 | $temp_array['direction_shortname'] = "SE"; |
1702 | 1702 | $temp_array['direction_fullname'] = "Southeast"; |
1703 | - } elseif ($direction >= 157.5 && $direction < 180){ |
|
1703 | + } elseif ($direction >= 157.5 && $direction < 180) { |
|
1704 | 1704 | $temp_array['direction_degree'] = $direction; |
1705 | 1705 | $temp_array['direction_shortname'] = "SSE"; |
1706 | 1706 | $temp_array['direction_fullname'] = "South-Southeast"; |
1707 | - } elseif ($direction >= 180 && $direction < 202.5){ |
|
1707 | + } elseif ($direction >= 180 && $direction < 202.5) { |
|
1708 | 1708 | $temp_array['direction_degree'] = $direction; |
1709 | 1709 | $temp_array['direction_shortname'] = "S"; |
1710 | 1710 | $temp_array['direction_fullname'] = "South"; |
1711 | - } elseif ($direction >= 202.5 && $direction < 225){ |
|
1711 | + } elseif ($direction >= 202.5 && $direction < 225) { |
|
1712 | 1712 | $temp_array['direction_degree'] = $direction; |
1713 | 1713 | $temp_array['direction_shortname'] = "SSW"; |
1714 | 1714 | $temp_array['direction_fullname'] = "South-Southwest"; |
1715 | - } elseif ($direction >= 225 && $direction < 247.5){ |
|
1715 | + } elseif ($direction >= 225 && $direction < 247.5) { |
|
1716 | 1716 | $temp_array['direction_degree'] = $direction; |
1717 | 1717 | $temp_array['direction_shortname'] = "SW"; |
1718 | 1718 | $temp_array['direction_fullname'] = "Southwest"; |
1719 | - } elseif ($direction >= 247.5 && $direction < 270){ |
|
1719 | + } elseif ($direction >= 247.5 && $direction < 270) { |
|
1720 | 1720 | $temp_array['direction_degree'] = $direction; |
1721 | 1721 | $temp_array['direction_shortname'] = "WSW"; |
1722 | 1722 | $temp_array['direction_fullname'] = "West-Southwest"; |
1723 | - } elseif ($direction >= 270 && $direction < 292.5){ |
|
1723 | + } elseif ($direction >= 270 && $direction < 292.5) { |
|
1724 | 1724 | $temp_array['direction_degree'] = $direction; |
1725 | 1725 | $temp_array['direction_shortname'] = "W"; |
1726 | 1726 | $temp_array['direction_fullname'] = "West"; |
1727 | - } elseif ($direction >= 292.5 && $direction < 315){ |
|
1727 | + } elseif ($direction >= 292.5 && $direction < 315) { |
|
1728 | 1728 | $temp_array['direction_degree'] = $direction; |
1729 | 1729 | $temp_array['direction_shortname'] = "WNW"; |
1730 | 1730 | $temp_array['direction_fullname'] = "West-Northwest"; |
1731 | - } elseif ($direction >= 315 && $direction < 337.5){ |
|
1731 | + } elseif ($direction >= 315 && $direction < 337.5) { |
|
1732 | 1732 | $temp_array['direction_degree'] = $direction; |
1733 | 1733 | $temp_array['direction_shortname'] = "NW"; |
1734 | 1734 | $temp_array['direction_fullname'] = "Northwest"; |
1735 | - } elseif ($direction >= 337.5 && $direction < 360){ |
|
1735 | + } elseif ($direction >= 337.5 && $direction < 360) { |
|
1736 | 1736 | $temp_array['direction_degree'] = $direction; |
1737 | 1737 | $temp_array['direction_shortname'] = "NNW"; |
1738 | 1738 | $temp_array['direction_fullname'] = "North-Northwest"; |
@@ -1749,11 +1749,11 @@ discard block |
||
1749 | 1749 | * @param Float $longitude longitute of the flight |
1750 | 1750 | * @return String the countrie |
1751 | 1751 | */ |
1752 | - public function getCountryFromLatitudeLongitude($latitude,$longitude) |
|
1752 | + public function getCountryFromLatitudeLongitude($latitude, $longitude) |
|
1753 | 1753 | { |
1754 | 1754 | global $globalDBdriver, $globalDebug; |
1755 | - $latitude = filter_var($latitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
1756 | - $longitude = filter_var($longitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
1755 | + $latitude = filter_var($latitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
1756 | + $longitude = filter_var($longitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
1757 | 1757 | |
1758 | 1758 | $Connection = new Connection($this->db); |
1759 | 1759 | if (!$Connection->tableExists('countries')) return ''; |
@@ -1793,7 +1793,7 @@ discard block |
||
1793 | 1793 | public function getCountryFromISO2($iso2) |
1794 | 1794 | { |
1795 | 1795 | global $globalDBdriver, $globalDebug; |
1796 | - $iso2 = filter_var($iso2,FILTER_SANITIZE_STRING); |
|
1796 | + $iso2 = filter_var($iso2, FILTER_SANITIZE_STRING); |
|
1797 | 1797 | |
1798 | 1798 | $Connection = new Connection($this->db); |
1799 | 1799 | if (!$Connection->tableExists('countries')) return ''; |
@@ -1841,7 +1841,7 @@ discard block |
||
1841 | 1841 | |
1842 | 1842 | $bitly_data = json_decode($bitly_data); |
1843 | 1843 | $bitly_url = ''; |
1844 | - if ($bitly_data->status_txt = "OK"){ |
|
1844 | + if ($bitly_data->status_txt = "OK") { |
|
1845 | 1845 | $bitly_url = $bitly_data->data->url; |
1846 | 1846 | } |
1847 | 1847 | |
@@ -1855,11 +1855,11 @@ discard block |
||
1855 | 1855 | * @return Array the vessel type list |
1856 | 1856 | * |
1857 | 1857 | */ |
1858 | - public function countAllMarineTypes($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array(),$year = '',$month = '',$day = '') |
|
1858 | + public function countAllMarineTypes($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array(), $year = '', $month = '', $day = '') |
|
1859 | 1859 | { |
1860 | 1860 | global $globalDBdriver; |
1861 | - $filter_query = $this->getFilter($filters,true,true); |
|
1862 | - $query = "SELECT marine_output.type AS marine_type, COUNT(marine_output.type) AS marine_type_count, marine_output.type_id AS marine_type_id |
|
1861 | + $filter_query = $this->getFilter($filters, true, true); |
|
1862 | + $query = "SELECT marine_output.type AS marine_type, COUNT(marine_output.type) AS marine_type_count, marine_output.type_id AS marine_type_id |
|
1863 | 1863 | FROM marine_output ".$filter_query." marine_output.type <> '' AND marine_output.type_id IS NOT NULL"; |
1864 | 1864 | if ($olderthanmonths > 0) { |
1865 | 1865 | if ($globalDBdriver == 'mysql') { |
@@ -1879,28 +1879,28 @@ discard block |
||
1879 | 1879 | if ($year != '') { |
1880 | 1880 | if ($globalDBdriver == 'mysql') { |
1881 | 1881 | $query .= " AND YEAR(marine_output.date) = :year"; |
1882 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
1882 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
1883 | 1883 | } else { |
1884 | 1884 | $query .= " AND EXTRACT(YEAR FROM marine_output.date) = :year"; |
1885 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
1885 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
1886 | 1886 | } |
1887 | 1887 | } |
1888 | 1888 | if ($month != '') { |
1889 | 1889 | if ($globalDBdriver == 'mysql') { |
1890 | 1890 | $query .= " AND MONTH(marine_output.date) = :month"; |
1891 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
1891 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
1892 | 1892 | } else { |
1893 | 1893 | $query .= " AND EXTRACT(MONTH FROM marine_output.date) = :month"; |
1894 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
1894 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
1895 | 1895 | } |
1896 | 1896 | } |
1897 | 1897 | if ($day != '') { |
1898 | 1898 | if ($globalDBdriver == 'mysql') { |
1899 | 1899 | $query .= " AND DAY(marine_output.date) = :day"; |
1900 | - $query_values = array_merge($query_values,array(':day' => $day)); |
|
1900 | + $query_values = array_merge($query_values, array(':day' => $day)); |
|
1901 | 1901 | } else { |
1902 | 1902 | $query .= " AND EXTRACT(DAY FROM marine_output.date) = :day"; |
1903 | - $query_values = array_merge($query_values,array(':day' => $day)); |
|
1903 | + $query_values = array_merge($query_values, array(':day' => $day)); |
|
1904 | 1904 | } |
1905 | 1905 | } |
1906 | 1906 | $query .= " GROUP BY marine_output.type, marine_output.type_id ORDER BY marine_type_count DESC"; |
@@ -1909,7 +1909,7 @@ discard block |
||
1909 | 1909 | $sth->execute($query_values); |
1910 | 1910 | $marine_array = array(); |
1911 | 1911 | $temp_array = array(); |
1912 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1912 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1913 | 1913 | { |
1914 | 1914 | $temp_array['marine_type'] = $row['marine_type']; |
1915 | 1915 | $temp_array['marine_type_id'] = $row['marine_type_id']; |
@@ -1925,13 +1925,13 @@ discard block |
||
1925 | 1925 | * @return Array the tracker information |
1926 | 1926 | * |
1927 | 1927 | */ |
1928 | - public function searchMarineData($q = '', $callsign = '',$mmsi = '', $imo = '', $date_posted = '', $limit = '', $sort = '', $includegeodata = '',$origLat = '',$origLon = '',$dist = '',$filters = array()) |
|
1928 | + public function searchMarineData($q = '', $callsign = '', $mmsi = '', $imo = '', $date_posted = '', $limit = '', $sort = '', $includegeodata = '', $origLat = '', $origLon = '', $dist = '', $filters = array()) |
|
1929 | 1929 | { |
1930 | 1930 | global $globalTimezone, $globalDBdriver; |
1931 | 1931 | date_default_timezone_set('UTC'); |
1932 | 1932 | $query_values = array(); |
1933 | 1933 | $additional_query = ''; |
1934 | - $filter_query = $this->getFilter($filters,true,true); |
|
1934 | + $filter_query = $this->getFilter($filters, true, true); |
|
1935 | 1935 | if ($q != "") |
1936 | 1936 | { |
1937 | 1937 | if (!is_string($q)) |
@@ -1939,8 +1939,8 @@ discard block |
||
1939 | 1939 | return false; |
1940 | 1940 | } else { |
1941 | 1941 | $q_array = explode(" ", $q); |
1942 | - foreach ($q_array as $q_item){ |
|
1943 | - $q_item = filter_var($q_item,FILTER_SANITIZE_STRING); |
|
1942 | + foreach ($q_array as $q_item) { |
|
1943 | + $q_item = filter_var($q_item, FILTER_SANITIZE_STRING); |
|
1944 | 1944 | $additional_query .= " AND ("; |
1945 | 1945 | if (is_int($q_item)) $additional_query .= "(marine_output.marine_id = '".$q_item."') OR "; |
1946 | 1946 | if (is_int($q_item)) $additional_query .= "(marine_output.mmsi = '".$q_item."') OR "; |
@@ -1952,42 +1952,42 @@ discard block |
||
1952 | 1952 | } |
1953 | 1953 | if ($callsign != "") |
1954 | 1954 | { |
1955 | - $callsign = filter_var($callsign,FILTER_SANITIZE_STRING); |
|
1955 | + $callsign = filter_var($callsign, FILTER_SANITIZE_STRING); |
|
1956 | 1956 | if (!is_string($callsign)) |
1957 | 1957 | { |
1958 | 1958 | return false; |
1959 | 1959 | } else { |
1960 | 1960 | $additional_query .= " AND marine_output.ident = :callsign"; |
1961 | - $query_values = array_merge($query_values,array(':callsign' => $callsign)); |
|
1961 | + $query_values = array_merge($query_values, array(':callsign' => $callsign)); |
|
1962 | 1962 | } |
1963 | 1963 | } |
1964 | 1964 | if ($mmsi != "") |
1965 | 1965 | { |
1966 | - $mmsi = filter_var($mmsi,FILTER_SANITIZE_STRING); |
|
1966 | + $mmsi = filter_var($mmsi, FILTER_SANITIZE_STRING); |
|
1967 | 1967 | if (!is_numeric($mmsi)) |
1968 | 1968 | { |
1969 | 1969 | return false; |
1970 | 1970 | } else { |
1971 | 1971 | $additional_query .= " AND marine_output.mmsi = :mmsi"; |
1972 | - $query_values = array_merge($query_values,array(':mmsi' => $mmsi)); |
|
1972 | + $query_values = array_merge($query_values, array(':mmsi' => $mmsi)); |
|
1973 | 1973 | } |
1974 | 1974 | } |
1975 | 1975 | if ($imo != "") |
1976 | 1976 | { |
1977 | - $imo = filter_var($imo,FILTER_SANITIZE_STRING); |
|
1977 | + $imo = filter_var($imo, FILTER_SANITIZE_STRING); |
|
1978 | 1978 | if (!is_numeric($imo)) |
1979 | 1979 | { |
1980 | 1980 | return false; |
1981 | 1981 | } else { |
1982 | 1982 | $additional_query .= " AND marine_output.imo = :imo"; |
1983 | - $query_values = array_merge($query_values,array(':imo' => $imo)); |
|
1983 | + $query_values = array_merge($query_values, array(':imo' => $imo)); |
|
1984 | 1984 | } |
1985 | 1985 | } |
1986 | 1986 | if ($date_posted != "") |
1987 | 1987 | { |
1988 | 1988 | $date_array = explode(",", $date_posted); |
1989 | - $date_array[0] = filter_var($date_array[0],FILTER_SANITIZE_STRING); |
|
1990 | - $date_array[1] = filter_var($date_array[1],FILTER_SANITIZE_STRING); |
|
1989 | + $date_array[0] = filter_var($date_array[0], FILTER_SANITIZE_STRING); |
|
1990 | + $date_array[1] = filter_var($date_array[1], FILTER_SANITIZE_STRING); |
|
1991 | 1991 | if ($globalTimezone != '') { |
1992 | 1992 | date_default_timezone_set($globalTimezone); |
1993 | 1993 | $datetime = new DateTime(); |
@@ -2014,8 +2014,8 @@ discard block |
||
2014 | 2014 | if ($limit != "") |
2015 | 2015 | { |
2016 | 2016 | $limit_array = explode(",", $limit); |
2017 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
2018 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
2017 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
2018 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
2019 | 2019 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
2020 | 2020 | { |
2021 | 2021 | $limit_query = " LIMIT ".$limit_array[1]." OFFSET ".$limit_array[0]; |
@@ -2033,28 +2033,28 @@ discard block |
||
2033 | 2033 | } |
2034 | 2034 | } |
2035 | 2035 | if ($origLat != "" && $origLon != "" && $dist != "") { |
2036 | - $dist = number_format($dist*0.621371,2,'.',''); // convert km to mile |
|
2036 | + $dist = number_format($dist*0.621371, 2, '.', ''); // convert km to mile |
|
2037 | 2037 | if ($globalDBdriver == 'mysql') { |
2038 | - $query="SELECT marine_output.*, 1.60935*3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - marine_archive.latitude)*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(marine_archive.latitude*pi()/180)*POWER(SIN(($origLon-marine_archive.longitude)*pi()/180/2),2))) as distance |
|
2038 | + $query = "SELECT marine_output.*, 1.60935*3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - marine_archive.latitude)*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(marine_archive.latitude*pi()/180)*POWER(SIN(($origLon-marine_archive.longitude)*pi()/180/2),2))) as distance |
|
2039 | 2039 | FROM marine_archive,marine_output".$filter_query." marine_output.fammarine_id = marine_archive.fammarine_id AND marine_output.ident <> '' ".$additional_query."AND marine_archive.longitude between ($origLon-$dist/cos(radians($origLat))*69) and ($origLon+$dist/cos(radians($origLat)*69)) and marine_archive.latitude between ($origLat-($dist/69)) and ($origLat+($dist/69)) |
2040 | 2040 | AND (3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - marine_archive.latitude)*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(marine_archive.latitude*pi()/180)*POWER(SIN(($origLon-marine_archive.longitude)*pi()/180/2),2)))) < $dist".$orderby_query; |
2041 | 2041 | } else { |
2042 | - $query="SELECT marine_output.*, 1.60935 * 3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - CAST(marine_archive.latitude as double precision))*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(CAST(marine_archive.latitude as double precision)*pi()/180)*POWER(SIN(($origLon-CAST(marine_archive.longitude as double precision))*pi()/180/2),2))) as distance |
|
2042 | + $query = "SELECT marine_output.*, 1.60935 * 3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - CAST(marine_archive.latitude as double precision))*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(CAST(marine_archive.latitude as double precision)*pi()/180)*POWER(SIN(($origLon-CAST(marine_archive.longitude as double precision))*pi()/180/2),2))) as distance |
|
2043 | 2043 | FROM marine_archive,marine_output".$filter_query." marine_output.fammarine_id = marine_archive.fammarine_id AND marine_output.ident <> '' ".$additional_query."AND CAST(marine_archive.longitude as double precision) between ($origLon-$dist/cos(radians($origLat))*69) and ($origLon+$dist/cos(radians($origLat))*69) and CAST(marine_archive.latitude as double precision) between ($origLat-($dist/69)) and ($origLat+($dist/69)) |
2044 | 2044 | AND (3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - CAST(marine_archive.latitude as double precision))*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(CAST(marine_archive.latitude as double precision)*pi()/180)*POWER(SIN(($origLon-CAST(marine_archive.longitude as double precision))*pi()/180/2),2)))) < $dist".$filter_query.$orderby_query; |
2045 | 2045 | } |
2046 | 2046 | } else { |
2047 | - $query = "SELECT marine_output.* FROM marine_output".$filter_query." marine_output.ident <> '' |
|
2047 | + $query = "SELECT marine_output.* FROM marine_output".$filter_query." marine_output.ident <> '' |
|
2048 | 2048 | ".$additional_query." |
2049 | 2049 | ".$orderby_query; |
2050 | 2050 | } |
2051 | - $marine_array = $this->getDataFromDB($query, $query_values,$limit_query); |
|
2051 | + $marine_array = $this->getDataFromDB($query, $query_values, $limit_query); |
|
2052 | 2052 | return $marine_array; |
2053 | 2053 | } |
2054 | 2054 | |
2055 | 2055 | public function getOrderBy() |
2056 | 2056 | { |
2057 | - $orderby = array("type_asc" => array("key" => "type_asc", "value" => "Type - ASC", "sql" => "ORDER BY marine_output.type ASC"), "type_desc" => array("key" => "type_desc", "value" => "Type - DESC", "sql" => "ORDER BY marine_output.type DESC"),"manufacturer_asc" => array("key" => "manufacturer_asc", "value" => "Aircraft Manufacturer - ASC", "sql" => "ORDER BY marine_output.aircraft_manufacturer ASC"), "manufacturer_desc" => array("key" => "manufacturer_desc", "value" => "Aircraft Manufacturer - DESC", "sql" => "ORDER BY marine_output.aircraft_manufacturer DESC"),"airline_name_asc" => array("key" => "airline_name_asc", "value" => "Airline Name - ASC", "sql" => "ORDER BY marine_output.airline_name ASC"), "airline_name_desc" => array("key" => "airline_name_desc", "value" => "Airline Name - DESC", "sql" => "ORDER BY marine_output.airline_name DESC"), "ident_asc" => array("key" => "ident_asc", "value" => "Ident - ASC", "sql" => "ORDER BY marine_output.ident ASC"), "ident_desc" => array("key" => "ident_desc", "value" => "Ident - DESC", "sql" => "ORDER BY marine_output.ident DESC"), "airport_departure_asc" => array("key" => "airport_departure_asc", "value" => "Departure Airport - ASC", "sql" => "ORDER BY marine_output.departure_airport_city ASC"), "airport_departure_desc" => array("key" => "airport_departure_desc", "value" => "Departure Airport - DESC", "sql" => "ORDER BY marine_output.departure_airport_city DESC"), "airport_arrival_asc" => array("key" => "airport_arrival_asc", "value" => "Arrival Airport - ASC", "sql" => "ORDER BY marine_output.arrival_airport_city ASC"), "airport_arrival_desc" => array("key" => "airport_arrival_desc", "value" => "Arrival Airport - DESC", "sql" => "ORDER BY marine_output.arrival_airport_city DESC"), "date_asc" => array("key" => "date_asc", "value" => "Date - ASC", "sql" => "ORDER BY marine_output.date ASC"), "date_desc" => array("key" => "date_desc", "value" => "Date - DESC", "sql" => "ORDER BY marine_output.date DESC"),"distance_asc" => array("key" => "distance_asc","value" => "Distance - ASC","sql" => "ORDER BY distance ASC"),"distance_desc" => array("key" => "distance_desc","value" => "Distance - DESC","sql" => "ORDER BY distance DESC")); |
|
2057 | + $orderby = array("type_asc" => array("key" => "type_asc", "value" => "Type - ASC", "sql" => "ORDER BY marine_output.type ASC"), "type_desc" => array("key" => "type_desc", "value" => "Type - DESC", "sql" => "ORDER BY marine_output.type DESC"), "manufacturer_asc" => array("key" => "manufacturer_asc", "value" => "Aircraft Manufacturer - ASC", "sql" => "ORDER BY marine_output.aircraft_manufacturer ASC"), "manufacturer_desc" => array("key" => "manufacturer_desc", "value" => "Aircraft Manufacturer - DESC", "sql" => "ORDER BY marine_output.aircraft_manufacturer DESC"), "airline_name_asc" => array("key" => "airline_name_asc", "value" => "Airline Name - ASC", "sql" => "ORDER BY marine_output.airline_name ASC"), "airline_name_desc" => array("key" => "airline_name_desc", "value" => "Airline Name - DESC", "sql" => "ORDER BY marine_output.airline_name DESC"), "ident_asc" => array("key" => "ident_asc", "value" => "Ident - ASC", "sql" => "ORDER BY marine_output.ident ASC"), "ident_desc" => array("key" => "ident_desc", "value" => "Ident - DESC", "sql" => "ORDER BY marine_output.ident DESC"), "airport_departure_asc" => array("key" => "airport_departure_asc", "value" => "Departure Airport - ASC", "sql" => "ORDER BY marine_output.departure_airport_city ASC"), "airport_departure_desc" => array("key" => "airport_departure_desc", "value" => "Departure Airport - DESC", "sql" => "ORDER BY marine_output.departure_airport_city DESC"), "airport_arrival_asc" => array("key" => "airport_arrival_asc", "value" => "Arrival Airport - ASC", "sql" => "ORDER BY marine_output.arrival_airport_city ASC"), "airport_arrival_desc" => array("key" => "airport_arrival_desc", "value" => "Arrival Airport - DESC", "sql" => "ORDER BY marine_output.arrival_airport_city DESC"), "date_asc" => array("key" => "date_asc", "value" => "Date - ASC", "sql" => "ORDER BY marine_output.date ASC"), "date_desc" => array("key" => "date_desc", "value" => "Date - DESC", "sql" => "ORDER BY marine_output.date DESC"), "distance_asc" => array("key" => "distance_asc", "value" => "Distance - ASC", "sql" => "ORDER BY distance ASC"), "distance_desc" => array("key" => "distance_desc", "value" => "Distance - DESC", "sql" => "ORDER BY distance DESC")); |
|
2058 | 2058 | |
2059 | 2059 | return $orderby; |
2060 | 2060 |
@@ -8,7 +8,9 @@ discard block |
||
8 | 8 | public function __construct($dbc = null) { |
9 | 9 | $Connection = new Connection($dbc); |
10 | 10 | $this->db = $Connection->db(); |
11 | - if ($this->db === null) die('Error: No DB connection. (Marine)'); |
|
11 | + if ($this->db === null) { |
|
12 | + die('Error: No DB connection. (Marine)'); |
|
13 | + } |
|
12 | 14 | } |
13 | 15 | |
14 | 16 | /** |
@@ -30,7 +32,9 @@ discard block |
||
30 | 32 | if (isset($filter[0]['source'])) { |
31 | 33 | $filters = array_merge($filters,$filter); |
32 | 34 | } |
33 | - if (is_array($globalFilter)) $filter = array_merge($filter,$globalFilter); |
|
35 | + if (is_array($globalFilter)) { |
|
36 | + $filter = array_merge($filter,$globalFilter); |
|
37 | + } |
|
34 | 38 | $filter_query_join = ''; |
35 | 39 | $filter_query_where = ''; |
36 | 40 | foreach($filters as $flt) { |
@@ -78,8 +82,11 @@ discard block |
||
78 | 82 | $filter_query_where .= " AND EXTRACT(DAY FROM marine_output.date) = '".$filter['day']."'"; |
79 | 83 | } |
80 | 84 | } |
81 | - if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE'; |
|
82 | - elseif ($filter_query_where != '' && $and) $filter_query_where .= ' AND'; |
|
85 | + if ($filter_query_where == '' && $where) { |
|
86 | + $filter_query_where = ' WHERE'; |
|
87 | + } elseif ($filter_query_where != '' && $and) { |
|
88 | + $filter_query_where .= ' AND'; |
|
89 | + } |
|
83 | 90 | if ($filter_query_where != '') { |
84 | 91 | $filter_query_where = preg_replace('/^ AND/',' WHERE',$filter_query_where); |
85 | 92 | } |
@@ -133,39 +140,75 @@ discard block |
||
133 | 140 | $temp_array['spotter_id'] = $row['spotter_archive_id']; |
134 | 141 | } elseif (isset($row['spotter_archive_output_id'])) { |
135 | 142 | $temp_array['spotter_id'] = $row['spotter_archive_output_id']; |
136 | - */} |
|
137 | - elseif (isset($row['marineid'])) { |
|
143 | + */} elseif (isset($row['marineid'])) { |
|
138 | 144 | $temp_array['marine_id'] = $row['marineid']; |
139 | 145 | } else { |
140 | 146 | $temp_array['marine_id'] = ''; |
141 | 147 | } |
142 | - if (isset($row['fammarine_id'])) $temp_array['fammarine_id'] = $row['fammarine_id']; |
|
143 | - if (isset($row['mmsi'])) $temp_array['mmsi'] = $row['mmsi']; |
|
144 | - if (isset($row['type'])) $temp_array['type'] = $row['type']; |
|
145 | - if (isset($row['type_id'])) $temp_array['type_id'] = $row['type_id']; |
|
146 | - if (isset($row['status'])) $temp_array['status'] = $row['status']; |
|
147 | - if (isset($row['status_id'])) $temp_array['status_id'] = $row['status_id']; |
|
148 | - if (isset($row['captain_id'])) $temp_array['captain_id'] = $row['captain_id']; |
|
149 | - if (isset($row['captain_name'])) $temp_array['captain_name'] = $row['captain_name']; |
|
150 | - if (isset($row['race_id'])) $temp_array['race_id'] = $row['race_id']; |
|
151 | - if (isset($row['race_name'])) $temp_array['race_name'] = $row['race_name']; |
|
152 | - if (isset($row['ident'])) $temp_array['ident'] = $row['ident']; |
|
153 | - if (isset($row['arrival_port_name'])) $temp_array['arrival_port_name'] = $row['arrival_port_name']; |
|
154 | - if (isset($row['latitude'])) $temp_array['latitude'] = $row['latitude']; |
|
155 | - if (isset($row['longitude'])) $temp_array['longitude'] = $row['longitude']; |
|
156 | - if (isset($row['format_source'])) $temp_array['format_source'] = $row['format_source']; |
|
148 | + if (isset($row['fammarine_id'])) { |
|
149 | + $temp_array['fammarine_id'] = $row['fammarine_id']; |
|
150 | + } |
|
151 | + if (isset($row['mmsi'])) { |
|
152 | + $temp_array['mmsi'] = $row['mmsi']; |
|
153 | + } |
|
154 | + if (isset($row['type'])) { |
|
155 | + $temp_array['type'] = $row['type']; |
|
156 | + } |
|
157 | + if (isset($row['type_id'])) { |
|
158 | + $temp_array['type_id'] = $row['type_id']; |
|
159 | + } |
|
160 | + if (isset($row['status'])) { |
|
161 | + $temp_array['status'] = $row['status']; |
|
162 | + } |
|
163 | + if (isset($row['status_id'])) { |
|
164 | + $temp_array['status_id'] = $row['status_id']; |
|
165 | + } |
|
166 | + if (isset($row['captain_id'])) { |
|
167 | + $temp_array['captain_id'] = $row['captain_id']; |
|
168 | + } |
|
169 | + if (isset($row['captain_name'])) { |
|
170 | + $temp_array['captain_name'] = $row['captain_name']; |
|
171 | + } |
|
172 | + if (isset($row['race_id'])) { |
|
173 | + $temp_array['race_id'] = $row['race_id']; |
|
174 | + } |
|
175 | + if (isset($row['race_name'])) { |
|
176 | + $temp_array['race_name'] = $row['race_name']; |
|
177 | + } |
|
178 | + if (isset($row['ident'])) { |
|
179 | + $temp_array['ident'] = $row['ident']; |
|
180 | + } |
|
181 | + if (isset($row['arrival_port_name'])) { |
|
182 | + $temp_array['arrival_port_name'] = $row['arrival_port_name']; |
|
183 | + } |
|
184 | + if (isset($row['latitude'])) { |
|
185 | + $temp_array['latitude'] = $row['latitude']; |
|
186 | + } |
|
187 | + if (isset($row['longitude'])) { |
|
188 | + $temp_array['longitude'] = $row['longitude']; |
|
189 | + } |
|
190 | + if (isset($row['format_source'])) { |
|
191 | + $temp_array['format_source'] = $row['format_source']; |
|
192 | + } |
|
157 | 193 | if (isset($row['heading'])) { |
158 | 194 | $temp_array['heading'] = $row['heading']; |
159 | 195 | $heading_direction = $this->parseDirection($row['heading']); |
160 | - if (isset($heading_direction[0]['direction_fullname'])) $temp_array['heading_name'] = $heading_direction[0]['direction_fullname']; |
|
196 | + if (isset($heading_direction[0]['direction_fullname'])) { |
|
197 | + $temp_array['heading_name'] = $heading_direction[0]['direction_fullname']; |
|
198 | + } |
|
199 | + } |
|
200 | + if (isset($row['ground_speed'])) { |
|
201 | + $temp_array['ground_speed'] = $row['ground_speed']; |
|
161 | 202 | } |
162 | - if (isset($row['ground_speed'])) $temp_array['ground_speed'] = $row['ground_speed']; |
|
163 | 203 | |
164 | 204 | if(isset($temp_array['mmsi']) && $temp_array['mmsi'] != "") |
165 | 205 | { |
166 | 206 | $Image = new Image($this->db); |
167 | - if (isset($temp_array['ident']) && $temp_array['ident'] != '') $image_array = $Image->getMarineImage($temp_array['mmsi'],'',$temp_array['ident']); |
|
168 | - else $image_array = $Image->getMarineImage($temp_array['mmsi']); |
|
207 | + if (isset($temp_array['ident']) && $temp_array['ident'] != '') { |
|
208 | + $image_array = $Image->getMarineImage($temp_array['mmsi'],'',$temp_array['ident']); |
|
209 | + } else { |
|
210 | + $image_array = $Image->getMarineImage($temp_array['mmsi']); |
|
211 | + } |
|
169 | 212 | unset($Image); |
170 | 213 | if (count($image_array) > 0) { |
171 | 214 | $temp_array['image'] = $image_array[0]['image']; |
@@ -217,13 +260,21 @@ discard block |
||
217 | 260 | } |
218 | 261 | |
219 | 262 | $fromsource = NULL; |
220 | - if (isset($row['source_name']) && $row['source_name'] != '') $temp_array['source_name'] = $row['source_name']; |
|
221 | - if (isset($row['over_country']) && $row['over_country'] != '') $temp_array['over_country'] = $row['over_country']; |
|
222 | - if (isset($row['distance']) && $row['distance'] != '') $temp_array['distance'] = $row['distance']; |
|
263 | + if (isset($row['source_name']) && $row['source_name'] != '') { |
|
264 | + $temp_array['source_name'] = $row['source_name']; |
|
265 | + } |
|
266 | + if (isset($row['over_country']) && $row['over_country'] != '') { |
|
267 | + $temp_array['over_country'] = $row['over_country']; |
|
268 | + } |
|
269 | + if (isset($row['distance']) && $row['distance'] != '') { |
|
270 | + $temp_array['distance'] = $row['distance']; |
|
271 | + } |
|
223 | 272 | $temp_array['query_number_rows'] = $num_rows; |
224 | 273 | $spotter_array[] = $temp_array; |
225 | 274 | } |
226 | - if ($num_rows == 0) return array(); |
|
275 | + if ($num_rows == 0) { |
|
276 | + return array(); |
|
277 | + } |
|
227 | 278 | $spotter_array[0]['query_number_rows'] = $num_rows; |
228 | 279 | return $spotter_array; |
229 | 280 | } |
@@ -249,8 +300,12 @@ discard block |
||
249 | 300 | { |
250 | 301 | //$limit_query = " LIMIT ".$limit_array[0].",".$limit_array[1]; |
251 | 302 | $limit_query = " LIMIT ".$limit_array[1]." OFFSET ".$limit_array[0]; |
252 | - } else $limit_query = ""; |
|
253 | - } else $limit_query = ""; |
|
303 | + } else { |
|
304 | + $limit_query = ""; |
|
305 | + } |
|
306 | + } else { |
|
307 | + $limit_query = ""; |
|
308 | + } |
|
254 | 309 | if ($sort != "") |
255 | 310 | { |
256 | 311 | $search_orderby_array = $this->getOrderBy(); |
@@ -274,7 +329,9 @@ discard block |
||
274 | 329 | global $global_query; |
275 | 330 | |
276 | 331 | date_default_timezone_set('UTC'); |
277 | - if ($id == '') return array(); |
|
332 | + if ($id == '') { |
|
333 | + return array(); |
|
334 | + } |
|
278 | 335 | $additional_query = "marine_output.fammarine_id = :id"; |
279 | 336 | $query_values = array(':id' => $id); |
280 | 337 | $query = $global_query." WHERE ".$additional_query." "; |
@@ -470,8 +527,11 @@ discard block |
||
470 | 527 | $query .= " ORDER BY marine_output.source_name ASC"; |
471 | 528 | |
472 | 529 | $sth = $this->db->prepare($query); |
473 | - if (!empty($query_values)) $sth->execute($query_values); |
|
474 | - else $sth->execute(); |
|
530 | + if (!empty($query_values)) { |
|
531 | + $sth->execute($query_values); |
|
532 | + } else { |
|
533 | + $sth->execute(); |
|
534 | + } |
|
475 | 535 | |
476 | 536 | $source_array = array(); |
477 | 537 | $temp_array = array(); |
@@ -526,8 +586,11 @@ discard block |
||
526 | 586 | $sth = $this->db->prepare($query); |
527 | 587 | $sth->execute(array(':mmsi' => $mmsi)); |
528 | 588 | $result = $sth->fetchAll(PDO::FETCH_ASSOC); |
529 | - if (isset($result[0])) return $result[0]; |
|
530 | - else return array(); |
|
589 | + if (isset($result[0])) { |
|
590 | + return $result[0]; |
|
591 | + } else { |
|
592 | + return array(); |
|
593 | + } |
|
531 | 594 | } |
532 | 595 | |
533 | 596 | /** |
@@ -568,7 +631,9 @@ discard block |
||
568 | 631 | date_default_timezone_set($globalTimezone); |
569 | 632 | $datetime = new DateTime(); |
570 | 633 | $offset = $datetime->format('P'); |
571 | - } else $offset = '+00:00'; |
|
634 | + } else { |
|
635 | + $offset = '+00:00'; |
|
636 | + } |
|
572 | 637 | |
573 | 638 | if ($globalDBdriver == 'mysql') { |
574 | 639 | $query = "SELECT DISTINCT DATE(CONVERT_TZ(marine_output.date,'+00:00', :offset)) as date |
@@ -818,11 +883,21 @@ discard block |
||
818 | 883 | $latitude = 0; |
819 | 884 | $longitude = 0; |
820 | 885 | } |
821 | - if ($type_id == '') $type_id = NULL; |
|
822 | - if ($status_id == '') $status_id = NULL; |
|
823 | - if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0; |
|
824 | - if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0; |
|
825 | - if ($arrival_date == '') $arrival_date = NULL; |
|
886 | + if ($type_id == '') { |
|
887 | + $type_id = NULL; |
|
888 | + } |
|
889 | + if ($status_id == '') { |
|
890 | + $status_id = NULL; |
|
891 | + } |
|
892 | + if ($heading == '' || $Common->isInteger($heading) === false) { |
|
893 | + $heading = 0; |
|
894 | + } |
|
895 | + if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) { |
|
896 | + $groundspeed = 0; |
|
897 | + } |
|
898 | + if ($arrival_date == '') { |
|
899 | + $arrival_date = NULL; |
|
900 | + } |
|
826 | 901 | $query = "INSERT INTO marine_output (fammarine_id, ident, latitude, longitude, heading, ground_speed, date, format_source, source_name, mmsi, type, type_id, status,status_id,imo,arrival_port_name,arrival_port_date,captain_id,captain_name,race_id,race_name) |
827 | 902 | VALUES (:fammarine_id,:ident,:latitude,:longitude,:heading,:speed,:date,:format_source, :source_name,:mmsi,:type,:type_id,:status,:status_id,:imo,:arrival_port_name,:arrival_port_date,:captain_id,:captain_name,:race_id,:race_name)"; |
828 | 903 | |
@@ -929,7 +1004,9 @@ discard block |
||
929 | 1004 | global $globalDBdriver, $globalArchive; |
930 | 1005 | //$filter_query = $this->getFilter($filters,true,true); |
931 | 1006 | $Connection= new Connection($this->db); |
932 | - if (!$Connection->tableExists('countries')) return array(); |
|
1007 | + if (!$Connection->tableExists('countries')) { |
|
1008 | + return array(); |
|
1009 | + } |
|
933 | 1010 | require_once('class.SpotterLive.php'); |
934 | 1011 | if (!isset($globalArchive) || $globalArchive !== TRUE) { |
935 | 1012 | $MarineLive = new MarineLive($this->db); |
@@ -973,7 +1050,9 @@ discard block |
||
973 | 1050 | $query = "SELECT c.name, c.iso3, c.iso2, count(c.name) as nb FROM countries c INNER JOIN (SELECT DISTINCT fammarine_id,over_country FROM marine_archive".$filter_query.") l ON c.iso2 = l.over_country "; |
974 | 1051 | } |
975 | 1052 | $query .= "GROUP BY c.name,c.iso3,c.iso2 ORDER BY nb DESC"; |
976 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
1053 | + if ($limit) { |
|
1054 | + $query .= " LIMIT 10 OFFSET 0"; |
|
1055 | + } |
|
977 | 1056 | |
978 | 1057 | $sth = $this->db->prepare($query); |
979 | 1058 | $sth->execute(); |
@@ -1007,12 +1086,18 @@ discard block |
||
1007 | 1086 | $query = "SELECT DISTINCT marine_output.ident, COUNT(marine_output.ident) AS callsign_icao_count |
1008 | 1087 | FROM marine_output".$filter_query." marine_output.ident <> ''"; |
1009 | 1088 | if ($olderthanmonths > 0) { |
1010 | - if ($globalDBdriver == 'mysql') $query .= ' AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH)'; |
|
1011 | - else $query .= " AND marine_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'"; |
|
1089 | + if ($globalDBdriver == 'mysql') { |
|
1090 | + $query .= ' AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH)'; |
|
1091 | + } else { |
|
1092 | + $query .= " AND marine_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'"; |
|
1093 | + } |
|
1012 | 1094 | } |
1013 | 1095 | if ($sincedate != '') { |
1014 | - if ($globalDBdriver == 'mysql') $query .= " AND marine_output.date > '".$sincedate."'"; |
|
1015 | - else $query .= " AND marine_output.date > CAST('".$sincedate."' AS TIMESTAMP)"; |
|
1096 | + if ($globalDBdriver == 'mysql') { |
|
1097 | + $query .= " AND marine_output.date > '".$sincedate."'"; |
|
1098 | + } else { |
|
1099 | + $query .= " AND marine_output.date > CAST('".$sincedate."' AS TIMESTAMP)"; |
|
1100 | + } |
|
1016 | 1101 | } |
1017 | 1102 | $query_values = array(); |
1018 | 1103 | if ($year != '') { |
@@ -1043,7 +1128,9 @@ discard block |
||
1043 | 1128 | } |
1044 | 1129 | } |
1045 | 1130 | $query .= " GROUP BY marine_output.ident ORDER BY callsign_icao_count DESC"; |
1046 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
1131 | + if ($limit) { |
|
1132 | + $query .= " LIMIT 10 OFFSET 0"; |
|
1133 | + } |
|
1047 | 1134 | |
1048 | 1135 | $sth = $this->db->prepare($query); |
1049 | 1136 | $sth->execute($query_values); |
@@ -1078,7 +1165,9 @@ discard block |
||
1078 | 1165 | date_default_timezone_set($globalTimezone); |
1079 | 1166 | $datetime = new DateTime(); |
1080 | 1167 | $offset = $datetime->format('P'); |
1081 | - } else $offset = '+00:00'; |
|
1168 | + } else { |
|
1169 | + $offset = '+00:00'; |
|
1170 | + } |
|
1082 | 1171 | |
1083 | 1172 | if ($globalDBdriver == 'mysql') { |
1084 | 1173 | $query = "SELECT DATE(CONVERT_TZ(marine_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count |
@@ -1128,7 +1217,9 @@ discard block |
||
1128 | 1217 | date_default_timezone_set($globalTimezone); |
1129 | 1218 | $datetime = new DateTime(); |
1130 | 1219 | $offset = $datetime->format('P'); |
1131 | - } else $offset = '+00:00'; |
|
1220 | + } else { |
|
1221 | + $offset = '+00:00'; |
|
1222 | + } |
|
1132 | 1223 | $filter_query = $this->getFilter($filters,true,true); |
1133 | 1224 | if ($globalDBdriver == 'mysql') { |
1134 | 1225 | $query = "SELECT DATE(CONVERT_TZ(marine_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count |
@@ -1174,7 +1265,9 @@ discard block |
||
1174 | 1265 | date_default_timezone_set($globalTimezone); |
1175 | 1266 | $datetime = new DateTime(); |
1176 | 1267 | $offset = $datetime->format('P'); |
1177 | - } else $offset = '+00:00'; |
|
1268 | + } else { |
|
1269 | + $offset = '+00:00'; |
|
1270 | + } |
|
1178 | 1271 | $filter_query = $this->getFilter($filters,true,true); |
1179 | 1272 | if ($globalDBdriver == 'mysql') { |
1180 | 1273 | $query = "SELECT DATE(CONVERT_TZ(marine_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count |
@@ -1222,7 +1315,9 @@ discard block |
||
1222 | 1315 | date_default_timezone_set($globalTimezone); |
1223 | 1316 | $datetime = new DateTime(); |
1224 | 1317 | $offset = $datetime->format('P'); |
1225 | - } else $offset = '+00:00'; |
|
1318 | + } else { |
|
1319 | + $offset = '+00:00'; |
|
1320 | + } |
|
1226 | 1321 | |
1227 | 1322 | if ($globalDBdriver == 'mysql') { |
1228 | 1323 | $query = "SELECT YEAR(CONVERT_TZ(marine_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(marine_output.date,'+00:00', :offset)) AS month_name, count(*) as date_count |
@@ -1271,7 +1366,9 @@ discard block |
||
1271 | 1366 | date_default_timezone_set($globalTimezone); |
1272 | 1367 | $datetime = new DateTime(); |
1273 | 1368 | $offset = $datetime->format('P'); |
1274 | - } else $offset = '+00:00'; |
|
1369 | + } else { |
|
1370 | + $offset = '+00:00'; |
|
1371 | + } |
|
1275 | 1372 | $filter_query = $this->getFilter($filters,true,true); |
1276 | 1373 | if ($globalDBdriver == 'mysql') { |
1277 | 1374 | $query = "SELECT MONTH(CONVERT_TZ(marine_output.date,'+00:00', :offset)) AS month_name, YEAR(CONVERT_TZ(marine_output.date,'+00:00', :offset)) AS year_name, count(*) as date_count |
@@ -1320,7 +1417,9 @@ discard block |
||
1320 | 1417 | date_default_timezone_set($globalTimezone); |
1321 | 1418 | $datetime = new DateTime(); |
1322 | 1419 | $offset = $datetime->format('P'); |
1323 | - } else $offset = '+00:00'; |
|
1420 | + } else { |
|
1421 | + $offset = '+00:00'; |
|
1422 | + } |
|
1324 | 1423 | |
1325 | 1424 | $orderby_sql = ''; |
1326 | 1425 | if ($orderby == "hour") |
@@ -1389,7 +1488,9 @@ discard block |
||
1389 | 1488 | date_default_timezone_set($globalTimezone); |
1390 | 1489 | $datetime = new DateTime($date); |
1391 | 1490 | $offset = $datetime->format('P'); |
1392 | - } else $offset = '+00:00'; |
|
1491 | + } else { |
|
1492 | + $offset = '+00:00'; |
|
1493 | + } |
|
1393 | 1494 | |
1394 | 1495 | if ($globalDBdriver == 'mysql') { |
1395 | 1496 | $query = "SELECT HOUR(CONVERT_TZ(marine_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
@@ -1437,7 +1538,9 @@ discard block |
||
1437 | 1538 | date_default_timezone_set($globalTimezone); |
1438 | 1539 | $datetime = new DateTime(); |
1439 | 1540 | $offset = $datetime->format('P'); |
1440 | - } else $offset = '+00:00'; |
|
1541 | + } else { |
|
1542 | + $offset = '+00:00'; |
|
1543 | + } |
|
1441 | 1544 | |
1442 | 1545 | if ($globalDBdriver == 'mysql') { |
1443 | 1546 | $query = "SELECT HOUR(CONVERT_TZ(marine_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
@@ -1502,8 +1605,11 @@ discard block |
||
1502 | 1605 | $query_values = array_merge($query_values,array(':month' => $month)); |
1503 | 1606 | } |
1504 | 1607 | } |
1505 | - if (empty($query_values)) $queryi .= $this->getFilter($filters); |
|
1506 | - else $queryi .= $this->getFilter($filters,true,true).substr($query,4); |
|
1608 | + if (empty($query_values)) { |
|
1609 | + $queryi .= $this->getFilter($filters); |
|
1610 | + } else { |
|
1611 | + $queryi .= $this->getFilter($filters,true,true).substr($query,4); |
|
1612 | + } |
|
1507 | 1613 | |
1508 | 1614 | $sth = $this->db->prepare($queryi); |
1509 | 1615 | $sth->execute($query_values); |
@@ -1540,8 +1646,11 @@ discard block |
||
1540 | 1646 | $query_values = array_merge($query_values,array(':month' => $month)); |
1541 | 1647 | } |
1542 | 1648 | } |
1543 | - if (empty($query_values)) $queryi .= $this->getFilter($filters); |
|
1544 | - else $queryi .= $this->getFilter($filters,true,true).substr($query,4); |
|
1649 | + if (empty($query_values)) { |
|
1650 | + $queryi .= $this->getFilter($filters); |
|
1651 | + } else { |
|
1652 | + $queryi .= $this->getFilter($filters,true,true).substr($query,4); |
|
1653 | + } |
|
1545 | 1654 | |
1546 | 1655 | $sth = $this->db->prepare($queryi); |
1547 | 1656 | $sth->execute($query_values); |
@@ -1563,7 +1672,9 @@ discard block |
||
1563 | 1672 | date_default_timezone_set($globalTimezone); |
1564 | 1673 | $datetime = new DateTime(); |
1565 | 1674 | $offset = $datetime->format('P'); |
1566 | - } else $offset = '+00:00'; |
|
1675 | + } else { |
|
1676 | + $offset = '+00:00'; |
|
1677 | + } |
|
1567 | 1678 | |
1568 | 1679 | if ($globalDBdriver == 'mysql') { |
1569 | 1680 | $query = "SELECT HOUR(CONVERT_TZ(marine_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
@@ -1667,7 +1778,9 @@ discard block |
||
1667 | 1778 | */ |
1668 | 1779 | public function parseDirection($direction = 0) |
1669 | 1780 | { |
1670 | - if ($direction == '') $direction = 0; |
|
1781 | + if ($direction == '') { |
|
1782 | + $direction = 0; |
|
1783 | + } |
|
1671 | 1784 | $direction_array = array(); |
1672 | 1785 | $temp_array = array(); |
1673 | 1786 | |
@@ -1756,7 +1869,9 @@ discard block |
||
1756 | 1869 | $longitude = filter_var($longitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
1757 | 1870 | |
1758 | 1871 | $Connection = new Connection($this->db); |
1759 | - if (!$Connection->tableExists('countries')) return ''; |
|
1872 | + if (!$Connection->tableExists('countries')) { |
|
1873 | + return ''; |
|
1874 | + } |
|
1760 | 1875 | |
1761 | 1876 | try { |
1762 | 1877 | /* |
@@ -1776,9 +1891,13 @@ discard block |
||
1776 | 1891 | $sth->closeCursor(); |
1777 | 1892 | if (count($row) > 0) { |
1778 | 1893 | return $row; |
1779 | - } else return ''; |
|
1894 | + } else { |
|
1895 | + return ''; |
|
1896 | + } |
|
1780 | 1897 | } catch (PDOException $e) { |
1781 | - if (isset($globalDebug) && $globalDebug) echo 'Error : '.$e->getMessage()."\n"; |
|
1898 | + if (isset($globalDebug) && $globalDebug) { |
|
1899 | + echo 'Error : '.$e->getMessage()."\n"; |
|
1900 | + } |
|
1782 | 1901 | return ''; |
1783 | 1902 | } |
1784 | 1903 | |
@@ -1796,7 +1915,9 @@ discard block |
||
1796 | 1915 | $iso2 = filter_var($iso2,FILTER_SANITIZE_STRING); |
1797 | 1916 | |
1798 | 1917 | $Connection = new Connection($this->db); |
1799 | - if (!$Connection->tableExists('countries')) return ''; |
|
1918 | + if (!$Connection->tableExists('countries')) { |
|
1919 | + return ''; |
|
1920 | + } |
|
1800 | 1921 | |
1801 | 1922 | try { |
1802 | 1923 | $query = "SELECT name,iso2,iso3 FROM countries WHERE iso2 = :iso2 LIMIT 1"; |
@@ -1808,9 +1929,13 @@ discard block |
||
1808 | 1929 | $sth->closeCursor(); |
1809 | 1930 | if (count($row) > 0) { |
1810 | 1931 | return $row; |
1811 | - } else return ''; |
|
1932 | + } else { |
|
1933 | + return ''; |
|
1934 | + } |
|
1812 | 1935 | } catch (PDOException $e) { |
1813 | - if (isset($globalDebug) && $globalDebug) echo 'Error : '.$e->getMessage()."\n"; |
|
1936 | + if (isset($globalDebug) && $globalDebug) { |
|
1937 | + echo 'Error : '.$e->getMessage()."\n"; |
|
1938 | + } |
|
1814 | 1939 | return ''; |
1815 | 1940 | } |
1816 | 1941 | |
@@ -1828,7 +1953,9 @@ discard block |
||
1828 | 1953 | { |
1829 | 1954 | global $globalBitlyAccessToken; |
1830 | 1955 | |
1831 | - if ($globalBitlyAccessToken == '') return $url; |
|
1956 | + if ($globalBitlyAccessToken == '') { |
|
1957 | + return $url; |
|
1958 | + } |
|
1832 | 1959 | |
1833 | 1960 | $google_url = 'https://api-ssl.bitly.com/v3/shorten?access_token='.$globalBitlyAccessToken.'&longUrl='.$url; |
1834 | 1961 | |
@@ -1904,7 +2031,9 @@ discard block |
||
1904 | 2031 | } |
1905 | 2032 | } |
1906 | 2033 | $query .= " GROUP BY marine_output.type, marine_output.type_id ORDER BY marine_type_count DESC"; |
1907 | - if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
|
2034 | + if ($limit) { |
|
2035 | + $query .= " LIMIT 10 OFFSET 0"; |
|
2036 | + } |
|
1908 | 2037 | $sth = $this->db->prepare($query); |
1909 | 2038 | $sth->execute($query_values); |
1910 | 2039 | $marine_array = array(); |
@@ -1942,9 +2071,15 @@ discard block |
||
1942 | 2071 | foreach ($q_array as $q_item){ |
1943 | 2072 | $q_item = filter_var($q_item,FILTER_SANITIZE_STRING); |
1944 | 2073 | $additional_query .= " AND ("; |
1945 | - if (is_int($q_item)) $additional_query .= "(marine_output.marine_id = '".$q_item."') OR "; |
|
1946 | - if (is_int($q_item)) $additional_query .= "(marine_output.mmsi = '".$q_item."') OR "; |
|
1947 | - if (is_int($q_item)) $additional_query .= "(marine_output.imo = '".$q_item."') OR "; |
|
2074 | + if (is_int($q_item)) { |
|
2075 | + $additional_query .= "(marine_output.marine_id = '".$q_item."') OR "; |
|
2076 | + } |
|
2077 | + if (is_int($q_item)) { |
|
2078 | + $additional_query .= "(marine_output.mmsi = '".$q_item."') OR "; |
|
2079 | + } |
|
2080 | + if (is_int($q_item)) { |
|
2081 | + $additional_query .= "(marine_output.imo = '".$q_item."') OR "; |
|
2082 | + } |
|
1948 | 2083 | $additional_query .= "(marine_output.ident like '%".$q_item."%') OR "; |
1949 | 2084 | $additional_query .= ")"; |
1950 | 2085 | } |
@@ -1992,7 +2127,9 @@ discard block |
||
1992 | 2127 | date_default_timezone_set($globalTimezone); |
1993 | 2128 | $datetime = new DateTime(); |
1994 | 2129 | $offset = $datetime->format('P'); |
1995 | - } else $offset = '+00:00'; |
|
2130 | + } else { |
|
2131 | + $offset = '+00:00'; |
|
2132 | + } |
|
1996 | 2133 | if ($date_array[1] != "") |
1997 | 2134 | { |
1998 | 2135 | $date_array[0] = date("Y-m-d H:i:s", strtotime($date_array[0])); |
@@ -2019,8 +2156,12 @@ discard block |
||
2019 | 2156 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
2020 | 2157 | { |
2021 | 2158 | $limit_query = " LIMIT ".$limit_array[1]." OFFSET ".$limit_array[0]; |
2022 | - } else $limit_query = ""; |
|
2023 | - } else $limit_query = ""; |
|
2159 | + } else { |
|
2160 | + $limit_query = ""; |
|
2161 | + } |
|
2162 | + } else { |
|
2163 | + $limit_query = ""; |
|
2164 | + } |
|
2024 | 2165 | if ($sort != "") |
2025 | 2166 | { |
2026 | 2167 | $search_orderby_array = $this->getOrderBy(); |
@@ -15,7 +15,7 @@ discard block |
||
15 | 15 | /** |
16 | 16 | * Get SQL query part for filter used |
17 | 17 | * @param Array $filter the filter |
18 | - * @return Array the SQL part |
|
18 | + * @return string the SQL part |
|
19 | 19 | */ |
20 | 20 | public function getFilter($filter = array(),$where = false,$and = false) { |
21 | 21 | global $globalFilter, $globalStatsFilters, $globalFilterName, $globalDBdriver; |
@@ -915,10 +915,6 @@ discard block |
||
915 | 915 | * |
916 | 916 | * @param String $fammarine_id the ID from flightaware |
917 | 917 | * @param String $ident the flight ident |
918 | - * @param String $aircraft_icao the aircraft type |
|
919 | - * @param String $departure_airport_icao the departure airport |
|
920 | - * @param String $arrival_airport_icao the arrival airport |
|
921 | - * @return String success or false |
|
922 | 918 | * |
923 | 919 | */ |
924 | 920 | public function addLiveMarineData($fammarine_id = '', $ident = '', $latitude = '', $longitude = '', $heading = '', $groundspeed = '', $date = '', $putinarchive = false, $mmsi = '',$type = '',$typeid = '',$imo = '', $callsign = '',$arrival_code = '',$arrival_date = '',$status = '',$statusid = '',$noarchive = false,$format_source = '', $source_name = '', $over_country = '',$captain_id = '',$captain_name = '',$race_id = '', $race_name = '') |
@@ -8,7 +8,9 @@ discard block |
||
8 | 8 | public function __construct($dbc = null) { |
9 | 9 | $Connection = new Connection($dbc); |
10 | 10 | $this->db = $Connection->db(); |
11 | - if ($this->db === null) die('Error: No DB connection. (MarineLive)'); |
|
11 | + if ($this->db === null) { |
|
12 | + die('Error: No DB connection. (MarineLive)'); |
|
13 | + } |
|
12 | 14 | } |
13 | 15 | |
14 | 16 | |
@@ -30,7 +32,9 @@ discard block |
||
30 | 32 | if (isset($filter[0]['source'])) { |
31 | 33 | $filters = array_merge($filters,$filter); |
32 | 34 | } |
33 | - if (is_array($globalFilter)) $filter = array_merge($filter,$globalFilter); |
|
35 | + if (is_array($globalFilter)) { |
|
36 | + $filter = array_merge($filter,$globalFilter); |
|
37 | + } |
|
34 | 38 | $filter_query_join = ''; |
35 | 39 | $filter_query_where = ''; |
36 | 40 | foreach($filters as $flt) { |
@@ -86,8 +90,11 @@ discard block |
||
86 | 90 | if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) { |
87 | 91 | $filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')"; |
88 | 92 | } |
89 | - if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE'; |
|
90 | - elseif ($filter_query_where != '' && $and) $filter_query_where .= ' AND'; |
|
93 | + if ($filter_query_where == '' && $where) { |
|
94 | + $filter_query_where = ' WHERE'; |
|
95 | + } elseif ($filter_query_where != '' && $and) { |
|
96 | + $filter_query_where .= ' AND'; |
|
97 | + } |
|
91 | 98 | if ($filter_query_where != '') { |
92 | 99 | $filter_query_where = preg_replace('/^ AND/',' WHERE',$filter_query_where); |
93 | 100 | } |
@@ -128,9 +135,13 @@ discard block |
||
128 | 135 | $orderby_query = ' '.$search_orderby_array[$sort]['sql']; |
129 | 136 | } |
130 | 137 | } |
131 | - if ($orderby_query == '') $orderby_query= ' ORDER BY date DESC'; |
|
138 | + if ($orderby_query == '') { |
|
139 | + $orderby_query= ' ORDER BY date DESC'; |
|
140 | + } |
|
132 | 141 | |
133 | - if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
|
142 | + if (!isset($globalLiveInterval)) { |
|
143 | + $globalLiveInterval = '200'; |
|
144 | + } |
|
134 | 145 | if ($globalDBdriver == 'mysql') { |
135 | 146 | //$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"; |
136 | 147 | $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; |
@@ -155,7 +166,9 @@ discard block |
||
155 | 166 | |
156 | 167 | $filter_query = $this->getFilter($filter,true,true); |
157 | 168 | |
158 | - if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
|
169 | + if (!isset($globalLiveInterval)) { |
|
170 | + $globalLiveInterval = '200'; |
|
171 | + } |
|
159 | 172 | if ($globalDBdriver == 'mysql') { |
160 | 173 | $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, marine_live.captain_name |
161 | 174 | 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"; |
@@ -196,48 +209,72 @@ discard block |
||
196 | 209 | } |
197 | 210 | $filter_query = $this->getFilter($filter,true,true); |
198 | 211 | |
199 | - if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
|
200 | - if (!isset($globalMap3DMarinesLimit) || $globalMap3DMarinesLimit == '') $globalMap3DMarinesLimit = '300'; |
|
212 | + if (!isset($globalLiveInterval)) { |
|
213 | + $globalLiveInterval = '200'; |
|
214 | + } |
|
215 | + if (!isset($globalMap3DMarinesLimit) || $globalMap3DMarinesLimit == '') { |
|
216 | + $globalMap3DMarinesLimit = '300'; |
|
217 | + } |
|
201 | 218 | if ($globalDBdriver == 'mysql') { |
202 | 219 | if (isset($globalArchive) && $globalArchive === TRUE) { |
203 | 220 | $query = 'SELECT * FROM (SELECT marine_archive.ident, marine_archive.fammarine_id,marine_archive.type, marine_archive.latitude, marine_archive.longitude, marine_archive.heading, marine_archive.ground_speed, marine_archive.date, marine_archive.format_source, marine_live.captain_name |
204 | 221 | FROM marine_archive INNER JOIN (SELECT fammarine_id FROM marine_live'.$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval." SECOND) <= marine_live.date) l ON l.fammarine_id = marine_archive.fammarine_id "; |
205 | - if ($usecoord) $query .= "AND marine_archive.latitude BETWEEN ".$minlat." AND ".$maxlat." AND marine_archive.longitude BETWEEN ".$minlong." AND ".$maxlong." "; |
|
222 | + if ($usecoord) { |
|
223 | + $query .= "AND marine_archive.latitude BETWEEN ".$minlat." AND ".$maxlat." AND marine_archive.longitude BETWEEN ".$minlong." AND ".$maxlong." "; |
|
224 | + } |
|
206 | 225 | $query .= "UNION |
207 | 226 | 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, marine_live.captain_name |
208 | 227 | FROM marine_live".$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval." SECOND) <= marine_live.date"; |
209 | - if ($usecoord) $query .= " AND marine_live.latitude BETWEEN ".$minlat." AND ".$maxlat." AND marine_live.longitude BETWEEN ".$minlong." AND ".$maxlong; |
|
228 | + if ($usecoord) { |
|
229 | + $query .= " AND marine_live.latitude BETWEEN ".$minlat." AND ".$maxlat." AND marine_live.longitude BETWEEN ".$minlong." AND ".$maxlong; |
|
230 | + } |
|
210 | 231 | $query .= ") AS marine |
211 | 232 | WHERE latitude <> '0' AND longitude <> '0' |
212 | 233 | ORDER BY fammarine_id, date"; |
213 | - if ($limit) $query .= " LIMIT ".$globalMap3DMarinesLimit; |
|
234 | + if ($limit) { |
|
235 | + $query .= " LIMIT ".$globalMap3DMarinesLimit; |
|
236 | + } |
|
214 | 237 | } else { |
215 | 238 | $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, marine_live.captain_name |
216 | 239 | FROM marine_live'.$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval." SECOND) <= marine_live.date "; |
217 | - if ($usecoord) $query .= "AND marine_live.latitude BETWEEN ".$minlat." AND ".$maxlat." AND marine_live.longitude BETWEEN ".$minlong." AND ".$maxlong." "; |
|
240 | + if ($usecoord) { |
|
241 | + $query .= "AND marine_live.latitude BETWEEN ".$minlat." AND ".$maxlat." AND marine_live.longitude BETWEEN ".$minlong." AND ".$maxlong." "; |
|
242 | + } |
|
218 | 243 | $query .= "AND marine_live.latitude <> '0' AND marine_live.longitude <> '0' |
219 | 244 | ORDER BY marine_live.fammarine_id, marine_live.date"; |
220 | - if ($limit) $query .= " LIMIT ".$globalMap3DMarinesLimit; |
|
245 | + if ($limit) { |
|
246 | + $query .= " LIMIT ".$globalMap3DMarinesLimit; |
|
247 | + } |
|
221 | 248 | } |
222 | 249 | } else { |
223 | 250 | if (isset($globalArchive) && $globalArchive === TRUE) { |
224 | 251 | $query = "SELECT * FROM (SELECT marine_archive.ident, marine_archive.fammarine_id, marine_archive.type,marine_archive.latitude, marine_archive.longitude, marine_archive.heading, marine_archive.ground_speed, marine_archive.date, marine_archive.format_source, marine_live.captain_name |
225 | 252 | FROM marine_archive INNER JOIN (SELECT fammarine_id FROM marine_live".$filter_query." CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= marine_live.date) l ON l.fammarine_id = marine_archive.fammarine_id "; |
226 | - if ($usecoord) $query .= "AND marine_archive.latitude BETWEEN ".$minlat." AND ".$maxlat." AND marine_archive.longitude BETWEEN ".$minlong." AND ".$maxlong." "; |
|
253 | + if ($usecoord) { |
|
254 | + $query .= "AND marine_archive.latitude BETWEEN ".$minlat." AND ".$maxlat." AND marine_archive.longitude BETWEEN ".$minlong." AND ".$maxlong." "; |
|
255 | + } |
|
227 | 256 | $query .= "UNION |
228 | 257 | 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, marine_live.captain_name |
229 | 258 | FROM marine_live".$filter_query." CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= marine_live.date"; |
230 | - if ($usecoord) $query .= " AND marine_live.latitude BETWEEN ".$minlat." AND ".$maxlat." AND marine_live.longitude BETWEEN ".$minlong." AND ".$maxlong; |
|
259 | + if ($usecoord) { |
|
260 | + $query .= " AND marine_live.latitude BETWEEN ".$minlat." AND ".$maxlat." AND marine_live.longitude BETWEEN ".$minlong." AND ".$maxlong; |
|
261 | + } |
|
231 | 262 | $query .= ") AS marine WHERE latitude <> '0' AND longitude <> '0' "; |
232 | 263 | $query .= "ORDER BY fammarine_id, date"; |
233 | - if ($limit) $query .= " LIMIT ".$globalMap3DMarinesLimit; |
|
264 | + if ($limit) { |
|
265 | + $query .= " LIMIT ".$globalMap3DMarinesLimit; |
|
266 | + } |
|
234 | 267 | } else { |
235 | 268 | $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, marine_live.captain_name |
236 | 269 | FROM marine_live".$filter_query." CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= marine_live.date "; |
237 | - if ($usecoord) $query .= "AND marine_live.latitude BETWEEN ".$minlat." AND ".$maxlat." AND marine_live.longitude BETWEEN ".$minlong." AND ".$maxlong." "; |
|
270 | + if ($usecoord) { |
|
271 | + $query .= "AND marine_live.latitude BETWEEN ".$minlat." AND ".$maxlat." AND marine_live.longitude BETWEEN ".$minlong." AND ".$maxlong." "; |
|
272 | + } |
|
238 | 273 | $query .= "AND marine_live.latitude <> '0' AND marine_live.longitude <> '0' |
239 | 274 | ORDER BY marine_live.fammarine_id, marine_live.date"; |
240 | - if ($limit) $query .= " LIMIT ".$globalMap3DMarinesLimit; |
|
275 | + if ($limit) { |
|
276 | + $query .= " LIMIT ".$globalMap3DMarinesLimit; |
|
277 | + } |
|
241 | 278 | } |
242 | 279 | } |
243 | 280 | try { |
@@ -262,7 +299,9 @@ discard block |
||
262 | 299 | global $globalDBdriver, $globalLiveInterval; |
263 | 300 | $filter_query = $this->getFilter($filter,true,true); |
264 | 301 | |
265 | - if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
|
302 | + if (!isset($globalLiveInterval)) { |
|
303 | + $globalLiveInterval = '200'; |
|
304 | + } |
|
266 | 305 | if ($globalDBdriver == 'mysql') { |
267 | 306 | $query = 'SELECT COUNT(DISTINCT marine_live.fammarine_id) as nb FROM marine_live'.$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= date'; |
268 | 307 | } else { |
@@ -290,7 +329,9 @@ discard block |
||
290 | 329 | { |
291 | 330 | global $globalDBdriver, $globalLiveInterval; |
292 | 331 | $Marine = new Marine($this->db); |
293 | - if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
|
332 | + if (!isset($globalLiveInterval)) { |
|
333 | + $globalLiveInterval = '200'; |
|
334 | + } |
|
294 | 335 | $filter_query = $this->getFilter($filter); |
295 | 336 | |
296 | 337 | if (is_array($coord)) { |
@@ -298,7 +339,9 @@ discard block |
||
298 | 339 | $minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
299 | 340 | $maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
300 | 341 | $maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
301 | - } else return array(); |
|
342 | + } else { |
|
343 | + return array(); |
|
344 | + } |
|
302 | 345 | if ($globalDBdriver == 'mysql') { |
303 | 346 | $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 ORDER BY date DESC'.$filter_query; |
304 | 347 | } else { |
@@ -318,7 +361,9 @@ discard block |
||
318 | 361 | { |
319 | 362 | global $globalDBdriver, $globalLiveInterval, $globalArchive; |
320 | 363 | $Marine = new Marine($this->db); |
321 | - if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
|
364 | + if (!isset($globalLiveInterval)) { |
|
365 | + $globalLiveInterval = '200'; |
|
366 | + } |
|
322 | 367 | $filter_query = $this->getFilter($filter,true,true); |
323 | 368 | |
324 | 369 | if (is_array($coord)) { |
@@ -326,7 +371,9 @@ discard block |
||
326 | 371 | $minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
327 | 372 | $maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
328 | 373 | $maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
329 | - } else return array(); |
|
374 | + } else { |
|
375 | + return array(); |
|
376 | + } |
|
330 | 377 | /* |
331 | 378 | if ($globalDBdriver == 'mysql') { |
332 | 379 | $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 |
@@ -549,11 +596,15 @@ discard block |
||
549 | 596 | //$query = self::$global_query.' WHERE marine_live.fammarine_id = :id ORDER BY date'; |
550 | 597 | if ($globalDBdriver == 'mysql') { |
551 | 598 | $query = 'SELECT marine_live.* FROM marine_live WHERE marine_live.fammarine_id = :id'; |
552 | - if ($liveinterval) $query .= ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= date'; |
|
599 | + if ($liveinterval) { |
|
600 | + $query .= ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= date'; |
|
601 | + } |
|
553 | 602 | $query .= ' ORDER BY date'; |
554 | 603 | } else { |
555 | 604 | $query = 'SELECT marine_live.* FROM marine_live WHERE marine_live.fammarine_id = :id'; |
556 | - if ($liveinterval) $query .= " AND CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= date"; |
|
605 | + if ($liveinterval) { |
|
606 | + $query .= " AND CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= date"; |
|
607 | + } |
|
557 | 608 | $query .= ' ORDER BY date'; |
558 | 609 | } |
559 | 610 | |
@@ -648,7 +699,9 @@ discard block |
||
648 | 699 | $i++; |
649 | 700 | $j++; |
650 | 701 | if ($j == 30) { |
651 | - if ($globalDebug) echo "."; |
|
702 | + if ($globalDebug) { |
|
703 | + echo "."; |
|
704 | + } |
|
652 | 705 | try { |
653 | 706 | |
654 | 707 | $sth = $this->db->prepare(substr($query_delete,0,-1).")"); |
@@ -943,7 +996,9 @@ discard block |
||
943 | 996 | { |
944 | 997 | return false; |
945 | 998 | } |
946 | - } else return ''; |
|
999 | + } else { |
|
1000 | + return ''; |
|
1001 | + } |
|
947 | 1002 | |
948 | 1003 | if ($longitude != '') |
949 | 1004 | { |
@@ -951,7 +1006,9 @@ discard block |
||
951 | 1006 | { |
952 | 1007 | return false; |
953 | 1008 | } |
954 | - } else return ''; |
|
1009 | + } else { |
|
1010 | + return ''; |
|
1011 | + } |
|
955 | 1012 | |
956 | 1013 | |
957 | 1014 | if ($heading != '') |
@@ -960,7 +1017,9 @@ discard block |
||
960 | 1017 | { |
961 | 1018 | return false; |
962 | 1019 | } |
963 | - } else $heading = 0; |
|
1020 | + } else { |
|
1021 | + $heading = 0; |
|
1022 | + } |
|
964 | 1023 | |
965 | 1024 | if ($groundspeed != '') |
966 | 1025 | { |
@@ -968,9 +1027,13 @@ discard block |
||
968 | 1027 | { |
969 | 1028 | return false; |
970 | 1029 | } |
971 | - } else $groundspeed = 0; |
|
1030 | + } else { |
|
1031 | + $groundspeed = 0; |
|
1032 | + } |
|
972 | 1033 | date_default_timezone_set('UTC'); |
973 | - if ($date == '') $date = date("Y-m-d H:i:s", time()); |
|
1034 | + if ($date == '') { |
|
1035 | + $date = date("Y-m-d H:i:s", time()); |
|
1036 | + } |
|
974 | 1037 | |
975 | 1038 | |
976 | 1039 | $fammarine_id = filter_var($fammarine_id,FILTER_SANITIZE_STRING); |
@@ -995,15 +1058,27 @@ discard block |
||
995 | 1058 | $captain_name = filter_var($captain_name,FILTER_SANITIZE_STRING); |
996 | 1059 | $race_id = filter_var($race_id,FILTER_SANITIZE_STRING); |
997 | 1060 | $race_name = filter_var($race_name,FILTER_SANITIZE_STRING); |
998 | - if ($typeid == '') $typeid = NULL; |
|
999 | - if ($statusid == '') $statusid = NULL; |
|
1061 | + if ($typeid == '') { |
|
1062 | + $typeid = NULL; |
|
1063 | + } |
|
1064 | + if ($statusid == '') { |
|
1065 | + $statusid = NULL; |
|
1066 | + } |
|
1000 | 1067 | |
1001 | - if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) $groundspeed = 0; |
|
1002 | - if ($heading == '' || $Common->isInteger($heading) === false ) $heading = 0; |
|
1003 | - if ($arrival_date == '') $arrival_date = NULL; |
|
1068 | + if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) { |
|
1069 | + $groundspeed = 0; |
|
1070 | + } |
|
1071 | + if ($heading == '' || $Common->isInteger($heading) === false ) { |
|
1072 | + $heading = 0; |
|
1073 | + } |
|
1074 | + if ($arrival_date == '') { |
|
1075 | + $arrival_date = NULL; |
|
1076 | + } |
|
1004 | 1077 | $query = ''; |
1005 | 1078 | if ($globalArchive) { |
1006 | - if ($globalDebug) echo '-- Delete previous data -- '; |
|
1079 | + if ($globalDebug) { |
|
1080 | + echo '-- Delete previous data -- '; |
|
1081 | + } |
|
1007 | 1082 | $query .= 'DELETE FROM marine_live WHERE fammarine_id = :fammarine_id;'; |
1008 | 1083 | } |
1009 | 1084 | $query .= 'INSERT INTO marine_live (fammarine_id, ident, latitude, longitude, heading, ground_speed, date, format_source, source_name, over_country, mmsi, type,type_id,status,status_id,imo,arrival_port_name,arrival_port_date,captain_id,captain_name,race_id,race_name) |
@@ -1018,10 +1093,14 @@ discard block |
||
1018 | 1093 | } |
1019 | 1094 | |
1020 | 1095 | if (isset($globalArchive) && $globalArchive && $putinarchive && $noarchive !== true) { |
1021 | - if ($globalDebug) echo '(Add to Marine archive : '; |
|
1096 | + if ($globalDebug) { |
|
1097 | + echo '(Add to Marine archive : '; |
|
1098 | + } |
|
1022 | 1099 | $MarineArchive = new MarineArchive($this->db); |
1023 | 1100 | $result = $MarineArchive->addMarineArchiveData($fammarine_id, $ident, $latitude, $longitude, $heading, $groundspeed, $date, $putinarchive, $mmsi,$type,$typeid,$imo, $callsign,$arrival_code,$arrival_date,$status,$statusid,$noarchive,$format_source, $source_name, $over_country,$captain_id,$captain_name,$race_id,$race_name); |
1024 | - if ($globalDebug) echo $result.')'; |
|
1101 | + if ($globalDebug) { |
|
1102 | + echo $result.')'; |
|
1103 | + } |
|
1025 | 1104 | } |
1026 | 1105 | return "success"; |
1027 | 1106 | } |
@@ -13,10 +13,10 @@ discard block |
||
13 | 13 | |
14 | 14 | |
15 | 15 | /** |
16 | - * Get SQL query part for filter used |
|
17 | - * @param Array $filter the filter |
|
18 | - * @return Array the SQL part |
|
19 | - */ |
|
16 | + * Get SQL query part for filter used |
|
17 | + * @param Array $filter the filter |
|
18 | + * @return Array the SQL part |
|
19 | + */ |
|
20 | 20 | public function getFilter($filter = array(),$where = false,$and = false) { |
21 | 21 | global $globalFilter, $globalStatsFilters, $globalFilterName, $globalDBdriver; |
22 | 22 | $filters = array(); |
@@ -96,11 +96,11 @@ discard block |
||
96 | 96 | } |
97 | 97 | |
98 | 98 | /** |
99 | - * Gets all the spotter information based on the latest data entry |
|
100 | - * |
|
101 | - * @return Array the spotter information |
|
102 | - * |
|
103 | - */ |
|
99 | + * Gets all the spotter information based on the latest data entry |
|
100 | + * |
|
101 | + * @return Array the spotter information |
|
102 | + * |
|
103 | + */ |
|
104 | 104 | public function getLiveMarineData($limit = '', $sort = '', $filter = array()) |
105 | 105 | { |
106 | 106 | global $globalDBdriver, $globalLiveInterval; |
@@ -143,11 +143,11 @@ discard block |
||
143 | 143 | } |
144 | 144 | |
145 | 145 | /** |
146 | - * Gets Minimal Live Spotter data |
|
147 | - * |
|
148 | - * @return Array the spotter information |
|
149 | - * |
|
150 | - */ |
|
146 | + * Gets Minimal Live Spotter data |
|
147 | + * |
|
148 | + * @return Array the spotter information |
|
149 | + * |
|
150 | + */ |
|
151 | 151 | public function getMinLiveMarineData($filter = array()) |
152 | 152 | { |
153 | 153 | global $globalDBdriver, $globalLiveInterval; |
@@ -177,11 +177,11 @@ discard block |
||
177 | 177 | } |
178 | 178 | |
179 | 179 | /** |
180 | - * Gets Minimal Live Spotter data since xx seconds |
|
181 | - * |
|
182 | - * @return Array the spotter information |
|
183 | - * |
|
184 | - */ |
|
180 | + * Gets Minimal Live Spotter data since xx seconds |
|
181 | + * |
|
182 | + * @return Array the spotter information |
|
183 | + * |
|
184 | + */ |
|
185 | 185 | public function getMinLastLiveMarineData($coord = array(),$filter = array(), $limit = false) |
186 | 186 | { |
187 | 187 | global $globalDBdriver, $globalLiveInterval, $globalMap3DMarinesLimit, $globalArchive; |
@@ -252,11 +252,11 @@ discard block |
||
252 | 252 | } |
253 | 253 | |
254 | 254 | /** |
255 | - * Gets number of latest data entry |
|
256 | - * |
|
257 | - * @return String number of entry |
|
258 | - * |
|
259 | - */ |
|
255 | + * Gets number of latest data entry |
|
256 | + * |
|
257 | + * @return String number of entry |
|
258 | + * |
|
259 | + */ |
|
260 | 260 | public function getLiveMarineCount($filter = array()) |
261 | 261 | { |
262 | 262 | global $globalDBdriver, $globalLiveInterval; |
@@ -281,11 +281,11 @@ discard block |
||
281 | 281 | } |
282 | 282 | |
283 | 283 | /** |
284 | - * Gets all the spotter information based on the latest data entry and coord |
|
285 | - * |
|
286 | - * @return Array the spotter information |
|
287 | - * |
|
288 | - */ |
|
284 | + * Gets all the spotter information based on the latest data entry and coord |
|
285 | + * |
|
286 | + * @return Array the spotter information |
|
287 | + * |
|
288 | + */ |
|
289 | 289 | public function getLiveMarineDatabyCoord($coord, $filter = array()) |
290 | 290 | { |
291 | 291 | global $globalDBdriver, $globalLiveInterval; |
@@ -309,11 +309,11 @@ discard block |
||
309 | 309 | } |
310 | 310 | |
311 | 311 | /** |
312 | - * Gets all the spotter information based on the latest data entry and coord |
|
313 | - * |
|
314 | - * @return Array the spotter information |
|
315 | - * |
|
316 | - */ |
|
312 | + * Gets all the spotter information based on the latest data entry and coord |
|
313 | + * |
|
314 | + * @return Array the spotter information |
|
315 | + * |
|
316 | + */ |
|
317 | 317 | public function getMinLiveMarineDatabyCoord($coord, $filter = array()) |
318 | 318 | { |
319 | 319 | global $globalDBdriver, $globalLiveInterval, $globalArchive; |
@@ -382,11 +382,11 @@ discard block |
||
382 | 382 | } |
383 | 383 | |
384 | 384 | /** |
385 | - * Gets all the spotter information based on a user's latitude and longitude |
|
386 | - * |
|
387 | - * @return Array the spotter information |
|
388 | - * |
|
389 | - */ |
|
385 | + * Gets all the spotter information based on a user's latitude and longitude |
|
386 | + * |
|
387 | + * @return Array the spotter information |
|
388 | + * |
|
389 | + */ |
|
390 | 390 | public function getLatestMarineForLayar($lat, $lng, $radius, $interval) |
391 | 391 | { |
392 | 392 | $Marine = new Marine($this->db); |
@@ -399,75 +399,75 @@ discard block |
||
399 | 399 | if ($lng != '') |
400 | 400 | { |
401 | 401 | if (!is_numeric($lng)) |
402 | - { |
|
403 | - return false; |
|
404 | - } |
|
405 | - } |
|
406 | - |
|
407 | - if ($radius != '') |
|
408 | - { |
|
409 | - if (!is_numeric($radius)) |
|
410 | - { |
|
411 | - return false; |
|
412 | - } |
|
413 | - } |
|
402 | + { |
|
403 | + return false; |
|
404 | + } |
|
405 | + } |
|
406 | + |
|
407 | + if ($radius != '') |
|
408 | + { |
|
409 | + if (!is_numeric($radius)) |
|
410 | + { |
|
411 | + return false; |
|
412 | + } |
|
413 | + } |
|
414 | 414 | $additional_query = ''; |
415 | 415 | if ($interval != '') |
416 | - { |
|
417 | - if (!is_string($interval)) |
|
418 | - { |
|
419 | - //$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= marine_live.date '; |
|
420 | - return false; |
|
421 | - } else { |
|
422 | - if ($interval == '1m') |
|
423 | - { |
|
424 | - $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= marine_live.date '; |
|
425 | - } else if ($interval == '15m'){ |
|
426 | - $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 15 MINUTE) <= marine_live.date '; |
|
427 | - } |
|
428 | - } |
|
429 | - } else { |
|
430 | - $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= marine_live.date '; |
|
431 | - } |
|
432 | - |
|
433 | - $query = "SELECT marine_live.*, ( 6371 * acos( cos( radians(:lat) ) * cos( radians( latitude ) ) * cos( radians( longitude ) - radians(:lng) ) + sin( radians(:lat) ) * sin( radians( latitude ) ) ) ) AS distance FROM marine_live |
|
416 | + { |
|
417 | + if (!is_string($interval)) |
|
418 | + { |
|
419 | + //$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= marine_live.date '; |
|
420 | + return false; |
|
421 | + } else { |
|
422 | + if ($interval == '1m') |
|
423 | + { |
|
424 | + $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= marine_live.date '; |
|
425 | + } else if ($interval == '15m'){ |
|
426 | + $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 15 MINUTE) <= marine_live.date '; |
|
427 | + } |
|
428 | + } |
|
429 | + } else { |
|
430 | + $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= marine_live.date '; |
|
431 | + } |
|
432 | + |
|
433 | + $query = "SELECT marine_live.*, ( 6371 * acos( cos( radians(:lat) ) * cos( radians( latitude ) ) * cos( radians( longitude ) - radians(:lng) ) + sin( radians(:lat) ) * sin( radians( latitude ) ) ) ) AS distance FROM marine_live |
|
434 | 434 | WHERE marine_live.latitude <> '' |
435 | 435 | AND marine_live.longitude <> '' |
436 | 436 | ".$additional_query." |
437 | 437 | HAVING distance < :radius |
438 | 438 | ORDER BY distance"; |
439 | 439 | |
440 | - $spotter_array = $Marine->getDataFromDB($query, array(':lat' => $lat, ':lng' => $lng,':radius' => $radius)); |
|
440 | + $spotter_array = $Marine->getDataFromDB($query, array(':lat' => $lat, ':lng' => $lng,':radius' => $radius)); |
|
441 | 441 | |
442 | - return $spotter_array; |
|
443 | - } |
|
442 | + return $spotter_array; |
|
443 | + } |
|
444 | 444 | |
445 | 445 | |
446 | - /** |
|
447 | - * Gets all the spotter information based on a particular callsign |
|
448 | - * |
|
449 | - * @return Array the spotter information |
|
450 | - * |
|
451 | - */ |
|
446 | + /** |
|
447 | + * Gets all the spotter information based on a particular callsign |
|
448 | + * |
|
449 | + * @return Array the spotter information |
|
450 | + * |
|
451 | + */ |
|
452 | 452 | public function getLastLiveMarineDataByIdent($ident) |
453 | 453 | { |
454 | 454 | $Marine = new Marine($this->db); |
455 | 455 | date_default_timezone_set('UTC'); |
456 | 456 | |
457 | 457 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
458 | - $query = 'SELECT marine_live.* FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l WHERE l.ident = :ident GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate ORDER BY marine_live.date DESC'; |
|
458 | + $query = 'SELECT marine_live.* FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l WHERE l.ident = :ident GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate ORDER BY marine_live.date DESC'; |
|
459 | 459 | |
460 | 460 | $spotter_array = $Marine->getDataFromDB($query,array(':ident' => $ident),'',true); |
461 | 461 | |
462 | 462 | return $spotter_array; |
463 | 463 | } |
464 | 464 | |
465 | - /** |
|
466 | - * Gets all the spotter information based on a particular callsign |
|
467 | - * |
|
468 | - * @return Array the spotter information |
|
469 | - * |
|
470 | - */ |
|
465 | + /** |
|
466 | + * Gets all the spotter information based on a particular callsign |
|
467 | + * |
|
468 | + * @return Array the spotter information |
|
469 | + * |
|
470 | + */ |
|
471 | 471 | public function getDateLiveMarineDataByIdent($ident,$date) |
472 | 472 | { |
473 | 473 | $Marine = new Marine($this->db); |
@@ -480,11 +480,11 @@ discard block |
||
480 | 480 | } |
481 | 481 | |
482 | 482 | /** |
483 | - * Gets all the spotter information based on a particular MMSI |
|
484 | - * |
|
485 | - * @return Array the spotter information |
|
486 | - * |
|
487 | - */ |
|
483 | + * Gets all the spotter information based on a particular MMSI |
|
484 | + * |
|
485 | + * @return Array the spotter information |
|
486 | + * |
|
487 | + */ |
|
488 | 488 | public function getDateLiveMarineDataByMMSI($mmsi,$date) |
489 | 489 | { |
490 | 490 | $Marine = new Marine($this->db); |
@@ -496,51 +496,51 @@ discard block |
||
496 | 496 | return $spotter_array; |
497 | 497 | } |
498 | 498 | |
499 | - /** |
|
500 | - * Gets last spotter information based on a particular callsign |
|
501 | - * |
|
502 | - * @return Array the spotter information |
|
503 | - * |
|
504 | - */ |
|
499 | + /** |
|
500 | + * Gets last spotter information based on a particular callsign |
|
501 | + * |
|
502 | + * @return Array the spotter information |
|
503 | + * |
|
504 | + */ |
|
505 | 505 | public function getLastLiveMarineDataById($id) |
506 | 506 | { |
507 | 507 | $Marine = new Marine($this->db); |
508 | 508 | date_default_timezone_set('UTC'); |
509 | 509 | |
510 | 510 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
511 | - $query = 'SELECT marine_live.* FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l WHERE l.fammarine_id = :id GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate ORDER BY marine_live.date DESC'; |
|
511 | + $query = 'SELECT marine_live.* FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l WHERE l.fammarine_id = :id GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate ORDER BY marine_live.date DESC'; |
|
512 | 512 | |
513 | 513 | $spotter_array = $Marine->getDataFromDB($query,array(':id' => $id),'',true); |
514 | 514 | |
515 | 515 | return $spotter_array; |
516 | 516 | } |
517 | 517 | |
518 | - /** |
|
519 | - * Gets last spotter information based on a particular callsign |
|
520 | - * |
|
521 | - * @return Array the spotter information |
|
522 | - * |
|
523 | - */ |
|
518 | + /** |
|
519 | + * Gets last spotter information based on a particular callsign |
|
520 | + * |
|
521 | + * @return Array the spotter information |
|
522 | + * |
|
523 | + */ |
|
524 | 524 | public function getDateLiveMarineDataById($id,$date) |
525 | 525 | { |
526 | 526 | $Marine = new Marine($this->db); |
527 | 527 | date_default_timezone_set('UTC'); |
528 | 528 | |
529 | 529 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
530 | - $query = 'SELECT marine_live.* FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l WHERE l.fammarine_id = :id AND l.date <= :date GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate ORDER BY marine_live.date DESC'; |
|
531 | - $date = date('c',$date); |
|
530 | + $query = 'SELECT marine_live.* FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l WHERE l.fammarine_id = :id AND l.date <= :date GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate ORDER BY marine_live.date DESC'; |
|
531 | + $date = date('c',$date); |
|
532 | 532 | $spotter_array = $Marine->getDataFromDB($query,array(':id' => $id,':date' => $date),'',true); |
533 | 533 | |
534 | 534 | return $spotter_array; |
535 | 535 | } |
536 | 536 | |
537 | 537 | |
538 | - /** |
|
539 | - * Gets all the spotter information based on a particular id |
|
540 | - * |
|
541 | - * @return Array the spotter information |
|
542 | - * |
|
543 | - */ |
|
538 | + /** |
|
539 | + * Gets all the spotter information based on a particular id |
|
540 | + * |
|
541 | + * @return Array the spotter information |
|
542 | + * |
|
543 | + */ |
|
544 | 544 | public function getAllLiveMarineDataById($id,$liveinterval = false) |
545 | 545 | { |
546 | 546 | global $globalDBdriver, $globalLiveInterval; |
@@ -568,18 +568,18 @@ discard block |
||
568 | 568 | return $spotter_array; |
569 | 569 | } |
570 | 570 | |
571 | - /** |
|
572 | - * Gets all the spotter information based on a particular ident |
|
573 | - * |
|
574 | - * @return Array the spotter information |
|
575 | - * |
|
576 | - */ |
|
571 | + /** |
|
572 | + * Gets all the spotter information based on a particular ident |
|
573 | + * |
|
574 | + * @return Array the spotter information |
|
575 | + * |
|
576 | + */ |
|
577 | 577 | public function getAllLiveMarineDataByIdent($ident) |
578 | 578 | { |
579 | 579 | date_default_timezone_set('UTC'); |
580 | 580 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
581 | 581 | $query = self::$global_query.' WHERE marine_live.ident = :ident'; |
582 | - try { |
|
582 | + try { |
|
583 | 583 | |
584 | 584 | $sth = $this->db->prepare($query); |
585 | 585 | $sth->execute(array(':ident' => $ident)); |
@@ -593,23 +593,23 @@ discard block |
||
593 | 593 | |
594 | 594 | |
595 | 595 | /** |
596 | - * Deletes all info in the table |
|
597 | - * |
|
598 | - * @return String success or false |
|
599 | - * |
|
600 | - */ |
|
596 | + * Deletes all info in the table |
|
597 | + * |
|
598 | + * @return String success or false |
|
599 | + * |
|
600 | + */ |
|
601 | 601 | public function deleteLiveMarineData() |
602 | 602 | { |
603 | 603 | global $globalDBdriver; |
604 | 604 | if ($globalDBdriver == 'mysql') { |
605 | 605 | //$query = "DELETE FROM marine_live WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL 30 MINUTE) >= marine_live.date"; |
606 | 606 | $query = 'DELETE FROM marine_live WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL 9 HOUR) >= marine_live.date'; |
607 | - //$query = "DELETE FROM marine_live WHERE marine_live.id IN (SELECT marine_live.id FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 HOUR) >= marine_live.date)"; |
|
607 | + //$query = "DELETE FROM marine_live WHERE marine_live.id IN (SELECT marine_live.id FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 HOUR) >= marine_live.date)"; |
|
608 | 608 | } else { |
609 | 609 | $query = "DELETE FROM marine_live WHERE NOW() AT TIME ZONE 'UTC' - INTERVAL '9 HOURS' >= marine_live.date"; |
610 | 610 | } |
611 | 611 | |
612 | - try { |
|
612 | + try { |
|
613 | 613 | |
614 | 614 | $sth = $this->db->prepare($query); |
615 | 615 | $sth->execute(); |
@@ -621,18 +621,18 @@ discard block |
||
621 | 621 | } |
622 | 622 | |
623 | 623 | /** |
624 | - * Deletes all info in the table for aircraft not seen since 2 HOUR |
|
625 | - * |
|
626 | - * @return String success or false |
|
627 | - * |
|
628 | - */ |
|
624 | + * Deletes all info in the table for aircraft not seen since 2 HOUR |
|
625 | + * |
|
626 | + * @return String success or false |
|
627 | + * |
|
628 | + */ |
|
629 | 629 | public function deleteLiveMarineDataNotUpdated() |
630 | 630 | { |
631 | 631 | global $globalDBdriver, $globalDebug; |
632 | 632 | if ($globalDBdriver == 'mysql') { |
633 | 633 | //$query = 'SELECT fammarine_id FROM marine_live WHERE DATE_SUB(UTC_TIMESTAMP(), INTERVAL 1 HOUR) >= marine_live.date AND marine_live.fammarine_id NOT IN (SELECT fammarine_id FROM marine_live WHERE DATE_SUB(UTC_TIMESTAMP(), INTERVAL 1 HOUR) < marine_live.date) LIMIT 800 OFFSET 0'; |
634 | - $query = "SELECT marine_live.fammarine_id FROM marine_live INNER JOIN (SELECT fammarine_id,MAX(date) as max_date FROM marine_live GROUP BY fammarine_id) s ON s.fammarine_id = marine_live.fammarine_id AND DATE_SUB(UTC_TIMESTAMP(), INTERVAL 2 HOUR) >= s.max_date LIMIT 1200 OFFSET 0"; |
|
635 | - try { |
|
634 | + $query = "SELECT marine_live.fammarine_id FROM marine_live INNER JOIN (SELECT fammarine_id,MAX(date) as max_date FROM marine_live GROUP BY fammarine_id) s ON s.fammarine_id = marine_live.fammarine_id AND DATE_SUB(UTC_TIMESTAMP(), INTERVAL 2 HOUR) >= s.max_date LIMIT 1200 OFFSET 0"; |
|
635 | + try { |
|
636 | 636 | |
637 | 637 | $sth = $this->db->prepare($query); |
638 | 638 | $sth->execute(); |
@@ -640,8 +640,8 @@ discard block |
||
640 | 640 | return "error"; |
641 | 641 | } |
642 | 642 | $query_delete = 'DELETE FROM marine_live WHERE fammarine_id IN ('; |
643 | - $i = 0; |
|
644 | - $j =0; |
|
643 | + $i = 0; |
|
644 | + $j =0; |
|
645 | 645 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
646 | 646 | foreach($all as $row) |
647 | 647 | { |
@@ -649,20 +649,20 @@ discard block |
||
649 | 649 | $j++; |
650 | 650 | if ($j == 30) { |
651 | 651 | if ($globalDebug) echo "."; |
652 | - try { |
|
652 | + try { |
|
653 | 653 | |
654 | 654 | $sth = $this->db->prepare(substr($query_delete,0,-1).")"); |
655 | 655 | $sth->execute(); |
656 | 656 | } catch(PDOException $e) { |
657 | 657 | return "error"; |
658 | 658 | } |
659 | - $query_delete = 'DELETE FROM marine_live WHERE fammarine_id IN ('; |
|
660 | - $j = 0; |
|
659 | + $query_delete = 'DELETE FROM marine_live WHERE fammarine_id IN ('; |
|
660 | + $j = 0; |
|
661 | 661 | } |
662 | 662 | $query_delete .= "'".$row['fammarine_id']."',"; |
663 | 663 | } |
664 | 664 | if ($i > 0) { |
665 | - try { |
|
665 | + try { |
|
666 | 666 | |
667 | 667 | $sth = $this->db->prepare(substr($query_delete,0,-1).")"); |
668 | 668 | $sth->execute(); |
@@ -673,9 +673,9 @@ discard block |
||
673 | 673 | return "success"; |
674 | 674 | } elseif ($globalDBdriver == 'pgsql') { |
675 | 675 | //$query = "SELECT fammarine_id FROM marine_live WHERE NOW() AT TIME ZONE 'UTC' - INTERVAL '9 HOURS' >= marine_live.date AND marine_live.fammarine_id NOT IN (SELECT fammarine_id FROM marine_live WHERE NOW() AT TIME ZONE 'UTC' - INTERVAL '9 HOURS' < marine_live.date) LIMIT 800 OFFSET 0"; |
676 | - //$query = "SELECT marine_live.fammarine_id FROM marine_live INNER JOIN (SELECT fammarine_id,MAX(date) as max_date FROM marine_live GROUP BY fammarine_id) s ON s.fammarine_id = marine_live.fammarine_id AND NOW() AT TIME ZONE 'UTC' - INTERVAL '2 HOURS' >= s.max_date LIMIT 800 OFFSET 0"; |
|
677 | - $query = "DELETE FROM marine_live WHERE fammarine_id IN (SELECT marine_live.fammarine_id FROM marine_live INNER JOIN (SELECT fammarine_id,MAX(date) as max_date FROM marine_live GROUP BY fammarine_id) s ON s.fammarine_id = marine_live.fammarine_id AND NOW() AT TIME ZONE 'UTC' - INTERVAL '2 HOURS' >= s.max_date LIMIT 800 OFFSET 0)"; |
|
678 | - try { |
|
676 | + //$query = "SELECT marine_live.fammarine_id FROM marine_live INNER JOIN (SELECT fammarine_id,MAX(date) as max_date FROM marine_live GROUP BY fammarine_id) s ON s.fammarine_id = marine_live.fammarine_id AND NOW() AT TIME ZONE 'UTC' - INTERVAL '2 HOURS' >= s.max_date LIMIT 800 OFFSET 0"; |
|
677 | + $query = "DELETE FROM marine_live WHERE fammarine_id IN (SELECT marine_live.fammarine_id FROM marine_live INNER JOIN (SELECT fammarine_id,MAX(date) as max_date FROM marine_live GROUP BY fammarine_id) s ON s.fammarine_id = marine_live.fammarine_id AND NOW() AT TIME ZONE 'UTC' - INTERVAL '2 HOURS' >= s.max_date LIMIT 800 OFFSET 0)"; |
|
678 | + try { |
|
679 | 679 | |
680 | 680 | $sth = $this->db->prepare($query); |
681 | 681 | $sth->execute(); |
@@ -719,17 +719,17 @@ discard block |
||
719 | 719 | } |
720 | 720 | |
721 | 721 | /** |
722 | - * Deletes all info in the table for an ident |
|
723 | - * |
|
724 | - * @return String success or false |
|
725 | - * |
|
726 | - */ |
|
722 | + * Deletes all info in the table for an ident |
|
723 | + * |
|
724 | + * @return String success or false |
|
725 | + * |
|
726 | + */ |
|
727 | 727 | public function deleteLiveMarineDataByIdent($ident) |
728 | 728 | { |
729 | 729 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
730 | 730 | $query = 'DELETE FROM marine_live WHERE ident = :ident'; |
731 | 731 | |
732 | - try { |
|
732 | + try { |
|
733 | 733 | |
734 | 734 | $sth = $this->db->prepare($query); |
735 | 735 | $sth->execute(array(':ident' => $ident)); |
@@ -741,17 +741,17 @@ discard block |
||
741 | 741 | } |
742 | 742 | |
743 | 743 | /** |
744 | - * Deletes all info in the table for an id |
|
745 | - * |
|
746 | - * @return String success or false |
|
747 | - * |
|
748 | - */ |
|
744 | + * Deletes all info in the table for an id |
|
745 | + * |
|
746 | + * @return String success or false |
|
747 | + * |
|
748 | + */ |
|
749 | 749 | public function deleteLiveMarineDataById($id) |
750 | 750 | { |
751 | 751 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
752 | 752 | $query = 'DELETE FROM marine_live WHERE fammarine_id = :id'; |
753 | 753 | |
754 | - try { |
|
754 | + try { |
|
755 | 755 | |
756 | 756 | $sth = $this->db->prepare($query); |
757 | 757 | $sth->execute(array(':id' => $id)); |
@@ -764,11 +764,11 @@ discard block |
||
764 | 764 | |
765 | 765 | |
766 | 766 | /** |
767 | - * Gets the marine races |
|
768 | - * |
|
769 | - * @return Array all races |
|
770 | - * |
|
771 | - */ |
|
767 | + * Gets the marine races |
|
768 | + * |
|
769 | + * @return Array all races |
|
770 | + * |
|
771 | + */ |
|
772 | 772 | public function getAllRaces() |
773 | 773 | { |
774 | 774 | $query = 'SELECT DISTINCT marine_live.race_id, marine_live.race_name FROM marine_live ORDER BY marine_live.race_name'; |
@@ -778,11 +778,11 @@ discard block |
||
778 | 778 | } |
779 | 779 | |
780 | 780 | /** |
781 | - * Gets the aircraft ident within the last hour |
|
782 | - * |
|
783 | - * @return String the ident |
|
784 | - * |
|
785 | - */ |
|
781 | + * Gets the aircraft ident within the last hour |
|
782 | + * |
|
783 | + * @return String the ident |
|
784 | + * |
|
785 | + */ |
|
786 | 786 | public function getIdentFromLastHour($ident) |
787 | 787 | { |
788 | 788 | global $globalDBdriver, $globalTimezone; |
@@ -808,14 +808,14 @@ discard block |
||
808 | 808 | $ident_result = $row['ident']; |
809 | 809 | } |
810 | 810 | return $ident_result; |
811 | - } |
|
811 | + } |
|
812 | 812 | |
813 | 813 | /** |
814 | - * Check recent aircraft |
|
815 | - * |
|
816 | - * @return String the ident |
|
817 | - * |
|
818 | - */ |
|
814 | + * Check recent aircraft |
|
815 | + * |
|
816 | + * @return String the ident |
|
817 | + * |
|
818 | + */ |
|
819 | 819 | public function checkIdentRecent($ident) |
820 | 820 | { |
821 | 821 | global $globalDBdriver, $globalTimezone; |
@@ -841,14 +841,14 @@ discard block |
||
841 | 841 | $ident_result = $row['fammarine_id']; |
842 | 842 | } |
843 | 843 | return $ident_result; |
844 | - } |
|
844 | + } |
|
845 | 845 | |
846 | 846 | /** |
847 | - * Check recent aircraft by id |
|
848 | - * |
|
849 | - * @return String the ident |
|
850 | - * |
|
851 | - */ |
|
847 | + * Check recent aircraft by id |
|
848 | + * |
|
849 | + * @return String the ident |
|
850 | + * |
|
851 | + */ |
|
852 | 852 | public function checkIdRecent($id) |
853 | 853 | { |
854 | 854 | global $globalDBdriver, $globalTimezone; |
@@ -874,14 +874,14 @@ discard block |
||
874 | 874 | $ident_result = $row['fammarine_id']; |
875 | 875 | } |
876 | 876 | return $ident_result; |
877 | - } |
|
877 | + } |
|
878 | 878 | |
879 | 879 | /** |
880 | - * Check recent aircraft by mmsi |
|
881 | - * |
|
882 | - * @return String the ident |
|
883 | - * |
|
884 | - */ |
|
880 | + * Check recent aircraft by mmsi |
|
881 | + * |
|
882 | + * @return String the ident |
|
883 | + * |
|
884 | + */ |
|
885 | 885 | public function checkMMSIRecent($mmsi) |
886 | 886 | { |
887 | 887 | global $globalDBdriver, $globalTimezone; |
@@ -907,19 +907,19 @@ discard block |
||
907 | 907 | $ident_result = $row['fammarine_id']; |
908 | 908 | } |
909 | 909 | return $ident_result; |
910 | - } |
|
910 | + } |
|
911 | 911 | |
912 | 912 | /** |
913 | - * Adds a new spotter data |
|
914 | - * |
|
915 | - * @param String $fammarine_id the ID from flightaware |
|
916 | - * @param String $ident the flight ident |
|
917 | - * @param String $aircraft_icao the aircraft type |
|
918 | - * @param String $departure_airport_icao the departure airport |
|
919 | - * @param String $arrival_airport_icao the arrival airport |
|
920 | - * @return String success or false |
|
921 | - * |
|
922 | - */ |
|
913 | + * Adds a new spotter data |
|
914 | + * |
|
915 | + * @param String $fammarine_id the ID from flightaware |
|
916 | + * @param String $ident the flight ident |
|
917 | + * @param String $aircraft_icao the aircraft type |
|
918 | + * @param String $departure_airport_icao the departure airport |
|
919 | + * @param String $arrival_airport_icao the arrival airport |
|
920 | + * @return String success or false |
|
921 | + * |
|
922 | + */ |
|
923 | 923 | public function addLiveMarineData($fammarine_id = '', $ident = '', $latitude = '', $longitude = '', $heading = '', $groundspeed = '', $date = '', $putinarchive = false, $mmsi = '',$type = '',$typeid = '',$imo = '', $callsign = '',$arrival_code = '',$arrival_date = '',$status = '',$statusid = '',$noarchive = false,$format_source = '', $source_name = '', $over_country = '',$captain_id = '',$captain_name = '',$race_id = '', $race_name = '') |
924 | 924 | { |
925 | 925 | global $globalURL, $globalArchive, $globalDebug; |
@@ -997,10 +997,10 @@ discard block |
||
997 | 997 | if ($typeid == '') $typeid = NULL; |
998 | 998 | if ($statusid == '') $statusid = NULL; |
999 | 999 | |
1000 | - if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) $groundspeed = 0; |
|
1001 | - if ($heading == '' || $Common->isInteger($heading) === false ) $heading = 0; |
|
1002 | - if ($arrival_date == '') $arrival_date = NULL; |
|
1003 | - $query = ''; |
|
1000 | + if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) $groundspeed = 0; |
|
1001 | + if ($heading == '' || $Common->isInteger($heading) === false ) $heading = 0; |
|
1002 | + if ($arrival_date == '') $arrival_date = NULL; |
|
1003 | + $query = ''; |
|
1004 | 1004 | if ($globalArchive) { |
1005 | 1005 | if ($globalDebug) echo '-- Delete previous data -- '; |
1006 | 1006 | $query .= 'DELETE FROM marine_live WHERE fammarine_id = :fammarine_id;'; |
@@ -17,33 +17,33 @@ discard block |
||
17 | 17 | * @param Array $filter the filter |
18 | 18 | * @return Array the SQL part |
19 | 19 | */ |
20 | - public function getFilter($filter = array(),$where = false,$and = false) { |
|
20 | + public function getFilter($filter = array(), $where = false, $and = false) { |
|
21 | 21 | global $globalFilter, $globalStatsFilters, $globalFilterName, $globalDBdriver; |
22 | 22 | $filters = array(); |
23 | 23 | if (is_array($globalStatsFilters) && isset($globalStatsFilters[$globalFilterName])) { |
24 | 24 | if (isset($globalStatsFilters[$globalFilterName][0]['source'])) { |
25 | 25 | $filters = $globalStatsFilters[$globalFilterName]; |
26 | 26 | } else { |
27 | - $filter = array_merge($filter,$globalStatsFilters[$globalFilterName]); |
|
27 | + $filter = array_merge($filter, $globalStatsFilters[$globalFilterName]); |
|
28 | 28 | } |
29 | 29 | } |
30 | 30 | if (isset($filter[0]['source'])) { |
31 | - $filters = array_merge($filters,$filter); |
|
31 | + $filters = array_merge($filters, $filter); |
|
32 | 32 | } |
33 | - if (is_array($globalFilter)) $filter = array_merge($filter,$globalFilter); |
|
33 | + if (is_array($globalFilter)) $filter = array_merge($filter, $globalFilter); |
|
34 | 34 | $filter_query_join = ''; |
35 | 35 | $filter_query_where = ''; |
36 | - foreach($filters as $flt) { |
|
36 | + foreach ($filters as $flt) { |
|
37 | 37 | if (isset($flt['idents']) && !empty($flt['idents'])) { |
38 | 38 | if (isset($flt['source'])) { |
39 | - $filter_query_join .= " INNER JOIN (SELECT fammarine_id FROM marine_output WHERE marine_output.ident IN ('".implode("','",$flt['idents'])."') AND marine_output.format_source IN ('".implode("','",$flt['source'])."')) spid ON spid.fammarine_id = marine_live.fammarine_id"; |
|
39 | + $filter_query_join .= " INNER JOIN (SELECT fammarine_id FROM marine_output WHERE marine_output.ident IN ('".implode("','", $flt['idents'])."') AND marine_output.format_source IN ('".implode("','", $flt['source'])."')) spid ON spid.fammarine_id = marine_live.fammarine_id"; |
|
40 | 40 | } else { |
41 | - $filter_query_join .= " INNER JOIN (SELECT fammarine_id FROM marine_output WHERE marine_output.ident IN ('".implode("','",$flt['idents'])."')) spid ON spid.fammarine_id = marine_live.fammarine_id"; |
|
41 | + $filter_query_join .= " INNER JOIN (SELECT fammarine_id FROM marine_output WHERE marine_output.ident IN ('".implode("','", $flt['idents'])."')) spid ON spid.fammarine_id = marine_live.fammarine_id"; |
|
42 | 42 | } |
43 | 43 | } |
44 | 44 | } |
45 | 45 | if (isset($filter['source']) && !empty($filter['source'])) { |
46 | - $filter_query_where .= " AND format_source IN ('".implode("','",$filter['source'])."')"; |
|
46 | + $filter_query_where .= " AND format_source IN ('".implode("','", $filter['source'])."')"; |
|
47 | 47 | } |
48 | 48 | if (isset($filter['ident']) && !empty($filter['ident'])) { |
49 | 49 | $filter_query_where .= " AND ident = '".$filter['ident']."'"; |
@@ -81,15 +81,15 @@ discard block |
||
81 | 81 | $filter_query_date .= " AND EXTRACT(DAY FROM marine_output.date) = '".$filter['day']."'"; |
82 | 82 | } |
83 | 83 | } |
84 | - $filter_query_join .= " INNER JOIN (SELECT fammarine_id FROM marine_output".preg_replace('/^ AND/',' WHERE',$filter_query_date).") sd ON sd.fammarine_id = marine_live.fammarine_id"; |
|
84 | + $filter_query_join .= " INNER JOIN (SELECT fammarine_id FROM marine_output".preg_replace('/^ AND/', ' WHERE', $filter_query_date).") sd ON sd.fammarine_id = marine_live.fammarine_id"; |
|
85 | 85 | } |
86 | 86 | if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) { |
87 | - $filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')"; |
|
87 | + $filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','", $filter['source_aprs'])."')"; |
|
88 | 88 | } |
89 | 89 | if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE'; |
90 | 90 | elseif ($filter_query_where != '' && $and) $filter_query_where .= ' AND'; |
91 | 91 | if ($filter_query_where != '') { |
92 | - $filter_query_where = preg_replace('/^ AND/',' WHERE',$filter_query_where); |
|
92 | + $filter_query_where = preg_replace('/^ AND/', ' WHERE', $filter_query_where); |
|
93 | 93 | } |
94 | 94 | $filter_query = $filter_query_join.$filter_query_where; |
95 | 95 | return $filter_query; |
@@ -112,8 +112,8 @@ discard block |
||
112 | 112 | if ($limit != '') |
113 | 113 | { |
114 | 114 | $limit_array = explode(',', $limit); |
115 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
116 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
115 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
116 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
117 | 117 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
118 | 118 | { |
119 | 119 | $limit_query = ' LIMIT '.$limit_array[1].' OFFSET '.$limit_array[0]; |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | $orderby_query = ' '.$search_orderby_array[$sort]['sql']; |
129 | 129 | } |
130 | 130 | } |
131 | - if ($orderby_query == '') $orderby_query= ' ORDER BY date DESC'; |
|
131 | + if ($orderby_query == '') $orderby_query = ' ORDER BY date DESC'; |
|
132 | 132 | |
133 | 133 | if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
134 | 134 | if ($globalDBdriver == 'mysql') { |
@@ -137,7 +137,7 @@ discard block |
||
137 | 137 | } else { |
138 | 138 | $query = "SELECT marine_live.* FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l WHERE CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= 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; |
139 | 139 | } |
140 | - $spotter_array = $Marine->getDataFromDB($query.$limit_query,array(),'',true); |
|
140 | + $spotter_array = $Marine->getDataFromDB($query.$limit_query, array(), '', true); |
|
141 | 141 | |
142 | 142 | return $spotter_array; |
143 | 143 | } |
@@ -153,7 +153,7 @@ discard block |
||
153 | 153 | global $globalDBdriver, $globalLiveInterval; |
154 | 154 | date_default_timezone_set('UTC'); |
155 | 155 | |
156 | - $filter_query = $this->getFilter($filter,true,true); |
|
156 | + $filter_query = $this->getFilter($filter, true, true); |
|
157 | 157 | |
158 | 158 | if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
159 | 159 | if ($globalDBdriver == 'mysql') { |
@@ -167,7 +167,7 @@ discard block |
||
167 | 167 | try { |
168 | 168 | $sth = $this->db->prepare($query); |
169 | 169 | $sth->execute(); |
170 | - } catch(PDOException $e) { |
|
170 | + } catch (PDOException $e) { |
|
171 | 171 | echo $e->getMessage(); |
172 | 172 | die; |
173 | 173 | } |
@@ -182,19 +182,19 @@ discard block |
||
182 | 182 | * @return Array the spotter information |
183 | 183 | * |
184 | 184 | */ |
185 | - public function getMinLastLiveMarineData($coord = array(),$filter = array(), $limit = false) |
|
185 | + public function getMinLastLiveMarineData($coord = array(), $filter = array(), $limit = false) |
|
186 | 186 | { |
187 | 187 | global $globalDBdriver, $globalLiveInterval, $globalMap3DMarinesLimit, $globalArchive; |
188 | 188 | date_default_timezone_set('UTC'); |
189 | 189 | $usecoord = false; |
190 | 190 | if (is_array($coord) && !empty($coord)) { |
191 | - $minlong = filter_var($coord[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
192 | - $minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
193 | - $maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
194 | - $maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
191 | + $minlong = filter_var($coord[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
192 | + $minlat = filter_var($coord[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
193 | + $maxlong = filter_var($coord[2], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
194 | + $maxlat = filter_var($coord[3], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
195 | 195 | $usecoord = true; |
196 | 196 | } |
197 | - $filter_query = $this->getFilter($filter,true,true); |
|
197 | + $filter_query = $this->getFilter($filter, true, true); |
|
198 | 198 | |
199 | 199 | if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
200 | 200 | if (!isset($globalMap3DMarinesLimit) || $globalMap3DMarinesLimit == '') $globalMap3DMarinesLimit = '300'; |
@@ -243,7 +243,7 @@ discard block |
||
243 | 243 | try { |
244 | 244 | $sth = $this->db->prepare($query); |
245 | 245 | $sth->execute(); |
246 | - } catch(PDOException $e) { |
|
246 | + } catch (PDOException $e) { |
|
247 | 247 | echo $e->getMessage(); |
248 | 248 | die; |
249 | 249 | } |
@@ -260,7 +260,7 @@ discard block |
||
260 | 260 | public function getLiveMarineCount($filter = array()) |
261 | 261 | { |
262 | 262 | global $globalDBdriver, $globalLiveInterval; |
263 | - $filter_query = $this->getFilter($filter,true,true); |
|
263 | + $filter_query = $this->getFilter($filter, true, true); |
|
264 | 264 | |
265 | 265 | if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
266 | 266 | if ($globalDBdriver == 'mysql') { |
@@ -271,7 +271,7 @@ discard block |
||
271 | 271 | try { |
272 | 272 | $sth = $this->db->prepare($query); |
273 | 273 | $sth->execute(); |
274 | - } catch(PDOException $e) { |
|
274 | + } catch (PDOException $e) { |
|
275 | 275 | echo $e->getMessage(); |
276 | 276 | die; |
277 | 277 | } |
@@ -294,10 +294,10 @@ discard block |
||
294 | 294 | $filter_query = $this->getFilter($filter); |
295 | 295 | |
296 | 296 | if (is_array($coord)) { |
297 | - $minlong = filter_var($coord[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
298 | - $minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
299 | - $maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
300 | - $maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
297 | + $minlong = filter_var($coord[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
298 | + $minlat = filter_var($coord[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
299 | + $maxlong = filter_var($coord[2], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
300 | + $maxlat = filter_var($coord[3], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
301 | 301 | } else return array(); |
302 | 302 | if ($globalDBdriver == 'mysql') { |
303 | 303 | $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 ORDER BY date DESC'.$filter_query; |
@@ -319,13 +319,13 @@ discard block |
||
319 | 319 | global $globalDBdriver, $globalLiveInterval, $globalArchive; |
320 | 320 | $Marine = new Marine($this->db); |
321 | 321 | if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
322 | - $filter_query = $this->getFilter($filter,true,true); |
|
322 | + $filter_query = $this->getFilter($filter, true, true); |
|
323 | 323 | |
324 | 324 | if (is_array($coord)) { |
325 | - $minlong = filter_var($coord[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
326 | - $minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
327 | - $maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
328 | - $maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
325 | + $minlong = filter_var($coord[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
326 | + $minlat = filter_var($coord[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
327 | + $maxlong = filter_var($coord[2], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
328 | + $maxlat = filter_var($coord[3], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
329 | 329 | } else return array(); |
330 | 330 | /* |
331 | 331 | if ($globalDBdriver == 'mysql') { |
@@ -340,13 +340,13 @@ discard block |
||
340 | 340 | */ |
341 | 341 | if ($globalDBdriver == 'mysql') { |
342 | 342 | if (isset($globalArchive) && $globalArchive === TRUE) { |
343 | - $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, marine_live.captain_name |
|
343 | + $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, marine_live.captain_name |
|
344 | 344 | FROM marine_live |
345 | 345 | '.$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= marine_live.date |
346 | 346 | AND marine_live.latitude BETWEEN '.$minlat.' AND '.$maxlat.' AND marine_live.longitude BETWEEN '.$minlong.' AND '.$maxlong.' |
347 | 347 | AND marine_live.latitude <> 0 AND marine_live.longitude <> 0 ORDER BY date DESC'; |
348 | 348 | } else { |
349 | - $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, marine_live.captain_name |
|
349 | + $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, marine_live.captain_name |
|
350 | 350 | FROM marine_live |
351 | 351 | INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate |
352 | 352 | FROM marine_live l |
@@ -358,14 +358,14 @@ discard block |
||
358 | 358 | } |
359 | 359 | } else { |
360 | 360 | if (isset($globalArchive) && $globalArchive === TRUE) { |
361 | - $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, marine_live.captain_name |
|
361 | + $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, marine_live.captain_name |
|
362 | 362 | FROM marine_live |
363 | 363 | ".$filter_query." CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= marine_live.date |
364 | 364 | AND marine_live.latitude BETWEEN ".$minlat." AND ".$maxlat." |
365 | 365 | AND marine_live.longitude BETWEEN ".$minlong." AND ".$maxlong." |
366 | 366 | AND marine_live.latitude <> '0' AND marine_live.longitude <> '0' ORDER BY date DESC"; |
367 | 367 | } else { |
368 | - $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, marine_live.captain_name |
|
368 | + $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, marine_live.captain_name |
|
369 | 369 | FROM marine_live |
370 | 370 | INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate |
371 | 371 | FROM marine_live l |
@@ -422,7 +422,7 @@ discard block |
||
422 | 422 | if ($interval == '1m') |
423 | 423 | { |
424 | 424 | $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= marine_live.date '; |
425 | - } else if ($interval == '15m'){ |
|
425 | + } else if ($interval == '15m') { |
|
426 | 426 | $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 15 MINUTE) <= marine_live.date '; |
427 | 427 | } |
428 | 428 | } |
@@ -430,14 +430,14 @@ discard block |
||
430 | 430 | $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= marine_live.date '; |
431 | 431 | } |
432 | 432 | |
433 | - $query = "SELECT marine_live.*, ( 6371 * acos( cos( radians(:lat) ) * cos( radians( latitude ) ) * cos( radians( longitude ) - radians(:lng) ) + sin( radians(:lat) ) * sin( radians( latitude ) ) ) ) AS distance FROM marine_live |
|
433 | + $query = "SELECT marine_live.*, ( 6371 * acos( cos( radians(:lat) ) * cos( radians( latitude ) ) * cos( radians( longitude ) - radians(:lng) ) + sin( radians(:lat) ) * sin( radians( latitude ) ) ) ) AS distance FROM marine_live |
|
434 | 434 | WHERE marine_live.latitude <> '' |
435 | 435 | AND marine_live.longitude <> '' |
436 | 436 | ".$additional_query." |
437 | 437 | HAVING distance < :radius |
438 | 438 | ORDER BY distance"; |
439 | 439 | |
440 | - $spotter_array = $Marine->getDataFromDB($query, array(':lat' => $lat, ':lng' => $lng,':radius' => $radius)); |
|
440 | + $spotter_array = $Marine->getDataFromDB($query, array(':lat' => $lat, ':lng' => $lng, ':radius' => $radius)); |
|
441 | 441 | |
442 | 442 | return $spotter_array; |
443 | 443 | } |
@@ -455,9 +455,9 @@ discard block |
||
455 | 455 | date_default_timezone_set('UTC'); |
456 | 456 | |
457 | 457 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
458 | - $query = 'SELECT marine_live.* FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l WHERE l.ident = :ident GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate ORDER BY marine_live.date DESC'; |
|
458 | + $query = 'SELECT marine_live.* FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l WHERE l.ident = :ident GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate ORDER BY marine_live.date DESC'; |
|
459 | 459 | |
460 | - $spotter_array = $Marine->getDataFromDB($query,array(':ident' => $ident),'',true); |
|
460 | + $spotter_array = $Marine->getDataFromDB($query, array(':ident' => $ident), '', true); |
|
461 | 461 | |
462 | 462 | return $spotter_array; |
463 | 463 | } |
@@ -468,14 +468,14 @@ discard block |
||
468 | 468 | * @return Array the spotter information |
469 | 469 | * |
470 | 470 | */ |
471 | - public function getDateLiveMarineDataByIdent($ident,$date) |
|
471 | + public function getDateLiveMarineDataByIdent($ident, $date) |
|
472 | 472 | { |
473 | 473 | $Marine = new Marine($this->db); |
474 | 474 | date_default_timezone_set('UTC'); |
475 | 475 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
476 | 476 | $query = 'SELECT marine_live.* FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l WHERE l.ident = :ident AND l.date <= :date GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate ORDER BY marine_live.date DESC'; |
477 | - $date = date('c',$date); |
|
478 | - $spotter_array = $Marine->getDataFromDB($query,array(':ident' => $ident,':date' => $date)); |
|
477 | + $date = date('c', $date); |
|
478 | + $spotter_array = $Marine->getDataFromDB($query, array(':ident' => $ident, ':date' => $date)); |
|
479 | 479 | return $spotter_array; |
480 | 480 | } |
481 | 481 | |
@@ -485,14 +485,14 @@ discard block |
||
485 | 485 | * @return Array the spotter information |
486 | 486 | * |
487 | 487 | */ |
488 | - public function getDateLiveMarineDataByMMSI($mmsi,$date) |
|
488 | + public function getDateLiveMarineDataByMMSI($mmsi, $date) |
|
489 | 489 | { |
490 | 490 | $Marine = new Marine($this->db); |
491 | 491 | date_default_timezone_set('UTC'); |
492 | 492 | $mmsi = filter_var($mmsi, FILTER_SANITIZE_NUMBER_INT); |
493 | 493 | $query = 'SELECT marine_live.* FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l WHERE l.mmsi = :mmsi AND l.date <= :date GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate ORDER BY marine_live.date DESC'; |
494 | - $date = date('c',$date); |
|
495 | - $spotter_array = $Marine->getDataFromDB($query,array(':mmsi' => $mmsi,':date' => $date)); |
|
494 | + $date = date('c', $date); |
|
495 | + $spotter_array = $Marine->getDataFromDB($query, array(':mmsi' => $mmsi, ':date' => $date)); |
|
496 | 496 | return $spotter_array; |
497 | 497 | } |
498 | 498 | |
@@ -508,9 +508,9 @@ discard block |
||
508 | 508 | date_default_timezone_set('UTC'); |
509 | 509 | |
510 | 510 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
511 | - $query = 'SELECT marine_live.* FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l WHERE l.fammarine_id = :id GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate ORDER BY marine_live.date DESC'; |
|
511 | + $query = 'SELECT marine_live.* FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l WHERE l.fammarine_id = :id GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate ORDER BY marine_live.date DESC'; |
|
512 | 512 | |
513 | - $spotter_array = $Marine->getDataFromDB($query,array(':id' => $id),'',true); |
|
513 | + $spotter_array = $Marine->getDataFromDB($query, array(':id' => $id), '', true); |
|
514 | 514 | |
515 | 515 | return $spotter_array; |
516 | 516 | } |
@@ -521,15 +521,15 @@ discard block |
||
521 | 521 | * @return Array the spotter information |
522 | 522 | * |
523 | 523 | */ |
524 | - public function getDateLiveMarineDataById($id,$date) |
|
524 | + public function getDateLiveMarineDataById($id, $date) |
|
525 | 525 | { |
526 | 526 | $Marine = new Marine($this->db); |
527 | 527 | date_default_timezone_set('UTC'); |
528 | 528 | |
529 | 529 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
530 | - $query = 'SELECT marine_live.* FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l WHERE l.fammarine_id = :id AND l.date <= :date GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate ORDER BY marine_live.date DESC'; |
|
531 | - $date = date('c',$date); |
|
532 | - $spotter_array = $Marine->getDataFromDB($query,array(':id' => $id,':date' => $date),'',true); |
|
530 | + $query = 'SELECT marine_live.* FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l WHERE l.fammarine_id = :id AND l.date <= :date GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate ORDER BY marine_live.date DESC'; |
|
531 | + $date = date('c', $date); |
|
532 | + $spotter_array = $Marine->getDataFromDB($query, array(':id' => $id, ':date' => $date), '', true); |
|
533 | 533 | |
534 | 534 | return $spotter_array; |
535 | 535 | } |
@@ -541,7 +541,7 @@ discard block |
||
541 | 541 | * @return Array the spotter information |
542 | 542 | * |
543 | 543 | */ |
544 | - public function getAllLiveMarineDataById($id,$liveinterval = false) |
|
544 | + public function getAllLiveMarineDataById($id, $liveinterval = false) |
|
545 | 545 | { |
546 | 546 | global $globalDBdriver, $globalLiveInterval; |
547 | 547 | date_default_timezone_set('UTC'); |
@@ -560,7 +560,7 @@ discard block |
||
560 | 560 | try { |
561 | 561 | $sth = $this->db->prepare($query); |
562 | 562 | $sth->execute(array(':id' => $id)); |
563 | - } catch(PDOException $e) { |
|
563 | + } catch (PDOException $e) { |
|
564 | 564 | echo $e->getMessage(); |
565 | 565 | die; |
566 | 566 | } |
@@ -578,12 +578,12 @@ discard block |
||
578 | 578 | { |
579 | 579 | date_default_timezone_set('UTC'); |
580 | 580 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
581 | - $query = self::$global_query.' WHERE marine_live.ident = :ident'; |
|
581 | + $query = self::$global_query.' WHERE marine_live.ident = :ident'; |
|
582 | 582 | try { |
583 | 583 | |
584 | 584 | $sth = $this->db->prepare($query); |
585 | 585 | $sth->execute(array(':ident' => $ident)); |
586 | - } catch(PDOException $e) { |
|
586 | + } catch (PDOException $e) { |
|
587 | 587 | echo $e->getMessage(); |
588 | 588 | die; |
589 | 589 | } |
@@ -613,7 +613,7 @@ discard block |
||
613 | 613 | |
614 | 614 | $sth = $this->db->prepare($query); |
615 | 615 | $sth->execute(); |
616 | - } catch(PDOException $e) { |
|
616 | + } catch (PDOException $e) { |
|
617 | 617 | return "error"; |
618 | 618 | } |
619 | 619 | |
@@ -636,14 +636,14 @@ discard block |
||
636 | 636 | |
637 | 637 | $sth = $this->db->prepare($query); |
638 | 638 | $sth->execute(); |
639 | - } catch(PDOException $e) { |
|
639 | + } catch (PDOException $e) { |
|
640 | 640 | return "error"; |
641 | 641 | } |
642 | 642 | $query_delete = 'DELETE FROM marine_live WHERE fammarine_id IN ('; |
643 | 643 | $i = 0; |
644 | - $j =0; |
|
644 | + $j = 0; |
|
645 | 645 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
646 | - foreach($all as $row) |
|
646 | + foreach ($all as $row) |
|
647 | 647 | { |
648 | 648 | $i++; |
649 | 649 | $j++; |
@@ -651,9 +651,9 @@ discard block |
||
651 | 651 | if ($globalDebug) echo "."; |
652 | 652 | try { |
653 | 653 | |
654 | - $sth = $this->db->prepare(substr($query_delete,0,-1).")"); |
|
654 | + $sth = $this->db->prepare(substr($query_delete, 0, -1).")"); |
|
655 | 655 | $sth->execute(); |
656 | - } catch(PDOException $e) { |
|
656 | + } catch (PDOException $e) { |
|
657 | 657 | return "error"; |
658 | 658 | } |
659 | 659 | $query_delete = 'DELETE FROM marine_live WHERE fammarine_id IN ('; |
@@ -664,9 +664,9 @@ discard block |
||
664 | 664 | if ($i > 0) { |
665 | 665 | try { |
666 | 666 | |
667 | - $sth = $this->db->prepare(substr($query_delete,0,-1).")"); |
|
667 | + $sth = $this->db->prepare(substr($query_delete, 0, -1).")"); |
|
668 | 668 | $sth->execute(); |
669 | - } catch(PDOException $e) { |
|
669 | + } catch (PDOException $e) { |
|
670 | 670 | return "error"; |
671 | 671 | } |
672 | 672 | } |
@@ -679,7 +679,7 @@ discard block |
||
679 | 679 | |
680 | 680 | $sth = $this->db->prepare($query); |
681 | 681 | $sth->execute(); |
682 | - } catch(PDOException $e) { |
|
682 | + } catch (PDOException $e) { |
|
683 | 683 | return "error"; |
684 | 684 | } |
685 | 685 | /* $query_delete = "DELETE FROM marine_live WHERE fammarine_id IN ("; |
@@ -727,13 +727,13 @@ discard block |
||
727 | 727 | public function deleteLiveMarineDataByIdent($ident) |
728 | 728 | { |
729 | 729 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
730 | - $query = 'DELETE FROM marine_live WHERE ident = :ident'; |
|
730 | + $query = 'DELETE FROM marine_live WHERE ident = :ident'; |
|
731 | 731 | |
732 | 732 | try { |
733 | 733 | |
734 | 734 | $sth = $this->db->prepare($query); |
735 | 735 | $sth->execute(array(':ident' => $ident)); |
736 | - } catch(PDOException $e) { |
|
736 | + } catch (PDOException $e) { |
|
737 | 737 | return "error"; |
738 | 738 | } |
739 | 739 | |
@@ -749,13 +749,13 @@ discard block |
||
749 | 749 | public function deleteLiveMarineDataById($id) |
750 | 750 | { |
751 | 751 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
752 | - $query = 'DELETE FROM marine_live WHERE fammarine_id = :id'; |
|
752 | + $query = 'DELETE FROM marine_live WHERE fammarine_id = :id'; |
|
753 | 753 | |
754 | 754 | try { |
755 | 755 | |
756 | 756 | $sth = $this->db->prepare($query); |
757 | 757 | $sth->execute(array(':id' => $id)); |
758 | - } catch(PDOException $e) { |
|
758 | + } catch (PDOException $e) { |
|
759 | 759 | return "error"; |
760 | 760 | } |
761 | 761 | |
@@ -771,7 +771,7 @@ discard block |
||
771 | 771 | */ |
772 | 772 | public function getAllRaces() |
773 | 773 | { |
774 | - $query = 'SELECT DISTINCT marine_live.race_id, marine_live.race_name FROM marine_live ORDER BY marine_live.race_name'; |
|
774 | + $query = 'SELECT DISTINCT marine_live.race_id, marine_live.race_name FROM marine_live ORDER BY marine_live.race_name'; |
|
775 | 775 | $sth = $this->db->prepare($query); |
776 | 776 | $sth->execute(); |
777 | 777 | return $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -787,13 +787,13 @@ discard block |
||
787 | 787 | { |
788 | 788 | global $globalDBdriver, $globalTimezone; |
789 | 789 | if ($globalDBdriver == 'mysql') { |
790 | - $query = 'SELECT marine_live.ident FROM marine_live |
|
790 | + $query = 'SELECT marine_live.ident FROM marine_live |
|
791 | 791 | WHERE marine_live.ident = :ident |
792 | 792 | AND marine_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 HOUR) |
793 | 793 | AND marine_live.date < UTC_TIMESTAMP()'; |
794 | 794 | $query_data = array(':ident' => $ident); |
795 | 795 | } else { |
796 | - $query = "SELECT marine_live.ident FROM marine_live |
|
796 | + $query = "SELECT marine_live.ident FROM marine_live |
|
797 | 797 | WHERE marine_live.ident = :ident |
798 | 798 | AND marine_live.date >= now() AT TIME ZONE 'UTC' - INTERVAL '1 HOURS' |
799 | 799 | AND marine_live.date < now() AT TIME ZONE 'UTC'"; |
@@ -802,8 +802,8 @@ discard block |
||
802 | 802 | |
803 | 803 | $sth = $this->db->prepare($query); |
804 | 804 | $sth->execute($query_data); |
805 | - $ident_result=''; |
|
806 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
805 | + $ident_result = ''; |
|
806 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
807 | 807 | { |
808 | 808 | $ident_result = $row['ident']; |
809 | 809 | } |
@@ -820,13 +820,13 @@ discard block |
||
820 | 820 | { |
821 | 821 | global $globalDBdriver, $globalTimezone; |
822 | 822 | if ($globalDBdriver == 'mysql') { |
823 | - $query = 'SELECT marine_live.ident, marine_live.fammarine_id FROM marine_live |
|
823 | + $query = 'SELECT marine_live.ident, marine_live.fammarine_id FROM marine_live |
|
824 | 824 | WHERE marine_live.ident = :ident |
825 | 825 | AND marine_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 30 MINUTE)'; |
826 | 826 | // AND marine_live.date < UTC_TIMESTAMP()"; |
827 | 827 | $query_data = array(':ident' => $ident); |
828 | 828 | } else { |
829 | - $query = "SELECT marine_live.ident, marine_live.fammarine_id FROM marine_live |
|
829 | + $query = "SELECT marine_live.ident, marine_live.fammarine_id FROM marine_live |
|
830 | 830 | WHERE marine_live.ident = :ident |
831 | 831 | AND marine_live.date >= now() AT TIME ZONE 'UTC' - INTERVAL '30 MINUTES'"; |
832 | 832 | // AND marine_live.date < now() AT TIME ZONE 'UTC'"; |
@@ -835,8 +835,8 @@ discard block |
||
835 | 835 | |
836 | 836 | $sth = $this->db->prepare($query); |
837 | 837 | $sth->execute($query_data); |
838 | - $ident_result=''; |
|
839 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
838 | + $ident_result = ''; |
|
839 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
840 | 840 | { |
841 | 841 | $ident_result = $row['fammarine_id']; |
842 | 842 | } |
@@ -853,13 +853,13 @@ discard block |
||
853 | 853 | { |
854 | 854 | global $globalDBdriver, $globalTimezone; |
855 | 855 | if ($globalDBdriver == 'mysql') { |
856 | - $query = 'SELECT marine_live.ident, marine_live.fammarine_id FROM marine_live |
|
856 | + $query = 'SELECT marine_live.ident, marine_live.fammarine_id FROM marine_live |
|
857 | 857 | WHERE marine_live.fammarine_id = :id |
858 | 858 | AND marine_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 10 HOUR)'; |
859 | 859 | // AND marine_live.date < UTC_TIMESTAMP()"; |
860 | 860 | $query_data = array(':id' => $id); |
861 | 861 | } else { |
862 | - $query = "SELECT marine_live.ident, marine_live.fammarine_id FROM marine_live |
|
862 | + $query = "SELECT marine_live.ident, marine_live.fammarine_id FROM marine_live |
|
863 | 863 | WHERE marine_live.fammarine_id = :id |
864 | 864 | AND marine_live.date >= now() AT TIME ZONE 'UTC' - INTERVAL '10 HOUR'"; |
865 | 865 | // AND marine_live.date < now() AT TIME ZONE 'UTC'"; |
@@ -868,8 +868,8 @@ discard block |
||
868 | 868 | |
869 | 869 | $sth = $this->db->prepare($query); |
870 | 870 | $sth->execute($query_data); |
871 | - $ident_result=''; |
|
872 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
871 | + $ident_result = ''; |
|
872 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
873 | 873 | { |
874 | 874 | $ident_result = $row['fammarine_id']; |
875 | 875 | } |
@@ -886,13 +886,13 @@ discard block |
||
886 | 886 | { |
887 | 887 | global $globalDBdriver, $globalTimezone; |
888 | 888 | if ($globalDBdriver == 'mysql') { |
889 | - $query = 'SELECT marine_live.fammarine_id FROM marine_live |
|
889 | + $query = 'SELECT marine_live.fammarine_id FROM marine_live |
|
890 | 890 | WHERE marine_live.mmsi = :mmsi |
891 | 891 | AND marine_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 10 HOUR)'; |
892 | 892 | // AND marine_live.date < UTC_TIMESTAMP()"; |
893 | 893 | $query_data = array(':mmsi' => $mmsi); |
894 | 894 | } else { |
895 | - $query = "SELECT marine_live.fammarine_id FROM marine_live |
|
895 | + $query = "SELECT marine_live.fammarine_id FROM marine_live |
|
896 | 896 | WHERE marine_live.mmsi = :mmsi |
897 | 897 | AND marine_live.date >= now() AT TIME ZONE 'UTC' - INTERVAL '10 HOUR'"; |
898 | 898 | // AND marine_live.date < now() AT TIME ZONE 'UTC'"; |
@@ -901,8 +901,8 @@ discard block |
||
901 | 901 | |
902 | 902 | $sth = $this->db->prepare($query); |
903 | 903 | $sth->execute($query_data); |
904 | - $ident_result=''; |
|
905 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
904 | + $ident_result = ''; |
|
905 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
906 | 906 | { |
907 | 907 | $ident_result = $row['fammarine_id']; |
908 | 908 | } |
@@ -920,7 +920,7 @@ discard block |
||
920 | 920 | * @return String success or false |
921 | 921 | * |
922 | 922 | */ |
923 | - public function addLiveMarineData($fammarine_id = '', $ident = '', $latitude = '', $longitude = '', $heading = '', $groundspeed = '', $date = '', $putinarchive = false, $mmsi = '',$type = '',$typeid = '',$imo = '', $callsign = '',$arrival_code = '',$arrival_date = '',$status = '',$statusid = '',$noarchive = false,$format_source = '', $source_name = '', $over_country = '',$captain_id = '',$captain_name = '',$race_id = '', $race_name = '') |
|
923 | + public function addLiveMarineData($fammarine_id = '', $ident = '', $latitude = '', $longitude = '', $heading = '', $groundspeed = '', $date = '', $putinarchive = false, $mmsi = '', $type = '', $typeid = '', $imo = '', $callsign = '', $arrival_code = '', $arrival_date = '', $status = '', $statusid = '', $noarchive = false, $format_source = '', $source_name = '', $over_country = '', $captain_id = '', $captain_name = '', $race_id = '', $race_name = '') |
|
924 | 924 | { |
925 | 925 | global $globalURL, $globalArchive, $globalDebug; |
926 | 926 | $Common = new Common(); |
@@ -972,33 +972,33 @@ discard block |
||
972 | 972 | if ($date == '') $date = date("Y-m-d H:i:s", time()); |
973 | 973 | |
974 | 974 | |
975 | - $fammarine_id = filter_var($fammarine_id,FILTER_SANITIZE_STRING); |
|
976 | - $ident = filter_var($ident,FILTER_SANITIZE_STRING); |
|
977 | - $latitude = filter_var($latitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
978 | - $longitude = filter_var($longitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
979 | - $heading = filter_var($heading,FILTER_SANITIZE_NUMBER_INT); |
|
980 | - $groundspeed = filter_var($groundspeed,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
981 | - $format_source = filter_var($format_source,FILTER_SANITIZE_STRING); |
|
982 | - $source_name = filter_var($source_name,FILTER_SANITIZE_STRING); |
|
983 | - $over_country = filter_var($over_country,FILTER_SANITIZE_STRING); |
|
984 | - $type = filter_var($type,FILTER_SANITIZE_STRING); |
|
985 | - $typeid = filter_var($typeid,FILTER_SANITIZE_NUMBER_INT); |
|
986 | - $mmsi = filter_var($mmsi,FILTER_SANITIZE_NUMBER_INT); |
|
987 | - $status = filter_var($status,FILTER_SANITIZE_STRING); |
|
988 | - $statusid = filter_var($statusid,FILTER_SANITIZE_NUMBER_INT); |
|
989 | - $imo = filter_var($imo,FILTER_SANITIZE_STRING); |
|
990 | - $callsign = filter_var($callsign,FILTER_SANITIZE_STRING); |
|
991 | - $arrival_code = filter_var($arrival_code,FILTER_SANITIZE_STRING); |
|
992 | - $arrival_date = filter_var($arrival_date,FILTER_SANITIZE_STRING); |
|
993 | - $captain_id = filter_var($captain_id,FILTER_SANITIZE_STRING); |
|
994 | - $captain_name = filter_var($captain_name,FILTER_SANITIZE_STRING); |
|
995 | - $race_id = filter_var($race_id,FILTER_SANITIZE_STRING); |
|
996 | - $race_name = filter_var($race_name,FILTER_SANITIZE_STRING); |
|
975 | + $fammarine_id = filter_var($fammarine_id, FILTER_SANITIZE_STRING); |
|
976 | + $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
|
977 | + $latitude = filter_var($latitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
978 | + $longitude = filter_var($longitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
979 | + $heading = filter_var($heading, FILTER_SANITIZE_NUMBER_INT); |
|
980 | + $groundspeed = filter_var($groundspeed, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
981 | + $format_source = filter_var($format_source, FILTER_SANITIZE_STRING); |
|
982 | + $source_name = filter_var($source_name, FILTER_SANITIZE_STRING); |
|
983 | + $over_country = filter_var($over_country, FILTER_SANITIZE_STRING); |
|
984 | + $type = filter_var($type, FILTER_SANITIZE_STRING); |
|
985 | + $typeid = filter_var($typeid, FILTER_SANITIZE_NUMBER_INT); |
|
986 | + $mmsi = filter_var($mmsi, FILTER_SANITIZE_NUMBER_INT); |
|
987 | + $status = filter_var($status, FILTER_SANITIZE_STRING); |
|
988 | + $statusid = filter_var($statusid, FILTER_SANITIZE_NUMBER_INT); |
|
989 | + $imo = filter_var($imo, FILTER_SANITIZE_STRING); |
|
990 | + $callsign = filter_var($callsign, FILTER_SANITIZE_STRING); |
|
991 | + $arrival_code = filter_var($arrival_code, FILTER_SANITIZE_STRING); |
|
992 | + $arrival_date = filter_var($arrival_date, FILTER_SANITIZE_STRING); |
|
993 | + $captain_id = filter_var($captain_id, FILTER_SANITIZE_STRING); |
|
994 | + $captain_name = filter_var($captain_name, FILTER_SANITIZE_STRING); |
|
995 | + $race_id = filter_var($race_id, FILTER_SANITIZE_STRING); |
|
996 | + $race_name = filter_var($race_name, FILTER_SANITIZE_STRING); |
|
997 | 997 | if ($typeid == '') $typeid = NULL; |
998 | 998 | if ($statusid == '') $statusid = NULL; |
999 | 999 | |
1000 | - if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) $groundspeed = 0; |
|
1001 | - if ($heading == '' || $Common->isInteger($heading) === false ) $heading = 0; |
|
1000 | + if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0; |
|
1001 | + if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0; |
|
1002 | 1002 | if ($arrival_date == '') $arrival_date = NULL; |
1003 | 1003 | $query = ''; |
1004 | 1004 | if ($globalArchive) { |
@@ -1007,19 +1007,19 @@ discard block |
||
1007 | 1007 | } |
1008 | 1008 | $query .= 'INSERT INTO marine_live (fammarine_id, ident, latitude, longitude, heading, ground_speed, date, format_source, source_name, over_country, mmsi, type,type_id,status,status_id,imo,arrival_port_name,arrival_port_date,captain_id,captain_name,race_id,race_name) |
1009 | 1009 | VALUES (:fammarine_id,:ident,:latitude,:longitude,:heading,:groundspeed,:date,:format_source, :source_name, :over_country,:mmsi,:type,:typeid,:status,:statusid,:imo,:arrival_port_name,:arrival_port_date,:captain_id,:captain_name,:race_id,:race_name)'; |
1010 | - $query_values = array(':fammarine_id' => $fammarine_id,':ident' => $ident,':latitude' => $latitude,':longitude' => $longitude,':heading' => $heading,':groundspeed' => $groundspeed,':date' => $date, ':format_source' => $format_source, ':source_name' => $source_name, ':over_country' => $over_country,':mmsi' => $mmsi,':type' => $type,':typeid' => $typeid,':status' => $status,':statusid' => $statusid,':imo' => $imo,':arrival_port_name' => $arrival_code,':arrival_port_date' => $arrival_date,':captain_id' => $captain_id,':captain_name' => $captain_name,':race_id' => $race_id,':race_name' => $race_name); |
|
1010 | + $query_values = array(':fammarine_id' => $fammarine_id, ':ident' => $ident, ':latitude' => $latitude, ':longitude' => $longitude, ':heading' => $heading, ':groundspeed' => $groundspeed, ':date' => $date, ':format_source' => $format_source, ':source_name' => $source_name, ':over_country' => $over_country, ':mmsi' => $mmsi, ':type' => $type, ':typeid' => $typeid, ':status' => $status, ':statusid' => $statusid, ':imo' => $imo, ':arrival_port_name' => $arrival_code, ':arrival_port_date' => $arrival_date, ':captain_id' => $captain_id, ':captain_name' => $captain_name, ':race_id' => $race_id, ':race_name' => $race_name); |
|
1011 | 1011 | try { |
1012 | 1012 | $sth = $this->db->prepare($query); |
1013 | 1013 | $sth->execute($query_values); |
1014 | 1014 | $sth->closeCursor(); |
1015 | - } catch(PDOException $e) { |
|
1015 | + } catch (PDOException $e) { |
|
1016 | 1016 | return "error : ".$e->getMessage(); |
1017 | 1017 | } |
1018 | 1018 | |
1019 | 1019 | if (isset($globalArchive) && $globalArchive && $putinarchive && $noarchive !== true) { |
1020 | 1020 | if ($globalDebug) echo '(Add to Marine archive : '; |
1021 | 1021 | $MarineArchive = new MarineArchive($this->db); |
1022 | - $result = $MarineArchive->addMarineArchiveData($fammarine_id, $ident, $latitude, $longitude, $heading, $groundspeed, $date, $putinarchive, $mmsi,$type,$typeid,$imo, $callsign,$arrival_code,$arrival_date,$status,$statusid,$noarchive,$format_source, $source_name, $over_country,$captain_id,$captain_name,$race_id,$race_name); |
|
1022 | + $result = $MarineArchive->addMarineArchiveData($fammarine_id, $ident, $latitude, $longitude, $heading, $groundspeed, $date, $putinarchive, $mmsi, $type, $typeid, $imo, $callsign, $arrival_code, $arrival_date, $status, $statusid, $noarchive, $format_source, $source_name, $over_country, $captain_id, $captain_name, $race_id, $race_name); |
|
1023 | 1023 | if ($globalDebug) echo $result.')'; |
1024 | 1024 | } |
1025 | 1025 | return "success"; |
@@ -1027,7 +1027,7 @@ discard block |
||
1027 | 1027 | |
1028 | 1028 | public function getOrderBy() |
1029 | 1029 | { |
1030 | - $orderby = array("aircraft_asc" => array("key" => "aircraft_asc", "value" => "Aircraft Type - ASC", "sql" => "ORDER BY marine_live.aircraft_icao ASC"), "aircraft_desc" => array("key" => "aircraft_desc", "value" => "Aircraft Type - DESC", "sql" => "ORDER BY marine_live.aircraft_icao DESC"),"manufacturer_asc" => array("key" => "manufacturer_asc", "value" => "Aircraft Manufacturer - ASC", "sql" => "ORDER BY marine_live.aircraft_manufacturer ASC"), "manufacturer_desc" => array("key" => "manufacturer_desc", "value" => "Aircraft Manufacturer - DESC", "sql" => "ORDER BY marine_live.aircraft_manufacturer DESC"),"airline_name_asc" => array("key" => "airline_name_asc", "value" => "Airline Name - ASC", "sql" => "ORDER BY marine_live.airline_name ASC"), "airline_name_desc" => array("key" => "airline_name_desc", "value" => "Airline Name - DESC", "sql" => "ORDER BY marine_live.airline_name DESC"), "ident_asc" => array("key" => "ident_asc", "value" => "Ident - ASC", "sql" => "ORDER BY marine_live.ident ASC"), "ident_desc" => array("key" => "ident_desc", "value" => "Ident - DESC", "sql" => "ORDER BY marine_live.ident DESC"), "airport_departure_asc" => array("key" => "airport_departure_asc", "value" => "Departure Airport - ASC", "sql" => "ORDER BY marine_live.departure_airport_city ASC"), "airport_departure_desc" => array("key" => "airport_departure_desc", "value" => "Departure Airport - DESC", "sql" => "ORDER BY marine_live.departure_airport_city DESC"), "airport_arrival_asc" => array("key" => "airport_arrival_asc", "value" => "Arrival Airport - ASC", "sql" => "ORDER BY marine_live.arrival_airport_city ASC"), "airport_arrival_desc" => array("key" => "airport_arrival_desc", "value" => "Arrival Airport - DESC", "sql" => "ORDER BY marine_live.arrival_airport_city DESC"), "date_asc" => array("key" => "date_asc", "value" => "Date - ASC", "sql" => "ORDER BY marine_live.date ASC"), "date_desc" => array("key" => "date_desc", "value" => "Date - DESC", "sql" => "ORDER BY marine_live.date DESC")); |
|
1030 | + $orderby = array("aircraft_asc" => array("key" => "aircraft_asc", "value" => "Aircraft Type - ASC", "sql" => "ORDER BY marine_live.aircraft_icao ASC"), "aircraft_desc" => array("key" => "aircraft_desc", "value" => "Aircraft Type - DESC", "sql" => "ORDER BY marine_live.aircraft_icao DESC"), "manufacturer_asc" => array("key" => "manufacturer_asc", "value" => "Aircraft Manufacturer - ASC", "sql" => "ORDER BY marine_live.aircraft_manufacturer ASC"), "manufacturer_desc" => array("key" => "manufacturer_desc", "value" => "Aircraft Manufacturer - DESC", "sql" => "ORDER BY marine_live.aircraft_manufacturer DESC"), "airline_name_asc" => array("key" => "airline_name_asc", "value" => "Airline Name - ASC", "sql" => "ORDER BY marine_live.airline_name ASC"), "airline_name_desc" => array("key" => "airline_name_desc", "value" => "Airline Name - DESC", "sql" => "ORDER BY marine_live.airline_name DESC"), "ident_asc" => array("key" => "ident_asc", "value" => "Ident - ASC", "sql" => "ORDER BY marine_live.ident ASC"), "ident_desc" => array("key" => "ident_desc", "value" => "Ident - DESC", "sql" => "ORDER BY marine_live.ident DESC"), "airport_departure_asc" => array("key" => "airport_departure_asc", "value" => "Departure Airport - ASC", "sql" => "ORDER BY marine_live.departure_airport_city ASC"), "airport_departure_desc" => array("key" => "airport_departure_desc", "value" => "Departure Airport - DESC", "sql" => "ORDER BY marine_live.departure_airport_city DESC"), "airport_arrival_asc" => array("key" => "airport_arrival_asc", "value" => "Arrival Airport - ASC", "sql" => "ORDER BY marine_live.arrival_airport_city ASC"), "airport_arrival_desc" => array("key" => "airport_arrival_desc", "value" => "Arrival Airport - DESC", "sql" => "ORDER BY marine_live.arrival_airport_city DESC"), "date_asc" => array("key" => "date_asc", "value" => "Date - ASC", "sql" => "ORDER BY marine_live.date ASC"), "date_desc" => array("key" => "date_desc", "value" => "Date - DESC", "sql" => "ORDER BY marine_live.date DESC")); |
|
1031 | 1031 | return $orderby; |
1032 | 1032 | } |
1033 | 1033 |