@@ -22,7 +22,9 @@ discard block |
||
| 22 | 22 | require_once(dirname(__FILE__).'/../require/class.MarineImport.php'); |
| 23 | 23 | } |
| 24 | 24 | |
| 25 | -if (!isset($globalDebug)) $globalDebug = FALSE; |
|
| 25 | +if (!isset($globalDebug)) { |
|
| 26 | + $globalDebug = FALSE; |
|
| 27 | +} |
|
| 26 | 28 | |
| 27 | 29 | if ($globalInstalled === FALSE) { |
| 28 | 30 | echo "This script MUST be run after install script. Use your web browser to run install/index.php"; |
@@ -68,66 +70,107 @@ discard block |
||
| 68 | 70 | //elseif (isset($options['source'])) $hosts = array($options['source']); |
| 69 | 71 | if (isset($options['s'])) { |
| 70 | 72 | $globalSources = array(); |
| 71 | - if (isset($options['format'])) $globalSources[] = array('host' => $options['s'],'format' => $options['format']); |
|
| 72 | - else $globalSources[] = array('host' => $options['s']); |
|
| 73 | -} elseif (isset($options['source'])) { |
|
| 73 | + if (isset($options['format'])) { |
|
| 74 | + $globalSources[] = array('host' => $options['s'],'format' => $options['format']); |
|
| 75 | + } else { |
|
| 76 | + $globalSources[] = array('host' => $options['s']); |
|
| 77 | + } |
|
| 78 | + } elseif (isset($options['source'])) { |
|
| 74 | 79 | $globalSources = array(); |
| 75 | - if (isset($options['format'])) $globalSources[] = array('host' => $options['source'],'format' => $options['format']); |
|
| 76 | - else $globalSources[] = array('host' => $options['source']); |
|
| 77 | -} |
|
| 80 | + if (isset($options['format'])) { |
|
| 81 | + $globalSources[] = array('host' => $options['source'],'format' => $options['format']); |
|
| 82 | + } else { |
|
| 83 | + $globalSources[] = array('host' => $options['source']); |
|
| 84 | + } |
|
| 85 | + } |
|
| 78 | 86 | if (isset($options['aprsserverhost'])) { |
| 79 | 87 | $globalServerAPRS = TRUE; |
| 80 | 88 | $globalServerAPRShost = $options['aprsserverhost']; |
| 81 | 89 | } |
| 82 | -if (isset($options['aprsserverport'])) $globalServerAPRSport = $options['aprsserverport']; |
|
| 83 | -if (isset($options['aprsserverssid'])) $globalServerAPRSssid = $options['aprsserverssid']; |
|
| 84 | -if (isset($options['aprsserverpass'])) $globalServerAPRSpass = $options['aprsserverpass']; |
|
| 85 | -if (isset($options['noaprsserver'])) $globalServerAPRS = FALSE; |
|
| 90 | +if (isset($options['aprsserverport'])) { |
|
| 91 | + $globalServerAPRSport = $options['aprsserverport']; |
|
| 92 | +} |
|
| 93 | +if (isset($options['aprsserverssid'])) { |
|
| 94 | + $globalServerAPRSssid = $options['aprsserverssid']; |
|
| 95 | +} |
|
| 96 | +if (isset($options['aprsserverpass'])) { |
|
| 97 | + $globalServerAPRSpass = $options['aprsserverpass']; |
|
| 98 | +} |
|
| 99 | +if (isset($options['noaprsserver'])) { |
|
| 100 | + $globalServerAPRS = FALSE; |
|
| 101 | +} |
|
| 86 | 102 | if (isset($options['enable-aircraft'])) { |
| 87 | - if ($globalDebug) echo 'Enable Aircraft mode'."\n"; |
|
| 103 | + if ($globalDebug) { |
|
| 104 | + echo 'Enable Aircraft mode'."\n"; |
|
| 105 | + } |
|
| 88 | 106 | $globalAircraft = TRUE; |
| 89 | 107 | } |
| 90 | 108 | if (isset($options['disable-aircraft'])) { |
| 91 | - if ($globalDebug) echo 'Disable Aircraft mode'."\n"; |
|
| 109 | + if ($globalDebug) { |
|
| 110 | + echo 'Disable Aircraft mode'."\n"; |
|
| 111 | + } |
|
| 92 | 112 | $globalAircraft = FALSE; |
| 93 | 113 | } |
| 94 | 114 | if (isset($options['enable-tracker'])) { |
| 95 | - if ($globalDebug) echo 'Enable Tracker mode'."\n"; |
|
| 115 | + if ($globalDebug) { |
|
| 116 | + echo 'Enable Tracker mode'."\n"; |
|
| 117 | + } |
|
| 96 | 118 | $globalTracker = TRUE; |
| 97 | 119 | } |
| 98 | 120 | if (isset($options['disable-tracker'])) { |
| 99 | - if ($globalDebug) echo 'Disable Tracker mode'."\n"; |
|
| 121 | + if ($globalDebug) { |
|
| 122 | + echo 'Disable Tracker mode'."\n"; |
|
| 123 | + } |
|
| 100 | 124 | $globalTracker = FALSE; |
| 101 | 125 | } |
| 102 | 126 | if (isset($options['enable-marine'])) { |
| 103 | - if ($globalDebug) echo 'Enable Marine mode'."\n"; |
|
| 127 | + if ($globalDebug) { |
|
| 128 | + echo 'Enable Marine mode'."\n"; |
|
| 129 | + } |
|
| 104 | 130 | $globalMarine = TRUE; |
| 105 | 131 | } |
| 106 | 132 | if (isset($options['disable-marine'])) { |
| 107 | - if ($globalDebug) echo 'Disable Marine mode'."\n"; |
|
| 133 | + if ($globalDebug) { |
|
| 134 | + echo 'Disable Marine mode'."\n"; |
|
| 135 | + } |
|
| 108 | 136 | $globalMarine = FALSE; |
| 109 | 137 | } |
| 110 | -if (isset($options['nodaemon'])) $globalDaemon = FALSE; |
|
| 111 | -if (isset($options['server'])) $globalServer = TRUE; |
|
| 112 | -if (isset($options['idsource'])) $id_source = $options['idsource']; |
|
| 113 | -else $id_source = 1; |
|
| 138 | +if (isset($options['nodaemon'])) { |
|
| 139 | + $globalDaemon = FALSE; |
|
| 140 | +} |
|
| 141 | +if (isset($options['server'])) { |
|
| 142 | + $globalServer = TRUE; |
|
| 143 | +} |
|
| 144 | +if (isset($options['idsource'])) { |
|
| 145 | + $id_source = $options['idsource']; |
|
| 146 | +} else { |
|
| 147 | + $id_source = 1; |
|
| 148 | +} |
|
| 114 | 149 | if (isset($globalServer) && $globalServer) { |
| 115 | - if ($globalDebug) echo "Using Server Mode\n"; |
|
| 150 | + if ($globalDebug) { |
|
| 151 | + echo "Using Server Mode\n"; |
|
| 152 | + } |
|
| 116 | 153 | $SI=new SpotterServer(); |
| 117 | 154 | /* |
| 118 | 155 | require_once(dirname(__FILE__).'/../require/class.APRS.php'); |
| 119 | 156 | $SI = new adsb2aprs(); |
| 120 | 157 | $SI->connect(); |
| 121 | 158 | */ |
| 122 | -} else $SI=new SpotterImport($Connection->db); |
|
| 159 | +} else { |
|
| 160 | + $SI=new SpotterImport($Connection->db); |
|
| 161 | +} |
|
| 123 | 162 | |
| 124 | -if (isset($globalTracker) && $globalTracker) require_once(dirname(__FILE__).'/../require/class.TrackerImport.php'); |
|
| 163 | +if (isset($globalTracker) && $globalTracker) { |
|
| 164 | + require_once(dirname(__FILE__).'/../require/class.TrackerImport.php'); |
|
| 165 | +} |
|
| 125 | 166 | if (isset($globalMarine) && $globalMarine) { |
| 126 | 167 | require_once(dirname(__FILE__).'/../require/class.AIS.php'); |
| 127 | 168 | require_once(dirname(__FILE__).'/../require/class.MarineImport.php'); |
| 128 | 169 | } |
| 129 | 170 | |
| 130 | -if (isset($globalTracker) && $globalTracker) $TI = new TrackerImport($Connection->db); |
|
| 171 | +if (isset($globalTracker) && $globalTracker) { |
|
| 172 | + $TI = new TrackerImport($Connection->db); |
|
| 173 | +} |
|
| 131 | 174 | if (isset($globalMarine) && $globalMarine) { |
| 132 | 175 | $AIS = new AIS(); |
| 133 | 176 | $MI = new MarineImport($Connection->db); |
@@ -152,7 +195,9 @@ discard block |
||
| 152 | 195 | } |
| 153 | 196 | |
| 154 | 197 | // let's try and connect |
| 155 | -if ($globalDebug) echo "Connecting...\n"; |
|
| 198 | +if ($globalDebug) { |
|
| 199 | + echo "Connecting...\n"; |
|
| 200 | +} |
|
| 156 | 201 | $use_aprs = false; |
| 157 | 202 | $aprs_full = false; |
| 158 | 203 | $reset = 0; |
@@ -161,7 +206,9 @@ discard block |
||
| 161 | 206 | //global $sockets, $formats, $globalDebug,$aprs_connect,$last_exec, $globalSourcesRights, $use_aprs; |
| 162 | 207 | global $sockets,$httpfeeds, $globalSources, $globalDebug,$aprs_connect,$last_exec, $globalSourcesRights, $use_aprs, $reset,$context; |
| 163 | 208 | $reset++; |
| 164 | - if ($globalDebug) echo 'Connect to all...'."\n"; |
|
| 209 | + if ($globalDebug) { |
|
| 210 | + echo 'Connect to all...'."\n"; |
|
| 211 | + } |
|
| 165 | 212 | foreach ($hosts as $id => $value) { |
| 166 | 213 | $host = $value['host']; |
| 167 | 214 | $globalSources[$id]['last_exec'] = 0; |
@@ -171,32 +218,44 @@ discard block |
||
| 171 | 218 | //$formats[$id] = 'deltadbtxt'; |
| 172 | 219 | $globalSources[$id]['format'] = 'deltadbtxt'; |
| 173 | 220 | //$last_exec['deltadbtxt'] = 0; |
| 174 | - if ($globalDebug) echo "Connect to deltadb source (".$host.")...\n"; |
|
| 221 | + if ($globalDebug) { |
|
| 222 | + echo "Connect to deltadb source (".$host.")...\n"; |
|
| 223 | + } |
|
| 175 | 224 | } else if (preg_match('/vatsim-data.txt$/i',$host)) { |
| 176 | 225 | //$formats[$id] = 'vatsimtxt'; |
| 177 | 226 | $globalSources[$id]['format'] = 'vatsimtxt'; |
| 178 | 227 | //$last_exec['vatsimtxt'] = 0; |
| 179 | - if ($globalDebug) echo "Connect to vatsim source (".$host.")...\n"; |
|
| 228 | + if ($globalDebug) { |
|
| 229 | + echo "Connect to vatsim source (".$host.")...\n"; |
|
| 230 | + } |
|
| 180 | 231 | } else if (preg_match('/aircraftlist.json$/i',$host)) { |
| 181 | 232 | //$formats[$id] = 'aircraftlistjson'; |
| 182 | 233 | $globalSources[$id]['format'] = 'aircraftlistjson'; |
| 183 | 234 | //$last_exec['aircraftlistjson'] = 0; |
| 184 | - if ($globalDebug) echo "Connect to aircraftlist.json source (".$host.")...\n"; |
|
| 235 | + if ($globalDebug) { |
|
| 236 | + echo "Connect to aircraftlist.json source (".$host.")...\n"; |
|
| 237 | + } |
|
| 185 | 238 | } else if (preg_match('/aircraft.json$/i',$host)) { |
| 186 | 239 | //$formats[$id] = 'aircraftjson'; |
| 187 | 240 | $globalSources[$id]['format'] = 'aircraftjson'; |
| 188 | 241 | //$last_exec['aircraftlistjson'] = 0; |
| 189 | - if ($globalDebug) echo "Connect to aircraft.json source (".$host.")...\n"; |
|
| 242 | + if ($globalDebug) { |
|
| 243 | + echo "Connect to aircraft.json source (".$host.")...\n"; |
|
| 244 | + } |
|
| 190 | 245 | } else if (preg_match('/aircraft$/i',$host)) { |
| 191 | 246 | //$formats[$id] = 'planefinderclient'; |
| 192 | 247 | $globalSources[$id]['format'] = 'planefinderclient'; |
| 193 | 248 | //$last_exec['aircraftlistjson'] = 0; |
| 194 | - if ($globalDebug) echo "Connect to planefinderclient source (".$host.")...\n"; |
|
| 249 | + if ($globalDebug) { |
|
| 250 | + echo "Connect to planefinderclient source (".$host.")...\n"; |
|
| 251 | + } |
|
| 195 | 252 | } else if (preg_match('/opensky/i',$host)) { |
| 196 | 253 | //$formats[$id] = 'aircraftlistjson'; |
| 197 | 254 | $globalSources[$id]['format'] = 'opensky'; |
| 198 | 255 | //$last_exec['aircraftlistjson'] = 0; |
| 199 | - if ($globalDebug) echo "Connect to opensky source (".$host.")...\n"; |
|
| 256 | + if ($globalDebug) { |
|
| 257 | + echo "Connect to opensky source (".$host.")...\n"; |
|
| 258 | + } |
|
| 200 | 259 | /* |
| 201 | 260 | // Disabled for now, site change source format |
| 202 | 261 | } else if (preg_match('/radarvirtuel.com\/list_aircrafts$/i',$host)) { |
@@ -213,7 +272,9 @@ discard block |
||
| 213 | 272 | //$formats[$id] = 'planeupdatefaa'; |
| 214 | 273 | $globalSources[$id]['format'] = 'planeupdatefaa'; |
| 215 | 274 | //$last_exec['planeupdatefaa'] = 0; |
| 216 | - if ($globalDebug) echo "Connect to planeUpdateFAA.php source (".$host.")...\n"; |
|
| 275 | + if ($globalDebug) { |
|
| 276 | + echo "Connect to planeUpdateFAA.php source (".$host.")...\n"; |
|
| 277 | + } |
|
| 217 | 278 | if (!isset($globalSourcesRights) || (isset($globalSourcesRights) && !$globalSourcesRights)) { |
| 218 | 279 | echo '!!! You MUST set $globalSourcesRights = TRUE in settings.php if you have the right to use this feed !!!'."\n"; |
| 219 | 280 | exit(0); |
@@ -222,37 +283,53 @@ discard block |
||
| 222 | 283 | //$formats[$id] = 'phpvmacars'; |
| 223 | 284 | $globalSources[$id]['format'] = 'phpvmacars'; |
| 224 | 285 | //$last_exec['phpvmacars'] = 0; |
| 225 | - if ($globalDebug) echo "Connect to phpvmacars source (".$host.")...\n"; |
|
| 286 | + if ($globalDebug) { |
|
| 287 | + echo "Connect to phpvmacars source (".$host.")...\n"; |
|
| 288 | + } |
|
| 226 | 289 | } else if (preg_match('/\/api\/v1\/acars\/data$/i',$host)) { |
| 227 | 290 | //$formats[$id] = 'phpvmacars'; |
| 228 | 291 | $globalSources[$id]['format'] = 'vaos'; |
| 229 | 292 | //$last_exec['phpvmacars'] = 0; |
| 230 | - if ($globalDebug) echo "Connect to vaos source (".$host.")...\n"; |
|
| 293 | + if ($globalDebug) { |
|
| 294 | + echo "Connect to vaos source (".$host.")...\n"; |
|
| 295 | + } |
|
| 231 | 296 | } else if (preg_match('/VAM-json.php$/i',$host)) { |
| 232 | 297 | //$formats[$id] = 'phpvmacars'; |
| 233 | 298 | $globalSources[$id]['format'] = 'vam'; |
| 234 | - if ($globalDebug) echo "Connect to Vam source (".$host.")...\n"; |
|
| 299 | + if ($globalDebug) { |
|
| 300 | + echo "Connect to Vam source (".$host.")...\n"; |
|
| 301 | + } |
|
| 235 | 302 | } else if (preg_match('/whazzup/i',$host)) { |
| 236 | 303 | //$formats[$id] = 'whazzup'; |
| 237 | 304 | $globalSources[$id]['format'] = 'whazzup'; |
| 238 | 305 | //$last_exec['whazzup'] = 0; |
| 239 | - if ($globalDebug) echo "Connect to whazzup source (".$host.")...\n"; |
|
| 306 | + if ($globalDebug) { |
|
| 307 | + echo "Connect to whazzup source (".$host.")...\n"; |
|
| 308 | + } |
|
| 240 | 309 | } else if (preg_match('/blitzortung/i',$host)) { |
| 241 | 310 | $globalSources[$id]['format'] = 'blitzortung'; |
| 242 | - if ($globalDebug) echo "Connect to blitzortung source (".$host.")...\n"; |
|
| 311 | + if ($globalDebug) { |
|
| 312 | + echo "Connect to blitzortung source (".$host.")...\n"; |
|
| 313 | + } |
|
| 243 | 314 | } else if (preg_match('/airwhere/i',$host)) { |
| 244 | 315 | $globalSources[$id]['format'] = 'airwhere'; |
| 245 | - if ($globalDebug) echo "Connect to airwhere source (".$host.")...\n"; |
|
| 316 | + if ($globalDebug) { |
|
| 317 | + echo "Connect to airwhere source (".$host.")...\n"; |
|
| 318 | + } |
|
| 246 | 319 | } else if (preg_match('/recentpireps/i',$host)) { |
| 247 | 320 | //$formats[$id] = 'pirepsjson'; |
| 248 | 321 | $globalSources[$id]['format'] = 'pirepsjson'; |
| 249 | 322 | //$last_exec['pirepsjson'] = 0; |
| 250 | - if ($globalDebug) echo "Connect to pirepsjson source (".$host.")...\n"; |
|
| 323 | + if ($globalDebug) { |
|
| 324 | + echo "Connect to pirepsjson source (".$host.")...\n"; |
|
| 325 | + } |
|
| 251 | 326 | } else if (preg_match(':data.fr24.com/zones/fcgi/feed.js:i',$host)) { |
| 252 | 327 | //$formats[$id] = 'fr24json'; |
| 253 | 328 | $globalSources[$id]['format'] = 'fr24json'; |
| 254 | 329 | //$last_exec['fr24json'] = 0; |
| 255 | - if ($globalDebug) echo "Connect to fr24 source (".$host.")...\n"; |
|
| 330 | + if ($globalDebug) { |
|
| 331 | + echo "Connect to fr24 source (".$host.")...\n"; |
|
| 332 | + } |
|
| 256 | 333 | if (!isset($globalSourcesRights) || (isset($globalSourcesRights) && !$globalSourcesRights)) { |
| 257 | 334 | echo '!!! You MUST set $globalSourcesRights = TRUE in settings.php if you have the right to use this feed !!!'."\n"; |
| 258 | 335 | exit(0); |
@@ -261,7 +338,9 @@ discard block |
||
| 261 | 338 | //$formats[$id] = 'fr24json'; |
| 262 | 339 | $globalSources[$id]['format'] = 'myshiptracking'; |
| 263 | 340 | //$last_exec['fr24json'] = 0; |
| 264 | - if ($globalDebug) echo "Connect to myshiptracking source (".$host.")...\n"; |
|
| 341 | + if ($globalDebug) { |
|
| 342 | + echo "Connect to myshiptracking source (".$host.")...\n"; |
|
| 343 | + } |
|
| 265 | 344 | if (!isset($globalSourcesRights) || (isset($globalSourcesRights) && !$globalSourcesRights)) { |
| 266 | 345 | echo '!!! You MUST set $globalSourcesRights = TRUE in settings.php if you have the right to use this feed !!!'."\n"; |
| 267 | 346 | exit(0); |
@@ -270,17 +349,26 @@ discard block |
||
| 270 | 349 | } else if (preg_match('/10001/',$host) || (isset($globalSources[$id]['port']) && $globalSources[$id]['port'] == '10001')) { |
| 271 | 350 | //$formats[$id] = 'tsv'; |
| 272 | 351 | $globalSources[$id]['format'] = 'tsv'; |
| 273 | - if ($globalDebug) echo "Connect to tsv source (".$host.")...\n"; |
|
| 352 | + if ($globalDebug) { |
|
| 353 | + echo "Connect to tsv source (".$host.")...\n"; |
|
| 354 | + } |
|
| 274 | 355 | } |
| 275 | 356 | } elseif (filter_var($host,FILTER_VALIDATE_URL) || (isset($globalSources[$id]['format']) && $globalSources[$id]['format'] == 'sailaway') || (isset($globalSources[$id]['format']) && $globalSources[$id]['format'] == 'acarsjson')) { |
| 276 | 357 | if ($globalSources[$id]['format'] == 'aisnmeahttp' || $globalSources[$id]['format'] == 'acarsjson') { |
| 277 | 358 | $idf = fopen($globalSources[$id]['host'],'r',false,$context); |
| 278 | 359 | if ($idf !== false) { |
| 279 | 360 | $httpfeeds[$id] = $idf; |
| 280 | - if ($globalDebug) echo "Connected to ".$globalSources[$id]['format']." source (".$host.")...\n"; |
|
| 281 | - } elseif ($globalDebug) echo "Can't connect to ".$globalSources[$id]['host']."\n"; |
|
| 282 | - } elseif ($globalDebug && isset($globalSources[$id]['format']) && $globalSources[$id]['format'] == 'sailaway') echo "Connect to ".$globalSources[$id]['format']." source (sailaway)...\n"; |
|
| 283 | - elseif ($globalDebug) echo "Connect to ".$globalSources[$id]['format']." source (".$host.")...\n"; |
|
| 361 | + if ($globalDebug) { |
|
| 362 | + echo "Connected to ".$globalSources[$id]['format']." source (".$host.")...\n"; |
|
| 363 | + } |
|
| 364 | + } elseif ($globalDebug) { |
|
| 365 | + echo "Can't connect to ".$globalSources[$id]['host']."\n"; |
|
| 366 | + } |
|
| 367 | + } elseif ($globalDebug && isset($globalSources[$id]['format']) && $globalSources[$id]['format'] == 'sailaway') { |
|
| 368 | + echo "Connect to ".$globalSources[$id]['format']." source (sailaway)...\n"; |
|
| 369 | + } elseif ($globalDebug) { |
|
| 370 | + echo "Connect to ".$globalSources[$id]['format']." source (".$host.")...\n"; |
|
| 371 | + } |
|
| 284 | 372 | } elseif (!filter_var($host,FILTER_VALIDATE_URL)) { |
| 285 | 373 | $hostport = explode(':',$host); |
| 286 | 374 | if (isset($hostport[1])) { |
@@ -320,19 +408,27 @@ discard block |
||
| 320 | 408 | //$formats[$id] = 'beast'; |
| 321 | 409 | $globalSources[$id]['format'] = 'beast'; |
| 322 | 410 | //} else $formats[$id] = 'sbs'; |
| 323 | - } else $globalSources[$id]['format'] = 'sbs'; |
|
| 411 | + } else { |
|
| 412 | + $globalSources[$id]['format'] = 'sbs'; |
|
| 413 | + } |
|
| 324 | 414 | //if ($globalDebug) echo 'Connection in progress to '.$host.'('.$formats[$id].')....'."\n"; |
| 325 | 415 | } |
| 326 | - if ($globalDebug) echo 'Connection in progress to '.$hostn.':'.$port.' ('.$globalSources[$id]['format'].')....'."\n"; |
|
| 416 | + if ($globalDebug) { |
|
| 417 | + echo 'Connection in progress to '.$hostn.':'.$port.' ('.$globalSources[$id]['format'].')....'."\n"; |
|
| 418 | + } |
|
| 327 | 419 | } else { |
| 328 | - if ($globalDebug) echo 'Connection failed to '.$hostn.':'.$port.' : '.$errno.' '.$errstr."\n"; |
|
| 420 | + if ($globalDebug) { |
|
| 421 | + echo 'Connection failed to '.$hostn.':'.$port.' : '.$errno.' '.$errstr."\n"; |
|
| 422 | + } |
|
| 329 | 423 | sleep(10); |
| 330 | 424 | connect_all($hosts); |
| 331 | 425 | } |
| 332 | 426 | } |
| 333 | 427 | } |
| 334 | 428 | } |
| 335 | -if (!isset($globalMinFetch)) $globalMinFetch = 15; |
|
| 429 | +if (!isset($globalMinFetch)) { |
|
| 430 | + $globalMinFetch = 15; |
|
| 431 | +} |
|
| 336 | 432 | |
| 337 | 433 | // Initialize all |
| 338 | 434 | $status = array(); |
@@ -341,13 +437,19 @@ discard block |
||
| 341 | 437 | $formats = array(); |
| 342 | 438 | $last_exec = array(); |
| 343 | 439 | $time = time(); |
| 344 | -if (isset($globalSourcesTimeout)) $timeout = $globalSourcesTimeOut; |
|
| 345 | -else if (isset($globalSBS1TimeOut)) $timeout = $globalSBS1TimeOut; |
|
| 346 | -else $timeout = 20; |
|
| 440 | +if (isset($globalSourcesTimeout)) { |
|
| 441 | + $timeout = $globalSourcesTimeOut; |
|
| 442 | +} else if (isset($globalSBS1TimeOut)) { |
|
| 443 | + $timeout = $globalSBS1TimeOut; |
|
| 444 | +} else { |
|
| 445 | + $timeout = 20; |
|
| 446 | +} |
|
| 347 | 447 | $errno = ''; |
| 348 | 448 | $errstr=''; |
| 349 | 449 | |
| 350 | -if (!isset($globalDaemon)) $globalDaemon = TRUE; |
|
| 450 | +if (!isset($globalDaemon)) { |
|
| 451 | + $globalDaemon = TRUE; |
|
| 452 | +} |
|
| 351 | 453 | /* Initiate connections to all the hosts simultaneously */ |
| 352 | 454 | //connect_all($hosts); |
| 353 | 455 | //connect_all($globalSources); |
@@ -376,7 +478,9 @@ discard block |
||
| 376 | 478 | if (isset($source['format']) && $source['format'] == 'aprs') { |
| 377 | 479 | $aprs_connect = 0; |
| 378 | 480 | $use_aprs = true; |
| 379 | - if (isset($source['port']) && $source['port'] == '10152') $aprs_full = true; |
|
| 481 | + if (isset($source['port']) && $source['port'] == '10152') { |
|
| 482 | + $aprs_full = true; |
|
| 483 | + } |
|
| 380 | 484 | break; |
| 381 | 485 | } |
| 382 | 486 | } |
@@ -387,25 +491,46 @@ discard block |
||
| 387 | 491 | $aprs_connect = 0; |
| 388 | 492 | $aprs_keep = 120; |
| 389 | 493 | $aprs_last_tx = time(); |
| 390 | - if (isset($globalAPRSversion)) $aprs_version = $globalAPRSversion; |
|
| 391 | - else $aprs_version = 'FlightAirMap '.str_replace(' ','_',$globalName); |
|
| 392 | - if (isset($globalAPRSssid)) $aprs_ssid = $globalAPRSssid; |
|
| 393 | - else $aprs_ssid = substr('FAM'.strtoupper(str_replace(' ','_',$globalName)),0,8); |
|
| 394 | - if (isset($globalAPRSfilter)) $aprs_filter = $globalAPRSfilter; |
|
| 395 | - else $aprs_filter = 'r/'.$globalCenterLatitude.'/'.$globalCenterLongitude.'/250.0'; |
|
| 396 | - if ($aprs_full) $aprs_filter = ''; |
|
| 397 | - if (isset($globalAPRSpass)) $aprs_pass = $globalAPRSpass; |
|
| 398 | - else $aprs_pass = '-1'; |
|
| 494 | + if (isset($globalAPRSversion)) { |
|
| 495 | + $aprs_version = $globalAPRSversion; |
|
| 496 | + } else { |
|
| 497 | + $aprs_version = 'FlightAirMap '.str_replace(' ','_',$globalName); |
|
| 498 | + } |
|
| 499 | + if (isset($globalAPRSssid)) { |
|
| 500 | + $aprs_ssid = $globalAPRSssid; |
|
| 501 | + } else { |
|
| 502 | + $aprs_ssid = substr('FAM'.strtoupper(str_replace(' ','_',$globalName)),0,8); |
|
| 503 | + } |
|
| 504 | + if (isset($globalAPRSfilter)) { |
|
| 505 | + $aprs_filter = $globalAPRSfilter; |
|
| 506 | + } else { |
|
| 507 | + $aprs_filter = 'r/'.$globalCenterLatitude.'/'.$globalCenterLongitude.'/250.0'; |
|
| 508 | + } |
|
| 509 | + if ($aprs_full) { |
|
| 510 | + $aprs_filter = ''; |
|
| 511 | + } |
|
| 512 | + if (isset($globalAPRSpass)) { |
|
| 513 | + $aprs_pass = $globalAPRSpass; |
|
| 514 | + } else { |
|
| 515 | + $aprs_pass = '-1'; |
|
| 516 | + } |
|
| 399 | 517 | |
| 400 | - if ($aprs_filter != '') $aprs_login = "user {$aprs_ssid} pass {$aprs_pass} vers {$aprs_version} filter {$aprs_filter}\n"; |
|
| 401 | - else $aprs_login = "user {$aprs_ssid} pass {$aprs_pass} vers {$aprs_version}\n"; |
|
| 402 | -} |
|
| 518 | + if ($aprs_filter != '') { |
|
| 519 | + $aprs_login = "user {$aprs_ssid} pass {$aprs_pass} vers {$aprs_version} filter {$aprs_filter}\n"; |
|
| 520 | + } else { |
|
| 521 | + $aprs_login = "user {$aprs_ssid} pass {$aprs_pass} vers {$aprs_version}\n"; |
|
| 522 | + } |
|
| 523 | + } |
|
| 403 | 524 | |
| 404 | 525 | // connected - lets do some work |
| 405 | 526 | //if ($globalDebug) echo "Connected!\n"; |
| 406 | 527 | sleep(1); |
| 407 | -if ($globalDebug) echo "SCAN MODE \n\n"; |
|
| 408 | -if (!isset($globalCronEnd)) $globalCronEnd = 60; |
|
| 528 | +if ($globalDebug) { |
|
| 529 | + echo "SCAN MODE \n\n"; |
|
| 530 | +} |
|
| 531 | +if (!isset($globalCronEnd)) { |
|
| 532 | + $globalCronEnd = 60; |
|
| 533 | +} |
|
| 409 | 534 | $endtime = time()+$globalCronEnd; |
| 410 | 535 | $i = 1; |
| 411 | 536 | $tt = array(); |
@@ -419,22 +544,32 @@ discard block |
||
| 419 | 544 | |
| 420 | 545 | // Infinite loop if daemon, else work for time defined in $globalCronEnd or only one time. |
| 421 | 546 | while ($i > 0) { |
| 422 | - if (function_exists('pcntl_fork')) pcntl_signal_dispatch(); |
|
| 547 | + if (function_exists('pcntl_fork')) { |
|
| 548 | + pcntl_signal_dispatch(); |
|
| 549 | + } |
|
| 423 | 550 | |
| 424 | - if (!$globalDaemon) $i = $endtime-time(); |
|
| 551 | + if (!$globalDaemon) { |
|
| 552 | + $i = $endtime-time(); |
|
| 553 | + } |
|
| 425 | 554 | // Delete old ATC |
| 426 | 555 | if ($globalDaemon && ((isset($globalVA) && $globalVA) || (isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM))) { |
| 427 | - if ($globalDebug) echo 'Delete old ATC...'."\n"; |
|
| 556 | + if ($globalDebug) { |
|
| 557 | + echo 'Delete old ATC...'."\n"; |
|
| 558 | + } |
|
| 428 | 559 | $ATC->deleteOldATC(); |
| 429 | 560 | } |
| 430 | 561 | |
| 431 | 562 | if (count($last_exec) == count($globalSources)) { |
| 432 | 563 | $max = $globalMinFetch; |
| 433 | 564 | foreach ($last_exec as $last) { |
| 434 | - if ((time() - $last['last']) < $max) $max = time() - $last['last']; |
|
| 565 | + if ((time() - $last['last']) < $max) { |
|
| 566 | + $max = time() - $last['last']; |
|
| 567 | + } |
|
| 435 | 568 | } |
| 436 | 569 | if ($max < $globalMinFetch) { |
| 437 | - if ($globalDebug) echo 'Sleeping...'."\n"; |
|
| 570 | + if ($globalDebug) { |
|
| 571 | + echo 'Sleeping...'."\n"; |
|
| 572 | + } |
|
| 438 | 573 | sleep($globalMinFetch-$max+2); |
| 439 | 574 | } |
| 440 | 575 | } |
@@ -444,7 +579,9 @@ discard block |
||
| 444 | 579 | foreach ($globalSources as $id => $value) { |
| 445 | 580 | date_default_timezone_set('UTC'); |
| 446 | 581 | //if ($globalDebug) echo 'Source host : '.$value['host'].' - Source format: '.$value['format']."\n"; |
| 447 | - if (!isset($last_exec[$id]['last'])) $last_exec[$id]['last'] = 0; |
|
| 582 | + if (!isset($last_exec[$id]['last'])) { |
|
| 583 | + $last_exec[$id]['last'] = 0; |
|
| 584 | + } |
|
| 448 | 585 | if ($value['format'] === 'deltadbtxt' && |
| 449 | 586 | ( |
| 450 | 587 | (isset($globalSources[$id]['minfetch']) && (time() - $last_exec[$id]['last'] > $globalSources[$id]['minfetch'])) || |
@@ -453,7 +590,9 @@ discard block |
||
| 453 | 590 | ) { |
| 454 | 591 | //$buffer = $Common->getData($hosts[$id]); |
| 455 | 592 | $buffer = $Common->getData($value['host']); |
| 456 | - if ($buffer != '') $reset = 0; |
|
| 593 | + if ($buffer != '') { |
|
| 594 | + $reset = 0; |
|
| 595 | + } |
|
| 457 | 596 | $buffer=trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'\n',$buffer)); |
| 458 | 597 | $buffer = explode('\n',$buffer); |
| 459 | 598 | foreach ($buffer as $line) { |
@@ -462,20 +601,41 @@ discard block |
||
| 462 | 601 | $data = array(); |
| 463 | 602 | $data['hex'] = $line[1]; // hex |
| 464 | 603 | $data['ident'] = $line[2]; // ident |
| 465 | - if (isset($line[3])) $data['altitude'] = $line[3]; // altitude |
|
| 466 | - if (isset($line[4])) $data['speed'] = $line[4]; // speed |
|
| 467 | - if (isset($line[5])) $data['heading'] = $line[5]; // heading |
|
| 468 | - if (isset($line[6])) $data['latitude'] = $line[6]; // lat |
|
| 469 | - if (isset($line[7])) $data['longitude'] = $line[7]; // long |
|
| 604 | + if (isset($line[3])) { |
|
| 605 | + $data['altitude'] = $line[3]; |
|
| 606 | + } |
|
| 607 | + // altitude |
|
| 608 | + if (isset($line[4])) { |
|
| 609 | + $data['speed'] = $line[4]; |
|
| 610 | + } |
|
| 611 | + // speed |
|
| 612 | + if (isset($line[5])) { |
|
| 613 | + $data['heading'] = $line[5]; |
|
| 614 | + } |
|
| 615 | + // heading |
|
| 616 | + if (isset($line[6])) { |
|
| 617 | + $data['latitude'] = $line[6]; |
|
| 618 | + } |
|
| 619 | + // lat |
|
| 620 | + if (isset($line[7])) { |
|
| 621 | + $data['longitude'] = $line[7]; |
|
| 622 | + } |
|
| 623 | + // long |
|
| 470 | 624 | $data['verticalrate'] = ''; // vertical rate |
| 471 | 625 | //if (isset($line[9])) $data['squawk'] = $line[9]; // squawk |
| 472 | 626 | $data['emergency'] = ''; // emergency |
| 473 | 627 | $data['datetime'] = date('Y-m-d H:i:s'); |
| 474 | 628 | $data['format_source'] = 'deltadbtxt'; |
| 475 | 629 | $data['id_source'] = $id_source; |
| 476 | - if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name']; |
|
| 477 | - if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true; |
|
| 478 | - if (isset($value['sourcestats'])) $data['sourcestats'] = $value['sourcestats']; |
|
| 630 | + if (isset($value['name']) && $value['name'] != '') { |
|
| 631 | + $data['source_name'] = $value['name']; |
|
| 632 | + } |
|
| 633 | + if (isset($value['noarchive']) && $value['noarchive'] === TRUE) { |
|
| 634 | + $data['noarchive'] = true; |
|
| 635 | + } |
|
| 636 | + if (isset($value['sourcestats'])) { |
|
| 637 | + $data['sourcestats'] = $value['sourcestats']; |
|
| 638 | + } |
|
| 479 | 639 | $SI->add($data); |
| 480 | 640 | unset($data); |
| 481 | 641 | } |
@@ -490,7 +650,9 @@ discard block |
||
| 490 | 650 | date_default_timezone_set('CET'); |
| 491 | 651 | $buffer = $Common->getData(str_replace('{date}',date('Ymd'),$value['host'])); |
| 492 | 652 | date_default_timezone_set('UTC'); |
| 493 | - if ($buffer != '') $reset = 0; |
|
| 653 | + if ($buffer != '') { |
|
| 654 | + $reset = 0; |
|
| 655 | + } |
|
| 494 | 656 | $buffer=trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'\n',$buffer)); |
| 495 | 657 | $buffer = explode('\n',$buffer); |
| 496 | 658 | foreach ($buffer as $line) { |
@@ -499,18 +661,42 @@ discard block |
||
| 499 | 661 | $add = false; |
| 500 | 662 | $ais_data = $AIS->parse_line(trim($line)); |
| 501 | 663 | $data = array(); |
| 502 | - if (isset($ais_data['ident'])) $data['ident'] = $ais_data['ident']; |
|
| 503 | - if (isset($ais_data['mmsi'])) $data['mmsi'] = substr($ais_data['mmsi'],-9); |
|
| 504 | - if (isset($ais_data['speed'])) $data['speed'] = $ais_data['speed']; |
|
| 505 | - if (isset($ais_data['heading'])) $data['heading'] = $ais_data['heading']; |
|
| 506 | - if (isset($ais_data['latitude'])) $data['latitude'] = $ais_data['latitude']; |
|
| 507 | - if (isset($ais_data['longitude'])) $data['longitude'] = $ais_data['longitude']; |
|
| 508 | - if (isset($ais_data['status'])) $data['status'] = $ais_data['status']; |
|
| 509 | - if (isset($ais_data['statusid'])) $data['status_id'] = $ais_data['statusid']; |
|
| 510 | - if (isset($ais_data['type'])) $data['type'] = $ais_data['type']; |
|
| 511 | - if (isset($ais_data['typeid'])) $data['type_id'] = $ais_data['typeid']; |
|
| 512 | - if (isset($ais_data['imo'])) $data['imo'] = $ais_data['imo']; |
|
| 513 | - if (isset($ais_data['callsign'])) $data['callsign'] = $ais_data['callsign']; |
|
| 664 | + if (isset($ais_data['ident'])) { |
|
| 665 | + $data['ident'] = $ais_data['ident']; |
|
| 666 | + } |
|
| 667 | + if (isset($ais_data['mmsi'])) { |
|
| 668 | + $data['mmsi'] = substr($ais_data['mmsi'],-9); |
|
| 669 | + } |
|
| 670 | + if (isset($ais_data['speed'])) { |
|
| 671 | + $data['speed'] = $ais_data['speed']; |
|
| 672 | + } |
|
| 673 | + if (isset($ais_data['heading'])) { |
|
| 674 | + $data['heading'] = $ais_data['heading']; |
|
| 675 | + } |
|
| 676 | + if (isset($ais_data['latitude'])) { |
|
| 677 | + $data['latitude'] = $ais_data['latitude']; |
|
| 678 | + } |
|
| 679 | + if (isset($ais_data['longitude'])) { |
|
| 680 | + $data['longitude'] = $ais_data['longitude']; |
|
| 681 | + } |
|
| 682 | + if (isset($ais_data['status'])) { |
|
| 683 | + $data['status'] = $ais_data['status']; |
|
| 684 | + } |
|
| 685 | + if (isset($ais_data['statusid'])) { |
|
| 686 | + $data['status_id'] = $ais_data['statusid']; |
|
| 687 | + } |
|
| 688 | + if (isset($ais_data['type'])) { |
|
| 689 | + $data['type'] = $ais_data['type']; |
|
| 690 | + } |
|
| 691 | + if (isset($ais_data['typeid'])) { |
|
| 692 | + $data['type_id'] = $ais_data['typeid']; |
|
| 693 | + } |
|
| 694 | + if (isset($ais_data['imo'])) { |
|
| 695 | + $data['imo'] = $ais_data['imo']; |
|
| 696 | + } |
|
| 697 | + if (isset($ais_data['callsign'])) { |
|
| 698 | + $data['callsign'] = $ais_data['callsign']; |
|
| 699 | + } |
|
| 514 | 700 | if (isset($ais_data['timestamp'])) { |
| 515 | 701 | $data['datetime'] = date('Y-m-d H:i:s',$ais_data['timestamp']); |
| 516 | 702 | if (!isset($last_exec[$id]['timestamp']) || $ais_data['timestamp'] >= $last_exec[$id]['timestamp']) { |
@@ -524,8 +710,12 @@ discard block |
||
| 524 | 710 | $data['format_source'] = 'aisnmeatxt'; |
| 525 | 711 | $data['id_source'] = $id_source; |
| 526 | 712 | //print_r($data); |
| 527 | - if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true; |
|
| 528 | - if ($add && isset($ais_data['mmsi_type']) && $ais_data['mmsi_type'] === 'Ship') $MI->add($data); |
|
| 713 | + if (isset($value['noarchive']) && $value['noarchive'] === TRUE) { |
|
| 714 | + $data['noarchive'] = true; |
|
| 715 | + } |
|
| 716 | + if ($add && isset($ais_data['mmsi_type']) && $ais_data['mmsi_type'] === 'Ship') { |
|
| 717 | + $MI->add($data); |
|
| 718 | + } |
|
| 529 | 719 | unset($data); |
| 530 | 720 | } |
| 531 | 721 | } |
@@ -548,20 +738,48 @@ discard block |
||
| 548 | 738 | if ($line != '') { |
| 549 | 739 | $ais_data = $AIS->parse_line(trim($line)); |
| 550 | 740 | $data = array(); |
| 551 | - if (isset($ais_data['ident'])) $data['ident'] = $ais_data['ident']; |
|
| 552 | - if (isset($ais_data['mmsi'])) $data['mmsi'] = substr($ais_data['mmsi'],-9); |
|
| 553 | - if (isset($ais_data['speed'])) $data['speed'] = $ais_data['speed']; |
|
| 554 | - if (isset($ais_data['heading'])) $data['heading'] = $ais_data['heading']; |
|
| 555 | - if (isset($ais_data['latitude'])) $data['latitude'] = $ais_data['latitude']; |
|
| 556 | - if (isset($ais_data['longitude'])) $data['longitude'] = $ais_data['longitude']; |
|
| 557 | - if (isset($ais_data['status'])) $data['status'] = $ais_data['status']; |
|
| 558 | - if (isset($ais_data['statusid'])) $data['status_id'] = $ais_data['statusid']; |
|
| 559 | - if (isset($ais_data['type'])) $data['type'] = $ais_data['type']; |
|
| 560 | - if (isset($ais_data['typeid'])) $data['type_id'] = $ais_data['typeid']; |
|
| 561 | - if (isset($ais_data['imo'])) $data['imo'] = $ais_data['imo']; |
|
| 562 | - if (isset($ais_data['callsign'])) $data['callsign'] = $ais_data['callsign']; |
|
| 563 | - if (isset($ais_data['destination'])) $data['arrival_code'] = $ais_data['destination']; |
|
| 564 | - if (isset($ais_data['eta_ts'])) $data['arrival_date'] = date('Y-m-d H:i:s',$ais_data['eta_ts']); |
|
| 741 | + if (isset($ais_data['ident'])) { |
|
| 742 | + $data['ident'] = $ais_data['ident']; |
|
| 743 | + } |
|
| 744 | + if (isset($ais_data['mmsi'])) { |
|
| 745 | + $data['mmsi'] = substr($ais_data['mmsi'],-9); |
|
| 746 | + } |
|
| 747 | + if (isset($ais_data['speed'])) { |
|
| 748 | + $data['speed'] = $ais_data['speed']; |
|
| 749 | + } |
|
| 750 | + if (isset($ais_data['heading'])) { |
|
| 751 | + $data['heading'] = $ais_data['heading']; |
|
| 752 | + } |
|
| 753 | + if (isset($ais_data['latitude'])) { |
|
| 754 | + $data['latitude'] = $ais_data['latitude']; |
|
| 755 | + } |
|
| 756 | + if (isset($ais_data['longitude'])) { |
|
| 757 | + $data['longitude'] = $ais_data['longitude']; |
|
| 758 | + } |
|
| 759 | + if (isset($ais_data['status'])) { |
|
| 760 | + $data['status'] = $ais_data['status']; |
|
| 761 | + } |
|
| 762 | + if (isset($ais_data['statusid'])) { |
|
| 763 | + $data['status_id'] = $ais_data['statusid']; |
|
| 764 | + } |
|
| 765 | + if (isset($ais_data['type'])) { |
|
| 766 | + $data['type'] = $ais_data['type']; |
|
| 767 | + } |
|
| 768 | + if (isset($ais_data['typeid'])) { |
|
| 769 | + $data['type_id'] = $ais_data['typeid']; |
|
| 770 | + } |
|
| 771 | + if (isset($ais_data['imo'])) { |
|
| 772 | + $data['imo'] = $ais_data['imo']; |
|
| 773 | + } |
|
| 774 | + if (isset($ais_data['callsign'])) { |
|
| 775 | + $data['callsign'] = $ais_data['callsign']; |
|
| 776 | + } |
|
| 777 | + if (isset($ais_data['destination'])) { |
|
| 778 | + $data['arrival_code'] = $ais_data['destination']; |
|
| 779 | + } |
|
| 780 | + if (isset($ais_data['eta_ts'])) { |
|
| 781 | + $data['arrival_date'] = date('Y-m-d H:i:s',$ais_data['eta_ts']); |
|
| 782 | + } |
|
| 565 | 783 | if (isset($ais_data['timestamp'])) { |
| 566 | 784 | $data['datetime'] = date('Y-m-d H:i:s',$ais_data['timestamp']); |
| 567 | 785 | } else { |
@@ -569,18 +787,27 @@ discard block |
||
| 569 | 787 | } |
| 570 | 788 | $data['format_source'] = 'aisnmeahttp'; |
| 571 | 789 | $data['id_source'] = $id_source; |
| 572 | - if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true; |
|
| 573 | - if (isset($ais_data['mmsi_type']) && $ais_data['mmsi_type'] === 'Ship') $MI->add($data); |
|
| 790 | + if (isset($value['noarchive']) && $value['noarchive'] === TRUE) { |
|
| 791 | + $data['noarchive'] = true; |
|
| 792 | + } |
|
| 793 | + if (isset($ais_data['mmsi_type']) && $ais_data['mmsi_type'] === 'Ship') { |
|
| 794 | + $MI->add($data); |
|
| 795 | + } |
|
| 574 | 796 | unset($data); |
| 575 | 797 | } |
| 576 | 798 | } |
| 577 | 799 | } |
| 578 | 800 | } else { |
| 579 | 801 | $format = $value['format']; |
| 580 | - if (isset($tt[$format])) $tt[$format]++; |
|
| 581 | - else $tt[$format] = 0; |
|
| 802 | + if (isset($tt[$format])) { |
|
| 803 | + $tt[$format]++; |
|
| 804 | + } else { |
|
| 805 | + $tt[$format] = 0; |
|
| 806 | + } |
|
| 582 | 807 | if ($tt[$format] > 30) { |
| 583 | - if ($globalDebug) echo 'Reconnect...'."\n"; |
|
| 808 | + if ($globalDebug) { |
|
| 809 | + echo 'Reconnect...'."\n"; |
|
| 810 | + } |
|
| 584 | 811 | sleep(2); |
| 585 | 812 | //$sourceeen[] = $value; |
| 586 | 813 | //connect_all($sourceeen); |
@@ -616,12 +843,18 @@ discard block |
||
| 616 | 843 | // if (isset($ais_data['type'])) $data['type'] = $ais_data['type']; |
| 617 | 844 | //$data['type_id'] = $line['TYPE']; |
| 618 | 845 | $data['imo'] = $line['IMO']; |
| 619 | - if ($line['DEST'] != '') $data['arrival_code'] = $line['DEST']; |
|
| 620 | - if ($line['ARV'] != '') $data['arrival_time'] = date('Y-m-d H:i:s',strtotime($line['ARV'])); |
|
| 846 | + if ($line['DEST'] != '') { |
|
| 847 | + $data['arrival_code'] = $line['DEST']; |
|
| 848 | + } |
|
| 849 | + if ($line['ARV'] != '') { |
|
| 850 | + $data['arrival_time'] = date('Y-m-d H:i:s',strtotime($line['ARV'])); |
|
| 851 | + } |
|
| 621 | 852 | $data['datetime'] = date('Y-m-d H:i:s',$line['T']); |
| 622 | 853 | $data['format_source'] = 'myshiptracking'; |
| 623 | 854 | $data['id_source'] = $id_source; |
| 624 | - if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true; |
|
| 855 | + if (isset($value['noarchive']) && $value['noarchive'] === TRUE) { |
|
| 856 | + $data['noarchive'] = true; |
|
| 857 | + } |
|
| 625 | 858 | $MI->add($data); |
| 626 | 859 | unset($data); |
| 627 | 860 | } |
@@ -646,7 +879,9 @@ discard block |
||
| 646 | 879 | $data['callsign'] = $line['callsign']; |
| 647 | 880 | $data['mmsi'] = substr($line['mmsi'],-9); |
| 648 | 881 | $data['speed'] = $line['sog']; |
| 649 | - if ($line['heading'] != '511') $data['heading'] = $line['heading']; |
|
| 882 | + if ($line['heading'] != '511') { |
|
| 883 | + $data['heading'] = $line['heading']; |
|
| 884 | + } |
|
| 650 | 885 | $data['latitude'] = $line['latitude']; |
| 651 | 886 | $data['longitude'] = $line['longitude']; |
| 652 | 887 | $data['type_id'] = $line['shiptype']; |
@@ -654,7 +889,9 @@ discard block |
||
| 654 | 889 | $data['datetime'] = $line['time']; |
| 655 | 890 | $data['format_source'] = 'boatbeaconapp'; |
| 656 | 891 | $data['id_source'] = $id_source; |
| 657 | - if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true; |
|
| 892 | + if (isset($value['noarchive']) && $value['noarchive'] === TRUE) { |
|
| 893 | + $data['noarchive'] = true; |
|
| 894 | + } |
|
| 658 | 895 | $MI->add($data); |
| 659 | 896 | unset($data); |
| 660 | 897 | } |
@@ -676,22 +913,44 @@ discard block |
||
| 676 | 913 | foreach ($all_data['features'] as $line) { |
| 677 | 914 | print_r($line); |
| 678 | 915 | $data = array(); |
| 679 | - if (isset($line['properties']['name'])) $data['ident'] = $line['properties']['name']; |
|
| 680 | - if (isset($line['properties']['callsign'])) $data['callsign'] = $line['properties']['callsign']; |
|
| 681 | - if (isset($line['properties']['mmsi'])) $data['mmsi'] = substr($line['properties']['mmsi'],-9); |
|
| 682 | - if (isset($line['properties']['imo'])) $data['imo'] = $line['properties']['imo']; |
|
| 683 | - if (isset($line['properties']['speed'])) $data['speed'] = $line['properties']['speed']; |
|
| 684 | - if (isset($line['properties']['heading']) && $line['properties']['heading'] != 0) $data['heading'] = $line['properties']['heading']; |
|
| 916 | + if (isset($line['properties']['name'])) { |
|
| 917 | + $data['ident'] = $line['properties']['name']; |
|
| 918 | + } |
|
| 919 | + if (isset($line['properties']['callsign'])) { |
|
| 920 | + $data['callsign'] = $line['properties']['callsign']; |
|
| 921 | + } |
|
| 922 | + if (isset($line['properties']['mmsi'])) { |
|
| 923 | + $data['mmsi'] = substr($line['properties']['mmsi'],-9); |
|
| 924 | + } |
|
| 925 | + if (isset($line['properties']['imo'])) { |
|
| 926 | + $data['imo'] = $line['properties']['imo']; |
|
| 927 | + } |
|
| 928 | + if (isset($line['properties']['speed'])) { |
|
| 929 | + $data['speed'] = $line['properties']['speed']; |
|
| 930 | + } |
|
| 931 | + if (isset($line['properties']['heading']) && $line['properties']['heading'] != 0) { |
|
| 932 | + $data['heading'] = $line['properties']['heading']; |
|
| 933 | + } |
|
| 685 | 934 | $data['latitude'] = $line['geometry']['coordinates'][1]; |
| 686 | 935 | $data['longitude'] = $line['geometry']['coordinates'][0]; |
| 687 | - if (isset($line['properties']['vesselType'])) $data['type'] = $line['properties']['vesselType']; |
|
| 688 | - if (isset($line['properties']['destination'])) $data['arrival_code'] = $line['properties']['destination']; |
|
| 689 | - if (isset($line['properties']['eta']) && $line['properties']['eta'] != '') $data['arrival_date'] = $line['properties']['eta']; |
|
| 936 | + if (isset($line['properties']['vesselType'])) { |
|
| 937 | + $data['type'] = $line['properties']['vesselType']; |
|
| 938 | + } |
|
| 939 | + if (isset($line['properties']['destination'])) { |
|
| 940 | + $data['arrival_code'] = $line['properties']['destination']; |
|
| 941 | + } |
|
| 942 | + if (isset($line['properties']['eta']) && $line['properties']['eta'] != '') { |
|
| 943 | + $data['arrival_date'] = $line['properties']['eta']; |
|
| 944 | + } |
|
| 690 | 945 | $data['format_source'] = 'boatnerd'; |
| 691 | 946 | $data['id_source'] = $id_source; |
| 692 | 947 | $data['datetime'] = date('Y-m-d H:i:s'); |
| 693 | - if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true; |
|
| 694 | - if ($line['properties']['vesselType'] != 'Navigation Aid') $MI->add($data); |
|
| 948 | + if (isset($value['noarchive']) && $value['noarchive'] === TRUE) { |
|
| 949 | + $data['noarchive'] = true; |
|
| 950 | + } |
|
| 951 | + if ($line['properties']['vesselType'] != 'Navigation Aid') { |
|
| 952 | + $MI->add($data); |
|
| 953 | + } |
|
| 695 | 954 | unset($data); |
| 696 | 955 | } |
| 697 | 956 | } |
@@ -704,11 +963,17 @@ discard block |
||
| 704 | 963 | (!isset($globalSources[$id]['minfetch']) && (time() - $last_exec[$id]['last'] > $globalMinFetch*3)) |
| 705 | 964 | ) |
| 706 | 965 | ) { |
| 707 | - if ($globalDebug) echo 'download...'; |
|
| 966 | + if ($globalDebug) { |
|
| 967 | + echo 'download...'; |
|
| 968 | + } |
|
| 708 | 969 | $buffer = $Common->getData($value['host'],'post',$value['post'],'','','','','ShipPlotter'); |
| 709 | - if ($globalDebug) echo 'done !'."\n"; |
|
| 970 | + if ($globalDebug) { |
|
| 971 | + echo 'done !'."\n"; |
|
| 972 | + } |
|
| 710 | 973 | // FIXME: Need more work |
| 711 | - if ($buffer != '') $reset = 0; |
|
| 974 | + if ($buffer != '') { |
|
| 975 | + $reset = 0; |
|
| 976 | + } |
|
| 712 | 977 | $buffer=trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'\n',$buffer)); |
| 713 | 978 | $buffer = explode('\n',$buffer); |
| 714 | 979 | foreach ($buffer as $line) { |
@@ -734,7 +999,9 @@ discard block |
||
| 734 | 999 | //$data['etaTime'] = substr($line,135,5); |
| 735 | 1000 | $data['format_source'] = 'shipplotter'; |
| 736 | 1001 | $data['id_source'] = $id_source; |
| 737 | - if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true; |
|
| 1002 | + if (isset($value['noarchive']) && $value['noarchive'] === TRUE) { |
|
| 1003 | + $data['noarchive'] = true; |
|
| 1004 | + } |
|
| 738 | 1005 | //print_r($data); |
| 739 | 1006 | //echo 'Add...'."\n"; |
| 740 | 1007 | $MI->add($data); |
@@ -757,11 +1024,17 @@ discard block |
||
| 757 | 1024 | } |
| 758 | 1025 | } |
| 759 | 1026 | |
| 760 | - if ($globalDebug) echo '! Download... '; |
|
| 1027 | + if ($globalDebug) { |
|
| 1028 | + echo '! Download... '; |
|
| 1029 | + } |
|
| 761 | 1030 | for ($i =0; $i <= 1; $i++) { |
| 762 | - if ($globalDebug) echo 'Racetype: '.$i.' '; |
|
| 1031 | + if ($globalDebug) { |
|
| 1032 | + echo 'Racetype: '.$i.' '; |
|
| 1033 | + } |
|
| 763 | 1034 | $buffer = $Common->getData('https://sailaway.world/cgi-bin/sailaway/GetMissions.pl?race=1&tutorial=0&hist=1&racetype='.$i); |
| 764 | - if ($globalDebug) echo 'done'."\n"; |
|
| 1035 | + if ($globalDebug) { |
|
| 1036 | + echo 'done'."\n"; |
|
| 1037 | + } |
|
| 765 | 1038 | if ($buffer != '') { |
| 766 | 1039 | $all_data = json_decode($buffer,true); |
| 767 | 1040 | if (isset($all_data['missions'])) { |
@@ -769,8 +1042,11 @@ discard block |
||
| 769 | 1042 | $mission_user = $mission['usrname']; |
| 770 | 1043 | $mission_name = preg_replace('/[\x00-\x1F\x7F-\xFF]/', '',$Common->remove_accents($mission['mistitle'])); |
| 771 | 1044 | if (!isset($globalFilter['sailway']['race']) || (isset($globalFilter['sailway']['race']) && in_array($mission['misnr'],$globalFilter['sailway']['race']))) { |
| 772 | - if (isset($sailaway_authcookie) && $sailaway_authcookie != '') $racebuffer = $Common->getData('https://sailaway.world/cgi-bin/sailaway/GetMission.pl?misnr='.$mission['misnr'],'get','','',$sailaway_authcookie); |
|
| 773 | - else $racebuffer = ''; |
|
| 1045 | + if (isset($sailaway_authcookie) && $sailaway_authcookie != '') { |
|
| 1046 | + $racebuffer = $Common->getData('https://sailaway.world/cgi-bin/sailaway/GetMission.pl?misnr='.$mission['misnr'],'get','','',$sailaway_authcookie); |
|
| 1047 | + } else { |
|
| 1048 | + $racebuffer = ''; |
|
| 1049 | + } |
|
| 774 | 1050 | $bufferm = $Common->getData('https://sailaway.world/cgi-bin/sailaway/GetLeaderboard.pl?misnr='.$mission['misnr']); |
| 775 | 1051 | } else { |
| 776 | 1052 | $bufferm = ''; |
@@ -834,7 +1110,9 @@ discard block |
||
| 834 | 1110 | $data['captain_id'] = $sail['usrnr']; |
| 835 | 1111 | $data['captain_name'] = $sail['usrname']; |
| 836 | 1112 | $data['race_id'] = $sail['misnr']; |
| 837 | - if ($sail['rank'] != 'DNF') $data['race_rank'] = $sail['rank']; |
|
| 1113 | + if ($sail['rank'] != 'DNF') { |
|
| 1114 | + $data['race_rank'] = $sail['rank']; |
|
| 1115 | + } |
|
| 838 | 1116 | $data['race_time'] = $sail['racetime']; |
| 839 | 1117 | if ($mission_user != '') { |
| 840 | 1118 | $data['race_name'] = $mission_name.' ('.$mission_user.')'; |
@@ -844,7 +1122,9 @@ discard block |
||
| 844 | 1122 | //$data['callsign'] = trim(substr($line,100,7); |
| 845 | 1123 | $data['format_source'] = 'sailaway'; |
| 846 | 1124 | $data['id_source'] = $id_source; |
| 847 | - if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true; |
|
| 1125 | + if (isset($value['noarchive']) && $value['noarchive'] === TRUE) { |
|
| 1126 | + $data['noarchive'] = true; |
|
| 1127 | + } |
|
| 848 | 1128 | //print_r($data); |
| 849 | 1129 | //if ($data['race_id'] == '48') print_r($data); |
| 850 | 1130 | //echo 'Add...'."\n"; |
@@ -886,16 +1166,28 @@ discard block |
||
| 886 | 1166 | $line = explode(':', $line); |
| 887 | 1167 | if (count($line) > 30 && $line[0] != 'callsign') { |
| 888 | 1168 | $data = array(); |
| 889 | - if (isset($line[37]) && $line[37] != '') $data['id'] = $value['format'].'-'.$line[1].'-'.$line[0].'-'.$line[37]; |
|
| 890 | - else $data['id'] = $value['format'].'-'.$line[1].'-'.$line[0]; |
|
| 1169 | + if (isset($line[37]) && $line[37] != '') { |
|
| 1170 | + $data['id'] = $value['format'].'-'.$line[1].'-'.$line[0].'-'.$line[37]; |
|
| 1171 | + } else { |
|
| 1172 | + $data['id'] = $value['format'].'-'.$line[1].'-'.$line[0]; |
|
| 1173 | + } |
|
| 891 | 1174 | $data['pilot_id'] = $line[1]; |
| 892 | 1175 | $data['pilot_name'] = $line[2]; |
| 893 | 1176 | $data['hex'] = str_pad(dechex($Common->str2int($line[1])),6,'000000',STR_PAD_LEFT); |
| 894 | 1177 | $data['ident'] = $line[0]; // ident |
| 895 | - if ($line[7] != '' && $line[7] != 0) $data['altitude'] = $line[7]; // altitude |
|
| 1178 | + if ($line[7] != '' && $line[7] != 0) { |
|
| 1179 | + $data['altitude'] = $line[7]; |
|
| 1180 | + } |
|
| 1181 | + // altitude |
|
| 896 | 1182 | $data['speed'] = $line[8]; // speed |
| 897 | - if (isset($line[45])) $data['heading'] = $line[45]; // heading |
|
| 898 | - elseif (isset($line[38])) $data['heading'] = $line[38]; // heading |
|
| 1183 | + if (isset($line[45])) { |
|
| 1184 | + $data['heading'] = $line[45]; |
|
| 1185 | + } |
|
| 1186 | + // heading |
|
| 1187 | + elseif (isset($line[38])) { |
|
| 1188 | + $data['heading'] = $line[38]; |
|
| 1189 | + } |
|
| 1190 | + // heading |
|
| 899 | 1191 | $data['latitude'] = $line[5]; // lat |
| 900 | 1192 | $data['longitude'] = $line[6]; // long |
| 901 | 1193 | $data['verticalrate'] = ''; // vertical rate |
@@ -911,7 +1203,9 @@ discard block |
||
| 911 | 1203 | $data['frequency'] = $line[4]; |
| 912 | 1204 | $data['type'] = $line[18]; |
| 913 | 1205 | $data['range'] = $line[19]; |
| 914 | - if (isset($line[35])) $data['info'] = $line[35]; |
|
| 1206 | + if (isset($line[35])) { |
|
| 1207 | + $data['info'] = $line[35]; |
|
| 1208 | + } |
|
| 915 | 1209 | $data['id_source'] = $id_source; |
| 916 | 1210 | //$data['arrival_airport_time'] = ; |
| 917 | 1211 | if ($line[9] != '') { |
@@ -925,27 +1219,47 @@ discard block |
||
| 925 | 1219 | elseif ($value === 'vatsimtxt') $data['format_source'] = 'vatsimtxt'; |
| 926 | 1220 | */ |
| 927 | 1221 | $data['format_source'] = $value['format']; |
| 928 | - if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true; |
|
| 929 | - if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name']; |
|
| 930 | - if ($line[3] === 'PILOT') $SI->add($data); |
|
| 931 | - elseif ($line[3] === 'ATC') { |
|
| 1222 | + if (isset($value['noarchive']) && $value['noarchive'] === TRUE) { |
|
| 1223 | + $data['noarchive'] = true; |
|
| 1224 | + } |
|
| 1225 | + if (isset($value['name']) && $value['name'] != '') { |
|
| 1226 | + $data['source_name'] = $value['name']; |
|
| 1227 | + } |
|
| 1228 | + if ($line[3] === 'PILOT') { |
|
| 1229 | + $SI->add($data); |
|
| 1230 | + } elseif ($line[3] === 'ATC') { |
|
| 932 | 1231 | //print_r($data); |
| 933 | 1232 | $data['info'] = str_replace('^§','<br />',$data['info']); |
| 934 | 1233 | $data['info'] = str_replace('&sect;','',$data['info']); |
| 935 | 1234 | $typec = substr($data['ident'],-3); |
| 936 | - if ($typec === 'APP') $data['type'] = 'Approach'; |
|
| 937 | - elseif ($typec === 'TWR') $data['type'] = 'Tower'; |
|
| 938 | - elseif ($typec === 'OBS') $data['type'] = 'Observer'; |
|
| 939 | - elseif ($typec === 'GND') $data['type'] = 'Ground'; |
|
| 940 | - elseif ($typec === 'DEL') $data['type'] = 'Delivery'; |
|
| 941 | - elseif ($typec === 'DEP') $data['type'] = 'Departure'; |
|
| 942 | - elseif ($typec === 'FSS') $data['type'] = 'Flight Service Station'; |
|
| 943 | - elseif ($typec === 'CTR') $data['type'] = 'Control Radar or Centre'; |
|
| 944 | - elseif ($data['type'] === '') $data['type'] = 'Observer'; |
|
| 945 | - if (!isset($data['source_name'])) $data['source_name'] = ''; |
|
| 1235 | + if ($typec === 'APP') { |
|
| 1236 | + $data['type'] = 'Approach'; |
|
| 1237 | + } elseif ($typec === 'TWR') { |
|
| 1238 | + $data['type'] = 'Tower'; |
|
| 1239 | + } elseif ($typec === 'OBS') { |
|
| 1240 | + $data['type'] = 'Observer'; |
|
| 1241 | + } elseif ($typec === 'GND') { |
|
| 1242 | + $data['type'] = 'Ground'; |
|
| 1243 | + } elseif ($typec === 'DEL') { |
|
| 1244 | + $data['type'] = 'Delivery'; |
|
| 1245 | + } elseif ($typec === 'DEP') { |
|
| 1246 | + $data['type'] = 'Departure'; |
|
| 1247 | + } elseif ($typec === 'FSS') { |
|
| 1248 | + $data['type'] = 'Flight Service Station'; |
|
| 1249 | + } elseif ($typec === 'CTR') { |
|
| 1250 | + $data['type'] = 'Control Radar or Centre'; |
|
| 1251 | + } elseif ($data['type'] === '') { |
|
| 1252 | + $data['type'] = 'Observer'; |
|
| 1253 | + } |
|
| 1254 | + if (!isset($data['source_name'])) { |
|
| 1255 | + $data['source_name'] = ''; |
|
| 1256 | + } |
|
| 946 | 1257 | if (isset($ATC)) { |
| 947 | - if (count($ATC->getByIdent($data['ident'],$data['format_source'])) > 0) echo $ATC->update($data['ident'],$data['frequency'],$data['latitude'],$data['longitude'],$data['range'],$data['info'],$data['datetime'],$data['type'],$data['pilot_id'],$data['pilot_name'],$data['format_source'],$data['source_name']); |
|
| 948 | - else echo $ATC->add($data['ident'],$data['frequency'],$data['latitude'],$data['longitude'],$data['range'],$data['info'],$data['datetime'],$data['type'],$data['pilot_id'],$data['pilot_name'],$data['format_source'],$data['source_name']); |
|
| 1258 | + if (count($ATC->getByIdent($data['ident'],$data['format_source'])) > 0) { |
|
| 1259 | + echo $ATC->update($data['ident'],$data['frequency'],$data['latitude'],$data['longitude'],$data['range'],$data['info'],$data['datetime'],$data['type'],$data['pilot_id'],$data['pilot_name'],$data['format_source'],$data['source_name']); |
|
| 1260 | + } else { |
|
| 1261 | + echo $ATC->add($data['ident'],$data['frequency'],$data['latitude'],$data['longitude'],$data['range'],$data['info'],$data['datetime'],$data['type'],$data['pilot_id'],$data['pilot_name'],$data['format_source'],$data['source_name']); |
|
| 1262 | + } |
|
| 949 | 1263 | } |
| 950 | 1264 | } |
| 951 | 1265 | unset($data); |
@@ -972,14 +1286,20 @@ discard block |
||
| 972 | 1286 | $data['datetime'] = date('Y-m-d H:i:s',strtotime((string)$line['entryTime'].' BST')); |
| 973 | 1287 | $data['latitude'] = (float)$line['pktLatitude']; |
| 974 | 1288 | $data['longitude'] = (float)$line['pktLongitude']; |
| 975 | - if ((float)$line['pktTrack'] != 0) $data['heading'] = (float)$line['pktTrack']; |
|
| 976 | - if ((int)$line['pktSpeed'] != 0) $data['speed'] = (int)$line['pktSpeed']; |
|
| 1289 | + if ((float)$line['pktTrack'] != 0) { |
|
| 1290 | + $data['heading'] = (float)$line['pktTrack']; |
|
| 1291 | + } |
|
| 1292 | + if ((int)$line['pktSpeed'] != 0) { |
|
| 1293 | + $data['speed'] = (int)$line['pktSpeed']; |
|
| 1294 | + } |
|
| 977 | 1295 | $data['altitude'] = round((int)$line['pktAltitude']*3.28084); |
| 978 | 1296 | $data['altitude_relative'] = 'AMSL'; |
| 979 | 1297 | $data['pilot_id'] = (int)$line['pktPilotID']; |
| 980 | 1298 | $data['aircraft_icao'] = 'PARAGLIDER'; |
| 981 | 1299 | $pilot_data = explode(',',$Common->getData('http://www.airwhere.co.uk/pilotdetails.php?pilot='.$data['pilot_id'])); |
| 982 | - if (isset($pilot_data[4])) $data['pilot_name'] = $pilot_data[4]; |
|
| 1300 | + if (isset($pilot_data[4])) { |
|
| 1301 | + $data['pilot_name'] = $pilot_data[4]; |
|
| 1302 | + } |
|
| 983 | 1303 | $data['format_source'] = $value['format']; |
| 984 | 1304 | $SI->add($data); |
| 985 | 1305 | unset($data); |
@@ -1027,25 +1347,59 @@ discard block |
||
| 1027 | 1347 | foreach ($all_data['acList'] as $line) { |
| 1028 | 1348 | $data = array(); |
| 1029 | 1349 | $data['hex'] = $line['Icao']; // hex |
| 1030 | - if (isset($line['Call'])) $data['ident'] = $line['Call']; // ident |
|
| 1031 | - if (isset($line['Alt'])) $data['altitude'] = $line['Alt']; // altitude |
|
| 1032 | - if (isset($line['Spd'])) $data['speed'] = $line['Spd']; // speed |
|
| 1033 | - if (isset($line['Trak'])) $data['heading'] = $line['Trak']; // heading |
|
| 1034 | - if (isset($line['Lat'])) $data['latitude'] = $line['Lat']; // lat |
|
| 1035 | - if (isset($line['Long'])) $data['longitude'] = $line['Long']; // long |
|
| 1350 | + if (isset($line['Call'])) { |
|
| 1351 | + $data['ident'] = $line['Call']; |
|
| 1352 | + } |
|
| 1353 | + // ident |
|
| 1354 | + if (isset($line['Alt'])) { |
|
| 1355 | + $data['altitude'] = $line['Alt']; |
|
| 1356 | + } |
|
| 1357 | + // altitude |
|
| 1358 | + if (isset($line['Spd'])) { |
|
| 1359 | + $data['speed'] = $line['Spd']; |
|
| 1360 | + } |
|
| 1361 | + // speed |
|
| 1362 | + if (isset($line['Trak'])) { |
|
| 1363 | + $data['heading'] = $line['Trak']; |
|
| 1364 | + } |
|
| 1365 | + // heading |
|
| 1366 | + if (isset($line['Lat'])) { |
|
| 1367 | + $data['latitude'] = $line['Lat']; |
|
| 1368 | + } |
|
| 1369 | + // lat |
|
| 1370 | + if (isset($line['Long'])) { |
|
| 1371 | + $data['longitude'] = $line['Long']; |
|
| 1372 | + } |
|
| 1373 | + // long |
|
| 1036 | 1374 | //$data['verticalrate'] = $line['']; // verticale rate |
| 1037 | - if (isset($line['Sqk'])) $data['squawk'] = $line['Sqk']; // squawk |
|
| 1375 | + if (isset($line['Sqk'])) { |
|
| 1376 | + $data['squawk'] = $line['Sqk']; |
|
| 1377 | + } |
|
| 1378 | + // squawk |
|
| 1038 | 1379 | $data['emergency'] = ''; // emergency |
| 1039 | - if (isset($line['Reg'])) $data['registration'] = $line['Reg']; |
|
| 1040 | - if (isset($line['PosTime'])) $data['datetime'] = date('Y-m-d H:i:s',round($line['PosTime']/1000)); |
|
| 1041 | - else $data['datetime'] = date('Y-m-d H:i:s'); |
|
| 1380 | + if (isset($line['Reg'])) { |
|
| 1381 | + $data['registration'] = $line['Reg']; |
|
| 1382 | + } |
|
| 1383 | + if (isset($line['PosTime'])) { |
|
| 1384 | + $data['datetime'] = date('Y-m-d H:i:s',round($line['PosTime']/1000)); |
|
| 1385 | + } else { |
|
| 1386 | + $data['datetime'] = date('Y-m-d H:i:s'); |
|
| 1387 | + } |
|
| 1042 | 1388 | //$data['datetime'] = date('Y-m-d H:i:s'); |
| 1043 | - if (isset($line['Type'])) $data['aircraft_icao'] = $line['Type']; |
|
| 1389 | + if (isset($line['Type'])) { |
|
| 1390 | + $data['aircraft_icao'] = $line['Type']; |
|
| 1391 | + } |
|
| 1044 | 1392 | $data['format_source'] = 'aircraftlistjson'; |
| 1045 | 1393 | $data['id_source'] = $id_source; |
| 1046 | - if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name']; |
|
| 1047 | - if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true; |
|
| 1048 | - if (isset($data['latitude'])) $SI->add($data); |
|
| 1394 | + if (isset($value['name']) && $value['name'] != '') { |
|
| 1395 | + $data['source_name'] = $value['name']; |
|
| 1396 | + } |
|
| 1397 | + if (isset($value['noarchive']) && $value['noarchive'] === TRUE) { |
|
| 1398 | + $data['noarchive'] = true; |
|
| 1399 | + } |
|
| 1400 | + if (isset($data['latitude'])) { |
|
| 1401 | + $SI->add($data); |
|
| 1402 | + } |
|
| 1049 | 1403 | unset($data); |
| 1050 | 1404 | } |
| 1051 | 1405 | } elseif (is_array($all_data)) { |
@@ -1062,17 +1416,26 @@ discard block |
||
| 1062 | 1416 | $data['verticalrate'] = $line['vrt']; // verticale rate |
| 1063 | 1417 | $data['squawk'] = $line['squawk']; // squawk |
| 1064 | 1418 | $data['emergency'] = ''; // emergency |
| 1065 | - if (isset($line['PosTime'])) $data['datetime'] = date('Y-m-d H:i:s',round($line['PosTime']/1000)); |
|
| 1066 | - else $data['datetime'] = date('Y-m-d H:i:s'); |
|
| 1419 | + if (isset($line['PosTime'])) { |
|
| 1420 | + $data['datetime'] = date('Y-m-d H:i:s',round($line['PosTime']/1000)); |
|
| 1421 | + } else { |
|
| 1422 | + $data['datetime'] = date('Y-m-d H:i:s'); |
|
| 1423 | + } |
|
| 1067 | 1424 | $data['format_source'] = 'aircraftlistjson'; |
| 1068 | 1425 | $data['id_source'] = $id_source; |
| 1069 | - if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true; |
|
| 1070 | - if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name']; |
|
| 1426 | + if (isset($value['noarchive']) && $value['noarchive'] === TRUE) { |
|
| 1427 | + $data['noarchive'] = true; |
|
| 1428 | + } |
|
| 1429 | + if (isset($value['name']) && $value['name'] != '') { |
|
| 1430 | + $data['source_name'] = $value['name']; |
|
| 1431 | + } |
|
| 1071 | 1432 | $SI->add($data); |
| 1072 | 1433 | unset($data); |
| 1073 | 1434 | } |
| 1074 | 1435 | } |
| 1075 | - } elseif ($globalDebug) echo 'No data'."\n"; |
|
| 1436 | + } elseif ($globalDebug) { |
|
| 1437 | + echo 'No data'."\n"; |
|
| 1438 | + } |
|
| 1076 | 1439 | //$last_exec['aircraftlistjson'] = time(); |
| 1077 | 1440 | $last_exec[$id]['last'] = time(); |
| 1078 | 1441 | //} elseif ($value === 'planeupdatefaa' && (time() - $last_exec['planeupdatefaa'] > $globalMinFetch)) { |
@@ -1108,8 +1471,12 @@ discard block |
||
| 1108 | 1471 | $data['datetime'] = date('Y-m-d H:i:s',$line[9]); |
| 1109 | 1472 | $data['format_source'] = 'planeupdatefaa'; |
| 1110 | 1473 | $data['id_source'] = $id_source; |
| 1111 | - if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true; |
|
| 1112 | - if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name']; |
|
| 1474 | + if (isset($value['noarchive']) && $value['noarchive'] === TRUE) { |
|
| 1475 | + $data['noarchive'] = true; |
|
| 1476 | + } |
|
| 1477 | + if (isset($value['name']) && $value['name'] != '') { |
|
| 1478 | + $data['source_name'] = $value['name']; |
|
| 1479 | + } |
|
| 1113 | 1480 | $SI->add($data); |
| 1114 | 1481 | unset($data); |
| 1115 | 1482 | } |
@@ -1143,7 +1510,9 @@ discard block |
||
| 1143 | 1510 | $data['datetime'] = date('Y-m-d H:i:s',$line[3]); |
| 1144 | 1511 | $data['format_source'] = 'opensky'; |
| 1145 | 1512 | $data['id_source'] = $id_source; |
| 1146 | - if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true; |
|
| 1513 | + if (isset($value['noarchive']) && $value['noarchive'] === TRUE) { |
|
| 1514 | + $data['noarchive'] = true; |
|
| 1515 | + } |
|
| 1147 | 1516 | $SI->add($data); |
| 1148 | 1517 | unset($data); |
| 1149 | 1518 | } |
@@ -1163,15 +1532,42 @@ discard block |
||
| 1163 | 1532 | foreach ($all_data['aircraft'] as $key => $line) { |
| 1164 | 1533 | $data = array(); |
| 1165 | 1534 | // add support for ground vehicule with ~ in front of hex |
| 1166 | - if (isset($line['hex'])) $data['hex'] = $line['hex']; // hex |
|
| 1167 | - if (isset($line['flight'])) $data['ident'] = trim($line['flight']); // ident |
|
| 1168 | - if (isset($line['altitude'])) $data['altitude'] = $line['altitude']; // altitude |
|
| 1169 | - if (isset($line['speed'])) $data['speed'] = $line['speed']; // speed |
|
| 1170 | - if (isset($line['track'])) $data['heading'] = $line['track']; // heading |
|
| 1171 | - if (isset($line['lat'])) $data['latitude'] = $line['lat']; // lat |
|
| 1172 | - if (isset($line['lon'])) $data['longitude'] = $line['lon']; // long |
|
| 1173 | - if (isset($line['vert_rate'])) $data['verticalrate'] = $line['vert_rate']; // verticale rate |
|
| 1174 | - if (isset($line['squawk'])) $data['squawk'] = $line['squawk']; // squawk |
|
| 1535 | + if (isset($line['hex'])) { |
|
| 1536 | + $data['hex'] = $line['hex']; |
|
| 1537 | + } |
|
| 1538 | + // hex |
|
| 1539 | + if (isset($line['flight'])) { |
|
| 1540 | + $data['ident'] = trim($line['flight']); |
|
| 1541 | + } |
|
| 1542 | + // ident |
|
| 1543 | + if (isset($line['altitude'])) { |
|
| 1544 | + $data['altitude'] = $line['altitude']; |
|
| 1545 | + } |
|
| 1546 | + // altitude |
|
| 1547 | + if (isset($line['speed'])) { |
|
| 1548 | + $data['speed'] = $line['speed']; |
|
| 1549 | + } |
|
| 1550 | + // speed |
|
| 1551 | + if (isset($line['track'])) { |
|
| 1552 | + $data['heading'] = $line['track']; |
|
| 1553 | + } |
|
| 1554 | + // heading |
|
| 1555 | + if (isset($line['lat'])) { |
|
| 1556 | + $data['latitude'] = $line['lat']; |
|
| 1557 | + } |
|
| 1558 | + // lat |
|
| 1559 | + if (isset($line['lon'])) { |
|
| 1560 | + $data['longitude'] = $line['lon']; |
|
| 1561 | + } |
|
| 1562 | + // long |
|
| 1563 | + if (isset($line['vert_rate'])) { |
|
| 1564 | + $data['verticalrate'] = $line['vert_rate']; |
|
| 1565 | + } |
|
| 1566 | + // verticale rate |
|
| 1567 | + if (isset($line['squawk'])) { |
|
| 1568 | + $data['squawk'] = $line['squawk']; |
|
| 1569 | + } |
|
| 1570 | + // squawk |
|
| 1175 | 1571 | //$data['emergency'] = ''; // emergency |
| 1176 | 1572 | //$data['registration'] = $line[2]; |
| 1177 | 1573 | //$data['aircraft_icao'] = $line[0]; |
@@ -1179,10 +1575,17 @@ discard block |
||
| 1179 | 1575 | $data['format_source'] = 'aircraftjson'; |
| 1180 | 1576 | $data['id_source'] = $id_source; |
| 1181 | 1577 | if (isset($value['name']) && $value['name'] != '') { |
| 1182 | - if (isset($line['mlat']) && !empty($line['mlat'])) $data['source_name'] = $value['name'].'_MLAT'; |
|
| 1183 | - else $data['source_name'] = $value['name']; |
|
| 1184 | - } elseif (isset($line['mlat']) && !empty($line['mlat'])) $data['source_name'] = 'MLAT'; |
|
| 1185 | - if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true; |
|
| 1578 | + if (isset($line['mlat']) && !empty($line['mlat'])) { |
|
| 1579 | + $data['source_name'] = $value['name'].'_MLAT'; |
|
| 1580 | + } else { |
|
| 1581 | + $data['source_name'] = $value['name']; |
|
| 1582 | + } |
|
| 1583 | + } elseif (isset($line['mlat']) && !empty($line['mlat'])) { |
|
| 1584 | + $data['source_name'] = 'MLAT'; |
|
| 1585 | + } |
|
| 1586 | + if (isset($value['noarchive']) && $value['noarchive'] === TRUE) { |
|
| 1587 | + $data['noarchive'] = true; |
|
| 1588 | + } |
|
| 1186 | 1589 | $SI->add($data); |
| 1187 | 1590 | unset($data); |
| 1188 | 1591 | } |
@@ -1202,22 +1605,54 @@ discard block |
||
| 1202 | 1605 | foreach ($all_data['aircraft'] as $key => $line) { |
| 1203 | 1606 | $data = array(); |
| 1204 | 1607 | $data['hex'] = $key; // hex |
| 1205 | - if (isset($line['callsign'])) $data['ident'] = trim($line['callsign']); // ident |
|
| 1206 | - if (isset($line['altitude'])) $data['altitude'] = $line['altitude']; // altitude |
|
| 1207 | - if (isset($line['speed'])) $data['speed'] = $line['speed']; // speed |
|
| 1208 | - if (isset($line['heading'])) $data['heading'] = $line['heading']; // heading |
|
| 1209 | - if (isset($line['lat'])) $data['latitude'] = $line['lat']; // lat |
|
| 1210 | - if (isset($line['lon'])) $data['longitude'] = $line['lon']; // long |
|
| 1211 | - if (isset($line['vert_rate'])) $data['verticalrate'] = $line['vert_rate']; // verticale rate |
|
| 1212 | - if (isset($line['squawk'])) $data['squawk'] = $line['squawk']; // squawk |
|
| 1608 | + if (isset($line['callsign'])) { |
|
| 1609 | + $data['ident'] = trim($line['callsign']); |
|
| 1610 | + } |
|
| 1611 | + // ident |
|
| 1612 | + if (isset($line['altitude'])) { |
|
| 1613 | + $data['altitude'] = $line['altitude']; |
|
| 1614 | + } |
|
| 1615 | + // altitude |
|
| 1616 | + if (isset($line['speed'])) { |
|
| 1617 | + $data['speed'] = $line['speed']; |
|
| 1618 | + } |
|
| 1619 | + // speed |
|
| 1620 | + if (isset($line['heading'])) { |
|
| 1621 | + $data['heading'] = $line['heading']; |
|
| 1622 | + } |
|
| 1623 | + // heading |
|
| 1624 | + if (isset($line['lat'])) { |
|
| 1625 | + $data['latitude'] = $line['lat']; |
|
| 1626 | + } |
|
| 1627 | + // lat |
|
| 1628 | + if (isset($line['lon'])) { |
|
| 1629 | + $data['longitude'] = $line['lon']; |
|
| 1630 | + } |
|
| 1631 | + // long |
|
| 1632 | + if (isset($line['vert_rate'])) { |
|
| 1633 | + $data['verticalrate'] = $line['vert_rate']; |
|
| 1634 | + } |
|
| 1635 | + // verticale rate |
|
| 1636 | + if (isset($line['squawk'])) { |
|
| 1637 | + $data['squawk'] = $line['squawk']; |
|
| 1638 | + } |
|
| 1639 | + // squawk |
|
| 1213 | 1640 | //$data['emergency'] = ''; // emergency |
| 1214 | - if (isset($line['reg'])) $data['registration'] = $line['reg']; |
|
| 1215 | - if (isset($line['type'])) $data['aircraft_icao'] = $line['type']; |
|
| 1641 | + if (isset($line['reg'])) { |
|
| 1642 | + $data['registration'] = $line['reg']; |
|
| 1643 | + } |
|
| 1644 | + if (isset($line['type'])) { |
|
| 1645 | + $data['aircraft_icao'] = $line['type']; |
|
| 1646 | + } |
|
| 1216 | 1647 | $data['datetime'] = date('Y-m-d H:i:s',$line['pos_update_time']); |
| 1217 | 1648 | $data['format_source'] = 'planefinderclient'; |
| 1218 | 1649 | $data['id_source'] = $id_source; |
| 1219 | - if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name']; |
|
| 1220 | - if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true; |
|
| 1650 | + if (isset($value['name']) && $value['name'] != '') { |
|
| 1651 | + $data['source_name'] = $value['name']; |
|
| 1652 | + } |
|
| 1653 | + if (isset($value['noarchive']) && $value['noarchive'] === TRUE) { |
|
| 1654 | + $data['noarchive'] = true; |
|
| 1655 | + } |
|
| 1221 | 1656 | $SI->add($data); |
| 1222 | 1657 | unset($data); |
| 1223 | 1658 | } |
@@ -1233,7 +1668,9 @@ discard block |
||
| 1233 | 1668 | //$buffer = $Common->getData($hosts[$id]); |
| 1234 | 1669 | $buffer = $Common->getData($value['host']); |
| 1235 | 1670 | $all_data = json_decode($buffer,true); |
| 1236 | - if (!empty($all_data)) $reset = 0; |
|
| 1671 | + if (!empty($all_data)) { |
|
| 1672 | + $reset = 0; |
|
| 1673 | + } |
|
| 1237 | 1674 | foreach ($all_data as $key => $line) { |
| 1238 | 1675 | if ($key != 'full_count' && $key != 'version' && $key != 'stats') { |
| 1239 | 1676 | $data = array(); |
@@ -1254,8 +1691,12 @@ discard block |
||
| 1254 | 1691 | $data['datetime'] = date('Y-m-d H:i:s'); //$line[10] |
| 1255 | 1692 | $data['format_source'] = 'fr24json'; |
| 1256 | 1693 | $data['id_source'] = $id_source; |
| 1257 | - if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true; |
|
| 1258 | - if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name']; |
|
| 1694 | + if (isset($value['noarchive']) && $value['noarchive'] === TRUE) { |
|
| 1695 | + $data['noarchive'] = true; |
|
| 1696 | + } |
|
| 1697 | + if (isset($value['name']) && $value['name'] != '') { |
|
| 1698 | + $data['source_name'] = $value['name']; |
|
| 1699 | + } |
|
| 1259 | 1700 | $SI->add($data); |
| 1260 | 1701 | unset($data); |
| 1261 | 1702 | } |
@@ -1284,24 +1725,42 @@ discard block |
||
| 1284 | 1725 | if (isset($line['inf'])) { |
| 1285 | 1726 | $data = array(); |
| 1286 | 1727 | $data['hex'] = $line['inf']['ia']; |
| 1287 | - if (isset($line['inf']['cs'])) $data['ident'] = $line['inf']['cs']; //$line[13] |
|
| 1728 | + if (isset($line['inf']['cs'])) { |
|
| 1729 | + $data['ident'] = $line['inf']['cs']; |
|
| 1730 | + } |
|
| 1731 | + //$line[13] |
|
| 1288 | 1732 | $data['altitude'] = round($line['inf']['al']*3.28084); // altitude |
| 1289 | - if (isset($line['inf']['gs'])) $data['speed'] = round($line['inf']['gs']*0.539957); // speed |
|
| 1290 | - if (isset($line['inf']['tr'])) $data['heading'] = $line['inf']['tr']; // heading |
|
| 1733 | + if (isset($line['inf']['gs'])) { |
|
| 1734 | + $data['speed'] = round($line['inf']['gs']*0.539957); |
|
| 1735 | + } |
|
| 1736 | + // speed |
|
| 1737 | + if (isset($line['inf']['tr'])) { |
|
| 1738 | + $data['heading'] = $line['inf']['tr']; |
|
| 1739 | + } |
|
| 1740 | + // heading |
|
| 1291 | 1741 | $data['latitude'] = $line['pt'][0]; // lat |
| 1292 | 1742 | $data['longitude'] = $line['pt'][1]; // long |
| 1293 | 1743 | //if (isset($line['inf']['vs'])) $data['verticalrate'] = $line['inf']['vs']; // verticale rate |
| 1294 | - if (isset($line['inf']['sq'])) $data['squawk'] = $line['inf']['sq']; // squawk |
|
| 1744 | + if (isset($line['inf']['sq'])) { |
|
| 1745 | + $data['squawk'] = $line['inf']['sq']; |
|
| 1746 | + } |
|
| 1747 | + // squawk |
|
| 1295 | 1748 | //$data['aircraft_icao'] = $line[8]; |
| 1296 | - if (isset($line['inf']['rc'])) $data['registration'] = $line['inf']['rc']; |
|
| 1749 | + if (isset($line['inf']['rc'])) { |
|
| 1750 | + $data['registration'] = $line['inf']['rc']; |
|
| 1751 | + } |
|
| 1297 | 1752 | //$data['departure_airport_iata'] = $line[11]; |
| 1298 | 1753 | //$data['arrival_airport_iata'] = $line[12]; |
| 1299 | 1754 | //$data['emergency'] = ''; // emergency |
| 1300 | 1755 | $data['datetime'] = date('Y-m-d H:i:s',$line['inf']['dt']); //$line[10] |
| 1301 | 1756 | $data['format_source'] = 'radarvirtueljson'; |
| 1302 | 1757 | $data['id_source'] = $id_source; |
| 1303 | - if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true; |
|
| 1304 | - if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name']; |
|
| 1758 | + if (isset($value['noarchive']) && $value['noarchive'] === TRUE) { |
|
| 1759 | + $data['noarchive'] = true; |
|
| 1760 | + } |
|
| 1761 | + if (isset($value['name']) && $value['name'] != '') { |
|
| 1762 | + $data['source_name'] = $value['name']; |
|
| 1763 | + } |
|
| 1305 | 1764 | $SI->add($data); |
| 1306 | 1765 | unset($data); |
| 1307 | 1766 | } |
@@ -1327,30 +1786,65 @@ discard block |
||
| 1327 | 1786 | $data['id'] = $line['id']; |
| 1328 | 1787 | $data['hex'] = substr(str_pad(dechex($line['id']),6,'000000',STR_PAD_LEFT),0,6); |
| 1329 | 1788 | $data['ident'] = $line['callsign']; // ident |
| 1330 | - if (isset($line['pilotid'])) $data['pilot_id'] = $line['pilotid']; // pilot id |
|
| 1331 | - if (isset($line['name'])) $data['pilot_name'] = $line['name']; // pilot name |
|
| 1332 | - if (isset($line['alt'])) $data['altitude'] = $line['alt']; // altitude |
|
| 1333 | - if (isset($line['gs'])) $data['speed'] = $line['gs']; // speed |
|
| 1334 | - if (isset($line['heading'])) $data['heading'] = $line['heading']; // heading |
|
| 1335 | - if (isset($line['route'])) $data['waypoints'] = $line['route']; // route |
|
| 1789 | + if (isset($line['pilotid'])) { |
|
| 1790 | + $data['pilot_id'] = $line['pilotid']; |
|
| 1791 | + } |
|
| 1792 | + // pilot id |
|
| 1793 | + if (isset($line['name'])) { |
|
| 1794 | + $data['pilot_name'] = $line['name']; |
|
| 1795 | + } |
|
| 1796 | + // pilot name |
|
| 1797 | + if (isset($line['alt'])) { |
|
| 1798 | + $data['altitude'] = $line['alt']; |
|
| 1799 | + } |
|
| 1800 | + // altitude |
|
| 1801 | + if (isset($line['gs'])) { |
|
| 1802 | + $data['speed'] = $line['gs']; |
|
| 1803 | + } |
|
| 1804 | + // speed |
|
| 1805 | + if (isset($line['heading'])) { |
|
| 1806 | + $data['heading'] = $line['heading']; |
|
| 1807 | + } |
|
| 1808 | + // heading |
|
| 1809 | + if (isset($line['route'])) { |
|
| 1810 | + $data['waypoints'] = $line['route']; |
|
| 1811 | + } |
|
| 1812 | + // route |
|
| 1336 | 1813 | $data['latitude'] = $line['lat']; // lat |
| 1337 | 1814 | $data['longitude'] = $line['lon']; // long |
| 1338 | 1815 | //$data['verticalrate'] = $line['vrt']; // verticale rate |
| 1339 | 1816 | //$data['squawk'] = $line['squawk']; // squawk |
| 1340 | 1817 | //$data['emergency'] = ''; // emergency |
| 1341 | - if (isset($line['depicao'])) $data['departure_airport_icao'] = $line['depicao']; |
|
| 1342 | - if (isset($line['deptime'])) $data['departure_airport_time'] = $line['deptime']; |
|
| 1343 | - if (isset($line['arricao'])) $data['arrival_airport_icao'] = $line['arricao']; |
|
| 1818 | + if (isset($line['depicao'])) { |
|
| 1819 | + $data['departure_airport_icao'] = $line['depicao']; |
|
| 1820 | + } |
|
| 1821 | + if (isset($line['deptime'])) { |
|
| 1822 | + $data['departure_airport_time'] = $line['deptime']; |
|
| 1823 | + } |
|
| 1824 | + if (isset($line['arricao'])) { |
|
| 1825 | + $data['arrival_airport_icao'] = $line['arricao']; |
|
| 1826 | + } |
|
| 1344 | 1827 | //$data['arrival_airport_time'] = $line['arrtime']; |
| 1345 | - if (isset($line['aircraft'])) $data['aircraft_icao'] = $line['aircraft']; |
|
| 1346 | - if (isset($line['transponder'])) $data['squawk'] = $line['transponder']; |
|
| 1347 | - if (isset($line['atis'])) $data['info'] = $line['atis']; |
|
| 1348 | - else $data['info'] = ''; |
|
| 1828 | + if (isset($line['aircraft'])) { |
|
| 1829 | + $data['aircraft_icao'] = $line['aircraft']; |
|
| 1830 | + } |
|
| 1831 | + if (isset($line['transponder'])) { |
|
| 1832 | + $data['squawk'] = $line['transponder']; |
|
| 1833 | + } |
|
| 1834 | + if (isset($line['atis'])) { |
|
| 1835 | + $data['info'] = $line['atis']; |
|
| 1836 | + } else { |
|
| 1837 | + $data['info'] = ''; |
|
| 1838 | + } |
|
| 1349 | 1839 | $data['format_source'] = 'pireps'; |
| 1350 | 1840 | $data['id_source'] = $id_source; |
| 1351 | 1841 | $data['datetime'] = date('Y-m-d H:i:s'); |
| 1352 | - if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true; |
|
| 1353 | - if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name']; |
|
| 1842 | + if (isset($value['noarchive']) && $value['noarchive'] === TRUE) { |
|
| 1843 | + $data['noarchive'] = true; |
|
| 1844 | + } |
|
| 1845 | + if (isset($value['name']) && $value['name'] != '') { |
|
| 1846 | + $data['source_name'] = $value['name']; |
|
| 1847 | + } |
|
| 1354 | 1848 | if ($line['icon'] === 'plane') { |
| 1355 | 1849 | $SI->add($data); |
| 1356 | 1850 | // print_r($data); |
@@ -1359,16 +1853,28 @@ discard block |
||
| 1359 | 1853 | $data['info'] = str_replace('&sect;','',$data['info']); |
| 1360 | 1854 | $typec = substr($data['ident'],-3); |
| 1361 | 1855 | $data['type'] = ''; |
| 1362 | - if ($typec === 'APP') $data['type'] = 'Approach'; |
|
| 1363 | - elseif ($typec === 'TWR') $data['type'] = 'Tower'; |
|
| 1364 | - elseif ($typec === 'OBS') $data['type'] = 'Observer'; |
|
| 1365 | - elseif ($typec === 'GND') $data['type'] = 'Ground'; |
|
| 1366 | - elseif ($typec === 'DEL') $data['type'] = 'Delivery'; |
|
| 1367 | - elseif ($typec === 'DEP') $data['type'] = 'Departure'; |
|
| 1368 | - elseif ($typec === 'FSS') $data['type'] = 'Flight Service Station'; |
|
| 1369 | - elseif ($typec === 'CTR') $data['type'] = 'Control Radar or Centre'; |
|
| 1370 | - else $data['type'] = 'Observer'; |
|
| 1371 | - if (isset($ATC)) echo $ATC->add($data['ident'],'',$data['latitude'],$data['longitude'],'0',$data['info'],$data['datetime'],$data['type'],$data['pilot_id'],$data['pilot_name'],$data['format_source']); |
|
| 1856 | + if ($typec === 'APP') { |
|
| 1857 | + $data['type'] = 'Approach'; |
|
| 1858 | + } elseif ($typec === 'TWR') { |
|
| 1859 | + $data['type'] = 'Tower'; |
|
| 1860 | + } elseif ($typec === 'OBS') { |
|
| 1861 | + $data['type'] = 'Observer'; |
|
| 1862 | + } elseif ($typec === 'GND') { |
|
| 1863 | + $data['type'] = 'Ground'; |
|
| 1864 | + } elseif ($typec === 'DEL') { |
|
| 1865 | + $data['type'] = 'Delivery'; |
|
| 1866 | + } elseif ($typec === 'DEP') { |
|
| 1867 | + $data['type'] = 'Departure'; |
|
| 1868 | + } elseif ($typec === 'FSS') { |
|
| 1869 | + $data['type'] = 'Flight Service Station'; |
|
| 1870 | + } elseif ($typec === 'CTR') { |
|
| 1871 | + $data['type'] = 'Control Radar or Centre'; |
|
| 1872 | + } else { |
|
| 1873 | + $data['type'] = 'Observer'; |
|
| 1874 | + } |
|
| 1875 | + if (isset($ATC)) { |
|
| 1876 | + echo $ATC->add($data['ident'],'',$data['latitude'],$data['longitude'],'0',$data['info'],$data['datetime'],$data['type'],$data['pilot_id'],$data['pilot_name'],$data['format_source']); |
|
| 1877 | + } |
|
| 1372 | 1878 | } |
| 1373 | 1879 | unset($data); |
| 1374 | 1880 | } |
@@ -1383,7 +1889,9 @@ discard block |
||
| 1383 | 1889 | ) |
| 1384 | 1890 | ) { |
| 1385 | 1891 | //$buffer = $Common->getData($hosts[$id]); |
| 1386 | - if ($globalDebug) echo 'Get Data...'."\n"; |
|
| 1892 | + if ($globalDebug) { |
|
| 1893 | + echo 'Get Data...'."\n"; |
|
| 1894 | + } |
|
| 1387 | 1895 | $buffer = $Common->getData($value['host']); |
| 1388 | 1896 | $all_data = json_decode($buffer,true); |
| 1389 | 1897 | if ($buffer != '' && is_array($all_data)) { |
@@ -1391,10 +1899,16 @@ discard block |
||
| 1391 | 1899 | foreach ($all_data as $line) { |
| 1392 | 1900 | $data = array(); |
| 1393 | 1901 | //$data['id'] = $line['id']; // id not usable |
| 1394 | - if (isset($line['pilotid'])) $data['id'] = $line['pilotid'].$line['flightnum']; |
|
| 1902 | + if (isset($line['pilotid'])) { |
|
| 1903 | + $data['id'] = $line['pilotid'].$line['flightnum']; |
|
| 1904 | + } |
|
| 1395 | 1905 | $data['hex'] = substr(str_pad(bin2hex($line['flightnum']),6,'000000',STR_PAD_LEFT),-6); // hex |
| 1396 | - if (isset($line['pilotname'])) $data['pilot_name'] = $line['pilotname']; |
|
| 1397 | - if (isset($line['pilotid'])) $data['pilot_id'] = $line['pilotid']; |
|
| 1906 | + if (isset($line['pilotname'])) { |
|
| 1907 | + $data['pilot_name'] = $line['pilotname']; |
|
| 1908 | + } |
|
| 1909 | + if (isset($line['pilotid'])) { |
|
| 1910 | + $data['pilot_id'] = $line['pilotid']; |
|
| 1911 | + } |
|
| 1398 | 1912 | $data['ident'] = $line['flightnum']; // ident |
| 1399 | 1913 | $data['altitude'] = $line['alt']; // altitude |
| 1400 | 1914 | $data['speed'] = $line['gs']; // speed |
@@ -1410,7 +1924,9 @@ discard block |
||
| 1410 | 1924 | $datetime = new DateTime($line['lastupdate'],new DateTimeZone($value['timezone'])); |
| 1411 | 1925 | $datetime->setTimeZone(new DateTimeZone('UTC')); |
| 1412 | 1926 | $data['datetime'] = $datetime->format('Y-m-d H:i:s'); |
| 1413 | - } else $data['datetime'] = date('Y-m-d H:i:s'); |
|
| 1927 | + } else { |
|
| 1928 | + $data['datetime'] = date('Y-m-d H:i:s'); |
|
| 1929 | + } |
|
| 1414 | 1930 | $data['departure_airport_icao'] = $line['depicao']; |
| 1415 | 1931 | $data['departure_airport_time'] = $line['deptime']; |
| 1416 | 1932 | $data['arrival_airport_icao'] = $line['arricao']; |
@@ -1418,29 +1934,47 @@ discard block |
||
| 1418 | 1934 | if (isset($line['registration'])) { |
| 1419 | 1935 | $data['registration'] = $line['registration']; |
| 1420 | 1936 | //if (isset($line['aircraft'])) $data['id'] = $line['aircraft']; |
| 1421 | - } else $data['registration'] = $line['aircraft']; |
|
| 1422 | - if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true; |
|
| 1423 | - if (isset($line['route'])) $data['waypoints'] = $line['route']; // route |
|
| 1937 | + } else { |
|
| 1938 | + $data['registration'] = $line['aircraft']; |
|
| 1939 | + } |
|
| 1940 | + if (isset($value['noarchive']) && $value['noarchive'] === TRUE) { |
|
| 1941 | + $data['noarchive'] = true; |
|
| 1942 | + } |
|
| 1943 | + if (isset($line['route'])) { |
|
| 1944 | + $data['waypoints'] = $line['route']; |
|
| 1945 | + } |
|
| 1946 | + // route |
|
| 1424 | 1947 | if (isset($line['aircraftname'])) { |
| 1425 | 1948 | $line['aircraftname'] = strtoupper($line['aircraftname']); |
| 1426 | 1949 | $line['aircraftname'] = str_replace('BOEING ','B',$line['aircraftname']); |
| 1427 | 1950 | $aircraft_data = explode('-',$line['aircraftname']); |
| 1428 | - if (isset($aircraft_data[1]) && strlen($aircraft_data[0]) >= 3 && strlen($aircraft_data[0]) <= 4) $data['aircraft_icao'] = $aircraft_data[0]; |
|
| 1429 | - elseif (isset($aircraft_data[1]) && strlen($aircraft_data[1]) >= 3 && strlen($aircraft_data[1]) <= 4) $data['aircraft_icao'] = $aircraft_data[1]; |
|
| 1430 | - else { |
|
| 1951 | + if (isset($aircraft_data[1]) && strlen($aircraft_data[0]) >= 3 && strlen($aircraft_data[0]) <= 4) { |
|
| 1952 | + $data['aircraft_icao'] = $aircraft_data[0]; |
|
| 1953 | + } elseif (isset($aircraft_data[1]) && strlen($aircraft_data[1]) >= 3 && strlen($aircraft_data[1]) <= 4) { |
|
| 1954 | + $data['aircraft_icao'] = $aircraft_data[1]; |
|
| 1955 | + } else { |
|
| 1431 | 1956 | $aircraft_data = explode(' ',$line['aircraftname']); |
| 1432 | - if (isset($aircraft_data[1])) $data['aircraft_icao'] = str_replace('-','',$aircraft_data[1]); |
|
| 1433 | - else $data['aircraft_icao'] = str_replace('-','',$line['aircraftname']); |
|
| 1957 | + if (isset($aircraft_data[1])) { |
|
| 1958 | + $data['aircraft_icao'] = str_replace('-','',$aircraft_data[1]); |
|
| 1959 | + } else { |
|
| 1960 | + $data['aircraft_icao'] = str_replace('-','',$line['aircraftname']); |
|
| 1961 | + } |
|
| 1434 | 1962 | } |
| 1435 | 1963 | } |
| 1436 | - if (isset($line['route'])) $data['waypoints'] = $line['route']; |
|
| 1964 | + if (isset($line['route'])) { |
|
| 1965 | + $data['waypoints'] = $line['route']; |
|
| 1966 | + } |
|
| 1437 | 1967 | $data['id_source'] = $id_source; |
| 1438 | 1968 | $data['format_source'] = 'phpvmacars'; |
| 1439 | - if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name']; |
|
| 1969 | + if (isset($value['name']) && $value['name'] != '') { |
|
| 1970 | + $data['source_name'] = $value['name']; |
|
| 1971 | + } |
|
| 1440 | 1972 | $SI->add($data); |
| 1441 | 1973 | unset($data); |
| 1442 | 1974 | } |
| 1443 | - if ($globalDebug) echo 'No more data...'."\n"; |
|
| 1975 | + if ($globalDebug) { |
|
| 1976 | + echo 'No more data...'."\n"; |
|
| 1977 | + } |
|
| 1444 | 1978 | unset($buffer); |
| 1445 | 1979 | unset($all_data); |
| 1446 | 1980 | } |
@@ -1453,7 +1987,9 @@ discard block |
||
| 1453 | 1987 | ) |
| 1454 | 1988 | ) { |
| 1455 | 1989 | //$buffer = $Common->getData($hosts[$id]); |
| 1456 | - if ($globalDebug) echo 'Get Data...'."\n"; |
|
| 1990 | + if ($globalDebug) { |
|
| 1991 | + echo 'Get Data...'."\n"; |
|
| 1992 | + } |
|
| 1457 | 1993 | $buffer = $Common->getData($value['host']); |
| 1458 | 1994 | $all_data = json_decode($buffer,true); |
| 1459 | 1995 | if ($buffer != '' && is_array($all_data) && isset($all_data['ACARSData'])) { |
@@ -1464,10 +2000,16 @@ discard block |
||
| 1464 | 2000 | //$data['id'] = $line['id']; // id not usable |
| 1465 | 2001 | $data['id'] = $line['id']; |
| 1466 | 2002 | //$data['hex'] = substr(str_pad(bin2hex($line['flightnum']),6,'000000',STR_PAD_LEFT),-6); // hex |
| 1467 | - if (isset($line['user']['username'])) $data['pilot_name'] = $line['user']['username']; |
|
| 1468 | - if (isset($line['user_id'])) $data['pilot_id'] = $line['user_id']; |
|
| 2003 | + if (isset($line['user']['username'])) { |
|
| 2004 | + $data['pilot_name'] = $line['user']['username']; |
|
| 2005 | + } |
|
| 2006 | + if (isset($line['user_id'])) { |
|
| 2007 | + $data['pilot_id'] = $line['user_id']; |
|
| 2008 | + } |
|
| 1469 | 2009 | $data['ident'] = str_replace(' ','',$line['bid']['flightnum']); // ident |
| 1470 | - if (is_numeric($data['ident'])) $data['ident'] = $line['bid']['airline']['icao'].$data['ident']; |
|
| 2010 | + if (is_numeric($data['ident'])) { |
|
| 2011 | + $data['ident'] = $line['bid']['airline']['icao'].$data['ident']; |
|
| 2012 | + } |
|
| 1471 | 2013 | $data['altitude'] = $line['altitude']; // altitude |
| 1472 | 2014 | $data['speed'] = $line['groundspeed']; // speed |
| 1473 | 2015 | $data['heading'] = $line['heading']; // heading |
@@ -1480,7 +2022,9 @@ discard block |
||
| 1480 | 2022 | $datetime = new DateTime($line['updated_at'],new DateTimeZone($value['timezone'])); |
| 1481 | 2023 | $datetime->setTimeZone(new DateTimeZone('UTC')); |
| 1482 | 2024 | $data['datetime'] = $datetime->format('Y-m-d H:i:s'); |
| 1483 | - } else $data['datetime'] = date('Y-m-d H:i:s'); |
|
| 2025 | + } else { |
|
| 2026 | + $data['datetime'] = date('Y-m-d H:i:s'); |
|
| 2027 | + } |
|
| 1484 | 2028 | |
| 1485 | 2029 | $data['departure_airport_icao'] = $line['bid']['depapt']['icao']; |
| 1486 | 2030 | $data['departure_airport_time'] = $line['bid']['deptime']; |
@@ -1488,17 +2032,26 @@ discard block |
||
| 1488 | 2032 | $data['arrival_airport_time'] = $line['bid']['arrtime']; |
| 1489 | 2033 | $data['registration'] = $line['bid']['aircraft']['registration']; |
| 1490 | 2034 | |
| 1491 | - if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true; |
|
| 1492 | - if (isset($line['bid']['route']) && $line['bid']['route'] != '') $data['waypoints'] = $line['bid']['route']; // route |
|
| 2035 | + if (isset($value['noarchive']) && $value['noarchive'] === TRUE) { |
|
| 2036 | + $data['noarchive'] = true; |
|
| 2037 | + } |
|
| 2038 | + if (isset($line['bid']['route']) && $line['bid']['route'] != '') { |
|
| 2039 | + $data['waypoints'] = $line['bid']['route']; |
|
| 2040 | + } |
|
| 2041 | + // route |
|
| 1493 | 2042 | $data['aircraft_icao'] = $line['bid']['aircraft']['icao']; |
| 1494 | 2043 | |
| 1495 | 2044 | $data['id_source'] = $id_source; |
| 1496 | 2045 | $data['format_source'] = 'vaos'; |
| 1497 | - if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name']; |
|
| 2046 | + if (isset($value['name']) && $value['name'] != '') { |
|
| 2047 | + $data['source_name'] = $value['name']; |
|
| 2048 | + } |
|
| 1498 | 2049 | $SI->add($data); |
| 1499 | 2050 | unset($data); |
| 1500 | 2051 | } |
| 1501 | - if ($globalDebug) echo 'No more data...'."\n"; |
|
| 2052 | + if ($globalDebug) { |
|
| 2053 | + echo 'No more data...'."\n"; |
|
| 2054 | + } |
|
| 1502 | 2055 | unset($buffer); |
| 1503 | 2056 | unset($all_data); |
| 1504 | 2057 | } |
@@ -1511,7 +2064,9 @@ discard block |
||
| 1511 | 2064 | ) |
| 1512 | 2065 | ) { |
| 1513 | 2066 | //$buffer = $Common->getData($hosts[$id]); |
| 1514 | - if ($globalDebug) echo 'Get Data...'."\n"; |
|
| 2067 | + if ($globalDebug) { |
|
| 2068 | + echo 'Get Data...'."\n"; |
|
| 2069 | + } |
|
| 1515 | 2070 | $buffer = $Common->getData($value['host']); |
| 1516 | 2071 | $all_data = json_decode($buffer,true); |
| 1517 | 2072 | if ($buffer != '' && is_array($all_data)) { |
@@ -1540,16 +2095,25 @@ discard block |
||
| 1540 | 2095 | $data['arrival_airport_icao'] = $line['arrival']; |
| 1541 | 2096 | //$data['arrival_airport_time'] = $line['arrival_time']; |
| 1542 | 2097 | //$data['registration'] = $line['aircraft']; |
| 1543 | - if (isset($line['route'])) $data['waypoints'] = $line['route']; // route |
|
| 2098 | + if (isset($line['route'])) { |
|
| 2099 | + $data['waypoints'] = $line['route']; |
|
| 2100 | + } |
|
| 2101 | + // route |
|
| 1544 | 2102 | $data['aircraft_icao'] = $line['plane_type']; |
| 1545 | 2103 | $data['id_source'] = $id_source; |
| 1546 | 2104 | $data['format_source'] = 'vam'; |
| 1547 | - if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true; |
|
| 1548 | - if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name']; |
|
| 2105 | + if (isset($value['noarchive']) && $value['noarchive'] === TRUE) { |
|
| 2106 | + $data['noarchive'] = true; |
|
| 2107 | + } |
|
| 2108 | + if (isset($value['name']) && $value['name'] != '') { |
|
| 2109 | + $data['source_name'] = $value['name']; |
|
| 2110 | + } |
|
| 1549 | 2111 | $SI->add($data); |
| 1550 | 2112 | unset($data); |
| 1551 | 2113 | } |
| 1552 | - if ($globalDebug) echo 'No more data...'."\n"; |
|
| 2114 | + if ($globalDebug) { |
|
| 2115 | + echo 'No more data...'."\n"; |
|
| 2116 | + } |
|
| 1553 | 2117 | unset($buffer); |
| 1554 | 2118 | unset($all_data); |
| 1555 | 2119 | } |
@@ -1562,7 +2126,9 @@ discard block |
||
| 1562 | 2126 | ) |
| 1563 | 2127 | ) { |
| 1564 | 2128 | //$buffer = $Common->getData($hosts[$id]); |
| 1565 | - if ($globalDebug) echo 'Get Data...'."\n"; |
|
| 2129 | + if ($globalDebug) { |
|
| 2130 | + echo 'Get Data...'."\n"; |
|
| 2131 | + } |
|
| 1566 | 2132 | $buffer = $Common->getData($value['host']); |
| 1567 | 2133 | $all_data = json_decode($buffer,true); |
| 1568 | 2134 | if ($buffer != '') { |
@@ -1580,12 +2146,16 @@ discard block |
||
| 1580 | 2146 | $data['id_source'] = $id_source; |
| 1581 | 2147 | $data['format_source'] = 'blitzortung'; |
| 1582 | 2148 | $SI->add($data); |
| 1583 | - if ($globalDebug) echo '☈ Lightning added'."\n"; |
|
| 2149 | + if ($globalDebug) { |
|
| 2150 | + echo '☈ Lightning added'."\n"; |
|
| 2151 | + } |
|
| 1584 | 2152 | $Source->addLocation('',$data['latitude'],$data['longitude'],0,'','','blitzortung','weather/thunderstorm.png','lightning',$id,0,$data['datetime']); |
| 1585 | 2153 | unset($data); |
| 1586 | 2154 | } |
| 1587 | 2155 | } |
| 1588 | - if ($globalDebug) echo 'No more data...'."\n"; |
|
| 2156 | + if ($globalDebug) { |
|
| 2157 | + echo 'No more data...'."\n"; |
|
| 2158 | + } |
|
| 1589 | 2159 | unset($buffer); |
| 1590 | 2160 | } |
| 1591 | 2161 | $last_exec[$id]['last'] = time(); |
@@ -1614,10 +2184,15 @@ discard block |
||
| 1614 | 2184 | } |
| 1615 | 2185 | } else { |
| 1616 | 2186 | $format = $value['format']; |
| 1617 | - if (isset($tt[$format])) $tt[$format]++; |
|
| 1618 | - else $tt[$format] = 0; |
|
| 2187 | + if (isset($tt[$format])) { |
|
| 2188 | + $tt[$format]++; |
|
| 2189 | + } else { |
|
| 2190 | + $tt[$format] = 0; |
|
| 2191 | + } |
|
| 1619 | 2192 | if ($tt[$format] > 30) { |
| 1620 | - if ($globalDebug) echo 'Reconnect...'."\n"; |
|
| 2193 | + if ($globalDebug) { |
|
| 2194 | + echo 'Reconnect...'."\n"; |
|
| 2195 | + } |
|
| 1621 | 2196 | sleep(2); |
| 1622 | 2197 | //$sourceeen[] = $value; |
| 1623 | 2198 | //connect_all($sourceeen); |
@@ -1634,7 +2209,9 @@ discard block |
||
| 1634 | 2209 | $write = NULL; |
| 1635 | 2210 | $e = NULL; |
| 1636 | 2211 | $n = socket_select($read, $write, $e, $timeout); |
| 1637 | - if ($e != NULL) var_dump($e); |
|
| 2212 | + if ($e != NULL) { |
|
| 2213 | + var_dump($e); |
|
| 2214 | + } |
|
| 1638 | 2215 | if ($n > 0) { |
| 1639 | 2216 | $reset = 0; |
| 1640 | 2217 | foreach ($read as $nb => $r) { |
@@ -1656,13 +2233,17 @@ discard block |
||
| 1656 | 2233 | if ($buffer !== FALSE) { |
| 1657 | 2234 | if ($format === 'vrstcp') { |
| 1658 | 2235 | $buffer = explode('},{',$buffer); |
| 1659 | - } else $buffer=trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'',$buffer)); |
|
| 2236 | + } else { |
|
| 2237 | + $buffer=trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'',$buffer)); |
|
| 2238 | + } |
|
| 1660 | 2239 | } |
| 1661 | 2240 | // SBS format is CSV format |
| 1662 | 2241 | if ($buffer !== FALSE && $buffer !== '') { |
| 1663 | 2242 | $tt[$format] = 0; |
| 1664 | 2243 | if ($format === 'acarssbs3') { |
| 1665 | - if ($globalDebug) echo 'ACARS : '.$buffer."\n"; |
|
| 2244 | + if ($globalDebug) { |
|
| 2245 | + echo 'ACARS : '.$buffer."\n"; |
|
| 2246 | + } |
|
| 1666 | 2247 | $ACARS->add(trim($buffer)); |
| 1667 | 2248 | $ACARS->deleteLiveAcarsData(); |
| 1668 | 2249 | } elseif ($format === 'raw') { |
@@ -1672,9 +2253,15 @@ discard block |
||
| 1672 | 2253 | //if (!empty($data)) print_r($data); |
| 1673 | 2254 | $data['datetime'] = date('Y-m-d H:i:s'); |
| 1674 | 2255 | $data['format_source'] = 'raw'; |
| 1675 | - if (isset($globalSources[$nb]['name']) && $globalSources[$nb]['name'] != '') $data['source_name'] = $globalSources[$nb]['name']; |
|
| 1676 | - if (isset($globalSources[$nb]['sourcestats'])) $data['sourcestats'] = $globalSources[$nb]['sourcestats']; |
|
| 1677 | - if (isset($globalSources[$nb]['noarchive']) && $globalSources[$nb]['noarchive'] === TRUE) $data['noarchive'] = true; |
|
| 2256 | + if (isset($globalSources[$nb]['name']) && $globalSources[$nb]['name'] != '') { |
|
| 2257 | + $data['source_name'] = $globalSources[$nb]['name']; |
|
| 2258 | + } |
|
| 2259 | + if (isset($globalSources[$nb]['sourcestats'])) { |
|
| 2260 | + $data['sourcestats'] = $globalSources[$nb]['sourcestats']; |
|
| 2261 | + } |
|
| 2262 | + if (isset($globalSources[$nb]['noarchive']) && $globalSources[$nb]['noarchive'] === TRUE) { |
|
| 2263 | + $data['noarchive'] = true; |
|
| 2264 | + } |
|
| 1678 | 2265 | //if (($data['latitude'] === '' && $data['longitude'] === '') || (is_numeric($data['latitude']) && is_numeric($data['longitude']))) $SI->add($data); |
| 1679 | 2266 | $SI->add($data); |
| 1680 | 2267 | unset($data); |
@@ -1682,22 +2269,54 @@ discard block |
||
| 1682 | 2269 | } elseif ($format === 'ais') { |
| 1683 | 2270 | $ais_data = $AIS->parse_line(trim($buffer)); |
| 1684 | 2271 | $data = array(); |
| 1685 | - if (isset($ais_data['ident'])) $data['ident'] = $ais_data['ident']; |
|
| 1686 | - if (isset($ais_data['mmsi'])) $data['mmsi'] = substr($ais_data['mmsi'],-9); |
|
| 1687 | - if (isset($ais_data['speed'])) $data['speed'] = $ais_data['speed']; |
|
| 1688 | - if (isset($ais_data['heading'])) $data['heading'] = $ais_data['heading']; |
|
| 1689 | - if (isset($ais_data['latitude'])) $data['latitude'] = $ais_data['latitude']; |
|
| 1690 | - if (isset($ais_data['longitude'])) $data['longitude'] = $ais_data['longitude']; |
|
| 1691 | - if (isset($ais_data['status'])) $data['status'] = $ais_data['status']; |
|
| 1692 | - if (isset($ais_data['statusid'])) $data['status_id'] = $ais_data['statusid']; |
|
| 1693 | - if (isset($ais_data['type'])) $data['type'] = $ais_data['type']; |
|
| 1694 | - if (isset($ais_data['imo'])) $data['imo'] = $ais_data['imo']; |
|
| 1695 | - if (isset($ais_data['callsign'])) $data['callsign'] = $ais_data['callsign']; |
|
| 1696 | - if (isset($ais_data['destination'])) $data['arrival_code'] = $ais_data['destination']; |
|
| 1697 | - if (isset($ais_data['eta_ts'])) $data['arrival_date'] = date('Y-m-d H:i:s',$ais_data['eta_ts']); |
|
| 1698 | - if (isset($globalSources[$nb]['noarchive']) && $globalSources[$nb]['noarchive'] === TRUE) $data['noarchive'] = true; |
|
| 1699 | - if (isset($globalSources[$nb]['name']) && $globalSources[$nb]['name'] != '') $data['source_name'] = $globalSources[$nb]['name']; |
|
| 1700 | - if (isset($globalSources[$nb]['sourcestats'])) $data['sourcestats'] = $globalSources[$nb]['sourcestats']; |
|
| 2272 | + if (isset($ais_data['ident'])) { |
|
| 2273 | + $data['ident'] = $ais_data['ident']; |
|
| 2274 | + } |
|
| 2275 | + if (isset($ais_data['mmsi'])) { |
|
| 2276 | + $data['mmsi'] = substr($ais_data['mmsi'],-9); |
|
| 2277 | + } |
|
| 2278 | + if (isset($ais_data['speed'])) { |
|
| 2279 | + $data['speed'] = $ais_data['speed']; |
|
| 2280 | + } |
|
| 2281 | + if (isset($ais_data['heading'])) { |
|
| 2282 | + $data['heading'] = $ais_data['heading']; |
|
| 2283 | + } |
|
| 2284 | + if (isset($ais_data['latitude'])) { |
|
| 2285 | + $data['latitude'] = $ais_data['latitude']; |
|
| 2286 | + } |
|
| 2287 | + if (isset($ais_data['longitude'])) { |
|
| 2288 | + $data['longitude'] = $ais_data['longitude']; |
|
| 2289 | + } |
|
| 2290 | + if (isset($ais_data['status'])) { |
|
| 2291 | + $data['status'] = $ais_data['status']; |
|
| 2292 | + } |
|
| 2293 | + if (isset($ais_data['statusid'])) { |
|
| 2294 | + $data['status_id'] = $ais_data['statusid']; |
|
| 2295 | + } |
|
| 2296 | + if (isset($ais_data['type'])) { |
|
| 2297 | + $data['type'] = $ais_data['type']; |
|
| 2298 | + } |
|
| 2299 | + if (isset($ais_data['imo'])) { |
|
| 2300 | + $data['imo'] = $ais_data['imo']; |
|
| 2301 | + } |
|
| 2302 | + if (isset($ais_data['callsign'])) { |
|
| 2303 | + $data['callsign'] = $ais_data['callsign']; |
|
| 2304 | + } |
|
| 2305 | + if (isset($ais_data['destination'])) { |
|
| 2306 | + $data['arrival_code'] = $ais_data['destination']; |
|
| 2307 | + } |
|
| 2308 | + if (isset($ais_data['eta_ts'])) { |
|
| 2309 | + $data['arrival_date'] = date('Y-m-d H:i:s',$ais_data['eta_ts']); |
|
| 2310 | + } |
|
| 2311 | + if (isset($globalSources[$nb]['noarchive']) && $globalSources[$nb]['noarchive'] === TRUE) { |
|
| 2312 | + $data['noarchive'] = true; |
|
| 2313 | + } |
|
| 2314 | + if (isset($globalSources[$nb]['name']) && $globalSources[$nb]['name'] != '') { |
|
| 2315 | + $data['source_name'] = $globalSources[$nb]['name']; |
|
| 2316 | + } |
|
| 2317 | + if (isset($globalSources[$nb]['sourcestats'])) { |
|
| 2318 | + $data['sourcestats'] = $globalSources[$nb]['sourcestats']; |
|
| 2319 | + } |
|
| 1701 | 2320 | |
| 1702 | 2321 | if (isset($ais_data['timestamp'])) { |
| 1703 | 2322 | $data['datetime'] = date('Y-m-d H:i:s',$ais_data['timestamp']); |
@@ -1706,7 +2325,9 @@ discard block |
||
| 1706 | 2325 | } |
| 1707 | 2326 | $data['format_source'] = 'aisnmea'; |
| 1708 | 2327 | $data['id_source'] = $id_source; |
| 1709 | - if (isset($ais_data['mmsi_type']) && $ais_data['mmsi_type'] === 'Ship') $MI->add($data); |
|
| 2328 | + if (isset($ais_data['mmsi_type']) && $ais_data['mmsi_type'] === 'Ship') { |
|
| 2329 | + $MI->add($data); |
|
| 2330 | + } |
|
| 1710 | 2331 | unset($data); |
| 1711 | 2332 | } elseif ($format === 'flightgearsp') { |
| 1712 | 2333 | //echo $buffer."\n"; |
@@ -1724,12 +2345,18 @@ discard block |
||
| 1724 | 2345 | $data['speed'] = round($line[5]*1.94384); |
| 1725 | 2346 | $data['datetime'] = date('Y-m-d H:i:s'); |
| 1726 | 2347 | $data['format_source'] = 'flightgearsp'; |
| 1727 | - if (isset($globalSources[$nb]['noarchive']) && $globalSources[$nb]['noarchive'] === TRUE) $data['noarchive'] = true; |
|
| 1728 | - if (($data['latitude'] === '' && $data['longitude'] === '') || (is_numeric($data['latitude']) && is_numeric($data['longitude']))) $SI->add($data); |
|
| 2348 | + if (isset($globalSources[$nb]['noarchive']) && $globalSources[$nb]['noarchive'] === TRUE) { |
|
| 2349 | + $data['noarchive'] = true; |
|
| 2350 | + } |
|
| 2351 | + if (($data['latitude'] === '' && $data['longitude'] === '') || (is_numeric($data['latitude']) && is_numeric($data['longitude']))) { |
|
| 2352 | + $SI->add($data); |
|
| 2353 | + } |
|
| 1729 | 2354 | //$send = @ socket_send( $r , $data_aprs , strlen($data_aprs) , 0 ); |
| 1730 | 2355 | } |
| 1731 | 2356 | } elseif ($format === 'acars') { |
| 1732 | - if ($globalDebug) echo 'ACARS : '.$buffer."\n"; |
|
| 2357 | + if ($globalDebug) { |
|
| 2358 | + echo 'ACARS : '.$buffer."\n"; |
|
| 2359 | + } |
|
| 1733 | 2360 | $ACARS->add(trim($buffer)); |
| 1734 | 2361 | socket_sendto($r, "OK " . $buffer , 100 , 0 , $remote_ip , $remote_port); |
| 1735 | 2362 | $ACARS->deleteLiveAcarsData(); |
@@ -1750,8 +2377,12 @@ discard block |
||
| 1750 | 2377 | $aircraft_type = $line[10]; |
| 1751 | 2378 | $aircraft_type = preg_split(':/:',$aircraft_type); |
| 1752 | 2379 | $data['aircraft_name'] = substr(end($aircraft_type),0,-4); |
| 1753 | - if (isset($globalSources[$nb]['noarchive']) && $globalSources[$nb]['noarchive'] === TRUE) $data['noarchive'] = true; |
|
| 1754 | - if (($data['latitude'] === '' && $data['longitude'] === '') || (is_numeric($data['latitude']) && is_numeric($data['longitude']))) $SI->add($data); |
|
| 2380 | + if (isset($globalSources[$nb]['noarchive']) && $globalSources[$nb]['noarchive'] === TRUE) { |
|
| 2381 | + $data['noarchive'] = true; |
|
| 2382 | + } |
|
| 2383 | + if (($data['latitude'] === '' && $data['longitude'] === '') || (is_numeric($data['latitude']) && is_numeric($data['longitude']))) { |
|
| 2384 | + $SI->add($data); |
|
| 2385 | + } |
|
| 1755 | 2386 | } |
| 1756 | 2387 | } |
| 1757 | 2388 | } elseif ($format === 'beast') { |
@@ -1761,28 +2392,62 @@ discard block |
||
| 1761 | 2392 | foreach($buffer as $all_data) { |
| 1762 | 2393 | $line = json_decode('{'.$all_data.'}',true); |
| 1763 | 2394 | $data = array(); |
| 1764 | - if (isset($line['Icao'])) $data['hex'] = $line['Icao']; // hex |
|
| 1765 | - if (isset($line['Call'])) $data['ident'] = $line['Call']; // ident |
|
| 1766 | - if (isset($line['Alt'])) $data['altitude'] = $line['Alt']; // altitude |
|
| 1767 | - if (isset($line['Spd'])) $data['speed'] = $line['Spd']; // speed |
|
| 1768 | - if (isset($line['Trak'])) $data['heading'] = $line['Trak']; // heading |
|
| 1769 | - if (isset($line['Lat'])) $data['latitude'] = $line['Lat']; // lat |
|
| 1770 | - if (isset($line['Long'])) $data['longitude'] = $line['Long']; // long |
|
| 2395 | + if (isset($line['Icao'])) { |
|
| 2396 | + $data['hex'] = $line['Icao']; |
|
| 2397 | + } |
|
| 2398 | + // hex |
|
| 2399 | + if (isset($line['Call'])) { |
|
| 2400 | + $data['ident'] = $line['Call']; |
|
| 2401 | + } |
|
| 2402 | + // ident |
|
| 2403 | + if (isset($line['Alt'])) { |
|
| 2404 | + $data['altitude'] = $line['Alt']; |
|
| 2405 | + } |
|
| 2406 | + // altitude |
|
| 2407 | + if (isset($line['Spd'])) { |
|
| 2408 | + $data['speed'] = $line['Spd']; |
|
| 2409 | + } |
|
| 2410 | + // speed |
|
| 2411 | + if (isset($line['Trak'])) { |
|
| 2412 | + $data['heading'] = $line['Trak']; |
|
| 2413 | + } |
|
| 2414 | + // heading |
|
| 2415 | + if (isset($line['Lat'])) { |
|
| 2416 | + $data['latitude'] = $line['Lat']; |
|
| 2417 | + } |
|
| 2418 | + // lat |
|
| 2419 | + if (isset($line['Long'])) { |
|
| 2420 | + $data['longitude'] = $line['Long']; |
|
| 2421 | + } |
|
| 2422 | + // long |
|
| 1771 | 2423 | //$data['verticalrate'] = $line['']; // verticale rate |
| 1772 | - if (isset($line['Sqk'])) $data['squawk'] = $line['Sqk']; // squawk |
|
| 2424 | + if (isset($line['Sqk'])) { |
|
| 2425 | + $data['squawk'] = $line['Sqk']; |
|
| 2426 | + } |
|
| 2427 | + // squawk |
|
| 1773 | 2428 | $data['emergency'] = ''; // emergency |
| 1774 | - if (isset($line['Reg'])) $data['registration'] = $line['Reg']; |
|
| 2429 | + if (isset($line['Reg'])) { |
|
| 2430 | + $data['registration'] = $line['Reg']; |
|
| 2431 | + } |
|
| 1775 | 2432 | /* |
| 1776 | 2433 | if (isset($line['PosTime'])) $data['datetime'] = date('Y-m-d H:i:s',$line['PosTime']/1000); |
| 1777 | 2434 | else $data['datetime'] = date('Y-m-d H:i:s'); |
| 1778 | 2435 | */ |
| 1779 | 2436 | $data['datetime'] = date('Y-m-d H:i:s'); |
| 1780 | - if (isset($line['Type'])) $data['aircraft_icao'] = $line['Type']; |
|
| 2437 | + if (isset($line['Type'])) { |
|
| 2438 | + $data['aircraft_icao'] = $line['Type']; |
|
| 2439 | + } |
|
| 1781 | 2440 | $data['format_source'] = 'vrstcp'; |
| 1782 | 2441 | $data['id_source'] = $id_source; |
| 1783 | - if (isset($globalSources[$nb]['noarchive']) && $globalSources[$nb]['noarchive'] === TRUE) $data['noarchive'] = true; |
|
| 1784 | - if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name']; |
|
| 1785 | - if (isset($data['latitude']) && isset($data['hex'])) $SI->add($data); |
|
| 2442 | + if (isset($globalSources[$nb]['noarchive']) && $globalSources[$nb]['noarchive'] === TRUE) { |
|
| 2443 | + $data['noarchive'] = true; |
|
| 2444 | + } |
|
| 2445 | + if (isset($value['name']) && $value['name'] != '') { |
|
| 2446 | + $data['source_name'] = $value['name']; |
|
| 2447 | + } |
|
| 2448 | + if (isset($data['latitude']) && isset($data['hex'])) { |
|
| 2449 | + $SI->add($data); |
|
| 2450 | + } |
|
| 1786 | 2451 | unset($data); |
| 1787 | 2452 | } |
| 1788 | 2453 | } elseif ($format === 'tsv' || substr($buffer,0,4) === 'clock') { |
@@ -1795,22 +2460,46 @@ discard block |
||
| 1795 | 2460 | $data['hex'] = $lined['hexid']; |
| 1796 | 2461 | //$data['datetime'] = date('Y-m-d H:i:s',strtotime($lined['clock']));; |
| 1797 | 2462 | $data['datetime'] = date('Y-m-d H:i:s');; |
| 1798 | - if (isset($lined['ident'])) $data['ident'] = $lined['ident']; |
|
| 1799 | - if (isset($lined['lat'])) $data['latitude'] = $lined['lat']; |
|
| 1800 | - if (isset($lined['lon'])) $data['longitude'] = $lined['lon']; |
|
| 1801 | - if (isset($lined['speed'])) $data['speed'] = $lined['speed']; |
|
| 1802 | - if (isset($lined['squawk'])) $data['squawk'] = $lined['squawk']; |
|
| 1803 | - if (isset($lined['alt'])) $data['altitude'] = $lined['alt']; |
|
| 1804 | - if (isset($lined['heading'])) $data['heading'] = $lined['heading']; |
|
| 2463 | + if (isset($lined['ident'])) { |
|
| 2464 | + $data['ident'] = $lined['ident']; |
|
| 2465 | + } |
|
| 2466 | + if (isset($lined['lat'])) { |
|
| 2467 | + $data['latitude'] = $lined['lat']; |
|
| 2468 | + } |
|
| 2469 | + if (isset($lined['lon'])) { |
|
| 2470 | + $data['longitude'] = $lined['lon']; |
|
| 2471 | + } |
|
| 2472 | + if (isset($lined['speed'])) { |
|
| 2473 | + $data['speed'] = $lined['speed']; |
|
| 2474 | + } |
|
| 2475 | + if (isset($lined['squawk'])) { |
|
| 2476 | + $data['squawk'] = $lined['squawk']; |
|
| 2477 | + } |
|
| 2478 | + if (isset($lined['alt'])) { |
|
| 2479 | + $data['altitude'] = $lined['alt']; |
|
| 2480 | + } |
|
| 2481 | + if (isset($lined['heading'])) { |
|
| 2482 | + $data['heading'] = $lined['heading']; |
|
| 2483 | + } |
|
| 1805 | 2484 | $data['id_source'] = $id_source; |
| 1806 | 2485 | $data['format_source'] = 'tsv'; |
| 1807 | - if (isset($globalSources[$nb]['name']) && $globalSources[$nb]['name'] != '') $data['source_name'] = $globalSources[$nb]['name']; |
|
| 1808 | - if (isset($globalSources[$nb]['sourcestats'])) $data['sourcestats'] = $globalSources[$nb]['sourcestats']; |
|
| 1809 | - if (isset($globalSources[$nb]['noarchive']) && $globalSources[$nb]['noarchive'] === TRUE) $data['noarchive'] = true; |
|
| 1810 | - if (($data['latitude'] === '' && $data['longitude'] === '') || (is_numeric($data['latitude']) && is_numeric($data['longitude']))) $SI->add($data); |
|
| 2486 | + if (isset($globalSources[$nb]['name']) && $globalSources[$nb]['name'] != '') { |
|
| 2487 | + $data['source_name'] = $globalSources[$nb]['name']; |
|
| 2488 | + } |
|
| 2489 | + if (isset($globalSources[$nb]['sourcestats'])) { |
|
| 2490 | + $data['sourcestats'] = $globalSources[$nb]['sourcestats']; |
|
| 2491 | + } |
|
| 2492 | + if (isset($globalSources[$nb]['noarchive']) && $globalSources[$nb]['noarchive'] === TRUE) { |
|
| 2493 | + $data['noarchive'] = true; |
|
| 2494 | + } |
|
| 2495 | + if (($data['latitude'] === '' && $data['longitude'] === '') || (is_numeric($data['latitude']) && is_numeric($data['longitude']))) { |
|
| 2496 | + $SI->add($data); |
|
| 2497 | + } |
|
| 1811 | 2498 | unset($lined); |
| 1812 | 2499 | unset($data); |
| 1813 | - } else $error = true; |
|
| 2500 | + } else { |
|
| 2501 | + $error = true; |
|
| 2502 | + } |
|
| 1814 | 2503 | } elseif ($format === 'aprs' && $use_aprs) { |
| 1815 | 2504 | if ($aprs_connect === 0) { |
| 1816 | 2505 | $send = @ socket_send( $r , $aprs_login , strlen($aprs_login) , 0 ); |
@@ -1836,47 +2525,96 @@ discard block |
||
| 1836 | 2525 | $aprs_last_tx = time(); |
| 1837 | 2526 | $data = array(); |
| 1838 | 2527 | //print_r($line); |
| 1839 | - if (isset($line['address'])) $data['hex'] = $line['address']; |
|
| 1840 | - if (isset($line['mmsi'])) $data['mmsi'] = $line['mmsi']; |
|
| 1841 | - if (isset($line['imo'])) $data['imo'] = $line['imo']; |
|
| 1842 | - if (isset($line['squawk'])) $data['squawk'] = $line['squawk']; |
|
| 1843 | - if (isset($line['arrival_code'])) $data['arrival_code'] = $line['arrival_code']; |
|
| 1844 | - if (isset($line['arrival_date'])) $data['arrival_date'] = $line['arrival_date']; |
|
| 1845 | - if (isset($line['typeid'])) $data['type_id'] = $line['typeid']; |
|
| 1846 | - if (isset($line['statusid'])) $data['status_id'] = $line['statusid']; |
|
| 1847 | - if (isset($line['timestamp'])) $data['datetime'] = date('Y-m-d H:i:s',$line['timestamp']); |
|
| 1848 | - else $data['datetime'] = date('Y-m-d H:i:s'); |
|
| 2528 | + if (isset($line['address'])) { |
|
| 2529 | + $data['hex'] = $line['address']; |
|
| 2530 | + } |
|
| 2531 | + if (isset($line['mmsi'])) { |
|
| 2532 | + $data['mmsi'] = $line['mmsi']; |
|
| 2533 | + } |
|
| 2534 | + if (isset($line['imo'])) { |
|
| 2535 | + $data['imo'] = $line['imo']; |
|
| 2536 | + } |
|
| 2537 | + if (isset($line['squawk'])) { |
|
| 2538 | + $data['squawk'] = $line['squawk']; |
|
| 2539 | + } |
|
| 2540 | + if (isset($line['arrival_code'])) { |
|
| 2541 | + $data['arrival_code'] = $line['arrival_code']; |
|
| 2542 | + } |
|
| 2543 | + if (isset($line['arrival_date'])) { |
|
| 2544 | + $data['arrival_date'] = $line['arrival_date']; |
|
| 2545 | + } |
|
| 2546 | + if (isset($line['typeid'])) { |
|
| 2547 | + $data['type_id'] = $line['typeid']; |
|
| 2548 | + } |
|
| 2549 | + if (isset($line['statusid'])) { |
|
| 2550 | + $data['status_id'] = $line['statusid']; |
|
| 2551 | + } |
|
| 2552 | + if (isset($line['timestamp'])) { |
|
| 2553 | + $data['datetime'] = date('Y-m-d H:i:s',$line['timestamp']); |
|
| 2554 | + } else { |
|
| 2555 | + $data['datetime'] = date('Y-m-d H:i:s'); |
|
| 2556 | + } |
|
| 1849 | 2557 | //$data['datetime'] = date('Y-m-d H:i:s'); |
| 1850 | - if (isset($line['ident'])) $data['ident'] = $line['ident']; |
|
| 2558 | + if (isset($line['ident'])) { |
|
| 2559 | + $data['ident'] = $line['ident']; |
|
| 2560 | + } |
|
| 1851 | 2561 | $data['latitude'] = $line['latitude']; |
| 1852 | 2562 | $data['longitude'] = $line['longitude']; |
| 1853 | 2563 | //$data['verticalrate'] = $line[16]; |
| 1854 | - if (isset($line['speed'])) $data['speed'] = $line['speed']; |
|
| 2564 | + if (isset($line['speed'])) { |
|
| 2565 | + $data['speed'] = $line['speed']; |
|
| 2566 | + } |
|
| 1855 | 2567 | //else $data['speed'] = 0; |
| 1856 | - if (isset($line['altitude'])) $data['altitude'] = $line['altitude']; |
|
| 1857 | - if (isset($line['comment'])) $data['comment'] = $line['comment']; |
|
| 1858 | - if (isset($line['symbol'])) $data['type'] = $line['symbol']; |
|
| 2568 | + if (isset($line['altitude'])) { |
|
| 2569 | + $data['altitude'] = $line['altitude']; |
|
| 2570 | + } |
|
| 2571 | + if (isset($line['comment'])) { |
|
| 2572 | + $data['comment'] = $line['comment']; |
|
| 2573 | + } |
|
| 2574 | + if (isset($line['symbol'])) { |
|
| 2575 | + $data['type'] = $line['symbol']; |
|
| 2576 | + } |
|
| 1859 | 2577 | //if (isset($line['heading'])) $data['heading'] = $line['heading']; |
| 1860 | 2578 | |
| 1861 | - if (isset($line['heading']) && isset($line['format_source'])) $data['heading'] = $line['heading']; |
|
| 2579 | + if (isset($line['heading']) && isset($line['format_source'])) { |
|
| 2580 | + $data['heading'] = $line['heading']; |
|
| 2581 | + } |
|
| 1862 | 2582 | //else echo 'No heading...'."\n"; |
| 1863 | 2583 | //else $data['heading'] = 0; |
| 1864 | - if (isset($line['stealth'])) $data['aircraft_type'] = $line['stealth']; |
|
| 2584 | + if (isset($line['stealth'])) { |
|
| 2585 | + $data['aircraft_type'] = $line['stealth']; |
|
| 2586 | + } |
|
| 1865 | 2587 | //if (!isset($line['source_type']) && (!isset($globalAPRSarchive) || (isset($globalAPRSarchive) && $globalAPRSarchive === FALSE))) $data['noarchive'] = true; |
| 1866 | - if (isset($globalAPRSarchive) && $globalAPRSarchive === FALSE) $data['noarchive'] = true; |
|
| 1867 | - elseif (isset($globalAPRSarchive) && $globalAPRSarchive === TRUE) $data['noarchive'] = false; |
|
| 1868 | - if (isset($globalSources[$nb]['noarchive']) && $globalSources[$nb]['noarchive'] === TRUE) $data['noarchive'] = true; |
|
| 1869 | - elseif (isset($globalSources[$nb]['noarchive']) && $globalSources[$nb]['noarchive'] === FALSE) $data['noarchive'] = false; |
|
| 2588 | + if (isset($globalAPRSarchive) && $globalAPRSarchive === FALSE) { |
|
| 2589 | + $data['noarchive'] = true; |
|
| 2590 | + } elseif (isset($globalAPRSarchive) && $globalAPRSarchive === TRUE) { |
|
| 2591 | + $data['noarchive'] = false; |
|
| 2592 | + } |
|
| 2593 | + if (isset($globalSources[$nb]['noarchive']) && $globalSources[$nb]['noarchive'] === TRUE) { |
|
| 2594 | + $data['noarchive'] = true; |
|
| 2595 | + } elseif (isset($globalSources[$nb]['noarchive']) && $globalSources[$nb]['noarchive'] === FALSE) { |
|
| 2596 | + $data['noarchive'] = false; |
|
| 2597 | + } |
|
| 1870 | 2598 | $data['id_source'] = $id_source; |
| 1871 | - if (isset($line['format_source'])) $data['format_source'] = $line['format_source']; |
|
| 1872 | - else $data['format_source'] = 'aprs'; |
|
| 2599 | + if (isset($line['format_source'])) { |
|
| 2600 | + $data['format_source'] = $line['format_source']; |
|
| 2601 | + } else { |
|
| 2602 | + $data['format_source'] = 'aprs'; |
|
| 2603 | + } |
|
| 1873 | 2604 | $data['source_name'] = $line['source']; |
| 1874 | - if (isset($line['source_type'])) $data['source_type'] = $line['source_type']; |
|
| 1875 | - else $data['source_type'] = 'flarm'; |
|
| 1876 | - if (isset($globalSources[$nb]['sourcestats'])) $data['sourcestats'] = $globalSources[$nb]['sourcestats']; |
|
| 2605 | + if (isset($line['source_type'])) { |
|
| 2606 | + $data['source_type'] = $line['source_type']; |
|
| 2607 | + } else { |
|
| 2608 | + $data['source_type'] = 'flarm'; |
|
| 2609 | + } |
|
| 2610 | + if (isset($globalSources[$nb]['sourcestats'])) { |
|
| 2611 | + $data['sourcestats'] = $globalSources[$nb]['sourcestats']; |
|
| 2612 | + } |
|
| 1877 | 2613 | $currentdate = date('Y-m-d H:i:s'); |
| 1878 | 2614 | $aprsdate = strtotime($data['datetime']); |
| 1879 | - if ($data['source_type'] != 'modes' && $data['source_type'] != 'ais') $data['altitude_relative'] = 'AMSL'; |
|
| 2615 | + if ($data['source_type'] != 'modes' && $data['source_type'] != 'ais') { |
|
| 2616 | + $data['altitude_relative'] = 'AMSL'; |
|
| 2617 | + } |
|
| 1880 | 2618 | // Accept data if time <= system time + 20s |
| 1881 | 2619 | //if (($data['source_type'] === 'modes') || isset($line['stealth']) && ($line['stealth'] === 0 || $line['stealth'] === '') && (strtotime($data['datetime']) <= strtotime($currentdate)+20) && (($data['latitude'] === '' && $data['longitude'] === '') || (is_numeric($data['latitude']) && is_numeric($data['longitude'])))) { |
| 1882 | 2620 | if ( |
@@ -1888,7 +2626,9 @@ discard block |
||
| 1888 | 2626 | $send = $SI->add($data); |
| 1889 | 2627 | } elseif ($data['source_type'] === 'ais') { |
| 1890 | 2628 | $data['type'] = ''; |
| 1891 | - if (isset($globalMarine) && $globalMarine) $send = $MI->add($data); |
|
| 2629 | + if (isset($globalMarine) && $globalMarine) { |
|
| 2630 | + $send = $MI->add($data); |
|
| 2631 | + } |
|
| 1892 | 2632 | } elseif (isset($line['stealth']) && $line['stealth'] != 0) { |
| 1893 | 2633 | echo '-------- '.$data['ident'].' : APRS stealth ON => not adding'."\n"; |
| 1894 | 2634 | } elseif (isset($globalAircraft) && $globalAircraft && isset($line['symbol']) && isset($line['latitude']) && isset($line['longitude']) && ( |
@@ -1896,8 +2636,12 @@ discard block |
||
| 1896 | 2636 | $line['symbol'] === 'Glider' || |
| 1897 | 2637 | $line['symbol'] === 'No. Plane' || |
| 1898 | 2638 | $line['symbol'] === 'Aircraft (small)' || $line['symbol'] === 'Helicopter')) { |
| 1899 | - if ($line['symbol'] === 'Ballon') $data['aircraft_icao'] = 'BALL'; |
|
| 1900 | - if ($line['symbol'] === 'Glider') $data['aircraft_icao'] = 'PARAGLIDER'; |
|
| 2639 | + if ($line['symbol'] === 'Ballon') { |
|
| 2640 | + $data['aircraft_icao'] = 'BALL'; |
|
| 2641 | + } |
|
| 2642 | + if ($line['symbol'] === 'Glider') { |
|
| 2643 | + $data['aircraft_icao'] = 'PARAGLIDER'; |
|
| 2644 | + } |
|
| 1901 | 2645 | $send = $SI->add($data); |
| 1902 | 2646 | } elseif (isset($globalMarine) && $globalMarine && isset($line['symbol']) && isset($line['latitude']) && isset($line['longitude']) && ( |
| 1903 | 2647 | $line['symbol'] === 'Yacht (Sail)' || |
@@ -1928,9 +2672,13 @@ discard block |
||
| 1928 | 2672 | //} elseif (isset($line['symbol']) && isset($line['latitude']) && isset($line['longitude']) && isset($line['speed']) && $line['symbol'] != 'Weather Station' && $line['symbol'] != 'House QTH (VHF)' && $line['symbol'] != 'Dot' && $line['symbol'] != 'TCP-IP' && $line['symbol'] != 'xAPRS (UNIX)' && $line['symbol'] != 'Antenna' && $line['symbol'] != 'Cloudy' && $line['symbol'] != 'HF Gateway' && $line['symbol'] != 'Yagi At QTH' && $line['symbol'] != 'Digi' && $line['symbol'] != '8' && $line['symbol'] != 'MacAPRS') { |
| 1929 | 2673 | // } elseif (isset($line['symbol']) && isset($line['latitude']) && isset($line['longitude']) && $line['symbol'] != 'Weather Station' && $line['symbol'] != 'House QTH (VHF)' && $line['symbol'] != 'Dot' && $line['symbol'] != 'TCP-IP' && $line['symbol'] != 'xAPRS (UNIX)' && $line['symbol'] != 'Antenna' && $line['symbol'] != 'Cloudy' && $line['symbol'] != 'HF Gateway' && $line['symbol'] != 'Yagi At QTH' && $line['symbol'] != 'Digi' && $line['symbol'] != '8' && $line['symbol'] != 'MacAPRS') { |
| 1930 | 2674 | //echo '!!!!!!!!!!!!!!!! SEND !!!!!!!!!!!!!!!!!!!!'."\n"; |
| 1931 | - if (isset($globalTracker) && $globalTracker) $send = $TI->add($data); |
|
| 2675 | + if (isset($globalTracker) && $globalTracker) { |
|
| 2676 | + $send = $TI->add($data); |
|
| 2677 | + } |
|
| 1932 | 2678 | } elseif (!isset($line['stealth']) && is_numeric($data['latitude']) && is_numeric($data['longitude']) && isset($data['ident']) && isset($data['altitude'])) { |
| 1933 | - if (!isset($data['altitude'])) $data['altitude'] = 0; |
|
| 2679 | + if (!isset($data['altitude'])) { |
|
| 2680 | + $data['altitude'] = 0; |
|
| 2681 | + } |
|
| 1934 | 2682 | $Source->deleteOldLocationByType('gs'); |
| 1935 | 2683 | if (count($Source->getLocationInfoByNameType($data['ident'],'gs')) > 0) { |
| 1936 | 2684 | $Source->updateLocation($data['ident'],$data['latitude'],$data['longitude'],$data['altitude'],'','',$data['source_name'],'antenna.png','gs',$id,0,$data['datetime']); |
@@ -1939,7 +2687,9 @@ discard block |
||
| 1939 | 2687 | } |
| 1940 | 2688 | } elseif (isset($line['symbol']) && $line['symbol'] === 'Weather Station') { |
| 1941 | 2689 | //if ($globalDebug) echo '!! Weather Station not yet supported'."\n"; |
| 1942 | - if ($globalDebug) echo '# Weather Station added'."\n"; |
|
| 2690 | + if ($globalDebug) { |
|
| 2691 | + echo '# Weather Station added'."\n"; |
|
| 2692 | + } |
|
| 1943 | 2693 | $Source->deleteOldLocationByType('wx'); |
| 1944 | 2694 | $weather_data = json_encode($line); |
| 1945 | 2695 | if (count($Source->getLocationInfoByNameType($data['ident'],'wx')) > 0) { |
@@ -1949,7 +2699,9 @@ discard block |
||
| 1949 | 2699 | } |
| 1950 | 2700 | } elseif (isset($line['symbol']) && ($line['symbol'] === 'Lightning' || $line['symbol'] === 'Thunderstorm')) { |
| 1951 | 2701 | //if ($globalDebug) echo '!! Weather Station not yet supported'."\n"; |
| 1952 | - if ($globalDebug) echo '☈ Lightning added'."\n"; |
|
| 2702 | + if ($globalDebug) { |
|
| 2703 | + echo '☈ Lightning added'."\n"; |
|
| 2704 | + } |
|
| 1953 | 2705 | $Source->deleteOldLocationByType('lightning'); |
| 1954 | 2706 | if (count($Source->getLocationInfoByNameType($data['ident'],'lightning')) > 0) { |
| 1955 | 2707 | $Source->updateLocation($data['ident'],$data['latitude'],$data['longitude'],0,'','',$data['source_name'],'weather/thunderstorm.png','lightning',$id,0,$data['datetime'],$data['comment']); |
@@ -1961,8 +2713,7 @@ discard block |
||
| 1961 | 2713 | print_r($line); |
| 1962 | 2714 | } |
| 1963 | 2715 | unset($data); |
| 1964 | - } |
|
| 1965 | - elseif (is_array($line) && isset($line['ident']) && $line['ident'] != '') { |
|
| 2716 | + } elseif (is_array($line) && isset($line['ident']) && $line['ident'] != '') { |
|
| 1966 | 2717 | $Source->updateLocationDescByName($line['ident'],$line['source'],$id,$line['comment']); |
| 1967 | 2718 | } |
| 1968 | 2719 | /* |
@@ -1971,7 +2722,9 @@ discard block |
||
| 1971 | 2722 | } |
| 1972 | 2723 | */ |
| 1973 | 2724 | //elseif ($line === false && $globalDebug) echo 'Ignored ('.$buffer.")\n"; |
| 1974 | - elseif ($line === true && $globalDebug) echo '!! Failed : '.$buffer."!!\n"; |
|
| 2725 | + elseif ($line === true && $globalDebug) { |
|
| 2726 | + echo '!! Failed : '.$buffer."!!\n"; |
|
| 2727 | + } |
|
| 1975 | 2728 | if (isset($globalSources[$nb]['last_weather_clean']) && time()-$globalSources[$nb]['last_weather_clean'] > 60*5) { |
| 1976 | 2729 | $Source->deleteOldLocationByType('lightning'); |
| 1977 | 2730 | $Source->deleteOldLocationByType('wx'); |
@@ -2008,27 +2761,47 @@ discard block |
||
| 2008 | 2761 | $data['ground'] = $line[21]; |
| 2009 | 2762 | $data['emergency'] = $line[19]; |
| 2010 | 2763 | $data['format_source'] = 'sbs'; |
| 2011 | - if (isset($globalSources[$nb]['name']) && $globalSources[$nb]['name'] != '') $data['source_name'] = $globalSources[$nb]['name']; |
|
| 2012 | - elseif ($line[0] == 'MLAT') $data['source_name'] = 'MLAT'; |
|
| 2013 | - if (isset($globalSources[$nb]['sourcestats'])) $data['sourcestats'] = $globalSources[$nb]['sourcestats']; |
|
| 2014 | - if (isset($globalSources[$nb]['noarchive']) && $globalSources[$nb]['noarchive'] === TRUE) $data['noarchive'] = true; |
|
| 2764 | + if (isset($globalSources[$nb]['name']) && $globalSources[$nb]['name'] != '') { |
|
| 2765 | + $data['source_name'] = $globalSources[$nb]['name']; |
|
| 2766 | + } elseif ($line[0] == 'MLAT') { |
|
| 2767 | + $data['source_name'] = 'MLAT'; |
|
| 2768 | + } |
|
| 2769 | + if (isset($globalSources[$nb]['sourcestats'])) { |
|
| 2770 | + $data['sourcestats'] = $globalSources[$nb]['sourcestats']; |
|
| 2771 | + } |
|
| 2772 | + if (isset($globalSources[$nb]['noarchive']) && $globalSources[$nb]['noarchive'] === TRUE) { |
|
| 2773 | + $data['noarchive'] = true; |
|
| 2774 | + } |
|
| 2015 | 2775 | $data['id_source'] = $id_source; |
| 2016 | - if (($data['latitude'] === '' && $data['longitude'] === '') || (is_numeric($data['latitude']) && is_numeric($data['longitude']))) $send = $SI->add($data); |
|
| 2017 | - else $error = true; |
|
| 2776 | + if (($data['latitude'] === '' && $data['longitude'] === '') || (is_numeric($data['latitude']) && is_numeric($data['longitude']))) { |
|
| 2777 | + $send = $SI->add($data); |
|
| 2778 | + } else { |
|
| 2779 | + $error = true; |
|
| 2780 | + } |
|
| 2018 | 2781 | unset($data); |
| 2019 | - } else $error = true; |
|
| 2782 | + } else { |
|
| 2783 | + $error = true; |
|
| 2784 | + } |
|
| 2020 | 2785 | if ($error) { |
| 2021 | 2786 | if (count($line) > 1 && ($line[0] === 'STA' || $line[0] === 'AIR' || $line[0] === 'SEL' || $line[0] === 'ID' || $line[0] === 'CLK')) { |
| 2022 | - if ($globalDebug) echo "Not a message. Ignoring... \n"; |
|
| 2787 | + if ($globalDebug) { |
|
| 2788 | + echo "Not a message. Ignoring... \n"; |
|
| 2789 | + } |
|
| 2023 | 2790 | } else { |
| 2024 | - if ($globalDebug) echo "Wrong line format. Ignoring... \n"; |
|
| 2791 | + if ($globalDebug) { |
|
| 2792 | + echo "Wrong line format. Ignoring... \n"; |
|
| 2793 | + } |
|
| 2025 | 2794 | if ($globalDebug) { |
| 2026 | 2795 | echo $buffer; |
| 2027 | 2796 | //print_r($line); |
| 2028 | 2797 | } |
| 2029 | 2798 | //socket_close($r); |
| 2030 | - if ($globalDebug) echo "Reconnect after an error...\n"; |
|
| 2031 | - if ($format === 'aprs') $aprs_connect = 0; |
|
| 2799 | + if ($globalDebug) { |
|
| 2800 | + echo "Reconnect after an error...\n"; |
|
| 2801 | + } |
|
| 2802 | + if ($format === 'aprs') { |
|
| 2803 | + $aprs_connect = 0; |
|
| 2804 | + } |
|
| 2032 | 2805 | $sourceer[$nb] = $globalSources[$nb]; |
| 2033 | 2806 | connect_all($sourceer); |
| 2034 | 2807 | $sourceer = array(); |
@@ -2036,10 +2809,14 @@ discard block |
||
| 2036 | 2809 | } |
| 2037 | 2810 | } |
| 2038 | 2811 | // Sleep for xxx microseconds |
| 2039 | - if (isset($globalSBSSleep)) usleep($globalSBSSleep); |
|
| 2812 | + if (isset($globalSBSSleep)) { |
|
| 2813 | + usleep($globalSBSSleep); |
|
| 2814 | + } |
|
| 2040 | 2815 | } else { |
| 2041 | 2816 | if ($format === 'flightgearmp') { |
| 2042 | - if ($globalDebug) echo "Reconnect FlightGear MP..."; |
|
| 2817 | + if ($globalDebug) { |
|
| 2818 | + echo "Reconnect FlightGear MP..."; |
|
| 2819 | + } |
|
| 2043 | 2820 | //@socket_close($r); |
| 2044 | 2821 | sleep($globalMinFetch); |
| 2045 | 2822 | $sourcefg[$nb] = $globalSources[$nb]; |
@@ -2048,10 +2825,15 @@ discard block |
||
| 2048 | 2825 | break; |
| 2049 | 2826 | |
| 2050 | 2827 | } elseif ($format != 'acars' && $format != 'flightgearsp') { |
| 2051 | - if (isset($tt[$format])) $tt[$format]++; |
|
| 2052 | - else $tt[$format] = 0; |
|
| 2828 | + if (isset($tt[$format])) { |
|
| 2829 | + $tt[$format]++; |
|
| 2830 | + } else { |
|
| 2831 | + $tt[$format] = 0; |
|
| 2832 | + } |
|
| 2053 | 2833 | if ($tt[$format] > 30 || $buffer === FALSE) { |
| 2054 | - if ($globalDebug) echo "ERROR : Reconnect ".$format."..."; |
|
| 2834 | + if ($globalDebug) { |
|
| 2835 | + echo "ERROR : Reconnect ".$format."..."; |
|
| 2836 | + } |
|
| 2055 | 2837 | //@socket_close($r); |
| 2056 | 2838 | sleep(2); |
| 2057 | 2839 | $aprs_connect = 0; |
@@ -2069,11 +2851,17 @@ discard block |
||
| 2069 | 2851 | } else { |
| 2070 | 2852 | $error = socket_strerror(socket_last_error()); |
| 2071 | 2853 | if (($error != SOCKET_EINPROGRESS && $error != SOCKET_EALREADY && $error != 'Success') || (time() - $time >= $timeout && $error != 'Success')) { |
| 2072 | - if ($globalDebug) echo "ERROR : socket_select give this error ".$error . "\n"; |
|
| 2073 | - if (isset($globalDebug)) echo "Restarting...\n"; |
|
| 2854 | + if ($globalDebug) { |
|
| 2855 | + echo "ERROR : socket_select give this error ".$error . "\n"; |
|
| 2856 | + } |
|
| 2857 | + if (isset($globalDebug)) { |
|
| 2858 | + echo "Restarting...\n"; |
|
| 2859 | + } |
|
| 2074 | 2860 | // Restart the script if possible |
| 2075 | 2861 | if (is_array($sockets)) { |
| 2076 | - if ($globalDebug) echo "Shutdown all sockets..."; |
|
| 2862 | + if ($globalDebug) { |
|
| 2863 | + echo "Shutdown all sockets..."; |
|
| 2864 | + } |
|
| 2077 | 2865 | |
| 2078 | 2866 | foreach ($sockets as $sock) { |
| 2079 | 2867 | @socket_shutdown($sock,2); |
@@ -2081,25 +2869,45 @@ discard block |
||
| 2081 | 2869 | } |
| 2082 | 2870 | |
| 2083 | 2871 | } |
| 2084 | - if ($globalDebug) echo "Waiting..."; |
|
| 2872 | + if ($globalDebug) { |
|
| 2873 | + echo "Waiting..."; |
|
| 2874 | + } |
|
| 2085 | 2875 | sleep(2); |
| 2086 | 2876 | $time = time(); |
| 2087 | 2877 | //connect_all($hosts); |
| 2088 | 2878 | $aprs_connect = 0; |
| 2089 | - if ($reset%5 === 0) sleep(20); |
|
| 2090 | - if ($reset%10 === 0) sleep(100); |
|
| 2091 | - if ($reset%20 === 0) sleep(200); |
|
| 2092 | - if ($reset > 100) exit('Too many attempts...'); |
|
| 2093 | - if ($globalDebug) echo "Restart all connections..."; |
|
| 2879 | + if ($reset%5 === 0) { |
|
| 2880 | + sleep(20); |
|
| 2881 | + } |
|
| 2882 | + if ($reset%10 === 0) { |
|
| 2883 | + sleep(100); |
|
| 2884 | + } |
|
| 2885 | + if ($reset%20 === 0) { |
|
| 2886 | + sleep(200); |
|
| 2887 | + } |
|
| 2888 | + if ($reset > 100) { |
|
| 2889 | + exit('Too many attempts...'); |
|
| 2890 | + } |
|
| 2891 | + if ($globalDebug) { |
|
| 2892 | + echo "Restart all connections..."; |
|
| 2893 | + } |
|
| 2094 | 2894 | connect_all($globalSources); |
| 2095 | 2895 | } |
| 2096 | 2896 | } |
| 2097 | 2897 | } |
| 2098 | 2898 | if ($globalDaemon === false) { |
| 2099 | - if ($globalDebug) echo 'Check all...'."\n"; |
|
| 2100 | - if (isset($SI)) $SI->checkAll(); |
|
| 2101 | - if (isset($TI)) $TI->checkAll(); |
|
| 2102 | - if (isset($MI)) $MI->checkAll(); |
|
| 2899 | + if ($globalDebug) { |
|
| 2900 | + echo 'Check all...'."\n"; |
|
| 2901 | + } |
|
| 2902 | + if (isset($SI)) { |
|
| 2903 | + $SI->checkAll(); |
|
| 2904 | + } |
|
| 2905 | + if (isset($TI)) { |
|
| 2906 | + $TI->checkAll(); |
|
| 2907 | + } |
|
| 2908 | + if (isset($MI)) { |
|
| 2909 | + $MI->checkAll(); |
|
| 2910 | + } |
|
| 2103 | 2911 | } |
| 2104 | 2912 | } |
| 2105 | 2913 | } |
@@ -4,12 +4,22 @@ discard block |
||
| 4 | 4 | if (isset($_SESSION['error'])) { |
| 5 | 5 | header('Content-Encoding: none;'); |
| 6 | 6 | echo 'Error : '.$_SESSION['error'].' - Resetting install... You need to fix the problem and run install again.'; |
| 7 | - if (isset($_SESSION['error'])) unset($_SESSION['error']); |
|
| 8 | - if (isset($_SESSION['errorlst'])) unset($_SESSION['errorlst']); |
|
| 9 | - if (isset($_SESSION['next'])) unset($_SESSION['next']); |
|
| 10 | - if (isset($_SESSION['install'])) unset($_SESSION['install']); |
|
| 11 | - if (isset($_SESSION['identitied'])) unset($_SESSION['identified']); |
|
| 12 | -} |
|
| 7 | + if (isset($_SESSION['error'])) { |
|
| 8 | + unset($_SESSION['error']); |
|
| 9 | + } |
|
| 10 | + if (isset($_SESSION['errorlst'])) { |
|
| 11 | + unset($_SESSION['errorlst']); |
|
| 12 | + } |
|
| 13 | + if (isset($_SESSION['next'])) { |
|
| 14 | + unset($_SESSION['next']); |
|
| 15 | + } |
|
| 16 | + if (isset($_SESSION['install'])) { |
|
| 17 | + unset($_SESSION['install']); |
|
| 18 | + } |
|
| 19 | + if (isset($_SESSION['identitied'])) { |
|
| 20 | + unset($_SESSION['identified']); |
|
| 21 | + } |
|
| 22 | + } |
|
| 13 | 23 | /* |
| 14 | 24 | if (isset($_SESSION['errorlst'])) { |
| 15 | 25 | header('Content-Encoding: none;'); |
@@ -131,7 +141,9 @@ discard block |
||
| 131 | 141 | if (count($alllng) != count($availablelng)) { |
| 132 | 142 | $notavailable = array(); |
| 133 | 143 | foreach($alllng as $lng) { |
| 134 | - if (!isset($availablelng[$lng])) $notavailable[] = $lng; |
|
| 144 | + if (!isset($availablelng[$lng])) { |
|
| 145 | + $notavailable[] = $lng; |
|
| 146 | + } |
|
| 135 | 147 | } |
| 136 | 148 | print '<div class="alert alert-warning">The following translation can\'t be used on your system: '.implode(', ',$notavailable).'. You need to add the system locales: <a href="https://github.com/Ysurac/FlightAirMap/wiki/Translation">documentation</a>.</div>'; |
| 137 | 149 | } |
@@ -170,7 +182,10 @@ discard block |
||
| 170 | 182 | <legend>Install script configuration</legend> |
| 171 | 183 | <p> |
| 172 | 184 | <label for="installpass">Install password</label> |
| 173 | - <input type="password" name="installpass" id="installpass" value="<?php if (isset($globalInstallPassword)) print $globalInstallPassword; ?>" /> |
|
| 185 | + <input type="password" name="installpass" id="installpass" value="<?php if (isset($globalInstallPassword)) { |
|
| 186 | + print $globalInstallPassword; |
|
| 187 | +} |
|
| 188 | +?>" /> |
|
| 174 | 189 | </p> |
| 175 | 190 | <p class="help-block">Password needed to access this install script. If empty, to access this script, you will need to change the $globalInstalled setting in require/settings.php to FALSE</p> |
| 176 | 191 | </fieldset> |
@@ -200,31 +215,49 @@ discard block |
||
| 200 | 215 | </div> |
| 201 | 216 | <p> |
| 202 | 217 | <label for="dbhost">Database hostname</label> |
| 203 | - <input type="text" name="dbhost" id="dbhost" value="<?php if (isset($globalDBhost)) print $globalDBhost; ?>" /> |
|
| 218 | + <input type="text" name="dbhost" id="dbhost" value="<?php if (isset($globalDBhost)) { |
|
| 219 | + print $globalDBhost; |
|
| 220 | +} |
|
| 221 | +?>" /> |
|
| 204 | 222 | </p> |
| 205 | 223 | <p> |
| 206 | 224 | <label for="dbport">Database port</label> |
| 207 | - <input type="text" name="dbport" id="dbport" value="<?php if (isset($globalDBport)) print $globalDBport; ?>" /> |
|
| 225 | + <input type="text" name="dbport" id="dbport" value="<?php if (isset($globalDBport)) { |
|
| 226 | + print $globalDBport; |
|
| 227 | +} |
|
| 228 | +?>" /> |
|
| 208 | 229 | <p class="help-block">Default is 3306 for MariaDB/MySQL, 5432 for PostgreSQL</p> |
| 209 | 230 | </p> |
| 210 | 231 | <p> |
| 211 | 232 | <label for="dbname">Database name</label> |
| 212 | - <input type="text" name="dbname" id="dbname" value="<?php if (isset($globalDBname)) print $globalDBname; ?>" /> |
|
| 233 | + <input type="text" name="dbname" id="dbname" value="<?php if (isset($globalDBname)) { |
|
| 234 | + print $globalDBname; |
|
| 235 | +} |
|
| 236 | +?>" /> |
|
| 213 | 237 | </p> |
| 214 | 238 | <p> |
| 215 | 239 | <label for="dbuser">Database user</label> |
| 216 | - <input type="text" name="dbuser" id="dbuser" value="<?php if (isset($globalDBuser)) print $globalDBuser; ?>" /> |
|
| 240 | + <input type="text" name="dbuser" id="dbuser" value="<?php if (isset($globalDBuser)) { |
|
| 241 | + print $globalDBuser; |
|
| 242 | +} |
|
| 243 | +?>" /> |
|
| 217 | 244 | </p> |
| 218 | 245 | <p> |
| 219 | 246 | <label for="dbuserpass">Database user password</label> |
| 220 | - <input type="password" name="dbuserpass" id="dbuserpass" value="<?php if (isset($globalDBpass)) print $globalDBpass; ?>" /> |
|
| 247 | + <input type="password" name="dbuserpass" id="dbuserpass" value="<?php if (isset($globalDBpass)) { |
|
| 248 | + print $globalDBpass; |
|
| 249 | +} |
|
| 250 | +?>" /> |
|
| 221 | 251 | </p> |
| 222 | 252 | </fieldset> |
| 223 | 253 | <fieldset id="site"> |
| 224 | 254 | <legend>Site configuration</legend> |
| 225 | 255 | <p> |
| 226 | 256 | <label for="sitename">Site name</label> |
| 227 | - <input type="text" name="sitename" id="sitename" value="<?php if (isset($globalName)) print $globalName; ?>" /> |
|
| 257 | + <input type="text" name="sitename" id="sitename" value="<?php if (isset($globalName)) { |
|
| 258 | + print $globalName; |
|
| 259 | +} |
|
| 260 | +?>" /> |
|
| 228 | 261 | </p> |
| 229 | 262 | <p> |
| 230 | 263 | <label for="siteurl">Site directory</label> |
@@ -237,18 +270,27 @@ discard block |
||
| 237 | 270 | } |
| 238 | 271 | } |
| 239 | 272 | ?> |
| 240 | - <input type="text" name="siteurl" id="siteurl" value="<?php if (isset($globalURL)) print $globalURL; ?>" /> |
|
| 273 | + <input type="text" name="siteurl" id="siteurl" value="<?php if (isset($globalURL)) { |
|
| 274 | + print $globalURL; |
|
| 275 | +} |
|
| 276 | +?>" /> |
|
| 241 | 277 | <p class="help-block">ex : <i>/flightairmap</i> if complete URL is <i>http://toto.com/flightairmap</i></p> |
| 242 | 278 | <p class="help-block">Can be empty</p> |
| 243 | 279 | </p> |
| 244 | 280 | <p> |
| 245 | 281 | <label for="timezone">Timezone</label> |
| 246 | - <input type="text" name="timezone" id="timezone" value="<?php if (isset($globalTimezone)) print $globalTimezone; ?>" /> |
|
| 282 | + <input type="text" name="timezone" id="timezone" value="<?php if (isset($globalTimezone)) { |
|
| 283 | + print $globalTimezone; |
|
| 284 | +} |
|
| 285 | +?>" /> |
|
| 247 | 286 | <p class="help-block">ex : UTC, Europe/Paris,...</p> |
| 248 | 287 | </p> |
| 249 | 288 | <p> |
| 250 | 289 | <label for="language">Language</label> |
| 251 | - <input type="text" name="language" id="language" value="<?php if (isset($globalLanguage)) print $globalLanguage; ?>" /> |
|
| 290 | + <input type="text" name="language" id="language" value="<?php if (isset($globalLanguage)) { |
|
| 291 | + print $globalLanguage; |
|
| 292 | +} |
|
| 293 | +?>" /> |
|
| 252 | 294 | <p class="help-block">Used only when link to wikipedia for now. Can be EN,DE,FR,...</p> |
| 253 | 295 | </p> |
| 254 | 296 | </fieldset> |
@@ -268,11 +310,17 @@ discard block |
||
| 268 | 310 | <div id="mapbox_data"> |
| 269 | 311 | <p> |
| 270 | 312 | <label for="mapboxid">Mapbox id</label> |
| 271 | - <input type="text" name="mapboxid" id="mapboxid" value="<?php if (isset($globalMapboxId)) print $globalMapboxId; ?>" /> |
|
| 313 | + <input type="text" name="mapboxid" id="mapboxid" value="<?php if (isset($globalMapboxId)) { |
|
| 314 | + print $globalMapboxId; |
|
| 315 | +} |
|
| 316 | +?>" /> |
|
| 272 | 317 | </p> |
| 273 | 318 | <p> |
| 274 | 319 | <label for="mapboxtoken">Mapbox token</label> |
| 275 | - <input type="text" name="mapboxtoken" id="mapboxtoken" value="<?php if (isset($globalMapboxToken)) print $globalMapboxToken; ?>" /> |
|
| 320 | + <input type="text" name="mapboxtoken" id="mapboxtoken" value="<?php if (isset($globalMapboxToken)) { |
|
| 321 | + print $globalMapboxToken; |
|
| 322 | +} |
|
| 323 | +?>" /> |
|
| 276 | 324 | </p> |
| 277 | 325 | <p class="help-block">Get a key <a href="https://www.mapbox.com/developers/">here</a></p> |
| 278 | 326 | </div> |
@@ -280,7 +328,10 @@ discard block |
||
| 280 | 328 | <div id="google_data"> |
| 281 | 329 | <p> |
| 282 | 330 | <label for="googlekey">Google API key</label> |
| 283 | - <input type="text" name="googlekey" id="googlekey" value="<?php if (isset($globalGoogleAPIKey)) print $globalGoogleAPIKey; ?>" /> |
|
| 331 | + <input type="text" name="googlekey" id="googlekey" value="<?php if (isset($globalGoogleAPIKey)) { |
|
| 332 | + print $globalGoogleAPIKey; |
|
| 333 | +} |
|
| 334 | +?>" /> |
|
| 284 | 335 | <p class="help-block">Get a key <a href="https://developers.google.com/maps/documentation/javascript/get-api-key#get-an-api-key">here</a></p> |
| 285 | 336 | </p> |
| 286 | 337 | </div> |
@@ -288,7 +339,10 @@ discard block |
||
| 288 | 339 | <div id="bing_data"> |
| 289 | 340 | <p> |
| 290 | 341 | <label for="bingkey">Bing Map key</label> |
| 291 | - <input type="text" name="bingkey" id="bingkey" value="<?php if (isset($globalBingMapKey)) print $globalBingMapKey; ?>" /> |
|
| 342 | + <input type="text" name="bingkey" id="bingkey" value="<?php if (isset($globalBingMapKey)) { |
|
| 343 | + print $globalBingMapKey; |
|
| 344 | +} |
|
| 345 | +?>" /> |
|
| 292 | 346 | <p class="help-block">Get a key <a href="https://www.bingmapsportal.com/">here</a></p> |
| 293 | 347 | </p> |
| 294 | 348 | </div> |
@@ -296,7 +350,10 @@ discard block |
||
| 296 | 350 | <div id="mapquest_data"> |
| 297 | 351 | <p> |
| 298 | 352 | <label for="mapquestkey">MapQuest key</label> |
| 299 | - <input type="text" name="mapquestkey" id="mapquestkey" value="<?php if (isset($globalMapQuestKey)) print $globalMapQuestKey; ?>" /> |
|
| 353 | + <input type="text" name="mapquestkey" id="mapquestkey" value="<?php if (isset($globalMapQuestKey)) { |
|
| 354 | + print $globalMapQuestKey; |
|
| 355 | +} |
|
| 356 | +?>" /> |
|
| 300 | 357 | <p class="help-block">Get a key <a href="https://developer.mapquest.com/user/me/apps">here</a></p> |
| 301 | 358 | </p> |
| 302 | 359 | </div> |
@@ -304,11 +361,17 @@ discard block |
||
| 304 | 361 | <div id="here_data"> |
| 305 | 362 | <p> |
| 306 | 363 | <label for="hereappid">Here App_Id</label> |
| 307 | - <input type="text" name="hereappid" id="hereappid" value="<?php if (isset($globalHereappId)) print $globalHereappId; ?>" /> |
|
| 364 | + <input type="text" name="hereappid" id="hereappid" value="<?php if (isset($globalHereappId)) { |
|
| 365 | + print $globalHereappId; |
|
| 366 | +} |
|
| 367 | +?>" /> |
|
| 308 | 368 | </p> |
| 309 | 369 | <p> |
| 310 | 370 | <label for="hereappcode">Here App_Code</label> |
| 311 | - <input type="text" name="hereappcode" id="hereappcode" value="<?php if (isset($globalHereappCode)) print $globalHereappCode; ?>" /> |
|
| 371 | + <input type="text" name="hereappcode" id="hereappcode" value="<?php if (isset($globalHereappCode)) { |
|
| 372 | + print $globalHereappCode; |
|
| 373 | +} |
|
| 374 | +?>" /> |
|
| 312 | 375 | </p> |
| 313 | 376 | <p class="help-block">Get a key <a href="https://developer.here.com/rest-apis/documentation/enterprise-map-tile/topics/quick-start.html">here</a></p> |
| 314 | 377 | </div> |
@@ -316,7 +379,10 @@ discard block |
||
| 316 | 379 | <div id="openweathermap_data"> |
| 317 | 380 | <p> |
| 318 | 381 | <label for="openweathermapkey">OpenWeatherMap key (weather layer)</label> |
| 319 | - <input type="text" name="openweathermapkey" id="openweathermapkey" value="<?php if (isset($globalOpenWeatherMapKey)) print $globalOpenWeatherMapKey; ?>" /> |
|
| 382 | + <input type="text" name="openweathermapkey" id="openweathermapkey" value="<?php if (isset($globalOpenWeatherMapKey)) { |
|
| 383 | + print $globalOpenWeatherMapKey; |
|
| 384 | +} |
|
| 385 | +?>" /> |
|
| 320 | 386 | <p class="help-block">Get a key <a href="https://openweathermap.org/">here</a></p> |
| 321 | 387 | </p> |
| 322 | 388 | </div> |
@@ -345,42 +411,86 @@ discard block |
||
| 345 | 411 | <legend>Coverage area</legend> |
| 346 | 412 | <p> |
| 347 | 413 | <label for="latitudemax">The maximum latitude (north)</label> |
| 348 | - <input type="text" name="latitudemax" id="latitudemax" value="<?php if (isset($globalLatitudeMax)) print $globalLatitudeMax; ?>" /> |
|
| 414 | + <input type="text" name="latitudemax" id="latitudemax" value="<?php if (isset($globalLatitudeMax)) { |
|
| 415 | + print $globalLatitudeMax; |
|
| 416 | +} |
|
| 417 | +?>" /> |
|
| 349 | 418 | </p> |
| 350 | 419 | <p> |
| 351 | 420 | <label for="latitudemin">The minimum latitude (south)</label> |
| 352 | - <input type="text" name="latitudemin" id="latitudemin" value="<?php if (isset($globalLatitudeMin)) print $globalLatitudeMin; ?>" /> |
|
| 421 | + <input type="text" name="latitudemin" id="latitudemin" value="<?php if (isset($globalLatitudeMin)) { |
|
| 422 | + print $globalLatitudeMin; |
|
| 423 | +} |
|
| 424 | +?>" /> |
|
| 353 | 425 | </p> |
| 354 | 426 | <p> |
| 355 | 427 | <label for="longitudemax">The maximum longitude (west)</label> |
| 356 | - <input type="text" name="longitudemax" id="longitudemax" value="<?php if (isset($globalLongitudeMax)) print $globalLongitudeMax; ?>" /> |
|
| 428 | + <input type="text" name="longitudemax" id="longitudemax" value="<?php if (isset($globalLongitudeMax)) { |
|
| 429 | + print $globalLongitudeMax; |
|
| 430 | +} |
|
| 431 | +?>" /> |
|
| 357 | 432 | </p> |
| 358 | 433 | <p> |
| 359 | 434 | <label for="longitudemin">The minimum longitude (east)</label> |
| 360 | - <input type="text" name="longitudemin" id="longitudemin" value="<?php if (isset($globalLongitudeMin)) print $globalLongitudeMin; ?>" /> |
|
| 435 | + <input type="text" name="longitudemin" id="longitudemin" value="<?php if (isset($globalLongitudeMin)) { |
|
| 436 | + print $globalLongitudeMin; |
|
| 437 | +} |
|
| 438 | +?>" /> |
|
| 361 | 439 | </p> |
| 362 | 440 | <p> |
| 363 | 441 | <label for="latitudecenter">The latitude center</label> |
| 364 | - <input type="text" name="latitudecenter" id="latitudecenter" value="<?php if (isset($globalCenterLatitude)) print $globalCenterLatitude; ?>" /> |
|
| 442 | + <input type="text" name="latitudecenter" id="latitudecenter" value="<?php if (isset($globalCenterLatitude)) { |
|
| 443 | + print $globalCenterLatitude; |
|
| 444 | +} |
|
| 445 | +?>" /> |
|
| 365 | 446 | </p> |
| 366 | 447 | <p> |
| 367 | 448 | <label for="longitudecenter">The longitude center</label> |
| 368 | - <input type="text" name="longitudecenter" id="longitudecenter" value="<?php if (isset($globalCenterLongitude)) print $globalCenterLongitude; ?>" /> |
|
| 449 | + <input type="text" name="longitudecenter" id="longitudecenter" value="<?php if (isset($globalCenterLongitude)) { |
|
| 450 | + print $globalCenterLongitude; |
|
| 451 | +} |
|
| 452 | +?>" /> |
|
| 369 | 453 | </p> |
| 370 | 454 | <p> |
| 371 | 455 | <label for="livezoom">Default Zoom on live map</label> |
| 372 | - <input type="number" name="livezoom" id="livezoom" value="<?php if (isset($globalLiveZoom)) print $globalLiveZoom; else print '9'; ?>" /> |
|
| 456 | + <input type="number" name="livezoom" id="livezoom" value="<?php if (isset($globalLiveZoom)) { |
|
| 457 | + print $globalLiveZoom; |
|
| 458 | +} else { |
|
| 459 | + print '9'; |
|
| 460 | +} |
|
| 461 | +?>" /> |
|
| 373 | 462 | </p> |
| 374 | 463 | <p> |
| 375 | 464 | <label for="squawk_country">Country for squawk usage</label> |
| 376 | 465 | <select name="squawk_country" id="squawk_country"> |
| 377 | - <option value="UK"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'UK') print ' selected '; ?>>UK</option> |
|
| 378 | - <option value="NZ"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'NZ') print ' selected '; ?>>NZ</option> |
|
| 379 | - <option value="US"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'US') print ' selected '; ?>>US</option> |
|
| 380 | - <option value="AU"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'AU') print ' selected '; ?>>AU</option> |
|
| 381 | - <option value="NL"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'NL') print ' selected '; ?>>NL</option> |
|
| 382 | - <option value="FR"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'FR') print ' selected '; ?>>FR</option> |
|
| 383 | - <option value="TR"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'TR') print ' selected '; ?>>TR</option> |
|
| 466 | + <option value="UK"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'UK') { |
|
| 467 | + print ' selected '; |
|
| 468 | +} |
|
| 469 | +?>>UK</option> |
|
| 470 | + <option value="NZ"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'NZ') { |
|
| 471 | + print ' selected '; |
|
| 472 | +} |
|
| 473 | +?>>NZ</option> |
|
| 474 | + <option value="US"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'US') { |
|
| 475 | + print ' selected '; |
|
| 476 | +} |
|
| 477 | +?>>US</option> |
|
| 478 | + <option value="AU"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'AU') { |
|
| 479 | + print ' selected '; |
|
| 480 | +} |
|
| 481 | +?>>AU</option> |
|
| 482 | + <option value="NL"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'NL') { |
|
| 483 | + print ' selected '; |
|
| 484 | +} |
|
| 485 | +?>>NL</option> |
|
| 486 | + <option value="FR"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'FR') { |
|
| 487 | + print ' selected '; |
|
| 488 | +} |
|
| 489 | +?>>FR</option> |
|
| 490 | + <option value="TR"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'TR') { |
|
| 491 | + print ' selected '; |
|
| 492 | +} |
|
| 493 | +?>>TR</option> |
|
| 384 | 494 | </select> |
| 385 | 495 | </p> |
| 386 | 496 | </fieldset> |
@@ -389,15 +499,24 @@ discard block |
||
| 389 | 499 | <p><i>Only put in DB flights that are inside a circle</i></p> |
| 390 | 500 | <p> |
| 391 | 501 | <label for="latitude">Center latitude</label> |
| 392 | - <input type="text" name="zoilatitude" id="latitude" value="<?php if (isset($globalDistanceIgnore['latitude'])) echo $globalDistanceIgnore['latitude']; ?>" /> |
|
| 502 | + <input type="text" name="zoilatitude" id="latitude" value="<?php if (isset($globalDistanceIgnore['latitude'])) { |
|
| 503 | + echo $globalDistanceIgnore['latitude']; |
|
| 504 | +} |
|
| 505 | +?>" /> |
|
| 393 | 506 | </p> |
| 394 | 507 | <p> |
| 395 | 508 | <label for="longitude">Center longitude</label> |
| 396 | - <input type="text" name="zoilongitude" id="longitude" value="<?php if (isset($globalDistanceIgnore['longitude'])) echo $globalDistanceIgnore['longitude']; ?>" /> |
|
| 509 | + <input type="text" name="zoilongitude" id="longitude" value="<?php if (isset($globalDistanceIgnore['longitude'])) { |
|
| 510 | + echo $globalDistanceIgnore['longitude']; |
|
| 511 | +} |
|
| 512 | +?>" /> |
|
| 397 | 513 | </p> |
| 398 | 514 | <p> |
| 399 | 515 | <label for="Distance">Distance (in km)</label> |
| 400 | - <input type="text" name="zoidistance" id="distance" value="<?php if (isset($globalDistanceIgnore['distance'])) echo $globalDistanceIgnore['distance']; ?>" /> |
|
| 516 | + <input type="text" name="zoidistance" id="distance" value="<?php if (isset($globalDistanceIgnore['distance'])) { |
|
| 517 | + echo $globalDistanceIgnore['distance']; |
|
| 518 | +} |
|
| 519 | +?>" /> |
|
| 401 | 520 | </p> |
| 402 | 521 | </fieldset> |
| 403 | 522 | <fieldset id="sourceloc"> |
@@ -523,22 +642,34 @@ discard block |
||
| 523 | 642 | <div id="flightaware_data"> |
| 524 | 643 | <p> |
| 525 | 644 | <label for="flightawareusername">FlightAware username</label> |
| 526 | - <input type="text" name="flightawareusername" id="flightawareusername" value="<?php if (isset($globalFlightAwareUsername)) print $globalFlightAwareUsername; ?>" /> |
|
| 645 | + <input type="text" name="flightawareusername" id="flightawareusername" value="<?php if (isset($globalFlightAwareUsername)) { |
|
| 646 | + print $globalFlightAwareUsername; |
|
| 647 | +} |
|
| 648 | +?>" /> |
|
| 527 | 649 | </p> |
| 528 | 650 | <p> |
| 529 | 651 | <label for="flightawarepassword">FlightAware password/API key</label> |
| 530 | - <input type="text" name="flightawarepassword" id="flightawarepassword" value="<?php if (isset($globalFlightAwarePassword)) print $globalFlightAwarePassword; ?>" /> |
|
| 652 | + <input type="text" name="flightawarepassword" id="flightawarepassword" value="<?php if (isset($globalFlightAwarePassword)) { |
|
| 653 | + print $globalFlightAwarePassword; |
|
| 654 | +} |
|
| 655 | +?>" /> |
|
| 531 | 656 | </p> |
| 532 | 657 | </div> |
| 533 | 658 | --> |
| 534 | 659 | <div id="sailaway_data"> |
| 535 | 660 | <p> |
| 536 | 661 | <label for="sailawayemail">Sailaway email</label> |
| 537 | - <input type="text" name="sailawayemail" id="sailawayemail" value="<?php if (isset($globalSailaway['email'])) print $globalSailaway['email']; ?>" /> |
|
| 662 | + <input type="text" name="sailawayemail" id="sailawayemail" value="<?php if (isset($globalSailaway['email'])) { |
|
| 663 | + print $globalSailaway['email']; |
|
| 664 | +} |
|
| 665 | +?>" /> |
|
| 538 | 666 | </p> |
| 539 | 667 | <p> |
| 540 | 668 | <label for="sailawaypassword">Sailaway password</label> |
| 541 | - <input type="text" name="sailawaypassword" id="sailawaypassword" value="<?php if (isset($globalSailaway['password'])) print $globalSailaway['password']; ?>" /> |
|
| 669 | + <input type="text" name="sailawaypassword" id="sailawaypassword" value="<?php if (isset($globalSailaway['password'])) { |
|
| 670 | + print $globalSailaway['password']; |
|
| 671 | +} |
|
| 672 | +?>" /> |
|
| 542 | 673 | </p> |
| 543 | 674 | </div> |
| 544 | 675 | |
@@ -580,7 +711,10 @@ discard block |
||
| 580 | 711 | if (filter_var($source['host'],FILTER_VALIDATE_URL)) { |
| 581 | 712 | ?> |
| 582 | 713 | <td><input type="text" name="host[]" value="<?php print $source['host']; ?>" /></td> |
| 583 | - <td><input type="text" name="port[]" class="col-xs-2" value="<?php if (isset($source['port'])) print $source['port']; ?>" /></td> |
|
| 714 | + <td><input type="text" name="port[]" class="col-xs-2" value="<?php if (isset($source['port'])) { |
|
| 715 | + print $source['port']; |
|
| 716 | +} |
|
| 717 | +?>" /></td> |
|
| 584 | 718 | <?php |
| 585 | 719 | } else { |
| 586 | 720 | $hostport = explode(':',$source['host']); |
@@ -599,38 +733,122 @@ discard block |
||
| 599 | 733 | ?> |
| 600 | 734 | <td> |
| 601 | 735 | <select name="format[]"> |
| 602 | - <option value="auto" <?php if (!isset($source['format'])) print 'selected'; ?>>Auto</option> |
|
| 603 | - <option value="sbs" <?php if (isset($source['format']) && $source['format'] == 'sbs') print 'selected'; ?>>SBS</option> |
|
| 604 | - <option value="tsv" <?php if (isset($source['format']) && $source['format'] == 'tsv') print 'selected'; ?>>TSV</option> |
|
| 605 | - <option value="raw" <?php if (isset($source['format']) && $source['format'] == 'raw') print 'selected'; ?>>Raw</option> |
|
| 606 | - <option value="aircraftjson" <?php if (isset($source['format']) && $source['format'] == 'aircraftjson') print 'selected'; ?>>Dump1090 aircraft.json</option> |
|
| 607 | - <option value="planefinderclient" <?php if (isset($source['format']) && $source['format'] == 'planefinderclient') print 'selected'; ?>>Planefinder client</option> |
|
| 608 | - <option value="aprs" <?php if (isset($source['format']) && $source['format'] == 'aprs') print 'selected'; ?>>APRS</option> |
|
| 609 | - <option value="deltadbtxt" <?php if (isset($source['format']) && $source['format'] == 'deltadbtxt') print 'selected'; ?>>Radarcape deltadb.txt</option> |
|
| 610 | - <option value="vatsimtxt" <?php if (isset($source['format']) && $source['format'] == 'vatsimtxt') print 'selected'; ?>>Vatsim</option> |
|
| 611 | - <option value="aircraftlistjson" <?php if (isset($source['format']) && $source['format'] == 'aircraftlistjson') print 'selected'; ?>>Virtual Radar Server AircraftList.json</option> |
|
| 612 | - <option value="vrstcp" <?php if (isset($source['format']) && $source['format'] == 'vrstcp') print 'selected'; ?>>Virtual Radar Server TCP</option> |
|
| 613 | - <option value="phpvmacars" <?php if (isset($source['format']) && $source['format'] == 'phpvmacars') print 'selected'; ?>>phpVMS</option> |
|
| 614 | - <option value="vaos" <?php if (isset($source['format']) && $source['format'] == 'phpvmacars') print 'selected'; ?>>Virtual Airline Operations System (VAOS)</option> |
|
| 615 | - <option value="vam" <?php if (isset($source['format']) && $source['format'] == 'vam') print 'selected'; ?>>Virtual Airlines Manager</option> |
|
| 616 | - <option value="whazzup" <?php if (isset($source['format']) && $source['format'] == 'whazzup') print 'selected'; ?>>IVAO</option> |
|
| 617 | - <option value="flightgearmp" <?php if (isset($source['format']) && $source['format'] == 'flightgearmp') print 'selected'; ?>>FlightGear Multiplayer</option> |
|
| 618 | - <option value="flightgearsp" <?php if (isset($source['format']) && $source['format'] == 'flightgearsp') print 'selected'; ?>>FlightGear Singleplayer</option> |
|
| 619 | - <option value="acars" <?php if (isset($source['format']) && $source['format'] == 'acars') print 'selected'; ?>>ACARS from acarsdec/acarsdeco2 over UDP</option> |
|
| 620 | - <option value="acarssbs3" <?php if (isset($source['format']) && $source['format'] == 'acarssbs3') print 'selected'; ?>>ACARS SBS-3 over TCP</option> |
|
| 621 | - <option value="acarsjson" <?php if (isset($source['format']) && $source['format'] == 'acarsjson') print 'selected'; ?>>ACARS from acarsdec json</option> |
|
| 622 | - <option value="ais" <?php if (isset($source['format']) && $source['format'] == 'ais') print 'selected'; ?>>NMEA AIS over TCP</option> |
|
| 623 | - <option value="airwhere" <?php if (isset($source['format']) && $source['format'] == 'airwhere') print 'selected'; ?>>AirWhere website</option> |
|
| 624 | - <option value="hidnseek_callback" <?php if (isset($source['format']) && $source['format'] == 'hidnseek_callback') print 'selected'; ?>>HidnSeek Callback</option> |
|
| 625 | - <option value="blitzortung" <?php if (isset($source['format']) && $source['format'] == 'blitzortung') print 'selected'; ?>>Blitzortung</option> |
|
| 626 | - <option value="sailaway" <?php if (isset($source['format']) && $source['format'] == 'sailaway') print 'selected'; ?>>Sailaway</option> |
|
| 736 | + <option value="auto" <?php if (!isset($source['format'])) { |
|
| 737 | + print 'selected'; |
|
| 738 | +} |
|
| 739 | +?>>Auto</option> |
|
| 740 | + <option value="sbs" <?php if (isset($source['format']) && $source['format'] == 'sbs') { |
|
| 741 | + print 'selected'; |
|
| 742 | +} |
|
| 743 | +?>>SBS</option> |
|
| 744 | + <option value="tsv" <?php if (isset($source['format']) && $source['format'] == 'tsv') { |
|
| 745 | + print 'selected'; |
|
| 746 | +} |
|
| 747 | +?>>TSV</option> |
|
| 748 | + <option value="raw" <?php if (isset($source['format']) && $source['format'] == 'raw') { |
|
| 749 | + print 'selected'; |
|
| 750 | +} |
|
| 751 | +?>>Raw</option> |
|
| 752 | + <option value="aircraftjson" <?php if (isset($source['format']) && $source['format'] == 'aircraftjson') { |
|
| 753 | + print 'selected'; |
|
| 754 | +} |
|
| 755 | +?>>Dump1090 aircraft.json</option> |
|
| 756 | + <option value="planefinderclient" <?php if (isset($source['format']) && $source['format'] == 'planefinderclient') { |
|
| 757 | + print 'selected'; |
|
| 758 | +} |
|
| 759 | +?>>Planefinder client</option> |
|
| 760 | + <option value="aprs" <?php if (isset($source['format']) && $source['format'] == 'aprs') { |
|
| 761 | + print 'selected'; |
|
| 762 | +} |
|
| 763 | +?>>APRS</option> |
|
| 764 | + <option value="deltadbtxt" <?php if (isset($source['format']) && $source['format'] == 'deltadbtxt') { |
|
| 765 | + print 'selected'; |
|
| 766 | +} |
|
| 767 | +?>>Radarcape deltadb.txt</option> |
|
| 768 | + <option value="vatsimtxt" <?php if (isset($source['format']) && $source['format'] == 'vatsimtxt') { |
|
| 769 | + print 'selected'; |
|
| 770 | +} |
|
| 771 | +?>>Vatsim</option> |
|
| 772 | + <option value="aircraftlistjson" <?php if (isset($source['format']) && $source['format'] == 'aircraftlistjson') { |
|
| 773 | + print 'selected'; |
|
| 774 | +} |
|
| 775 | +?>>Virtual Radar Server AircraftList.json</option> |
|
| 776 | + <option value="vrstcp" <?php if (isset($source['format']) && $source['format'] == 'vrstcp') { |
|
| 777 | + print 'selected'; |
|
| 778 | +} |
|
| 779 | +?>>Virtual Radar Server TCP</option> |
|
| 780 | + <option value="phpvmacars" <?php if (isset($source['format']) && $source['format'] == 'phpvmacars') { |
|
| 781 | + print 'selected'; |
|
| 782 | +} |
|
| 783 | +?>>phpVMS</option> |
|
| 784 | + <option value="vaos" <?php if (isset($source['format']) && $source['format'] == 'phpvmacars') { |
|
| 785 | + print 'selected'; |
|
| 786 | +} |
|
| 787 | +?>>Virtual Airline Operations System (VAOS)</option> |
|
| 788 | + <option value="vam" <?php if (isset($source['format']) && $source['format'] == 'vam') { |
|
| 789 | + print 'selected'; |
|
| 790 | +} |
|
| 791 | +?>>Virtual Airlines Manager</option> |
|
| 792 | + <option value="whazzup" <?php if (isset($source['format']) && $source['format'] == 'whazzup') { |
|
| 793 | + print 'selected'; |
|
| 794 | +} |
|
| 795 | +?>>IVAO</option> |
|
| 796 | + <option value="flightgearmp" <?php if (isset($source['format']) && $source['format'] == 'flightgearmp') { |
|
| 797 | + print 'selected'; |
|
| 798 | +} |
|
| 799 | +?>>FlightGear Multiplayer</option> |
|
| 800 | + <option value="flightgearsp" <?php if (isset($source['format']) && $source['format'] == 'flightgearsp') { |
|
| 801 | + print 'selected'; |
|
| 802 | +} |
|
| 803 | +?>>FlightGear Singleplayer</option> |
|
| 804 | + <option value="acars" <?php if (isset($source['format']) && $source['format'] == 'acars') { |
|
| 805 | + print 'selected'; |
|
| 806 | +} |
|
| 807 | +?>>ACARS from acarsdec/acarsdeco2 over UDP</option> |
|
| 808 | + <option value="acarssbs3" <?php if (isset($source['format']) && $source['format'] == 'acarssbs3') { |
|
| 809 | + print 'selected'; |
|
| 810 | +} |
|
| 811 | +?>>ACARS SBS-3 over TCP</option> |
|
| 812 | + <option value="acarsjson" <?php if (isset($source['format']) && $source['format'] == 'acarsjson') { |
|
| 813 | + print 'selected'; |
|
| 814 | +} |
|
| 815 | +?>>ACARS from acarsdec json</option> |
|
| 816 | + <option value="ais" <?php if (isset($source['format']) && $source['format'] == 'ais') { |
|
| 817 | + print 'selected'; |
|
| 818 | +} |
|
| 819 | +?>>NMEA AIS over TCP</option> |
|
| 820 | + <option value="airwhere" <?php if (isset($source['format']) && $source['format'] == 'airwhere') { |
|
| 821 | + print 'selected'; |
|
| 822 | +} |
|
| 823 | +?>>AirWhere website</option> |
|
| 824 | + <option value="hidnseek_callback" <?php if (isset($source['format']) && $source['format'] == 'hidnseek_callback') { |
|
| 825 | + print 'selected'; |
|
| 826 | +} |
|
| 827 | +?>>HidnSeek Callback</option> |
|
| 828 | + <option value="blitzortung" <?php if (isset($source['format']) && $source['format'] == 'blitzortung') { |
|
| 829 | + print 'selected'; |
|
| 830 | +} |
|
| 831 | +?>>Blitzortung</option> |
|
| 832 | + <option value="sailaway" <?php if (isset($source['format']) && $source['format'] == 'sailaway') { |
|
| 833 | + print 'selected'; |
|
| 834 | +} |
|
| 835 | +?>>Sailaway</option> |
|
| 627 | 836 | </select> |
| 628 | 837 | </td> |
| 629 | 838 | <td> |
| 630 | - <input type="text" name="name[]" value="<?php if (isset($source['name'])) print $source['name']; ?>" /> |
|
| 839 | + <input type="text" name="name[]" value="<?php if (isset($source['name'])) { |
|
| 840 | + print $source['name']; |
|
| 841 | +} |
|
| 842 | +?>" /> |
|
| 631 | 843 | </td> |
| 632 | - <td><input type="checkbox" name="sourcestats[]" title="Create statistics for the source like number of messages, distance,..." value="1" <?php if (isset($source['sourcestats']) && $source['sourcestats']) print 'checked'; ?> /></td> |
|
| 633 | - <td><input type="checkbox" name="noarchive[]" title="Don't archive this source" value="1" <?php if (isset($source['noarchive']) && $source['noarchive']) print 'checked'; ?> /></td> |
|
| 844 | + <td><input type="checkbox" name="sourcestats[]" title="Create statistics for the source like number of messages, distance,..." value="1" <?php if (isset($source['sourcestats']) && $source['sourcestats']) { |
|
| 845 | + print 'checked'; |
|
| 846 | +} |
|
| 847 | +?> /></td> |
|
| 848 | + <td><input type="checkbox" name="noarchive[]" title="Don't archive this source" value="1" <?php if (isset($source['noarchive']) && $source['noarchive']) { |
|
| 849 | + print 'checked'; |
|
| 850 | +} |
|
| 851 | +?> /></td> |
|
| 634 | 852 | <td> |
| 635 | 853 | <select name="timezones[]"> |
| 636 | 854 | <?php |
@@ -640,7 +858,9 @@ discard block |
||
| 640 | 858 | print '<option selected>'.$timezones.'</option>'; |
| 641 | 859 | } elseif (!isset($source['timezone']) && $timezones == 'UTC') { |
| 642 | 860 | print '<option selected>'.$timezones.'</option>'; |
| 643 | - } else print '<option>'.$timezones.'</option>'; |
|
| 861 | + } else { |
|
| 862 | + print '<option>'.$timezones.'</option>'; |
|
| 863 | + } |
|
| 644 | 864 | } |
| 645 | 865 | ?> |
| 646 | 866 | </select> |
@@ -695,7 +915,9 @@ discard block |
||
| 695 | 915 | foreach($timezonelist as $timezones){ |
| 696 | 916 | if ($timezones == 'UTC') { |
| 697 | 917 | print '<option selected>'.$timezones.'</option>'; |
| 698 | - } else print '<option>'.$timezones.'</option>'; |
|
| 918 | + } else { |
|
| 919 | + print '<option>'.$timezones.'</option>'; |
|
| 920 | + } |
|
| 699 | 921 | } |
| 700 | 922 | ?> |
| 701 | 923 | </select> |
@@ -720,11 +942,17 @@ discard block |
||
| 720 | 942 | <p>Listen UDP server for acarsdec/acarsdeco2/... with <i>daemon-acars.php</i> script</p> |
| 721 | 943 | <p> |
| 722 | 944 | <label for="acarshost">ACARS UDP host</label> |
| 723 | - <input type="text" name="acarshost" id="acarshost" value="<?php if (isset($globalACARSHost)) print $globalACARSHost; ?>" /> |
|
| 945 | + <input type="text" name="acarshost" id="acarshost" value="<?php if (isset($globalACARSHost)) { |
|
| 946 | + print $globalACARSHost; |
|
| 947 | +} |
|
| 948 | +?>" /> |
|
| 724 | 949 | </p> |
| 725 | 950 | <p> |
| 726 | 951 | <label for="acarsport">ACARS UDP port</label> |
| 727 | - <input type="number" name="acarsport" id="acarsport" value="<?php if (isset($globalACARSPort)) print $globalACARSPort; ?>" /> |
|
| 952 | + <input type="number" name="acarsport" id="acarsport" value="<?php if (isset($globalACARSPort)) { |
|
| 953 | + print $globalACARSPort; |
|
| 954 | +} |
|
| 955 | +?>" /> |
|
| 728 | 956 | </p> |
| 729 | 957 | <p class="help-block"><i>daemon-acars.php</i> can only be run as daemon. It's an alternate script for ACARS data, <i>daemon-spotter.php</i> may be better.</p> |
| 730 | 958 | </fieldset> |
@@ -751,17 +979,38 @@ discard block |
||
| 751 | 979 | <td><input type="url" name="newsurl[]" value="<?php print $feed; ?>"/></td> |
| 752 | 980 | <td> |
| 753 | 981 | <select name="newslang[]"> |
| 754 | - <option value="en"<?php if ($lng == 'en') print ' selected'; ?>>English</option> |
|
| 755 | - <option value="fr"<?php if ($lng == 'fr') print ' selected'; ?>>French</option> |
|
| 982 | + <option value="en"<?php if ($lng == 'en') { |
|
| 983 | + print ' selected'; |
|
| 984 | +} |
|
| 985 | +?>>English</option> |
|
| 986 | + <option value="fr"<?php if ($lng == 'fr') { |
|
| 987 | + print ' selected'; |
|
| 988 | +} |
|
| 989 | +?>>French</option> |
|
| 756 | 990 | </select> |
| 757 | 991 | </td> |
| 758 | 992 | <td> |
| 759 | 993 | <select name="newstype[]"> |
| 760 | - <option value="global"<?php if ($type == 'global') print ' selected'; ?>>Global</option> |
|
| 761 | - <option value="aircraft"<?php if ($type == 'aircraft') print ' selected'; ?>>Aircraft</option> |
|
| 762 | - <option value="marine"<?php if ($type == 'marine') print ' selected'; ?>>Marine</option> |
|
| 763 | - <option value="tracker"<?php if ($type == 'tracker') print ' selected'; ?>>Tracker</option> |
|
| 764 | - <option value="satellite"<?php if ($type == 'Satellite') print ' selected'; ?>>Satellite</option> |
|
| 994 | + <option value="global"<?php if ($type == 'global') { |
|
| 995 | + print ' selected'; |
|
| 996 | +} |
|
| 997 | +?>>Global</option> |
|
| 998 | + <option value="aircraft"<?php if ($type == 'aircraft') { |
|
| 999 | + print ' selected'; |
|
| 1000 | +} |
|
| 1001 | +?>>Aircraft</option> |
|
| 1002 | + <option value="marine"<?php if ($type == 'marine') { |
|
| 1003 | + print ' selected'; |
|
| 1004 | +} |
|
| 1005 | +?>>Marine</option> |
|
| 1006 | + <option value="tracker"<?php if ($type == 'tracker') { |
|
| 1007 | + print ' selected'; |
|
| 1008 | +} |
|
| 1009 | +?>>Tracker</option> |
|
| 1010 | + <option value="satellite"<?php if ($type == 'Satellite') { |
|
| 1011 | + print ' selected'; |
|
| 1012 | +} |
|
| 1013 | +?>>Satellite</option> |
|
| 765 | 1014 | </select> |
| 766 | 1015 | </td> |
| 767 | 1016 | <td><input type="button" value="Delete" onclick="deleteRowNews(this)" /> <input type="button" value="Add" onclick="insRowNews()" /></td> |
@@ -845,7 +1094,10 @@ discard block |
||
| 845 | 1094 | </p> |
| 846 | 1095 | <p> |
| 847 | 1096 | <label for="corsproxy">CORS proxy</label> |
| 848 | - <input type="text" name="corsproxy" id="corsproxy" value="<?php if (isset($globalCORSproxy)) print $globalCORSproxy; else print 'https://galvanize-cors-proxy.herokuapp.com/' ?>" /> |
|
| 1097 | + <input type="text" name="corsproxy" id="corsproxy" value="<?php if (isset($globalCORSproxy)) { |
|
| 1098 | + print $globalCORSproxy; |
|
| 1099 | +} else { |
|
| 1100 | + print 'https://galvanize-cors-proxy.herokuapp.com/' ?>" /> |
|
| 849 | 1101 | <p class="help-block">CORS proxy used for some WMS servers</p> |
| 850 | 1102 | </p> |
| 851 | 1103 | <!-- |
@@ -908,13 +1160,18 @@ discard block |
||
| 908 | 1160 | <div id="schedules_options"> |
| 909 | 1161 | <p> |
| 910 | 1162 | <label for="britishairways">British Airways API Key</label> |
| 911 | - <input type="text" name="britishairways" id="britishairways" value="<?php if (isset($globalBritishAirwaysKey)) print $globalBritishAirwaysKey; ?>" /> |
|
| 1163 | + <input type="text" name="britishairways" id="britishairways" value="<?php if (isset($globalBritishAirwaysKey)) print $globalBritishAirwaysKey; |
|
| 1164 | +} |
|
| 1165 | +?>" /> |
|
| 912 | 1166 | <p class="help-block">Register an account on <a href="https://developer.ba.com/">https://developer.ba.com/</a></p> |
| 913 | 1167 | </p> |
| 914 | 1168 | <!-- |
| 915 | 1169 | <p> |
| 916 | 1170 | <label for="transavia">Transavia Test API Consumer Key</label> |
| 917 | - <input type="text" name="transavia" id="transavia" value="<?php if (isset($globalTransaviaKey)) print $globalTransaviaKey; ?>" /> |
|
| 1171 | + <input type="text" name="transavia" id="transavia" value="<?php if (isset($globalTransaviaKey)) { |
|
| 1172 | + print $globalTransaviaKey; |
|
| 1173 | +} |
|
| 1174 | +?>" /> |
|
| 918 | 1175 | <p class="help-block">Register an account on <a href="https://developer.transavia.com">https://developer.transavia.com</a></p> |
| 919 | 1176 | </p> |
| 920 | 1177 | --> |
@@ -923,10 +1180,16 @@ discard block |
||
| 923 | 1180 | <b>Lufthansa API Key</b> |
| 924 | 1181 | <p> |
| 925 | 1182 | <label for="lufthansakey">Key</label> |
| 926 | - <input type="text" name="lufthansakey" id="lufthansakey" value="<?php if (isset($globalLufthansaKey['key'])) print $globalLufthansaKey['key']; ?>" /> |
|
| 1183 | + <input type="text" name="lufthansakey" id="lufthansakey" value="<?php if (isset($globalLufthansaKey['key'])) { |
|
| 1184 | + print $globalLufthansaKey['key']; |
|
| 1185 | +} |
|
| 1186 | +?>" /> |
|
| 927 | 1187 | </p><p> |
| 928 | 1188 | <label for="lufthansasecret">Secret</label> |
| 929 | - <input type="text" name="lufthansasecret" id="lufthansasecret" value="<?php if (isset($globalLufthansaKey['secret'])) print $globalLufthansaKey['secret']; ?>" /> |
|
| 1189 | + <input type="text" name="lufthansasecret" id="lufthansasecret" value="<?php if (isset($globalLufthansaKey['secret'])) { |
|
| 1190 | + print $globalLufthansaKey['secret']; |
|
| 1191 | +} |
|
| 1192 | +?>" /> |
|
| 930 | 1193 | </p> |
| 931 | 1194 | </div> |
| 932 | 1195 | <p class="help-block">Register an account on <a href="https://developer.lufthansa.com/page">https://developer.lufthansa.com/page</a></p> |
@@ -936,11 +1199,17 @@ discard block |
||
| 936 | 1199 | <b>FlightAware API Key</b> |
| 937 | 1200 | <p> |
| 938 | 1201 | <label for="flightawareusername">Username</label> |
| 939 | - <input type="text" name="flightawareusername" id="flightawareusername" value="<?php if (isset($globalFlightAwareUsername)) print $globalFlightAwareUsername; ?>" /> |
|
| 1202 | + <input type="text" name="flightawareusername" id="flightawareusername" value="<?php if (isset($globalFlightAwareUsername)) { |
|
| 1203 | + print $globalFlightAwareUsername; |
|
| 1204 | +} |
|
| 1205 | +?>" /> |
|
| 940 | 1206 | </p> |
| 941 | 1207 | <p> |
| 942 | 1208 | <label for="flightawarepassword">API key</label> |
| 943 | - <input type="text" name="flightawarepassword" id="flightawarepassword" value="<?php if (isset($globalFlightAwarePassword)) print $globalFlightAwarePassword; ?>" /> |
|
| 1209 | + <input type="text" name="flightawarepassword" id="flightawarepassword" value="<?php if (isset($globalFlightAwarePassword)) { |
|
| 1210 | + print $globalFlightAwarePassword; |
|
| 1211 | +} |
|
| 1212 | +?>" /> |
|
| 944 | 1213 | </p> |
| 945 | 1214 | </div> |
| 946 | 1215 | <p class="help-block">Register an account on <a href="https://www.flightaware.com/">https://www.flightaware.com/</a></p> |
@@ -957,10 +1226,22 @@ discard block |
||
| 957 | 1226 | <p> |
| 958 | 1227 | <label for="mapmatchingsource">Map Matching source</label> |
| 959 | 1228 | <select name="mapmatchingsource" id="mapmatchingsource"> |
| 960 | - <option value="fam" <?php if ((isset($globalMapMatchingSource) && $globalMapMatchingSource == 'fam') || !isset($globalMatchingSource)) print 'selected="selected" '; ?>>FlightAirMap Map Matching</option> |
|
| 961 | - <option value="graphhopper" <?php if (isset($globalMapMatchingSource) && $globalMapMatchingSource == 'graphhopper') print 'selected="selected" '; ?>>GraphHopper</option> |
|
| 962 | - <option value="osmr" <?php if (isset($globalMapMatchingSource) && $globalMapMatchingSource == 'osmr') print 'selected="selected" '; ?>>OSMR</option> |
|
| 963 | - <option value="mapbox" <?php if (isset($globalMapMatchingSource) && $globalMapMatchingSource == 'mapbox') print 'selected="selected" '; ?>>Mapbox</option> |
|
| 1229 | + <option value="fam" <?php if ((isset($globalMapMatchingSource) && $globalMapMatchingSource == 'fam') || !isset($globalMatchingSource)) { |
|
| 1230 | + print 'selected="selected" '; |
|
| 1231 | +} |
|
| 1232 | +?>>FlightAirMap Map Matching</option> |
|
| 1233 | + <option value="graphhopper" <?php if (isset($globalMapMatchingSource) && $globalMapMatchingSource == 'graphhopper') { |
|
| 1234 | + print 'selected="selected" '; |
|
| 1235 | +} |
|
| 1236 | +?>>GraphHopper</option> |
|
| 1237 | + <option value="osmr" <?php if (isset($globalMapMatchingSource) && $globalMapMatchingSource == 'osmr') { |
|
| 1238 | + print 'selected="selected" '; |
|
| 1239 | +} |
|
| 1240 | +?>>OSMR</option> |
|
| 1241 | + <option value="mapbox" <?php if (isset($globalMapMatchingSource) && $globalMapMatchingSource == 'mapbox') { |
|
| 1242 | + print 'selected="selected" '; |
|
| 1243 | +} |
|
| 1244 | +?>>Mapbox</option> |
|
| 964 | 1245 | </select> |
| 965 | 1246 | <p class="help-block">Mapbox need the API Key defined in map section.</p> |
| 966 | 1247 | <p class="help-block">FlightAirMap Map Matching is free, without API key but limited to about 100 input points to keep fast results.</p> |
@@ -968,7 +1249,10 @@ discard block |
||
| 968 | 1249 | <br /> |
| 969 | 1250 | <p> |
| 970 | 1251 | <label for="graphhopper">GraphHopper API Key</label> |
| 971 | - <input type="text" name="graphhopper" id="graphhopper" value="<?php if (isset($globalGraphHopperKey)) print $globalGraphHopperKey; ?>" /> |
|
| 1252 | + <input type="text" name="graphhopper" id="graphhopper" value="<?php if (isset($globalGraphHopperKey)) { |
|
| 1253 | + print $globalGraphHopperKey; |
|
| 1254 | +} |
|
| 1255 | +?>" /> |
|
| 972 | 1256 | <p class="help-block">Register an account on <a href="https://www.graphhopper.com/">https://www.graphhopper.com/</a></p> |
| 973 | 1257 | </p> |
| 974 | 1258 | </div> |
@@ -986,7 +1270,10 @@ discard block |
||
| 986 | 1270 | </p> |
| 987 | 1271 | <p> |
| 988 | 1272 | <label for="notamsource">URL of your feed from notaminfo.com</label> |
| 989 | - <input type="text" name="notamsource" id="notamsource" value="<?php if (isset($globalNOTAMSource)) print $globalNOTAMSource; ?>" /> |
|
| 1273 | + <input type="text" name="notamsource" id="notamsource" value="<?php if (isset($globalNOTAMSource)) { |
|
| 1274 | + print $globalNOTAMSource; |
|
| 1275 | +} |
|
| 1276 | +?>" /> |
|
| 990 | 1277 | <p class="help-block">If you want to use world NOTAM from FlightAirMap website, leave it blank</p> |
| 991 | 1278 | </p> |
| 992 | 1279 | <br /> |
@@ -1002,14 +1289,20 @@ discard block |
||
| 1002 | 1289 | <div id="metarsrc"> |
| 1003 | 1290 | <p> |
| 1004 | 1291 | <label for="metarsource">URL of your METAR source</label> |
| 1005 | - <input type="text" name="metarsource" id="metarsource" value="<?php if (isset($globalMETARurl)) print $globalMETARurl; ?>" /> |
|
| 1292 | + <input type="text" name="metarsource" id="metarsource" value="<?php if (isset($globalMETARurl)) { |
|
| 1293 | + print $globalMETARurl; |
|
| 1294 | +} |
|
| 1295 | +?>" /> |
|
| 1006 | 1296 | <p class="help-block">Use {icao} to specify where we replace by airport icao. ex : http://metar.vatsim.net/metar.php?id={icao}</p> |
| 1007 | 1297 | </p> |
| 1008 | 1298 | </div> |
| 1009 | 1299 | <br /> |
| 1010 | 1300 | <p> |
| 1011 | 1301 | <label for="bitly">Bit.ly access token api (used in search page)</label> |
| 1012 | - <input type="text" name="bitly" id="bitly" value="<?php if (isset($globalBitlyAccessToken)) print $globalBitlyAccessToken; ?>" /> |
|
| 1302 | + <input type="text" name="bitly" id="bitly" value="<?php if (isset($globalBitlyAccessToken)) { |
|
| 1303 | + print $globalBitlyAccessToken; |
|
| 1304 | +} |
|
| 1305 | +?>" /> |
|
| 1013 | 1306 | </p> |
| 1014 | 1307 | <br /> |
| 1015 | 1308 | <p> |
@@ -1025,11 +1318,26 @@ discard block |
||
| 1025 | 1318 | <p> |
| 1026 | 1319 | <label for="geoid_source">Geoid Source</label> |
| 1027 | 1320 | <select name="geoid_source" id="geoid_source"> |
| 1028 | - <option value="egm96-15"<?php if (isset($globalGeoidSource) && $globalGeoidSource == 'egm96-15') print ' selected="selected"'; ?>>EGM96 15' (2.1MB)</option> |
|
| 1029 | - <option value="egm96-5"<?php if (isset($globalGeoidSource) && $globalGeoidSource == 'egm96-5') print ' selected="selected"'; ?>>EGM96 5' (19MB)</option> |
|
| 1030 | - <option value="egm2008-5"<?php if (isset($globalGeoidSource) && $globalGeoidSource == 'egm2008-5') print ' selected="selected"'; ?>>EGM2008 5' (19MB)</option> |
|
| 1031 | - <option value="egm2008-2_5"<?php if (isset($globalGeoidSource) && $globalGeoidSource == 'egm2008-2_5') print ' selected="selected"'; ?>>EGM2008 2.5' (75MB)</option> |
|
| 1032 | - <option value="egm2008-1"<?php if (isset($globalGeoidSource) && $globalGeoidSource == 'egm2008-1') print ' selected="selected"'; ?>>EGM2008 1' (470MB)</option> |
|
| 1321 | + <option value="egm96-15"<?php if (isset($globalGeoidSource) && $globalGeoidSource == 'egm96-15') { |
|
| 1322 | + print ' selected="selected"'; |
|
| 1323 | +} |
|
| 1324 | +?>>EGM96 15' (2.1MB)</option> |
|
| 1325 | + <option value="egm96-5"<?php if (isset($globalGeoidSource) && $globalGeoidSource == 'egm96-5') { |
|
| 1326 | + print ' selected="selected"'; |
|
| 1327 | +} |
|
| 1328 | +?>>EGM96 5' (19MB)</option> |
|
| 1329 | + <option value="egm2008-5"<?php if (isset($globalGeoidSource) && $globalGeoidSource == 'egm2008-5') { |
|
| 1330 | + print ' selected="selected"'; |
|
| 1331 | +} |
|
| 1332 | +?>>EGM2008 5' (19MB)</option> |
|
| 1333 | + <option value="egm2008-2_5"<?php if (isset($globalGeoidSource) && $globalGeoidSource == 'egm2008-2_5') { |
|
| 1334 | + print ' selected="selected"'; |
|
| 1335 | +} |
|
| 1336 | +?>>EGM2008 2.5' (75MB)</option> |
|
| 1337 | + <option value="egm2008-1"<?php if (isset($globalGeoidSource) && $globalGeoidSource == 'egm2008-1') { |
|
| 1338 | + print ' selected="selected"'; |
|
| 1339 | +} |
|
| 1340 | +?>>EGM2008 1' (470MB)</option> |
|
| 1033 | 1341 | </select> |
| 1034 | 1342 | <p class="help-block">The geoid is approximated by an "earth gravity model" (EGM).</p> |
| 1035 | 1343 | </p> |
@@ -1051,7 +1359,12 @@ discard block |
||
| 1051 | 1359 | </p> |
| 1052 | 1360 | <p> |
| 1053 | 1361 | <label for="archivemonths">Generate statistics, delete or put in archive flights older than xx months</label> |
| 1054 | - <input type="number" name="archivemonths" id="archivemonths" value="<?php if (isset($globalArchiveMonths)) print $globalArchiveMonths; else echo '1'; ?>" /> |
|
| 1362 | + <input type="number" name="archivemonths" id="archivemonths" value="<?php if (isset($globalArchiveMonths)) { |
|
| 1363 | + print $globalArchiveMonths; |
|
| 1364 | +} else { |
|
| 1365 | + echo '1'; |
|
| 1366 | +} |
|
| 1367 | +?>" /> |
|
| 1055 | 1368 | <p class="help-block">0 to disable, delete old flight if <i>Archive all flights data</i> is disabled</p> |
| 1056 | 1369 | </p> |
| 1057 | 1370 | <p> |
@@ -1061,12 +1374,22 @@ discard block |
||
| 1061 | 1374 | </p> |
| 1062 | 1375 | <p> |
| 1063 | 1376 | <label for="archivekeepmonths">Keep flights data for xx months in archive</label> |
| 1064 | - <input type="number" name="archivekeepmonths" id="archivekeepmonths" value="<?php if (isset($globalArchiveKeepMonths)) print $globalArchiveKeepMonths; else echo '1'; ?>" /> |
|
| 1377 | + <input type="number" name="archivekeepmonths" id="archivekeepmonths" value="<?php if (isset($globalArchiveKeepMonths)) { |
|
| 1378 | + print $globalArchiveKeepMonths; |
|
| 1379 | +} else { |
|
| 1380 | + echo '1'; |
|
| 1381 | +} |
|
| 1382 | +?>" /> |
|
| 1065 | 1383 | <p class="help-block">0 to disable</p> |
| 1066 | 1384 | </p> |
| 1067 | 1385 | <p> |
| 1068 | 1386 | <label for="archivekeeptrackmonths">Keep flights track data for xx months in archive</label> |
| 1069 | - <input type="number" name="archivekeeptrackmonths" id="archivekeeptrackmonths" value="<?php if (isset($globalArchiveKeepTrackMonths)) print $globalArchiveKeepTrackMonths; else echo '1'; ?>" /> |
|
| 1387 | + <input type="number" name="archivekeeptrackmonths" id="archivekeeptrackmonths" value="<?php if (isset($globalArchiveKeepTrackMonths)) { |
|
| 1388 | + print $globalArchiveKeepTrackMonths; |
|
| 1389 | +} else { |
|
| 1390 | + echo '1'; |
|
| 1391 | +} |
|
| 1392 | +?>" /> |
|
| 1070 | 1393 | <p class="help-block">0 to disable, should be less or egal to <i>Keep flights data</i> value</p> |
| 1071 | 1394 | </p> |
| 1072 | 1395 | <br /> |
@@ -1076,7 +1399,12 @@ discard block |
||
| 1076 | 1399 | <p class="help-block">Uncheck if the script is running as cron job. You should always run it as daemon when it's possible.</p> |
| 1077 | 1400 | <div id="cronends"> |
| 1078 | 1401 | <label for="cronend">Run script for xx seconds</label> |
| 1079 | - <input type="number" name="cronend" id="cronend" value="<?php if (isset($globalCronEnd)) print $globalCronEnd; else print '0'; ?>" /> |
|
| 1402 | + <input type="number" name="cronend" id="cronend" value="<?php if (isset($globalCronEnd)) { |
|
| 1403 | + print $globalCronEnd; |
|
| 1404 | +} else { |
|
| 1405 | + print '0'; |
|
| 1406 | +} |
|
| 1407 | +?>" /> |
|
| 1080 | 1408 | <p class="help-block">Set to 0 to disable. Should be disabled if source is URL.</p> |
| 1081 | 1409 | </div> |
| 1082 | 1410 | </p> |
@@ -1135,20 +1463,40 @@ discard block |
||
| 1135 | 1463 | <br /> |
| 1136 | 1464 | <p> |
| 1137 | 1465 | <label for="refresh">Show flights detected since xxx seconds</label> |
| 1138 | - <input type="number" name="refresh" id="refresh" value="<?php if (isset($globalLiveInterval)) echo $globalLiveInterval; else echo '200'; ?>" /> |
|
| 1466 | + <input type="number" name="refresh" id="refresh" value="<?php if (isset($globalLiveInterval)) { |
|
| 1467 | + echo $globalLiveInterval; |
|
| 1468 | +} else { |
|
| 1469 | + echo '200'; |
|
| 1470 | +} |
|
| 1471 | +?>" /> |
|
| 1139 | 1472 | </p> |
| 1140 | 1473 | <p> |
| 1141 | 1474 | <label for="maprefresh">Live map refresh (in seconds)</label> |
| 1142 | - <input type="number" name="maprefresh" id="maprefresh" value="<?php if (isset($globalMapRefresh)) echo $globalMapRefresh; else echo '30'; ?>" /> |
|
| 1475 | + <input type="number" name="maprefresh" id="maprefresh" value="<?php if (isset($globalMapRefresh)) { |
|
| 1476 | + echo $globalMapRefresh; |
|
| 1477 | +} else { |
|
| 1478 | + echo '30'; |
|
| 1479 | +} |
|
| 1480 | +?>" /> |
|
| 1143 | 1481 | </p> |
| 1144 | 1482 | <p> |
| 1145 | 1483 | <label for="mapidle">Map idle timeout (in minutes)</label> |
| 1146 | - <input type="number" name="mapidle" id="mapidle" value="<?php if (isset($globalMapIdleTimeout)) echo $globalMapIdleTimeout; else echo '30'; ?>" /> |
|
| 1484 | + <input type="number" name="mapidle" id="mapidle" value="<?php if (isset($globalMapIdleTimeout)) { |
|
| 1485 | + echo $globalMapIdleTimeout; |
|
| 1486 | +} else { |
|
| 1487 | + echo '30'; |
|
| 1488 | +} |
|
| 1489 | +?>" /> |
|
| 1147 | 1490 | <p class="help-block">0 to disable</p> |
| 1148 | 1491 | </p> |
| 1149 | 1492 | <p> |
| 1150 | 1493 | <label for="minfetch">HTTP/file source fetch every xxx seconds</label> |
| 1151 | - <input type="number" name="minfetch" id="minfetch" value="<?php if (isset($globalMinFetch)) echo $globalMinFetch; else echo '20'; ?>" /> |
|
| 1494 | + <input type="number" name="minfetch" id="minfetch" value="<?php if (isset($globalMinFetch)) { |
|
| 1495 | + echo $globalMinFetch; |
|
| 1496 | +} else { |
|
| 1497 | + echo '20'; |
|
| 1498 | +} |
|
| 1499 | +?>" /> |
|
| 1152 | 1500 | </p> |
| 1153 | 1501 | <p> |
| 1154 | 1502 | <label for="bbox">Only display flights that we can see on screen (bounding box)</label> |
@@ -1167,12 +1515,20 @@ discard block |
||
| 1167 | 1515 | <br /> |
| 1168 | 1516 | <p> |
| 1169 | 1517 | <label for="closestmindist">Distance to airport set as arrival (in km)</label> |
| 1170 | - <input type="number" name="closestmindist" id="closestmindist" value="<?php if (isset($globalClosestMinDist)) echo $globalClosestMinDist; else echo '50'; ?>" /> |
|
| 1518 | + <input type="number" name="closestmindist" id="closestmindist" value="<?php if (isset($globalClosestMinDist)) { |
|
| 1519 | + echo $globalClosestMinDist; |
|
| 1520 | +} else { |
|
| 1521 | + echo '50'; |
|
| 1522 | +} |
|
| 1523 | +?>" /> |
|
| 1171 | 1524 | </p> |
| 1172 | 1525 | <br /> |
| 1173 | 1526 | <p> |
| 1174 | 1527 | <label for="aircraftsize">Size of aircraft icon on map (default to 30px if zoom > 7 else 15px), empty to default</label> |
| 1175 | - <input type="number" name="aircraftsize" id="aircraftsize" value="<?php if (isset($globalAircraftSize)) echo $globalAircraftSize;?>" /> |
|
| 1528 | + <input type="number" name="aircraftsize" id="aircraftsize" value="<?php if (isset($globalAircraftSize)) { |
|
| 1529 | + echo $globalAircraftSize; |
|
| 1530 | +} |
|
| 1531 | +?>" /> |
|
| 1176 | 1532 | </p> |
| 1177 | 1533 | <br /> |
| 1178 | 1534 | <p> |
@@ -1191,22 +1547,42 @@ discard block |
||
| 1191 | 1547 | <br /> |
| 1192 | 1548 | <p> |
| 1193 | 1549 | <label for="aircrafticoncolor">Color of aircraft icon on map</label> |
| 1194 | - <input type="color" name="aircrafticoncolor" id="aircrafticoncolor" value="#<?php if (isset($globalAircraftIconColor)) echo $globalAircraftIconColor; else echo '1a3151'; ?>" /> |
|
| 1550 | + <input type="color" name="aircrafticoncolor" id="aircrafticoncolor" value="#<?php if (isset($globalAircraftIconColor)) { |
|
| 1551 | + echo $globalAircraftIconColor; |
|
| 1552 | +} else { |
|
| 1553 | + echo '1a3151'; |
|
| 1554 | +} |
|
| 1555 | +?>" /> |
|
| 1195 | 1556 | </p> |
| 1196 | 1557 | <br /> |
| 1197 | 1558 | <p> |
| 1198 | 1559 | <label for="marineiconcolor">Color of marine icon on map</label> |
| 1199 | - <input type="color" name="marineiconcolor" id="marineiconcolor" value="#<?php if (isset($globalMarineIconColor)) echo $globalMarineIconColor; else echo '43d1d8'; ?>" /> |
|
| 1560 | + <input type="color" name="marineiconcolor" id="marineiconcolor" value="#<?php if (isset($globalMarineIconColor)) { |
|
| 1561 | + echo $globalMarineIconColor; |
|
| 1562 | +} else { |
|
| 1563 | + echo '43d1d8'; |
|
| 1564 | +} |
|
| 1565 | +?>" /> |
|
| 1200 | 1566 | </p> |
| 1201 | 1567 | <br /> |
| 1202 | 1568 | <p> |
| 1203 | 1569 | <label for="trackericoncolor">Color of tracker icon on map</label> |
| 1204 | - <input type="color" name="trackericoncolor" id="trackericoncolor" value="#<?php if (isset($globalTrackerIconColor)) echo $globalTrackerIconColor; else echo '1a3151'; ?>" /> |
|
| 1570 | + <input type="color" name="trackericoncolor" id="trackericoncolor" value="#<?php if (isset($globalTrackerIconColor)) { |
|
| 1571 | + echo $globalTrackerIconColor; |
|
| 1572 | +} else { |
|
| 1573 | + echo '1a3151'; |
|
| 1574 | +} |
|
| 1575 | +?>" /> |
|
| 1205 | 1576 | </p> |
| 1206 | 1577 | <br /> |
| 1207 | 1578 | <p> |
| 1208 | 1579 | <label for="satelliteiconcolor">Color of satellite icon on map</label> |
| 1209 | - <input type="color" name="satelliteiconcolor" id="satelliteiconcolor" value="#<?php if (isset($globalSatelliteIconColor)) echo $globalSatelliteIconColor; else echo '1a3151'; ?>" /> |
|
| 1580 | + <input type="color" name="satelliteiconcolor" id="satelliteiconcolor" value="#<?php if (isset($globalSatelliteIconColor)) { |
|
| 1581 | + echo $globalSatelliteIconColor; |
|
| 1582 | +} else { |
|
| 1583 | + echo '1a3151'; |
|
| 1584 | +} |
|
| 1585 | +?>" /> |
|
| 1210 | 1586 | </p> |
| 1211 | 1587 | <?php |
| 1212 | 1588 | if (!is_writable('../cache')) { |
@@ -1230,14 +1606,27 @@ discard block |
||
| 1230 | 1606 | <p> |
| 1231 | 1607 | <label for="airportzoom">Zoom level minimum to see airports icons</label> |
| 1232 | 1608 | <div class="range"> |
| 1233 | - <input type="range" name="airportzoom" id="airportzoom" value="<?php if (isset($globalAirportZoom)) echo $globalAirportZoom; else echo '7'; ?>" /> |
|
| 1234 | - <output id="range"><?php if (isset($globalAirportZoom)) echo $globalAirportZoom; else echo '7'; ?></output> |
|
| 1609 | + <input type="range" name="airportzoom" id="airportzoom" value="<?php if (isset($globalAirportZoom)) { |
|
| 1610 | + echo $globalAirportZoom; |
|
| 1611 | +} else { |
|
| 1612 | + echo '7'; |
|
| 1613 | +} |
|
| 1614 | +?>" /> |
|
| 1615 | + <output id="range"><?php if (isset($globalAirportZoom)) { |
|
| 1616 | + echo $globalAirportZoom; |
|
| 1617 | +} else { |
|
| 1618 | + echo '7'; |
|
| 1619 | +} |
|
| 1620 | +?></output> |
|
| 1235 | 1621 | </div> |
| 1236 | 1622 | </p> |
| 1237 | 1623 | <br /> |
| 1238 | 1624 | <p> |
| 1239 | 1625 | <label for="customcss">Custom CSS web path</label> |
| 1240 | - <input type="text" name="customcss" id="customcss" value="<?php if (isset($globalCustomCSS)) echo $globalCustomCSS; ?>" /> |
|
| 1626 | + <input type="text" name="customcss" id="customcss" value="<?php if (isset($globalCustomCSS)) { |
|
| 1627 | + echo $globalCustomCSS; |
|
| 1628 | +} |
|
| 1629 | +?>" /> |
|
| 1241 | 1630 | </p> |
| 1242 | 1631 | </fieldset> |
| 1243 | 1632 | <input type="submit" name="submit" value="Create/Update database & write setup" /> |
@@ -1267,8 +1656,12 @@ discard block |
||
| 1267 | 1656 | $dbhost = filter_input(INPUT_POST,'dbhost',FILTER_SANITIZE_STRING); |
| 1268 | 1657 | $dbport = filter_input(INPUT_POST,'dbport',FILTER_SANITIZE_STRING); |
| 1269 | 1658 | |
| 1270 | - if ($dbtype == 'mysql' && !extension_loaded('pdo_mysql')) $error .= 'Mysql driver for PDO must be loaded'; |
|
| 1271 | - if ($dbtype == 'pgsql' && !extension_loaded('pdo_pgsql')) $error .= 'PosgreSQL driver for PDO must be loaded'; |
|
| 1659 | + if ($dbtype == 'mysql' && !extension_loaded('pdo_mysql')) { |
|
| 1660 | + $error .= 'Mysql driver for PDO must be loaded'; |
|
| 1661 | + } |
|
| 1662 | + if ($dbtype == 'pgsql' && !extension_loaded('pdo_pgsql')) { |
|
| 1663 | + $error .= 'PosgreSQL driver for PDO must be loaded'; |
|
| 1664 | + } |
|
| 1272 | 1665 | |
| 1273 | 1666 | $_SESSION['database_root'] = $dbroot; |
| 1274 | 1667 | $_SESSION['database_rootpass'] = $dbrootpass; |
@@ -1346,15 +1739,23 @@ discard block |
||
| 1346 | 1739 | $source_city = $_POST['source_city']; |
| 1347 | 1740 | $source_country = $_POST['source_country']; |
| 1348 | 1741 | $source_ref = $_POST['source_ref']; |
| 1349 | - if (isset($source_id)) $source_id = $_POST['source_id']; |
|
| 1350 | - else $source_id = array(); |
|
| 1742 | + if (isset($source_id)) { |
|
| 1743 | + $source_id = $_POST['source_id']; |
|
| 1744 | + } else { |
|
| 1745 | + $source_id = array(); |
|
| 1746 | + } |
|
| 1351 | 1747 | |
| 1352 | 1748 | $sources = array(); |
| 1353 | 1749 | foreach ($source_name as $keys => $name) { |
| 1354 | - if (isset($source_id[$keys])) $sources[] = array('name' => $name,'latitude' => $source_latitude[$keys],'longitude' => $source_longitude[$keys],'altitude' => $source_altitude[$keys],'city' => $source_city[$keys],'country' => $source_country[$keys],'id' => $source_id[$keys],'source' => $source_ref[$keys]); |
|
| 1355 | - else $sources[] = array('name' => $name,'latitude' => $source_latitude[$keys],'longitude' => $source_longitude[$keys],'altitude' => $source_altitude[$keys],'city' => $source_city[$keys],'country' => $source_country[$keys],'source' => $source_ref[$keys]); |
|
| 1750 | + if (isset($source_id[$keys])) { |
|
| 1751 | + $sources[] = array('name' => $name,'latitude' => $source_latitude[$keys],'longitude' => $source_longitude[$keys],'altitude' => $source_altitude[$keys],'city' => $source_city[$keys],'country' => $source_country[$keys],'id' => $source_id[$keys],'source' => $source_ref[$keys]); |
|
| 1752 | + } else { |
|
| 1753 | + $sources[] = array('name' => $name,'latitude' => $source_latitude[$keys],'longitude' => $source_longitude[$keys],'altitude' => $source_altitude[$keys],'city' => $source_city[$keys],'country' => $source_country[$keys],'source' => $source_ref[$keys]); |
|
| 1754 | + } |
|
| 1755 | + } |
|
| 1756 | + if (count($sources) > 0) { |
|
| 1757 | + $_SESSION['sources'] = $sources; |
|
| 1356 | 1758 | } |
| 1357 | - if (count($sources) > 0) $_SESSION['sources'] = $sources; |
|
| 1358 | 1759 | |
| 1359 | 1760 | $newsurl = $_POST['newsurl']; |
| 1360 | 1761 | $newslng = $_POST['newslang']; |
@@ -1367,7 +1768,9 @@ discard block |
||
| 1367 | 1768 | $lng = $newslng[$newskey]; |
| 1368 | 1769 | if (isset($newsfeeds[$type][$lng])) { |
| 1369 | 1770 | $newsfeeds[$type][$lng] = array_merge($newsfeeds[$type][$lng],array($url)); |
| 1370 | - } else $newsfeeds[$type][$lng] = array($url); |
|
| 1771 | + } else { |
|
| 1772 | + $newsfeeds[$type][$lng] = array($url); |
|
| 1773 | + } |
|
| 1371 | 1774 | } |
| 1372 | 1775 | } |
| 1373 | 1776 | $settings = array_merge($settings,array('globalNewsFeeds' => $newsfeeds)); |
@@ -1392,17 +1795,29 @@ discard block |
||
| 1392 | 1795 | $datasource = filter_input(INPUT_POST,'datasource',FILTER_SANITIZE_STRING); |
| 1393 | 1796 | |
| 1394 | 1797 | $globalaircraft = filter_input(INPUT_POST,'globalaircraft',FILTER_SANITIZE_STRING); |
| 1395 | - if ($globalaircraft == 'aircraft') $settings = array_merge($settings,array('globalAircraft' => 'TRUE')); |
|
| 1396 | - else $settings = array_merge($settings,array('globalAircraft' => 'FALSE')); |
|
| 1798 | + if ($globalaircraft == 'aircraft') { |
|
| 1799 | + $settings = array_merge($settings,array('globalAircraft' => 'TRUE')); |
|
| 1800 | + } else { |
|
| 1801 | + $settings = array_merge($settings,array('globalAircraft' => 'FALSE')); |
|
| 1802 | + } |
|
| 1397 | 1803 | $globaltracker = filter_input(INPUT_POST,'globaltracker',FILTER_SANITIZE_STRING); |
| 1398 | - if ($globaltracker == 'tracker') $settings = array_merge($settings,array('globalTracker' => 'TRUE')); |
|
| 1399 | - else $settings = array_merge($settings,array('globalTracker' => 'FALSE')); |
|
| 1804 | + if ($globaltracker == 'tracker') { |
|
| 1805 | + $settings = array_merge($settings,array('globalTracker' => 'TRUE')); |
|
| 1806 | + } else { |
|
| 1807 | + $settings = array_merge($settings,array('globalTracker' => 'FALSE')); |
|
| 1808 | + } |
|
| 1400 | 1809 | $globalmarine = filter_input(INPUT_POST,'globalmarine',FILTER_SANITIZE_STRING); |
| 1401 | - if ($globalmarine == 'marine') $settings = array_merge($settings,array('globalMarine' => 'TRUE')); |
|
| 1402 | - else $settings = array_merge($settings,array('globalMarine' => 'FALSE')); |
|
| 1810 | + if ($globalmarine == 'marine') { |
|
| 1811 | + $settings = array_merge($settings,array('globalMarine' => 'TRUE')); |
|
| 1812 | + } else { |
|
| 1813 | + $settings = array_merge($settings,array('globalMarine' => 'FALSE')); |
|
| 1814 | + } |
|
| 1403 | 1815 | $globalsatellite = filter_input(INPUT_POST,'globalsatellite',FILTER_SANITIZE_STRING); |
| 1404 | - if ($globalsatellite == 'satellite') $settings = array_merge($settings,array('globalSatellite' => 'TRUE')); |
|
| 1405 | - else $settings = array_merge($settings,array('globalSatellite' => 'FALSE')); |
|
| 1816 | + if ($globalsatellite == 'satellite') { |
|
| 1817 | + $settings = array_merge($settings,array('globalSatellite' => 'TRUE')); |
|
| 1818 | + } else { |
|
| 1819 | + $settings = array_merge($settings,array('globalSatellite' => 'FALSE')); |
|
| 1820 | + } |
|
| 1406 | 1821 | |
| 1407 | 1822 | /* |
| 1408 | 1823 | $globalSBS1Hosts = array(); |
@@ -1424,23 +1839,37 @@ discard block |
||
| 1424 | 1839 | $name = $_POST['name']; |
| 1425 | 1840 | $format = $_POST['format']; |
| 1426 | 1841 | $timezones = $_POST['timezones']; |
| 1427 | - if (isset($_POST['sourcestats'])) $sourcestats = $_POST['sourcestats']; |
|
| 1428 | - else $sourcestats = array(); |
|
| 1429 | - if (isset($_POST['noarchive'])) $noarchive = $_POST['noarchive']; |
|
| 1430 | - else $noarchive = array(); |
|
| 1842 | + if (isset($_POST['sourcestats'])) { |
|
| 1843 | + $sourcestats = $_POST['sourcestats']; |
|
| 1844 | + } else { |
|
| 1845 | + $sourcestats = array(); |
|
| 1846 | + } |
|
| 1847 | + if (isset($_POST['noarchive'])) { |
|
| 1848 | + $noarchive = $_POST['noarchive']; |
|
| 1849 | + } else { |
|
| 1850 | + $noarchive = array(); |
|
| 1851 | + } |
|
| 1431 | 1852 | $gSources = array(); |
| 1432 | 1853 | $forcepilots = false; |
| 1433 | 1854 | foreach ($host as $key => $h) { |
| 1434 | - if (isset($sourcestats[$key]) && $sourcestats[$key] == 1) $cov = 'TRUE'; |
|
| 1435 | - else $cov = 'FALSE'; |
|
| 1436 | - if (isset($noarchive[$key]) && $noarchive[$key] == 1) $arch = 'TRUE'; |
|
| 1437 | - else $arch = 'FALSE'; |
|
| 1855 | + if (isset($sourcestats[$key]) && $sourcestats[$key] == 1) { |
|
| 1856 | + $cov = 'TRUE'; |
|
| 1857 | + } else { |
|
| 1858 | + $cov = 'FALSE'; |
|
| 1859 | + } |
|
| 1860 | + if (isset($noarchive[$key]) && $noarchive[$key] == 1) { |
|
| 1861 | + $arch = 'TRUE'; |
|
| 1862 | + } else { |
|
| 1863 | + $arch = 'FALSE'; |
|
| 1864 | + } |
|
| 1438 | 1865 | if (strpos($format[$key],'_callback')) { |
| 1439 | 1866 | $gSources[] = array('host' => $h, 'pass' => $port[$key],'name' => $name[$key],'format' => $format[$key],'sourcestats' => $cov,'noarchive' => $arch,'timezone' => $timezones[$key],'callback' => 'TRUE'); |
| 1440 | 1867 | } elseif ($format[$key] != 'auto' || ($h != '' || $name[$key] != '')) { |
| 1441 | 1868 | $gSources[] = array('host' => $h, 'port' => $port[$key],'name' => $name[$key],'format' => $format[$key],'sourcestats' => $cov,'noarchive' => $arch,'timezone' => $timezones[$key],'callback' => 'FALSE'); |
| 1442 | 1869 | } |
| 1443 | - if ($format[$key] == 'airwhere') $forcepilots = true; |
|
| 1870 | + if ($format[$key] == 'airwhere') { |
|
| 1871 | + $forcepilots = true; |
|
| 1872 | + } |
|
| 1444 | 1873 | } |
| 1445 | 1874 | $settings = array_merge($settings,array('globalSources' => $gSources)); |
| 1446 | 1875 | |
@@ -1471,7 +1900,9 @@ discard block |
||
| 1471 | 1900 | $zoidistance = filter_input(INPUT_POST,'zoidistance',FILTER_SANITIZE_NUMBER_INT); |
| 1472 | 1901 | if ($zoilatitude != '' && $zoilongitude != '' && $zoidistance != '') { |
| 1473 | 1902 | $settings = array_merge($settings,array('globalDistanceIgnore' => array('latitude' => $zoilatitude,'longitude' => $zoilongitude,'distance' => $zoidistance))); |
| 1474 | - } else $settings = array_merge($settings,array('globalDistanceIgnore' => array())); |
|
| 1903 | + } else { |
|
| 1904 | + $settings = array_merge($settings,array('globalDistanceIgnore' => array())); |
|
| 1905 | + } |
|
| 1475 | 1906 | |
| 1476 | 1907 | $refresh = filter_input(INPUT_POST,'refresh',FILTER_SANITIZE_NUMBER_INT); |
| 1477 | 1908 | $settings = array_merge($settings,array('globalLiveInterval' => $refresh)); |
@@ -1512,7 +1943,9 @@ discard block |
||
| 1512 | 1943 | |
| 1513 | 1944 | // Create in settings.php keys not yet configurable if not already here |
| 1514 | 1945 | //if (!isset($globalImageBingKey)) $settings = array_merge($settings,array('globalImageBingKey' => '')); |
| 1515 | - if (!isset($globalDebug)) $settings = array_merge($settings,array('globalDebug' => 'TRUE')); |
|
| 1946 | + if (!isset($globalDebug)) { |
|
| 1947 | + $settings = array_merge($settings,array('globalDebug' => 'TRUE')); |
|
| 1948 | + } |
|
| 1516 | 1949 | |
| 1517 | 1950 | $resetyearstats = filter_input(INPUT_POST,'resetyearstats',FILTER_SANITIZE_STRING); |
| 1518 | 1951 | if ($resetyearstats == 'resetyearstats') { |
@@ -1555,37 +1988,56 @@ discard block |
||
| 1555 | 1988 | } |
| 1556 | 1989 | */ |
| 1557 | 1990 | $settings = array_merge($settings,array('globalFlightAware' => 'FALSE')); |
| 1558 | - if ($globalsbs == 'sbs') $settings = array_merge($settings,array('globalSBS1' => 'TRUE')); |
|
| 1559 | - else $settings = array_merge($settings,array('globalSBS1' => 'FALSE')); |
|
| 1560 | - if ($globalaprs == 'aprs') $settings = array_merge($settings,array('globalAPRS' => 'TRUE')); |
|
| 1561 | - else $settings = array_merge($settings,array('globalAPRS' => 'FALSE')); |
|
| 1991 | + if ($globalsbs == 'sbs') { |
|
| 1992 | + $settings = array_merge($settings,array('globalSBS1' => 'TRUE')); |
|
| 1993 | + } else { |
|
| 1994 | + $settings = array_merge($settings,array('globalSBS1' => 'FALSE')); |
|
| 1995 | + } |
|
| 1996 | + if ($globalaprs == 'aprs') { |
|
| 1997 | + $settings = array_merge($settings,array('globalAPRS' => 'TRUE')); |
|
| 1998 | + } else { |
|
| 1999 | + $settings = array_merge($settings,array('globalAPRS' => 'FALSE')); |
|
| 2000 | + } |
|
| 1562 | 2001 | $va = false; |
| 1563 | 2002 | if ($globalivao == 'ivao') { |
| 1564 | 2003 | $settings = array_merge($settings,array('globalIVAO' => 'TRUE')); |
| 1565 | 2004 | $va = true; |
| 1566 | - } else $settings = array_merge($settings,array('globalIVAO' => 'FALSE')); |
|
| 2005 | + } else { |
|
| 2006 | + $settings = array_merge($settings,array('globalIVAO' => 'FALSE')); |
|
| 2007 | + } |
|
| 1567 | 2008 | if ($globalvatsim == 'vatsim') { |
| 1568 | 2009 | $settings = array_merge($settings,array('globalVATSIM' => 'TRUE')); |
| 1569 | 2010 | $va = true; |
| 1570 | - } else $settings = array_merge($settings,array('globalVATSIM' => 'FALSE')); |
|
| 2011 | + } else { |
|
| 2012 | + $settings = array_merge($settings,array('globalVATSIM' => 'FALSE')); |
|
| 2013 | + } |
|
| 1571 | 2014 | if ($globalphpvms == 'phpvms') { |
| 1572 | 2015 | $settings = array_merge($settings,array('globalphpVMS' => 'TRUE')); |
| 1573 | 2016 | $va = true; |
| 1574 | - } else $settings = array_merge($settings,array('globalphpVMS' => 'FALSE')); |
|
| 2017 | + } else { |
|
| 2018 | + $settings = array_merge($settings,array('globalphpVMS' => 'FALSE')); |
|
| 2019 | + } |
|
| 1575 | 2020 | if ($globalvam == 'vam') { |
| 1576 | 2021 | $settings = array_merge($settings,array('globalVAM' => 'TRUE')); |
| 1577 | 2022 | $va = true; |
| 1578 | - } else $settings = array_merge($settings,array('globalVAM' => 'FALSE')); |
|
| 2023 | + } else { |
|
| 2024 | + $settings = array_merge($settings,array('globalVAM' => 'FALSE')); |
|
| 2025 | + } |
|
| 1579 | 2026 | if ($va) { |
| 1580 | 2027 | $settings = array_merge($settings,array('globalSchedulesFetch' => 'FALSE','globalTranslationFetch' => 'FALSE')); |
| 1581 | - } else $settings = array_merge($settings,array('globalSchedulesFetch' => 'TRUE','globalTranslationFetch' => 'TRUE')); |
|
| 2028 | + } else { |
|
| 2029 | + $settings = array_merge($settings,array('globalSchedulesFetch' => 'TRUE','globalTranslationFetch' => 'TRUE')); |
|
| 2030 | + } |
|
| 1582 | 2031 | if ($globalva == 'va' || $va) { |
| 1583 | 2032 | $settings = array_merge($settings,array('globalVA' => 'TRUE')); |
| 1584 | 2033 | $settings = array_merge($settings,array('globalUsePilot' => 'TRUE','globalUseOwner' => 'FALSE')); |
| 1585 | 2034 | } else { |
| 1586 | 2035 | $settings = array_merge($settings,array('globalVA' => 'FALSE')); |
| 1587 | - if ($forcepilots) $settings = array_merge($settings,array('globalUsePilot' => 'TRUE','globalUseOwner' => 'FALSE')); |
|
| 1588 | - else $settings = array_merge($settings,array('globalUsePilot' => 'FALSE','globalUseOwner' => 'TRUE')); |
|
| 2036 | + if ($forcepilots) { |
|
| 2037 | + $settings = array_merge($settings,array('globalUsePilot' => 'TRUE','globalUseOwner' => 'FALSE')); |
|
| 2038 | + } else { |
|
| 2039 | + $settings = array_merge($settings,array('globalUsePilot' => 'FALSE','globalUseOwner' => 'TRUE')); |
|
| 2040 | + } |
|
| 1589 | 2041 | } |
| 1590 | 2042 | if ($globalvm == 'vm') { |
| 1591 | 2043 | $settings = array_merge($settings,array('globalVM' => 'TRUE')); |
@@ -1845,7 +2297,9 @@ discard block |
||
| 1845 | 2297 | $graphhopper = filter_input(INPUT_POST,'graphhopper',FILTER_SANITIZE_STRING); |
| 1846 | 2298 | $settings = array_merge($settings,array('globalGraphHopperKey' => $graphhopper)); |
| 1847 | 2299 | |
| 1848 | - if (!isset($globalTransaction)) $settings = array_merge($settings,array('globalTransaction' => 'TRUE')); |
|
| 2300 | + if (!isset($globalTransaction)) { |
|
| 2301 | + $settings = array_merge($settings,array('globalTransaction' => 'TRUE')); |
|
| 2302 | + } |
|
| 1849 | 2303 | |
| 1850 | 2304 | // Set some defaults values... |
| 1851 | 2305 | if (!isset($globalAircraftImageSources)) { |
@@ -1860,15 +2314,23 @@ discard block |
||
| 1860 | 2314 | |
| 1861 | 2315 | $settings = array_merge($settings,array('globalInstalled' => 'TRUE')); |
| 1862 | 2316 | |
| 1863 | - if ($error == '') settings::modify_settings($settings); |
|
| 1864 | - if ($error == '') settings::comment_settings($settings_comment); |
|
| 2317 | + if ($error == '') { |
|
| 2318 | + settings::modify_settings($settings); |
|
| 2319 | + } |
|
| 2320 | + if ($error == '') { |
|
| 2321 | + settings::comment_settings($settings_comment); |
|
| 2322 | + } |
|
| 1865 | 2323 | if ($error != '') { |
| 1866 | 2324 | print '<div class="info column">'.$error.'</div>'; |
| 1867 | 2325 | require('../footer.php'); |
| 1868 | 2326 | exit; |
| 1869 | 2327 | } else { |
| 1870 | - if (isset($_POST['waypoints']) && $_POST['waypoints'] == 'waypoints') $_SESSION['waypoints'] = 1; |
|
| 1871 | - if (isset($_POST['owner']) && $_POST['owner'] == 'owner') $_SESSION['owner'] = 1; |
|
| 2328 | + if (isset($_POST['waypoints']) && $_POST['waypoints'] == 'waypoints') { |
|
| 2329 | + $_SESSION['waypoints'] = 1; |
|
| 2330 | + } |
|
| 2331 | + if (isset($_POST['owner']) && $_POST['owner'] == 'owner') { |
|
| 2332 | + $_SESSION['owner'] = 1; |
|
| 2333 | + } |
|
| 1872 | 2334 | if (isset($_POST['createdb'])) { |
| 1873 | 2335 | $_SESSION['install'] = 'database_create'; |
| 1874 | 2336 | } else { |
@@ -1905,10 +2367,18 @@ discard block |
||
| 1905 | 2367 | $popw = false; |
| 1906 | 2368 | foreach ($_SESSION['done'] as $done) { |
| 1907 | 2369 | print '<li>'.$done.'....<strong>SUCCESS</strong></li>'; |
| 1908 | - if ($done == 'Create database') $pop = true; |
|
| 1909 | - if ($_SESSION['install'] == 'database_create') $pop = true; |
|
| 1910 | - if ($_SESSION['install'] == 'database_import') $popi = true; |
|
| 1911 | - if ($_SESSION['install'] == 'waypoints') $popw = true; |
|
| 2370 | + if ($done == 'Create database') { |
|
| 2371 | + $pop = true; |
|
| 2372 | + } |
|
| 2373 | + if ($_SESSION['install'] == 'database_create') { |
|
| 2374 | + $pop = true; |
|
| 2375 | + } |
|
| 2376 | + if ($_SESSION['install'] == 'database_import') { |
|
| 2377 | + $popi = true; |
|
| 2378 | + } |
|
| 2379 | + if ($_SESSION['install'] == 'waypoints') { |
|
| 2380 | + $popw = true; |
|
| 2381 | + } |
|
| 1912 | 2382 | } |
| 1913 | 2383 | if ($pop) { |
| 1914 | 2384 | sleep(5); |
@@ -1919,7 +2389,9 @@ discard block |
||
| 1919 | 2389 | } else if ($popw) { |
| 1920 | 2390 | sleep(5); |
| 1921 | 2391 | print '<li>Populate waypoints database....<img src="../images/loading.gif" /></li>'; |
| 1922 | - } else print '<li>Update schema if needed....<img src="../images/loading.gif" /></li>'; |
|
| 2392 | + } else { |
|
| 2393 | + print '<li>Update schema if needed....<img src="../images/loading.gif" /></li>'; |
|
| 2394 | + } |
|
| 1923 | 2395 | print '</div></ul>'; |
| 1924 | 2396 | print '<div id="error"></div>'; |
| 1925 | 2397 | /* foreach ($_SESSION['done'] as $done) { |
@@ -24,7 +24,9 @@ discard block |
||
| 24 | 24 | public function __construct($dbc = null,$fromACARSscript = false) { |
| 25 | 25 | $Connection = new Connection($dbc); |
| 26 | 26 | $this->db = $Connection->db(); |
| 27 | - if ($this->db === null) die('Error: No DB connection. (ACARS)'); |
|
| 27 | + if ($this->db === null) { |
|
| 28 | + die('Error: No DB connection. (ACARS)'); |
|
| 29 | + } |
|
| 28 | 30 | if ($fromACARSscript) { |
| 29 | 31 | $this->fromACARSscript = true; |
| 30 | 32 | $this->SI = new SpotterImport($this->db); |
@@ -39,14 +41,19 @@ discard block |
||
| 39 | 41 | */ |
| 40 | 42 | public function ident2icao($ident) { |
| 41 | 43 | if (substr($ident,0,2) == 'AF') { |
| 42 | - if (filter_var(substr($ident,2),FILTER_VALIDATE_INT,array("flags"=>FILTER_FLAG_ALLOW_OCTAL))) $icao = $ident; |
|
| 43 | - else $icao = 'AFR'.ltrim(substr($ident,2),'0'); |
|
| 44 | + if (filter_var(substr($ident,2),FILTER_VALIDATE_INT,array("flags"=>FILTER_FLAG_ALLOW_OCTAL))) { |
|
| 45 | + $icao = $ident; |
|
| 46 | + } else { |
|
| 47 | + $icao = 'AFR'.ltrim(substr($ident,2),'0'); |
|
| 48 | + } |
|
| 44 | 49 | } else { |
| 45 | 50 | $Spotter = new Spotter($this->db); |
| 46 | 51 | $identicao = $Spotter->getAllAirlineInfo(substr($ident,0,2)); |
| 47 | 52 | if (isset($identicao[0])) { |
| 48 | 53 | $icao = $identicao[0]['icao'].ltrim(substr($ident,2),'0'); |
| 49 | - } else $icao = $ident; |
|
| 54 | + } else { |
|
| 55 | + $icao = $ident; |
|
| 56 | + } |
|
| 50 | 57 | } |
| 51 | 58 | return $icao; |
| 52 | 59 | } |
@@ -120,14 +127,24 @@ discard block |
||
| 120 | 127 | $message = ''; |
| 121 | 128 | $result = array(); |
| 122 | 129 | $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); |
| 123 | - 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); |
|
| 124 | - 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); |
|
| 125 | - 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); |
|
| 130 | + if ($n == 0) { |
|
| 131 | + $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); |
|
| 132 | + } |
|
| 133 | + if ($n == 0) { |
|
| 134 | + $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); |
|
| 135 | + } |
|
| 136 | + if ($n == 0) { |
|
| 137 | + $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); |
|
| 138 | + } |
|
| 126 | 139 | if ($n != 0 && ($registration != '' || $ident != '' || $label != '' || $block_id != '' || $msg_no != '')) { |
| 127 | 140 | $registration = str_replace('.','',$registration); |
| 128 | 141 | $result = array('registration' => $registration, 'ident' => $ident,'label' => $label, 'block_id' => $block_id,'msg_no' => $msg_no,'message' => $message); |
| 129 | - if ($globalDebug) echo "Reg. : ".$registration." - Ident : ".$ident." - Label : ".$label." - Message : ".$message."\n"; |
|
| 130 | - } else $message = $data; |
|
| 142 | + if ($globalDebug) { |
|
| 143 | + echo "Reg. : ".$registration." - Ident : ".$ident." - Label : ".$label." - Message : ".$message."\n"; |
|
| 144 | + } |
|
| 145 | + } else { |
|
| 146 | + $message = $data; |
|
| 147 | + } |
|
| 131 | 148 | $decode = array(); |
| 132 | 149 | $found = false; |
| 133 | 150 | // if ($registration != '' && $ident != '' && $registration != '!') { |
@@ -147,12 +164,21 @@ discard block |
||
| 147 | 164 | if ($n > 5 && ($lac == 'N' || $lac == 'S') && ($lnc == 'E' || $lnc == 'W')) { |
| 148 | 165 | $latitude = $la / 10000.0; |
| 149 | 166 | $longitude = $ln / 10000.0; |
| 150 | - if ($lac == 'S') $latitude = '-'.$latitude; |
|
| 151 | - if ($lnc == 'W') $longitude = '-'.$longitude; |
|
| 167 | + if ($lac == 'S') { |
|
| 168 | + $latitude = '-'.$latitude; |
|
| 169 | + } |
|
| 170 | + if ($lnc == 'W') { |
|
| 171 | + $longitude = '-'.$longitude; |
|
| 172 | + } |
|
| 152 | 173 | // Temp not always available |
| 153 | - if ($globalDebug) echo 'latitude : '.$latitude.' - longitude : '.$longitude.' - airport depart : '.$dair.' - airport arrival : '.$darr.' - température : '.$temp."°C\n"; |
|
| 154 | - if ($temp == '') $decode = array('Latitude' => $latitude, 'Longitude' => $longitude, 'Departure airport' => $dair, 'Arrival airport' => $darr,'Altitude' => $alt); |
|
| 155 | - else $decode = array('Latitude' => $latitude, 'Longitude' => $longitude, 'Departure airport' => $dair, 'Arrival airport' => $darr, 'Altitude' => 'FL'.$alt,'Temperature' => $temp.'°C'); |
|
| 174 | + if ($globalDebug) { |
|
| 175 | + echo 'latitude : '.$latitude.' - longitude : '.$longitude.' - airport depart : '.$dair.' - airport arrival : '.$darr.' - température : '.$temp."°C\n"; |
|
| 176 | + } |
|
| 177 | + if ($temp == '') { |
|
| 178 | + $decode = array('Latitude' => $latitude, 'Longitude' => $longitude, 'Departure airport' => $dair, 'Arrival airport' => $darr,'Altitude' => $alt); |
|
| 179 | + } else { |
|
| 180 | + $decode = array('Latitude' => $latitude, 'Longitude' => $longitude, 'Departure airport' => $dair, 'Arrival airport' => $darr, 'Altitude' => 'FL'.$alt,'Temperature' => $temp.'°C'); |
|
| 181 | + } |
|
| 156 | 182 | |
| 157 | 183 | //$icao = $Translation->checkTranslation($ident); |
| 158 | 184 | //$Schedule->addSchedule($icao,$dair,'',$darr,'','ACARS'); |
@@ -166,25 +192,35 @@ discard block |
||
| 166 | 192 | $ahour = ''; |
| 167 | 193 | $n = sscanf($message, "ARR01 %4[A-Z]%4d %4[A-Z]%4d", $dair, $dhour, $darr,$ahour); |
| 168 | 194 | if ($n == 4 && strlen($darr) == 4) { |
| 169 | - if ($dhour != '') $dhour = substr(sprintf('%04d',$dhour),0,2).':'.substr(sprintf('%04d',$dhour),2); |
|
| 170 | - if ($ahour != '') $ahour = substr(sprintf('%04d',$ahour),0,2).':'.substr(sprintf('%04d',$ahour),2); |
|
| 171 | - if ($globalDebug) echo 'departure airport : '.$dair.' - arrival airport : '. $darr.' - departure hour : '. $dhour.' - arrival hour : '.$ahour."\n"; |
|
| 195 | + if ($dhour != '') { |
|
| 196 | + $dhour = substr(sprintf('%04d',$dhour),0,2).':'.substr(sprintf('%04d',$dhour),2); |
|
| 197 | + } |
|
| 198 | + if ($ahour != '') { |
|
| 199 | + $ahour = substr(sprintf('%04d',$ahour),0,2).':'.substr(sprintf('%04d',$ahour),2); |
|
| 200 | + } |
|
| 201 | + if ($globalDebug) { |
|
| 202 | + echo 'departure airport : '.$dair.' - arrival airport : '. $darr.' - departure hour : '. $dhour.' - arrival hour : '.$ahour."\n"; |
|
| 203 | + } |
|
| 172 | 204 | //$icao = ACARS->ident2icao($ident); |
| 173 | 205 | //$icao = $Translation->checkTranslation($ident); |
| 174 | 206 | //$Schedule->addSchedule($icao,$dair,$dhour,$darr,$ahour,'ACARS'); |
| 175 | 207 | $decode = array('Departure airport' => $dair, 'Departure hour' => $dhour, 'Arrival airport' => $darr, 'Arrival hour' => $ahour); |
| 176 | 208 | $found = true; |
| 177 | - } |
|
| 178 | - elseif ($n == 2 || $n == 4) { |
|
| 179 | - if ($dhour != '') $dhour = substr(sprintf('%04d',$dhour),0,2).':'.substr(sprintf('%04d',$dhour),2); |
|
| 180 | - if ($globalDebug) echo 'airport arrival : '.$dair.' - arrival hour : '.$dhour."\n"; |
|
| 209 | + } elseif ($n == 2 || $n == 4) { |
|
| 210 | + if ($dhour != '') { |
|
| 211 | + $dhour = substr(sprintf('%04d',$dhour),0,2).':'.substr(sprintf('%04d',$dhour),2); |
|
| 212 | + } |
|
| 213 | + if ($globalDebug) { |
|
| 214 | + echo 'airport arrival : '.$dair.' - arrival hour : '.$dhour."\n"; |
|
| 215 | + } |
|
| 181 | 216 | //$icao = ACARS->ident2icao($ident); |
| 182 | 217 | //$icao = $Translation->checkTranslation($ident); |
| 183 | 218 | $decode = array('Arrival airport' => $dair, 'Arrival hour' => $dhour); |
| 184 | 219 | $found = true; |
| 185 | - } |
|
| 186 | - elseif ($n == 1) { |
|
| 187 | - if ($globalDebug) echo 'airport arrival : '.$darr."\n"; |
|
| 220 | + } elseif ($n == 1) { |
|
| 221 | + if ($globalDebug) { |
|
| 222 | + echo 'airport arrival : '.$darr."\n"; |
|
| 223 | + } |
|
| 188 | 224 | //$icao = ACARS->ident2icao($ident); |
| 189 | 225 | //$icao = $Translation->checkTranslation($ident); |
| 190 | 226 | $decode = array('Arrival airport' => $darr); |
@@ -202,7 +238,9 @@ discard block |
||
| 202 | 238 | $darr = ''; |
| 203 | 239 | $n = sscanf($message, "%4c,%4c,%*7s,%*d", $dair, $darr); |
| 204 | 240 | if ($n == 4) { |
| 205 | - if ($globalDebug) echo 'airport depart : '.$dair.' - airport arrival : '.$darr."\n"; |
|
| 241 | + if ($globalDebug) { |
|
| 242 | + echo 'airport depart : '.$dair.' - airport arrival : '.$darr."\n"; |
|
| 243 | + } |
|
| 206 | 244 | //$icao = ACARS->ident2icao($ident); |
| 207 | 245 | //$icao = $Translation->checkTranslation($ident); |
| 208 | 246 | //$Schedule->addSchedule($icao,$dair,'',$darr,'','ACARS'); |
@@ -236,14 +274,23 @@ discard block |
||
| 236 | 274 | $apiste = ''; |
| 237 | 275 | $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); |
| 238 | 276 | if ($n > 8) { |
| 239 | - 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"; |
|
| 240 | - if ($dhour != '') $dhour = substr(sprintf('%04d',$dhour),0,2).':'.substr(sprintf('%04d',$dhour),2); |
|
| 241 | - if ($ahour != '') $ahour = substr(sprintf('%04d',$ahour),0,2).':'.substr(sprintf('%04d',$ahour),2); |
|
| 277 | + if ($globalDebug) { |
|
| 278 | + 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"; |
|
| 279 | + } |
|
| 280 | + if ($dhour != '') { |
|
| 281 | + $dhour = substr(sprintf('%04d',$dhour),0,2).':'.substr(sprintf('%04d',$dhour),2); |
|
| 282 | + } |
|
| 283 | + if ($ahour != '') { |
|
| 284 | + $ahour = substr(sprintf('%04d',$ahour),0,2).':'.substr(sprintf('%04d',$ahour),2); |
|
| 285 | + } |
|
| 242 | 286 | $icao = trim($aident); |
| 243 | 287 | |
| 244 | 288 | //$decode = 'Departure airport : '.$dair.' ('.$ddate.' at '.$dhour.') - Arrival Airport : '.$aair.' (at '.$ahour.') way '.$apiste; |
| 245 | - if ($ahour == '') $decode = array('Departure airport' => $dair, 'Departure date' => $ddate, 'Departure hour' => $dhour, 'Arrival airport' => $darr); |
|
| 246 | - else $decode = array('Departure airport' => $dair, 'Departure date' => $ddate, 'Departure hour' => $dhour, 'Arrival airport' => $darr, 'Arrival hour' => $ahour, 'Arrival way' => $apiste); |
|
| 289 | + if ($ahour == '') { |
|
| 290 | + $decode = array('Departure airport' => $dair, 'Departure date' => $ddate, 'Departure hour' => $dhour, 'Arrival airport' => $darr); |
|
| 291 | + } else { |
|
| 292 | + $decode = array('Departure airport' => $dair, 'Departure date' => $ddate, 'Departure hour' => $dhour, 'Arrival airport' => $darr, 'Arrival hour' => $ahour, 'Arrival way' => $apiste); |
|
| 293 | + } |
|
| 247 | 294 | //$Schedule->addSchedule($icao,$dair,$dhour,$darr,$ahour,'ACARS'); |
| 248 | 295 | $decode['icao'] = $icao; |
| 249 | 296 | $found = true; |
@@ -265,9 +312,15 @@ discard block |
||
| 265 | 312 | $lns = $lns.'.'.$lns; |
| 266 | 313 | $latitude = $las / 1000.0; |
| 267 | 314 | $longitude = $lns / 1000.0; |
| 268 | - if ($lac == 'S') $latitude = '-'.$latitude; |
|
| 269 | - if ($lnc == 'W') $longitude = '-'.$longitude; |
|
| 270 | - if ($globalDebug) echo 'latitude : '.$latitude.' - longitude : '.$longitude."\n"; |
|
| 315 | + if ($lac == 'S') { |
|
| 316 | + $latitude = '-'.$latitude; |
|
| 317 | + } |
|
| 318 | + if ($lnc == 'W') { |
|
| 319 | + $longitude = '-'.$longitude; |
|
| 320 | + } |
|
| 321 | + if ($globalDebug) { |
|
| 322 | + echo 'latitude : '.$latitude.' - longitude : '.$longitude."\n"; |
|
| 323 | + } |
|
| 271 | 324 | $decode = array('Latitude' => $latitude, 'Longitude' => $longitude); |
| 272 | 325 | $found = true; |
| 273 | 326 | } |
@@ -285,7 +338,9 @@ discard block |
||
| 285 | 338 | $darr = ''; |
| 286 | 339 | $n = sscanf($message, "%*[0-9A-Z ]/%*s %4c/%4c .", $dair, $darr); |
| 287 | 340 | if ($n == 4) { |
| 288 | - if ($globalDebug) echo 'airport depart : '.$dair.' - airport arrival : '.$darr."\n"; |
|
| 341 | + if ($globalDebug) { |
|
| 342 | + echo 'airport depart : '.$dair.' - airport arrival : '.$darr."\n"; |
|
| 343 | + } |
|
| 289 | 344 | //$icao = $Translation->checkTranslation($ident); |
| 290 | 345 | //$Schedule->addSchedule($icao,$dair,'',$darr,'','ACARS'); |
| 291 | 346 | $decode = array('Departure airport' => $dair, 'Arrival airport' => $darr); |
@@ -298,7 +353,9 @@ discard block |
||
| 298 | 353 | $darr = ''; |
| 299 | 354 | $n = sscanf($message, "%*[0-9],%4c,%4c,", $dair, $darr); |
| 300 | 355 | if ($n == 4) { |
| 301 | - if ($globalDebug) echo 'airport depart : '.$dair.' - airport arrival : '.$darr."\n"; |
|
| 356 | + if ($globalDebug) { |
|
| 357 | + echo 'airport depart : '.$dair.' - airport arrival : '.$darr."\n"; |
|
| 358 | + } |
|
| 302 | 359 | //$icao = $Translation->checkTranslation($ident); |
| 303 | 360 | //$Schedule->addSchedule($icao,$dair,'',$darr,'','ACARS'); |
| 304 | 361 | $decode = array('Departure airport' => $dair, 'Arrival airport' => $darr); |
@@ -311,7 +368,9 @@ discard block |
||
| 311 | 368 | $darr = ''; |
| 312 | 369 | $n = sscanf($message, "002AF %4c %4c ", $dair, $darr); |
| 313 | 370 | if ($n == 2) { |
| 314 | - if ($globalDebug) echo 'airport depart : '.$dair.' - airport arrival : '.$darr."\n"; |
|
| 371 | + if ($globalDebug) { |
|
| 372 | + echo 'airport depart : '.$dair.' - airport arrival : '.$darr."\n"; |
|
| 373 | + } |
|
| 315 | 374 | //$icao = $Translation->checkTranslation($ident); |
| 316 | 375 | $decode = array('Departure airport' => $dair, 'Arrival airport' => $darr); |
| 317 | 376 | //$Schedule->addSchedule($icao,$dair,'',$darr,'','ACARS'); |
@@ -325,7 +384,9 @@ discard block |
||
| 325 | 384 | $darr = ''; |
| 326 | 385 | $n = sscanf($message, "#DFBA%*02d/%*[A-Z-],%*[0-9A-Z],%*d,%4c,%4c", $dair, $darr); |
| 327 | 386 | if ($n == 6) { |
| 328 | - if ($globalDebug) echo 'airport depart : '.$dair.' - airport arrival : '.$darr."\n"; |
|
| 387 | + if ($globalDebug) { |
|
| 388 | + echo 'airport depart : '.$dair.' - airport arrival : '.$darr."\n"; |
|
| 389 | + } |
|
| 329 | 390 | //$icao = $Translation->checkTranslation($ident); |
| 330 | 391 | //$Schedule->addSchedule($icao,$dair,'',$darr,'','ACARS'); |
| 331 | 392 | $decode = array('Departure airport' => $dair, 'Arrival airport' => $darr); |
@@ -338,7 +399,9 @@ discard block |
||
| 338 | 399 | $darr = ''; |
| 339 | 400 | $n = sscanf($message, "#DFBA%*02d/%*[0-9A-Z,]/%*[A-Z-],%*[0-9A-Z],%*d,%4c,%4c", $dair, $darr); |
| 340 | 401 | if ($n == 7) { |
| 341 | - if ($globalDebug) echo 'airport depart : '.$dair.' - airport arrival : '.$darr."\n"; |
|
| 402 | + if ($globalDebug) { |
|
| 403 | + echo 'airport depart : '.$dair.' - airport arrival : '.$darr."\n"; |
|
| 404 | + } |
|
| 342 | 405 | //$icao = $Translation->checkTranslation($ident); |
| 343 | 406 | //$Schedule->addSchedule($icao,$dair,'',$darr,'','ACARS'); |
| 344 | 407 | $decode = array('Departure airport' => $dair, 'Arrival airport' => $darr); |
@@ -366,8 +429,12 @@ discard block |
||
| 366 | 429 | $decode['icao'] = $icao; |
| 367 | 430 | $latitude = $las / 100.0; |
| 368 | 431 | $longitude = $lns / 100.0; |
| 369 | - if ($lac == 'S') $latitude = '-'.$latitude; |
|
| 370 | - if ($lnc == 'W') $longitude = '-'.$longitude; |
|
| 432 | + if ($lac == 'S') { |
|
| 433 | + $latitude = '-'.$latitude; |
|
| 434 | + } |
|
| 435 | + if ($lnc == 'W') { |
|
| 436 | + $longitude = '-'.$longitude; |
|
| 437 | + } |
|
| 371 | 438 | |
| 372 | 439 | $decode = array('Latitude' => $latitude,'Longitude' => $longitude,'Altitude' => 'FL'.$alt,'Fuel' => $fuel,'speed' => $speed); |
| 373 | 440 | $found = true; |
@@ -385,8 +452,12 @@ discard block |
||
| 385 | 452 | if ($n == 4) { |
| 386 | 453 | $latitude = $las; |
| 387 | 454 | $longitude = $lns; |
| 388 | - if ($lac == 'S') $latitude = '-'.$latitude; |
|
| 389 | - if ($lnc == 'W') $longitude = '-'.$longitude; |
|
| 455 | + if ($lac == 'S') { |
|
| 456 | + $latitude = '-'.$latitude; |
|
| 457 | + } |
|
| 458 | + if ($lnc == 'W') { |
|
| 459 | + $longitude = '-'.$longitude; |
|
| 460 | + } |
|
| 390 | 461 | |
| 391 | 462 | $decode = array('Latitude' => $latitude,'Longitude' => $longitude); |
| 392 | 463 | $found = true; |
@@ -402,7 +473,9 @@ discard block |
||
| 402 | 473 | $darr = ''; |
| 403 | 474 | $n = sscanf($message, "%*[0-9A-Z] NLINFO %*d/%*d %4c/%4c .", $dair, $darr); |
| 404 | 475 | if ($n == 5) { |
| 405 | - if ($globalDebug) echo 'airport depart : '.$dair.' - airport arrival : '.$darr."\n"; |
|
| 476 | + if ($globalDebug) { |
|
| 477 | + echo 'airport depart : '.$dair.' - airport arrival : '.$darr."\n"; |
|
| 478 | + } |
|
| 406 | 479 | //$icao = $Translation->checkTranslation($ident); |
| 407 | 480 | //$Schedule->addSchedule($icao,$dair,'',$darr,'','ACARS'); |
| 408 | 481 | $decode = array('Departure airport' => $dair, 'Arrival airport' => $darr); |
@@ -423,7 +496,9 @@ discard block |
||
| 423 | 496 | $aident = ''; |
| 424 | 497 | $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); |
| 425 | 498 | if ($n == 8) { |
| 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 = trim($aident); |
| 428 | 503 | //$Schedule->addSchedule($icao,$dair,'',$darr,'','ACARS'); |
| 429 | 504 | $decode['icao'] = $icao; |
@@ -440,7 +515,9 @@ discard block |
||
| 440 | 515 | $darr = ''; |
| 441 | 516 | $n = sscanf($message, "%*d/%*d %4s/%4s .%*6s", $dair, $darr); |
| 442 | 517 | if ($n == 5) { |
| 443 | - if ($globalDebug) echo 'airport depart : '.$dair.' - airport arrival : '.$darr."\n"; |
|
| 518 | + if ($globalDebug) { |
|
| 519 | + echo 'airport depart : '.$dair.' - airport arrival : '.$darr."\n"; |
|
| 520 | + } |
|
| 444 | 521 | //$icao = $Translation->checkTranslation($ident); |
| 445 | 522 | //$Schedule->addSchedule($icao,$dair,'',$darr,'','ACARS'); |
| 446 | 523 | $decode = array('Departure airport' => $dair, 'Arrival airport' => $darr); |
@@ -455,7 +532,9 @@ discard block |
||
| 455 | 532 | $darr = ''; |
| 456 | 533 | $n = sscanf($message,'%4[A-Z]%4[A-Z]%*4d',$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 | //$Schedule->addSchedule($icao,$dair,'',$darr,'','ACARS'); |
| 461 | 540 | $decode = array('Departure airport' => $dair, 'Arrival airport' => $darr); |
@@ -470,7 +549,9 @@ discard block |
||
| 470 | 549 | $darr = ''; |
| 471 | 550 | $n = sscanf($message,'3J01 DSPTCH %*d/%*d %4s/%4s .%*6s',$dair,$darr); |
| 472 | 551 | if ($n == 3) { |
| 473 | - if ($globalDebug) echo 'airport depart : '.$dair.' - airport arrival : '.$darr."\n"; |
|
| 552 | + if ($globalDebug) { |
|
| 553 | + echo 'airport depart : '.$dair.' - airport arrival : '.$darr."\n"; |
|
| 554 | + } |
|
| 474 | 555 | //$icao = $Translation->checkTranslation($ident); |
| 475 | 556 | //$Schedule->addSchedule($icao,$dair,'',$darr,'','ACARS'); |
| 476 | 557 | $decode = array('Departure airport' => $dair, 'Arrival airport' => $darr); |
@@ -480,7 +561,9 @@ discard block |
||
| 480 | 561 | if (!$found) { |
| 481 | 562 | $n = sscanf($message,'MET01%4c',$airport); |
| 482 | 563 | if ($n == 1) { |
| 483 | - if ($globalDebug) echo 'airport name : '.$airport; |
|
| 564 | + if ($globalDebug) { |
|
| 565 | + echo 'airport name : '.$airport; |
|
| 566 | + } |
|
| 484 | 567 | $decode = array('Airport/Waypoint name' => $airport); |
| 485 | 568 | $found = true; |
| 486 | 569 | } |
@@ -488,184 +571,126 @@ discard block |
||
| 488 | 571 | if ($label == 'H1') { |
| 489 | 572 | if (preg_match('/^#CFBFLR/',$message) || preg_match('/^#CFBWRN/',$message)) { |
| 490 | 573 | $decode = array_merge(array('Message nature' => 'Equipment failure'),$decode); |
| 491 | - } |
|
| 492 | - elseif (preg_match('/^#DFB\*TKO/',$message) || preg_match('/^#DFBTKO/',$message)) { |
|
| 574 | + } elseif (preg_match('/^#DFB\*TKO/',$message) || preg_match('/^#DFBTKO/',$message)) { |
|
| 493 | 575 | $decode = array_merge(array('Message nature' => 'Take off performance data'),$decode); |
| 494 | - } |
|
| 495 | - elseif (preg_match('/^#DFB\*CRZ/',$message) || preg_match('/^#DFBCRZ/',$message)) { |
|
| 576 | + } elseif (preg_match('/^#DFB\*CRZ/',$message) || preg_match('/^#DFBCRZ/',$message)) { |
|
| 496 | 577 | $decode = array_merge(array('Message nature' => 'Cruise performance data'),$decode); |
| 497 | - } |
|
| 498 | - elseif (preg_match('/^#DFB\*WOB/',$message) || preg_match('/^#DFBWOB/',$message)) { |
|
| 578 | + } elseif (preg_match('/^#DFB\*WOB/',$message) || preg_match('/^#DFBWOB/',$message)) { |
|
| 499 | 579 | $decode = array_merge(array('Message nature' => 'Weather observation'),$decode); |
| 500 | - } |
|
| 501 | - elseif (preg_match(':^#DFB/PIREP:',$message)) { |
|
| 580 | + } elseif (preg_match(':^#DFB/PIREP:',$message)) { |
|
| 502 | 581 | $decode = array_merge(array('Message nature' => 'Pilot Report'),$decode); |
| 503 | - } |
|
| 504 | - elseif (preg_match('/^#DFBEDA/',$message) || preg_match('/^#DFBENG/',$message)) { |
|
| 582 | + } elseif (preg_match('/^#DFBEDA/',$message) || preg_match('/^#DFBENG/',$message)) { |
|
| 505 | 583 | $decode = array_merge(array('Message nature' => 'Engine Data'),$decode); |
| 506 | - } |
|
| 507 | - elseif (preg_match(':^#M1AAEP:',$message)) { |
|
| 584 | + } elseif (preg_match(':^#M1AAEP:',$message)) { |
|
| 508 | 585 | $decode = array_merge(array('Message nature' => 'Position/Weather Report'),$decode); |
| 509 | - } |
|
| 510 | - elseif (preg_match(':^#M2APWD:',$message)) { |
|
| 586 | + } elseif (preg_match(':^#M2APWD:',$message)) { |
|
| 511 | 587 | $decode = array_merge(array('Message nature' => 'Flight plan predicted wind data'),$decode); |
| 512 | - } |
|
| 513 | - elseif (preg_match(':^#M1BREQPWI:',$message)) { |
|
| 588 | + } elseif (preg_match(':^#M1BREQPWI:',$message)) { |
|
| 514 | 589 | $decode = array_merge(array('Message nature' => 'Predicted wind info request'),$decode); |
| 515 | - } |
|
| 516 | - elseif (preg_match(':^#CF:',$message)) { |
|
| 590 | + } elseif (preg_match(':^#CF:',$message)) { |
|
| 517 | 591 | $decode = array_merge(array('Message nature' => 'Central Fault Display'),$decode); |
| 518 | - } |
|
| 519 | - elseif (preg_match(':^#DF:',$message)) { |
|
| 592 | + } elseif (preg_match(':^#DF:',$message)) { |
|
| 520 | 593 | $decode = array_merge(array('Message nature' => 'Digital Flight Data Acquisition Unit'),$decode); |
| 521 | - } |
|
| 522 | - elseif (preg_match(':^#EC:',$message)) { |
|
| 594 | + } elseif (preg_match(':^#EC:',$message)) { |
|
| 523 | 595 | $decode = array_merge(array('Message nature' => 'Engine Display System'),$decode); |
| 524 | - } |
|
| 525 | - elseif (preg_match(':^#EI:',$message)) { |
|
| 596 | + } elseif (preg_match(':^#EI:',$message)) { |
|
| 526 | 597 | $decode = array_merge(array('Message nature' => 'Engine Report'),$decode); |
| 527 | - } |
|
| 528 | - elseif (preg_match(':^#H1:',$message)) { |
|
| 598 | + } elseif (preg_match(':^#H1:',$message)) { |
|
| 529 | 599 | $decode = array_merge(array('Message nature' => 'HF Data Radio - Left'),$decode); |
| 530 | - } |
|
| 531 | - elseif (preg_match(':^#H2:',$message)) { |
|
| 600 | + } elseif (preg_match(':^#H2:',$message)) { |
|
| 532 | 601 | $decode = array_merge(array('Message nature' => 'HF Data Radio - Right'),$decode); |
| 533 | - } |
|
| 534 | - elseif (preg_match(':^#HD:',$message)) { |
|
| 602 | + } elseif (preg_match(':^#HD:',$message)) { |
|
| 535 | 603 | $decode = array_merge(array('Message nature' => 'HF Data Radio - Selected'),$decode); |
| 536 | - } |
|
| 537 | - elseif (preg_match(':^#M1:',$message)) { |
|
| 604 | + } elseif (preg_match(':^#M1:',$message)) { |
|
| 538 | 605 | $decode = array_merge(array('Message nature' => 'Flight Management Computer - Left'),$decode); |
| 539 | - } |
|
| 540 | - elseif (preg_match(':^#M2:',$message)) { |
|
| 606 | + } elseif (preg_match(':^#M2:',$message)) { |
|
| 541 | 607 | $decode = array_merge(array('Message nature' => 'Flight Management Computer - Right'),$decode); |
| 542 | - } |
|
| 543 | - elseif (preg_match(':^#M3:',$message)) { |
|
| 608 | + } elseif (preg_match(':^#M3:',$message)) { |
|
| 544 | 609 | $decode = array_merge(array('Message nature' => 'Flight Management Computer - Center'),$decode); |
| 545 | - } |
|
| 546 | - elseif (preg_match(':^#MD:',$message)) { |
|
| 610 | + } elseif (preg_match(':^#MD:',$message)) { |
|
| 547 | 611 | $decode = array_merge(array('Message nature' => 'Flight Management Computer - Selected'),$decode); |
| 548 | - } |
|
| 549 | - elseif (preg_match(':^#PS:',$message)) { |
|
| 612 | + } elseif (preg_match(':^#PS:',$message)) { |
|
| 550 | 613 | $decode = array_merge(array('Message nature' => 'Keyboard/Display Unit'),$decode); |
| 551 | - } |
|
| 552 | - elseif (preg_match(':^#S1:',$message)) { |
|
| 614 | + } elseif (preg_match(':^#S1:',$message)) { |
|
| 553 | 615 | $decode = array_merge(array('Message nature' => 'SDU - Left'),$decode); |
| 554 | - } |
|
| 555 | - elseif (preg_match(':^#S2:',$message)) { |
|
| 616 | + } elseif (preg_match(':^#S2:',$message)) { |
|
| 556 | 617 | $decode = array_merge(array('Message nature' => 'SDU - Right'),$decode); |
| 557 | - } |
|
| 558 | - elseif (preg_match(':^#SD:',$message)) { |
|
| 618 | + } elseif (preg_match(':^#SD:',$message)) { |
|
| 559 | 619 | $decode = array_merge(array('Message nature' => 'SDU - Selected'),$decode); |
| 560 | - } |
|
| 561 | - elseif (preg_match(':^#T[0-8]:',$message)) { |
|
| 620 | + } elseif (preg_match(':^#T[0-8]:',$message)) { |
|
| 562 | 621 | $decode = array_merge(array('Message nature' => 'Cabin Terminal Messages'),$decode); |
| 563 | - } |
|
| 564 | - elseif (preg_match(':^#WO:',$message)) { |
|
| 622 | + } elseif (preg_match(':^#WO:',$message)) { |
|
| 565 | 623 | $decode = array_merge(array('Message nature' => 'Weather Observation Report'),$decode); |
| 566 | - } |
|
| 567 | - elseif (preg_match(':^#A1:',$message)) { |
|
| 624 | + } elseif (preg_match(':^#A1:',$message)) { |
|
| 568 | 625 | $decode = array_merge(array('Message nature' => 'Oceanic Clearance'),$decode); |
| 569 | - } |
|
| 570 | - elseif (preg_match(':^#A3:',$message)) { |
|
| 626 | + } elseif (preg_match(':^#A3:',$message)) { |
|
| 571 | 627 | $decode = array_merge(array('Message nature' => 'Departure Clearance Response'),$decode); |
| 572 | - } |
|
| 573 | - elseif (preg_match(':^#A4:',$message)) { |
|
| 628 | + } elseif (preg_match(':^#A4:',$message)) { |
|
| 574 | 629 | $decode = array_merge(array('Message nature' => 'Flight Systems Message'),$decode); |
| 575 | - } |
|
| 576 | - elseif (preg_match(':^#A6:',$message)) { |
|
| 630 | + } elseif (preg_match(':^#A6:',$message)) { |
|
| 577 | 631 | $decode = array_merge(array('Message nature' => 'Request ADS Reports'),$decode); |
| 578 | - } |
|
| 579 | - elseif (preg_match(':^#A8:',$message)) { |
|
| 632 | + } elseif (preg_match(':^#A8:',$message)) { |
|
| 580 | 633 | $decode = array_merge(array('Message nature' => 'Deliver Departure Slot'),$decode); |
| 581 | - } |
|
| 582 | - elseif (preg_match(':^#A9:',$message)) { |
|
| 634 | + } elseif (preg_match(':^#A9:',$message)) { |
|
| 583 | 635 | $decode = array_merge(array('Message nature' => 'ATIS report'),$decode); |
| 584 | - } |
|
| 585 | - elseif (preg_match(':^#A0:',$message)) { |
|
| 636 | + } elseif (preg_match(':^#A0:',$message)) { |
|
| 586 | 637 | $decode = array_merge(array('Message nature' => 'ATIS Facility Notification (AFN)'),$decode); |
| 587 | - } |
|
| 588 | - elseif (preg_match(':^#AA:',$message)) { |
|
| 638 | + } elseif (preg_match(':^#AA:',$message)) { |
|
| 589 | 639 | $decode = array_merge(array('Message nature' => 'ATCComm'),$decode); |
| 590 | - } |
|
| 591 | - elseif (preg_match(':^#AB:',$message)) { |
|
| 640 | + } elseif (preg_match(':^#AB:',$message)) { |
|
| 592 | 641 | $decode = array_merge(array('Message nature' => 'TWIP Report'),$decode); |
| 593 | - } |
|
| 594 | - elseif (preg_match(':^#AC:',$message)) { |
|
| 642 | + } elseif (preg_match(':^#AC:',$message)) { |
|
| 595 | 643 | $decode = array_merge(array('Message nature' => 'Pushback Clearance'),$decode); |
| 596 | - } |
|
| 597 | - elseif (preg_match(':^#AD:',$message)) { |
|
| 644 | + } elseif (preg_match(':^#AD:',$message)) { |
|
| 598 | 645 | $decode = array_merge(array('Message nature' => 'Expected Taxi Clearance'),$decode); |
| 599 | - } |
|
| 600 | - elseif (preg_match(':^#AF:',$message)) { |
|
| 646 | + } elseif (preg_match(':^#AF:',$message)) { |
|
| 601 | 647 | $decode = array_merge(array('Message nature' => 'CPC Command/Response'),$decode); |
| 602 | - } |
|
| 603 | - elseif (preg_match(':^#B1:',$message)) { |
|
| 648 | + } elseif (preg_match(':^#B1:',$message)) { |
|
| 604 | 649 | $decode = array_merge(array('Message nature' => 'Request Oceanic Clearance'),$decode); |
| 605 | - } |
|
| 606 | - elseif (preg_match(':^#B2:',$message)) { |
|
| 650 | + } elseif (preg_match(':^#B2:',$message)) { |
|
| 607 | 651 | $decode = array_merge(array('Message nature' => 'Oceanic Clearance Readback'),$decode); |
| 608 | - } |
|
| 609 | - elseif (preg_match(':^#B3:',$message)) { |
|
| 652 | + } elseif (preg_match(':^#B3:',$message)) { |
|
| 610 | 653 | $decode = array_merge(array('Message nature' => 'Request Departure Clearance'),$decode); |
| 611 | - } |
|
| 612 | - elseif (preg_match(':^#B4:',$message)) { |
|
| 654 | + } elseif (preg_match(':^#B4:',$message)) { |
|
| 613 | 655 | $decode = array_merge(array('Message nature' => 'Departure Clearance Readback'),$decode); |
| 614 | - } |
|
| 615 | - elseif (preg_match(':^#B6:',$message)) { |
|
| 656 | + } elseif (preg_match(':^#B6:',$message)) { |
|
| 616 | 657 | $decode = array_merge(array('Message nature' => 'Provide ADS Report'),$decode); |
| 617 | - } |
|
| 618 | - elseif (preg_match(':^#B8:',$message)) { |
|
| 658 | + } elseif (preg_match(':^#B8:',$message)) { |
|
| 619 | 659 | $decode = array_merge(array('Message nature' => 'Request Departure Slot'),$decode); |
| 620 | - } |
|
| 621 | - elseif (preg_match(':^#B9:',$message)) { |
|
| 660 | + } elseif (preg_match(':^#B9:',$message)) { |
|
| 622 | 661 | $decode = array_merge(array('Message nature' => 'Request ATIS Report'),$decode); |
| 623 | - } |
|
| 624 | - elseif (preg_match(':^#B0:',$message)) { |
|
| 662 | + } elseif (preg_match(':^#B0:',$message)) { |
|
| 625 | 663 | $decode = array_merge(array('Message nature' => 'ATS Facility Notification'),$decode); |
| 626 | - } |
|
| 627 | - elseif (preg_match(':^#BA:',$message)) { |
|
| 664 | + } elseif (preg_match(':^#BA:',$message)) { |
|
| 628 | 665 | $decode = array_merge(array('Message nature' => 'ATCComm'),$decode); |
| 629 | - } |
|
| 630 | - elseif (preg_match(':^#BB:',$message)) { |
|
| 666 | + } elseif (preg_match(':^#BB:',$message)) { |
|
| 631 | 667 | $decode = array_merge(array('Message nature' => 'Request TWIP Report'),$decode); |
| 632 | - } |
|
| 633 | - elseif (preg_match(':^#BC:',$message)) { |
|
| 668 | + } elseif (preg_match(':^#BC:',$message)) { |
|
| 634 | 669 | $decode = array_merge(array('Message nature' => 'Pushback Clearance Request'),$decode); |
| 635 | - } |
|
| 636 | - elseif (preg_match(':^#BD:',$message)) { |
|
| 670 | + } elseif (preg_match(':^#BD:',$message)) { |
|
| 637 | 671 | $decode = array_merge(array('Message nature' => 'Expected Taxi Clearance Request'),$decode); |
| 638 | - } |
|
| 639 | - elseif (preg_match(':^#BE:',$message)) { |
|
| 672 | + } elseif (preg_match(':^#BE:',$message)) { |
|
| 640 | 673 | $decode = array_merge(array('Message nature' => 'CPC Aircraft Log-On/Off Request'),$decode); |
| 641 | - } |
|
| 642 | - elseif (preg_match(':^#BF:',$message)) { |
|
| 674 | + } elseif (preg_match(':^#BF:',$message)) { |
|
| 643 | 675 | $decode = array_merge(array('Message nature' => 'CPC WILCO/UNABLE Response'),$decode); |
| 644 | - } |
|
| 645 | - elseif (preg_match(':^#H3:',$message)) { |
|
| 676 | + } elseif (preg_match(':^#H3:',$message)) { |
|
| 646 | 677 | $decode = array_merge(array('Message nature' => 'Icing Report'),$decode); |
| 647 | 678 | } |
| 648 | 679 | } |
| 649 | 680 | if ($label == '10') { |
| 650 | 681 | if (preg_match(':^DTO01:',$message)) { |
| 651 | 682 | $decode = array_merge(array('Message nature' => 'Delayed Takeoff Report'),$decode); |
| 652 | - } |
|
| 653 | - elseif (preg_match(':^AIS01:',$message)) { |
|
| 683 | + } elseif (preg_match(':^AIS01:',$message)) { |
|
| 654 | 684 | $decode = array_merge(array('Message nature' => 'AIS Request'),$decode); |
| 655 | - } |
|
| 656 | - elseif (preg_match(':^FTX01:',$message)) { |
|
| 685 | + } elseif (preg_match(':^FTX01:',$message)) { |
|
| 657 | 686 | $decode = array_merge(array('Message nature' => 'Free Text Downlink'),$decode); |
| 658 | - } |
|
| 659 | - elseif (preg_match(':^FPL01:',$message)) { |
|
| 687 | + } elseif (preg_match(':^FPL01:',$message)) { |
|
| 660 | 688 | $decode = array_merge(array('Message nature' => 'Flight Plan Request'),$decode); |
| 661 | - } |
|
| 662 | - elseif (preg_match(':^WAB01:',$message)) { |
|
| 689 | + } elseif (preg_match(':^WAB01:',$message)) { |
|
| 663 | 690 | $decode = array_merge(array('Message nature' => 'Weight & Balance Request'),$decode); |
| 664 | - } |
|
| 665 | - elseif (preg_match(':^MET01:',$message)) { |
|
| 691 | + } elseif (preg_match(':^MET01:',$message)) { |
|
| 666 | 692 | $decode = array_merge(array('Message nature' => 'Weather Data Request'),$decode); |
| 667 | - } |
|
| 668 | - elseif (preg_match(':^WAB02:',$message)) { |
|
| 693 | + } elseif (preg_match(':^WAB02:',$message)) { |
|
| 669 | 694 | $decode = array_merge(array('Message nature' => 'Weight and Balance Acknowledgement'),$decode); |
| 670 | 695 | } |
| 671 | 696 | } |
@@ -680,38 +705,28 @@ discard block |
||
| 680 | 705 | $vsta = array('Version' => $version); |
| 681 | 706 | if ($state == 'E') { |
| 682 | 707 | $vsta = array_merge($vsta,array('Link state' => 'Established')); |
| 683 | - } |
|
| 684 | - elseif ($state == 'L') { |
|
| 708 | + } elseif ($state == 'L') { |
|
| 685 | 709 | $vsta = array_merge($vsta,array('Link state' => 'Lost')); |
| 686 | - } |
|
| 687 | - else { |
|
| 710 | + } else { |
|
| 688 | 711 | $vsta = array_merge($vsta,array('Link state' => 'Unknown')); |
| 689 | 712 | } |
| 690 | 713 | if ($type == 'V') { |
| 691 | 714 | $vsta = array_merge($vsta,array('Link type' => 'VHF ACARS')); |
| 692 | - } |
|
| 693 | - elseif ($type == 'S') { |
|
| 715 | + } elseif ($type == 'S') { |
|
| 694 | 716 | $vsta = array_merge($vsta,array('Link type' => 'Generic SATCOM')); |
| 695 | - } |
|
| 696 | - elseif ($type == 'H') { |
|
| 717 | + } elseif ($type == 'H') { |
|
| 697 | 718 | $vsta = array_merge($vsta,array('Link type' => 'HF')); |
| 698 | - } |
|
| 699 | - elseif ($type == 'G') { |
|
| 719 | + } elseif ($type == 'G') { |
|
| 700 | 720 | $vsta = array_merge($vsta,array('Link type' => 'GlobalStar SATCOM')); |
| 701 | - } |
|
| 702 | - elseif ($type == 'C') { |
|
| 721 | + } elseif ($type == 'C') { |
|
| 703 | 722 | $vsta = array_merge($vsta,array('Link type' => 'ICO SATCOM')); |
| 704 | - } |
|
| 705 | - elseif ($type == '2') { |
|
| 723 | + } elseif ($type == '2') { |
|
| 706 | 724 | $vsta = array_merge($vsta,array('Link type' => 'VDL Mode 2')); |
| 707 | - } |
|
| 708 | - elseif ($type == 'X') { |
|
| 725 | + } elseif ($type == 'X') { |
|
| 709 | 726 | $vsta = array_merge($vsta,array('Link type' => 'Inmarsat Aero')); |
| 710 | - } |
|
| 711 | - elseif ($type == 'I') { |
|
| 727 | + } elseif ($type == 'I') { |
|
| 712 | 728 | $vsta = array_merge($vsta,array('Link type' => 'Irridium SATCOM')); |
| 713 | - } |
|
| 714 | - else { |
|
| 729 | + } else { |
|
| 715 | 730 | $vsta = array_merge($vsta,array('Link type' => 'Unknown')); |
| 716 | 731 | } |
| 717 | 732 | $vsta = array_merge($vsta,array('Event occured at' => implode(':',str_split($at,2)))); |
@@ -720,7 +735,9 @@ discard block |
||
| 720 | 735 | } |
| 721 | 736 | |
| 722 | 737 | $title = $this->getTitlefromLabel($label); |
| 723 | - if ($title != '') $decode = array_merge(array('Message title' => $title),$decode); |
|
| 738 | + if ($title != '') { |
|
| 739 | + $decode = array_merge(array('Message title' => $title),$decode); |
|
| 740 | + } |
|
| 724 | 741 | /* |
| 725 | 742 | // Business jets always use GS0001 |
| 726 | 743 | if ($ident != 'GS0001') $info = $this->addModeSData($ident,$registration,$icao,$airicao,$latitude,$longitude); |
@@ -756,31 +773,54 @@ discard block |
||
| 756 | 773 | $msg = $message['message']; |
| 757 | 774 | $decode = $message['decode']; |
| 758 | 775 | $registration = (string)$message['registration']; |
| 759 | - if (isset($decode['latitude'])) $latitude = $decode['latitude']; |
|
| 760 | - else $latitude = ''; |
|
| 761 | - if (isset($decode['longitude'])) $longitude = $decode['longitude']; |
|
| 762 | - else $longitude = ''; |
|
| 763 | - if (isset($decode['airicao'])) $airicao = $decode['airicao']; |
|
| 764 | - else $airicao = ''; |
|
| 765 | - if (isset($decode['icao'])) $icao = $decode['icao']; |
|
| 766 | - else $icao = $Translation->checkTranslation($ident); |
|
| 776 | + if (isset($decode['latitude'])) { |
|
| 777 | + $latitude = $decode['latitude']; |
|
| 778 | + } else { |
|
| 779 | + $latitude = ''; |
|
| 780 | + } |
|
| 781 | + if (isset($decode['longitude'])) { |
|
| 782 | + $longitude = $decode['longitude']; |
|
| 783 | + } else { |
|
| 784 | + $longitude = ''; |
|
| 785 | + } |
|
| 786 | + if (isset($decode['airicao'])) { |
|
| 787 | + $airicao = $decode['airicao']; |
|
| 788 | + } else { |
|
| 789 | + $airicao = ''; |
|
| 790 | + } |
|
| 791 | + if (isset($decode['icao'])) { |
|
| 792 | + $icao = $decode['icao']; |
|
| 793 | + } else { |
|
| 794 | + $icao = $Translation->checkTranslation($ident); |
|
| 795 | + } |
|
| 767 | 796 | $image_array = $Image->getSpotterImage($registration); |
| 768 | 797 | if (!isset($image_array[0]['registration'])) { |
| 769 | 798 | $Image->addSpotterImage($registration); |
| 770 | 799 | } |
| 771 | 800 | // Business jets always use GS0001 |
| 772 | - if ($ident != 'GS0001') $info = $this->addModeSData($ident,$registration,$icao,$airicao,$latitude,$longitude); |
|
| 773 | - if ($globalDebug && isset($info) && $info != '') echo $info; |
|
| 774 | - if (count($decode) > 0) $decode_json = json_encode($decode); |
|
| 775 | - else $decode_json = ''; |
|
| 801 | + if ($ident != 'GS0001') { |
|
| 802 | + $info = $this->addModeSData($ident,$registration,$icao,$airicao,$latitude,$longitude); |
|
| 803 | + } |
|
| 804 | + if ($globalDebug && isset($info) && $info != '') { |
|
| 805 | + echo $info; |
|
| 806 | + } |
|
| 807 | + if (count($decode) > 0) { |
|
| 808 | + $decode_json = json_encode($decode); |
|
| 809 | + } else { |
|
| 810 | + $decode_json = ''; |
|
| 811 | + } |
|
| 776 | 812 | if (isset($decode['Departure airport']) && isset($decode['Departure hour']) && isset($decode['Arrival airport']) && isset($decode['Arrival hour'])) { |
| 777 | 813 | $Schedule->addSchedule($icao,$decode['Departure airport'],$decode['Departure hour'],$decode['Arrival airport'],$decode['Arrival hour'],'ACARS'); |
| 778 | 814 | } elseif (isset($decode['Departure airport']) && isset($decode['Arrival airport'])) { |
| 779 | 815 | $Schedule->addSchedule($icao,$decode['Departure airport'],'',$decode['Arrival airport'],'','ACARS'); |
| 780 | 816 | } |
| 781 | 817 | $result = $this->addLiveAcarsData($ident,$registration,$label,$block_id,$msg_no,$msg,$decode_json); |
| 782 | - if (!isset($globalACARSArchive)) $globalACARSArchive = array('10','80','81','82','3F'); |
|
| 783 | - if ($result && in_array($label,$globalACARSArchive)) $this->addArchiveAcarsData($ident,$registration,$label,$block_id,$msg_no,$msg,$decode_json); |
|
| 818 | + if (!isset($globalACARSArchive)) { |
|
| 819 | + $globalACARSArchive = array('10','80','81','82','3F'); |
|
| 820 | + } |
|
| 821 | + if ($result && in_array($label,$globalACARSArchive)) { |
|
| 822 | + $this->addArchiveAcarsData($ident,$registration,$label,$block_id,$msg_no,$msg,$decode_json); |
|
| 823 | + } |
|
| 784 | 824 | if ($globalDebug && count($decode) > 0) { |
| 785 | 825 | echo "Human readable data : ".implode(' - ',$decode)."\n"; |
| 786 | 826 | } |
@@ -805,7 +845,9 @@ discard block |
||
| 805 | 845 | if ($label != 'SQ' && $label != 'Q0' && $label != '_d' && $message != '') { |
| 806 | 846 | $Connection = new Connection($this->db); |
| 807 | 847 | $this->db = $Connection->db; |
| 808 | - if ($globalDebug) echo "Test if not already in Live ACARS table..."; |
|
| 848 | + if ($globalDebug) { |
|
| 849 | + echo "Test if not already in Live ACARS table..."; |
|
| 850 | + } |
|
| 809 | 851 | $query_test = "SELECT COUNT(*) as nb FROM acars_live WHERE ident = :ident AND registration = :registration AND message = :message"; |
| 810 | 852 | $query_test_values = array(':ident' => $ident,':registration' => $registration, ':message' => $message); |
| 811 | 853 | try { |
@@ -816,7 +858,9 @@ discard block |
||
| 816 | 858 | return false; |
| 817 | 859 | } |
| 818 | 860 | if ($stht->fetchColumn() == 0) { |
| 819 | - if ($globalDebug) echo "Add Live ACARS data..."; |
|
| 861 | + if ($globalDebug) { |
|
| 862 | + echo "Add Live ACARS data..."; |
|
| 863 | + } |
|
| 820 | 864 | $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)"; |
| 821 | 865 | $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")); |
| 822 | 866 | try { |
@@ -827,10 +871,14 @@ discard block |
||
| 827 | 871 | return false; |
| 828 | 872 | } |
| 829 | 873 | } else { |
| 830 | - if ($globalDebug) echo "Data already in DB...\n"; |
|
| 874 | + if ($globalDebug) { |
|
| 875 | + echo "Data already in DB...\n"; |
|
| 876 | + } |
|
| 831 | 877 | return false; |
| 832 | 878 | } |
| 833 | - if ($globalDebug) echo "Done\n"; |
|
| 879 | + if ($globalDebug) { |
|
| 880 | + echo "Done\n"; |
|
| 881 | + } |
|
| 834 | 882 | return true; |
| 835 | 883 | } |
| 836 | 884 | return false; |
@@ -864,7 +912,9 @@ discard block |
||
| 864 | 912 | } |
| 865 | 913 | if ($stht->fetchColumn() == 0) { |
| 866 | 914 | */ |
| 867 | - if ($globalDebug) echo "Add Live ACARS data..."; |
|
| 915 | + if ($globalDebug) { |
|
| 916 | + echo "Add Live ACARS data..."; |
|
| 917 | + } |
|
| 868 | 918 | $query = "INSERT INTO acars_archive (ident,registration,label,block_id,msg_no,message,decode) VALUES (:ident,:registration,:label,:block_id,:msg_no,:message,:decode)"; |
| 869 | 919 | $query_values = array(':ident' => $ident,':registration' => $registration, ':label' => $label,':block_id' => $block_id, ':msg_no' => $msg_no, ':message' => $message, ':decode' => $decode); |
| 870 | 920 | try { |
@@ -873,7 +923,9 @@ discard block |
||
| 873 | 923 | } catch(PDOException $e) { |
| 874 | 924 | return "error : ".$e->getMessage(); |
| 875 | 925 | } |
| 876 | - if ($globalDebug) echo "Done\n"; |
|
| 926 | + if ($globalDebug) { |
|
| 927 | + echo "Done\n"; |
|
| 928 | + } |
|
| 877 | 929 | } |
| 878 | 930 | return ''; |
| 879 | 931 | } |
@@ -897,8 +949,11 @@ discard block |
||
| 897 | 949 | return ''; |
| 898 | 950 | } |
| 899 | 951 | $row = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 900 | - if (count($row) > 0) return $row[0]['title']; |
|
| 901 | - else return ''; |
|
| 952 | + if (count($row) > 0) { |
|
| 953 | + return $row[0]['title']; |
|
| 954 | + } else { |
|
| 955 | + return ''; |
|
| 956 | + } |
|
| 902 | 957 | } |
| 903 | 958 | |
| 904 | 959 | /** |
@@ -917,8 +972,11 @@ discard block |
||
| 917 | 972 | return array(); |
| 918 | 973 | } |
| 919 | 974 | $row = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 920 | - if (count($row) > 0) return $row; |
|
| 921 | - else return array(); |
|
| 975 | + if (count($row) > 0) { |
|
| 976 | + return $row; |
|
| 977 | + } else { |
|
| 978 | + return array(); |
|
| 979 | + } |
|
| 922 | 980 | } |
| 923 | 981 | |
| 924 | 982 | /** |
@@ -938,8 +996,11 @@ discard block |
||
| 938 | 996 | return array(); |
| 939 | 997 | } |
| 940 | 998 | $row = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 941 | - if (count($row) > 0) return $row[0]; |
|
| 942 | - else return array(); |
|
| 999 | + if (count($row) > 0) { |
|
| 1000 | + return $row[0]; |
|
| 1001 | + } else { |
|
| 1002 | + return array(); |
|
| 1003 | + } |
|
| 943 | 1004 | } |
| 944 | 1005 | |
| 945 | 1006 | /** |
@@ -987,19 +1048,35 @@ discard block |
||
| 987 | 1048 | if ($row['registration'] != '') { |
| 988 | 1049 | $row['registration'] = str_replace('.','',$row['registration']); |
| 989 | 1050 | $image_array = $Image->getSpotterImage($row['registration']); |
| 990 | - 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'])); |
|
| 991 | - else $data = array_merge($data,array('image' => '','image_thumbnail' => '','image_copyright' => '','image_source' => '','image_source_website' => '')); |
|
| 992 | - } else $data = array_merge($data,array('image' => '','image_thumbnail' => '','image_copyright' => '','image_source' => '','image_source_website' => '')); |
|
| 993 | - if ($row['registration'] == '') $row['registration'] = 'NA'; |
|
| 994 | - if ($row['ident'] == '') $row['ident'] = 'NA'; |
|
| 1051 | + if (count($image_array) > 0) { |
|
| 1052 | + $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'])); |
|
| 1053 | + } else { |
|
| 1054 | + $data = array_merge($data,array('image' => '','image_thumbnail' => '','image_copyright' => '','image_source' => '','image_source_website' => '')); |
|
| 1055 | + } |
|
| 1056 | + } else { |
|
| 1057 | + $data = array_merge($data,array('image' => '','image_thumbnail' => '','image_copyright' => '','image_source' => '','image_source_website' => '')); |
|
| 1058 | + } |
|
| 1059 | + if ($row['registration'] == '') { |
|
| 1060 | + $row['registration'] = 'NA'; |
|
| 1061 | + } |
|
| 1062 | + if ($row['ident'] == '') { |
|
| 1063 | + $row['ident'] = 'NA'; |
|
| 1064 | + } |
|
| 995 | 1065 | $identicao = $Spotter->getAllAirlineInfo(substr($row['ident'],0,2)); |
| 996 | 1066 | if (isset($identicao[0])) { |
| 997 | 1067 | if (substr($row['ident'],0,2) == 'AF') { |
| 998 | - if (filter_var(substr($row['ident'],2),FILTER_VALIDATE_INT,array("flags"=>FILTER_FLAG_ALLOW_OCTAL))) $icao = $row['ident']; |
|
| 999 | - else $icao = 'AFR'.ltrim(substr($row['ident'],2),'0'); |
|
| 1000 | - } else $icao = $identicao[0]['icao'].ltrim(substr($row['ident'],2),'0'); |
|
| 1068 | + if (filter_var(substr($row['ident'],2),FILTER_VALIDATE_INT,array("flags"=>FILTER_FLAG_ALLOW_OCTAL))) { |
|
| 1069 | + $icao = $row['ident']; |
|
| 1070 | + } else { |
|
| 1071 | + $icao = 'AFR'.ltrim(substr($row['ident'],2),'0'); |
|
| 1072 | + } |
|
| 1073 | + } else { |
|
| 1074 | + $icao = $identicao[0]['icao'].ltrim(substr($row['ident'],2),'0'); |
|
| 1075 | + } |
|
| 1001 | 1076 | $data = array_merge($data,array('airline_icao' => $identicao[0]['icao'],'airline_name' => $identicao[0]['name'])); |
| 1002 | - } else $icao = $row['ident']; |
|
| 1077 | + } else { |
|
| 1078 | + $icao = $row['ident']; |
|
| 1079 | + } |
|
| 1003 | 1080 | $icao = $Translation->checkTranslation($icao,false); |
| 1004 | 1081 | $decode = json_decode($row['decode'],true); |
| 1005 | 1082 | $found = false; |
@@ -1024,7 +1101,9 @@ discard block |
||
| 1024 | 1101 | $found = true; |
| 1025 | 1102 | } |
| 1026 | 1103 | } |
| 1027 | - if ($found) $row['decode'] = json_encode($decode); |
|
| 1104 | + if ($found) { |
|
| 1105 | + $row['decode'] = json_encode($decode); |
|
| 1106 | + } |
|
| 1028 | 1107 | $data = array_merge($data,array('registration' => $row['registration'],'message' => $row['message'], 'date' => $row['date'], 'ident' => $icao, 'decode' => $row['decode'])); |
| 1029 | 1108 | $result[] = $data; |
| 1030 | 1109 | $i++; |
@@ -1032,8 +1111,9 @@ discard block |
||
| 1032 | 1111 | if (isset($result)) { |
| 1033 | 1112 | $result[0]['query_number_rows'] = $i; |
| 1034 | 1113 | return $result; |
| 1114 | + } else { |
|
| 1115 | + return array(); |
|
| 1035 | 1116 | } |
| 1036 | - else return array(); |
|
| 1037 | 1117 | } |
| 1038 | 1118 | |
| 1039 | 1119 | /** |
@@ -1086,31 +1166,51 @@ discard block |
||
| 1086 | 1166 | if ($row['registration'] != '') { |
| 1087 | 1167 | $row['registration'] = str_replace('.','',$row['registration']); |
| 1088 | 1168 | $image_array = $Image->getSpotterImage($row['registration']); |
| 1089 | - 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'])); |
|
| 1090 | - else $data = array_merge($data,array('image_thumbnail' => '','image_copyright' => '','image_source' => '','image_source_website' => '')); |
|
| 1091 | - } else $data = array_merge($data,array('image_thumbnail' => '','image_copyright' => '','image_source' => '','image_source_website' => '')); |
|
| 1169 | + if (count($image_array) > 0) { |
|
| 1170 | + $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'])); |
|
| 1171 | + } else { |
|
| 1172 | + $data = array_merge($data,array('image_thumbnail' => '','image_copyright' => '','image_source' => '','image_source_website' => '')); |
|
| 1173 | + } |
|
| 1174 | + } else { |
|
| 1175 | + $data = array_merge($data,array('image_thumbnail' => '','image_copyright' => '','image_source' => '','image_source_website' => '')); |
|
| 1176 | + } |
|
| 1092 | 1177 | $icao = ''; |
| 1093 | - if ($row['registration'] == '') $row['registration'] = 'NA'; |
|
| 1094 | - if ($row['ident'] == '') $row['ident'] = 'NA'; |
|
| 1178 | + if ($row['registration'] == '') { |
|
| 1179 | + $row['registration'] = 'NA'; |
|
| 1180 | + } |
|
| 1181 | + if ($row['ident'] == '') { |
|
| 1182 | + $row['ident'] = 'NA'; |
|
| 1183 | + } |
|
| 1095 | 1184 | $identicao = $Spotter->getAllAirlineInfo(substr($row['ident'],0,2)); |
| 1096 | 1185 | if (isset($identicao[0])) { |
| 1097 | 1186 | if (substr($row['ident'],0,2) == 'AF') { |
| 1098 | - if (filter_var(substr($row['ident'],2),FILTER_VALIDATE_INT,array("flags"=>FILTER_FLAG_ALLOW_OCTAL))) $icao = $row['ident']; |
|
| 1099 | - else $icao = 'AFR'.ltrim(substr($row['ident'],2),'0'); |
|
| 1100 | - } else $icao = $identicao[0]['icao'].ltrim(substr($row['ident'],2),'0'); |
|
| 1187 | + if (filter_var(substr($row['ident'],2),FILTER_VALIDATE_INT,array("flags"=>FILTER_FLAG_ALLOW_OCTAL))) { |
|
| 1188 | + $icao = $row['ident']; |
|
| 1189 | + } else { |
|
| 1190 | + $icao = 'AFR'.ltrim(substr($row['ident'],2),'0'); |
|
| 1191 | + } |
|
| 1192 | + } else { |
|
| 1193 | + $icao = $identicao[0]['icao'].ltrim(substr($row['ident'],2),'0'); |
|
| 1194 | + } |
|
| 1101 | 1195 | $data = array_merge($data,array('airline_icao' => $identicao[0]['icao'],'airline_name' => $identicao[0]['name'])); |
| 1102 | - } else $icao = $row['ident']; |
|
| 1196 | + } else { |
|
| 1197 | + $icao = $row['ident']; |
|
| 1198 | + } |
|
| 1103 | 1199 | $icao = $Translation->checkTranslation($icao); |
| 1104 | 1200 | $decode = json_decode($row['decode'],true); |
| 1105 | 1201 | $found = false; |
| 1106 | 1202 | if ($decode != '' && array_key_exists('Departure airport',$decode)) { |
| 1107 | 1203 | $airport_info = $Spotter->getAllAirportInfo($decode['Departure airport']); |
| 1108 | - 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>'; |
|
| 1204 | + if (isset($airport_info[0]['icao'])) { |
|
| 1205 | + $decode['Departure airport'] = '<a href="'.$globalURL.'/airport/'.$airport_info[0]['icao'].'">'.$airport_info[0]['city'].','.$airport_info[0]['country'].' ('.$airport_info[0]['icao'].')</a>'; |
|
| 1206 | + } |
|
| 1109 | 1207 | $found = true; |
| 1110 | 1208 | } |
| 1111 | 1209 | if ($decode != '' && array_key_exists('Arrival airport',$decode)) { |
| 1112 | 1210 | $airport_info = $Spotter->getAllAirportInfo($decode['Arrival airport']); |
| 1113 | - 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>'; |
|
| 1211 | + if (isset($airport_info[0]['icao'])) { |
|
| 1212 | + $decode['Arrival airport'] = '<a href="'.$globalURL.'/airport/'.$airport_info[0]['icao'].'">'.$airport_info[0]['city'].','.$airport_info[0]['country'].' ('.$airport_info[0]['icao'].')</a>'; |
|
| 1213 | + } |
|
| 1114 | 1214 | $found = true; |
| 1115 | 1215 | } |
| 1116 | 1216 | if ($decode != '' && array_key_exists('Airport/Waypoint name',$decode)) { |
@@ -1120,7 +1220,9 @@ discard block |
||
| 1120 | 1220 | $found = true; |
| 1121 | 1221 | } |
| 1122 | 1222 | } |
| 1123 | - if ($found) $row['decode'] = json_encode($decode); |
|
| 1223 | + if ($found) { |
|
| 1224 | + $row['decode'] = json_encode($decode); |
|
| 1225 | + } |
|
| 1124 | 1226 | $data = array_merge($data,array('registration' => $row['registration'],'message' => $row['message'], 'date' => $row['date'], 'ident' => $icao, 'decode' => $row['decode'])); |
| 1125 | 1227 | $result[] = $data; |
| 1126 | 1228 | $i++; |
@@ -1128,7 +1230,9 @@ discard block |
||
| 1128 | 1230 | if (!empty($result)) { |
| 1129 | 1231 | $result[0]['query_number_rows'] = $i; |
| 1130 | 1232 | return $result; |
| 1131 | - } else return array(); |
|
| 1233 | + } else { |
|
| 1234 | + return array(); |
|
| 1235 | + } |
|
| 1132 | 1236 | } |
| 1133 | 1237 | |
| 1134 | 1238 | /** |
@@ -1147,25 +1251,37 @@ discard block |
||
| 1147 | 1251 | $ident = trim($ident); |
| 1148 | 1252 | $Translation = new Translation($this->db); |
| 1149 | 1253 | $Spotter = new Spotter($this->db); |
| 1150 | - if ($globalDebug) echo "Test if we add ModeS data..."; |
|
| 1254 | + if ($globalDebug) { |
|
| 1255 | + echo "Test if we add ModeS data..."; |
|
| 1256 | + } |
|
| 1151 | 1257 | //if ($icao == '') $icao = ACARS->ident2icao($ident); |
| 1152 | - if ($icao == '') $icao = $Translation->checkTranslation($ident); |
|
| 1153 | - if ($globalDebug) echo '- Ident : '.$icao.' - '; |
|
| 1258 | + if ($icao == '') { |
|
| 1259 | + $icao = $Translation->checkTranslation($ident); |
|
| 1260 | + } |
|
| 1261 | + if ($globalDebug) { |
|
| 1262 | + echo '- Ident : '.$icao.' - '; |
|
| 1263 | + } |
|
| 1154 | 1264 | if ($ident == '' || $registration == '') { |
| 1155 | - if ($globalDebug) echo "Ident or registration null, exit\n"; |
|
| 1265 | + if ($globalDebug) { |
|
| 1266 | + echo "Ident or registration null, exit\n"; |
|
| 1267 | + } |
|
| 1156 | 1268 | return ''; |
| 1157 | 1269 | } |
| 1158 | 1270 | $registration = str_replace('.','',$registration); |
| 1159 | 1271 | $ident = $Translation->ident2icao($ident); |
| 1160 | 1272 | // Check if a flight with same registration is flying now, if ok check if callsign = name in ACARS, else add it to translation |
| 1161 | - if ($globalDebug) echo "Check if needed to add translation ".$ident.'... '; |
|
| 1273 | + if ($globalDebug) { |
|
| 1274 | + echo "Check if needed to add translation ".$ident.'... '; |
|
| 1275 | + } |
|
| 1162 | 1276 | $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"; |
| 1163 | 1277 | $querysi_values = array(':registration' => $registration); |
| 1164 | 1278 | try { |
| 1165 | 1279 | $sthsi = $this->db->prepare($querysi); |
| 1166 | 1280 | $sthsi->execute($querysi_values); |
| 1167 | 1281 | } catch(PDOException $e) { |
| 1168 | - if ($globalDebug) echo $e->getMessage(); |
|
| 1282 | + if ($globalDebug) { |
|
| 1283 | + echo $e->getMessage(); |
|
| 1284 | + } |
|
| 1169 | 1285 | return "error : ".$e->getMessage(); |
| 1170 | 1286 | } |
| 1171 | 1287 | $resultsi = $sthsi->fetch(PDO::FETCH_ASSOC); |
@@ -1173,9 +1289,14 @@ discard block |
||
| 1173 | 1289 | if (count($resultsi) > 0 && $resultsi['ident'] != $ident && $resultsi['ident'] != '') { |
| 1174 | 1290 | $Translation = new Translation($this->db); |
| 1175 | 1291 | $trans_ident = $Translation->getOperator($resultsi['ident']); |
| 1176 | - if ($globalDebug) echo 'Add translation to table : '.$ident.' -> '.$resultsi['ident'].' '; |
|
| 1177 | - if ($ident != $trans_ident) $Translation->addOperator($resultsi['ident'],$ident,'ACARS'); |
|
| 1178 | - elseif ($trans_ident == $ident) $Translation->updateOperator($resultsi['ident'],$ident,'ACARS'); |
|
| 1292 | + if ($globalDebug) { |
|
| 1293 | + echo 'Add translation to table : '.$ident.' -> '.$resultsi['ident'].' '; |
|
| 1294 | + } |
|
| 1295 | + if ($ident != $trans_ident) { |
|
| 1296 | + $Translation->addOperator($resultsi['ident'],$ident,'ACARS'); |
|
| 1297 | + } elseif ($trans_ident == $ident) { |
|
| 1298 | + $Translation->updateOperator($resultsi['ident'],$ident,'ACARS'); |
|
| 1299 | + } |
|
| 1179 | 1300 | } else { |
| 1180 | 1301 | if ($registration != '' && $latitude != '' && $longitude != '') { |
| 1181 | 1302 | $query = "SELECT ModeS FROM aircraft_modes WHERE Registration = :registration LIMIT 1"; |
@@ -1184,32 +1305,46 @@ discard block |
||
| 1184 | 1305 | $sth = $this->db->prepare($query); |
| 1185 | 1306 | $sth->execute($query_values); |
| 1186 | 1307 | } catch(PDOException $e) { |
| 1187 | - if ($globalDebug) echo $e->getMessage(); |
|
| 1308 | + if ($globalDebug) { |
|
| 1309 | + echo $e->getMessage(); |
|
| 1310 | + } |
|
| 1188 | 1311 | return "error : ".$e->getMessage(); |
| 1189 | 1312 | } |
| 1190 | 1313 | $result = $sth->fetch(PDO::FETCH_ASSOC); |
| 1191 | 1314 | $sth->closeCursor(); |
| 1192 | - if (isset($result['modes'])) $hex = $result['modes']; |
|
| 1193 | - else $hex = ''; |
|
| 1315 | + if (isset($result['modes'])) { |
|
| 1316 | + $hex = $result['modes']; |
|
| 1317 | + } else { |
|
| 1318 | + $hex = ''; |
|
| 1319 | + } |
|
| 1194 | 1320 | $SI_data = array('hex' => $hex,'ident' => $ident,'aircraft_icao' => $ICAOTypeCode,'registration' => $registration,'latitude' => $latitude,'$longitude' => $longitude,'format_source' => 'ACARS'); |
| 1195 | - if ($this->fromACARSscript) $this->SI->add($SI_data); |
|
| 1321 | + if ($this->fromACARSscript) { |
|
| 1322 | + $this->SI->add($SI_data); |
|
| 1323 | + } |
|
| 1196 | 1324 | } |
| 1197 | 1325 | } |
| 1198 | - if ($globalDebug) echo 'Done'."\n"; |
|
| 1326 | + if ($globalDebug) { |
|
| 1327 | + echo 'Done'."\n"; |
|
| 1328 | + } |
|
| 1199 | 1329 | $query = "SELECT flightaware_id, ModeS FROM spotter_output WHERE ident = :ident AND format_source <> 'ACARS' ORDER BY spotter_id DESC LIMIT 1"; |
| 1200 | 1330 | $query_values = array(':ident' => $icao); |
| 1201 | 1331 | try { |
| 1202 | 1332 | $sth = $this->db->prepare($query); |
| 1203 | 1333 | $sth->execute($query_values); |
| 1204 | 1334 | } catch(PDOException $e) { |
| 1205 | - if ($globalDebug) echo $e->getMessage(); |
|
| 1335 | + if ($globalDebug) { |
|
| 1336 | + echo $e->getMessage(); |
|
| 1337 | + } |
|
| 1206 | 1338 | return "error : ".$e->getMessage(); |
| 1207 | 1339 | } |
| 1208 | 1340 | $result = $sth->fetch(PDO::FETCH_ASSOC); |
| 1209 | 1341 | $sth->closeCursor(); |
| 1210 | 1342 | if (isset($result['flightaware_id'])) { |
| 1211 | - if (isset($result['ModeS'])) $ModeS = $result['ModeS']; |
|
| 1212 | - else $ModeS = ''; |
|
| 1343 | + if (isset($result['ModeS'])) { |
|
| 1344 | + $ModeS = $result['ModeS']; |
|
| 1345 | + } else { |
|
| 1346 | + $ModeS = ''; |
|
| 1347 | + } |
|
| 1213 | 1348 | if ($ModeS == '') { |
| 1214 | 1349 | $id = explode('-',$result['flightaware_id']); |
| 1215 | 1350 | $ModeS = $id[0]; |
@@ -1222,24 +1357,32 @@ discard block |
||
| 1222 | 1357 | $sthc = $this->db->prepare($queryc); |
| 1223 | 1358 | $sthc->execute($queryc_values); |
| 1224 | 1359 | } catch(PDOException $e) { |
| 1225 | - if ($globalDebug) echo $e->getMessage(); |
|
| 1360 | + if ($globalDebug) { |
|
| 1361 | + echo $e->getMessage(); |
|
| 1362 | + } |
|
| 1226 | 1363 | return "error : ".$e->getMessage(); |
| 1227 | 1364 | } |
| 1228 | 1365 | $row = $sthc->fetch(PDO::FETCH_ASSOC); |
| 1229 | 1366 | $sthc->closeCursor(); |
| 1230 | 1367 | if (count($row) == 0) { |
| 1231 | - if ($globalDebug) echo " Add to ModeS table - "; |
|
| 1368 | + if ($globalDebug) { |
|
| 1369 | + echo " Add to ModeS table - "; |
|
| 1370 | + } |
|
| 1232 | 1371 | $queryi = "INSERT INTO aircraft_modes (ModeS,ModeSCountry,Registration,ICAOTypeCode,Source) VALUES (:ModeS,:ModeSCountry,:Registration, :ICAOTypeCode,'ACARS')"; |
| 1233 | 1372 | $queryi_values = array(':ModeS' => $ModeS,':ModeSCountry' => $country,':Registration' => $registration, ':ICAOTypeCode' => $ICAOTypeCode); |
| 1234 | 1373 | try { |
| 1235 | 1374 | $sthi = $this->db->prepare($queryi); |
| 1236 | 1375 | $sthi->execute($queryi_values); |
| 1237 | 1376 | } catch(PDOException $e) { |
| 1238 | - if ($globalDebug) echo $e->getMessage(); |
|
| 1377 | + if ($globalDebug) { |
|
| 1378 | + echo $e->getMessage(); |
|
| 1379 | + } |
|
| 1239 | 1380 | return "error : ".$e->getMessage(); |
| 1240 | 1381 | } |
| 1241 | 1382 | } else { |
| 1242 | - if ($globalDebug) echo " Update ModeS table - "; |
|
| 1383 | + if ($globalDebug) { |
|
| 1384 | + echo " Update ModeS table - "; |
|
| 1385 | + } |
|
| 1243 | 1386 | if ($ICAOTypeCode != '') { |
| 1244 | 1387 | $queryi = "UPDATE aircraft_modes SET ModeSCountry = :ModeSCountry,Registration = :Registration,ICAOTypeCode = :ICAOTypeCode,Source = 'ACARS',LastModified = NOW() WHERE ModeS = :ModeS"; |
| 1245 | 1388 | $queryi_values = array(':ModeS' => $ModeS,':ModeSCountry' => $country,':Registration' => $registration, ':ICAOTypeCode' => $ICAOTypeCode); |
@@ -1251,7 +1394,9 @@ discard block |
||
| 1251 | 1394 | $sthi = $this->db->prepare($queryi); |
| 1252 | 1395 | $sthi->execute($queryi_values); |
| 1253 | 1396 | } catch(PDOException $e) { |
| 1254 | - if ($globalDebug) echo $e->getMessage(); |
|
| 1397 | + if ($globalDebug) { |
|
| 1398 | + echo $e->getMessage(); |
|
| 1399 | + } |
|
| 1255 | 1400 | return "error : ".$e->getMessage(); |
| 1256 | 1401 | } |
| 1257 | 1402 | } |
@@ -1272,7 +1417,9 @@ discard block |
||
| 1272 | 1417 | return "error : ".$e->getMessage(); |
| 1273 | 1418 | } |
| 1274 | 1419 | */ |
| 1275 | - if ($globalDebug) echo " Update Spotter_output table - "; |
|
| 1420 | + if ($globalDebug) { |
|
| 1421 | + echo " Update Spotter_output table - "; |
|
| 1422 | + } |
|
| 1276 | 1423 | if ($ICAOTypeCode != '') { |
| 1277 | 1424 | if ($globalDBdriver == 'mysql') { |
| 1278 | 1425 | $queryi = "UPDATE spotter_output SET registration = :Registration,aircraft_icao = :ICAOTypeCode WHERE ident = :ident AND date >= date_sub(UTC_TIMESTAMP(), INTERVAL 1 HOUR)"; |
@@ -1283,8 +1430,7 @@ discard block |
||
| 1283 | 1430 | } else { |
| 1284 | 1431 | if ($globalDBdriver == 'mysql') { |
| 1285 | 1432 | $queryi = "UPDATE spotter_output SET registration = :Registration WHERE ident = :ident AND date >= date_sub(UTC_TIMESTAMP(), INTERVAL 1 HOUR)"; |
| 1286 | - } |
|
| 1287 | - elseif ($globalDBdriver == 'pgsql') { |
|
| 1433 | + } elseif ($globalDBdriver == 'pgsql') { |
|
| 1288 | 1434 | $queryi = "UPDATE spotter_output SET registration = :Registration WHERE ident = :ident AND date >= NOW() AT TIME ZONE 'UTC' - INTERVAL '1 HOUR'"; |
| 1289 | 1435 | } |
| 1290 | 1436 | $queryi_values = array(':Registration' => $registration,':ident' => $icao); |
@@ -1293,14 +1439,20 @@ discard block |
||
| 1293 | 1439 | $sthi = $this->db->prepare($queryi); |
| 1294 | 1440 | $sthi->execute($queryi_values); |
| 1295 | 1441 | } catch(PDOException $e) { |
| 1296 | - if ($globalDebug) echo $e->getMessage(); |
|
| 1442 | + if ($globalDebug) { |
|
| 1443 | + echo $e->getMessage(); |
|
| 1444 | + } |
|
| 1297 | 1445 | return "error : ".$e->getMessage(); |
| 1298 | 1446 | } |
| 1299 | 1447 | } |
| 1300 | 1448 | } else { |
| 1301 | - if ($globalDebug) echo " Can't find ModeS in spotter_output - "; |
|
| 1449 | + if ($globalDebug) { |
|
| 1450 | + echo " Can't find ModeS in spotter_output - "; |
|
| 1451 | + } |
|
| 1452 | + } |
|
| 1453 | + if ($globalDebug) { |
|
| 1454 | + echo "Done\n"; |
|
| 1302 | 1455 | } |
| 1303 | - if ($globalDebug) echo "Done\n"; |
|
| 1304 | 1456 | return ''; |
| 1305 | 1457 | } |
| 1306 | 1458 | } |