@@ -41,12 +41,12 @@ 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) { |
|
44 | + foreach ($sourcestat as $srcst) { |
|
45 | 45 | $type = $srcst['stats_type']; |
46 | 46 | if ($type == 'polar' || $type == 'hist') { |
47 | 47 | $source = $srcst['source_name']; |
48 | 48 | $data = $srcst['source_data']; |
49 | - $this->stats[$currentdate][$source][$type] = json_decode($data,true); |
|
49 | + $this->stats[$currentdate][$source][$type] = json_decode($data, true); |
|
50 | 50 | } |
51 | 51 | } |
52 | 52 | } |
@@ -58,14 +58,14 @@ discard block |
||
58 | 58 | if (isset($globalGeoid) && $globalGeoid) { |
59 | 59 | try { |
60 | 60 | $GeoidClass = new GeoidHeight(); |
61 | - } catch(Exception $e) { |
|
61 | + } catch (Exception $e) { |
|
62 | 62 | if ($globalDebug) echo "Can't calculate geoid, check that you downloaded it via update_db.php (".$e.")\n"; |
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 | |
@@ -90,8 +90,8 @@ discard block |
||
90 | 90 | $schedule = $Schedule->fetchSchedule($operator); |
91 | 91 | if (count($schedule) > 0 && isset($schedule['DepartureTime']) && isset($schedule['ArrivalTime'])) { |
92 | 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'])); |
|
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 | 95 | // Should also check if route schedule = route from DB |
96 | 96 | if ($schedule['DepartureAirportIATA'] != '') { |
97 | 97 | if ($this->all_flights[$id]['departure_airport'] != $Spotter->getAirportIcao($schedule['DepartureAirportIATA'])) { |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | } |
112 | 112 | } |
113 | 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']); |
|
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 | 116 | } else $scheduleexist = true; |
117 | 117 | } else $scheduleexist = true; |
@@ -119,8 +119,8 @@ discard block |
||
119 | 119 | if ($scheduleexist) { |
120 | 120 | if ($globalDebug) echo "-> get arrival/departure airport info for ".$ident."\n"; |
121 | 121 | $sch = $Schedule->getSchedule($operator); |
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 | - 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']); |
|
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 | + 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; |
@@ -147,7 +147,7 @@ discard block |
||
147 | 147 | //echo $this->all_flights[$key]['id'].' - '.$this->all_flights[$key]['latitude'].' '.$this->all_flights[$key]['longitude']."\n"; |
148 | 148 | $Spotter = new Spotter($this->db); |
149 | 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']); |
|
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 | 151 | } |
152 | 152 | } |
153 | 153 | } |
@@ -161,7 +161,7 @@ discard block |
||
161 | 161 | $airport_time = ''; |
162 | 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); |
|
164 | + $closestAirports = $Spotter->closestAirports($this->all_flights[$key]['latitude'], $this->all_flights[$key]['longitude'], $globalClosestMinDist); |
|
165 | 165 | if (isset($closestAirports[0])) { |
166 | 166 | if (isset($this->all_flights[$key]['arrival_airport']) && $this->all_flights[$key]['arrival_airport'] == $closestAirports[0]['icao']) { |
167 | 167 | $airport_icao = $closestAirports[0]['icao']; |
@@ -176,7 +176,7 @@ discard block |
||
176 | 176 | break; |
177 | 177 | } |
178 | 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))) { |
|
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 | 180 | $airport_icao = $closestAirports[0]['icao']; |
181 | 181 | $airport_time = $this->all_flights[$key]['datetime']; |
182 | 182 | } else { |
@@ -189,7 +189,7 @@ discard block |
||
189 | 189 | } else { |
190 | 190 | if ($globalDebug) echo "---- No latitude or longitude. Ident : ".$this->all_flights[$key]['ident']."\n"; |
191 | 191 | } |
192 | - return array('airport_icao' => $airport_icao,'airport_time' => $airport_time); |
|
192 | + return array('airport_icao' => $airport_icao, 'airport_time' => $airport_time); |
|
193 | 193 | } |
194 | 194 | |
195 | 195 | |
@@ -201,7 +201,7 @@ discard block |
||
201 | 201 | |
202 | 202 | foreach ($this->all_flights as $key => $flight) { |
203 | 203 | if (isset($flight['lastupdate'])) { |
204 | - if ($flight['lastupdate'] < (time()-1800)) { |
|
204 | + if ($flight['lastupdate'] < (time() - 1800)) { |
|
205 | 205 | $this->delKey($key); |
206 | 206 | } |
207 | 207 | } |
@@ -218,10 +218,10 @@ discard block |
||
218 | 218 | $Spotter = new Spotter($this->db); |
219 | 219 | $SpotterLive = new SpotterLive($this->db); |
220 | 220 | if ($this->all_flights[$key]['latitude'] != '' && $this->all_flights[$key]['longitude'] != '') { |
221 | - $result = $Spotter->updateLatestSpotterData($this->all_flights[$key]['id'],$this->all_flights[$key]['ident'],$this->all_flights[$key]['latitude'],$this->all_flights[$key]['longitude'],$this->all_flights[$key]['altitude'],$this->all_flights[$key]['ground'],$this->all_flights[$key]['speed'],$this->all_flights[$key]['datetime'],$real_arrival['airport_icao'],$real_arrival['airport_time']); |
|
221 | + $result = $Spotter->updateLatestSpotterData($this->all_flights[$key]['id'], $this->all_flights[$key]['ident'], $this->all_flights[$key]['latitude'], $this->all_flights[$key]['longitude'], $this->all_flights[$key]['altitude'], $this->all_flights[$key]['ground'], $this->all_flights[$key]['speed'], $this->all_flights[$key]['datetime'], $real_arrival['airport_icao'], $real_arrival['airport_time']); |
|
222 | 222 | if ($globalDebug && $result != 'success') echo '!!! ERROR : '.$result."\n"; |
223 | 223 | $this->all_flights[$key]['putinarchive'] = true; |
224 | - $result = $SpotterLive->addLiveSpotterData($this->all_flights[$key]['id'], $this->all_flights[$key]['ident'], $this->all_flights[$key]['aircraft_icao'], $this->all_flights[$key]['departure_airport'], $this->all_flights[$key]['arrival_airport'], $this->all_flights[$key]['latitude'], $this->all_flights[$key]['longitude'], $this->all_flights[$key]['waypoints'], $this->all_flights[$key]['altitude'],$this->all_flights[$key]['altitude_real'], $this->all_flights[$key]['heading'], $this->all_flights[$key]['speed'],$this->all_flights[$key]['datetime'], $this->all_flights[$key]['departure_airport_time'], $this->all_flights[$key]['arrival_airport_time'], $this->all_flights[$key]['squawk'],$this->all_flights[$key]['route_stop'],$this->all_flights[$key]['hex'],$this->all_flights[$key]['putinarchive'],$this->all_flights[$key]['registration'],$this->all_flights[$key]['pilot_id'],$this->all_flights[$key]['pilot_name'], $this->all_flights[$key]['verticalrate'], $this->all_flights[$key]['noarchive'], $this->all_flights[$key]['ground'],$this->all_flights[$key]['format_source'],$this->all_flights[$key]['source_name'],$this->all_flights[$key]['over_country']); |
|
224 | + $result = $SpotterLive->addLiveSpotterData($this->all_flights[$key]['id'], $this->all_flights[$key]['ident'], $this->all_flights[$key]['aircraft_icao'], $this->all_flights[$key]['departure_airport'], $this->all_flights[$key]['arrival_airport'], $this->all_flights[$key]['latitude'], $this->all_flights[$key]['longitude'], $this->all_flights[$key]['waypoints'], $this->all_flights[$key]['altitude'], $this->all_flights[$key]['altitude_real'], $this->all_flights[$key]['heading'], $this->all_flights[$key]['speed'], $this->all_flights[$key]['datetime'], $this->all_flights[$key]['departure_airport_time'], $this->all_flights[$key]['arrival_airport_time'], $this->all_flights[$key]['squawk'], $this->all_flights[$key]['route_stop'], $this->all_flights[$key]['hex'], $this->all_flights[$key]['putinarchive'], $this->all_flights[$key]['registration'], $this->all_flights[$key]['pilot_id'], $this->all_flights[$key]['pilot_name'], $this->all_flights[$key]['verticalrate'], $this->all_flights[$key]['noarchive'], $this->all_flights[$key]['ground'], $this->all_flights[$key]['format_source'], $this->all_flights[$key]['source_name'], $this->all_flights[$key]['over_country']); |
|
225 | 225 | if ($globalDebug && $result != 'success') echo '!!! ERROR : '.$result."\n"; |
226 | 226 | } |
227 | 227 | $Spotter->db = null; |
@@ -257,10 +257,10 @@ discard block |
||
257 | 257 | $send = false; |
258 | 258 | |
259 | 259 | // SBS format is CSV format |
260 | - if(is_array($line) && (isset($line['hex']) || isset($line['id']))) { |
|
260 | + if (is_array($line) && (isset($line['hex']) || isset($line['id']))) { |
|
261 | 261 | //print_r($line); |
262 | 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)) { |
|
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) { |
@@ -293,25 +293,25 @@ discard block |
||
293 | 293 | if (!isset($this->all_flights[$id])) { |
294 | 294 | if ($globalDebug) echo 'New flight...'."\n"; |
295 | 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())); |
|
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 | 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 | - 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'))); |
|
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 | 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'])); |
|
305 | + } else $this->all_flights[$id] = array_merge($this->all_flights[$id], array('id' => $line['id'])); |
|
306 | 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']))); |
|
314 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('hex' => trim($line['hex']))); |
|
315 | 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 | 317 | //} else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('datetime' => date('Y-m-d H:i:s'))); |
@@ -320,20 +320,20 @@ discard block |
||
320 | 320 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
321 | 321 | $Spotter = new Spotter($this->db); |
322 | 322 | if (isset($this->all_flights[$id]['source_type'])) { |
323 | - $aircraft_icao = $Spotter->getAllAircraftType(trim($line['hex']),$this->all_flights[$id]['source_type']); |
|
323 | + $aircraft_icao = $Spotter->getAllAircraftType(trim($line['hex']), $this->all_flights[$id]['source_type']); |
|
324 | 324 | } else { |
325 | 325 | $aircraft_icao = $Spotter->getAllAircraftType(trim($line['hex'])); |
326 | 326 | } |
327 | 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)); |
|
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 | 331 | } |
332 | 332 | if ($globalAllFlights !== FALSE) $dataFound = true; |
333 | 333 | if ($globalDebug) echo "*********** New aircraft hex : ".$line['hex']." ***********\n"; |
334 | 334 | } |
335 | 335 | if (isset($line['id']) && !isset($line['hex'])) { |
336 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('hex' => '')); |
|
336 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('hex' => '')); |
|
337 | 337 | } |
338 | 338 | if (isset($line['aircraft_icao']) && $line['aircraft_icao'] != '') { |
339 | 339 | $icao = $line['aircraft_icao']; |
@@ -342,14 +342,14 @@ discard block |
||
342 | 342 | if (isset($Spotter->aircraft_correct_icaotype[$icao])) $icao = $Spotter->aircraft_correct_icaotype[$icao]; |
343 | 343 | $Spotter->db = null; |
344 | 344 | } |
345 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('aircraft_icao' => $icao)); |
|
345 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('aircraft_icao' => $icao)); |
|
346 | 346 | } elseif (!isset($this->all_flights[$id]['aircraft_icao']) && isset($line['aircraft_name'])) { |
347 | 347 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
348 | 348 | // Get aircraft ICAO from aircraft name |
349 | 349 | $Spotter = new Spotter($this->db); |
350 | 350 | $aircraft_icao = $Spotter->getAircraftIcao($line['aircraft_name']); |
351 | 351 | $Spotter->db = null; |
352 | - if ($aircraft_icao != '') $this->all_flights[$id] = array_merge($this->all_flights[$id],array('aircraft_icao' => $aircraft_icao)); |
|
352 | + if ($aircraft_icao != '') $this->all_flights[$id] = array_merge($this->all_flights[$id], array('aircraft_icao' => $aircraft_icao)); |
|
353 | 353 | } |
354 | 354 | } |
355 | 355 | if (!isset($this->all_flights[$id]['aircraft_icao']) && isset($line['aircraft_type'])) { |
@@ -357,15 +357,15 @@ discard block |
||
357 | 357 | elseif ($line['aircraft_type'] == 'HELICOPTER_ROTORCRAFT') $aircraft_icao = 'UHEL'; |
358 | 358 | elseif ($line['aircraft_type'] == 'TOW_PLANE') $aircraft_icao = 'TOWPLANE'; |
359 | 359 | elseif ($line['aircraft_type'] == 'POWERED_AIRCRAFT') $aircraft_icao = 'POWAIRC'; |
360 | - if (isset($aircraft_icao)) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('aircraft_icao' => $aircraft_icao)); |
|
360 | + if (isset($aircraft_icao)) $this->all_flights[$id] = array_merge($this->all_flights[$id], array('aircraft_icao' => $aircraft_icao)); |
|
361 | 361 | } |
362 | 362 | if (!isset($this->all_flights[$id]['aircraft_icao'])) { |
363 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('aircraft_icao' => 'NA')); |
|
363 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('aircraft_icao' => 'NA')); |
|
364 | 364 | } |
365 | 365 | //if (isset($line['datetime']) && preg_match('/^(\d{4}(?:\-\d{2}){2} \d{2}(?:\:\d{2}){2})$/',$line['datetime'])) { |
366 | - if (isset($line['datetime']) && strtotime($line['datetime']) > time()-20*60 && strtotime($line['datetime']) < time()+20*60) { |
|
366 | + if (isset($line['datetime']) && strtotime($line['datetime']) > time() - 20*60 && strtotime($line['datetime']) < time() + 20*60) { |
|
367 | 367 | if (!isset($this->all_flights[$id]['datetime']) || strtotime($line['datetime']) >= strtotime($this->all_flights[$id]['datetime'])) { |
368 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('datetime' => $line['datetime'])); |
|
368 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('datetime' => $line['datetime'])); |
|
369 | 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"; |
@@ -376,31 +376,31 @@ discard block |
||
376 | 376 | */ |
377 | 377 | return ''; |
378 | 378 | } |
379 | - } elseif (isset($line['datetime']) && strtotime($line['datetime']) < time()-20*60) { |
|
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 ''; |
382 | - } elseif (isset($line['datetime']) && strtotime($line['datetime']) > time()+20*60) { |
|
382 | + } elseif (isset($line['datetime']) && strtotime($line['datetime']) > time() + 20*60) { |
|
383 | 383 | if ($globalDebug) echo "!!! Date is in the future ".$line['datetime']." for ".$this->all_flights[$id]['hex']." - format : ".$line['format_source']."!!!\n"; |
384 | 384 | return ''; |
385 | 385 | } elseif (!isset($line['datetime'])) { |
386 | 386 | date_default_timezone_set('UTC'); |
387 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('datetime' => date('Y-m-d H:i:s'))); |
|
387 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('datetime' => date('Y-m-d H:i:s'))); |
|
388 | 388 | } else { |
389 | 389 | if ($globalDebug) echo "!!! Unknow date error ".$this->all_flights[$id]['hex']." - format : ".$line['format_source']."!!!"; |
390 | 390 | return ''; |
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'])) { |
@@ -408,13 +408,13 @@ discard block |
||
408 | 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 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('addedSpotter' => 0)); |
|
412 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('forcenew' => 1)); |
|
413 | - 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'))); |
|
414 | - elseif (isset($line['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $line['id'])); |
|
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'])); |
|
411 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('addedSpotter' => 0)); |
|
412 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('forcenew' => 1)); |
|
413 | + 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'))); |
|
414 | + elseif (isset($line['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id], array('id' => $line['id'])); |
|
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']))); |
|
417 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('ident' => trim($line['ident']))); |
|
418 | 418 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
419 | 419 | $timeelapsed = microtime(true); |
420 | 420 | $Spotter = new Spotter($this->db); |
@@ -424,13 +424,13 @@ discard block |
||
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 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update identspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
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,25 +440,25 @@ 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 | 445 | //$putinarchive = true; |
446 | 446 | if (isset($line['departure_airport_time']) && $line['departure_airport_time'] != 0) { |
447 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('departure_airport_time' => $line['departure_airport_time'])); |
|
447 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('departure_airport_time' => $line['departure_airport_time'])); |
|
448 | 448 | } |
449 | 449 | if (isset($line['arrival_airport_time']) && $line['arrival_airport_time'] != 0) { |
450 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('arrival_airport_time' => $line['arrival_airport_time'])); |
|
450 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('arrival_airport_time' => $line['arrival_airport_time'])); |
|
451 | 451 | } |
452 | 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' => '')); |
|
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 | 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' => '')); |
|
461 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update getAirportICAO : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
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 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update getAirportICAO : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
462 | 462 | } |
463 | 463 | } elseif (!isset($line['format_source']) || $line['format_source'] != 'aprs') { |
464 | 464 | $timeelapsed = microtime(true); |
@@ -472,35 +472,35 @@ discard block |
||
472 | 472 | $Translation->db = null; |
473 | 473 | } |
474 | 474 | $Spotter->db = null; |
475 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update getrouteinfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
475 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update getrouteinfo : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
476 | 476 | } |
477 | 477 | if (isset($route['fromairport_icao']) && isset($route['toairport_icao'])) { |
478 | 478 | //if ($route['FromAirport_ICAO'] != $route['ToAirport_ICAO']) { |
479 | 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'])); |
|
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 | 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 | - if (!isset($this->all_flights[$id]['schedule_check']) || $this->all_flights[$id]['schedule_check'] === false) $this->get_Schedule($id,trim($line['ident'])); |
|
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)); |
|
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 | 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'); |
|
497 | + $distance = $Common->distance($line['latitude'], $line['longitude'], $this->all_flights[$id]['latitude'], $this->all_flights[$id]['longitude'], 'm'); |
|
498 | 498 | if ($distance > 1000 && $distance < 10000) { |
499 | 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) { |
503 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('speed' => round($speed))); |
|
503 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('speed' => round($speed))); |
|
504 | 504 | if ($globalDebug) echo "ø Calculated Speed for ".$this->all_flights[$id]['hex']." : ".round($speed)." - distance : ".$distance."\n"; |
505 | 505 | } else { |
506 | 506 | if ($globalDebug) echo "ø IGNORED : Calculated Speed for ".$this->all_flights[$id]['hex']." : ".round($speed)." - distance : ".$distance."\n"; |
@@ -515,9 +515,9 @@ discard block |
||
515 | 515 | if ($globalDebug) echo "/!\ Invalid latitude or/and longitude data : lat: ".$line['latitude']." - lng: ".$line['longitude']."\n"; |
516 | 516 | return false; |
517 | 517 | } |
518 | - if (isset($this->all_flights[$id]['time_last_coord'])) $timediff = round(time()-$this->all_flights[$id]['time_last_coord']); |
|
518 | + if (isset($this->all_flights[$id]['time_last_coord'])) $timediff = round(time() - $this->all_flights[$id]['time_last_coord']); |
|
519 | 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']); |
|
520 | + if (isset($this->all_flights[$id]['time_last_archive_coord'])) $timediff_archive = round(time() - $this->all_flights[$id]['time_last_archive_coord']); |
|
521 | 521 | else unset($timediff_archive); |
522 | 522 | if ($this->tmd > 5 |
523 | 523 | || (isset($line['format_source']) |
@@ -542,14 +542,14 @@ discard block |
||
542 | 542 | || ($timediff > 30 |
543 | 543 | && isset($this->all_flights[$id]['latitude']) |
544 | 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')) |
|
545 | + && $Common->withinThreshold($timediff, $Common->distance($line['latitude'], $line['longitude'], $this->all_flights[$id]['latitude'], $this->all_flights[$id]['longitude'], 'm')) |
|
546 | 546 | ) |
547 | 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 | 550 | if ((isset($timediff_archive) && $timediff_archive > $globalAircraftMaxUpdate) |
551 | 551 | || (isset($line['format_source']) && $line['format_source'] == 'airwhere') |
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'])) { |
|
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']; |
554 | 554 | $this->all_flights[$id]['archive_longitude'] = $line['longitude']; |
555 | 555 | $this->all_flights[$id]['putinarchive'] = true; |
@@ -563,11 +563,11 @@ discard block |
||
563 | 563 | $timeelapsed = microtime(true); |
564 | 564 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
565 | 565 | $Spotter = new Spotter($this->db); |
566 | - $all_country = $Spotter->getCountryFromLatitudeLongitude($line['latitude'],$line['longitude']); |
|
566 | + $all_country = $Spotter->getCountryFromLatitudeLongitude($line['latitude'], $line['longitude']); |
|
567 | 567 | if (!empty($all_country)) $this->all_flights[$id]['over_country'] = $all_country['iso2']; |
568 | 568 | else $this->all_flights[$id]['over_country'] = ''; |
569 | 569 | $Spotter->db = null; |
570 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update getCountryFromlatitudeLongitude : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
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 | } |
@@ -593,13 +593,13 @@ discard block |
||
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 | - 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)) { |
|
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 | 597 | $this->all_flights[$id]['livedb_latitude'] = $line['latitude']; |
598 | 598 | $dataFound = true; |
599 | 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 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('latitude' => $line['latitude'])); |
|
602 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('latitude' => $line['latitude'])); |
|
603 | 603 | /* |
604 | 604 | if (abs($this->all_flights[$id]['archive_latitude']-$this->all_flights[$id]['latitude']) > 0.3) { |
605 | 605 | $this->all_flights[$id]['archive_latitude'] = $line['latitude']; |
@@ -621,14 +621,14 @@ discard block |
||
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 | - 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)) { |
|
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 | 625 | $this->all_flights[$id]['livedb_longitude'] = $line['longitude']; |
626 | 626 | $dataFound = true; |
627 | 627 | $this->all_flights[$id]['coordinates'] += 1; |
628 | 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 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('longitude' => $line['longitude'])); |
|
631 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('longitude' => $line['longitude'])); |
|
632 | 632 | /* |
633 | 633 | if (abs($this->all_flights[$id]['archive_longitude']-$this->all_flights[$id]['longitude']) > 0.3) { |
634 | 634 | $this->all_flights[$id]['archive_longitude'] = $line['longitude']; |
@@ -649,52 +649,52 @@ discard block |
||
649 | 649 | $SpotterArchive->deleteSpotterArchiveTrackDataByID($this->all_flights[$id]['id']); |
650 | 650 | $SpotterArchive->db = null; |
651 | 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']); |
|
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 | 653 | $Spotter->db = null; |
654 | 654 | } |
655 | 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 | - echo 'Time : '.$timediff.'s - Distance : '.$Common->distance($line['latitude'],$line['longitude'],$this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],'m')."m -"; |
|
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 - "; |
|
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 | + 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 | 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'])); |
|
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'])); |
|
668 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('verticalrate' => $line['verticalrate'])); |
|
669 | 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'])); |
|
678 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('emergency' => $line['emergency'])); |
|
679 | 679 | //$dataFound = true; |
680 | 680 | } |
681 | 681 | if (isset($line['ground']) && $line['ground'] != '') { |
682 | 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 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('addedSpotter' => 0)); |
|
685 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('forcenew' => 1)); |
|
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'])); |
|
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'])); |
|
684 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('addedSpotter' => 0)); |
|
685 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('forcenew' => 1)); |
|
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'])); |
|
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 | 689 | } |
690 | 690 | if ($line['ground'] != 1) $line['ground'] = 0; |
691 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('ground' => $line['ground'])); |
|
691 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('ground' => $line['ground'])); |
|
692 | 692 | //$dataFound = true; |
693 | 693 | } |
694 | 694 | if (isset($line['squawk']) && $line['squawk'] != '') { |
695 | 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 | 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'])); |
|
697 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('squawk' => $line['squawk'])); |
|
698 | 698 | $highlight = ''; |
699 | 699 | if ($this->all_flights[$id]['squawk'] == '7500') $highlight = 'Squawk 7500 : Hijack at '.date('Y-m-d G:i').' UTC'; |
700 | 700 | if ($this->all_flights[$id]['squawk'] == '7600') $highlight = 'Squawk 7600 : Lost Comm (radio failure) at '.date('Y-m-d G:i').' UTC'; |
@@ -703,66 +703,66 @@ discard block |
||
703 | 703 | $timeelapsed = microtime(true); |
704 | 704 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
705 | 705 | $Spotter = new Spotter($this->db); |
706 | - $Spotter->setHighlightFlight($this->all_flights[$id]['id'],$highlight); |
|
706 | + $Spotter->setHighlightFlight($this->all_flights[$id]['id'], $highlight); |
|
707 | 707 | $Spotter->db = null; |
708 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update sethighlightflight : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
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'])); |
|
714 | + } else $this->all_flights[$id] = array_merge($this->all_flights[$id], array('squawk' => $line['squawk'])); |
|
715 | 715 | //$dataFound = true; |
716 | 716 | } |
717 | 717 | |
718 | 718 | if (isset($line['altitude']) && $line['altitude'] != '') { |
719 | 719 | if (isset($line['altitude_relative']) && isset($GeoidClass) && is_object($GeoidClass)) { |
720 | 720 | if ($line['altitude_relative'] == 'AMSL' || $line['altitude_relative'] == 'MSL') { |
721 | - $geoid = round($GeoidClass->get($this->all_flights[$id]['livedb_latitude'],$this->all_flights[$id]['livedb_longitude'])*3.28084,2); |
|
721 | + $geoid = round($GeoidClass->get($this->all_flights[$id]['livedb_latitude'], $this->all_flights[$id]['livedb_longitude'])*3.28084, 2); |
|
722 | 722 | //if ($globalDebug) echo '=> Set altitude to WGS84 Ellipsoid, add '.$geoid.' to '.$line['altitude']."\n"; |
723 | 723 | $line['altitude'] = $line['altitude'] - $geoid; |
724 | 724 | } |
725 | 725 | } |
726 | 726 | //if (!isset($this->all_flights[$id]['altitude']) || $this->all_flights[$id]['altitude'] == '' || ($this->all_flights[$id]['altitude'] > 0 && $line['altitude'] != 0)) { |
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 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('altitude' => round($line['altitude']/100))); |
|
729 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('altitude_real' => $line['altitude'])); |
|
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 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('altitude' => round($line['altitude']/100))); |
|
729 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('altitude_real' => $line['altitude'])); |
|
730 | 730 | //$dataFound = true; |
731 | 731 | //} elseif ($globalDebug) echo "!!! Strange altitude data... not added.\n"; |
732 | 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 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('addedSpotter' => 0)); |
|
736 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('forcenew' => 1)); |
|
737 | - 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'))); |
|
738 | - elseif (isset($line['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $line['id'])); |
|
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'])); |
|
735 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('addedSpotter' => 0)); |
|
736 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('forcenew' => 1)); |
|
737 | + 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'))); |
|
738 | + elseif (isset($line['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id], array('id' => $line['id'])); |
|
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 | 741 | } |
742 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('altitude_previous' => $line['altitude'])); |
|
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)); |
|
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 | 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; |
|
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 | 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 | 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)); |
|
761 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('heading' => 0)); |
|
762 | 762 | } |
763 | - if ($globalDaemon === TRUE && isset($globalSourcesupdate) && $globalSourcesupdate != '' && isset($this->all_flights[$id]['lastupdate']) && time()-$this->all_flights[$id]['lastupdate'] < $globalSourcesupdate) $dataFound = false; |
|
764 | - elseif ($globalDaemon === TRUE && isset($globalSBS1update) && $globalSBS1update != '' && isset($this->all_flights[$id]['lastupdate']) && time()-$this->all_flights[$id]['lastupdate'] < $globalSBS1update) $dataFound = false; |
|
765 | - elseif ($globalDaemon === TRUE && isset($globalAircraftMinUpdate) && $globalAircraftMinUpdate != '' && isset($this->all_flights[$id]['lastupdate']) && time()-$this->all_flights[$id]['lastupdate'] < $globalAircraftMinupdate) $dataFound = false; |
|
763 | + if ($globalDaemon === TRUE && isset($globalSourcesupdate) && $globalSourcesupdate != '' && isset($this->all_flights[$id]['lastupdate']) && time() - $this->all_flights[$id]['lastupdate'] < $globalSourcesupdate) $dataFound = false; |
|
764 | + elseif ($globalDaemon === TRUE && isset($globalSBS1update) && $globalSBS1update != '' && isset($this->all_flights[$id]['lastupdate']) && time() - $this->all_flights[$id]['lastupdate'] < $globalSBS1update) $dataFound = false; |
|
765 | + elseif ($globalDaemon === TRUE && isset($globalAircraftMinUpdate) && $globalAircraftMinUpdate != '' && isset($this->all_flights[$id]['lastupdate']) && time() - $this->all_flights[$id]['lastupdate'] < $globalAircraftMinupdate) $dataFound = false; |
|
766 | 766 | |
767 | 767 | // print_r($this->all_flights[$id]); |
768 | 768 | //gets the callsign from the last hour |
@@ -773,7 +773,7 @@ discard block |
||
773 | 773 | if ($dataFound === true && isset($this->all_flights[$id]['id'])) { |
774 | 774 | $this->all_flights[$id]['lastupdate'] = time(); |
775 | 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'])) { |
|
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 | 777 | //print_r($this->all_flights); |
778 | 778 | //echo $this->all_flights[$id]['id'].' - '.$this->all_flights[$id]['addedSpotter']."\n"; |
779 | 779 | //$last_hour_ident = Spotter->getIdentFromLastHour($this->all_flights[$id]['ident']); |
@@ -784,61 +784,61 @@ discard block |
||
784 | 784 | $SpotterLive = new SpotterLive($this->db); |
785 | 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 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkModeSRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
787 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkModeSRecent : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
788 | 788 | } elseif (isset($line['id'])) { |
789 | 789 | $recent_ident = $SpotterLive->checkIdRecent($line['id']); |
790 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
790 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdRecent : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
791 | 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 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdentRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
793 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdentRecent : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
794 | 794 | } else $recent_ident = ''; |
795 | - $SpotterLive->db=null; |
|
795 | + $SpotterLive->db = null; |
|
796 | 796 | if ($globalDebug && $recent_ident == '') echo " Not in DB.\n"; |
797 | 797 | elseif ($globalDebug && $recent_ident != '') echo " Already in DB.\n"; |
798 | 798 | } else $recent_ident = ''; |
799 | 799 | } else { |
800 | 800 | $recent_ident = ''; |
801 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('forcenew' => 0)); |
|
801 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('forcenew' => 0)); |
|
802 | 802 | } |
803 | 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 == "") |
|
804 | + if ($recent_ident == "") |
|
805 | 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 | - foreach($globalAirportIgnore as $airportIgnore) { |
|
811 | + foreach ($globalAirportIgnore as $airportIgnore) { |
|
812 | 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 | 817 | $ignoreImport = true; |
818 | - foreach($globalAirportIgnore as $airportIgnore) { |
|
818 | + foreach ($globalAirportIgnore as $airportIgnore) { |
|
819 | 819 | if (($this->all_flights[$id]['departure_airport'] == $airportIgnore) || ($this->all_flights[$id]['arrival_airport'] == $airportIgnore)) { |
820 | 820 | $ignoreImport = false; |
821 | 821 | } |
822 | 822 | } |
823 | 823 | } |
824 | 824 | if (isset($globalAirlineIgnore) && is_array($globalAirlineIgnore)) { |
825 | - foreach($globalAirlineIgnore as $airlineIgnore) { |
|
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)) { |
|
825 | + foreach ($globalAirlineIgnore as $airlineIgnore) { |
|
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 | 827 | $ignoreImport = true; |
828 | 828 | } |
829 | 829 | } |
830 | 830 | } |
831 | 831 | if (isset($globalAirlineAccept) && count($globalAirlineAccept) > 0) { |
832 | 832 | $ignoreImport = true; |
833 | - foreach($globalAirlineAccept as $airlineAccept) { |
|
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)) { |
|
833 | + foreach ($globalAirlineAccept as $airlineAccept) { |
|
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 | 835 | $ignoreImport = false; |
836 | 836 | } |
837 | 837 | } |
838 | 838 | } |
839 | 839 | if (isset($globalPilotIdAccept) && count($globalPilotIdAccept) > 0) { |
840 | 840 | $ignoreImport = true; |
841 | - foreach($globalPilotIdAccept as $pilotIdAccept) { |
|
841 | + foreach ($globalPilotIdAccept as $pilotIdAccept) { |
|
842 | 842 | if ($this->all_flights[$id]['pilot_id'] == $pilotIdAccept) { |
843 | 843 | $ignoreImport = false; |
844 | 844 | } |
@@ -850,12 +850,12 @@ discard block |
||
850 | 850 | if ($this->all_flights[$id]['squawk'] == '7500') $highlight = 'Squawk 7500 : Hijack'; |
851 | 851 | if ($this->all_flights[$id]['squawk'] == '7600') $highlight = 'Squawk 7600 : Lost Comm (radio failure)'; |
852 | 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'))); |
|
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 | 854 | $timeelapsed = microtime(true); |
855 | 855 | if (!isset($globalNoImport) || $globalNoImport === FALSE) { |
856 | 856 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
857 | 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']); |
|
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 | 859 | $Spotter->db = null; |
860 | 860 | if ($globalDebug) { |
861 | 861 | if (isset($result['error'])) echo 'Error: '.$result['error']."\n"; |
@@ -868,22 +868,22 @@ discard block |
||
868 | 868 | } |
869 | 869 | } |
870 | 870 | } |
871 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update addspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
871 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update addspotterdata : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
872 | 872 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
873 | 873 | |
874 | 874 | // Add source stat in DB |
875 | 875 | $Stats = new Stats($this->db); |
876 | 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) { |
|
878 | + foreach ($this->stats as $date => $data) { |
|
879 | + foreach ($data as $source => $sourced) { |
|
880 | 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); |
|
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 | 883 | if (isset($sourced['msg'])) { |
884 | 884 | if (time() - $sourced['msg']['date'] > 10) { |
885 | 885 | $nbmsg = round($sourced['msg']['nb']/(time() - $sourced['msg']['date'])); |
886 | - echo $Stats->addStatSource($nbmsg,$source,'msg',$date); |
|
886 | + echo $Stats->addStatSource($nbmsg, $source, 'msg', $date); |
|
887 | 887 | unset($this->stats[$date][$source]['msg']); |
888 | 888 | } |
889 | 889 | } |
@@ -921,14 +921,14 @@ discard block |
||
921 | 921 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
922 | 922 | $SpotterLive = new SpotterLive($this->db); |
923 | 923 | $SpotterLive->deleteLiveSpotterData(); |
924 | - $SpotterLive->db=null; |
|
924 | + $SpotterLive->db = null; |
|
925 | 925 | } |
926 | 926 | } |
927 | 927 | if ($globalDebug) echo " Done\n"; |
928 | 928 | $this->last_delete = time(); |
929 | 929 | } |
930 | 930 | } else { |
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')) { |
|
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 | 932 | $this->all_flights[$id]['id'] = $recent_ident; |
933 | 933 | $this->all_flights[$id]['addedSpotter'] = 1; |
934 | 934 | } |
@@ -936,7 +936,7 @@ discard block |
||
936 | 936 | if (!isset($globalNoImport) || $globalNoImport === FALSE) { |
937 | 937 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
938 | 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']); |
|
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 | 940 | $Spotter->db = null; |
941 | 941 | } |
942 | 942 | } |
@@ -962,37 +962,37 @@ discard block |
||
962 | 962 | if ($this->all_flights[$id]['departure_airport'] == "") { $this->all_flights[$id]['departure_airport'] = "NA"; } |
963 | 963 | if ($this->all_flights[$id]['arrival_airport'] == "") { $this->all_flights[$id]['arrival_airport'] = "NA"; } |
964 | 964 | |
965 | - foreach($globalAirportIgnore as $airportIgnore) { |
|
965 | + foreach ($globalAirportIgnore as $airportIgnore) { |
|
966 | 966 | if (($this->all_flights[$id]['departure_airport'] == $airportIgnore) || ($this->all_flights[$id]['arrival_airport'] == $airportIgnore)) { |
967 | 967 | $ignoreImport = true; |
968 | 968 | } |
969 | 969 | } |
970 | 970 | if (count($globalAirportAccept) > 0) { |
971 | 971 | $ignoreImport = true; |
972 | - foreach($globalAirportIgnore as $airportIgnore) { |
|
972 | + foreach ($globalAirportIgnore as $airportIgnore) { |
|
973 | 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 | 977 | } |
978 | 978 | if (isset($globalAirlineIgnore) && is_array($globalAirlineIgnore)) { |
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)) { |
|
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)) { |
|
981 | 981 | $ignoreImport = true; |
982 | 982 | } |
983 | 983 | } |
984 | 984 | } |
985 | 985 | if (isset($globalAirlineAccept) && count($globalAirlineAccept) > 0) { |
986 | 986 | $ignoreImport = true; |
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)) { |
|
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)) { |
|
989 | 989 | $ignoreImport = false; |
990 | 990 | } |
991 | 991 | } |
992 | 992 | } |
993 | 993 | if (isset($globalPilotIdAccept) && count($globalPilotIdAccept) > 0) { |
994 | 994 | $ignoreImport = true; |
995 | - foreach($globalPilotIdAccept as $pilotIdAccept) { |
|
995 | + foreach ($globalPilotIdAccept as $pilotIdAccept) { |
|
996 | 996 | if ($this->all_flights[$id]['pilot_id'] == $pilotIdAccept) { |
997 | 997 | $ignoreImport = false; |
998 | 998 | } |
@@ -1000,24 +1000,24 @@ discard block |
||
1000 | 1000 | } |
1001 | 1001 | |
1002 | 1002 | if (!$ignoreImport) { |
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 | - 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'))); |
|
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 | + 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 | 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 | - $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']); |
|
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 | - $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']); |
|
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']); |
|
1018 | 1018 | } |
1019 | 1019 | $this->all_flights[$id]['putinarchive'] = false; |
1020 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update addlivespotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
1020 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update addlivespotterdata : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
1021 | 1021 | |
1022 | 1022 | // Put statistics in $this->stats variable |
1023 | 1023 | //if ($line['format_source'] != 'aprs') { |
@@ -1036,19 +1036,19 @@ discard block |
||
1036 | 1036 | $latitude = $globalCenterLatitude; |
1037 | 1037 | $longitude = $globalCenterLongitude; |
1038 | 1038 | } |
1039 | - $this->source_location[$source] = array('latitude' => $latitude,'longitude' => $longitude); |
|
1039 | + $this->source_location[$source] = array('latitude' => $latitude, 'longitude' => $longitude); |
|
1040 | 1040 | } else { |
1041 | 1041 | $latitude = $this->source_location[$source]['latitude']; |
1042 | 1042 | $longitude = $this->source_location[$source]['longitude']; |
1043 | 1043 | } |
1044 | - $stats_heading = $Common->getHeading($latitude,$longitude,$this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude']); |
|
1044 | + $stats_heading = $Common->getHeading($latitude, $longitude, $this->all_flights[$id]['latitude'], $this->all_flights[$id]['longitude']); |
|
1045 | 1045 | //$stats_heading = $stats_heading%22.5; |
1046 | 1046 | $stats_heading = round($stats_heading/22.5); |
1047 | - $stats_distance = $Common->distance($latitude,$longitude,$this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude']); |
|
1047 | + $stats_distance = $Common->distance($latitude, $longitude, $this->all_flights[$id]['latitude'], $this->all_flights[$id]['longitude']); |
|
1048 | 1048 | $current_date = date('Y-m-d'); |
1049 | 1049 | if ($stats_heading == 16) $stats_heading = 0; |
1050 | 1050 | if (!isset($this->stats[$current_date][$source]['polar'][1])) { |
1051 | - for ($i=0;$i<=15;$i++) { |
|
1051 | + for ($i = 0; $i <= 15; $i++) { |
|
1052 | 1052 | $this->stats[$current_date][$source]['polar'][$i] = 0; |
1053 | 1053 | } |
1054 | 1054 | $this->stats[$current_date][$source]['polar'][$stats_heading] = $stats_distance; |
@@ -1063,9 +1063,9 @@ discard block |
||
1063 | 1063 | if (!isset($this->stats[$current_date][$source]['hist'][$distance])) { |
1064 | 1064 | if (isset($this->stats[$current_date][$source]['hist'][0])) { |
1065 | 1065 | end($this->stats[$current_date][$source]['hist']); |
1066 | - $mini = key($this->stats[$current_date][$source]['hist'])+10; |
|
1066 | + $mini = key($this->stats[$current_date][$source]['hist']) + 10; |
|
1067 | 1067 | } else $mini = 0; |
1068 | - for ($i=$mini;$i<=$distance;$i+=10) { |
|
1068 | + for ($i = $mini; $i <= $distance; $i += 10) { |
|
1069 | 1069 | $this->stats[$current_date][$source]['hist'][$i] = 0; |
1070 | 1070 | } |
1071 | 1071 | $this->stats[$current_date][$source]['hist'][$distance] = 1; |
@@ -1078,7 +1078,7 @@ discard block |
||
1078 | 1078 | $this->all_flights[$id]['lastupdate'] = time(); |
1079 | 1079 | if ($this->all_flights[$id]['putinarchive']) $send = true; |
1080 | 1080 | //if ($globalDebug) echo "Distance : ".Common->distance($this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude'])."\n"; |
1081 | - } elseif (isset($this->all_flights[$id]['latitude']) && isset($globalDistanceIgnore['latitude']) && $globalDebug) echo "!! Too far -> Distance : ".$Common->distance($this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude'])."\n"; |
|
1081 | + } elseif (isset($this->all_flights[$id]['latitude']) && isset($globalDistanceIgnore['latitude']) && $globalDebug) echo "!! Too far -> Distance : ".$Common->distance($this->all_flights[$id]['latitude'], $this->all_flights[$id]['longitude'], $globalDistanceIgnore['latitude'], $globalDistanceIgnore['longitude'])."\n"; |
|
1082 | 1082 | //$this->del(); |
1083 | 1083 | |
1084 | 1084 | if ($this->last_delete_hourly == 0 || time() - $this->last_delete_hourly > 900) { |
@@ -17,62 +17,62 @@ discard block |
||
17 | 17 | * @param Array $filter the filter |
18 | 18 | * @return Array the SQL part |
19 | 19 | */ |
20 | - public function getFilter($filter = array(),$where = false,$and = false) { |
|
20 | + public function getFilter($filter = array(), $where = false, $and = false) { |
|
21 | 21 | global $globalFilter, $globalStatsFilters, $globalFilterName, $globalDBdriver; |
22 | 22 | $filters = array(); |
23 | 23 | if (is_array($globalStatsFilters) && isset($globalStatsFilters[$globalFilterName])) { |
24 | 24 | if (isset($globalStatsFilters[$globalFilterName][0]['source'])) { |
25 | 25 | $filters = $globalStatsFilters[$globalFilterName]; |
26 | 26 | } else { |
27 | - $filter = array_merge($filter,$globalStatsFilters[$globalFilterName]); |
|
27 | + $filter = array_merge($filter, $globalStatsFilters[$globalFilterName]); |
|
28 | 28 | } |
29 | 29 | } |
30 | 30 | if (isset($filter[0]['source'])) { |
31 | - $filters = array_merge($filters,$filter); |
|
31 | + $filters = array_merge($filters, $filter); |
|
32 | 32 | } |
33 | - if (is_array($globalFilter)) $filter = array_merge($filter,$globalFilter); |
|
33 | + if (is_array($globalFilter)) $filter = array_merge($filter, $globalFilter); |
|
34 | 34 | $filter_query_join = ''; |
35 | 35 | $filter_query_where = ''; |
36 | - foreach($filters as $flt) { |
|
36 | + foreach ($filters as $flt) { |
|
37 | 37 | if (isset($flt['airlines']) && !empty($flt['airlines'])) { |
38 | 38 | if ($flt['airlines'][0] != '' && $flt['airlines'][0] != 'all') { |
39 | 39 | if (isset($flt['source'])) { |
40 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','",$flt['airlines'])."') AND spotter_output.format_source IN ('".implode("','",$flt['source'])."')) saf ON saf.flightaware_id = spotter_live.flightaware_id"; |
|
40 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','", $flt['airlines'])."') AND spotter_output.format_source IN ('".implode("','", $flt['source'])."')) saf ON saf.flightaware_id = spotter_live.flightaware_id"; |
|
41 | 41 | } else { |
42 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','",$flt['airlines'])."')) saf ON saf.flightaware_id = spotter_live.flightaware_id"; |
|
42 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','", $flt['airlines'])."')) saf ON saf.flightaware_id = spotter_live.flightaware_id"; |
|
43 | 43 | } |
44 | 44 | } |
45 | 45 | } |
46 | 46 | if (isset($flt['pilots_id']) && !empty($flt['pilots_id'])) { |
47 | 47 | if (isset($flt['source'])) { |
48 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','",$flt['pilots_id'])."') AND spotter_output.format_source IN ('".implode("','",$flt['source'])."')) spi ON spi.flightaware_id = spotter_live.flightaware_id"; |
|
48 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','", $flt['pilots_id'])."') AND spotter_output.format_source IN ('".implode("','", $flt['source'])."')) spi ON spi.flightaware_id = spotter_live.flightaware_id"; |
|
49 | 49 | } else { |
50 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','",$flt['pilots_id'])."')) spi ON spi.flightaware_id = spotter_live.flightaware_id"; |
|
50 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','", $flt['pilots_id'])."')) spi ON spi.flightaware_id = spotter_live.flightaware_id"; |
|
51 | 51 | } |
52 | 52 | } |
53 | 53 | if (isset($flt['idents']) && !empty($flt['idents'])) { |
54 | 54 | if (isset($flt['source'])) { |
55 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.ident IN ('".implode("','",$flt['idents'])."') AND spotter_output.format_source IN ('".implode("','",$flt['source'])."')) spid ON spid.flightaware_id = spotter_live.flightaware_id"; |
|
55 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.ident IN ('".implode("','", $flt['idents'])."') AND spotter_output.format_source IN ('".implode("','", $flt['source'])."')) spid ON spid.flightaware_id = spotter_live.flightaware_id"; |
|
56 | 56 | } else { |
57 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.ident IN ('".implode("','",$flt['idents'])."')) spid ON spid.flightaware_id = spotter_live.flightaware_id"; |
|
57 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.ident IN ('".implode("','", $flt['idents'])."')) spid ON spid.flightaware_id = spotter_live.flightaware_id"; |
|
58 | 58 | } |
59 | 59 | } |
60 | 60 | if (isset($flt['registrations']) && !empty($flt['registrations'])) { |
61 | 61 | if (isset($flt['source'])) { |
62 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.registration IN ('".implode("','",$flt['registrations'])."') AND spotter_output.format_source IN ('".implode("','",$flt['source'])."')) sre ON sre.flightaware_id = spotter_live.flightaware_id"; |
|
62 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.registration IN ('".implode("','", $flt['registrations'])."') AND spotter_output.format_source IN ('".implode("','", $flt['source'])."')) sre ON sre.flightaware_id = spotter_live.flightaware_id"; |
|
63 | 63 | } else { |
64 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.registration IN ('".implode("','",$flt['registrations'])."')) sre ON sre.flightaware_id = spotter_live.flightaware_id"; |
|
64 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.registration IN ('".implode("','", $flt['registrations'])."')) sre ON sre.flightaware_id = spotter_live.flightaware_id"; |
|
65 | 65 | } |
66 | 66 | } |
67 | 67 | if ((isset($flt['airlines']) && empty($flt['airlines']) && isset($flt['pilots_id']) && empty($flt['pilots_id']) && isset($flt['idents']) && empty($flt['idents'])) || (!isset($flt['airlines']) && !isset($flt['pilots_id']) && !isset($flt['idents']) && !isset($flt['registrations']))) { |
68 | 68 | if (isset($flt['source'])) { |
69 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.format_source IN ('".implode("','",$flt['source'])."')) ssf ON ssf.flightaware_id = spotter_live.flightaware_id"; |
|
69 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.format_source IN ('".implode("','", $flt['source'])."')) ssf ON ssf.flightaware_id = spotter_live.flightaware_id"; |
|
70 | 70 | } |
71 | 71 | } |
72 | 72 | } |
73 | 73 | if (isset($filter['airlines']) && !empty($filter['airlines'])) { |
74 | 74 | if ($filter['airlines'][0] != '' && $filter['airlines'][0] != 'all') { |
75 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','",$filter['airlines'])."')) sai ON sai.flightaware_id = spotter_live.flightaware_id"; |
|
75 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','", $filter['airlines'])."')) sai ON sai.flightaware_id = spotter_live.flightaware_id"; |
|
76 | 76 | } |
77 | 77 | } |
78 | 78 | if (isset($filter['alliance']) && !empty($filter['alliance'])) { |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_type = '".$filter['airlinestype']."') sa ON sa.flightaware_id = spotter_live.flightaware_id "; |
83 | 83 | } |
84 | 84 | if (isset($filter['pilots_id']) && !empty($filter['pilots_id'])) { |
85 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','",$filter['pilots_id'])."')) sp ON sp.flightaware_id = spotter_live.flightaware_id"; |
|
85 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','", $filter['pilots_id'])."')) sp ON sp.flightaware_id = spotter_live.flightaware_id"; |
|
86 | 86 | } |
87 | 87 | if (isset($filter['blocked']) && $filter['blocked'] == true) { |
88 | 88 | $filter_query_join .= " INNER JOIN (SELECT callsign FROM aircraft_block) cblk ON cblk.callsign = spotter_live.ident"; |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | if (count($filter['source']) == 1) { |
92 | 92 | $filter_query_where .= " AND format_source = '".$filter['source'][0]."'"; |
93 | 93 | } else { |
94 | - $filter_query_where .= " AND format_source IN ('".implode("','",$filter['source'])."')"; |
|
94 | + $filter_query_where .= " AND format_source IN ('".implode("','", $filter['source'])."')"; |
|
95 | 95 | } |
96 | 96 | } |
97 | 97 | if (isset($filter['ident']) && !empty($filter['ident'])) { |
@@ -124,15 +124,15 @@ discard block |
||
124 | 124 | $filter_query_date .= " AND EXTRACT(DAY FROM spotter_output.date) = '".$filter['day']."'"; |
125 | 125 | } |
126 | 126 | } |
127 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output".preg_replace('/^ AND/',' WHERE',$filter_query_date).") sd ON sd.flightaware_id = spotter_live.flightaware_id"; |
|
127 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output".preg_replace('/^ AND/', ' WHERE', $filter_query_date).") sd ON sd.flightaware_id = spotter_live.flightaware_id"; |
|
128 | 128 | } |
129 | 129 | if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) { |
130 | - $filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')"; |
|
130 | + $filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','", $filter['source_aprs'])."')"; |
|
131 | 131 | } |
132 | 132 | if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE'; |
133 | 133 | elseif ($filter_query_where != '' && $and) $filter_query_where .= ' AND'; |
134 | 134 | if ($filter_query_where != '') { |
135 | - $filter_query_where = preg_replace('/^ AND/',' WHERE',$filter_query_where); |
|
135 | + $filter_query_where = preg_replace('/^ AND/', ' WHERE', $filter_query_where); |
|
136 | 136 | } |
137 | 137 | $filter_query = $filter_query_join.$filter_query_where; |
138 | 138 | return $filter_query; |
@@ -155,8 +155,8 @@ discard block |
||
155 | 155 | if ($limit != '') |
156 | 156 | { |
157 | 157 | $limit_array = explode(',', $limit); |
158 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
159 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
158 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
159 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
160 | 160 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
161 | 161 | { |
162 | 162 | $limit_query = ' LIMIT '.$limit_array[1].' OFFSET '.$limit_array[0]; |
@@ -180,7 +180,7 @@ discard block |
||
180 | 180 | } else { |
181 | 181 | $query = "SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= l.date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate".$filter_query.$orderby_query; |
182 | 182 | } |
183 | - $spotter_array = $Spotter->getDataFromDB($query.$limit_query,array(),'',true); |
|
183 | + $spotter_array = $Spotter->getDataFromDB($query.$limit_query, array(), '', true); |
|
184 | 184 | |
185 | 185 | return $spotter_array; |
186 | 186 | } |
@@ -191,34 +191,34 @@ discard block |
||
191 | 191 | * @return Array the spotter information |
192 | 192 | * |
193 | 193 | */ |
194 | - public function getMinLiveSpotterData($limit = 0,$filter = array()) |
|
194 | + public function getMinLiveSpotterData($limit = 0, $filter = array()) |
|
195 | 195 | { |
196 | 196 | global $globalDBdriver, $globalLiveInterval, $globalArchive, $globalMap2DAircraftsLimit; |
197 | 197 | date_default_timezone_set('UTC'); |
198 | - $filter_query = $this->getFilter($filter,true,true); |
|
198 | + $filter_query = $this->getFilter($filter, true, true); |
|
199 | 199 | if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
200 | 200 | if ($globalDBdriver == 'mysql') { |
201 | 201 | if (isset($globalArchive) && $globalArchive === TRUE) { |
202 | 202 | // $query = 'SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.real_altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source, spotter_live.registration |
203 | 203 | // FROM spotter_live'.$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= spotter_live.date AND'." spotter_live.latitude <> 0 AND spotter_live.longitude <> 0 ORDER BY date DESC"; |
204 | - $query = 'SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.real_altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source, spotter_live.registration |
|
204 | + $query = 'SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.real_altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source, spotter_live.registration |
|
205 | 205 | FROM spotter_live'.$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= spotter_live.date AND'." spotter_live.latitude <> 0 AND spotter_live.longitude <> 0"; |
206 | 206 | } else { |
207 | 207 | // $query = 'SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.real_altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source, spotter_live.registration |
208 | 208 | // FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate'.$filter_query." spotter_live.latitude <> 0 AND spotter_live.longitude <> 0 ORDER BY date DESC"; |
209 | - $query = 'SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.real_altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source, spotter_live.registration |
|
209 | + $query = 'SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.real_altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source, spotter_live.registration |
|
210 | 210 | FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate'.$filter_query." spotter_live.latitude <> 0 AND spotter_live.longitude <> 0"; |
211 | 211 | } |
212 | 212 | } else { |
213 | 213 | if (isset($globalArchive) && $globalArchive === TRUE) { |
214 | 214 | // $query = "SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.real_altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source, spotter_live.registration |
215 | 215 | // FROM spotter_live".$filter_query." CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= spotter_live.date AND spotter_live.latitude <> '0' AND spotter_live.longitude <> '0' ORDER BY date DESC"; |
216 | - $query = "SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.real_altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source, spotter_live.registration |
|
216 | + $query = "SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.real_altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source, spotter_live.registration |
|
217 | 217 | FROM spotter_live".$filter_query." CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= spotter_live.date AND spotter_live.latitude <> '0' AND spotter_live.longitude <> '0'"; |
218 | 218 | } else { |
219 | 219 | // $query = "SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.real_altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source, spotter_live.registration |
220 | 220 | // FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= l.date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate".$filter_query." spotter_live.latitude <> '0' AND spotter_live.longitude <> '0' ORDER BY date DESC"; |
221 | - $query = "SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.real_altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source, spotter_live.registration |
|
221 | + $query = "SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.real_altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source, spotter_live.registration |
|
222 | 222 | FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= l.date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate".$filter_query." spotter_live.latitude <> '0' AND spotter_live.longitude <> '0'"; |
223 | 223 | } |
224 | 224 | } |
@@ -226,14 +226,14 @@ discard block |
||
226 | 226 | if ($limit == 0 && isset($globalMap2DAircraftsLimit) && $globalMap2DAircraftsLimit != '') { |
227 | 227 | $limit = $globalMap2DAircraftsLimit; |
228 | 228 | } |
229 | - if ($limit != 0 && filter_var($limit,FILTER_VALIDATE_INT)) { |
|
229 | + if ($limit != 0 && filter_var($limit, FILTER_VALIDATE_INT)) { |
|
230 | 230 | $query .= ' LIMIT '.$limit; |
231 | 231 | } |
232 | 232 | |
233 | 233 | try { |
234 | 234 | $sth = $this->db->prepare($query); |
235 | 235 | $sth->execute(); |
236 | - } catch(PDOException $e) { |
|
236 | + } catch (PDOException $e) { |
|
237 | 237 | echo $e->getMessage(); |
238 | 238 | die; |
239 | 239 | } |
@@ -247,20 +247,20 @@ discard block |
||
247 | 247 | * @return Array the spotter information |
248 | 248 | * |
249 | 249 | */ |
250 | - public function getMinLastLiveSpotterData($coord = array(),$filter = array(), $limit = 0, $id = '') |
|
250 | + public function getMinLastLiveSpotterData($coord = array(), $filter = array(), $limit = 0, $id = '') |
|
251 | 251 | { |
252 | 252 | global $globalDBdriver, $globalLiveInterval, $globalArchive, $globalMap3DAircraftsLimit; |
253 | 253 | date_default_timezone_set('UTC'); |
254 | 254 | $usecoord = false; |
255 | 255 | if (is_array($coord) && !empty($coord)) { |
256 | - $minlong = filter_var($coord[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
257 | - $minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
258 | - $maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
259 | - $maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
256 | + $minlong = filter_var($coord[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
257 | + $minlat = filter_var($coord[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
258 | + $maxlong = filter_var($coord[2], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
259 | + $maxlat = filter_var($coord[3], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
260 | 260 | $usecoord = true; |
261 | 261 | } |
262 | - $id = filter_var($id,FILTER_SANITIZE_STRING); |
|
263 | - $filter_query = $this->getFilter($filter,true,true); |
|
262 | + $id = filter_var($id, FILTER_SANITIZE_STRING); |
|
263 | + $filter_query = $this->getFilter($filter, true, true); |
|
264 | 264 | |
265 | 265 | if (!isset($globalLiveInterval) || $globalLiveInterval == '') $globalLiveInterval = '200'; |
266 | 266 | if (!isset($globalMap3DAircraftsLimit) || $globalMap3DAircraftsLimit == '') $globalMap3DAircraftsLimit = '300'; |
@@ -290,7 +290,7 @@ discard block |
||
290 | 290 | ORDER BY flightaware_id, date"; |
291 | 291 | if ($limit > 0) $query .= " LIMIT ".$limit; |
292 | 292 | } else { |
293 | - $query = 'SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source, spotter_live.registration |
|
293 | + $query = 'SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source, spotter_live.registration |
|
294 | 294 | FROM spotter_live'.$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval." SECOND) <= spotter_live.date "; |
295 | 295 | if ($usecoord) $query .= "AND (spotter_live.latitude BETWEEN ".$minlat." AND ".$maxlat." AND spotter_live.longitude BETWEEN ".$minlong." AND ".$maxlong.") "; |
296 | 296 | if ($id != '') $query .= "OR spotter_live.flightaware_id = :id "; |
@@ -340,7 +340,7 @@ discard block |
||
340 | 340 | try { |
341 | 341 | $sth = $this->db->prepare($query); |
342 | 342 | $sth->execute($query_values); |
343 | - } catch(PDOException $e) { |
|
343 | + } catch (PDOException $e) { |
|
344 | 344 | echo $e->getMessage(); |
345 | 345 | die; |
346 | 346 | } |
@@ -354,12 +354,12 @@ discard block |
||
354 | 354 | * @return Array the spotter information |
355 | 355 | * |
356 | 356 | */ |
357 | - public function getMinLastLiveSpotterDataByID($id = '',$filter = array(), $limit = 0) |
|
357 | + public function getMinLastLiveSpotterDataByID($id = '', $filter = array(), $limit = 0) |
|
358 | 358 | { |
359 | 359 | global $globalDBdriver, $globalLiveInterval, $globalArchive, $globalMap3DAircraftsLimit; |
360 | 360 | date_default_timezone_set('UTC'); |
361 | - $id = filter_var($id,FILTER_SANITIZE_STRING); |
|
362 | - $filter_query = $this->getFilter($filter,true,true); |
|
361 | + $id = filter_var($id, FILTER_SANITIZE_STRING); |
|
362 | + $filter_query = $this->getFilter($filter, true, true); |
|
363 | 363 | |
364 | 364 | if (!isset($globalLiveInterval) || $globalLiveInterval == '') $globalLiveInterval = '200'; |
365 | 365 | if (!isset($globalMap3DAircraftsLimit) || $globalMap3DAircraftsLimit == '') $globalMap3DAircraftsLimit = '300'; |
@@ -384,13 +384,13 @@ discard block |
||
384 | 384 | } |
385 | 385 | } else { |
386 | 386 | if (isset($globalArchive) && $globalArchive === TRUE) { |
387 | - $query = "SELECT * FROM ( |
|
387 | + $query = "SELECT * FROM ( |
|
388 | 388 | SELECT spotter_archive.ident, spotter_archive.flightaware_id, spotter_archive.aircraft_icao, spotter_archive.departure_airport_icao as departure_airport, spotter_archive.arrival_airport_icao as arrival_airport, spotter_archive.latitude, spotter_archive.longitude, spotter_archive.altitude, spotter_archive.heading, spotter_archive.ground_speed, spotter_archive.squawk, spotter_archive.date, spotter_archive.format_source, spotter_archive.registration |
389 | 389 | FROM spotter_archive |
390 | 390 | INNER JOIN ( |
391 | 391 | SELECT flightaware_id |
392 | 392 | FROM spotter_live".$filter_query." spotter_live.flightaware_id = :id"; |
393 | - $query.= ") l ON l.flightaware_id = spotter_archive.flightaware_id "; |
|
393 | + $query .= ") l ON l.flightaware_id = spotter_archive.flightaware_id "; |
|
394 | 394 | $query .= "UNION |
395 | 395 | SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source, spotter_live.registration |
396 | 396 | FROM spotter_live".$filter_query." spotter_live.flightaware_id = :id"; |
@@ -410,7 +410,7 @@ discard block |
||
410 | 410 | try { |
411 | 411 | $sth = $this->db->prepare($query); |
412 | 412 | $sth->execute($query_values); |
413 | - } catch(PDOException $e) { |
|
413 | + } catch (PDOException $e) { |
|
414 | 414 | echo $e->getMessage(); |
415 | 415 | die; |
416 | 416 | } |
@@ -427,7 +427,7 @@ discard block |
||
427 | 427 | public function getLiveSpotterCount($filter = array()) |
428 | 428 | { |
429 | 429 | global $globalDBdriver, $globalLiveInterval; |
430 | - $filter_query = $this->getFilter($filter,true,true); |
|
430 | + $filter_query = $this->getFilter($filter, true, true); |
|
431 | 431 | |
432 | 432 | if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
433 | 433 | if ($globalDBdriver == 'mysql') { |
@@ -440,7 +440,7 @@ discard block |
||
440 | 440 | try { |
441 | 441 | $sth = $this->db->prepare($query); |
442 | 442 | $sth->execute(); |
443 | - } catch(PDOException $e) { |
|
443 | + } catch (PDOException $e) { |
|
444 | 444 | echo $e->getMessage(); |
445 | 445 | die; |
446 | 446 | } |
@@ -457,16 +457,16 @@ discard block |
||
457 | 457 | */ |
458 | 458 | public function getLiveSpotterDatabyCoord($coord, $filter = array()) |
459 | 459 | { |
460 | - global $globalDBdriver, $globalLiveInterval,$globalMap2DAircraftsLimit; |
|
460 | + global $globalDBdriver, $globalLiveInterval, $globalMap2DAircraftsLimit; |
|
461 | 461 | $Spotter = new Spotter($this->db); |
462 | 462 | if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
463 | 463 | $filter_query = $this->getFilter($filter); |
464 | 464 | |
465 | 465 | if (is_array($coord)) { |
466 | - $minlong = filter_var($coord[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
467 | - $minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
468 | - $maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
469 | - $maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
466 | + $minlong = filter_var($coord[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
467 | + $minlat = filter_var($coord[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
468 | + $maxlong = filter_var($coord[2], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
469 | + $maxlat = filter_var($coord[3], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
470 | 470 | } else return array(); |
471 | 471 | if ($globalDBdriver == 'mysql') { |
472 | 472 | $query = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate AND spotter_live.latitude BETWEEN '.$minlat.' AND '.$maxlat.' AND spotter_live.longitude BETWEEN '.$minlong.' AND '.$maxlong.' GROUP BY spotter_live.flightaware_id'.$filter_query; |
@@ -487,28 +487,28 @@ discard block |
||
487 | 487 | * @return Array the spotter information |
488 | 488 | * |
489 | 489 | */ |
490 | - public function getMinLiveSpotterDatabyCoord($coord,$limit = 0, $filter = array()) |
|
490 | + public function getMinLiveSpotterDatabyCoord($coord, $limit = 0, $filter = array()) |
|
491 | 491 | { |
492 | - global $globalDBdriver, $globalLiveInterval, $globalArchive,$globalMap2DAircraftsLimit; |
|
492 | + global $globalDBdriver, $globalLiveInterval, $globalArchive, $globalMap2DAircraftsLimit; |
|
493 | 493 | $Spotter = new Spotter($this->db); |
494 | 494 | if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
495 | - $filter_query = $this->getFilter($filter,true,true); |
|
495 | + $filter_query = $this->getFilter($filter, true, true); |
|
496 | 496 | |
497 | 497 | if (is_array($coord)) { |
498 | - $minlong = filter_var($coord[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
499 | - $minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
500 | - $maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
501 | - $maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
498 | + $minlong = filter_var($coord[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
499 | + $minlat = filter_var($coord[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
500 | + $maxlong = filter_var($coord[2], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
501 | + $maxlat = filter_var($coord[3], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
502 | 502 | } else return array(); |
503 | 503 | if ($globalDBdriver == 'mysql') { |
504 | 504 | if (isset($globalArchive) && $globalArchive === TRUE) { |
505 | - $query = 'SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.real_altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source, spotter_live.registration |
|
505 | + $query = 'SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.real_altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source, spotter_live.registration |
|
506 | 506 | FROM spotter_live |
507 | 507 | '.$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= spotter_live.date |
508 | 508 | AND spotter_live.latitude BETWEEN '.$minlat.' AND '.$maxlat.' AND spotter_live.longitude BETWEEN '.$minlong.' AND '.$maxlong.' |
509 | 509 | AND spotter_live.latitude <> 0 AND spotter_live.longitude <> 0 ORDER BY date DESC'; |
510 | 510 | } else { |
511 | - $query = 'SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.real_altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source, spotter_live.registration |
|
511 | + $query = 'SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.real_altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source, spotter_live.registration |
|
512 | 512 | FROM spotter_live |
513 | 513 | INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate |
514 | 514 | FROM spotter_live l |
@@ -528,7 +528,7 @@ discard block |
||
528 | 528 | AND spotter_live.longitude BETWEEN ".$minlong." AND ".$maxlong." |
529 | 529 | AND spotter_live.latitude <> '0' AND spotter_live.longitude <> '0' ORDER BY date DESC"; |
530 | 530 | */ |
531 | - $query = "SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.real_altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source, spotter_live.registration |
|
531 | + $query = "SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.real_altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source, spotter_live.registration |
|
532 | 532 | FROM spotter_live |
533 | 533 | ".$filter_query." CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= spotter_live.date |
534 | 534 | AND spotter_live.latitude BETWEEN ".$minlat." AND ".$maxlat." |
@@ -547,7 +547,7 @@ discard block |
||
547 | 547 | ) s on spotter_live.flightaware_id = s.flightaware_id |
548 | 548 | AND spotter_live.date = s.maxdate".$filter_query." spotter_live.latitude <> '0' AND spotter_live.longitude <> '0' ORDER BY date DESC"; |
549 | 549 | */ |
550 | - $query = "SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.real_altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source, spotter_live.registration |
|
550 | + $query = "SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.real_altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source, spotter_live.registration |
|
551 | 551 | FROM spotter_live |
552 | 552 | INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate |
553 | 553 | FROM spotter_live l |
@@ -562,13 +562,13 @@ discard block |
||
562 | 562 | if ($limit == 0 && isset($globalMap2DAircraftsLimit) && $globalMap2DAircraftsLimit != '') { |
563 | 563 | $limit = $globalMap2DAircraftsLimit; |
564 | 564 | } |
565 | - if ($limit != 0 && filter_var($limit,FILTER_VALIDATE_INT)) { |
|
565 | + if ($limit != 0 && filter_var($limit, FILTER_VALIDATE_INT)) { |
|
566 | 566 | $query .= ' LIMIT '.$limit; |
567 | 567 | } |
568 | 568 | try { |
569 | 569 | $sth = $this->db->prepare($query); |
570 | 570 | $sth->execute(); |
571 | - } catch(PDOException $e) { |
|
571 | + } catch (PDOException $e) { |
|
572 | 572 | echo $e->getMessage(); |
573 | 573 | die; |
574 | 574 | } |
@@ -617,7 +617,7 @@ discard block |
||
617 | 617 | if ($interval == '1m') |
618 | 618 | { |
619 | 619 | $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= spotter_live.date '; |
620 | - } else if ($interval == '15m'){ |
|
620 | + } else if ($interval == '15m') { |
|
621 | 621 | $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 15 MINUTE) <= spotter_live.date '; |
622 | 622 | } |
623 | 623 | } |
@@ -625,14 +625,14 @@ discard block |
||
625 | 625 | $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= spotter_live.date '; |
626 | 626 | } |
627 | 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 |
|
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 | 637 | return $spotter_array; |
638 | 638 | } |
@@ -650,9 +650,9 @@ discard block |
||
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 | - $spotter_array = $Spotter->getDataFromDB($query,array(':ident' => $ident),'',true); |
|
655 | + $spotter_array = $Spotter->getDataFromDB($query, array(':ident' => $ident), '', true); |
|
656 | 656 | |
657 | 657 | return $spotter_array; |
658 | 658 | } |
@@ -663,16 +663,16 @@ discard block |
||
663 | 663 | * @return Array the spotter information |
664 | 664 | * |
665 | 665 | */ |
666 | - public function getDateLiveSpotterDataByIdent($ident,$date) |
|
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); |
|
675 | - $spotter_array = $Spotter->getDataFromDB($query,array(':ident' => $ident,':date' => $date)); |
|
674 | + $date = date('c', $date); |
|
675 | + $spotter_array = $Spotter->getDataFromDB($query, array(':ident' => $ident, ':date' => $date)); |
|
676 | 676 | |
677 | 677 | return $spotter_array; |
678 | 678 | } |
@@ -688,8 +688,8 @@ discard block |
||
688 | 688 | $Spotter = new Spotter($this->db); |
689 | 689 | date_default_timezone_set('UTC'); |
690 | 690 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
691 | - $query = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.flightaware_id = :id GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC'; |
|
692 | - $spotter_array = $Spotter->getDataFromDB($query,array(':id' => $id),'',true); |
|
691 | + $query = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.flightaware_id = :id GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC'; |
|
692 | + $spotter_array = $Spotter->getDataFromDB($query, array(':id' => $id), '', true); |
|
693 | 693 | return $spotter_array; |
694 | 694 | } |
695 | 695 | |
@@ -699,15 +699,15 @@ discard block |
||
699 | 699 | * @return Array the spotter information |
700 | 700 | * |
701 | 701 | */ |
702 | - public function getDateLiveSpotterDataById($id,$date) |
|
702 | + public function getDateLiveSpotterDataById($id, $date) |
|
703 | 703 | { |
704 | 704 | $Spotter = new Spotter($this->db); |
705 | 705 | date_default_timezone_set('UTC'); |
706 | 706 | |
707 | 707 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
708 | - $query = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.flightaware_id = :id AND l.date <= :date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC'; |
|
709 | - $date = date('c',$date); |
|
710 | - $spotter_array = $Spotter->getDataFromDB($query,array(':id' => $id,':date' => $date),'',true); |
|
708 | + $query = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.flightaware_id = :id AND l.date <= :date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC'; |
|
709 | + $date = date('c', $date); |
|
710 | + $spotter_array = $Spotter->getDataFromDB($query, array(':id' => $id, ':date' => $date), '', true); |
|
711 | 711 | return $spotter_array; |
712 | 712 | } |
713 | 713 | |
@@ -723,13 +723,13 @@ discard block |
||
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 | 728 | try { |
729 | 729 | |
730 | 730 | $sth = $this->db->prepare($query); |
731 | 731 | $sth->execute(array(':ident' => $ident)); |
732 | - } catch(PDOException $e) { |
|
732 | + } catch (PDOException $e) { |
|
733 | 733 | echo $e->getMessage(); |
734 | 734 | die; |
735 | 735 | } |
@@ -744,7 +744,7 @@ discard block |
||
744 | 744 | * @return Array the spotter information |
745 | 745 | * |
746 | 746 | */ |
747 | - public function getAllLiveSpotterDataById($id,$liveinterval = false) |
|
747 | + public function getAllLiveSpotterDataById($id, $liveinterval = false) |
|
748 | 748 | { |
749 | 749 | global $globalDBdriver, $globalLiveInterval; |
750 | 750 | date_default_timezone_set('UTC'); |
@@ -763,7 +763,7 @@ discard block |
||
763 | 763 | try { |
764 | 764 | $sth = $this->db->prepare($query); |
765 | 765 | $sth->execute(array(':id' => $id)); |
766 | - } catch(PDOException $e) { |
|
766 | + } catch (PDOException $e) { |
|
767 | 767 | echo $e->getMessage(); |
768 | 768 | die; |
769 | 769 | } |
@@ -781,12 +781,12 @@ discard block |
||
781 | 781 | { |
782 | 782 | date_default_timezone_set('UTC'); |
783 | 783 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
784 | - $query = self::$global_query.' WHERE spotter_live.ident = :ident'; |
|
784 | + $query = self::$global_query.' WHERE spotter_live.ident = :ident'; |
|
785 | 785 | try { |
786 | 786 | |
787 | 787 | $sth = $this->db->prepare($query); |
788 | 788 | $sth->execute(array(':ident' => $ident)); |
789 | - } catch(PDOException $e) { |
|
789 | + } catch (PDOException $e) { |
|
790 | 790 | echo $e->getMessage(); |
791 | 791 | die; |
792 | 792 | } |
@@ -816,7 +816,7 @@ discard block |
||
816 | 816 | |
817 | 817 | $sth = $this->db->prepare($query); |
818 | 818 | $sth->execute(); |
819 | - } catch(PDOException $e) { |
|
819 | + } catch (PDOException $e) { |
|
820 | 820 | return "error"; |
821 | 821 | } |
822 | 822 | |
@@ -839,14 +839,14 @@ discard block |
||
839 | 839 | |
840 | 840 | $sth = $this->db->prepare($query); |
841 | 841 | $sth->execute(); |
842 | - } catch(PDOException $e) { |
|
842 | + } catch (PDOException $e) { |
|
843 | 843 | return "error"; |
844 | 844 | } |
845 | 845 | $query_delete = 'DELETE FROM spotter_live WHERE flightaware_id IN ('; |
846 | 846 | $i = 0; |
847 | - $j =0; |
|
847 | + $j = 0; |
|
848 | 848 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
849 | - foreach($all as $row) |
|
849 | + foreach ($all as $row) |
|
850 | 850 | { |
851 | 851 | $i++; |
852 | 852 | $j++; |
@@ -854,9 +854,9 @@ discard block |
||
854 | 854 | if ($globalDebug) echo "."; |
855 | 855 | try { |
856 | 856 | |
857 | - $sth = $this->db->prepare(substr($query_delete,0,-1).")"); |
|
857 | + $sth = $this->db->prepare(substr($query_delete, 0, -1).")"); |
|
858 | 858 | $sth->execute(); |
859 | - } catch(PDOException $e) { |
|
859 | + } catch (PDOException $e) { |
|
860 | 860 | return "error"; |
861 | 861 | } |
862 | 862 | $query_delete = 'DELETE FROM spotter_live WHERE flightaware_id IN ('; |
@@ -867,9 +867,9 @@ discard block |
||
867 | 867 | if ($i > 0) { |
868 | 868 | try { |
869 | 869 | |
870 | - $sth = $this->db->prepare(substr($query_delete,0,-1).")"); |
|
870 | + $sth = $this->db->prepare(substr($query_delete, 0, -1).")"); |
|
871 | 871 | $sth->execute(); |
872 | - } catch(PDOException $e) { |
|
872 | + } catch (PDOException $e) { |
|
873 | 873 | return "error"; |
874 | 874 | } |
875 | 875 | } |
@@ -882,7 +882,7 @@ discard block |
||
882 | 882 | |
883 | 883 | $sth = $this->db->prepare($query); |
884 | 884 | $sth->execute(); |
885 | - } catch(PDOException $e) { |
|
885 | + } catch (PDOException $e) { |
|
886 | 886 | return "error"; |
887 | 887 | } |
888 | 888 | /* $query_delete = "DELETE FROM spotter_live WHERE flightaware_id IN ("; |
@@ -930,13 +930,13 @@ discard block |
||
930 | 930 | public function deleteLiveSpotterDataByIdent($ident) |
931 | 931 | { |
932 | 932 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
933 | - $query = 'DELETE FROM spotter_live WHERE ident = :ident'; |
|
933 | + $query = 'DELETE FROM spotter_live WHERE ident = :ident'; |
|
934 | 934 | |
935 | 935 | try { |
936 | 936 | |
937 | 937 | $sth = $this->db->prepare($query); |
938 | 938 | $sth->execute(array(':ident' => $ident)); |
939 | - } catch(PDOException $e) { |
|
939 | + } catch (PDOException $e) { |
|
940 | 940 | return "error"; |
941 | 941 | } |
942 | 942 | |
@@ -952,13 +952,13 @@ discard block |
||
952 | 952 | public function deleteLiveSpotterDataById($id) |
953 | 953 | { |
954 | 954 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
955 | - $query = 'DELETE FROM spotter_live WHERE flightaware_id = :id'; |
|
955 | + $query = 'DELETE FROM spotter_live WHERE flightaware_id = :id'; |
|
956 | 956 | |
957 | 957 | try { |
958 | 958 | |
959 | 959 | $sth = $this->db->prepare($query); |
960 | 960 | $sth->execute(array(':id' => $id)); |
961 | - } catch(PDOException $e) { |
|
961 | + } catch (PDOException $e) { |
|
962 | 962 | return "error"; |
963 | 963 | } |
964 | 964 | |
@@ -976,13 +976,13 @@ discard block |
||
976 | 976 | { |
977 | 977 | global $globalDBdriver, $globalTimezone; |
978 | 978 | if ($globalDBdriver == 'mysql') { |
979 | - $query = 'SELECT spotter_live.ident FROM spotter_live |
|
979 | + $query = 'SELECT spotter_live.ident FROM spotter_live |
|
980 | 980 | WHERE spotter_live.ident = :ident |
981 | 981 | AND spotter_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 HOUR) |
982 | 982 | AND spotter_live.date < UTC_TIMESTAMP()'; |
983 | 983 | $query_data = array(':ident' => $ident); |
984 | 984 | } else { |
985 | - $query = "SELECT spotter_live.ident FROM spotter_live |
|
985 | + $query = "SELECT spotter_live.ident FROM spotter_live |
|
986 | 986 | WHERE spotter_live.ident = :ident |
987 | 987 | AND spotter_live.date >= now() AT TIME ZONE 'UTC' - INTERVAL '1 HOURS' |
988 | 988 | AND spotter_live.date < now() AT TIME ZONE 'UTC'"; |
@@ -991,8 +991,8 @@ discard block |
||
991 | 991 | |
992 | 992 | $sth = $this->db->prepare($query); |
993 | 993 | $sth->execute($query_data); |
994 | - $ident_result=''; |
|
995 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
994 | + $ident_result = ''; |
|
995 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
996 | 996 | { |
997 | 997 | $ident_result = $row['ident']; |
998 | 998 | } |
@@ -1009,13 +1009,13 @@ discard block |
||
1009 | 1009 | { |
1010 | 1010 | global $globalDBdriver, $globalTimezone; |
1011 | 1011 | if ($globalDBdriver == 'mysql') { |
1012 | - $query = 'SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live |
|
1012 | + $query = 'SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live |
|
1013 | 1013 | WHERE spotter_live.ident = :ident |
1014 | 1014 | AND spotter_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 20 MINUTE)'; |
1015 | 1015 | // AND spotter_live.date < UTC_TIMESTAMP()"; |
1016 | 1016 | $query_data = array(':ident' => $ident); |
1017 | 1017 | } else { |
1018 | - $query = "SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live |
|
1018 | + $query = "SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live |
|
1019 | 1019 | WHERE spotter_live.ident = :ident |
1020 | 1020 | AND spotter_live.date >= now() AT TIME ZONE 'UTC' - INTERVAL '20 MINUTES'"; |
1021 | 1021 | // AND spotter_live.date < now() AT TIME ZONE 'UTC'"; |
@@ -1024,8 +1024,8 @@ discard block |
||
1024 | 1024 | |
1025 | 1025 | $sth = $this->db->prepare($query); |
1026 | 1026 | $sth->execute($query_data); |
1027 | - $ident_result=''; |
|
1028 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1027 | + $ident_result = ''; |
|
1028 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1029 | 1029 | { |
1030 | 1030 | $ident_result = $row['flightaware_id']; |
1031 | 1031 | } |
@@ -1042,13 +1042,13 @@ discard block |
||
1042 | 1042 | { |
1043 | 1043 | global $globalDBdriver, $globalTimezone; |
1044 | 1044 | if ($globalDBdriver == 'mysql') { |
1045 | - $query = 'SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live |
|
1045 | + $query = 'SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live |
|
1046 | 1046 | WHERE spotter_live.flightaware_id = :id |
1047 | 1047 | AND spotter_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 10 HOUR)'; |
1048 | 1048 | // AND spotter_live.date < UTC_TIMESTAMP()"; |
1049 | 1049 | $query_data = array(':id' => $id); |
1050 | 1050 | } else { |
1051 | - $query = "SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live |
|
1051 | + $query = "SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live |
|
1052 | 1052 | WHERE spotter_live.flightaware_id = :id |
1053 | 1053 | AND spotter_live.date >= now() AT TIME ZONE 'UTC' - INTERVAL '10 HOUR'"; |
1054 | 1054 | // AND spotter_live.date < now() AT TIME ZONE 'UTC'"; |
@@ -1057,8 +1057,8 @@ discard block |
||
1057 | 1057 | |
1058 | 1058 | $sth = $this->db->prepare($query); |
1059 | 1059 | $sth->execute($query_data); |
1060 | - $ident_result=''; |
|
1061 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1060 | + $ident_result = ''; |
|
1061 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1062 | 1062 | { |
1063 | 1063 | $ident_result = $row['flightaware_id']; |
1064 | 1064 | } |
@@ -1075,13 +1075,13 @@ discard block |
||
1075 | 1075 | { |
1076 | 1076 | global $globalDBdriver, $globalTimezone; |
1077 | 1077 | if ($globalDBdriver == 'mysql') { |
1078 | - $query = 'SELECT spotter_live.ModeS, spotter_live.flightaware_id FROM spotter_live |
|
1078 | + $query = 'SELECT spotter_live.ModeS, spotter_live.flightaware_id FROM spotter_live |
|
1079 | 1079 | WHERE spotter_live.ModeS = :modes |
1080 | 1080 | AND spotter_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 20 MINUTE)'; |
1081 | 1081 | // AND spotter_live.date < UTC_TIMESTAMP()"; |
1082 | 1082 | $query_data = array(':modes' => $modes); |
1083 | 1083 | } else { |
1084 | - $query = "SELECT spotter_live.ModeS, spotter_live.flightaware_id FROM spotter_live |
|
1084 | + $query = "SELECT spotter_live.ModeS, spotter_live.flightaware_id FROM spotter_live |
|
1085 | 1085 | WHERE spotter_live.ModeS = :modes |
1086 | 1086 | AND spotter_live.date >= CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '20 MINUTE'"; |
1087 | 1087 | // // AND spotter_live.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC'"; |
@@ -1090,8 +1090,8 @@ discard block |
||
1090 | 1090 | |
1091 | 1091 | $sth = $this->db->prepare($query); |
1092 | 1092 | $sth->execute($query_data); |
1093 | - $ident_result=''; |
|
1094 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1093 | + $ident_result = ''; |
|
1094 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1095 | 1095 | { |
1096 | 1096 | //$ident_result = $row['spotter_live_id']; |
1097 | 1097 | $ident_result = $row['flightaware_id']; |
@@ -1116,8 +1116,8 @@ discard block |
||
1116 | 1116 | return array(); |
1117 | 1117 | } else { |
1118 | 1118 | $q_array = explode(" ", $q); |
1119 | - foreach ($q_array as $q_item){ |
|
1120 | - $q_item = filter_var($q_item,FILTER_SANITIZE_STRING); |
|
1119 | + foreach ($q_array as $q_item) { |
|
1120 | + $q_item = filter_var($q_item, FILTER_SANITIZE_STRING); |
|
1121 | 1121 | $additional_query .= " AND ("; |
1122 | 1122 | $additional_query .= "(spotter_live.aircraft_icao like '%".$q_item."%') OR "; |
1123 | 1123 | $additional_query .= "(spotter_live.aircraft_name like '%".$q_item."%') OR "; |
@@ -1132,11 +1132,11 @@ discard block |
||
1132 | 1132 | } |
1133 | 1133 | } |
1134 | 1134 | if ($globalDBdriver == 'mysql') { |
1135 | - $query = "SELECT spotter_live.* FROM spotter_live |
|
1135 | + $query = "SELECT spotter_live.* FROM spotter_live |
|
1136 | 1136 | WHERE spotter_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 20 SECOND) ".$additional_query." |
1137 | 1137 | AND spotter_live.date < UTC_TIMESTAMP()"; |
1138 | 1138 | } else { |
1139 | - $query = "SELECT spotter_live.* FROM spotter_live |
|
1139 | + $query = "SELECT spotter_live.* FROM spotter_live |
|
1140 | 1140 | WHERE spotter_live.date::timestamp >= CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '20 SECONDS' ".$additional_query." |
1141 | 1141 | AND spotter_live.date::timestamp < CURRENT_TIMESTAMP AT TIME ZONE 'UTC'"; |
1142 | 1142 | } |
@@ -1156,7 +1156,7 @@ discard block |
||
1156 | 1156 | * @return String success or false |
1157 | 1157 | * |
1158 | 1158 | */ |
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 = '') |
|
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; |
1162 | 1162 | $Common = new Common(); |
@@ -1256,27 +1256,27 @@ discard block |
||
1256 | 1256 | if ($date == '') $date = date("Y-m-d H:i:s", time()); |
1257 | 1257 | |
1258 | 1258 | |
1259 | - $flightaware_id = filter_var($flightaware_id,FILTER_SANITIZE_STRING); |
|
1260 | - $ident = filter_var($ident,FILTER_SANITIZE_STRING); |
|
1261 | - $aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING); |
|
1262 | - $departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING); |
|
1263 | - $arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING); |
|
1264 | - $latitude = filter_var($latitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
1265 | - $longitude = filter_var($longitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
1266 | - $waypoints = filter_var($waypoints,FILTER_SANITIZE_STRING); |
|
1267 | - $altitude = filter_var($altitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
1268 | - $altitude_real = filter_var($altitude_real,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
1269 | - $heading = filter_var($heading,FILTER_SANITIZE_NUMBER_INT); |
|
1270 | - $groundspeed = filter_var($groundspeed,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
1271 | - $squawk = filter_var($squawk,FILTER_SANITIZE_NUMBER_INT); |
|
1272 | - $route_stop = filter_var($route_stop,FILTER_SANITIZE_STRING); |
|
1273 | - $ModeS = filter_var($ModeS,FILTER_SANITIZE_STRING); |
|
1274 | - $pilot_id = filter_var($pilot_id,FILTER_SANITIZE_STRING); |
|
1275 | - $pilot_name = filter_var($pilot_name,FILTER_SANITIZE_STRING); |
|
1276 | - $format_source = filter_var($format_source,FILTER_SANITIZE_STRING); |
|
1277 | - $source_name = filter_var($source_name,FILTER_SANITIZE_STRING); |
|
1278 | - $over_country = filter_var($over_country,FILTER_SANITIZE_STRING); |
|
1279 | - $verticalrate = filter_var($verticalrate,FILTER_SANITIZE_NUMBER_INT); |
|
1259 | + $flightaware_id = filter_var($flightaware_id, FILTER_SANITIZE_STRING); |
|
1260 | + $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
|
1261 | + $aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING); |
|
1262 | + $departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING); |
|
1263 | + $arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING); |
|
1264 | + $latitude = filter_var($latitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
1265 | + $longitude = filter_var($longitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
1266 | + $waypoints = filter_var($waypoints, FILTER_SANITIZE_STRING); |
|
1267 | + $altitude = filter_var($altitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
1268 | + $altitude_real = filter_var($altitude_real, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
1269 | + $heading = filter_var($heading, FILTER_SANITIZE_NUMBER_INT); |
|
1270 | + $groundspeed = filter_var($groundspeed, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
1271 | + $squawk = filter_var($squawk, FILTER_SANITIZE_NUMBER_INT); |
|
1272 | + $route_stop = filter_var($route_stop, FILTER_SANITIZE_STRING); |
|
1273 | + $ModeS = filter_var($ModeS, FILTER_SANITIZE_STRING); |
|
1274 | + $pilot_id = filter_var($pilot_id, FILTER_SANITIZE_STRING); |
|
1275 | + $pilot_name = filter_var($pilot_name, FILTER_SANITIZE_STRING); |
|
1276 | + $format_source = filter_var($format_source, FILTER_SANITIZE_STRING); |
|
1277 | + $source_name = filter_var($source_name, FILTER_SANITIZE_STRING); |
|
1278 | + $over_country = filter_var($over_country, FILTER_SANITIZE_STRING); |
|
1279 | + $verticalrate = filter_var($verticalrate, FILTER_SANITIZE_NUMBER_INT); |
|
1280 | 1280 | |
1281 | 1281 | $airline_name = ''; |
1282 | 1282 | $airline_icao = ''; |
@@ -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) { |
@@ -1312,19 +1312,19 @@ discard block |
||
1312 | 1312 | $query .= 'INSERT INTO spotter_live (flightaware_id, ident, registration, airline_name, airline_icao, airline_country, airline_type, aircraft_icao, aircraft_shadow, aircraft_name, aircraft_manufacturer, departure_airport_icao, departure_airport_name, departure_airport_city, departure_airport_country, arrival_airport_icao, arrival_airport_name, arrival_airport_city, arrival_airport_country, latitude, longitude, waypoints, altitude, heading, ground_speed, date, departure_airport_time, arrival_airport_time, squawk, route_stop, ModeS, pilot_id, pilot_name, verticalrate, ground, format_source, source_name, over_country, real_altitude) |
1313 | 1313 | VALUES (:flightaware_id,:ident,:registration,:airline_name,:airline_icao,:airline_country,:airline_type,:aircraft_icao,:aircraft_shadow,:aircraft_type,:aircraft_manufacturer,:departure_airport_icao,:departure_airport_name, :departure_airport_city, :departure_airport_country, :arrival_airport_icao, :arrival_airport_name, :arrival_airport_city, :arrival_airport_country, :latitude,:longitude,:waypoints,:altitude,:heading,:groundspeed,:date,:departure_airport_time,:arrival_airport_time,:squawk,:route_stop,:ModeS, :pilot_id, :pilot_name, :verticalrate, :ground, :format_source, :source_name, :over_country, :real_altitude)'; |
1314 | 1314 | |
1315 | - $query_values = array(':flightaware_id' => $flightaware_id,':ident' => $ident, ':registration' => $registration,':airline_name' => $airline_name,':airline_icao' => $airline_icao,':airline_country' => $airline_country,':airline_type' => $airline_type,':aircraft_icao' => $aircraft_icao,':aircraft_shadow' => $aircraft_shadow,':aircraft_type' => $aircraft_type,':aircraft_manufacturer' => $aircraft_manufacturer,':departure_airport_icao' => $departure_airport_icao,':departure_airport_name' => $departure_airport_name,':departure_airport_city' => $departure_airport_city,':departure_airport_country' => $departure_airport_country,':arrival_airport_icao' => $arrival_airport_icao,':arrival_airport_name' => $arrival_airport_name,':arrival_airport_city' => $arrival_airport_city,':arrival_airport_country' => $arrival_airport_country,':latitude' => $latitude,':longitude' => $longitude, ':waypoints' => $waypoints,':altitude' => $altitude,':heading' => $heading,':groundspeed' => $groundspeed,':date' => $date, ':departure_airport_time' => $departure_airport_time,':arrival_airport_time' => $arrival_airport_time, ':squawk' => $squawk,':route_stop' => $route_stop,':ModeS' => $ModeS, ':pilot_id' => $pilot_id, ':pilot_name' => $pilot_name, ':verticalrate' => $verticalrate, ':format_source' => $format_source,':ground' => $ground, ':source_name' => $source_name, ':over_country' => $over_country,':real_altitude' => $altitude_real); |
|
1315 | + $query_values = array(':flightaware_id' => $flightaware_id, ':ident' => $ident, ':registration' => $registration, ':airline_name' => $airline_name, ':airline_icao' => $airline_icao, ':airline_country' => $airline_country, ':airline_type' => $airline_type, ':aircraft_icao' => $aircraft_icao, ':aircraft_shadow' => $aircraft_shadow, ':aircraft_type' => $aircraft_type, ':aircraft_manufacturer' => $aircraft_manufacturer, ':departure_airport_icao' => $departure_airport_icao, ':departure_airport_name' => $departure_airport_name, ':departure_airport_city' => $departure_airport_city, ':departure_airport_country' => $departure_airport_country, ':arrival_airport_icao' => $arrival_airport_icao, ':arrival_airport_name' => $arrival_airport_name, ':arrival_airport_city' => $arrival_airport_city, ':arrival_airport_country' => $arrival_airport_country, ':latitude' => $latitude, ':longitude' => $longitude, ':waypoints' => $waypoints, ':altitude' => $altitude, ':heading' => $heading, ':groundspeed' => $groundspeed, ':date' => $date, ':departure_airport_time' => $departure_airport_time, ':arrival_airport_time' => $arrival_airport_time, ':squawk' => $squawk, ':route_stop' => $route_stop, ':ModeS' => $ModeS, ':pilot_id' => $pilot_id, ':pilot_name' => $pilot_name, ':verticalrate' => $verticalrate, ':format_source' => $format_source, ':ground' => $ground, ':source_name' => $source_name, ':over_country' => $over_country, ':real_altitude' => $altitude_real); |
|
1316 | 1316 | try { |
1317 | 1317 | |
1318 | 1318 | $sth = $this->db->prepare($query); |
1319 | 1319 | $sth->execute($query_values); |
1320 | 1320 | $sth->closeCursor(); |
1321 | - } catch(PDOException $e) { |
|
1321 | + } catch (PDOException $e) { |
|
1322 | 1322 | return "error : ".$e->getMessage(); |
1323 | 1323 | } |
1324 | 1324 | if (isset($globalArchive) && $globalArchive && $putinarchive && $noarchive !== true) { |
1325 | 1325 | if ($globalDebug) echo '(Add to Spotter archive : '; |
1326 | 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); |
|
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 | 1328 | if ($globalDebug) echo $result.')'; |
1329 | 1329 | } elseif ($globalDebug && $putinarchive !== true) { |
1330 | 1330 | echo '(Not adding to archive)'; |
@@ -1337,7 +1337,7 @@ discard block |
||
1337 | 1337 | |
1338 | 1338 | public function getOrderBy() |
1339 | 1339 | { |
1340 | - $orderby = array("aircraft_asc" => array("key" => "aircraft_asc", "value" => "Aircraft Type - ASC", "sql" => "ORDER BY spotter_live.aircraft_icao ASC"), "aircraft_desc" => array("key" => "aircraft_desc", "value" => "Aircraft Type - DESC", "sql" => "ORDER BY spotter_live.aircraft_icao DESC"),"manufacturer_asc" => array("key" => "manufacturer_asc", "value" => "Aircraft Manufacturer - ASC", "sql" => "ORDER BY spotter_live.aircraft_manufacturer ASC"), "manufacturer_desc" => array("key" => "manufacturer_desc", "value" => "Aircraft Manufacturer - DESC", "sql" => "ORDER BY spotter_live.aircraft_manufacturer DESC"),"airline_name_asc" => array("key" => "airline_name_asc", "value" => "Airline Name - ASC", "sql" => "ORDER BY spotter_live.airline_name ASC"), "airline_name_desc" => array("key" => "airline_name_desc", "value" => "Airline Name - DESC", "sql" => "ORDER BY spotter_live.airline_name DESC"), "ident_asc" => array("key" => "ident_asc", "value" => "Ident - ASC", "sql" => "ORDER BY spotter_live.ident ASC"), "ident_desc" => array("key" => "ident_desc", "value" => "Ident - DESC", "sql" => "ORDER BY spotter_live.ident DESC"), "airport_departure_asc" => array("key" => "airport_departure_asc", "value" => "Departure Airport - ASC", "sql" => "ORDER BY spotter_live.departure_airport_city ASC"), "airport_departure_desc" => array("key" => "airport_departure_desc", "value" => "Departure Airport - DESC", "sql" => "ORDER BY spotter_live.departure_airport_city DESC"), "airport_arrival_asc" => array("key" => "airport_arrival_asc", "value" => "Arrival Airport - ASC", "sql" => "ORDER BY spotter_live.arrival_airport_city ASC"), "airport_arrival_desc" => array("key" => "airport_arrival_desc", "value" => "Arrival Airport - DESC", "sql" => "ORDER BY spotter_live.arrival_airport_city DESC"), "date_asc" => array("key" => "date_asc", "value" => "Date - ASC", "sql" => "ORDER BY spotter_live.date ASC"), "date_desc" => array("key" => "date_desc", "value" => "Date - DESC", "sql" => "ORDER BY spotter_live.date DESC")); |
|
1340 | + $orderby = array("aircraft_asc" => array("key" => "aircraft_asc", "value" => "Aircraft Type - ASC", "sql" => "ORDER BY spotter_live.aircraft_icao ASC"), "aircraft_desc" => array("key" => "aircraft_desc", "value" => "Aircraft Type - DESC", "sql" => "ORDER BY spotter_live.aircraft_icao DESC"), "manufacturer_asc" => array("key" => "manufacturer_asc", "value" => "Aircraft Manufacturer - ASC", "sql" => "ORDER BY spotter_live.aircraft_manufacturer ASC"), "manufacturer_desc" => array("key" => "manufacturer_desc", "value" => "Aircraft Manufacturer - DESC", "sql" => "ORDER BY spotter_live.aircraft_manufacturer DESC"), "airline_name_asc" => array("key" => "airline_name_asc", "value" => "Airline Name - ASC", "sql" => "ORDER BY spotter_live.airline_name ASC"), "airline_name_desc" => array("key" => "airline_name_desc", "value" => "Airline Name - DESC", "sql" => "ORDER BY spotter_live.airline_name DESC"), "ident_asc" => array("key" => "ident_asc", "value" => "Ident - ASC", "sql" => "ORDER BY spotter_live.ident ASC"), "ident_desc" => array("key" => "ident_desc", "value" => "Ident - DESC", "sql" => "ORDER BY spotter_live.ident DESC"), "airport_departure_asc" => array("key" => "airport_departure_asc", "value" => "Departure Airport - ASC", "sql" => "ORDER BY spotter_live.departure_airport_city ASC"), "airport_departure_desc" => array("key" => "airport_departure_desc", "value" => "Departure Airport - DESC", "sql" => "ORDER BY spotter_live.departure_airport_city DESC"), "airport_arrival_asc" => array("key" => "airport_arrival_asc", "value" => "Arrival Airport - ASC", "sql" => "ORDER BY spotter_live.arrival_airport_city ASC"), "airport_arrival_desc" => array("key" => "airport_arrival_desc", "value" => "Arrival Airport - DESC", "sql" => "ORDER BY spotter_live.arrival_airport_city DESC"), "date_asc" => array("key" => "date_asc", "value" => "Date - ASC", "sql" => "ORDER BY spotter_live.date ASC"), "date_desc" => array("key" => "date_desc", "value" => "Date - DESC", "sql" => "ORDER BY spotter_live.date DESC")); |
|
1341 | 1341 | return $orderby; |
1342 | 1342 | } |
1343 | 1343 |
@@ -42,20 +42,20 @@ discard block |
||
42 | 42 | * @param String $date get data for a date |
43 | 43 | * @return Array Return Accidents data in array |
44 | 44 | */ |
45 | - public function getAccidentData($limit = '',$type = '',$date = '') { |
|
45 | + public function getAccidentData($limit = '', $type = '', $date = '') { |
|
46 | 46 | global $globalURL, $globalDBdriver; |
47 | 47 | $Image = new Image($this->db); |
48 | 48 | $Spotter = new Spotter($this->db); |
49 | 49 | $Translation = new Translation($this->db); |
50 | - $date = filter_var($date,FILTER_SANITIZE_STRING); |
|
50 | + $date = filter_var($date, FILTER_SANITIZE_STRING); |
|
51 | 51 | date_default_timezone_set('UTC'); |
52 | 52 | $result = array(); |
53 | 53 | $limit_query = ''; |
54 | 54 | if ($limit != "") |
55 | 55 | { |
56 | 56 | $limit_array = explode(",", $limit); |
57 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
58 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
57 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
58 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
59 | 59 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
60 | 60 | { |
61 | 61 | $limit_query = " LIMIT ".$limit_array[1]." OFFSET ".$limit_array[0]; |
@@ -64,29 +64,29 @@ discard block |
||
64 | 64 | |
65 | 65 | if ($type != '') { |
66 | 66 | if ($date != '') { |
67 | - if (preg_match("/^[0-9]{4}-[0-9]{2}-[0-9]{2}$/",$date)) { |
|
67 | + if (preg_match("/^[0-9]{4}-[0-9]{2}-[0-9]{2}$/", $date)) { |
|
68 | 68 | $query = "SELECT * FROM accidents WHERE accidents_id IN (SELECT max(accidents_id) FROM accidents WHERE type = :type AND date = :date GROUP BY registration) ORDER BY accidents.date DESC".$limit_query; |
69 | 69 | //$query = "SELECT accidents.registration, accidents.ident, accidents.date, accidents.url, accidents.country, accidents.place, accidents.title, accidents.fatalities, accidents.type, accidents.ident, accidents.aircraft_manufacturer, accidents.aircraft_name, accidents.airline_name, accidents.airline_icao, spotter_output.flightaware_id FROM accidents LEFT OUTER JOIN spotter_output ON accidents.registration = spotter_output.registration WHERE accidents_id IN (SELECT max(accidents_id) FROM accidents WHERE type = :type AND date = :date GROUP BY registration) ORDER BY accidents.date DESC".$limit_query; |
70 | - $query_values = array(':type' => $type,':date' => $date); |
|
71 | - } elseif (preg_match("/^[0-9]{4}-[0-9]{2}$/",$date)) { |
|
70 | + $query_values = array(':type' => $type, ':date' => $date); |
|
71 | + } elseif (preg_match("/^[0-9]{4}-[0-9]{2}$/", $date)) { |
|
72 | 72 | $query = "SELECT * FROM accidents WHERE accidents_id IN (SELECT max(accidents_id) FROM accidents WHERE type = :type AND date BETWEEN :dated AND :datef GROUP BY registration) ORDER BY accidents.date DESC".$limit_query; |
73 | - $query_values = array(':type' => $type,':dated' => $date.'-01', ':datef' => $date.'-31'); |
|
74 | - } elseif (preg_match("/^[0-9]{4}$/",$date)) { |
|
73 | + $query_values = array(':type' => $type, ':dated' => $date.'-01', ':datef' => $date.'-31'); |
|
74 | + } elseif (preg_match("/^[0-9]{4}$/", $date)) { |
|
75 | 75 | if ($globalDBdriver == 'mysql') { |
76 | 76 | $query = "SELECT * FROM accidents WHERE accidents_id IN (SELECT max(accidents_id) FROM accidents WHERE type = :type AND YEAR(date) = :date GROUP BY registration) ORDER BY accidents.date DESC".$limit_query; |
77 | 77 | } else { |
78 | 78 | $query = "SELECT * FROM accidents WHERE accidents_id IN (SELECT max(accidents_id) FROM accidents WHERE type = :type AND EXTRACT(YEAR FROM date) = :date GROUP BY registration) ORDER BY accidents.date DESC".$limit_query; |
79 | 79 | } |
80 | - $query_values = array(':type' => $type,':date' => $date); |
|
80 | + $query_values = array(':type' => $type, ':date' => $date); |
|
81 | 81 | } else { |
82 | 82 | $date = $date.'%'; |
83 | 83 | if ($globalDBdriver == 'mysql') { |
84 | 84 | $query = "SELECT * FROM accidents WHERE accidents_id IN (SELECT max(accidents_id) FROM accidents WHERE type = :type AND DATE_FORMAT(date,'%Y-%m-%d') LIKE :date GROUP BY registration) ORDER BY accidents.date DESC".$limit_query; |
85 | - $query_values = array(':type' => $type,':date' => $date); |
|
85 | + $query_values = array(':type' => $type, ':date' => $date); |
|
86 | 86 | } else { |
87 | 87 | $query = "SELECT * FROM accidents WHERE accidents_id IN (SELECT max(accidents_id) FROM accidents WHERE type = :type AND to_char(date,'YYYY-MM-DD') LIKE :date GROUP BY registration) ORDER BY accidents.date DESC".$limit_query; |
88 | 88 | //$query = "SELECT accidents.registration, accidents.ident, accidents.date, accidents.url, accidents.country, accidents.place, accidents.title, accidents.fatalities, accidents.type, accidents.ident, accidents.aircraft_manufacturer, accidents.aircraft_name, accidents.airline_name, accidents.airline_icao, spotter_output.flightaware_id FROM accidents LEFT OUTER JOIN spotter_output ON accidents.registration = spotter_output.registration WHERE accidents_id IN (SELECT max(accidents_id) FROM accidents WHERE type = :type AND to_char(date,'YYYY-MM-DD') LIKE :date GROUP BY registration) ORDER BY accidents.date DESC".$limit_query; |
89 | - $query_values = array(':type' => $type,':date' => $date); |
|
89 | + $query_values = array(':type' => $type, ':date' => $date); |
|
90 | 90 | } |
91 | 91 | } |
92 | 92 | } else { |
@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | } |
98 | 98 | } else { |
99 | 99 | if ($date != '') { |
100 | - if (preg_match("/^[0-9]{4}-[0-9]{2}-[0-9]{2}$/",$date)) { |
|
100 | + if (preg_match("/^[0-9]{4}-[0-9]{2}-[0-9]{2}$/", $date)) { |
|
101 | 101 | $query = "SELECT * FROM accidents WHERE accidents_id IN (SELECT max(accidents_id) FROM accidents WHERE date = :date GROUP BY registration) ORDER BY accidents.date DESC".$limit_query; |
102 | 102 | //$query = "SELECT accidents.registration, accidents.ident, accidents.date, accidents.url, accidents.country, accidents.place, accidents.title, accidents.fatalities, accidents.type, accidents.ident, accidents.aircraft_manufacturer, accidents.aircraft_name, accidents.airline_name, accidents.airline_icao, spotter_output.flightaware_id FROM accidents LEFT OUTER JOIN spotter_output ON accidents.registration = spotter_output.registration WHERE accidents_id IN (SELECT max(accidents_id) FROM accidents WHERE date = :date GROUP BY registration) ORDER BY accidents.date DESC".$limit_query; |
103 | 103 | } else { |
@@ -116,17 +116,17 @@ discard block |
||
116 | 116 | try { |
117 | 117 | $sth = $this->db->prepare($query); |
118 | 118 | $sth->execute($query_values); |
119 | - } catch(PDOException $e) { |
|
119 | + } catch (PDOException $e) { |
|
120 | 120 | echo "error : ".$e->getMessage(); |
121 | 121 | } |
122 | 122 | $i = 0; |
123 | 123 | while ($row = $sth->fetch(PDO::FETCH_ASSOC)) { |
124 | - if (preg_match('/^[\w\-]+$/',$row['registration'])) { |
|
124 | + if (preg_match('/^[\w\-]+$/', $row['registration'])) { |
|
125 | 125 | $data = array(); |
126 | 126 | if ($row['registration'] != '') { |
127 | 127 | $image_array = $Image->getSpotterImage($row['registration']); |
128 | - if (count($image_array) > 0) $data = array_merge($data,array('image' => $image_array[0]['image'],'image_thumbnail' => $image_array[0]['image_thumbnail'],'image_copyright' => $image_array[0]['image_copyright'],'image_source' => $image_array[0]['image_source'],'image_source_website' => $image_array[0]['image_source_website'])); |
|
129 | - else $data = array_merge($data,array('image' => '','image_thumbnail' => '','image_copyright' => '','image_source' => '','image_source_website' => '')); |
|
128 | + if (count($image_array) > 0) $data = array_merge($data, array('image' => $image_array[0]['image'], 'image_thumbnail' => $image_array[0]['image_thumbnail'], 'image_copyright' => $image_array[0]['image_copyright'], 'image_source' => $image_array[0]['image_source'], 'image_source_website' => $image_array[0]['image_source_website'])); |
|
129 | + else $data = array_merge($data, array('image' => '', 'image_thumbnail' => '', 'image_copyright' => '', 'image_source' => '', 'image_source_website' => '')); |
|
130 | 130 | $aircraft_type = $Spotter->getAllAircraftTypeByRegistration($row['registration']); |
131 | 131 | $aircraft_info = $Spotter->getAllAircraftInfo($aircraft_type); |
132 | 132 | if (!empty($aircraft_info)) { |
@@ -134,7 +134,7 @@ discard block |
||
134 | 134 | $data['aircraft_name'] = $aircraft_info[0]['type']; |
135 | 135 | $data['aircraft_manufacturer'] = $aircraft_info[0]['manufacturer']; |
136 | 136 | } else { |
137 | - $data = array_merge($data,array('aircraft_type' => 'NA')); |
|
137 | + $data = array_merge($data, array('aircraft_type' => 'NA')); |
|
138 | 138 | } |
139 | 139 | $owner_data = $Spotter->getAircraftOwnerByRegistration($row['registration']); |
140 | 140 | if (!empty($owner_data)) { |
@@ -142,18 +142,18 @@ discard block |
||
142 | 142 | $data['aircraft_base'] = $owner_data['base']; |
143 | 143 | $data['aircraft_date_first_reg'] = $owner_data['date_first_reg']; |
144 | 144 | } |
145 | - } else $data = array_merge($data,array('image' => '','image_thumbnail' => '','image_copyright' => '','image_source' => '','image_source_website' => '')); |
|
145 | + } else $data = array_merge($data, array('image' => '', 'image_thumbnail' => '', 'image_copyright' => '', 'image_source' => '', 'image_source_website' => '')); |
|
146 | 146 | if ($row['registration'] == '') $row['registration'] = 'NA'; |
147 | 147 | if ($row['ident'] == '') $row['ident'] = 'NA'; |
148 | - $identicao = $Spotter->getAllAirlineInfo(substr($row['ident'],0,3)); |
|
148 | + $identicao = $Spotter->getAllAirlineInfo(substr($row['ident'], 0, 3)); |
|
149 | 149 | if (isset($identicao[0])) { |
150 | - if (substr($row['ident'],0,2) == 'AF') { |
|
151 | - if (filter_var(substr($row['ident'],2),FILTER_VALIDATE_INT,array("flags"=>FILTER_FLAG_ALLOW_OCTAL))) $icao = $row['ident']; |
|
152 | - else $icao = 'AFR'.ltrim(substr($row['ident'],2),'0'); |
|
153 | - } else $icao = $identicao[0]['icao'].ltrim(substr($row['ident'],2),'0'); |
|
154 | - $data = array_merge($data,array('airline_icao' => $identicao[0]['icao'],'airline_name' => $identicao[0]['name'])); |
|
150 | + if (substr($row['ident'], 0, 2) == 'AF') { |
|
151 | + if (filter_var(substr($row['ident'], 2), FILTER_VALIDATE_INT, array("flags"=>FILTER_FLAG_ALLOW_OCTAL))) $icao = $row['ident']; |
|
152 | + else $icao = 'AFR'.ltrim(substr($row['ident'], 2), '0'); |
|
153 | + } else $icao = $identicao[0]['icao'].ltrim(substr($row['ident'], 2), '0'); |
|
154 | + $data = array_merge($data, array('airline_icao' => $identicao[0]['icao'], 'airline_name' => $identicao[0]['name'])); |
|
155 | 155 | } else $icao = $row['ident']; |
156 | - $icao = $Translation->checkTranslation($icao,false); |
|
156 | + $icao = $Translation->checkTranslation($icao, false); |
|
157 | 157 | //$data = array_merge($data,array('registration' => $row['registration'], 'date' => $row['date'], 'ident' => $icao,'url' => $row['url'])); |
158 | 158 | if ($row['airline_name'] != '' && !isset($data['airline_name'])) { |
159 | 159 | //echo 'Check airline info... for '.$row['airline_name'].' '; |
@@ -162,16 +162,16 @@ discard block |
||
162 | 162 | if (!empty($airline_info)) { |
163 | 163 | //echo 'data found !'."\n"; |
164 | 164 | //print_r($airline_info); |
165 | - $data = array_merge($data,$airline_info); |
|
165 | + $data = array_merge($data, $airline_info); |
|
166 | 166 | } |
167 | 167 | //else echo 'No data...'."\n"; |
168 | 168 | } |
169 | - $data = array_merge($row,$data); |
|
169 | + $data = array_merge($row, $data); |
|
170 | 170 | if ($data['ident'] == null) $data['ident'] = $icao; |
171 | 171 | if ($data['title'] == null) { |
172 | 172 | $data['message'] = $row['type'].' of '.$row['registration'].' at '.$row['place'].','.$row['country']; |
173 | 173 | } else $data['message'] = strtolower($data['title']); |
174 | - $ids = $Spotter->getAllIDByRegistration($data['registration'],true); |
|
174 | + $ids = $Spotter->getAllIDByRegistration($data['registration'], true); |
|
175 | 175 | $date = $data['date']; |
176 | 176 | if (isset($ids[$date])) { |
177 | 177 | $data['spotted'] = TRUE; |
@@ -203,7 +203,7 @@ discard block |
||
203 | 203 | try { |
204 | 204 | $sth = $this->db->prepare($query); |
205 | 205 | $sth->execute(); |
206 | - } catch(PDOException $e) { |
|
206 | + } catch (PDOException $e) { |
|
207 | 207 | echo "Error : ".$e->getMessage(); |
208 | 208 | } |
209 | 209 | return $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -223,7 +223,7 @@ discard block |
||
223 | 223 | try { |
224 | 224 | $sth = $this->db->prepare($query); |
225 | 225 | $sth->execute(); |
226 | - } catch(PDOException $e) { |
|
226 | + } catch (PDOException $e) { |
|
227 | 227 | echo "Error : ".$e->getMessage(); |
228 | 228 | } |
229 | 229 | return $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -238,15 +238,15 @@ discard block |
||
238 | 238 | if ($globalDebug) echo 'Import '.$file."\n"; |
239 | 239 | $result = array(); |
240 | 240 | if (file_exists($file)) { |
241 | - if (($handle = fopen($file,'r')) !== FALSE) { |
|
242 | - while (($data = fgetcsv($handle,2000,",")) !== FALSE) { |
|
241 | + if (($handle = fopen($file, 'r')) !== FALSE) { |
|
242 | + while (($data = fgetcsv($handle, 2000, ",")) !== FALSE) { |
|
243 | 243 | if (isset($data[1]) && $data[1] != '0000-00-00 00:00:00') { |
244 | - $result[] = array('registration' => $data[0],'date' => strtotime($data[1]),'url' => $data[2],'country' => $data[3],'place' => $data[4],'title' => $data[5],'fatalities' => $data[6],'latitude' => $data[7],'longitude' => $data[8],'type' => $data[9],'ident' => $data[10],'aircraft_manufacturer' => $data[11],'aircraft_name' => $data[12],'operator' => $data[13],'source' => 'website_fam'); |
|
244 | + $result[] = array('registration' => $data[0], 'date' => strtotime($data[1]), 'url' => $data[2], 'country' => $data[3], 'place' => $data[4], 'title' => $data[5], 'fatalities' => $data[6], 'latitude' => $data[7], 'longitude' => $data[8], 'type' => $data[9], 'ident' => $data[10], 'aircraft_manufacturer' => $data[11], 'aircraft_name' => $data[12], 'operator' => $data[13], 'source' => 'website_fam'); |
|
245 | 245 | } |
246 | 246 | } |
247 | 247 | fclose($handle); |
248 | 248 | } |
249 | - if (!empty($result)) $this->add($result,true); |
|
249 | + if (!empty($result)) $this->add($result, true); |
|
250 | 250 | elseif ($globalDebug) echo 'Nothing to import'; |
251 | 251 | } |
252 | 252 | } |
@@ -262,8 +262,8 @@ discard block |
||
262 | 262 | $all_md5_new = array(); |
263 | 263 | if (file_exists(dirname(__FILE__).'/../install/tmp/cr-all.md5')) { |
264 | 264 | if ($this->check_accidents_nb() > 0) { |
265 | - if (($handle = fopen(dirname(__FILE__).'/../install/tmp/cr-all.md5','r')) !== FALSE) { |
|
266 | - while (($data = fgetcsv($handle,2000,"\t")) !== FALSE) { |
|
265 | + if (($handle = fopen(dirname(__FILE__).'/../install/tmp/cr-all.md5', 'r')) !== FALSE) { |
|
266 | + while (($data = fgetcsv($handle, 2000, "\t")) !== FALSE) { |
|
267 | 267 | if (isset($data[1])) { |
268 | 268 | $year = $data[0]; |
269 | 269 | $all_md5[$year] = $data[1]; |
@@ -273,10 +273,10 @@ discard block |
||
273 | 273 | } |
274 | 274 | } |
275 | 275 | } |
276 | - $Common->download('http://data.flightairmap.fr/data/cr/cr-all.md5',dirname(__FILE__).'/../install/tmp/cr-all.md5'); |
|
276 | + $Common->download('http://data.flightairmap.fr/data/cr/cr-all.md5', dirname(__FILE__).'/../install/tmp/cr-all.md5'); |
|
277 | 277 | if (file_exists(dirname(__FILE__).'/../install/tmp/cr-all.md5')) { |
278 | - if (($handle = fopen(dirname(__FILE__).'/../install/tmp/cr-all.md5','r')) !== FALSE) { |
|
279 | - while (($data = fgetcsv($handle,2000,"\t")) !== FALSE) { |
|
278 | + if (($handle = fopen(dirname(__FILE__).'/../install/tmp/cr-all.md5', 'r')) !== FALSE) { |
|
279 | + while (($data = fgetcsv($handle, 2000, "\t")) !== FALSE) { |
|
280 | 280 | if (isset($data[1])) { |
281 | 281 | $year = $data[0]; |
282 | 282 | $all_md5_new[$year] = $data[1]; |
@@ -285,10 +285,10 @@ discard block |
||
285 | 285 | fclose($handle); |
286 | 286 | } elseif ($globalDebug) echo "Can't open ".dirname(__FILE__).'/../install/tmp/cr-all.md5'; |
287 | 287 | } elseif ($globalDebug) echo 'Download cr-all.md5 failed. '.dirname(__FILE__).'/../install/tmp/cr-all.md5 not here.'; |
288 | - $result = $Common->arr_diff($all_md5_new,$all_md5); |
|
288 | + $result = $Common->arr_diff($all_md5_new, $all_md5); |
|
289 | 289 | if (empty($result) && $globalDebug) echo 'Nothing to update'; |
290 | 290 | foreach ($result as $file => $md5) { |
291 | - $Common->download('http://data.flightairmap.fr/data/cr/'.$file,dirname(__FILE__).'/../install/tmp/'.$file); |
|
291 | + $Common->download('http://data.flightairmap.fr/data/cr/'.$file, dirname(__FILE__).'/../install/tmp/'.$file); |
|
292 | 292 | if (file_exists(dirname(__FILE__).'/../install/tmp/'.$file)) $this->import(dirname(__FILE__).'/../install/tmp/'.$file); |
293 | 293 | elseif ($globalDebug) echo 'Download '.$file.' failed'; |
294 | 294 | } |
@@ -298,7 +298,7 @@ discard block |
||
298 | 298 | * Add data to DB |
299 | 299 | * @param Array $crash An array with accidents/incidents data |
300 | 300 | */ |
301 | - public function add($crash,$new = false) { |
|
301 | + public function add($crash, $new = false) { |
|
302 | 302 | global $globalTransaction, $globalDebug, $globalAircraftImageFetch; |
303 | 303 | require_once('class.Connection.php'); |
304 | 304 | require_once('class.Image.php'); |
@@ -314,7 +314,7 @@ discard block |
||
314 | 314 | $sthd->execute(array(':source' => $crash[0]['source'])); |
315 | 315 | } |
316 | 316 | if ($globalTransaction) $Connection->db->beginTransaction(); |
317 | - $initial_array = array('ident' => null,'type' => 'accident','url' => null,'registration' => null, 'date' => null, 'place' => null,'country' => null, 'latitude' => null, 'longitude' => null, 'fatalities' => null, 'title' => '','source' => '','aircraft_manufacturer' => null,'aircraft_name' => null,'operator' => null); |
|
317 | + $initial_array = array('ident' => null, 'type' => 'accident', 'url' => null, 'registration' => null, 'date' => null, 'place' => null, 'country' => null, 'latitude' => null, 'longitude' => null, 'fatalities' => null, 'title' => '', 'source' => '', 'aircraft_manufacturer' => null, 'aircraft_name' => null, 'operator' => null); |
|
318 | 318 | $query_check = 'SELECT COUNT(*) as nb FROM accidents WHERE registration = :registration AND date = :date AND type = :type AND source = :source'; |
319 | 319 | $sth_check = $Connection->db->prepare($query_check); |
320 | 320 | $query = 'INSERT INTO accidents (aircraft_manufacturer,aircraft_name,ident,registration,date,url,country,place,title,fatalities,latitude,longitude,type,airline_name,source) VALUES (:aircraft_manufacturer,:aircraft_name,:ident,:registration,:date,:url,:country,:place,:title,:fatalities,:latitude,:longitude,:type,:airline_name,:source)'; |
@@ -327,15 +327,15 @@ discard block |
||
327 | 327 | $cr = array_map(function($value) { |
328 | 328 | return $value === "" ? NULL : $value; |
329 | 329 | }, $cr); |
330 | - if ($cr['date'] != '' && $cr['registration'] != null && $cr['registration'] != '' && $cr['registration'] != '?' && $cr['registration'] != '-' && strtolower($cr['registration']) != 'unknown' && $cr['date'] < time() && !preg_match('/\s/',$cr['registration'])) { |
|
331 | - if (strpos($cr['registration'],'-') === FALSE) $cr['registration'] = $Spotter->convertAircraftRegistration($cr['registration']); |
|
332 | - $query_check_values = array(':registration' => $cr['registration'],':date' => date('Y-m-d',$cr['date']),':type' => $cr['type'],':source' => $cr['source']); |
|
330 | + if ($cr['date'] != '' && $cr['registration'] != null && $cr['registration'] != '' && $cr['registration'] != '?' && $cr['registration'] != '-' && strtolower($cr['registration']) != 'unknown' && $cr['date'] < time() && !preg_match('/\s/', $cr['registration'])) { |
|
331 | + if (strpos($cr['registration'], '-') === FALSE) $cr['registration'] = $Spotter->convertAircraftRegistration($cr['registration']); |
|
332 | + $query_check_values = array(':registration' => $cr['registration'], ':date' => date('Y-m-d', $cr['date']), ':type' => $cr['type'], ':source' => $cr['source']); |
|
333 | 333 | $sth_check->execute($query_check_values); |
334 | 334 | $result_check = $sth_check->fetchAll(PDO::FETCH_ASSOC); |
335 | 335 | if ($result_check[0]['nb'] == 0) { |
336 | - $query_values = array(':registration' => trim($cr['registration']),':date' => date('Y-m-d',$cr['date']),':url' => $cr['url'],':country' => $cr['country'],':place' => $cr['place'],':title' => $cr['title'],':fatalities' => $cr['fatalities'],':latitude' => $cr['latitude'],':longitude' => $cr['longitude'],':type' => $cr['type'],':source' => $cr['source'],':ident' => $cr['ident'],':aircraft_manufacturer' => $cr['aircraft_manufacturer'],':aircraft_name' => $cr['aircraft_name'],':airline_name' => $cr['operator']); |
|
336 | + $query_values = array(':registration' => trim($cr['registration']), ':date' => date('Y-m-d', $cr['date']), ':url' => $cr['url'], ':country' => $cr['country'], ':place' => $cr['place'], ':title' => $cr['title'], ':fatalities' => $cr['fatalities'], ':latitude' => $cr['latitude'], ':longitude' => $cr['longitude'], ':type' => $cr['type'], ':source' => $cr['source'], ':ident' => $cr['ident'], ':aircraft_manufacturer' => $cr['aircraft_manufacturer'], ':aircraft_name' => $cr['aircraft_name'], ':airline_name' => $cr['operator']); |
|
337 | 337 | $sth->execute($query_values); |
338 | - if ($cr['date'] > time()-(30*86400)) { |
|
338 | + if ($cr['date'] > time() - (30*86400)) { |
|
339 | 339 | if ($globalAircraftImageFetch) { |
340 | 340 | $imgchk = $Image->getSpotterImage($cr['registration']); |
341 | 341 | if (empty($imgchk)) { |
@@ -346,17 +346,17 @@ discard block |
||
346 | 346 | // elseif ($globalDebug) echo 'Image already in DB'."\n"; |
347 | 347 | } |
348 | 348 | if ($cr['title'] == '') $cr['title'] = $cr['registration'].' '.$cr['type']; |
349 | - $Spotter->setHighlightFlightByRegistration($cr['registration'],$cr['title'],date('Y-m-d',$cr['date'])); |
|
349 | + $Spotter->setHighlightFlightByRegistration($cr['registration'], $cr['title'], date('Y-m-d', $cr['date'])); |
|
350 | 350 | } |
351 | 351 | } |
352 | 352 | } |
353 | - if ($globalTransaction && $j % 1000 == 0) { |
|
353 | + if ($globalTransaction && $j%1000 == 0) { |
|
354 | 354 | $Connection->db->commit(); |
355 | 355 | $Connection->db->beginTransaction(); |
356 | 356 | } |
357 | 357 | } |
358 | 358 | if ($globalTransaction) $Connection->db->commit(); |
359 | - } catch(PDOException $e) { |
|
359 | + } catch (PDOException $e) { |
|
360 | 360 | if ($globalTransaction) $Connection->db->rollBack(); |
361 | 361 | echo $e->getMessage(); |
362 | 362 | } |
@@ -374,7 +374,7 @@ discard block |
||
374 | 374 | $Connection = new Connection(); |
375 | 375 | $sth = $Connection->db->prepare($query); |
376 | 376 | $sth->execute(); |
377 | - } catch(PDOException $e) { |
|
377 | + } catch (PDOException $e) { |
|
378 | 378 | return "error : ".$e->getMessage(); |
379 | 379 | } |
380 | 380 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
@@ -392,7 +392,7 @@ discard block |
||
392 | 392 | $Connection = new Connection(); |
393 | 393 | $sth = $Connection->db->prepare($query); |
394 | 394 | $sth->execute(); |
395 | - } catch(PDOException $e) { |
|
395 | + } catch (PDOException $e) { |
|
396 | 396 | return "error : ".$e->getMessage(); |
397 | 397 | } |
398 | 398 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
@@ -407,7 +407,7 @@ discard block |
||
407 | 407 | $Connection = new Connection(); |
408 | 408 | $sth = $Connection->db->prepare($query); |
409 | 409 | $sth->execute(); |
410 | - } catch(PDOException $e) { |
|
410 | + } catch (PDOException $e) { |
|
411 | 411 | return "error : ".$e->getMessage(); |
412 | 412 | } |
413 | 413 | } |
@@ -23,13 +23,13 @@ discard block |
||
23 | 23 | require_once(dirname(__FILE__).'/class.create_db.php'); |
24 | 24 | require_once(dirname(__FILE__).'/class.update_schema.php'); |
25 | 25 | require_once(dirname(__FILE__).'/class.settings.php'); |
26 | -$title="Install"; |
|
26 | +$title = "Install"; |
|
27 | 27 | require(dirname(__FILE__).'/../require/settings.php'); |
28 | 28 | require_once(dirname(__FILE__).'/../require/class.Common.php'); |
29 | 29 | require(dirname(__FILE__).'/header.php'); |
30 | 30 | |
31 | 31 | if (!isset($_SESSION['install']) && !isset($_SESSION['identified'])) { |
32 | - $password = filter_input(INPUT_POST,'password',FILTER_SANITIZE_STRING); |
|
32 | + $password = filter_input(INPUT_POST, 'password', FILTER_SANITIZE_STRING); |
|
33 | 33 | if ($password == '') { |
34 | 34 | if ($globalInstalled === TRUE && (!isset($globalInstallPassword) || $globalInstallPassword == '')) { |
35 | 35 | print '<div class="alert alert-danger">You need to change $globalInstalled in settings.php to FALSE if you want to access setup again.</div>'; |
@@ -110,8 +110,8 @@ discard block |
||
110 | 110 | if (!file_exists(dirname(__FILE__).'/../.htaccess')) { |
111 | 111 | $error[] = dirname(__FILE__).'/../.htaccess'." doesn't exist. The provided .htaccess must exist if you use Apache."; |
112 | 112 | } |
113 | - if(function_exists('apache_get_modules') ){ |
|
114 | - if(!in_array('mod_rewrite',apache_get_modules())) { |
|
113 | + if (function_exists('apache_get_modules')) { |
|
114 | + if (!in_array('mod_rewrite', apache_get_modules())) { |
|
115 | 115 | $error[] = "mod_rewrite is not available."; |
116 | 116 | } |
117 | 117 | /* |
@@ -130,22 +130,22 @@ discard block |
||
130 | 130 | $alllng = $Language->listLocaleDir(); |
131 | 131 | if (count($alllng) != count($availablelng)) { |
132 | 132 | $notavailable = array(); |
133 | - foreach($alllng as $lng) { |
|
133 | + foreach ($alllng as $lng) { |
|
134 | 134 | if (!isset($availablelng[$lng])) $notavailable[] = $lng; |
135 | 135 | } |
136 | - print '<div class="alert alert-warning">The following translation can\'t be used on your system: '.implode(', ',$notavailable).'. You need to add the system locales: <a href="https://github.com/Ysurac/FlightAirMap/wiki/Translation">documentation</a>.</div>'; |
|
136 | + print '<div class="alert alert-warning">The following translation can\'t be used on your system: '.implode(', ', $notavailable).'. You need to add the system locales: <a href="https://github.com/Ysurac/FlightAirMap/wiki/Translation">documentation</a>.</div>'; |
|
137 | 137 | } |
138 | 138 | } |
139 | 139 | print '<div class="alert alert-info">If you use MySQL or MariaDB, check that <i>max_allowed_packet</i> >= 8M, else import of some tables can fail.</div>'; |
140 | 140 | if (isset($_SERVER['REQUEST_SCHEME']) && isset($_SERVER['SERVER_NAME']) && isset($_SERVER['SERVER_PORT']) && isset($_SERVER['REQUEST_URI'])) { |
141 | 141 | if (function_exists('get_headers')) { |
142 | 142 | //$check_header = @get_headers($_SERVER['REQUEST_SCHEME'].'://'.$_SERVER["SERVER_NAME"].':'.$_SERVER["SERVER_PORT"].str_replace(array('install/','install'),'search',str_replace('index.php','',$_SERVER["REQUEST_URI"]))); |
143 | - $check_header = @get_headers($_SERVER['REQUEST_SCHEME'].'://'.$_SERVER["SERVER_NAME"].':'.$_SERVER["SERVER_PORT"].str_replace(array('install/','install'),'live/geojson?test',str_replace('index.php','',$_SERVER["REQUEST_URI"]))); |
|
144 | - if (isset($check_header[0]) && !stripos($check_header[0],"200 OK")) { |
|
143 | + $check_header = @get_headers($_SERVER['REQUEST_SCHEME'].'://'.$_SERVER["SERVER_NAME"].':'.$_SERVER["SERVER_PORT"].str_replace(array('install/', 'install'), 'live/geojson?test', str_replace('index.php', '', $_SERVER["REQUEST_URI"]))); |
|
144 | + if (isset($check_header[0]) && !stripos($check_header[0], "200 OK")) { |
|
145 | 145 | print '<div class="alert alert-danger"><strong>Error</strong> Check your configuration, rewrite don\'t seems to work well. If using Apache, you need to desactivate MultiViews <a href="https://github.com/Ysurac/FlightAirMap/wiki/Apache-configuration">https://github.com/Ysurac/FlightAirMap/wiki/Apache-configuration</a></div>'; |
146 | 146 | } else { |
147 | - $check_header = @get_headers($_SERVER['REQUEST_SCHEME'].'://'.$_SERVER["SERVER_NAME"].':'.$_SERVER["SERVER_PORT"].str_replace(array('install/','install'),'search',str_replace('index.php','',$_SERVER["REQUEST_URI"]))); |
|
148 | - if (isset($check_header[0]) && !stripos($check_header[0],"200 OK")) { |
|
147 | + $check_header = @get_headers($_SERVER['REQUEST_SCHEME'].'://'.$_SERVER["SERVER_NAME"].':'.$_SERVER["SERVER_PORT"].str_replace(array('install/', 'install'), 'search', str_replace('index.php', '', $_SERVER["REQUEST_URI"]))); |
|
148 | + if (isset($check_header[0]) && !stripos($check_header[0], "200 OK")) { |
|
149 | 149 | print '<div class="alert alert-danger"><strong>Error</strong> Check your configuration, rewrite don\'t seems to work well. If using Apache, you need to desactivate MultiViews <a href="https://github.com/Ysurac/FlightAirMap/wiki/Apache-configuration">https://github.com/Ysurac/FlightAirMap/wiki/Apache-configuration</a></div>'; |
150 | 150 | } |
151 | 151 | } |
@@ -233,7 +233,7 @@ discard block |
||
233 | 233 | if ((!isset($globalURL) || $globalURL == '') && (!isset($globalDBuser) || $globalDBuser == '')) { |
234 | 234 | if (isset($_SERVER['REQUEST_URI'])) { |
235 | 235 | $URL = $_SERVER['REQUEST_URI']; |
236 | - $globalURL = str_replace('/install','',str_replace('/install/','',str_replace('/install/index.php','',$URL))); |
|
236 | + $globalURL = str_replace('/install', '', str_replace('/install/', '', str_replace('/install/index.php', '', $URL))); |
|
237 | 237 | } |
238 | 238 | } |
239 | 239 | ?> |
@@ -577,13 +577,13 @@ 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 | 585 | } else { |
586 | - $hostport = explode(':',$source['host']); |
|
586 | + $hostport = explode(':', $source['host']); |
|
587 | 587 | if (isset($hostport[1])) { |
588 | 588 | $host = $hostport[0]; |
589 | 589 | $port = $hostport[1]; |
@@ -634,7 +634,7 @@ discard block |
||
634 | 634 | <select name="timezones[]"> |
635 | 635 | <?php |
636 | 636 | $timezonelist = DateTimeZone::listIdentifiers(DateTimeZone::ALL); |
637 | - foreach($timezonelist as $timezones){ |
|
637 | + foreach ($timezonelist as $timezones) { |
|
638 | 638 | if (isset($source['timezone']) && $source['timezone'] == $timezones) { |
639 | 639 | print '<option selected>'.$timezones.'</option>'; |
640 | 640 | } elseif (!isset($source['timezone']) && $timezones == 'UTC') { |
@@ -690,7 +690,7 @@ discard block |
||
690 | 690 | <select name="timezones[]" id="timezones"> |
691 | 691 | <?php |
692 | 692 | $timezonelist = DateTimeZone::listIdentifiers(DateTimeZone::ALL); |
693 | - foreach($timezonelist as $timezones){ |
|
693 | + foreach ($timezonelist as $timezones) { |
|
694 | 694 | if ($timezones == 'UTC') { |
695 | 695 | print '<option selected>'.$timezones.'</option>'; |
696 | 696 | } else print '<option>'.$timezones.'</option>'; |
@@ -1170,7 +1170,7 @@ discard block |
||
1170 | 1170 | <br /> |
1171 | 1171 | <p> |
1172 | 1172 | <label for="aircraftsize">Size of aircraft icon on map (default to 30px if zoom > 7 else 15px), empty to default</label> |
1173 | - <input type="number" name="aircraftsize" id="aircraftsize" value="<?php if (isset($globalAircraftSize)) echo $globalAircraftSize;?>" /> |
|
1173 | + <input type="number" name="aircraftsize" id="aircraftsize" value="<?php if (isset($globalAircraftSize)) echo $globalAircraftSize; ?>" /> |
|
1174 | 1174 | </p> |
1175 | 1175 | <br /> |
1176 | 1176 | <p> |
@@ -1253,17 +1253,17 @@ discard block |
||
1253 | 1253 | $error = ''; |
1254 | 1254 | |
1255 | 1255 | if (isset($_POST['dbtype'])) { |
1256 | - $installpass = filter_input(INPUT_POST,'installpass',FILTER_SANITIZE_STRING); |
|
1257 | - $settings = array_merge($settings,array('globalInstallPassword' => $installpass)); |
|
1256 | + $installpass = filter_input(INPUT_POST, 'installpass', FILTER_SANITIZE_STRING); |
|
1257 | + $settings = array_merge($settings, array('globalInstallPassword' => $installpass)); |
|
1258 | 1258 | |
1259 | - $dbtype = filter_input(INPUT_POST,'dbtype',FILTER_SANITIZE_STRING); |
|
1260 | - $dbroot = filter_input(INPUT_POST,'dbroot',FILTER_SANITIZE_STRING); |
|
1261 | - $dbrootpass = filter_input(INPUT_POST,'dbrootpass',FILTER_SANITIZE_STRING); |
|
1262 | - $dbname = filter_input(INPUT_POST,'dbname',FILTER_SANITIZE_STRING); |
|
1263 | - $dbuser = filter_input(INPUT_POST,'dbuser',FILTER_SANITIZE_STRING); |
|
1264 | - $dbuserpass = filter_input(INPUT_POST,'dbuserpass',FILTER_SANITIZE_STRING); |
|
1265 | - $dbhost = filter_input(INPUT_POST,'dbhost',FILTER_SANITIZE_STRING); |
|
1266 | - $dbport = filter_input(INPUT_POST,'dbport',FILTER_SANITIZE_STRING); |
|
1259 | + $dbtype = filter_input(INPUT_POST, 'dbtype', FILTER_SANITIZE_STRING); |
|
1260 | + $dbroot = filter_input(INPUT_POST, 'dbroot', FILTER_SANITIZE_STRING); |
|
1261 | + $dbrootpass = filter_input(INPUT_POST, 'dbrootpass', FILTER_SANITIZE_STRING); |
|
1262 | + $dbname = filter_input(INPUT_POST, 'dbname', FILTER_SANITIZE_STRING); |
|
1263 | + $dbuser = filter_input(INPUT_POST, 'dbuser', FILTER_SANITIZE_STRING); |
|
1264 | + $dbuserpass = filter_input(INPUT_POST, 'dbuserpass', FILTER_SANITIZE_STRING); |
|
1265 | + $dbhost = filter_input(INPUT_POST, 'dbhost', FILTER_SANITIZE_STRING); |
|
1266 | + $dbport = filter_input(INPUT_POST, 'dbport', FILTER_SANITIZE_STRING); |
|
1267 | 1267 | |
1268 | 1268 | if ($dbtype == 'mysql' && !extension_loaded('pdo_mysql')) $error .= 'Mysql driver for PDO must be loaded'; |
1269 | 1269 | if ($dbtype == 'pgsql' && !extension_loaded('pdo_pgsql')) $error .= 'PosgreSQL driver for PDO must be loaded'; |
@@ -1283,59 +1283,59 @@ discard block |
||
1283 | 1283 | } else $settings = array_merge($settings,array('globalDBdriver' => $dbtype,'globalDBhost' => $dbhost,'globalDBuser' => $dbuser,'globalDBport' => $dbport,'globalDBpass' => $dbuserpass,'globalDBname' => $dbname)); |
1284 | 1284 | */ |
1285 | 1285 | |
1286 | - $settings = array_merge($settings,array('globalDBdriver' => $dbtype,'globalDBhost' => $dbhost,'globalDBuser' => $dbuser,'globalDBport' => $dbport,'globalDBpass' => $dbuserpass,'globalDBname' => $dbname)); |
|
1286 | + $settings = array_merge($settings, array('globalDBdriver' => $dbtype, 'globalDBhost' => $dbhost, 'globalDBuser' => $dbuser, 'globalDBport' => $dbport, 'globalDBpass' => $dbuserpass, 'globalDBname' => $dbname)); |
|
1287 | 1287 | |
1288 | - $sitename = filter_input(INPUT_POST,'sitename',FILTER_SANITIZE_STRING); |
|
1289 | - $siteurl = filter_input(INPUT_POST,'siteurl',FILTER_SANITIZE_STRING); |
|
1290 | - $timezone = filter_input(INPUT_POST,'timezone',FILTER_SANITIZE_STRING); |
|
1291 | - $language = filter_input(INPUT_POST,'language',FILTER_SANITIZE_STRING); |
|
1292 | - $settings = array_merge($settings,array('globalName' => $sitename,'globalURL' => $siteurl, 'globalTimezone' => $timezone,'globalLanguage' => $language)); |
|
1288 | + $sitename = filter_input(INPUT_POST, 'sitename', FILTER_SANITIZE_STRING); |
|
1289 | + $siteurl = filter_input(INPUT_POST, 'siteurl', FILTER_SANITIZE_STRING); |
|
1290 | + $timezone = filter_input(INPUT_POST, 'timezone', FILTER_SANITIZE_STRING); |
|
1291 | + $language = filter_input(INPUT_POST, 'language', FILTER_SANITIZE_STRING); |
|
1292 | + $settings = array_merge($settings, array('globalName' => $sitename, 'globalURL' => $siteurl, 'globalTimezone' => $timezone, 'globalLanguage' => $language)); |
|
1293 | 1293 | |
1294 | - $mapprovider = filter_input(INPUT_POST,'mapprovider',FILTER_SANITIZE_STRING); |
|
1295 | - $mapboxid = filter_input(INPUT_POST,'mapboxid',FILTER_SANITIZE_STRING); |
|
1296 | - $mapboxtoken = filter_input(INPUT_POST,'mapboxtoken',FILTER_SANITIZE_STRING); |
|
1297 | - $googlekey = filter_input(INPUT_POST,'googlekey',FILTER_SANITIZE_STRING); |
|
1298 | - $bingkey = filter_input(INPUT_POST,'bingkey',FILTER_SANITIZE_STRING); |
|
1299 | - $openweathermapkey = filter_input(INPUT_POST,'openweathermapkey',FILTER_SANITIZE_STRING); |
|
1300 | - $mapquestkey = filter_input(INPUT_POST,'mapquestkey',FILTER_SANITIZE_STRING); |
|
1301 | - $hereappid = filter_input(INPUT_POST,'hereappid',FILTER_SANITIZE_STRING); |
|
1302 | - $hereappcode = filter_input(INPUT_POST,'hereappcode',FILTER_SANITIZE_STRING); |
|
1303 | - $settings = array_merge($settings,array('globalMapProvider' => $mapprovider,'globalMapboxId' => $mapboxid,'globalMapboxToken' => $mapboxtoken,'globalGoogleAPIKey' => $googlekey,'globalBingMapKey' => $bingkey,'globalHereappID' => $hereappid,'globalHereappCode' => $hereappcode,'globalMapQuestKey' => $mapquestkey,'globalOpenWeatherMapKey' => $openweathermapkey)); |
|
1294 | + $mapprovider = filter_input(INPUT_POST, 'mapprovider', FILTER_SANITIZE_STRING); |
|
1295 | + $mapboxid = filter_input(INPUT_POST, 'mapboxid', FILTER_SANITIZE_STRING); |
|
1296 | + $mapboxtoken = filter_input(INPUT_POST, 'mapboxtoken', FILTER_SANITIZE_STRING); |
|
1297 | + $googlekey = filter_input(INPUT_POST, 'googlekey', FILTER_SANITIZE_STRING); |
|
1298 | + $bingkey = filter_input(INPUT_POST, 'bingkey', FILTER_SANITIZE_STRING); |
|
1299 | + $openweathermapkey = filter_input(INPUT_POST, 'openweathermapkey', FILTER_SANITIZE_STRING); |
|
1300 | + $mapquestkey = filter_input(INPUT_POST, 'mapquestkey', FILTER_SANITIZE_STRING); |
|
1301 | + $hereappid = filter_input(INPUT_POST, 'hereappid', FILTER_SANITIZE_STRING); |
|
1302 | + $hereappcode = filter_input(INPUT_POST, 'hereappcode', FILTER_SANITIZE_STRING); |
|
1303 | + $settings = array_merge($settings, array('globalMapProvider' => $mapprovider, 'globalMapboxId' => $mapboxid, 'globalMapboxToken' => $mapboxtoken, 'globalGoogleAPIKey' => $googlekey, 'globalBingMapKey' => $bingkey, 'globalHereappID' => $hereappid, 'globalHereappCode' => $hereappcode, 'globalMapQuestKey' => $mapquestkey, 'globalOpenWeatherMapKey' => $openweathermapkey)); |
|
1304 | 1304 | |
1305 | - $latitudemax = filter_input(INPUT_POST,'latitudemax',FILTER_SANITIZE_STRING); |
|
1306 | - $latitudemin = filter_input(INPUT_POST,'latitudemin',FILTER_SANITIZE_STRING); |
|
1307 | - $longitudemax = filter_input(INPUT_POST,'longitudemax',FILTER_SANITIZE_STRING); |
|
1308 | - $longitudemin = filter_input(INPUT_POST,'longitudemin',FILTER_SANITIZE_STRING); |
|
1309 | - $livezoom = filter_input(INPUT_POST,'livezoom',FILTER_SANITIZE_NUMBER_INT); |
|
1310 | - $settings = array_merge($settings,array('globalLatitudeMax' => $latitudemax,'globalLatitudeMin' => $latitudemin,'globalLongitudeMax' => $longitudemax,'globalLongitudeMin' => $longitudemin,'globalLiveZoom' => $livezoom)); |
|
1305 | + $latitudemax = filter_input(INPUT_POST, 'latitudemax', FILTER_SANITIZE_STRING); |
|
1306 | + $latitudemin = filter_input(INPUT_POST, 'latitudemin', FILTER_SANITIZE_STRING); |
|
1307 | + $longitudemax = filter_input(INPUT_POST, 'longitudemax', FILTER_SANITIZE_STRING); |
|
1308 | + $longitudemin = filter_input(INPUT_POST, 'longitudemin', FILTER_SANITIZE_STRING); |
|
1309 | + $livezoom = filter_input(INPUT_POST, 'livezoom', FILTER_SANITIZE_NUMBER_INT); |
|
1310 | + $settings = array_merge($settings, array('globalLatitudeMax' => $latitudemax, 'globalLatitudeMin' => $latitudemin, 'globalLongitudeMax' => $longitudemax, 'globalLongitudeMin' => $longitudemin, 'globalLiveZoom' => $livezoom)); |
|
1311 | 1311 | |
1312 | - $squawk_country = filter_input(INPUT_POST,'squawk_country',FILTER_SANITIZE_STRING); |
|
1313 | - $settings = array_merge($settings,array('globalSquawkCountry' => $squawk_country)); |
|
1312 | + $squawk_country = filter_input(INPUT_POST, 'squawk_country', FILTER_SANITIZE_STRING); |
|
1313 | + $settings = array_merge($settings, array('globalSquawkCountry' => $squawk_country)); |
|
1314 | 1314 | |
1315 | - $latitudecenter = filter_input(INPUT_POST,'latitudecenter',FILTER_SANITIZE_STRING); |
|
1316 | - $longitudecenter = filter_input(INPUT_POST,'longitudecenter',FILTER_SANITIZE_STRING); |
|
1317 | - $settings = array_merge($settings,array('globalCenterLatitude' => $latitudecenter,'globalCenterLongitude' => $longitudecenter)); |
|
1315 | + $latitudecenter = filter_input(INPUT_POST, 'latitudecenter', FILTER_SANITIZE_STRING); |
|
1316 | + $longitudecenter = filter_input(INPUT_POST, 'longitudecenter', FILTER_SANITIZE_STRING); |
|
1317 | + $settings = array_merge($settings, array('globalCenterLatitude' => $latitudecenter, 'globalCenterLongitude' => $longitudecenter)); |
|
1318 | 1318 | |
1319 | - $acars = filter_input(INPUT_POST,'acars',FILTER_SANITIZE_STRING); |
|
1319 | + $acars = filter_input(INPUT_POST, 'acars', FILTER_SANITIZE_STRING); |
|
1320 | 1320 | if ($acars == 'acars') { |
1321 | - $settings = array_merge($settings,array('globalACARS' => 'TRUE')); |
|
1321 | + $settings = array_merge($settings, array('globalACARS' => 'TRUE')); |
|
1322 | 1322 | } else { |
1323 | - $settings = array_merge($settings,array('globalACARS' => 'FALSE')); |
|
1323 | + $settings = array_merge($settings, array('globalACARS' => 'FALSE')); |
|
1324 | 1324 | } |
1325 | - $updatecheck = filter_input(INPUT_POST,'updatecheck',FILTER_SANITIZE_STRING); |
|
1325 | + $updatecheck = filter_input(INPUT_POST, 'updatecheck', FILTER_SANITIZE_STRING); |
|
1326 | 1326 | if ($updatecheck == 'updatecheck') { |
1327 | - $settings = array_merge($settings,array('globalDisableUpdateCheck' => 'TRUE')); |
|
1327 | + $settings = array_merge($settings, array('globalDisableUpdateCheck' => 'TRUE')); |
|
1328 | 1328 | } else { |
1329 | - $settings = array_merge($settings,array('globalDisableUpdateCheck' => 'FALSE')); |
|
1329 | + $settings = array_merge($settings, array('globalDisableUpdateCheck' => 'FALSE')); |
|
1330 | 1330 | } |
1331 | 1331 | |
1332 | - $flightawareusername = filter_input(INPUT_POST,'flightawareusername',FILTER_SANITIZE_STRING); |
|
1333 | - $flightawarepassword = filter_input(INPUT_POST,'flightawarepassword',FILTER_SANITIZE_STRING); |
|
1334 | - $settings = array_merge($settings,array('globalFlightAwareUsername' => $flightawareusername,'globalFlightAwarePassword' => $flightawarepassword)); |
|
1332 | + $flightawareusername = filter_input(INPUT_POST, 'flightawareusername', FILTER_SANITIZE_STRING); |
|
1333 | + $flightawarepassword = filter_input(INPUT_POST, 'flightawarepassword', FILTER_SANITIZE_STRING); |
|
1334 | + $settings = array_merge($settings, array('globalFlightAwareUsername' => $flightawareusername, 'globalFlightAwarePassword' => $flightawarepassword)); |
|
1335 | 1335 | |
1336 | - $sailawayemail = filter_input(INPUT_POST,'sailawayemail',FILTER_SANITIZE_STRING); |
|
1337 | - $sailawaypass = filter_input(INPUT_POST,'sailawaypassword',FILTER_SANITIZE_STRING); |
|
1338 | - $settings = array_merge($settings,array('globalSailaway' => array('email' => $sailawayemail,'password' => $sailawaypass))); |
|
1336 | + $sailawayemail = filter_input(INPUT_POST, 'sailawayemail', FILTER_SANITIZE_STRING); |
|
1337 | + $sailawaypass = filter_input(INPUT_POST, 'sailawaypassword', FILTER_SANITIZE_STRING); |
|
1338 | + $settings = array_merge($settings, array('globalSailaway' => array('email' => $sailawayemail, 'password' => $sailawaypass))); |
|
1339 | 1339 | |
1340 | 1340 | $source_name = $_POST['source_name']; |
1341 | 1341 | $source_latitude = $_POST['source_latitude']; |
@@ -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 | |
@@ -1359,16 +1359,16 @@ discard block |
||
1359 | 1359 | $newstype = $_POST['newstype']; |
1360 | 1360 | |
1361 | 1361 | $newsfeeds = array(); |
1362 | - foreach($newsurl as $newskey => $url) { |
|
1362 | + foreach ($newsurl as $newskey => $url) { |
|
1363 | 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 | - $settings = array_merge($settings,array('globalNewsFeeds' => $newsfeeds)); |
|
1371 | + $settings = array_merge($settings, array('globalNewsFeeds' => $newsfeeds)); |
|
1372 | 1372 | |
1373 | 1373 | //$sbshost = filter_input(INPUT_POST,'sbshost',FILTER_SANITIZE_STRING); |
1374 | 1374 | //$sbsport = filter_input(INPUT_POST,'sbsport',FILTER_SANITIZE_NUMBER_INT); |
@@ -1379,28 +1379,28 @@ discard block |
||
1379 | 1379 | $sbsurl = $_POST['sbsurl']; |
1380 | 1380 | */ |
1381 | 1381 | |
1382 | - $globalvatsim = filter_input(INPUT_POST,'globalvatsim',FILTER_SANITIZE_STRING); |
|
1383 | - $globalva = filter_input(INPUT_POST,'globalva',FILTER_SANITIZE_STRING); |
|
1384 | - $globalvm = filter_input(INPUT_POST,'globalvm',FILTER_SANITIZE_STRING); |
|
1385 | - $globalivao = filter_input(INPUT_POST,'globalivao',FILTER_SANITIZE_STRING); |
|
1386 | - $globalphpvms = filter_input(INPUT_POST,'globalphpvms',FILTER_SANITIZE_STRING); |
|
1387 | - $globalvam = filter_input(INPUT_POST,'globalvam',FILTER_SANITIZE_STRING); |
|
1388 | - $globalsbs = filter_input(INPUT_POST,'globalsbs',FILTER_SANITIZE_STRING); |
|
1389 | - $globalaprs = filter_input(INPUT_POST,'globalaprs',FILTER_SANITIZE_STRING); |
|
1390 | - $datasource = filter_input(INPUT_POST,'datasource',FILTER_SANITIZE_STRING); |
|
1382 | + $globalvatsim = filter_input(INPUT_POST, 'globalvatsim', FILTER_SANITIZE_STRING); |
|
1383 | + $globalva = filter_input(INPUT_POST, 'globalva', FILTER_SANITIZE_STRING); |
|
1384 | + $globalvm = filter_input(INPUT_POST, 'globalvm', FILTER_SANITIZE_STRING); |
|
1385 | + $globalivao = filter_input(INPUT_POST, 'globalivao', FILTER_SANITIZE_STRING); |
|
1386 | + $globalphpvms = filter_input(INPUT_POST, 'globalphpvms', FILTER_SANITIZE_STRING); |
|
1387 | + $globalvam = filter_input(INPUT_POST, 'globalvam', FILTER_SANITIZE_STRING); |
|
1388 | + $globalsbs = filter_input(INPUT_POST, 'globalsbs', FILTER_SANITIZE_STRING); |
|
1389 | + $globalaprs = filter_input(INPUT_POST, 'globalaprs', FILTER_SANITIZE_STRING); |
|
1390 | + $datasource = filter_input(INPUT_POST, 'datasource', FILTER_SANITIZE_STRING); |
|
1391 | 1391 | |
1392 | - $globalaircraft = filter_input(INPUT_POST,'globalaircraft',FILTER_SANITIZE_STRING); |
|
1393 | - if ($globalaircraft == 'aircraft') $settings = array_merge($settings,array('globalAircraft' => 'TRUE')); |
|
1394 | - else $settings = array_merge($settings,array('globalAircraft' => 'FALSE')); |
|
1395 | - $globaltracker = filter_input(INPUT_POST,'globaltracker',FILTER_SANITIZE_STRING); |
|
1396 | - if ($globaltracker == 'tracker') $settings = array_merge($settings,array('globalTracker' => 'TRUE')); |
|
1397 | - else $settings = array_merge($settings,array('globalTracker' => 'FALSE')); |
|
1398 | - $globalmarine = filter_input(INPUT_POST,'globalmarine',FILTER_SANITIZE_STRING); |
|
1399 | - if ($globalmarine == 'marine') $settings = array_merge($settings,array('globalMarine' => 'TRUE')); |
|
1400 | - else $settings = array_merge($settings,array('globalMarine' => 'FALSE')); |
|
1401 | - $globalsatellite = filter_input(INPUT_POST,'globalsatellite',FILTER_SANITIZE_STRING); |
|
1402 | - if ($globalsatellite == 'satellite') $settings = array_merge($settings,array('globalSatellite' => 'TRUE')); |
|
1403 | - else $settings = array_merge($settings,array('globalSatellite' => 'FALSE')); |
|
1392 | + $globalaircraft = filter_input(INPUT_POST, 'globalaircraft', FILTER_SANITIZE_STRING); |
|
1393 | + if ($globalaircraft == 'aircraft') $settings = array_merge($settings, array('globalAircraft' => 'TRUE')); |
|
1394 | + else $settings = array_merge($settings, array('globalAircraft' => 'FALSE')); |
|
1395 | + $globaltracker = filter_input(INPUT_POST, 'globaltracker', FILTER_SANITIZE_STRING); |
|
1396 | + if ($globaltracker == 'tracker') $settings = array_merge($settings, array('globalTracker' => 'TRUE')); |
|
1397 | + else $settings = array_merge($settings, array('globalTracker' => 'FALSE')); |
|
1398 | + $globalmarine = filter_input(INPUT_POST, 'globalmarine', FILTER_SANITIZE_STRING); |
|
1399 | + if ($globalmarine == 'marine') $settings = array_merge($settings, array('globalMarine' => 'TRUE')); |
|
1400 | + else $settings = array_merge($settings, array('globalMarine' => 'FALSE')); |
|
1401 | + $globalsatellite = filter_input(INPUT_POST, 'globalsatellite', FILTER_SANITIZE_STRING); |
|
1402 | + if ($globalsatellite == 'satellite') $settings = array_merge($settings, array('globalSatellite' => 'TRUE')); |
|
1403 | + else $settings = array_merge($settings, array('globalSatellite' => 'FALSE')); |
|
1404 | 1404 | |
1405 | 1405 | /* |
1406 | 1406 | $globalSBS1Hosts = array(); |
@@ -1416,7 +1416,7 @@ discard block |
||
1416 | 1416 | } |
1417 | 1417 | $settings = array_merge($settings,array('globalSBS1Hosts' => $globalSBS1Hosts)); |
1418 | 1418 | */ |
1419 | - $settings_comment = array_merge($settings_comment,array('globalSBS1Hosts')); |
|
1419 | + $settings_comment = array_merge($settings_comment, array('globalSBS1Hosts')); |
|
1420 | 1420 | $host = $_POST['host']; |
1421 | 1421 | $port = $_POST['port']; |
1422 | 1422 | $name = $_POST['name']; |
@@ -1433,115 +1433,115 @@ discard block |
||
1433 | 1433 | else $cov = 'FALSE'; |
1434 | 1434 | if (isset($noarchive[$key]) && $noarchive[$key] == 1) $arch = 'TRUE'; |
1435 | 1435 | else $arch = 'FALSE'; |
1436 | - if (strpos($format[$key],'_callback')) { |
|
1437 | - $gSources[] = array('host' => $h, 'pass' => $port[$key],'name' => $name[$key],'format' => $format[$key],'sourcestats' => $cov,'noarchive' => $arch,'timezone' => $timezones[$key],'callback' => 'TRUE'); |
|
1436 | + if (strpos($format[$key], '_callback')) { |
|
1437 | + $gSources[] = array('host' => $h, 'pass' => $port[$key], 'name' => $name[$key], 'format' => $format[$key], 'sourcestats' => $cov, 'noarchive' => $arch, 'timezone' => $timezones[$key], 'callback' => 'TRUE'); |
|
1438 | 1438 | } elseif ($format[$key] != 'auto' || ($h != '' || $name[$key] != '')) { |
1439 | - $gSources[] = array('host' => $h, 'port' => $port[$key],'name' => $name[$key],'format' => $format[$key],'sourcestats' => $cov,'noarchive' => $arch,'timezone' => $timezones[$key],'callback' => 'FALSE'); |
|
1439 | + $gSources[] = array('host' => $h, 'port' => $port[$key], 'name' => $name[$key], 'format' => $format[$key], 'sourcestats' => $cov, 'noarchive' => $arch, 'timezone' => $timezones[$key], 'callback' => 'FALSE'); |
|
1440 | 1440 | } |
1441 | 1441 | if ($format[$key] == 'airwhere') $forcepilots = true; |
1442 | 1442 | } |
1443 | - $settings = array_merge($settings,array('globalSources' => $gSources)); |
|
1443 | + $settings = array_merge($settings, array('globalSources' => $gSources)); |
|
1444 | 1444 | |
1445 | 1445 | /* |
1446 | 1446 | $sbstimeout = filter_input(INPUT_POST,'sbstimeout',FILTER_SANITIZE_NUMBER_INT); |
1447 | 1447 | $settings = array_merge($settings,array('globalSourcesTimeOut' => $sbstimeout)); |
1448 | 1448 | */ |
1449 | - $acarshost = filter_input(INPUT_POST,'acarshost',FILTER_SANITIZE_STRING); |
|
1450 | - $acarsport = filter_input(INPUT_POST,'acarsport',FILTER_SANITIZE_NUMBER_INT); |
|
1451 | - $settings = array_merge($settings,array('globalACARSHost' => $acarshost,'globalACARSPort' => $acarsport)); |
|
1449 | + $acarshost = filter_input(INPUT_POST, 'acarshost', FILTER_SANITIZE_STRING); |
|
1450 | + $acarsport = filter_input(INPUT_POST, 'acarsport', FILTER_SANITIZE_NUMBER_INT); |
|
1451 | + $settings = array_merge($settings, array('globalACARSHost' => $acarshost, 'globalACARSPort' => $acarsport)); |
|
1452 | 1452 | |
1453 | - $bitly = filter_input(INPUT_POST,'bitly',FILTER_SANITIZE_STRING); |
|
1454 | - $settings = array_merge($settings,array('globalBitlyAccessToken' => $bitly)); |
|
1453 | + $bitly = filter_input(INPUT_POST, 'bitly', FILTER_SANITIZE_STRING); |
|
1454 | + $settings = array_merge($settings, array('globalBitlyAccessToken' => $bitly)); |
|
1455 | 1455 | |
1456 | - $customcss = filter_input(INPUT_POST,'customcss',FILTER_SANITIZE_STRING); |
|
1457 | - $settings = array_merge($settings,array('globalCustomCSS' => $customcss)); |
|
1456 | + $customcss = filter_input(INPUT_POST, 'customcss', FILTER_SANITIZE_STRING); |
|
1457 | + $settings = array_merge($settings, array('globalCustomCSS' => $customcss)); |
|
1458 | 1458 | |
1459 | - $map3dtile = filter_input(INPUT_POST,'map3dtileset',FILTER_SANITIZE_STRING); |
|
1460 | - $settings = array_merge($settings,array('globalMap3DTiles' => $map3dtile)); |
|
1459 | + $map3dtile = filter_input(INPUT_POST, 'map3dtileset', FILTER_SANITIZE_STRING); |
|
1460 | + $settings = array_merge($settings, array('globalMap3DTiles' => $map3dtile)); |
|
1461 | 1461 | |
1462 | - $notamsource = filter_input(INPUT_POST,'notamsource',FILTER_SANITIZE_STRING); |
|
1463 | - $settings = array_merge($settings,array('globalNOTAMSource' => $notamsource)); |
|
1464 | - $metarsource = filter_input(INPUT_POST,'metarsource',FILTER_SANITIZE_STRING); |
|
1465 | - $settings = array_merge($settings,array('globalMETARurl' => $metarsource)); |
|
1462 | + $notamsource = filter_input(INPUT_POST, 'notamsource', FILTER_SANITIZE_STRING); |
|
1463 | + $settings = array_merge($settings, array('globalNOTAMSource' => $notamsource)); |
|
1464 | + $metarsource = filter_input(INPUT_POST, 'metarsource', FILTER_SANITIZE_STRING); |
|
1465 | + $settings = array_merge($settings, array('globalMETARurl' => $metarsource)); |
|
1466 | 1466 | |
1467 | - $zoilatitude = filter_input(INPUT_POST,'zoilatitude',FILTER_SANITIZE_STRING); |
|
1468 | - $zoilongitude = filter_input(INPUT_POST,'zoilongitude',FILTER_SANITIZE_STRING); |
|
1469 | - $zoidistance = filter_input(INPUT_POST,'zoidistance',FILTER_SANITIZE_NUMBER_INT); |
|
1467 | + $zoilatitude = filter_input(INPUT_POST, 'zoilatitude', FILTER_SANITIZE_STRING); |
|
1468 | + $zoilongitude = filter_input(INPUT_POST, 'zoilongitude', FILTER_SANITIZE_STRING); |
|
1469 | + $zoidistance = filter_input(INPUT_POST, 'zoidistance', FILTER_SANITIZE_NUMBER_INT); |
|
1470 | 1470 | if ($zoilatitude != '' && $zoilongitude != '' && $zoidistance != '') { |
1471 | - $settings = array_merge($settings,array('globalDistanceIgnore' => array('latitude' => $zoilatitude,'longitude' => $zoilongitude,'distance' => $zoidistance))); |
|
1472 | - } else $settings = array_merge($settings,array('globalDistanceIgnore' => array())); |
|
1471 | + $settings = array_merge($settings, array('globalDistanceIgnore' => array('latitude' => $zoilatitude, 'longitude' => $zoilongitude, 'distance' => $zoidistance))); |
|
1472 | + } else $settings = array_merge($settings, array('globalDistanceIgnore' => array())); |
|
1473 | 1473 | |
1474 | - $refresh = filter_input(INPUT_POST,'refresh',FILTER_SANITIZE_NUMBER_INT); |
|
1475 | - $settings = array_merge($settings,array('globalLiveInterval' => $refresh)); |
|
1476 | - $maprefresh = filter_input(INPUT_POST,'maprefresh',FILTER_SANITIZE_NUMBER_INT); |
|
1477 | - $settings = array_merge($settings,array('globalMapRefresh' => $maprefresh)); |
|
1478 | - $mapidle = filter_input(INPUT_POST,'mapidle',FILTER_SANITIZE_NUMBER_INT); |
|
1479 | - $settings = array_merge($settings,array('globalMapIdleTimeout' => $mapidle)); |
|
1480 | - $minfetch = filter_input(INPUT_POST,'minfetch',FILTER_SANITIZE_NUMBER_INT); |
|
1481 | - $settings = array_merge($settings,array('globalMinFetch' => $minfetch)); |
|
1482 | - $closestmindist = filter_input(INPUT_POST,'closestmindist',FILTER_SANITIZE_NUMBER_INT); |
|
1483 | - $settings = array_merge($settings,array('globalClosestMinDist' => $closestmindist)); |
|
1474 | + $refresh = filter_input(INPUT_POST, 'refresh', FILTER_SANITIZE_NUMBER_INT); |
|
1475 | + $settings = array_merge($settings, array('globalLiveInterval' => $refresh)); |
|
1476 | + $maprefresh = filter_input(INPUT_POST, 'maprefresh', FILTER_SANITIZE_NUMBER_INT); |
|
1477 | + $settings = array_merge($settings, array('globalMapRefresh' => $maprefresh)); |
|
1478 | + $mapidle = filter_input(INPUT_POST, 'mapidle', FILTER_SANITIZE_NUMBER_INT); |
|
1479 | + $settings = array_merge($settings, array('globalMapIdleTimeout' => $mapidle)); |
|
1480 | + $minfetch = filter_input(INPUT_POST, 'minfetch', FILTER_SANITIZE_NUMBER_INT); |
|
1481 | + $settings = array_merge($settings, array('globalMinFetch' => $minfetch)); |
|
1482 | + $closestmindist = filter_input(INPUT_POST, 'closestmindist', FILTER_SANITIZE_NUMBER_INT); |
|
1483 | + $settings = array_merge($settings, array('globalClosestMinDist' => $closestmindist)); |
|
1484 | 1484 | |
1485 | - $aircraftsize = filter_input(INPUT_POST,'aircraftsize',FILTER_SANITIZE_NUMBER_INT); |
|
1486 | - $settings = array_merge($settings,array('globalAircraftSize' => $aircraftsize)); |
|
1485 | + $aircraftsize = filter_input(INPUT_POST, 'aircraftsize', FILTER_SANITIZE_NUMBER_INT); |
|
1486 | + $settings = array_merge($settings, array('globalAircraftSize' => $aircraftsize)); |
|
1487 | 1487 | |
1488 | - $archivemonths = filter_input(INPUT_POST,'archivemonths',FILTER_SANITIZE_NUMBER_INT); |
|
1489 | - $settings = array_merge($settings,array('globalArchiveMonths' => $archivemonths)); |
|
1488 | + $archivemonths = filter_input(INPUT_POST, 'archivemonths', FILTER_SANITIZE_NUMBER_INT); |
|
1489 | + $settings = array_merge($settings, array('globalArchiveMonths' => $archivemonths)); |
|
1490 | 1490 | |
1491 | - $archiveyear = filter_input(INPUT_POST,'archiveyear',FILTER_SANITIZE_STRING); |
|
1491 | + $archiveyear = filter_input(INPUT_POST, 'archiveyear', FILTER_SANITIZE_STRING); |
|
1492 | 1492 | if ($archiveyear == "archiveyear") { |
1493 | - $settings = array_merge($settings,array('globalArchiveYear' => 'TRUE')); |
|
1493 | + $settings = array_merge($settings, array('globalArchiveYear' => 'TRUE')); |
|
1494 | 1494 | } else { |
1495 | - $settings = array_merge($settings,array('globalArchiveYear' => 'FALSE')); |
|
1495 | + $settings = array_merge($settings, array('globalArchiveYear' => 'FALSE')); |
|
1496 | 1496 | } |
1497 | - $archivekeepmonths = filter_input(INPUT_POST,'archivekeepmonths',FILTER_SANITIZE_NUMBER_INT); |
|
1498 | - $settings = array_merge($settings,array('globalArchiveKeepMonths' => $archivekeepmonths)); |
|
1499 | - $archivekeeptrackmonths = filter_input(INPUT_POST,'archivekeeptrackmonths',FILTER_SANITIZE_NUMBER_INT); |
|
1500 | - $settings = array_merge($settings,array('globalArchiveKeepTrackMonths' => $archivekeeptrackmonths)); |
|
1497 | + $archivekeepmonths = filter_input(INPUT_POST, 'archivekeepmonths', FILTER_SANITIZE_NUMBER_INT); |
|
1498 | + $settings = array_merge($settings, array('globalArchiveKeepMonths' => $archivekeepmonths)); |
|
1499 | + $archivekeeptrackmonths = filter_input(INPUT_POST, 'archivekeeptrackmonths', FILTER_SANITIZE_NUMBER_INT); |
|
1500 | + $settings = array_merge($settings, array('globalArchiveKeepTrackMonths' => $archivekeeptrackmonths)); |
|
1501 | 1501 | |
1502 | - $britishairways = filter_input(INPUT_POST,'britishairways',FILTER_SANITIZE_STRING); |
|
1503 | - $settings = array_merge($settings,array('globalBritishAirwaysKey' => $britishairways)); |
|
1504 | - $transavia = filter_input(INPUT_POST,'transavia',FILTER_SANITIZE_STRING); |
|
1505 | - $settings = array_merge($settings,array('globalTransaviaKey' => $transavia)); |
|
1502 | + $britishairways = filter_input(INPUT_POST, 'britishairways', FILTER_SANITIZE_STRING); |
|
1503 | + $settings = array_merge($settings, array('globalBritishAirwaysKey' => $britishairways)); |
|
1504 | + $transavia = filter_input(INPUT_POST, 'transavia', FILTER_SANITIZE_STRING); |
|
1505 | + $settings = array_merge($settings, array('globalTransaviaKey' => $transavia)); |
|
1506 | 1506 | |
1507 | - $lufthansakey = filter_input(INPUT_POST,'lufthansakey',FILTER_SANITIZE_STRING); |
|
1508 | - $lufthansasecret = filter_input(INPUT_POST,'lufthansasecret',FILTER_SANITIZE_STRING); |
|
1509 | - $settings = array_merge($settings,array('globalLufthansaKey' => array('key' => $lufthansakey,'secret' => $lufthansasecret))); |
|
1507 | + $lufthansakey = filter_input(INPUT_POST, 'lufthansakey', FILTER_SANITIZE_STRING); |
|
1508 | + $lufthansasecret = filter_input(INPUT_POST, 'lufthansasecret', FILTER_SANITIZE_STRING); |
|
1509 | + $settings = array_merge($settings, array('globalLufthansaKey' => array('key' => $lufthansakey, 'secret' => $lufthansasecret))); |
|
1510 | 1510 | |
1511 | 1511 | // Create in settings.php keys not yet configurable if not already here |
1512 | 1512 | //if (!isset($globalImageBingKey)) $settings = array_merge($settings,array('globalImageBingKey' => '')); |
1513 | - if (!isset($globalDebug)) $settings = array_merge($settings,array('globalDebug' => 'TRUE')); |
|
1513 | + if (!isset($globalDebug)) $settings = array_merge($settings, array('globalDebug' => 'TRUE')); |
|
1514 | 1514 | |
1515 | - $resetyearstats = filter_input(INPUT_POST,'resetyearstats',FILTER_SANITIZE_STRING); |
|
1515 | + $resetyearstats = filter_input(INPUT_POST, 'resetyearstats', FILTER_SANITIZE_STRING); |
|
1516 | 1516 | if ($resetyearstats == 'resetyearstats') { |
1517 | - $settings = array_merge($settings,array('globalDeleteLastYearStats' => 'TRUE')); |
|
1517 | + $settings = array_merge($settings, array('globalDeleteLastYearStats' => 'TRUE')); |
|
1518 | 1518 | } else { |
1519 | - $settings = array_merge($settings,array('globalDeleteLastYearStats' => 'FALSE')); |
|
1519 | + $settings = array_merge($settings, array('globalDeleteLastYearStats' => 'FALSE')); |
|
1520 | 1520 | } |
1521 | 1521 | |
1522 | - $archive = filter_input(INPUT_POST,'archive',FILTER_SANITIZE_STRING); |
|
1522 | + $archive = filter_input(INPUT_POST, 'archive', FILTER_SANITIZE_STRING); |
|
1523 | 1523 | if ($archive == 'archive') { |
1524 | - $settings = array_merge($settings,array('globalArchive' => 'TRUE')); |
|
1524 | + $settings = array_merge($settings, array('globalArchive' => 'TRUE')); |
|
1525 | 1525 | } else { |
1526 | - $settings = array_merge($settings,array('globalArchive' => 'FALSE')); |
|
1526 | + $settings = array_merge($settings, array('globalArchive' => 'FALSE')); |
|
1527 | 1527 | } |
1528 | - $archiveresults = filter_input(INPUT_POST,'archiveresults',FILTER_SANITIZE_STRING); |
|
1528 | + $archiveresults = filter_input(INPUT_POST, 'archiveresults', FILTER_SANITIZE_STRING); |
|
1529 | 1529 | if ($archiveresults == 'archiveresults') { |
1530 | - $settings = array_merge($settings,array('globalArchiveResults' => 'TRUE')); |
|
1530 | + $settings = array_merge($settings, array('globalArchiveResults' => 'TRUE')); |
|
1531 | 1531 | } else { |
1532 | - $settings = array_merge($settings,array('globalArchiveResults' => 'FALSE')); |
|
1532 | + $settings = array_merge($settings, array('globalArchiveResults' => 'FALSE')); |
|
1533 | 1533 | } |
1534 | - $daemon = filter_input(INPUT_POST,'daemon',FILTER_SANITIZE_STRING); |
|
1534 | + $daemon = filter_input(INPUT_POST, 'daemon', FILTER_SANITIZE_STRING); |
|
1535 | 1535 | if ($daemon == 'daemon') { |
1536 | - $settings = array_merge($settings,array('globalDaemon' => 'TRUE')); |
|
1536 | + $settings = array_merge($settings, array('globalDaemon' => 'TRUE')); |
|
1537 | 1537 | } else { |
1538 | - $settings = array_merge($settings,array('globalDaemon' => 'FALSE')); |
|
1538 | + $settings = array_merge($settings, array('globalDaemon' => 'FALSE')); |
|
1539 | 1539 | } |
1540 | - $schedules = filter_input(INPUT_POST,'schedules',FILTER_SANITIZE_STRING); |
|
1540 | + $schedules = filter_input(INPUT_POST, 'schedules', FILTER_SANITIZE_STRING); |
|
1541 | 1541 | if ($schedules == 'schedules') { |
1542 | - $settings = array_merge($settings,array('globalSchedulesFetch' => 'TRUE')); |
|
1542 | + $settings = array_merge($settings, array('globalSchedulesFetch' => 'TRUE')); |
|
1543 | 1543 | } else { |
1544 | - $settings = array_merge($settings,array('globalSchedulesFetch' => 'FALSE')); |
|
1544 | + $settings = array_merge($settings, array('globalSchedulesFetch' => 'FALSE')); |
|
1545 | 1545 | } |
1546 | 1546 | |
1547 | 1547 | /* |
@@ -1552,311 +1552,311 @@ discard block |
||
1552 | 1552 | $settings = array_merge($settings,array('globalFlightAware' => 'FALSE','globalSBS1' => 'TRUE')); |
1553 | 1553 | } |
1554 | 1554 | */ |
1555 | - $settings = array_merge($settings,array('globalFlightAware' => 'FALSE')); |
|
1556 | - if ($globalsbs == 'sbs') $settings = array_merge($settings,array('globalSBS1' => 'TRUE')); |
|
1557 | - else $settings = array_merge($settings,array('globalSBS1' => 'FALSE')); |
|
1558 | - if ($globalaprs == 'aprs') $settings = array_merge($settings,array('globalAPRS' => 'TRUE')); |
|
1559 | - else $settings = array_merge($settings,array('globalAPRS' => 'FALSE')); |
|
1555 | + $settings = array_merge($settings, array('globalFlightAware' => 'FALSE')); |
|
1556 | + if ($globalsbs == 'sbs') $settings = array_merge($settings, array('globalSBS1' => 'TRUE')); |
|
1557 | + else $settings = array_merge($settings, array('globalSBS1' => 'FALSE')); |
|
1558 | + if ($globalaprs == 'aprs') $settings = array_merge($settings, array('globalAPRS' => 'TRUE')); |
|
1559 | + else $settings = array_merge($settings, array('globalAPRS' => 'FALSE')); |
|
1560 | 1560 | $va = false; |
1561 | 1561 | if ($globalivao == 'ivao') { |
1562 | - $settings = array_merge($settings,array('globalIVAO' => 'TRUE')); |
|
1562 | + $settings = array_merge($settings, array('globalIVAO' => 'TRUE')); |
|
1563 | 1563 | $va = true; |
1564 | - } else $settings = array_merge($settings,array('globalIVAO' => 'FALSE')); |
|
1564 | + } else $settings = array_merge($settings, array('globalIVAO' => 'FALSE')); |
|
1565 | 1565 | if ($globalvatsim == 'vatsim') { |
1566 | - $settings = array_merge($settings,array('globalVATSIM' => 'TRUE')); |
|
1566 | + $settings = array_merge($settings, array('globalVATSIM' => 'TRUE')); |
|
1567 | 1567 | $va = true; |
1568 | - } else $settings = array_merge($settings,array('globalVATSIM' => 'FALSE')); |
|
1568 | + } else $settings = array_merge($settings, array('globalVATSIM' => 'FALSE')); |
|
1569 | 1569 | if ($globalphpvms == 'phpvms') { |
1570 | - $settings = array_merge($settings,array('globalphpVMS' => 'TRUE')); |
|
1570 | + $settings = array_merge($settings, array('globalphpVMS' => 'TRUE')); |
|
1571 | 1571 | $va = true; |
1572 | - } else $settings = array_merge($settings,array('globalphpVMS' => 'FALSE')); |
|
1572 | + } else $settings = array_merge($settings, array('globalphpVMS' => 'FALSE')); |
|
1573 | 1573 | if ($globalvam == 'vam') { |
1574 | - $settings = array_merge($settings,array('globalVAM' => 'TRUE')); |
|
1574 | + $settings = array_merge($settings, array('globalVAM' => 'TRUE')); |
|
1575 | 1575 | $va = true; |
1576 | - } else $settings = array_merge($settings,array('globalVAM' => 'FALSE')); |
|
1576 | + } else $settings = array_merge($settings, array('globalVAM' => 'FALSE')); |
|
1577 | 1577 | if ($va) { |
1578 | - $settings = array_merge($settings,array('globalSchedulesFetch' => 'FALSE','globalTranslationFetch' => 'FALSE')); |
|
1579 | - } else $settings = array_merge($settings,array('globalSchedulesFetch' => 'TRUE','globalTranslationFetch' => 'TRUE')); |
|
1578 | + $settings = array_merge($settings, array('globalSchedulesFetch' => 'FALSE', 'globalTranslationFetch' => 'FALSE')); |
|
1579 | + } else $settings = array_merge($settings, array('globalSchedulesFetch' => 'TRUE', 'globalTranslationFetch' => 'TRUE')); |
|
1580 | 1580 | if ($globalva == 'va' || $va) { |
1581 | - $settings = array_merge($settings,array('globalVA' => 'TRUE')); |
|
1582 | - $settings = array_merge($settings,array('globalUsePilot' => 'TRUE','globalUseOwner' => 'FALSE')); |
|
1581 | + $settings = array_merge($settings, array('globalVA' => 'TRUE')); |
|
1582 | + $settings = array_merge($settings, array('globalUsePilot' => 'TRUE', 'globalUseOwner' => 'FALSE')); |
|
1583 | 1583 | } else { |
1584 | - $settings = array_merge($settings,array('globalVA' => 'FALSE')); |
|
1585 | - if ($forcepilots) $settings = array_merge($settings,array('globalUsePilot' => 'TRUE','globalUseOwner' => 'FALSE')); |
|
1586 | - else $settings = array_merge($settings,array('globalUsePilot' => 'FALSE','globalUseOwner' => 'TRUE')); |
|
1584 | + $settings = array_merge($settings, array('globalVA' => 'FALSE')); |
|
1585 | + if ($forcepilots) $settings = array_merge($settings, array('globalUsePilot' => 'TRUE', 'globalUseOwner' => 'FALSE')); |
|
1586 | + else $settings = array_merge($settings, array('globalUsePilot' => 'FALSE', 'globalUseOwner' => 'TRUE')); |
|
1587 | 1587 | } |
1588 | 1588 | if ($globalvm == 'vm') { |
1589 | - $settings = array_merge($settings,array('globalVM' => 'TRUE')); |
|
1589 | + $settings = array_merge($settings, array('globalVM' => 'TRUE')); |
|
1590 | 1590 | } else { |
1591 | - $settings = array_merge($settings,array('globalVM' => 'FALSE')); |
|
1591 | + $settings = array_merge($settings, array('globalVM' => 'FALSE')); |
|
1592 | 1592 | } |
1593 | 1593 | |
1594 | - $mapoffline = filter_input(INPUT_POST,'mapoffline',FILTER_SANITIZE_STRING); |
|
1594 | + $mapoffline = filter_input(INPUT_POST, 'mapoffline', FILTER_SANITIZE_STRING); |
|
1595 | 1595 | if ($mapoffline == 'mapoffline') { |
1596 | - $settings = array_merge($settings,array('globalMapOffline' => 'TRUE')); |
|
1596 | + $settings = array_merge($settings, array('globalMapOffline' => 'TRUE')); |
|
1597 | 1597 | } else { |
1598 | - $settings = array_merge($settings,array('globalMapOffline' => 'FALSE')); |
|
1598 | + $settings = array_merge($settings, array('globalMapOffline' => 'FALSE')); |
|
1599 | 1599 | } |
1600 | - $globaloffline = filter_input(INPUT_POST,'globaloffline',FILTER_SANITIZE_STRING); |
|
1600 | + $globaloffline = filter_input(INPUT_POST, 'globaloffline', FILTER_SANITIZE_STRING); |
|
1601 | 1601 | if ($globaloffline == 'globaloffline') { |
1602 | - $settings = array_merge($settings,array('globalOffline' => 'TRUE')); |
|
1602 | + $settings = array_merge($settings, array('globalOffline' => 'TRUE')); |
|
1603 | 1603 | } else { |
1604 | - $settings = array_merge($settings,array('globalOffline' => 'FALSE')); |
|
1604 | + $settings = array_merge($settings, array('globalOffline' => 'FALSE')); |
|
1605 | 1605 | } |
1606 | 1606 | |
1607 | - $notam = filter_input(INPUT_POST,'notam',FILTER_SANITIZE_STRING); |
|
1607 | + $notam = filter_input(INPUT_POST, 'notam', FILTER_SANITIZE_STRING); |
|
1608 | 1608 | if ($notam == 'notam') { |
1609 | - $settings = array_merge($settings,array('globalNOTAM' => 'TRUE')); |
|
1609 | + $settings = array_merge($settings, array('globalNOTAM' => 'TRUE')); |
|
1610 | 1610 | } else { |
1611 | - $settings = array_merge($settings,array('globalNOTAM' => 'FALSE')); |
|
1611 | + $settings = array_merge($settings, array('globalNOTAM' => 'FALSE')); |
|
1612 | 1612 | } |
1613 | - $owner = filter_input(INPUT_POST,'owner',FILTER_SANITIZE_STRING); |
|
1613 | + $owner = filter_input(INPUT_POST, 'owner', FILTER_SANITIZE_STRING); |
|
1614 | 1614 | if ($owner == 'owner') { |
1615 | - $settings = array_merge($settings,array('globalOwner' => 'TRUE')); |
|
1615 | + $settings = array_merge($settings, array('globalOwner' => 'TRUE')); |
|
1616 | 1616 | } else { |
1617 | - $settings = array_merge($settings,array('globalOwner' => 'FALSE')); |
|
1617 | + $settings = array_merge($settings, array('globalOwner' => 'FALSE')); |
|
1618 | 1618 | } |
1619 | - $map3d = filter_input(INPUT_POST,'map3d',FILTER_SANITIZE_STRING); |
|
1619 | + $map3d = filter_input(INPUT_POST, 'map3d', FILTER_SANITIZE_STRING); |
|
1620 | 1620 | if ($map3d == 'map3d') { |
1621 | - $settings = array_merge($settings,array('globalMap3D' => 'TRUE')); |
|
1621 | + $settings = array_merge($settings, array('globalMap3D' => 'TRUE')); |
|
1622 | 1622 | } else { |
1623 | - $settings = array_merge($settings,array('globalMap3D' => 'FALSE')); |
|
1623 | + $settings = array_merge($settings, array('globalMap3D' => 'FALSE')); |
|
1624 | 1624 | } |
1625 | - $crash = filter_input(INPUT_POST,'crash',FILTER_SANITIZE_STRING); |
|
1625 | + $crash = filter_input(INPUT_POST, 'crash', FILTER_SANITIZE_STRING); |
|
1626 | 1626 | if ($crash == 'crash') { |
1627 | - $settings = array_merge($settings,array('globalAccidents' => 'TRUE')); |
|
1627 | + $settings = array_merge($settings, array('globalAccidents' => 'TRUE')); |
|
1628 | 1628 | } else { |
1629 | - $settings = array_merge($settings,array('globalAccidents' => 'FALSE')); |
|
1629 | + $settings = array_merge($settings, array('globalAccidents' => 'FALSE')); |
|
1630 | 1630 | } |
1631 | - $fires = filter_input(INPUT_POST,'fires',FILTER_SANITIZE_STRING); |
|
1631 | + $fires = filter_input(INPUT_POST, 'fires', FILTER_SANITIZE_STRING); |
|
1632 | 1632 | if ($fires == 'fires') { |
1633 | - $settings = array_merge($settings,array('globalMapFires' => 'TRUE')); |
|
1633 | + $settings = array_merge($settings, array('globalMapFires' => 'TRUE')); |
|
1634 | 1634 | } else { |
1635 | - $settings = array_merge($settings,array('globalMapFires' => 'FALSE')); |
|
1635 | + $settings = array_merge($settings, array('globalMapFires' => 'FALSE')); |
|
1636 | 1636 | } |
1637 | - $firessupport = filter_input(INPUT_POST,'firessupport',FILTER_SANITIZE_STRING); |
|
1637 | + $firessupport = filter_input(INPUT_POST, 'firessupport', FILTER_SANITIZE_STRING); |
|
1638 | 1638 | if ($firessupport == 'firessupport') { |
1639 | - $settings = array_merge($settings,array('globalFires' => 'TRUE')); |
|
1639 | + $settings = array_merge($settings, array('globalFires' => 'TRUE')); |
|
1640 | 1640 | } else { |
1641 | - $settings = array_merge($settings,array('globalFires' => 'FALSE')); |
|
1641 | + $settings = array_merge($settings, array('globalFires' => 'FALSE')); |
|
1642 | 1642 | } |
1643 | - $mapsatellites = filter_input(INPUT_POST,'mapsatellites',FILTER_SANITIZE_STRING); |
|
1643 | + $mapsatellites = filter_input(INPUT_POST, 'mapsatellites', FILTER_SANITIZE_STRING); |
|
1644 | 1644 | if ($mapsatellites == 'mapsatellites') { |
1645 | - $settings = array_merge($settings,array('globalMapSatellites' => 'TRUE')); |
|
1645 | + $settings = array_merge($settings, array('globalMapSatellites' => 'TRUE')); |
|
1646 | 1646 | } else { |
1647 | - $settings = array_merge($settings,array('globalMapSatellites' => 'FALSE')); |
|
1647 | + $settings = array_merge($settings, array('globalMapSatellites' => 'FALSE')); |
|
1648 | 1648 | } |
1649 | - $map3ddefault = filter_input(INPUT_POST,'map3ddefault',FILTER_SANITIZE_STRING); |
|
1649 | + $map3ddefault = filter_input(INPUT_POST, 'map3ddefault', FILTER_SANITIZE_STRING); |
|
1650 | 1650 | if ($map3ddefault == 'map3ddefault') { |
1651 | - $settings = array_merge($settings,array('globalMap3Ddefault' => 'TRUE')); |
|
1651 | + $settings = array_merge($settings, array('globalMap3Ddefault' => 'TRUE')); |
|
1652 | 1652 | } else { |
1653 | - $settings = array_merge($settings,array('globalMap3Ddefault' => 'FALSE')); |
|
1653 | + $settings = array_merge($settings, array('globalMap3Ddefault' => 'FALSE')); |
|
1654 | 1654 | } |
1655 | - $one3dmodel = filter_input(INPUT_POST,'one3dmodel',FILTER_SANITIZE_STRING); |
|
1655 | + $one3dmodel = filter_input(INPUT_POST, 'one3dmodel', FILTER_SANITIZE_STRING); |
|
1656 | 1656 | if ($one3dmodel == 'one3dmodel') { |
1657 | - $settings = array_merge($settings,array('globalMap3DOneModel' => 'TRUE')); |
|
1657 | + $settings = array_merge($settings, array('globalMap3DOneModel' => 'TRUE')); |
|
1658 | 1658 | } else { |
1659 | - $settings = array_merge($settings,array('globalMap3DOneModel' => 'FALSE')); |
|
1659 | + $settings = array_merge($settings, array('globalMap3DOneModel' => 'FALSE')); |
|
1660 | 1660 | } |
1661 | - $map3dliveries = filter_input(INPUT_POST,'map3dliveries',FILTER_SANITIZE_STRING); |
|
1661 | + $map3dliveries = filter_input(INPUT_POST, 'map3dliveries', FILTER_SANITIZE_STRING); |
|
1662 | 1662 | if ($map3dliveries == 'map3dliveries') { |
1663 | - $settings = array_merge($settings,array('globalMap3DLiveries' => 'TRUE')); |
|
1663 | + $settings = array_merge($settings, array('globalMap3DLiveries' => 'TRUE')); |
|
1664 | 1664 | } else { |
1665 | - $settings = array_merge($settings,array('globalMap3DLiveries' => 'FALSE')); |
|
1665 | + $settings = array_merge($settings, array('globalMap3DLiveries' => 'FALSE')); |
|
1666 | 1666 | } |
1667 | - $map3dshadows = filter_input(INPUT_POST,'map3dshadows',FILTER_SANITIZE_STRING); |
|
1667 | + $map3dshadows = filter_input(INPUT_POST, 'map3dshadows', FILTER_SANITIZE_STRING); |
|
1668 | 1668 | if ($map3dshadows == 'map3dshadows') { |
1669 | - $settings = array_merge($settings,array('globalMap3DShadows' => 'TRUE')); |
|
1669 | + $settings = array_merge($settings, array('globalMap3DShadows' => 'TRUE')); |
|
1670 | 1670 | } else { |
1671 | - $settings = array_merge($settings,array('globalMap3DShadows' => 'FALSE')); |
|
1671 | + $settings = array_merge($settings, array('globalMap3DShadows' => 'FALSE')); |
|
1672 | 1672 | } |
1673 | - $translate = filter_input(INPUT_POST,'translate',FILTER_SANITIZE_STRING); |
|
1673 | + $translate = filter_input(INPUT_POST, 'translate', FILTER_SANITIZE_STRING); |
|
1674 | 1674 | if ($translate == 'translate') { |
1675 | - $settings = array_merge($settings,array('globalTranslate' => 'TRUE')); |
|
1675 | + $settings = array_merge($settings, array('globalTranslate' => 'TRUE')); |
|
1676 | 1676 | } else { |
1677 | - $settings = array_merge($settings,array('globalTranslate' => 'FALSE')); |
|
1677 | + $settings = array_merge($settings, array('globalTranslate' => 'FALSE')); |
|
1678 | 1678 | } |
1679 | - $realairlines = filter_input(INPUT_POST,'realairlines',FILTER_SANITIZE_STRING); |
|
1679 | + $realairlines = filter_input(INPUT_POST, 'realairlines', FILTER_SANITIZE_STRING); |
|
1680 | 1680 | if ($realairlines == 'realairlines') { |
1681 | - $settings = array_merge($settings,array('globalUseRealAirlines' => 'TRUE')); |
|
1681 | + $settings = array_merge($settings, array('globalUseRealAirlines' => 'TRUE')); |
|
1682 | 1682 | } else { |
1683 | - $settings = array_merge($settings,array('globalUseRealAirlines' => 'FALSE')); |
|
1683 | + $settings = array_merge($settings, array('globalUseRealAirlines' => 'FALSE')); |
|
1684 | 1684 | } |
1685 | - $estimation = filter_input(INPUT_POST,'estimation',FILTER_SANITIZE_STRING); |
|
1685 | + $estimation = filter_input(INPUT_POST, 'estimation', FILTER_SANITIZE_STRING); |
|
1686 | 1686 | if ($estimation == 'estimation') { |
1687 | - $settings = array_merge($settings,array('globalMapEstimation' => 'TRUE')); |
|
1687 | + $settings = array_merge($settings, array('globalMapEstimation' => 'TRUE')); |
|
1688 | 1688 | } else { |
1689 | - $settings = array_merge($settings,array('globalMapEstimation' => 'FALSE')); |
|
1689 | + $settings = array_merge($settings, array('globalMapEstimation' => 'FALSE')); |
|
1690 | 1690 | } |
1691 | - $metar = filter_input(INPUT_POST,'metar',FILTER_SANITIZE_STRING); |
|
1691 | + $metar = filter_input(INPUT_POST, 'metar', FILTER_SANITIZE_STRING); |
|
1692 | 1692 | if ($metar == 'metar') { |
1693 | - $settings = array_merge($settings,array('globalMETAR' => 'TRUE')); |
|
1693 | + $settings = array_merge($settings, array('globalMETAR' => 'TRUE')); |
|
1694 | 1694 | } else { |
1695 | - $settings = array_merge($settings,array('globalMETAR' => 'FALSE')); |
|
1695 | + $settings = array_merge($settings, array('globalMETAR' => 'FALSE')); |
|
1696 | 1696 | } |
1697 | - $metarcycle = filter_input(INPUT_POST,'metarcycle',FILTER_SANITIZE_STRING); |
|
1697 | + $metarcycle = filter_input(INPUT_POST, 'metarcycle', FILTER_SANITIZE_STRING); |
|
1698 | 1698 | if ($metarcycle == 'metarcycle') { |
1699 | - $settings = array_merge($settings,array('globalMETARcycle' => 'TRUE')); |
|
1699 | + $settings = array_merge($settings, array('globalMETARcycle' => 'TRUE')); |
|
1700 | 1700 | } else { |
1701 | - $settings = array_merge($settings,array('globalMETARcycle' => 'FALSE')); |
|
1701 | + $settings = array_merge($settings, array('globalMETARcycle' => 'FALSE')); |
|
1702 | 1702 | } |
1703 | - $fork = filter_input(INPUT_POST,'fork',FILTER_SANITIZE_STRING); |
|
1703 | + $fork = filter_input(INPUT_POST, 'fork', FILTER_SANITIZE_STRING); |
|
1704 | 1704 | if ($fork == 'fork') { |
1705 | - $settings = array_merge($settings,array('globalFork' => 'TRUE')); |
|
1705 | + $settings = array_merge($settings, array('globalFork' => 'TRUE')); |
|
1706 | 1706 | } else { |
1707 | - $settings = array_merge($settings,array('globalFork' => 'FALSE')); |
|
1707 | + $settings = array_merge($settings, array('globalFork' => 'FALSE')); |
|
1708 | 1708 | } |
1709 | 1709 | |
1710 | - $colormap = filter_input(INPUT_POST,'colormap',FILTER_SANITIZE_STRING); |
|
1710 | + $colormap = filter_input(INPUT_POST, 'colormap', FILTER_SANITIZE_STRING); |
|
1711 | 1711 | if ($colormap == 'colormap') { |
1712 | - $settings = array_merge($settings,array('globalMapAltitudeColor' => 'TRUE')); |
|
1712 | + $settings = array_merge($settings, array('globalMapAltitudeColor' => 'TRUE')); |
|
1713 | 1713 | } else { |
1714 | - $settings = array_merge($settings,array('globalMapAltitudeColor' => 'FALSE')); |
|
1714 | + $settings = array_merge($settings, array('globalMapAltitudeColor' => 'FALSE')); |
|
1715 | 1715 | } |
1716 | 1716 | |
1717 | 1717 | if (isset($_POST['aircrafticoncolor'])) { |
1718 | - $aircrafticoncolor = filter_input(INPUT_POST,'aircrafticoncolor',FILTER_SANITIZE_STRING); |
|
1719 | - $settings = array_merge($settings,array('globalAircraftIconColor' => substr($aircrafticoncolor,1))); |
|
1718 | + $aircrafticoncolor = filter_input(INPUT_POST, 'aircrafticoncolor', FILTER_SANITIZE_STRING); |
|
1719 | + $settings = array_merge($settings, array('globalAircraftIconColor' => substr($aircrafticoncolor, 1))); |
|
1720 | 1720 | } |
1721 | 1721 | if (isset($_POST['marineiconcolor'])) { |
1722 | - $marineiconcolor = filter_input(INPUT_POST,'marineiconcolor',FILTER_SANITIZE_STRING); |
|
1723 | - $settings = array_merge($settings,array('globalMarineIconColor' => substr($marineiconcolor,1))); |
|
1722 | + $marineiconcolor = filter_input(INPUT_POST, 'marineiconcolor', FILTER_SANITIZE_STRING); |
|
1723 | + $settings = array_merge($settings, array('globalMarineIconColor' => substr($marineiconcolor, 1))); |
|
1724 | 1724 | } |
1725 | 1725 | if (isset($_POST['trackericoncolor'])) { |
1726 | - $trackericoncolor = filter_input(INPUT_POST,'trackericoncolor',FILTER_SANITIZE_STRING); |
|
1727 | - $settings = array_merge($settings,array('globalTrackerIconColor' => substr($trackericoncolor,1))); |
|
1726 | + $trackericoncolor = filter_input(INPUT_POST, 'trackericoncolor', FILTER_SANITIZE_STRING); |
|
1727 | + $settings = array_merge($settings, array('globalTrackerIconColor' => substr($trackericoncolor, 1))); |
|
1728 | 1728 | } |
1729 | 1729 | if (isset($_POST['satelliteiconcolor'])) { |
1730 | - $satelliteiconcolor = filter_input(INPUT_POST,'satelliteiconcolor',FILTER_SANITIZE_STRING); |
|
1731 | - $settings = array_merge($settings,array('globalSatelliteIconColor' => substr($satelliteiconcolor,1))); |
|
1730 | + $satelliteiconcolor = filter_input(INPUT_POST, 'satelliteiconcolor', FILTER_SANITIZE_STRING); |
|
1731 | + $settings = array_merge($settings, array('globalSatelliteIconColor' => substr($satelliteiconcolor, 1))); |
|
1732 | 1732 | } |
1733 | 1733 | |
1734 | - $corsproxy = filter_input(INPUT_POST,'corsproxy',FILTER_SANITIZE_STRING); |
|
1735 | - $settings = array_merge($settings,array('globalCORSproxy' => $corsproxy)); |
|
1734 | + $corsproxy = filter_input(INPUT_POST, 'corsproxy', FILTER_SANITIZE_STRING); |
|
1735 | + $settings = array_merge($settings, array('globalCORSproxy' => $corsproxy)); |
|
1736 | 1736 | |
1737 | - $airportzoom = filter_input(INPUT_POST,'airportzoom',FILTER_SANITIZE_NUMBER_INT); |
|
1738 | - $settings = array_merge($settings,array('globalAirportZoom' => $airportzoom)); |
|
1737 | + $airportzoom = filter_input(INPUT_POST, 'airportzoom', FILTER_SANITIZE_NUMBER_INT); |
|
1738 | + $settings = array_merge($settings, array('globalAirportZoom' => $airportzoom)); |
|
1739 | 1739 | |
1740 | - $unitdistance = filter_input(INPUT_POST,'unitdistance',FILTER_SANITIZE_STRING); |
|
1741 | - $settings = array_merge($settings,array('globalUnitDistance' => $unitdistance)); |
|
1742 | - $unitaltitude = filter_input(INPUT_POST,'unitaltitude',FILTER_SANITIZE_STRING); |
|
1743 | - $settings = array_merge($settings,array('globalUnitAltitude' => $unitaltitude)); |
|
1744 | - $unitspeed = filter_input(INPUT_POST,'unitspeed',FILTER_SANITIZE_STRING); |
|
1745 | - $settings = array_merge($settings,array('globalUnitSpeed' => $unitspeed)); |
|
1740 | + $unitdistance = filter_input(INPUT_POST, 'unitdistance', FILTER_SANITIZE_STRING); |
|
1741 | + $settings = array_merge($settings, array('globalUnitDistance' => $unitdistance)); |
|
1742 | + $unitaltitude = filter_input(INPUT_POST, 'unitaltitude', FILTER_SANITIZE_STRING); |
|
1743 | + $settings = array_merge($settings, array('globalUnitAltitude' => $unitaltitude)); |
|
1744 | + $unitspeed = filter_input(INPUT_POST, 'unitspeed', FILTER_SANITIZE_STRING); |
|
1745 | + $settings = array_merge($settings, array('globalUnitSpeed' => $unitspeed)); |
|
1746 | 1746 | |
1747 | - $mappopup = filter_input(INPUT_POST,'mappopup',FILTER_SANITIZE_STRING); |
|
1747 | + $mappopup = filter_input(INPUT_POST, 'mappopup', FILTER_SANITIZE_STRING); |
|
1748 | 1748 | if ($mappopup == 'mappopup') { |
1749 | - $settings = array_merge($settings,array('globalMapPopup' => 'TRUE')); |
|
1749 | + $settings = array_merge($settings, array('globalMapPopup' => 'TRUE')); |
|
1750 | 1750 | } else { |
1751 | - $settings = array_merge($settings,array('globalMapPopup' => 'FALSE')); |
|
1751 | + $settings = array_merge($settings, array('globalMapPopup' => 'FALSE')); |
|
1752 | 1752 | } |
1753 | - $airportpopup = filter_input(INPUT_POST,'airportpopup',FILTER_SANITIZE_STRING); |
|
1753 | + $airportpopup = filter_input(INPUT_POST, 'airportpopup', FILTER_SANITIZE_STRING); |
|
1754 | 1754 | if ($airportpopup == 'airportpopup') { |
1755 | - $settings = array_merge($settings,array('globalAirportPopup' => 'TRUE')); |
|
1755 | + $settings = array_merge($settings, array('globalAirportPopup' => 'TRUE')); |
|
1756 | 1756 | } else { |
1757 | - $settings = array_merge($settings,array('globalAirportPopup' => 'FALSE')); |
|
1757 | + $settings = array_merge($settings, array('globalAirportPopup' => 'FALSE')); |
|
1758 | 1758 | } |
1759 | - $maphistory = filter_input(INPUT_POST,'maphistory',FILTER_SANITIZE_STRING); |
|
1759 | + $maphistory = filter_input(INPUT_POST, 'maphistory', FILTER_SANITIZE_STRING); |
|
1760 | 1760 | if ($maphistory == 'maphistory') { |
1761 | - $settings = array_merge($settings,array('globalMapHistory' => 'TRUE')); |
|
1761 | + $settings = array_merge($settings, array('globalMapHistory' => 'TRUE')); |
|
1762 | 1762 | } else { |
1763 | - $settings = array_merge($settings,array('globalMapHistory' => 'FALSE')); |
|
1763 | + $settings = array_merge($settings, array('globalMapHistory' => 'FALSE')); |
|
1764 | 1764 | } |
1765 | - $maptooltip = filter_input(INPUT_POST,'maptooltip',FILTER_SANITIZE_STRING); |
|
1765 | + $maptooltip = filter_input(INPUT_POST, 'maptooltip', FILTER_SANITIZE_STRING); |
|
1766 | 1766 | if ($maptooltip == 'maptooltip') { |
1767 | - $settings = array_merge($settings,array('globalMapTooltip' => 'TRUE')); |
|
1767 | + $settings = array_merge($settings, array('globalMapTooltip' => 'TRUE')); |
|
1768 | 1768 | } else { |
1769 | - $settings = array_merge($settings,array('globalMapTooltip' => 'FALSE')); |
|
1769 | + $settings = array_merge($settings, array('globalMapTooltip' => 'FALSE')); |
|
1770 | 1770 | } |
1771 | - $flightroute = filter_input(INPUT_POST,'flightroute',FILTER_SANITIZE_STRING); |
|
1771 | + $flightroute = filter_input(INPUT_POST, 'flightroute', FILTER_SANITIZE_STRING); |
|
1772 | 1772 | if ($flightroute == 'flightroute') { |
1773 | - $settings = array_merge($settings,array('globalMapRoute' => 'TRUE')); |
|
1773 | + $settings = array_merge($settings, array('globalMapRoute' => 'TRUE')); |
|
1774 | 1774 | } else { |
1775 | - $settings = array_merge($settings,array('globalMapRoute' => 'FALSE')); |
|
1775 | + $settings = array_merge($settings, array('globalMapRoute' => 'FALSE')); |
|
1776 | 1776 | } |
1777 | - $flightremainingroute = filter_input(INPUT_POST,'flightremainingroute',FILTER_SANITIZE_STRING); |
|
1777 | + $flightremainingroute = filter_input(INPUT_POST, 'flightremainingroute', FILTER_SANITIZE_STRING); |
|
1778 | 1778 | if ($flightremainingroute == 'flightremainingroute') { |
1779 | - $settings = array_merge($settings,array('globalMapRemainingRoute' => 'TRUE')); |
|
1779 | + $settings = array_merge($settings, array('globalMapRemainingRoute' => 'TRUE')); |
|
1780 | 1780 | } else { |
1781 | - $settings = array_merge($settings,array('globalMapRemainingRoute' => 'FALSE')); |
|
1781 | + $settings = array_merge($settings, array('globalMapRemainingRoute' => 'FALSE')); |
|
1782 | 1782 | } |
1783 | - $allflights = filter_input(INPUT_POST,'allflights',FILTER_SANITIZE_STRING); |
|
1783 | + $allflights = filter_input(INPUT_POST, 'allflights', FILTER_SANITIZE_STRING); |
|
1784 | 1784 | if ($allflights == 'allflights') { |
1785 | - $settings = array_merge($settings,array('globalAllFlights' => 'TRUE')); |
|
1785 | + $settings = array_merge($settings, array('globalAllFlights' => 'TRUE')); |
|
1786 | 1786 | } else { |
1787 | - $settings = array_merge($settings,array('globalAllFlights' => 'FALSE')); |
|
1787 | + $settings = array_merge($settings, array('globalAllFlights' => 'FALSE')); |
|
1788 | 1788 | } |
1789 | - $bbox = filter_input(INPUT_POST,'bbox',FILTER_SANITIZE_STRING); |
|
1789 | + $bbox = filter_input(INPUT_POST, 'bbox', FILTER_SANITIZE_STRING); |
|
1790 | 1790 | if ($bbox == 'bbox') { |
1791 | - $settings = array_merge($settings,array('globalMapUseBbox' => 'TRUE')); |
|
1791 | + $settings = array_merge($settings, array('globalMapUseBbox' => 'TRUE')); |
|
1792 | 1792 | } else { |
1793 | - $settings = array_merge($settings,array('globalMapUseBbox' => 'FALSE')); |
|
1793 | + $settings = array_merge($settings, array('globalMapUseBbox' => 'FALSE')); |
|
1794 | 1794 | } |
1795 | - $singlemodel = filter_input(INPUT_POST,'singlemodel',FILTER_SANITIZE_STRING); |
|
1795 | + $singlemodel = filter_input(INPUT_POST, 'singlemodel', FILTER_SANITIZE_STRING); |
|
1796 | 1796 | if ($singlemodel == 'singlemodel') { |
1797 | - $settings = array_merge($settings,array('globalMap3DSelected' => 'TRUE')); |
|
1797 | + $settings = array_merge($settings, array('globalMap3DSelected' => 'TRUE')); |
|
1798 | 1798 | } else { |
1799 | - $settings = array_merge($settings,array('globalMap3DSelected' => 'FALSE')); |
|
1799 | + $settings = array_merge($settings, array('globalMap3DSelected' => 'FALSE')); |
|
1800 | 1800 | } |
1801 | - $groundaltitude = filter_input(INPUT_POST,'groundaltitude',FILTER_SANITIZE_STRING); |
|
1801 | + $groundaltitude = filter_input(INPUT_POST, 'groundaltitude', FILTER_SANITIZE_STRING); |
|
1802 | 1802 | if ($groundaltitude == 'groundaltitude') { |
1803 | - $settings = array_merge($settings,array('globalGroundAltitude' => 'TRUE')); |
|
1803 | + $settings = array_merge($settings, array('globalGroundAltitude' => 'TRUE')); |
|
1804 | 1804 | } else { |
1805 | - $settings = array_merge($settings,array('globalGroundAltitude' => 'FALSE')); |
|
1805 | + $settings = array_merge($settings, array('globalGroundAltitude' => 'FALSE')); |
|
1806 | 1806 | } |
1807 | - $waypoints = filter_input(INPUT_POST,'waypoints',FILTER_SANITIZE_STRING); |
|
1807 | + $waypoints = filter_input(INPUT_POST, 'waypoints', FILTER_SANITIZE_STRING); |
|
1808 | 1808 | if ($waypoints == 'waypoints') { |
1809 | - $settings = array_merge($settings,array('globalWaypoints' => 'TRUE')); |
|
1809 | + $settings = array_merge($settings, array('globalWaypoints' => 'TRUE')); |
|
1810 | 1810 | } else { |
1811 | - $settings = array_merge($settings,array('globalWaypoints' => 'FALSE')); |
|
1811 | + $settings = array_merge($settings, array('globalWaypoints' => 'FALSE')); |
|
1812 | 1812 | } |
1813 | - $geoid = filter_input(INPUT_POST,'geoid',FILTER_SANITIZE_STRING); |
|
1813 | + $geoid = filter_input(INPUT_POST, 'geoid', FILTER_SANITIZE_STRING); |
|
1814 | 1814 | if ($geoid == 'geoid') { |
1815 | - $settings = array_merge($settings,array('globalGeoid' => 'TRUE')); |
|
1815 | + $settings = array_merge($settings, array('globalGeoid' => 'TRUE')); |
|
1816 | 1816 | } else { |
1817 | - $settings = array_merge($settings,array('globalGeoid' => 'FALSE')); |
|
1817 | + $settings = array_merge($settings, array('globalGeoid' => 'FALSE')); |
|
1818 | 1818 | } |
1819 | - $geoid_source = filter_input(INPUT_POST,'geoid_source',FILTER_SANITIZE_STRING); |
|
1820 | - $settings = array_merge($settings,array('globalGeoidSource' => $geoid_source)); |
|
1819 | + $geoid_source = filter_input(INPUT_POST, 'geoid_source', FILTER_SANITIZE_STRING); |
|
1820 | + $settings = array_merge($settings, array('globalGeoidSource' => $geoid_source)); |
|
1821 | 1821 | |
1822 | - $noairlines = filter_input(INPUT_POST,'noairlines',FILTER_SANITIZE_STRING); |
|
1822 | + $noairlines = filter_input(INPUT_POST, 'noairlines', FILTER_SANITIZE_STRING); |
|
1823 | 1823 | if ($noairlines == 'noairlines') { |
1824 | - $settings = array_merge($settings,array('globalNoAirlines' => 'TRUE')); |
|
1824 | + $settings = array_merge($settings, array('globalNoAirlines' => 'TRUE')); |
|
1825 | 1825 | } else { |
1826 | - $settings = array_merge($settings,array('globalNoAirlines' => 'FALSE')); |
|
1826 | + $settings = array_merge($settings, array('globalNoAirlines' => 'FALSE')); |
|
1827 | 1827 | } |
1828 | 1828 | |
1829 | - $tsk = filter_input(INPUT_POST,'tsk',FILTER_SANITIZE_STRING); |
|
1829 | + $tsk = filter_input(INPUT_POST, 'tsk', FILTER_SANITIZE_STRING); |
|
1830 | 1830 | if ($tsk == 'tsk') { |
1831 | - $settings = array_merge($settings,array('globalTSK' => 'TRUE')); |
|
1831 | + $settings = array_merge($settings, array('globalTSK' => 'TRUE')); |
|
1832 | 1832 | } else { |
1833 | - $settings = array_merge($settings,array('globalTSK' => 'FALSE')); |
|
1833 | + $settings = array_merge($settings, array('globalTSK' => 'FALSE')); |
|
1834 | 1834 | } |
1835 | - $mapmatching = filter_input(INPUT_POST,'mapmatching',FILTER_SANITIZE_STRING); |
|
1835 | + $mapmatching = filter_input(INPUT_POST, 'mapmatching', FILTER_SANITIZE_STRING); |
|
1836 | 1836 | if ($mapmatching == 'mapmatching') { |
1837 | - $settings = array_merge($settings,array('globalMapMatching' => 'TRUE')); |
|
1837 | + $settings = array_merge($settings, array('globalMapMatching' => 'TRUE')); |
|
1838 | 1838 | } else { |
1839 | - $settings = array_merge($settings,array('globalMapMatching' => 'FALSE')); |
|
1839 | + $settings = array_merge($settings, array('globalMapMatching' => 'FALSE')); |
|
1840 | 1840 | } |
1841 | - $mapmatchingsource = filter_input(INPUT_POST,'mapmatchingsource',FILTER_SANITIZE_STRING); |
|
1842 | - $settings = array_merge($settings,array('globalMapMatchingSource' => $mapmatchingsource)); |
|
1843 | - $graphhopper = filter_input(INPUT_POST,'graphhopper',FILTER_SANITIZE_STRING); |
|
1844 | - $settings = array_merge($settings,array('globalGraphHopperKey' => $graphhopper)); |
|
1841 | + $mapmatchingsource = filter_input(INPUT_POST, 'mapmatchingsource', FILTER_SANITIZE_STRING); |
|
1842 | + $settings = array_merge($settings, array('globalMapMatchingSource' => $mapmatchingsource)); |
|
1843 | + $graphhopper = filter_input(INPUT_POST, 'graphhopper', FILTER_SANITIZE_STRING); |
|
1844 | + $settings = array_merge($settings, array('globalGraphHopperKey' => $graphhopper)); |
|
1845 | 1845 | |
1846 | - if (!isset($globalTransaction)) $settings = array_merge($settings,array('globalTransaction' => 'TRUE')); |
|
1846 | + if (!isset($globalTransaction)) $settings = array_merge($settings, array('globalTransaction' => 'TRUE')); |
|
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)); |
|
1855 | + $globalSchedulesSources = array('flightmapper', 'costtotravel', 'flightradar24', 'flightaware'); |
|
1856 | + $settings = array_merge($settings, array('globalSchedulesSources' => $globalSchedulesSources)); |
|
1857 | 1857 | } |
1858 | 1858 | |
1859 | - $settings = array_merge($settings,array('globalInstalled' => 'TRUE')); |
|
1859 | + $settings = array_merge($settings, array('globalInstalled' => 'TRUE')); |
|
1860 | 1860 | |
1861 | 1861 | if ($error == '') settings::modify_settings($settings); |
1862 | 1862 | if ($error == '') settings::comment_settings($settings_comment); |
@@ -66,11 +66,11 @@ discard block |
||
66 | 66 | $s3 = sin($bank/2); |
67 | 67 | $c1c2 = $c1*$c2; |
68 | 68 | $s1s2 = $s1*$s2; |
69 | - $w =$c1c2*$c3 - $s1s2*$s3; |
|
70 | - $x =$c1c2*$s3 + $s1s2*$c3; |
|
71 | - $y =$s1*$c2*$c3 + $c1*$s2*$s3; |
|
72 | - $z =$c1*$s2*$c3 - $s1*$c2*$s3; |
|
73 | - return array('x' => $x,'y' => $y,'z' => $z,'w' => $w); |
|
69 | + $w = $c1c2*$c3 - $s1s2*$s3; |
|
70 | + $x = $c1c2*$s3 + $s1s2*$c3; |
|
71 | + $y = $s1*$c2*$c3 + $c1*$s2*$s3; |
|
72 | + $z = $c1*$s2*$c3 - $s1*$c2*$s3; |
|
73 | + return array('x' => $x, 'y' => $y, 'z' => $z, 'w' => $w); |
|
74 | 74 | // return array('x' => '0.0','y' => '-0.931','z' => '0.0','w' => '0.365'); |
75 | 75 | |
76 | 76 | } |
@@ -92,22 +92,22 @@ discard block |
||
92 | 92 | $allhistory = false; |
93 | 93 | $filter['source'] = array(); |
94 | 94 | $limit = 0; |
95 | -if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') $filter['source'] = array_merge($filter['source'],array('vatsimtxt')); |
|
96 | -if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') $filter['source'] = array_merge($filter['source'],array('whazzup')); |
|
97 | -if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') $filter['source'] = array_merge($filter['source'],array('phpvmacars')); |
|
98 | -if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') $filter['source'] = array_merge($filter['source'],array('sbs','famaprs')); |
|
99 | -if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') $filter['source'] = array_merge($filter['source'],array('aprs')); |
|
100 | -if (isset($_COOKIE['filter_ident']) && $_COOKIE['filter_ident'] != '') $filter['ident'] = filter_var($_COOKIE['filter_ident'],FILTER_SANITIZE_STRING); |
|
101 | -if (isset($_COOKIE['filter_mmsi']) && $_COOKIE['filter_mmsi'] != '') $filter['mmsi'] = filter_var($_COOKIE['filter_mmsi'],FILTER_SANITIZE_STRING); |
|
102 | -if (isset($_COOKIE['filter_Airlines']) && $_COOKIE['filter_Airlines'] != '') $filter['airlines'] = filter_var_array(explode(',',$_COOKIE['filter_Airlines']),FILTER_SANITIZE_STRING); |
|
103 | -if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') $filter['source_aprs'] = filter_var_array(explode(',',$_COOKIE['filter_Sources']),FILTER_SANITIZE_STRING); |
|
104 | -if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') $filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'],FILTER_SANITIZE_STRING); |
|
105 | -if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] != 'all') $filter['alliance'] = filter_var($_COOKIE['filter_alliance'],FILTER_SANITIZE_STRING); |
|
106 | -if (isset($_COOKIE['filter_race']) && $_COOKIE['filter_race'] != 'all') $filter['race'] = filter_var($_COOKIE['filter_race'],FILTER_SANITIZE_NUMBER_INT); |
|
95 | +if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') $filter['source'] = array_merge($filter['source'], array('vatsimtxt')); |
|
96 | +if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') $filter['source'] = array_merge($filter['source'], array('whazzup')); |
|
97 | +if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') $filter['source'] = array_merge($filter['source'], array('phpvmacars')); |
|
98 | +if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') $filter['source'] = array_merge($filter['source'], array('sbs', 'famaprs')); |
|
99 | +if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') $filter['source'] = array_merge($filter['source'], array('aprs')); |
|
100 | +if (isset($_COOKIE['filter_ident']) && $_COOKIE['filter_ident'] != '') $filter['ident'] = filter_var($_COOKIE['filter_ident'], FILTER_SANITIZE_STRING); |
|
101 | +if (isset($_COOKIE['filter_mmsi']) && $_COOKIE['filter_mmsi'] != '') $filter['mmsi'] = filter_var($_COOKIE['filter_mmsi'], FILTER_SANITIZE_STRING); |
|
102 | +if (isset($_COOKIE['filter_Airlines']) && $_COOKIE['filter_Airlines'] != '') $filter['airlines'] = filter_var_array(explode(',', $_COOKIE['filter_Airlines']), FILTER_SANITIZE_STRING); |
|
103 | +if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') $filter['source_aprs'] = filter_var_array(explode(',', $_COOKIE['filter_Sources']), FILTER_SANITIZE_STRING); |
|
104 | +if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') $filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'], FILTER_SANITIZE_STRING); |
|
105 | +if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] != 'all') $filter['alliance'] = filter_var($_COOKIE['filter_alliance'], FILTER_SANITIZE_STRING); |
|
106 | +if (isset($_COOKIE['filter_race']) && $_COOKIE['filter_race'] != 'all') $filter['race'] = filter_var($_COOKIE['filter_race'], FILTER_SANITIZE_NUMBER_INT); |
|
107 | 107 | if (isset($_COOKIE['filter_blocked']) && $_COOKIE['filter_blocked'] == 'true') $filter['blocked'] = true; |
108 | 108 | |
109 | 109 | if (isset($_COOKIE['map_3d_limit'])) { |
110 | - $limit = filter_var($_COOKIE['map_3d_limit'],FILTER_SANITIZE_NUMBER_INT); |
|
110 | + $limit = filter_var($_COOKIE['map_3d_limit'], FILTER_SANITIZE_NUMBER_INT); |
|
111 | 111 | } |
112 | 112 | |
113 | 113 | /* |
@@ -156,17 +156,17 @@ discard block |
||
156 | 156 | $from_archive = true; |
157 | 157 | // $begindate = filter_input(INPUT_GET,'begindate',FILTER_VALIDATE_REGEXP,array("options"=>array("regexp"=>'~^\d{4}/\d{2}/\d{2}$~'))); |
158 | 158 | // $enddate = filter_input(INPUT_GET,'enddate',FILTER_VALIDATE_REGEXP,array("options"=>array("regexp"=>'~^\d{4}/\d{2}/\d{2}$~'))); |
159 | - $begindate = filter_input(INPUT_GET,'begindate',FILTER_SANITIZE_NUMBER_INT); |
|
160 | - $enddate = filter_input(INPUT_GET,'enddate',FILTER_SANITIZE_NUMBER_INT); |
|
161 | - $archivespeed = filter_input(INPUT_GET,'speed',FILTER_SANITIZE_NUMBER_INT); |
|
162 | - $begindate = date('Y-m-d H:i:s',$begindate); |
|
163 | - $enddate = date('Y-m-d H:i:s',$enddate); |
|
159 | + $begindate = filter_input(INPUT_GET, 'begindate', FILTER_SANITIZE_NUMBER_INT); |
|
160 | + $enddate = filter_input(INPUT_GET, 'enddate', FILTER_SANITIZE_NUMBER_INT); |
|
161 | + $archivespeed = filter_input(INPUT_GET, 'speed', FILTER_SANITIZE_NUMBER_INT); |
|
162 | + $begindate = date('Y-m-d H:i:s', $begindate); |
|
163 | + $enddate = date('Y-m-d H:i:s', $enddate); |
|
164 | 164 | if ($tracker) { |
165 | - $spotter_array = $TrackerArchive->getMinLiveTrackerDataPlayback($begindate,$enddate,$filter); |
|
165 | + $spotter_array = $TrackerArchive->getMinLiveTrackerDataPlayback($begindate, $enddate, $filter); |
|
166 | 166 | } elseif ($marine) { |
167 | - $spotter_array = $MarineArchive->getMinLiveMarineDataPlayback($begindate,$enddate,$filter); |
|
167 | + $spotter_array = $MarineArchive->getMinLiveMarineDataPlayback($begindate, $enddate, $filter); |
|
168 | 168 | } else { |
169 | - $spotter_array = $SpotterArchive->getMinLiveSpotterDataPlayback($begindate,$enddate,$filter); |
|
169 | + $spotter_array = $SpotterArchive->getMinLiveSpotterDataPlayback($begindate, $enddate, $filter); |
|
170 | 170 | } |
171 | 171 | } elseif (isset($_COOKIE['archive']) && isset($_COOKIE['archive_begin']) && isset($_COOKIE['archive_end']) && isset($_COOKIE['archive_speed'])) { |
172 | 172 | $from_archive = true; |
@@ -183,36 +183,36 @@ discard block |
||
183 | 183 | } |
184 | 184 | $enddate = $_COOKIE['archive_end']; |
185 | 185 | $enddateinitial = $_COOKIE['archive_end']; |
186 | - $archivespeed = filter_var($_COOKIE['archive_speed'],FILTER_SANITIZE_NUMBER_INT); |
|
187 | - $begindate = date('Y-m-d H:i:s',$begindate); |
|
188 | - $enddate = date('Y-m-d H:i:s',$enddate); |
|
186 | + $archivespeed = filter_var($_COOKIE['archive_speed'], FILTER_SANITIZE_NUMBER_INT); |
|
187 | + $begindate = date('Y-m-d H:i:s', $begindate); |
|
188 | + $enddate = date('Y-m-d H:i:s', $enddate); |
|
189 | 189 | //echo 'Begin : '.$begindate.' - End : '.$enddate."\n"; |
190 | 190 | if ($tracker) { |
191 | - $spotter_array = $TrackerArchive->getMinLiveTrackerData($begindate,$enddate,$filter); |
|
191 | + $spotter_array = $TrackerArchive->getMinLiveTrackerData($begindate, $enddate, $filter); |
|
192 | 192 | } elseif ($marine) { |
193 | - $spotter_array = $MarineArchive->getMinLiveMarineData($begindate,$enddate,$filter); |
|
193 | + $spotter_array = $MarineArchive->getMinLiveMarineData($begindate, $enddate, $filter); |
|
194 | 194 | } else { |
195 | - $spotter_array = $SpotterArchive->getMinLiveSpotterData($begindate,$enddate,$filter); |
|
195 | + $spotter_array = $SpotterArchive->getMinLiveSpotterData($begindate, $enddate, $filter); |
|
196 | 196 | } |
197 | 197 | } elseif ($tracker) { |
198 | 198 | $coord = array(); |
199 | 199 | if (isset($_GET['coord']) && $_GET['coord'] != '') { |
200 | - $coord = explode(',',$_GET['coord']); |
|
201 | - if (!(filter_var($coord[0],FILTER_VALIDATE_FLOAT) && filter_var($coord[1],FILTER_VALIDATE_FLOAT) && filter_var($coord[2],FILTER_VALIDATE_FLOAT) && filter_var($coord[3],FILTER_VALIDATE_FLOAT) |
|
200 | + $coord = explode(',', $_GET['coord']); |
|
201 | + if (!(filter_var($coord[0], FILTER_VALIDATE_FLOAT) && filter_var($coord[1], FILTER_VALIDATE_FLOAT) && filter_var($coord[2], FILTER_VALIDATE_FLOAT) && filter_var($coord[3], FILTER_VALIDATE_FLOAT) |
|
202 | 202 | && $coord[0] > -180.0 && $coord[0] < 180.0 && $coord[1] > -90.0 && $coord[1] < 90.0 && $coord[2] > -180.0 && $coord[2] < 180.0 && $coord[3] > -90.0 && $coord[3] < 90.0)) { |
203 | 203 | $coord = array(); |
204 | 204 | } |
205 | 205 | } |
206 | 206 | $previous_filter = $filter; |
207 | 207 | if ((isset($_COOKIE['singlemodel']) && $_COOKIE['singlemodel'] == 'true') && (isset($_COOKIE['MapTrackTracker']) && $_COOKIE['MapTrackTracker'] != '')) { |
208 | - $filter = array_merge($filter,array('id' => $_COOKIE['MapTrackTracker'])); |
|
209 | - $spotter_array = $TrackerLive->getMinLastLiveTrackerData($coord,$filter,false); |
|
208 | + $filter = array_merge($filter, array('id' => $_COOKIE['MapTrackTracker'])); |
|
209 | + $spotter_array = $TrackerLive->getMinLastLiveTrackerData($coord, $filter, false); |
|
210 | 210 | /* |
211 | 211 | } elseif (isset($_COOKIE['MapTrack']) && $_COOKIE['MapTrack'] != '' && !empty($coord)) { |
212 | 212 | $spotter_array = $TrackerLive->getMinLastLiveTrackerData($coord,$filter,true,$_COOKIE['MapTrack']); |
213 | 213 | */ |
214 | 214 | } elseif (!isset($_COOKIE['singlemodel']) || $_COOKIE['singlemodel'] == 'false') { |
215 | - $spotter_array = $TrackerLive->getMinLastLiveTrackerData($coord,$filter,false); |
|
215 | + $spotter_array = $TrackerLive->getMinLastLiveTrackerData($coord, $filter, false); |
|
216 | 216 | } else { |
217 | 217 | $spotter_array = array(); |
218 | 218 | } |
@@ -221,8 +221,8 @@ discard block |
||
221 | 221 | $coord = array(); |
222 | 222 | //if (isset($_GET['coord']) && $_GET['coord'] != '') { |
223 | 223 | if (!((isset($_COOKIE['singlemodel']) && $_COOKIE['singlemodel'] == 'true') && (isset($_COOKIE['MapTrackMarine']) && $_COOKIE['MapTrackMarine'] != '')) && isset($_GET['coord']) && $_GET['coord'] != '') { |
224 | - $coord = explode(',',$_GET['coord']); |
|
225 | - if (!(filter_var($coord[0],FILTER_VALIDATE_FLOAT) && filter_var($coord[1],FILTER_VALIDATE_FLOAT) && filter_var($coord[2],FILTER_VALIDATE_FLOAT) && filter_var($coord[3],FILTER_VALIDATE_FLOAT) |
|
224 | + $coord = explode(',', $_GET['coord']); |
|
225 | + if (!(filter_var($coord[0], FILTER_VALIDATE_FLOAT) && filter_var($coord[1], FILTER_VALIDATE_FLOAT) && filter_var($coord[2], FILTER_VALIDATE_FLOAT) && filter_var($coord[3], FILTER_VALIDATE_FLOAT) |
|
226 | 226 | && $coord[0] > -180.0 && $coord[0] < 180.0 && $coord[1] > -90.0 && $coord[1] < 90.0 && $coord[2] > -180.0 && $coord[2] < 180.0 && $coord[3] > -90.0 && $coord[3] < 90.0)) { |
227 | 227 | $coord = array(); |
228 | 228 | } |
@@ -231,11 +231,11 @@ discard block |
||
231 | 231 | if (((isset($_COOKIE['singlemodel']) && $_COOKIE['singlemodel'] == 'true') || (!isset($_COOKIE['singlemodel']) && isset($globalMap3DSelected) && $globalMap3DSelected)) && (isset($_COOKIE['MapTrackMarine']) && $_COOKIE['MapTrackMarine'] != '')) { |
232 | 232 | //$filter = array_merge($filter,array('id' => $_COOKIE['MapTrackMarine'])); |
233 | 233 | //$spotter_array = $MarineLive->getMinLastLiveMarineData($coord,$filter,false); |
234 | - $spotter_array = $MarineLive->getMinLastLiveMarineDataByID($_COOKIE['MapTrackMarine'],$filter,false); |
|
234 | + $spotter_array = $MarineLive->getMinLastLiveMarineDataByID($_COOKIE['MapTrackMarine'], $filter, false); |
|
235 | 235 | } elseif (isset($_COOKIE['MapTrackMarine']) && $_COOKIE['MapTrackMarine'] != '' && !empty($coord)) { |
236 | - $spotter_array = $MarineLive->getMinLastLiveMarineData($coord,$filter,false,$_COOKIE['MapTrack']); |
|
236 | + $spotter_array = $MarineLive->getMinLastLiveMarineData($coord, $filter, false, $_COOKIE['MapTrack']); |
|
237 | 237 | } elseif (!isset($_COOKIE['singlemodel']) || $_COOKIE['singlemodel'] == 'false') { |
238 | - $spotter_array = $MarineLive->getMinLastLiveMarineData($coord,$filter,false); |
|
238 | + $spotter_array = $MarineLive->getMinLastLiveMarineData($coord, $filter, false); |
|
239 | 239 | } else { |
240 | 240 | $spotter_array = array(); |
241 | 241 | } |
@@ -243,8 +243,8 @@ discard block |
||
243 | 243 | } else { |
244 | 244 | $coord = array(); |
245 | 245 | if (!((isset($_COOKIE['singlemodel']) && $_COOKIE['singlemodel'] == 'true') && (isset($_COOKIE['MapTrack']) && $_COOKIE['MapTrack'] != '')) && isset($_GET['coord']) && $_GET['coord'] != '') { |
246 | - $coord = explode(',',$_GET['coord']); |
|
247 | - if (!(filter_var($coord[0],FILTER_VALIDATE_FLOAT) && filter_var($coord[1],FILTER_VALIDATE_FLOAT) && filter_var($coord[2],FILTER_VALIDATE_FLOAT) && filter_var($coord[3],FILTER_VALIDATE_FLOAT) |
|
246 | + $coord = explode(',', $_GET['coord']); |
|
247 | + if (!(filter_var($coord[0], FILTER_VALIDATE_FLOAT) && filter_var($coord[1], FILTER_VALIDATE_FLOAT) && filter_var($coord[2], FILTER_VALIDATE_FLOAT) && filter_var($coord[3], FILTER_VALIDATE_FLOAT) |
|
248 | 248 | && $coord[0] > -180.0 && $coord[0] < 180.0 && $coord[1] > -90.0 && $coord[1] < 90.0 && $coord[2] > -180.0 && $coord[2] < 180.0 && $coord[3] > -90.0 && $coord[3] < 90.0)) { |
249 | 249 | $coord = array(); |
250 | 250 | } |
@@ -252,14 +252,14 @@ discard block |
||
252 | 252 | $previous_filter = $filter; |
253 | 253 | if (((isset($_COOKIE['singlemodel']) && $_COOKIE['singlemodel'] == 'true') || (!isset($_COOKIE['singlemodel']) && isset($globalMap3DSelected) && $globalMap3DSelected)) && (isset($_COOKIE['MapTrack']) && $_COOKIE['MapTrack'] != '')) { |
254 | 254 | //$filter = array_merge($filter,array('id' => $_COOKIE['MapTrack'])); |
255 | - $spotter_array = $SpotterLive->getMinLastLiveSpotterDataByID($_COOKIE['MapTrack'],$filter,$limit); |
|
255 | + $spotter_array = $SpotterLive->getMinLastLiveSpotterDataByID($_COOKIE['MapTrack'], $filter, $limit); |
|
256 | 256 | //$spotter_array = $SpotterLive->getMinLastLiveSpotterData($coord,$filter,false); |
257 | 257 | } elseif (isset($_COOKIE['MapTrack']) && $_COOKIE['MapTrack'] != '') { |
258 | 258 | //$spotter_array = $SpotterLive->getMinLastLiveSpotterDataByID($_COOKIE['MapTrack'],$filter,false); |
259 | 259 | //if (empty($spotter_array)) $spotter_array = $SpotterLive->getMinLastLiveSpotterData($coord,$filter,false,$_COOKIE['MapTrack']); |
260 | - $spotter_array = $SpotterLive->getMinLastLiveSpotterData($coord,$filter,$limit,$_COOKIE['MapTrack']); |
|
260 | + $spotter_array = $SpotterLive->getMinLastLiveSpotterData($coord, $filter, $limit, $_COOKIE['MapTrack']); |
|
261 | 261 | } elseif (!isset($_COOKIE['singlemodel']) || $_COOKIE['singlemodel'] == 'false') { |
262 | - $spotter_array = $SpotterLive->getMinLastLiveSpotterData($coord,$filter,$limit); |
|
262 | + $spotter_array = $SpotterLive->getMinLastLiveSpotterData($coord, $filter, $limit); |
|
263 | 263 | } else { |
264 | 264 | $spotter_array = array(); |
265 | 265 | } |
@@ -269,19 +269,19 @@ discard block |
||
269 | 269 | if (!empty($spotter_array) && isset($coord)) { |
270 | 270 | if ($tracker) { |
271 | 271 | if (isset($_GET['archive'])) { |
272 | - $flightcnt = $TrackerArchive->getLiveTrackerCount($begindate,$enddate,$filter); |
|
272 | + $flightcnt = $TrackerArchive->getLiveTrackerCount($begindate, $enddate, $filter); |
|
273 | 273 | } else { |
274 | 274 | $flightcnt = $TrackerLive->getLiveTrackerCount($filter); |
275 | 275 | } |
276 | 276 | } elseif ($marine) { |
277 | 277 | if (isset($_GET['archive'])) { |
278 | - $flightcnt = $MarineArchive->getLiveMarineCount($begindate,$enddate,$filter); |
|
278 | + $flightcnt = $MarineArchive->getLiveMarineCount($begindate, $enddate, $filter); |
|
279 | 279 | } else { |
280 | 280 | $flightcnt = $MarineLive->getLiveMarineCount($filter); |
281 | 281 | } |
282 | 282 | } else { |
283 | 283 | if (isset($_GET['archive'])) { |
284 | - $flightcnt = $SpotterArchive->getLiveSpotterCount($begindate,$enddate,$filter); |
|
284 | + $flightcnt = $SpotterArchive->getLiveSpotterCount($begindate, $enddate, $filter); |
|
285 | 285 | } else { |
286 | 286 | $flightcnt = $SpotterLive->getLiveSpotterCount($filter); |
287 | 287 | } |
@@ -289,17 +289,17 @@ discard block |
||
289 | 289 | if ($flightcnt == '') $flightcnt = 0; |
290 | 290 | } else $flightcnt = 0; |
291 | 291 | |
292 | -$sqltime = round(microtime(true)-$begintime,2); |
|
292 | +$sqltime = round(microtime(true) - $begintime, 2); |
|
293 | 293 | $minitime = time(); |
294 | 294 | $minitracktime_begin = time(); |
295 | 295 | $minitracktime = $minitracktime_begin; |
296 | 296 | $maxitime = 0; |
297 | -$lastupdate = filter_input(INPUT_GET,'update',FILTER_SANITIZE_NUMBER_INT); |
|
297 | +$lastupdate = filter_input(INPUT_GET, 'update', FILTER_SANITIZE_NUMBER_INT); |
|
298 | 298 | $modelsdb = array(); |
299 | 299 | if (file_exists(dirname(__FILE__).'/models/modelsdb')) { |
300 | - if (($handle = fopen(dirname(__FILE__).'/models/modelsdb','r')) !== FALSE) { |
|
301 | - while (($row = fgetcsv($handle,1000)) !== FALSE) { |
|
302 | - if (isset($row[1]) ){ |
|
300 | + if (($handle = fopen(dirname(__FILE__).'/models/modelsdb', 'r')) !== FALSE) { |
|
301 | + while (($row = fgetcsv($handle, 1000)) !== FALSE) { |
|
302 | + if (isset($row[1])) { |
|
303 | 303 | $model = $row[0]; |
304 | 304 | $modelsdb[$model] = $row[1]; |
305 | 305 | } |
@@ -309,9 +309,9 @@ discard block |
||
309 | 309 | } |
310 | 310 | $modelsdb2 = array(); |
311 | 311 | if (file_exists(dirname(__FILE__).'/models/gltf2/modelsdb')) { |
312 | - if (($handle = fopen(dirname(__FILE__).'/models/gltf2/modelsdb','r')) !== FALSE) { |
|
313 | - while (($row = fgetcsv($handle,1000)) !== FALSE) { |
|
314 | - if (isset($row[1]) ){ |
|
312 | + if (($handle = fopen(dirname(__FILE__).'/models/gltf2/modelsdb', 'r')) !== FALSE) { |
|
313 | + while (($row = fgetcsv($handle, 1000)) !== FALSE) { |
|
314 | + if (isset($row[1])) { |
|
315 | 315 | $model = $row[0]; |
316 | 316 | $glb = $row[1]; |
317 | 317 | if (isset($row[2])) { |
@@ -357,7 +357,7 @@ discard block |
||
357 | 357 | if (!empty($spotter_array) && is_array($spotter_array)) |
358 | 358 | { |
359 | 359 | $nblatlong = 0; |
360 | - foreach($spotter_array as $spotter_item) |
|
360 | + foreach ($spotter_array as $spotter_item) |
|
361 | 361 | { |
362 | 362 | $j++; |
363 | 363 | //if (isset($spotter_item['format_source']) && $spotter_item['format_source'] == 'airwhere') $heightrelative = 'RELATIVE_TO_GROUND'; |
@@ -411,17 +411,17 @@ discard block |
||
411 | 411 | } |
412 | 412 | if (isset($spotter_item['registration'])) $output .= '"registration": "'.$spotter_item['registration'].'",'; |
413 | 413 | if (isset($spotter_item['format_source'])) $output .= '"format": "'.$spotter_item['format_source'].'",'; |
414 | - if (isset($spotter_item['ident'])) $output.= '"ident": '.json_encode($spotter_item['ident']).','; |
|
414 | + if (isset($spotter_item['ident'])) $output .= '"ident": '.json_encode($spotter_item['ident']).','; |
|
415 | 415 | if ($tracker) { |
416 | 416 | if (isset($spotter_item['type'])) $output .= '"tracker_type": '.json_encode($spotter_item['type']).','; |
417 | - $output.= '"type": "tracker"'; |
|
417 | + $output .= '"type": "tracker"'; |
|
418 | 418 | } elseif ($marine) { |
419 | 419 | if (isset($spotter_item['type'])) $output .= '"marine_type": '.json_encode($spotter_item['type']).','; |
420 | 420 | if (isset($spotter_item['captain_name'])) $output .= '"captain": '.json_encode($spotter_item['captain_name']).','; |
421 | 421 | if (isset($spotter_item['race_id'])) $output .= '"raceid": '.$spotter_item['race_id'].','; |
422 | 422 | if (isset($spotter_item['race_name'])) $output .= '"race": '.json_encode($spotter_item['race_name']).','; |
423 | 423 | if (isset($spotter_item['race_rank'])) $output .= '"rank": "'.$spotter_item['race_rank'].'",'; |
424 | - $output.= '"type": "marine"'; |
|
424 | + $output .= '"type": "marine"'; |
|
425 | 425 | } else { |
426 | 426 | if ($one3dmodel === false && isset($globalMap3DLiveries) && $globalMap3DLiveries) { |
427 | 427 | $aircraft_icao = $spotter_item['aircraft_icao']; |
@@ -435,14 +435,14 @@ discard block |
||
435 | 435 | if (isset($airline_icao)) { |
436 | 436 | $imagefile = $aircraft_icao.'-'.$airline_icao.'.png'; |
437 | 437 | if (file_exists(dirname(__FILE__).'/models/gltf2/liveries/'.$imagefile)) { |
438 | - $output.= '"liveries": "'.$globalURL.'/models/gltf2/liveries/'.$imagefile.'",'; |
|
438 | + $output .= '"liveries": "'.$globalURL.'/models/gltf2/liveries/'.$imagefile.'",'; |
|
439 | 439 | } |
440 | 440 | } |
441 | 441 | } |
442 | 442 | //if ($ident != '') $output.= '"ident": "'.$ident.'",'; |
443 | 443 | } |
444 | - $output.= '"gltf2": %gltf2%,'; |
|
445 | - $output.= '"type": "flight"'; |
|
444 | + $output .= '"gltf2": %gltf2%,'; |
|
445 | + $output .= '"type": "flight"'; |
|
446 | 446 | } |
447 | 447 | $output .= '},'; |
448 | 448 | |
@@ -817,8 +817,8 @@ discard block |
||
817 | 817 | $output .= '},'; |
818 | 818 | } |
819 | 819 | } |
820 | - if (isset($onground) && $onground) $output = str_replace('%onground%','true',$output); |
|
821 | - else $output = str_replace('%onground%','false',$output); |
|
820 | + if (isset($onground) && $onground) $output = str_replace('%onground%', 'true', $output); |
|
821 | + else $output = str_replace('%onground%', 'false', $output); |
|
822 | 822 | |
823 | 823 | // $output .= '"heightReference": "CLAMP_TO_GROUND",'; |
824 | 824 | //$output .= '"heightReference": "'.$heightrelative.'",'; |
@@ -834,7 +834,7 @@ discard block |
||
834 | 834 | if ($minitime > strtotime($spotter_item['date'])) $minitime = strtotime($spotter_item['date']); |
835 | 835 | if (isset($_COOKIE['MapTrack']) && $id == $_COOKIE['MapTrack'] && $minitracktime > strtotime($spotter_item['date'])) $minitracktime = strtotime($spotter_item['date']); |
836 | 836 | if ($maxitime < strtotime($spotter_item['date'])) $maxitime = strtotime($spotter_item['date']); |
837 | - $output .= '"'.date("c",strtotime($spotter_item['date'])).'", '; |
|
837 | + $output .= '"'.date("c", strtotime($spotter_item['date'])).'", '; |
|
838 | 838 | $output .= $spotter_item['longitude'].', '; |
839 | 839 | $output .= $spotter_item['latitude']; |
840 | 840 | $prevlong = $spotter_item['longitude']; |
@@ -862,8 +862,8 @@ discard block |
||
862 | 862 | //$quat = quaternionrotate(deg2rad($spotter_item['heading']),deg2rad(0),deg2rad(0)); |
863 | 863 | //$orientation .= '"'.date("c",strtotime($spotter_item['date'])).'",'.$quat['x'].','.$quat['y'].','.$quat['z'].','.$quat['w']; |
864 | 864 | } else { |
865 | - $nblatlong = $nblatlong+1; |
|
866 | - $output .= ',"'.date("c",strtotime($spotter_item['date'])).'", '; |
|
865 | + $nblatlong = $nblatlong + 1; |
|
866 | + $output .= ',"'.date("c", strtotime($spotter_item['date'])).'", '; |
|
867 | 867 | if ($maxitime < strtotime($spotter_item['date'])) $maxitime = strtotime($spotter_item['date']); |
868 | 868 | if ($spotter_item['ground_speed'] == 0) { |
869 | 869 | $output .= $prevlong.', '; |
@@ -904,26 +904,26 @@ discard block |
||
904 | 904 | $output .= ']'; |
905 | 905 | if (isset($globalArchive) && $globalArchive === TRUE) { |
906 | 906 | if (isset($begindateinitial)) { |
907 | - $output = str_replace('%minitime%',date("c",$begindateinitial),$output); |
|
908 | - } elseif ((time()-$globalLiveInterval) > $minitime) { |
|
909 | - if (time()-$globalLiveInterval > $maxitime) { |
|
910 | - $output = str_replace('%minitime%',date("c",$maxitime),$output); |
|
907 | + $output = str_replace('%minitime%', date("c", $begindateinitial), $output); |
|
908 | + } elseif ((time() - $globalLiveInterval) > $minitime) { |
|
909 | + if (time() - $globalLiveInterval > $maxitime) { |
|
910 | + $output = str_replace('%minitime%', date("c", $maxitime), $output); |
|
911 | 911 | } else { |
912 | - $output = str_replace('%minitime%',date("c",time()-$globalLiveInterval),$output); |
|
912 | + $output = str_replace('%minitime%', date("c", time() - $globalLiveInterval), $output); |
|
913 | 913 | } |
914 | 914 | } |
915 | - else $output = str_replace('%minitime%',date("c",$minitime),$output); |
|
915 | + else $output = str_replace('%minitime%', date("c", $minitime), $output); |
|
916 | 916 | } elseif (isset($_COOKIE['MapTrack']) && $_COOKIE['MapTrack'] != '' && $minitracktime != $minitracktime_begin) { |
917 | - $output = str_replace('%minitime%',date("c",$minitracktime),$output); |
|
917 | + $output = str_replace('%minitime%', date("c", $minitracktime), $output); |
|
918 | 918 | } else { |
919 | - $output = str_replace('%minitime%',date("c",$minitime),$output); |
|
919 | + $output = str_replace('%minitime%', date("c", $minitime), $output); |
|
920 | 920 | } |
921 | 921 | if (isset($enddateinitial)) { |
922 | - $output = str_replace('%maxitime%',date("c",$enddateinitial),$output); |
|
922 | + $output = str_replace('%maxitime%', date("c", $enddateinitial), $output); |
|
923 | 923 | } else { |
924 | - $output = str_replace('%maxitime%',date("c",$maxitime),$output); |
|
924 | + $output = str_replace('%maxitime%', date("c", $maxitime), $output); |
|
925 | 925 | } |
926 | -if ($gltf2) $output = str_replace('%gltf2%','true',$output); |
|
927 | -else $output = str_replace('%gltf2%','false',$output); |
|
926 | +if ($gltf2) $output = str_replace('%gltf2%', 'true', $output); |
|
927 | +else $output = str_replace('%gltf2%', 'false', $output); |
|
928 | 928 | print $output; |
929 | 929 | ?> |