Completed
Push — master ( 29f11a...828dff )
by Yannick
112:32 queued 85:33
created
install/index.php 1 patch
Braces   +532 added lines, -146 removed lines patch added patch discarded remove patch
@@ -4,19 +4,35 @@  discard block
 block discarded – undo
4 4
 if (isset($_SESSION['error'])) {
5 5
 	header('Content-Encoding: none;');
6 6
 	echo 'Error : '.$_SESSION['error'].' - Resetting install... You need to fix the problem and run install again.';
7
-	if (isset($_SESSION['error'])) unset($_SESSION['error']);
8
-	if (isset($_SESSION['errorlst'])) unset($_SESSION['errorlst']);
9
-	if (isset($_SESSION['next'])) unset($_SESSION['next']);
10
-	if (isset($_SESSION['install'])) unset($_SESSION['install']);
11
-}
7
+	if (isset($_SESSION['error'])) {
8
+		unset($_SESSION['error']);
9
+	}
10
+	if (isset($_SESSION['errorlst'])) {
11
+		unset($_SESSION['errorlst']);
12
+	}
13
+	if (isset($_SESSION['next'])) {
14
+		unset($_SESSION['next']);
15
+	}
16
+	if (isset($_SESSION['install'])) {
17
+		unset($_SESSION['install']);
18
+	}
19
+	}
12 20
 if (isset($_SESSION['errorlst'])) {
13 21
 	header('Content-Encoding: none;');
14 22
 	echo 'Error : Resetting install... You need to fix the problem and run install again.';
15
-	if (isset($_SESSION['error'])) unset($_SESSION['error']);
16
-	if (isset($_SESSION['errorlst'])) unset($_SESSION['errorlst']);
17
-	if (isset($_SESSION['next'])) unset($_SESSION['next']);
18
-	if (isset($_SESSION['install'])) unset($_SESSION['install']);
19
-}
23
+	if (isset($_SESSION['error'])) {
24
+		unset($_SESSION['error']);
25
+	}
26
+	if (isset($_SESSION['errorlst'])) {
27
+		unset($_SESSION['errorlst']);
28
+	}
29
+	if (isset($_SESSION['next'])) {
30
+		unset($_SESSION['next']);
31
+	}
32
+	if (isset($_SESSION['install'])) {
33
+		unset($_SESSION['install']);
34
+	}
35
+	}
20 36
 require_once(dirname(__FILE__).'/class.create_db.php');
21 37
 require_once(dirname(__FILE__).'/class.update_schema.php');
22 38
 require_once(dirname(__FILE__).'/class.settings.php');
@@ -154,45 +170,72 @@  discard block
 block discarded – undo
154 170
 			</div>
155 171
 			<p>
156 172
 				<label for="dbhost">Database hostname</label>
157
-				<input type="text" name="dbhost" id="dbhost" value="<?php if (isset($globalDBhost)) print $globalDBhost; ?>" />
173
+				<input type="text" name="dbhost" id="dbhost" value="<?php if (isset($globalDBhost)) {
174
+	print $globalDBhost;
175
+}
176
+?>" />
158 177
 			</p>
159 178
 			<p>
160 179
 				<label for="dbport">Database port</label>
161
-				<input type="text" name="dbport" id="dbport" value="<?php if (isset($globalDBport)) print $globalDBport; ?>" />
180
+				<input type="text" name="dbport" id="dbport" value="<?php if (isset($globalDBport)) {
181
+	print $globalDBport;
182
+}
183
+?>" />
162 184
 				<p class="help-block">Default is 3306 for MariaDB/MySQL, 5432 for PostgreSQL</p>
163 185
 			</p>
164 186
 			<p>
165 187
 				<label for="dbname">Database name</label>
166
-				<input type="text" name="dbname" id="dbname" value="<?php if (isset($globalDBname)) print $globalDBname; ?>" />
188
+				<input type="text" name="dbname" id="dbname" value="<?php if (isset($globalDBname)) {
189
+	print $globalDBname;
190
+}
191
+?>" />
167 192
 			</p>
168 193
 			<p>
169 194
 				<label for="dbuser">Database user</label>
170
-				<input type="text" name="dbuser" id="dbuser" value="<?php if (isset($globalDBuser)) print $globalDBuser; ?>" />
195
+				<input type="text" name="dbuser" id="dbuser" value="<?php if (isset($globalDBuser)) {
196
+	print $globalDBuser;
197
+}
198
+?>" />
171 199
 			</p>
172 200
 			<p>
173 201
 				<label for="dbuserpass">Database user password</label>
174
-				<input type="password" name="dbuserpass" id="dbuserpass" value="<?php if (isset($globalDBpass)) print $globalDBpass; ?>" />
202
+				<input type="password" name="dbuserpass" id="dbuserpass" value="<?php if (isset($globalDBpass)) {
203
+	print $globalDBpass;
204
+}
205
+?>" />
175 206
 			</p>
176 207
 		</fieldset>
177 208
 		<fieldset id="site">
178 209
 			<legend>Site configuration</legend>
179 210
 			<p>
180 211
 				<label for="sitename">Site name</label>
181
-				<input type="text" name="sitename" id="sitename" value="<?php if (isset($globalName)) print $globalName; ?>" />
212
+				<input type="text" name="sitename" id="sitename" value="<?php if (isset($globalName)) {
213
+	print $globalName;
214
+}
215
+?>" />
182 216
 			</p>
183 217
 			<p>
184 218
 				<label for="siteurl">Site directory</label>
185
-				<input type="text" name="siteurl" id="siteurl" value="<?php if (isset($globalURL)) print $globalURL; ?>" />
219
+				<input type="text" name="siteurl" id="siteurl" value="<?php if (isset($globalURL)) {
220
+	print $globalURL;
221
+}
222
+?>" />
186 223
 				<p class="help-block">Can be null. ex : <i>flightairmap</i> if complete URL is <i>http://toto.com/flightairmap</i></p>
187 224
 			</p>
188 225
 			<p>
189 226
 				<label for="timezone">Timezone</label>
190
-				<input type="text" name="timezone" id="timezone" value="<?php if (isset($globalTimezone)) print $globalTimezone; ?>" />
227
+				<input type="text" name="timezone" id="timezone" value="<?php if (isset($globalTimezone)) {
228
+	print $globalTimezone;
229
+}
230
+?>" />
191 231
 				<p class="help-block">ex : UTC, Europe/Paris,...</p>
192 232
 			</p>
193 233
 			<p>
194 234
 				<label for="language">Language</label>
195
-				<input type="text" name="language" id="language" value="<?php if (isset($globalLanguage)) print $globalLanguage; ?>" />
235
+				<input type="text" name="language" id="language" value="<?php if (isset($globalLanguage)) {
236
+	print $globalLanguage;
237
+}
238
+?>" />
196 239
 				<p class="help-block">Used only when link to wikipedia for now. Can be EN,DE,FR,...</p>
197 240
 			</p>
198 241
 		</fieldset>
@@ -213,11 +256,17 @@  discard block
 block discarded – undo
213 256
 			<div id="mapbox_data">
214 257
 				<p>
215 258
 					<label for="mapboxid">Mapbox id</label>
216
-					<input type="text" name="mapboxid" id="mapboxid" value="<?php if (isset($globalMapboxId)) print $globalMapboxId; ?>" />
259
+					<input type="text" name="mapboxid" id="mapboxid" value="<?php if (isset($globalMapboxId)) {
260
+	print $globalMapboxId;
261
+}
262
+?>" />
217 263
 				</p>
218 264
 				<p>
219 265
 					<label for="mapboxtoken">Mapbox token</label>
220
-					<input type="text" name="mapboxtoken" id="mapboxtoken" value="<?php if (isset($globalMapboxToken)) print $globalMapboxToken; ?>" />
266
+					<input type="text" name="mapboxtoken" id="mapboxtoken" value="<?php if (isset($globalMapboxToken)) {
267
+	print $globalMapboxToken;
268
+}
269
+?>" />
221 270
 				</p>
222 271
 				<p class="help-block">Get a key <a href="https://www.mapbox.com/developers/">here</a></p>
223 272
 			</div>
@@ -225,7 +274,10 @@  discard block
 block discarded – undo
225 274
 			<div id="google_data">
226 275
 				<p>
227 276
 					<label for="googlekey">Google API key</label>
