@@ -752,8 +752,7 @@ discard block |
||
| 752 | 752 | $sat->deep_arg->eosq + 5337.524 * $eoc; |
| 753 | 753 | $g532 = -853.666 + 4690.25 * $eq - 8624.77 * |
| 754 | 754 | $sat->deep_arg->eosq + 5341.4 * $eoc; |
| 755 | - } |
|
| 756 | - else { |
|
| 755 | + } else { |
|
| 757 | 756 | $g533 = -37995.78 + 161616.52 * $eq - 229838.2* |
| 758 | 757 | $sat->deep_arg->eosq + 109377.94 * $eoc; |
| 759 | 758 | $g521 = -51752.104 + 218913.95 * $eq - 309468.16* |
@@ -887,8 +886,7 @@ discard block |
||
| 887 | 886 | if (abs($sat->deep_arg->t - $sat->dps->atime) >= $sat->dps->stepp) { |
| 888 | 887 | $sat->flags |= self::DO_LOOP_FLAG; |
| 889 | 888 | $sat->flags &= ~self::EPOCH_RESTART_FLAG; |
| 890 | - } |
|
| 891 | - else { |
|
| 889 | + } else { |
|
| 892 | 890 | $ft = $sat->deep_arg->t - $sat->dps->atime; |
| 893 | 891 | $sat->flags &= ~self::DO_LOOP_FLAG; |
| 894 | 892 | } |
@@ -146,8 +146,7 @@ |
||
| 146 | 146 | $obs_geodetic->lat = $qth->lat * Predict::de2ra; |
| 147 | 147 | $obs_geodetic->alt = $qth->alt / 1000.0; |
| 148 | 148 | $obs_geodetic->theta = 0; |
| 149 | - } |
|
| 150 | - else { |
|
| 149 | + } else { |
|
| 151 | 150 | $obs_geodetic->lon = 0.0; |
| 152 | 151 | $obs_geodetic->lat = 0.0; |
| 153 | 152 | $obs_geodetic->alt = 0.0; |
@@ -23,8 +23,11 @@ discard block |
||
| 23 | 23 | echo $e->getMessage(); |
| 24 | 24 | } |
| 25 | 25 | $result = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 26 | - if (isset($result[0])) return $result[0]; |
|
| 27 | - else return array(); |
|
| 26 | + if (isset($result[0])) { |
|
| 27 | + return $result[0]; |
|
| 28 | + } else { |
|
| 29 | + return array(); |
|
| 30 | + } |
|
| 28 | 31 | } |
| 29 | 32 | public function get_tle_types() { |
| 30 | 33 | $query = 'SELECT DISTINCT tle_type FROM tle ORDER BY tle_type'; |
@@ -35,8 +38,11 @@ discard block |
||
| 35 | 38 | echo $e->getMessage(); |
| 36 | 39 | } |
| 37 | 40 | $result = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 38 | - if (isset($result[0])) return $result; |
|
| 39 | - else return array(); |
|
| 41 | + if (isset($result[0])) { |
|
| 42 | + return $result; |
|
| 43 | + } else { |
|
| 44 | + return array(); |
|
| 45 | + } |
|
| 40 | 46 | } |
| 41 | 47 | public function get_tle_names() { |
| 42 | 48 | $query = 'SELECT DISTINCT tle_name, tle_type FROM tle'; |
@@ -47,8 +53,11 @@ discard block |
||
| 47 | 53 | echo $e->getMessage(); |
| 48 | 54 | } |
| 49 | 55 | $result = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 50 | - if (isset($result[0])) return $result; |
|
| 51 | - else return array(); |
|
| 56 | + if (isset($result[0])) { |
|
| 57 | + return $result; |
|
| 58 | + } else { |
|
| 59 | + return array(); |
|
| 60 | + } |
|
| 52 | 61 | } |
| 53 | 62 | public function get_tle_names_type($type) { |
| 54 | 63 | $query = 'SELECT tle_name, tle_type FROM tle WHERE tle_type = :type ORDER BY tle_name'; |
@@ -59,8 +68,11 @@ discard block |
||
| 59 | 68 | echo $e->getMessage(); |
| 60 | 69 | } |
| 61 | 70 | $result = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 62 | - if (isset($result[0])) return $result; |
|
| 63 | - else return array(); |
|
| 71 | + if (isset($result[0])) { |
|
| 72 | + return $result; |
|
| 73 | + } else { |
|
| 74 | + return array(); |
|
| 75 | + } |
|
| 64 | 76 | } |
| 65 | 77 | |
| 66 | 78 | public function position_all($timestamp_begin = '',$timestamp_end = '',$second = 10) { |
@@ -95,7 +107,9 @@ discard block |
||
| 95 | 107 | $sat = new Predict_Sat($tle); |
| 96 | 108 | $predict = new Predict(); |
| 97 | 109 | //if ($timestamp == '') $now = Predict_Time::get_current_daynum(); |
| 98 | - if ($timestamp_begin == '') $timestamp_begin = time(); |
|
| 110 | + if ($timestamp_begin == '') { |
|
| 111 | + $timestamp_begin = time(); |
|
| 112 | + } |
|
| 99 | 113 | if ($timestamp_end == '') { |
| 100 | 114 | $now = Predict_Time::unix2daynum($timestamp_begin); |
| 101 | 115 | //echo $now; |
@@ -54,7 +54,9 @@ discard block |
||
| 54 | 54 | } |
| 55 | 55 | } |
| 56 | 56 | if (!isset($array_value)) { |
| 57 | - if (!isset($arrayd_value)) $arrayd_value = ''; |
|
| 57 | + if (!isset($arrayd_value)) { |
|
| 58 | + $arrayd_value = ''; |
|
| 59 | + } |
|
| 58 | 60 | //$array_value = "'".$key."' => array(".$arrayd_value.")"; |
| 59 | 61 | $array_value = "array(".$arrayd_value.")"; |
| 60 | 62 | } elseif (isset($arrayd_value)) { |
@@ -71,7 +73,9 @@ discard block |
||
| 71 | 73 | } |
| 72 | 74 | } |
| 73 | 75 | } |
| 74 | - if (!isset($array_value)) $array_value = ''; |
|
| 76 | + if (!isset($array_value)) { |
|
| 77 | + $array_value = ''; |
|
| 78 | + } |
|
| 75 | 79 | $replace = "\n".'\$'.$settingname." = array(".$array_value.")"; |
| 76 | 80 | unset($array_value); |
| 77 | 81 | } else { |
@@ -25,7 +25,9 @@ discard block |
||
| 25 | 25 | $airspace = $result[0]; |
| 26 | 26 | date_default_timezone_set('UTC'); |
| 27 | 27 | print '<div class="top">'; |
| 28 | -if (isset($airspace['name'])) $airspace['title'] = $airspace['name']; |
|
| 28 | +if (isset($airspace['name'])) { |
|
| 29 | + $airspace['title'] = $airspace['name']; |
|
| 30 | +} |
|
| 29 | 31 | print '<div class="right"><div class="callsign-details"><div class="callsign">'.$airspace['title'].'</a></div>'; |
| 30 | 32 | print '</div>'; |
| 31 | 33 | print '<div class="details">'; |
@@ -44,13 +46,17 @@ discard block |
||
| 44 | 46 | print '</div>'; |
| 45 | 47 | } |
| 46 | 48 | |
| 47 | -if (isset($airspace['ceiling'])) $airspace['tops'] = $airspace['ceiling']; |
|
| 49 | +if (isset($airspace['ceiling'])) { |
|
| 50 | + $airspace['tops'] = $airspace['ceiling']; |
|
| 51 | +} |
|
| 48 | 52 | print '<div>'; |
| 49 | 53 | print '<span>'._("Tops").'</span>'; |
| 50 | 54 | print $airspace['tops']; |
| 51 | 55 | print '</div>'; |
| 52 | 56 | |
| 53 | -if (isset($airspace['floor'])) $airspace['base'] = $airspace['floor']; |
|
| 57 | +if (isset($airspace['floor'])) { |
|
| 58 | + $airspace['base'] = $airspace['floor']; |
|
| 59 | +} |
|
| 54 | 60 | print '<div>'; |
| 55 | 61 | print '<span>'._("Base").'</span>'; |
| 56 | 62 | print $airspace['base']; |
@@ -67,12 +67,22 @@ |
||
| 67 | 67 | } else { |
| 68 | 68 | $geom = geoPHP::load(stream_get_contents($row['wkb'])); |
| 69 | 69 | } |
| 70 | - if (isset($properties['type'])) $properties['type'] = trim($properties['type']); |
|
| 71 | - elseif (isset($properties['class'])) $properties['type'] = trim($properties['class']); |
|
| 72 | - if (isset($properties['ogr_fid'])) $properties['id'] = $properties['ogr_fid']; |
|
| 73 | - elseif (isset($properties['ogc_fid'])) $properties['id'] = $properties['ogc_fid']; |
|
| 74 | - if (isset($properties['ceiling'])) $properties['tops'] = $properties['ceiling']; |
|
| 75 | - if (isset($properties['floor'])) $properties['base'] = $properties['floor']; |
|
| 70 | + if (isset($properties['type'])) { |
|
| 71 | + $properties['type'] = trim($properties['type']); |
|
| 72 | + } elseif (isset($properties['class'])) { |
|
| 73 | + $properties['type'] = trim($properties['class']); |
|
| 74 | + } |
|
| 75 | + if (isset($properties['ogr_fid'])) { |
|
| 76 | + $properties['id'] = $properties['ogr_fid']; |
|
| 77 | + } elseif (isset($properties['ogc_fid'])) { |
|
| 78 | + $properties['id'] = $properties['ogc_fid']; |
|
| 79 | + } |
|
| 80 | + if (isset($properties['ceiling'])) { |
|
| 81 | + $properties['tops'] = $properties['ceiling']; |
|
| 82 | + } |
|
| 83 | + if (isset($properties['floor'])) { |
|
| 84 | + $properties['base'] = $properties['floor']; |
|
| 85 | + } |
|
| 76 | 86 | if (preg_match('/^FL(\s)*(?<alt>\d+)/',strtoupper($properties['tops']),$matches)) { |
| 77 | 87 | $properties['upper_limit'] = round($matches['alt']*100*0.38048); |
| 78 | 88 | } elseif (preg_match('/^(?<alt>\d+)(\s)*(FT|AGL|ALT|MSL)/',strtoupper($properties['tops']),$matches)) { |
@@ -14,7 +14,9 @@ discard block |
||
| 14 | 14 | //foreach ($lines as $line) |
| 15 | 15 | while (($line = fgets($handle,4096)) !== false) |
| 16 | 16 | { |
| 17 | - if (substr($line,0,2) == '--' || $line == '') continue; |
|
| 17 | + if (substr($line,0,2) == '--' || $line == '') { |
|
| 18 | + continue; |
|
| 19 | + } |
|
| 18 | 20 | $templine .= $line; |
| 19 | 21 | if (substr(trim($line), -1,1) == ';') |
| 20 | 22 | { |
@@ -40,7 +42,9 @@ discard block |
||
| 40 | 42 | //foreach (new RecursiveIteratorIterator(new RecursiveDirectoryIterator($directory)) as $filename) |
| 41 | 43 | while(false !== ($filename = readdir($dh))) |
| 42 | 44 | { |
| 43 | - if (preg_match('/\.sql$/',$filename)) $error .= create_db::import_file($directory.$filename); |
|
| 45 | + if (preg_match('/\.sql$/',$filename)) { |
|
| 46 | + $error .= create_db::import_file($directory.$filename); |
|
| 47 | + } |
|
| 44 | 48 | } |
| 45 | 49 | return $error; |
| 46 | 50 | } |
@@ -56,13 +60,17 @@ discard block |
||
| 56 | 60 | // Dirty hack |
| 57 | 61 | if ($host != 'localhost' && $host != '127.0.0.1') { |
| 58 | 62 | $grantright = $_SERVER['SERVER_ADDR']; |
| 59 | - } else $grantright = 'localhost'; |
|
| 63 | + } else { |
|
| 64 | + $grantright = 'localhost'; |
|
| 65 | + } |
|
| 60 | 66 | try { |
| 61 | 67 | $dbh = new PDO($db_type.':host='.$host,$root,$root_pass); |
| 62 | 68 | $dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); |
| 63 | 69 | if ($db_type == 'mysql') { |
| 64 | 70 | $dbh->exec('CREATE DATABASE IF NOT EXISTS `'.$db.'`;GRANT ALL ON `'.$db."`.* TO '".$user."'@'".$grantright."' IDENTIFIED BY '".$password."';FLUSH PRIVILEGES;"); |
| 65 | - if ($grantright == 'localhost') $dbh->exec('GRANT ALL ON `'.$db."`.* TO '".$user."'@'127.0.0.1' IDENTIFIED BY '".$password."';FLUSH PRIVILEGES;"); |
|
| 71 | + if ($grantright == 'localhost') { |
|
| 72 | + $dbh->exec('GRANT ALL ON `'.$db."`.* TO '".$user."'@'127.0.0.1' IDENTIFIED BY '".$password."';FLUSH PRIVILEGES;"); |
|
| 73 | + } |
|
| 66 | 74 | } else if ($db_type == 'pgsql') { |
| 67 | 75 | $dbh->exec("CREATE DATABASE ".$db.";"); |
| 68 | 76 | $dbh->exec("CREATE USER ".$user." WITH PASSWORD '".$password."'; |
@@ -23,14 +23,19 @@ discard block |
||
| 23 | 23 | */ |
| 24 | 24 | public function ident2icao($ident) { |
| 25 | 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'); |
|
| 26 | + if (filter_var(substr($ident,2),FILTER_VALIDATE_INT,array("flags"=>FILTER_FLAG_ALLOW_OCTAL))) { |
|
| 27 | + $icao = $ident; |
|
| 28 | + } else { |
|
| 29 | + $icao = 'AFR'.ltrim(substr($ident,2),'0'); |
|
| 30 | + } |
|
| 28 | 31 | } else { |
| 29 | 32 | $Spotter = new Spotter($this->db); |
| 30 | 33 | $identicao = $Spotter->getAllAirlineInfo(substr($ident,0,2)); |
| 31 | 34 | if (isset($identicao[0])) { |
| 32 | 35 | $icao = $identicao[0]['icao'].ltrim(substr($ident,2),'0'); |
| 33 | - } else $icao = $ident; |
|
| 36 | + } else { |
|
| 37 | + $icao = $ident; |
|
| 38 | + } |
|
| 34 | 39 | } |
| 35 | 40 | return $icao; |
| 36 | 41 | } |
@@ -103,14 +108,24 @@ discard block |
||
| 103 | 108 | $message = ''; |
| 104 | 109 | $result = array(); |
| 105 | 110 | $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); |
|
| 111 | + if ($n == 0) { |
|
| 112 | + $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); |
|
| 113 | + } |
|
| 114 | + if ($n == 0) { |
|
| 115 | + $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); |
|
| 116 | + } |
|
| 117 | + if ($n == 0) { |
|
| 118 | + $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); |
|
| 119 | + } |
|
| 109 | 120 | if ($n != 0) { |
| 110 | 121 | $registration = str_replace('.','',$registration); |
| 111 | 122 | $result = array('registration' => $registration, 'ident' => $ident,'label' => $label, 'block_id' => $block_id,'msg_no' => $msg_no,'message' => $message); |
| 112 | - if ($globalDebug) echo "Reg. : ".$registration." - Ident : ".$ident." - Label : ".$label." - Message : ".$message."\n"; |
|
| 113 | - } else $message = $data; |
|
| 123 | + if ($globalDebug) { |
|
| 124 | + echo "Reg. : ".$registration." - Ident : ".$ident." - Label : ".$label." - Message : ".$message."\n"; |
|
| 125 | + } |
|
| 126 | + } else { |
|
| 127 | + $message = $data; |
|
| 128 | + } |
|
| 114 | 129 | $decode = array(); |
| 115 | 130 | $found = false; |
| 116 | 131 | // if ($registration != '' && $ident != '' && $registration != '!') { |
@@ -130,12 +145,21 @@ discard block |
||
| 130 | 145 | if ($n > 5 && ($lac == 'N' || $lac == 'S') && ($lnc == 'E' || $lnc == 'W')) { |
| 131 | 146 | $latitude = $la / 10000.0; |
| 132 | 147 | $longitude = $ln / 10000.0; |
| 133 | - if ($lac == 'S') $latitude = '-'.$latitude; |
|
| 134 | - if ($lnc == 'W') $longitude = '-'.$longitude; |
|
| 148 | + if ($lac == 'S') { |
|
| 149 | + $latitude = '-'.$latitude; |
|
| 150 | + } |
|
| 151 | + if ($lnc == 'W') { |
|
| 152 | + $longitude = '-'.$longitude; |
|
| 153 | + } |
|
| 135 | 154 | // Temp not always available |
| 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'); |
|
| 155 | + if ($globalDebug) { |
|
| 156 | + echo 'latitude : '.$latitude.' - longitude : '.$longitude.' - airport depart : '.$dair.' - airport arrival : '.$darr.' - température : '.$temp."°C\n"; |
|
| 157 | + } |
|
| 158 | + if ($temp == '') { |
|
| 159 | + $decode = array('Latitude' => $latitude, 'Longitude' => $longitude, 'Departure airport' => $dair, 'Arrival airport' => $darr,'Altitude' => $alt); |
|
| 160 | + } else { |
|
| 161 | + $decode = array('Latitude' => $latitude, 'Longitude' => $longitude, 'Departure airport' => $dair, 'Arrival airport' => $darr, 'Altitude' => 'FL'.$alt,'Temperature' => $temp.'°C'); |
|
| 162 | + } |
|
| 139 | 163 | |
| 140 | 164 | //$icao = $Translation->checkTranslation($ident); |
| 141 | 165 | //$Schedule->addSchedule($icao,$dair,'',$darr,'','ACARS'); |
@@ -149,25 +173,35 @@ discard block |
||
| 149 | 173 | $ahour = ''; |
| 150 | 174 | $n = sscanf($message, "ARR01 %4[A-Z]%4d %4[A-Z]%4d", $dair, $dhour, $darr,$ahour); |
| 151 | 175 | 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"; |
|
| 176 | + if ($dhour != '') { |
|
| 177 | + $dhour = substr(sprintf('%04d',$dhour),0,2).':'.substr(sprintf('%04d',$dhour),2); |
|
| 178 | + } |
|
| 179 | + if ($ahour != '') { |
|
| 180 | + $ahour = substr(sprintf('%04d',$ahour),0,2).':'.substr(sprintf('%04d',$ahour),2); |
|
| 181 | + } |
|
| 182 | + if ($globalDebug) { |
|
| 183 | + echo 'departure airport : '.$dair.' - arrival airport : '. $darr.' - departure hour : '. $dhour.' - arrival hour : '.$ahour."\n"; |
|
| 184 | + } |
|
| 155 | 185 | //$icao = ACARS->ident2icao($ident); |
| 156 | 186 | //$icao = $Translation->checkTranslation($ident); |
| 157 | 187 | //$Schedule->addSchedule($icao,$dair,$dhour,$darr,$ahour,'ACARS'); |
| 158 | 188 | $decode = array('Departure airport' => $dair, 'Departure hour' => $dhour, 'Arrival airport' => $darr, 'Arrival hour' => $ahour); |
| 159 | 189 | $found = true; |
| 160 | - } |
|
| 161 | - elseif ($n == 2 || $n == 4) { |
|
| 162 | - if ($dhour != '') $dhour = substr(sprintf('%04d',$dhour),0,2).':'.substr(sprintf('%04d',$dhour),2); |
|
| 163 | - if ($globalDebug) echo 'airport arrival : '.$dair.' - arrival hour : '.$dhour."\n"; |
|
| 190 | + } elseif ($n == 2 || $n == 4) { |
|
| 191 | + if ($dhour != '') { |
|
| 192 | + $dhour = substr(sprintf('%04d',$dhour),0,2).':'.substr(sprintf('%04d',$dhour),2); |
|
| 193 | + } |
|
| 194 | + if ($globalDebug) { |
|
| 195 | + echo 'airport arrival : '.$dair.' - arrival hour : '.$dhour."\n"; |
|
| 196 | + } |
|
| 164 | 197 | //$icao = ACARS->ident2icao($ident); |
| 165 | 198 | //$icao = $Translation->checkTranslation($ident); |
| 166 | 199 | $decode = array('Arrival airport' => $dair, 'Arrival hour' => $dhour); |
| 167 | 200 | $found = true; |
| 168 | - } |
|
| 169 | - elseif ($n == 1) { |
|
| 170 | - if ($globalDebug) echo 'airport arrival : '.$darr."\n"; |
|
| 201 | + } elseif ($n == 1) { |
|
| 202 | + if ($globalDebug) { |
|
| 203 | + echo 'airport arrival : '.$darr."\n"; |
|
| 204 | + } |
|
| 171 | 205 | //$icao = ACARS->ident2icao($ident); |
| 172 | 206 | //$icao = $Translation->checkTranslation($ident); |
| 173 | 207 | $decode = array('Arrival airport' => $darr); |
@@ -185,7 +219,9 @@ discard block |
||
| 185 | 219 | $darr = ''; |
| 186 | 220 | $n = sscanf($message, "%4c,%4c,%*7s,%*d", $dair, $darr); |
| 187 | 221 | if ($n == 4) { |
| 188 | - if ($globalDebug) echo 'airport depart : '.$dair.' - airport arrival : '.$darr."\n"; |
|
| 222 | + if ($globalDebug) { |
|
| 223 | + echo 'airport depart : '.$dair.' - airport arrival : '.$darr."\n"; |
|
| 224 | + } |
|
| 189 | 225 | //$icao = ACARS->ident2icao($ident); |
| 190 | 226 | //$icao = $Translation->checkTranslation($ident); |
| 191 | 227 | //$Schedule->addSchedule($icao,$dair,'',$darr,'','ACARS'); |
@@ -219,14 +255,23 @@ discard block |
||
| 219 | 255 | $apiste = ''; |
| 220 | 256 | $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 | 257 | 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); |
|
| 258 | + if ($globalDebug) { |
|
| 259 | + 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"; |
|
| 260 | + } |
|
| 261 | + if ($dhour != '') { |
|
| 262 | + $dhour = substr(sprintf('%04d',$dhour),0,2).':'.substr(sprintf('%04d',$dhour),2); |
|
| 263 | + } |
|
| 264 | + if ($ahour != '') { |
|
| 265 | + $ahour = substr(sprintf('%04d',$ahour),0,2).':'.substr(sprintf('%04d',$ahour),2); |
|
| 266 | + } |
|
| 225 | 267 | $icao = trim($aident); |
| 226 | 268 | |
| 227 | 269 | //$decode = 'Departure airport : '.$dair.' ('.$ddate.' at '.$dhour.') - Arrival Airport : '.$aair.' (at '.$ahour.') way '.$apiste; |
| 228 | - if ($ahour == '') $decode = array('Departure airport' => $dair, 'Departure date' => $ddate, 'Departure hour' => $dhour, 'Arrival airport' => $darr); |
|
| 229 | - else $decode = array('Departure airport' => $dair, 'Departure date' => $ddate, 'Departure hour' => $dhour, 'Arrival airport' => $darr, 'Arrival hour' => $ahour, 'Arrival way' => $apiste); |
|
| 270 | + if ($ahour == '') { |
|
| 271 | + $decode = array('Departure airport' => $dair, 'Departure date' => $ddate, 'Departure hour' => $dhour, 'Arrival airport' => $darr); |
|
| 272 | + } else { |
|
| 273 | + $decode = array('Departure airport' => $dair, 'Departure date' => $ddate, 'Departure hour' => $dhour, 'Arrival airport' => $darr, 'Arrival hour' => $ahour, 'Arrival way' => $apiste); |
|
| 274 | + } |
|
| 230 | 275 | //$Schedule->addSchedule($icao,$dair,$dhour,$darr,$ahour,'ACARS'); |
| 231 | 276 | $decode['icao'] = $icao; |
| 232 | 277 | $found = true; |
@@ -248,9 +293,15 @@ discard block |
||
| 248 | 293 | $lns = $lns.'.'.$lns; |
| 249 | 294 | $latitude = $las / 1000.0; |
| 250 | 295 | $longitude = $lns / 1000.0; |
| 251 | - if ($lac == 'S') $latitude = '-'.$latitude; |
|
| 252 | - if ($lnc == 'W') $longitude = '-'.$longitude; |
|
| 253 | - if ($globalDebug) echo 'latitude : '.$latitude.' - longitude : '.$longitude."\n"; |
|
| 296 | + if ($lac == 'S') { |
|
| 297 | + $latitude = '-'.$latitude; |
|
| 298 | + } |
|
| 299 | + if ($lnc == 'W') { |
|
| 300 | + $longitude = '-'.$longitude; |
|
| 301 | + } |
|
| 302 | + if ($globalDebug) { |
|
| 303 | + echo 'latitude : '.$latitude.' - longitude : '.$longitude."\n"; |
|
| 304 | + } |
|
| 254 | 305 | $decode = array('Latitude' => $latitude, 'Longitude' => $longitude); |
| 255 | 306 | $found = true; |
| 256 | 307 | } |
@@ -268,7 +319,9 @@ discard block |
||
| 268 | 319 | $darr = ''; |
| 269 | 320 | $n = sscanf($message, "%*[0-9A-Z ]/%*s %4c/%4c .", $dair, $darr); |
| 270 | 321 | if ($n == 4) { |
| 271 | - if ($globalDebug) echo 'airport depart : '.$dair.' - airport arrival : '.$darr."\n"; |
|
| 322 | + if ($globalDebug) { |
|
| 323 | + echo 'airport depart : '.$dair.' - airport arrival : '.$darr."\n"; |
|
| 324 | + } |
|
| 272 | 325 | //$icao = $Translation->checkTranslation($ident); |
| 273 | 326 | //$Schedule->addSchedule($icao,$dair,'',$darr,'','ACARS'); |
| 274 | 327 | $decode = array('Departure airport' => $dair, 'Arrival airport' => $darr); |
@@ -281,7 +334,9 @@ discard block |
||
| 281 | 334 | $darr = ''; |
| 282 | 335 | $n = sscanf($message, "%*[0-9],%4c,%4c,", $dair, $darr); |
| 283 | 336 | if ($n == 4) { |
| 284 | - if ($globalDebug) echo 'airport depart : '.$dair.' - airport arrival : '.$darr."\n"; |
|
| 337 | + if ($globalDebug) { |
|
| 338 | + echo 'airport depart : '.$dair.' - airport arrival : '.$darr."\n"; |
|
| 339 | + } |
|
| 285 | 340 | //$icao = $Translation->checkTranslation($ident); |
| 286 | 341 | //$Schedule->addSchedule($icao,$dair,'',$darr,'','ACARS'); |
| 287 | 342 | $decode = array('Departure airport' => $dair, 'Arrival airport' => $darr); |
@@ -294,7 +349,9 @@ discard block |
||
| 294 | 349 | $darr = ''; |
| 295 | 350 | $n = sscanf($message, "002AF %4c %4c ", $dair, $darr); |
| 296 | 351 | if ($n == 2) { |
| 297 | - if ($globalDebug) echo 'airport depart : '.$dair.' - airport arrival : '.$darr."\n"; |
|
| 352 | + if ($globalDebug) { |
|
| 353 | + echo 'airport depart : '.$dair.' - airport arrival : '.$darr."\n"; |
|
| 354 | + } |
|
| 298 | 355 | //$icao = $Translation->checkTranslation($ident); |
| 299 | 356 | $decode = array('Departure airport' => $dair, 'Arrival airport' => $darr); |
| 300 | 357 | //$Schedule->addSchedule($icao,$dair,'',$darr,'','ACARS'); |
@@ -308,7 +365,9 @@ discard block |
||
| 308 | 365 | $darr = ''; |
| 309 | 366 | $n = sscanf($message, "#DFBA%*02d/%*[A-Z-],%*[0-9A-Z],%*d,%4c,%4c", $dair, $darr); |
| 310 | 367 | if ($n == 6) { |
| 311 | - if ($globalDebug) echo 'airport depart : '.$dair.' - airport arrival : '.$darr."\n"; |
|
| 368 | + if ($globalDebug) { |
|
| 369 | + echo 'airport depart : '.$dair.' - airport arrival : '.$darr."\n"; |
|
| 370 | + } |
|
| 312 | 371 | //$icao = $Translation->checkTranslation($ident); |
| 313 | 372 | //$Schedule->addSchedule($icao,$dair,'',$darr,'','ACARS'); |
| 314 | 373 | $decode = array('Departure airport' => $dair, 'Arrival airport' => $darr); |
@@ -321,7 +380,9 @@ discard block |
||
| 321 | 380 | $darr = ''; |
| 322 | 381 | $n = sscanf($message, "#DFBA%*02d/%*[0-9A-Z,]/%*[A-Z-],%*[0-9A-Z],%*d,%4c,%4c", $dair, $darr); |
| 323 | 382 | if ($n == 7) { |
| 324 | - if ($globalDebug) echo 'airport depart : '.$dair.' - airport arrival : '.$darr."\n"; |
|
| 383 | + if ($globalDebug) { |
|
| 384 | + echo 'airport depart : '.$dair.' - airport arrival : '.$darr."\n"; |
|
| 385 | + } |
|
| 325 | 386 | //$icao = $Translation->checkTranslation($ident); |
| 326 | 387 | //$Schedule->addSchedule($icao,$dair,'',$darr,'','ACARS'); |
| 327 | 388 | $decode = array('Departure airport' => $dair, 'Arrival airport' => $darr); |
@@ -349,8 +410,12 @@ discard block |
||
| 349 | 410 | $decode['icao'] = $icao; |
| 350 | 411 | $latitude = $las / 100.0; |
| 351 | 412 | $longitude = $lns / 100.0; |
| 352 | - if ($lac == 'S') $latitude = '-'.$latitude; |
|
| 353 | - if ($lnc == 'W') $longitude = '-'.$longitude; |
|
| 413 | + if ($lac == 'S') { |
|
| 414 | + $latitude = '-'.$latitude; |
|
| 415 | + } |
|
| 416 | + if ($lnc == 'W') { |
|
| 417 | + $longitude = '-'.$longitude; |
|
| 418 | + } |
|
| 354 | 419 | |
| 355 | 420 | $decode = array('Latitude' => $latitude,'Longitude' => $longitude,'Altitude' => 'FL'.$alt,'Fuel' => $fuel,'speed' => $speed); |
| 356 | 421 | $found = true; |
@@ -368,8 +433,12 @@ discard block |
||
| 368 | 433 | if ($n == 4) { |
| 369 | 434 | $latitude = $las; |
| 370 | 435 | $longitude = $lns; |
| 371 | - if ($lac == 'S') $latitude = '-'.$latitude; |
|
| 372 | - if ($lnc == 'W') $longitude = '-'.$longitude; |
|
| 436 | + if ($lac == 'S') { |
|
| 437 | + $latitude = '-'.$latitude; |
|
| 438 | + } |
|
| 439 | + if ($lnc == 'W') { |
|
| 440 | + $longitude = '-'.$longitude; |
|
| 441 | + } |
|
| 373 | 442 | |
| 374 | 443 | $decode = array('Latitude' => $latitude,'Longitude' => $longitude); |
| 375 | 444 | $found = true; |
@@ -385,7 +454,9 @@ discard block |
||
| 385 | 454 | $darr = ''; |
| 386 | 455 | $n = sscanf($message, "%*[0-9A-Z] NLINFO %*d/%*d %4c/%4c .", $dair, $darr); |
| 387 | 456 | if ($n == 5) { |
| 388 | - if ($globalDebug) echo 'airport depart : '.$dair.' - airport arrival : '.$darr."\n"; |
|
| 457 | + if ($globalDebug) { |
|
| 458 | + echo 'airport depart : '.$dair.' - airport arrival : '.$darr."\n"; |
|
| 459 | + } |
|
| 389 | 460 | //$icao = $Translation->checkTranslation($ident); |
| 390 | 461 | //$Schedule->addSchedule($icao,$dair,'',$darr,'','ACARS'); |
| 391 | 462 | $decode = array('Departure airport' => $dair, 'Arrival airport' => $darr); |
@@ -406,7 +477,9 @@ discard block |
||
| 406 | 477 | $aident = ''; |
| 407 | 478 | $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 | 479 | if ($n == 8) { |
| 409 | - if ($globalDebug) echo 'airport depart : '.$dair.' - airport arrival : '.$darr."\n"; |
|
| 480 | + if ($globalDebug) { |
|
| 481 | + echo 'airport depart : '.$dair.' - airport arrival : '.$darr."\n"; |
|
| 482 | + } |
|
| 410 | 483 | $icao = trim($aident); |
| 411 | 484 | //$Schedule->addSchedule($icao,$dair,'',$darr,'','ACARS'); |
| 412 | 485 | $decode['icao'] = $icao; |
@@ -423,7 +496,9 @@ discard block |
||
| 423 | 496 | $darr = ''; |
| 424 | 497 | $n = sscanf($message, "%*d/%*d %4s/%4s .%*6s", $dair, $darr); |
| 425 | 498 | if ($n == 5) { |
| 426 | - if ($globalDebug) echo 'airport depart : '.$dair.' - airport arrival : '.$darr."\n"; |
|
| 499 | + if ($globalDebug) { |
|
| 500 | + echo 'airport depart : '.$dair.' - airport arrival : '.$darr."\n"; |
|
| 501 | + } |
|
| 427 | 502 | //$icao = $Translation->checkTranslation($ident); |
| 428 | 503 | |
| 429 | 504 | //$Schedule->addSchedule($icao,$dair,'',$darr,'','ACARS'); |
@@ -439,7 +514,9 @@ discard block |
||
| 439 | 514 | $darr = ''; |
| 440 | 515 | $n = sscanf($message,'%4[A-Z]%4[A-Z]%*4d',$dair,$darr); |
| 441 | 516 | if ($n == 3) { |
| 442 | - if ($globalDebug) echo 'airport depart : '.$dair.' - airport arrival : '.$darr."\n"; |
|
| 517 | + if ($globalDebug) { |
|
| 518 | + echo 'airport depart : '.$dair.' - airport arrival : '.$darr."\n"; |
|
| 519 | + } |
|
| 443 | 520 | //$icao = $Translation->checkTranslation($ident); |
| 444 | 521 | |
| 445 | 522 | //$Schedule->addSchedule($icao,$dair,'',$darr,'','ACARS'); |
@@ -455,7 +532,9 @@ discard block |
||
| 455 | 532 | $darr = ''; |
| 456 | 533 | $n = sscanf($message,'3J01 DSPTCH %*d/%*d %4s/%4s .%*6s',$dair,$darr); |
| 457 | 534 | if ($n == 3) { |
| 458 | - if ($globalDebug) echo 'airport depart : '.$dair.' - airport arrival : '.$darr."\n"; |
|
| 535 | + if ($globalDebug) { |
|
| 536 | + echo 'airport depart : '.$dair.' - airport arrival : '.$darr."\n"; |
|
| 537 | + } |
|
| 459 | 538 | //$icao = $Translation->checkTranslation($ident); |
| 460 | 539 | |
| 461 | 540 | //$Schedule->addSchedule($icao,$dair,'',$darr,'','ACARS'); |
@@ -466,7 +545,9 @@ discard block |
||
| 466 | 545 | if (!$found) { |
| 467 | 546 | $n = sscanf($message,'MET01%4c',$airport); |
| 468 | 547 | if ($n == 1) { |
| 469 | - if ($globalDebug) echo 'airport name : '.$airport; |
|
| 548 | + if ($globalDebug) { |
|
| 549 | + echo 'airport name : '.$airport; |
|
| 550 | + } |
|
| 470 | 551 | $decode = array('Airport/Waypoint name' => $airport); |
| 471 | 552 | $found = true; |
| 472 | 553 | } |
@@ -475,184 +556,126 @@ discard block |
||
| 475 | 556 | if ($label == 'H1') { |
| 476 | 557 | if (preg_match('/^#CFBFLR/',$message) || preg_match('/^#CFBWRN/',$message)) { |
| 477 | 558 | $decode = array_merge(array('Message nature' => 'Equipment failure'),$decode); |
| 478 | - } |
|
| 479 | - elseif (preg_match('/^#DFB\*TKO/',$message) || preg_match('/^#DFBTKO/',$message)) { |
|
| 559 | + } elseif (preg_match('/^#DFB\*TKO/',$message) || preg_match('/^#DFBTKO/',$message)) { |
|
| 480 | 560 | $decode = array_merge(array('Message nature' => 'Take off performance data'),$decode); |
| 481 | - } |
|
| 482 | - elseif (preg_match('/^#DFB\*CRZ/',$message) || preg_match('/^#DFBCRZ/',$message)) { |
|
| 561 | + } elseif (preg_match('/^#DFB\*CRZ/',$message) || preg_match('/^#DFBCRZ/',$message)) { |
|
| 483 | 562 | $decode = array_merge(array('Message nature' => 'Cruise performance data'),$decode); |
| 484 | - } |
|
| 485 | - elseif (preg_match('/^#DFB\*WOB/',$message) || preg_match('/^#DFBWOB/',$message)) { |
|
| 563 | + } elseif (preg_match('/^#DFB\*WOB/',$message) || preg_match('/^#DFBWOB/',$message)) { |
|
| 486 | 564 | $decode = array_merge(array('Message nature' => 'Weather observation'),$decode); |
| 487 | - } |
|
| 488 | - elseif (preg_match(':^#DFB/PIREP:',$message)) { |
|
| 565 | + } elseif (preg_match(':^#DFB/PIREP:',$message)) { |
|
| 489 | 566 | $decode = array_merge(array('Message nature' => 'Pilot Report'),$decode); |
| 490 | - } |
|
| 491 | - elseif (preg_match('/^#DFBEDA/',$message) || preg_match('/^#DFBENG/',$message)) { |
|
| 567 | + } elseif (preg_match('/^#DFBEDA/',$message) || preg_match('/^#DFBENG/',$message)) { |
|
| 492 | 568 | $decode = array_merge(array('Message nature' => 'Engine Data'),$decode); |
| 493 | - } |
|
| 494 | - elseif (preg_match(':^#M1AAEP:',$message)) { |
|
| 569 | + } elseif (preg_match(':^#M1AAEP:',$message)) { |
|
| 495 | 570 | $decode = array_merge(array('Message nature' => 'Position/Weather Report'),$decode); |
| 496 | - } |
|
| 497 | - elseif (preg_match(':^#M2APWD:',$message)) { |
|
| 571 | + } elseif (preg_match(':^#M2APWD:',$message)) { |
|
| 498 | 572 | $decode = array_merge(array('Message nature' => 'Flight plan predicted wind data'),$decode); |
| 499 | - } |
|
| 500 | - elseif (preg_match(':^#M1BREQPWI:',$message)) { |
|
| 573 | + } elseif (preg_match(':^#M1BREQPWI:',$message)) { |
|
| 501 | 574 | $decode = array_merge(array('Message nature' => 'Predicted wind info request'),$decode); |
| 502 | - } |
|
| 503 | - elseif (preg_match(':^#CF:',$message)) { |
|
| 575 | + } elseif (preg_match(':^#CF:',$message)) { |
|
| 504 | 576 | $decode = array_merge(array('Message nature' => 'Central Fault Display'),$decode); |
| 505 | - } |
|
| 506 | - elseif (preg_match(':^#DF:',$message)) { |
|
| 577 | + } elseif (preg_match(':^#DF:',$message)) { |
|
| 507 | 578 | $decode = array_merge(array('Message nature' => 'Digital Flight Data Acquisition Unit'),$decode); |
| 508 | - } |
|
| 509 | - elseif (preg_match(':^#EC:',$message)) { |
|
| 579 | + } elseif (preg_match(':^#EC:',$message)) { |
|
| 510 | 580 | $decode = array_merge(array('Message nature' => 'Engine Display System'),$decode); |
| 511 | - } |
|
| 512 | - elseif (preg_match(':^#EI:',$message)) { |
|
| 581 | + } elseif (preg_match(':^#EI:',$message)) { |
|
| 513 | 582 | $decode = array_merge(array('Message nature' => 'Engine Report'),$decode); |
| 514 | - } |
|
| 515 | - elseif (preg_match(':^#H1:',$message)) { |
|
| 583 | + } elseif (preg_match(':^#H1:',$message)) { |
|
| 516 | 584 | $decode = array_merge(array('Message nature' => 'HF Data Radio - Left'),$decode); |
| 517 | - } |
|
| 518 | - elseif (preg_match(':^#H2:',$message)) { |
|
| 585 | + } elseif (preg_match(':^#H2:',$message)) { |
|
| 519 | 586 | $decode = array_merge(array('Message nature' => 'HF Data Radio - Right'),$decode); |
| 520 | - } |
|
| 521 | - elseif (preg_match(':^#HD:',$message)) { |
|
| 587 | + } elseif (preg_match(':^#HD:',$message)) { |
|
| 522 | 588 | $decode = array_merge(array('Message nature' => 'HF Data Radio - Selected'),$decode); |
| 523 | - } |
|
| 524 | - elseif (preg_match(':^#M1:',$message)) { |
|
| 589 | + } elseif (preg_match(':^#M1:',$message)) { |
|
| 525 | 590 | $decode = array_merge(array('Message nature' => 'Flight Management Computer - Left'),$decode); |
| 526 | - } |
|
| 527 | - elseif (preg_match(':^#M2:',$message)) { |
|
| 591 | + } elseif (preg_match(':^#M2:',$message)) { |
|
| 528 | 592 | $decode = array_merge(array('Message nature' => 'Flight Management Computer - Right'),$decode); |
| 529 | - } |
|
| 530 | - elseif (preg_match(':^#M3:',$message)) { |
|
| 593 | + } elseif (preg_match(':^#M3:',$message)) { |
|
| 531 | 594 | $decode = array_merge(array('Message nature' => 'Flight Management Computer - Center'),$decode); |
| 532 | - } |
|
| 533 | - elseif (preg_match(':^#MD:',$message)) { |
|
| 595 | + } elseif (preg_match(':^#MD:',$message)) { |
|
| 534 | 596 | $decode = array_merge(array('Message nature' => 'Flight Management Computer - Selected'),$decode); |
| 535 | - } |
|
| 536 | - elseif (preg_match(':^#PS:',$message)) { |
|
| 597 | + } elseif (preg_match(':^#PS:',$message)) { |
|
| 537 | 598 | $decode = array_merge(array('Message nature' => 'Keyboard/Display Unit'),$decode); |
| 538 | - } |
|
| 539 | - elseif (preg_match(':^#S1:',$message)) { |
|
| 599 | + } elseif (preg_match(':^#S1:',$message)) { |
|
| 540 | 600 | $decode = array_merge(array('Message nature' => 'SDU - Left'),$decode); |
| 541 | - } |
|
| 542 | - elseif (preg_match(':^#S2:',$message)) { |
|
| 601 | + } elseif (preg_match(':^#S2:',$message)) { |
|
| 543 | 602 | $decode = array_merge(array('Message nature' => 'SDU - Right'),$decode); |
| 544 | - } |
|
| 545 | - elseif (preg_match(':^#SD:',$message)) { |
|
| 603 | + } elseif (preg_match(':^#SD:',$message)) { |
|
| 546 | 604 | $decode = array_merge(array('Message nature' => 'SDU - Selected'),$decode); |
| 547 | - } |
|
| 548 | - elseif (preg_match(':^#T[0-8]:',$message)) { |
|
| 605 | + } elseif (preg_match(':^#T[0-8]:',$message)) { |
|
| 549 | 606 | $decode = array_merge(array('Message nature' => 'Cabin Terminal Messages'),$decode); |
| 550 | - } |
|
| 551 | - elseif (preg_match(':^#WO:',$message)) { |
|
| 607 | + } elseif (preg_match(':^#WO:',$message)) { |
|
| 552 | 608 | $decode = array_merge(array('Message nature' => 'Weather Observation Report'),$decode); |
| 553 | - } |
|
| 554 | - elseif (preg_match(':^#A1:',$message)) { |
|
| 609 | + } elseif (preg_match(':^#A1:',$message)) { |
|
| 555 | 610 | $decode = array_merge(array('Message nature' => 'Oceanic Clearance'),$decode); |
| 556 | - } |
|
| 557 | - elseif (preg_match(':^#A3:',$message)) { |
|
| 611 | + } elseif (preg_match(':^#A3:',$message)) { |
|
| 558 | 612 | $decode = array_merge(array('Message nature' => 'Departure Clearance Response'),$decode); |
| 559 | - } |
|
| 560 | - elseif (preg_match(':^#A4:',$message)) { |
|
| 613 | + } elseif (preg_match(':^#A4:',$message)) { |
|
| 561 | 614 | $decode = array_merge(array('Message nature' => 'Flight Systems Message'),$decode); |
| 562 | - } |
|
| 563 | - elseif (preg_match(':^#A6:',$message)) { |
|
| 615 | + } elseif (preg_match(':^#A6:',$message)) { |
|
| 564 | 616 | $decode = array_merge(array('Message nature' => 'Request ADS Reports'),$decode); |
| 565 | - } |
|
| 566 | - elseif (preg_match(':^#A8:',$message)) { |
|
| 617 | + } elseif (preg_match(':^#A8:',$message)) { |
|
| 567 | 618 | $decode = array_merge(array('Message nature' => 'Deliver Departure Slot'),$decode); |
| 568 | - } |
|
| 569 | - elseif (preg_match(':^#A9:',$message)) { |
|
| 619 | + } elseif (preg_match(':^#A9:',$message)) { |
|
| 570 | 620 | $decode = array_merge(array('Message nature' => 'ATIS report'),$decode); |
| 571 | - } |
|
| 572 | - elseif (preg_match(':^#A0:',$message)) { |
|
| 621 | + } elseif (preg_match(':^#A0:',$message)) { |
|
| 573 | 622 | $decode = array_merge(array('Message nature' => 'ATIS Facility Notification (AFN)'),$decode); |
| 574 | - } |
|
| 575 | - elseif (preg_match(':^#AA:',$message)) { |
|
| 623 | + } elseif (preg_match(':^#AA:',$message)) { |
|
| 576 | 624 | $decode = array_merge(array('Message nature' => 'ATCComm'),$decode); |
| 577 | - } |
|
| 578 | - elseif (preg_match(':^#AB:',$message)) { |
|
| 625 | + } elseif (preg_match(':^#AB:',$message)) { |
|
| 579 | 626 | $decode = array_merge(array('Message nature' => 'TWIP Report'),$decode); |
| 580 | - } |
|
| 581 | - elseif (preg_match(':^#AC:',$message)) { |
|
| 627 | + } elseif (preg_match(':^#AC:',$message)) { |
|
| 582 | 628 | $decode = array_merge(array('Message nature' => 'Pushback Clearance'),$decode); |
| 583 | - } |
|
| 584 | - elseif (preg_match(':^#AD:',$message)) { |
|
| 629 | + } elseif (preg_match(':^#AD:',$message)) { |
|
| 585 | 630 | $decode = array_merge(array('Message nature' => 'Expected Taxi Clearance'),$decode); |
| 586 | - } |
|
| 587 | - elseif (preg_match(':^#AF:',$message)) { |
|
| 631 | + } elseif (preg_match(':^#AF:',$message)) { |
|
| 588 | 632 | $decode = array_merge(array('Message nature' => 'CPC Command/Response'),$decode); |
| 589 | - } |
|
| 590 | - elseif (preg_match(':^#B1:',$message)) { |
|
| 633 | + } elseif (preg_match(':^#B1:',$message)) { |
|
| 591 | 634 | $decode = array_merge(array('Message nature' => 'Request Oceanic Clearance'),$decode); |
| 592 | - } |
|
| 593 | - elseif (preg_match(':^#B2:',$message)) { |
|
| 635 | + } elseif (preg_match(':^#B2:',$message)) { |
|
| 594 | 636 | $decode = array_merge(array('Message nature' => 'Oceanic Clearance Readback'),$decode); |
| 595 | - } |
|
| 596 | - elseif (preg_match(':^#B3:',$message)) { |
|
| 637 | + } elseif (preg_match(':^#B3:',$message)) { |
|
| 597 | 638 | $decode = array_merge(array('Message nature' => 'Request Departure Clearance'),$decode); |
| 598 | - } |
|
| 599 | - elseif (preg_match(':^#B4:',$message)) { |
|
| 639 | + } elseif (preg_match(':^#B4:',$message)) { |
|
| 600 | 640 | $decode = array_merge(array('Message nature' => 'Departure Clearance Readback'),$decode); |
| 601 | - } |
|
| 602 | - elseif (preg_match(':^#B6:',$message)) { |
|
| 641 | + } elseif (preg_match(':^#B6:',$message)) { |
|
| 603 | 642 | $decode = array_merge(array('Message nature' => 'Provide ADS Report'),$decode); |
| 604 | - } |
|
| 605 | - elseif (preg_match(':^#B8:',$message)) { |
|
| 643 | + } elseif (preg_match(':^#B8:',$message)) { |
|
| 606 | 644 | $decode = array_merge(array('Message nature' => 'Request Departure Slot'),$decode); |
| 607 | - } |
|
| 608 | - elseif (preg_match(':^#B9:',$message)) { |
|
| 645 | + } elseif (preg_match(':^#B9:',$message)) { |
|
| 609 | 646 | $decode = array_merge(array('Message nature' => 'Request ATIS Report'),$decode); |
| 610 | - } |
|
| 611 | - elseif (preg_match(':^#B0:',$message)) { |
|
| 647 | + } elseif (preg_match(':^#B0:',$message)) { |
|
| 612 | 648 | $decode = array_merge(array('Message nature' => 'ATS Facility Notification'),$decode); |
| 613 | - } |
|
| 614 | - elseif (preg_match(':^#BA:',$message)) { |
|
| 649 | + } elseif (preg_match(':^#BA:',$message)) { |
|
| 615 | 650 | $decode = array_merge(array('Message nature' => 'ATCComm'),$decode); |
| 616 | - } |
|
| 617 | - elseif (preg_match(':^#BB:',$message)) { |
|
| 651 | + } elseif (preg_match(':^#BB:',$message)) { |
|
| 618 | 652 | $decode = array_merge(array('Message nature' => 'Request TWIP Report'),$decode); |
| 619 | - } |
|
| 620 | - elseif (preg_match(':^#BC:',$message)) { |
|
| 653 | + } elseif (preg_match(':^#BC:',$message)) { |
|
| 621 | 654 | $decode = array_merge(array('Message nature' => 'Pushback Clearance Request'),$decode); |
| 622 | - } |
|
| 623 | - elseif (preg_match(':^#BD:',$message)) { |
|
| 655 | + } elseif (preg_match(':^#BD:',$message)) { |
|
| 624 | 656 | $decode = array_merge(array('Message nature' => 'Expected Taxi Clearance Request'),$decode); |
| 625 | - } |
|
| 626 | - elseif (preg_match(':^#BE:',$message)) { |
|
| 657 | + } elseif (preg_match(':^#BE:',$message)) { |
|
| 627 | 658 | $decode = array_merge(array('Message nature' => 'CPC Aircraft Log-On/Off Request'),$decode); |
| 628 | - } |
|
| 629 | - elseif (preg_match(':^#BF:',$message)) { |
|
| 659 | + } elseif (preg_match(':^#BF:',$message)) { |
|
| 630 | 660 | $decode = array_merge(array('Message nature' => 'CPC WILCO/UNABLE Response'),$decode); |
| 631 | - } |
|
| 632 | - elseif (preg_match(':^#H3:',$message)) { |
|
| 661 | + } elseif (preg_match(':^#H3:',$message)) { |
|
| 633 | 662 | $decode = array_merge(array('Message nature' => 'Icing Report'),$decode); |
| 634 | 663 | } |
| 635 | 664 | } |
| 636 | 665 | if ($label == '10') { |
| 637 | 666 | if (preg_match(':^DTO01:',$message)) { |
| 638 | 667 | $decode = array_merge(array('Message nature' => 'Delayed Takeoff Report'),$decode); |
| 639 | - } |
|
| 640 | - elseif (preg_match(':^AIS01:',$message)) { |
|
| 668 | + } elseif (preg_match(':^AIS01:',$message)) { |
|
| 641 | 669 | $decode = array_merge(array('Message nature' => 'AIS Request'),$decode); |
| 642 | - } |
|
| 643 | - elseif (preg_match(':^FTX01:',$message)) { |
|
| 670 | + } elseif (preg_match(':^FTX01:',$message)) { |
|
| 644 | 671 | $decode = array_merge(array('Message nature' => 'Free Text Downlink'),$decode); |
| 645 | - } |
|
| 646 | - elseif (preg_match(':^FPL01:',$message)) { |
|
| 672 | + } elseif (preg_match(':^FPL01:',$message)) { |
|
| 647 | 673 | $decode = array_merge(array('Message nature' => 'Flight Plan Request'),$decode); |
| 648 | - } |
|
| 649 | - elseif (preg_match(':^WAB01:',$message)) { |
|
| 674 | + } elseif (preg_match(':^WAB01:',$message)) { |
|
| 650 | 675 | $decode = array_merge(array('Message nature' => 'Weight & Balance Request'),$decode); |
| 651 | - } |
|
| 652 | - elseif (preg_match(':^MET01:',$message)) { |
|
| 676 | + } elseif (preg_match(':^MET01:',$message)) { |
|
| 653 | 677 | $decode = array_merge(array('Message nature' => 'Weather Data Request'),$decode); |
| 654 | - } |
|
| 655 | - elseif (preg_match(':^WAB02:',$message)) { |
|
| 678 | + } elseif (preg_match(':^WAB02:',$message)) { |
|
| 656 | 679 | $decode = array_merge(array('Message nature' => 'Weight and Balance Acknowledgement'),$decode); |
| 657 | 680 | } |
| 658 | 681 | } |
@@ -667,38 +690,28 @@ discard block |
||
| 667 | 690 | $vsta = array('Version' => $version); |
| 668 | 691 | if ($state == 'E') { |
| 669 | 692 | $vsta = array_merge($vsta,array('Link state' => 'Established')); |
| 670 | - } |
|
| 671 | - elseif ($state == 'L') { |
|
| 693 | + } elseif ($state == 'L') { |
|
| 672 | 694 | $vsta = array_merge($vsta,array('Link state' => 'Lost')); |
| 673 | - } |
|
| 674 | - else { |
|
| 695 | + } else { |
|
| 675 | 696 | $vsta = array_merge($vsta,array('Link state' => 'Unknown')); |
| 676 | 697 | } |
| 677 | 698 | if ($type == 'V') { |
| 678 | 699 | $vsta = array_merge($vsta,array('Link type' => 'VHF ACARS')); |
| 679 | - } |
|
| 680 | - elseif ($type == 'S') { |
|
| 700 | + } elseif ($type == 'S') { |
|
| 681 | 701 | $vsta = array_merge($vsta,array('Link type' => 'Generic SATCOM')); |
| 682 | - } |
|
| 683 | - elseif ($type == 'H') { |
|
| 702 | + } elseif ($type == 'H') { |
|
| 684 | 703 | $vsta = array_merge($vsta,array('Link type' => 'HF')); |
| 685 | - } |
|
| 686 | - elseif ($type == 'G') { |
|
| 704 | + } elseif ($type == 'G') { |
|
| 687 | 705 | $vsta = array_merge($vsta,array('Link type' => 'GlobalStar SATCOM')); |
| 688 | - } |
|
| 689 | - elseif ($type == 'C') { |
|
| 706 | + } elseif ($type == 'C') { |
|
| 690 | 707 | $vsta = array_merge($vsta,array('Link type' => 'ICO SATCOM')); |
| 691 | - } |
|
| 692 | - elseif ($type == '2') { |
|
| 708 | + } elseif ($type == '2') { |
|
| 693 | 709 | $vsta = array_merge($vsta,array('Link type' => 'VDL Mode 2')); |
| 694 | - } |
|
| 695 | - elseif ($type == 'X') { |
|
| 710 | + } elseif ($type == 'X') { |
|
| 696 | 711 | $vsta = array_merge($vsta,array('Link type' => 'Inmarsat Aero')); |
| 697 | - } |
|
| 698 | - elseif ($type == 'I') { |
|
| 712 | + } elseif ($type == 'I') { |
|
| 699 | 713 | $vsta = array_merge($vsta,array('Link type' => 'Irridium SATCOM')); |
| 700 | - } |
|
| 701 | - else { |
|
| 714 | + } else { |
|
| 702 | 715 | $vsta = array_merge($vsta,array('Link type' => 'Unknown')); |
| 703 | 716 | } |
| 704 | 717 | $vsta = array_merge($vsta,array('Event occured at' => implode(':',str_split($at,2)))); |
@@ -707,7 +720,9 @@ discard block |
||
| 707 | 720 | } |
| 708 | 721 | |
| 709 | 722 | $title = $this->getTitlefromLabel($label); |
| 710 | - if ($title != '') $decode = array_merge(array('Message title' => $title),$decode); |
|
| 723 | + if ($title != '') { |
|
| 724 | + $decode = array_merge(array('Message title' => $title),$decode); |
|
| 725 | + } |
|
| 711 | 726 | |
| 712 | 727 | /* |
| 713 | 728 | // Business jets always use GS0001 |
@@ -748,14 +763,26 @@ discard block |
||
| 748 | 763 | $decode = $message['decode']; |
| 749 | 764 | $registration = (string)$message['registration']; |
| 750 | 765 | |
| 751 | - if (isset($decode['latitude'])) $latitude = $decode['latitude']; |
|
| 752 | - else $latitude = ''; |
|
| 753 | - if (isset($decode['longitude'])) $longitude = $decode['longitude']; |
|
| 754 | - else $longitude = ''; |
|
| 755 | - if (isset($decode['airicao'])) $airicao = $decode['airicao']; |
|
| 756 | - else $airicao = ''; |
|
| 757 | - if (isset($decode['icao'])) $icao = $decode['icao']; |
|
| 758 | - else $icao = $Translation->checkTranslation($ident); |
|
| 766 | + if (isset($decode['latitude'])) { |
|
| 767 | + $latitude = $decode['latitude']; |
|
| 768 | + } else { |
|
| 769 | + $latitude = ''; |
|
| 770 | + } |
|
| 771 | + if (isset($decode['longitude'])) { |
|
| 772 | + $longitude = $decode['longitude']; |
|
| 773 | + } else { |
|
| 774 | + $longitude = ''; |
|
| 775 | + } |
|
| 776 | + if (isset($decode['airicao'])) { |
|
| 777 | + $airicao = $decode['airicao']; |
|
| 778 | + } else { |
|
| 779 | + $airicao = ''; |
|
| 780 | + } |
|
| 781 | + if (isset($decode['icao'])) { |
|
| 782 | + $icao = $decode['icao']; |
|
| 783 | + } else { |
|
| 784 | + $icao = $Translation->checkTranslation($ident); |
|
| 785 | + } |
|
| 759 | 786 | |
| 760 | 787 | $image_array = $Image->getSpotterImage($registration); |
| 761 | 788 | if (!isset($image_array[0]['registration'])) { |
@@ -763,11 +790,18 @@ discard block |
||
| 763 | 790 | } |
| 764 | 791 | |
| 765 | 792 | // Business jets always use GS0001 |
| 766 | - if ($ident != 'GS0001') $info = $this->addModeSData($ident,$registration,$icao,$airicao,$latitude,$longitude); |
|
| 767 | - if ($globalDebug && isset($info) && $info != '') echo $info; |
|
| 793 | + if ($ident != 'GS0001') { |
|
| 794 | + $info = $this->addModeSData($ident,$registration,$icao,$airicao,$latitude,$longitude); |
|
| 795 | + } |
|
| 796 | + if ($globalDebug && isset($info) && $info != '') { |
|
| 797 | + echo $info; |
|
| 798 | + } |
|
| 768 | 799 | |
| 769 | - if (count($decode) > 0) $decode_json = json_encode($decode); |
|
| 770 | - else $decode_json = ''; |
|
| 800 | + if (count($decode) > 0) { |
|
| 801 | + $decode_json = json_encode($decode); |
|
| 802 | + } else { |
|
| 803 | + $decode_json = ''; |
|
| 804 | + } |
|
| 771 | 805 | if (isset($decode['Departure airport']) && isset($decode['Departure hour']) && isset($decode['Arrival airport']) && isset($decode['Arrival hour'])) { |
| 772 | 806 | $Schedule->addSchedule($icao,$decode['Departure airport'],$decode['Departure hour'],$decode['Arrival airport'],$decode['Arrival hour'],'ACARS'); |
| 773 | 807 | } elseif (isset($decode['Departure airport']) && isset($decode['Arrival airport'])) { |
@@ -775,8 +809,12 @@ discard block |
||
| 775 | 809 | } |
| 776 | 810 | |
| 777 | 811 | $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); |
|
| 812 | + if (!isset($globalACARSArchive)) { |
|
| 813 | + $globalACARSArchive = array('10','80','81','82','3F'); |
|
| 814 | + } |
|
| 815 | + if ($result && in_array($label,$globalACARSArchive)) { |
|
| 816 | + $this->addArchiveAcarsData($ident,$registration,$label,$block_id,$msg_no,$msg,$decode_json); |
|
| 817 | + } |
|
| 780 | 818 | |
| 781 | 819 | if ($globalDebug && count($decode) > 0) { |
| 782 | 820 | echo "Human readable data : ".implode(' - ',$decode)."\n"; |
@@ -801,7 +839,9 @@ discard block |
||
| 801 | 839 | $Connection = new Connection($this->db); |
| 802 | 840 | $this->db = $Connection->db; |
| 803 | 841 | |
| 804 | - if ($globalDebug) echo "Test if not already in Live ACARS table..."; |
|
| 842 | + if ($globalDebug) { |
|
| 843 | + echo "Test if not already in Live ACARS table..."; |
|
| 844 | + } |
|
| 805 | 845 | $query_test = "SELECT COUNT(*) as nb FROM acars_live WHERE ident = :ident AND registration = :registration AND message = :message"; |
| 806 | 846 | $query_test_values = array(':ident' => $ident,':registration' => $registration, ':message' => $message); |
| 807 | 847 | try { |
@@ -811,7 +851,9 @@ discard block |
||
| 811 | 851 | return "error : ".$e->getMessage(); |
| 812 | 852 | } |
| 813 | 853 | if ($stht->fetchColumn() == 0) { |
| 814 | - if ($globalDebug) echo "Add Live ACARS data..."; |
|
| 854 | + if ($globalDebug) { |
|
| 855 | + echo "Add Live ACARS data..."; |
|
| 856 | + } |
|
| 815 | 857 | $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 | 858 | $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 | 859 | try { |
@@ -822,10 +864,14 @@ discard block |
||
| 822 | 864 | return "error : ".$e->getMessage(); |
| 823 | 865 | } |
| 824 | 866 | } else { |
| 825 | - if ($globalDebug) echo "Data already in DB...\n"; |
|
| 867 | + if ($globalDebug) { |
|
| 868 | + echo "Data already in DB...\n"; |
|
| 869 | + } |
|
| 826 | 870 | return false; |
| 827 | 871 | } |
| 828 | - if ($globalDebug) echo "Done\n"; |
|
| 872 | + if ($globalDebug) { |
|
| 873 | + echo "Done\n"; |
|
| 874 | + } |
|
| 829 | 875 | return true; |
| 830 | 876 | } |
| 831 | 877 | } |
@@ -857,7 +903,9 @@ discard block |
||
| 857 | 903 | } |
| 858 | 904 | if ($stht->fetchColumn() == 0) { |
| 859 | 905 | */ |
| 860 | - if ($globalDebug) echo "Add Live ACARS data..."; |
|
| 906 | + if ($globalDebug) { |
|
| 907 | + echo "Add Live ACARS data..."; |
|
| 908 | + } |
|
| 861 | 909 | $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 | 910 | $query_values = array(':ident' => $ident,':registration' => $registration, ':label' => $label,':block_id' => $block_id, ':msg_no' => $msg_no, ':message' => $message, ':decode' => $decode); |
| 863 | 911 | try { |
@@ -868,7 +916,9 @@ discard block |
||
| 868 | 916 | return "error : ".$e->getMessage(); |
| 869 | 917 | } |
| 870 | 918 | // } |
| 871 | - if ($globalDebug) echo "Done\n"; |
|
| 919 | + if ($globalDebug) { |
|
| 920 | + echo "Done\n"; |
|
| 921 | + } |
|
| 872 | 922 | } |
| 873 | 923 | } |
| 874 | 924 | |
@@ -892,8 +942,11 @@ discard block |
||
| 892 | 942 | die; |
| 893 | 943 | } |
| 894 | 944 | $row = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 895 | - if (count($row) > 0) return $row[0]['title']; |
|
| 896 | - else return ''; |
|
| 945 | + if (count($row) > 0) { |
|
| 946 | + return $row[0]['title']; |
|
| 947 | + } else { |
|
| 948 | + return ''; |
|
| 949 | + } |
|
| 897 | 950 | } |
| 898 | 951 | |
| 899 | 952 | /** |
@@ -913,8 +966,11 @@ discard block |
||
| 913 | 966 | die; |
| 914 | 967 | } |
| 915 | 968 | $row = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 916 | - if (count($row) > 0) return $row; |
|
| 917 | - else return array(); |
|
| 969 | + if (count($row) > 0) { |
|
| 970 | + return $row; |
|
| 971 | + } else { |
|
| 972 | + return array(); |
|
| 973 | + } |
|
| 918 | 974 | } |
| 919 | 975 | |
| 920 | 976 | /** |
@@ -935,8 +991,11 @@ discard block |
||
| 935 | 991 | die; |
| 936 | 992 | } |
| 937 | 993 | $row = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 938 | - if (count($row) > 0) return $row[0]; |
|
| 939 | - else return array(); |
|
| 994 | + if (count($row) > 0) { |
|
| 995 | + return $row[0]; |
|
| 996 | + } else { |
|
| 997 | + return array(); |
|
| 998 | + } |
|
| 940 | 999 | } |
| 941 | 1000 | |
| 942 | 1001 | /** |
@@ -988,20 +1047,36 @@ discard block |
||
| 988 | 1047 | if ($row['registration'] != '') { |
| 989 | 1048 | $row['registration'] = str_replace('.','',$row['registration']); |
| 990 | 1049 | $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' => '')); |
|
| 994 | - if ($row['registration'] == '') $row['registration'] = 'NA'; |
|
| 995 | - if ($row['ident'] == '') $row['ident'] = 'NA'; |
|
| 1050 | + if (count($image_array) > 0) { |
|
| 1051 | + $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'])); |
|
| 1052 | + } else { |
|
| 1053 | + $data = array_merge($data,array('image' => '','image_thumbnail' => '','image_copyright' => '','image_source' => '','image_source_website' => '')); |
|
| 1054 | + } |
|
| 1055 | + } else { |
|
| 1056 | + $data = array_merge($data,array('image' => '','image_thumbnail' => '','image_copyright' => '','image_source' => '','image_source_website' => '')); |
|
| 1057 | + } |
|
| 1058 | + if ($row['registration'] == '') { |
|
| 1059 | + $row['registration'] = 'NA'; |
|
| 1060 | + } |
|
| 1061 | + if ($row['ident'] == '') { |
|
| 1062 | + $row['ident'] = 'NA'; |
|
| 1063 | + } |
|
| 996 | 1064 | $identicao = $Spotter->getAllAirlineInfo(substr($row['ident'],0,2)); |
| 997 | 1065 | if (isset($identicao[0])) { |
| 998 | 1066 | 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'); |
|
| 1067 | + if (filter_var(substr($row['ident'],2),FILTER_VALIDATE_INT,array("flags"=>FILTER_FLAG_ALLOW_OCTAL))) { |
|
| 1068 | + $icao = $row['ident']; |
|
| 1069 | + } else { |
|
| 1070 | + $icao = 'AFR'.ltrim(substr($row['ident'],2),'0'); |
|
| 1071 | + } |
|
| 1072 | + } else { |
|
| 1073 | + $icao = $identicao[0]['icao'].ltrim(substr($row['ident'],2),'0'); |
|
| 1074 | + } |
|
| 1002 | 1075 | |
| 1003 | 1076 | $data = array_merge($data,array('airline_icao' => $identicao[0]['icao'],'airline_name' => $identicao[0]['name'])); |
| 1004 | - } else $icao = $row['ident']; |
|
| 1077 | + } else { |
|
| 1078 | + $icao = $row['ident']; |
|
| 1079 | + } |
|
| 1005 | 1080 | $icao = $Translation->checkTranslation($icao,false); |
| 1006 | 1081 | |
| 1007 | 1082 | $decode = json_decode($row['decode'],true); |
@@ -1027,7 +1102,9 @@ discard block |
||
| 1027 | 1102 | $found = true; |
| 1028 | 1103 | } |
| 1029 | 1104 | } |
| 1030 | - if ($found) $row['decode'] = json_encode($decode); |
|
| 1105 | + if ($found) { |
|
| 1106 | + $row['decode'] = json_encode($decode); |
|
| 1107 | + } |
|
| 1031 | 1108 | $data = array_merge($data,array('registration' => $row['registration'],'message' => $row['message'], 'date' => $row['date'], 'ident' => $icao, 'decode' => $row['decode'])); |
| 1032 | 1109 | $result[] = $data; |
| 1033 | 1110 | $i++; |
@@ -1035,8 +1112,9 @@ discard block |
||
| 1035 | 1112 | if (isset($result)) { |
| 1036 | 1113 | $result[0]['query_number_rows'] = $i; |
| 1037 | 1114 | return $result; |
| 1115 | + } else { |
|
| 1116 | + return array(); |
|
| 1038 | 1117 | } |
| 1039 | - else return array(); |
|
| 1040 | 1118 | } |
| 1041 | 1119 | |
| 1042 | 1120 | /** |
@@ -1096,20 +1174,36 @@ discard block |
||
| 1096 | 1174 | if ($row['registration'] != '') { |
| 1097 | 1175 | $row['registration'] = str_replace('.','',$row['registration']); |
| 1098 | 1176 | $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' => '')); |
|
| 1177 | + if (count($image_array) > 0) { |
|
| 1178 | + $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'])); |
|
| 1179 | + } else { |
|
| 1180 | + $data = array_merge($data,array('image_thumbnail' => '','image_copyright' => '','image_source' => '','image_source_website' => '')); |
|
| 1181 | + } |
|
| 1182 | + } else { |
|
| 1183 | + $data = array_merge($data,array('image_thumbnail' => '','image_copyright' => '','image_source' => '','image_source_website' => '')); |
|
| 1184 | + } |
|
| 1102 | 1185 | $icao = ''; |
| 1103 | - if ($row['registration'] == '') $row['registration'] = 'NA'; |
|
| 1104 | - if ($row['ident'] == '') $row['ident'] = 'NA'; |
|
| 1186 | + if ($row['registration'] == '') { |
|
| 1187 | + $row['registration'] = 'NA'; |
|
| 1188 | + } |
|
| 1189 | + if ($row['ident'] == '') { |
|
| 1190 | + $row['ident'] = 'NA'; |
|
| 1191 | + } |
|
| 1105 | 1192 | $identicao = $Spotter->getAllAirlineInfo(substr($row['ident'],0,2)); |
| 1106 | 1193 | if (isset($identicao[0])) { |
| 1107 | 1194 | 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'); |
|
| 1195 | + if (filter_var(substr($row['ident'],2),FILTER_VALIDATE_INT,array("flags"=>FILTER_FLAG_ALLOW_OCTAL))) { |
|
| 1196 | + $icao = $row['ident']; |
|
| 1197 | + } else { |
|
| 1198 | + $icao = 'AFR'.ltrim(substr($row['ident'],2),'0'); |
|
| 1199 | + } |
|
| 1200 | + } else { |
|
| 1201 | + $icao = $identicao[0]['icao'].ltrim(substr($row['ident'],2),'0'); |
|
| 1202 | + } |
|
| 1111 | 1203 | $data = array_merge($data,array('airline_icao' => $identicao[0]['icao'],'airline_name' => $identicao[0]['name'])); |
| 1112 | - } else $icao = $row['ident']; |
|
| 1204 | + } else { |
|
| 1205 | + $icao = $row['ident']; |
|
| 1206 | + } |
|
| 1113 | 1207 | $icao = $Translation->checkTranslation($icao); |
| 1114 | 1208 | |
| 1115 | 1209 | |
@@ -1117,12 +1211,16 @@ discard block |
||
| 1117 | 1211 | $found = false; |
| 1118 | 1212 | if ($decode != '' && array_key_exists('Departure airport',$decode)) { |
| 1119 | 1213 | $airport_info = $Spotter->getAllAirportInfo($decode['Departure airport']); |
| 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>'; |
|
| 1214 | + if (isset($airport_info[0]['icao'])) { |
|
| 1215 | + $decode['Departure airport'] = '<a href="'.$globalURL.'/airport/'.$airport_info[0]['icao'].'">'.$airport_info[0]['city'].','.$airport_info[0]['country'].' ('.$airport_info[0]['icao'].')</a>'; |
|
| 1216 | + } |
|
| 1121 | 1217 | $found = true; |
| 1122 | 1218 | } |
| 1123 | 1219 | if ($decode != '' && array_key_exists('Arrival airport',$decode)) { |
| 1124 | 1220 | $airport_info = $Spotter->getAllAirportInfo($decode['Arrival airport']); |
| 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>'; |
|
| 1221 | + if (isset($airport_info[0]['icao'])) { |
|
| 1222 | + $decode['Arrival airport'] = '<a href="'.$globalURL.'/airport/'.$airport_info[0]['icao'].'">'.$airport_info[0]['city'].','.$airport_info[0]['country'].' ('.$airport_info[0]['icao'].')</a>'; |
|
| 1223 | + } |
|
| 1126 | 1224 | $found = true; |
| 1127 | 1225 | } |
| 1128 | 1226 | if ($decode != '' && array_key_exists('Airport/Waypoint name',$decode)) { |
@@ -1132,7 +1230,9 @@ discard block |
||
| 1132 | 1230 | $found = true; |
| 1133 | 1231 | } |
| 1134 | 1232 | } |
| 1135 | - if ($found) $row['decode'] = json_encode($decode); |
|
| 1233 | + if ($found) { |
|
| 1234 | + $row['decode'] = json_encode($decode); |
|
| 1235 | + } |
|
| 1136 | 1236 | |
| 1137 | 1237 | $data = array_merge($data,array('registration' => $row['registration'],'message' => $row['message'], 'date' => $row['date'], 'ident' => $icao, 'decode' => $row['decode'])); |
| 1138 | 1238 | $result[] = $data; |
@@ -1141,7 +1241,9 @@ discard block |
||
| 1141 | 1241 | if (isset($result)) { |
| 1142 | 1242 | $result[0]['query_number_rows'] = $i; |
| 1143 | 1243 | return $result; |
| 1144 | - } else return array(); |
|
| 1244 | + } else { |
|
| 1245 | + return array(); |
|
| 1246 | + } |
|
| 1145 | 1247 | } |
| 1146 | 1248 | |
| 1147 | 1249 | /** |
@@ -1157,19 +1259,29 @@ discard block |
||
| 1157 | 1259 | $ident = trim($ident); |
| 1158 | 1260 | $Translation = new Translation($this->db); |
| 1159 | 1261 | $Spotter = new Spotter($this->db); |
| 1160 | - if ($globalDebug) echo "Test if we add ModeS data..."; |
|
| 1262 | + if ($globalDebug) { |
|
| 1263 | + echo "Test if we add ModeS data..."; |
|
| 1264 | + } |
|
| 1161 | 1265 | //if ($icao == '') $icao = ACARS->ident2icao($ident); |
| 1162 | - if ($icao == '') $icao = $Translation->checkTranslation($ident); |
|
| 1163 | - if ($globalDebug) echo '- Ident : '.$icao.' - '; |
|
| 1266 | + if ($icao == '') { |
|
| 1267 | + $icao = $Translation->checkTranslation($ident); |
|
| 1268 | + } |
|
| 1269 | + if ($globalDebug) { |
|
| 1270 | + echo '- Ident : '.$icao.' - '; |
|
| 1271 | + } |
|
| 1164 | 1272 | if ($ident == '' || $registration == '') { |
| 1165 | - if ($globalDebug) echo "Ident or registration null, exit\n"; |
|
| 1273 | + if ($globalDebug) { |
|
| 1274 | + echo "Ident or registration null, exit\n"; |
|
| 1275 | + } |
|
| 1166 | 1276 | return ''; |
| 1167 | 1277 | } |
| 1168 | 1278 | |
| 1169 | 1279 | $registration = str_replace('.','',$registration); |
| 1170 | 1280 | $ident = $Translation->ident2icao($ident); |
| 1171 | 1281 | // Check if a flight with same registration is flying now, if ok check if callsign = name in ACARS, else add it to translation |
| 1172 | - if ($globalDebug) echo "Check if needed to add translation ".$ident.'... '; |
|
| 1282 | + if ($globalDebug) { |
|
| 1283 | + echo "Check if needed to add translation ".$ident.'... '; |
|
| 1284 | + } |
|
| 1173 | 1285 | $querysi = "SELECT ident FROM spotter_live s,aircraft_modes a WHERE a.ModeS = s.ModeS AND a.Registration = :registration AND s.format_source <> 'ACARS' LIMIT 1"; |
| 1174 | 1286 | $querysi_values = array(':registration' => $registration); |
| 1175 | 1287 | try { |
@@ -1177,7 +1289,9 @@ discard block |
||
| 1177 | 1289 | $sthsi = $this->db->prepare($querysi); |
| 1178 | 1290 | $sthsi->execute($querysi_values); |
| 1179 | 1291 | } catch(PDOException $e) { |
| 1180 | - if ($globalDebug) echo $e->getMessage(); |
|
| 1292 | + if ($globalDebug) { |
|
| 1293 | + echo $e->getMessage(); |
|
| 1294 | + } |
|
| 1181 | 1295 | return "error : ".$e->getMessage(); |
| 1182 | 1296 | } |
| 1183 | 1297 | $resultsi = $sthsi->fetch(PDO::FETCH_ASSOC); |
@@ -1186,9 +1300,14 @@ discard block |
||
| 1186 | 1300 | if (count($resultsi) > 0 && $resultsi['ident'] != $ident && $resultsi['ident'] != '') { |
| 1187 | 1301 | $Translation = new Translation($this->db); |
| 1188 | 1302 | $trans_ident = $Translation->getOperator($resultsi['ident']); |
| 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'); |
|
| 1303 | + if ($globalDebug) { |
|
| 1304 | + echo 'Add translation to table : '.$ident.' -> '.$resultsi['ident'].' '; |
|
| 1305 | + } |
|
| 1306 | + if ($ident != $trans_ident) { |
|
| 1307 | + $Translation->addOperator($resultsi['ident'],$ident,'ACARS'); |
|
| 1308 | + } elseif ($trans_ident == $ident) { |
|
| 1309 | + $Translation->updateOperator($resultsi['ident'],$ident,'ACARS'); |
|
| 1310 | + } |
|
| 1192 | 1311 | } else { |
| 1193 | 1312 | if ($registration != '' && $latitude != '' && $longitude != '') { |
| 1194 | 1313 | $query = "SELECT ModeS FROM aircraft_modes WHERE Registration = :registration LIMIT 1"; |
@@ -1197,18 +1316,25 @@ discard block |
||
| 1197 | 1316 | $sth = $this->db->prepare($query); |
| 1198 | 1317 | $sth->execute($query_values); |
| 1199 | 1318 | } catch(PDOException $e) { |
| 1200 | - if ($globalDebug) echo $e->getMessage(); |
|
| 1319 | + if ($globalDebug) { |
|
| 1320 | + echo $e->getMessage(); |
|
| 1321 | + } |
|
| 1201 | 1322 | return "error : ".$e->getMessage(); |
| 1202 | 1323 | } |
| 1203 | 1324 | $result = $sth->fetch(PDO::FETCH_ASSOC); |
| 1204 | 1325 | $sth->closeCursor(); |
| 1205 | - if (isset($result['modes'])) $hex = $result['modes']; |
|
| 1206 | - else $hex = ''; |
|
| 1326 | + if (isset($result['modes'])) { |
|
| 1327 | + $hex = $result['modes']; |
|
| 1328 | + } else { |
|
| 1329 | + $hex = ''; |
|
| 1330 | + } |
|
| 1207 | 1331 | $SI_data = array('hex' => $hex,'ident' => $ident,'aircraft_icao' => $ICAOTypeCode,'registration' => $registration,'latitude' => $latitude,'$longitude' => $longitude,'format_source' => 'ACARS'); |
| 1208 | 1332 | $this->SI->add($SI_data); |
| 1209 | 1333 | } |
| 1210 | 1334 | } |
| 1211 | - if ($globalDebug) echo 'Done'."\n"; |
|
| 1335 | + if ($globalDebug) { |
|
| 1336 | + echo 'Done'."\n"; |
|
| 1337 | + } |
|
| 1212 | 1338 | |
| 1213 | 1339 | $query = "SELECT flightaware_id, ModeS FROM spotter_output WHERE ident = :ident AND format_source <> 'ACARS' ORDER BY spotter_id DESC LIMIT 1"; |
| 1214 | 1340 | $query_values = array(':ident' => $icao); |
@@ -1217,15 +1343,20 @@ discard block |
||
| 1217 | 1343 | $sth = $this->db->prepare($query); |
| 1218 | 1344 | $sth->execute($query_values); |
| 1219 | 1345 | } catch(PDOException $e) { |
| 1220 | - if ($globalDebug) echo $e->getMessage(); |
|
| 1346 | + if ($globalDebug) { |
|
| 1347 | + echo $e->getMessage(); |
|
| 1348 | + } |
|
| 1221 | 1349 | return "error : ".$e->getMessage(); |
| 1222 | 1350 | } |
| 1223 | 1351 | $result = $sth->fetch(PDO::FETCH_ASSOC); |
| 1224 | 1352 | $sth->closeCursor(); |
| 1225 | 1353 | //print_r($result); |
| 1226 | 1354 | if (isset($result['flightaware_id'])) { |
| 1227 | - if (isset($result['ModeS'])) $ModeS = $result['ModeS']; |
|
| 1228 | - else $ModeS = ''; |
|
| 1355 | + if (isset($result['ModeS'])) { |
|
| 1356 | + $ModeS = $result['ModeS']; |
|
| 1357 | + } else { |
|
| 1358 | + $ModeS = ''; |
|
| 1359 | + } |
|
| 1229 | 1360 | if ($ModeS == '') { |
| 1230 | 1361 | $id = explode('-',$result['flightaware_id']); |
| 1231 | 1362 | $ModeS = $id[0]; |
@@ -1239,13 +1370,17 @@ discard block |
||
| 1239 | 1370 | $sthc = $this->db->prepare($queryc); |
| 1240 | 1371 | $sthc->execute($queryc_values); |
| 1241 | 1372 | } catch(PDOException $e) { |
| 1242 | - if ($globalDebug) echo $e->getMessage(); |
|
| 1373 | + if ($globalDebug) { |
|
| 1374 | + echo $e->getMessage(); |
|
| 1375 | + } |
|
| 1243 | 1376 | return "error : ".$e->getMessage(); |
| 1244 | 1377 | } |
| 1245 | 1378 | $row = $sthc->fetch(PDO::FETCH_ASSOC); |
| 1246 | 1379 | $sthc->closeCursor(); |
| 1247 | 1380 | if (count($row) == 0) { |
| 1248 | - if ($globalDebug) echo " Add to ModeS table - "; |
|
| 1381 | + if ($globalDebug) { |
|
| 1382 | + echo " Add to ModeS table - "; |
|
| 1383 | + } |
|
| 1249 | 1384 | $queryi = "INSERT INTO aircraft_modes (ModeS,ModeSCountry,Registration,ICAOTypeCode,Source) VALUES (:ModeS,:ModeSCountry,:Registration, :ICAOTypeCode,'ACARS')"; |
| 1250 | 1385 | $queryi_values = array(':ModeS' => $ModeS,':ModeSCountry' => $country,':Registration' => $registration, ':ICAOTypeCode' => $ICAOTypeCode); |
| 1251 | 1386 | try { |
@@ -1253,11 +1388,15 @@ discard block |
||
| 1253 | 1388 | $sthi = $this->db->prepare($queryi); |
| 1254 | 1389 | $sthi->execute($queryi_values); |
| 1255 | 1390 | } catch(PDOException $e) { |
| 1256 | - if ($globalDebug) echo $e->getMessage(); |
|
| 1391 | + if ($globalDebug) { |
|
| 1392 | + echo $e->getMessage(); |
|
| 1393 | + } |
|
| 1257 | 1394 | return "error : ".$e->getMessage(); |
| 1258 | 1395 | } |
| 1259 | 1396 | } else { |
| 1260 | - if ($globalDebug) echo " Update ModeS table - "; |
|
| 1397 | + if ($globalDebug) { |
|
| 1398 | + echo " Update ModeS table - "; |
|
| 1399 | + } |
|
| 1261 | 1400 | if ($ICAOTypeCode != '') { |
| 1262 | 1401 | $queryi = "UPDATE aircraft_modes SET ModeSCountry = :ModeSCountry,Registration = :Registration,ICAOTypeCode = :ICAOTypeCode,Source = 'ACARS',LastModified = NOW() WHERE ModeS = :ModeS"; |
| 1263 | 1402 | $queryi_values = array(':ModeS' => $ModeS,':ModeSCountry' => $country,':Registration' => $registration, ':ICAOTypeCode' => $ICAOTypeCode); |
@@ -1270,7 +1409,9 @@ discard block |
||
| 1270 | 1409 | $sthi = $this->db->prepare($queryi); |
| 1271 | 1410 | $sthi->execute($queryi_values); |
| 1272 | 1411 | } catch(PDOException $e) { |
| 1273 | - if ($globalDebug) echo $e->getMessage(); |
|
| 1412 | + if ($globalDebug) { |
|
| 1413 | + echo $e->getMessage(); |
|
| 1414 | + } |
|
| 1274 | 1415 | return "error : ".$e->getMessage(); |
| 1275 | 1416 | } |
| 1276 | 1417 | } |
@@ -1292,7 +1433,9 @@ discard block |
||
| 1292 | 1433 | return "error : ".$e->getMessage(); |
| 1293 | 1434 | } |
| 1294 | 1435 | */ |
| 1295 | - if ($globalDebug) echo " Update Spotter_output table - "; |
|
| 1436 | + if ($globalDebug) { |
|
| 1437 | + echo " Update Spotter_output table - "; |
|
| 1438 | + } |
|
| 1296 | 1439 | if ($ICAOTypeCode != '') { |
| 1297 | 1440 | if ($globalDBdriver == 'mysql') { |
| 1298 | 1441 | $queryi = "UPDATE spotter_output SET registration = :Registration,aircraft_icao = :ICAOTypeCode WHERE ident = :ident AND date >= date_sub(UTC_TIMESTAMP(), INTERVAL 1 HOUR)"; |
@@ -1303,8 +1446,7 @@ discard block |
||
| 1303 | 1446 | } else { |
| 1304 | 1447 | if ($globalDBdriver == 'mysql') { |
| 1305 | 1448 | $queryi = "UPDATE spotter_output SET registration = :Registration WHERE ident = :ident AND date >= date_sub(UTC_TIMESTAMP(), INTERVAL 1 HOUR)"; |
| 1306 | - } |
|
| 1307 | - elseif ($globalDBdriver == 'pgsql') { |
|
| 1449 | + } elseif ($globalDBdriver == 'pgsql') { |
|
| 1308 | 1450 | $queryi = "UPDATE spotter_output SET registration = :Registration WHERE ident = :ident AND date >= NOW() AT TIME ZONE 'UTC' - INTERVAL '1 HOUR'"; |
| 1309 | 1451 | } |
| 1310 | 1452 | $queryi_values = array(':Registration' => $registration,':ident' => $icao); |
@@ -1314,15 +1456,21 @@ discard block |
||
| 1314 | 1456 | $sthi = $this->db->prepare($queryi); |
| 1315 | 1457 | $sthi->execute($queryi_values); |
| 1316 | 1458 | } catch(PDOException $e) { |
| 1317 | - if ($globalDebug) echo $e->getMessage(); |
|
| 1459 | + if ($globalDebug) { |
|
| 1460 | + echo $e->getMessage(); |
|
| 1461 | + } |
|
| 1318 | 1462 | return "error : ".$e->getMessage(); |
| 1319 | 1463 | } |
| 1320 | 1464 | |
| 1321 | 1465 | } |
| 1322 | 1466 | } else { |
| 1323 | - if ($globalDebug) echo " Can't find ModeS in spotter_output - "; |
|
| 1467 | + if ($globalDebug) { |
|
| 1468 | + echo " Can't find ModeS in spotter_output - "; |
|
| 1469 | + } |
|
| 1470 | + } |
|
| 1471 | + if ($globalDebug) { |
|
| 1472 | + echo "Done\n"; |
|
| 1324 | 1473 | } |
| 1325 | - if ($globalDebug) echo "Done\n"; |
|
| 1326 | 1474 | } |
| 1327 | 1475 | } |
| 1328 | 1476 | ?> |
@@ -21,7 +21,9 @@ discard block |
||
| 21 | 21 | print '<option></option>'; |
| 22 | 22 | $Stats = new Stats(); |
| 23 | 23 | $airline_names = $Stats->getAllAirlineNames(); |
| 24 | - if (empty($airline_names)) $airline_names = $Spotter->getAllAirlineNames(); |
|
| 24 | + if (empty($airline_names)) { |
|
| 25 | + $airline_names = $Spotter->getAllAirlineNames(); |
|
| 26 | + } |
|
| 25 | 27 | foreach($airline_names as $airline_name) |
| 26 | 28 | { |
| 27 | 29 | if($airline == $airline_name['airline_icao']) |
@@ -43,8 +45,7 @@ discard block |
||
| 43 | 45 | if ($globalIVAO && @getimagesize($globalURL.'/images/airlines/'.$spotter_array[0]['airline_icao'].'.gif')) |
| 44 | 46 | { |
| 45 | 47 | print '<img src="'.$globalURL.'/images/airlines/'.$spotter_array[0]['airline_icao'].'.gif" alt="'.$spotter_array[0]['airline_name'].' ('.$spotter_array[0]['airline_icao'].')" title="'.$spotter_array[0]['airline_name'].' ('.$spotter_array[0]['airline_icao'].')" class="logo" />'; |
| 46 | - } |
|
| 47 | - elseif (@getimagesize($globalURL.'/images/airlines/'.$spotter_array[0]['airline_icao'].'.png')) |
|
| 48 | + } elseif (@getimagesize($globalURL.'/images/airlines/'.$spotter_array[0]['airline_icao'].'.png')) |
|
| 48 | 49 | { |
| 49 | 50 | print '<img src="'.$globalURL.'/images/airlines/'.$spotter_array[0]['airline_icao'].'.png" alt="'.$spotter_array[0]['airline_name'].' ('.$spotter_array[0]['airline_icao'].')" title="'.$spotter_array[0]['airline_name'].' ('.$spotter_array[0]['airline_icao'].')" class="logo" />'; |
| 50 | 51 | } |