@@ -8,7 +8,9 @@ |
||
8 | 8 | $atcid = filter_input(INPUT_GET,'atcid',FILTER_SANITIZE_NUMBER_INT); |
9 | 9 | $atcident = filter_input(INPUT_GET,'atcident',FILTER_SANITIZE_STRING); |
10 | 10 | $atc_data = $ATC->getById($atcid); |
11 | - if (!isset($atc_data[0])) $atc_data = $ATC->getByIdent($atcident); |
|
11 | + if (!isset($atc_data[0])) { |
|
12 | + $atc_data = $ATC->getByIdent($atcident); |
|
13 | + } |
|
12 | 14 | ?> |
13 | 15 | <div class="alldetails"> |
14 | 16 | <button type="button" class="close">×</button> |
@@ -131,45 +131,72 @@ discard block |
||
131 | 131 | </div> |
132 | 132 | <p> |
133 | 133 | <label for="dbhost">Database hostname</label> |
134 | - <input type="text" name="dbhost" id="dbhost" value="<?php if (isset($globalDBhost)) print $globalDBhost; ?>" /> |
|
134 | + <input type="text" name="dbhost" id="dbhost" value="<?php if (isset($globalDBhost)) { |
|
135 | + print $globalDBhost; |
|
136 | +} |
|
137 | +?>" /> |
|
135 | 138 | </p> |
136 | 139 | <p> |
137 | 140 | <label for="dbport">Database port</label> |
138 | - <input type="text" name="dbport" id="dbport" value="<?php if (isset($globalDBport)) print $globalDBport; ?>" /> |
|
141 | + <input type="text" name="dbport" id="dbport" value="<?php if (isset($globalDBport)) { |
|
142 | + print $globalDBport; |
|
143 | +} |
|
144 | +?>" /> |
|
139 | 145 | <p class="help-block">Default is 3306 for MariaDB/MySQL, 5432 for PostgreSQL</p> |
140 | 146 | </p> |
141 | 147 | <p> |
142 | 148 | <label for="dbname">Database name</label> |
143 | - <input type="text" name="dbname" id="dbname" value="<?php if (isset($globalDBname)) print $globalDBname; ?>" /> |
|
149 | + <input type="text" name="dbname" id="dbname" value="<?php if (isset($globalDBname)) { |
|
150 | + print $globalDBname; |
|
151 | +} |
|
152 | +?>" /> |
|
144 | 153 | </p> |
145 | 154 | <p> |
146 | 155 | <label for="dbuser">Database user</label> |
147 | - <input type="text" name="dbuser" id="dbuser" value="<?php if (isset($globalDBuser)) print $globalDBuser; ?>" /> |
|
156 | + <input type="text" name="dbuser" id="dbuser" value="<?php if (isset($globalDBuser)) { |
|
157 | + print $globalDBuser; |
|
158 | +} |
|
159 | +?>" /> |
|
148 | 160 | </p> |
149 | 161 | <p> |
150 | 162 | <label for="dbuserpass">Database user password</label> |
151 | - <input type="password" name="dbuserpass" id="dbuserpass" value="<?php if (isset($globalDBpass)) print $globalDBpass; ?>" /> |
|
163 | + <input type="password" name="dbuserpass" id="dbuserpass" value="<?php if (isset($globalDBpass)) { |
|
164 | + print $globalDBpass; |
|
165 | +} |
|
166 | +?>" /> |
|
152 | 167 | </p> |
153 | 168 | </fieldset> |
154 | 169 | <fieldset id="site"> |
155 | 170 | <legend>Site configuration</legend> |
156 | 171 | <p> |
157 | 172 | <label for="sitename">Site name</label> |
158 | - <input type="text" name="sitename" id="sitename" value="<?php if (isset($globalName)) print $globalName; ?>" /> |
|
173 | + <input type="text" name="sitename" id="sitename" value="<?php if (isset($globalName)) { |
|
174 | + print $globalName; |
|
175 | +} |
|
176 | +?>" /> |
|
159 | 177 | </p> |
160 | 178 | <p> |
161 | 179 | <label for="siteurl">Site directory</label> |
162 | - <input type="text" name="siteurl" id="siteurl" value="<?php if (isset($globalURL)) print $globalURL; ?>" /> |
|
180 | + <input type="text" name="siteurl" id="siteurl" value="<?php if (isset($globalURL)) { |
|
181 | + print $globalURL; |
|
182 | +} |
|
183 | +?>" /> |
|
163 | 184 | <p class="help-block">Can be null. ex : <i>flightairmap</i> if complete URL is <i>http://toto.com/flightairmap</i></p> |
164 | 185 | </p> |
165 | 186 | <p> |
166 | 187 | <label for="timezone">Timezone</label> |
167 | - <input type="text" name="timezone" id="timezone" value="<?php if (isset($globalTimezone)) print $globalTimezone; ?>" /> |
|
188 | + <input type="text" name="timezone" id="timezone" value="<?php if (isset($globalTimezone)) { |
|
189 | + print $globalTimezone; |
|
190 | +} |
|
191 | +?>" /> |
|
168 | 192 | <p class="help-block">ex : UTC, Europe/Paris,...</p> |
169 | 193 | </p> |
170 | 194 | <p> |
171 | 195 | <label for="language">Language</label> |
172 | - <input type="text" name="language" id="language" value="<?php if (isset($globalLanguage)) print $globalLanguage; ?>" /> |
|
196 | + <input type="text" name="language" id="language" value="<?php if (isset($globalLanguage)) { |
|
197 | + print $globalLanguage; |
|
198 | +} |
|
199 | +?>" /> |
|
173 | 200 | <p class="help-block">Used only when link to wikipedia for now. Can be EN,DE,FR,...</p> |
174 | 201 | </p> |
175 | 202 | </fieldset> |
@@ -190,11 +217,17 @@ discard block |
||
190 | 217 | <div id="mapbox_data"> |
191 | 218 | <p> |
192 | 219 | <label for="mapboxid">Mapbox id</label> |
193 | - <input type="text" name="mapboxid" id="mapboxid" value="<?php if (isset($globalMapboxId)) print $globalMapboxId; ?>" /> |
|
220 | + <input type="text" name="mapboxid" id="mapboxid" value="<?php if (isset($globalMapboxId)) { |
|
221 | + print $globalMapboxId; |
|
222 | +} |
|
223 | +?>" /> |
|
194 | 224 | </p> |
195 | 225 | <p> |
196 | 226 | <label for="mapboxtoken">Mapbox token</label> |
197 | - <input type="text" name="mapboxtoken" id="mapboxtoken" value="<?php if (isset($globalMapboxToken)) print $globalMapboxToken; ?>" /> |
|
227 | + <input type="text" name="mapboxtoken" id="mapboxtoken" value="<?php if (isset($globalMapboxToken)) { |
|
228 | + print $globalMapboxToken; |
|
229 | +} |
|
230 | +?>" /> |
|
198 | 231 | </p> |
199 | 232 | <p class="help-block">Get a key <a href="https://www.mapbox.com/developers/">here</a></p> |
200 | 233 | </div> |
@@ -202,7 +235,10 @@ discard block |
||
202 | 235 | <div id="google_data"> |
203 | 236 | <p> |
204 | 237 | <label for="googlekey">Google API key</label> |
205 | - <input type="text" name="googlekey" id="googlekey" value="<?php if (isset($globalGoogleAPIKey)) print $globalGoogleAPIKey; ?>" /> |
|
238 | + <input type="text" name="googlekey" id="googlekey" value="<?php if (isset($globalGoogleAPIKey)) { |
|
239 | + print $globalGoogleAPIKey; |
|
240 | +} |
|
241 | +?>" /> |
|
206 | 242 | <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> |
207 | 243 | </p> |
208 | 244 | </div> |
@@ -210,7 +246,10 @@ discard block |
||
210 | 246 | <div id="bing_data"> |
211 | 247 | <p> |
212 | 248 | <label for="bingkey">Bing Map key</label> |
213 | - <input type="text" name="bingkey" id="bingkey" value="<?php if (isset($globalBingMapKey)) print $globalBingMapKey; ?>" /> |
|
249 | + <input type="text" name="bingkey" id="bingkey" value="<?php if (isset($globalBingMapKey)) { |
|
250 | + print $globalBingMapKey; |
|
251 | +} |
|
252 | +?>" /> |
|
214 | 253 | <p class="help-block">Get a key <a href="https://www.bingmapsportal.com/">here</a></p> |
215 | 254 | </p> |
216 | 255 | </div> |
@@ -218,7 +257,10 @@ discard block |
||
218 | 257 | <div id="mapquest_data"> |
219 | 258 | <p> |
220 | 259 | <label for="mapquestkey">MapQuest key</label> |
221 | - <input type="text" name="mapquestkey" id="mapquestkey" value="<?php if (isset($globalMapQuestKey)) print $globalMapQuestKey; ?>" /> |
|
260 | + <input type="text" name="mapquestkey" id="mapquestkey" value="<?php if (isset($globalMapQuestKey)) { |
|
261 | + print $globalMapQuestKey; |
|
262 | +} |
|
263 | +?>" /> |
|
222 | 264 | <p class="help-block">Get a key <a href="https://developer.mapquest.com/user/me/apps">here</a></p> |
223 | 265 | </p> |
224 | 266 | </div> |
@@ -226,11 +268,17 @@ discard block |
||
226 | 268 | <div id="here_data"> |
227 | 269 | <p> |
228 | 270 | <label for="hereappid">Here App_Id</label> |
229 | - <input type="text" name="hereappid" id="hereappid" value="<?php if (isset($globalHereappId)) print $globalHereappId; ?>" /> |
|
271 | + <input type="text" name="hereappid" id="hereappid" value="<?php if (isset($globalHereappId)) { |
|
272 | + print $globalHereappId; |
|
273 | +} |
|
274 | +?>" /> |
|
230 | 275 | </p> |
231 | 276 | <p> |
232 | 277 | <label for="hereappcode">Here App_Code</label> |
233 | - <input type="text" name="hereappcode" id="hereappcode" value="<?php if (isset($globalHereappCode)) print $globalHereappCode; ?>" /> |
|
278 | + <input type="text" name="hereappcode" id="hereappcode" value="<?php if (isset($globalHereappCode)) { |
|
279 | + print $globalHereappCode; |
|
280 | +} |
|
281 | +?>" /> |
|
234 | 282 | </p> |
235 | 283 | <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> |
236 | 284 | </div> |
@@ -239,42 +287,86 @@ discard block |
||
239 | 287 | <legend>Coverage area</legend> |
240 | 288 | <p> |
241 | 289 | <label for="latitudemax">The maximum latitude (north)</label> |
242 | - <input type="text" name="latitudemax" id="latitudemax" value="<?php if (isset($globalLatitudeMax)) print $globalLatitudeMax; ?>" /> |
|
290 | + <input type="text" name="latitudemax" id="latitudemax" value="<?php if (isset($globalLatitudeMax)) { |
|
291 | + print $globalLatitudeMax; |
|
292 | +} |
|
293 | +?>" /> |
|
243 | 294 | </p> |
244 | 295 | <p> |
245 | 296 | <label for="latitudemin">The minimum latitude (south)</label> |
246 | - <input type="text" name="latitudemin" id="latitudemin" value="<?php if (isset($globalLatitudeMin)) print $globalLatitudeMin; ?>" /> |
|
297 | + <input type="text" name="latitudemin" id="latitudemin" value="<?php if (isset($globalLatitudeMin)) { |
|
298 | + print $globalLatitudeMin; |
|
299 | +} |
|
300 | +?>" /> |
|
247 | 301 | </p> |
248 | 302 | <p> |
249 | 303 | <label for="longitudemax">The maximum longitude (west)</label> |
250 | - <input type="text" name="longitudemax" id="longitudemax" value="<?php if (isset($globalLongitudeMax)) print $globalLongitudeMax; ?>" /> |
|
304 | + <input type="text" name="longitudemax" id="longitudemax" value="<?php if (isset($globalLongitudeMax)) { |
|
305 | + print $globalLongitudeMax; |
|
306 | +} |
|
307 | +?>" /> |
|
251 | 308 | </p> |
252 | 309 | <p> |
253 | 310 | <label for="longitudemin">The minimum longitude (east)</label> |
254 | - <input type="text" name="longitudemin" id="longitudemin" value="<?php if (isset($globalLongitudeMin)) print $globalLongitudeMin; ?>" /> |
|
311 | + <input type="text" name="longitudemin" id="longitudemin" value="<?php if (isset($globalLongitudeMin)) { |
|
312 | + print $globalLongitudeMin; |
|
313 | +} |
|
314 | +?>" /> |
|
255 | 315 | </p> |
256 | 316 | <p> |
257 | 317 | <label for="latitudecenter">The latitude center</label> |
258 | - <input type="text" name="latitudecenter" id="latitudecenter" value="<?php if (isset($globalCenterLatitude)) print $globalCenterLatitude; ?>" /> |
|
318 | + <input type="text" name="latitudecenter" id="latitudecenter" value="<?php if (isset($globalCenterLatitude)) { |
|
319 | + print $globalCenterLatitude; |
|
320 | +} |
|
321 | +?>" /> |
|
259 | 322 | </p> |
260 | 323 | <p> |
261 | 324 | <label for="longitudecenter">The longitude center</label> |
262 | - <input type="text" name="longitudecenter" id="longitudecenter" value="<?php if (isset($globalCenterLongitude)) print $globalCenterLongitude; ?>" /> |
|
325 | + <input type="text" name="longitudecenter" id="longitudecenter" value="<?php if (isset($globalCenterLongitude)) { |
|
326 | + print $globalCenterLongitude; |
|
327 | +} |
|
328 | +?>" /> |
|
263 | 329 | </p> |
264 | 330 | <p> |
265 | 331 | <label for="livezoom">Default Zoom on live map</label> |
266 | - <input type="number" name="livezoom" id="livezoom" value="<?php if (isset($globalLiveZoom)) print $globalLiveZoom; else print '9'; ?>" /> |
|
332 | + <input type="number" name="livezoom" id="livezoom" value="<?php if (isset($globalLiveZoom)) { |
|
333 | + print $globalLiveZoom; |
|
334 | +} else { |
|
335 | + print '9'; |
|
336 | +} |
|
337 | +?>" /> |
|
267 | 338 | </p> |
268 | 339 | <p> |
269 | 340 | <label for="squawk_country">Country for squawk usage</label> |
270 | 341 | <select name="squawk_country" id="squawk_country"> |
271 | - <option value="UK"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'UK') print ' selected '; ?>>UK</option> |
|
272 | - <option value="NZ"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'NZ') print ' selected '; ?>>NZ</option> |
|
273 | - <option value="US"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'US') print ' selected '; ?>>US</option> |
|
274 | - <option value="AU"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'AU') print ' selected '; ?>>AU</option> |
|
275 | - <option value="NL"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'NL') print ' selected '; ?>>NL</option> |
|
276 | - <option value="FR"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'FR') print ' selected '; ?>>FR</option> |
|
277 | - <option value="TR"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'TR') print ' selected '; ?>>TR</option> |
|
342 | + <option value="UK"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'UK') { |
|
343 | + print ' selected '; |
|
344 | +} |
|
345 | +?>>UK</option> |
|
346 | + <option value="NZ"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'NZ') { |
|
347 | + print ' selected '; |
|
348 | +} |
|
349 | +?>>NZ</option> |
|
350 | + <option value="US"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'US') { |
|
351 | + print ' selected '; |
|
352 | +} |
|
353 | +?>>US</option> |
|
354 | + <option value="AU"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'AU') { |
|
355 | + print ' selected '; |
|
356 | +} |
|
357 | +?>>AU</option> |
|
358 | + <option value="NL"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'NL') { |
|
359 | + print ' selected '; |
|
360 | +} |
|
361 | +?>>NL</option> |
|
362 | + <option value="FR"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'FR') { |
|
363 | + print ' selected '; |
|
364 | +} |
|
365 | +?>>FR</option> |
|
366 | + <option value="TR"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'TR') { |
|
367 | + print ' selected '; |
|
368 | +} |
|
369 | +?>>TR</option> |
|
278 | 370 | </select> |
279 | 371 | </p> |
280 | 372 | </fieldset> |
@@ -283,15 +375,24 @@ discard block |
||
283 | 375 | <p><i>Only put in DB flights that are inside a circle</i></p> |
284 | 376 | <p> |
285 | 377 | <label for="latitude">Center latitude</label> |
286 | - <input type="text" name="zoilatitude" id="latitude" value="<?php if (isset($globalDistanceIgnore['latitude'])) echo $globalDistanceIgnore['latitude']; ?>" /> |
|
378 | + <input type="text" name="zoilatitude" id="latitude" value="<?php if (isset($globalDistanceIgnore['latitude'])) { |
|
379 | + echo $globalDistanceIgnore['latitude']; |
|
380 | +} |
|
381 | +?>" /> |
|
287 | 382 | </p> |
288 | 383 | <p> |
289 | 384 | <label for="longitude">Center longitude</label> |
290 | - <input type="text" name="zoilongitude" id="longitude" value="<?php if (isset($globalDistanceIgnore['longitude'])) echo $globalDistanceIgnore['longitude']; ?>" /> |
|
385 | + <input type="text" name="zoilongitude" id="longitude" value="<?php if (isset($globalDistanceIgnore['longitude'])) { |
|
386 | + echo $globalDistanceIgnore['longitude']; |
|
387 | +} |
|
388 | +?>" /> |
|
291 | 389 | </p> |
292 | 390 | <p> |
293 | 391 | <label for="Distance">Distance (in km)</label> |
294 | - <input type="text" name="zoidistance" id="distance" value="<?php if (isset($globalDistanceIgnore['distance'])) echo $globalDistanceIgnore['distance']; ?>" /> |
|
392 | + <input type="text" name="zoidistance" id="distance" value="<?php if (isset($globalDistanceIgnore['distance'])) { |
|
393 | + echo $globalDistanceIgnore['distance']; |
|
394 | +} |
|
395 | +?>" /> |
|
295 | 396 | </p> |
296 | 397 | </fieldset> |
297 | 398 | <fieldset id="sourceloc"> |
@@ -399,11 +500,17 @@ discard block |
||
399 | 500 | <div id="flightaware_data"> |
400 | 501 | <p> |
401 | 502 | <label for="flightawareusername">FlightAware username</label> |
402 | - <input type="text" name="flightawareusername" id="flightawareusername" value="<?php if (isset($globalFlightAwareUsername)) print $globalFlightAwareUsername; ?>" /> |
|
503 | + <input type="text" name="flightawareusername" id="flightawareusername" value="<?php if (isset($globalFlightAwareUsername)) { |
|
504 | + print $globalFlightAwareUsername; |
|
505 | +} |
|
506 | +?>" /> |
|
403 | 507 | </p> |
404 | 508 | <p> |
405 | 509 | <label for="flightawarepassword">FlightAware password/API key</label> |
406 | - <input type="text" name="flightawarepassword" id="flightawarepassword" value="<?php if (isset($globalFlightAwarePassword)) print $globalFlightAwarePassword; ?>" /> |
|
510 | + <input type="text" name="flightawarepassword" id="flightawarepassword" value="<?php if (isset($globalFlightAwarePassword)) { |
|
511 | + print $globalFlightAwarePassword; |
|
512 | +} |
|
513 | +?>" /> |
|
407 | 514 | </p> |
408 | 515 | </div> |
409 | 516 | --> |
@@ -463,28 +570,88 @@ discard block |
||
463 | 570 | ?> |
464 | 571 | <td> |
465 | 572 | <select name="format[]" id="format"> |
466 | - <option value="auto" <?php if (!isset($source['format'])) print 'selected'; ?>>Auto</option> |
|
467 | - <option value="sbs" <?php if (isset($source['format']) && $source['format'] == 'sbs') print 'selected'; ?>>SBS</option> |
|
468 | - <option value="tsv" <?php if (isset($source['format']) && $source['format'] == 'tsv') print 'selected'; ?>>TSV</option> |
|
469 | - <option value="raw" <?php if (isset($source['format']) && $source['format'] == 'raw') print 'selected'; ?>>Raw</option> |
|
470 | - <option value="aprs" <?php if (isset($source['format']) && $source['format'] == 'aprs') print 'selected'; ?>>APRS</option> |
|
471 | - <option value="deltadbtxt" <?php if (isset($source['format']) && $source['format'] == 'deltadbtxt') print 'selected'; ?>>Radarcape deltadb.txt</option> |
|
472 | - <option value="vatsimtxt" <?php if (isset($source['format']) && $source['format'] == 'vatsimtxt') print 'selected'; ?>>Vatsim</option> |
|
473 | - <option value="aircraftlistjson" <?php if (isset($source['format']) && $source['format'] == 'aircraftlistjson') print 'selected'; ?>>Virtual Radar Server AircraftList.json</option> |
|
474 | - <option value="vrstcp" <?php if (isset($source['format']) && $source['format'] == 'vrstcp') print 'selected'; ?>>Virtual Radar Server TCP</option> |
|
475 | - <option value="phpvmacars" <?php if (isset($source['format']) && $source['format'] == 'phpvmacars') print 'selected'; ?>>phpVMS</option> |
|
476 | - <option value="vam" <?php if (isset($source['format']) && $source['format'] == 'vam') print 'selected'; ?>>Virtual Airlines Manager</option> |
|
477 | - <option value="whazzup" <?php if (isset($source['format']) && $source['format'] == 'whazzup') print 'selected'; ?>>IVAO</option> |
|
478 | - <option value="flightgearmp" <?php if (isset($source['format']) && $source['format'] == 'flightgearmp') print 'selected'; ?>>FlightGear Multiplayer</option> |
|
479 | - <option value="flightgearsp" <?php if (isset($source['format']) && $source['format'] == 'flightgearsp') print 'selected'; ?>>FlightGear Singleplayer</option> |
|
480 | - <option value="acars" <?php if (isset($source['format']) && $source['format'] == 'acars') print 'selected'; ?>>ACARS from acarsdec/acarsdeco2 over UDP</option> |
|
481 | - <option value="acarssbs3" <?php if (isset($source['format']) && $source['format'] == 'acarssbs3') print 'selected'; ?>>ACARS SBS-3 over TCP</option> |
|
482 | - <option value="ais" <?php if (isset($source['format']) && $source['format'] == 'ais') print 'selected'; ?>>NMEA AIS over TCP</option> |
|
573 | + <option value="auto" <?php if (!isset($source['format'])) { |
|
574 | + print 'selected'; |
|
575 | +} |
|
576 | +?>>Auto</option> |
|
577 | + <option value="sbs" <?php if (isset($source['format']) && $source['format'] == 'sbs') { |
|
578 | + print 'selected'; |
|
579 | +} |
|
580 | +?>>SBS</option> |
|
581 | + <option value="tsv" <?php if (isset($source['format']) && $source['format'] == 'tsv') { |
|
582 | + print 'selected'; |
|
583 | +} |
|
584 | +?>>TSV</option> |
|
585 | + <option value="raw" <?php if (isset($source['format']) && $source['format'] == 'raw') { |
|
586 | + print 'selected'; |
|
587 | +} |
|
588 | +?>>Raw</option> |
|
589 | + <option value="aprs" <?php if (isset($source['format']) && $source['format'] == 'aprs') { |
|
590 | + print 'selected'; |
|
591 | +} |
|
592 | +?>>APRS</option> |
|
593 | + <option value="deltadbtxt" <?php if (isset($source['format']) && $source['format'] == 'deltadbtxt') { |
|
594 | + print 'selected'; |
|
595 | +} |
|
596 | +?>>Radarcape deltadb.txt</option> |
|
597 | + <option value="vatsimtxt" <?php if (isset($source['format']) && $source['format'] == 'vatsimtxt') { |
|
598 | + print 'selected'; |
|
599 | +} |
|
600 | +?>>Vatsim</option> |
|
601 | + <option value="aircraftlistjson" <?php if (isset($source['format']) && $source['format'] == 'aircraftlistjson') { |
|
602 | + print 'selected'; |
|
603 | +} |
|
604 | +?>>Virtual Radar Server AircraftList.json</option> |
|
605 | + <option value="vrstcp" <?php if (isset($source['format']) && $source['format'] == 'vrstcp') { |
|
606 | + print 'selected'; |
|
607 | +} |
|
608 | +?>>Virtual Radar Server TCP</option> |
|
609 | + <option value="phpvmacars" <?php if (isset($source['format']) && $source['format'] == 'phpvmacars') { |
|
610 | + print 'selected'; |
|
611 | +} |
|
612 | +?>>phpVMS</option> |
|
613 | + <option value="vam" <?php if (isset($source['format']) && $source['format'] == 'vam') { |
|
614 | + print 'selected'; |
|
615 | +} |
|
616 | +?>>Virtual Airlines Manager</option> |
|
617 | + <option value="whazzup" <?php if (isset($source['format']) && $source['format'] == 'whazzup') { |
|
618 | + print 'selected'; |
|
619 | +} |
|
620 | +?>>IVAO</option> |
|
621 | + <option value="flightgearmp" <?php if (isset($source['format']) && $source['format'] == 'flightgearmp') { |
|
622 | + print 'selected'; |
|
623 | +} |
|
624 | +?>>FlightGear Multiplayer</option> |
|
625 | + <option value="flightgearsp" <?php if (isset($source['format']) && $source['format'] == 'flightgearsp') { |
|
626 | + print 'selected'; |
|
627 | +} |
|
628 | +?>>FlightGear Singleplayer</option> |
|
629 | + <option value="acars" <?php if (isset($source['format']) && $source['format'] == 'acars') { |
|
630 | + print 'selected'; |
|
631 | +} |
|
632 | +?>>ACARS from acarsdec/acarsdeco2 over UDP</option> |
|
633 | + <option value="acarssbs3" <?php if (isset($source['format']) && $source['format'] == 'acarssbs3') { |
|
634 | + print 'selected'; |
|
635 | +} |
|
636 | +?>>ACARS SBS-3 over TCP</option> |
|
637 | + <option value="ais" <?php if (isset($source['format']) && $source['format'] == 'ais') { |
|
638 | + print 'selected'; |
|
639 | +} |
|
640 | +?>>NMEA AIS over TCP</option> |
|
483 | 641 | </select> |
484 | 642 | </td> |
485 | - <td><input type="text" name="name[]" id="name" value="<?php if (isset($source['name'])) print $source['name']; ?>" /></td> |
|
486 | - <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> |
|
487 | - <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> |
|
643 | + <td><input type="text" name="name[]" id="name" value="<?php if (isset($source['name'])) { |
|
644 | + print $source['name']; |
|
645 | +} |
|
646 | +?>" /></td> |
|
647 | + <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']) { |
|
648 | + print 'checked'; |
|
649 | +} |
|
650 | +?> /></td> |
|
651 | + <td><input type="checkbox" name="noarchive[]" id="noarchive" title="Don't archive this source" value="1" <?php if (isset($source['noarchive']) && $source['noarchive']) { |
|
652 | + print 'checked'; |
|
653 | +} |
|
654 | +?> /></td> |
|
488 | 655 | <td><input type="button" id="delhost" value="Delete" onclick="deleteRow(this)" /> <input type="button" id="addhost" value="Add" onclick="insRow()" /></td> |
489 | 656 | </tr> |
490 | 657 | <?php |
@@ -533,11 +700,17 @@ discard block |
||
533 | 700 | <p>Listen UDP server for acarsdec/acarsdeco2/... with <i>daemon-acars.php</i> script</p> |
534 | 701 | <p> |
535 | 702 | <label for="acarshost">ACARS UDP host</label> |
536 | - <input type="text" name="acarshost" id="acarshost" value="<?php if (isset($globalACARSHost)) print $globalACARSHost; ?>" /> |
|
703 | + <input type="text" name="acarshost" id="acarshost" value="<?php if (isset($globalACARSHost)) { |
|
704 | + print $globalACARSHost; |
|
705 | +} |
|
706 | +?>" /> |
|
537 | 707 | </p> |
538 | 708 | <p> |
539 | 709 | <label for="acarsport">ACARS UDP port</label> |
540 | - <input type="number" name="acarsport" id="acarsport" value="<?php if (isset($globalACARSPort)) print $globalACARSPort; ?>" /> |
|
710 | + <input type="number" name="acarsport" id="acarsport" value="<?php if (isset($globalACARSPort)) { |
|
711 | + print $globalACARSPort; |
|
712 | +} |
|
713 | +?>" /> |
|
541 | 714 | </p> |
542 | 715 | </fieldset> |
543 | 716 | </div> |
@@ -617,13 +790,19 @@ discard block |
||
617 | 790 | <div id="schedules_options"> |
618 | 791 | <p> |
619 | 792 | <label for="britishairways">British Airways API Key</label> |
620 | - <input type="text" name="britishairways" id="britishairways" value="<?php if (isset($globalBritishAirwaysKey)) print $globalBritishAirwaysKey; ?>" /> |
|
793 | + <input type="text" name="britishairways" id="britishairways" value="<?php if (isset($globalBritishAirwaysKey)) { |
|
794 | + print $globalBritishAirwaysKey; |
|
795 | +} |
|
796 | +?>" /> |
|
621 | 797 | <p class="help-block">Register an account on <a href="https://developer.ba.com/">https://developer.ba.com/</a></p> |
622 | 798 | </p> |
623 | 799 | <!-- |
624 | 800 | <p> |
625 | 801 | <label for="transavia">Transavia Test API Consumer Key</label> |
626 | - <input type="text" name="transavia" id="transavia" value="<?php if (isset($globalTransaviaKey)) print $globalTransaviaKey; ?>" /> |
|
802 | + <input type="text" name="transavia" id="transavia" value="<?php if (isset($globalTransaviaKey)) { |
|
803 | + print $globalTransaviaKey; |
|
804 | +} |
|
805 | +?>" /> |
|
627 | 806 | <p class="help-block">Register an account on <a href="https://developer.transavia.com">https://developer.transavia.com</a></p> |
628 | 807 | </p> |
629 | 808 | --> |
@@ -632,10 +811,16 @@ discard block |
||
632 | 811 | <b>Lufthansa API Key</b> |
633 | 812 | <p> |
634 | 813 | <label for="lufthansakey">Key</label> |
635 | - <input type="text" name="lufthansakey" id="lufthansakey" value="<?php if (isset($globalLufthansaKey['key'])) print $globalLufthansaKey['key']; ?>" /> |
|
814 | + <input type="text" name="lufthansakey" id="lufthansakey" value="<?php if (isset($globalLufthansaKey['key'])) { |
|
815 | + print $globalLufthansaKey['key']; |
|
816 | +} |
|
817 | +?>" /> |
|
636 | 818 | </p><p> |
637 | 819 | <label for="lufthansasecret">Secret</label> |
638 | - <input type="text" name="lufthansasecret" id="lufthansasecret" value="<?php if (isset($globalLufthansaKey['secret'])) print $globalLufthansaKey['secret']; ?>" /> |
|
820 | + <input type="text" name="lufthansasecret" id="lufthansasecret" value="<?php if (isset($globalLufthansaKey['secret'])) { |
|
821 | + print $globalLufthansaKey['secret']; |
|
822 | +} |
|
823 | +?>" /> |
|
639 | 824 | </p> |
640 | 825 | </div> |
641 | 826 | <p class="help-block">Register an account on <a href="https://developer.lufthansa.com/page">https://developer.lufthansa.com/page</a></p> |
@@ -655,7 +840,10 @@ discard block |
||
655 | 840 | </p> |
656 | 841 | <p> |
657 | 842 | <label for="notamsource">URL of your feed from notaminfo.com</label> |
658 | - <input type="text" name="notamsource" id="notamsource" value="<?php if (isset($globalNOTAMSource)) print $globalNOTAMSource; ?>" /> |
|
843 | + <input type="text" name="notamsource" id="notamsource" value="<?php if (isset($globalNOTAMSource)) { |
|
844 | + print $globalNOTAMSource; |
|
845 | +} |
|
846 | +?>" /> |
|
659 | 847 | <p class="help-block">If you want to use world NOTAM from FlightAirMap website, leave it blank</p> |
660 | 848 | </p> |
661 | 849 | <br /> |
@@ -671,14 +859,20 @@ discard block |
||
671 | 859 | <div id="metarsrc"> |
672 | 860 | <p> |
673 | 861 | <label for="metarsource">URL of your METAR source</label> |
674 | - <input type="text" name="metarsource" id="metarsource" value="<?php if (isset($globalMETARurl)) print $globalMETARurl; ?>" /> |
|
862 | + <input type="text" name="metarsource" id="metarsource" value="<?php if (isset($globalMETARurl)) { |
|
863 | + print $globalMETARurl; |
|
864 | +} |
|
865 | +?>" /> |
|
675 | 866 | <p class="help-block">Use {icao} to specify where we replace by airport icao. ex : http://metar.vatsim.net/metar.php?id={icao}</p> |
676 | 867 | </p> |
677 | 868 | </div> |
678 | 869 | <br /> |
679 | 870 | <p> |
680 | 871 | <label for="bitly">Bit.ly access token api (used in search page)</label> |
681 | - <input type="text" name="bitly" id="bitly" value="<?php if (isset($globalBitlyAccessToken)) print $globalBitlyAccessToken; ?>" /> |
|
872 | + <input type="text" name="bitly" id="bitly" value="<?php if (isset($globalBitlyAccessToken)) { |
|
873 | + print $globalBitlyAccessToken; |
|
874 | +} |
|
875 | +?>" /> |
|
682 | 876 | </p> |
683 | 877 | <br /> |
684 | 878 | <p> |
@@ -698,7 +892,12 @@ discard block |
||
698 | 892 | </p> |
699 | 893 | <p> |
700 | 894 | <label for="archivemonths">Generate statistics, delete or put in archive flights older than xx months</label> |
701 | - <input type="number" name="archivemonths" id="archivemonths" value="<?php if (isset($globalArchiveMonths)) print $globalArchiveMonths; else echo '0'; ?>" /> |
|
895 | + <input type="number" name="archivemonths" id="archivemonths" value="<?php if (isset($globalArchiveMonths)) { |
|
896 | + print $globalArchiveMonths; |
|
897 | +} else { |
|
898 | + echo '0'; |
|
899 | +} |
|
900 | +?>" /> |
|
702 | 901 | <p class="help-block">0 to disable, delete old flight if <i>Archive all flights data</i> is disabled</p> |
703 | 902 | </p> |
704 | 903 | <p> |
@@ -708,12 +907,22 @@ discard block |
||
708 | 907 | </p> |
709 | 908 | <p> |
710 | 909 | <label for="archivekeepmonths">Keep flights data for xx months in archive</label> |
711 | - <input type="number" name="archivekeepmonths" id="archivekeepmonths" value="<?php if (isset($globalArchiveKeepMonths)) print $globalArchiveKeepMonths; else echo '0'; ?>" /> |
|
910 | + <input type="number" name="archivekeepmonths" id="archivekeepmonths" value="<?php if (isset($globalArchiveKeepMonths)) { |
|
911 | + print $globalArchiveKeepMonths; |
|
912 | +} else { |
|
913 | + echo '0'; |
|
914 | +} |
|
915 | +?>" /> |
|
712 | 916 | <p class="help-block">0 to disable</p> |
713 | 917 | </p> |
714 | 918 | <p> |
715 | 919 | <label for="archivekeeptrackmonths">Keep flights track data for xx months in archive</label> |
716 | - <input type="number" name="archivekeeptrackmonths" id="archivekeeptrackmonths" value="<?php if (isset($globalArchiveKeepTrackMonths)) print $globalArchiveKeepTrackMonths; else echo '0'; ?>" /> |
|
920 | + <input type="number" name="archivekeeptrackmonths" id="archivekeeptrackmonths" value="<?php if (isset($globalArchiveKeepTrackMonths)) { |
|
921 | + print $globalArchiveKeepTrackMonths; |
|
922 | +} else { |
|
923 | + echo '0'; |
|
924 | +} |
|
925 | +?>" /> |
|
717 | 926 | <p class="help-block">0 to disable, should be less or egal to <i>Keep flights data</i> value</p> |
718 | 927 | </p> |
719 | 928 | <br /> |
@@ -723,7 +932,12 @@ discard block |
||
723 | 932 | <p class="help-block">Uncheck if the script is running as cron job</p> |
724 | 933 | <div id="cronends"> |
725 | 934 | <label for="cronend">Run script for xx seconds</label> |
726 | - <input type="number" name="cronend" id="cronend" value="<?php if (isset($globalCronEnd)) print $globalCronEnd; else print '0'; ?>" /> |
|
935 | + <input type="number" name="cronend" id="cronend" value="<?php if (isset($globalCronEnd)) { |
|
936 | + print $globalCronEnd; |
|
937 | +} else { |
|
938 | + print '0'; |
|
939 | +} |
|
940 | +?>" /> |
|
727 | 941 | <p class="help-block">Set to 0 to disable. Should be disabled if source is URL.</p> |
728 | 942 | </div> |
729 | 943 | </p> |
@@ -772,15 +986,30 @@ discard block |
||
772 | 986 | <br /> |
773 | 987 | <p> |
774 | 988 | <label for="refresh">Show flights detected since xxx seconds</label> |
775 | - <input type="number" name="refresh" id="refresh" value="<?php if (isset($globalLiveInterval)) echo $globalLiveInterval; else echo '200'; ?>" /> |
|
989 | + <input type="number" name="refresh" id="refresh" value="<?php if (isset($globalLiveInterval)) { |
|
990 | + echo $globalLiveInterval; |
|
991 | +} else { |
|
992 | + echo '200'; |
|
993 | +} |
|
994 | +?>" /> |
|
776 | 995 | </p> |
777 | 996 | <p> |
778 | 997 | <label for="maprefresh">Live map refresh (in seconds)</label> |
779 | - <input type="number" name="maprefresh" id="maprefresh" value="<?php if (isset($globalMapRefresh)) echo $globalMapRefresh; else echo '30'; ?>" /> |
|
998 | + <input type="number" name="maprefresh" id="maprefresh" value="<?php if (isset($globalMapRefresh)) { |
|
999 | + echo $globalMapRefresh; |
|
1000 | +} else { |
|
1001 | + echo '30'; |
|
1002 | +} |
|
1003 | +?>" /> |
|
780 | 1004 | </p> |
781 | 1005 | <p> |
782 | 1006 | <label for="mapidle">Map idle timeout (in minutes)</label> |
783 | - <input type="number" name="mapidle" id="mapidle" value="<?php if (isset($globalMapIdleTimeout)) echo $globalMapIdleTimeout; else echo '30'; ?>" /> |
|
1007 | + <input type="number" name="mapidle" id="mapidle" value="<?php if (isset($globalMapIdleTimeout)) { |
|
1008 | + echo $globalMapIdleTimeout; |
|
1009 | +} else { |
|
1010 | + echo '30'; |
|
1011 | +} |
|
1012 | +?>" /> |
|
784 | 1013 | <p class="help-block">0 to disable</p> |
785 | 1014 | </p> |
786 | 1015 | <p> |
@@ -790,12 +1019,20 @@ discard block |
||
790 | 1019 | <br /> |
791 | 1020 | <p> |
792 | 1021 | <label for="closestmindist">Distance to airport set as arrival (in km)</label> |
793 | - <input type="number" name="closestmindist" id="closestmindist" value="<?php if (isset($globalClosestMinDist)) echo $globalClosestMinDist; else echo '50'; ?>" /> |
|
1022 | + <input type="number" name="closestmindist" id="closestmindist" value="<?php if (isset($globalClosestMinDist)) { |
|
1023 | + echo $globalClosestMinDist; |
|
1024 | +} else { |
|
1025 | + echo '50'; |
|
1026 | +} |
|
1027 | +?>" /> |
|
794 | 1028 | </p> |
795 | 1029 | <br /> |
796 | 1030 | <p> |
797 | 1031 | <label for="aircraftsize">Size of aircraft icon on map (default to 30px if zoom > 7 else 15px), empty to default</label> |
798 | - <input type="number" name="aircraftsize" id="aircraftsize" value="<?php if (isset($globalAircraftSize)) echo $globalAircraftSize;?>" /> |
|
1032 | + <input type="number" name="aircraftsize" id="aircraftsize" value="<?php if (isset($globalAircraftSize)) { |
|
1033 | + echo $globalAircraftSize; |
|
1034 | +} |
|
1035 | +?>" /> |
|
799 | 1036 | </p> |
800 | 1037 | <br /> |
801 | 1038 | <p> |
@@ -808,7 +1045,12 @@ discard block |
||
808 | 1045 | if (extension_loaded('gd') && function_exists('gd_info')) { |
809 | 1046 | ?> |
810 | 1047 | <label for="aircrafticoncolor">Color of aircraft icon on map</label> |
811 | - <input type="color" name="aircrafticoncolor" id="aircrafticoncolor" value="#<?php if (isset($globalAircraftIconColor)) echo $globalAircraftIconColor; else echo '1a3151'; ?>" /> |
|
1048 | + <input type="color" name="aircrafticoncolor" id="aircrafticoncolor" value="#<?php if (isset($globalAircraftIconColor)) { |
|
1049 | + echo $globalAircraftIconColor; |
|
1050 | +} else { |
|
1051 | + echo '1a3151'; |
|
1052 | +} |
|
1053 | +?>" /> |
|
812 | 1054 | <?php |
813 | 1055 | if (!is_writable('../cache')) { |
814 | 1056 | ?> |
@@ -826,14 +1068,27 @@ discard block |
||
826 | 1068 | <p> |
827 | 1069 | <label for="airportzoom">Zoom level minimum to see airports icons</label> |
828 | 1070 | <div class="range"> |
829 | - <input type="range" name="airportzoom" id="airportzoom" value="<?php if (isset($globalAirportZoom)) echo $globalAirportZoom; else echo '7'; ?>" /> |
|
830 | - <output id="range"><?php if (isset($globalAirportZoom)) echo $globalAirportZoom; else echo '7'; ?></output> |
|
1071 | + <input type="range" name="airportzoom" id="airportzoom" value="<?php if (isset($globalAirportZoom)) { |
|
1072 | + echo $globalAirportZoom; |
|
1073 | +} else { |
|
1074 | + echo '7'; |
|
1075 | +} |
|
1076 | +?>" /> |
|
1077 | + <output id="range"><?php if (isset($globalAirportZoom)) { |
|
1078 | + echo $globalAirportZoom; |
|
1079 | +} else { |
|
1080 | + echo '7'; |
|
1081 | +} |
|
1082 | +?></output> |
|
831 | 1083 | </div> |
832 | 1084 | </p> |
833 | 1085 | <br /> |
834 | 1086 | <p> |
835 | 1087 | <label for="customcss">Custom CSS web path</label> |
836 | - <input type="text" name="customcss" id="customcss" value="<?php if (isset($globalCustomCSS)) echo $globalCustomCSS; ?>" /> |
|
1088 | + <input type="text" name="customcss" id="customcss" value="<?php if (isset($globalCustomCSS)) { |
|
1089 | + echo $globalCustomCSS; |
|
1090 | +} |
|
1091 | +?>" /> |
|
837 | 1092 | </p> |
838 | 1093 | </fieldset> |
839 | 1094 | <input type="submit" name="submit" value="Create/Update database & write setup" /> |
@@ -860,8 +1115,12 @@ discard block |
||
860 | 1115 | $dbhost = filter_input(INPUT_POST,'dbhost',FILTER_SANITIZE_STRING); |
861 | 1116 | $dbport = filter_input(INPUT_POST,'dbport',FILTER_SANITIZE_STRING); |
862 | 1117 | |
863 | - if ($dbtype == 'mysql' && !extension_loaded('pdo_mysql')) $error .= 'Mysql driver for PDO must be loaded'; |
|
864 | - if ($dbtype == 'pgsql' && !extension_loaded('pdo_pgsql')) $error .= 'PosgreSQL driver for PDO must be loaded'; |
|
1118 | + if ($dbtype == 'mysql' && !extension_loaded('pdo_mysql')) { |
|
1119 | + $error .= 'Mysql driver for PDO must be loaded'; |
|
1120 | + } |
|
1121 | + if ($dbtype == 'pgsql' && !extension_loaded('pdo_pgsql')) { |
|
1122 | + $error .= 'PosgreSQL driver for PDO must be loaded'; |
|
1123 | + } |
|
865 | 1124 | |
866 | 1125 | $_SESSION['database_root'] = $dbroot; |
867 | 1126 | $_SESSION['database_rootpass'] = $dbrootpass; |
@@ -928,15 +1187,23 @@ discard block |
||
928 | 1187 | $source_city = $_POST['source_city']; |
929 | 1188 | $source_country = $_POST['source_country']; |
930 | 1189 | $source_ref = $_POST['source_ref']; |
931 | - if (isset($source_id)) $source_id = $_POST['source_id']; |
|
932 | - else $source_id = array(); |
|
1190 | + if (isset($source_id)) { |
|
1191 | + $source_id = $_POST['source_id']; |
|
1192 | + } else { |
|
1193 | + $source_id = array(); |
|
1194 | + } |
|
933 | 1195 | |
934 | 1196 | $sources = array(); |
935 | 1197 | foreach ($source_name as $keys => $name) { |
936 | - 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]); |
|
937 | - 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]); |
|
1198 | + if (isset($source_id[$keys])) { |
|
1199 | + $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]); |
|
1200 | + } else { |
|
1201 | + $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]); |
|
1202 | + } |
|
1203 | + } |
|
1204 | + if (count($sources) > 0) { |
|
1205 | + $_SESSION['sources'] = $sources; |
|
938 | 1206 | } |
939 | - if (count($sources) > 0) $_SESSION['sources'] = $sources; |
|
940 | 1207 | |
941 | 1208 | //$sbshost = filter_input(INPUT_POST,'sbshost',FILTER_SANITIZE_STRING); |
942 | 1209 | //$sbsport = filter_input(INPUT_POST,'sbsport',FILTER_SANITIZE_NUMBER_INT); |
@@ -957,14 +1224,23 @@ discard block |
||
957 | 1224 | $datasource = filter_input(INPUT_POST,'datasource',FILTER_SANITIZE_STRING); |
958 | 1225 | |
959 | 1226 | $globalaircraft = filter_input(INPUT_POST,'globalaircraft',FILTER_SANITIZE_STRING); |
960 | - if ($globalaircraft == 'aircraft') $settings = array_merge($settings,array('globalAircraft' => 'TRUE')); |
|
961 | - else $settings = array_merge($settings,array('globalAircraft' => 'FALSE')); |
|
1227 | + if ($globalaircraft == 'aircraft') { |
|
1228 | + $settings = array_merge($settings,array('globalAircraft' => 'TRUE')); |
|
1229 | + } else { |
|
1230 | + $settings = array_merge($settings,array('globalAircraft' => 'FALSE')); |
|
1231 | + } |
|
962 | 1232 | $globaltracker = filter_input(INPUT_POST,'globaltracker',FILTER_SANITIZE_STRING); |
963 | - if ($globaltracker == 'tracker') $settings = array_merge($settings,array('globalTracker' => 'TRUE')); |
|
964 | - else $settings = array_merge($settings,array('globalTracker' => 'FALSE')); |
|
1233 | + if ($globaltracker == 'tracker') { |
|
1234 | + $settings = array_merge($settings,array('globalTracker' => 'TRUE')); |
|
1235 | + } else { |
|
1236 | + $settings = array_merge($settings,array('globalTracker' => 'FALSE')); |
|
1237 | + } |
|
965 | 1238 | $globalmarine = filter_input(INPUT_POST,'globalmarine',FILTER_SANITIZE_STRING); |
966 | - if ($globalmarine == 'marine') $settings = array_merge($settings,array('globalMarine' => 'TRUE')); |
|
967 | - else $settings = array_merge($settings,array('globalMarine' => 'FALSE')); |
|
1239 | + if ($globalmarine == 'marine') { |
|
1240 | + $settings = array_merge($settings,array('globalMarine' => 'TRUE')); |
|
1241 | + } else { |
|
1242 | + $settings = array_merge($settings,array('globalMarine' => 'FALSE')); |
|
1243 | + } |
|
968 | 1244 | |
969 | 1245 | /* |
970 | 1246 | $globalSBS1Hosts = array(); |
@@ -985,17 +1261,31 @@ discard block |
||
985 | 1261 | $port = $_POST['port']; |
986 | 1262 | $name = $_POST['name']; |
987 | 1263 | $format = $_POST['format']; |
988 | - if (isset($_POST['sourcestats'])) $sourcestats = $_POST['sourcestats']; |
|
989 | - else $sourcestats = array(); |
|
990 | - if (isset($_POST['noarchive'])) $noarchive = $_POST['noarchive']; |
|
991 | - else $noarchive = array(); |
|
1264 | + if (isset($_POST['sourcestats'])) { |
|
1265 | + $sourcestats = $_POST['sourcestats']; |
|
1266 | + } else { |
|
1267 | + $sourcestats = array(); |
|
1268 | + } |
|
1269 | + if (isset($_POST['noarchive'])) { |
|
1270 | + $noarchive = $_POST['noarchive']; |
|
1271 | + } else { |
|
1272 | + $noarchive = array(); |
|
1273 | + } |
|
992 | 1274 | $gSources = array(); |
993 | 1275 | foreach ($host as $key => $h) { |
994 | - if (isset($sourcestats[$key]) && $sourcestats[$key] == 1) $cov = 'TRUE'; |
|
995 | - else $cov = 'FALSE'; |
|
996 | - if (isset($noarchive[$key]) && $noarchive[$key] == 1) $arch = 'TRUE'; |
|
997 | - else $arch = 'FALSE'; |
|
998 | - if ($h != '') $gSources[] = array('host' => $h, 'port' => $port[$key],'name' => $name[$key],'format' => $format[$key],'sourcestats' => $cov,'noarchive' => $arch); |
|
1276 | + if (isset($sourcestats[$key]) && $sourcestats[$key] == 1) { |
|
1277 | + $cov = 'TRUE'; |
|
1278 | + } else { |
|
1279 | + $cov = 'FALSE'; |
|
1280 | + } |
|
1281 | + if (isset($noarchive[$key]) && $noarchive[$key] == 1) { |
|
1282 | + $arch = 'TRUE'; |
|
1283 | + } else { |
|
1284 | + $arch = 'FALSE'; |
|
1285 | + } |
|
1286 | + if ($h != '') { |
|
1287 | + $gSources[] = array('host' => $h, 'port' => $port[$key],'name' => $name[$key],'format' => $format[$key],'sourcestats' => $cov,'noarchive' => $arch); |
|
1288 | + } |
|
999 | 1289 | } |
1000 | 1290 | $settings = array_merge($settings,array('globalSources' => $gSources)); |
1001 | 1291 | |
@@ -1023,7 +1313,9 @@ discard block |
||
1023 | 1313 | $zoidistance = filter_input(INPUT_POST,'zoidistance',FILTER_SANITIZE_NUMBER_INT); |
1024 | 1314 | if ($zoilatitude != '' && $zoilongitude != '' && $zoidistance != '') { |
1025 | 1315 | $settings = array_merge($settings,array('globalDistanceIgnore' => array('latitude' => $zoilatitude,'longitude' => $zoilongitude,'distance' => $zoidistance))); |
1026 | - } else $settings = array_merge($settings,array('globalDistanceIgnore' => array())); |
|
1316 | + } else { |
|
1317 | + $settings = array_merge($settings,array('globalDistanceIgnore' => array())); |
|
1318 | + } |
|
1027 | 1319 | |
1028 | 1320 | $refresh = filter_input(INPUT_POST,'refresh',FILTER_SANITIZE_NUMBER_INT); |
1029 | 1321 | $settings = array_merge($settings,array('globalLiveInterval' => $refresh)); |
@@ -1062,7 +1354,9 @@ discard block |
||
1062 | 1354 | |
1063 | 1355 | // Create in settings.php keys not yet configurable if not already here |
1064 | 1356 | //if (!isset($globalImageBingKey)) $settings = array_merge($settings,array('globalImageBingKey' => '')); |
1065 | - if (!isset($globalDebug)) $settings = array_merge($settings,array('globalDebug' => 'TRUE')); |
|
1357 | + if (!isset($globalDebug)) { |
|
1358 | + $settings = array_merge($settings,array('globalDebug' => 'TRUE')); |
|
1359 | + } |
|
1066 | 1360 | |
1067 | 1361 | $resetyearstats = filter_input(INPUT_POST,'resetyearstats',FILTER_SANITIZE_STRING); |
1068 | 1362 | if ($resetyearstats == 'resetyearstats') { |
@@ -1099,33 +1393,51 @@ discard block |
||
1099 | 1393 | } |
1100 | 1394 | */ |
1101 | 1395 | $settings = array_merge($settings,array('globalFlightAware' => 'FALSE')); |
1102 | - if ($globalsbs == 'sbs') $settings = array_merge($settings,array('globalSBS1' => 'TRUE')); |
|
1103 | - else $settings = array_merge($settings,array('globalSBS1' => 'FALSE')); |
|
1104 | - if ($globalaprs == 'aprs') $settings = array_merge($settings,array('globalAPRS' => 'TRUE')); |
|
1105 | - else $settings = array_merge($settings,array('globalAPRS' => 'FALSE')); |
|
1396 | + if ($globalsbs == 'sbs') { |
|
1397 | + $settings = array_merge($settings,array('globalSBS1' => 'TRUE')); |
|
1398 | + } else { |
|
1399 | + $settings = array_merge($settings,array('globalSBS1' => 'FALSE')); |
|
1400 | + } |
|
1401 | + if ($globalaprs == 'aprs') { |
|
1402 | + $settings = array_merge($settings,array('globalAPRS' => 'TRUE')); |
|
1403 | + } else { |
|
1404 | + $settings = array_merge($settings,array('globalAPRS' => 'FALSE')); |
|
1405 | + } |
|
1106 | 1406 | $va = false; |
1107 | 1407 | if ($globalivao == 'ivao') { |
1108 | 1408 | $settings = array_merge($settings,array('globalIVAO' => 'TRUE')); |
1109 | 1409 | $va = true; |
1110 | - } else $settings = array_merge($settings,array('globalIVAO' => 'FALSE')); |
|
1410 | + } else { |
|
1411 | + $settings = array_merge($settings,array('globalIVAO' => 'FALSE')); |
|
1412 | + } |
|
1111 | 1413 | if ($globalvatsim == 'vatsim') { |
1112 | 1414 | $settings = array_merge($settings,array('globalVATSIM' => 'TRUE')); |
1113 | 1415 | $va = true; |
1114 | - } else $settings = array_merge($settings,array('globalVATSIM' => 'FALSE')); |
|
1416 | + } else { |
|
1417 | + $settings = array_merge($settings,array('globalVATSIM' => 'FALSE')); |
|
1418 | + } |
|
1115 | 1419 | if ($globalphpvms == 'phpvms') { |
1116 | 1420 | $settings = array_merge($settings,array('globalphpVMS' => 'TRUE')); |
1117 | 1421 | $va = true; |
1118 | - } else $settings = array_merge($settings,array('globalphpVMS' => 'FALSE')); |
|
1422 | + } else { |
|
1423 | + $settings = array_merge($settings,array('globalphpVMS' => 'FALSE')); |
|
1424 | + } |
|
1119 | 1425 | if ($globalvam == 'vam') { |
1120 | 1426 | $settings = array_merge($settings,array('globalVAM' => 'TRUE')); |
1121 | 1427 | $va = true; |
1122 | - } else $settings = array_merge($settings,array('globalVAM' => 'FALSE')); |
|
1428 | + } else { |
|
1429 | + $settings = array_merge($settings,array('globalVAM' => 'FALSE')); |
|
1430 | + } |
|
1123 | 1431 | if ($va) { |
1124 | 1432 | $settings = array_merge($settings,array('globalSchedulesFetch' => 'FALSE','globalTranslationFetch' => 'FALSE')); |
1125 | - } else $settings = array_merge($settings,array('globalSchedulesFetch' => 'TRUE','globalTranslationFetch' => 'TRUE')); |
|
1433 | + } else { |
|
1434 | + $settings = array_merge($settings,array('globalSchedulesFetch' => 'TRUE','globalTranslationFetch' => 'TRUE')); |
|
1435 | + } |
|
1126 | 1436 | if ($globalva == 'va' || $va) { |
1127 | 1437 | $settings = array_merge($settings,array('globalVA' => 'TRUE')); |
1128 | - } else $settings = array_merge($settings,array('globalVA' => 'FALSE')); |
|
1438 | + } else { |
|
1439 | + $settings = array_merge($settings,array('globalVA' => 'FALSE')); |
|
1440 | + } |
|
1129 | 1441 | |
1130 | 1442 | |
1131 | 1443 | |
@@ -1279,7 +1591,9 @@ discard block |
||
1279 | 1591 | $settings = array_merge($settings,array('globalNoAirlines' => 'FALSE')); |
1280 | 1592 | } |
1281 | 1593 | |
1282 | - if (!isset($globalTransaction)) $settings = array_merge($settings,array('globalTransaction' => 'TRUE')); |
|
1594 | + if (!isset($globalTransaction)) { |
|
1595 | + $settings = array_merge($settings,array('globalTransaction' => 'TRUE')); |
|
1596 | + } |
|
1283 | 1597 | |
1284 | 1598 | // Set some defaults values... |
1285 | 1599 | if (!isset($globalAircraftImageSources)) { |
@@ -1294,15 +1608,23 @@ discard block |
||
1294 | 1608 | |
1295 | 1609 | $settings = array_merge($settings,array('globalInstalled' => 'TRUE')); |
1296 | 1610 | |
1297 | - if ($error == '') settings::modify_settings($settings); |
|
1298 | - if ($error == '') settings::comment_settings($settings_comment); |
|
1611 | + if ($error == '') { |
|
1612 | + settings::modify_settings($settings); |
|
1613 | + } |
|
1614 | + if ($error == '') { |
|
1615 | + settings::comment_settings($settings_comment); |
|
1616 | + } |
|
1299 | 1617 | if ($error != '') { |
1300 | 1618 | print '<div class="info column">'.$error.'</div>'; |
1301 | 1619 | require('../footer.php'); |
1302 | 1620 | exit; |
1303 | 1621 | } else { |
1304 | - if (isset($_POST['waypoints']) && $_POST['waypoints'] == 'waypoints') $_SESSION['waypoints'] = 1; |
|
1305 | - if (isset($_POST['owner']) && $_POST['owner'] == 'owner') $_SESSION['owner'] = 1; |
|
1622 | + if (isset($_POST['waypoints']) && $_POST['waypoints'] == 'waypoints') { |
|
1623 | + $_SESSION['waypoints'] = 1; |
|
1624 | + } |
|
1625 | + if (isset($_POST['owner']) && $_POST['owner'] == 'owner') { |
|
1626 | + $_SESSION['owner'] = 1; |
|
1627 | + } |
|
1306 | 1628 | if (isset($_POST['createdb'])) { |
1307 | 1629 | $_SESSION['install'] = 'database_create'; |
1308 | 1630 | } else { |
@@ -1343,10 +1665,18 @@ discard block |
||
1343 | 1665 | $popw = false; |
1344 | 1666 | foreach ($_SESSION['done'] as $done) { |
1345 | 1667 | print '<li>'.$done.'....<strong>SUCCESS</strong></li>'; |
1346 | - if ($done == 'Create database') $pop = true; |
|
1347 | - if ($_SESSION['install'] == 'database_create') $pop = true; |
|
1348 | - if ($_SESSION['install'] == 'database_import') $popi = true; |
|
1349 | - if ($_SESSION['install'] == 'waypoints') $popw = true; |
|
1668 | + if ($done == 'Create database') { |
|
1669 | + $pop = true; |
|
1670 | + } |
|
1671 | + if ($_SESSION['install'] == 'database_create') { |
|
1672 | + $pop = true; |
|
1673 | + } |
|
1674 | + if ($_SESSION['install'] == 'database_import') { |
|
1675 | + $popi = true; |
|
1676 | + } |
|
1677 | + if ($_SESSION['install'] == 'waypoints') { |
|
1678 | + $popw = true; |
|
1679 | + } |
|
1350 | 1680 | } |
1351 | 1681 | if ($pop) { |
1352 | 1682 | sleep(5); |
@@ -1357,7 +1687,9 @@ discard block |
||
1357 | 1687 | } else if ($popw) { |
1358 | 1688 | sleep(5); |
1359 | 1689 | print '<li>Populate waypoints database....<img src="../images/loading.gif" /></li>'; |
1360 | - } else print '<li>Update schema if needed....<img src="../images/loading.gif" /></li>'; |
|
1690 | + } else { |
|
1691 | + print '<li>Update schema if needed....<img src="../images/loading.gif" /></li>'; |
|
1692 | + } |
|
1361 | 1693 | print '</div></ul>'; |
1362 | 1694 | print '<div id="error"></div>'; |
1363 | 1695 | /* foreach ($_SESSION['done'] as $done) { |
@@ -107,17 +107,23 @@ discard block |
||
107 | 107 | |
108 | 108 | /* Check that end was found and body has at least one byte. */ |
109 | 109 | if ($splitpos == 0 || $splitpos + 1 == $input_len || $splitpos === FALSE) { |
110 | - if ($globalDebug) echo '!!! APRS invalid : '.$input."\n"; |
|
110 | + if ($globalDebug) { |
|
111 | + echo '!!! APRS invalid : '.$input."\n"; |
|
112 | + } |
|
111 | 113 | return false; |
112 | 114 | } |
113 | 115 | |
114 | - if ($debug) echo 'input : '.$input."\n"; |
|
116 | + if ($debug) { |
|
117 | + echo 'input : '.$input."\n"; |
|
118 | + } |
|
115 | 119 | /* Save header and body. */ |
116 | 120 | $body = substr($input,$splitpos+1,$input_len); |
117 | 121 | $body_len = strlen($body); |
118 | 122 | $header = substr($input,0,$splitpos); |
119 | 123 | //$header_len = strlen($header); |
120 | - if ($debug) echo 'header : '.$header."\n"; |
|
124 | + if ($debug) { |
|
125 | + echo 'header : '.$header."\n"; |
|
126 | + } |
|
121 | 127 | |
122 | 128 | /* Parse source, target and path. */ |
123 | 129 | //FLRDF0A52>APRS,qAS,LSTB |
@@ -131,10 +137,14 @@ discard block |
||
131 | 137 | $result['format_source'] = 'famaprs'; |
132 | 138 | $result['source_type'] = 'ais'; |
133 | 139 | } else { |
134 | - if ($debug) echo 'ident : '.$ident."\n"; |
|
140 | + if ($debug) { |
|
141 | + echo 'ident : '.$ident."\n"; |
|
142 | + } |
|
135 | 143 | $result['ident'] = $ident; |
136 | 144 | } |
137 | - } else return false; |
|
145 | + } else { |
|
146 | + return false; |
|
147 | + } |
|
138 | 148 | $elements = explode(',',$all_elements); |
139 | 149 | $source = end($elements); |
140 | 150 | $result['source'] = $source; |
@@ -143,7 +153,9 @@ discard block |
||
143 | 153 | //echo "ok"; |
144 | 154 | //if ($element == 'TCPIP*') return false; |
145 | 155 | } elseif (!preg_match('/^([0-9A-F]{32})$/',$element)) { |
146 | - if ($debug) echo 'element : '.$element."\n"; |
|
156 | + if ($debug) { |
|
157 | + echo 'element : '.$element."\n"; |
|
158 | + } |
|
147 | 159 | return false; |
148 | 160 | } |
149 | 161 | /* |
@@ -156,13 +168,17 @@ discard block |
||
156 | 168 | } |
157 | 169 | |
158 | 170 | $type = substr($body,0,1); |
159 | - if ($debug) echo 'type : '.$type."\n"; |
|
171 | + if ($debug) { |
|
172 | + echo 'type : '.$type."\n"; |
|
173 | + } |
|
160 | 174 | if ($type == ';') { |
161 | 175 | if (isset($result['source_type']) && $result['source_type'] == 'modes') { |
162 | 176 | $result['address'] = trim(substr($body,1,9)); |
163 | 177 | } elseif (isset($result['source_type']) && $result['source_type'] == 'ais') { |
164 | 178 | $result['mmsi'] = trim(substr($body,1,9)); |
165 | - } else $result['ident'] = trim(substr($body,1,9)); |
|
179 | + } else { |
|
180 | + $result['ident'] = trim(substr($body,1,9)); |
|
181 | + } |
|
166 | 182 | } elseif ($type == ',') { |
167 | 183 | // Invalid data or test data |
168 | 184 | return false; |
@@ -230,7 +246,9 @@ discard block |
||
230 | 246 | //$symbol_table = $matches[4]; |
231 | 247 | $lat = intval($lat_deg); |
232 | 248 | $lon = intval($lon_deg); |
233 | - if ($lat > 89 || $lon > 179) return false; |
|
249 | + if ($lat > 89 || $lon > 179) { |
|
250 | + return false; |
|
251 | + } |
|
234 | 252 | |
235 | 253 | /* |
236 | 254 | $tmp_5b = str_replace('.','',$lat_min); |
@@ -240,8 +258,12 @@ discard block |
||
240 | 258 | */ |
241 | 259 | $latitude = $lat + floatval($lat_min)/60; |
242 | 260 | $longitude = $lon + floatval($lon_min)/60; |
243 | - if ($sind == 'S') $latitude = 0-$latitude; |
|
244 | - if ($wind == 'W') $longitude = 0-$longitude; |
|
261 | + if ($sind == 'S') { |
|
262 | + $latitude = 0-$latitude; |
|
263 | + } |
|
264 | + if ($wind == 'W') { |
|
265 | + $longitude = 0-$longitude; |
|
266 | + } |
|
245 | 267 | $result['latitude'] = $latitude; |
246 | 268 | $result['longitude'] = $longitude; |
247 | 269 | $body_parse = substr($body_parse,18); |
@@ -275,7 +297,9 @@ discard block |
||
275 | 297 | $body_parse = substr($body_parse,1); |
276 | 298 | $body_parse_len = strlen($body_parse); |
277 | 299 | $result['symbol_code'] = $symbol_code; |
278 | - if (isset($this->symbols[$symbol_code])) $result['symbol'] = $this->symbols[$symbol_code]; |
|
300 | + if (isset($this->symbols[$symbol_code])) { |
|
301 | + $result['symbol'] = $this->symbols[$symbol_code]; |
|
302 | + } |
|
279 | 303 | if ($symbol_code != '_') { |
280 | 304 | } |
281 | 305 | //$body_parse = substr($body_parse,1); |
@@ -286,7 +310,9 @@ discard block |
||
286 | 310 | if (preg_match('/^([0-9\\. ]{3})\\/([0-9\\. ]{3})/',$body_parse)) { |
287 | 311 | $course = substr($body_parse,0,3); |
288 | 312 | $tmp_s = intval($course); |
289 | - if ($tmp_s >= 1 && $tmp_s <= 360) $result['heading'] = intval($course); |
|
313 | + if ($tmp_s >= 1 && $tmp_s <= 360) { |
|
314 | + $result['heading'] = intval($course); |
|
315 | + } |
|
290 | 316 | $speed = substr($body_parse,4,3); |
291 | 317 | if ($speed != '...') { |
292 | 318 | //$result['speed'] = round($speed*1.852); |
@@ -327,10 +353,16 @@ discard block |
||
327 | 353 | $lat_off = (($dao_split[1])-48.0)*0.001/60.0; |
328 | 354 | $lon_off = (($dao_split[2])-48.0)*0.001/60.0; |
329 | 355 | |
330 | - if ($result['latitude'] < 0) $result['latitude'] -= $lat_off; |
|
331 | - else $result['latitude'] += $lat_off; |
|
332 | - if ($result['longitude'] < 0) $result['longitude'] -= $lon_off; |
|
333 | - else $result['longitude'] += $lon_off; |
|
356 | + if ($result['latitude'] < 0) { |
|
357 | + $result['latitude'] -= $lat_off; |
|
358 | + } else { |
|
359 | + $result['latitude'] += $lat_off; |
|
360 | + } |
|
361 | + if ($result['longitude'] < 0) { |
|
362 | + $result['longitude'] -= $lon_off; |
|
363 | + } else { |
|
364 | + $result['longitude'] += $lon_off; |
|
365 | + } |
|
334 | 366 | } |
335 | 367 | |
336 | 368 | $body_parse = substr($body_parse,6); |
@@ -372,27 +404,48 @@ discard block |
||
372 | 404 | $address = substr($id,2); |
373 | 405 | //print_r($matches); |
374 | 406 | $addressType = (intval(substr($id,0,2),16))&3; |
375 | - if ($addressType == 0) $result['addresstype'] = "RANDOM"; |
|
376 | - elseif ($addressType == 1) $result['addresstype'] = "ICAO"; |
|
377 | - elseif ($addressType == 2) $result['addresstype'] = "FLARM"; |
|
378 | - elseif ($addressType == 3) $result['addresstype'] = "OGN"; |
|
407 | + if ($addressType == 0) { |
|
408 | + $result['addresstype'] = "RANDOM"; |
|
409 | + } elseif ($addressType == 1) { |
|
410 | + $result['addresstype'] = "ICAO"; |
|
411 | + } elseif ($addressType == 2) { |
|
412 | + $result['addresstype'] = "FLARM"; |
|
413 | + } elseif ($addressType == 3) { |
|
414 | + $result['addresstype'] = "OGN"; |
|
415 | + } |
|
379 | 416 | $aircraftType = $this->urshift(((intval(substr($id,0,2),16)) & 0b1111100),2); |
380 | 417 | $result['aircrafttype_code'] = $aircraftType; |
381 | - if ($aircraftType == 0) $result['aircrafttype'] = "UNKNOWN"; |
|
382 | - elseif ($aircraftType == 1) $result['aircrafttype'] = "GLIDER"; |
|
383 | - elseif ($aircraftType == 2) $result['aircrafttype'] = "TOW_PLANE"; |
|
384 | - elseif ($aircraftType == 3) $result['aircrafttype'] = "HELICOPTER_ROTORCRAFT"; |
|
385 | - elseif ($aircraftType == 4) $result['aircrafttype'] = "PARACHUTE"; |
|
386 | - elseif ($aircraftType == 5) $result['aircrafttype'] = "DROP_PLANE"; |
|
387 | - elseif ($aircraftType == 6) $result['aircrafttype'] = "HANG_GLIDER"; |
|
388 | - elseif ($aircraftType == 7) $result['aircrafttype'] = "PARA_GLIDER"; |
|
389 | - elseif ($aircraftType == 8) $result['aircrafttype'] = "POWERED_AIRCRAFT"; |
|
390 | - elseif ($aircraftType == 9) $result['aircrafttype'] = "JET_AIRCRAFT"; |
|
391 | - elseif ($aircraftType == 10) $result['aircrafttype'] = "UFO"; |
|
392 | - elseif ($aircraftType == 11) $result['aircrafttype'] = "BALLOON"; |
|
393 | - elseif ($aircraftType == 12) $result['aircrafttype'] = "AIRSHIP"; |
|
394 | - elseif ($aircraftType == 13) $result['aircrafttype'] = "UAV"; |
|
395 | - elseif ($aircraftType == 15) $result['aircrafttype'] = "STATIC_OBJECT"; |
|
418 | + if ($aircraftType == 0) { |
|
419 | + $result['aircrafttype'] = "UNKNOWN"; |
|
420 | + } elseif ($aircraftType == 1) { |
|
421 | + $result['aircrafttype'] = "GLIDER"; |
|
422 | + } elseif ($aircraftType == 2) { |
|
423 | + $result['aircrafttype'] = "TOW_PLANE"; |
|
424 | + } elseif ($aircraftType == 3) { |
|
425 | + $result['aircrafttype'] = "HELICOPTER_ROTORCRAFT"; |
|
426 | + } elseif ($aircraftType == 4) { |
|
427 | + $result['aircrafttype'] = "PARACHUTE"; |
|
428 | + } elseif ($aircraftType == 5) { |
|
429 | + $result['aircrafttype'] = "DROP_PLANE"; |
|
430 | + } elseif ($aircraftType == 6) { |
|
431 | + $result['aircrafttype'] = "HANG_GLIDER"; |
|
432 | + } elseif ($aircraftType == 7) { |
|
433 | + $result['aircrafttype'] = "PARA_GLIDER"; |
|
434 | + } elseif ($aircraftType == 8) { |
|
435 | + $result['aircrafttype'] = "POWERED_AIRCRAFT"; |
|
436 | + } elseif ($aircraftType == 9) { |
|
437 | + $result['aircrafttype'] = "JET_AIRCRAFT"; |
|
438 | + } elseif ($aircraftType == 10) { |
|
439 | + $result['aircrafttype'] = "UFO"; |
|
440 | + } elseif ($aircraftType == 11) { |
|
441 | + $result['aircrafttype'] = "BALLOON"; |
|
442 | + } elseif ($aircraftType == 12) { |
|
443 | + $result['aircrafttype'] = "AIRSHIP"; |
|
444 | + } elseif ($aircraftType == 13) { |
|
445 | + $result['aircrafttype'] = "UAV"; |
|
446 | + } elseif ($aircraftType == 15) { |
|
447 | + $result['aircrafttype'] = "STATIC_OBJECT"; |
|
448 | + } |
|
396 | 449 | $stealth = (intval(substr($id,0,2), 16) & 0b10000000) != 0; |
397 | 450 | $result['stealth'] = $stealth; |
398 | 451 | $result['address'] = $address; |
@@ -432,13 +485,21 @@ discard block |
||
432 | 485 | $result['temp'] = round(5/9*(($matches[1])-32),1); |
433 | 486 | } |
434 | 487 | } |
435 | - } else $result['comment'] = trim($body_parse); |
|
488 | + } else { |
|
489 | + $result['comment'] = trim($body_parse); |
|
490 | + } |
|
436 | 491 | |
437 | 492 | } |
438 | 493 | //} |
439 | - if (isset($result['latitude'])) $result['latitude'] = round($result['latitude'],4); |
|
440 | - if (isset($result['longitude'])) $result['longitude'] = round($result['longitude'],4); |
|
441 | - if ($debug) print_r($result); |
|
494 | + if (isset($result['latitude'])) { |
|
495 | + $result['latitude'] = round($result['latitude'],4); |
|
496 | + } |
|
497 | + if (isset($result['longitude'])) { |
|
498 | + $result['longitude'] = round($result['longitude'],4); |
|
499 | + } |
|
500 | + if ($debug) { |
|
501 | + print_r($result); |
|
502 | + } |
|
442 | 503 | return $result; |
443 | 504 | } |
444 | 505 | |
@@ -447,12 +508,21 @@ discard block |
||
447 | 508 | $aprs_connect = 0; |
448 | 509 | $aprs_keep = 120; |
449 | 510 | $aprs_last_tx = time(); |
450 | - if (isset($globalAPRSversion)) $aprs_version = $globalAPRSversion; |
|
451 | - else $aprs_version = 'FlightAirMap '.str_replace(' ','_',$globalName); |
|
452 | - if (isset($globalServerAPRSssid)) $aprs_ssid = $globalServerAPRSssid; |
|
453 | - else $aprs_ssid = substr('FAM'.strtoupper(str_replace(' ','_',$globalName)),0,8); |
|
454 | - if (isset($globalServerAPRSpass)) $aprs_pass = $globalServerAPRSpass; |
|
455 | - else $aprs_pass = '-1'; |
|
511 | + if (isset($globalAPRSversion)) { |
|
512 | + $aprs_version = $globalAPRSversion; |
|
513 | + } else { |
|
514 | + $aprs_version = 'FlightAirMap '.str_replace(' ','_',$globalName); |
|
515 | + } |
|
516 | + if (isset($globalServerAPRSssid)) { |
|
517 | + $aprs_ssid = $globalServerAPRSssid; |
|
518 | + } else { |
|
519 | + $aprs_ssid = substr('FAM'.strtoupper(str_replace(' ','_',$globalName)),0,8); |
|
520 | + } |
|
521 | + if (isset($globalServerAPRSpass)) { |
|
522 | + $aprs_pass = $globalServerAPRSpass; |
|
523 | + } else { |
|
524 | + $aprs_pass = '-1'; |
|
525 | + } |
|
456 | 526 | |
457 | 527 | $aprs_filter = ''; |
458 | 528 | $aprs_login = "user {$aprs_ssid} pass {$aprs_pass} vers {$aprs_version}\n"; |
@@ -485,10 +555,14 @@ discard block |
||
485 | 555 | |
486 | 556 | public function send($data) { |
487 | 557 | global $globalDebug; |
488 | - if ($this->connected === false) $this->connect(); |
|
558 | + if ($this->connected === false) { |
|
559 | + $this->connect(); |
|
560 | + } |
|
489 | 561 | $send = socket_send( $this->socket , $data , strlen($data),0); |
490 | 562 | if ($send === FALSE) { |
491 | - if ($globalDebug) echo 'Reconnect...'; |
|
563 | + if ($globalDebug) { |
|
564 | + echo 'Reconnect...'; |
|
565 | + } |
|
492 | 566 | socket_close($this->socket); |
493 | 567 | $this->connect(); |
494 | 568 | } |
@@ -508,22 +582,32 @@ discard block |
||
508 | 582 | //$w = '00'; |
509 | 583 | $custom = ''; |
510 | 584 | if ($ident != '') { |
511 | - if ($custom != '') $custom .= '/'; |
|
585 | + if ($custom != '') { |
|
586 | + $custom .= '/'; |
|
587 | + } |
|
512 | 588 | $custom .= 'CS='.$ident; |
513 | 589 | } |
514 | 590 | if ($squawk != '') { |
515 | - if ($custom != '') $custom .= '/'; |
|
591 | + if ($custom != '') { |
|
592 | + $custom .= '/'; |
|
593 | + } |
|
516 | 594 | $custom .= 'SQ='.$squawk; |
517 | 595 | } |
518 | 596 | if ($verticalrate != '') { |
519 | - if ($custom != '') $custom .= '/'; |
|
597 | + if ($custom != '') { |
|
598 | + $custom .= '/'; |
|
599 | + } |
|
520 | 600 | $custom .= 'VR='.$verticalrate; |
521 | 601 | } |
522 | 602 | if ($aircraft_icao != '' && $aircraft_icao != 'NA') { |
523 | - if ($custom != '') $custom .= '/'; |
|
603 | + if ($custom != '') { |
|
604 | + $custom .= '/'; |
|
605 | + } |
|
524 | 606 | $custom .= 'AI='.$aircraft_icao; |
525 | 607 | } |
526 | - if ($custom != '') $custom = ' '.$custom; |
|
608 | + if ($custom != '') { |
|
609 | + $custom = ' '.$custom; |
|
610 | + } |
|
527 | 611 | $this->send('AIRCRAFT>APRS,TCPIP*:;'.$hex.' *'.date('His',strtotime($datetime)).'h'.$coordinate.'^'.str_pad($heading,3,'0',STR_PAD_LEFT).'/'.str_pad($speed,3,'0',STR_PAD_LEFT).'/A='.str_pad($altitude_real,6,'0',STR_PAD_LEFT).' !W'.$w.'!'.$custom."\n"); |
528 | 612 | } |
529 | 613 | } |
@@ -541,30 +625,44 @@ discard block |
||
541 | 625 | //$w = '00'; |
542 | 626 | $custom = ''; |
543 | 627 | if ($ident != '') { |
544 | - if ($custom != '') $custom .= '/'; |
|
628 | + if ($custom != '') { |
|
629 | + $custom .= '/'; |
|
630 | + } |
|
545 | 631 | $custom .= 'CS='.str_replace(' ','_',$ident); |
546 | 632 | } |
547 | 633 | if ($typeid != '') { |
548 | - if ($custom != '') $custom .= '/'; |
|
634 | + if ($custom != '') { |
|
635 | + $custom .= '/'; |
|
636 | + } |
|
549 | 637 | $custom .= 'TI='.$typeid; |
550 | 638 | } |
551 | 639 | if ($statusid != '') { |
552 | - if ($custom != '') $custom .= '/'; |
|
640 | + if ($custom != '') { |
|
641 | + $custom .= '/'; |
|
642 | + } |
|
553 | 643 | $custom .= 'SI='.$statusid; |
554 | 644 | } |
555 | 645 | if ($imo != '') { |
556 | - if ($custom != '') $custom .= '/'; |
|
646 | + if ($custom != '') { |
|
647 | + $custom .= '/'; |
|
648 | + } |
|
557 | 649 | $custom .= 'IMO='.$imo; |
558 | 650 | } |
559 | 651 | if ($arrival_date != '') { |
560 | - if ($custom != '') $custom .= '/'; |
|
652 | + if ($custom != '') { |
|
653 | + $custom .= '/'; |
|
654 | + } |
|
561 | 655 | $custom .= 'AD='.strtotime($arrival_date); |
562 | 656 | } |
563 | 657 | if ($arrival_code != '') { |
564 | - if ($custom != '') $custom .= '/'; |
|
658 | + if ($custom != '') { |
|
659 | + $custom .= '/'; |
|
660 | + } |
|
565 | 661 | $custom .= 'AC='.str_replace(' ','_',$arrival_code); |
566 | 662 | } |
567 | - if ($custom != '') $custom = ' '.$custom; |
|
663 | + if ($custom != '') { |
|
664 | + $custom = ' '.$custom; |
|
665 | + } |
|
568 | 666 | $altitude = 0; |
569 | 667 | $this->send('MARINE>APRS,TCPIP*:;'.$mmsi.'*'.date('His',strtotime($datetime)).'h'.$coordinate.'s'.str_pad($heading,3,'0',STR_PAD_LEFT).'/'.str_pad($speed,3,'0',STR_PAD_LEFT).'/A='.str_pad($altitude,6,'0',STR_PAD_LEFT).' !W'.$w.'!'.$custom."\n"); |
570 | 668 | } |