228
-					<input type="text" name="googlekey" id="googlekey" value="<?php if (isset($globalGoogleAPIKey)) print $globalGoogleAPIKey; ?>" />
277
+					<input type="text" name="googlekey" id="googlekey" value="<?php if (isset($globalGoogleAPIKey)) {
278
+	print $globalGoogleAPIKey;
279
+}
280
+?>" />
229 281
 					<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>
230 282
 				</p>
231 283
 			</div>
@@ -233,7 +285,10 @@  discard block
 block discarded – undo
233 285
 			<div id="bing_data">
234 286
 				<p>
235 287
 					<label for="bingkey">Bing Map key</label>
236
-					<input type="text" name="bingkey" id="bingkey" value="<?php if (isset($globalBingMapKey)) print $globalBingMapKey; ?>" />
288
+					<input type="text" name="bingkey" id="bingkey" value="<?php if (isset($globalBingMapKey)) {
289
+	print $globalBingMapKey;
290
+}
291
+?>" />
237 292
 					<p class="help-block">Get a key <a href="https://www.bingmapsportal.com/">here</a></p>
238 293
 				</p>
239 294
 			</div>
@@ -241,7 +296,10 @@  discard block
 block discarded – undo
241 296
 			<div id="mapquest_data">
242 297
 				<p>
243 298
 					<label for="mapquestkey">MapQuest key</label>
244
-					<input type="text" name="mapquestkey" id="mapquestkey" value="<?php if (isset($globalMapQuestKey)) print $globalMapQuestKey; ?>" />
299
+					<input type="text" name="mapquestkey" id="mapquestkey" value="<?php if (isset($globalMapQuestKey)) {
300
+	print $globalMapQuestKey;
301
+}
302
+?>" />
245 303
 					<p class="help-block">Get a key <a href="https://developer.mapquest.com/user/me/apps">here</a></p>
246 304
 				</p>
247 305
 			</div>
@@ -249,11 +307,17 @@  discard block
 block discarded – undo
249 307
 			<div id="here_data">
250 308
 				<p>
251 309
 					<label for="hereappid">Here App_Id</label>
252
-					<input type="text" name="hereappid" id="hereappid" value="<?php if (isset($globalHereappId)) print $globalHereappId; ?>" />
310
+					<input type="text" name="hereappid" id="hereappid" value="<?php if (isset($globalHereappId)) {
311
+	print $globalHereappId;
312
+}
313
+?>" />
253 314
 				</p>
254 315
 				<p>
255 316
 					<label for="hereappcode">Here App_Code</label>
256
-					<input type="text" name="hereappcode" id="hereappcode" value="<?php if (isset($globalHereappCode)) print $globalHereappCode; ?>" />
317
+					<input type="text" name="hereappcode" id="hereappcode" value="<?php if (isset($globalHereappCode)) {
318
+	print $globalHereappCode;
319
+}
320
+?>" />
257 321
 				</p>
258 322
 				<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>
259 323
 			</div>
@@ -261,7 +325,10 @@  discard block
 block discarded – undo
261 325
 			<div id="openweathermap_data">
262 326
 				<p>
263 327
 					<label for="openweathermapkey">OpenWeatherMap key (weather layer)</label>
264
-					<input type="text" name="openweathermapkey" id="openweathermapkey" value="<?php if (isset($globalOpenWeatherMapKey)) print $globalOpenWeatherMapKey; ?>" />
328
+					<input type="text" name="openweathermapkey" id="openweathermapkey" value="<?php if (isset($globalOpenWeatherMapKey)) {
329
+	print $globalOpenWeatherMapKey;
330
+}
331
+?>" />
265 332
 					<p class="help-block">Get a key <a href="https://openweathermap.org/">here</a></p>
266 333
 				</p>
267 334
 			</div>
@@ -271,42 +338,86 @@  discard block
 block discarded – undo
271 338
 			<legend>Coverage area</legend>
272 339
 			<p>
273 340
 				<label for="latitudemax">The maximum latitude (north)</label>
274
-				<input type="text" name="latitudemax" id="latitudemax" value="<?php if (isset($globalLatitudeMax)) print $globalLatitudeMax; ?>" />
341
+				<input type="text" name="latitudemax" id="latitudemax" value="<?php if (isset($globalLatitudeMax)) {
342
+	print $globalLatitudeMax;
343
+}
344
+?>" />
275 345
 			</p>
276 346
 			<p>
277 347
 				<label for="latitudemin">The minimum latitude (south)</label>
278
-				<input type="text" name="latitudemin" id="latitudemin" value="<?php if (isset($globalLatitudeMin)) print $globalLatitudeMin; ?>" />
348
+				<input type="text" name="latitudemin" id="latitudemin" value="<?php if (isset($globalLatitudeMin)) {
349
+	print $globalLatitudeMin;
350
+}
351
+?>" />
279 352
 			</p>
280 353
 			<p>
281 354
 				<label for="longitudemax">The maximum longitude (west)</label>
282
-				<input type="text" name="longitudemax" id="longitudemax" value="<?php if (isset($globalLongitudeMax)) print $globalLongitudeMax; ?>" />
355
+				<input type="text" name="longitudemax" id="longitudemax" value="<?php if (isset($globalLongitudeMax)) {
356
+	print $globalLongitudeMax;
357
+}
358
+?>" />
283 359
 			</p>
284 360
 			<p>
285 361
 				<label for="longitudemin">The minimum longitude (east)</label>
286
-				<input type="text" name="longitudemin" id="longitudemin" value="<?php if (isset($globalLongitudeMin)) print $globalLongitudeMin; ?>" />
362
+				<input type="text" name="longitudemin" id="longitudemin" value="<?php if (isset($globalLongitudeMin)) {
363
+	print $globalLongitudeMin;
364
+}
365
+?>" />
287 366
 			</p>
288 367
 			<p>
289 368
 				<label for="latitudecenter">The latitude center</label>
290
-				<input type="text" name="latitudecenter" id="latitudecenter" value="<?php if (isset($globalCenterLatitude)) print $globalCenterLatitude; ?>" />
369
+				<input type="text" name="latitudecenter" id="latitudecenter" value="<?php if (isset($globalCenterLatitude)) {
370
+	print $globalCenterLatitude;
371
+}
372
+?>" />
291 373
 			</p>
292 374
 			<p>
293 375
 				<label for="longitudecenter">The longitude center</label>
294
-				<input type="text" name="longitudecenter" id="longitudecenter" value="<?php if (isset($globalCenterLongitude)) print $globalCenterLongitude; ?>" />
376
+				<input type="text" name="longitudecenter" id="longitudecenter" value="<?php if (isset($globalCenterLongitude)) {
377
+	print $globalCenterLongitude;
378
+}
379
+?>" />
295 380
 			</p>
296 381
 			<p>
297 382
 				<label for="livezoom">Default Zoom on live map</label>
298
-				<input type="number" name="livezoom" id="livezoom" value="<?php if (isset($globalLiveZoom)) print $globalLiveZoom; else print '9'; ?>" />
383
+				<input type="number" name="livezoom" id="livezoom" value="<?php if (isset($globalLiveZoom)) {
384
+	print $globalLiveZoom;
385
+} else {
386
+	print '9';
387
+}
388
+?>" />
299 389
 			</p>
300 390
 			<p>
301 391
 				<label for="squawk_country">Country for squawk usage</label>
302 392
 				<select name="squawk_country" id="squawk_country">
303
-					<option value="UK"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'UK') print ' selected '; ?>>UK</option>
304
-					<option value="NZ"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'NZ') print ' selected '; ?>>NZ</option>
305
-					<option value="US"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'US') print ' selected '; ?>>US</option>
306
-					<option value="AU"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'AU') print ' selected '; ?>>AU</option>
307
-					<option value="NL"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'NL') print ' selected '; ?>>NL</option>
308
-					<option value="FR"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'FR') print ' selected '; ?>>FR</option>
309
-					<option value="TR"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'TR') print ' selected '; ?>>TR</option>
393
+					<option value="UK"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'UK') {
394
+	print ' selected ';
395
+}
396
+?>>UK</option>
397
+					<option value="NZ"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'NZ') {
398
+	print ' selected ';
399
+}
400
+?>>NZ</option>
401
+					<option value="US"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'US') {
402
+	print ' selected ';
403
+}
404
+?>>US</option>
405
+					<option value="AU"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'AU') {
406
+	print ' selected ';
407
+}
408
+?>>AU</option>
409
+					<option value="NL"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'NL') {
410
+	print ' selected ';
411
+}
412
+?>>NL</option>
413
+					<option value="FR"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'FR') {
414
+	print ' selected ';
415
+}
416
+?>>FR</option>
417
+					<option value="TR"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'TR') {
418
+	print ' selected ';
419
+}
420
+?>>TR</option>
310 421
 				</select>
