@@ -4,11 +4,19 @@ 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 | -} |
|
| 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 | + } |
|
| 12 | 20 | /* |
| 13 | 21 | if (isset($_SESSION['errorlst'])) { |
| 14 | 22 | header('Content-Encoding: none;'); |
@@ -156,45 +164,72 @@ discard block |
||
| 156 | 164 | </div> |
| 157 | 165 | <p> |
| 158 | 166 | <label for="dbhost">Database hostname</label> |
| 159 | - <input type="text" name="dbhost" id="dbhost" value="<?php if (isset($globalDBhost)) print $globalDBhost; ?>" /> |
|
| 167 | + <input type="text" name="dbhost" id="dbhost" value="<?php if (isset($globalDBhost)) { |
|
| 168 | + print $globalDBhost; |
|
| 169 | +} |
|
| 170 | +?>" /> |
|
| 160 | 171 | </p> |
| 161 | 172 | <p> |
| 162 | 173 | <label for="dbport">Database port</label> |
| 163 | - <input type="text" name="dbport" id="dbport" value="<?php if (isset($globalDBport)) print $globalDBport; ?>" /> |
|
| 174 | + <input type="text" name="dbport" id="dbport" value="<?php if (isset($globalDBport)) { |
|
| 175 | + print $globalDBport; |
|
| 176 | +} |
|
| 177 | +?>" /> |
|
| 164 | 178 | <p class="help-block">Default is 3306 for MariaDB/MySQL, 5432 for PostgreSQL</p> |
| 165 | 179 | </p> |
| 166 | 180 | <p> |
| 167 | 181 | <label for="dbname">Database name</label> |
| 168 | - <input type="text" name="dbname" id="dbname" value="<?php if (isset($globalDBname)) print $globalDBname; ?>" /> |
|
| 182 | + <input type="text" name="dbname" id="dbname" value="<?php if (isset($globalDBname)) { |
|
| 183 | + print $globalDBname; |
|
| 184 | +} |
|
| 185 | +?>" /> |
|
| 169 | 186 | </p> |
| 170 | 187 | <p> |
| 171 | 188 | <label for="dbuser">Database user</label> |
| 172 | - <input type="text" name="dbuser" id="dbuser" value="<?php if (isset($globalDBuser)) print $globalDBuser; ?>" /> |
|
| 189 | + <input type="text" name="dbuser" id="dbuser" value="<?php if (isset($globalDBuser)) { |
|
| 190 | + print $globalDBuser; |
|
| 191 | +} |
|
| 192 | +?>" /> |
|
| 173 | 193 | </p> |
| 174 | 194 | <p> |
| 175 | 195 | <label for="dbuserpass">Database user password</label> |
| 176 | - <input type="password" name="dbuserpass" id="dbuserpass" value="<?php if (isset($globalDBpass)) print $globalDBpass; ?>" /> |
|
| 196 | + <input type="password" name="dbuserpass" id="dbuserpass" value="<?php if (isset($globalDBpass)) { |
|
| 197 | + print $globalDBpass; |
|
| 198 | +} |
|
| 199 | +?>" /> |
|
| 177 | 200 | </p> |
| 178 | 201 | </fieldset> |
| 179 | 202 | <fieldset id="site"> |
| 180 | 203 | <legend>Site configuration</legend> |
| 181 | 204 | <p> |
| 182 | 205 | <label for="sitename">Site name</label> |
| 183 | - <input type="text" name="sitename" id="sitename" value="<?php if (isset($globalName)) print $globalName; ?>" /> |
|
| 206 | + <input type="text" name="sitename" id="sitename" value="<?php if (isset($globalName)) { |
|
| 207 | + print $globalName; |
|
| 208 | +} |
|
| 209 | +?>" /> |
|
| 184 | 210 | </p> |
| 185 | 211 | <p> |
| 186 | 212 | <label for="siteurl">Site directory</label> |
| 187 | - <input type="text" name="siteurl" id="siteurl" value="<?php if (isset($globalURL)) print $globalURL; ?>" /> |
|
| 213 | + <input type="text" name="siteurl" id="siteurl" value="<?php if (isset($globalURL)) { |
|
| 214 | + print $globalURL; |
|
| 215 | +} |
|
| 216 | +?>" /> |
|
| 188 | 217 | <p class="help-block">Can be null. ex : <i>flightairmap</i> if complete URL is <i>http://toto.com/flightairmap</i></p> |
| 189 | 218 | </p> |
| 190 | 219 | <p> |
| 191 | 220 | <label for="timezone">Timezone</label> |
| 192 | - <input type="text" name="timezone" id="timezone" value="<?php if (isset($globalTimezone)) print $globalTimezone; ?>" /> |
|
| 221 | + <input type="text" name="timezone" id="timezone" value="<?php if (isset($globalTimezone)) { |
|
| 222 | + print $globalTimezone; |
|
| 223 | +} |
|
| 224 | +?>" /> |
|
| 193 | 225 | <p class="help-block">ex : UTC, Europe/Paris,...</p> |
| 194 | 226 | </p> |
| 195 | 227 | <p> |
| 196 | 228 | <label for="language">Language</label> |
| 197 | - <input type="text" name="language" id="language" value="<?php if (isset($globalLanguage)) print $globalLanguage; ?>" /> |
|
| 229 | + <input type="text" name="language" id="language" value="<?php if (isset($globalLanguage)) { |
|
| 230 | + print $globalLanguage; |
|
| 231 | +} |
|
| 232 | +?>" /> |
|
| 198 | 233 | <p class="help-block">Used only when link to wikipedia for now. Can be EN,DE,FR,...</p> |
| 199 | 234 | </p> |
| 200 | 235 | </fieldset> |
@@ -215,11 +250,17 @@ discard block |
||
| 215 | 250 | <div id="mapbox_data"> |
| 216 | 251 | <p> |
| 217 | 252 | <label for="mapboxid">Mapbox id</label> |
| 218 | - <input type="text" name="mapboxid" id="mapboxid" value="<?php if (isset($globalMapboxId)) print $globalMapboxId; ?>" /> |
|
| 253 | + <input type="text" name="mapboxid" id="mapboxid" value="<?php if (isset($globalMapboxId)) { |
|
| 254 | + print $globalMapboxId; |
|
| 255 | +} |
|
| 256 | +?>" /> |
|
| 219 | 257 | </p> |
| 220 | 258 | <p> |
| 221 | 259 | <label for="mapboxtoken">Mapbox token</label> |
| 222 | - <input type="text" name="mapboxtoken" id="mapboxtoken" value="<?php if (isset($globalMapboxToken)) print $globalMapboxToken; ?>" /> |
|
| 260 | + <input type="text" name="mapboxtoken" id="mapboxtoken" value="<?php if (isset($globalMapboxToken)) { |
|
| 261 | + print $globalMapboxToken; |
|
| 262 | +} |
|
| 263 | +?>" /> |
|
| 223 | 264 | </p> |
| 224 | 265 | <p class="help-block">Get a key <a href="https://www.mapbox.com/developers/">here</a></p> |
| 225 | 266 | </div> |
@@ -227,7 +268,10 @@ discard block |
||
| 227 | 268 | <div id="google_data"> |
| 228 | 269 | <p> |
| 229 | 270 | <label for="googlekey">Google API key</label> |
| 230 | - <input type="text" name="googlekey" id="googlekey" value="<?php if (isset($globalGoogleAPIKey)) print $globalGoogleAPIKey; ?>" /> |
|
| 271 | + <input type="text" name="googlekey" id="googlekey" value="<?php if (isset($globalGoogleAPIKey)) { |
|
| 272 | + print $globalGoogleAPIKey; |
|
| 273 | +} |
|
| 274 | +?>" /> |
|
| 231 | 275 | <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> |
| 232 | 276 | </p> |
| 233 | 277 | </div> |
@@ -235,7 +279,10 @@ discard block |
||
| 235 | 279 | <div id="bing_data"> |
| 236 | 280 | <p> |
| 237 | 281 | <label for="bingkey">Bing Map key</label> |
| 238 | - <input type="text" name="bingkey" id="bingkey" value="<?php if (isset($globalBingMapKey)) print $globalBingMapKey; ?>" /> |
|
| 282 | + <input type="text" name="bingkey" id="bingkey" value="<?php if (isset($globalBingMapKey)) { |
|
| 283 | + print $globalBingMapKey; |
|
| 284 | +} |
|
| 285 | +?>" /> |
|
| 239 | 286 | <p class="help-block">Get a key <a href="https://www.bingmapsportal.com/">here</a></p> |
| 240 | 287 | </p> |
| 241 | 288 | </div> |
@@ -243,7 +290,10 @@ discard block |
||
| 243 | 290 | <div id="mapquest_data"> |
| 244 | 291 | <p> |
| 245 | 292 | <label for="mapquestkey">MapQuest key</label> |
| 246 | - <input type="text" name="mapquestkey" id="mapquestkey" value="<?php if (isset($globalMapQuestKey)) print $globalMapQuestKey; ?>" /> |
|
| 293 | + <input type="text" name="mapquestkey" id="mapquestkey" value="<?php if (isset($globalMapQuestKey)) { |
|
| 294 | + print $globalMapQuestKey; |
|
| 295 | +} |
|
| 296 | +?>" /> |
|
| 247 | 297 | <p class="help-block">Get a key <a href="https://developer.mapquest.com/user/me/apps">here</a></p> |
| 248 | 298 | </p> |
| 249 | 299 | </div> |
@@ -251,11 +301,17 @@ discard block |
||
| 251 | 301 | <div id="here_data"> |
| 252 | 302 | <p> |
| 253 | 303 | <label for="hereappid">Here App_Id</label> |
| 254 | - <input type="text" name="hereappid" id="hereappid" value="<?php if (isset($globalHereappId)) print $globalHereappId; ?>" /> |
|
| 304 | + <input type="text" name="hereappid" id="hereappid" value="<?php if (isset($globalHereappId)) { |
|
| 305 | + print $globalHereappId; |
|
| 306 | +} |
|
| 307 | +?>" /> |
|
| 255 | 308 | </p> |
| 256 | 309 | <p> |
| 257 | 310 | <label for="hereappcode">Here App_Code</label> |
| 258 | - <input type="text" name="hereappcode" id="hereappcode" value="<?php if (isset($globalHereappCode)) print $globalHereappCode; ?>" /> |
|
| 311 | + <input type="text" name="hereappcode" id="hereappcode" value="<?php if (isset($globalHereappCode)) { |
|
| 312 | + print $globalHereappCode; |
|
| 313 | +} |
|
| 314 | +?>" /> |
|
| 259 | 315 | </p> |
| 260 | 316 | <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> |
| 261 | 317 | </div> |
@@ -263,7 +319,10 @@ discard block |
||
| 263 | 319 | <div id="openweathermap_data"> |
| 264 | 320 | <p> |
| 265 | 321 | <label for="openweathermapkey">OpenWeatherMap key (weather layer)</label> |
| 266 | - <input type="text" name="openweathermapkey" id="openweathermapkey" value="<?php if (isset($globalOpenWeatherMapKey)) print $globalOpenWeatherMapKey; ?>" /> |
|
| 322 | + <input type="text" name="openweathermapkey" id="openweathermapkey" value="<?php if (isset($globalOpenWeatherMapKey)) { |
|
| 323 | + print $globalOpenWeatherMapKey; |
|
| 324 | +} |
|
| 325 | +?>" /> |
|
| 267 | 326 | <p class="help-block">Get a key <a href="https://openweathermap.org/">here</a></p> |
| 268 | 327 | </p> |
| 269 | 328 | </div> |
@@ -273,42 +332,86 @@ discard block |
||
| 273 | 332 | <legend>Coverage area</legend> |
| 274 | 333 | <p> |
| 275 | 334 | <label for="latitudemax">The maximum latitude (north)</label> |
| 276 | - <input type="text" name="latitudemax" id="latitudemax" value="<?php if (isset($globalLatitudeMax)) print $globalLatitudeMax; ?>" /> |
|
| 335 | + <input type="text" name="latitudemax" id="latitudemax" value="<?php if (isset($globalLatitudeMax)) { |
|
| 336 | + print $globalLatitudeMax; |
|
| 337 | +} |
|
| 338 | +?>" /> |
|
| 277 | 339 | </p> |
| 278 | 340 | <p> |
| 279 | 341 | <label for="latitudemin">The minimum latitude (south)</label> |
| 280 | - <input type="text" name="latitudemin" id="latitudemin" value="<?php if (isset($globalLatitudeMin)) print $globalLatitudeMin; ?>" /> |
|
| 342 | + <input type="text" name="latitudemin" id="latitudemin" value="<?php if (isset($globalLatitudeMin)) { |
|
| 343 | + print $globalLatitudeMin; |
|
| 344 | +} |
|
| 345 | +?>" /> |
|
| 281 | 346 | </p> |
| 282 | 347 | <p> |
| 283 | 348 | <label for="longitudemax">The maximum longitude (west)</label> |
| 284 | - <input type="text" name="longitudemax" id="longitudemax" value="<?php if (isset($globalLongitudeMax)) print $globalLongitudeMax; ?>" /> |
|
| 349 | + <input type="text" name="longitudemax" id="longitudemax" value="<?php if (isset($globalLongitudeMax)) { |
|
| 350 | + print $globalLongitudeMax; |
|
| 351 | +} |
|
| 352 | +?>" /> |
|
| 285 | 353 | </p> |
| 286 | 354 | <p> |
| 287 | 355 | <label for="longitudemin">The minimum longitude (east)</label> |
| 288 | - <input type="text" name="longitudemin" id="longitudemin" value="<?php if (isset($globalLongitudeMin)) print $globalLongitudeMin; ?>" /> |
|
| 356 | + <input type="text" name="longitudemin" id="longitudemin" value="<?php if (isset($globalLongitudeMin)) { |
|
| 357 | + print $globalLongitudeMin; |
|
| 358 | +} |
|
| 359 | +?>" /> |
|
| 289 | 360 | </p> |
| 290 | 361 | <p> |
| 291 | 362 | <label for="latitudecenter">The latitude center</label> |
| 292 | - <input type="text" name="latitudecenter" id="latitudecenter" value="<?php if (isset($globalCenterLatitude)) print $globalCenterLatitude; ?>" /> |
|
| 363 | + <input type="text" name="latitudecenter" id="latitudecenter" value="<?php if (isset($globalCenterLatitude)) { |
|
| 364 | + print $globalCenterLatitude; |
|
| 365 | +} |
|
| 366 | +?>" /> |
|
| 293 | 367 | </p> |
| 294 | 368 | <p> |
| 295 | 369 | <label for="longitudecenter">The longitude center</label> |
| 296 | - <input type="text" name="longitudecenter" id="longitudecenter" value="<?php if (isset($globalCenterLongitude)) print $globalCenterLongitude; ?>" /> |
|
| 370 | + <input type="text" name="longitudecenter" id="longitudecenter" value="<?php if (isset($globalCenterLongitude)) { |
|
| 371 | + print $globalCenterLongitude; |
|
| 372 | +} |
|
| 373 | +?>" /> |
|
| 297 | 374 | </p> |
| 298 | 375 | <p> |
| 299 | 376 | <label for="livezoom">Default Zoom on live map</label> |
| 300 | - <input type="number" name="livezoom" id="livezoom" value="<?php if (isset($globalLiveZoom)) print $globalLiveZoom; else print '9'; ?>" /> |
|
| 377 | + <input type="number" name="livezoom" id="livezoom" value="<?php if (isset($globalLiveZoom)) { |
|
| 378 | + print $globalLiveZoom; |
|
| 379 | +} else { |
|
| 380 | + print '9'; |
|
| 381 | +} |
|
| 382 | +?>" /> |
|
| 301 | 383 | </p> |
| 302 | 384 | <p> |
| 303 | 385 | <label for="squawk_country">Country for squawk usage</label> |
| 304 | 386 | <select name="squawk_country" id="squawk_country"> |
| 305 | - <option value="UK"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'UK') print ' selected '; ?>>UK</option> |
|
| 306 | - <option value="NZ"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'NZ') print ' selected '; ?>>NZ</option> |
|
| 307 | - <option value="US"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'US') print ' selected '; ?>>US</option> |
|
| 308 | - <option value="AU"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'AU') print ' selected '; ?>>AU</option> |
|
| 309 | - <option value="NL"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'NL') print ' selected '; ?>>NL</option> |
|
| 310 | - <option value="FR"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'FR') print ' selected '; ?>>FR</option> |
|
| 311 | - <option value="TR"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'TR') print ' selected '; ?>>TR</option> |
|
| 387 | + <option value="UK"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'UK') { |
|
| 388 | + print ' selected '; |
|
| 389 | +} |
|
| 390 | +?>>UK</option> |
|
| 391 | + <option value="NZ"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'NZ') { |
|
| 392 | + print ' selected '; |
|
| 393 | +} |
|
| 394 | +?>>NZ</option> |
|
| 395 | + <option value="US"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'US') { |
|
| 396 | + print ' selected '; |
|
| 397 | +} |
|
| 398 | +?>>US</option> |
|
| 399 | + <option value="AU"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'AU') { |
|
| 400 | + print ' selected '; |
|
| 401 | +} |
|
| 402 | +?>>AU</option> |
|
| 403 | + <option value="NL"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'NL') { |
|
| 404 | + print ' selected '; |
|
| 405 | +} |
|
| 406 | +?>>NL</option> |
|
| 407 | + <option value="FR"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'FR') { |
|
| 408 | + print ' selected '; |
|
| 409 | +} |
|
| 410 | +?>>FR</option> |
|
| 411 | + <option value="TR"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'TR') { |
|
| 412 | + print ' selected '; |
|
| 413 | +} |
|
| 414 | +?>>TR</option> |
|
| 312 | 415 | </select> |
| 313 | 416 | </p> |
| 314 | 417 | </fieldset> |
@@ -317,15 +420,24 @@ discard block |
||
| 317 | 420 | <p><i>Only put in DB flights that are inside a circle</i></p> |
| 318 | 421 | <p> |
| 319 | 422 | <label for="latitude">Center latitude</label> |
| 320 | - <input type="text" name="zoilatitude" id="latitude" value="<?php if (isset($globalDistanceIgnore['latitude'])) echo $globalDistanceIgnore['latitude']; ?>" /> |
|
| 423 | + <input type="text" name="zoilatitude" id="latitude" value="<?php if (isset($globalDistanceIgnore['latitude'])) { |
|
| 424 | + echo $globalDistanceIgnore['latitude']; |
|
| 425 | +} |
|
| 426 | +?>" /> |
|
| 321 | 427 | </p> |
| 322 | 428 | <p> |
| 323 | 429 | <label for="longitude">Center longitude</label> |
| 324 | - <input type="text" name="zoilongitude" id="longitude" value="<?php if (isset($globalDistanceIgnore['longitude'])) echo $globalDistanceIgnore['longitude']; ?>" /> |
|
| 430 | + <input type="text" name="zoilongitude" id="longitude" value="<?php if (isset($globalDistanceIgnore['longitude'])) { |
|
| 431 | + echo $globalDistanceIgnore['longitude']; |
|
| 432 | +} |
|
| 433 | +?>" /> |
|
| 325 | 434 | </p> |
| 326 | 435 | <p> |
| 327 | 436 | <label for="Distance">Distance (in km)</label> |
| 328 | - <input type="text" name="zoidistance" id="distance" value="<?php if (isset($globalDistanceIgnore['distance'])) echo $globalDistanceIgnore['distance']; ?>" /> |
|
| 437 | + <input type="text" name="zoidistance" id="distance" value="<?php if (isset($globalDistanceIgnore['distance'])) { |
|
| 438 | + echo $globalDistanceIgnore['distance']; |
|
| 439 | +} |
|
| 440 | +?>" /> |
|
| 329 | 441 | </p> |
| 330 | 442 | </fieldset> |
| 331 | 443 | <fieldset id="sourceloc"> |
@@ -438,11 +550,17 @@ discard block |
||
| 438 | 550 | <div id="flightaware_data"> |
| 439 | 551 | <p> |
| 440 | 552 | <label for="flightawareusername">FlightAware username</label> |
| 441 | - <input type="text" name="flightawareusername" id="flightawareusername" value="<?php if (isset($globalFlightAwareUsername)) print $globalFlightAwareUsername; ?>" /> |
|
| 553 | + <input type="text" name="flightawareusername" id="flightawareusername" value="<?php if (isset($globalFlightAwareUsername)) { |
|
| 554 | + print $globalFlightAwareUsername; |
|
| 555 | +} |
|
| 556 | +?>" /> |
|
| 442 | 557 | </p> |
| 443 | 558 | <p> |
| 444 | 559 | <label for="flightawarepassword">FlightAware password/API key</label> |
| 445 | - <input type="text" name="flightawarepassword" id="flightawarepassword" value="<?php if (isset($globalFlightAwarePassword)) print $globalFlightAwarePassword; ?>" /> |
|
| 560 | + <input type="text" name="flightawarepassword" id="flightawarepassword" value="<?php if (isset($globalFlightAwarePassword)) { |
|
| 561 | + print $globalFlightAwarePassword; |
|
| 562 | +} |
|
| 563 | +?>" /> |
|
| 446 | 564 | </p> |
| 447 | 565 | </div> |
| 448 | 566 | --> |
@@ -484,7 +602,10 @@ discard block |
||
| 484 | 602 | if (filter_var($source['host'],FILTER_VALIDATE_URL)) { |
| 485 | 603 | ?> |
| 486 | 604 | <td><input type="text" name="host[]" id="host" value="<?php print $source['host']; ?>" /></td> |
| 487 | - <td><input type="text" name="port[]" class="col-xs-2" id="port" value="<?php if (isset($source['port'])) print $source['port']; ?>" /></td> |
|
| 605 | + <td><input type="text" name="port[]" class="col-xs-2" id="port" value="<?php if (isset($source['port'])) { |
|
| 606 | + print $source['port']; |
|
| 607 | +} |
|
| 608 | +?>" /></td> |
|
| 488 | 609 | <?php |
| 489 | 610 | } else { |
| 490 | 611 | $hostport = explode(':',$source['host']); |
@@ -503,34 +624,106 @@ discard block |
||
| 503 | 624 | ?> |
| 504 | 625 | <td> |
| 505 | 626 | <select name="format[]" id="format"> |
| 506 | - <option value="auto" <?php if (!isset($source['format'])) print 'selected'; ?>>Auto</option> |
|
| 507 | - <option value="sbs" <?php if (isset($source['format']) && $source['format'] == 'sbs') print 'selected'; ?>>SBS</option> |
|
| 508 | - <option value="tsv" <?php if (isset($source['format']) && $source['format'] == 'tsv') print 'selected'; ?>>TSV</option> |
|
| 509 | - <option value="raw" <?php if (isset($source['format']) && $source['format'] == 'raw') print 'selected'; ?>>Raw</option> |
|
| 510 | - <option value="aprs" <?php if (isset($source['format']) && $source['format'] == 'aprs') print 'selected'; ?>>APRS</option> |
|
| 511 | - <option value="deltadbtxt" <?php if (isset($source['format']) && $source['format'] == 'deltadbtxt') print 'selected'; ?>>Radarcape deltadb.txt</option> |
|
| 512 | - <option value="vatsimtxt" <?php if (isset($source['format']) && $source['format'] == 'vatsimtxt') print 'selected'; ?>>Vatsim</option> |
|
| 513 | - <option value="aircraftlistjson" <?php if (isset($source['format']) && $source['format'] == 'aircraftlistjson') print 'selected'; ?>>Virtual Radar Server AircraftList.json</option> |
|
| 514 | - <option value="vrstcp" <?php if (isset($source['format']) && $source['format'] == 'vrstcp') print 'selected'; ?>>Virtual Radar Server TCP</option> |
|
| 515 | - <option value="phpvmacars" <?php if (isset($source['format']) && $source['format'] == 'phpvmacars') print 'selected'; ?>>phpVMS</option> |
|
| 516 | - <option value="vaos" <?php if (isset($source['format']) && $source['format'] == 'phpvmacars') print 'selected'; ?>>Virtual Airline Operations System (VAOS)</option> |
|
| 517 | - <option value="vam" <?php if (isset($source['format']) && $source['format'] == 'vam') print 'selected'; ?>>Virtual Airlines Manager</option> |
|
| 518 | - <option value="whazzup" <?php if (isset($source['format']) && $source['format'] == 'whazzup') print 'selected'; ?>>IVAO</option> |
|
| 519 | - <option value="flightgearmp" <?php if (isset($source['format']) && $source['format'] == 'flightgearmp') print 'selected'; ?>>FlightGear Multiplayer</option> |
|
| 520 | - <option value="flightgearsp" <?php if (isset($source['format']) && $source['format'] == 'flightgearsp') print 'selected'; ?>>FlightGear Singleplayer</option> |
|
| 521 | - <option value="acars" <?php if (isset($source['format']) && $source['format'] == 'acars') print 'selected'; ?>>ACARS from acarsdec/acarsdeco2 over UDP</option> |
|
| 522 | - <option value="acarssbs3" <?php if (isset($source['format']) && $source['format'] == 'acarssbs3') print 'selected'; ?>>ACARS SBS-3 over TCP</option> |
|
| 523 | - <option value="ais" <?php if (isset($source['format']) && $source['format'] == 'ais') print 'selected'; ?>>NMEA AIS over TCP</option> |
|
| 524 | - <option value="airwhere" <?php if (isset($source['format']) && $source['format'] == 'airwhere') print 'selected'; ?>>AirWhere website</option> |
|
| 525 | - <option value="hidnseek_callback" <?php if (isset($source['format']) && $source['format'] == 'hidnseek_callback') print 'selected'; ?>>HidnSeek Callback</option> |
|
| 526 | - <option value="blitzortung" <?php if (isset($source['format']) && $source['format'] == 'blitzortung') print 'selected'; ?>>Blitzortung</option> |
|
| 627 | + <option value="auto" <?php if (!isset($source['format'])) { |
|
| 628 | + print 'selected'; |
|
| 629 | +} |
|
| 630 | +?>>Auto</option> |
|
| 631 | + <option value="sbs" <?php if (isset($source['format']) && $source['format'] == 'sbs') { |
|
| 632 | + print 'selected'; |
|
| 633 | +} |
|
| 634 | +?>>SBS</option> |
|
| 635 | + <option value="tsv" <?php if (isset($source['format']) && $source['format'] == 'tsv') { |
|
| 636 | + print 'selected'; |
|
| 637 | +} |
|
| 638 | +?>>TSV</option> |
|
| 639 | + <option value="raw" <?php if (isset($source['format']) && $source['format'] == 'raw') { |
|
| 640 | + print 'selected'; |
|
| 641 | +} |
|
| 642 | +?>>Raw</option> |
|
| 643 | + <option value="aprs" <?php if (isset($source['format']) && $source['format'] == 'aprs') { |
|
| 644 | + print 'selected'; |
|
| 645 | +} |
|
| 646 | +?>>APRS</option> |
|
| 647 | + <option value="deltadbtxt" <?php if (isset($source['format']) && $source['format'] == 'deltadbtxt') { |
|
| 648 | + print 'selected'; |
|
| 649 | +} |
|
| 650 | +?>>Radarcape deltadb.txt</option> |
|
| 651 | + <option value="vatsimtxt" <?php if (isset($source['format']) && $source['format'] == 'vatsimtxt') { |
|
| 652 | + print 'selected'; |
|
| 653 | +} |
|
| 654 | +?>>Vatsim</option> |
|
| 655 | + <option value="aircraftlistjson" <?php if (isset($source['format']) && $source['format'] == 'aircraftlistjson') { |
|
| 656 | + print 'selected'; |
|
| 657 | +} |
|
| 658 | +?>>Virtual Radar Server AircraftList.json</option> |
|
| 659 | + <option value="vrstcp" <?php if (isset($source['format']) && $source['format'] == 'vrstcp') { |
|
| 660 | + print 'selected'; |
|
| 661 | +} |
|
| 662 | +?>>Virtual Radar Server TCP</option> |
|
| 663 | + <option value="phpvmacars" <?php if (isset($source['format']) && $source['format'] == 'phpvmacars') { |
|
| 664 | + print 'selected'; |
|
| 665 | +} |
|
| 666 | +?>>phpVMS</option> |
|
| 667 | + <option value="vaos" <?php if (isset($source['format']) && $source['format'] == 'phpvmacars') { |
|
| 668 | + print 'selected'; |
|
| 669 | +} |
|
| 670 | +?>>Virtual Airline Operations System (VAOS)</option> |
|
| 671 | + <option value="vam" <?php if (isset($source['format']) && $source['format'] == 'vam') { |
|
| 672 | + print 'selected'; |
|
| 673 | +} |
|
| 674 | +?>>Virtual Airlines Manager</option> |
|
| 675 | + <option value="whazzup" <?php if (isset($source['format']) && $source['format'] == 'whazzup') { |
|
| 676 | + print 'selected'; |
|
| 677 | +} |
|
| 678 | +?>>IVAO</option> |
|
| 679 | + <option value="flightgearmp" <?php if (isset($source['format']) && $source['format'] == 'flightgearmp') { |
|
| 680 | + print 'selected'; |
|
| 681 | +} |
|
| 682 | +?>>FlightGear Multiplayer</option> |
|
| 683 | + <option value="flightgearsp" <?php if (isset($source['format']) && $source['format'] == 'flightgearsp') { |
|
| 684 | + print 'selected'; |
|
| 685 | +} |
|
| 686 | +?>>FlightGear Singleplayer</option> |
|
| 687 | + <option value="acars" <?php if (isset($source['format']) && $source['format'] == 'acars') { |
|
| 688 | + print 'selected'; |
|
| 689 | +} |
|
| 690 | +?>>ACARS from acarsdec/acarsdeco2 over UDP</option> |
|
| 691 | + <option value="acarssbs3" <?php if (isset($source['format']) && $source['format'] == 'acarssbs3') { |
|
| 692 | + print 'selected'; |
|
| 693 | +} |
|
| 694 | +?>>ACARS SBS-3 over TCP</option> |
|
| 695 | + <option value="ais" <?php if (isset($source['format']) && $source['format'] == 'ais') { |
|
| 696 | + print 'selected'; |
|
| 697 | +} |
|
| 698 | +?>>NMEA AIS over TCP</option> |
|
| 699 | + <option value="airwhere" <?php if (isset($source['format']) && $source['format'] == 'airwhere') { |
|
| 700 | + print 'selected'; |
|
| 701 | +} |
|
| 702 | +?>>AirWhere website</option> |
|
| 703 | + <option value="hidnseek_callback" <?php if (isset($source['format']) && $source['format'] == 'hidnseek_callback') { |
|
| 704 | + print 'selected'; |
|
| 705 | +} |
|
| 706 | +?>>HidnSeek Callback</option> |
|
| 707 | + <option value="blitzortung" <?php if (isset($source['format']) && $source['format'] == 'blitzortung') { |
|
| 708 | + print 'selected'; |
|
| 709 | +} |
|
| 710 | +?>>Blitzortung</option> |
|
| 527 | 711 | </select> |
| 528 | 712 | </td> |
| 529 | 713 | <td> |
| 530 | - <input type="text" name="name[]" id="name" value="<?php if (isset($source['name'])) print $source['name']; ?>" /> |
|
| 714 | + <input type="text" name="name[]" id="name" value="<?php if (isset($source['name'])) { |
|
| 715 | + print $source['name']; |
|
| 716 | +} |
|
| 717 | +?>" /> |
|
| 531 | 718 | </td> |
| 532 | - <td><input type="checkbox" name="sourcestats[]" id="sourcestats" title="Create statistics for the source like number of messages, distance,..." value="1" <?php if (isset($source['sourcestats']) && $source['sourcestats']) print 'checked'; ?> /></td> |
|
| 533 | - <td><input type="checkbox" name="noarchive[]" id="noarchive" title="Don't archive this source" value="1" <?php if (isset($source['noarchive']) && $source['noarchive']) print 'checked'; ?> /></td> |
|
| 719 | + <td><input type="checkbox" name="sourcestats[]" id="sourcestats" title="Create statistics for the source like number of messages, distance,..." value="1" <?php if (isset($source['sourcestats']) && $source['sourcestats']) { |
|
| 720 | + print 'checked'; |
|
| 721 | +} |
|
| 722 | +?> /></td> |
|
| 723 | + <td><input type="checkbox" name="noarchive[]" id="noarchive" title="Don't archive this source" value="1" <?php if (isset($source['noarchive']) && $source['noarchive']) { |
|
| 724 | + print 'checked'; |
|
| 725 | +} |
|
| 726 | +?> /></td> |
|
| 534 | 727 | <td> |
| 535 | 728 | <select name="timezones[]" id="timezones"> |
| 536 | 729 | <?php |
@@ -540,7 +733,9 @@ discard block |
||
| 540 | 733 | print '<option selected>'.$timezones.'</option>'; |
| 541 | 734 | } elseif (!isset($source['timezone']) && $timezones == 'UTC') { |
| 542 | 735 | print '<option selected>'.$timezones.'</option>'; |
| 543 | - } else print '<option>'.$timezones.'</option>'; |
|
| 736 | + } else { |
|
| 737 | + print '<option>'.$timezones.'</option>'; |
|
| 738 | + } |
|
| 544 | 739 | } |
| 545 | 740 | ?> |
| 546 | 741 | </select> |
@@ -591,7 +786,9 @@ discard block |
||
| 591 | 786 | foreach($timezonelist as $timezones){ |
| 592 | 787 | if ($timezones == 'UTC') { |
| 593 | 788 | print '<option selected>'.$timezones.'</option>'; |
| 594 | - } else print '<option>'.$timezones.'</option>'; |
|
| 789 | + } else { |
|
| 790 | + print '<option>'.$timezones.'</option>'; |
|
| 791 | + } |
|
| 595 | 792 | } |
| 596 | 793 | ?> |
| 597 | 794 | </select> |
@@ -614,11 +811,17 @@ discard block |
||
| 614 | 811 | <p>Listen UDP server for acarsdec/acarsdeco2/... with <i>daemon-acars.php</i> script</p> |
| 615 | 812 | <p> |
| 616 | 813 | <label for="acarshost">ACARS UDP host</label> |
| 617 | - <input type="text" name="acarshost" id="acarshost" value="<?php if (isset($globalACARSHost)) print $globalACARSHost; ?>" /> |
|
| 814 | + <input type="text" name="acarshost" id="acarshost" value="<?php if (isset($globalACARSHost)) { |
|
| 815 | + print $globalACARSHost; |
|
| 816 | +} |
|
| 817 | +?>" /> |
|
| 618 | 818 | </p> |
| 619 | 819 | <p> |
| 620 | 820 | <label for="acarsport">ACARS UDP port</label> |
| 621 | - <input type="number" name="acarsport" id="acarsport" value="<?php if (isset($globalACARSPort)) print $globalACARSPort; ?>" /> |
|
| 821 | + <input type="number" name="acarsport" id="acarsport" value="<?php if (isset($globalACARSPort)) { |
|
| 822 | + print $globalACARSPort; |
|
| 823 | +} |
|
| 824 | +?>" /> |
|
| 622 | 825 | </p> |
| 623 | 826 | </fieldset> |
| 624 | 827 | </div> |
@@ -721,13 +924,19 @@ discard block |
||
| 721 | 924 | <div id="schedules_options"> |
| 722 | 925 | <p> |
| 723 | 926 | <label for="britishairways">British Airways API Key</label> |
| 724 | - <input type="text" name="britishairways" id="britishairways" value="<?php if (isset($globalBritishAirwaysKey)) print $globalBritishAirwaysKey; ?>" /> |
|
| 927 | + <input type="text" name="britishairways" id="britishairways" value="<?php if (isset($globalBritishAirwaysKey)) { |
|
| 928 | + print $globalBritishAirwaysKey; |
|
| 929 | +} |
|
| 930 | +?>" /> |
|
| 725 | 931 | <p class="help-block">Register an account on <a href="https://developer.ba.com/">https://developer.ba.com/</a></p> |
| 726 | 932 | </p> |
| 727 | 933 | <!-- |
| 728 | 934 | <p> |
| 729 | 935 | <label for="transavia">Transavia Test API Consumer Key</label> |
| 730 | - <input type="text" name="transavia" id="transavia" value="<?php if (isset($globalTransaviaKey)) print $globalTransaviaKey; ?>" /> |
|
| 936 | + <input type="text" name="transavia" id="transavia" value="<?php if (isset($globalTransaviaKey)) { |
|
| 937 | + print $globalTransaviaKey; |
|
| 938 | +} |
|
| 939 | +?>" /> |
|
| 731 | 940 | <p class="help-block">Register an account on <a href="https://developer.transavia.com">https://developer.transavia.com</a></p> |
| 732 | 941 | </p> |
| 733 | 942 | --> |
@@ -736,10 +945,16 @@ discard block |
||
| 736 | 945 | <b>Lufthansa API Key</b> |
| 737 | 946 | <p> |
| 738 | 947 | <label for="lufthansakey">Key</label> |
| 739 | - <input type="text" name="lufthansakey" id="lufthansakey" value="<?php if (isset($globalLufthansaKey['key'])) print $globalLufthansaKey['key']; ?>" /> |
|
| 948 | + <input type="text" name="lufthansakey" id="lufthansakey" value="<?php if (isset($globalLufthansaKey['key'])) { |
|
| 949 | + print $globalLufthansaKey['key']; |
|
| 950 | +} |
|
| 951 | +?>" /> |
|
| 740 | 952 | </p><p> |
| 741 | 953 | <label for="lufthansasecret">Secret</label> |
| 742 | - <input type="text" name="lufthansasecret" id="lufthansasecret" value="<?php if (isset($globalLufthansaKey['secret'])) print $globalLufthansaKey['secret']; ?>" /> |
|
| 954 | + <input type="text" name="lufthansasecret" id="lufthansasecret" value="<?php if (isset($globalLufthansaKey['secret'])) { |
|
| 955 | + print $globalLufthansaKey['secret']; |
|
| 956 | +} |
|
| 957 | +?>" /> |
|
| 743 | 958 | </p> |
| 744 | 959 | </div> |
| 745 | 960 | <p class="help-block">Register an account on <a href="https://developer.lufthansa.com/page">https://developer.lufthansa.com/page</a></p> |
@@ -759,7 +974,10 @@ discard block |
||
| 759 | 974 | </p> |
| 760 | 975 | <p> |
| 761 | 976 | <label for="notamsource">URL of your feed from notaminfo.com</label> |
| 762 | - <input type="text" name="notamsource" id="notamsource" value="<?php if (isset($globalNOTAMSource)) print $globalNOTAMSource; ?>" /> |
|
| 977 | + <input type="text" name="notamsource" id="notamsource" value="<?php if (isset($globalNOTAMSource)) { |
|
| 978 | + print $globalNOTAMSource; |
|
| 979 | +} |
|
| 980 | +?>" /> |
|
| 763 | 981 | <p class="help-block">If you want to use world NOTAM from FlightAirMap website, leave it blank</p> |
| 764 | 982 | </p> |
| 765 | 983 | <br /> |
@@ -775,14 +993,20 @@ discard block |
||
| 775 | 993 | <div id="metarsrc"> |
| 776 | 994 | <p> |
| 777 | 995 | <label for="metarsource">URL of your METAR source</label> |
| 778 | - <input type="text" name="metarsource" id="metarsource" value="<?php if (isset($globalMETARurl)) print $globalMETARurl; ?>" /> |
|
| 996 | + <input type="text" name="metarsource" id="metarsource" value="<?php if (isset($globalMETARurl)) { |
|
| 997 | + print $globalMETARurl; |
|
| 998 | +} |
|
| 999 | +?>" /> |
|
| 779 | 1000 | <p class="help-block">Use {icao} to specify where we replace by airport icao. ex : http://metar.vatsim.net/metar.php?id={icao}</p> |
| 780 | 1001 | </p> |
| 781 | 1002 | </div> |
| 782 | 1003 | <br /> |
| 783 | 1004 | <p> |
| 784 | 1005 | <label for="bitly">Bit.ly access token api (used in search page)</label> |
| 785 | - <input type="text" name="bitly" id="bitly" value="<?php if (isset($globalBitlyAccessToken)) print $globalBitlyAccessToken; ?>" /> |
|
| 1006 | + <input type="text" name="bitly" id="bitly" value="<?php if (isset($globalBitlyAccessToken)) { |
|
| 1007 | + print $globalBitlyAccessToken; |
|
| 1008 | +} |
|
| 1009 | +?>" /> |
|
| 786 | 1010 | </p> |
| 787 | 1011 | <br /> |
| 788 | 1012 | <p> |
@@ -798,11 +1022,26 @@ discard block |
||
| 798 | 1022 | <p> |
| 799 | 1023 | <label for="geoid_source">Geoid Source</label> |
| 800 | 1024 | <select name="geoid_source" id="geoid_source"> |
| 801 | - <option value="egm96-15"<?php if (isset($globalGeoidSource) && $globalGeoidSource == 'egm96-15') print ' selected="selected"'; ?>>EGM96 15' (2.1MB)</option> |
|
| 802 | - <option value="egm96-5"<?php if (isset($globalGeoidSource) && $globalGeoidSource == 'egm96-5') print ' selected="selected"'; ?>>EGM96 5' (19MB)</option> |
|
| 803 | - <option value="egm2008-5"<?php if (isset($globalGeoidSource) && $globalGeoidSource == 'egm2008-5') print ' selected="selected"'; ?>>EGM2008 5' (19MB)</option> |
|
| 804 | - <option value="egm2008-2_5"<?php if (isset($globalGeoidSource) && $globalGeoidSource == 'egm2008-2_5') print ' selected="selected"'; ?>>EGM2008 2.5' (75MB)</option> |
|
| 805 | - <option value="egm2008-1"<?php if (isset($globalGeoidSource) && $globalGeoidSource == 'egm2008-1') print ' selected="selected"'; ?>>EGM2008 1' (470MB)</option> |
|
| 1025 | + <option value="egm96-15"<?php if (isset($globalGeoidSource) && $globalGeoidSource == 'egm96-15') { |
|
| 1026 | + print ' selected="selected"'; |
|
| 1027 | +} |
|
| 1028 | +?>>EGM96 15' (2.1MB)</option> |
|
| 1029 | + <option value="egm96-5"<?php if (isset($globalGeoidSource) && $globalGeoidSource == 'egm96-5') { |
|
| 1030 | + print ' selected="selected"'; |
|
| 1031 | +} |
|
| 1032 | +?>>EGM96 5' (19MB)</option> |
|
| 1033 | + <option value="egm2008-5"<?php if (isset($globalGeoidSource) && $globalGeoidSource == 'egm2008-5') { |
|
| 1034 | + print ' selected="selected"'; |
|
| 1035 | +} |
|
| 1036 | +?>>EGM2008 5' (19MB)</option> |
|
| 1037 | + <option value="egm2008-2_5"<?php if (isset($globalGeoidSource) && $globalGeoidSource == 'egm2008-2_5') { |
|
| 1038 | + print ' selected="selected"'; |
|
| 1039 | +} |
|
| 1040 | +?>>EGM2008 2.5' (75MB)</option> |
|
| 1041 | + <option value="egm2008-1"<?php if (isset($globalGeoidSource) && $globalGeoidSource == 'egm2008-1') { |
|
| 1042 | + print ' selected="selected"'; |
|
| 1043 | +} |
|
| 1044 | +?>>EGM2008 1' (470MB)</option> |
|
| 806 | 1045 | </select> |
| 807 | 1046 | <p class="help-block">The geoid is approximated by an "earth gravity model" (EGM).</p> |
| 808 | 1047 | </p> |
@@ -824,7 +1063,12 @@ discard block |
||
| 824 | 1063 | </p> |
| 825 | 1064 | <p> |
| 826 | 1065 | <label for="archivemonths">Generate statistics, delete or put in archive flights older than xx months</label> |
| 827 | - <input type="number" name="archivemonths" id="archivemonths" value="<?php if (isset($globalArchiveMonths)) print $globalArchiveMonths; else echo '1'; ?>" /> |
|
| 1066 | + <input type="number" name="archivemonths" id="archivemonths" value="<?php if (isset($globalArchiveMonths)) { |
|
| 1067 | + print $globalArchiveMonths; |
|
| 1068 | +} else { |
|
| 1069 | + echo '1'; |
|
| 1070 | +} |
|
| 1071 | +?>" /> |
|
| 828 | 1072 | <p class="help-block">0 to disable, delete old flight if <i>Archive all flights data</i> is disabled</p> |
| 829 | 1073 | </p> |
| 830 | 1074 | <p> |
@@ -834,12 +1078,22 @@ discard block |
||
| 834 | 1078 | </p> |
| 835 | 1079 | <p> |
| 836 | 1080 | <label for="archivekeepmonths">Keep flights data for xx months in archive</label> |
| 837 | - <input type="number" name="archivekeepmonths" id="archivekeepmonths" value="<?php if (isset($globalArchiveKeepMonths)) print $globalArchiveKeepMonths; else echo '1'; ?>" /> |
|
| 1081 | + <input type="number" name="archivekeepmonths" id="archivekeepmonths" value="<?php if (isset($globalArchiveKeepMonths)) { |
|
| 1082 | + print $globalArchiveKeepMonths; |
|
| 1083 | +} else { |
|
| 1084 | + echo '1'; |
|
| 1085 | +} |
|
| 1086 | +?>" /> |
|
| 838 | 1087 | <p class="help-block">0 to disable</p> |
| 839 | 1088 | </p> |
| 840 | 1089 | <p> |
| 841 | 1090 | <label for="archivekeeptrackmonths">Keep flights track data for xx months in archive</label> |
| 842 | - <input type="number" name="archivekeeptrackmonths" id="archivekeeptrackmonths" value="<?php if (isset($globalArchiveKeepTrackMonths)) print $globalArchiveKeepTrackMonths; else echo '1'; ?>" /> |
|
| 1091 | + <input type="number" name="archivekeeptrackmonths" id="archivekeeptrackmonths" value="<?php if (isset($globalArchiveKeepTrackMonths)) { |
|
| 1092 | + print $globalArchiveKeepTrackMonths; |
|
| 1093 | +} else { |
|
| 1094 | + echo '1'; |
|
| 1095 | +} |
|
| 1096 | +?>" /> |
|
| 843 | 1097 | <p class="help-block">0 to disable, should be less or egal to <i>Keep flights data</i> value</p> |
| 844 | 1098 | </p> |
| 845 | 1099 | <br /> |
@@ -849,7 +1103,12 @@ discard block |
||
| 849 | 1103 | <p class="help-block">Uncheck if the script is running as cron job</p> |
| 850 | 1104 | <div id="cronends"> |
| 851 | 1105 | <label for="cronend">Run script for xx seconds</label> |
| 852 | - <input type="number" name="cronend" id="cronend" value="<?php if (isset($globalCronEnd)) print $globalCronEnd; else print '0'; ?>" /> |
|
| 1106 | + <input type="number" name="cronend" id="cronend" value="<?php if (isset($globalCronEnd)) { |
|
| 1107 | + print $globalCronEnd; |
|
| 1108 | +} else { |
|
| 1109 | + print '0'; |
|
| 1110 | +} |
|
| 1111 | +?>" /> |
|
| 853 | 1112 | <p class="help-block">Set to 0 to disable. Should be disabled if source is URL.</p> |
| 854 | 1113 | </div> |
| 855 | 1114 | </p> |
@@ -902,15 +1161,30 @@ discard block |
||
| 902 | 1161 | <br /> |
| 903 | 1162 | <p> |
| 904 | 1163 | <label for="refresh">Show flights detected since xxx seconds</label> |
| 905 | - <input type="number" name="refresh" id="refresh" value="<?php if (isset($globalLiveInterval)) echo $globalLiveInterval; else echo '200'; ?>" /> |
|
| 1164 | + <input type="number" name="refresh" id="refresh" value="<?php if (isset($globalLiveInterval)) { |
|
| 1165 | + echo $globalLiveInterval; |
|
| 1166 | +} else { |
|
| 1167 | + echo '200'; |
|
| 1168 | +} |
|
| 1169 | +?>" /> |
|
| 906 | 1170 | </p> |
| 907 | 1171 | <p> |
| 908 | 1172 | <label for="maprefresh">Live map refresh (in seconds)</label> |
| 909 | - <input type="number" name="maprefresh" id="maprefresh" value="<?php if (isset($globalMapRefresh)) echo $globalMapRefresh; else echo '30'; ?>" /> |
|
| 1173 | + <input type="number" name="maprefresh" id="maprefresh" value="<?php if (isset($globalMapRefresh)) { |
|
| 1174 | + echo $globalMapRefresh; |
|
| 1175 | +} else { |
|
| 1176 | + echo '30'; |
|
| 1177 | +} |
|
| 1178 | +?>" /> |
|
| 910 | 1179 | </p> |
| 911 | 1180 | <p> |
| 912 | 1181 | <label for="mapidle">Map idle timeout (in minutes)</label> |
| 913 | - <input type="number" name="mapidle" id="mapidle" value="<?php if (isset($globalMapIdleTimeout)) echo $globalMapIdleTimeout; else echo '30'; ?>" /> |
|
| 1182 | + <input type="number" name="mapidle" id="mapidle" value="<?php if (isset($globalMapIdleTimeout)) { |
|
| 1183 | + echo $globalMapIdleTimeout; |
|
| 1184 | +} else { |
|
| 1185 | + echo '30'; |
|
| 1186 | +} |
|
| 1187 | +?>" /> |
|
| 914 | 1188 | <p class="help-block">0 to disable</p> |
| 915 | 1189 | </p> |
| 916 | 1190 | <p> |
@@ -925,12 +1199,20 @@ discard block |
||
| 925 | 1199 | <br /> |
| 926 | 1200 | <p> |
| 927 | 1201 | <label for="closestmindist">Distance to airport set as arrival (in km)</label> |
| 928 | - <input type="number" name="closestmindist" id="closestmindist" value="<?php if (isset($globalClosestMinDist)) echo $globalClosestMinDist; else echo '50'; ?>" /> |
|
| 1202 | + <input type="number" name="closestmindist" id="closestmindist" value="<?php if (isset($globalClosestMinDist)) { |
|
| 1203 | + echo $globalClosestMinDist; |
|
| 1204 | +} else { |
|
| 1205 | + echo '50'; |
|
| 1206 | +} |
|
| 1207 | +?>" /> |
|
| 929 | 1208 | </p> |
| 930 | 1209 | <br /> |
| 931 | 1210 | <p> |
| 932 | 1211 | <label for="aircraftsize">Size of aircraft icon on map (default to 30px if zoom > 7 else 15px), empty to default</label> |
| 933 | - <input type="number" name="aircraftsize" id="aircraftsize" value="<?php if (isset($globalAircraftSize)) echo $globalAircraftSize;?>" /> |
|
| 1212 | + <input type="number" name="aircraftsize" id="aircraftsize" value="<?php if (isset($globalAircraftSize)) { |
|
| 1213 | + echo $globalAircraftSize; |
|
| 1214 | +} |
|
| 1215 | +?>" /> |
|
| 934 | 1216 | </p> |
| 935 | 1217 | <br /> |
| 936 | 1218 | <p> |
@@ -943,7 +1225,12 @@ discard block |
||
| 943 | 1225 | if (extension_loaded('gd') && function_exists('gd_info')) { |
| 944 | 1226 | ?> |
| 945 | 1227 | <label for="aircrafticoncolor">Color of aircraft icon on map</label> |
| 946 | - <input type="color" name="aircrafticoncolor" id="aircrafticoncolor" value="#<?php if (isset($globalAircraftIconColor)) echo $globalAircraftIconColor; else echo '1a3151'; ?>" /> |
|
| 1228 | + <input type="color" name="aircrafticoncolor" id="aircrafticoncolor" value="#<?php if (isset($globalAircraftIconColor)) { |
|
| 1229 | + echo $globalAircraftIconColor; |
|
| 1230 | +} else { |
|
| 1231 | + echo '1a3151'; |
|
| 1232 | +} |
|
| 1233 | +?>" /> |
|
| 947 | 1234 | <?php |
| 948 | 1235 | if (!is_writable('../cache')) { |
| 949 | 1236 | ?> |
@@ -961,14 +1248,27 @@ discard block |
||
| 961 | 1248 | <p> |
| 962 | 1249 | <label for="airportzoom">Zoom level minimum to see airports icons</label> |
| 963 | 1250 | <div class="range"> |
| 964 | - <input type="range" name="airportzoom" id="airportzoom" value="<?php if (isset($globalAirportZoom)) echo $globalAirportZoom; else echo '7'; ?>" /> |
|
| 965 | - <output id="range"><?php if (isset($globalAirportZoom)) echo $globalAirportZoom; else echo '7'; ?></output> |
|
| 1251 | + <input type="range" name="airportzoom" id="airportzoom" value="<?php if (isset($globalAirportZoom)) { |
|
| 1252 | + echo $globalAirportZoom; |
|
| 1253 | +} else { |
|
| 1254 | + echo '7'; |
|
| 1255 | +} |
|
| 1256 | +?>" /> |
|
| 1257 | + <output id="range"><?php if (isset($globalAirportZoom)) { |
|
| 1258 | + echo $globalAirportZoom; |
|
| 1259 | +} else { |
|
| 1260 | + echo '7'; |
|
| 1261 | +} |
|
| 1262 | +?></output> |
|
| 966 | 1263 | </div> |
| 967 | 1264 | </p> |
| 968 | 1265 | <br /> |
| 969 | 1266 | <p> |
| 970 | 1267 | <label for="customcss">Custom CSS web path</label> |
| 971 | - <input type="text" name="customcss" id="customcss" value="<?php if (isset($globalCustomCSS)) echo $globalCustomCSS; ?>" /> |
|
| 1268 | + <input type="text" name="customcss" id="customcss" value="<?php if (isset($globalCustomCSS)) { |
|
| 1269 | + echo $globalCustomCSS; |
|
| 1270 | +} |
|
| 1271 | +?>" /> |
|
| 972 | 1272 | </p> |
| 973 | 1273 | </fieldset> |
| 974 | 1274 | <input type="submit" name="submit" value="Create/Update database & write setup" /> |
@@ -995,8 +1295,12 @@ discard block |
||
| 995 | 1295 | $dbhost = filter_input(INPUT_POST,'dbhost',FILTER_SANITIZE_STRING); |
| 996 | 1296 | $dbport = filter_input(INPUT_POST,'dbport',FILTER_SANITIZE_STRING); |
| 997 | 1297 | |
| 998 | - if ($dbtype == 'mysql' && !extension_loaded('pdo_mysql')) $error .= 'Mysql driver for PDO must be loaded'; |
|
| 999 | - if ($dbtype == 'pgsql' && !extension_loaded('pdo_pgsql')) $error .= 'PosgreSQL driver for PDO must be loaded'; |
|
| 1298 | + if ($dbtype == 'mysql' && !extension_loaded('pdo_mysql')) { |
|
| 1299 | + $error .= 'Mysql driver for PDO must be loaded'; |
|
| 1300 | + } |
|
| 1301 | + if ($dbtype == 'pgsql' && !extension_loaded('pdo_pgsql')) { |
|
| 1302 | + $error .= 'PosgreSQL driver for PDO must be loaded'; |
|
| 1303 | + } |
|
| 1000 | 1304 | |
| 1001 | 1305 | $_SESSION['database_root'] = $dbroot; |
| 1002 | 1306 | $_SESSION['database_rootpass'] = $dbrootpass; |
@@ -1064,15 +1368,23 @@ discard block |
||
| 1064 | 1368 | $source_city = $_POST['source_city']; |
| 1065 | 1369 | $source_country = $_POST['source_country']; |
| 1066 | 1370 | $source_ref = $_POST['source_ref']; |
| 1067 | - if (isset($source_id)) $source_id = $_POST['source_id']; |
|
| 1068 | - else $source_id = array(); |
|
| 1371 | + if (isset($source_id)) { |
|
| 1372 | + $source_id = $_POST['source_id']; |
|
| 1373 | + } else { |
|
| 1374 | + $source_id = array(); |
|
| 1375 | + } |
|
| 1069 | 1376 | |
| 1070 | 1377 | $sources = array(); |
| 1071 | 1378 | foreach ($source_name as $keys => $name) { |
| 1072 | - 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]); |
|
| 1073 | - 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]); |
|
| 1379 | + if (isset($source_id[$keys])) { |
|
| 1380 | + $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]); |
|
| 1381 | + } else { |
|
| 1382 | + $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]); |
|
| 1383 | + } |
|
| 1384 | + } |
|
| 1385 | + if (count($sources) > 0) { |
|
| 1386 | + $_SESSION['sources'] = $sources; |
|
| 1074 | 1387 | } |
| 1075 | - if (count($sources) > 0) $_SESSION['sources'] = $sources; |
|
| 1076 | 1388 | |
| 1077 | 1389 | //$sbshost = filter_input(INPUT_POST,'sbshost',FILTER_SANITIZE_STRING); |
| 1078 | 1390 | //$sbsport = filter_input(INPUT_POST,'sbsport',FILTER_SANITIZE_NUMBER_INT); |
@@ -1093,17 +1405,29 @@ discard block |
||
| 1093 | 1405 | $datasource = filter_input(INPUT_POST,'datasource',FILTER_SANITIZE_STRING); |
| 1094 | 1406 | |
| 1095 | 1407 | $globalaircraft = filter_input(INPUT_POST,'globalaircraft',FILTER_SANITIZE_STRING); |
| 1096 | - if ($globalaircraft == 'aircraft') $settings = array_merge($settings,array('globalAircraft' => 'TRUE')); |
|
| 1097 | - else $settings = array_merge($settings,array('globalAircraft' => 'FALSE')); |
|
| 1408 | + if ($globalaircraft == 'aircraft') { |
|
| 1409 | + $settings = array_merge($settings,array('globalAircraft' => 'TRUE')); |
|
| 1410 | + } else { |
|
| 1411 | + $settings = array_merge($settings,array('globalAircraft' => 'FALSE')); |
|
| 1412 | + } |
|
| 1098 | 1413 | $globaltracker = filter_input(INPUT_POST,'globaltracker',FILTER_SANITIZE_STRING); |
| 1099 | - if ($globaltracker == 'tracker') $settings = array_merge($settings,array('globalTracker' => 'TRUE')); |
|
| 1100 | - else $settings = array_merge($settings,array('globalTracker' => 'FALSE')); |
|
| 1414 | + if ($globaltracker == 'tracker') { |
|
| 1415 | + $settings = array_merge($settings,array('globalTracker' => 'TRUE')); |
|
| 1416 | + } else { |
|
| 1417 | + $settings = array_merge($settings,array('globalTracker' => 'FALSE')); |
|
| 1418 | + } |
|
| 1101 | 1419 | $globalmarine = filter_input(INPUT_POST,'globalmarine',FILTER_SANITIZE_STRING); |
| 1102 | - if ($globalmarine == 'marine') $settings = array_merge($settings,array('globalMarine' => 'TRUE')); |
|
| 1103 | - else $settings = array_merge($settings,array('globalMarine' => 'FALSE')); |
|
| 1420 | + if ($globalmarine == 'marine') { |
|
| 1421 | + $settings = array_merge($settings,array('globalMarine' => 'TRUE')); |
|
| 1422 | + } else { |
|
| 1423 | + $settings = array_merge($settings,array('globalMarine' => 'FALSE')); |
|
| 1424 | + } |
|
| 1104 | 1425 | $globalsatellite = filter_input(INPUT_POST,'globalsatellite',FILTER_SANITIZE_STRING); |
| 1105 | - if ($globalsatellite == 'satellite') $settings = array_merge($settings,array('globalSatellite' => 'TRUE')); |
|
| 1106 | - else $settings = array_merge($settings,array('globalSatellite' => 'FALSE')); |
|
| 1426 | + if ($globalsatellite == 'satellite') { |
|
| 1427 | + $settings = array_merge($settings,array('globalSatellite' => 'TRUE')); |
|
| 1428 | + } else { |
|
| 1429 | + $settings = array_merge($settings,array('globalSatellite' => 'FALSE')); |
|
| 1430 | + } |
|
| 1107 | 1431 | |
| 1108 | 1432 | /* |
| 1109 | 1433 | $globalSBS1Hosts = array(); |
@@ -1125,23 +1449,37 @@ discard block |
||
| 1125 | 1449 | $name = $_POST['name']; |
| 1126 | 1450 | $format = $_POST['format']; |
| 1127 | 1451 | $timezones = $_POST['timezones']; |
| 1128 | - if (isset($_POST['sourcestats'])) $sourcestats = $_POST['sourcestats']; |
|
| 1129 | - else $sourcestats = array(); |
|
| 1130 | - if (isset($_POST['noarchive'])) $noarchive = $_POST['noarchive']; |
|
| 1131 | - else $noarchive = array(); |
|
| 1452 | + if (isset($_POST['sourcestats'])) { |
|
| 1453 | + $sourcestats = $_POST['sourcestats']; |
|
| 1454 | + } else { |
|
| 1455 | + $sourcestats = array(); |
|
| 1456 | + } |
|
| 1457 | + if (isset($_POST['noarchive'])) { |
|
| 1458 | + $noarchive = $_POST['noarchive']; |
|
| 1459 | + } else { |
|
| 1460 | + $noarchive = array(); |
|
| 1461 | + } |
|
| 1132 | 1462 | $gSources = array(); |
| 1133 | 1463 | $forcepilots = false; |
| 1134 | 1464 | foreach ($host as $key => $h) { |
| 1135 | - if (isset($sourcestats[$key]) && $sourcestats[$key] == 1) $cov = 'TRUE'; |
|
| 1136 | - else $cov = 'FALSE'; |
|
| 1137 | - if (isset($noarchive[$key]) && $noarchive[$key] == 1) $arch = 'TRUE'; |
|
| 1138 | - else $arch = 'FALSE'; |
|
| 1465 | + if (isset($sourcestats[$key]) && $sourcestats[$key] == 1) { |
|
| 1466 | + $cov = 'TRUE'; |
|
| 1467 | + } else { |
|
| 1468 | + $cov = 'FALSE'; |
|
| 1469 | + } |
|
| 1470 | + if (isset($noarchive[$key]) && $noarchive[$key] == 1) { |
|
| 1471 | + $arch = 'TRUE'; |
|
| 1472 | + } else { |
|
| 1473 | + $arch = 'FALSE'; |
|
| 1474 | + } |
|
| 1139 | 1475 | if (strpos($format[$key],'_callback')) { |
| 1140 | 1476 | $gSources[] = array('host' => $h, 'pass' => $port[$key],'name' => $name[$key],'format' => $format[$key],'sourcestats' => $cov,'noarchive' => $arch,'timezone' => $timezones[$key],'callback' => 'TRUE'); |
| 1141 | 1477 | } elseif ($h != '' || $name[$key] != '') { |
| 1142 | 1478 | $gSources[] = array('host' => $h, 'port' => $port[$key],'name' => $name[$key],'format' => $format[$key],'sourcestats' => $cov,'noarchive' => $arch,'timezone' => $timezones[$key],'callback' => 'FALSE'); |
| 1143 | 1479 | } |
| 1144 | - if ($format[$key] == 'airwhere') $forcepilots = true; |
|
| 1480 | + if ($format[$key] == 'airwhere') { |
|
| 1481 | + $forcepilots = true; |
|
| 1482 | + } |
|
| 1145 | 1483 | } |
| 1146 | 1484 | $settings = array_merge($settings,array('globalSources' => $gSources)); |
| 1147 | 1485 | |
@@ -1172,7 +1510,9 @@ discard block |
||
| 1172 | 1510 | $zoidistance = filter_input(INPUT_POST,'zoidistance',FILTER_SANITIZE_NUMBER_INT); |
| 1173 | 1511 | if ($zoilatitude != '' && $zoilongitude != '' && $zoidistance != '') { |
| 1174 | 1512 | $settings = array_merge($settings,array('globalDistanceIgnore' => array('latitude' => $zoilatitude,'longitude' => $zoilongitude,'distance' => $zoidistance))); |
| 1175 | - } else $settings = array_merge($settings,array('globalDistanceIgnore' => array())); |
|
| 1513 | + } else { |
|
| 1514 | + $settings = array_merge($settings,array('globalDistanceIgnore' => array())); |
|
| 1515 | + } |
|
| 1176 | 1516 | |
| 1177 | 1517 | $refresh = filter_input(INPUT_POST,'refresh',FILTER_SANITIZE_NUMBER_INT); |
| 1178 | 1518 | $settings = array_merge($settings,array('globalLiveInterval' => $refresh)); |
@@ -1211,7 +1551,9 @@ discard block |
||
| 1211 | 1551 | |
| 1212 | 1552 | // Create in settings.php keys not yet configurable if not already here |
| 1213 | 1553 | //if (!isset($globalImageBingKey)) $settings = array_merge($settings,array('globalImageBingKey' => '')); |
| 1214 | - if (!isset($globalDebug)) $settings = array_merge($settings,array('globalDebug' => 'TRUE')); |
|
| 1554 | + if (!isset($globalDebug)) { |
|
| 1555 | + $settings = array_merge($settings,array('globalDebug' => 'TRUE')); |
|
| 1556 | + } |
|
| 1215 | 1557 | |
| 1216 | 1558 | $resetyearstats = filter_input(INPUT_POST,'resetyearstats',FILTER_SANITIZE_STRING); |
| 1217 | 1559 | if ($resetyearstats == 'resetyearstats') { |
@@ -1254,37 +1596,56 @@ discard block |
||
| 1254 | 1596 | } |
| 1255 | 1597 | */ |
| 1256 | 1598 | $settings = array_merge($settings,array('globalFlightAware' => 'FALSE')); |
| 1257 | - if ($globalsbs == 'sbs') $settings = array_merge($settings,array('globalSBS1' => 'TRUE')); |
|
| 1258 | - else $settings = array_merge($settings,array('globalSBS1' => 'FALSE')); |
|
| 1259 | - if ($globalaprs == 'aprs') $settings = array_merge($settings,array('globalAPRS' => 'TRUE')); |
|
| 1260 | - else $settings = array_merge($settings,array('globalAPRS' => 'FALSE')); |
|
| 1599 | + if ($globalsbs == 'sbs') { |
|
| 1600 | + $settings = array_merge($settings,array('globalSBS1' => 'TRUE')); |
|
| 1601 | + } else { |
|
| 1602 | + $settings = array_merge($settings,array('globalSBS1' => 'FALSE')); |
|
| 1603 | + } |
|
| 1604 | + if ($globalaprs == 'aprs') { |
|
| 1605 | + $settings = array_merge($settings,array('globalAPRS' => 'TRUE')); |
|
| 1606 | + } else { |
|
| 1607 | + $settings = array_merge($settings,array('globalAPRS' => 'FALSE')); |
|
| 1608 | + } |
|
| 1261 | 1609 | $va = false; |
| 1262 | 1610 | if ($globalivao == 'ivao') { |
| 1263 | 1611 | $settings = array_merge($settings,array('globalIVAO' => 'TRUE')); |
| 1264 | 1612 | $va = true; |
| 1265 | - } else $settings = array_merge($settings,array('globalIVAO' => 'FALSE')); |
|
| 1613 | + } else { |
|
| 1614 | + $settings = array_merge($settings,array('globalIVAO' => 'FALSE')); |
|
| 1615 | + } |
|
| 1266 | 1616 | if ($globalvatsim == 'vatsim') { |
| 1267 | 1617 | $settings = array_merge($settings,array('globalVATSIM' => 'TRUE')); |
| 1268 | 1618 | $va = true; |
| 1269 | - } else $settings = array_merge($settings,array('globalVATSIM' => 'FALSE')); |
|
| 1619 | + } else { |
|
| 1620 | + $settings = array_merge($settings,array('globalVATSIM' => 'FALSE')); |
|
| 1621 | + } |
|
| 1270 | 1622 | if ($globalphpvms == 'phpvms') { |
| 1271 | 1623 | $settings = array_merge($settings,array('globalphpVMS' => 'TRUE')); |
| 1272 | 1624 | $va = true; |
| 1273 | - } else $settings = array_merge($settings,array('globalphpVMS' => 'FALSE')); |
|
| 1625 | + } else { |
|
| 1626 | + $settings = array_merge($settings,array('globalphpVMS' => 'FALSE')); |
|
| 1627 | + } |
|
| 1274 | 1628 | if ($globalvam == 'vam') { |
| 1275 | 1629 | $settings = array_merge($settings,array('globalVAM' => 'TRUE')); |
| 1276 | 1630 | $va = true; |
| 1277 | - } else $settings = array_merge($settings,array('globalVAM' => 'FALSE')); |
|
| 1631 | + } else { |
|
| 1632 | + $settings = array_merge($settings,array('globalVAM' => 'FALSE')); |
|
| 1633 | + } |
|
| 1278 | 1634 | if ($va) { |
| 1279 | 1635 | $settings = array_merge($settings,array('globalSchedulesFetch' => 'FALSE','globalTranslationFetch' => 'FALSE')); |
| 1280 | - } else $settings = array_merge($settings,array('globalSchedulesFetch' => 'TRUE','globalTranslationFetch' => 'TRUE')); |
|
| 1636 | + } else { |
|
| 1637 | + $settings = array_merge($settings,array('globalSchedulesFetch' => 'TRUE','globalTranslationFetch' => 'TRUE')); |
|
| 1638 | + } |
|
| 1281 | 1639 | if ($globalva == 'va' || $va) { |
| 1282 | 1640 | $settings = array_merge($settings,array('globalVA' => 'TRUE')); |
| 1283 | 1641 | $settings = array_merge($settings,array('globalUsePilot' => 'TRUE','globalUseOwner' => 'FALSE')); |
| 1284 | 1642 | } else { |
| 1285 | 1643 | $settings = array_merge($settings,array('globalVA' => 'FALSE')); |
| 1286 | - if ($forcepilots) $settings = array_merge($settings,array('globalUsePilot' => 'TRUE','globalUseOwner' => 'FALSE')); |
|
| 1287 | - else $settings = array_merge($settings,array('globalUsePilot' => 'FALSE','globalUseOwner' => 'TRUE')); |
|
| 1644 | + if ($forcepilots) { |
|
| 1645 | + $settings = array_merge($settings,array('globalUsePilot' => 'TRUE','globalUseOwner' => 'FALSE')); |
|
| 1646 | + } else { |
|
| 1647 | + $settings = array_merge($settings,array('globalUsePilot' => 'FALSE','globalUseOwner' => 'TRUE')); |
|
| 1648 | + } |
|
| 1288 | 1649 | } |
| 1289 | 1650 | |
| 1290 | 1651 | |
@@ -1478,7 +1839,9 @@ discard block |
||
| 1478 | 1839 | $settings = array_merge($settings,array('globalNoAirlines' => 'FALSE')); |
| 1479 | 1840 | } |
| 1480 | 1841 | |
| 1481 | - if (!isset($globalTransaction)) $settings = array_merge($settings,array('globalTransaction' => 'TRUE')); |
|
| 1842 | + if (!isset($globalTransaction)) { |
|
| 1843 | + $settings = array_merge($settings,array('globalTransaction' => 'TRUE')); |
|
| 1844 | + } |
|
| 1482 | 1845 | |
| 1483 | 1846 | // Set some defaults values... |
| 1484 | 1847 | if (!isset($globalAircraftImageSources)) { |
@@ -1493,15 +1856,23 @@ discard block |
||
| 1493 | 1856 | |
| 1494 | 1857 | $settings = array_merge($settings,array('globalInstalled' => 'TRUE')); |
| 1495 | 1858 | |
| 1496 | - if ($error == '') settings::modify_settings($settings); |
|
| 1497 | - if ($error == '') settings::comment_settings($settings_comment); |
|
| 1859 | + if ($error == '') { |
|
| 1860 | + settings::modify_settings($settings); |
|
| 1861 | + } |
|
| 1862 | + if ($error == '') { |
|
| 1863 | + settings::comment_settings($settings_comment); |
|
| 1864 | + } |
|
| 1498 | 1865 | if ($error != '') { |
| 1499 | 1866 | print '<div class="info column">'.$error.'</div>'; |
| 1500 | 1867 | require('../footer.php'); |
| 1501 | 1868 | exit; |
| 1502 | 1869 | } else { |
| 1503 | - if (isset($_POST['waypoints']) && $_POST['waypoints'] == 'waypoints') $_SESSION['waypoints'] = 1; |
|
| 1504 | - if (isset($_POST['owner']) && $_POST['owner'] == 'owner') $_SESSION['owner'] = 1; |
|
| 1870 | + if (isset($_POST['waypoints']) && $_POST['waypoints'] == 'waypoints') { |
|
| 1871 | + $_SESSION['waypoints'] = 1; |
|
| 1872 | + } |
|
| 1873 | + if (isset($_POST['owner']) && $_POST['owner'] == 'owner') { |
|
| 1874 | + $_SESSION['owner'] = 1; |
|
| 1875 | + } |
|
| 1505 | 1876 | if (isset($_POST['createdb'])) { |
| 1506 | 1877 | $_SESSION['install'] = 'database_create'; |
| 1507 | 1878 | } else { |
@@ -1538,10 +1909,18 @@ discard block |
||
| 1538 | 1909 | $popw = false; |
| 1539 | 1910 | foreach ($_SESSION['done'] as $done) { |
| 1540 | 1911 | print '<li>'.$done.'....<strong>SUCCESS</strong></li>'; |
| 1541 | - if ($done == 'Create database') $pop = true; |
|
| 1542 | - if ($_SESSION['install'] == 'database_create') $pop = true; |
|
| 1543 | - if ($_SESSION['install'] == 'database_import') $popi = true; |
|
| 1544 | - if ($_SESSION['install'] == 'waypoints') $popw = true; |
|
| 1912 | + if ($done == 'Create database') { |
|
| 1913 | + $pop = true; |
|
| 1914 | + } |
|
| 1915 | + if ($_SESSION['install'] == 'database_create') { |
|
| 1916 | + $pop = true; |
|
| 1917 | + } |
|
| 1918 | + if ($_SESSION['install'] == 'database_import') { |
|
| 1919 | + $popi = true; |
|
| 1920 | + } |
|
| 1921 | + if ($_SESSION['install'] == 'waypoints') { |
|
| 1922 | + $popw = true; |
|
| 1923 | + } |
|
| 1545 | 1924 | } |
| 1546 | 1925 | if ($pop) { |
| 1547 | 1926 | sleep(5); |
@@ -1552,7 +1931,9 @@ discard block |
||
| 1552 | 1931 | } else if ($popw) { |
| 1553 | 1932 | sleep(5); |
| 1554 | 1933 | print '<li>Populate waypoints database....<img src="../images/loading.gif" /></li>'; |
| 1555 | - } else print '<li>Update schema if needed....<img src="../images/loading.gif" /></li>'; |
|
| 1934 | + } else { |
|
| 1935 | + print '<li>Update schema if needed....<img src="../images/loading.gif" /></li>'; |
|
| 1936 | + } |
|
| 1556 | 1937 | print '</div></ul>'; |
| 1557 | 1938 | print '<div id="error"></div>'; |
| 1558 | 1939 | /* foreach ($_SESSION['done'] as $done) { |
@@ -14,13 +14,17 @@ discard block |
||
| 14 | 14 | require_once(dirname(__FILE__).'/../require/class.Source.php'); |
| 15 | 15 | require_once(dirname(__FILE__).'/../require/class.Connection.php'); |
| 16 | 16 | require_once(dirname(__FILE__).'/../require/class.Common.php'); |
| 17 | -if (isset($globalTracker) && $globalTracker) require_once(dirname(__FILE__).'/../require/class.TrackerImport.php'); |
|
| 17 | +if (isset($globalTracker) && $globalTracker) { |
|
| 18 | + require_once(dirname(__FILE__).'/../require/class.TrackerImport.php'); |
|
| 19 | +} |
|
| 18 | 20 | if (isset($globalMarine) && $globalMarine) { |
| 19 | 21 | require_once(dirname(__FILE__).'/../require/class.AIS.php'); |
| 20 | 22 | require_once(dirname(__FILE__).'/../require/class.MarineImport.php'); |
| 21 | 23 | } |
| 22 | 24 | |
| 23 | -if (!isset($globalDebug)) $globalDebug = FALSE; |
|
| 25 | +if (!isset($globalDebug)) { |
|
| 26 | + $globalDebug = FALSE; |
|
| 27 | +} |
|
| 24 | 28 | |
| 25 | 29 | // Check if schema is at latest version |
| 26 | 30 | $Connection = new Connection(); |
@@ -59,66 +63,107 @@ discard block |
||
| 59 | 63 | //elseif (isset($options['source'])) $hosts = array($options['source']); |
| 60 | 64 | if (isset($options['s'])) { |
| 61 | 65 | $globalSources = array(); |
| 62 | - if (isset($options['format'])) $globalSources[] = array('host' => $options['s'],'format' => $options['format']); |
|
| 63 | - else $globalSources[] = array('host' => $options['s']); |
|
| 64 | -} elseif (isset($options['source'])) { |
|
| 66 | + if (isset($options['format'])) { |
|
| 67 | + $globalSources[] = array('host' => $options['s'],'format' => $options['format']); |
|
| 68 | + } else { |
|
| 69 | + $globalSources[] = array('host' => $options['s']); |
|
| 70 | + } |
|
| 71 | + } elseif (isset($options['source'])) { |
|
| 65 | 72 | $globalSources = array(); |
| 66 | - if (isset($options['format'])) $globalSources[] = array('host' => $options['source'],'format' => $options['format']); |
|
| 67 | - else $globalSources[] = array('host' => $options['source']); |
|
| 68 | -} |
|
| 73 | + if (isset($options['format'])) { |
|
| 74 | + $globalSources[] = array('host' => $options['source'],'format' => $options['format']); |
|
| 75 | + } else { |
|
| 76 | + $globalSources[] = array('host' => $options['source']); |
|
| 77 | + } |
|
| 78 | + } |
|
| 69 | 79 | if (isset($options['aprsserverhost'])) { |
| 70 | 80 | $globalServerAPRS = TRUE; |
| 71 | 81 | $globalServerAPRShost = $options['aprsserverhost']; |
| 72 | 82 | } |
| 73 | -if (isset($options['aprsserverport'])) $globalServerAPRSport = $options['aprsserverport']; |
|
| 74 | -if (isset($options['aprsserverssid'])) $globalServerAPRSssid = $options['aprsserverssid']; |
|
| 75 | -if (isset($options['aprsserverpass'])) $globalServerAPRSpass = $options['aprsserverpass']; |
|
| 76 | -if (isset($options['noaprsserver'])) $globalServerAPRS = FALSE; |
|
| 83 | +if (isset($options['aprsserverport'])) { |
|
| 84 | + $globalServerAPRSport = $options['aprsserverport']; |
|
| 85 | +} |
|
| 86 | +if (isset($options['aprsserverssid'])) { |
|
| 87 | + $globalServerAPRSssid = $options['aprsserverssid']; |
|
| 88 | +} |
|
| 89 | +if (isset($options['aprsserverpass'])) { |
|
| 90 | + $globalServerAPRSpass = $options['aprsserverpass']; |
|
| 91 | +} |
|
| 92 | +if (isset($options['noaprsserver'])) { |
|
| 93 | + $globalServerAPRS = FALSE; |
|
| 94 | +} |
|
| 77 | 95 | if (isset($options['enable-aircraft'])) { |
| 78 | - if ($globalDebug) echo 'Enable Aircraft mode'."\n"; |
|
| 96 | + if ($globalDebug) { |
|
| 97 | + echo 'Enable Aircraft mode'."\n"; |
|
| 98 | + } |
|
| 79 | 99 | $globalAircraft = TRUE; |
| 80 | 100 | } |
| 81 | 101 | if (isset($options['disable-aircraft'])) { |
| 82 | - if ($globalDebug) echo 'Disable Aircraft mode'."\n"; |
|
| 102 | + if ($globalDebug) { |
|
| 103 | + echo 'Disable Aircraft mode'."\n"; |
|
| 104 | + } |
|
| 83 | 105 | $globalAircraft = FALSE; |
| 84 | 106 | } |
| 85 | 107 | if (isset($options['enable-tracker'])) { |
| 86 | - if ($globalDebug) echo 'Enable Tracker mode'."\n"; |
|
| 108 | + if ($globalDebug) { |
|
| 109 | + echo 'Enable Tracker mode'."\n"; |
|
| 110 | + } |
|
| 87 | 111 | $globalTracker = TRUE; |
| 88 | 112 | } |
| 89 | 113 | if (isset($options['disable-tracker'])) { |
| 90 | - if ($globalDebug) echo 'Disable Tracker mode'."\n"; |
|
| 114 | + if ($globalDebug) { |
|
| 115 | + echo 'Disable Tracker mode'."\n"; |
|
| 116 | + } |
|
| 91 | 117 | $globalTracker = FALSE; |
| 92 | 118 | } |
| 93 | 119 | if (isset($options['enable-marine'])) { |
| 94 | - if ($globalDebug) echo 'Enable Marine mode'."\n"; |
|
| 120 | + if ($globalDebug) { |
|
| 121 | + echo 'Enable Marine mode'."\n"; |
|
| 122 | + } |
|
| 95 | 123 | $globalMarine = TRUE; |
| 96 | 124 | } |
| 97 | 125 | if (isset($options['disable-marine'])) { |
| 98 | - if ($globalDebug) echo 'Disable Marine mode'."\n"; |
|
| 126 | + if ($globalDebug) { |
|
| 127 | + echo 'Disable Marine mode'."\n"; |
|
| 128 | + } |
|
| 99 | 129 | $globalMarine = FALSE; |
| 100 | 130 | } |
| 101 | -if (isset($options['nodaemon'])) $globalDaemon = FALSE; |
|
| 102 | -if (isset($options['server'])) $globalServer = TRUE; |
|
| 103 | -if (isset($options['idsource'])) $id_source = $options['idsource']; |
|
| 104 | -else $id_source = 1; |
|
| 131 | +if (isset($options['nodaemon'])) { |
|
| 132 | + $globalDaemon = FALSE; |
|
| 133 | +} |
|
| 134 | +if (isset($options['server'])) { |
|
| 135 | + $globalServer = TRUE; |
|
| 136 | +} |
|
| 137 | +if (isset($options['idsource'])) { |
|
| 138 | + $id_source = $options['idsource']; |
|
| 139 | +} else { |
|
| 140 | + $id_source = 1; |
|
| 141 | +} |
|
| 105 | 142 | if (isset($globalServer) && $globalServer) { |
| 106 | - if ($globalDebug) echo "Using Server Mode\n"; |
|
| 143 | + if ($globalDebug) { |
|
| 144 | + echo "Using Server Mode\n"; |
|
| 145 | + } |
|
| 107 | 146 | $SI=new SpotterServer(); |
| 108 | 147 | /* |
| 109 | 148 | require_once(dirname(__FILE__).'/../require/class.APRS.php'); |
| 110 | 149 | $SI = new adsb2aprs(); |
| 111 | 150 | $SI->connect(); |
| 112 | 151 | */ |
| 113 | -} else $SI=new SpotterImport($Connection->db); |
|
| 152 | +} else { |
|
| 153 | + $SI=new SpotterImport($Connection->db); |
|
| 154 | +} |
|
| 114 | 155 | |
| 115 | -if (isset($globalTracker) && $globalTracker) require_once(dirname(__FILE__).'/../require/class.TrackerImport.php'); |
|
| 156 | +if (isset($globalTracker) && $globalTracker) { |
|
| 157 | + require_once(dirname(__FILE__).'/../require/class.TrackerImport.php'); |
|
| 158 | +} |
|
| 116 | 159 | if (isset($globalMarine) && $globalMarine) { |
| 117 | 160 | require_once(dirname(__FILE__).'/../require/class.AIS.php'); |
| 118 | 161 | require_once(dirname(__FILE__).'/../require/class.MarineImport.php'); |
| 119 | 162 | } |
| 120 | 163 | |
| 121 | -if (isset($globalTracker) && $globalTracker) $TI = new TrackerImport($Connection->db); |
|
| 164 | +if (isset($globalTracker) && $globalTracker) { |
|
| 165 | + $TI = new TrackerImport($Connection->db); |
|
| 166 | +} |
|
| 122 | 167 | if (isset($globalMarine) && $globalMarine) { |
| 123 | 168 | $AIS = new AIS(); |
| 124 | 169 | $MI = new MarineImport($Connection->db); |
@@ -143,7 +188,9 @@ discard block |
||
| 143 | 188 | } |
| 144 | 189 | |
| 145 | 190 | // let's try and connect |
| 146 | -if ($globalDebug) echo "Connecting...\n"; |
|
| 191 | +if ($globalDebug) { |
|
| 192 | + echo "Connecting...\n"; |
|
| 193 | +} |
|
| 147 | 194 | $use_aprs = false; |
| 148 | 195 | $aprs_full = false; |
| 149 | 196 | $reset = 0; |
@@ -152,7 +199,9 @@ discard block |
||
| 152 | 199 | //global $sockets, $formats, $globalDebug,$aprs_connect,$last_exec, $globalSourcesRights, $use_aprs; |
| 153 | 200 | global $sockets,$httpfeeds, $globalSources, $globalDebug,$aprs_connect,$last_exec, $globalSourcesRights, $use_aprs, $reset,$context; |
| 154 | 201 | $reset++; |
| 155 | - if ($globalDebug) echo 'Connect to all...'."\n"; |
|
| 202 | + if ($globalDebug) { |
|
| 203 | + echo 'Connect to all...'."\n"; |
|
| 204 | + } |
|
| 156 | 205 | foreach ($hosts as $id => $value) { |
| 157 | 206 | $host = $value['host']; |
| 158 | 207 | $globalSources[$id]['last_exec'] = 0; |
@@ -162,22 +211,30 @@ discard block |
||
| 162 | 211 | //$formats[$id] = 'deltadbtxt'; |
| 163 | 212 | $globalSources[$id]['format'] = 'deltadbtxt'; |
| 164 | 213 | //$last_exec['deltadbtxt'] = 0; |
| 165 | - if ($globalDebug) echo "Connect to deltadb source (".$host.")...\n"; |
|
| 214 | + if ($globalDebug) { |
|
| 215 | + echo "Connect to deltadb source (".$host.")...\n"; |
|
| 216 | + } |
|
| 166 | 217 | } else if (preg_match('/vatsim-data.txt$/i',$host)) { |
| 167 | 218 | //$formats[$id] = 'vatsimtxt'; |
| 168 | 219 | $globalSources[$id]['format'] = 'vatsimtxt'; |
| 169 | 220 | //$last_exec['vatsimtxt'] = 0; |
| 170 | - if ($globalDebug) echo "Connect to vatsim source (".$host.")...\n"; |
|
| 221 | + if ($globalDebug) { |
|
| 222 | + echo "Connect to vatsim source (".$host.")...\n"; |
|
| 223 | + } |
|
| 171 | 224 | } else if (preg_match('/aircraftlist.json$/i',$host)) { |
| 172 | 225 | //$formats[$id] = 'aircraftlistjson'; |
| 173 | 226 | $globalSources[$id]['format'] = 'aircraftlistjson'; |
| 174 | 227 | //$last_exec['aircraftlistjson'] = 0; |
| 175 | - if ($globalDebug) echo "Connect to aircraftlist.json source (".$host.")...\n"; |
|
| 228 | + if ($globalDebug) { |
|
| 229 | + echo "Connect to aircraftlist.json source (".$host.")...\n"; |
|
| 230 | + } |
|
| 176 | 231 | } else if (preg_match('/opensky/i',$host)) { |
| 177 | 232 | //$formats[$id] = 'aircraftlistjson'; |
| 178 | 233 | $globalSources[$id]['format'] = 'opensky'; |
| 179 | 234 | //$last_exec['aircraftlistjson'] = 0; |
| 180 | - if ($globalDebug) echo "Connect to opensky source (".$host.")...\n"; |
|
| 235 | + if ($globalDebug) { |
|
| 236 | + echo "Connect to opensky source (".$host.")...\n"; |
|
| 237 | + } |
|
| 181 | 238 | /* |
| 182 | 239 | // Disabled for now, site change source format |
| 183 | 240 | } else if (preg_match('/radarvirtuel.com\/list_aircrafts$/i',$host)) { |
@@ -194,7 +251,9 @@ discard block |
||
| 194 | 251 | //$formats[$id] = 'planeupdatefaa'; |
| 195 | 252 | $globalSources[$id]['format'] = 'planeupdatefaa'; |
| 196 | 253 | //$last_exec['planeupdatefaa'] = 0; |
| 197 | - if ($globalDebug) echo "Connect to planeUpdateFAA.php source (".$host.")...\n"; |
|
| 254 | + if ($globalDebug) { |
|
| 255 | + echo "Connect to planeUpdateFAA.php source (".$host.")...\n"; |
|
| 256 | + } |
|
| 198 | 257 | if (!isset($globalSourcesRights) || (isset($globalSourcesRights) && !$globalSourcesRights)) { |
| 199 | 258 | echo '!!! You MUST set $globalSourcesRights = TRUE in settings.php if you have the right to use this feed !!!'."\n"; |
| 200 | 259 | exit(0); |
@@ -203,37 +262,53 @@ discard block |
||
| 203 | 262 | //$formats[$id] = 'phpvmacars'; |
| 204 | 263 | $globalSources[$id]['format'] = 'phpvmacars'; |
| 205 | 264 | //$last_exec['phpvmacars'] = 0; |
| 206 | - if ($globalDebug) echo "Connect to phpvmacars source (".$host.")...\n"; |
|
| 265 | + if ($globalDebug) { |
|
| 266 | + echo "Connect to phpvmacars source (".$host.")...\n"; |
|
| 267 | + } |
|
| 207 | 268 | } else if (preg_match('/\/api\/v1\/acars\/data$/i',$host)) { |
| 208 | 269 | //$formats[$id] = 'phpvmacars'; |
| 209 | 270 | $globalSources[$id]['format'] = 'vaos'; |
| 210 | 271 | //$last_exec['phpvmacars'] = 0; |
| 211 | - if ($globalDebug) echo "Connect to vaos source (".$host.")...\n"; |
|
| 272 | + if ($globalDebug) { |
|
| 273 | + echo "Connect to vaos source (".$host.")...\n"; |
|
| 274 | + } |
|
| 212 | 275 | } else if (preg_match('/VAM-json.php$/i',$host)) { |
| 213 | 276 | //$formats[$id] = 'phpvmacars'; |
| 214 | 277 | $globalSources[$id]['format'] = 'vam'; |
| 215 | - if ($globalDebug) echo "Connect to Vam source (".$host.")...\n"; |
|
| 278 | + if ($globalDebug) { |
|
| 279 | + echo "Connect to Vam source (".$host.")...\n"; |
|
| 280 | + } |
|
| 216 | 281 | } else if (preg_match('/whazzup/i',$host)) { |
| 217 | 282 | //$formats[$id] = 'whazzup'; |
| 218 | 283 | $globalSources[$id]['format'] = 'whazzup'; |
| 219 | 284 | //$last_exec['whazzup'] = 0; |
| 220 | - if ($globalDebug) echo "Connect to whazzup source (".$host.")...\n"; |
|
| 285 | + if ($globalDebug) { |
|
| 286 | + echo "Connect to whazzup source (".$host.")...\n"; |
|
| 287 | + } |
|
| 221 | 288 | } else if (preg_match('/blitzortung/i',$host)) { |
| 222 | 289 | $globalSources[$id]['format'] = 'blitzortung'; |
| 223 | - if ($globalDebug) echo "Connect to blitzortung source (".$host.")...\n"; |
|
| 290 | + if ($globalDebug) { |
|
| 291 | + echo "Connect to blitzortung source (".$host.")...\n"; |
|
| 292 | + } |
|
| 224 | 293 | } else if (preg_match('/airwhere/i',$host)) { |
| 225 | 294 | $globalSources[$id]['format'] = 'airwhere'; |
| 226 | - if ($globalDebug) echo "Connect to airwhere source (".$host.")...\n"; |
|
| 295 | + if ($globalDebug) { |
|
| 296 | + echo "Connect to airwhere source (".$host.")...\n"; |
|
| 297 | + } |
|
| 227 | 298 | } else if (preg_match('/recentpireps/i',$host)) { |
| 228 | 299 | //$formats[$id] = 'pirepsjson'; |
| 229 | 300 | $globalSources[$id]['format'] = 'pirepsjson'; |
| 230 | 301 | //$last_exec['pirepsjson'] = 0; |
| 231 | - if ($globalDebug) echo "Connect to pirepsjson source (".$host.")...\n"; |
|
| 302 | + if ($globalDebug) { |
|
| 303 | + echo "Connect to pirepsjson source (".$host.")...\n"; |
|
| 304 | + } |
|
| 232 | 305 | } else if (preg_match(':data.fr24.com/zones/fcgi/feed.js:i',$host)) { |
| 233 | 306 | //$formats[$id] = 'fr24json'; |
| 234 | 307 | $globalSources[$id]['format'] = 'fr24json'; |
| 235 | 308 | //$last_exec['fr24json'] = 0; |
| 236 | - if ($globalDebug) echo "Connect to fr24 source (".$host.")...\n"; |
|
| 309 | + if ($globalDebug) { |
|
| 310 | + echo "Connect to fr24 source (".$host.")...\n"; |
|
| 311 | + } |
|
| 237 | 312 | if (!isset($globalSourcesRights) || (isset($globalSourcesRights) && !$globalSourcesRights)) { |
| 238 | 313 | echo '!!! You MUST set $globalSourcesRights = TRUE in settings.php if you have the right to use this feed !!!'."\n"; |
| 239 | 314 | exit(0); |
@@ -242,7 +317,9 @@ discard block |
||
| 242 | 317 | //$formats[$id] = 'fr24json'; |
| 243 | 318 | $globalSources[$id]['format'] = 'myshiptracking'; |
| 244 | 319 | //$last_exec['fr24json'] = 0; |
| 245 | - if ($globalDebug) echo "Connect to myshiptracking source (".$host.")...\n"; |
|
| 320 | + if ($globalDebug) { |
|
| 321 | + echo "Connect to myshiptracking source (".$host.")...\n"; |
|
| 322 | + } |
|
| 246 | 323 | if (!isset($globalSourcesRights) || (isset($globalSourcesRights) && !$globalSourcesRights)) { |
| 247 | 324 | echo '!!! You MUST set $globalSourcesRights = TRUE in settings.php if you have the right to use this feed !!!'."\n"; |
| 248 | 325 | exit(0); |
@@ -251,16 +328,24 @@ discard block |
||
| 251 | 328 | } else if (preg_match('/10001/',$host) || (isset($globalSources[$id]['port']) && $globalSources[$id]['port'] == '10001')) { |
| 252 | 329 | //$formats[$id] = 'tsv'; |
| 253 | 330 | $globalSources[$id]['format'] = 'tsv'; |
| 254 | - if ($globalDebug) echo "Connect to tsv source (".$host.")...\n"; |
|
| 331 | + if ($globalDebug) { |
|
| 332 | + echo "Connect to tsv source (".$host.")...\n"; |
|
| 333 | + } |
|
| 255 | 334 | } |
| 256 | 335 | } elseif (filter_var($host,FILTER_VALIDATE_URL)) { |
| 257 | 336 | if ($globalSources[$id]['format'] == 'aisnmeahttp') { |
| 258 | 337 | $idf = fopen($globalSources[$id]['host'],'r',false,$context); |
| 259 | 338 | if ($idf !== false) { |
| 260 | 339 | $httpfeeds[$id] = $idf; |
| 261 | - if ($globalDebug) echo "Connected to ".$globalSources[$id]['format']." source (".$host.")...\n"; |
|
| 262 | - } elseif ($globalDebug) echo "Can't connect to ".$globalSources[$id]['host']."\n"; |
|
| 263 | - } elseif ($globalDebug) echo "Connect to ".$globalSources[$id]['format']." source (".$host.")...\n"; |
|
| 340 | + if ($globalDebug) { |
|
| 341 | + echo "Connected to ".$globalSources[$id]['format']." source (".$host.")...\n"; |
|
| 342 | + } |
|
| 343 | + } elseif ($globalDebug) { |
|
| 344 | + echo "Can't connect to ".$globalSources[$id]['host']."\n"; |
|
| 345 | + } |
|
| 346 | + } elseif ($globalDebug) { |
|
| 347 | + echo "Connect to ".$globalSources[$id]['format']." source (".$host.")...\n"; |
|
| 348 | + } |
|
| 264 | 349 | } elseif (!filter_var($host,FILTER_VALIDATE_URL)) { |
| 265 | 350 | $hostport = explode(':',$host); |
| 266 | 351 | if (isset($hostport[1])) { |
@@ -300,17 +385,25 @@ discard block |
||
| 300 | 385 | //$formats[$id] = 'beast'; |
| 301 | 386 | $globalSources[$id]['format'] = 'beast'; |
| 302 | 387 | //} else $formats[$id] = 'sbs'; |
| 303 | - } else $globalSources[$id]['format'] = 'sbs'; |
|
| 388 | + } else { |
|
| 389 | + $globalSources[$id]['format'] = 'sbs'; |
|
| 390 | + } |
|
| 304 | 391 | //if ($globalDebug) echo 'Connection in progress to '.$host.'('.$formats[$id].')....'."\n"; |
| 305 | 392 | } |
| 306 | - if ($globalDebug) echo 'Connection in progress to '.$hostn.':'.$port.' ('.$globalSources[$id]['format'].')....'."\n"; |
|
| 393 | + if ($globalDebug) { |
|
| 394 | + echo 'Connection in progress to '.$hostn.':'.$port.' ('.$globalSources[$id]['format'].')....'."\n"; |
|
| 395 | + } |
|
| 307 | 396 | } else { |
| 308 | - if ($globalDebug) echo 'Connection failed to '.$hostn.':'.$port.' : '.$errno.' '.$errstr."\n"; |
|
| 397 | + if ($globalDebug) { |
|
| 398 | + echo 'Connection failed to '.$hostn.':'.$port.' : '.$errno.' '.$errstr."\n"; |
|
| 399 | + } |
|
| 309 | 400 | } |
| 310 | 401 | } |
| 311 | 402 | } |
| 312 | 403 | } |
| 313 | -if (!isset($globalMinFetch)) $globalMinFetch = 15; |
|
| 404 | +if (!isset($globalMinFetch)) { |
|
| 405 | + $globalMinFetch = 15; |
|
| 406 | +} |
|
| 314 | 407 | |
| 315 | 408 | // Initialize all |
| 316 | 409 | $status = array(); |
@@ -319,13 +412,19 @@ discard block |
||
| 319 | 412 | $formats = array(); |
| 320 | 413 | $last_exec = array(); |
| 321 | 414 | $time = time(); |
| 322 | -if (isset($globalSourcesTimeout)) $timeout = $globalSourcesTimeOut; |
|
| 323 | -else if (isset($globalSBS1TimeOut)) $timeout = $globalSBS1TimeOut; |
|
| 324 | -else $timeout = 20; |
|
| 415 | +if (isset($globalSourcesTimeout)) { |
|
| 416 | + $timeout = $globalSourcesTimeOut; |
|
| 417 | +} else if (isset($globalSBS1TimeOut)) { |
|
| 418 | + $timeout = $globalSBS1TimeOut; |
|
| 419 | +} else { |
|
| 420 | + $timeout = 20; |
|
| 421 | +} |
|
| 325 | 422 | $errno = ''; |
| 326 | 423 | $errstr=''; |
| 327 | 424 | |
| 328 | -if (!isset($globalDaemon)) $globalDaemon = TRUE; |
|
| 425 | +if (!isset($globalDaemon)) { |
|
| 426 | + $globalDaemon = TRUE; |
|
| 427 | +} |
|
| 329 | 428 | /* Initiate connections to all the hosts simultaneously */ |
| 330 | 429 | //connect_all($hosts); |
| 331 | 430 | //connect_all($globalSources); |
@@ -354,7 +453,9 @@ discard block |
||
| 354 | 453 | if (isset($source['format']) && $source['format'] == 'aprs') { |
| 355 | 454 | $aprs_connect = 0; |
| 356 | 455 | $use_aprs = true; |
| 357 | - if (isset($source['port']) && $source['port'] == '10152') $aprs_full = true; |
|
| 456 | + if (isset($source['port']) && $source['port'] == '10152') { |
|
| 457 | + $aprs_full = true; |
|
| 458 | + } |
|
| 358 | 459 | break; |
| 359 | 460 | } |
| 360 | 461 | } |
@@ -365,25 +466,46 @@ discard block |
||
| 365 | 466 | $aprs_connect = 0; |
| 366 | 467 | $aprs_keep = 120; |
| 367 | 468 | $aprs_last_tx = time(); |
| 368 | - if (isset($globalAPRSversion)) $aprs_version = $globalAPRSversion; |
|
| 369 | - else $aprs_version = 'FlightAirMap '.str_replace(' ','_',$globalName); |
|
| 370 | - if (isset($globalAPRSssid)) $aprs_ssid = $globalAPRSssid; |
|
| 371 | - else $aprs_ssid = substr('FAM'.strtoupper(str_replace(' ','_',$globalName)),0,8); |
|
| 372 | - if (isset($globalAPRSfilter)) $aprs_filter = $globalAPRSfilter; |
|
| 373 | - else $aprs_filter = 'r/'.$globalCenterLatitude.'/'.$globalCenterLongitude.'/250.0'; |
|
| 374 | - if ($aprs_full) $aprs_filter = ''; |
|
| 375 | - if (isset($globalAPRSpass)) $aprs_pass = $globalAPRSpass; |
|
| 376 | - else $aprs_pass = '-1'; |
|
| 469 | + if (isset($globalAPRSversion)) { |
|
| 470 | + $aprs_version = $globalAPRSversion; |
|
| 471 | + } else { |
|
| 472 | + $aprs_version = 'FlightAirMap '.str_replace(' ','_',$globalName); |
|
| 473 | + } |
|
| 474 | + if (isset($globalAPRSssid)) { |
|
| 475 | + $aprs_ssid = $globalAPRSssid; |
|
| 476 | + } else { |
|
| 477 | + $aprs_ssid = substr('FAM'.strtoupper(str_replace(' ','_',$globalName)),0,8); |
|
| 478 | + } |
|
| 479 | + if (isset($globalAPRSfilter)) { |
|
| 480 | + $aprs_filter = $globalAPRSfilter; |
|
| 481 | + } else { |
|
| 482 | + $aprs_filter = 'r/'.$globalCenterLatitude.'/'.$globalCenterLongitude.'/250.0'; |
|
| 483 | + } |
|
| 484 | + if ($aprs_full) { |
|
| 485 | + $aprs_filter = ''; |
|
| 486 | + } |
|
| 487 | + if (isset($globalAPRSpass)) { |
|
| 488 | + $aprs_pass = $globalAPRSpass; |
|
| 489 | + } else { |
|
| 490 | + $aprs_pass = '-1'; |
|
| 491 | + } |
|
| 377 | 492 | |
| 378 | - if ($aprs_filter != '') $aprs_login = "user {$aprs_ssid} pass {$aprs_pass} vers {$aprs_version} filter {$aprs_filter}\n"; |
|
| 379 | - else $aprs_login = "user {$aprs_ssid} pass {$aprs_pass} vers {$aprs_version}\n"; |
|
| 380 | -} |
|
| 493 | + if ($aprs_filter != '') { |
|
| 494 | + $aprs_login = "user {$aprs_ssid} pass {$aprs_pass} vers {$aprs_version} filter {$aprs_filter}\n"; |
|
| 495 | + } else { |
|
| 496 | + $aprs_login = "user {$aprs_ssid} pass {$aprs_pass} vers {$aprs_version}\n"; |
|
| 497 | + } |
|
| 498 | + } |
|
| 381 | 499 | |
| 382 | 500 | // connected - lets do some work |
| 383 | 501 | //if ($globalDebug) echo "Connected!\n"; |
| 384 | 502 | sleep(1); |
| 385 | -if ($globalDebug) echo "SCAN MODE \n\n"; |
|
| 386 | -if (!isset($globalCronEnd)) $globalCronEnd = 60; |
|
| 503 | +if ($globalDebug) { |
|
| 504 | + echo "SCAN MODE \n\n"; |
|
| 505 | +} |
|
| 506 | +if (!isset($globalCronEnd)) { |
|
| 507 | + $globalCronEnd = 60; |
|
| 508 | +} |
|
| 387 | 509 | $endtime = time()+$globalCronEnd; |
| 388 | 510 | $i = 1; |
| 389 | 511 | $tt = array(); |
@@ -397,20 +519,28 @@ discard block |
||
| 397 | 519 | |
| 398 | 520 | // Infinite loop if daemon, else work for time defined in $globalCronEnd or only one time. |
| 399 | 521 | while ($i > 0) { |
| 400 | - if (!$globalDaemon) $i = $endtime-time(); |
|
| 522 | + if (!$globalDaemon) { |
|
| 523 | + $i = $endtime-time(); |
|
| 524 | + } |
|
| 401 | 525 | // Delete old ATC |
| 402 | 526 | if ($globalDaemon && ((isset($globalVA) && $globalVA) || (isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM))) { |
| 403 | - if ($globalDebug) echo 'Delete old ATC...'."\n"; |
|
| 527 | + if ($globalDebug) { |
|
| 528 | + echo 'Delete old ATC...'."\n"; |
|
| 529 | + } |
|
| 404 | 530 | $ATC->deleteOldATC(); |
| 405 | 531 | } |
| 406 | 532 | |
| 407 | 533 | if (count($last_exec) == count($globalSources)) { |
| 408 | 534 | $max = $globalMinFetch; |
| 409 | 535 | foreach ($last_exec as $last) { |
| 410 | - if ((time() - $last['last']) < $max) $max = time() - $last['last']; |
|
| 536 | + if ((time() - $last['last']) < $max) { |
|
| 537 | + $max = time() - $last['last']; |
|
| 538 | + } |
|
| 411 | 539 | } |
| 412 | 540 | if ($max != $globalMinFetch) { |
| 413 | - if ($globalDebug) echo 'Sleeping...'."\n"; |
|
| 541 | + if ($globalDebug) { |
|
| 542 | + echo 'Sleeping...'."\n"; |
|
| 543 | + } |
|
| 414 | 544 | sleep($globalMinFetch-$max+2); |
| 415 | 545 | } |
| 416 | 546 | } |
@@ -420,7 +550,9 @@ discard block |
||
| 420 | 550 | foreach ($globalSources as $id => $value) { |
| 421 | 551 | date_default_timezone_set('UTC'); |
| 422 | 552 | //if ($globalDebug) echo 'Source host : '.$value['host'].' - Source format: '.$value['format']."\n"; |
| 423 | - if (!isset($last_exec[$id]['last'])) $last_exec[$id]['last'] = 0; |
|
| 553 | + if (!isset($last_exec[$id]['last'])) { |
|
| 554 | + $last_exec[$id]['last'] = 0; |
|
| 555 | + } |
|
| 424 | 556 | if ($value['format'] == 'deltadbtxt' && |
| 425 | 557 | ( |
| 426 | 558 | (isset($globalSources[$id]['minfetch']) && (time() - $last_exec[$id]['last'] > $globalSources[$id]['minfetch'])) || |
@@ -429,7 +561,9 @@ discard block |
||
| 429 | 561 | ) { |
| 430 | 562 | //$buffer = $Common->getData($hosts[$id]); |
| 431 | 563 | $buffer = $Common->getData($value['host']); |
| 432 | - if ($buffer != '') $reset = 0; |
|
| 564 | + if ($buffer != '') { |
|
| 565 | + $reset = 0; |
|
| 566 | + } |
|
| 433 | 567 | $buffer=trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'\n',$buffer)); |
| 434 | 568 | $buffer = explode('\n',$buffer); |
| 435 | 569 | foreach ($buffer as $line) { |
@@ -438,20 +572,41 @@ discard block |
||
| 438 | 572 | $data = array(); |
| 439 | 573 | $data['hex'] = $line[1]; // hex |
| 440 | 574 | $data['ident'] = $line[2]; // ident |
| 441 | - if (isset($line[3])) $data['altitude'] = $line[3]; // altitude |
|
| 442 | - if (isset($line[4])) $data['speed'] = $line[4]; // speed |
|
| 443 | - if (isset($line[5])) $data['heading'] = $line[5]; // heading |
|
| 444 | - if (isset($line[6])) $data['latitude'] = $line[6]; // lat |
|
| 445 | - if (isset($line[7])) $data['longitude'] = $line[7]; // long |
|
| 575 | + if (isset($line[3])) { |
|
| 576 | + $data['altitude'] = $line[3]; |
|
| 577 | + } |
|
| 578 | + // altitude |
|
| 579 | + if (isset($line[4])) { |
|
| 580 | + $data['speed'] = $line[4]; |
|
| 581 | + } |
|
| 582 | + // speed |
|
| 583 | + if (isset($line[5])) { |
|
| 584 | + $data['heading'] = $line[5]; |
|
| 585 | + } |
|
| 586 | + // heading |
|
| 587 | + if (isset($line[6])) { |
|
| 588 | + $data['latitude'] = $line[6]; |
|
| 589 | + } |
|
| 590 | + // lat |
|
| 591 | + if (isset($line[7])) { |
|
| 592 | + $data['longitude'] = $line[7]; |
|
| 593 | + } |
|
| 594 | + // long |
|
| 446 | 595 | $data['verticalrate'] = ''; // vertical rate |
| 447 | 596 | //if (isset($line[9])) $data['squawk'] = $line[9]; // squawk |
| 448 | 597 | $data['emergency'] = ''; // emergency |
| 449 | 598 | $data['datetime'] = date('Y-m-d H:i:s'); |
| 450 | 599 | $data['format_source'] = 'deltadbtxt'; |
| 451 | 600 | $data['id_source'] = $id_source; |
| 452 | - if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name']; |
|
| 453 | - if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true; |
|
| 454 | - if (isset($value['sourcestats'])) $data['sourcestats'] = $value['sourcestats']; |
|
| 601 | + if (isset($value['name']) && $value['name'] != '') { |
|
| 602 | + $data['source_name'] = $value['name']; |
|
| 603 | + } |
|
| 604 | + if (isset($value['noarchive']) && $value['noarchive'] === TRUE) { |
|
| 605 | + $data['noarchive'] = true; |
|
| 606 | + } |
|
| 607 | + if (isset($value['sourcestats'])) { |
|
| 608 | + $data['sourcestats'] = $value['sourcestats']; |
|
| 609 | + } |
|
| 455 | 610 | $SI->add($data); |
| 456 | 611 | unset($data); |
| 457 | 612 | } |
@@ -466,7 +621,9 @@ discard block |
||
| 466 | 621 | date_default_timezone_set('CET'); |
| 467 | 622 | $buffer = $Common->getData(str_replace('{date}',date('Ymd'),$value['host'])); |
| 468 | 623 | date_default_timezone_set('UTC'); |
| 469 | - if ($buffer != '') $reset = 0; |
|
| 624 | + if ($buffer != '') { |
|
| 625 | + $reset = 0; |
|
| 626 | + } |
|
| 470 | 627 | $buffer=trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'\n',$buffer)); |
| 471 | 628 | $buffer = explode('\n',$buffer); |
| 472 | 629 | foreach ($buffer as $line) { |
@@ -475,16 +632,36 @@ discard block |
||
| 475 | 632 | $add = false; |
| 476 | 633 | $ais_data = $AIS->parse_line(trim($line)); |
| 477 | 634 | $data = array(); |
| 478 | - if (isset($ais_data['ident'])) $data['ident'] = $ais_data['ident']; |
|
| 479 | - if (isset($ais_data['mmsi'])) $data['mmsi'] = $ais_data['mmsi']; |
|
| 480 | - if (isset($ais_data['speed'])) $data['speed'] = $ais_data['speed']; |
|
| 481 | - if (isset($ais_data['heading'])) $data['heading'] = $ais_data['heading']; |
|
| 482 | - if (isset($ais_data['latitude'])) $data['latitude'] = $ais_data['latitude']; |
|
| 483 | - if (isset($ais_data['longitude'])) $data['longitude'] = $ais_data['longitude']; |
|
| 484 | - if (isset($ais_data['status'])) $data['status'] = $ais_data['status']; |
|
| 485 | - if (isset($ais_data['type'])) $data['type'] = $ais_data['type']; |
|
| 486 | - if (isset($ais_data['imo'])) $data['imo'] = $ais_data['imo']; |
|
| 487 | - if (isset($ais_data['callsign'])) $data['callsign'] = $ais_data['callsign']; |
|
| 635 | + if (isset($ais_data['ident'])) { |
|
| 636 | + $data['ident'] = $ais_data['ident']; |
|
| 637 | + } |
|
| 638 | + if (isset($ais_data['mmsi'])) { |
|
| 639 | + $data['mmsi'] = $ais_data['mmsi']; |
|
| 640 | + } |
|
| 641 | + if (isset($ais_data['speed'])) { |
|
| 642 | + $data['speed'] = $ais_data['speed']; |
|
| 643 | + } |
|
| 644 | + if (isset($ais_data['heading'])) { |
|
| 645 | + $data['heading'] = $ais_data['heading']; |
|
| 646 | + } |
|
| 647 | + if (isset($ais_data['latitude'])) { |
|
| 648 | + $data['latitude'] = $ais_data['latitude']; |
|
| 649 | + } |
|
| 650 | + if (isset($ais_data['longitude'])) { |
|
| 651 | + $data['longitude'] = $ais_data['longitude']; |
|
| 652 | + } |
|
| 653 | + if (isset($ais_data['status'])) { |
|
| 654 | + $data['status'] = $ais_data['status']; |
|
| 655 | + } |
|
| 656 | + if (isset($ais_data['type'])) { |
|
| 657 | + $data['type'] = $ais_data['type']; |
|
| 658 | + } |
|
| 659 | + if (isset($ais_data['imo'])) { |
|
| 660 | + $data['imo'] = $ais_data['imo']; |
|
| 661 | + } |
|
| 662 | + if (isset($ais_data['callsign'])) { |
|
| 663 | + $data['callsign'] = $ais_data['callsign']; |
|
| 664 | + } |
|
| 488 | 665 | if (isset($ais_data['timestamp'])) { |
| 489 | 666 | $data['datetime'] = date('Y-m-d H:i:s',$ais_data['timestamp']); |
| 490 | 667 | if (!isset($last_exec[$id]['timestamp']) || $ais_data['timestamp'] >= $last_exec[$id]['timestamp']) { |
@@ -498,8 +675,12 @@ discard block |
||
| 498 | 675 | $data['format_source'] = 'aisnmeatxt'; |
| 499 | 676 | $data['id_source'] = $id_source; |
| 500 | 677 | //print_r($data); |
| 501 | - if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true; |
|
| 502 | - if ($add && isset($ais_data['mmsi_type']) && $ais_data['mmsi_type'] == 'Ship') $MI->add($data); |
|
| 678 | + if (isset($value['noarchive']) && $value['noarchive'] === TRUE) { |
|
| 679 | + $data['noarchive'] = true; |
|
| 680 | + } |
|
| 681 | + if ($add && isset($ais_data['mmsi_type']) && $ais_data['mmsi_type'] == 'Ship') { |
|
| 682 | + $MI->add($data); |
|
| 683 | + } |
|
| 503 | 684 | unset($data); |
| 504 | 685 | } |
| 505 | 686 | } |
@@ -522,20 +703,48 @@ discard block |
||
| 522 | 703 | if ($line != '') { |
| 523 | 704 | $ais_data = $AIS->parse_line(trim($line)); |
| 524 | 705 | $data = array(); |
| 525 | - if (isset($ais_data['ident'])) $data['ident'] = $ais_data['ident']; |
|
| 526 | - if (isset($ais_data['mmsi'])) $data['mmsi'] = $ais_data['mmsi']; |
|
| 527 | - if (isset($ais_data['speed'])) $data['speed'] = $ais_data['speed']; |
|
| 528 | - if (isset($ais_data['heading'])) $data['heading'] = $ais_data['heading']; |
|
| 529 | - if (isset($ais_data['latitude'])) $data['latitude'] = $ais_data['latitude']; |
|
| 530 | - if (isset($ais_data['longitude'])) $data['longitude'] = $ais_data['longitude']; |
|
| 531 | - if (isset($ais_data['status'])) $data['status'] = $ais_data['status']; |
|
| 532 | - if (isset($ais_data['statusid'])) $data['status_id'] = $ais_data['statusid']; |
|
| 533 | - if (isset($ais_data['type'])) $data['type'] = $ais_data['type']; |
|
| 534 | - if (isset($ais_data['typeid'])) $data['type_id'] = $ais_data['typeid']; |
|
| 535 | - if (isset($ais_data['imo'])) $data['imo'] = $ais_data['imo']; |
|
| 536 | - if (isset($ais_data['callsign'])) $data['callsign'] = $ais_data['callsign']; |
|
| 537 | - if (isset($ais_data['destination'])) $data['arrival_code'] = $ais_data['destination']; |
|
| 538 | - if (isset($ais_data['eta_ts'])) $data['arrival_date'] = date('Y-m-d H:i:s',$ais_data['eta_ts']); |
|
| 706 | + if (isset($ais_data['ident'])) { |
|
| 707 | + $data['ident'] = $ais_data['ident']; |
|
| 708 | + } |
|
| 709 | + if (isset($ais_data['mmsi'])) { |
|
| 710 | + $data['mmsi'] = $ais_data['mmsi']; |
|
| 711 | + } |
|
| 712 | + if (isset($ais_data['speed'])) { |
|
| 713 | + $data['speed'] = $ais_data['speed']; |
|
| 714 | + } |
|
| 715 | + if (isset($ais_data['heading'])) { |
|
| 716 | + $data['heading'] = $ais_data['heading']; |
|
| 717 | + } |
|
| 718 | + if (isset($ais_data['latitude'])) { |
|
| 719 | + $data['latitude'] = $ais_data['latitude']; |
|
| 720 | + } |
|
| 721 | + if (isset($ais_data['longitude'])) { |
|
| 722 | + $data['longitude'] = $ais_data['longitude']; |
|
| 723 | + } |
|
| 724 | + if (isset($ais_data['status'])) { |
|
| 725 | + $data['status'] = $ais_data['status']; |
|
| 726 | + } |
|
| 727 | + if (isset($ais_data['statusid'])) { |
|
| 728 | + $data['status_id'] = $ais_data['statusid']; |
|
| 729 | + } |
|
| 730 | + if (isset($ais_data['type'])) { |
|
| 731 | + $data['type'] = $ais_data['type']; |
|
| 732 | + } |
|
| 733 | + if (isset($ais_data['typeid'])) { |
|
| 734 | + $data['type_id'] = $ais_data['typeid']; |
|
| 735 | + } |
|
| 736 | + if (isset($ais_data['imo'])) { |
|
| 737 | + $data['imo'] = $ais_data['imo']; |
|
| 738 | + } |
|
| 739 | + if (isset($ais_data['callsign'])) { |
|
| 740 | + $data['callsign'] = $ais_data['callsign']; |
|
| 741 | + } |
|
| 742 | + if (isset($ais_data['destination'])) { |
|
| 743 | + $data['arrival_code'] = $ais_data['destination']; |
|
| 744 | + } |
|
| 745 | + if (isset($ais_data['eta_ts'])) { |
|
| 746 | + $data['arrival_date'] = date('Y-m-d H:i:s',$ais_data['eta_ts']); |
|
| 747 | + } |
|
| 539 | 748 | if (isset($ais_data['timestamp'])) { |
| 540 | 749 | $data['datetime'] = date('Y-m-d H:i:s',$ais_data['timestamp']); |
| 541 | 750 | } else { |
@@ -543,18 +752,27 @@ discard block |
||
| 543 | 752 | } |
| 544 | 753 | $data['format_source'] = 'aisnmeahttp'; |
| 545 | 754 | $data['id_source'] = $id_source; |
| 546 | - if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true; |
|
| 547 | - if (isset($ais_data['mmsi_type']) && $ais_data['mmsi_type'] == 'Ship') $MI->add($data); |
|
| 755 | + if (isset($value['noarchive']) && $value['noarchive'] === TRUE) { |
|
| 756 | + $data['noarchive'] = true; |
|
| 757 | + } |
|
| 758 | + if (isset($ais_data['mmsi_type']) && $ais_data['mmsi_type'] == 'Ship') { |
|
| 759 | + $MI->add($data); |
|
| 760 | + } |
|
| 548 | 761 | unset($data); |
| 549 | 762 | } |
| 550 | 763 | } |
| 551 | 764 | } |
| 552 | 765 | } else { |
| 553 | 766 | $format = $value['format']; |
| 554 | - if (isset($tt[$format])) $tt[$format]++; |
|
| 555 | - else $tt[$format] = 0; |
|
| 767 | + if (isset($tt[$format])) { |
|
| 768 | + $tt[$format]++; |
|
| 769 | + } else { |
|
| 770 | + $tt[$format] = 0; |
|
| 771 | + } |
|
| 556 | 772 | if ($tt[$format] > 30) { |
| 557 | - if ($globalDebug) echo 'Reconnect...'."\n"; |
|
| 773 | + if ($globalDebug) { |
|
| 774 | + echo 'Reconnect...'."\n"; |
|
| 775 | + } |
|
| 558 | 776 | sleep(2); |
| 559 | 777 | //$sourceeen[] = $value; |
| 560 | 778 | //connect_all($sourceeen); |
@@ -593,7 +811,9 @@ discard block |
||
| 593 | 811 | $data['datetime'] = date('Y-m-d H:i:s',$line['T']); |
| 594 | 812 | $data['format_source'] = 'myshiptracking'; |
| 595 | 813 | $data['id_source'] = $id_source; |
| 596 | - if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true; |
|
| 814 | + if (isset($value['noarchive']) && $value['noarchive'] === TRUE) { |
|
| 815 | + $data['noarchive'] = true; |
|
| 816 | + } |
|
| 597 | 817 | $MI->add($data); |
| 598 | 818 | unset($data); |
| 599 | 819 | } |
@@ -618,7 +838,9 @@ discard block |
||
| 618 | 838 | $data['callsign'] = $line['callsign']; |
| 619 | 839 | $data['mmsi'] = $line['mmsi']; |
| 620 | 840 | $data['speed'] = $line['sog']; |
| 621 | - if ($line['heading'] != '511') $data['heading'] = $line['heading']; |
|
| 841 | + if ($line['heading'] != '511') { |
|
| 842 | + $data['heading'] = $line['heading']; |
|
| 843 | + } |
|
| 622 | 844 | $data['latitude'] = $line['latitude']; |
| 623 | 845 | $data['longitude'] = $line['longitude']; |
| 624 | 846 | $data['type_id'] = $line['shiptype']; |
@@ -626,7 +848,9 @@ discard block |
||
| 626 | 848 | $data['datetime'] = $line['time']; |
| 627 | 849 | $data['format_source'] = 'boatbeaconapp'; |
| 628 | 850 | $data['id_source'] = $id_source; |
| 629 | - if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true; |
|
| 851 | + if (isset($value['noarchive']) && $value['noarchive'] === TRUE) { |
|
| 852 | + $data['noarchive'] = true; |
|
| 853 | + } |
|
| 630 | 854 | $MI->add($data); |
| 631 | 855 | unset($data); |
| 632 | 856 | } |
@@ -647,22 +871,44 @@ discard block |
||
| 647 | 871 | if (isset($all_data['features'][0]['id'])) { |
| 648 | 872 | foreach ($all_data['features'] as $line) { |
| 649 | 873 | $data = array(); |
| 650 | - if (isset($line['properties']['name'])) $data['ident'] = $line['properties']['name']; |
|
| 651 | - if (isset($line['properties']['callsign'])) $data['callsign'] = $line['properties']['callsign']; |
|
| 652 | - if (isset($line['properties']['mmsi'])) $data['mmsi'] = $line['properties']['mmsi']; |
|
| 653 | - if (isset($line['properties']['imo'])) $data['mmsi'] = $line['properties']['imo']; |
|
| 654 | - if (isset($line['properties']['speed'])) $data['speed'] = $line['properties']['speed']; |
|
| 655 | - if (isset($line['properties']['heading'])) $data['heading'] = $line['properties']['heading']; |
|
| 874 | + if (isset($line['properties']['name'])) { |
|
| 875 | + $data['ident'] = $line['properties']['name']; |
|
| 876 | + } |
|
| 877 | + if (isset($line['properties']['callsign'])) { |
|
| 878 | + $data['callsign'] = $line['properties']['callsign']; |
|
| 879 | + } |
|
| 880 | + if (isset($line['properties']['mmsi'])) { |
|
| 881 | + $data['mmsi'] = $line['properties']['mmsi']; |
|
| 882 | + } |
|
| 883 | + if (isset($line['properties']['imo'])) { |
|
| 884 | + $data['mmsi'] = $line['properties']['imo']; |
|
| 885 | + } |
|
| 886 | + if (isset($line['properties']['speed'])) { |
|
| 887 | + $data['speed'] = $line['properties']['speed']; |
|
| 888 | + } |
|
| 889 | + if (isset($line['properties']['heading'])) { |
|
| 890 | + $data['heading'] = $line['properties']['heading']; |
|
| 891 | + } |
|
| 656 | 892 | $data['latitude'] = $line['geometry']['coordinates'][1]; |
| 657 | 893 | $data['longitude'] = $line['geometry']['coordinates'][0]; |
| 658 | - if (isset($line['properties']['vesselType'])) $data['type'] = $line['properties']['vesselType']; |
|
| 659 | - if (isset($line['properties']['destination'])) $data['arrival_code'] = $line['properties']['destination']; |
|
| 660 | - if (isset($line['properties']['eta']) && $line['properties']['eta'] != '') $data['arrival_date'] = $line['properties']['eta']; |
|
| 894 | + if (isset($line['properties']['vesselType'])) { |
|
| 895 | + $data['type'] = $line['properties']['vesselType']; |
|
| 896 | + } |
|
| 897 | + if (isset($line['properties']['destination'])) { |
|
| 898 | + $data['arrival_code'] = $line['properties']['destination']; |
|
| 899 | + } |
|
| 900 | + if (isset($line['properties']['eta']) && $line['properties']['eta'] != '') { |
|
| 901 | + $data['arrival_date'] = $line['properties']['eta']; |
|
| 902 | + } |
|
| 661 | 903 | $data['format_source'] = 'boatnerd'; |
| 662 | 904 | $data['id_source'] = $id_source; |
| 663 | 905 | $data['datetime'] = date('Y-m-d H:i:s'); |
| 664 | - if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true; |
|
| 665 | - if ($line['properties']['vesselType'] != 'Navigation Aid') $MI->add($data); |
|
| 906 | + if (isset($value['noarchive']) && $value['noarchive'] === TRUE) { |
|
| 907 | + $data['noarchive'] = true; |
|
| 908 | + } |
|
| 909 | + if ($line['properties']['vesselType'] != 'Navigation Aid') { |
|
| 910 | + $MI->add($data); |
|
| 911 | + } |
|
| 666 | 912 | unset($data); |
| 667 | 913 | } |
| 668 | 914 | } |
@@ -678,7 +924,9 @@ discard block |
||
| 678 | 924 | echo 'download...'; |
| 679 | 925 | $buffer = $Common->getData($value['host'],'post',$value['post'],'','','','','ShipPlotter'); |
| 680 | 926 | echo 'done !'."\n"; |
| 681 | - if ($buffer != '') $reset = 0; |
|
| 927 | + if ($buffer != '') { |
|
| 928 | + $reset = 0; |
|
| 929 | + } |
|
| 682 | 930 | $buffer=trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'\n',$buffer)); |
| 683 | 931 | $buffer = explode('\n',$buffer); |
| 684 | 932 | foreach ($buffer as $line) { |
@@ -703,7 +951,9 @@ discard block |
||
| 703 | 951 | //$data['etaTime'] = substr($line,135,5); |
| 704 | 952 | $data['format_source'] = 'shipplotter'; |
| 705 | 953 | $data['id_source'] = $id_source; |
| 706 | - if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true; |
|
| 954 | + if (isset($value['noarchive']) && $value['noarchive'] === TRUE) { |
|
| 955 | + $data['noarchive'] = true; |
|
| 956 | + } |
|
| 707 | 957 | //print_r($data); |
| 708 | 958 | echo 'Add...'."\n"; |
| 709 | 959 | $MI->add($data); |
@@ -737,16 +987,28 @@ discard block |
||
| 737 | 987 | $line = explode(':', $line); |
| 738 | 988 | if (count($line) > 30 && $line[0] != 'callsign') { |
| 739 | 989 | $data = array(); |
| 740 | - if (isset($line[37]) && $line[37] != '') $data['id'] = $value['format'].'-'.$line[1].'-'.$line[0].'-'.$line[37]; |
|
| 741 | - else $data['id'] = $value['format'].'-'.$line[1].'-'.$line[0]; |
|
| 990 | + if (isset($line[37]) && $line[37] != '') { |
|
| 991 | + $data['id'] = $value['format'].'-'.$line[1].'-'.$line[0].'-'.$line[37]; |
|
| 992 | + } else { |
|
| 993 | + $data['id'] = $value['format'].'-'.$line[1].'-'.$line[0]; |
|
| 994 | + } |
|
| 742 | 995 | $data['pilot_id'] = $line[1]; |
| 743 | 996 | $data['pilot_name'] = $line[2]; |
| 744 | 997 | $data['hex'] = str_pad(dechex($Common->str2int($line[1])),6,'000000',STR_PAD_LEFT); |
| 745 | 998 | $data['ident'] = $line[0]; // ident |
| 746 | - if ($line[7] != '' && $line[7] != 0) $data['altitude'] = $line[7]; // altitude |
|
| 999 | + if ($line[7] != '' && $line[7] != 0) { |
|
| 1000 | + $data['altitude'] = $line[7]; |
|
| 1001 | + } |
|
| 1002 | + // altitude |
|
| 747 | 1003 | $data['speed'] = $line[8]; // speed |
| 748 | - if (isset($line[45])) $data['heading'] = $line[45]; // heading |
|
| 749 | - elseif (isset($line[38])) $data['heading'] = $line[38]; // heading |
|
| 1004 | + if (isset($line[45])) { |
|
| 1005 | + $data['heading'] = $line[45]; |
|
| 1006 | + } |
|
| 1007 | + // heading |
|
| 1008 | + elseif (isset($line[38])) { |
|
| 1009 | + $data['heading'] = $line[38]; |
|
| 1010 | + } |
|
| 1011 | + // heading |
|
| 750 | 1012 | $data['latitude'] = $line[5]; // lat |
| 751 | 1013 | $data['longitude'] = $line[6]; // long |
| 752 | 1014 | $data['verticalrate'] = ''; // vertical rate |
@@ -762,7 +1024,9 @@ discard block |
||
| 762 | 1024 | $data['frequency'] = $line[4]; |
| 763 | 1025 | $data['type'] = $line[18]; |
| 764 | 1026 | $data['range'] = $line[19]; |
| 765 | - if (isset($line[35])) $data['info'] = $line[35]; |
|
| 1027 | + if (isset($line[35])) { |
|
| 1028 | + $data['info'] = $line[35]; |
|
| 1029 | + } |
|
| 766 | 1030 | $data['id_source'] = $id_source; |
| 767 | 1031 | //$data['arrival_airport_time'] = ; |
| 768 | 1032 | if ($line[9] != '') { |
@@ -776,27 +1040,47 @@ discard block |
||
| 776 | 1040 | elseif ($value == 'vatsimtxt') $data['format_source'] = 'vatsimtxt'; |
| 777 | 1041 | */ |
| 778 | 1042 | $data['format_source'] = $value['format']; |
| 779 | - if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true; |
|
| 780 | - if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name']; |
|
| 781 | - if ($line[3] == 'PILOT') $SI->add($data); |
|
| 782 | - elseif ($line[3] == 'ATC') { |
|
| 1043 | + if (isset($value['noarchive']) && $value['noarchive'] === TRUE) { |
|
| 1044 | + $data['noarchive'] = true; |
|
| 1045 | + } |
|
| 1046 | + if (isset($value['name']) && $value['name'] != '') { |
|
| 1047 | + $data['source_name'] = $value['name']; |
|
| 1048 | + } |
|
| 1049 | + if ($line[3] == 'PILOT') { |
|
| 1050 | + $SI->add($data); |
|
| 1051 | + } elseif ($line[3] == 'ATC') { |
|
| 783 | 1052 | //print_r($data); |
| 784 | 1053 | $data['info'] = str_replace('^§','<br />',$data['info']); |
| 785 | 1054 | $data['info'] = str_replace('&sect;','',$data['info']); |
| 786 | 1055 | $typec = substr($data['ident'],-3); |
| 787 | - if ($typec == 'APP') $data['type'] = 'Approach'; |
|
| 788 | - elseif ($typec == 'TWR') $data['type'] = 'Tower'; |
|
| 789 | - elseif ($typec == 'OBS') $data['type'] = 'Observer'; |
|
| 790 | - elseif ($typec == 'GND') $data['type'] = 'Ground'; |
|
| 791 | - elseif ($typec == 'DEL') $data['type'] = 'Delivery'; |
|
| 792 | - elseif ($typec == 'DEP') $data['type'] = 'Departure'; |
|
| 793 | - elseif ($typec == 'FSS') $data['type'] = 'Flight Service Station'; |
|
| 794 | - elseif ($typec == 'CTR') $data['type'] = 'Control Radar or Centre'; |
|
| 795 | - elseif ($data['type'] == '') $data['type'] = 'Observer'; |
|
| 796 | - if (!isset($data['source_name'])) $data['source_name'] = ''; |
|
| 1056 | + if ($typec == 'APP') { |
|
| 1057 | + $data['type'] = 'Approach'; |
|
| 1058 | + } elseif ($typec == 'TWR') { |
|
| 1059 | + $data['type'] = 'Tower'; |
|
| 1060 | + } elseif ($typec == 'OBS') { |
|
| 1061 | + $data['type'] = 'Observer'; |
|
| 1062 | + } elseif ($typec == 'GND') { |
|
| 1063 | + $data['type'] = 'Ground'; |
|
| 1064 | + } elseif ($typec == 'DEL') { |
|
| 1065 | + $data['type'] = 'Delivery'; |
|
| 1066 | + } elseif ($typec == 'DEP') { |
|
| 1067 | + $data['type'] = 'Departure'; |
|
| 1068 | + } elseif ($typec == 'FSS') { |
|
| 1069 | + $data['type'] = 'Flight Service Station'; |
|
| 1070 | + } elseif ($typec == 'CTR') { |
|
| 1071 | + $data['type'] = 'Control Radar or Centre'; |
|
| 1072 | + } elseif ($data['type'] == '') { |
|
| 1073 | + $data['type'] = 'Observer'; |
|
| 1074 | + } |
|
| 1075 | + if (!isset($data['source_name'])) { |
|
| 1076 | + $data['source_name'] = ''; |
|
| 1077 | + } |
|
| 797 | 1078 | if (isset($ATC)) { |
| 798 | - 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']); |
|
| 799 | - 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']); |
|
| 1079 | + if (count($ATC->getByIdent($data['ident'],$data['format_source'])) > 0) { |
|
| 1080 | + 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']); |
|
| 1081 | + } else { |
|
| 1082 | + 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']); |
|
| 1083 | + } |
|
| 800 | 1084 | } |
| 801 | 1085 | } |
| 802 | 1086 | unset($data); |
@@ -823,14 +1107,20 @@ discard block |
||
| 823 | 1107 | $data['datetime'] = date('Y-m-d H:i:s',strtotime((string)$line['entryTime'].' BST')); |
| 824 | 1108 | $data['latitude'] = (float)$line['pktLatitude']; |
| 825 | 1109 | $data['longitude'] = (float)$line['pktLongitude']; |
| 826 | - if ((float)$line['pktTrack'] != 0) $data['heading'] = (float)$line['pktTrack']; |
|
| 827 | - if ((int)$line['pktSpeed'] != 0) $data['speed'] = (int)$line['pktSpeed']; |
|
| 1110 | + if ((float)$line['pktTrack'] != 0) { |
|
| 1111 | + $data['heading'] = (float)$line['pktTrack']; |
|
| 1112 | + } |
|
| 1113 | + if ((int)$line['pktSpeed'] != 0) { |
|
| 1114 | + $data['speed'] = (int)$line['pktSpeed']; |
|
| 1115 | + } |
|
| 828 | 1116 | $data['altitude'] = round((int)$line['pktAltitude']*3.28084); |
| 829 | 1117 | $data['altitude_relative'] = 'AMSL'; |
| 830 | 1118 | $data['pilot_id'] = (int)$line['pktPilotID']; |
| 831 | 1119 | $data['aircraft_icao'] = 'PARAGLIDER'; |
| 832 | 1120 | $pilot_data = explode(',',$Common->getData('http://www.airwhere.co.uk/pilotdetails.php?pilot='.$data['pilot_id'])); |
| 833 | - if (isset($pilot_data[4])) $data['pilot_name'] = $pilot_data[4]; |
|
| 1121 | + if (isset($pilot_data[4])) { |
|
| 1122 | + $data['pilot_name'] = $pilot_data[4]; |
|
| 1123 | + } |
|
| 834 | 1124 | $data['format_source'] = $value['format']; |
| 835 | 1125 | $SI->add($data); |
| 836 | 1126 | unset($data); |
@@ -878,25 +1168,59 @@ discard block |
||
| 878 | 1168 | foreach ($all_data['acList'] as $line) { |
| 879 | 1169 | $data = array(); |
| 880 | 1170 | $data['hex'] = $line['Icao']; // hex |
| 881 | - if (isset($line['Call'])) $data['ident'] = $line['Call']; // ident |
|
| 882 | - if (isset($line['Alt'])) $data['altitude'] = $line['Alt']; // altitude |
|
| 883 | - if (isset($line['Spd'])) $data['speed'] = $line['Spd']; // speed |
|
| 884 | - if (isset($line['Trak'])) $data['heading'] = $line['Trak']; // heading |
|
| 885 | - if (isset($line['Lat'])) $data['latitude'] = $line['Lat']; // lat |
|
| 886 | - if (isset($line['Long'])) $data['longitude'] = $line['Long']; // long |
|
| 1171 | + if (isset($line['Call'])) { |
|
| 1172 | + $data['ident'] = $line['Call']; |
|
| 1173 | + } |
|
| 1174 | + // ident |
|
| 1175 | + if (isset($line['Alt'])) { |
|
| 1176 | + $data['altitude'] = $line['Alt']; |
|
| 1177 | + } |
|
| 1178 | + // altitude |
|
| 1179 | + if (isset($line['Spd'])) { |
|
| 1180 | + $data['speed'] = $line['Spd']; |
|
| 1181 | + } |
|
| 1182 | + // speed |
|
| 1183 | + if (isset($line['Trak'])) { |
|
| 1184 | + $data['heading'] = $line['Trak']; |
|
| 1185 | + } |
|
| 1186 | + // heading |
|
| 1187 | + if (isset($line['Lat'])) { |
|
| 1188 | + $data['latitude'] = $line['Lat']; |
|
| 1189 | + } |
|
| 1190 | + // lat |
|
| 1191 | + if (isset($line['Long'])) { |
|
| 1192 | + $data['longitude'] = $line['Long']; |
|
| 1193 | + } |
|
| 1194 | + // long |
|
| 887 | 1195 | //$data['verticalrate'] = $line['']; // verticale rate |
| 888 | - if (isset($line['Sqk'])) $data['squawk'] = $line['Sqk']; // squawk |
|
| 1196 | + if (isset($line['Sqk'])) { |
|
| 1197 | + $data['squawk'] = $line['Sqk']; |
|
| 1198 | + } |
|
| 1199 | + // squawk |
|
| 889 | 1200 | $data['emergency'] = ''; // emergency |
| 890 | - if (isset($line['Reg'])) $data['registration'] = $line['Reg']; |
|
| 891 | - if (isset($line['PosTime'])) $data['datetime'] = date('Y-m-d H:i:s',round($line['PosTime']/1000)); |
|
| 892 | - else $data['datetime'] = date('Y-m-d H:i:s'); |
|
| 1201 | + if (isset($line['Reg'])) { |
|
| 1202 | + $data['registration'] = $line['Reg']; |
|
| 1203 | + } |
|
| 1204 | + if (isset($line['PosTime'])) { |
|
| 1205 | + $data['datetime'] = date('Y-m-d H:i:s',round($line['PosTime']/1000)); |
|
| 1206 | + } else { |
|
| 1207 | + $data['datetime'] = date('Y-m-d H:i:s'); |
|
| 1208 | + } |
|
| 893 | 1209 | //$data['datetime'] = date('Y-m-d H:i:s'); |
| 894 | - if (isset($line['Type'])) $data['aircraft_icao'] = $line['Type']; |
|
| 1210 | + if (isset($line['Type'])) { |
|
| 1211 | + $data['aircraft_icao'] = $line['Type']; |
|
| 1212 | + } |
|
| 895 | 1213 | $data['format_source'] = 'aircraftlistjson'; |
| 896 | 1214 | $data['id_source'] = $id_source; |
| 897 | - if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name']; |
|
| 898 | - if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true; |
|
| 899 | - if (isset($data['latitude'])) $SI->add($data); |
|
| 1215 | + if (isset($value['name']) && $value['name'] != '') { |
|
| 1216 | + $data['source_name'] = $value['name']; |
|
| 1217 | + } |
|
| 1218 | + if (isset($value['noarchive']) && $value['noarchive'] === TRUE) { |
|
| 1219 | + $data['noarchive'] = true; |
|
| 1220 | + } |
|
| 1221 | + if (isset($data['latitude'])) { |
|
| 1222 | + $SI->add($data); |
|
| 1223 | + } |
|
| 900 | 1224 | unset($data); |
| 901 | 1225 | } |
| 902 | 1226 | } elseif (is_array($all_data)) { |
@@ -913,17 +1237,26 @@ discard block |
||
| 913 | 1237 | $data['verticalrate'] = $line['vrt']; // verticale rate |
| 914 | 1238 | $data['squawk'] = $line['squawk']; // squawk |
| 915 | 1239 | $data['emergency'] = ''; // emergency |
| 916 | - if (isset($line['PosTime'])) $data['datetime'] = date('Y-m-d H:i:s',round($line['PosTime']/1000)); |
|
| 917 | - else $data['datetime'] = date('Y-m-d H:i:s'); |
|
| 1240 | + if (isset($line['PosTime'])) { |
|
| 1241 | + $data['datetime'] = date('Y-m-d H:i:s',round($line['PosTime']/1000)); |
|
| 1242 | + } else { |
|
| 1243 | + $data['datetime'] = date('Y-m-d H:i:s'); |
|
| 1244 | + } |
|
| 918 | 1245 | $data['format_source'] = 'aircraftlistjson'; |
| 919 | 1246 | $data['id_source'] = $id_source; |
| 920 | - if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true; |
|
| 921 | - if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name']; |
|
| 1247 | + if (isset($value['noarchive']) && $value['noarchive'] === TRUE) { |
|
| 1248 | + $data['noarchive'] = true; |
|
| 1249 | + } |
|
| 1250 | + if (isset($value['name']) && $value['name'] != '') { |
|
| 1251 | + $data['source_name'] = $value['name']; |
|
| 1252 | + } |
|
| 922 | 1253 | $SI->add($data); |
| 923 | 1254 | unset($data); |
| 924 | 1255 | } |
| 925 | 1256 | } |
| 926 | - } elseif ($globalDebug) echo 'No data'."\n"; |
|
| 1257 | + } elseif ($globalDebug) { |
|
| 1258 | + echo 'No data'."\n"; |
|
| 1259 | + } |
|
| 927 | 1260 | //$last_exec['aircraftlistjson'] = time(); |
| 928 | 1261 | $last_exec[$id]['last'] = time(); |
| 929 | 1262 | //} elseif ($value == 'planeupdatefaa' && (time() - $last_exec['planeupdatefaa'] > $globalMinFetch)) { |
@@ -959,8 +1292,12 @@ discard block |
||
| 959 | 1292 | $data['datetime'] = date('Y-m-d H:i:s',$line[9]); |
| 960 | 1293 | $data['format_source'] = 'planeupdatefaa'; |
| 961 | 1294 | $data['id_source'] = $id_source; |
| 962 | - if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true; |
|
| 963 | - if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name']; |
|
| 1295 | + if (isset($value['noarchive']) && $value['noarchive'] === TRUE) { |
|
| 1296 | + $data['noarchive'] = true; |
|
| 1297 | + } |
|
| 1298 | + if (isset($value['name']) && $value['name'] != '') { |
|
| 1299 | + $data['source_name'] = $value['name']; |
|
| 1300 | + } |
|
| 964 | 1301 | $SI->add($data); |
| 965 | 1302 | unset($data); |
| 966 | 1303 | } |
@@ -994,7 +1331,9 @@ discard block |
||
| 994 | 1331 | $data['datetime'] = date('Y-m-d H:i:s',$line[3]); |
| 995 | 1332 | $data['format_source'] = 'opensky'; |
| 996 | 1333 | $data['id_source'] = $id_source; |
| 997 | - if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true; |
|
| 1334 | + if (isset($value['noarchive']) && $value['noarchive'] === TRUE) { |
|
| 1335 | + $data['noarchive'] = true; |
|
| 1336 | + } |
|
| 998 | 1337 | $SI->add($data); |
| 999 | 1338 | unset($data); |
| 1000 | 1339 | } |
@@ -1011,7 +1350,9 @@ discard block |
||
| 1011 | 1350 | //$buffer = $Common->getData($hosts[$id]); |
| 1012 | 1351 | $buffer = $Common->getData($value['host']); |
| 1013 | 1352 | $all_data = json_decode($buffer,true); |
| 1014 | - if (!empty($all_data)) $reset = 0; |
|
| 1353 | + if (!empty($all_data)) { |
|
| 1354 | + $reset = 0; |
|
| 1355 | + } |
|
| 1015 | 1356 | foreach ($all_data as $key => $line) { |
| 1016 | 1357 | if ($key != 'full_count' && $key != 'version' && $key != 'stats') { |
| 1017 | 1358 | $data = array(); |
@@ -1032,8 +1373,12 @@ discard block |
||
| 1032 | 1373 | $data['datetime'] = date('Y-m-d H:i:s'); //$line[10] |
| 1033 | 1374 | $data['format_source'] = 'fr24json'; |
| 1034 | 1375 | $data['id_source'] = $id_source; |
| 1035 | - if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true; |
|
| 1036 | - if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name']; |
|
| 1376 | + if (isset($value['noarchive']) && $value['noarchive'] === TRUE) { |
|
| 1377 | + $data['noarchive'] = true; |
|
| 1378 | + } |
|
| 1379 | + if (isset($value['name']) && $value['name'] != '') { |
|
| 1380 | + $data['source_name'] = $value['name']; |
|
| 1381 | + } |
|
| 1037 | 1382 | $SI->add($data); |
| 1038 | 1383 | unset($data); |
| 1039 | 1384 | } |
@@ -1062,24 +1407,42 @@ discard block |
||
| 1062 | 1407 | if (isset($line['inf'])) { |
| 1063 | 1408 | $data = array(); |
| 1064 | 1409 | $data['hex'] = $line['inf']['ia']; |
| 1065 | - if (isset($line['inf']['cs'])) $data['ident'] = $line['inf']['cs']; //$line[13] |
|
| 1410 | + if (isset($line['inf']['cs'])) { |
|
| 1411 | + $data['ident'] = $line['inf']['cs']; |
|
| 1412 | + } |
|
| 1413 | + //$line[13] |
|
| 1066 | 1414 | $data['altitude'] = round($line['inf']['al']*3.28084); // altitude |
| 1067 | - if (isset($line['inf']['gs'])) $data['speed'] = round($line['inf']['gs']*0.539957); // speed |
|
| 1068 | - if (isset($line['inf']['tr'])) $data['heading'] = $line['inf']['tr']; // heading |
|
| 1415 | + if (isset($line['inf']['gs'])) { |
|
| 1416 | + $data['speed'] = round($line['inf']['gs']*0.539957); |
|
| 1417 | + } |
|
| 1418 | + // speed |
|
| 1419 | + if (isset($line['inf']['tr'])) { |
|
| 1420 | + $data['heading'] = $line['inf']['tr']; |
|
| 1421 | + } |
|
| 1422 | + // heading |
|
| 1069 | 1423 | $data['latitude'] = $line['pt'][0]; // lat |
| 1070 | 1424 | $data['longitude'] = $line['pt'][1]; // long |
| 1071 | 1425 | //if (isset($line['inf']['vs'])) $data['verticalrate'] = $line['inf']['vs']; // verticale rate |
| 1072 | - if (isset($line['inf']['sq'])) $data['squawk'] = $line['inf']['sq']; // squawk |
|
| 1426 | + if (isset($line['inf']['sq'])) { |
|
| 1427 | + $data['squawk'] = $line['inf']['sq']; |
|
| 1428 | + } |
|
| 1429 | + // squawk |
|
| 1073 | 1430 | //$data['aircraft_icao'] = $line[8]; |
| 1074 | - if (isset($line['inf']['rc'])) $data['registration'] = $line['inf']['rc']; |
|
| 1431 | + if (isset($line['inf']['rc'])) { |
|
| 1432 | + $data['registration'] = $line['inf']['rc']; |
|
| 1433 | + } |
|
| 1075 | 1434 | //$data['departure_airport_iata'] = $line[11]; |
| 1076 | 1435 | //$data['arrival_airport_iata'] = $line[12]; |
| 1077 | 1436 | //$data['emergency'] = ''; // emergency |
| 1078 | 1437 | $data['datetime'] = date('Y-m-d H:i:s',$line['inf']['dt']); //$line[10] |
| 1079 | 1438 | $data['format_source'] = 'radarvirtueljson'; |
| 1080 | 1439 | $data['id_source'] = $id_source; |
| 1081 | - if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true; |
|
| 1082 | - if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name']; |
|
| 1440 | + if (isset($value['noarchive']) && $value['noarchive'] === TRUE) { |
|
| 1441 | + $data['noarchive'] = true; |
|
| 1442 | + } |
|
| 1443 | + if (isset($value['name']) && $value['name'] != '') { |
|
| 1444 | + $data['source_name'] = $value['name']; |
|
| 1445 | + } |
|
| 1083 | 1446 | $SI->add($data); |
| 1084 | 1447 | unset($data); |
| 1085 | 1448 | } |
@@ -1105,30 +1468,65 @@ discard block |
||
| 1105 | 1468 | $data['id'] = $line['id']; |
| 1106 | 1469 | $data['hex'] = substr(str_pad(dechex($line['id']),6,'000000',STR_PAD_LEFT),0,6); |
| 1107 | 1470 | $data['ident'] = $line['callsign']; // ident |
| 1108 | - if (isset($line['pilotid'])) $data['pilot_id'] = $line['pilotid']; // pilot id |
|
| 1109 | - if (isset($line['name'])) $data['pilot_name'] = $line['name']; // pilot name |
|
| 1110 | - if (isset($line['alt'])) $data['altitude'] = $line['alt']; // altitude |
|
| 1111 | - if (isset($line['gs'])) $data['speed'] = $line['gs']; // speed |
|
| 1112 | - if (isset($line['heading'])) $data['heading'] = $line['heading']; // heading |
|
| 1113 | - if (isset($line['route'])) $data['waypoints'] = $line['route']; // route |
|
| 1471 | + if (isset($line['pilotid'])) { |
|
| 1472 | + $data['pilot_id'] = $line['pilotid']; |
|
| 1473 | + } |
|
| 1474 | + // pilot id |
|
| 1475 | + if (isset($line['name'])) { |
|
| 1476 | + $data['pilot_name'] = $line['name']; |
|
| 1477 | + } |
|
| 1478 | + // pilot name |
|
| 1479 | + if (isset($line['alt'])) { |
|
| 1480 | + $data['altitude'] = $line['alt']; |
|
| 1481 | + } |
|
| 1482 | + // altitude |
|
| 1483 | + if (isset($line['gs'])) { |
|
| 1484 | + $data['speed'] = $line['gs']; |
|
| 1485 | + } |
|
| 1486 | + // speed |
|
| 1487 | + if (isset($line['heading'])) { |
|
| 1488 | + $data['heading'] = $line['heading']; |
|
| 1489 | + } |
|
| 1490 | + // heading |
|
| 1491 | + if (isset($line['route'])) { |
|
| 1492 | + $data['waypoints'] = $line['route']; |
|
| 1493 | + } |
|
| 1494 | + // route |
|
| 1114 | 1495 | $data['latitude'] = $line['lat']; // lat |
| 1115 | 1496 | $data['longitude'] = $line['lon']; // long |
| 1116 | 1497 | //$data['verticalrate'] = $line['vrt']; // verticale rate |
| 1117 | 1498 | //$data['squawk'] = $line['squawk']; // squawk |
| 1118 | 1499 | //$data['emergency'] = ''; // emergency |
| 1119 | - if (isset($line['depicao'])) $data['departure_airport_icao'] = $line['depicao']; |
|
| 1120 | - if (isset($line['deptime'])) $data['departure_airport_time'] = $line['deptime']; |
|
| 1121 | - if (isset($line['arricao'])) $data['arrival_airport_icao'] = $line['arricao']; |
|
| 1500 | + if (isset($line['depicao'])) { |
|
| 1501 | + $data['departure_airport_icao'] = $line['depicao']; |
|
| 1502 | + } |
|
| 1503 | + if (isset($line['deptime'])) { |
|
| 1504 | + $data['departure_airport_time'] = $line['deptime']; |
|
| 1505 | + } |
|
| 1506 | + if (isset($line['arricao'])) { |
|
| 1507 | + $data['arrival_airport_icao'] = $line['arricao']; |
|
| 1508 | + } |
|
| 1122 | 1509 | //$data['arrival_airport_time'] = $line['arrtime']; |
| 1123 | - if (isset($line['aircraft'])) $data['aircraft_icao'] = $line['aircraft']; |
|
| 1124 | - if (isset($line['transponder'])) $data['squawk'] = $line['transponder']; |
|
| 1125 | - if (isset($line['atis'])) $data['info'] = $line['atis']; |
|
| 1126 | - else $data['info'] = ''; |
|
| 1510 | + if (isset($line['aircraft'])) { |
|
| 1511 | + $data['aircraft_icao'] = $line['aircraft']; |
|
| 1512 | + } |
|
| 1513 | + if (isset($line['transponder'])) { |
|
| 1514 | + $data['squawk'] = $line['transponder']; |
|
| 1515 | + } |
|
| 1516 | + if (isset($line['atis'])) { |
|
| 1517 | + $data['info'] = $line['atis']; |
|
| 1518 | + } else { |
|
| 1519 | + $data['info'] = ''; |
|
| 1520 | + } |
|
| 1127 | 1521 | $data['format_source'] = 'pireps'; |
| 1128 | 1522 | $data['id_source'] = $id_source; |
| 1129 | 1523 | $data['datetime'] = date('Y-m-d H:i:s'); |
| 1130 | - if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true; |
|
| 1131 | - if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name']; |
|
| 1524 | + if (isset($value['noarchive']) && $value['noarchive'] === TRUE) { |
|
| 1525 | + $data['noarchive'] = true; |
|
| 1526 | + } |
|
| 1527 | + if (isset($value['name']) && $value['name'] != '') { |
|
| 1528 | + $data['source_name'] = $value['name']; |
|
| 1529 | + } |
|
| 1132 | 1530 | if ($line['icon'] == 'plane') { |
| 1133 | 1531 | $SI->add($data); |
| 1134 | 1532 | // print_r($data); |
@@ -1137,16 +1535,28 @@ discard block |
||
| 1137 | 1535 | $data['info'] = str_replace('&sect;','',$data['info']); |
| 1138 | 1536 | $typec = substr($data['ident'],-3); |
| 1139 | 1537 | $data['type'] = ''; |
| 1140 | - if ($typec == 'APP') $data['type'] = 'Approach'; |
|
| 1141 | - elseif ($typec == 'TWR') $data['type'] = 'Tower'; |
|
| 1142 | - elseif ($typec == 'OBS') $data['type'] = 'Observer'; |
|
| 1143 | - elseif ($typec == 'GND') $data['type'] = 'Ground'; |
|
| 1144 | - elseif ($typec == 'DEL') $data['type'] = 'Delivery'; |
|
| 1145 | - elseif ($typec == 'DEP') $data['type'] = 'Departure'; |
|
| 1146 | - elseif ($typec == 'FSS') $data['type'] = 'Flight Service Station'; |
|
| 1147 | - elseif ($typec == 'CTR') $data['type'] = 'Control Radar or Centre'; |
|
| 1148 | - else $data['type'] = 'Observer'; |
|
| 1149 | - 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']); |
|
| 1538 | + if ($typec == 'APP') { |
|
| 1539 | + $data['type'] = 'Approach'; |
|
| 1540 | + } elseif ($typec == 'TWR') { |
|
| 1541 | + $data['type'] = 'Tower'; |
|
| 1542 | + } elseif ($typec == 'OBS') { |
|
| 1543 | + $data['type'] = 'Observer'; |
|
| 1544 | + } elseif ($typec == 'GND') { |
|
| 1545 | + $data['type'] = 'Ground'; |
|
| 1546 | + } elseif ($typec == 'DEL') { |
|
| 1547 | + $data['type'] = 'Delivery'; |
|
| 1548 | + } elseif ($typec == 'DEP') { |
|
| 1549 | + $data['type'] = 'Departure'; |
|
| 1550 | + } elseif ($typec == 'FSS') { |
|
| 1551 | + $data['type'] = 'Flight Service Station'; |
|
| 1552 | + } elseif ($typec == 'CTR') { |
|
| 1553 | + $data['type'] = 'Control Radar or Centre'; |
|
| 1554 | + } else { |
|
| 1555 | + $data['type'] = 'Observer'; |
|
| 1556 | + } |
|
| 1557 | + if (isset($ATC)) { |
|
| 1558 | + 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']); |
|
| 1559 | + } |
|
| 1150 | 1560 | } |
| 1151 | 1561 | unset($data); |
| 1152 | 1562 | } |
@@ -1161,7 +1571,9 @@ discard block |
||
| 1161 | 1571 | ) |
| 1162 | 1572 | ) { |
| 1163 | 1573 | //$buffer = $Common->getData($hosts[$id]); |
| 1164 | - if ($globalDebug) echo 'Get Data...'."\n"; |
|
| 1574 | + if ($globalDebug) { |
|
| 1575 | + echo 'Get Data...'."\n"; |
|
| 1576 | + } |
|
| 1165 | 1577 | $buffer = $Common->getData($value['host']); |
| 1166 | 1578 | $all_data = json_decode($buffer,true); |
| 1167 | 1579 | if ($buffer != '' && is_array($all_data)) { |
@@ -1169,10 +1581,16 @@ discard block |
||
| 1169 | 1581 | foreach ($all_data as $line) { |
| 1170 | 1582 | $data = array(); |
| 1171 | 1583 | //$data['id'] = $line['id']; // id not usable |
| 1172 | - if (isset($line['pilotid'])) $data['id'] = $line['pilotid'].$line['flightnum']; |
|
| 1584 | + if (isset($line['pilotid'])) { |
|
| 1585 | + $data['id'] = $line['pilotid'].$line['flightnum']; |
|
| 1586 | + } |
|
| 1173 | 1587 | $data['hex'] = substr(str_pad(bin2hex($line['flightnum']),6,'000000',STR_PAD_LEFT),-6); // hex |
| 1174 | - if (isset($line['pilotname'])) $data['pilot_name'] = $line['pilotname']; |
|
| 1175 | - if (isset($line['pilotid'])) $data['pilot_id'] = $line['pilotid']; |
|
| 1588 | + if (isset($line['pilotname'])) { |
|
| 1589 | + $data['pilot_name'] = $line['pilotname']; |
|
| 1590 | + } |
|
| 1591 | + if (isset($line['pilotid'])) { |
|
| 1592 | + $data['pilot_id'] = $line['pilotid']; |
|
| 1593 | + } |
|
| 1176 | 1594 | $data['ident'] = $line['flightnum']; // ident |
| 1177 | 1595 | $data['altitude'] = $line['alt']; // altitude |
| 1178 | 1596 | $data['speed'] = $line['gs']; // speed |
@@ -1188,7 +1606,9 @@ discard block |
||
| 1188 | 1606 | $datetime = new DateTime($line['lastupdate'],new DateTimeZone($value['timezone'])); |
| 1189 | 1607 | $datetime->setTimeZone(new DateTimeZone('UTC')); |
| 1190 | 1608 | $data['datetime'] = $datetime->format('Y-m-d H:i:s'); |
| 1191 | - } else $data['datetime'] = date('Y-m-d H:i:s'); |
|
| 1609 | + } else { |
|
| 1610 | + $data['datetime'] = date('Y-m-d H:i:s'); |
|
| 1611 | + } |
|
| 1192 | 1612 | $data['departure_airport_icao'] = $line['depicao']; |
| 1193 | 1613 | $data['departure_airport_time'] = $line['deptime']; |
| 1194 | 1614 | $data['arrival_airport_icao'] = $line['arricao']; |
@@ -1196,29 +1616,47 @@ discard block |
||
| 1196 | 1616 | if (isset($line['registration'])) { |
| 1197 | 1617 | $data['registration'] = $line['registration']; |
| 1198 | 1618 | //if (isset($line['aircraft'])) $data['id'] = $line['aircraft']; |
| 1199 | - } else $data['registration'] = $line['aircraft']; |
|
| 1200 | - if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true; |
|
| 1201 | - if (isset($line['route'])) $data['waypoints'] = $line['route']; // route |
|
| 1619 | + } else { |
|
| 1620 | + $data['registration'] = $line['aircraft']; |
|
| 1621 | + } |
|
| 1622 | + if (isset($value['noarchive']) && $value['noarchive'] === TRUE) { |
|
| 1623 | + $data['noarchive'] = true; |
|
| 1624 | + } |
|
| 1625 | + if (isset($line['route'])) { |
|
| 1626 | + $data['waypoints'] = $line['route']; |
|
| 1627 | + } |
|
| 1628 | + // route |
|
| 1202 | 1629 | if (isset($line['aircraftname'])) { |
| 1203 | 1630 | $line['aircraftname'] = strtoupper($line['aircraftname']); |
| 1204 | 1631 | $line['aircraftname'] = str_replace('BOEING ','B',$line['aircraftname']); |
| 1205 | 1632 | $aircraft_data = explode('-',$line['aircraftname']); |
| 1206 | - if (isset($aircraft_data[1]) && strlen($aircraft_data[0]) >= 3 && strlen($aircraft_data[0]) <= 4) $data['aircraft_icao'] = $aircraft_data[0]; |
|
| 1207 | - elseif (isset($aircraft_data[1]) && strlen($aircraft_data[1]) >= 3 && strlen($aircraft_data[1]) <= 4) $data['aircraft_icao'] = $aircraft_data[1]; |
|
| 1208 | - else { |
|
| 1633 | + if (isset($aircraft_data[1]) && strlen($aircraft_data[0]) >= 3 && strlen($aircraft_data[0]) <= 4) { |
|
| 1634 | + $data['aircraft_icao'] = $aircraft_data[0]; |
|
| 1635 | + } elseif (isset($aircraft_data[1]) && strlen($aircraft_data[1]) >= 3 && strlen($aircraft_data[1]) <= 4) { |
|
| 1636 | + $data['aircraft_icao'] = $aircraft_data[1]; |
|
| 1637 | + } else { |
|
| 1209 | 1638 | $aircraft_data = explode(' ',$line['aircraftname']); |
| 1210 | - if (isset($aircraft_data[1])) $data['aircraft_icao'] = str_replace('-','',$aircraft_data[1]); |
|
| 1211 | - else $data['aircraft_icao'] = str_replace('-','',$line['aircraftname']); |
|
| 1639 | + if (isset($aircraft_data[1])) { |
|
| 1640 | + $data['aircraft_icao'] = str_replace('-','',$aircraft_data[1]); |
|
| 1641 | + } else { |
|
| 1642 | + $data['aircraft_icao'] = str_replace('-','',$line['aircraftname']); |
|
| 1643 | + } |
|
| 1212 | 1644 | } |
| 1213 | 1645 | } |
| 1214 | - if (isset($line['route'])) $data['waypoints'] = $line['route']; |
|
| 1646 | + if (isset($line['route'])) { |
|
| 1647 | + $data['waypoints'] = $line['route']; |
|
| 1648 | + } |
|
| 1215 | 1649 | $data['id_source'] = $id_source; |
| 1216 | 1650 | $data['format_source'] = 'phpvmacars'; |
| 1217 | - if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name']; |
|
| 1651 | + if (isset($value['name']) && $value['name'] != '') { |
|
| 1652 | + $data['source_name'] = $value['name']; |
|
| 1653 | + } |
|
| 1218 | 1654 | $SI->add($data); |
| 1219 | 1655 | unset($data); |
| 1220 | 1656 | } |
| 1221 | - if ($globalDebug) echo 'No more data...'."\n"; |
|
| 1657 | + if ($globalDebug) { |
|
| 1658 | + echo 'No more data...'."\n"; |
|
| 1659 | + } |
|
| 1222 | 1660 | unset($buffer); |
| 1223 | 1661 | unset($all_data); |
| 1224 | 1662 | } |
@@ -1231,7 +1669,9 @@ discard block |
||
| 1231 | 1669 | ) |
| 1232 | 1670 | ) { |
| 1233 | 1671 | //$buffer = $Common->getData($hosts[$id]); |
| 1234 | - if ($globalDebug) echo 'Get Data...'."\n"; |
|
| 1672 | + if ($globalDebug) { |
|
| 1673 | + echo 'Get Data...'."\n"; |
|
| 1674 | + } |
|
| 1235 | 1675 | $buffer = $Common->getData($value['host']); |
| 1236 | 1676 | $all_data = json_decode($buffer,true); |
| 1237 | 1677 | if ($buffer != '' && is_array($all_data) && isset($all_data['ACARSData'])) { |
@@ -1242,10 +1682,16 @@ discard block |
||
| 1242 | 1682 | //$data['id'] = $line['id']; // id not usable |
| 1243 | 1683 | $data['id'] = $line['id']; |
| 1244 | 1684 | //$data['hex'] = substr(str_pad(bin2hex($line['flightnum']),6,'000000',STR_PAD_LEFT),-6); // hex |
| 1245 | - if (isset($line['user']['username'])) $data['pilot_name'] = $line['user']['username']; |
|
| 1246 | - if (isset($line['user_id'])) $data['pilot_id'] = $line['user_id']; |
|
| 1685 | + if (isset($line['user']['username'])) { |
|
| 1686 | + $data['pilot_name'] = $line['user']['username']; |
|
| 1687 | + } |
|
| 1688 | + if (isset($line['user_id'])) { |
|
| 1689 | + $data['pilot_id'] = $line['user_id']; |
|
| 1690 | + } |
|
| 1247 | 1691 | $data['ident'] = str_replace(' ','',$line['bid']['flightnum']); // ident |
| 1248 | - if (is_numeric($data['ident'])) $data['ident'] = $line['bid']['airline']['icao'].$data['ident']; |
|
| 1692 | + if (is_numeric($data['ident'])) { |
|
| 1693 | + $data['ident'] = $line['bid']['airline']['icao'].$data['ident']; |
|
| 1694 | + } |
|
| 1249 | 1695 | $data['altitude'] = $line['altitude']; // altitude |
| 1250 | 1696 | $data['speed'] = $line['groundspeed']; // speed |
| 1251 | 1697 | $data['heading'] = $line['heading']; // heading |
@@ -1258,7 +1704,9 @@ discard block |
||
| 1258 | 1704 | $datetime = new DateTime($line['updated_at'],new DateTimeZone($value['timezone'])); |
| 1259 | 1705 | $datetime->setTimeZone(new DateTimeZone('UTC')); |
| 1260 | 1706 | $data['datetime'] = $datetime->format('Y-m-d H:i:s'); |
| 1261 | - } else $data['datetime'] = date('Y-m-d H:i:s'); |
|
| 1707 | + } else { |
|
| 1708 | + $data['datetime'] = date('Y-m-d H:i:s'); |
|
| 1709 | + } |
|
| 1262 | 1710 | |
| 1263 | 1711 | $data['departure_airport_icao'] = $line['bid']['depapt']['icao']; |
| 1264 | 1712 | $data['departure_airport_time'] = $line['bid']['deptime']; |
@@ -1266,17 +1714,26 @@ discard block |
||
| 1266 | 1714 | $data['arrival_airport_time'] = $line['bid']['arrtime']; |
| 1267 | 1715 | $data['registration'] = $line['bid']['aircraft']['registration']; |
| 1268 | 1716 | |
| 1269 | - if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true; |
|
| 1270 | - if (isset($line['bid']['route']) && $line['bid']['route'] != '') $data['waypoints'] = $line['bid']['route']; // route |
|
| 1717 | + if (isset($value['noarchive']) && $value['noarchive'] === TRUE) { |
|
| 1718 | + $data['noarchive'] = true; |
|
| 1719 | + } |
|
| 1720 | + if (isset($line['bid']['route']) && $line['bid']['route'] != '') { |
|
| 1721 | + $data['waypoints'] = $line['bid']['route']; |
|
| 1722 | + } |
|
| 1723 | + // route |
|
| 1271 | 1724 | $data['aircraft_icao'] = $line['bid']['aircraft']['icao']; |
| 1272 | 1725 | |
| 1273 | 1726 | $data['id_source'] = $id_source; |
| 1274 | 1727 | $data['format_source'] = 'vaos'; |
| 1275 | - if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name']; |
|
| 1728 | + if (isset($value['name']) && $value['name'] != '') { |
|
| 1729 | + $data['source_name'] = $value['name']; |
|
| 1730 | + } |
|
| 1276 | 1731 | $SI->add($data); |
| 1277 | 1732 | unset($data); |
| 1278 | 1733 | } |
| 1279 | - if ($globalDebug) echo 'No more data...'."\n"; |
|
| 1734 | + if ($globalDebug) { |
|
| 1735 | + echo 'No more data...'."\n"; |
|
| 1736 | + } |
|
| 1280 | 1737 | unset($buffer); |
| 1281 | 1738 | unset($all_data); |
| 1282 | 1739 | } |
@@ -1289,7 +1746,9 @@ discard block |
||
| 1289 | 1746 | ) |
| 1290 | 1747 | ) { |
| 1291 | 1748 | //$buffer = $Common->getData($hosts[$id]); |
| 1292 | - if ($globalDebug) echo 'Get Data...'."\n"; |
|
| 1749 | + if ($globalDebug) { |
|
| 1750 | + echo 'Get Data...'."\n"; |
|
| 1751 | + } |
|
| 1293 | 1752 | $buffer = $Common->getData($value['host']); |
| 1294 | 1753 | $all_data = json_decode($buffer,true); |
| 1295 | 1754 | if ($buffer != '' && is_array($all_data)) { |
@@ -1318,16 +1777,25 @@ discard block |
||
| 1318 | 1777 | $data['arrival_airport_icao'] = $line['arrival']; |
| 1319 | 1778 | //$data['arrival_airport_time'] = $line['arrival_time']; |
| 1320 | 1779 | //$data['registration'] = $line['aircraft']; |
| 1321 | - if (isset($line['route'])) $data['waypoints'] = $line['route']; // route |
|
| 1780 | + if (isset($line['route'])) { |
|
| 1781 | + $data['waypoints'] = $line['route']; |
|
| 1782 | + } |
|
| 1783 | + // route |
|
| 1322 | 1784 | $data['aircraft_icao'] = $line['plane_type']; |
| 1323 | 1785 | $data['id_source'] = $id_source; |
| 1324 | 1786 | $data['format_source'] = 'vam'; |
| 1325 | - if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true; |
|
| 1326 | - if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name']; |
|
| 1787 | + if (isset($value['noarchive']) && $value['noarchive'] === TRUE) { |
|
| 1788 | + $data['noarchive'] = true; |
|
| 1789 | + } |
|
| 1790 | + if (isset($value['name']) && $value['name'] != '') { |
|
| 1791 | + $data['source_name'] = $value['name']; |
|
| 1792 | + } |
|
| 1327 | 1793 | $SI->add($data); |
| 1328 | 1794 | unset($data); |
| 1329 | 1795 | } |
| 1330 | - if ($globalDebug) echo 'No more data...'."\n"; |
|
| 1796 | + if ($globalDebug) { |
|
| 1797 | + echo 'No more data...'."\n"; |
|
| 1798 | + } |
|
| 1331 | 1799 | unset($buffer); |
| 1332 | 1800 | unset($all_data); |
| 1333 | 1801 | } |
@@ -1340,7 +1808,9 @@ discard block |
||
| 1340 | 1808 | ) |
| 1341 | 1809 | ) { |
| 1342 | 1810 | //$buffer = $Common->getData($hosts[$id]); |
| 1343 | - if ($globalDebug) echo 'Get Data...'."\n"; |
|
| 1811 | + if ($globalDebug) { |
|
| 1812 | + echo 'Get Data...'."\n"; |
|
| 1813 | + } |
|
| 1344 | 1814 | $buffer = $Common->getData($value['host']); |
| 1345 | 1815 | $all_data = json_decode($buffer,true); |
| 1346 | 1816 | if ($buffer != '') { |
@@ -1358,18 +1828,24 @@ discard block |
||
| 1358 | 1828 | $data['id_source'] = $id_source; |
| 1359 | 1829 | $data['format_source'] = 'blitzortung'; |
| 1360 | 1830 | $SI->add($data); |
| 1361 | - if ($globalDebug) echo '☈ Lightning added'."\n"; |
|
| 1831 | + if ($globalDebug) { |
|
| 1832 | + echo '☈ Lightning added'."\n"; |
|
| 1833 | + } |
|
| 1362 | 1834 | $Source->addLocation('',$data['latitude'],$data['longitude'],0,'','','blitzortung','weather/thunderstorm.png','lightning',$id,0,$data['datetime']); |
| 1363 | 1835 | unset($data); |
| 1364 | 1836 | } |
| 1365 | 1837 | } |
| 1366 | - if ($globalDebug) echo 'No more data...'."\n"; |
|
| 1838 | + if ($globalDebug) { |
|
| 1839 | + echo 'No more data...'."\n"; |
|
| 1840 | + } |
|
| 1367 | 1841 | unset($buffer); |
| 1368 | 1842 | } |
| 1369 | 1843 | $last_exec[$id]['last'] = time(); |
| 1370 | 1844 | //} elseif ($value == 'sbs' || $value == 'tsv' || $value == 'raw' || $value == 'aprs' || $value == 'beast') { |
| 1371 | 1845 | } elseif ($value['format'] == 'sbs' || $value['format'] == 'tsv' || $value['format'] == 'raw' || $value['format'] == 'aprs' || $value['format'] == 'famaprs' || $value['format'] == 'beast' || $value['format'] == 'flightgearmp' || $value['format'] == 'flightgearsp' || $value['format'] == 'acars' || $value['format'] == 'acarssbs3' || $value['format'] == 'ais' || $value['format'] == 'vrstcp') { |
| 1372 | - if (function_exists('pcntl_fork')) pcntl_signal_dispatch(); |
|
| 1846 | + if (function_exists('pcntl_fork')) { |
|
| 1847 | + pcntl_signal_dispatch(); |
|
| 1848 | + } |
|
| 1373 | 1849 | //$last_exec[$id]['last'] = time(); |
| 1374 | 1850 | |
| 1375 | 1851 | //$read = array( $sockets[$id] ); |
@@ -1377,7 +1853,9 @@ discard block |
||
| 1377 | 1853 | $write = NULL; |
| 1378 | 1854 | $e = NULL; |
| 1379 | 1855 | $n = socket_select($read, $write, $e, $timeout); |
| 1380 | - if ($e != NULL) var_dump($e); |
|
| 1856 | + if ($e != NULL) { |
|
| 1857 | + var_dump($e); |
|
| 1858 | + } |
|
| 1381 | 1859 | if ($n > 0) { |
| 1382 | 1860 | $reset = 0; |
| 1383 | 1861 | foreach ($read as $nb => $r) { |
@@ -1399,13 +1877,17 @@ discard block |
||
| 1399 | 1877 | if ($buffer !== FALSE) { |
| 1400 | 1878 | if ($format == 'vrstcp') { |
| 1401 | 1879 | $buffer = explode('},{',$buffer); |
| 1402 | - } else $buffer=trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'',$buffer)); |
|
| 1880 | + } else { |
|
| 1881 | + $buffer=trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'',$buffer)); |
|
| 1882 | + } |
|
| 1403 | 1883 | } |
| 1404 | 1884 | // SBS format is CSV format |
| 1405 | 1885 | if ($buffer !== FALSE && $buffer !== '') { |
| 1406 | 1886 | $tt[$format] = 0; |
| 1407 | 1887 | if ($format == 'acarssbs3') { |
| 1408 | - if ($globalDebug) echo 'ACARS : '.$buffer."\n"; |
|
| 1888 | + if ($globalDebug) { |
|
| 1889 | + echo 'ACARS : '.$buffer."\n"; |
|
| 1890 | + } |
|
| 1409 | 1891 | $ACARS->add(trim($buffer)); |
| 1410 | 1892 | $ACARS->deleteLiveAcarsData(); |
| 1411 | 1893 | } elseif ($format == 'raw') { |
@@ -1414,30 +1896,70 @@ discard block |
||
| 1414 | 1896 | if (is_array($data)) { |
| 1415 | 1897 | $data['datetime'] = date('Y-m-d H:i:s'); |
| 1416 | 1898 | $data['format_source'] = 'raw'; |
| 1417 | - if (isset($globalSources[$nb]['name']) && $globalSources[$nb]['name'] != '') $data['source_name'] = $globalSources[$nb]['name']; |
|
| 1418 | - if (isset($globalSources[$nb]['sourcestats'])) $data['sourcestats'] = $globalSources[$nb]['sourcestats']; |
|
| 1419 | - if (isset($globalSources[$nb]['noarchive']) && $globalSources[$nb]['noarchive'] === TRUE) $data['noarchive'] = true; |
|
| 1420 | - if (($data['latitude'] == '' && $data['longitude'] == '') || (is_numeric($data['latitude']) && is_numeric($data['longitude']))) $SI->add($data); |
|
| 1899 | + if (isset($globalSources[$nb]['name']) && $globalSources[$nb]['name'] != '') { |
|
| 1900 | + $data['source_name'] = $globalSources[$nb]['name']; |
|
| 1901 | + } |
|
| 1902 | + if (isset($globalSources[$nb]['sourcestats'])) { |
|
| 1903 | + $data['sourcestats'] = $globalSources[$nb]['sourcestats']; |
|
| 1904 | + } |
|
| 1905 | + if (isset($globalSources[$nb]['noarchive']) && $globalSources[$nb]['noarchive'] === TRUE) { |
|
| 1906 | + $data['noarchive'] = true; |
|
| 1907 | + } |
|
| 1908 | + if (($data['latitude'] == '' && $data['longitude'] == '') || (is_numeric($data['latitude']) && is_numeric($data['longitude']))) { |
|
| 1909 | + $SI->add($data); |
|
| 1910 | + } |
|
| 1421 | 1911 | } |
| 1422 | 1912 | } elseif ($format == 'ais') { |
| 1423 | 1913 | $ais_data = $AIS->parse_line(trim($buffer)); |
| 1424 | 1914 | $data = array(); |
| 1425 | - if (isset($ais_data['ident'])) $data['ident'] = $ais_data['ident']; |
|
| 1426 | - if (isset($ais_data['mmsi'])) $data['mmsi'] = $ais_data['mmsi']; |
|
| 1427 | - if (isset($ais_data['speed'])) $data['speed'] = $ais_data['speed']; |
|
| 1428 | - if (isset($ais_data['heading'])) $data['heading'] = $ais_data['heading']; |
|
| 1429 | - if (isset($ais_data['latitude'])) $data['latitude'] = $ais_data['latitude']; |
|
| 1430 | - if (isset($ais_data['longitude'])) $data['longitude'] = $ais_data['longitude']; |
|
| 1431 | - if (isset($ais_data['status'])) $data['status'] = $ais_data['status']; |
|
| 1432 | - if (isset($ais_data['statusid'])) $data['status_id'] = $ais_data['statusid']; |
|
| 1433 | - if (isset($ais_data['type'])) $data['type'] = $ais_data['type']; |
|
| 1434 | - if (isset($ais_data['imo'])) $data['imo'] = $ais_data['imo']; |
|
| 1435 | - if (isset($ais_data['callsign'])) $data['callsign'] = $ais_data['callsign']; |
|
| 1436 | - if (isset($ais_data['destination'])) $data['arrival_code'] = $ais_data['destination']; |
|
| 1437 | - if (isset($ais_data['eta_ts'])) $data['arrival_date'] = date('Y-m-d H:i:s',$ais_data['eta_ts']); |
|
| 1438 | - if (isset($globalSources[$nb]['noarchive']) && $globalSources[$nb]['noarchive'] === TRUE) $data['noarchive'] = true; |
|
| 1439 | - if (isset($globalSources[$nb]['name']) && $globalSources[$nb]['name'] != '') $data['source_name'] = $globalSources[$nb]['name']; |
|
| 1440 | - if (isset($globalSources[$nb]['sourcestats'])) $data['sourcestats'] = $globalSources[$nb]['sourcestats']; |
|
| 1915 | + if (isset($ais_data['ident'])) { |
|
| 1916 | + $data['ident'] = $ais_data['ident']; |
|
| 1917 | + } |
|
| 1918 | + if (isset($ais_data['mmsi'])) { |
|
| 1919 | + $data['mmsi'] = $ais_data['mmsi']; |
|
| 1920 | + } |
|
| 1921 | + if (isset($ais_data['speed'])) { |
|
| 1922 | + $data['speed'] = $ais_data['speed']; |
|
| 1923 | + } |
|
| 1924 | + if (isset($ais_data['heading'])) { |
|
| 1925 | + $data['heading'] = $ais_data['heading']; |
|
| 1926 | + } |
|
| 1927 | + if (isset($ais_data['latitude'])) { |
|
| 1928 | + $data['latitude'] = $ais_data['latitude']; |
|
| 1929 | + } |
|
| 1930 | + if (isset($ais_data['longitude'])) { |
|
| 1931 | + $data['longitude'] = $ais_data['longitude']; |
|
| 1932 | + } |
|
| 1933 | + if (isset($ais_data['status'])) { |
|
| 1934 | + $data['status'] = $ais_data['status']; |
|
| 1935 | + } |
|
| 1936 | + if (isset($ais_data['statusid'])) { |
|
| 1937 | + $data['status_id'] = $ais_data['statusid']; |
|
| 1938 | + } |
|
| 1939 | + if (isset($ais_data['type'])) { |
|
| 1940 | + $data['type'] = $ais_data['type']; |
|
| 1941 | + } |
|
| 1942 | + if (isset($ais_data['imo'])) { |
|
| 1943 | + $data['imo'] = $ais_data['imo']; |
|
| 1944 | + } |
|
| 1945 | + if (isset($ais_data['callsign'])) { |
|
| 1946 | + $data['callsign'] = $ais_data['callsign']; |
|
| 1947 | + } |
|
| 1948 | + if (isset($ais_data['destination'])) { |
|
| 1949 | + $data['arrival_code'] = $ais_data['destination']; |
|
| 1950 | + } |
|
| 1951 | + if (isset($ais_data['eta_ts'])) { |
|
| 1952 | + $data['arrival_date'] = date('Y-m-d H:i:s',$ais_data['eta_ts']); |
|
| 1953 | + } |
|
| 1954 | + if (isset($globalSources[$nb]['noarchive']) && $globalSources[$nb]['noarchive'] === TRUE) { |
|
| 1955 | + $data['noarchive'] = true; |
|
| 1956 | + } |
|
| 1957 | + if (isset($globalSources[$nb]['name']) && $globalSources[$nb]['name'] != '') { |
|
| 1958 | + $data['source_name'] = $globalSources[$nb]['name']; |
|
| 1959 | + } |
|
| 1960 | + if (isset($globalSources[$nb]['sourcestats'])) { |
|
| 1961 | + $data['sourcestats'] = $globalSources[$nb]['sourcestats']; |
|
| 1962 | + } |
|
| 1441 | 1963 | |
| 1442 | 1964 | if (isset($ais_data['timestamp'])) { |
| 1443 | 1965 | $data['datetime'] = date('Y-m-d H:i:s',$ais_data['timestamp']); |
@@ -1446,7 +1968,9 @@ discard block |
||
| 1446 | 1968 | } |
| 1447 | 1969 | $data['format_source'] = 'aisnmea'; |
| 1448 | 1970 | $data['id_source'] = $id_source; |
| 1449 | - if (isset($ais_data['mmsi_type']) && $ais_data['mmsi_type'] == 'Ship') $MI->add($data); |
|
| 1971 | + if (isset($ais_data['mmsi_type']) && $ais_data['mmsi_type'] == 'Ship') { |
|
| 1972 | + $MI->add($data); |
|
| 1973 | + } |
|
| 1450 | 1974 | unset($data); |
| 1451 | 1975 | } elseif ($format == 'flightgearsp') { |
| 1452 | 1976 | //echo $buffer."\n"; |
@@ -1464,12 +1988,18 @@ discard block |
||
| 1464 | 1988 | $data['speed'] = round($line[5]*1.94384); |
| 1465 | 1989 | $data['datetime'] = date('Y-m-d H:i:s'); |
| 1466 | 1990 | $data['format_source'] = 'flightgearsp'; |
| 1467 | - if (isset($globalSources[$nb]['noarchive']) && $globalSources[$nb]['noarchive'] === TRUE) $data['noarchive'] = true; |
|
| 1468 | - if (($data['latitude'] == '' && $data['longitude'] == '') || (is_numeric($data['latitude']) && is_numeric($data['longitude']))) $SI->add($data); |
|
| 1991 | + if (isset($globalSources[$nb]['noarchive']) && $globalSources[$nb]['noarchive'] === TRUE) { |
|
| 1992 | + $data['noarchive'] = true; |
|
| 1993 | + } |
|
| 1994 | + if (($data['latitude'] == '' && $data['longitude'] == '') || (is_numeric($data['latitude']) && is_numeric($data['longitude']))) { |
|
| 1995 | + $SI->add($data); |
|
| 1996 | + } |
|
| 1469 | 1997 | //$send = @ socket_send( $r , $data_aprs , strlen($data_aprs) , 0 ); |
| 1470 | 1998 | } |
| 1471 | 1999 | } elseif ($format == 'acars') { |
| 1472 | - if ($globalDebug) echo 'ACARS : '.$buffer."\n"; |
|
| 2000 | + if ($globalDebug) { |
|
| 2001 | + echo 'ACARS : '.$buffer."\n"; |
|
| 2002 | + } |
|
| 1473 | 2003 | $ACARS->add(trim($buffer)); |
| 1474 | 2004 | socket_sendto($r, "OK " . $buffer , 100 , 0 , $remote_ip , $remote_port); |
| 1475 | 2005 | $ACARS->deleteLiveAcarsData(); |
@@ -1490,8 +2020,12 @@ discard block |
||
| 1490 | 2020 | $aircraft_type = $line[10]; |
| 1491 | 2021 | $aircraft_type = preg_split(':/:',$aircraft_type); |
| 1492 | 2022 | $data['aircraft_name'] = substr(end($aircraft_type),0,-4); |
| 1493 | - if (isset($globalSources[$nb]['noarchive']) && $globalSources[$nb]['noarchive'] === TRUE) $data['noarchive'] = true; |
|
| 1494 | - if (($data['latitude'] == '' && $data['longitude'] == '') || (is_numeric($data['latitude']) && is_numeric($data['longitude']))) $SI->add($data); |
|
| 2023 | + if (isset($globalSources[$nb]['noarchive']) && $globalSources[$nb]['noarchive'] === TRUE) { |
|
| 2024 | + $data['noarchive'] = true; |
|
| 2025 | + } |
|
| 2026 | + if (($data['latitude'] == '' && $data['longitude'] == '') || (is_numeric($data['latitude']) && is_numeric($data['longitude']))) { |
|
| 2027 | + $SI->add($data); |
|
| 2028 | + } |
|
| 1495 | 2029 | } |
| 1496 | 2030 | } |
| 1497 | 2031 | } elseif ($format == 'beast') { |
@@ -1501,28 +2035,62 @@ discard block |
||
| 1501 | 2035 | foreach($buffer as $all_data) { |
| 1502 | 2036 | $line = json_decode('{'.$all_data.'}',true); |
| 1503 | 2037 | $data = array(); |
| 1504 | - if (isset($line['Icao'])) $data['hex'] = $line['Icao']; // hex |
|
| 1505 | - if (isset($line['Call'])) $data['ident'] = $line['Call']; // ident |
|
| 1506 | - if (isset($line['Alt'])) $data['altitude'] = $line['Alt']; // altitude |
|
| 1507 | - if (isset($line['Spd'])) $data['speed'] = $line['Spd']; // speed |
|
| 1508 | - if (isset($line['Trak'])) $data['heading'] = $line['Trak']; // heading |
|
| 1509 | - if (isset($line['Lat'])) $data['latitude'] = $line['Lat']; // lat |
|
| 1510 | - if (isset($line['Long'])) $data['longitude'] = $line['Long']; // long |
|
| 2038 | + if (isset($line['Icao'])) { |
|
| 2039 | + $data['hex'] = $line['Icao']; |
|
| 2040 | + } |
|
| 2041 | + // hex |
|
| 2042 | + if (isset($line['Call'])) { |
|
| 2043 | + $data['ident'] = $line['Call']; |
|
| 2044 | + } |
|
| 2045 | + // ident |
|
| 2046 | + if (isset($line['Alt'])) { |
|
| 2047 | + $data['altitude'] = $line['Alt']; |
|
| 2048 | + } |
|
| 2049 | + // altitude |
|
| 2050 | + if (isset($line['Spd'])) { |
|
| 2051 | + $data['speed'] = $line['Spd']; |
|
| 2052 | + } |
|
| 2053 | + // speed |
|
| 2054 | + if (isset($line['Trak'])) { |
|
| 2055 | + $data['heading'] = $line['Trak']; |
|
| 2056 | + } |
|
| 2057 | + // heading |
|
| 2058 | + if (isset($line['Lat'])) { |
|
| 2059 | + $data['latitude'] = $line['Lat']; |
|
| 2060 | + } |
|
| 2061 | + // lat |
|
| 2062 | + if (isset($line['Long'])) { |
|
| 2063 | + $data['longitude'] = $line['Long']; |
|
| 2064 | + } |
|
| 2065 | + // long |
|
| 1511 | 2066 | //$data['verticalrate'] = $line['']; // verticale rate |
| 1512 | - if (isset($line['Sqk'])) $data['squawk'] = $line['Sqk']; // squawk |
|
| 2067 | + if (isset($line['Sqk'])) { |
|
| 2068 | + $data['squawk'] = $line['Sqk']; |
|
| 2069 | + } |
|
| 2070 | + // squawk |
|
| 1513 | 2071 | $data['emergency'] = ''; // emergency |
| 1514 | - if (isset($line['Reg'])) $data['registration'] = $line['Reg']; |
|
| 2072 | + if (isset($line['Reg'])) { |
|
| 2073 | + $data['registration'] = $line['Reg']; |
|
| 2074 | + } |
|
| 1515 | 2075 | /* |
| 1516 | 2076 | if (isset($line['PosTime'])) $data['datetime'] = date('Y-m-d H:i:s',$line['PosTime']/1000); |
| 1517 | 2077 | else $data['datetime'] = date('Y-m-d H:i:s'); |
| 1518 | 2078 | */ |
| 1519 | 2079 | $data['datetime'] = date('Y-m-d H:i:s'); |
| 1520 | - if (isset($line['Type'])) $data['aircraft_icao'] = $line['Type']; |
|
| 2080 | + if (isset($line['Type'])) { |
|
| 2081 | + $data['aircraft_icao'] = $line['Type']; |
|
| 2082 | + } |
|
| 1521 | 2083 | $data['format_source'] = 'vrstcp'; |
| 1522 | 2084 | $data['id_source'] = $id_source; |
| 1523 | - if (isset($globalSources[$nb]['noarchive']) && $globalSources[$nb]['noarchive'] === TRUE) $data['noarchive'] = true; |
|
| 1524 | - if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name']; |
|
| 1525 | - if (isset($data['latitude']) && isset($data['hex'])) $SI->add($data); |
|
| 2085 | + if (isset($globalSources[$nb]['noarchive']) && $globalSources[$nb]['noarchive'] === TRUE) { |
|
| 2086 | + $data['noarchive'] = true; |
|
| 2087 | + } |
|
| 2088 | + if (isset($value['name']) && $value['name'] != '') { |
|
| 2089 | + $data['source_name'] = $value['name']; |
|
| 2090 | + } |
|
| 2091 | + if (isset($data['latitude']) && isset($data['hex'])) { |
|
| 2092 | + $SI->add($data); |
|
| 2093 | + } |
|
| 1526 | 2094 | unset($data); |
| 1527 | 2095 | } |
| 1528 | 2096 | } elseif ($format == 'tsv' || substr($buffer,0,4) == 'clock') { |
@@ -1535,22 +2103,46 @@ discard block |
||
| 1535 | 2103 | $data['hex'] = $lined['hexid']; |
| 1536 | 2104 | //$data['datetime'] = date('Y-m-d H:i:s',strtotime($lined['clock']));; |
| 1537 | 2105 | $data['datetime'] = date('Y-m-d H:i:s');; |
| 1538 | - if (isset($lined['ident'])) $data['ident'] = $lined['ident']; |
|
| 1539 | - if (isset($lined['lat'])) $data['latitude'] = $lined['lat']; |
|
| 1540 | - if (isset($lined['lon'])) $data['longitude'] = $lined['lon']; |
|
| 1541 | - if (isset($lined['speed'])) $data['speed'] = $lined['speed']; |
|
| 1542 | - if (isset($lined['squawk'])) $data['squawk'] = $lined['squawk']; |
|
| 1543 | - if (isset($lined['alt'])) $data['altitude'] = $lined['alt']; |
|
| 1544 | - if (isset($lined['heading'])) $data['heading'] = $lined['heading']; |
|
| 2106 | + if (isset($lined['ident'])) { |
|
| 2107 | + $data['ident'] = $lined['ident']; |
|
| 2108 | + } |
|
| 2109 | + if (isset($lined['lat'])) { |
|
| 2110 | + $data['latitude'] = $lined['lat']; |
|
| 2111 | + } |
|
| 2112 | + if (isset($lined['lon'])) { |
|
| 2113 | + $data['longitude'] = $lined['lon']; |
|
| 2114 | + } |
|
| 2115 | + if (isset($lined['speed'])) { |
|
| 2116 | + $data['speed'] = $lined['speed']; |
|
| 2117 | + } |
|
| 2118 | + if (isset($lined['squawk'])) { |
|
| 2119 | + $data['squawk'] = $lined['squawk']; |
|
| 2120 | + } |
|
| 2121 | + if (isset($lined['alt'])) { |
|
| 2122 | + $data['altitude'] = $lined['alt']; |
|
| 2123 | + } |
|
| 2124 | + if (isset($lined['heading'])) { |
|
| 2125 | + $data['heading'] = $lined['heading']; |
|
| 2126 | + } |
|
| 1545 | 2127 | $data['id_source'] = $id_source; |
| 1546 | 2128 | $data['format_source'] = 'tsv'; |
| 1547 | - if (isset($globalSources[$nb]['name']) && $globalSources[$nb]['name'] != '') $data['source_name'] = $globalSources[$nb]['name']; |
|
| 1548 | - if (isset($globalSources[$nb]['sourcestats'])) $data['sourcestats'] = $globalSources[$nb]['sourcestats']; |
|
| 1549 | - if (isset($globalSources[$nb]['noarchive']) && $globalSources[$nb]['noarchive'] === TRUE) $data['noarchive'] = true; |
|
| 1550 | - if (($data['latitude'] == '' && $data['longitude'] == '') || (is_numeric($data['latitude']) && is_numeric($data['longitude']))) $SI->add($data); |
|
| 2129 | + if (isset($globalSources[$nb]['name']) && $globalSources[$nb]['name'] != '') { |
|
| 2130 | + $data['source_name'] = $globalSources[$nb]['name']; |
|
| 2131 | + } |
|
| 2132 | + if (isset($globalSources[$nb]['sourcestats'])) { |
|
| 2133 | + $data['sourcestats'] = $globalSources[$nb]['sourcestats']; |
|
| 2134 | + } |
|
| 2135 | + if (isset($globalSources[$nb]['noarchive']) && $globalSources[$nb]['noarchive'] === TRUE) { |
|
| 2136 | + $data['noarchive'] = true; |
|
| 2137 | + } |
|
| 2138 | + if (($data['latitude'] == '' && $data['longitude'] == '') || (is_numeric($data['latitude']) && is_numeric($data['longitude']))) { |
|
| 2139 | + $SI->add($data); |
|
| 2140 | + } |
|
| 1551 | 2141 | unset($lined); |
| 1552 | 2142 | unset($data); |
| 1553 | - } else $error = true; |
|
| 2143 | + } else { |
|
| 2144 | + $error = true; |
|
| 2145 | + } |
|
| 1554 | 2146 | } elseif ($format == 'aprs' && $use_aprs) { |
| 1555 | 2147 | if ($aprs_connect == 0) { |
| 1556 | 2148 | $send = @ socket_send( $r , $aprs_login , strlen($aprs_login) , 0 ); |
@@ -1576,63 +2168,121 @@ discard block |
||
| 1576 | 2168 | $aprs_last_tx = time(); |
| 1577 | 2169 | $data = array(); |
| 1578 | 2170 | //print_r($line); |
| 1579 | - if (isset($line['address'])) $data['hex'] = $line['address']; |
|
| 1580 | - if (isset($line['mmsi'])) $data['mmsi'] = $line['mmsi']; |
|
| 1581 | - if (isset($line['imo'])) $data['imo'] = $line['imo']; |
|
| 1582 | - if (isset($line['squawk'])) $data['squawk'] = $line['squawk']; |
|
| 1583 | - if (isset($line['arrival_code'])) $data['arrical_code'] = $line['arrival_code']; |
|
| 1584 | - if (isset($line['arrival_date'])) $data['arrical_date'] = $line['arrival_date']; |
|
| 1585 | - if (isset($line['type_id'])) $data['type_id'] = $line['typeid']; |
|
| 1586 | - if (isset($line['status_id'])) $data['status_id'] = $line['statusid']; |
|
| 1587 | - if (isset($line['timestamp'])) $data['datetime'] = date('Y-m-d H:i:s',$line['timestamp']); |
|
| 1588 | - else $data['datetime'] = date('Y-m-d H:i:s'); |
|
| 2171 | + if (isset($line['address'])) { |
|
| 2172 | + $data['hex'] = $line['address']; |
|
| 2173 | + } |
|
| 2174 | + if (isset($line['mmsi'])) { |
|
| 2175 | + $data['mmsi'] = $line['mmsi']; |
|
| 2176 | + } |
|
| 2177 | + if (isset($line['imo'])) { |
|
| 2178 | + $data['imo'] = $line['imo']; |
|
| 2179 | + } |
|
| 2180 | + if (isset($line['squawk'])) { |
|
| 2181 | + $data['squawk'] = $line['squawk']; |
|
| 2182 | + } |
|
| 2183 | + if (isset($line['arrival_code'])) { |
|
| 2184 | + $data['arrical_code'] = $line['arrival_code']; |
|
| 2185 | + } |
|
| 2186 | + if (isset($line['arrival_date'])) { |
|
| 2187 | + $data['arrical_date'] = $line['arrival_date']; |
|
| 2188 | + } |
|
| 2189 | + if (isset($line['type_id'])) { |
|
| 2190 | + $data['type_id'] = $line['typeid']; |
|
| 2191 | + } |
|
| 2192 | + if (isset($line['status_id'])) { |
|
| 2193 | + $data['status_id'] = $line['statusid']; |
|
| 2194 | + } |
|
| 2195 | + if (isset($line['timestamp'])) { |
|
| 2196 | + $data['datetime'] = date('Y-m-d H:i:s',$line['timestamp']); |
|
| 2197 | + } else { |
|
| 2198 | + $data['datetime'] = date('Y-m-d H:i:s'); |
|
| 2199 | + } |
|
| 1589 | 2200 | //$data['datetime'] = date('Y-m-d H:i:s'); |
| 1590 | - if (isset($line['ident'])) $data['ident'] = $line['ident']; |
|
| 2201 | + if (isset($line['ident'])) { |
|
| 2202 | + $data['ident'] = $line['ident']; |
|
| 2203 | + } |
|
| 1591 | 2204 | $data['latitude'] = $line['latitude']; |
| 1592 | 2205 | $data['longitude'] = $line['longitude']; |
| 1593 | 2206 | //$data['verticalrate'] = $line[16]; |
| 1594 | - if (isset($line['speed'])) $data['speed'] = $line['speed']; |
|
| 2207 | + if (isset($line['speed'])) { |
|
| 2208 | + $data['speed'] = $line['speed']; |
|
| 2209 | + } |
|
| 1595 | 2210 | //else $data['speed'] = 0; |
| 1596 | - if (isset($line['altitude'])) $data['altitude'] = $line['altitude']; |
|
| 1597 | - if (isset($line['comment'])) $data['comment'] = $line['comment']; |
|
| 1598 | - if (isset($line['symbol'])) $data['type'] = $line['symbol']; |
|
| 2211 | + if (isset($line['altitude'])) { |
|
| 2212 | + $data['altitude'] = $line['altitude']; |
|
| 2213 | + } |
|
| 2214 | + if (isset($line['comment'])) { |
|
| 2215 | + $data['comment'] = $line['comment']; |
|
| 2216 | + } |
|
| 2217 | + if (isset($line['symbol'])) { |
|
| 2218 | + $data['type'] = $line['symbol']; |
|
| 2219 | + } |
|
| 1599 | 2220 | //if (isset($line['heading'])) $data['heading'] = $line['heading']; |
| 1600 | 2221 | |
| 1601 | - if (isset($line['heading']) && isset($line['format_source'])) $data['heading'] = $line['heading']; |
|
| 2222 | + if (isset($line['heading']) && isset($line['format_source'])) { |
|
| 2223 | + $data['heading'] = $line['heading']; |
|
| 2224 | + } |
|
| 1602 | 2225 | //else echo 'No heading...'."\n"; |
| 1603 | 2226 | //else $data['heading'] = 0; |
| 1604 | - if (isset($line['stealth'])) $data['aircraft_type'] = $line['stealth']; |
|
| 2227 | + if (isset($line['stealth'])) { |
|
| 2228 | + $data['aircraft_type'] = $line['stealth']; |
|
| 2229 | + } |
|
| 1605 | 2230 | //if (!isset($line['source_type']) && (!isset($globalAPRSarchive) || (isset($globalAPRSarchive) && $globalAPRSarchive === FALSE))) $data['noarchive'] = true; |
| 1606 | - if (isset($globalAPRSarchive) && $globalAPRSarchive === FALSE) $data['noarchive'] = true; |
|
| 1607 | - elseif (isset($globalAPRSarchive) && $globalAPRSarchive === TRUE) $data['noarchive'] = false; |
|
| 1608 | - if (isset($globalSources[$nb]['noarchive']) && $globalSources[$nb]['noarchive'] === TRUE) $data['noarchive'] = true; |
|
| 1609 | - elseif (isset($globalSources[$nb]['noarchive']) && $globalSources[$nb]['noarchive'] === FALSE) $data['noarchive'] = false; |
|
| 2231 | + if (isset($globalAPRSarchive) && $globalAPRSarchive === FALSE) { |
|
| 2232 | + $data['noarchive'] = true; |
|
| 2233 | + } elseif (isset($globalAPRSarchive) && $globalAPRSarchive === TRUE) { |
|
| 2234 | + $data['noarchive'] = false; |
|
| 2235 | + } |
|
| 2236 | + if (isset($globalSources[$nb]['noarchive']) && $globalSources[$nb]['noarchive'] === TRUE) { |
|
| 2237 | + $data['noarchive'] = true; |
|
| 2238 | + } elseif (isset($globalSources[$nb]['noarchive']) && $globalSources[$nb]['noarchive'] === FALSE) { |
|
| 2239 | + $data['noarchive'] = false; |
|
| 2240 | + } |
|
| 1610 | 2241 | $data['id_source'] = $id_source; |
| 1611 | - if (isset($line['format_source'])) $data['format_source'] = $line['format_source']; |
|
| 1612 | - else $data['format_source'] = 'aprs'; |
|
| 2242 | + if (isset($line['format_source'])) { |
|
| 2243 | + $data['format_source'] = $line['format_source']; |
|
| 2244 | + } else { |
|
| 2245 | + $data['format_source'] = 'aprs'; |
|
| 2246 | + } |
|
| 1613 | 2247 | $data['source_name'] = $line['source']; |
| 1614 | - if (isset($line['source_type'])) $data['source_type'] = $line['source_type']; |
|
| 1615 | - else $data['source_type'] = 'flarm'; |
|
| 1616 | - if (isset($globalSources[$nb]['sourcestats'])) $data['sourcestats'] = $globalSources[$nb]['sourcestats']; |
|
| 2248 | + if (isset($line['source_type'])) { |
|
| 2249 | + $data['source_type'] = $line['source_type']; |
|
| 2250 | + } else { |
|
| 2251 | + $data['source_type'] = 'flarm'; |
|
| 2252 | + } |
|
| 2253 | + if (isset($globalSources[$nb]['sourcestats'])) { |
|
| 2254 | + $data['sourcestats'] = $globalSources[$nb]['sourcestats']; |
|
| 2255 | + } |
|
| 1617 | 2256 | $currentdate = date('Y-m-d H:i:s'); |
| 1618 | 2257 | $aprsdate = strtotime($data['datetime']); |
| 1619 | - if ($data['source_type'] != 'modes' && $data['source_type'] != 'ais') $data['altitude_relative'] = 'AMSL'; |
|
| 2258 | + if ($data['source_type'] != 'modes' && $data['source_type'] != 'ais') { |
|
| 2259 | + $data['altitude_relative'] = 'AMSL'; |
|
| 2260 | + } |
|
| 1620 | 2261 | // Accept data if time <= system time + 20s |
| 1621 | 2262 | //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'])))) { |
| 1622 | 2263 | if (($data['source_type'] == 'modes') || isset($line['stealth']) && ($line['stealth'] == 0 || $line['stealth'] == '') && (($data['latitude'] == '' && $data['longitude'] == '') || (is_numeric($data['latitude']) && is_numeric($data['longitude'])))) { |
| 1623 | 2264 | $send = $SI->add($data); |
| 1624 | 2265 | } elseif ($data['source_type'] == 'ais') { |
| 1625 | 2266 | $data['type'] = ''; |
| 1626 | - if (isset($globalMarine) && $globalMarine) $send = $MI->add($data); |
|
| 2267 | + if (isset($globalMarine) && $globalMarine) { |
|
| 2268 | + $send = $MI->add($data); |
|
| 2269 | + } |
|
| 1627 | 2270 | } elseif (isset($line['stealth'])) { |
| 1628 | - if ($line['stealth'] != 0) echo '-------- '.$data['ident'].' : APRS stealth ON => not adding'."\n"; |
|
| 1629 | - else echo '--------- '.$data['ident'].' : Date APRS : '.$data['datetime'].' - Current date : '.$currentdate.' => not adding future event'."\n"; |
|
| 2271 | + if ($line['stealth'] != 0) { |
|
| 2272 | + echo '-------- '.$data['ident'].' : APRS stealth ON => not adding'."\n"; |
|
| 2273 | + } else { |
|
| 2274 | + echo '--------- '.$data['ident'].' : Date APRS : '.$data['datetime'].' - Current date : '.$currentdate.' => not adding future event'."\n"; |
|
| 2275 | + } |
|
| 1630 | 2276 | } elseif (isset($globalAircraft) && $globalAircraft && isset($line['symbol']) && isset($line['latitude']) && isset($line['longitude']) && ( |
| 1631 | 2277 | //$line['symbol'] == 'Balloon' || |
| 1632 | 2278 | $line['symbol'] == 'Glider' || |
| 1633 | 2279 | $line['symbol'] == 'Aircraft (small)' || $line['symbol'] == 'Helicopter')) { |
| 1634 | - if ($line['symbol'] == 'Ballon') $data['aircraft_icao'] = 'BALL'; |
|
| 1635 | - if ($line['symbol'] == 'Glider') $data['aircraft_icao'] = 'PARAGLIDER'; |
|
| 2280 | + if ($line['symbol'] == 'Ballon') { |
|
| 2281 | + $data['aircraft_icao'] = 'BALL'; |
|
| 2282 | + } |
|
| 2283 | + if ($line['symbol'] == 'Glider') { |
|
| 2284 | + $data['aircraft_icao'] = 'PARAGLIDER'; |
|
| 2285 | + } |
|
| 1636 | 2286 | $send = $SI->add($data); |
| 1637 | 2287 | } elseif (isset($globalMarine) && $globalMarine && isset($line['symbol']) && isset($line['latitude']) && isset($line['longitude']) && ( |
| 1638 | 2288 | $line['symbol'] == 'Yacht (Sail)' || |
@@ -1663,9 +2313,13 @@ discard block |
||
| 1663 | 2313 | //} 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') { |
| 1664 | 2314 | // } 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') { |
| 1665 | 2315 | //echo '!!!!!!!!!!!!!!!! SEND !!!!!!!!!!!!!!!!!!!!'."\n"; |
| 1666 | - if (isset($globalTracker) && $globalTracker) $send = $TI->add($data); |
|
| 2316 | + if (isset($globalTracker) && $globalTracker) { |
|
| 2317 | + $send = $TI->add($data); |
|
| 2318 | + } |
|
| 1667 | 2319 | } elseif (!isset($line['stealth']) && is_numeric($data['latitude']) && is_numeric($data['longitude']) && isset($data['ident']) && isset($data['altitude'])) { |
| 1668 | - if (!isset($data['altitude'])) $data['altitude'] = 0; |
|
| 2320 | + if (!isset($data['altitude'])) { |
|
| 2321 | + $data['altitude'] = 0; |
|
| 2322 | + } |
|
| 1669 | 2323 | $Source->deleteOldLocationByType('gs'); |
| 1670 | 2324 | if (count($Source->getLocationInfoByNameType($data['ident'],'gs')) > 0) { |
| 1671 | 2325 | $Source->updateLocation($data['ident'],$data['latitude'],$data['longitude'],$data['altitude'],'','',$data['source_name'],'antenna.png','gs',$id,0,$data['datetime']); |
@@ -1674,7 +2328,9 @@ discard block |
||
| 1674 | 2328 | } |
| 1675 | 2329 | } elseif (isset($line['symbol']) && $line['symbol'] == 'Weather Station') { |
| 1676 | 2330 | //if ($globalDebug) echo '!! Weather Station not yet supported'."\n"; |
| 1677 | - if ($globalDebug) echo '# Weather Station added'."\n"; |
|
| 2331 | + if ($globalDebug) { |
|
| 2332 | + echo '# Weather Station added'."\n"; |
|
| 2333 | + } |
|
| 1678 | 2334 | $Source->deleteOldLocationByType('wx'); |
| 1679 | 2335 | $weather_data = json_encode($line); |
| 1680 | 2336 | if (count($Source->getLocationInfoByNameType($data['ident'],'wx')) > 0) { |
@@ -1684,7 +2340,9 @@ discard block |
||
| 1684 | 2340 | } |
| 1685 | 2341 | } elseif (isset($line['symbol']) && ($line['symbol'] == 'Lightning' || $line['symbol'] == 'Thunderstorm')) { |
| 1686 | 2342 | //if ($globalDebug) echo '!! Weather Station not yet supported'."\n"; |
| 1687 | - if ($globalDebug) echo '☈ Lightning added'."\n"; |
|
| 2343 | + if ($globalDebug) { |
|
| 2344 | + echo '☈ Lightning added'."\n"; |
|
| 2345 | + } |
|
| 1688 | 2346 | $Source->deleteOldLocationByType('lightning'); |
| 1689 | 2347 | if (count($Source->getLocationInfoByNameType($data['ident'],'lightning')) > 0) { |
| 1690 | 2348 | $Source->updateLocation($data['ident'],$data['latitude'],$data['longitude'],0,'','',$data['source_name'],'weather/thunderstorm.png','lightning',$id,0,$data['datetime'],$data['comment']); |
@@ -1696,8 +2354,7 @@ discard block |
||
| 1696 | 2354 | print_r($line); |
| 1697 | 2355 | } |
| 1698 | 2356 | unset($data); |
| 1699 | - } |
|
| 1700 | - elseif (is_array($line) && isset($line['ident']) && $line['ident'] != '') { |
|
| 2357 | + } elseif (is_array($line) && isset($line['ident']) && $line['ident'] != '') { |
|
| 1701 | 2358 | $Source->updateLocationDescByName($line['ident'],$line['source'],$id,$line['comment']); |
| 1702 | 2359 | } |
| 1703 | 2360 | /* |
@@ -1706,7 +2363,9 @@ discard block |
||
| 1706 | 2363 | } |
| 1707 | 2364 | */ |
| 1708 | 2365 | //elseif ($line == false && $globalDebug) echo 'Ignored ('.$buffer.")\n"; |
| 1709 | - elseif ($line == true && $globalDebug) echo '!! Failed : '.$buffer."!!\n"; |
|
| 2366 | + elseif ($line == true && $globalDebug) { |
|
| 2367 | + echo '!! Failed : '.$buffer."!!\n"; |
|
| 2368 | + } |
|
| 1710 | 2369 | if (isset($globalSources[$nb]['last_weather_clean']) && time()-$globalSources[$nb]['last_weather_clean'] > 60*5) { |
| 1711 | 2370 | $Source->deleteOldLocationByType('lightning'); |
| 1712 | 2371 | $Source->deleteOldLocationByType('wx'); |
@@ -1742,26 +2401,45 @@ discard block |
||
| 1742 | 2401 | $data['ground'] = $line[21]; |
| 1743 | 2402 | $data['emergency'] = $line[19]; |
| 1744 | 2403 | $data['format_source'] = 'sbs'; |
| 1745 | - if (isset($globalSources[$nb]['name']) && $globalSources[$nb]['name'] != '') $data['source_name'] = $globalSources[$nb]['name']; |
|
| 1746 | - if (isset($globalSources[$nb]['sourcestats'])) $data['sourcestats'] = $globalSources[$nb]['sourcestats']; |
|
| 1747 | - if (isset($globalSources[$nb]['noarchive']) && $globalSources[$nb]['noarchive'] === TRUE) $data['noarchive'] = true; |
|
| 2404 | + if (isset($globalSources[$nb]['name']) && $globalSources[$nb]['name'] != '') { |
|
| 2405 | + $data['source_name'] = $globalSources[$nb]['name']; |
|
| 2406 | + } |
|
| 2407 | + if (isset($globalSources[$nb]['sourcestats'])) { |
|
| 2408 | + $data['sourcestats'] = $globalSources[$nb]['sourcestats']; |
|
| 2409 | + } |
|
| 2410 | + if (isset($globalSources[$nb]['noarchive']) && $globalSources[$nb]['noarchive'] === TRUE) { |
|
| 2411 | + $data['noarchive'] = true; |
|
| 2412 | + } |
|
| 1748 | 2413 | $data['id_source'] = $id_source; |
| 1749 | - if (($data['latitude'] == '' && $data['longitude'] == '') || (is_numeric($data['latitude']) && is_numeric($data['longitude']))) $send = $SI->add($data); |
|
| 1750 | - else $error = true; |
|
| 2414 | + if (($data['latitude'] == '' && $data['longitude'] == '') || (is_numeric($data['latitude']) && is_numeric($data['longitude']))) { |
|
| 2415 | + $send = $SI->add($data); |
|
| 2416 | + } else { |
|
| 2417 | + $error = true; |
|
| 2418 | + } |
|
| 1751 | 2419 | unset($data); |
| 1752 | - } else $error = true; |
|
| 2420 | + } else { |
|
| 2421 | + $error = true; |
|
| 2422 | + } |
|
| 1753 | 2423 | if ($error) { |
| 1754 | 2424 | if (count($line) > 1 && ($line[0] == 'STA' || $line[0] == 'AIR' || $line[0] == 'SEL' || $line[0] == 'ID' || $line[0] == 'CLK')) { |
| 1755 | - if ($globalDebug) echo "Not a message. Ignoring... \n"; |
|
| 2425 | + if ($globalDebug) { |
|
| 2426 | + echo "Not a message. Ignoring... \n"; |
|
| 2427 | + } |
|
| 1756 | 2428 | } else { |
| 1757 | - if ($globalDebug) echo "Wrong line format. Ignoring... \n"; |
|
| 2429 | + if ($globalDebug) { |
|
| 2430 | + echo "Wrong line format. Ignoring... \n"; |
|
| 2431 | + } |
|
| 1758 | 2432 | if ($globalDebug) { |
| 1759 | 2433 | echo $buffer; |
| 1760 | 2434 | //print_r($line); |
| 1761 | 2435 | } |
| 1762 | 2436 | //socket_close($r); |
| 1763 | - if ($globalDebug) echo "Reconnect after an error...\n"; |
|
| 1764 | - if ($format == 'aprs') $aprs_connect = 0; |
|
| 2437 | + if ($globalDebug) { |
|
| 2438 | + echo "Reconnect after an error...\n"; |
|
| 2439 | + } |
|
| 2440 | + if ($format == 'aprs') { |
|
| 2441 | + $aprs_connect = 0; |
|
| 2442 | + } |
|
| 1765 | 2443 | $sourceer[$nb] = $globalSources[$nb]; |
| 1766 | 2444 | connect_all($sourceer); |
| 1767 | 2445 | $sourceer = array(); |
@@ -1769,10 +2447,14 @@ discard block |
||
| 1769 | 2447 | } |
| 1770 | 2448 | } |
| 1771 | 2449 | // Sleep for xxx microseconds |
| 1772 | - if (isset($globalSBSSleep)) usleep($globalSBSSleep); |
|
| 2450 | + if (isset($globalSBSSleep)) { |
|
| 2451 | + usleep($globalSBSSleep); |
|
| 2452 | + } |
|
| 1773 | 2453 | } else { |
| 1774 | 2454 | if ($format == 'flightgearmp') { |
| 1775 | - if ($globalDebug) echo "Reconnect FlightGear MP..."; |
|
| 2455 | + if ($globalDebug) { |
|
| 2456 | + echo "Reconnect FlightGear MP..."; |
|
| 2457 | + } |
|
| 1776 | 2458 | //@socket_close($r); |
| 1777 | 2459 | sleep($globalMinFetch); |
| 1778 | 2460 | $sourcefg[$nb] = $globalSources[$nb]; |
@@ -1781,10 +2463,15 @@ discard block |
||
| 1781 | 2463 | break; |
| 1782 | 2464 | |
| 1783 | 2465 | } elseif ($format != 'acars' && $format != 'flightgearsp') { |
| 1784 | - if (isset($tt[$format])) $tt[$format]++; |
|
| 1785 | - else $tt[$format] = 0; |
|
| 2466 | + if (isset($tt[$format])) { |
|
| 2467 | + $tt[$format]++; |
|
| 2468 | + } else { |
|
| 2469 | + $tt[$format] = 0; |
|
| 2470 | + } |
|
| 1786 | 2471 | if ($tt[$format] > 30 || $buffer === FALSE) { |
| 1787 | - if ($globalDebug) echo "ERROR : Reconnect ".$format."..."; |
|
| 2472 | + if ($globalDebug) { |
|
| 2473 | + echo "ERROR : Reconnect ".$format."..."; |
|
| 2474 | + } |
|
| 1788 | 2475 | //@socket_close($r); |
| 1789 | 2476 | sleep(2); |
| 1790 | 2477 | $aprs_connect = 0; |
@@ -1802,11 +2489,17 @@ discard block |
||
| 1802 | 2489 | } else { |
| 1803 | 2490 | $error = socket_strerror(socket_last_error()); |
| 1804 | 2491 | if (($error != SOCKET_EINPROGRESS && $error != SOCKET_EALREADY && $error != 'Success') || (time() - $time >= $timeout && $error != 'Success')) { |
| 1805 | - if ($globalDebug) echo "ERROR : socket_select give this error ".$error . "\n"; |
|
| 1806 | - if (isset($globalDebug)) echo "Restarting...\n"; |
|
| 2492 | + if ($globalDebug) { |
|
| 2493 | + echo "ERROR : socket_select give this error ".$error . "\n"; |
|
| 2494 | + } |
|
| 2495 | + if (isset($globalDebug)) { |
|
| 2496 | + echo "Restarting...\n"; |
|
| 2497 | + } |
|
| 1807 | 2498 | // Restart the script if possible |
| 1808 | 2499 | if (is_array($sockets)) { |
| 1809 | - if ($globalDebug) echo "Shutdown all sockets..."; |
|
| 2500 | + if ($globalDebug) { |
|
| 2501 | + echo "Shutdown all sockets..."; |
|
| 2502 | + } |
|
| 1810 | 2503 | |
| 1811 | 2504 | foreach ($sockets as $sock) { |
| 1812 | 2505 | @socket_shutdown($sock,2); |
@@ -1814,25 +2507,45 @@ discard block |
||
| 1814 | 2507 | } |
| 1815 | 2508 | |
| 1816 | 2509 | } |
| 1817 | - if ($globalDebug) echo "Waiting..."; |
|
| 2510 | + if ($globalDebug) { |
|
| 2511 | + echo "Waiting..."; |
|
| 2512 | + } |
|
| 1818 | 2513 | sleep(2); |
| 1819 | 2514 | $time = time(); |
| 1820 | 2515 | //connect_all($hosts); |
| 1821 | 2516 | $aprs_connect = 0; |
| 1822 | - if ($reset%5 == 0) sleep(20); |
|
| 1823 | - if ($reset%10 == 0) sleep(100); |
|
| 1824 | - if ($reset%20 == 0) sleep(200); |
|
| 1825 | - if ($reset > 100) exit('Too many attempts...'); |
|
| 1826 | - if ($globalDebug) echo "Restart all connections..."; |
|
| 2517 | + if ($reset%5 == 0) { |
|
| 2518 | + sleep(20); |
|
| 2519 | + } |
|
| 2520 | + if ($reset%10 == 0) { |
|
| 2521 | + sleep(100); |
|
| 2522 | + } |
|
| 2523 | + if ($reset%20 == 0) { |
|
| 2524 | + sleep(200); |
|
| 2525 | + } |
|
| 2526 | + if ($reset > 100) { |
|
| 2527 | + exit('Too many attempts...'); |
|
| 2528 | + } |
|
| 2529 | + if ($globalDebug) { |
|
| 2530 | + echo "Restart all connections..."; |
|
| 2531 | + } |
|
| 1827 | 2532 | connect_all($globalSources); |
| 1828 | 2533 | } |
| 1829 | 2534 | } |
| 1830 | 2535 | } |
| 1831 | 2536 | if ($globalDaemon === false) { |
| 1832 | - if ($globalDebug) echo 'Check all...'."\n"; |
|
| 1833 | - if (isset($SI)) $SI->checkAll(); |
|
| 1834 | - if (isset($TI)) $TI->checkAll(); |
|
| 1835 | - if (isset($MI)) $MI->checkAll(); |
|
| 2537 | + if ($globalDebug) { |
|
| 2538 | + echo 'Check all...'."\n"; |
|
| 2539 | + } |
|
| 2540 | + if (isset($SI)) { |
|
| 2541 | + $SI->checkAll(); |
|
| 2542 | + } |
|
| 2543 | + if (isset($TI)) { |
|
| 2544 | + $TI->checkAll(); |
|
| 2545 | + } |
|
| 2546 | + if (isset($MI)) { |
|
| 2547 | + $MI->checkAll(); |
|
| 2548 | + } |
|
| 1836 | 2549 | } |
| 1837 | 2550 | } |
| 1838 | 2551 | } |