Add support for vdlm2dec
[FlightAirMap.git] / install / index.php
blobe4ca30910d98c76fab3549e89b028fc372b2627d
1 <?php
2 @session_start();
3 //print_r($_SESSION);
4 if (isset($_SESSION['error'])) {
5 header('Content-Encoding: none;');
6 echo 'Error : '.$_SESSION['error'].' - Resetting install... You need to fix the problem and run install again.';
7 if (isset($_SESSION['error'])) unset($_SESSION['error']);
8 if (isset($_SESSION['errorlst'])) unset($_SESSION['errorlst']);
9 if (isset($_SESSION['next'])) unset($_SESSION['next']);
10 if (isset($_SESSION['install'])) unset($_SESSION['install']);
11 if (isset($_SESSION['identitied'])) unset($_SESSION['identified']);
14 if (isset($_SESSION['errorlst'])) {
15 header('Content-Encoding: none;');
16 echo 'Error : Resetting install... You need to fix the problem and run install again.';
17 if (isset($_SESSION['error'])) unset($_SESSION['error']);
18 if (isset($_SESSION['errorlst'])) unset($_SESSION['errorlst']);
19 if (isset($_SESSION['next'])) unset($_SESSION['next']);
20 if (isset($_SESSION['install'])) unset($_SESSION['install']);
23 require_once(dirname(__FILE__).'/class.create_db.php');
24 require_once(dirname(__FILE__).'/class.update_schema.php');
25 require_once(dirname(__FILE__).'/class.settings.php');
26 $title="Install";
27 require(dirname(__FILE__).'/../require/settings.php');
28 require_once(dirname(__FILE__).'/../require/class.Common.php');
29 require(dirname(__FILE__).'/header.php');
31 if (!isset($_SESSION['install']) && !isset($_SESSION['identified'])) {
32 $password = filter_input(INPUT_POST,'password',FILTER_SANITIZE_STRING);
33 if ($password == '') {
34 if ($globalInstalled === TRUE && (!isset($globalInstallPassword) || $globalInstallPassword == '')) {
35 print '<div class="alert alert-danger">You need to change $globalInstalled in settings.php to FALSE if you want to access setup again.</div>';
36 require('../footer.php');
37 exit;
38 } elseif (isset($globalInstallPassword) && $globalInstallPassword != '') {
39 print '<div class="col-md-6 col-md-offset-3"><form method="post" class="form-horizontal"><fieldset id="askpass"><legend>Install script access</legend><div class="form-group"><label for="password" class="col-sm-2 control-label"><b>Password</b></label><div class="col-sm-10"><input type="password" name="password" id="password" class="form-control" placeholder="Password" value="" /></div></div></fieldset><div class="form-group"><div class="col-sm-offset-2 col-sm-10"><button type="submit" class="btn btn-default">Submit</button></div></div></form></div>';
40 require('../footer.php');
41 exit;
43 } elseif (!isset($globalInstallPassword) || $globalInstallPassword == '' || $password != $globalInstallPassword) {
44 print '<div class="alert alert-danger">Wrong password.</div>';
45 require('../footer.php');
46 exit;
49 $_SESSION['identified'] = true;
50 $writable = false;
51 $error = array();
52 if (!isset($_SESSION['install']) && !isset($_POST['dbtype'])) {
53 if (!is_writable('../require/settings.php')) {
54 print '<div class="alert alert-danger"><strong>Error</strong> The file <i>require/settings.php</i> must be writable.</div>';
55 require('../footer.php');
56 exit;
58 $Common = new Common();
59 if (!$Common->is__writable('tmp/')) {
60 print '<div class="alert alert-danger"><strong>Error</strong> The directory <i>install/tmp</i> must be writable to the current user.</div>';
61 require('../footer.php');
62 exit;
64 if (!$Common->is__writable('../data/')) {
65 print '<div class="alert alert-danger"><strong>Error</strong> The directory <i>data</i> must be writable from this page or at least to <i>scripts/update_db.php</i> user.</div>';
67 if (!$Common->is__writable('../images/airlines')) {
68 print '<div class="alert alert-warning">The directory <i>images/airlines</i> must be writable for virtual airlines IVAO (else you can ignore this warning).</div>';
70 if (!set_time_limit(0)) {
71 print '<div class="alert alert-info">You may need to update the maximum execution time.</div>';
74 if (!function_exists('pcntl_fork')) {
75 print '<div class="info column"><p><strong>pcntl_fork is not available. Schedules will not be fetched.</strong></p></div>';
79 if (!extension_loaded('SimpleXML')) {
80 $error[] = "SimpleXML is not loaded.";
82 if (!extension_loaded('dom')) {
83 $error[] = "Dom is not loaded. Needed for aircraft schedule";
86 if (!extension_loaded('PDO')) {
87 $error[] = "PDO is not loaded.";
90 if (!extension_loaded('pdo_sqlite')) {
91 $error[] = "PDO SQLite is not loaded. Needed to populate database for SBS.";
94 if (!extension_loaded('zip')) {
95 //$error[] = "ZIP is not loaded. Needed to populate database for SBS.";
96 print '<div class="alert alert-info">ZIP is not loaded. Needed to populate database for IVAO.</div>';
98 if (!extension_loaded('xml') && !extension_loaded('xmlreader')) {
99 print '<div class="alert alert-warning"><strong>Alert</strong> XML is not loaded. Needed to parse RSS for News pages and if you want tsk files support.</div>';
101 if (!extension_loaded('json')) {
102 $error[] = "Json is not loaded. Needed for aircraft schedule and bitly.";
104 if (!extension_loaded('sockets')) {
105 $error[] = "Sockets is not loaded. Needed to populate DB from spotter_daemon.php script.";
107 if (!extension_loaded('curl')) {
108 $error[] = "Curl is not loaded.";
110 if (!file_exists(dirname(__FILE__).'/../.htaccess')) {
111 $error[] = dirname(__FILE__).'/../.htaccess'." doesn't exist. The provided .htaccess must exist if you use Apache.";
113 if(function_exists('apache_get_modules') ){
114 if(!in_array('mod_rewrite',apache_get_modules())) {
115 $error[] = "mod_rewrite is not available.";
118 if (!isset($_SERVER['HTTP_FAMHTACCESS'])) {
119 $error[] = "htaccess is not interpreted. Check your Apache configuration";
124 if (!function_exists("gettext")) {
125 print '<div class="alert alert-warning"><strong>Alert</strong> gettext doesn\'t exist. Site translation not available.</div>';
126 } else {
127 require_once(dirname(__FILE__).'/../require/class.Language.php');
128 $Language = new Language();
129 $availablelng = $Language->getLanguages();
130 $alllng = $Language->listLocaleDir();
131 if (count($alllng) != count($availablelng)) {
132 $notavailable = array();
133 foreach($alllng as $lng) {
134 if (!isset($availablelng[$lng])) $notavailable[] = $lng;
136 print '<div class="alert alert-warning">The following translation can\'t be used on your system: '.implode(', ',$notavailable).'. You need to add the system locales: <a href="https://github.com/Ysurac/FlightAirMap/wiki/Translation">documentation</a>.</div>';
139 print '<div class="alert alert-info">If you use MySQL or MariaDB, check that <i>max_allowed_packet</i> >= 8M, else import of some tables can fail.</div>';
140 if (isset($_SERVER['REQUEST_SCHEME']) && isset($_SERVER['SERVER_NAME']) && isset($_SERVER['SERVER_PORT']) && isset($_SERVER['REQUEST_URI'])) {
141 if (function_exists('get_headers')) {
142 //$check_header = @get_headers($_SERVER['REQUEST_SCHEME'].'://'.$_SERVER["SERVER_NAME"].':'.$_SERVER["SERVER_PORT"].str_replace(array('install/','install'),'search',str_replace('index.php','',$_SERVER["REQUEST_URI"])));
143 $check_header = @get_headers($_SERVER['REQUEST_SCHEME'].'://'.$_SERVER["SERVER_NAME"].':'.$_SERVER["SERVER_PORT"].str_replace(array('install/','install'),'live/geojson?test',str_replace('index.php','',$_SERVER["REQUEST_URI"])));
144 if (isset($check_header[0]) && !stripos($check_header[0],"200 OK")) {
145 print '<div class="alert alert-danger"><strong>Error</strong> Check your configuration, rewrite don\'t seems to work well. If using Apache, you need to desactivate MultiViews <a href="https://github.com/Ysurac/FlightAirMap/wiki/Apache-configuration">https://github.com/Ysurac/FlightAirMap/wiki/Apache-configuration</a></div>';
146 } else {
147 $check_header = @get_headers($_SERVER['REQUEST_SCHEME'].'://'.$_SERVER["SERVER_NAME"].':'.$_SERVER["SERVER_PORT"].str_replace(array('install/','install'),'search',str_replace('index.php','',$_SERVER["REQUEST_URI"])));
148 if (isset($check_header[0]) && !stripos($check_header[0],"200 OK")) {
149 print '<div class="alert alert-danger"><strong>Error</strong> Check your configuration, rewrite don\'t seems to work well. If using Apache, you need to desactivate MultiViews <a href="https://github.com/Ysurac/FlightAirMap/wiki/Apache-configuration">https://github.com/Ysurac/FlightAirMap/wiki/Apache-configuration</a></div>';
154 if (count($error) > 0) {
155 print '<div class="alert alert-danger"><ul>';
156 foreach ($error as $err) {
157 print '<li>'.$err.'</li>';
159 print '</ul>You <strong>must</strong> add these modules/fix errors.</div>';
160 // require('../footer.php');
161 // exit;
164 //if (isset($_SESSION['install'])) echo 'My session';
165 if (!isset($_SESSION['install']) && !isset($_POST['dbtype']) && (count($error) == 0)) {
167 <div class="info column install">
168 <form method="post" class="form-horizontal">
169 <fieldset id="install">
170 <legend>Install script configuration</legend>
172 <label for="installpass">Install password</label>
173 <input type="password" name="installpass" id="installpass" value="<?php if (isset($globalInstallPassword)) print $globalInstallPassword; ?>" />
174 </p>
175 <p class="help-block">Password needed to access this install script. If empty, to access this script, you will need to change the $globalInstalled setting in require/settings.php to FALSE</p>
176 </fieldset>
177 <fieldset id="database">
178 <legend>Database configuration</legend>
180 <label for="dbtype">Database type</label>
181 <select name="dbtype" id="dbtype">
182 <option value="mysql" <?php if (isset($globalDBdriver) && $globalDBdriver == 'mysql') { ?>selected="selected" <?php } ?>>MySQL</option>
183 <option value="pgsql" <?php if (isset($globalDBdriver) && $globalDBdriver == 'pgsql') { ?>selected="selected" <?php } ?>>PostgreSQL</option>
184 </select>
185 </p>
187 <label for="createdb">Create database</label>
188 <input type="checkbox" name="createdb" id="createdb" value="createdb" onClick="create_database_js()" />
189 <p class="help-block">Create database will not work for MySQL >= 5.7 and MariaDB >= 10.1, you need to create DB and user manually</p>
190 </p>
191 <div id="createdb_data">
193 <label for="dbroot">Database admin user</label>
194 <input type="text" name="dbroot" id="dbroot" />
195 </p>
197 <label for="dbrootpass">Database admin password</label>
198 <input type="password" name="dbrootpass" id="dbrootpass" />
199 </p>
200 </div>
202 <label for="dbhost">Database hostname</label>
203 <input type="text" name="dbhost" id="dbhost" value="<?php if (isset($globalDBhost)) print $globalDBhost; ?>" />
204 </p>
206 <label for="dbport">Database port</label>
207 <input type="text" name="dbport" id="dbport" value="<?php if (isset($globalDBport)) print $globalDBport; ?>" />
208 <p class="help-block">Default is 3306 for MariaDB/MySQL, 5432 for PostgreSQL</p>
209 </p>
211 <label for="dbname">Database name</label>
212 <input type="text" name="dbname" id="dbname" value="<?php if (isset($globalDBname)) print $globalDBname; ?>" />
213 </p>
215 <label for="dbuser">Database user</label>
216 <input type="text" name="dbuser" id="dbuser" value="<?php if (isset($globalDBuser)) print $globalDBuser; ?>" />
217 </p>
219 <label for="dbuserpass">Database user password</label>
220 <input type="password" name="dbuserpass" id="dbuserpass" value="<?php if (isset($globalDBpass)) print $globalDBpass; ?>" />
221 </p>
222 </fieldset>
223 <fieldset id="site">
224 <legend>Site configuration</legend>
226 <label for="sitename">Site name</label>
227 <input type="text" name="sitename" id="sitename" value="<?php if (isset($globalName)) print $globalName; ?>" />
228 </p>
230 <label for="siteurl">Site directory</label>
231 <?php
232 // Try to detect site directory
233 if ((!isset($globalURL) || $globalURL == '') && (!isset($globalDBuser) || $globalDBuser == '')) {
234 if (isset($_SERVER['REQUEST_URI'])) {
235 $URL = $_SERVER['REQUEST_URI'];
236 $globalURL = str_replace('/install','',str_replace('/install/','',str_replace('/install/index.php','',$URL)));
240 <input type="text" name="siteurl" id="siteurl" value="<?php if (isset($globalURL)) print $globalURL; ?>" />
241 <p class="help-block">ex : <i>/flightairmap</i> if complete URL is <i>http://toto.com/flightairmap</i></p>
242 <p class="help-block">Can be empty</p>
243 </p>
245 <label for="timezone">Timezone</label>
246 <input type="text" name="timezone" id="timezone" value="<?php if (isset($globalTimezone)) print $globalTimezone; ?>" />
247 <p class="help-block">ex : UTC, Europe/Paris,...</p>
248 </p>
250 <label for="language">Language</label>
251 <input type="text" name="language" id="language" value="<?php if (isset($globalLanguage)) print $globalLanguage; ?>" />
252 <p class="help-block">Used only when link to wikipedia for now. Can be EN,DE,FR,...</p>
253 </p>
254 </fieldset>
255 <fieldset id="mapprov">
256 <legend>Map provider</legend>
258 <label for="mapprovider">Default map Provider</label>
259 <select name="mapprovider" id="mapprovider">
260 <option value="OpenStreetMap" <?php if (isset($globalMapProvider) && $globalMapProvider == 'OpenStreetMap') { ?>selected="selected" <?php } ?>>OpenStreetMap</option>
261 <option value="Mapbox" <?php if (isset($globalMapProvider) && $globalMapProvider == 'Mapbox') { ?>selected="selected" <?php } ?>>Mapbox</option>
262 <option value="MapQuest-OSM" <?php if (isset($globalMapProvider) && $globalMapProvider == 'MapQuest-OSM') { ?>selected="selected" <?php } ?>>MapQuest-OSM</option>
263 <option value="MapQuest-Aerial" <?php if (isset($globalMapProvider) && $globalMapProvider == 'MapQuest-Aerial') { ?>selected="selected" <?php } ?>>MapQuest-Aerial</option>
264 <option value="Bing-Hybrid" <?php if (isset($globalMapProvider) && $globalMapProvider == 'Bing-Hybrid') { ?>selected="selected" <?php } ?>>Bing Hybrid</option>
265 <option value="Yandex" <?php if (isset($globalMapProvider) && $globalMapProvider == 'Yandex') { ?>selected="selected" <?php } ?>>Yandex</option>
266 </select>
267 </p>
268 <div id="mapbox_data">
270 <label for="mapboxid">Mapbox id</label>
271 <input type="text" name="mapboxid" id="mapboxid" value="<?php if (isset($globalMapboxId)) print $globalMapboxId; ?>" />
272 </p>
274 <label for="mapboxtoken">Mapbox token</label>
275 <input type="text" name="mapboxtoken" id="mapboxtoken" value="<?php if (isset($globalMapboxToken)) print $globalMapboxToken; ?>" />
276 </p>
277 <p class="help-block">Get a key <a href="https://www.mapbox.com/developers/">here</a></p>
278 </div>
279 <br />
280 <div id="google_data">
282 <label for="googlekey">Google API key</label>
283 <input type="text" name="googlekey" id="googlekey" value="<?php if (isset($globalGoogleAPIKey)) print $globalGoogleAPIKey; ?>" />
284 <p class="help-block">Get a key <a href="https://developers.google.com/maps/documentation/javascript/get-api-key#get-an-api-key">here</a></p>
285 </p>
286 </div>
287 <br />
288 <div id="bing_data">
290 <label for="bingkey">Bing Map key</label>
291 <input type="text" name="bingkey" id="bingkey" value="<?php if (isset($globalBingMapKey)) print $globalBingMapKey; ?>" />
292 <p class="help-block">Get a key <a href="https://www.bingmapsportal.com/">here</a></p>
293 </p>
294 </div>
295 <br />
296 <div id="mapquest_data">
298 <label for="mapquestkey">MapQuest key</label>
299 <input type="text" name="mapquestkey" id="mapquestkey" value="<?php if (isset($globalMapQuestKey)) print $globalMapQuestKey; ?>" />
300 <p class="help-block">Get a key <a href="https://developer.mapquest.com/user/me/apps">here</a></p>
301 </p>
302 </div>
303 <br />
304 <div id="here_data">
306 <label for="hereappid">Here App_Id</label>
307 <input type="text" name="hereappid" id="hereappid" value="<?php if (isset($globalHereappId)) print $globalHereappId; ?>" />
308 </p>
310 <label for="hereappcode">Here App_Code</label>
311 <input type="text" name="hereappcode" id="hereappcode" value="<?php if (isset($globalHereappCode)) print $globalHereappCode; ?>" />
312 </p>
313 <p class="help-block">Get a key <a href="https://developer.here.com/rest-apis/documentation/enterprise-map-tile/topics/quick-start.html">here</a></p>
314 </div>
315 <br />
316 <div id="openweathermap_data">
318 <label for="openweathermapkey">OpenWeatherMap key (weather layer)</label>
319 <input type="text" name="openweathermapkey" id="openweathermapkey" value="<?php if (isset($globalOpenWeatherMapKey)) print $globalOpenWeatherMapKey; ?>" />
320 <p class="help-block">Get a key <a href="https://openweathermap.org/">here</a></p>
321 </p>
322 </div>
323 <br />
324 </fieldset>
325 <fieldset id="offline">
326 <legend>Offline mode</legend>
327 <?php
328 if (file_exists(dirname(__FILE__).'/../js/Cesium/Cesium.js')) {
331 <input type="checkbox" name="mapoffline" id="mapoffline" value="mapoffline" <?php if (isset($globalMapOffline) && $globalMapOffline) { ?>checked="checked" <?php } ?>/>
332 <label for="mapoffline">Map offline mode</label>
333 <p class="help-block">Map offline mode will not use network to display map but Natural Earth</p>
334 </p>
335 <?php
339 <input type="checkbox" name="globaloffline" id="globaloffline" value="globaloffline" <?php if (isset($globalOffline) && $globalOffline) { ?>checked="checked" <?php } ?>/>
340 <label for="globaloffline">Offline mode</label>
341 <p class="help-block">Backend will not use network</p>
342 </p>
343 </fieldset>
344 <fieldset id="coverage">
345 <legend>Coverage area</legend>
347 <label for="latitudemax">The maximum latitude (north)</label>
348 <input type="text" name="latitudemax" id="latitudemax" value="<?php if (isset($globalLatitudeMax)) print $globalLatitudeMax; ?>" />
349 </p>
351 <label for="latitudemin">The minimum latitude (south)</label>
352 <input type="text" name="latitudemin" id="latitudemin" value="<?php if (isset($globalLatitudeMin)) print $globalLatitudeMin; ?>" />
353 </p>
355 <label for="longitudemax">The maximum longitude (west)</label>
356 <input type="text" name="longitudemax" id="longitudemax" value="<?php if (isset($globalLongitudeMax)) print $globalLongitudeMax; ?>" />
357 </p>
359 <label for="longitudemin">The minimum longitude (east)</label>
360 <input type="text" name="longitudemin" id="longitudemin" value="<?php if (isset($globalLongitudeMin)) print $globalLongitudeMin; ?>" />
361 </p>
363 <label for="latitudecenter">The latitude center</label>
364 <input type="text" name="latitudecenter" id="latitudecenter" value="<?php if (isset($globalCenterLatitude)) print $globalCenterLatitude; ?>" />
365 </p>
367 <label for="longitudecenter">The longitude center</label>
368 <input type="text" name="longitudecenter" id="longitudecenter" value="<?php if (isset($globalCenterLongitude)) print $globalCenterLongitude; ?>" />
369 </p>
371 <label for="livezoom">Default Zoom on live map</label>
372 <input type="number" name="livezoom" id="livezoom" value="<?php if (isset($globalLiveZoom)) print $globalLiveZoom; else print '9'; ?>" />
373 </p>
375 <label for="squawk_country">Country for squawk usage</label>
376 <select name="squawk_country" id="squawk_country">
377 <option value="UK"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'UK') print ' selected '; ?>>UK</option>
378 <option value="NZ"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'NZ') print ' selected '; ?>>NZ</option>
379 <option value="US"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'US') print ' selected '; ?>>US</option>
380 <option value="AU"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'AU') print ' selected '; ?>>AU</option>
381 <option value="NL"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'NL') print ' selected '; ?>>NL</option>
382 <option value="FR"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'FR') print ' selected '; ?>>FR</option>
383 <option value="TR"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'TR') print ' selected '; ?>>TR</option>
384 </select>
385 </p>
386 </fieldset>
387 <fieldset id="zone">
388 <legend>Zone of interest</legend>
389 <p><i>Only put in DB flights that are inside a circle</i></p>
391 <label for="latitude">Center latitude</label>
392 <input type="text" name="zoilatitude" id="latitude" value="<?php if (isset($globalDistanceIgnore['latitude'])) echo $globalDistanceIgnore['latitude']; ?>" />
393 </p>
395 <label for="longitude">Center longitude</label>
396 <input type="text" name="zoilongitude" id="longitude" value="<?php if (isset($globalDistanceIgnore['longitude'])) echo $globalDistanceIgnore['longitude']; ?>" />
397 </p>
399 <label for="Distance">Distance (in km)</label>
400 <input type="text" name="zoidistance" id="distance" value="<?php if (isset($globalDistanceIgnore['distance'])) echo $globalDistanceIgnore['distance']; ?>" />
401 </p>
402 </fieldset>
403 <fieldset id="sourceloc">
404 <legend>Sources location</legend>
405 <table class="sources">
406 <thead>
407 <tr>
408 <th>Name</th>
409 <th>Latitude</th>
410 <th>Longitude</th>
411 <th>Altitude (in m)</th>
412 <th>City</th>
413 <th>Country</th>
414 <th>Source name</th>
415 </tr>
416 </thead>
417 <tbody>
418 <?php
419 if (isset($globalDBuser) && isset($globalDBpass) && $globalDBuser != '' && $globalDBpass != '') {
421 <!--
422 <?php
423 require_once(dirname(__FILE__).'/../require/class.Connection.php');
424 $Connection = new Connection();
427 <?php
428 if ($Connection->db != NULL) {
429 if ($Connection->tableExists('source_location')) {
430 require_once(dirname(__FILE__).'/../require/class.Source.php');
431 $Source = new Source();
432 //$alllocations = $Source->getAllLocationInfo();
433 $alllocations = $Source->getLocationInfobyType('');
434 foreach ($alllocations as $location) {
436 <tr>
437 <input type="hidden" name="source_id[]" value="<?php print $location['id']; ?>" />
438 <td><input type="text" name="source_name[]" value="<?php print $location['name']; ?>" /></td>
439 <td><input type="text" name="source_latitude[]" value="<?php print $location['latitude']; ?>" /></td>
440 <td><input type="text" name="source_longitude[]" value="<?php print $location['longitude']; ?>" /></td>
441 <td><input type="text" name="source_altitude[]" value="<?php print $location['altitude']; ?>" /></td>
442 <td><input type="text" name="source_city[]" value="<?php print $location['city']; ?>" /></td>
443 <td><input type="text" name="source_country[]" value="<?php print $location['country']; ?>" /></td>
444 <td><input type="text" name="source_ref[]" value="<?php print $location['source']; ?>" /></td>
445 </tr>
447 <?php
454 <tr>
455 <td><input type="text" name="source_name[]" value="" /></td>
456 <td><input type="text" name="source_latitude[]" value="" /></td>
457 <td><input type="text" name="source_longitude[]" value="" /></td>
458 <td><input type="text" name="source_altitude[]" value="" /></td>
459 <td><input type="text" name="source_city[]" value="" /></td>
460 <td><input type="text" name="source_country[]" value="" /></td>
461 <td><input type="text" name="source_ref[]" value="" /></td>
462 </tr>
463 </tbody>
464 </table>
465 <center>
466 <input type="button" value="Add a row" class="add-row-source" />
467 <input type="button" value="Remove last row" class="del-row-source" />
468 </center>
469 </fieldset>
470 <fieldset>
471 <legend>Source Type</legend>
473 <input type="checkbox" name="globalaircraft" id="aircraft" value="aircraft" <?php if (!isset($globalAircraft) || $globalAircraft) { ?>checked="checked" <?php } ?>/>
474 <label for="aircraft">Aircrafts</label>
475 <input type="checkbox" name="globaltracker" id="tracker" value="tracker" <?php if (isset($globalTracker) && $globalTracker) { ?>checked="checked" <?php } ?>/>
476 <label for="tracker">Trackers</label>
477 <input type="checkbox" name="globalmarine" id="marine" value="marine" <?php if (isset($globalMarine) && $globalMarine) { ?>checked="checked" <?php } ?>/>
478 <label for="marine">Ships/Vessels</label>
479 <input type="checkbox" name="globalsatellite" id="satellite" value="satellite" <?php if (isset($globalSatellite) && $globalSatellite) { ?>checked="checked" <?php } ?>/>
480 <label for="satellite">Satellites</label>
481 </p>
482 </fieldset>
483 <fieldset id="datasource">
484 <legend>Data source</legend>
486 <b>Virtual flights</b>
488 <p><i>If you choose IVAO, airlines names and logos will come from ivao.aero (you have to run install/populate_ivao.php to populate table with IVAO data)</i></p>
489 <input type="checkbox" name="globalva" id="va" value="va" onClick="datasource_js()" <?php if (isset($globalVA) && $globalVA) { ?>checked="checked" <?php } ?>/>
490 <label for="va">Virtual Airlines</label>
491 <input type="checkbox" name="globalivao" id="ivao" value="ivao" onClick="datasource_js()" <?php if (isset($globalIVAO) && $globalIVAO) { ?>checked="checked" <?php } ?>/>
492 <label for="ivao">IVAO</label>
493 <input type="checkbox" name="globalvatsim" id="vatsim" value="vatsim" onClick="datasource_js()" <?php if (isset($globalVATSIM) && $globalVATSIM) { ?>checked="checked" <?php } ?>/>
494 <label for="vatsim">VATSIM</label>
495 <input type="checkbox" name="globalphpvms" id="phpvms" value="phpvms" onClick="datasource_js()" <?php if (isset($globalphpVMS) && $globalphpVMS) { ?>checked="checked" <?php } ?>/>
496 <label for="phpvms">phpVMS</label>
497 <input type="checkbox" name="globalvam" id="vam" value="vam" onClick="datasource_js()" <?php if (isset($globalVAM) && $globalVAM) { ?>checked="checked" <?php } ?>/>
498 <label for="vam">Virtual Airline Manager</label>
499 </p>
500 </p><p>
501 <b>Real flights</b>
503 <!--
504 <input type="radio" name="datasource" id="flightaware" value="flightaware" onClick="datasource_js()" <?php if (isset($globalFlightAware) && $globalFlightAware) { ?>checked="checked" <?php } ?>/>
505 <label for="flightaware">FlightAware (not tested, no more supported no data feed available for test)</label>
507 <input type="checkbox" name="globalsbs" id="sbs" value="sbs" onClick="datasource_js()" <?php if (isset($globalSBS1) && $globalSBS1) { ?>checked="checked" <?php } ?> />
508 <label for="sbs">ADS-B, SBS-1 format (dump1090 or SBS-1 compatible format)</label>
509 <input type="checkbox" name="globalaprs" id="aprs" value="aprs" onClick="datasource_js()" <?php if (isset($globalAPRS) && $globalAPRS) { ?>checked="checked" <?php } ?> />
510 <label for="sbs">APRS from glidernet</label>
511 <input type="checkbox" name="acars" id="acars" value="acars" onClick="datasource_js()" <?php if (isset($globalACARS) && $globalACARS) { ?>checked="checked" <?php } ?> />
512 <label for="acars">ACARS</label>
513 </p>
514 </p>
516 <b>Virtual marine</b>
518 <input type="checkbox" name="globalvm" id="globalvm" value="vm" onClick="datasource_js()" <?php if (isset($globalVM) && $globalVM) { ?>checked="checked" <?php } ?>/>
519 <label for="globalvm">Virtual Marine</label>
520 </p>
522 <!--
523 <div id="flightaware_data">
525 <label for="flightawareusername">FlightAware username</label>
526 <input type="text" name="flightawareusername" id="flightawareusername" value="<?php if (isset($globalFlightAwareUsername)) print $globalFlightAwareUsername; ?>" />
527 </p>
529 <label for="flightawarepassword">FlightAware password/API key</label>
530 <input type="text" name="flightawarepassword" id="flightawarepassword" value="<?php if (isset($globalFlightAwarePassword)) print $globalFlightAwarePassword; ?>" />
531 </p>
532 </div>
534 <div id="sailaway_data">
536 <label for="sailawayemail">Sailaway email</label>
537 <input type="text" name="sailawayemail" id="sailawayemail" value="<?php if (isset($globalSailaway['email'])) print $globalSailaway['email']; ?>" />
538 </p>
540 <label for="sailawaypassword">Sailaway password</label>
541 <input type="text" name="sailawaypassword" id="sailawaypassword" value="<?php if (isset($globalSailaway['password'])) print $globalSailaway['password']; ?>" />
542 </p>
543 </div>
545 <!-- <div id="sbs_data">
547 <fieldset id="sources">
548 <legend>Sources</legend>
549 <table id="SourceTable" class="table">
550 <thead>
551 <tr>
552 <th>Host/URL</th>
553 <th>Port/Callback pass</th>
554 <th>Format</th>
555 <th>Name</th>
556 <th>Source Stats</th>
557 <th>No archive</th>
558 <th>Source TimeZone</th>
559 <th>Action</th>
560 </tr>
561 </thead>
562 <tbody>
563 <?php
565 if (!isset($globalSources) && isset($globalSBS1Hosts)) {
566 if (!is_array($globalSBS1Hosts)) {
567 $globalSources[] = array('host' => $globalSBS1Hosts);
568 } else {
569 foreach ($globalSBS1Hosts as $host) {
570 $globalSources[] = array('host' => $host);
574 $i = 0;
575 if (isset($globalSources)) {
576 foreach ($globalSources as $source) {
578 <tr>
579 <?php
580 if (filter_var($source['host'],FILTER_VALIDATE_URL)) {
582 <td><input type="text" name="host[]" value="<?php print $source['host']; ?>" /></td>
583 <td><input type="text" name="port[]" class="col-xs-2" value="<?php if (isset($source['port'])) print $source['port']; ?>" /></td>
584 <?php
585 } else {
586 $hostport = explode(':',$source['host']);
587 if (isset($hostport[1])) {
588 $host = $hostport[0];
589 $port = $hostport[1];
590 } else {
591 $host = $source['host'];
592 $port = $source['port'];
595 <td><input type="text" name="host[]" value="<?php print $host; ?>" /></td>
596 <td><input type="text" name="port[]" class="col-xs-2" value="<?php print $port; ?>" /></td>
597 <?php
600 <td>
601 <select name="format[]">
602 <option value="auto" <?php if (!isset($source['format'])) print 'selected'; ?>>Auto</option>
603 <option value="sbs" <?php if (isset($source['format']) && $source['format'] == 'sbs') print 'selected'; ?>>SBS</option>
604 <option value="tsv" <?php if (isset($source['format']) && $source['format'] == 'tsv') print 'selected'; ?>>TSV</option>
605 <option value="raw" <?php if (isset($source['format']) && $source['format'] == 'raw') print 'selected'; ?>>Raw</option>
606 <option value="aircraftjson" <?php if (isset($source['format']) && $source['format'] == 'aircraftjson') print 'selected'; ?>>Dump1090 aircraft.json</option>
607 <option value="planefinderclient" <?php if (isset($source['format']) && $source['format'] == 'planefinderclient') print 'selected'; ?>>Planefinder client</option>
608 <option value="aprs" <?php if (isset($source['format']) && $source['format'] == 'aprs') print 'selected'; ?>>APRS</option>
609 <option value="deltadbtxt" <?php if (isset($source['format']) && $source['format'] == 'deltadbtxt') print 'selected'; ?>>Radarcape deltadb.txt</option>
610 <option value="radarcapejson" <?php if (isset($source['format']) && $source['format'] == 'radarcapejson') print 'selected'; ?>>Radarcape json</option>
611 <option value="vatsimtxt" <?php if (isset($source['format']) && $source['format'] == 'vatsimtxt') print 'selected'; ?>>Vatsim</option>
612 <option value="aircraftlistjson" <?php if (isset($source['format']) && $source['format'] == 'aircraftlistjson') print 'selected'; ?>>Virtual Radar Server AircraftList.json</option>
613 <option value="vrstcp" <?php if (isset($source['format']) && $source['format'] == 'vrstcp') print 'selected'; ?>>Virtual Radar Server TCP</option>
614 <option value="phpvmacars" <?php if (isset($source['format']) && $source['format'] == 'phpvmacars') print 'selected'; ?>>phpVMS</option>
615 <option value="vaos" <?php if (isset($source['format']) && $source['format'] == 'phpvmacars') print 'selected'; ?>>Virtual Airline Operations System (VAOS)</option>
616 <option value="vam" <?php if (isset($source['format']) && $source['format'] == 'vam') print 'selected'; ?>>Virtual Airlines Manager</option>
617 <option value="whazzup" <?php if (isset($source['format']) && $source['format'] == 'whazzup') print 'selected'; ?>>IVAO</option>
618 <option value="flightgearmp" <?php if (isset($source['format']) && $source['format'] == 'flightgearmp') print 'selected'; ?>>FlightGear Multiplayer</option>
619 <option value="flightgearsp" <?php if (isset($source['format']) && $source['format'] == 'flightgearsp') print 'selected'; ?>>FlightGear Singleplayer</option>
620 <option value="acars" <?php if (isset($source['format']) && $source['format'] == 'acars') print 'selected'; ?>>ACARS from acarsdec/acarsdeco2 over UDP</option>
621 <option value="acarssbs3" <?php if (isset($source['format']) && $source['format'] == 'acarssbs3') print 'selected'; ?>>ACARS SBS-3 over TCP</option>
622 <option value="acarsjson" <?php if (isset($source['format']) && $source['format'] == 'acarsjson') print 'selected'; ?>>ACARS from acarsdec json and vdlm2dec</option>
623 <option value="ais" <?php if (isset($source['format']) && $source['format'] == 'ais') print 'selected'; ?>>NMEA AIS over TCP</option>
624 <option value="airwhere" <?php if (isset($source['format']) && $source['format'] == 'airwhere') print 'selected'; ?>>AirWhere website</option>
625 <option value="hidnseek_callback" <?php if (isset($source['format']) && $source['format'] == 'hidnseek_callback') print 'selected'; ?>>HidnSeek Callback</option>
626 <option value="blitzortung" <?php if (isset($source['format']) && $source['format'] == 'blitzortung') print 'selected'; ?>>Blitzortung</option>
627 <option value="sailaway" <?php if (isset($source['format']) && $source['format'] == 'sailaway') print 'selected'; ?>>Sailaway</option>
628 </select>
629 </td>
630 <td>
631 <input type="text" name="name[]" value="<?php if (isset($source['name'])) print $source['name']; ?>" />
632 </td>
633 <td><input type="checkbox" name="sourcestats[]" title="Create statistics for the source like number of messages, distance,..." value="1" <?php if (isset($source['sourcestats']) && $source['sourcestats']) print 'checked'; ?> /></td>
634 <td><input type="checkbox" name="noarchive[]" title="Don't archive this source" value="1" <?php if (isset($source['noarchive']) && $source['noarchive']) print 'checked'; ?> /></td>
635 <td>
636 <select name="timezones[]">
637 <?php
638 $timezonelist = DateTimeZone::listIdentifiers(DateTimeZone::ALL);
639 foreach($timezonelist as $timezones){
640 if (isset($source['timezone']) && $source['timezone'] == $timezones) {
641 print '<option selected>'.$timezones.'</option>';
642 } elseif (!isset($source['timezone']) && $timezones == 'UTC') {
643 print '<option selected>'.$timezones.'</option>';
644 } else print '<option>'.$timezones.'</option>';
647 </select>
648 </td>
649 <td><input type="button" value="Delete" onclick="deleteRow(this)" /> <input type="button" value="Add" onclick="insRow()" /></td>
650 </tr>
651 <?php
655 <tr>
656 <td><input type="text" name="host[]" value="" /></td>
657 <td><input type="text" name="port[]" class="col-xs-2" value="" /></td>
658 <td>
659 <select name="format[]">
660 <option value="auto">Auto</option>
661 <option value="sbs">SBS</option>
662 <option value="tsv">TSV</option>
663 <option value="raw">Raw</option>
664 <option value="aircraftjson">Dump1090 aircraft.json</option>
665 <option value="planefinderclient">Planefinder client</option>
666 <option value="aprs">APRS</option>
667 <option value="deltadbtxt">Radarcape deltadb.txt</option>
668 <option value="radarcapejson">Radarcape json</option>
669 <option value="vatsimtxt">Vatsim</option>
670 <option value="aircraftlistjson">Virtual Radar Server AircraftList.json</option>
671 <option value="vrstcp">Virtual Radar Server TCP</option>
672 <option value="phpvmacars">phpVMS</option>
673 <option value="vaos">Virtual Airline Operations System (VAOS)</option>
674 <option value="vam">Virtual Airlines Manager</option>
675 <option value="whazzup">IVAO</option>
676 <option value="flightgearmp">FlightGear Multiplayer</option>
677 <option value="flightgearsp">FlightGear Singleplayer</option>
678 <option value="acars">ACARS from acarsdec/acarsdeco2 over UDP</option>
679 <option value="acarssbs3">ACARS SBS-3 over TCP</option>
680 <option value="acarsjson">ACARS from acarsdec json and vdlm2dec</option>
681 <option value="ais">NMEA AIS over TCP</option>
682 <option value="airwhere">AirWhere website</option>
683 <option value="hidnseek_callback">HidnSeek Callback</option>
684 <option value="blitzortung">Blitzortung</option>
685 <option value="sailaway">Sailaway</option>
686 </select>
687 </td>
688 <td>
689 <input type="text" name="name[]" value="" id="name" />
690 </td>
691 <td><input type="checkbox" name="sourcestats[]" id="sourcestats" title="Create statistics for the source like number of messages, distance,..." value="1" /></td>
692 <td><input type="checkbox" name="noarchive[]" id="noarchive" title="Don't archive this source" value="1" /></td>
693 <td>
694 <select name="timezones[]" id="timezones">
695 <?php
696 $timezonelist = DateTimeZone::listIdentifiers(DateTimeZone::ALL);
697 foreach($timezonelist as $timezones){
698 if ($timezones == 'UTC') {
699 print '<option selected>'.$timezones.'</option>';
700 } else print '<option>'.$timezones.'</option>';
703 </select>
704 </td>
705 <td><input type="button" id="delhosti" value="Delete" onclick="deleteRow(this)" /> <input type="button" id="addhosti" value="Add" onclick="insRow()" /></td>
706 </tr>
707 </tbody>
708 </table>
709 <p class="help-block">Source timezone is to define timezone used by a source if not UTC (not your timezone).</p>
710 <p class="help-block">For working source statistics, the name of the source <b>MUST</b> be the same as the source name of a source location, else center coverage latitude and longitude is used as source position. This is not available/usable with virtual airlines.</p>
711 <p class="help-block">FlightGear Singleplayer open an UDP server, the host should be <i>0.0.0.0</i>.</p>
712 <p class="help-block">Virtual Airlines Manager need to use the file <i>install/vAM/VAM-json.php</i> and the url <i>http://yourvaminstall/VAM-json.php</i>.</p>
713 <p class="help-block">For a local file, you should use file:// before the path.</p>
714 <p class="help-block">URL and TCP sources can't be used at the same time.</p>
715 <!-- ' -->
716 <p class="help-block">Callback script is in <i>import/callback.php</i>. In host you can restrict access to some IP, Callback pass to restrict by a pass using <i>import/callback.php?pass=yourpass</i>.</p>
717 </fieldset>
718 </fieldset>
719 <div id="acars_data">
720 <fieldset>
721 <legend>Source ACARS</legend>
722 <p>Listen UDP server for acarsdec/acarsdeco2/... with <i>daemon-acars.php</i> script</p>
724 <label for="acarshost">ACARS UDP host</label>
725 <input type="text" name="acarshost" id="acarshost" value="<?php if (isset($globalACARSHost)) print $globalACARSHost; ?>" />
726 </p>
728 <label for="acarsport">ACARS UDP port</label>
729 <input type="number" name="acarsport" id="acarsport" value="<?php if (isset($globalACARSPort)) print $globalACARSPort; ?>" />
730 </p>
731 <p class="help-block"><i>daemon-acars.php</i> can only be run as daemon. It's an alternate script for ACARS data, <i>daemon-spotter.php</i> may be better.</p>
732 </fieldset>
733 </div>
734 </fieldset>
735 <fieldset id="newsi">
736 <legend>News</legend>
737 <table class="newsi table" id="NewsTable">
738 <thead>
739 <tr>
740 <td>RSS/Atom URL</td>
741 <td>Language</td>
742 <td>Type</td>
743 <td>Action</td>
744 </thead>
745 <tbody>
746 <?php
747 if (isset($globalNewsFeeds) && !empty($globalNewsFeeds)) {
748 foreach ($globalNewsFeeds as $type => $feedslng) {
749 foreach ($feedslng as $lng => $feeds) {
750 foreach ($feeds as $feed) {
752 <tr>
753 <td><input type="url" name="newsurl[]" value="<?php print $feed; ?>"/></td>
754 <td>
755 <select name="newslang[]">
756 <option value="en"<?php if ($lng == 'en') print ' selected'; ?>>English</option>
757 <option value="fr"<?php if ($lng == 'fr') print ' selected'; ?>>French</option>
758 </select>
759 </td>
760 <td>
761 <select name="newstype[]">
762 <option value="global"<?php if ($type == 'global') print ' selected'; ?>>Global</option>
763 <option value="aircraft"<?php if ($type == 'aircraft') print ' selected'; ?>>Aircraft</option>
764 <option value="marine"<?php if ($type == 'marine') print ' selected'; ?>>Marine</option>
765 <option value="tracker"<?php if ($type == 'tracker') print ' selected'; ?>>Tracker</option>
766 <option value="satellite"<?php if ($type == 'Satellite') print ' selected'; ?>>Satellite</option>
767 </select>
768 </td>
769 <td><input type="button" value="Delete" onclick="deleteRowNews(this)" /> <input type="button" value="Add" onclick="insRowNews()" /></td>
770 </tr>
772 <?php
778 <tr>
779 <td><input type="url" name="newsurl[]" /></td>
780 <td>
781 <select name="newslang[]">
782 <option value="en">English</option>
783 <option value="fr">French</option>
784 </select>
785 </td>
786 <td>
787 <select name="newstype[]">
788 <option value="global">Global</option>
789 <option value="aircraft">Aircraft</option>
790 <option value="marine">Marine</option>
791 <option value="tracker">Tracker</option>
792 <option value="satellite">Satellite</option>
793 </select>
794 </td>
795 <td><input type="button" value="Delete" onclick="deleteRowNews(this)" /> <input type="button" value="Add" onclick="insRowNews()" /></td>
796 </tr>
797 </tbody>
798 </table>
799 <p class="help-block"><i>News</i> page syndicate RSS/Atom feeds. If you only use one mode, use type global.</p>
800 </fieldset>
802 <fieldset id="optional">
803 <legend>Optional configuration</legend>
805 <label for="crash">Add accident/incident support for real flights</label>
806 <input type="checkbox" name="crash" id="crash" value="crash"<?php if ((isset($globalAccidents) && $globalAccidents) || !isset($globalAccidents)) { ?> checked="checked"<?php } ?> />
807 </p>
808 <br />
810 <label for="firessupport">Add fires support</label>
811 <input type="checkbox" name="firessupport" id="firessupport" value="firessupport"<?php if (isset($globalFires) && $globalFires) { ?> checked="checked"<?php } ?> />
812 <p class="help-block">Fires are updated via <i>update_db.php</i> script.</p>
813 </p>
815 <label for="fires">Display fires on map</label>
816 <input type="checkbox" name="fires" id="fires" value="fires"<?php if (isset($globalMapFires) && $globalMapFires) { ?> checked="checked"<?php } ?> />
817 <p class="help-block">Display all fires on map by default.</p>
818 </p>
819 <br />
821 <label for="map3d">Enable map in 3D</label>
822 <input type="checkbox" name="map3d" id="map3d" value="map3d"<?php if ((isset($globalMap3D) && $globalMap3D) || !isset($globalMap3D)) { ?> checked="checked"<?php } ?> />
823 <p class="help-block">Bing map key is needed. <i>scripts/update_db.php</i> will download 3d models needed, about 400Mo is needed for all models.</p>
824 </p>
826 <label for="map3ddefault">Default to map in 3D</label>
827 <input type="checkbox" name="map3ddefault" id="map3ddefault" value="map3ddefault"<?php if (isset($globalMap3Ddefault) && $globalMap3Ddefault) { ?> checked="checked"<?php } ?> />
828 </p>
830 <label for="one3dmodel">Use same 3D model for all aircraft</label>
831 <input type="checkbox" name="one3dmodel" id="one3dmodel" value="one3dmodel"<?php if (isset($globalMap3DOneModel) && $globalMap3DOneModel) { ?> checked="checked"<?php } ?> />
832 <p class="help-block">Use less resources</p>
833 </p>
835 <label for="map3dliveries">Display real liveries</label>
836 <input type="checkbox" name="map3dliveries" id="map3dliveries" value="map3dliveries"<?php if (isset($globalMap3DLiveries) && $globalMap3DLiveries) { ?> checked="checked"<?php } ?> />
837 <p class="help-block">Liveries will be loaded when you click on a flight (about 300Mo is needed for all liveries)</p>
838 </p>
840 <label for="map3dtileset">3D Tiles</label>
841 <input type="text" name="map3dtileset" id="map3dtileset" value="<?php if (isset($globalMap3DTiles) && $globalMap3DTiles) { print $globalMap3DTiles; } ?>" />
842 <p class="help-block">Set the url of your 3D Tiles</p>
843 </p>
845 <label for="map3dshadows">Use sun shadows on 3D models</label>
846 <input type="checkbox" name="map3dshadows" id="map3dshadows" value="map3dshadows"<?php if (!isset($globalMap3DShadows) || (isset($globalMap3DShadows) && $globalMap3DShadows)) { ?> checked="checked" <?php } ?> />
847 </p>
849 <label for="corsproxy">CORS proxy</label>
850 <input type="text" name="corsproxy" id="corsproxy" value="<?php if (isset($globalCORSproxy)) print $globalCORSproxy; else print 'https://galvanize-cors-proxy.herokuapp.com/' ?>" />
851 <p class="help-block">CORS proxy used for some WMS servers</p>
852 </p>
853 <!--
855 <label for="mapsatellites">Enable satellites in 3D map</label>
856 <input type="checkbox" name="mapsatellites" id="mapsatellites" value="mapsatellites"<?php if ((isset($globalMapSatellites) && $globalMapSatellites) || !isset($globalMapSatellites)) { ?> checked="checked"<?php } ?> />
857 <p class="help-block">Bing map key is needed.</p>
858 </p>
860 <br />
862 <label for="translate">Allow site translation</label>
863 <input type="checkbox" name="translate" id="translate" value="translate"<?php if (isset($globalTranslate) && $globalTranslate) { ?> checked="checked"<?php } ?> />
864 <p class="help-block">Display language available, else the site is only available in english.</p>
865 </p>
866 <br />
868 <label for="realairlines">Always use real airlines</label>
869 <input type="checkbox" name="realairlines" id="realairlines" value="realairlines"<?php if (isset($globalUseRealAirlines) && $globalUseRealAirlines) { ?> checked="checked"<?php } ?> />
870 <p class="help-block">Use real airlines for IVAO or VATSIM.</p>
871 </p>
872 <br />
874 <label for="estimation">Planes animate between updates</label>
875 <input type="checkbox" name="estimation" id="estimation" value="estimation"<?php if (isset($globalMapEstimation) && $globalMapEstimation) { ?> checked="checked"<?php } ?> />
876 <p class="help-block">Estimate plane track between flights refresh.</p>
877 </p>
878 <br />
880 <label for="unitdistance">Unit for distance</label>
881 <select name="unitdistance" id="unitdistance">
882 <option value="km" <?php if (isset($globalUnitDistance) && $globalUnitDistance == 'km') { ?>selected="selected" <?php } ?>>Kilometres</option>
883 <option value="nm" <?php if (isset($globalUnitDistance) && $globalUnitDistance == 'nm') { ?>selected="selected" <?php } ?>>Nautical Miles</option>
884 <option value="mi" <?php if (isset($globalUnitDistance) && $globalUnitDistance == 'mi') { ?>selected="selected" <?php } ?>>Statute Miles</option>
885 </select>
886 </p>
888 <label for="unitaltitude">Unit for altitude</label>
889 <select name="unitaltitude" id="unitaltitude">
890 <option value="m" <?php if (isset($globalUnitAltitude) && $globalUnitAltitude == 'm') { ?>selected="selected" <?php } ?>>Metres</option>
891 <option value="feet" <?php if (isset($globalUnitAltitude) && $globalUnitAltitude == 'feet') { ?>selected="selected" <?php } ?>>Feet</option>
892 </select>
893 </p>
895 <label for="unitspeed">Unit for speed</label>
896 <select name="unitspeed" id="unitspeed">
897 <option value="kmh" <?php if (isset($globalUnitSpeed) && $globalUnitSpeed == 'kmh') { ?>selected="selected" <?php } ?>>Kilometres/Hour</option>
898 <option value="mph" <?php if (isset($globalUnitSpeed) && $globalUnitSpeed == 'mph') { ?>selected="selected" <?php } ?>>Miles/Hour</option>
899 <option value="knots" <?php if (isset($globalUnitSpeed) && $globalUnitSpeed == 'knots') { ?>selected="selected" <?php } ?>>Knots</option>
900 </select>
901 </p>
902 <br />
903 <div id="optional_sbs">
905 <label for="schedules">Retrieve schedules from external websites</label>
906 <input type="checkbox" name="schedules" id="schedules" value="schedules"<?php if (isset($globalSchedulesFetch) && $globalSchedulesFetch || !isset($globalSchedulesFetch)) { ?> checked="checked"<?php } ?> onClick="schedule_js()" />
907 <p class="help-block">Not available for IVAO</p>
908 </p>
909 <br />
910 <div id="schedules_options">
912 <label for="britishairways">British Airways API Key</label>
913 <input type="text" name="britishairways" id="britishairways" value="<?php if (isset($globalBritishAirwaysKey)) print $globalBritishAirwaysKey; ?>" />
914 <p class="help-block">Register an account on <a href="https://developer.ba.com/">https://developer.ba.com/</a></p>
915 </p>
916 <!--
918 <label for="transavia">Transavia Test API Consumer Key</label>
919 <input type="text" name="transavia" id="transavia" value="<?php if (isset($globalTransaviaKey)) print $globalTransaviaKey; ?>" />
920 <p class="help-block">Register an account on <a href="https://developer.transavia.com">https://developer.transavia.com</a></p>
921 </p>
924 <div class="form-group">
925 <b>Lufthansa API Key</b>
927 <label for="lufthansakey">Key</label>
928 <input type="text" name="lufthansakey" id="lufthansakey" value="<?php if (isset($globalLufthansaKey['key'])) print $globalLufthansaKey['key']; ?>" />
929 </p><p>
930 <label for="lufthansasecret">Secret</label>
931 <input type="text" name="lufthansasecret" id="lufthansasecret" value="<?php if (isset($globalLufthansaKey['secret'])) print $globalLufthansaKey['secret']; ?>" />
932 </p>
933 </div>
934 <p class="help-block">Register an account on <a href="https://developer.lufthansa.com/page">https://developer.lufthansa.com/page</a></p>
935 </p>
937 <div class="form-group">
938 <b>FlightAware API Key</b>
940 <label for="flightawareusername">Username</label>
941 <input type="text" name="flightawareusername" id="flightawareusername" value="<?php if (isset($globalFlightAwareUsername)) print $globalFlightAwareUsername; ?>" />
942 </p>
944 <label for="flightawarepassword">API key</label>
945 <input type="text" name="flightawarepassword" id="flightawarepassword" value="<?php if (isset($globalFlightAwarePassword)) print $globalFlightAwarePassword; ?>" />
946 </p>
947 </div>
948 <p class="help-block">Register an account on <a href="https://www.flightaware.com/">https://www.flightaware.com/</a></p>
949 </p>
950 </div>
951 <br />
953 <label for="mapmatching">Map Matching</label>
954 <input type="checkbox" name="mapmatching" id="mapmatching" value="mapmatching"<?php if (isset($globalMapMatching) && $globalMapMatching) { ?> checked="checked"<?php } ?> onClick="mapmatching_js()" />
955 <p class="help-block">Only for Tracker mode</p>
956 </p>
957 <br />
958 <div id="mapmatching_options">
960 <label for="mapmatchingsource">Map Matching source</label>
961 <select name="mapmatchingsource" id="mapmatchingsource">
962 <option value="fam" <?php if ((isset($globalMapMatchingSource) && $globalMapMatchingSource == 'fam') || !isset($globalMatchingSource)) print 'selected="selected" '; ?>>FlightAirMap Map Matching</option>
963 <option value="graphhopper" <?php if (isset($globalMapMatchingSource) && $globalMapMatchingSource == 'graphhopper') print 'selected="selected" '; ?>>GraphHopper</option>
964 <option value="osmr" <?php if (isset($globalMapMatchingSource) && $globalMapMatchingSource == 'osmr') print 'selected="selected" '; ?>>OSMR</option>
965 <option value="mapbox" <?php if (isset($globalMapMatchingSource) && $globalMapMatchingSource == 'mapbox') print 'selected="selected" '; ?>>Mapbox</option>
966 </select>
967 <p class="help-block">Mapbox need the API Key defined in map section.</p>
968 <p class="help-block">FlightAirMap Map Matching is free, without API key but limited to about 100 input points to keep fast results.</p>
969 </p>
970 <br />
972 <label for="graphhopper">GraphHopper API Key</label>
973 <input type="text" name="graphhopper" id="graphhopper" value="<?php if (isset($globalGraphHopperKey)) print $globalGraphHopperKey; ?>" />
974 <p class="help-block">Register an account on <a href="https://www.graphhopper.com/">https://www.graphhopper.com/</a></p>
975 </p>
976 </div>
977 <br />
979 <label for="owner">Add private owners of aircrafts</label>
980 <input type="checkbox" name="owner" id="owner" value="owner"<?php if (isset($globalOwner) && $globalOwner) { ?> checked="checked"<?php } ?> />
981 <p class="help-block">Display also private owners of aircrafts, else only commercial owners are available</p>
982 </p>
983 </div>
984 <br />
986 <label for="notam">Activate NOTAM support</label>
987 <input type="checkbox" name="notam" id="notam" value="notam"<?php if (isset($globalNOTAM) && $globalNOTAM) { ?> checked="checked"<?php } ?> />
988 </p>
990 <label for="notamsource">URL of your feed from notaminfo.com</label>
991 <input type="text" name="notamsource" id="notamsource" value="<?php if (isset($globalNOTAMSource)) print $globalNOTAMSource; ?>" />
992 <p class="help-block">If you want to use world NOTAM from FlightAirMap website, leave it blank</p>
993 </p>
994 <br />
996 <label for="metar">Activate METAR support</label>
997 <input type="checkbox" name="metar" id="metar" value="metar"<?php if (isset($globalMETAR) && $globalMETAR) { ?> checked="checked"<?php } ?> />
998 </p>
1000 <label for="metarcycle">Activate METAR cycle support</label>
1001 <input type="checkbox" name="metarcycle" id="metarcycle" onClick="metarcycle_js()" value="metarcycle"<?php if (isset($globalMETARcycle) && $globalMETARcycle) { ?> checked="checked"<?php } ?> />
1002 <p class="help-block">Download feed from NOAA every hour. Need <i>scripts/update_db.php</i> in cron</p>
1003 </p>
1004 <div id="metarsrc">
1006 <label for="metarsource">URL of your METAR source</label>
1007 <input type="text" name="metarsource" id="metarsource" value="<?php if (isset($globalMETARurl)) print $globalMETARurl; ?>" />
1008 <p class="help-block">Use {icao} to specify where we replace by airport icao. ex : http://metar.vatsim.net/metar.php?id={icao}</p>
1009 </p>
1010 </div>
1011 <br />
1013 <label for="bitly">Bit.ly access token api (used in search page)</label>
1014 <input type="text" name="bitly" id="bitly" value="<?php if (isset($globalBitlyAccessToken)) print $globalBitlyAccessToken; ?>" />
1015 </p>
1016 <br />
1018 <label for="waypoints">Add Waypoints, Airspace and countries data (about 45Mio in DB) <i>Need PostGIS if you use PostgreSQL</i></label>
1019 <input type="checkbox" name="waypoints" id="waypoints" value="waypoints"<?php if (!isset($globalWaypoints) || (isset($globalWaypoints) && $globalWaypoints)) { ?> checked="checked"<?php } ?> />
1020 </p>
1021 <br />
1023 <label for="geoid">Geoid support</label>
1024 <input type="checkbox" name="geoid" id="geoid" value="geoid"<?php if (!isset($globalGeoid) || (isset($globalGeoid) && $globalGeoid)) { ?> checked="checked"<?php } ?> />
1025 <p class="help-block">Calculate the height of the geoid above WGS84 ellipsoid. Needed when source give altitute based on above mean sea level.</p>
1026 </p>
1028 <label for="geoid_source">Geoid Source</label>
1029 <select name="geoid_source" id="geoid_source">
1030 <option value="egm96-15"<?php if (isset($globalGeoidSource) && $globalGeoidSource == 'egm96-15') print ' selected="selected"'; ?>>EGM96 15' (2.1MB)</option>
1031 <option value="egm96-5"<?php if (isset($globalGeoidSource) && $globalGeoidSource == 'egm96-5') print ' selected="selected"'; ?>>EGM96 5' (19MB)</option>
1032 <option value="egm2008-5"<?php if (isset($globalGeoidSource) && $globalGeoidSource == 'egm2008-5') print ' selected="selected"'; ?>>EGM2008 5' (19MB)</option>
1033 <option value="egm2008-2_5"<?php if (isset($globalGeoidSource) && $globalGeoidSource == 'egm2008-2_5') print ' selected="selected"'; ?>>EGM2008 2.5' (75MB)</option>
1034 <option value="egm2008-1"<?php if (isset($globalGeoidSource) && $globalGeoidSource == 'egm2008-1') print ' selected="selected"'; ?>>EGM2008 1' (470MB)</option>
1035 </select>
1036 <p class="help-block">The geoid is approximated by an "earth gravity model" (EGM).</p>
1037 </p>
1038 <br />
1040 <label for="resetyearstats">Reset stats every years</label>
1041 <input type="checkbox" name="resetyearstats" id="resetyearsats" value="1"<?php if ((isset($globalDeleteLastYearStats) && $globalDeleteLastYearStats) || !isset($globalDeleteLastYearStats)) { ?> checked="checked"<?php } ?> />
1042 <p class="help-block">Reset count of aircraft types, airlines, registrations, callsigns, owners, pilots, departure and arrival airports</p>
1043 </p>
1044 <br />
1046 <label for="archive">Archive all flights data</label>
1047 <input type="checkbox" name="archive" id="archive" value="archive"<?php if ((isset($globalArchive) && $globalArchive) || !isset($globalArchive)) { ?> checked="checked"<?php } ?> />
1048 <p class="help-block">You will need to put <i>update_db.php</i> in cron. But all should be faster when archive is enabled.</p>
1049 </p>
1051 <label for="archiveresults">Use archive to display results</label>
1052 <input type="checkbox" name="archiveresults" id="archiveresults" value="archiveresults"<?php if ((isset($globalArchiveResults) && $globalArchiveResults) || !isset($globalArchiveResults)) { ?> checked="checked"<?php } ?> />
1053 </p>
1055 <label for="archivemonths">Generate statistics, delete or put in archive flights older than xx months</label>
1056 <input type="number" name="archivemonths" id="archivemonths" value="<?php if (isset($globalArchiveMonths)) print $globalArchiveMonths; else echo '1'; ?>" />
1057 <p class="help-block">0 to disable, delete old flight if <i>Archive all flights data</i> is disabled</p>
1058 </p>
1060 <label for="archiveyear">Generate statistics, delete or put in archive flights from previous year</label>
1061 <input type="checkbox" name="archiveyear" id="archiveyear" value="archiveyear"<?php if (isset($globalArchiveYear) && $globalArchiveYear) { ?> checked="checked"<?php } ?> />
1062 <p class="help-block">delete old flight if <i>Archive all flights data</i> is disabled</p>
1063 </p>
1065 <label for="archivekeepmonths">Keep flights data for xx months in archive</label>
1066 <input type="number" name="archivekeepmonths" id="archivekeepmonths" value="<?php if (isset($globalArchiveKeepMonths)) print $globalArchiveKeepMonths; else echo '1'; ?>" />
1067 <p class="help-block">0 to disable</p>
1068 </p>
1070 <label for="archivekeeptrackmonths">Keep flights track data for xx months in archive</label>
1071 <input type="number" name="archivekeeptrackmonths" id="archivekeeptrackmonths" value="<?php if (isset($globalArchiveKeepTrackMonths)) print $globalArchiveKeepTrackMonths; else echo '1'; ?>" />
1072 <p class="help-block">0 to disable, should be less or egal to <i>Keep flights data</i> value</p>
1073 </p>
1074 <br />
1076 <label for="daemon">Use daemon-spotter.php as daemon</label>
1077 <input type="checkbox" name="daemon" id="daemon" value="daemon"<?php if ((isset($globalDaemon) && $globalDaemon) || !isset($globalDaemon)) { ?> checked="checked"<?php } ?> onClick="daemon_js()" />
1078 <p class="help-block">Uncheck if the script is running as cron job. You should always run it as daemon when it's possible.</p>
1079 <div id="cronends">
1080 <label for="cronend">Run script for xx seconds</label>
1081 <input type="number" name="cronend" id="cronend" value="<?php if (isset($globalCronEnd)) print $globalCronEnd; else print '0'; ?>" />
1082 <p class="help-block">Set to 0 to disable. Should be disabled if source is URL.</p>
1083 </div>
1084 </p>
1085 <br />
1087 <label for="updatecheck">Disable update started check</label>
1088 <input type="checkbox" name="updatecheck" id="updatecheck" value="updatecheck"<?php if (isset($globalDisableUpdateCheck) && $globalDisableUpdateCheck) { ?> checked="checked"<?php } ?> />
1089 <p class="help-block">Disable check if <i>scripts/update_db.php</i> is already running</p>
1090 </p>
1091 <br />
1092 <!--
1094 <label for="fork">Allow processes fork</label>
1095 <input type="checkbox" name="fork" id="fork" value="fork"<?php if ((isset($globalFork) && $globalFork) || !isset($globalFork)) { ?> checked="checked"<?php } ?> />
1096 <p class="help-block">Used for schedule</p>
1097 </p>
1098 <br />
1101 <label for="colormap">Show altitudes on map with several colors</label>
1102 <input type="checkbox" name="colormap" id="colormap" value="colormap"<?php if ((isset($globalMapAltitudeColor) && $globalMapAltitudeColor) || !isset($globalMapAltitudeColor)) { ?> checked="checked"<?php } ?> />
1103 </p>
1104 <!--
1106 <label for="mappopup">Show flights info in popup</label>
1107 <input type="checkbox" name="mappopup" id="mappopup" value="mappopup"<?php if ((isset($globalMapPopup) && $globalMapPopup)) { ?> checked="checked"<?php } ?> />
1108 </p>
1110 <label for="airportpopup">Show airport info in popup</label>
1111 <input type="checkbox" name="airportpopup" id="airportpopup" value="airportpopup"<?php if ((isset($globalAirportPopup) && $globalAirportPopup)) { ?> checked="checked"<?php } ?> />
1112 </p>
1115 <label for="maptooltip">Always display callsign (only in 2D and can be slow)</label>
1116 <input type="checkbox" name="maptooltip" id="maptooltip" value="maptooltip"<?php if ((isset($globalMapPermanentTooltip) && $globalMapPermanentTooltip)) { ?> checked="checked"<?php } ?> />
1117 </p>
1118 <br />
1120 <label for="maphistory">Always show path of flights (else only when flight is selected)</label>
1121 <input type="checkbox" name="maphistory" id="maphistory" value="maphistory"<?php if ((isset($globalMapHistory) && $globalMapHistory) || !isset($globalMapHistory)) { ?> checked="checked"<?php } ?> />
1122 </p>
1123 <br />
1125 <label for="flightroute">Show route of flights when selected</label>
1126 <input type="checkbox" name="flightroute" id="flightroute" value="flightroute"<?php if (isset($globalMapRoute) && $globalMapRoute) { ?> checked="checked"<?php } ?> />
1127 </p>
1129 <label for="flightremainingroute">Show remaining route of flights when selected</label>
1130 <input type="checkbox" name="flightremainingroute" id="flightremainingroute" value="flightremainingroute"<?php if ((isset($globalMapRemainingRoute) && $globalMapRemainingRoute) || !isset($globalMapRemainingRoute)) { ?> checked="checked"<?php } ?> />
1131 </p>
1132 <br />
1134 <label for="allflights">Put all flights in DB even without coordinates</label>
1135 <input type="checkbox" name="allflights" id="allflights" value="allflights"<?php if ((isset($globalAllFlights) && $globalAllFlights) || !isset($globalAllFlights)) { ?> checked="checked"<?php } ?> />
1136 </p>
1137 <br />
1139 <label for="refresh">Show flights detected since xxx seconds</label>
1140 <input type="number" name="refresh" id="refresh" value="<?php if (isset($globalLiveInterval)) echo $globalLiveInterval; else echo '200'; ?>" />
1141 </p>
1143 <label for="maprefresh">Live map refresh (in seconds)</label>
1144 <input type="number" name="maprefresh" id="maprefresh" value="<?php if (isset($globalMapRefresh)) echo $globalMapRefresh; else echo '30'; ?>" />
1145 </p>
1147 <label for="mapidle">Map idle timeout (in minutes)</label>
1148 <input type="number" name="mapidle" id="mapidle" value="<?php if (isset($globalMapIdleTimeout)) echo $globalMapIdleTimeout; else echo '30'; ?>" />
1149 <p class="help-block">0 to disable</p>
1150 </p>
1152 <label for="minfetch">HTTP/file source fetch every xxx seconds</label>
1153 <input type="number" name="minfetch" id="minfetch" value="<?php if (isset($globalMinFetch)) echo $globalMinFetch; else echo '20'; ?>" />
1154 </p>
1156 <label for="bbox">Only display flights that we can see on screen (bounding box)</label>
1157 <input type="checkbox" name="bbox" id="bbox" value="bbox"<?php if (isset($globalMapUseBbox) && $globalMapUseBbox) { ?> checked="checked"<?php } ?> />
1158 </p>
1159 <br />
1161 <label for="singlemodel">By default, only display selected model on 3D mode</label>
1162 <input type="checkbox" name="singlemodel" id="singlemodel" value="singlemodel"<?php if (isset($globalMap3DSelected) && $globalMap3DSelected) { ?> checked="checked"<?php } ?> />
1163 </p>
1164 <br />
1166 <label for="groundaltitude">Display and calculate ground altitude (can take lot of disk space)</label>
1167 <input type="checkbox" name="groundaltitude" id="groundaltitude" value="groundaltitude"<?php if (isset($globalGroundAltitude) && $globalGroundAltitude) { ?> checked="checked"<?php } ?> />
1168 </p>
1169 <br />
1171 <label for="closestmindist">Distance to airport set as arrival (in km)</label>
1172 <input type="number" name="closestmindist" id="closestmindist" value="<?php if (isset($globalClosestMinDist)) echo $globalClosestMinDist; else echo '50'; ?>" />
1173 </p>
1174 <br />
1176 <label for="aircraftsize">Size of aircraft icon on map (default to 30px if zoom > 7 else 15px), empty to default</label>
1177 <input type="number" name="aircraftsize" id="aircraftsize" value="<?php if (isset($globalAircraftSize)) echo $globalAircraftSize;?>" />
1178 </p>
1179 <br />
1181 <label for="noairlines">No airlines check and display (can be used for OGN or Virtual Flights without airlines)</label>
1182 <input type="checkbox" name="noairlines" id="noairlines" value="noairlines"<?php if (isset($globalNoAirlines) && $globalNoAirlines) { ?> checked="checked"<?php } ?> />
1183 </p>
1184 <br />
1186 <label for="tsk">Enable support of XCSoar task (.tsk) files</label>
1187 <input type="checkbox" name="tsk" id="tsk" value="tsk"<?php if (isset($globalTSK) && $globalTSK) { ?> checked="checked"<?php } ?> />
1188 <p class="help-block">tsk file can be loaded using http://yourflightairmap/tsk=http://yourtskfile</p>
1189 </p>
1190 <?php
1191 if (extension_loaded('gd') && function_exists('gd_info')) {
1193 <br />
1195 <label for="aircrafticoncolor">Color of aircraft icon on map</label>
1196 <input type="color" name="aircrafticoncolor" id="aircrafticoncolor" value="#<?php if (isset($globalAircraftIconColor)) echo $globalAircraftIconColor; else echo '1a3151'; ?>" />
1197 </p>
1198 <br />
1200 <label for="marineiconcolor">Color of marine icon on map</label>
1201 <input type="color" name="marineiconcolor" id="marineiconcolor" value="#<?php if (isset($globalMarineIconColor)) echo $globalMarineIconColor; else echo '43d1d8'; ?>" />
1202 </p>
1203 <br />
1205 <label for="trackericoncolor">Color of tracker icon on map</label>
1206 <input type="color" name="trackericoncolor" id="trackericoncolor" value="#<?php if (isset($globalTrackerIconColor)) echo $globalTrackerIconColor; else echo '1a3151'; ?>" />
1207 </p>
1208 <br />
1210 <label for="satelliteiconcolor">Color of satellite icon on map</label>
1211 <input type="color" name="satelliteiconcolor" id="satelliteiconcolor" value="#<?php if (isset($globalSatelliteIconColor)) echo $globalSatelliteIconColor; else echo '1a3151'; ?>" />
1212 </p>
1213 <?php
1214 if (!is_writable('../cache')) {
1216 <br />
1218 <b>The directory cache is not writable, aircraft icon will not be cached</b>
1219 </p>
1220 <?php
1222 } else {
1224 <br />
1226 <b>PHP GD is not installed, you can't change color of aircraft icon on map</b>
1227 </p>
1228 <?php
1231 <br />
1233 <label for="airportzoom">Zoom level minimum to see airports icons</label>
1234 <div class="range">
1235 <input type="range" name="airportzoom" id="airportzoom" value="<?php if (isset($globalAirportZoom)) echo $globalAirportZoom; else echo '7'; ?>" />
1236 <output id="range"><?php if (isset($globalAirportZoom)) echo $globalAirportZoom; else echo '7'; ?></output>
1237 </div>
1238 </p>
1239 <br />
1241 <label for="customcss">Custom CSS web path</label>
1242 <input type="text" name="customcss" id="customcss" value="<?php if (isset($globalCustomCSS)) echo $globalCustomCSS; ?>" />
1243 </p>
1244 </fieldset>
1245 <input type="submit" name="submit" value="Create/Update database & write setup" />
1246 </form>
1248 If it fails to populate tables, you can run inside console <i>install/install_db.php</i> or <i>install/install_db.sh</i>.
1249 </p>
1250 <?php
1251 require('../footer.php');
1252 exit;
1254 // '
1255 $settings = array();
1256 $settings_comment = array();
1257 $error = '';
1259 if (isset($_POST['dbtype'])) {
1260 $installpass = filter_input(INPUT_POST,'installpass',FILTER_SANITIZE_STRING);
1261 $settings = array_merge($settings,array('globalInstallPassword' => $installpass));
1263 $dbtype = filter_input(INPUT_POST,'dbtype',FILTER_SANITIZE_STRING);
1264 $dbroot = filter_input(INPUT_POST,'dbroot',FILTER_SANITIZE_STRING);
1265 $dbrootpass = filter_input(INPUT_POST,'dbrootpass',FILTER_SANITIZE_STRING);
1266 $dbname = filter_input(INPUT_POST,'dbname',FILTER_SANITIZE_STRING);
1267 $dbuser = filter_input(INPUT_POST,'dbuser',FILTER_SANITIZE_STRING);
1268 $dbuserpass = filter_input(INPUT_POST,'dbuserpass',FILTER_SANITIZE_STRING);
1269 $dbhost = filter_input(INPUT_POST,'dbhost',FILTER_SANITIZE_STRING);
1270 $dbport = filter_input(INPUT_POST,'dbport',FILTER_SANITIZE_STRING);
1272 if ($dbtype == 'mysql' && !extension_loaded('pdo_mysql')) $error .= 'Mysql driver for PDO must be loaded';
1273 if ($dbtype == 'pgsql' && !extension_loaded('pdo_pgsql')) $error .= 'PosgreSQL driver for PDO must be loaded';
1275 $_SESSION['database_root'] = $dbroot;
1276 $_SESSION['database_rootpass'] = $dbrootpass;
1278 if ($error == '' && isset($_POST['createdb']) && $dbname != '' && $dbuser != '' && $dbuserpass != '') {
1279 if ($dbroot != '' && $dbrootpass != '') {
1280 $result = create_db::create_database($dbroot,$dbrootpass,$dbuser,$dbuserpass,$dbname,$dbtype,$dbhost);
1281 if ($result != '') $error .= $result;
1283 if ($error == '') {
1284 //$error .= create_db::import_all_db('../db/');
1285 $settings = array_merge($settings,array('globalDBdriver' => $dbtype,'globalDBhost' => $dbhost,'globalDBport' => $dbport,'globalDBuser' => $dbuser,'globalDBpass' => $dbuserpass,'globalDBname' => $dbname));
1287 } else $settings = array_merge($settings,array('globalDBdriver' => $dbtype,'globalDBhost' => $dbhost,'globalDBuser' => $dbuser,'globalDBport' => $dbport,'globalDBpass' => $dbuserpass,'globalDBname' => $dbname));
1290 $settings = array_merge($settings,array('globalDBdriver' => $dbtype,'globalDBhost' => $dbhost,'globalDBuser' => $dbuser,'globalDBport' => $dbport,'globalDBpass' => $dbuserpass,'globalDBname' => $dbname));
1292 $sitename = filter_input(INPUT_POST,'sitename',FILTER_SANITIZE_STRING);
1293 $siteurl = filter_input(INPUT_POST,'siteurl',FILTER_SANITIZE_STRING);
1294 $timezone = filter_input(INPUT_POST,'timezone',FILTER_SANITIZE_STRING);
1295 $language = filter_input(INPUT_POST,'language',FILTER_SANITIZE_STRING);
1296 $settings = array_merge($settings,array('globalName' => $sitename,'globalURL' => $siteurl, 'globalTimezone' => $timezone,'globalLanguage' => $language));
1298 $mapprovider = filter_input(INPUT_POST,'mapprovider',FILTER_SANITIZE_STRING);
1299 $mapboxid = filter_input(INPUT_POST,'mapboxid',FILTER_SANITIZE_STRING);
1300 $mapboxtoken = filter_input(INPUT_POST,'mapboxtoken',FILTER_SANITIZE_STRING);
1301 $googlekey = filter_input(INPUT_POST,'googlekey',FILTER_SANITIZE_STRING);
1302 $bingkey = filter_input(INPUT_POST,'bingkey',FILTER_SANITIZE_STRING);
1303 $openweathermapkey = filter_input(INPUT_POST,'openweathermapkey',FILTER_SANITIZE_STRING);
1304 $mapquestkey = filter_input(INPUT_POST,'mapquestkey',FILTER_SANITIZE_STRING);
1305 $hereappid = filter_input(INPUT_POST,'hereappid',FILTER_SANITIZE_STRING);
1306 $hereappcode = filter_input(INPUT_POST,'hereappcode',FILTER_SANITIZE_STRING);
1307 $settings = array_merge($settings,array('globalMapProvider' => $mapprovider,'globalMapboxId' => $mapboxid,'globalMapboxToken' => $mapboxtoken,'globalGoogleAPIKey' => $googlekey,'globalBingMapKey' => $bingkey,'globalHereappID' => $hereappid,'globalHereappCode' => $hereappcode,'globalMapQuestKey' => $mapquestkey,'globalOpenWeatherMapKey' => $openweathermapkey));
1309 $latitudemax = filter_input(INPUT_POST,'latitudemax',FILTER_SANITIZE_STRING);
1310 $latitudemin = filter_input(INPUT_POST,'latitudemin',FILTER_SANITIZE_STRING);
1311 $longitudemax = filter_input(INPUT_POST,'longitudemax',FILTER_SANITIZE_STRING);
1312 $longitudemin = filter_input(INPUT_POST,'longitudemin',FILTER_SANITIZE_STRING);
1313 $livezoom = filter_input(INPUT_POST,'livezoom',FILTER_SANITIZE_NUMBER_INT);
1314 $settings = array_merge($settings,array('globalLatitudeMax' => $latitudemax,'globalLatitudeMin' => $latitudemin,'globalLongitudeMax' => $longitudemax,'globalLongitudeMin' => $longitudemin,'globalLiveZoom' => $livezoom));
1316 $squawk_country = filter_input(INPUT_POST,'squawk_country',FILTER_SANITIZE_STRING);
1317 $settings = array_merge($settings,array('globalSquawkCountry' => $squawk_country));
1319 $latitudecenter = filter_input(INPUT_POST,'latitudecenter',FILTER_SANITIZE_STRING);
1320 $longitudecenter = filter_input(INPUT_POST,'longitudecenter',FILTER_SANITIZE_STRING);
1321 $settings = array_merge($settings,array('globalCenterLatitude' => $latitudecenter,'globalCenterLongitude' => $longitudecenter));
1323 $acars = filter_input(INPUT_POST,'acars',FILTER_SANITIZE_STRING);
1324 if ($acars == 'acars') {
1325 $settings = array_merge($settings,array('globalACARS' => 'TRUE'));
1326 } else {
1327 $settings = array_merge($settings,array('globalACARS' => 'FALSE'));
1329 $updatecheck = filter_input(INPUT_POST,'updatecheck',FILTER_SANITIZE_STRING);
1330 if ($updatecheck == 'updatecheck') {
1331 $settings = array_merge($settings,array('globalDisableUpdateCheck' => 'TRUE'));
1332 } else {
1333 $settings = array_merge($settings,array('globalDisableUpdateCheck' => 'FALSE'));
1336 $flightawareusername = filter_input(INPUT_POST,'flightawareusername',FILTER_SANITIZE_STRING);
1337 $flightawarepassword = filter_input(INPUT_POST,'flightawarepassword',FILTER_SANITIZE_STRING);
1338 $settings = array_merge($settings,array('globalFlightAwareUsername' => $flightawareusername,'globalFlightAwarePassword' => $flightawarepassword));
1340 $sailawayemail = filter_input(INPUT_POST,'sailawayemail',FILTER_SANITIZE_STRING);
1341 $sailawaypass = filter_input(INPUT_POST,'sailawaypassword',FILTER_SANITIZE_STRING);
1342 $settings = array_merge($settings,array('globalSailaway' => array('email' => $sailawayemail,'password' => $sailawaypass)));
1344 $source_name = $_POST['source_name'];
1345 $source_latitude = $_POST['source_latitude'];
1346 $source_longitude = $_POST['source_longitude'];
1347 $source_altitude = $_POST['source_altitude'];
1348 $source_city = $_POST['source_city'];
1349 $source_country = $_POST['source_country'];
1350 $source_ref = $_POST['source_ref'];
1351 if (isset($source_id)) $source_id = $_POST['source_id'];
1352 else $source_id = array();
1354 $sources = array();
1355 foreach ($source_name as $keys => $name) {
1356 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]);
1357 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]);
1359 if (count($sources) > 0) $_SESSION['sources'] = $sources;
1361 $newsurl = $_POST['newsurl'];
1362 $newslng = $_POST['newslang'];
1363 $newstype = $_POST['newstype'];
1365 $newsfeeds = array();
1366 foreach($newsurl as $newskey => $url) {
1367 if ($url != '') {
1368 $type = $newstype[$newskey];
1369 $lng = $newslng[$newskey];
1370 if (isset($newsfeeds[$type][$lng])) {
1371 $newsfeeds[$type][$lng] = array_merge($newsfeeds[$type][$lng],array($url));
1372 } else $newsfeeds[$type][$lng] = array($url);
1375 $settings = array_merge($settings,array('globalNewsFeeds' => $newsfeeds));
1377 //$sbshost = filter_input(INPUT_POST,'sbshost',FILTER_SANITIZE_STRING);
1378 //$sbsport = filter_input(INPUT_POST,'sbsport',FILTER_SANITIZE_NUMBER_INT);
1379 //$sbsurl = filter_input(INPUT_POST,'sbsurl',FILTER_SANITIZE_URL);
1381 $sbshost = $_POST['sbshost'];
1382 $sbsport = $_POST['sbsport'];
1383 $sbsurl = $_POST['sbsurl'];
1386 $globalvatsim = filter_input(INPUT_POST,'globalvatsim',FILTER_SANITIZE_STRING);
1387 $globalva = filter_input(INPUT_POST,'globalva',FILTER_SANITIZE_STRING);
1388 $globalvm = filter_input(INPUT_POST,'globalvm',FILTER_SANITIZE_STRING);
1389 $globalivao = filter_input(INPUT_POST,'globalivao',FILTER_SANITIZE_STRING);
1390 $globalphpvms = filter_input(INPUT_POST,'globalphpvms',FILTER_SANITIZE_STRING);
1391 $globalvam = filter_input(INPUT_POST,'globalvam',FILTER_SANITIZE_STRING);
1392 $globalsbs = filter_input(INPUT_POST,'globalsbs',FILTER_SANITIZE_STRING);
1393 $globalaprs = filter_input(INPUT_POST,'globalaprs',FILTER_SANITIZE_STRING);
1394 $datasource = filter_input(INPUT_POST,'datasource',FILTER_SANITIZE_STRING);
1396 $globalaircraft = filter_input(INPUT_POST,'globalaircraft',FILTER_SANITIZE_STRING);
1397 if ($globalaircraft == 'aircraft') $settings = array_merge($settings,array('globalAircraft' => 'TRUE'));
1398 else $settings = array_merge($settings,array('globalAircraft' => 'FALSE'));
1399 $globaltracker = filter_input(INPUT_POST,'globaltracker',FILTER_SANITIZE_STRING);
1400 if ($globaltracker == 'tracker') $settings = array_merge($settings,array('globalTracker' => 'TRUE'));
1401 else $settings = array_merge($settings,array('globalTracker' => 'FALSE'));
1402 $globalmarine = filter_input(INPUT_POST,'globalmarine',FILTER_SANITIZE_STRING);
1403 if ($globalmarine == 'marine') $settings = array_merge($settings,array('globalMarine' => 'TRUE'));
1404 else $settings = array_merge($settings,array('globalMarine' => 'FALSE'));
1405 $globalsatellite = filter_input(INPUT_POST,'globalsatellite',FILTER_SANITIZE_STRING);
1406 if ($globalsatellite == 'satellite') $settings = array_merge($settings,array('globalSatellite' => 'TRUE'));
1407 else $settings = array_merge($settings,array('globalSatellite' => 'FALSE'));
1410 $globalSBS1Hosts = array();
1411 // if ($datasource != 'ivao' && $datasource != 'vatsim') {
1412 if ($globalsbs == 'sbs') {
1413 foreach ($sbshost as $key => $host) {
1414 if ($host != '') $globalSBS1Hosts[] = $host.':'.$sbsport[$key];
1417 if (count($sbsurl) > 0 && $sbsurl[0] != '') {
1418 $sbsurl = array_filter($sbsurl);
1419 $globalSBS1Hosts = array_merge($globalSBS1Hosts,$sbsurl);
1421 $settings = array_merge($settings,array('globalSBS1Hosts' => $globalSBS1Hosts));
1423 $settings_comment = array_merge($settings_comment,array('globalSBS1Hosts'));
1424 $host = $_POST['host'];
1425 $port = $_POST['port'];
1426 $name = $_POST['name'];
1427 $format = $_POST['format'];
1428 $timezones = $_POST['timezones'];
1429 if (isset($_POST['sourcestats'])) $sourcestats = $_POST['sourcestats'];
1430 else $sourcestats = array();
1431 if (isset($_POST['noarchive'])) $noarchive = $_POST['noarchive'];
1432 else $noarchive = array();
1433 $gSources = array();
1434 $forcepilots = false;
1435 foreach ($host as $key => $h) {
1436 if (isset($sourcestats[$key]) && $sourcestats[$key] == 1) $cov = 'TRUE';
1437 else $cov = 'FALSE';
1438 if (isset($noarchive[$key]) && $noarchive[$key] == 1) $arch = 'TRUE';
1439 else $arch = 'FALSE';
1440 if (strpos($format[$key],'_callback')) {
1441 $gSources[] = array('host' => $h, 'pass' => $port[$key],'name' => $name[$key],'format' => $format[$key],'sourcestats' => $cov,'noarchive' => $arch,'timezone' => $timezones[$key],'callback' => 'TRUE');
1442 } elseif ($format[$key] != 'auto' || ($h != '' || $name[$key] != '')) {
1443 $gSources[] = array('host' => $h, 'port' => $port[$key],'name' => $name[$key],'format' => $format[$key],'sourcestats' => $cov,'noarchive' => $arch,'timezone' => $timezones[$key],'callback' => 'FALSE');
1445 if ($format[$key] == 'airwhere') $forcepilots = true;
1447 $settings = array_merge($settings,array('globalSources' => $gSources));
1450 $sbstimeout = filter_input(INPUT_POST,'sbstimeout',FILTER_SANITIZE_NUMBER_INT);
1451 $settings = array_merge($settings,array('globalSourcesTimeOut' => $sbstimeout));
1453 $acarshost = filter_input(INPUT_POST,'acarshost',FILTER_SANITIZE_STRING);
1454 $acarsport = filter_input(INPUT_POST,'acarsport',FILTER_SANITIZE_NUMBER_INT);
1455 $settings = array_merge($settings,array('globalACARSHost' => $acarshost,'globalACARSPort' => $acarsport));
1457 $bitly = filter_input(INPUT_POST,'bitly',FILTER_SANITIZE_STRING);
1458 $settings = array_merge($settings,array('globalBitlyAccessToken' => $bitly));
1460 $customcss = filter_input(INPUT_POST,'customcss',FILTER_SANITIZE_STRING);
1461 $settings = array_merge($settings,array('globalCustomCSS' => $customcss));
1463 $map3dtile = filter_input(INPUT_POST,'map3dtileset',FILTER_SANITIZE_STRING);
1464 $settings = array_merge($settings,array('globalMap3DTiles' => $map3dtile));
1466 $notamsource = filter_input(INPUT_POST,'notamsource',FILTER_SANITIZE_STRING);
1467 $settings = array_merge($settings,array('globalNOTAMSource' => $notamsource));
1468 $metarsource = filter_input(INPUT_POST,'metarsource',FILTER_SANITIZE_STRING);
1469 $settings = array_merge($settings,array('globalMETARurl' => $metarsource));
1471 $zoilatitude = filter_input(INPUT_POST,'zoilatitude',FILTER_SANITIZE_STRING);
1472 $zoilongitude = filter_input(INPUT_POST,'zoilongitude',FILTER_SANITIZE_STRING);
1473 $zoidistance = filter_input(INPUT_POST,'zoidistance',FILTER_SANITIZE_NUMBER_INT);
1474 if ($zoilatitude != '' && $zoilongitude != '' && $zoidistance != '') {
1475 $settings = array_merge($settings,array('globalDistanceIgnore' => array('latitude' => $zoilatitude,'longitude' => $zoilongitude,'distance' => $zoidistance)));
1476 } else $settings = array_merge($settings,array('globalDistanceIgnore' => array()));
1478 $refresh = filter_input(INPUT_POST,'refresh',FILTER_SANITIZE_NUMBER_INT);
1479 $settings = array_merge($settings,array('globalLiveInterval' => $refresh));
1480 $maprefresh = filter_input(INPUT_POST,'maprefresh',FILTER_SANITIZE_NUMBER_INT);
1481 $settings = array_merge($settings,array('globalMapRefresh' => $maprefresh));
1482 $mapidle = filter_input(INPUT_POST,'mapidle',FILTER_SANITIZE_NUMBER_INT);
1483 $settings = array_merge($settings,array('globalMapIdleTimeout' => $mapidle));
1484 $minfetch = filter_input(INPUT_POST,'minfetch',FILTER_SANITIZE_NUMBER_INT);
1485 $settings = array_merge($settings,array('globalMinFetch' => $minfetch));
1486 $closestmindist = filter_input(INPUT_POST,'closestmindist',FILTER_SANITIZE_NUMBER_INT);
1487 $settings = array_merge($settings,array('globalClosestMinDist' => $closestmindist));
1489 $aircraftsize = filter_input(INPUT_POST,'aircraftsize',FILTER_SANITIZE_NUMBER_INT);
1490 $settings = array_merge($settings,array('globalAircraftSize' => $aircraftsize));
1492 $archivemonths = filter_input(INPUT_POST,'archivemonths',FILTER_SANITIZE_NUMBER_INT);
1493 $settings = array_merge($settings,array('globalArchiveMonths' => $archivemonths));
1495 $archiveyear = filter_input(INPUT_POST,'archiveyear',FILTER_SANITIZE_STRING);
1496 if ($archiveyear == "archiveyear") {
1497 $settings = array_merge($settings,array('globalArchiveYear' => 'TRUE'));
1498 } else {
1499 $settings = array_merge($settings,array('globalArchiveYear' => 'FALSE'));
1501 $archivekeepmonths = filter_input(INPUT_POST,'archivekeepmonths',FILTER_SANITIZE_NUMBER_INT);
1502 $settings = array_merge($settings,array('globalArchiveKeepMonths' => $archivekeepmonths));
1503 $archivekeeptrackmonths = filter_input(INPUT_POST,'archivekeeptrackmonths',FILTER_SANITIZE_NUMBER_INT);
1504 $settings = array_merge($settings,array('globalArchiveKeepTrackMonths' => $archivekeeptrackmonths));
1506 $britishairways = filter_input(INPUT_POST,'britishairways',FILTER_SANITIZE_STRING);
1507 $settings = array_merge($settings,array('globalBritishAirwaysKey' => $britishairways));
1508 $transavia = filter_input(INPUT_POST,'transavia',FILTER_SANITIZE_STRING);
1509 $settings = array_merge($settings,array('globalTransaviaKey' => $transavia));
1511 $lufthansakey = filter_input(INPUT_POST,'lufthansakey',FILTER_SANITIZE_STRING);
1512 $lufthansasecret = filter_input(INPUT_POST,'lufthansasecret',FILTER_SANITIZE_STRING);
1513 $settings = array_merge($settings,array('globalLufthansaKey' => array('key' => $lufthansakey,'secret' => $lufthansasecret)));
1515 // Create in settings.php keys not yet configurable if not already here
1516 //if (!isset($globalImageBingKey)) $settings = array_merge($settings,array('globalImageBingKey' => ''));
1517 if (!isset($globalDebug)) $settings = array_merge($settings,array('globalDebug' => 'TRUE'));
1519 $resetyearstats = filter_input(INPUT_POST,'resetyearstats',FILTER_SANITIZE_STRING);
1520 if ($resetyearstats == 'resetyearstats') {
1521 $settings = array_merge($settings,array('globalDeleteLastYearStats' => 'TRUE'));
1522 } else {
1523 $settings = array_merge($settings,array('globalDeleteLastYearStats' => 'FALSE'));
1526 $archive = filter_input(INPUT_POST,'archive',FILTER_SANITIZE_STRING);
1527 if ($archive == 'archive') {
1528 $settings = array_merge($settings,array('globalArchive' => 'TRUE'));
1529 } else {
1530 $settings = array_merge($settings,array('globalArchive' => 'FALSE'));
1532 $archiveresults = filter_input(INPUT_POST,'archiveresults',FILTER_SANITIZE_STRING);
1533 if ($archiveresults == 'archiveresults') {
1534 $settings = array_merge($settings,array('globalArchiveResults' => 'TRUE'));
1535 } else {
1536 $settings = array_merge($settings,array('globalArchiveResults' => 'FALSE'));
1538 $daemon = filter_input(INPUT_POST,'daemon',FILTER_SANITIZE_STRING);
1539 if ($daemon == 'daemon') {
1540 $settings = array_merge($settings,array('globalDaemon' => 'TRUE'));
1541 } else {
1542 $settings = array_merge($settings,array('globalDaemon' => 'FALSE'));
1544 $schedules = filter_input(INPUT_POST,'schedules',FILTER_SANITIZE_STRING);
1545 if ($schedules == 'schedules') {
1546 $settings = array_merge($settings,array('globalSchedulesFetch' => 'TRUE'));
1547 } else {
1548 $settings = array_merge($settings,array('globalSchedulesFetch' => 'FALSE'));
1552 $datasource = filter_input(INPUT_POST,'datasource',FILTER_SANITIZE_STRING);
1553 if ($datasource == 'flightaware') {
1554 $settings = array_merge($settings,array('globalFlightAware' => 'TRUE','globalSBS1' => 'FALSE'));
1555 } else {
1556 $settings = array_merge($settings,array('globalFlightAware' => 'FALSE','globalSBS1' => 'TRUE'));
1559 $settings = array_merge($settings,array('globalFlightAware' => 'FALSE'));
1560 if ($globalsbs == 'sbs') $settings = array_merge($settings,array('globalSBS1' => 'TRUE'));
1561 else $settings = array_merge($settings,array('globalSBS1' => 'FALSE'));
1562 if ($globalaprs == 'aprs') $settings = array_merge($settings,array('globalAPRS' => 'TRUE'));
1563 else $settings = array_merge($settings,array('globalAPRS' => 'FALSE'));
1564 $va = false;
1565 if ($globalivao == 'ivao') {
1566 $settings = array_merge($settings,array('globalIVAO' => 'TRUE'));
1567 $va = true;
1568 } else $settings = array_merge($settings,array('globalIVAO' => 'FALSE'));
1569 if ($globalvatsim == 'vatsim') {
1570 $settings = array_merge($settings,array('globalVATSIM' => 'TRUE'));
1571 $va = true;
1572 } else $settings = array_merge($settings,array('globalVATSIM' => 'FALSE'));
1573 if ($globalphpvms == 'phpvms') {
1574 $settings = array_merge($settings,array('globalphpVMS' => 'TRUE'));
1575 $va = true;
1576 } else $settings = array_merge($settings,array('globalphpVMS' => 'FALSE'));
1577 if ($globalvam == 'vam') {
1578 $settings = array_merge($settings,array('globalVAM' => 'TRUE'));
1579 $va = true;
1580 } else $settings = array_merge($settings,array('globalVAM' => 'FALSE'));
1581 if ($va) {
1582 $settings = array_merge($settings,array('globalSchedulesFetch' => 'FALSE','globalTranslationFetch' => 'FALSE'));
1583 } else $settings = array_merge($settings,array('globalSchedulesFetch' => 'TRUE','globalTranslationFetch' => 'TRUE'));
1584 if ($globalva == 'va' || $va) {
1585 $settings = array_merge($settings,array('globalVA' => 'TRUE'));
1586 $settings = array_merge($settings,array('globalUsePilot' => 'TRUE','globalUseOwner' => 'FALSE'));
1587 } else {
1588 $settings = array_merge($settings,array('globalVA' => 'FALSE'));
1589 if ($forcepilots) $settings = array_merge($settings,array('globalUsePilot' => 'TRUE','globalUseOwner' => 'FALSE'));
1590 else $settings = array_merge($settings,array('globalUsePilot' => 'FALSE','globalUseOwner' => 'TRUE'));
1592 if ($globalvm == 'vm') {
1593 $settings = array_merge($settings,array('globalVM' => 'TRUE'));
1594 } else {
1595 $settings = array_merge($settings,array('globalVM' => 'FALSE'));
1598 $mapoffline = filter_input(INPUT_POST,'mapoffline',FILTER_SANITIZE_STRING);
1599 if ($mapoffline == 'mapoffline') {
1600 $settings = array_merge($settings,array('globalMapOffline' => 'TRUE'));
1601 } else {
1602 $settings = array_merge($settings,array('globalMapOffline' => 'FALSE'));
1604 $globaloffline = filter_input(INPUT_POST,'globaloffline',FILTER_SANITIZE_STRING);
1605 if ($globaloffline == 'globaloffline') {
1606 $settings = array_merge($settings,array('globalOffline' => 'TRUE'));
1607 } else {
1608 $settings = array_merge($settings,array('globalOffline' => 'FALSE'));
1611 $notam = filter_input(INPUT_POST,'notam',FILTER_SANITIZE_STRING);
1612 if ($notam == 'notam') {
1613 $settings = array_merge($settings,array('globalNOTAM' => 'TRUE'));
1614 } else {
1615 $settings = array_merge($settings,array('globalNOTAM' => 'FALSE'));
1617 $owner = filter_input(INPUT_POST,'owner',FILTER_SANITIZE_STRING);
1618 if ($owner == 'owner') {
1619 $settings = array_merge($settings,array('globalOwner' => 'TRUE'));
1620 } else {
1621 $settings = array_merge($settings,array('globalOwner' => 'FALSE'));
1623 $map3d = filter_input(INPUT_POST,'map3d',FILTER_SANITIZE_STRING);
1624 if ($map3d == 'map3d') {
1625 $settings = array_merge($settings,array('globalMap3D' => 'TRUE'));
1626 } else {
1627 $settings = array_merge($settings,array('globalMap3D' => 'FALSE'));
1629 $crash = filter_input(INPUT_POST,'crash',FILTER_SANITIZE_STRING);
1630 if ($crash == 'crash') {
1631 $settings = array_merge($settings,array('globalAccidents' => 'TRUE'));
1632 } else {
1633 $settings = array_merge($settings,array('globalAccidents' => 'FALSE'));
1635 $fires = filter_input(INPUT_POST,'fires',FILTER_SANITIZE_STRING);
1636 if ($fires == 'fires') {
1637 $settings = array_merge($settings,array('globalMapFires' => 'TRUE'));
1638 } else {
1639 $settings = array_merge($settings,array('globalMapFires' => 'FALSE'));
1641 $firessupport = filter_input(INPUT_POST,'firessupport',FILTER_SANITIZE_STRING);
1642 if ($firessupport == 'firessupport') {
1643 $settings = array_merge($settings,array('globalFires' => 'TRUE'));
1644 } else {
1645 $settings = array_merge($settings,array('globalFires' => 'FALSE'));
1647 $mapsatellites = filter_input(INPUT_POST,'mapsatellites',FILTER_SANITIZE_STRING);
1648 if ($mapsatellites == 'mapsatellites') {
1649 $settings = array_merge($settings,array('globalMapSatellites' => 'TRUE'));
1650 } else {
1651 $settings = array_merge($settings,array('globalMapSatellites' => 'FALSE'));
1653 $map3ddefault = filter_input(INPUT_POST,'map3ddefault',FILTER_SANITIZE_STRING);
1654 if ($map3ddefault == 'map3ddefault') {
1655 $settings = array_merge($settings,array('globalMap3Ddefault' => 'TRUE'));
1656 } else {
1657 $settings = array_merge($settings,array('globalMap3Ddefault' => 'FALSE'));
1659 $one3dmodel = filter_input(INPUT_POST,'one3dmodel',FILTER_SANITIZE_STRING);
1660 if ($one3dmodel == 'one3dmodel') {
1661 $settings = array_merge($settings,array('globalMap3DOneModel' => 'TRUE'));
1662 } else {
1663 $settings = array_merge($settings,array('globalMap3DOneModel' => 'FALSE'));
1665 $map3dliveries = filter_input(INPUT_POST,'map3dliveries',FILTER_SANITIZE_STRING);
1666 if ($map3dliveries == 'map3dliveries') {
1667 $settings = array_merge($settings,array('globalMap3DLiveries' => 'TRUE'));
1668 } else {
1669 $settings = array_merge($settings,array('globalMap3DLiveries' => 'FALSE'));
1671 $map3dshadows = filter_input(INPUT_POST,'map3dshadows',FILTER_SANITIZE_STRING);
1672 if ($map3dshadows == 'map3dshadows') {
1673 $settings = array_merge($settings,array('globalMap3DShadows' => 'TRUE'));
1674 } else {
1675 $settings = array_merge($settings,array('globalMap3DShadows' => 'FALSE'));
1677 $translate = filter_input(INPUT_POST,'translate',FILTER_SANITIZE_STRING);
1678 if ($translate == 'translate') {
1679 $settings = array_merge($settings,array('globalTranslate' => 'TRUE'));
1680 } else {
1681 $settings = array_merge($settings,array('globalTranslate' => 'FALSE'));
1683 $realairlines = filter_input(INPUT_POST,'realairlines',FILTER_SANITIZE_STRING);
1684 if ($realairlines == 'realairlines') {
1685 $settings = array_merge($settings,array('globalUseRealAirlines' => 'TRUE'));
1686 } else {
1687 $settings = array_merge($settings,array('globalUseRealAirlines' => 'FALSE'));
1689 $estimation = filter_input(INPUT_POST,'estimation',FILTER_SANITIZE_STRING);
1690 if ($estimation == 'estimation') {
1691 $settings = array_merge($settings,array('globalMapEstimation' => 'TRUE'));
1692 } else {
1693 $settings = array_merge($settings,array('globalMapEstimation' => 'FALSE'));
1695 $metar = filter_input(INPUT_POST,'metar',FILTER_SANITIZE_STRING);
1696 if ($metar == 'metar') {
1697 $settings = array_merge($settings,array('globalMETAR' => 'TRUE'));
1698 } else {
1699 $settings = array_merge($settings,array('globalMETAR' => 'FALSE'));
1701 $metarcycle = filter_input(INPUT_POST,'metarcycle',FILTER_SANITIZE_STRING);
1702 if ($metarcycle == 'metarcycle') {
1703 $settings = array_merge($settings,array('globalMETARcycle' => 'TRUE'));
1704 } else {
1705 $settings = array_merge($settings,array('globalMETARcycle' => 'FALSE'));
1707 $fork = filter_input(INPUT_POST,'fork',FILTER_SANITIZE_STRING);
1708 if ($fork == 'fork') {
1709 $settings = array_merge($settings,array('globalFork' => 'TRUE'));
1710 } else {
1711 $settings = array_merge($settings,array('globalFork' => 'FALSE'));
1714 $colormap = filter_input(INPUT_POST,'colormap',FILTER_SANITIZE_STRING);
1715 if ($colormap == 'colormap') {
1716 $settings = array_merge($settings,array('globalMapAltitudeColor' => 'TRUE'));
1717 } else {
1718 $settings = array_merge($settings,array('globalMapAltitudeColor' => 'FALSE'));
1721 if (isset($_POST['aircrafticoncolor'])) {
1722 $aircrafticoncolor = filter_input(INPUT_POST,'aircrafticoncolor',FILTER_SANITIZE_STRING);
1723 $settings = array_merge($settings,array('globalAircraftIconColor' => substr($aircrafticoncolor,1)));
1725 if (isset($_POST['marineiconcolor'])) {
1726 $marineiconcolor = filter_input(INPUT_POST,'marineiconcolor',FILTER_SANITIZE_STRING);
1727 $settings = array_merge($settings,array('globalMarineIconColor' => substr($marineiconcolor,1)));
1729 if (isset($_POST['trackericoncolor'])) {
1730 $trackericoncolor = filter_input(INPUT_POST,'trackericoncolor',FILTER_SANITIZE_STRING);
1731 $settings = array_merge($settings,array('globalTrackerIconColor' => substr($trackericoncolor,1)));
1733 if (isset($_POST['satelliteiconcolor'])) {
1734 $satelliteiconcolor = filter_input(INPUT_POST,'satelliteiconcolor',FILTER_SANITIZE_STRING);
1735 $settings = array_merge($settings,array('globalSatelliteIconColor' => substr($satelliteiconcolor,1)));
1738 $corsproxy = filter_input(INPUT_POST,'corsproxy',FILTER_SANITIZE_STRING);
1739 $settings = array_merge($settings,array('globalCORSproxy' => $corsproxy));
1741 $airportzoom = filter_input(INPUT_POST,'airportzoom',FILTER_SANITIZE_NUMBER_INT);
1742 $settings = array_merge($settings,array('globalAirportZoom' => $airportzoom));
1744 $unitdistance = filter_input(INPUT_POST,'unitdistance',FILTER_SANITIZE_STRING);
1745 $settings = array_merge($settings,array('globalUnitDistance' => $unitdistance));
1746 $unitaltitude = filter_input(INPUT_POST,'unitaltitude',FILTER_SANITIZE_STRING);
1747 $settings = array_merge($settings,array('globalUnitAltitude' => $unitaltitude));
1748 $unitspeed = filter_input(INPUT_POST,'unitspeed',FILTER_SANITIZE_STRING);
1749 $settings = array_merge($settings,array('globalUnitSpeed' => $unitspeed));
1751 $mappopup = filter_input(INPUT_POST,'mappopup',FILTER_SANITIZE_STRING);
1752 if ($mappopup == 'mappopup') {
1753 $settings = array_merge($settings,array('globalMapPopup' => 'TRUE'));
1754 } else {
1755 $settings = array_merge($settings,array('globalMapPopup' => 'FALSE'));
1757 $airportpopup = filter_input(INPUT_POST,'airportpopup',FILTER_SANITIZE_STRING);
1758 if ($airportpopup == 'airportpopup') {
1759 $settings = array_merge($settings,array('globalAirportPopup' => 'TRUE'));
1760 } else {
1761 $settings = array_merge($settings,array('globalAirportPopup' => 'FALSE'));
1763 $maphistory = filter_input(INPUT_POST,'maphistory',FILTER_SANITIZE_STRING);
1764 if ($maphistory == 'maphistory') {
1765 $settings = array_merge($settings,array('globalMapHistory' => 'TRUE'));
1766 } else {
1767 $settings = array_merge($settings,array('globalMapHistory' => 'FALSE'));
1769 $maptooltip = filter_input(INPUT_POST,'maptooltip',FILTER_SANITIZE_STRING);
1770 if ($maptooltip == 'maptooltip') {
1771 $settings = array_merge($settings,array('globalMapTooltip' => 'TRUE'));
1772 } else {
1773 $settings = array_merge($settings,array('globalMapTooltip' => 'FALSE'));
1775 $flightroute = filter_input(INPUT_POST,'flightroute',FILTER_SANITIZE_STRING);
1776 if ($flightroute == 'flightroute') {
1777 $settings = array_merge($settings,array('globalMapRoute' => 'TRUE'));
1778 } else {
1779 $settings = array_merge($settings,array('globalMapRoute' => 'FALSE'));
1781 $flightremainingroute = filter_input(INPUT_POST,'flightremainingroute',FILTER_SANITIZE_STRING);
1782 if ($flightremainingroute == 'flightremainingroute') {
1783 $settings = array_merge($settings,array('globalMapRemainingRoute' => 'TRUE'));
1784 } else {
1785 $settings = array_merge($settings,array('globalMapRemainingRoute' => 'FALSE'));
1787 $allflights = filter_input(INPUT_POST,'allflights',FILTER_SANITIZE_STRING);
1788 if ($allflights == 'allflights') {
1789 $settings = array_merge($settings,array('globalAllFlights' => 'TRUE'));
1790 } else {
1791 $settings = array_merge($settings,array('globalAllFlights' => 'FALSE'));
1793 $bbox = filter_input(INPUT_POST,'bbox',FILTER_SANITIZE_STRING);
1794 if ($bbox == 'bbox') {
1795 $settings = array_merge($settings,array('globalMapUseBbox' => 'TRUE'));
1796 } else {
1797 $settings = array_merge($settings,array('globalMapUseBbox' => 'FALSE'));
1799 $singlemodel = filter_input(INPUT_POST,'singlemodel',FILTER_SANITIZE_STRING);
1800 if ($singlemodel == 'singlemodel') {
1801 $settings = array_merge($settings,array('globalMap3DSelected' => 'TRUE'));
1802 } else {
1803 $settings = array_merge($settings,array('globalMap3DSelected' => 'FALSE'));
1805 $groundaltitude = filter_input(INPUT_POST,'groundaltitude',FILTER_SANITIZE_STRING);
1806 if ($groundaltitude == 'groundaltitude') {
1807 $settings = array_merge($settings,array('globalGroundAltitude' => 'TRUE'));
1808 } else {
1809 $settings = array_merge($settings,array('globalGroundAltitude' => 'FALSE'));
1811 $waypoints = filter_input(INPUT_POST,'waypoints',FILTER_SANITIZE_STRING);
1812 if ($waypoints == 'waypoints') {
1813 $settings = array_merge($settings,array('globalWaypoints' => 'TRUE'));
1814 } else {
1815 $settings = array_merge($settings,array('globalWaypoints' => 'FALSE'));
1817 $geoid = filter_input(INPUT_POST,'geoid',FILTER_SANITIZE_STRING);
1818 if ($geoid == 'geoid') {
1819 $settings = array_merge($settings,array('globalGeoid' => 'TRUE'));
1820 } else {
1821 $settings = array_merge($settings,array('globalGeoid' => 'FALSE'));
1823 $geoid_source = filter_input(INPUT_POST,'geoid_source',FILTER_SANITIZE_STRING);
1824 $settings = array_merge($settings,array('globalGeoidSource' => $geoid_source));
1826 $noairlines = filter_input(INPUT_POST,'noairlines',FILTER_SANITIZE_STRING);
1827 if ($noairlines == 'noairlines') {
1828 $settings = array_merge($settings,array('globalNoAirlines' => 'TRUE'));
1829 } else {
1830 $settings = array_merge($settings,array('globalNoAirlines' => 'FALSE'));
1833 $tsk = filter_input(INPUT_POST,'tsk',FILTER_SANITIZE_STRING);
1834 if ($tsk == 'tsk') {
1835 $settings = array_merge($settings,array('globalTSK' => 'TRUE'));
1836 } else {
1837 $settings = array_merge($settings,array('globalTSK' => 'FALSE'));
1839 $mapmatching = filter_input(INPUT_POST,'mapmatching',FILTER_SANITIZE_STRING);
1840 if ($mapmatching == 'mapmatching') {
1841 $settings = array_merge($settings,array('globalMapMatching' => 'TRUE'));
1842 } else {
1843 $settings = array_merge($settings,array('globalMapMatching' => 'FALSE'));
1845 $mapmatchingsource = filter_input(INPUT_POST,'mapmatchingsource',FILTER_SANITIZE_STRING);
1846 $settings = array_merge($settings,array('globalMapMatchingSource' => $mapmatchingsource));
1847 $graphhopper = filter_input(INPUT_POST,'graphhopper',FILTER_SANITIZE_STRING);
1848 $settings = array_merge($settings,array('globalGraphHopperKey' => $graphhopper));
1850 if (!isset($globalTransaction)) $settings = array_merge($settings,array('globalTransaction' => 'TRUE'));
1852 // Set some defaults values...
1853 if (!isset($globalAircraftImageSources)) {
1854 $globalAircraftImageSources = array('ivaomtl','wikimedia','airportdata','deviantart','flickr','bing','jetphotos','planepictures','planespotters');
1855 $settings = array_merge($settings,array('globalAircraftImageSources' => $globalAircraftImageSources));
1858 if (!isset($globalSchedulesSources)) {
1859 $globalSchedulesSources = array('flightmapper','costtotravel','flightradar24','flightaware');
1860 $settings = array_merge($settings,array('globalSchedulesSources' => $globalSchedulesSources));
1863 $settings = array_merge($settings,array('globalInstalled' => 'TRUE'));
1865 if ($error == '') settings::modify_settings($settings);
1866 if ($error == '') settings::comment_settings($settings_comment);
1867 if ($error != '') {
1868 print '<div class="info column">'.$error.'</div>';
1869 require('../footer.php');
1870 exit;
1871 } else {
1872 if (isset($_POST['waypoints']) && $_POST['waypoints'] == 'waypoints') $_SESSION['waypoints'] = 1;
1873 if (isset($_POST['owner']) && $_POST['owner'] == 'owner') $_SESSION['owner'] = 1;
1874 if (isset($_POST['createdb'])) {
1875 $_SESSION['install'] = 'database_create';
1876 } else {
1877 require_once(dirname(__FILE__).'/../require/class.Connection.php');
1878 $Connection = new Connection();
1879 if ($Connection->latest() && isset($_POST['waypoints']) && $_POST['waypoints'] == 'waypoints') {
1880 if ($Connection->tableExists('airspace') === false) {
1881 $_SESSION['install'] = 'waypoints';
1882 } else {
1883 $_SESSION['install'] = 'database_import';
1885 } else {
1886 $_SESSION['install'] = 'database_import';
1889 //require('../footer.php');
1890 print '<div class="info column"><ul>';
1892 if (isset($_POST['createdb'])) {
1893 $_SESSION['done'] = array('Create database','Write configuration');
1894 print '<li>Create database....<strong>SUCCESS</strong></li>';
1895 } else $_SESSION['done'] = array('Write configuration');
1897 $_SESSION['done'] = array('Write configuration');
1898 $_SESSION['errorlst'] = array();
1899 print '<li>Write configuration....<img src="../images/loading.gif" /></li></ul></div>';
1900 print "<script>console.log('Configuration writed...');setTimeout(window.location = 'index.php?".rand()."&next=".$_SESSION['install']."',10000);</script>";
1902 } else if (isset($_SESSION['install']) && $_SESSION['install'] != 'finish') {
1903 print '<div class="info column">';
1904 print '<ul><div id="step">';
1905 $pop = false;
1906 $popi = false;
1907 $popw = false;
1908 foreach ($_SESSION['done'] as $done) {
1909 print '<li>'.$done.'....<strong>SUCCESS</strong></li>';
1910 if ($done == 'Create database') $pop = true;
1911 if ($_SESSION['install'] == 'database_create') $pop = true;
1912 if ($_SESSION['install'] == 'database_import') $popi = true;
1913 if ($_SESSION['install'] == 'waypoints') $popw = true;
1915 if ($pop) {
1916 sleep(5);
1917 print '<li>Create database....<img src="../images/loading.gif" /></li>';
1918 } else if ($popi) {
1919 sleep(5);
1920 print '<li>Create and import tables....<img src="../images/loading.gif" /></li>';
1921 } else if ($popw) {
1922 sleep(5);
1923 print '<li>Populate waypoints database....<img src="../images/loading.gif" /></li>';
1924 } else print '<li>Update schema if needed....<img src="../images/loading.gif" /></li>';
1925 print '</div></ul>';
1926 print '<div id="error"></div>';
1927 /* foreach ($_SESSION['done'] as $done) {
1928 print '<li>'.$done.'....<strong>SUCCESS</strong></li>';
1930 print '<li>'.$SESSION['next'].'....<img src="../images/loading.gif" /></li>';
1932 if ($error != '') {
1933 print '<div class="info column"><span class="error"><strong>Error</strong>'.$error.'</span></div>';
1934 require('../footer.php');
1935 exit;
1939 <script language="JavaScript">
1940 function installaction() {
1941 $.ajax({
1942 url:'install-action.php',
1943 dataType: 'json',
1944 async: true,
1945 success: function(result) {
1946 console.log(result);
1947 $('#step').html('');
1948 result['done'].forEach(function(done) {
1949 $('#step').append('<li>'+ done +'....<strong>SUCCESS</strong></li>');
1951 result['errorlst'].forEach(function(done) {
1952 $('#step').append('<li>'+ done +'....<strong>FAILED</strong></li>');
1954 if (result['error'] != '') {
1955 setTimeout(function(){
1956 console.log('error !');
1957 $('#error').html('<p><b>Error : </b> ' + result['error'] + '</p>');
1958 }, 1000);
1959 loop = false;
1960 } else if (result['next'] != 'finish') {
1961 $('#step').append('<li>'+ result['next'] +'....<img src="../images/loading.gif" /></li>');
1962 installaction();
1963 } else if (result['install'] == 'finish') {
1964 console.log('finish !!!');
1965 $('#step').append('<li>Reloading page to check all is now ok....<img src="../images/loading.gif" /></li>');
1966 $(location).attr('href','index.php?next=finish');
1967 loop = false;
1970 error: function(XMLHttpRequest, textStatus, errorThrown) {
1971 console.log('error !');
1972 console.log(XMLHttpRequest);
1973 $('#error').html('<p><b>Error : </b> ' + textStatus + ' - ' + errorThrown + '</p><p><i>If the error is a time-out, you have to increase PHP script execution time-out</i></p>');
1979 $(document).ready(function() {
1980 installaction();
1982 </script>
1983 <?php
1984 } else if (isset($_SESSION['install']) && $_SESSION['install'] == 'finish') {
1985 unset($_SESSION['install']);
1986 unset($_SESSION['identified']);
1987 unset($_COOKIE['install']);
1988 print '<div class="info column"><ul>';
1989 foreach ($_SESSION['done'] as $done) {
1990 print '<li>'.$done.'....<strong>SUCCESS</strong></li>';
1992 print '<li>Reloading page to check all is now ok....<strong>SUCCESS</strong></li>';
1993 print '</ul></div>';
1994 print '<br /><p>All is now installed ! Thanks</p>';
1995 if ($globalSBS1) {
1996 print '<p>You need to run <b>scripts/daemon-spotter.php</b> as a daemon. You can use init script in the install/init directory.</p>';
1997 } else {
1998 print '<p>You need to run <b>scripts/daemon-spotter.php</b>. You can use init script in the install/init directory to run it as daemon.</p>';
2000 if ($globalACARS) {
2001 print '<p>You need to run <b>scripts/daemon-acars.php</b> as a daemon. You can use init script in the install/init directory.</p>';
2003 if ($globalFlightAware && ($globalFlightAwareUsername == '' || $globalFlightAwarePassword == '')) {
2004 print '<p>You <strong>must</strong> have a FlightAware API account to use FlightAware source</p>';
2006 if (isset($globalVATSIM) && $globalVATSIM) {
2007 print '<p>Airline table is populated with VATSIM data</p>';
2009 if (isset($globalIVAO) && $globalIVAO) {
2010 print '<p>You need to run install/populate_ivao.php if you want to have IVAO airlines</p>';
2012 if (isset($globalMap3D) && $globalMap3D) {
2013 print '<p>You need to run <b>scripts/update_db.php</b> first time manually, this will update all and download 3D models.</p>';
2015 if (isset($globalVAM) && $globalVAM) {
2016 print '<p>You need to copy <b>install/VAM/VAM-json.php</b> to your Virtual Airline Manager directory and use this URL as source.</p>';
2018 if (isset($globalGeoid) && $globalGeoid) {
2019 print '<p>You need to run <b>scripts/update_db.php</b> to update Geoid file if needed (or first time).</p>';
2021 print '<p>If you want to keep external data updated, you have to add <b>scripts/update_db.php</b> in cron (every hour or 30 minutes if computer is fast enough).</p>';
2022 print '<p>If <b>scripts/daemon-spotter.php</b> is already running, you have to restart it.</p>';
2023 print '</div>';
2024 } else {
2025 unset($_SESSION['install']);
2026 unset($_SESSION['identified']);
2027 // header("Location: index.php");
2029 require('../footer.php');