311 422
 			</p>
312 423
 		</fieldset>
@@ -315,15 +426,24 @@  discard block
 block discarded – undo
315 426
 			<p><i>Only put in DB flights that are inside a circle</i></p>
316 427
 			<p>
317 428
 				<label for="latitude">Center latitude</label>
318
-				<input type="text" name="zoilatitude" id="latitude" value="<?php if (isset($globalDistanceIgnore['latitude'])) echo $globalDistanceIgnore['latitude']; ?>" />
429
+				<input type="text" name="zoilatitude" id="latitude" value="<?php if (isset($globalDistanceIgnore['latitude'])) {
430
+	echo $globalDistanceIgnore['latitude'];
431
+}
432
+?>" />
319 433
 			</p>
320 434
 			<p>
321 435
 				<label for="longitude">Center longitude</label>
322
-				<input type="text" name="zoilongitude" id="longitude" value="<?php if (isset($globalDistanceIgnore['longitude'])) echo $globalDistanceIgnore['longitude']; ?>" />
436
+				<input type="text" name="zoilongitude" id="longitude" value="<?php if (isset($globalDistanceIgnore['longitude'])) {
437
+	echo $globalDistanceIgnore['longitude'];
438
+}
439
+?>" />
323 440
 			</p>
324 441
 			<p>
325 442
 				<label for="Distance">Distance (in km)</label>
326
-				<input type="text" name="zoidistance" id="distance" value="<?php if (isset($globalDistanceIgnore['distance'])) echo $globalDistanceIgnore['distance']; ?>" />
443
+				<input type="text" name="zoidistance" id="distance" value="<?php if (isset($globalDistanceIgnore['distance'])) {
444
+	echo $globalDistanceIgnore['distance'];
445
+}
446
+?>" />
327 447
 			</p>
328 448
 		</fieldset>
329 449
 		<fieldset id="sourceloc">
@@ -436,11 +556,17 @@  discard block
 block discarded – undo
436 556
 			<div id="flightaware_data">
437 557
 				<p>
438 558
 					<label for="flightawareusername">FlightAware username</label>
439
-					<input type="text" name="flightawareusername" id="flightawareusername" value="<?php if (isset($globalFlightAwareUsername)) print $globalFlightAwareUsername; ?>" />
559
+					<input type="text" name="flightawareusername" id="flightawareusername" value="<?php if (isset($globalFlightAwareUsername)) {
560
+	print $globalFlightAwareUsername;
561
+}
562
+?>" />
440 563
 				</p>
441 564
 				<p>
442 565
 					<label for="flightawarepassword">FlightAware password/API key</label>
443
-					<input type="text" name="flightawarepassword" id="flightawarepassword" value="<?php if (isset($globalFlightAwarePassword)) print $globalFlightAwarePassword; ?>" />
566
+					<input type="text" name="flightawarepassword" id="flightawarepassword" value="<?php if (isset($globalFlightAwarePassword)) {
567
+	print $globalFlightAwarePassword;
568
+}
569
+?>" />
444 570
 				</p>
445 571
 			</div>
446 572
 -->
@@ -482,7 +608,10 @@  discard block
 block discarded – undo
482 608
 								    if (filter_var($source['host'],FILTER_VALIDATE_URL)) {
483 609
 								?>
484 610
 								<td><input type="text" name="host[]" id="host" value="<?php print $source['host']; ?>" /></td>
485
-								<td><input type="text" name="port[]" class="col-xs-2" id="port" value="<?php if (isset($source['port'])) print $source['port']; ?>" /></td>
611
+								<td><input type="text" name="port[]" class="col-xs-2" id="port" value="<?php if (isset($source['port'])) {
612
+	print $source['port'];
613
+}
614
+?>" /></td>
486 615
 								<?php
487 616
 								    } else {
488 617
 									$hostport = explode(':',$source['host']);
@@ -501,33 +630,102 @@  discard block
 block discarded – undo
501 630
 								?>
502 631
 								<td>
503 632
 									<select name="format[]" id="format">
504
-										<option value="auto" <?php if (!isset($source['format'])) print 'selected'; ?>>Auto</option>
505
-										<option value="sbs" <?php if (isset($source['format']) && $source['format'] == 'sbs') print 'selected'; ?>>SBS</option>
506
-										<option value="tsv" <?php if (isset($source['format']) && $source['format'] == 'tsv') print 'selected'; ?>>TSV</option>
507
-										<option value="raw" <?php if (isset($source['format']) && $source['format'] == 'raw') print 'selected'; ?>>Raw</option>
508
-										<option value="aprs" <?php if (isset($source['format']) && $source['format'] == 'aprs') print 'selected'; ?>>APRS</option>
509
-										<option value="deltadbtxt" <?php if (isset($source['format']) && $source['format'] == 'deltadbtxt') print 'selected'; ?>>Radarcape deltadb.txt</option>
510
-										<option value="vatsimtxt" <?php if (isset($source['format']) && $source['format'] == 'vatsimtxt') print 'selected'; ?>>Vatsim</option>
511
-										<option value="aircraftlistjson" <?php if (isset($source['format']) && $source['format'] == 'aircraftlistjson') print 'selected'; ?>>Virtual Radar Server AircraftList.json</option>
512
-										<option value="vrstcp" <?php if (isset($source['format']) && $source['format'] == 'vrstcp') print 'selected'; ?>>Virtual Radar Server TCP</option>
513
-										<option value="phpvmacars" <?php if (isset($source['format']) && $source['format'] == 'phpvmacars') print 'selected'; ?>>phpVMS</option>
514
-										<option value="vam" <?php if (isset($source['format']) && $source['format'] == 'vam') print 'selected'; ?>>Virtual Airlines Manager</option>
515
-										<option value="whazzup" <?php if (isset($source['format']) && $source['format'] == 'whazzup') print 'selected'; ?>>IVAO</option>
516
-										<option value="flightgearmp" <?php if (isset($source['format']) && $source['format'] == 'flightgearmp') print 'selected'; ?>>FlightGear Multiplayer</option>
517
-										<option value="flightgearsp" <?php if (isset($source['format']) && $source['format'] == 'flightgearsp') print 'selected'; ?>>FlightGear Singleplayer</option>
518
-										<option value="acars" <?php if (isset($source['format']) && $source['format'] == 'acars') print 'selected'; ?>>ACARS from acarsdec/acarsdeco2 over UDP</option>
519
-										<option value="acarssbs3" <?php if (isset($source['format']) && $source['format'] == 'acarssbs3') print 'selected'; ?>>ACARS SBS-3 over TCP</option>
520
-										<option value="ais" <?php if (isset($source['format']) && $source['format'] == 'ais') print 'selected'; ?>>NMEA AIS over TCP</option>
521
-										<option value="airwhere" <?php if (isset($source['format']) && $source['format'] == 'airwhere') print 'selected'; ?>>AirWhere website</option>
522
-										<option value="hidnseek_callback" <?php if (isset($source['format']) && $source['format'] == 'hidnseek_callback') print 'selected'; ?>>HidnSeek Callback</option>
523
-										<option value="blitzortung" <?php if (isset($source['format']) && $source['format'] == 'blitzortung') print 'selected'; ?>>Blitzortung</option>
633
+										<option value="auto" <?php if (!isset($source['format'])) {
634
+	print 'selected';
635
+}
636
+?>>Auto</option>
637
+										<option value="sbs" <?php if (isset($source['format']) && $source['format'] == 'sbs') {
638
+	print 'selected';
639
+}
640
+?>>SBS</option>
641
+										<option value="tsv" <?php if (isset($source['format']) && $source['format'] == 'tsv') {
642
+	print 'selected';
643
+}
644
+?>>TSV</option>
645
+										<option value="raw" <?php if (isset($source['format']) && $source['format'] == 'raw') {
646
+	print 'selected';
647
+}
648
+?>>Raw</option>
649
+										<option value="aprs" <?php if (isset($source['format']) && $source['format'] == 'aprs') {
650
+	print 'selected';
651
+}
652
+?>>APRS</option>
653
+										<option value="deltadbtxt" <?php if (isset($source['format']) && $source['format'] == 'deltadbtxt') {
654
+	print 'selected';
655
+}
656
+?>>Radarcape deltadb.txt</option>
657
+										<option value="vatsimtxt" <?php if (isset($source['format']) && $source['format'] == 'vatsimtxt') {
658
+	print 'selected';
659
+}
660
+?>>Vatsim</option>
661
+										<option value="aircraftlistjson" <?php if (isset($source['format']) && $source['format'] == 'aircraftlistjson') {
662
+	print 'selected';
663
+}
664
+?>>Virtual Radar Server AircraftList.json</option>
665
+										<option value="vrstcp" <?php if (isset($source['format']) && $source['format'] == 'vrstcp') {
666
+	print 'selected';
667
+}
668
+?>>Virtual Radar Server TCP</option>
669
+										<option value="phpvmacars" <?php if (isset($source['format']) && $source['format'] == 'phpvmacars') {
670
+	print 'selected';
671
+}
672
+?>>phpVMS</option>
673
+										<option value="vam" <?php if (isset($source['format']) && $source['format'] == 'vam') {
674
+	print 'selected';
675
+}
676
+?>>Virtual Airlines Manager</option>
677
+										<option value="whazzup" <?php if (isset($source['format']) && $source['format'] == 'whazzup') {
678
+	print 'selected';
679
+}
680
+?>>IVAO</option>
681
+										<option value="flightgearmp" <?php if (isset($source['format']) && $source['format'] == 'flightgearmp') {
682
+	print 'selected';
683
+}
684
+?>>FlightGear Multiplayer</option>
685
+										<option value="flightgearsp" <?php if (isset($source['format']) && $source['format'] == 'flightgearsp') {
686
+	print 'selected';
687
+}
688
+?>>FlightGear Singleplayer</option>
689
+										<option value="acars" <?php if (isset($source['format']) && $source['format'] == 'acars') {
690
+	print 'selected';
691
+}
692
+?>>ACARS from acarsdec/acarsdeco2 over UDP</option>
693
+										<option value="acarssbs3" <?php if (isset($source['format']) && $source['format'] == 'acarssbs3') {
694
+	print 'selected';
695
+}
696
+?>>ACARS SBS-3 over TCP</option>
697
+										<option value="ais" <?php if (isset($source['format']) && $source['format'] == 'ais') {
698
+	print 'selected';
699
+}
700
+?>>NMEA AIS over TCP</option>
701
+										<option value="airwhere" <?php if (isset($source['format']) && $source['format'] == 'airwhere') {
702
+	print 'selected';
703
+}
704
+?>>AirWhere website</option>
705
+										<option value="hidnseek_callback" <?php if (isset($source['format']) && $source['format'] == 'hidnseek_callback') {
706
+	print 'selected';
707
+}
708
+?>>HidnSeek Callback</option>
709
+										<option value="blitzortung" <?php if (isset($source['format']) && $source['format'] == 'blitzortung') {
710
+	print 'selected';
711
+}
712
+?>>Blitzortung</option>
524 713
 									</select>
525 714
 								</td>
526 715
 								<td>
527
-									<input type="text" name="name[]" id="name" value="<?php if (isset($source['name'])) print $source['name']; ?>" />
716
+									<input type="text" name="name[]" id="name" value="<?php if (isset($source['name'])) {
717
+	print $source['name'];
718
+}
719
+?>" />
528 720
 								</td>
