@@ -60,24 +60,24 @@ discard block |
||
60 | 60 | $min = false; |
61 | 61 | $allhistory = false; |
62 | 62 | $filter['source'] = array(); |
63 | -if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') $filter['source'] = array_merge($filter['source'],array('vatsimtxt')); |
|
64 | -if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') $filter['source'] = array_merge($filter['source'],array('whazzup')); |
|
65 | -if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') $filter['source'] = array_merge($filter['source'],array('phpvmacars')); |
|
66 | -if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') $filter['source'] = array_merge($filter['source'],array('sbs','famaprs')); |
|
67 | -if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') $filter['source'] = array_merge($filter['source'],array('aprs')); |
|
68 | -if (isset($_COOKIE['filter_ident']) && $_COOKIE['filter_ident'] != '') $filter['ident'] = filter_var($_COOKIE['filter_ident'],FILTER_SANITIZE_STRING); |
|
69 | -if (isset($_COOKIE['filter_mmsi']) && $_COOKIE['filter_mmsi'] != '') $filter['mmsi'] = filter_var($_COOKIE['filter_mmsi'],FILTER_SANITIZE_STRING); |
|
70 | -if (isset($_COOKIE['filter_Airlines']) && $_COOKIE['filter_Airlines'] != '') $filter['airlines'] = filter_var_array(explode(',',$_COOKIE['filter_Airlines']),FILTER_SANITIZE_STRING); |
|
71 | -if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') $filter['source_aprs'] = filter_var_array(explode(',',$_COOKIE['filter_Sources']),FILTER_SANITIZE_STRING); |
|
72 | -if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') $filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'],FILTER_SANITIZE_STRING); |
|
73 | -if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] != 'all') $filter['alliance'] = filter_var($_COOKIE['filter_alliance'],FILTER_SANITIZE_STRING); |
|
63 | +if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') $filter['source'] = array_merge($filter['source'], array('vatsimtxt')); |
|
64 | +if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') $filter['source'] = array_merge($filter['source'], array('whazzup')); |
|
65 | +if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') $filter['source'] = array_merge($filter['source'], array('phpvmacars')); |
|
66 | +if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') $filter['source'] = array_merge($filter['source'], array('sbs', 'famaprs')); |
|
67 | +if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') $filter['source'] = array_merge($filter['source'], array('aprs')); |
|
68 | +if (isset($_COOKIE['filter_ident']) && $_COOKIE['filter_ident'] != '') $filter['ident'] = filter_var($_COOKIE['filter_ident'], FILTER_SANITIZE_STRING); |
|
69 | +if (isset($_COOKIE['filter_mmsi']) && $_COOKIE['filter_mmsi'] != '') $filter['mmsi'] = filter_var($_COOKIE['filter_mmsi'], FILTER_SANITIZE_STRING); |
|
70 | +if (isset($_COOKIE['filter_Airlines']) && $_COOKIE['filter_Airlines'] != '') $filter['airlines'] = filter_var_array(explode(',', $_COOKIE['filter_Airlines']), FILTER_SANITIZE_STRING); |
|
71 | +if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') $filter['source_aprs'] = filter_var_array(explode(',', $_COOKIE['filter_Sources']), FILTER_SANITIZE_STRING); |
|
72 | +if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') $filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'], FILTER_SANITIZE_STRING); |
|
73 | +if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] != 'all') $filter['alliance'] = filter_var($_COOKIE['filter_alliance'], FILTER_SANITIZE_STRING); |
|
74 | 74 | |
75 | 75 | if (isset($globalMapPopup) && !$globalMapPopup && !(isset($_COOKIE['flightpopup']) && $_COOKIE['flightpopup'] == 'true')) { |
76 | 76 | $min = true; |
77 | 77 | } else $min = false; |
78 | 78 | |
79 | 79 | if (isset($_GET['ident'])) { |
80 | - $ident = filter_input(INPUT_GET,'ident',FILTER_SANITIZE_STRING); |
|
80 | + $ident = filter_input(INPUT_GET, 'ident', FILTER_SANITIZE_STRING); |
|
81 | 81 | $from_archive = true; |
82 | 82 | if ($tracker) { |
83 | 83 | $spotter_array = $TrackerArchive->getLastArchiveTrackerDataByIdent($ident); |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | $allhistory = true; |
92 | 92 | } |
93 | 93 | elseif (isset($_GET['flightaware_id'])) { |
94 | - $flightaware_id = filter_input(INPUT_GET,'flightaware_id',FILTER_SANITIZE_STRING); |
|
94 | + $flightaware_id = filter_input(INPUT_GET, 'flightaware_id', FILTER_SANITIZE_STRING); |
|
95 | 95 | $from_archive = true; |
96 | 96 | if ($tracker) { |
97 | 97 | $spotter_array = $TrackerArchive->getLastArchiveTrackerDataById($flightaware_id); |
@@ -106,23 +106,23 @@ discard block |
||
106 | 106 | } |
107 | 107 | elseif (isset($_GET['archive']) && isset($_GET['begindate']) && isset($_GET['enddate']) && isset($_GET['speed'])) { |
108 | 108 | $from_archive = true; |
109 | - $begindate = filter_input(INPUT_GET,'begindate',FILTER_SANITIZE_NUMBER_INT); |
|
109 | + $begindate = filter_input(INPUT_GET, 'begindate', FILTER_SANITIZE_NUMBER_INT); |
|
110 | 110 | if (isset($globalAircraftMaxUpdate)) $begindate = $begindate - $globalAircraftMaxUpdate; |
111 | 111 | else $begindate = $begindate - 3000; |
112 | - $enddate = filter_input(INPUT_GET,'enddate',FILTER_SANITIZE_NUMBER_INT); |
|
113 | - $archivespeed = filter_input(INPUT_GET,'speed',FILTER_SANITIZE_NUMBER_INT); |
|
112 | + $enddate = filter_input(INPUT_GET, 'enddate', FILTER_SANITIZE_NUMBER_INT); |
|
113 | + $archivespeed = filter_input(INPUT_GET, 'speed', FILTER_SANITIZE_NUMBER_INT); |
|
114 | 114 | if ($begindate != '' && $enddate != '') { |
115 | - $begindate = date('Y-m-d H:i:s',$begindate); |
|
116 | - $enddate = date('Y-m-d H:i:s',$enddate); |
|
115 | + $begindate = date('Y-m-d H:i:s', $begindate); |
|
116 | + $enddate = date('Y-m-d H:i:s', $enddate); |
|
117 | 117 | //$spotter_array = $SpotterArchive->getMinLiveSpotterDataPlayback($begindate,$enddate,$filter); |
118 | 118 | if ($tracker) { |
119 | - $spotter_array = $TrackerArchive->getMinLiveTrackerData($begindate,$enddate,$filter); |
|
119 | + $spotter_array = $TrackerArchive->getMinLiveTrackerData($begindate, $enddate, $filter); |
|
120 | 120 | } |
121 | 121 | elseif ($marine) { |
122 | - $spotter_array = $MarineArchive->getMinLiveMarineData($begindate,$enddate,$filter); |
|
122 | + $spotter_array = $MarineArchive->getMinLiveMarineData($begindate, $enddate, $filter); |
|
123 | 123 | } |
124 | 124 | else { |
125 | - $spotter_array = $SpotterArchive->getMinLiveSpotterData($begindate,$enddate,$filter); |
|
125 | + $spotter_array = $SpotterArchive->getMinLiveSpotterData($begindate, $enddate, $filter); |
|
126 | 126 | } |
127 | 127 | } |
128 | 128 | } |
@@ -133,7 +133,7 @@ discard block |
||
133 | 133 | if ($flightcnt == '') $flightcnt = 0; |
134 | 134 | } else $flightcnt = 0; |
135 | 135 | |
136 | -$sqltime = round(microtime(true)-$begintime,2); |
|
136 | +$sqltime = round(microtime(true) - $begintime, 2); |
|
137 | 137 | |
138 | 138 | $pfi = ''; |
139 | 139 | //var_dump($spotter_array); |
@@ -148,7 +148,7 @@ discard block |
||
148 | 148 | $begin = true; |
149 | 149 | if (!empty($spotter_array) && is_array($spotter_array)) { |
150 | 150 | $output .= '"features": ['; |
151 | - foreach($spotter_array as $spotter_item) { |
|
151 | + foreach ($spotter_array as $spotter_item) { |
|
152 | 152 | $j++; |
153 | 153 | date_default_timezone_set('UTC'); |
154 | 154 | if ($tracker) { |
@@ -172,7 +172,7 @@ discard block |
||
172 | 172 | if ($begin) { |
173 | 173 | if ($j > 1) { |
174 | 174 | if (isset($output_time)) { |
175 | - $output_time = substr($output_time, 0, -1); |
|
175 | + $output_time = substr($output_time, 0, -1); |
|
176 | 176 | $output .= '"time": ['.$output_time.']'; |
177 | 177 | } |
178 | 178 | $output .= '},'; |
@@ -181,7 +181,7 @@ discard block |
||
181 | 181 | $output .= '"type": "LineString",'; |
182 | 182 | $output .= '"coordinates": ['; |
183 | 183 | if (isset($output_history)) { |
184 | - $output_history = substr($output_history, 0, -1); |
|
184 | + $output_history = substr($output_history, 0, -1); |
|
185 | 185 | $output .= $output_history; |
186 | 186 | } |
187 | 187 | $output .= ']}},'; |
@@ -345,7 +345,7 @@ discard block |
||
345 | 345 | |
346 | 346 | if ($j > 1) { |
347 | 347 | if (isset($output_time)) { |
348 | - $output_time = substr($output_time, 0, -1); |
|
348 | + $output_time = substr($output_time, 0, -1); |
|
349 | 349 | $output .= '"time": ['.$output_time.']'; |
350 | 350 | } |
351 | 351 | $output .= '},'; |
@@ -354,7 +354,7 @@ discard block |
||
354 | 354 | $output .= '"type": "LineString",'; |
355 | 355 | $output .= '"coordinates": ['; |
356 | 356 | if (isset($output_history)) { |
357 | - $output_history = substr($output_history, 0, -1); |
|
357 | + $output_history = substr($output_history, 0, -1); |
|
358 | 358 | $output .= $output_history; |
359 | 359 | } |
360 | 360 | $output .= ']'; |
@@ -365,7 +365,7 @@ discard block |
||
365 | 365 | $output = substr($output, 0, -1); |
366 | 366 | $output .= ']'; |
367 | 367 | $output .= ',"initial_sqltime": "'.$sqltime.'",'; |
368 | - $output .= '"totaltime": "'.round(microtime(true)-$begintime,2).'",'; |
|
368 | + $output .= '"totaltime": "'.round(microtime(true) - $begintime, 2).'",'; |
|
369 | 369 | if (isset($begindate)) $output .= '"archive_date": "'.$begindate.'",'; |
370 | 370 | $output .= '"fc": "'.$flightcnt.'"'; |
371 | 371 | } else { |
@@ -22,12 +22,10 @@ discard block |
||
22 | 22 | if ($tracker) { |
23 | 23 | require_once('require/class.Tracker.php'); |
24 | 24 | require_once('require/class.TrackerArchive.php'); |
25 | -} |
|
26 | -elseif ($marine) { |
|
25 | +} elseif ($marine) { |
|
27 | 26 | require_once('require/class.Marine.php'); |
28 | 27 | require_once('require/class.MarineArchive.php'); |
29 | -} |
|
30 | -else { |
|
28 | +} else { |
|
31 | 29 | require_once('require/class.Spotter.php'); |
32 | 30 | require_once('require/class.SpotterArchive.php'); |
33 | 31 | } |
@@ -35,12 +33,10 @@ discard block |
||
35 | 33 | if ($tracker) { |
36 | 34 | $Tracker = new Tracker(); |
37 | 35 | $TrackerArchive = new TrackerArchive(); |
38 | -} |
|
39 | -elseif ($marine) { |
|
36 | +} elseif ($marine) { |
|
40 | 37 | $Marine = new Marine(); |
41 | 38 | $MarineArchive = new MarineArchive(); |
42 | -} |
|
43 | -else { |
|
39 | +} else { |
|
44 | 40 | $Spotter = new Spotter(); |
45 | 41 | $SpotterArchive = new SpotterArchive(); |
46 | 42 | } |
@@ -53,62 +49,86 @@ discard block |
||
53 | 49 | } |
54 | 50 | header('Content-Type: text/javascript'); |
55 | 51 | |
56 | -if (!isset($globalJsonCompress)) $compress = true; |
|
57 | -else $compress = $globalJsonCompress; |
|
52 | +if (!isset($globalJsonCompress)) { |
|
53 | + $compress = true; |
|
54 | +} else { |
|
55 | + $compress = $globalJsonCompress; |
|
56 | +} |
|
58 | 57 | |
59 | 58 | $from_archive = false; |
60 | 59 | $min = false; |
61 | 60 | $allhistory = false; |
62 | 61 | $filter['source'] = array(); |
63 | -if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') $filter['source'] = array_merge($filter['source'],array('vatsimtxt')); |
|
64 | -if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') $filter['source'] = array_merge($filter['source'],array('whazzup')); |
|
65 | -if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') $filter['source'] = array_merge($filter['source'],array('phpvmacars')); |
|
66 | -if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') $filter['source'] = array_merge($filter['source'],array('sbs','famaprs')); |
|
67 | -if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') $filter['source'] = array_merge($filter['source'],array('aprs')); |
|
68 | -if (isset($_COOKIE['filter_ident']) && $_COOKIE['filter_ident'] != '') $filter['ident'] = filter_var($_COOKIE['filter_ident'],FILTER_SANITIZE_STRING); |
|
69 | -if (isset($_COOKIE['filter_mmsi']) && $_COOKIE['filter_mmsi'] != '') $filter['mmsi'] = filter_var($_COOKIE['filter_mmsi'],FILTER_SANITIZE_STRING); |
|
70 | -if (isset($_COOKIE['filter_Airlines']) && $_COOKIE['filter_Airlines'] != '') $filter['airlines'] = filter_var_array(explode(',',$_COOKIE['filter_Airlines']),FILTER_SANITIZE_STRING); |
|
71 | -if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') $filter['source_aprs'] = filter_var_array(explode(',',$_COOKIE['filter_Sources']),FILTER_SANITIZE_STRING); |
|
72 | -if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') $filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'],FILTER_SANITIZE_STRING); |
|
73 | -if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] != 'all') $filter['alliance'] = filter_var($_COOKIE['filter_alliance'],FILTER_SANITIZE_STRING); |
|
62 | +if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') { |
|
63 | + $filter['source'] = array_merge($filter['source'],array('vatsimtxt')); |
|
64 | +} |
|
65 | +if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') { |
|
66 | + $filter['source'] = array_merge($filter['source'],array('whazzup')); |
|
67 | +} |
|
68 | +if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') { |
|
69 | + $filter['source'] = array_merge($filter['source'],array('phpvmacars')); |
|
70 | +} |
|
71 | +if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') { |
|
72 | + $filter['source'] = array_merge($filter['source'],array('sbs','famaprs')); |
|
73 | +} |
|
74 | +if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') { |
|
75 | + $filter['source'] = array_merge($filter['source'],array('aprs')); |
|
76 | +} |
|
77 | +if (isset($_COOKIE['filter_ident']) && $_COOKIE['filter_ident'] != '') { |
|
78 | + $filter['ident'] = filter_var($_COOKIE['filter_ident'],FILTER_SANITIZE_STRING); |
|
79 | +} |
|
80 | +if (isset($_COOKIE['filter_mmsi']) && $_COOKIE['filter_mmsi'] != '') { |
|
81 | + $filter['mmsi'] = filter_var($_COOKIE['filter_mmsi'],FILTER_SANITIZE_STRING); |
|
82 | +} |
|
83 | +if (isset($_COOKIE['filter_Airlines']) && $_COOKIE['filter_Airlines'] != '') { |
|
84 | + $filter['airlines'] = filter_var_array(explode(',',$_COOKIE['filter_Airlines']),FILTER_SANITIZE_STRING); |
|
85 | +} |
|
86 | +if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') { |
|
87 | + $filter['source_aprs'] = filter_var_array(explode(',',$_COOKIE['filter_Sources']),FILTER_SANITIZE_STRING); |
|
88 | +} |
|
89 | +if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') { |
|
90 | + $filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'],FILTER_SANITIZE_STRING); |
|
91 | +} |
|
92 | +if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] != 'all') { |
|
93 | + $filter['alliance'] = filter_var($_COOKIE['filter_alliance'],FILTER_SANITIZE_STRING); |
|
94 | +} |
|
74 | 95 | |
75 | 96 | if (isset($globalMapPopup) && !$globalMapPopup && !(isset($_COOKIE['flightpopup']) && $_COOKIE['flightpopup'] == 'true')) { |
76 | 97 | $min = true; |
77 | -} else $min = false; |
|
98 | +} else { |
|
99 | + $min = false; |
|
100 | +} |
|
78 | 101 | |
79 | 102 | if (isset($_GET['ident'])) { |
80 | 103 | $ident = filter_input(INPUT_GET,'ident',FILTER_SANITIZE_STRING); |
81 | 104 | $from_archive = true; |
82 | 105 | if ($tracker) { |
83 | 106 | $spotter_array = $TrackerArchive->getLastArchiveTrackerDataByIdent($ident); |
84 | - } |
|
85 | - elseif ($marine) { |
|
107 | + } elseif ($marine) { |
|
86 | 108 | $spotter_array = $MarineArchive->getLastArchiveMarineDataByIdent($ident); |
87 | - } |
|
88 | - else { |
|
109 | + } else { |
|
89 | 110 | $spotter_array = $SpotterArchive->getLastArchiveSpotterDataByIdent($ident); |
90 | 111 | } |
91 | 112 | $allhistory = true; |
92 | -} |
|
93 | -elseif (isset($_GET['flightaware_id'])) { |
|
113 | +} elseif (isset($_GET['flightaware_id'])) { |
|
94 | 114 | $flightaware_id = filter_input(INPUT_GET,'flightaware_id',FILTER_SANITIZE_STRING); |
95 | 115 | $from_archive = true; |
96 | 116 | if ($tracker) { |
97 | 117 | $spotter_array = $TrackerArchive->getLastArchiveTrackerDataById($flightaware_id); |
98 | - } |
|
99 | - elseif ($marine) { |
|
118 | + } elseif ($marine) { |
|
100 | 119 | $spotter_array = $MarineArchive->getLastArchiveMarineDataById($flightaware_id); |
101 | - } |
|
102 | - else { |
|
120 | + } else { |
|
103 | 121 | $spotter_array = $SpotterArchive->getLastArchiveSpotterDataById($flightaware_id); |
104 | 122 | } |
105 | 123 | $allhistory = true; |
106 | -} |
|
107 | -elseif (isset($_GET['archive']) && isset($_GET['begindate']) && isset($_GET['enddate']) && isset($_GET['speed'])) { |
|
124 | +} elseif (isset($_GET['archive']) && isset($_GET['begindate']) && isset($_GET['enddate']) && isset($_GET['speed'])) { |
|
108 | 125 | $from_archive = true; |
109 | 126 | $begindate = filter_input(INPUT_GET,'begindate',FILTER_SANITIZE_NUMBER_INT); |
110 | - if (isset($globalAircraftMaxUpdate)) $begindate = $begindate - $globalAircraftMaxUpdate; |
|
111 | - else $begindate = $begindate - 3000; |
|
127 | + if (isset($globalAircraftMaxUpdate)) { |
|
128 | + $begindate = $begindate - $globalAircraftMaxUpdate; |
|
129 | + } else { |
|
130 | + $begindate = $begindate - 3000; |
|
131 | + } |
|
112 | 132 | $enddate = filter_input(INPUT_GET,'enddate',FILTER_SANITIZE_NUMBER_INT); |
113 | 133 | $archivespeed = filter_input(INPUT_GET,'speed',FILTER_SANITIZE_NUMBER_INT); |
114 | 134 | if ($begindate != '' && $enddate != '') { |
@@ -117,11 +137,9 @@ discard block |
||
117 | 137 | //$spotter_array = $SpotterArchive->getMinLiveSpotterDataPlayback($begindate,$enddate,$filter); |
118 | 138 | if ($tracker) { |
119 | 139 | $spotter_array = $TrackerArchive->getMinLiveTrackerData($begindate,$enddate,$filter); |
120 | - } |
|
121 | - elseif ($marine) { |
|
140 | + } elseif ($marine) { |
|
122 | 141 | $spotter_array = $MarineArchive->getMinLiveMarineData($begindate,$enddate,$filter); |
123 | - } |
|
124 | - else { |
|
142 | + } else { |
|
125 | 143 | $spotter_array = $SpotterArchive->getMinLiveSpotterData($begindate,$enddate,$filter); |
126 | 144 | } |
127 | 145 | } |
@@ -130,8 +148,12 @@ discard block |
||
130 | 148 | if (!empty($spotter_array)) { |
131 | 149 | //$flightcnt = $SpotterArchive->getLiveSpotterCount($begindate,$enddate,$filter); |
132 | 150 | $flightcnt = 0; |
133 | - if ($flightcnt == '') $flightcnt = 0; |
|
134 | -} else $flightcnt = 0; |
|
151 | + if ($flightcnt == '') { |
|
152 | + $flightcnt = 0; |
|
153 | + } |
|
154 | + } else { |
|
155 | + $flightcnt = 0; |
|
156 | +} |
|
135 | 157 | |
136 | 158 | $sqltime = round(microtime(true)-$begintime,2); |
137 | 159 | |
@@ -141,8 +163,11 @@ discard block |
||
141 | 163 | $aircrafts_shadow = array(); |
142 | 164 | $output = '{'; |
143 | 165 | $output .= '"type": "FeatureCollection",'; |
144 | -if ($min) $output .= '"minimal": "true",'; |
|
145 | -else $output .= '"minimal": "false",'; |
|
166 | +if ($min) { |
|
167 | + $output .= '"minimal": "true",'; |
|
168 | +} else { |
|
169 | + $output .= '"minimal": "false",'; |
|
170 | +} |
|
146 | 171 | $output .= '"fc": "'.$flightcnt.'",'; |
147 | 172 | $output .= '"sqt": "'.$sqltime.'",'; |
148 | 173 | $begin = true; |
@@ -155,15 +180,17 @@ discard block |
||
155 | 180 | if ($pfi != $spotter_item['famtrackid']) { |
156 | 181 | $pfi = $spotter_item['famtrackid']; |
157 | 182 | $begin = true; |
158 | - } else $spotter_history_array = 0; |
|
159 | - } |
|
160 | - elseif ($marine) { |
|
183 | + } else { |
|
184 | + $spotter_history_array = 0; |
|
185 | + } |
|
186 | + } elseif ($marine) { |
|
161 | 187 | if ($pfi != $spotter_item['fammarine_d']) { |
162 | 188 | $pfi = $spotter_item['fammarine_id']; |
163 | 189 | $begin = true; |
164 | - } else $spotter_history_array = 0; |
|
165 | - } |
|
166 | - else { |
|
190 | + } else { |
|
191 | + $spotter_history_array = 0; |
|
192 | + } |
|
193 | + } else { |
|
167 | 194 | if ($pfi != $spotter_item['flightaware_id']) { |
168 | 195 | $pfi = $spotter_item['flightaware_id']; |
169 | 196 | $begin = true; |
@@ -200,7 +227,9 @@ discard block |
||
200 | 227 | $output_history .= '['.$spotter_item['longitude'].', '.$spotter_item['latitude'].'],'; |
201 | 228 | $output_time .= (strtotime($spotter_item['date'])*1000).','; |
202 | 229 | $previousts = strtotime($spotter_item['date']); |
203 | - if ($k > 1 && (strtotime($spotter_item['date'])*1000 > $enddate)) $end = true; |
|
230 | + if ($k > 1 && (strtotime($spotter_item['date'])*1000 > $enddate)) { |
|
231 | + $end = true; |
|
232 | + } |
|
204 | 233 | } |
205 | 234 | |
206 | 235 | if ($begin) { |
@@ -210,21 +239,29 @@ discard block |
||
210 | 239 | $output .= '"type": "Feature",'; |
211 | 240 | $output .= '"properties": {'; |
212 | 241 | $output .= '"fi": "'.$pfi.'",'; |
213 | - if (isset($begindate)) $output .= '"archive_date": "'.$begindate.'",'; |
|
242 | + if (isset($begindate)) { |
|
243 | + $output .= '"archive_date": "'.$begindate.'",'; |
|
244 | + } |
|
214 | 245 | if (isset($spotter_item['ident']) && $spotter_item['ident'] != '') { |
215 | 246 | $output .= '"c": "'.$spotter_item['ident'].'",'; |
216 | 247 | } else { |
217 | 248 | $output .= '"c": "NA",'; |
218 | 249 | } |
219 | 250 | if (!isset($spotter_item['aircraft_shadow']) && !$tracker && !$marine) { |
220 | - if (!isset($spotter_item['aircraft_icao']) || $spotter_item['aircraft_icao'] == '') $spotter_item['aircraft_shadow'] = ''; |
|
221 | - else { |
|
251 | + if (!isset($spotter_item['aircraft_icao']) || $spotter_item['aircraft_icao'] == '') { |
|
252 | + $spotter_item['aircraft_shadow'] = ''; |
|
253 | + } else { |
|
222 | 254 | $aircraft_icao = $spotter_item['aircraft_icao']; |
223 | 255 | $aircraft_info = $Spotter->getAllAircraftInfo($spotter_item['aircraft_icao']); |
224 | - if (count($aircraft_info) > 0) $spotter_item['aircraft_shadow'] = $aircraft_info[0]['aircraft_shadow']; |
|
225 | - elseif (isset($spotter_item['format_source']) && $spotter_item['format_source'] == 'aprs') $spotter_item['aircraft_shadow'] = 'PA18.png'; |
|
226 | - elseif ($aircraft_icao == 'PARAGLIDER') $spotter_item['aircraft_shadow'] = 'PARAGLIDER.png'; |
|
227 | - else $spotter_item['aircraft_shadow'] = ''; |
|
256 | + if (count($aircraft_info) > 0) { |
|
257 | + $spotter_item['aircraft_shadow'] = $aircraft_info[0]['aircraft_shadow']; |
|
258 | + } elseif (isset($spotter_item['format_source']) && $spotter_item['format_source'] == 'aprs') { |
|
259 | + $spotter_item['aircraft_shadow'] = 'PA18.png'; |
|
260 | + } elseif ($aircraft_icao == 'PARAGLIDER') { |
|
261 | + $spotter_item['aircraft_shadow'] = 'PARAGLIDER.png'; |
|
262 | + } else { |
|
263 | + $spotter_item['aircraft_shadow'] = ''; |
|
264 | + } |
|
228 | 265 | $aircrafts_shadow[$aircraft_icao] = $spotter_item['aircraft_shadow']; |
229 | 266 | } |
230 | 267 | } |
@@ -232,93 +269,139 @@ discard block |
||
232 | 269 | if (!isset($spotter_item['aircraft_shadow']) || $spotter_item['aircraft_shadow'] == '') { |
233 | 270 | if ($tracker) { |
234 | 271 | if (isset($spotter_item['type']) && $spotter_item['type'] == 'Ambulance') { |
235 | - if ($compress) $output .= '"as": "ambulance.png",'; |
|
236 | - else $output .= '"aircraft_shadow": "ambulance.png",'; |
|
237 | - } |
|
238 | - elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Police') { |
|
239 | - if ($compress) $output .= '"as": "police.png",'; |
|
240 | - else $output .= '"aircraft_shadow": "police.png",'; |
|
241 | - } |
|
242 | - elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Yacht (Sail)') { |
|
243 | - if ($compress) $output .= '"as": "ship.png",'; |
|
244 | - else $output .= '"aircraft_shadow": "ship.png",'; |
|
245 | - } |
|
246 | - elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Ship (Power Boat)') { |
|
247 | - if ($compress) $output .= '"as": "ship.png",'; |
|
248 | - else $output .= '"aircraft_shadow": "ship.png",'; |
|
249 | - } |
|
250 | - elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Shuttle') { |
|
251 | - if ($compress) $output .= '"as": "ship.png",'; |
|
252 | - else $output .= '"aircraft_shadow": "ship.png",'; |
|
272 | + if ($compress) { |
|
273 | + $output .= '"as": "ambulance.png",'; |
|
274 | + } else { |
|
275 | + $output .= '"aircraft_shadow": "ambulance.png",'; |
|
276 | + } |
|
277 | + } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Police') { |
|
278 | + if ($compress) { |
|
279 | + $output .= '"as": "police.png",'; |
|
280 | + } else { |
|
281 | + $output .= '"aircraft_shadow": "police.png",'; |
|
282 | + } |
|
283 | + } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Yacht (Sail)') { |
|
284 | + if ($compress) { |
|
285 | + $output .= '"as": "ship.png",'; |
|
286 | + } else { |
|
287 | + $output .= '"aircraft_shadow": "ship.png",'; |
|
288 | + } |
|
289 | + } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Ship (Power Boat)') { |
|
290 | + if ($compress) { |
|
291 | + $output .= '"as": "ship.png",'; |
|
292 | + } else { |
|
293 | + $output .= '"aircraft_shadow": "ship.png",'; |
|
294 | + } |
|
295 | + } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Shuttle') { |
|
296 | + if ($compress) { |
|
297 | + $output .= '"as": "ship.png",'; |
|
298 | + } else { |
|
299 | + $output .= '"aircraft_shadow": "ship.png",'; |
|
300 | + } |
|
301 | + } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Truck') { |
|
302 | + if ($compress) { |
|
303 | + $output .= '"as": "truck.png",'; |
|
304 | + } else { |
|
305 | + $output .= '"aircraft_shadow": "truck.png",'; |
|
306 | + } |
|
307 | + } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Truck (18 Wheeler)') { |
|
308 | + if ($compress) { |
|
309 | + $output .= '"as": "truck.png",'; |
|
310 | + } else { |
|
311 | + $output .= '"aircraft_shadow": "truck.png",'; |
|
312 | + } |
|
313 | + } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Aircraft (small)') { |
|
314 | + if ($compress) { |
|
315 | + $output .= '"as": "aircraft.png",'; |
|
316 | + } else { |
|
317 | + $output .= '"aircraft_shadow": "aircraft.png",'; |
|
318 | + } |
|
319 | + } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Large Aircraft') { |
|
320 | + if ($compress) { |
|
321 | + $output .= '"as": "aircraft.png",'; |
|
322 | + } else { |
|
323 | + $output .= '"aircraft_shadow": "aircraft.png",'; |
|
324 | + } |
|
325 | + } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Helicopter') { |
|
326 | + if ($compress) { |
|
327 | + $output .= '"as": "helico.png",'; |
|
328 | + } else { |
|
329 | + $output .= '"aircraft_shadow": "helico.png",'; |
|
330 | + } |
|
331 | + } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Railroad Engine') { |
|
332 | + if ($compress) { |
|
333 | + $output .= '"as": "rail.png",'; |
|
334 | + } else { |
|
335 | + $output .= '"aircraft_shadow": "rail.png",'; |
|
336 | + } |
|
337 | + } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Firetruck') { |
|
338 | + if ($compress) { |
|
339 | + $output .= '"as": "firetruck.png",'; |
|
340 | + } else { |
|
341 | + $output .= '"aircraft_shadow": "firetruck.png",'; |
|
342 | + } |
|
343 | + } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Bus') { |
|
344 | + if ($compress) { |
|
345 | + $output .= '"as": "bus.png",'; |
|
346 | + } else { |
|
347 | + $output .= '"aircraft_shadow": "bus.png",'; |
|
348 | + } |
|
349 | + } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Phone') { |
|
350 | + if ($compress) { |
|
351 | + $output .= '"as": "phone.png",'; |
|
352 | + } else { |
|
353 | + $output .= '"aircraft_shadow": "phone.png",'; |
|
354 | + } |
|
355 | + } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Jogger') { |
|
356 | + if ($compress) { |
|
357 | + $output .= '"as": "jogger.png",'; |
|
358 | + } else { |
|
359 | + $output .= '"aircraft_shadow": "jogger.png",'; |
|
360 | + } |
|
361 | + } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Bike') { |
|
362 | + if ($compress) { |
|
363 | + $output .= '"as": "bike.png",'; |
|
364 | + } else { |
|
365 | + $output .= '"aircraft_shadow": "bike.png",'; |
|
366 | + } |
|
367 | + } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Motorcycle') { |
|
368 | + if ($compress) { |
|
369 | + $output .= '"as": "motorcycle.png",'; |
|
370 | + } else { |
|
371 | + $output .= '"aircraft_shadow": "motorcycle.png",'; |
|
372 | + } |
|
373 | + } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Balloon') { |
|
374 | + if ($compress) { |
|
375 | + $output .= '"as": "balloon.png",'; |
|
376 | + } else { |
|
377 | + $output .= '"aircraft_shadow": "balloon.png",'; |
|
378 | + } |
|
379 | + } else { |
|
380 | + if ($compress) { |
|
381 | + $output .= '"as": "car.png",'; |
|
382 | + } else { |
|
383 | + $output .= '"aircraft_shadow": "car.png",'; |
|
384 | + } |
|
253 | 385 | } |
254 | - elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Truck') { |
|
255 | - if ($compress) $output .= '"as": "truck.png",'; |
|
256 | - else $output .= '"aircraft_shadow": "truck.png",'; |
|
386 | + } elseif ($marine) { |
|
387 | + if ($compress) { |
|
388 | + $output .= '"as": "ship.png",'; |
|
389 | + } else { |
|
390 | + $output .= '"aircraft_shadow": "ship.png",'; |
|
257 | 391 | } |
258 | - elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Truck (18 Wheeler)') { |
|
259 | - if ($compress) $output .= '"as": "truck.png",'; |
|
260 | - else $output .= '"aircraft_shadow": "truck.png",'; |
|
261 | - } |
|
262 | - elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Aircraft (small)') { |
|
263 | - if ($compress) $output .= '"as": "aircraft.png",'; |
|
264 | - else $output .= '"aircraft_shadow": "aircraft.png",'; |
|
265 | - } |
|
266 | - elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Large Aircraft') { |
|
267 | - if ($compress) $output .= '"as": "aircraft.png",'; |
|
268 | - else $output .= '"aircraft_shadow": "aircraft.png",'; |
|
269 | - } |
|
270 | - elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Helicopter') { |
|
271 | - if ($compress) $output .= '"as": "helico.png",'; |
|
272 | - else $output .= '"aircraft_shadow": "helico.png",'; |
|
273 | - } |
|
274 | - elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Railroad Engine') { |
|
275 | - if ($compress) $output .= '"as": "rail.png",'; |
|
276 | - else $output .= '"aircraft_shadow": "rail.png",'; |
|
277 | - } |
|
278 | - elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Firetruck') { |
|
279 | - if ($compress) $output .= '"as": "firetruck.png",'; |
|
280 | - else $output .= '"aircraft_shadow": "firetruck.png",'; |
|
281 | - } |
|
282 | - elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Bus') { |
|
283 | - if ($compress) $output .= '"as": "bus.png",'; |
|
284 | - else $output .= '"aircraft_shadow": "bus.png",'; |
|
285 | - } |
|
286 | - elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Phone') { |
|
287 | - if ($compress) $output .= '"as": "phone.png",'; |
|
288 | - else $output .= '"aircraft_shadow": "phone.png",'; |
|
289 | - } |
|
290 | - elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Jogger') { |
|
291 | - if ($compress) $output .= '"as": "jogger.png",'; |
|
292 | - else $output .= '"aircraft_shadow": "jogger.png",'; |
|
293 | - } |
|
294 | - elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Bike') { |
|
295 | - if ($compress) $output .= '"as": "bike.png",'; |
|
296 | - else $output .= '"aircraft_shadow": "bike.png",'; |
|
297 | - } |
|
298 | - elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Motorcycle') { |
|
299 | - if ($compress) $output .= '"as": "motorcycle.png",'; |
|
300 | - else $output .= '"aircraft_shadow": "motorcycle.png",'; |
|
301 | - } |
|
302 | - elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Balloon') { |
|
303 | - if ($compress) $output .= '"as": "balloon.png",'; |
|
304 | - else $output .= '"aircraft_shadow": "balloon.png",'; |
|
305 | - } |
|
306 | - else { |
|
307 | - if ($compress) $output .= '"as": "car.png",'; |
|
308 | - else $output .= '"aircraft_shadow": "car.png",'; |
|
392 | + } else { |
|
393 | + if ($compress) { |
|
394 | + $output .= '"as": "default.png",'; |
|
395 | + } else { |
|
396 | + $output .= '"aircraft_shadow": "default.png",'; |
|
309 | 397 | } |
310 | 398 | } |
311 | - elseif ($marine) { |
|
312 | - if ($compress) $output .= '"as": "ship.png",'; |
|
313 | - else $output .= '"aircraft_shadow": "ship.png",'; |
|
314 | - } |
|
315 | - else { |
|
316 | - if ($compress) $output .= '"as": "default.png",'; |
|
317 | - else $output .= '"aircraft_shadow": "default.png",'; |
|
318 | - } |
|
319 | 399 | } else { |
320 | - if ($compress) $output .= '"as": "'.$spotter_item['aircraft_shadow'].'",'; |
|
321 | - else $output .= '"aircraft_shadow": "'.$spotter_item['aircraft_shadow'].'",'; |
|
400 | + if ($compress) { |
|
401 | + $output .= '"as": "'.$spotter_item['aircraft_shadow'].'",'; |
|
402 | + } else { |
|
403 | + $output .= '"aircraft_shadow": "'.$spotter_item['aircraft_shadow'].'",'; |
|
404 | + } |
|
322 | 405 | } |
323 | 406 | |
324 | 407 | if (isset($spotter_item['date_iso_8601'])) { |
@@ -366,7 +449,9 @@ discard block |
||
366 | 449 | $output .= ']'; |
367 | 450 | $output .= ',"initial_sqltime": "'.$sqltime.'",'; |
368 | 451 | $output .= '"totaltime": "'.round(microtime(true)-$begintime,2).'",'; |
369 | - if (isset($begindate)) $output .= '"archive_date": "'.$begindate.'",'; |
|
452 | + if (isset($begindate)) { |
|
453 | + $output .= '"archive_date": "'.$begindate.'",'; |
|
454 | + } |
|
370 | 455 | $output .= '"fc": "'.$flightcnt.'"'; |
371 | 456 | } else { |
372 | 457 | $output .= '"features": '; |