@@ -16,20 +16,20 @@ discard block |
||
16 | 16 | require_once(dirname(__FILE__).'/class.Source.php'); |
17 | 17 | require_once(dirname(__FILE__).'/class.GeoidHeight.php'); |
18 | 18 | if (isset($globalServerAPRS) && $globalServerAPRS) { |
19 | - require_once(dirname(__FILE__).'/class.APRS.php'); |
|
19 | + require_once(dirname(__FILE__).'/class.APRS.php'); |
|
20 | 20 | } |
21 | 21 | |
22 | 22 | class SpotterImport { |
23 | - private $all_flights = array(); |
|
24 | - private $last_delete_hourly = 0; |
|
25 | - private $last_delete = 0; |
|
26 | - private $stats = array(); |
|
27 | - private $tmd = 0; |
|
28 | - private $source_location = array(); |
|
29 | - public $db = null; |
|
30 | - public $nb = 0; |
|
23 | + private $all_flights = array(); |
|
24 | + private $last_delete_hourly = 0; |
|
25 | + private $last_delete = 0; |
|
26 | + private $stats = array(); |
|
27 | + private $tmd = 0; |
|
28 | + private $source_location = array(); |
|
29 | + public $db = null; |
|
30 | + public $nb = 0; |
|
31 | 31 | |
32 | - public function __construct($dbc = null) { |
|
32 | + public function __construct($dbc = null) { |
|
33 | 33 | global $globalBeta, $globalServerAPRS, $APRSSpotter, $globalNoDB, $GeoidClass, $globalDebug, $globalGeoid; |
34 | 34 | if (!(isset($globalNoDB) && $globalNoDB)) { |
35 | 35 | $Connection = new Connection($dbc); |
@@ -41,14 +41,14 @@ discard block |
||
41 | 41 | $currentdate = date('Y-m-d'); |
42 | 42 | $sourcestat = $Stats->getStatsSource($currentdate); |
43 | 43 | if (!empty($sourcestat)) { |
44 | - foreach($sourcestat as $srcst) { |
|
45 | - $type = $srcst['stats_type']; |
|
44 | + foreach($sourcestat as $srcst) { |
|
45 | + $type = $srcst['stats_type']; |
|
46 | 46 | if ($type == 'polar' || $type == 'hist') { |
47 | - $source = $srcst['source_name']; |
|
48 | - $data = $srcst['source_data']; |
|
49 | - $this->stats[$currentdate][$source][$type] = json_decode($data,true); |
|
50 | - } |
|
51 | - } |
|
47 | + $source = $srcst['source_name']; |
|
48 | + $data = $srcst['source_data']; |
|
49 | + $this->stats[$currentdate][$source][$type] = json_decode($data,true); |
|
50 | + } |
|
51 | + } |
|
52 | 52 | } |
53 | 53 | } |
54 | 54 | if (isset($globalServerAPRS) && $globalServerAPRS) { |
@@ -63,9 +63,9 @@ discard block |
||
63 | 63 | $GeoidClass = FALSE; |
64 | 64 | } |
65 | 65 | } |
66 | - } |
|
66 | + } |
|
67 | 67 | |
68 | - public function get_Schedule($id,$ident) { |
|
68 | + public function get_Schedule($id,$ident) { |
|
69 | 69 | global $globalDebug, $globalFork, $globalSchedulesFetch; |
70 | 70 | // Get schedule here, so it's done only one time |
71 | 71 | |
@@ -85,43 +85,43 @@ discard block |
||
85 | 85 | $operator = $Spotter->getOperator($ident); |
86 | 86 | $scheduleexist = false; |
87 | 87 | if ($Schedule->checkSchedule($operator) == 0) { |
88 | - $operator = $Translation->checkTranslation($ident); |
|
89 | - if ($Schedule->checkSchedule($operator) == 0) { |
|
88 | + $operator = $Translation->checkTranslation($ident); |
|
89 | + if ($Schedule->checkSchedule($operator) == 0) { |
|
90 | 90 | $schedule = $Schedule->fetchSchedule($operator); |
91 | 91 | if (count($schedule) > 0 && isset($schedule['DepartureTime']) && isset($schedule['ArrivalTime'])) { |
92 | - if ($globalDebug) echo "-> Schedule info for ".$operator." (".$ident.")\n"; |
|
93 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('departure_airport_time' => $schedule['DepartureTime'])); |
|
94 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('arrival_airport_time' => $schedule['ArrivalTime'])); |
|
95 | - // Should also check if route schedule = route from DB |
|
96 | - if ($schedule['DepartureAirportIATA'] != '') { |
|
92 | + if ($globalDebug) echo "-> Schedule info for ".$operator." (".$ident.")\n"; |
|
93 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('departure_airport_time' => $schedule['DepartureTime'])); |
|
94 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('arrival_airport_time' => $schedule['ArrivalTime'])); |
|
95 | + // Should also check if route schedule = route from DB |
|
96 | + if ($schedule['DepartureAirportIATA'] != '') { |
|
97 | 97 | if ($this->all_flights[$id]['departure_airport'] != $Spotter->getAirportIcao($schedule['DepartureAirportIATA'])) { |
98 | - $airport_icao = $Spotter->getAirportIcao($schedule['DepartureAirportIATA']); |
|
99 | - if (trim($airport_icao) != '') { |
|
98 | + $airport_icao = $Spotter->getAirportIcao($schedule['DepartureAirportIATA']); |
|
99 | + if (trim($airport_icao) != '') { |
|
100 | 100 | $this->all_flights[$id]['departure_airport'] = $airport_icao; |
101 | 101 | if ($globalDebug) echo "-> Change departure airport to ".$airport_icao." for ".$ident."\n"; |
102 | - } |
|
102 | + } |
|
103 | + } |
|
103 | 104 | } |
104 | - } |
|
105 | - if ($schedule['ArrivalAirportIATA'] != '') { |
|
105 | + if ($schedule['ArrivalAirportIATA'] != '') { |
|
106 | 106 | if ($this->all_flights[$id]['arrival_airport'] != $Spotter->getAirportIcao($schedule['ArrivalAirportIATA'])) { |
107 | - $airport_icao = $Spotter->getAirportIcao($schedule['ArrivalAirportIATA']); |
|
108 | - if (trim($airport_icao) != '') { |
|
107 | + $airport_icao = $Spotter->getAirportIcao($schedule['ArrivalAirportIATA']); |
|
108 | + if (trim($airport_icao) != '') { |
|
109 | 109 | $this->all_flights[$id]['arrival_airport'] = $airport_icao; |
110 | 110 | if ($globalDebug) echo "-> Change arrival airport to ".$airport_icao." for ".$ident."\n"; |
111 | - } |
|
111 | + } |
|
112 | 112 | } |
113 | - } |
|
114 | - $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']); |
|
113 | + } |
|
114 | + $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']); |
|
115 | 115 | } |
116 | - } else $scheduleexist = true; |
|
116 | + } else $scheduleexist = true; |
|
117 | 117 | } else $scheduleexist = true; |
118 | 118 | // close connection, at least one way will work ? |
119 | - if ($scheduleexist) { |
|
119 | + if ($scheduleexist) { |
|
120 | 120 | if ($globalDebug) echo "-> get arrival/departure airport info for ".$ident."\n"; |
121 | - $sch = $Schedule->getSchedule($operator); |
|
121 | + $sch = $Schedule->getSchedule($operator); |
|
122 | 122 | $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'])); |
123 | 123 | 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']); |
124 | - } |
|
124 | + } |
|
125 | 125 | $Spotter->db = null; |
126 | 126 | $Schedule->db = null; |
127 | 127 | $Translation->db = null; |
@@ -136,65 +136,65 @@ discard block |
||
136 | 136 | } |
137 | 137 | */ |
138 | 138 | } |
139 | - } |
|
139 | + } |
|
140 | 140 | |
141 | - public function checkAll() { |
|
141 | + public function checkAll() { |
|
142 | 142 | global $globalDebug, $globalNoImport; |
143 | 143 | if ($globalDebug) echo "Update last seen flights data...\n"; |
144 | 144 | if (!isset($globalNoImport) || $globalNoImport === FALSE) { |
145 | - foreach ($this->all_flights as $key => $flight) { |
|
145 | + foreach ($this->all_flights as $key => $flight) { |
|
146 | 146 | if (isset($this->all_flights[$key]['id'])) { |
147 | - //echo $this->all_flights[$key]['id'].' - '.$this->all_flights[$key]['latitude'].' '.$this->all_flights[$key]['longitude']."\n"; |
|
148 | - $Spotter = new Spotter($this->db); |
|
149 | - $real_arrival = $this->arrival($key); |
|
150 | - 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']); |
|
151 | - } |
|
152 | - } |
|
147 | + //echo $this->all_flights[$key]['id'].' - '.$this->all_flights[$key]['latitude'].' '.$this->all_flights[$key]['longitude']."\n"; |
|
148 | + $Spotter = new Spotter($this->db); |
|
149 | + $real_arrival = $this->arrival($key); |
|
150 | + 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']); |
|
151 | + } |
|
152 | + } |
|
153 | + } |
|
153 | 154 | } |
154 | - } |
|
155 | 155 | |
156 | - public function arrival($key) { |
|
156 | + public function arrival($key) { |
|
157 | 157 | global $globalClosestMinDist, $globalDebug; |
158 | 158 | if ($globalDebug) echo 'Update arrival...'."\n"; |
159 | 159 | $Spotter = new Spotter($this->db); |
160 | - $airport_icao = ''; |
|
161 | - $airport_time = ''; |
|
162 | - if (!isset($globalClosestMinDist) || $globalClosestMinDist == '') $globalClosestMinDist = 50; |
|
160 | + $airport_icao = ''; |
|
161 | + $airport_time = ''; |
|
162 | + if (!isset($globalClosestMinDist) || $globalClosestMinDist == '') $globalClosestMinDist = 50; |
|
163 | 163 | if ($this->all_flights[$key]['latitude'] != '' && $this->all_flights[$key]['longitude'] != '') { |
164 | - $closestAirports = $Spotter->closestAirports($this->all_flights[$key]['latitude'],$this->all_flights[$key]['longitude'],$globalClosestMinDist); |
|
165 | - if (isset($closestAirports[0])) { |
|
166 | - if (isset($this->all_flights[$key]['arrival_airport']) && $this->all_flights[$key]['arrival_airport'] == $closestAirports[0]['icao']) { |
|
167 | - $airport_icao = $closestAirports[0]['icao']; |
|
168 | - $airport_time = $this->all_flights[$key]['datetime']; |
|
169 | - if ($globalDebug) echo "---++ Find arrival airport. airport_icao : ".$airport_icao."\n"; |
|
170 | - } elseif (count($closestAirports > 1) && isset($this->all_flights[$key]['arrival_airport']) && $this->all_flights[$key]['arrival_airport'] != '') { |
|
171 | - foreach ($closestAirports as $airport) { |
|
172 | - if ($this->all_flights[$key]['arrival_airport'] == $airport['icao']) { |
|
173 | - $airport_icao = $airport['icao']; |
|
174 | - $airport_time = $this->all_flights[$key]['datetime']; |
|
175 | - if ($globalDebug) echo "---++ Find arrival airport. airport_icao : ".$airport_icao."\n"; |
|
176 | - break; |
|
177 | - } |
|
178 | - } |
|
179 | - } 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))) { |
|
180 | - $airport_icao = $closestAirports[0]['icao']; |
|
181 | - $airport_time = $this->all_flights[$key]['datetime']; |
|
182 | - } else { |
|
183 | - if ($globalDebug) echo "----- Can't find arrival airport. Airport altitude : ".$closestAirports[0]['altitude'].' - flight altitude : '.$this->all_flights[$key]['altitude_real']."\n"; |
|
184 | - } |
|
185 | - } else { |
|
186 | - if ($globalDebug) echo "----- No Airport near last coord. Latitude : ".$this->all_flights[$key]['latitude'].' - Longitude : '.$this->all_flights[$key]['longitude'].' - MinDist : '.$globalClosestMinDist."\n"; |
|
187 | - } |
|
164 | + $closestAirports = $Spotter->closestAirports($this->all_flights[$key]['latitude'],$this->all_flights[$key]['longitude'],$globalClosestMinDist); |
|
165 | + if (isset($closestAirports[0])) { |
|
166 | + if (isset($this->all_flights[$key]['arrival_airport']) && $this->all_flights[$key]['arrival_airport'] == $closestAirports[0]['icao']) { |
|
167 | + $airport_icao = $closestAirports[0]['icao']; |
|
168 | + $airport_time = $this->all_flights[$key]['datetime']; |
|
169 | + if ($globalDebug) echo "---++ Find arrival airport. airport_icao : ".$airport_icao."\n"; |
|
170 | + } elseif (count($closestAirports > 1) && isset($this->all_flights[$key]['arrival_airport']) && $this->all_flights[$key]['arrival_airport'] != '') { |
|
171 | + foreach ($closestAirports as $airport) { |
|
172 | + if ($this->all_flights[$key]['arrival_airport'] == $airport['icao']) { |
|
173 | + $airport_icao = $airport['icao']; |
|
174 | + $airport_time = $this->all_flights[$key]['datetime']; |
|
175 | + if ($globalDebug) echo "---++ Find arrival airport. airport_icao : ".$airport_icao."\n"; |
|
176 | + break; |
|
177 | + } |
|
178 | + } |
|
179 | + } 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))) { |
|
180 | + $airport_icao = $closestAirports[0]['icao']; |
|
181 | + $airport_time = $this->all_flights[$key]['datetime']; |
|
182 | + } else { |
|
183 | + if ($globalDebug) echo "----- Can't find arrival airport. Airport altitude : ".$closestAirports[0]['altitude'].' - flight altitude : '.$this->all_flights[$key]['altitude_real']."\n"; |
|
184 | + } |
|
185 | + } else { |
|
186 | + if ($globalDebug) echo "----- No Airport near last coord. Latitude : ".$this->all_flights[$key]['latitude'].' - Longitude : '.$this->all_flights[$key]['longitude'].' - MinDist : '.$globalClosestMinDist."\n"; |
|
187 | + } |
|
188 | 188 | |
189 | - } else { |
|
190 | - if ($globalDebug) echo "---- No latitude or longitude. Ident : ".$this->all_flights[$key]['ident']."\n"; |
|
191 | - } |
|
192 | - return array('airport_icao' => $airport_icao,'airport_time' => $airport_time); |
|
193 | - } |
|
189 | + } else { |
|
190 | + if ($globalDebug) echo "---- No latitude or longitude. Ident : ".$this->all_flights[$key]['ident']."\n"; |
|
191 | + } |
|
192 | + return array('airport_icao' => $airport_icao,'airport_time' => $airport_time); |
|
193 | + } |
|
194 | 194 | |
195 | 195 | |
196 | 196 | |
197 | - public function del() { |
|
197 | + public function del() { |
|
198 | 198 | global $globalDebug, $globalNoImport, $globalNoDB; |
199 | 199 | // Delete old infos |
200 | 200 | if ($globalDebug) echo 'Delete old values and update latest data...'."\n"; |
@@ -206,9 +206,9 @@ discard block |
||
206 | 206 | } |
207 | 207 | } |
208 | 208 | } |
209 | - } |
|
209 | + } |
|
210 | 210 | |
211 | - public function delKey($key) { |
|
211 | + public function delKey($key) { |
|
212 | 212 | global $globalDebug, $globalNoImport, $globalNoDB; |
213 | 213 | // Delete old infos |
214 | 214 | if (isset($this->all_flights[$key]['id'])) { |
@@ -230,9 +230,9 @@ discard block |
||
230 | 230 | if ($globalDebug) echo "\n"; |
231 | 231 | } |
232 | 232 | unset($this->all_flights[$key]); |
233 | - } |
|
233 | + } |
|
234 | 234 | |
235 | - public function add($line) { |
|
235 | + public function add($line) { |
|
236 | 236 | 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; |
237 | 237 | //if (!isset($globalDebugTimeElapsed) || $globalDebugTimeElapsed == '') $globalDebugTimeElapsed = FALSE; |
238 | 238 | if (!isset($globalCoordMinChange) || $globalCoordMinChange == '') $globalCoordMinChange = '0.01'; |
@@ -258,20 +258,20 @@ discard block |
||
258 | 258 | |
259 | 259 | // SBS format is CSV format |
260 | 260 | if(is_array($line) && (isset($line['hex']) || isset($line['id']))) { |
261 | - //print_r($line); |
|
262 | - if (isset($line['hex'])) $line['hex'] = strtoupper($line['hex']); |
|
263 | - 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)) { |
|
261 | + //print_r($line); |
|
262 | + if (isset($line['hex'])) $line['hex'] = strtoupper($line['hex']); |
|
263 | + 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)) { |
|
264 | 264 | |
265 | 265 | // Increment message number |
266 | 266 | if (isset($line['sourcestats']) && $line['sourcestats'] === TRUE) { |
267 | - $current_date = date('Y-m-d'); |
|
268 | - if (isset($line['source_name'])) $source = $line['source_name']; |
|
269 | - else $source = ''; |
|
270 | - if ($source == '' || $line['format_source'] == 'aprs') $source = $line['format_source']; |
|
271 | - if (!isset($this->stats[$current_date][$source]['msg'])) { |
|
272 | - $this->stats[$current_date][$source]['msg']['date'] = time(); |
|
273 | - $this->stats[$current_date][$source]['msg']['nb'] = 1; |
|
274 | - } else $this->stats[$current_date][$source]['msg']['nb'] += 1; |
|
267 | + $current_date = date('Y-m-d'); |
|
268 | + if (isset($line['source_name'])) $source = $line['source_name']; |
|
269 | + else $source = ''; |
|
270 | + if ($source == '' || $line['format_source'] == 'aprs') $source = $line['format_source']; |
|
271 | + if (!isset($this->stats[$current_date][$source]['msg'])) { |
|
272 | + $this->stats[$current_date][$source]['msg']['date'] = time(); |
|
273 | + $this->stats[$current_date][$source]['msg']['nb'] = 1; |
|
274 | + } else $this->stats[$current_date][$source]['msg']['nb'] += 1; |
|
275 | 275 | } |
276 | 276 | |
277 | 277 | /* |
@@ -287,54 +287,54 @@ discard block |
||
287 | 287 | //$this->db = $dbc; |
288 | 288 | |
289 | 289 | //$hex = trim($line['hex']); |
290 | - if (!isset($line['id'])) $id = trim($line['hex']); |
|
291 | - else $id = trim($line['id']); |
|
290 | + if (!isset($line['id'])) $id = trim($line['hex']); |
|
291 | + else $id = trim($line['id']); |
|
292 | 292 | |
293 | 293 | if (!isset($this->all_flights[$id])) { |
294 | - if ($globalDebug) echo 'New flight...'."\n"; |
|
295 | - $this->all_flights[$id] = array(); |
|
296 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('addedSpotter' => 0)); |
|
297 | - $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' => '','coordinates' => 0)); |
|
298 | - if (isset($globalDaemon) && $globalDaemon === FALSE) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('lastupdate' => time())); |
|
299 | - if (!isset($line['id'])) { |
|
294 | + if ($globalDebug) echo 'New flight...'."\n"; |
|
295 | + $this->all_flights[$id] = array(); |
|
296 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('addedSpotter' => 0)); |
|
297 | + $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' => '','coordinates' => 0)); |
|
298 | + if (isset($globalDaemon) && $globalDaemon === FALSE) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('lastupdate' => time())); |
|
299 | + if (!isset($line['id'])) { |
|
300 | 300 | if (!isset($globalDaemon)) $globalDaemon = TRUE; |
301 | 301 | // 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'))); |
302 | 302 | // 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'))); |
303 | 303 | 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'))); |
304 | - //else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident'])); |
|
305 | - } else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $line['id'])); |
|
306 | - if ($globalAllFlights !== FALSE) $dataFound = true; |
|
304 | + //else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident'])); |
|
305 | + } else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $line['id'])); |
|
306 | + if ($globalAllFlights !== FALSE) $dataFound = true; |
|
307 | 307 | } |
308 | 308 | if (isset($line['source_type']) && $line['source_type'] != '') { |
309 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('source_type' => $line['source_type'])); |
|
309 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('source_type' => $line['source_type'])); |
|
310 | 310 | } |
311 | 311 | |
312 | 312 | //print_r($this->all_flights); |
313 | 313 | if (isset($line['hex']) && !isset($this->all_flights[$id]['hex']) && ctype_xdigit($line['hex'])) { |
314 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('hex' => trim($line['hex']))); |
|
315 | - //if (isset($line['datetime']) && preg_match('/^(\d{4}(?:\-\d{2}){2} \d{2}(?:\:\d{2}){2})$/',$line['datetime'])) { |
|
314 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('hex' => trim($line['hex']))); |
|
315 | + //if (isset($line['datetime']) && preg_match('/^(\d{4}(?:\-\d{2}){2} \d{2}(?:\:\d{2}){2})$/',$line['datetime'])) { |
|
316 | 316 | //$this->all_flights[$id] = array_merge($this->all_flights[$id],array('datetime' => $line['datetime'])); |
317 | - //} else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('datetime' => date('Y-m-d H:i:s'))); |
|
318 | - 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') { |
|
317 | + //} else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('datetime' => date('Y-m-d H:i:s'))); |
|
318 | + 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') { |
|
319 | 319 | $timeelapsed = microtime(true); |
320 | 320 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
321 | - $Spotter = new Spotter($this->db); |
|
322 | - if (isset($this->all_flights[$id]['source_type'])) { |
|
321 | + $Spotter = new Spotter($this->db); |
|
322 | + if (isset($this->all_flights[$id]['source_type'])) { |
|
323 | 323 | $aircraft_icao = $Spotter->getAllAircraftType(trim($line['hex']),$this->all_flights[$id]['source_type']); |
324 | - } else { |
|
324 | + } else { |
|
325 | 325 | $aircraft_icao = $Spotter->getAllAircraftType(trim($line['hex'])); |
326 | - } |
|
327 | - $Spotter->db = null; |
|
328 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update getallaircrattype : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
329 | - if ($aircraft_icao != '') $this->all_flights[$id] = array_merge($this->all_flights[$id],array('aircraft_icao' => $aircraft_icao)); |
|
326 | + } |
|
327 | + $Spotter->db = null; |
|
328 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update getallaircrattype : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
329 | + if ($aircraft_icao != '') $this->all_flights[$id] = array_merge($this->all_flights[$id],array('aircraft_icao' => $aircraft_icao)); |
|
330 | 330 | } |
331 | - } |
|
332 | - if ($globalAllFlights !== FALSE) $dataFound = true; |
|
333 | - if ($globalDebug) echo "*********** New aircraft hex : ".$line['hex']." ***********\n"; |
|
331 | + } |
|
332 | + if ($globalAllFlights !== FALSE) $dataFound = true; |
|
333 | + if ($globalDebug) echo "*********** New aircraft hex : ".$line['hex']." ***********\n"; |
|
334 | 334 | } |
335 | - if (isset($line['id']) && !isset($line['hex'])) { |
|
336 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('hex' => '')); |
|
337 | - } |
|
335 | + if (isset($line['id']) && !isset($line['hex'])) { |
|
336 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('hex' => '')); |
|
337 | + } |
|
338 | 338 | if (isset($line['aircraft_icao']) && $line['aircraft_icao'] != '') { |
339 | 339 | $icao = $line['aircraft_icao']; |
340 | 340 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
@@ -364,9 +364,9 @@ discard block |
||
364 | 364 | } |
365 | 365 | //if (isset($line['datetime']) && preg_match('/^(\d{4}(?:\-\d{2}){2} \d{2}(?:\:\d{2}){2})$/',$line['datetime'])) { |
366 | 366 | if (isset($line['datetime']) && strtotime($line['datetime']) > time()-20*60 && strtotime($line['datetime']) < time()+20*60) { |
367 | - if (!isset($this->all_flights[$id]['datetime']) || strtotime($line['datetime']) >= strtotime($this->all_flights[$id]['datetime'])) { |
|
367 | + if (!isset($this->all_flights[$id]['datetime']) || strtotime($line['datetime']) >= strtotime($this->all_flights[$id]['datetime'])) { |
|
368 | 368 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('datetime' => $line['datetime'])); |
369 | - } else { |
|
369 | + } else { |
|
370 | 370 | 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"; |
371 | 371 | 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"; |
372 | 372 | /* |
@@ -375,7 +375,7 @@ discard block |
||
375 | 375 | print_r($line); |
376 | 376 | */ |
377 | 377 | return ''; |
378 | - } |
|
378 | + } |
|
379 | 379 | } elseif (isset($line['datetime']) && strtotime($line['datetime']) < time()-20*60) { |
380 | 380 | if ($globalDebug) echo "!!! Date is too old ".$line['datetime']." for ".$this->all_flights[$id]['hex']." - format : ".$line['format_source']."!!!\n"; |
381 | 381 | return ''; |
@@ -391,21 +391,21 @@ discard block |
||
391 | 391 | } |
392 | 392 | |
393 | 393 | if (isset($line['registration']) && $line['registration'] != '' && $line['registration'] != 'z.NO-REG' && $line['registration'] != 'NA') { |
394 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('registration' => $line['registration'])); |
|
394 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('registration' => $line['registration'])); |
|
395 | 395 | } |
396 | 396 | if (isset($line['waypoints']) && $line['waypoints'] != '') { |
397 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('waypoints' => $line['waypoints'])); |
|
397 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('waypoints' => $line['waypoints'])); |
|
398 | 398 | } |
399 | 399 | if (isset($line['pilot_id']) && $line['pilot_id'] != '') { |
400 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('pilot_id' => trim($line['pilot_id']))); |
|
400 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('pilot_id' => trim($line['pilot_id']))); |
|
401 | 401 | } |
402 | 402 | if (isset($line['pilot_name']) && $line['pilot_name'] != '') { |
403 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('pilot_name' => trim($line['pilot_name']))); |
|
403 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('pilot_name' => trim($line['pilot_name']))); |
|
404 | 404 | } |
405 | 405 | |
406 | 406 | 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'])) { |
407 | 407 | |
408 | - if ($this->all_flights[$id]['addedSpotter'] == 1) { |
|
408 | + if ($this->all_flights[$id]['addedSpotter'] == 1) { |
|
409 | 409 | if ($globalVA !== TRUE && $globalIVAO !== TRUE && $globalVATSIM !== TRUE && $globalphpVMS !== TRUE && $globalVAM !== TRUE && $this->all_flights[$id]['lastupdate'] < time() - 1600) { |
410 | 410 | if ($globalDebug) echo '---!!!! New ident, reset aircraft data...'."\n"; |
411 | 411 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('addedSpotter' => 0)); |
@@ -414,23 +414,23 @@ discard block |
||
414 | 414 | elseif (isset($line['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $line['id'])); |
415 | 415 | 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'])); |
416 | 416 | } else { |
417 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('ident' => trim($line['ident']))); |
|
418 | - if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
|
417 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('ident' => trim($line['ident']))); |
|
418 | + if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
|
419 | 419 | $timeelapsed = microtime(true); |
420 | - $Spotter = new Spotter($this->db); |
|
421 | - $fromsource = NULL; |
|
422 | - if (isset($globalAirlinesSource) && $globalAirlinesSource != '') $fromsource = $globalAirlinesSource; |
|
423 | - elseif (isset($line['format_source']) && $line['format_source'] == 'vatsimtxt') $fromsource = 'vatsim'; |
|
420 | + $Spotter = new Spotter($this->db); |
|
421 | + $fromsource = NULL; |
|
422 | + if (isset($globalAirlinesSource) && $globalAirlinesSource != '') $fromsource = $globalAirlinesSource; |
|
423 | + elseif (isset($line['format_source']) && $line['format_source'] == 'vatsimtxt') $fromsource = 'vatsim'; |
|
424 | 424 | elseif (isset($line['format_source']) && $line['format_source'] == 'whazzup') $fromsource = 'ivao'; |
425 | 425 | elseif (isset($globalVATSIM) && $globalVATSIM) $fromsource = 'vatsim'; |
426 | 426 | elseif (isset($globalIVAO) && $globalIVAO) $fromsource = 'ivao'; |
427 | - $result = $Spotter->updateIdentSpotterData($this->all_flights[$id]['id'],$this->all_flights[$id]['ident'],$fromsource,$this->all_flights[$id]['source_type']); |
|
427 | + $result = $Spotter->updateIdentSpotterData($this->all_flights[$id]['id'],$this->all_flights[$id]['ident'],$fromsource,$this->all_flights[$id]['source_type']); |
|
428 | 428 | if ($globalDebug && $result != 'success') echo '!!! ERROR : '.$result."\n"; |
429 | 429 | $Spotter->db = null; |
430 | 430 | if ($globalDebugTimeElapsed) echo 'Time elapsed for update identspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
431 | - } |
|
431 | + } |
|
432 | 432 | } |
433 | - } else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('ident' => trim($line['ident']))); |
|
433 | + } else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('ident' => trim($line['ident']))); |
|
434 | 434 | |
435 | 435 | /* |
436 | 436 | if (!isset($line['id'])) { |
@@ -440,63 +440,63 @@ discard block |
||
440 | 440 | else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident'])); |
441 | 441 | } else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $line['id'])); |
442 | 442 | */ |
443 | - 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'])); |
|
443 | + 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'])); |
|
444 | 444 | |
445 | - //$putinarchive = true; |
|
446 | - if (isset($line['departure_airport_time']) && $line['departure_airport_time'] != 0) { |
|
445 | + //$putinarchive = true; |
|
446 | + if (isset($line['departure_airport_time']) && $line['departure_airport_time'] != 0) { |
|
447 | 447 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('departure_airport_time' => $line['departure_airport_time'])); |
448 | - } |
|
449 | - if (isset($line['arrival_airport_time']) && $line['arrival_airport_time'] != 0) { |
|
448 | + } |
|
449 | + if (isset($line['arrival_airport_time']) && $line['arrival_airport_time'] != 0) { |
|
450 | 450 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('arrival_airport_time' => $line['arrival_airport_time'])); |
451 | - } |
|
452 | - if (isset($line['departure_airport_icao']) && isset($line['arrival_airport_icao'])) { |
|
453 | - $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' => '')); |
|
454 | - } elseif (isset($line['departure_airport_iata']) && isset($line['arrival_airport_iata'])) { |
|
451 | + } |
|
452 | + if (isset($line['departure_airport_icao']) && isset($line['arrival_airport_icao'])) { |
|
453 | + $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' => '')); |
|
454 | + } elseif (isset($line['departure_airport_iata']) && isset($line['arrival_airport_iata'])) { |
|
455 | 455 | $timeelapsed = microtime(true); |
456 | 456 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
457 | 457 | $Spotter = new Spotter($this->db); |
458 | 458 | $line['departure_airport_icao'] = $Spotter->getAirportIcao($line['departure_airport_iata']); |
459 | 459 | $line['arrival_airport_icao'] = $Spotter->getAirportIcao($line['arrival_airport_iata']); |
460 | - $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' => '')); |
|
460 | + $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' => '')); |
|
461 | 461 | if ($globalDebugTimeElapsed) echo 'Time elapsed for update getAirportICAO : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
462 | - } |
|
463 | - } elseif (!isset($line['format_source']) || $line['format_source'] != 'aprs') { |
|
462 | + } |
|
463 | + } elseif (!isset($line['format_source']) || $line['format_source'] != 'aprs') { |
|
464 | 464 | $timeelapsed = microtime(true); |
465 | 465 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
466 | - $Spotter = new Spotter($this->db); |
|
467 | - $route = $Spotter->getRouteInfo(trim($line['ident'])); |
|
468 | - if (!isset($route['fromairport_icao']) && !isset($route['toairport_icao'])) { |
|
466 | + $Spotter = new Spotter($this->db); |
|
467 | + $route = $Spotter->getRouteInfo(trim($line['ident'])); |
|
468 | + if (!isset($route['fromairport_icao']) && !isset($route['toairport_icao'])) { |
|
469 | 469 | $Translation = new Translation($this->db); |
470 | 470 | $ident = $Translation->checkTranslation(trim($line['ident'])); |
471 | 471 | $route = $Spotter->getRouteInfo($ident); |
472 | 472 | $Translation->db = null; |
473 | - } |
|
474 | - $Spotter->db = null; |
|
475 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update getrouteinfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
476 | - } |
|
473 | + } |
|
474 | + $Spotter->db = null; |
|
475 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update getrouteinfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
476 | + } |
|
477 | 477 | if (isset($route['fromairport_icao']) && isset($route['toairport_icao'])) { |
478 | - //if ($route['FromAirport_ICAO'] != $route['ToAirport_ICAO']) { |
|
479 | - if ($route['fromairport_icao'] != $route['toairport_icao']) { |
|
478 | + //if ($route['FromAirport_ICAO'] != $route['ToAirport_ICAO']) { |
|
479 | + if ($route['fromairport_icao'] != $route['toairport_icao']) { |
|
480 | 480 | // $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'])); |
481 | - $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'])); |
|
482 | - } |
|
481 | + $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'])); |
|
482 | + } |
|
483 | 483 | } |
484 | 484 | if (!isset($globalFork)) $globalFork = TRUE; |
485 | 485 | if (!$globalVA && !$globalIVAO && !$globalVATSIM && !$globalphpVMS && !$globalVAM && (!isset($line['format_source']) || $line['format_source'] != 'aprs')) { |
486 | 486 | if (!isset($this->all_flights[$id]['schedule_check']) || $this->all_flights[$id]['schedule_check'] === false) $this->get_Schedule($id,trim($line['ident'])); |
487 | 487 | } |
488 | - } |
|
488 | + } |
|
489 | 489 | } |
490 | 490 | |
491 | 491 | if (isset($line['speed']) && $line['speed'] != '' && $line['speed'] != 0) { |
492 | 492 | // $this->all_flights[$id] = array_merge($this->all_flights[$id],array('speed' => $line[12])); |
493 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('speed' => round($line['speed']))); |
|
494 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('speed_fromsrc' => true)); |
|
495 | - //$dataFound = true; |
|
493 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('speed' => round($line['speed']))); |
|
494 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('speed_fromsrc' => true)); |
|
495 | + //$dataFound = true; |
|
496 | 496 | } 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'])) { |
497 | - $distance = $Common->distance($line['latitude'],$line['longitude'],$this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],'m'); |
|
498 | - if ($distance > 1000 && $distance < 10000) { |
|
499 | - // use datetime |
|
497 | + $distance = $Common->distance($line['latitude'],$line['longitude'],$this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],'m'); |
|
498 | + if ($distance > 1000 && $distance < 10000) { |
|
499 | + // use datetime |
|
500 | 500 | $speed = $distance/(time() - $this->all_flights[$id]['time_last_coord']); |
501 | 501 | $speed = $speed*3.6; |
502 | 502 | if ($speed < 1000) { |
@@ -505,49 +505,49 @@ discard block |
||
505 | 505 | } else { |
506 | 506 | if ($globalDebug) echo "ø IGNORED : Calculated Speed for ".$this->all_flights[$id]['hex']." : ".round($speed)." - distance : ".$distance."\n"; |
507 | 507 | } |
508 | - } |
|
508 | + } |
|
509 | 509 | } |
510 | 510 | |
511 | 511 | |
512 | 512 | |
513 | - if (isset($line['latitude']) && isset($line['longitude']) && $line['latitude'] != '' && $line['longitude'] != '' && is_numeric($line['latitude']) && is_numeric($line['longitude'])) { |
|
514 | - if (ctype_digit(strval($line['latitude'])) || ctype_digit(strval($line['longitude']))) { |
|
515 | - if ($globalDebug) echo "/!\ Invalid latitude or/and longitude data : lat: ".$line['latitude']." - lng: ".$line['longitude']."\n"; |
|
516 | - return false; |
|
517 | - } |
|
518 | - if (isset($this->all_flights[$id]['time_last_coord'])) $timediff = round(time()-$this->all_flights[$id]['time_last_coord']); |
|
519 | - else unset($timediff); |
|
520 | - if (isset($this->all_flights[$id]['time_last_archive_coord'])) $timediff_archive = round(time()-$this->all_flights[$id]['time_last_archive_coord']); |
|
521 | - else unset($timediff_archive); |
|
522 | - if ($this->tmd > 5 |
|
523 | - || (isset($line['format_source']) |
|
524 | - && $line['format_source'] == 'airwhere' |
|
525 | - && ((!isset($this->all_flights[$id]['latitude']) |
|
526 | - || !isset($this->all_flights[$id]['longitude'])) |
|
527 | - || (isset($this->all_flights[$id]['latitude']) |
|
528 | - && isset($this->all_flights[$id]['longitude']) |
|
529 | - && $this->all_flights[$id]['latitude'] != $line['latitude'] |
|
530 | - && $this->all_flights[$id]['longitude'] != $line['longitude'] |
|
531 | - ) |
|
532 | - ) |
|
533 | - ) |
|
534 | - || (isset($globalVA) && $globalVA) |
|
535 | - || (isset($globalIVAO) && $globalIVAO) |
|
536 | - || (isset($globalVATSIM) && $globalVATSIM) |
|
537 | - || (isset($globalphpVMS) && $globalphpVMS) |
|
538 | - || (isset($globalVAM) && $globalVAM) |
|
539 | - || !isset($timediff) |
|
540 | - || $timediff > $globalLiveInterval |
|
541 | - || $globalArchive |
|
542 | - || ($timediff > 30 |
|
543 | - && isset($this->all_flights[$id]['latitude']) |
|
544 | - && isset($this->all_flights[$id]['longitude']) |
|
545 | - && $Common->withinThreshold($timediff,$Common->distance($line['latitude'],$line['longitude'],$this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],'m')) |
|
546 | - ) |
|
547 | - ) { |
|
513 | + if (isset($line['latitude']) && isset($line['longitude']) && $line['latitude'] != '' && $line['longitude'] != '' && is_numeric($line['latitude']) && is_numeric($line['longitude'])) { |
|
514 | + if (ctype_digit(strval($line['latitude'])) || ctype_digit(strval($line['longitude']))) { |
|
515 | + if ($globalDebug) echo "/!\ Invalid latitude or/and longitude data : lat: ".$line['latitude']." - lng: ".$line['longitude']."\n"; |
|
516 | + return false; |
|
517 | + } |
|
518 | + if (isset($this->all_flights[$id]['time_last_coord'])) $timediff = round(time()-$this->all_flights[$id]['time_last_coord']); |
|
519 | + else unset($timediff); |
|
520 | + if (isset($this->all_flights[$id]['time_last_archive_coord'])) $timediff_archive = round(time()-$this->all_flights[$id]['time_last_archive_coord']); |
|
521 | + else unset($timediff_archive); |
|
522 | + if ($this->tmd > 5 |
|
523 | + || (isset($line['format_source']) |
|
524 | + && $line['format_source'] == 'airwhere' |
|
525 | + && ((!isset($this->all_flights[$id]['latitude']) |
|
526 | + || !isset($this->all_flights[$id]['longitude'])) |
|
527 | + || (isset($this->all_flights[$id]['latitude']) |
|
528 | + && isset($this->all_flights[$id]['longitude']) |
|
529 | + && $this->all_flights[$id]['latitude'] != $line['latitude'] |
|
530 | + && $this->all_flights[$id]['longitude'] != $line['longitude'] |
|
531 | + ) |
|
532 | + ) |
|
533 | + ) |
|
534 | + || (isset($globalVA) && $globalVA) |
|
535 | + || (isset($globalIVAO) && $globalIVAO) |
|
536 | + || (isset($globalVATSIM) && $globalVATSIM) |
|
537 | + || (isset($globalphpVMS) && $globalphpVMS) |
|
538 | + || (isset($globalVAM) && $globalVAM) |
|
539 | + || !isset($timediff) |
|
540 | + || $timediff > $globalLiveInterval |
|
541 | + || $globalArchive |
|
542 | + || ($timediff > 30 |
|
543 | + && isset($this->all_flights[$id]['latitude']) |
|
544 | + && isset($this->all_flights[$id]['longitude']) |
|
545 | + && $Common->withinThreshold($timediff,$Common->distance($line['latitude'],$line['longitude'],$this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],'m')) |
|
546 | + ) |
|
547 | + ) { |
|
548 | 548 | |
549 | 549 | 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']))) { |
550 | - if ((isset($timediff_archive) && $timediff_archive > $globalAircraftMaxUpdate) |
|
550 | + if ((isset($timediff_archive) && $timediff_archive > $globalAircraftMaxUpdate) |
|
551 | 551 | || (isset($line['format_source']) && $line['format_source'] == 'airwhere') |
552 | 552 | || !$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'])) { |
553 | 553 | $this->all_flights[$id]['archive_latitude'] = $line['latitude']; |
@@ -559,9 +559,9 @@ discard block |
||
559 | 559 | } |
560 | 560 | $this->tmd = 0; |
561 | 561 | if (!isset($globalNoImport) || $globalNoImport === FALSE) { |
562 | - if ($globalDebug) echo "\n".' ------- Check Country for '.$this->all_flights[$id]['ident'].' with latitude : '.$line['latitude'].' and longitude : '.$line['longitude'].'.... '; |
|
563 | - $timeelapsed = microtime(true); |
|
564 | - if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
|
562 | + if ($globalDebug) echo "\n".' ------- Check Country for '.$this->all_flights[$id]['ident'].' with latitude : '.$line['latitude'].' and longitude : '.$line['longitude'].'.... '; |
|
563 | + $timeelapsed = microtime(true); |
|
564 | + if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
|
565 | 565 | $Spotter = new Spotter($this->db); |
566 | 566 | $all_country = $Spotter->getCountryFromLatitudeLongitude($line['latitude'],$line['longitude']); |
567 | 567 | if (!empty($all_country)) $this->all_flights[$id]['over_country'] = $all_country['iso2']; |
@@ -569,11 +569,11 @@ discard block |
||
569 | 569 | $Spotter->db = null; |
570 | 570 | if ($globalDebugTimeElapsed) echo 'Time elapsed for update getCountryFromlatitudeLongitude : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
571 | 571 | if ($globalDebug) echo 'FOUND : '.$this->all_flights[$id]['over_country'].' ---------------'."\n"; |
572 | - } |
|
572 | + } |
|
573 | 573 | } |
574 | 574 | $this->all_flights[$id]['time_last_archive_coord'] = time(); |
575 | - } |
|
576 | - /* |
|
575 | + } |
|
576 | + /* |
|
577 | 577 | else { |
578 | 578 | if (!isset($timediff)) echo 'NO TIMEDIFF'; |
579 | 579 | else { |
@@ -587,16 +587,16 @@ discard block |
||
587 | 587 | } |
588 | 588 | |
589 | 589 | if (isset($line['latitude']) && $line['latitude'] != '' && $line['latitude'] != 0 && $line['latitude'] < 91 && $line['latitude'] > -90) { |
590 | - //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) { |
|
590 | + //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) { |
|
591 | 591 | if (!isset($this->all_flights[$id]['archive_latitude'])) { |
592 | 592 | $this->all_flights[$id]['archive_latitude'] = $line['latitude']; |
593 | 593 | $this->all_flights[$id]['time_last_coord'] = time(); |
594 | 594 | } |
595 | 595 | //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)) { |
596 | 596 | 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)) { |
597 | - $this->all_flights[$id]['livedb_latitude'] = $line['latitude']; |
|
598 | - $dataFound = true; |
|
599 | - $this->all_flights[$id]['time_last_coord'] = time(); |
|
597 | + $this->all_flights[$id]['livedb_latitude'] = $line['latitude']; |
|
598 | + $dataFound = true; |
|
599 | + $this->all_flights[$id]['time_last_coord'] = time(); |
|
600 | 600 | } |
601 | 601 | // elseif ($globalDebug) echo '!*!*! Ignore data, too close to previous one'."\n"; |
602 | 602 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('latitude' => $line['latitude'])); |
@@ -607,25 +607,25 @@ discard block |
||
607 | 607 | //$putinarchive = true; |
608 | 608 | } |
609 | 609 | */ |
610 | - /* |
|
610 | + /* |
|
611 | 611 | } elseif (isset($this->all_flights[$id]['latitude'])) { |
612 | 612 | 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"; |
613 | 613 | } |
614 | 614 | */ |
615 | 615 | } |
616 | 616 | if (isset($line['longitude']) && $line['longitude'] != '' && $line['longitude'] != 0 && $line['longitude'] < 360 && $line['longitude'] > -180) { |
617 | - if ($line['longitude'] > 180) $line['longitude'] = $line['longitude'] - 360; |
|
618 | - //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) { |
|
617 | + if ($line['longitude'] > 180) $line['longitude'] = $line['longitude'] - 360; |
|
618 | + //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) { |
|
619 | 619 | if (!isset($this->all_flights[$id]['archive_longitude'])) { |
620 | 620 | $this->all_flights[$id]['archive_longitude'] = $line['longitude']; |
621 | 621 | $this->all_flights[$id]['time_last_coord'] = time(); |
622 | 622 | } |
623 | 623 | //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)) { |
624 | 624 | 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)) { |
625 | - $this->all_flights[$id]['livedb_longitude'] = $line['longitude']; |
|
626 | - $dataFound = true; |
|
627 | - $this->all_flights[$id]['coordinates'] += 1; |
|
628 | - $this->all_flights[$id]['time_last_coord'] = time(); |
|
625 | + $this->all_flights[$id]['livedb_longitude'] = $line['longitude']; |
|
626 | + $dataFound = true; |
|
627 | + $this->all_flights[$id]['coordinates'] += 1; |
|
628 | + $this->all_flights[$id]['time_last_coord'] = time(); |
|
629 | 629 | } |
630 | 630 | // elseif ($globalDebug) echo '!*!*! Ignore data, too close to previous one'."\n"; |
631 | 631 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('longitude' => $line['longitude'])); |
@@ -643,76 +643,76 @@ discard block |
||
643 | 643 | */ |
644 | 644 | } |
645 | 645 | if ($globalDaemon === TRUE && isset($updateinitial) && $updateinitial && $this->all_flights[$id]['addedSpotter'] == 1) { |
646 | - if ($globalDebug) echo "\n".'>>> Update initial data !'."\n"; |
|
647 | - unset($updateinitial); |
|
648 | - $SpotterArchive = new SpotterArchive(); |
|
649 | - $SpotterArchive->deleteSpotterArchiveTrackDataByID($this->all_flights[$id]['id']); |
|
650 | - $SpotterArchive->db = null; |
|
651 | - $Spotter = new Spotter(); |
|
652 | - $Spotter->updateInitialSpotterData($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']); |
|
653 | - $Spotter->db = null; |
|
646 | + if ($globalDebug) echo "\n".'>>> Update initial data !'."\n"; |
|
647 | + unset($updateinitial); |
|
648 | + $SpotterArchive = new SpotterArchive(); |
|
649 | + $SpotterArchive->deleteSpotterArchiveTrackDataByID($this->all_flights[$id]['id']); |
|
650 | + $SpotterArchive->db = null; |
|
651 | + $Spotter = new Spotter(); |
|
652 | + $Spotter->updateInitialSpotterData($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']); |
|
653 | + $Spotter->db = null; |
|
654 | 654 | } |
655 | - } else if ($globalDebug && $timediff > 30) { |
|
655 | + } else if ($globalDebug && $timediff > 30) { |
|
656 | 656 | $this->tmd = $this->tmd + 1; |
657 | 657 | echo '!!! Too much distance in short time... for '.$this->all_flights[$id]['ident']."\n"; |
658 | 658 | echo 'Time : '.$timediff.'s - Distance : '.$Common->distance($line['latitude'],$line['longitude'],$this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],'m')."m -"; |
659 | 659 | echo 'Speed : '.(($Common->distance($line['latitude'],$line['longitude'],$this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],'m')/$timediff)*3.6)." km/h - "; |
660 | 660 | echo 'Lat : '.$line['latitude'].' - long : '.$line['longitude'].' - prev lat : '.$this->all_flights[$id]['latitude'].' - prev long : '.$this->all_flights[$id]['longitude']." \n"; |
661 | - } |
|
661 | + } |
|
662 | 662 | } |
663 | 663 | if (isset($line['last_update']) && $line['last_update'] != '') { |
664 | - if (isset($this->all_flights[$id]['last_update']) && $this->all_flights[$id]['last_update'] != $line['last_update']) $dataFound = true; |
|
665 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('last_update' => $line['last_update'])); |
|
664 | + if (isset($this->all_flights[$id]['last_update']) && $this->all_flights[$id]['last_update'] != $line['last_update']) $dataFound = true; |
|
665 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('last_update' => $line['last_update'])); |
|
666 | 666 | } |
667 | 667 | if (isset($line['verticalrate']) && $line['verticalrate'] != '') { |
668 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('verticalrate' => $line['verticalrate'])); |
|
669 | - //$dataFound = true; |
|
668 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('verticalrate' => $line['verticalrate'])); |
|
669 | + //$dataFound = true; |
|
670 | 670 | } |
671 | 671 | if (isset($line['format_source']) && $line['format_source'] != '') { |
672 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('format_source' => $line['format_source'])); |
|
672 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('format_source' => $line['format_source'])); |
|
673 | 673 | } |
674 | 674 | if (isset($line['source_name']) && $line['source_name'] != '') { |
675 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('source_name' => $line['source_name'])); |
|
675 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('source_name' => $line['source_name'])); |
|
676 | 676 | } |
677 | 677 | if (isset($line['emergency']) && $line['emergency'] != '') { |
678 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('emergency' => $line['emergency'])); |
|
679 | - //$dataFound = true; |
|
678 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('emergency' => $line['emergency'])); |
|
679 | + //$dataFound = true; |
|
680 | 680 | } |
681 | 681 | if (isset($line['ground']) && $line['ground'] != '') { |
682 | - if (isset($this->all_flights[$id]['ground']) && $this->all_flights[$id]['ground'] == 1 && $line['ground'] == 0) { |
|
682 | + if (isset($this->all_flights[$id]['ground']) && $this->all_flights[$id]['ground'] == 1 && $line['ground'] == 0) { |
|
683 | 683 | // Here we force archive of flight because after ground it's a new one (or should be) |
684 | 684 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('addedSpotter' => 0)); |
685 | 685 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('forcenew' => 1)); |
686 | 686 | 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'))); |
687 | - elseif (isset($line['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $line['id'])); |
|
687 | + elseif (isset($line['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $line['id'])); |
|
688 | 688 | 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'])); |
689 | - } |
|
690 | - if ($line['ground'] != 1) $line['ground'] = 0; |
|
691 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('ground' => $line['ground'])); |
|
692 | - //$dataFound = true; |
|
689 | + } |
|
690 | + if ($line['ground'] != 1) $line['ground'] = 0; |
|
691 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('ground' => $line['ground'])); |
|
692 | + //$dataFound = true; |
|
693 | 693 | } |
694 | 694 | if (isset($line['squawk']) && $line['squawk'] != '') { |
695 | - 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'])) { |
|
696 | - if ($this->all_flights[$id]['squawk'] != $line['squawk']) $this->all_flights[$id]['putinarchive'] = true; |
|
697 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('squawk' => $line['squawk'])); |
|
698 | - $highlight = ''; |
|
699 | - if ($this->all_flights[$id]['squawk'] == '7500') $highlight = 'Squawk 7500 : Hijack at '.date('Y-m-d G:i').' UTC'; |
|
700 | - if ($this->all_flights[$id]['squawk'] == '7600') $highlight = 'Squawk 7600 : Lost Comm (radio failure) at '.date('Y-m-d G:i').' UTC'; |
|
701 | - if ($this->all_flights[$id]['squawk'] == '7700') $highlight = 'Squawk 7700 : Emergency at '.date('Y-m-d G:i').' UTC'; |
|
702 | - if ($highlight != '') { |
|
695 | + 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'])) { |
|
696 | + if ($this->all_flights[$id]['squawk'] != $line['squawk']) $this->all_flights[$id]['putinarchive'] = true; |
|
697 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('squawk' => $line['squawk'])); |
|
698 | + $highlight = ''; |
|
699 | + if ($this->all_flights[$id]['squawk'] == '7500') $highlight = 'Squawk 7500 : Hijack at '.date('Y-m-d G:i').' UTC'; |
|
700 | + if ($this->all_flights[$id]['squawk'] == '7600') $highlight = 'Squawk 7600 : Lost Comm (radio failure) at '.date('Y-m-d G:i').' UTC'; |
|
701 | + if ($this->all_flights[$id]['squawk'] == '7700') $highlight = 'Squawk 7700 : Emergency at '.date('Y-m-d G:i').' UTC'; |
|
702 | + if ($highlight != '') { |
|
703 | 703 | $timeelapsed = microtime(true); |
704 | 704 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
705 | - $Spotter = new Spotter($this->db); |
|
706 | - $Spotter->setHighlightFlight($this->all_flights[$id]['id'],$highlight); |
|
707 | - $Spotter->db = null; |
|
708 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update sethighlightflight : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
705 | + $Spotter = new Spotter($this->db); |
|
706 | + $Spotter->setHighlightFlight($this->all_flights[$id]['id'],$highlight); |
|
707 | + $Spotter->db = null; |
|
708 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update sethighlightflight : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
709 | 709 | } |
710 | 710 | //$putinarchive = true; |
711 | 711 | //$highlight = ''; |
712 | - } |
|
712 | + } |
|
713 | 713 | |
714 | - } else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('squawk' => $line['squawk'])); |
|
715 | - //$dataFound = true; |
|
714 | + } else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('squawk' => $line['squawk'])); |
|
715 | + //$dataFound = true; |
|
716 | 716 | } |
717 | 717 | |
718 | 718 | if (isset($line['altitude']) && $line['altitude'] != '') { |
@@ -723,13 +723,13 @@ discard block |
||
723 | 723 | $line['altitude'] = $line['altitude'] - $geoid; |
724 | 724 | } |
725 | 725 | } |
726 | - //if (!isset($this->all_flights[$id]['altitude']) || $this->all_flights[$id]['altitude'] == '' || ($this->all_flights[$id]['altitude'] > 0 && $line['altitude'] != 0)) { |
|
726 | + //if (!isset($this->all_flights[$id]['altitude']) || $this->all_flights[$id]['altitude'] == '' || ($this->all_flights[$id]['altitude'] > 0 && $line['altitude'] != 0)) { |
|
727 | 727 | 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; |
728 | 728 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('altitude' => round($line['altitude']/100))); |
729 | 729 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('altitude_real' => $line['altitude'])); |
730 | 730 | //$dataFound = true; |
731 | - //} elseif ($globalDebug) echo "!!! Strange altitude data... not added.\n"; |
|
732 | - if ($globalVA !== TRUE && $globalIVAO !== TRUE && $globalVATSIM !== TRUE && $globalphpVMS !== TRUE && $globalVAM !== TRUE) { |
|
731 | + //} elseif ($globalDebug) echo "!!! Strange altitude data... not added.\n"; |
|
732 | + if ($globalVA !== TRUE && $globalIVAO !== TRUE && $globalVATSIM !== TRUE && $globalphpVMS !== TRUE && $globalVAM !== TRUE) { |
|
733 | 733 | 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) { |
734 | 734 | if ($globalDebug) echo '--- Reset because of altitude'."\n"; |
735 | 735 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('addedSpotter' => 0)); |
@@ -738,27 +738,27 @@ discard block |
||
738 | 738 | elseif (isset($line['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $line['id'])); |
739 | 739 | 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'])); |
740 | 740 | } |
741 | - } |
|
742 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('altitude_previous' => $line['altitude'])); |
|
741 | + } |
|
742 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('altitude_previous' => $line['altitude'])); |
|
743 | 743 | } |
744 | 744 | |
745 | 745 | if (isset($line['noarchive']) && $line['noarchive'] === true) { |
746 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('noarchive' => true)); |
|
746 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('noarchive' => true)); |
|
747 | 747 | } |
748 | 748 | |
749 | 749 | if (isset($line['heading']) && $line['heading'] != '') { |
750 | - if (is_int($this->all_flights[$id]['heading']) && abs($this->all_flights[$id]['heading']-round($line['heading'])) > 10) $this->all_flights[$id]['putinarchive'] = true; |
|
751 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('heading' => round($line['heading']))); |
|
752 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('heading_fromsrc' => true)); |
|
753 | - //$dataFound = true; |
|
750 | + if (is_int($this->all_flights[$id]['heading']) && abs($this->all_flights[$id]['heading']-round($line['heading'])) > 10) $this->all_flights[$id]['putinarchive'] = true; |
|
751 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('heading' => round($line['heading']))); |
|
752 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('heading_fromsrc' => true)); |
|
753 | + //$dataFound = true; |
|
754 | 754 | } 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']) { |
755 | - $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']); |
|
756 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('heading' => round($heading))); |
|
757 | - if (abs($this->all_flights[$id]['heading']-round($heading)) > 10) $this->all_flights[$id]['putinarchive'] = true; |
|
758 | - if ($globalDebug) echo "ø Calculated Heading for ".$this->all_flights[$id]['hex']." : ".$heading."\n"; |
|
755 | + $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']); |
|
756 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('heading' => round($heading))); |
|
757 | + if (abs($this->all_flights[$id]['heading']-round($heading)) > 10) $this->all_flights[$id]['putinarchive'] = true; |
|
758 | + if ($globalDebug) echo "ø Calculated Heading for ".$this->all_flights[$id]['hex']." : ".$heading."\n"; |
|
759 | 759 | } elseif (isset($this->all_flights[$id]['format_source']) && $this->all_flights[$id]['format_source'] == 'ACARS') { |
760 | - // If not enough messages and ACARS set heading to 0 |
|
761 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('heading' => 0)); |
|
760 | + // If not enough messages and ACARS set heading to 0 |
|
761 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('heading' => 0)); |
|
762 | 762 | } |
763 | 763 | if ($globalDaemon === TRUE && isset($globalSourcesupdate) && $globalSourcesupdate != '' && isset($this->all_flights[$id]['lastupdate']) && time()-$this->all_flights[$id]['lastupdate'] < $globalSourcesupdate) $dataFound = false; |
764 | 764 | elseif ($globalDaemon === TRUE && isset($globalSBS1update) && $globalSBS1update != '' && isset($this->all_flights[$id]['lastupdate']) && time()-$this->all_flights[$id]['lastupdate'] < $globalSBS1update) $dataFound = false; |
@@ -771,133 +771,133 @@ discard block |
||
771 | 771 | //if ($dataFound === true && isset($this->all_flights[$id]['hex']) && $this->all_flights[$id]['heading'] != '' && $this->all_flights[$id]['latitude'] != '' && $this->all_flights[$id]['longitude'] != '') { |
772 | 772 | //if ($dataFound === true && isset($this->all_flights[$id]['hex'])) { |
773 | 773 | if ($dataFound === true && isset($this->all_flights[$id]['id'])) { |
774 | - $this->all_flights[$id]['lastupdate'] = time(); |
|
775 | - if ((!isset($globalNoImport) || $globalNoImport === FALSE) && $this->all_flights[$id]['addedSpotter'] == 0) { |
|
776 | - 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'])) { |
|
777 | - //print_r($this->all_flights); |
|
778 | - //echo $this->all_flights[$id]['id'].' - '.$this->all_flights[$id]['addedSpotter']."\n"; |
|
779 | - //$last_hour_ident = Spotter->getIdentFromLastHour($this->all_flights[$id]['ident']); |
|
780 | - if (!isset($this->all_flights[$id]['forcenew']) || $this->all_flights[$id]['forcenew'] == 0) { |
|
774 | + $this->all_flights[$id]['lastupdate'] = time(); |
|
775 | + if ((!isset($globalNoImport) || $globalNoImport === FALSE) && $this->all_flights[$id]['addedSpotter'] == 0) { |
|
776 | + 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'])) { |
|
777 | + //print_r($this->all_flights); |
|
778 | + //echo $this->all_flights[$id]['id'].' - '.$this->all_flights[$id]['addedSpotter']."\n"; |
|
779 | + //$last_hour_ident = Spotter->getIdentFromLastHour($this->all_flights[$id]['ident']); |
|
780 | + if (!isset($this->all_flights[$id]['forcenew']) || $this->all_flights[$id]['forcenew'] == 0) { |
|
781 | 781 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
782 | - if ($globalDebug) echo "Check if aircraft is already in DB..."; |
|
783 | - $timeelapsed = microtime(true); |
|
784 | - $SpotterLive = new SpotterLive($this->db); |
|
785 | - 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')) { |
|
782 | + if ($globalDebug) echo "Check if aircraft is already in DB..."; |
|
783 | + $timeelapsed = microtime(true); |
|
784 | + $SpotterLive = new SpotterLive($this->db); |
|
785 | + 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')) { |
|
786 | 786 | $recent_ident = $SpotterLive->checkModeSRecent($this->all_flights[$id]['hex']); |
787 | 787 | if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkModeSRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
788 | - } elseif (isset($line['id'])) { |
|
788 | + } elseif (isset($line['id'])) { |
|
789 | 789 | $recent_ident = $SpotterLive->checkIdRecent($line['id']); |
790 | 790 | if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
791 | - } elseif (isset($this->all_flights[$id]['ident']) && $this->all_flights[$id]['ident'] != '') { |
|
791 | + } elseif (isset($this->all_flights[$id]['ident']) && $this->all_flights[$id]['ident'] != '') { |
|
792 | 792 | $recent_ident = $SpotterLive->checkIdentRecent($this->all_flights[$id]['ident']); |
793 | 793 | if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdentRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
794 | - } else $recent_ident = ''; |
|
795 | - $SpotterLive->db=null; |
|
796 | - if ($globalDebug && $recent_ident == '') echo " Not in DB.\n"; |
|
797 | - elseif ($globalDebug && $recent_ident != '') echo " Already in DB.\n"; |
|
794 | + } else $recent_ident = ''; |
|
795 | + $SpotterLive->db=null; |
|
796 | + if ($globalDebug && $recent_ident == '') echo " Not in DB.\n"; |
|
797 | + elseif ($globalDebug && $recent_ident != '') echo " Already in DB.\n"; |
|
798 | 798 | } else $recent_ident = ''; |
799 | - } else { |
|
799 | + } else { |
|
800 | 800 | $recent_ident = ''; |
801 | 801 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('forcenew' => 0)); |
802 | - } |
|
803 | - //if there was no aircraft with the same callsign within the last hour and go post it into the archive |
|
804 | - if($recent_ident == "") |
|
805 | - { |
|
802 | + } |
|
803 | + //if there was no aircraft with the same callsign within the last hour and go post it into the archive |
|
804 | + if($recent_ident == "") |
|
805 | + { |
|
806 | 806 | if ($globalDebug) echo "\o/ Add ".$this->all_flights[$id]['ident']." in archive DB : "; |
807 | 807 | if ($this->all_flights[$id]['departure_airport'] == "") { $this->all_flights[$id]['departure_airport'] = "NA"; } |
808 | 808 | if ($this->all_flights[$id]['arrival_airport'] == "") { $this->all_flights[$id]['arrival_airport'] = "NA"; } |
809 | 809 | //adds the spotter data for the archive |
810 | 810 | $ignoreImport = false; |
811 | 811 | foreach($globalAirportIgnore as $airportIgnore) { |
812 | - if (($this->all_flights[$id]['departure_airport'] == $airportIgnore) || ($this->all_flights[$id]['arrival_airport'] == $airportIgnore)) { |
|
812 | + if (($this->all_flights[$id]['departure_airport'] == $airportIgnore) || ($this->all_flights[$id]['arrival_airport'] == $airportIgnore)) { |
|
813 | 813 | $ignoreImport = true; |
814 | - } |
|
814 | + } |
|
815 | 815 | } |
816 | 816 | if (count($globalAirportAccept) > 0) { |
817 | - $ignoreImport = true; |
|
818 | - foreach($globalAirportIgnore as $airportIgnore) { |
|
817 | + $ignoreImport = true; |
|
818 | + foreach($globalAirportIgnore as $airportIgnore) { |
|
819 | 819 | if (($this->all_flights[$id]['departure_airport'] == $airportIgnore) || ($this->all_flights[$id]['arrival_airport'] == $airportIgnore)) { |
820 | - $ignoreImport = false; |
|
820 | + $ignoreImport = false; |
|
821 | + } |
|
821 | 822 | } |
822 | - } |
|
823 | 823 | } |
824 | 824 | if (isset($globalAirlineIgnore) && is_array($globalAirlineIgnore)) { |
825 | - foreach($globalAirlineIgnore as $airlineIgnore) { |
|
825 | + foreach($globalAirlineIgnore as $airlineIgnore) { |
|
826 | 826 | 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)) { |
827 | - $ignoreImport = true; |
|
827 | + $ignoreImport = true; |
|
828 | + } |
|
828 | 829 | } |
829 | - } |
|
830 | 830 | } |
831 | 831 | if (isset($globalAirlineAccept) && count($globalAirlineAccept) > 0) { |
832 | - $ignoreImport = true; |
|
833 | - foreach($globalAirlineAccept as $airlineAccept) { |
|
832 | + $ignoreImport = true; |
|
833 | + foreach($globalAirlineAccept as $airlineAccept) { |
|
834 | 834 | 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)) { |
835 | - $ignoreImport = false; |
|
835 | + $ignoreImport = false; |
|
836 | + } |
|
836 | 837 | } |
837 | - } |
|
838 | 838 | } |
839 | 839 | if (isset($globalPilotIdAccept) && count($globalPilotIdAccept) > 0) { |
840 | - $ignoreImport = true; |
|
841 | - foreach($globalPilotIdAccept as $pilotIdAccept) { |
|
840 | + $ignoreImport = true; |
|
841 | + foreach($globalPilotIdAccept as $pilotIdAccept) { |
|
842 | 842 | if ($this->all_flights[$id]['pilot_id'] == $pilotIdAccept) { |
843 | - $ignoreImport = false; |
|
843 | + $ignoreImport = false; |
|
844 | + } |
|
844 | 845 | } |
845 | - } |
|
846 | 846 | } |
847 | 847 | |
848 | 848 | if (!$ignoreImport) { |
849 | - $highlight = ''; |
|
850 | - if ($this->all_flights[$id]['squawk'] == '7500') $highlight = 'Squawk 7500 : Hijack'; |
|
851 | - if ($this->all_flights[$id]['squawk'] == '7600') $highlight = 'Squawk 7600 : Lost Comm (radio failure)'; |
|
852 | - if ($this->all_flights[$id]['squawk'] == '7700') $highlight = 'Squawk 7700 : Emergency'; |
|
853 | - 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'))); |
|
854 | - $timeelapsed = microtime(true); |
|
855 | - if (!isset($globalNoImport) || $globalNoImport === FALSE) { |
|
849 | + $highlight = ''; |
|
850 | + if ($this->all_flights[$id]['squawk'] == '7500') $highlight = 'Squawk 7500 : Hijack'; |
|
851 | + if ($this->all_flights[$id]['squawk'] == '7600') $highlight = 'Squawk 7600 : Lost Comm (radio failure)'; |
|
852 | + if ($this->all_flights[$id]['squawk'] == '7700') $highlight = 'Squawk 7700 : Emergency'; |
|
853 | + 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'))); |
|
854 | + $timeelapsed = microtime(true); |
|
855 | + if (!isset($globalNoImport) || $globalNoImport === FALSE) { |
|
856 | 856 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
857 | - $Spotter = new Spotter($this->db); |
|
858 | - $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']); |
|
859 | - $Spotter->db = null; |
|
860 | - if ($globalDebug) { |
|
857 | + $Spotter = new Spotter($this->db); |
|
858 | + $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']); |
|
859 | + $Spotter->db = null; |
|
860 | + if ($globalDebug) { |
|
861 | 861 | if (isset($result['error'])) echo 'Error: '.$result['error']."\n"; |
862 | 862 | else echo 'Success'; |
863 | - } |
|
864 | - if (count($result) > 1) { |
|
865 | - // ':airline_name' => $airline_name,':airline_icao' => $airline_icao,':airline_country' => $airline_country,':airline_type' => $airline_type, |
|
863 | + } |
|
864 | + if (count($result) > 1) { |
|
865 | + // ':airline_name' => $airline_name,':airline_icao' => $airline_icao,':airline_country' => $airline_country,':airline_type' => $airline_type, |
|
866 | 866 | if ($this->all_flights[$id]['aircraft_icao'] == '') $this->all_flights[$id]['aircraft_icao'] = $result[':aircraft_icao']; |
867 | 867 | if ($this->all_flights[$id]['registration'] == '') $this->all_flights[$id]['registration'] = $result[':registration']; |
868 | - } |
|
868 | + } |
|
869 | 869 | } |
870 | - } |
|
871 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update addspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
872 | - if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
|
870 | + } |
|
871 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update addspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
872 | + if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
|
873 | 873 | |
874 | - // Add source stat in DB |
|
875 | - $Stats = new Stats($this->db); |
|
876 | - if (!empty($this->stats)) { |
|
874 | + // Add source stat in DB |
|
875 | + $Stats = new Stats($this->db); |
|
876 | + if (!empty($this->stats)) { |
|
877 | 877 | if ($globalDebug) echo 'Add source stats : '; |
878 | - foreach($this->stats as $date => $data) { |
|
879 | - foreach($data as $source => $sourced) { |
|
880 | - //print_r($sourced); |
|
881 | - if (isset($sourced['polar'])) echo $Stats->addStatSource(json_encode($sourced['polar']),$source,'polar',$date); |
|
882 | - if (isset($sourced['hist'])) echo $Stats->addStatSource(json_encode($sourced['hist']),$source,'hist',$date); |
|
883 | - if (isset($sourced['msg'])) { |
|
884 | - if (time() - $sourced['msg']['date'] > 10) { |
|
885 | - $nbmsg = round($sourced['msg']['nb']/(time() - $sourced['msg']['date'])); |
|
886 | - echo $Stats->addStatSource($nbmsg,$source,'msg',$date); |
|
887 | - unset($this->stats[$date][$source]['msg']); |
|
888 | - } |
|
889 | - } |
|
890 | - } |
|
891 | - if ($date != date('Y-m-d')) { |
|
892 | - unset($this->stats[$date]); |
|
893 | - } |
|
894 | - } |
|
895 | - if ($globalDebug) echo 'Done'."\n"; |
|
878 | + foreach($this->stats as $date => $data) { |
|
879 | + foreach($data as $source => $sourced) { |
|
880 | + //print_r($sourced); |
|
881 | + if (isset($sourced['polar'])) echo $Stats->addStatSource(json_encode($sourced['polar']),$source,'polar',$date); |
|
882 | + if (isset($sourced['hist'])) echo $Stats->addStatSource(json_encode($sourced['hist']),$source,'hist',$date); |
|
883 | + if (isset($sourced['msg'])) { |
|
884 | + if (time() - $sourced['msg']['date'] > 10) { |
|
885 | + $nbmsg = round($sourced['msg']['nb']/(time() - $sourced['msg']['date'])); |
|
886 | + echo $Stats->addStatSource($nbmsg,$source,'msg',$date); |
|
887 | + unset($this->stats[$date][$source]['msg']); |
|
888 | + } |
|
889 | + } |
|
890 | + } |
|
891 | + if ($date != date('Y-m-d')) { |
|
892 | + unset($this->stats[$date]); |
|
893 | + } |
|
894 | + } |
|
895 | + if ($globalDebug) echo 'Done'."\n"; |
|
896 | 896 | |
897 | - } |
|
898 | - $Stats->db = null; |
|
899 | - } |
|
900 | - $this->del(); |
|
897 | + } |
|
898 | + $Stats->db = null; |
|
899 | + } |
|
900 | + $this->del(); |
|
901 | 901 | } elseif ($globalDebug) echo 'Ignore data'."\n"; |
902 | 902 | //$ignoreImport = false; |
903 | 903 | $this->all_flights[$id]['addedSpotter'] = 1; |
@@ -915,41 +915,41 @@ discard block |
||
915 | 915 | */ |
916 | 916 | //SpotterLive->deleteLiveSpotterDataByIdent($this->all_flights[$id]['ident']); |
917 | 917 | if ($this->last_delete == 0 || time() - $this->last_delete > 1800) { |
918 | - if ($globalDebug) echo "---- Deleting Live Spotter data older than 9 hours..."; |
|
919 | - //SpotterLive->deleteLiveSpotterDataNotUpdated(); |
|
920 | - if (!isset($globalNoImport) || $globalNoImport === FALSE) { |
|
918 | + if ($globalDebug) echo "---- Deleting Live Spotter data older than 9 hours..."; |
|
919 | + //SpotterLive->deleteLiveSpotterDataNotUpdated(); |
|
920 | + if (!isset($globalNoImport) || $globalNoImport === FALSE) { |
|
921 | 921 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
922 | - $SpotterLive = new SpotterLive($this->db); |
|
923 | - $SpotterLive->deleteLiveSpotterData(); |
|
924 | - $SpotterLive->db=null; |
|
922 | + $SpotterLive = new SpotterLive($this->db); |
|
923 | + $SpotterLive->deleteLiveSpotterData(); |
|
924 | + $SpotterLive->db=null; |
|
925 | 925 | } |
926 | - } |
|
927 | - if ($globalDebug) echo " Done\n"; |
|
928 | - $this->last_delete = time(); |
|
926 | + } |
|
927 | + if ($globalDebug) echo " Done\n"; |
|
928 | + $this->last_delete = time(); |
|
929 | 929 | } |
930 | - } else { |
|
930 | + } else { |
|
931 | 931 | 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')) { |
932 | - $this->all_flights[$id]['id'] = $recent_ident; |
|
933 | - $this->all_flights[$id]['addedSpotter'] = 1; |
|
932 | + $this->all_flights[$id]['id'] = $recent_ident; |
|
933 | + $this->all_flights[$id]['addedSpotter'] = 1; |
|
934 | 934 | } |
935 | 935 | if (isset($globalDaemon) && !$globalDaemon) { |
936 | - if (!isset($globalNoImport) || $globalNoImport === FALSE) { |
|
936 | + if (!isset($globalNoImport) || $globalNoImport === FALSE) { |
|
937 | 937 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
938 | - $Spotter = new Spotter($this->db); |
|
939 | - $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']); |
|
940 | - $Spotter->db = null; |
|
938 | + $Spotter = new Spotter($this->db); |
|
939 | + $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']); |
|
940 | + $Spotter->db = null; |
|
941 | + } |
|
941 | 942 | } |
942 | - } |
|
943 | 943 | } |
944 | 944 | |
945 | - } |
|
945 | + } |
|
946 | 946 | } |
947 | - } |
|
948 | - //adds the spotter LIVE data |
|
949 | - //SpotterLive->addLiveSpotterData($flightaware_id, $ident, $aircraft_type, $departure_airport, $arrival_airport, $latitude, $longitude, $waypoints, $altitude, $heading, $groundspeed); |
|
950 | - //echo "\nAdd in Live !! \n"; |
|
951 | - //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"; |
|
952 | - if ($globalDebug) { |
|
947 | + } |
|
948 | + //adds the spotter LIVE data |
|
949 | + //SpotterLive->addLiveSpotterData($flightaware_id, $ident, $aircraft_type, $departure_airport, $arrival_airport, $latitude, $longitude, $waypoints, $altitude, $heading, $groundspeed); |
|
950 | + //echo "\nAdd in Live !! \n"; |
|
951 | + //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"; |
|
952 | + if ($globalDebug) { |
|
953 | 953 | if ((isset($globalVA) && $globalVA) || (isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS) || (isset($globalVAM) && $globalVAM)) { |
954 | 954 | 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"; |
955 | 955 | 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"; |
@@ -957,61 +957,61 @@ discard block |
||
957 | 957 | 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"; |
958 | 958 | 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"; |
959 | 959 | } |
960 | - } |
|
961 | - $ignoreImport = false; |
|
962 | - if ($this->all_flights[$id]['departure_airport'] == "") { $this->all_flights[$id]['departure_airport'] = "NA"; } |
|
963 | - if ($this->all_flights[$id]['arrival_airport'] == "") { $this->all_flights[$id]['arrival_airport'] = "NA"; } |
|
960 | + } |
|
961 | + $ignoreImport = false; |
|
962 | + if ($this->all_flights[$id]['departure_airport'] == "") { $this->all_flights[$id]['departure_airport'] = "NA"; } |
|
963 | + if ($this->all_flights[$id]['arrival_airport'] == "") { $this->all_flights[$id]['arrival_airport'] = "NA"; } |
|
964 | 964 | |
965 | - foreach($globalAirportIgnore as $airportIgnore) { |
|
966 | - if (($this->all_flights[$id]['departure_airport'] == $airportIgnore) || ($this->all_flights[$id]['arrival_airport'] == $airportIgnore)) { |
|
967 | - $ignoreImport = true; |
|
965 | + foreach($globalAirportIgnore as $airportIgnore) { |
|
966 | + if (($this->all_flights[$id]['departure_airport'] == $airportIgnore) || ($this->all_flights[$id]['arrival_airport'] == $airportIgnore)) { |
|
967 | + $ignoreImport = true; |
|
968 | + } |
|
968 | 969 | } |
969 | - } |
|
970 | - if (count($globalAirportAccept) > 0) { |
|
971 | - $ignoreImport = true; |
|
972 | - foreach($globalAirportIgnore as $airportIgnore) { |
|
973 | - if (($this->all_flights[$id]['departure_airport'] == $airportIgnore) || ($this->all_flights[$id]['arrival_airport'] == $airportIgnore)) { |
|
970 | + if (count($globalAirportAccept) > 0) { |
|
971 | + $ignoreImport = true; |
|
972 | + foreach($globalAirportIgnore as $airportIgnore) { |
|
973 | + if (($this->all_flights[$id]['departure_airport'] == $airportIgnore) || ($this->all_flights[$id]['arrival_airport'] == $airportIgnore)) { |
|
974 | 974 | $ignoreImport = false; |
975 | - } |
|
975 | + } |
|
976 | 976 | } |
977 | - } |
|
978 | - if (isset($globalAirlineIgnore) && is_array($globalAirlineIgnore)) { |
|
977 | + } |
|
978 | + if (isset($globalAirlineIgnore) && is_array($globalAirlineIgnore)) { |
|
979 | 979 | foreach($globalAirlineIgnore as $airlineIgnore) { |
980 | - 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)) { |
|
980 | + 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)) { |
|
981 | 981 | $ignoreImport = true; |
982 | - } |
|
982 | + } |
|
983 | 983 | } |
984 | - } |
|
985 | - if (isset($globalAirlineAccept) && count($globalAirlineAccept) > 0) { |
|
984 | + } |
|
985 | + if (isset($globalAirlineAccept) && count($globalAirlineAccept) > 0) { |
|
986 | 986 | $ignoreImport = true; |
987 | 987 | foreach($globalAirlineAccept as $airlineAccept) { |
988 | - 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)) { |
|
988 | + 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)) { |
|
989 | 989 | $ignoreImport = false; |
990 | - } |
|
990 | + } |
|
991 | + } |
|
991 | 992 | } |
992 | - } |
|
993 | - if (isset($globalPilotIdAccept) && count($globalPilotIdAccept) > 0) { |
|
993 | + if (isset($globalPilotIdAccept) && count($globalPilotIdAccept) > 0) { |
|
994 | 994 | $ignoreImport = true; |
995 | 995 | foreach($globalPilotIdAccept as $pilotIdAccept) { |
996 | - if ($this->all_flights[$id]['pilot_id'] == $pilotIdAccept) { |
|
997 | - $ignoreImport = false; |
|
998 | - } |
|
996 | + if ($this->all_flights[$id]['pilot_id'] == $pilotIdAccept) { |
|
997 | + $ignoreImport = false; |
|
998 | + } |
|
999 | + } |
|
999 | 1000 | } |
1000 | - } |
|
1001 | 1001 | |
1002 | - if (!$ignoreImport) { |
|
1002 | + if (!$ignoreImport) { |
|
1003 | 1003 | 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'])) { |
1004 | 1004 | 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'))); |
1005 | 1005 | $timeelapsed = microtime(true); |
1006 | 1006 | if (!isset($globalNoImport) || $globalNoImport === FALSE) { |
1007 | - if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
|
1007 | + if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
|
1008 | 1008 | if ($globalDebug) echo "\o/ Add ".$this->all_flights[$id]['ident']." from ".$this->all_flights[$id]['format_source']." in Live DB : "; |
1009 | 1009 | $SpotterLive = new SpotterLive($this->db); |
1010 | 1010 | //var_dump($this->all_flights[$id]); |
1011 | 1011 | $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']); |
1012 | 1012 | $SpotterLive->db = null; |
1013 | 1013 | if ($globalDebug) echo $result."\n"; |
1014 | - } |
|
1014 | + } |
|
1015 | 1015 | } |
1016 | 1016 | if (isset($globalServerAPRS) && $globalServerAPRS && $this->all_flights[$id]['putinarchive']) { |
1017 | 1017 | $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']); |
@@ -1023,7 +1023,7 @@ discard block |
||
1023 | 1023 | //if ($line['format_source'] != 'aprs') { |
1024 | 1024 | //if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw' || $line['format_source'] === 'deltadbtxt')) { |
1025 | 1025 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
1026 | - if (isset($line['sourcestats']) && $line['sourcestats'] == TRUE && $this->all_flights[$id]['latitude'] != '' && $this->all_flights[$id]['longitude'] != '') { |
|
1026 | + if (isset($line['sourcestats']) && $line['sourcestats'] == TRUE && $this->all_flights[$id]['latitude'] != '' && $this->all_flights[$id]['longitude'] != '') { |
|
1027 | 1027 | $source = $this->all_flights[$id]['source_name']; |
1028 | 1028 | if ($source == '') $source = $this->all_flights[$id]['format_source']; |
1029 | 1029 | if (!isset($this->source_location[$source])) { |
@@ -1049,7 +1049,7 @@ discard block |
||
1049 | 1049 | if ($stats_heading == 16) $stats_heading = 0; |
1050 | 1050 | if (!isset($this->stats[$current_date][$source]['polar'][1])) { |
1051 | 1051 | for ($i=0;$i<=15;$i++) { |
1052 | - $this->stats[$current_date][$source]['polar'][$i] = 0; |
|
1052 | + $this->stats[$current_date][$source]['polar'][$i] = 0; |
|
1053 | 1053 | } |
1054 | 1054 | $this->stats[$current_date][$source]['polar'][$stats_heading] = $stats_distance; |
1055 | 1055 | } else { |
@@ -1062,17 +1062,17 @@ discard block |
||
1062 | 1062 | //var_dump($this->stats); |
1063 | 1063 | if (!isset($this->stats[$current_date][$source]['hist'][$distance])) { |
1064 | 1064 | if (isset($this->stats[$current_date][$source]['hist'][0])) { |
1065 | - end($this->stats[$current_date][$source]['hist']); |
|
1066 | - $mini = key($this->stats[$current_date][$source]['hist'])+10; |
|
1065 | + end($this->stats[$current_date][$source]['hist']); |
|
1066 | + $mini = key($this->stats[$current_date][$source]['hist'])+10; |
|
1067 | 1067 | } else $mini = 0; |
1068 | 1068 | for ($i=$mini;$i<=$distance;$i+=10) { |
1069 | - $this->stats[$current_date][$source]['hist'][$i] = 0; |
|
1069 | + $this->stats[$current_date][$source]['hist'][$i] = 0; |
|
1070 | 1070 | } |
1071 | 1071 | $this->stats[$current_date][$source]['hist'][$distance] = 1; |
1072 | 1072 | } else { |
1073 | 1073 | $this->stats[$current_date][$source]['hist'][$distance] += 1; |
1074 | 1074 | } |
1075 | - } |
|
1075 | + } |
|
1076 | 1076 | } |
1077 | 1077 | |
1078 | 1078 | $this->all_flights[$id]['lastupdate'] = time(); |
@@ -1082,7 +1082,7 @@ discard block |
||
1082 | 1082 | //$this->del(); |
1083 | 1083 | |
1084 | 1084 | if ($this->last_delete_hourly == 0 || time() - $this->last_delete_hourly > 900) { |
1085 | - if ((!isset($globalNoImport) || $globalNoImport === FALSE) && (!isset($globalNoDB) || $globalNoDB !== TRUE)) { |
|
1085 | + if ((!isset($globalNoImport) || $globalNoImport === FALSE) && (!isset($globalNoDB) || $globalNoDB !== TRUE)) { |
|
1086 | 1086 | if ($globalDebug) echo "---- Deleting Live Spotter data Not updated since 2 hour..."; |
1087 | 1087 | $SpotterLive = new SpotterLive($this->db); |
1088 | 1088 | $SpotterLive->deleteLiveSpotterDataNotUpdated(); |
@@ -1090,19 +1090,19 @@ discard block |
||
1090 | 1090 | //SpotterLive->deleteLiveSpotterData(); |
1091 | 1091 | if ($globalDebug) echo " Done\n"; |
1092 | 1092 | $this->last_delete_hourly = time(); |
1093 | - } else { |
|
1093 | + } else { |
|
1094 | 1094 | $this->del(); |
1095 | 1095 | $this->last_delete_hourly = time(); |
1096 | - } |
|
1096 | + } |
|
1097 | 1097 | } |
1098 | 1098 | |
1099 | - } |
|
1100 | - //$ignoreImport = false; |
|
1099 | + } |
|
1100 | + //$ignoreImport = false; |
|
1101 | 1101 | } |
1102 | 1102 | //if (function_exists('pcntl_fork') && $globalFork) pcntl_signal(SIGCHLD, SIG_IGN); |
1103 | 1103 | if ($send) return $this->all_flights[$id]; |
1104 | - } |
|
1104 | + } |
|
1105 | + } |
|
1105 | 1106 | } |
1106 | - } |
|
1107 | 1107 | } |
1108 | 1108 | ?> |
@@ -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(); |
@@ -139,11 +139,11 @@ discard block |
||
139 | 139 | } |
140 | 140 | |
141 | 141 | /** |
142 | - * Gets all the spotter information based on the latest data entry |
|
143 | - * |
|
144 | - * @return Array the spotter information |
|
145 | - * |
|
146 | - */ |
|
142 | + * Gets all the spotter information based on the latest data entry |
|
143 | + * |
|
144 | + * @return Array the spotter information |
|
145 | + * |
|
146 | + */ |
|
147 | 147 | public function getLiveSpotterData($limit = '', $sort = '', $filter = array()) |
148 | 148 | { |
149 | 149 | global $globalDBdriver, $globalLiveInterval; |
@@ -186,11 +186,11 @@ discard block |
||
186 | 186 | } |
187 | 187 | |
188 | 188 | /** |
189 | - * Gets Minimal Live Spotter data |
|
190 | - * |
|
191 | - * @return Array the spotter information |
|
192 | - * |
|
193 | - */ |
|
189 | + * Gets Minimal Live Spotter data |
|
190 | + * |
|
191 | + * @return Array the spotter information |
|
192 | + * |
|
193 | + */ |
|
194 | 194 | public function getMinLiveSpotterData($limit = 0,$filter = array()) |
195 | 195 | { |
196 | 196 | global $globalDBdriver, $globalLiveInterval, $globalArchive, $globalMap2DAircraftsLimit; |
@@ -242,11 +242,11 @@ discard block |
||
242 | 242 | } |
243 | 243 | |
244 | 244 | /** |
245 | - * Gets Minimal Live Spotter data since xx seconds |
|
246 | - * |
|
247 | - * @return Array the spotter information |
|
248 | - * |
|
249 | - */ |
|
245 | + * Gets Minimal Live Spotter data since xx seconds |
|
246 | + * |
|
247 | + * @return Array the spotter information |
|
248 | + * |
|
249 | + */ |
|
250 | 250 | public function getMinLastLiveSpotterData($coord = array(),$filter = array(), $limit = 0, $id = '') |
251 | 251 | { |
252 | 252 | global $globalDBdriver, $globalLiveInterval, $globalArchive, $globalMap3DAircraftsLimit; |
@@ -349,11 +349,11 @@ discard block |
||
349 | 349 | } |
350 | 350 | |
351 | 351 | /** |
352 | - * Gets Minimal Live Spotter data since xx seconds |
|
353 | - * |
|
354 | - * @return Array the spotter information |
|
355 | - * |
|
356 | - */ |
|
352 | + * Gets Minimal Live Spotter data since xx seconds |
|
353 | + * |
|
354 | + * @return Array the spotter information |
|
355 | + * |
|
356 | + */ |
|
357 | 357 | public function getMinLastLiveSpotterDataByID($id = '',$filter = array(), $limit = 0) |
358 | 358 | { |
359 | 359 | global $globalDBdriver, $globalLiveInterval, $globalArchive, $globalMap3DAircraftsLimit; |
@@ -419,11 +419,11 @@ discard block |
||
419 | 419 | } |
420 | 420 | |
421 | 421 | /** |
422 | - * Gets number of latest data entry |
|
423 | - * |
|
424 | - * @return String number of entry |
|
425 | - * |
|
426 | - */ |
|
422 | + * Gets number of latest data entry |
|
423 | + * |
|
424 | + * @return String number of entry |
|
425 | + * |
|
426 | + */ |
|
427 | 427 | public function getLiveSpotterCount($filter = array()) |
428 | 428 | { |
429 | 429 | global $globalDBdriver, $globalLiveInterval; |
@@ -450,11 +450,11 @@ discard block |
||
450 | 450 | } |
451 | 451 | |
452 | 452 | /** |
453 | - * Gets all the spotter information based on the latest data entry and coord |
|
454 | - * |
|
455 | - * @return Array the spotter information |
|
456 | - * |
|
457 | - */ |
|
453 | + * Gets all the spotter information based on the latest data entry and coord |
|
454 | + * |
|
455 | + * @return Array the spotter information |
|
456 | + * |
|
457 | + */ |
|
458 | 458 | public function getLiveSpotterDatabyCoord($coord, $filter = array()) |
459 | 459 | { |
460 | 460 | global $globalDBdriver, $globalLiveInterval,$globalMap2DAircraftsLimit; |
@@ -482,11 +482,11 @@ discard block |
||
482 | 482 | } |
483 | 483 | |
484 | 484 | /** |
485 | - * Gets all the spotter information based on the latest data entry and coord |
|
486 | - * |
|
487 | - * @return Array the spotter information |
|
488 | - * |
|
489 | - */ |
|
485 | + * Gets all the spotter information based on the latest data entry and coord |
|
486 | + * |
|
487 | + * @return Array the spotter information |
|
488 | + * |
|
489 | + */ |
|
490 | 490 | public function getMinLiveSpotterDatabyCoord($coord,$limit = 0, $filter = array()) |
491 | 491 | { |
492 | 492 | global $globalDBdriver, $globalLiveInterval, $globalArchive,$globalMap2DAircraftsLimit; |
@@ -577,11 +577,11 @@ discard block |
||
577 | 577 | } |
578 | 578 | |
579 | 579 | /** |
580 | - * Gets all the spotter information based on a user's latitude and longitude |
|
581 | - * |
|
582 | - * @return Array the spotter information |
|
583 | - * |
|
584 | - */ |
|
580 | + * Gets all the spotter information based on a user's latitude and longitude |
|
581 | + * |
|
582 | + * @return Array the spotter information |
|
583 | + * |
|
584 | + */ |
|
585 | 585 | public function getLatestSpotterForLayar($lat, $lng, $radius, $interval) |
586 | 586 | { |
587 | 587 | $Spotter = new Spotter($this->db); |
@@ -591,98 +591,98 @@ discard block |
||
591 | 591 | return false; |
592 | 592 | } |
593 | 593 | } |
594 | - if ($lng != '') |
|
595 | - { |
|
596 | - if (!is_numeric($lng)) |
|
597 | - { |
|
598 | - return false; |
|
599 | - } |
|
600 | - } |
|
601 | - |
|
602 | - if ($radius != '') |
|
603 | - { |
|
604 | - if (!is_numeric($radius)) |
|
605 | - { |
|
606 | - return false; |
|
607 | - } |
|
608 | - } |
|
594 | + if ($lng != '') |
|
595 | + { |
|
596 | + if (!is_numeric($lng)) |
|
597 | + { |
|
598 | + return false; |
|
599 | + } |
|
600 | + } |
|
601 | + |
|
602 | + if ($radius != '') |
|
603 | + { |
|
604 | + if (!is_numeric($radius)) |
|
605 | + { |
|
606 | + return false; |
|
607 | + } |
|
608 | + } |
|
609 | 609 | $additional_query = ''; |
610 | - if ($interval != '') |
|
611 | - { |
|
612 | - if (!is_string($interval)) |
|
613 | - { |
|
614 | - //$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= spotter_live.date '; |
|
615 | - return false; |
|
616 | - } else { |
|
617 | - if ($interval == '1m') |
|
618 | - { |
|
619 | - $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= spotter_live.date '; |
|
620 | - } else if ($interval == '15m'){ |
|
621 | - $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 15 MINUTE) <= spotter_live.date '; |
|
622 | - } |
|
623 | - } |
|
624 | - } else { |
|
625 | - $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= spotter_live.date '; |
|
626 | - } |
|
627 | - |
|
628 | - $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 |
|
610 | + if ($interval != '') |
|
611 | + { |
|
612 | + if (!is_string($interval)) |
|
613 | + { |
|
614 | + //$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= spotter_live.date '; |
|
615 | + return false; |
|
616 | + } else { |
|
617 | + if ($interval == '1m') |
|
618 | + { |
|
619 | + $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= spotter_live.date '; |
|
620 | + } else if ($interval == '15m'){ |
|
621 | + $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 15 MINUTE) <= spotter_live.date '; |
|
622 | + } |
|
623 | + } |
|
624 | + } else { |
|
625 | + $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= spotter_live.date '; |
|
626 | + } |
|
627 | + |
|
628 | + $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 |
|
629 | 629 | WHERE spotter_live.latitude <> '' |
630 | 630 | AND spotter_live.longitude <> '' |
631 | 631 | ".$additional_query." |
632 | 632 | HAVING distance < :radius |
633 | 633 | ORDER BY distance"; |
634 | 634 | |
635 | - $spotter_array = $Spotter->getDataFromDB($query, array(':lat' => $lat, ':lng' => $lng,':radius' => $radius)); |
|
635 | + $spotter_array = $Spotter->getDataFromDB($query, array(':lat' => $lat, ':lng' => $lng,':radius' => $radius)); |
|
636 | 636 | |
637 | - return $spotter_array; |
|
638 | - } |
|
637 | + return $spotter_array; |
|
638 | + } |
|
639 | 639 | |
640 | 640 | |
641 | - /** |
|
642 | - * Gets all the spotter information based on a particular callsign |
|
643 | - * |
|
644 | - * @return Array the spotter information |
|
645 | - * |
|
646 | - */ |
|
641 | + /** |
|
642 | + * Gets all the spotter information based on a particular callsign |
|
643 | + * |
|
644 | + * @return Array the spotter information |
|
645 | + * |
|
646 | + */ |
|
647 | 647 | public function getLastLiveSpotterDataByIdent($ident) |
648 | 648 | { |
649 | 649 | $Spotter = new Spotter($this->db); |
650 | 650 | date_default_timezone_set('UTC'); |
651 | 651 | |
652 | 652 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
653 | - $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'; |
|
653 | + $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'; |
|
654 | 654 | |
655 | 655 | $spotter_array = $Spotter->getDataFromDB($query,array(':ident' => $ident),'',true); |
656 | 656 | |
657 | 657 | return $spotter_array; |
658 | 658 | } |
659 | 659 | |
660 | - /** |
|
661 | - * Gets all the spotter information based on a particular callsign |
|
662 | - * |
|
663 | - * @return Array the spotter information |
|
664 | - * |
|
665 | - */ |
|
660 | + /** |
|
661 | + * Gets all the spotter information based on a particular callsign |
|
662 | + * |
|
663 | + * @return Array the spotter information |
|
664 | + * |
|
665 | + */ |
|
666 | 666 | public function getDateLiveSpotterDataByIdent($ident,$date) |
667 | 667 | { |
668 | 668 | $Spotter = new Spotter($this->db); |
669 | 669 | date_default_timezone_set('UTC'); |
670 | 670 | |
671 | 671 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
672 | - $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'; |
|
672 | + $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'; |
|
673 | 673 | |
674 | - $date = date('c',$date); |
|
674 | + $date = date('c',$date); |
|
675 | 675 | $spotter_array = $Spotter->getDataFromDB($query,array(':ident' => $ident,':date' => $date)); |
676 | 676 | |
677 | 677 | return $spotter_array; |
678 | 678 | } |
679 | 679 | |
680 | - /** |
|
681 | - * Gets last spotter information based on a particular callsign |
|
682 | - * |
|
683 | - * @return Array the spotter information |
|
684 | - * |
|
685 | - */ |
|
680 | + /** |
|
681 | + * Gets last spotter information based on a particular callsign |
|
682 | + * |
|
683 | + * @return Array the spotter information |
|
684 | + * |
|
685 | + */ |
|
686 | 686 | public function getLastLiveSpotterDataById($id) |
687 | 687 | { |
688 | 688 | $Spotter = new Spotter($this->db); |
@@ -693,12 +693,12 @@ discard block |
||
693 | 693 | return $spotter_array; |
694 | 694 | } |
695 | 695 | |
696 | - /** |
|
697 | - * Gets last spotter information based on a particular callsign |
|
698 | - * |
|
699 | - * @return Array the spotter information |
|
700 | - * |
|
701 | - */ |
|
696 | + /** |
|
697 | + * Gets last spotter information based on a particular callsign |
|
698 | + * |
|
699 | + * @return Array the spotter information |
|
700 | + * |
|
701 | + */ |
|
702 | 702 | public function getDateLiveSpotterDataById($id,$date) |
703 | 703 | { |
704 | 704 | $Spotter = new Spotter($this->db); |
@@ -711,21 +711,21 @@ discard block |
||
711 | 711 | return $spotter_array; |
712 | 712 | } |
713 | 713 | |
714 | - /** |
|
715 | - * Gets altitude information based on a particular callsign |
|
716 | - * |
|
717 | - * @return Array the spotter information |
|
718 | - * |
|
719 | - */ |
|
714 | + /** |
|
715 | + * Gets altitude information based on a particular callsign |
|
716 | + * |
|
717 | + * @return Array the spotter information |
|
718 | + * |
|
719 | + */ |
|
720 | 720 | public function getAltitudeLiveSpotterDataByIdent($ident) |
721 | 721 | { |
722 | 722 | |
723 | 723 | date_default_timezone_set('UTC'); |
724 | 724 | |
725 | 725 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
726 | - $query = 'SELECT spotter_live.altitude, spotter_live.date FROM spotter_live WHERE spotter_live.ident = :ident'; |
|
726 | + $query = 'SELECT spotter_live.altitude, spotter_live.date FROM spotter_live WHERE spotter_live.ident = :ident'; |
|
727 | 727 | |
728 | - try { |
|
728 | + try { |
|
729 | 729 | |
730 | 730 | $sth = $this->db->prepare($query); |
731 | 731 | $sth->execute(array(':ident' => $ident)); |
@@ -738,12 +738,12 @@ discard block |
||
738 | 738 | return $spotter_array; |
739 | 739 | } |
740 | 740 | |
741 | - /** |
|
742 | - * Gets all the spotter information based on a particular id |
|
743 | - * |
|
744 | - * @return Array the spotter information |
|
745 | - * |
|
746 | - */ |
|
741 | + /** |
|
742 | + * Gets all the spotter information based on a particular id |
|
743 | + * |
|
744 | + * @return Array the spotter information |
|
745 | + * |
|
746 | + */ |
|
747 | 747 | public function getAllLiveSpotterDataById($id,$liveinterval = false) |
748 | 748 | { |
749 | 749 | global $globalDBdriver, $globalLiveInterval; |
@@ -771,18 +771,18 @@ discard block |
||
771 | 771 | return $spotter_array; |
772 | 772 | } |
773 | 773 | |
774 | - /** |
|
775 | - * Gets all the spotter information based on a particular ident |
|
776 | - * |
|
777 | - * @return Array the spotter information |
|
778 | - * |
|
779 | - */ |
|
774 | + /** |
|
775 | + * Gets all the spotter information based on a particular ident |
|
776 | + * |
|
777 | + * @return Array the spotter information |
|
778 | + * |
|
779 | + */ |
|
780 | 780 | public function getAllLiveSpotterDataByIdent($ident) |
781 | 781 | { |
782 | 782 | date_default_timezone_set('UTC'); |
783 | 783 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
784 | 784 | $query = self::$global_query.' WHERE spotter_live.ident = :ident'; |
785 | - try { |
|
785 | + try { |
|
786 | 786 | |
787 | 787 | $sth = $this->db->prepare($query); |
788 | 788 | $sth->execute(array(':ident' => $ident)); |
@@ -796,23 +796,23 @@ discard block |
||
796 | 796 | |
797 | 797 | |
798 | 798 | /** |
799 | - * Deletes all info in the table |
|
800 | - * |
|
801 | - * @return String success or false |
|
802 | - * |
|
803 | - */ |
|
799 | + * Deletes all info in the table |
|
800 | + * |
|
801 | + * @return String success or false |
|
802 | + * |
|
803 | + */ |
|
804 | 804 | public function deleteLiveSpotterData() |
805 | 805 | { |
806 | 806 | global $globalDBdriver; |
807 | 807 | if ($globalDBdriver == 'mysql') { |
808 | 808 | //$query = "DELETE FROM spotter_live WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL 30 MINUTE) >= spotter_live.date"; |
809 | 809 | $query = 'DELETE FROM spotter_live WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL 9 HOUR) >= spotter_live.date'; |
810 | - //$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)"; |
|
810 | + //$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)"; |
|
811 | 811 | } else { |
812 | 812 | $query = "DELETE FROM spotter_live WHERE NOW() AT TIME ZONE 'UTC' - INTERVAL '9 HOURS' >= spotter_live.date"; |
813 | 813 | } |
814 | 814 | |
815 | - try { |
|
815 | + try { |
|
816 | 816 | |
817 | 817 | $sth = $this->db->prepare($query); |
818 | 818 | $sth->execute(); |
@@ -824,18 +824,18 @@ discard block |
||
824 | 824 | } |
825 | 825 | |
826 | 826 | /** |
827 | - * Deletes all info in the table for aircraft not seen since 2 HOUR |
|
828 | - * |
|
829 | - * @return String success or false |
|
830 | - * |
|
831 | - */ |
|
827 | + * Deletes all info in the table for aircraft not seen since 2 HOUR |
|
828 | + * |
|
829 | + * @return String success or false |
|
830 | + * |
|
831 | + */ |
|
832 | 832 | public function deleteLiveSpotterDataNotUpdated() |
833 | 833 | { |
834 | 834 | global $globalDBdriver, $globalDebug; |
835 | 835 | if ($globalDBdriver == 'mysql') { |
836 | 836 | //$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'; |
837 | - $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"; |
|
838 | - try { |
|
837 | + $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"; |
|
838 | + try { |
|
839 | 839 | |
840 | 840 | $sth = $this->db->prepare($query); |
841 | 841 | $sth->execute(); |
@@ -843,8 +843,8 @@ discard block |
||
843 | 843 | return "error"; |
844 | 844 | } |
845 | 845 | $query_delete = 'DELETE FROM spotter_live WHERE flightaware_id IN ('; |
846 | - $i = 0; |
|
847 | - $j =0; |
|
846 | + $i = 0; |
|
847 | + $j =0; |
|
848 | 848 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
849 | 849 | foreach($all as $row) |
850 | 850 | { |
@@ -852,20 +852,20 @@ discard block |
||
852 | 852 | $j++; |
853 | 853 | if ($j == 30) { |
854 | 854 | if ($globalDebug) echo "."; |
855 | - try { |
|
855 | + try { |
|
856 | 856 | |
857 | 857 | $sth = $this->db->prepare(substr($query_delete,0,-1).")"); |
858 | 858 | $sth->execute(); |
859 | 859 | } catch(PDOException $e) { |
860 | 860 | return "error"; |
861 | 861 | } |
862 | - $query_delete = 'DELETE FROM spotter_live WHERE flightaware_id IN ('; |
|
863 | - $j = 0; |
|
862 | + $query_delete = 'DELETE FROM spotter_live WHERE flightaware_id IN ('; |
|
863 | + $j = 0; |
|
864 | 864 | } |
865 | 865 | $query_delete .= "'".$row['flightaware_id']."',"; |
866 | 866 | } |
867 | 867 | if ($i > 0) { |
868 | - try { |
|
868 | + try { |
|
869 | 869 | |
870 | 870 | $sth = $this->db->prepare(substr($query_delete,0,-1).")"); |
871 | 871 | $sth->execute(); |
@@ -876,9 +876,9 @@ discard block |
||
876 | 876 | return "success"; |
877 | 877 | } elseif ($globalDBdriver == 'pgsql') { |
878 | 878 | //$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"; |
879 | - //$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"; |
|
880 | - $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)"; |
|
881 | - try { |
|
879 | + //$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"; |
|
880 | + $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)"; |
|
881 | + try { |
|
882 | 882 | |
883 | 883 | $sth = $this->db->prepare($query); |
884 | 884 | $sth->execute(); |
@@ -922,17 +922,17 @@ discard block |
||
922 | 922 | } |
923 | 923 | |
924 | 924 | /** |
925 | - * Deletes all info in the table for an ident |
|
926 | - * |
|
927 | - * @return String success or false |
|
928 | - * |
|
929 | - */ |
|
925 | + * Deletes all info in the table for an ident |
|
926 | + * |
|
927 | + * @return String success or false |
|
928 | + * |
|
929 | + */ |
|
930 | 930 | public function deleteLiveSpotterDataByIdent($ident) |
931 | 931 | { |
932 | 932 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
933 | 933 | $query = 'DELETE FROM spotter_live WHERE ident = :ident'; |
934 | 934 | |
935 | - try { |
|
935 | + try { |
|
936 | 936 | |
937 | 937 | $sth = $this->db->prepare($query); |
938 | 938 | $sth->execute(array(':ident' => $ident)); |
@@ -944,17 +944,17 @@ discard block |
||
944 | 944 | } |
945 | 945 | |
946 | 946 | /** |
947 | - * Deletes all info in the table for an id |
|
948 | - * |
|
949 | - * @return String success or false |
|
950 | - * |
|
951 | - */ |
|
947 | + * Deletes all info in the table for an id |
|
948 | + * |
|
949 | + * @return String success or false |
|
950 | + * |
|
951 | + */ |
|
952 | 952 | public function deleteLiveSpotterDataById($id) |
953 | 953 | { |
954 | 954 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
955 | 955 | $query = 'DELETE FROM spotter_live WHERE flightaware_id = :id'; |
956 | 956 | |
957 | - try { |
|
957 | + try { |
|
958 | 958 | |
959 | 959 | $sth = $this->db->prepare($query); |
960 | 960 | $sth->execute(array(':id' => $id)); |
@@ -967,11 +967,11 @@ discard block |
||
967 | 967 | |
968 | 968 | |
969 | 969 | /** |
970 | - * Gets the aircraft ident within the last hour |
|
971 | - * |
|
972 | - * @return String the ident |
|
973 | - * |
|
974 | - */ |
|
970 | + * Gets the aircraft ident within the last hour |
|
971 | + * |
|
972 | + * @return String the ident |
|
973 | + * |
|
974 | + */ |
|
975 | 975 | public function getIdentFromLastHour($ident) |
976 | 976 | { |
977 | 977 | global $globalDBdriver, $globalTimezone; |
@@ -997,14 +997,14 @@ discard block |
||
997 | 997 | $ident_result = $row['ident']; |
998 | 998 | } |
999 | 999 | return $ident_result; |
1000 | - } |
|
1000 | + } |
|
1001 | 1001 | |
1002 | 1002 | /** |
1003 | - * Check recent aircraft |
|
1004 | - * |
|
1005 | - * @return String the ident |
|
1006 | - * |
|
1007 | - */ |
|
1003 | + * Check recent aircraft |
|
1004 | + * |
|
1005 | + * @return String the ident |
|
1006 | + * |
|
1007 | + */ |
|
1008 | 1008 | public function checkIdentRecent($ident) |
1009 | 1009 | { |
1010 | 1010 | global $globalDBdriver, $globalTimezone; |
@@ -1030,14 +1030,14 @@ discard block |
||
1030 | 1030 | $ident_result = $row['flightaware_id']; |
1031 | 1031 | } |
1032 | 1032 | return $ident_result; |
1033 | - } |
|
1033 | + } |
|
1034 | 1034 | |
1035 | 1035 | /** |
1036 | - * Check recent aircraft by id |
|
1037 | - * |
|
1038 | - * @return String the ident |
|
1039 | - * |
|
1040 | - */ |
|
1036 | + * Check recent aircraft by id |
|
1037 | + * |
|
1038 | + * @return String the ident |
|
1039 | + * |
|
1040 | + */ |
|
1041 | 1041 | public function checkIdRecent($id) |
1042 | 1042 | { |
1043 | 1043 | global $globalDBdriver, $globalTimezone; |
@@ -1063,14 +1063,14 @@ discard block |
||
1063 | 1063 | $ident_result = $row['flightaware_id']; |
1064 | 1064 | } |
1065 | 1065 | return $ident_result; |
1066 | - } |
|
1066 | + } |
|
1067 | 1067 | |
1068 | 1068 | /** |
1069 | - * Check recent aircraft by ModeS |
|
1070 | - * |
|
1071 | - * @return String the ModeS |
|
1072 | - * |
|
1073 | - */ |
|
1069 | + * Check recent aircraft by ModeS |
|
1070 | + * |
|
1071 | + * @return String the ModeS |
|
1072 | + * |
|
1073 | + */ |
|
1074 | 1074 | public function checkModeSRecent($modes) |
1075 | 1075 | { |
1076 | 1076 | global $globalDBdriver, $globalTimezone; |
@@ -1100,11 +1100,11 @@ discard block |
||
1100 | 1100 | } |
1101 | 1101 | |
1102 | 1102 | /** |
1103 | - * Gets the aircraft data from the last 20 seconds |
|
1104 | - * |
|
1105 | - * @return Array the spotter data |
|
1106 | - * |
|
1107 | - */ |
|
1103 | + * Gets the aircraft data from the last 20 seconds |
|
1104 | + * |
|
1105 | + * @return Array the spotter data |
|
1106 | + * |
|
1107 | + */ |
|
1108 | 1108 | public function getRealTimeData($q = '') |
1109 | 1109 | { |
1110 | 1110 | global $globalDBdriver; |
@@ -1146,16 +1146,16 @@ discard block |
||
1146 | 1146 | } |
1147 | 1147 | |
1148 | 1148 | /** |
1149 | - * Adds a new spotter data |
|
1150 | - * |
|
1151 | - * @param String $flightaware_id the ID from flightaware |
|
1152 | - * @param String $ident the flight ident |
|
1153 | - * @param String $aircraft_icao the aircraft type |
|
1154 | - * @param String $departure_airport_icao the departure airport |
|
1155 | - * @param String $arrival_airport_icao the arrival airport |
|
1156 | - * @return String success or false |
|
1157 | - * |
|
1158 | - */ |
|
1149 | + * Adds a new spotter data |
|
1150 | + * |
|
1151 | + * @param String $flightaware_id the ID from flightaware |
|
1152 | + * @param String $ident the flight ident |
|
1153 | + * @param String $aircraft_icao the aircraft type |
|
1154 | + * @param String $departure_airport_icao the departure airport |
|
1155 | + * @param String $arrival_airport_icao the arrival airport |
|
1156 | + * @return String success or false |
|
1157 | + * |
|
1158 | + */ |
|
1159 | 1159 | 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 = '') |
1160 | 1160 | { |
1161 | 1161 | global $globalURL, $globalArchive, $globalDebug; |
@@ -1298,10 +1298,10 @@ discard block |
||
1298 | 1298 | $arrival_airport_country = ''; |
1299 | 1299 | |
1300 | 1300 | |
1301 | - if ($squawk == '' || $Common->isInteger($squawk) === false ) $squawk = NULL; |
|
1302 | - if ($verticalrate == '' || $Common->isInteger($verticalrate) === false ) $verticalrate = NULL; |
|
1303 | - if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) $groundspeed = 0; |
|
1304 | - if ($heading == '' || $Common->isInteger($heading) === false ) $heading = 0; |
|
1301 | + if ($squawk == '' || $Common->isInteger($squawk) === false ) $squawk = NULL; |
|
1302 | + if ($verticalrate == '' || $Common->isInteger($verticalrate) === false ) $verticalrate = NULL; |
|
1303 | + if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) $groundspeed = 0; |
|
1304 | + if ($heading == '' || $Common->isInteger($heading) === false ) $heading = 0; |
|
1305 | 1305 | |
1306 | 1306 | $query = ''; |
1307 | 1307 | if ($globalArchive) { |
@@ -1322,10 +1322,10 @@ discard block |
||
1322 | 1322 | return "error : ".$e->getMessage(); |
1323 | 1323 | } |
1324 | 1324 | if (isset($globalArchive) && $globalArchive && $putinarchive && $noarchive !== true) { |
1325 | - if ($globalDebug) echo '(Add to Spotter archive : '; |
|
1326 | - $SpotterArchive = new SpotterArchive($this->db); |
|
1327 | - $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); |
|
1328 | - if ($globalDebug) echo $result.')'; |
|
1325 | + if ($globalDebug) echo '(Add to Spotter archive : '; |
|
1326 | + $SpotterArchive = new SpotterArchive($this->db); |
|
1327 | + $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); |
|
1328 | + if ($globalDebug) echo $result.')'; |
|
1329 | 1329 | } elseif ($globalDebug && $putinarchive !== true) { |
1330 | 1330 | echo '(Not adding to archive)'; |
1331 | 1331 | } elseif ($globalDebug && $noarchive === true) { |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | <?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 } ?> |
56 | 56 | </tr></table></div> |
57 | 57 | <?php |
58 | - if ((!isset($_COOKIE['MapFormat']) && isset($globalMap3Ddefault) && $globalMap3Ddefault) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d')) { |
|
58 | + if ((!isset($_COOKIE['MapFormat']) && isset($globalMap3Ddefault) && $globalMap3Ddefault) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d')) { |
|
59 | 59 | ?> |
60 | 60 | <script src="<?php echo $globalURL; ?>/js/map.3d.js.php<?php if (isset($tsk)) print '?tsk='.$tsk; ?>"></script> |
61 | 61 | <script src="<?php echo $globalURL; ?>/js/meuusjs.1.0.3.min.js"></script> |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | <script src="<?php echo $globalURL; ?>/js/map-marine.3d.js.php"></script> |
82 | 82 | <?php |
83 | 83 | } |
84 | - } |
|
84 | + } |
|
85 | 85 | ?> |
86 | 86 | |
87 | 87 | <div id="sidebar" class="sidebar collapsed"> |
@@ -92,13 +92,13 @@ discard block |
||
92 | 92 | <li><a href="" onclick="getUserLocation(); return false;" title="<?php echo _("Plot your Location"); ?>"><i class="fa fa-map-marker"></i></a></li> |
93 | 93 | <li><a href="" onclick="getCompassDirection(); return false;" title="<?php echo _("Compass Mode"); ?>"><i class="fa fa-compass"></i></a></li> |
94 | 94 | <?php |
95 | - //if ((isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d') || (isset($globalBeta) && $globalBeta === TRUE)) { |
|
95 | + //if ((isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d') || (isset($globalBeta) && $globalBeta === TRUE)) { |
|
96 | 96 | if (isset($globalArchive) && $globalArchive == TRUE && (!isset($globalAircraft) || $globalAircraft === TRUE)) { |
97 | 97 | ?> |
98 | 98 | <li><a href="#archive" role="tab" title="<?php echo _("Archive"); ?>"><i class="fa fa-archive"></i></a></li> |
99 | 99 | <?php |
100 | 100 | } |
101 | - //} |
|
101 | + //} |
|
102 | 102 | ?> |
103 | 103 | <li><a href="#home" role="tab" title="<?php echo _("Layers"); ?>"><i class="fa fa-map"></i></a></li> |
104 | 104 | <li><a href="#filters" role="tab" title="<?php echo _("Filters"); ?>"><i class="fa fa-filter"></i></a></li> |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | ?> |
113 | 113 | |
114 | 114 | <?php |
115 | - if (isset($globalMap3D) && $globalMap3D) { |
|
115 | + if (isset($globalMap3D) && $globalMap3D) { |
|
116 | 116 | if ((!isset($_COOKIE['MapFormat']) && (!isset($globalMap3Ddefault) || !$globalMap3Ddefault)) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] != '3d')) { |
117 | 117 | ?> |
118 | 118 | <li><a href="" onclick="show3D(); return false;" role="tab" title="3D"><b>3D</b></a></li> |
@@ -122,7 +122,7 @@ discard block |
||
122 | 122 | <li><a href="" onclick="show2D(); return false;" role="tab" title="2D"><b>2D</b></a></li> |
123 | 123 | <?php |
124 | 124 | } |
125 | - } |
|
125 | + } |
|
126 | 126 | ?> |
127 | 127 | </ul> |
128 | 128 | |
@@ -306,15 +306,15 @@ discard block |
||
306 | 306 | </div> |
307 | 307 | </li> |
308 | 308 | <?php |
309 | - if (isset($globalDemo) && $globalDemo) { |
|
309 | + if (isset($globalDemo) && $globalDemo) { |
|
310 | 310 | ?> |
311 | 311 | <li><button type="button" class="btn btn-primary disabled"><?php echo _("Show archive"); ?></button> Disabled in Demo mode</li> |
312 | 312 | <?php |
313 | - } else { |
|
313 | + } else { |
|
314 | 314 | ?> |
315 | 315 | <li><button type="button" onclick="addarchive(begindate,enddate);" class="btn btn-primary"><?php echo _("Show archive"); ?></button></li> |
316 | 316 | <?php |
317 | - } |
|
317 | + } |
|
318 | 318 | ?> |
319 | 319 | </ul> |
320 | 320 | <ul> |
@@ -333,82 +333,82 @@ discard block |
||
333 | 333 | if ((!isset($_COOKIE['MapFormat']) && (!isset($globalMap3Ddefault) || !$globalMap3Ddefault)) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] != '3d')) { |
334 | 334 | if (!isset($_COOKIE['MapType']) || $_COOKIE['MapType'] == '') $MapType = $globalMapProvider; |
335 | 335 | else $MapType = $_COOKIE['MapType']; |
336 | - ?> |
|
336 | + ?> |
|
337 | 337 | <select class="selectpicker" onchange="mapType(this);"> |
338 | 338 | <?php |
339 | 339 | } else { |
340 | 340 | if (!isset($_COOKIE['MapType3D']) || $_COOKIE['MapType3D'] == '') $MapType = $globalMapProvider; |
341 | 341 | else $MapType = $_COOKIE['MapType3D']; |
342 | - ?> |
|
342 | + ?> |
|
343 | 343 | <select class="selectpicker" onchange="mapType3D(this);"> |
344 | 344 | <?php |
345 | 345 | } |
346 | - ?> |
|
346 | + ?> |
|
347 | 347 | <?php |
348 | 348 | if (isset($globalMapOffline) && $globalMapOffline === TRUE) { |
349 | - ?> |
|
349 | + ?> |
|
350 | 350 | <option value="offline"<?php if ($MapType == 'offline') print ' selected'; ?>>Natural Earth (local)</option> |
351 | 351 | <?php |
352 | 352 | } else { |
353 | - if (file_exists(dirname(__FILE__).'/js/Cesium/Assets/Textures/NaturalEarthII/tilemapresource.xml')) { |
|
354 | - ?> |
|
353 | + if (file_exists(dirname(__FILE__).'/js/Cesium/Assets/Textures/NaturalEarthII/tilemapresource.xml')) { |
|
354 | + ?> |
|
355 | 355 | <option value="offline"<?php if ($MapType == 'offline') print ' selected'; ?>>Natural Earth (local)</option> |
356 | 356 | <?php |
357 | - } |
|
358 | - ?> |
|
357 | + } |
|
358 | + ?> |
|
359 | 359 | <option value="ArcGIS-Streetmap"<?php if ($MapType == 'ArcGIS-Streetmap') print ' selected'; ?>>ArcGIS Streetmap</option> |
360 | 360 | <option value="ArcGIS-Satellite"<?php if ($MapType == 'ArcGIS-Satellite') print ' selected'; ?>>ArcGIS Satellite</option> |
361 | 361 | <option value="ArcGIS-Satellite"<?php if ($MapType == 'ArcGIS-Ocean') print ' selected'; ?>>ArcGIS Ocean</option> |
362 | 362 | <?php |
363 | - if (isset($globalBingMapKey) && $globalBingMapKey != '') { |
|
364 | - ?> |
|
363 | + if (isset($globalBingMapKey) && $globalBingMapKey != '') { |
|
364 | + ?> |
|
365 | 365 | <option value="Bing-Aerial"<?php if ($MapType == 'Bing-Aerial') print ' selected'; ?>>Bing-Aerial</option> |
366 | 366 | <option value="Bing-Hybrid"<?php if ($MapType == 'Bing-Hybrid') print ' selected'; ?>>Bing-Hybrid</option> |
367 | 367 | <option value="Bing-Road"<?php if ($MapType == 'Bing-Road') print ' selected'; ?>>Bing-Road</option> |
368 | 368 | <?php |
369 | - } |
|
370 | - ?> |
|
369 | + } |
|
370 | + ?> |
|
371 | 371 | <?php |
372 | - if ((!isset($_COOKIE['MapFormat']) && (!isset($globalMap3Ddefault) || !$globalMap3Ddefault)) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] != '3d')) { |
|
373 | - ?> |
|
372 | + if ((!isset($_COOKIE['MapFormat']) && (!isset($globalMap3Ddefault) || !$globalMap3Ddefault)) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] != '3d')) { |
|
373 | + ?> |
|
374 | 374 | <?php |
375 | 375 | if (isset($globalHereappId) && $globalHereappId != '' && isset($globalHereappCode) && $globalHereappCode != '') { |
376 | - ?> |
|
376 | + ?> |
|
377 | 377 | <option value="Here-Aerial"<?php if ($MapType == 'Here-Aerial') print ' selected'; ?>>Here-Aerial</option> |
378 | 378 | <option value="Here-Hybrid"<?php if ($MapType == 'Here-Hybrid') print ' selected'; ?>>Here-Hybrid</option> |
379 | 379 | <option value="Here-Road"<?php if ($MapType == 'Here-Road') print ' selected'; ?>>Here-Road</option> |
380 | 380 | <?php |
381 | 381 | } |
382 | - ?> |
|
382 | + ?> |
|
383 | 383 | <?php |
384 | 384 | if (isset($globalGoogleAPIKey) && $globalGoogleAPIKey != '') { |
385 | - ?> |
|
385 | + ?> |
|
386 | 386 | <option value="Google-Roadmap"<?php if ($MapType == 'Google-Roadmap') print ' selected'; ?>>Google Roadmap</option> |
387 | 387 | <option value="Google-Satellite"<?php if ($MapType == 'Google-Satellite') print ' selected'; ?>>Google Satellite</option> |
388 | 388 | <option value="Google-Hybrid"<?php if ($MapType == 'Google-Hybrid') print ' selected'; ?>>Google Hybrid</option> |
389 | 389 | <option value="Google-Terrain"<?php if ($MapType == 'Google-Terrain') print ' selected'; ?>>Google Terrain</option> |
390 | 390 | <?php |
391 | 391 | } |
392 | - ?> |
|
392 | + ?> |
|
393 | 393 | <?php |
394 | 394 | if (isset($globalMapQuestKey) && $globalMapQuestKey != '') { |
395 | - ?> |
|
395 | + ?> |
|
396 | 396 | <option value="MapQuest-OSM"<?php if ($MapType == 'MapQuest-OSM') print ' selected'; ?>>MapQuest-OSM</option> |
397 | 397 | <option value="MapQuest-Aerial"<?php if ($MapType == 'MapQuest-Aerial') print ' selected'; ?>>MapQuest-Aerial</option> |
398 | 398 | <option value="MapQuest-Hybrid"<?php if ($MapType == 'MapQuest-Hybrid') print ' selected'; ?>>MapQuest-Hybrid</option> |
399 | 399 | <?php |
400 | 400 | } |
401 | - ?> |
|
401 | + ?> |
|
402 | 402 | <option value="offline"<?php if ($MapType == 'offline') print ' selected'; ?>>Natural Earth</option> |
403 | 403 | <?php |
404 | - } |
|
405 | - ?> |
|
404 | + } |
|
405 | + ?> |
|
406 | 406 | <option value="NatGeo-Street"<?php if ($MapType == 'NatGeo-Street') print ' selected'; ?>>National Geographic Street</option> |
407 | 407 | <?php |
408 | - if (isset($globalMapboxToken) && $globalMapboxToken != '') { |
|
408 | + if (isset($globalMapboxToken) && $globalMapboxToken != '') { |
|
409 | 409 | if (!isset($_COOKIE['MapTypeId'])) $MapBoxId = 'default'; |
410 | 410 | else $MapBoxId = $_COOKIE['MapTypeId']; |
411 | - ?> |
|
411 | + ?> |
|
412 | 412 | <option value="MapboxGL"<?php if ($MapType == 'MapboxGL') print ' selected'; ?>>Mapbox GL</option> |
413 | 413 | <option value="Mapbox-default"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'default') print ' selected'; ?>>Mapbox default</option> |
414 | 414 | <option value="Mapbox-mapbox.streets"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.streets') print ' selected'; ?>>Mapbox streets</option> |
@@ -423,17 +423,17 @@ discard block |
||
423 | 423 | <option value="Mapbox-mapbox.pirates"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.pirates') print ' selected'; ?>>Mapbox pirates</option> |
424 | 424 | <option value="Mapbox-mapbox.emerald"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.emerald') print ' selected'; ?>>Mapbox emerald</option> |
425 | 425 | <?php |
426 | - } |
|
427 | - ?> |
|
426 | + } |
|
427 | + ?> |
|
428 | 428 | <option value="OpenStreetMap"<?php if ($MapType == 'OpenStreetMap') print ' selected'; ?>>OpenStreetMap</option> |
429 | 429 | <option value="Yandex"<?php if ($MapType == 'Yandex') print ' selected'; ?>>Yandex</option> |
430 | 430 | <?php |
431 | 431 | } |
432 | - ?> |
|
432 | + ?> |
|
433 | 433 | </select> |
434 | 434 | </li> |
435 | 435 | <?php |
436 | - if (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d' && (!isset($globalMapOffline) || $globalMapOffline === FALSE)) { |
|
436 | + if (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d' && (!isset($globalMapOffline) || $globalMapOffline === FALSE)) { |
|
437 | 437 | ?> |
438 | 438 | <li><?php echo _("Type of Terrain:"); ?> |
439 | 439 | <select class="selectpicker" onchange="terrainType(this);"> |
@@ -444,18 +444,18 @@ discard block |
||
444 | 444 | </select> |
445 | 445 | </li> |
446 | 446 | <?php |
447 | - } |
|
447 | + } |
|
448 | 448 | ?> |
449 | 449 | |
450 | 450 | <?php |
451 | - if (isset($globalMap3D) && $globalMap3D) { |
|
451 | + if (isset($globalMap3D) && $globalMap3D) { |
|
452 | 452 | ?> |
453 | 453 | <li><div class="checkbox"><label><input type="checkbox" name="synchro2d3d" value="1" onclick="clickSyncMap2D3D(this)" <?php if (isset($_COOKIE['Map2D3DSync']) && $_COOKIE['Map2D3DSync'] == 'true') print 'checked'; ?> ><?php echo _("Use same type of map for 2D & 3D"); ?></label></div></li> |
454 | 454 | <?php |
455 | - } |
|
455 | + } |
|
456 | 456 | ?> |
457 | 457 | <?php |
458 | - if (!isset($_COOKIE['MapFormat']) || $_COOKIE['MapFormat'] != '3d') { |
|
458 | + if (!isset($_COOKIE['MapFormat']) || $_COOKIE['MapFormat'] != '3d') { |
|
459 | 459 | ?> |
460 | 460 | <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> |
461 | 461 | |
@@ -478,12 +478,12 @@ discard block |
||
478 | 478 | <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> |
479 | 479 | <?php |
480 | 480 | } |
481 | - } |
|
482 | - if (!isset($globalAircraft) || $globalAircraft === TRUE) { |
|
481 | + } |
|
482 | + if (!isset($globalAircraft) || $globalAircraft === TRUE) { |
|
483 | 483 | ?> |
484 | 484 | <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> |
485 | 485 | <?php |
486 | - } |
|
486 | + } |
|
487 | 487 | ?> |
488 | 488 | <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> |
489 | 489 | <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> |
@@ -502,88 +502,88 @@ discard block |
||
502 | 502 | ?> |
503 | 503 | <li><div class="checkbox"><label><input type="checkbox" name="truelight" value="1" onclick="clickTrueLight(this)" <?php if ((!isset($_COOKIE['truelight']) && (!isset($globalMapTrueLight) || $globalMapTrueLight)) || (isset($_COOKIE['truelight']) && $_COOKIE['truelight'] == 'true')) print 'checked'; ?> ><?php echo _("Enable globe sun lighting"); ?></label></div></li> |
504 | 504 | <?php |
505 | - if (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d') { |
|
505 | + if (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d') { |
|
506 | 506 | ?> |
507 | 507 | <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> |
508 | 508 | <li><div class="checkbox"><label><input type="checkbox" name="shadows" value="1" onclick="clickShadows(this)" <?php if ((!isset($_COOKIE['map3dnoshadows']) && (!isset($globalMap3DShadows) || $globalMap3DShadows)) || (isset($_COOKIE['map3dnoshadows']) && $_COOKIE['map3dnoshadows'] == 'false')) print 'checked'; ?> ><?php echo _("Use shadows"); ?></label></div></li> |
509 | 509 | <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> |
510 | 510 | <li><div class="checkbox"><label><input type="checkbox" name="updaterealtime" value="1" onclick="clickUpdateRealtime(this)" <?php if ((isset($_COOKIE['updaterealtime']) && $_COOKIE['updaterealtime'] == 'true') || !isset($_COOKIE['updaterealtime'])) print 'checked'; ?> ><?php echo _("Display realtime data in infobox"); ?></label></div></li> |
511 | 511 | <?php |
512 | - } |
|
513 | - if (time() > mktime(0,0,0,12,1,date("Y")) && time() < mktime(0,0,0,12,31,date("Y"))) { |
|
512 | + } |
|
513 | + if (time() > mktime(0,0,0,12,1,date("Y")) && time() < mktime(0,0,0,12,31,date("Y"))) { |
|
514 | 514 | ?> |
515 | 515 | <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> |
516 | 516 | <?php |
517 | - } |
|
517 | + } |
|
518 | 518 | ?> |
519 | 519 | <?php |
520 | 520 | if (function_exists('array_column')) { |
521 | - if (array_search(TRUE, array_column($globalSources, 'sourcestats')) !== FALSE) { |
|
522 | - ?> |
|
521 | + if (array_search(TRUE, array_column($globalSources, 'sourcestats')) !== FALSE) { |
|
522 | + ?> |
|
523 | 523 | <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> |
524 | 524 | <?php |
525 | - } |
|
525 | + } |
|
526 | 526 | } elseif (isset($globalSources)) { |
527 | - $dispolar = false; |
|
528 | - foreach ($globalSources as $testsource) { |
|
529 | - if (isset($globalSources['sourcestats']) && $globalSources['sourcestats'] !== FALSE) $dispolar = true; |
|
530 | - } |
|
531 | - if ($dispolar) { |
|
532 | - ?> |
|
527 | + $dispolar = false; |
|
528 | + foreach ($globalSources as $testsource) { |
|
529 | + if (isset($globalSources['sourcestats']) && $globalSources['sourcestats'] !== FALSE) $dispolar = true; |
|
530 | + } |
|
531 | + if ($dispolar) { |
|
532 | + ?> |
|
533 | 533 | <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> |
534 | 534 | <?php |
535 | - } |
|
536 | - } |
|
537 | - ?> |
|
535 | + } |
|
536 | + } |
|
537 | + ?> |
|
538 | 538 | <?php |
539 | - if (!isset($_COOKIE['MapFormat']) || $_COOKIE['MapFormat'] != '3d') { |
|
539 | + if (!isset($_COOKIE['MapFormat']) || $_COOKIE['MapFormat'] != '3d') { |
|
540 | 540 | ?> |
541 | 541 | <?php |
542 | 542 | if (!isset($globalAircraft) || $globalAircraft === TRUE) { |
543 | - ?> |
|
543 | + ?> |
|
544 | 544 | <li><?php echo _("Max number of flights to display in 2D:"); ?> <input type="number" name="2dlimit" value="<?php if (isset($_COOKIE['map_2d_limit'])) print $_COOKIE['map_2d_limit']; elseif (isset($globalMap2DAircraftsLimit)) print $globalMap2DAircraftsLimit; else print 15000; ?>" onchange="map2dlimit(this.value);" /></li> |
545 | 545 | <?php |
546 | 546 | } |
547 | - ?> |
|
547 | + ?> |
|
548 | 548 | <?php |
549 | 549 | if (!isset($globalAircraft) || $globalAircraft === TRUE) { |
550 | - if (extension_loaded('gd') && function_exists('gd_info')) { |
|
551 | - ?> |
|
550 | + if (extension_loaded('gd') && function_exists('gd_info')) { |
|
551 | + ?> |
|
552 | 552 | <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> |
553 | 553 | <?php |
554 | 554 | if (!isset($_COOKIE['IconColorAltitude']) || $_COOKIE['IconColorAltitude'] == 'false') { |
555 | - ?> |
|
555 | + ?> |
|
556 | 556 | <li><?php echo _("Aircraft icon color:"); ?> <input type="color" name="aircraftcolor" id="html5colorpicker" onchange="iconColor(this.value);" value="#<?php if (isset($_COOKIE['IconColor'])) print $_COOKIE['IconColor']; elseif (isset($globalAircraftIconColor)) print $globalAircraftIconColor; else print '1a3151'; ?>"></li> |
557 | 557 | <?php |
558 | 558 | } |
559 | - } |
|
560 | - } |
|
561 | - ?> |
|
559 | + } |
|
560 | + } |
|
561 | + ?> |
|
562 | 562 | <?php |
563 | 563 | if (isset($globalMarine) && $globalMarine === TRUE) { |
564 | - if (extension_loaded('gd') && function_exists('gd_info')) { |
|
565 | - ?> |
|
564 | + if (extension_loaded('gd') && function_exists('gd_info')) { |
|
565 | + ?> |
|
566 | 566 | <li><?php echo _("Marine icon color:"); ?> |
567 | 567 | <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'; ?>"> |
568 | 568 | </li> |
569 | 569 | <?php |
570 | - } |
|
571 | - } |
|
572 | - ?> |
|
570 | + } |
|
571 | + } |
|
572 | + ?> |
|
573 | 573 | <?php |
574 | 574 | if (isset($globalTracker) && $globalTracker === TRUE) { |
575 | - if (extension_loaded('gd') && function_exists('gd_info')) { |
|
576 | - ?> |
|
575 | + if (extension_loaded('gd') && function_exists('gd_info')) { |
|
576 | + ?> |
|
577 | 577 | <li><?php echo _("Tracker icon color:"); ?> |
578 | 578 | <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'; ?>"> |
579 | 579 | </li> |
580 | 580 | <?php |
581 | - } |
|
582 | - } |
|
583 | - ?> |
|
581 | + } |
|
582 | + } |
|
583 | + ?> |
|
584 | 584 | <?php |
585 | 585 | if (!isset($globalAircraft) || $globalAircraft === TRUE) { |
586 | - ?> |
|
586 | + ?> |
|
587 | 587 | <li><?php echo _("Show airport icon at zoom level:"); ?> |
588 | 588 | <div class="range"> |
589 | 589 | <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'; ?>"> |
@@ -592,9 +592,9 @@ discard block |
||
592 | 592 | </li> |
593 | 593 | <?php |
594 | 594 | } |
595 | - ?> |
|
595 | + ?> |
|
596 | 596 | <?php |
597 | - } elseif (isset($_COOKIE['MapFormat']) || $_COOKIE['MapFOrmat'] == '3d') { |
|
597 | + } elseif (isset($_COOKIE['MapFormat']) || $_COOKIE['MapFOrmat'] == '3d') { |
|
598 | 598 | ?> |
599 | 599 | <li><?php echo _("Set scaling factor for rendering resolution:"); ?> |
600 | 600 | <div class="range"> |
@@ -633,7 +633,7 @@ discard block |
||
633 | 633 | </li> |
634 | 634 | <?php |
635 | 635 | } |
636 | - } |
|
636 | + } |
|
637 | 637 | ?> |
638 | 638 | <li><?php echo _("Distance unit:"); ?> |
639 | 639 | <select class="selectpicker" onchange="unitdistance(this);"> |
@@ -673,19 +673,19 @@ discard block |
||
673 | 673 | <ul> |
674 | 674 | <?php |
675 | 675 | if (!isset($globalAircraft) || $globalAircraft) { |
676 | - ?> |
|
676 | + ?> |
|
677 | 677 | <?php |
678 | 678 | if (((isset($globalVATSIM) && $globalVATSIM) || isset($globalIVAO) && $globalIVAO || isset($globalphpVMS) && $globalphpVMS) && (!isset($globalMapVAchoose) || $globalMapVAchoose)) { |
679 | - ?> |
|
679 | + ?> |
|
680 | 680 | <?php if (isset($globalVATSIM) && $globalVATSIM) { ?><li><input type="checkbox" name="vatsim" value="1" onclick="clickVATSIM(this)" <?php if ((isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') || !isset($_COOKIE['filter_ShowVATSIM'])) print 'checked'; ?> ><?php echo _("Display VATSIM data"); ?></li><?php } ?> |
681 | 681 | <?php if (isset($globalIVAO) && $globalIVAO) { ?><li><input type="checkbox" name="ivao" value="1" onclick="clickIVAO(this)" <?php if ((isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') || !isset($_COOKIE['filter_ShowIVAO'])) print 'checked'; ?> ><?php echo _("Display IVAO data"); ?></li><?php } ?> |
682 | 682 | <?php if (isset($globalphpVMS) && $globalphpVMS) { ?><li><input type="checkbox" name="phpvms" value="1" onclick="clickphpVMS(this)" <?php if ((isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') || !isset($_COOKIE['filter_ShowVMS'])) print 'checked'; ?> ><?php echo _("Display phpVMS data"); ?></li><?php } ?> |
683 | 683 | <?php |
684 | 684 | } |
685 | - ?> |
|
685 | + ?> |
|
686 | 686 | <?php |
687 | 687 | if (!(isset($globalVA) && $globalVA) && !(isset($globalVATSIM) && $globalVATSIM) && !(isset($globalIVAO) && $globalIVAO) && !(isset($globalphpVMS) && $globalphpVMS) && isset($globalSBS1) && $globalSBS1 && isset($globalAPRS) && $globalAPRS && (!isset($globalMapchoose) || $globalMapchoose)) { |
688 | - ?> |
|
688 | + ?> |
|
689 | 689 | <?php if (isset($globalSBS1) && $globalSBS1) { ?> |
690 | 690 | <li><div class="checkbox"><label><input type="checkbox" name="sbs" value="1" onclick="clickSBS1(this)" <?php if ((isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') || !isset($_COOKIE['filter_ShowSBS1'])) print 'checked'; ?> ><?php echo _("Display ADS-B data"); ?></label></div></li> |
691 | 691 | <?php } ?> |
@@ -695,7 +695,7 @@ discard block |
||
695 | 695 | <li><div class="checkbox"><label><input type="checkbox" name="blocked" value="1" onclick="clickBlocked(this)" <?php if (isset($_COOKIE['filter_blocked']) && $_COOKIE['filter_blocked'] == 'true') print 'checked'; ?> ><?php echo _("Only display FAA ASDI blocked aircrafts"); ?></label></div></li> |
696 | 696 | <?php |
697 | 697 | } |
698 | - ?> |
|
698 | + ?> |
|
699 | 699 | <li><?php echo _("Display airlines:"); ?> |
700 | 700 | <br/> |
701 | 701 | <select class="selectpicker" multiple onchange="airlines(this);" id="display_airlines"> |
@@ -715,14 +715,14 @@ discard block |
||
715 | 715 | echo '<option value="'.$airline['airline_icao'].'">'.$airline_name.'</option>'; |
716 | 716 | } |
717 | 717 | } |
718 | - ?> |
|
718 | + ?> |
|
719 | 719 | </select> |
720 | 720 | </li> |
721 | 721 | <?php |
722 | 722 | $Spotter = new Spotter(); |
723 | 723 | $allalliancenames = $Spotter->getAllAllianceNames(); |
724 | 724 | if (!empty($allalliancenames)) { |
725 | - ?> |
|
725 | + ?> |
|
726 | 726 | <li><?php echo _("Display alliance:"); ?> |
727 | 727 | <br/> |
728 | 728 | <select class="selectpicker" onchange="alliance(this);" id="display_alliance"> |
@@ -736,18 +736,18 @@ discard block |
||
736 | 736 | echo '<option value="'.$alliance_name.'">'.$alliance_name.'</option>'; |
737 | 737 | } |
738 | 738 | } |
739 | - ?> |
|
739 | + ?> |
|
740 | 740 | </select> |
741 | 741 | </li> |
742 | 742 | <?php |
743 | 743 | } |
744 | - ?> |
|
744 | + ?> |
|
745 | 745 | <?php |
746 | 746 | } |
747 | - ?> |
|
747 | + ?> |
|
748 | 748 | <?php |
749 | 749 | if (isset($globalAPRS) && $globalAPRS) { |
750 | - ?> |
|
750 | + ?> |
|
751 | 751 | <li><?php echo _("Display APRS sources name:"); ?> |
752 | 752 | <select class="selectpicker" multiple onchange="sources(this);"> |
753 | 753 | <?php |
@@ -771,18 +771,18 @@ discard block |
||
771 | 771 | echo '<option value="'.$src['name'].'">'.$src['name'].'</option>'; |
772 | 772 | } |
773 | 773 | } |
774 | - ?> |
|
774 | + ?> |
|
775 | 775 | </select> |
776 | 776 | </li> |
777 | 777 | <?php |
778 | 778 | } |
779 | - ?> |
|
779 | + ?> |
|
780 | 780 | <?php |
781 | 781 | if (!isset($globalAircraft) || $globalAircraft) { |
782 | - ?> |
|
782 | + ?> |
|
783 | 783 | <?php |
784 | - if (!(isset($globalVATSIM) && $globalVATSIM) && !(isset($globalIVAO) && $globalIVAO) && !(isset($globalphpVMS) && $globalphpVMS)) { |
|
785 | - ?> |
|
784 | + if (!(isset($globalVATSIM) && $globalVATSIM) && !(isset($globalIVAO) && $globalIVAO) && !(isset($globalphpVMS) && $globalphpVMS)) { |
|
785 | + ?> |
|
786 | 786 | <li><?php echo _("Display airlines of type:"); ?><br/> |
787 | 787 | <select class="selectpicker" onchange="airlinestype(this);"> |
788 | 788 | <option value="all"<?php if (!isset($_COOKIE['filter_airlinestype']) || $_COOKIE['filter_airlinestype'] == 'all' || $_COOKIE['filter_airlinestype'] == '') echo ' selected'; ?>><?php echo _("All"); ?></option> |
@@ -792,14 +792,14 @@ discard block |
||
792 | 792 | </select> |
793 | 793 | </li> |
794 | 794 | <?php |
795 | - } |
|
796 | - ?> |
|
795 | + } |
|
796 | + ?> |
|
797 | 797 | <?php |
798 | 798 | } |
799 | - ?> |
|
799 | + ?> |
|
800 | 800 | <?php |
801 | 801 | if (isset($globalMarine) && $globalMarine) { |
802 | - ?> |
|
802 | + ?> |
|
803 | 803 | <li> |
804 | 804 | <?php echo _("Display vessels with MMSI:"); ?> |
805 | 805 | <input type="text" name="mmsifilter" onchange="mmsifilter();" id="mmsifilter" value="<?php if (isset($_COOKIE['filter_mmsi'])) print $_COOKIE['filter_mmsi']; ?>" /> |
@@ -822,7 +822,7 @@ discard block |
||
822 | 822 | print '<option value="'.$race['race_id'].'">'.$race['race_name'].'</option>'; |
823 | 823 | } |
824 | 824 | } |
825 | - ?> |
|
825 | + ?> |
|
826 | 826 | </select> |
827 | 827 | </li> |
828 | 828 | |
@@ -830,7 +830,7 @@ discard block |
||
830 | 830 | } |
831 | 831 | } |
832 | 832 | } |
833 | - ?> |
|
833 | + ?> |
|
834 | 834 | <li> |
835 | 835 | <?php echo _("Display with ident:"); ?> |
836 | 836 | <input type="text" name="identfilter" onchange="identfilter();" id="identfilter" value="<?php if (isset($_COOKIE['filter_ident'])) print $_COOKIE['filter_ident']; ?>" /> |
@@ -843,7 +843,7 @@ discard block |
||
843 | 843 | </form> |
844 | 844 | </div> |
845 | 845 | <?php |
846 | - if (isset($globalSatellite) && $globalSatellite) { |
|
846 | + if (isset($globalSatellite) && $globalSatellite) { |
|
847 | 847 | ?> |
848 | 848 | <div class="sidebar-pane" id="satellites"> |
849 | 849 | <h1 class="sidebar-header"><?php echo _("Satellites"); ?><span class="sidebar-close"><i class="fa fa-caret-left"></i></span></h1> |
@@ -883,14 +883,14 @@ discard block |
||
883 | 883 | print '<option value="'.$type['tle_type'].'">'.$type_name.'</option>'; |
884 | 884 | } |
885 | 885 | } |
886 | - ?> |
|
886 | + ?> |
|
887 | 887 | </select> |
888 | 888 | </li> |
889 | 889 | </ul> |
890 | 890 | </form> |
891 | 891 | </div> |
892 | 892 | <?php |
893 | - } |
|
893 | + } |
|
894 | 894 | ?> |
895 | 895 | </div> |
896 | 896 | </div> |
@@ -229,13 +229,13 @@ discard block |
||
229 | 229 | <p> |
230 | 230 | <label for="siteurl">Site directory</label> |
231 | 231 | <?php |
232 | - // Try to detect site directory |
|
233 | - if ((!isset($globalURL) || $globalURL == '') && (!isset($globalDBuser) || $globalDBuser == '')) { |
|
232 | + // Try to detect site directory |
|
233 | + if ((!isset($globalURL) || $globalURL == '') && (!isset($globalDBuser) || $globalDBuser == '')) { |
|
234 | 234 | if (isset($_SERVER['REQUEST_URI'])) { |
235 | 235 | $URL = $_SERVER['REQUEST_URI']; |
236 | 236 | $globalURL = str_replace('/install','',str_replace('/install/','',str_replace('/install/index.php','',$URL))); |
237 | 237 | } |
238 | - } |
|
238 | + } |
|
239 | 239 | ?> |
240 | 240 | <input type="text" name="siteurl" id="siteurl" value="<?php if (isset($globalURL)) print $globalURL; ?>" /> |
241 | 241 | <p class="help-block">ex : <i>/flightairmap</i> if complete URL is <i>http://toto.com/flightairmap</i></p> |
@@ -416,17 +416,17 @@ discard block |
||
416 | 416 | </thead> |
417 | 417 | <tbody> |
418 | 418 | <?php |
419 | - if (isset($globalDBuser) && isset($globalDBpass) && $globalDBuser != '' && $globalDBpass != '') { |
|
419 | + if (isset($globalDBuser) && isset($globalDBpass) && $globalDBuser != '' && $globalDBpass != '') { |
|
420 | 420 | ?> |
421 | 421 | <!-- |
422 | 422 | <?php |
423 | - require_once(dirname(__FILE__).'/../require/class.Connection.php'); |
|
424 | - $Connection = new Connection(); |
|
423 | + require_once(dirname(__FILE__).'/../require/class.Connection.php'); |
|
424 | + $Connection = new Connection(); |
|
425 | 425 | ?> |
426 | 426 | --> |
427 | 427 | <?php |
428 | 428 | if ($Connection->db != NULL) { |
429 | - if ($Connection->tableExists('source_location')) { |
|
429 | + if ($Connection->tableExists('source_location')) { |
|
430 | 430 | require_once(dirname(__FILE__).'/../require/class.Source.php'); |
431 | 431 | $Source = new Source(); |
432 | 432 | //$alllocations = $Source->getAllLocationInfo(); |
@@ -446,9 +446,9 @@ discard block |
||
446 | 446 | |
447 | 447 | <?php |
448 | 448 | } |
449 | - } |
|
449 | + } |
|
450 | + } |
|
450 | 451 | } |
451 | - } |
|
452 | 452 | ?> |
453 | 453 | |
454 | 454 | <tr> |
@@ -577,12 +577,12 @@ discard block |
||
577 | 577 | ?> |
578 | 578 | <tr> |
579 | 579 | <?php |
580 | - if (filter_var($source['host'],FILTER_VALIDATE_URL)) { |
|
580 | + if (filter_var($source['host'],FILTER_VALIDATE_URL)) { |
|
581 | 581 | ?> |
582 | 582 | <td><input type="text" name="host[]" value="<?php print $source['host']; ?>" /></td> |
583 | 583 | <td><input type="text" name="port[]" class="col-xs-2" value="<?php if (isset($source['port'])) print $source['port']; ?>" /></td> |
584 | 584 | <?php |
585 | - } else { |
|
585 | + } else { |
|
586 | 586 | $hostport = explode(':',$source['host']); |
587 | 587 | if (isset($hostport[1])) { |
588 | 588 | $host = $hostport[0]; |
@@ -595,7 +595,7 @@ discard block |
||
595 | 595 | <td><input type="text" name="host[]" value="<?php print $host; ?>" /></td> |
596 | 596 | <td><input type="text" name="port[]" class="col-xs-2" value="<?php print $port; ?>" /></td> |
597 | 597 | <?php |
598 | - } |
|
598 | + } |
|
599 | 599 | ?> |
600 | 600 | <td> |
601 | 601 | <select name="format[]"> |
@@ -740,9 +740,9 @@ discard block |
||
740 | 740 | </thead> |
741 | 741 | <tbody> |
742 | 742 | <?php |
743 | - if (isset($globalNewsFeeds) && !empty($globalNewsFeeds)) { |
|
743 | + if (isset($globalNewsFeeds) && !empty($globalNewsFeeds)) { |
|
744 | 744 | foreach ($globalNewsFeeds as $type => $feedslng) { |
745 | - foreach ($feedslng as $lng => $feeds) { |
|
745 | + foreach ($feedslng as $lng => $feeds) { |
|
746 | 746 | foreach ($feeds as $feed) { |
747 | 747 | ?> |
748 | 748 | <tr> |
@@ -767,9 +767,9 @@ discard block |
||
767 | 767 | |
768 | 768 | <?php |
769 | 769 | } |
770 | - } |
|
770 | + } |
|
771 | + } |
|
771 | 772 | } |
772 | - } |
|
773 | 773 | ?> |
774 | 774 | <tr> |
775 | 775 | <td><input type="url" name="newsurl[]" /></td> |
@@ -1184,7 +1184,7 @@ discard block |
||
1184 | 1184 | <p class="help-block">tsk file can be loaded using http://yourflightairmap/tsk=http://yourtskfile</p> |
1185 | 1185 | </p> |
1186 | 1186 | <?php |
1187 | - if (extension_loaded('gd') && function_exists('gd_info')) { |
|
1187 | + if (extension_loaded('gd') && function_exists('gd_info')) { |
|
1188 | 1188 | ?> |
1189 | 1189 | <br /> |
1190 | 1190 | <p> |
@@ -1215,14 +1215,14 @@ discard block |
||
1215 | 1215 | </p> |
1216 | 1216 | <?php |
1217 | 1217 | } |
1218 | - } else { |
|
1218 | + } else { |
|
1219 | 1219 | ?> |
1220 | 1220 | <br /> |
1221 | 1221 | <p> |
1222 | 1222 | <b>PHP GD is not installed, you can't change color of aircraft icon on map</b> |
1223 | 1223 | </p> |
1224 | 1224 | <?php |
1225 | - } |
|
1225 | + } |
|
1226 | 1226 | ?> |
1227 | 1227 | <br /> |
1228 | 1228 | <p> |
@@ -1245,7 +1245,7 @@ discard block |
||
1245 | 1245 | </p> |
1246 | 1246 | <?php |
1247 | 1247 | require('../footer.php'); |
1248 | - exit; |
|
1248 | + exit; |
|
1249 | 1249 | } |
1250 | 1250 | // ' |
1251 | 1251 | $settings = array(); |
@@ -1349,8 +1349,8 @@ discard block |
||
1349 | 1349 | |
1350 | 1350 | $sources = array(); |
1351 | 1351 | foreach ($source_name as $keys => $name) { |
1352 | - if (isset($source_id[$keys])) $sources[] = array('name' => $name,'latitude' => $source_latitude[$keys],'longitude' => $source_longitude[$keys],'altitude' => $source_altitude[$keys],'city' => $source_city[$keys],'country' => $source_country[$keys],'id' => $source_id[$keys],'source' => $source_ref[$keys]); |
|
1353 | - else $sources[] = array('name' => $name,'latitude' => $source_latitude[$keys],'longitude' => $source_longitude[$keys],'altitude' => $source_altitude[$keys],'city' => $source_city[$keys],'country' => $source_country[$keys],'source' => $source_ref[$keys]); |
|
1352 | + if (isset($source_id[$keys])) $sources[] = array('name' => $name,'latitude' => $source_latitude[$keys],'longitude' => $source_longitude[$keys],'altitude' => $source_altitude[$keys],'city' => $source_city[$keys],'country' => $source_country[$keys],'id' => $source_id[$keys],'source' => $source_ref[$keys]); |
|
1353 | + else $sources[] = array('name' => $name,'latitude' => $source_latitude[$keys],'longitude' => $source_longitude[$keys],'altitude' => $source_altitude[$keys],'city' => $source_city[$keys],'country' => $source_country[$keys],'source' => $source_ref[$keys]); |
|
1354 | 1354 | } |
1355 | 1355 | if (count($sources) > 0) $_SESSION['sources'] = $sources; |
1356 | 1356 | |
@@ -1360,13 +1360,13 @@ discard block |
||
1360 | 1360 | |
1361 | 1361 | $newsfeeds = array(); |
1362 | 1362 | foreach($newsurl as $newskey => $url) { |
1363 | - if ($url != '') { |
|
1363 | + if ($url != '') { |
|
1364 | 1364 | $type = $newstype[$newskey]; |
1365 | 1365 | $lng = $newslng[$newskey]; |
1366 | 1366 | if (isset($newsfeeds[$type][$lng])) { |
1367 | - $newsfeeds[$type][$lng] = array_merge($newsfeeds[$type][$lng],array($url)); |
|
1367 | + $newsfeeds[$type][$lng] = array_merge($newsfeeds[$type][$lng],array($url)); |
|
1368 | 1368 | } else $newsfeeds[$type][$lng] = array($url); |
1369 | - } |
|
1369 | + } |
|
1370 | 1370 | } |
1371 | 1371 | $settings = array_merge($settings,array('globalNewsFeeds' => $newsfeeds)); |
1372 | 1372 | |
@@ -1847,14 +1847,14 @@ discard block |
||
1847 | 1847 | |
1848 | 1848 | // Set some defaults values... |
1849 | 1849 | if (!isset($globalAircraftImageSources)) { |
1850 | - $globalAircraftImageSources = array('ivaomtl','wikimedia','airportdata','deviantart','flickr','bing','jetphotos','planepictures','planespotters'); |
|
1851 | - $settings = array_merge($settings,array('globalAircraftImageSources' => $globalAircraftImageSources)); |
|
1850 | + $globalAircraftImageSources = array('ivaomtl','wikimedia','airportdata','deviantart','flickr','bing','jetphotos','planepictures','planespotters'); |
|
1851 | + $settings = array_merge($settings,array('globalAircraftImageSources' => $globalAircraftImageSources)); |
|
1852 | 1852 | } |
1853 | 1853 | |
1854 | 1854 | if (!isset($globalSchedulesSources)) { |
1855 | - $globalSchedulesSources = array('flightmapper','costtotravel','flightradar24','flightaware'); |
|
1856 | - $settings = array_merge($settings,array('globalSchedulesSources' => $globalSchedulesSources)); |
|
1857 | - } |
|
1855 | + $globalSchedulesSources = array('flightmapper','costtotravel','flightradar24','flightaware'); |
|
1856 | + $settings = array_merge($settings,array('globalSchedulesSources' => $globalSchedulesSources)); |
|
1857 | + } |
|
1858 | 1858 | |
1859 | 1859 | $settings = array_merge($settings,array('globalInstalled' => 'TRUE')); |
1860 | 1860 | |
@@ -1902,21 +1902,21 @@ discard block |
||
1902 | 1902 | $popi = false; |
1903 | 1903 | $popw = false; |
1904 | 1904 | foreach ($_SESSION['done'] as $done) { |
1905 | - print '<li>'.$done.'....<strong>SUCCESS</strong></li>'; |
|
1906 | - if ($done == 'Create database') $pop = true; |
|
1907 | - if ($_SESSION['install'] == 'database_create') $pop = true; |
|
1908 | - if ($_SESSION['install'] == 'database_import') $popi = true; |
|
1909 | - if ($_SESSION['install'] == 'waypoints') $popw = true; |
|
1905 | + print '<li>'.$done.'....<strong>SUCCESS</strong></li>'; |
|
1906 | + if ($done == 'Create database') $pop = true; |
|
1907 | + if ($_SESSION['install'] == 'database_create') $pop = true; |
|
1908 | + if ($_SESSION['install'] == 'database_import') $popi = true; |
|
1909 | + if ($_SESSION['install'] == 'waypoints') $popw = true; |
|
1910 | 1910 | } |
1911 | 1911 | if ($pop) { |
1912 | - sleep(5); |
|
1913 | - print '<li>Create database....<img src="../images/loading.gif" /></li>'; |
|
1912 | + sleep(5); |
|
1913 | + print '<li>Create database....<img src="../images/loading.gif" /></li>'; |
|
1914 | 1914 | } else if ($popi) { |
1915 | - sleep(5); |
|
1916 | - print '<li>Create and import tables....<img src="../images/loading.gif" /></li>'; |
|
1915 | + sleep(5); |
|
1916 | + print '<li>Create and import tables....<img src="../images/loading.gif" /></li>'; |
|
1917 | 1917 | } else if ($popw) { |
1918 | - sleep(5); |
|
1919 | - print '<li>Populate waypoints database....<img src="../images/loading.gif" /></li>'; |
|
1918 | + sleep(5); |
|
1919 | + print '<li>Populate waypoints database....<img src="../images/loading.gif" /></li>'; |
|
1920 | 1920 | } else print '<li>Update schema if needed....<img src="../images/loading.gif" /></li>'; |
1921 | 1921 | print '</div></ul>'; |
1922 | 1922 | print '<div id="error"></div>'; |
@@ -1983,7 +1983,7 @@ discard block |
||
1983 | 1983 | unset($_COOKIE['install']); |
1984 | 1984 | print '<div class="info column"><ul>'; |
1985 | 1985 | foreach ($_SESSION['done'] as $done) { |
1986 | - print '<li>'.$done.'....<strong>SUCCESS</strong></li>'; |
|
1986 | + print '<li>'.$done.'....<strong>SUCCESS</strong></li>'; |
|
1987 | 1987 | } |
1988 | 1988 | print '<li>Reloading page to check all is now ok....<strong>SUCCESS</strong></li>'; |
1989 | 1989 | print '</ul></div>'; |