529
-								<td><input type="checkbox" name="sourcestats[]" id="sourcestats" title="Create statistics for the source like number of messages, distance,..." value="1" <?php if (isset($source['sourcestats']) && $source['sourcestats']) print 'checked'; ?> /></td>
530
-								<td><input type="checkbox" name="noarchive[]" id="noarchive" title="Don't archive this source" value="1" <?php if (isset($source['noarchive']) && $source['noarchive']) print 'checked'; ?> /></td>
721
+								<td><input type="checkbox" name="sourcestats[]" id="sourcestats" title="Create statistics for the source like number of messages, distance,..." value="1" <?php if (isset($source['sourcestats']) && $source['sourcestats']) {
722
+	print 'checked';
723
+}
724
+?> /></td>
725
+								<td><input type="checkbox" name="noarchive[]" id="noarchive" title="Don't archive this source" value="1" <?php if (isset($source['noarchive']) && $source['noarchive']) {
726
+	print 'checked';
727
+}
728
+?> /></td>
531 729
 								<td>
532 730
 									<select name="timezones[]" id="timezones">
533 731
 								<?php
@@ -537,7 +735,9 @@  discard block
 block discarded – undo
537 735
 											print '<option selected>'.$timezones.'</option>';
538 736
 										} elseif (!isset($source['timezone']) && $timezones == 'UTC') {
539 737
 											print '<option selected>'.$timezones.'</option>';
540
-										} else print '<option>'.$timezones.'</option>';
738
+										} else {
739
+											print '<option>'.$timezones.'</option>';
740
+										}
541 741
 									}
542 742
 								?>
543 743
 									</select>
@@ -587,7 +787,9 @@  discard block
 block discarded – undo
587 787
 									foreach($timezonelist as $timezones){
588 788
 										if ($timezones == 'UTC') {
589 789
 											print '<option selected>'.$timezones.'</option>';
590
-										} else print '<option>'.$timezones.'</option>';
790
+										} else {
791
+											print '<option>'.$timezones.'</option>';
792
+										}
591 793
 									}
592 794
 								?>
593 795
 									</select>
@@ -610,11 +812,17 @@  discard block
 block discarded – undo
610 812
 					<p>Listen UDP server for acarsdec/acarsdeco2/... with <i>daemon-acars.php</i> script</p>
611 813
 					<p>
612 814
 						<label for="acarshost">ACARS UDP host</label>
613
-						<input type="text" name="acarshost" id="acarshost" value="<?php if (isset($globalACARSHost)) print $globalACARSHost; ?>" />
815
+						<input type="text" name="acarshost" id="acarshost" value="<?php if (isset($globalACARSHost)) {
816
+	print $globalACARSHost;
817
+}
818
+?>" />
614 819
 					</p>
615 820
 					<p>
616 821
 						<label for="acarsport">ACARS UDP port</label>
617
-						<input type="number" name="acarsport" id="acarsport" value="<?php if (isset($globalACARSPort)) print $globalACARSPort; ?>" />
822
+						<input type="number" name="acarsport" id="acarsport" value="<?php if (isset($globalACARSPort)) {
823
+	print $globalACARSPort;
824
+}
825
+?>" />
618 826
 					</p>
619 827
 				</fieldset>
620 828
 			</div>
@@ -701,13 +909,19 @@  discard block
 block discarded – undo
701 909
 			<div id="schedules_options">
702 910
 				<p>
703 911
 					<label for="britishairways">British Airways API Key</label>
704
-					<input type="text" name="britishairways" id="britishairways" value="<?php if (isset($globalBritishAirwaysKey)) print $globalBritishAirwaysKey; ?>" />
912
+					<input type="text" name="britishairways" id="britishairways" value="<?php if (isset($globalBritishAirwaysKey)) {
913
+	print $globalBritishAirwaysKey;
914
+}
915
+?>" />
705 916
 					<p class="help-block">Register an account on <a href="https://developer.ba.com/">https://developer.ba.com/</a></p>
706 917
 				</p>
707 918
 				<!--
708 919
 				<p>
709 920
 					<label for="transavia">Transavia Test API Consumer Key</label>
710
-					<input type="text" name="transavia" id="transavia" value="<?php if (isset($globalTransaviaKey)) print $globalTransaviaKey; ?>" />
921
+					<input type="text" name="transavia" id="transavia" value="<?php if (isset($globalTransaviaKey)) {
922
+	print $globalTransaviaKey;
923
+}
924
+?>" />
711 925
 					<p class="help-block">Register an account on <a href="https://developer.transavia.com">https://developer.transavia.com</a></p>
712 926
 				</p>
713 927
 				-->
@@ -716,10 +930,16 @@  discard block
 block discarded – undo
716 930
 						<b>Lufthansa API Key</b>
717 931
 						<p>
718 932
 							<label for="lufthansakey">Key</label>
