@@ -22,14 +22,14 @@ discard block |
||
22 | 22 | * @return String the icao |
23 | 23 | */ |
24 | 24 | public function ident2icao($ident) { |
25 | - if (substr($ident,0,2) == 'AF') { |
|
26 | - if (filter_var(substr($ident,2),FILTER_VALIDATE_INT,array("flags"=>FILTER_FLAG_ALLOW_OCTAL))) $icao = $ident; |
|
27 | - else $icao = 'AFR'.ltrim(substr($ident,2),'0'); |
|
25 | + if (substr($ident, 0, 2) == 'AF') { |
|
26 | + if (filter_var(substr($ident, 2), FILTER_VALIDATE_INT, array("flags"=>FILTER_FLAG_ALLOW_OCTAL))) $icao = $ident; |
|
27 | + else $icao = 'AFR'.ltrim(substr($ident, 2), '0'); |
|
28 | 28 | } else { |
29 | 29 | $Spotter = new Spotter($this->db); |
30 | - $identicao = $Spotter->getAllAirlineInfo(substr($ident,0,2)); |
|
30 | + $identicao = $Spotter->getAllAirlineInfo(substr($ident, 0, 2)); |
|
31 | 31 | if (isset($identicao[0])) { |
32 | - $icao = $identicao[0]['icao'].ltrim(substr($ident,2),'0'); |
|
32 | + $icao = $identicao[0]['icao'].ltrim(substr($ident, 2), '0'); |
|
33 | 33 | } else $icao = $ident; |
34 | 34 | } |
35 | 35 | return $icao; |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | |
54 | 54 | $sth = $this->db->prepare($query); |
55 | 55 | $sth->execute(); |
56 | - } catch(PDOException $e) { |
|
56 | + } catch (PDOException $e) { |
|
57 | 57 | return "error"; |
58 | 58 | } |
59 | 59 | return "success"; |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | |
78 | 78 | $sth = $this->db->prepare($query); |
79 | 79 | $sth->execute(); |
80 | - } catch(PDOException $e) { |
|
80 | + } catch (PDOException $e) { |
|
81 | 81 | return "error"; |
82 | 82 | } |
83 | 83 | return "success"; |
@@ -102,13 +102,13 @@ discard block |
||
102 | 102 | $ident = ''; |
103 | 103 | $message = ''; |
104 | 104 | $result = array(); |
105 | - $n = sscanf($data,'(null) %*d %*02d/%*02d/%*04d %*02d:%*02d:%*02d %*d %*[0-9-] %*[A-Z0-9] %7s %*c %2[0-9a-zA-Z_] %d %4[0-9A-Z] %6[0-9A-Z] %[^\r\n]',$registration,$label,$block_id,$msg_no,$ident,$message); |
|
106 | - if ($n == 0) $n = sscanf($data,'AC%*c %7s %*c %2[0-9a-zA-Z_] %d %4[0-9A-Z] %6[0-9A-Z] %[^\r\n]',$registration,$label,$block_id,$msg_no,$ident,$message); |
|
107 | - if ($n == 0) $n = sscanf($data,'%*04d-%*02d-%*02d,%*02d:%*02d:%*02d,%*7s,%*c,%6[0-9A-Z-],%*c,%2[0-9a-zA-Z_],%d,%4[0-9A-Z],%6[0-9A-Z],%[^\r\n]',$registration,$label,$block_id,$msg_no,$ident,$message); |
|
108 | - if ($n == 0) $n = sscanf($data,'%*04d-%*02d-%*02d,%*02d:%*02d:%*02d,%*7s,%*c,%5[0-9A-Z],%*c,%2[0-9a-zA-Z_],%d,%4[0-9A-Z],%6[0-9A-Z],%[^\r\n]',$registration,$label,$block_id,$msg_no,$ident,$message); |
|
105 | + $n = sscanf($data, '(null) %*d %*02d/%*02d/%*04d %*02d:%*02d:%*02d %*d %*[0-9-] %*[A-Z0-9] %7s %*c %2[0-9a-zA-Z_] %d %4[0-9A-Z] %6[0-9A-Z] %[^\r\n]', $registration, $label, $block_id, $msg_no, $ident, $message); |
|
106 | + if ($n == 0) $n = sscanf($data, 'AC%*c %7s %*c %2[0-9a-zA-Z_] %d %4[0-9A-Z] %6[0-9A-Z] %[^\r\n]', $registration, $label, $block_id, $msg_no, $ident, $message); |
|
107 | + if ($n == 0) $n = sscanf($data, '%*04d-%*02d-%*02d,%*02d:%*02d:%*02d,%*7s,%*c,%6[0-9A-Z-],%*c,%2[0-9a-zA-Z_],%d,%4[0-9A-Z],%6[0-9A-Z],%[^\r\n]', $registration, $label, $block_id, $msg_no, $ident, $message); |
|
108 | + if ($n == 0) $n = sscanf($data, '%*04d-%*02d-%*02d,%*02d:%*02d:%*02d,%*7s,%*c,%5[0-9A-Z],%*c,%2[0-9a-zA-Z_],%d,%4[0-9A-Z],%6[0-9A-Z],%[^\r\n]', $registration, $label, $block_id, $msg_no, $ident, $message); |
|
109 | 109 | if ($n != 0) { |
110 | - $registration = str_replace('.','',$registration); |
|
111 | - $result = array('registration' => $registration, 'ident' => $ident,'label' => $label, 'block_id' => $block_id,'msg_no' => $msg_no,'message' => $message); |
|
110 | + $registration = str_replace('.', '', $registration); |
|
111 | + $result = array('registration' => $registration, 'ident' => $ident, 'label' => $label, 'block_id' => $block_id, 'msg_no' => $msg_no, 'message' => $message); |
|
112 | 112 | if ($globalDebug) echo "Reg. : ".$registration." - Ident : ".$ident." - Label : ".$label." - Message : ".$message."\n"; |
113 | 113 | } else $message = $data; |
114 | 114 | $decode = array(); |
@@ -128,14 +128,14 @@ discard block |
||
128 | 128 | $temp = ''; |
129 | 129 | $n = sscanf($message, "FST01%4c%4c%c%06d%c%07d%03d%*8[0-9a-zA-Z ]-%02dC", $dair, $darr, $lac, $la, $lnc, $ln, $alt, $temp); |
130 | 130 | if ($n > 5 && ($lac == 'N' || $lac == 'S') && ($lnc == 'E' || $lnc == 'W')) { |
131 | - $latitude = $la / 10000.0; |
|
132 | - $longitude = $ln / 10000.0; |
|
131 | + $latitude = $la/10000.0; |
|
132 | + $longitude = $ln/10000.0; |
|
133 | 133 | if ($lac == 'S') $latitude = '-'.$latitude; |
134 | 134 | if ($lnc == 'W') $longitude = '-'.$longitude; |
135 | 135 | // Temp not always available |
136 | 136 | if ($globalDebug) echo 'latitude : '.$latitude.' - longitude : '.$longitude.' - airport depart : '.$dair.' - airport arrival : '.$darr.' - température : '.$temp."°C\n"; |
137 | - if ($temp == '') $decode = array('Latitude' => $latitude, 'Longitude' => $longitude, 'Departure airport' => $dair, 'Arrival airport' => $darr,'Altitude' => $alt); |
|
138 | - else $decode = array('Latitude' => $latitude, 'Longitude' => $longitude, 'Departure airport' => $dair, 'Arrival airport' => $darr, 'Altitude' => 'FL'.$alt,'Temperature' => $temp.'°C'); |
|
137 | + if ($temp == '') $decode = array('Latitude' => $latitude, 'Longitude' => $longitude, 'Departure airport' => $dair, 'Arrival airport' => $darr, 'Altitude' => $alt); |
|
138 | + else $decode = array('Latitude' => $latitude, 'Longitude' => $longitude, 'Departure airport' => $dair, 'Arrival airport' => $darr, 'Altitude' => 'FL'.$alt, 'Temperature' => $temp.'°C'); |
|
139 | 139 | |
140 | 140 | //$icao = $Translation->checkTranslation($ident); |
141 | 141 | //$Schedule->addSchedule($icao,$dair,'',$darr,'','ACARS'); |
@@ -147,19 +147,19 @@ discard block |
||
147 | 147 | $dhour = ''; |
148 | 148 | $darr = ''; |
149 | 149 | $ahour = ''; |
150 | - $n = sscanf($message, "ARR01 %4[A-Z]%4d %4[A-Z]%4d", $dair, $dhour, $darr,$ahour); |
|
150 | + $n = sscanf($message, "ARR01 %4[A-Z]%4d %4[A-Z]%4d", $dair, $dhour, $darr, $ahour); |
|
151 | 151 | if ($n == 4 && strlen($darr) == 4) { |
152 | - if ($dhour != '') $dhour = substr(sprintf('%04d',$dhour),0,2).':'.substr(sprintf('%04d',$dhour),2); |
|
153 | - if ($ahour != '') $ahour = substr(sprintf('%04d',$ahour),0,2).':'.substr(sprintf('%04d',$ahour),2); |
|
154 | - if ($globalDebug) echo 'departure airport : '.$dair.' - arrival airport : '. $darr.' - departure hour : '. $dhour.' - arrival hour : '.$ahour."\n"; |
|
152 | + if ($dhour != '') $dhour = substr(sprintf('%04d', $dhour), 0, 2).':'.substr(sprintf('%04d', $dhour), 2); |
|
153 | + if ($ahour != '') $ahour = substr(sprintf('%04d', $ahour), 0, 2).':'.substr(sprintf('%04d', $ahour), 2); |
|
154 | + if ($globalDebug) echo 'departure airport : '.$dair.' - arrival airport : '.$darr.' - departure hour : '.$dhour.' - arrival hour : '.$ahour."\n"; |
|
155 | 155 | //$icao = ACARS->ident2icao($ident); |
156 | 156 | //$icao = $Translation->checkTranslation($ident); |
157 | 157 | //$Schedule->addSchedule($icao,$dair,$dhour,$darr,$ahour,'ACARS'); |
158 | 158 | $decode = array('Departure airport' => $dair, 'Departure hour' => $dhour, 'Arrival airport' => $darr, 'Arrival hour' => $ahour); |
159 | 159 | $found = true; |
160 | 160 | } |
161 | - elseif ($n == 2 || $n == 4) { |
|
162 | - if ($dhour != '') $dhour = substr(sprintf('%04d',$dhour),0,2).':'.substr(sprintf('%04d',$dhour),2); |
|
161 | + elseif ($n == 2 || $n == 4) { |
|
162 | + if ($dhour != '') $dhour = substr(sprintf('%04d', $dhour), 0, 2).':'.substr(sprintf('%04d', $dhour), 2); |
|
163 | 163 | if ($globalDebug) echo 'airport arrival : '.$dair.' - arrival hour : '.$dhour."\n"; |
164 | 164 | //$icao = ACARS->ident2icao($ident); |
165 | 165 | //$icao = $Translation->checkTranslation($ident); |
@@ -217,11 +217,11 @@ discard block |
||
217 | 217 | $ahour = ''; |
218 | 218 | $aair = ''; |
219 | 219 | $apiste = ''; |
220 | - $n = sscanf(str_replace(array("\r\n", "\n", "\r"),'',$message), "%*[0-9A-Z]/%*3d/%4s/%*cSCH/%6[0-9A-Z ]/%4c/%4c/%5s/%4d%*3c/%4d/%4c/%[0-9A-Z ]/", $airicao,$aident,$dair, $darr, $ddate, $dhour,$ahour, $aair, $apiste); |
|
220 | + $n = sscanf(str_replace(array("\r\n", "\n", "\r"), '', $message), "%*[0-9A-Z]/%*3d/%4s/%*cSCH/%6[0-9A-Z ]/%4c/%4c/%5s/%4d%*3c/%4d/%4c/%[0-9A-Z ]/", $airicao, $aident, $dair, $darr, $ddate, $dhour, $ahour, $aair, $apiste); |
|
221 | 221 | if ($n > 8) { |
222 | - if ($globalDebug) echo 'airicao : '. $airicao.' - ident : '.$aident.' - departure airport : '.$dair.' - arrival airport : '. $darr.' - date depart : '.$ddate.' - departure hour : '. $dhour.' - arrival hour : '.$ahour.' - arrival airport : '.$aair.' - arrival piste : '.$apiste."\n"; |
|
223 | - if ($dhour != '') $dhour = substr(sprintf('%04d',$dhour),0,2).':'.substr(sprintf('%04d',$dhour),2); |
|
224 | - if ($ahour != '') $ahour = substr(sprintf('%04d',$ahour),0,2).':'.substr(sprintf('%04d',$ahour),2); |
|
222 | + if ($globalDebug) echo 'airicao : '.$airicao.' - ident : '.$aident.' - departure airport : '.$dair.' - arrival airport : '.$darr.' - date depart : '.$ddate.' - departure hour : '.$dhour.' - arrival hour : '.$ahour.' - arrival airport : '.$aair.' - arrival piste : '.$apiste."\n"; |
|
223 | + if ($dhour != '') $dhour = substr(sprintf('%04d', $dhour), 0, 2).':'.substr(sprintf('%04d', $dhour), 2); |
|
224 | + if ($ahour != '') $ahour = substr(sprintf('%04d', $ahour), 0, 2).':'.substr(sprintf('%04d', $ahour), 2); |
|
225 | 225 | $icao = trim($aident); |
226 | 226 | |
227 | 227 | //$decode = 'Departure airport : '.$dair.' ('.$ddate.' at '.$dhour.') - Arrival Airport : '.$aair.' (at '.$ahour.') way '.$apiste; |
@@ -246,8 +246,8 @@ discard block |
||
246 | 246 | if ($n == 10 && ($lac == 'N' || $lac == 'S') && ($lnc == 'E' || $lnc == 'W')) { |
247 | 247 | $las = $las.'.'.$lass; |
248 | 248 | $lns = $lns.'.'.$lns; |
249 | - $latitude = $las / 1000.0; |
|
250 | - $longitude = $lns / 1000.0; |
|
249 | + $latitude = $las/1000.0; |
|
250 | + $longitude = $lns/1000.0; |
|
251 | 251 | if ($lac == 'S') $latitude = '-'.$latitude; |
252 | 252 | if ($lnc == 'W') $longitude = '-'.$longitude; |
253 | 253 | if ($globalDebug) echo 'latitude : '.$latitude.' - longitude : '.$longitude."\n"; |
@@ -342,17 +342,17 @@ discard block |
||
342 | 342 | $alt = ''; |
343 | 343 | $fuel = ''; |
344 | 344 | $speed = ''; |
345 | - $n = sscanf(str_replace(array("\r\n", "\n", "\r"),'',$message), "#DFB(POS-%s -%4d%c%5d%c/%*d F%dRMK/FUEL %f M%f", $aident, $las, $lac, $lns, $lnc, $alt, $fuel, $speed); |
|
345 | + $n = sscanf(str_replace(array("\r\n", "\n", "\r"), '', $message), "#DFB(POS-%s -%4d%c%5d%c/%*d F%dRMK/FUEL %f M%f", $aident, $las, $lac, $lns, $lnc, $alt, $fuel, $speed); |
|
346 | 346 | if ($n == 9) { |
347 | 347 | //if (self->$debug) echo 'airport depart : '.$dair.' - airport arrival : '.$darr."\n"; |
348 | 348 | $icao = trim($aident); |
349 | 349 | $decode['icao'] = $icao; |
350 | - $latitude = $las / 100.0; |
|
351 | - $longitude = $lns / 100.0; |
|
350 | + $latitude = $las/100.0; |
|
351 | + $longitude = $lns/100.0; |
|
352 | 352 | if ($lac == 'S') $latitude = '-'.$latitude; |
353 | 353 | if ($lnc == 'W') $longitude = '-'.$longitude; |
354 | 354 | |
355 | - $decode = array('Latitude' => $latitude,'Longitude' => $longitude,'Altitude' => 'FL'.$alt,'Fuel' => $fuel,'speed' => $speed); |
|
355 | + $decode = array('Latitude' => $latitude, 'Longitude' => $longitude, 'Altitude' => 'FL'.$alt, 'Fuel' => $fuel, 'speed' => $speed); |
|
356 | 356 | $found = true; |
357 | 357 | } |
358 | 358 | } |
@@ -371,7 +371,7 @@ discard block |
||
371 | 371 | if ($lac == 'S') $latitude = '-'.$latitude; |
372 | 372 | if ($lnc == 'W') $longitude = '-'.$longitude; |
373 | 373 | |
374 | - $decode = array('Latitude' => $latitude,'Longitude' => $longitude); |
|
374 | + $decode = array('Latitude' => $latitude, 'Longitude' => $longitude); |
|
375 | 375 | $found = true; |
376 | 376 | } |
377 | 377 | } |
@@ -404,7 +404,7 @@ discard block |
||
404 | 404 | $dair = ''; |
405 | 405 | $darr = ''; |
406 | 406 | $aident = ''; |
407 | - $n = sscanf(str_replace(array("\r\n", "\n", "\r"),'',$message), "%*[0-9A-Z],,%*[0-9A-Z],%*[0-9A-Z],%4s,%4s,.%*6s,%*4[A-Z],%[0-9A-Z],", $dair, $darr, $aident); |
|
407 | + $n = sscanf(str_replace(array("\r\n", "\n", "\r"), '', $message), "%*[0-9A-Z],,%*[0-9A-Z],%*[0-9A-Z],%4s,%4s,.%*6s,%*4[A-Z],%[0-9A-Z],", $dair, $darr, $aident); |
|
408 | 408 | if ($n == 8) { |
409 | 409 | if ($globalDebug) echo 'airport depart : '.$dair.' - airport arrival : '.$darr."\n"; |
410 | 410 | $icao = trim($aident); |
@@ -436,7 +436,7 @@ discard block |
||
436 | 436 | */ |
437 | 437 | $dair = ''; |
438 | 438 | $darr = ''; |
439 | - $n = sscanf($message,'%4[A-Z]%4[A-Z]%*4d',$dair,$darr); |
|
439 | + $n = sscanf($message, '%4[A-Z]%4[A-Z]%*4d', $dair, $darr); |
|
440 | 440 | if ($n == 3) { |
441 | 441 | if ($globalDebug) echo 'airport depart : '.$dair.' - airport arrival : '.$darr."\n"; |
442 | 442 | //$icao = $Translation->checkTranslation($ident); |
@@ -451,7 +451,7 @@ discard block |
||
451 | 451 | */ |
452 | 452 | $dair = ''; |
453 | 453 | $darr = ''; |
454 | - $n = sscanf($message,'3J01 DSPTCH %*d/%*d %4s/%4s .%*6s',$dair,$darr); |
|
454 | + $n = sscanf($message, '3J01 DSPTCH %*d/%*d %4s/%4s .%*6s', $dair, $darr); |
|
455 | 455 | if ($n == 3) { |
456 | 456 | if ($globalDebug) echo 'airport depart : '.$dair.' - airport arrival : '.$darr."\n"; |
457 | 457 | //$icao = $Translation->checkTranslation($ident); |
@@ -461,7 +461,7 @@ discard block |
||
461 | 461 | } |
462 | 462 | } |
463 | 463 | if (!$found) { |
464 | - $n = sscanf($message,'MET01%4c',$airport); |
|
464 | + $n = sscanf($message, 'MET01%4c', $airport); |
|
465 | 465 | if ($n == 1) { |
466 | 466 | if ($globalDebug) echo 'airport name : '.$airport; |
467 | 467 | $decode = array('Airport/Waypoint name' => $airport); |
@@ -469,241 +469,241 @@ discard block |
||
469 | 469 | } |
470 | 470 | } |
471 | 471 | if ($label == 'H1') { |
472 | - if (preg_match('/^#CFBFLR/',$message) || preg_match('/^#CFBWRN/',$message)) { |
|
473 | - $decode = array_merge(array('Message nature' => 'Equipment failure'),$decode); |
|
472 | + if (preg_match('/^#CFBFLR/', $message) || preg_match('/^#CFBWRN/', $message)) { |
|
473 | + $decode = array_merge(array('Message nature' => 'Equipment failure'), $decode); |
|
474 | 474 | } |
475 | - elseif (preg_match('/^#DFB\*TKO/',$message) || preg_match('/^#DFBTKO/',$message)) { |
|
476 | - $decode = array_merge(array('Message nature' => 'Take off performance data'),$decode); |
|
475 | + elseif (preg_match('/^#DFB\*TKO/', $message) || preg_match('/^#DFBTKO/', $message)) { |
|
476 | + $decode = array_merge(array('Message nature' => 'Take off performance data'), $decode); |
|
477 | 477 | } |
478 | - elseif (preg_match('/^#DFB\*CRZ/',$message) || preg_match('/^#DFBCRZ/',$message)) { |
|
479 | - $decode = array_merge(array('Message nature' => 'Cruise performance data'),$decode); |
|
478 | + elseif (preg_match('/^#DFB\*CRZ/', $message) || preg_match('/^#DFBCRZ/', $message)) { |
|
479 | + $decode = array_merge(array('Message nature' => 'Cruise performance data'), $decode); |
|
480 | 480 | } |
481 | - elseif (preg_match('/^#DFB\*WOB/',$message) || preg_match('/^#DFBWOB/',$message)) { |
|
482 | - $decode = array_merge(array('Message nature' => 'Weather observation'),$decode); |
|
481 | + elseif (preg_match('/^#DFB\*WOB/', $message) || preg_match('/^#DFBWOB/', $message)) { |
|
482 | + $decode = array_merge(array('Message nature' => 'Weather observation'), $decode); |
|
483 | 483 | } |
484 | - elseif (preg_match(':^#DFB/PIREP:',$message)) { |
|
485 | - $decode = array_merge(array('Message nature' => 'Pilot Report'),$decode); |
|
484 | + elseif (preg_match(':^#DFB/PIREP:', $message)) { |
|
485 | + $decode = array_merge(array('Message nature' => 'Pilot Report'), $decode); |
|
486 | 486 | } |
487 | - elseif (preg_match('/^#DFBEDA/',$message) || preg_match('/^#DFBENG/',$message)) { |
|
488 | - $decode = array_merge(array('Message nature' => 'Engine Data'),$decode); |
|
487 | + elseif (preg_match('/^#DFBEDA/', $message) || preg_match('/^#DFBENG/', $message)) { |
|
488 | + $decode = array_merge(array('Message nature' => 'Engine Data'), $decode); |
|
489 | 489 | } |
490 | - elseif (preg_match(':^#M1AAEP:',$message)) { |
|
491 | - $decode = array_merge(array('Message nature' => 'Position/Weather Report'),$decode); |
|
490 | + elseif (preg_match(':^#M1AAEP:', $message)) { |
|
491 | + $decode = array_merge(array('Message nature' => 'Position/Weather Report'), $decode); |
|
492 | 492 | } |
493 | - elseif (preg_match(':^#M2APWD:',$message)) { |
|
494 | - $decode = array_merge(array('Message nature' => 'Flight plan predicted wind data'),$decode); |
|
493 | + elseif (preg_match(':^#M2APWD:', $message)) { |
|
494 | + $decode = array_merge(array('Message nature' => 'Flight plan predicted wind data'), $decode); |
|
495 | 495 | } |
496 | - elseif (preg_match(':^#M1BREQPWI:',$message)) { |
|
497 | - $decode = array_merge(array('Message nature' => 'Predicted wind info request'),$decode); |
|
496 | + elseif (preg_match(':^#M1BREQPWI:', $message)) { |
|
497 | + $decode = array_merge(array('Message nature' => 'Predicted wind info request'), $decode); |
|
498 | 498 | } |
499 | - elseif (preg_match(':^#CF:',$message)) { |
|
500 | - $decode = array_merge(array('Message nature' => 'Central Fault Display'),$decode); |
|
499 | + elseif (preg_match(':^#CF:', $message)) { |
|
500 | + $decode = array_merge(array('Message nature' => 'Central Fault Display'), $decode); |
|
501 | 501 | } |
502 | - elseif (preg_match(':^#DF:',$message)) { |
|
503 | - $decode = array_merge(array('Message nature' => 'Digital Flight Data Acquisition Unit'),$decode); |
|
502 | + elseif (preg_match(':^#DF:', $message)) { |
|
503 | + $decode = array_merge(array('Message nature' => 'Digital Flight Data Acquisition Unit'), $decode); |
|
504 | 504 | } |
505 | - elseif (preg_match(':^#EC:',$message)) { |
|
506 | - $decode = array_merge(array('Message nature' => 'Engine Display System'),$decode); |
|
505 | + elseif (preg_match(':^#EC:', $message)) { |
|
506 | + $decode = array_merge(array('Message nature' => 'Engine Display System'), $decode); |
|
507 | 507 | } |
508 | - elseif (preg_match(':^#EI:',$message)) { |
|
509 | - $decode = array_merge(array('Message nature' => 'Engine Report'),$decode); |
|
508 | + elseif (preg_match(':^#EI:', $message)) { |
|
509 | + $decode = array_merge(array('Message nature' => 'Engine Report'), $decode); |
|
510 | 510 | } |
511 | - elseif (preg_match(':^#H1:',$message)) { |
|
512 | - $decode = array_merge(array('Message nature' => 'HF Data Radio - Left'),$decode); |
|
511 | + elseif (preg_match(':^#H1:', $message)) { |
|
512 | + $decode = array_merge(array('Message nature' => 'HF Data Radio - Left'), $decode); |
|
513 | 513 | } |
514 | - elseif (preg_match(':^#H2:',$message)) { |
|
515 | - $decode = array_merge(array('Message nature' => 'HF Data Radio - Right'),$decode); |
|
514 | + elseif (preg_match(':^#H2:', $message)) { |
|
515 | + $decode = array_merge(array('Message nature' => 'HF Data Radio - Right'), $decode); |
|
516 | 516 | } |
517 | - elseif (preg_match(':^#HD:',$message)) { |
|
518 | - $decode = array_merge(array('Message nature' => 'HF Data Radio - Selected'),$decode); |
|
517 | + elseif (preg_match(':^#HD:', $message)) { |
|
518 | + $decode = array_merge(array('Message nature' => 'HF Data Radio - Selected'), $decode); |
|
519 | 519 | } |
520 | - elseif (preg_match(':^#M1:',$message)) { |
|
521 | - $decode = array_merge(array('Message nature' => 'Flight Management Computer - Left'),$decode); |
|
520 | + elseif (preg_match(':^#M1:', $message)) { |
|
521 | + $decode = array_merge(array('Message nature' => 'Flight Management Computer - Left'), $decode); |
|
522 | 522 | } |
523 | - elseif (preg_match(':^#M2:',$message)) { |
|
524 | - $decode = array_merge(array('Message nature' => 'Flight Management Computer - Right'),$decode); |
|
523 | + elseif (preg_match(':^#M2:', $message)) { |
|
524 | + $decode = array_merge(array('Message nature' => 'Flight Management Computer - Right'), $decode); |
|
525 | 525 | } |
526 | - elseif (preg_match(':^#M3:',$message)) { |
|
527 | - $decode = array_merge(array('Message nature' => 'Flight Management Computer - Center'),$decode); |
|
526 | + elseif (preg_match(':^#M3:', $message)) { |
|
527 | + $decode = array_merge(array('Message nature' => 'Flight Management Computer - Center'), $decode); |
|
528 | 528 | } |
529 | - elseif (preg_match(':^#MD:',$message)) { |
|
530 | - $decode = array_merge(array('Message nature' => 'Flight Management Computer - Selected'),$decode); |
|
529 | + elseif (preg_match(':^#MD:', $message)) { |
|
530 | + $decode = array_merge(array('Message nature' => 'Flight Management Computer - Selected'), $decode); |
|
531 | 531 | } |
532 | - elseif (preg_match(':^#PS:',$message)) { |
|
533 | - $decode = array_merge(array('Message nature' => 'Keyboard/Display Unit'),$decode); |
|
532 | + elseif (preg_match(':^#PS:', $message)) { |
|
533 | + $decode = array_merge(array('Message nature' => 'Keyboard/Display Unit'), $decode); |
|
534 | 534 | } |
535 | - elseif (preg_match(':^#S1:',$message)) { |
|
536 | - $decode = array_merge(array('Message nature' => 'SDU - Left'),$decode); |
|
535 | + elseif (preg_match(':^#S1:', $message)) { |
|
536 | + $decode = array_merge(array('Message nature' => 'SDU - Left'), $decode); |
|
537 | 537 | } |
538 | - elseif (preg_match(':^#S2:',$message)) { |
|
539 | - $decode = array_merge(array('Message nature' => 'SDU - Right'),$decode); |
|
538 | + elseif (preg_match(':^#S2:', $message)) { |
|
539 | + $decode = array_merge(array('Message nature' => 'SDU - Right'), $decode); |
|
540 | 540 | } |
541 | - elseif (preg_match(':^#SD:',$message)) { |
|
542 | - $decode = array_merge(array('Message nature' => 'SDU - Selected'),$decode); |
|
541 | + elseif (preg_match(':^#SD:', $message)) { |
|
542 | + $decode = array_merge(array('Message nature' => 'SDU - Selected'), $decode); |
|
543 | 543 | } |
544 | - elseif (preg_match(':^#T[0-8]:',$message)) { |
|
545 | - $decode = array_merge(array('Message nature' => 'Cabin Terminal Messages'),$decode); |
|
544 | + elseif (preg_match(':^#T[0-8]:', $message)) { |
|
545 | + $decode = array_merge(array('Message nature' => 'Cabin Terminal Messages'), $decode); |
|
546 | 546 | } |
547 | - elseif (preg_match(':^#WO:',$message)) { |
|
548 | - $decode = array_merge(array('Message nature' => 'Weather Observation Report'),$decode); |
|
547 | + elseif (preg_match(':^#WO:', $message)) { |
|
548 | + $decode = array_merge(array('Message nature' => 'Weather Observation Report'), $decode); |
|
549 | 549 | } |
550 | - elseif (preg_match(':^#A1:',$message)) { |
|
551 | - $decode = array_merge(array('Message nature' => 'Oceanic Clearance'),$decode); |
|
550 | + elseif (preg_match(':^#A1:', $message)) { |
|
551 | + $decode = array_merge(array('Message nature' => 'Oceanic Clearance'), $decode); |
|
552 | 552 | } |
553 | - elseif (preg_match(':^#A3:',$message)) { |
|
554 | - $decode = array_merge(array('Message nature' => 'Departure Clearance Response'),$decode); |
|
553 | + elseif (preg_match(':^#A3:', $message)) { |
|
554 | + $decode = array_merge(array('Message nature' => 'Departure Clearance Response'), $decode); |
|
555 | 555 | } |
556 | - elseif (preg_match(':^#A4:',$message)) { |
|
557 | - $decode = array_merge(array('Message nature' => 'Flight Systems Message'),$decode); |
|
556 | + elseif (preg_match(':^#A4:', $message)) { |
|
557 | + $decode = array_merge(array('Message nature' => 'Flight Systems Message'), $decode); |
|
558 | 558 | } |
559 | - elseif (preg_match(':^#A6:',$message)) { |
|
560 | - $decode = array_merge(array('Message nature' => 'Request ADS Reports'),$decode); |
|
559 | + elseif (preg_match(':^#A6:', $message)) { |
|
560 | + $decode = array_merge(array('Message nature' => 'Request ADS Reports'), $decode); |
|
561 | 561 | } |
562 | - elseif (preg_match(':^#A8:',$message)) { |
|
563 | - $decode = array_merge(array('Message nature' => 'Deliver Departure Slot'),$decode); |
|
562 | + elseif (preg_match(':^#A8:', $message)) { |
|
563 | + $decode = array_merge(array('Message nature' => 'Deliver Departure Slot'), $decode); |
|
564 | 564 | } |
565 | - elseif (preg_match(':^#A9:',$message)) { |
|
566 | - $decode = array_merge(array('Message nature' => 'ATIS report'),$decode); |
|
565 | + elseif (preg_match(':^#A9:', $message)) { |
|
566 | + $decode = array_merge(array('Message nature' => 'ATIS report'), $decode); |
|
567 | 567 | } |
568 | - elseif (preg_match(':^#A0:',$message)) { |
|
569 | - $decode = array_merge(array('Message nature' => 'ATIS Facility Notification (AFN)'),$decode); |
|
568 | + elseif (preg_match(':^#A0:', $message)) { |
|
569 | + $decode = array_merge(array('Message nature' => 'ATIS Facility Notification (AFN)'), $decode); |
|
570 | 570 | } |
571 | - elseif (preg_match(':^#AA:',$message)) { |
|
572 | - $decode = array_merge(array('Message nature' => 'ATCComm'),$decode); |
|
571 | + elseif (preg_match(':^#AA:', $message)) { |
|
572 | + $decode = array_merge(array('Message nature' => 'ATCComm'), $decode); |
|
573 | 573 | } |
574 | - elseif (preg_match(':^#AB:',$message)) { |
|
575 | - $decode = array_merge(array('Message nature' => 'TWIP Report'),$decode); |
|
574 | + elseif (preg_match(':^#AB:', $message)) { |
|
575 | + $decode = array_merge(array('Message nature' => 'TWIP Report'), $decode); |
|
576 | 576 | } |
577 | - elseif (preg_match(':^#AC:',$message)) { |
|
578 | - $decode = array_merge(array('Message nature' => 'Pushback Clearance'),$decode); |
|
577 | + elseif (preg_match(':^#AC:', $message)) { |
|
578 | + $decode = array_merge(array('Message nature' => 'Pushback Clearance'), $decode); |
|
579 | 579 | } |
580 | - elseif (preg_match(':^#AD:',$message)) { |
|
581 | - $decode = array_merge(array('Message nature' => 'Expected Taxi Clearance'),$decode); |
|
580 | + elseif (preg_match(':^#AD:', $message)) { |
|
581 | + $decode = array_merge(array('Message nature' => 'Expected Taxi Clearance'), $decode); |
|
582 | 582 | } |
583 | - elseif (preg_match(':^#AF:',$message)) { |
|
584 | - $decode = array_merge(array('Message nature' => 'CPC Command/Response'),$decode); |
|
583 | + elseif (preg_match(':^#AF:', $message)) { |
|
584 | + $decode = array_merge(array('Message nature' => 'CPC Command/Response'), $decode); |
|
585 | 585 | } |
586 | - elseif (preg_match(':^#B1:',$message)) { |
|
587 | - $decode = array_merge(array('Message nature' => 'Request Oceanic Clearance'),$decode); |
|
586 | + elseif (preg_match(':^#B1:', $message)) { |
|
587 | + $decode = array_merge(array('Message nature' => 'Request Oceanic Clearance'), $decode); |
|
588 | 588 | } |
589 | - elseif (preg_match(':^#B2:',$message)) { |
|
590 | - $decode = array_merge(array('Message nature' => 'Oceanic Clearance Readback'),$decode); |
|
589 | + elseif (preg_match(':^#B2:', $message)) { |
|
590 | + $decode = array_merge(array('Message nature' => 'Oceanic Clearance Readback'), $decode); |
|
591 | 591 | } |
592 | - elseif (preg_match(':^#B3:',$message)) { |
|
593 | - $decode = array_merge(array('Message nature' => 'Request Departure Clearance'),$decode); |
|
592 | + elseif (preg_match(':^#B3:', $message)) { |
|
593 | + $decode = array_merge(array('Message nature' => 'Request Departure Clearance'), $decode); |
|
594 | 594 | } |
595 | - elseif (preg_match(':^#B4:',$message)) { |
|
596 | - $decode = array_merge(array('Message nature' => 'Departure Clearance Readback'),$decode); |
|
595 | + elseif (preg_match(':^#B4:', $message)) { |
|
596 | + $decode = array_merge(array('Message nature' => 'Departure Clearance Readback'), $decode); |
|
597 | 597 | } |
598 | - elseif (preg_match(':^#B6:',$message)) { |
|
599 | - $decode = array_merge(array('Message nature' => 'Provide ADS Report'),$decode); |
|
598 | + elseif (preg_match(':^#B6:', $message)) { |
|
599 | + $decode = array_merge(array('Message nature' => 'Provide ADS Report'), $decode); |
|
600 | 600 | } |
601 | - elseif (preg_match(':^#B8:',$message)) { |
|
602 | - $decode = array_merge(array('Message nature' => 'Request Departure Slot'),$decode); |
|
601 | + elseif (preg_match(':^#B8:', $message)) { |
|
602 | + $decode = array_merge(array('Message nature' => 'Request Departure Slot'), $decode); |
|
603 | 603 | } |
604 | - elseif (preg_match(':^#B9:',$message)) { |
|
605 | - $decode = array_merge(array('Message nature' => 'Request ATIS Report'),$decode); |
|
604 | + elseif (preg_match(':^#B9:', $message)) { |
|
605 | + $decode = array_merge(array('Message nature' => 'Request ATIS Report'), $decode); |
|
606 | 606 | } |
607 | - elseif (preg_match(':^#B0:',$message)) { |
|
608 | - $decode = array_merge(array('Message nature' => 'ATS Facility Notification'),$decode); |
|
607 | + elseif (preg_match(':^#B0:', $message)) { |
|
608 | + $decode = array_merge(array('Message nature' => 'ATS Facility Notification'), $decode); |
|
609 | 609 | } |
610 | - elseif (preg_match(':^#BA:',$message)) { |
|
611 | - $decode = array_merge(array('Message nature' => 'ATCComm'),$decode); |
|
610 | + elseif (preg_match(':^#BA:', $message)) { |
|
611 | + $decode = array_merge(array('Message nature' => 'ATCComm'), $decode); |
|
612 | 612 | } |
613 | - elseif (preg_match(':^#BB:',$message)) { |
|
614 | - $decode = array_merge(array('Message nature' => 'Request TWIP Report'),$decode); |
|
613 | + elseif (preg_match(':^#BB:', $message)) { |
|
614 | + $decode = array_merge(array('Message nature' => 'Request TWIP Report'), $decode); |
|
615 | 615 | } |
616 | - elseif (preg_match(':^#BC:',$message)) { |
|
617 | - $decode = array_merge(array('Message nature' => 'Pushback Clearance Request'),$decode); |
|
616 | + elseif (preg_match(':^#BC:', $message)) { |
|
617 | + $decode = array_merge(array('Message nature' => 'Pushback Clearance Request'), $decode); |
|
618 | 618 | } |
619 | - elseif (preg_match(':^#BD:',$message)) { |
|
620 | - $decode = array_merge(array('Message nature' => 'Expected Taxi Clearance Request'),$decode); |
|
619 | + elseif (preg_match(':^#BD:', $message)) { |
|
620 | + $decode = array_merge(array('Message nature' => 'Expected Taxi Clearance Request'), $decode); |
|
621 | 621 | } |
622 | - elseif (preg_match(':^#BE:',$message)) { |
|
623 | - $decode = array_merge(array('Message nature' => 'CPC Aircraft Log-On/Off Request'),$decode); |
|
622 | + elseif (preg_match(':^#BE:', $message)) { |
|
623 | + $decode = array_merge(array('Message nature' => 'CPC Aircraft Log-On/Off Request'), $decode); |
|
624 | 624 | } |
625 | - elseif (preg_match(':^#BF:',$message)) { |
|
626 | - $decode = array_merge(array('Message nature' => 'CPC WILCO/UNABLE Response'),$decode); |
|
625 | + elseif (preg_match(':^#BF:', $message)) { |
|
626 | + $decode = array_merge(array('Message nature' => 'CPC WILCO/UNABLE Response'), $decode); |
|
627 | 627 | } |
628 | - elseif (preg_match(':^#H3:',$message)) { |
|
629 | - $decode = array_merge(array('Message nature' => 'Icing Report'),$decode); |
|
628 | + elseif (preg_match(':^#H3:', $message)) { |
|
629 | + $decode = array_merge(array('Message nature' => 'Icing Report'), $decode); |
|
630 | 630 | } |
631 | 631 | } |
632 | 632 | if ($label == '10') { |
633 | - if (preg_match(':^DTO01:',$message)) { |
|
634 | - $decode = array_merge(array('Message nature' => 'Delayed Takeoff Report'),$decode); |
|
633 | + if (preg_match(':^DTO01:', $message)) { |
|
634 | + $decode = array_merge(array('Message nature' => 'Delayed Takeoff Report'), $decode); |
|
635 | 635 | } |
636 | - elseif (preg_match(':^AIS01:',$message)) { |
|
637 | - $decode = array_merge(array('Message nature' => 'AIS Request'),$decode); |
|
636 | + elseif (preg_match(':^AIS01:', $message)) { |
|
637 | + $decode = array_merge(array('Message nature' => 'AIS Request'), $decode); |
|
638 | 638 | } |
639 | - elseif (preg_match(':^FTX01:',$message)) { |
|
640 | - $decode = array_merge(array('Message nature' => 'Free Text Downlink'),$decode); |
|
639 | + elseif (preg_match(':^FTX01:', $message)) { |
|
640 | + $decode = array_merge(array('Message nature' => 'Free Text Downlink'), $decode); |
|
641 | 641 | } |
642 | - elseif (preg_match(':^FPL01:',$message)) { |
|
643 | - $decode = array_merge(array('Message nature' => 'Flight Plan Request'),$decode); |
|
642 | + elseif (preg_match(':^FPL01:', $message)) { |
|
643 | + $decode = array_merge(array('Message nature' => 'Flight Plan Request'), $decode); |
|
644 | 644 | } |
645 | - elseif (preg_match(':^WAB01:',$message)) { |
|
646 | - $decode = array_merge(array('Message nature' => 'Weight & Balance Request'),$decode); |
|
645 | + elseif (preg_match(':^WAB01:', $message)) { |
|
646 | + $decode = array_merge(array('Message nature' => 'Weight & Balance Request'), $decode); |
|
647 | 647 | } |
648 | - elseif (preg_match(':^MET01:',$message)) { |
|
649 | - $decode = array_merge(array('Message nature' => 'Weather Data Request'),$decode); |
|
648 | + elseif (preg_match(':^MET01:', $message)) { |
|
649 | + $decode = array_merge(array('Message nature' => 'Weather Data Request'), $decode); |
|
650 | 650 | } |
651 | - elseif (preg_match(':^WAB02:',$message)) { |
|
652 | - $decode = array_merge(array('Message nature' => 'Weight and Balance Acknowledgement'),$decode); |
|
651 | + elseif (preg_match(':^WAB02:', $message)) { |
|
652 | + $decode = array_merge(array('Message nature' => 'Weight and Balance Acknowledgement'), $decode); |
|
653 | 653 | } |
654 | 654 | } |
655 | 655 | if ($label == '15') { |
656 | - if (preg_match(':^FST01:',$message)) { |
|
657 | - $decode = array_merge(array('Message nature' => 'Flight Status Report'),$decode); |
|
656 | + if (preg_match(':^FST01:', $message)) { |
|
657 | + $decode = array_merge(array('Message nature' => 'Flight Status Report'), $decode); |
|
658 | 658 | } |
659 | 659 | } |
660 | 660 | if (!$found && $label == 'SA') { |
661 | - $n = sscanf($message, "%d%c%c%6[0-9]", $version,$state,$type,$at); |
|
661 | + $n = sscanf($message, "%d%c%c%6[0-9]", $version, $state, $type, $at); |
|
662 | 662 | if ($n == 4) { |
663 | 663 | $vsta = array('Version' => $version); |
664 | 664 | if ($state == 'E') { |
665 | - $vsta = array_merge($vsta,array('Link state' => 'Established')); |
|
665 | + $vsta = array_merge($vsta, array('Link state' => 'Established')); |
|
666 | 666 | } |
667 | 667 | elseif ($state == 'L') { |
668 | - $vsta = array_merge($vsta,array('Link state' => 'Lost')); |
|
668 | + $vsta = array_merge($vsta, array('Link state' => 'Lost')); |
|
669 | 669 | } |
670 | 670 | else { |
671 | - $vsta = array_merge($vsta,array('Link state' => 'Unknown')); |
|
671 | + $vsta = array_merge($vsta, array('Link state' => 'Unknown')); |
|
672 | 672 | } |
673 | 673 | if ($type == 'V') { |
674 | - $vsta = array_merge($vsta,array('Link type' => 'VHF ACARS')); |
|
674 | + $vsta = array_merge($vsta, array('Link type' => 'VHF ACARS')); |
|
675 | 675 | } |
676 | 676 | elseif ($type == 'S') { |
677 | - $vsta = array_merge($vsta,array('Link type' => 'Generic SATCOM')); |
|
677 | + $vsta = array_merge($vsta, array('Link type' => 'Generic SATCOM')); |
|
678 | 678 | } |
679 | 679 | elseif ($type == 'H') { |
680 | - $vsta = array_merge($vsta,array('Link type' => 'HF')); |
|
680 | + $vsta = array_merge($vsta, array('Link type' => 'HF')); |
|
681 | 681 | } |
682 | 682 | elseif ($type == 'G') { |
683 | - $vsta = array_merge($vsta,array('Link type' => 'GlobalStar SATCOM')); |
|
683 | + $vsta = array_merge($vsta, array('Link type' => 'GlobalStar SATCOM')); |
|
684 | 684 | } |
685 | 685 | elseif ($type == 'C') { |
686 | - $vsta = array_merge($vsta,array('Link type' => 'ICO SATCOM')); |
|
686 | + $vsta = array_merge($vsta, array('Link type' => 'ICO SATCOM')); |
|
687 | 687 | } |
688 | 688 | elseif ($type == '2') { |
689 | - $vsta = array_merge($vsta,array('Link type' => 'VDL Mode 2')); |
|
689 | + $vsta = array_merge($vsta, array('Link type' => 'VDL Mode 2')); |
|
690 | 690 | } |
691 | 691 | elseif ($type == 'X') { |
692 | - $vsta = array_merge($vsta,array('Link type' => 'Inmarsat Aero')); |
|
692 | + $vsta = array_merge($vsta, array('Link type' => 'Inmarsat Aero')); |
|
693 | 693 | } |
694 | 694 | elseif ($type == 'I') { |
695 | - $vsta = array_merge($vsta,array('Link type' => 'Irridium SATCOM')); |
|
695 | + $vsta = array_merge($vsta, array('Link type' => 'Irridium SATCOM')); |
|
696 | 696 | } |
697 | 697 | else { |
698 | - $vsta = array_merge($vsta,array('Link type' => 'Unknown')); |
|
698 | + $vsta = array_merge($vsta, array('Link type' => 'Unknown')); |
|
699 | 699 | } |
700 | - $vsta = array_merge($vsta,array('Event occured at' => implode(':',str_split($at,2)))); |
|
701 | - $decode = array_merge($vsta,$decode); |
|
700 | + $vsta = array_merge($vsta, array('Event occured at' => implode(':', str_split($at, 2)))); |
|
701 | + $decode = array_merge($vsta, $decode); |
|
702 | 702 | } |
703 | 703 | } |
704 | 704 | |
705 | 705 | $title = $this->getTitlefromLabel($label); |
706 | - if ($title != '') $decode = array_merge(array('Message title' => $title),$decode); |
|
706 | + if ($title != '') $decode = array_merge(array('Message title' => $title), $decode); |
|
707 | 707 | /* |
708 | 708 | // Business jets always use GS0001 |
709 | 709 | if ($ident != 'GS0001') $info = $this->addModeSData($ident,$registration,$icao,$airicao,$latitude,$longitude); |
@@ -731,13 +731,13 @@ discard block |
||
731 | 731 | $Translation = new Translation($this->db); |
732 | 732 | $message = $this->parse($data); |
733 | 733 | if (isset($message['registration']) && $message['registration'] != '' && $message['ident'] != '' && $message['registration'] != '!') { |
734 | - $ident = (string)$message['ident']; |
|
734 | + $ident = (string) $message['ident']; |
|
735 | 735 | $label = $message['label']; |
736 | 736 | $block_id = $message['block_id']; |
737 | 737 | $msg_no = $message['msg_no']; |
738 | 738 | $msg = $message['message']; |
739 | 739 | $decode = $message['decode']; |
740 | - $registration = (string)$message['registration']; |
|
740 | + $registration = (string) $message['registration']; |
|
741 | 741 | if (isset($decode['latitude'])) $latitude = $decode['latitude']; |
742 | 742 | else $latitude = ''; |
743 | 743 | if (isset($decode['longitude'])) $longitude = $decode['longitude']; |
@@ -751,20 +751,20 @@ discard block |
||
751 | 751 | $Image->addSpotterImage($registration); |
752 | 752 | } |
753 | 753 | // Business jets always use GS0001 |
754 | - if ($ident != 'GS0001') $info = $this->addModeSData($ident,$registration,$icao,$airicao,$latitude,$longitude); |
|
754 | + if ($ident != 'GS0001') $info = $this->addModeSData($ident, $registration, $icao, $airicao, $latitude, $longitude); |
|
755 | 755 | if ($globalDebug && isset($info) && $info != '') echo $info; |
756 | 756 | if (count($decode) > 0) $decode_json = json_encode($decode); |
757 | 757 | else $decode_json = ''; |
758 | 758 | if (isset($decode['Departure airport']) && isset($decode['Departure hour']) && isset($decode['Arrival airport']) && isset($decode['Arrival hour'])) { |
759 | - $Schedule->addSchedule($icao,$decode['Departure airport'],$decode['Departure hour'],$decode['Arrival airport'],$decode['Arrival hour'],'ACARS'); |
|
759 | + $Schedule->addSchedule($icao, $decode['Departure airport'], $decode['Departure hour'], $decode['Arrival airport'], $decode['Arrival hour'], 'ACARS'); |
|
760 | 760 | } elseif (isset($decode['Departure airport']) && isset($decode['Arrival airport'])) { |
761 | - $Schedule->addSchedule($icao,$decode['Departure airport'],'',$decode['Arrival airport'],'','ACARS'); |
|
761 | + $Schedule->addSchedule($icao, $decode['Departure airport'], '', $decode['Arrival airport'], '', 'ACARS'); |
|
762 | 762 | } |
763 | - $result = $this->addLiveAcarsData($ident,$registration,$label,$block_id,$msg_no,$msg,$decode_json); |
|
764 | - if (!isset($globalACARSArchive)) $globalACARSArchive = array('10','80','81','82','3F'); |
|
765 | - if ($result && in_array($label,$globalACARSArchive)) $this->addArchiveAcarsData($ident,$registration,$label,$block_id,$msg_no,$msg,$decode_json); |
|
763 | + $result = $this->addLiveAcarsData($ident, $registration, $label, $block_id, $msg_no, $msg, $decode_json); |
|
764 | + if (!isset($globalACARSArchive)) $globalACARSArchive = array('10', '80', '81', '82', '3F'); |
|
765 | + if ($result && in_array($label, $globalACARSArchive)) $this->addArchiveAcarsData($ident, $registration, $label, $block_id, $msg_no, $msg, $decode_json); |
|
766 | 766 | if ($globalDebug && count($decode) > 0) { |
767 | - echo "Human readable data : ".implode(' - ',$decode)."\n"; |
|
767 | + echo "Human readable data : ".implode(' - ', $decode)."\n"; |
|
768 | 768 | } |
769 | 769 | } |
770 | 770 | } |
@@ -779,7 +779,7 @@ discard block |
||
779 | 779 | * @param String $msg_no Number of the ACARS message |
780 | 780 | * @param String $message ACARS message |
781 | 781 | */ |
782 | - public function addLiveAcarsData($ident,$registration,$label,$block_id,$msg_no,$message,$decode = '') { |
|
782 | + public function addLiveAcarsData($ident, $registration, $label, $block_id, $msg_no, $message, $decode = '') { |
|
783 | 783 | global $globalDebug; |
784 | 784 | date_default_timezone_set('UTC'); |
785 | 785 | if ($label != 'SQ' && $label != 'Q0' && $label != '_d' && $message != '') { |
@@ -787,21 +787,21 @@ discard block |
||
787 | 787 | $this->db = $Connection->db; |
788 | 788 | if ($globalDebug) echo "Test if not already in Live ACARS table..."; |
789 | 789 | $query_test = "SELECT COUNT(*) as nb FROM acars_live WHERE ident = :ident AND registration = :registration AND message = :message"; |
790 | - $query_test_values = array(':ident' => $ident,':registration' => $registration, ':message' => $message); |
|
790 | + $query_test_values = array(':ident' => $ident, ':registration' => $registration, ':message' => $message); |
|
791 | 791 | try { |
792 | 792 | $stht = $this->db->prepare($query_test); |
793 | 793 | $stht->execute($query_test_values); |
794 | - } catch(PDOException $e) { |
|
794 | + } catch (PDOException $e) { |
|
795 | 795 | return "error : ".$e->getMessage(); |
796 | 796 | } |
797 | 797 | if ($stht->fetchColumn() == 0) { |
798 | 798 | if ($globalDebug) echo "Add Live ACARS data..."; |
799 | 799 | $query = "INSERT INTO acars_live (ident,registration,label,block_id,msg_no,message,decode,date) VALUES (:ident,:registration,:label,:block_id,:msg_no,:message,:decode,:date)"; |
800 | - $query_values = array(':ident' => $ident,':registration' => $registration, ':label' => $label,':block_id' => $block_id, ':msg_no' => $msg_no, ':message' => $message, ':decode' => $decode,':date' => date("Y-m-d H:i:s")); |
|
800 | + $query_values = array(':ident' => $ident, ':registration' => $registration, ':label' => $label, ':block_id' => $block_id, ':msg_no' => $msg_no, ':message' => $message, ':decode' => $decode, ':date' => date("Y-m-d H:i:s")); |
|
801 | 801 | try { |
802 | 802 | $sth = $this->db->prepare($query); |
803 | 803 | $sth->execute($query_values); |
804 | - } catch(PDOException $e) { |
|
804 | + } catch (PDOException $e) { |
|
805 | 805 | return "error : ".$e->getMessage(); |
806 | 806 | } |
807 | 807 | } else { |
@@ -823,10 +823,10 @@ discard block |
||
823 | 823 | * @param String $msg_no Number of the ACARS message |
824 | 824 | * @param String $message ACARS message |
825 | 825 | */ |
826 | - public function addArchiveAcarsData($ident,$registration,$label,$block_id,$msg_no,$message,$decode = '') { |
|
826 | + public function addArchiveAcarsData($ident, $registration, $label, $block_id, $msg_no, $message, $decode = '') { |
|
827 | 827 | global $globalDebug; |
828 | 828 | date_default_timezone_set('UTC'); |
829 | - if ($label != 'SQ' && $label != 'Q0' && $label != '_d' && $message != '' && preg_match('/^MET0/',$message) === 0 && preg_match('/^ARR0/',$message) === 0 && preg_match('/^ETA/',$message) === 0 && preg_match('/^WXR/',$message) === 0 && preg_match('/^FTX01.FIC/',$message) === 0) { |
|
829 | + if ($label != 'SQ' && $label != 'Q0' && $label != '_d' && $message != '' && preg_match('/^MET0/', $message) === 0 && preg_match('/^ARR0/', $message) === 0 && preg_match('/^ETA/', $message) === 0 && preg_match('/^WXR/', $message) === 0 && preg_match('/^FTX01.FIC/', $message) === 0) { |
|
830 | 830 | /* |
831 | 831 | if ($globalDebug) echo "Test if not already in Archive ACARS table..."; |
832 | 832 | $query_test = "SELECT COUNT(*) as nb FROM acars_archive WHERE ident = :ident AND registration = :registration AND message = :message"; |
@@ -841,11 +841,11 @@ discard block |
||
841 | 841 | */ |
842 | 842 | if ($globalDebug) echo "Add Live ACARS data..."; |
843 | 843 | $query = "INSERT INTO acars_archive (ident,registration,label,block_id,msg_no,message,decode) VALUES (:ident,:registration,:label,:block_id,:msg_no,:message,:decode)"; |
844 | - $query_values = array(':ident' => $ident,':registration' => $registration, ':label' => $label,':block_id' => $block_id, ':msg_no' => $msg_no, ':message' => $message, ':decode' => $decode); |
|
844 | + $query_values = array(':ident' => $ident, ':registration' => $registration, ':label' => $label, ':block_id' => $block_id, ':msg_no' => $msg_no, ':message' => $message, ':decode' => $decode); |
|
845 | 845 | try { |
846 | 846 | $sth = $this->db->prepare($query); |
847 | 847 | $sth->execute($query_values); |
848 | - } catch(PDOException $e) { |
|
848 | + } catch (PDOException $e) { |
|
849 | 849 | return "error : ".$e->getMessage(); |
850 | 850 | } |
851 | 851 | if ($globalDebug) echo "Done\n"; |
@@ -866,7 +866,7 @@ discard block |
||
866 | 866 | try { |
867 | 867 | $sth = $this->db->prepare($query); |
868 | 868 | $sth->execute($query_values); |
869 | - } catch(PDOException $e) { |
|
869 | + } catch (PDOException $e) { |
|
870 | 870 | echo "error : ".$e->getMessage(); |
871 | 871 | die; |
872 | 872 | } |
@@ -886,7 +886,7 @@ discard block |
||
886 | 886 | try { |
887 | 887 | $sth = $this->db->prepare($query); |
888 | 888 | $sth->execute($query_values); |
889 | - } catch(PDOException $e) { |
|
889 | + } catch (PDOException $e) { |
|
890 | 890 | echo "error : ".$e->getMessage(); |
891 | 891 | die; |
892 | 892 | } |
@@ -907,7 +907,7 @@ discard block |
||
907 | 907 | try { |
908 | 908 | $sth = $this->db->prepare($query); |
909 | 909 | $sth->execute($query_values); |
910 | - } catch(PDOException $e) { |
|
910 | + } catch (PDOException $e) { |
|
911 | 911 | echo "error : ".$e->getMessage(); |
912 | 912 | die; |
913 | 913 | } |
@@ -921,7 +921,7 @@ discard block |
||
921 | 921 | * |
922 | 922 | * @return Array Return ACARS data in array |
923 | 923 | */ |
924 | - public function getLatestAcarsData($limit = '',$label = '') { |
|
924 | + public function getLatestAcarsData($limit = '', $label = '') { |
|
925 | 925 | global $globalURL, $globalDBdriver; |
926 | 926 | $Image = new Image($this->db); |
927 | 927 | $Spotter = new Spotter($this->db); |
@@ -932,8 +932,8 @@ discard block |
||
932 | 932 | if ($limit != "") |
933 | 933 | { |
934 | 934 | $limit_array = explode(",", $limit); |
935 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
936 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
935 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
936 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
937 | 937 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
938 | 938 | { |
939 | 939 | $limit_query = " LIMIT ".$limit_array[1]." OFFSET ".$limit_array[0]; |
@@ -949,46 +949,46 @@ discard block |
||
949 | 949 | try { |
950 | 950 | $sth = $this->db->prepare($query); |
951 | 951 | $sth->execute($query_values); |
952 | - } catch(PDOException $e) { |
|
952 | + } catch (PDOException $e) { |
|
953 | 953 | return "error : ".$e->getMessage(); |
954 | 954 | } |
955 | 955 | $i = 0; |
956 | 956 | while ($row = $sth->fetch(PDO::FETCH_ASSOC)) { |
957 | 957 | $data = array(); |
958 | 958 | if ($row['registration'] != '') { |
959 | - $row['registration'] = str_replace('.','',$row['registration']); |
|
959 | + $row['registration'] = str_replace('.', '', $row['registration']); |
|
960 | 960 | $image_array = $Image->getSpotterImage($row['registration']); |
961 | - 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'])); |
|
962 | - else $data = array_merge($data,array('image' => '','image_thumbnail' => '','image_copyright' => '','image_source' => '','image_source_website' => '')); |
|
963 | - } else $data = array_merge($data,array('image' => '','image_thumbnail' => '','image_copyright' => '','image_source' => '','image_source_website' => '')); |
|
961 | + 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'])); |
|
962 | + else $data = array_merge($data, array('image' => '', 'image_thumbnail' => '', 'image_copyright' => '', 'image_source' => '', 'image_source_website' => '')); |
|
963 | + } else $data = array_merge($data, array('image' => '', 'image_thumbnail' => '', 'image_copyright' => '', 'image_source' => '', 'image_source_website' => '')); |
|
964 | 964 | if ($row['registration'] == '') $row['registration'] = 'NA'; |
965 | 965 | if ($row['ident'] == '') $row['ident'] = 'NA'; |
966 | - $identicao = $Spotter->getAllAirlineInfo(substr($row['ident'],0,2)); |
|
966 | + $identicao = $Spotter->getAllAirlineInfo(substr($row['ident'], 0, 2)); |
|
967 | 967 | if (isset($identicao[0])) { |
968 | - if (substr($row['ident'],0,2) == 'AF') { |
|
969 | - if (filter_var(substr($row['ident'],2),FILTER_VALIDATE_INT,array("flags"=>FILTER_FLAG_ALLOW_OCTAL))) $icao = $row['ident']; |
|
970 | - else $icao = 'AFR'.ltrim(substr($row['ident'],2),'0'); |
|
971 | - } else $icao = $identicao[0]['icao'].ltrim(substr($row['ident'],2),'0'); |
|
972 | - $data = array_merge($data,array('airline_icao' => $identicao[0]['icao'],'airline_name' => $identicao[0]['name'])); |
|
968 | + if (substr($row['ident'], 0, 2) == 'AF') { |
|
969 | + if (filter_var(substr($row['ident'], 2), FILTER_VALIDATE_INT, array("flags"=>FILTER_FLAG_ALLOW_OCTAL))) $icao = $row['ident']; |
|
970 | + else $icao = 'AFR'.ltrim(substr($row['ident'], 2), '0'); |
|
971 | + } else $icao = $identicao[0]['icao'].ltrim(substr($row['ident'], 2), '0'); |
|
972 | + $data = array_merge($data, array('airline_icao' => $identicao[0]['icao'], 'airline_name' => $identicao[0]['name'])); |
|
973 | 973 | } else $icao = $row['ident']; |
974 | - $icao = $Translation->checkTranslation($icao,false); |
|
975 | - $decode = json_decode($row['decode'],true); |
|
974 | + $icao = $Translation->checkTranslation($icao, false); |
|
975 | + $decode = json_decode($row['decode'], true); |
|
976 | 976 | $found = false; |
977 | - if ($decode != '' && array_key_exists('Departure airport',$decode)) { |
|
977 | + if ($decode != '' && array_key_exists('Departure airport', $decode)) { |
|
978 | 978 | $airport_info = $Spotter->getAllAirportInfo($decode['Departure airport']); |
979 | 979 | if (isset($airport_info[0]['icao'])) { |
980 | 980 | $decode['Departure airport'] = '<a href="'.$globalURL.'/airport/'.$airport_info[0]['icao'].'">'.$airport_info[0]['city'].','.$airport_info[0]['country'].' ('.$airport_info[0]['icao'].')</a>'; |
981 | 981 | $found = true; |
982 | 982 | } |
983 | 983 | } |
984 | - if ($decode != '' && array_key_exists('Arrival airport',$decode)) { |
|
984 | + if ($decode != '' && array_key_exists('Arrival airport', $decode)) { |
|
985 | 985 | $airport_info = $Spotter->getAllAirportInfo($decode['Arrival airport']); |
986 | 986 | if (isset($airport_info[0]['icao'])) { |
987 | 987 | $decode['Arrival airport'] = '<a href="'.$globalURL.'/airport/'.$airport_info[0]['icao'].'">'.$airport_info[0]['city'].','.$airport_info[0]['country'].' ('.$airport_info[0]['icao'].')</a>'; |
988 | 988 | $found = true; |
989 | 989 | } |
990 | 990 | } |
991 | - if ($decode != '' && array_key_exists('Airport/Waypoint name',$decode)) { |
|
991 | + if ($decode != '' && array_key_exists('Airport/Waypoint name', $decode)) { |
|
992 | 992 | $airport_info = $Spotter->getAllAirportInfo($decode['Airport/Waypoint name']); |
993 | 993 | if (isset($airport_info[0]['icao'])) { |
994 | 994 | $decode['Airport/Waypoint name'] = '<a href="'.$globalURL.'/airport/'.$airport_info[0]['icao'].'">'.$airport_info[0]['city'].','.$airport_info[0]['country'].' ('.$airport_info[0]['icao'].')</a>'; |
@@ -996,7 +996,7 @@ discard block |
||
996 | 996 | } |
997 | 997 | } |
998 | 998 | if ($found) $row['decode'] = json_encode($decode); |
999 | - $data = array_merge($data,array('registration' => $row['registration'],'message' => $row['message'], 'date' => $row['date'], 'ident' => $icao, 'decode' => $row['decode'])); |
|
999 | + $data = array_merge($data, array('registration' => $row['registration'], 'message' => $row['message'], 'date' => $row['date'], 'ident' => $icao, 'decode' => $row['decode'])); |
|
1000 | 1000 | $result[] = $data; |
1001 | 1001 | $i++; |
1002 | 1002 | } |
@@ -1012,7 +1012,7 @@ discard block |
||
1012 | 1012 | * |
1013 | 1013 | * @return Array Return ACARS data in array |
1014 | 1014 | */ |
1015 | - public function getArchiveAcarsData($limit = '',$label = '') { |
|
1015 | + public function getArchiveAcarsData($limit = '', $label = '') { |
|
1016 | 1016 | global $globalURL, $globalDBdriver; |
1017 | 1017 | $Image = new Image($this->db); |
1018 | 1018 | $Spotter = new Spotter($this->db); |
@@ -1022,8 +1022,8 @@ discard block |
||
1022 | 1022 | if ($limit != "") |
1023 | 1023 | { |
1024 | 1024 | $limit_array = explode(",", $limit); |
1025 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
1026 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
1025 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
1026 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
1027 | 1027 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
1028 | 1028 | { |
1029 | 1029 | $limit_query = " LIMIT ".$limit_array[1]." OFFSET ".$limit_array[0]; |
@@ -1044,43 +1044,43 @@ discard block |
||
1044 | 1044 | try { |
1045 | 1045 | $sth = $this->db->prepare($query); |
1046 | 1046 | $sth->execute($query_values); |
1047 | - } catch(PDOException $e) { |
|
1047 | + } catch (PDOException $e) { |
|
1048 | 1048 | return "error : ".$e->getMessage(); |
1049 | 1049 | } |
1050 | - $i=0; |
|
1050 | + $i = 0; |
|
1051 | 1051 | while ($row = $sth->fetch(PDO::FETCH_ASSOC)) { |
1052 | 1052 | $data = array(); |
1053 | 1053 | if ($row['registration'] != '') { |
1054 | - $row['registration'] = str_replace('.','',$row['registration']); |
|
1054 | + $row['registration'] = str_replace('.', '', $row['registration']); |
|
1055 | 1055 | $image_array = $Image->getSpotterImage($row['registration']); |
1056 | - if (count($image_array) > 0) $data = array_merge($data,array('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'])); |
|
1057 | - else $data = array_merge($data,array('image_thumbnail' => '','image_copyright' => '','image_source' => '','image_source_website' => '')); |
|
1058 | - } else $data = array_merge($data,array('image_thumbnail' => '','image_copyright' => '','image_source' => '','image_source_website' => '')); |
|
1056 | + if (count($image_array) > 0) $data = array_merge($data, array('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'])); |
|
1057 | + else $data = array_merge($data, array('image_thumbnail' => '', 'image_copyright' => '', 'image_source' => '', 'image_source_website' => '')); |
|
1058 | + } else $data = array_merge($data, array('image_thumbnail' => '', 'image_copyright' => '', 'image_source' => '', 'image_source_website' => '')); |
|
1059 | 1059 | $icao = ''; |
1060 | 1060 | if ($row['registration'] == '') $row['registration'] = 'NA'; |
1061 | 1061 | if ($row['ident'] == '') $row['ident'] = 'NA'; |
1062 | - $identicao = $Spotter->getAllAirlineInfo(substr($row['ident'],0,2)); |
|
1062 | + $identicao = $Spotter->getAllAirlineInfo(substr($row['ident'], 0, 2)); |
|
1063 | 1063 | if (isset($identicao[0])) { |
1064 | - if (substr($row['ident'],0,2) == 'AF') { |
|
1065 | - if (filter_var(substr($row['ident'],2),FILTER_VALIDATE_INT,array("flags"=>FILTER_FLAG_ALLOW_OCTAL))) $icao = $row['ident']; |
|
1066 | - else $icao = 'AFR'.ltrim(substr($row['ident'],2),'0'); |
|
1067 | - } else $icao = $identicao[0]['icao'].ltrim(substr($row['ident'],2),'0'); |
|
1068 | - $data = array_merge($data,array('airline_icao' => $identicao[0]['icao'],'airline_name' => $identicao[0]['name'])); |
|
1064 | + if (substr($row['ident'], 0, 2) == 'AF') { |
|
1065 | + if (filter_var(substr($row['ident'], 2), FILTER_VALIDATE_INT, array("flags"=>FILTER_FLAG_ALLOW_OCTAL))) $icao = $row['ident']; |
|
1066 | + else $icao = 'AFR'.ltrim(substr($row['ident'], 2), '0'); |
|
1067 | + } else $icao = $identicao[0]['icao'].ltrim(substr($row['ident'], 2), '0'); |
|
1068 | + $data = array_merge($data, array('airline_icao' => $identicao[0]['icao'], 'airline_name' => $identicao[0]['name'])); |
|
1069 | 1069 | } else $icao = $row['ident']; |
1070 | 1070 | $icao = $Translation->checkTranslation($icao); |
1071 | - $decode = json_decode($row['decode'],true); |
|
1071 | + $decode = json_decode($row['decode'], true); |
|
1072 | 1072 | $found = false; |
1073 | - if ($decode != '' && array_key_exists('Departure airport',$decode)) { |
|
1073 | + if ($decode != '' && array_key_exists('Departure airport', $decode)) { |
|
1074 | 1074 | $airport_info = $Spotter->getAllAirportInfo($decode['Departure airport']); |
1075 | 1075 | if (isset($airport_info[0]['icao'])) $decode['Departure airport'] = '<a href="'.$globalURL.'/airport/'.$airport_info[0]['icao'].'">'.$airport_info[0]['city'].','.$airport_info[0]['country'].' ('.$airport_info[0]['icao'].')</a>'; |
1076 | 1076 | $found = true; |
1077 | 1077 | } |
1078 | - if ($decode != '' && array_key_exists('Arrival airport',$decode)) { |
|
1078 | + if ($decode != '' && array_key_exists('Arrival airport', $decode)) { |
|
1079 | 1079 | $airport_info = $Spotter->getAllAirportInfo($decode['Arrival airport']); |
1080 | 1080 | if (isset($airport_info[0]['icao'])) $decode['Arrival airport'] = '<a href="'.$globalURL.'/airport/'.$airport_info[0]['icao'].'">'.$airport_info[0]['city'].','.$airport_info[0]['country'].' ('.$airport_info[0]['icao'].')</a>'; |
1081 | 1081 | $found = true; |
1082 | 1082 | } |
1083 | - if ($decode != '' && array_key_exists('Airport/Waypoint name',$decode)) { |
|
1083 | + if ($decode != '' && array_key_exists('Airport/Waypoint name', $decode)) { |
|
1084 | 1084 | $airport_info = $Spotter->getAllAirportInfo($decode['Airport/Waypoint name']); |
1085 | 1085 | if (isset($airport_info[0]['icao'])) { |
1086 | 1086 | $decode['Airport/Waypoint name'] = '<a href="'.$globalURL.'/airport/'.$airport_info[0]['icao'].'">'.$airport_info[0]['city'].','.$airport_info[0]['country'].' ('.$airport_info[0]['icao'].')</a>'; |
@@ -1088,7 +1088,7 @@ discard block |
||
1088 | 1088 | } |
1089 | 1089 | } |
1090 | 1090 | if ($found) $row['decode'] = json_encode($decode); |
1091 | - $data = array_merge($data,array('registration' => $row['registration'],'message' => $row['message'], 'date' => $row['date'], 'ident' => $icao, 'decode' => $row['decode'])); |
|
1091 | + $data = array_merge($data, array('registration' => $row['registration'], 'message' => $row['message'], 'date' => $row['date'], 'ident' => $icao, 'decode' => $row['decode'])); |
|
1092 | 1092 | $result[] = $data; |
1093 | 1093 | $i++; |
1094 | 1094 | } |
@@ -1106,7 +1106,7 @@ discard block |
||
1106 | 1106 | * @param String $icao |
1107 | 1107 | * @param String $ICAOTypeCode |
1108 | 1108 | */ |
1109 | - public function addModeSData($ident,$registration,$icao = '',$ICAOTypeCode = '',$latitude = '', $longitude = '') { |
|
1109 | + public function addModeSData($ident, $registration, $icao = '', $ICAOTypeCode = '', $latitude = '', $longitude = '') { |
|
1110 | 1110 | global $globalDebug, $globalDBdriver; |
1111 | 1111 | $ident = trim($ident); |
1112 | 1112 | $Translation = new Translation($this->db); |
@@ -1119,7 +1119,7 @@ discard block |
||
1119 | 1119 | if ($globalDebug) echo "Ident or registration null, exit\n"; |
1120 | 1120 | return ''; |
1121 | 1121 | } |
1122 | - $registration = str_replace('.','',$registration); |
|
1122 | + $registration = str_replace('.', '', $registration); |
|
1123 | 1123 | $ident = $Translation->ident2icao($ident); |
1124 | 1124 | // Check if a flight with same registration is flying now, if ok check if callsign = name in ACARS, else add it to translation |
1125 | 1125 | if ($globalDebug) echo "Check if needed to add translation ".$ident.'... '; |
@@ -1128,7 +1128,7 @@ discard block |
||
1128 | 1128 | try { |
1129 | 1129 | $sthsi = $this->db->prepare($querysi); |
1130 | 1130 | $sthsi->execute($querysi_values); |
1131 | - } catch(PDOException $e) { |
|
1131 | + } catch (PDOException $e) { |
|
1132 | 1132 | if ($globalDebug) echo $e->getMessage(); |
1133 | 1133 | return "error : ".$e->getMessage(); |
1134 | 1134 | } |
@@ -1138,8 +1138,8 @@ discard block |
||
1138 | 1138 | $Translation = new Translation($this->db); |
1139 | 1139 | $trans_ident = $Translation->getOperator($resultsi['ident']); |
1140 | 1140 | if ($globalDebug) echo 'Add translation to table : '.$ident.' -> '.$resultsi['ident'].' '; |
1141 | - if ($ident != $trans_ident) $Translation->addOperator($resultsi['ident'],$ident,'ACARS'); |
|
1142 | - elseif ($trans_ident == $ident) $Translation->updateOperator($resultsi['ident'],$ident,'ACARS'); |
|
1141 | + if ($ident != $trans_ident) $Translation->addOperator($resultsi['ident'], $ident, 'ACARS'); |
|
1142 | + elseif ($trans_ident == $ident) $Translation->updateOperator($resultsi['ident'], $ident, 'ACARS'); |
|
1143 | 1143 | } else { |
1144 | 1144 | if ($registration != '' && $latitude != '' && $longitude != '') { |
1145 | 1145 | $query = "SELECT ModeS FROM aircraft_modes WHERE Registration = :registration LIMIT 1"; |
@@ -1147,7 +1147,7 @@ discard block |
||
1147 | 1147 | try { |
1148 | 1148 | $sth = $this->db->prepare($query); |
1149 | 1149 | $sth->execute($query_values); |
1150 | - } catch(PDOException $e) { |
|
1150 | + } catch (PDOException $e) { |
|
1151 | 1151 | if ($globalDebug) echo $e->getMessage(); |
1152 | 1152 | return "error : ".$e->getMessage(); |
1153 | 1153 | } |
@@ -1155,7 +1155,7 @@ discard block |
||
1155 | 1155 | $sth->closeCursor(); |
1156 | 1156 | if (isset($result['modes'])) $hex = $result['modes']; |
1157 | 1157 | else $hex = ''; |
1158 | - $SI_data = array('hex' => $hex,'ident' => $ident,'aircraft_icao' => $ICAOTypeCode,'registration' => $registration,'latitude' => $latitude,'$longitude' => $longitude,'format_source' => 'ACARS'); |
|
1158 | + $SI_data = array('hex' => $hex, 'ident' => $ident, 'aircraft_icao' => $ICAOTypeCode, 'registration' => $registration, 'latitude' => $latitude, '$longitude' => $longitude, 'format_source' => 'ACARS'); |
|
1159 | 1159 | $this->SI->add($SI_data); |
1160 | 1160 | } |
1161 | 1161 | } |
@@ -1165,7 +1165,7 @@ discard block |
||
1165 | 1165 | try { |
1166 | 1166 | $sth = $this->db->prepare($query); |
1167 | 1167 | $sth->execute($query_values); |
1168 | - } catch(PDOException $e) { |
|
1168 | + } catch (PDOException $e) { |
|
1169 | 1169 | if ($globalDebug) echo $e->getMessage(); |
1170 | 1170 | return "error : ".$e->getMessage(); |
1171 | 1171 | } |
@@ -1175,7 +1175,7 @@ discard block |
||
1175 | 1175 | if (isset($result['ModeS'])) $ModeS = $result['ModeS']; |
1176 | 1176 | else $ModeS = ''; |
1177 | 1177 | if ($ModeS == '') { |
1178 | - $id = explode('-',$result['flightaware_id']); |
|
1178 | + $id = explode('-', $result['flightaware_id']); |
|
1179 | 1179 | $ModeS = $id[0]; |
1180 | 1180 | } |
1181 | 1181 | if ($ModeS != '') { |
@@ -1185,20 +1185,20 @@ discard block |
||
1185 | 1185 | try { |
1186 | 1186 | $sthc = $this->db->prepare($queryc); |
1187 | 1187 | $sthc->execute($queryc_values); |
1188 | - } catch(PDOException $e) { |
|
1188 | + } catch (PDOException $e) { |
|
1189 | 1189 | if ($globalDebug) echo $e->getMessage(); |
1190 | 1190 | return "error : ".$e->getMessage(); |
1191 | 1191 | } |
1192 | 1192 | $row = $sthc->fetch(PDO::FETCH_ASSOC); |
1193 | 1193 | $sthc->closeCursor(); |
1194 | - if (count($row) == 0) { |
|
1194 | + if (count($row) == 0) { |
|
1195 | 1195 | if ($globalDebug) echo " Add to ModeS table - "; |
1196 | 1196 | $queryi = "INSERT INTO aircraft_modes (ModeS,ModeSCountry,Registration,ICAOTypeCode,Source) VALUES (:ModeS,:ModeSCountry,:Registration, :ICAOTypeCode,'ACARS')"; |
1197 | - $queryi_values = array(':ModeS' => $ModeS,':ModeSCountry' => $country,':Registration' => $registration, ':ICAOTypeCode' => $ICAOTypeCode); |
|
1197 | + $queryi_values = array(':ModeS' => $ModeS, ':ModeSCountry' => $country, ':Registration' => $registration, ':ICAOTypeCode' => $ICAOTypeCode); |
|
1198 | 1198 | try { |
1199 | 1199 | $sthi = $this->db->prepare($queryi); |
1200 | 1200 | $sthi->execute($queryi_values); |
1201 | - } catch(PDOException $e) { |
|
1201 | + } catch (PDOException $e) { |
|
1202 | 1202 | if ($globalDebug) echo $e->getMessage(); |
1203 | 1203 | return "error : ".$e->getMessage(); |
1204 | 1204 | } |
@@ -1206,15 +1206,15 @@ discard block |
||
1206 | 1206 | if ($globalDebug) echo " Update ModeS table - "; |
1207 | 1207 | if ($ICAOTypeCode != '') { |
1208 | 1208 | $queryi = "UPDATE aircraft_modes SET ModeSCountry = :ModeSCountry,Registration = :Registration,ICAOTypeCode = :ICAOTypeCode,Source = 'ACARS',LastModified = NOW() WHERE ModeS = :ModeS"; |
1209 | - $queryi_values = array(':ModeS' => $ModeS,':ModeSCountry' => $country,':Registration' => $registration, ':ICAOTypeCode' => $ICAOTypeCode); |
|
1209 | + $queryi_values = array(':ModeS' => $ModeS, ':ModeSCountry' => $country, ':Registration' => $registration, ':ICAOTypeCode' => $ICAOTypeCode); |
|
1210 | 1210 | } else { |
1211 | 1211 | $queryi = "UPDATE aircraft_modes SET ModeSCountry = :ModeSCountry,Registration = :Registration,Source = 'ACARS',LastModified = NOW() WHERE ModeS = :ModeS"; |
1212 | - $queryi_values = array(':ModeS' => $ModeS,':ModeSCountry' => $country,':Registration' => $registration); |
|
1212 | + $queryi_values = array(':ModeS' => $ModeS, ':ModeSCountry' => $country, ':Registration' => $registration); |
|
1213 | 1213 | } |
1214 | 1214 | try { |
1215 | 1215 | $sthi = $this->db->prepare($queryi); |
1216 | 1216 | $sthi->execute($queryi_values); |
1217 | - } catch(PDOException $e) { |
|
1217 | + } catch (PDOException $e) { |
|
1218 | 1218 | if ($globalDebug) echo $e->getMessage(); |
1219 | 1219 | return "error : ".$e->getMessage(); |
1220 | 1220 | } |
@@ -1251,12 +1251,12 @@ discard block |
||
1251 | 1251 | elseif ($globalDBdriver == 'pgsql') { |
1252 | 1252 | $queryi = "UPDATE spotter_output SET registration = :Registration WHERE ident = :ident AND date >= NOW() AT TIME ZONE 'UTC' - INTERVAL '1 HOUR'"; |
1253 | 1253 | } |
1254 | - $queryi_values = array(':Registration' => $registration,':ident' => $icao); |
|
1254 | + $queryi_values = array(':Registration' => $registration, ':ident' => $icao); |
|
1255 | 1255 | } |
1256 | 1256 | try { |
1257 | 1257 | $sthi = $this->db->prepare($queryi); |
1258 | 1258 | $sthi->execute($queryi_values); |
1259 | - } catch(PDOException $e) { |
|
1259 | + } catch (PDOException $e) { |
|
1260 | 1260 | if ($globalDebug) echo $e->getMessage(); |
1261 | 1261 | return "error : ".$e->getMessage(); |
1262 | 1262 | } |
@@ -14,22 +14,22 @@ discard block |
||
14 | 14 | * @param Array $filter the filter |
15 | 15 | * @return Array the SQL part |
16 | 16 | */ |
17 | - public function getFilter($filter = array(),$where = false,$and = false) { |
|
17 | + public function getFilter($filter = array(), $where = false, $and = false) { |
|
18 | 18 | global $globalFilter, $globalStatsFilters, $globalFilterName; |
19 | 19 | if (is_array($globalStatsFilters) && isset($globalStatsFilters[$globalFilterName])) { |
20 | 20 | if (isset($globalStatsFilters[$globalFilterName][0]['source'])) { |
21 | - foreach($globalStatsFilters[$globalFilterName] as $source) { |
|
21 | + foreach ($globalStatsFilters[$globalFilterName] as $source) { |
|
22 | 22 | if (isset($source['source'])) $filter['source'][] = $source['source']; |
23 | 23 | } |
24 | 24 | } else { |
25 | 25 | $filter = $globalStatsFilters[$globalFilterName]; |
26 | 26 | } |
27 | 27 | } |
28 | - if (is_array($globalFilter)) $filter = array_merge($filter,$globalFilter); |
|
28 | + if (is_array($globalFilter)) $filter = array_merge($filter, $globalFilter); |
|
29 | 29 | $filter_query_join = ''; |
30 | 30 | $filter_query_where = ''; |
31 | 31 | if (isset($filter['source']) && !empty($filter['source'])) { |
32 | - $filter_query_where = " WHERE format_source IN ('".implode("','",$filter['source'])."')"; |
|
32 | + $filter_query_where = " WHERE format_source IN ('".implode("','", $filter['source'])."')"; |
|
33 | 33 | } |
34 | 34 | if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE'; |
35 | 35 | elseif ($filter_query_where != '' && $and) $filter_query_where .= ' AND'; |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | try { |
45 | 45 | $sth = $this->db->prepare($query); |
46 | 46 | $sth->execute($query_values); |
47 | - } catch(PDOException $e) { |
|
47 | + } catch (PDOException $e) { |
|
48 | 48 | return "error : ".$e->getMessage(); |
49 | 49 | } |
50 | 50 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -52,66 +52,66 @@ discard block |
||
52 | 52 | } |
53 | 53 | |
54 | 54 | public function getById($id) { |
55 | - $filter_query = $this->getFilter(array(),true); |
|
55 | + $filter_query = $this->getFilter(array(), true); |
|
56 | 56 | $query = "SELECT * FROM atc".$filter_query." atc_id = :id"; |
57 | 57 | $query_values = array(':id' => $id); |
58 | 58 | try { |
59 | 59 | $sth = $this->db->prepare($query); |
60 | 60 | $sth->execute($query_values); |
61 | - } catch(PDOException $e) { |
|
61 | + } catch (PDOException $e) { |
|
62 | 62 | return "error : ".$e->getMessage(); |
63 | 63 | } |
64 | 64 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
65 | 65 | return $all; |
66 | 66 | } |
67 | 67 | |
68 | - public function getByIdent($ident,$format_source = '') { |
|
69 | - $filter_query = $this->getFilter(array(),true); |
|
68 | + public function getByIdent($ident, $format_source = '') { |
|
69 | + $filter_query = $this->getFilter(array(), true); |
|
70 | 70 | if ($format_source == '') { |
71 | 71 | $query = "SELECT * FROM atc".$filter_query." ident = :ident"; |
72 | 72 | $query_values = array(':ident' => $ident); |
73 | 73 | } else { |
74 | 74 | $query = "SELECT * FROM atc".$filter_query." ident = :ident AND format_source = :format_source"; |
75 | - $query_values = array(':ident' => $ident,':format_source' => $format_source); |
|
75 | + $query_values = array(':ident' => $ident, ':format_source' => $format_source); |
|
76 | 76 | } |
77 | 77 | try { |
78 | 78 | $sth = $this->db->prepare($query); |
79 | 79 | $sth->execute($query_values); |
80 | - } catch(PDOException $e) { |
|
80 | + } catch (PDOException $e) { |
|
81 | 81 | return "error : ".$e->getMessage(); |
82 | 82 | } |
83 | 83 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
84 | 84 | return $all; |
85 | 85 | } |
86 | 86 | |
87 | - public function add($ident,$frequency,$latitude,$longitude,$range,$info,$date,$type = '',$ivao_id = '',$ivao_name = '',$format_source = '',$source_name = '') { |
|
88 | - $info = preg_replace('/[^(\x20-\x7F)]*/','',$info); |
|
89 | - $info = str_replace('^','<br />',$info); |
|
90 | - $info = str_replace('&sect;','',$info); |
|
91 | - $info = str_replace('"','',$info); |
|
87 | + public function add($ident, $frequency, $latitude, $longitude, $range, $info, $date, $type = '', $ivao_id = '', $ivao_name = '', $format_source = '', $source_name = '') { |
|
88 | + $info = preg_replace('/[^(\x20-\x7F)]*/', '', $info); |
|
89 | + $info = str_replace('^', '<br />', $info); |
|
90 | + $info = str_replace('&sect;', '', $info); |
|
91 | + $info = str_replace('"', '', $info); |
|
92 | 92 | if ($type == '') $type = NULL; |
93 | 93 | $query = "INSERT INTO atc (ident,frequency,latitude,longitude,atc_range,info,atc_lastseen,type,ivao_id,ivao_name,format_source,source_name) VALUES (:ident,:frequency,:latitude,:longitude,:range,:info,:date,:type,:ivao_id,:ivao_name,:format_source,:source_name)"; |
94 | - $query_values = array(':ident' => $ident,':frequency' => $frequency,':latitude' => $latitude,':longitude' => $longitude,':range' => $range,':info' => $info,':date' => $date,':ivao_id' => $ivao_id,':ivao_name' => $ivao_name, ':type' => $type,':format_source' => $format_source,':source_name' => $source_name); |
|
94 | + $query_values = array(':ident' => $ident, ':frequency' => $frequency, ':latitude' => $latitude, ':longitude' => $longitude, ':range' => $range, ':info' => $info, ':date' => $date, ':ivao_id' => $ivao_id, ':ivao_name' => $ivao_name, ':type' => $type, ':format_source' => $format_source, ':source_name' => $source_name); |
|
95 | 95 | try { |
96 | 96 | $sth = $this->db->prepare($query); |
97 | 97 | $sth->execute($query_values); |
98 | - } catch(PDOException $e) { |
|
98 | + } catch (PDOException $e) { |
|
99 | 99 | return "error : ".$e->getMessage(); |
100 | 100 | } |
101 | 101 | } |
102 | 102 | |
103 | - public function update($ident,$frequency,$latitude,$longitude,$range,$info,$date,$type = '',$ivao_id = '',$ivao_name = '',$format_source = '',$source_name = '') { |
|
104 | - $info = preg_replace('/[^(\x20-\x7F)]*/','',$info); |
|
105 | - $info = str_replace('^','<br />',$info); |
|
106 | - $info = str_replace('&sect;','',$info); |
|
107 | - $info = str_replace('"','',$info); |
|
103 | + public function update($ident, $frequency, $latitude, $longitude, $range, $info, $date, $type = '', $ivao_id = '', $ivao_name = '', $format_source = '', $source_name = '') { |
|
104 | + $info = preg_replace('/[^(\x20-\x7F)]*/', '', $info); |
|
105 | + $info = str_replace('^', '<br />', $info); |
|
106 | + $info = str_replace('&sect;', '', $info); |
|
107 | + $info = str_replace('"', '', $info); |
|
108 | 108 | if ($type == '') $type = NULL; |
109 | 109 | $query = "UPDATE atc SET frequency = :frequency,latitude = :latitude,longitude = :longitude,atc_range = :range,info = :info,atc_lastseen = :date,type = :type,ivao_id = :ivao_id,ivao_name = :ivao_name WHERE ident = :ident AND format_source = :format_source AND source_name = :source_name"; |
110 | - $query_values = array(':ident' => $ident,':frequency' => $frequency,':latitude' => $latitude,':longitude' => $longitude,':range' => $range,':info' => $info,':date' => $date,':ivao_id' => $ivao_id,':ivao_name' => $ivao_name, ':type' => $type,':format_source' => $format_source,':source_name' => $source_name); |
|
110 | + $query_values = array(':ident' => $ident, ':frequency' => $frequency, ':latitude' => $latitude, ':longitude' => $longitude, ':range' => $range, ':info' => $info, ':date' => $date, ':ivao_id' => $ivao_id, ':ivao_name' => $ivao_name, ':type' => $type, ':format_source' => $format_source, ':source_name' => $source_name); |
|
111 | 111 | try { |
112 | 112 | $sth = $this->db->prepare($query); |
113 | 113 | $sth->execute($query_values); |
114 | - } catch(PDOException $e) { |
|
114 | + } catch (PDOException $e) { |
|
115 | 115 | return "error : ".$e->getMessage(); |
116 | 116 | } |
117 | 117 | } |
@@ -122,18 +122,18 @@ discard block |
||
122 | 122 | try { |
123 | 123 | $sth = $this->db->prepare($query); |
124 | 124 | $sth->execute($query_values); |
125 | - } catch(PDOException $e) { |
|
125 | + } catch (PDOException $e) { |
|
126 | 126 | return "error : ".$e->getMessage(); |
127 | 127 | } |
128 | 128 | } |
129 | 129 | |
130 | - public function deleteByIdent($ident,$format_source) { |
|
130 | + public function deleteByIdent($ident, $format_source) { |
|
131 | 131 | $query = "DELETE FROM atc WHERE ident = :ident AND format_source = :format_source"; |
132 | - $query_values = array(':ident' => $ident,':format_source' => $format_source); |
|
132 | + $query_values = array(':ident' => $ident, ':format_source' => $format_source); |
|
133 | 133 | try { |
134 | 134 | $sth = $this->db->prepare($query); |
135 | 135 | $sth->execute($query_values); |
136 | - } catch(PDOException $e) { |
|
136 | + } catch (PDOException $e) { |
|
137 | 137 | return "error : ".$e->getMessage(); |
138 | 138 | } |
139 | 139 | } |
@@ -144,7 +144,7 @@ discard block |
||
144 | 144 | try { |
145 | 145 | $sth = $this->db->prepare($query); |
146 | 146 | $sth->execute($query_values); |
147 | - } catch(PDOException $e) { |
|
147 | + } catch (PDOException $e) { |
|
148 | 148 | return "error : ".$e->getMessage(); |
149 | 149 | } |
150 | 150 | } |
@@ -159,7 +159,7 @@ discard block |
||
159 | 159 | try { |
160 | 160 | $sth = $this->db->prepare($query); |
161 | 161 | $sth->execute(); |
162 | - } catch(PDOException $e) { |
|
162 | + } catch (PDOException $e) { |
|
163 | 163 | return "error"; |
164 | 164 | } |
165 | 165 | return "success"; |
@@ -34,12 +34,12 @@ discard block |
||
34 | 34 | $currentdate = date('Y-m-d'); |
35 | 35 | $sourcestat = $Stats->getStatsSource($currentdate); |
36 | 36 | if (!empty($sourcestat)) { |
37 | - foreach($sourcestat as $srcst) { |
|
37 | + foreach ($sourcestat as $srcst) { |
|
38 | 38 | $type = $srcst['stats_type']; |
39 | 39 | if ($type == 'polar' || $type == 'hist') { |
40 | 40 | $source = $srcst['source_name']; |
41 | 41 | $data = $srcst['source_data']; |
42 | - $this->stats[$currentdate][$source][$type] = json_decode($data,true); |
|
42 | + $this->stats[$currentdate][$source][$type] = json_decode($data, true); |
|
43 | 43 | } |
44 | 44 | } |
45 | 45 | } |
@@ -51,14 +51,14 @@ discard block |
||
51 | 51 | if (isset($globalGeoid) && $globalGeoid) { |
52 | 52 | try { |
53 | 53 | $GeoidClass = new GeoidHeight(); |
54 | - } catch(Exception $e) { |
|
54 | + } catch (Exception $e) { |
|
55 | 55 | if ($globalDebug) echo "Can't calculate geoid, check that you downloaded it via update_db.php \n"; |
56 | 56 | $GeoidClass = FALSE; |
57 | 57 | } |
58 | 58 | } |
59 | 59 | } |
60 | 60 | |
61 | - public function get_Schedule($id,$ident) { |
|
61 | + public function get_Schedule($id, $ident) { |
|
62 | 62 | global $globalDebug, $globalFork, $globalSchedulesFetch; |
63 | 63 | // Get schedule here, so it's done only one time |
64 | 64 | |
@@ -83,8 +83,8 @@ discard block |
||
83 | 83 | $schedule = $Schedule->fetchSchedule($operator); |
84 | 84 | if (count($schedule) > 0 && isset($schedule['DepartureTime']) && isset($schedule['ArrivalTime'])) { |
85 | 85 | if ($globalDebug) echo "-> Schedule info for ".$operator." (".$ident.")\n"; |
86 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('departure_airport_time' => $schedule['DepartureTime'])); |
|
87 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('arrival_airport_time' => $schedule['ArrivalTime'])); |
|
86 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('departure_airport_time' => $schedule['DepartureTime'])); |
|
87 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('arrival_airport_time' => $schedule['ArrivalTime'])); |
|
88 | 88 | // Should also check if route schedule = route from DB |
89 | 89 | if ($schedule['DepartureAirportIATA'] != '') { |
90 | 90 | if ($this->all_flights[$id]['departure_airport'] != $Spotter->getAirportIcao($schedule['DepartureAirportIATA'])) { |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | } |
105 | 105 | } |
106 | 106 | } |
107 | - $Schedule->addSchedule($operator,$this->all_flights[$id]['departure_airport'],$this->all_flights[$id]['departure_airport_time'],$this->all_flights[$id]['arrival_airport'],$this->all_flights[$id]['arrival_airport_time'],$schedule['Source']); |
|
107 | + $Schedule->addSchedule($operator, $this->all_flights[$id]['departure_airport'], $this->all_flights[$id]['departure_airport_time'], $this->all_flights[$id]['arrival_airport'], $this->all_flights[$id]['arrival_airport_time'], $schedule['Source']); |
|
108 | 108 | } |
109 | 109 | } else $scheduleexist = true; |
110 | 110 | } else $scheduleexist = true; |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | if ($scheduleexist) { |
113 | 113 | if ($globalDebug) echo "-> get arrival/departure airport info for ".$ident."\n"; |
114 | 114 | $sch = $Schedule->getSchedule($operator); |
115 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('arrival_airport' => $sch['arrival_airport_icao'],'departure_airport' => $sch['departure_airport_icao'],'departure_airport_time' => $sch['departure_airport_time'],'arrival_airport_time' => $sch['arrival_airport_time'])); |
|
115 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('arrival_airport' => $sch['arrival_airport_icao'], 'departure_airport' => $sch['departure_airport_icao'], 'departure_airport_time' => $sch['departure_airport_time'], 'arrival_airport_time' => $sch['arrival_airport_time'])); |
|
116 | 116 | } |
117 | 117 | $Spotter->db = null; |
118 | 118 | $Schedule->db = null; |
@@ -139,7 +139,7 @@ discard block |
||
139 | 139 | //echo $this->all_flights[$key]['id'].' - '.$this->all_flights[$key]['latitude'].' '.$this->all_flights[$key]['longitude']."\n"; |
140 | 140 | $Spotter = new Spotter($this->db); |
141 | 141 | $real_arrival = $this->arrival($key); |
142 | - 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']); |
|
142 | + if (isset($this->all_flights[$key]['altitude']) && isset($this->all_flights[$key]['datetime'])) $Spotter->updateLatestSpotterData($this->all_flights[$key]['id'], $this->all_flights[$key]['ident'], $this->all_flights[$key]['latitude'], $this->all_flights[$key]['longitude'], $this->all_flights[$key]['altitude'], $this->all_flights[$key]['ground'], $this->all_flights[$key]['speed'], $this->all_flights[$key]['datetime'], $real_arrival['airport_icao'], $real_arrival['airport_time']); |
|
143 | 143 | } |
144 | 144 | } |
145 | 145 | } |
@@ -153,7 +153,7 @@ discard block |
||
153 | 153 | $airport_time = ''; |
154 | 154 | if (!isset($globalClosestMinDist) || $globalClosestMinDist == '') $globalClosestMinDist = 50; |
155 | 155 | if ($this->all_flights[$key]['latitude'] != '' && $this->all_flights[$key]['longitude'] != '') { |
156 | - $closestAirports = $Spotter->closestAirports($this->all_flights[$key]['latitude'],$this->all_flights[$key]['longitude'],$globalClosestMinDist); |
|
156 | + $closestAirports = $Spotter->closestAirports($this->all_flights[$key]['latitude'], $this->all_flights[$key]['longitude'], $globalClosestMinDist); |
|
157 | 157 | if (isset($closestAirports[0])) { |
158 | 158 | if (isset($this->all_flights[$key]['arrival_airport']) && $this->all_flights[$key]['arrival_airport'] == $closestAirports[0]['icao']) { |
159 | 159 | $airport_icao = $closestAirports[0]['icao']; |
@@ -168,7 +168,7 @@ discard block |
||
168 | 168 | break; |
169 | 169 | } |
170 | 170 | } |
171 | - } 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))) { |
|
171 | + } elseif ($this->all_flights[$key]['altitude'] == 0 || ($this->all_flights[$key]['altitude_real'] != '' && ($closestAirports[0]['altitude'] < $this->all_flights[$key]['altitude_real'] && $this->all_flights[$key]['altitude_real'] < $closestAirports[0]['altitude'] + 5000))) { |
|
172 | 172 | $airport_icao = $closestAirports[0]['icao']; |
173 | 173 | $airport_time = $this->all_flights[$key]['datetime']; |
174 | 174 | } else { |
@@ -181,7 +181,7 @@ discard block |
||
181 | 181 | } else { |
182 | 182 | if ($globalDebug) echo "---- No latitude or longitude. Ident : ".$this->all_flights[$key]['ident']."\n"; |
183 | 183 | } |
184 | - return array('airport_icao' => $airport_icao,'airport_time' => $airport_time); |
|
184 | + return array('airport_icao' => $airport_icao, 'airport_time' => $airport_time); |
|
185 | 185 | } |
186 | 186 | |
187 | 187 | |
@@ -192,7 +192,7 @@ discard block |
||
192 | 192 | if ($globalDebug) echo 'Delete old values and update latest data...'."\n"; |
193 | 193 | foreach ($this->all_flights as $key => $flight) { |
194 | 194 | if (isset($flight['lastupdate'])) { |
195 | - if ($flight['lastupdate'] < (time()-5900)) { |
|
195 | + if ($flight['lastupdate'] < (time() - 5900)) { |
|
196 | 196 | $this->delKey($key); |
197 | 197 | } |
198 | 198 | } |
@@ -208,7 +208,7 @@ discard block |
||
208 | 208 | $real_arrival = $this->arrival($key); |
209 | 209 | $Spotter = new Spotter($this->db); |
210 | 210 | if ($this->all_flights[$key]['latitude'] != '' && $this->all_flights[$key]['longitude'] != '') { |
211 | - $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']); |
|
211 | + $result = $Spotter->updateLatestSpotterData($this->all_flights[$key]['id'], $this->all_flights[$key]['ident'], $this->all_flights[$key]['latitude'], $this->all_flights[$key]['longitude'], $this->all_flights[$key]['altitude'], $this->all_flights[$key]['ground'], $this->all_flights[$key]['speed'], $this->all_flights[$key]['datetime'], $real_arrival['airport_icao'], $real_arrival['airport_time']); |
|
212 | 212 | if ($globalDebug && $result != 'success') echo '!!! ERROR : '.$result."\n"; |
213 | 213 | } |
214 | 214 | } |
@@ -241,7 +241,7 @@ discard block |
||
241 | 241 | $send = false; |
242 | 242 | |
243 | 243 | // SBS format is CSV format |
244 | - if(is_array($line) && (isset($line['hex']) || isset($line['id']))) { |
|
244 | + if (is_array($line) && (isset($line['hex']) || isset($line['id']))) { |
|
245 | 245 | //print_r($line); |
246 | 246 | if (isset($line['hex'])) $line['hex'] = strtoupper($line['hex']); |
247 | 247 | if (isset($line['id']) || (isset($line['hex']) && $line['hex'] != '' && $line['hex'] != '00000' && $line['hex'] != '000000' && $line['hex'] != '111111' && ctype_xdigit($line['hex']) && strlen($line['hex']) === 6)) { |
@@ -277,25 +277,25 @@ discard block |
||
277 | 277 | if (!isset($this->all_flights[$id])) { |
278 | 278 | if ($globalDebug) echo 'New flight...'."\n"; |
279 | 279 | $this->all_flights[$id] = array(); |
280 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('addedSpotter' => 0)); |
|
281 | - $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' => '')); |
|
282 | - if (isset($globalDaemon) && $globalDaemon === FALSE) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('lastupdate' => time())); |
|
280 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('addedSpotter' => 0)); |
|
281 | + $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' => '')); |
|
282 | + if (isset($globalDaemon) && $globalDaemon === FALSE) $this->all_flights[$id] = array_merge($this->all_flights[$id], array('lastupdate' => time())); |
|
283 | 283 | if (!isset($line['id'])) { |
284 | 284 | if (!isset($globalDaemon)) $globalDaemon = TRUE; |
285 | 285 | // 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'))); |
286 | 286 | // 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'))); |
287 | - if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw' || $line['format_source'] === 'deltadbtxt' || $line['format_source'] === 'planeupdatefaa' || $line['format_source'] === 'aprs' || $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'))); |
|
287 | + if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw' || $line['format_source'] === 'deltadbtxt' || $line['format_source'] === 'planeupdatefaa' || $line['format_source'] === 'aprs' || $line['format_source'] === 'aircraftlistjson' || $line['format_source'] === 'radarvirtueljson' || $line['format_source'] === 'famaprs')) $this->all_flights[$id] = array_merge($this->all_flights[$id], array('id' => $id.'-'.date('YmdHi'))); |
|
288 | 288 | //else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident'])); |
289 | - } else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $line['id'])); |
|
289 | + } else $this->all_flights[$id] = array_merge($this->all_flights[$id], array('id' => $line['id'])); |
|
290 | 290 | if ($globalAllFlights !== FALSE) $dataFound = true; |
291 | 291 | } |
292 | 292 | if (isset($line['source_type']) && $line['source_type'] != '') { |
293 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('source_type' => $line['source_type'])); |
|
293 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('source_type' => $line['source_type'])); |
|
294 | 294 | } |
295 | 295 | |
296 | 296 | //print_r($this->all_flights); |
297 | 297 | if (isset($line['hex']) && !isset($this->all_flights[$id]['hex']) && ctype_xdigit($line['hex'])) { |
298 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('hex' => trim($line['hex']))); |
|
298 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('hex' => trim($line['hex']))); |
|
299 | 299 | //if (isset($line['datetime']) && preg_match('/^(\d{4}(?:\-\d{2}){2} \d{2}(?:\:\d{2}){2})$/',$line['datetime'])) { |
300 | 300 | //$this->all_flights[$id] = array_merge($this->all_flights[$id],array('datetime' => $line['datetime'])); |
301 | 301 | //} else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('datetime' => date('Y-m-d H:i:s'))); |
@@ -304,27 +304,27 @@ discard block |
||
304 | 304 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
305 | 305 | $Spotter = new Spotter($this->db); |
306 | 306 | if (isset($this->all_flights[$id]['source_type'])) { |
307 | - $aircraft_icao = $Spotter->getAllAircraftType(trim($line['hex']),$this->all_flights[$id]['source_type']); |
|
307 | + $aircraft_icao = $Spotter->getAllAircraftType(trim($line['hex']), $this->all_flights[$id]['source_type']); |
|
308 | 308 | } else { |
309 | 309 | $aircraft_icao = $Spotter->getAllAircraftType(trim($line['hex'])); |
310 | 310 | } |
311 | 311 | $Spotter->db = null; |
312 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update getallaircrattype : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
313 | - if ($aircraft_icao != '') $this->all_flights[$id] = array_merge($this->all_flights[$id],array('aircraft_icao' => $aircraft_icao)); |
|
312 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update getallaircrattype : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
313 | + if ($aircraft_icao != '') $this->all_flights[$id] = array_merge($this->all_flights[$id], array('aircraft_icao' => $aircraft_icao)); |
|
314 | 314 | } |
315 | 315 | } |
316 | 316 | if ($globalAllFlights !== FALSE) $dataFound = true; |
317 | 317 | if ($globalDebug) echo "*********** New aircraft hex : ".$line['hex']." ***********\n"; |
318 | 318 | } |
319 | 319 | if (isset($line['id']) && !isset($line['hex'])) { |
320 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('hex' => '')); |
|
320 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('hex' => '')); |
|
321 | 321 | } |
322 | 322 | if (isset($line['aircraft_icao']) && $line['aircraft_icao'] != '') { |
323 | 323 | $icao = $line['aircraft_icao']; |
324 | 324 | $Spotter = new Spotter($this->db); |
325 | 325 | if (isset($Spotter->aircraft_correct_icaotype[$icao])) $icao = $Spotter->aircraft_correct_icaotype[$icao]; |
326 | 326 | $Spotter->db = null; |
327 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('aircraft_icao' => $icao)); |
|
327 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('aircraft_icao' => $icao)); |
|
328 | 328 | } |
329 | 329 | if (!isset($this->all_flights[$id]['aircraft_icao']) && isset($line['aircraft_name'])) { |
330 | 330 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
@@ -332,7 +332,7 @@ discard block |
||
332 | 332 | $Spotter = new Spotter($this->db); |
333 | 333 | $aircraft_icao = $Spotter->getAircraftIcao($line['aircraft_name']); |
334 | 334 | $Spotter->db = null; |
335 | - if ($aircraft_icao != '') $this->all_flights[$id] = array_merge($this->all_flights[$id],array('aircraft_icao' => $aircraft_icao)); |
|
335 | + if ($aircraft_icao != '') $this->all_flights[$id] = array_merge($this->all_flights[$id], array('aircraft_icao' => $aircraft_icao)); |
|
336 | 336 | } |
337 | 337 | } |
338 | 338 | if (!isset($this->all_flights[$id]['aircraft_icao']) && isset($line['aircraft_type'])) { |
@@ -340,15 +340,15 @@ discard block |
||
340 | 340 | elseif ($line['aircraft_type'] == 'HELICOPTER_ROTORCRAFT') $aircraft_icao = 'UHEL'; |
341 | 341 | elseif ($line['aircraft_type'] == 'TOW_PLANE') $aircraft_icao = 'TOWPLANE'; |
342 | 342 | elseif ($line['aircraft_type'] == 'POWERED_AIRCRAFT') $aircraft_icao = 'POWAIRC'; |
343 | - if (isset($aircraft_icao)) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('aircraft_icao' => $aircraft_icao)); |
|
343 | + if (isset($aircraft_icao)) $this->all_flights[$id] = array_merge($this->all_flights[$id], array('aircraft_icao' => $aircraft_icao)); |
|
344 | 344 | } |
345 | 345 | if (!isset($this->all_flights[$id]['aircraft_icao'])) { |
346 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('aircraft_icao' => 'NA')); |
|
346 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('aircraft_icao' => 'NA')); |
|
347 | 347 | } |
348 | 348 | //if (isset($line['datetime']) && preg_match('/^(\d{4}(?:\-\d{2}){2} \d{2}(?:\:\d{2}){2})$/',$line['datetime'])) { |
349 | - if (isset($line['datetime']) && strtotime($line['datetime']) > time()-20*60 && strtotime($line['datetime']) < time()+20*60) { |
|
349 | + if (isset($line['datetime']) && strtotime($line['datetime']) > time() - 20*60 && strtotime($line['datetime']) < time() + 20*60) { |
|
350 | 350 | if (!isset($this->all_flights[$id]['datetime']) || strtotime($line['datetime']) >= strtotime($this->all_flights[$id]['datetime'])) { |
351 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('datetime' => $line['datetime'])); |
|
351 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('datetime' => $line['datetime'])); |
|
352 | 352 | } else { |
353 | 353 | 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"; |
354 | 354 | 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"; |
@@ -359,31 +359,31 @@ discard block |
||
359 | 359 | */ |
360 | 360 | return ''; |
361 | 361 | } |
362 | - } elseif (isset($line['datetime']) && strtotime($line['datetime']) < time()-20*60) { |
|
362 | + } elseif (isset($line['datetime']) && strtotime($line['datetime']) < time() - 20*60) { |
|
363 | 363 | if ($globalDebug) echo "!!! Date is too old ".$line['datetime']." for ".$this->all_flights[$id]['id']." - format : ".$line['format_source']."!!!\n"; |
364 | 364 | return ''; |
365 | - } elseif (isset($line['datetime']) && strtotime($line['datetime']) > time()+20*60) { |
|
365 | + } elseif (isset($line['datetime']) && strtotime($line['datetime']) > time() + 20*60) { |
|
366 | 366 | if ($globalDebug) echo "!!! Date is in the future ".$line['datetime']." for ".$this->all_flights[$id]['id']." - format : ".$line['format_source']."!!!\n"; |
367 | 367 | return ''; |
368 | 368 | } elseif (!isset($line['datetime'])) { |
369 | 369 | date_default_timezone_set('UTC'); |
370 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('datetime' => date('Y-m-d H:i:s'))); |
|
370 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('datetime' => date('Y-m-d H:i:s'))); |
|
371 | 371 | } else { |
372 | 372 | if ($globalDebug) echo "!!! Unknow date error ".$this->all_flights[$id]['hex']." - format : ".$line['format_source']."!!!"; |
373 | 373 | return ''; |
374 | 374 | } |
375 | 375 | |
376 | 376 | if (isset($line['registration']) && $line['registration'] != '' && $line['registration'] != 'z.NO-REG') { |
377 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('registration' => $line['registration'])); |
|
377 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('registration' => $line['registration'])); |
|
378 | 378 | } |
379 | 379 | if (isset($line['waypoints']) && $line['waypoints'] != '') { |
380 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('waypoints' => $line['waypoints'])); |
|
380 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('waypoints' => $line['waypoints'])); |
|
381 | 381 | } |
382 | 382 | if (isset($line['pilot_id']) && $line['pilot_id'] != '') { |
383 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('pilot_id' => trim($line['pilot_id']))); |
|
383 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('pilot_id' => trim($line['pilot_id']))); |
|
384 | 384 | } |
385 | 385 | if (isset($line['pilot_name']) && $line['pilot_name'] != '') { |
386 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('pilot_name' => trim($line['pilot_name']))); |
|
386 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('pilot_name' => trim($line['pilot_name']))); |
|
387 | 387 | } |
388 | 388 | |
389 | 389 | if (isset($line['ident']) && $line['ident'] != '' && $line['ident'] != '????????' && $line['ident'] != '00000000' && ($this->all_flights[$id]['ident'] != trim($line['ident'])) && preg_match('/^[a-zA-Z0-9]+$/', $line['ident'])) { |
@@ -391,13 +391,13 @@ discard block |
||
391 | 391 | if ($this->all_flights[$id]['addedSpotter'] == 1) { |
392 | 392 | if ($globalVA !== TRUE && $globalIVAO !== TRUE && $globalVATSIM !== TRUE && $globalphpVMS !== TRUE && $globalVAM !== TRUE && $this->all_flights[$id]['lastupdate'] < time() - 1600) { |
393 | 393 | if ($globalDebug) echo '---!!!! New ident, reset aircraft data...'."\n"; |
394 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('addedSpotter' => 0)); |
|
395 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('forcenew' => 1)); |
|
396 | - 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' || $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'))); |
|
397 | - elseif (isset($line['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $line['id'])); |
|
398 | - 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'])); |
|
394 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('addedSpotter' => 0)); |
|
395 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('forcenew' => 1)); |
|
396 | + 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' || $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'))); |
|
397 | + elseif (isset($line['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id], array('id' => $line['id'])); |
|
398 | + 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'])); |
|
399 | 399 | } else { |
400 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('ident' => trim($line['ident']))); |
|
400 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('ident' => trim($line['ident']))); |
|
401 | 401 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
402 | 402 | $timeelapsed = microtime(true); |
403 | 403 | $Spotter = new Spotter($this->db); |
@@ -407,13 +407,13 @@ discard block |
||
407 | 407 | elseif (isset($line['format_source']) && $line['format_source'] == 'whazzup') $fromsource = 'ivao'; |
408 | 408 | elseif (isset($globalVATSIM) && $globalVATSIM) $fromsource = 'vatsim'; |
409 | 409 | elseif (isset($globalIVAO) && $globalIVAO) $fromsource = 'ivao'; |
410 | - $result = $Spotter->updateIdentSpotterData($this->all_flights[$id]['id'],$this->all_flights[$id]['ident'],$fromsource); |
|
410 | + $result = $Spotter->updateIdentSpotterData($this->all_flights[$id]['id'], $this->all_flights[$id]['ident'], $fromsource); |
|
411 | 411 | if ($globalDebug && $result != 'success') echo '!!! ERROR : '.$result."\n"; |
412 | 412 | $Spotter->db = null; |
413 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update identspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
413 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update identspotterdata : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
414 | 414 | } |
415 | 415 | } |
416 | - } else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('ident' => trim($line['ident']))); |
|
416 | + } else $this->all_flights[$id] = array_merge($this->all_flights[$id], array('ident' => trim($line['ident']))); |
|
417 | 417 | |
418 | 418 | /* |
419 | 419 | if (!isset($line['id'])) { |
@@ -423,25 +423,25 @@ discard block |
||
423 | 423 | else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident'])); |
424 | 424 | } else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $line['id'])); |
425 | 425 | */ |
426 | - 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'])); |
|
426 | + 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'])); |
|
427 | 427 | |
428 | 428 | //$putinarchive = true; |
429 | 429 | if (isset($line['departure_airport_time']) && $line['departure_airport_time'] != 0) { |
430 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('departure_airport_time' => $line['departure_airport_time'])); |
|
430 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('departure_airport_time' => $line['departure_airport_time'])); |
|
431 | 431 | } |
432 | 432 | if (isset($line['arrival_airport_time']) && $line['arrival_airport_time'] != 0) { |
433 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('arrival_airport_time' => $line['arrival_airport_time'])); |
|
433 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('arrival_airport_time' => $line['arrival_airport_time'])); |
|
434 | 434 | } |
435 | 435 | if (isset($line['departure_airport_icao']) && isset($line['arrival_airport_icao'])) { |
436 | - $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' => '')); |
|
436 | + $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' => '')); |
|
437 | 437 | } elseif (isset($line['departure_airport_iata']) && isset($line['arrival_airport_iata'])) { |
438 | 438 | $timeelapsed = microtime(true); |
439 | 439 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
440 | 440 | $Spotter = new Spotter($this->db); |
441 | 441 | $line['departure_airport_icao'] = $Spotter->getAirportIcao($line['departure_airport_iata']); |
442 | 442 | $line['arrival_airport_icao'] = $Spotter->getAirportIcao($line['arrival_airport_iata']); |
443 | - $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' => '')); |
|
444 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update getAirportICAO : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
443 | + $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' => '')); |
|
444 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update getAirportICAO : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
445 | 445 | } |
446 | 446 | } elseif (!isset($line['format_source']) || $line['format_source'] != 'aprs') { |
447 | 447 | $timeelapsed = microtime(true); |
@@ -455,35 +455,35 @@ discard block |
||
455 | 455 | $Translation->db = null; |
456 | 456 | } |
457 | 457 | $Spotter->db = null; |
458 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update getrouteinfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
458 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update getrouteinfo : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
459 | 459 | } |
460 | 460 | if (isset($route['fromairport_icao']) && isset($route['toairport_icao'])) { |
461 | 461 | //if ($route['FromAirport_ICAO'] != $route['ToAirport_ICAO']) { |
462 | 462 | if ($route['fromairport_icao'] != $route['toairport_icao']) { |
463 | 463 | // $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'])); |
464 | - $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'])); |
|
464 | + $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'])); |
|
465 | 465 | } |
466 | 466 | } |
467 | 467 | if (!isset($globalFork)) $globalFork = TRUE; |
468 | 468 | if (!$globalVA && !$globalIVAO && !$globalVATSIM && !$globalphpVMS && !$globalVAM && (!isset($line['format_source']) || $line['format_source'] != 'aprs')) { |
469 | - if (!isset($this->all_flights[$id]['schedule_check']) || $this->all_flights[$id]['schedule_check'] === false) $this->get_Schedule($id,trim($line['ident'])); |
|
469 | + if (!isset($this->all_flights[$id]['schedule_check']) || $this->all_flights[$id]['schedule_check'] === false) $this->get_Schedule($id, trim($line['ident'])); |
|
470 | 470 | } |
471 | 471 | } |
472 | 472 | } |
473 | 473 | |
474 | 474 | if (isset($line['speed']) && $line['speed'] != '' && $line['speed'] != 0) { |
475 | 475 | // $this->all_flights[$id] = array_merge($this->all_flights[$id],array('speed' => $line[12])); |
476 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('speed' => round($line['speed']))); |
|
477 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('speed_fromsrc' => true)); |
|
476 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('speed' => round($line['speed']))); |
|
477 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('speed_fromsrc' => true)); |
|
478 | 478 | //$dataFound = true; |
479 | 479 | } 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'])) { |
480 | - $distance = $Common->distance($line['latitude'],$line['longitude'],$this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],'m'); |
|
480 | + $distance = $Common->distance($line['latitude'], $line['longitude'], $this->all_flights[$id]['latitude'], $this->all_flights[$id]['longitude'], 'm'); |
|
481 | 481 | if ($distance > 1000 && $distance < 10000) { |
482 | 482 | // use datetime |
483 | 483 | $speed = $distance/(time() - $this->all_flights[$id]['time_last_coord']); |
484 | 484 | $speed = $speed*3.6; |
485 | 485 | if ($speed < 1000) { |
486 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('speed' => round($speed))); |
|
486 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('speed' => round($speed))); |
|
487 | 487 | if ($globalDebug) echo "ø Calculated Speed for ".$this->all_flights[$id]['hex']." : ".round($speed)." - distance : ".$distance."\n"; |
488 | 488 | } else { |
489 | 489 | if ($globalDebug) echo "ø IGNORED : Calculated Speed for ".$this->all_flights[$id]['hex']." : ".round($speed)." - distance : ".$distance."\n"; |
@@ -498,9 +498,9 @@ discard block |
||
498 | 498 | if ($globalDebug) echo "/!\ Invalid latitude or/and longitude data : lat: ".$line['latitude']." - lng: ".$line['longitude']."\n"; |
499 | 499 | return false; |
500 | 500 | } |
501 | - if (isset($this->all_flights[$id]['time_last_coord'])) $timediff = round(time()-$this->all_flights[$id]['time_last_coord']); |
|
501 | + if (isset($this->all_flights[$id]['time_last_coord'])) $timediff = round(time() - $this->all_flights[$id]['time_last_coord']); |
|
502 | 502 | else unset($timediff); |
503 | - if (isset($this->all_flights[$id]['time_last_archive_coord'])) $timediff_archive = round(time()-$this->all_flights[$id]['time_last_archive_coord']); |
|
503 | + if (isset($this->all_flights[$id]['time_last_archive_coord'])) $timediff_archive = round(time() - $this->all_flights[$id]['time_last_archive_coord']); |
|
504 | 504 | else unset($timediff_archive); |
505 | 505 | if ($this->tmd > 5 |
506 | 506 | || (isset($line['format_source']) |
@@ -524,14 +524,14 @@ discard block |
||
524 | 524 | || ($timediff > 30 |
525 | 525 | && isset($this->all_flights[$id]['latitude']) |
526 | 526 | && isset($this->all_flights[$id]['longitude']) |
527 | - && $Common->withinThreshold($timediff,$Common->distance($line['latitude'],$line['longitude'],$this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],'m')) |
|
527 | + && $Common->withinThreshold($timediff, $Common->distance($line['latitude'], $line['longitude'], $this->all_flights[$id]['latitude'], $this->all_flights[$id]['longitude'], 'm')) |
|
528 | 528 | ) |
529 | 529 | ) { |
530 | 530 | |
531 | 531 | 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']))) { |
532 | 532 | if ((isset($timediff_archive) && $timediff_archive > $globalAircraftMaxUpdate) |
533 | 533 | || (isset($line['format_source']) && $line['format_source'] == 'airwhere') |
534 | - || !$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'])) { |
|
534 | + || !$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'])) { |
|
535 | 535 | $this->all_flights[$id]['archive_latitude'] = $line['latitude']; |
536 | 536 | $this->all_flights[$id]['archive_longitude'] = $line['longitude']; |
537 | 537 | $this->all_flights[$id]['putinarchive'] = true; |
@@ -541,11 +541,11 @@ discard block |
||
541 | 541 | $timeelapsed = microtime(true); |
542 | 542 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
543 | 543 | $Spotter = new Spotter($this->db); |
544 | - $all_country = $Spotter->getCountryFromLatitudeLongitude($line['latitude'],$line['longitude']); |
|
544 | + $all_country = $Spotter->getCountryFromLatitudeLongitude($line['latitude'], $line['longitude']); |
|
545 | 545 | if (!empty($all_country)) $this->all_flights[$id]['over_country'] = $all_country['iso2']; |
546 | 546 | else $this->all_flights[$id]['over_country'] = ''; |
547 | 547 | $Spotter->db = null; |
548 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update getCountryFromlatitudeLongitude : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
548 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update getCountryFromlatitudeLongitude : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
549 | 549 | if ($globalDebug) echo 'FOUND : '.$this->all_flights[$id]['over_country'].' ---------------'."\n"; |
550 | 550 | } |
551 | 551 | } |
@@ -571,13 +571,13 @@ discard block |
||
571 | 571 | $this->all_flights[$id]['time_last_coord'] = time(); |
572 | 572 | } |
573 | 573 | //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)) { |
574 | - 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)) { |
|
574 | + 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)) { |
|
575 | 575 | $this->all_flights[$id]['livedb_latitude'] = $line['latitude']; |
576 | 576 | $dataFound = true; |
577 | 577 | $this->all_flights[$id]['time_last_coord'] = time(); |
578 | 578 | } |
579 | 579 | // elseif ($globalDebug) echo '!*!*! Ignore data, too close to previous one'."\n"; |
580 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('latitude' => $line['latitude'])); |
|
580 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('latitude' => $line['latitude'])); |
|
581 | 581 | /* |
582 | 582 | if (abs($this->all_flights[$id]['archive_latitude']-$this->all_flights[$id]['latitude']) > 0.3) { |
583 | 583 | $this->all_flights[$id]['archive_latitude'] = $line['latitude']; |
@@ -599,13 +599,13 @@ discard block |
||
599 | 599 | $this->all_flights[$id]['time_last_coord'] = time(); |
600 | 600 | } |
601 | 601 | //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)) { |
602 | - 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)) { |
|
602 | + 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)) { |
|
603 | 603 | $this->all_flights[$id]['livedb_longitude'] = $line['longitude']; |
604 | 604 | $dataFound = true; |
605 | 605 | $this->all_flights[$id]['time_last_coord'] = time(); |
606 | 606 | } |
607 | 607 | // elseif ($globalDebug) echo '!*!*! Ignore data, too close to previous one'."\n"; |
608 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('longitude' => $line['longitude'])); |
|
608 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('longitude' => $line['longitude'])); |
|
609 | 609 | /* |
610 | 610 | if (abs($this->all_flights[$id]['archive_longitude']-$this->all_flights[$id]['longitude']) > 0.3) { |
611 | 611 | $this->all_flights[$id]['archive_longitude'] = $line['longitude']; |
@@ -623,46 +623,46 @@ discard block |
||
623 | 623 | } else if ($globalDebug && $timediff > 30) { |
624 | 624 | $this->tmd = $this->tmd + 1; |
625 | 625 | echo '!!! Too much distance in short time... for '.$this->all_flights[$id]['ident']."\n"; |
626 | - echo 'Time : '.$timediff.'s - Distance : '.$Common->distance($line['latitude'],$line['longitude'],$this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],'m')."m -"; |
|
627 | - echo 'Speed : '.(($Common->distance($line['latitude'],$line['longitude'],$this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],'m')/$timediff)*3.6)." km/h - "; |
|
626 | + echo 'Time : '.$timediff.'s - Distance : '.$Common->distance($line['latitude'], $line['longitude'], $this->all_flights[$id]['latitude'], $this->all_flights[$id]['longitude'], 'm')."m -"; |
|
627 | + echo 'Speed : '.(($Common->distance($line['latitude'], $line['longitude'], $this->all_flights[$id]['latitude'], $this->all_flights[$id]['longitude'], 'm')/$timediff)*3.6)." km/h - "; |
|
628 | 628 | echo 'Lat : '.$line['latitude'].' - long : '.$line['longitude'].' - prev lat : '.$this->all_flights[$id]['latitude'].' - prev long : '.$this->all_flights[$id]['longitude']." \n"; |
629 | 629 | } |
630 | 630 | } |
631 | 631 | if (isset($line['last_update']) && $line['last_update'] != '') { |
632 | 632 | if (isset($this->all_flights[$id]['last_update']) && $this->all_flights[$id]['last_update'] != $line['last_update']) $dataFound = true; |
633 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('last_update' => $line['last_update'])); |
|
633 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('last_update' => $line['last_update'])); |
|
634 | 634 | } |
635 | 635 | if (isset($line['verticalrate']) && $line['verticalrate'] != '') { |
636 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('verticalrate' => $line['verticalrate'])); |
|
636 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('verticalrate' => $line['verticalrate'])); |
|
637 | 637 | //$dataFound = true; |
638 | 638 | } |
639 | 639 | if (isset($line['format_source']) && $line['format_source'] != '') { |
640 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('format_source' => $line['format_source'])); |
|
640 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('format_source' => $line['format_source'])); |
|
641 | 641 | } |
642 | 642 | if (isset($line['source_name']) && $line['source_name'] != '') { |
643 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('source_name' => $line['source_name'])); |
|
643 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('source_name' => $line['source_name'])); |
|
644 | 644 | } |
645 | 645 | if (isset($line['emergency']) && $line['emergency'] != '') { |
646 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('emergency' => $line['emergency'])); |
|
646 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('emergency' => $line['emergency'])); |
|
647 | 647 | //$dataFound = true; |
648 | 648 | } |
649 | 649 | if (isset($line['ground']) && $line['ground'] != '') { |
650 | 650 | if (isset($this->all_flights[$id]['ground']) && $this->all_flights[$id]['ground'] == 1 && $line['ground'] == 0) { |
651 | 651 | // Here we force archive of flight because after ground it's a new one (or should be) |
652 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('addedSpotter' => 0)); |
|
653 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('forcenew' => 1)); |
|
654 | - 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' || $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'))); |
|
655 | - elseif (isset($line['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $line['id'])); |
|
656 | - 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'])); |
|
652 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('addedSpotter' => 0)); |
|
653 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('forcenew' => 1)); |
|
654 | + 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' || $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'))); |
|
655 | + elseif (isset($line['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id], array('id' => $line['id'])); |
|
656 | + 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'])); |
|
657 | 657 | } |
658 | 658 | if ($line['ground'] != 1) $line['ground'] = 0; |
659 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('ground' => $line['ground'])); |
|
659 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('ground' => $line['ground'])); |
|
660 | 660 | //$dataFound = true; |
661 | 661 | } |
662 | 662 | if (isset($line['squawk']) && $line['squawk'] != '') { |
663 | 663 | 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'])) { |
664 | 664 | if ($this->all_flights[$id]['squawk'] != $line['squawk']) $this->all_flights[$id]['putinarchive'] = true; |
665 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('squawk' => $line['squawk'])); |
|
665 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('squawk' => $line['squawk'])); |
|
666 | 666 | $highlight = ''; |
667 | 667 | if ($this->all_flights[$id]['squawk'] == '7500') $highlight = 'Squawk 7500 : Hijack at '.date('Y-m-d G:i').' UTC'; |
668 | 668 | if ($this->all_flights[$id]['squawk'] == '7600') $highlight = 'Squawk 7600 : Lost Comm (radio failure) at '.date('Y-m-d G:i').' UTC'; |
@@ -671,66 +671,66 @@ discard block |
||
671 | 671 | $timeelapsed = microtime(true); |
672 | 672 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
673 | 673 | $Spotter = new Spotter($this->db); |
674 | - $Spotter->setHighlightFlight($this->all_flights[$id]['id'],$highlight); |
|
674 | + $Spotter->setHighlightFlight($this->all_flights[$id]['id'], $highlight); |
|
675 | 675 | $Spotter->db = null; |
676 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update sethighlightflight : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
676 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update sethighlightflight : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
677 | 677 | } |
678 | 678 | //$putinarchive = true; |
679 | 679 | //$highlight = ''; |
680 | 680 | } |
681 | 681 | |
682 | - } else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('squawk' => $line['squawk'])); |
|
682 | + } else $this->all_flights[$id] = array_merge($this->all_flights[$id], array('squawk' => $line['squawk'])); |
|
683 | 683 | //$dataFound = true; |
684 | 684 | } |
685 | 685 | |
686 | 686 | if (isset($line['altitude']) && $line['altitude'] != '') { |
687 | 687 | if (isset($line['altitude_relative']) && isset($GeoidClass) && is_object($GeoidClass)) { |
688 | 688 | if ($line['altitude_relative'] == 'AMSL' || $line['altitude_relative'] == 'MSL') { |
689 | - $geoid = round($GeoidClass->get($this->all_flights[$id]['livedb_latitude'],$this->all_flights[$id]['livedb_longitude'])*3.28084,2); |
|
689 | + $geoid = round($GeoidClass->get($this->all_flights[$id]['livedb_latitude'], $this->all_flights[$id]['livedb_longitude'])*3.28084, 2); |
|
690 | 690 | //if ($globalDebug) echo '=> Set altitude to WGS84 Ellipsoid, add '.$geoid.' to '.$line['altitude']."\n"; |
691 | 691 | $line['altitude'] = $line['altitude'] - $geoid; |
692 | 692 | } |
693 | 693 | } |
694 | 694 | //if (!isset($this->all_flights[$id]['altitude']) || $this->all_flights[$id]['altitude'] == '' || ($this->all_flights[$id]['altitude'] > 0 && $line['altitude'] != 0)) { |
695 | - 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; |
|
696 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('altitude' => round($line['altitude']/100))); |
|
697 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('altitude_real' => $line['altitude'])); |
|
695 | + 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; |
|
696 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('altitude' => round($line['altitude']/100))); |
|
697 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('altitude_real' => $line['altitude'])); |
|
698 | 698 | //$dataFound = true; |
699 | 699 | //} elseif ($globalDebug) echo "!!! Strange altitude data... not added.\n"; |
700 | 700 | if ($globalVA !== TRUE && $globalIVAO !== TRUE && $globalVATSIM !== TRUE && $globalphpVMS !== TRUE && $globalVAM !== TRUE) { |
701 | 701 | 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) { |
702 | 702 | if ($globalDebug) echo '--- Reset because of altitude'."\n"; |
703 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('addedSpotter' => 0)); |
|
704 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('forcenew' => 1)); |
|
705 | - 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' || $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'))); |
|
706 | - elseif (isset($line['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $line['id'])); |
|
707 | - 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'])); |
|
703 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('addedSpotter' => 0)); |
|
704 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('forcenew' => 1)); |
|
705 | + 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' || $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'))); |
|
706 | + elseif (isset($line['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id], array('id' => $line['id'])); |
|
707 | + 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'])); |
|
708 | 708 | } |
709 | 709 | } |
710 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('altitude_previous' => $line['altitude'])); |
|
710 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('altitude_previous' => $line['altitude'])); |
|
711 | 711 | } |
712 | 712 | |
713 | 713 | if (isset($line['noarchive']) && $line['noarchive'] === true) { |
714 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('noarchive' => true)); |
|
714 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('noarchive' => true)); |
|
715 | 715 | } |
716 | 716 | |
717 | 717 | if (isset($line['heading']) && $line['heading'] != '') { |
718 | - if (is_int($this->all_flights[$id]['heading']) && abs($this->all_flights[$id]['heading']-round($line['heading'])) > 10) $this->all_flights[$id]['putinarchive'] = true; |
|
719 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('heading' => round($line['heading']))); |
|
720 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('heading_fromsrc' => true)); |
|
718 | + if (is_int($this->all_flights[$id]['heading']) && abs($this->all_flights[$id]['heading'] - round($line['heading'])) > 10) $this->all_flights[$id]['putinarchive'] = true; |
|
719 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('heading' => round($line['heading']))); |
|
720 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('heading_fromsrc' => true)); |
|
721 | 721 | //$dataFound = true; |
722 | 722 | } 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']) { |
723 | - $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']); |
|
724 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('heading' => round($heading))); |
|
725 | - if (abs($this->all_flights[$id]['heading']-round($heading)) > 10) $this->all_flights[$id]['putinarchive'] = true; |
|
723 | + $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']); |
|
724 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('heading' => round($heading))); |
|
725 | + if (abs($this->all_flights[$id]['heading'] - round($heading)) > 10) $this->all_flights[$id]['putinarchive'] = true; |
|
726 | 726 | if ($globalDebug) echo "ø Calculated Heading for ".$this->all_flights[$id]['id']." : ".$heading."\n"; |
727 | 727 | } elseif (isset($this->all_flights[$id]['format_source']) && $this->all_flights[$id]['format_source'] == 'ACARS') { |
728 | 728 | // If not enough messages and ACARS set heading to 0 |
729 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('heading' => 0)); |
|
729 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('heading' => 0)); |
|
730 | 730 | } |
731 | - if ($globalDaemon === TRUE && isset($globalSourcesupdate) && $globalSourcesupdate != '' && isset($this->all_flights[$id]['lastupdate']) && time()-$this->all_flights[$id]['lastupdate'] < $globalSourcesupdate) $dataFound = false; |
|
732 | - elseif ($globalDaemon === TRUE && isset($globalSBS1update) && $globalSBS1update != '' && isset($this->all_flights[$id]['lastupdate']) && time()-$this->all_flights[$id]['lastupdate'] < $globalSBS1update) $dataFound = false; |
|
733 | - elseif ($globalDaemon === TRUE && isset($globalAircraftMinUpdate) && $globalAircraftMinUpdate != '' && isset($this->all_flights[$id]['lastupdate']) && time()-$this->all_flights[$id]['lastupdate'] < $globalMinupdate) $dataFound = false; |
|
731 | + if ($globalDaemon === TRUE && isset($globalSourcesupdate) && $globalSourcesupdate != '' && isset($this->all_flights[$id]['lastupdate']) && time() - $this->all_flights[$id]['lastupdate'] < $globalSourcesupdate) $dataFound = false; |
|
732 | + elseif ($globalDaemon === TRUE && isset($globalSBS1update) && $globalSBS1update != '' && isset($this->all_flights[$id]['lastupdate']) && time() - $this->all_flights[$id]['lastupdate'] < $globalSBS1update) $dataFound = false; |
|
733 | + elseif ($globalDaemon === TRUE && isset($globalAircraftMinUpdate) && $globalAircraftMinUpdate != '' && isset($this->all_flights[$id]['lastupdate']) && time() - $this->all_flights[$id]['lastupdate'] < $globalMinupdate) $dataFound = false; |
|
734 | 734 | |
735 | 735 | // print_r($this->all_flights[$id]); |
736 | 736 | //gets the callsign from the last hour |
@@ -741,7 +741,7 @@ discard block |
||
741 | 741 | if ($dataFound === true && isset($this->all_flights[$id]['id'])) { |
742 | 742 | $this->all_flights[$id]['lastupdate'] = time(); |
743 | 743 | if ((!isset($globalNoImport) || $globalNoImport === FALSE) && $this->all_flights[$id]['addedSpotter'] == 0) { |
744 | - 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'])) { |
|
744 | + 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'])) { |
|
745 | 745 | //print_r($this->all_flights); |
746 | 746 | //echo $this->all_flights[$id]['id'].' - '.$this->all_flights[$id]['addedSpotter']."\n"; |
747 | 747 | //$last_hour_ident = Spotter->getIdentFromLastHour($this->all_flights[$id]['ident']); |
@@ -752,61 +752,61 @@ discard block |
||
752 | 752 | $SpotterLive = new SpotterLive($this->db); |
753 | 753 | 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' || $line['format_source'] === 'aircraftlistjson' || $line['format_source'] === 'radarvirtueljson' || $line['format_source'] === 'famaprs')) { |
754 | 754 | $recent_ident = $SpotterLive->checkModeSRecent($this->all_flights[$id]['hex']); |
755 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkModeSRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
755 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkModeSRecent : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
756 | 756 | } elseif (isset($line['id'])) { |
757 | 757 | $recent_ident = $SpotterLive->checkIdRecent($line['id']); |
758 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
758 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdRecent : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
759 | 759 | } elseif (isset($this->all_flights[$id]['ident']) && $this->all_flights[$id]['ident'] != '') { |
760 | 760 | $recent_ident = $SpotterLive->checkIdentRecent($this->all_flights[$id]['ident']); |
761 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdentRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
761 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdentRecent : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
762 | 762 | } else $recent_ident = ''; |
763 | - $SpotterLive->db=null; |
|
763 | + $SpotterLive->db = null; |
|
764 | 764 | if ($globalDebug && $recent_ident == '') echo " Not in DB.\n"; |
765 | 765 | elseif ($globalDebug && $recent_ident != '') echo " Already in DB.\n"; |
766 | 766 | } else $recent_ident = ''; |
767 | 767 | } else { |
768 | 768 | $recent_ident = ''; |
769 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('forcenew' => 0)); |
|
769 | + $this->all_flights[$id] = array_merge($this->all_flights[$id], array('forcenew' => 0)); |
|
770 | 770 | } |
771 | 771 | //if there was no aircraft with the same callsign within the last hour and go post it into the archive |
772 | - if($recent_ident == "") |
|
772 | + if ($recent_ident == "") |
|
773 | 773 | { |
774 | 774 | if ($globalDebug) echo "\o/ Add ".$this->all_flights[$id]['ident']." in archive DB : "; |
775 | 775 | if ($this->all_flights[$id]['departure_airport'] == "") { $this->all_flights[$id]['departure_airport'] = "NA"; } |
776 | 776 | if ($this->all_flights[$id]['arrival_airport'] == "") { $this->all_flights[$id]['arrival_airport'] = "NA"; } |
777 | 777 | //adds the spotter data for the archive |
778 | 778 | $ignoreImport = false; |
779 | - foreach($globalAirportIgnore as $airportIgnore) { |
|
779 | + foreach ($globalAirportIgnore as $airportIgnore) { |
|
780 | 780 | if (($this->all_flights[$id]['departure_airport'] == $airportIgnore) || ($this->all_flights[$id]['arrival_airport'] == $airportIgnore)) { |
781 | 781 | $ignoreImport = true; |
782 | 782 | } |
783 | 783 | } |
784 | 784 | if (count($globalAirportAccept) > 0) { |
785 | 785 | $ignoreImport = true; |
786 | - foreach($globalAirportIgnore as $airportIgnore) { |
|
786 | + foreach ($globalAirportIgnore as $airportIgnore) { |
|
787 | 787 | if (($this->all_flights[$id]['departure_airport'] == $airportIgnore) || ($this->all_flights[$id]['arrival_airport'] == $airportIgnore)) { |
788 | 788 | $ignoreImport = false; |
789 | 789 | } |
790 | 790 | } |
791 | 791 | } |
792 | 792 | if (isset($globalAirlineIgnore) && is_array($globalAirlineIgnore)) { |
793 | - foreach($globalAirlineIgnore as $airlineIgnore) { |
|
794 | - 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)) { |
|
793 | + foreach ($globalAirlineIgnore as $airlineIgnore) { |
|
794 | + 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)) { |
|
795 | 795 | $ignoreImport = true; |
796 | 796 | } |
797 | 797 | } |
798 | 798 | } |
799 | 799 | if (isset($globalAirlineAccept) && count($globalAirlineAccept) > 0) { |
800 | 800 | $ignoreImport = true; |
801 | - foreach($globalAirlineAccept as $airlineAccept) { |
|
802 | - 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)) { |
|
801 | + foreach ($globalAirlineAccept as $airlineAccept) { |
|
802 | + 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)) { |
|
803 | 803 | $ignoreImport = false; |
804 | 804 | } |
805 | 805 | } |
806 | 806 | } |
807 | 807 | if (isset($globalPilotIdAccept) && count($globalPilotIdAccept) > 0) { |
808 | 808 | $ignoreImport = true; |
809 | - foreach($globalPilotIdAccept as $pilotIdAccept) { |
|
809 | + foreach ($globalPilotIdAccept as $pilotIdAccept) { |
|
810 | 810 | if ($this->all_flights[$id]['pilot_id'] == $pilotIdAccept) { |
811 | 811 | $ignoreImport = false; |
812 | 812 | } |
@@ -818,32 +818,32 @@ discard block |
||
818 | 818 | if ($this->all_flights[$id]['squawk'] == '7500') $highlight = 'Squawk 7500 : Hijack'; |
819 | 819 | if ($this->all_flights[$id]['squawk'] == '7600') $highlight = 'Squawk 7600 : Lost Comm (radio failure)'; |
820 | 820 | if ($this->all_flights[$id]['squawk'] == '7700') $highlight = 'Squawk 7700 : Emergency'; |
821 | - 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'))); |
|
821 | + 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'))); |
|
822 | 822 | $timeelapsed = microtime(true); |
823 | 823 | if (!isset($globalNoImport) || $globalNoImport === FALSE) { |
824 | 824 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
825 | 825 | $Spotter = new Spotter($this->db); |
826 | - $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']); |
|
826 | + $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']); |
|
827 | 827 | $Spotter->db = null; |
828 | 828 | if ($globalDebug && isset($result)) echo $result."\n"; |
829 | 829 | } |
830 | 830 | } |
831 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update addspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
831 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update addspotterdata : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
832 | 832 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
833 | 833 | |
834 | 834 | // Add source stat in DB |
835 | 835 | $Stats = new Stats($this->db); |
836 | 836 | if (!empty($this->stats)) { |
837 | 837 | if ($globalDebug) echo 'Add source stats : '; |
838 | - foreach($this->stats as $date => $data) { |
|
839 | - foreach($data as $source => $sourced) { |
|
838 | + foreach ($this->stats as $date => $data) { |
|
839 | + foreach ($data as $source => $sourced) { |
|
840 | 840 | //print_r($sourced); |
841 | - if (isset($sourced['polar'])) echo $Stats->addStatSource(json_encode($sourced['polar']),$source,'polar',$date); |
|
842 | - if (isset($sourced['hist'])) echo $Stats->addStatSource(json_encode($sourced['hist']),$source,'hist',$date); |
|
841 | + if (isset($sourced['polar'])) echo $Stats->addStatSource(json_encode($sourced['polar']), $source, 'polar', $date); |
|
842 | + if (isset($sourced['hist'])) echo $Stats->addStatSource(json_encode($sourced['hist']), $source, 'hist', $date); |
|
843 | 843 | if (isset($sourced['msg'])) { |
844 | 844 | if (time() - $sourced['msg']['date'] > 10) { |
845 | 845 | $nbmsg = round($sourced['msg']['nb']/(time() - $sourced['msg']['date'])); |
846 | - echo $Stats->addStatSource($nbmsg,$source,'msg',$date); |
|
846 | + echo $Stats->addStatSource($nbmsg, $source, 'msg', $date); |
|
847 | 847 | unset($this->stats[$date][$source]['msg']); |
848 | 848 | } |
849 | 849 | } |
@@ -881,14 +881,14 @@ discard block |
||
881 | 881 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
882 | 882 | $SpotterLive = new SpotterLive($this->db); |
883 | 883 | $SpotterLive->deleteLiveSpotterData(); |
884 | - $SpotterLive->db=null; |
|
884 | + $SpotterLive->db = null; |
|
885 | 885 | } |
886 | 886 | } |
887 | 887 | if ($globalDebug) echo " Done\n"; |
888 | 888 | $this->last_delete = time(); |
889 | 889 | } |
890 | 890 | } else { |
891 | - 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' || $line['format_source'] === 'aircraftlistjson' || $line['format_source'] === 'famaprs' || $line['format_source'] === 'airwhere')) { |
|
891 | + 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' || $line['format_source'] === 'aircraftlistjson' || $line['format_source'] === 'famaprs' || $line['format_source'] === 'airwhere')) { |
|
892 | 892 | $this->all_flights[$id]['id'] = $recent_ident; |
893 | 893 | $this->all_flights[$id]['addedSpotter'] = 1; |
894 | 894 | } |
@@ -896,7 +896,7 @@ discard block |
||
896 | 896 | if (!isset($globalNoImport) || $globalNoImport === FALSE) { |
897 | 897 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
898 | 898 | $Spotter = new Spotter($this->db); |
899 | - $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']); |
|
899 | + $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']); |
|
900 | 900 | $Spotter->db = null; |
901 | 901 | } |
902 | 902 | } |
@@ -922,37 +922,37 @@ discard block |
||
922 | 922 | if ($this->all_flights[$id]['departure_airport'] == "") { $this->all_flights[$id]['departure_airport'] = "NA"; } |
923 | 923 | if ($this->all_flights[$id]['arrival_airport'] == "") { $this->all_flights[$id]['arrival_airport'] = "NA"; } |
924 | 924 | |
925 | - foreach($globalAirportIgnore as $airportIgnore) { |
|
925 | + foreach ($globalAirportIgnore as $airportIgnore) { |
|
926 | 926 | if (($this->all_flights[$id]['departure_airport'] == $airportIgnore) || ($this->all_flights[$id]['arrival_airport'] == $airportIgnore)) { |
927 | 927 | $ignoreImport = true; |
928 | 928 | } |
929 | 929 | } |
930 | 930 | if (count($globalAirportAccept) > 0) { |
931 | 931 | $ignoreImport = true; |
932 | - foreach($globalAirportIgnore as $airportIgnore) { |
|
932 | + foreach ($globalAirportIgnore as $airportIgnore) { |
|
933 | 933 | if (($this->all_flights[$id]['departure_airport'] == $airportIgnore) || ($this->all_flights[$id]['arrival_airport'] == $airportIgnore)) { |
934 | 934 | $ignoreImport = false; |
935 | 935 | } |
936 | 936 | } |
937 | 937 | } |
938 | 938 | if (isset($globalAirlineIgnore) && is_array($globalAirlineIgnore)) { |
939 | - foreach($globalAirlineIgnore as $airlineIgnore) { |
|
940 | - 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)) { |
|
939 | + foreach ($globalAirlineIgnore as $airlineIgnore) { |
|
940 | + 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)) { |
|
941 | 941 | $ignoreImport = true; |
942 | 942 | } |
943 | 943 | } |
944 | 944 | } |
945 | 945 | if (isset($globalAirlineAccept) && count($globalAirlineAccept) > 0) { |
946 | 946 | $ignoreImport = true; |
947 | - foreach($globalAirlineAccept as $airlineAccept) { |
|
948 | - 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)) { |
|
947 | + foreach ($globalAirlineAccept as $airlineAccept) { |
|
948 | + 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)) { |
|
949 | 949 | $ignoreImport = false; |
950 | 950 | } |
951 | 951 | } |
952 | 952 | } |
953 | 953 | if (isset($globalPilotIdAccept) && count($globalPilotIdAccept) > 0) { |
954 | 954 | $ignoreImport = true; |
955 | - foreach($globalPilotIdAccept as $pilotIdAccept) { |
|
955 | + foreach ($globalPilotIdAccept as $pilotIdAccept) { |
|
956 | 956 | if ($this->all_flights[$id]['pilot_id'] == $pilotIdAccept) { |
957 | 957 | $ignoreImport = false; |
958 | 958 | } |
@@ -960,23 +960,23 @@ discard block |
||
960 | 960 | } |
961 | 961 | |
962 | 962 | if (!$ignoreImport) { |
963 | - 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'])) { |
|
964 | - 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'))); |
|
963 | + 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'])) { |
|
964 | + 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'))); |
|
965 | 965 | $timeelapsed = microtime(true); |
966 | 966 | if (!isset($globalNoImport) || $globalNoImport === FALSE) { |
967 | 967 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
968 | 968 | if ($globalDebug) echo "\o/ Add ".$this->all_flights[$id]['ident']." from ".$this->all_flights[$id]['format_source']." in Live DB : "; |
969 | 969 | $SpotterLive = new SpotterLive($this->db); |
970 | - $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']); |
|
970 | + $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']); |
|
971 | 971 | $SpotterLive->db = null; |
972 | 972 | if ($globalDebug) echo $result."\n"; |
973 | 973 | } |
974 | 974 | } |
975 | 975 | if (isset($globalServerAPRS) && $globalServerAPRS && $this->all_flights[$id]['putinarchive']) { |
976 | - $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']); |
|
976 | + $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']); |
|
977 | 977 | } |
978 | 978 | $this->all_flights[$id]['putinarchive'] = false; |
979 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update addlivespotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
979 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update addlivespotterdata : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
980 | 980 | |
981 | 981 | // Put statistics in $this->stats variable |
982 | 982 | //if ($line['format_source'] != 'aprs') { |
@@ -995,19 +995,19 @@ discard block |
||
995 | 995 | $latitude = $globalCenterLatitude; |
996 | 996 | $longitude = $globalCenterLongitude; |
997 | 997 | } |
998 | - $this->source_location[$source] = array('latitude' => $latitude,'longitude' => $longitude); |
|
998 | + $this->source_location[$source] = array('latitude' => $latitude, 'longitude' => $longitude); |
|
999 | 999 | } else { |
1000 | 1000 | $latitude = $this->source_location[$source]['latitude']; |
1001 | 1001 | $longitude = $this->source_location[$source]['longitude']; |
1002 | 1002 | } |
1003 | - $stats_heading = $Common->getHeading($latitude,$longitude,$this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude']); |
|
1003 | + $stats_heading = $Common->getHeading($latitude, $longitude, $this->all_flights[$id]['latitude'], $this->all_flights[$id]['longitude']); |
|
1004 | 1004 | //$stats_heading = $stats_heading%22.5; |
1005 | 1005 | $stats_heading = round($stats_heading/22.5); |
1006 | - $stats_distance = $Common->distance($latitude,$longitude,$this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude']); |
|
1006 | + $stats_distance = $Common->distance($latitude, $longitude, $this->all_flights[$id]['latitude'], $this->all_flights[$id]['longitude']); |
|
1007 | 1007 | $current_date = date('Y-m-d'); |
1008 | 1008 | if ($stats_heading == 16) $stats_heading = 0; |
1009 | 1009 | if (!isset($this->stats[$current_date][$source]['polar'][1])) { |
1010 | - for ($i=0;$i<=15;$i++) { |
|
1010 | + for ($i = 0; $i <= 15; $i++) { |
|
1011 | 1011 | $this->stats[$current_date][$source]['polar'][$i] = 0; |
1012 | 1012 | } |
1013 | 1013 | $this->stats[$current_date][$source]['polar'][$stats_heading] = $stats_distance; |
@@ -1022,9 +1022,9 @@ discard block |
||
1022 | 1022 | if (!isset($this->stats[$current_date][$source]['hist'][$distance])) { |
1023 | 1023 | if (isset($this->stats[$current_date][$source]['hist'][0])) { |
1024 | 1024 | end($this->stats[$current_date][$source]['hist']); |
1025 | - $mini = key($this->stats[$current_date][$source]['hist'])+10; |
|
1025 | + $mini = key($this->stats[$current_date][$source]['hist']) + 10; |
|
1026 | 1026 | } else $mini = 0; |
1027 | - for ($i=$mini;$i<=$distance;$i+=10) { |
|
1027 | + for ($i = $mini; $i <= $distance; $i += 10) { |
|
1028 | 1028 | $this->stats[$current_date][$source]['hist'][$i] = 0; |
1029 | 1029 | } |
1030 | 1030 | $this->stats[$current_date][$source]['hist'][$distance] = 1; |
@@ -1037,7 +1037,7 @@ discard block |
||
1037 | 1037 | $this->all_flights[$id]['lastupdate'] = time(); |
1038 | 1038 | if ($this->all_flights[$id]['putinarchive']) $send = true; |
1039 | 1039 | //if ($globalDebug) echo "Distance : ".Common->distance($this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude'])."\n"; |
1040 | - } 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"; |
|
1040 | + } 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"; |
|
1041 | 1041 | //$this->del(); |
1042 | 1042 | |
1043 | 1043 | if ($this->last_delete_hourly == 0 || time() - $this->last_delete_hourly > 900) { |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | $Connection = new Connection(); |
55 | 55 | $sth = $Connection->db->prepare($query); |
56 | 56 | $sth->execute(); |
57 | - } catch(PDOException $e) { |
|
57 | + } catch (PDOException $e) { |
|
58 | 58 | return "error : ".$e->getMessage(); |
59 | 59 | } |
60 | 60 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | $Connection = new Connection(); |
71 | 71 | $sth = $Connection->db->prepare($query); |
72 | 72 | $sth->execute(); |
73 | - } catch(PDOException $e) { |
|
73 | + } catch (PDOException $e) { |
|
74 | 74 | return "error : ".$e->getMessage(); |
75 | 75 | } |
76 | 76 | } |
@@ -78,9 +78,9 @@ discard block |
||
78 | 78 | public function parse($data) { |
79 | 79 | //$data = str_replace(array('\n','\r','\r','\n'),'',$data); |
80 | 80 | $codes = implode('|', array_keys($this->texts)); |
81 | - $regWeather = '#^(\+|\-|VC)?(' . $codes . ')(' . $codes . ')?$#'; |
|
81 | + $regWeather = '#^(\+|\-|VC)?('.$codes.')('.$codes.')?$#'; |
|
82 | 82 | //$pieces = explode(' ',$data); |
83 | - $pieces = preg_split('/\s/',$data); |
|
83 | + $pieces = preg_split('/\s/', $data); |
|
84 | 84 | $pos = 0; |
85 | 85 | if ($pieces[0] == 'METAR') $pos++; |
86 | 86 | elseif ($pieces[0] == 'SPECI') $pos++; |
@@ -88,25 +88,25 @@ discard block |
||
88 | 88 | $result = array(); |
89 | 89 | $result['location'] = $pieces[$pos]; |
90 | 90 | $pos++; |
91 | - $result['dayofmonth'] = substr($pieces[$pos],0,2); |
|
92 | - $result['time'] = substr($pieces[$pos],2,4); |
|
91 | + $result['dayofmonth'] = substr($pieces[$pos], 0, 2); |
|
92 | + $result['time'] = substr($pieces[$pos], 2, 4); |
|
93 | 93 | $c = count($pieces); |
94 | - for($pos++; $pos < $c; $pos++) { |
|
94 | + for ($pos++; $pos < $c; $pos++) { |
|
95 | 95 | $piece = $pieces[$pos]; |
96 | 96 | if ($piece == 'RMK') break; |
97 | 97 | if ($piece == 'AUTO') $result['auto'] = true; |
98 | 98 | if ($piece == 'COR') $result['correction'] = true; |
99 | 99 | // Wind Speed |
100 | 100 | if (preg_match('#(VRB|\d\d\d)(\d\d)(?:G(\d\d))?(KT|MPS|KPH)(?: (\d{1,3})V(\d{1,3}))?$#', $piece, $matches)) { |
101 | - $result['wind']['direction'] = (float)$matches[1]; |
|
101 | + $result['wind']['direction'] = (float) $matches[1]; |
|
102 | 102 | $result['wind']['unit'] = $matches[4]; |
103 | - if ($result['wind']['unit'] == 'KT') $result['wind']['speed'] = round(((float)$matches[2])*0.51444444444,2); |
|
104 | - elseif ($result['wind']['unit'] == 'KPH') $result['wind']['speed'] = round(((float)$matches[2])*1000,2); |
|
105 | - elseif ($result['wind']['unit'] == 'MPS') $result['wind']['speed'] = round(((float)$matches[2]),2); |
|
106 | - $result['wind']['gust'] = (float)$matches[3]; |
|
103 | + if ($result['wind']['unit'] == 'KT') $result['wind']['speed'] = round(((float) $matches[2])*0.51444444444, 2); |
|
104 | + elseif ($result['wind']['unit'] == 'KPH') $result['wind']['speed'] = round(((float) $matches[2])*1000, 2); |
|
105 | + elseif ($result['wind']['unit'] == 'MPS') $result['wind']['speed'] = round(((float) $matches[2]), 2); |
|
106 | + $result['wind']['gust'] = (float) $matches[3]; |
|
107 | 107 | $result['wind']['unit'] = $matches[4]; |
108 | - $result['wind']['min_variation'] = array_key_exists(5,$matches) ? $matches[5] : 0; |
|
109 | - $result['wind']['max_variation'] = array_key_exists(6,$matches) ? $matches[6] : 0; |
|
108 | + $result['wind']['min_variation'] = array_key_exists(5, $matches) ? $matches[5] : 0; |
|
109 | + $result['wind']['max_variation'] = array_key_exists(6, $matches) ? $matches[6] : 0; |
|
110 | 110 | } |
111 | 111 | |
112 | 112 | /* if (preg_match('#^([0-9]{3})([0-9]{2})(G([0-9]{2}))?(KT|MPS)$#', $piece, $matches)) { |
@@ -127,14 +127,14 @@ discard block |
||
127 | 127 | |
128 | 128 | // Temperature |
129 | 129 | if (preg_match('#^(M?[0-9]{2,})/(M?[0-9]{2,})$#', $piece, $matches)) { |
130 | - $temp = (float)$matches[1]; |
|
130 | + $temp = (float) $matches[1]; |
|
131 | 131 | if ($matches[1]{0} == 'M') { |
132 | - $temp = ((float)substr($matches[1], 1)) * -1; |
|
132 | + $temp = ((float) substr($matches[1], 1))*-1; |
|
133 | 133 | } |
134 | 134 | $result['temperature'] = $temp; |
135 | - $dew = (float)$matches[2]; |
|
135 | + $dew = (float) $matches[2]; |
|
136 | 136 | if ($matches[2]{0} == 'M') { |
137 | - $dew = ((float)substr($matches[2], 1)) * -1; |
|
137 | + $dew = ((float) substr($matches[2], 1))*-1; |
|
138 | 138 | } |
139 | 139 | $result['dew'] = $dew; |
140 | 140 | } |
@@ -146,7 +146,7 @@ discard block |
||
146 | 146 | $result['QNH'] = $matches[2]; |
147 | 147 | } else { |
148 | 148 | // inHg |
149 | - $result['QNH'] = round(($matches[2] / 100)*33.86389,2); |
|
149 | + $result['QNH'] = round(($matches[2]/100)*33.86389, 2); |
|
150 | 150 | } |
151 | 151 | /* |
152 | 152 | $result['QNH'] = $matches[1] == 'Q' ? $matches[2] : ($matches[2] / 100); |
@@ -167,12 +167,12 @@ discard block |
||
167 | 167 | // Visibility |
168 | 168 | if (preg_match('#^([0-9]{4})|(([0-9]{1,4})SM)$#', $piece, $matches)) { |
169 | 169 | if (isset($matches[3]) && strlen($matches[3]) > 0) { |
170 | - $result['visibility'] = (float)$matches[3] * 1609.34; |
|
170 | + $result['visibility'] = (float) $matches[3]*1609.34; |
|
171 | 171 | } else { |
172 | 172 | if ($matches[1] == '9999') { |
173 | 173 | $result['visibility'] = '> 10000'; |
174 | 174 | } else { |
175 | - $result['visibility'] = (float)$matches[1]; |
|
175 | + $result['visibility'] = (float) $matches[1]; |
|
176 | 176 | } |
177 | 177 | } |
178 | 178 | if (preg_match('#^CAVOK$#', $piece, $matches)) { |
@@ -194,7 +194,7 @@ discard block |
||
194 | 194 | elseif ($type == 'OVC') $cloud['type'] = 'Overcast/Full cloud coverage'; |
195 | 195 | elseif ($type == 'VV') $cloud['type'] = 'Vertical visibility'; |
196 | 196 | $cloud['type_code'] = $type; |
197 | - $cloud['level'] = round(((float)$matches[2]) * 100 * 0.3048); |
|
197 | + $cloud['level'] = round(((float) $matches[2])*100*0.3048); |
|
198 | 198 | $cloud['significant'] = isset($matches[3]) ? $matches[3] : ''; |
199 | 199 | $result['cloud'][] = $cloud; |
200 | 200 | } |
@@ -204,8 +204,8 @@ discard block |
||
204 | 204 | $rvr['runway'] = $matches[1]; |
205 | 205 | $rvr['assessment'] = $matches[2]; |
206 | 206 | $rvr['rvr'] = $matches[3]; |
207 | - $rvr['rvr_max'] = array_key_exists(4,$matches) ? $matches[4] : 0; |
|
208 | - $rvr['unit'] = array_key_exists(5,$matches) ? $matches[5] : ''; |
|
207 | + $rvr['rvr_max'] = array_key_exists(4, $matches) ? $matches[4] : 0; |
|
208 | + $rvr['unit'] = array_key_exists(5, $matches) ? $matches[5] : ''; |
|
209 | 209 | $result['RVR'] = $rvr; |
210 | 210 | } |
211 | 211 | //if (preg_match('#^(R[A-Z0-9]{2,3})/([0-9]{4})(V([0-9]{4}))?(FT)?$#', $piece, $matches)) { |
@@ -218,12 +218,12 @@ discard block |
||
218 | 218 | $result['RVR']['friction'] = $matches[5]; |
219 | 219 | } |
220 | 220 | if (preg_match('#^(R[A-Z0-9]{2,3})/([0-9]{4})(V([0-9]{4}))?(FT)?$#', $piece, $matches)) { |
221 | - if (isset($matches[5])) $range = array('exact' => (float)$matches[2], 'unit' => $matches[5] ? 'FT' : 'M'); |
|
222 | - else $range = array('exact' => (float)$matches[2], 'unit' => 'M'); |
|
221 | + if (isset($matches[5])) $range = array('exact' => (float) $matches[2], 'unit' => $matches[5] ? 'FT' : 'M'); |
|
222 | + else $range = array('exact' => (float) $matches[2], 'unit' => 'M'); |
|
223 | 223 | if (isset($matches[3])) { |
224 | 224 | $range = Array( |
225 | - 'from' => (float)$matches[2], |
|
226 | - 'to' => (float)$matches[4], |
|
225 | + 'from' => (float) $matches[2], |
|
226 | + 'to' => (float) $matches[4], |
|
227 | 227 | 'unit' => $matches[5] ? 'FT' : 'M' |
228 | 228 | ); |
229 | 229 | } |
@@ -271,7 +271,7 @@ discard block |
||
271 | 271 | try { |
272 | 272 | $sth = $this->db->prepare($query); |
273 | 273 | $sth->execute($query_values); |
274 | - } catch(PDOException $e) { |
|
274 | + } catch (PDOException $e) { |
|
275 | 275 | return "error : ".$e->getMessage(); |
276 | 276 | } |
277 | 277 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -281,19 +281,19 @@ discard block |
||
281 | 281 | return $all; |
282 | 282 | } |
283 | 283 | |
284 | - public function addMETAR($location,$metar,$date) { |
|
284 | + public function addMETAR($location, $metar, $date) { |
|
285 | 285 | global $globalDBdriver; |
286 | - $date = date('Y-m-d H:i:s',strtotime($date)); |
|
286 | + $date = date('Y-m-d H:i:s', strtotime($date)); |
|
287 | 287 | if ($globalDBdriver == 'mysql') { |
288 | 288 | $query = "INSERT INTO metar (metar_location,metar_date,metar) VALUES (:location,:date,:metar) ON DUPLICATE KEY UPDATE metar_date = :date, metar = :metar"; |
289 | 289 | } else { |
290 | 290 | $query = "UPDATE metar SET metar_date = :date, metar = metar WHERE metar_location = :location;INSERT INTO metar (metar_location,metar_date,metar) SELECT :location,:date,:metar WHERE NOT EXISTS (SELECT 1 FROM metar WHERE metar_location = :location);"; |
291 | 291 | } |
292 | - $query_values = array(':location' => $location,':date' => $date,':metar' => utf8_encode($metar)); |
|
292 | + $query_values = array(':location' => $location, ':date' => $date, ':metar' => utf8_encode($metar)); |
|
293 | 293 | try { |
294 | 294 | $sth = $this->db->prepare($query); |
295 | 295 | $sth->execute($query_values); |
296 | - } catch(PDOException $e) { |
|
296 | + } catch (PDOException $e) { |
|
297 | 297 | return "error : ".$e->getMessage(); |
298 | 298 | } |
299 | 299 | } |
@@ -304,7 +304,7 @@ discard block |
||
304 | 304 | try { |
305 | 305 | $sth = $this->db->prepare($query); |
306 | 306 | $sth->execute($query_values); |
307 | - } catch(PDOException $e) { |
|
307 | + } catch (PDOException $e) { |
|
308 | 308 | return "error : ".$e->getMessage(); |
309 | 309 | } |
310 | 310 | } |
@@ -314,7 +314,7 @@ discard block |
||
314 | 314 | try { |
315 | 315 | $sth = $this->db->prepare($query); |
316 | 316 | $sth->execute(); |
317 | - } catch(PDOException $e) { |
|
317 | + } catch (PDOException $e) { |
|
318 | 318 | return "error : ".$e->getMessage(); |
319 | 319 | } |
320 | 320 | } |
@@ -325,27 +325,27 @@ discard block |
||
325 | 325 | date_default_timezone_set("UTC"); |
326 | 326 | $Common = new Common(); |
327 | 327 | if (isset($globalIVAO) && $globalIVAO) { |
328 | - $Common->download('http://wx.ivao.aero/metar.php',dirname(__FILE__).'/../install/tmp/ivaometar.txt'); |
|
329 | - $handle = fopen(dirname(__FILE__).'/../install/tmp/ivaometar.txt',"r"); |
|
328 | + $Common->download('http://wx.ivao.aero/metar.php', dirname(__FILE__).'/../install/tmp/ivaometar.txt'); |
|
329 | + $handle = fopen(dirname(__FILE__).'/../install/tmp/ivaometar.txt', "r"); |
|
330 | 330 | } else { |
331 | - $Common->download('http://tgftp.nws.noaa.gov/data/observations/metar/cycles/'.date('H').'Z.TXT',dirname(__FILE__).'/../install/tmp/'.date('H').'Z.TXT'); |
|
332 | - $handle = fopen(dirname(__FILE__).'/../install/tmp/'.date('H').'Z.TXT',"r"); |
|
331 | + $Common->download('http://tgftp.nws.noaa.gov/data/observations/metar/cycles/'.date('H').'Z.TXT', dirname(__FILE__).'/../install/tmp/'.date('H').'Z.TXT'); |
|
332 | + $handle = fopen(dirname(__FILE__).'/../install/tmp/'.date('H').'Z.TXT', "r"); |
|
333 | 333 | } |
334 | 334 | if ($handle) { |
335 | 335 | if (isset($globalDebug) && $globalDebug) echo "Done - Updating DB..."; |
336 | 336 | $date = ''; |
337 | 337 | if ($globalTransaction) $this->db->beginTransaction(); |
338 | - while(($line = fgets($handle,4096)) !== false) { |
|
339 | - if (preg_match('#^([0-9]{4})/([0-9]{2})/([0-9]{2}) ([0-9]{2}):([0-9]{2})$#',$line)) { |
|
338 | + while (($line = fgets($handle, 4096)) !== false) { |
|
339 | + if (preg_match('#^([0-9]{4})/([0-9]{2})/([0-9]{2}) ([0-9]{2}):([0-9]{2})$#', $line)) { |
|
340 | 340 | $date = $line; |
341 | 341 | } elseif ($line != '') { |
342 | 342 | if ($date == '') $date = date('Y/m/d H:m'); |
343 | 343 | $pos = 0; |
344 | - $pieces = preg_split('/\s/',$line); |
|
344 | + $pieces = preg_split('/\s/', $line); |
|
345 | 345 | if ($pieces[0] == 'METAR') $pos++; |
346 | 346 | if (strlen($pieces[$pos]) != 4) $pos++; |
347 | 347 | $location = $pieces[$pos]; |
348 | - echo $this->addMETAR($location,$line,$date); |
|
348 | + echo $this->addMETAR($location, $line, $date); |
|
349 | 349 | } |
350 | 350 | } |
351 | 351 | fclose($handle); |
@@ -359,22 +359,22 @@ discard block |
||
359 | 359 | if ($globalMETARurl == '') return array(); |
360 | 360 | date_default_timezone_set("UTC"); |
361 | 361 | $Common = new Common(); |
362 | - $url = str_replace('{icao}',$icao,$globalMETARurl); |
|
362 | + $url = str_replace('{icao}', $icao, $globalMETARurl); |
|
363 | 363 | $cycle = $Common->getData($url); |
364 | 364 | $date = ''; |
365 | - foreach(explode("\n",$cycle) as $line) { |
|
366 | - if (preg_match('#^([0-9]{4})/([0-9]{2})/([0-9]{2}) ([0-9]{2}):([0-9]{2})$#',$line)) { |
|
365 | + foreach (explode("\n", $cycle) as $line) { |
|
366 | + if (preg_match('#^([0-9]{4})/([0-9]{2})/([0-9]{2}) ([0-9]{2}):([0-9]{2})$#', $line)) { |
|
367 | 367 | $date = $line; |
368 | 368 | } |
369 | 369 | if ($line != '') { |
370 | 370 | if ($date == '') $date = date('Y/m/d H:m'); |
371 | 371 | $pos = 0; |
372 | - $pieces = preg_split('/\s/',$line); |
|
372 | + $pieces = preg_split('/\s/', $line); |
|
373 | 373 | if ($pieces[0] == 'METAR') $pos++; |
374 | 374 | if (strlen($pieces[$pos]) != 4) $pos++; |
375 | 375 | $location = $pieces[$pos]; |
376 | 376 | if (strlen($location == 4)) { |
377 | - $this->addMETAR($location,$line,$date); |
|
377 | + $this->addMETAR($location, $line, $date); |
|
378 | 378 | return array('0' => array('metar_date' => $date, 'metar_location' => $location, 'metar' => $line)); |
379 | 379 | } else return array(); |
380 | 380 | } |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -$id = filter_input(INPUT_GET,'id',FILTER_SANITIZE_STRING); |
|
2 | +$id = filter_input(INPUT_GET, 'id', FILTER_SANITIZE_STRING); |
|
3 | 3 | if ($id == "") |
4 | 4 | { |
5 | 5 | header('Location: /'); |
@@ -16,30 +16,30 @@ discard block |
||
16 | 16 | |
17 | 17 | if (!empty($spotter_array)) |
18 | 18 | { |
19 | - if(isset($spotter_array[0]['flightaware_id'])) { |
|
19 | + if (isset($spotter_array[0]['flightaware_id'])) { |
|
20 | 20 | $flightaware_id = $spotter_array[0]['flightaware_id']; |
21 | 21 | } |
22 | - if(isset($spotter_array[0]['last_latitude']) && $spotter_array[0]['last_latitude'] != '') { |
|
22 | + if (isset($spotter_array[0]['last_latitude']) && $spotter_array[0]['last_latitude'] != '') { |
|
23 | 23 | $latitude = $spotter_array[0]['last_latitude']; |
24 | - } elseif(isset($spotter_array[0]['latitude'])) { |
|
24 | + } elseif (isset($spotter_array[0]['latitude'])) { |
|
25 | 25 | $latitude = $spotter_array[0]['latitude']; |
26 | 26 | } |
27 | - if(isset($spotter_array[0]['last_longitude']) && $spotter_array[0]['last_longitude'] != '') { |
|
27 | + if (isset($spotter_array[0]['last_longitude']) && $spotter_array[0]['last_longitude'] != '') { |
|
28 | 28 | $longitude = $spotter_array[0]['last_longitude']; |
29 | - } elseif(isset($spotter_array[0]['longitude'])) { |
|
29 | + } elseif (isset($spotter_array[0]['longitude'])) { |
|
30 | 30 | $longitude = $spotter_array[0]['longitude']; |
31 | 31 | } |
32 | 32 | $title = ''; |
33 | - if(isset($spotter_array[0]['ident'])) { |
|
33 | + if (isset($spotter_array[0]['ident'])) { |
|
34 | 34 | $title .= $spotter_array[0]['ident']; |
35 | 35 | } |
36 | - if(isset($spotter_array[0]['airline_name'])) { |
|
36 | + if (isset($spotter_array[0]['airline_name'])) { |
|
37 | 37 | $title .= ' - '.$spotter_array[0]['airline_name']; |
38 | 38 | } |
39 | - if(isset($spotter_array[0]['aircraft_name']) && $spotter_array[0]['aircraft_name'] != 'Not Available') { |
|
39 | + if (isset($spotter_array[0]['aircraft_name']) && $spotter_array[0]['aircraft_name'] != 'Not Available') { |
|
40 | 40 | $title .= ' - '.$spotter_array[0]['aircraft_name'].' ('.$spotter_array[0]['aircraft_type'].')'; |
41 | 41 | } |
42 | - if(isset($spotter_array[0]['registration']) && $spotter_array[0]['registration'] != 'NA' && $spotter_array[0]['registration'] != 'N/A') { |
|
42 | + if (isset($spotter_array[0]['registration']) && $spotter_array[0]['registration'] != 'NA' && $spotter_array[0]['registration'] != 'N/A') { |
|
43 | 43 | $title .= ' - '.$spotter_array[0]['registration']; |
44 | 44 | } |
45 | 45 | //$facebook_meta_image = $spotter_array[0]['image']; |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | $altitude_data = ''; |
60 | 60 | $hour_data = ''; |
61 | 61 | $speed_data = ''; |
62 | - foreach($all_data as $data) |
|
62 | + foreach ($all_data as $data) |
|
63 | 63 | { |
64 | 64 | $hour_data .= '"'.$data['date'].'",'; |
65 | 65 | if (isset($data['real_altitude']) && $data['real_altitude'] != '') { |
@@ -87,8 +87,8 @@ discard block |
||
87 | 87 | $speed_data .= $speed.','; |
88 | 88 | } |
89 | 89 | $hour_data = "['x',".substr($hour_data, 0, -1)."]"; |
90 | - $altitude_data = "['altitude',".substr($altitude_data,0,-1)."]"; |
|
91 | - $speed_data = "['speed',".substr($speed_data,0,-1)."]"; |
|
90 | + $altitude_data = "['altitude',".substr($altitude_data, 0, -1)."]"; |
|
91 | + $speed_data = "['speed',".substr($speed_data, 0, -1)."]"; |
|
92 | 92 | print 'c3.generate({ |
93 | 93 | bindto: "#chart", |
94 | 94 | data: { |
@@ -134,16 +134,16 @@ discard block |
||
134 | 134 | print '<a href="'.$globalURL.'/airline/'.$spotter_array[0]['airline_icao'].'">'.$spotter_array[0]['airline_name'].'</a> '; |
135 | 135 | } |
136 | 136 | } |
137 | - if(isset($spotter_array[0]['ident'])) { |
|
137 | + if (isset($spotter_array[0]['ident'])) { |
|
138 | 138 | print $spotter_array[0]['ident']; |
139 | 139 | } |
140 | - if(isset($spotter_array[0]['airline_name'])) { |
|
140 | + if (isset($spotter_array[0]['airline_name'])) { |
|
141 | 141 | print ' - '.$spotter_array[0]['airline_name']; |
142 | 142 | } |
143 | - if(isset($spotter_array[0]['aircraft_name']) && $spotter_array[0]['aircraft_name'] != 'Not Available') { |
|
143 | + if (isset($spotter_array[0]['aircraft_name']) && $spotter_array[0]['aircraft_name'] != 'Not Available') { |
|
144 | 144 | print ' - '.$spotter_array[0]['aircraft_name'].' ('.$spotter_array[0]['aircraft_type'].')'; |
145 | 145 | } |
146 | - if(isset($spotter_array[0]['registration']) && $spotter_array[0]['registration'] != 'NA') { |
|
146 | + if (isset($spotter_array[0]['registration']) && $spotter_array[0]['registration'] != 'NA') { |
|
147 | 147 | print ' - '.$spotter_array[0]['registration']; |
148 | 148 | } |
149 | 149 | print '</h1>'; |
@@ -297,7 +297,7 @@ discard block |
||
297 | 297 | print '</div>'; |
298 | 298 | */ |
299 | 299 | |
300 | - foreach($spotter_array as $spotter_item) |
|
300 | + foreach ($spotter_array as $spotter_item) |
|
301 | 301 | { |
302 | 302 | print '<div class="details">'; |
303 | 303 | print '<h3>'._("Flight Information").'</h3>'; |
@@ -397,7 +397,7 @@ discard block |
||
397 | 397 | if (isset($spotter_item['departure_airport_time']) && $spotter_item['departure_airport_time'] != '') { |
398 | 398 | if ($spotter_item['departure_airport_time'] > 2460) { |
399 | 399 | print '<div class="time">'; |
400 | - print 'at '.date('H:m',$spotter_item['departure_airport_time']); |
|
400 | + print 'at '.date('H:m', $spotter_item['departure_airport_time']); |
|
401 | 401 | print '</div>'; |
402 | 402 | } else { |
403 | 403 | print '<div class="time">'; |
@@ -546,19 +546,19 @@ discard block |
||
546 | 546 | $departure_airport_info = $Spotter->getAllAirportInfo($spotter_item['departure_airport']); |
547 | 547 | if (isset($spotter_item['last_latitude']) && $spotter_item['last_latitude'] != '') { |
548 | 548 | if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'nm') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'nm')) { |
549 | - print $Common->distance($spotter_item['last_latitude'],$spotter_item['last_longitude'],$departure_airport_info[0]['latitude'],$departure_airport_info[0]['longitude'],'nm').' nm'; |
|
549 | + print $Common->distance($spotter_item['last_latitude'], $spotter_item['last_longitude'], $departure_airport_info[0]['latitude'], $departure_airport_info[0]['longitude'], 'nm').' nm'; |
|
550 | 550 | } elseif ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'mi') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'mi')) { |
551 | - print $Common->distance($spotter_item['last_latitude'],$spotter_item['last_longitude'],$departure_airport_info[0]['latitude'],$departure_airport_info[0]['longitude'],'mi').' mi'; |
|
551 | + print $Common->distance($spotter_item['last_latitude'], $spotter_item['last_longitude'], $departure_airport_info[0]['latitude'], $departure_airport_info[0]['longitude'], 'mi').' mi'; |
|
552 | 552 | } else { |
553 | - print $Common->distance($spotter_item['last_latitude'],$spotter_item['last_longitude'],$departure_airport_info[0]['latitude'],$departure_airport_info[0]['longitude'],'km').' km'; |
|
553 | + print $Common->distance($spotter_item['last_latitude'], $spotter_item['last_longitude'], $departure_airport_info[0]['latitude'], $departure_airport_info[0]['longitude'], 'km').' km'; |
|
554 | 554 | } |
555 | 555 | } else { |
556 | 556 | if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'nm') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'nm')) { |
557 | - print $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$departure_airport_info[0]['latitude'],$departure_airport_info[0]['longitude'],'nm').' nm'; |
|
557 | + print $Common->distance($spotter_item['latitude'], $spotter_item['longitude'], $departure_airport_info[0]['latitude'], $departure_airport_info[0]['longitude'], 'nm').' nm'; |
|
558 | 558 | } elseif ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'mi') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'mi')) { |
559 | - print $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$departure_airport_info[0]['latitude'],$departure_airport_info[0]['longitude'],'mi').' mi'; |
|
559 | + print $Common->distance($spotter_item['latitude'], $spotter_item['longitude'], $departure_airport_info[0]['latitude'], $departure_airport_info[0]['longitude'], 'mi').' mi'; |
|
560 | 560 | } else { |
561 | - print $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$departure_airport_info[0]['latitude'],$departure_airport_info[0]['longitude'],'km').' km'; |
|
561 | + print $Common->distance($spotter_item['latitude'], $spotter_item['longitude'], $departure_airport_info[0]['latitude'], $departure_airport_info[0]['longitude'], 'km').' km'; |
|
562 | 562 | } |
563 | 563 | } |
564 | 564 | print '</div>'; |
@@ -572,19 +572,19 @@ discard block |
||
572 | 572 | $arrival_airport_info = $Spotter->getAllAirportInfo($spotter_item['arrival_airport']); |
573 | 573 | if (isset($spotter_item['last_latitude']) && $spotter_item['last_latitude'] != '') { |
574 | 574 | if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'nm') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'nm')) { |
575 | - print $Common->distance($spotter_item['last_latitude'],$spotter_item['last_longitude'],$arrival_airport_info[0]['latitude'],$arrival_airport_info[0]['longitude'],'nm').' nm'; |
|
575 | + print $Common->distance($spotter_item['last_latitude'], $spotter_item['last_longitude'], $arrival_airport_info[0]['latitude'], $arrival_airport_info[0]['longitude'], 'nm').' nm'; |
|
576 | 576 | } elseif ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'mi') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'mi')) { |
577 | - print $Common->distance($spotter_item['last_latitude'],$spotter_item['last_longitude'],$arrival_airport_info[0]['latitude'],$arrival_airport_info[0]['longitude'],'mi').' mi'; |
|
577 | + print $Common->distance($spotter_item['last_latitude'], $spotter_item['last_longitude'], $arrival_airport_info[0]['latitude'], $arrival_airport_info[0]['longitude'], 'mi').' mi'; |
|
578 | 578 | } else { |
579 | - print $Common->distance($spotter_item['last_latitude'],$spotter_item['last_longitude'],$arrival_airport_info[0]['latitude'],$arrival_airport_info[0]['longitude'],'km').' km'; |
|
579 | + print $Common->distance($spotter_item['last_latitude'], $spotter_item['last_longitude'], $arrival_airport_info[0]['latitude'], $arrival_airport_info[0]['longitude'], 'km').' km'; |
|
580 | 580 | } |
581 | 581 | } else { |
582 | 582 | if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'nm') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'nm')) { |
583 | - print $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$arrival_airport_info[0]['latitude'],$arrival_airport_info[0]['longitude'],'nm').' nm'; |
|
583 | + print $Common->distance($spotter_item['latitude'], $spotter_item['longitude'], $arrival_airport_info[0]['latitude'], $arrival_airport_info[0]['longitude'], 'nm').' nm'; |
|
584 | 584 | } elseif ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'mi') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'mi')) { |
585 | - print $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$arrival_airport_info[0]['latitude'],$arrival_airport_info[0]['longitude'],'mi').' mi'; |
|
585 | + print $Common->distance($spotter_item['latitude'], $spotter_item['longitude'], $arrival_airport_info[0]['latitude'], $arrival_airport_info[0]['longitude'], 'mi').' mi'; |
|
586 | 586 | } else { |
587 | - print $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$arrival_airport_info[0]['latitude'],$arrival_airport_info[0]['longitude'],'km').' km'; |
|
587 | + print $Common->distance($spotter_item['latitude'], $spotter_item['longitude'], $arrival_airport_info[0]['latitude'], $arrival_airport_info[0]['longitude'], 'km').' km'; |
|
588 | 588 | } |
589 | 589 | } |
590 | 590 | print '</div>'; |
@@ -603,7 +603,7 @@ discard block |
||
603 | 603 | print '<div class="last-flights">'; |
604 | 604 | print '<h3>'._("Last 5 Flights of this Aircraft").' ('.$spotter_array[0]['registration'].')</h3>'; |
605 | 605 | $hide_th_links = true; |
606 | - $spotter_array = $Spotter->getSpotterDataByRegistration($spotter_array[0]['registration'],"0,5", ""); |
|
606 | + $spotter_array = $Spotter->getSpotterDataByRegistration($spotter_array[0]['registration'], "0,5", ""); |
|
607 | 607 | include('table-output.php'); |
608 | 608 | print '<div class="more">'; |
609 | 609 | print '<a href="'.$globalURL.'/registration/'.$spotter_array[0]['registration'].'" class="btn btn-default btn" role="button">See all Flights»</a>'; |
@@ -13,62 +13,62 @@ discard block |
||
13 | 13 | * @param Array $filter the filter |
14 | 14 | * @return Array the SQL part |
15 | 15 | */ |
16 | - public function getFilter($filter = array(),$where = false,$and = false) { |
|
16 | + public function getFilter($filter = array(), $where = false, $and = false) { |
|
17 | 17 | global $globalFilter, $globalStatsFilters, $globalFilterName, $globalDBdriver; |
18 | 18 | $filters = array(); |
19 | 19 | if (is_array($globalStatsFilters) && isset($globalStatsFilters[$globalFilterName])) { |
20 | 20 | if (isset($globalStatsFilters[$globalFilterName][0]['source'])) { |
21 | 21 | $filters = $globalStatsFilters[$globalFilterName]; |
22 | 22 | } else { |
23 | - $filter = array_merge($filter,$globalStatsFilters[$globalFilterName]); |
|
23 | + $filter = array_merge($filter, $globalStatsFilters[$globalFilterName]); |
|
24 | 24 | } |
25 | 25 | } |
26 | 26 | if (isset($filter[0]['source'])) { |
27 | - $filters = array_merge($filters,$filter); |
|
27 | + $filters = array_merge($filters, $filter); |
|
28 | 28 | } |
29 | - if (is_array($globalFilter)) $filter = array_merge($filter,$globalFilter); |
|
29 | + if (is_array($globalFilter)) $filter = array_merge($filter, $globalFilter); |
|
30 | 30 | $filter_query_join = ''; |
31 | 31 | $filter_query_where = ''; |
32 | - foreach($filters as $flt) { |
|
32 | + foreach ($filters as $flt) { |
|
33 | 33 | if (isset($flt['airlines']) && !empty($flt['airlines'])) { |
34 | 34 | if ($flt['airlines'][0] != '') { |
35 | 35 | if (isset($flt['source'])) { |
36 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.airline_icao IN ('".implode("','",$flt['airlines'])."') AND spotter_archive_output.format_source IN ('".implode("','",$flt['source'])."')) saff ON saff.flightaware_id = spotter_archive_output.flightaware_id"; |
|
36 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.airline_icao IN ('".implode("','", $flt['airlines'])."') AND spotter_archive_output.format_source IN ('".implode("','", $flt['source'])."')) saff ON saff.flightaware_id = spotter_archive_output.flightaware_id"; |
|
37 | 37 | } else { |
38 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.airline_icao IN ('".implode("','",$flt['airlines'])."')) saff ON saff.flightaware_id = spotter_archive_output.flightaware_id"; |
|
38 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.airline_icao IN ('".implode("','", $flt['airlines'])."')) saff ON saff.flightaware_id = spotter_archive_output.flightaware_id"; |
|
39 | 39 | } |
40 | 40 | } |
41 | 41 | } |
42 | 42 | if (isset($flt['pilots_id']) && !empty($flt['pilots_id'])) { |
43 | 43 | if (isset($flt['source'])) { |
44 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.pilot_id IN ('".implode("','",$flt['pilots_id'])."') AND spotter_archive_output.format_source IN ('".implode("','",$flt['source'])."')) sp ON sp.flightaware_id = spotter_archive_output.flightaware_id"; |
|
44 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.pilot_id IN ('".implode("','", $flt['pilots_id'])."') AND spotter_archive_output.format_source IN ('".implode("','", $flt['source'])."')) sp ON sp.flightaware_id = spotter_archive_output.flightaware_id"; |
|
45 | 45 | } else { |
46 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.pilot_id IN ('".implode("','",$flt['pilots_id'])."')) sp ON sp.flightaware_id = spotter_archive_output.flightaware_id"; |
|
46 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.pilot_id IN ('".implode("','", $flt['pilots_id'])."')) sp ON sp.flightaware_id = spotter_archive_output.flightaware_id"; |
|
47 | 47 | } |
48 | 48 | } |
49 | 49 | if (isset($flt['idents']) && !empty($flt['idents'])) { |
50 | 50 | if (isset($flt['source'])) { |
51 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.ident IN ('".implode("','",$flt['idents'])."') AND spotter_archive_output.format_source IN ('".implode("','",$flt['source'])."')) spi ON spi.flightaware_id = spotter_archive_output.flightaware_id"; |
|
51 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.ident IN ('".implode("','", $flt['idents'])."') AND spotter_archive_output.format_source IN ('".implode("','", $flt['source'])."')) spi ON spi.flightaware_id = spotter_archive_output.flightaware_id"; |
|
52 | 52 | } else { |
53 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.ident IN ('".implode("','",$flt['idents'])."')) spi ON spi.flightaware_id = spotter_archive_output.flightaware_id"; |
|
53 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.ident IN ('".implode("','", $flt['idents'])."')) spi ON spi.flightaware_id = spotter_archive_output.flightaware_id"; |
|
54 | 54 | } |
55 | 55 | } |
56 | 56 | if (isset($flt['registrations']) && !empty($flt['registrations'])) { |
57 | 57 | if (isset($flt['source'])) { |
58 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.registration IN ('".implode("','",$flt['registrations'])."') AND spotter_archive_output.format_source IN ('".implode("','",$flt['source'])."')) sre ON sre.flightaware_id = spotter_archive_output.flightaware_id"; |
|
58 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.registration IN ('".implode("','", $flt['registrations'])."') AND spotter_archive_output.format_source IN ('".implode("','", $flt['source'])."')) sre ON sre.flightaware_id = spotter_archive_output.flightaware_id"; |
|
59 | 59 | } else { |
60 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.registration IN ('".implode("','",$flt['registrations'])."')) sre ON sre.flightaware_id = spotter_archive_output.flightaware_id"; |
|
60 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.registration IN ('".implode("','", $flt['registrations'])."')) sre ON sre.flightaware_id = spotter_archive_output.flightaware_id"; |
|
61 | 61 | } |
62 | 62 | } |
63 | 63 | if ((isset($flt['airlines']) && empty($flt['airlines']) && isset($flt['pilots_id']) && empty($flt['pilots_id']) && isset($flt['idents']) && empty($flt['idents']) && isset($flt['registrations']) && empty($flt['registrations'])) || (!isset($flt['airlines']) && !isset($flt['pilots_id']) && !isset($flt['idents']) && !isset($flt['registrations']))) { |
64 | 64 | if (isset($flt['source'])) { |
65 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_output.format_source IN ('".implode("','",$flt['source'])."')) saa ON saa.flightaware_id = spotter_archive_output.flightaware_id"; |
|
65 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_output.format_source IN ('".implode("','", $flt['source'])."')) saa ON saa.flightaware_id = spotter_archive_output.flightaware_id"; |
|
66 | 66 | } |
67 | 67 | } |
68 | 68 | } |
69 | 69 | if (isset($filter['airlines']) && !empty($filter['airlines'])) { |
70 | 70 | if ($filter['airlines'][0] != '') { |
71 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.airline_icao IN ('".implode("','",$filter['airlines'])."')) saf ON saf.flightaware_id = spotter_archive_output.flightaware_id"; |
|
71 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.airline_icao IN ('".implode("','", $filter['airlines'])."')) saf ON saf.flightaware_id = spotter_archive_output.flightaware_id"; |
|
72 | 72 | } |
73 | 73 | } |
74 | 74 | |
@@ -76,16 +76,16 @@ discard block |
||
76 | 76 | $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.airline_type = '".$filter['airlinestype']."') sa ON sa.flightaware_id = spotter_archive_output.flightaware_id "; |
77 | 77 | } |
78 | 78 | if (isset($filter['pilots_id']) && !empty($filter['pilots_id'])) { |
79 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.pilot_id IN ('".implode("','",$filter['pilots_id'])."')) spi ON spi.flightaware_id = spotter_archive_output.flightaware_id"; |
|
79 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.pilot_id IN ('".implode("','", $filter['pilots_id'])."')) spi ON spi.flightaware_id = spotter_archive_output.flightaware_id"; |
|
80 | 80 | } |
81 | 81 | if (isset($filter['source']) && !empty($filter['source'])) { |
82 | - $filter_query_where .= " AND format_source IN ('".implode("','",$filter['source'])."')"; |
|
82 | + $filter_query_where .= " AND format_source IN ('".implode("','", $filter['source'])."')"; |
|
83 | 83 | } |
84 | 84 | if (isset($filter['ident']) && !empty($filter['ident'])) { |
85 | 85 | $filter_query_where .= " AND ident = '".$filter['ident']."'"; |
86 | 86 | } |
87 | 87 | if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) { |
88 | - $filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')"; |
|
88 | + $filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','", $filter['source_aprs'])."')"; |
|
89 | 89 | } |
90 | 90 | if ((isset($filter['year']) && $filter['year'] != '') || (isset($filter['month']) && $filter['month'] != '') || (isset($filter['day']) && $filter['day'] != '')) { |
91 | 91 | $filter_query_date = ''; |
@@ -111,41 +111,41 @@ discard block |
||
111 | 111 | $filter_query_date .= " AND EXTRACT(DAY FROM spotter_archive_output.date) = '".$filter['day']."'"; |
112 | 112 | } |
113 | 113 | } |
114 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output".preg_replace('/^ AND/',' WHERE',$filter_query_date).") sd ON sd.flightaware_id = spotter_archive_output.flightaware_id"; |
|
114 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output".preg_replace('/^ AND/', ' WHERE', $filter_query_date).") sd ON sd.flightaware_id = spotter_archive_output.flightaware_id"; |
|
115 | 115 | } |
116 | 116 | if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE'; |
117 | 117 | elseif ($filter_query_where != '' && $and) $filter_query_where .= ' AND'; |
118 | 118 | if ($filter_query_where != '') { |
119 | - $filter_query_where = preg_replace('/^ AND/',' WHERE',$filter_query_where); |
|
119 | + $filter_query_where = preg_replace('/^ AND/', ' WHERE', $filter_query_where); |
|
120 | 120 | } |
121 | 121 | $filter_query = $filter_query_join.$filter_query_where; |
122 | 122 | return $filter_query; |
123 | 123 | } |
124 | 124 | |
125 | 125 | // Spotter_archive |
126 | - public function addSpotterArchiveData($flightaware_id = '', $ident = '', $registration = '', $airline_name = '', $airline_icao = '', $airline_country = '', $airline_type = '', $aircraft_icao = '', $aircraft_shadow = '', $aircraft_name = '', $aircraft_manufacturer = '', $departure_airport_icao = '', $departure_airport_name = '', $departure_airport_city = '', $departure_airport_country = '', $departure_airport_time = '',$arrival_airport_icao = '', $arrival_airport_name = '', $arrival_airport_city ='', $arrival_airport_country = '', $arrival_airport_time = '', $route_stop = '', $date = '',$latitude = '', $longitude = '', $waypoints = '', $altitude = '', $real_altitude = '',$heading = '', $ground_speed = '', $squawk = '', $ModeS = '', $pilot_id = '', $pilot_name = '',$verticalrate = '',$format_source = '', $source_name = '', $over_country = '') { |
|
126 | + public function addSpotterArchiveData($flightaware_id = '', $ident = '', $registration = '', $airline_name = '', $airline_icao = '', $airline_country = '', $airline_type = '', $aircraft_icao = '', $aircraft_shadow = '', $aircraft_name = '', $aircraft_manufacturer = '', $departure_airport_icao = '', $departure_airport_name = '', $departure_airport_city = '', $departure_airport_country = '', $departure_airport_time = '', $arrival_airport_icao = '', $arrival_airport_name = '', $arrival_airport_city = '', $arrival_airport_country = '', $arrival_airport_time = '', $route_stop = '', $date = '', $latitude = '', $longitude = '', $waypoints = '', $altitude = '', $real_altitude = '', $heading = '', $ground_speed = '', $squawk = '', $ModeS = '', $pilot_id = '', $pilot_name = '', $verticalrate = '', $format_source = '', $source_name = '', $over_country = '') { |
|
127 | 127 | require_once(dirname(__FILE__).'/class.Spotter.php'); |
128 | 128 | if ($over_country == '') { |
129 | 129 | $Spotter = new Spotter($this->db); |
130 | - $data_country = $Spotter->getCountryFromLatitudeLongitude($latitude,$longitude); |
|
130 | + $data_country = $Spotter->getCountryFromLatitudeLongitude($latitude, $longitude); |
|
131 | 131 | if (!empty($data_country)) $country = $data_country['iso2']; |
132 | 132 | else $country = ''; |
133 | 133 | } else $country = $over_country; |
134 | - if ($airline_type === NULL) $airline_type =''; |
|
134 | + if ($airline_type === NULL) $airline_type = ''; |
|
135 | 135 | |
136 | 136 | //if ($country == '') echo "\n".'************ UNKNOW COUNTRY ****************'."\n"; |
137 | 137 | //else echo "\n".'*/*/*/*/*/*/*/ Country : '.$country.' */*/*/*/*/*/*/*/*/'."\n"; |
138 | 138 | |
139 | 139 | // Route is not added in spotter_archive |
140 | - $query = "INSERT INTO spotter_archive (flightaware_id, ident, registration, airline_name, airline_icao, airline_country, airline_type, aircraft_icao, aircraft_shadow, aircraft_name, aircraft_manufacturer, departure_airport_icao, departure_airport_name, departure_airport_city, departure_airport_country, departure_airport_time,arrival_airport_icao, arrival_airport_name, arrival_airport_city, arrival_airport_country, arrival_airport_time, route_stop, date,latitude, longitude, waypoints, altitude, heading, ground_speed, squawk, ModeS, pilot_id, pilot_name, verticalrate,format_source,over_country,source_name,real_altitude) |
|
140 | + $query = "INSERT INTO spotter_archive (flightaware_id, ident, registration, airline_name, airline_icao, airline_country, airline_type, aircraft_icao, aircraft_shadow, aircraft_name, aircraft_manufacturer, departure_airport_icao, departure_airport_name, departure_airport_city, departure_airport_country, departure_airport_time,arrival_airport_icao, arrival_airport_name, arrival_airport_city, arrival_airport_country, arrival_airport_time, route_stop, date,latitude, longitude, waypoints, altitude, heading, ground_speed, squawk, ModeS, pilot_id, pilot_name, verticalrate,format_source,over_country,source_name,real_altitude) |
|
141 | 141 | VALUES (:flightaware_id, :ident, :registration, :airline_name, :airline_icao, :airline_country, :airline_type, :aircraft_icao, :aircraft_shadow, :aircraft_name, :aircraft_manufacturer, :departure_airport_icao, :departure_airport_name, :departure_airport_city, :departure_airport_country, :departure_airport_time,:arrival_airport_icao, :arrival_airport_name, :arrival_airport_city, :arrival_airport_country, :arrival_airport_time, :route_stop, :date,:latitude, :longitude, :waypoints, :altitude, :heading, :ground_speed, :squawk, :ModeS, :pilot_id, :pilot_name, :verticalrate, :format_source, :over_country, :source_name,:real_altitude)"; |
142 | 142 | |
143 | - $query_values = array(':flightaware_id' => $flightaware_id, ':ident' => $ident, ':registration' => $registration, ':airline_name' => $airline_name, ':airline_icao' => $airline_icao, ':airline_country' => $airline_country, ':airline_type' => $airline_type, ':aircraft_icao' => $aircraft_icao, ':aircraft_shadow' => $aircraft_shadow, ':aircraft_name' => $aircraft_name, ':aircraft_manufacturer' => $aircraft_manufacturer, ':departure_airport_icao' => $departure_airport_icao, ':departure_airport_name' => $departure_airport_name, ':departure_airport_city' => $departure_airport_city, ':departure_airport_country' => $departure_airport_country, ':departure_airport_time' => $departure_airport_time,':arrival_airport_icao' => $arrival_airport_icao, ':arrival_airport_name' => $arrival_airport_name, ':arrival_airport_city' => $arrival_airport_city, ':arrival_airport_country' => $arrival_airport_country, ':arrival_airport_time' => $arrival_airport_time, ':route_stop' => $route_stop, ':date' => $date,':latitude' => $latitude, ':longitude' => $longitude, ':waypoints' => $waypoints, ':altitude' => $altitude, ':heading' => $heading, ':ground_speed' => $ground_speed, ':squawk' => $squawk, ':ModeS' => $ModeS, ':pilot_id' => $pilot_id, ':pilot_name' => $pilot_name, ':verticalrate' => $verticalrate, ':format_source' => $format_source, ':over_country' => $country, ':source_name' => $source_name,':real_altitude' => $real_altitude); |
|
143 | + $query_values = array(':flightaware_id' => $flightaware_id, ':ident' => $ident, ':registration' => $registration, ':airline_name' => $airline_name, ':airline_icao' => $airline_icao, ':airline_country' => $airline_country, ':airline_type' => $airline_type, ':aircraft_icao' => $aircraft_icao, ':aircraft_shadow' => $aircraft_shadow, ':aircraft_name' => $aircraft_name, ':aircraft_manufacturer' => $aircraft_manufacturer, ':departure_airport_icao' => $departure_airport_icao, ':departure_airport_name' => $departure_airport_name, ':departure_airport_city' => $departure_airport_city, ':departure_airport_country' => $departure_airport_country, ':departure_airport_time' => $departure_airport_time, ':arrival_airport_icao' => $arrival_airport_icao, ':arrival_airport_name' => $arrival_airport_name, ':arrival_airport_city' => $arrival_airport_city, ':arrival_airport_country' => $arrival_airport_country, ':arrival_airport_time' => $arrival_airport_time, ':route_stop' => $route_stop, ':date' => $date, ':latitude' => $latitude, ':longitude' => $longitude, ':waypoints' => $waypoints, ':altitude' => $altitude, ':heading' => $heading, ':ground_speed' => $ground_speed, ':squawk' => $squawk, ':ModeS' => $ModeS, ':pilot_id' => $pilot_id, ':pilot_name' => $pilot_name, ':verticalrate' => $verticalrate, ':format_source' => $format_source, ':over_country' => $country, ':source_name' => $source_name, ':real_altitude' => $real_altitude); |
|
144 | 144 | try { |
145 | 145 | $sth = $this->db->prepare($query); |
146 | 146 | $sth->execute($query_values); |
147 | 147 | $sth->closeCursor(); |
148 | - } catch(PDOException $e) { |
|
148 | + } catch (PDOException $e) { |
|
149 | 149 | return "error : ".$e->getMessage(); |
150 | 150 | } |
151 | 151 | return "success"; |
@@ -165,9 +165,9 @@ discard block |
||
165 | 165 | |
166 | 166 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
167 | 167 | //$query = "SELECT spotter_archive.* FROM spotter_archive INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_archive l WHERE l.ident = :ident GROUP BY l.flightaware_id) s on spotter_archive.flightaware_id = s.flightaware_id AND spotter_archive.date = s.maxdate LIMIT 1"; |
168 | - $query = "SELECT spotter_archive.* FROM spotter_archive WHERE ident = :ident ORDER BY date DESC LIMIT 1"; |
|
168 | + $query = "SELECT spotter_archive.* FROM spotter_archive WHERE ident = :ident ORDER BY date DESC LIMIT 1"; |
|
169 | 169 | |
170 | - $spotter_array = $Spotter->getDataFromDB($query,array(':ident' => $ident)); |
|
170 | + $spotter_array = $Spotter->getDataFromDB($query, array(':ident' => $ident)); |
|
171 | 171 | |
172 | 172 | return $spotter_array; |
173 | 173 | } |
@@ -186,7 +186,7 @@ discard block |
||
186 | 186 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
187 | 187 | //$query = SpotterArchive->$global_query." WHERE spotter_archive.flightaware_id = :id"; |
188 | 188 | //$query = "SELECT spotter_archive.* FROM spotter_archive INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_archive l WHERE l.flightaware_id = :id GROUP BY l.flightaware_id) s on spotter_archive.flightaware_id = s.flightaware_id AND spotter_archive.date = s.maxdate LIMIT 1"; |
189 | - $query = "SELECT * FROM spotter_archive WHERE flightaware_id = :id ORDER BY date DESC LIMIT 1"; |
|
189 | + $query = "SELECT * FROM spotter_archive WHERE flightaware_id = :id ORDER BY date DESC LIMIT 1"; |
|
190 | 190 | |
191 | 191 | // $spotter_array = Spotter->getDataFromDB($query,array(':id' => $id)); |
192 | 192 | /* |
@@ -199,7 +199,7 @@ discard block |
||
199 | 199 | } |
200 | 200 | $spotter_array = $sth->fetchAll(PDO->FETCH_ASSOC); |
201 | 201 | */ |
202 | - $spotter_array = $Spotter->getDataFromDB($query,array(':id' => $id)); |
|
202 | + $spotter_array = $Spotter->getDataFromDB($query, array(':id' => $id)); |
|
203 | 203 | |
204 | 204 | return $spotter_array; |
205 | 205 | } |
@@ -214,14 +214,14 @@ discard block |
||
214 | 214 | { |
215 | 215 | date_default_timezone_set('UTC'); |
216 | 216 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
217 | - $query = $this->global_query." WHERE spotter_archive.flightaware_id = :id ORDER BY date"; |
|
217 | + $query = $this->global_query." WHERE spotter_archive.flightaware_id = :id ORDER BY date"; |
|
218 | 218 | |
219 | 219 | // $spotter_array = Spotter->getDataFromDB($query,array(':id' => $id)); |
220 | 220 | |
221 | 221 | try { |
222 | 222 | $sth = $this->db->prepare($query); |
223 | 223 | $sth->execute(array(':id' => $id)); |
224 | - } catch(PDOException $e) { |
|
224 | + } catch (PDOException $e) { |
|
225 | 225 | echo $e->getMessage(); |
226 | 226 | die; |
227 | 227 | } |
@@ -240,14 +240,14 @@ discard block |
||
240 | 240 | { |
241 | 241 | date_default_timezone_set('UTC'); |
242 | 242 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
243 | - $query = "SELECT spotter_archive.latitude, spotter_archive.longitude, spotter_archive.date FROM spotter_archive WHERE spotter_archive.flightaware_id = :id"; |
|
243 | + $query = "SELECT spotter_archive.latitude, spotter_archive.longitude, spotter_archive.date FROM spotter_archive WHERE spotter_archive.flightaware_id = :id"; |
|
244 | 244 | |
245 | 245 | // $spotter_array = Spotter->getDataFromDB($query,array(':id' => $id)); |
246 | 246 | |
247 | 247 | try { |
248 | 248 | $sth = $this->db->prepare($query); |
249 | 249 | $sth->execute(array(':id' => $id)); |
250 | - } catch(PDOException $e) { |
|
250 | + } catch (PDOException $e) { |
|
251 | 251 | echo $e->getMessage(); |
252 | 252 | die; |
253 | 253 | } |
@@ -269,12 +269,12 @@ discard block |
||
269 | 269 | date_default_timezone_set('UTC'); |
270 | 270 | |
271 | 271 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
272 | - $query = "SELECT spotter_archive.altitude, spotter_archive.date FROM spotter_archive WHERE spotter_archive.ident = :ident AND spotter_archive.latitude <> 0 AND spotter_archive.longitude <> 0 ORDER BY date"; |
|
272 | + $query = "SELECT spotter_archive.altitude, spotter_archive.date FROM spotter_archive WHERE spotter_archive.ident = :ident AND spotter_archive.latitude <> 0 AND spotter_archive.longitude <> 0 ORDER BY date"; |
|
273 | 273 | |
274 | 274 | try { |
275 | 275 | $sth = $this->db->prepare($query); |
276 | 276 | $sth->execute(array(':ident' => $ident)); |
277 | - } catch(PDOException $e) { |
|
277 | + } catch (PDOException $e) { |
|
278 | 278 | echo $e->getMessage(); |
279 | 279 | die; |
280 | 280 | } |
@@ -295,12 +295,12 @@ discard block |
||
295 | 295 | date_default_timezone_set('UTC'); |
296 | 296 | |
297 | 297 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
298 | - $query = "SELECT spotter_archive.altitude, spotter_archive.date FROM spotter_archive WHERE spotter_archive.flightaware_id = :id AND spotter_archive.latitude <> 0 AND spotter_archive.longitude <> 0 ORDER BY date"; |
|
298 | + $query = "SELECT spotter_archive.altitude, spotter_archive.date FROM spotter_archive WHERE spotter_archive.flightaware_id = :id AND spotter_archive.latitude <> 0 AND spotter_archive.longitude <> 0 ORDER BY date"; |
|
299 | 299 | |
300 | 300 | try { |
301 | 301 | $sth = $this->db->prepare($query); |
302 | 302 | $sth->execute(array(':id' => $id)); |
303 | - } catch(PDOException $e) { |
|
303 | + } catch (PDOException $e) { |
|
304 | 304 | echo $e->getMessage(); |
305 | 305 | die; |
306 | 306 | } |
@@ -321,12 +321,12 @@ discard block |
||
321 | 321 | date_default_timezone_set('UTC'); |
322 | 322 | |
323 | 323 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
324 | - $query = "SELECT spotter_archive.altitude, spotter_archive.real_altitude,spotter_archive.ground_speed, spotter_archive.date FROM spotter_archive WHERE spotter_archive.flightaware_id = :id ORDER BY date"; |
|
324 | + $query = "SELECT spotter_archive.altitude, spotter_archive.real_altitude,spotter_archive.ground_speed, spotter_archive.date FROM spotter_archive WHERE spotter_archive.flightaware_id = :id ORDER BY date"; |
|
325 | 325 | |
326 | 326 | try { |
327 | 327 | $sth = $this->db->prepare($query); |
328 | 328 | $sth->execute(array(':id' => $id)); |
329 | - } catch(PDOException $e) { |
|
329 | + } catch (PDOException $e) { |
|
330 | 330 | echo $e->getMessage(); |
331 | 331 | die; |
332 | 332 | } |
@@ -348,13 +348,13 @@ discard block |
||
348 | 348 | date_default_timezone_set('UTC'); |
349 | 349 | |
350 | 350 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
351 | - $query = "SELECT spotter_archive.altitude, spotter_archive.date FROM spotter_archive INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_archive l WHERE l.ident = :ident GROUP BY l.flightaware_id) s on spotter_archive.flightaware_id = s.flightaware_id AND spotter_archive.date = s.maxdate LIMIT 1"; |
|
351 | + $query = "SELECT spotter_archive.altitude, spotter_archive.date FROM spotter_archive INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_archive l WHERE l.ident = :ident GROUP BY l.flightaware_id) s on spotter_archive.flightaware_id = s.flightaware_id AND spotter_archive.date = s.maxdate LIMIT 1"; |
|
352 | 352 | // $query = "SELECT spotter_archive.altitude, spotter_archive.date FROM spotter_archive WHERE spotter_archive.ident = :ident"; |
353 | 353 | |
354 | 354 | try { |
355 | 355 | $sth = $this->db->prepare($query); |
356 | 356 | $sth->execute(array(':ident' => $ident)); |
357 | - } catch(PDOException $e) { |
|
357 | + } catch (PDOException $e) { |
|
358 | 358 | echo $e->getMessage(); |
359 | 359 | die; |
360 | 360 | } |
@@ -371,13 +371,13 @@ discard block |
||
371 | 371 | * @return Array the spotter information |
372 | 372 | * |
373 | 373 | */ |
374 | - public function getSpotterArchiveData($ident,$flightaware_id,$date) |
|
374 | + public function getSpotterArchiveData($ident, $flightaware_id, $date) |
|
375 | 375 | { |
376 | 376 | $Spotter = new Spotter($this->db); |
377 | 377 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
378 | - $query = "SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.ident = :ident AND l.flightaware_id = :flightaware_id AND l.date LIKE :date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate"; |
|
378 | + $query = "SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.ident = :ident AND l.flightaware_id = :flightaware_id AND l.date LIKE :date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate"; |
|
379 | 379 | |
380 | - $spotter_array = $Spotter->getDataFromDB($query,array(':ident' => $ident,':flightaware_id' => $flightaware_id,':date' => $date.'%')); |
|
380 | + $spotter_array = $Spotter->getDataFromDB($query, array(':ident' => $ident, ':flightaware_id' => $flightaware_id, ':date' => $date.'%')); |
|
381 | 381 | |
382 | 382 | return $spotter_array; |
383 | 383 | } |
@@ -393,7 +393,7 @@ discard block |
||
393 | 393 | try { |
394 | 394 | $sth = $this->db->prepare($query); |
395 | 395 | $sth->execute(); |
396 | - } catch(PDOException $e) { |
|
396 | + } catch (PDOException $e) { |
|
397 | 397 | echo $e->getMessage(); |
398 | 398 | die; |
399 | 399 | } |
@@ -405,24 +405,24 @@ discard block |
||
405 | 405 | * @return Array the spotter information |
406 | 406 | * |
407 | 407 | */ |
408 | - public function getMinLiveSpotterData($begindate,$enddate,$filter = array()) |
|
408 | + public function getMinLiveSpotterData($begindate, $enddate, $filter = array()) |
|
409 | 409 | { |
410 | 410 | global $globalDBdriver, $globalLiveInterval; |
411 | 411 | date_default_timezone_set('UTC'); |
412 | 412 | |
413 | 413 | $filter_query = ''; |
414 | 414 | if (isset($filter['source']) && !empty($filter['source'])) { |
415 | - $filter_query .= " AND format_source IN ('".implode("','",$filter['source'])."') "; |
|
415 | + $filter_query .= " AND format_source IN ('".implode("','", $filter['source'])."') "; |
|
416 | 416 | } |
417 | 417 | // Use spotter_output also ? |
418 | 418 | if (isset($filter['airlines']) && !empty($filter['airlines'])) { |
419 | - $filter_query .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.airline_icao IN ('".implode("','",$filter['airlines'])."')) so ON so.flightaware_id = spotter_archive.flightaware_id "; |
|
419 | + $filter_query .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.airline_icao IN ('".implode("','", $filter['airlines'])."')) so ON so.flightaware_id = spotter_archive.flightaware_id "; |
|
420 | 420 | } |
421 | 421 | if (isset($filter['airlinestype']) && !empty($filter['airlinestype'])) { |
422 | 422 | $filter_query .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.airline_type = '".$filter['airlinestype']."') sa ON sa.flightaware_id = spotter_archive.flightaware_id "; |
423 | 423 | } |
424 | 424 | if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) { |
425 | - $filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')"; |
|
425 | + $filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','", $filter['source_aprs'])."')"; |
|
426 | 426 | } |
427 | 427 | |
428 | 428 | //if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
@@ -441,14 +441,14 @@ discard block |
||
441 | 441 | GROUP BY l.flightaware_id) s on spotter_archive.flightaware_id = s.flightaware_id |
442 | 442 | AND spotter_archive.date = s.maxdate '.$filter_query.'LEFT JOIN (SELECT aircraft_shadow,icao FROM aircraft) a ON spotter_archive.aircraft_icao = a.icao'; |
443 | 443 | */ |
444 | - $query = 'SELECT spotter_archive.date,spotter_archive.flightaware_id, spotter_archive.ident, spotter_archive.aircraft_icao, spotter_archive.departure_airport_icao as departure_airport, spotter_archive.arrival_airport_icao as arrival_airport, spotter_archive.latitude, spotter_archive.longitude, spotter_archive.altitude, spotter_archive.heading, spotter_archive.ground_speed, spotter_archive.squawk, a.aircraft_shadow,a.engine_type, a.engine_count, a.wake_category |
|
444 | + $query = 'SELECT spotter_archive.date,spotter_archive.flightaware_id, spotter_archive.ident, spotter_archive.aircraft_icao, spotter_archive.departure_airport_icao as departure_airport, spotter_archive.arrival_airport_icao as arrival_airport, spotter_archive.latitude, spotter_archive.longitude, spotter_archive.altitude, spotter_archive.heading, spotter_archive.ground_speed, spotter_archive.squawk, a.aircraft_shadow,a.engine_type, a.engine_count, a.wake_category |
|
445 | 445 | FROM spotter_archive |
446 | 446 | INNER JOIN (SELECT * FROM aircraft) a on spotter_archive.aircraft_icao = a.icao |
447 | 447 | WHERE spotter_archive.date BETWEEN '."'".$begindate."'".' AND '."'".$begindate."'".' |
448 | 448 | '.$filter_query.' ORDER BY flightaware_id'; |
449 | 449 | } else { |
450 | 450 | //$query = 'SELECT spotter_archive.ident, spotter_archive.flightaware_id, spotter_archive.aircraft_icao, spotter_archive.departure_airport_icao as departure_airport, spotter_archive.arrival_airport_icao as arrival_airport, spotter_archive.latitude, spotter_archive.longitude, spotter_archive.altitude, spotter_archive.heading, spotter_archive.ground_speed, spotter_archive.squawk, a.aircraft_shadow FROM spotter_archive INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_archive l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.flightaware_id) s on spotter_archive.flightaware_id = s.flightaware_id AND spotter_archive.date = s.maxdate '.$filter_query.'INNER JOIN (SELECT * FROM aircraft) a on spotter_archive.aircraft_icao = a.icao'; |
451 | - $query = 'SELECT spotter_archive.date,spotter_archive.flightaware_id, spotter_archive.ident, spotter_archive.aircraft_icao, spotter_archive.departure_airport_icao as departure_airport, spotter_archive.arrival_airport_icao as arrival_airport, spotter_archive.latitude, spotter_archive.longitude, spotter_archive.altitude, spotter_archive.heading, spotter_archive.ground_speed, spotter_archive.squawk, a.aircraft_shadow,a.engine_type, a.engine_count, a.wake_category |
|
451 | + $query = 'SELECT spotter_archive.date,spotter_archive.flightaware_id, spotter_archive.ident, spotter_archive.aircraft_icao, spotter_archive.departure_airport_icao as departure_airport, spotter_archive.arrival_airport_icao as arrival_airport, spotter_archive.latitude, spotter_archive.longitude, spotter_archive.altitude, spotter_archive.heading, spotter_archive.ground_speed, spotter_archive.squawk, a.aircraft_shadow,a.engine_type, a.engine_count, a.wake_category |
|
452 | 452 | FROM spotter_archive |
453 | 453 | INNER JOIN (SELECT * FROM aircraft) a on spotter_archive.aircraft_icao = a.icao |
454 | 454 | WHERE spotter_archive.date >= '."'".$begindate."'".' AND spotter_archive.date <= '."'".$enddate."'".' |
@@ -458,7 +458,7 @@ discard block |
||
458 | 458 | try { |
459 | 459 | $sth = $this->db->prepare($query); |
460 | 460 | $sth->execute(); |
461 | - } catch(PDOException $e) { |
|
461 | + } catch (PDOException $e) { |
|
462 | 462 | echo $e->getMessage(); |
463 | 463 | die; |
464 | 464 | } |
@@ -473,24 +473,24 @@ discard block |
||
473 | 473 | * @return Array the spotter information |
474 | 474 | * |
475 | 475 | */ |
476 | - public function getMinLiveSpotterDataPlayback($begindate,$enddate,$filter = array()) |
|
476 | + public function getMinLiveSpotterDataPlayback($begindate, $enddate, $filter = array()) |
|
477 | 477 | { |
478 | 478 | global $globalDBdriver, $globalLiveInterval; |
479 | 479 | date_default_timezone_set('UTC'); |
480 | 480 | |
481 | 481 | $filter_query = ''; |
482 | 482 | if (isset($filter['source']) && !empty($filter['source'])) { |
483 | - $filter_query .= " AND format_source IN ('".implode("','",$filter['source'])."') "; |
|
483 | + $filter_query .= " AND format_source IN ('".implode("','", $filter['source'])."') "; |
|
484 | 484 | } |
485 | 485 | // Should use spotter_output also ? |
486 | 486 | if (isset($filter['airlines']) && !empty($filter['airlines'])) { |
487 | - $filter_query .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.airline_icao IN ('".implode("','",$filter['airlines'])."')) so ON so.flightaware_id = spotter_archive.flightaware_id "; |
|
487 | + $filter_query .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.airline_icao IN ('".implode("','", $filter['airlines'])."')) so ON so.flightaware_id = spotter_archive.flightaware_id "; |
|
488 | 488 | } |
489 | 489 | if (isset($filter['airlinestype']) && !empty($filter['airlinestype'])) { |
490 | 490 | $filter_query .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.airline_type = '".$filter['airlinestype']."') sa ON sa.flightaware_id = spotter_archive.flightaware_id "; |
491 | 491 | } |
492 | 492 | if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) { |
493 | - $filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')"; |
|
493 | + $filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','", $filter['source_aprs'])."')"; |
|
494 | 494 | } |
495 | 495 | |
496 | 496 | //if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
@@ -500,7 +500,7 @@ discard block |
||
500 | 500 | FROM spotter_archive |
501 | 501 | INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_archive l WHERE (l.date BETWEEN '."'".$begindate."'".' AND '."'".$enddate."'".') GROUP BY l.flightaware_id) s on spotter_archive.flightaware_id = s.flightaware_id AND spotter_archive.date = s.maxdate '.$filter_query.'LEFT JOIN (SELECT aircraft_shadow,icao FROM aircraft) a ON spotter_archive.aircraft_icao = a.icao'; |
502 | 502 | */ |
503 | - $query = 'SELECT a.aircraft_shadow, spotter_archive_output.ident, spotter_archive_output.flightaware_id, spotter_archive_output.aircraft_icao, spotter_archive_output.departure_airport_icao as departure_airport, spotter_archive_output.arrival_airport_icao as arrival_airport, spotter_archive_output.latitude, spotter_archive_output.longitude, spotter_archive_output.altitude, spotter_archive_output.heading, spotter_archive_output.ground_speed, spotter_archive_output.squawk |
|
503 | + $query = 'SELECT a.aircraft_shadow, spotter_archive_output.ident, spotter_archive_output.flightaware_id, spotter_archive_output.aircraft_icao, spotter_archive_output.departure_airport_icao as departure_airport, spotter_archive_output.arrival_airport_icao as arrival_airport, spotter_archive_output.latitude, spotter_archive_output.longitude, spotter_archive_output.altitude, spotter_archive_output.heading, spotter_archive_output.ground_speed, spotter_archive_output.squawk |
|
504 | 504 | FROM spotter_archive_output |
505 | 505 | LEFT JOIN (SELECT aircraft_shadow,icao FROM aircraft) a ON spotter_archive_output.aircraft_icao = a.icao |
506 | 506 | WHERE (spotter_archive_output.date BETWEEN '."'".$begindate."'".' AND '."'".$enddate."'".') |
@@ -515,7 +515,7 @@ discard block |
||
515 | 515 | WHERE spotter_archive_output.date >= '."'".$begindate."'".' AND spotter_archive_output.date <= '."'".$enddate."'".' |
516 | 516 | '.$filter_query.' GROUP BY spotter_archive_output.flightaware_id, spotter_archive_output.ident, spotter_archive_output.aircraft_icao, spotter_archive_output.departure_airport_icao, spotter_archive_output.arrival_airport_icao, spotter_archive_output.latitude, spotter_archive_output.longitude, spotter_archive_output.altitude, spotter_archive_output.heading, spotter_archive_output.ground_speed, spotter_archive_output.squawk, a.aircraft_shadow'; |
517 | 517 | */ |
518 | - $query = 'SELECT DISTINCT spotter_archive_output.flightaware_id, spotter_archive_output.ident, spotter_archive_output.aircraft_icao, spotter_archive_output.departure_airport_icao as departure_airport, spotter_archive_output.arrival_airport_icao as arrival_airport, spotter_archive_output.latitude, spotter_archive_output.longitude, spotter_archive_output.altitude, spotter_archive_output.heading, spotter_archive_output.ground_speed, spotter_archive_output.squawk, a.aircraft_shadow |
|
518 | + $query = 'SELECT DISTINCT spotter_archive_output.flightaware_id, spotter_archive_output.ident, spotter_archive_output.aircraft_icao, spotter_archive_output.departure_airport_icao as departure_airport, spotter_archive_output.arrival_airport_icao as arrival_airport, spotter_archive_output.latitude, spotter_archive_output.longitude, spotter_archive_output.altitude, spotter_archive_output.heading, spotter_archive_output.ground_speed, spotter_archive_output.squawk, a.aircraft_shadow |
|
519 | 519 | FROM spotter_archive_output |
520 | 520 | INNER JOIN (SELECT * FROM aircraft) a on spotter_archive_output.aircraft_icao = a.icao |
521 | 521 | WHERE spotter_archive_output.date >= '."'".$begindate."'".' AND spotter_archive_output.date <= '."'".$enddate."'".' |
@@ -527,7 +527,7 @@ discard block |
||
527 | 527 | try { |
528 | 528 | $sth = $this->db->prepare($query); |
529 | 529 | $sth->execute(); |
530 | - } catch(PDOException $e) { |
|
530 | + } catch (PDOException $e) { |
|
531 | 531 | echo $e->getMessage(); |
532 | 532 | die; |
533 | 533 | } |
@@ -542,23 +542,23 @@ discard block |
||
542 | 542 | * @return Array the spotter information |
543 | 543 | * |
544 | 544 | */ |
545 | - public function getLiveSpotterCount($begindate,$enddate,$filter = array()) |
|
545 | + public function getLiveSpotterCount($begindate, $enddate, $filter = array()) |
|
546 | 546 | { |
547 | 547 | global $globalDBdriver, $globalLiveInterval; |
548 | 548 | date_default_timezone_set('UTC'); |
549 | 549 | |
550 | 550 | $filter_query = ''; |
551 | 551 | if (isset($filter['source']) && !empty($filter['source'])) { |
552 | - $filter_query .= " AND format_source IN ('".implode("','",$filter['source'])."') "; |
|
552 | + $filter_query .= " AND format_source IN ('".implode("','", $filter['source'])."') "; |
|
553 | 553 | } |
554 | 554 | if (isset($filter['airlines']) && !empty($filter['airlines'])) { |
555 | - $filter_query .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','",$filter['airlines'])."')) so ON so.flightaware_id = spotter_archive.flightaware_id "; |
|
555 | + $filter_query .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','", $filter['airlines'])."')) so ON so.flightaware_id = spotter_archive.flightaware_id "; |
|
556 | 556 | } |
557 | 557 | if (isset($filter['airlinestype']) && !empty($filter['airlinestype'])) { |
558 | 558 | $filter_query .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_type = '".$filter['airlinestype']."') sa ON sa.flightaware_id = spotter_archive.flightaware_id "; |
559 | 559 | } |
560 | 560 | if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) { |
561 | - $filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')"; |
|
561 | + $filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','", $filter['source_aprs'])."')"; |
|
562 | 562 | } |
563 | 563 | |
564 | 564 | //if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
@@ -573,7 +573,7 @@ discard block |
||
573 | 573 | try { |
574 | 574 | $sth = $this->db->prepare($query); |
575 | 575 | $sth->execute(); |
576 | - } catch(PDOException $e) { |
|
576 | + } catch (PDOException $e) { |
|
577 | 577 | echo $e->getMessage(); |
578 | 578 | die; |
579 | 579 | } |
@@ -593,7 +593,7 @@ discard block |
||
593 | 593 | * @return Array the spotter information |
594 | 594 | * |
595 | 595 | */ |
596 | - public function searchSpotterData($q = '', $registration = '', $aircraft_icao = '', $aircraft_manufacturer = '', $highlights = '', $airline_icao = '', $airline_country = '', $airline_type = '', $airport = '', $airport_country = '', $callsign = '', $departure_airport_route = '', $arrival_airport_route = '', $owner = '',$pilot_id = '',$pilot_name = '',$altitude = '', $date_posted = '', $limit = '', $sort = '', $includegeodata = '',$origLat = '',$origLon = '',$dist = '', $filters=array()) |
|
596 | + public function searchSpotterData($q = '', $registration = '', $aircraft_icao = '', $aircraft_manufacturer = '', $highlights = '', $airline_icao = '', $airline_country = '', $airline_type = '', $airport = '', $airport_country = '', $callsign = '', $departure_airport_route = '', $arrival_airport_route = '', $owner = '', $pilot_id = '', $pilot_name = '', $altitude = '', $date_posted = '', $limit = '', $sort = '', $includegeodata = '', $origLat = '', $origLon = '', $dist = '', $filters = array()) |
|
597 | 597 | { |
598 | 598 | global $globalTimezone, $globalDBdriver; |
599 | 599 | require_once(dirname(__FILE__).'/class.Translation.php'); |
@@ -615,7 +615,7 @@ discard block |
||
615 | 615 | |
616 | 616 | $q_array = explode(" ", $q); |
617 | 617 | |
618 | - foreach ($q_array as $q_item){ |
|
618 | + foreach ($q_array as $q_item) { |
|
619 | 619 | $additional_query .= " AND ("; |
620 | 620 | $additional_query .= "(spotter_archive_output.spotter_id like '%".$q_item."%') OR "; |
621 | 621 | $additional_query .= "(spotter_archive_output.aircraft_icao like '%".$q_item."%') OR "; |
@@ -647,7 +647,7 @@ discard block |
||
647 | 647 | |
648 | 648 | if ($registration != "") |
649 | 649 | { |
650 | - $registration = filter_var($registration,FILTER_SANITIZE_STRING); |
|
650 | + $registration = filter_var($registration, FILTER_SANITIZE_STRING); |
|
651 | 651 | if (!is_string($registration)) |
652 | 652 | { |
653 | 653 | return false; |
@@ -658,7 +658,7 @@ discard block |
||
658 | 658 | |
659 | 659 | if ($aircraft_icao != "") |
660 | 660 | { |
661 | - $aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING); |
|
661 | + $aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING); |
|
662 | 662 | if (!is_string($aircraft_icao)) |
663 | 663 | { |
664 | 664 | return false; |
@@ -669,7 +669,7 @@ discard block |
||
669 | 669 | |
670 | 670 | if ($aircraft_manufacturer != "") |
671 | 671 | { |
672 | - $aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING); |
|
672 | + $aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING); |
|
673 | 673 | if (!is_string($aircraft_manufacturer)) |
674 | 674 | { |
675 | 675 | return false; |
@@ -690,7 +690,7 @@ discard block |
||
690 | 690 | |
691 | 691 | if ($airline_icao != "") |
692 | 692 | { |
693 | - $airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING); |
|
693 | + $airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING); |
|
694 | 694 | if (!is_string($airline_icao)) |
695 | 695 | { |
696 | 696 | return false; |
@@ -701,7 +701,7 @@ discard block |
||
701 | 701 | |
702 | 702 | if ($airline_country != "") |
703 | 703 | { |
704 | - $airline_country = filter_var($airline_country,FILTER_SANITIZE_STRING); |
|
704 | + $airline_country = filter_var($airline_country, FILTER_SANITIZE_STRING); |
|
705 | 705 | if (!is_string($airline_country)) |
706 | 706 | { |
707 | 707 | return false; |
@@ -712,7 +712,7 @@ discard block |
||
712 | 712 | |
713 | 713 | if ($airline_type != "") |
714 | 714 | { |
715 | - $airline_type = filter_var($airline_type,FILTER_SANITIZE_STRING); |
|
715 | + $airline_type = filter_var($airline_type, FILTER_SANITIZE_STRING); |
|
716 | 716 | if (!is_string($airline_type)) |
717 | 717 | { |
718 | 718 | return false; |
@@ -734,7 +734,7 @@ discard block |
||
734 | 734 | |
735 | 735 | if ($airport != "") |
736 | 736 | { |
737 | - $airport = filter_var($airport,FILTER_SANITIZE_STRING); |
|
737 | + $airport = filter_var($airport, FILTER_SANITIZE_STRING); |
|
738 | 738 | if (!is_string($airport)) |
739 | 739 | { |
740 | 740 | return false; |
@@ -745,7 +745,7 @@ discard block |
||
745 | 745 | |
746 | 746 | if ($airport_country != "") |
747 | 747 | { |
748 | - $airport_country = filter_var($airport_country,FILTER_SANITIZE_STRING); |
|
748 | + $airport_country = filter_var($airport_country, FILTER_SANITIZE_STRING); |
|
749 | 749 | if (!is_string($airport_country)) |
750 | 750 | { |
751 | 751 | return false; |
@@ -756,7 +756,7 @@ discard block |
||
756 | 756 | |
757 | 757 | if ($callsign != "") |
758 | 758 | { |
759 | - $callsign = filter_var($callsign,FILTER_SANITIZE_STRING); |
|
759 | + $callsign = filter_var($callsign, FILTER_SANITIZE_STRING); |
|
760 | 760 | if (!is_string($callsign)) |
761 | 761 | { |
762 | 762 | return false; |
@@ -764,7 +764,7 @@ discard block |
||
764 | 764 | $translate = $Translation->ident2icao($callsign); |
765 | 765 | if ($translate != $callsign) { |
766 | 766 | $additional_query .= " AND (spotter_archive_output.ident = :callsign OR spotter_archive_output.ident = :translate)"; |
767 | - $query_values = array_merge($query_values,array(':callsign' => $callsign,':translate' => $translate)); |
|
767 | + $query_values = array_merge($query_values, array(':callsign' => $callsign, ':translate' => $translate)); |
|
768 | 768 | } else { |
769 | 769 | $additional_query .= " AND (spotter_archive_output.ident = '".$callsign."')"; |
770 | 770 | } |
@@ -773,7 +773,7 @@ discard block |
||
773 | 773 | |
774 | 774 | if ($owner != "") |
775 | 775 | { |
776 | - $owner = filter_var($owner,FILTER_SANITIZE_STRING); |
|
776 | + $owner = filter_var($owner, FILTER_SANITIZE_STRING); |
|
777 | 777 | if (!is_string($owner)) |
778 | 778 | { |
779 | 779 | return false; |
@@ -784,7 +784,7 @@ discard block |
||
784 | 784 | |
785 | 785 | if ($pilot_name != "") |
786 | 786 | { |
787 | - $pilot_name = filter_var($pilot_name,FILTER_SANITIZE_STRING); |
|
787 | + $pilot_name = filter_var($pilot_name, FILTER_SANITIZE_STRING); |
|
788 | 788 | if (!is_string($pilot_name)) |
789 | 789 | { |
790 | 790 | return false; |
@@ -795,7 +795,7 @@ discard block |
||
795 | 795 | |
796 | 796 | if ($pilot_id != "") |
797 | 797 | { |
798 | - $pilot_id = filter_var($pilot_id,FILTER_SANITIZE_NUMBER_INT); |
|
798 | + $pilot_id = filter_var($pilot_id, FILTER_SANITIZE_NUMBER_INT); |
|
799 | 799 | if (!is_string($pilot_id)) |
800 | 800 | { |
801 | 801 | return false; |
@@ -806,7 +806,7 @@ discard block |
||
806 | 806 | |
807 | 807 | if ($departure_airport_route != "") |
808 | 808 | { |
809 | - $departure_airport_route = filter_var($departure_airport_route,FILTER_SANITIZE_STRING); |
|
809 | + $departure_airport_route = filter_var($departure_airport_route, FILTER_SANITIZE_STRING); |
|
810 | 810 | if (!is_string($departure_airport_route)) |
811 | 811 | { |
812 | 812 | return false; |
@@ -817,7 +817,7 @@ discard block |
||
817 | 817 | |
818 | 818 | if ($arrival_airport_route != "") |
819 | 819 | { |
820 | - $arrival_airport_route = filter_var($arrival_airport_route,FILTER_SANITIZE_STRING); |
|
820 | + $arrival_airport_route = filter_var($arrival_airport_route, FILTER_SANITIZE_STRING); |
|
821 | 821 | if (!is_string($arrival_airport_route)) |
822 | 822 | { |
823 | 823 | return false; |
@@ -830,8 +830,8 @@ discard block |
||
830 | 830 | { |
831 | 831 | $altitude_array = explode(",", $altitude); |
832 | 832 | |
833 | - $altitude_array[0] = filter_var($altitude_array[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
834 | - $altitude_array[1] = filter_var($altitude_array[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
833 | + $altitude_array[0] = filter_var($altitude_array[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
834 | + $altitude_array[1] = filter_var($altitude_array[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
835 | 835 | |
836 | 836 | |
837 | 837 | if ($altitude_array[1] != "") |
@@ -849,8 +849,8 @@ discard block |
||
849 | 849 | { |
850 | 850 | $date_array = explode(",", $date_posted); |
851 | 851 | |
852 | - $date_array[0] = filter_var($date_array[0],FILTER_SANITIZE_STRING); |
|
853 | - $date_array[1] = filter_var($date_array[1],FILTER_SANITIZE_STRING); |
|
852 | + $date_array[0] = filter_var($date_array[0], FILTER_SANITIZE_STRING); |
|
853 | + $date_array[1] = filter_var($date_array[1], FILTER_SANITIZE_STRING); |
|
854 | 854 | |
855 | 855 | if ($globalTimezone != '') { |
856 | 856 | date_default_timezone_set($globalTimezone); |
@@ -882,8 +882,8 @@ discard block |
||
882 | 882 | { |
883 | 883 | $limit_array = explode(",", $limit); |
884 | 884 | |
885 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
886 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
885 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
886 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
887 | 887 | |
888 | 888 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
889 | 889 | { |
@@ -894,8 +894,8 @@ discard block |
||
894 | 894 | |
895 | 895 | |
896 | 896 | if ($origLat != "" && $origLon != "" && $dist != "") { |
897 | - $dist = number_format($dist*0.621371,2,'.',''); |
|
898 | - $query="SELECT spotter_archive_output.*, 3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - ABS(CAST(spotter_archive.latitude as double precision)))*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(ABS(CAST(spotter_archive.latitude as double precision))*pi()/180)*POWER(SIN(($origLon-CAST(spotter_archive.longitude as double precision))*pi()/180/2),2))) as distance |
|
897 | + $dist = number_format($dist*0.621371, 2, '.', ''); |
|
898 | + $query = "SELECT spotter_archive_output.*, 3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - ABS(CAST(spotter_archive.latitude as double precision)))*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(ABS(CAST(spotter_archive.latitude as double precision))*pi()/180)*POWER(SIN(($origLon-CAST(spotter_archive.longitude as double precision))*pi()/180/2),2))) as distance |
|
899 | 899 | FROM spotter_archive_output, spotter_archive WHERE spotter_output_archive.flightaware_id = spotter_archive.flightaware_id AND spotter_output.ident <> '' ".$additional_query."AND CAST(spotter_archive.longitude as double precision) between ($origLon-$dist/ABS(cos(radians($origLat))*69)) and ($origLon+$dist/ABS(cos(radians($origLat))*69)) and CAST(spotter_archive.latitude as double precision) between ($origLat-($dist/69)) and ($origLat+($dist/69)) |
900 | 900 | AND (3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - ABS(CAST(spotter_archive.latitude as double precision)))*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(ABS(CAST(spotter_archive.latitude as double precision))*pi()/180)*POWER(SIN(($origLon-CAST(spotter_archive.longitude as double precision))*pi()/180/2),2)))) < $dist".$filter_query." ORDER BY distance"; |
901 | 901 | } else { |
@@ -912,12 +912,12 @@ discard block |
||
912 | 912 | $additional_query .= " AND (spotter_archive_output.waypoints <> '')"; |
913 | 913 | } |
914 | 914 | |
915 | - $query = "SELECT spotter_archive_output.* FROM spotter_archive_output |
|
915 | + $query = "SELECT spotter_archive_output.* FROM spotter_archive_output |
|
916 | 916 | WHERE spotter_archive_output.ident <> '' |
917 | 917 | ".$additional_query." |
918 | 918 | ".$filter_query.$orderby_query; |
919 | 919 | } |
920 | - $spotter_array = $Spotter->getDataFromDB($query, $query_values,$limit_query); |
|
920 | + $spotter_array = $Spotter->getDataFromDB($query, $query_values, $limit_query); |
|
921 | 921 | |
922 | 922 | return $spotter_array; |
923 | 923 | } |
@@ -934,7 +934,7 @@ discard block |
||
934 | 934 | try { |
935 | 935 | $sth = $this->db->prepare($query); |
936 | 936 | $sth->execute(); |
937 | - } catch(PDOException $e) { |
|
937 | + } catch (PDOException $e) { |
|
938 | 938 | return "error"; |
939 | 939 | } |
940 | 940 | } |
@@ -971,8 +971,8 @@ discard block |
||
971 | 971 | { |
972 | 972 | $limit_array = explode(",", $limit); |
973 | 973 | |
974 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
975 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
974 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
975 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
976 | 976 | |
977 | 977 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
978 | 978 | { |
@@ -1013,7 +1013,7 @@ discard block |
||
1013 | 1013 | $query_values = array(); |
1014 | 1014 | $limit_query = ''; |
1015 | 1015 | $additional_query = ''; |
1016 | - $filter_query = $this->getFilter($filter,true,true); |
|
1016 | + $filter_query = $this->getFilter($filter, true, true); |
|
1017 | 1017 | |
1018 | 1018 | if ($owner != "") |
1019 | 1019 | { |
@@ -1030,8 +1030,8 @@ discard block |
||
1030 | 1030 | { |
1031 | 1031 | $limit_array = explode(",", $limit); |
1032 | 1032 | |
1033 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
1034 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
1033 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
1034 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
1035 | 1035 | |
1036 | 1036 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
1037 | 1037 | { |
@@ -1071,7 +1071,7 @@ discard block |
||
1071 | 1071 | $query_values = array(); |
1072 | 1072 | $limit_query = ''; |
1073 | 1073 | $additional_query = ''; |
1074 | - $filter_query = $this->getFilter($filter,true,true); |
|
1074 | + $filter_query = $this->getFilter($filter, true, true); |
|
1075 | 1075 | |
1076 | 1076 | if ($pilot != "") |
1077 | 1077 | { |
@@ -1083,8 +1083,8 @@ discard block |
||
1083 | 1083 | { |
1084 | 1084 | $limit_array = explode(",", $limit); |
1085 | 1085 | |
1086 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
1087 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
1086 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
1087 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
1088 | 1088 | |
1089 | 1089 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
1090 | 1090 | { |
@@ -1114,7 +1114,7 @@ discard block |
||
1114 | 1114 | * @return Array the airline country list |
1115 | 1115 | * |
1116 | 1116 | */ |
1117 | - public function countAllFlightOverCountries($limit = true,$olderthanmonths = 0,$sincedate = '') |
|
1117 | + public function countAllFlightOverCountries($limit = true, $olderthanmonths = 0, $sincedate = '') |
|
1118 | 1118 | { |
1119 | 1119 | global $globalDBdriver; |
1120 | 1120 | /* |
@@ -1143,7 +1143,7 @@ discard block |
||
1143 | 1143 | $flight_array = array(); |
1144 | 1144 | $temp_array = array(); |
1145 | 1145 | |
1146 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1146 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1147 | 1147 | { |
1148 | 1148 | $temp_array['flight_count'] = $row['nb']; |
1149 | 1149 | $temp_array['flight_country'] = $row['name']; |
@@ -1160,7 +1160,7 @@ discard block |
||
1160 | 1160 | * @return Array the airline country list |
1161 | 1161 | * |
1162 | 1162 | */ |
1163 | - public function countAllFlightOverCountriesByAirlines($limit = true,$olderthanmonths = 0,$sincedate = '') |
|
1163 | + public function countAllFlightOverCountriesByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '') |
|
1164 | 1164 | { |
1165 | 1165 | global $globalDBdriver; |
1166 | 1166 | /* |
@@ -1189,7 +1189,7 @@ discard block |
||
1189 | 1189 | $flight_array = array(); |
1190 | 1190 | $temp_array = array(); |
1191 | 1191 | |
1192 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1192 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1193 | 1193 | { |
1194 | 1194 | $temp_array['airline_icao'] = $row['airline_icao']; |
1195 | 1195 | $temp_array['flight_count'] = $row['nb']; |
@@ -1207,14 +1207,14 @@ discard block |
||
1207 | 1207 | * @return Array the spotter information |
1208 | 1208 | * |
1209 | 1209 | */ |
1210 | - public function getDateArchiveSpotterDataById($id,$date) |
|
1210 | + public function getDateArchiveSpotterDataById($id, $date) |
|
1211 | 1211 | { |
1212 | 1212 | $Spotter = new Spotter($this->db); |
1213 | 1213 | date_default_timezone_set('UTC'); |
1214 | 1214 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
1215 | - $query = 'SELECT spotter_archive.* FROM spotter_archive INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_archive l WHERE l.flightaware_id = :id AND l.date <= :date GROUP BY l.flightaware_id) s on spotter_archive.flightaware_id = s.flightaware_id AND spotter_archive.date = s.maxdate ORDER BY spotter_archive.date DESC'; |
|
1216 | - $date = date('c',$date); |
|
1217 | - $spotter_array = $Spotter->getDataFromDB($query,array(':id' => $id,':date' => $date)); |
|
1215 | + $query = 'SELECT spotter_archive.* FROM spotter_archive INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_archive l WHERE l.flightaware_id = :id AND l.date <= :date GROUP BY l.flightaware_id) s on spotter_archive.flightaware_id = s.flightaware_id AND spotter_archive.date = s.maxdate ORDER BY spotter_archive.date DESC'; |
|
1216 | + $date = date('c', $date); |
|
1217 | + $spotter_array = $Spotter->getDataFromDB($query, array(':id' => $id, ':date' => $date)); |
|
1218 | 1218 | return $spotter_array; |
1219 | 1219 | } |
1220 | 1220 | |
@@ -1224,14 +1224,14 @@ discard block |
||
1224 | 1224 | * @return Array the spotter information |
1225 | 1225 | * |
1226 | 1226 | */ |
1227 | - public function getDateArchiveSpotterDataByIdent($ident,$date) |
|
1227 | + public function getDateArchiveSpotterDataByIdent($ident, $date) |
|
1228 | 1228 | { |
1229 | 1229 | $Spotter = new Spotter($this->db); |
1230 | 1230 | date_default_timezone_set('UTC'); |
1231 | 1231 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
1232 | - $query = 'SELECT spotter_archive.* FROM spotter_archive INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_archive l WHERE l.ident = :ident AND l.date <= :date GROUP BY l.flightaware_id) s on spotter_archive.flightaware_id = s.flightaware_id AND spotter_archive.date = s.maxdate ORDER BY spotter_archive.date DESC'; |
|
1233 | - $date = date('c',$date); |
|
1234 | - $spotter_array = $Spotter->getDataFromDB($query,array(':ident' => $ident,':date' => $date)); |
|
1232 | + $query = 'SELECT spotter_archive.* FROM spotter_archive INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_archive l WHERE l.ident = :ident AND l.date <= :date GROUP BY l.flightaware_id) s on spotter_archive.flightaware_id = s.flightaware_id AND spotter_archive.date = s.maxdate ORDER BY spotter_archive.date DESC'; |
|
1233 | + $date = date('c', $date); |
|
1234 | + $spotter_array = $Spotter->getDataFromDB($query, array(':ident' => $ident, ':date' => $date)); |
|
1235 | 1235 | return $spotter_array; |
1236 | 1236 | } |
1237 | 1237 | |
@@ -1241,7 +1241,7 @@ discard block |
||
1241 | 1241 | * @return Array the spotter information |
1242 | 1242 | * |
1243 | 1243 | */ |
1244 | - public function getSpotterDataByAirport($airport = '', $limit = '', $sort = '',$filters = array()) |
|
1244 | + public function getSpotterDataByAirport($airport = '', $limit = '', $sort = '', $filters = array()) |
|
1245 | 1245 | { |
1246 | 1246 | global $global_query; |
1247 | 1247 | $Spotter = new Spotter(); |
@@ -1249,7 +1249,7 @@ discard block |
||
1249 | 1249 | $query_values = array(); |
1250 | 1250 | $limit_query = ''; |
1251 | 1251 | $additional_query = ''; |
1252 | - $filter_query = $this->getFilter($filters,true,true); |
|
1252 | + $filter_query = $this->getFilter($filters, true, true); |
|
1253 | 1253 | |
1254 | 1254 | if ($airport != "") |
1255 | 1255 | { |
@@ -1266,8 +1266,8 @@ discard block |
||
1266 | 1266 | { |
1267 | 1267 | $limit_array = explode(",", $limit); |
1268 | 1268 | |
1269 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
1270 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
1269 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
1270 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
1271 | 1271 | |
1272 | 1272 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
1273 | 1273 | { |
@@ -3,7 +3,7 @@ discard block |
||
3 | 3 | require_once('require/class.Language.php'); |
4 | 4 | require_once('require/class.Translation.php'); |
5 | 5 | $type = ''; |
6 | -$ident = urldecode(filter_input(INPUT_GET,'ident',FILTER_SANITIZE_STRING)); |
|
6 | +$ident = urldecode(filter_input(INPUT_GET, 'ident', FILTER_SANITIZE_STRING)); |
|
7 | 7 | if (isset($_GET['marine'])) { |
8 | 8 | require_once('require/class.Marine.php'); |
9 | 9 | require_once('require/class.MarineLive.php'); |
@@ -30,12 +30,12 @@ discard block |
||
30 | 30 | $page_url = $globalURL.'/ident/'.$_GET['ident']; |
31 | 31 | } |
32 | 32 | |
33 | -if (!isset($_GET['ident'])){ |
|
33 | +if (!isset($_GET['ident'])) { |
|
34 | 34 | header('Location: '.$globalURL.''); |
35 | 35 | } else { |
36 | 36 | $Translation = new Translation(); |
37 | 37 | //calculuation for the pagination |
38 | - if(!isset($_GET['limit'])) |
|
38 | + if (!isset($_GET['limit'])) |
|
39 | 39 | { |
40 | 40 | $limit_start = 0; |
41 | 41 | $limit_end = 25; |
@@ -54,18 +54,18 @@ discard block |
||
54 | 54 | $limit_previous_1 = $limit_start - $absolute_difference; |
55 | 55 | $limit_previous_2 = $limit_end - $absolute_difference; |
56 | 56 | |
57 | - $sort = filter_input(INPUT_GET,'sort',FILTER_SANITIZE_STRING); |
|
57 | + $sort = filter_input(INPUT_GET, 'sort', FILTER_SANITIZE_STRING); |
|
58 | 58 | if ($type == 'aircraft') { |
59 | 59 | if ($sort != '') |
60 | 60 | { |
61 | - $spotter_array = $Spotter->getSpotterDataByIdent($ident,$limit_start.",".$absolute_difference, $sort); |
|
61 | + $spotter_array = $Spotter->getSpotterDataByIdent($ident, $limit_start.",".$absolute_difference, $sort); |
|
62 | 62 | if (empty($spotter_array)) { |
63 | - $spotter_array = $SpotterArchive->getSpotterDataByIdent($ident,$limit_start.",".$absolute_difference, $sort); |
|
63 | + $spotter_array = $SpotterArchive->getSpotterDataByIdent($ident, $limit_start.",".$absolute_difference, $sort); |
|
64 | 64 | } |
65 | 65 | } else { |
66 | - $spotter_array = $Spotter->getSpotterDataByIdent($ident,$limit_start.",".$absolute_difference); |
|
66 | + $spotter_array = $Spotter->getSpotterDataByIdent($ident, $limit_start.",".$absolute_difference); |
|
67 | 67 | if (empty($spotter_array)) { |
68 | - $spotter_array = $SpotterArchive->getSpotterDataByIdent($ident,$limit_start.",".$absolute_difference); |
|
68 | + $spotter_array = $SpotterArchive->getSpotterDataByIdent($ident, $limit_start.",".$absolute_difference); |
|
69 | 69 | } |
70 | 70 | } |
71 | 71 | if (empty($spotter_array)) { |
@@ -74,14 +74,14 @@ discard block |
||
74 | 74 | $ident = $new_ident; |
75 | 75 | if ($sort != '') |
76 | 76 | { |
77 | - $spotter_array = $Spotter->getSpotterDataByIdent($ident,$limit_start.",".$absolute_difference, $sort); |
|
77 | + $spotter_array = $Spotter->getSpotterDataByIdent($ident, $limit_start.",".$absolute_difference, $sort); |
|
78 | 78 | if (empty($spotter_array)) { |
79 | - $spotter_array = $SpotterArchive->getSpotterDataByIdent($ident,$limit_start.",".$absolute_difference, $sort); |
|
79 | + $spotter_array = $SpotterArchive->getSpotterDataByIdent($ident, $limit_start.",".$absolute_difference, $sort); |
|
80 | 80 | } |
81 | 81 | } else { |
82 | - $spotter_array = $Spotter->getSpotterDataByIdent($ident,$limit_start.",".$absolute_difference); |
|
82 | + $spotter_array = $Spotter->getSpotterDataByIdent($ident, $limit_start.",".$absolute_difference); |
|
83 | 83 | if (empty($spotter_array)) { |
84 | - $spotter_array = $SpotterArchive->getSpotterDataByIdent($ident,$limit_start.",".$absolute_difference); |
|
84 | + $spotter_array = $SpotterArchive->getSpotterDataByIdent($ident, $limit_start.",".$absolute_difference); |
|
85 | 85 | } |
86 | 86 | } |
87 | 87 | } |
@@ -89,34 +89,34 @@ discard block |
||
89 | 89 | } elseif ($type == 'marine') { |
90 | 90 | if ($sort != '') |
91 | 91 | { |
92 | - $spotter_array = $Marine->getMarineDataByIdent($ident,$limit_start.",".$absolute_difference, $sort); |
|
92 | + $spotter_array = $Marine->getMarineDataByIdent($ident, $limit_start.",".$absolute_difference, $sort); |
|
93 | 93 | if (empty($spotter_array)) { |
94 | - $spotter_array = $MarineArchive->getMarineDataByIdent($ident,$limit_start.",".$absolute_difference, $sort); |
|
94 | + $spotter_array = $MarineArchive->getMarineDataByIdent($ident, $limit_start.",".$absolute_difference, $sort); |
|
95 | 95 | } |
96 | 96 | } else { |
97 | - $spotter_array = $Marine->getMarineDataByIdent($ident,$limit_start.",".$absolute_difference); |
|
97 | + $spotter_array = $Marine->getMarineDataByIdent($ident, $limit_start.",".$absolute_difference); |
|
98 | 98 | if (empty($spotter_array)) { |
99 | - $spotter_array = $MarineArchive->getMarineDataByIdent($ident,$limit_start.",".$absolute_difference); |
|
99 | + $spotter_array = $MarineArchive->getMarineDataByIdent($ident, $limit_start.",".$absolute_difference); |
|
100 | 100 | } |
101 | 101 | } |
102 | 102 | } elseif ($type == 'tracker') { |
103 | 103 | if ($sort != '') |
104 | 104 | { |
105 | - $spotter_array = $Tracker->getTrackerDataByIdent($ident,$limit_start.",".$absolute_difference, $sort); |
|
105 | + $spotter_array = $Tracker->getTrackerDataByIdent($ident, $limit_start.",".$absolute_difference, $sort); |
|
106 | 106 | if (empty($spotter_array)) { |
107 | - $spotter_array = $TrackerArchive->getTrackerDataByIdent($ident,$limit_start.",".$absolute_difference, $sort); |
|
107 | + $spotter_array = $TrackerArchive->getTrackerDataByIdent($ident, $limit_start.",".$absolute_difference, $sort); |
|
108 | 108 | } |
109 | 109 | } else { |
110 | - $spotter_array = $Tracker->getTrackerDataByIdent($ident,$limit_start.",".$absolute_difference); |
|
110 | + $spotter_array = $Tracker->getTrackerDataByIdent($ident, $limit_start.",".$absolute_difference); |
|
111 | 111 | if (empty($spotter_array)) { |
112 | - $spotter_array = $TrackerArchive->getTrackerDataByIdent($ident,$limit_start.",".$absolute_difference); |
|
112 | + $spotter_array = $TrackerArchive->getTrackerDataByIdent($ident, $limit_start.",".$absolute_difference); |
|
113 | 113 | } |
114 | 114 | } |
115 | 115 | } |
116 | 116 | |
117 | 117 | if (!empty($spotter_array)) |
118 | 118 | { |
119 | - $title = sprintf(_("Detailed View for %s"),$spotter_array[0]['ident']); |
|
119 | + $title = sprintf(_("Detailed View for %s"), $spotter_array[0]['ident']); |
|
120 | 120 | $ident = $spotter_array[0]['ident']; |
121 | 121 | if (isset($spotter_array[0]['latitude'])) $latitude = $spotter_array[0]['latitude']; |
122 | 122 | if (isset($spotter_array[0]['longitude'])) $longitude = $spotter_array[0]['longitude']; |
@@ -136,7 +136,7 @@ discard block |
||
136 | 136 | $altitude_data = ''; |
137 | 137 | $hour_data = ''; |
138 | 138 | $speed_data = ''; |
139 | - foreach($all_data as $data) |
|
139 | + foreach ($all_data as $data) |
|
140 | 140 | { |
141 | 141 | $hour_data .= '"'.$data['date'].'",'; |
142 | 142 | if (isset($data['real_altitude']) && $data['real_altitude'] != '') { |
@@ -164,8 +164,8 @@ discard block |
||
164 | 164 | $speed_data .= $speed.','; |
165 | 165 | } |
166 | 166 | $hour_data = "['x',".substr($hour_data, 0, -1)."]"; |
167 | - $altitude_data = "['altitude',".substr($altitude_data,0,-1)."]"; |
|
168 | - $speed_data = "['speed',".substr($speed_data,0,-1)."]"; |
|
167 | + $altitude_data = "['altitude',".substr($altitude_data, 0, -1)."]"; |
|
168 | + $speed_data = "['speed',".substr($speed_data, 0, -1)."]"; |
|
169 | 169 | print 'c3.generate({ |
170 | 170 | bindto: "#chart", |
171 | 171 | data: { |
@@ -209,9 +209,9 @@ discard block |
||
209 | 209 | |
210 | 210 | if ($type == 'aircraft') include('ident-sub-menu.php'); |
211 | 211 | print '<div class="table column">'; |
212 | - if ($type == 'aircraft') print '<p>'.sprintf(_("The table below shows the detailed information of all flights with the ident/callsign of <strong>%s</strong>."),$spotter_array[0]['ident']).'</p>'; |
|
213 | - elseif ($type == 'marine') print '<p>'.sprintf(_("The table below shows the detailed information of all vessels with the ident/callsign of <strong>%s</strong>."),$spotter_array[0]['ident']).'</p>'; |
|
214 | - elseif ($type == 'tracker') print '<p>'.sprintf(_("The table below shows the detailed information of all trackers with the ident/callsign of <strong>%s</strong>."),$spotter_array[0]['ident']).'</p>'; |
|
212 | + if ($type == 'aircraft') print '<p>'.sprintf(_("The table below shows the detailed information of all flights with the ident/callsign of <strong>%s</strong>."), $spotter_array[0]['ident']).'</p>'; |
|
213 | + elseif ($type == 'marine') print '<p>'.sprintf(_("The table below shows the detailed information of all vessels with the ident/callsign of <strong>%s</strong>."), $spotter_array[0]['ident']).'</p>'; |
|
214 | + elseif ($type == 'tracker') print '<p>'.sprintf(_("The table below shows the detailed information of all trackers with the ident/callsign of <strong>%s</strong>."), $spotter_array[0]['ident']).'</p>'; |
|
215 | 215 | |
216 | 216 | include('table-output.php'); |
217 | 217 | print '<div class="pagination">'; |
@@ -7,14 +7,14 @@ discard block |
||
7 | 7 | die(); |
8 | 8 | } |
9 | 9 | $Spotter = new Spotter(); |
10 | -$country = ucwords(str_replace("-", " ", filter_input(INPUT_GET,'country',FILTER_SANITIZE_STRING))); |
|
11 | -$sort = filter_input(INPUT_GET,'sort',FILTER_SANITIZE_STRING); |
|
10 | +$country = ucwords(str_replace("-", " ", filter_input(INPUT_GET, 'country', FILTER_SANITIZE_STRING))); |
|
11 | +$sort = filter_input(INPUT_GET, 'sort', FILTER_SANITIZE_STRING); |
|
12 | 12 | $spotter_array = $Spotter->getSpotterDataByCountry($country, "0,1", $sort); |
13 | 13 | |
14 | 14 | |
15 | 15 | if (!empty($spotter_array)) |
16 | 16 | { |
17 | - $title = sprintf(_("Most Common Arrival Airports from %s"),$country); |
|
17 | + $title = sprintf(_("Most Common Arrival Airports from %s"), $country); |
|
18 | 18 | |
19 | 19 | require_once('header.php'); |
20 | 20 | print '<div class="select-item">'; |
@@ -22,9 +22,9 @@ discard block |
||
22 | 22 | print '<select name="country" class="selectpicker" data-live-search="true">'; |
23 | 23 | print '<option></option>'; |
24 | 24 | $all_countries = $Spotter->getAllCountries(); |
25 | - foreach($all_countries as $all_country) |
|
25 | + foreach ($all_countries as $all_country) |
|
26 | 26 | { |
27 | - if($country == $all_country['country']) |
|
27 | + if ($country == $all_country['country']) |
|
28 | 28 | { |
29 | 29 | print '<option value="'.strtolower(str_replace(" ", "-", $all_country['country'])).'" selected="selected">'.$all_country['country'].'</option>'; |
30 | 30 | } else { |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | if ($_GET['country'] != "NA") |
40 | 40 | { |
41 | 41 | print '<div class="info column">'; |
42 | - print '<h1>'.sprintf(_("Airports & Airlines from %s"),$country).'</h1>'; |
|
42 | + print '<h1>'.sprintf(_("Airports & Airlines from %s"), $country).'</h1>'; |
|
43 | 43 | print '</div>'; |
44 | 44 | } else { |
45 | 45 | print '<div class="alert alert-warning">'._("This special country profile shows all flights that do <u>not</u> have a country of a airline or departure/arrival airport associated with them.").'</div>'; |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | include('country-sub-menu.php'); |
49 | 49 | print '<div class="column">'; |
50 | 50 | print '<h2>'._("Most Common Arrival Airports").'</h2>'; |
51 | - print '<p>'.sprintf(_("The statistic below shows all arrival airports of flights of airports & airlines from <strong>%s</strong>."),$country).'</p>'; |
|
51 | + print '<p>'.sprintf(_("The statistic below shows all arrival airports of flights of airports & airlines from <strong>%s</strong>."), $country).'</p>'; |
|
52 | 52 | $airport_airport_array = $Spotter->countAllArrivalAirportsByCountry($country); |
53 | 53 | print '<script type="text/javascript" src="'.$globalURL.'/js/d3.min.js"></script>'; |
54 | 54 | print '<script type="text/javascript" src="'.$globalURL.'/js/topojson.v2.min.js"></script>'; |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | print '<script>'; |
58 | 58 | print 'var series = ['; |
59 | 59 | $airport_data = ''; |
60 | - foreach($airport_airport_array as $airport_item) |
|
60 | + foreach ($airport_airport_array as $airport_item) |
|
61 | 61 | { |
62 | 62 | $airport_data .= '[ "'.$airport_item['airport_arrival_icao_count'].'", "'.$airport_item['airport_arrival_name'].' ('.$airport_item['airport_arrival_icao'].')",'.$airport_item['airport_arrival_latitude'].','.$airport_item['airport_arrival_longitude'].'],'; |
63 | 63 | } |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | print '</thead>'; |
112 | 112 | print '<tbody>'; |
113 | 113 | $i = 1; |
114 | - foreach($airport_airport_array as $airport_item) |
|
114 | + foreach ($airport_airport_array as $airport_item) |
|
115 | 115 | { |
116 | 116 | print '<tr>'; |
117 | 117 | print '<td><strong>'.$i.'</strong></td>'; |
@@ -7,14 +7,14 @@ discard block |
||
7 | 7 | header('Location: '.$globalURL.'/aircraft'); |
8 | 8 | die(); |
9 | 9 | } |
10 | -$aircraft_type = filter_input(INPUT_GET,'aircraft_type',FILTER_SANITIZE_STRING); |
|
10 | +$aircraft_type = filter_input(INPUT_GET, 'aircraft_type', FILTER_SANITIZE_STRING); |
|
11 | 11 | $Spotter = new Spotter(); |
12 | -$spotter_array = $Spotter->getSpotterDataByAircraft($aircraft_type,"0,1",""); |
|
12 | +$spotter_array = $Spotter->getSpotterDataByAircraft($aircraft_type, "0,1", ""); |
|
13 | 13 | |
14 | 14 | |
15 | 15 | if (!empty($spotter_array)) |
16 | 16 | { |
17 | - $title = sprintf(_("Most Common Departure Airports for %s (%s)"),$spotter_array[0]['aircraft_name'],$spotter_array[0]['aircraft_type']); |
|
17 | + $title = sprintf(_("Most Common Departure Airports for %s (%s)"), $spotter_array[0]['aircraft_name'], $spotter_array[0]['aircraft_type']); |
|
18 | 18 | require_once('header.php'); |
19 | 19 | print '<div class="select-item">'; |
20 | 20 | print '<form action="'.$globalURL.'/aircraft" method="post">'; |
@@ -23,9 +23,9 @@ discard block |
||
23 | 23 | $Stats = new Stats(); |
24 | 24 | $aircraft_types = $Stats->getAllAircraftTypes(); |
25 | 25 | if (empty($aircraft_types)) $aircraft_types = $Spotter->getAllAircraftTypes(); |
26 | - foreach($aircraft_types as $aircrafttype) |
|
26 | + foreach ($aircraft_types as $aircrafttype) |
|
27 | 27 | { |
28 | - if($aircraft_type == $aircrafttype['aircraft_icao']) |
|
28 | + if ($aircraft_type == $aircrafttype['aircraft_icao']) |
|
29 | 29 | { |
30 | 30 | print '<option value="'.$aircrafttype['aircraft_icao'].'" selected="selected">'.$aircrafttype['aircraft_name'].' ('.$aircrafttype['aircraft_icao'].')</option>'; |
31 | 31 | } else { |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | include('aircraft-sub-menu.php'); |
53 | 53 | print '<div class="column">'; |
54 | 54 | print '<h2>'._("Most Common Departure Airports").'</h2>'; |
55 | - print '<p>'.sprintf(_("The statistic below shows all departure airports of flights from <strong>%s (%s)</strong>."),$spotter_array[0]['aircraft_name'],$spotter_array[0]['aircraft_type']).'</p>'; |
|
55 | + print '<p>'.sprintf(_("The statistic below shows all departure airports of flights from <strong>%s (%s)</strong>."), $spotter_array[0]['aircraft_name'], $spotter_array[0]['aircraft_type']).'</p>'; |
|
56 | 56 | $airport_airport_array = $Spotter->countAllDepartureAirportsByAircraft($aircraft_type); |
57 | 57 | print '<script type="text/javascript" src="'.$globalURL.'/js/d3.min.js"></script>'; |
58 | 58 | print '<script type="text/javascript" src="'.$globalURL.'/js/topojson.v2.min.js"></script>'; |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | print '<script>'; |
62 | 62 | print 'var series = ['; |
63 | 63 | $airport_data = ''; |
64 | - foreach($airport_airport_array as $airport_item) |
|
64 | + foreach ($airport_airport_array as $airport_item) |
|
65 | 65 | { |
66 | 66 | $airport_data .= '[ "'.$airport_item['airport_departure_icao_count'].'", "'.$airport_item['airport_departure_name'].' ('.$airport_item['airport_departure_icao'].')",'.$airport_item['airport_departure_latitude'].','.$airport_item['airport_departure_longitude'].'],'; |
67 | 67 | } |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | print '</thead>'; |
117 | 117 | print '<tbody>'; |
118 | 118 | $i = 1; |
119 | - foreach($airport_airport_array as $airport_item) |
|
119 | + foreach ($airport_airport_array as $airport_item) |
|
120 | 120 | { |
121 | 121 | print '<tr>'; |
122 | 122 | print '<td><strong>'.$i.'</strong></td>'; |