@@ -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); |
@@ -437,7 +437,7 @@ discard block |
||
437 | 437 | */ |
438 | 438 | $dair = ''; |
439 | 439 | $darr = ''; |
440 | - $n = sscanf($message,'%4[A-Z]%4[A-Z]%*4d',$dair,$darr); |
|
440 | + $n = sscanf($message, '%4[A-Z]%4[A-Z]%*4d', $dair, $darr); |
|
441 | 441 | if ($n == 3) { |
442 | 442 | if ($globalDebug) echo 'airport depart : '.$dair.' - airport arrival : '.$darr."\n"; |
443 | 443 | //$icao = $Translation->checkTranslation($ident); |
@@ -453,7 +453,7 @@ discard block |
||
453 | 453 | */ |
454 | 454 | $dair = ''; |
455 | 455 | $darr = ''; |
456 | - $n = sscanf($message,'3J01 DSPTCH %*d/%*d %4s/%4s .%*6s',$dair,$darr); |
|
456 | + $n = sscanf($message, '3J01 DSPTCH %*d/%*d %4s/%4s .%*6s', $dair, $darr); |
|
457 | 457 | if ($n == 3) { |
458 | 458 | if ($globalDebug) echo 'airport depart : '.$dair.' - airport arrival : '.$darr."\n"; |
459 | 459 | //$icao = $Translation->checkTranslation($ident); |
@@ -464,7 +464,7 @@ discard block |
||
464 | 464 | } |
465 | 465 | } |
466 | 466 | if (!$found) { |
467 | - $n = sscanf($message,'MET01%4c',$airport); |
|
467 | + $n = sscanf($message, 'MET01%4c', $airport); |
|
468 | 468 | if ($n == 1) { |
469 | 469 | if ($globalDebug) echo 'airport name : '.$airport; |
470 | 470 | $decode = array('Airport/Waypoint name' => $airport); |
@@ -473,241 +473,241 @@ discard block |
||
473 | 473 | } |
474 | 474 | |
475 | 475 | if ($label == 'H1') { |
476 | - if (preg_match('/^#CFBFLR/',$message) || preg_match('/^#CFBWRN/',$message)) { |
|
477 | - $decode = array_merge(array('Message nature' => 'Equipment failure'),$decode); |
|
476 | + if (preg_match('/^#CFBFLR/', $message) || preg_match('/^#CFBWRN/', $message)) { |
|
477 | + $decode = array_merge(array('Message nature' => 'Equipment failure'), $decode); |
|
478 | 478 | } |
479 | - elseif (preg_match('/^#DFB\*TKO/',$message) || preg_match('/^#DFBTKO/',$message)) { |
|
480 | - $decode = array_merge(array('Message nature' => 'Take off performance data'),$decode); |
|
479 | + elseif (preg_match('/^#DFB\*TKO/', $message) || preg_match('/^#DFBTKO/', $message)) { |
|
480 | + $decode = array_merge(array('Message nature' => 'Take off performance data'), $decode); |
|
481 | 481 | } |
482 | - elseif (preg_match('/^#DFB\*CRZ/',$message) || preg_match('/^#DFBCRZ/',$message)) { |
|
483 | - $decode = array_merge(array('Message nature' => 'Cruise performance data'),$decode); |
|
482 | + elseif (preg_match('/^#DFB\*CRZ/', $message) || preg_match('/^#DFBCRZ/', $message)) { |
|
483 | + $decode = array_merge(array('Message nature' => 'Cruise performance data'), $decode); |
|
484 | 484 | } |
485 | - elseif (preg_match('/^#DFB\*WOB/',$message) || preg_match('/^#DFBWOB/',$message)) { |
|
486 | - $decode = array_merge(array('Message nature' => 'Weather observation'),$decode); |
|
485 | + elseif (preg_match('/^#DFB\*WOB/', $message) || preg_match('/^#DFBWOB/', $message)) { |
|
486 | + $decode = array_merge(array('Message nature' => 'Weather observation'), $decode); |
|
487 | 487 | } |
488 | - elseif (preg_match(':^#DFB/PIREP:',$message)) { |
|
489 | - $decode = array_merge(array('Message nature' => 'Pilot Report'),$decode); |
|
488 | + elseif (preg_match(':^#DFB/PIREP:', $message)) { |
|
489 | + $decode = array_merge(array('Message nature' => 'Pilot Report'), $decode); |
|
490 | 490 | } |
491 | - elseif (preg_match('/^#DFBEDA/',$message) || preg_match('/^#DFBENG/',$message)) { |
|
492 | - $decode = array_merge(array('Message nature' => 'Engine Data'),$decode); |
|
491 | + elseif (preg_match('/^#DFBEDA/', $message) || preg_match('/^#DFBENG/', $message)) { |
|
492 | + $decode = array_merge(array('Message nature' => 'Engine Data'), $decode); |
|
493 | 493 | } |
494 | - elseif (preg_match(':^#M1AAEP:',$message)) { |
|
495 | - $decode = array_merge(array('Message nature' => 'Position/Weather Report'),$decode); |
|
494 | + elseif (preg_match(':^#M1AAEP:', $message)) { |
|
495 | + $decode = array_merge(array('Message nature' => 'Position/Weather Report'), $decode); |
|
496 | 496 | } |
497 | - elseif (preg_match(':^#M2APWD:',$message)) { |
|
498 | - $decode = array_merge(array('Message nature' => 'Flight plan predicted wind data'),$decode); |
|
497 | + elseif (preg_match(':^#M2APWD:', $message)) { |
|
498 | + $decode = array_merge(array('Message nature' => 'Flight plan predicted wind data'), $decode); |
|
499 | 499 | } |
500 | - elseif (preg_match(':^#M1BREQPWI:',$message)) { |
|
501 | - $decode = array_merge(array('Message nature' => 'Predicted wind info request'),$decode); |
|
500 | + elseif (preg_match(':^#M1BREQPWI:', $message)) { |
|
501 | + $decode = array_merge(array('Message nature' => 'Predicted wind info request'), $decode); |
|
502 | 502 | } |
503 | - elseif (preg_match(':^#CF:',$message)) { |
|
504 | - $decode = array_merge(array('Message nature' => 'Central Fault Display'),$decode); |
|
503 | + elseif (preg_match(':^#CF:', $message)) { |
|
504 | + $decode = array_merge(array('Message nature' => 'Central Fault Display'), $decode); |
|
505 | 505 | } |
506 | - elseif (preg_match(':^#DF:',$message)) { |
|
507 | - $decode = array_merge(array('Message nature' => 'Digital Flight Data Acquisition Unit'),$decode); |
|
506 | + elseif (preg_match(':^#DF:', $message)) { |
|
507 | + $decode = array_merge(array('Message nature' => 'Digital Flight Data Acquisition Unit'), $decode); |
|
508 | 508 | } |
509 | - elseif (preg_match(':^#EC:',$message)) { |
|
510 | - $decode = array_merge(array('Message nature' => 'Engine Display System'),$decode); |
|
509 | + elseif (preg_match(':^#EC:', $message)) { |
|
510 | + $decode = array_merge(array('Message nature' => 'Engine Display System'), $decode); |
|
511 | 511 | } |
512 | - elseif (preg_match(':^#EI:',$message)) { |
|
513 | - $decode = array_merge(array('Message nature' => 'Engine Report'),$decode); |
|
512 | + elseif (preg_match(':^#EI:', $message)) { |
|
513 | + $decode = array_merge(array('Message nature' => 'Engine Report'), $decode); |
|
514 | 514 | } |
515 | - elseif (preg_match(':^#H1:',$message)) { |
|
516 | - $decode = array_merge(array('Message nature' => 'HF Data Radio - Left'),$decode); |
|
515 | + elseif (preg_match(':^#H1:', $message)) { |
|
516 | + $decode = array_merge(array('Message nature' => 'HF Data Radio - Left'), $decode); |
|
517 | 517 | } |
518 | - elseif (preg_match(':^#H2:',$message)) { |
|
519 | - $decode = array_merge(array('Message nature' => 'HF Data Radio - Right'),$decode); |
|
518 | + elseif (preg_match(':^#H2:', $message)) { |
|
519 | + $decode = array_merge(array('Message nature' => 'HF Data Radio - Right'), $decode); |
|
520 | 520 | } |
521 | - elseif (preg_match(':^#HD:',$message)) { |
|
522 | - $decode = array_merge(array('Message nature' => 'HF Data Radio - Selected'),$decode); |
|
521 | + elseif (preg_match(':^#HD:', $message)) { |
|
522 | + $decode = array_merge(array('Message nature' => 'HF Data Radio - Selected'), $decode); |
|
523 | 523 | } |
524 | - elseif (preg_match(':^#M1:',$message)) { |
|
525 | - $decode = array_merge(array('Message nature' => 'Flight Management Computer - Left'),$decode); |
|
524 | + elseif (preg_match(':^#M1:', $message)) { |
|
525 | + $decode = array_merge(array('Message nature' => 'Flight Management Computer - Left'), $decode); |
|
526 | 526 | } |
527 | - elseif (preg_match(':^#M2:',$message)) { |
|
528 | - $decode = array_merge(array('Message nature' => 'Flight Management Computer - Right'),$decode); |
|
527 | + elseif (preg_match(':^#M2:', $message)) { |
|
528 | + $decode = array_merge(array('Message nature' => 'Flight Management Computer - Right'), $decode); |
|
529 | 529 | } |
530 | - elseif (preg_match(':^#M3:',$message)) { |
|
531 | - $decode = array_merge(array('Message nature' => 'Flight Management Computer - Center'),$decode); |
|
530 | + elseif (preg_match(':^#M3:', $message)) { |
|
531 | + $decode = array_merge(array('Message nature' => 'Flight Management Computer - Center'), $decode); |
|
532 | 532 | } |
533 | - elseif (preg_match(':^#MD:',$message)) { |
|
534 | - $decode = array_merge(array('Message nature' => 'Flight Management Computer - Selected'),$decode); |
|
533 | + elseif (preg_match(':^#MD:', $message)) { |
|
534 | + $decode = array_merge(array('Message nature' => 'Flight Management Computer - Selected'), $decode); |
|
535 | 535 | } |
536 | - elseif (preg_match(':^#PS:',$message)) { |
|
537 | - $decode = array_merge(array('Message nature' => 'Keyboard/Display Unit'),$decode); |
|
536 | + elseif (preg_match(':^#PS:', $message)) { |
|
537 | + $decode = array_merge(array('Message nature' => 'Keyboard/Display Unit'), $decode); |
|
538 | 538 | } |
539 | - elseif (preg_match(':^#S1:',$message)) { |
|
540 | - $decode = array_merge(array('Message nature' => 'SDU - Left'),$decode); |
|
539 | + elseif (preg_match(':^#S1:', $message)) { |
|
540 | + $decode = array_merge(array('Message nature' => 'SDU - Left'), $decode); |
|
541 | 541 | } |
542 | - elseif (preg_match(':^#S2:',$message)) { |
|
543 | - $decode = array_merge(array('Message nature' => 'SDU - Right'),$decode); |
|
542 | + elseif (preg_match(':^#S2:', $message)) { |
|
543 | + $decode = array_merge(array('Message nature' => 'SDU - Right'), $decode); |
|
544 | 544 | } |
545 | - elseif (preg_match(':^#SD:',$message)) { |
|
546 | - $decode = array_merge(array('Message nature' => 'SDU - Selected'),$decode); |
|
545 | + elseif (preg_match(':^#SD:', $message)) { |
|
546 | + $decode = array_merge(array('Message nature' => 'SDU - Selected'), $decode); |
|
547 | 547 | } |
548 | - elseif (preg_match(':^#T[0-8]:',$message)) { |
|
549 | - $decode = array_merge(array('Message nature' => 'Cabin Terminal Messages'),$decode); |
|
548 | + elseif (preg_match(':^#T[0-8]:', $message)) { |
|
549 | + $decode = array_merge(array('Message nature' => 'Cabin Terminal Messages'), $decode); |
|
550 | 550 | } |
551 | - elseif (preg_match(':^#WO:',$message)) { |
|
552 | - $decode = array_merge(array('Message nature' => 'Weather Observation Report'),$decode); |
|
551 | + elseif (preg_match(':^#WO:', $message)) { |
|
552 | + $decode = array_merge(array('Message nature' => 'Weather Observation Report'), $decode); |
|
553 | 553 | } |
554 | - elseif (preg_match(':^#A1:',$message)) { |
|
555 | - $decode = array_merge(array('Message nature' => 'Oceanic Clearance'),$decode); |
|
554 | + elseif (preg_match(':^#A1:', $message)) { |
|
555 | + $decode = array_merge(array('Message nature' => 'Oceanic Clearance'), $decode); |
|
556 | 556 | } |
557 | - elseif (preg_match(':^#A3:',$message)) { |
|
558 | - $decode = array_merge(array('Message nature' => 'Departure Clearance Response'),$decode); |
|
557 | + elseif (preg_match(':^#A3:', $message)) { |
|
558 | + $decode = array_merge(array('Message nature' => 'Departure Clearance Response'), $decode); |
|
559 | 559 | } |
560 | - elseif (preg_match(':^#A4:',$message)) { |
|
561 | - $decode = array_merge(array('Message nature' => 'Flight Systems Message'),$decode); |
|
560 | + elseif (preg_match(':^#A4:', $message)) { |
|
561 | + $decode = array_merge(array('Message nature' => 'Flight Systems Message'), $decode); |
|
562 | 562 | } |
563 | - elseif (preg_match(':^#A6:',$message)) { |
|
564 | - $decode = array_merge(array('Message nature' => 'Request ADS Reports'),$decode); |
|
563 | + elseif (preg_match(':^#A6:', $message)) { |
|
564 | + $decode = array_merge(array('Message nature' => 'Request ADS Reports'), $decode); |
|
565 | 565 | } |
566 | - elseif (preg_match(':^#A8:',$message)) { |
|
567 | - $decode = array_merge(array('Message nature' => 'Deliver Departure Slot'),$decode); |
|
566 | + elseif (preg_match(':^#A8:', $message)) { |
|
567 | + $decode = array_merge(array('Message nature' => 'Deliver Departure Slot'), $decode); |
|
568 | 568 | } |
569 | - elseif (preg_match(':^#A9:',$message)) { |
|
570 | - $decode = array_merge(array('Message nature' => 'ATIS report'),$decode); |
|
569 | + elseif (preg_match(':^#A9:', $message)) { |
|
570 | + $decode = array_merge(array('Message nature' => 'ATIS report'), $decode); |
|
571 | 571 | } |
572 | - elseif (preg_match(':^#A0:',$message)) { |
|
573 | - $decode = array_merge(array('Message nature' => 'ATIS Facility Notification (AFN)'),$decode); |
|
572 | + elseif (preg_match(':^#A0:', $message)) { |
|
573 | + $decode = array_merge(array('Message nature' => 'ATIS Facility Notification (AFN)'), $decode); |
|
574 | 574 | } |
575 | - elseif (preg_match(':^#AA:',$message)) { |
|
576 | - $decode = array_merge(array('Message nature' => 'ATCComm'),$decode); |
|
575 | + elseif (preg_match(':^#AA:', $message)) { |
|
576 | + $decode = array_merge(array('Message nature' => 'ATCComm'), $decode); |
|
577 | 577 | } |
578 | - elseif (preg_match(':^#AB:',$message)) { |
|
579 | - $decode = array_merge(array('Message nature' => 'TWIP Report'),$decode); |
|
578 | + elseif (preg_match(':^#AB:', $message)) { |
|
579 | + $decode = array_merge(array('Message nature' => 'TWIP Report'), $decode); |
|
580 | 580 | } |
581 | - elseif (preg_match(':^#AC:',$message)) { |
|
582 | - $decode = array_merge(array('Message nature' => 'Pushback Clearance'),$decode); |
|
581 | + elseif (preg_match(':^#AC:', $message)) { |
|
582 | + $decode = array_merge(array('Message nature' => 'Pushback Clearance'), $decode); |
|
583 | 583 | } |
584 | - elseif (preg_match(':^#AD:',$message)) { |
|
585 | - $decode = array_merge(array('Message nature' => 'Expected Taxi Clearance'),$decode); |
|
584 | + elseif (preg_match(':^#AD:', $message)) { |
|
585 | + $decode = array_merge(array('Message nature' => 'Expected Taxi Clearance'), $decode); |
|
586 | 586 | } |
587 | - elseif (preg_match(':^#AF:',$message)) { |
|
588 | - $decode = array_merge(array('Message nature' => 'CPC Command/Response'),$decode); |
|
587 | + elseif (preg_match(':^#AF:', $message)) { |
|
588 | + $decode = array_merge(array('Message nature' => 'CPC Command/Response'), $decode); |
|
589 | 589 | } |
590 | - elseif (preg_match(':^#B1:',$message)) { |
|
591 | - $decode = array_merge(array('Message nature' => 'Request Oceanic Clearance'),$decode); |
|
590 | + elseif (preg_match(':^#B1:', $message)) { |
|
591 | + $decode = array_merge(array('Message nature' => 'Request Oceanic Clearance'), $decode); |
|
592 | 592 | } |
593 | - elseif (preg_match(':^#B2:',$message)) { |
|
594 | - $decode = array_merge(array('Message nature' => 'Oceanic Clearance Readback'),$decode); |
|
593 | + elseif (preg_match(':^#B2:', $message)) { |
|
594 | + $decode = array_merge(array('Message nature' => 'Oceanic Clearance Readback'), $decode); |
|
595 | 595 | } |
596 | - elseif (preg_match(':^#B3:',$message)) { |
|
597 | - $decode = array_merge(array('Message nature' => 'Request Departure Clearance'),$decode); |
|
596 | + elseif (preg_match(':^#B3:', $message)) { |
|
597 | + $decode = array_merge(array('Message nature' => 'Request Departure Clearance'), $decode); |
|
598 | 598 | } |
599 | - elseif (preg_match(':^#B4:',$message)) { |
|
600 | - $decode = array_merge(array('Message nature' => 'Departure Clearance Readback'),$decode); |
|
599 | + elseif (preg_match(':^#B4:', $message)) { |
|
600 | + $decode = array_merge(array('Message nature' => 'Departure Clearance Readback'), $decode); |
|
601 | 601 | } |
602 | - elseif (preg_match(':^#B6:',$message)) { |
|
603 | - $decode = array_merge(array('Message nature' => 'Provide ADS Report'),$decode); |
|
602 | + elseif (preg_match(':^#B6:', $message)) { |
|
603 | + $decode = array_merge(array('Message nature' => 'Provide ADS Report'), $decode); |
|
604 | 604 | } |
605 | - elseif (preg_match(':^#B8:',$message)) { |
|
606 | - $decode = array_merge(array('Message nature' => 'Request Departure Slot'),$decode); |
|
605 | + elseif (preg_match(':^#B8:', $message)) { |
|
606 | + $decode = array_merge(array('Message nature' => 'Request Departure Slot'), $decode); |
|
607 | 607 | } |
608 | - elseif (preg_match(':^#B9:',$message)) { |
|
609 | - $decode = array_merge(array('Message nature' => 'Request ATIS Report'),$decode); |
|
608 | + elseif (preg_match(':^#B9:', $message)) { |
|
609 | + $decode = array_merge(array('Message nature' => 'Request ATIS Report'), $decode); |
|
610 | 610 | } |
611 | - elseif (preg_match(':^#B0:',$message)) { |
|
612 | - $decode = array_merge(array('Message nature' => 'ATS Facility Notification'),$decode); |
|
611 | + elseif (preg_match(':^#B0:', $message)) { |
|
612 | + $decode = array_merge(array('Message nature' => 'ATS Facility Notification'), $decode); |
|
613 | 613 | } |
614 | - elseif (preg_match(':^#BA:',$message)) { |
|
615 | - $decode = array_merge(array('Message nature' => 'ATCComm'),$decode); |
|
614 | + elseif (preg_match(':^#BA:', $message)) { |
|
615 | + $decode = array_merge(array('Message nature' => 'ATCComm'), $decode); |
|
616 | 616 | } |
617 | - elseif (preg_match(':^#BB:',$message)) { |
|
618 | - $decode = array_merge(array('Message nature' => 'Request TWIP Report'),$decode); |
|
617 | + elseif (preg_match(':^#BB:', $message)) { |
|
618 | + $decode = array_merge(array('Message nature' => 'Request TWIP Report'), $decode); |
|
619 | 619 | } |
620 | - elseif (preg_match(':^#BC:',$message)) { |
|
621 | - $decode = array_merge(array('Message nature' => 'Pushback Clearance Request'),$decode); |
|
620 | + elseif (preg_match(':^#BC:', $message)) { |
|
621 | + $decode = array_merge(array('Message nature' => 'Pushback Clearance Request'), $decode); |
|
622 | 622 | } |
623 | - elseif (preg_match(':^#BD:',$message)) { |
|
624 | - $decode = array_merge(array('Message nature' => 'Expected Taxi Clearance Request'),$decode); |
|
623 | + elseif (preg_match(':^#BD:', $message)) { |
|
624 | + $decode = array_merge(array('Message nature' => 'Expected Taxi Clearance Request'), $decode); |
|
625 | 625 | } |
626 | - elseif (preg_match(':^#BE:',$message)) { |
|
627 | - $decode = array_merge(array('Message nature' => 'CPC Aircraft Log-On/Off Request'),$decode); |
|
626 | + elseif (preg_match(':^#BE:', $message)) { |
|
627 | + $decode = array_merge(array('Message nature' => 'CPC Aircraft Log-On/Off Request'), $decode); |
|
628 | 628 | } |
629 | - elseif (preg_match(':^#BF:',$message)) { |
|
630 | - $decode = array_merge(array('Message nature' => 'CPC WILCO/UNABLE Response'),$decode); |
|
629 | + elseif (preg_match(':^#BF:', $message)) { |
|
630 | + $decode = array_merge(array('Message nature' => 'CPC WILCO/UNABLE Response'), $decode); |
|
631 | 631 | } |
632 | - elseif (preg_match(':^#H3:',$message)) { |
|
633 | - $decode = array_merge(array('Message nature' => 'Icing Report'),$decode); |
|
632 | + elseif (preg_match(':^#H3:', $message)) { |
|
633 | + $decode = array_merge(array('Message nature' => 'Icing Report'), $decode); |
|
634 | 634 | } |
635 | 635 | } |
636 | 636 | if ($label == '10') { |
637 | - if (preg_match(':^DTO01:',$message)) { |
|
638 | - $decode = array_merge(array('Message nature' => 'Delayed Takeoff Report'),$decode); |
|
637 | + if (preg_match(':^DTO01:', $message)) { |
|
638 | + $decode = array_merge(array('Message nature' => 'Delayed Takeoff Report'), $decode); |
|
639 | 639 | } |
640 | - elseif (preg_match(':^AIS01:',$message)) { |
|
641 | - $decode = array_merge(array('Message nature' => 'AIS Request'),$decode); |
|
640 | + elseif (preg_match(':^AIS01:', $message)) { |
|
641 | + $decode = array_merge(array('Message nature' => 'AIS Request'), $decode); |
|
642 | 642 | } |
643 | - elseif (preg_match(':^FTX01:',$message)) { |
|
644 | - $decode = array_merge(array('Message nature' => 'Free Text Downlink'),$decode); |
|
643 | + elseif (preg_match(':^FTX01:', $message)) { |
|
644 | + $decode = array_merge(array('Message nature' => 'Free Text Downlink'), $decode); |
|
645 | 645 | } |
646 | - elseif (preg_match(':^FPL01:',$message)) { |
|
647 | - $decode = array_merge(array('Message nature' => 'Flight Plan Request'),$decode); |
|
646 | + elseif (preg_match(':^FPL01:', $message)) { |
|
647 | + $decode = array_merge(array('Message nature' => 'Flight Plan Request'), $decode); |
|
648 | 648 | } |
649 | - elseif (preg_match(':^WAB01:',$message)) { |
|
650 | - $decode = array_merge(array('Message nature' => 'Weight & Balance Request'),$decode); |
|
649 | + elseif (preg_match(':^WAB01:', $message)) { |
|
650 | + $decode = array_merge(array('Message nature' => 'Weight & Balance Request'), $decode); |
|
651 | 651 | } |
652 | - elseif (preg_match(':^MET01:',$message)) { |
|
653 | - $decode = array_merge(array('Message nature' => 'Weather Data Request'),$decode); |
|
652 | + elseif (preg_match(':^MET01:', $message)) { |
|
653 | + $decode = array_merge(array('Message nature' => 'Weather Data Request'), $decode); |
|
654 | 654 | } |
655 | - elseif (preg_match(':^WAB02:',$message)) { |
|
656 | - $decode = array_merge(array('Message nature' => 'Weight and Balance Acknowledgement'),$decode); |
|
655 | + elseif (preg_match(':^WAB02:', $message)) { |
|
656 | + $decode = array_merge(array('Message nature' => 'Weight and Balance Acknowledgement'), $decode); |
|
657 | 657 | } |
658 | 658 | } |
659 | 659 | if ($label == '15') { |
660 | - if (preg_match(':^FST01:',$message)) { |
|
661 | - $decode = array_merge(array('Message nature' => 'Flight Status Report'),$decode); |
|
660 | + if (preg_match(':^FST01:', $message)) { |
|
661 | + $decode = array_merge(array('Message nature' => 'Flight Status Report'), $decode); |
|
662 | 662 | } |
663 | 663 | } |
664 | 664 | if (!$found && $label == 'SA') { |
665 | - $n = sscanf($message, "%d%c%c%6[0-9]", $version,$state,$type,$at); |
|
665 | + $n = sscanf($message, "%d%c%c%6[0-9]", $version, $state, $type, $at); |
|
666 | 666 | if ($n == 4) { |
667 | 667 | $vsta = array('Version' => $version); |
668 | 668 | if ($state == 'E') { |
669 | - $vsta = array_merge($vsta,array('Link state' => 'Established')); |
|
669 | + $vsta = array_merge($vsta, array('Link state' => 'Established')); |
|
670 | 670 | } |
671 | 671 | elseif ($state == 'L') { |
672 | - $vsta = array_merge($vsta,array('Link state' => 'Lost')); |
|
672 | + $vsta = array_merge($vsta, array('Link state' => 'Lost')); |
|
673 | 673 | } |
674 | 674 | else { |
675 | - $vsta = array_merge($vsta,array('Link state' => 'Unknown')); |
|
675 | + $vsta = array_merge($vsta, array('Link state' => 'Unknown')); |
|
676 | 676 | } |
677 | 677 | if ($type == 'V') { |
678 | - $vsta = array_merge($vsta,array('Link type' => 'VHF ACARS')); |
|
678 | + $vsta = array_merge($vsta, array('Link type' => 'VHF ACARS')); |
|
679 | 679 | } |
680 | 680 | elseif ($type == 'S') { |
681 | - $vsta = array_merge($vsta,array('Link type' => 'Generic SATCOM')); |
|
681 | + $vsta = array_merge($vsta, array('Link type' => 'Generic SATCOM')); |
|
682 | 682 | } |
683 | 683 | elseif ($type == 'H') { |
684 | - $vsta = array_merge($vsta,array('Link type' => 'HF')); |
|
684 | + $vsta = array_merge($vsta, array('Link type' => 'HF')); |
|
685 | 685 | } |
686 | 686 | elseif ($type == 'G') { |
687 | - $vsta = array_merge($vsta,array('Link type' => 'GlobalStar SATCOM')); |
|
687 | + $vsta = array_merge($vsta, array('Link type' => 'GlobalStar SATCOM')); |
|
688 | 688 | } |
689 | 689 | elseif ($type == 'C') { |
690 | - $vsta = array_merge($vsta,array('Link type' => 'ICO SATCOM')); |
|
690 | + $vsta = array_merge($vsta, array('Link type' => 'ICO SATCOM')); |
|
691 | 691 | } |
692 | 692 | elseif ($type == '2') { |
693 | - $vsta = array_merge($vsta,array('Link type' => 'VDL Mode 2')); |
|
693 | + $vsta = array_merge($vsta, array('Link type' => 'VDL Mode 2')); |
|
694 | 694 | } |
695 | 695 | elseif ($type == 'X') { |
696 | - $vsta = array_merge($vsta,array('Link type' => 'Inmarsat Aero')); |
|
696 | + $vsta = array_merge($vsta, array('Link type' => 'Inmarsat Aero')); |
|
697 | 697 | } |
698 | 698 | elseif ($type == 'I') { |
699 | - $vsta = array_merge($vsta,array('Link type' => 'Irridium SATCOM')); |
|
699 | + $vsta = array_merge($vsta, array('Link type' => 'Irridium SATCOM')); |
|
700 | 700 | } |
701 | 701 | else { |
702 | - $vsta = array_merge($vsta,array('Link type' => 'Unknown')); |
|
702 | + $vsta = array_merge($vsta, array('Link type' => 'Unknown')); |
|
703 | 703 | } |
704 | - $vsta = array_merge($vsta,array('Event occured at' => implode(':',str_split($at,2)))); |
|
705 | - $decode = array_merge($vsta,$decode); |
|
704 | + $vsta = array_merge($vsta, array('Event occured at' => implode(':', str_split($at, 2)))); |
|
705 | + $decode = array_merge($vsta, $decode); |
|
706 | 706 | } |
707 | 707 | } |
708 | 708 | |
709 | 709 | $title = $this->getTitlefromLabel($label); |
710 | - if ($title != '') $decode = array_merge(array('Message title' => $title),$decode); |
|
710 | + if ($title != '') $decode = array_merge(array('Message title' => $title), $decode); |
|
711 | 711 | |
712 | 712 | /* |
713 | 713 | // Business jets always use GS0001 |
@@ -740,13 +740,13 @@ discard block |
||
740 | 740 | $message = $this->parse($data); |
741 | 741 | if (isset($message['registration']) && $message['registration'] != '' && $message['ident'] != '' && $message['registration'] != '!') { |
742 | 742 | |
743 | - $ident = (string)$message['ident']; |
|
743 | + $ident = (string) $message['ident']; |
|
744 | 744 | $label = $message['label']; |
745 | 745 | $block_id = $message['block_id']; |
746 | 746 | $msg_no = $message['msg_no']; |
747 | 747 | $msg = $message['message']; |
748 | 748 | $decode = $message['decode']; |
749 | - $registration = (string)$message['registration']; |
|
749 | + $registration = (string) $message['registration']; |
|
750 | 750 | |
751 | 751 | if (isset($decode['latitude'])) $latitude = $decode['latitude']; |
752 | 752 | else $latitude = ''; |
@@ -763,23 +763,23 @@ discard block |
||
763 | 763 | } |
764 | 764 | |
765 | 765 | // Business jets always use GS0001 |
766 | - if ($ident != 'GS0001') $info = $this->addModeSData($ident,$registration,$icao,$airicao,$latitude,$longitude); |
|
766 | + if ($ident != 'GS0001') $info = $this->addModeSData($ident, $registration, $icao, $airicao, $latitude, $longitude); |
|
767 | 767 | if ($globalDebug && isset($info) && $info != '') echo $info; |
768 | 768 | |
769 | 769 | if (count($decode) > 0) $decode_json = json_encode($decode); |
770 | 770 | else $decode_json = ''; |
771 | 771 | if (isset($decode['Departure airport']) && isset($decode['Departure hour']) && isset($decode['Arrival airport']) && isset($decode['Arrival hour'])) { |
772 | - $Schedule->addSchedule($icao,$decode['Departure airport'],$decode['Departure hour'],$decode['Arrival airport'],$decode['Arrival hour'],'ACARS'); |
|
772 | + $Schedule->addSchedule($icao, $decode['Departure airport'], $decode['Departure hour'], $decode['Arrival airport'], $decode['Arrival hour'], 'ACARS'); |
|
773 | 773 | } elseif (isset($decode['Departure airport']) && isset($decode['Arrival airport'])) { |
774 | - $Schedule->addSchedule($icao,$decode['Departure airport'],'',$decode['Arrival airport'],'','ACARS'); |
|
774 | + $Schedule->addSchedule($icao, $decode['Departure airport'], '', $decode['Arrival airport'], '', 'ACARS'); |
|
775 | 775 | } |
776 | 776 | |
777 | - $result = $this->addLiveAcarsData($ident,$registration,$label,$block_id,$msg_no,$msg,$decode_json); |
|
778 | - if (!isset($globalACARSArchive)) $globalACARSArchive = array('10','80','81','82','3F'); |
|
779 | - if ($result && in_array($label,$globalACARSArchive)) $this->addArchiveAcarsData($ident,$registration,$label,$block_id,$msg_no,$msg,$decode_json); |
|
777 | + $result = $this->addLiveAcarsData($ident, $registration, $label, $block_id, $msg_no, $msg, $decode_json); |
|
778 | + if (!isset($globalACARSArchive)) $globalACARSArchive = array('10', '80', '81', '82', '3F'); |
|
779 | + if ($result && in_array($label, $globalACARSArchive)) $this->addArchiveAcarsData($ident, $registration, $label, $block_id, $msg_no, $msg, $decode_json); |
|
780 | 780 | |
781 | 781 | if ($globalDebug && count($decode) > 0) { |
782 | - echo "Human readable data : ".implode(' - ',$decode)."\n"; |
|
782 | + echo "Human readable data : ".implode(' - ', $decode)."\n"; |
|
783 | 783 | } |
784 | 784 | } |
785 | 785 | } |
@@ -794,7 +794,7 @@ discard block |
||
794 | 794 | * @param String $msg_no Number of the ACARS message |
795 | 795 | * @param String $message ACARS message |
796 | 796 | */ |
797 | - public function addLiveAcarsData($ident,$registration,$label,$block_id,$msg_no,$message,$decode = '') { |
|
797 | + public function addLiveAcarsData($ident, $registration, $label, $block_id, $msg_no, $message, $decode = '') { |
|
798 | 798 | global $globalDebug; |
799 | 799 | date_default_timezone_set('UTC'); |
800 | 800 | if ($label != 'SQ' && $label != 'Q0' && $label != '_d' && $message != '') { |
@@ -803,22 +803,22 @@ discard block |
||
803 | 803 | |
804 | 804 | if ($globalDebug) echo "Test if not already in Live ACARS table..."; |
805 | 805 | $query_test = "SELECT COUNT(*) as nb FROM acars_live WHERE ident = :ident AND registration = :registration AND message = :message"; |
806 | - $query_test_values = array(':ident' => $ident,':registration' => $registration, ':message' => $message); |
|
806 | + $query_test_values = array(':ident' => $ident, ':registration' => $registration, ':message' => $message); |
|
807 | 807 | try { |
808 | 808 | $stht = $this->db->prepare($query_test); |
809 | 809 | $stht->execute($query_test_values); |
810 | - } catch(PDOException $e) { |
|
810 | + } catch (PDOException $e) { |
|
811 | 811 | return "error : ".$e->getMessage(); |
812 | 812 | } |
813 | 813 | if ($stht->fetchColumn() == 0) { |
814 | 814 | if ($globalDebug) echo "Add Live ACARS data..."; |
815 | 815 | $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)"; |
816 | - $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")); |
|
816 | + $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")); |
|
817 | 817 | try { |
818 | 818 | |
819 | 819 | $sth = $this->db->prepare($query); |
820 | 820 | $sth->execute($query_values); |
821 | - } catch(PDOException $e) { |
|
821 | + } catch (PDOException $e) { |
|
822 | 822 | return "error : ".$e->getMessage(); |
823 | 823 | } |
824 | 824 | } else { |
@@ -840,10 +840,10 @@ discard block |
||
840 | 840 | * @param String $msg_no Number of the ACARS message |
841 | 841 | * @param String $message ACARS message |
842 | 842 | */ |
843 | - public function addArchiveAcarsData($ident,$registration,$label,$block_id,$msg_no,$message,$decode = '') { |
|
843 | + public function addArchiveAcarsData($ident, $registration, $label, $block_id, $msg_no, $message, $decode = '') { |
|
844 | 844 | global $globalDebug; |
845 | 845 | date_default_timezone_set('UTC'); |
846 | - 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) { |
|
846 | + 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) { |
|
847 | 847 | /* |
848 | 848 | if ($globalDebug) echo "Test if not already in Archive ACARS table..."; |
849 | 849 | $query_test = "SELECT COUNT(*) as nb FROM acars_archive WHERE ident = :ident AND registration = :registration AND message = :message"; |
@@ -859,12 +859,12 @@ discard block |
||
859 | 859 | */ |
860 | 860 | if ($globalDebug) echo "Add Live ACARS data..."; |
861 | 861 | $query = "INSERT INTO acars_archive (ident,registration,label,block_id,msg_no,message,decode) VALUES (:ident,:registration,:label,:block_id,:msg_no,:message,:decode)"; |
862 | - $query_values = array(':ident' => $ident,':registration' => $registration, ':label' => $label,':block_id' => $block_id, ':msg_no' => $msg_no, ':message' => $message, ':decode' => $decode); |
|
862 | + $query_values = array(':ident' => $ident, ':registration' => $registration, ':label' => $label, ':block_id' => $block_id, ':msg_no' => $msg_no, ':message' => $message, ':decode' => $decode); |
|
863 | 863 | try { |
864 | 864 | |
865 | 865 | $sth = $this->db->prepare($query); |
866 | 866 | $sth->execute($query_values); |
867 | - } catch(PDOException $e) { |
|
867 | + } catch (PDOException $e) { |
|
868 | 868 | return "error : ".$e->getMessage(); |
869 | 869 | } |
870 | 870 | // } |
@@ -887,7 +887,7 @@ discard block |
||
887 | 887 | |
888 | 888 | $sth = $this->db->prepare($query); |
889 | 889 | $sth->execute($query_values); |
890 | - } catch(PDOException $e) { |
|
890 | + } catch (PDOException $e) { |
|
891 | 891 | echo "error : ".$e->getMessage(); |
892 | 892 | die; |
893 | 893 | } |
@@ -908,7 +908,7 @@ discard block |
||
908 | 908 | |
909 | 909 | $sth = $this->db->prepare($query); |
910 | 910 | $sth->execute($query_values); |
911 | - } catch(PDOException $e) { |
|
911 | + } catch (PDOException $e) { |
|
912 | 912 | echo "error : ".$e->getMessage(); |
913 | 913 | die; |
914 | 914 | } |
@@ -930,7 +930,7 @@ discard block |
||
930 | 930 | |
931 | 931 | $sth = $this->db->prepare($query); |
932 | 932 | $sth->execute($query_values); |
933 | - } catch(PDOException $e) { |
|
933 | + } catch (PDOException $e) { |
|
934 | 934 | echo "error : ".$e->getMessage(); |
935 | 935 | die; |
936 | 936 | } |
@@ -944,7 +944,7 @@ discard block |
||
944 | 944 | * |
945 | 945 | * @return Array Return ACARS data in array |
946 | 946 | */ |
947 | - public function getLatestAcarsData($limit = '',$label = '') { |
|
947 | + public function getLatestAcarsData($limit = '', $label = '') { |
|
948 | 948 | global $globalURL, $globalDBdriver; |
949 | 949 | $Image = new Image($this->db); |
950 | 950 | $Spotter = new Spotter($this->db); |
@@ -956,8 +956,8 @@ discard block |
||
956 | 956 | { |
957 | 957 | $limit_array = explode(",", $limit); |
958 | 958 | |
959 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
960 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
959 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
960 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
961 | 961 | |
962 | 962 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
963 | 963 | { |
@@ -979,48 +979,48 @@ discard block |
||
979 | 979 | |
980 | 980 | $sth = $this->db->prepare($query); |
981 | 981 | $sth->execute($query_values); |
982 | - } catch(PDOException $e) { |
|
982 | + } catch (PDOException $e) { |
|
983 | 983 | return "error : ".$e->getMessage(); |
984 | 984 | } |
985 | 985 | $i = 0; |
986 | 986 | while ($row = $sth->fetch(PDO::FETCH_ASSOC)) { |
987 | 987 | $data = array(); |
988 | 988 | if ($row['registration'] != '') { |
989 | - $row['registration'] = str_replace('.','',$row['registration']); |
|
989 | + $row['registration'] = str_replace('.', '', $row['registration']); |
|
990 | 990 | $image_array = $Image->getSpotterImage($row['registration']); |
991 | - 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'])); |
|
992 | - else $data = array_merge($data,array('image' => '','image_thumbnail' => '','image_copyright' => '','image_source' => '','image_source_website' => '')); |
|
993 | - } else $data = array_merge($data,array('image' => '','image_thumbnail' => '','image_copyright' => '','image_source' => '','image_source_website' => '')); |
|
991 | + 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'])); |
|
992 | + else $data = array_merge($data, array('image' => '', 'image_thumbnail' => '', 'image_copyright' => '', 'image_source' => '', 'image_source_website' => '')); |
|
993 | + } else $data = array_merge($data, array('image' => '', 'image_thumbnail' => '', 'image_copyright' => '', 'image_source' => '', 'image_source_website' => '')); |
|
994 | 994 | if ($row['registration'] == '') $row['registration'] = 'NA'; |
995 | 995 | if ($row['ident'] == '') $row['ident'] = 'NA'; |
996 | - $identicao = $Spotter->getAllAirlineInfo(substr($row['ident'],0,2)); |
|
996 | + $identicao = $Spotter->getAllAirlineInfo(substr($row['ident'], 0, 2)); |
|
997 | 997 | if (isset($identicao[0])) { |
998 | - if (substr($row['ident'],0,2) == 'AF') { |
|
999 | - if (filter_var(substr($row['ident'],2),FILTER_VALIDATE_INT,array("flags"=>FILTER_FLAG_ALLOW_OCTAL))) $icao = $row['ident']; |
|
1000 | - else $icao = 'AFR'.ltrim(substr($row['ident'],2),'0'); |
|
1001 | - } else $icao = $identicao[0]['icao'].ltrim(substr($row['ident'],2),'0'); |
|
998 | + if (substr($row['ident'], 0, 2) == 'AF') { |
|
999 | + if (filter_var(substr($row['ident'], 2), FILTER_VALIDATE_INT, array("flags"=>FILTER_FLAG_ALLOW_OCTAL))) $icao = $row['ident']; |
|
1000 | + else $icao = 'AFR'.ltrim(substr($row['ident'], 2), '0'); |
|
1001 | + } else $icao = $identicao[0]['icao'].ltrim(substr($row['ident'], 2), '0'); |
|
1002 | 1002 | |
1003 | - $data = array_merge($data,array('airline_icao' => $identicao[0]['icao'],'airline_name' => $identicao[0]['name'])); |
|
1003 | + $data = array_merge($data, array('airline_icao' => $identicao[0]['icao'], 'airline_name' => $identicao[0]['name'])); |
|
1004 | 1004 | } else $icao = $row['ident']; |
1005 | - $icao = $Translation->checkTranslation($icao,false); |
|
1005 | + $icao = $Translation->checkTranslation($icao, false); |
|
1006 | 1006 | |
1007 | - $decode = json_decode($row['decode'],true); |
|
1007 | + $decode = json_decode($row['decode'], true); |
|
1008 | 1008 | $found = false; |
1009 | - if ($decode != '' && array_key_exists('Departure airport',$decode)) { |
|
1009 | + if ($decode != '' && array_key_exists('Departure airport', $decode)) { |
|
1010 | 1010 | $airport_info = $Spotter->getAllAirportInfo($decode['Departure airport']); |
1011 | 1011 | if (isset($airport_info[0]['icao'])) { |
1012 | 1012 | $decode['Departure airport'] = '<a href="'.$globalURL.'/airport/'.$airport_info[0]['icao'].'">'.$airport_info[0]['city'].','.$airport_info[0]['country'].' ('.$airport_info[0]['icao'].')</a>'; |
1013 | 1013 | $found = true; |
1014 | 1014 | } |
1015 | 1015 | } |
1016 | - if ($decode != '' && array_key_exists('Arrival airport',$decode)) { |
|
1016 | + if ($decode != '' && array_key_exists('Arrival airport', $decode)) { |
|
1017 | 1017 | $airport_info = $Spotter->getAllAirportInfo($decode['Arrival airport']); |
1018 | 1018 | if (isset($airport_info[0]['icao'])) { |
1019 | 1019 | $decode['Arrival airport'] = '<a href="'.$globalURL.'/airport/'.$airport_info[0]['icao'].'">'.$airport_info[0]['city'].','.$airport_info[0]['country'].' ('.$airport_info[0]['icao'].')</a>'; |
1020 | 1020 | $found = true; |
1021 | 1021 | } |
1022 | 1022 | } |
1023 | - if ($decode != '' && array_key_exists('Airport/Waypoint name',$decode)) { |
|
1023 | + if ($decode != '' && array_key_exists('Airport/Waypoint name', $decode)) { |
|
1024 | 1024 | $airport_info = $Spotter->getAllAirportInfo($decode['Airport/Waypoint name']); |
1025 | 1025 | if (isset($airport_info[0]['icao'])) { |
1026 | 1026 | $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>'; |
@@ -1028,7 +1028,7 @@ discard block |
||
1028 | 1028 | } |
1029 | 1029 | } |
1030 | 1030 | if ($found) $row['decode'] = json_encode($decode); |
1031 | - $data = array_merge($data,array('registration' => $row['registration'],'message' => $row['message'], 'date' => $row['date'], 'ident' => $icao, 'decode' => $row['decode'])); |
|
1031 | + $data = array_merge($data, array('registration' => $row['registration'], 'message' => $row['message'], 'date' => $row['date'], 'ident' => $icao, 'decode' => $row['decode'])); |
|
1032 | 1032 | $result[] = $data; |
1033 | 1033 | $i++; |
1034 | 1034 | } |
@@ -1044,7 +1044,7 @@ discard block |
||
1044 | 1044 | * |
1045 | 1045 | * @return Array Return ACARS data in array |
1046 | 1046 | */ |
1047 | - public function getArchiveAcarsData($limit = '',$label = '') { |
|
1047 | + public function getArchiveAcarsData($limit = '', $label = '') { |
|
1048 | 1048 | global $globalURL, $globalDBdriver; |
1049 | 1049 | $Image = new Image($this->db); |
1050 | 1050 | $Spotter = new Spotter($this->db); |
@@ -1056,8 +1056,8 @@ discard block |
||
1056 | 1056 | { |
1057 | 1057 | $limit_array = explode(",", $limit); |
1058 | 1058 | |
1059 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
1060 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
1059 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
1060 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
1061 | 1061 | |
1062 | 1062 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
1063 | 1063 | { |
@@ -1087,45 +1087,45 @@ discard block |
||
1087 | 1087 | |
1088 | 1088 | $sth = $this->db->prepare($query); |
1089 | 1089 | $sth->execute($query_values); |
1090 | - } catch(PDOException $e) { |
|
1090 | + } catch (PDOException $e) { |
|
1091 | 1091 | return "error : ".$e->getMessage(); |
1092 | 1092 | } |
1093 | - $i=0; |
|
1093 | + $i = 0; |
|
1094 | 1094 | while ($row = $sth->fetch(PDO::FETCH_ASSOC)) { |
1095 | 1095 | $data = array(); |
1096 | 1096 | if ($row['registration'] != '') { |
1097 | - $row['registration'] = str_replace('.','',$row['registration']); |
|
1097 | + $row['registration'] = str_replace('.', '', $row['registration']); |
|
1098 | 1098 | $image_array = $Image->getSpotterImage($row['registration']); |
1099 | - 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'])); |
|
1100 | - else $data = array_merge($data,array('image_thumbnail' => '','image_copyright' => '','image_source' => '','image_source_website' => '')); |
|
1101 | - } else $data = array_merge($data,array('image_thumbnail' => '','image_copyright' => '','image_source' => '','image_source_website' => '')); |
|
1099 | + 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'])); |
|
1100 | + else $data = array_merge($data, array('image_thumbnail' => '', 'image_copyright' => '', 'image_source' => '', 'image_source_website' => '')); |
|
1101 | + } else $data = array_merge($data, array('image_thumbnail' => '', 'image_copyright' => '', 'image_source' => '', 'image_source_website' => '')); |
|
1102 | 1102 | $icao = ''; |
1103 | 1103 | if ($row['registration'] == '') $row['registration'] = 'NA'; |
1104 | 1104 | if ($row['ident'] == '') $row['ident'] = 'NA'; |
1105 | - $identicao = $Spotter->getAllAirlineInfo(substr($row['ident'],0,2)); |
|
1105 | + $identicao = $Spotter->getAllAirlineInfo(substr($row['ident'], 0, 2)); |
|
1106 | 1106 | if (isset($identicao[0])) { |
1107 | - if (substr($row['ident'],0,2) == 'AF') { |
|
1108 | - if (filter_var(substr($row['ident'],2),FILTER_VALIDATE_INT,array("flags"=>FILTER_FLAG_ALLOW_OCTAL))) $icao = $row['ident']; |
|
1109 | - else $icao = 'AFR'.ltrim(substr($row['ident'],2),'0'); |
|
1110 | - } else $icao = $identicao[0]['icao'].ltrim(substr($row['ident'],2),'0'); |
|
1111 | - $data = array_merge($data,array('airline_icao' => $identicao[0]['icao'],'airline_name' => $identicao[0]['name'])); |
|
1107 | + if (substr($row['ident'], 0, 2) == 'AF') { |
|
1108 | + if (filter_var(substr($row['ident'], 2), FILTER_VALIDATE_INT, array("flags"=>FILTER_FLAG_ALLOW_OCTAL))) $icao = $row['ident']; |
|
1109 | + else $icao = 'AFR'.ltrim(substr($row['ident'], 2), '0'); |
|
1110 | + } else $icao = $identicao[0]['icao'].ltrim(substr($row['ident'], 2), '0'); |
|
1111 | + $data = array_merge($data, array('airline_icao' => $identicao[0]['icao'], 'airline_name' => $identicao[0]['name'])); |
|
1112 | 1112 | } else $icao = $row['ident']; |
1113 | 1113 | $icao = $Translation->checkTranslation($icao); |
1114 | 1114 | |
1115 | 1115 | |
1116 | - $decode = json_decode($row['decode'],true); |
|
1116 | + $decode = json_decode($row['decode'], true); |
|
1117 | 1117 | $found = false; |
1118 | - if ($decode != '' && array_key_exists('Departure airport',$decode)) { |
|
1118 | + if ($decode != '' && array_key_exists('Departure airport', $decode)) { |
|
1119 | 1119 | $airport_info = $Spotter->getAllAirportInfo($decode['Departure airport']); |
1120 | 1120 | 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>'; |
1121 | 1121 | $found = true; |
1122 | 1122 | } |
1123 | - if ($decode != '' && array_key_exists('Arrival airport',$decode)) { |
|
1123 | + if ($decode != '' && array_key_exists('Arrival airport', $decode)) { |
|
1124 | 1124 | $airport_info = $Spotter->getAllAirportInfo($decode['Arrival airport']); |
1125 | 1125 | 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>'; |
1126 | 1126 | $found = true; |
1127 | 1127 | } |
1128 | - if ($decode != '' && array_key_exists('Airport/Waypoint name',$decode)) { |
|
1128 | + if ($decode != '' && array_key_exists('Airport/Waypoint name', $decode)) { |
|
1129 | 1129 | $airport_info = $Spotter->getAllAirportInfo($decode['Airport/Waypoint name']); |
1130 | 1130 | if (isset($airport_info[0]['icao'])) { |
1131 | 1131 | $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>'; |
@@ -1134,7 +1134,7 @@ discard block |
||
1134 | 1134 | } |
1135 | 1135 | if ($found) $row['decode'] = json_encode($decode); |
1136 | 1136 | |
1137 | - $data = array_merge($data,array('registration' => $row['registration'],'message' => $row['message'], 'date' => $row['date'], 'ident' => $icao, 'decode' => $row['decode'])); |
|
1137 | + $data = array_merge($data, array('registration' => $row['registration'], 'message' => $row['message'], 'date' => $row['date'], 'ident' => $icao, 'decode' => $row['decode'])); |
|
1138 | 1138 | $result[] = $data; |
1139 | 1139 | $i++; |
1140 | 1140 | } |
@@ -1152,7 +1152,7 @@ discard block |
||
1152 | 1152 | * @param String $icao |
1153 | 1153 | * @param String $ICAOTypeCode |
1154 | 1154 | */ |
1155 | - public function addModeSData($ident,$registration,$icao = '',$ICAOTypeCode = '',$latitude = '', $longitude = '') { |
|
1155 | + public function addModeSData($ident, $registration, $icao = '', $ICAOTypeCode = '', $latitude = '', $longitude = '') { |
|
1156 | 1156 | global $globalDebug, $globalDBdriver; |
1157 | 1157 | $ident = trim($ident); |
1158 | 1158 | $Translation = new Translation($this->db); |
@@ -1166,7 +1166,7 @@ discard block |
||
1166 | 1166 | return ''; |
1167 | 1167 | } |
1168 | 1168 | |
1169 | - $registration = str_replace('.','',$registration); |
|
1169 | + $registration = str_replace('.', '', $registration); |
|
1170 | 1170 | $ident = $Translation->ident2icao($ident); |
1171 | 1171 | // Check if a flight with same registration is flying now, if ok check if callsign = name in ACARS, else add it to translation |
1172 | 1172 | if ($globalDebug) echo "Check if needed to add translation ".$ident.'... '; |
@@ -1176,7 +1176,7 @@ discard block |
||
1176 | 1176 | |
1177 | 1177 | $sthsi = $this->db->prepare($querysi); |
1178 | 1178 | $sthsi->execute($querysi_values); |
1179 | - } catch(PDOException $e) { |
|
1179 | + } catch (PDOException $e) { |
|
1180 | 1180 | if ($globalDebug) echo $e->getMessage(); |
1181 | 1181 | return "error : ".$e->getMessage(); |
1182 | 1182 | } |
@@ -1187,8 +1187,8 @@ discard block |
||
1187 | 1187 | $Translation = new Translation($this->db); |
1188 | 1188 | $trans_ident = $Translation->getOperator($resultsi['ident']); |
1189 | 1189 | if ($globalDebug) echo 'Add translation to table : '.$ident.' -> '.$resultsi['ident'].' '; |
1190 | - if ($ident != $trans_ident) $Translation->addOperator($resultsi['ident'],$ident,'ACARS'); |
|
1191 | - elseif ($trans_ident == $ident) $Translation->updateOperator($resultsi['ident'],$ident,'ACARS'); |
|
1190 | + if ($ident != $trans_ident) $Translation->addOperator($resultsi['ident'], $ident, 'ACARS'); |
|
1191 | + elseif ($trans_ident == $ident) $Translation->updateOperator($resultsi['ident'], $ident, 'ACARS'); |
|
1192 | 1192 | } else { |
1193 | 1193 | if ($registration != '' && $latitude != '' && $longitude != '') { |
1194 | 1194 | $query = "SELECT ModeS FROM aircraft_modes WHERE Registration = :registration LIMIT 1"; |
@@ -1196,7 +1196,7 @@ discard block |
||
1196 | 1196 | try { |
1197 | 1197 | $sth = $this->db->prepare($query); |
1198 | 1198 | $sth->execute($query_values); |
1199 | - } catch(PDOException $e) { |
|
1199 | + } catch (PDOException $e) { |
|
1200 | 1200 | if ($globalDebug) echo $e->getMessage(); |
1201 | 1201 | return "error : ".$e->getMessage(); |
1202 | 1202 | } |
@@ -1204,7 +1204,7 @@ discard block |
||
1204 | 1204 | $sth->closeCursor(); |
1205 | 1205 | if (isset($result['modes'])) $hex = $result['modes']; |
1206 | 1206 | else $hex = ''; |
1207 | - $SI_data = array('hex' => $hex,'ident' => $ident,'aircraft_icao' => $ICAOTypeCode,'registration' => $registration,'latitude' => $latitude,'$longitude' => $longitude,'format_source' => 'ACARS'); |
|
1207 | + $SI_data = array('hex' => $hex, 'ident' => $ident, 'aircraft_icao' => $ICAOTypeCode, 'registration' => $registration, 'latitude' => $latitude, '$longitude' => $longitude, 'format_source' => 'ACARS'); |
|
1208 | 1208 | $this->SI->add($SI_data); |
1209 | 1209 | } |
1210 | 1210 | } |
@@ -1216,7 +1216,7 @@ discard block |
||
1216 | 1216 | |
1217 | 1217 | $sth = $this->db->prepare($query); |
1218 | 1218 | $sth->execute($query_values); |
1219 | - } catch(PDOException $e) { |
|
1219 | + } catch (PDOException $e) { |
|
1220 | 1220 | if ($globalDebug) echo $e->getMessage(); |
1221 | 1221 | return "error : ".$e->getMessage(); |
1222 | 1222 | } |
@@ -1227,7 +1227,7 @@ discard block |
||
1227 | 1227 | if (isset($result['ModeS'])) $ModeS = $result['ModeS']; |
1228 | 1228 | else $ModeS = ''; |
1229 | 1229 | if ($ModeS == '') { |
1230 | - $id = explode('-',$result['flightaware_id']); |
|
1230 | + $id = explode('-', $result['flightaware_id']); |
|
1231 | 1231 | $ModeS = $id[0]; |
1232 | 1232 | } |
1233 | 1233 | if ($ModeS != '') { |
@@ -1238,21 +1238,21 @@ discard block |
||
1238 | 1238 | |
1239 | 1239 | $sthc = $this->db->prepare($queryc); |
1240 | 1240 | $sthc->execute($queryc_values); |
1241 | - } catch(PDOException $e) { |
|
1241 | + } catch (PDOException $e) { |
|
1242 | 1242 | if ($globalDebug) echo $e->getMessage(); |
1243 | 1243 | return "error : ".$e->getMessage(); |
1244 | 1244 | } |
1245 | 1245 | $row = $sthc->fetch(PDO::FETCH_ASSOC); |
1246 | 1246 | $sthc->closeCursor(); |
1247 | - if (count($row) == 0) { |
|
1247 | + if (count($row) == 0) { |
|
1248 | 1248 | if ($globalDebug) echo " Add to ModeS table - "; |
1249 | 1249 | $queryi = "INSERT INTO aircraft_modes (ModeS,ModeSCountry,Registration,ICAOTypeCode,Source) VALUES (:ModeS,:ModeSCountry,:Registration, :ICAOTypeCode,'ACARS')"; |
1250 | - $queryi_values = array(':ModeS' => $ModeS,':ModeSCountry' => $country,':Registration' => $registration, ':ICAOTypeCode' => $ICAOTypeCode); |
|
1250 | + $queryi_values = array(':ModeS' => $ModeS, ':ModeSCountry' => $country, ':Registration' => $registration, ':ICAOTypeCode' => $ICAOTypeCode); |
|
1251 | 1251 | try { |
1252 | 1252 | |
1253 | 1253 | $sthi = $this->db->prepare($queryi); |
1254 | 1254 | $sthi->execute($queryi_values); |
1255 | - } catch(PDOException $e) { |
|
1255 | + } catch (PDOException $e) { |
|
1256 | 1256 | if ($globalDebug) echo $e->getMessage(); |
1257 | 1257 | return "error : ".$e->getMessage(); |
1258 | 1258 | } |
@@ -1260,16 +1260,16 @@ discard block |
||
1260 | 1260 | if ($globalDebug) echo " Update ModeS table - "; |
1261 | 1261 | if ($ICAOTypeCode != '') { |
1262 | 1262 | $queryi = "UPDATE aircraft_modes SET ModeSCountry = :ModeSCountry,Registration = :Registration,ICAOTypeCode = :ICAOTypeCode,Source = 'ACARS',LastModified = NOW() WHERE ModeS = :ModeS"; |
1263 | - $queryi_values = array(':ModeS' => $ModeS,':ModeSCountry' => $country,':Registration' => $registration, ':ICAOTypeCode' => $ICAOTypeCode); |
|
1263 | + $queryi_values = array(':ModeS' => $ModeS, ':ModeSCountry' => $country, ':Registration' => $registration, ':ICAOTypeCode' => $ICAOTypeCode); |
|
1264 | 1264 | } else { |
1265 | 1265 | $queryi = "UPDATE aircraft_modes SET ModeSCountry = :ModeSCountry,Registration = :Registration,Source = 'ACARS',LastModified = NOW() WHERE ModeS = :ModeS"; |
1266 | - $queryi_values = array(':ModeS' => $ModeS,':ModeSCountry' => $country,':Registration' => $registration); |
|
1266 | + $queryi_values = array(':ModeS' => $ModeS, ':ModeSCountry' => $country, ':Registration' => $registration); |
|
1267 | 1267 | } |
1268 | 1268 | try { |
1269 | 1269 | |
1270 | 1270 | $sthi = $this->db->prepare($queryi); |
1271 | 1271 | $sthi->execute($queryi_values); |
1272 | - } catch(PDOException $e) { |
|
1272 | + } catch (PDOException $e) { |
|
1273 | 1273 | if ($globalDebug) echo $e->getMessage(); |
1274 | 1274 | return "error : ".$e->getMessage(); |
1275 | 1275 | } |
@@ -1307,13 +1307,13 @@ discard block |
||
1307 | 1307 | elseif ($globalDBdriver == 'pgsql') { |
1308 | 1308 | $queryi = "UPDATE spotter_output SET registration = :Registration WHERE ident = :ident AND date >= NOW() AT TIME ZONE 'UTC' - INTERVAL '1 HOUR'"; |
1309 | 1309 | } |
1310 | - $queryi_values = array(':Registration' => $registration,':ident' => $icao); |
|
1310 | + $queryi_values = array(':Registration' => $registration, ':ident' => $icao); |
|
1311 | 1311 | } |
1312 | 1312 | try { |
1313 | 1313 | |
1314 | 1314 | $sthi = $this->db->prepare($queryi); |
1315 | 1315 | $sthi->execute($queryi_values); |
1316 | - } catch(PDOException $e) { |
|
1316 | + } catch (PDOException $e) { |
|
1317 | 1317 | if ($globalDebug) echo $e->getMessage(); |
1318 | 1318 | return "error : ".$e->getMessage(); |
1319 | 1319 | } |
@@ -7,14 +7,14 @@ discard block |
||
7 | 7 | header('Location: '.$globalURL.'/airport'); |
8 | 8 | die(); |
9 | 9 | } |
10 | -$airport = filter_input(INPUT_GET,'airport',FILTER_SANITIZE_STRING); |
|
10 | +$airport = filter_input(INPUT_GET, 'airport', FILTER_SANITIZE_STRING); |
|
11 | 11 | $Spotter = new Spotter(); |
12 | -$spotter_array = $Spotter->getSpotterDataByAirport($airport,"0,1",""); |
|
12 | +$spotter_array = $Spotter->getSpotterDataByAirport($airport, "0,1", ""); |
|
13 | 13 | $airport_array = $Spotter->getAllAirportInfo($airport); |
14 | 14 | |
15 | 15 | if (!empty($airport_array)) |
16 | 16 | { |
17 | - $title = sprintf(_("Most Common Routes to/from %s, %s (%s)"),$airport_array[0]['city'],$airport_array[0]['name'],$airport_array[0]['icao']); |
|
17 | + $title = sprintf(_("Most Common Routes to/from %s, %s (%s)"), $airport_array[0]['city'], $airport_array[0]['name'], $airport_array[0]['icao']); |
|
18 | 18 | |
19 | 19 | require_once('header.php'); |
20 | 20 | print '<div class="select-item">'; |
@@ -25,9 +25,9 @@ discard block |
||
25 | 25 | $airport_names = $Stats->getAllAirportNames(); |
26 | 26 | if (empty($airport_names)) $airport_names = $Spotter->getAllAirportNames(); |
27 | 27 | ksort($airport_names); |
28 | - foreach($airport_names as $airport_name) |
|
28 | + foreach ($airport_names as $airport_name) |
|
29 | 29 | { |
30 | - if($airport == $airport_name['airport_icao']) |
|
30 | + if ($airport == $airport_name['airport_icao']) |
|
31 | 31 | { |
32 | 32 | print '<option value="'.$airport_name['airport_icao'].'" selected="selected">'.$airport_name['airport_city'].', '.$airport_name['airport_name'].', '.$airport_name['airport_country'].' ('.$airport_name['airport_icao'].')</option>'; |
33 | 33 | } else { |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | include('airport-sub-menu.php'); |
59 | 59 | print '<div class="column">'; |
60 | 60 | print '<h2>'._("Most Common Routes").'</h2>'; |
61 | - print '<p>'.sprintf(_("The statistic below shows the most common routes to/from <strong>%s, %s (%s)</strong>."),$airport_array[0]['city'],$airport_array[0]['name'],$airport_array[0]['icao']).'</p>'; |
|
61 | + print '<p>'.sprintf(_("The statistic below shows the most common routes to/from <strong>%s, %s (%s)</strong>."), $airport_array[0]['city'], $airport_array[0]['name'], $airport_array[0]['icao']).'</p>'; |
|
62 | 62 | |
63 | 63 | $route_array = $Spotter->countAllRoutesByAirport($airport); |
64 | 64 | if (!empty($route_array)) |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | print '</thead>'; |
75 | 75 | print '<tbody>'; |
76 | 76 | $i = 1; |
77 | - foreach($route_array as $route_item) |
|
77 | + foreach ($route_array as $route_item) |
|
78 | 78 | { |
79 | 79 | print '<tr>'; |
80 | 80 | 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 ' |
58 | 58 | <script type="text/javascript" src="https://www.google.com/jsapi"></script> |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | var data = google.visualization.arrayToDataTable([ |
68 | 68 | ["'._("Airport").'", "'._("# of times").'"],'; |
69 | 69 | $airport_data = ''; |
70 | - foreach($airport_airport_array as $airport_item) |
|
70 | + foreach ($airport_airport_array as $airport_item) |
|
71 | 71 | { |
72 | 72 | $name = $airport_item['airport_departure_city'].', '.$airport_item['airport_departure_country'].' ('.$airport_item['airport_departure_icao'].')'; |
73 | 73 | $name = str_replace("'", "", $name); |
@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | print '</thead>'; |
107 | 107 | print '<tbody>'; |
108 | 108 | $i = 1; |
109 | - foreach($airport_airport_array as $airport_item) |
|
109 | + foreach ($airport_airport_array as $airport_item) |
|
110 | 110 | { |
111 | 111 | print '<tr>'; |
112 | 112 | 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 Aircraft by Registration from %s (%s)"),$spotter_array[0]['aircraft_name'],$spotter_array[0]['aircraft_type']); |
|
17 | + $title = sprintf(_("Most Common Aircraft by Registration from %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 { |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | include('aircraft-sub-menu.php'); |
52 | 52 | print '<div class="column">'; |
53 | 53 | print '<h2>'._("Most Common Aircraft by Registration").'</h2>'; |
54 | - print '<p>'.sprintf(_("The statistic below shows the most common aircraft by registration of flights from aircraft type <strong>%s (%s)</strong>."),$spotter_array[0]['aircraft_name'],$spotter_array[0]['aircraft_type']).'</p>'; |
|
54 | + print '<p>'.sprintf(_("The statistic below shows the most common aircraft by registration of flights from aircraft type <strong>%s (%s)</strong>."), $spotter_array[0]['aircraft_name'], $spotter_array[0]['aircraft_type']).'</p>'; |
|
55 | 55 | |
56 | 56 | $aircraft_array = $Spotter->countAllAircraftRegistrationByAircraft($aircraft_type); |
57 | 57 | if (!empty($aircraft_array)) |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | print '</thead>'; |
69 | 69 | print '<tbody>'; |
70 | 70 | $i = 1; |
71 | - foreach($aircraft_array as $aircraft_item) |
|
71 | + foreach ($aircraft_array as $aircraft_item) |
|
72 | 72 | { |
73 | 73 | print '<tr>'; |
74 | 74 | 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 Routes from %s (%s)"),$spotter_array[0]['aircraft_name'],$spotter_array[0]['aircraft_type']); |
|
17 | + $title = sprintf(_("Most Common Routes from %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 { |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | include('aircraft-sub-menu.php'); |
52 | 52 | print '<div class="column">'; |
53 | 53 | print '<h2>'._("Most Common Routes").'</h2>'; |
54 | - print '<p>'.sprintf(_("The statistic below shows the most common routes from <strong>%s (%s)</strong>."),$spotter_array[0]['aircraft_name'],$spotter_array[0]['aircraft_type']).'</p>'; |
|
54 | + print '<p>'.sprintf(_("The statistic below shows the most common routes from <strong>%s (%s)</strong>."), $spotter_array[0]['aircraft_name'], $spotter_array[0]['aircraft_type']).'</p>'; |
|
55 | 55 | |
56 | 56 | $route_array = $Spotter->countAllRoutesByAircraft($aircraft_type); |
57 | 57 | if (!empty($route_array)) |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | print '</thead>'; |
69 | 69 | print '<tbody>'; |
70 | 70 | $i = 1; |
71 | - foreach($route_array as $route_item) |
|
71 | + foreach ($route_array as $route_item) |
|
72 | 72 | { |
73 | 73 | print '<tr>'; |
74 | 74 | print '<td><strong>'.$i.'</strong></td>'; |
@@ -7,14 +7,14 @@ discard block |
||
7 | 7 | header('Location: '.$globalURL.'/airport'); |
8 | 8 | die(); |
9 | 9 | } |
10 | -$airport = filter_input(INPUT_GET,'airport',FILTER_SANITIZE_STRING); |
|
10 | +$airport = filter_input(INPUT_GET, 'airport', FILTER_SANITIZE_STRING); |
|
11 | 11 | $Spotter = new Spotter(); |
12 | -$spotter_array = $Spotter->getSpotterDataByAirport($airport,"0,1",""); |
|
12 | +$spotter_array = $Spotter->getSpotterDataByAirport($airport, "0,1", ""); |
|
13 | 13 | $airport_array = $Spotter->getAllAirportInfo($airport); |
14 | 14 | |
15 | 15 | if (!empty($airport_array)) |
16 | 16 | { |
17 | - $title = sprintf(_("Most Common Time of Day to/from %s, %s (%s)"),$airport_array[0]['city'],$airport_array[0]['name'],$airport_array[0]['icao']); |
|
17 | + $title = sprintf(_("Most Common Time of Day to/from %s, %s (%s)"), $airport_array[0]['city'], $airport_array[0]['name'], $airport_array[0]['icao']); |
|
18 | 18 | |
19 | 19 | require_once('header.php'); |
20 | 20 | print '<div class="select-item">'; |
@@ -25,9 +25,9 @@ discard block |
||
25 | 25 | $airport_names = $Stats->getAllAirportNames(); |
26 | 26 | if (empty($airport_names)) $airport_names = $Spotter->getAllAirportNames(); |
27 | 27 | ksort($airport_names); |
28 | - foreach($airport_names as $airport_name) |
|
28 | + foreach ($airport_names as $airport_name) |
|
29 | 29 | { |
30 | - if($airport == $airport_name['airport_icao']) |
|
30 | + if ($airport == $airport_name['airport_icao']) |
|
31 | 31 | { |
32 | 32 | print '<option value="'.$airport_name['airport_icao'].'" selected="selected">'.$airport_name['airport_city'].', '.$airport_name['airport_name'].', '.$airport_name['airport_country'].' ('.$airport_name['airport_icao'].')</option>'; |
33 | 33 | } else { |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | include('airport-sub-menu.php'); |
59 | 59 | print '<div class="column">'; |
60 | 60 | print '<h2>'._("Most Common Time of Day").'</h2>'; |
61 | - print '<p>'.sprintf(_("The statistic below shows the most common time of day to/from <strong>%s, %s (%s)</strong>."),$airport_array[0]['city'],$airport_array[0]['name'],$airport_array[0]['icao']).'</p>'; |
|
61 | + print '<p>'.sprintf(_("The statistic below shows the most common time of day to/from <strong>%s, %s (%s)</strong>."), $airport_array[0]['city'], $airport_array[0]['name'], $airport_array[0]['icao']).'</p>'; |
|
62 | 62 | |
63 | 63 | $hour_array = $Spotter->countAllHoursByAirport($airport); |
64 | 64 | print '<script type="text/javascript" src="https://www.google.com/jsapi"></script>'; |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | var data = google.visualization.arrayToDataTable([ |
71 | 71 | ["'._("Hour").'", "'._("# of Flights").'"], '; |
72 | 72 | $hour_data = ''; |
73 | - foreach($hour_array as $hour_item) |
|
73 | + foreach ($hour_array as $hour_item) |
|
74 | 74 | { |
75 | 75 | $hour_data .= '[ "'.date("ga", strtotime($hour_item['hour_name'].":00")).'",'.$hour_item['hour_count'].'],'; |
76 | 76 | } |
@@ -9,15 +9,15 @@ discard block |
||
9 | 9 | die(); |
10 | 10 | } |
11 | 11 | |
12 | -$aircraft_type = filter_input(INPUT_GET,'aircraft_type',FILTER_SANITIZE_STRING); |
|
12 | +$aircraft_type = filter_input(INPUT_GET, 'aircraft_type', FILTER_SANITIZE_STRING); |
|
13 | 13 | |
14 | 14 | $Spotter = new Spotter(); |
15 | -$spotter_array = $Spotter->getSpotterDataByAircraft($aircraft_type,"0,1",""); |
|
15 | +$spotter_array = $Spotter->getSpotterDataByAircraft($aircraft_type, "0,1", ""); |
|
16 | 16 | |
17 | 17 | |
18 | 18 | if (!empty($spotter_array)) |
19 | 19 | { |
20 | - $title = sprintf(_("Most Common Arrival Airports for %s (%s)"),$spotter_array[0]['aircraft_name'],$spotter_array[0]['aircraft_type']); |
|
20 | + $title = sprintf(_("Most Common Arrival Airports for %s (%s)"), $spotter_array[0]['aircraft_name'], $spotter_array[0]['aircraft_type']); |
|
21 | 21 | require_once('header.php'); |
22 | 22 | print '<div class="select-item">'; |
23 | 23 | print '<form action="'.$globalURL.'/aircraft" method="post">'; |
@@ -26,9 +26,9 @@ discard block |
||
26 | 26 | $Stats = new Stats(); |
27 | 27 | $aircraft_types = $Stats->getAllAircraftTypes(); |
28 | 28 | if (empty($aircraft_types)) $aircraft_types = $Spotter->getAllAircraftTypes(); |
29 | - foreach($aircraft_types as $aircrafttype) |
|
29 | + foreach ($aircraft_types as $aircrafttype) |
|
30 | 30 | { |
31 | - if($aircraft_type == $aircrafttype['aircraft_icao']) |
|
31 | + if ($aircraft_type == $aircrafttype['aircraft_icao']) |
|
32 | 32 | { |
33 | 33 | print '<option value="'.$aircrafttype['aircraft_icao'].'" selected="selected">'.$aircrafttype['aircraft_name'].' ('.$aircrafttype['aircraft_icao'].')</option>'; |
34 | 34 | } else { |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | include('aircraft-sub-menu.php'); |
56 | 56 | print '<div class="column">'; |
57 | 57 | print '<h2>'._("Most Common Arrival Airports").'</h2>'; |
58 | - print '<p>'.sprintf(_("The statistic below shows all arrival airports of flights from <strong>%s (%s)</strong>."),$spotter_array[0]['aircraft_name'],$spotter_array[0]['aircraft_type']).'</p>'; |
|
58 | + print '<p>'.sprintf(_("The statistic below shows all arrival airports of flights from <strong>%s (%s)</strong>."), $spotter_array[0]['aircraft_name'], $spotter_array[0]['aircraft_type']).'</p>'; |
|
59 | 59 | $airport_airport_array = $Spotter->countAllArrivalAirportsByAircraft($aircraft_type); |
60 | 60 | ?> |
61 | 61 | <script type="text/javascript" src="https://www.google.com/jsapi"></script> |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | ["<?php echo _("Airport"); ?>", "<?php echo _("# of times"); ?>"], |
72 | 72 | <?php |
73 | 73 | $airport_data = ''; |
74 | - foreach($airport_airport_array as $airport_item) |
|
74 | + foreach ($airport_airport_array as $airport_item) |
|
75 | 75 | { |
76 | 76 | $name = $airport_item['airport_arrival_city'].', '.$airport_item['airport_arrival_country'].' ('.$airport_item['airport_arrival_icao'].')'; |
77 | 77 | $name = str_replace("'", "", $name); |
@@ -110,7 +110,7 @@ discard block |
||
110 | 110 | print '</thead>'; |
111 | 111 | print '<tbody>'; |
112 | 112 | $i = 1; |
113 | - foreach($airport_airport_array as $airport_item) |
|
113 | + foreach ($airport_airport_array as $airport_item) |
|
114 | 114 | { |
115 | 115 | print '<tr>'; |
116 | 116 | print '<td><strong>'.$i.'</strong></td>'; |
@@ -7,7 +7,7 @@ discard block |
||
7 | 7 | header('Content-disposition: attachment; filename="atc.geojson"'); |
8 | 8 | } |
9 | 9 | header('Content-Type: text/javascript'); |
10 | -$ATC=new ATC(); |
|
10 | +$ATC = new ATC(); |
|
11 | 11 | if (isset($_GET['coord'])) |
12 | 12 | { |
13 | 13 | //$coords = explode(',',$_GET['coord']); |
@@ -19,7 +19,7 @@ discard block |
||
19 | 19 | $output = '{"type": "FeatureCollection","features": ['; |
20 | 20 | if (!empty($spotter_array)) |
21 | 21 | { |
22 | - foreach($spotter_array as $spotter_item) |
|
22 | + foreach ($spotter_array as $spotter_item) |
|
23 | 23 | { |
24 | 24 | date_default_timezone_set('UTC'); |
25 | 25 | //waypoint plotting |
@@ -7,7 +7,7 @@ discard block |
||
7 | 7 | <button type="button" class="close">×</button> |
8 | 8 | <?php |
9 | 9 | |
10 | -$sat = filter_input(INPUT_GET,'sat',FILTER_SANITIZE_STRING); |
|
10 | +$sat = filter_input(INPUT_GET, 'sat', FILTER_SANITIZE_STRING); |
|
11 | 11 | $sat = urldecode($sat); |
12 | 12 | |
13 | 13 | if ($sat == 'ISS (ZARYA)') { |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | $aircraft_name = 'INTEGRAL'; |
43 | 43 | // $ground_speed = 14970; |
44 | 44 | $launch_date = '17 October 2002'; |
45 | -} elseif (strpos($sat,'IRIDIUM') !== false) { |
|
45 | +} elseif (strpos($sat, 'IRIDIUM') !== false) { |
|
46 | 46 | $image = 'https://upload.wikimedia.org/wikipedia/commons/b/b6/Iridium_Satellite.jpg'; |
47 | 47 | $image_copyright = 'Cliff'; |
48 | 48 | $ident = 'Iridium satellite constellation'; |
@@ -50,22 +50,22 @@ discard block |
||
50 | 50 | $aircraft_name = $sat; |
51 | 51 | // $ground_speed = 14970; |
52 | 52 | // $launch_date = '29 september 2011'; |
53 | -} elseif (strpos($sat,'ORBCOMM') !== false) { |
|
53 | +} elseif (strpos($sat, 'ORBCOMM') !== false) { |
|
54 | 54 | $ident = 'Orbcomm'; |
55 | 55 | $aircraft_wiki = 'https://en.wikipedia.org/wiki/Orbcomm_(satellite)'; |
56 | 56 | $aircraft_name = $sat; |
57 | -} elseif (strpos($sat,'GLOBALSTAR') !== false) { |
|
57 | +} elseif (strpos($sat, 'GLOBALSTAR') !== false) { |
|
58 | 58 | $ident = 'Globalstar'; |
59 | 59 | $aircraft_wiki = 'https://en.wikipedia.org/wiki/Globalstar'; |
60 | 60 | $aircraft_name = $sat; |
61 | -} elseif (strpos($sat,'OSCAR 7') !== false) { |
|
61 | +} elseif (strpos($sat, 'OSCAR 7') !== false) { |
|
62 | 62 | $image = 'https://upload.wikimedia.org/wikipedia/en/a/ad/AMSAT-OSCAR_7.jpg'; |
63 | 63 | $image_copyright = 'Amsat.org'; |
64 | 64 | $ident = 'AMSAT-OSCAR 7'; |
65 | 65 | $aircraft_wiki = 'https://en.wikipedia.org/wiki/AMSAT-OSCAR_7'; |
66 | 66 | $aircraft_name = $sat; |
67 | 67 | $launch_date = '15 November 1974'; |
68 | -} elseif (strpos($sat,'santaclaus') !== false) { |
|
68 | +} elseif (strpos($sat, 'santaclaus') !== false) { |
|
69 | 69 | $image = 'https://upload.wikimedia.org/wikipedia/commons/4/49/Jonathan_G_Meath_portrays_Santa_Claus.jpg'; |
70 | 70 | $image_copyright = 'Jonathan G Meath'; |
71 | 71 | $ident = 'Santa Claus'; |