719
-							<input type="text" name="lufthansakey" id="lufthansakey" value="<?php if (isset($globalLufthansaKey['key'])) print $globalLufthansaKey['key']; ?>" />
933
+							<input type="text" name="lufthansakey" id="lufthansakey" value="<?php if (isset($globalLufthansaKey['key'])) {
934
+	print $globalLufthansaKey['key'];
935
+}
936
+?>" />
720 937
 						</p><p>
721 938
 							<label for="lufthansasecret">Secret</label>
722
-							<input type="text" name="lufthansasecret" id="lufthansasecret" value="<?php if (isset($globalLufthansaKey['secret'])) print $globalLufthansaKey['secret']; ?>" />
939
+							<input type="text" name="lufthansasecret" id="lufthansasecret" value="<?php if (isset($globalLufthansaKey['secret'])) {
940
+	print $globalLufthansaKey['secret'];
941
+}
942
+?>" />
723 943
 						</p>
724 944
 					</div>
725 945
 					<p class="help-block">Register an account on <a href="https://developer.lufthansa.com/page">https://developer.lufthansa.com/page</a></p>
@@ -739,7 +959,10 @@  discard block
 block discarded – undo
739 959
 			</p>
740 960
 			<p>
741 961
 				<label for="notamsource">URL of your feed from notaminfo.com</label>
742
-				<input type="text" name="notamsource" id="notamsource" value="<?php if (isset($globalNOTAMSource)) print $globalNOTAMSource; ?>" />
962
+				<input type="text" name="notamsource" id="notamsource" value="<?php if (isset($globalNOTAMSource)) {
963
+	print $globalNOTAMSource;
964
+}
965
+?>" />
743 966
 				<p class="help-block">If you want to use world NOTAM from FlightAirMap website, leave it blank</p>
744 967
 			</p>
745 968
 			<br />
@@ -755,14 +978,20 @@  discard block
 block discarded – undo
755 978
 			<div id="metarsrc">
756 979
 				<p>
757 980
 					<label for="metarsource">URL of your METAR source</label>
758
-					<input type="text" name="metarsource" id="metarsource" value="<?php if (isset($globalMETARurl)) print $globalMETARurl; ?>" />
981
+					<input type="text" name="metarsource" id="metarsource" value="<?php if (isset($globalMETARurl)) {
982
+	print $globalMETARurl;
983
+}
984
+?>" />
759 985
 					<p class="help-block">Use {icao} to specify where we replace by airport icao. ex : http://metar.vatsim.net/metar.php?id={icao}</p>
760 986
 				</p>
761 987
 			</div>
762 988
 			<br />
763 989
 			<p>
764 990
 				<label for="bitly">Bit.ly access token api (used in search page)</label>
765
-				<input type="text" name="bitly" id="bitly" value="<?php if (isset($globalBitlyAccessToken)) print $globalBitlyAccessToken; ?>" />
991
+				<input type="text" name="bitly" id="bitly" value="<?php if (isset($globalBitlyAccessToken)) {
992
+	print $globalBitlyAccessToken;
993
+}
994
+?>" />
766 995
 			</p>
767 996
 			<br />
768 997
 			<p>
@@ -778,11 +1007,26 @@  discard block
 block discarded – undo
778 1007
 			<p>
779 1008
 				<label for="geoid_source">Geoid Source</label>
780 1009
 				<select name="geoid_source" id="geoid_source">
781
-					<option value="egm96-15"<?php if (isset($globalGeoidSource) && $globalGeoidSource == 'egm96-15') print ' selected="selected"'; ?>>EGM96 15' (2.1MB)</option>
782
-					<option value="egm96-5"<?php if (isset($globalGeoidSource) && $globalGeoidSource == 'egm96-5') print ' selected="selected"'; ?>>EGM96 5' (19MB)</option>
783
-					<option value="egm2008-5"<?php if (isset($globalGeoidSource) && $globalGeoidSource == 'egm2008-5') print ' selected="selected"'; ?>>EGM2008 5' (19MB)</option>
784
-					<option value="egm2008-2_5"<?php if (isset($globalGeoidSource) && $globalGeoidSource == 'egm2008-2_5') print ' selected="selected"'; ?>>EGM2008 2.5' (75MB)</option>
785
-					<option value="egm2008-1"<?php if (isset($globalGeoidSource) && $globalGeoidSource == 'egm2008-1') print ' selected="selected"'; ?>>EGM2008 1' (470MB)</option>
1010
+					<option value="egm96-15"<?php if (isset($globalGeoidSource) && $globalGeoidSource == 'egm96-15') {
1011
+	print ' selected="selected"';
1012
+}
1013
+?>>EGM96 15' (2.1MB)</option>
1014
+					<option value="egm96-5"<?php if (isset($globalGeoidSource) && $globalGeoidSource == 'egm96-5') {
1015
+	print ' selected="selected"';
1016
+}
1017
+?>>EGM96 5' (19MB)</option>
1018
+					<option value="egm2008-5"<?php if (isset($globalGeoidSource) && $globalGeoidSource == 'egm2008-5') {
1019
+	print ' selected="selected"';
1020
+}
1021
+?>>EGM2008 5' (19MB)</option>
1022
+					<option value="egm2008-2_5"<?php if (isset($globalGeoidSource) && $globalGeoidSource == 'egm2008-2_5') {
1023
+	print ' selected="selected"';
1024
+}
1025
+?>>EGM2008 2.5' (75MB)</option>
1026
+					<option value="egm2008-1"<?php if (isset($globalGeoidSource) && $globalGeoidSource == 'egm2008-1') {
1027
+	print ' selected="selected"';
1028
+}
1029
+?>>EGM2008 1' (470MB)</option>
786 1030
 				</select>
787 1031
 				<p class="help-block">The geoid is approximated by an "earth gravity model" (EGM).</p>
788 1032
 			</p>
@@ -800,7 +1044,12 @@  discard block
 block discarded – undo
800 1044
 			</p>
801 1045
 			<p>
802 1046
 				<label for="archivemonths">Generate statistics, delete or put in archive flights older than xx months</label>
803
-				<input type="number" name="archivemonths" id="archivemonths" value="<?php if (isset($globalArchiveMonths)) print $globalArchiveMonths; else echo '1'; ?>" />
1047
+				<input type="number" name="archivemonths" id="archivemonths" value="<?php if (isset($globalArchiveMonths)) {
1048
+	print $globalArchiveMonths;
1049
+} else {
1050
+	echo '1';
1051
+}
1052
+?>" />
804 1053
 				<p class="help-block">0 to disable, delete old flight if <i>Archive all flights data</i> is disabled</p>
805 1054
 			</p>
806 1055
 			<p>
@@ -810,12 +1059,22 @@  discard block
 block discarded – undo
810 1059
 			</p>
811 1060
 			<p>
812 1061
 				<label for="archivekeepmonths">Keep flights data for xx months in archive</label>
813
-				<input type="number" name="archivekeepmonths" id="archivekeepmonths" value="<?php if (isset($globalArchiveKeepMonths)) print $globalArchiveKeepMonths; else echo '1'; ?>" />
1062
+				<input type="number" name="archivekeepmonths" id="archivekeepmonths" value="<?php if (isset($globalArchiveKeepMonths)) {
1063
+	print $globalArchiveKeepMonths;
1064
+} else {
1065
+	echo '1';
1066
+}
1067
+?>" />
814 1068
 				<p class="help-block">0 to disable</p>
815 1069
 			</p>
816 1070
 			<p>
817 1071
 				<label for="archivekeeptrackmonths">Keep flights track data for xx months in archive</label>
818
-				<input type="number" name="archivekeeptrackmonths" id="archivekeeptrackmonths" value="<?php if (isset($globalArchiveKeepTrackMonths)) print $globalArchiveKeepTrackMonths; else echo '1'; ?>" />
1072
+				<input type="number" name="archivekeeptrackmonths" id="archivekeeptrackmonths" value="<?php if (isset($globalArchiveKeepTrackMonths)) {
1073
+	print $globalArchiveKeepTrackMonths;
1074
+} else {
1075
+	echo '1';
1076
+}
1077
+?>" />
819 1078
 				<p class="help-block">0 to disable, should be less or egal to <i>Keep flights data</i> value</p>
820 1079
 			</p>
821 1080
 			<br />
@@ -825,7 +1084,12 @@  discard block
 block discarded – undo
