@@ -9,20 +9,20 @@ discard block |
||
9 | 9 | require_once(dirname(__FILE__).'/class.Source.php'); |
10 | 10 | require_once(dirname(__FILE__).'/class.GeoidHeight.php'); |
11 | 11 | if (isset($globalServerAPRS) && $globalServerAPRS) { |
12 | - require_once(dirname(__FILE__).'/class.APRS.php'); |
|
12 | + require_once(dirname(__FILE__).'/class.APRS.php'); |
|
13 | 13 | } |
14 | 14 | |
15 | 15 | class SpotterImport { |
16 | - private $all_flights = array(); |
|
17 | - private $last_delete_hourly = 0; |
|
18 | - private $last_delete = 0; |
|
19 | - private $stats = array(); |
|
20 | - private $tmd = 0; |
|
21 | - private $source_location = array(); |
|
22 | - public $db = null; |
|
23 | - public $nb = 0; |
|
16 | + private $all_flights = array(); |
|
17 | + private $last_delete_hourly = 0; |
|
18 | + private $last_delete = 0; |
|
19 | + private $stats = array(); |
|
20 | + private $tmd = 0; |
|
21 | + private $source_location = array(); |
|
22 | + public $db = null; |
|
23 | + public $nb = 0; |
|
24 | 24 | |
25 | - public function __construct($dbc = null) { |
|
25 | + public function __construct($dbc = null) { |
|
26 | 26 | global $globalBeta, $globalServerAPRS, $APRSSpotter, $globalNoDB, $GeoidClass, $globalDebug, $globalGeoid; |
27 | 27 | if (!(isset($globalNoDB) && $globalNoDB)) { |
28 | 28 | $Connection = new Connection($dbc); |
@@ -34,14 +34,14 @@ discard block |
||
34 | 34 | $currentdate = date('Y-m-d'); |
35 | 35 | $sourcestat = $Stats->getStatsSource($currentdate); |
36 | 36 | if (!empty($sourcestat)) { |
37 | - foreach($sourcestat as $srcst) { |
|
38 | - $type = $srcst['stats_type']; |
|
37 | + foreach($sourcestat as $srcst) { |
|
38 | + $type = $srcst['stats_type']; |
|
39 | 39 | if ($type == 'polar' || $type == 'hist') { |
40 | - $source = $srcst['source_name']; |
|
41 | - $data = $srcst['source_data']; |
|
42 | - $this->stats[$currentdate][$source][$type] = json_decode($data,true); |
|
43 | - } |
|
44 | - } |
|
40 | + $source = $srcst['source_name']; |
|
41 | + $data = $srcst['source_data']; |
|
42 | + $this->stats[$currentdate][$source][$type] = json_decode($data,true); |
|
43 | + } |
|
44 | + } |
|
45 | 45 | } |
46 | 46 | } |
47 | 47 | if (isset($globalServerAPRS) && $globalServerAPRS) { |
@@ -56,9 +56,9 @@ discard block |
||
56 | 56 | $GeoidClass = FALSE; |
57 | 57 | } |
58 | 58 | } |
59 | - } |
|
59 | + } |
|
60 | 60 | |
61 | - public function get_Schedule($id,$ident) { |
|
61 | + public function get_Schedule($id,$ident) { |
|
62 | 62 | global $globalDebug, $globalFork, $globalSchedulesFetch; |
63 | 63 | // Get schedule here, so it's done only one time |
64 | 64 | |
@@ -78,43 +78,43 @@ discard block |
||
78 | 78 | $operator = $Spotter->getOperator($ident); |
79 | 79 | $scheduleexist = false; |
80 | 80 | if ($Schedule->checkSchedule($operator) == 0) { |
81 | - $operator = $Translation->checkTranslation($ident); |
|
82 | - if ($Schedule->checkSchedule($operator) == 0) { |
|
81 | + $operator = $Translation->checkTranslation($ident); |
|
82 | + if ($Schedule->checkSchedule($operator) == 0) { |
|
83 | 83 | $schedule = $Schedule->fetchSchedule($operator); |
84 | 84 | if (count($schedule) > 0 && isset($schedule['DepartureTime']) && isset($schedule['ArrivalTime'])) { |
85 | - if ($globalDebug) echo "-> Schedule info for ".$operator." (".$ident.")\n"; |
|
86 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('departure_airport_time' => $schedule['DepartureTime'])); |
|
87 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('arrival_airport_time' => $schedule['ArrivalTime'])); |
|
88 | - // Should also check if route schedule = route from DB |
|
89 | - if ($schedule['DepartureAirportIATA'] != '') { |
|
85 | + if ($globalDebug) echo "-> Schedule info for ".$operator." (".$ident.")\n"; |
|
86 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('departure_airport_time' => $schedule['DepartureTime'])); |
|
87 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('arrival_airport_time' => $schedule['ArrivalTime'])); |
|
88 | + // Should also check if route schedule = route from DB |
|
89 | + if ($schedule['DepartureAirportIATA'] != '') { |
|
90 | 90 | if ($this->all_flights[$id]['departure_airport'] != $Spotter->getAirportIcao($schedule['DepartureAirportIATA'])) { |
91 | - $airport_icao = $Spotter->getAirportIcao($schedule['DepartureAirportIATA']); |
|
92 | - if (trim($airport_icao) != '') { |
|
91 | + $airport_icao = $Spotter->getAirportIcao($schedule['DepartureAirportIATA']); |
|
92 | + if (trim($airport_icao) != '') { |
|
93 | 93 | $this->all_flights[$id]['departure_airport'] = $airport_icao; |
94 | 94 | if ($globalDebug) echo "-> Change departure airport to ".$airport_icao." for ".$ident."\n"; |
95 | - } |
|
95 | + } |
|
96 | + } |
|
96 | 97 | } |
97 | - } |
|
98 | - if ($schedule['ArrivalAirportIATA'] != '') { |
|
98 | + if ($schedule['ArrivalAirportIATA'] != '') { |
|
99 | 99 | if ($this->all_flights[$id]['arrival_airport'] != $Spotter->getAirportIcao($schedule['ArrivalAirportIATA'])) { |
100 | - $airport_icao = $Spotter->getAirportIcao($schedule['ArrivalAirportIATA']); |
|
101 | - if (trim($airport_icao) != '') { |
|
100 | + $airport_icao = $Spotter->getAirportIcao($schedule['ArrivalAirportIATA']); |
|
101 | + if (trim($airport_icao) != '') { |
|
102 | 102 | $this->all_flights[$id]['arrival_airport'] = $airport_icao; |
103 | 103 | if ($globalDebug) echo "-> Change arrival airport to ".$airport_icao." for ".$ident."\n"; |
104 | - } |
|
104 | + } |
|
105 | 105 | } |
106 | - } |
|
107 | - $Schedule->addSchedule($operator,$this->all_flights[$id]['departure_airport'],$this->all_flights[$id]['departure_airport_time'],$this->all_flights[$id]['arrival_airport'],$this->all_flights[$id]['arrival_airport_time'],$schedule['Source']); |
|
106 | + } |
|
107 | + $Schedule->addSchedule($operator,$this->all_flights[$id]['departure_airport'],$this->all_flights[$id]['departure_airport_time'],$this->all_flights[$id]['arrival_airport'],$this->all_flights[$id]['arrival_airport_time'],$schedule['Source']); |
|
108 | 108 | } |
109 | - } else $scheduleexist = true; |
|
109 | + } else $scheduleexist = true; |
|
110 | 110 | } else $scheduleexist = true; |
111 | 111 | // close connection, at least one way will work ? |
112 | - if ($scheduleexist) { |
|
112 | + if ($scheduleexist) { |
|
113 | 113 | if ($globalDebug) echo "-> get arrival/departure airport info for ".$ident."\n"; |
114 | - $sch = $Schedule->getSchedule($operator); |
|
114 | + $sch = $Schedule->getSchedule($operator); |
|
115 | 115 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('arrival_airport' => $sch['arrival_airport_icao'],'departure_airport' => $sch['departure_airport_icao'],'departure_airport_time' => $sch['departure_airport_time'],'arrival_airport_time' => $sch['arrival_airport_time'])); |
116 | 116 | if ($this->all_flights[$id]['addedSpotter'] == 1) $Spotter->updateLatestScheduleSpotterData($this->all_flights[$id]['id'],$sch['departure_airport_icao'],$sch['departure_airport_time'],$sch['arrival_airport_icao'],$sch['arrival_airport_time']); |
117 | - } |
|
117 | + } |
|
118 | 118 | $Spotter->db = null; |
119 | 119 | $Schedule->db = null; |
120 | 120 | $Translation->db = null; |
@@ -129,78 +129,78 @@ discard block |
||
129 | 129 | } |
130 | 130 | */ |
131 | 131 | } |
132 | - } |
|
132 | + } |
|
133 | 133 | |
134 | - public function checkAll() { |
|
134 | + public function checkAll() { |
|
135 | 135 | global $globalDebug, $globalNoImport; |
136 | 136 | if ($globalDebug) echo "Update last seen flights data...\n"; |
137 | 137 | if (!isset($globalNoImport) || $globalNoImport === FALSE) { |
138 | - foreach ($this->all_flights as $key => $flight) { |
|
138 | + foreach ($this->all_flights as $key => $flight) { |
|
139 | 139 | if (isset($this->all_flights[$key]['id'])) { |
140 | - //echo $this->all_flights[$key]['id'].' - '.$this->all_flights[$key]['latitude'].' '.$this->all_flights[$key]['longitude']."\n"; |
|
141 | - $Spotter = new Spotter($this->db); |
|
142 | - $real_arrival = $this->arrival($key); |
|
143 | - if (isset($this->all_flights[$key]['altitude']) && isset($this->all_flights[$key]['datetime'])) $Spotter->updateLatestSpotterData($this->all_flights[$key]['id'],$this->all_flights[$key]['ident'],$this->all_flights[$key]['latitude'],$this->all_flights[$key]['longitude'],$this->all_flights[$key]['altitude'],$this->all_flights[$key]['ground'],$this->all_flights[$key]['speed'],$this->all_flights[$key]['datetime'],$real_arrival['airport_icao'],$real_arrival['airport_time']); |
|
144 | - } |
|
145 | - } |
|
140 | + //echo $this->all_flights[$key]['id'].' - '.$this->all_flights[$key]['latitude'].' '.$this->all_flights[$key]['longitude']."\n"; |
|
141 | + $Spotter = new Spotter($this->db); |
|
142 | + $real_arrival = $this->arrival($key); |
|
143 | + if (isset($this->all_flights[$key]['altitude']) && isset($this->all_flights[$key]['datetime'])) $Spotter->updateLatestSpotterData($this->all_flights[$key]['id'],$this->all_flights[$key]['ident'],$this->all_flights[$key]['latitude'],$this->all_flights[$key]['longitude'],$this->all_flights[$key]['altitude'],$this->all_flights[$key]['ground'],$this->all_flights[$key]['speed'],$this->all_flights[$key]['datetime'],$real_arrival['airport_icao'],$real_arrival['airport_time']); |
|
144 | + } |
|
145 | + } |
|
146 | + } |
|
146 | 147 | } |
147 | - } |
|
148 | 148 | |
149 | - public function arrival($key) { |
|
149 | + public function arrival($key) { |
|
150 | 150 | global $globalClosestMinDist, $globalDebug; |
151 | 151 | if ($globalDebug) echo 'Update arrival...'."\n"; |
152 | 152 | $Spotter = new Spotter($this->db); |
153 | - $airport_icao = ''; |
|
154 | - $airport_time = ''; |
|
155 | - if (!isset($globalClosestMinDist) || $globalClosestMinDist == '') $globalClosestMinDist = 50; |
|
153 | + $airport_icao = ''; |
|
154 | + $airport_time = ''; |
|
155 | + if (!isset($globalClosestMinDist) || $globalClosestMinDist == '') $globalClosestMinDist = 50; |
|
156 | 156 | if ($this->all_flights[$key]['latitude'] != '' && $this->all_flights[$key]['longitude'] != '') { |
157 | - $closestAirports = $Spotter->closestAirports($this->all_flights[$key]['latitude'],$this->all_flights[$key]['longitude'],$globalClosestMinDist); |
|
158 | - if (isset($closestAirports[0])) { |
|
159 | - if (isset($this->all_flights[$key]['arrival_airport']) && $this->all_flights[$key]['arrival_airport'] == $closestAirports[0]['icao']) { |
|
160 | - $airport_icao = $closestAirports[0]['icao']; |
|
161 | - $airport_time = $this->all_flights[$key]['datetime']; |
|
162 | - if ($globalDebug) echo "---++ Find arrival airport. airport_icao : ".$airport_icao."\n"; |
|
163 | - } elseif (count($closestAirports > 1) && isset($this->all_flights[$key]['arrival_airport']) && $this->all_flights[$key]['arrival_airport'] != '') { |
|
164 | - foreach ($closestAirports as $airport) { |
|
165 | - if ($this->all_flights[$key]['arrival_airport'] == $airport['icao']) { |
|
166 | - $airport_icao = $airport['icao']; |
|
167 | - $airport_time = $this->all_flights[$key]['datetime']; |
|
168 | - if ($globalDebug) echo "---++ Find arrival airport. airport_icao : ".$airport_icao."\n"; |
|
169 | - break; |
|
170 | - } |
|
171 | - } |
|
172 | - } elseif ($this->all_flights[$key]['altitude'] == 0 || ($this->all_flights[$key]['altitude_real'] != '' && ($closestAirports[0]['altitude'] < $this->all_flights[$key]['altitude_real'] && $this->all_flights[$key]['altitude_real'] < $closestAirports[0]['altitude']+5000))) { |
|
173 | - $airport_icao = $closestAirports[0]['icao']; |
|
174 | - $airport_time = $this->all_flights[$key]['datetime']; |
|
175 | - } else { |
|
176 | - if ($globalDebug) echo "----- Can't find arrival airport. Airport altitude : ".$closestAirports[0]['altitude'].' - flight altitude : '.$this->all_flights[$key]['altitude_real']."\n"; |
|
177 | - } |
|
178 | - } else { |
|
179 | - if ($globalDebug) echo "----- No Airport near last coord. Latitude : ".$this->all_flights[$key]['latitude'].' - Longitude : '.$this->all_flights[$key]['longitude'].' - MinDist : '.$globalClosestMinDist."\n"; |
|
180 | - } |
|
157 | + $closestAirports = $Spotter->closestAirports($this->all_flights[$key]['latitude'],$this->all_flights[$key]['longitude'],$globalClosestMinDist); |
|
158 | + if (isset($closestAirports[0])) { |
|
159 | + if (isset($this->all_flights[$key]['arrival_airport']) && $this->all_flights[$key]['arrival_airport'] == $closestAirports[0]['icao']) { |
|
160 | + $airport_icao = $closestAirports[0]['icao']; |
|
161 | + $airport_time = $this->all_flights[$key]['datetime']; |
|
162 | + if ($globalDebug) echo "---++ Find arrival airport. airport_icao : ".$airport_icao."\n"; |
|
163 | + } elseif (count($closestAirports > 1) && isset($this->all_flights[$key]['arrival_airport']) && $this->all_flights[$key]['arrival_airport'] != '') { |
|
164 | + foreach ($closestAirports as $airport) { |
|
165 | + if ($this->all_flights[$key]['arrival_airport'] == $airport['icao']) { |
|
166 | + $airport_icao = $airport['icao']; |
|
167 | + $airport_time = $this->all_flights[$key]['datetime']; |
|
168 | + if ($globalDebug) echo "---++ Find arrival airport. airport_icao : ".$airport_icao."\n"; |
|
169 | + break; |
|
170 | + } |
|
171 | + } |
|
172 | + } elseif ($this->all_flights[$key]['altitude'] == 0 || ($this->all_flights[$key]['altitude_real'] != '' && ($closestAirports[0]['altitude'] < $this->all_flights[$key]['altitude_real'] && $this->all_flights[$key]['altitude_real'] < $closestAirports[0]['altitude']+5000))) { |
|
173 | + $airport_icao = $closestAirports[0]['icao']; |
|
174 | + $airport_time = $this->all_flights[$key]['datetime']; |
|
175 | + } else { |
|
176 | + if ($globalDebug) echo "----- Can't find arrival airport. Airport altitude : ".$closestAirports[0]['altitude'].' - flight altitude : '.$this->all_flights[$key]['altitude_real']."\n"; |
|
177 | + } |
|
178 | + } else { |
|
179 | + if ($globalDebug) echo "----- No Airport near last coord. Latitude : ".$this->all_flights[$key]['latitude'].' - Longitude : '.$this->all_flights[$key]['longitude'].' - MinDist : '.$globalClosestMinDist."\n"; |
|
180 | + } |
|
181 | 181 | |
182 | - } else { |
|
183 | - if ($globalDebug) echo "---- No latitude or longitude. Ident : ".$this->all_flights[$key]['ident']."\n"; |
|
184 | - } |
|
185 | - return array('airport_icao' => $airport_icao,'airport_time' => $airport_time); |
|
186 | - } |
|
182 | + } else { |
|
183 | + if ($globalDebug) echo "---- No latitude or longitude. Ident : ".$this->all_flights[$key]['ident']."\n"; |
|
184 | + } |
|
185 | + return array('airport_icao' => $airport_icao,'airport_time' => $airport_time); |
|
186 | + } |
|
187 | 187 | |
188 | 188 | |
189 | 189 | |
190 | - public function del() { |
|
190 | + public function del() { |
|
191 | 191 | global $globalDebug, $globalNoImport, $globalNoDB; |
192 | 192 | // Delete old infos |
193 | 193 | if ($globalDebug) echo 'Delete old values and update latest data...'."\n"; |
194 | 194 | foreach ($this->all_flights as $key => $flight) { |
195 | - if (isset($flight['lastupdate'])) { |
|
195 | + if (isset($flight['lastupdate'])) { |
|
196 | 196 | if ($flight['lastupdate'] < (time()-1800)) { |
197 | - $this->delKey($key); |
|
197 | + $this->delKey($key); |
|
198 | 198 | } |
199 | - } |
|
199 | + } |
|
200 | + } |
|
200 | 201 | } |
201 | - } |
|
202 | 202 | |
203 | - public function delKey($key) { |
|
203 | + public function delKey($key) { |
|
204 | 204 | global $globalDebug, $globalNoImport, $globalNoDB; |
205 | 205 | // Delete old infos |
206 | 206 | if (isset($this->all_flights[$key]['id'])) { |
@@ -215,9 +215,9 @@ discard block |
||
215 | 215 | } |
216 | 216 | } |
217 | 217 | unset($this->all_flights[$key]); |
218 | - } |
|
218 | + } |
|
219 | 219 | |
220 | - public function add($line) { |
|
220 | + public function add($line) { |
|
221 | 221 | global $globalPilotIdAccept, $globalAirportAccept, $globalAirlineAccept, $globalAirlineIgnore, $globalAirportIgnore, $globalFork, $globalDistanceIgnore, $globalDaemon, $globalSBS1update, $globalDebug, $globalIVAO, $globalVATSIM, $globalphpVMS, $globalCoordMinChange, $globalDebugTimeElapsed, $globalCenterLatitude, $globalCenterLongitude, $globalBeta, $globalSourcesupdate, $globalAirlinesSource, $globalVAM, $globalAllFlights, $globalServerAPRS, $APRSSpotter, $globalNoImport, $globalNoDB, $globalVA, $globalAircraftMaxUpdate, $globalAircraftMinUpdate, $globalLiveInterval, $GeoidClass, $globalArchive; |
222 | 222 | //if (!isset($globalDebugTimeElapsed) || $globalDebugTimeElapsed == '') $globalDebugTimeElapsed = FALSE; |
223 | 223 | if (!isset($globalCoordMinChange) || $globalCoordMinChange == '') $globalCoordMinChange = '0.01'; |
@@ -243,20 +243,20 @@ discard block |
||
243 | 243 | |
244 | 244 | // SBS format is CSV format |
245 | 245 | if(is_array($line) && (isset($line['hex']) || isset($line['id']))) { |
246 | - //print_r($line); |
|
247 | - if (isset($line['hex'])) $line['hex'] = strtoupper($line['hex']); |
|
248 | - if (isset($line['id']) || (isset($line['hex']) && $line['hex'] != '' && substr($line['hex'],0,1) != '~' && $line['hex'] != '00000' && $line['hex'] != '000000' && $line['hex'] != '111111' && ctype_xdigit($line['hex']) && strlen($line['hex']) === 6)) { |
|
246 | + //print_r($line); |
|
247 | + if (isset($line['hex'])) $line['hex'] = strtoupper($line['hex']); |
|
248 | + if (isset($line['id']) || (isset($line['hex']) && $line['hex'] != '' && substr($line['hex'],0,1) != '~' && $line['hex'] != '00000' && $line['hex'] != '000000' && $line['hex'] != '111111' && ctype_xdigit($line['hex']) && strlen($line['hex']) === 6)) { |
|
249 | 249 | |
250 | 250 | // Increment message number |
251 | 251 | if (isset($line['sourcestats']) && $line['sourcestats'] === TRUE) { |
252 | - $current_date = date('Y-m-d'); |
|
253 | - if (isset($line['source_name'])) $source = $line['source_name']; |
|
254 | - else $source = ''; |
|
255 | - if ($source == '' || $line['format_source'] == 'aprs') $source = $line['format_source']; |
|
256 | - if (!isset($this->stats[$current_date][$source]['msg'])) { |
|
257 | - $this->stats[$current_date][$source]['msg']['date'] = time(); |
|
258 | - $this->stats[$current_date][$source]['msg']['nb'] = 1; |
|
259 | - } else $this->stats[$current_date][$source]['msg']['nb'] += 1; |
|
252 | + $current_date = date('Y-m-d'); |
|
253 | + if (isset($line['source_name'])) $source = $line['source_name']; |
|
254 | + else $source = ''; |
|
255 | + if ($source == '' || $line['format_source'] == 'aprs') $source = $line['format_source']; |
|
256 | + if (!isset($this->stats[$current_date][$source]['msg'])) { |
|
257 | + $this->stats[$current_date][$source]['msg']['date'] = time(); |
|
258 | + $this->stats[$current_date][$source]['msg']['nb'] = 1; |
|
259 | + } else $this->stats[$current_date][$source]['msg']['nb'] += 1; |
|
260 | 260 | } |
261 | 261 | |
262 | 262 | /* |
@@ -272,54 +272,54 @@ discard block |
||
272 | 272 | //$this->db = $dbc; |
273 | 273 | |
274 | 274 | //$hex = trim($line['hex']); |
275 | - if (!isset($line['id'])) $id = trim($line['hex']); |
|
276 | - else $id = trim($line['id']); |
|
275 | + if (!isset($line['id'])) $id = trim($line['hex']); |
|
276 | + else $id = trim($line['id']); |
|
277 | 277 | |
278 | 278 | if (!isset($this->all_flights[$id])) { |
279 | - if ($globalDebug) echo 'New flight...'."\n"; |
|
280 | - $this->all_flights[$id] = array(); |
|
281 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('addedSpotter' => 0)); |
|
282 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('ident' => '','departure_airport' => '', 'arrival_airport' => '','latitude' => '', 'longitude' => '', 'speed' => '', 'altitude' => '','altitude_real' => '','altitude_previous' => '', 'heading' => '','departure_airport_time' => '','arrival_airport_time' => '','squawk' => '','route_stop' => '','registration' => '','pilot_id' => '','pilot_name' => '','waypoints' => '','ground' => '0', 'format_source' => '','source_name' => '','over_country' => '','verticalrate' => '','noarchive' => false,'putinarchive' => true,'source_type' => '')); |
|
283 | - if (isset($globalDaemon) && $globalDaemon === FALSE) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('lastupdate' => time())); |
|
284 | - if (!isset($line['id'])) { |
|
279 | + if ($globalDebug) echo 'New flight...'."\n"; |
|
280 | + $this->all_flights[$id] = array(); |
|
281 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('addedSpotter' => 0)); |
|
282 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('ident' => '','departure_airport' => '', 'arrival_airport' => '','latitude' => '', 'longitude' => '', 'speed' => '', 'altitude' => '','altitude_real' => '','altitude_previous' => '', 'heading' => '','departure_airport_time' => '','arrival_airport_time' => '','squawk' => '','route_stop' => '','registration' => '','pilot_id' => '','pilot_name' => '','waypoints' => '','ground' => '0', 'format_source' => '','source_name' => '','over_country' => '','verticalrate' => '','noarchive' => false,'putinarchive' => true,'source_type' => '')); |
|
283 | + if (isset($globalDaemon) && $globalDaemon === FALSE) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('lastupdate' => time())); |
|
284 | + if (!isset($line['id'])) { |
|
285 | 285 | if (!isset($globalDaemon)) $globalDaemon = TRUE; |
286 | 286 | // if (isset($line['format_source']) && ($line['format_source'] == 'sbs' || $line['format_source'] == 'tsv' || $line['format_source'] == 'raw') && $globalDaemon) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident'].'-'.date('YmdGi'))); |
287 | 287 | // if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw' || $line['format_source'] === 'deltadbtxt' || $line['format_source'] === 'planeupdatefaa' || $line['format_source'] === 'aprs') && $globalDaemon) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.date('YmdHi'))); |
288 | 288 | if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'aircraftjson' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw' || $line['format_source'] === 'deltadbtxt' || $line['format_source'] === 'planeupdatefaa' || $line['format_source'] === 'aprs' || $line['format_source'] === 'aircraftlistjson' || $line['format_source'] === 'radarvirtueljson' || $line['format_source'] === 'famaprs')) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $id.'-'.date('YmdHi'))); |
289 | - //else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident'])); |
|
290 | - } else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $line['id'])); |
|
291 | - if ($globalAllFlights !== FALSE) $dataFound = true; |
|
289 | + //else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident'])); |
|
290 | + } else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $line['id'])); |
|
291 | + if ($globalAllFlights !== FALSE) $dataFound = true; |
|
292 | 292 | } |
293 | 293 | if (isset($line['source_type']) && $line['source_type'] != '') { |
294 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('source_type' => $line['source_type'])); |
|
294 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('source_type' => $line['source_type'])); |
|
295 | 295 | } |
296 | 296 | |
297 | 297 | //print_r($this->all_flights); |
298 | 298 | if (isset($line['hex']) && !isset($this->all_flights[$id]['hex']) && ctype_xdigit($line['hex'])) { |
299 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('hex' => trim($line['hex']))); |
|
300 | - //if (isset($line['datetime']) && preg_match('/^(\d{4}(?:\-\d{2}){2} \d{2}(?:\:\d{2}){2})$/',$line['datetime'])) { |
|
299 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('hex' => trim($line['hex']))); |
|
300 | + //if (isset($line['datetime']) && preg_match('/^(\d{4}(?:\-\d{2}){2} \d{2}(?:\:\d{2}){2})$/',$line['datetime'])) { |
|
301 | 301 | //$this->all_flights[$id] = array_merge($this->all_flights[$id],array('datetime' => $line['datetime'])); |
302 | - //} else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('datetime' => date('Y-m-d H:i:s'))); |
|
303 | - if (!isset($line['aircraft_name']) && (!isset($line['aircraft_icao']) || $line['aircraft_icao'] == '????') && $line['format_source'] != 'whazzup' && $line['format_source'] != 'vatsimtxt' && $line['format_source'] != 'pireps' && $line['format_source'] != 'phpvmacars' && $line['format_source'] != 'vam' && $line['format_source'] != 'flightgearsp' && $line['format_source'] != 'flightgearmp') { |
|
302 | + //} else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('datetime' => date('Y-m-d H:i:s'))); |
|
303 | + if (!isset($line['aircraft_name']) && (!isset($line['aircraft_icao']) || $line['aircraft_icao'] == '????') && $line['format_source'] != 'whazzup' && $line['format_source'] != 'vatsimtxt' && $line['format_source'] != 'pireps' && $line['format_source'] != 'phpvmacars' && $line['format_source'] != 'vam' && $line['format_source'] != 'flightgearsp' && $line['format_source'] != 'flightgearmp') { |
|
304 | 304 | $timeelapsed = microtime(true); |
305 | 305 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
306 | - $Spotter = new Spotter($this->db); |
|
307 | - if (isset($this->all_flights[$id]['source_type'])) { |
|
306 | + $Spotter = new Spotter($this->db); |
|
307 | + if (isset($this->all_flights[$id]['source_type'])) { |
|
308 | 308 | $aircraft_icao = $Spotter->getAllAircraftType(trim($line['hex']),$this->all_flights[$id]['source_type']); |
309 | - } else { |
|
309 | + } else { |
|
310 | 310 | $aircraft_icao = $Spotter->getAllAircraftType(trim($line['hex'])); |
311 | - } |
|
312 | - $Spotter->db = null; |
|
313 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update getallaircrattype : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
314 | - if ($aircraft_icao != '') $this->all_flights[$id] = array_merge($this->all_flights[$id],array('aircraft_icao' => $aircraft_icao)); |
|
311 | + } |
|
312 | + $Spotter->db = null; |
|
313 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update getallaircrattype : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
314 | + if ($aircraft_icao != '') $this->all_flights[$id] = array_merge($this->all_flights[$id],array('aircraft_icao' => $aircraft_icao)); |
|
315 | 315 | } |
316 | - } |
|
317 | - if ($globalAllFlights !== FALSE) $dataFound = true; |
|
318 | - if ($globalDebug) echo "*********** New aircraft hex : ".$line['hex']." ***********\n"; |
|
316 | + } |
|
317 | + if ($globalAllFlights !== FALSE) $dataFound = true; |
|
318 | + if ($globalDebug) echo "*********** New aircraft hex : ".$line['hex']." ***********\n"; |
|
319 | 319 | } |
320 | - if (isset($line['id']) && !isset($line['hex'])) { |
|
321 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('hex' => '')); |
|
322 | - } |
|
320 | + if (isset($line['id']) && !isset($line['hex'])) { |
|
321 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('hex' => '')); |
|
322 | + } |
|
323 | 323 | if (isset($line['aircraft_icao']) && $line['aircraft_icao'] != '') { |
324 | 324 | $icao = $line['aircraft_icao']; |
325 | 325 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
@@ -349,9 +349,9 @@ discard block |
||
349 | 349 | } |
350 | 350 | //if (isset($line['datetime']) && preg_match('/^(\d{4}(?:\-\d{2}){2} \d{2}(?:\:\d{2}){2})$/',$line['datetime'])) { |
351 | 351 | if (isset($line['datetime']) && strtotime($line['datetime']) > time()-20*60 && strtotime($line['datetime']) < time()+20*60) { |
352 | - if (!isset($this->all_flights[$id]['datetime']) || strtotime($line['datetime']) >= strtotime($this->all_flights[$id]['datetime'])) { |
|
352 | + if (!isset($this->all_flights[$id]['datetime']) || strtotime($line['datetime']) >= strtotime($this->all_flights[$id]['datetime'])) { |
|
353 | 353 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('datetime' => $line['datetime'])); |
354 | - } else { |
|
354 | + } else { |
|
355 | 355 | if (strtotime($line['datetime']) == strtotime($this->all_flights[$id]['datetime']) && $globalDebug) echo "!!! Date is the same as previous data for ".$this->all_flights[$id]['hex']." - format : ".$line['format_source']."\n"; |
356 | 356 | elseif (strtotime($line['datetime']) > strtotime($this->all_flights[$id]['datetime']) && $globalDebug) echo "!!! Date previous latest data (".$line['datetime']." > ".$this->all_flights[$id]['datetime'].") !!! for ".$this->all_flights[$id]['hex']." - format : ".$line['format_source']."\n"; |
357 | 357 | /* |
@@ -360,7 +360,7 @@ discard block |
||
360 | 360 | print_r($line); |
361 | 361 | */ |
362 | 362 | return ''; |
363 | - } |
|
363 | + } |
|
364 | 364 | } elseif (isset($line['datetime']) && strtotime($line['datetime']) < time()-20*60) { |
365 | 365 | if ($globalDebug) echo "!!! Date is too old ".$line['datetime']." for ".$this->all_flights[$id]['hex']." - format : ".$line['format_source']."!!!\n"; |
366 | 366 | return ''; |
@@ -376,21 +376,21 @@ discard block |
||
376 | 376 | } |
377 | 377 | |
378 | 378 | if (isset($line['registration']) && $line['registration'] != '' && $line['registration'] != 'z.NO-REG' && $line['registration'] != 'NA') { |
379 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('registration' => $line['registration'])); |
|
379 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('registration' => $line['registration'])); |
|
380 | 380 | } |
381 | 381 | if (isset($line['waypoints']) && $line['waypoints'] != '') { |
382 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('waypoints' => $line['waypoints'])); |
|
382 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('waypoints' => $line['waypoints'])); |
|
383 | 383 | } |
384 | 384 | if (isset($line['pilot_id']) && $line['pilot_id'] != '') { |
385 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('pilot_id' => trim($line['pilot_id']))); |
|
385 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('pilot_id' => trim($line['pilot_id']))); |
|
386 | 386 | } |
387 | 387 | if (isset($line['pilot_name']) && $line['pilot_name'] != '') { |
388 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('pilot_name' => trim($line['pilot_name']))); |
|
388 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('pilot_name' => trim($line['pilot_name']))); |
|
389 | 389 | } |
390 | 390 | |
391 | 391 | if (isset($line['ident']) && trim($line['ident']) != '' && $line['ident'] != '????????' && $line['ident'] != '00000000' && ($this->all_flights[$id]['ident'] != trim($line['ident'])) && preg_match('/^[a-zA-Z0-9]+$/', $line['ident'])) { |
392 | 392 | |
393 | - if ($this->all_flights[$id]['addedSpotter'] == 1) { |
|
393 | + if ($this->all_flights[$id]['addedSpotter'] == 1) { |
|
394 | 394 | if ($globalVA !== TRUE && $globalIVAO !== TRUE && $globalVATSIM !== TRUE && $globalphpVMS !== TRUE && $globalVAM !== TRUE && $this->all_flights[$id]['lastupdate'] < time() - 1600) { |
395 | 395 | if ($globalDebug) echo '---!!!! New ident, reset aircraft data...'."\n"; |
396 | 396 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('addedSpotter' => 0)); |
@@ -399,23 +399,23 @@ discard block |
||
399 | 399 | elseif (isset($line['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $line['id'])); |
400 | 400 | elseif (isset($this->all_flights[$id]['ident'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident'])); |
401 | 401 | } else { |
402 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('ident' => trim($line['ident']))); |
|
403 | - if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
|
402 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('ident' => trim($line['ident']))); |
|
403 | + if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
|
404 | 404 | $timeelapsed = microtime(true); |
405 | - $Spotter = new Spotter($this->db); |
|
406 | - $fromsource = NULL; |
|
407 | - if (isset($globalAirlinesSource) && $globalAirlinesSource != '') $fromsource = $globalAirlinesSource; |
|
408 | - elseif (isset($line['format_source']) && $line['format_source'] == 'vatsimtxt') $fromsource = 'vatsim'; |
|
405 | + $Spotter = new Spotter($this->db); |
|
406 | + $fromsource = NULL; |
|
407 | + if (isset($globalAirlinesSource) && $globalAirlinesSource != '') $fromsource = $globalAirlinesSource; |
|
408 | + elseif (isset($line['format_source']) && $line['format_source'] == 'vatsimtxt') $fromsource = 'vatsim'; |
|
409 | 409 | elseif (isset($line['format_source']) && $line['format_source'] == 'whazzup') $fromsource = 'ivao'; |
410 | 410 | elseif (isset($globalVATSIM) && $globalVATSIM) $fromsource = 'vatsim'; |
411 | 411 | elseif (isset($globalIVAO) && $globalIVAO) $fromsource = 'ivao'; |
412 | - $result = $Spotter->updateIdentSpotterData($this->all_flights[$id]['id'],$this->all_flights[$id]['ident'],$fromsource); |
|
412 | + $result = $Spotter->updateIdentSpotterData($this->all_flights[$id]['id'],$this->all_flights[$id]['ident'],$fromsource); |
|
413 | 413 | if ($globalDebug && $result != 'success') echo '!!! ERROR : '.$result."\n"; |
414 | 414 | $Spotter->db = null; |
415 | 415 | if ($globalDebugTimeElapsed) echo 'Time elapsed for update identspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
416 | - } |
|
416 | + } |
|
417 | 417 | } |
418 | - } else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('ident' => trim($line['ident']))); |
|
418 | + } else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('ident' => trim($line['ident']))); |
|
419 | 419 | |
420 | 420 | /* |
421 | 421 | if (!isset($line['id'])) { |
@@ -425,63 +425,63 @@ discard block |
||
425 | 425 | else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident'])); |
426 | 426 | } else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $line['id'])); |
427 | 427 | */ |
428 | - if (!isset($this->all_flights[$id]['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident'])); |
|
428 | + if (!isset($this->all_flights[$id]['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident'])); |
|
429 | 429 | |
430 | - //$putinarchive = true; |
|
431 | - if (isset($line['departure_airport_time']) && $line['departure_airport_time'] != 0) { |
|
430 | + //$putinarchive = true; |
|
431 | + if (isset($line['departure_airport_time']) && $line['departure_airport_time'] != 0) { |
|
432 | 432 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('departure_airport_time' => $line['departure_airport_time'])); |
433 | - } |
|
434 | - if (isset($line['arrival_airport_time']) && $line['arrival_airport_time'] != 0) { |
|
433 | + } |
|
434 | + if (isset($line['arrival_airport_time']) && $line['arrival_airport_time'] != 0) { |
|
435 | 435 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('arrival_airport_time' => $line['arrival_airport_time'])); |
436 | - } |
|
437 | - if (isset($line['departure_airport_icao']) && isset($line['arrival_airport_icao'])) { |
|
438 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('departure_airport' => $line['departure_airport_icao'],'arrival_airport' => $line['arrival_airport_icao'],'route_stop' => '')); |
|
439 | - } elseif (isset($line['departure_airport_iata']) && isset($line['arrival_airport_iata'])) { |
|
436 | + } |
|
437 | + if (isset($line['departure_airport_icao']) && isset($line['arrival_airport_icao'])) { |
|
438 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('departure_airport' => $line['departure_airport_icao'],'arrival_airport' => $line['arrival_airport_icao'],'route_stop' => '')); |
|
439 | + } elseif (isset($line['departure_airport_iata']) && isset($line['arrival_airport_iata'])) { |
|
440 | 440 | $timeelapsed = microtime(true); |
441 | 441 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
442 | 442 | $Spotter = new Spotter($this->db); |
443 | 443 | $line['departure_airport_icao'] = $Spotter->getAirportIcao($line['departure_airport_iata']); |
444 | 444 | $line['arrival_airport_icao'] = $Spotter->getAirportIcao($line['arrival_airport_iata']); |
445 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('departure_airport' => $line['departure_airport_icao'],'arrival_airport' => $line['arrival_airport_icao'],'route_stop' => '')); |
|
445 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('departure_airport' => $line['departure_airport_icao'],'arrival_airport' => $line['arrival_airport_icao'],'route_stop' => '')); |
|
446 | 446 | if ($globalDebugTimeElapsed) echo 'Time elapsed for update getAirportICAO : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
447 | - } |
|
448 | - } elseif (!isset($line['format_source']) || $line['format_source'] != 'aprs') { |
|
447 | + } |
|
448 | + } elseif (!isset($line['format_source']) || $line['format_source'] != 'aprs') { |
|
449 | 449 | $timeelapsed = microtime(true); |
450 | 450 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
451 | - $Spotter = new Spotter($this->db); |
|
452 | - $route = $Spotter->getRouteInfo(trim($line['ident'])); |
|
453 | - if (!isset($route['fromairport_icao']) && !isset($route['toairport_icao'])) { |
|
451 | + $Spotter = new Spotter($this->db); |
|
452 | + $route = $Spotter->getRouteInfo(trim($line['ident'])); |
|
453 | + if (!isset($route['fromairport_icao']) && !isset($route['toairport_icao'])) { |
|
454 | 454 | $Translation = new Translation($this->db); |
455 | 455 | $ident = $Translation->checkTranslation(trim($line['ident'])); |
456 | 456 | $route = $Spotter->getRouteInfo($ident); |
457 | 457 | $Translation->db = null; |
458 | - } |
|
459 | - $Spotter->db = null; |
|
460 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update getrouteinfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
461 | - } |
|
458 | + } |
|
459 | + $Spotter->db = null; |
|
460 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update getrouteinfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
461 | + } |
|
462 | 462 | if (isset($route['fromairport_icao']) && isset($route['toairport_icao'])) { |
463 | - //if ($route['FromAirport_ICAO'] != $route['ToAirport_ICAO']) { |
|
464 | - if ($route['fromairport_icao'] != $route['toairport_icao']) { |
|
463 | + //if ($route['FromAirport_ICAO'] != $route['ToAirport_ICAO']) { |
|
464 | + if ($route['fromairport_icao'] != $route['toairport_icao']) { |
|
465 | 465 | // $this->all_flights[$id] = array_merge($this->all_flights[$id],array('departure_airport' => $route['FromAirport_ICAO'],'arrival_airport' => $route['ToAirport_ICAO'],'route_stop' => $route['RouteStop'])); |
466 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('departure_airport' => $route['fromairport_icao'],'arrival_airport' => $route['toairport_icao'],'route_stop' => $route['routestop'])); |
|
467 | - } |
|
466 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('departure_airport' => $route['fromairport_icao'],'arrival_airport' => $route['toairport_icao'],'route_stop' => $route['routestop'])); |
|
467 | + } |
|
468 | 468 | } |
469 | 469 | if (!isset($globalFork)) $globalFork = TRUE; |
470 | 470 | if (!$globalVA && !$globalIVAO && !$globalVATSIM && !$globalphpVMS && !$globalVAM && (!isset($line['format_source']) || $line['format_source'] != 'aprs')) { |
471 | 471 | if (!isset($this->all_flights[$id]['schedule_check']) || $this->all_flights[$id]['schedule_check'] === false) $this->get_Schedule($id,trim($line['ident'])); |
472 | 472 | } |
473 | - } |
|
473 | + } |
|
474 | 474 | } |
475 | 475 | |
476 | 476 | if (isset($line['speed']) && $line['speed'] != '' && $line['speed'] != 0) { |
477 | 477 | // $this->all_flights[$id] = array_merge($this->all_flights[$id],array('speed' => $line[12])); |
478 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('speed' => round($line['speed']))); |
|
479 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('speed_fromsrc' => true)); |
|
480 | - //$dataFound = true; |
|
478 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('speed' => round($line['speed']))); |
|
479 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('speed_fromsrc' => true)); |
|
480 | + //$dataFound = true; |
|
481 | 481 | } else if (!isset($this->all_flights[$id]['speed_fromsrc']) && isset($this->all_flights[$id]['time_last_coord']) && $this->all_flights[$id]['time_last_coord'] != time() && isset($line['latitude']) && isset($line['longitude'])) { |
482 | - $distance = $Common->distance($line['latitude'],$line['longitude'],$this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],'m'); |
|
483 | - if ($distance > 1000 && $distance < 10000) { |
|
484 | - // use datetime |
|
482 | + $distance = $Common->distance($line['latitude'],$line['longitude'],$this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],'m'); |
|
483 | + if ($distance > 1000 && $distance < 10000) { |
|
484 | + // use datetime |
|
485 | 485 | $speed = $distance/(time() - $this->all_flights[$id]['time_last_coord']); |
486 | 486 | $speed = $speed*3.6; |
487 | 487 | if ($speed < 1000) { |
@@ -490,49 +490,49 @@ discard block |
||
490 | 490 | } else { |
491 | 491 | if ($globalDebug) echo "ø IGNORED : Calculated Speed for ".$this->all_flights[$id]['hex']." : ".round($speed)." - distance : ".$distance."\n"; |
492 | 492 | } |
493 | - } |
|
493 | + } |
|
494 | 494 | } |
495 | 495 | |
496 | 496 | |
497 | 497 | |
498 | - if (isset($line['latitude']) && isset($line['longitude']) && $line['latitude'] != '' && $line['longitude'] != '' && is_numeric($line['latitude']) && is_numeric($line['longitude'])) { |
|
499 | - if (ctype_digit(strval($line['latitude'])) || ctype_digit(strval($line['longitude']))) { |
|
500 | - if ($globalDebug) echo "/!\ Invalid latitude or/and longitude data : lat: ".$line['latitude']." - lng: ".$line['longitude']."\n"; |
|
501 | - return false; |
|
502 | - } |
|
503 | - if (isset($this->all_flights[$id]['time_last_coord'])) $timediff = round(time()-$this->all_flights[$id]['time_last_coord']); |
|
504 | - else unset($timediff); |
|
505 | - if (isset($this->all_flights[$id]['time_last_archive_coord'])) $timediff_archive = round(time()-$this->all_flights[$id]['time_last_archive_coord']); |
|
506 | - else unset($timediff_archive); |
|
507 | - if ($this->tmd > 5 |
|
508 | - || (isset($line['format_source']) |
|
509 | - && $line['format_source'] == 'airwhere' |
|
510 | - && ((!isset($this->all_flights[$id]['latitude']) |
|
511 | - || !isset($this->all_flights[$id]['longitude'])) |
|
512 | - || (isset($this->all_flights[$id]['latitude']) |
|
513 | - && isset($this->all_flights[$id]['longitude']) |
|
514 | - && $this->all_flights[$id]['latitude'] != $line['latitude'] |
|
515 | - && $this->all_flights[$id]['longitude'] != $line['longitude'] |
|
516 | - ) |
|
517 | - ) |
|
518 | - ) |
|
519 | - || (isset($globalVA) && $globalVA) |
|
520 | - || (isset($globalIVAO) && $globalIVAO) |
|
521 | - || (isset($globalVATSIM) && $globalVATSIM) |
|
522 | - || (isset($globalphpVMS) && $globalphpVMS) |
|
523 | - || (isset($globalVAM) && $globalVAM) |
|
524 | - || !isset($timediff) |
|
525 | - || $timediff > $globalLiveInterval |
|
526 | - || $globalArchive |
|
527 | - || ($timediff > 30 |
|
528 | - && isset($this->all_flights[$id]['latitude']) |
|
529 | - && isset($this->all_flights[$id]['longitude']) |
|
530 | - && $Common->withinThreshold($timediff,$Common->distance($line['latitude'],$line['longitude'],$this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],'m')) |
|
531 | - ) |
|
532 | - ) { |
|
498 | + if (isset($line['latitude']) && isset($line['longitude']) && $line['latitude'] != '' && $line['longitude'] != '' && is_numeric($line['latitude']) && is_numeric($line['longitude'])) { |
|
499 | + if (ctype_digit(strval($line['latitude'])) || ctype_digit(strval($line['longitude']))) { |
|
500 | + if ($globalDebug) echo "/!\ Invalid latitude or/and longitude data : lat: ".$line['latitude']." - lng: ".$line['longitude']."\n"; |
|
501 | + return false; |
|
502 | + } |
|
503 | + if (isset($this->all_flights[$id]['time_last_coord'])) $timediff = round(time()-$this->all_flights[$id]['time_last_coord']); |
|
504 | + else unset($timediff); |
|
505 | + if (isset($this->all_flights[$id]['time_last_archive_coord'])) $timediff_archive = round(time()-$this->all_flights[$id]['time_last_archive_coord']); |
|
506 | + else unset($timediff_archive); |
|
507 | + if ($this->tmd > 5 |
|
508 | + || (isset($line['format_source']) |
|
509 | + && $line['format_source'] == 'airwhere' |
|
510 | + && ((!isset($this->all_flights[$id]['latitude']) |
|
511 | + || !isset($this->all_flights[$id]['longitude'])) |
|
512 | + || (isset($this->all_flights[$id]['latitude']) |
|
513 | + && isset($this->all_flights[$id]['longitude']) |
|
514 | + && $this->all_flights[$id]['latitude'] != $line['latitude'] |
|
515 | + && $this->all_flights[$id]['longitude'] != $line['longitude'] |
|
516 | + ) |
|
517 | + ) |
|
518 | + ) |
|
519 | + || (isset($globalVA) && $globalVA) |
|
520 | + || (isset($globalIVAO) && $globalIVAO) |
|
521 | + || (isset($globalVATSIM) && $globalVATSIM) |
|
522 | + || (isset($globalphpVMS) && $globalphpVMS) |
|
523 | + || (isset($globalVAM) && $globalVAM) |
|
524 | + || !isset($timediff) |
|
525 | + || $timediff > $globalLiveInterval |
|
526 | + || $globalArchive |
|
527 | + || ($timediff > 30 |
|
528 | + && isset($this->all_flights[$id]['latitude']) |
|
529 | + && isset($this->all_flights[$id]['longitude']) |
|
530 | + && $Common->withinThreshold($timediff,$Common->distance($line['latitude'],$line['longitude'],$this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],'m')) |
|
531 | + ) |
|
532 | + ) { |
|
533 | 533 | |
534 | 534 | if ((isset($timediff) && !isset($timediff_archive)) || (isset($this->all_flights[$id]['archive_latitude']) && isset($this->all_flights[$id]['archive_longitude']) && isset($this->all_flights[$id]['livedb_latitude']) && isset($this->all_flights[$id]['livedb_longitude']))) { |
535 | - if ((isset($timediff_archive) && $timediff_archive > $globalAircraftMaxUpdate) |
|
535 | + if ((isset($timediff_archive) && $timediff_archive > $globalAircraftMaxUpdate) |
|
536 | 536 | || (isset($line['format_source']) && $line['format_source'] == 'airwhere') |
537 | 537 | || !$Common->checkLine($this->all_flights[$id]['archive_latitude'],$this->all_flights[$id]['archive_longitude'],$this->all_flights[$id]['livedb_latitude'],$this->all_flights[$id]['livedb_longitude'],$line['latitude'],$line['longitude'])) { |
538 | 538 | $this->all_flights[$id]['archive_latitude'] = $line['latitude']; |
@@ -540,9 +540,9 @@ discard block |
||
540 | 540 | $this->all_flights[$id]['putinarchive'] = true; |
541 | 541 | $this->tmd = 0; |
542 | 542 | if (!isset($globalNoImport) || $globalNoImport === FALSE) { |
543 | - if ($globalDebug) echo "\n".' ------- Check Country for '.$this->all_flights[$id]['ident'].' with latitude : '.$line['latitude'].' and longitude : '.$line['longitude'].'.... '; |
|
544 | - $timeelapsed = microtime(true); |
|
545 | - if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
|
543 | + if ($globalDebug) echo "\n".' ------- Check Country for '.$this->all_flights[$id]['ident'].' with latitude : '.$line['latitude'].' and longitude : '.$line['longitude'].'.... '; |
|
544 | + $timeelapsed = microtime(true); |
|
545 | + if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
|
546 | 546 | $Spotter = new Spotter($this->db); |
547 | 547 | $all_country = $Spotter->getCountryFromLatitudeLongitude($line['latitude'],$line['longitude']); |
548 | 548 | if (!empty($all_country)) $this->all_flights[$id]['over_country'] = $all_country['iso2']; |
@@ -550,11 +550,11 @@ discard block |
||
550 | 550 | $Spotter->db = null; |
551 | 551 | if ($globalDebugTimeElapsed) echo 'Time elapsed for update getCountryFromlatitudeLongitude : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
552 | 552 | if ($globalDebug) echo 'FOUND : '.$this->all_flights[$id]['over_country'].' ---------------'."\n"; |
553 | - } |
|
553 | + } |
|
554 | 554 | } |
555 | 555 | $this->all_flights[$id]['time_last_archive_coord'] = time(); |
556 | - } |
|
557 | - /* |
|
556 | + } |
|
557 | + /* |
|
558 | 558 | else { |
559 | 559 | if (!isset($timediff)) echo 'NO TIMEDIFF'; |
560 | 560 | else { |
@@ -568,16 +568,16 @@ discard block |
||
568 | 568 | } |
569 | 569 | |
570 | 570 | if (isset($line['latitude']) && $line['latitude'] != '' && $line['latitude'] != 0 && $line['latitude'] < 91 && $line['latitude'] > -90) { |
571 | - //if (!isset($this->all_flights[$id]['latitude']) || $this->all_flights[$id]['latitude'] == '' || abs($this->all_flights[$id]['latitude']-$line['latitude']) < 3 || $line['format_source'] != 'sbs' || time() - $this->all_flights[$id]['lastupdate'] > 30) { |
|
571 | + //if (!isset($this->all_flights[$id]['latitude']) || $this->all_flights[$id]['latitude'] == '' || abs($this->all_flights[$id]['latitude']-$line['latitude']) < 3 || $line['format_source'] != 'sbs' || time() - $this->all_flights[$id]['lastupdate'] > 30) { |
|
572 | 572 | if (!isset($this->all_flights[$id]['archive_latitude'])) { |
573 | 573 | $this->all_flights[$id]['archive_latitude'] = $line['latitude']; |
574 | 574 | $this->all_flights[$id]['time_last_coord'] = time(); |
575 | 575 | } |
576 | 576 | //if (!isset($this->all_flights[$id]['livedb_latitude']) || abs($this->all_flights[$id]['livedb_latitude']-$line['latitude']) > $globalCoordMinChange || $this->all_flights[$id]['format_source'] == 'aprs' || ($this->all_flights[$id]['format_source'] == 'airwhere' && abs($this->all_flights[$id]['livedb_latitude']-$line['latitude']) > 0.0001)) { |
577 | 577 | if (!isset($this->all_flights[$id]['livedb_latitude']) || abs($this->all_flights[$id]['livedb_latitude']-$line['latitude']) > $globalCoordMinChange || ($this->all_flights[$id]['format_source'] == 'airwhere' && abs($this->all_flights[$id]['livedb_latitude']-$line['latitude']) > 0.0001)) { |
578 | - $this->all_flights[$id]['livedb_latitude'] = $line['latitude']; |
|
579 | - $dataFound = true; |
|
580 | - $this->all_flights[$id]['time_last_coord'] = time(); |
|
578 | + $this->all_flights[$id]['livedb_latitude'] = $line['latitude']; |
|
579 | + $dataFound = true; |
|
580 | + $this->all_flights[$id]['time_last_coord'] = time(); |
|
581 | 581 | } |
582 | 582 | // elseif ($globalDebug) echo '!*!*! Ignore data, too close to previous one'."\n"; |
583 | 583 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('latitude' => $line['latitude'])); |
@@ -588,24 +588,24 @@ discard block |
||
588 | 588 | //$putinarchive = true; |
589 | 589 | } |
590 | 590 | */ |
591 | - /* |
|
591 | + /* |
|
592 | 592 | } elseif (isset($this->all_flights[$id]['latitude'])) { |
593 | 593 | if ($globalDebug) echo '!!! Strange latitude value - diff : '.abs($this->all_flights[$id]['latitude']-$line['latitude']).'- previous lat : '.$this->all_flights[$id]['latitude'].'- new lat : '.$line['latitude']."\n"; |
594 | 594 | } |
595 | 595 | */ |
596 | 596 | } |
597 | 597 | if (isset($line['longitude']) && $line['longitude'] != '' && $line['longitude'] != 0 && $line['longitude'] < 360 && $line['longitude'] > -180) { |
598 | - if ($line['longitude'] > 180) $line['longitude'] = $line['longitude'] - 360; |
|
599 | - //if (!isset($this->all_flights[$id]['longitude']) || $this->all_flights[$id]['longitude'] == '' || abs($this->all_flights[$id]['longitude']-$line['longitude']) < 2 || $line['format_source'] != 'sbs' || time() - $this->all_flights[$id]['lastupdate'] > 30) { |
|
598 | + if ($line['longitude'] > 180) $line['longitude'] = $line['longitude'] - 360; |
|
599 | + //if (!isset($this->all_flights[$id]['longitude']) || $this->all_flights[$id]['longitude'] == '' || abs($this->all_flights[$id]['longitude']-$line['longitude']) < 2 || $line['format_source'] != 'sbs' || time() - $this->all_flights[$id]['lastupdate'] > 30) { |
|
600 | 600 | if (!isset($this->all_flights[$id]['archive_longitude'])) { |
601 | 601 | $this->all_flights[$id]['archive_longitude'] = $line['longitude']; |
602 | 602 | $this->all_flights[$id]['time_last_coord'] = time(); |
603 | 603 | } |
604 | 604 | //if (!isset($this->all_flights[$id]['livedb_longitude']) || abs($this->all_flights[$id]['livedb_longitude']-$line['longitude']) > $globalCoordMinChange || $this->all_flights[$id]['format_source'] == 'aprs' || ($this->all_flights[$id]['format_source'] == 'airwhere' && abs($this->all_flights[$id]['livedb_longitude']-$line['longitude']) > 0.0001)) { |
605 | 605 | if (!isset($this->all_flights[$id]['livedb_longitude']) || abs($this->all_flights[$id]['livedb_longitude']-$line['longitude']) > $globalCoordMinChange || ($this->all_flights[$id]['format_source'] == 'airwhere' && abs($this->all_flights[$id]['livedb_longitude']-$line['longitude']) > 0.0001)) { |
606 | - $this->all_flights[$id]['livedb_longitude'] = $line['longitude']; |
|
607 | - $dataFound = true; |
|
608 | - $this->all_flights[$id]['time_last_coord'] = time(); |
|
606 | + $this->all_flights[$id]['livedb_longitude'] = $line['longitude']; |
|
607 | + $dataFound = true; |
|
608 | + $this->all_flights[$id]['time_last_coord'] = time(); |
|
609 | 609 | } |
610 | 610 | // elseif ($globalDebug) echo '!*!*! Ignore data, too close to previous one'."\n"; |
611 | 611 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('longitude' => $line['longitude'])); |
@@ -623,67 +623,67 @@ discard block |
||
623 | 623 | */ |
624 | 624 | } |
625 | 625 | |
626 | - } else if ($globalDebug && $timediff > 30) { |
|
626 | + } else if ($globalDebug && $timediff > 30) { |
|
627 | 627 | $this->tmd = $this->tmd + 1; |
628 | 628 | echo '!!! Too much distance in short time... for '.$this->all_flights[$id]['ident']."\n"; |
629 | 629 | echo 'Time : '.$timediff.'s - Distance : '.$Common->distance($line['latitude'],$line['longitude'],$this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],'m')."m -"; |
630 | 630 | echo 'Speed : '.(($Common->distance($line['latitude'],$line['longitude'],$this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],'m')/$timediff)*3.6)." km/h - "; |
631 | 631 | echo 'Lat : '.$line['latitude'].' - long : '.$line['longitude'].' - prev lat : '.$this->all_flights[$id]['latitude'].' - prev long : '.$this->all_flights[$id]['longitude']." \n"; |
632 | - } |
|
632 | + } |
|
633 | 633 | } |
634 | 634 | if (isset($line['last_update']) && $line['last_update'] != '') { |
635 | - if (isset($this->all_flights[$id]['last_update']) && $this->all_flights[$id]['last_update'] != $line['last_update']) $dataFound = true; |
|
636 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('last_update' => $line['last_update'])); |
|
635 | + if (isset($this->all_flights[$id]['last_update']) && $this->all_flights[$id]['last_update'] != $line['last_update']) $dataFound = true; |
|
636 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('last_update' => $line['last_update'])); |
|
637 | 637 | } |
638 | 638 | if (isset($line['verticalrate']) && $line['verticalrate'] != '') { |
639 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('verticalrate' => $line['verticalrate'])); |
|
640 | - //$dataFound = true; |
|
639 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('verticalrate' => $line['verticalrate'])); |
|
640 | + //$dataFound = true; |
|
641 | 641 | } |
642 | 642 | if (isset($line['format_source']) && $line['format_source'] != '') { |
643 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('format_source' => $line['format_source'])); |
|
643 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('format_source' => $line['format_source'])); |
|
644 | 644 | } |
645 | 645 | if (isset($line['source_name']) && $line['source_name'] != '') { |
646 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('source_name' => $line['source_name'])); |
|
646 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('source_name' => $line['source_name'])); |
|
647 | 647 | } |
648 | 648 | if (isset($line['emergency']) && $line['emergency'] != '') { |
649 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('emergency' => $line['emergency'])); |
|
650 | - //$dataFound = true; |
|
649 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('emergency' => $line['emergency'])); |
|
650 | + //$dataFound = true; |
|
651 | 651 | } |
652 | 652 | if (isset($line['ground']) && $line['ground'] != '') { |
653 | - if (isset($this->all_flights[$id]['ground']) && $this->all_flights[$id]['ground'] == 1 && $line['ground'] == 0) { |
|
653 | + if (isset($this->all_flights[$id]['ground']) && $this->all_flights[$id]['ground'] == 1 && $line['ground'] == 0) { |
|
654 | 654 | // Here we force archive of flight because after ground it's a new one (or should be) |
655 | 655 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('addedSpotter' => 0)); |
656 | 656 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('forcenew' => 1)); |
657 | 657 | if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'aircraftjson' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw' || $line['format_source'] === 'deltadbtxt' || $line['format_source'] === 'planeupdatefaa' || $line['format_source'] === 'aprs' || $line['format_source'] === 'aircraftlistjson' || $line['format_source'] === 'radarvirtueljson' || $line['format_source'] === 'famaprs')) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $id.'-'.date('YmdHi'))); |
658 | - elseif (isset($line['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $line['id'])); |
|
658 | + elseif (isset($line['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $line['id'])); |
|
659 | 659 | elseif (isset($this->all_flights[$id]['ident'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident'])); |
660 | - } |
|
661 | - if ($line['ground'] != 1) $line['ground'] = 0; |
|
662 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('ground' => $line['ground'])); |
|
663 | - //$dataFound = true; |
|
660 | + } |
|
661 | + if ($line['ground'] != 1) $line['ground'] = 0; |
|
662 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('ground' => $line['ground'])); |
|
663 | + //$dataFound = true; |
|
664 | 664 | } |
665 | 665 | if (isset($line['squawk']) && $line['squawk'] != '') { |
666 | - if (isset($this->all_flights[$id]['squawk']) && $this->all_flights[$id]['squawk'] != '7500' && $this->all_flights[$id]['squawk'] != '7600' && $this->all_flights[$id]['squawk'] != '7700' && isset($this->all_flights[$id]['id'])) { |
|
667 | - if ($this->all_flights[$id]['squawk'] != $line['squawk']) $this->all_flights[$id]['putinarchive'] = true; |
|
668 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('squawk' => $line['squawk'])); |
|
669 | - $highlight = ''; |
|
670 | - if ($this->all_flights[$id]['squawk'] == '7500') $highlight = 'Squawk 7500 : Hijack at '.date('Y-m-d G:i').' UTC'; |
|
671 | - if ($this->all_flights[$id]['squawk'] == '7600') $highlight = 'Squawk 7600 : Lost Comm (radio failure) at '.date('Y-m-d G:i').' UTC'; |
|
672 | - if ($this->all_flights[$id]['squawk'] == '7700') $highlight = 'Squawk 7700 : Emergency at '.date('Y-m-d G:i').' UTC'; |
|
673 | - if ($highlight != '') { |
|
666 | + if (isset($this->all_flights[$id]['squawk']) && $this->all_flights[$id]['squawk'] != '7500' && $this->all_flights[$id]['squawk'] != '7600' && $this->all_flights[$id]['squawk'] != '7700' && isset($this->all_flights[$id]['id'])) { |
|
667 | + if ($this->all_flights[$id]['squawk'] != $line['squawk']) $this->all_flights[$id]['putinarchive'] = true; |
|
668 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('squawk' => $line['squawk'])); |
|
669 | + $highlight = ''; |
|
670 | + if ($this->all_flights[$id]['squawk'] == '7500') $highlight = 'Squawk 7500 : Hijack at '.date('Y-m-d G:i').' UTC'; |
|
671 | + if ($this->all_flights[$id]['squawk'] == '7600') $highlight = 'Squawk 7600 : Lost Comm (radio failure) at '.date('Y-m-d G:i').' UTC'; |
|
672 | + if ($this->all_flights[$id]['squawk'] == '7700') $highlight = 'Squawk 7700 : Emergency at '.date('Y-m-d G:i').' UTC'; |
|
673 | + if ($highlight != '') { |
|
674 | 674 | $timeelapsed = microtime(true); |
675 | 675 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
676 | - $Spotter = new Spotter($this->db); |
|
677 | - $Spotter->setHighlightFlight($this->all_flights[$id]['id'],$highlight); |
|
678 | - $Spotter->db = null; |
|
679 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update sethighlightflight : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
676 | + $Spotter = new Spotter($this->db); |
|
677 | + $Spotter->setHighlightFlight($this->all_flights[$id]['id'],$highlight); |
|
678 | + $Spotter->db = null; |
|
679 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update sethighlightflight : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
680 | 680 | } |
681 | 681 | //$putinarchive = true; |
682 | 682 | //$highlight = ''; |
683 | - } |
|
683 | + } |
|
684 | 684 | |
685 | - } else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('squawk' => $line['squawk'])); |
|
686 | - //$dataFound = true; |
|
685 | + } else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('squawk' => $line['squawk'])); |
|
686 | + //$dataFound = true; |
|
687 | 687 | } |
688 | 688 | |
689 | 689 | if (isset($line['altitude']) && $line['altitude'] != '') { |
@@ -694,13 +694,13 @@ discard block |
||
694 | 694 | $line['altitude'] = $line['altitude'] - $geoid; |
695 | 695 | } |
696 | 696 | } |
697 | - //if (!isset($this->all_flights[$id]['altitude']) || $this->all_flights[$id]['altitude'] == '' || ($this->all_flights[$id]['altitude'] > 0 && $line['altitude'] != 0)) { |
|
697 | + //if (!isset($this->all_flights[$id]['altitude']) || $this->all_flights[$id]['altitude'] == '' || ($this->all_flights[$id]['altitude'] > 0 && $line['altitude'] != 0)) { |
|
698 | 698 | if (is_int($this->all_flights[$id]['altitude']) && abs(round($line['altitude']/100)-$this->all_flights[$id]['altitude']) > 3) $this->all_flights[$id]['putinarchive'] = true; |
699 | 699 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('altitude' => round($line['altitude']/100))); |
700 | 700 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('altitude_real' => $line['altitude'])); |
701 | 701 | //$dataFound = true; |
702 | - //} elseif ($globalDebug) echo "!!! Strange altitude data... not added.\n"; |
|
703 | - if ($globalVA !== TRUE && $globalIVAO !== TRUE && $globalVATSIM !== TRUE && $globalphpVMS !== TRUE && $globalVAM !== TRUE) { |
|
702 | + //} elseif ($globalDebug) echo "!!! Strange altitude data... not added.\n"; |
|
703 | + if ($globalVA !== TRUE && $globalIVAO !== TRUE && $globalVATSIM !== TRUE && $globalphpVMS !== TRUE && $globalVAM !== TRUE) { |
|
704 | 704 | if (isset($this->all_flights[$id]['over_country']) && $this->all_flights[$id]['over_country'] != '' && isset($this->all_flights[$id]['altitude_previous']) && $this->all_flights[$id]['altitude_previous'] != '' && $this->all_flights[$id]['altitude_previous'] < $this->all_flights[$id]['altitude_real'] && isset($this->all_flights[$id]['lastupdate']) && $this->all_flights[$id]['lastupdate'] < time() - 1600) { |
705 | 705 | if ($globalDebug) echo '--- Reset because of altitude'."\n"; |
706 | 706 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('addedSpotter' => 0)); |
@@ -709,27 +709,27 @@ discard block |
||
709 | 709 | elseif (isset($line['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $line['id'])); |
710 | 710 | elseif (isset($this->all_flights[$id]['ident'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident'])); |
711 | 711 | } |
712 | - } |
|
713 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('altitude_previous' => $line['altitude'])); |
|
712 | + } |
|
713 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('altitude_previous' => $line['altitude'])); |
|
714 | 714 | } |
715 | 715 | |
716 | 716 | if (isset($line['noarchive']) && $line['noarchive'] === true) { |
717 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('noarchive' => true)); |
|
717 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('noarchive' => true)); |
|
718 | 718 | } |
719 | 719 | |
720 | 720 | if (isset($line['heading']) && $line['heading'] != '') { |
721 | - if (is_int($this->all_flights[$id]['heading']) && abs($this->all_flights[$id]['heading']-round($line['heading'])) > 10) $this->all_flights[$id]['putinarchive'] = true; |
|
722 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('heading' => round($line['heading']))); |
|
723 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('heading_fromsrc' => true)); |
|
724 | - //$dataFound = true; |
|
721 | + if (is_int($this->all_flights[$id]['heading']) && abs($this->all_flights[$id]['heading']-round($line['heading'])) > 10) $this->all_flights[$id]['putinarchive'] = true; |
|
722 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('heading' => round($line['heading']))); |
|
723 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('heading_fromsrc' => true)); |
|
724 | + //$dataFound = true; |
|
725 | 725 | } elseif (!isset($this->all_flights[$id]['heading_fromsrc']) && isset($this->all_flights[$id]['archive_latitude']) && $this->all_flights[$id]['archive_latitude'] != $this->all_flights[$id]['latitude'] && isset($this->all_flights[$id]['archive_longitude']) && $this->all_flights[$id]['archive_longitude'] != $this->all_flights[$id]['longitude']) { |
726 | - $heading = $Common->getHeading($this->all_flights[$id]['archive_latitude'],$this->all_flights[$id]['archive_longitude'],$this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude']); |
|
727 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('heading' => round($heading))); |
|
728 | - if (abs($this->all_flights[$id]['heading']-round($heading)) > 10) $this->all_flights[$id]['putinarchive'] = true; |
|
729 | - if ($globalDebug) echo "ø Calculated Heading for ".$this->all_flights[$id]['hex']." : ".$heading."\n"; |
|
726 | + $heading = $Common->getHeading($this->all_flights[$id]['archive_latitude'],$this->all_flights[$id]['archive_longitude'],$this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude']); |
|
727 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('heading' => round($heading))); |
|
728 | + if (abs($this->all_flights[$id]['heading']-round($heading)) > 10) $this->all_flights[$id]['putinarchive'] = true; |
|
729 | + if ($globalDebug) echo "ø Calculated Heading for ".$this->all_flights[$id]['hex']." : ".$heading."\n"; |
|
730 | 730 | } elseif (isset($this->all_flights[$id]['format_source']) && $this->all_flights[$id]['format_source'] == 'ACARS') { |
731 | - // If not enough messages and ACARS set heading to 0 |
|
732 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('heading' => 0)); |
|
731 | + // If not enough messages and ACARS set heading to 0 |
|
732 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('heading' => 0)); |
|
733 | 733 | } |
734 | 734 | if ($globalDaemon === TRUE && isset($globalSourcesupdate) && $globalSourcesupdate != '' && isset($this->all_flights[$id]['lastupdate']) && time()-$this->all_flights[$id]['lastupdate'] < $globalSourcesupdate) $dataFound = false; |
735 | 735 | elseif ($globalDaemon === TRUE && isset($globalSBS1update) && $globalSBS1update != '' && isset($this->all_flights[$id]['lastupdate']) && time()-$this->all_flights[$id]['lastupdate'] < $globalSBS1update) $dataFound = false; |
@@ -742,125 +742,125 @@ discard block |
||
742 | 742 | //if ($dataFound === true && isset($this->all_flights[$id]['hex']) && $this->all_flights[$id]['heading'] != '' && $this->all_flights[$id]['latitude'] != '' && $this->all_flights[$id]['longitude'] != '') { |
743 | 743 | //if ($dataFound === true && isset($this->all_flights[$id]['hex'])) { |
744 | 744 | if ($dataFound === true && isset($this->all_flights[$id]['id'])) { |
745 | - $this->all_flights[$id]['lastupdate'] = time(); |
|
746 | - if ((!isset($globalNoImport) || $globalNoImport === FALSE) && $this->all_flights[$id]['addedSpotter'] == 0) { |
|
747 | - if (!isset($globalDistanceIgnore['latitude']) || $this->all_flights[$id]['longitude'] == '' || $this->all_flights[$id]['latitude'] == '' || (isset($globalDistanceIgnore['latitude']) && $Common->distance($this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude']) < $globalDistanceIgnore['distance'])) { |
|
748 | - //print_r($this->all_flights); |
|
749 | - //echo $this->all_flights[$id]['id'].' - '.$this->all_flights[$id]['addedSpotter']."\n"; |
|
750 | - //$last_hour_ident = Spotter->getIdentFromLastHour($this->all_flights[$id]['ident']); |
|
751 | - if (!isset($this->all_flights[$id]['forcenew']) || $this->all_flights[$id]['forcenew'] == 0) { |
|
745 | + $this->all_flights[$id]['lastupdate'] = time(); |
|
746 | + if ((!isset($globalNoImport) || $globalNoImport === FALSE) && $this->all_flights[$id]['addedSpotter'] == 0) { |
|
747 | + if (!isset($globalDistanceIgnore['latitude']) || $this->all_flights[$id]['longitude'] == '' || $this->all_flights[$id]['latitude'] == '' || (isset($globalDistanceIgnore['latitude']) && $Common->distance($this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude']) < $globalDistanceIgnore['distance'])) { |
|
748 | + //print_r($this->all_flights); |
|
749 | + //echo $this->all_flights[$id]['id'].' - '.$this->all_flights[$id]['addedSpotter']."\n"; |
|
750 | + //$last_hour_ident = Spotter->getIdentFromLastHour($this->all_flights[$id]['ident']); |
|
751 | + if (!isset($this->all_flights[$id]['forcenew']) || $this->all_flights[$id]['forcenew'] == 0) { |
|
752 | 752 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
753 | - if ($globalDebug) echo "Check if aircraft is already in DB..."; |
|
754 | - $timeelapsed = microtime(true); |
|
755 | - $SpotterLive = new SpotterLive($this->db); |
|
756 | - if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'aircraftjson' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw' || $line['format_source'] === 'deltadbtxt' || $line['format_source'] === 'planeupdatefaa' || $line['format_source'] === 'aprs' || $line['format_source'] === 'aircraftlistjson' || $line['format_source'] === 'radarvirtueljson' || $line['format_source'] === 'famaprs')) { |
|
753 | + if ($globalDebug) echo "Check if aircraft is already in DB..."; |
|
754 | + $timeelapsed = microtime(true); |
|
755 | + $SpotterLive = new SpotterLive($this->db); |
|
756 | + if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'aircraftjson' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw' || $line['format_source'] === 'deltadbtxt' || $line['format_source'] === 'planeupdatefaa' || $line['format_source'] === 'aprs' || $line['format_source'] === 'aircraftlistjson' || $line['format_source'] === 'radarvirtueljson' || $line['format_source'] === 'famaprs')) { |
|
757 | 757 | $recent_ident = $SpotterLive->checkModeSRecent($this->all_flights[$id]['hex']); |
758 | 758 | if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkModeSRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
759 | - } elseif (isset($line['id'])) { |
|
759 | + } elseif (isset($line['id'])) { |
|
760 | 760 | $recent_ident = $SpotterLive->checkIdRecent($line['id']); |
761 | 761 | if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
762 | - } elseif (isset($this->all_flights[$id]['ident']) && $this->all_flights[$id]['ident'] != '') { |
|
762 | + } elseif (isset($this->all_flights[$id]['ident']) && $this->all_flights[$id]['ident'] != '') { |
|
763 | 763 | $recent_ident = $SpotterLive->checkIdentRecent($this->all_flights[$id]['ident']); |
764 | 764 | if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdentRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
765 | - } else $recent_ident = ''; |
|
766 | - $SpotterLive->db=null; |
|
767 | - if ($globalDebug && $recent_ident == '') echo " Not in DB.\n"; |
|
768 | - elseif ($globalDebug && $recent_ident != '') echo " Already in DB.\n"; |
|
765 | + } else $recent_ident = ''; |
|
766 | + $SpotterLive->db=null; |
|
767 | + if ($globalDebug && $recent_ident == '') echo " Not in DB.\n"; |
|
768 | + elseif ($globalDebug && $recent_ident != '') echo " Already in DB.\n"; |
|
769 | 769 | } else $recent_ident = ''; |
770 | - } else { |
|
770 | + } else { |
|
771 | 771 | $recent_ident = ''; |
772 | 772 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('forcenew' => 0)); |
773 | - } |
|
774 | - //if there was no aircraft with the same callsign within the last hour and go post it into the archive |
|
775 | - if($recent_ident == "") |
|
776 | - { |
|
773 | + } |
|
774 | + //if there was no aircraft with the same callsign within the last hour and go post it into the archive |
|
775 | + if($recent_ident == "") |
|
776 | + { |
|
777 | 777 | if ($globalDebug) echo "\o/ Add ".$this->all_flights[$id]['ident']." in archive DB : "; |
778 | 778 | if ($this->all_flights[$id]['departure_airport'] == "") { $this->all_flights[$id]['departure_airport'] = "NA"; } |
779 | 779 | if ($this->all_flights[$id]['arrival_airport'] == "") { $this->all_flights[$id]['arrival_airport'] = "NA"; } |
780 | 780 | //adds the spotter data for the archive |
781 | 781 | $ignoreImport = false; |
782 | 782 | foreach($globalAirportIgnore as $airportIgnore) { |
783 | - if (($this->all_flights[$id]['departure_airport'] == $airportIgnore) || ($this->all_flights[$id]['arrival_airport'] == $airportIgnore)) { |
|
783 | + if (($this->all_flights[$id]['departure_airport'] == $airportIgnore) || ($this->all_flights[$id]['arrival_airport'] == $airportIgnore)) { |
|
784 | 784 | $ignoreImport = true; |
785 | - } |
|
785 | + } |
|
786 | 786 | } |
787 | 787 | if (count($globalAirportAccept) > 0) { |
788 | - $ignoreImport = true; |
|
789 | - foreach($globalAirportIgnore as $airportIgnore) { |
|
788 | + $ignoreImport = true; |
|
789 | + foreach($globalAirportIgnore as $airportIgnore) { |
|
790 | 790 | if (($this->all_flights[$id]['departure_airport'] == $airportIgnore) || ($this->all_flights[$id]['arrival_airport'] == $airportIgnore)) { |
791 | - $ignoreImport = false; |
|
791 | + $ignoreImport = false; |
|
792 | + } |
|
792 | 793 | } |
793 | - } |
|
794 | 794 | } |
795 | 795 | if (isset($globalAirlineIgnore) && is_array($globalAirlineIgnore)) { |
796 | - foreach($globalAirlineIgnore as $airlineIgnore) { |
|
796 | + foreach($globalAirlineIgnore as $airlineIgnore) { |
|
797 | 797 | if ((is_numeric(substr(substr($this->all_flights[$id]['ident'],0,4),-1,1)) && substr($this->all_flights[$id]['ident'],0,3) == $airlineIgnore) || (is_numeric(substr(substr($this->all_flights[$id]['ident'],0,3),-1,1)) && substr($this->all_flights[$id]['ident'],0,2) == $airlineIgnore)) { |
798 | - $ignoreImport = true; |
|
798 | + $ignoreImport = true; |
|
799 | + } |
|
799 | 800 | } |
800 | - } |
|
801 | 801 | } |
802 | 802 | if (isset($globalAirlineAccept) && count($globalAirlineAccept) > 0) { |
803 | - $ignoreImport = true; |
|
804 | - foreach($globalAirlineAccept as $airlineAccept) { |
|
803 | + $ignoreImport = true; |
|
804 | + foreach($globalAirlineAccept as $airlineAccept) { |
|
805 | 805 | if ((is_numeric(substr(substr($this->all_flights[$id]['ident'],0,4),-1,1)) && substr($this->all_flights[$id]['ident'],0,3) == $airlineAccept) || (is_numeric(substr(substr($this->all_flights[$id]['ident'],0,3),-1,1)) && substr($this->all_flights[$id]['ident'],0,2) == $airlineAccept)) { |
806 | - $ignoreImport = false; |
|
806 | + $ignoreImport = false; |
|
807 | + } |
|
807 | 808 | } |
808 | - } |
|
809 | 809 | } |
810 | 810 | if (isset($globalPilotIdAccept) && count($globalPilotIdAccept) > 0) { |
811 | - $ignoreImport = true; |
|
812 | - foreach($globalPilotIdAccept as $pilotIdAccept) { |
|
811 | + $ignoreImport = true; |
|
812 | + foreach($globalPilotIdAccept as $pilotIdAccept) { |
|
813 | 813 | if ($this->all_flights[$id]['pilot_id'] == $pilotIdAccept) { |
814 | - $ignoreImport = false; |
|
814 | + $ignoreImport = false; |
|
815 | + } |
|
815 | 816 | } |
816 | - } |
|
817 | 817 | } |
818 | 818 | |
819 | 819 | if (!$ignoreImport) { |
820 | - $highlight = ''; |
|
821 | - if ($this->all_flights[$id]['squawk'] == '7500') $highlight = 'Squawk 7500 : Hijack'; |
|
822 | - if ($this->all_flights[$id]['squawk'] == '7600') $highlight = 'Squawk 7600 : Lost Comm (radio failure)'; |
|
823 | - if ($this->all_flights[$id]['squawk'] == '7700') $highlight = 'Squawk 7700 : Emergency'; |
|
824 | - if (!isset($this->all_flights[$id]['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.date('YmdHi'))); |
|
825 | - $timeelapsed = microtime(true); |
|
826 | - if (!isset($globalNoImport) || $globalNoImport === FALSE) { |
|
820 | + $highlight = ''; |
|
821 | + if ($this->all_flights[$id]['squawk'] == '7500') $highlight = 'Squawk 7500 : Hijack'; |
|
822 | + if ($this->all_flights[$id]['squawk'] == '7600') $highlight = 'Squawk 7600 : Lost Comm (radio failure)'; |
|
823 | + if ($this->all_flights[$id]['squawk'] == '7700') $highlight = 'Squawk 7700 : Emergency'; |
|
824 | + if (!isset($this->all_flights[$id]['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.date('YmdHi'))); |
|
825 | + $timeelapsed = microtime(true); |
|
826 | + if (!isset($globalNoImport) || $globalNoImport === FALSE) { |
|
827 | 827 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
828 | - $Spotter = new Spotter($this->db); |
|
829 | - $result = $Spotter->addSpotterData($this->all_flights[$id]['id'], $this->all_flights[$id]['ident'], $this->all_flights[$id]['aircraft_icao'], $this->all_flights[$id]['departure_airport'], $this->all_flights[$id]['arrival_airport'], $this->all_flights[$id]['latitude'], $this->all_flights[$id]['longitude'], $this->all_flights[$id]['waypoints'], $this->all_flights[$id]['altitude'],$this->all_flights[$id]['altitude_real'], $this->all_flights[$id]['heading'], $this->all_flights[$id]['speed'], $this->all_flights[$id]['datetime'], $this->all_flights[$id]['departure_airport_time'], $this->all_flights[$id]['arrival_airport_time'],$this->all_flights[$id]['squawk'],$this->all_flights[$id]['route_stop'],$highlight,$this->all_flights[$id]['hex'],$this->all_flights[$id]['registration'],$this->all_flights[$id]['pilot_id'],$this->all_flights[$id]['pilot_name'],$this->all_flights[$id]['verticalrate'],$this->all_flights[$id]['ground'],$this->all_flights[$id]['format_source'],$this->all_flights[$id]['source_name'],$this->all_flights[$id]['source_type']); |
|
830 | - $Spotter->db = null; |
|
831 | - if ($globalDebug && isset($result)) echo $result."\n"; |
|
828 | + $Spotter = new Spotter($this->db); |
|
829 | + $result = $Spotter->addSpotterData($this->all_flights[$id]['id'], $this->all_flights[$id]['ident'], $this->all_flights[$id]['aircraft_icao'], $this->all_flights[$id]['departure_airport'], $this->all_flights[$id]['arrival_airport'], $this->all_flights[$id]['latitude'], $this->all_flights[$id]['longitude'], $this->all_flights[$id]['waypoints'], $this->all_flights[$id]['altitude'],$this->all_flights[$id]['altitude_real'], $this->all_flights[$id]['heading'], $this->all_flights[$id]['speed'], $this->all_flights[$id]['datetime'], $this->all_flights[$id]['departure_airport_time'], $this->all_flights[$id]['arrival_airport_time'],$this->all_flights[$id]['squawk'],$this->all_flights[$id]['route_stop'],$highlight,$this->all_flights[$id]['hex'],$this->all_flights[$id]['registration'],$this->all_flights[$id]['pilot_id'],$this->all_flights[$id]['pilot_name'],$this->all_flights[$id]['verticalrate'],$this->all_flights[$id]['ground'],$this->all_flights[$id]['format_source'],$this->all_flights[$id]['source_name'],$this->all_flights[$id]['source_type']); |
|
830 | + $Spotter->db = null; |
|
831 | + if ($globalDebug && isset($result)) echo $result."\n"; |
|
832 | 832 | } |
833 | - } |
|
834 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update addspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
835 | - if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
|
833 | + } |
|
834 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update addspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
835 | + if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
|
836 | 836 | |
837 | - // Add source stat in DB |
|
838 | - $Stats = new Stats($this->db); |
|
839 | - if (!empty($this->stats)) { |
|
837 | + // Add source stat in DB |
|
838 | + $Stats = new Stats($this->db); |
|
839 | + if (!empty($this->stats)) { |
|
840 | 840 | if ($globalDebug) echo 'Add source stats : '; |
841 | - foreach($this->stats as $date => $data) { |
|
842 | - foreach($data as $source => $sourced) { |
|
843 | - //print_r($sourced); |
|
844 | - if (isset($sourced['polar'])) echo $Stats->addStatSource(json_encode($sourced['polar']),$source,'polar',$date); |
|
845 | - if (isset($sourced['hist'])) echo $Stats->addStatSource(json_encode($sourced['hist']),$source,'hist',$date); |
|
846 | - if (isset($sourced['msg'])) { |
|
847 | - if (time() - $sourced['msg']['date'] > 10) { |
|
848 | - $nbmsg = round($sourced['msg']['nb']/(time() - $sourced['msg']['date'])); |
|
849 | - echo $Stats->addStatSource($nbmsg,$source,'msg',$date); |
|
850 | - unset($this->stats[$date][$source]['msg']); |
|
851 | - } |
|
852 | - } |
|
853 | - } |
|
854 | - if ($date != date('Y-m-d')) { |
|
855 | - unset($this->stats[$date]); |
|
856 | - } |
|
857 | - } |
|
858 | - if ($globalDebug) echo 'Done'."\n"; |
|
841 | + foreach($this->stats as $date => $data) { |
|
842 | + foreach($data as $source => $sourced) { |
|
843 | + //print_r($sourced); |
|
844 | + if (isset($sourced['polar'])) echo $Stats->addStatSource(json_encode($sourced['polar']),$source,'polar',$date); |
|
845 | + if (isset($sourced['hist'])) echo $Stats->addStatSource(json_encode($sourced['hist']),$source,'hist',$date); |
|
846 | + if (isset($sourced['msg'])) { |
|
847 | + if (time() - $sourced['msg']['date'] > 10) { |
|
848 | + $nbmsg = round($sourced['msg']['nb']/(time() - $sourced['msg']['date'])); |
|
849 | + echo $Stats->addStatSource($nbmsg,$source,'msg',$date); |
|
850 | + unset($this->stats[$date][$source]['msg']); |
|
851 | + } |
|
852 | + } |
|
853 | + } |
|
854 | + if ($date != date('Y-m-d')) { |
|
855 | + unset($this->stats[$date]); |
|
856 | + } |
|
857 | + } |
|
858 | + if ($globalDebug) echo 'Done'."\n"; |
|
859 | 859 | |
860 | - } |
|
861 | - $Stats->db = null; |
|
862 | - } |
|
863 | - $this->del(); |
|
860 | + } |
|
861 | + $Stats->db = null; |
|
862 | + } |
|
863 | + $this->del(); |
|
864 | 864 | } elseif ($globalDebug) echo 'Ignore data'."\n"; |
865 | 865 | //$ignoreImport = false; |
866 | 866 | $this->all_flights[$id]['addedSpotter'] = 1; |
@@ -878,41 +878,41 @@ discard block |
||
878 | 878 | */ |
879 | 879 | //SpotterLive->deleteLiveSpotterDataByIdent($this->all_flights[$id]['ident']); |
880 | 880 | if ($this->last_delete == 0 || time() - $this->last_delete > 1800) { |
881 | - if ($globalDebug) echo "---- Deleting Live Spotter data older than 9 hours..."; |
|
882 | - //SpotterLive->deleteLiveSpotterDataNotUpdated(); |
|
883 | - if (!isset($globalNoImport) || $globalNoImport === FALSE) { |
|
881 | + if ($globalDebug) echo "---- Deleting Live Spotter data older than 9 hours..."; |
|
882 | + //SpotterLive->deleteLiveSpotterDataNotUpdated(); |
|
883 | + if (!isset($globalNoImport) || $globalNoImport === FALSE) { |
|
884 | 884 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
885 | - $SpotterLive = new SpotterLive($this->db); |
|
886 | - $SpotterLive->deleteLiveSpotterData(); |
|
887 | - $SpotterLive->db=null; |
|
885 | + $SpotterLive = new SpotterLive($this->db); |
|
886 | + $SpotterLive->deleteLiveSpotterData(); |
|
887 | + $SpotterLive->db=null; |
|
888 | 888 | } |
889 | - } |
|
890 | - if ($globalDebug) echo " Done\n"; |
|
891 | - $this->last_delete = time(); |
|
889 | + } |
|
890 | + if ($globalDebug) echo " Done\n"; |
|
891 | + $this->last_delete = time(); |
|
892 | 892 | } |
893 | - } else { |
|
893 | + } else { |
|
894 | 894 | if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'aircraftjson' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw' || $line['format_source'] === 'deltadbtxt'|| $line['format_source'] === 'planeupdatefaa' || $line['format_source'] === 'aprs' || $line['format_source'] === 'aircraftlistjson' || $line['format_source'] === 'famaprs' || $line['format_source'] === 'airwhere')) { |
895 | - $this->all_flights[$id]['id'] = $recent_ident; |
|
896 | - $this->all_flights[$id]['addedSpotter'] = 1; |
|
895 | + $this->all_flights[$id]['id'] = $recent_ident; |
|
896 | + $this->all_flights[$id]['addedSpotter'] = 1; |
|
897 | 897 | } |
898 | 898 | if (isset($globalDaemon) && !$globalDaemon) { |
899 | - if (!isset($globalNoImport) || $globalNoImport === FALSE) { |
|
899 | + if (!isset($globalNoImport) || $globalNoImport === FALSE) { |
|
900 | 900 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
901 | - $Spotter = new Spotter($this->db); |
|
902 | - $Spotter->updateLatestSpotterData($this->all_flights[$id]['id'],$this->all_flights[$id]['ident'],$this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],$this->all_flights[$id]['altitude'],$this->all_flights[$id]['altitude_real'],$this->all_flights[$id]['ground'],$this->all_flights[$id]['speed'],$this->all_flights[$id]['datetime'],$this->all_flights[$id]['arrival_airport'],$this->all_flights[$id]['arrival_airport_time']); |
|
903 | - $Spotter->db = null; |
|
901 | + $Spotter = new Spotter($this->db); |
|
902 | + $Spotter->updateLatestSpotterData($this->all_flights[$id]['id'],$this->all_flights[$id]['ident'],$this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],$this->all_flights[$id]['altitude'],$this->all_flights[$id]['altitude_real'],$this->all_flights[$id]['ground'],$this->all_flights[$id]['speed'],$this->all_flights[$id]['datetime'],$this->all_flights[$id]['arrival_airport'],$this->all_flights[$id]['arrival_airport_time']); |
|
903 | + $Spotter->db = null; |
|
904 | + } |
|
904 | 905 | } |
905 | - } |
|
906 | 906 | } |
907 | 907 | |
908 | - } |
|
908 | + } |
|
909 | 909 | } |
910 | - } |
|
911 | - //adds the spotter LIVE data |
|
912 | - //SpotterLive->addLiveSpotterData($flightaware_id, $ident, $aircraft_type, $departure_airport, $arrival_airport, $latitude, $longitude, $waypoints, $altitude, $heading, $groundspeed); |
|
913 | - //echo "\nAdd in Live !! \n"; |
|
914 | - //echo "{$line[8]} {$line[7]} - MODES:{$line[4]} CALLSIGN:{$line[10]} ALT:{$line[11]} VEL:{$line[12]} HDG:{$line[13]} LAT:{$line[14]} LON:{$line[15]} VR:{$line[16]} SQUAWK:{$line[17]}\n"; |
|
915 | - if ($globalDebug) { |
|
910 | + } |
|
911 | + //adds the spotter LIVE data |
|
912 | + //SpotterLive->addLiveSpotterData($flightaware_id, $ident, $aircraft_type, $departure_airport, $arrival_airport, $latitude, $longitude, $waypoints, $altitude, $heading, $groundspeed); |
|
913 | + //echo "\nAdd in Live !! \n"; |
|
914 | + //echo "{$line[8]} {$line[7]} - MODES:{$line[4]} CALLSIGN:{$line[10]} ALT:{$line[11]} VEL:{$line[12]} HDG:{$line[13]} LAT:{$line[14]} LON:{$line[15]} VR:{$line[16]} SQUAWK:{$line[17]}\n"; |
|
915 | + if ($globalDebug) { |
|
916 | 916 | if ((isset($globalVA) && $globalVA) || (isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS) || (isset($globalVAM) && $globalVAM)) { |
917 | 917 | if (isset($this->all_flights[$id]['source_name'])) echo 'DATA : hex : '.$this->all_flights[$id]['hex'].' - ident : '.$this->all_flights[$id]['ident'].' - ICAO : '.$this->all_flights[$id]['aircraft_icao'].' - Departure Airport : '.$this->all_flights[$id]['departure_airport'].' - Arrival Airport : '.$this->all_flights[$id]['arrival_airport'].' - Latitude : '.$this->all_flights[$id]['latitude'].' - Longitude : '.$this->all_flights[$id]['longitude'].' - waypoints : '.$this->all_flights[$id]['waypoints'].' - Altitude : '.$this->all_flights[$id]['altitude'].' - Heading : '.$this->all_flights[$id]['heading'].' - Speed : '.$this->all_flights[$id]['speed'].' - Departure Airport Time : '.$this->all_flights[$id]['departure_airport_time'].' - Arrival Airport time : '.$this->all_flights[$id]['arrival_airport_time'].' - Pilot : '.$this->all_flights[$id]['pilot_name'].' - Source name : '.$this->all_flights[$id]['source_name']."\n"; |
918 | 918 | else echo 'DATA : hex : '.$this->all_flights[$id]['hex'].' - ident : '.$this->all_flights[$id]['ident'].' - ICAO : '.$this->all_flights[$id]['aircraft_icao'].' - Departure Airport : '.$this->all_flights[$id]['departure_airport'].' - Arrival Airport : '.$this->all_flights[$id]['arrival_airport'].' - Latitude : '.$this->all_flights[$id]['latitude'].' - Longitude : '.$this->all_flights[$id]['longitude'].' - waypoints : '.$this->all_flights[$id]['waypoints'].' - Altitude : '.$this->all_flights[$id]['altitude'].' - Heading : '.$this->all_flights[$id]['heading'].' - Speed : '.$this->all_flights[$id]['speed'].' - Departure Airport Time : '.$this->all_flights[$id]['departure_airport_time'].' - Arrival Airport time : '.$this->all_flights[$id]['arrival_airport_time'].' - Pilot : '.$this->all_flights[$id]['pilot_name']."\n"; |
@@ -920,60 +920,60 @@ discard block |
||
920 | 920 | if (isset($this->all_flights[$id]['source_name'])) echo 'DATA : hex : '.$this->all_flights[$id]['hex'].' - ident : '.$this->all_flights[$id]['ident'].' - ICAO : '.$this->all_flights[$id]['aircraft_icao'].' - Departure Airport : '.$this->all_flights[$id]['departure_airport'].' - Arrival Airport : '.$this->all_flights[$id]['arrival_airport'].' - Latitude : '.$this->all_flights[$id]['latitude'].' - Longitude : '.$this->all_flights[$id]['longitude'].' - waypoints : '.$this->all_flights[$id]['waypoints'].' - Altitude : '.$this->all_flights[$id]['altitude'].' - Heading : '.$this->all_flights[$id]['heading'].' - Speed : '.$this->all_flights[$id]['speed'].' - Departure Airport Time : '.$this->all_flights[$id]['departure_airport_time'].' - Arrival Airport time : '.$this->all_flights[$id]['arrival_airport_time'].' - Source Name : '.$this->all_flights[$id]['source_name']."\n"; |
921 | 921 | else echo 'DATA : hex : '.$this->all_flights[$id]['hex'].' - ident : '.$this->all_flights[$id]['ident'].' - ICAO : '.$this->all_flights[$id]['aircraft_icao'].' - Departure Airport : '.$this->all_flights[$id]['departure_airport'].' - Arrival Airport : '.$this->all_flights[$id]['arrival_airport'].' - Latitude : '.$this->all_flights[$id]['latitude'].' - Longitude : '.$this->all_flights[$id]['longitude'].' - waypoints : '.$this->all_flights[$id]['waypoints'].' - Altitude : '.$this->all_flights[$id]['altitude'].' - Heading : '.$this->all_flights[$id]['heading'].' - Speed : '.$this->all_flights[$id]['speed'].' - Departure Airport Time : '.$this->all_flights[$id]['departure_airport_time'].' - Arrival Airport time : '.$this->all_flights[$id]['arrival_airport_time']."\n"; |
922 | 922 | } |
923 | - } |
|
924 | - $ignoreImport = false; |
|
925 | - if ($this->all_flights[$id]['departure_airport'] == "") { $this->all_flights[$id]['departure_airport'] = "NA"; } |
|
926 | - if ($this->all_flights[$id]['arrival_airport'] == "") { $this->all_flights[$id]['arrival_airport'] = "NA"; } |
|
923 | + } |
|
924 | + $ignoreImport = false; |
|
925 | + if ($this->all_flights[$id]['departure_airport'] == "") { $this->all_flights[$id]['departure_airport'] = "NA"; } |
|
926 | + if ($this->all_flights[$id]['arrival_airport'] == "") { $this->all_flights[$id]['arrival_airport'] = "NA"; } |
|
927 | 927 | |
928 | - foreach($globalAirportIgnore as $airportIgnore) { |
|
929 | - if (($this->all_flights[$id]['departure_airport'] == $airportIgnore) || ($this->all_flights[$id]['arrival_airport'] == $airportIgnore)) { |
|
930 | - $ignoreImport = true; |
|
928 | + foreach($globalAirportIgnore as $airportIgnore) { |
|
929 | + if (($this->all_flights[$id]['departure_airport'] == $airportIgnore) || ($this->all_flights[$id]['arrival_airport'] == $airportIgnore)) { |
|
930 | + $ignoreImport = true; |
|
931 | + } |
|
931 | 932 | } |
932 | - } |
|
933 | - if (count($globalAirportAccept) > 0) { |
|
934 | - $ignoreImport = true; |
|
935 | - foreach($globalAirportIgnore as $airportIgnore) { |
|
936 | - if (($this->all_flights[$id]['departure_airport'] == $airportIgnore) || ($this->all_flights[$id]['arrival_airport'] == $airportIgnore)) { |
|
933 | + if (count($globalAirportAccept) > 0) { |
|
934 | + $ignoreImport = true; |
|
935 | + foreach($globalAirportIgnore as $airportIgnore) { |
|
936 | + if (($this->all_flights[$id]['departure_airport'] == $airportIgnore) || ($this->all_flights[$id]['arrival_airport'] == $airportIgnore)) { |
|
937 | 937 | $ignoreImport = false; |
938 | - } |
|
938 | + } |
|
939 | 939 | } |
940 | - } |
|
941 | - if (isset($globalAirlineIgnore) && is_array($globalAirlineIgnore)) { |
|
940 | + } |
|
941 | + if (isset($globalAirlineIgnore) && is_array($globalAirlineIgnore)) { |
|
942 | 942 | foreach($globalAirlineIgnore as $airlineIgnore) { |
943 | - if ((is_numeric(substr(substr($this->all_flights[$id]['ident'],0,4),-1,1)) && substr($this->all_flights[$id]['ident'],0,3) == $airlineIgnore) || (is_numeric(substr(substr($this->all_flights[$id]['ident'],0,3),-1,1)) && substr($this->all_flights[$id]['ident'],0,2) == $airlineIgnore)) { |
|
943 | + if ((is_numeric(substr(substr($this->all_flights[$id]['ident'],0,4),-1,1)) && substr($this->all_flights[$id]['ident'],0,3) == $airlineIgnore) || (is_numeric(substr(substr($this->all_flights[$id]['ident'],0,3),-1,1)) && substr($this->all_flights[$id]['ident'],0,2) == $airlineIgnore)) { |
|
944 | 944 | $ignoreImport = true; |
945 | - } |
|
945 | + } |
|
946 | 946 | } |
947 | - } |
|
948 | - if (isset($globalAirlineAccept) && count($globalAirlineAccept) > 0) { |
|
947 | + } |
|
948 | + if (isset($globalAirlineAccept) && count($globalAirlineAccept) > 0) { |
|
949 | 949 | $ignoreImport = true; |
950 | 950 | foreach($globalAirlineAccept as $airlineAccept) { |
951 | - if ((is_numeric(substr(substr($this->all_flights[$id]['ident'],0,4),-1,1)) && substr($this->all_flights[$id]['ident'],0,3) == $airlineAccept) || (is_numeric(substr(substr($this->all_flights[$id]['ident'],0,3),-1,1)) && substr($this->all_flights[$id]['ident'],0,2) == $airlineAccept)) { |
|
951 | + if ((is_numeric(substr(substr($this->all_flights[$id]['ident'],0,4),-1,1)) && substr($this->all_flights[$id]['ident'],0,3) == $airlineAccept) || (is_numeric(substr(substr($this->all_flights[$id]['ident'],0,3),-1,1)) && substr($this->all_flights[$id]['ident'],0,2) == $airlineAccept)) { |
|
952 | 952 | $ignoreImport = false; |
953 | - } |
|
953 | + } |
|
954 | + } |
|
954 | 955 | } |
955 | - } |
|
956 | - if (isset($globalPilotIdAccept) && count($globalPilotIdAccept) > 0) { |
|
956 | + if (isset($globalPilotIdAccept) && count($globalPilotIdAccept) > 0) { |
|
957 | 957 | $ignoreImport = true; |
958 | 958 | foreach($globalPilotIdAccept as $pilotIdAccept) { |
959 | - if ($this->all_flights[$id]['pilot_id'] == $pilotIdAccept) { |
|
960 | - $ignoreImport = false; |
|
961 | - } |
|
959 | + if ($this->all_flights[$id]['pilot_id'] == $pilotIdAccept) { |
|
960 | + $ignoreImport = false; |
|
961 | + } |
|
962 | + } |
|
962 | 963 | } |
963 | - } |
|
964 | 964 | |
965 | - if (!$ignoreImport) { |
|
965 | + if (!$ignoreImport) { |
|
966 | 966 | if (!isset($globalDistanceIgnore['latitude']) || (isset($globalDistanceIgnore['latitude']) && $Common->distance($this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude']) < $globalDistanceIgnore['distance'])) { |
967 | 967 | if (!isset($this->all_flights[$id]['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.date('YmdHi'))); |
968 | 968 | $timeelapsed = microtime(true); |
969 | 969 | if (!isset($globalNoImport) || $globalNoImport === FALSE) { |
970 | - if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
|
970 | + if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
|
971 | 971 | if ($globalDebug) echo "\o/ Add ".$this->all_flights[$id]['ident']." from ".$this->all_flights[$id]['format_source']." in Live DB : "; |
972 | 972 | $SpotterLive = new SpotterLive($this->db); |
973 | 973 | $result = $SpotterLive->addLiveSpotterData($this->all_flights[$id]['id'], $this->all_flights[$id]['ident'], $this->all_flights[$id]['aircraft_icao'], $this->all_flights[$id]['departure_airport'], $this->all_flights[$id]['arrival_airport'], $this->all_flights[$id]['latitude'], $this->all_flights[$id]['longitude'], $this->all_flights[$id]['waypoints'], $this->all_flights[$id]['altitude'],$this->all_flights[$id]['altitude_real'], $this->all_flights[$id]['heading'], $this->all_flights[$id]['speed'],$this->all_flights[$id]['datetime'], $this->all_flights[$id]['departure_airport_time'], $this->all_flights[$id]['arrival_airport_time'], $this->all_flights[$id]['squawk'],$this->all_flights[$id]['route_stop'],$this->all_flights[$id]['hex'],$this->all_flights[$id]['putinarchive'],$this->all_flights[$id]['registration'],$this->all_flights[$id]['pilot_id'],$this->all_flights[$id]['pilot_name'], $this->all_flights[$id]['verticalrate'], $this->all_flights[$id]['noarchive'], $this->all_flights[$id]['ground'],$this->all_flights[$id]['format_source'],$this->all_flights[$id]['source_name'],$this->all_flights[$id]['over_country']); |
974 | 974 | $SpotterLive->db = null; |
975 | 975 | if ($globalDebug) echo $result."\n"; |
976 | - } |
|
976 | + } |
|
977 | 977 | } |
978 | 978 | if (isset($globalServerAPRS) && $globalServerAPRS && $this->all_flights[$id]['putinarchive']) { |
979 | 979 | $APRSSpotter->addLiveSpotterData($this->all_flights[$id]['id'], $this->all_flights[$id]['ident'], $this->all_flights[$id]['aircraft_icao'], $this->all_flights[$id]['departure_airport'], $this->all_flights[$id]['arrival_airport'], $this->all_flights[$id]['latitude'], $this->all_flights[$id]['longitude'], $this->all_flights[$id]['waypoints'], $this->all_flights[$id]['altitude'], $this->all_flights[$id]['altitude_real'], $this->all_flights[$id]['heading'], $this->all_flights[$id]['speed'],$this->all_flights[$id]['datetime'], $this->all_flights[$id]['departure_airport_time'], $this->all_flights[$id]['arrival_airport_time'], $this->all_flights[$id]['squawk'],$this->all_flights[$id]['route_stop'],$this->all_flights[$id]['hex'],$this->all_flights[$id]['putinarchive'],$this->all_flights[$id]['registration'],$this->all_flights[$id]['pilot_id'],$this->all_flights[$id]['pilot_name'], $this->all_flights[$id]['verticalrate'], $this->all_flights[$id]['noarchive'], $this->all_flights[$id]['ground'],$this->all_flights[$id]['format_source'],$this->all_flights[$id]['source_name'],$this->all_flights[$id]['over_country']); |
@@ -985,7 +985,7 @@ discard block |
||
985 | 985 | //if ($line['format_source'] != 'aprs') { |
986 | 986 | //if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw' || $line['format_source'] === 'deltadbtxt')) { |
987 | 987 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
988 | - if (isset($line['sourcestats']) && $line['sourcestats'] == TRUE && $this->all_flights[$id]['latitude'] != '' && $this->all_flights[$id]['longitude'] != '') { |
|
988 | + if (isset($line['sourcestats']) && $line['sourcestats'] == TRUE && $this->all_flights[$id]['latitude'] != '' && $this->all_flights[$id]['longitude'] != '') { |
|
989 | 989 | $source = $this->all_flights[$id]['source_name']; |
990 | 990 | if ($source == '') $source = $this->all_flights[$id]['format_source']; |
991 | 991 | if (!isset($this->source_location[$source])) { |
@@ -1011,7 +1011,7 @@ discard block |
||
1011 | 1011 | if ($stats_heading == 16) $stats_heading = 0; |
1012 | 1012 | if (!isset($this->stats[$current_date][$source]['polar'][1])) { |
1013 | 1013 | for ($i=0;$i<=15;$i++) { |
1014 | - $this->stats[$current_date][$source]['polar'][$i] = 0; |
|
1014 | + $this->stats[$current_date][$source]['polar'][$i] = 0; |
|
1015 | 1015 | } |
1016 | 1016 | $this->stats[$current_date][$source]['polar'][$stats_heading] = $stats_distance; |
1017 | 1017 | } else { |
@@ -1024,17 +1024,17 @@ discard block |
||
1024 | 1024 | //var_dump($this->stats); |
1025 | 1025 | if (!isset($this->stats[$current_date][$source]['hist'][$distance])) { |
1026 | 1026 | if (isset($this->stats[$current_date][$source]['hist'][0])) { |
1027 | - end($this->stats[$current_date][$source]['hist']); |
|
1028 | - $mini = key($this->stats[$current_date][$source]['hist'])+10; |
|
1027 | + end($this->stats[$current_date][$source]['hist']); |
|
1028 | + $mini = key($this->stats[$current_date][$source]['hist'])+10; |
|
1029 | 1029 | } else $mini = 0; |
1030 | 1030 | for ($i=$mini;$i<=$distance;$i+=10) { |
1031 | - $this->stats[$current_date][$source]['hist'][$i] = 0; |
|
1031 | + $this->stats[$current_date][$source]['hist'][$i] = 0; |
|
1032 | 1032 | } |
1033 | 1033 | $this->stats[$current_date][$source]['hist'][$distance] = 1; |
1034 | 1034 | } else { |
1035 | 1035 | $this->stats[$current_date][$source]['hist'][$distance] += 1; |
1036 | 1036 | } |
1037 | - } |
|
1037 | + } |
|
1038 | 1038 | } |
1039 | 1039 | |
1040 | 1040 | $this->all_flights[$id]['lastupdate'] = time(); |
@@ -1044,7 +1044,7 @@ discard block |
||
1044 | 1044 | //$this->del(); |
1045 | 1045 | |
1046 | 1046 | if ($this->last_delete_hourly == 0 || time() - $this->last_delete_hourly > 900) { |
1047 | - if ((!isset($globalNoImport) || $globalNoImport === FALSE) && (!isset($globalNoDB) || $globalNoDB !== TRUE)) { |
|
1047 | + if ((!isset($globalNoImport) || $globalNoImport === FALSE) && (!isset($globalNoDB) || $globalNoDB !== TRUE)) { |
|
1048 | 1048 | if ($globalDebug) echo "---- Deleting Live Spotter data Not updated since 2 hour..."; |
1049 | 1049 | $SpotterLive = new SpotterLive($this->db); |
1050 | 1050 | $SpotterLive->deleteLiveSpotterDataNotUpdated(); |
@@ -1052,19 +1052,19 @@ discard block |
||
1052 | 1052 | //SpotterLive->deleteLiveSpotterData(); |
1053 | 1053 | if ($globalDebug) echo " Done\n"; |
1054 | 1054 | $this->last_delete_hourly = time(); |
1055 | - } else { |
|
1055 | + } else { |
|
1056 | 1056 | $this->del(); |
1057 | 1057 | $this->last_delete_hourly = time(); |
1058 | - } |
|
1058 | + } |
|
1059 | 1059 | } |
1060 | 1060 | |
1061 | - } |
|
1062 | - //$ignoreImport = false; |
|
1061 | + } |
|
1062 | + //$ignoreImport = false; |
|
1063 | 1063 | } |
1064 | 1064 | //if (function_exists('pcntl_fork') && $globalFork) pcntl_signal(SIGCHLD, SIG_IGN); |
1065 | 1065 | if ($send) return $this->all_flights[$id]; |
1066 | - } |
|
1066 | + } |
|
1067 | + } |
|
1067 | 1068 | } |
1068 | - } |
|
1069 | 1069 | } |
1070 | 1070 | ?> |
@@ -34,12 +34,12 @@ discard block |
||
34 | 34 | $currentdate = date('Y-m-d'); |
35 | 35 | $sourcestat = $Stats->getStatsSource($currentdate); |
36 | 36 | if (!empty($sourcestat)) { |
37 | - foreach($sourcestat as $srcst) { |
|
37 | + foreach ($sourcestat as $srcst) { |
|
38 | 38 | $type = $srcst['stats_type']; |
39 | 39 | if ($type == 'polar' || $type == 'hist') { |
40 | 40 | $source = $srcst['source_name']; |
41 | 41 | $data = $srcst['source_data']; |
42 | - $this->stats[$currentdate][$source][$type] = json_decode($data,true); |
|
42 | + $this->stats[$currentdate][$source][$type] = json_decode($data, true); |
|
43 | 43 | } |
44 | 44 | } |
45 | 45 | } |
@@ -51,14 +51,14 @@ discard block |
||
51 | 51 | if (isset($globalGeoid) && $globalGeoid) { |
52 | 52 | try { |
53 | 53 | $GeoidClass = new GeoidHeight(); |
54 | - } catch(Exception $e) { |
|
54 | + } catch (Exception $e) { |
|
55 | 55 | if ($globalDebug) echo "Can't calculate geoid, check that you downloaded it via update_db.php (".$e.")\n"; |
56 | 56 | $GeoidClass = FALSE; |
57 | 57 | } |
58 | 58 | } |
59 | 59 | } |
60 | 60 | |
61 | - public function get_Schedule($id,$ident) { |
|
61 | + public function get_Schedule($id, $ident) { |
|
62 | 62 | global $globalDebug, $globalFork, $globalSchedulesFetch; |
63 | 63 | // Get schedule here, so it's done only one time |
64 | 64 | |
@@ -83,8 +83,8 @@ discard block |
||
83 | 83 | $schedule = $Schedule->fetchSchedule($operator); |
84 | 84 | if (count($schedule) > 0 && isset($schedule['DepartureTime']) && isset($schedule['ArrivalTime'])) { |
85 | 85 | if ($globalDebug) echo "-> Schedule info for ".$operator." (".$ident.")\n"; |
86 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('departure_airport_time' => $schedule['DepartureTime'])); |
|
87 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('arrival_airport_time' => $schedule['ArrivalTime'])); |
|
86 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('departure_airport_time' => $schedule['DepartureTime'])); |
|
87 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('arrival_airport_time' => $schedule['ArrivalTime'])); |
|
88 | 88 | // Should also check if route schedule = route from DB |
89 | 89 | if ($schedule['DepartureAirportIATA'] != '') { |
90 | 90 | if ($this->all_flights[$id]['departure_airport'] != $Spotter->getAirportIcao($schedule['DepartureAirportIATA'])) { |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | } |
105 | 105 | } |
106 | 106 | } |
107 | - $Schedule->addSchedule($operator,$this->all_flights[$id]['departure_airport'],$this->all_flights[$id]['departure_airport_time'],$this->all_flights[$id]['arrival_airport'],$this->all_flights[$id]['arrival_airport_time'],$schedule['Source']); |
|
107 | + $Schedule->addSchedule($operator, $this->all_flights[$id]['departure_airport'], $this->all_flights[$id]['departure_airport_time'], $this->all_flights[$id]['arrival_airport'], $this->all_flights[$id]['arrival_airport_time'], $schedule['Source']); |
|
108 | 108 | } |
109 | 109 | } else $scheduleexist = true; |
110 | 110 | } else $scheduleexist = true; |
@@ -112,8 +112,8 @@ discard block |
||
112 | 112 | if ($scheduleexist) { |
113 | 113 | if ($globalDebug) echo "-> get arrival/departure airport info for ".$ident."\n"; |
114 | 114 | $sch = $Schedule->getSchedule($operator); |
115 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('arrival_airport' => $sch['arrival_airport_icao'],'departure_airport' => $sch['departure_airport_icao'],'departure_airport_time' => $sch['departure_airport_time'],'arrival_airport_time' => $sch['arrival_airport_time'])); |
|
116 | - if ($this->all_flights[$id]['addedSpotter'] == 1) $Spotter->updateLatestScheduleSpotterData($this->all_flights[$id]['id'],$sch['departure_airport_icao'],$sch['departure_airport_time'],$sch['arrival_airport_icao'],$sch['arrival_airport_time']); |
|
115 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('arrival_airport' => $sch['arrival_airport_icao'], 'departure_airport' => $sch['departure_airport_icao'], 'departure_airport_time' => $sch['departure_airport_time'], 'arrival_airport_time' => $sch['arrival_airport_time'])); |
|
116 | + if ($this->all_flights[$id]['addedSpotter'] == 1) $Spotter->updateLatestScheduleSpotterData($this->all_flights[$id]['id'], $sch['departure_airport_icao'], $sch['departure_airport_time'], $sch['arrival_airport_icao'], $sch['arrival_airport_time']); |
|
117 | 117 | } |
118 | 118 | $Spotter->db = null; |
119 | 119 | $Schedule->db = null; |
@@ -140,7 +140,7 @@ discard block |
||
140 | 140 | //echo $this->all_flights[$key]['id'].' - '.$this->all_flights[$key]['latitude'].' '.$this->all_flights[$key]['longitude']."\n"; |
141 | 141 | $Spotter = new Spotter($this->db); |
142 | 142 | $real_arrival = $this->arrival($key); |
143 | - if (isset($this->all_flights[$key]['altitude']) && isset($this->all_flights[$key]['datetime'])) $Spotter->updateLatestSpotterData($this->all_flights[$key]['id'],$this->all_flights[$key]['ident'],$this->all_flights[$key]['latitude'],$this->all_flights[$key]['longitude'],$this->all_flights[$key]['altitude'],$this->all_flights[$key]['ground'],$this->all_flights[$key]['speed'],$this->all_flights[$key]['datetime'],$real_arrival['airport_icao'],$real_arrival['airport_time']); |
|
143 | + if (isset($this->all_flights[$key]['altitude']) && isset($this->all_flights[$key]['datetime'])) $Spotter->updateLatestSpotterData($this->all_flights[$key]['id'], $this->all_flights[$key]['ident'], $this->all_flights[$key]['latitude'], $this->all_flights[$key]['longitude'], $this->all_flights[$key]['altitude'], $this->all_flights[$key]['ground'], $this->all_flights[$key]['speed'], $this->all_flights[$key]['datetime'], $real_arrival['airport_icao'], $real_arrival['airport_time']); |
|
144 | 144 | } |
145 | 145 | } |
146 | 146 | } |
@@ -154,7 +154,7 @@ discard block |
||
154 | 154 | $airport_time = ''; |
155 | 155 | if (!isset($globalClosestMinDist) || $globalClosestMinDist == '') $globalClosestMinDist = 50; |
156 | 156 | if ($this->all_flights[$key]['latitude'] != '' && $this->all_flights[$key]['longitude'] != '') { |
157 | - $closestAirports = $Spotter->closestAirports($this->all_flights[$key]['latitude'],$this->all_flights[$key]['longitude'],$globalClosestMinDist); |
|
157 | + $closestAirports = $Spotter->closestAirports($this->all_flights[$key]['latitude'], $this->all_flights[$key]['longitude'], $globalClosestMinDist); |
|
158 | 158 | if (isset($closestAirports[0])) { |
159 | 159 | if (isset($this->all_flights[$key]['arrival_airport']) && $this->all_flights[$key]['arrival_airport'] == $closestAirports[0]['icao']) { |
160 | 160 | $airport_icao = $closestAirports[0]['icao']; |
@@ -169,7 +169,7 @@ discard block |
||
169 | 169 | break; |
170 | 170 | } |
171 | 171 | } |
172 | - } elseif ($this->all_flights[$key]['altitude'] == 0 || ($this->all_flights[$key]['altitude_real'] != '' && ($closestAirports[0]['altitude'] < $this->all_flights[$key]['altitude_real'] && $this->all_flights[$key]['altitude_real'] < $closestAirports[0]['altitude']+5000))) { |
|
172 | + } elseif ($this->all_flights[$key]['altitude'] == 0 || ($this->all_flights[$key]['altitude_real'] != '' && ($closestAirports[0]['altitude'] < $this->all_flights[$key]['altitude_real'] && $this->all_flights[$key]['altitude_real'] < $closestAirports[0]['altitude'] + 5000))) { |
|
173 | 173 | $airport_icao = $closestAirports[0]['icao']; |
174 | 174 | $airport_time = $this->all_flights[$key]['datetime']; |
175 | 175 | } else { |
@@ -182,7 +182,7 @@ discard block |
||
182 | 182 | } else { |
183 | 183 | if ($globalDebug) echo "---- No latitude or longitude. Ident : ".$this->all_flights[$key]['ident']."\n"; |
184 | 184 | } |
185 | - return array('airport_icao' => $airport_icao,'airport_time' => $airport_time); |
|
185 | + return array('airport_icao' => $airport_icao, 'airport_time' => $airport_time); |
|
186 | 186 | } |
187 | 187 | |
188 | 188 | |
@@ -193,7 +193,7 @@ discard block |
||
193 | 193 | if ($globalDebug) echo 'Delete old values and update latest data...'."\n"; |
194 | 194 | foreach ($this->all_flights as $key => $flight) { |
195 | 195 | if (isset($flight['lastupdate'])) { |
196 | - if ($flight['lastupdate'] < (time()-1800)) { |
|
196 | + if ($flight['lastupdate'] < (time() - 1800)) { |
|
197 | 197 | $this->delKey($key); |
198 | 198 | } |
199 | 199 | } |
@@ -209,7 +209,7 @@ discard block |
||
209 | 209 | $real_arrival = $this->arrival($key); |
210 | 210 | $Spotter = new Spotter($this->db); |
211 | 211 | if ($this->all_flights[$key]['latitude'] != '' && $this->all_flights[$key]['longitude'] != '') { |
212 | - $result = $Spotter->updateLatestSpotterData($this->all_flights[$key]['id'],$this->all_flights[$key]['ident'],$this->all_flights[$key]['latitude'],$this->all_flights[$key]['longitude'],$this->all_flights[$key]['altitude'],$this->all_flights[$key]['ground'],$this->all_flights[$key]['speed'],$this->all_flights[$key]['datetime'],$real_arrival['airport_icao'],$real_arrival['airport_time']); |
|
212 | + $result = $Spotter->updateLatestSpotterData($this->all_flights[$key]['id'], $this->all_flights[$key]['ident'], $this->all_flights[$key]['latitude'], $this->all_flights[$key]['longitude'], $this->all_flights[$key]['altitude'], $this->all_flights[$key]['ground'], $this->all_flights[$key]['speed'], $this->all_flights[$key]['datetime'], $real_arrival['airport_icao'], $real_arrival['airport_time']); |
|
213 | 213 | if ($globalDebug && $result != 'success') echo '!!! ERROR : '.$result."\n"; |
214 | 214 | } |
215 | 215 | } |
@@ -242,10 +242,10 @@ discard block |
||
242 | 242 | $send = false; |
243 | 243 | |
244 | 244 | // SBS format is CSV format |
245 | - if(is_array($line) && (isset($line['hex']) || isset($line['id']))) { |
|
245 | + if (is_array($line) && (isset($line['hex']) || isset($line['id']))) { |
|
246 | 246 | //print_r($line); |
247 | 247 | if (isset($line['hex'])) $line['hex'] = strtoupper($line['hex']); |
248 | - if (isset($line['id']) || (isset($line['hex']) && $line['hex'] != '' && substr($line['hex'],0,1) != '~' && $line['hex'] != '00000' && $line['hex'] != '000000' && $line['hex'] != '111111' && ctype_xdigit($line['hex']) && strlen($line['hex']) === 6)) { |
|
248 | + if (isset($line['id']) || (isset($line['hex']) && $line['hex'] != '' && substr($line['hex'], 0, 1) != '~' && $line['hex'] != '00000' && $line['hex'] != '000000' && $line['hex'] != '111111' && ctype_xdigit($line['hex']) && strlen($line['hex']) === 6)) { |
|
249 | 249 | |
250 | 250 | // Increment message number |
251 | 251 | if (isset($line['sourcestats']) && $line['sourcestats'] === TRUE) { |
@@ -278,25 +278,25 @@ discard block |
||
278 | 278 | if (!isset($this->all_flights[$id])) { |
279 | 279 | if ($globalDebug) echo 'New flight...'."\n"; |
280 | 280 | $this->all_flights[$id] = array(); |
281 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('addedSpotter' => 0)); |
|
282 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('ident' => '','departure_airport' => '', 'arrival_airport' => '','latitude' => '', 'longitude' => '', 'speed' => '', 'altitude' => '','altitude_real' => '','altitude_previous' => '', 'heading' => '','departure_airport_time' => '','arrival_airport_time' => '','squawk' => '','route_stop' => '','registration' => '','pilot_id' => '','pilot_name' => '','waypoints' => '','ground' => '0', 'format_source' => '','source_name' => '','over_country' => '','verticalrate' => '','noarchive' => false,'putinarchive' => true,'source_type' => '')); |
|
283 | - if (isset($globalDaemon) && $globalDaemon === FALSE) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('lastupdate' => time())); |
|
281 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('addedSpotter' => 0)); |
|
282 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('ident' => '', 'departure_airport' => '', 'arrival_airport' => '', 'latitude' => '', 'longitude' => '', 'speed' => '', 'altitude' => '', 'altitude_real' => '', 'altitude_previous' => '', 'heading' => '', 'departure_airport_time' => '', 'arrival_airport_time' => '', 'squawk' => '', 'route_stop' => '', 'registration' => '', 'pilot_id' => '', 'pilot_name' => '', 'waypoints' => '', 'ground' => '0', 'format_source' => '', 'source_name' => '', 'over_country' => '', 'verticalrate' => '', 'noarchive' => false, 'putinarchive' => true, 'source_type' => '')); |
|
283 | + if (isset($globalDaemon) && $globalDaemon === FALSE) $this->all_flights[$id] = array_merge($this->all_flights[$id], array('lastupdate' => time())); |
|
284 | 284 | if (!isset($line['id'])) { |
285 | 285 | if (!isset($globalDaemon)) $globalDaemon = TRUE; |
286 | 286 | // if (isset($line['format_source']) && ($line['format_source'] == 'sbs' || $line['format_source'] == 'tsv' || $line['format_source'] == 'raw') && $globalDaemon) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident'].'-'.date('YmdGi'))); |
287 | 287 | // if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw' || $line['format_source'] === 'deltadbtxt' || $line['format_source'] === 'planeupdatefaa' || $line['format_source'] === 'aprs') && $globalDaemon) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.date('YmdHi'))); |
288 | - if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'aircraftjson' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw' || $line['format_source'] === 'deltadbtxt' || $line['format_source'] === 'planeupdatefaa' || $line['format_source'] === 'aprs' || $line['format_source'] === 'aircraftlistjson' || $line['format_source'] === 'radarvirtueljson' || $line['format_source'] === 'famaprs')) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $id.'-'.date('YmdHi'))); |
|
288 | + if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'aircraftjson' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw' || $line['format_source'] === 'deltadbtxt' || $line['format_source'] === 'planeupdatefaa' || $line['format_source'] === 'aprs' || $line['format_source'] === 'aircraftlistjson' || $line['format_source'] === 'radarvirtueljson' || $line['format_source'] === 'famaprs')) $this->all_flights[$id] = array_merge($this->all_flights[$id], array('id' => $id.'-'.date('YmdHi'))); |
|
289 | 289 | //else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident'])); |
290 | - } else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $line['id'])); |
|
290 | + } else $this->all_flights[$id] = array_merge($this->all_flights[$id], array('id' => $line['id'])); |
|
291 | 291 | if ($globalAllFlights !== FALSE) $dataFound = true; |
292 | 292 | } |
293 | 293 | if (isset($line['source_type']) && $line['source_type'] != '') { |
294 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('source_type' => $line['source_type'])); |
|
294 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('source_type' => $line['source_type'])); |
|
295 | 295 | } |
296 | 296 | |
297 | 297 | //print_r($this->all_flights); |
298 | 298 | if (isset($line['hex']) && !isset($this->all_flights[$id]['hex']) && ctype_xdigit($line['hex'])) { |
299 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('hex' => trim($line['hex']))); |
|
299 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('hex' => trim($line['hex']))); |
|
300 | 300 | //if (isset($line['datetime']) && preg_match('/^(\d{4}(?:\-\d{2}){2} \d{2}(?:\:\d{2}){2})$/',$line['datetime'])) { |
301 | 301 | //$this->all_flights[$id] = array_merge($this->all_flights[$id],array('datetime' => $line['datetime'])); |
302 | 302 | //} else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('datetime' => date('Y-m-d H:i:s'))); |
@@ -305,20 +305,20 @@ discard block |
||
305 | 305 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
306 | 306 | $Spotter = new Spotter($this->db); |
307 | 307 | if (isset($this->all_flights[$id]['source_type'])) { |
308 | - $aircraft_icao = $Spotter->getAllAircraftType(trim($line['hex']),$this->all_flights[$id]['source_type']); |
|
308 | + $aircraft_icao = $Spotter->getAllAircraftType(trim($line['hex']), $this->all_flights[$id]['source_type']); |
|
309 | 309 | } else { |
310 | 310 | $aircraft_icao = $Spotter->getAllAircraftType(trim($line['hex'])); |
311 | 311 | } |
312 | 312 | $Spotter->db = null; |
313 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update getallaircrattype : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
314 | - if ($aircraft_icao != '') $this->all_flights[$id] = array_merge($this->all_flights[$id],array('aircraft_icao' => $aircraft_icao)); |
|
313 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update getallaircrattype : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
314 | + if ($aircraft_icao != '') $this->all_flights[$id] = array_merge($this->all_flights[$id], array('aircraft_icao' => $aircraft_icao)); |
|
315 | 315 | } |
316 | 316 | } |
317 | 317 | if ($globalAllFlights !== FALSE) $dataFound = true; |
318 | 318 | if ($globalDebug) echo "*********** New aircraft hex : ".$line['hex']." ***********\n"; |
319 | 319 | } |
320 | 320 | if (isset($line['id']) && !isset($line['hex'])) { |
321 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('hex' => '')); |
|
321 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('hex' => '')); |
|
322 | 322 | } |
323 | 323 | if (isset($line['aircraft_icao']) && $line['aircraft_icao'] != '') { |
324 | 324 | $icao = $line['aircraft_icao']; |
@@ -327,14 +327,14 @@ discard block |
||
327 | 327 | if (isset($Spotter->aircraft_correct_icaotype[$icao])) $icao = $Spotter->aircraft_correct_icaotype[$icao]; |
328 | 328 | $Spotter->db = null; |
329 | 329 | } |
330 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('aircraft_icao' => $icao)); |
|
330 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('aircraft_icao' => $icao)); |
|
331 | 331 | } elseif (!isset($this->all_flights[$id]['aircraft_icao']) && isset($line['aircraft_name'])) { |
332 | 332 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
333 | 333 | // Get aircraft ICAO from aircraft name |
334 | 334 | $Spotter = new Spotter($this->db); |
335 | 335 | $aircraft_icao = $Spotter->getAircraftIcao($line['aircraft_name']); |
336 | 336 | $Spotter->db = null; |
337 | - if ($aircraft_icao != '') $this->all_flights[$id] = array_merge($this->all_flights[$id],array('aircraft_icao' => $aircraft_icao)); |
|
337 | + if ($aircraft_icao != '') $this->all_flights[$id] = array_merge($this->all_flights[$id], array('aircraft_icao' => $aircraft_icao)); |
|
338 | 338 | } |
339 | 339 | } |
340 | 340 | if (!isset($this->all_flights[$id]['aircraft_icao']) && isset($line['aircraft_type'])) { |
@@ -342,15 +342,15 @@ discard block |
||
342 | 342 | elseif ($line['aircraft_type'] == 'HELICOPTER_ROTORCRAFT') $aircraft_icao = 'UHEL'; |
343 | 343 | elseif ($line['aircraft_type'] == 'TOW_PLANE') $aircraft_icao = 'TOWPLANE'; |
344 | 344 | elseif ($line['aircraft_type'] == 'POWERED_AIRCRAFT') $aircraft_icao = 'POWAIRC'; |
345 | - if (isset($aircraft_icao)) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('aircraft_icao' => $aircraft_icao)); |
|
345 | + if (isset($aircraft_icao)) $this->all_flights[$id] = array_merge($this->all_flights[$id], array('aircraft_icao' => $aircraft_icao)); |
|
346 | 346 | } |
347 | 347 | if (!isset($this->all_flights[$id]['aircraft_icao'])) { |
348 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('aircraft_icao' => 'NA')); |
|
348 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('aircraft_icao' => 'NA')); |
|
349 | 349 | } |
350 | 350 | //if (isset($line['datetime']) && preg_match('/^(\d{4}(?:\-\d{2}){2} \d{2}(?:\:\d{2}){2})$/',$line['datetime'])) { |
351 | - if (isset($line['datetime']) && strtotime($line['datetime']) > time()-20*60 && strtotime($line['datetime']) < time()+20*60) { |
|
351 | + if (isset($line['datetime']) && strtotime($line['datetime']) > time() - 20*60 && strtotime($line['datetime']) < time() + 20*60) { |
|
352 | 352 | if (!isset($this->all_flights[$id]['datetime']) || strtotime($line['datetime']) >= strtotime($this->all_flights[$id]['datetime'])) { |
353 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('datetime' => $line['datetime'])); |
|
353 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('datetime' => $line['datetime'])); |
|
354 | 354 | } else { |
355 | 355 | if (strtotime($line['datetime']) == strtotime($this->all_flights[$id]['datetime']) && $globalDebug) echo "!!! Date is the same as previous data for ".$this->all_flights[$id]['hex']." - format : ".$line['format_source']."\n"; |
356 | 356 | elseif (strtotime($line['datetime']) > strtotime($this->all_flights[$id]['datetime']) && $globalDebug) echo "!!! Date previous latest data (".$line['datetime']." > ".$this->all_flights[$id]['datetime'].") !!! for ".$this->all_flights[$id]['hex']." - format : ".$line['format_source']."\n"; |
@@ -361,31 +361,31 @@ discard block |
||
361 | 361 | */ |
362 | 362 | return ''; |
363 | 363 | } |
364 | - } elseif (isset($line['datetime']) && strtotime($line['datetime']) < time()-20*60) { |
|
364 | + } elseif (isset($line['datetime']) && strtotime($line['datetime']) < time() - 20*60) { |
|
365 | 365 | if ($globalDebug) echo "!!! Date is too old ".$line['datetime']." for ".$this->all_flights[$id]['hex']." - format : ".$line['format_source']."!!!\n"; |
366 | 366 | return ''; |
367 | - } elseif (isset($line['datetime']) && strtotime($line['datetime']) > time()+20*60) { |
|
367 | + } elseif (isset($line['datetime']) && strtotime($line['datetime']) > time() + 20*60) { |
|
368 | 368 | if ($globalDebug) echo "!!! Date is in the future ".$line['datetime']." for ".$this->all_flights[$id]['hex']." - format : ".$line['format_source']."!!!\n"; |
369 | 369 | return ''; |
370 | 370 | } elseif (!isset($line['datetime'])) { |
371 | 371 | date_default_timezone_set('UTC'); |
372 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('datetime' => date('Y-m-d H:i:s'))); |
|
372 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('datetime' => date('Y-m-d H:i:s'))); |
|
373 | 373 | } else { |
374 | 374 | if ($globalDebug) echo "!!! Unknow date error ".$this->all_flights[$id]['hex']." - format : ".$line['format_source']."!!!"; |
375 | 375 | return ''; |
376 | 376 | } |
377 | 377 | |
378 | 378 | if (isset($line['registration']) && $line['registration'] != '' && $line['registration'] != 'z.NO-REG' && $line['registration'] != 'NA') { |
379 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('registration' => $line['registration'])); |
|
379 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('registration' => $line['registration'])); |
|
380 | 380 | } |
381 | 381 | if (isset($line['waypoints']) && $line['waypoints'] != '') { |
382 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('waypoints' => $line['waypoints'])); |
|
382 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('waypoints' => $line['waypoints'])); |
|
383 | 383 | } |
384 | 384 | if (isset($line['pilot_id']) && $line['pilot_id'] != '') { |
385 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('pilot_id' => trim($line['pilot_id']))); |
|
385 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('pilot_id' => trim($line['pilot_id']))); |
|
386 | 386 | } |
387 | 387 | if (isset($line['pilot_name']) && $line['pilot_name'] != '') { |
388 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('pilot_name' => trim($line['pilot_name']))); |
|
388 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('pilot_name' => trim($line['pilot_name']))); |
|
389 | 389 | } |
390 | 390 | |
391 | 391 | if (isset($line['ident']) && trim($line['ident']) != '' && $line['ident'] != '????????' && $line['ident'] != '00000000' && ($this->all_flights[$id]['ident'] != trim($line['ident'])) && preg_match('/^[a-zA-Z0-9]+$/', $line['ident'])) { |
@@ -393,13 +393,13 @@ discard block |
||
393 | 393 | if ($this->all_flights[$id]['addedSpotter'] == 1) { |
394 | 394 | if ($globalVA !== TRUE && $globalIVAO !== TRUE && $globalVATSIM !== TRUE && $globalphpVMS !== TRUE && $globalVAM !== TRUE && $this->all_flights[$id]['lastupdate'] < time() - 1600) { |
395 | 395 | if ($globalDebug) echo '---!!!! New ident, reset aircraft data...'."\n"; |
396 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('addedSpotter' => 0)); |
|
397 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('forcenew' => 1)); |
|
398 | - if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'aircraftjson' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw' || $line['format_source'] === 'deltadbtxt' || $line['format_source'] === 'planeupdatefaa' || $line['format_source'] === 'aprs' || $line['format_source'] === 'aircraftlistjson' || $line['format_source'] === 'radarvirtueljson' || $line['format_source'] === 'famaprs')) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $id.'-'.date('YmdHi'))); |
|
399 | - elseif (isset($line['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $line['id'])); |
|
400 | - elseif (isset($this->all_flights[$id]['ident'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident'])); |
|
396 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('addedSpotter' => 0)); |
|
397 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('forcenew' => 1)); |
|
398 | + if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'aircraftjson' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw' || $line['format_source'] === 'deltadbtxt' || $line['format_source'] === 'planeupdatefaa' || $line['format_source'] === 'aprs' || $line['format_source'] === 'aircraftlistjson' || $line['format_source'] === 'radarvirtueljson' || $line['format_source'] === 'famaprs')) $this->all_flights[$id] = array_merge($this->all_flights[$id], array('id' => $id.'-'.date('YmdHi'))); |
|
399 | + elseif (isset($line['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id], array('id' => $line['id'])); |
|
400 | + elseif (isset($this->all_flights[$id]['ident'])) $this->all_flights[$id] = array_merge($this->all_flights[$id], array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident'])); |
|
401 | 401 | } else { |
402 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('ident' => trim($line['ident']))); |
|
402 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('ident' => trim($line['ident']))); |
|
403 | 403 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
404 | 404 | $timeelapsed = microtime(true); |
405 | 405 | $Spotter = new Spotter($this->db); |
@@ -409,13 +409,13 @@ discard block |
||
409 | 409 | elseif (isset($line['format_source']) && $line['format_source'] == 'whazzup') $fromsource = 'ivao'; |
410 | 410 | elseif (isset($globalVATSIM) && $globalVATSIM) $fromsource = 'vatsim'; |
411 | 411 | elseif (isset($globalIVAO) && $globalIVAO) $fromsource = 'ivao'; |
412 | - $result = $Spotter->updateIdentSpotterData($this->all_flights[$id]['id'],$this->all_flights[$id]['ident'],$fromsource); |
|
412 | + $result = $Spotter->updateIdentSpotterData($this->all_flights[$id]['id'], $this->all_flights[$id]['ident'], $fromsource); |
|
413 | 413 | if ($globalDebug && $result != 'success') echo '!!! ERROR : '.$result."\n"; |
414 | 414 | $Spotter->db = null; |
415 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update identspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
415 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update identspotterdata : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
416 | 416 | } |
417 | 417 | } |
418 | - } else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('ident' => trim($line['ident']))); |
|
418 | + } else $this->all_flights[$id] = array_merge($this->all_flights[$id], array('ident' => trim($line['ident']))); |
|
419 | 419 | |
420 | 420 | /* |
421 | 421 | if (!isset($line['id'])) { |
@@ -425,25 +425,25 @@ discard block |
||
425 | 425 | else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident'])); |
426 | 426 | } else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $line['id'])); |
427 | 427 | */ |
428 | - if (!isset($this->all_flights[$id]['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident'])); |
|
428 | + if (!isset($this->all_flights[$id]['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id], array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident'])); |
|
429 | 429 | |
430 | 430 | //$putinarchive = true; |
431 | 431 | if (isset($line['departure_airport_time']) && $line['departure_airport_time'] != 0) { |
432 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('departure_airport_time' => $line['departure_airport_time'])); |
|
432 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('departure_airport_time' => $line['departure_airport_time'])); |
|
433 | 433 | } |
434 | 434 | if (isset($line['arrival_airport_time']) && $line['arrival_airport_time'] != 0) { |
435 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('arrival_airport_time' => $line['arrival_airport_time'])); |
|
435 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('arrival_airport_time' => $line['arrival_airport_time'])); |
|
436 | 436 | } |
437 | 437 | if (isset($line['departure_airport_icao']) && isset($line['arrival_airport_icao'])) { |
438 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('departure_airport' => $line['departure_airport_icao'],'arrival_airport' => $line['arrival_airport_icao'],'route_stop' => '')); |
|
438 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('departure_airport' => $line['departure_airport_icao'], 'arrival_airport' => $line['arrival_airport_icao'], 'route_stop' => '')); |
|
439 | 439 | } elseif (isset($line['departure_airport_iata']) && isset($line['arrival_airport_iata'])) { |
440 | 440 | $timeelapsed = microtime(true); |
441 | 441 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
442 | 442 | $Spotter = new Spotter($this->db); |
443 | 443 | $line['departure_airport_icao'] = $Spotter->getAirportIcao($line['departure_airport_iata']); |
444 | 444 | $line['arrival_airport_icao'] = $Spotter->getAirportIcao($line['arrival_airport_iata']); |
445 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('departure_airport' => $line['departure_airport_icao'],'arrival_airport' => $line['arrival_airport_icao'],'route_stop' => '')); |
|
446 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update getAirportICAO : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
445 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('departure_airport' => $line['departure_airport_icao'], 'arrival_airport' => $line['arrival_airport_icao'], 'route_stop' => '')); |
|
446 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update getAirportICAO : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
447 | 447 | } |
448 | 448 | } elseif (!isset($line['format_source']) || $line['format_source'] != 'aprs') { |
449 | 449 | $timeelapsed = microtime(true); |
@@ -457,35 +457,35 @@ discard block |
||
457 | 457 | $Translation->db = null; |
458 | 458 | } |
459 | 459 | $Spotter->db = null; |
460 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update getrouteinfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
460 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update getrouteinfo : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
461 | 461 | } |
462 | 462 | if (isset($route['fromairport_icao']) && isset($route['toairport_icao'])) { |
463 | 463 | //if ($route['FromAirport_ICAO'] != $route['ToAirport_ICAO']) { |
464 | 464 | if ($route['fromairport_icao'] != $route['toairport_icao']) { |
465 | 465 | // $this->all_flights[$id] = array_merge($this->all_flights[$id],array('departure_airport' => $route['FromAirport_ICAO'],'arrival_airport' => $route['ToAirport_ICAO'],'route_stop' => $route['RouteStop'])); |
466 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('departure_airport' => $route['fromairport_icao'],'arrival_airport' => $route['toairport_icao'],'route_stop' => $route['routestop'])); |
|
466 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('departure_airport' => $route['fromairport_icao'], 'arrival_airport' => $route['toairport_icao'], 'route_stop' => $route['routestop'])); |
|
467 | 467 | } |
468 | 468 | } |
469 | 469 | if (!isset($globalFork)) $globalFork = TRUE; |
470 | 470 | if (!$globalVA && !$globalIVAO && !$globalVATSIM && !$globalphpVMS && !$globalVAM && (!isset($line['format_source']) || $line['format_source'] != 'aprs')) { |
471 | - if (!isset($this->all_flights[$id]['schedule_check']) || $this->all_flights[$id]['schedule_check'] === false) $this->get_Schedule($id,trim($line['ident'])); |
|
471 | + if (!isset($this->all_flights[$id]['schedule_check']) || $this->all_flights[$id]['schedule_check'] === false) $this->get_Schedule($id, trim($line['ident'])); |
|
472 | 472 | } |
473 | 473 | } |
474 | 474 | } |
475 | 475 | |
476 | 476 | if (isset($line['speed']) && $line['speed'] != '' && $line['speed'] != 0) { |
477 | 477 | // $this->all_flights[$id] = array_merge($this->all_flights[$id],array('speed' => $line[12])); |
478 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('speed' => round($line['speed']))); |
|
479 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('speed_fromsrc' => true)); |
|
478 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('speed' => round($line['speed']))); |
|
479 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('speed_fromsrc' => true)); |
|
480 | 480 | //$dataFound = true; |
481 | 481 | } else if (!isset($this->all_flights[$id]['speed_fromsrc']) && isset($this->all_flights[$id]['time_last_coord']) && $this->all_flights[$id]['time_last_coord'] != time() && isset($line['latitude']) && isset($line['longitude'])) { |
482 | - $distance = $Common->distance($line['latitude'],$line['longitude'],$this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],'m'); |
|
482 | + $distance = $Common->distance($line['latitude'], $line['longitude'], $this->all_flights[$id]['latitude'], $this->all_flights[$id]['longitude'], 'm'); |
|
483 | 483 | if ($distance > 1000 && $distance < 10000) { |
484 | 484 | // use datetime |
485 | 485 | $speed = $distance/(time() - $this->all_flights[$id]['time_last_coord']); |
486 | 486 | $speed = $speed*3.6; |
487 | 487 | if ($speed < 1000) { |
488 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('speed' => round($speed))); |
|
488 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('speed' => round($speed))); |
|
489 | 489 | if ($globalDebug) echo "ø Calculated Speed for ".$this->all_flights[$id]['hex']." : ".round($speed)." - distance : ".$distance."\n"; |
490 | 490 | } else { |
491 | 491 | if ($globalDebug) echo "ø IGNORED : Calculated Speed for ".$this->all_flights[$id]['hex']." : ".round($speed)." - distance : ".$distance."\n"; |
@@ -500,9 +500,9 @@ discard block |
||
500 | 500 | if ($globalDebug) echo "/!\ Invalid latitude or/and longitude data : lat: ".$line['latitude']." - lng: ".$line['longitude']."\n"; |
501 | 501 | return false; |
502 | 502 | } |
503 | - if (isset($this->all_flights[$id]['time_last_coord'])) $timediff = round(time()-$this->all_flights[$id]['time_last_coord']); |
|
503 | + if (isset($this->all_flights[$id]['time_last_coord'])) $timediff = round(time() - $this->all_flights[$id]['time_last_coord']); |
|
504 | 504 | else unset($timediff); |
505 | - if (isset($this->all_flights[$id]['time_last_archive_coord'])) $timediff_archive = round(time()-$this->all_flights[$id]['time_last_archive_coord']); |
|
505 | + if (isset($this->all_flights[$id]['time_last_archive_coord'])) $timediff_archive = round(time() - $this->all_flights[$id]['time_last_archive_coord']); |
|
506 | 506 | else unset($timediff_archive); |
507 | 507 | if ($this->tmd > 5 |
508 | 508 | || (isset($line['format_source']) |
@@ -527,14 +527,14 @@ discard block |
||
527 | 527 | || ($timediff > 30 |
528 | 528 | && isset($this->all_flights[$id]['latitude']) |
529 | 529 | && isset($this->all_flights[$id]['longitude']) |
530 | - && $Common->withinThreshold($timediff,$Common->distance($line['latitude'],$line['longitude'],$this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],'m')) |
|
530 | + && $Common->withinThreshold($timediff, $Common->distance($line['latitude'], $line['longitude'], $this->all_flights[$id]['latitude'], $this->all_flights[$id]['longitude'], 'm')) |
|
531 | 531 | ) |
532 | 532 | ) { |
533 | 533 | |
534 | 534 | if ((isset($timediff) && !isset($timediff_archive)) || (isset($this->all_flights[$id]['archive_latitude']) && isset($this->all_flights[$id]['archive_longitude']) && isset($this->all_flights[$id]['livedb_latitude']) && isset($this->all_flights[$id]['livedb_longitude']))) { |
535 | 535 | if ((isset($timediff_archive) && $timediff_archive > $globalAircraftMaxUpdate) |
536 | 536 | || (isset($line['format_source']) && $line['format_source'] == 'airwhere') |
537 | - || !$Common->checkLine($this->all_flights[$id]['archive_latitude'],$this->all_flights[$id]['archive_longitude'],$this->all_flights[$id]['livedb_latitude'],$this->all_flights[$id]['livedb_longitude'],$line['latitude'],$line['longitude'])) { |
|
537 | + || !$Common->checkLine($this->all_flights[$id]['archive_latitude'], $this->all_flights[$id]['archive_longitude'], $this->all_flights[$id]['livedb_latitude'], $this->all_flights[$id]['livedb_longitude'], $line['latitude'], $line['longitude'])) { |
|
538 | 538 | $this->all_flights[$id]['archive_latitude'] = $line['latitude']; |
539 | 539 | $this->all_flights[$id]['archive_longitude'] = $line['longitude']; |
540 | 540 | $this->all_flights[$id]['putinarchive'] = true; |
@@ -544,11 +544,11 @@ discard block |
||
544 | 544 | $timeelapsed = microtime(true); |
545 | 545 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
546 | 546 | $Spotter = new Spotter($this->db); |
547 | - $all_country = $Spotter->getCountryFromLatitudeLongitude($line['latitude'],$line['longitude']); |
|
547 | + $all_country = $Spotter->getCountryFromLatitudeLongitude($line['latitude'], $line['longitude']); |
|
548 | 548 | if (!empty($all_country)) $this->all_flights[$id]['over_country'] = $all_country['iso2']; |
549 | 549 | else $this->all_flights[$id]['over_country'] = ''; |
550 | 550 | $Spotter->db = null; |
551 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update getCountryFromlatitudeLongitude : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
551 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update getCountryFromlatitudeLongitude : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
552 | 552 | if ($globalDebug) echo 'FOUND : '.$this->all_flights[$id]['over_country'].' ---------------'."\n"; |
553 | 553 | } |
554 | 554 | } |
@@ -574,13 +574,13 @@ discard block |
||
574 | 574 | $this->all_flights[$id]['time_last_coord'] = time(); |
575 | 575 | } |
576 | 576 | //if (!isset($this->all_flights[$id]['livedb_latitude']) || abs($this->all_flights[$id]['livedb_latitude']-$line['latitude']) > $globalCoordMinChange || $this->all_flights[$id]['format_source'] == 'aprs' || ($this->all_flights[$id]['format_source'] == 'airwhere' && abs($this->all_flights[$id]['livedb_latitude']-$line['latitude']) > 0.0001)) { |
577 | - if (!isset($this->all_flights[$id]['livedb_latitude']) || abs($this->all_flights[$id]['livedb_latitude']-$line['latitude']) > $globalCoordMinChange || ($this->all_flights[$id]['format_source'] == 'airwhere' && abs($this->all_flights[$id]['livedb_latitude']-$line['latitude']) > 0.0001)) { |
|
577 | + if (!isset($this->all_flights[$id]['livedb_latitude']) || abs($this->all_flights[$id]['livedb_latitude'] - $line['latitude']) > $globalCoordMinChange || ($this->all_flights[$id]['format_source'] == 'airwhere' && abs($this->all_flights[$id]['livedb_latitude'] - $line['latitude']) > 0.0001)) { |
|
578 | 578 | $this->all_flights[$id]['livedb_latitude'] = $line['latitude']; |
579 | 579 | $dataFound = true; |
580 | 580 | $this->all_flights[$id]['time_last_coord'] = time(); |
581 | 581 | } |
582 | 582 | // elseif ($globalDebug) echo '!*!*! Ignore data, too close to previous one'."\n"; |
583 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('latitude' => $line['latitude'])); |
|
583 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('latitude' => $line['latitude'])); |
|
584 | 584 | /* |
585 | 585 | if (abs($this->all_flights[$id]['archive_latitude']-$this->all_flights[$id]['latitude']) > 0.3) { |
586 | 586 | $this->all_flights[$id]['archive_latitude'] = $line['latitude']; |
@@ -602,13 +602,13 @@ discard block |
||
602 | 602 | $this->all_flights[$id]['time_last_coord'] = time(); |
603 | 603 | } |
604 | 604 | //if (!isset($this->all_flights[$id]['livedb_longitude']) || abs($this->all_flights[$id]['livedb_longitude']-$line['longitude']) > $globalCoordMinChange || $this->all_flights[$id]['format_source'] == 'aprs' || ($this->all_flights[$id]['format_source'] == 'airwhere' && abs($this->all_flights[$id]['livedb_longitude']-$line['longitude']) > 0.0001)) { |
605 | - if (!isset($this->all_flights[$id]['livedb_longitude']) || abs($this->all_flights[$id]['livedb_longitude']-$line['longitude']) > $globalCoordMinChange || ($this->all_flights[$id]['format_source'] == 'airwhere' && abs($this->all_flights[$id]['livedb_longitude']-$line['longitude']) > 0.0001)) { |
|
605 | + if (!isset($this->all_flights[$id]['livedb_longitude']) || abs($this->all_flights[$id]['livedb_longitude'] - $line['longitude']) > $globalCoordMinChange || ($this->all_flights[$id]['format_source'] == 'airwhere' && abs($this->all_flights[$id]['livedb_longitude'] - $line['longitude']) > 0.0001)) { |
|
606 | 606 | $this->all_flights[$id]['livedb_longitude'] = $line['longitude']; |
607 | 607 | $dataFound = true; |
608 | 608 | $this->all_flights[$id]['time_last_coord'] = time(); |
609 | 609 | } |
610 | 610 | // elseif ($globalDebug) echo '!*!*! Ignore data, too close to previous one'."\n"; |
611 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('longitude' => $line['longitude'])); |
|
611 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('longitude' => $line['longitude'])); |
|
612 | 612 | /* |
613 | 613 | if (abs($this->all_flights[$id]['archive_longitude']-$this->all_flights[$id]['longitude']) > 0.3) { |
614 | 614 | $this->all_flights[$id]['archive_longitude'] = $line['longitude']; |
@@ -626,46 +626,46 @@ discard block |
||
626 | 626 | } else if ($globalDebug && $timediff > 30) { |
627 | 627 | $this->tmd = $this->tmd + 1; |
628 | 628 | echo '!!! Too much distance in short time... for '.$this->all_flights[$id]['ident']."\n"; |
629 | - echo 'Time : '.$timediff.'s - Distance : '.$Common->distance($line['latitude'],$line['longitude'],$this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],'m')."m -"; |
|
630 | - echo 'Speed : '.(($Common->distance($line['latitude'],$line['longitude'],$this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],'m')/$timediff)*3.6)." km/h - "; |
|
629 | + echo 'Time : '.$timediff.'s - Distance : '.$Common->distance($line['latitude'], $line['longitude'], $this->all_flights[$id]['latitude'], $this->all_flights[$id]['longitude'], 'm')."m -"; |
|
630 | + echo 'Speed : '.(($Common->distance($line['latitude'], $line['longitude'], $this->all_flights[$id]['latitude'], $this->all_flights[$id]['longitude'], 'm')/$timediff)*3.6)." km/h - "; |
|
631 | 631 | echo 'Lat : '.$line['latitude'].' - long : '.$line['longitude'].' - prev lat : '.$this->all_flights[$id]['latitude'].' - prev long : '.$this->all_flights[$id]['longitude']." \n"; |
632 | 632 | } |
633 | 633 | } |
634 | 634 | if (isset($line['last_update']) && $line['last_update'] != '') { |
635 | 635 | if (isset($this->all_flights[$id]['last_update']) && $this->all_flights[$id]['last_update'] != $line['last_update']) $dataFound = true; |
636 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('last_update' => $line['last_update'])); |
|
636 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('last_update' => $line['last_update'])); |
|
637 | 637 | } |
638 | 638 | if (isset($line['verticalrate']) && $line['verticalrate'] != '') { |
639 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('verticalrate' => $line['verticalrate'])); |
|
639 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('verticalrate' => $line['verticalrate'])); |
|
640 | 640 | //$dataFound = true; |
641 | 641 | } |
642 | 642 | if (isset($line['format_source']) && $line['format_source'] != '') { |
643 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('format_source' => $line['format_source'])); |
|
643 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('format_source' => $line['format_source'])); |
|
644 | 644 | } |
645 | 645 | if (isset($line['source_name']) && $line['source_name'] != '') { |
646 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('source_name' => $line['source_name'])); |
|
646 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('source_name' => $line['source_name'])); |
|
647 | 647 | } |
648 | 648 | if (isset($line['emergency']) && $line['emergency'] != '') { |
649 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('emergency' => $line['emergency'])); |
|
649 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('emergency' => $line['emergency'])); |
|
650 | 650 | //$dataFound = true; |
651 | 651 | } |
652 | 652 | if (isset($line['ground']) && $line['ground'] != '') { |
653 | 653 | if (isset($this->all_flights[$id]['ground']) && $this->all_flights[$id]['ground'] == 1 && $line['ground'] == 0) { |
654 | 654 | // Here we force archive of flight because after ground it's a new one (or should be) |
655 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('addedSpotter' => 0)); |
|
656 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('forcenew' => 1)); |
|
657 | - if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'aircraftjson' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw' || $line['format_source'] === 'deltadbtxt' || $line['format_source'] === 'planeupdatefaa' || $line['format_source'] === 'aprs' || $line['format_source'] === 'aircraftlistjson' || $line['format_source'] === 'radarvirtueljson' || $line['format_source'] === 'famaprs')) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $id.'-'.date('YmdHi'))); |
|
658 | - elseif (isset($line['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $line['id'])); |
|
659 | - elseif (isset($this->all_flights[$id]['ident'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident'])); |
|
655 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('addedSpotter' => 0)); |
|
656 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('forcenew' => 1)); |
|
657 | + if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'aircraftjson' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw' || $line['format_source'] === 'deltadbtxt' || $line['format_source'] === 'planeupdatefaa' || $line['format_source'] === 'aprs' || $line['format_source'] === 'aircraftlistjson' || $line['format_source'] === 'radarvirtueljson' || $line['format_source'] === 'famaprs')) $this->all_flights[$id] = array_merge($this->all_flights[$id], array('id' => $id.'-'.date('YmdHi'))); |
|
658 | + elseif (isset($line['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id], array('id' => $line['id'])); |
|
659 | + elseif (isset($this->all_flights[$id]['ident'])) $this->all_flights[$id] = array_merge($this->all_flights[$id], array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident'])); |
|
660 | 660 | } |
661 | 661 | if ($line['ground'] != 1) $line['ground'] = 0; |
662 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('ground' => $line['ground'])); |
|
662 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('ground' => $line['ground'])); |
|
663 | 663 | //$dataFound = true; |
664 | 664 | } |
665 | 665 | if (isset($line['squawk']) && $line['squawk'] != '') { |
666 | 666 | if (isset($this->all_flights[$id]['squawk']) && $this->all_flights[$id]['squawk'] != '7500' && $this->all_flights[$id]['squawk'] != '7600' && $this->all_flights[$id]['squawk'] != '7700' && isset($this->all_flights[$id]['id'])) { |
667 | 667 | if ($this->all_flights[$id]['squawk'] != $line['squawk']) $this->all_flights[$id]['putinarchive'] = true; |
668 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('squawk' => $line['squawk'])); |
|
668 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('squawk' => $line['squawk'])); |
|
669 | 669 | $highlight = ''; |
670 | 670 | if ($this->all_flights[$id]['squawk'] == '7500') $highlight = 'Squawk 7500 : Hijack at '.date('Y-m-d G:i').' UTC'; |
671 | 671 | if ($this->all_flights[$id]['squawk'] == '7600') $highlight = 'Squawk 7600 : Lost Comm (radio failure) at '.date('Y-m-d G:i').' UTC'; |
@@ -674,66 +674,66 @@ discard block |
||
674 | 674 | $timeelapsed = microtime(true); |
675 | 675 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
676 | 676 | $Spotter = new Spotter($this->db); |
677 | - $Spotter->setHighlightFlight($this->all_flights[$id]['id'],$highlight); |
|
677 | + $Spotter->setHighlightFlight($this->all_flights[$id]['id'], $highlight); |
|
678 | 678 | $Spotter->db = null; |
679 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update sethighlightflight : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
679 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update sethighlightflight : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
680 | 680 | } |
681 | 681 | //$putinarchive = true; |
682 | 682 | //$highlight = ''; |
683 | 683 | } |
684 | 684 | |
685 | - } else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('squawk' => $line['squawk'])); |
|
685 | + } else $this->all_flights[$id] = array_merge($this->all_flights[$id], array('squawk' => $line['squawk'])); |
|
686 | 686 | //$dataFound = true; |
687 | 687 | } |
688 | 688 | |
689 | 689 | if (isset($line['altitude']) && $line['altitude'] != '') { |
690 | 690 | if (isset($line['altitude_relative']) && isset($GeoidClass) && is_object($GeoidClass)) { |
691 | 691 | if ($line['altitude_relative'] == 'AMSL' || $line['altitude_relative'] == 'MSL') { |
692 | - $geoid = round($GeoidClass->get($this->all_flights[$id]['livedb_latitude'],$this->all_flights[$id]['livedb_longitude'])*3.28084,2); |
|
692 | + $geoid = round($GeoidClass->get($this->all_flights[$id]['livedb_latitude'], $this->all_flights[$id]['livedb_longitude'])*3.28084, 2); |
|
693 | 693 | //if ($globalDebug) echo '=> Set altitude to WGS84 Ellipsoid, add '.$geoid.' to '.$line['altitude']."\n"; |
694 | 694 | $line['altitude'] = $line['altitude'] - $geoid; |
695 | 695 | } |
696 | 696 | } |
697 | 697 | //if (!isset($this->all_flights[$id]['altitude']) || $this->all_flights[$id]['altitude'] == '' || ($this->all_flights[$id]['altitude'] > 0 && $line['altitude'] != 0)) { |
698 | - if (is_int($this->all_flights[$id]['altitude']) && abs(round($line['altitude']/100)-$this->all_flights[$id]['altitude']) > 3) $this->all_flights[$id]['putinarchive'] = true; |
|
699 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('altitude' => round($line['altitude']/100))); |
|
700 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('altitude_real' => $line['altitude'])); |
|
698 | + if (is_int($this->all_flights[$id]['altitude']) && abs(round($line['altitude']/100) - $this->all_flights[$id]['altitude']) > 3) $this->all_flights[$id]['putinarchive'] = true; |
|
699 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('altitude' => round($line['altitude']/100))); |
|
700 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('altitude_real' => $line['altitude'])); |
|
701 | 701 | //$dataFound = true; |
702 | 702 | //} elseif ($globalDebug) echo "!!! Strange altitude data... not added.\n"; |
703 | 703 | if ($globalVA !== TRUE && $globalIVAO !== TRUE && $globalVATSIM !== TRUE && $globalphpVMS !== TRUE && $globalVAM !== TRUE) { |
704 | 704 | if (isset($this->all_flights[$id]['over_country']) && $this->all_flights[$id]['over_country'] != '' && isset($this->all_flights[$id]['altitude_previous']) && $this->all_flights[$id]['altitude_previous'] != '' && $this->all_flights[$id]['altitude_previous'] < $this->all_flights[$id]['altitude_real'] && isset($this->all_flights[$id]['lastupdate']) && $this->all_flights[$id]['lastupdate'] < time() - 1600) { |
705 | 705 | if ($globalDebug) echo '--- Reset because of altitude'."\n"; |
706 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('addedSpotter' => 0)); |
|
707 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('forcenew' => 1)); |
|
708 | - if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'aircraftjson' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw' || $line['format_source'] === 'deltadbtxt' || $line['format_source'] === 'planeupdatefaa' || $line['format_source'] === 'aprs' || $line['format_source'] === 'aircraftlistjson' || $line['format_source'] === 'radarvirtueljson' || $line['format_source'] === 'famaprs')) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $id.'-'.date('YmdHi'))); |
|
709 | - elseif (isset($line['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $line['id'])); |
|
710 | - elseif (isset($this->all_flights[$id]['ident'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident'])); |
|
706 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('addedSpotter' => 0)); |
|
707 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('forcenew' => 1)); |
|
708 | + if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'aircraftjson' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw' || $line['format_source'] === 'deltadbtxt' || $line['format_source'] === 'planeupdatefaa' || $line['format_source'] === 'aprs' || $line['format_source'] === 'aircraftlistjson' || $line['format_source'] === 'radarvirtueljson' || $line['format_source'] === 'famaprs')) $this->all_flights[$id] = array_merge($this->all_flights[$id], array('id' => $id.'-'.date('YmdHi'))); |
|
709 | + elseif (isset($line['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id], array('id' => $line['id'])); |
|
710 | + elseif (isset($this->all_flights[$id]['ident'])) $this->all_flights[$id] = array_merge($this->all_flights[$id], array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident'])); |
|
711 | 711 | } |
712 | 712 | } |
713 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('altitude_previous' => $line['altitude'])); |
|
713 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('altitude_previous' => $line['altitude'])); |
|
714 | 714 | } |
715 | 715 | |
716 | 716 | if (isset($line['noarchive']) && $line['noarchive'] === true) { |
717 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('noarchive' => true)); |
|
717 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('noarchive' => true)); |
|
718 | 718 | } |
719 | 719 | |
720 | 720 | if (isset($line['heading']) && $line['heading'] != '') { |
721 | - if (is_int($this->all_flights[$id]['heading']) && abs($this->all_flights[$id]['heading']-round($line['heading'])) > 10) $this->all_flights[$id]['putinarchive'] = true; |
|
722 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('heading' => round($line['heading']))); |
|
723 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('heading_fromsrc' => true)); |
|
721 | + if (is_int($this->all_flights[$id]['heading']) && abs($this->all_flights[$id]['heading'] - round($line['heading'])) > 10) $this->all_flights[$id]['putinarchive'] = true; |
|
722 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('heading' => round($line['heading']))); |
|
723 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('heading_fromsrc' => true)); |
|
724 | 724 | //$dataFound = true; |
725 | 725 | } elseif (!isset($this->all_flights[$id]['heading_fromsrc']) && isset($this->all_flights[$id]['archive_latitude']) && $this->all_flights[$id]['archive_latitude'] != $this->all_flights[$id]['latitude'] && isset($this->all_flights[$id]['archive_longitude']) && $this->all_flights[$id]['archive_longitude'] != $this->all_flights[$id]['longitude']) { |
726 | - $heading = $Common->getHeading($this->all_flights[$id]['archive_latitude'],$this->all_flights[$id]['archive_longitude'],$this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude']); |
|
727 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('heading' => round($heading))); |
|
728 | - if (abs($this->all_flights[$id]['heading']-round($heading)) > 10) $this->all_flights[$id]['putinarchive'] = true; |
|
726 | + $heading = $Common->getHeading($this->all_flights[$id]['archive_latitude'], $this->all_flights[$id]['archive_longitude'], $this->all_flights[$id]['latitude'], $this->all_flights[$id]['longitude']); |
|
727 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('heading' => round($heading))); |
|
728 | + if (abs($this->all_flights[$id]['heading'] - round($heading)) > 10) $this->all_flights[$id]['putinarchive'] = true; |
|
729 | 729 | if ($globalDebug) echo "ø Calculated Heading for ".$this->all_flights[$id]['hex']." : ".$heading."\n"; |
730 | 730 | } elseif (isset($this->all_flights[$id]['format_source']) && $this->all_flights[$id]['format_source'] == 'ACARS') { |
731 | 731 | // If not enough messages and ACARS set heading to 0 |
732 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('heading' => 0)); |
|
732 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('heading' => 0)); |
|
733 | 733 | } |
734 | - if ($globalDaemon === TRUE && isset($globalSourcesupdate) && $globalSourcesupdate != '' && isset($this->all_flights[$id]['lastupdate']) && time()-$this->all_flights[$id]['lastupdate'] < $globalSourcesupdate) $dataFound = false; |
|
735 | - elseif ($globalDaemon === TRUE && isset($globalSBS1update) && $globalSBS1update != '' && isset($this->all_flights[$id]['lastupdate']) && time()-$this->all_flights[$id]['lastupdate'] < $globalSBS1update) $dataFound = false; |
|
736 | - elseif ($globalDaemon === TRUE && isset($globalAircraftMinUpdate) && $globalAircraftMinUpdate != '' && isset($this->all_flights[$id]['lastupdate']) && time()-$this->all_flights[$id]['lastupdate'] < $globalAircraftMinupdate) $dataFound = false; |
|
734 | + if ($globalDaemon === TRUE && isset($globalSourcesupdate) && $globalSourcesupdate != '' && isset($this->all_flights[$id]['lastupdate']) && time() - $this->all_flights[$id]['lastupdate'] < $globalSourcesupdate) $dataFound = false; |
|
735 | + elseif ($globalDaemon === TRUE && isset($globalSBS1update) && $globalSBS1update != '' && isset($this->all_flights[$id]['lastupdate']) && time() - $this->all_flights[$id]['lastupdate'] < $globalSBS1update) $dataFound = false; |
|
736 | + elseif ($globalDaemon === TRUE && isset($globalAircraftMinUpdate) && $globalAircraftMinUpdate != '' && isset($this->all_flights[$id]['lastupdate']) && time() - $this->all_flights[$id]['lastupdate'] < $globalAircraftMinupdate) $dataFound = false; |
|
737 | 737 | |
738 | 738 | // print_r($this->all_flights[$id]); |
739 | 739 | //gets the callsign from the last hour |
@@ -744,7 +744,7 @@ discard block |
||
744 | 744 | if ($dataFound === true && isset($this->all_flights[$id]['id'])) { |
745 | 745 | $this->all_flights[$id]['lastupdate'] = time(); |
746 | 746 | if ((!isset($globalNoImport) || $globalNoImport === FALSE) && $this->all_flights[$id]['addedSpotter'] == 0) { |
747 | - if (!isset($globalDistanceIgnore['latitude']) || $this->all_flights[$id]['longitude'] == '' || $this->all_flights[$id]['latitude'] == '' || (isset($globalDistanceIgnore['latitude']) && $Common->distance($this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude']) < $globalDistanceIgnore['distance'])) { |
|
747 | + if (!isset($globalDistanceIgnore['latitude']) || $this->all_flights[$id]['longitude'] == '' || $this->all_flights[$id]['latitude'] == '' || (isset($globalDistanceIgnore['latitude']) && $Common->distance($this->all_flights[$id]['latitude'], $this->all_flights[$id]['longitude'], $globalDistanceIgnore['latitude'], $globalDistanceIgnore['longitude']) < $globalDistanceIgnore['distance'])) { |
|
748 | 748 | //print_r($this->all_flights); |
749 | 749 | //echo $this->all_flights[$id]['id'].' - '.$this->all_flights[$id]['addedSpotter']."\n"; |
750 | 750 | //$last_hour_ident = Spotter->getIdentFromLastHour($this->all_flights[$id]['ident']); |
@@ -755,61 +755,61 @@ discard block |
||
755 | 755 | $SpotterLive = new SpotterLive($this->db); |
756 | 756 | if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'aircraftjson' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw' || $line['format_source'] === 'deltadbtxt' || $line['format_source'] === 'planeupdatefaa' || $line['format_source'] === 'aprs' || $line['format_source'] === 'aircraftlistjson' || $line['format_source'] === 'radarvirtueljson' || $line['format_source'] === 'famaprs')) { |
757 | 757 | $recent_ident = $SpotterLive->checkModeSRecent($this->all_flights[$id]['hex']); |
758 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkModeSRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
758 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkModeSRecent : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
759 | 759 | } elseif (isset($line['id'])) { |
760 | 760 | $recent_ident = $SpotterLive->checkIdRecent($line['id']); |
761 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
761 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdRecent : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
762 | 762 | } elseif (isset($this->all_flights[$id]['ident']) && $this->all_flights[$id]['ident'] != '') { |
763 | 763 | $recent_ident = $SpotterLive->checkIdentRecent($this->all_flights[$id]['ident']); |
764 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdentRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
764 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdentRecent : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
765 | 765 | } else $recent_ident = ''; |
766 | - $SpotterLive->db=null; |
|
766 | + $SpotterLive->db = null; |
|
767 | 767 | if ($globalDebug && $recent_ident == '') echo " Not in DB.\n"; |
768 | 768 | elseif ($globalDebug && $recent_ident != '') echo " Already in DB.\n"; |
769 | 769 | } else $recent_ident = ''; |
770 | 770 | } else { |
771 | 771 | $recent_ident = ''; |
772 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('forcenew' => 0)); |
|
772 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('forcenew' => 0)); |
|
773 | 773 | } |
774 | 774 | //if there was no aircraft with the same callsign within the last hour and go post it into the archive |
775 | - if($recent_ident == "") |
|
775 | + if ($recent_ident == "") |
|
776 | 776 | { |
777 | 777 | if ($globalDebug) echo "\o/ Add ".$this->all_flights[$id]['ident']." in archive DB : "; |
778 | 778 | if ($this->all_flights[$id]['departure_airport'] == "") { $this->all_flights[$id]['departure_airport'] = "NA"; } |
779 | 779 | if ($this->all_flights[$id]['arrival_airport'] == "") { $this->all_flights[$id]['arrival_airport'] = "NA"; } |
780 | 780 | //adds the spotter data for the archive |
781 | 781 | $ignoreImport = false; |
782 | - foreach($globalAirportIgnore as $airportIgnore) { |
|
782 | + foreach ($globalAirportIgnore as $airportIgnore) { |
|
783 | 783 | if (($this->all_flights[$id]['departure_airport'] == $airportIgnore) || ($this->all_flights[$id]['arrival_airport'] == $airportIgnore)) { |
784 | 784 | $ignoreImport = true; |
785 | 785 | } |
786 | 786 | } |
787 | 787 | if (count($globalAirportAccept) > 0) { |
788 | 788 | $ignoreImport = true; |
789 | - foreach($globalAirportIgnore as $airportIgnore) { |
|
789 | + foreach ($globalAirportIgnore as $airportIgnore) { |
|
790 | 790 | if (($this->all_flights[$id]['departure_airport'] == $airportIgnore) || ($this->all_flights[$id]['arrival_airport'] == $airportIgnore)) { |
791 | 791 | $ignoreImport = false; |
792 | 792 | } |
793 | 793 | } |
794 | 794 | } |
795 | 795 | if (isset($globalAirlineIgnore) && is_array($globalAirlineIgnore)) { |
796 | - foreach($globalAirlineIgnore as $airlineIgnore) { |
|
797 | - if ((is_numeric(substr(substr($this->all_flights[$id]['ident'],0,4),-1,1)) && substr($this->all_flights[$id]['ident'],0,3) == $airlineIgnore) || (is_numeric(substr(substr($this->all_flights[$id]['ident'],0,3),-1,1)) && substr($this->all_flights[$id]['ident'],0,2) == $airlineIgnore)) { |
|
796 | + foreach ($globalAirlineIgnore as $airlineIgnore) { |
|
797 | + if ((is_numeric(substr(substr($this->all_flights[$id]['ident'], 0, 4), -1, 1)) && substr($this->all_flights[$id]['ident'], 0, 3) == $airlineIgnore) || (is_numeric(substr(substr($this->all_flights[$id]['ident'], 0, 3), -1, 1)) && substr($this->all_flights[$id]['ident'], 0, 2) == $airlineIgnore)) { |
|
798 | 798 | $ignoreImport = true; |
799 | 799 | } |
800 | 800 | } |
801 | 801 | } |
802 | 802 | if (isset($globalAirlineAccept) && count($globalAirlineAccept) > 0) { |
803 | 803 | $ignoreImport = true; |
804 | - foreach($globalAirlineAccept as $airlineAccept) { |
|
805 | - if ((is_numeric(substr(substr($this->all_flights[$id]['ident'],0,4),-1,1)) && substr($this->all_flights[$id]['ident'],0,3) == $airlineAccept) || (is_numeric(substr(substr($this->all_flights[$id]['ident'],0,3),-1,1)) && substr($this->all_flights[$id]['ident'],0,2) == $airlineAccept)) { |
|
804 | + foreach ($globalAirlineAccept as $airlineAccept) { |
|
805 | + if ((is_numeric(substr(substr($this->all_flights[$id]['ident'], 0, 4), -1, 1)) && substr($this->all_flights[$id]['ident'], 0, 3) == $airlineAccept) || (is_numeric(substr(substr($this->all_flights[$id]['ident'], 0, 3), -1, 1)) && substr($this->all_flights[$id]['ident'], 0, 2) == $airlineAccept)) { |
|
806 | 806 | $ignoreImport = false; |
807 | 807 | } |
808 | 808 | } |
809 | 809 | } |
810 | 810 | if (isset($globalPilotIdAccept) && count($globalPilotIdAccept) > 0) { |
811 | 811 | $ignoreImport = true; |
812 | - foreach($globalPilotIdAccept as $pilotIdAccept) { |
|
812 | + foreach ($globalPilotIdAccept as $pilotIdAccept) { |
|
813 | 813 | if ($this->all_flights[$id]['pilot_id'] == $pilotIdAccept) { |
814 | 814 | $ignoreImport = false; |
815 | 815 | } |
@@ -821,32 +821,32 @@ discard block |
||
821 | 821 | if ($this->all_flights[$id]['squawk'] == '7500') $highlight = 'Squawk 7500 : Hijack'; |
822 | 822 | if ($this->all_flights[$id]['squawk'] == '7600') $highlight = 'Squawk 7600 : Lost Comm (radio failure)'; |
823 | 823 | if ($this->all_flights[$id]['squawk'] == '7700') $highlight = 'Squawk 7700 : Emergency'; |
824 | - if (!isset($this->all_flights[$id]['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.date('YmdHi'))); |
|
824 | + if (!isset($this->all_flights[$id]['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id], array('id' => $this->all_flights[$id]['hex'].'-'.date('YmdHi'))); |
|
825 | 825 | $timeelapsed = microtime(true); |
826 | 826 | if (!isset($globalNoImport) || $globalNoImport === FALSE) { |
827 | 827 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
828 | 828 | $Spotter = new Spotter($this->db); |
829 | - $result = $Spotter->addSpotterData($this->all_flights[$id]['id'], $this->all_flights[$id]['ident'], $this->all_flights[$id]['aircraft_icao'], $this->all_flights[$id]['departure_airport'], $this->all_flights[$id]['arrival_airport'], $this->all_flights[$id]['latitude'], $this->all_flights[$id]['longitude'], $this->all_flights[$id]['waypoints'], $this->all_flights[$id]['altitude'],$this->all_flights[$id]['altitude_real'], $this->all_flights[$id]['heading'], $this->all_flights[$id]['speed'], $this->all_flights[$id]['datetime'], $this->all_flights[$id]['departure_airport_time'], $this->all_flights[$id]['arrival_airport_time'],$this->all_flights[$id]['squawk'],$this->all_flights[$id]['route_stop'],$highlight,$this->all_flights[$id]['hex'],$this->all_flights[$id]['registration'],$this->all_flights[$id]['pilot_id'],$this->all_flights[$id]['pilot_name'],$this->all_flights[$id]['verticalrate'],$this->all_flights[$id]['ground'],$this->all_flights[$id]['format_source'],$this->all_flights[$id]['source_name'],$this->all_flights[$id]['source_type']); |
|
829 | + $result = $Spotter->addSpotterData($this->all_flights[$id]['id'], $this->all_flights[$id]['ident'], $this->all_flights[$id]['aircraft_icao'], $this->all_flights[$id]['departure_airport'], $this->all_flights[$id]['arrival_airport'], $this->all_flights[$id]['latitude'], $this->all_flights[$id]['longitude'], $this->all_flights[$id]['waypoints'], $this->all_flights[$id]['altitude'], $this->all_flights[$id]['altitude_real'], $this->all_flights[$id]['heading'], $this->all_flights[$id]['speed'], $this->all_flights[$id]['datetime'], $this->all_flights[$id]['departure_airport_time'], $this->all_flights[$id]['arrival_airport_time'], $this->all_flights[$id]['squawk'], $this->all_flights[$id]['route_stop'], $highlight, $this->all_flights[$id]['hex'], $this->all_flights[$id]['registration'], $this->all_flights[$id]['pilot_id'], $this->all_flights[$id]['pilot_name'], $this->all_flights[$id]['verticalrate'], $this->all_flights[$id]['ground'], $this->all_flights[$id]['format_source'], $this->all_flights[$id]['source_name'], $this->all_flights[$id]['source_type']); |
|
830 | 830 | $Spotter->db = null; |
831 | 831 | if ($globalDebug && isset($result)) echo $result."\n"; |
832 | 832 | } |
833 | 833 | } |
834 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update addspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
834 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update addspotterdata : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
835 | 835 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
836 | 836 | |
837 | 837 | // Add source stat in DB |
838 | 838 | $Stats = new Stats($this->db); |
839 | 839 | if (!empty($this->stats)) { |
840 | 840 | if ($globalDebug) echo 'Add source stats : '; |
841 | - foreach($this->stats as $date => $data) { |
|
842 | - foreach($data as $source => $sourced) { |
|
841 | + foreach ($this->stats as $date => $data) { |
|
842 | + foreach ($data as $source => $sourced) { |
|
843 | 843 | //print_r($sourced); |
844 | - if (isset($sourced['polar'])) echo $Stats->addStatSource(json_encode($sourced['polar']),$source,'polar',$date); |
|
845 | - if (isset($sourced['hist'])) echo $Stats->addStatSource(json_encode($sourced['hist']),$source,'hist',$date); |
|
844 | + if (isset($sourced['polar'])) echo $Stats->addStatSource(json_encode($sourced['polar']), $source, 'polar', $date); |
|
845 | + if (isset($sourced['hist'])) echo $Stats->addStatSource(json_encode($sourced['hist']), $source, 'hist', $date); |
|
846 | 846 | if (isset($sourced['msg'])) { |
847 | 847 | if (time() - $sourced['msg']['date'] > 10) { |
848 | 848 | $nbmsg = round($sourced['msg']['nb']/(time() - $sourced['msg']['date'])); |
849 | - echo $Stats->addStatSource($nbmsg,$source,'msg',$date); |
|
849 | + echo $Stats->addStatSource($nbmsg, $source, 'msg', $date); |
|
850 | 850 | unset($this->stats[$date][$source]['msg']); |
851 | 851 | } |
852 | 852 | } |
@@ -884,14 +884,14 @@ discard block |
||
884 | 884 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
885 | 885 | $SpotterLive = new SpotterLive($this->db); |
886 | 886 | $SpotterLive->deleteLiveSpotterData(); |
887 | - $SpotterLive->db=null; |
|
887 | + $SpotterLive->db = null; |
|
888 | 888 | } |
889 | 889 | } |
890 | 890 | if ($globalDebug) echo " Done\n"; |
891 | 891 | $this->last_delete = time(); |
892 | 892 | } |
893 | 893 | } else { |
894 | - if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'aircraftjson' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw' || $line['format_source'] === 'deltadbtxt'|| $line['format_source'] === 'planeupdatefaa' || $line['format_source'] === 'aprs' || $line['format_source'] === 'aircraftlistjson' || $line['format_source'] === 'famaprs' || $line['format_source'] === 'airwhere')) { |
|
894 | + if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'aircraftjson' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw' || $line['format_source'] === 'deltadbtxt' || $line['format_source'] === 'planeupdatefaa' || $line['format_source'] === 'aprs' || $line['format_source'] === 'aircraftlistjson' || $line['format_source'] === 'famaprs' || $line['format_source'] === 'airwhere')) { |
|
895 | 895 | $this->all_flights[$id]['id'] = $recent_ident; |
896 | 896 | $this->all_flights[$id]['addedSpotter'] = 1; |
897 | 897 | } |
@@ -899,7 +899,7 @@ discard block |
||
899 | 899 | if (!isset($globalNoImport) || $globalNoImport === FALSE) { |
900 | 900 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
901 | 901 | $Spotter = new Spotter($this->db); |
902 | - $Spotter->updateLatestSpotterData($this->all_flights[$id]['id'],$this->all_flights[$id]['ident'],$this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],$this->all_flights[$id]['altitude'],$this->all_flights[$id]['altitude_real'],$this->all_flights[$id]['ground'],$this->all_flights[$id]['speed'],$this->all_flights[$id]['datetime'],$this->all_flights[$id]['arrival_airport'],$this->all_flights[$id]['arrival_airport_time']); |
|
902 | + $Spotter->updateLatestSpotterData($this->all_flights[$id]['id'], $this->all_flights[$id]['ident'], $this->all_flights[$id]['latitude'], $this->all_flights[$id]['longitude'], $this->all_flights[$id]['altitude'], $this->all_flights[$id]['altitude_real'], $this->all_flights[$id]['ground'], $this->all_flights[$id]['speed'], $this->all_flights[$id]['datetime'], $this->all_flights[$id]['arrival_airport'], $this->all_flights[$id]['arrival_airport_time']); |
|
903 | 903 | $Spotter->db = null; |
904 | 904 | } |
905 | 905 | } |
@@ -925,37 +925,37 @@ discard block |
||
925 | 925 | if ($this->all_flights[$id]['departure_airport'] == "") { $this->all_flights[$id]['departure_airport'] = "NA"; } |
926 | 926 | if ($this->all_flights[$id]['arrival_airport'] == "") { $this->all_flights[$id]['arrival_airport'] = "NA"; } |
927 | 927 | |
928 | - foreach($globalAirportIgnore as $airportIgnore) { |
|
928 | + foreach ($globalAirportIgnore as $airportIgnore) { |
|
929 | 929 | if (($this->all_flights[$id]['departure_airport'] == $airportIgnore) || ($this->all_flights[$id]['arrival_airport'] == $airportIgnore)) { |
930 | 930 | $ignoreImport = true; |
931 | 931 | } |
932 | 932 | } |
933 | 933 | if (count($globalAirportAccept) > 0) { |
934 | 934 | $ignoreImport = true; |
935 | - foreach($globalAirportIgnore as $airportIgnore) { |
|
935 | + foreach ($globalAirportIgnore as $airportIgnore) { |
|
936 | 936 | if (($this->all_flights[$id]['departure_airport'] == $airportIgnore) || ($this->all_flights[$id]['arrival_airport'] == $airportIgnore)) { |
937 | 937 | $ignoreImport = false; |
938 | 938 | } |
939 | 939 | } |
940 | 940 | } |
941 | 941 | if (isset($globalAirlineIgnore) && is_array($globalAirlineIgnore)) { |
942 | - foreach($globalAirlineIgnore as $airlineIgnore) { |
|
943 | - if ((is_numeric(substr(substr($this->all_flights[$id]['ident'],0,4),-1,1)) && substr($this->all_flights[$id]['ident'],0,3) == $airlineIgnore) || (is_numeric(substr(substr($this->all_flights[$id]['ident'],0,3),-1,1)) && substr($this->all_flights[$id]['ident'],0,2) == $airlineIgnore)) { |
|
942 | + foreach ($globalAirlineIgnore as $airlineIgnore) { |
|
943 | + if ((is_numeric(substr(substr($this->all_flights[$id]['ident'], 0, 4), -1, 1)) && substr($this->all_flights[$id]['ident'], 0, 3) == $airlineIgnore) || (is_numeric(substr(substr($this->all_flights[$id]['ident'], 0, 3), -1, 1)) && substr($this->all_flights[$id]['ident'], 0, 2) == $airlineIgnore)) { |
|
944 | 944 | $ignoreImport = true; |
945 | 945 | } |
946 | 946 | } |
947 | 947 | } |
948 | 948 | if (isset($globalAirlineAccept) && count($globalAirlineAccept) > 0) { |
949 | 949 | $ignoreImport = true; |
950 | - foreach($globalAirlineAccept as $airlineAccept) { |
|
951 | - if ((is_numeric(substr(substr($this->all_flights[$id]['ident'],0,4),-1,1)) && substr($this->all_flights[$id]['ident'],0,3) == $airlineAccept) || (is_numeric(substr(substr($this->all_flights[$id]['ident'],0,3),-1,1)) && substr($this->all_flights[$id]['ident'],0,2) == $airlineAccept)) { |
|
950 | + foreach ($globalAirlineAccept as $airlineAccept) { |
|
951 | + if ((is_numeric(substr(substr($this->all_flights[$id]['ident'], 0, 4), -1, 1)) && substr($this->all_flights[$id]['ident'], 0, 3) == $airlineAccept) || (is_numeric(substr(substr($this->all_flights[$id]['ident'], 0, 3), -1, 1)) && substr($this->all_flights[$id]['ident'], 0, 2) == $airlineAccept)) { |
|
952 | 952 | $ignoreImport = false; |
953 | 953 | } |
954 | 954 | } |
955 | 955 | } |
956 | 956 | if (isset($globalPilotIdAccept) && count($globalPilotIdAccept) > 0) { |
957 | 957 | $ignoreImport = true; |
958 | - foreach($globalPilotIdAccept as $pilotIdAccept) { |
|
958 | + foreach ($globalPilotIdAccept as $pilotIdAccept) { |
|
959 | 959 | if ($this->all_flights[$id]['pilot_id'] == $pilotIdAccept) { |
960 | 960 | $ignoreImport = false; |
961 | 961 | } |
@@ -963,23 +963,23 @@ discard block |
||
963 | 963 | } |
964 | 964 | |
965 | 965 | if (!$ignoreImport) { |
966 | - if (!isset($globalDistanceIgnore['latitude']) || (isset($globalDistanceIgnore['latitude']) && $Common->distance($this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude']) < $globalDistanceIgnore['distance'])) { |
|
967 | - if (!isset($this->all_flights[$id]['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.date('YmdHi'))); |
|
966 | + if (!isset($globalDistanceIgnore['latitude']) || (isset($globalDistanceIgnore['latitude']) && $Common->distance($this->all_flights[$id]['latitude'], $this->all_flights[$id]['longitude'], $globalDistanceIgnore['latitude'], $globalDistanceIgnore['longitude']) < $globalDistanceIgnore['distance'])) { |
|
967 | + if (!isset($this->all_flights[$id]['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id], array('id' => $this->all_flights[$id]['hex'].'-'.date('YmdHi'))); |
|
968 | 968 | $timeelapsed = microtime(true); |
969 | 969 | if (!isset($globalNoImport) || $globalNoImport === FALSE) { |
970 | 970 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
971 | 971 | if ($globalDebug) echo "\o/ Add ".$this->all_flights[$id]['ident']." from ".$this->all_flights[$id]['format_source']." in Live DB : "; |
972 | 972 | $SpotterLive = new SpotterLive($this->db); |
973 | - $result = $SpotterLive->addLiveSpotterData($this->all_flights[$id]['id'], $this->all_flights[$id]['ident'], $this->all_flights[$id]['aircraft_icao'], $this->all_flights[$id]['departure_airport'], $this->all_flights[$id]['arrival_airport'], $this->all_flights[$id]['latitude'], $this->all_flights[$id]['longitude'], $this->all_flights[$id]['waypoints'], $this->all_flights[$id]['altitude'],$this->all_flights[$id]['altitude_real'], $this->all_flights[$id]['heading'], $this->all_flights[$id]['speed'],$this->all_flights[$id]['datetime'], $this->all_flights[$id]['departure_airport_time'], $this->all_flights[$id]['arrival_airport_time'], $this->all_flights[$id]['squawk'],$this->all_flights[$id]['route_stop'],$this->all_flights[$id]['hex'],$this->all_flights[$id]['putinarchive'],$this->all_flights[$id]['registration'],$this->all_flights[$id]['pilot_id'],$this->all_flights[$id]['pilot_name'], $this->all_flights[$id]['verticalrate'], $this->all_flights[$id]['noarchive'], $this->all_flights[$id]['ground'],$this->all_flights[$id]['format_source'],$this->all_flights[$id]['source_name'],$this->all_flights[$id]['over_country']); |
|
973 | + $result = $SpotterLive->addLiveSpotterData($this->all_flights[$id]['id'], $this->all_flights[$id]['ident'], $this->all_flights[$id]['aircraft_icao'], $this->all_flights[$id]['departure_airport'], $this->all_flights[$id]['arrival_airport'], $this->all_flights[$id]['latitude'], $this->all_flights[$id]['longitude'], $this->all_flights[$id]['waypoints'], $this->all_flights[$id]['altitude'], $this->all_flights[$id]['altitude_real'], $this->all_flights[$id]['heading'], $this->all_flights[$id]['speed'], $this->all_flights[$id]['datetime'], $this->all_flights[$id]['departure_airport_time'], $this->all_flights[$id]['arrival_airport_time'], $this->all_flights[$id]['squawk'], $this->all_flights[$id]['route_stop'], $this->all_flights[$id]['hex'], $this->all_flights[$id]['putinarchive'], $this->all_flights[$id]['registration'], $this->all_flights[$id]['pilot_id'], $this->all_flights[$id]['pilot_name'], $this->all_flights[$id]['verticalrate'], $this->all_flights[$id]['noarchive'], $this->all_flights[$id]['ground'], $this->all_flights[$id]['format_source'], $this->all_flights[$id]['source_name'], $this->all_flights[$id]['over_country']); |
|
974 | 974 | $SpotterLive->db = null; |
975 | 975 | if ($globalDebug) echo $result."\n"; |
976 | 976 | } |
977 | 977 | } |
978 | 978 | if (isset($globalServerAPRS) && $globalServerAPRS && $this->all_flights[$id]['putinarchive']) { |
979 | - $APRSSpotter->addLiveSpotterData($this->all_flights[$id]['id'], $this->all_flights[$id]['ident'], $this->all_flights[$id]['aircraft_icao'], $this->all_flights[$id]['departure_airport'], $this->all_flights[$id]['arrival_airport'], $this->all_flights[$id]['latitude'], $this->all_flights[$id]['longitude'], $this->all_flights[$id]['waypoints'], $this->all_flights[$id]['altitude'], $this->all_flights[$id]['altitude_real'], $this->all_flights[$id]['heading'], $this->all_flights[$id]['speed'],$this->all_flights[$id]['datetime'], $this->all_flights[$id]['departure_airport_time'], $this->all_flights[$id]['arrival_airport_time'], $this->all_flights[$id]['squawk'],$this->all_flights[$id]['route_stop'],$this->all_flights[$id]['hex'],$this->all_flights[$id]['putinarchive'],$this->all_flights[$id]['registration'],$this->all_flights[$id]['pilot_id'],$this->all_flights[$id]['pilot_name'], $this->all_flights[$id]['verticalrate'], $this->all_flights[$id]['noarchive'], $this->all_flights[$id]['ground'],$this->all_flights[$id]['format_source'],$this->all_flights[$id]['source_name'],$this->all_flights[$id]['over_country']); |
|
979 | + $APRSSpotter->addLiveSpotterData($this->all_flights[$id]['id'], $this->all_flights[$id]['ident'], $this->all_flights[$id]['aircraft_icao'], $this->all_flights[$id]['departure_airport'], $this->all_flights[$id]['arrival_airport'], $this->all_flights[$id]['latitude'], $this->all_flights[$id]['longitude'], $this->all_flights[$id]['waypoints'], $this->all_flights[$id]['altitude'], $this->all_flights[$id]['altitude_real'], $this->all_flights[$id]['heading'], $this->all_flights[$id]['speed'], $this->all_flights[$id]['datetime'], $this->all_flights[$id]['departure_airport_time'], $this->all_flights[$id]['arrival_airport_time'], $this->all_flights[$id]['squawk'], $this->all_flights[$id]['route_stop'], $this->all_flights[$id]['hex'], $this->all_flights[$id]['putinarchive'], $this->all_flights[$id]['registration'], $this->all_flights[$id]['pilot_id'], $this->all_flights[$id]['pilot_name'], $this->all_flights[$id]['verticalrate'], $this->all_flights[$id]['noarchive'], $this->all_flights[$id]['ground'], $this->all_flights[$id]['format_source'], $this->all_flights[$id]['source_name'], $this->all_flights[$id]['over_country']); |
|
980 | 980 | } |
981 | 981 | $this->all_flights[$id]['putinarchive'] = false; |
982 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update addlivespotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
982 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update addlivespotterdata : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
983 | 983 | |
984 | 984 | // Put statistics in $this->stats variable |
985 | 985 | //if ($line['format_source'] != 'aprs') { |
@@ -998,19 +998,19 @@ discard block |
||
998 | 998 | $latitude = $globalCenterLatitude; |
999 | 999 | $longitude = $globalCenterLongitude; |
1000 | 1000 | } |
1001 | - $this->source_location[$source] = array('latitude' => $latitude,'longitude' => $longitude); |
|
1001 | + $this->source_location[$source] = array('latitude' => $latitude, 'longitude' => $longitude); |
|
1002 | 1002 | } else { |
1003 | 1003 | $latitude = $this->source_location[$source]['latitude']; |
1004 | 1004 | $longitude = $this->source_location[$source]['longitude']; |
1005 | 1005 | } |
1006 | - $stats_heading = $Common->getHeading($latitude,$longitude,$this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude']); |
|
1006 | + $stats_heading = $Common->getHeading($latitude, $longitude, $this->all_flights[$id]['latitude'], $this->all_flights[$id]['longitude']); |
|
1007 | 1007 | //$stats_heading = $stats_heading%22.5; |
1008 | 1008 | $stats_heading = round($stats_heading/22.5); |
1009 | - $stats_distance = $Common->distance($latitude,$longitude,$this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude']); |
|
1009 | + $stats_distance = $Common->distance($latitude, $longitude, $this->all_flights[$id]['latitude'], $this->all_flights[$id]['longitude']); |
|
1010 | 1010 | $current_date = date('Y-m-d'); |
1011 | 1011 | if ($stats_heading == 16) $stats_heading = 0; |
1012 | 1012 | if (!isset($this->stats[$current_date][$source]['polar'][1])) { |
1013 | - for ($i=0;$i<=15;$i++) { |
|
1013 | + for ($i = 0; $i <= 15; $i++) { |
|
1014 | 1014 | $this->stats[$current_date][$source]['polar'][$i] = 0; |
1015 | 1015 | } |
1016 | 1016 | $this->stats[$current_date][$source]['polar'][$stats_heading] = $stats_distance; |
@@ -1025,9 +1025,9 @@ discard block |
||
1025 | 1025 | if (!isset($this->stats[$current_date][$source]['hist'][$distance])) { |
1026 | 1026 | if (isset($this->stats[$current_date][$source]['hist'][0])) { |
1027 | 1027 | end($this->stats[$current_date][$source]['hist']); |
1028 | - $mini = key($this->stats[$current_date][$source]['hist'])+10; |
|
1028 | + $mini = key($this->stats[$current_date][$source]['hist']) + 10; |
|
1029 | 1029 | } else $mini = 0; |
1030 | - for ($i=$mini;$i<=$distance;$i+=10) { |
|
1030 | + for ($i = $mini; $i <= $distance; $i += 10) { |
|
1031 | 1031 | $this->stats[$current_date][$source]['hist'][$i] = 0; |
1032 | 1032 | } |
1033 | 1033 | $this->stats[$current_date][$source]['hist'][$distance] = 1; |
@@ -1040,7 +1040,7 @@ discard block |
||
1040 | 1040 | $this->all_flights[$id]['lastupdate'] = time(); |
1041 | 1041 | if ($this->all_flights[$id]['putinarchive']) $send = true; |
1042 | 1042 | //if ($globalDebug) echo "Distance : ".Common->distance($this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude'])."\n"; |
1043 | - } elseif (isset($this->all_flights[$id]['latitude']) && isset($globalDistanceIgnore['latitude']) && $globalDebug) echo "!! Too far -> Distance : ".$Common->distance($this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude'])."\n"; |
|
1043 | + } elseif (isset($this->all_flights[$id]['latitude']) && isset($globalDistanceIgnore['latitude']) && $globalDebug) echo "!! Too far -> Distance : ".$Common->distance($this->all_flights[$id]['latitude'], $this->all_flights[$id]['longitude'], $globalDistanceIgnore['latitude'], $globalDistanceIgnore['longitude'])."\n"; |
|
1044 | 1044 | //$this->del(); |
1045 | 1045 | |
1046 | 1046 | if ($this->last_delete_hourly == 0 || time() - $this->last_delete_hourly > 900) { |
@@ -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(); |
@@ -136,11 +136,11 @@ discard block |
||
136 | 136 | } |
137 | 137 | |
138 | 138 | /** |
139 | - * Gets all the spotter information based on the latest data entry |
|
140 | - * |
|
141 | - * @return Array the spotter information |
|
142 | - * |
|
143 | - */ |
|
139 | + * Gets all the spotter information based on the latest data entry |
|
140 | + * |
|
141 | + * @return Array the spotter information |
|
142 | + * |
|
143 | + */ |
|
144 | 144 | public function getLiveSpotterData($limit = '', $sort = '', $filter = array()) |
145 | 145 | { |
146 | 146 | global $globalDBdriver, $globalLiveInterval; |
@@ -183,11 +183,11 @@ discard block |
||
183 | 183 | } |
184 | 184 | |
185 | 185 | /** |
186 | - * Gets Minimal Live Spotter data |
|
187 | - * |
|
188 | - * @return Array the spotter information |
|
189 | - * |
|
190 | - */ |
|
186 | + * Gets Minimal Live Spotter data |
|
187 | + * |
|
188 | + * @return Array the spotter information |
|
189 | + * |
|
190 | + */ |
|
191 | 191 | public function getMinLiveSpotterData($filter = array()) |
192 | 192 | { |
193 | 193 | global $globalDBdriver, $globalLiveInterval, $globalArchive; |
@@ -224,11 +224,11 @@ discard block |
||
224 | 224 | } |
225 | 225 | |
226 | 226 | /** |
227 | - * Gets Minimal Live Spotter data since xx seconds |
|
228 | - * |
|
229 | - * @return Array the spotter information |
|
230 | - * |
|
231 | - */ |
|
227 | + * Gets Minimal Live Spotter data since xx seconds |
|
228 | + * |
|
229 | + * @return Array the spotter information |
|
230 | + * |
|
231 | + */ |
|
232 | 232 | public function getMinLastLiveSpotterData($coord = array(),$filter = array(), $limit = false, $id = '') |
233 | 233 | { |
234 | 234 | global $globalDBdriver, $globalLiveInterval, $globalArchive, $globalMap3DAircraftsLimit; |
@@ -320,11 +320,11 @@ discard block |
||
320 | 320 | } |
321 | 321 | |
322 | 322 | /** |
323 | - * Gets number of latest data entry |
|
324 | - * |
|
325 | - * @return String number of entry |
|
326 | - * |
|
327 | - */ |
|
323 | + * Gets number of latest data entry |
|
324 | + * |
|
325 | + * @return String number of entry |
|
326 | + * |
|
327 | + */ |
|
328 | 328 | public function getLiveSpotterCount($filter = array()) |
329 | 329 | { |
330 | 330 | global $globalDBdriver, $globalLiveInterval; |
@@ -351,11 +351,11 @@ discard block |
||
351 | 351 | } |
352 | 352 | |
353 | 353 | /** |
354 | - * Gets all the spotter information based on the latest data entry and coord |
|
355 | - * |
|
356 | - * @return Array the spotter information |
|
357 | - * |
|
358 | - */ |
|
354 | + * Gets all the spotter information based on the latest data entry and coord |
|
355 | + * |
|
356 | + * @return Array the spotter information |
|
357 | + * |
|
358 | + */ |
|
359 | 359 | public function getLiveSpotterDatabyCoord($coord, $filter = array()) |
360 | 360 | { |
361 | 361 | global $globalDBdriver, $globalLiveInterval; |
@@ -380,11 +380,11 @@ discard block |
||
380 | 380 | } |
381 | 381 | |
382 | 382 | /** |
383 | - * Gets all the spotter information based on the latest data entry and coord |
|
384 | - * |
|
385 | - * @return Array the spotter information |
|
386 | - * |
|
387 | - */ |
|
383 | + * Gets all the spotter information based on the latest data entry and coord |
|
384 | + * |
|
385 | + * @return Array the spotter information |
|
386 | + * |
|
387 | + */ |
|
388 | 388 | public function getMinLiveSpotterDatabyCoord($coord, $filter = array()) |
389 | 389 | { |
390 | 390 | global $globalDBdriver, $globalLiveInterval, $globalArchive; |
@@ -449,11 +449,11 @@ discard block |
||
449 | 449 | } |
450 | 450 | |
451 | 451 | /** |
452 | - * Gets all the spotter information based on a user's latitude and longitude |
|
453 | - * |
|
454 | - * @return Array the spotter information |
|
455 | - * |
|
456 | - */ |
|
452 | + * Gets all the spotter information based on a user's latitude and longitude |
|
453 | + * |
|
454 | + * @return Array the spotter information |
|
455 | + * |
|
456 | + */ |
|
457 | 457 | public function getLatestSpotterForLayar($lat, $lng, $radius, $interval) |
458 | 458 | { |
459 | 459 | $Spotter = new Spotter($this->db); |
@@ -463,98 +463,98 @@ discard block |
||
463 | 463 | return false; |
464 | 464 | } |
465 | 465 | } |
466 | - if ($lng != '') |
|
467 | - { |
|
468 | - if (!is_numeric($lng)) |
|
469 | - { |
|
470 | - return false; |
|
471 | - } |
|
472 | - } |
|
473 | - |
|
474 | - if ($radius != '') |
|
475 | - { |
|
476 | - if (!is_numeric($radius)) |
|
477 | - { |
|
478 | - return false; |
|
479 | - } |
|
480 | - } |
|
466 | + if ($lng != '') |
|
467 | + { |
|
468 | + if (!is_numeric($lng)) |
|
469 | + { |
|
470 | + return false; |
|
471 | + } |
|
472 | + } |
|
473 | + |
|
474 | + if ($radius != '') |
|
475 | + { |
|
476 | + if (!is_numeric($radius)) |
|
477 | + { |
|
478 | + return false; |
|
479 | + } |
|
480 | + } |
|
481 | 481 | $additional_query = ''; |
482 | - if ($interval != '') |
|
483 | - { |
|
484 | - if (!is_string($interval)) |
|
485 | - { |
|
486 | - //$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= spotter_live.date '; |
|
487 | - return false; |
|
488 | - } else { |
|
489 | - if ($interval == '1m') |
|
490 | - { |
|
491 | - $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= spotter_live.date '; |
|
492 | - } else if ($interval == '15m'){ |
|
493 | - $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 15 MINUTE) <= spotter_live.date '; |
|
494 | - } |
|
495 | - } |
|
496 | - } else { |
|
497 | - $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= spotter_live.date '; |
|
498 | - } |
|
499 | - |
|
500 | - $query = "SELECT spotter_live.*, ( 6371 * acos( cos( radians(:lat) ) * cos( radians( latitude ) ) * cos( radians( longitude ) - radians(:lng) ) + sin( radians(:lat) ) * sin( radians( latitude ) ) ) ) AS distance FROM spotter_live |
|
482 | + if ($interval != '') |
|
483 | + { |
|
484 | + if (!is_string($interval)) |
|
485 | + { |
|
486 | + //$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= spotter_live.date '; |
|
487 | + return false; |
|
488 | + } else { |
|
489 | + if ($interval == '1m') |
|
490 | + { |
|
491 | + $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= spotter_live.date '; |
|
492 | + } else if ($interval == '15m'){ |
|
493 | + $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 15 MINUTE) <= spotter_live.date '; |
|
494 | + } |
|
495 | + } |
|
496 | + } else { |
|
497 | + $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= spotter_live.date '; |
|
498 | + } |
|
499 | + |
|
500 | + $query = "SELECT spotter_live.*, ( 6371 * acos( cos( radians(:lat) ) * cos( radians( latitude ) ) * cos( radians( longitude ) - radians(:lng) ) + sin( radians(:lat) ) * sin( radians( latitude ) ) ) ) AS distance FROM spotter_live |
|
501 | 501 | WHERE spotter_live.latitude <> '' |
502 | 502 | AND spotter_live.longitude <> '' |
503 | 503 | ".$additional_query." |
504 | 504 | HAVING distance < :radius |
505 | 505 | ORDER BY distance"; |
506 | 506 | |
507 | - $spotter_array = $Spotter->getDataFromDB($query, array(':lat' => $lat, ':lng' => $lng,':radius' => $radius)); |
|
507 | + $spotter_array = $Spotter->getDataFromDB($query, array(':lat' => $lat, ':lng' => $lng,':radius' => $radius)); |
|
508 | 508 | |
509 | - return $spotter_array; |
|
510 | - } |
|
509 | + return $spotter_array; |
|
510 | + } |
|
511 | 511 | |
512 | 512 | |
513 | - /** |
|
514 | - * Gets all the spotter information based on a particular callsign |
|
515 | - * |
|
516 | - * @return Array the spotter information |
|
517 | - * |
|
518 | - */ |
|
513 | + /** |
|
514 | + * Gets all the spotter information based on a particular callsign |
|
515 | + * |
|
516 | + * @return Array the spotter information |
|
517 | + * |
|
518 | + */ |
|
519 | 519 | public function getLastLiveSpotterDataByIdent($ident) |
520 | 520 | { |
521 | 521 | $Spotter = new Spotter($this->db); |
522 | 522 | date_default_timezone_set('UTC'); |
523 | 523 | |
524 | 524 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
525 | - $query = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.ident = :ident GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC'; |
|
525 | + $query = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.ident = :ident GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC'; |
|
526 | 526 | |
527 | 527 | $spotter_array = $Spotter->getDataFromDB($query,array(':ident' => $ident),'',true); |
528 | 528 | |
529 | 529 | return $spotter_array; |
530 | 530 | } |
531 | 531 | |
532 | - /** |
|
533 | - * Gets all the spotter information based on a particular callsign |
|
534 | - * |
|
535 | - * @return Array the spotter information |
|
536 | - * |
|
537 | - */ |
|
532 | + /** |
|
533 | + * Gets all the spotter information based on a particular callsign |
|
534 | + * |
|
535 | + * @return Array the spotter information |
|
536 | + * |
|
537 | + */ |
|
538 | 538 | public function getDateLiveSpotterDataByIdent($ident,$date) |
539 | 539 | { |
540 | 540 | $Spotter = new Spotter($this->db); |
541 | 541 | date_default_timezone_set('UTC'); |
542 | 542 | |
543 | 543 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
544 | - $query = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.ident = :ident AND l.date <= :date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC'; |
|
544 | + $query = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.ident = :ident AND l.date <= :date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC'; |
|
545 | 545 | |
546 | - $date = date('c',$date); |
|
546 | + $date = date('c',$date); |
|
547 | 547 | $spotter_array = $Spotter->getDataFromDB($query,array(':ident' => $ident,':date' => $date)); |
548 | 548 | |
549 | 549 | return $spotter_array; |
550 | 550 | } |
551 | 551 | |
552 | - /** |
|
553 | - * Gets last spotter information based on a particular callsign |
|
554 | - * |
|
555 | - * @return Array the spotter information |
|
556 | - * |
|
557 | - */ |
|
552 | + /** |
|
553 | + * Gets last spotter information based on a particular callsign |
|
554 | + * |
|
555 | + * @return Array the spotter information |
|
556 | + * |
|
557 | + */ |
|
558 | 558 | public function getLastLiveSpotterDataById($id) |
559 | 559 | { |
560 | 560 | $Spotter = new Spotter($this->db); |
@@ -565,12 +565,12 @@ discard block |
||
565 | 565 | return $spotter_array; |
566 | 566 | } |
567 | 567 | |
568 | - /** |
|
569 | - * Gets last spotter information based on a particular callsign |
|
570 | - * |
|
571 | - * @return Array the spotter information |
|
572 | - * |
|
573 | - */ |
|
568 | + /** |
|
569 | + * Gets last spotter information based on a particular callsign |
|
570 | + * |
|
571 | + * @return Array the spotter information |
|
572 | + * |
|
573 | + */ |
|
574 | 574 | public function getDateLiveSpotterDataById($id,$date) |
575 | 575 | { |
576 | 576 | $Spotter = new Spotter($this->db); |
@@ -583,21 +583,21 @@ discard block |
||
583 | 583 | return $spotter_array; |
584 | 584 | } |
585 | 585 | |
586 | - /** |
|
587 | - * Gets altitude information based on a particular callsign |
|
588 | - * |
|
589 | - * @return Array the spotter information |
|
590 | - * |
|
591 | - */ |
|
586 | + /** |
|
587 | + * Gets altitude information based on a particular callsign |
|
588 | + * |
|
589 | + * @return Array the spotter information |
|
590 | + * |
|
591 | + */ |
|
592 | 592 | public function getAltitudeLiveSpotterDataByIdent($ident) |
593 | 593 | { |
594 | 594 | |
595 | 595 | date_default_timezone_set('UTC'); |
596 | 596 | |
597 | 597 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
598 | - $query = 'SELECT spotter_live.altitude, spotter_live.date FROM spotter_live WHERE spotter_live.ident = :ident'; |
|
598 | + $query = 'SELECT spotter_live.altitude, spotter_live.date FROM spotter_live WHERE spotter_live.ident = :ident'; |
|
599 | 599 | |
600 | - try { |
|
600 | + try { |
|
601 | 601 | |
602 | 602 | $sth = $this->db->prepare($query); |
603 | 603 | $sth->execute(array(':ident' => $ident)); |
@@ -610,12 +610,12 @@ discard block |
||
610 | 610 | return $spotter_array; |
611 | 611 | } |
612 | 612 | |
613 | - /** |
|
614 | - * Gets all the spotter information based on a particular id |
|
615 | - * |
|
616 | - * @return Array the spotter information |
|
617 | - * |
|
618 | - */ |
|
613 | + /** |
|
614 | + * Gets all the spotter information based on a particular id |
|
615 | + * |
|
616 | + * @return Array the spotter information |
|
617 | + * |
|
618 | + */ |
|
619 | 619 | public function getAllLiveSpotterDataById($id,$liveinterval = false) |
620 | 620 | { |
621 | 621 | global $globalDBdriver, $globalLiveInterval; |
@@ -643,18 +643,18 @@ discard block |
||
643 | 643 | return $spotter_array; |
644 | 644 | } |
645 | 645 | |
646 | - /** |
|
647 | - * Gets all the spotter information based on a particular ident |
|
648 | - * |
|
649 | - * @return Array the spotter information |
|
650 | - * |
|
651 | - */ |
|
646 | + /** |
|
647 | + * Gets all the spotter information based on a particular ident |
|
648 | + * |
|
649 | + * @return Array the spotter information |
|
650 | + * |
|
651 | + */ |
|
652 | 652 | public function getAllLiveSpotterDataByIdent($ident) |
653 | 653 | { |
654 | 654 | date_default_timezone_set('UTC'); |
655 | 655 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
656 | 656 | $query = self::$global_query.' WHERE spotter_live.ident = :ident'; |
657 | - try { |
|
657 | + try { |
|
658 | 658 | |
659 | 659 | $sth = $this->db->prepare($query); |
660 | 660 | $sth->execute(array(':ident' => $ident)); |
@@ -668,23 +668,23 @@ discard block |
||
668 | 668 | |
669 | 669 | |
670 | 670 | /** |
671 | - * Deletes all info in the table |
|
672 | - * |
|
673 | - * @return String success or false |
|
674 | - * |
|
675 | - */ |
|
671 | + * Deletes all info in the table |
|
672 | + * |
|
673 | + * @return String success or false |
|
674 | + * |
|
675 | + */ |
|
676 | 676 | public function deleteLiveSpotterData() |
677 | 677 | { |
678 | 678 | global $globalDBdriver; |
679 | 679 | if ($globalDBdriver == 'mysql') { |
680 | 680 | //$query = "DELETE FROM spotter_live WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL 30 MINUTE) >= spotter_live.date"; |
681 | 681 | $query = 'DELETE FROM spotter_live WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL 9 HOUR) >= spotter_live.date'; |
682 | - //$query = "DELETE FROM spotter_live WHERE spotter_live.id IN (SELECT spotter_live.id FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 HOUR) >= spotter_live.date)"; |
|
682 | + //$query = "DELETE FROM spotter_live WHERE spotter_live.id IN (SELECT spotter_live.id FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 HOUR) >= spotter_live.date)"; |
|
683 | 683 | } else { |
684 | 684 | $query = "DELETE FROM spotter_live WHERE NOW() AT TIME ZONE 'UTC' - INTERVAL '9 HOURS' >= spotter_live.date"; |
685 | 685 | } |
686 | 686 | |
687 | - try { |
|
687 | + try { |
|
688 | 688 | |
689 | 689 | $sth = $this->db->prepare($query); |
690 | 690 | $sth->execute(); |
@@ -696,18 +696,18 @@ discard block |
||
696 | 696 | } |
697 | 697 | |
698 | 698 | /** |
699 | - * Deletes all info in the table for aircraft not seen since 2 HOUR |
|
700 | - * |
|
701 | - * @return String success or false |
|
702 | - * |
|
703 | - */ |
|
699 | + * Deletes all info in the table for aircraft not seen since 2 HOUR |
|
700 | + * |
|
701 | + * @return String success or false |
|
702 | + * |
|
703 | + */ |
|
704 | 704 | public function deleteLiveSpotterDataNotUpdated() |
705 | 705 | { |
706 | 706 | global $globalDBdriver, $globalDebug; |
707 | 707 | if ($globalDBdriver == 'mysql') { |
708 | 708 | //$query = 'SELECT flightaware_id FROM spotter_live WHERE DATE_SUB(UTC_TIMESTAMP(), INTERVAL 1 HOUR) >= spotter_live.date AND spotter_live.flightaware_id NOT IN (SELECT flightaware_id FROM spotter_live WHERE DATE_SUB(UTC_TIMESTAMP(), INTERVAL 1 HOUR) < spotter_live.date) LIMIT 800 OFFSET 0'; |
709 | - $query = "SELECT spotter_live.flightaware_id FROM spotter_live INNER JOIN (SELECT flightaware_id,MAX(date) as max_date FROM spotter_live GROUP BY flightaware_id) s ON s.flightaware_id = spotter_live.flightaware_id AND DATE_SUB(UTC_TIMESTAMP(), INTERVAL 2 HOUR) >= s.max_date LIMIT 2000 OFFSET 0"; |
|
710 | - try { |
|
709 | + $query = "SELECT spotter_live.flightaware_id FROM spotter_live INNER JOIN (SELECT flightaware_id,MAX(date) as max_date FROM spotter_live GROUP BY flightaware_id) s ON s.flightaware_id = spotter_live.flightaware_id AND DATE_SUB(UTC_TIMESTAMP(), INTERVAL 2 HOUR) >= s.max_date LIMIT 2000 OFFSET 0"; |
|
710 | + try { |
|
711 | 711 | |
712 | 712 | $sth = $this->db->prepare($query); |
713 | 713 | $sth->execute(); |
@@ -715,8 +715,8 @@ discard block |
||
715 | 715 | return "error"; |
716 | 716 | } |
717 | 717 | $query_delete = 'DELETE FROM spotter_live WHERE flightaware_id IN ('; |
718 | - $i = 0; |
|
719 | - $j =0; |
|
718 | + $i = 0; |
|
719 | + $j =0; |
|
720 | 720 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
721 | 721 | foreach($all as $row) |
722 | 722 | { |
@@ -724,20 +724,20 @@ discard block |
||
724 | 724 | $j++; |
725 | 725 | if ($j == 30) { |
726 | 726 | if ($globalDebug) echo "."; |
727 | - try { |
|
727 | + try { |
|
728 | 728 | |
729 | 729 | $sth = $this->db->prepare(substr($query_delete,0,-1).")"); |
730 | 730 | $sth->execute(); |
731 | 731 | } catch(PDOException $e) { |
732 | 732 | return "error"; |
733 | 733 | } |
734 | - $query_delete = 'DELETE FROM spotter_live WHERE flightaware_id IN ('; |
|
735 | - $j = 0; |
|
734 | + $query_delete = 'DELETE FROM spotter_live WHERE flightaware_id IN ('; |
|
735 | + $j = 0; |
|
736 | 736 | } |
737 | 737 | $query_delete .= "'".$row['flightaware_id']."',"; |
738 | 738 | } |
739 | 739 | if ($i > 0) { |
740 | - try { |
|
740 | + try { |
|
741 | 741 | |
742 | 742 | $sth = $this->db->prepare(substr($query_delete,0,-1).")"); |
743 | 743 | $sth->execute(); |
@@ -748,9 +748,9 @@ discard block |
||
748 | 748 | return "success"; |
749 | 749 | } elseif ($globalDBdriver == 'pgsql') { |
750 | 750 | //$query = "SELECT flightaware_id FROM spotter_live WHERE NOW() AT TIME ZONE 'UTC' - INTERVAL '9 HOURS' >= spotter_live.date AND spotter_live.flightaware_id NOT IN (SELECT flightaware_id FROM spotter_live WHERE NOW() AT TIME ZONE 'UTC' - INTERVAL '9 HOURS' < spotter_live.date) LIMIT 800 OFFSET 0"; |
751 | - //$query = "SELECT spotter_live.flightaware_id FROM spotter_live INNER JOIN (SELECT flightaware_id,MAX(date) as max_date FROM spotter_live GROUP BY flightaware_id) s ON s.flightaware_id = spotter_live.flightaware_id AND NOW() AT TIME ZONE 'UTC' - INTERVAL '2 HOURS' >= s.max_date LIMIT 800 OFFSET 0"; |
|
752 | - $query = "DELETE FROM spotter_live WHERE flightaware_id IN (SELECT spotter_live.flightaware_id FROM spotter_live INNER JOIN (SELECT flightaware_id,MAX(date) as max_date FROM spotter_live GROUP BY flightaware_id) s ON s.flightaware_id = spotter_live.flightaware_id AND NOW() AT TIME ZONE 'UTC' - INTERVAL '2 HOURS' >= s.max_date LIMIT 2000 OFFSET 0)"; |
|
753 | - try { |
|
751 | + //$query = "SELECT spotter_live.flightaware_id FROM spotter_live INNER JOIN (SELECT flightaware_id,MAX(date) as max_date FROM spotter_live GROUP BY flightaware_id) s ON s.flightaware_id = spotter_live.flightaware_id AND NOW() AT TIME ZONE 'UTC' - INTERVAL '2 HOURS' >= s.max_date LIMIT 800 OFFSET 0"; |
|
752 | + $query = "DELETE FROM spotter_live WHERE flightaware_id IN (SELECT spotter_live.flightaware_id FROM spotter_live INNER JOIN (SELECT flightaware_id,MAX(date) as max_date FROM spotter_live GROUP BY flightaware_id) s ON s.flightaware_id = spotter_live.flightaware_id AND NOW() AT TIME ZONE 'UTC' - INTERVAL '2 HOURS' >= s.max_date LIMIT 2000 OFFSET 0)"; |
|
753 | + try { |
|
754 | 754 | |
755 | 755 | $sth = $this->db->prepare($query); |
756 | 756 | $sth->execute(); |
@@ -794,17 +794,17 @@ discard block |
||
794 | 794 | } |
795 | 795 | |
796 | 796 | /** |
797 | - * Deletes all info in the table for an ident |
|
798 | - * |
|
799 | - * @return String success or false |
|
800 | - * |
|
801 | - */ |
|
797 | + * Deletes all info in the table for an ident |
|
798 | + * |
|
799 | + * @return String success or false |
|
800 | + * |
|
801 | + */ |
|
802 | 802 | public function deleteLiveSpotterDataByIdent($ident) |
803 | 803 | { |
804 | 804 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
805 | 805 | $query = 'DELETE FROM spotter_live WHERE ident = :ident'; |
806 | 806 | |
807 | - try { |
|
807 | + try { |
|
808 | 808 | |
809 | 809 | $sth = $this->db->prepare($query); |
810 | 810 | $sth->execute(array(':ident' => $ident)); |
@@ -816,17 +816,17 @@ discard block |
||
816 | 816 | } |
817 | 817 | |
818 | 818 | /** |
819 | - * Deletes all info in the table for an id |
|
820 | - * |
|
821 | - * @return String success or false |
|
822 | - * |
|
823 | - */ |
|
819 | + * Deletes all info in the table for an id |
|
820 | + * |
|
821 | + * @return String success or false |
|
822 | + * |
|
823 | + */ |
|
824 | 824 | public function deleteLiveSpotterDataById($id) |
825 | 825 | { |
826 | 826 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
827 | 827 | $query = 'DELETE FROM spotter_live WHERE flightaware_id = :id'; |
828 | 828 | |
829 | - try { |
|
829 | + try { |
|
830 | 830 | |
831 | 831 | $sth = $this->db->prepare($query); |
832 | 832 | $sth->execute(array(':id' => $id)); |
@@ -839,11 +839,11 @@ discard block |
||
839 | 839 | |
840 | 840 | |
841 | 841 | /** |
842 | - * Gets the aircraft ident within the last hour |
|
843 | - * |
|
844 | - * @return String the ident |
|
845 | - * |
|
846 | - */ |
|
842 | + * Gets the aircraft ident within the last hour |
|
843 | + * |
|
844 | + * @return String the ident |
|
845 | + * |
|
846 | + */ |
|
847 | 847 | public function getIdentFromLastHour($ident) |
848 | 848 | { |
849 | 849 | global $globalDBdriver, $globalTimezone; |
@@ -869,14 +869,14 @@ discard block |
||
869 | 869 | $ident_result = $row['ident']; |
870 | 870 | } |
871 | 871 | return $ident_result; |
872 | - } |
|
872 | + } |
|
873 | 873 | |
874 | 874 | /** |
875 | - * Check recent aircraft |
|
876 | - * |
|
877 | - * @return String the ident |
|
878 | - * |
|
879 | - */ |
|
875 | + * Check recent aircraft |
|
876 | + * |
|
877 | + * @return String the ident |
|
878 | + * |
|
879 | + */ |
|
880 | 880 | public function checkIdentRecent($ident) |
881 | 881 | { |
882 | 882 | global $globalDBdriver, $globalTimezone; |
@@ -902,14 +902,14 @@ discard block |
||
902 | 902 | $ident_result = $row['flightaware_id']; |
903 | 903 | } |
904 | 904 | return $ident_result; |
905 | - } |
|
905 | + } |
|
906 | 906 | |
907 | 907 | /** |
908 | - * Check recent aircraft by id |
|
909 | - * |
|
910 | - * @return String the ident |
|
911 | - * |
|
912 | - */ |
|
908 | + * Check recent aircraft by id |
|
909 | + * |
|
910 | + * @return String the ident |
|
911 | + * |
|
912 | + */ |
|
913 | 913 | public function checkIdRecent($id) |
914 | 914 | { |
915 | 915 | global $globalDBdriver, $globalTimezone; |
@@ -935,14 +935,14 @@ discard block |
||
935 | 935 | $ident_result = $row['flightaware_id']; |
936 | 936 | } |
937 | 937 | return $ident_result; |
938 | - } |
|
938 | + } |
|
939 | 939 | |
940 | 940 | /** |
941 | - * Check recent aircraft by ModeS |
|
942 | - * |
|
943 | - * @return String the ModeS |
|
944 | - * |
|
945 | - */ |
|
941 | + * Check recent aircraft by ModeS |
|
942 | + * |
|
943 | + * @return String the ModeS |
|
944 | + * |
|
945 | + */ |
|
946 | 946 | public function checkModeSRecent($modes) |
947 | 947 | { |
948 | 948 | global $globalDBdriver, $globalTimezone; |
@@ -972,11 +972,11 @@ discard block |
||
972 | 972 | } |
973 | 973 | |
974 | 974 | /** |
975 | - * Gets the aircraft data from the last 20 seconds |
|
976 | - * |
|
977 | - * @return Array the spotter data |
|
978 | - * |
|
979 | - */ |
|
975 | + * Gets the aircraft data from the last 20 seconds |
|
976 | + * |
|
977 | + * @return Array the spotter data |
|
978 | + * |
|
979 | + */ |
|
980 | 980 | public function getRealTimeData($q = '') |
981 | 981 | { |
982 | 982 | global $globalDBdriver; |
@@ -1018,16 +1018,16 @@ discard block |
||
1018 | 1018 | } |
1019 | 1019 | |
1020 | 1020 | /** |
1021 | - * Adds a new spotter data |
|
1022 | - * |
|
1023 | - * @param String $flightaware_id the ID from flightaware |
|
1024 | - * @param String $ident the flight ident |
|
1025 | - * @param String $aircraft_icao the aircraft type |
|
1026 | - * @param String $departure_airport_icao the departure airport |
|
1027 | - * @param String $arrival_airport_icao the arrival airport |
|
1028 | - * @return String success or false |
|
1029 | - * |
|
1030 | - */ |
|
1021 | + * Adds a new spotter data |
|
1022 | + * |
|
1023 | + * @param String $flightaware_id the ID from flightaware |
|
1024 | + * @param String $ident the flight ident |
|
1025 | + * @param String $aircraft_icao the aircraft type |
|
1026 | + * @param String $departure_airport_icao the departure airport |
|
1027 | + * @param String $arrival_airport_icao the arrival airport |
|
1028 | + * @return String success or false |
|
1029 | + * |
|
1030 | + */ |
|
1031 | 1031 | public function addLiveSpotterData($flightaware_id = '', $ident = '', $aircraft_icao = '', $departure_airport_icao = '', $arrival_airport_icao = '', $latitude = '', $longitude = '', $waypoints = '', $altitude = '', $altitude_real = '',$heading = '', $groundspeed = '', $date = '',$departure_airport_time = '', $arrival_airport_time = '', $squawk = '', $route_stop = '', $ModeS = '', $putinarchive = false,$registration = '',$pilot_id = '', $pilot_name = '', $verticalrate = '', $noarchive = false, $ground = false,$format_source = '', $source_name = '', $over_country = '') |
1032 | 1032 | { |
1033 | 1033 | global $globalURL, $globalArchive, $globalDebug; |
@@ -1170,10 +1170,10 @@ discard block |
||
1170 | 1170 | $arrival_airport_country = ''; |
1171 | 1171 | |
1172 | 1172 | |
1173 | - if ($squawk == '' || $Common->isInteger($squawk) === false ) $squawk = NULL; |
|
1174 | - if ($verticalrate == '' || $Common->isInteger($verticalrate) === false ) $verticalrate = NULL; |
|
1175 | - if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) $groundspeed = 0; |
|
1176 | - if ($heading == '' || $Common->isInteger($heading) === false ) $heading = 0; |
|
1173 | + if ($squawk == '' || $Common->isInteger($squawk) === false ) $squawk = NULL; |
|
1174 | + if ($verticalrate == '' || $Common->isInteger($verticalrate) === false ) $verticalrate = NULL; |
|
1175 | + if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) $groundspeed = 0; |
|
1176 | + if ($heading == '' || $Common->isInteger($heading) === false ) $heading = 0; |
|
1177 | 1177 | |
1178 | 1178 | $query = ''; |
1179 | 1179 | if ($globalArchive) { |
@@ -1194,10 +1194,10 @@ discard block |
||
1194 | 1194 | return "error : ".$e->getMessage(); |
1195 | 1195 | } |
1196 | 1196 | if (isset($globalArchive) && $globalArchive && $putinarchive && $noarchive !== true) { |
1197 | - if ($globalDebug) echo '(Add to SBS archive : '; |
|
1198 | - $SpotterArchive = new SpotterArchive($this->db); |
|
1199 | - $result = $SpotterArchive->addSpotterArchiveData($flightaware_id, $ident, $registration, $airline_name, $airline_icao, $airline_country, $airline_type, $aircraft_icao, $aircraft_shadow, $aircraft_name, $aircraft_manufacturer, $departure_airport_icao, $departure_airport_name, $departure_airport_city, $departure_airport_country, $departure_airport_time,$arrival_airport_icao, $arrival_airport_name, $arrival_airport_city, $arrival_airport_country, $arrival_airport_time, $route_stop, $date,$latitude, $longitude, $waypoints, $altitude, $altitude_real,$heading, $groundspeed, $squawk, $ModeS, $pilot_id, $pilot_name,$verticalrate,$format_source,$source_name, $over_country); |
|
1200 | - if ($globalDebug) echo $result.')'; |
|
1197 | + if ($globalDebug) echo '(Add to SBS archive : '; |
|
1198 | + $SpotterArchive = new SpotterArchive($this->db); |
|
1199 | + $result = $SpotterArchive->addSpotterArchiveData($flightaware_id, $ident, $registration, $airline_name, $airline_icao, $airline_country, $airline_type, $aircraft_icao, $aircraft_shadow, $aircraft_name, $aircraft_manufacturer, $departure_airport_icao, $departure_airport_name, $departure_airport_city, $departure_airport_country, $departure_airport_time,$arrival_airport_icao, $arrival_airport_name, $arrival_airport_city, $arrival_airport_country, $arrival_airport_time, $route_stop, $date,$latitude, $longitude, $waypoints, $altitude, $altitude_real,$heading, $groundspeed, $squawk, $ModeS, $pilot_id, $pilot_name,$verticalrate,$format_source,$source_name, $over_country); |
|
1200 | + if ($globalDebug) echo $result.')'; |
|
1201 | 1201 | } elseif ($globalDebug && $putinarchive !== true) { |
1202 | 1202 | echo '(Not adding to archive)'; |
1203 | 1203 | } elseif ($globalDebug && $noarchive === true) { |
@@ -17,62 +17,62 @@ 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['airlines']) && !empty($flt['airlines'])) { |
38 | 38 | if ($flt['airlines'][0] != '' && $flt['airlines'][0] != 'all') { |
39 | 39 | if (isset($flt['source'])) { |
40 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','",$flt['airlines'])."') AND spotter_output.format_source IN ('".implode("','",$flt['source'])."')) saf ON saf.flightaware_id = spotter_live.flightaware_id"; |
|
40 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','", $flt['airlines'])."') AND spotter_output.format_source IN ('".implode("','", $flt['source'])."')) saf ON saf.flightaware_id = spotter_live.flightaware_id"; |
|
41 | 41 | } else { |
42 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','",$flt['airlines'])."')) saf ON saf.flightaware_id = spotter_live.flightaware_id"; |
|
42 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','", $flt['airlines'])."')) saf ON saf.flightaware_id = spotter_live.flightaware_id"; |
|
43 | 43 | } |
44 | 44 | } |
45 | 45 | } |
46 | 46 | if (isset($flt['pilots_id']) && !empty($flt['pilots_id'])) { |
47 | 47 | if (isset($flt['source'])) { |
48 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','",$flt['pilots_id'])."') AND spotter_output.format_source IN ('".implode("','",$flt['source'])."')) spi ON spi.flightaware_id = spotter_live.flightaware_id"; |
|
48 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','", $flt['pilots_id'])."') AND spotter_output.format_source IN ('".implode("','", $flt['source'])."')) spi ON spi.flightaware_id = spotter_live.flightaware_id"; |
|
49 | 49 | } else { |
50 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','",$flt['pilots_id'])."')) spi ON spi.flightaware_id = spotter_live.flightaware_id"; |
|
50 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','", $flt['pilots_id'])."')) spi ON spi.flightaware_id = spotter_live.flightaware_id"; |
|
51 | 51 | } |
52 | 52 | } |
53 | 53 | if (isset($flt['idents']) && !empty($flt['idents'])) { |
54 | 54 | if (isset($flt['source'])) { |
55 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.ident IN ('".implode("','",$flt['idents'])."') AND spotter_output.format_source IN ('".implode("','",$flt['source'])."')) spid ON spid.flightaware_id = spotter_live.flightaware_id"; |
|
55 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.ident IN ('".implode("','", $flt['idents'])."') AND spotter_output.format_source IN ('".implode("','", $flt['source'])."')) spid ON spid.flightaware_id = spotter_live.flightaware_id"; |
|
56 | 56 | } else { |
57 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.ident IN ('".implode("','",$flt['idents'])."')) spid ON spid.flightaware_id = spotter_live.flightaware_id"; |
|
57 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.ident IN ('".implode("','", $flt['idents'])."')) spid ON spid.flightaware_id = spotter_live.flightaware_id"; |
|
58 | 58 | } |
59 | 59 | } |
60 | 60 | if (isset($flt['registrations']) && !empty($flt['registrations'])) { |
61 | 61 | if (isset($flt['source'])) { |
62 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.registration IN ('".implode("','",$flt['registrations'])."') AND spotter_output.format_source IN ('".implode("','",$flt['source'])."')) sre ON sre.flightaware_id = spotter_live.flightaware_id"; |
|
62 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.registration IN ('".implode("','", $flt['registrations'])."') AND spotter_output.format_source IN ('".implode("','", $flt['source'])."')) sre ON sre.flightaware_id = spotter_live.flightaware_id"; |
|
63 | 63 | } else { |
64 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.registration IN ('".implode("','",$flt['registrations'])."')) sre ON sre.flightaware_id = spotter_live.flightaware_id"; |
|
64 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.registration IN ('".implode("','", $flt['registrations'])."')) sre ON sre.flightaware_id = spotter_live.flightaware_id"; |
|
65 | 65 | } |
66 | 66 | } |
67 | 67 | if ((isset($flt['airlines']) && empty($flt['airlines']) && isset($flt['pilots_id']) && empty($flt['pilots_id']) && isset($flt['idents']) && empty($flt['idents'])) || (!isset($flt['airlines']) && !isset($flt['pilots_id']) && !isset($flt['idents']) && !isset($flt['registrations']))) { |
68 | 68 | if (isset($flt['source'])) { |
69 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.format_source IN ('".implode("','",$flt['source'])."')) ssf ON ssf.flightaware_id = spotter_live.flightaware_id"; |
|
69 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.format_source IN ('".implode("','", $flt['source'])."')) ssf ON ssf.flightaware_id = spotter_live.flightaware_id"; |
|
70 | 70 | } |
71 | 71 | } |
72 | 72 | } |
73 | 73 | if (isset($filter['airlines']) && !empty($filter['airlines'])) { |
74 | 74 | if ($filter['airlines'][0] != '' && $filter['airlines'][0] != 'all') { |
75 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','",$filter['airlines'])."')) sai ON sai.flightaware_id = spotter_live.flightaware_id"; |
|
75 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','", $filter['airlines'])."')) sai ON sai.flightaware_id = spotter_live.flightaware_id"; |
|
76 | 76 | } |
77 | 77 | } |
78 | 78 | if (isset($filter['alliance']) && !empty($filter['alliance'])) { |
@@ -82,13 +82,13 @@ discard block |
||
82 | 82 | $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_type = '".$filter['airlinestype']."') sa ON sa.flightaware_id = spotter_live.flightaware_id "; |
83 | 83 | } |
84 | 84 | if (isset($filter['pilots_id']) && !empty($filter['pilots_id'])) { |
85 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','",$filter['pilots_id'])."')) sp ON sp.flightaware_id = spotter_live.flightaware_id"; |
|
85 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','", $filter['pilots_id'])."')) sp ON sp.flightaware_id = spotter_live.flightaware_id"; |
|
86 | 86 | } |
87 | 87 | if (isset($filter['source']) && !empty($filter['source'])) { |
88 | 88 | if (count($filter['source']) == 1) { |
89 | 89 | $filter_query_where .= " AND format_source = '".$filter['source'][0]."'"; |
90 | 90 | } else { |
91 | - $filter_query_where .= " AND format_source IN ('".implode("','",$filter['source'])."')"; |
|
91 | + $filter_query_where .= " AND format_source IN ('".implode("','", $filter['source'])."')"; |
|
92 | 92 | } |
93 | 93 | } |
94 | 94 | if (isset($filter['ident']) && !empty($filter['ident'])) { |
@@ -121,15 +121,15 @@ discard block |
||
121 | 121 | $filter_query_date .= " AND EXTRACT(DAY FROM spotter_output.date) = '".$filter['day']."'"; |
122 | 122 | } |
123 | 123 | } |
124 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output".preg_replace('/^ AND/',' WHERE',$filter_query_date).") sd ON sd.flightaware_id = spotter_live.flightaware_id"; |
|
124 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output".preg_replace('/^ AND/', ' WHERE', $filter_query_date).") sd ON sd.flightaware_id = spotter_live.flightaware_id"; |
|
125 | 125 | } |
126 | 126 | if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) { |
127 | - $filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')"; |
|
127 | + $filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','", $filter['source_aprs'])."')"; |
|
128 | 128 | } |
129 | 129 | if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE'; |
130 | 130 | elseif ($filter_query_where != '' && $and) $filter_query_where .= ' AND'; |
131 | 131 | if ($filter_query_where != '') { |
132 | - $filter_query_where = preg_replace('/^ AND/',' WHERE',$filter_query_where); |
|
132 | + $filter_query_where = preg_replace('/^ AND/', ' WHERE', $filter_query_where); |
|
133 | 133 | } |
134 | 134 | $filter_query = $filter_query_join.$filter_query_where; |
135 | 135 | return $filter_query; |
@@ -152,8 +152,8 @@ discard block |
||
152 | 152 | if ($limit != '') |
153 | 153 | { |
154 | 154 | $limit_array = explode(',', $limit); |
155 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
156 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
155 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
156 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
157 | 157 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
158 | 158 | { |
159 | 159 | $limit_query = ' LIMIT '.$limit_array[1].' OFFSET '.$limit_array[0]; |
@@ -177,7 +177,7 @@ discard block |
||
177 | 177 | } else { |
178 | 178 | $query = "SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= l.date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate".$filter_query.$orderby_query; |
179 | 179 | } |
180 | - $spotter_array = $Spotter->getDataFromDB($query.$limit_query,array(),'',true); |
|
180 | + $spotter_array = $Spotter->getDataFromDB($query.$limit_query, array(), '', true); |
|
181 | 181 | |
182 | 182 | return $spotter_array; |
183 | 183 | } |
@@ -192,7 +192,7 @@ discard block |
||
192 | 192 | { |
193 | 193 | global $globalDBdriver, $globalLiveInterval, $globalArchive; |
194 | 194 | date_default_timezone_set('UTC'); |
195 | - $filter_query = $this->getFilter($filter,true,true); |
|
195 | + $filter_query = $this->getFilter($filter, true, true); |
|
196 | 196 | if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
197 | 197 | if ($globalDBdriver == 'mysql') { |
198 | 198 | if (isset($globalArchive) && $globalArchive === TRUE) { |
@@ -215,7 +215,7 @@ discard block |
||
215 | 215 | try { |
216 | 216 | $sth = $this->db->prepare($query); |
217 | 217 | $sth->execute(); |
218 | - } catch(PDOException $e) { |
|
218 | + } catch (PDOException $e) { |
|
219 | 219 | echo $e->getMessage(); |
220 | 220 | die; |
221 | 221 | } |
@@ -229,20 +229,20 @@ discard block |
||
229 | 229 | * @return Array the spotter information |
230 | 230 | * |
231 | 231 | */ |
232 | - public function getMinLastLiveSpotterData($coord = array(),$filter = array(), $limit = false, $id = '') |
|
232 | + public function getMinLastLiveSpotterData($coord = array(), $filter = array(), $limit = false, $id = '') |
|
233 | 233 | { |
234 | 234 | global $globalDBdriver, $globalLiveInterval, $globalArchive, $globalMap3DAircraftsLimit; |
235 | 235 | date_default_timezone_set('UTC'); |
236 | 236 | $usecoord = false; |
237 | 237 | if (is_array($coord) && !empty($coord)) { |
238 | - $minlong = filter_var($coord[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
239 | - $minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
240 | - $maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
241 | - $maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
238 | + $minlong = filter_var($coord[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
239 | + $minlat = filter_var($coord[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
240 | + $maxlong = filter_var($coord[2], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
241 | + $maxlat = filter_var($coord[3], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
242 | 242 | $usecoord = true; |
243 | 243 | } |
244 | - $id = filter_var($id,FILTER_SANITIZE_STRING); |
|
245 | - $filter_query = $this->getFilter($filter,true,true); |
|
244 | + $id = filter_var($id, FILTER_SANITIZE_STRING); |
|
245 | + $filter_query = $this->getFilter($filter, true, true); |
|
246 | 246 | |
247 | 247 | if (!isset($globalLiveInterval) || $globalLiveInterval == '') $globalLiveInterval = '200'; |
248 | 248 | if (!isset($globalMap3DAircraftsLimit) || $globalMap3DAircraftsLimit == '') $globalMap3DAircraftsLimit = '300'; |
@@ -254,7 +254,7 @@ discard block |
||
254 | 254 | WHERE spotter_archive.latitude <> '0' AND spotter_archive.longitude <> '0' |
255 | 255 | ORDER BY spotter_archive.flightaware_id, spotter_archive.date"; |
256 | 256 | */ |
257 | - $query = 'SELECT * FROM (SELECT spotter_archive.ident, spotter_archive.flightaware_id, spotter_archive.aircraft_icao, spotter_archive.departure_airport_icao as departure_airport, spotter_archive.arrival_airport_icao as arrival_airport, spotter_archive.latitude, spotter_archive.longitude, spotter_archive.altitude, spotter_archive.heading, spotter_archive.ground_speed, spotter_archive.squawk, spotter_archive.date, spotter_archive.format_source |
|
257 | + $query = 'SELECT * FROM (SELECT spotter_archive.ident, spotter_archive.flightaware_id, spotter_archive.aircraft_icao, spotter_archive.departure_airport_icao as departure_airport, spotter_archive.arrival_airport_icao as arrival_airport, spotter_archive.latitude, spotter_archive.longitude, spotter_archive.altitude, spotter_archive.heading, spotter_archive.ground_speed, spotter_archive.squawk, spotter_archive.date, spotter_archive.format_source |
|
258 | 258 | FROM spotter_archive INNER JOIN (SELECT flightaware_id FROM spotter_live'.$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval." SECOND) <= spotter_live.date) l ON l.flightaware_id = spotter_archive.flightaware_id "; |
259 | 259 | if ($usecoord) $query .= "AND (spotter_archive.latitude BETWEEN ".$minlat." AND ".$maxlat." AND spotter_archive.longitude BETWEEN ".$minlong." AND ".$maxlong.") "; |
260 | 260 | if ($id != '') $query .= "OR spotter_archive.flightaware_id = :id "; |
@@ -268,7 +268,7 @@ discard block |
||
268 | 268 | ORDER BY flightaware_id, date"; |
269 | 269 | if ($limit) $query .= " LIMIT ".$globalMap3DAircraftsLimit; |
270 | 270 | } else { |
271 | - $query = 'SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source |
|
271 | + $query = 'SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source |
|
272 | 272 | FROM spotter_live'.$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval." SECOND) <= spotter_live.date "; |
273 | 273 | if ($usecoord) $query .= "AND (spotter_live.latitude BETWEEN ".$minlat." AND ".$maxlat." AND spotter_live.longitude BETWEEN ".$minlong." AND ".$maxlong.") "; |
274 | 274 | if ($id != '') $query .= "OR spotter_live.flightaware_id = :id "; |
@@ -284,7 +284,7 @@ discard block |
||
284 | 284 | WHERE spotter_archive.latitude <> '0' AND spotter_archive.longitude <> '0' |
285 | 285 | ORDER BY spotter_archive.flightaware_id, spotter_archive.date"; |
286 | 286 | */ |
287 | - $query = "SELECT * FROM (SELECT spotter_archive.ident, spotter_archive.flightaware_id, spotter_archive.aircraft_icao, spotter_archive.departure_airport_icao as departure_airport, spotter_archive.arrival_airport_icao as arrival_airport, spotter_archive.latitude, spotter_archive.longitude, spotter_archive.altitude, spotter_archive.heading, spotter_archive.ground_speed, spotter_archive.squawk, spotter_archive.date, spotter_archive.format_source |
|
287 | + $query = "SELECT * FROM (SELECT spotter_archive.ident, spotter_archive.flightaware_id, spotter_archive.aircraft_icao, spotter_archive.departure_airport_icao as departure_airport, spotter_archive.arrival_airport_icao as arrival_airport, spotter_archive.latitude, spotter_archive.longitude, spotter_archive.altitude, spotter_archive.heading, spotter_archive.ground_speed, spotter_archive.squawk, spotter_archive.date, spotter_archive.format_source |
|
288 | 288 | FROM spotter_archive INNER JOIN (SELECT flightaware_id FROM spotter_live".$filter_query." CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= spotter_live.date) l ON l.flightaware_id = spotter_archive.flightaware_id "; |
289 | 289 | if ($usecoord) $query .= "AND (spotter_archive.latitude BETWEEN ".$minlat." AND ".$maxlat." AND spotter_archive.longitude BETWEEN ".$minlong." AND ".$maxlong.") "; |
290 | 290 | if ($id != '') $query .= "OR spotter_archive.flightaware_id = :id "; |
@@ -311,7 +311,7 @@ discard block |
||
311 | 311 | try { |
312 | 312 | $sth = $this->db->prepare($query); |
313 | 313 | $sth->execute($query_values); |
314 | - } catch(PDOException $e) { |
|
314 | + } catch (PDOException $e) { |
|
315 | 315 | echo $e->getMessage(); |
316 | 316 | die; |
317 | 317 | } |
@@ -328,7 +328,7 @@ discard block |
||
328 | 328 | public function getLiveSpotterCount($filter = array()) |
329 | 329 | { |
330 | 330 | global $globalDBdriver, $globalLiveInterval; |
331 | - $filter_query = $this->getFilter($filter,true,true); |
|
331 | + $filter_query = $this->getFilter($filter, true, true); |
|
332 | 332 | |
333 | 333 | if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
334 | 334 | if ($globalDBdriver == 'mysql') { |
@@ -341,7 +341,7 @@ discard block |
||
341 | 341 | try { |
342 | 342 | $sth = $this->db->prepare($query); |
343 | 343 | $sth->execute(); |
344 | - } catch(PDOException $e) { |
|
344 | + } catch (PDOException $e) { |
|
345 | 345 | echo $e->getMessage(); |
346 | 346 | die; |
347 | 347 | } |
@@ -364,10 +364,10 @@ discard block |
||
364 | 364 | $filter_query = $this->getFilter($filter); |
365 | 365 | |
366 | 366 | if (is_array($coord)) { |
367 | - $minlong = filter_var($coord[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
368 | - $minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
369 | - $maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
370 | - $maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
367 | + $minlong = filter_var($coord[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
368 | + $minlat = filter_var($coord[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
369 | + $maxlong = filter_var($coord[2], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
370 | + $maxlat = filter_var($coord[3], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
371 | 371 | } else return array(); |
372 | 372 | if ($globalDBdriver == 'mysql') { |
373 | 373 | $query = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate AND spotter_live.latitude BETWEEN '.$minlat.' AND '.$maxlat.' AND spotter_live.longitude BETWEEN '.$minlong.' AND '.$maxlong.' GROUP BY spotter_live.flightaware_id'.$filter_query; |
@@ -390,23 +390,23 @@ discard block |
||
390 | 390 | global $globalDBdriver, $globalLiveInterval, $globalArchive; |
391 | 391 | $Spotter = new Spotter($this->db); |
392 | 392 | if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
393 | - $filter_query = $this->getFilter($filter,true,true); |
|
393 | + $filter_query = $this->getFilter($filter, true, true); |
|
394 | 394 | |
395 | 395 | if (is_array($coord)) { |
396 | - $minlong = filter_var($coord[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
397 | - $minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
398 | - $maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
399 | - $maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
396 | + $minlong = filter_var($coord[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
397 | + $minlat = filter_var($coord[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
398 | + $maxlong = filter_var($coord[2], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
399 | + $maxlat = filter_var($coord[3], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
400 | 400 | } else return array(); |
401 | 401 | if ($globalDBdriver == 'mysql') { |
402 | 402 | if (isset($globalArchive) && $globalArchive === TRUE) { |
403 | - $query = 'SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source |
|
403 | + $query = 'SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source |
|
404 | 404 | FROM spotter_live |
405 | 405 | '.$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= spotter_live.date |
406 | 406 | AND spotter_live.latitude BETWEEN '.$minlat.' AND '.$maxlat.' AND spotter_live.longitude BETWEEN '.$minlong.' AND '.$maxlong.' |
407 | 407 | AND spotter_live.latitude <> 0 AND spotter_live.longitude <> 0'; |
408 | 408 | } else { |
409 | - $query = 'SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source |
|
409 | + $query = 'SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source |
|
410 | 410 | FROM spotter_live |
411 | 411 | INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate |
412 | 412 | FROM spotter_live l |
@@ -418,14 +418,14 @@ discard block |
||
418 | 418 | } |
419 | 419 | } else { |
420 | 420 | if (isset($globalArchive) && $globalArchive === TRUE) { |
421 | - $query = "SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source |
|
421 | + $query = "SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source |
|
422 | 422 | FROM spotter_live |
423 | 423 | ".$filter_query." CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= spotter_live.date |
424 | 424 | AND spotter_live.latitude BETWEEN ".$minlat." AND ".$maxlat." |
425 | 425 | AND spotter_live.longitude BETWEEN ".$minlong." AND ".$maxlong." |
426 | 426 | AND spotter_live.latitude <> '0' AND spotter_live.longitude <> '0'"; |
427 | 427 | } else { |
428 | - $query = "SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source |
|
428 | + $query = "SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source |
|
429 | 429 | FROM spotter_live |
430 | 430 | INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate |
431 | 431 | FROM spotter_live l |
@@ -440,7 +440,7 @@ discard block |
||
440 | 440 | try { |
441 | 441 | $sth = $this->db->prepare($query); |
442 | 442 | $sth->execute(); |
443 | - } catch(PDOException $e) { |
|
443 | + } catch (PDOException $e) { |
|
444 | 444 | echo $e->getMessage(); |
445 | 445 | die; |
446 | 446 | } |
@@ -489,7 +489,7 @@ discard block |
||
489 | 489 | if ($interval == '1m') |
490 | 490 | { |
491 | 491 | $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= spotter_live.date '; |
492 | - } else if ($interval == '15m'){ |
|
492 | + } else if ($interval == '15m') { |
|
493 | 493 | $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 15 MINUTE) <= spotter_live.date '; |
494 | 494 | } |
495 | 495 | } |
@@ -497,14 +497,14 @@ discard block |
||
497 | 497 | $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= spotter_live.date '; |
498 | 498 | } |
499 | 499 | |
500 | - $query = "SELECT spotter_live.*, ( 6371 * acos( cos( radians(:lat) ) * cos( radians( latitude ) ) * cos( radians( longitude ) - radians(:lng) ) + sin( radians(:lat) ) * sin( radians( latitude ) ) ) ) AS distance FROM spotter_live |
|
500 | + $query = "SELECT spotter_live.*, ( 6371 * acos( cos( radians(:lat) ) * cos( radians( latitude ) ) * cos( radians( longitude ) - radians(:lng) ) + sin( radians(:lat) ) * sin( radians( latitude ) ) ) ) AS distance FROM spotter_live |
|
501 | 501 | WHERE spotter_live.latitude <> '' |
502 | 502 | AND spotter_live.longitude <> '' |
503 | 503 | ".$additional_query." |
504 | 504 | HAVING distance < :radius |
505 | 505 | ORDER BY distance"; |
506 | 506 | |
507 | - $spotter_array = $Spotter->getDataFromDB($query, array(':lat' => $lat, ':lng' => $lng,':radius' => $radius)); |
|
507 | + $spotter_array = $Spotter->getDataFromDB($query, array(':lat' => $lat, ':lng' => $lng, ':radius' => $radius)); |
|
508 | 508 | |
509 | 509 | return $spotter_array; |
510 | 510 | } |
@@ -522,9 +522,9 @@ discard block |
||
522 | 522 | date_default_timezone_set('UTC'); |
523 | 523 | |
524 | 524 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
525 | - $query = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.ident = :ident GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC'; |
|
525 | + $query = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.ident = :ident GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC'; |
|
526 | 526 | |
527 | - $spotter_array = $Spotter->getDataFromDB($query,array(':ident' => $ident),'',true); |
|
527 | + $spotter_array = $Spotter->getDataFromDB($query, array(':ident' => $ident), '', true); |
|
528 | 528 | |
529 | 529 | return $spotter_array; |
530 | 530 | } |
@@ -535,16 +535,16 @@ discard block |
||
535 | 535 | * @return Array the spotter information |
536 | 536 | * |
537 | 537 | */ |
538 | - public function getDateLiveSpotterDataByIdent($ident,$date) |
|
538 | + public function getDateLiveSpotterDataByIdent($ident, $date) |
|
539 | 539 | { |
540 | 540 | $Spotter = new Spotter($this->db); |
541 | 541 | date_default_timezone_set('UTC'); |
542 | 542 | |
543 | 543 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
544 | - $query = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.ident = :ident AND l.date <= :date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC'; |
|
544 | + $query = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.ident = :ident AND l.date <= :date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC'; |
|
545 | 545 | |
546 | - $date = date('c',$date); |
|
547 | - $spotter_array = $Spotter->getDataFromDB($query,array(':ident' => $ident,':date' => $date)); |
|
546 | + $date = date('c', $date); |
|
547 | + $spotter_array = $Spotter->getDataFromDB($query, array(':ident' => $ident, ':date' => $date)); |
|
548 | 548 | |
549 | 549 | return $spotter_array; |
550 | 550 | } |
@@ -560,8 +560,8 @@ discard block |
||
560 | 560 | $Spotter = new Spotter($this->db); |
561 | 561 | date_default_timezone_set('UTC'); |
562 | 562 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
563 | - $query = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.flightaware_id = :id GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC'; |
|
564 | - $spotter_array = $Spotter->getDataFromDB($query,array(':id' => $id),'',true); |
|
563 | + $query = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.flightaware_id = :id GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC'; |
|
564 | + $spotter_array = $Spotter->getDataFromDB($query, array(':id' => $id), '', true); |
|
565 | 565 | return $spotter_array; |
566 | 566 | } |
567 | 567 | |
@@ -571,15 +571,15 @@ discard block |
||
571 | 571 | * @return Array the spotter information |
572 | 572 | * |
573 | 573 | */ |
574 | - public function getDateLiveSpotterDataById($id,$date) |
|
574 | + public function getDateLiveSpotterDataById($id, $date) |
|
575 | 575 | { |
576 | 576 | $Spotter = new Spotter($this->db); |
577 | 577 | date_default_timezone_set('UTC'); |
578 | 578 | |
579 | 579 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
580 | - $query = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.flightaware_id = :id AND l.date <= :date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC'; |
|
581 | - $date = date('c',$date); |
|
582 | - $spotter_array = $Spotter->getDataFromDB($query,array(':id' => $id,':date' => $date),'',true); |
|
580 | + $query = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.flightaware_id = :id AND l.date <= :date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC'; |
|
581 | + $date = date('c', $date); |
|
582 | + $spotter_array = $Spotter->getDataFromDB($query, array(':id' => $id, ':date' => $date), '', true); |
|
583 | 583 | return $spotter_array; |
584 | 584 | } |
585 | 585 | |
@@ -595,13 +595,13 @@ discard block |
||
595 | 595 | date_default_timezone_set('UTC'); |
596 | 596 | |
597 | 597 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
598 | - $query = 'SELECT spotter_live.altitude, spotter_live.date FROM spotter_live WHERE spotter_live.ident = :ident'; |
|
598 | + $query = 'SELECT spotter_live.altitude, spotter_live.date FROM spotter_live WHERE spotter_live.ident = :ident'; |
|
599 | 599 | |
600 | 600 | try { |
601 | 601 | |
602 | 602 | $sth = $this->db->prepare($query); |
603 | 603 | $sth->execute(array(':ident' => $ident)); |
604 | - } catch(PDOException $e) { |
|
604 | + } catch (PDOException $e) { |
|
605 | 605 | echo $e->getMessage(); |
606 | 606 | die; |
607 | 607 | } |
@@ -616,7 +616,7 @@ discard block |
||
616 | 616 | * @return Array the spotter information |
617 | 617 | * |
618 | 618 | */ |
619 | - public function getAllLiveSpotterDataById($id,$liveinterval = false) |
|
619 | + public function getAllLiveSpotterDataById($id, $liveinterval = false) |
|
620 | 620 | { |
621 | 621 | global $globalDBdriver, $globalLiveInterval; |
622 | 622 | date_default_timezone_set('UTC'); |
@@ -635,7 +635,7 @@ discard block |
||
635 | 635 | try { |
636 | 636 | $sth = $this->db->prepare($query); |
637 | 637 | $sth->execute(array(':id' => $id)); |
638 | - } catch(PDOException $e) { |
|
638 | + } catch (PDOException $e) { |
|
639 | 639 | echo $e->getMessage(); |
640 | 640 | die; |
641 | 641 | } |
@@ -653,12 +653,12 @@ discard block |
||
653 | 653 | { |
654 | 654 | date_default_timezone_set('UTC'); |
655 | 655 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
656 | - $query = self::$global_query.' WHERE spotter_live.ident = :ident'; |
|
656 | + $query = self::$global_query.' WHERE spotter_live.ident = :ident'; |
|
657 | 657 | try { |
658 | 658 | |
659 | 659 | $sth = $this->db->prepare($query); |
660 | 660 | $sth->execute(array(':ident' => $ident)); |
661 | - } catch(PDOException $e) { |
|
661 | + } catch (PDOException $e) { |
|
662 | 662 | echo $e->getMessage(); |
663 | 663 | die; |
664 | 664 | } |
@@ -688,7 +688,7 @@ discard block |
||
688 | 688 | |
689 | 689 | $sth = $this->db->prepare($query); |
690 | 690 | $sth->execute(); |
691 | - } catch(PDOException $e) { |
|
691 | + } catch (PDOException $e) { |
|
692 | 692 | return "error"; |
693 | 693 | } |
694 | 694 | |
@@ -711,14 +711,14 @@ discard block |
||
711 | 711 | |
712 | 712 | $sth = $this->db->prepare($query); |
713 | 713 | $sth->execute(); |
714 | - } catch(PDOException $e) { |
|
714 | + } catch (PDOException $e) { |
|
715 | 715 | return "error"; |
716 | 716 | } |
717 | 717 | $query_delete = 'DELETE FROM spotter_live WHERE flightaware_id IN ('; |
718 | 718 | $i = 0; |
719 | - $j =0; |
|
719 | + $j = 0; |
|
720 | 720 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
721 | - foreach($all as $row) |
|
721 | + foreach ($all as $row) |
|
722 | 722 | { |
723 | 723 | $i++; |
724 | 724 | $j++; |
@@ -726,9 +726,9 @@ discard block |
||
726 | 726 | if ($globalDebug) echo "."; |
727 | 727 | try { |
728 | 728 | |
729 | - $sth = $this->db->prepare(substr($query_delete,0,-1).")"); |
|
729 | + $sth = $this->db->prepare(substr($query_delete, 0, -1).")"); |
|
730 | 730 | $sth->execute(); |
731 | - } catch(PDOException $e) { |
|
731 | + } catch (PDOException $e) { |
|
732 | 732 | return "error"; |
733 | 733 | } |
734 | 734 | $query_delete = 'DELETE FROM spotter_live WHERE flightaware_id IN ('; |
@@ -739,9 +739,9 @@ discard block |
||
739 | 739 | if ($i > 0) { |
740 | 740 | try { |
741 | 741 | |
742 | - $sth = $this->db->prepare(substr($query_delete,0,-1).")"); |
|
742 | + $sth = $this->db->prepare(substr($query_delete, 0, -1).")"); |
|
743 | 743 | $sth->execute(); |
744 | - } catch(PDOException $e) { |
|
744 | + } catch (PDOException $e) { |
|
745 | 745 | return "error"; |
746 | 746 | } |
747 | 747 | } |
@@ -754,7 +754,7 @@ discard block |
||
754 | 754 | |
755 | 755 | $sth = $this->db->prepare($query); |
756 | 756 | $sth->execute(); |
757 | - } catch(PDOException $e) { |
|
757 | + } catch (PDOException $e) { |
|
758 | 758 | return "error"; |
759 | 759 | } |
760 | 760 | /* $query_delete = "DELETE FROM spotter_live WHERE flightaware_id IN ("; |
@@ -802,13 +802,13 @@ discard block |
||
802 | 802 | public function deleteLiveSpotterDataByIdent($ident) |
803 | 803 | { |
804 | 804 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
805 | - $query = 'DELETE FROM spotter_live WHERE ident = :ident'; |
|
805 | + $query = 'DELETE FROM spotter_live WHERE ident = :ident'; |
|
806 | 806 | |
807 | 807 | try { |
808 | 808 | |
809 | 809 | $sth = $this->db->prepare($query); |
810 | 810 | $sth->execute(array(':ident' => $ident)); |
811 | - } catch(PDOException $e) { |
|
811 | + } catch (PDOException $e) { |
|
812 | 812 | return "error"; |
813 | 813 | } |
814 | 814 | |
@@ -824,13 +824,13 @@ discard block |
||
824 | 824 | public function deleteLiveSpotterDataById($id) |
825 | 825 | { |
826 | 826 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
827 | - $query = 'DELETE FROM spotter_live WHERE flightaware_id = :id'; |
|
827 | + $query = 'DELETE FROM spotter_live WHERE flightaware_id = :id'; |
|
828 | 828 | |
829 | 829 | try { |
830 | 830 | |
831 | 831 | $sth = $this->db->prepare($query); |
832 | 832 | $sth->execute(array(':id' => $id)); |
833 | - } catch(PDOException $e) { |
|
833 | + } catch (PDOException $e) { |
|
834 | 834 | return "error"; |
835 | 835 | } |
836 | 836 | |
@@ -848,13 +848,13 @@ discard block |
||
848 | 848 | { |
849 | 849 | global $globalDBdriver, $globalTimezone; |
850 | 850 | if ($globalDBdriver == 'mysql') { |
851 | - $query = 'SELECT spotter_live.ident FROM spotter_live |
|
851 | + $query = 'SELECT spotter_live.ident FROM spotter_live |
|
852 | 852 | WHERE spotter_live.ident = :ident |
853 | 853 | AND spotter_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 HOUR) |
854 | 854 | AND spotter_live.date < UTC_TIMESTAMP()'; |
855 | 855 | $query_data = array(':ident' => $ident); |
856 | 856 | } else { |
857 | - $query = "SELECT spotter_live.ident FROM spotter_live |
|
857 | + $query = "SELECT spotter_live.ident FROM spotter_live |
|
858 | 858 | WHERE spotter_live.ident = :ident |
859 | 859 | AND spotter_live.date >= now() AT TIME ZONE 'UTC' - INTERVAL '1 HOURS' |
860 | 860 | AND spotter_live.date < now() AT TIME ZONE 'UTC'"; |
@@ -863,8 +863,8 @@ discard block |
||
863 | 863 | |
864 | 864 | $sth = $this->db->prepare($query); |
865 | 865 | $sth->execute($query_data); |
866 | - $ident_result=''; |
|
867 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
866 | + $ident_result = ''; |
|
867 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
868 | 868 | { |
869 | 869 | $ident_result = $row['ident']; |
870 | 870 | } |
@@ -881,13 +881,13 @@ discard block |
||
881 | 881 | { |
882 | 882 | global $globalDBdriver, $globalTimezone; |
883 | 883 | if ($globalDBdriver == 'mysql') { |
884 | - $query = 'SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live |
|
884 | + $query = 'SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live |
|
885 | 885 | WHERE spotter_live.ident = :ident |
886 | 886 | AND spotter_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 20 MINUTE)'; |
887 | 887 | // AND spotter_live.date < UTC_TIMESTAMP()"; |
888 | 888 | $query_data = array(':ident' => $ident); |
889 | 889 | } else { |
890 | - $query = "SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live |
|
890 | + $query = "SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live |
|
891 | 891 | WHERE spotter_live.ident = :ident |
892 | 892 | AND spotter_live.date >= now() AT TIME ZONE 'UTC' - INTERVAL '20 MINUTES'"; |
893 | 893 | // AND spotter_live.date < now() AT TIME ZONE 'UTC'"; |
@@ -896,8 +896,8 @@ discard block |
||
896 | 896 | |
897 | 897 | $sth = $this->db->prepare($query); |
898 | 898 | $sth->execute($query_data); |
899 | - $ident_result=''; |
|
900 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
899 | + $ident_result = ''; |
|
900 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
901 | 901 | { |
902 | 902 | $ident_result = $row['flightaware_id']; |
903 | 903 | } |
@@ -914,13 +914,13 @@ discard block |
||
914 | 914 | { |
915 | 915 | global $globalDBdriver, $globalTimezone; |
916 | 916 | if ($globalDBdriver == 'mysql') { |
917 | - $query = 'SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live |
|
917 | + $query = 'SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live |
|
918 | 918 | WHERE spotter_live.flightaware_id = :id |
919 | 919 | AND spotter_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 10 HOUR)'; |
920 | 920 | // AND spotter_live.date < UTC_TIMESTAMP()"; |
921 | 921 | $query_data = array(':id' => $id); |
922 | 922 | } else { |
923 | - $query = "SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live |
|
923 | + $query = "SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live |
|
924 | 924 | WHERE spotter_live.flightaware_id = :id |
925 | 925 | AND spotter_live.date >= now() AT TIME ZONE 'UTC' - INTERVAL '10 HOUR'"; |
926 | 926 | // AND spotter_live.date < now() AT TIME ZONE 'UTC'"; |
@@ -929,8 +929,8 @@ discard block |
||
929 | 929 | |
930 | 930 | $sth = $this->db->prepare($query); |
931 | 931 | $sth->execute($query_data); |
932 | - $ident_result=''; |
|
933 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
932 | + $ident_result = ''; |
|
933 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
934 | 934 | { |
935 | 935 | $ident_result = $row['flightaware_id']; |
936 | 936 | } |
@@ -947,13 +947,13 @@ discard block |
||
947 | 947 | { |
948 | 948 | global $globalDBdriver, $globalTimezone; |
949 | 949 | if ($globalDBdriver == 'mysql') { |
950 | - $query = 'SELECT spotter_live.ModeS, spotter_live.flightaware_id FROM spotter_live |
|
950 | + $query = 'SELECT spotter_live.ModeS, spotter_live.flightaware_id FROM spotter_live |
|
951 | 951 | WHERE spotter_live.ModeS = :modes |
952 | 952 | AND spotter_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 20 MINUTE)'; |
953 | 953 | // AND spotter_live.date < UTC_TIMESTAMP()"; |
954 | 954 | $query_data = array(':modes' => $modes); |
955 | 955 | } else { |
956 | - $query = "SELECT spotter_live.ModeS, spotter_live.flightaware_id FROM spotter_live |
|
956 | + $query = "SELECT spotter_live.ModeS, spotter_live.flightaware_id FROM spotter_live |
|
957 | 957 | WHERE spotter_live.ModeS = :modes |
958 | 958 | AND spotter_live.date >= CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '20 MINUTE'"; |
959 | 959 | // // AND spotter_live.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC'"; |
@@ -962,8 +962,8 @@ discard block |
||
962 | 962 | |
963 | 963 | $sth = $this->db->prepare($query); |
964 | 964 | $sth->execute($query_data); |
965 | - $ident_result=''; |
|
966 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
965 | + $ident_result = ''; |
|
966 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
967 | 967 | { |
968 | 968 | //$ident_result = $row['spotter_live_id']; |
969 | 969 | $ident_result = $row['flightaware_id']; |
@@ -988,8 +988,8 @@ discard block |
||
988 | 988 | return array(); |
989 | 989 | } else { |
990 | 990 | $q_array = explode(" ", $q); |
991 | - foreach ($q_array as $q_item){ |
|
992 | - $q_item = filter_var($q_item,FILTER_SANITIZE_STRING); |
|
991 | + foreach ($q_array as $q_item) { |
|
992 | + $q_item = filter_var($q_item, FILTER_SANITIZE_STRING); |
|
993 | 993 | $additional_query .= " AND ("; |
994 | 994 | $additional_query .= "(spotter_live.aircraft_icao like '%".$q_item."%') OR "; |
995 | 995 | $additional_query .= "(spotter_live.aircraft_name like '%".$q_item."%') OR "; |
@@ -1004,11 +1004,11 @@ discard block |
||
1004 | 1004 | } |
1005 | 1005 | } |
1006 | 1006 | if ($globalDBdriver == 'mysql') { |
1007 | - $query = "SELECT spotter_live.* FROM spotter_live |
|
1007 | + $query = "SELECT spotter_live.* FROM spotter_live |
|
1008 | 1008 | WHERE spotter_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 20 SECOND) ".$additional_query." |
1009 | 1009 | AND spotter_live.date < UTC_TIMESTAMP()"; |
1010 | 1010 | } else { |
1011 | - $query = "SELECT spotter_live.* FROM spotter_live |
|
1011 | + $query = "SELECT spotter_live.* FROM spotter_live |
|
1012 | 1012 | WHERE spotter_live.date::timestamp >= CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '20 SECONDS' ".$additional_query." |
1013 | 1013 | AND spotter_live.date::timestamp < CURRENT_TIMESTAMP AT TIME ZONE 'UTC'"; |
1014 | 1014 | } |
@@ -1028,7 +1028,7 @@ discard block |
||
1028 | 1028 | * @return String success or false |
1029 | 1029 | * |
1030 | 1030 | */ |
1031 | - public function addLiveSpotterData($flightaware_id = '', $ident = '', $aircraft_icao = '', $departure_airport_icao = '', $arrival_airport_icao = '', $latitude = '', $longitude = '', $waypoints = '', $altitude = '', $altitude_real = '',$heading = '', $groundspeed = '', $date = '',$departure_airport_time = '', $arrival_airport_time = '', $squawk = '', $route_stop = '', $ModeS = '', $putinarchive = false,$registration = '',$pilot_id = '', $pilot_name = '', $verticalrate = '', $noarchive = false, $ground = false,$format_source = '', $source_name = '', $over_country = '') |
|
1031 | + public function addLiveSpotterData($flightaware_id = '', $ident = '', $aircraft_icao = '', $departure_airport_icao = '', $arrival_airport_icao = '', $latitude = '', $longitude = '', $waypoints = '', $altitude = '', $altitude_real = '', $heading = '', $groundspeed = '', $date = '', $departure_airport_time = '', $arrival_airport_time = '', $squawk = '', $route_stop = '', $ModeS = '', $putinarchive = false, $registration = '', $pilot_id = '', $pilot_name = '', $verticalrate = '', $noarchive = false, $ground = false, $format_source = '', $source_name = '', $over_country = '') |
|
1032 | 1032 | { |
1033 | 1033 | global $globalURL, $globalArchive, $globalDebug; |
1034 | 1034 | $Common = new Common(); |
@@ -1128,27 +1128,27 @@ discard block |
||
1128 | 1128 | if ($date == '') $date = date("Y-m-d H:i:s", time()); |
1129 | 1129 | |
1130 | 1130 | |
1131 | - $flightaware_id = filter_var($flightaware_id,FILTER_SANITIZE_STRING); |
|
1132 | - $ident = filter_var($ident,FILTER_SANITIZE_STRING); |
|
1133 | - $aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING); |
|
1134 | - $departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING); |
|
1135 | - $arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING); |
|
1136 | - $latitude = filter_var($latitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
1137 | - $longitude = filter_var($longitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
1138 | - $waypoints = filter_var($waypoints,FILTER_SANITIZE_STRING); |
|
1139 | - $altitude = filter_var($altitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
1140 | - $altitude_real = filter_var($altitude_real,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
1141 | - $heading = filter_var($heading,FILTER_SANITIZE_NUMBER_INT); |
|
1142 | - $groundspeed = filter_var($groundspeed,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
1143 | - $squawk = filter_var($squawk,FILTER_SANITIZE_NUMBER_INT); |
|
1144 | - $route_stop = filter_var($route_stop,FILTER_SANITIZE_STRING); |
|
1145 | - $ModeS = filter_var($ModeS,FILTER_SANITIZE_STRING); |
|
1146 | - $pilot_id = filter_var($pilot_id,FILTER_SANITIZE_STRING); |
|
1147 | - $pilot_name = filter_var($pilot_name,FILTER_SANITIZE_STRING); |
|
1148 | - $format_source = filter_var($format_source,FILTER_SANITIZE_STRING); |
|
1149 | - $source_name = filter_var($source_name,FILTER_SANITIZE_STRING); |
|
1150 | - $over_country = filter_var($over_country,FILTER_SANITIZE_STRING); |
|
1151 | - $verticalrate = filter_var($verticalrate,FILTER_SANITIZE_NUMBER_INT); |
|
1131 | + $flightaware_id = filter_var($flightaware_id, FILTER_SANITIZE_STRING); |
|
1132 | + $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
|
1133 | + $aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING); |
|
1134 | + $departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING); |
|
1135 | + $arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING); |
|
1136 | + $latitude = filter_var($latitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
1137 | + $longitude = filter_var($longitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
1138 | + $waypoints = filter_var($waypoints, FILTER_SANITIZE_STRING); |
|
1139 | + $altitude = filter_var($altitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
1140 | + $altitude_real = filter_var($altitude_real, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
1141 | + $heading = filter_var($heading, FILTER_SANITIZE_NUMBER_INT); |
|
1142 | + $groundspeed = filter_var($groundspeed, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
1143 | + $squawk = filter_var($squawk, FILTER_SANITIZE_NUMBER_INT); |
|
1144 | + $route_stop = filter_var($route_stop, FILTER_SANITIZE_STRING); |
|
1145 | + $ModeS = filter_var($ModeS, FILTER_SANITIZE_STRING); |
|
1146 | + $pilot_id = filter_var($pilot_id, FILTER_SANITIZE_STRING); |
|
1147 | + $pilot_name = filter_var($pilot_name, FILTER_SANITIZE_STRING); |
|
1148 | + $format_source = filter_var($format_source, FILTER_SANITIZE_STRING); |
|
1149 | + $source_name = filter_var($source_name, FILTER_SANITIZE_STRING); |
|
1150 | + $over_country = filter_var($over_country, FILTER_SANITIZE_STRING); |
|
1151 | + $verticalrate = filter_var($verticalrate, FILTER_SANITIZE_NUMBER_INT); |
|
1152 | 1152 | |
1153 | 1153 | $airline_name = ''; |
1154 | 1154 | $airline_icao = ''; |
@@ -1170,10 +1170,10 @@ discard block |
||
1170 | 1170 | $arrival_airport_country = ''; |
1171 | 1171 | |
1172 | 1172 | |
1173 | - if ($squawk == '' || $Common->isInteger($squawk) === false ) $squawk = NULL; |
|
1174 | - if ($verticalrate == '' || $Common->isInteger($verticalrate) === false ) $verticalrate = NULL; |
|
1175 | - if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) $groundspeed = 0; |
|
1176 | - if ($heading == '' || $Common->isInteger($heading) === false ) $heading = 0; |
|
1173 | + if ($squawk == '' || $Common->isInteger($squawk) === false) $squawk = NULL; |
|
1174 | + if ($verticalrate == '' || $Common->isInteger($verticalrate) === false) $verticalrate = NULL; |
|
1175 | + if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0; |
|
1176 | + if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0; |
|
1177 | 1177 | |
1178 | 1178 | $query = ''; |
1179 | 1179 | if ($globalArchive) { |
@@ -1184,19 +1184,19 @@ discard block |
||
1184 | 1184 | $query .= 'INSERT INTO spotter_live (flightaware_id, ident, registration, airline_name, airline_icao, airline_country, airline_type, aircraft_icao, aircraft_shadow, aircraft_name, aircraft_manufacturer, departure_airport_icao, departure_airport_name, departure_airport_city, departure_airport_country, arrival_airport_icao, arrival_airport_name, arrival_airport_city, arrival_airport_country, latitude, longitude, waypoints, altitude, heading, ground_speed, date, departure_airport_time, arrival_airport_time, squawk, route_stop, ModeS, pilot_id, pilot_name, verticalrate, ground, format_source, source_name, over_country, real_altitude) |
1185 | 1185 | VALUES (:flightaware_id,:ident,:registration,:airline_name,:airline_icao,:airline_country,:airline_type,:aircraft_icao,:aircraft_shadow,:aircraft_type,:aircraft_manufacturer,:departure_airport_icao,:departure_airport_name, :departure_airport_city, :departure_airport_country, :arrival_airport_icao, :arrival_airport_name, :arrival_airport_city, :arrival_airport_country, :latitude,:longitude,:waypoints,:altitude,:heading,:groundspeed,:date,:departure_airport_time,:arrival_airport_time,:squawk,:route_stop,:ModeS, :pilot_id, :pilot_name, :verticalrate, :ground, :format_source, :source_name, :over_country, :real_altitude)'; |
1186 | 1186 | |
1187 | - $query_values = array(':flightaware_id' => $flightaware_id,':ident' => $ident, ':registration' => $registration,':airline_name' => $airline_name,':airline_icao' => $airline_icao,':airline_country' => $airline_country,':airline_type' => $airline_type,':aircraft_icao' => $aircraft_icao,':aircraft_shadow' => $aircraft_shadow,':aircraft_type' => $aircraft_type,':aircraft_manufacturer' => $aircraft_manufacturer,':departure_airport_icao' => $departure_airport_icao,':departure_airport_name' => $departure_airport_name,':departure_airport_city' => $departure_airport_city,':departure_airport_country' => $departure_airport_country,':arrival_airport_icao' => $arrival_airport_icao,':arrival_airport_name' => $arrival_airport_name,':arrival_airport_city' => $arrival_airport_city,':arrival_airport_country' => $arrival_airport_country,':latitude' => $latitude,':longitude' => $longitude, ':waypoints' => $waypoints,':altitude' => $altitude,':heading' => $heading,':groundspeed' => $groundspeed,':date' => $date, ':departure_airport_time' => $departure_airport_time,':arrival_airport_time' => $arrival_airport_time, ':squawk' => $squawk,':route_stop' => $route_stop,':ModeS' => $ModeS, ':pilot_id' => $pilot_id, ':pilot_name' => $pilot_name, ':verticalrate' => $verticalrate, ':format_source' => $format_source,':ground' => $ground, ':source_name' => $source_name, ':over_country' => $over_country,':real_altitude' => $altitude_real); |
|
1187 | + $query_values = array(':flightaware_id' => $flightaware_id, ':ident' => $ident, ':registration' => $registration, ':airline_name' => $airline_name, ':airline_icao' => $airline_icao, ':airline_country' => $airline_country, ':airline_type' => $airline_type, ':aircraft_icao' => $aircraft_icao, ':aircraft_shadow' => $aircraft_shadow, ':aircraft_type' => $aircraft_type, ':aircraft_manufacturer' => $aircraft_manufacturer, ':departure_airport_icao' => $departure_airport_icao, ':departure_airport_name' => $departure_airport_name, ':departure_airport_city' => $departure_airport_city, ':departure_airport_country' => $departure_airport_country, ':arrival_airport_icao' => $arrival_airport_icao, ':arrival_airport_name' => $arrival_airport_name, ':arrival_airport_city' => $arrival_airport_city, ':arrival_airport_country' => $arrival_airport_country, ':latitude' => $latitude, ':longitude' => $longitude, ':waypoints' => $waypoints, ':altitude' => $altitude, ':heading' => $heading, ':groundspeed' => $groundspeed, ':date' => $date, ':departure_airport_time' => $departure_airport_time, ':arrival_airport_time' => $arrival_airport_time, ':squawk' => $squawk, ':route_stop' => $route_stop, ':ModeS' => $ModeS, ':pilot_id' => $pilot_id, ':pilot_name' => $pilot_name, ':verticalrate' => $verticalrate, ':format_source' => $format_source, ':ground' => $ground, ':source_name' => $source_name, ':over_country' => $over_country, ':real_altitude' => $altitude_real); |
|
1188 | 1188 | try { |
1189 | 1189 | |
1190 | 1190 | $sth = $this->db->prepare($query); |
1191 | 1191 | $sth->execute($query_values); |
1192 | 1192 | $sth->closeCursor(); |
1193 | - } catch(PDOException $e) { |
|
1193 | + } catch (PDOException $e) { |
|
1194 | 1194 | return "error : ".$e->getMessage(); |
1195 | 1195 | } |
1196 | 1196 | if (isset($globalArchive) && $globalArchive && $putinarchive && $noarchive !== true) { |
1197 | 1197 | if ($globalDebug) echo '(Add to SBS archive : '; |
1198 | 1198 | $SpotterArchive = new SpotterArchive($this->db); |
1199 | - $result = $SpotterArchive->addSpotterArchiveData($flightaware_id, $ident, $registration, $airline_name, $airline_icao, $airline_country, $airline_type, $aircraft_icao, $aircraft_shadow, $aircraft_name, $aircraft_manufacturer, $departure_airport_icao, $departure_airport_name, $departure_airport_city, $departure_airport_country, $departure_airport_time,$arrival_airport_icao, $arrival_airport_name, $arrival_airport_city, $arrival_airport_country, $arrival_airport_time, $route_stop, $date,$latitude, $longitude, $waypoints, $altitude, $altitude_real,$heading, $groundspeed, $squawk, $ModeS, $pilot_id, $pilot_name,$verticalrate,$format_source,$source_name, $over_country); |
|
1199 | + $result = $SpotterArchive->addSpotterArchiveData($flightaware_id, $ident, $registration, $airline_name, $airline_icao, $airline_country, $airline_type, $aircraft_icao, $aircraft_shadow, $aircraft_name, $aircraft_manufacturer, $departure_airport_icao, $departure_airport_name, $departure_airport_city, $departure_airport_country, $departure_airport_time, $arrival_airport_icao, $arrival_airport_name, $arrival_airport_city, $arrival_airport_country, $arrival_airport_time, $route_stop, $date, $latitude, $longitude, $waypoints, $altitude, $altitude_real, $heading, $groundspeed, $squawk, $ModeS, $pilot_id, $pilot_name, $verticalrate, $format_source, $source_name, $over_country); |
|
1200 | 1200 | if ($globalDebug) echo $result.')'; |
1201 | 1201 | } elseif ($globalDebug && $putinarchive !== true) { |
1202 | 1202 | echo '(Not adding to archive)'; |
@@ -1209,7 +1209,7 @@ discard block |
||
1209 | 1209 | |
1210 | 1210 | public function getOrderBy() |
1211 | 1211 | { |
1212 | - $orderby = array("aircraft_asc" => array("key" => "aircraft_asc", "value" => "Aircraft Type - ASC", "sql" => "ORDER BY spotter_live.aircraft_icao ASC"), "aircraft_desc" => array("key" => "aircraft_desc", "value" => "Aircraft Type - DESC", "sql" => "ORDER BY spotter_live.aircraft_icao DESC"),"manufacturer_asc" => array("key" => "manufacturer_asc", "value" => "Aircraft Manufacturer - ASC", "sql" => "ORDER BY spotter_live.aircraft_manufacturer ASC"), "manufacturer_desc" => array("key" => "manufacturer_desc", "value" => "Aircraft Manufacturer - DESC", "sql" => "ORDER BY spotter_live.aircraft_manufacturer DESC"),"airline_name_asc" => array("key" => "airline_name_asc", "value" => "Airline Name - ASC", "sql" => "ORDER BY spotter_live.airline_name ASC"), "airline_name_desc" => array("key" => "airline_name_desc", "value" => "Airline Name - DESC", "sql" => "ORDER BY spotter_live.airline_name DESC"), "ident_asc" => array("key" => "ident_asc", "value" => "Ident - ASC", "sql" => "ORDER BY spotter_live.ident ASC"), "ident_desc" => array("key" => "ident_desc", "value" => "Ident - DESC", "sql" => "ORDER BY spotter_live.ident DESC"), "airport_departure_asc" => array("key" => "airport_departure_asc", "value" => "Departure Airport - ASC", "sql" => "ORDER BY spotter_live.departure_airport_city ASC"), "airport_departure_desc" => array("key" => "airport_departure_desc", "value" => "Departure Airport - DESC", "sql" => "ORDER BY spotter_live.departure_airport_city DESC"), "airport_arrival_asc" => array("key" => "airport_arrival_asc", "value" => "Arrival Airport - ASC", "sql" => "ORDER BY spotter_live.arrival_airport_city ASC"), "airport_arrival_desc" => array("key" => "airport_arrival_desc", "value" => "Arrival Airport - DESC", "sql" => "ORDER BY spotter_live.arrival_airport_city DESC"), "date_asc" => array("key" => "date_asc", "value" => "Date - ASC", "sql" => "ORDER BY spotter_live.date ASC"), "date_desc" => array("key" => "date_desc", "value" => "Date - DESC", "sql" => "ORDER BY spotter_live.date DESC")); |
|
1212 | + $orderby = array("aircraft_asc" => array("key" => "aircraft_asc", "value" => "Aircraft Type - ASC", "sql" => "ORDER BY spotter_live.aircraft_icao ASC"), "aircraft_desc" => array("key" => "aircraft_desc", "value" => "Aircraft Type - DESC", "sql" => "ORDER BY spotter_live.aircraft_icao DESC"), "manufacturer_asc" => array("key" => "manufacturer_asc", "value" => "Aircraft Manufacturer - ASC", "sql" => "ORDER BY spotter_live.aircraft_manufacturer ASC"), "manufacturer_desc" => array("key" => "manufacturer_desc", "value" => "Aircraft Manufacturer - DESC", "sql" => "ORDER BY spotter_live.aircraft_manufacturer DESC"), "airline_name_asc" => array("key" => "airline_name_asc", "value" => "Airline Name - ASC", "sql" => "ORDER BY spotter_live.airline_name ASC"), "airline_name_desc" => array("key" => "airline_name_desc", "value" => "Airline Name - DESC", "sql" => "ORDER BY spotter_live.airline_name DESC"), "ident_asc" => array("key" => "ident_asc", "value" => "Ident - ASC", "sql" => "ORDER BY spotter_live.ident ASC"), "ident_desc" => array("key" => "ident_desc", "value" => "Ident - DESC", "sql" => "ORDER BY spotter_live.ident DESC"), "airport_departure_asc" => array("key" => "airport_departure_asc", "value" => "Departure Airport - ASC", "sql" => "ORDER BY spotter_live.departure_airport_city ASC"), "airport_departure_desc" => array("key" => "airport_departure_desc", "value" => "Departure Airport - DESC", "sql" => "ORDER BY spotter_live.departure_airport_city DESC"), "airport_arrival_asc" => array("key" => "airport_arrival_asc", "value" => "Arrival Airport - ASC", "sql" => "ORDER BY spotter_live.arrival_airport_city ASC"), "airport_arrival_desc" => array("key" => "airport_arrival_desc", "value" => "Arrival Airport - DESC", "sql" => "ORDER BY spotter_live.arrival_airport_city DESC"), "date_asc" => array("key" => "date_asc", "value" => "Date - ASC", "sql" => "ORDER BY spotter_live.date ASC"), "date_desc" => array("key" => "date_desc", "value" => "Date - DESC", "sql" => "ORDER BY spotter_live.date DESC")); |
|
1213 | 1213 | return $orderby; |
1214 | 1214 | } |
1215 | 1215 |
@@ -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. (SpotterLive)'); |
|
11 | + if ($this->db === null) { |
|
12 | + die('Error: No DB connection. (SpotterLive)'); |
|
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) { |
@@ -126,8 +130,11 @@ discard block |
||
126 | 130 | if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) { |
127 | 131 | $filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')"; |
128 | 132 | } |
129 | - if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE'; |
|
130 | - elseif ($filter_query_where != '' && $and) $filter_query_where .= ' AND'; |
|
133 | + if ($filter_query_where == '' && $where) { |
|
134 | + $filter_query_where = ' WHERE'; |
|
135 | + } elseif ($filter_query_where != '' && $and) { |
|
136 | + $filter_query_where .= ' AND'; |
|
137 | + } |
|
131 | 138 | if ($filter_query_where != '') { |
132 | 139 | $filter_query_where = preg_replace('/^ AND/',' WHERE',$filter_query_where); |
133 | 140 | } |
@@ -168,9 +175,13 @@ discard block |
||
168 | 175 | $orderby_query = ' '.$search_orderby_array[$sort]['sql']; |
169 | 176 | } |
170 | 177 | } |
171 | - if ($orderby_query == '') $orderby_query = ' ORDER BY date DESC'; |
|
178 | + if ($orderby_query == '') { |
|
179 | + $orderby_query = ' ORDER BY date DESC'; |
|
180 | + } |
|
172 | 181 | |
173 | - if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
|
182 | + if (!isset($globalLiveInterval)) { |
|
183 | + $globalLiveInterval = '200'; |
|
184 | + } |
|
174 | 185 | if ($globalDBdriver == 'mysql') { |
175 | 186 | //$query = "SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL 30 SECOND) <= l.date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate"; |
176 | 187 | $query = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate'.$filter_query.$orderby_query; |
@@ -193,7 +204,9 @@ discard block |
||
193 | 204 | global $globalDBdriver, $globalLiveInterval, $globalArchive; |
194 | 205 | date_default_timezone_set('UTC'); |
195 | 206 | $filter_query = $this->getFilter($filter,true,true); |
196 | - if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
|
207 | + if (!isset($globalLiveInterval)) { |
|
208 | + $globalLiveInterval = '200'; |
|
209 | + } |
|
197 | 210 | if ($globalDBdriver == 'mysql') { |
198 | 211 | if (isset($globalArchive) && $globalArchive === TRUE) { |
199 | 212 | $query = 'SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source |
@@ -244,8 +257,12 @@ discard block |
||
244 | 257 | $id = filter_var($id,FILTER_SANITIZE_STRING); |
245 | 258 | $filter_query = $this->getFilter($filter,true,true); |
246 | 259 | |
247 | - if (!isset($globalLiveInterval) || $globalLiveInterval == '') $globalLiveInterval = '200'; |
|
248 | - if (!isset($globalMap3DAircraftsLimit) || $globalMap3DAircraftsLimit == '') $globalMap3DAircraftsLimit = '300'; |
|
260 | + if (!isset($globalLiveInterval) || $globalLiveInterval == '') { |
|
261 | + $globalLiveInterval = '200'; |
|
262 | + } |
|
263 | + if (!isset($globalMap3DAircraftsLimit) || $globalMap3DAircraftsLimit == '') { |
|
264 | + $globalMap3DAircraftsLimit = '300'; |
|
265 | + } |
|
249 | 266 | if ($globalDBdriver == 'mysql') { |
250 | 267 | if (isset($globalArchive) && $globalArchive === TRUE) { |
251 | 268 | /* |
@@ -256,25 +273,41 @@ discard block |
||
256 | 273 | */ |
257 | 274 | $query = 'SELECT * FROM (SELECT spotter_archive.ident, spotter_archive.flightaware_id, spotter_archive.aircraft_icao, spotter_archive.departure_airport_icao as departure_airport, spotter_archive.arrival_airport_icao as arrival_airport, spotter_archive.latitude, spotter_archive.longitude, spotter_archive.altitude, spotter_archive.heading, spotter_archive.ground_speed, spotter_archive.squawk, spotter_archive.date, spotter_archive.format_source |
258 | 275 | FROM spotter_archive INNER JOIN (SELECT flightaware_id FROM spotter_live'.$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval." SECOND) <= spotter_live.date) l ON l.flightaware_id = spotter_archive.flightaware_id "; |
259 | - if ($usecoord) $query .= "AND (spotter_archive.latitude BETWEEN ".$minlat." AND ".$maxlat." AND spotter_archive.longitude BETWEEN ".$minlong." AND ".$maxlong.") "; |
|
260 | - if ($id != '') $query .= "OR spotter_archive.flightaware_id = :id "; |
|
276 | + if ($usecoord) { |
|
277 | + $query .= "AND (spotter_archive.latitude BETWEEN ".$minlat." AND ".$maxlat." AND spotter_archive.longitude BETWEEN ".$minlong." AND ".$maxlong.") "; |
|
278 | + } |
|
279 | + if ($id != '') { |
|
280 | + $query .= "OR spotter_archive.flightaware_id = :id "; |
|
281 | + } |
|
261 | 282 | $query .= "UNION |
262 | 283 | SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source |
263 | 284 | FROM spotter_live".$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval." SECOND) <= spotter_live.date"; |
264 | - if ($usecoord) $query .= " AND (spotter_live.latitude BETWEEN ".$minlat." AND ".$maxlat." AND spotter_live.longitude BETWEEN ".$minlong." AND ".$maxlong.")"; |
|
265 | - if ($id != '') $query .= " OR spotter_live.flightaware_id = :id"; |
|
285 | + if ($usecoord) { |
|
286 | + $query .= " AND (spotter_live.latitude BETWEEN ".$minlat." AND ".$maxlat." AND spotter_live.longitude BETWEEN ".$minlong." AND ".$maxlong.")"; |
|
287 | + } |
|
288 | + if ($id != '') { |
|
289 | + $query .= " OR spotter_live.flightaware_id = :id"; |
|
290 | + } |
|
266 | 291 | $query .= ") AS spotter |
267 | 292 | WHERE latitude <> '0' AND longitude <> '0' |
268 | 293 | ORDER BY flightaware_id, date"; |
269 | - if ($limit) $query .= " LIMIT ".$globalMap3DAircraftsLimit; |
|
294 | + if ($limit) { |
|
295 | + $query .= " LIMIT ".$globalMap3DAircraftsLimit; |
|
296 | + } |
|
270 | 297 | } else { |
271 | 298 | $query = 'SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source |
272 | 299 | FROM spotter_live'.$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval." SECOND) <= spotter_live.date "; |
273 | - if ($usecoord) $query .= "AND (spotter_live.latitude BETWEEN ".$minlat." AND ".$maxlat." AND spotter_live.longitude BETWEEN ".$minlong." AND ".$maxlong.") "; |
|
274 | - if ($id != '') $query .= "OR spotter_live.flightaware_id = :id "; |
|
300 | + if ($usecoord) { |
|
301 | + $query .= "AND (spotter_live.latitude BETWEEN ".$minlat." AND ".$maxlat." AND spotter_live.longitude BETWEEN ".$minlong." AND ".$maxlong.") "; |
|
302 | + } |
|
303 | + if ($id != '') { |
|
304 | + $query .= "OR spotter_live.flightaware_id = :id "; |
|
305 | + } |
|
275 | 306 | $query .= "AND spotter_live.latitude <> '0' AND spotter_live.longitude <> '0' |
276 | 307 | ORDER BY spotter_live.flightaware_id, spotter_live.date"; |
277 | - if ($limit) $query .= " LIMIT ".$globalMap3DAircraftsLimit; |
|
308 | + if ($limit) { |
|
309 | + $query .= " LIMIT ".$globalMap3DAircraftsLimit; |
|
310 | + } |
|
278 | 311 | } |
279 | 312 | } else { |
280 | 313 | if (isset($globalArchive) && $globalArchive === TRUE) { |
@@ -286,28 +319,46 @@ discard block |
||
286 | 319 | */ |
287 | 320 | $query = "SELECT * FROM (SELECT spotter_archive.ident, spotter_archive.flightaware_id, spotter_archive.aircraft_icao, spotter_archive.departure_airport_icao as departure_airport, spotter_archive.arrival_airport_icao as arrival_airport, spotter_archive.latitude, spotter_archive.longitude, spotter_archive.altitude, spotter_archive.heading, spotter_archive.ground_speed, spotter_archive.squawk, spotter_archive.date, spotter_archive.format_source |
288 | 321 | FROM spotter_archive INNER JOIN (SELECT flightaware_id FROM spotter_live".$filter_query." CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= spotter_live.date) l ON l.flightaware_id = spotter_archive.flightaware_id "; |
289 | - if ($usecoord) $query .= "AND (spotter_archive.latitude BETWEEN ".$minlat." AND ".$maxlat." AND spotter_archive.longitude BETWEEN ".$minlong." AND ".$maxlong.") "; |
|
290 | - if ($id != '') $query .= "OR spotter_archive.flightaware_id = :id "; |
|
322 | + if ($usecoord) { |
|
323 | + $query .= "AND (spotter_archive.latitude BETWEEN ".$minlat." AND ".$maxlat." AND spotter_archive.longitude BETWEEN ".$minlong." AND ".$maxlong.") "; |
|
324 | + } |
|
325 | + if ($id != '') { |
|
326 | + $query .= "OR spotter_archive.flightaware_id = :id "; |
|
327 | + } |
|
291 | 328 | $query .= "UNION |
292 | 329 | SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source |
293 | 330 | FROM spotter_live".$filter_query." CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= spotter_live.date"; |
294 | - if ($usecoord) $query .= " AND (spotter_live.latitude BETWEEN ".$minlat." AND ".$maxlat." AND spotter_live.longitude BETWEEN ".$minlong." AND ".$maxlong.")"; |
|
295 | - if ($id != '') $query .= " OR spotter_live.flightaware_id = :id"; |
|
331 | + if ($usecoord) { |
|
332 | + $query .= " AND (spotter_live.latitude BETWEEN ".$minlat." AND ".$maxlat." AND spotter_live.longitude BETWEEN ".$minlong." AND ".$maxlong.")"; |
|
333 | + } |
|
334 | + if ($id != '') { |
|
335 | + $query .= " OR spotter_live.flightaware_id = :id"; |
|
336 | + } |
|
296 | 337 | $query .= ") AS spotter WHERE latitude <> '0' AND longitude <> '0' "; |
297 | 338 | $query .= "ORDER BY flightaware_id, date"; |
298 | - if ($limit) $query .= " LIMIT ".$globalMap3DAircraftsLimit; |
|
339 | + if ($limit) { |
|
340 | + $query .= " LIMIT ".$globalMap3DAircraftsLimit; |
|
341 | + } |
|
299 | 342 | } else { |
300 | 343 | $query = "SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source |
301 | 344 | FROM spotter_live".$filter_query." CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= spotter_live.date "; |
302 | - if ($usecoord) $query .= "AND (spotter_live.latitude BETWEEN ".$minlat." AND ".$maxlat." AND spotter_live.longitude BETWEEN ".$minlong." AND ".$maxlong.") "; |
|
303 | - if ($id != '') $query .= "OR spotter_live.flightaware_id = :id "; |
|
345 | + if ($usecoord) { |
|
346 | + $query .= "AND (spotter_live.latitude BETWEEN ".$minlat." AND ".$maxlat." AND spotter_live.longitude BETWEEN ".$minlong." AND ".$maxlong.") "; |
|
347 | + } |
|
348 | + if ($id != '') { |
|
349 | + $query .= "OR spotter_live.flightaware_id = :id "; |
|
350 | + } |
|
304 | 351 | $query .= "AND spotter_live.latitude <> '0' AND spotter_live.longitude <> '0' |
305 | 352 | ORDER BY spotter_live.flightaware_id, spotter_live.date"; |
306 | - if ($limit) $query .= " LIMIT ".$globalMap3DAircraftsLimit; |
|
353 | + if ($limit) { |
|
354 | + $query .= " LIMIT ".$globalMap3DAircraftsLimit; |
|
355 | + } |
|
307 | 356 | } |
308 | 357 | } |
309 | 358 | $query_values = array(); |
310 | - if ($id != '') $query_values = array(':id' => $id); |
|
359 | + if ($id != '') { |
|
360 | + $query_values = array(':id' => $id); |
|
361 | + } |
|
311 | 362 | try { |
312 | 363 | $sth = $this->db->prepare($query); |
313 | 364 | $sth->execute($query_values); |
@@ -330,7 +381,9 @@ discard block |
||
330 | 381 | global $globalDBdriver, $globalLiveInterval; |
331 | 382 | $filter_query = $this->getFilter($filter,true,true); |
332 | 383 | |
333 | - if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
|
384 | + if (!isset($globalLiveInterval)) { |
|
385 | + $globalLiveInterval = '200'; |
|
386 | + } |
|
334 | 387 | if ($globalDBdriver == 'mysql') { |
335 | 388 | //$query = 'SELECT COUNT(*) as nb FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate'.$filter_query; |
336 | 389 | $query = 'SELECT COUNT(DISTINCT spotter_live.flightaware_id) as nb FROM spotter_live'.$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= date'; |
@@ -360,7 +413,9 @@ discard block |
||
360 | 413 | { |
361 | 414 | global $globalDBdriver, $globalLiveInterval; |
362 | 415 | $Spotter = new Spotter($this->db); |
363 | - if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
|
416 | + if (!isset($globalLiveInterval)) { |
|
417 | + $globalLiveInterval = '200'; |
|
418 | + } |
|
364 | 419 | $filter_query = $this->getFilter($filter); |
365 | 420 | |
366 | 421 | if (is_array($coord)) { |
@@ -368,7 +423,9 @@ discard block |
||
368 | 423 | $minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
369 | 424 | $maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
370 | 425 | $maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
371 | - } else return array(); |
|
426 | + } else { |
|
427 | + return array(); |
|
428 | + } |
|
372 | 429 | if ($globalDBdriver == 'mysql') { |
373 | 430 | $query = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate AND spotter_live.latitude BETWEEN '.$minlat.' AND '.$maxlat.' AND spotter_live.longitude BETWEEN '.$minlong.' AND '.$maxlong.' GROUP BY spotter_live.flightaware_id'.$filter_query; |
374 | 431 | } else { |
@@ -389,7 +446,9 @@ discard block |
||
389 | 446 | { |
390 | 447 | global $globalDBdriver, $globalLiveInterval, $globalArchive; |
391 | 448 | $Spotter = new Spotter($this->db); |
392 | - if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
|
449 | + if (!isset($globalLiveInterval)) { |
|
450 | + $globalLiveInterval = '200'; |
|
451 | + } |
|
393 | 452 | $filter_query = $this->getFilter($filter,true,true); |
394 | 453 | |
395 | 454 | if (is_array($coord)) { |
@@ -397,7 +456,9 @@ discard block |
||
397 | 456 | $minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
398 | 457 | $maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
399 | 458 | $maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
400 | - } else return array(); |
|
459 | + } else { |
|
460 | + return array(); |
|
461 | + } |
|
401 | 462 | if ($globalDBdriver == 'mysql') { |
402 | 463 | if (isset($globalArchive) && $globalArchive === TRUE) { |
403 | 464 | $query = 'SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source |
@@ -624,11 +685,15 @@ discard block |
||
624 | 685 | //$query = self::$global_query.' WHERE spotter_live.flightaware_id = :id ORDER BY date'; |
625 | 686 | if ($globalDBdriver == 'mysql') { |
626 | 687 | $query = 'SELECT spotter_live.* FROM spotter_live WHERE spotter_live.flightaware_id = :id'; |
627 | - if ($liveinterval) $query .= ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= date'; |
|
688 | + if ($liveinterval) { |
|
689 | + $query .= ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= date'; |
|
690 | + } |
|
628 | 691 | $query .= ' ORDER BY date'; |
629 | 692 | } else { |
630 | 693 | $query = 'SELECT spotter_live.* FROM spotter_live WHERE spotter_live.flightaware_id = :id'; |
631 | - if ($liveinterval) $query .= " AND CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= date"; |
|
694 | + if ($liveinterval) { |
|
695 | + $query .= " AND CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= date"; |
|
696 | + } |
|
632 | 697 | $query .= ' ORDER BY date'; |
633 | 698 | } |
634 | 699 | |
@@ -723,7 +788,9 @@ discard block |
||
723 | 788 | $i++; |
724 | 789 | $j++; |
725 | 790 | if ($j == 30) { |
726 | - if ($globalDebug) echo "."; |
|
791 | + if ($globalDebug) { |
|
792 | + echo "."; |
|
793 | + } |
|
727 | 794 | try { |
728 | 795 | |
729 | 796 | $sth = $this->db->prepare(substr($query_delete,0,-1).")"); |
@@ -1076,7 +1143,9 @@ discard block |
||
1076 | 1143 | { |
1077 | 1144 | return false; |
1078 | 1145 | } |
1079 | - } else return ''; |
|
1146 | + } else { |
|
1147 | + return ''; |
|
1148 | + } |
|
1080 | 1149 | |
1081 | 1150 | if ($longitude != '') |
1082 | 1151 | { |
@@ -1084,7 +1153,9 @@ discard block |
||
1084 | 1153 | { |
1085 | 1154 | return false; |
1086 | 1155 | } |
1087 | - } else return ''; |
|
1156 | + } else { |
|
1157 | + return ''; |
|
1158 | + } |
|
1088 | 1159 | |
1089 | 1160 | if ($waypoints != '') |
1090 | 1161 | { |
@@ -1100,14 +1171,18 @@ discard block |
||
1100 | 1171 | { |
1101 | 1172 | return false; |
1102 | 1173 | } |
1103 | - } else $altitude = 0; |
|
1174 | + } else { |
|
1175 | + $altitude = 0; |
|
1176 | + } |
|
1104 | 1177 | if ($altitude_real != '') |
1105 | 1178 | { |
1106 | 1179 | if (!is_numeric($altitude_real)) |
1107 | 1180 | { |
1108 | 1181 | return false; |
1109 | 1182 | } |
1110 | - } else $altitude_real = 0; |
|
1183 | + } else { |
|
1184 | + $altitude_real = 0; |
|
1185 | + } |
|
1111 | 1186 | |
1112 | 1187 | if ($heading != '') |
1113 | 1188 | { |
@@ -1115,7 +1190,9 @@ discard block |
||
1115 | 1190 | { |
1116 | 1191 | return false; |
1117 | 1192 | } |
1118 | - } else $heading = 0; |
|
1193 | + } else { |
|
1194 | + $heading = 0; |
|
1195 | + } |
|
1119 | 1196 | |
1120 | 1197 | if ($groundspeed != '') |
1121 | 1198 | { |
@@ -1123,9 +1200,13 @@ discard block |
||
1123 | 1200 | { |
1124 | 1201 | return false; |
1125 | 1202 | } |
1126 | - } else $groundspeed = 0; |
|
1203 | + } else { |
|
1204 | + $groundspeed = 0; |
|
1205 | + } |
|
1127 | 1206 | date_default_timezone_set('UTC'); |
1128 | - if ($date == '') $date = date("Y-m-d H:i:s", time()); |
|
1207 | + if ($date == '') { |
|
1208 | + $date = date("Y-m-d H:i:s", time()); |
|
1209 | + } |
|
1129 | 1210 | |
1130 | 1211 | |
1131 | 1212 | $flightaware_id = filter_var($flightaware_id,FILTER_SANITIZE_STRING); |
@@ -1170,14 +1251,24 @@ discard block |
||
1170 | 1251 | $arrival_airport_country = ''; |
1171 | 1252 | |
1172 | 1253 | |
1173 | - if ($squawk == '' || $Common->isInteger($squawk) === false ) $squawk = NULL; |
|
1174 | - if ($verticalrate == '' || $Common->isInteger($verticalrate) === false ) $verticalrate = NULL; |
|
1175 | - if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) $groundspeed = 0; |
|
1176 | - if ($heading == '' || $Common->isInteger($heading) === false ) $heading = 0; |
|
1254 | + if ($squawk == '' || $Common->isInteger($squawk) === false ) { |
|
1255 | + $squawk = NULL; |
|
1256 | + } |
|
1257 | + if ($verticalrate == '' || $Common->isInteger($verticalrate) === false ) { |
|
1258 | + $verticalrate = NULL; |
|
1259 | + } |
|
1260 | + if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) { |
|
1261 | + $groundspeed = 0; |
|
1262 | + } |
|
1263 | + if ($heading == '' || $Common->isInteger($heading) === false ) { |
|
1264 | + $heading = 0; |
|
1265 | + } |
|
1177 | 1266 | |
1178 | 1267 | $query = ''; |
1179 | 1268 | if ($globalArchive) { |
1180 | - if ($globalDebug) echo '-- Delete previous data -- '; |
|
1269 | + if ($globalDebug) { |
|
1270 | + echo '-- Delete previous data -- '; |
|
1271 | + } |
|
1181 | 1272 | $query .= 'DELETE FROM spotter_live WHERE flightaware_id = :flightaware_id;'; |
1182 | 1273 | } |
1183 | 1274 | |
@@ -1194,10 +1285,14 @@ discard block |
||
1194 | 1285 | return "error : ".$e->getMessage(); |
1195 | 1286 | } |
1196 | 1287 | if (isset($globalArchive) && $globalArchive && $putinarchive && $noarchive !== true) { |
1197 | - if ($globalDebug) echo '(Add to SBS archive : '; |
|
1288 | + if ($globalDebug) { |
|
1289 | + echo '(Add to SBS archive : '; |
|
1290 | + } |
|
1198 | 1291 | $SpotterArchive = new SpotterArchive($this->db); |
1199 | 1292 | $result = $SpotterArchive->addSpotterArchiveData($flightaware_id, $ident, $registration, $airline_name, $airline_icao, $airline_country, $airline_type, $aircraft_icao, $aircraft_shadow, $aircraft_name, $aircraft_manufacturer, $departure_airport_icao, $departure_airport_name, $departure_airport_city, $departure_airport_country, $departure_airport_time,$arrival_airport_icao, $arrival_airport_name, $arrival_airport_city, $arrival_airport_country, $arrival_airport_time, $route_stop, $date,$latitude, $longitude, $waypoints, $altitude, $altitude_real,$heading, $groundspeed, $squawk, $ModeS, $pilot_id, $pilot_name,$verticalrate,$format_source,$source_name, $over_country); |
1200 | - if ($globalDebug) echo $result.')'; |
|
1293 | + if ($globalDebug) { |
|
1294 | + echo $result.')'; |
|
1295 | + } |
|
1201 | 1296 | } elseif ($globalDebug && $putinarchive !== true) { |
1202 | 1297 | echo '(Not adding to archive)'; |
1203 | 1298 | } elseif ($globalDebug && $noarchive === true) { |
@@ -14,75 +14,75 @@ discard block |
||
14 | 14 | * @param Array $filter the filter |
15 | 15 | * @return Array the SQL part |
16 | 16 | */ |
17 | - public function getFilter($filter = array(),$where = false,$and = false) { |
|
17 | + public function getFilter($filter = array(), $where = false, $and = false) { |
|
18 | 18 | global $globalFilter, $globalStatsFilters, $globalFilterName, $globalDBdriver; |
19 | 19 | $filters = array(); |
20 | 20 | if (is_array($globalStatsFilters) && isset($globalStatsFilters[$globalFilterName])) { |
21 | 21 | if (isset($globalStatsFilters[$globalFilterName][0]['source'])) { |
22 | 22 | $filters = $globalStatsFilters[$globalFilterName]; |
23 | 23 | } else { |
24 | - $filter = array_merge($filter,$globalStatsFilters[$globalFilterName]); |
|
24 | + $filter = array_merge($filter, $globalStatsFilters[$globalFilterName]); |
|
25 | 25 | } |
26 | 26 | } |
27 | 27 | if (isset($filter[0]['source'])) { |
28 | - $filters = array_merge($filters,$filter); |
|
28 | + $filters = array_merge($filters, $filter); |
|
29 | 29 | } |
30 | - if (is_array($globalFilter)) $filter = array_merge($filter,$globalFilter); |
|
30 | + if (is_array($globalFilter)) $filter = array_merge($filter, $globalFilter); |
|
31 | 31 | $filter_query_join = ''; |
32 | 32 | $filter_query_where = ''; |
33 | - foreach($filters as $flt) { |
|
33 | + foreach ($filters as $flt) { |
|
34 | 34 | if (isset($flt['airlines']) && !empty($flt['airlines'])) { |
35 | 35 | if ($flt['airlines'][0] != '' && $flt['airlines'][0] != 'all') { |
36 | 36 | if (isset($flt['source'])) { |
37 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.airline_icao IN ('".implode("','",$flt['airlines'])."') AND spotter_archive_output.format_source IN ('".implode("','",$flt['source'])."')) saff ON saff.flightaware_id = spotter_archive_output.flightaware_id"; |
|
37 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.airline_icao IN ('".implode("','", $flt['airlines'])."') AND spotter_archive_output.format_source IN ('".implode("','", $flt['source'])."')) saff ON saff.flightaware_id = spotter_archive_output.flightaware_id"; |
|
38 | 38 | } else { |
39 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.airline_icao IN ('".implode("','",$flt['airlines'])."')) saff ON saff.flightaware_id = spotter_archive_output.flightaware_id"; |
|
39 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.airline_icao IN ('".implode("','", $flt['airlines'])."')) saff ON saff.flightaware_id = spotter_archive_output.flightaware_id"; |
|
40 | 40 | } |
41 | 41 | } |
42 | 42 | } |
43 | 43 | if (isset($flt['pilots_id']) && !empty($flt['pilots_id'])) { |
44 | 44 | if (isset($flt['source'])) { |
45 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.pilot_id IN ('".implode("','",$flt['pilots_id'])."') AND spotter_archive_output.format_source IN ('".implode("','",$flt['source'])."')) sp ON sp.flightaware_id = spotter_archive_output.flightaware_id"; |
|
45 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.pilot_id IN ('".implode("','", $flt['pilots_id'])."') AND spotter_archive_output.format_source IN ('".implode("','", $flt['source'])."')) sp ON sp.flightaware_id = spotter_archive_output.flightaware_id"; |
|
46 | 46 | } else { |
47 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.pilot_id IN ('".implode("','",$flt['pilots_id'])."')) sp ON sp.flightaware_id = spotter_archive_output.flightaware_id"; |
|
47 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.pilot_id IN ('".implode("','", $flt['pilots_id'])."')) sp ON sp.flightaware_id = spotter_archive_output.flightaware_id"; |
|
48 | 48 | } |
49 | 49 | } |
50 | 50 | if (isset($flt['idents']) && !empty($flt['idents'])) { |
51 | 51 | if (isset($flt['source'])) { |
52 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.ident IN ('".implode("','",$flt['idents'])."') AND spotter_archive_output.format_source IN ('".implode("','",$flt['source'])."')) spi ON spi.flightaware_id = spotter_archive_output.flightaware_id"; |
|
52 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.ident IN ('".implode("','", $flt['idents'])."') AND spotter_archive_output.format_source IN ('".implode("','", $flt['source'])."')) spi ON spi.flightaware_id = spotter_archive_output.flightaware_id"; |
|
53 | 53 | } else { |
54 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.ident IN ('".implode("','",$flt['idents'])."')) spi ON spi.flightaware_id = spotter_archive_output.flightaware_id"; |
|
54 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.ident IN ('".implode("','", $flt['idents'])."')) spi ON spi.flightaware_id = spotter_archive_output.flightaware_id"; |
|
55 | 55 | } |
56 | 56 | } |
57 | 57 | if (isset($flt['registrations']) && !empty($flt['registrations'])) { |
58 | 58 | if (isset($flt['source'])) { |
59 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.registration IN ('".implode("','",$flt['registrations'])."') AND spotter_archive_output.format_source IN ('".implode("','",$flt['source'])."')) sre ON sre.flightaware_id = spotter_archive_output.flightaware_id"; |
|
59 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.registration IN ('".implode("','", $flt['registrations'])."') AND spotter_archive_output.format_source IN ('".implode("','", $flt['source'])."')) sre ON sre.flightaware_id = spotter_archive_output.flightaware_id"; |
|
60 | 60 | } else { |
61 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.registration IN ('".implode("','",$flt['registrations'])."')) sre ON sre.flightaware_id = spotter_archive_output.flightaware_id"; |
|
61 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.registration IN ('".implode("','", $flt['registrations'])."')) sre ON sre.flightaware_id = spotter_archive_output.flightaware_id"; |
|
62 | 62 | } |
63 | 63 | } |
64 | 64 | if ((isset($flt['airlines']) && empty($flt['airlines']) && isset($flt['pilots_id']) && empty($flt['pilots_id']) && isset($flt['idents']) && empty($flt['idents']) && isset($flt['registrations']) && empty($flt['registrations'])) || (!isset($flt['airlines']) && !isset($flt['pilots_id']) && !isset($flt['idents']) && !isset($flt['registrations']))) { |
65 | 65 | if (isset($flt['source'])) { |
66 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_output.format_source IN ('".implode("','",$flt['source'])."')) saa ON saa.flightaware_id = spotter_archive_output.flightaware_id"; |
|
66 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_output.format_source IN ('".implode("','", $flt['source'])."')) saa ON saa.flightaware_id = spotter_archive_output.flightaware_id"; |
|
67 | 67 | } |
68 | 68 | } |
69 | 69 | } |
70 | 70 | if (isset($filter['airlines']) && !empty($filter['airlines'])) { |
71 | 71 | if ($filter['airlines'][0] != '' && $filter['airlines'][0] != 'all') { |
72 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.airline_icao IN ('".implode("','",$filter['airlines'])."')) saf ON saf.flightaware_id = spotter_archive_output.flightaware_id"; |
|
72 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.airline_icao IN ('".implode("','", $filter['airlines'])."')) saf ON saf.flightaware_id = spotter_archive_output.flightaware_id"; |
|
73 | 73 | } |
74 | 74 | } |
75 | 75 | if (isset($filter['airlinestype']) && !empty($filter['airlinestype'])) { |
76 | 76 | $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.airline_type = '".$filter['airlinestype']."') sa ON sa.flightaware_id = spotter_archive_output.flightaware_id "; |
77 | 77 | } |
78 | 78 | if (isset($filter['pilots_id']) && !empty($filter['pilots_id'])) { |
79 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.pilot_id IN ('".implode("','",$filter['pilots_id'])."')) spi ON spi.flightaware_id = spotter_archive_output.flightaware_id"; |
|
79 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.pilot_id IN ('".implode("','", $filter['pilots_id'])."')) spi ON spi.flightaware_id = spotter_archive_output.flightaware_id"; |
|
80 | 80 | } |
81 | 81 | if (isset($filter['source']) && !empty($filter['source'])) { |
82 | 82 | if (count($filter['source']) == 1) { |
83 | 83 | $filter_query_where .= " AND format_source = '".$filter['source'][0]."'"; |
84 | 84 | } else { |
85 | - $filter_query_where .= " AND format_source IN ('".implode("','",$filter['source'])."')"; |
|
85 | + $filter_query_where .= " AND format_source IN ('".implode("','", $filter['source'])."')"; |
|
86 | 86 | } |
87 | 87 | } |
88 | 88 | if (isset($filter['ident']) && !empty($filter['ident'])) { |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | $filter_query_where .= " AND flightaware_id = '".$filter['id']."'"; |
93 | 93 | } |
94 | 94 | if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) { |
95 | - $filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')"; |
|
95 | + $filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','", $filter['source_aprs'])."')"; |
|
96 | 96 | } |
97 | 97 | if ((isset($filter['year']) && $filter['year'] != '') || (isset($filter['month']) && $filter['month'] != '') || (isset($filter['day']) && $filter['day'] != '')) { |
98 | 98 | $filter_query_date = ''; |
@@ -117,41 +117,41 @@ discard block |
||
117 | 117 | $filter_query_date .= " AND EXTRACT(DAY FROM spotter_archive_output.date) = '".$filter['day']."'"; |
118 | 118 | } |
119 | 119 | } |
120 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output".preg_replace('/^ AND/',' WHERE',$filter_query_date).") sd ON sd.flightaware_id = spotter_archive_output.flightaware_id"; |
|
120 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output".preg_replace('/^ AND/', ' WHERE', $filter_query_date).") sd ON sd.flightaware_id = spotter_archive_output.flightaware_id"; |
|
121 | 121 | } |
122 | 122 | if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE'; |
123 | 123 | elseif ($filter_query_where != '' && $and) $filter_query_where .= ' AND'; |
124 | 124 | if ($filter_query_where != '') { |
125 | - $filter_query_where = preg_replace('/^ AND/',' WHERE',$filter_query_where); |
|
125 | + $filter_query_where = preg_replace('/^ AND/', ' WHERE', $filter_query_where); |
|
126 | 126 | } |
127 | 127 | $filter_query = $filter_query_join.$filter_query_where; |
128 | 128 | return $filter_query; |
129 | 129 | } |
130 | 130 | |
131 | 131 | // Spotter_archive |
132 | - public function addSpotterArchiveData($flightaware_id = '', $ident = '', $registration = '', $airline_name = '', $airline_icao = '', $airline_country = '', $airline_type = '', $aircraft_icao = '', $aircraft_shadow = '', $aircraft_name = '', $aircraft_manufacturer = '', $departure_airport_icao = '', $departure_airport_name = '', $departure_airport_city = '', $departure_airport_country = '', $departure_airport_time = '',$arrival_airport_icao = '', $arrival_airport_name = '', $arrival_airport_city ='', $arrival_airport_country = '', $arrival_airport_time = '', $route_stop = '', $date = '',$latitude = '', $longitude = '', $waypoints = '', $altitude = '', $real_altitude = '',$heading = '', $ground_speed = '', $squawk = '', $ModeS = '', $pilot_id = '', $pilot_name = '',$verticalrate = '',$format_source = '', $source_name = '', $over_country = '') { |
|
132 | + public function addSpotterArchiveData($flightaware_id = '', $ident = '', $registration = '', $airline_name = '', $airline_icao = '', $airline_country = '', $airline_type = '', $aircraft_icao = '', $aircraft_shadow = '', $aircraft_name = '', $aircraft_manufacturer = '', $departure_airport_icao = '', $departure_airport_name = '', $departure_airport_city = '', $departure_airport_country = '', $departure_airport_time = '', $arrival_airport_icao = '', $arrival_airport_name = '', $arrival_airport_city = '', $arrival_airport_country = '', $arrival_airport_time = '', $route_stop = '', $date = '', $latitude = '', $longitude = '', $waypoints = '', $altitude = '', $real_altitude = '', $heading = '', $ground_speed = '', $squawk = '', $ModeS = '', $pilot_id = '', $pilot_name = '', $verticalrate = '', $format_source = '', $source_name = '', $over_country = '') { |
|
133 | 133 | require_once(dirname(__FILE__).'/class.Spotter.php'); |
134 | 134 | if ($over_country == '') { |
135 | 135 | $Spotter = new Spotter($this->db); |
136 | - $data_country = $Spotter->getCountryFromLatitudeLongitude($latitude,$longitude); |
|
136 | + $data_country = $Spotter->getCountryFromLatitudeLongitude($latitude, $longitude); |
|
137 | 137 | if (!empty($data_country)) $country = $data_country['iso2']; |
138 | 138 | else $country = ''; |
139 | 139 | } else $country = $over_country; |
140 | - if ($airline_type === NULL) $airline_type =''; |
|
140 | + if ($airline_type === NULL) $airline_type = ''; |
|
141 | 141 | |
142 | 142 | //if ($country == '') echo "\n".'************ UNKNOW COUNTRY ****************'."\n"; |
143 | 143 | //else echo "\n".'*/*/*/*/*/*/*/ Country : '.$country.' */*/*/*/*/*/*/*/*/'."\n"; |
144 | 144 | |
145 | 145 | // Route is not added in spotter_archive |
146 | - $query = "INSERT INTO spotter_archive (flightaware_id, ident, registration, airline_name, airline_icao, airline_country, airline_type, aircraft_icao, aircraft_shadow, aircraft_name, aircraft_manufacturer, departure_airport_icao, departure_airport_name, departure_airport_city, departure_airport_country, departure_airport_time,arrival_airport_icao, arrival_airport_name, arrival_airport_city, arrival_airport_country, arrival_airport_time, route_stop, date,latitude, longitude, waypoints, altitude, heading, ground_speed, squawk, ModeS, pilot_id, pilot_name, verticalrate,format_source,over_country,source_name,real_altitude) |
|
146 | + $query = "INSERT INTO spotter_archive (flightaware_id, ident, registration, airline_name, airline_icao, airline_country, airline_type, aircraft_icao, aircraft_shadow, aircraft_name, aircraft_manufacturer, departure_airport_icao, departure_airport_name, departure_airport_city, departure_airport_country, departure_airport_time,arrival_airport_icao, arrival_airport_name, arrival_airport_city, arrival_airport_country, arrival_airport_time, route_stop, date,latitude, longitude, waypoints, altitude, heading, ground_speed, squawk, ModeS, pilot_id, pilot_name, verticalrate,format_source,over_country,source_name,real_altitude) |
|
147 | 147 | VALUES (:flightaware_id, :ident, :registration, :airline_name, :airline_icao, :airline_country, :airline_type, :aircraft_icao, :aircraft_shadow, :aircraft_name, :aircraft_manufacturer, :departure_airport_icao, :departure_airport_name, :departure_airport_city, :departure_airport_country, :departure_airport_time,:arrival_airport_icao, :arrival_airport_name, :arrival_airport_city, :arrival_airport_country, :arrival_airport_time, :route_stop, :date,:latitude, :longitude, :waypoints, :altitude, :heading, :ground_speed, :squawk, :ModeS, :pilot_id, :pilot_name, :verticalrate, :format_source, :over_country, :source_name,:real_altitude)"; |
148 | 148 | |
149 | - $query_values = array(':flightaware_id' => $flightaware_id, ':ident' => $ident, ':registration' => $registration, ':airline_name' => $airline_name, ':airline_icao' => $airline_icao, ':airline_country' => $airline_country, ':airline_type' => $airline_type, ':aircraft_icao' => $aircraft_icao, ':aircraft_shadow' => $aircraft_shadow, ':aircraft_name' => $aircraft_name, ':aircraft_manufacturer' => $aircraft_manufacturer, ':departure_airport_icao' => $departure_airport_icao, ':departure_airport_name' => $departure_airport_name, ':departure_airport_city' => $departure_airport_city, ':departure_airport_country' => $departure_airport_country, ':departure_airport_time' => $departure_airport_time,':arrival_airport_icao' => $arrival_airport_icao, ':arrival_airport_name' => $arrival_airport_name, ':arrival_airport_city' => $arrival_airport_city, ':arrival_airport_country' => $arrival_airport_country, ':arrival_airport_time' => $arrival_airport_time, ':route_stop' => $route_stop, ':date' => $date,':latitude' => $latitude, ':longitude' => $longitude, ':waypoints' => $waypoints, ':altitude' => $altitude, ':heading' => $heading, ':ground_speed' => $ground_speed, ':squawk' => $squawk, ':ModeS' => $ModeS, ':pilot_id' => $pilot_id, ':pilot_name' => $pilot_name, ':verticalrate' => $verticalrate, ':format_source' => $format_source, ':over_country' => $country, ':source_name' => $source_name,':real_altitude' => $real_altitude); |
|
149 | + $query_values = array(':flightaware_id' => $flightaware_id, ':ident' => $ident, ':registration' => $registration, ':airline_name' => $airline_name, ':airline_icao' => $airline_icao, ':airline_country' => $airline_country, ':airline_type' => $airline_type, ':aircraft_icao' => $aircraft_icao, ':aircraft_shadow' => $aircraft_shadow, ':aircraft_name' => $aircraft_name, ':aircraft_manufacturer' => $aircraft_manufacturer, ':departure_airport_icao' => $departure_airport_icao, ':departure_airport_name' => $departure_airport_name, ':departure_airport_city' => $departure_airport_city, ':departure_airport_country' => $departure_airport_country, ':departure_airport_time' => $departure_airport_time, ':arrival_airport_icao' => $arrival_airport_icao, ':arrival_airport_name' => $arrival_airport_name, ':arrival_airport_city' => $arrival_airport_city, ':arrival_airport_country' => $arrival_airport_country, ':arrival_airport_time' => $arrival_airport_time, ':route_stop' => $route_stop, ':date' => $date, ':latitude' => $latitude, ':longitude' => $longitude, ':waypoints' => $waypoints, ':altitude' => $altitude, ':heading' => $heading, ':ground_speed' => $ground_speed, ':squawk' => $squawk, ':ModeS' => $ModeS, ':pilot_id' => $pilot_id, ':pilot_name' => $pilot_name, ':verticalrate' => $verticalrate, ':format_source' => $format_source, ':over_country' => $country, ':source_name' => $source_name, ':real_altitude' => $real_altitude); |
|
150 | 150 | try { |
151 | 151 | $sth = $this->db->prepare($query); |
152 | 152 | $sth->execute($query_values); |
153 | 153 | $sth->closeCursor(); |
154 | - } catch(PDOException $e) { |
|
154 | + } catch (PDOException $e) { |
|
155 | 155 | return "error : ".$e->getMessage(); |
156 | 156 | } |
157 | 157 | return "success"; |
@@ -171,9 +171,9 @@ discard block |
||
171 | 171 | |
172 | 172 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
173 | 173 | //$query = "SELECT spotter_archive.* FROM spotter_archive INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_archive l WHERE l.ident = :ident GROUP BY l.flightaware_id) s on spotter_archive.flightaware_id = s.flightaware_id AND spotter_archive.date = s.maxdate LIMIT 1"; |
174 | - $query = "SELECT spotter_archive.* FROM spotter_archive WHERE ident = :ident ORDER BY date DESC LIMIT 1"; |
|
174 | + $query = "SELECT spotter_archive.* FROM spotter_archive WHERE ident = :ident ORDER BY date DESC LIMIT 1"; |
|
175 | 175 | |
176 | - $spotter_array = $Spotter->getDataFromDB($query,array(':ident' => $ident)); |
|
176 | + $spotter_array = $Spotter->getDataFromDB($query, array(':ident' => $ident)); |
|
177 | 177 | |
178 | 178 | return $spotter_array; |
179 | 179 | } |
@@ -192,7 +192,7 @@ discard block |
||
192 | 192 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
193 | 193 | //$query = SpotterArchive->$global_query." WHERE spotter_archive.flightaware_id = :id"; |
194 | 194 | //$query = "SELECT spotter_archive.* FROM spotter_archive INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_archive l WHERE l.flightaware_id = :id GROUP BY l.flightaware_id) s on spotter_archive.flightaware_id = s.flightaware_id AND spotter_archive.date = s.maxdate LIMIT 1"; |
195 | - $query = "SELECT * FROM spotter_archive WHERE flightaware_id = :id ORDER BY date DESC LIMIT 1"; |
|
195 | + $query = "SELECT * FROM spotter_archive WHERE flightaware_id = :id ORDER BY date DESC LIMIT 1"; |
|
196 | 196 | |
197 | 197 | // $spotter_array = Spotter->getDataFromDB($query,array(':id' => $id)); |
198 | 198 | /* |
@@ -205,7 +205,7 @@ discard block |
||
205 | 205 | } |
206 | 206 | $spotter_array = $sth->fetchAll(PDO->FETCH_ASSOC); |
207 | 207 | */ |
208 | - $spotter_array = $Spotter->getDataFromDB($query,array(':id' => $id)); |
|
208 | + $spotter_array = $Spotter->getDataFromDB($query, array(':id' => $id)); |
|
209 | 209 | |
210 | 210 | return $spotter_array; |
211 | 211 | } |
@@ -220,14 +220,14 @@ discard block |
||
220 | 220 | { |
221 | 221 | date_default_timezone_set('UTC'); |
222 | 222 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
223 | - $query = $this->global_query." WHERE spotter_archive.flightaware_id = :id ORDER BY date"; |
|
223 | + $query = $this->global_query." WHERE spotter_archive.flightaware_id = :id ORDER BY date"; |
|
224 | 224 | |
225 | 225 | // $spotter_array = Spotter->getDataFromDB($query,array(':id' => $id)); |
226 | 226 | |
227 | 227 | try { |
228 | 228 | $sth = $this->db->prepare($query); |
229 | 229 | $sth->execute(array(':id' => $id)); |
230 | - } catch(PDOException $e) { |
|
230 | + } catch (PDOException $e) { |
|
231 | 231 | echo $e->getMessage(); |
232 | 232 | die; |
233 | 233 | } |
@@ -246,14 +246,14 @@ discard block |
||
246 | 246 | { |
247 | 247 | date_default_timezone_set('UTC'); |
248 | 248 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
249 | - $query = "SELECT spotter_archive.latitude, spotter_archive.longitude, spotter_archive.date FROM spotter_archive WHERE spotter_archive.flightaware_id = :id"; |
|
249 | + $query = "SELECT spotter_archive.latitude, spotter_archive.longitude, spotter_archive.date FROM spotter_archive WHERE spotter_archive.flightaware_id = :id"; |
|
250 | 250 | |
251 | 251 | // $spotter_array = Spotter->getDataFromDB($query,array(':id' => $id)); |
252 | 252 | |
253 | 253 | try { |
254 | 254 | $sth = $this->db->prepare($query); |
255 | 255 | $sth->execute(array(':id' => $id)); |
256 | - } catch(PDOException $e) { |
|
256 | + } catch (PDOException $e) { |
|
257 | 257 | echo $e->getMessage(); |
258 | 258 | die; |
259 | 259 | } |
@@ -275,12 +275,12 @@ discard block |
||
275 | 275 | date_default_timezone_set('UTC'); |
276 | 276 | |
277 | 277 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
278 | - $query = "SELECT spotter_archive.altitude, spotter_archive.date FROM spotter_archive WHERE spotter_archive.ident = :ident AND spotter_archive.latitude <> 0 AND spotter_archive.longitude <> 0 ORDER BY date"; |
|
278 | + $query = "SELECT spotter_archive.altitude, spotter_archive.date FROM spotter_archive WHERE spotter_archive.ident = :ident AND spotter_archive.latitude <> 0 AND spotter_archive.longitude <> 0 ORDER BY date"; |
|
279 | 279 | |
280 | 280 | try { |
281 | 281 | $sth = $this->db->prepare($query); |
282 | 282 | $sth->execute(array(':ident' => $ident)); |
283 | - } catch(PDOException $e) { |
|
283 | + } catch (PDOException $e) { |
|
284 | 284 | echo $e->getMessage(); |
285 | 285 | die; |
286 | 286 | } |
@@ -301,12 +301,12 @@ discard block |
||
301 | 301 | date_default_timezone_set('UTC'); |
302 | 302 | |
303 | 303 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
304 | - $query = "SELECT spotter_archive.altitude, spotter_archive.date FROM spotter_archive WHERE spotter_archive.flightaware_id = :id AND spotter_archive.latitude <> 0 AND spotter_archive.longitude <> 0 ORDER BY date"; |
|
304 | + $query = "SELECT spotter_archive.altitude, spotter_archive.date FROM spotter_archive WHERE spotter_archive.flightaware_id = :id AND spotter_archive.latitude <> 0 AND spotter_archive.longitude <> 0 ORDER BY date"; |
|
305 | 305 | |
306 | 306 | try { |
307 | 307 | $sth = $this->db->prepare($query); |
308 | 308 | $sth->execute(array(':id' => $id)); |
309 | - } catch(PDOException $e) { |
|
309 | + } catch (PDOException $e) { |
|
310 | 310 | echo $e->getMessage(); |
311 | 311 | die; |
312 | 312 | } |
@@ -325,11 +325,11 @@ discard block |
||
325 | 325 | { |
326 | 326 | date_default_timezone_set('UTC'); |
327 | 327 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
328 | - $query = "SELECT spotter_archive.altitude, spotter_archive.real_altitude,spotter_archive.ground_speed, spotter_archive.date FROM spotter_archive WHERE spotter_archive.flightaware_id = :id ORDER BY date"; |
|
328 | + $query = "SELECT spotter_archive.altitude, spotter_archive.real_altitude,spotter_archive.ground_speed, spotter_archive.date FROM spotter_archive WHERE spotter_archive.flightaware_id = :id ORDER BY date"; |
|
329 | 329 | try { |
330 | 330 | $sth = $this->db->prepare($query); |
331 | 331 | $sth->execute(array(':id' => $id)); |
332 | - } catch(PDOException $e) { |
|
332 | + } catch (PDOException $e) { |
|
333 | 333 | echo $e->getMessage(); |
334 | 334 | die; |
335 | 335 | } |
@@ -347,12 +347,12 @@ discard block |
||
347 | 347 | { |
348 | 348 | date_default_timezone_set('UTC'); |
349 | 349 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
350 | - $query = "SELECT spotter_archive.altitude, spotter_archive.date FROM spotter_archive INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_archive l WHERE l.ident = :ident GROUP BY l.flightaware_id) s on spotter_archive.flightaware_id = s.flightaware_id AND spotter_archive.date = s.maxdate LIMIT 1"; |
|
350 | + $query = "SELECT spotter_archive.altitude, spotter_archive.date FROM spotter_archive INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_archive l WHERE l.ident = :ident GROUP BY l.flightaware_id) s on spotter_archive.flightaware_id = s.flightaware_id AND spotter_archive.date = s.maxdate LIMIT 1"; |
|
351 | 351 | // $query = "SELECT spotter_archive.altitude, spotter_archive.date FROM spotter_archive WHERE spotter_archive.ident = :ident"; |
352 | 352 | try { |
353 | 353 | $sth = $this->db->prepare($query); |
354 | 354 | $sth->execute(array(':ident' => $ident)); |
355 | - } catch(PDOException $e) { |
|
355 | + } catch (PDOException $e) { |
|
356 | 356 | echo $e->getMessage(); |
357 | 357 | die; |
358 | 358 | } |
@@ -368,12 +368,12 @@ discard block |
||
368 | 368 | * @return Array the spotter information |
369 | 369 | * |
370 | 370 | */ |
371 | - public function getSpotterArchiveData($ident,$flightaware_id,$date) |
|
371 | + public function getSpotterArchiveData($ident, $flightaware_id, $date) |
|
372 | 372 | { |
373 | 373 | $Spotter = new Spotter($this->db); |
374 | 374 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
375 | - $query = "SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.ident = :ident AND l.flightaware_id = :flightaware_id AND l.date LIKE :date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate"; |
|
376 | - $spotter_array = $Spotter->getDataFromDB($query,array(':ident' => $ident,':flightaware_id' => $flightaware_id,':date' => $date.'%')); |
|
375 | + $query = "SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.ident = :ident AND l.flightaware_id = :flightaware_id AND l.date LIKE :date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate"; |
|
376 | + $spotter_array = $Spotter->getDataFromDB($query, array(':ident' => $ident, ':flightaware_id' => $flightaware_id, ':date' => $date.'%')); |
|
377 | 377 | return $spotter_array; |
378 | 378 | } |
379 | 379 | |
@@ -388,7 +388,7 @@ discard block |
||
388 | 388 | try { |
389 | 389 | $sth = $this->db->prepare($query); |
390 | 390 | $sth->execute(); |
391 | - } catch(PDOException $e) { |
|
391 | + } catch (PDOException $e) { |
|
392 | 392 | echo $e->getMessage(); |
393 | 393 | die; |
394 | 394 | } |
@@ -400,24 +400,24 @@ discard block |
||
400 | 400 | * @return Array the spotter information |
401 | 401 | * |
402 | 402 | */ |
403 | - public function getMinLiveSpotterData($begindate,$enddate,$filter = array()) |
|
403 | + public function getMinLiveSpotterData($begindate, $enddate, $filter = array()) |
|
404 | 404 | { |
405 | 405 | global $globalDBdriver, $globalLiveInterval; |
406 | 406 | date_default_timezone_set('UTC'); |
407 | 407 | |
408 | 408 | $filter_query = ''; |
409 | 409 | if (isset($filter['source']) && !empty($filter['source'])) { |
410 | - $filter_query .= " AND format_source IN ('".implode("','",$filter['source'])."') "; |
|
410 | + $filter_query .= " AND format_source IN ('".implode("','", $filter['source'])."') "; |
|
411 | 411 | } |
412 | 412 | // Use spotter_output also ? |
413 | 413 | if (isset($filter['airlines']) && !empty($filter['airlines'])) { |
414 | - $filter_query .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.airline_icao IN ('".implode("','",$filter['airlines'])."')) so ON so.flightaware_id = spotter_archive.flightaware_id "; |
|
414 | + $filter_query .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.airline_icao IN ('".implode("','", $filter['airlines'])."')) so ON so.flightaware_id = spotter_archive.flightaware_id "; |
|
415 | 415 | } |
416 | 416 | if (isset($filter['airlinestype']) && !empty($filter['airlinestype'])) { |
417 | 417 | $filter_query .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.airline_type = '".$filter['airlinestype']."') sa ON sa.flightaware_id = spotter_archive.flightaware_id "; |
418 | 418 | } |
419 | 419 | if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) { |
420 | - $filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')"; |
|
420 | + $filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','", $filter['source_aprs'])."')"; |
|
421 | 421 | } |
422 | 422 | |
423 | 423 | //if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
@@ -436,14 +436,14 @@ discard block |
||
436 | 436 | GROUP BY l.flightaware_id) s on spotter_archive.flightaware_id = s.flightaware_id |
437 | 437 | AND spotter_archive.date = s.maxdate '.$filter_query.'LEFT JOIN (SELECT aircraft_shadow,icao FROM aircraft) a ON spotter_archive.aircraft_icao = a.icao'; |
438 | 438 | */ |
439 | - $query = 'SELECT spotter_archive.date,spotter_archive.flightaware_id, spotter_archive.ident, spotter_archive.aircraft_icao, spotter_archive.departure_airport_icao as departure_airport, spotter_archive.arrival_airport_icao as arrival_airport, spotter_archive.latitude, spotter_archive.longitude, spotter_archive.altitude, spotter_archive.heading, spotter_archive.ground_speed, spotter_archive.squawk, a.aircraft_shadow,a.engine_type, a.engine_count, a.wake_category |
|
439 | + $query = 'SELECT spotter_archive.date,spotter_archive.flightaware_id, spotter_archive.ident, spotter_archive.aircraft_icao, spotter_archive.departure_airport_icao as departure_airport, spotter_archive.arrival_airport_icao as arrival_airport, spotter_archive.latitude, spotter_archive.longitude, spotter_archive.altitude, spotter_archive.heading, spotter_archive.ground_speed, spotter_archive.squawk, a.aircraft_shadow,a.engine_type, a.engine_count, a.wake_category |
|
440 | 440 | FROM spotter_archive |
441 | 441 | INNER JOIN (SELECT * FROM aircraft) a on spotter_archive.aircraft_icao = a.icao |
442 | 442 | WHERE spotter_archive.date BETWEEN '."'".$begindate."'".' AND '."'".$begindate."'".' |
443 | 443 | '.$filter_query.' ORDER BY flightaware_id'; |
444 | 444 | } else { |
445 | 445 | //$query = 'SELECT spotter_archive.ident, spotter_archive.flightaware_id, spotter_archive.aircraft_icao, spotter_archive.departure_airport_icao as departure_airport, spotter_archive.arrival_airport_icao as arrival_airport, spotter_archive.latitude, spotter_archive.longitude, spotter_archive.altitude, spotter_archive.heading, spotter_archive.ground_speed, spotter_archive.squawk, a.aircraft_shadow FROM spotter_archive INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_archive l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.flightaware_id) s on spotter_archive.flightaware_id = s.flightaware_id AND spotter_archive.date = s.maxdate '.$filter_query.'INNER JOIN (SELECT * FROM aircraft) a on spotter_archive.aircraft_icao = a.icao'; |
446 | - $query = 'SELECT spotter_archive.date,spotter_archive.flightaware_id, spotter_archive.ident, spotter_archive.aircraft_icao, spotter_archive.departure_airport_icao as departure_airport, spotter_archive.arrival_airport_icao as arrival_airport, spotter_archive.latitude, spotter_archive.longitude, spotter_archive.altitude, spotter_archive.heading, spotter_archive.ground_speed, spotter_archive.squawk, a.aircraft_shadow,a.engine_type, a.engine_count, a.wake_category |
|
446 | + $query = 'SELECT spotter_archive.date,spotter_archive.flightaware_id, spotter_archive.ident, spotter_archive.aircraft_icao, spotter_archive.departure_airport_icao as departure_airport, spotter_archive.arrival_airport_icao as arrival_airport, spotter_archive.latitude, spotter_archive.longitude, spotter_archive.altitude, spotter_archive.heading, spotter_archive.ground_speed, spotter_archive.squawk, a.aircraft_shadow,a.engine_type, a.engine_count, a.wake_category |
|
447 | 447 | FROM spotter_archive |
448 | 448 | INNER JOIN (SELECT * FROM aircraft) a on spotter_archive.aircraft_icao = a.icao |
449 | 449 | WHERE spotter_archive.date >= '."'".$begindate."'".' AND spotter_archive.date <= '."'".$enddate."'".' |
@@ -453,7 +453,7 @@ discard block |
||
453 | 453 | try { |
454 | 454 | $sth = $this->db->prepare($query); |
455 | 455 | $sth->execute(); |
456 | - } catch(PDOException $e) { |
|
456 | + } catch (PDOException $e) { |
|
457 | 457 | echo $e->getMessage(); |
458 | 458 | die; |
459 | 459 | } |
@@ -468,24 +468,24 @@ discard block |
||
468 | 468 | * @return Array the spotter information |
469 | 469 | * |
470 | 470 | */ |
471 | - public function getMinLiveSpotterDataPlayback($begindate,$enddate,$filter = array()) |
|
471 | + public function getMinLiveSpotterDataPlayback($begindate, $enddate, $filter = array()) |
|
472 | 472 | { |
473 | 473 | global $globalDBdriver, $globalLiveInterval; |
474 | 474 | date_default_timezone_set('UTC'); |
475 | 475 | |
476 | 476 | $filter_query = ''; |
477 | 477 | if (isset($filter['source']) && !empty($filter['source'])) { |
478 | - $filter_query .= " AND format_source IN ('".implode("','",$filter['source'])."') "; |
|
478 | + $filter_query .= " AND format_source IN ('".implode("','", $filter['source'])."') "; |
|
479 | 479 | } |
480 | 480 | // Should use spotter_output also ? |
481 | 481 | if (isset($filter['airlines']) && !empty($filter['airlines'])) { |
482 | - $filter_query .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.airline_icao IN ('".implode("','",$filter['airlines'])."')) so ON so.flightaware_id = spotter_archive.flightaware_id "; |
|
482 | + $filter_query .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.airline_icao IN ('".implode("','", $filter['airlines'])."')) so ON so.flightaware_id = spotter_archive.flightaware_id "; |
|
483 | 483 | } |
484 | 484 | if (isset($filter['airlinestype']) && !empty($filter['airlinestype'])) { |
485 | 485 | $filter_query .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.airline_type = '".$filter['airlinestype']."') sa ON sa.flightaware_id = spotter_archive.flightaware_id "; |
486 | 486 | } |
487 | 487 | if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) { |
488 | - $filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')"; |
|
488 | + $filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','", $filter['source_aprs'])."')"; |
|
489 | 489 | } |
490 | 490 | |
491 | 491 | //if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
@@ -495,7 +495,7 @@ discard block |
||
495 | 495 | FROM spotter_archive |
496 | 496 | INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_archive l WHERE (l.date BETWEEN '."'".$begindate."'".' AND '."'".$enddate."'".') GROUP BY l.flightaware_id) s on spotter_archive.flightaware_id = s.flightaware_id AND spotter_archive.date = s.maxdate '.$filter_query.'LEFT JOIN (SELECT aircraft_shadow,icao FROM aircraft) a ON spotter_archive.aircraft_icao = a.icao'; |
497 | 497 | */ |
498 | - $query = 'SELECT a.aircraft_shadow, spotter_archive_output.ident, spotter_archive_output.flightaware_id, spotter_archive_output.aircraft_icao, spotter_archive_output.departure_airport_icao as departure_airport, spotter_archive_output.arrival_airport_icao as arrival_airport, spotter_archive_output.latitude, spotter_archive_output.longitude, spotter_archive_output.altitude, spotter_archive_output.heading, spotter_archive_output.ground_speed, spotter_archive_output.squawk |
|
498 | + $query = 'SELECT a.aircraft_shadow, spotter_archive_output.ident, spotter_archive_output.flightaware_id, spotter_archive_output.aircraft_icao, spotter_archive_output.departure_airport_icao as departure_airport, spotter_archive_output.arrival_airport_icao as arrival_airport, spotter_archive_output.latitude, spotter_archive_output.longitude, spotter_archive_output.altitude, spotter_archive_output.heading, spotter_archive_output.ground_speed, spotter_archive_output.squawk |
|
499 | 499 | FROM spotter_archive_output |
500 | 500 | LEFT JOIN (SELECT aircraft_shadow,icao FROM aircraft) a ON spotter_archive_output.aircraft_icao = a.icao |
501 | 501 | WHERE (spotter_archive_output.date BETWEEN '."'".$begindate."'".' AND '."'".$enddate."'".') |
@@ -510,7 +510,7 @@ discard block |
||
510 | 510 | WHERE spotter_archive_output.date >= '."'".$begindate."'".' AND spotter_archive_output.date <= '."'".$enddate."'".' |
511 | 511 | '.$filter_query.' GROUP BY spotter_archive_output.flightaware_id, spotter_archive_output.ident, spotter_archive_output.aircraft_icao, spotter_archive_output.departure_airport_icao, spotter_archive_output.arrival_airport_icao, spotter_archive_output.latitude, spotter_archive_output.longitude, spotter_archive_output.altitude, spotter_archive_output.heading, spotter_archive_output.ground_speed, spotter_archive_output.squawk, a.aircraft_shadow'; |
512 | 512 | */ |
513 | - $query = 'SELECT DISTINCT spotter_archive_output.flightaware_id, spotter_archive_output.ident, spotter_archive_output.aircraft_icao, spotter_archive_output.departure_airport_icao as departure_airport, spotter_archive_output.arrival_airport_icao as arrival_airport, spotter_archive_output.latitude, spotter_archive_output.longitude, spotter_archive_output.altitude, spotter_archive_output.heading, spotter_archive_output.ground_speed, spotter_archive_output.squawk, a.aircraft_shadow |
|
513 | + $query = 'SELECT DISTINCT spotter_archive_output.flightaware_id, spotter_archive_output.ident, spotter_archive_output.aircraft_icao, spotter_archive_output.departure_airport_icao as departure_airport, spotter_archive_output.arrival_airport_icao as arrival_airport, spotter_archive_output.latitude, spotter_archive_output.longitude, spotter_archive_output.altitude, spotter_archive_output.heading, spotter_archive_output.ground_speed, spotter_archive_output.squawk, a.aircraft_shadow |
|
514 | 514 | FROM spotter_archive_output |
515 | 515 | INNER JOIN (SELECT * FROM aircraft) a on spotter_archive_output.aircraft_icao = a.icao |
516 | 516 | WHERE spotter_archive_output.date >= '."'".$begindate."'".' AND spotter_archive_output.date <= '."'".$enddate."'".' |
@@ -522,7 +522,7 @@ discard block |
||
522 | 522 | try { |
523 | 523 | $sth = $this->db->prepare($query); |
524 | 524 | $sth->execute(); |
525 | - } catch(PDOException $e) { |
|
525 | + } catch (PDOException $e) { |
|
526 | 526 | echo $e->getMessage(); |
527 | 527 | die; |
528 | 528 | } |
@@ -537,23 +537,23 @@ discard block |
||
537 | 537 | * @return Array the spotter information |
538 | 538 | * |
539 | 539 | */ |
540 | - public function getLiveSpotterCount($begindate,$enddate,$filter = array()) |
|
540 | + public function getLiveSpotterCount($begindate, $enddate, $filter = array()) |
|
541 | 541 | { |
542 | 542 | global $globalDBdriver, $globalLiveInterval; |
543 | 543 | date_default_timezone_set('UTC'); |
544 | 544 | |
545 | 545 | $filter_query = ''; |
546 | 546 | if (isset($filter['source']) && !empty($filter['source'])) { |
547 | - $filter_query .= " AND format_source IN ('".implode("','",$filter['source'])."') "; |
|
547 | + $filter_query .= " AND format_source IN ('".implode("','", $filter['source'])."') "; |
|
548 | 548 | } |
549 | 549 | if (isset($filter['airlines']) && !empty($filter['airlines'])) { |
550 | - $filter_query .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','",$filter['airlines'])."')) so ON so.flightaware_id = spotter_archive.flightaware_id "; |
|
550 | + $filter_query .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','", $filter['airlines'])."')) so ON so.flightaware_id = spotter_archive.flightaware_id "; |
|
551 | 551 | } |
552 | 552 | if (isset($filter['airlinestype']) && !empty($filter['airlinestype'])) { |
553 | 553 | $filter_query .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_type = '".$filter['airlinestype']."') sa ON sa.flightaware_id = spotter_archive.flightaware_id "; |
554 | 554 | } |
555 | 555 | if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) { |
556 | - $filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')"; |
|
556 | + $filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','", $filter['source_aprs'])."')"; |
|
557 | 557 | } |
558 | 558 | |
559 | 559 | //if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
@@ -568,7 +568,7 @@ discard block |
||
568 | 568 | try { |
569 | 569 | $sth = $this->db->prepare($query); |
570 | 570 | $sth->execute(); |
571 | - } catch(PDOException $e) { |
|
571 | + } catch (PDOException $e) { |
|
572 | 572 | echo $e->getMessage(); |
573 | 573 | die; |
574 | 574 | } |
@@ -588,7 +588,7 @@ discard block |
||
588 | 588 | * @return Array the spotter information |
589 | 589 | * |
590 | 590 | */ |
591 | - public function searchSpotterData($q = '', $registration = '', $aircraft_icao = '', $aircraft_manufacturer = '', $highlights = '', $airline_icao = '', $airline_country = '', $airline_type = '', $airport = '', $airport_country = '', $callsign = '', $departure_airport_route = '', $arrival_airport_route = '', $owner = '',$pilot_id = '',$pilot_name = '',$altitude = '', $date_posted = '', $limit = '', $sort = '', $includegeodata = '',$origLat = '',$origLon = '',$dist = '', $filters=array()) |
|
591 | + public function searchSpotterData($q = '', $registration = '', $aircraft_icao = '', $aircraft_manufacturer = '', $highlights = '', $airline_icao = '', $airline_country = '', $airline_type = '', $airport = '', $airport_country = '', $callsign = '', $departure_airport_route = '', $arrival_airport_route = '', $owner = '', $pilot_id = '', $pilot_name = '', $altitude = '', $date_posted = '', $limit = '', $sort = '', $includegeodata = '', $origLat = '', $origLon = '', $dist = '', $filters = array()) |
|
592 | 592 | { |
593 | 593 | global $globalTimezone, $globalDBdriver; |
594 | 594 | require_once(dirname(__FILE__).'/class.Translation.php'); |
@@ -610,7 +610,7 @@ discard block |
||
610 | 610 | |
611 | 611 | $q_array = explode(" ", $q); |
612 | 612 | |
613 | - foreach ($q_array as $q_item){ |
|
613 | + foreach ($q_array as $q_item) { |
|
614 | 614 | $additional_query .= " AND ("; |
615 | 615 | $additional_query .= "(spotter_archive_output.spotter_id like '%".$q_item."%') OR "; |
616 | 616 | $additional_query .= "(spotter_archive_output.aircraft_icao like '%".$q_item."%') OR "; |
@@ -642,7 +642,7 @@ discard block |
||
642 | 642 | |
643 | 643 | if ($registration != "") |
644 | 644 | { |
645 | - $registration = filter_var($registration,FILTER_SANITIZE_STRING); |
|
645 | + $registration = filter_var($registration, FILTER_SANITIZE_STRING); |
|
646 | 646 | if (!is_string($registration)) |
647 | 647 | { |
648 | 648 | return false; |
@@ -653,7 +653,7 @@ discard block |
||
653 | 653 | |
654 | 654 | if ($aircraft_icao != "") |
655 | 655 | { |
656 | - $aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING); |
|
656 | + $aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING); |
|
657 | 657 | if (!is_string($aircraft_icao)) |
658 | 658 | { |
659 | 659 | return false; |
@@ -664,7 +664,7 @@ discard block |
||
664 | 664 | |
665 | 665 | if ($aircraft_manufacturer != "") |
666 | 666 | { |
667 | - $aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING); |
|
667 | + $aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING); |
|
668 | 668 | if (!is_string($aircraft_manufacturer)) |
669 | 669 | { |
670 | 670 | return false; |
@@ -685,7 +685,7 @@ discard block |
||
685 | 685 | |
686 | 686 | if ($airline_icao != "") |
687 | 687 | { |
688 | - $airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING); |
|
688 | + $airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING); |
|
689 | 689 | if (!is_string($airline_icao)) |
690 | 690 | { |
691 | 691 | return false; |
@@ -696,7 +696,7 @@ discard block |
||
696 | 696 | |
697 | 697 | if ($airline_country != "") |
698 | 698 | { |
699 | - $airline_country = filter_var($airline_country,FILTER_SANITIZE_STRING); |
|
699 | + $airline_country = filter_var($airline_country, FILTER_SANITIZE_STRING); |
|
700 | 700 | if (!is_string($airline_country)) |
701 | 701 | { |
702 | 702 | return false; |
@@ -707,7 +707,7 @@ discard block |
||
707 | 707 | |
708 | 708 | if ($airline_type != "") |
709 | 709 | { |
710 | - $airline_type = filter_var($airline_type,FILTER_SANITIZE_STRING); |
|
710 | + $airline_type = filter_var($airline_type, FILTER_SANITIZE_STRING); |
|
711 | 711 | if (!is_string($airline_type)) |
712 | 712 | { |
713 | 713 | return false; |
@@ -729,7 +729,7 @@ discard block |
||
729 | 729 | |
730 | 730 | if ($airport != "") |
731 | 731 | { |
732 | - $airport = filter_var($airport,FILTER_SANITIZE_STRING); |
|
732 | + $airport = filter_var($airport, FILTER_SANITIZE_STRING); |
|
733 | 733 | if (!is_string($airport)) |
734 | 734 | { |
735 | 735 | return false; |
@@ -740,7 +740,7 @@ discard block |
||
740 | 740 | |
741 | 741 | if ($airport_country != "") |
742 | 742 | { |
743 | - $airport_country = filter_var($airport_country,FILTER_SANITIZE_STRING); |
|
743 | + $airport_country = filter_var($airport_country, FILTER_SANITIZE_STRING); |
|
744 | 744 | if (!is_string($airport_country)) |
745 | 745 | { |
746 | 746 | return false; |
@@ -751,7 +751,7 @@ discard block |
||
751 | 751 | |
752 | 752 | if ($callsign != "") |
753 | 753 | { |
754 | - $callsign = filter_var($callsign,FILTER_SANITIZE_STRING); |
|
754 | + $callsign = filter_var($callsign, FILTER_SANITIZE_STRING); |
|
755 | 755 | if (!is_string($callsign)) |
756 | 756 | { |
757 | 757 | return false; |
@@ -759,7 +759,7 @@ discard block |
||
759 | 759 | $translate = $Translation->ident2icao($callsign); |
760 | 760 | if ($translate != $callsign) { |
761 | 761 | $additional_query .= " AND (spotter_archive_output.ident = :callsign OR spotter_archive_output.ident = :translate)"; |
762 | - $query_values = array_merge($query_values,array(':callsign' => $callsign,':translate' => $translate)); |
|
762 | + $query_values = array_merge($query_values, array(':callsign' => $callsign, ':translate' => $translate)); |
|
763 | 763 | } else { |
764 | 764 | $additional_query .= " AND (spotter_archive_output.ident = '".$callsign."')"; |
765 | 765 | } |
@@ -768,7 +768,7 @@ discard block |
||
768 | 768 | |
769 | 769 | if ($owner != "") |
770 | 770 | { |
771 | - $owner = filter_var($owner,FILTER_SANITIZE_STRING); |
|
771 | + $owner = filter_var($owner, FILTER_SANITIZE_STRING); |
|
772 | 772 | if (!is_string($owner)) |
773 | 773 | { |
774 | 774 | return false; |
@@ -779,7 +779,7 @@ discard block |
||
779 | 779 | |
780 | 780 | if ($pilot_name != "") |
781 | 781 | { |
782 | - $pilot_name = filter_var($pilot_name,FILTER_SANITIZE_STRING); |
|
782 | + $pilot_name = filter_var($pilot_name, FILTER_SANITIZE_STRING); |
|
783 | 783 | if (!is_string($pilot_name)) |
784 | 784 | { |
785 | 785 | return false; |
@@ -790,7 +790,7 @@ discard block |
||
790 | 790 | |
791 | 791 | if ($pilot_id != "") |
792 | 792 | { |
793 | - $pilot_id = filter_var($pilot_id,FILTER_SANITIZE_NUMBER_INT); |
|
793 | + $pilot_id = filter_var($pilot_id, FILTER_SANITIZE_NUMBER_INT); |
|
794 | 794 | if (!is_string($pilot_id)) |
795 | 795 | { |
796 | 796 | return false; |
@@ -801,7 +801,7 @@ discard block |
||
801 | 801 | |
802 | 802 | if ($departure_airport_route != "") |
803 | 803 | { |
804 | - $departure_airport_route = filter_var($departure_airport_route,FILTER_SANITIZE_STRING); |
|
804 | + $departure_airport_route = filter_var($departure_airport_route, FILTER_SANITIZE_STRING); |
|
805 | 805 | if (!is_string($departure_airport_route)) |
806 | 806 | { |
807 | 807 | return false; |
@@ -812,7 +812,7 @@ discard block |
||
812 | 812 | |
813 | 813 | if ($arrival_airport_route != "") |
814 | 814 | { |
815 | - $arrival_airport_route = filter_var($arrival_airport_route,FILTER_SANITIZE_STRING); |
|
815 | + $arrival_airport_route = filter_var($arrival_airport_route, FILTER_SANITIZE_STRING); |
|
816 | 816 | if (!is_string($arrival_airport_route)) |
817 | 817 | { |
818 | 818 | return false; |
@@ -825,8 +825,8 @@ discard block |
||
825 | 825 | { |
826 | 826 | $altitude_array = explode(",", $altitude); |
827 | 827 | |
828 | - $altitude_array[0] = filter_var($altitude_array[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
829 | - $altitude_array[1] = filter_var($altitude_array[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
828 | + $altitude_array[0] = filter_var($altitude_array[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
829 | + $altitude_array[1] = filter_var($altitude_array[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
830 | 830 | |
831 | 831 | |
832 | 832 | if ($altitude_array[1] != "") |
@@ -843,8 +843,8 @@ discard block |
||
843 | 843 | if ($date_posted != "") |
844 | 844 | { |
845 | 845 | $date_array = explode(",", $date_posted); |
846 | - $date_array[0] = filter_var($date_array[0],FILTER_SANITIZE_STRING); |
|
847 | - $date_array[1] = filter_var($date_array[1],FILTER_SANITIZE_STRING); |
|
846 | + $date_array[0] = filter_var($date_array[0], FILTER_SANITIZE_STRING); |
|
847 | + $date_array[1] = filter_var($date_array[1], FILTER_SANITIZE_STRING); |
|
848 | 848 | if ($globalTimezone != '') { |
849 | 849 | date_default_timezone_set($globalTimezone); |
850 | 850 | $datetime = new DateTime(); |
@@ -871,8 +871,8 @@ discard block |
||
871 | 871 | if ($limit != "") |
872 | 872 | { |
873 | 873 | $limit_array = explode(",", $limit); |
874 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
875 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
874 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
875 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
876 | 876 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
877 | 877 | { |
878 | 878 | //$limit_query = " LIMIT ".$limit_array[0].",".$limit_array[1]; |
@@ -880,8 +880,8 @@ discard block |
||
880 | 880 | } |
881 | 881 | } |
882 | 882 | if ($origLat != "" && $origLon != "" && $dist != "") { |
883 | - $dist = number_format($dist*0.621371,2,'.',''); |
|
884 | - $query="SELECT spotter_archive_output.*, 3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - ABS(CAST(spotter_archive.latitude as double precision)))*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(ABS(CAST(spotter_archive.latitude as double precision))*pi()/180)*POWER(SIN(($origLon-CAST(spotter_archive.longitude as double precision))*pi()/180/2),2))) as distance |
|
883 | + $dist = number_format($dist*0.621371, 2, '.', ''); |
|
884 | + $query = "SELECT spotter_archive_output.*, 3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - ABS(CAST(spotter_archive.latitude as double precision)))*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(ABS(CAST(spotter_archive.latitude as double precision))*pi()/180)*POWER(SIN(($origLon-CAST(spotter_archive.longitude as double precision))*pi()/180/2),2))) as distance |
|
885 | 885 | FROM spotter_archive_output, spotter_archive WHERE spotter_output_archive.flightaware_id = spotter_archive.flightaware_id AND spotter_output.ident <> '' ".$additional_query."AND CAST(spotter_archive.longitude as double precision) between ($origLon-$dist/ABS(cos(radians($origLat))*69)) and ($origLon+$dist/ABS(cos(radians($origLat))*69)) and CAST(spotter_archive.latitude as double precision) between ($origLat-($dist/69)) and ($origLat+($dist/69)) |
886 | 886 | AND (3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - ABS(CAST(spotter_archive.latitude as double precision)))*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(ABS(CAST(spotter_archive.latitude as double precision))*pi()/180)*POWER(SIN(($origLon-CAST(spotter_archive.longitude as double precision))*pi()/180/2),2)))) < $dist".$filter_query." ORDER BY distance"; |
887 | 887 | } else { |
@@ -897,12 +897,12 @@ discard block |
||
897 | 897 | $additional_query .= " AND (spotter_archive_output.waypoints <> '')"; |
898 | 898 | } |
899 | 899 | |
900 | - $query = "SELECT spotter_archive_output.* FROM spotter_archive_output |
|
900 | + $query = "SELECT spotter_archive_output.* FROM spotter_archive_output |
|
901 | 901 | WHERE spotter_archive_output.ident <> '' |
902 | 902 | ".$additional_query." |
903 | 903 | ".$filter_query.$orderby_query; |
904 | 904 | } |
905 | - $spotter_array = $Spotter->getDataFromDB($query, $query_values,$limit_query); |
|
905 | + $spotter_array = $Spotter->getDataFromDB($query, $query_values, $limit_query); |
|
906 | 906 | return $spotter_array; |
907 | 907 | } |
908 | 908 | |
@@ -917,7 +917,7 @@ discard block |
||
917 | 917 | try { |
918 | 918 | $sth = $this->db->prepare($query); |
919 | 919 | $sth->execute(); |
920 | - } catch(PDOException $e) { |
|
920 | + } catch (PDOException $e) { |
|
921 | 921 | return "error"; |
922 | 922 | } |
923 | 923 | } |
@@ -954,8 +954,8 @@ discard block |
||
954 | 954 | { |
955 | 955 | $limit_array = explode(",", $limit); |
956 | 956 | |
957 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
958 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
957 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
958 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
959 | 959 | |
960 | 960 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
961 | 961 | { |
@@ -996,7 +996,7 @@ discard block |
||
996 | 996 | $query_values = array(); |
997 | 997 | $limit_query = ''; |
998 | 998 | $additional_query = ''; |
999 | - $filter_query = $this->getFilter($filter,true,true); |
|
999 | + $filter_query = $this->getFilter($filter, true, true); |
|
1000 | 1000 | |
1001 | 1001 | if ($owner != "") |
1002 | 1002 | { |
@@ -1013,8 +1013,8 @@ discard block |
||
1013 | 1013 | { |
1014 | 1014 | $limit_array = explode(",", $limit); |
1015 | 1015 | |
1016 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
1017 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
1016 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
1017 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
1018 | 1018 | |
1019 | 1019 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
1020 | 1020 | { |
@@ -1054,7 +1054,7 @@ discard block |
||
1054 | 1054 | $query_values = array(); |
1055 | 1055 | $limit_query = ''; |
1056 | 1056 | $additional_query = ''; |
1057 | - $filter_query = $this->getFilter($filter,true,true); |
|
1057 | + $filter_query = $this->getFilter($filter, true, true); |
|
1058 | 1058 | |
1059 | 1059 | if ($pilot != "") |
1060 | 1060 | { |
@@ -1066,8 +1066,8 @@ discard block |
||
1066 | 1066 | { |
1067 | 1067 | $limit_array = explode(",", $limit); |
1068 | 1068 | |
1069 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
1070 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
1069 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
1070 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
1071 | 1071 | |
1072 | 1072 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
1073 | 1073 | { |
@@ -1097,7 +1097,7 @@ discard block |
||
1097 | 1097 | * @return Array the airline country list |
1098 | 1098 | * |
1099 | 1099 | */ |
1100 | - public function countAllFlightOverCountries($limit = true,$olderthanmonths = 0,$sincedate = '') |
|
1100 | + public function countAllFlightOverCountries($limit = true, $olderthanmonths = 0, $sincedate = '') |
|
1101 | 1101 | { |
1102 | 1102 | global $globalDBdriver; |
1103 | 1103 | /* |
@@ -1126,7 +1126,7 @@ discard block |
||
1126 | 1126 | $flight_array = array(); |
1127 | 1127 | $temp_array = array(); |
1128 | 1128 | |
1129 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1129 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1130 | 1130 | { |
1131 | 1131 | $temp_array['flight_count'] = $row['nb']; |
1132 | 1132 | $temp_array['flight_country'] = $row['name']; |
@@ -1143,7 +1143,7 @@ discard block |
||
1143 | 1143 | * @return Array the airline country list |
1144 | 1144 | * |
1145 | 1145 | */ |
1146 | - public function countAllFlightOverCountriesByAirlines($limit = true,$olderthanmonths = 0,$sincedate = '') |
|
1146 | + public function countAllFlightOverCountriesByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '') |
|
1147 | 1147 | { |
1148 | 1148 | global $globalDBdriver; |
1149 | 1149 | /* |
@@ -1172,7 +1172,7 @@ discard block |
||
1172 | 1172 | $flight_array = array(); |
1173 | 1173 | $temp_array = array(); |
1174 | 1174 | |
1175 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1175 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1176 | 1176 | { |
1177 | 1177 | $temp_array['airline_icao'] = $row['airline_icao']; |
1178 | 1178 | $temp_array['flight_count'] = $row['nb']; |
@@ -1190,14 +1190,14 @@ discard block |
||
1190 | 1190 | * @return Array the spotter information |
1191 | 1191 | * |
1192 | 1192 | */ |
1193 | - public function getDateArchiveSpotterDataById($id,$date) |
|
1193 | + public function getDateArchiveSpotterDataById($id, $date) |
|
1194 | 1194 | { |
1195 | 1195 | $Spotter = new Spotter($this->db); |
1196 | 1196 | date_default_timezone_set('UTC'); |
1197 | 1197 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
1198 | - $query = 'SELECT spotter_archive.* FROM spotter_archive INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_archive l WHERE l.flightaware_id = :id AND l.date <= :date GROUP BY l.flightaware_id) s on spotter_archive.flightaware_id = s.flightaware_id AND spotter_archive.date = s.maxdate ORDER BY spotter_archive.date DESC'; |
|
1199 | - $date = date('c',$date); |
|
1200 | - $spotter_array = $Spotter->getDataFromDB($query,array(':id' => $id,':date' => $date)); |
|
1198 | + $query = 'SELECT spotter_archive.* FROM spotter_archive INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_archive l WHERE l.flightaware_id = :id AND l.date <= :date GROUP BY l.flightaware_id) s on spotter_archive.flightaware_id = s.flightaware_id AND spotter_archive.date = s.maxdate ORDER BY spotter_archive.date DESC'; |
|
1199 | + $date = date('c', $date); |
|
1200 | + $spotter_array = $Spotter->getDataFromDB($query, array(':id' => $id, ':date' => $date)); |
|
1201 | 1201 | return $spotter_array; |
1202 | 1202 | } |
1203 | 1203 | |
@@ -1207,14 +1207,14 @@ discard block |
||
1207 | 1207 | * @return Array the spotter information |
1208 | 1208 | * |
1209 | 1209 | */ |
1210 | - public function getDateArchiveSpotterDataByIdent($ident,$date) |
|
1210 | + public function getDateArchiveSpotterDataByIdent($ident, $date) |
|
1211 | 1211 | { |
1212 | 1212 | $Spotter = new Spotter($this->db); |
1213 | 1213 | date_default_timezone_set('UTC'); |
1214 | 1214 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
1215 | - $query = 'SELECT spotter_archive.* FROM spotter_archive INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_archive l WHERE l.ident = :ident AND l.date <= :date GROUP BY l.flightaware_id) s on spotter_archive.flightaware_id = s.flightaware_id AND spotter_archive.date = s.maxdate ORDER BY spotter_archive.date DESC'; |
|
1216 | - $date = date('c',$date); |
|
1217 | - $spotter_array = $Spotter->getDataFromDB($query,array(':ident' => $ident,':date' => $date)); |
|
1215 | + $query = 'SELECT spotter_archive.* FROM spotter_archive INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_archive l WHERE l.ident = :ident AND l.date <= :date GROUP BY l.flightaware_id) s on spotter_archive.flightaware_id = s.flightaware_id AND spotter_archive.date = s.maxdate ORDER BY spotter_archive.date DESC'; |
|
1216 | + $date = date('c', $date); |
|
1217 | + $spotter_array = $Spotter->getDataFromDB($query, array(':ident' => $ident, ':date' => $date)); |
|
1218 | 1218 | return $spotter_array; |
1219 | 1219 | } |
1220 | 1220 | |
@@ -1224,7 +1224,7 @@ discard block |
||
1224 | 1224 | * @return Array the spotter information |
1225 | 1225 | * |
1226 | 1226 | */ |
1227 | - public function getSpotterDataByAirport($airport = '', $limit = '', $sort = '',$filters = array()) |
|
1227 | + public function getSpotterDataByAirport($airport = '', $limit = '', $sort = '', $filters = array()) |
|
1228 | 1228 | { |
1229 | 1229 | global $global_query; |
1230 | 1230 | $Spotter = new Spotter($this->db); |
@@ -1232,7 +1232,7 @@ discard block |
||
1232 | 1232 | $query_values = array(); |
1233 | 1233 | $limit_query = ''; |
1234 | 1234 | $additional_query = ''; |
1235 | - $filter_query = $this->getFilter($filters,true,true); |
|
1235 | + $filter_query = $this->getFilter($filters, true, true); |
|
1236 | 1236 | |
1237 | 1237 | if ($airport != "") |
1238 | 1238 | { |
@@ -1249,8 +1249,8 @@ discard block |
||
1249 | 1249 | { |
1250 | 1250 | $limit_array = explode(",", $limit); |
1251 | 1251 | |
1252 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
1253 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
1252 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
1253 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
1254 | 1254 | |
1255 | 1255 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
1256 | 1256 | { |
@@ -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 | |
@@ -166,7 +166,7 @@ discard block |
||
166 | 166 | if (isset($_GET['coord']) && $_GET['coord'] != '') { |
167 | 167 | $coord = explode(',',$_GET['coord']); |
168 | 168 | 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) |
169 | - && $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)) { |
|
169 | + && $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)) { |
|
170 | 170 | $coord = array(); |
171 | 171 | } |
172 | 172 | } |
@@ -176,7 +176,7 @@ discard block |
||
176 | 176 | if (isset($_GET['coord']) && $_GET['coord'] != '') { |
177 | 177 | $coord = explode(',',$_GET['coord']); |
178 | 178 | 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) |
179 | - && $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)) { |
|
179 | + && $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)) { |
|
180 | 180 | $coord = array(); |
181 | 181 | } |
182 | 182 | } |
@@ -186,7 +186,7 @@ discard block |
||
186 | 186 | if (!((isset($_COOKIE['singlemodel']) && $_COOKIE['singlemodel'] == 'true') && (isset($_COOKIE['MapTrack']) && $_COOKIE['MapTrack'] != '')) && isset($_GET['coord']) && $_GET['coord'] != '') { |
187 | 187 | $coord = explode(',',$_GET['coord']); |
188 | 188 | 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) |
189 | - && $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)) { |
|
189 | + && $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)) { |
|
190 | 190 | $coord = array(); |
191 | 191 | } |
192 | 192 | } |
@@ -287,10 +287,10 @@ discard block |
||
287 | 287 | $image = "images/placeholder_thumb.png"; |
288 | 288 | } |
289 | 289 | |
290 | - if (isset($spotter_item['flightaware_id'])) $id = $spotter_item['flightaware_id']; |
|
291 | - elseif (isset($spotter_item['famtrackid'])) $id = $spotter_item['famtrackid']; |
|
292 | - elseif (isset($spotter_item['fammarine_id'])) $id = $spotter_item['fammarine_id']; |
|
293 | - if ($prev_flightaware_id != $id) { |
|
290 | + if (isset($spotter_item['flightaware_id'])) $id = $spotter_item['flightaware_id']; |
|
291 | + elseif (isset($spotter_item['famtrackid'])) $id = $spotter_item['famtrackid']; |
|
292 | + elseif (isset($spotter_item['fammarine_id'])) $id = $spotter_item['fammarine_id']; |
|
293 | + if ($prev_flightaware_id != $id) { |
|
294 | 294 | if ($prev_flightaware_id != '') { |
295 | 295 | /* |
296 | 296 | if ($nblatlong == 1) { |
@@ -370,7 +370,7 @@ discard block |
||
370 | 370 | $spotter_item['wake_category'] = $aircraft_info[0]['wake_category']; |
371 | 371 | $spotter_item['engine_count'] = $aircraft_info[0]['engine_count']; |
372 | 372 | } else $aircraft_shadow = ''; |
373 | - $output .= ' "billboard" : {"image" : "'.$globalURL.'/images/aircrafts/new/'.$aircraft_shadow.'","scale" : 0.5'; |
|
373 | + $output .= ' "billboard" : {"image" : "'.$globalURL.'/images/aircrafts/new/'.$aircraft_shadow.'","scale" : 0.5'; |
|
374 | 374 | if (isset($_COOKIE['IconColorForce']) && $_COOKIE['IconColorForce'] == 'true' && isset($_COOKIE['IconColor'])) { |
375 | 375 | $rgb = $Common->hex2rgb($_COOKIE['IconColor']); |
376 | 376 | $output .= ',"color": {"rgba" : ['.$rgb[0].','.$rgb[1].','.$rgb[2].',255]}'; |
@@ -401,7 +401,7 @@ discard block |
||
401 | 401 | $rgb = $Common->hex2rgb($_COOKIE['IconColor']); |
402 | 402 | $output .= ',"color": {"rgba" : ['.$rgb[0].','.$rgb[1].','.$rgb[2].',255]}'; |
403 | 403 | } |
404 | - $output .= '},'; |
|
404 | + $output .= '},'; |
|
405 | 405 | } elseif (isset($modelsdb[$aircraft_icao]) && $aircraft_icao != '') { |
406 | 406 | $output .= '"model": {"gltf" : "'.$globalURL.'/models/'.$modelsdb[$aircraft_icao].'","scale" : 1.0,"minimumPixelSize": 20'; |
407 | 407 | $output .= ',"heightReference": "'.$heightrelative.'"'; |
@@ -409,7 +409,7 @@ discard block |
||
409 | 409 | $rgb = $Common->hex2rgb($_COOKIE['IconColor']); |
410 | 410 | $output .= ',"color": {"rgba" : ['.$rgb[0].','.$rgb[1].','.$rgb[2].',255]}'; |
411 | 411 | } |
412 | - $output .= '},'; |
|
412 | + $output .= '},'; |
|
413 | 413 | } elseif ($aircraft_icao != '') { |
414 | 414 | $aircraft_info = $Spotter->getAllAircraftInfo($aircraft_icao); |
415 | 415 | if (isset($aircraft_info[0]['engine_type'])) { |
@@ -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,12 +141,12 @@ 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); |
|
149 | - $spotter_array = $SpotterArchive->getMinLiveSpotterDataPlayback($begindate,$enddate,$filter); |
|
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 | + $spotter_array = $SpotterArchive->getMinLiveSpotterDataPlayback($begindate, $enddate, $filter); |
|
150 | 150 | } elseif (isset($_COOKIE['archive']) && isset($_COOKIE['archive_begin']) && isset($_COOKIE['archive_end']) && isset($_COOKIE['archive_speed'])) { |
151 | 151 | $from_archive = true; |
152 | 152 | // $begindate = filter_input(INPUT_GET,'begindate',FILTER_VALIDATE_REGEXP,array("options"=>array("regexp"=>'~^\d{4}/\d{2}/\d{2}$~'))); |
@@ -156,55 +156,55 @@ discard block |
||
156 | 156 | $begindate = $_COOKIE['archive_begin']; |
157 | 157 | $enddate = $_COOKIE['archive_end']; |
158 | 158 | |
159 | - $archivespeed = filter_var($_COOKIE['archive_speed'],FILTER_SANITIZE_NUMBER_INT); |
|
160 | - $begindate = date('Y-m-d H:i:s',$begindate); |
|
161 | - $enddate = date('Y-m-d H:i:s',$enddate); |
|
159 | + $archivespeed = filter_var($_COOKIE['archive_speed'], FILTER_SANITIZE_NUMBER_INT); |
|
160 | + $begindate = date('Y-m-d H:i:s', $begindate); |
|
161 | + $enddate = date('Y-m-d H:i:s', $enddate); |
|
162 | 162 | // echo 'Begin : '.$begindate.' - End : '.$enddate."\n"; |
163 | - $spotter_array = $SpotterArchive->getMinLiveSpotterData($begindate,$enddate,$filter); |
|
163 | + $spotter_array = $SpotterArchive->getMinLiveSpotterData($begindate, $enddate, $filter); |
|
164 | 164 | } elseif ($tracker) { |
165 | 165 | $coord = array(); |
166 | 166 | if (isset($_GET['coord']) && $_GET['coord'] != '') { |
167 | - $coord = explode(',',$_GET['coord']); |
|
168 | - 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) |
|
167 | + $coord = explode(',', $_GET['coord']); |
|
168 | + 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) |
|
169 | 169 | && $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)) { |
170 | 170 | $coord = array(); |
171 | 171 | } |
172 | 172 | } |
173 | - $spotter_array = $TrackerLive->getMinLastLiveTrackerData($coord,$filter,true); |
|
173 | + $spotter_array = $TrackerLive->getMinLastLiveTrackerData($coord, $filter, true); |
|
174 | 174 | } elseif ($marine) { |
175 | 175 | $coord = array(); |
176 | 176 | if (isset($_GET['coord']) && $_GET['coord'] != '') { |
177 | - $coord = explode(',',$_GET['coord']); |
|
178 | - 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) |
|
177 | + $coord = explode(',', $_GET['coord']); |
|
178 | + 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) |
|
179 | 179 | && $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)) { |
180 | 180 | $coord = array(); |
181 | 181 | } |
182 | 182 | } |
183 | - $spotter_array = $MarineLive->getMinLastLiveMarineData($coord,$filter,true); |
|
183 | + $spotter_array = $MarineLive->getMinLastLiveMarineData($coord, $filter, true); |
|
184 | 184 | } else { |
185 | 185 | $coord = array(); |
186 | 186 | if (!((isset($_COOKIE['singlemodel']) && $_COOKIE['singlemodel'] == 'true') && (isset($_COOKIE['MapTrack']) && $_COOKIE['MapTrack'] != '')) && isset($_GET['coord']) && $_GET['coord'] != '') { |
187 | - $coord = explode(',',$_GET['coord']); |
|
188 | - 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 | + $coord = explode(',', $_GET['coord']); |
|
188 | + 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) |
|
189 | 189 | && $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)) { |
190 | 190 | $coord = array(); |
191 | 191 | } |
192 | 192 | } |
193 | 193 | $previous_filter = $filter; |
194 | 194 | if ((isset($_COOKIE['singlemodel']) && $_COOKIE['singlemodel'] == 'true') && (isset($_COOKIE['MapTrack']) && $_COOKIE['MapTrack'] != '')) { |
195 | - $filter = array_merge($filter,array('id' => $_COOKIE['MapTrack'])); |
|
196 | - $spotter_array = $SpotterLive->getMinLastLiveSpotterData($coord,$filter,true); |
|
195 | + $filter = array_merge($filter, array('id' => $_COOKIE['MapTrack'])); |
|
196 | + $spotter_array = $SpotterLive->getMinLastLiveSpotterData($coord, $filter, true); |
|
197 | 197 | } elseif (isset($_COOKIE['MapTrack']) && $_COOKIE['MapTrack'] != '' && !empty($coord)) { |
198 | - $spotter_array = $SpotterLive->getMinLastLiveSpotterData($coord,$filter,true,$_COOKIE['MapTrack']); |
|
198 | + $spotter_array = $SpotterLive->getMinLastLiveSpotterData($coord, $filter, true, $_COOKIE['MapTrack']); |
|
199 | 199 | } else { |
200 | - $spotter_array = $SpotterLive->getMinLastLiveSpotterData($coord,$filter,true); |
|
200 | + $spotter_array = $SpotterLive->getMinLastLiveSpotterData($coord, $filter, true); |
|
201 | 201 | } |
202 | 202 | $filter = $previous_filter; |
203 | 203 | } |
204 | 204 | //print_r($spotter_array); |
205 | 205 | if (!empty($spotter_array) && isset($coord)) { |
206 | 206 | if (isset($_GET['archive'])) { |
207 | - $flightcnt = $SpotterArchive->getLiveSpotterCount($begindate,$enddate,$filter); |
|
207 | + $flightcnt = $SpotterArchive->getLiveSpotterCount($begindate, $enddate, $filter); |
|
208 | 208 | } elseif ($tracker) { |
209 | 209 | $flightcnt = $TrackerLive->getLiveTrackerCount($filter); |
210 | 210 | } elseif ($marine) { |
@@ -215,17 +215,17 @@ discard block |
||
215 | 215 | if ($flightcnt == '') $flightcnt = 0; |
216 | 216 | } else $flightcnt = 0; |
217 | 217 | |
218 | -$sqltime = round(microtime(true)-$begintime,2); |
|
218 | +$sqltime = round(microtime(true) - $begintime, 2); |
|
219 | 219 | $minitime = time(); |
220 | 220 | $minitracktime_begin = time(); |
221 | 221 | $minitracktime = $minitracktime_begin; |
222 | 222 | $maxitime = 0; |
223 | -$lastupdate = filter_input(INPUT_GET,'update',FILTER_SANITIZE_NUMBER_INT); |
|
223 | +$lastupdate = filter_input(INPUT_GET, 'update', FILTER_SANITIZE_NUMBER_INT); |
|
224 | 224 | $modelsdb = array(); |
225 | 225 | if (file_exists(dirname(__FILE__).'/models/modelsdb')) { |
226 | - if (($handle = fopen(dirname(__FILE__).'/models/modelsdb','r')) !== FALSE) { |
|
227 | - while (($row = fgetcsv($handle,1000)) !== FALSE) { |
|
228 | - if (isset($row[1]) ){ |
|
226 | + if (($handle = fopen(dirname(__FILE__).'/models/modelsdb', 'r')) !== FALSE) { |
|
227 | + while (($row = fgetcsv($handle, 1000)) !== FALSE) { |
|
228 | + if (isset($row[1])) { |
|
229 | 229 | $model = $row[0]; |
230 | 230 | $modelsdb[$model] = $row[1]; |
231 | 231 | } |
@@ -235,9 +235,9 @@ discard block |
||
235 | 235 | } |
236 | 236 | $modelsdb2 = array(); |
237 | 237 | if (file_exists(dirname(__FILE__).'/models/gltf2/modelsdb')) { |
238 | - if (($handle = fopen(dirname(__FILE__).'/models/gltf2/modelsdb','r')) !== FALSE) { |
|
239 | - while (($row = fgetcsv($handle,1000)) !== FALSE) { |
|
240 | - if (isset($row[1]) ){ |
|
238 | + if (($handle = fopen(dirname(__FILE__).'/models/gltf2/modelsdb', 'r')) !== FALSE) { |
|
239 | + while (($row = fgetcsv($handle, 1000)) !== FALSE) { |
|
240 | + if (isset($row[1])) { |
|
241 | 241 | $model = $row[0]; |
242 | 242 | $modelsdb2[$model] = $row[1]; |
243 | 243 | } |
@@ -275,7 +275,7 @@ discard block |
||
275 | 275 | if (!empty($spotter_array) && is_array($spotter_array)) |
276 | 276 | { |
277 | 277 | $nblatlong = 0; |
278 | - foreach($spotter_array as $spotter_item) |
|
278 | + foreach ($spotter_array as $spotter_item) |
|
279 | 279 | { |
280 | 280 | $j++; |
281 | 281 | //if (isset($spotter_item['format_source']) && $spotter_item['format_source'] == 'airwhere') $heightrelative = 'RELATIVE_TO_GROUND'; |
@@ -317,9 +317,9 @@ discard block |
||
317 | 317 | $output .= '"lastupdate": "'.$lastupdate.'",'; |
318 | 318 | if (isset($spotter_item['format_source'])) $output .= '"format": "'.$spotter_item['format_source'].'",'; |
319 | 319 | if ($tracker) { |
320 | - $output.= '"type": "tracker"'; |
|
320 | + $output .= '"type": "tracker"'; |
|
321 | 321 | } elseif ($marine) { |
322 | - $output.= '"type": "marine"'; |
|
322 | + $output .= '"type": "marine"'; |
|
323 | 323 | } else { |
324 | 324 | if ($one3dmodel === false && isset($globalMap3DLiveries) && $globalMap3DLiveries) { |
325 | 325 | $aircraft_icao = $spotter_item['aircraft_icao']; |
@@ -333,14 +333,14 @@ discard block |
||
333 | 333 | if (isset($airline_icao)) { |
334 | 334 | $imagefile = $aircraft_icao.'-'.$airline_icao.'.png'; |
335 | 335 | if (file_exists(dirname(__FILE__).'/models/gltf2/liveries/'.$imagefile)) { |
336 | - $output.= '"liveries": "'.$globalURL.'/models/gltf2/liveries/'.$imagefile.'",'; |
|
336 | + $output .= '"liveries": "'.$globalURL.'/models/gltf2/liveries/'.$imagefile.'",'; |
|
337 | 337 | } |
338 | 338 | } |
339 | 339 | } |
340 | - if ($ident != '') $output.= '"ident": "'.$ident.'",'; |
|
340 | + if ($ident != '') $output .= '"ident": "'.$ident.'",'; |
|
341 | 341 | } |
342 | - $output.= '"gltf2": %gltf2%,'; |
|
343 | - $output.= '"type": "flight"'; |
|
342 | + $output .= '"gltf2": %gltf2%,'; |
|
343 | + $output .= '"type": "flight"'; |
|
344 | 344 | } |
345 | 345 | $output .= '},'; |
346 | 346 | |
@@ -693,8 +693,8 @@ discard block |
||
693 | 693 | $output .= '},'; |
694 | 694 | } |
695 | 695 | } |
696 | - if (isset($onground) && $onground) $output = str_replace('%onground%','true',$output); |
|
697 | - else $output = str_replace('%onground%','false',$output); |
|
696 | + if (isset($onground) && $onground) $output = str_replace('%onground%', 'true', $output); |
|
697 | + else $output = str_replace('%onground%', 'false', $output); |
|
698 | 698 | |
699 | 699 | // $output .= '"heightReference": "CLAMP_TO_GROUND",'; |
700 | 700 | //$output .= '"heightReference": "'.$heightrelative.'",'; |
@@ -710,7 +710,7 @@ discard block |
||
710 | 710 | if ($minitime > strtotime($spotter_item['date'])) $minitime = strtotime($spotter_item['date']); |
711 | 711 | if (isset($_COOKIE['MapTrack']) && $id == $_COOKIE['MapTrack'] && $minitracktime > strtotime($spotter_item['date'])) $minitracktime = strtotime($spotter_item['date']); |
712 | 712 | if ($maxitime < strtotime($spotter_item['date'])) $maxitime = strtotime($spotter_item['date']); |
713 | - $output .= '"'.date("c",strtotime($spotter_item['date'])).'", '; |
|
713 | + $output .= '"'.date("c", strtotime($spotter_item['date'])).'", '; |
|
714 | 714 | $output .= $spotter_item['longitude'].', '; |
715 | 715 | $output .= $spotter_item['latitude']; |
716 | 716 | $prevlong = $spotter_item['longitude']; |
@@ -738,8 +738,8 @@ discard block |
||
738 | 738 | //$quat = quaternionrotate(deg2rad($spotter_item['heading']),deg2rad(0),deg2rad(0)); |
739 | 739 | //$orientation .= '"'.date("c",strtotime($spotter_item['date'])).'",'.$quat['x'].','.$quat['y'].','.$quat['z'].','.$quat['w']; |
740 | 740 | } else { |
741 | - $nblatlong = $nblatlong+1; |
|
742 | - $output .= ',"'.date("c",strtotime($spotter_item['date'])).'", '; |
|
741 | + $nblatlong = $nblatlong + 1; |
|
742 | + $output .= ',"'.date("c", strtotime($spotter_item['date'])).'", '; |
|
743 | 743 | if ($maxitime < strtotime($spotter_item['date'])) $maxitime = strtotime($spotter_item['date']); |
744 | 744 | if ($spotter_item['ground_speed'] == 0) { |
745 | 745 | $output .= $prevlong.', '; |
@@ -779,21 +779,21 @@ discard block |
||
779 | 779 | } |
780 | 780 | $output .= ']'; |
781 | 781 | if (isset($globalArchive) && $globalArchive === TRUE) { |
782 | - if ((time()-$globalLiveInterval) > $minitime) { |
|
783 | - if (time()-$globalLiveInterval > $maxitime) { |
|
784 | - $output = str_replace('%minitime%',date("c",$maxitime),$output); |
|
782 | + if ((time() - $globalLiveInterval) > $minitime) { |
|
783 | + if (time() - $globalLiveInterval > $maxitime) { |
|
784 | + $output = str_replace('%minitime%', date("c", $maxitime), $output); |
|
785 | 785 | } else { |
786 | - $output = str_replace('%minitime%',date("c",time()-$globalLiveInterval),$output); |
|
786 | + $output = str_replace('%minitime%', date("c", time() - $globalLiveInterval), $output); |
|
787 | 787 | } |
788 | 788 | } |
789 | - else $output = str_replace('%minitime%',date("c",$minitime),$output); |
|
789 | + else $output = str_replace('%minitime%', date("c", $minitime), $output); |
|
790 | 790 | } elseif (isset($_COOKIE['MapTrack']) && $_COOKIE['MapTrack'] != '' && $minitracktime != $minitracktime_begin) { |
791 | - $output = str_replace('%minitime%',date("c",$minitracktime),$output); |
|
791 | + $output = str_replace('%minitime%', date("c", $minitracktime), $output); |
|
792 | 792 | } else { |
793 | - $output = str_replace('%minitime%',date("c",$minitime),$output); |
|
793 | + $output = str_replace('%minitime%', date("c", $minitime), $output); |
|
794 | 794 | } |
795 | -$output = str_replace('%maxitime%',date("c",$maxitime),$output); |
|
796 | -if ($gltf2) $output = str_replace('%gltf2%','true',$output); |
|
797 | -else $output = str_replace('%gltf2%','false',$output); |
|
795 | +$output = str_replace('%maxitime%', date("c", $maxitime), $output); |
|
796 | +if ($gltf2) $output = str_replace('%gltf2%', 'true', $output); |
|
797 | +else $output = str_replace('%gltf2%', 'false', $output); |
|
798 | 798 | print $output; |
799 | 799 | ?> |
@@ -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; |
@@ -212,8 +241,12 @@ discard block |
||
212 | 241 | } else { |
213 | 242 | $flightcnt = $SpotterLive->getLiveSpotterCount($filter); |
214 | 243 | } |
215 | - if ($flightcnt == '') $flightcnt = 0; |
|
216 | -} else $flightcnt = 0; |
|
244 | + if ($flightcnt == '') { |
|
245 | + $flightcnt = 0; |
|
246 | + } |
|
247 | + } else { |
|
248 | + $flightcnt = 0; |
|
249 | +} |
|
217 | 250 | |
218 | 251 | $sqltime = round(microtime(true)-$begintime,2); |
219 | 252 | $minitime = time(); |
@@ -251,7 +284,9 @@ discard block |
||
251 | 284 | $prev_flightaware_id = ''; |
252 | 285 | $speed = 1; |
253 | 286 | $gltf2 = false; |
254 | -if (isset($archivespeed)) $speed = $archivespeed; |
|
287 | +if (isset($archivespeed)) { |
|
288 | + $speed = $archivespeed; |
|
289 | +} |
|
255 | 290 | $output = '['; |
256 | 291 | if ($tracker) { |
257 | 292 | $output .= '{"id" : "document", "name" : "tracker","version" : "1.0"'; |
@@ -287,9 +322,13 @@ discard block |
||
287 | 322 | $image = "images/placeholder_thumb.png"; |
288 | 323 | } |
289 | 324 | |
290 | - if (isset($spotter_item['flightaware_id'])) $id = $spotter_item['flightaware_id']; |
|
291 | - elseif (isset($spotter_item['famtrackid'])) $id = $spotter_item['famtrackid']; |
|
292 | - elseif (isset($spotter_item['fammarine_id'])) $id = $spotter_item['fammarine_id']; |
|
325 | + if (isset($spotter_item['flightaware_id'])) { |
|
326 | + $id = $spotter_item['flightaware_id']; |
|
327 | + } elseif (isset($spotter_item['famtrackid'])) { |
|
328 | + $id = $spotter_item['famtrackid']; |
|
329 | + } elseif (isset($spotter_item['fammarine_id'])) { |
|
330 | + $id = $spotter_item['fammarine_id']; |
|
331 | + } |
|
293 | 332 | if ($prev_flightaware_id != $id) { |
294 | 333 | if ($prev_flightaware_id != '') { |
295 | 334 | /* |
@@ -315,7 +354,9 @@ discard block |
||
315 | 354 | $output .= '"flightcnt": "'.$flightcnt.'",'; |
316 | 355 | $output .= '"onground": %onground%,'; |
317 | 356 | $output .= '"lastupdate": "'.$lastupdate.'",'; |
318 | - if (isset($spotter_item['format_source'])) $output .= '"format": "'.$spotter_item['format_source'].'",'; |
|
357 | + if (isset($spotter_item['format_source'])) { |
|
358 | + $output .= '"format": "'.$spotter_item['format_source'].'",'; |
|
359 | + } |
|
319 | 360 | if ($tracker) { |
320 | 361 | $output.= '"type": "tracker"'; |
321 | 362 | } elseif ($marine) { |
@@ -337,7 +378,9 @@ discard block |
||
337 | 378 | } |
338 | 379 | } |
339 | 380 | } |
340 | - if ($ident != '') $output.= '"ident": "'.$ident.'",'; |
|
381 | + if ($ident != '') { |
|
382 | + $output.= '"ident": "'.$ident.'",'; |
|
383 | + } |
|
341 | 384 | } |
342 | 385 | $output.= '"gltf2": %gltf2%,'; |
343 | 386 | $output.= '"type": "flight"'; |
@@ -369,7 +412,9 @@ discard block |
||
369 | 412 | $spotter_item['engine_type'] = $aircraft_info[0]['engine_type']; |
370 | 413 | $spotter_item['wake_category'] = $aircraft_info[0]['wake_category']; |
371 | 414 | $spotter_item['engine_count'] = $aircraft_info[0]['engine_count']; |
372 | - } else $aircraft_shadow = ''; |
|
415 | + } else { |
|
416 | + $aircraft_shadow = ''; |
|
417 | + } |
|
373 | 418 | $output .= ' "billboard" : {"image" : "'.$globalURL.'/images/aircrafts/new/'.$aircraft_shadow.'","scale" : 0.5'; |
374 | 419 | if (isset($_COOKIE['IconColorForce']) && $_COOKIE['IconColorForce'] == 'true' && isset($_COOKIE['IconColor'])) { |
375 | 420 | $rgb = $Common->hex2rgb($_COOKIE['IconColor']); |
@@ -377,7 +422,9 @@ discard block |
||
377 | 422 | } |
378 | 423 | $output .= '},'; |
379 | 424 | } |
380 | - } 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},'; |
|
425 | + } else { |
|
426 | + $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},'; |
|
427 | + } |
|
381 | 428 | } elseif ($one3dmodel) { |
382 | 429 | if (isset($globalMap3DForceModel) && $globalMap3DForceModel != '') { |
383 | 430 | $output .= '"model": {"gltf" : "'.$globalURL.'/models/'.$globalMap3DForceModel.'","scale" : 1.0,"minimumPixelSize": 20'; |
@@ -417,7 +464,9 @@ discard block |
||
417 | 464 | $spotter_item['engine_type'] = $aircraft_info[0]['engine_type']; |
418 | 465 | $spotter_item['wake_category'] = $aircraft_info[0]['wake_category']; |
419 | 466 | $spotter_item['engine_count'] = $aircraft_info[0]['engine_count']; |
420 | - } else $aircraft_shadow = ''; |
|
467 | + } else { |
|
468 | + $aircraft_shadow = ''; |
|
469 | + } |
|
421 | 470 | if ($aircraft_shadow != '') { |
422 | 471 | if (isset($modelsdb[$aircraft_shadow])) { |
423 | 472 | $output .= '"model": {"gltf" : "'.$globalURL.'/models/'.$modelsdb[$aircraft_shadow].'","scale" : 1.0,"minimumPixelSize": 20'; |
@@ -554,7 +603,9 @@ discard block |
||
554 | 603 | } |
555 | 604 | $output .= '},'; |
556 | 605 | //if ($spotter_item['aircraft_shadow'] != '') $output .= '"aircraft_shadow": "'.$spotter_item['aircraft_shadow'].'",'; |
557 | - if ($spotter_item['aircraft_icao'] != '') $output .= '"aircraft_icao": "'.$spotter_item['aircraft_icao'].'",'; |
|
606 | + if ($spotter_item['aircraft_icao'] != '') { |
|
607 | + $output .= '"aircraft_icao": "'.$spotter_item['aircraft_icao'].'",'; |
|
608 | + } |
|
558 | 609 | $modelsdb[$aircraft_icao] = 'Cesium_Air.glb'; |
559 | 610 | } |
560 | 611 | } elseif (isset($spotter_item['format_source']) && $spotter_item['format_source'] == 'aprs') { |
@@ -576,7 +627,9 @@ discard block |
||
576 | 627 | } |
577 | 628 | $output .= '},'; |
578 | 629 | //if ($spotter_item['aircraft_shadow'] != '') $output .= '"aircraft_shadow": "'.$spotter_item['aircraft_shadow'].'",'; |
579 | - if ($spotter_item['aircraft_icao'] != '') $output .= '"aircraft_icao": "'.$spotter_item['aircraft_icao'].'",'; |
|
630 | + if ($spotter_item['aircraft_icao'] != '') { |
|
631 | + $output .= '"aircraft_icao": "'.$spotter_item['aircraft_icao'].'",'; |
|
632 | + } |
|
580 | 633 | $modelsdb[$aircraft_icao] = 'Cesium_Air.glb'; |
581 | 634 | } |
582 | 635 | } else { |
@@ -589,7 +642,9 @@ discard block |
||
589 | 642 | } |
590 | 643 | $output .= '},'; |
591 | 644 | //if ($spotter_item['aircraft_shadow'] != '') $output .= '"aircraft_shadow": "'.$spotter_item['aircraft_shadow'].'",'; |
592 | - if ($spotter_item['aircraft_icao'] != '') $output .= '"aircraft_icao": "'.$spotter_item['aircraft_icao'].'",'; |
|
645 | + if ($spotter_item['aircraft_icao'] != '') { |
|
646 | + $output .= '"aircraft_icao": "'.$spotter_item['aircraft_icao'].'",'; |
|
647 | + } |
|
593 | 648 | $modelsdb[$aircraft_icao] = 'Cesium_Air.glb'; |
594 | 649 | } |
595 | 650 | } elseif ($tracker && isset($spotter_item['type'])) { |
@@ -693,8 +748,11 @@ discard block |
||
693 | 748 | $output .= '},'; |
694 | 749 | } |
695 | 750 | } |
696 | - if (isset($onground) && $onground) $output = str_replace('%onground%','true',$output); |
|
697 | - else $output = str_replace('%onground%','false',$output); |
|
751 | + if (isset($onground) && $onground) { |
|
752 | + $output = str_replace('%onground%','true',$output); |
|
753 | + } else { |
|
754 | + $output = str_replace('%onground%','false',$output); |
|
755 | + } |
|
698 | 756 | |
699 | 757 | // $output .= '"heightReference": "CLAMP_TO_GROUND",'; |
700 | 758 | //$output .= '"heightReference": "'.$heightrelative.'",'; |
@@ -707,9 +765,15 @@ discard block |
||
707 | 765 | // $output .= '"interpolationDegree" : 5,'; |
708 | 766 | // $output .= '"epoch" : "'.date("c",strtotime($spotter_item['date'])).'", '; |
709 | 767 | $output .= '"cartographicDegrees": ['; |
710 | - if ($minitime > strtotime($spotter_item['date'])) $minitime = strtotime($spotter_item['date']); |
|
711 | - if (isset($_COOKIE['MapTrack']) && $id == $_COOKIE['MapTrack'] && $minitracktime > strtotime($spotter_item['date'])) $minitracktime = strtotime($spotter_item['date']); |
|
712 | - if ($maxitime < strtotime($spotter_item['date'])) $maxitime = strtotime($spotter_item['date']); |
|
768 | + if ($minitime > strtotime($spotter_item['date'])) { |
|
769 | + $minitime = strtotime($spotter_item['date']); |
|
770 | + } |
|
771 | + if (isset($_COOKIE['MapTrack']) && $id == $_COOKIE['MapTrack'] && $minitracktime > strtotime($spotter_item['date'])) { |
|
772 | + $minitracktime = strtotime($spotter_item['date']); |
|
773 | + } |
|
774 | + if ($maxitime < strtotime($spotter_item['date'])) { |
|
775 | + $maxitime = strtotime($spotter_item['date']); |
|
776 | + } |
|
713 | 777 | $output .= '"'.date("c",strtotime($spotter_item['date'])).'", '; |
714 | 778 | $output .= $spotter_item['longitude'].', '; |
715 | 779 | $output .= $spotter_item['latitude']; |
@@ -732,7 +796,9 @@ discard block |
||
732 | 796 | $output .= ', '.round($spotter_item['altitude']*30.48); |
733 | 797 | $prevalt = round($spotter_item['altitude']*30.48); |
734 | 798 | } |
735 | - } else $output .= ', 0'; |
|
799 | + } else { |
|
800 | + $output .= ', 0'; |
|
801 | + } |
|
736 | 802 | //$orientation = '"orientation" : { '; |
737 | 803 | //$orientation .= '"unitQuaternion": ['; |
738 | 804 | //$quat = quaternionrotate(deg2rad($spotter_item['heading']),deg2rad(0),deg2rad(0)); |
@@ -740,13 +806,18 @@ discard block |
||
740 | 806 | } else { |
741 | 807 | $nblatlong = $nblatlong+1; |
742 | 808 | $output .= ',"'.date("c",strtotime($spotter_item['date'])).'", '; |
743 | - if ($maxitime < strtotime($spotter_item['date'])) $maxitime = strtotime($spotter_item['date']); |
|
809 | + if ($maxitime < strtotime($spotter_item['date'])) { |
|
810 | + $maxitime = strtotime($spotter_item['date']); |
|
811 | + } |
|
744 | 812 | if ($spotter_item['ground_speed'] == 0) { |
745 | 813 | $output .= $prevlong.', '; |
746 | 814 | $output .= $prevlat; |
747 | 815 | //if (!$marine && (!isset($onground) || !$onground)) $output .= ', '.$prevalt; |
748 | - if (!$marine) $output .= ', '.$prevalt; |
|
749 | - else $output .= ', 0'; |
|
816 | + if (!$marine) { |
|
817 | + $output .= ', '.$prevalt; |
|
818 | + } else { |
|
819 | + $output .= ', 0'; |
|
820 | + } |
|
750 | 821 | } else { |
751 | 822 | $output .= $spotter_item['longitude'].', '; |
752 | 823 | $output .= $spotter_item['latitude']; |
@@ -759,14 +830,17 @@ discard block |
||
759 | 830 | $output .= ', 0'; |
760 | 831 | } |
761 | 832 | } else { |
762 | - if (isset($spotter_item['real_altitude']) && $spotter_item['real_altitude'] != '') $output .= ', '.round($spotter_item['real_altitude']*0.3048); |
|
763 | - elseif ($tracker) { |
|
833 | + if (isset($spotter_item['real_altitude']) && $spotter_item['real_altitude'] != '') { |
|
834 | + $output .= ', '.round($spotter_item['real_altitude']*0.3048); |
|
835 | + } elseif ($tracker) { |
|
764 | 836 | $output .= ', '.round($spotter_item['altitude']*0.3048); |
765 | 837 | } else { |
766 | 838 | $output .= ', '.round($spotter_item['altitude']*30.48); |
767 | 839 | } |
768 | 840 | } |
769 | - } else $output .= ', 0'; |
|
841 | + } else { |
|
842 | + $output .= ', 0'; |
|
843 | + } |
|
770 | 844 | } |
771 | 845 | //$quat = quaternionrotate(deg2rad($spotter_item['heading']),deg2rad(0),deg2rad(0)); |
772 | 846 | //$orientation .= ',"'.date("c",strtotime($spotter_item['date'])).'",'.$quat['x'].','.$quat['y'].','.$quat['z'].','.$quat['w']; |
@@ -785,15 +859,19 @@ discard block |
||
785 | 859 | } else { |
786 | 860 | $output = str_replace('%minitime%',date("c",time()-$globalLiveInterval),$output); |
787 | 861 | } |
862 | + } else { |
|
863 | + $output = str_replace('%minitime%',date("c",$minitime),$output); |
|
788 | 864 | } |
789 | - else $output = str_replace('%minitime%',date("c",$minitime),$output); |
|
790 | -} elseif (isset($_COOKIE['MapTrack']) && $_COOKIE['MapTrack'] != '' && $minitracktime != $minitracktime_begin) { |
|
865 | + } elseif (isset($_COOKIE['MapTrack']) && $_COOKIE['MapTrack'] != '' && $minitracktime != $minitracktime_begin) { |
|
791 | 866 | $output = str_replace('%minitime%',date("c",$minitracktime),$output); |
792 | 867 | } else { |
793 | 868 | $output = str_replace('%minitime%',date("c",$minitime),$output); |
794 | 869 | } |
795 | 870 | $output = str_replace('%maxitime%',date("c",$maxitime),$output); |
796 | -if ($gltf2) $output = str_replace('%gltf2%','true',$output); |
|
797 | -else $output = str_replace('%gltf2%','false',$output); |
|
871 | +if ($gltf2) { |
|
872 | + $output = str_replace('%gltf2%','true',$output); |
|
873 | +} else { |
|
874 | + $output = str_replace('%gltf2%','false',$output); |
|
875 | +} |
|
798 | 876 | print $output; |
799 | 877 | ?> |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | <?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 } ?> |
50 | 50 | </tr></table></div> |
51 | 51 | <?php |
52 | - if ((!isset($_COOKIE['MapFormat']) && isset($globalMap3Ddefault) && $globalMap3Ddefault) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d')) { |
|
52 | + if ((!isset($_COOKIE['MapFormat']) && isset($globalMap3Ddefault) && $globalMap3Ddefault) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d')) { |
|
53 | 53 | ?> |
54 | 54 | <script src="<?php echo $globalURL; ?>/js/map.3d.js.php<?php if (isset($tsk)) print '?tsk='.$tsk; ?>"></script> |
55 | 55 | <?php |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | <script src="<?php echo $globalURL; ?>/js/map-marine.3d.js.php"></script> |
74 | 74 | <?php |
75 | 75 | } |
76 | - } |
|
76 | + } |
|
77 | 77 | ?> |
78 | 78 | |
79 | 79 | <div id="sidebar" class="sidebar collapsed"> |
@@ -84,34 +84,34 @@ discard block |
||
84 | 84 | <li><a href="" onclick="getUserLocation(); return false;" title="<?php echo _("Plot your Location"); ?>"><i class="fa fa-map-marker"></i></a></li> |
85 | 85 | <li><a href="" onclick="getCompassDirection(); return false;" title="<?php echo _("Compass Mode"); ?>"><i class="fa fa-compass"></i></a></li> |
86 | 86 | <?php |
87 | - if (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d') { |
|
87 | + if (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d') { |
|
88 | 88 | if (isset($globalArchive) && $globalArchive == TRUE) { |
89 | 89 | ?> |
90 | 90 | <li><a href="#archive" role="tab" title="<?php echo _("Archive"); ?>"><i class="fa fa-archive"></i></a></li> |
91 | 91 | <?php |
92 | 92 | } |
93 | - } |
|
93 | + } |
|
94 | 94 | ?> |
95 | 95 | <li><a href="#home" role="tab" title="<?php echo _("Layers"); ?>"><i class="fa fa-map"></i></a></li> |
96 | 96 | <li><a href="#filters" role="tab" title="<?php echo _("Filters"); ?>"><i class="fa fa-filter"></i></a></li> |
97 | 97 | <li><a href="#settings" role="tab" title="<?php echo _("Settings"); ?>"><i class="fa fa-gears"></i></a></li> |
98 | 98 | <?php |
99 | - if (isset($globalMap3D) && $globalMap3D) { |
|
99 | + if (isset($globalMap3D) && $globalMap3D) { |
|
100 | 100 | if ((!isset($_COOKIE['MapFormat']) && (!isset($globalMap3Ddefault) || !$globalMap3Ddefault)) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] != '3d')) { |
101 | 101 | ?> |
102 | 102 | <li><a href="" onclick="show3D(); return false;" role="tab" title="3D"><b>3D</b></a></li> |
103 | 103 | <?php |
104 | 104 | } else { |
105 | - if (isset($globalSatellite) && $globalSatellite) { |
|
105 | + if (isset($globalSatellite) && $globalSatellite) { |
|
106 | 106 | ?> |
107 | 107 | <li><a href="#satellites" role="tab" title="<?php echo _("Satellites"); ?>"><i class="satellite"></i></a></li> |
108 | 108 | <?php |
109 | - } |
|
109 | + } |
|
110 | 110 | ?> |
111 | 111 | <li><a href="" onclick="show2D(); return false;" role="tab" title="2D"><b>2D</b></a></li> |
112 | 112 | <?php |
113 | 113 | } |
114 | - } |
|
114 | + } |
|
115 | 115 | ?> |
116 | 116 | </ul> |
117 | 117 | |
@@ -186,7 +186,7 @@ discard block |
||
186 | 186 | ?> |
187 | 187 | </div> |
188 | 188 | <?php |
189 | - if (isset($globalArchive) && $globalArchive == TRUE) { |
|
189 | + if (isset($globalArchive) && $globalArchive == TRUE) { |
|
190 | 190 | ?> |
191 | 191 | <div class="sidebar-pane" id="archive"> |
192 | 192 | <h1 class="sidebar-header"><?php echo _("Playback"); ?> <i>Bêta</i><span class="sidebar-close"><i class="fa fa-caret-left"></i></span></h1> |
@@ -245,7 +245,7 @@ discard block |
||
245 | 245 | </form> |
246 | 246 | </div> |
247 | 247 | <?php |
248 | - } |
|
248 | + } |
|
249 | 249 | ?> |
250 | 250 | <div class="sidebar-pane" id="settings"> |
251 | 251 | <h1 class="sidebar-header"><?php echo _("Settings"); ?><span class="sidebar-close"><i class="fa fa-caret-left"></i></span></h1> |
@@ -256,72 +256,72 @@ discard block |
||
256 | 256 | <?php |
257 | 257 | if (!isset($_COOKIE['MapType']) || $_COOKIE['MapType'] == '') $MapType = $globalMapProvider; |
258 | 258 | else $MapType = $_COOKIE['MapType']; |
259 | - ?> |
|
259 | + ?> |
|
260 | 260 | <?php |
261 | 261 | if (isset($globalMapOffline) && $globalMapOffline === TRUE) { |
262 | - ?> |
|
262 | + ?> |
|
263 | 263 | <option value="offline"<?php if ($MapType == 'offline') print ' selected'; ?>>Natural Earth (local)</option> |
264 | 264 | <?php |
265 | 265 | } else { |
266 | - if (file_exists(dirname(__FILE__).'/js/Cesium/Assets/Textures/NaturalEarthII/tilemapresource.xml')) { |
|
267 | - ?> |
|
266 | + if (file_exists(dirname(__FILE__).'/js/Cesium/Assets/Textures/NaturalEarthII/tilemapresource.xml')) { |
|
267 | + ?> |
|
268 | 268 | <option value="offline"<?php if ($MapType == 'offline') print ' selected'; ?>>Natural Earth (local)</option> |
269 | 269 | <?php |
270 | - } |
|
271 | - ?> |
|
270 | + } |
|
271 | + ?> |
|
272 | 272 | <option value="ArcGIS-Streetmap"<?php if ($MapType == 'ArcGIS-Streetmap') print ' selected'; ?>>ArcGIS Streetmap</option> |
273 | 273 | <option value="ArcGIS-Satellite"<?php if ($MapType == 'ArcGIS-Satellite') print ' selected'; ?>>ArcGIS Satellite</option> |
274 | 274 | <?php |
275 | - if (isset($globalBingMapKey) && $globalBingMapKey != '') { |
|
276 | - ?> |
|
275 | + if (isset($globalBingMapKey) && $globalBingMapKey != '') { |
|
276 | + ?> |
|
277 | 277 | <option value="Bing-Aerial"<?php if ($MapType == 'Bing-Aerial') print ' selected'; ?>>Bing-Aerial</option> |
278 | 278 | <option value="Bing-Hybrid"<?php if ($MapType == 'Bing-Hybrid') print ' selected'; ?>>Bing-Hybrid</option> |
279 | 279 | <option value="Bing-Road"<?php if ($MapType == 'Bing-Road') print ' selected'; ?>>Bing-Road</option> |
280 | 280 | <?php |
281 | - } |
|
282 | - ?> |
|
281 | + } |
|
282 | + ?> |
|
283 | 283 | <?php |
284 | - if ((!isset($_COOKIE['MapFormat']) && (!isset($globalMap3Ddefault) || !$globalMap3Ddefault)) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] != '3d')) { |
|
285 | - ?> |
|
284 | + if ((!isset($_COOKIE['MapFormat']) && (!isset($globalMap3Ddefault) || !$globalMap3Ddefault)) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] != '3d')) { |
|
285 | + ?> |
|
286 | 286 | <?php |
287 | 287 | if (isset($globalHereappId) && $globalHereappId != '' && isset($globalHereappCode) && $globalHereappCode != '') { |
288 | - ?> |
|
288 | + ?> |
|
289 | 289 | <option value="Here-Aerial"<?php if ($MapType == 'Here') print ' selected'; ?>>Here-Aerial</option> |
290 | 290 | <option value="Here-Hybrid"<?php if ($MapType == 'Here') print ' selected'; ?>>Here-Hybrid</option> |
291 | 291 | <option value="Here-Road"<?php if ($MapType == 'Here') print ' selected'; ?>>Here-Road</option> |
292 | 292 | <?php |
293 | 293 | } |
294 | - ?> |
|
294 | + ?> |
|
295 | 295 | <?php |
296 | 296 | if (isset($globalGoogleAPIKey) && $globalGoogleAPIKey != '') { |
297 | - ?> |
|
297 | + ?> |
|
298 | 298 | <option value="Google-Roadmap"<?php if ($MapType == 'Google-Roadmap') print ' selected'; ?>>Google Roadmap</option> |
299 | 299 | <option value="Google-Satellite"<?php if ($MapType == 'Google-Satellite') print ' selected'; ?>>Google Satellite</option> |
300 | 300 | <option value="Google-Hybrid"<?php if ($MapType == 'Google-Hybrid') print ' selected'; ?>>Google Hybrid</option> |
301 | 301 | <option value="Google-Terrain"<?php if ($MapType == 'Google-Terrain') print ' selected'; ?>>Google Terrain</option> |
302 | 302 | <?php |
303 | 303 | } |
304 | - ?> |
|
304 | + ?> |
|
305 | 305 | <?php |
306 | 306 | if (isset($globalMapQuestKey) && $globalMapQuestKey != '') { |
307 | - ?> |
|
307 | + ?> |
|
308 | 308 | <option value="MapQuest-OSM"<?php if ($MapType == 'MapQuest-OSM') print ' selected'; ?>>MapQuest-OSM</option> |
309 | 309 | <option value="MapQuest-Aerial"<?php if ($MapType == 'MapQuest-Aerial') print ' selected'; ?>>MapQuest-Aerial</option> |
310 | 310 | <option value="MapQuest-Hybrid"<?php if ($MapType == 'MapQuest-Hybrid') print ' selected'; ?>>MapQuest-Hybrid</option> |
311 | 311 | <?php |
312 | 312 | } |
313 | - ?> |
|
313 | + ?> |
|
314 | 314 | <option value="Yandex"<?php if ($MapType == 'Yandex') print ' selected'; ?>>Yandex</option> |
315 | 315 | <option value="offline"<?php if ($MapType == 'offline') print ' selected'; ?>>Natural Earth</option> |
316 | 316 | <?php |
317 | - } |
|
318 | - ?> |
|
317 | + } |
|
318 | + ?> |
|
319 | 319 | <option value="NatGeo-Street"<?php if ($MapType == 'NatGeo-Street') print ' selected'; ?>>National Geographic Street</option> |
320 | 320 | <?php |
321 | - if (isset($globalMapboxToken) && $globalMapboxToken != '') { |
|
321 | + if (isset($globalMapboxToken) && $globalMapboxToken != '') { |
|
322 | 322 | if (!isset($_COOKIE['MapTypeId'])) $MapBoxId = 'default'; |
323 | 323 | else $MapBoxId = $_COOKIE['MapTypeId']; |
324 | - ?> |
|
324 | + ?> |
|
325 | 325 | <option value="MapboxGL"<?php if ($MapType == 'MapboxGL') print ' selected'; ?>>Mapbox GL</option> |
326 | 326 | <option value="Mapbox-default"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'default') print ' selected'; ?>>Mapbox default</option> |
327 | 327 | <option value="Mapbox-mapbox.streets"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.streets') print ' selected'; ?>>Mapbox streets</option> |
@@ -336,16 +336,16 @@ discard block |
||
336 | 336 | <option value="Mapbox-mapbox.pirates"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.pirates') print ' selected'; ?>>Mapbox pirates</option> |
337 | 337 | <option value="Mapbox-mapbox.emerald"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.emerald') print ' selected'; ?>>Mapbox emerald</option> |
338 | 338 | <?php |
339 | - } |
|
340 | - ?> |
|
339 | + } |
|
340 | + ?> |
|
341 | 341 | <option value="OpenStreetMap"<?php if ($MapType == 'OpenStreetMap') print ' selected'; ?>>OpenStreetMap</option> |
342 | 342 | <?php |
343 | 343 | } |
344 | - ?> |
|
344 | + ?> |
|
345 | 345 | </select> |
346 | 346 | </li> |
347 | 347 | <?php |
348 | - if (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d' && (!isset($globalMapOffline) || $globalMapOffline === FALSE)) { |
|
348 | + if (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d' && (!isset($globalMapOffline) || $globalMapOffline === FALSE)) { |
|
349 | 349 | ?> |
350 | 350 | <li><?php echo _("Type of Terrain:"); ?> |
351 | 351 | <select class="selectpicker" onchange="terrainType(this);"> |
@@ -356,10 +356,10 @@ discard block |
||
356 | 356 | </select> |
357 | 357 | </li> |
358 | 358 | <?php |
359 | - } |
|
359 | + } |
|
360 | 360 | ?> |
361 | 361 | <?php |
362 | - if (!isset($_COOKIE['MapFormat']) || $_COOKIE['MapFormat'] != '3d') { |
|
362 | + if (!isset($_COOKIE['MapFormat']) || $_COOKIE['MapFormat'] != '3d') { |
|
363 | 363 | ?> |
364 | 364 | <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> |
365 | 365 | |
@@ -382,7 +382,7 @@ discard block |
||
382 | 382 | <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> |
383 | 383 | <?php |
384 | 384 | } |
385 | - } |
|
385 | + } |
|
386 | 386 | ?> |
387 | 387 | <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> |
388 | 388 | <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> |
@@ -401,82 +401,82 @@ discard block |
||
401 | 401 | } |
402 | 402 | ?> |
403 | 403 | <?php |
404 | - if (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d') { |
|
404 | + if (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d') { |
|
405 | 405 | ?> |
406 | 406 | <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> |
407 | 407 | <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> |
408 | 408 | <?php |
409 | - } |
|
410 | - if (time() > mktime(0,0,0,12,1,date("Y")) && time() < mktime(0,0,0,12,31,date("Y"))) { |
|
409 | + } |
|
410 | + if (time() > mktime(0,0,0,12,1,date("Y")) && time() < mktime(0,0,0,12,31,date("Y"))) { |
|
411 | 411 | ?> |
412 | 412 | <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> |
413 | 413 | <?php |
414 | - } |
|
414 | + } |
|
415 | 415 | ?> |
416 | 416 | <?php |
417 | 417 | if (function_exists('array_column')) { |
418 | - if (array_search(TRUE, array_column($globalSources, 'sourcestats')) !== FALSE) { |
|
419 | - ?> |
|
418 | + if (array_search(TRUE, array_column($globalSources, 'sourcestats')) !== FALSE) { |
|
419 | + ?> |
|
420 | 420 | <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> |
421 | 421 | <?php |
422 | - } |
|
422 | + } |
|
423 | 423 | } elseif (isset($globalSources)) { |
424 | - $dispolar = false; |
|
425 | - foreach ($globalSources as $testsource) { |
|
426 | - if (isset($globalSources['sourcestats']) && $globalSources['sourcestats'] !== FALSE) $dispolar = true; |
|
427 | - } |
|
428 | - if ($dispolar) { |
|
429 | - ?> |
|
424 | + $dispolar = false; |
|
425 | + foreach ($globalSources as $testsource) { |
|
426 | + if (isset($globalSources['sourcestats']) && $globalSources['sourcestats'] !== FALSE) $dispolar = true; |
|
427 | + } |
|
428 | + if ($dispolar) { |
|
429 | + ?> |
|
430 | 430 | <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> |
431 | 431 | <?php |
432 | - } |
|
433 | - } |
|
434 | - ?> |
|
432 | + } |
|
433 | + } |
|
434 | + ?> |
|
435 | 435 | <?php |
436 | - if (!isset($_COOKIE['MapFormat']) || $_COOKIE['MapFormat'] != '3d') { |
|
436 | + if (!isset($_COOKIE['MapFormat']) || $_COOKIE['MapFormat'] != '3d') { |
|
437 | 437 | ?> |
438 | 438 | |
439 | 439 | <?php |
440 | 440 | if (!isset($globalAircraft) || $globalAircraft === TRUE) { |
441 | - if (extension_loaded('gd') && function_exists('gd_info')) { |
|
442 | - ?> |
|
441 | + if (extension_loaded('gd') && function_exists('gd_info')) { |
|
442 | + ?> |
|
443 | 443 | <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> |
444 | 444 | <?php |
445 | 445 | if (!isset($_COOKIE['IconColorAltitude']) || $_COOKIE['IconColorAltitude'] == 'false') { |
446 | - ?> |
|
446 | + ?> |
|
447 | 447 | <li><?php echo _("Aircraft icon color:"); ?> |
448 | 448 | <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'; ?>"> |
449 | 449 | </li> |
450 | 450 | <?php |
451 | 451 | } |
452 | - } |
|
453 | - } |
|
454 | - ?> |
|
452 | + } |
|
453 | + } |
|
454 | + ?> |
|
455 | 455 | <?php |
456 | 456 | if (isset($globalMarine) && $globalMarine === TRUE) { |
457 | - if (extension_loaded('gd') && function_exists('gd_info')) { |
|
458 | - ?> |
|
457 | + if (extension_loaded('gd') && function_exists('gd_info')) { |
|
458 | + ?> |
|
459 | 459 | <li><?php echo _("Marine icon color:"); ?> |
460 | 460 | <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'; ?>"> |
461 | 461 | </li> |
462 | 462 | <?php |
463 | - } |
|
464 | - } |
|
465 | - ?> |
|
463 | + } |
|
464 | + } |
|
465 | + ?> |
|
466 | 466 | <?php |
467 | 467 | if (isset($globalTracker) && $globalTracker === TRUE) { |
468 | - if (extension_loaded('gd') && function_exists('gd_info')) { |
|
469 | - ?> |
|
468 | + if (extension_loaded('gd') && function_exists('gd_info')) { |
|
469 | + ?> |
|
470 | 470 | <li><?php echo _("Tracker icon color:"); ?> |
471 | 471 | <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'; ?>"> |
472 | 472 | </li> |
473 | 473 | <?php |
474 | - } |
|
475 | - } |
|
476 | - ?> |
|
474 | + } |
|
475 | + } |
|
476 | + ?> |
|
477 | 477 | <?php |
478 | 478 | if (!isset($globalAircraft) || $globalAircraft === TRUE) { |
479 | - ?> |
|
479 | + ?> |
|
480 | 480 | <li><?php echo _("Show airport icon at zoom level:"); ?> |
481 | 481 | <div class="range"> |
482 | 482 | <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'; ?>"> |
@@ -485,9 +485,9 @@ discard block |
||
485 | 485 | </li> |
486 | 486 | <?php |
487 | 487 | } |
488 | - ?> |
|
488 | + ?> |
|
489 | 489 | <?php |
490 | - } elseif (isset($_COOKIE['MapFormat']) || $_COOKIE['MapFOrmat'] == '3d') { |
|
490 | + } elseif (isset($_COOKIE['MapFormat']) || $_COOKIE['MapFOrmat'] == '3d') { |
|
491 | 491 | ?> |
492 | 492 | <?php |
493 | 493 | if (!isset($globalAircraft) || $globalAircraft === TRUE) { |
@@ -519,7 +519,7 @@ discard block |
||
519 | 519 | </li> |
520 | 520 | <?php |
521 | 521 | } |
522 | - } |
|
522 | + } |
|
523 | 523 | ?> |
524 | 524 | <li><?php echo _("Distance unit:"); ?> |
525 | 525 | <select class="selectpicker" onchange="unitdistance(this);"> |
@@ -552,19 +552,19 @@ discard block |
||
552 | 552 | <ul> |
553 | 553 | <?php |
554 | 554 | if (!isset($globalAircraft) || $globalAircraft) { |
555 | - ?> |
|
555 | + ?> |
|
556 | 556 | <?php |
557 | 557 | if (((isset($globalVATSIM) && $globalVATSIM) || isset($globalIVAO) && $globalIVAO || isset($globalphpVMS) && $globalphpVMS) && (!isset($globalMapVAchoose) || $globalMapVAchoose)) { |
558 | - ?> |
|
558 | + ?> |
|
559 | 559 | <?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 } ?> |
560 | 560 | <?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 } ?> |
561 | 561 | <?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 } ?> |
562 | 562 | <?php |
563 | 563 | } |
564 | - ?> |
|
564 | + ?> |
|
565 | 565 | <?php |
566 | 566 | if (!(isset($globalVA) && $globalVA) && !(isset($globalVATSIM) && $globalVATSIM) && !(isset($globalIVAO) && $globalIVAO) && !(isset($globalphpVMS) && $globalphpVMS) && isset($globalSBS1) && $globalSBS1 && isset($globalAPRS) && $globalAPRS && (!isset($globalMapchoose) || $globalMapchoose)) { |
567 | - ?> |
|
567 | + ?> |
|
568 | 568 | <?php if (isset($globalSBS1) && $globalSBS1) { ?> |
569 | 569 | <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> |
570 | 570 | <?php } ?> |
@@ -573,7 +573,7 @@ discard block |
||
573 | 573 | <?php } ?> |
574 | 574 | <?php |
575 | 575 | } |
576 | - ?> |
|
576 | + ?> |
|
577 | 577 | <li><?php echo _("Display airlines:"); ?> |
578 | 578 | <br/> |
579 | 579 | <select class="selectpicker" multiple onchange="airlines(this);" id="display_airlines"> |
@@ -593,14 +593,14 @@ discard block |
||
593 | 593 | echo '<option value="'.$airline['airline_icao'].'">'.$airline_name.'</option>'; |
594 | 594 | } |
595 | 595 | } |
596 | - ?> |
|
596 | + ?> |
|
597 | 597 | </select> |
598 | 598 | </li> |
599 | 599 | <?php |
600 | 600 | $Spotter = new Spotter(); |
601 | 601 | $allalliancenames = $Spotter->getAllAllianceNames(); |
602 | 602 | if (!empty($allalliancenames)) { |
603 | - ?> |
|
603 | + ?> |
|
604 | 604 | <li><?php echo _("Display alliance:"); ?> |
605 | 605 | <br/> |
606 | 606 | <select class="selectpicker" onchange="alliance(this);" id="display_alliance"> |
@@ -614,18 +614,18 @@ discard block |
||
614 | 614 | echo '<option value="'.$alliance_name.'">'.$alliance_name.'</option>'; |
615 | 615 | } |
616 | 616 | } |
617 | - ?> |
|
617 | + ?> |
|
618 | 618 | </select> |
619 | 619 | </li> |
620 | 620 | <?php |
621 | 621 | } |
622 | - ?> |
|
622 | + ?> |
|
623 | 623 | <?php |
624 | 624 | } |
625 | - ?> |
|
625 | + ?> |
|
626 | 626 | <?php |
627 | 627 | if (isset($globalAPRS) && $globalAPRS) { |
628 | - ?> |
|
628 | + ?> |
|
629 | 629 | <li><?php echo _("Display APRS sources name:"); ?> |
630 | 630 | <select class="selectpicker" multiple onchange="sources(this);"> |
631 | 631 | <?php |
@@ -649,18 +649,18 @@ discard block |
||
649 | 649 | echo '<option value="'.$src['name'].'">'.$src['name'].'</option>'; |
650 | 650 | } |
651 | 651 | } |
652 | - ?> |
|
652 | + ?> |
|
653 | 653 | </select> |
654 | 654 | </li> |
655 | 655 | <?php |
656 | 656 | } |
657 | - ?> |
|
657 | + ?> |
|
658 | 658 | <?php |
659 | 659 | if (!isset($globalAircraft) || $globalAircraft) { |
660 | - ?> |
|
660 | + ?> |
|
661 | 661 | <?php |
662 | - if (!(isset($globalVATSIM) && $globalVATSIM) && !(isset($globalIVAO) && $globalIVAO) && !(isset($globalphpVMS) && $globalphpVMS)) { |
|
663 | - ?> |
|
662 | + if (!(isset($globalVATSIM) && $globalVATSIM) && !(isset($globalIVAO) && $globalIVAO) && !(isset($globalphpVMS) && $globalphpVMS)) { |
|
663 | + ?> |
|
664 | 664 | <li><?php echo _("Display airlines of type:"); ?><br/> |
665 | 665 | <select class="selectpicker" onchange="airlinestype(this);"> |
666 | 666 | <option value="all"<?php if (!isset($_COOKIE['filter_airlinestype']) || $_COOKIE['filter_airlinestype'] == 'all' || $_COOKIE['filter_airlinestype'] == '') echo ' selected'; ?>><?php echo _("All"); ?></option> |
@@ -670,21 +670,21 @@ discard block |
||
670 | 670 | </select> |
671 | 671 | </li> |
672 | 672 | <?php |
673 | - } |
|
674 | - ?> |
|
673 | + } |
|
674 | + ?> |
|
675 | 675 | <?php |
676 | 676 | } |
677 | - ?> |
|
677 | + ?> |
|
678 | 678 | <?php |
679 | 679 | if (isset($globalMarine) && $globalMarine) { |
680 | - ?> |
|
680 | + ?> |
|
681 | 681 | <li> |
682 | 682 | <?php echo _("Display vessels with MMSI:"); ?> |
683 | 683 | <input type="text" name="mmsifilter" onchange="mmsifilter();" id="mmsifilter" value="<?php if (isset($_COOKIE['filter_mmsi'])) print $_COOKIE['filter_mmsi']; ?>" /> |
684 | 684 | </li> |
685 | 685 | <?php |
686 | 686 | } |
687 | - ?> |
|
687 | + ?> |
|
688 | 688 | <li> |
689 | 689 | <?php echo _("Display with ident:"); ?> |
690 | 690 | <input type="text" name="identfilter" onchange="identfilter();" id="identfilter" value="<?php if (isset($_COOKIE['filter_ident'])) print $_COOKIE['filter_ident']; ?>" /> |
@@ -697,7 +697,7 @@ discard block |
||
697 | 697 | </form> |
698 | 698 | </div> |
699 | 699 | <?php |
700 | - if (isset($globalSatellite) && $globalSatellite) { |
|
700 | + if (isset($globalSatellite) && $globalSatellite) { |
|
701 | 701 | ?> |
702 | 702 | <div class="sidebar-pane" id="satellites"> |
703 | 703 | <h1 class="sidebar-header"><?php echo _("Satellites"); ?><span class="sidebar-close"><i class="fa fa-caret-left"></i></span></h1> |
@@ -737,14 +737,14 @@ discard block |
||
737 | 737 | print '<option value="'.$type['tle_type'].'">'.$type_name.'</option>'; |
738 | 738 | } |
739 | 739 | } |
740 | - ?> |
|
740 | + ?> |
|
741 | 741 | </select> |
742 | 742 | </li> |
743 | 743 | </ul> |
744 | 744 | </form> |
745 | 745 | </div> |
746 | 746 | <?php |
747 | - } |
|
747 | + } |
|
748 | 748 | ?> |
749 | 749 | </div> |
750 | 750 | </div> |
@@ -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 { |
@@ -197,7 +197,7 @@ discard block |
||
197 | 197 | <div class="form-group"> |
198 | 198 | <label>From (UTC):</label> |
199 | 199 | <div class='input-group date' id='datetimepicker1'> |
200 | - <input type='text' name="start_date" class="form-control" value="<?php if (isset($_POST['start_date'])) print $_POST['start_date']; elseif (isset($_COOKIE['archive_begin'])) print date("m/d/Y h:i a",$_COOKIE['archive_begin']); ?>" required /> |
|
200 | + <input type='text' name="start_date" class="form-control" value="<?php if (isset($_POST['start_date'])) print $_POST['start_date']; elseif (isset($_COOKIE['archive_begin'])) print date("m/d/Y h:i a", $_COOKIE['archive_begin']); ?>" required /> |
|
201 | 201 | <span class="input-group-addon"> |
202 | 202 | <span class="glyphicon glyphicon-calendar"></span> |
203 | 203 | </span> |
@@ -206,7 +206,7 @@ discard block |
||
206 | 206 | <div class="form-group"> |
207 | 207 | <label>To (UTC):</label> |
208 | 208 | <div class='input-group date' id='datetimepicker2'> |
209 | - <input type='text' name="end_date" class="form-control" value="<?php if (isset($_POST['end_date'])) print $_POST['end_date']; elseif (isset($_COOKIE['archive_end'])) print date("m/d/Y h:i a",$_COOKIE['archive_end']); ?>" /> |
|
209 | + <input type='text' name="end_date" class="form-control" value="<?php if (isset($_POST['end_date'])) print $_POST['end_date']; elseif (isset($_COOKIE['archive_end'])) print date("m/d/Y h:i a", $_COOKIE['archive_end']); ?>" /> |
|
210 | 210 | <span class="input-group-addon"> |
211 | 211 | <span class="glyphicon glyphicon-calendar"></span> |
212 | 212 | </span> |
@@ -350,9 +350,9 @@ discard block |
||
350 | 350 | <li><?php echo _("Type of Terrain:"); ?> |
351 | 351 | <select class="selectpicker" onchange="terrainType(this);"> |
352 | 352 | <option value="stk"<?php if (!isset($_COOKIE['MapTerrain']) || $_COOKIE['MapTerrain'] == 'stk') print ' selected'; ?>>stk terrain</option> |
353 | - <option value="ellipsoid"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'ellipsoid') print ' selected';?>>ellipsoid</option> |
|
354 | - <option value="vrterrain"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'vrterrain') print ' selected';?>>vr terrain</option> |
|
355 | - <option value="articdem"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'articdem') print ' selected';?>>ArticDEM</option> |
|
353 | + <option value="ellipsoid"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'ellipsoid') print ' selected'; ?>>ellipsoid</option> |
|
354 | + <option value="vrterrain"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'vrterrain') print ' selected'; ?>>vr terrain</option> |
|
355 | + <option value="articdem"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'articdem') print ' selected'; ?>>ArticDEM</option> |
|
356 | 356 | </select> |
357 | 357 | </li> |
358 | 358 | <?php |
@@ -407,7 +407,7 @@ discard block |
||
407 | 407 | <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> |
408 | 408 | <?php |
409 | 409 | } |
410 | - if (time() > mktime(0,0,0,12,1,date("Y")) && time() < mktime(0,0,0,12,31,date("Y"))) { |
|
410 | + if (time() > mktime(0, 0, 0, 12, 1, date("Y")) && time() < mktime(0, 0, 0, 12, 31, date("Y"))) { |
|
411 | 411 | ?> |
412 | 412 | <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> |
413 | 413 | <?php |
@@ -584,10 +584,10 @@ discard block |
||
584 | 584 | $Spotter = new Spotter(); |
585 | 585 | $allairlinenames = $Spotter->getAllAirlineNames(); |
586 | 586 | } |
587 | - foreach($allairlinenames as $airline) { |
|
587 | + foreach ($allairlinenames as $airline) { |
|
588 | 588 | $airline_name = $airline['airline_name']; |
589 | - if (strlen($airline_name) > 30) $airline_name = substr($airline_name,0,30).'...'; |
|
590 | - if (isset($_COOKIE['filter_Airlines']) && in_array($airline['airline_icao'],explode(',',$_COOKIE['filter_Airlines']))) { |
|
589 | + if (strlen($airline_name) > 30) $airline_name = substr($airline_name, 0, 30).'...'; |
|
590 | + if (isset($_COOKIE['filter_Airlines']) && in_array($airline['airline_icao'], explode(',', $_COOKIE['filter_Airlines']))) { |
|
591 | 591 | echo '<option value="'.$airline['airline_icao'].'" selected>'.$airline_name.'</option>'; |
592 | 592 | } else { |
593 | 593 | echo '<option value="'.$airline['airline_icao'].'">'.$airline_name.'</option>'; |
@@ -606,7 +606,7 @@ discard block |
||
606 | 606 | <select class="selectpicker" onchange="alliance(this);" id="display_alliance"> |
607 | 607 | <option value="all"<?php if (!isset($_COOKIE['filter_alliance']) || $_COOKIE['filter_alliance'] == 'all' || $_COOKIE['filter_alliance'] == '') echo ' selected'; ?>><?php echo _("All"); ?></option> |
608 | 608 | <?php |
609 | - foreach($allalliancenames as $alliance) { |
|
609 | + foreach ($allalliancenames as $alliance) { |
|
610 | 610 | $alliance_name = $alliance['alliance']; |
611 | 611 | if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] == $alliance_name) { |
612 | 612 | echo '<option value="'.$alliance_name.'" selected>'.$alliance_name.'</option>'; |
@@ -642,8 +642,8 @@ discard block |
||
642 | 642 | */ |
643 | 643 | $Source = new Source(); |
644 | 644 | $datasource = $Source->getLocationInfoByType('gs'); |
645 | - foreach($datasource as $src) { |
|
646 | - if (isset($_COOKIE['filter_Sources']) && in_array($src['name'],explode(',',$_COOKIE['filter_Sources']))) { |
|
645 | + foreach ($datasource as $src) { |
|
646 | + if (isset($_COOKIE['filter_Sources']) && in_array($src['name'], explode(',', $_COOKIE['filter_Sources']))) { |
|
647 | 647 | echo '<option value="'.$src['name'].'" selected>'.$src['name'].'</option>'; |
648 | 648 | } else { |
649 | 649 | echo '<option value="'.$src['name'].'">'.$src['name'].'</option>'; |
@@ -731,7 +731,7 @@ discard block |
||
731 | 731 | else if ($type_name == 'radar') $type_name = 'Radar Calibration'; |
732 | 732 | else if ($type_name == 'tle-new') $type_name = 'Last 30 days launches'; |
733 | 733 | |
734 | - if (isset($_COOKIE['sattypes']) && in_array($type['tle_type'],explode(',',$_COOKIE['sattypes']))) { |
|
734 | + if (isset($_COOKIE['sattypes']) && in_array($type['tle_type'], explode(',', $_COOKIE['sattypes']))) { |
|
735 | 735 | print '<option value="'.$type['tle_type'].'" selected>'.$type_name.'</option>'; |
736 | 736 | } else { |
737 | 737 | print '<option value="'.$type['tle_type'].'">'.$type_name.'</option>'; |
@@ -51,7 +51,10 @@ discard block |
||
51 | 51 | <?php |
52 | 52 | if ((!isset($_COOKIE['MapFormat']) && isset($globalMap3Ddefault) && $globalMap3Ddefault) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d')) { |
53 | 53 | ?> |
54 | -<script src="<?php echo $globalURL; ?>/js/map.3d.js.php<?php if (isset($tsk)) print '?tsk='.$tsk; ?>"></script> |
|
54 | +<script src="<?php echo $globalURL; ?>/js/map.3d.js.php<?php if (isset($tsk)) { |
|
55 | + print '?tsk='.$tsk; |
|
56 | +} |
|
57 | +?>"></script> |
|
55 | 58 | <?php |
56 | 59 | if (!isset($globalAircraft) || $globalAircraft) { |
57 | 60 | ?> |
@@ -141,8 +144,14 @@ discard block |
||
141 | 144 | ?> |
142 | 145 | <form> |
143 | 146 | <ul> |
144 | - <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> |
|
145 | - <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> |
|
147 | + <li><div class="checkbox"><label><input type="checkbox" name="waypoints" value="1" onclick="showWaypoints(this);" <?php if (isset($_COOKIE['waypoints']) && $_COOKIE['waypoints'] == 'true') { |
|
148 | + print 'checked'; |
|
149 | +} |
|
150 | +?> /><?php echo _("Display waypoints"); ?></label></div></li> |
|
151 | + <li><div class="checkbox"><label><input type="checkbox" name="airspace" value="1" onclick="showAirspace(this);" <?php if (isset($_COOKIE['airspace']) && $_COOKIE['airspace'] == 'true') { |
|
152 | + print 'checked'; |
|
153 | +} |
|
154 | +?> /><?php echo _("Display airspace"); ?></label></div></li> |
|
146 | 155 | </ul> |
147 | 156 | </form> |
148 | 157 | <?php |
@@ -150,8 +159,14 @@ discard block |
||
150 | 159 | ?> |
151 | 160 | <form> |
152 | 161 | <ul> |
153 | - <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> |
|
154 | - <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> |
|
162 | + <li><div class="checkbox"><label><input type="checkbox" name="waypoints" value="1" onclick="showWaypoints(this);" <?php if (isset($_COOKIE['waypoints']) && $_COOKIE['waypoints'] == 'true') { |
|
163 | + print 'checked'; |
|
164 | +} |
|
165 | +?> /><?php echo _("Display waypoints"); ?> Beta</label></div></li> |
|
166 | + <li><div class="checkbox"><label><input type="checkbox" name="airspace" value="1" onclick="showAirspace(this);" <?php if (isset($_COOKIE['airspace']) && $_COOKIE['airspace'] == 'true') { |
|
167 | + print 'checked'; |
|
168 | +} |
|
169 | +?> /><?php echo _("Display airspace"); ?> Beta</label></div></li> |
|
155 | 170 | </ul> |
156 | 171 | <p>This layers are in Beta, this can and will crash.</p> |
157 | 172 | </form> |
@@ -162,14 +177,32 @@ discard block |
||
162 | 177 | <h1>NOTAM</h1> |
163 | 178 | <form> |
164 | 179 | <ul> |
165 | - <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> |
|
180 | + <li><div class="checkbox"><label><input type="checkbox" name="notamcb" value="1" onclick="showNotam(this);" <?php if (isset($_COOKIE['notam']) && $_COOKIE['notam'] == 'true') { |
|
181 | + print 'checked'; |
|
182 | +} |
|
183 | +?> /><?php echo _("Display NOTAM"); ?></label></div></li> |
|
166 | 184 | <li><?php echo _("NOTAM scope:"); ?> |
167 | 185 | <select class="selectpicker" onchange="notamscope(this);"> |
168 | - <option<?php if (!isset($_COOKIE['notamscope']) || $_COOKIE['notamscope'] == 'All') print ' selected'; ?>>All</option> |
|
169 | - <option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Airport/Enroute warning') print ' selected'; ?>>Airport/Enroute warning</option> |
|
170 | - <option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Airport warning') print ' selected'; ?>>Airport warning</option> |
|
171 | - <option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Navigation warning') print ' selected'; ?>>Navigation warning</option> |
|
172 | - <option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Enroute warning') print ' selected'; ?>>Enroute warning</option> |
|
186 | + <option<?php if (!isset($_COOKIE['notamscope']) || $_COOKIE['notamscope'] == 'All') { |
|
187 | + print ' selected'; |
|
188 | +} |
|
189 | +?>>All</option> |
|
190 | + <option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Airport/Enroute warning') { |
|
191 | + print ' selected'; |
|
192 | +} |
|
193 | +?>>Airport/Enroute warning</option> |
|
194 | + <option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Airport warning') { |
|
195 | + print ' selected'; |
|
196 | +} |
|
197 | +?>>Airport warning</option> |
|
198 | + <option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Navigation warning') { |
|
199 | + print ' selected'; |
|
200 | +} |
|
201 | +?>>Navigation warning</option> |
|
202 | + <option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Enroute warning') { |
|
203 | + print ' selected'; |
|
204 | +} |
|
205 | +?>>Enroute warning</option> |
|
173 | 206 | </select |
174 | 207 | </li> |
175 | 208 | </ul> |
@@ -197,7 +230,12 @@ discard block |
||
197 | 230 | <div class="form-group"> |
198 | 231 | <label>From (UTC):</label> |
199 | 232 | <div class='input-group date' id='datetimepicker1'> |
200 | - <input type='text' name="start_date" class="form-control" value="<?php if (isset($_POST['start_date'])) print $_POST['start_date']; elseif (isset($_COOKIE['archive_begin'])) print date("m/d/Y h:i a",$_COOKIE['archive_begin']); ?>" required /> |
|
233 | + <input type='text' name="start_date" class="form-control" value="<?php if (isset($_POST['start_date'])) { |
|
234 | + print $_POST['start_date']; |
|
235 | +} elseif (isset($_COOKIE['archive_begin'])) { |
|
236 | + print date("m/d/Y h:i a",$_COOKIE['archive_begin']); |
|
237 | +} |
|
238 | +?>" required /> |
|
201 | 239 | <span class="input-group-addon"> |
202 | 240 | <span class="glyphicon glyphicon-calendar"></span> |
203 | 241 | </span> |
@@ -206,7 +244,12 @@ discard block |
||
206 | 244 | <div class="form-group"> |
207 | 245 | <label>To (UTC):</label> |
208 | 246 | <div class='input-group date' id='datetimepicker2'> |
209 | - <input type='text' name="end_date" class="form-control" value="<?php if (isset($_POST['end_date'])) print $_POST['end_date']; elseif (isset($_COOKIE['archive_end'])) print date("m/d/Y h:i a",$_COOKIE['archive_end']); ?>" /> |
|
247 | + <input type='text' name="end_date" class="form-control" value="<?php if (isset($_POST['end_date'])) { |
|
248 | + print $_POST['end_date']; |
|
249 | +} elseif (isset($_COOKIE['archive_end'])) { |
|
250 | + print date("m/d/Y h:i a",$_COOKIE['archive_end']); |
|
251 | +} |
|
252 | +?>" /> |
|
210 | 253 | <span class="input-group-addon"> |
211 | 254 | <span class="glyphicon glyphicon-calendar"></span> |
212 | 255 | </span> |
@@ -231,8 +274,20 @@ discard block |
||
231 | 274 | </script> |
232 | 275 | <li><?php echo _("Playback speed:"); ?> |
233 | 276 | <div class="range"> |
234 | - <input type="range" min="0" max="50" step="1" 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'; ?>"> |
|
235 | - <output id="archivespeedrange"><?php if (isset($_COOKIE['archive_speed'])) print $_COOKIE['archive_speed']; else print '1'; ?></output> |
|
277 | + <input type="range" min="0" max="50" step="1" name="archivespeed" onChange="archivespeedrange.value=value;" value="<?php if (isset($_POST['archivespeed'])) { |
|
278 | + print $_POST['archivespeed']; |
|
279 | +} elseif (isset($_COOKIE['archive_speed'])) { |
|
280 | + print $_COOKIE['archive_speed']; |
|
281 | +} else { |
|
282 | + print '1'; |
|
283 | +} |
|
284 | +?>"> |
|
285 | + <output id="archivespeedrange"><?php if (isset($_COOKIE['archive_speed'])) { |
|
286 | + print $_COOKIE['archive_speed']; |
|
287 | +} else { |
|
288 | + print '1'; |
|
289 | +} |
|
290 | +?></output> |
|
236 | 291 | </div> |
237 | 292 | </li> |
238 | 293 | <li><input type="submit" name="archive" value="Show archive" class="btn btn-primary" /></li> |
@@ -254,29 +309,53 @@ discard block |
||
254 | 309 | <li><?php echo _("Type of Map:"); ?> |
255 | 310 | <select class="selectpicker" onchange="mapType(this);"> |
256 | 311 | <?php |
257 | - if (!isset($_COOKIE['MapType']) || $_COOKIE['MapType'] == '') $MapType = $globalMapProvider; |
|
258 | - else $MapType = $_COOKIE['MapType']; |
|
312 | + if (!isset($_COOKIE['MapType']) || $_COOKIE['MapType'] == '') { |
|
313 | + $MapType = $globalMapProvider; |
|
314 | + } else { |
|
315 | + $MapType = $_COOKIE['MapType']; |
|
316 | + } |
|
259 | 317 | ?> |
260 | 318 | <?php |
261 | 319 | if (isset($globalMapOffline) && $globalMapOffline === TRUE) { |
262 | 320 | ?> |
263 | - <option value="offline"<?php if ($MapType == 'offline') print ' selected'; ?>>Natural Earth (local)</option> |
|
321 | + <option value="offline"<?php if ($MapType == 'offline') { |
|
322 | + print ' selected'; |
|
323 | +} |
|
324 | +?>>Natural Earth (local)</option> |
|
264 | 325 | <?php |
265 | 326 | } else { |
266 | 327 | if (file_exists(dirname(__FILE__).'/js/Cesium/Assets/Textures/NaturalEarthII/tilemapresource.xml')) { |
267 | 328 | ?> |
268 | - <option value="offline"<?php if ($MapType == 'offline') print ' selected'; ?>>Natural Earth (local)</option> |
|
329 | + <option value="offline"<?php if ($MapType == 'offline') { |
|
330 | + print ' selected'; |
|
331 | +} |
|
332 | +?>>Natural Earth (local)</option> |
|
269 | 333 | <?php |
270 | 334 | } |
271 | 335 | ?> |
272 | - <option value="ArcGIS-Streetmap"<?php if ($MapType == 'ArcGIS-Streetmap') print ' selected'; ?>>ArcGIS Streetmap</option> |
|
273 | - <option value="ArcGIS-Satellite"<?php if ($MapType == 'ArcGIS-Satellite') print ' selected'; ?>>ArcGIS Satellite</option> |
|
336 | + <option value="ArcGIS-Streetmap"<?php if ($MapType == 'ArcGIS-Streetmap') { |
|
337 | + print ' selected'; |
|
338 | +} |
|
339 | +?>>ArcGIS Streetmap</option> |
|
340 | + <option value="ArcGIS-Satellite"<?php if ($MapType == 'ArcGIS-Satellite') { |
|
341 | + print ' selected'; |
|
342 | +} |
|
343 | +?>>ArcGIS Satellite</option> |
|
274 | 344 | <?php |
275 | 345 | if (isset($globalBingMapKey) && $globalBingMapKey != '') { |
276 | 346 | ?> |
277 | - <option value="Bing-Aerial"<?php if ($MapType == 'Bing-Aerial') print ' selected'; ?>>Bing-Aerial</option> |
|
278 | - <option value="Bing-Hybrid"<?php if ($MapType == 'Bing-Hybrid') print ' selected'; ?>>Bing-Hybrid</option> |
|
279 | - <option value="Bing-Road"<?php if ($MapType == 'Bing-Road') print ' selected'; ?>>Bing-Road</option> |
|
347 | + <option value="Bing-Aerial"<?php if ($MapType == 'Bing-Aerial') { |
|
348 | + print ' selected'; |
|
349 | +} |
|
350 | +?>>Bing-Aerial</option> |
|
351 | + <option value="Bing-Hybrid"<?php if ($MapType == 'Bing-Hybrid') { |
|
352 | + print ' selected'; |
|
353 | +} |
|
354 | +?>>Bing-Hybrid</option> |
|
355 | + <option value="Bing-Road"<?php if ($MapType == 'Bing-Road') { |
|
356 | + print ' selected'; |
|
357 | +} |
|
358 | +?>>Bing-Road</option> |
|
280 | 359 | <?php |
281 | 360 | } |
282 | 361 | ?> |
@@ -286,59 +365,143 @@ discard block |
||
286 | 365 | <?php |
287 | 366 | if (isset($globalHereappId) && $globalHereappId != '' && isset($globalHereappCode) && $globalHereappCode != '') { |
288 | 367 | ?> |
289 | - <option value="Here-Aerial"<?php if ($MapType == 'Here') print ' selected'; ?>>Here-Aerial</option> |
|
290 | - <option value="Here-Hybrid"<?php if ($MapType == 'Here') print ' selected'; ?>>Here-Hybrid</option> |
|
291 | - <option value="Here-Road"<?php if ($MapType == 'Here') print ' selected'; ?>>Here-Road</option> |
|
368 | + <option value="Here-Aerial"<?php if ($MapType == 'Here') { |
|
369 | + print ' selected'; |
|
370 | +} |
|
371 | +?>>Here-Aerial</option> |
|
372 | + <option value="Here-Hybrid"<?php if ($MapType == 'Here') { |
|
373 | + print ' selected'; |
|
374 | +} |
|
375 | +?>>Here-Hybrid</option> |
|
376 | + <option value="Here-Road"<?php if ($MapType == 'Here') { |
|
377 | + print ' selected'; |
|
378 | +} |
|
379 | +?>>Here-Road</option> |
|
292 | 380 | <?php |
293 | 381 | } |
294 | 382 | ?> |
295 | 383 | <?php |
296 | 384 | if (isset($globalGoogleAPIKey) && $globalGoogleAPIKey != '') { |
297 | 385 | ?> |
298 | - <option value="Google-Roadmap"<?php if ($MapType == 'Google-Roadmap') print ' selected'; ?>>Google Roadmap</option> |
|
299 | - <option value="Google-Satellite"<?php if ($MapType == 'Google-Satellite') print ' selected'; ?>>Google Satellite</option> |
|
300 | - <option value="Google-Hybrid"<?php if ($MapType == 'Google-Hybrid') print ' selected'; ?>>Google Hybrid</option> |
|
301 | - <option value="Google-Terrain"<?php if ($MapType == 'Google-Terrain') print ' selected'; ?>>Google Terrain</option> |
|
386 | + <option value="Google-Roadmap"<?php if ($MapType == 'Google-Roadmap') { |
|
387 | + print ' selected'; |
|
388 | +} |
|
389 | +?>>Google Roadmap</option> |
|
390 | + <option value="Google-Satellite"<?php if ($MapType == 'Google-Satellite') { |
|
391 | + print ' selected'; |
|
392 | +} |
|
393 | +?>>Google Satellite</option> |
|
394 | + <option value="Google-Hybrid"<?php if ($MapType == 'Google-Hybrid') { |
|
395 | + print ' selected'; |
|
396 | +} |
|
397 | +?>>Google Hybrid</option> |
|
398 | + <option value="Google-Terrain"<?php if ($MapType == 'Google-Terrain') { |
|
399 | + print ' selected'; |
|
400 | +} |
|
401 | +?>>Google Terrain</option> |
|
302 | 402 | <?php |
303 | 403 | } |
304 | 404 | ?> |
305 | 405 | <?php |
306 | 406 | if (isset($globalMapQuestKey) && $globalMapQuestKey != '') { |
307 | 407 | ?> |
308 | - <option value="MapQuest-OSM"<?php if ($MapType == 'MapQuest-OSM') print ' selected'; ?>>MapQuest-OSM</option> |
|
309 | - <option value="MapQuest-Aerial"<?php if ($MapType == 'MapQuest-Aerial') print ' selected'; ?>>MapQuest-Aerial</option> |
|
310 | - <option value="MapQuest-Hybrid"<?php if ($MapType == 'MapQuest-Hybrid') print ' selected'; ?>>MapQuest-Hybrid</option> |
|
408 | + <option value="MapQuest-OSM"<?php if ($MapType == 'MapQuest-OSM') { |
|
409 | + print ' selected'; |
|
410 | +} |
|
411 | +?>>MapQuest-OSM</option> |
|
412 | + <option value="MapQuest-Aerial"<?php if ($MapType == 'MapQuest-Aerial') { |
|
413 | + print ' selected'; |
|
414 | +} |
|
415 | +?>>MapQuest-Aerial</option> |
|
416 | + <option value="MapQuest-Hybrid"<?php if ($MapType == 'MapQuest-Hybrid') { |
|
417 | + print ' selected'; |
|
418 | +} |
|
419 | +?>>MapQuest-Hybrid</option> |
|
311 | 420 | <?php |
312 | 421 | } |
313 | 422 | ?> |
314 | - <option value="Yandex"<?php if ($MapType == 'Yandex') print ' selected'; ?>>Yandex</option> |
|
315 | - <option value="offline"<?php if ($MapType == 'offline') print ' selected'; ?>>Natural Earth</option> |
|
423 | + <option value="Yandex"<?php if ($MapType == 'Yandex') { |
|
424 | + print ' selected'; |
|
425 | +} |
|
426 | +?>>Yandex</option> |
|
427 | + <option value="offline"<?php if ($MapType == 'offline') { |
|
428 | + print ' selected'; |
|
429 | +} |
|
430 | +?>>Natural Earth</option> |
|
316 | 431 | <?php |
317 | 432 | } |
318 | 433 | ?> |
319 | - <option value="NatGeo-Street"<?php if ($MapType == 'NatGeo-Street') print ' selected'; ?>>National Geographic Street</option> |
|
434 | + <option value="NatGeo-Street"<?php if ($MapType == 'NatGeo-Street') { |
|
435 | + print ' selected'; |
|
436 | +} |
|
437 | +?>>National Geographic Street</option> |
|
320 | 438 | <?php |
321 | 439 | if (isset($globalMapboxToken) && $globalMapboxToken != '') { |
322 | - if (!isset($_COOKIE['MapTypeId'])) $MapBoxId = 'default'; |
|
323 | - else $MapBoxId = $_COOKIE['MapTypeId']; |
|
440 | + if (!isset($_COOKIE['MapTypeId'])) { |
|
441 | + $MapBoxId = 'default'; |
|
442 | + } else { |
|
443 | + $MapBoxId = $_COOKIE['MapTypeId']; |
|
444 | + } |
|
324 | 445 | ?> |
325 | - <option value="MapboxGL"<?php if ($MapType == 'MapboxGL') print ' selected'; ?>>Mapbox GL</option> |
|
326 | - <option value="Mapbox-default"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'default') print ' selected'; ?>>Mapbox default</option> |
|
327 | - <option value="Mapbox-mapbox.streets"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.streets') print ' selected'; ?>>Mapbox streets</option> |
|
328 | - <option value="Mapbox-mapbox.light"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.light') print ' selected'; ?>>Mapbox light</option> |
|
329 | - <option value="Mapbox-mapbox.dark"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.dark') print ' selected'; ?>>Mapbox dark</option> |
|
330 | - <option value="Mapbox-mapbox.satellite"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.satellite') print ' selected'; ?>>Mapbox satellite</option> |
|
331 | - <option value="Mapbox-mapbox.streets-satellite"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.streets-satellite') print ' selected'; ?>>Mapbox streets-satellite</option> |
|
332 | - <option value="Mapbox-mapbox.streets-basic"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.streets-basic') print ' selected'; ?>>Mapbox streets-basic</option> |
|
333 | - <option value="Mapbox-mapbox.comic"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.comic') print ' selected'; ?>>Mapbox comic</option> |
|
334 | - <option value="Mapbox-mapbox.outdoors"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.outdoors') print ' selected'; ?>>Mapbox outdoors</option> |
|
335 | - <option value="Mapbox-mapbox.pencil"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.pencil') print ' selected'; ?>>Mapbox pencil</option> |
|
336 | - <option value="Mapbox-mapbox.pirates"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.pirates') print ' selected'; ?>>Mapbox pirates</option> |
|
337 | - <option value="Mapbox-mapbox.emerald"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.emerald') print ' selected'; ?>>Mapbox emerald</option> |
|
446 | + <option value="MapboxGL"<?php if ($MapType == 'MapboxGL') { |
|
447 | + print ' selected'; |
|
448 | +} |
|
449 | +?>>Mapbox GL</option> |
|
450 | + <option value="Mapbox-default"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'default') { |
|
451 | + print ' selected'; |
|
452 | +} |
|
453 | +?>>Mapbox default</option> |
|
454 | + <option value="Mapbox-mapbox.streets"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.streets') { |
|
455 | + print ' selected'; |
|
456 | +} |
|
457 | +?>>Mapbox streets</option> |
|
458 | + <option value="Mapbox-mapbox.light"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.light') { |
|
459 | + print ' selected'; |
|
460 | +} |
|
461 | +?>>Mapbox light</option> |
|
462 | + <option value="Mapbox-mapbox.dark"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.dark') { |
|
463 | + print ' selected'; |
|
464 | +} |
|
465 | +?>>Mapbox dark</option> |
|
466 | + <option value="Mapbox-mapbox.satellite"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.satellite') { |
|
467 | + print ' selected'; |
|
468 | +} |
|
469 | +?>>Mapbox satellite</option> |
|
470 | + <option value="Mapbox-mapbox.streets-satellite"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.streets-satellite') { |
|
471 | + print ' selected'; |
|
472 | +} |
|
473 | +?>>Mapbox streets-satellite</option> |
|
474 | + <option value="Mapbox-mapbox.streets-basic"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.streets-basic') { |
|
475 | + print ' selected'; |
|
476 | +} |
|
477 | +?>>Mapbox streets-basic</option> |
|
478 | + <option value="Mapbox-mapbox.comic"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.comic') { |
|
479 | + print ' selected'; |
|
480 | +} |
|
481 | +?>>Mapbox comic</option> |
|
482 | + <option value="Mapbox-mapbox.outdoors"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.outdoors') { |
|
483 | + print ' selected'; |
|
484 | +} |
|
485 | +?>>Mapbox outdoors</option> |
|
486 | + <option value="Mapbox-mapbox.pencil"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.pencil') { |
|
487 | + print ' selected'; |
|
488 | +} |
|
489 | +?>>Mapbox pencil</option> |
|
490 | + <option value="Mapbox-mapbox.pirates"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.pirates') { |
|
491 | + print ' selected'; |
|
492 | +} |
|
493 | +?>>Mapbox pirates</option> |
|
494 | + <option value="Mapbox-mapbox.emerald"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.emerald') { |
|
495 | + print ' selected'; |
|
496 | +} |
|
497 | +?>>Mapbox emerald</option> |
|
338 | 498 | <?php |
339 | 499 | } |
340 | 500 | ?> |
341 | - <option value="OpenStreetMap"<?php if ($MapType == 'OpenStreetMap') print ' selected'; ?>>OpenStreetMap</option> |
|
501 | + <option value="OpenStreetMap"<?php if ($MapType == 'OpenStreetMap') { |
|
502 | + print ' selected'; |
|
503 | +} |
|
504 | +?>>OpenStreetMap</option> |
|
342 | 505 | <?php |
343 | 506 | } |
344 | 507 | ?> |
@@ -349,10 +512,22 @@ discard block |
||
349 | 512 | ?> |
350 | 513 | <li><?php echo _("Type of Terrain:"); ?> |
351 | 514 | <select class="selectpicker" onchange="terrainType(this);"> |
352 | - <option value="stk"<?php if (!isset($_COOKIE['MapTerrain']) || $_COOKIE['MapTerrain'] == 'stk') print ' selected'; ?>>stk terrain</option> |
|
353 | - <option value="ellipsoid"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'ellipsoid') print ' selected';?>>ellipsoid</option> |
|
354 | - <option value="vrterrain"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'vrterrain') print ' selected';?>>vr terrain</option> |
|
355 | - <option value="articdem"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'articdem') print ' selected';?>>ArticDEM</option> |
|
515 | + <option value="stk"<?php if (!isset($_COOKIE['MapTerrain']) || $_COOKIE['MapTerrain'] == 'stk') { |
|
516 | + print ' selected'; |
|
517 | +} |
|
518 | +?>>stk terrain</option> |
|
519 | + <option value="ellipsoid"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'ellipsoid') { |
|
520 | + print ' selected'; |
|
521 | +} |
|
522 | +?>>ellipsoid</option> |
|
523 | + <option value="vrterrain"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'vrterrain') { |
|
524 | + print ' selected'; |
|
525 | +} |
|
526 | +?>>vr terrain</option> |
|
527 | + <option value="articdem"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'articdem') { |
|
528 | + print ' selected'; |
|
529 | +} |
|
530 | +?>>ArticDEM</option> |
|
356 | 531 | </select> |
357 | 532 | </li> |
358 | 533 | <?php |
@@ -361,50 +536,98 @@ discard block |
||
361 | 536 | <?php |
362 | 537 | if (!isset($_COOKIE['MapFormat']) || $_COOKIE['MapFormat'] != '3d') { |
363 | 538 | ?> |
364 | - <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> |
|
539 | + <li><div class="checkbox"><label><input type="checkbox" name="display2dbuildings" value="1" onclick="clickDisplay2DBuildings(this)" <?php if (isset($_COOKIE['Map2DBuildings']) && $_COOKIE['Map2DBuildings'] == 'true') { |
|
540 | + print 'checked'; |
|
541 | +} |
|
542 | +?> ><?php echo _("Display 2.5D buidings on map"); ?></label></div></li> |
|
365 | 543 | |
366 | 544 | <?php |
367 | 545 | if (!isset($globalAircraft) || $globalAircraft === TRUE) { |
368 | 546 | ?> |
369 | - <!--<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>--> |
|
370 | - <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> |
|
371 | - <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> |
|
372 | - <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> |
|
373 | - <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> |
|
547 | + <!--<li><div class="checkbox"><label><input type="checkbox" name="flightpopup" value="1" onclick="clickFlightPopup(this)" <?php if (isset($_COOKIE['flightpopup']) && $_COOKIE['flightpopup'] == 'true') { |
|
548 | + print 'checked'; |
|
549 | +} |
|
550 | +?> ><?php echo _("Display flight info as popup"); ?></label></div></li>--> |
|
551 | + <li><div class="checkbox"><label><input type="checkbox" name="flightpath" value="1" onclick="clickFlightPath(this)" <?php if ((isset($_COOKIE['flightpath']) && $_COOKIE['flightpath'] == 'true')) { |
|
552 | + print 'checked'; |
|
553 | +} |
|
554 | +?> ><?php echo _("Display flight path"); ?></label></div></li> |
|
555 | + <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)) { |
|
556 | + print 'checked'; |
|
557 | +} |
|
558 | +?> ><?php echo _("Display flight route on click"); ?></label></div></li> |
|
559 | + <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)) { |
|
560 | + print 'checked'; |
|
561 | +} |
|
562 | +?> ><?php echo _("Display flight remaining route on click"); ?></label></div></li> |
|
563 | + <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)) { |
|
564 | + print 'checked'; |
|
565 | +} |
|
566 | +?> ><?php echo _("Planes animate between updates"); ?></label></div></li> |
|
374 | 567 | <?php |
375 | 568 | } elseif (!isset($globalTracker) || $globalTracker === TRUE) { |
376 | 569 | ?> |
377 | - <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> |
|
570 | + <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)) { |
|
571 | + print 'checked'; |
|
572 | +} |
|
573 | +?> ><?php echo _("Enable map matching"); ?></label></div></li> |
|
378 | 574 | <?php |
379 | 575 | } |
380 | 576 | if (isset($globalSatellite) && $globalSatellite === TRUE) { |
381 | 577 | ?> |
382 | - <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> |
|
578 | + <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)) { |
|
579 | + print 'checked'; |
|
580 | +} |
|
581 | +?> ><?php echo _("Satellites animate between updates"); ?></label></div></li> |
|
383 | 582 | <?php |
384 | 583 | } |
385 | 584 | } |
386 | 585 | ?> |
387 | - <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> |
|
388 | - <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> |
|
389 | - <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> |
|
390 | - <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> |
|
586 | + <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'])) { |
|
587 | + print 'checked'; |
|
588 | +} |
|
589 | +?> ><?php echo _("Display airports on map"); ?></label></div></li> |
|
590 | + <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))) { |
|
591 | + print 'checked'; |
|
592 | +} |
|
593 | +?> ><?php echo _("Display ground station on map"); ?></label></div></li> |
|
594 | + <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))) { |
|
595 | + print 'checked'; |
|
596 | +} |
|
597 | +?> ><?php echo _("Display weather station on map"); ?></label></div></li> |
|
598 | + <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))) { |
|
599 | + print 'checked'; |
|
600 | +} |
|
601 | +?> ><?php echo _("Display lightning on map"); ?></label></div></li> |
|
391 | 602 | <?php |
392 | 603 | if (isset($globalFires)) { |
393 | 604 | ?> |
394 | - <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> |
|
605 | + <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))) { |
|
606 | + print 'checked'; |
|
607 | +} |
|
608 | +?> ><?php echo _("Display fires on map"); ?></label></div></li> |
|
395 | 609 | <?php |
396 | 610 | } |
397 | 611 | if (isset($globalMap3D) && $globalMap3D) { |
398 | 612 | ?> |
399 | - <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> |
|
613 | + <li><div class="checkbox"><label><input type="checkbox" name="singlemodel" value="1" onclick="clickSingleModel(this)" <?php if (isset($_COOKIE['singlemodel']) && $_COOKIE['singlemodel'] == 'true') { |
|
614 | + print 'checked'; |
|
615 | +} |
|
616 | +?> ><?php echo _("Only display selected flight on 3D mode"); ?></label></div></li> |
|
400 | 617 | <?php |
401 | 618 | } |
402 | 619 | ?> |
403 | 620 | <?php |
404 | 621 | if (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d') { |
405 | 622 | ?> |
406 | - <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> |
|
407 | - <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> |
|
623 | + <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')) { |
|
624 | + print 'checked'; |
|
625 | +} |
|
626 | +?> ><?php echo _("Show mini-map"); ?></label></div></li> |
|
627 | + <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)) { |
|
628 | + print 'checked'; |
|
629 | +} |
|
630 | +?> ><?php echo _("Use same 3D model for all aircraft (use fewer resources)"); ?></label></div></li> |
|
408 | 631 | <?php |
409 | 632 | } |
410 | 633 | if (time() > mktime(0,0,0,12,1,date("Y")) && time() < mktime(0,0,0,12,31,date("Y"))) { |
@@ -417,17 +640,25 @@ discard block |
||
417 | 640 | if (function_exists('array_column')) { |
418 | 641 | if (array_search(TRUE, array_column($globalSources, 'sourcestats')) !== FALSE) { |
419 | 642 | ?> |
420 | - <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> |
|
643 | + <li><div class="checkbox"><label><input type="checkbox" name="flightpolar" value="1" onclick="clickPolar(this)" <?php if ((isset($_COOKIE['polar']) && $_COOKIE['polar'] == 'true')) { |
|
644 | + print 'checked'; |
|
645 | +} |
|
646 | +?> ><?php echo _("Display polar on map"); ?></label></div></li> |
|
421 | 647 | <?php |
422 | 648 | } |
423 | 649 | } elseif (isset($globalSources)) { |
424 | 650 | $dispolar = false; |
425 | 651 | foreach ($globalSources as $testsource) { |
426 | - if (isset($globalSources['sourcestats']) && $globalSources['sourcestats'] !== FALSE) $dispolar = true; |
|
652 | + if (isset($globalSources['sourcestats']) && $globalSources['sourcestats'] !== FALSE) { |
|
653 | + $dispolar = true; |
|
654 | + } |
|
427 | 655 | } |
428 | 656 | if ($dispolar) { |
429 | 657 | ?> |
430 | - <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> |
|
658 | + <li><div class="checkbox"><label><input type="checkbox" name="flightpolar" value="1" onclick="clickPolar(this)" <?php if ((isset($_COOKIE['polar']) && $_COOKIE['polar'] == 'true')) { |
|
659 | + print 'checked'; |
|
660 | +} |
|
661 | +?> ><?php echo _("Display polar on map"); ?></label></div></li> |
|
431 | 662 | <?php |
432 | 663 | } |
433 | 664 | } |
@@ -440,12 +671,22 @@ discard block |
||
440 | 671 | if (!isset($globalAircraft) || $globalAircraft === TRUE) { |
441 | 672 | if (extension_loaded('gd') && function_exists('gd_info')) { |
442 | 673 | ?> |
443 | - <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> |
|
674 | + <li><input type="checkbox" name="aircraftcoloraltitude" value="1" onclick="iconColorAltitude(this)" <?php if (isset($_COOKIE['IconColorAltitude']) && $_COOKIE['IconColorAltitude'] == 'true') { |
|
675 | + print 'checked'; |
|
676 | +} |
|
677 | +?> ><?php echo _("Aircraft icon color based on altitude"); ?></li> |
|
444 | 678 | <?php |
445 | 679 | if (!isset($_COOKIE['IconColorAltitude']) || $_COOKIE['IconColorAltitude'] == 'false') { |
446 | 680 | ?> |
447 | 681 | <li><?php echo _("Aircraft icon color:"); ?> |
448 | - <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'; ?>"> |
|
682 | + <input type="color" name="aircraftcolor" id="html5colorpicker" onchange="iconColor(aircraftcolor.value);" value="#<?php if (isset($_COOKIE['IconColor'])) { |
|
683 | + print $_COOKIE['IconColor']; |
|
684 | +} elseif (isset($globalAircraftIconColor)) { |
|
685 | + print $globalAircraftIconColor; |
|
686 | +} else { |
|
687 | + print '1a3151'; |
|
688 | +} |
|
689 | +?>"> |
|
449 | 690 | </li> |
450 | 691 | <?php |
451 | 692 | } |
@@ -457,7 +698,14 @@ discard block |
||
457 | 698 | if (extension_loaded('gd') && function_exists('gd_info')) { |
458 | 699 | ?> |
459 | 700 | <li><?php echo _("Marine icon color:"); ?> |
460 | - <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'; ?>"> |
|
701 | + <input type="color" name="marinecolor" id="html5colorpicker" onchange="MarineiconColor(marinecolor.value);" value="#<?php if (isset($_COOKIE['MarineIconColor'])) { |
|
702 | + print $_COOKIE['MarineIconColor']; |
|
703 | +} elseif (isset($globalMarineIconColor)) { |
|
704 | + print $globalMarineIconColor; |
|
705 | +} else { |
|
706 | + print '1a3151'; |
|
707 | +} |
|
708 | +?>"> |
|
461 | 709 | </li> |
462 | 710 | <?php |
463 | 711 | } |
@@ -468,7 +716,14 @@ discard block |
||
468 | 716 | if (extension_loaded('gd') && function_exists('gd_info')) { |
469 | 717 | ?> |
470 | 718 | <li><?php echo _("Tracker icon color:"); ?> |
471 | - <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'; ?>"> |
|
719 | + <input type="color" name="trackercolor" id="html5colorpicker" onchange="TrackericonColor(trackercolor.value);" value="#<?php if (isset($_COOKIE['TrackerIconColor'])) { |
|
720 | + print $_COOKIE['TrackerIconColor']; |
|
721 | +} elseif (isset($globalTrackerIconColor)) { |
|
722 | + print $globalTrackerIconColor; |
|
723 | +} else { |
|
724 | + print '1a3151'; |
|
725 | +} |
|
726 | +?>"> |
|
472 | 727 | </li> |
473 | 728 | <?php |
474 | 729 | } |
@@ -479,8 +734,22 @@ discard block |
||
479 | 734 | ?> |
480 | 735 | <li><?php echo _("Show airport icon at zoom level:"); ?> |
481 | 736 | <div class="range"> |
482 | - <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'; ?>"> |
|
483 | - <output id="range"><?php if (isset($_COOKIE['AirportZoom'])) print $_COOKIE['AirportZoom']; elseif (isset($globalAirportZoom)) print $globalAirportZoom; else print '7'; ?></output> |
|
737 | + <input type="range" min="0" max="19" step="1" name="airportzoom" onchange="range.value=value;airportDisplayZoom(airportzoom.value);" value="<?php if (isset($_COOKIE['AirportZoom'])) { |
|
738 | + print $_COOKIE['AirportZoom']; |
|
739 | +} elseif (isset($globalAirportZoom)) { |
|
740 | + print $globalAirportZoom; |
|
741 | +} else { |
|
742 | + print '7'; |
|
743 | +} |
|
744 | +?>"> |
|
745 | + <output id="range"><?php if (isset($_COOKIE['AirportZoom'])) { |
|
746 | + print $_COOKIE['AirportZoom']; |
|
747 | +} elseif (isset($globalAirportZoom)) { |
|
748 | + print $globalAirportZoom; |
|
749 | +} else { |
|
750 | + print '7'; |
|
751 | +} |
|
752 | +?></output> |
|
484 | 753 | </div> |
485 | 754 | </li> |
486 | 755 | <?php |
@@ -492,10 +761,23 @@ discard block |
||
492 | 761 | <?php |
493 | 762 | if (!isset($globalAircraft) || $globalAircraft === TRUE) { |
494 | 763 | ?> |
495 | - <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> |
|
496 | - <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"); ?></li> |
|
764 | + <li><input type="checkbox" name="useliveries" value="1" onclick="useLiveries(this)" <?php if (isset($_COOKIE['UseLiveries']) && $_COOKIE['UseLiveries'] == 'true') { |
|
765 | + print 'checked'; |
|
766 | +} |
|
767 | +?> ><?php echo _("Use airlines liveries"); ?></li> |
|
768 | + <li><input type="checkbox" name="aircraftcolorforce" value="1" onclick="iconColorForce(this)" <?php if (isset($_COOKIE['IconColorForce']) && $_COOKIE['IconColorForce'] == 'true') { |
|
769 | + print 'checked'; |
|
770 | +} |
|
771 | +?> ><?php echo _("Force Aircraft color"); ?></li> |
|
497 | 772 | <li><?php echo _("Aircraft icon color:"); ?> |
498 | - <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'; ?>"> |
|
773 | + <input type="color" name="aircraftcolor" id="html5colorpicker" onchange="iconColor(aircraftcolor.value);" value="#<?php if (isset($_COOKIE['IconColor'])) { |
|
774 | + print $_COOKIE['IconColor']; |
|
775 | +} elseif (isset($globalAircraftIconColor)) { |
|
776 | + print $globalAircraftIconColor; |
|
777 | +} else { |
|
778 | + print 'ff0000'; |
|
779 | +} |
|
780 | +?>"> |
|
499 | 781 | </li> |
500 | 782 | <?php |
501 | 783 | } |
@@ -503,9 +785,19 @@ discard block |
||
503 | 785 | <?php |
504 | 786 | if (isset($globalMarine) && $globalMarine === TRUE) { |
505 | 787 | ?> |
506 | - <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"); ?></li> |
|
788 | + <li><input type="checkbox" name="marinecolorforce" value="1" onclick="MarineiconColorForce(this)" <?php if (isset($_COOKIE['MarineIconColorForce']) && $_COOKIE['MarineIconColorForce'] == 'true') { |
|
789 | + print 'checked'; |
|
790 | +} |
|
791 | +?> ><?php echo _("Force Marine color"); ?></li> |
|
507 | 792 | <li><?php echo _("Marine icon color:"); ?> |
508 | - <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'; ?>"> |
|
793 | + <input type="color" name="marinecolor" id="html5colorpicker" onchange="MarineiconColor(marinecolor.value);" value="#<?php if (isset($_COOKIE['MarineIconColor'])) { |
|
794 | + print $_COOKIE['MarineIconColor']; |
|
795 | +} elseif (isset($globalMarineIconColor)) { |
|
796 | + print $globalMarineIconColor; |
|
797 | +} else { |
|
798 | + print 'ff0000'; |
|
799 | +} |
|
800 | +?>"> |
|
509 | 801 | </li> |
510 | 802 | <?php |
511 | 803 | } |
@@ -513,9 +805,19 @@ discard block |
||
513 | 805 | <?php |
514 | 806 | if (isset($globalTracker) && $globalTracker === TRUE) { |
515 | 807 | ?> |
516 | - <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"); ?></li> |
|
808 | + <li><input type="checkbox" name="trackercolorforce" value="1" onclick="TrackericonColorForce(this)" <?php if (isset($_COOKIE['TrackerIconColorForce']) && $_COOKIE['TrackerIconColorForce'] == 'true') { |
|
809 | + print 'checked'; |
|
810 | +} |
|
811 | +?> ><?php echo _("Force Tracker color"); ?></li> |
|
517 | 812 | <li><?php echo _("Tracker icon color:"); ?> |
518 | - <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'; ?>"> |
|
813 | + <input type="color" name="trackercolor" id="html5colorpicker" onchange="TrackericonColor(trackercolor.value);" value="#<?php if (isset($_COOKIE['TrackerIconColor'])) { |
|
814 | + print $_COOKIE['TrackerIconColor']; |
|
815 | +} elseif (isset($globalTrackerIconColor)) { |
|
816 | + print $globalTrackerIconColor; |
|
817 | +} else { |
|
818 | + print 'ff0000'; |
|
819 | +} |
|
820 | +?>"> |
|
519 | 821 | </li> |
520 | 822 | <?php |
521 | 823 | } |
@@ -523,22 +825,46 @@ discard block |
||
523 | 825 | ?> |
524 | 826 | <li><?php echo _("Distance unit:"); ?> |
525 | 827 | <select class="selectpicker" onchange="unitdistance(this);"> |
526 | - <option value="km"<?php if ((!isset($_COOKIE['unitdistance']) && (!isset($globalUnitDistance) || (isset($globalUnitDistance) && $globalUnitDistance == 'km'))) || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'km')) echo ' selected'; ?>>km</option> |
|
527 | - <option value="nm"<?php if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'nm') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'nm')) echo ' selected'; ?>>nm</option> |
|
528 | - <option value="mi"<?php if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'mi') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'mi')) echo ' selected'; ?>>mi</option> |
|
828 | + <option value="km"<?php if ((!isset($_COOKIE['unitdistance']) && (!isset($globalUnitDistance) || (isset($globalUnitDistance) && $globalUnitDistance == 'km'))) || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'km')) { |
|
829 | + echo ' selected'; |
|
830 | +} |
|
831 | +?>>km</option> |
|
832 | + <option value="nm"<?php if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'nm') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'nm')) { |
|
833 | + echo ' selected'; |
|
834 | +} |
|
835 | +?>>nm</option> |
|
836 | + <option value="mi"<?php if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'mi') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'mi')) { |
|
837 | + echo ' selected'; |
|
838 | +} |
|
839 | +?>>mi</option> |
|
529 | 840 | </select> |
530 | 841 | </li> |
531 | 842 | <li><?php echo _("Altitude unit:"); ?> |
532 | 843 | <select class="selectpicker" onchange="unitaltitude(this);"> |
533 | - <option value="m"<?php if ((!isset($_COOKIE['unitaltitude']) && (!isset($globalUnitAltitude) || (isset($globalUnitAltitude) && $globalUnitAltitude == 'm'))) || (isset($_COOKIE['unitaltitude']) && $_COOKIE['unitaltitude'] == 'm')) echo ' selected'; ?>>m</option> |
|
534 | - <option value="feet"<?php if ((!isset($_COOKIE['unitaltitude']) && isset($globalUnitAltitude) && $globalUnitAltitude == 'feet') || (isset($_COOKIE['unitaltitude']) && $_COOKIE['unitaltitude'] == 'feet')) echo ' selected'; ?>>feet</option> |
|
844 | + <option value="m"<?php if ((!isset($_COOKIE['unitaltitude']) && (!isset($globalUnitAltitude) || (isset($globalUnitAltitude) && $globalUnitAltitude == 'm'))) || (isset($_COOKIE['unitaltitude']) && $_COOKIE['unitaltitude'] == 'm')) { |
|
845 | + echo ' selected'; |
|
846 | +} |
|
847 | +?>>m</option> |
|
848 | + <option value="feet"<?php if ((!isset($_COOKIE['unitaltitude']) && isset($globalUnitAltitude) && $globalUnitAltitude == 'feet') || (isset($_COOKIE['unitaltitude']) && $_COOKIE['unitaltitude'] == 'feet')) { |
|
849 | + echo ' selected'; |
|
850 | +} |
|
851 | +?>>feet</option> |
|
535 | 852 | </select> |
536 | 853 | </li> |
537 | 854 | <li><?php echo _("Speed unit:"); ?> |
538 | 855 | <select class="selectpicker" onchange="unitspeed(this);"> |
539 | - <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> |
|
540 | - <option value="mph"<?php if ((!isset($_COOKIE['unitspeed']) && isset($globalUnitSpeed) && $globalUnitSpeed == 'mph') || (isset($_COOKIE['unitspeed']) && $_COOKIE['unitspeed'] == 'mph')) echo ' selected'; ?>>mph</option> |
|
541 | - <option value="knots"<?php if ((!isset($_COOKIE['unitspeed']) && isset($globalUnitSpeed) && $globalUnitSpeed == 'knots') || (isset($_COOKIE['unitspeed']) && $_COOKIE['unitspeed'] == 'knots')) echo ' selected'; ?>>knots</option> |
|
856 | + <option value="kmh"<?php if ((!isset($_COOKIE['unitspeed']) && (!isset($globalUnitSpeed) || (isset($globalUnitSpeed) && $globalUnitSpeed == 'kmh'))) || (isset($_COOKIE['unitspeed']) && $_COOKIE['unitspeed'] == 'kmh')) { |
|
857 | + echo ' selected'; |
|
858 | +} |
|
859 | +?>>km/h</option> |
|
860 | + <option value="mph"<?php if ((!isset($_COOKIE['unitspeed']) && isset($globalUnitSpeed) && $globalUnitSpeed == 'mph') || (isset($_COOKIE['unitspeed']) && $_COOKIE['unitspeed'] == 'mph')) { |
|
861 | + echo ' selected'; |
|
862 | +} |
|
863 | +?>>mph</option> |
|
864 | + <option value="knots"<?php if ((!isset($_COOKIE['unitspeed']) && isset($globalUnitSpeed) && $globalUnitSpeed == 'knots') || (isset($_COOKIE['unitspeed']) && $_COOKIE['unitspeed'] == 'knots')) { |
|
865 | + echo ' selected'; |
|
866 | +} |
|
867 | +?>>knots</option> |
|
542 | 868 | </select> |
543 | 869 | </li> |
544 | 870 | |
@@ -556,9 +882,18 @@ discard block |
||
556 | 882 | <?php |
557 | 883 | if (((isset($globalVATSIM) && $globalVATSIM) || isset($globalIVAO) && $globalIVAO || isset($globalphpVMS) && $globalphpVMS) && (!isset($globalMapVAchoose) || $globalMapVAchoose)) { |
558 | 884 | ?> |
559 | - <?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 } ?> |
|
560 | - <?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 } ?> |
|
561 | - <?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 } ?> |
|
885 | + <?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'])) { |
|
886 | + print 'checked'; |
|
887 | +} |
|
888 | +?> ><?php echo _("Display VATSIM data"); ?></li><?php } ?> |
|
889 | + <?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'])) { |
|
890 | + print 'checked'; |
|
891 | +} |
|
892 | +?> ><?php echo _("Display IVAO data"); ?></li><?php } ?> |
|
893 | + <?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'])) { |
|
894 | + print 'checked'; |
|
895 | +} |
|
896 | +?> ><?php echo _("Display phpVMS data"); ?></li><?php } ?> |
|
562 | 897 | <?php |
563 | 898 | } |
564 | 899 | ?> |
@@ -566,10 +901,16 @@ discard block |
||
566 | 901 | if (!(isset($globalVA) && $globalVA) && !(isset($globalVATSIM) && $globalVATSIM) && !(isset($globalIVAO) && $globalIVAO) && !(isset($globalphpVMS) && $globalphpVMS) && isset($globalSBS1) && $globalSBS1 && isset($globalAPRS) && $globalAPRS && (!isset($globalMapchoose) || $globalMapchoose)) { |
567 | 902 | ?> |
568 | 903 | <?php if (isset($globalSBS1) && $globalSBS1) { ?> |
569 | - <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> |
|
904 | + <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'])) { |
|
905 | + print 'checked'; |
|
906 | +} |
|
907 | +?> ><?php echo _("Display ADS-B data"); ?></label></div></li> |
|
570 | 908 | <?php } ?> |
571 | 909 | <?php if (isset($globalAPRS) && $globalAPRS) { ?> |
572 | - <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> |
|
910 | + <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'])) { |
|
911 | + print 'checked'; |
|
912 | +} |
|
913 | +?> ><?php echo _("Display APRS data"); ?></label></div></li> |
|
573 | 914 | <?php } ?> |
574 | 915 | <?php |
575 | 916 | } |
@@ -586,7 +927,9 @@ discard block |
||
586 | 927 | } |
587 | 928 | foreach($allairlinenames as $airline) { |
588 | 929 | $airline_name = $airline['airline_name']; |
589 | - if (strlen($airline_name) > 30) $airline_name = substr($airline_name,0,30).'...'; |
|
930 | + if (strlen($airline_name) > 30) { |
|
931 | + $airline_name = substr($airline_name,0,30).'...'; |
|
932 | + } |
|
590 | 933 | if (isset($_COOKIE['filter_Airlines']) && in_array($airline['airline_icao'],explode(',',$_COOKIE['filter_Airlines']))) { |
591 | 934 | echo '<option value="'.$airline['airline_icao'].'" selected>'.$airline_name.'</option>'; |
592 | 935 | } else { |
@@ -604,7 +947,10 @@ discard block |
||
604 | 947 | <li><?php echo _("Display alliance:"); ?> |
605 | 948 | <br/> |
606 | 949 | <select class="selectpicker" onchange="alliance(this);" id="display_alliance"> |
607 | - <option value="all"<?php if (!isset($_COOKIE['filter_alliance']) || $_COOKIE['filter_alliance'] == 'all' || $_COOKIE['filter_alliance'] == '') echo ' selected'; ?>><?php echo _("All"); ?></option> |
|
950 | + <option value="all"<?php if (!isset($_COOKIE['filter_alliance']) || $_COOKIE['filter_alliance'] == 'all' || $_COOKIE['filter_alliance'] == '') { |
|
951 | + echo ' selected'; |
|
952 | +} |
|
953 | +?>><?php echo _("All"); ?></option> |
|
608 | 954 | <?php |
609 | 955 | foreach($allalliancenames as $alliance) { |
610 | 956 | $alliance_name = $alliance['alliance']; |
@@ -663,10 +1009,22 @@ discard block |
||
663 | 1009 | ?> |
664 | 1010 | <li><?php echo _("Display airlines of type:"); ?><br/> |
665 | 1011 | <select class="selectpicker" onchange="airlinestype(this);"> |
666 | - <option value="all"<?php if (!isset($_COOKIE['filter_airlinestype']) || $_COOKIE['filter_airlinestype'] == 'all' || $_COOKIE['filter_airlinestype'] == '') echo ' selected'; ?>><?php echo _("All"); ?></option> |
|
667 | - <option value="passenger"<?php if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] == 'passenger') echo ' selected'; ?>><?php echo _("Passenger"); ?></option> |
|
668 | - <option value="cargo"<?php if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] == 'cargo') echo ' selected'; ?>><?php echo _("Cargo"); ?></option> |
|
669 | - <option value="military"<?php if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] == 'military') echo ' selected'; ?>><?php echo _("Military"); ?></option> |
|
1012 | + <option value="all"<?php if (!isset($_COOKIE['filter_airlinestype']) || $_COOKIE['filter_airlinestype'] == 'all' || $_COOKIE['filter_airlinestype'] == '') { |
|
1013 | + echo ' selected'; |
|
1014 | +} |
|
1015 | +?>><?php echo _("All"); ?></option> |
|
1016 | + <option value="passenger"<?php if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] == 'passenger') { |
|
1017 | + echo ' selected'; |
|
1018 | +} |
|
1019 | +?>><?php echo _("Passenger"); ?></option> |
|
1020 | + <option value="cargo"<?php if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] == 'cargo') { |
|
1021 | + echo ' selected'; |
|
1022 | +} |
|
1023 | +?>><?php echo _("Cargo"); ?></option> |
|
1024 | + <option value="military"<?php if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] == 'military') { |
|
1025 | + echo ' selected'; |
|
1026 | +} |
|
1027 | +?>><?php echo _("Military"); ?></option> |
|
670 | 1028 | </select> |
671 | 1029 | </li> |
672 | 1030 | <?php |
@@ -680,14 +1038,20 @@ discard block |
||
680 | 1038 | ?> |
681 | 1039 | <li> |
682 | 1040 | <?php echo _("Display vessels with MMSI:"); ?> |
683 | - <input type="text" name="mmsifilter" onchange="mmsifilter();" id="mmsifilter" value="<?php if (isset($_COOKIE['filter_mmsi'])) print $_COOKIE['filter_mmsi']; ?>" /> |
|
1041 | + <input type="text" name="mmsifilter" onchange="mmsifilter();" id="mmsifilter" value="<?php if (isset($_COOKIE['filter_mmsi'])) { |
|
1042 | + print $_COOKIE['filter_mmsi']; |
|
1043 | +} |
|
1044 | +?>" /> |
|
684 | 1045 | </li> |
685 | 1046 | <?php |
686 | 1047 | } |
687 | 1048 | ?> |
688 | 1049 | <li> |
689 | 1050 | <?php echo _("Display with ident:"); ?> |
690 | - <input type="text" name="identfilter" onchange="identfilter();" id="identfilter" value="<?php if (isset($_COOKIE['filter_ident'])) print $_COOKIE['filter_ident']; ?>" /> |
|
1051 | + <input type="text" name="identfilter" onchange="identfilter();" id="identfilter" value="<?php if (isset($_COOKIE['filter_ident'])) { |
|
1052 | + print $_COOKIE['filter_ident']; |
|
1053 | +} |
|
1054 | +?>" /> |
|
691 | 1055 | </li> |
692 | 1056 | </ul> |
693 | 1057 | </form> |
@@ -703,7 +1067,10 @@ discard block |
||
703 | 1067 | <h1 class="sidebar-header"><?php echo _("Satellites"); ?><span class="sidebar-close"><i class="fa fa-caret-left"></i></span></h1> |
704 | 1068 | <form> |
705 | 1069 | <ul> |
706 | - <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> |
|
1070 | + <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'])) { |
|
1071 | + print 'checked'; |
|
1072 | +} |
|
1073 | +?> ><?php echo _("Show ISS, Tiangong-1 and Tiangong-2 on map"); ?></label></div></li> |
|
707 | 1074 | <li><?php echo _("Type:"); ?> |
708 | 1075 | <select class="selectpicker" multiple onchange="sattypes(this);"> |
709 | 1076 | <?php |
@@ -711,25 +1078,45 @@ discard block |
||
711 | 1078 | $types = $Satellite->get_tle_types(); |
712 | 1079 | foreach ($types as $type) { |
713 | 1080 | $type_name = $type['tle_type']; |
714 | - if ($type_name == 'musson') $type_name = 'Russian LEO Navigation'; |
|
715 | - else if ($type_name == 'nnss') $type_name = 'Navi Navigation Satellite System'; |
|
716 | - else if ($type_name == 'sbas') $type_name = 'Satellite-Based Augmentation System'; |
|
717 | - else if ($type_name == 'glo-ops') $type_name = 'Glonass Operational'; |
|
718 | - else if ($type_name == 'gps-ops') $type_name = 'GPS Operational'; |
|
719 | - else if ($type_name == 'argos') $type_name = 'ARGOS Data Collection System'; |
|
720 | - else if ($type_name == 'tdrss') $type_name = 'Tracking and Data Relay Satellite System'; |
|
721 | - else if ($type_name == 'sarsat') $type_name = 'Search & Rescue'; |
|
722 | - else if ($type_name == 'dmc') $type_name = 'Disaster Monitoring'; |
|
723 | - else if ($type_name == 'resource') $type_name = 'Earth Resources'; |
|
724 | - else if ($type_name == 'stations') $type_name = 'Space Stations'; |
|
725 | - else if ($type_name == 'geo') $type_name = 'Geostationary'; |
|
726 | - else if ($type_name == 'amateur') $type_name = 'Amateur Radio'; |
|
727 | - else if ($type_name == 'x-comm') $type_name = 'Experimental'; |
|
728 | - else if ($type_name == 'other-comm') $type_name = 'Other Comm'; |
|
729 | - else if ($type_name == 'science') $type_name = 'Space & Earth Science'; |
|
730 | - else if ($type_name == 'military') $type_name = 'Miscellaneous Military'; |
|
731 | - else if ($type_name == 'radar') $type_name = 'Radar Calibration'; |
|
732 | - else if ($type_name == 'tle-new') $type_name = 'Last 30 days launches'; |
|
1081 | + if ($type_name == 'musson') { |
|
1082 | + $type_name = 'Russian LEO Navigation'; |
|
1083 | + } else if ($type_name == 'nnss') { |
|
1084 | + $type_name = 'Navi Navigation Satellite System'; |
|
1085 | + } else if ($type_name == 'sbas') { |
|
1086 | + $type_name = 'Satellite-Based Augmentation System'; |
|
1087 | + } else if ($type_name == 'glo-ops') { |
|
1088 | + $type_name = 'Glonass Operational'; |
|
1089 | + } else if ($type_name == 'gps-ops') { |
|
1090 | + $type_name = 'GPS Operational'; |
|
1091 | + } else if ($type_name == 'argos') { |
|
1092 | + $type_name = 'ARGOS Data Collection System'; |
|
1093 | + } else if ($type_name == 'tdrss') { |
|
1094 | + $type_name = 'Tracking and Data Relay Satellite System'; |
|
1095 | + } else if ($type_name == 'sarsat') { |
|
1096 | + $type_name = 'Search & Rescue'; |
|
1097 | + } else if ($type_name == 'dmc') { |
|
1098 | + $type_name = 'Disaster Monitoring'; |
|
1099 | + } else if ($type_name == 'resource') { |
|
1100 | + $type_name = 'Earth Resources'; |
|
1101 | + } else if ($type_name == 'stations') { |
|
1102 | + $type_name = 'Space Stations'; |
|
1103 | + } else if ($type_name == 'geo') { |
|
1104 | + $type_name = 'Geostationary'; |
|
1105 | + } else if ($type_name == 'amateur') { |
|
1106 | + $type_name = 'Amateur Radio'; |
|
1107 | + } else if ($type_name == 'x-comm') { |
|
1108 | + $type_name = 'Experimental'; |
|
1109 | + } else if ($type_name == 'other-comm') { |
|
1110 | + $type_name = 'Other Comm'; |
|
1111 | + } else if ($type_name == 'science') { |
|
1112 | + $type_name = 'Space & Earth Science'; |
|
1113 | + } else if ($type_name == 'military') { |
|
1114 | + $type_name = 'Miscellaneous Military'; |
|
1115 | + } else if ($type_name == 'radar') { |
|
1116 | + $type_name = 'Radar Calibration'; |
|
1117 | + } else if ($type_name == 'tle-new') { |
|
1118 | + $type_name = 'Last 30 days launches'; |
|
1119 | + } |
|
733 | 1120 | |
734 | 1121 | if (isset($_COOKIE['sattypes']) && in_array($type['tle_type'],explode(',',$_COOKIE['sattypes']))) { |
735 | 1122 | print '<option value="'.$type['tle_type'].'" selected>'.$type_name.'</option>'; |