825 1084
 				<p class="help-block">Uncheck if the script is running as cron job</p>
826 1085
 				<div id="cronends"> 
827 1086
 					<label for="cronend">Run script for xx seconds</label>
828
-					<input type="number" name="cronend" id="cronend" value="<?php if (isset($globalCronEnd)) print $globalCronEnd; else print '0'; ?>" />
1087
+					<input type="number" name="cronend" id="cronend" value="<?php if (isset($globalCronEnd)) {
1088
+	print $globalCronEnd;
1089
+} else {
1090
+	print '0';
1091
+}
1092
+?>" />
829 1093
 					<p class="help-block">Set to 0 to disable. Should be disabled if source is URL.</p>
830 1094
 				</div>
831 1095
 			</p>
@@ -878,15 +1142,30 @@  discard block
 block discarded – undo
878 1142
 			<br />
879 1143
 			<p>
880 1144
 				<label for="refresh">Show flights detected since xxx seconds</label>
881
-				<input type="number" name="refresh" id="refresh" value="<?php if (isset($globalLiveInterval)) echo $globalLiveInterval; else echo '200'; ?>" />
1145
+				<input type="number" name="refresh" id="refresh" value="<?php if (isset($globalLiveInterval)) {
1146
+	echo $globalLiveInterval;
1147
+} else {
1148
+	echo '200';
1149
+}
1150
+?>" />
882 1151
 			</p>
883 1152
 			<p>
884 1153
 				<label for="maprefresh">Live map refresh (in seconds)</label>
885
-				<input type="number" name="maprefresh" id="maprefresh" value="<?php if (isset($globalMapRefresh)) echo $globalMapRefresh; else echo '30'; ?>" />
1154
+				<input type="number" name="maprefresh" id="maprefresh" value="<?php if (isset($globalMapRefresh)) {
1155
+	echo $globalMapRefresh;
1156
+} else {
1157
+	echo '30';
1158
+}
1159
+?>" />
886 1160
 			</p>
887 1161
 			<p>
888 1162
 				<label for="mapidle">Map idle timeout (in minutes)</label>
889
-				<input type="number" name="mapidle" id="mapidle" value="<?php if (isset($globalMapIdleTimeout)) echo $globalMapIdleTimeout; else echo '30'; ?>" />
1163
+				<input type="number" name="mapidle" id="mapidle" value="<?php if (isset($globalMapIdleTimeout)) {
1164
+	echo $globalMapIdleTimeout;
1165
+} else {
1166
+	echo '30';
1167
+}
1168
+?>" />
890 1169
 				<p class="help-block">0 to disable</p>
891 1170
 			</p>
892 1171
 			<p>
@@ -901,12 +1180,20 @@  discard block
 block discarded – undo
901 1180
 			<br />
902 1181
 			<p>
903 1182
 				<label for="closestmindist">Distance to airport set as arrival (in km)</label>
904
-				<input type="number" name="closestmindist" id="closestmindist" value="<?php if (isset($globalClosestMinDist)) echo $globalClosestMinDist; else echo '50'; ?>" />
1183
+				<input type="number" name="closestmindist" id="closestmindist" value="<?php if (isset($globalClosestMinDist)) {
1184
+	echo $globalClosestMinDist;
1185
+} else {
1186
+	echo '50';
1187
+}
1188
+?>" />
905 1189
 			</p>
906 1190
 			<br />
907 1191
 			<p>
908 1192
 				<label for="aircraftsize">Size of aircraft icon on map (default to 30px if zoom > 7 else 15px), empty to default</label>
909
-				<input type="number" name="aircraftsize" id="aircraftsize" value="<?php if (isset($globalAircraftSize)) echo $globalAircraftSize;?>" />
1193
+				<input type="number" name="aircraftsize" id="aircraftsize" value="<?php if (isset($globalAircraftSize)) {
1194
+	echo $globalAircraftSize;
1195
+}
1196
+?>" />
910 1197
 			</p>
911 1198
 			<br />
912 1199
 			<p>
@@ -919,7 +1206,12 @@  discard block
 block discarded – undo
919 1206
 			    if (extension_loaded('gd') && function_exists('gd_info')) {
920 1207
 			?>
921 1208
 				<label for="aircrafticoncolor">Color of aircraft icon on map</label>
922
-				<input type="color" name="aircrafticoncolor" id="aircrafticoncolor" value="#<?php if (isset($globalAircraftIconColor)) echo $globalAircraftIconColor; else echo '1a3151'; ?>" />
1209
+				<input type="color" name="aircrafticoncolor" id="aircrafticoncolor" value="#<?php if (isset($globalAircraftIconColor)) {
1210
+	echo $globalAircraftIconColor;
1211
+} else {
1212
+	echo '1a3151';
1213
+}
1214
+?>" />
923 1215
 			<?php
924 1216
 				if (!is_writable('../cache')) {
925 1217
 			?>
@@ -937,14 +1229,27 @@  discard block
 block discarded – undo
937 1229
 			<p>
938 1230
 				<label for="airportzoom">Zoom level minimum to see airports icons</label>
939 1231
 				<div class="range">
940
-					<input type="range" name="airportzoom" id="airportzoom" value="<?php if (isset($globalAirportZoom)) echo $globalAirportZoom; else echo '7'; ?>" />
941
-					<output id="range"><?php if (isset($globalAirportZoom)) echo $globalAirportZoom; else echo '7'; ?></output>
1232
+					<input type="range" name="airportzoom" id="airportzoom" value="<?php if (isset($globalAirportZoom)) {
1233
+	echo $globalAirportZoom;
1234
+} else {
1235
+	echo '7';
1236
+}
1237
+?>" />
1238
+					<output id="range"><?php if (isset($globalAirportZoom)) {
1239
+	echo $globalAirportZoom;
1240
+} else {
1241
+	echo '7';
1242
+}
1243
+?></output>
942 1244
 				</div>
943 1245
 			</p>
944 1246
 			<br />
945 1247
 			<p>
946 1248
 				<label for="customcss">Custom CSS web path</label>
947
-				<input type="text" name="customcss" id="customcss" value="<?php if (isset($globalCustomCSS)) echo $globalCustomCSS; ?>" />
1249
+				<input type="text" name="customcss" id="customcss" value="<?php if (isset($globalCustomCSS)) {
1250
+	echo $globalCustomCSS;
1251
+}
1252
+?>" />
948 1253
 			</p>
949 1254
 		</fieldset>
950 1255
 		<input type="submit" name="submit" value="Create/Update database & write setup" />
@@ -971,8 +1276,12 @@  discard block
 block discarded – undo
971 1276
 	$dbhost = filter_input(INPUT_POST,'dbhost',FILTER_SANITIZE_STRING);
972 1277
 	$dbport = filter_input(INPUT_POST,'dbport',FILTER_SANITIZE_STRING);
973 1278
 
974
-	if ($dbtype == 'mysql' && !extension_loaded('pdo_mysql')) $error .= 'Mysql driver for PDO must be loaded';
975
-	if ($dbtype == 'pgsql' && !extension_loaded('pdo_pgsql')) $error .= 'PosgreSQL driver for PDO must be loaded';
1279
+	if ($dbtype == 'mysql' && !extension_loaded('pdo_mysql')) {
1280
+		$error .= 'Mysql driver for PDO must be loaded';
1281
+	}
1282
+	if ($dbtype == 'pgsql' && !extension_loaded('pdo_pgsql')) {
1283
+		$error .= 'PosgreSQL driver for PDO must be loaded';
1284
+	}
976 1285
 	
977 1286
 	$_SESSION['database_root'] = $dbroot;
978 1287
 	$_SESSION['database_rootpass'] = $dbrootpass;
@@ -1040,15 +1349,23 @@  discard block
 block discarded – undo
1040 1349
 	$source_city = $_POST['source_city'];
1041 1350
 	$source_country = $_POST['source_country'];
1042 1351
 	$source_ref = $_POST['source_ref'];
1043
-	if (isset($source_id)) $source_id = $_POST['source_id'];
1044
-	else $source_id = array();
1352
+	if (isset($source_id)) {
1353
+		$source_id = $_POST['source_id'];
1354
+	} else {
1355
+		$source_id = array();
1356
+	}
1045 1357
 	
1046 1358
 	$sources = array();
1047 1359
 	foreach ($source_name as $keys => $name) {
1048
-	    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]);
1049
-	    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]);
1360
+	    if (isset($source_id[$keys])) {
1361
+	    	$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]);
1362
+	    } else {
1363
+	    	$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]);
1364
+	    }
1365
+	}
1366
+	if (count($sources) > 0) {
1367
+		$_SESSION['sources'] = $sources;
1050 1368
 	}
1051
-	if (count($sources) > 0) $_SESSION['sources'] = $sources;
1052 1369
 
1053 1370
 	//$sbshost = filter_input(INPUT_POST,'sbshost',FILTER_SANITIZE_STRING);
1054 1371
 	//$sbsport = filter_input(INPUT_POST,'sbsport',FILTER_SANITIZE_NUMBER_INT);
@@ -1069,17 +1386,29 @@  discard block
 block discarded – undo
1069 1386
 	$datasource = filter_input(INPUT_POST,'datasource',FILTER_SANITIZE_STRING);
1070 1387
 
1071 1388
 	$globalaircraft = filter_input(INPUT_POST,'globalaircraft',FILTER_SANITIZE_STRING);
1072
-	if ($globalaircraft == 'aircraft') $settings = array_merge($settings,array('globalAircraft' => 'TRUE'));
1073
-	else $settings = array_merge($settings,array('globalAircraft' => 'FALSE'));
1389
+	if ($globalaircraft == 'aircraft') {
1390
+		$settings = array_merge($settings,array('globalAircraft' => 'TRUE'));
1391
+	} else {
1392
+		$settings = array_merge($settings,array('globalAircraft' => 'FALSE'));
1393
+	}
1074 1394
 	$globaltracker = filter_input(INPUT_POST,'globaltracker',FILTER_SANITIZE_STRING);
1075
-	if ($globaltracker == 'tracker') $settings = array_merge($settings,array('globalTracker' => 'TRUE'));
1076
-	else $settings = array_merge($settings,array('globalTracker' => 'FALSE'));
1395
+	if ($globaltracker == 'tracker') {
1396
+		$settings = array_merge($settings,array('globalTracker' => 'TRUE'));
1397
+	} else {
1398
+		$settings = array_merge($settings,array('globalTracker' => 'FALSE'));
1399
+	}
1077 1400
 	$globalmarine = filter_input(INPUT_POST,'globalmarine',FILTER_SANITIZE_STRING);
1078
-	if ($globalmarine == 'marine') $settings = array_merge($settings,array('globalMarine' => 'TRUE'));
1079
-	else $settings = array_merge($settings,array('globalMarine' => 'FALSE'));
1401
+	if ($globalmarine == 'marine') {
1402
+		$settings = array_merge($settings,array('globalMarine' => 'TRUE'));
1403
+	} else {
1404
+		$settings = array_merge($settings,array('globalMarine' => 'FALSE'));
1405
+	}
1080 1406
 	$globalsatellite = filter_input(INPUT_POST,'globalsatellite',FILTER_SANITIZE_STRING);
1081
-	if ($globalsatellite == 'satellite') $settings = array_merge($settings,array('globalSatellite' => 'TRUE'));
1082
-	else $settings = array_merge($settings,array('globalSatellite' => 'FALSE'));
1407
+	if ($globalsatellite == 'satellite') {
1408
+		$settings = array_merge($settings,array('globalSatellite' => 'TRUE'));
1409
+	} else {
1410
+		$settings = array_merge($settings,array('globalSatellite' => 'FALSE'));
1411
+	}
1083 1412
 
1084 1413
 /*	
1085 1414
 	$globalSBS1Hosts = array();
@@ -1101,23 +1430,37 @@  discard block
 block discarded – undo
1101 1430
 	$name = $_POST['name'];
1102 1431
 	$format = $_POST['format'];
1103 1432
 	$timezones = $_POST['timezones'];
1104
-	if (isset($_POST['sourcestats'])) $sourcestats = $_POST['sourcestats'];
1105
-	else $sourcestats = array();
1106
-	if (isset($_POST['noarchive'])) $noarchive = $_POST['noarchive'];
1107
-	else $noarchive = array();
1433
+	if (isset($_POST['sourcestats'])) {
1434
+		$sourcestats = $_POST['sourcestats'];
1435
+	} else {
1436
+		$sourcestats = array();
1437
+	}
1438
+	if (isset($_POST['noarchive'])) {
1439
+		$noarchive = $_POST['noarchive'];
1440
+	} else {
1441
+		$noarchive = array();
1442
+	}
1108 1443
 	$gSources = array();
1109 1444
 	$forcepilots = false;
1110 1445
 	foreach ($host as $key => $h) {
1111
-		if (isset($sourcestats[$key]) && $sourcestats[$key] == 1) $cov = 'TRUE';
1112
-		else $cov = 'FALSE';
1113
-		if (isset($noarchive[$key]) && $noarchive[$key] == 1) $arch = 'TRUE';
1114
-		else $arch = 'FALSE';
1446
+		if (isset($sourcestats[$key]) && $sourcestats[$key] == 1) {
1447
+			$cov = 'TRUE';
1448
+		} else {
1449
+			$cov = 'FALSE';
1450
+		}
1451
+		if (isset($noarchive[$key]) && $noarchive[$key] == 1) {
1452
+			$arch = 'TRUE';
1453
+		} else {
1454
+			$arch = 'FALSE';
1455
+		}
1115 1456
 		if (strpos($format[$key],'_callback')) {
1116 1457
 			$gSources[] = array('host' => $h, 'pass' => $port[$key],'name' => $name[$key],'format' => $format[$key],'sourcestats' => $cov,'noarchive' => $arch,'timezone' => $timezones[$key],'callback' => 'TRUE');
1117 1458
 		} elseif ($h != '' || $name[$key] != '') {
1118 1459
 			$gSources[] = array('host' => $h, 'port' => $port[$key],'name' => $name[$key],'format' => $format[$key],'sourcestats' => $cov,'noarchive' => $arch,'timezone' => $timezones[$key],'callback' => 'FALSE');
1119 1460
 		}
1120
-		if ($format[$key] == 'airwhere') $forcepilots = true;
1461
+		if ($format[$key] == 'airwhere') {
1462
+			$forcepilots = true;
1463
+		}
1121 1464
 	}
1122 1465
 	$settings = array_merge($settings,array('globalSources' => $gSources));
1123 1466
 
@@ -1148,7 +1491,9 @@  discard block
 block discarded – undo
1148 1491
 	$zoidistance = filter_input(INPUT_POST,'zoidistance',FILTER_SANITIZE_NUMBER_INT);
1149 1492
 	if ($zoilatitude != '' && $zoilongitude != '' && $zoidistance != '') {
1150 1493
 		$settings = array_merge($settings,array('globalDistanceIgnore' => array('latitude' => $zoilatitude,'longitude' => $zoilongitude,'distance' => $zoidistance)));
1151
-	} else $settings = array_merge($settings,array('globalDistanceIgnore' => array()));
1494
+	} else {
1495
+		$settings = array_merge($settings,array('globalDistanceIgnore' => array()));
1496
+	}
1152 1497
 
1153 1498
 	$refresh = filter_input(INPUT_POST,'refresh',FILTER_SANITIZE_NUMBER_INT);
1154 1499
 	$settings = array_merge($settings,array('globalLiveInterval' => $refresh));
@@ -1187,7 +1532,9 @@  discard block
 block discarded – undo
1187 1532
 
1188 1533
 	// Create in settings.php keys not yet configurable if not already here
1189 1534
 	//if (!isset($globalImageBingKey)) $settings = array_merge($settings,array('globalImageBingKey' => ''));
1190
-	if (!isset($globalDebug)) $settings = array_merge($settings,array('globalDebug' => 'TRUE'));
1535
+	if (!isset($globalDebug)) {
1536
+		$settings = array_merge($settings,array('globalDebug' => 'TRUE'));
1537
+	}
1191 1538
 
1192 1539
 	$resetyearstats = filter_input(INPUT_POST,'resetyearstats',FILTER_SANITIZE_STRING);
1193 1540
 	if ($resetyearstats == 'resetyearstats') {
@@ -1224,37 +1571,56 @@  discard block
 block discarded – undo
1224 1571
 	}
1225 1572
 */
1226 1573
 	$settings = array_merge($settings,array('globalFlightAware' => 'FALSE'));
1227
-	if ($globalsbs == 'sbs') $settings = array_merge($settings,array('globalSBS1' => 'TRUE'));
1228
-	else $settings = array_merge($settings,array('globalSBS1' => 'FALSE'));
1229
-	if ($globalaprs == 'aprs') $settings = array_merge($settings,array('globalAPRS' => 'TRUE'));
1230
-	else $settings = array_merge($settings,array('globalAPRS' => 'FALSE'));
1574
+	if ($globalsbs == 'sbs') {
1575
+		$settings = array_merge($settings,array('globalSBS1' => 'TRUE'));
1576
+	} else {
1577
+		$settings = array_merge($settings,array('globalSBS1' => 'FALSE'));
1578
+	}
1579
+	if ($globalaprs == 'aprs') {
1580
+		$settings = array_merge($settings,array('globalAPRS' => 'TRUE'));
1581
+	} else {
1582
+		$settings = array_merge($settings,array('globalAPRS' => 'FALSE'));
1583
+	}
1231 1584
 	$va = false;
1232 1585
 	if ($globalivao == 'ivao') {
1233 1586
 		$settings = array_merge($settings,array('globalIVAO' => 'TRUE'));
1234 1587
 		$va = true;
1235
-	} else $settings = array_merge($settings,array('globalIVAO' => 'FALSE'));
1588
+	} else {
1589
+		$settings = array_merge($settings,array('globalIVAO' => 'FALSE'));
1590
+	}
1236 1591
 	if ($globalvatsim == 'vatsim') {
1237 1592
 		$settings = array_merge($settings,array('globalVATSIM' => 'TRUE'));
1238 1593
 		$va = true;
1239
-	} else $settings = array_merge($settings,array('globalVATSIM' => 'FALSE'));
1594
+	} else {
1595
+		$settings = array_merge($settings,array('globalVATSIM' => 'FALSE'));
1596
+	}
1240 1597
 	if ($globalphpvms == 'phpvms') {
1241 1598
 		$settings = array_merge($settings,array('globalphpVMS' => 'TRUE'));
1242 1599
 		$va = true;
1243
-	} else $settings = array_merge($settings,array('globalphpVMS' => 'FALSE'));
1600
+	} else {
1601
+		$settings = array_merge($settings,array('globalphpVMS' => 'FALSE'));
1602
+	}
1244 1603
 	if ($globalvam == 'vam') {
1245 1604
 		$settings = array_merge($settings,array('globalVAM' => 'TRUE'));
1246 1605
 		$va = true;
1247
-	} else $settings = array_merge($settings,array('globalVAM' => 'FALSE'));
1606
+	} else {
1607
+		$settings = array_merge($settings,array('globalVAM' => 'FALSE'));
1608
+	}
1248 1609
 	if ($va) {
1249 1610
 		$settings = array_merge($settings,array('globalSchedulesFetch' => 'FALSE','globalTranslationFetch' => 'FALSE'));
1250
-	} else $settings = array_merge($settings,array('globalSchedulesFetch' => 'TRUE','globalTranslationFetch' => 'TRUE'));
1611
+	} else {
1612
+		$settings = array_merge($settings,array('globalSchedulesFetch' => 'TRUE','globalTranslationFetch' => 'TRUE'));
1613
+	}
1251 1614
 	if ($globalva == 'va' || $va) {
1252 1615
 		$settings = array_merge($settings,array('globalVA' => 'TRUE'));
1253 1616
 		$settings = array_merge($settings,array('globalUsePilot' => 'TRUE','globalUseOwner' => 'FALSE'));
1254 1617
 	} else {
1255 1618
 		$settings = array_merge($settings,array('globalVA' => 'FALSE'));
1256
-		if ($forcepilots) $settings = array_merge($settings,array('globalUsePilot' => 'TRUE','globalUseOwner' => 'FALSE'));
1257
-		else $settings = array_merge($settings,array('globalUsePilot' => 'FALSE','globalUseOwner' => 'TRUE'));
1619
+		if ($forcepilots) {
1620
+			$settings = array_merge($settings,array('globalUsePilot' => 'TRUE','globalUseOwner' => 'FALSE'));
1621
+		} else {
1622
+			$settings = array_merge($settings,array('globalUsePilot' => 'FALSE','globalUseOwner' => 'TRUE'));
1623
+		}
1258 1624
 	}
1259 1625
 	
1260 1626
 	
@@ -1430,7 +1796,9 @@  discard block
 block discarded – undo
1430 1796
 		$settings = array_merge($settings,array('globalNoAirlines' => 'FALSE'));
1431 1797
 	}
1432 1798
 
1433
-	if (!isset($globalTransaction)) $settings = array_merge($settings,array('globalTransaction' => 'TRUE'));
1799
+	if (!isset($globalTransaction)) {
1800
+		$settings = array_merge($settings,array('globalTransaction' => 'TRUE'));
1801
+	}
1434 1802
 
1435 1803
 	// Set some defaults values...
1436 1804
 	if (!isset($globalAircraftImageSources)) {
@@ -1445,15 +1813,23 @@  discard block
 block discarded – undo
1445 1813
 
1446 1814
 	$settings = array_merge($settings,array('globalInstalled' => 'TRUE'));
1447 1815
 
1448
-	if ($error == '') settings::modify_settings($settings);
1449
-	if ($error == '') settings::comment_settings($settings_comment);
1816
+	if ($error == '') {
1817
+		settings::modify_settings($settings);
1818
+	}
1819
+	if ($error == '') {
1820
+		settings::comment_settings($settings_comment);
1821
+	}
1450 1822
 	if ($error != '') {
1451 1823
 		print '<div class="info column">'.$error.'</div>';
1452 1824
 		require('../footer.php');
1453 1825
 		exit;
1454 1826
 	} else {
1455
-		if (isset($_POST['waypoints']) && $_POST['waypoints'] == 'waypoints') $_SESSION['waypoints'] = 1;
1456
-		if (isset($_POST['owner']) && $_POST['owner'] == 'owner') $_SESSION['owner'] = 1;
1827
+		if (isset($_POST['waypoints']) && $_POST['waypoints'] == 'waypoints') {
1828
+			$_SESSION['waypoints'] = 1;
1829
+		}
1830
+		if (isset($_POST['owner']) && $_POST['owner'] == 'owner') {
1831
+			$_SESSION['owner'] = 1;
1832
+		}
1457 1833
 		if (isset($_POST['createdb'])) {
1458 1834
 			$_SESSION['install'] = 'database_create';
1459 1835
 		} else {
@@ -1490,10 +1866,18 @@  discard block
 block discarded – undo
1490 1866
 	$popw = false;
1491 1867
 	foreach ($_SESSION['done'] as $done) {
1492 1868
 	    print '<li>'.$done.'....<strong>SUCCESS</strong></li>';
1493
-	    if ($done == 'Create database') $pop = true;
1494
-	    if ($_SESSION['install'] == 'database_create') $pop = true;
1495
-	    if ($_SESSION['install'] == 'database_import') $popi = true;
1496
-	    if ($_SESSION['install'] == 'waypoints') $popw = true;
1869
+	    if ($done == 'Create database') {
1870
+	    	$pop = true;
1871
+	    }
1872
+	    if ($_SESSION['install'] == 'database_create') {
1873
+	    	$pop = true;
1874
+	    }
1875
+	    if ($_SESSION['install'] == 'database_import') {
1876
+	    	$popi = true;
1877
+	    }
1878
+	    if ($_SESSION['install'] == 'waypoints') {
1879
+	    	$popw = true;
1880
+	    }
1497 1881
 	}
1498 1882
 	if ($pop) {
1499 1883
 	    sleep(5);
@@ -1504,7 +1888,9 @@  discard block
 block discarded – undo
1504 1888
 	} else if ($popw) {
1505 1889
 	    sleep(5);
1506 1890
 	    print '<li>Populate waypoints database....<img src="../images/loading.gif" /></li>';
1507
-	} else print '<li>Update schema if needed....<img src="../images/loading.gif" /></li>';
1891
+	} else {
1892
+		print '<li>Update schema if needed....<img src="../images/loading.gif" /></li>';
1893
+	}
1508 1894
 	print '</div></ul>';
1509 1895
 	print '<div id="error"></div>';
1510 1896
 /*	foreach ($_SESSION['done'] as $done) {
Please login to merge, or discard this patch.