Completed
Push — master ( 46434e...ad133e )
by Yannick
32:08 queued 16:03
created
scripts/update_db.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -12,10 +12,10 @@
 block discarded – undo
12 12
 }
13 13
 // Check if script is not already running... (dirty)
14 14
 if (strtoupper(substr(PHP_OS, 0, 3)) != 'WIN' && (!isset($globalDisableUpdateCheck) || $globalDisableUpdateCheck === FALSE)) {
15
-	if(function_exists('exec')) {
15
+	if (function_exists('exec')) {
16 16
 		exec("ps ux", $output, $result);
17 17
 		$j = 0;
18
-		foreach ($output as $line) if(strpos($line, dirname(__FILE__)."/update_db.php") && !strpos($line, "sh ") && !strpos($line, "sudo ")) $j++;
18
+		foreach ($output as $line) if (strpos($line, dirname(__FILE__)."/update_db.php") && !strpos($line, "sh ") && !strpos($line, "sudo ")) $j++;
19 19
 		if ($j > 1) {
20 20
 			echo "Script is already runnning...";
21 21
 			die();
Please login to merge, or discard this patch.
Braces   +33 added lines, -12 removed lines patch added patch discarded remove patch
@@ -15,7 +15,9 @@  discard block
 block discarded – undo
15 15
 	if(function_exists('exec')) {
16 16
 		exec("ps ux", $output, $result);
17 17
 		$j = 0;
18
-		foreach ($output as $line) if(strpos($line, dirname(__FILE__)."/update_db.php") && !strpos($line, "sh ") && !strpos($line, "sudo ")) $j++;
18
+		foreach ($output as $line) {
19
+			if(strpos($line, dirname(__FILE__)."/update_db.php") && !strpos($line, "sh ") && !strpos($line, "sudo ")) $j++;
20
+		}
19 21
 		if ($j > 1) {
20 22
 			echo "Script is already runnning...";
21 23
 			die();
@@ -25,7 +27,9 @@  discard block
 block discarded – undo
25 27
 require(dirname(__FILE__).'/../install/class.update_db.php');
26 28
 $update_db = new update_db();
27 29
 
28
-if ($update_db->check() === false) die();
30
+if ($update_db->check() === false) {
31
+	die();
32
+}
29 33
 
30 34
 if ((!isset($globalMasterServer) || !$globalMasterServer) && (!isset($globalOffline) || $globalOffline === FALSE)) {
31 35
 	if (isset($globalNOTAM) && $globalNOTAM && $update_db->check_last_notam_update()) {
@@ -36,14 +40,18 @@  discard block
 block discarded – undo
36 40
 			$update_db->update_notam();
37 41
 		}
38 42
 		$update_db->insert_last_notam_update();
39
-	} elseif (isset($globalDebug) && $globalDebug && isset($globalNOTAM) && $globalNOTAM) echo "NOTAM are only updated once a day.\n";
43
+	} elseif (isset($globalDebug) && $globalDebug && isset($globalNOTAM) && $globalNOTAM) {
44
+		echo "NOTAM are only updated once a day.\n";
45
+	}
40 46
 	if ((!isset($globalAircraft) || (isset($globalAircraft) && $globalAircraft)) && ($update_db->check_last_update() && (!isset($globalVA) || !$globalVA) && (!isset($globalIVAO) || !$globalIVAO) && (!isset($globalVATSIM) || !$globalVATSIM) && (!isset($globalphpVMS) || !$globalphpVMS))) {
41 47
 		$update_db->update_all();
42 48
 	//	require_once(dirname(__FILE__).'/../require/class.Spotter.php');
43 49
 	//	$Spotter = new Spotter();
44 50
 	//	$Spotter->updateFieldsFromOtherTables();
45 51
 		$update_db->insert_last_update();
46
-	} elseif (isset($globalDebug) && $globalDebug && (!isset($globalVA) || !$globalVA) && (!isset($globalphpVMS) || !$globalphpVMS) && (!isset($globalIVAO) || !$globalIVAO) && (!isset($globalVATSIM) || !$globalVATSIM)) echo "DB are populated with external data only every 15 days ! Files are not updated more often.\n";
52
+	} elseif (isset($globalDebug) && $globalDebug && (!isset($globalVA) || !$globalVA) && (!isset($globalphpVMS) || !$globalphpVMS) && (!isset($globalIVAO) || !$globalIVAO) && (!isset($globalVATSIM) || !$globalVATSIM)) {
53
+		echo "DB are populated with external data only every 15 days ! Files are not updated more often.\n";
54
+	}
47 55
 	if (isset($globalWaypoints) && $globalWaypoints && $update_db->check_last_airspace_update()) {
48 56
 		echo "Check if new airspace version exist...";
49 57
 		echo $update_db->update_airspace_fam();
@@ -52,8 +60,11 @@  discard block
 block discarded – undo
52 60
 	if (isset($globalGeoid) && $globalGeoid && $update_db->check_last_geoid_update()) {
53 61
 		echo "Check if new geoid version exist...";
54 62
 		$error = $update_db->update_geoid_fam();
55
-		if ($error == '') $update_db->insert_last_geoid_update();
56
-		else echo $error;
63
+		if ($error == '') {
64
+			$update_db->insert_last_geoid_update();
65
+		} else {
66
+			echo $error;
67
+		}
57 68
 	}
58 69
 	if (isset($globalMarine) && $globalMarine && (!isset($globalVM) || $globalVM === FALSE) && $update_db->check_last_marine_identity_update()) {
59 70
 		echo "Check if new marine identity version exist...";
@@ -71,13 +82,17 @@  discard block
 block discarded – undo
71 82
 			//echo "Done";
72 83
 		}
73 84
 		$update_db->insert_last_owner_update();
74
-	} elseif (isset($globalDebug) && $globalDebug && (!isset($globalVA) || !$globalVA) && (!isset($globalIVAO) || !$globalIVAO) && (!isset($globalVATSIM) || !$globalVATSIM) && (!isset($globalphpVMS) || !$globalphpVMS)) echo "Owner are only updated every 15 days.\n";
85
+	} elseif (isset($globalDebug) && $globalDebug && (!isset($globalVA) || !$globalVA) && (!isset($globalIVAO) || !$globalIVAO) && (!isset($globalVATSIM) || !$globalVATSIM) && (!isset($globalphpVMS) || !$globalphpVMS)) {
86
+		echo "Owner are only updated every 15 days.\n";
87
+	}
75 88
 
76 89
 	if ((!isset($globalAircraft) || (isset($globalAircraft) && $globalAircraft)) && ($update_db->check_last_airlines_update() && (!isset($globalVA) || !$globalVA) && (!isset($globalIVAO) || !$globalIVAO) && (!isset($globalVATSIM) || !$globalVATSIM) && (!isset($globalphpVMS) || !$globalphpVMS))) {
77 90
 		echo "Updating airlines...\n";
78 91
 		echo $update_db->update_airlines_fam();
79 92
 		$update_db->insert_last_airlines_update();
80
-	} elseif (isset($globalDebug) && $globalDebug && (!isset($globalVA) || !$globalVA) && (!isset($globalIVAO) || !$globalIVAO) && (!isset($globalVATSIM) || !$globalVATSIM) && (!isset($globalphpVMS) || !$globalphpVMS)) echo "Airlines are only updated every 15 days.\n";
93
+	} elseif (isset($globalDebug) && $globalDebug && (!isset($globalVA) || !$globalVA) && (!isset($globalIVAO) || !$globalIVAO) && (!isset($globalVATSIM) || !$globalVATSIM) && (!isset($globalphpVMS) || !$globalphpVMS)) {
94
+		echo "Airlines are only updated every 15 days.\n";
95
+	}
81 96
 
82 97
 	if ((!isset($globalAircraft) || (isset($globalAircraft) && $globalAircraft)) && (isset($globalAccidents) && $globalAccidents && (!isset($globalVA) || !$globalVA) && (!isset($globalIVAO) || !$globalIVAO) && (!isset($globalVATSIM) || !$globalVATSIM) && (!isset($globalphpVMS) || !$globalphpVMS))) {
83 98
 		require_once(dirname(__FILE__).'/../require/class.Accident.php');
@@ -86,7 +101,9 @@  discard block
 block discarded – undo
86 101
 		if ($Accident->check_last_accidents_update()) {
87 102
 			$Accident->download_update();
88 103
 			$Accident->insert_last_accidents_update();
89
-		} else echo "Accidents are updated once a day.\n";
104
+		} else {
105
+			echo "Accidents are updated once a day.\n";
106
+		}
90 107
 	}
91 108
   
92 109
 }
@@ -99,7 +116,9 @@  discard block
 block discarded – undo
99 116
 		if ($METAR->check_last_update()) {
100 117
 			$METAR->addMETARCycle();
101 118
 			$METAR->insert_last_update();
102
-		} else echo "METAR are only updated every 30 minutes.\n";
119
+		} else {
120
+			echo "METAR are only updated every 30 minutes.\n";
121
+		}
103 122
 	}
104 123
 
105 124
 	if ((!isset($globalAircraft) || (isset($globalAircraft) && $globalAircraft)) && (isset($globalSchedules) && $globalSchedules && $update_db->check_last_schedules_update() && (!isset($globalVA) || !$globalVA) && (!isset($globalIVAO) || !$globalIVAO) && (!isset($globalVATSIM) || !$globalVATSIM) && (!isset($globalphpVMS) || !$globalphpVMS))) {
@@ -107,8 +126,10 @@  discard block
 block discarded – undo
107 126
 		//$update_db->update_oneworld();
108 127
 		$update_db->update_skyteam();
109 128
 		$update_db->insert_last_schedules_update();
110
-	} elseif (isset($globalDebug) && $globalDebug && isset($globalOwner) && $globalOwner && (!isset($globalVA) || !$globalVA) && (!isset($globalIVAO) || !$globalIVAO) && (!isset($globalVATSIM) || !$globalVATSIM) && (!isset($globalphpVMS) || !$globalphpVMS)) echo "Schedules are only updated every 15 days.\n";
111
-}
129
+	} elseif (isset($globalDebug) && $globalDebug && isset($globalOwner) && $globalOwner && (!isset($globalVA) || !$globalVA) && (!isset($globalIVAO) || !$globalIVAO) && (!isset($globalVATSIM) || !$globalVATSIM) && (!isset($globalphpVMS) || !$globalphpVMS)) {
130
+		echo "Schedules are only updated every 15 days.\n";
131
+	}
132
+	}
112 133
 
113 134
 if (isset($globalArchiveMonths) && $globalArchiveMonths > 0) {
114 135
 	echo "Updating statistics and archive old data...\n";
Please login to merge, or discard this patch.
js/map.2d.js.php 3 patches
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -1,7 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 require_once('../require/settings.php');
3 3
 require_once('../require/class.Language.php'); 
4
-setcookie("MapFormat",'2d');
4
+setcookie("MapFormat", '2d');
5 5
 ?>
6 6
 /**
7 7
  * This javascript is part of FlightAirmap.
@@ -108,16 +108,16 @@  discard block
 block discarded – undo
108 108
 <?php
109 109
 	}
110 110
 	if (isset($_GET['ident'])) {
111
-		$ident = filter_input(INPUT_GET,'ident',FILTER_SANITIZE_STRING);
111
+		$ident = filter_input(INPUT_GET, 'ident', FILTER_SANITIZE_STRING);
112 112
 	}
113 113
 	if (isset($_GET['flightaware_id'])) {
114
-		$flightaware_id = filter_input(INPUT_GET,'flightaware_id',FILTER_SANITIZE_STRING);
114
+		$flightaware_id = filter_input(INPUT_GET, 'flightaware_id', FILTER_SANITIZE_STRING);
115 115
 	}
116 116
 	if (isset($_GET['latitude'])) {
117
-		$latitude = filter_input(INPUT_GET,'latitude',FILTER_SANITIZE_STRING);
117
+		$latitude = filter_input(INPUT_GET, 'latitude', FILTER_SANITIZE_STRING);
118 118
 	}
119 119
 	if (isset($_GET['longitude'])) {
120
-		$longitude = filter_input(INPUT_GET,'longitude',FILTER_SANITIZE_STRING);
120
+		$longitude = filter_input(INPUT_GET, 'longitude', FILTER_SANITIZE_STRING);
121 121
 	}
122 122
 ?>
123 123
 
@@ -145,7 +145,7 @@  discard block
 block discarded – undo
145 145
 	} else {
146 146
 		if ((isset($globalCenterLatitude) && $globalCenterLatitude != '' && isset($globalCenterLongitude) && $globalCenterLongitude != '') || isset($_COOKIE['lastcentercoord'])) {
147 147
 			if (isset($_COOKIE['lastcentercoord'])) {
148
-				$lastcentercoord = explode(',',$_COOKIE['lastcentercoord']);
148
+				$lastcentercoord = explode(',', $_COOKIE['lastcentercoord']);
149 149
 				$viewcenterlatitude = $lastcentercoord[0];
150 150
 				$viewcenterlongitude = $lastcentercoord[1];
151 151
 				$viewzoom = $lastcentercoord[2];
@@ -166,7 +166,7 @@  discard block
 block discarded – undo
166 166
 	     || navigator.userAgent.match(/BlackBerry/i)
167 167
 	     || navigator.userAgent.match(/Windows Phone/i))
168 168
 	{
169
-		var zoom = <?php if (isset($viewzoom) && $viewzoom == $globalLiveZoom) print $viewzoom-1; elseif (isset($viewzoom)) print $viewzoom; else print '8'; ?>;
169
+		var zoom = <?php if (isset($viewzoom) && $viewzoom == $globalLiveZoom) print $viewzoom - 1; elseif (isset($viewzoom)) print $viewzoom; else print '8'; ?>;
170 170
 	} else {
171 171
 		var zoom = <?php if (isset($viewzoom)) print $viewzoom; else print '9'; ?>;
172 172
 	}
@@ -310,19 +310,19 @@  discard block
 block discarded – undo
310 310
 	map.addLayer(yandexLayer);
311 311
 <?php
312 312
 	} elseif ($MapType == 'Bing-Aerial') {
313
-		if (!isset($globalBingMapKey) || $globalBingMapKey == '') setcookie('MapType','OpenStreetMap');
313
+		if (!isset($globalBingMapKey) || $globalBingMapKey == '') setcookie('MapType', 'OpenStreetMap');
314 314
 ?>
315 315
 	var bingLayer = new L.tileLayer.bing({bingMapsKey: '<?php print $globalBingMapKey; ?>',imagerySet: 'Aerial'});
316 316
 	map.addLayer(bingLayer);
317 317
 <?php
318 318
 	} elseif ($MapType == 'Bing-Hybrid') {
319
-		if (!isset($globalBingMapKey) || $globalBingMapKey == '') setcookie('MapType','OpenStreetMap');
319
+		if (!isset($globalBingMapKey) || $globalBingMapKey == '') setcookie('MapType', 'OpenStreetMap');
320 320
 ?>
321 321
 	var bingLayer = new L.tileLayer.bing({bingMapsKey: '<?php print $globalBingMapKey; ?>',imagerySet: 'AerialWithLabels'});
322 322
 	map.addLayer(bingLayer);
323 323
 <?php
324 324
 	} elseif ($MapType == 'Bing-Road') {
325
-		if (!isset($globalBingMapKey) || $globalBingMapKey == '') setcookie('MapType','OpenStreetMap');
325
+		if (!isset($globalBingMapKey) || $globalBingMapKey == '') setcookie('MapType', 'OpenStreetMap');
326 326
 ?>
327 327
 	var bingLayer = new L.tileLayer.bing({bingMapsKey: '<?php print $globalBingMapKey; ?>',imagerySet: 'Road'});
328 328
 	map.addLayer(bingLayer);
@@ -460,7 +460,7 @@  discard block
 block discarded – undo
460 460
 
461 461
 	function update_tsk() {
462 462
 		var bbox = map.getBounds().toBBoxString();
463
-		var tskLayerQuery = $.getJSON("<?php print $globalURL; ?>/tsk-geojson.php?tsk=<?php echo filter_input(INPUT_GET,'tsk',FILTER_SANITIZE_URL); ?>",function (data) {
463
+		var tskLayerQuery = $.getJSON("<?php print $globalURL; ?>/tsk-geojson.php?tsk=<?php echo filter_input(INPUT_GET, 'tsk', FILTER_SANITIZE_URL); ?>",function (data) {
464 464
 		    tskLayer = L.geoJson(data,{
465 465
 			onEachFeature: function (feature, layer) {
466 466
 			    tskPopup(feature, layer);
Please login to merge, or discard this patch.
Indentation   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -448,7 +448,7 @@  discard block
 block discarded – undo
448 448
 	};
449 449
 
450 450
 <?php
451
-    if (isset($globalTSK) && $globalTSK && isset($_GET['tsk'])) {
451
+	if (isset($globalTSK) && $globalTSK && isset($_GET['tsk'])) {
452 452
 ?>
453 453
 	function tskPopup (feature, layer) {
454 454
 		var output = '';
@@ -483,7 +483,7 @@  discard block
 block discarded – undo
483 483
 	};
484 484
 	update_tsk();
485 485
 <?php
486
-    }
486
+	}
487 487
 ?>
488 488
 	map.on('moveend', function() {
489 489
 		if (map.hasLayer(locationsLayer) == true) {
@@ -504,10 +504,10 @@  discard block
 block discarded – undo
504 504
 		update_santaLayer(false);
505 505
 	}
506 506
 <?php
507
-    // Add support for custom json via $globalMapJson
508
-    if (isset($globalMapJson) && is_array($globalMapJson)) {
507
+	// Add support for custom json via $globalMapJson
508
+	if (isset($globalMapJson) && is_array($globalMapJson)) {
509 509
 	foreach ($globalMapJson as $json) {
510
-	    if (isset($json['url'])) {
510
+		if (isset($json['url'])) {
511 511
 ?>
512 512
 update_genLayer('<?php print $json['url']; ?>');
513 513
 <?php
@@ -516,9 +516,9 @@  discard block
 block discarded – undo
516 516
 setInterval(function(){if (noTimeout) update_genLayer('<?php print $json['url']; ?>')}, <?php print $json['refresh']; ?>);
517 517
 <?php
518 518
 		}
519
-	    }
519
+		}
520
+	}
520 521
 	}
521
-    }
522 522
 
523 523
 ?>
524 524
 //adds the bootstrap tooltip to the map icons
Please login to merge, or discard this patch.
Braces   +134 added lines, -30 removed lines patch added patch discarded remove patch
@@ -13,10 +13,15 @@  discard block
 block discarded – undo
13 13
 "use strict";
14 14
 <?php
15 15
 
16
-if (!isset($globalOpenWeatherMapKey)) $globalOpenWeatherMapKey = '';
16
+if (!isset($globalOpenWeatherMapKey)) {
17
+	$globalOpenWeatherMapKey = '';
18
+}
17 19
 // Compressed GeoJson is used if true
18
-if (!isset($globalJsonCompress)) $compress = true;
19
-else $compress = $globalJsonCompress;
20
+if (!isset($globalJsonCompress)) {
21
+	$compress = true;
22
+} else {
23
+	$compress = $globalJsonCompress;
24
+}
20 25
 
21 26
 /*
22 27
 if (isset($_COOKIE['archive_begin']) && $_COOKIE['archive_begin'] != '') {
@@ -142,7 +147,17 @@  discard block
 block discarded – undo
142 147
 	}
143 148
 
144 149
 	//create the map
145
-	map = L.map('archive-map', { zoomControl:false }).setView([<?php if (isset($latitude)) print $latitude; else print $globalCenterLatitude; ?>,<?php if (isset($longitude)) print $longitude; else print $globalCenterLongitude; ?>], zoom);
150
+	map = L.map('archive-map', { zoomControl:false }).setView([<?php if (isset($latitude)) {
151
+	print $latitude;
152
+} else {
153
+	print $globalCenterLatitude;
154
+}
155
+?>,<?php if (isset($longitude)) {
156
+	print $longitude;
157
+} else {
158
+	print $globalCenterLongitude;
159
+}
160
+?>], zoom);
146 161
 <?php
147 162
 	} else {
148 163
 		if ((isset($globalCenterLatitude) && $globalCenterLatitude != '' && isset($globalCenterLongitude) && $globalCenterLongitude != '') || isset($_COOKIE['lastcentercoord'])) {
@@ -168,9 +183,21 @@  discard block
 block discarded – undo
168 183
 	     || navigator.userAgent.match(/BlackBerry/i)
169 184
 	     || navigator.userAgent.match(/Windows Phone/i))
170 185
 	{
171
-		var zoom = <?php if (isset($viewzoom) && $viewzoom == $globalLiveZoom) print $viewzoom-1; elseif (isset($viewzoom)) print $viewzoom; else print '8'; ?>;
186
+		var zoom = <?php if (isset($viewzoom) && $viewzoom == $globalLiveZoom) {
187
+	print $viewzoom-1;
188
+} elseif (isset($viewzoom)) {
189
+	print $viewzoom;
190
+} else {
191
+	print '8';
192
+}
193
+?>;
172 194
 	} else {
173
-		var zoom = <?php if (isset($viewzoom)) print $viewzoom; else print '9'; ?>;
195
+		var zoom = <?php if (isset($viewzoom)) {
196
+	print $viewzoom;
197
+} else {
198
+	print '9';
199
+}
200
+?>;
174 201
 	}
175 202
 
176 203
 	//create the map
@@ -196,16 +223,27 @@  discard block
 block discarded – undo
196 223
 	var bounds = L.latLngBounds(southWest,northEast);
197 224
 	//a few title layers
198 225
 <?php
199
-	if (isset($_COOKIE['MapType'])) $MapType = $_COOKIE['MapType'];
200
-	else $MapType = $globalMapProvider;
226
+	if (isset($_COOKIE['MapType'])) {
227
+		$MapType = $_COOKIE['MapType'];
228
+	} else {
229
+		$MapType = $globalMapProvider;
230
+	}
201 231
 
202 232
 	if ($MapType == 'Mapbox') {
203
-		if ($_COOKIE['MapTypeId'] == 'default') $MapBoxId = $globalMapboxId;
204
-		else $MapBoxId = $_COOKIE['MapTypeId'];
205
-?>
233
+		if ($_COOKIE['MapTypeId'] == 'default') {
234
+			$MapBoxId = $globalMapboxId;
235
+		} else {
236
+			$MapBoxId = $_COOKIE['MapTypeId'];
237
+		}
238
+		?>
206 239
 	L.tileLayer('https://{s}.tiles.mapbox.com/v4/{id}/{z}/{x}/{y}.png?access_token={token}', {
207 240
 	    maxZoom: 18,
208
-	    noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) print 'false'; else print 'true'; ?>,
241
+	    noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) {
242
+	print 'false';
243
+} else {
244
+	print 'true';
245
+}
246
+?>,
209 247
 	    attribution: '© <a href="https://www.mapbox.com/about/maps/">Mapbox</a> © <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a> <strong><a href="https://www.mapbox.com/map-feedback/" target="_blank">Improve this map</a></strong>',
210 248
 	    id: '<?php print $MapBoxId; ?>',
211 249
 	    token: '<?php print $globalMapboxToken; ?>'
@@ -224,7 +262,12 @@  discard block
 block discarded – undo
224 262
 ?>
225 263
 	L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
226 264
 	    maxZoom: 18,
227
-	    noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) print 'false'; else print 'true'; ?>,
265
+	    noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) {
266
+	print 'false';
267
+} else {
268
+	print 'true';
269
+}
270
+?>,
228 271
 	    attribution: 'Map data &copy; <a href="http://openstreetmap.org">OpenStreetMap</a> contributors, ' +
229 272
 	      '<a href="www.openstreetmap.org/copyright">Open Database Licence</a>'
230 273
 	}).addTo(map);
@@ -233,7 +276,12 @@  discard block
 block discarded – undo
233 276
 ?>
234 277
 	L.tileLayer('https://tiles.openseamap.org/seamark/{z}/{x}/{y}.png', {
235 278
 	    maxZoom: 18,
236
-	    noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) print 'false'; else print 'true'; ?>,
279
+	    noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) {
280
+	print 'false';
281
+} else {
282
+	print 'true';
283
+}
284
+?>,
237 285
 	    attribution: 'Map data &copy; <a href="http://openstreetmap.org">OpenStreetMap</a> contributors, ' +
238 286
 		'&copy; <a href="http://openseamap.org">OpenSeaMap</a> contributors, ' +
239 287
 	      '<a href="www.openstreetmap.org/copyright">Open Database Licence</a>'
@@ -243,7 +291,12 @@  discard block
 block discarded – undo
243 291
 ?>
244 292
 	L.tileLayer('https://server.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer/tile/{z}/{y}/{x}', {
245 293
 	    maxZoom: 18,
246
-	    noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) print 'false'; else print 'true'; ?>,
294
+	    noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) {
295
+	print 'false';
296
+} else {
297
+	print 'true';
298
+}
299
+?>,
247 300
 	    attribution: 'Tiles &copy; Esri &mdash; Sources: Esri, DeLorme, NAVTEQ, USGS, Intermap, iPC, NRCAN, Esri Japan, METI, Esri China (Hong Kong), Esri (Thailand), TomTom, 2012'
248 301
 	}).addTo(map);
249 302
 <?php
@@ -251,7 +304,12 @@  discard block
 block discarded – undo
251 304
 ?>
252 305
 	L.tileLayer('https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}', {
253 306
 	    maxZoom: 18,
254
-	    noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) print 'false'; else print 'true'; ?>,
307
+	    noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) {
308
+	print 'false';
309
+} else {
310
+	print 'true';
311
+}
312
+?>,
255 313
 	    attribution: 'Tiles &copy; Esri &mdash; Sources: Esri, i-cubed, USDA, USGS, AEX, GeoEye, Getmapping, Aerogrid, IGN, IGP, UPR-EGP, and the GIS User Community'
256 314
 	}).addTo(map);
257 315
 <?php
@@ -259,7 +317,12 @@  discard block
 block discarded – undo
259 317
 ?>
260 318
 	L.tileLayer('https://server.arcgisonline.com/ArcGIS/rest/services/Ocean_Basemap/MapServer/tile/{z}/{y}/{x}', {
261 319
 	    maxZoom: 18,
262
-	    noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) print 'false'; else print 'true'; ?>,
320
+	    noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) {
321
+	print 'false';
322
+} else {
323
+	print 'true';
324
+}
325
+?>,
263 326
 	    attribution: 'Tiles &copy; Esri &mdash; Sources: GEBCO, NOAA, CHS, OSU, UNH, CSUMB, National Geographic, DeLorme, NAVTEQ, and Esri'
264 327
 	}).addTo(map);
265 328
 <?php
@@ -267,7 +330,12 @@  discard block
 block discarded – undo
267 330
 ?>
268 331
 	L.tileLayer('https://server.arcgisonline.com/ArcGIS/rest/services/NatGeo_World_Map/MapServer/tile/{z}/{y}/{x}', {
269 332
 	    maxZoom: 18,
270
-	    noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) print 'false'; else print 'true'; ?>,
333
+	    noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) {
334
+	print 'false';
335
+} else {
336
+	print 'true';
337
+}
338
+?>,
271 339
 	    attribution: 'Tiles &copy; Esri &mdash; Sources: National Geographic, Esri, DeLorme, NAVTEQ, UNEP-WCMC, USGS, NASA, ESA, METI, NRCAN, GEBCO, NOAA, iPC'
272 340
 	}).addTo(map);
273 341
 <?php
@@ -312,20 +380,26 @@  discard block
 block discarded – undo
312 380
 	map.addLayer(yandexLayer);
313 381
 <?php
314 382
 	} elseif ($MapType == 'Bing-Aerial') {
315
-		if (!isset($globalBingMapKey) || $globalBingMapKey == '') setcookie('MapType','OpenStreetMap');
316
-?>
383
+		if (!isset($globalBingMapKey) || $globalBingMapKey == '') {
384
+			setcookie('MapType','OpenStreetMap');
385
+		}
386
+		?>
317 387
 	var bingLayer = new L.tileLayer.bing({bingMapsKey: '<?php print $globalBingMapKey; ?>',imagerySet: 'Aerial'});
318 388
 	map.addLayer(bingLayer);
319 389
 <?php
320 390
 	} elseif ($MapType == 'Bing-Hybrid') {
321
-		if (!isset($globalBingMapKey) || $globalBingMapKey == '') setcookie('MapType','OpenStreetMap');
322
-?>
391
+		if (!isset($globalBingMapKey) || $globalBingMapKey == '') {
392
+			setcookie('MapType','OpenStreetMap');
393
+		}
394
+		?>
323 395
 	var bingLayer = new L.tileLayer.bing({bingMapsKey: '<?php print $globalBingMapKey; ?>',imagerySet: 'AerialWithLabels'});
324 396
 	map.addLayer(bingLayer);
325 397
 <?php
326 398
 	} elseif ($MapType == 'Bing-Road') {
327
-		if (!isset($globalBingMapKey) || $globalBingMapKey == '') setcookie('MapType','OpenStreetMap');
328
-?>
399
+		if (!isset($globalBingMapKey) || $globalBingMapKey == '') {
400
+			setcookie('MapType','OpenStreetMap');
401
+		}
402
+		?>
329 403
 	var bingLayer = new L.tileLayer.bing({bingMapsKey: '<?php print $globalBingMapKey; ?>',imagerySet: 'Road'});
330 404
 	map.addLayer(bingLayer);
331 405
 <?php
@@ -354,7 +428,12 @@  discard block
 block discarded – undo
354 428
 	    maxZoom: 5,
355 429
 	    tms : true,
356 430
 	    zindex : 3,
357
-	    noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) print 'false'; else print 'true'; ?>,
431
+	    noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) {
432
+	print 'false';
433
+} else {
434
+	print 'true';
435
+}
436
+?>,
358 437
 	    attribution: 'Natural Earth'
359 438
 	}).addTo(map);
360 439
 <?php
@@ -362,9 +441,24 @@  discard block
 block discarded – undo
362 441
 		$customid = $MapType;
363 442
 ?>
364 443
 	L.tileLayer('<?php print $globalMapCustomLayer[$customid]['url']; ?>/{z}/{x}/{y}.png', {
365
-	    maxZoom: <?php if (isset($globalMapCustomLayer[$customid]['maxZoom'])) print $globalMapCustomLayer[$customid]['maxZoom']; else print '18'; ?>,
366
-	    minZoom: <?php if (isset($globalMapCustomLayer[$customid]['minZoom'])) print $globalMapCustomLayer[$customid]['minZoom']; else print '0'; ?>,
367
-	    noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) print 'false'; else print 'true'; ?>,
444
+	    maxZoom: <?php if (isset($globalMapCustomLayer[$customid]['maxZoom'])) {
445
+	print $globalMapCustomLayer[$customid]['maxZoom'];
446
+} else {
447
+	print '18';
448
+}
449
+?>,
450
+	    minZoom: <?php if (isset($globalMapCustomLayer[$customid]['minZoom'])) {
451
+	print $globalMapCustomLayer[$customid]['minZoom'];
452
+} else {
453
+	print '0';
454
+}
455
+?>,
456
+	    noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) {
457
+	print 'false';
458
+} else {
459
+	print 'true';
460
+}
461
+?>,
368 462
 	    attribution: '<?php print $globalMapCustomLayer[$customid]['attribution']; ?>'
369 463
 	}).addTo(map);
370 464
 
@@ -404,7 +498,12 @@  discard block
 block discarded – undo
404 498
 		}
405 499
 	} elseif ($globalBounding == 'circle') {
406 500
 ?>
407
-	var circle = L.circle([<?php print $globalCenterLatitude; ?>, <?php print $globalCenterLongitude; ?>],<?php if (isset($globalBoundingCircleSize)) print $globalBoundingCircleSize; else print '70000'; ?>,{
501
+	var circle = L.circle([<?php print $globalCenterLatitude; ?>, <?php print $globalCenterLongitude; ?>],<?php if (isset($globalBoundingCircleSize)) {
502
+	print $globalBoundingCircleSize;
503
+} else {
504
+	print '70000';
505
+}
506
+?>,{
408 507
 	    color: '#92C7D1',
409 508
 	    fillColor: '#92C7D1',
410 509
 	    fillOpacity: 0.3,
@@ -494,7 +593,12 @@  discard block
 block discarded – undo
494 593
 	});
495 594
 	if (archive === false) {
496 595
 		update_locationsLayer();
497
-		setInterval(function(){if (noTimeout) { map.removeLayer(locationsLayer); update_locationsLayer();} },<?php if (isset($globalMapRefresh)) print $globalMapRefresh*1000*2; else print '60000'; ?>);
596
+		setInterval(function(){if (noTimeout) { map.removeLayer(locationsLayer); update_locationsLayer();} },<?php if (isset($globalMapRefresh)) {
597
+	print $globalMapRefresh*1000*2;
598
+} else {
599
+	print '60000';
600
+}
601
+?>);
498 602
 	}
499 603
 	var currentdate = new Date();
500 604
 	var currentyear = new Date().getFullYear();
Please login to merge, or discard this patch.
install/header.php 1 patch
Indentation   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
 <meta property="og:site_name" content="<?php print $globalName; ?>"/>
46 46
 
47 47
 <?php
48
-    if (!isset($_SESSION['install']) && !isset($_POST['dbtype'])) {
48
+	if (!isset($_SESSION['install']) && !isset($_POST['dbtype'])) {
49 49
 ?>
50 50
 <script language="JavaScript" type="text/javascript">
51 51
     function datasource_js() {
@@ -154,22 +154,22 @@  discard block
 block discarded – undo
154 154
     }
155 155
 </script>
156 156
 <?php
157
-    }
157
+	}
158 158
 ?>
159 159
 
160 160
 </head>
161 161
 
162 162
 <?php
163
-    if (!isset($_SESSION['install']) && !isset($_POST['dbtype']) && isset($_SESSION['identified'])) {
163
+	if (!isset($_SESSION['install']) && !isset($_POST['dbtype']) && isset($_SESSION['identified'])) {
164 164
 ?>
165 165
 
166 166
 <body class="page-<?php print strtolower($current_page); ?>" onload="datasource_js(); metarcycle_js(); create_database_js(); daemon_js(); schedule_js()">
167 167
 <?php
168
-    } else {
168
+	} else {
169 169
 ?>
170 170
     <body class="page-<?php print strtolower($current_page); ?>">
171 171
 <?php
172
-    }
172
+	}
173 173
 ?>
174 174
 <div class="navbar navbar-fixed-top" role="navigation">
175 175
     <div class="container">
@@ -183,7 +183,7 @@  discard block
 block discarded – undo
183 183
 	    <a class="navbar-brand" href="../"><img src="<?php print '../'.$logoURL; ?>" height="30px" /></a>
184 184
 	</div>
185 185
 <?php
186
-    if (!isset($_SESSION['install']) && !isset($_POST['dbtype']) && isset($_SESSION['identified'])) {
186
+	if (!isset($_SESSION['install']) && !isset($_POST['dbtype']) && isset($_SESSION['identified'])) {
187 187
 ?>
188 188
 	<div class="collapse navbar-collapse">
189 189
 	    <ul class="nav navbar-nav">
@@ -213,19 +213,19 @@  discard block
 block discarded – undo
213 213
 	     </ul>
214 214
 	</div>
215 215
 <?php
216
-    }
216
+	}
217 217
 ?>
218 218
     </div>
219 219
 </div>
220 220
 
221 221
 <?php
222 222
 if (isset($top_header)) {
223
-    if ($top_header != "")
224
-    {
223
+	if ($top_header != "")
224
+	{
225 225
 	print '<div class="top-header container clear" role="main">';
226 226
 		print '<img src="../images/'.$top_header.'" alt="'.$title.'" title="'.$title.'" />';
227 227
 	print '</div>';
228
-    }
228
+	}
229 229
 }
230 230
 ?>
231 231
 
Please login to merge, or discard this patch.
install/class.update_db.php 4 patches
Doc Comments   +48 added lines patch added patch discarded remove patch
@@ -20,6 +20,9 @@  discard block
 block discarded – undo
20 20
 		return $writable;
21 21
 	}
22 22
 
23
+	/**
24
+	 * @param string $file
25
+	 */
23 26
 	public static function download($url, $file, $referer = '') {
24 27
 		global $globalProxy, $globalForceIPv4;
25 28
 		$fp = fopen($file, 'w');
@@ -44,6 +47,9 @@  discard block
 block discarded – undo
44 47
 		fclose($fp);
45 48
 	}
46 49
 
50
+	/**
51
+	 * @param string $in_file
52
+	 */
47 53
 	public static function gunzip($in_file,$out_file_name = '') {
48 54
 		//echo $in_file.' -> '.$out_file_name."\n";
49 55
 		$buffer_size = 4096; // read 4kb at a time
@@ -65,6 +71,9 @@  discard block
 block discarded – undo
65 71
 		}
66 72
 	}
67 73
 
74
+	/**
75
+	 * @param string $in_file
76
+	 */
68 77
 	public static function unzip($in_file) {
69 78
 		if ($in_file != '' && file_exists($in_file)) {
70 79
 			$path = pathinfo(realpath($in_file), PATHINFO_DIRNAME);
@@ -86,6 +95,9 @@  discard block
 block discarded – undo
86 95
 		}
87 96
 	}
88 97
 	
98
+	/**
99
+	 * @param string $database_file
100
+	 */
89 101
 	public static function retrieve_route_sqlite_to_dest($database_file) {
90 102
 		global $globalDebug, $globalTransaction;
91 103
 		//$query = 'TRUNCATE TABLE routes';
@@ -128,6 +140,10 @@  discard block
 block discarded – undo
128 140
 		}
129 141
                 return '';
130 142
 	}
143
+
144
+	/**
145
+	 * @param string $database_file
146
+	 */
131 147
 	public static function retrieve_route_oneworld($database_file) {
132 148
 		global $globalDebug, $globalTransaction;
133 149
 		//$query = 'TRUNCATE TABLE routes';
@@ -169,6 +185,9 @@  discard block
 block discarded – undo
169 185
                 return '';
170 186
 	}
171 187
 	
188
+	/**
189
+	 * @param string $database_file
190
+	 */
172 191
 	public static function retrieve_route_skyteam($database_file) {
173 192
 		global $globalDebug, $globalTransaction;
174 193
 		//$query = 'TRUNCATE TABLE routes';
@@ -211,6 +230,10 @@  discard block
 block discarded – undo
211 230
 		}
212 231
                 return '';
213 232
 	}
233
+
234
+	/**
235
+	 * @param string $database_file
236
+	 */
214 237
 	public static function retrieve_modes_sqlite_to_dest($database_file) {
215 238
 		global $globalTransaction;
216 239
 		//$query = 'TRUNCATE TABLE aircraft_modes';
@@ -277,6 +300,9 @@  discard block
 block discarded – undo
277 300
 		return '';
278 301
 	}
279 302
 
303
+	/**
304
+	 * @param string $database_file
305
+	 */
280 306
 	public static function retrieve_modes_flarmnet($database_file) {
281 307
 		global $globalTransaction;
282 308
 		$Common = new Common();
@@ -347,6 +373,9 @@  discard block
 block discarded – undo
347 373
 		return '';
348 374
 	}
349 375
 
376
+	/**
377
+	 * @param string $database_file
378
+	 */
350 379
 	public static function retrieve_modes_ogn($database_file) {
351 380
 		global $globalTransaction;
352 381
 		//$query = 'TRUNCATE TABLE aircraft_modes';
@@ -416,6 +445,9 @@  discard block
 block discarded – undo
416 445
 		return '';
417 446
 	}
418 447
 
448
+	/**
449
+	 * @param string $database_file
450
+	 */
419 451
 	public static function retrieve_owner($database_file,$country = 'F') {
420 452
 		global $globalTransaction, $globalMasterSource;
421 453
 		//$query = 'TRUNCATE TABLE aircraft_modes';
@@ -1448,6 +1480,10 @@  discard block
 block discarded – undo
1448 1480
 		return '';
1449 1481
         }
1450 1482
 
1483
+	/**
1484
+	 * @param string $filename
1485
+	 * @param string $tletype
1486
+	 */
1451 1487
 	public static function tle($filename,$tletype) {
1452 1488
 		require_once(dirname(__FILE__).'/../require/class.Spotter.php');
1453 1489
 		global $tmp_dir, $globalTransaction;
@@ -1497,6 +1533,9 @@  discard block
 block discarded – undo
1497 1533
 		return '';
1498 1534
         }
1499 1535
 
1536
+	/**
1537
+	 * @param string $filename
1538
+	 */
1500 1539
 	public static function satellite_ucsdb($filename) {
1501 1540
 		global $tmp_dir, $globalTransaction;
1502 1541
 		
@@ -1545,6 +1584,9 @@  discard block
 block discarded – undo
1545 1584
 		return '';
1546 1585
 	}
1547 1586
 
1587
+	/**
1588
+	 * @param string $filename
1589
+	 */
1548 1590
 	public static function satellite_celestrak($filename) {
1549 1591
 		global $tmp_dir, $globalTransaction, $globalDebug;
1550 1592
 		$satcat_sources = array(
@@ -1871,6 +1913,9 @@  discard block
 block discarded – undo
1871 1913
 
1872 1914
 	}
1873 1915
 */
1916
+	/**
1917
+	 * @param string $filename
1918
+	 */
1874 1919
 	public static function waypoints($filename) {
1875 1920
 		//require_once(dirname(__FILE__).'/../require/class.Spotter.php');
1876 1921
 		global $tmp_dir, $globalTransaction;
@@ -1948,6 +1993,9 @@  discard block
 block discarded – undo
1948 1993
 		}
1949 1994
 	}
1950 1995
 
1996
+	/**
1997
+	 * @param string $filename
1998
+	 */
1951 1999
 	public static function ivao_airlines($filename) {
1952 2000
 		//require_once(dirname(__FILE__).'/../require/class.Spotter.php');
1953 2001
 		global $tmp_dir, $globalTransaction;
Please login to merge, or discard this patch.
Indentation   +358 added lines, -358 removed lines patch added patch discarded remove patch
@@ -95,38 +95,38 @@  discard block
 block discarded – undo
95 95
 		try {
96 96
 			//$Connection = new Connection();
97 97
 			$sth = $Connection->db->prepare($query);
98
-                        $sth->execute(array(':source' => $database_file));
99
-                } catch(PDOException $e) {
100
-                        return "error : ".$e->getMessage();
101
-                }
98
+						$sth->execute(array(':source' => $database_file));
99
+				} catch(PDOException $e) {
100
+						return "error : ".$e->getMessage();
101
+				}
102 102
 
103
-    		if ($globalDebug) echo " - Add routes to DB -";
104
-    		update_db::connect_sqlite($database_file);
103
+			if ($globalDebug) echo " - Add routes to DB -";
104
+			update_db::connect_sqlite($database_file);
105 105
 		//$query = 'select Route.RouteID, Route.callsign, operator.Icao AS operator_icao, FromAir.Icao AS FromAirportIcao, ToAir.Icao AS ToAirportIcao from Route inner join operator ON Route.operatorId = operator.operatorId LEFT JOIN Airport AS FromAir ON route.FromAirportId = FromAir.AirportId LEFT JOIN Airport AS ToAir ON ToAir.AirportID = route.ToAirportID';
106 106
 		$query = "select Route.RouteID, Route.callsign, operator.Icao AS operator_icao, FromAir.Icao AS FromAirportIcao, ToAir.Icao AS ToAirportIcao, rstp.allstop AS AllStop from Route inner join operator ON Route.operatorId = operator.operatorId LEFT JOIN Airport AS FromAir ON route.FromAirportId = FromAir.AirportId LEFT JOIN Airport AS ToAir ON ToAir.AirportID = route.ToAirportID LEFT JOIN (select RouteId,GROUP_CONCAT(icao,' ') as allstop from routestop left join Airport as air ON routestop.AirportId = air.AirportID group by RouteID) AS rstp ON Route.RouteID = rstp.RouteID";
107 107
 		try {
108
-                        $sth = update_db::$db_sqlite->prepare($query);
109
-                        $sth->execute();
110
-                } catch(PDOException $e) {
111
-                        return "error : ".$e->getMessage();
112
-                }
108
+						$sth = update_db::$db_sqlite->prepare($query);
109
+						$sth->execute();
110
+				} catch(PDOException $e) {
111
+						return "error : ".$e->getMessage();
112
+				}
113 113
 		//$query_dest = 'INSERT INTO routes (`RouteID`,`CallSign`,`Operator_ICAO`,`FromAirport_ICAO`,`ToAirport_ICAO`,`RouteStop`,`Source`) VALUES (:RouteID, :CallSign, :Operator_ICAO, :FromAirport_ICAO, :ToAirport_ICAO, :routestop, :source)';
114 114
 		$query_dest = 'INSERT INTO routes (CallSign,Operator_ICAO,FromAirport_ICAO,ToAirport_ICAO,RouteStop,Source) VALUES (:CallSign, :Operator_ICAO, :FromAirport_ICAO, :ToAirport_ICAO, :routestop, :source)';
115 115
 		$Connection = new Connection();
116 116
 		$sth_dest = $Connection->db->prepare($query_dest);
117 117
 		try {
118 118
 			if ($globalTransaction) $Connection->db->beginTransaction();
119
-            		while ($values = $sth->fetch(PDO::FETCH_ASSOC)) {
119
+					while ($values = $sth->fetch(PDO::FETCH_ASSOC)) {
120 120
 				//$query_dest_values = array(':RouteID' => $values['RouteId'],':CallSign' => $values['Callsign'],':Operator_ICAO' => $values['operator_icao'],':FromAirport_ICAO' => $values['FromAirportIcao'],':ToAirport_ICAO' => $values['ToAirportIcao'],':routestop' => $values['AllStop'],':source' => $database_file);
121 121
 				$query_dest_values = array(':CallSign' => $values['Callsign'],':Operator_ICAO' => $values['operator_icao'],':FromAirport_ICAO' => $values['FromAirportIcao'],':ToAirport_ICAO' => $values['ToAirportIcao'],':routestop' => $values['AllStop'],':source' => $database_file);
122 122
 				$sth_dest->execute($query_dest_values);
123
-            		}
123
+					}
124 124
 			if ($globalTransaction) $Connection->db->commit();
125 125
 		} catch(PDOException $e) {
126 126
 			if ($globalTransaction) $Connection->db->rollBack(); 
127 127
 			return "error : ".$e->getMessage();
128 128
 		}
129
-                return '';
129
+				return '';
130 130
 	}
131 131
 	public static function retrieve_route_oneworld($database_file) {
132 132
 		global $globalDebug, $globalTransaction;
@@ -137,12 +137,12 @@  discard block
 block discarded – undo
137 137
 		try {
138 138
 			//$Connection = new Connection();
139 139
 			$sth = $Connection->db->prepare($query);
140
-                        $sth->execute(array(':source' => 'oneworld'));
141
-                } catch(PDOException $e) {
142
-                        return "error : ".$e->getMessage();
143
-                }
140
+						$sth->execute(array(':source' => 'oneworld'));
141
+				} catch(PDOException $e) {
142
+						return "error : ".$e->getMessage();
143
+				}
144 144
 
145
-    		if ($globalDebug) echo " - Add routes to DB -";
145
+			if ($globalDebug) echo " - Add routes to DB -";
146 146
 		require_once(dirname(__FILE__).'/../require/class.Spotter.php');
147 147
 		$Spotter = new Spotter();
148 148
 		if ($fh = fopen($database_file,"r")) {
@@ -166,7 +166,7 @@  discard block
 block discarded – undo
166 166
 			}
167 167
 			if ($globalTransaction) $Connection->db->commit();
168 168
 		}
169
-                return '';
169
+				return '';
170 170
 	}
171 171
 	
172 172
 	public static function retrieve_route_skyteam($database_file) {
@@ -178,12 +178,12 @@  discard block
 block discarded – undo
178 178
 		try {
179 179
 			//$Connection = new Connection();
180 180
 			$sth = $Connection->db->prepare($query);
181
-                        $sth->execute(array(':source' => 'skyteam'));
182
-                } catch(PDOException $e) {
183
-                        return "error : ".$e->getMessage();
184
-                }
181
+						$sth->execute(array(':source' => 'skyteam'));
182
+				} catch(PDOException $e) {
183
+						return "error : ".$e->getMessage();
184
+				}
185 185
 
186
-    		if ($globalDebug) echo " - Add routes to DB -";
186
+			if ($globalDebug) echo " - Add routes to DB -";
187 187
 
188 188
 		require_once(dirname(__FILE__).'/../require/class.Spotter.php');
189 189
 		$Spotter = new Spotter();
@@ -209,7 +209,7 @@  discard block
 block discarded – undo
209 209
 				return "error : ".$e->getMessage();
210 210
 			}
211 211
 		}
212
-                return '';
212
+				return '';
213 213
 	}
214 214
 	public static function retrieve_modes_sqlite_to_dest($database_file) {
215 215
 		global $globalTransaction;
@@ -218,27 +218,27 @@  discard block
 block discarded – undo
218 218
 		try {
219 219
 			$Connection = new Connection();
220 220
 			$sth = $Connection->db->prepare($query);
221
-                        $sth->execute(array(':source' => $database_file));
222
-                } catch(PDOException $e) {
223
-                        return "error : ".$e->getMessage();
224
-                }
221
+						$sth->execute(array(':source' => $database_file));
222
+				} catch(PDOException $e) {
223
+						return "error : ".$e->getMessage();
224
+				}
225 225
 		$query = "DELETE FROM aircraft_owner WHERE Source = '' OR Source IS NULL OR Source = :source";
226 226
 		try {
227 227
 			$Connection = new Connection();
228 228
 			$sth = $Connection->db->prepare($query);
229
-                        $sth->execute(array(':source' => $database_file));
230
-                } catch(PDOException $e) {
231
-                        return "error : ".$e->getMessage();
232
-                }
229
+						$sth->execute(array(':source' => $database_file));
230
+				} catch(PDOException $e) {
231
+						return "error : ".$e->getMessage();
232
+				}
233 233
 
234
-    		update_db::connect_sqlite($database_file);
234
+			update_db::connect_sqlite($database_file);
235 235
 		$query = 'select * from Aircraft';
236 236
 		try {
237
-                        $sth = update_db::$db_sqlite->prepare($query);
238
-                        $sth->execute();
239
-                } catch(PDOException $e) {
240
-                        return "error : ".$e->getMessage();
241
-                }
237
+						$sth = update_db::$db_sqlite->prepare($query);
238
+						$sth->execute();
239
+				} catch(PDOException $e) {
240
+						return "error : ".$e->getMessage();
241
+				}
242 242
 		//$query_dest = 'INSERT INTO aircraft_modes (`AircraftID`,`FirstCreated`,`LastModified`, `ModeS`,`ModeSCountry`,`Registration`,`ICAOTypeCode`,`SerialNo`, `OperatorFlagCode`, `Manufacturer`, `Type`, `FirstRegDate`, `CurrentRegDate`, `Country`, `PreviousID`, `DeRegDate`, `Status`, `PopularName`,`GenericName`,`AircraftClass`, `Engines`, `OwnershipStatus`,`RegisteredOwners`,`MTOW`, `TotalHours`, `YearBuilt`, `CofACategory`, `CofAExpiry`, `UserNotes`, `Interested`, `UserTag`, `InfoUrl`, `PictureUrl1`, `PictureUrl2`, `PictureUrl3`, `UserBool1`, `UserBool2`, `UserBool3`, `UserBool4`, `UserBool5`, `UserString1`, `UserString2`, `UserString3`, `UserString4`, `UserString5`, `UserInt1`, `UserInt2`, `UserInt3`, `UserInt4`, `UserInt5`) VALUES (:AircraftID,:FirstCreated,:LastModified,:ModeS,:ModeSCountry,:Registration,:ICAOTypeCode,:SerialNo, :OperatorFlagCode, :Manufacturer, :Type, :FirstRegDate, :CurrentRegDate, :Country, :PreviousID, :DeRegDate, :Status, :PopularName,:GenericName,:AircraftClass, :Engines, :OwnershipStatus,:RegisteredOwners,:MTOW, :TotalHours,:YearBuilt, :CofACategory, :CofAExpiry, :UserNotes, :Interested, :UserTag, :InfoUrl, :PictureUrl1, :PictureUrl2, :PictureUrl3, :UserBool1, :UserBool2, :UserBool3, :UserBool4, :UserBool5, :UserString1, :UserString2, :UserString3, :UserString4, :UserString5, :UserInt1, :UserInt2, :UserInt3, :UserInt4, :UserInt5)';
243 243
 		$query_dest = 'INSERT INTO aircraft_modes (LastModified, ModeS,ModeSCountry,Registration,ICAOTypeCode,type_flight,Source) VALUES (:LastModified,:ModeS,:ModeSCountry,:Registration,:ICAOTypeCode,:type,:source)';
244 244
 		
@@ -249,17 +249,17 @@  discard block
 block discarded – undo
249 249
 		$sth_dest_owner = $Connection->db->prepare($query_dest_owner);
250 250
 		try {
251 251
 			if ($globalTransaction) $Connection->db->beginTransaction();
252
-            		while ($values = $sth->fetch(PDO::FETCH_ASSOC)) {
252
+					while ($values = $sth->fetch(PDO::FETCH_ASSOC)) {
253 253
 			//$query_dest_values = array(':AircraftID' => $values['AircraftID'],':FirstCreated' => $values['FirstCreated'],':LastModified' => $values['LastModified'],':ModeS' => $values['ModeS'],':ModeSCountry' => $values['ModeSCountry'],':Registration' => $values['Registration'],':ICAOTypeCode' => $values['ICAOTypeCode'],':SerialNo' => $values['SerialNo'], ':OperatorFlagCode' => $values['OperatorFlagCode'], ':Manufacturer' => $values['Manufacturer'], ':Type' => $values['Type'], ':FirstRegDate' => $values['FirstRegDate'], ':CurrentRegDate' => $values['CurrentRegDate'], ':Country' => $values['Country'], ':PreviousID' => $values['PreviousID'], ':DeRegDate' => $values['DeRegDate'], ':Status' => $values['Status'], ':PopularName' => $values['PopularName'],':GenericName' => $values['GenericName'],':AircraftClass' => $values['AircraftClass'], ':Engines' => $values['Engines'], ':OwnershipStatus' => $values['OwnershipStatus'],':RegisteredOwners' => $values['RegisteredOwners'],':MTOW' => $values['MTOW'], ':TotalHours' => $values['TotalHours'],':YearBuilt' => $values['YearBuilt'], ':CofACategory' => $values['CofACategory'], ':CofAExpiry' => $values['CofAExpiry'], ':UserNotes' => $values['UserNotes'], ':Interested' => $values['Interested'], ':UserTag' => $values['UserTag'], ':InfoUrl' => $values['InfoURL'], ':PictureUrl1' => $values['PictureURL1'], ':PictureUrl2' => $values['PictureURL2'], ':PictureUrl3' => $values['PictureURL3'], ':UserBool1' => $values['UserBool1'], ':UserBool2' => $values['UserBool2'], ':UserBool3' => $values['UserBool3'], ':UserBool4' => $values['UserBool4'], ':UserBool5' => $values['UserBool5'], ':UserString1' => $values['UserString1'], ':UserString2' => $values['UserString2'], ':UserString3' => $values['UserString3'], ':UserString4' => $values['UserString4'], ':UserString5' => $values['UserString5'], ':UserInt1' => $values['UserInt1'], ':UserInt2' => $values['UserInt2'], ':UserInt3' => $values['UserInt3'], ':UserInt4' => $values['UserInt4'], ':UserInt5' => $values['UserInt5']);
254 254
 				if ($values['UserString4'] == 'M') $type = 'military';
255 255
 				else $type = null;
256 256
 				$query_dest_values = array(':LastModified' => $values['LastModified'],':ModeS' => $values['ModeS'],':ModeSCountry' => $values['ModeSCountry'],':Registration' => $values['Registration'],':ICAOTypeCode' => $values['ICAOTypeCode'],':source' => $database_file,':type' => $type);
257 257
 				$sth_dest->execute($query_dest_values);
258 258
 				if ($values['RegisteredOwners'] != '' && $values['RegisteredOwners'] != NULL && $values['RegisteredOwners'] != 'Private') {
259
-				    $query_dest_owner_values = array(':registration' => $values['Registration'],':source' => $database_file,':owner' => $values['RegisteredOwners']);
260
-				    $sth_dest_owner->execute($query_dest_owner_values);
259
+					$query_dest_owner_values = array(':registration' => $values['Registration'],':source' => $database_file,':owner' => $values['RegisteredOwners']);
260
+					$sth_dest_owner->execute($query_dest_owner_values);
261 261
 				}
262
-            		}
262
+					}
263 263
 			if ($globalTransaction) $Connection->db->commit();
264 264
 		} catch(PDOException $e) {
265 265
 			return "error : ".$e->getMessage();
@@ -270,10 +270,10 @@  discard block
 block discarded – undo
270 270
 		try {
271 271
 			$Connection = new Connection();
272 272
 			$sth = $Connection->db->prepare($query);
273
-                        $sth->execute(array(':source' => $database_file));
274
-                } catch(PDOException $e) {
275
-                        return "error : ".$e->getMessage();
276
-                }
273
+						$sth->execute(array(':source' => $database_file));
274
+				} catch(PDOException $e) {
275
+						return "error : ".$e->getMessage();
276
+				}
277 277
 		return '';
278 278
 	}
279 279
 
@@ -285,10 +285,10 @@  discard block
 block discarded – undo
285 285
 		try {
286 286
 			$Connection = new Connection();
287 287
 			$sth = $Connection->db->prepare($query);
288
-                        $sth->execute(array(':source' => $database_file));
289
-                } catch(PDOException $e) {
290
-                        return "error : ".$e->getMessage();
291
-                }
288
+						$sth->execute(array(':source' => $database_file));
289
+				} catch(PDOException $e) {
290
+						return "error : ".$e->getMessage();
291
+				}
292 292
 		
293 293
 		if ($fh = fopen($database_file,"r")) {
294 294
 			//$query_dest = 'INSERT INTO aircraft_modes (`AircraftID`,`FirstCreated`,`LastModified`, `ModeS`,`ModeSCountry`,`Registration`,`ICAOTypeCode`,`SerialNo`, `OperatorFlagCode`, `Manufacturer`, `Type`, `FirstRegDate`, `CurrentRegDate`, `Country`, `PreviousID`, `DeRegDate`, `Status`, `PopularName`,`GenericName`,`AircraftClass`, `Engines`, `OwnershipStatus`,`RegisteredOwners`,`MTOW`, `TotalHours`, `YearBuilt`, `CofACategory`, `CofAExpiry`, `UserNotes`, `Interested`, `UserTag`, `InfoUrl`, `PictureUrl1`, `PictureUrl2`, `PictureUrl3`, `UserBool1`, `UserBool2`, `UserBool3`, `UserBool4`, `UserBool5`, `UserString1`, `UserString2`, `UserString3`, `UserString4`, `UserString5`, `UserInt1`, `UserInt2`, `UserInt3`, `UserInt4`, `UserInt5`) VALUES (:AircraftID,:FirstCreated,:LastModified,:ModeS,:ModeSCountry,:Registration,:ICAOTypeCode,:SerialNo, :OperatorFlagCode, :Manufacturer, :Type, :FirstRegDate, :CurrentRegDate, :Country, :PreviousID, :DeRegDate, :Status, :PopularName,:GenericName,:AircraftClass, :Engines, :OwnershipStatus,:RegisteredOwners,:MTOW, :TotalHours,:YearBuilt, :CofACategory, :CofAExpiry, :UserNotes, :Interested, :UserTag, :InfoUrl, :PictureUrl1, :PictureUrl2, :PictureUrl3, :UserBool1, :UserBool2, :UserBool3, :UserBool4, :UserBool5, :UserString1, :UserString2, :UserString3, :UserString4, :UserString5, :UserInt1, :UserInt2, :UserInt3, :UserInt4, :UserInt5)';
@@ -298,26 +298,26 @@  discard block
 block discarded – undo
298 298
 			$sth_dest = $Connection->db->prepare($query_dest);
299 299
 			try {
300 300
 				if ($globalTransaction) $Connection->db->beginTransaction();
301
-            			while (!feof($fh)) {
302
-            				$values = array();
303
-            				$line = $Common->hex2str(fgets($fh,9999));
301
+						while (!feof($fh)) {
302
+							$values = array();
303
+							$line = $Common->hex2str(fgets($fh,9999));
304 304
 					//FFFFFF                     RIDEAU VALLEY SOARINGASW-20               C-FBKN MZ 123.400
305
-            				$values['ModeS'] = substr($line,0,6);
306
-            				$values['Registration'] = trim(substr($line,69,6));
307
-            				$aircraft_name = trim(substr($line,48,6));
308
-            				// Check if we can find ICAO, else set it to GLID
309
-            				$aircraft_name_split = explode(' ',$aircraft_name);
310
-            				$search_more = '';
311
-            				if (count($aircraft_name) > 1 && strlen($aircraft_name_split[1]) > 3) $search_more .= " AND LIKE '%".$aircraft_name_split[0]."%'";
312
-            				$query_search = "SELECT * FROM aircraft WHERE type LIKE '%".$aircraft_name."%'".$search_more;
313
-            				$sth_search = $Connection->db->prepare($query_search);
305
+							$values['ModeS'] = substr($line,0,6);
306
+							$values['Registration'] = trim(substr($line,69,6));
307
+							$aircraft_name = trim(substr($line,48,6));
308
+							// Check if we can find ICAO, else set it to GLID
309
+							$aircraft_name_split = explode(' ',$aircraft_name);
310
+							$search_more = '';
311
+							if (count($aircraft_name) > 1 && strlen($aircraft_name_split[1]) > 3) $search_more .= " AND LIKE '%".$aircraft_name_split[0]."%'";
312
+							$query_search = "SELECT * FROM aircraft WHERE type LIKE '%".$aircraft_name."%'".$search_more;
313
+							$sth_search = $Connection->db->prepare($query_search);
314 314
 					try {
315
-                                    		$sth_search->execute();
316
-	            				$result = $sth_search->fetch(PDO::FETCH_ASSOC);
317
-	            				//if (count($result) > 0) {
318
-	            				if (isset($result['icao']) && $result['icao'] != '') {
319
-	            				    $values['ICAOTypeCode'] = $result['icao'];
320
-	            				} 
315
+											$sth_search->execute();
316
+								$result = $sth_search->fetch(PDO::FETCH_ASSOC);
317
+								//if (count($result) > 0) {
318
+								if (isset($result['icao']) && $result['icao'] != '') {
319
+									$values['ICAOTypeCode'] = $result['icao'];
320
+								} 
321 321
 					} catch(PDOException $e) {
322 322
 						return "error : ".$e->getMessage();
323 323
 					}
@@ -340,10 +340,10 @@  discard block
 block discarded – undo
340 340
 		try {
341 341
 			$Connection = new Connection();
342 342
 			$sth = $Connection->db->prepare($query);
343
-                        $sth->execute(array(':source' => $database_file));
344
-                } catch(PDOException $e) {
345
-                        return "error : ".$e->getMessage();
346
-                }
343
+						$sth->execute(array(':source' => $database_file));
344
+				} catch(PDOException $e) {
345
+						return "error : ".$e->getMessage();
346
+				}
347 347
 		return '';
348 348
 	}
349 349
 
@@ -354,10 +354,10 @@  discard block
 block discarded – undo
354 354
 		try {
355 355
 			$Connection = new Connection();
356 356
 			$sth = $Connection->db->prepare($query);
357
-                        $sth->execute(array(':source' => $database_file));
358
-                } catch(PDOException $e) {
359
-                        return "error : ".$e->getMessage();
360
-                }
357
+						$sth->execute(array(':source' => $database_file));
358
+				} catch(PDOException $e) {
359
+						return "error : ".$e->getMessage();
360
+				}
361 361
 		
362 362
 		if ($fh = fopen($database_file,"r")) {
363 363
 			//$query_dest = 'INSERT INTO aircraft_modes (`AircraftID`,`FirstCreated`,`LastModified`, `ModeS`,`ModeSCountry`,`Registration`,`ICAOTypeCode`,`SerialNo`, `OperatorFlagCode`, `Manufacturer`, `Type`, `FirstRegDate`, `CurrentRegDate`, `Country`, `PreviousID`, `DeRegDate`, `Status`, `PopularName`,`GenericName`,`AircraftClass`, `Engines`, `OwnershipStatus`,`RegisteredOwners`,`MTOW`, `TotalHours`, `YearBuilt`, `CofACategory`, `CofAExpiry`, `UserNotes`, `Interested`, `UserTag`, `InfoUrl`, `PictureUrl1`, `PictureUrl2`, `PictureUrl3`, `UserBool1`, `UserBool2`, `UserBool3`, `UserBool4`, `UserBool5`, `UserString1`, `UserString2`, `UserString3`, `UserString4`, `UserString5`, `UserInt1`, `UserInt2`, `UserInt3`, `UserInt4`, `UserInt5`) VALUES (:AircraftID,:FirstCreated,:LastModified,:ModeS,:ModeSCountry,:Registration,:ICAOTypeCode,:SerialNo, :OperatorFlagCode, :Manufacturer, :Type, :FirstRegDate, :CurrentRegDate, :Country, :PreviousID, :DeRegDate, :Status, :PopularName,:GenericName,:AircraftClass, :Engines, :OwnershipStatus,:RegisteredOwners,:MTOW, :TotalHours,:YearBuilt, :CofACategory, :CofAExpiry, :UserNotes, :Interested, :UserTag, :InfoUrl, :PictureUrl1, :PictureUrl2, :PictureUrl3, :UserBool1, :UserBool2, :UserBool3, :UserBool4, :UserBool5, :UserString1, :UserString2, :UserString3, :UserString4, :UserString5, :UserInt1, :UserInt2, :UserInt3, :UserInt4, :UserInt5)';
@@ -368,25 +368,25 @@  discard block
 block discarded – undo
368 368
 			try {
369 369
 				if ($globalTransaction) $Connection->db->beginTransaction();
370 370
 				$tmp = fgetcsv($fh,9999,',',"'");
371
-            			while (!feof($fh)) {
372
-            				$line = fgetcsv($fh,9999,',',"'");
371
+						while (!feof($fh)) {
372
+							$line = fgetcsv($fh,9999,',',"'");
373 373
             				
374 374
 					//FFFFFF                     RIDEAU VALLEY SOARINGASW-20               C-FBKN MZ 123.400
375 375
 					//print_r($line);
376
-            				$values['ModeS'] = $line[1];
377
-            				$values['Registration'] = $line[3];
378
-            				$values['ICAOTypeCode'] = '';
379
-            				$aircraft_name = $line[2];
380
-            				// Check if we can find ICAO, else set it to GLID
381
-            				$aircraft_name_split = explode(' ',$aircraft_name);
382
-            				$search_more = '';
383
-            				if (count($aircraft_name) > 1 && strlen($aircraft_name_split[1]) > 3) $search_more .= " AND LIKE '%".$aircraft_name_split[0]."%'";
384
-            				$query_search = "SELECT * FROM aircraft WHERE type LIKE '%".$aircraft_name."%'".$search_more;
385
-            				$sth_search = $Connection->db->prepare($query_search);
376
+							$values['ModeS'] = $line[1];
377
+							$values['Registration'] = $line[3];
378
+							$values['ICAOTypeCode'] = '';
379
+							$aircraft_name = $line[2];
380
+							// Check if we can find ICAO, else set it to GLID
381
+							$aircraft_name_split = explode(' ',$aircraft_name);
382
+							$search_more = '';
383
+							if (count($aircraft_name) > 1 && strlen($aircraft_name_split[1]) > 3) $search_more .= " AND LIKE '%".$aircraft_name_split[0]."%'";
384
+							$query_search = "SELECT * FROM aircraft WHERE type LIKE '%".$aircraft_name."%'".$search_more;
385
+							$sth_search = $Connection->db->prepare($query_search);
386 386
 					try {
387
-                                    		$sth_search->execute();
388
-	            				$result = $sth_search->fetch(PDO::FETCH_ASSOC);
389
-	            				if (isset($result['icao']) && $result['icao'] != '') $values['ICAOTypeCode'] = $result['icao'];
387
+											$sth_search->execute();
388
+								$result = $sth_search->fetch(PDO::FETCH_ASSOC);
389
+								if (isset($result['icao']) && $result['icao'] != '') $values['ICAOTypeCode'] = $result['icao'];
390 390
 					} catch(PDOException $e) {
391 391
 						return "error : ".$e->getMessage();
392 392
 					}
@@ -409,10 +409,10 @@  discard block
 block discarded – undo
409 409
 		try {
410 410
 			$Connection = new Connection();
411 411
 			$sth = $Connection->db->prepare($query);
412
-                        $sth->execute(array(':source' => $database_file));
413
-                } catch(PDOException $e) {
414
-                        return "error : ".$e->getMessage();
415
-                }
412
+						$sth->execute(array(':source' => $database_file));
413
+				} catch(PDOException $e) {
414
+						return "error : ".$e->getMessage();
415
+				}
416 416
 		return '';
417 417
 	}
418 418
 
@@ -423,16 +423,16 @@  discard block
 block discarded – undo
423 423
 		try {
424 424
 			$Connection = new Connection();
425 425
 			$sth = $Connection->db->prepare($query);
426
-                        $sth->execute(array(':source' => $database_file));
427
-                } catch(PDOException $e) {
428
-                        return "error : ".$e->getMessage();
429
-                }
426
+						$sth->execute(array(':source' => $database_file));
427
+				} catch(PDOException $e) {
428
+						return "error : ".$e->getMessage();
429
+				}
430 430
 		require_once(dirname(__FILE__).'/../require/class.Spotter.php');
431 431
 		$Spotter = new Spotter();
432 432
 		if ($fh = fopen($database_file,"r")) {
433 433
 			//$query_dest = 'INSERT INTO aircraft_modes (`AircraftID`,`FirstCreated`,`LastModified`, `ModeS`,`ModeSCountry`,`Registration`,`ICAOTypeCode`,`SerialNo`, `OperatorFlagCode`, `Manufacturer`, `Type`, `FirstRegDate`, `CurrentRegDate`, `Country`, `PreviousID`, `DeRegDate`, `Status`, `PopularName`,`GenericName`,`AircraftClass`, `Engines`, `OwnershipStatus`,`RegisteredOwners`,`MTOW`, `TotalHours`, `YearBuilt`, `CofACategory`, `CofAExpiry`, `UserNotes`, `Interested`, `UserTag`, `InfoUrl`, `PictureUrl1`, `PictureUrl2`, `PictureUrl3`, `UserBool1`, `UserBool2`, `UserBool3`, `UserBool4`, `UserBool5`, `UserString1`, `UserString2`, `UserString3`, `UserString4`, `UserString5`, `UserInt1`, `UserInt2`, `UserInt3`, `UserInt4`, `UserInt5`) VALUES (:AircraftID,:FirstCreated,:LastModified,:ModeS,:ModeSCountry,:Registration,:ICAOTypeCode,:SerialNo, :OperatorFlagCode, :Manufacturer, :Type, :FirstRegDate, :CurrentRegDate, :Country, :PreviousID, :DeRegDate, :Status, :PopularName,:GenericName,:AircraftClass, :Engines, :OwnershipStatus,:RegisteredOwners,:MTOW, :TotalHours,:YearBuilt, :CofACategory, :CofAExpiry, :UserNotes, :Interested, :UserTag, :InfoUrl, :PictureUrl1, :PictureUrl2, :PictureUrl3, :UserBool1, :UserBool2, :UserBool3, :UserBool4, :UserBool5, :UserString1, :UserString2, :UserString3, :UserString4, :UserString5, :UserInt1, :UserInt2, :UserInt3, :UserInt4, :UserInt5)';
434 434
 			$query_dest = 'INSERT INTO aircraft_owner (registration,base,owner,date_first_reg,Source) VALUES (:registration,:base,:owner,:date_first_reg,:source)';
435
-		        $query_modes = 'INSERT INTO aircraft_modes (ModeS,ModeSCountry,Registration,ICAOTypeCode,Source) VALUES (:modes,:modescountry,:registration,:icaotypecode,:source)';
435
+				$query_modes = 'INSERT INTO aircraft_modes (ModeS,ModeSCountry,Registration,ICAOTypeCode,Source) VALUES (:modes,:modescountry,:registration,:icaotypecode,:source)';
436 436
 		        
437 437
 			$Connection = new Connection();
438 438
 			$sth_dest = $Connection->db->prepare($query_dest);
@@ -440,126 +440,126 @@  discard block
 block discarded – undo
440 440
 			try {
441 441
 				if ($globalTransaction) $Connection->db->beginTransaction();
442 442
 				$tmp = fgetcsv($fh,9999,',','"');
443
-            			while (!feof($fh)) {
444
-            				$line = fgetcsv($fh,9999,',','"');
445
-            				$values = array();
446
-            				//print_r($line);
447
-            				if ($country == 'F') {
448
-            				    $values['registration'] = $line[0];
449
-            				    $values['base'] = $line[4];
450
-            				    $values['owner'] = $line[5];
451
-            				    if ($line[6] == '') $values['date_first_reg'] = null;
452
-					    else $values['date_first_reg'] = date("Y-m-d",strtotime($line[6]));
453
-					    $values['cancel'] = $line[7];
443
+						while (!feof($fh)) {
444
+							$line = fgetcsv($fh,9999,',','"');
445
+							$values = array();
446
+							//print_r($line);
447
+							if ($country == 'F') {
448
+								$values['registration'] = $line[0];
449
+								$values['base'] = $line[4];
450
+								$values['owner'] = $line[5];
451
+								if ($line[6] == '') $values['date_first_reg'] = null;
452
+						else $values['date_first_reg'] = date("Y-m-d",strtotime($line[6]));
453
+						$values['cancel'] = $line[7];
454 454
 					} elseif ($country == 'EI') {
455
-					    // TODO : add modeS & reg to aircraft_modes
456
-            				    $values['registration'] = $line[0];
457
-            				    $values['base'] = $line[3];
458
-            				    $values['owner'] = $line[2];
459
-            				    if ($line[1] == '') $values['date_first_reg'] = null;
460
-					    else $values['date_first_reg'] = date("Y-m-d",strtotime($line[1]));
461
-					    $values['cancel'] = '';
462
-					    $values['modes'] = $line[7];
463
-					    $values['icao'] = $line[8];
455
+						// TODO : add modeS & reg to aircraft_modes
456
+								$values['registration'] = $line[0];
457
+								$values['base'] = $line[3];
458
+								$values['owner'] = $line[2];
459
+								if ($line[1] == '') $values['date_first_reg'] = null;
460
+						else $values['date_first_reg'] = date("Y-m-d",strtotime($line[1]));
461
+						$values['cancel'] = '';
462
+						$values['modes'] = $line[7];
463
+						$values['icao'] = $line[8];
464 464
 					    
465 465
 					} elseif ($country == 'HB') {
466
-					    // TODO : add modeS & reg to aircraft_modes
467
-            				    $values['registration'] = $line[0];
468
-            				    $values['base'] = null;
469
-            				    $values['owner'] = $line[5];
470
-            				    $values['date_first_reg'] = null;
471
-					    $values['cancel'] = '';
472
-					    $values['modes'] = $line[4];
473
-					    $values['icao'] = $line[7];
466
+						// TODO : add modeS & reg to aircraft_modes
467
+								$values['registration'] = $line[0];
468
+								$values['base'] = null;
469
+								$values['owner'] = $line[5];
470
+								$values['date_first_reg'] = null;
471
+						$values['cancel'] = '';
472
+						$values['modes'] = $line[4];
473
+						$values['icao'] = $line[7];
474 474
 					} elseif ($country == 'OK') {
475
-					    // TODO : add modeS & reg to aircraft_modes
476
-            				    $values['registration'] = $line[3];
477
-            				    $values['base'] = null;
478
-            				    $values['owner'] = $line[5];
479
-            				    if ($line[18] == '') $values['date_first_reg'] = null;
480
-					    else $values['date_first_reg'] = date("Y-m-d",strtotime($line[18]));
481
-					    $values['cancel'] = '';
475
+						// TODO : add modeS & reg to aircraft_modes
476
+								$values['registration'] = $line[3];
477
+								$values['base'] = null;
478
+								$values['owner'] = $line[5];
479
+								if ($line[18] == '') $values['date_first_reg'] = null;
480
+						else $values['date_first_reg'] = date("Y-m-d",strtotime($line[18]));
481
+						$values['cancel'] = '';
482 482
 					} elseif ($country == 'VH') {
483
-					    // TODO : add modeS & reg to aircraft_modes
484
-            				    $values['registration'] = $line[0];
485
-            				    $values['base'] = null;
486
-            				    $values['owner'] = $line[12];
487
-            				    if ($line[28] == '') $values['date_first_reg'] = null;
488
-					    else $values['date_first_reg'] = date("Y-m-d",strtotime($line[28]));
489
-
490
-					    $values['cancel'] = $line[39];
483
+						// TODO : add modeS & reg to aircraft_modes
484
+								$values['registration'] = $line[0];
485
+								$values['base'] = null;
486
+								$values['owner'] = $line[12];
487
+								if ($line[28] == '') $values['date_first_reg'] = null;
488
+						else $values['date_first_reg'] = date("Y-m-d",strtotime($line[28]));
489
+
490
+						$values['cancel'] = $line[39];
491 491
 					} elseif ($country == 'OE' || $country == '9A' || $country == 'VP' || $country == 'LX' || $country == 'P2' || $country == 'HC') {
492
-            				    $values['registration'] = $line[0];
493
-            				    $values['base'] = null;
494
-            				    $values['owner'] = $line[4];
495
-            				    $values['date_first_reg'] = null;
496
-					    $values['cancel'] = '';
492
+								$values['registration'] = $line[0];
493
+								$values['base'] = null;
494
+								$values['owner'] = $line[4];
495
+								$values['date_first_reg'] = null;
496
+						$values['cancel'] = '';
497 497
 					} elseif ($country == 'CC') {
498
-            				    $values['registration'] = $line[0];
499
-            				    $values['base'] = null;
500
-            				    $values['owner'] = $line[6];
501
-            				    $values['date_first_reg'] = null;
502
-					    $values['cancel'] = '';
498
+								$values['registration'] = $line[0];
499
+								$values['base'] = null;
500
+								$values['owner'] = $line[6];
501
+								$values['date_first_reg'] = null;
502
+						$values['cancel'] = '';
503 503
 					} elseif ($country == 'HJ') {
504
-            				    $values['registration'] = $line[0];
505
-            				    $values['base'] = null;
506
-            				    $values['owner'] = $line[8];
507
-            				    if ($line[7] == '') $values['date_first_reg'] = null;
508
-					    else $values['date_first_reg'] = date("Y-m-d",strtotime($line[7]));
509
-					    $values['cancel'] = '';
504
+								$values['registration'] = $line[0];
505
+								$values['base'] = null;
506
+								$values['owner'] = $line[8];
507
+								if ($line[7] == '') $values['date_first_reg'] = null;
508
+						else $values['date_first_reg'] = date("Y-m-d",strtotime($line[7]));
509
+						$values['cancel'] = '';
510 510
 					} elseif ($country == 'PP') {
511
-            				    $values['registration'] = $line[0];
512
-            				    $values['base'] = null;
513
-            				    $values['owner'] = $line[4];
514
-            				    if ($line[6] == '') $values['date_first_reg'] = null;
515
-					    else $values['date_first_reg'] = date("Y-m-d",strtotime($line[6]));
516
-					    $values['cancel'] = $line[7];
511
+								$values['registration'] = $line[0];
512
+								$values['base'] = null;
513
+								$values['owner'] = $line[4];
514
+								if ($line[6] == '') $values['date_first_reg'] = null;
515
+						else $values['date_first_reg'] = date("Y-m-d",strtotime($line[6]));
516
+						$values['cancel'] = $line[7];
517 517
 					} elseif ($country == 'E7') {
518
-            				    $values['registration'] = $line[0];
519
-            				    $values['base'] = null;
520
-            				    $values['owner'] = $line[4];
521
-            				    if ($line[5] == '') $values['date_first_reg'] = null;
522
-					    else $values['date_first_reg'] = date("Y-m-d",strtotime($line[5]));
523
-					    $values['cancel'] = '';
518
+								$values['registration'] = $line[0];
519
+								$values['base'] = null;
520
+								$values['owner'] = $line[4];
521
+								if ($line[5] == '') $values['date_first_reg'] = null;
522
+						else $values['date_first_reg'] = date("Y-m-d",strtotime($line[5]));
523
+						$values['cancel'] = '';
524 524
 					} elseif ($country == '8Q') {
525
-            				    $values['registration'] = $line[0];
526
-            				    $values['base'] = null;
527
-            				    $values['owner'] = $line[3];
528
-            				    if ($line[7] == '') $values['date_first_reg'] = null;
529
-					    else $values['date_first_reg'] = date("Y-m-d",strtotime($line[7]));
530
-					    $values['cancel'] = '';
525
+								$values['registration'] = $line[0];
526
+								$values['base'] = null;
527
+								$values['owner'] = $line[3];
528
+								if ($line[7] == '') $values['date_first_reg'] = null;
529
+						else $values['date_first_reg'] = date("Y-m-d",strtotime($line[7]));
530
+						$values['cancel'] = '';
531 531
 					} elseif ($country == 'ZK') {
532
-            				    $values['registration'] = $line[0];
533
-            				    $values['base'] = null;
534
-            				    $values['owner'] = $line[3];
535
-            				    $values['date_first_reg'] = null;
536
-					    $values['cancel'] = '';
537
-					    $values['modes'] = $line[5];
538
-					    $values['icao'] = $line[9];
532
+								$values['registration'] = $line[0];
533
+								$values['base'] = null;
534
+								$values['owner'] = $line[3];
535
+								$values['date_first_reg'] = null;
536
+						$values['cancel'] = '';
537
+						$values['modes'] = $line[5];
538
+						$values['icao'] = $line[9];
539 539
 					} elseif ($country == 'M') {
540
-            				    $values['registration'] = $line[0];
541
-            				    $values['base'] = null;
542
-            				    $values['owner'] = $line[6];
543
-            				    $values['date_first_reg'] = date("Y-m-d",strtotime($line[5]));
544
-					    $values['cancel'] = date("Y-m-d",strtotime($line[8]));
545
-					    $values['modes'] = $line[4];
546
-					    $values['icao'] = $line[10];
540
+								$values['registration'] = $line[0];
541
+								$values['base'] = null;
542
+								$values['owner'] = $line[6];
543
+								$values['date_first_reg'] = date("Y-m-d",strtotime($line[5]));
544
+						$values['cancel'] = date("Y-m-d",strtotime($line[8]));
545
+						$values['modes'] = $line[4];
546
+						$values['icao'] = $line[10];
547 547
 					} elseif ($country == 'OY') {
548
-            				    $values['registration'] = $line[0];
549
-            				    $values['date_first_reg'] = date("Y-m-d",strtotime($line[4]));
550
-					    $values['modes'] = $line[5];
551
-					    $values['icao'] = $line[6];
548
+								$values['registration'] = $line[0];
549
+								$values['date_first_reg'] = date("Y-m-d",strtotime($line[4]));
550
+						$values['modes'] = $line[5];
551
+						$values['icao'] = $line[6];
552 552
 					} elseif ($country == 'PH') {
553
-            				    $values['registration'] = $line[0];
554
-            				    $values['date_first_reg'] = date("Y-m-d",strtotime($line[3]));
555
-					    $values['modes'] = $line[4];
556
-					    $values['icao'] = $line[5];
553
+								$values['registration'] = $line[0];
554
+								$values['date_first_reg'] = date("Y-m-d",strtotime($line[3]));
555
+						$values['modes'] = $line[4];
556
+						$values['icao'] = $line[5];
557 557
 					} elseif ($country == 'OM' || $country == 'TF') {
558
-            				    $values['registration'] = $line[0];
559
-            				    $values['base'] = null;
560
-            				    $values['owner'] = $line[3];
561
-            				    $values['date_first_reg'] = null;
562
-					    $values['cancel'] = '';
558
+								$values['registration'] = $line[0];
559
+								$values['base'] = null;
560
+								$values['owner'] = $line[3];
561
+								$values['date_first_reg'] = null;
562
+						$values['cancel'] = '';
563 563
 					}
564 564
 					if (isset($values['cancel']) && $values['cancel'] == '' && $values['registration'] != null && isset($values['owner'])) {
565 565
 						$query_dest_values = array(':registration' => $values['registration'],':base' => $values['base'],':date_first_reg' => $values['date_first_reg'],':owner' => $values['owner'],':source' => $database_file);
@@ -692,7 +692,7 @@  discard block
 block discarded – undo
692 692
                         return "error : ".$e->getMessage();
693 693
                 }
694 694
                 */
695
-                /*
695
+				/*
696 696
 		$query = 'ALTER TABLE airport DROP INDEX icaoidx';
697 697
 		try {
698 698
 			$Connection = new Connection();
@@ -937,10 +937,10 @@  discard block
 block discarded – undo
937 937
 		try {
938 938
 			$Connection = new Connection();
939 939
 			$sth = $Connection->db->prepare($query);
940
-                        $sth->execute(array(':source' => 'translation.csv'));
941
-                } catch(PDOException $e) {
942
-                        return "error : ".$e->getMessage();
943
-                }
940
+						$sth->execute(array(':source' => 'translation.csv'));
941
+				} catch(PDOException $e) {
942
+						return "error : ".$e->getMessage();
943
+				}
944 944
 
945 945
 		
946 946
 		//update_db::unzip($out_file);
@@ -959,21 +959,21 @@  discard block
 block discarded – undo
959 959
 					$data = $row;
960 960
 					$operator = $data[2];
961 961
 					if ($operator != '' && is_numeric(substr(substr($operator, 0, 3), -1, 1))) {
962
-                                                $airline_array = $Spotter->getAllAirlineInfo(substr($operator, 0, 2));
963
-                                                //echo substr($operator, 0, 2)."\n";;
964
-                                                if (count($airline_array) > 0) {
962
+												$airline_array = $Spotter->getAllAirlineInfo(substr($operator, 0, 2));
963
+												//echo substr($operator, 0, 2)."\n";;
964
+												if (count($airline_array) > 0) {
965 965
 							//print_r($airline_array);
966 966
 							$operator = $airline_array[0]['icao'].substr($operator,2);
967
-                                                }
968
-                                        }
967
+												}
968
+										}
969 969
 					
970 970
 					$operator_correct = $data[3];
971 971
 					if ($operator_correct != '' && is_numeric(substr(substr($operator_correct, 0, 3), -1, 1))) {
972
-                                                $airline_array = $Spotter->getAllAirlineInfo(substr($operator_correct, 0, 2));
973
-                                                if (count($airline_array) > 0) {
974
-                                            		$operator_correct = $airline_array[0]['icao'].substr($operator_correct,2);
975
-                                            	}
976
-                                        }
972
+												$airline_array = $Spotter->getAllAirlineInfo(substr($operator_correct, 0, 2));
973
+												if (count($airline_array) > 0) {
974
+													$operator_correct = $airline_array[0]['icao'].substr($operator_correct,2);
975
+												}
976
+										}
977 977
 					$query = 'INSERT INTO translation (Reg,Reg_correct,Operator,Operator_correct,Source) VALUES (:Reg, :Reg_correct, :Operator, :Operator_correct, :source)';
978 978
 					try {
979 979
 						$sth = $Connection->db->prepare($query);
@@ -987,7 +987,7 @@  discard block
 block discarded – undo
987 987
 			//$Connection->db->commit();
988 988
 		}
989 989
 		return '';
990
-        }
990
+		}
991 991
 	
992 992
 	public static function translation_fam() {
993 993
 		global $tmp_dir, $globalTransaction;
@@ -1025,7 +1025,7 @@  discard block
 block discarded – undo
1025 1025
 			//$Connection->db->commit();
1026 1026
 		}
1027 1027
 		return '';
1028
-        }
1028
+		}
1029 1029
 
1030 1030
 	public static function diagrams_fam() {
1031 1031
 		global $tmp_dir, $globalTransaction;
@@ -1051,7 +1051,7 @@  discard block
 block discarded – undo
1051 1051
 			$Connection->db->commit();
1052 1052
 		}
1053 1053
 		return '';
1054
-        }
1054
+		}
1055 1055
 
1056 1056
 	/*
1057 1057
 	* This function use FAA public data.
@@ -1063,19 +1063,19 @@  discard block
 block discarded – undo
1063 1063
 		try {
1064 1064
 			$Connection = new Connection();
1065 1065
 			$sth = $Connection->db->prepare($query);
1066
-                        $sth->execute(array(':source' => 'website_faa'));
1067
-                } catch(PDOException $e) {
1068
-                        return "error : ".$e->getMessage();
1069
-                }
1066
+						$sth->execute(array(':source' => 'website_faa'));
1067
+				} catch(PDOException $e) {
1068
+						return "error : ".$e->getMessage();
1069
+				}
1070 1070
 
1071 1071
 		$query = "DELETE FROM aircraft_owner WHERE Source = '' OR Source = :source";
1072 1072
 		try {
1073 1073
 			$Connection = new Connection();
1074 1074
 			$sth = $Connection->db->prepare($query);
1075
-                        $sth->execute(array(':source' => 'website_faa'));
1076
-                } catch(PDOException $e) {
1077
-                        return "error : ".$e->getMessage();
1078
-                }
1075
+						$sth->execute(array(':source' => 'website_faa'));
1076
+				} catch(PDOException $e) {
1077
+						return "error : ".$e->getMessage();
1078
+				}
1079 1079
 
1080 1080
 		$delimiter = ",";
1081 1081
 		$mfr = array();
@@ -1243,7 +1243,7 @@  discard block
 block discarded – undo
1243 1243
 		}
1244 1244
 		*/
1245 1245
 		return '';
1246
-        }
1246
+		}
1247 1247
         
1248 1248
 	public static function owner_fam() {
1249 1249
 		global $tmp_dir, $globalTransaction;
@@ -1251,10 +1251,10 @@  discard block
 block discarded – undo
1251 1251
 		try {
1252 1252
 			$Connection = new Connection();
1253 1253
 			$sth = $Connection->db->prepare($query);
1254
-                        $sth->execute(array(':source' => 'website_fam'));
1255
-                } catch(PDOException $e) {
1256
-                        return "error : ".$e->getMessage();
1257
-                }
1254
+						$sth->execute(array(':source' => 'website_fam'));
1255
+				} catch(PDOException $e) {
1256
+						return "error : ".$e->getMessage();
1257
+				}
1258 1258
 
1259 1259
 		$delimiter = "\t";
1260 1260
 		$Connection = new Connection();
@@ -1280,7 +1280,7 @@  discard block
 block discarded – undo
1280 1280
 			if ($globalTransaction) $Connection->db->commit();
1281 1281
 		}
1282 1282
 		return '';
1283
-        }
1283
+		}
1284 1284
 
1285 1285
 	public static function routes_fam() {
1286 1286
 		global $tmp_dir, $globalTransaction, $globalDebug;
@@ -1360,7 +1360,7 @@  discard block
 block discarded – undo
1360 1360
 			if ($globalTransaction) $Connection->db->commit();
1361 1361
 		}
1362 1362
 		return '';
1363
-        }
1363
+		}
1364 1364
 
1365 1365
 	public static function marine_identity_fam() {
1366 1366
 		global $tmp_dir, $globalTransaction;
@@ -1368,10 +1368,10 @@  discard block
 block discarded – undo
1368 1368
 		try {
1369 1369
 			$Connection = new Connection();
1370 1370
 			$sth = $Connection->db->prepare($query);
1371
-                        $sth->execute();
1372
-                } catch(PDOException $e) {
1373
-                        return "error : ".$e->getMessage();
1374
-                }
1371
+						$sth->execute();
1372
+				} catch(PDOException $e) {
1373
+						return "error : ".$e->getMessage();
1374
+				}
1375 1375
 
1376 1376
 		
1377 1377
 		//update_db::unzip($out_file);
@@ -1401,7 +1401,7 @@  discard block
 block discarded – undo
1401 1401
 			if ($globalTransaction) $Connection->db->commit();
1402 1402
 		}
1403 1403
 		return '';
1404
-        }
1404
+		}
1405 1405
 
1406 1406
 	public static function satellite_fam() {
1407 1407
 		global $tmp_dir, $globalTransaction;
@@ -1472,7 +1472,7 @@  discard block
 block discarded – undo
1472 1472
 			if ($globalTransaction) $Connection->db->commit();
1473 1473
 		}
1474 1474
 		return '';
1475
-        }
1475
+		}
1476 1476
 
1477 1477
 	public static function tle($filename,$tletype) {
1478 1478
 		require_once(dirname(__FILE__).'/../require/class.Spotter.php');
@@ -1483,10 +1483,10 @@  discard block
 block discarded – undo
1483 1483
 		try {
1484 1484
 			$Connection = new Connection();
1485 1485
 			$sth = $Connection->db->prepare($query);
1486
-                        $sth->execute(array(':source' => $filename));
1487
-                } catch(PDOException $e) {
1488
-                        return "error : ".$e->getMessage();
1489
-                }
1486
+						$sth->execute(array(':source' => $filename));
1487
+				} catch(PDOException $e) {
1488
+						return "error : ".$e->getMessage();
1489
+				}
1490 1490
 		
1491 1491
 		$Connection = new Connection();
1492 1492
 		if (($handle = fopen($filename, 'r')) !== FALSE)
@@ -1521,7 +1521,7 @@  discard block
 block discarded – undo
1521 1521
 			//$Connection->db->commit();
1522 1522
 		}
1523 1523
 		return '';
1524
-        }
1524
+		}
1525 1525
 
1526 1526
 	public static function satellite_ucsdb($filename) {
1527 1527
 		global $tmp_dir, $globalTransaction;
@@ -1781,11 +1781,11 @@  discard block
 block discarded – undo
1781 1781
 							try {
1782 1782
 								$sth = $Connection->db->prepare($query);
1783 1783
 								$sth->execute(array(
1784
-								    ':name' => $result['name'], ':name_alternate' => '', ':country_un' => '', ':country_owner' => $result['country_owner'], ':owner' => $result['owner'], ':users' => '', ':purpose' => '', ':purpose_detailed' => '', ':orbit' => $result['status'],
1785
-								    ':type' => '', ':longitude_geo' => NULL, ':perigee' => !empty($result['perigee']) ? $result['perigee'] : NULL, ':apogee' => !empty($result['apogee']) ? $result['apogee'] : NULL, ':eccentricity' => NULL, ':inclination' => $result['inclination'],
1786
-								    ':period' => !empty($result['period']) ? $result['period'] : NULL, ':launch_mass' => NULL, ':dry_mass' => NULL, ':power' => NULL, ':launch_date' => $result['launch_date'], ':lifetime' => $result['lifetime'], 
1787
-								    ':contractor' => '',':country_contractor' => '', ':launch_site' => $result['launch_site'], ':launch_vehicule' => '', ':cospar' => $result['cospar'], ':norad' => $result['norad'], ':comments' => '', ':source_orbital' => '', ':sources' => ''
1788
-								    )
1784
+									':name' => $result['name'], ':name_alternate' => '', ':country_un' => '', ':country_owner' => $result['country_owner'], ':owner' => $result['owner'], ':users' => '', ':purpose' => '', ':purpose_detailed' => '', ':orbit' => $result['status'],
1785
+									':type' => '', ':longitude_geo' => NULL, ':perigee' => !empty($result['perigee']) ? $result['perigee'] : NULL, ':apogee' => !empty($result['apogee']) ? $result['apogee'] : NULL, ':eccentricity' => NULL, ':inclination' => $result['inclination'],
1786
+									':period' => !empty($result['period']) ? $result['period'] : NULL, ':launch_mass' => NULL, ':dry_mass' => NULL, ':power' => NULL, ':launch_date' => $result['launch_date'], ':lifetime' => $result['lifetime'], 
1787
+									':contractor' => '',':country_contractor' => '', ':launch_site' => $result['launch_site'], ':launch_vehicule' => '', ':cospar' => $result['cospar'], ':norad' => $result['norad'], ':comments' => '', ':source_orbital' => '', ':sources' => ''
1788
+									)
1789 1789
 								);
1790 1790
 							} catch(PDOException $e) {
1791 1791
 								return "error : ".$e->getMessage();
@@ -1809,13 +1809,13 @@  discard block
 block discarded – undo
1809 1809
 			//$Connection->db->commit();
1810 1810
 		}
1811 1811
 		return '';
1812
-        }
1812
+		}
1813 1813
 
1814 1814
 	/**
1815
-        * Convert a HTML table to an array
1816
-        * @param String $data HTML page
1817
-        * @return Array array of the tables in HTML page
1818
-        */
1815
+	 * Convert a HTML table to an array
1816
+	 * @param String $data HTML page
1817
+	 * @return Array array of the tables in HTML page
1818
+	 */
1819 1819
 /*
1820 1820
         private static function table2array($data) {
1821 1821
                 $html = str_get_html($data);
@@ -1845,11 +1845,11 @@  discard block
 block discarded – undo
1845 1845
                 return(array_filter($tabledata));
1846 1846
         }
1847 1847
 */
1848
-       /**
1849
-        * Get data from form result
1850
-        * @param String $url form URL
1851
-        * @return String the result
1852
-        */
1848
+	   /**
1849
+	    * Get data from form result
1850
+	    * @param String $url form URL
1851
+	    * @return String the result
1852
+	    */
1853 1853
 /*
1854 1854
         private static function getData($url) {
1855 1855
                 $ch = curl_init();
@@ -2008,7 +2008,7 @@  discard block
 block discarded – undo
2008 2008
 			if ($globalTransaction) $Connection->db->commit();
2009 2009
 		}
2010 2010
 		return '';
2011
-        }
2011
+		}
2012 2012
 	
2013 2013
 	public static function update_airspace() {
2014 2014
 		global $tmp_dir, $globalDBdriver;
@@ -2018,11 +2018,11 @@  discard block
 block discarded – undo
2018 2018
 			$query = 'DROP TABLE airspace';
2019 2019
 			try {
2020 2020
 				$sth = $Connection->db->prepare($query);
2021
-                    		$sth->execute();
2022
-	                } catch(PDOException $e) {
2021
+							$sth->execute();
2022
+					} catch(PDOException $e) {
2023 2023
 				return "error : ".$e->getMessage();
2024
-	                }
2025
-	        }
2024
+					}
2025
+			}
2026 2026
 
2027 2027
 
2028 2028
 		if ($globalDBdriver == 'mysql') update_db::gunzip('../db/airspace.sql.gz',$tmp_dir.'airspace.sql');
@@ -2087,10 +2087,10 @@  discard block
 block discarded – undo
2087 2087
 			$query = 'DROP TABLE countries';
2088 2088
 			try {
2089 2089
 				$sth = $Connection->db->prepare($query);
2090
-            	        	$sth->execute();
2091
-	                } catch(PDOException $e) {
2092
-    	                	echo "error : ".$e->getMessage();
2093
-	                }
2090
+							$sth->execute();
2091
+					} catch(PDOException $e) {
2092
+							echo "error : ".$e->getMessage();
2093
+					}
2094 2094
 		}
2095 2095
 		if ($globalDBdriver == 'mysql') {
2096 2096
 			update_db::gunzip('../db/countries.sql.gz',$tmp_dir.'countries.sql');
@@ -2549,7 +2549,7 @@  discard block
 block discarded – undo
2549 2549
 						$error = update_db::airlines_fam();
2550 2550
 						update_db::insert_airlines_version($airlines_md5);
2551 2551
 					} else $error = "File ".$tmp_dir.'airlines.tsv.gz'." md5 failed. Download failed.";
2552
-			    } else $error = "File ".$tmp_dir.'airlines.tsv.gz'." doesn't exist. Download failed.";
2552
+				} else $error = "File ".$tmp_dir.'airlines.tsv.gz'." doesn't exist. Download failed.";
2553 2553
 			} elseif ($globalDebug) echo "No update.";
2554 2554
 		} else $error = "File ".$tmp_dir.'airlines.tsv.gz.md5'." doesn't exist. Download failed.";
2555 2555
 		if ($error != '') {
@@ -3137,10 +3137,10 @@  discard block
 block discarded – undo
3137 3137
 		try {
3138 3138
 			$Connection = new Connection();
3139 3139
 			$sth = $Connection->db->prepare($query);
3140
-                        $sth->execute();
3141
-                } catch(PDOException $e) {
3142
-                        return "error : ".$e->getMessage();
3143
-                }
3140
+						$sth->execute();
3141
+				} catch(PDOException $e) {
3142
+						return "error : ".$e->getMessage();
3143
+				}
3144 3144
 
3145 3145
 		$error = '';
3146 3146
 		if ($globalDebug) echo "Notam : Download...";
@@ -3196,8 +3196,8 @@  discard block
 block discarded – undo
3196 3196
 					$data['date_end'] = date("Y-m-d H:i:s",strtotime($to));
3197 3197
 					$data['permanent'] = 0;
3198 3198
 				} else {
3199
-				    $data['date_end'] = NULL;
3200
-				    $data['permanent'] = 1;
3199
+					$data['date_end'] = NULL;
3200
+					$data['permanent'] = 1;
3201 3201
 				}
3202 3202
 				$data['full_notam'] = $notam['title'].'<br>'.$notam['description'];
3203 3203
 				$NOTAM = new NOTAM();
@@ -3271,13 +3271,13 @@  discard block
 block discarded – undo
3271 3271
 		try {
3272 3272
 			$Connection = new Connection();
3273 3273
 			$sth = $Connection->db->prepare($query);
3274
-                        $sth->execute();
3275
-                } catch(PDOException $e) {
3276
-                        return "error : ".$e->getMessage();
3277
-                }
3278
-                $row = $sth->fetch(PDO::FETCH_ASSOC);
3279
-                if ($row['nb'] > 0) return false;
3280
-                else return true;
3274
+						$sth->execute();
3275
+				} catch(PDOException $e) {
3276
+						return "error : ".$e->getMessage();
3277
+				}
3278
+				$row = $sth->fetch(PDO::FETCH_ASSOC);
3279
+				if ($row['nb'] > 0) return false;
3280
+				else return true;
3281 3281
 	}
3282 3282
 
3283 3283
 	public static function insert_last_update() {
@@ -3286,10 +3286,10 @@  discard block
 block discarded – undo
3286 3286
 		try {
3287 3287
 			$Connection = new Connection();
3288 3288
 			$sth = $Connection->db->prepare($query);
3289
-                        $sth->execute();
3290
-                } catch(PDOException $e) {
3291
-                        return "error : ".$e->getMessage();
3292
-                }
3289
+						$sth->execute();
3290
+				} catch(PDOException $e) {
3291
+						return "error : ".$e->getMessage();
3292
+				}
3293 3293
 	}
3294 3294
 
3295 3295
 	public static function check_airspace_version($version) {
@@ -3297,13 +3297,13 @@  discard block
 block discarded – undo
3297 3297
 		try {
3298 3298
 			$Connection = new Connection();
3299 3299
 			$sth = $Connection->db->prepare($query);
3300
-                        $sth->execute(array(':version' => $version));
3301
-                } catch(PDOException $e) {
3302
-                        return "error : ".$e->getMessage();
3303
-                }
3304
-                $row = $sth->fetch(PDO::FETCH_ASSOC);
3305
-                if ($row['nb'] > 0) return true;
3306
-                else return false;
3300
+						$sth->execute(array(':version' => $version));
3301
+				} catch(PDOException $e) {
3302
+						return "error : ".$e->getMessage();
3303
+				}
3304
+				$row = $sth->fetch(PDO::FETCH_ASSOC);
3305
+				if ($row['nb'] > 0) return true;
3306
+				else return false;
3307 3307
 	}
3308 3308
 
3309 3309
 	public static function check_geoid_version($version) {
@@ -3311,13 +3311,13 @@  discard block
 block discarded – undo
3311 3311
 		try {
3312 3312
 			$Connection = new Connection();
3313 3313
 			$sth = $Connection->db->prepare($query);
3314
-                        $sth->execute(array(':version' => $version));
3315
-                } catch(PDOException $e) {
3316
-                        return "error : ".$e->getMessage();
3317
-                }
3318
-                $row = $sth->fetch(PDO::FETCH_ASSOC);
3319
-                if ($row['nb'] > 0) return true;
3320
-                else return false;
3314
+						$sth->execute(array(':version' => $version));
3315
+				} catch(PDOException $e) {
3316
+						return "error : ".$e->getMessage();
3317
+				}
3318
+				$row = $sth->fetch(PDO::FETCH_ASSOC);
3319
+				if ($row['nb'] > 0) return true;
3320
+				else return false;
3321 3321
 	}
3322 3322
 
3323 3323
 	public static function check_marine_identity_version($version) {
@@ -3431,10 +3431,10 @@  discard block
 block discarded – undo
3431 3431
 		try {
3432 3432
 			$Connection = new Connection();
3433 3433
 			$sth = $Connection->db->prepare($query);
3434
-                        $sth->execute(array(':version' => $version));
3435
-                } catch(PDOException $e) {
3436
-                        return "error : ".$e->getMessage();
3437
-                }
3434
+						$sth->execute(array(':version' => $version));
3435
+				} catch(PDOException $e) {
3436
+						return "error : ".$e->getMessage();
3437
+				}
3438 3438
 	}
3439 3439
 
3440 3440
 	public static function insert_marine_identity_version($version) {
@@ -3482,13 +3482,13 @@  discard block
 block discarded – undo
3482 3482
 		try {
3483 3483
 			$Connection = new Connection();
3484 3484
 			$sth = $Connection->db->prepare($query);
3485
-                        $sth->execute();
3486
-                } catch(PDOException $e) {
3487
-                        return "error : ".$e->getMessage();
3488
-                }
3489
-                $row = $sth->fetch(PDO::FETCH_ASSOC);
3490
-                if ($row['nb'] > 0) return false;
3491
-                else return true;
3485
+						$sth->execute();
3486
+				} catch(PDOException $e) {
3487
+						return "error : ".$e->getMessage();
3488
+				}
3489
+				$row = $sth->fetch(PDO::FETCH_ASSOC);
3490
+				if ($row['nb'] > 0) return false;
3491
+				else return true;
3492 3492
 	}
3493 3493
 
3494 3494
 	public static function insert_last_notam_update() {
@@ -3497,10 +3497,10 @@  discard block
 block discarded – undo
3497 3497
 		try {
3498 3498
 			$Connection = new Connection();
3499 3499
 			$sth = $Connection->db->prepare($query);
3500
-                        $sth->execute();
3501
-                } catch(PDOException $e) {
3502
-                        return "error : ".$e->getMessage();
3503
-                }
3500
+						$sth->execute();
3501
+				} catch(PDOException $e) {
3502
+						return "error : ".$e->getMessage();
3503
+				}
3504 3504
 	}
3505 3505
 
3506 3506
 	public static function check_last_airspace_update() {
@@ -3513,13 +3513,13 @@  discard block
 block discarded – undo
3513 3513
 		try {
3514 3514
 			$Connection = new Connection();
3515 3515
 			$sth = $Connection->db->prepare($query);
3516
-                        $sth->execute();
3517
-                } catch(PDOException $e) {
3518
-                        return "error : ".$e->getMessage();
3519
-                }
3520
-                $row = $sth->fetch(PDO::FETCH_ASSOC);
3521
-                if ($row['nb'] > 0) return false;
3522
-                else return true;
3516
+						$sth->execute();
3517
+				} catch(PDOException $e) {
3518
+						return "error : ".$e->getMessage();
3519
+				}
3520
+				$row = $sth->fetch(PDO::FETCH_ASSOC);
3521
+				if ($row['nb'] > 0) return false;
3522
+				else return true;
3523 3523
 	}
3524 3524
 
3525 3525
 	public static function insert_last_airspace_update() {
@@ -3528,10 +3528,10 @@  discard block
 block discarded – undo
3528 3528
 		try {
3529 3529
 			$Connection = new Connection();
3530 3530
 			$sth = $Connection->db->prepare($query);
3531
-                        $sth->execute();
3532
-                } catch(PDOException $e) {
3533
-                        return "error : ".$e->getMessage();
3534
-                }
3531
+						$sth->execute();
3532
+				} catch(PDOException $e) {
3533
+						return "error : ".$e->getMessage();
3534
+				}
3535 3535
 	}
3536 3536
 
3537 3537
 	public static function check_last_geoid_update() {
@@ -3544,13 +3544,13 @@  discard block
 block discarded – undo
3544 3544
 		try {
3545 3545
 			$Connection = new Connection();
3546 3546
 			$sth = $Connection->db->prepare($query);
3547
-                        $sth->execute();
3548
-                } catch(PDOException $e) {
3549
-                        return "error : ".$e->getMessage();
3550
-                }
3551
-                $row = $sth->fetch(PDO::FETCH_ASSOC);
3552
-                if ($row['nb'] > 0) return false;
3553
-                else return true;
3547
+						$sth->execute();
3548
+				} catch(PDOException $e) {
3549
+						return "error : ".$e->getMessage();
3550
+				}
3551
+				$row = $sth->fetch(PDO::FETCH_ASSOC);
3552
+				if ($row['nb'] > 0) return false;
3553
+				else return true;
3554 3554
 	}
3555 3555
 
3556 3556
 	public static function insert_last_geoid_update() {
@@ -3559,10 +3559,10 @@  discard block
 block discarded – undo
3559 3559
 		try {
3560 3560
 			$Connection = new Connection();
3561 3561
 			$sth = $Connection->db->prepare($query);
3562
-                        $sth->execute();
3563
-                } catch(PDOException $e) {
3564
-                        return "error : ".$e->getMessage();
3565
-                }
3562
+						$sth->execute();
3563
+				} catch(PDOException $e) {
3564
+						return "error : ".$e->getMessage();
3565
+				}
3566 3566
 	}
3567 3567
 
3568 3568
 	public static function check_last_owner_update() {
@@ -3668,13 +3668,13 @@  discard block
 block discarded – undo
3668 3668
 		try {
3669 3669
 			$Connection = new Connection();
3670 3670
 			$sth = $Connection->db->prepare($query);
3671
-                        $sth->execute();
3672
-                } catch(PDOException $e) {
3673
-                        return "error : ".$e->getMessage();
3674
-                }
3675
-                $row = $sth->fetch(PDO::FETCH_ASSOC);
3676
-                if ($row['nb'] > 0) return false;
3677
-                else return true;
3671
+						$sth->execute();
3672
+				} catch(PDOException $e) {
3673
+						return "error : ".$e->getMessage();
3674
+				}
3675
+				$row = $sth->fetch(PDO::FETCH_ASSOC);
3676
+				if ($row['nb'] > 0) return false;
3677
+				else return true;
3678 3678
 	}
3679 3679
 
3680 3680
 	public static function insert_last_schedules_update() {
@@ -3854,10 +3854,10 @@  discard block
 block discarded – undo
3854 3854
 		try {
3855 3855
 			$Connection = new Connection();
3856 3856
 			$sth = $Connection->db->prepare($query);
3857
-                        $sth->execute();
3858
-                } catch(PDOException $e) {
3859
-                        return "error : ".$e->getMessage();
3860
-                }
3857
+						$sth->execute();
3858
+				} catch(PDOException $e) {
3859
+						return "error : ".$e->getMessage();
3860
+				}
3861 3861
 	}
3862 3862
 	public static function delete_duplicateowner() {
3863 3863
 		global $globalDBdriver;
@@ -3869,10 +3869,10 @@  discard block
 block discarded – undo
3869 3869
 		try {
3870 3870
 			$Connection = new Connection();
3871 3871
 			$sth = $Connection->db->prepare($query);
3872
-                        $sth->execute();
3873
-                } catch(PDOException $e) {
3874
-                        return "error : ".$e->getMessage();
3875
-                }
3872
+						$sth->execute();
3873
+				} catch(PDOException $e) {
3874
+						return "error : ".$e->getMessage();
3875
+				}
3876 3876
 	}
3877 3877
 	
3878 3878
 	public static function update_all() {
Please login to merge, or discard this patch.
Spacing   +426 added lines, -426 removed lines patch added patch discarded remove patch
@@ -26,7 +26,7 @@  discard block
 block discarded – undo
26 26
 		$ch = curl_init();
27 27
 		curl_setopt($ch, CURLOPT_URL, $url);
28 28
 		if (isset($globalForceIPv4) && $globalForceIPv4) {
29
-			if (defined('CURLOPT_IPRESOLVE') && defined('CURL_IPRESOLVE_V4')){
29
+			if (defined('CURLOPT_IPRESOLVE') && defined('CURL_IPRESOLVE_V4')) {
30 30
 				curl_setopt($ch, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4);
31 31
 			}
32 32
 		}
@@ -44,20 +44,20 @@  discard block
 block discarded – undo
44 44
 		fclose($fp);
45 45
 	}
46 46
 
47
-	public static function gunzip($in_file,$out_file_name = '') {
47
+	public static function gunzip($in_file, $out_file_name = '') {
48 48
 		//echo $in_file.' -> '.$out_file_name."\n";
49 49
 		$buffer_size = 4096; // read 4kb at a time
50 50
 		if ($out_file_name == '') $out_file_name = str_replace('.gz', '', $in_file); 
51 51
 		if ($in_file != '' && file_exists($in_file)) {
52 52
 			// PHP version of Ubuntu use gzopen64 instead of gzopen
53
-			if (function_exists('gzopen')) $file = gzopen($in_file,'rb');
54
-			elseif (function_exists('gzopen64')) $file = gzopen64($in_file,'rb');
53
+			if (function_exists('gzopen')) $file = gzopen($in_file, 'rb');
54
+			elseif (function_exists('gzopen64')) $file = gzopen64($in_file, 'rb');
55 55
 			else {
56 56
 				echo 'gzopen not available';
57 57
 				die;
58 58
 			}
59 59
 			$out_file = fopen($out_file_name, 'wb'); 
60
-			while(!gzeof($file)) {
60
+			while (!gzeof($file)) {
61 61
 				fwrite($out_file, gzread($file, $buffer_size));
62 62
 			}  
63 63
 			fclose($out_file);
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
 		try {
82 82
 			self::$db_sqlite = new PDO('sqlite:'.$database);
83 83
 			self::$db_sqlite->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
84
-		} catch(PDOException $e) {
84
+		} catch (PDOException $e) {
85 85
 			return "error : ".$e->getMessage();
86 86
 		}
87 87
 	}
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
 			//$Connection = new Connection();
97 97
 			$sth = $Connection->db->prepare($query);
98 98
                         $sth->execute(array(':source' => $database_file));
99
-                } catch(PDOException $e) {
99
+                } catch (PDOException $e) {
100 100
                         return "error : ".$e->getMessage();
101 101
                 }
102 102
 
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
 		try {
108 108
                         $sth = update_db::$db_sqlite->prepare($query);
109 109
                         $sth->execute();
110
-                } catch(PDOException $e) {
110
+                } catch (PDOException $e) {
111 111
                         return "error : ".$e->getMessage();
112 112
                 }
113 113
 		//$query_dest = 'INSERT INTO routes (`RouteID`,`CallSign`,`Operator_ICAO`,`FromAirport_ICAO`,`ToAirport_ICAO`,`RouteStop`,`Source`) VALUES (:RouteID, :CallSign, :Operator_ICAO, :FromAirport_ICAO, :ToAirport_ICAO, :routestop, :source)';
@@ -118,11 +118,11 @@  discard block
 block discarded – undo
118 118
 			if ($globalTransaction) $Connection->db->beginTransaction();
119 119
             		while ($values = $sth->fetch(PDO::FETCH_ASSOC)) {
120 120
 				//$query_dest_values = array(':RouteID' => $values['RouteId'],':CallSign' => $values['Callsign'],':Operator_ICAO' => $values['operator_icao'],':FromAirport_ICAO' => $values['FromAirportIcao'],':ToAirport_ICAO' => $values['ToAirportIcao'],':routestop' => $values['AllStop'],':source' => $database_file);
121
-				$query_dest_values = array(':CallSign' => $values['Callsign'],':Operator_ICAO' => $values['operator_icao'],':FromAirport_ICAO' => $values['FromAirportIcao'],':ToAirport_ICAO' => $values['ToAirportIcao'],':routestop' => $values['AllStop'],':source' => $database_file);
121
+				$query_dest_values = array(':CallSign' => $values['Callsign'], ':Operator_ICAO' => $values['operator_icao'], ':FromAirport_ICAO' => $values['FromAirportIcao'], ':ToAirport_ICAO' => $values['ToAirportIcao'], ':routestop' => $values['AllStop'], ':source' => $database_file);
122 122
 				$sth_dest->execute($query_dest_values);
123 123
             		}
124 124
 			if ($globalTransaction) $Connection->db->commit();
125
-		} catch(PDOException $e) {
125
+		} catch (PDOException $e) {
126 126
 			if ($globalTransaction) $Connection->db->rollBack(); 
127 127
 			return "error : ".$e->getMessage();
128 128
 		}
@@ -138,26 +138,26 @@  discard block
 block discarded – undo
138 138
 			//$Connection = new Connection();
139 139
 			$sth = $Connection->db->prepare($query);
140 140
                         $sth->execute(array(':source' => 'oneworld'));
141
-                } catch(PDOException $e) {
141
+                } catch (PDOException $e) {
142 142
                         return "error : ".$e->getMessage();
143 143
                 }
144 144
 
145 145
     		if ($globalDebug) echo " - Add routes to DB -";
146 146
 		require_once(dirname(__FILE__).'/../require/class.Spotter.php');
147 147
 		$Spotter = new Spotter();
148
-		if ($fh = fopen($database_file,"r")) {
148
+		if ($fh = fopen($database_file, "r")) {
149 149
 			$query_dest = 'INSERT INTO routes (CallSign,Operator_ICAO,FromAirport_ICAO,FromAirport_Time,ToAirport_ICAO,ToAirport_Time,RouteStop,Source) VALUES (:CallSign, :Operator_ICAO, :FromAirport_ICAO,:FromAirport_Time, :ToAirport_ICAO, :ToAirport_Time,:routestop, :source)';
150 150
 			$Connection = new Connection();
151 151
 			$sth_dest = $Connection->db->prepare($query_dest);
152 152
 			if ($globalTransaction) $Connection->db->beginTransaction();
153 153
 			while (!feof($fh)) {
154
-				$line = fgetcsv($fh,9999,',');
154
+				$line = fgetcsv($fh, 9999, ',');
155 155
 				if ($line[0] != '') {
156 156
 					if (($line[2] == '-' || ($line[2] != '-' && (strtotime($line[2]) > time()))) && ($line[3] == '-' || ($line[3] != '-' && (strtotime($line[3]) < time())))) {
157 157
 						try {
158
-							$query_dest_values = array(':CallSign' => str_replace('*','',$line[7]),':Operator_ICAO' => '',':FromAirport_ICAO' => $Spotter->getAirportICAO($line[0]),':FromAirport_Time' => $line[5],':ToAirport_ICAO' => $Spotter->getAirportICAO($line[1]),':ToAirport_Time' => $line[6],':routestop' => '',':source' => 'oneworld');
158
+							$query_dest_values = array(':CallSign' => str_replace('*', '', $line[7]), ':Operator_ICAO' => '', ':FromAirport_ICAO' => $Spotter->getAirportICAO($line[0]), ':FromAirport_Time' => $line[5], ':ToAirport_ICAO' => $Spotter->getAirportICAO($line[1]), ':ToAirport_Time' => $line[6], ':routestop' => '', ':source' => 'oneworld');
159 159
 							$sth_dest->execute($query_dest_values);
160
-						} catch(PDOException $e) {
160
+						} catch (PDOException $e) {
161 161
 							if ($globalTransaction) $Connection->db->rollBack(); 
162 162
 							return "error : ".$e->getMessage();
163 163
 						}
@@ -179,7 +179,7 @@  discard block
 block discarded – undo
179 179
 			//$Connection = new Connection();
180 180
 			$sth = $Connection->db->prepare($query);
181 181
                         $sth->execute(array(':source' => 'skyteam'));
182
-                } catch(PDOException $e) {
182
+                } catch (PDOException $e) {
183 183
                         return "error : ".$e->getMessage();
184 184
                 }
185 185
 
@@ -187,24 +187,24 @@  discard block
 block discarded – undo
187 187
 
188 188
 		require_once(dirname(__FILE__).'/../require/class.Spotter.php');
189 189
 		$Spotter = new Spotter();
190
-		if ($fh = fopen($database_file,"r")) {
190
+		if ($fh = fopen($database_file, "r")) {
191 191
 			$query_dest = 'INSERT INTO routes (CallSign,Operator_ICAO,FromAirport_ICAO,FromAirport_Time,ToAirport_ICAO,ToAirport_Time,RouteStop,Source) VALUES (:CallSign, :Operator_ICAO, :FromAirport_ICAO,:FromAirport_Time, :ToAirport_ICAO, :ToAirport_Time,:routestop, :source)';
192 192
 			$Connection = new Connection();
193 193
 			$sth_dest = $Connection->db->prepare($query_dest);
194 194
 			try {
195 195
 				if ($globalTransaction) $Connection->db->beginTransaction();
196 196
 				while (!feof($fh)) {
197
-					$line = fgetcsv($fh,9999,',');
197
+					$line = fgetcsv($fh, 9999, ',');
198 198
 					if ($line[0] != '') {
199
-						$datebe = explode('  -  ',$line[2]);
199
+						$datebe = explode('  -  ', $line[2]);
200 200
 						if (strtotime($datebe[0]) > time() && strtotime($datebe[1]) < time()) {
201
-							$query_dest_values = array(':CallSign' => str_replace('*','',$line[6]),':Operator_ICAO' => '',':FromAirport_ICAO' => $Spotter->getAirportICAO($line[0]),':FromAirport_Time' => $line[4],':ToAirport_ICAO' => $Spotter->getAirportICAO($line[1]),':ToAirport_Time' => $line[5],':routestop' => '',':source' => 'skyteam');
201
+							$query_dest_values = array(':CallSign' => str_replace('*', '', $line[6]), ':Operator_ICAO' => '', ':FromAirport_ICAO' => $Spotter->getAirportICAO($line[0]), ':FromAirport_Time' => $line[4], ':ToAirport_ICAO' => $Spotter->getAirportICAO($line[1]), ':ToAirport_Time' => $line[5], ':routestop' => '', ':source' => 'skyteam');
202 202
 							$sth_dest->execute($query_dest_values);
203 203
 						}
204 204
 					}
205 205
 				}
206 206
 				if ($globalTransaction) $Connection->db->commit();
207
-			} catch(PDOException $e) {
207
+			} catch (PDOException $e) {
208 208
 				if ($globalTransaction) $Connection->db->rollBack(); 
209 209
 				return "error : ".$e->getMessage();
210 210
 			}
@@ -219,7 +219,7 @@  discard block
 block discarded – undo
219 219
 			$Connection = new Connection();
220 220
 			$sth = $Connection->db->prepare($query);
221 221
                         $sth->execute(array(':source' => $database_file));
222
-                } catch(PDOException $e) {
222
+                } catch (PDOException $e) {
223 223
                         return "error : ".$e->getMessage();
224 224
                 }
225 225
 		$query = "DELETE FROM aircraft_owner WHERE Source = '' OR Source IS NULL OR Source = :source";
@@ -227,7 +227,7 @@  discard block
 block discarded – undo
227 227
 			$Connection = new Connection();
228 228
 			$sth = $Connection->db->prepare($query);
229 229
                         $sth->execute(array(':source' => $database_file));
230
-                } catch(PDOException $e) {
230
+                } catch (PDOException $e) {
231 231
                         return "error : ".$e->getMessage();
232 232
                 }
233 233
 
@@ -236,7 +236,7 @@  discard block
 block discarded – undo
236 236
 		try {
237 237
                         $sth = update_db::$db_sqlite->prepare($query);
238 238
                         $sth->execute();
239
-                } catch(PDOException $e) {
239
+                } catch (PDOException $e) {
240 240
                         return "error : ".$e->getMessage();
241 241
                 }
242 242
 		//$query_dest = 'INSERT INTO aircraft_modes (`AircraftID`,`FirstCreated`,`LastModified`, `ModeS`,`ModeSCountry`,`Registration`,`ICAOTypeCode`,`SerialNo`, `OperatorFlagCode`, `Manufacturer`, `Type`, `FirstRegDate`, `CurrentRegDate`, `Country`, `PreviousID`, `DeRegDate`, `Status`, `PopularName`,`GenericName`,`AircraftClass`, `Engines`, `OwnershipStatus`,`RegisteredOwners`,`MTOW`, `TotalHours`, `YearBuilt`, `CofACategory`, `CofAExpiry`, `UserNotes`, `Interested`, `UserTag`, `InfoUrl`, `PictureUrl1`, `PictureUrl2`, `PictureUrl3`, `UserBool1`, `UserBool2`, `UserBool3`, `UserBool4`, `UserBool5`, `UserString1`, `UserString2`, `UserString3`, `UserString4`, `UserString5`, `UserInt1`, `UserInt2`, `UserInt3`, `UserInt4`, `UserInt5`) VALUES (:AircraftID,:FirstCreated,:LastModified,:ModeS,:ModeSCountry,:Registration,:ICAOTypeCode,:SerialNo, :OperatorFlagCode, :Manufacturer, :Type, :FirstRegDate, :CurrentRegDate, :Country, :PreviousID, :DeRegDate, :Status, :PopularName,:GenericName,:AircraftClass, :Engines, :OwnershipStatus,:RegisteredOwners,:MTOW, :TotalHours,:YearBuilt, :CofACategory, :CofAExpiry, :UserNotes, :Interested, :UserTag, :InfoUrl, :PictureUrl1, :PictureUrl2, :PictureUrl3, :UserBool1, :UserBool2, :UserBool3, :UserBool4, :UserBool5, :UserString1, :UserString2, :UserString3, :UserString4, :UserString5, :UserInt1, :UserInt2, :UserInt3, :UserInt4, :UserInt5)';
@@ -253,15 +253,15 @@  discard block
 block discarded – undo
253 253
 			//$query_dest_values = array(':AircraftID' => $values['AircraftID'],':FirstCreated' => $values['FirstCreated'],':LastModified' => $values['LastModified'],':ModeS' => $values['ModeS'],':ModeSCountry' => $values['ModeSCountry'],':Registration' => $values['Registration'],':ICAOTypeCode' => $values['ICAOTypeCode'],':SerialNo' => $values['SerialNo'], ':OperatorFlagCode' => $values['OperatorFlagCode'], ':Manufacturer' => $values['Manufacturer'], ':Type' => $values['Type'], ':FirstRegDate' => $values['FirstRegDate'], ':CurrentRegDate' => $values['CurrentRegDate'], ':Country' => $values['Country'], ':PreviousID' => $values['PreviousID'], ':DeRegDate' => $values['DeRegDate'], ':Status' => $values['Status'], ':PopularName' => $values['PopularName'],':GenericName' => $values['GenericName'],':AircraftClass' => $values['AircraftClass'], ':Engines' => $values['Engines'], ':OwnershipStatus' => $values['OwnershipStatus'],':RegisteredOwners' => $values['RegisteredOwners'],':MTOW' => $values['MTOW'], ':TotalHours' => $values['TotalHours'],':YearBuilt' => $values['YearBuilt'], ':CofACategory' => $values['CofACategory'], ':CofAExpiry' => $values['CofAExpiry'], ':UserNotes' => $values['UserNotes'], ':Interested' => $values['Interested'], ':UserTag' => $values['UserTag'], ':InfoUrl' => $values['InfoURL'], ':PictureUrl1' => $values['PictureURL1'], ':PictureUrl2' => $values['PictureURL2'], ':PictureUrl3' => $values['PictureURL3'], ':UserBool1' => $values['UserBool1'], ':UserBool2' => $values['UserBool2'], ':UserBool3' => $values['UserBool3'], ':UserBool4' => $values['UserBool4'], ':UserBool5' => $values['UserBool5'], ':UserString1' => $values['UserString1'], ':UserString2' => $values['UserString2'], ':UserString3' => $values['UserString3'], ':UserString4' => $values['UserString4'], ':UserString5' => $values['UserString5'], ':UserInt1' => $values['UserInt1'], ':UserInt2' => $values['UserInt2'], ':UserInt3' => $values['UserInt3'], ':UserInt4' => $values['UserInt4'], ':UserInt5' => $values['UserInt5']);
254 254
 				if ($values['UserString4'] == 'M') $type = 'military';
255 255
 				else $type = null;
256
-				$query_dest_values = array(':LastModified' => $values['LastModified'],':ModeS' => $values['ModeS'],':ModeSCountry' => $values['ModeSCountry'],':Registration' => $values['Registration'],':ICAOTypeCode' => $values['ICAOTypeCode'],':source' => $database_file,':type' => $type);
256
+				$query_dest_values = array(':LastModified' => $values['LastModified'], ':ModeS' => $values['ModeS'], ':ModeSCountry' => $values['ModeSCountry'], ':Registration' => $values['Registration'], ':ICAOTypeCode' => $values['ICAOTypeCode'], ':source' => $database_file, ':type' => $type);
257 257
 				$sth_dest->execute($query_dest_values);
258 258
 				if ($values['RegisteredOwners'] != '' && $values['RegisteredOwners'] != NULL && $values['RegisteredOwners'] != 'Private') {
259
-				    $query_dest_owner_values = array(':registration' => $values['Registration'],':source' => $database_file,':owner' => $values['RegisteredOwners']);
259
+				    $query_dest_owner_values = array(':registration' => $values['Registration'], ':source' => $database_file, ':owner' => $values['RegisteredOwners']);
260 260
 				    $sth_dest_owner->execute($query_dest_owner_values);
261 261
 				}
262 262
             		}
263 263
 			if ($globalTransaction) $Connection->db->commit();
264
-		} catch(PDOException $e) {
264
+		} catch (PDOException $e) {
265 265
 			return "error : ".$e->getMessage();
266 266
 		}
267 267
 
@@ -271,7 +271,7 @@  discard block
 block discarded – undo
271 271
 			$Connection = new Connection();
272 272
 			$sth = $Connection->db->prepare($query);
273 273
                         $sth->execute(array(':source' => $database_file));
274
-                } catch(PDOException $e) {
274
+                } catch (PDOException $e) {
275 275
                         return "error : ".$e->getMessage();
276 276
                 }
277 277
 		return '';
@@ -286,11 +286,11 @@  discard block
 block discarded – undo
286 286
 			$Connection = new Connection();
287 287
 			$sth = $Connection->db->prepare($query);
288 288
                         $sth->execute(array(':source' => $database_file));
289
-                } catch(PDOException $e) {
289
+                } catch (PDOException $e) {
290 290
                         return "error : ".$e->getMessage();
291 291
                 }
292 292
 		
293
-		if ($fh = fopen($database_file,"r")) {
293
+		if ($fh = fopen($database_file, "r")) {
294 294
 			//$query_dest = 'INSERT INTO aircraft_modes (`AircraftID`,`FirstCreated`,`LastModified`, `ModeS`,`ModeSCountry`,`Registration`,`ICAOTypeCode`,`SerialNo`, `OperatorFlagCode`, `Manufacturer`, `Type`, `FirstRegDate`, `CurrentRegDate`, `Country`, `PreviousID`, `DeRegDate`, `Status`, `PopularName`,`GenericName`,`AircraftClass`, `Engines`, `OwnershipStatus`,`RegisteredOwners`,`MTOW`, `TotalHours`, `YearBuilt`, `CofACategory`, `CofAExpiry`, `UserNotes`, `Interested`, `UserTag`, `InfoUrl`, `PictureUrl1`, `PictureUrl2`, `PictureUrl3`, `UserBool1`, `UserBool2`, `UserBool3`, `UserBool4`, `UserBool5`, `UserString1`, `UserString2`, `UserString3`, `UserString4`, `UserString5`, `UserInt1`, `UserInt2`, `UserInt3`, `UserInt4`, `UserInt5`) VALUES (:AircraftID,:FirstCreated,:LastModified,:ModeS,:ModeSCountry,:Registration,:ICAOTypeCode,:SerialNo, :OperatorFlagCode, :Manufacturer, :Type, :FirstRegDate, :CurrentRegDate, :Country, :PreviousID, :DeRegDate, :Status, :PopularName,:GenericName,:AircraftClass, :Engines, :OwnershipStatus,:RegisteredOwners,:MTOW, :TotalHours,:YearBuilt, :CofACategory, :CofAExpiry, :UserNotes, :Interested, :UserTag, :InfoUrl, :PictureUrl1, :PictureUrl2, :PictureUrl3, :UserBool1, :UserBool2, :UserBool3, :UserBool4, :UserBool5, :UserString1, :UserString2, :UserString3, :UserString4, :UserString5, :UserInt1, :UserInt2, :UserInt3, :UserInt4, :UserInt5)';
295 295
 			$query_dest = 'INSERT INTO aircraft_modes (ModeS,Registration,ICAOTypeCode,Source,source_type) VALUES (:ModeS,:Registration,:ICAOTypeCode,:source,:source_type)';
296 296
 		
@@ -300,13 +300,13 @@  discard block
 block discarded – undo
300 300
 				if ($globalTransaction) $Connection->db->beginTransaction();
301 301
             			while (!feof($fh)) {
302 302
             				$values = array();
303
-            				$line = $Common->hex2str(fgets($fh,9999));
303
+            				$line = $Common->hex2str(fgets($fh, 9999));
304 304
 					//FFFFFF                     RIDEAU VALLEY SOARINGASW-20               C-FBKN MZ 123.400
305
-            				$values['ModeS'] = substr($line,0,6);
306
-            				$values['Registration'] = trim(substr($line,69,6));
307
-            				$aircraft_name = trim(substr($line,48,6));
305
+            				$values['ModeS'] = substr($line, 0, 6);
306
+            				$values['Registration'] = trim(substr($line, 69, 6));
307
+            				$aircraft_name = trim(substr($line, 48, 6));
308 308
             				// Check if we can find ICAO, else set it to GLID
309
-            				$aircraft_name_split = explode(' ',$aircraft_name);
309
+            				$aircraft_name_split = explode(' ', $aircraft_name);
310 310
             				$search_more = '';
311 311
             				if (count($aircraft_name) > 1 && strlen($aircraft_name_split[1]) > 3) $search_more .= " AND LIKE '%".$aircraft_name_split[0]."%'";
312 312
             				$query_search = "SELECT * FROM aircraft WHERE type LIKE '%".$aircraft_name."%'".$search_more;
@@ -318,20 +318,20 @@  discard block
 block discarded – undo
318 318
 	            				if (isset($result['icao']) && $result['icao'] != '') {
319 319
 	            				    $values['ICAOTypeCode'] = $result['icao'];
320 320
 	            				} 
321
-					} catch(PDOException $e) {
321
+					} catch (PDOException $e) {
322 322
 						return "error : ".$e->getMessage();
323 323
 					}
324 324
 					if (!isset($values['ICAOTypeCode'])) $values['ICAOTypeCode'] = 'GLID';
325 325
 					// Add data to db
326 326
 					if ($values['Registration'] != '' && $values['Registration'] != '0000') {
327 327
 						//$query_dest_values = array(':AircraftID' => $values['AircraftID'],':FirstCreated' => $values['FirstCreated'],':LastModified' => $values['LastModified'],':ModeS' => $values['ModeS'],':ModeSCountry' => $values['ModeSCountry'],':Registration' => $values['Registration'],':ICAOTypeCode' => $values['ICAOTypeCode'],':SerialNo' => $values['SerialNo'], ':OperatorFlagCode' => $values['OperatorFlagCode'], ':Manufacturer' => $values['Manufacturer'], ':Type' => $values['Type'], ':FirstRegDate' => $values['FirstRegDate'], ':CurrentRegDate' => $values['CurrentRegDate'], ':Country' => $values['Country'], ':PreviousID' => $values['PreviousID'], ':DeRegDate' => $values['DeRegDate'], ':Status' => $values['Status'], ':PopularName' => $values['PopularName'],':GenericName' => $values['GenericName'],':AircraftClass' => $values['AircraftClass'], ':Engines' => $values['Engines'], ':OwnershipStatus' => $values['OwnershipStatus'],':RegisteredOwners' => $values['RegisteredOwners'],':MTOW' => $values['MTOW'], ':TotalHours' => $values['TotalHours'],':YearBuilt' => $values['YearBuilt'], ':CofACategory' => $values['CofACategory'], ':CofAExpiry' => $values['CofAExpiry'], ':UserNotes' => $values['UserNotes'], ':Interested' => $values['Interested'], ':UserTag' => $values['UserTag'], ':InfoUrl' => $values['InfoURL'], ':PictureUrl1' => $values['PictureURL1'], ':PictureUrl2' => $values['PictureURL2'], ':PictureUrl3' => $values['PictureURL3'], ':UserBool1' => $values['UserBool1'], ':UserBool2' => $values['UserBool2'], ':UserBool3' => $values['UserBool3'], ':UserBool4' => $values['UserBool4'], ':UserBool5' => $values['UserBool5'], ':UserString1' => $values['UserString1'], ':UserString2' => $values['UserString2'], ':UserString3' => $values['UserString3'], ':UserString4' => $values['UserString4'], ':UserString5' => $values['UserString5'], ':UserInt1' => $values['UserInt1'], ':UserInt2' => $values['UserInt2'], ':UserInt3' => $values['UserInt3'], ':UserInt4' => $values['UserInt4'], ':UserInt5' => $values['UserInt5']);
328
-						$query_dest_values = array(':ModeS' => $values['ModeS'],':Registration' => $values['Registration'],':ICAOTypeCode' => $values['ICAOTypeCode'],':source' => $database_file,':source_type' => 'flarm');
328
+						$query_dest_values = array(':ModeS' => $values['ModeS'], ':Registration' => $values['Registration'], ':ICAOTypeCode' => $values['ICAOTypeCode'], ':source' => $database_file, ':source_type' => 'flarm');
329 329
 						//print_r($query_dest_values);
330 330
 						$sth_dest->execute($query_dest_values);
331 331
 					}
332 332
 				}
333 333
 				if ($globalTransaction) $Connection->db->commit();
334
-			} catch(PDOException $e) {
334
+			} catch (PDOException $e) {
335 335
 				return "error : ".$e->getMessage();
336 336
 			}
337 337
 		}
@@ -341,7 +341,7 @@  discard block
 block discarded – undo
341 341
 			$Connection = new Connection();
342 342
 			$sth = $Connection->db->prepare($query);
343 343
                         $sth->execute(array(':source' => $database_file));
344
-                } catch(PDOException $e) {
344
+                } catch (PDOException $e) {
345 345
                         return "error : ".$e->getMessage();
346 346
                 }
347 347
 		return '';
@@ -355,11 +355,11 @@  discard block
 block discarded – undo
355 355
 			$Connection = new Connection();
356 356
 			$sth = $Connection->db->prepare($query);
357 357
                         $sth->execute(array(':source' => $database_file));
358
-                } catch(PDOException $e) {
358
+                } catch (PDOException $e) {
359 359
                         return "error : ".$e->getMessage();
360 360
                 }
361 361
 		
362
-		if ($fh = fopen($database_file,"r")) {
362
+		if ($fh = fopen($database_file, "r")) {
363 363
 			//$query_dest = 'INSERT INTO aircraft_modes (`AircraftID`,`FirstCreated`,`LastModified`, `ModeS`,`ModeSCountry`,`Registration`,`ICAOTypeCode`,`SerialNo`, `OperatorFlagCode`, `Manufacturer`, `Type`, `FirstRegDate`, `CurrentRegDate`, `Country`, `PreviousID`, `DeRegDate`, `Status`, `PopularName`,`GenericName`,`AircraftClass`, `Engines`, `OwnershipStatus`,`RegisteredOwners`,`MTOW`, `TotalHours`, `YearBuilt`, `CofACategory`, `CofAExpiry`, `UserNotes`, `Interested`, `UserTag`, `InfoUrl`, `PictureUrl1`, `PictureUrl2`, `PictureUrl3`, `UserBool1`, `UserBool2`, `UserBool3`, `UserBool4`, `UserBool5`, `UserString1`, `UserString2`, `UserString3`, `UserString4`, `UserString5`, `UserInt1`, `UserInt2`, `UserInt3`, `UserInt4`, `UserInt5`) VALUES (:AircraftID,:FirstCreated,:LastModified,:ModeS,:ModeSCountry,:Registration,:ICAOTypeCode,:SerialNo, :OperatorFlagCode, :Manufacturer, :Type, :FirstRegDate, :CurrentRegDate, :Country, :PreviousID, :DeRegDate, :Status, :PopularName,:GenericName,:AircraftClass, :Engines, :OwnershipStatus,:RegisteredOwners,:MTOW, :TotalHours,:YearBuilt, :CofACategory, :CofAExpiry, :UserNotes, :Interested, :UserTag, :InfoUrl, :PictureUrl1, :PictureUrl2, :PictureUrl3, :UserBool1, :UserBool2, :UserBool3, :UserBool4, :UserBool5, :UserString1, :UserString2, :UserString3, :UserString4, :UserString5, :UserInt1, :UserInt2, :UserInt3, :UserInt4, :UserInt5)';
364 364
 			$query_dest = 'INSERT INTO aircraft_modes (LastModified,ModeS,Registration,ICAOTypeCode,Source,source_type) VALUES (:lastmodified,:ModeS,:Registration,:ICAOTypeCode,:source,:source_type)';
365 365
 		
@@ -367,9 +367,9 @@  discard block
 block discarded – undo
367 367
 			$sth_dest = $Connection->db->prepare($query_dest);
368 368
 			try {
369 369
 				if ($globalTransaction) $Connection->db->beginTransaction();
370
-				$tmp = fgetcsv($fh,9999,',',"'");
370
+				$tmp = fgetcsv($fh, 9999, ',', "'");
371 371
             			while (!feof($fh)) {
372
-            				$line = fgetcsv($fh,9999,',',"'");
372
+            				$line = fgetcsv($fh, 9999, ',', "'");
373 373
             				
374 374
 					//FFFFFF                     RIDEAU VALLEY SOARINGASW-20               C-FBKN MZ 123.400
375 375
 					//print_r($line);
@@ -378,7 +378,7 @@  discard block
 block discarded – undo
378 378
             				$values['ICAOTypeCode'] = '';
379 379
             				$aircraft_name = $line[2];
380 380
             				// Check if we can find ICAO, else set it to GLID
381
-            				$aircraft_name_split = explode(' ',$aircraft_name);
381
+            				$aircraft_name_split = explode(' ', $aircraft_name);
382 382
             				$search_more = '';
383 383
             				if (count($aircraft_name) > 1 && strlen($aircraft_name_split[1]) > 3) $search_more .= " AND LIKE '%".$aircraft_name_split[0]."%'";
384 384
             				$query_search = "SELECT * FROM aircraft WHERE type LIKE '%".$aircraft_name."%'".$search_more;
@@ -387,20 +387,20 @@  discard block
 block discarded – undo
387 387
                                     		$sth_search->execute();
388 388
 	            				$result = $sth_search->fetch(PDO::FETCH_ASSOC);
389 389
 	            				if (isset($result['icao']) && $result['icao'] != '') $values['ICAOTypeCode'] = $result['icao'];
390
-					} catch(PDOException $e) {
390
+					} catch (PDOException $e) {
391 391
 						return "error : ".$e->getMessage();
392 392
 					}
393 393
 					//if (!isset($values['ICAOTypeCode'])) $values['ICAOTypeCode'] = 'GLID';
394 394
 					// Add data to db
395 395
 					if ($values['Registration'] != '' && $values['Registration'] != '0000' && $values['ICAOTypeCode'] != '') {
396 396
 						//$query_dest_values = array(':AircraftID' => $values['AircraftID'],':FirstCreated' => $values['FirstCreated'],':LastModified' => $values['LastModified'],':ModeS' => $values['ModeS'],':ModeSCountry' => $values['ModeSCountry'],':Registration' => $values['Registration'],':ICAOTypeCode' => $values['ICAOTypeCode'],':SerialNo' => $values['SerialNo'], ':OperatorFlagCode' => $values['OperatorFlagCode'], ':Manufacturer' => $values['Manufacturer'], ':Type' => $values['Type'], ':FirstRegDate' => $values['FirstRegDate'], ':CurrentRegDate' => $values['CurrentRegDate'], ':Country' => $values['Country'], ':PreviousID' => $values['PreviousID'], ':DeRegDate' => $values['DeRegDate'], ':Status' => $values['Status'], ':PopularName' => $values['PopularName'],':GenericName' => $values['GenericName'],':AircraftClass' => $values['AircraftClass'], ':Engines' => $values['Engines'], ':OwnershipStatus' => $values['OwnershipStatus'],':RegisteredOwners' => $values['RegisteredOwners'],':MTOW' => $values['MTOW'], ':TotalHours' => $values['TotalHours'],':YearBuilt' => $values['YearBuilt'], ':CofACategory' => $values['CofACategory'], ':CofAExpiry' => $values['CofAExpiry'], ':UserNotes' => $values['UserNotes'], ':Interested' => $values['Interested'], ':UserTag' => $values['UserTag'], ':InfoUrl' => $values['InfoURL'], ':PictureUrl1' => $values['PictureURL1'], ':PictureUrl2' => $values['PictureURL2'], ':PictureUrl3' => $values['PictureURL3'], ':UserBool1' => $values['UserBool1'], ':UserBool2' => $values['UserBool2'], ':UserBool3' => $values['UserBool3'], ':UserBool4' => $values['UserBool4'], ':UserBool5' => $values['UserBool5'], ':UserString1' => $values['UserString1'], ':UserString2' => $values['UserString2'], ':UserString3' => $values['UserString3'], ':UserString4' => $values['UserString4'], ':UserString5' => $values['UserString5'], ':UserInt1' => $values['UserInt1'], ':UserInt2' => $values['UserInt2'], ':UserInt3' => $values['UserInt3'], ':UserInt4' => $values['UserInt4'], ':UserInt5' => $values['UserInt5']);
397
-						$query_dest_values = array(':lastmodified' => date('Y-m-d H:m:s'),':ModeS' => $values['ModeS'],':Registration' => $values['Registration'],':ICAOTypeCode' => $values['ICAOTypeCode'],':source' => $database_file,':source_type' => 'flarm');
397
+						$query_dest_values = array(':lastmodified' => date('Y-m-d H:m:s'), ':ModeS' => $values['ModeS'], ':Registration' => $values['Registration'], ':ICAOTypeCode' => $values['ICAOTypeCode'], ':source' => $database_file, ':source_type' => 'flarm');
398 398
 						//print_r($query_dest_values);
399 399
 						$sth_dest->execute($query_dest_values);
400 400
 					}
401 401
 				}
402 402
 				if ($globalTransaction) $Connection->db->commit();
403
-			} catch(PDOException $e) {
403
+			} catch (PDOException $e) {
404 404
 				return "error : ".$e->getMessage();
405 405
 			}
406 406
 		}
@@ -410,13 +410,13 @@  discard block
 block discarded – undo
410 410
 			$Connection = new Connection();
411 411
 			$sth = $Connection->db->prepare($query);
412 412
                         $sth->execute(array(':source' => $database_file));
413
-                } catch(PDOException $e) {
413
+                } catch (PDOException $e) {
414 414
                         return "error : ".$e->getMessage();
415 415
                 }
416 416
 		return '';
417 417
 	}
418 418
 
419
-	public static function retrieve_owner($database_file,$country = 'F') {
419
+	public static function retrieve_owner($database_file, $country = 'F') {
420 420
 		global $globalTransaction, $globalMasterSource;
421 421
 		//$query = 'TRUNCATE TABLE aircraft_modes';
422 422
 		$query = "DELETE FROM aircraft_owner WHERE Source = '' OR Source IS NULL OR Source = :source; DELETE FROM aircraft_modes WHERE Source = :source;";
@@ -424,12 +424,12 @@  discard block
 block discarded – undo
424 424
 			$Connection = new Connection();
425 425
 			$sth = $Connection->db->prepare($query);
426 426
                         $sth->execute(array(':source' => $database_file));
427
-                } catch(PDOException $e) {
427
+                } catch (PDOException $e) {
428 428
                         return "error : ".$e->getMessage();
429 429
                 }
430 430
 		require_once(dirname(__FILE__).'/../require/class.Spotter.php');
431 431
 		$Spotter = new Spotter();
432
-		if ($fh = fopen($database_file,"r")) {
432
+		if ($fh = fopen($database_file, "r")) {
433 433
 			//$query_dest = 'INSERT INTO aircraft_modes (`AircraftID`,`FirstCreated`,`LastModified`, `ModeS`,`ModeSCountry`,`Registration`,`ICAOTypeCode`,`SerialNo`, `OperatorFlagCode`, `Manufacturer`, `Type`, `FirstRegDate`, `CurrentRegDate`, `Country`, `PreviousID`, `DeRegDate`, `Status`, `PopularName`,`GenericName`,`AircraftClass`, `Engines`, `OwnershipStatus`,`RegisteredOwners`,`MTOW`, `TotalHours`, `YearBuilt`, `CofACategory`, `CofAExpiry`, `UserNotes`, `Interested`, `UserTag`, `InfoUrl`, `PictureUrl1`, `PictureUrl2`, `PictureUrl3`, `UserBool1`, `UserBool2`, `UserBool3`, `UserBool4`, `UserBool5`, `UserString1`, `UserString2`, `UserString3`, `UserString4`, `UserString5`, `UserInt1`, `UserInt2`, `UserInt3`, `UserInt4`, `UserInt5`) VALUES (:AircraftID,:FirstCreated,:LastModified,:ModeS,:ModeSCountry,:Registration,:ICAOTypeCode,:SerialNo, :OperatorFlagCode, :Manufacturer, :Type, :FirstRegDate, :CurrentRegDate, :Country, :PreviousID, :DeRegDate, :Status, :PopularName,:GenericName,:AircraftClass, :Engines, :OwnershipStatus,:RegisteredOwners,:MTOW, :TotalHours,:YearBuilt, :CofACategory, :CofAExpiry, :UserNotes, :Interested, :UserTag, :InfoUrl, :PictureUrl1, :PictureUrl2, :PictureUrl3, :UserBool1, :UserBool2, :UserBool3, :UserBool4, :UserBool5, :UserString1, :UserString2, :UserString3, :UserString4, :UserString5, :UserInt1, :UserInt2, :UserInt3, :UserInt4, :UserInt5)';
434 434
 			$query_dest = 'INSERT INTO aircraft_owner (registration,base,owner,date_first_reg,Source) VALUES (:registration,:base,:owner,:date_first_reg,:source)';
435 435
 		        $query_modes = 'INSERT INTO aircraft_modes (ModeS,ModeSCountry,Registration,ICAOTypeCode,Source) VALUES (:modes,:modescountry,:registration,:icaotypecode,:source)';
@@ -439,9 +439,9 @@  discard block
 block discarded – undo
439 439
 			$sth_modes = $Connection->db->prepare($query_modes);
440 440
 			try {
441 441
 				if ($globalTransaction) $Connection->db->beginTransaction();
442
-				$tmp = fgetcsv($fh,9999,',','"');
442
+				$tmp = fgetcsv($fh, 9999, ',', '"');
443 443
             			while (!feof($fh)) {
444
-            				$line = fgetcsv($fh,9999,',','"');
444
+            				$line = fgetcsv($fh, 9999, ',', '"');
445 445
             				$values = array();
446 446
             				//print_r($line);
447 447
             				if ($country == 'F') {
@@ -449,7 +449,7 @@  discard block
 block discarded – undo
449 449
             				    $values['base'] = $line[4];
450 450
             				    $values['owner'] = $line[5];
451 451
             				    if ($line[6] == '') $values['date_first_reg'] = null;
452
-					    else $values['date_first_reg'] = date("Y-m-d",strtotime($line[6]));
452
+					    else $values['date_first_reg'] = date("Y-m-d", strtotime($line[6]));
453 453
 					    $values['cancel'] = $line[7];
454 454
 					} elseif ($country == 'EI') {
455 455
 					    // TODO : add modeS & reg to aircraft_modes
@@ -457,7 +457,7 @@  discard block
 block discarded – undo
457 457
             				    $values['base'] = $line[3];
458 458
             				    $values['owner'] = $line[2];
459 459
             				    if ($line[1] == '') $values['date_first_reg'] = null;
460
-					    else $values['date_first_reg'] = date("Y-m-d",strtotime($line[1]));
460
+					    else $values['date_first_reg'] = date("Y-m-d", strtotime($line[1]));
461 461
 					    $values['cancel'] = '';
462 462
 					    $values['modes'] = $line[7];
463 463
 					    $values['icao'] = $line[8];
@@ -477,7 +477,7 @@  discard block
 block discarded – undo
477 477
             				    $values['base'] = null;
478 478
             				    $values['owner'] = $line[5];
479 479
             				    if ($line[18] == '') $values['date_first_reg'] = null;
480
-					    else $values['date_first_reg'] = date("Y-m-d",strtotime($line[18]));
480
+					    else $values['date_first_reg'] = date("Y-m-d", strtotime($line[18]));
481 481
 					    $values['cancel'] = '';
482 482
 					} elseif ($country == 'VH') {
483 483
 					    // TODO : add modeS & reg to aircraft_modes
@@ -485,7 +485,7 @@  discard block
 block discarded – undo
485 485
             				    $values['base'] = null;
486 486
             				    $values['owner'] = $line[12];
487 487
             				    if ($line[28] == '') $values['date_first_reg'] = null;
488
-					    else $values['date_first_reg'] = date("Y-m-d",strtotime($line[28]));
488
+					    else $values['date_first_reg'] = date("Y-m-d", strtotime($line[28]));
489 489
 
490 490
 					    $values['cancel'] = $line[39];
491 491
 					} elseif ($country == 'OE' || $country == '9A' || $country == 'VP' || $country == 'LX' || $country == 'P2' || $country == 'HC') {
@@ -505,28 +505,28 @@  discard block
 block discarded – undo
505 505
             				    $values['base'] = null;
506 506
             				    $values['owner'] = $line[8];
507 507
             				    if ($line[7] == '') $values['date_first_reg'] = null;
508
-					    else $values['date_first_reg'] = date("Y-m-d",strtotime($line[7]));
508
+					    else $values['date_first_reg'] = date("Y-m-d", strtotime($line[7]));
509 509
 					    $values['cancel'] = '';
510 510
 					} elseif ($country == 'PP') {
511 511
             				    $values['registration'] = $line[0];
512 512
             				    $values['base'] = null;
513 513
             				    $values['owner'] = $line[4];
514 514
             				    if ($line[6] == '') $values['date_first_reg'] = null;
515
-					    else $values['date_first_reg'] = date("Y-m-d",strtotime($line[6]));
515
+					    else $values['date_first_reg'] = date("Y-m-d", strtotime($line[6]));
516 516
 					    $values['cancel'] = $line[7];
517 517
 					} elseif ($country == 'E7') {
518 518
             				    $values['registration'] = $line[0];
519 519
             				    $values['base'] = null;
520 520
             				    $values['owner'] = $line[4];
521 521
             				    if ($line[5] == '') $values['date_first_reg'] = null;
522
-					    else $values['date_first_reg'] = date("Y-m-d",strtotime($line[5]));
522
+					    else $values['date_first_reg'] = date("Y-m-d", strtotime($line[5]));
523 523
 					    $values['cancel'] = '';
524 524
 					} elseif ($country == '8Q') {
525 525
             				    $values['registration'] = $line[0];
526 526
             				    $values['base'] = null;
527 527
             				    $values['owner'] = $line[3];
528 528
             				    if ($line[7] == '') $values['date_first_reg'] = null;
529
-					    else $values['date_first_reg'] = date("Y-m-d",strtotime($line[7]));
529
+					    else $values['date_first_reg'] = date("Y-m-d", strtotime($line[7]));
530 530
 					    $values['cancel'] = '';
531 531
 					} elseif ($country == 'ZK') {
532 532
             				    $values['registration'] = $line[0];
@@ -540,18 +540,18 @@  discard block
 block discarded – undo
540 540
             				    $values['registration'] = $line[0];
541 541
             				    $values['base'] = null;
542 542
             				    $values['owner'] = $line[6];
543
-            				    $values['date_first_reg'] = date("Y-m-d",strtotime($line[5]));
544
-					    $values['cancel'] = date("Y-m-d",strtotime($line[8]));
543
+            				    $values['date_first_reg'] = date("Y-m-d", strtotime($line[5]));
544
+					    $values['cancel'] = date("Y-m-d", strtotime($line[8]));
545 545
 					    $values['modes'] = $line[4];
546 546
 					    $values['icao'] = $line[10];
547 547
 					} elseif ($country == 'OY') {
548 548
             				    $values['registration'] = $line[0];
549
-            				    $values['date_first_reg'] = date("Y-m-d",strtotime($line[4]));
549
+            				    $values['date_first_reg'] = date("Y-m-d", strtotime($line[4]));
550 550
 					    $values['modes'] = $line[5];
551 551
 					    $values['icao'] = $line[6];
552 552
 					} elseif ($country == 'PH') {
553 553
             				    $values['registration'] = $line[0];
554
-            				    $values['date_first_reg'] = date("Y-m-d",strtotime($line[3]));
554
+            				    $values['date_first_reg'] = date("Y-m-d", strtotime($line[3]));
555 555
 					    $values['modes'] = $line[4];
556 556
 					    $values['icao'] = $line[5];
557 557
 					} elseif ($country == 'OM' || $country == 'TF') {
@@ -562,17 +562,17 @@  discard block
 block discarded – undo
562 562
 					    $values['cancel'] = '';
563 563
 					}
564 564
 					if (isset($values['cancel']) && $values['cancel'] == '' && $values['registration'] != null && isset($values['owner'])) {
565
-						$query_dest_values = array(':registration' => $values['registration'],':base' => $values['base'],':date_first_reg' => $values['date_first_reg'],':owner' => $values['owner'],':source' => $database_file);
565
+						$query_dest_values = array(':registration' => $values['registration'], ':base' => $values['base'], ':date_first_reg' => $values['date_first_reg'], ':owner' => $values['owner'], ':source' => $database_file);
566 566
 						$sth_dest->execute($query_dest_values);
567 567
 					}
568 568
 					if ($globalMasterSource && $values['registration'] != null && isset($values['modes']) && $values['modes'] != '') {
569 569
 						$modescountry = $Spotter->countryFromAircraftRegistration($values['registration']);
570
-						$query_modes_values = array(':registration' => $values['registration'],':modes' => $values['modes'],':modescountry' => $modescountry,':icaotypecode' => $values['icao'],':source' => $database_file);
570
+						$query_modes_values = array(':registration' => $values['registration'], ':modes' => $values['modes'], ':modescountry' => $modescountry, ':icaotypecode' => $values['icao'], ':source' => $database_file);
571 571
 						$sth_modes->execute($query_modes_values);
572 572
 					}
573 573
 				}
574 574
 				if ($globalTransaction) $Connection->db->commit();
575
-			} catch(PDOException $e) {
575
+			} catch (PDOException $e) {
576 576
 				return "error : ".$e->getMessage();
577 577
 			}
578 578
 		}
@@ -710,7 +710,7 @@  discard block
 block discarded – undo
710 710
 		if ($globalTransaction) $Connection->db->beginTransaction();
711 711
   
712 712
 		$i = 0;
713
-		while($row = sparql_fetch_array($result))
713
+		while ($row = sparql_fetch_array($result))
714 714
 		{
715 715
 			if ($i >= 1) {
716 716
 			//print_r($row);
@@ -730,33 +730,33 @@  discard block
 block discarded – undo
730 730
 				$row['image'] = '';
731 731
 				$row['image_thumb'] = '';
732 732
 			} else {
733
-				$image = str_replace(' ','_',$row['image']);
733
+				$image = str_replace(' ', '_', $row['image']);
734 734
 				$digest = md5($image);
735
-				$folder = $digest[0] . '/' . $digest[0] . $digest[1] . '/' . $image . '/220px-' . $image;
736
-				$row['image_thumb'] = 'http://upload.wikimedia.org/wikipedia/commons/thumb/' . $folder;
737
-				$folder = $digest[0] . '/' . $digest[0] . $digest[1] . '/' . $image;
738
-				$row['image'] = 'http://upload.wikimedia.org/wikipedia/commons/' . $folder;
735
+				$folder = $digest[0].'/'.$digest[0].$digest[1].'/'.$image.'/220px-'.$image;
736
+				$row['image_thumb'] = 'http://upload.wikimedia.org/wikipedia/commons/thumb/'.$folder;
737
+				$folder = $digest[0].'/'.$digest[0].$digest[1].'/'.$image;
738
+				$row['image'] = 'http://upload.wikimedia.org/wikipedia/commons/'.$folder;
739 739
 			}
740 740
 			
741
-			$country = explode('-',$row['country']);
741
+			$country = explode('-', $row['country']);
742 742
 			$row['country'] = $country[0];
743 743
 			
744 744
 			$row['type'] = trim($row['type']);
745
-			if ($row['type'] == 'Military: Naval Auxiliary Air Station' || $row['type'] == 'http://dbpedia.org/resource/Naval_air_station' || $row['type'] == 'Military: Naval Air Station' || $row['type'] == 'Military Northern Fleet' || $row['type'] == 'Military and industrial' || $row['type'] == 'Military: Royal Air Force station' || $row['type'] == 'http://dbpedia.org/resource/Military_airbase' || $row['type'] == 'Military: Naval air station' || preg_match('/air base/i',$row['name'])) {
745
+			if ($row['type'] == 'Military: Naval Auxiliary Air Station' || $row['type'] == 'http://dbpedia.org/resource/Naval_air_station' || $row['type'] == 'Military: Naval Air Station' || $row['type'] == 'Military Northern Fleet' || $row['type'] == 'Military and industrial' || $row['type'] == 'Military: Royal Air Force station' || $row['type'] == 'http://dbpedia.org/resource/Military_airbase' || $row['type'] == 'Military: Naval air station' || preg_match('/air base/i', $row['name'])) {
746 746
 				$row['type'] = 'military';
747 747
 			} elseif ($row['type'] == 'http://dbpedia.org/resource/Airport' || $row['type'] == 'Civil' || $row['type'] == 'Public use' || $row['type'] == 'Public' || $row['type'] == 'http://dbpedia.org/resource/Civilian' || $row['type'] == 'Public, Civilian' || $row['type'] == 'Public / Military' || $row['type'] == 'Private & Civilian' || $row['type'] == 'Civilian and Military' || $row['type'] == 'Public/military' || $row['type'] == 'Active With Few Facilities' || $row['type'] == '?ivilian' || $row['type'] == 'Civil/Military' || $row['type'] == 'NA' || $row['type'] == 'Public/Military') {
748 748
 				$row['type'] = 'small_airport';
749 749
 			}
750 750
 			
751
-			$row['city'] = urldecode(str_replace('_',' ',str_replace('http://dbpedia.org/resource/','',$row['city'])));
752
-			$query_dest_values = array(':name' => $row['name'],':iata' => $row['iata'],':icao' => $row['icao'],':latitude' => $row['latitude'],':longitude' => $row['longitude'],':altitude' => round($row['altitude']),':type' => $row['type'],':city' => $row['city'],':country' => $row['country'],':home_link' => $row['homepage'],':wikipedia_link' => $row['wikipedia_page'],':image' => $row['image'],':image_thumb' => $row['image_thumb']);
751
+			$row['city'] = urldecode(str_replace('_', ' ', str_replace('http://dbpedia.org/resource/', '', $row['city'])));
752
+			$query_dest_values = array(':name' => $row['name'], ':iata' => $row['iata'], ':icao' => $row['icao'], ':latitude' => $row['latitude'], ':longitude' => $row['longitude'], ':altitude' => round($row['altitude']), ':type' => $row['type'], ':city' => $row['city'], ':country' => $row['country'], ':home_link' => $row['homepage'], ':wikipedia_link' => $row['wikipedia_page'], ':image' => $row['image'], ':image_thumb' => $row['image_thumb']);
753 753
 			//print_r($query_dest_values);
754 754
 			
755 755
 			if ($row['icao'] != '') {
756 756
 				try {
757 757
 					$sth = $Connection->db->prepare('SELECT COUNT(*) FROM airport WHERE icao = :icao');
758 758
 					$sth->execute(array(':icao' => $row['icao']));
759
-				} catch(PDOException $e) {
759
+				} catch (PDOException $e) {
760 760
 					return "error : ".$e->getMessage();
761 761
 				}
762 762
 					if ($sth->fetchColumn() > 0) {
@@ -764,15 +764,15 @@  discard block
 block discarded – undo
764 764
 						$query = 'UPDATE airport SET type = :type WHERE icao = :icao';
765 765
 						try {
766 766
 							$sth = $Connection->db->prepare($query);
767
-							$sth->execute(array(':icao' => $row['icao'],':type' => $row['type']));
768
-						} catch(PDOException $e) {
767
+							$sth->execute(array(':icao' => $row['icao'], ':type' => $row['type']));
768
+						} catch (PDOException $e) {
769 769
 							return "error : ".$e->getMessage();
770 770
 						}
771 771
 						echo $row['icao'].' : '.$row['type']."\n";
772 772
 					} else {
773 773
 						try {
774 774
 							$sth_dest->execute($query_dest_values);
775
-						} catch(PDOException $e) {
775
+						} catch (PDOException $e) {
776 776
 							return "error : ".$e->getMessage();
777 777
 						}
778 778
 					}
@@ -823,7 +823,7 @@  discard block
 block discarded – undo
823 823
 		echo "Download data from ourairports.com...\n";
824 824
 		$delimiter = ',';
825 825
 		$out_file = $tmp_dir.'airports.csv';
826
-		update_db::download('http://ourairports.com/data/airports.csv',$out_file);
826
+		update_db::download('http://ourairports.com/data/airports.csv', $out_file);
827 827
 		if (!file_exists($out_file) || !is_readable($out_file)) return FALSE;
828 828
 		echo "Add data from ourairports.com...\n";
829 829
 
@@ -834,33 +834,33 @@  discard block
 block discarded – undo
834 834
 			//$Connection->db->beginTransaction();
835 835
 			while (($row = fgetcsv($handle, 1000, $delimiter)) !== FALSE)
836 836
 			{
837
-				if(!$header) $header = $row;
837
+				if (!$header) $header = $row;
838 838
 				else {
839 839
 					$data = array();
840 840
 					$data = array_combine($header, $row);
841 841
 					try {
842 842
 						$sth = $Connection->db->prepare('SELECT COUNT(*) FROM airport WHERE icao = :icao');
843 843
 						$sth->execute(array(':icao' => $data['ident']));
844
-					} catch(PDOException $e) {
844
+					} catch (PDOException $e) {
845 845
 						return "error : ".$e->getMessage();
846 846
 					}
847 847
 					if ($sth->fetchColumn() > 0) {
848 848
 						$query = 'UPDATE airport SET type = :type WHERE icao = :icao';
849 849
 						try {
850 850
 							$sth = $Connection->db->prepare($query);
851
-							$sth->execute(array(':icao' => $data['ident'],':type' => $data['type']));
852
-						} catch(PDOException $e) {
851
+							$sth->execute(array(':icao' => $data['ident'], ':type' => $data['type']));
852
+						} catch (PDOException $e) {
853 853
 							return "error : ".$e->getMessage();
854 854
 						}
855 855
 					} else {
856 856
 						if ($data['gps_code'] == $data['ident']) {
857 857
 						$query = "INSERT INTO airport (name,city,country,iata,icao,latitude,longitude,altitude,type,home_link,wikipedia_link)
858 858
 						    VALUES (:name, :city, :country, :iata, :icao, :latitude, :longitude, :altitude, :type, :home_link, :wikipedia_link)";
859
-						$query_values = array(':name' => $data['name'],':iata' => $data['iata_code'],':icao' => $data['gps_code'],':latitude' => $data['latitude_deg'],':longitude' => $data['longitude_deg'],':altitude' => round($data['elevation_ft']),':type' => $data['type'],':city' => $data['municipality'],':country' => $data['iso_country'],':home_link' => $data['home_link'],':wikipedia_link' => $data['wikipedia_link']);
859
+						$query_values = array(':name' => $data['name'], ':iata' => $data['iata_code'], ':icao' => $data['gps_code'], ':latitude' => $data['latitude_deg'], ':longitude' => $data['longitude_deg'], ':altitude' => round($data['elevation_ft']), ':type' => $data['type'], ':city' => $data['municipality'], ':country' => $data['iso_country'], ':home_link' => $data['home_link'], ':wikipedia_link' => $data['wikipedia_link']);
860 860
 						try {
861 861
 							$sth = $Connection->db->prepare($query);
862 862
 							$sth->execute($query_values);
863
-						} catch(PDOException $e) {
863
+						} catch (PDOException $e) {
864 864
 							return "error : ".$e->getMessage();
865 865
 						}
866 866
 						$i++;
@@ -875,7 +875,7 @@  discard block
 block discarded – undo
875 875
 		
876 876
 		echo "Download data from another free database...\n";
877 877
 		$out_file = $tmp_dir.'GlobalAirportDatabase.zip';
878
-		update_db::download('http://www.partow.net/downloads/GlobalAirportDatabase.zip',$out_file);
878
+		update_db::download('http://www.partow.net/downloads/GlobalAirportDatabase.zip', $out_file);
879 879
 		if (!file_exists($out_file) || !is_readable($out_file)) return FALSE;
880 880
 		update_db::unzip($out_file);
881 881
 		$header = NULL;
@@ -887,15 +887,15 @@  discard block
 block discarded – undo
887 887
 			//$Connection->db->beginTransaction();
888 888
 			while (($row = fgetcsv($handle, 1000, $delimiter)) !== FALSE)
889 889
 			{
890
-				if(!$header) $header = $row;
890
+				if (!$header) $header = $row;
891 891
 				else {
892 892
 					$data = $row;
893 893
 
894 894
 					$query = 'UPDATE airport SET city = :city, country = :country WHERE icao = :icao';
895 895
 					try {
896 896
 						$sth = $Connection->db->prepare($query);
897
-						$sth->execute(array(':icao' => $data[0],':city' => ucwords(strtolower($data[3])),':country' => ucwords(strtolower($data[4]))));
898
-					} catch(PDOException $e) {
897
+						$sth->execute(array(':icao' => $data[0], ':city' => ucwords(strtolower($data[3])), ':country' => ucwords(strtolower($data[4]))));
898
+					} catch (PDOException $e) {
899 899
 						return "error : ".$e->getMessage();
900 900
 					}
901 901
 				}
@@ -909,15 +909,15 @@  discard block
 block discarded – undo
909 909
 		try {
910 910
 			$sth = $Connection->db->prepare("SELECT icao FROM airport WHERE name LIKE '%Air Base%'");
911 911
 			$sth->execute();
912
-		} catch(PDOException $e) {
912
+		} catch (PDOException $e) {
913 913
 			return "error : ".$e->getMessage();
914 914
 		}
915 915
 		while ($row = $sth->fetch(PDO::FETCH_ASSOC)) {
916 916
 			$query2 = 'UPDATE airport SET type = :type WHERE icao = :icao';
917 917
 			try {
918 918
 				$sth2 = $Connection->db->prepare($query2);
919
-				$sth2->execute(array(':icao' => $row['icao'],':type' => 'military'));
920
-			} catch(PDOException $e) {
919
+				$sth2->execute(array(':icao' => $row['icao'], ':type' => 'military'));
920
+			} catch (PDOException $e) {
921 921
 				return "error : ".$e->getMessage();
922 922
 			}
923 923
 		}
@@ -938,7 +938,7 @@  discard block
 block discarded – undo
938 938
 			$Connection = new Connection();
939 939
 			$sth = $Connection->db->prepare($query);
940 940
                         $sth->execute(array(':source' => 'translation.csv'));
941
-                } catch(PDOException $e) {
941
+                } catch (PDOException $e) {
942 942
                         return "error : ".$e->getMessage();
943 943
                 }
944 944
 
@@ -955,7 +955,7 @@  discard block
 block discarded – undo
955 955
 			while (($row = fgetcsv($handle, 1000, $delimiter)) !== FALSE)
956 956
 			{
957 957
 				$i++;
958
-				if($i > 12) {
958
+				if ($i > 12) {
959 959
 					$data = $row;
960 960
 					$operator = $data[2];
961 961
 					if ($operator != '' && is_numeric(substr(substr($operator, 0, 3), -1, 1))) {
@@ -963,7 +963,7 @@  discard block
 block discarded – undo
963 963
                                                 //echo substr($operator, 0, 2)."\n";;
964 964
                                                 if (count($airline_array) > 0) {
965 965
 							//print_r($airline_array);
966
-							$operator = $airline_array[0]['icao'].substr($operator,2);
966
+							$operator = $airline_array[0]['icao'].substr($operator, 2);
967 967
                                                 }
968 968
                                         }
969 969
 					
@@ -971,14 +971,14 @@  discard block
 block discarded – undo
971 971
 					if ($operator_correct != '' && is_numeric(substr(substr($operator_correct, 0, 3), -1, 1))) {
972 972
                                                 $airline_array = $Spotter->getAllAirlineInfo(substr($operator_correct, 0, 2));
973 973
                                                 if (count($airline_array) > 0) {
974
-                                            		$operator_correct = $airline_array[0]['icao'].substr($operator_correct,2);
974
+                                            		$operator_correct = $airline_array[0]['icao'].substr($operator_correct, 2);
975 975
                                             	}
976 976
                                         }
977 977
 					$query = 'INSERT INTO translation (Reg,Reg_correct,Operator,Operator_correct,Source) VALUES (:Reg, :Reg_correct, :Operator, :Operator_correct, :source)';
978 978
 					try {
979 979
 						$sth = $Connection->db->prepare($query);
980
-						$sth->execute(array(':Reg' => $data[0],':Reg_correct' => $data[1],':Operator' => $operator,':Operator_correct' => $operator_correct, ':source' => 'translation.csv'));
981
-					} catch(PDOException $e) {
980
+						$sth->execute(array(':Reg' => $data[0], ':Reg_correct' => $data[1], ':Operator' => $operator, ':Operator_correct' => $operator_correct, ':source' => 'translation.csv'));
981
+					} catch (PDOException $e) {
982 982
 						return "error : ".$e->getMessage();
983 983
 					}
984 984
 				}
@@ -996,7 +996,7 @@  discard block
 block discarded – undo
996 996
 			$Connection = new Connection();
997 997
 			$sth = $Connection->db->prepare($query);
998 998
 			$sth->execute(array(':source' => 'website_fam'));
999
-		} catch(PDOException $e) {
999
+		} catch (PDOException $e) {
1000 1000
 			return "error : ".$e->getMessage();
1001 1001
 		}
1002 1002
 		//update_db::unzip($out_file);
@@ -1014,8 +1014,8 @@  discard block
 block discarded – undo
1014 1014
 					$query = 'INSERT INTO translation (Reg,Reg_correct,Operator,Operator_correct,Source) VALUES (:Reg, :Reg_correct, :Operator, :Operator_correct, :source)';
1015 1015
 					try {
1016 1016
 						$sth = $Connection->db->prepare($query);
1017
-						$sth->execute(array(':Reg' => $data[0],':Reg_correct' => $data[1],':Operator' => $data[2],':Operator_correct' => $data[3], ':source' => 'website_fam'));
1018
-					} catch(PDOException $e) {
1017
+						$sth->execute(array(':Reg' => $data[0], ':Reg_correct' => $data[1], ':Operator' => $data[2], ':Operator_correct' => $data[3], ':source' => 'website_fam'));
1018
+					} catch (PDOException $e) {
1019 1019
 						return "error : ".$e->getMessage();
1020 1020
 					}
1021 1021
 				}
@@ -1037,11 +1037,11 @@  discard block
 block discarded – undo
1037 1037
 			while (($data = fgetcsv($handle, 1000, $delimiter)) !== FALSE)
1038 1038
 			{
1039 1039
 				$query = 'UPDATE airport SET diagram_pdf = :diagrampdf, diagram_png = :diagrampng WHERE icao = :icao';
1040
-				$icao = str_replace('.pdf','',$data[2]);
1040
+				$icao = str_replace('.pdf', '', $data[2]);
1041 1041
 				try {
1042 1042
 					$sth = $Connection->db->prepare($query);
1043
-					$sth->execute(array(':icao' => $icao,':diagrampdf' => 'https://data.flightairmap.com/data/diagrams/'.$icao.'.pdf',':diagrampng' => 'https://data.flightairmap.com/data/diagrams/'.$icao.'.png'));
1044
-				} catch(PDOException $e) {
1043
+					$sth->execute(array(':icao' => $icao, ':diagrampdf' => 'https://data.flightairmap.com/data/diagrams/'.$icao.'.pdf', ':diagrampng' => 'https://data.flightairmap.com/data/diagrams/'.$icao.'.png'));
1044
+				} catch (PDOException $e) {
1045 1045
 					echo "error : ".$e->getMessage();
1046 1046
 					return "error : ".$e->getMessage();
1047 1047
 				}
@@ -1063,7 +1063,7 @@  discard block
 block discarded – undo
1063 1063
 			$Connection = new Connection();
1064 1064
 			$sth = $Connection->db->prepare($query);
1065 1065
                         $sth->execute(array(':source' => 'website_faa'));
1066
-                } catch(PDOException $e) {
1066
+                } catch (PDOException $e) {
1067 1067
                         return "error : ".$e->getMessage();
1068 1068
                 }
1069 1069
 
@@ -1072,7 +1072,7 @@  discard block
 block discarded – undo
1072 1072
 			$Connection = new Connection();
1073 1073
 			$sth = $Connection->db->prepare($query);
1074 1074
                         $sth->execute(array(':source' => 'website_faa'));
1075
-                } catch(PDOException $e) {
1075
+                } catch (PDOException $e) {
1076 1076
                         return "error : ".$e->getMessage();
1077 1077
                 }
1078 1078
 
@@ -1089,8 +1089,8 @@  discard block
 block discarded – undo
1089 1089
 					$query_search = 'SELECT icaotypecode FROM aircraft_modes WHERE registration = :registration AND Source <> :source LIMIT 1';
1090 1090
 					try {
1091 1091
 						$sths = $Connection->db->prepare($query_search);
1092
-						$sths->execute(array(':registration' => 'N'.$data[0],':source' => 'website_faa'));
1093
-					} catch(PDOException $e) {
1092
+						$sths->execute(array(':registration' => 'N'.$data[0], ':source' => 'website_faa'));
1093
+					} catch (PDOException $e) {
1094 1094
 						return "error s : ".$e->getMessage();
1095 1095
 					}
1096 1096
 					$result_search = $sths->fetchAll(PDO::FETCH_ASSOC);
@@ -1103,8 +1103,8 @@  discard block
 block discarded – undo
1103 1103
 							//}
1104 1104
 						try {
1105 1105
 							$sthi = $Connection->db->prepare($queryi);
1106
-							$sthi->execute(array(':mfr' => $data[2],':icao' => $result_search[0]['icaotypecode']));
1107
-						} catch(PDOException $e) {
1106
+							$sthi->execute(array(':mfr' => $data[2], ':icao' => $result_search[0]['icaotypecode']));
1107
+						} catch (PDOException $e) {
1108 1108
 							return "error u : ".$e->getMessage();
1109 1109
 						}
1110 1110
 					} else {
@@ -1112,7 +1112,7 @@  discard block
 block discarded – undo
1112 1112
 						try {
1113 1113
 							$sthsm = $Connection->db->prepare($query_search_mfr);
1114 1114
 							$sthsm->execute(array(':mfr' => $data[2]));
1115
-						} catch(PDOException $e) {
1115
+						} catch (PDOException $e) {
1116 1116
 							return "error mfr : ".$e->getMessage();
1117 1117
 						}
1118 1118
 						$result_search_mfr = $sthsm->fetchAll(PDO::FETCH_ASSOC);
@@ -1122,8 +1122,8 @@  discard block
 block discarded – undo
1122 1122
 							$queryf = 'INSERT INTO aircraft_modes (FirstCreated,LastModified,ModeS,ModeSCountry,Registration,ICAOTypeCode,Source) VALUES (:FirstCreated,:LastModified,:ModeS,:ModeSCountry,:Registration,:ICAOTypeCode,:source)';
1123 1123
 							try {
1124 1124
 								$sthf = $Connection->db->prepare($queryf);
1125
-								$sthf->execute(array(':FirstCreated' => $data[16],':LastModified' => $data[15],':ModeS' => $data[33],':ModeSCountry' => $data[14], ':Registration' => 'N'.$data[0],':ICAOTypeCode' => $result_search_mfr[0]['icao'],':source' => 'website_faa'));
1126
-							} catch(PDOException $e) {
1125
+								$sthf->execute(array(':FirstCreated' => $data[16], ':LastModified' => $data[15], ':ModeS' => $data[33], ':ModeSCountry' => $data[14], ':Registration' => 'N'.$data[0], ':ICAOTypeCode' => $result_search_mfr[0]['icao'], ':source' => 'website_faa'));
1126
+							} catch (PDOException $e) {
1127 1127
 								return "error f : ".$e->getMessage();
1128 1128
 							}
1129 1129
 						}
@@ -1133,13 +1133,13 @@  discard block
 block discarded – undo
1133 1133
 						$query = 'INSERT INTO aircraft_owner (registration,base,owner,date_first_reg,Source) VALUES (:registration,:base,:owner,:date_first_reg,:source)';
1134 1134
 						try {
1135 1135
 							$sth = $Connection->db->prepare($query);
1136
-							$sth->execute(array(':registration' => 'N'.$data[0],':base' => $data[9],':owner' => ucwords(strtolower($data[6])),':date_first_reg' => date('Y-m-d',strtotime($data[23])), ':source' => 'website_faa'));
1137
-						} catch(PDOException $e) {
1136
+							$sth->execute(array(':registration' => 'N'.$data[0], ':base' => $data[9], ':owner' => ucwords(strtolower($data[6])), ':date_first_reg' => date('Y-m-d', strtotime($data[23])), ':source' => 'website_faa'));
1137
+						} catch (PDOException $e) {
1138 1138
 							return "error i : ".$e->getMessage();
1139 1139
 						}
1140 1140
 					}
1141 1141
 				}
1142
-				if ($i % 90 == 0) {
1142
+				if ($i%90 == 0) {
1143 1143
 					if ($globalTransaction) $Connection->db->commit();
1144 1144
 					if ($globalTransaction) $Connection->db->beginTransaction();
1145 1145
 				}
@@ -1158,7 +1158,7 @@  discard block
 block discarded – undo
1158 1158
 			$Connection = new Connection();
1159 1159
 			$sth = $Connection->db->prepare($query);
1160 1160
 			$sth->execute(array(':source' => 'website_fam'));
1161
-		} catch(PDOException $e) {
1161
+		} catch (PDOException $e) {
1162 1162
 			return "error : ".$e->getMessage();
1163 1163
 		}
1164 1164
 		$delimiter = "\t";
@@ -1174,8 +1174,8 @@  discard block
 block discarded – undo
1174 1174
 					$query = 'INSERT INTO aircraft_modes (FirstCreated,LastModified,ModeS,ModeSCountry,Registration,ICAOTypeCode,type_flight,Source) VALUES (:FirstCreated,:LastModified,:ModeS,:ModeSCountry,:Registration,:ICAOTypeCode,:type_flight,:source)';
1175 1175
 					try {
1176 1176
 						$sth = $Connection->db->prepare($query);
1177
-						$sth->execute(array(':FirstCreated' => $data[0],':LastModified' => $data[1],':ModeS' => $data[2],':ModeSCountry' => $data[3], ':Registration' => $data[4],':ICAOTypeCode' => $data[5],':type_flight' => $data[6],':source' => 'website_fam'));
1178
-					} catch(PDOException $e) {
1177
+						$sth->execute(array(':FirstCreated' => $data[0], ':LastModified' => $data[1], ':ModeS' => $data[2], ':ModeSCountry' => $data[3], ':Registration' => $data[4], ':ICAOTypeCode' => $data[5], ':type_flight' => $data[6], ':source' => 'website_fam'));
1178
+					} catch (PDOException $e) {
1179 1179
 						return "error : ".$e->getMessage();
1180 1180
 					}
1181 1181
 				}
@@ -1207,7 +1207,7 @@  discard block
 block discarded – undo
1207 1207
 		try {
1208 1208
 			$sth = $Connection->db->prepare($query);
1209 1209
 			$sth->execute();
1210
-		} catch(PDOException $e) {
1210
+		} catch (PDOException $e) {
1211 1211
 			return "error : ".$e->getMessage();
1212 1212
 		}
1213 1213
 		$delimiter = "\t";
@@ -1222,8 +1222,8 @@  discard block
 block discarded – undo
1222 1222
 					$query = 'INSERT INTO airlines (airline_id,name,alias,iata,icao,callsign,country,active,type,home_link,wikipedia_link,alliance,ban_eu) VALUES (0,:name,:alias,:iata,:icao,:callsign,:country,:active,:type,:home,:wikipedia_link,:alliance,:ban_eu)';
1223 1223
 					try {
1224 1224
 						$sth = $Connection->db->prepare($query);
1225
-						$sth->execute(array(':name' => $data[0],':alias' => $data[1],':iata' => $data[2],':icao' => $data[3], ':callsign' => $data[4],':country' => $data[5],':active' => $data[6],':type' => $data[7],':home' => $data[8],':wikipedia_link' => $data[9],':alliance' => $data[10],':ban_eu' => $data[11]));
1226
-					} catch(PDOException $e) {
1225
+						$sth->execute(array(':name' => $data[0], ':alias' => $data[1], ':iata' => $data[2], ':icao' => $data[3], ':callsign' => $data[4], ':country' => $data[5], ':active' => $data[6], ':type' => $data[7], ':home' => $data[8], ':wikipedia_link' => $data[9], ':alliance' => $data[10], ':ban_eu' => $data[11]));
1226
+					} catch (PDOException $e) {
1227 1227
 						return "error : ".$e->getMessage();
1228 1228
 					}
1229 1229
 				}
@@ -1251,7 +1251,7 @@  discard block
 block discarded – undo
1251 1251
 			$Connection = new Connection();
1252 1252
 			$sth = $Connection->db->prepare($query);
1253 1253
                         $sth->execute(array(':source' => 'website_fam'));
1254
-                } catch(PDOException $e) {
1254
+                } catch (PDOException $e) {
1255 1255
                         return "error : ".$e->getMessage();
1256 1256
                 }
1257 1257
 
@@ -1267,8 +1267,8 @@  discard block
 block discarded – undo
1267 1267
 					$query = 'INSERT INTO aircraft_owner (registration,base,owner,date_first_reg,Source) VALUES (:registration,:base,:owner,NULL,:source)';
1268 1268
 					try {
1269 1269
 						$sth = $Connection->db->prepare($query);
1270
-						$sth->execute(array(':registration' => $data[0],':base' => $data[1],':owner' => $data[2], ':source' => 'website_fam'));
1271
-					} catch(PDOException $e) {
1270
+						$sth->execute(array(':registration' => $data[0], ':base' => $data[1], ':owner' => $data[2], ':source' => 'website_fam'));
1271
+					} catch (PDOException $e) {
1272 1272
 						//print_r($data);
1273 1273
 						return "error : ".$e->getMessage();
1274 1274
 					}
@@ -1288,7 +1288,7 @@  discard block
 block discarded – undo
1288 1288
 			$Connection = new Connection();
1289 1289
 			$sth = $Connection->db->prepare($query);
1290 1290
 			$sth->execute(array(':source' => 'website_fam'));
1291
-		} catch(PDOException $e) {
1291
+		} catch (PDOException $e) {
1292 1292
 			return "error : ".$e->getMessage();
1293 1293
 		}
1294 1294
 		$delimiter = "\t";
@@ -1304,13 +1304,13 @@  discard block
 block discarded – undo
1304 1304
 					$query = 'INSERT INTO routes (CallSign,Operator_ICAO,FromAirport_ICAO,FromAirport_Time,ToAirport_ICAO,ToAirport_Time,RouteStop,Source) VALUES (:CallSign,:Operator_ICAO,:FromAirport_ICAO,:FromAirport_Time,:ToAirport_ICAO,:ToAirport_Time,:RouteStop,:source)';
1305 1305
 					try {
1306 1306
 						$sth = $Connection->db->prepare($query);
1307
-						$sth->execute(array(':CallSign' => $data[0],':Operator_ICAO' => $data[1],':FromAirport_ICAO' => $data[2],':FromAirport_Time' => $data[3], ':ToAirport_ICAO' => $data[4],':ToAirport_Time' => $data[5],':RouteStop' => $data[6],':source' => 'website_fam'));
1308
-					} catch(PDOException $e) {
1309
-						if ($globalDebug) echo "error: ".$e->getMessage()." - data: ".implode(',',$data);
1307
+						$sth->execute(array(':CallSign' => $data[0], ':Operator_ICAO' => $data[1], ':FromAirport_ICAO' => $data[2], ':FromAirport_Time' => $data[3], ':ToAirport_ICAO' => $data[4], ':ToAirport_Time' => $data[5], ':RouteStop' => $data[6], ':source' => 'website_fam'));
1308
+					} catch (PDOException $e) {
1309
+						if ($globalDebug) echo "error: ".$e->getMessage()." - data: ".implode(',', $data);
1310 1310
 						die();
1311 1311
 					}
1312 1312
 				}
1313
-				if ($globalTransaction && $i % 2000 == 0) {
1313
+				if ($globalTransaction && $i%2000 == 0) {
1314 1314
 					$Connection->db->commit();
1315 1315
 					if ($globalDebug) echo '.';
1316 1316
 					$Connection->db->beginTransaction();
@@ -1330,7 +1330,7 @@  discard block
 block discarded – undo
1330 1330
 			$Connection = new Connection();
1331 1331
 			$sth = $Connection->db->prepare($query);
1332 1332
 			$sth->execute(array(':source' => 'website_fam'));
1333
-		} catch(PDOException $e) {
1333
+		} catch (PDOException $e) {
1334 1334
 			return "error : ".$e->getMessage();
1335 1335
 		}
1336 1336
 		$Connection = new Connection();
@@ -1343,12 +1343,12 @@  discard block
 block discarded – undo
1343 1343
 				$query = 'INSERT INTO aircraft_block (callSign,Source) VALUES (:callSign,:source)';
1344 1344
 				try {
1345 1345
 					$sth = $Connection->db->prepare($query);
1346
-					$sth->execute(array(':callSign' => trim($data),':source' => 'website_fam'));
1347
-				} catch(PDOException $e) {
1346
+					$sth->execute(array(':callSign' => trim($data), ':source' => 'website_fam'));
1347
+				} catch (PDOException $e) {
1348 1348
 					if ($globalDebug) echo "error: ".$e->getMessage()." - data: ".$data;
1349 1349
 					die();
1350 1350
 				}
1351
-				if ($globalTransaction && $i % 2000 == 0) {
1351
+				if ($globalTransaction && $i%2000 == 0) {
1352 1352
 					$Connection->db->commit();
1353 1353
 					if ($globalDebug) echo '.';
1354 1354
 					$Connection->db->beginTransaction();
@@ -1368,7 +1368,7 @@  discard block
 block discarded – undo
1368 1368
 			$Connection = new Connection();
1369 1369
 			$sth = $Connection->db->prepare($query);
1370 1370
                         $sth->execute();
1371
-                } catch(PDOException $e) {
1371
+                } catch (PDOException $e) {
1372 1372
                         return "error : ".$e->getMessage();
1373 1373
                 }
1374 1374
 
@@ -1389,8 +1389,8 @@  discard block
 block discarded – undo
1389 1389
 					$query = 'INSERT INTO marine_identity (mmsi,imo,call_sign,ship_name,length,gross_tonnage,dead_weight,width,country,engine_power,type) VALUES (:mmsi,:imo,:call_sign,:ship_name,:length,:gross_tonnage,:dead_weight,:width,:country,:engine_power,:type)';
1390 1390
 					try {
1391 1391
 						$sth = $Connection->db->prepare($query);
1392
-						$sth->execute(array(':mmsi' => $data[0],':imo' => $data[1],':call_sign' => $data[2],':ship_name' => $data[3], ':length' => $data[4],':gross_tonnage' => $data[5],':dead_weight' => $data[6],':width' => $data[7],':country' => $data[8],':engine_power' => $data[9],':type' => $data[10]));
1393
-					} catch(PDOException $e) {
1392
+						$sth->execute(array(':mmsi' => $data[0], ':imo' => $data[1], ':call_sign' => $data[2], ':ship_name' => $data[3], ':length' => $data[4], ':gross_tonnage' => $data[5], ':dead_weight' => $data[6], ':width' => $data[7], ':country' => $data[8], ':engine_power' => $data[9], ':type' => $data[10]));
1393
+					} catch (PDOException $e) {
1394 1394
 						return "error : ".$e->getMessage();
1395 1395
 					}
1396 1396
 				}
@@ -1409,7 +1409,7 @@  discard block
 block discarded – undo
1409 1409
 			$Connection = new Connection();
1410 1410
 			$sth = $Connection->db->prepare($query);
1411 1411
 			$sth->execute();
1412
-		} catch(PDOException $e) {
1412
+		} catch (PDOException $e) {
1413 1413
 			return "error : ".$e->getMessage();
1414 1414
 		}
1415 1415
 		$delimiter = "\t";
@@ -1426,8 +1426,8 @@  discard block
 block discarded – undo
1426 1426
 					    VALUES (:name, :name_alternate, :country_un, :country_owner, :owner, :users, :purpose, :purpose_detailed, :orbit, :type, :longitude_geo, :perigee, :apogee, :eccentricity, :inclination, :period, :launch_mass, :dry_mass, :power, :launch_date, :lifetime, :contractor, :country_contractor, :launch_site, :launch_vehicule, :cospar, :norad, :comments, :source_orbital, :sources)';
1427 1427
 					try {
1428 1428
 						$sth = $Connection->db->prepare($query);
1429
-						$sth->execute(array(':name' => $data[0], ':name_alternate' => $data[1], ':country_un' => $data[2], ':country_owner' => $data[3], ':owner' => $data[4], ':users' => $data[5], ':purpose' => $data[6], ':purpose_detailed' => $data[7], ':orbit' => $data[8], ':type' => $data[9], ':longitude_geo' => $data[10], ':perigee' => !empty($data[11]) ? $data[11] : NULL, ':apogee' => !empty($data[12]) ? $data[12] : NULL, ':eccentricity' => $data[13], ':inclination' => $data[14], ':period' => !empty($data[15]) ? $data[15] : NULL, ':launch_mass' => !empty($data[16]) ? $data[16] : NULL, ':dry_mass' => !empty($data[17]) ? $data[17] : NULL, ':power' => !empty($data[18]) ? $data[18] : NULL, ':launch_date' => $data[19], ':lifetime' => $data[20], ':contractor' => $data[21],':country_contractor' => $data[22], ':launch_site' => $data[23], ':launch_vehicule' => $data[24], ':cospar' => $data[25], ':norad' => $data[26], ':comments' => $data[27], ':source_orbital' => $data[28], ':sources' => $data[29]));
1430
-					} catch(PDOException $e) {
1429
+						$sth->execute(array(':name' => $data[0], ':name_alternate' => $data[1], ':country_un' => $data[2], ':country_owner' => $data[3], ':owner' => $data[4], ':users' => $data[5], ':purpose' => $data[6], ':purpose_detailed' => $data[7], ':orbit' => $data[8], ':type' => $data[9], ':longitude_geo' => $data[10], ':perigee' => !empty($data[11]) ? $data[11] : NULL, ':apogee' => !empty($data[12]) ? $data[12] : NULL, ':eccentricity' => $data[13], ':inclination' => $data[14], ':period' => !empty($data[15]) ? $data[15] : NULL, ':launch_mass' => !empty($data[16]) ? $data[16] : NULL, ':dry_mass' => !empty($data[17]) ? $data[17] : NULL, ':power' => !empty($data[18]) ? $data[18] : NULL, ':launch_date' => $data[19], ':lifetime' => $data[20], ':contractor' => $data[21], ':country_contractor' => $data[22], ':launch_site' => $data[23], ':launch_vehicule' => $data[24], ':cospar' => $data[25], ':norad' => $data[26], ':comments' => $data[27], ':source_orbital' => $data[28], ':sources' => $data[29]));
1430
+					} catch (PDOException $e) {
1431 1431
 						return "error : ".$e->getMessage();
1432 1432
 					}
1433 1433
 				}
@@ -1446,7 +1446,7 @@  discard block
 block discarded – undo
1446 1446
 			$Connection = new Connection();
1447 1447
 			$sth = $Connection->db->prepare($query);
1448 1448
 			$sth->execute();
1449
-		} catch(PDOException $e) {
1449
+		} catch (PDOException $e) {
1450 1450
 			return "error : ".$e->getMessage();
1451 1451
 		}
1452 1452
 
@@ -1462,7 +1462,7 @@  discard block
 block discarded – undo
1462 1462
 					try {
1463 1463
 						$sth = $Connection->db->prepare($query);
1464 1464
 						$sth->execute(array(':icao' => $icao));
1465
-					} catch(PDOException $e) {
1465
+					} catch (PDOException $e) {
1466 1466
 						return "error : ".$e->getMessage();
1467 1467
 					}
1468 1468
 				}
@@ -1473,7 +1473,7 @@  discard block
 block discarded – undo
1473 1473
 		return '';
1474 1474
         }
1475 1475
 
1476
-	public static function tle($filename,$tletype) {
1476
+	public static function tle($filename, $tletype) {
1477 1477
 		require_once(dirname(__FILE__).'/../require/class.Spotter.php');
1478 1478
 		global $tmp_dir, $globalTransaction;
1479 1479
 		//$Spotter = new Spotter();
@@ -1483,7 +1483,7 @@  discard block
 block discarded – undo
1483 1483
 			$Connection = new Connection();
1484 1484
 			$sth = $Connection->db->prepare($query);
1485 1485
                         $sth->execute(array(':source' => $filename));
1486
-                } catch(PDOException $e) {
1486
+                } catch (PDOException $e) {
1487 1487
                         return "error : ".$e->getMessage();
1488 1488
                 }
1489 1489
 		
@@ -1508,8 +1508,8 @@  discard block
 block discarded – undo
1508 1508
 					$query = 'INSERT INTO tle (tle_name,tle_tle1,tle_tle2,tle_type,tle_source) VALUES (:name, :tle1, :tle2, :type, :source)';
1509 1509
 					try {
1510 1510
 						$sth = $Connection->db->prepare($query);
1511
-						$sth->execute(array(':name' => $dbdata['name'],':tle1' => $dbdata['tle1'],':tle2' => $dbdata['tle2'], ':type' => $tletype,':source' => $filename));
1512
-					} catch(PDOException $e) {
1511
+						$sth->execute(array(':name' => $dbdata['name'], ':tle1' => $dbdata['tle1'], ':tle2' => $dbdata['tle2'], ':type' => $tletype, ':source' => $filename));
1512
+					} catch (PDOException $e) {
1513 1513
 						return "error : ".$e->getMessage();
1514 1514
 					}
1515 1515
 
@@ -1530,7 +1530,7 @@  discard block
 block discarded – undo
1530 1530
 			$Connection = new Connection();
1531 1531
 			$sth = $Connection->db->prepare($query);
1532 1532
 			$sth->execute(array(':source' => $filename));
1533
-		} catch(PDOException $e) {
1533
+		} catch (PDOException $e) {
1534 1534
 			return "error : ".$e->getMessage();
1535 1535
 		}
1536 1536
 		
@@ -1541,13 +1541,13 @@  discard block
 block discarded – undo
1541 1541
 			$i = 0;
1542 1542
 			//$Connection->db->setAttribute(PDO::ATTR_AUTOCOMMIT, FALSE);
1543 1543
 			//$Connection->db->beginTransaction();
1544
-			while (($data = fgetcsv($handle, 1000,"\t")) !== FALSE)
1544
+			while (($data = fgetcsv($handle, 1000, "\t")) !== FALSE)
1545 1545
 			{
1546 1546
 				if ($i > 0 && $data[0] != '') {
1547 1547
 					$sources = trim($data[28].' '.$data[29].' '.$data[30].' '.$data[31].' '.$data[32].' '.$data[33]);
1548
-					$period = str_replace(',','',$data[14]);
1549
-					if (!empty($period) && strpos($period,'days')) $period = str_replace(' days','',$period)*24*60;
1550
-					if ($data[18] != '') $launch_date = date('Y-m-d',strtotime($data[18]));
1548
+					$period = str_replace(',', '', $data[14]);
1549
+					if (!empty($period) && strpos($period, 'days')) $period = str_replace(' days', '', $period)*24*60;
1550
+					if ($data[18] != '') $launch_date = date('Y-m-d', strtotime($data[18]));
1551 1551
 					else $launch_date = NULL;
1552 1552
 					$data = array_map(function($value) {
1553 1553
 						return trim($value) === '' ? null : $value;
@@ -1557,8 +1557,8 @@  discard block
 block discarded – undo
1557 1557
 					    VALUES (:name, :name_alternate, :country_un, :country_owner, :owner, :users, :purpose, :purpose_detailed, :orbit, :type, :longitude_geo, :perigee, :apogee, :eccentricity, :inclination, :period, :launch_mass, :dry_mass, :power, :launch_date, :lifetime, :contractor, :country_contractor, :launch_site, :launch_vehicule, :cospar, :norad, :comments, :source_orbital, :sources)';
1558 1558
 					try {
1559 1559
 						$sth = $Connection->db->prepare($query);
1560
-						$sth->execute(array(':name' => $data[0], ':name_alternate' => '', ':country_un' => $data[1], ':country_owner' => $data[2], ':owner' => $data[3], ':users' => $data[4], ':purpose' => $data[5], ':purpose_detailed' => $data[6], ':orbit' => $data[7], ':type' => $data[8], ':longitude_geo' => $data[9], ':perigee' => !empty($data[10]) ? str_replace(',','',$data[10]) : NULL, ':apogee' => !empty($data[11]) ? str_replace(',','',$data[11]) : NULL, ':eccentricity' => $data[12], ':inclination' => $data[13], ':period' => !empty($period) ? $period : NULL, ':launch_mass' => !empty($data[15]) ? str_replace(array('+',','),'',$data[15]) : NULL, ':dry_mass' => !empty($data[16]) ? str_replace(array(',','-1900',' (BOL)',' (EOL)'),'',$data[16]) : NULL, ':power' => !empty($data[17]) ? str_replace(array(',',' (BOL)',' (EOL)'),'',$data[17]) : NULL, ':launch_date' => $launch_date, ':lifetime' => $data[19], ':contractor' => $data[20],':country_contractor' => $data[21], ':launch_site' => $data[22], ':launch_vehicule' => $data[23], ':cospar' => $data[24], ':norad' => $data[25], ':comments' => $data[26], ':source_orbital' => $data[27], ':sources' => $sources));
1561
-					} catch(PDOException $e) {
1560
+						$sth->execute(array(':name' => $data[0], ':name_alternate' => '', ':country_un' => $data[1], ':country_owner' => $data[2], ':owner' => $data[3], ':users' => $data[4], ':purpose' => $data[5], ':purpose_detailed' => $data[6], ':orbit' => $data[7], ':type' => $data[8], ':longitude_geo' => $data[9], ':perigee' => !empty($data[10]) ? str_replace(',', '', $data[10]) : NULL, ':apogee' => !empty($data[11]) ? str_replace(',', '', $data[11]) : NULL, ':eccentricity' => $data[12], ':inclination' => $data[13], ':period' => !empty($period) ? $period : NULL, ':launch_mass' => !empty($data[15]) ? str_replace(array('+', ','), '', $data[15]) : NULL, ':dry_mass' => !empty($data[16]) ? str_replace(array(',', '-1900', ' (BOL)', ' (EOL)'), '', $data[16]) : NULL, ':power' => !empty($data[17]) ? str_replace(array(',', ' (BOL)', ' (EOL)'), '', $data[17]) : NULL, ':launch_date' => $launch_date, ':lifetime' => $data[19], ':contractor' => $data[20], ':country_contractor' => $data[21], ':launch_site' => $data[22], ':launch_vehicule' => $data[23], ':cospar' => $data[24], ':norad' => $data[25], ':comments' => $data[26], ':source_orbital' => $data[27], ':sources' => $sources));
1561
+					} catch (PDOException $e) {
1562 1562
 						return "error : ".$e->getMessage();
1563 1563
 					}
1564 1564
 				}
@@ -1598,7 +1598,7 @@  discard block
 block discarded – undo
1598 1598
 			'EGYP' => array('country' => 'Egypt', 'owner' => ''),
1599 1599
 			'ESA' => array('country' => 'Multinational', 'owner' => 'European Space Agency'),
1600 1600
 			'ESRO' => array('country' => 'Multinational', 'owner' => 'European Space Research Organization'),
1601
-			'EST' => array('country' => 'Estonia','owner' => ''),
1601
+			'EST' => array('country' => 'Estonia', 'owner' => ''),
1602 1602
 			'EUME' => array('country' => 'Multinational', 'owner' => 'EUMETSAT (European Organization for the Exploitation of Meteorological Satellites)'),
1603 1603
 			'EUTE' => array('country' => 'Multinational', 'owner' => 'European Telecommunications Satellite Consortium (EUTELSAT)'),
1604 1604
 			'FGER' => array('country' => 'France/Germany', 'owner' => ''),
@@ -1722,10 +1722,10 @@  discard block
 block discarded – undo
1722 1722
 			{
1723 1723
 				if ($data != '') {
1724 1724
 				$result = array();
1725
-				$result['cospar'] = trim(substr($data,0,11));
1726
-				$result['norad'] = trim(substr($data,13,6));
1727
-				$result['operational'] = trim(substr($data,21,1));
1728
-				$result['name'] = trim(substr($data,23,24));
1725
+				$result['cospar'] = trim(substr($data, 0, 11));
1726
+				$result['norad'] = trim(substr($data, 13, 6));
1727
+				$result['operational'] = trim(substr($data, 21, 1));
1728
+				$result['name'] = trim(substr($data, 23, 24));
1729 1729
 				/*
1730 1730
 				    * R/B(1) = Rocket body, first stage
1731 1731
 				    * R/B(2) = Rocket body, second stage
@@ -1737,28 +1737,28 @@  discard block
 block discarded – undo
1737 1737
 				    * An ampersand (&) indicates two or more objects are attached
1738 1738
 				*/
1739 1739
 				
1740
-				$owner_code = trim(substr($data,49,5));
1740
+				$owner_code = trim(substr($data, 49, 5));
1741 1741
 				
1742 1742
 				if (!isset($satcat_sources[$owner_code]) && $owner_code != 'TBD') {
1743 1743
 					if ($globalDebug) echo $data.'owner_code: '.$owner_code."\n";
1744 1744
 				}
1745
-				if (!isset($satcat_launch_site[trim(substr($data,68,5))])) {
1746
-					if ($globalDebug) echo 'launch_site_code: '.trim(substr($data,68,5))."\n";
1745
+				if (!isset($satcat_launch_site[trim(substr($data, 68, 5))])) {
1746
+					if ($globalDebug) echo 'launch_site_code: '.trim(substr($data, 68, 5))."\n";
1747 1747
 				}
1748 1748
 				
1749
-				if ($owner_code != 'TBD' && isset($satcat_sources[$owner_code]) && isset($satcat_launch_site[trim(substr($data,68,5))])) {
1749
+				if ($owner_code != 'TBD' && isset($satcat_sources[$owner_code]) && isset($satcat_launch_site[trim(substr($data, 68, 5))])) {
1750 1750
 					$result['country_owner'] = $satcat_sources[$owner_code]['country'];
1751 1751
 					$result['owner'] = $satcat_sources[$owner_code]['owner'];
1752
-					$result['launch_date'] = trim(substr($data,56,10));
1753
-					$launch_site_code = trim(substr($data,68,5));
1752
+					$result['launch_date'] = trim(substr($data, 56, 10));
1753
+					$launch_site_code = trim(substr($data, 68, 5));
1754 1754
 					$result['launch_site'] = $satcat_launch_site[$launch_site_code];
1755
-					$result['lifetime'] = trim(substr($data,75,10));
1756
-					$result['period'] = trim(substr($data,87,7));
1757
-					$result['inclination'] = trim(substr($data,96,5));
1758
-					$result['apogee'] = trim(substr($data,103,6));
1759
-					$result['perigee'] = trim(substr($data,111,6));
1755
+					$result['lifetime'] = trim(substr($data, 75, 10));
1756
+					$result['period'] = trim(substr($data, 87, 7));
1757
+					$result['inclination'] = trim(substr($data, 96, 5));
1758
+					$result['apogee'] = trim(substr($data, 103, 6));
1759
+					$result['perigee'] = trim(substr($data, 111, 6));
1760 1760
 					//$result['radarcross'] = trim(substr($data,119,8));
1761
-					$result['status'] = trim(substr($data,129,3));
1761
+					$result['status'] = trim(substr($data, 129, 3));
1762 1762
 					//print_r($result);
1763 1763
 					$result = array_map(function($value) {
1764 1764
 						return trim($value) === '' ? null : $value;
@@ -1771,7 +1771,7 @@  discard block
 block discarded – undo
1771 1771
 							$sth = $Connection->db->prepare($query);
1772 1772
 							$sth->execute(array(':cospar' => $result['cospar']));
1773 1773
 							$exist = $sth->fetchAll(PDO::FETCH_ASSOC);
1774
-						} catch(PDOException $e) {
1774
+						} catch (PDOException $e) {
1775 1775
 							return "error : ".$e->getMessage();
1776 1776
 						}
1777 1777
 						if (empty($exist)) {
@@ -1783,10 +1783,10 @@  discard block
 block discarded – undo
1783 1783
 								    ':name' => $result['name'], ':name_alternate' => '', ':country_un' => '', ':country_owner' => $result['country_owner'], ':owner' => $result['owner'], ':users' => '', ':purpose' => '', ':purpose_detailed' => '', ':orbit' => $result['status'],
1784 1784
 								    ':type' => '', ':longitude_geo' => NULL, ':perigee' => !empty($result['perigee']) ? $result['perigee'] : NULL, ':apogee' => !empty($result['apogee']) ? $result['apogee'] : NULL, ':eccentricity' => NULL, ':inclination' => $result['inclination'],
1785 1785
 								    ':period' => !empty($result['period']) ? $result['period'] : NULL, ':launch_mass' => NULL, ':dry_mass' => NULL, ':power' => NULL, ':launch_date' => $result['launch_date'], ':lifetime' => $result['lifetime'], 
1786
-								    ':contractor' => '',':country_contractor' => '', ':launch_site' => $result['launch_site'], ':launch_vehicule' => '', ':cospar' => $result['cospar'], ':norad' => $result['norad'], ':comments' => '', ':source_orbital' => '', ':sources' => ''
1786
+								    ':contractor' => '', ':country_contractor' => '', ':launch_site' => $result['launch_site'], ':launch_vehicule' => '', ':cospar' => $result['cospar'], ':norad' => $result['norad'], ':comments' => '', ':source_orbital' => '', ':sources' => ''
1787 1787
 								    )
1788 1788
 								);
1789
-							} catch(PDOException $e) {
1789
+							} catch (PDOException $e) {
1790 1790
 								return "error : ".$e->getMessage();
1791 1791
 							}
1792 1792
 						} elseif ($exist[0]['name'] != $result['name'] && $exist[0]['name_alternate'] != $result['name']) {
@@ -1794,8 +1794,8 @@  discard block
 block discarded – undo
1794 1794
 							try {
1795 1795
 								$Connection = new Connection();
1796 1796
 								$sth = $Connection->db->prepare($query);
1797
-								$sth->execute(array(':name_alternate' => $result['name'],':cospar' => $result['cospar']));
1798
-							} catch(PDOException $e) {
1797
+								$sth->execute(array(':name_alternate' => $result['name'], ':cospar' => $result['cospar']));
1798
+							} catch (PDOException $e) {
1799 1799
 								return "error : ".$e->getMessage();
1800 1800
 							}
1801 1801
 						}
@@ -1914,13 +1914,13 @@  discard block
 block discarded – undo
1914 1914
 			while (($row = fgetcsv($handle, 1000, $delimiter)) !== FALSE)
1915 1915
 			{
1916 1916
 				$i++;
1917
-				if($i > 3 && count($row) > 2) {
1917
+				if ($i > 3 && count($row) > 2) {
1918 1918
 					$data = array_values(array_filter($row));
1919 1919
 					$cntdata = count($data);
1920 1920
 					if ($cntdata > 10) {
1921 1921
 						$value = $data[9];
1922 1922
 						
1923
-						for ($i =10;$i < $cntdata;$i++) {
1923
+						for ($i = 10; $i < $cntdata; $i++) {
1924 1924
 							$value .= ' '.$data[$i];
1925 1925
 						}
1926 1926
 						$data[9] = $value;
@@ -1930,8 +1930,8 @@  discard block
 block discarded – undo
1930 1930
 						$query = 'INSERT INTO waypoints (name_begin,latitude_begin,longitude_begin,name_end,latitude_end,longitude_end,high,base,top,segment_name) VALUES (:name_begin, :latitude_begin, :longitude_begin, :name_end, :latitude_end, :longitude_end, :high, :base, :top, :segment_name)';
1931 1931
 						try {
1932 1932
 							$sth = $Connection->db->prepare($query);
1933
-							$sth->execute(array(':name_begin' => $data[0],':latitude_begin' => $data[1],':longitude_begin' => $data[2],':name_end' => $data[3], ':latitude_end' => $data[4], ':longitude_end' => $data[5], ':high' => $data[6], ':base' => $data[7], ':top' => $data[8], ':segment_name' => $data[9]));
1934
-						} catch(PDOException $e) {
1933
+							$sth->execute(array(':name_begin' => $data[0], ':latitude_begin' => $data[1], ':longitude_begin' => $data[2], ':name_end' => $data[3], ':latitude_end' => $data[4], ':longitude_end' => $data[5], ':high' => $data[6], ':base' => $data[7], ':top' => $data[8], ':segment_name' => $data[9]));
1934
+						} catch (PDOException $e) {
1935 1935
 							return "error : ".$e->getMessage();
1936 1936
 						}
1937 1937
 					}
@@ -1948,22 +1948,22 @@  discard block
 block discarded – undo
1948 1948
 		require_once(dirname(__FILE__).'/../require/class.Source.php');
1949 1949
 		$delimiter = ',';
1950 1950
 		$Common = new Common();
1951
-		$Common->download('http://firms.modaps.eosdis.nasa.gov/active_fire/viirs/text/VNP14IMGTDL_NRT_Global_24h.csv',$tmp_dir.'fires.csv');
1951
+		$Common->download('http://firms.modaps.eosdis.nasa.gov/active_fire/viirs/text/VNP14IMGTDL_NRT_Global_24h.csv', $tmp_dir.'fires.csv');
1952 1952
 		$Connection = new Connection();
1953 1953
 		$Source = new Source();
1954 1954
 		$Source->deleteLocationByType('fires');
1955 1955
 		$i = 0;
1956
-		if (($handle = fopen($tmp_dir.'fires.csv','r')) !== false) {
1956
+		if (($handle = fopen($tmp_dir.'fires.csv', 'r')) !== false) {
1957 1957
 			if ($globalTransaction) $Connection->db->beginTransaction();
1958
-			while (($row = fgetcsv($handle,1000)) !== false) {
1958
+			while (($row = fgetcsv($handle, 1000)) !== false) {
1959 1959
 				if ($i > 0 && $row[0] != '' && $row[8] != 'low') {
1960
-					$description = array('bright_t14' => $row[2],'scan' => $row[3],'track' => $row[4],'sat' => $row[7],'confidence' => $row[8],'version' => $row[9],'bright_t15' => $row[10],'frp' => $row[11],'daynight' => $row[12]);
1960
+					$description = array('bright_t14' => $row[2], 'scan' => $row[3], 'track' => $row[4], 'sat' => $row[7], 'confidence' => $row[8], 'version' => $row[9], 'bright_t15' => $row[10], 'frp' => $row[11], 'daynight' => $row[12]);
1961 1961
 					$query = "INSERT INTO source_location (name,latitude,longitude,altitude,country,city,logo,source,type,source_id,last_seen,location_id,description) VALUES (:name,:latitude,:longitude,:altitude,:country,:city,:logo,:source,:type,:source_id,:last_seen,:location_id,:description)";
1962
-					$query_values = array(':name' => '',':latitude' => $row[0], ':longitude' => $row[1],':altitude' => null,':city' => '',':country' => '',':logo' => 'fire.png',':source' => 'NASA',':type' => 'fires',':source_id' => 0,':last_seen' => $row[5].' '.substr($row[6],0,2).':'.substr($row[6],2,2),':location_id' => 0,':description' => json_encode($description));
1962
+					$query_values = array(':name' => '', ':latitude' => $row[0], ':longitude' => $row[1], ':altitude' => null, ':city' => '', ':country' => '', ':logo' => 'fire.png', ':source' => 'NASA', ':type' => 'fires', ':source_id' => 0, ':last_seen' => $row[5].' '.substr($row[6], 0, 2).':'.substr($row[6], 2, 2), ':location_id' => 0, ':description' => json_encode($description));
1963 1963
 					try {
1964 1964
 						$sth = $Connection->db->prepare($query);
1965 1965
 						$sth->execute($query_values);
1966
-					} catch(PDOException $e) {
1966
+					} catch (PDOException $e) {
1967 1967
 						echo "error : ".$e->getMessage();
1968 1968
 					}
1969 1969
 				}
@@ -1982,7 +1982,7 @@  discard block
 block discarded – undo
1982 1982
 			$Connection = new Connection();
1983 1983
 			$sth = $Connection->db->prepare($query);
1984 1984
 			$sth->execute();
1985
-		} catch(PDOException $e) {
1985
+		} catch (PDOException $e) {
1986 1986
 			return "error : ".$e->getMessage();
1987 1987
 		}
1988 1988
 		$header = NULL;
@@ -1993,12 +1993,12 @@  discard block
 block discarded – undo
1993 1993
 			if ($globalTransaction) $Connection->db->beginTransaction();
1994 1994
 			while (($row = fgetcsv($handle, 1000, $delimiter)) !== FALSE)
1995 1995
 			{
1996
-				if(count($row) > 1) {
1996
+				if (count($row) > 1) {
1997 1997
 					$query = "INSERT INTO airlines (name,icao,active,forsource) VALUES (:name, :icao, 'Y','ivao')";
1998 1998
 					try {
1999 1999
 						$sth = $Connection->db->prepare($query);
2000
-						$sth->execute(array(':name' => $row[1],':icao' => $row[0]));
2001
-					} catch(PDOException $e) {
2000
+						$sth->execute(array(':name' => $row[1], ':icao' => $row[0]));
2001
+					} catch (PDOException $e) {
2002 2002
 						return "error : ".$e->getMessage();
2003 2003
 					}
2004 2004
 				}
@@ -2018,21 +2018,21 @@  discard block
 block discarded – undo
2018 2018
 			try {
2019 2019
 				$sth = $Connection->db->prepare($query);
2020 2020
                     		$sth->execute();
2021
-	                } catch(PDOException $e) {
2021
+	                } catch (PDOException $e) {
2022 2022
 				return "error : ".$e->getMessage();
2023 2023
 	                }
2024 2024
 	        }
2025 2025
 
2026 2026
 
2027
-		if ($globalDBdriver == 'mysql') update_db::gunzip('../db/airspace.sql.gz',$tmp_dir.'airspace.sql');
2027
+		if ($globalDBdriver == 'mysql') update_db::gunzip('../db/airspace.sql.gz', $tmp_dir.'airspace.sql');
2028 2028
 		else {
2029
-			update_db::gunzip('../db/pgsql/airspace.sql.gz',$tmp_dir.'airspace.sql');
2029
+			update_db::gunzip('../db/pgsql/airspace.sql.gz', $tmp_dir.'airspace.sql');
2030 2030
 			$query = "CREATE EXTENSION postgis";
2031
-			$Connection = new Connection(null,null,$_SESSION['database_root'],$_SESSION['database_rootpass']);
2031
+			$Connection = new Connection(null, null, $_SESSION['database_root'], $_SESSION['database_rootpass']);
2032 2032
 			try {
2033 2033
 				$sth = $Connection->db->prepare($query);
2034 2034
 				$sth->execute();
2035
-			} catch(PDOException $e) {
2035
+			} catch (PDOException $e) {
2036 2036
 				return "error : ".$e->getMessage();
2037 2037
 			}
2038 2038
 		}
@@ -2045,13 +2045,13 @@  discard block
 block discarded – undo
2045 2045
 		include_once('class.create_db.php');
2046 2046
 		require_once(dirname(__FILE__).'/../require/class.NOTAM.php');
2047 2047
 		if ($globalDebug) echo "NOTAM from FlightAirMap website : Download...";
2048
-		update_db::download('http://data.flightairmap.com/data/notam.txt.gz.md5',$tmp_dir.'notam.txt.gz.md5');
2048
+		update_db::download('http://data.flightairmap.com/data/notam.txt.gz.md5', $tmp_dir.'notam.txt.gz.md5');
2049 2049
 		$error = '';
2050 2050
 		if (file_exists($tmp_dir.'notam.txt.gz.md5')) {
2051
-			$notam_md5_file = explode(' ',file_get_contents($tmp_dir.'notam.txt.gz.md5'));
2051
+			$notam_md5_file = explode(' ', file_get_contents($tmp_dir.'notam.txt.gz.md5'));
2052 2052
 			$notam_md5 = $notam_md5_file[0];
2053 2053
 			if (!update_db::check_notam_version($notam_md5)) {
2054
-				update_db::download('http://data.flightairmap.com/data/notam.txt.gz',$tmp_dir.'notam.txt.gz');
2054
+				update_db::download('http://data.flightairmap.com/data/notam.txt.gz', $tmp_dir.'notam.txt.gz');
2055 2055
 				if (file_exists($tmp_dir.'notam.txt.gz')) {
2056 2056
 					if (md5_file($tmp_dir.'notam.txt.gz') == $notam_md5) {
2057 2057
 						if ($globalDebug) echo "Gunzip...";
@@ -2087,14 +2087,14 @@  discard block
 block discarded – undo
2087 2087
 			try {
2088 2088
 				$sth = $Connection->db->prepare($query);
2089 2089
             	        	$sth->execute();
2090
-	                } catch(PDOException $e) {
2090
+	                } catch (PDOException $e) {
2091 2091
     	                	echo "error : ".$e->getMessage();
2092 2092
 	                }
2093 2093
 		}
2094 2094
 		if ($globalDBdriver == 'mysql') {
2095
-			update_db::gunzip('../db/countries.sql.gz',$tmp_dir.'countries.sql');
2095
+			update_db::gunzip('../db/countries.sql.gz', $tmp_dir.'countries.sql');
2096 2096
 		} else {
2097
-			update_db::gunzip('../db/pgsql/countries.sql.gz',$tmp_dir.'countries.sql');
2097
+			update_db::gunzip('../db/pgsql/countries.sql.gz', $tmp_dir.'countries.sql');
2098 2098
 		}
2099 2099
 		$error = create_db::import_file($tmp_dir.'countries.sql');
2100 2100
 		return $error;
@@ -2107,7 +2107,7 @@  discard block
 block discarded – undo
2107 2107
 //		update_db::unzip($tmp_dir.'AptNav.zip');
2108 2108
 //		update_db::download('https://gitorious.org/fg/fgdata/raw/e81f8a15424a175a7b715f8f7eb8f4147b802a27:Navaids/awy.dat.gz',$tmp_dir.'awy.dat.gz');
2109 2109
 //		update_db::download('http://sourceforge.net/p/flightgear/fgdata/ci/next/tree/Navaids/awy.dat.gz?format=raw',$tmp_dir.'awy.dat.gz','http://sourceforge.net');
2110
-		update_db::download('http://pkgs.fedoraproject.org/repo/extras/FlightGear-Atlas/awy.dat.gz/f530c9d1c4b31a288ba88dcc8224268b/awy.dat.gz',$tmp_dir.'awy.dat.gz','http://sourceforge.net');
2110
+		update_db::download('http://pkgs.fedoraproject.org/repo/extras/FlightGear-Atlas/awy.dat.gz/f530c9d1c4b31a288ba88dcc8224268b/awy.dat.gz', $tmp_dir.'awy.dat.gz', 'http://sourceforge.net');
2111 2111
 		update_db::gunzip($tmp_dir.'awy.dat.gz');
2112 2112
 		$error = update_db::waypoints($tmp_dir.'awy.dat');
2113 2113
 		return $error;
@@ -2128,7 +2128,7 @@  discard block
 block discarded – undo
2128 2128
 				update_db::ivao_airlines($tmp_dir.'data/airlines.dat');
2129 2129
 				if ($globalDebug) echo "Copy airlines logos to airlines images directory...";
2130 2130
 				if (is_writable(dirname(__FILE__).'/../images/airlines')) {
2131
-					if (!$Common->xcopy($tmp_dir.'logos/',dirname(__FILE__).'/../images/airlines/')) $error = "Failed to copy airlines logo.";
2131
+					if (!$Common->xcopy($tmp_dir.'logos/', dirname(__FILE__).'/../images/airlines/')) $error = "Failed to copy airlines logo.";
2132 2132
 				} else $error = "The directory ".dirname(__FILE__).'/../images/airlines'." must be writable";
2133 2133
 			} else $error = "File ".$tmp_dir.'ivao.zip'." doesn't exist. Download failed.";
2134 2134
 		} else $error = "ZIP module not loaded but required for IVAO.";
@@ -2142,7 +2142,7 @@  discard block
 block discarded – undo
2142 2142
 		global $tmp_dir, $globalDebug;
2143 2143
 		$error = '';
2144 2144
 		if ($globalDebug) echo "Routes : Download...";
2145
-		update_db::download('http://www.virtualradarserver.co.uk/Files/StandingData.sqb.gz',$tmp_dir.'StandingData.sqb.gz');
2145
+		update_db::download('http://www.virtualradarserver.co.uk/Files/StandingData.sqb.gz', $tmp_dir.'StandingData.sqb.gz');
2146 2146
 		if (file_exists($tmp_dir.'StandingData.sqb.gz')) {
2147 2147
 			if ($globalDebug) echo "Gunzip...";
2148 2148
 			update_db::gunzip($tmp_dir.'StandingData.sqb.gz');
@@ -2158,7 +2158,7 @@  discard block
 block discarded – undo
2158 2158
 		global $tmp_dir, $globalDebug;
2159 2159
 		$error = '';
2160 2160
 		if ($globalDebug) echo "Schedules Oneworld : Download...";
2161
-		update_db::download('http://data.flightairmap.com/data/schedules/oneworld.csv.gz',$tmp_dir.'oneworld.csv.gz');
2161
+		update_db::download('http://data.flightairmap.com/data/schedules/oneworld.csv.gz', $tmp_dir.'oneworld.csv.gz');
2162 2162
 		if (file_exists($tmp_dir.'oneworld.csv.gz')) {
2163 2163
 			if ($globalDebug) echo "Gunzip...";
2164 2164
 			update_db::gunzip($tmp_dir.'oneworld.csv.gz');
@@ -2174,7 +2174,7 @@  discard block
 block discarded – undo
2174 2174
 		global $tmp_dir, $globalDebug;
2175 2175
 		$error = '';
2176 2176
 		if ($globalDebug) echo "Schedules Skyteam : Download...";
2177
-		update_db::download('http://data.flightairmap.com/data/schedules/skyteam.csv.gz',$tmp_dir.'skyteam.csv.gz');
2177
+		update_db::download('http://data.flightairmap.com/data/schedules/skyteam.csv.gz', $tmp_dir.'skyteam.csv.gz');
2178 2178
 		if (file_exists($tmp_dir.'skyteam.csv.gz')) {
2179 2179
 			if ($globalDebug) echo "Gunzip...";
2180 2180
 			update_db::gunzip($tmp_dir.'skyteam.csv.gz');
@@ -2202,7 +2202,7 @@  discard block
 block discarded – undo
2202 2202
 */
2203 2203
 		if ($globalDebug) echo "Modes : Download...";
2204 2204
 //		update_db::download('http://planebase.biz/sqb.php?f=basestationall.zip',$tmp_dir.'basestation_latest.zip','http://planebase.biz/bstnsqb');
2205
-		update_db::download('http://data.flightairmap.com/data/BaseStation.sqb.gz',$tmp_dir.'BaseStation.sqb.gz');
2205
+		update_db::download('http://data.flightairmap.com/data/BaseStation.sqb.gz', $tmp_dir.'BaseStation.sqb.gz');
2206 2206
 
2207 2207
 //		if (file_exists($tmp_dir.'basestation_latest.zip')) {
2208 2208
 		if (file_exists($tmp_dir.'BaseStation.sqb.gz')) {
@@ -2222,7 +2222,7 @@  discard block
 block discarded – undo
2222 2222
 	public static function update_ModeS_faa() {
2223 2223
 		global $tmp_dir, $globalDebug;
2224 2224
 		if ($globalDebug) echo "Modes FAA: Download...";
2225
-		update_db::download('http://registry.faa.gov/database/ReleasableAircraft.zip',$tmp_dir.'ReleasableAircraft.zip');
2225
+		update_db::download('http://registry.faa.gov/database/ReleasableAircraft.zip', $tmp_dir.'ReleasableAircraft.zip');
2226 2226
 		if (file_exists($tmp_dir.'ReleasableAircraft.zip')) {
2227 2227
 			if ($globalDebug) echo "Unzip...";
2228 2228
 			update_db::unzip($tmp_dir.'ReleasableAircraft.zip');
@@ -2238,7 +2238,7 @@  discard block
 block discarded – undo
2238 2238
 	public static function update_ModeS_flarm() {
2239 2239
 		global $tmp_dir, $globalDebug;
2240 2240
 		if ($globalDebug) echo "Modes Flarmnet: Download...";
2241
-		update_db::download('http://flarmnet.org/files/data.fln',$tmp_dir.'data.fln');
2241
+		update_db::download('http://flarmnet.org/files/data.fln', $tmp_dir.'data.fln');
2242 2242
 		if (file_exists($tmp_dir.'data.fln')) {
2243 2243
 			if ($globalDebug) echo "Add to DB...";
2244 2244
 			$error = update_db::retrieve_modes_flarmnet($tmp_dir.'data.fln');
@@ -2252,7 +2252,7 @@  discard block
 block discarded – undo
2252 2252
 	public static function update_ModeS_ogn() {
2253 2253
 		global $tmp_dir, $globalDebug;
2254 2254
 		if ($globalDebug) echo "Modes OGN: Download...";
2255
-		update_db::download('http://ddb.glidernet.org/download/',$tmp_dir.'ogn.csv');
2255
+		update_db::download('http://ddb.glidernet.org/download/', $tmp_dir.'ogn.csv');
2256 2256
 		if (file_exists($tmp_dir.'ogn.csv')) {
2257 2257
 			if ($globalDebug) echo "Add to DB...";
2258 2258
 			$error = update_db::retrieve_modes_ogn($tmp_dir.'ogn.csv');
@@ -2267,201 +2267,201 @@  discard block
 block discarded – undo
2267 2267
 		global $tmp_dir, $globalDebug, $globalMasterSource;
2268 2268
 		
2269 2269
 		if ($globalDebug) echo "Owner France: Download...";
2270
-		update_db::download('http://antonakis.co.uk/registers/France.txt',$tmp_dir.'owner_f.csv');
2270
+		update_db::download('http://antonakis.co.uk/registers/France.txt', $tmp_dir.'owner_f.csv');
2271 2271
 		if (file_exists($tmp_dir.'owner_f.csv')) {
2272 2272
 			if ($globalDebug) echo "Add to DB...";
2273
-			$error = update_db::retrieve_owner($tmp_dir.'owner_f.csv','F');
2273
+			$error = update_db::retrieve_owner($tmp_dir.'owner_f.csv', 'F');
2274 2274
 		} else $error = "File ".$tmp_dir.'owner_f.csv'." doesn't exist. Download failed.";
2275 2275
 		if ($error != '') {
2276 2276
 			return $error;
2277 2277
 		} elseif ($globalDebug) echo "Done\n";
2278 2278
 		
2279 2279
 		if ($globalDebug) echo "Owner Ireland: Download...";
2280
-		update_db::download('http://antonakis.co.uk/registers/Ireland.txt',$tmp_dir.'owner_ei.csv');
2280
+		update_db::download('http://antonakis.co.uk/registers/Ireland.txt', $tmp_dir.'owner_ei.csv');
2281 2281
 		if (file_exists($tmp_dir.'owner_ei.csv')) {
2282 2282
 			if ($globalDebug) echo "Add to DB...";
2283
-			$error = update_db::retrieve_owner($tmp_dir.'owner_ei.csv','EI');
2283
+			$error = update_db::retrieve_owner($tmp_dir.'owner_ei.csv', 'EI');
2284 2284
 		} else $error = "File ".$tmp_dir.'owner_ei.csv'." doesn't exist. Download failed.";
2285 2285
 		if ($error != '') {
2286 2286
 			return $error;
2287 2287
 		} elseif ($globalDebug) echo "Done\n";
2288 2288
 		if ($globalDebug) echo "Owner Switzerland: Download...";
2289
-		update_db::download('http://antonakis.co.uk/registers/Switzerland.txt',$tmp_dir.'owner_hb.csv');
2289
+		update_db::download('http://antonakis.co.uk/registers/Switzerland.txt', $tmp_dir.'owner_hb.csv');
2290 2290
 		if (file_exists($tmp_dir.'owner_hb.csv')) {
2291 2291
 			if ($globalDebug) echo "Add to DB...";
2292
-			$error = update_db::retrieve_owner($tmp_dir.'owner_hb.csv','HB');
2292
+			$error = update_db::retrieve_owner($tmp_dir.'owner_hb.csv', 'HB');
2293 2293
 		} else $error = "File ".$tmp_dir.'owner_hb.csv'." doesn't exist. Download failed.";
2294 2294
 		if ($error != '') {
2295 2295
 			return $error;
2296 2296
 		} elseif ($globalDebug) echo "Done\n";
2297 2297
 		if ($globalDebug) echo "Owner Czech Republic: Download...";
2298
-		update_db::download('http://antonakis.co.uk/registers/CzechRepublic.txt',$tmp_dir.'owner_ok.csv');
2298
+		update_db::download('http://antonakis.co.uk/registers/CzechRepublic.txt', $tmp_dir.'owner_ok.csv');
2299 2299
 		if (file_exists($tmp_dir.'owner_ok.csv')) {
2300 2300
 			if ($globalDebug) echo "Add to DB...";
2301
-			$error = update_db::retrieve_owner($tmp_dir.'owner_ok.csv','OK');
2301
+			$error = update_db::retrieve_owner($tmp_dir.'owner_ok.csv', 'OK');
2302 2302
 		} else $error = "File ".$tmp_dir.'owner_ok.csv'." doesn't exist. Download failed.";
2303 2303
 		if ($error != '') {
2304 2304
 			return $error;
2305 2305
 		} elseif ($globalDebug) echo "Done\n";
2306 2306
 		if ($globalDebug) echo "Owner Australia: Download...";
2307
-		update_db::download('http://antonakis.co.uk/registers/Australia.txt',$tmp_dir.'owner_vh.csv');
2307
+		update_db::download('http://antonakis.co.uk/registers/Australia.txt', $tmp_dir.'owner_vh.csv');
2308 2308
 		if (file_exists($tmp_dir.'owner_vh.csv')) {
2309 2309
 			if ($globalDebug) echo "Add to DB...";
2310
-			$error = update_db::retrieve_owner($tmp_dir.'owner_vh.csv','VH');
2310
+			$error = update_db::retrieve_owner($tmp_dir.'owner_vh.csv', 'VH');
2311 2311
 		} else $error = "File ".$tmp_dir.'owner_vh.csv'." doesn't exist. Download failed.";
2312 2312
 		if ($error != '') {
2313 2313
 			return $error;
2314 2314
 		} elseif ($globalDebug) echo "Done\n";
2315 2315
 		if ($globalDebug) echo "Owner Austria: Download...";
2316
-		update_db::download('http://antonakis.co.uk/registers/Austria.txt',$tmp_dir.'owner_oe.csv');
2316
+		update_db::download('http://antonakis.co.uk/registers/Austria.txt', $tmp_dir.'owner_oe.csv');
2317 2317
 		if (file_exists($tmp_dir.'owner_oe.csv')) {
2318 2318
 			if ($globalDebug) echo "Add to DB...";
2319
-			$error = update_db::retrieve_owner($tmp_dir.'owner_oe.csv','OE');
2319
+			$error = update_db::retrieve_owner($tmp_dir.'owner_oe.csv', 'OE');
2320 2320
 		} else $error = "File ".$tmp_dir.'owner_oe.csv'." doesn't exist. Download failed.";
2321 2321
 		if ($error != '') {
2322 2322
 			return $error;
2323 2323
 		} elseif ($globalDebug) echo "Done\n";
2324 2324
 		if ($globalDebug) echo "Owner Chile: Download...";
2325
-		update_db::download('http://antonakis.co.uk/registers/Chile.txt',$tmp_dir.'owner_cc.csv');
2325
+		update_db::download('http://antonakis.co.uk/registers/Chile.txt', $tmp_dir.'owner_cc.csv');
2326 2326
 		if (file_exists($tmp_dir.'owner_cc.csv')) {
2327 2327
 			if ($globalDebug) echo "Add to DB...";
2328
-			$error = update_db::retrieve_owner($tmp_dir.'owner_cc.csv','CC');
2328
+			$error = update_db::retrieve_owner($tmp_dir.'owner_cc.csv', 'CC');
2329 2329
 		} else $error = "File ".$tmp_dir.'owner_cc.csv'." doesn't exist. Download failed.";
2330 2330
 		if ($error != '') {
2331 2331
 			return $error;
2332 2332
 		} elseif ($globalDebug) echo "Done\n";
2333 2333
 		if ($globalDebug) echo "Owner Colombia: Download...";
2334
-		update_db::download('http://antonakis.co.uk/registers/Colombia.txt',$tmp_dir.'owner_hj.csv');
2334
+		update_db::download('http://antonakis.co.uk/registers/Colombia.txt', $tmp_dir.'owner_hj.csv');
2335 2335
 		if (file_exists($tmp_dir.'owner_hj.csv')) {
2336 2336
 			if ($globalDebug) echo "Add to DB...";
2337
-			$error = update_db::retrieve_owner($tmp_dir.'owner_hj.csv','HJ');
2337
+			$error = update_db::retrieve_owner($tmp_dir.'owner_hj.csv', 'HJ');
2338 2338
 		} else $error = "File ".$tmp_dir.'owner_hj.csv'." doesn't exist. Download failed.";
2339 2339
 		if ($error != '') {
2340 2340
 			return $error;
2341 2341
 		} elseif ($globalDebug) echo "Done\n";
2342 2342
 		if ($globalDebug) echo "Owner Bosnia Herzegobina: Download...";
2343
-		update_db::download('http://antonakis.co.uk/registers/BosniaHerzegovina.txt',$tmp_dir.'owner_e7.csv');
2343
+		update_db::download('http://antonakis.co.uk/registers/BosniaHerzegovina.txt', $tmp_dir.'owner_e7.csv');
2344 2344
 		if (file_exists($tmp_dir.'owner_e7.csv')) {
2345 2345
 			if ($globalDebug) echo "Add to DB...";
2346
-			$error = update_db::retrieve_owner($tmp_dir.'owner_e7.csv','E7');
2346
+			$error = update_db::retrieve_owner($tmp_dir.'owner_e7.csv', 'E7');
2347 2347
 		} else $error = "File ".$tmp_dir.'owner_e7.csv'." doesn't exist. Download failed.";
2348 2348
 		if ($error != '') {
2349 2349
 			return $error;
2350 2350
 		} elseif ($globalDebug) echo "Done\n";
2351 2351
 		if ($globalDebug) echo "Owner Brazil: Download...";
2352
-		update_db::download('http://antonakis.co.uk/registers/Brazil.txt',$tmp_dir.'owner_pp.csv');
2352
+		update_db::download('http://antonakis.co.uk/registers/Brazil.txt', $tmp_dir.'owner_pp.csv');
2353 2353
 		if (file_exists($tmp_dir.'owner_pp.csv')) {
2354 2354
 			if ($globalDebug) echo "Add to DB...";
2355
-			$error = update_db::retrieve_owner($tmp_dir.'owner_pp.csv','PP');
2355
+			$error = update_db::retrieve_owner($tmp_dir.'owner_pp.csv', 'PP');
2356 2356
 		} else $error = "File ".$tmp_dir.'owner_pp.csv'." doesn't exist. Download failed.";
2357 2357
 		if ($error != '') {
2358 2358
 			return $error;
2359 2359
 		} elseif ($globalDebug) echo "Done\n";
2360 2360
 		if ($globalDebug) echo "Owner Cayman Islands: Download...";
2361
-		update_db::download('http://antonakis.co.uk/registers/CaymanIslands.txt',$tmp_dir.'owner_vp.csv');
2361
+		update_db::download('http://antonakis.co.uk/registers/CaymanIslands.txt', $tmp_dir.'owner_vp.csv');
2362 2362
 		if (file_exists($tmp_dir.'owner_vp.csv')) {
2363 2363
 			if ($globalDebug) echo "Add to DB...";
2364
-			$error = update_db::retrieve_owner($tmp_dir.'owner_vp.csv','VP');
2364
+			$error = update_db::retrieve_owner($tmp_dir.'owner_vp.csv', 'VP');
2365 2365
 		} else $error = "File ".$tmp_dir.'owner_vp.csv'." doesn't exist. Download failed.";
2366 2366
 		if ($error != '') {
2367 2367
 			return $error;
2368 2368
 		} elseif ($globalDebug) echo "Done\n";
2369 2369
 		if ($globalDebug) echo "Owner Croatia: Download...";
2370
-		update_db::download('http://antonakis.co.uk/registers/Croatia.txt',$tmp_dir.'owner_9a.csv');
2370
+		update_db::download('http://antonakis.co.uk/registers/Croatia.txt', $tmp_dir.'owner_9a.csv');
2371 2371
 		if (file_exists($tmp_dir.'owner_9a.csv')) {
2372 2372
 			if ($globalDebug) echo "Add to DB...";
2373
-			$error = update_db::retrieve_owner($tmp_dir.'owner_9a.csv','9A');
2373
+			$error = update_db::retrieve_owner($tmp_dir.'owner_9a.csv', '9A');
2374 2374
 		} else $error = "File ".$tmp_dir.'owner_9a.csv'." doesn't exist. Download failed.";
2375 2375
 		if ($error != '') {
2376 2376
 			return $error;
2377 2377
 		} elseif ($globalDebug) echo "Done\n";
2378 2378
 		if ($globalDebug) echo "Owner Luxembourg: Download...";
2379
-		update_db::download('http://antonakis.co.uk/registers/Luxembourg.txt',$tmp_dir.'owner_lx.csv');
2379
+		update_db::download('http://antonakis.co.uk/registers/Luxembourg.txt', $tmp_dir.'owner_lx.csv');
2380 2380
 		if (file_exists($tmp_dir.'owner_lx.csv')) {
2381 2381
 			if ($globalDebug) echo "Add to DB...";
2382
-			$error = update_db::retrieve_owner($tmp_dir.'owner_lx.csv','LX');
2382
+			$error = update_db::retrieve_owner($tmp_dir.'owner_lx.csv', 'LX');
2383 2383
 		} else $error = "File ".$tmp_dir.'owner_lx.csv'." doesn't exist. Download failed.";
2384 2384
 		if ($error != '') {
2385 2385
 			return $error;
2386 2386
 		} elseif ($globalDebug) echo "Done\n";
2387 2387
 		if ($globalDebug) echo "Owner Maldives: Download...";
2388
-		update_db::download('http://antonakis.co.uk/registers/Maldives.txt',$tmp_dir.'owner_8q.csv');
2388
+		update_db::download('http://antonakis.co.uk/registers/Maldives.txt', $tmp_dir.'owner_8q.csv');
2389 2389
 		if (file_exists($tmp_dir.'owner_8q.csv')) {
2390 2390
 			if ($globalDebug) echo "Add to DB...";
2391
-			$error = update_db::retrieve_owner($tmp_dir.'owner_8q.csv','8Q');
2391
+			$error = update_db::retrieve_owner($tmp_dir.'owner_8q.csv', '8Q');
2392 2392
 		} else $error = "File ".$tmp_dir.'owner_8q.csv'." doesn't exist. Download failed.";
2393 2393
 		if ($error != '') {
2394 2394
 			return $error;
2395 2395
 		} elseif ($globalDebug) echo "Done\n";
2396 2396
 		if ($globalDebug) echo "Owner New Zealand: Download...";
2397
-		update_db::download('http://antonakis.co.uk/registers/NewZealand.txt',$tmp_dir.'owner_zk.csv');
2397
+		update_db::download('http://antonakis.co.uk/registers/NewZealand.txt', $tmp_dir.'owner_zk.csv');
2398 2398
 		if (file_exists($tmp_dir.'owner_zk.csv')) {
2399 2399
 			if ($globalDebug) echo "Add to DB...";
2400
-			$error = update_db::retrieve_owner($tmp_dir.'owner_zk.csv','ZK');
2400
+			$error = update_db::retrieve_owner($tmp_dir.'owner_zk.csv', 'ZK');
2401 2401
 		} else $error = "File ".$tmp_dir.'owner_zk.csv'." doesn't exist. Download failed.";
2402 2402
 		if ($error != '') {
2403 2403
 			return $error;
2404 2404
 		} elseif ($globalDebug) echo "Done\n";
2405 2405
 		if ($globalDebug) echo "Owner Papua New Guinea: Download...";
2406
-		update_db::download('http://antonakis.co.uk/registers/PapuaNewGuinea.txt',$tmp_dir.'owner_p2.csv');
2406
+		update_db::download('http://antonakis.co.uk/registers/PapuaNewGuinea.txt', $tmp_dir.'owner_p2.csv');
2407 2407
 		if (file_exists($tmp_dir.'owner_p2.csv')) {
2408 2408
 			if ($globalDebug) echo "Add to DB...";
2409
-			$error = update_db::retrieve_owner($tmp_dir.'owner_p2.csv','P2');
2409
+			$error = update_db::retrieve_owner($tmp_dir.'owner_p2.csv', 'P2');
2410 2410
 		} else $error = "File ".$tmp_dir.'owner_p2.csv'." doesn't exist. Download failed.";
2411 2411
 		if ($error != '') {
2412 2412
 			return $error;
2413 2413
 		} elseif ($globalDebug) echo "Done\n";
2414 2414
 		if ($globalDebug) echo "Owner Slovakia: Download...";
2415
-		update_db::download('http://antonakis.co.uk/registers/Slovakia.txt',$tmp_dir.'owner_om.csv');
2415
+		update_db::download('http://antonakis.co.uk/registers/Slovakia.txt', $tmp_dir.'owner_om.csv');
2416 2416
 		if (file_exists($tmp_dir.'owner_om.csv')) {
2417 2417
 			if ($globalDebug) echo "Add to DB...";
2418
-			$error = update_db::retrieve_owner($tmp_dir.'owner_om.csv','OM');
2418
+			$error = update_db::retrieve_owner($tmp_dir.'owner_om.csv', 'OM');
2419 2419
 		} else $error = "File ".$tmp_dir.'owner_om.csv'." doesn't exist. Download failed.";
2420 2420
 		if ($error != '') {
2421 2421
 			return $error;
2422 2422
 		} elseif ($globalDebug) echo "Done\n";
2423 2423
 		if ($globalDebug) echo "Owner Ecuador: Download...";
2424
-		update_db::download('http://antonakis.co.uk/registers/Ecuador.txt',$tmp_dir.'owner_hc.csv');
2424
+		update_db::download('http://antonakis.co.uk/registers/Ecuador.txt', $tmp_dir.'owner_hc.csv');
2425 2425
 		if (file_exists($tmp_dir.'owner_hc.csv')) {
2426 2426
 			if ($globalDebug) echo "Add to DB...";
2427
-			$error = update_db::retrieve_owner($tmp_dir.'owner_hc.csv','HC');
2427
+			$error = update_db::retrieve_owner($tmp_dir.'owner_hc.csv', 'HC');
2428 2428
 		} else $error = "File ".$tmp_dir.'owner_hc.csv'." doesn't exist. Download failed.";
2429 2429
 		if ($error != '') {
2430 2430
 			return $error;
2431 2431
 		} elseif ($globalDebug) echo "Done\n";
2432 2432
 		if ($globalDebug) echo "Owner Iceland: Download...";
2433
-		update_db::download('http://antonakis.co.uk/registers/Iceland.txt',$tmp_dir.'owner_tf.csv');
2433
+		update_db::download('http://antonakis.co.uk/registers/Iceland.txt', $tmp_dir.'owner_tf.csv');
2434 2434
 		if (file_exists($tmp_dir.'owner_tf.csv')) {
2435 2435
 			if ($globalDebug) echo "Add to DB...";
2436
-			$error = update_db::retrieve_owner($tmp_dir.'owner_tf.csv','TF');
2436
+			$error = update_db::retrieve_owner($tmp_dir.'owner_tf.csv', 'TF');
2437 2437
 		} else $error = "File ".$tmp_dir.'owner_tf.csv'." doesn't exist. Download failed.";
2438 2438
 		if ($error != '') {
2439 2439
 			return $error;
2440 2440
 		} elseif ($globalDebug) echo "Done\n";
2441 2441
 		if ($globalDebug) echo "Owner Isle of Man: Download...";
2442
-		update_db::download('http://antonakis.co.uk/registers/IsleOfMan.txt',$tmp_dir.'owner_m.csv');
2442
+		update_db::download('http://antonakis.co.uk/registers/IsleOfMan.txt', $tmp_dir.'owner_m.csv');
2443 2443
 		if (file_exists($tmp_dir.'owner_m.csv')) {
2444 2444
 			if ($globalDebug) echo "Add to DB...";
2445
-			$error = update_db::retrieve_owner($tmp_dir.'owner_m.csv','M');
2445
+			$error = update_db::retrieve_owner($tmp_dir.'owner_m.csv', 'M');
2446 2446
 		} else $error = "File ".$tmp_dir.'owner_m.csv'." doesn't exist. Download failed.";
2447 2447
 		if ($error != '') {
2448 2448
 			return $error;
2449 2449
 		} elseif ($globalDebug) echo "Done\n";
2450 2450
 		if ($globalMasterSource) {
2451 2451
 			if ($globalDebug) echo "ModeS Netherlands: Download...";
2452
-			update_db::download('http://antonakis.co.uk/registers/Netherlands.txt',$tmp_dir.'owner_ph.csv');
2452
+			update_db::download('http://antonakis.co.uk/registers/Netherlands.txt', $tmp_dir.'owner_ph.csv');
2453 2453
 			if (file_exists($tmp_dir.'owner_ph.csv')) {
2454 2454
 				if ($globalDebug) echo "Add to DB...";
2455
-				$error = update_db::retrieve_owner($tmp_dir.'owner_ph.csv','PH');
2455
+				$error = update_db::retrieve_owner($tmp_dir.'owner_ph.csv', 'PH');
2456 2456
 			} else $error = "File ".$tmp_dir.'owner_ph.csv'." doesn't exist. Download failed.";
2457 2457
 			if ($error != '') {
2458 2458
 				return $error;
2459 2459
 			} elseif ($globalDebug) echo "Done\n";
2460 2460
 			if ($globalDebug) echo "ModeS Denmark: Download...";
2461
-			update_db::download('http://antonakis.co.uk/registers/Denmark.txt',$tmp_dir.'owner_oy.csv');
2461
+			update_db::download('http://antonakis.co.uk/registers/Denmark.txt', $tmp_dir.'owner_oy.csv');
2462 2462
 			if (file_exists($tmp_dir.'owner_oy.csv')) {
2463 2463
 				if ($globalDebug) echo "Add to DB...";
2464
-				$error = update_db::retrieve_owner($tmp_dir.'owner_oy.csv','OY');
2464
+				$error = update_db::retrieve_owner($tmp_dir.'owner_oy.csv', 'OY');
2465 2465
 			} else $error = "File ".$tmp_dir.'owner_oy.csv'." doesn't exist. Download failed.";
2466 2466
 			if ($error != '') {
2467 2467
 				return $error;
@@ -2474,7 +2474,7 @@  discard block
 block discarded – undo
2474 2474
 		global $tmp_dir, $globalDebug;
2475 2475
 		$error = '';
2476 2476
 		if ($globalDebug) echo "Translation : Download...";
2477
-		update_db::download('http://www.acarsd.org/download/translation.php',$tmp_dir.'translation.zip');
2477
+		update_db::download('http://www.acarsd.org/download/translation.php', $tmp_dir.'translation.zip');
2478 2478
 		if (file_exists($tmp_dir.'translation.zip')) {
2479 2479
 			if ($globalDebug) echo "Unzip...";
2480 2480
 			update_db::unzip($tmp_dir.'translation.zip');
@@ -2491,10 +2491,10 @@  discard block
 block discarded – undo
2491 2491
 		global $tmp_dir, $globalDebug;
2492 2492
 		$error = '';
2493 2493
 		if ($globalDebug) echo "Translation from FlightAirMap website : Download...";
2494
-		update_db::download('http://data.flightairmap.com/data/translation.tsv.gz',$tmp_dir.'translation.tsv.gz');
2495
-		update_db::download('http://data.flightairmap.com/data/translation.tsv.gz.md5',$tmp_dir.'translation.tsv.gz.md5');
2494
+		update_db::download('http://data.flightairmap.com/data/translation.tsv.gz', $tmp_dir.'translation.tsv.gz');
2495
+		update_db::download('http://data.flightairmap.com/data/translation.tsv.gz.md5', $tmp_dir.'translation.tsv.gz.md5');
2496 2496
 		if (file_exists($tmp_dir.'translation.tsv.gz') && file_exists($tmp_dir.'translation.tsv.gz')) {
2497
-			$translation_md5_file = explode(' ',file_get_contents($tmp_dir.'translation.tsv.gz.md5'));
2497
+			$translation_md5_file = explode(' ', file_get_contents($tmp_dir.'translation.tsv.gz.md5'));
2498 2498
 			$translation_md5 = $translation_md5_file[0];
2499 2499
 			if (md5_file($tmp_dir.'translation.tsv.gz') == $translation_md5) {
2500 2500
 				if ($globalDebug) echo "Gunzip...";
@@ -2512,10 +2512,10 @@  discard block
 block discarded – undo
2512 2512
 		global $tmp_dir, $globalDebug;
2513 2513
 		$error = '';
2514 2514
 		if ($globalDebug) echo "ModeS from FlightAirMap website : Download...";
2515
-		update_db::download('http://data.flightairmap.com/data/modes.tsv.gz',$tmp_dir.'modes.tsv.gz');
2516
-		update_db::download('http://data.flightairmap.com/data/modes.tsv.gz.md5',$tmp_dir.'modes.tsv.gz.md5');
2515
+		update_db::download('http://data.flightairmap.com/data/modes.tsv.gz', $tmp_dir.'modes.tsv.gz');
2516
+		update_db::download('http://data.flightairmap.com/data/modes.tsv.gz.md5', $tmp_dir.'modes.tsv.gz.md5');
2517 2517
 		if (file_exists($tmp_dir.'modes.tsv.gz') && file_exists($tmp_dir.'modes.tsv.gz.md5')) {
2518
-			$modes_md5_file = explode(' ',file_get_contents($tmp_dir.'modes.tsv.gz.md5'));
2518
+			$modes_md5_file = explode(' ', file_get_contents($tmp_dir.'modes.tsv.gz.md5'));
2519 2519
 			$modes_md5 = $modes_md5_file[0];
2520 2520
 			if (md5_file($tmp_dir.'modes.tsv.gz') == $modes_md5) {
2521 2521
 				if ($globalDebug) echo "Gunzip...";
@@ -2534,12 +2534,12 @@  discard block
 block discarded – undo
2534 2534
 		global $tmp_dir, $globalDebug;
2535 2535
 		$error = '';
2536 2536
 		if ($globalDebug) echo "Airlines from FlightAirMap website : Download...";
2537
-		update_db::download('http://data.flightairmap.com/data/airlines.tsv.gz.md5',$tmp_dir.'airlines.tsv.gz.md5');
2537
+		update_db::download('http://data.flightairmap.com/data/airlines.tsv.gz.md5', $tmp_dir.'airlines.tsv.gz.md5');
2538 2538
 		if (file_exists($tmp_dir.'airlines.tsv.gz.md5')) {
2539
-			$airlines_md5_file = explode(' ',file_get_contents($tmp_dir.'airlines.tsv.gz.md5'));
2539
+			$airlines_md5_file = explode(' ', file_get_contents($tmp_dir.'airlines.tsv.gz.md5'));
2540 2540
 			$airlines_md5 = $airlines_md5_file[0];
2541 2541
 			if (!update_db::check_airlines_version($airlines_md5)) {
2542
-				update_db::download('http://data.flightairmap.com/data/airlines.tsv.gz',$tmp_dir.'airlines.tsv.gz');
2542
+				update_db::download('http://data.flightairmap.com/data/airlines.tsv.gz', $tmp_dir.'airlines.tsv.gz');
2543 2543
 				if (file_exists($tmp_dir.'airlines.tsv.gz')) {
2544 2544
 					if (md5_file($tmp_dir.'airlines.tsv.gz') == $airlines_md5) {
2545 2545
 						if ($globalDebug) echo "Gunzip...";
@@ -2564,14 +2564,14 @@  discard block
 block discarded – undo
2564 2564
 		if ($globalDebug) echo "owner from FlightAirMap website : Download...";
2565 2565
 		$error = '';
2566 2566
 		if ($globalOwner === TRUE) {
2567
-			update_db::download('http://data.flightairmap.com/data/owners_all.tsv.gz',$tmp_dir.'owners.tsv.gz');
2568
-			update_db::download('http://data.flightairmap.com/data/owners_all.tsv.gz.md5',$tmp_dir.'owners.tsv.gz.md5');
2567
+			update_db::download('http://data.flightairmap.com/data/owners_all.tsv.gz', $tmp_dir.'owners.tsv.gz');
2568
+			update_db::download('http://data.flightairmap.com/data/owners_all.tsv.gz.md5', $tmp_dir.'owners.tsv.gz.md5');
2569 2569
 		} else {
2570
-			update_db::download('http://data.flightairmap.com/data/owners.tsv.gz',$tmp_dir.'owners.tsv.gz');
2571
-			update_db::download('http://data.flightairmap.com/data/owners.tsv.gz.md5',$tmp_dir.'owners.tsv.gz.md5');
2570
+			update_db::download('http://data.flightairmap.com/data/owners.tsv.gz', $tmp_dir.'owners.tsv.gz');
2571
+			update_db::download('http://data.flightairmap.com/data/owners.tsv.gz.md5', $tmp_dir.'owners.tsv.gz.md5');
2572 2572
 		}
2573 2573
 		if (file_exists($tmp_dir.'owners.tsv.gz') && file_exists($tmp_dir.'owners.tsv.gz.md5')) {
2574
-			$owners_md5_file = explode(' ',file_get_contents($tmp_dir.'owners.tsv.gz.md5'));
2574
+			$owners_md5_file = explode(' ', file_get_contents($tmp_dir.'owners.tsv.gz.md5'));
2575 2575
 			$owners_md5 = $owners_md5_file[0];
2576 2576
 			if (md5_file($tmp_dir.'owners.tsv.gz') == $owners_md5) {
2577 2577
 				if ($globalDebug) echo "Gunzip...";
@@ -2588,10 +2588,10 @@  discard block
 block discarded – undo
2588 2588
 	public static function update_routes_fam() {
2589 2589
 		global $tmp_dir, $globalDebug;
2590 2590
 		if ($globalDebug) echo "Routes from FlightAirMap website : Download...";
2591
-		update_db::download('http://data.flightairmap.com/data/routes.tsv.gz',$tmp_dir.'routes.tsv.gz');
2592
-		update_db::download('http://data.flightairmap.com/data/routes.tsv.gz.md5',$tmp_dir.'routes.tsv.gz.md5');
2591
+		update_db::download('http://data.flightairmap.com/data/routes.tsv.gz', $tmp_dir.'routes.tsv.gz');
2592
+		update_db::download('http://data.flightairmap.com/data/routes.tsv.gz.md5', $tmp_dir.'routes.tsv.gz.md5');
2593 2593
 		if (file_exists($tmp_dir.'routes.tsv.gz') && file_exists($tmp_dir.'routes.tsv.gz.md5')) {
2594
-			$routes_md5_file = explode(' ',file_get_contents($tmp_dir.'routes.tsv.gz.md5'));
2594
+			$routes_md5_file = explode(' ', file_get_contents($tmp_dir.'routes.tsv.gz.md5'));
2595 2595
 			$routes_md5 = $routes_md5_file[0];
2596 2596
 			if (md5_file($tmp_dir.'routes.tsv.gz') == $routes_md5) {
2597 2597
 				if ($globalDebug) echo "Gunzip...";
@@ -2608,10 +2608,10 @@  discard block
 block discarded – undo
2608 2608
 	public static function update_block_fam() {
2609 2609
 		global $tmp_dir, $globalDebug;
2610 2610
 		if ($globalDebug) echo "Blocked aircraft from FlightAirMap website : Download...";
2611
-		update_db::download('http://data.flightairmap.com/data/block.tsv.gz',$tmp_dir.'block.tsv.gz');
2612
-		update_db::download('http://data.flightairmap.com/data/block.tsv.gz.md5',$tmp_dir.'block.tsv.gz.md5');
2611
+		update_db::download('http://data.flightairmap.com/data/block.tsv.gz', $tmp_dir.'block.tsv.gz');
2612
+		update_db::download('http://data.flightairmap.com/data/block.tsv.gz.md5', $tmp_dir.'block.tsv.gz.md5');
2613 2613
 		if (file_exists($tmp_dir.'block.tsv.gz') && file_exists($tmp_dir.'block.tsv.gz.md5')) {
2614
-			$block_md5_file = explode(' ',file_get_contents($tmp_dir.'block.tsv.gz.md5'));
2614
+			$block_md5_file = explode(' ', file_get_contents($tmp_dir.'block.tsv.gz.md5'));
2615 2615
 			$block_md5 = $block_md5_file[0];
2616 2616
 			if (md5_file($tmp_dir.'block.tsv.gz') == $block_md5) {
2617 2617
 				if ($globalDebug) echo "Gunzip...";
@@ -2627,13 +2627,13 @@  discard block
 block discarded – undo
2627 2627
 	}
2628 2628
 	public static function update_marine_identity_fam() {
2629 2629
 		global $tmp_dir, $globalDebug;
2630
-		update_db::download('http://data.flightairmap.com/data/marine_identity.tsv.gz.md5',$tmp_dir.'marine_identity.tsv.gz.md5');
2630
+		update_db::download('http://data.flightairmap.com/data/marine_identity.tsv.gz.md5', $tmp_dir.'marine_identity.tsv.gz.md5');
2631 2631
 		if (file_exists($tmp_dir.'marine_identity.tsv.gz.md5')) {
2632
-			$marine_identity_md5_file = explode(' ',file_get_contents($tmp_dir.'marine_identity.tsv.gz.md5'));
2632
+			$marine_identity_md5_file = explode(' ', file_get_contents($tmp_dir.'marine_identity.tsv.gz.md5'));
2633 2633
 			$marine_identity_md5 = $marine_identity_md5_file[0];
2634 2634
 			if (!update_db::check_marine_identity_version($marine_identity_md5)) {
2635 2635
 				if ($globalDebug) echo "Marine identity from FlightAirMap website : Download...";
2636
-				update_db::download('http://data.flightairmap.com/data/marine_identity.tsv.gz',$tmp_dir.'marine_identity.tsv.gz');
2636
+				update_db::download('http://data.flightairmap.com/data/marine_identity.tsv.gz', $tmp_dir.'marine_identity.tsv.gz');
2637 2637
 				if (file_exists($tmp_dir.'marine_identity.tsv.gz')) {
2638 2638
 					if (md5_file($tmp_dir.'marine_identity.tsv.gz') == $marine_identity_md5) {
2639 2639
 						if ($globalDebug) echo "Gunzip...";
@@ -2655,13 +2655,13 @@  discard block
 block discarded – undo
2655 2655
 
2656 2656
 	public static function update_satellite_fam() {
2657 2657
 		global $tmp_dir, $globalDebug;
2658
-		update_db::download('http://data.flightairmap.com/data/satellite.tsv.gz.md5',$tmp_dir.'satellite.tsv.gz.md5');
2658
+		update_db::download('http://data.flightairmap.com/data/satellite.tsv.gz.md5', $tmp_dir.'satellite.tsv.gz.md5');
2659 2659
 		if (file_exists($tmp_dir.'satellite.tsv.gz.md5')) {
2660
-			$satellite_md5_file = explode(' ',file_get_contents($tmp_dir.'satellite.tsv.gz.md5'));
2660
+			$satellite_md5_file = explode(' ', file_get_contents($tmp_dir.'satellite.tsv.gz.md5'));
2661 2661
 			$satellite_md5 = $satellite_md5_file[0];
2662 2662
 			if (!update_db::check_satellite_version($satellite_md5)) {
2663 2663
 				if ($globalDebug) echo "Satellite from FlightAirMap website : Download...";
2664
-				update_db::download('http://data.flightairmap.com/data/satellite.tsv.gz',$tmp_dir.'satellite.tsv.gz');
2664
+				update_db::download('http://data.flightairmap.com/data/satellite.tsv.gz', $tmp_dir.'satellite.tsv.gz');
2665 2665
 				if (file_exists($tmp_dir.'satellite.tsv.gz')) {
2666 2666
 					if (md5_file($tmp_dir.'satellite.tsv.gz') == $satellite_md5) {
2667 2667
 						if ($globalDebug) echo "Gunzip...";
@@ -2682,13 +2682,13 @@  discard block
 block discarded – undo
2682 2682
 	}
2683 2683
 	public static function update_diagrams_fam() {
2684 2684
 		global $tmp_dir, $globalDebug;
2685
-		update_db::download('http://data.flightairmap.com/data/diagrams/diagramspdf.md5',$tmp_dir.'diagramspdf.md5');
2685
+		update_db::download('http://data.flightairmap.com/data/diagrams/diagramspdf.md5', $tmp_dir.'diagramspdf.md5');
2686 2686
 		if (file_exists($tmp_dir.'diagramspdf.md5')) {
2687
-			$diagrams_md5_file = explode(' ',file_get_contents($tmp_dir.'diagramspdf.md5'));
2687
+			$diagrams_md5_file = explode(' ', file_get_contents($tmp_dir.'diagramspdf.md5'));
2688 2688
 			$diagrams_md5 = $diagrams_md5_file[0];
2689 2689
 			if (!update_db::check_diagrams_version($diagrams_md5)) {
2690 2690
 				if ($globalDebug) echo "Airports diagrams from FlightAirMap website : Download...";
2691
-				update_db::download('http://data.flightairmap.com/data/diagrams/diagramspdf',$tmp_dir.'diagramspdf');
2691
+				update_db::download('http://data.flightairmap.com/data/diagrams/diagramspdf', $tmp_dir.'diagramspdf');
2692 2692
 				if (file_exists($tmp_dir.'diagramspdf')) {
2693 2693
 					if (md5_file($tmp_dir.'diagramspdf') == $diagrams_md5) {
2694 2694
 						if ($globalDebug) echo "Add to DB...";
@@ -2708,7 +2708,7 @@  discard block
 block discarded – undo
2708 2708
 	public static function update_banned_fam() {
2709 2709
 		global $tmp_dir, $globalDebug;
2710 2710
 		if ($globalDebug) echo "Banned airlines in Europe from FlightAirMap website : Download...";
2711
-		update_db::download('http://data.flightairmap.com/data/ban-eu.csv',$tmp_dir.'ban_eu.csv');
2711
+		update_db::download('http://data.flightairmap.com/data/ban-eu.csv', $tmp_dir.'ban_eu.csv');
2712 2712
 		if (file_exists($tmp_dir.'ban_eu.csv')) {
2713 2713
 			//if ($globalDebug) echo "Gunzip...";
2714 2714
 			//update_db::gunzip($tmp_dir.'ban_ue.csv');
@@ -2727,18 +2727,18 @@  discard block
 block discarded – undo
2727 2727
 		$error = '';
2728 2728
 		if ($globalDebug) echo "Airspace from FlightAirMap website : Download...";
2729 2729
 		if ($globalDBdriver == 'mysql') {
2730
-			update_db::download('http://data.flightairmap.com/data/airspace_mysql.sql.gz.md5',$tmp_dir.'airspace.sql.gz.md5');
2730
+			update_db::download('http://data.flightairmap.com/data/airspace_mysql.sql.gz.md5', $tmp_dir.'airspace.sql.gz.md5');
2731 2731
 		} else {
2732
-			update_db::download('http://data.flightairmap.com/data/airspace_pgsql.sql.gz.md5',$tmp_dir.'airspace.sql.gz.md5');
2732
+			update_db::download('http://data.flightairmap.com/data/airspace_pgsql.sql.gz.md5', $tmp_dir.'airspace.sql.gz.md5');
2733 2733
 		}
2734 2734
 		if (file_exists($tmp_dir.'airspace.sql.gz.md5')) {
2735
-			$airspace_md5_file = explode(' ',file_get_contents($tmp_dir.'airspace.sql.gz.md5'));
2735
+			$airspace_md5_file = explode(' ', file_get_contents($tmp_dir.'airspace.sql.gz.md5'));
2736 2736
 			$airspace_md5 = $airspace_md5_file[0];
2737 2737
 			if (!update_db::check_airspace_version($airspace_md5)) {
2738 2738
 				if ($globalDBdriver == 'mysql') {
2739
-					update_db::download('http://data.flightairmap.com/data/airspace_mysql.sql.gz',$tmp_dir.'airspace.sql.gz');
2739
+					update_db::download('http://data.flightairmap.com/data/airspace_mysql.sql.gz', $tmp_dir.'airspace.sql.gz');
2740 2740
 				} else {
2741
-					update_db::download('http://data.flightairmap.com/data/airspace_pgsql.sql.gz',$tmp_dir.'airspace.sql.gz');
2741
+					update_db::download('http://data.flightairmap.com/data/airspace_pgsql.sql.gz', $tmp_dir.'airspace.sql.gz');
2742 2742
 				}
2743 2743
 				if (file_exists($tmp_dir.'airspace.sql.gz')) {
2744 2744
 					if (md5_file($tmp_dir.'airspace.sql.gz') == $airspace_md5) {
@@ -2751,7 +2751,7 @@  discard block
 block discarded – undo
2751 2751
 							try {
2752 2752
 								$sth = $Connection->db->prepare($query);
2753 2753
 								$sth->execute();
2754
-							} catch(PDOException $e) {
2754
+							} catch (PDOException $e) {
2755 2755
 								return "error : ".$e->getMessage();
2756 2756
 							}
2757 2757
 						}
@@ -2771,16 +2771,16 @@  discard block
 block discarded – undo
2771 2771
 		global $tmp_dir, $globalDebug, $globalGeoidSource;
2772 2772
 		$error = '';
2773 2773
 		if ($globalDebug) echo "Geoid from FlightAirMap website : Download...";
2774
-		update_db::download('http://data.flightairmap.com/data/geoid/'.$globalGeoidSource.'.pgm.gz.md5',$tmp_dir.$globalGeoidSource.'.pgm.gz.md5');
2774
+		update_db::download('http://data.flightairmap.com/data/geoid/'.$globalGeoidSource.'.pgm.gz.md5', $tmp_dir.$globalGeoidSource.'.pgm.gz.md5');
2775 2775
 		if (file_exists($tmp_dir.$globalGeoidSource.'.pgm.gz.md5')) {
2776
-			$geoid_md5_file = explode(' ',file_get_contents($tmp_dir.$globalGeoidSource.'.pgm.gz.md5'));
2776
+			$geoid_md5_file = explode(' ', file_get_contents($tmp_dir.$globalGeoidSource.'.pgm.gz.md5'));
2777 2777
 			$geoid_md5 = $geoid_md5_file[0];
2778 2778
 			if (!update_db::check_geoid_version($geoid_md5)) {
2779
-				update_db::download('http://data.flightairmap.com/data/geoid/'.$globalGeoidSource.'.pgm.gz',$tmp_dir.$globalGeoidSource.'.pgm.gz');
2779
+				update_db::download('http://data.flightairmap.com/data/geoid/'.$globalGeoidSource.'.pgm.gz', $tmp_dir.$globalGeoidSource.'.pgm.gz');
2780 2780
 				if (file_exists($tmp_dir.$globalGeoidSource.'.pgm.gz')) {
2781 2781
 					if (md5_file($tmp_dir.$globalGeoidSource.'.pgm.gz') == $geoid_md5) {
2782 2782
 						if ($globalDebug) echo "Gunzip...";
2783
-						update_db::gunzip($tmp_dir.$globalGeoidSource.'.pgm.gz',dirname(__FILE__).'/../data/'.$globalGeoidSource.'.pgm');
2783
+						update_db::gunzip($tmp_dir.$globalGeoidSource.'.pgm.gz', dirname(__FILE__).'/../data/'.$globalGeoidSource.'.pgm');
2784 2784
 						if (file_exists(dirname(__FILE__).'/../data/'.$globalGeoidSource.'.pgm')) {
2785 2785
 							update_db::insert_geoid_version($geoid_md5);
2786 2786
 						} else $error = "File data/".$globalGeoidSource.'.pgm'." doesn't exist. Gunzip failed.";
@@ -2797,15 +2797,15 @@  discard block
 block discarded – undo
2797 2797
 	public static function update_tle() {
2798 2798
 		global $tmp_dir, $globalDebug;
2799 2799
 		if ($globalDebug) echo "Download TLE : Download...";
2800
-		$alltle = array('stations.txt','gps-ops.txt','glo-ops.txt','galileo.txt','weather.txt','noaa.txt','goes.txt','resource.txt','dmc.txt','tdrss.txt','geo.txt','intelsat.txt','gorizont.txt',
2801
-		'raduga.txt','molniya.txt','iridium.txt','orbcomm.txt','globalstar.txt','amateur.txt','x-comm.txt','other-comm.txt','sbas.txt','nnss.txt','musson.txt','science.txt','geodetic.txt',
2802
-		'engineering.txt','education.txt','military.txt','radar.txt','cubesat.txt','other.txt','tle-new.txt','visual.txt','sarsat.txt','argos.txt','ses.txt','iridium-NEXT.txt','beidou.txt');
2800
+		$alltle = array('stations.txt', 'gps-ops.txt', 'glo-ops.txt', 'galileo.txt', 'weather.txt', 'noaa.txt', 'goes.txt', 'resource.txt', 'dmc.txt', 'tdrss.txt', 'geo.txt', 'intelsat.txt', 'gorizont.txt',
2801
+		'raduga.txt', 'molniya.txt', 'iridium.txt', 'orbcomm.txt', 'globalstar.txt', 'amateur.txt', 'x-comm.txt', 'other-comm.txt', 'sbas.txt', 'nnss.txt', 'musson.txt', 'science.txt', 'geodetic.txt',
2802
+		'engineering.txt', 'education.txt', 'military.txt', 'radar.txt', 'cubesat.txt', 'other.txt', 'tle-new.txt', 'visual.txt', 'sarsat.txt', 'argos.txt', 'ses.txt', 'iridium-NEXT.txt', 'beidou.txt');
2803 2803
 		foreach ($alltle as $filename) {
2804 2804
 			if ($globalDebug) echo "downloading ".$filename.'...';
2805
-			update_db::download('http://celestrak.com/NORAD/elements/'.$filename,$tmp_dir.$filename);
2805
+			update_db::download('http://celestrak.com/NORAD/elements/'.$filename, $tmp_dir.$filename);
2806 2806
 			if (file_exists($tmp_dir.$filename)) {
2807 2807
 				if ($globalDebug) echo "Add to DB ".$filename."...";
2808
-				$error = update_db::tle($tmp_dir.$filename,str_replace('.txt','',$filename));
2808
+				$error = update_db::tle($tmp_dir.$filename, str_replace('.txt', '', $filename));
2809 2809
 			} else $error = "File ".$tmp_dir.$filename." doesn't exist. Download failed.";
2810 2810
 			if ($error != '') {
2811 2811
 				echo $error."\n";
@@ -2817,7 +2817,7 @@  discard block
 block discarded – undo
2817 2817
 	public static function update_ucsdb() {
2818 2818
 		global $tmp_dir, $globalDebug;
2819 2819
 		if ($globalDebug) echo "Download UCS DB : Download...";
2820
-		update_db::download('https://s3.amazonaws.com/ucs-documents/nuclear-weapons/sat-database/8-10-18-update/UCS_Satellite_Database_officialname_5-1-2018.txt',$tmp_dir.'UCS_Satellite_Database_officialname_9-1-2017.txt');
2820
+		update_db::download('https://s3.amazonaws.com/ucs-documents/nuclear-weapons/sat-database/8-10-18-update/UCS_Satellite_Database_officialname_5-1-2018.txt', $tmp_dir.'UCS_Satellite_Database_officialname_9-1-2017.txt');
2821 2821
 		if (file_exists($tmp_dir.'UCS_Satellite_Database_officialname_5-1-2018.txt')) {
2822 2822
 			if ($globalDebug) echo "Add to DB...";
2823 2823
 			$error = update_db::satellite_ucsdb($tmp_dir.'UCS_Satellite_Database_officialname_5-1-2018.txt');
@@ -2831,7 +2831,7 @@  discard block
 block discarded – undo
2831 2831
 	public static function update_celestrak() {
2832 2832
 		global $tmp_dir, $globalDebug;
2833 2833
 		if ($globalDebug) echo "Download Celestrak DB : Download...";
2834
-		update_db::download('http://celestrak.com/pub/satcat.txt',$tmp_dir.'satcat.txt');
2834
+		update_db::download('http://celestrak.com/pub/satcat.txt', $tmp_dir.'satcat.txt');
2835 2835
 		if (file_exists($tmp_dir.'satcat.txt')) {
2836 2836
 			if ($globalDebug) echo "Add to DB...";
2837 2837
 			$error = update_db::satellite_celestrak($tmp_dir.'satcat.txt');
@@ -2850,62 +2850,62 @@  discard block
 block discarded – undo
2850 2850
 			if ($globalDebug) echo dirname(__FILE__).'/../models'.' is not writable !';
2851 2851
 			return '';
2852 2852
 		}
2853
-		update_db::download('http://data.flightairmap.com/data/models/models.md5sum',$tmp_dir.'models.md5sum');
2853
+		update_db::download('http://data.flightairmap.com/data/models/models.md5sum', $tmp_dir.'models.md5sum');
2854 2854
 		if (file_exists($tmp_dir.'models.md5sum')) {
2855 2855
 			if ($globalDebug) echo "Check files...\n";
2856 2856
 			$newmodelsdb = array();
2857
-			if (($handle = fopen($tmp_dir.'models.md5sum','r')) !== FALSE) {
2858
-				while (($row = fgetcsv($handle,1000," ")) !== FALSE) {
2857
+			if (($handle = fopen($tmp_dir.'models.md5sum', 'r')) !== FALSE) {
2858
+				while (($row = fgetcsv($handle, 1000, " ")) !== FALSE) {
2859 2859
 					$model = trim($row[2]);
2860 2860
 					$newmodelsdb[$model] = trim($row[0]);
2861 2861
 				}
2862 2862
 			}
2863 2863
 			$modelsdb = array();
2864 2864
 			if (file_exists(dirname(__FILE__).'/../models/models.md5sum')) {
2865
-				if (($handle = fopen(dirname(__FILE__).'/../models/models.md5sum','r')) !== FALSE) {
2866
-					while (($row = fgetcsv($handle,1000," ")) !== FALSE) {
2865
+				if (($handle = fopen(dirname(__FILE__).'/../models/models.md5sum', 'r')) !== FALSE) {
2866
+					while (($row = fgetcsv($handle, 1000, " ")) !== FALSE) {
2867 2867
 						$model = trim($row[2]);
2868 2868
 						$modelsdb[$model] = trim($row[0]);
2869 2869
 					}
2870 2870
 				}
2871 2871
 			}
2872
-			$diff = array_diff($newmodelsdb,$modelsdb);
2872
+			$diff = array_diff($newmodelsdb, $modelsdb);
2873 2873
 			foreach ($diff as $key => $value) {
2874 2874
 				if ($globalDebug) echo 'Downloading model '.$key.' ...'."\n";
2875
-				update_db::download('http://data.flightairmap.com/data/models/'.$key,dirname(__FILE__).'/../models/'.$key);
2875
+				update_db::download('http://data.flightairmap.com/data/models/'.$key, dirname(__FILE__).'/../models/'.$key);
2876 2876
 			}
2877
-			update_db::download('http://data.flightairmap.com/data/models/models.md5sum',dirname(__FILE__).'/../models/models.md5sum');
2877
+			update_db::download('http://data.flightairmap.com/data/models/models.md5sum', dirname(__FILE__).'/../models/models.md5sum');
2878 2878
 		} else $error = "File ".$tmp_dir.'models.md5sum'." doesn't exist. Download failed.";
2879 2879
 		if ($error != '') {
2880 2880
 			return $error;
2881 2881
 		} elseif ($globalDebug) echo "Done\n";
2882 2882
 		if ($globalDebug) echo "glTF 2.0 Models from FlightAirMap website : Download...";
2883
-		update_db::download('http://data.flightairmap.com/data/models/gltf2/models.md5sum',$tmp_dir.'modelsgltf2.md5sum');
2883
+		update_db::download('http://data.flightairmap.com/data/models/gltf2/models.md5sum', $tmp_dir.'modelsgltf2.md5sum');
2884 2884
 		if (file_exists($tmp_dir.'modelsgltf2.md5sum')) {
2885 2885
 			if ($globalDebug) echo "Check files...\n";
2886 2886
 			$newmodelsdb = array();
2887
-			if (($handle = fopen($tmp_dir.'modelsgltf2.md5sum','r')) !== FALSE) {
2888
-				while (($row = fgetcsv($handle,1000," ")) !== FALSE) {
2887
+			if (($handle = fopen($tmp_dir.'modelsgltf2.md5sum', 'r')) !== FALSE) {
2888
+				while (($row = fgetcsv($handle, 1000, " ")) !== FALSE) {
2889 2889
 					$model = trim($row[2]);
2890 2890
 					$newmodelsdb[$model] = trim($row[0]);
2891 2891
 				}
2892 2892
 			}
2893 2893
 			$modelsdb = array();
2894 2894
 			if (file_exists(dirname(__FILE__).'/../models/gltf2/models.md5sum')) {
2895
-				if (($handle = fopen(dirname(__FILE__).'/../models/gltf2/models.md5sum','r')) !== FALSE) {
2896
-					while (($row = fgetcsv($handle,1000," ")) !== FALSE) {
2895
+				if (($handle = fopen(dirname(__FILE__).'/../models/gltf2/models.md5sum', 'r')) !== FALSE) {
2896
+					while (($row = fgetcsv($handle, 1000, " ")) !== FALSE) {
2897 2897
 						$model = trim($row[2]);
2898 2898
 						$modelsdb[$model] = trim($row[0]);
2899 2899
 					}
2900 2900
 				}
2901 2901
 			}
2902
-			$diff = array_diff($newmodelsdb,$modelsdb);
2902
+			$diff = array_diff($newmodelsdb, $modelsdb);
2903 2903
 			foreach ($diff as $key => $value) {
2904 2904
 				if ($globalDebug) echo 'Downloading model '.$key.' ...'."\n";
2905
-				update_db::download('http://data.flightairmap.com/data/models/gltf2/'.$key,dirname(__FILE__).'/../models/gltf2/'.$key);
2905
+				update_db::download('http://data.flightairmap.com/data/models/gltf2/'.$key, dirname(__FILE__).'/../models/gltf2/'.$key);
2906 2906
 				
2907 2907
 			}
2908
-			update_db::download('http://data.flightairmap.com/data/models/gltf2/models.md5sum',dirname(__FILE__).'/../models/gltf2/models.md5sum');
2908
+			update_db::download('http://data.flightairmap.com/data/models/gltf2/models.md5sum', dirname(__FILE__).'/../models/gltf2/models.md5sum');
2909 2909
 		} else $error = "File ".$tmp_dir.'modelsgltf2.md5sum'." doesn't exist. Download failed.";
2910 2910
 		if ($error != '') {
2911 2911
 			return $error;
@@ -2921,32 +2921,32 @@  discard block
 block discarded – undo
2921 2921
 			return '';
2922 2922
 		}
2923 2923
 		if ($globalDebug) echo "Weather Models from FlightAirMap website : Download...";
2924
-		update_db::download('http://data.flightairmap.com/data/models/gltf2/weather/models.md5sum',$tmp_dir.'modelsweather.md5sum');
2924
+		update_db::download('http://data.flightairmap.com/data/models/gltf2/weather/models.md5sum', $tmp_dir.'modelsweather.md5sum');
2925 2925
 		if (file_exists($tmp_dir.'modelsweather.md5sum')) {
2926 2926
 			if ($globalDebug) echo "Check files...\n";
2927 2927
 			$newmodelsdb = array();
2928
-			if (($handle = fopen($tmp_dir.'modelsweather.md5sum','r')) !== FALSE) {
2929
-				while (($row = fgetcsv($handle,1000," ")) !== FALSE) {
2928
+			if (($handle = fopen($tmp_dir.'modelsweather.md5sum', 'r')) !== FALSE) {
2929
+				while (($row = fgetcsv($handle, 1000, " ")) !== FALSE) {
2930 2930
 					$model = trim($row[2]);
2931 2931
 					$newmodelsdb[$model] = trim($row[0]);
2932 2932
 				}
2933 2933
 			}
2934 2934
 			$modelsdb = array();
2935 2935
 			if (file_exists(dirname(__FILE__).'/../models/gltf2/weather/models.md5sum')) {
2936
-				if (($handle = fopen(dirname(__FILE__).'/../models/gltf2/weather/models.md5sum','r')) !== FALSE) {
2937
-					while (($row = fgetcsv($handle,1000," ")) !== FALSE) {
2936
+				if (($handle = fopen(dirname(__FILE__).'/../models/gltf2/weather/models.md5sum', 'r')) !== FALSE) {
2937
+					while (($row = fgetcsv($handle, 1000, " ")) !== FALSE) {
2938 2938
 						$model = trim($row[2]);
2939 2939
 						$modelsdb[$model] = trim($row[0]);
2940 2940
 					}
2941 2941
 				}
2942 2942
 			}
2943
-			$diff = array_diff($newmodelsdb,$modelsdb);
2943
+			$diff = array_diff($newmodelsdb, $modelsdb);
2944 2944
 			foreach ($diff as $key => $value) {
2945 2945
 				if ($globalDebug) echo 'Downloading model '.$key.' ...'."\n";
2946
-				update_db::download('http://data.flightairmap.com/data/models/gltf2/weather/'.$key,dirname(__FILE__).'/../models/gltf2/weather/'.$key);
2946
+				update_db::download('http://data.flightairmap.com/data/models/gltf2/weather/'.$key, dirname(__FILE__).'/../models/gltf2/weather/'.$key);
2947 2947
 				
2948 2948
 			}
2949
-			update_db::download('http://data.flightairmap.com/data/models/gltf2/weather/models.md5sum',dirname(__FILE__).'/../models/gltf2/weather/models.md5sum');
2949
+			update_db::download('http://data.flightairmap.com/data/models/gltf2/weather/models.md5sum', dirname(__FILE__).'/../models/gltf2/weather/models.md5sum');
2950 2950
 		} else $error = "File ".$tmp_dir.'modelsweather.md5sum'." doesn't exist. Download failed.";
2951 2951
 		if ($error != '') {
2952 2952
 			return $error;
@@ -2958,32 +2958,32 @@  discard block
 block discarded – undo
2958 2958
 		global $tmp_dir, $globalDebug;
2959 2959
 		$error = '';
2960 2960
 		if ($globalDebug) echo "Liveries from FlightAirMap website : Download...";
2961
-		update_db::download('http://data.flightairmap.com/data/models/gltf2/liveries/liveries.md5sum',$tmp_dir.'liveries.md5sum');
2961
+		update_db::download('http://data.flightairmap.com/data/models/gltf2/liveries/liveries.md5sum', $tmp_dir.'liveries.md5sum');
2962 2962
 		if (file_exists($tmp_dir.'liveries.md5sum')) {
2963 2963
 			if ($globalDebug) echo "Check files...\n";
2964 2964
 			$newmodelsdb = array();
2965
-			if (($handle = fopen($tmp_dir.'liveries.md5sum','r')) !== FALSE) {
2966
-				while (($row = fgetcsv($handle,1000," ")) !== FALSE) {
2965
+			if (($handle = fopen($tmp_dir.'liveries.md5sum', 'r')) !== FALSE) {
2966
+				while (($row = fgetcsv($handle, 1000, " ")) !== FALSE) {
2967 2967
 					$model = trim($row[2]);
2968 2968
 					$newmodelsdb[$model] = trim($row[0]);
2969 2969
 				}
2970 2970
 			}
2971 2971
 			$modelsdb = array();
2972 2972
 			if (file_exists(dirname(__FILE__).'/../models/gltf2/liveries/liveries.md5sum')) {
2973
-				if (($handle = fopen(dirname(__FILE__).'/../models/gltf2/liveries/liveries.md5sum','r')) !== FALSE) {
2974
-					while (($row = fgetcsv($handle,1000," ")) !== FALSE) {
2973
+				if (($handle = fopen(dirname(__FILE__).'/../models/gltf2/liveries/liveries.md5sum', 'r')) !== FALSE) {
2974
+					while (($row = fgetcsv($handle, 1000, " ")) !== FALSE) {
2975 2975
 						$model = trim($row[2]);
2976 2976
 						$modelsdb[$model] = trim($row[0]);
2977 2977
 					}
2978 2978
 				}
2979 2979
 			}
2980
-			$diff = array_diff($newmodelsdb,$modelsdb);
2980
+			$diff = array_diff($newmodelsdb, $modelsdb);
2981 2981
 			foreach ($diff as $key => $value) {
2982 2982
 				if ($globalDebug) echo 'Downloading liveries '.$key.' ...'."\n";
2983
-				update_db::download('http://data.flightairmap.com/data/models/gltf2/liveries/'.$key,dirname(__FILE__).'/../models/gltf2/liveries/'.$key);
2983
+				update_db::download('http://data.flightairmap.com/data/models/gltf2/liveries/'.$key, dirname(__FILE__).'/../models/gltf2/liveries/'.$key);
2984 2984
 				
2985 2985
 			}
2986
-			update_db::download('http://data.flightairmap.com/data/models/gltf2/liveries/liveries.md5sum',dirname(__FILE__).'/../models/gltf2/liveries/liveries.md5sum');
2986
+			update_db::download('http://data.flightairmap.com/data/models/gltf2/liveries/liveries.md5sum', dirname(__FILE__).'/../models/gltf2/liveries/liveries.md5sum');
2987 2987
 		} else $error = "File ".$tmp_dir.'models.md5sum'." doesn't exist. Download failed.";
2988 2988
 		if ($error != '') {
2989 2989
 			return $error;
@@ -2999,32 +2999,32 @@  discard block
 block discarded – undo
2999 2999
 			return '';
3000 3000
 		}
3001 3001
 		if ($globalDebug) echo "Space models from FlightAirMap website : Download...";
3002
-		update_db::download('http://data.flightairmap.com/data/models/space/space_models.md5sum',$tmp_dir.'space_models.md5sum');
3002
+		update_db::download('http://data.flightairmap.com/data/models/space/space_models.md5sum', $tmp_dir.'space_models.md5sum');
3003 3003
 		if (file_exists($tmp_dir.'space_models.md5sum')) {
3004 3004
 			if ($globalDebug) echo "Check files...\n";
3005 3005
 			$newmodelsdb = array();
3006
-			if (($handle = fopen($tmp_dir.'space_models.md5sum','r')) !== FALSE) {
3007
-				while (($row = fgetcsv($handle,1000," ")) !== FALSE) {
3006
+			if (($handle = fopen($tmp_dir.'space_models.md5sum', 'r')) !== FALSE) {
3007
+				while (($row = fgetcsv($handle, 1000, " ")) !== FALSE) {
3008 3008
 					$model = trim($row[2]);
3009 3009
 					$newmodelsdb[$model] = trim($row[0]);
3010 3010
 				}
3011 3011
 			}
3012 3012
 			$modelsdb = array();
3013 3013
 			if (file_exists(dirname(__FILE__).'/../models/space/space_models.md5sum')) {
3014
-				if (($handle = fopen(dirname(__FILE__).'/../models/space/space_models.md5sum','r')) !== FALSE) {
3015
-					while (($row = fgetcsv($handle,1000," ")) !== FALSE) {
3014
+				if (($handle = fopen(dirname(__FILE__).'/../models/space/space_models.md5sum', 'r')) !== FALSE) {
3015
+					while (($row = fgetcsv($handle, 1000, " ")) !== FALSE) {
3016 3016
 						$model = trim($row[2]);
3017 3017
 						$modelsdb[$model] = trim($row[0]);
3018 3018
 					}
3019 3019
 				}
3020 3020
 			}
3021
-			$diff = array_diff($newmodelsdb,$modelsdb);
3021
+			$diff = array_diff($newmodelsdb, $modelsdb);
3022 3022
 			foreach ($diff as $key => $value) {
3023 3023
 				if ($globalDebug) echo 'Downloading space model '.$key.' ...'."\n";
3024
-				update_db::download('http://data.flightairmap.com/data/models/space/'.$key,dirname(__FILE__).'/../models/space/'.$key);
3024
+				update_db::download('http://data.flightairmap.com/data/models/space/'.$key, dirname(__FILE__).'/../models/space/'.$key);
3025 3025
 				
3026 3026
 			}
3027
-			update_db::download('http://data.flightairmap.com/data/models/space/space_models.md5sum',dirname(__FILE__).'/../models/space/space_models.md5sum');
3027
+			update_db::download('http://data.flightairmap.com/data/models/space/space_models.md5sum', dirname(__FILE__).'/../models/space/space_models.md5sum');
3028 3028
 		} else $error = "File ".$tmp_dir.'models.md5sum'." doesn't exist. Download failed.";
3029 3029
 		if ($error != '') {
3030 3030
 			return $error;
@@ -3040,32 +3040,32 @@  discard block
 block discarded – undo
3040 3040
 			return '';
3041 3041
 		}
3042 3042
 		if ($globalDebug) echo "Vehicules models from FlightAirMap website : Download...";
3043
-		update_db::download('http://data.flightairmap.com/data/models/vehicules/vehicules_models.md5sum',$tmp_dir.'vehicules_models.md5sum');
3043
+		update_db::download('http://data.flightairmap.com/data/models/vehicules/vehicules_models.md5sum', $tmp_dir.'vehicules_models.md5sum');
3044 3044
 		if (file_exists($tmp_dir.'vehicules_models.md5sum')) {
3045 3045
 			if ($globalDebug) echo "Check files...\n";
3046 3046
 			$newmodelsdb = array();
3047
-			if (($handle = fopen($tmp_dir.'vehicules_models.md5sum','r')) !== FALSE) {
3048
-				while (($row = fgetcsv($handle,1000," ")) !== FALSE) {
3047
+			if (($handle = fopen($tmp_dir.'vehicules_models.md5sum', 'r')) !== FALSE) {
3048
+				while (($row = fgetcsv($handle, 1000, " ")) !== FALSE) {
3049 3049
 					$model = trim($row[2]);
3050 3050
 					$newmodelsdb[$model] = trim($row[0]);
3051 3051
 				}
3052 3052
 			}
3053 3053
 			$modelsdb = array();
3054 3054
 			if (file_exists(dirname(__FILE__).'/../models/vehicules/vehicules_models.md5sum')) {
3055
-				if (($handle = fopen(dirname(__FILE__).'/../models/vehicules/vehicules_models.md5sum','r')) !== FALSE) {
3056
-					while (($row = fgetcsv($handle,1000," ")) !== FALSE) {
3055
+				if (($handle = fopen(dirname(__FILE__).'/../models/vehicules/vehicules_models.md5sum', 'r')) !== FALSE) {
3056
+					while (($row = fgetcsv($handle, 1000, " ")) !== FALSE) {
3057 3057
 						$model = trim($row[2]);
3058 3058
 						$modelsdb[$model] = trim($row[0]);
3059 3059
 					}
3060 3060
 				}
3061 3061
 			}
3062
-			$diff = array_diff($newmodelsdb,$modelsdb);
3062
+			$diff = array_diff($newmodelsdb, $modelsdb);
3063 3063
 			foreach ($diff as $key => $value) {
3064 3064
 				if ($globalDebug) echo 'Downloading vehicules model '.$key.' ...'."\n";
3065
-				update_db::download('http://data.flightairmap.com/data/models/vehicules/'.$key,dirname(__FILE__).'/../models/vehicules/'.$key);
3065
+				update_db::download('http://data.flightairmap.com/data/models/vehicules/'.$key, dirname(__FILE__).'/../models/vehicules/'.$key);
3066 3066
 				
3067 3067
 			}
3068
-			update_db::download('http://data.flightairmap.com/data/models/vehicules/vehicules_models.md5sum',dirname(__FILE__).'/../models/vehicules/vehicules_models.md5sum');
3068
+			update_db::download('http://data.flightairmap.com/data/models/vehicules/vehicules_models.md5sum', dirname(__FILE__).'/../models/vehicules/vehicules_models.md5sum');
3069 3069
 		} else $error = "File ".$tmp_dir.'models.md5sum'." doesn't exist. Download failed.";
3070 3070
 		if ($error != '') {
3071 3071
 			return $error;
@@ -3077,8 +3077,8 @@  discard block
 block discarded – undo
3077 3077
 		global $tmp_dir, $globalDebug;
3078 3078
 		date_default_timezone_set('UTC');
3079 3079
 		$Common = new Common();
3080
-		$data = $Common->getData('https://www4.icao.int/doc8643/External/AircraftTypes','post',array('X-Requested-With: XMLHttpRequest','Accept: application/json, text/javascript, */*; q=0.01','Host: www4.icao.int','Origin: https://www.icao.int','Content-Length: 0'),'','','https://www.icao.int/publications/DOC8643/Pages/Search.aspx',60);
3081
-		$all = json_decode($data,true);
3080
+		$data = $Common->getData('https://www4.icao.int/doc8643/External/AircraftTypes', 'post', array('X-Requested-With: XMLHttpRequest', 'Accept: application/json, text/javascript, */*; q=0.01', 'Host: www4.icao.int', 'Origin: https://www.icao.int', 'Content-Length: 0'), '', '', 'https://www.icao.int/publications/DOC8643/Pages/Search.aspx', 60);
3081
+		$all = json_decode($data, true);
3082 3082
 		$Connection = new Connection();
3083 3083
 		$querychk = "SELECT COUNT(1) as nb FROM aircraft WHERE icao = :icao";
3084 3084
 		$sth = $Connection->db->prepare($querychk);
@@ -3090,8 +3090,8 @@  discard block
 block discarded – undo
3090 3090
 		foreach ($all as $model) {
3091 3091
 			$icao = $model['Designator'];
3092 3092
 			if (!isset($allicao[$icao])) {
3093
-				$aircraft_shadow = 'generic_'.substr($model['EngineType'],0,1).$model['EngineCount'].$model['WTC'].'.png';
3094
-				$allicao[$icao] = array(':icao' => $icao,':type' => $model['ModelFullName'],':manufacturer' => $model['ManufacturerCode'],':aircraft_shadow' => $aircraft_shadow,':aircraft_description' => $model['AircraftDescription'],':engine_type' => $model['EngineType'],':engine_count' => $model['EngineCount'],':wake_category' => $model['WTC']);
3093
+				$aircraft_shadow = 'generic_'.substr($model['EngineType'], 0, 1).$model['EngineCount'].$model['WTC'].'.png';
3094
+				$allicao[$icao] = array(':icao' => $icao, ':type' => $model['ModelFullName'], ':manufacturer' => $model['ManufacturerCode'], ':aircraft_shadow' => $aircraft_shadow, ':aircraft_description' => $model['AircraftDescription'], ':engine_type' => $model['EngineType'], ':engine_count' => $model['EngineCount'], ':wake_category' => $model['WTC']);
3095 3095
 			} else {
3096 3096
 				$allicao[$icao][':type'] = $allicao[$icao][':type'].'/'.$model['ModelFullName'];
3097 3097
 			}
@@ -3103,9 +3103,9 @@  discard block
 block discarded – undo
3103 3103
 				if ($exist[0]['nb'] == 0) {
3104 3104
 					$sthins->execute($airdata);
3105 3105
 				} else {
3106
-					$sthup->execute(array(':type' => $airdata[':type'],':icao' => $icao));
3106
+					$sthup->execute(array(':type' => $airdata[':type'], ':icao' => $icao));
3107 3107
 				}
3108
-			} catch(PDOException $e) {
3108
+			} catch (PDOException $e) {
3109 3109
 				return "error : ".$e->getMessage();
3110 3110
 			}
3111 3111
 		}
@@ -3137,23 +3137,23 @@  discard block
 block discarded – undo
3137 3137
 			$Connection = new Connection();
3138 3138
 			$sth = $Connection->db->prepare($query);
3139 3139
                         $sth->execute();
3140
-                } catch(PDOException $e) {
3140
+                } catch (PDOException $e) {
3141 3141
                         return "error : ".$e->getMessage();
3142 3142
                 }
3143 3143
 
3144 3144
 		$error = '';
3145 3145
 		if ($globalDebug) echo "Notam : Download...";
3146
-		update_db::download($globalNOTAMSource,$tmp_dir.'notam.rss');
3146
+		update_db::download($globalNOTAMSource, $tmp_dir.'notam.rss');
3147 3147
 		if (file_exists($tmp_dir.'notam.rss')) {
3148
-			$notams = json_decode(json_encode(simplexml_load_file($tmp_dir.'notam.rss')),true);
3148
+			$notams = json_decode(json_encode(simplexml_load_file($tmp_dir.'notam.rss')), true);
3149 3149
 			foreach ($notams['channel']['item'] as $notam) {
3150
-				$title = explode(':',$notam['title']);
3150
+				$title = explode(':', $notam['title']);
3151 3151
 				$data['ref'] = trim($title[0]);
3152 3152
 				unset($title[0]);
3153
-				$data['title'] = trim(implode(':',$title));
3154
-				$description = strip_tags($notam['description'],'<pre>');
3155
-				preg_match(':^(.*?)<pre>:',$description,$match);
3156
-				$q = explode('/',$match[1]);
3153
+				$data['title'] = trim(implode(':', $title));
3154
+				$description = strip_tags($notam['description'], '<pre>');
3155
+				preg_match(':^(.*?)<pre>:', $description, $match);
3156
+				$q = explode('/', $match[1]);
3157 3157
 				$data['fir'] = $q[0];
3158 3158
 				$data['code'] = $q[1];
3159 3159
 				$ifrvfr = $q[2];
@@ -3169,30 +3169,30 @@  discard block
 block discarded – undo
3169 3169
 				$data['lower_limit'] = $q[5];
3170 3170
 				$data['upper_limit'] = $q[6];
3171 3171
 				$latlonrad = $q[7];
3172
-				sscanf($latlonrad,'%4c%c%5c%c%3d',$las,$lac,$lns,$lnc,$radius);
3173
-				$latitude = $Common->convertDec($las,'latitude');
3174
-				$longitude = $Common->convertDec($lns,'longitude');
3172
+				sscanf($latlonrad, '%4c%c%5c%c%3d', $las, $lac, $lns, $lnc, $radius);
3173
+				$latitude = $Common->convertDec($las, 'latitude');
3174
+				$longitude = $Common->convertDec($lns, 'longitude');
3175 3175
 				if ($lac == 'S') $latitude = '-'.$latitude;
3176 3176
 				if ($lnc == 'W') $longitude = '-'.$longitude;
3177 3177
 				$data['center_latitude'] = $latitude;
3178 3178
 				$data['center_longitude'] = $longitude;
3179 3179
 				$data['radius'] = intval($radius);
3180 3180
 				
3181
-				preg_match(':<pre>(.*?)</pre>:',$description,$match);
3181
+				preg_match(':<pre>(.*?)</pre>:', $description, $match);
3182 3182
 				$data['text'] = $match[1];
3183
-				preg_match(':</pre>(.*?)$:',$description,$match);
3183
+				preg_match(':</pre>(.*?)$:', $description, $match);
3184 3184
 				$fromto = $match[1];
3185
-				preg_match('#FROM:(.*?)TO:#',$fromto,$match);
3185
+				preg_match('#FROM:(.*?)TO:#', $fromto, $match);
3186 3186
 				$fromall = trim($match[1]);
3187
-				preg_match('#^(.*?) \((.*?)\)$#',$fromall,$match);
3187
+				preg_match('#^(.*?) \((.*?)\)$#', $fromall, $match);
3188 3188
 				$from = trim($match[1]);
3189
-				$data['date_begin'] = date("Y-m-d H:i:s",strtotime($from));
3190
-				preg_match('#TO:(.*?)$#',$fromto,$match);
3189
+				$data['date_begin'] = date("Y-m-d H:i:s", strtotime($from));
3190
+				preg_match('#TO:(.*?)$#', $fromto, $match);
3191 3191
 				$toall = trim($match[1]);
3192
-				if (!preg_match(':Permanent:',$toall)) {
3193
-					preg_match('#^(.*?) \((.*?)\)#',$toall,$match);
3192
+				if (!preg_match(':Permanent:', $toall)) {
3193
+					preg_match('#^(.*?) \((.*?)\)#', $toall, $match);
3194 3194
 					$to = trim($match[1]);
3195
-					$data['date_end'] = date("Y-m-d H:i:s",strtotime($to));
3195
+					$data['date_end'] = date("Y-m-d H:i:s", strtotime($to));
3196 3196
 					$data['permanent'] = 0;
3197 3197
 				} else {
3198 3198
 				    $data['date_end'] = NULL;
@@ -3200,7 +3200,7 @@  discard block
 block discarded – undo
3200 3200
 				}
3201 3201
 				$data['full_notam'] = $notam['title'].'<br>'.$notam['description'];
3202 3202
 				$NOTAM = new NOTAM();
3203
-				$NOTAM->addNOTAM($data['ref'],$data['title'],'',$data['fir'],$data['code'],'',$data['scope'],$data['lower_limit'],$data['upper_limit'],$data['center_latitude'],$data['center_longitude'],$data['radius'],$data['date_begin'],$data['date_end'],$data['permanent'],$data['text'],$data['full_notam']);
3203
+				$NOTAM->addNOTAM($data['ref'], $data['title'], '', $data['fir'], $data['code'], '', $data['scope'], $data['lower_limit'], $data['upper_limit'], $data['center_latitude'], $data['center_longitude'], $data['radius'], $data['date_begin'], $data['date_end'], $data['permanent'], $data['text'], $data['full_notam']);
3204 3204
 				unset($data);
3205 3205
 			} 
3206 3206
 		} else $error = "File ".$tmp_dir.'notam.rss'." doesn't exist. Download failed.";
@@ -3223,16 +3223,16 @@  discard block
 block discarded – undo
3223 3223
 				$Connection = new Connection();
3224 3224
 				$sth = $Connection->db->prepare($query);
3225 3225
 				$sth->execute();
3226
-			} catch(PDOException $e) {
3226
+			} catch (PDOException $e) {
3227 3227
 				return "error : ".$e->getMessage();
3228 3228
 			}
3229 3229
 		}
3230 3230
 		$Common = new Common();
3231 3231
 		$airspace_lst = $Common->getData('https://raw.githubusercontent.com/XCSoar/xcsoar-data-repository/master/data/airspace.json');
3232
-		$airspace_json = json_decode($airspace_lst,true);
3232
+		$airspace_json = json_decode($airspace_lst, true);
3233 3233
 		foreach ($airspace_json['records'] as $airspace) {
3234 3234
 			if ($globalDebug) echo $airspace['name']."...\n";
3235
-			update_db::download($airspace['uri'],$tmp_dir.$airspace['name']);
3235
+			update_db::download($airspace['uri'], $tmp_dir.$airspace['name']);
3236 3236
 			if (file_exists($tmp_dir.$airspace['name'])) {
3237 3237
 				file_put_contents($tmp_dir.$airspace['name'], utf8_encode(file_get_contents($tmp_dir.$airspace['name'])));
3238 3238
 				//system('recode l9..utf8 '.$tmp_dir.$airspace['name']);
@@ -3254,7 +3254,7 @@  discard block
 block discarded – undo
3254 3254
 				$Connection = new Connection();
3255 3255
 				$sth = $Connection->db->prepare($query);
3256 3256
 				$sth->execute(array(':new' => $new, ':old' => $old));
3257
-			} catch(PDOException $e) {
3257
+			} catch (PDOException $e) {
3258 3258
 				return "error : ".$e->getMessage();
3259 3259
 			}
3260 3260
 		}
@@ -3271,7 +3271,7 @@  discard block
 block discarded – undo
3271 3271
 			$Connection = new Connection();
3272 3272
 			$sth = $Connection->db->prepare($query);
3273 3273
                         $sth->execute();
3274
-                } catch(PDOException $e) {
3274
+                } catch (PDOException $e) {
3275 3275
                         return "error : ".$e->getMessage();
3276 3276
                 }
3277 3277
                 $row = $sth->fetch(PDO::FETCH_ASSOC);
@@ -3286,7 +3286,7 @@  discard block
 block discarded – undo
3286 3286
 			$Connection = new Connection();
3287 3287
 			$sth = $Connection->db->prepare($query);
3288 3288
                         $sth->execute();
3289
-                } catch(PDOException $e) {
3289
+                } catch (PDOException $e) {
3290 3290
                         return "error : ".$e->getMessage();
3291 3291
                 }
3292 3292
 	}
@@ -3297,7 +3297,7 @@  discard block
 block discarded – undo
3297 3297
 			$Connection = new Connection();
3298 3298
 			$sth = $Connection->db->prepare($query);
3299 3299
                         $sth->execute(array(':version' => $version));
3300
-                } catch(PDOException $e) {
3300
+                } catch (PDOException $e) {
3301 3301
                         return "error : ".$e->getMessage();
3302 3302
                 }
3303 3303
                 $row = $sth->fetch(PDO::FETCH_ASSOC);
@@ -3311,7 +3311,7 @@  discard block
 block discarded – undo
3311 3311
 			$Connection = new Connection();
3312 3312
 			$sth = $Connection->db->prepare($query);
3313 3313
                         $sth->execute(array(':version' => $version));
3314
-                } catch(PDOException $e) {
3314
+                } catch (PDOException $e) {
3315 3315
                         return "error : ".$e->getMessage();
3316 3316
                 }
3317 3317
                 $row = $sth->fetch(PDO::FETCH_ASSOC);
@@ -3325,7 +3325,7 @@  discard block
 block discarded – undo
3325 3325
 			$Connection = new Connection();
3326 3326
 			$sth = $Connection->db->prepare($query);
3327 3327
 			$sth->execute(array(':version' => $version));
3328
-		} catch(PDOException $e) {
3328
+		} catch (PDOException $e) {
3329 3329
 			return "error : ".$e->getMessage();
3330 3330
 		}
3331 3331
 		$row = $sth->fetch(PDO::FETCH_ASSOC);
@@ -3339,7 +3339,7 @@  discard block
 block discarded – undo
3339 3339
 			$Connection = new Connection();
3340 3340
 			$sth = $Connection->db->prepare($query);
3341 3341
 			$sth->execute(array(':version' => $version));
3342
-		} catch(PDOException $e) {
3342
+		} catch (PDOException $e) {
3343 3343
 			return "error : ".$e->getMessage();
3344 3344
 		}
3345 3345
 		$row = $sth->fetch(PDO::FETCH_ASSOC);
@@ -3352,7 +3352,7 @@  discard block
 block discarded – undo
3352 3352
 			$Connection = new Connection();
3353 3353
 			$sth = $Connection->db->prepare($query);
3354 3354
 			$sth->execute(array(':version' => $version));
3355
-		} catch(PDOException $e) {
3355
+		} catch (PDOException $e) {
3356 3356
 			return "error : ".$e->getMessage();
3357 3357
 		}
3358 3358
 		$row = $sth->fetch(PDO::FETCH_ASSOC);
@@ -3366,7 +3366,7 @@  discard block
 block discarded – undo
3366 3366
 			$Connection = new Connection();
3367 3367
 			$sth = $Connection->db->prepare($query);
3368 3368
 			$sth->execute(array(':version' => $version));
3369
-		} catch(PDOException $e) {
3369
+		} catch (PDOException $e) {
3370 3370
 			return "error : ".$e->getMessage();
3371 3371
 		}
3372 3372
 		$row = $sth->fetch(PDO::FETCH_ASSOC);
@@ -3380,7 +3380,7 @@  discard block
 block discarded – undo
3380 3380
 			$Connection = new Connection();
3381 3381
 			$sth = $Connection->db->prepare($query);
3382 3382
 			$sth->execute(array(':version' => $version));
3383
-		} catch(PDOException $e) {
3383
+		} catch (PDOException $e) {
3384 3384
 			return "error : ".$e->getMessage();
3385 3385
 		}
3386 3386
 		$row = $sth->fetch(PDO::FETCH_ASSOC);
@@ -3395,7 +3395,7 @@  discard block
 block discarded – undo
3395 3395
 			$Connection = new Connection();
3396 3396
 			$sth = $Connection->db->prepare($query);
3397 3397
 			$sth->execute(array(':version' => $version));
3398
-		} catch(PDOException $e) {
3398
+		} catch (PDOException $e) {
3399 3399
 			return "error : ".$e->getMessage();
3400 3400
 		}
3401 3401
 	}
@@ -3407,7 +3407,7 @@  discard block
 block discarded – undo
3407 3407
 			$Connection = new Connection();
3408 3408
 			$sth = $Connection->db->prepare($query);
3409 3409
 			$sth->execute(array(':version' => $version));
3410
-		} catch(PDOException $e) {
3410
+		} catch (PDOException $e) {
3411 3411
 			return "error : ".$e->getMessage();
3412 3412
 		}
3413 3413
 	}
@@ -3419,7 +3419,7 @@  discard block
 block discarded – undo
3419 3419
 			$Connection = new Connection();
3420 3420
 			$sth = $Connection->db->prepare($query);
3421 3421
 			$sth->execute(array(':version' => $version));
3422
-		} catch(PDOException $e) {
3422
+		} catch (PDOException $e) {
3423 3423
 			return "error : ".$e->getMessage();
3424 3424
 		}
3425 3425
 	}
@@ -3431,7 +3431,7 @@  discard block
 block discarded – undo
3431 3431
 			$Connection = new Connection();
3432 3432
 			$sth = $Connection->db->prepare($query);
3433 3433
                         $sth->execute(array(':version' => $version));
3434
-                } catch(PDOException $e) {
3434
+                } catch (PDOException $e) {
3435 3435
                         return "error : ".$e->getMessage();
3436 3436
                 }
3437 3437
 	}
@@ -3443,7 +3443,7 @@  discard block
 block discarded – undo
3443 3443
 			$Connection = new Connection();
3444 3444
 			$sth = $Connection->db->prepare($query);
3445 3445
 			$sth->execute(array(':version' => $version));
3446
-		} catch(PDOException $e) {
3446
+		} catch (PDOException $e) {
3447 3447
 			return "error : ".$e->getMessage();
3448 3448
 		}
3449 3449
 	}
@@ -3455,7 +3455,7 @@  discard block
 block discarded – undo
3455 3455
 			$Connection = new Connection();
3456 3456
 			$sth = $Connection->db->prepare($query);
3457 3457
 			$sth->execute(array(':version' => $version));
3458
-		} catch(PDOException $e) {
3458
+		} catch (PDOException $e) {
3459 3459
 			return "error : ".$e->getMessage();
3460 3460
 		}
3461 3461
 	}
@@ -3466,7 +3466,7 @@  discard block
 block discarded – undo
3466 3466
 			$Connection = new Connection();
3467 3467
 			$sth = $Connection->db->prepare($query);
3468 3468
 			$sth->execute(array(':version' => $version));
3469
-		} catch(PDOException $e) {
3469
+		} catch (PDOException $e) {
3470 3470
 			return "error : ".$e->getMessage();
3471 3471
 		}
3472 3472
 	}
@@ -3482,7 +3482,7 @@  discard block
 block discarded – undo
3482 3482
 			$Connection = new Connection();
3483 3483
 			$sth = $Connection->db->prepare($query);
3484 3484
                         $sth->execute();
3485
-                } catch(PDOException $e) {
3485
+                } catch (PDOException $e) {
3486 3486
                         return "error : ".$e->getMessage();
3487 3487
                 }
3488 3488
                 $row = $sth->fetch(PDO::FETCH_ASSOC);
@@ -3497,7 +3497,7 @@  discard block
 block discarded – undo
3497 3497
 			$Connection = new Connection();
3498 3498
 			$sth = $Connection->db->prepare($query);
3499 3499
                         $sth->execute();
3500
-                } catch(PDOException $e) {
3500
+                } catch (PDOException $e) {
3501 3501
                         return "error : ".$e->getMessage();
3502 3502
                 }
3503 3503
 	}
@@ -3513,7 +3513,7 @@  discard block
 block discarded – undo
3513 3513
 			$Connection = new Connection();
3514 3514
 			$sth = $Connection->db->prepare($query);
3515 3515
                         $sth->execute();
3516
-                } catch(PDOException $e) {
3516
+                } catch (PDOException $e) {
3517 3517
                         return "error : ".$e->getMessage();
3518 3518
                 }
3519 3519
                 $row = $sth->fetch(PDO::FETCH_ASSOC);
@@ -3528,7 +3528,7 @@  discard block
 block discarded – undo
3528 3528
 			$Connection = new Connection();
3529 3529
 			$sth = $Connection->db->prepare($query);
3530 3530
                         $sth->execute();
3531
-                } catch(PDOException $e) {
3531
+                } catch (PDOException $e) {
3532 3532
                         return "error : ".$e->getMessage();
3533 3533
                 }
3534 3534
 	}
@@ -3544,7 +3544,7 @@  discard block
 block discarded – undo
3544 3544
 			$Connection = new Connection();
3545 3545
 			$sth = $Connection->db->prepare($query);
3546 3546
                         $sth->execute();
3547
-                } catch(PDOException $e) {
3547
+                } catch (PDOException $e) {
3548 3548
                         return "error : ".$e->getMessage();
3549 3549
                 }
3550 3550
                 $row = $sth->fetch(PDO::FETCH_ASSOC);
@@ -3559,7 +3559,7 @@  discard block
 block discarded – undo
3559 3559
 			$Connection = new Connection();
3560 3560
 			$sth = $Connection->db->prepare($query);
3561 3561
                         $sth->execute();
3562
-                } catch(PDOException $e) {
3562
+                } catch (PDOException $e) {
3563 3563
                         return "error : ".$e->getMessage();
3564 3564
                 }
3565 3565
 	}
@@ -3575,7 +3575,7 @@  discard block
 block discarded – undo
3575 3575
 			$Connection = new Connection();
3576 3576
 			$sth = $Connection->db->prepare($query);
3577 3577
 			$sth->execute();
3578
-		} catch(PDOException $e) {
3578
+		} catch (PDOException $e) {
3579 3579
 			return "error : ".$e->getMessage();
3580 3580
 		}
3581 3581
 		$row = $sth->fetch(PDO::FETCH_ASSOC);
@@ -3590,7 +3590,7 @@  discard block
 block discarded – undo
3590 3590
 			$Connection = new Connection();
3591 3591
 			$sth = $Connection->db->prepare($query);
3592 3592
 			$sth->execute();
3593
-		} catch(PDOException $e) {
3593
+		} catch (PDOException $e) {
3594 3594
 			return "error : ".$e->getMessage();
3595 3595
 		}
3596 3596
 	}
@@ -3606,7 +3606,7 @@  discard block
 block discarded – undo
3606 3606
 			$Connection = new Connection();
3607 3607
 			$sth = $Connection->db->prepare($query);
3608 3608
 			$sth->execute();
3609
-		} catch(PDOException $e) {
3609
+		} catch (PDOException $e) {
3610 3610
 			return "error : ".$e->getMessage();
3611 3611
 		}
3612 3612
 		$row = $sth->fetch(PDO::FETCH_ASSOC);
@@ -3621,7 +3621,7 @@  discard block
 block discarded – undo
3621 3621
 			$Connection = new Connection();
3622 3622
 			$sth = $Connection->db->prepare($query);
3623 3623
 			$sth->execute();
3624
-		} catch(PDOException $e) {
3624
+		} catch (PDOException $e) {
3625 3625
 			return "error : ".$e->getMessage();
3626 3626
 		}
3627 3627
 	}
@@ -3637,7 +3637,7 @@  discard block
 block discarded – undo
3637 3637
 			$Connection = new Connection();
3638 3638
 			$sth = $Connection->db->prepare($query);
3639 3639
 			$sth->execute();
3640
-		} catch(PDOException $e) {
3640
+		} catch (PDOException $e) {
3641 3641
 			return "error : ".$e->getMessage();
3642 3642
 		}
3643 3643
 		$row = $sth->fetch(PDO::FETCH_ASSOC);
@@ -3652,7 +3652,7 @@  discard block
 block discarded – undo
3652 3652
 			$Connection = new Connection();
3653 3653
 			$sth = $Connection->db->prepare($query);
3654 3654
 			$sth->execute();
3655
-		} catch(PDOException $e) {
3655
+		} catch (PDOException $e) {
3656 3656
 			return "error : ".$e->getMessage();
3657 3657
 		}
3658 3658
 	}
@@ -3668,7 +3668,7 @@  discard block
 block discarded – undo
3668 3668
 			$Connection = new Connection();
3669 3669
 			$sth = $Connection->db->prepare($query);
3670 3670
                         $sth->execute();
3671
-                } catch(PDOException $e) {
3671
+                } catch (PDOException $e) {
3672 3672
                         return "error : ".$e->getMessage();
3673 3673
                 }
3674 3674
                 $row = $sth->fetch(PDO::FETCH_ASSOC);
@@ -3683,7 +3683,7 @@  discard block
 block discarded – undo
3683 3683
 			$Connection = new Connection();
3684 3684
 			$sth = $Connection->db->prepare($query);
3685 3685
 			$sth->execute();
3686
-		} catch(PDOException $e) {
3686
+		} catch (PDOException $e) {
3687 3687
 			return "error : ".$e->getMessage();
3688 3688
 		}
3689 3689
 	}
@@ -3699,7 +3699,7 @@  discard block
 block discarded – undo
3699 3699
 			$Connection = new Connection();
3700 3700
 			$sth = $Connection->db->prepare($query);
3701 3701
 			$sth->execute();
3702
-		} catch(PDOException $e) {
3702
+		} catch (PDOException $e) {
3703 3703
 			return "error : ".$e->getMessage();
3704 3704
 		}
3705 3705
 		$row = $sth->fetch(PDO::FETCH_ASSOC);
@@ -3714,7 +3714,7 @@  discard block
 block discarded – undo
3714 3714
 			$Connection = new Connection();
3715 3715
 			$sth = $Connection->db->prepare($query);
3716 3716
 			$sth->execute();
3717
-		} catch(PDOException $e) {
3717
+		} catch (PDOException $e) {
3718 3718
 			return "error : ".$e->getMessage();
3719 3719
 		}
3720 3720
 	}
@@ -3730,7 +3730,7 @@  discard block
 block discarded – undo
3730 3730
 			$Connection = new Connection();
3731 3731
 			$sth = $Connection->db->prepare($query);
3732 3732
 			$sth->execute();
3733
-		} catch(PDOException $e) {
3733
+		} catch (PDOException $e) {
3734 3734
 			return "error : ".$e->getMessage();
3735 3735
 		}
3736 3736
 		$row = $sth->fetch(PDO::FETCH_ASSOC);
@@ -3745,7 +3745,7 @@  discard block
 block discarded – undo
3745 3745
 			$Connection = new Connection();
3746 3746
 			$sth = $Connection->db->prepare($query);
3747 3747
 			$sth->execute();
3748
-		} catch(PDOException $e) {
3748
+		} catch (PDOException $e) {
3749 3749
 			return "error : ".$e->getMessage();
3750 3750
 		}
3751 3751
 	}
@@ -3761,7 +3761,7 @@  discard block
 block discarded – undo
3761 3761
 			$Connection = new Connection();
3762 3762
 			$sth = $Connection->db->prepare($query);
3763 3763
 			$sth->execute();
3764
-		} catch(PDOException $e) {
3764
+		} catch (PDOException $e) {
3765 3765
 			return "error : ".$e->getMessage();
3766 3766
 		}
3767 3767
 		$row = $sth->fetch(PDO::FETCH_ASSOC);
@@ -3776,7 +3776,7 @@  discard block
 block discarded – undo
3776 3776
 			$Connection = new Connection();
3777 3777
 			$sth = $Connection->db->prepare($query);
3778 3778
 			$sth->execute();
3779
-		} catch(PDOException $e) {
3779
+		} catch (PDOException $e) {
3780 3780
 			return "error : ".$e->getMessage();
3781 3781
 		}
3782 3782
 	}
@@ -3792,7 +3792,7 @@  discard block
 block discarded – undo
3792 3792
 			$Connection = new Connection();
3793 3793
 			$sth = $Connection->db->prepare($query);
3794 3794
 			$sth->execute();
3795
-		} catch(PDOException $e) {
3795
+		} catch (PDOException $e) {
3796 3796
 			return "error : ".$e->getMessage();
3797 3797
 		}
3798 3798
 		$row = $sth->fetch(PDO::FETCH_ASSOC);
@@ -3811,7 +3811,7 @@  discard block
 block discarded – undo
3811 3811
 			$Connection = new Connection();
3812 3812
 			$sth = $Connection->db->prepare($query);
3813 3813
 			$sth->execute();
3814
-		} catch(PDOException $e) {
3814
+		} catch (PDOException $e) {
3815 3815
 			return "error : ".$e->getMessage();
3816 3816
 		}
3817 3817
 		$row = $sth->fetch(PDO::FETCH_ASSOC);
@@ -3826,7 +3826,7 @@  discard block
 block discarded – undo
3826 3826
 			$Connection = new Connection();
3827 3827
 			$sth = $Connection->db->prepare($query);
3828 3828
 			$sth->execute();
3829
-		} catch(PDOException $e) {
3829
+		} catch (PDOException $e) {
3830 3830
 			return "error : ".$e->getMessage();
3831 3831
 		}
3832 3832
 	}
@@ -3838,7 +3838,7 @@  discard block
 block discarded – undo
3838 3838
 			$Connection = new Connection();
3839 3839
 			$sth = $Connection->db->prepare($query);
3840 3840
 			$sth->execute();
3841
-		} catch(PDOException $e) {
3841
+		} catch (PDOException $e) {
3842 3842
 			return "error : ".$e->getMessage();
3843 3843
 		}
3844 3844
 	}
@@ -3854,7 +3854,7 @@  discard block
 block discarded – undo
3854 3854
 			$Connection = new Connection();
3855 3855
 			$sth = $Connection->db->prepare($query);
3856 3856
                         $sth->execute();
3857
-                } catch(PDOException $e) {
3857
+                } catch (PDOException $e) {
3858 3858
                         return "error : ".$e->getMessage();
3859 3859
                 }
3860 3860
 	}
@@ -3869,7 +3869,7 @@  discard block
 block discarded – undo
3869 3869
 			$Connection = new Connection();
3870 3870
 			$sth = $Connection->db->prepare($query);
3871 3871
                         $sth->execute();
3872
-                } catch(PDOException $e) {
3872
+                } catch (PDOException $e) {
3873 3873
                         return "error : ".$e->getMessage();
3874 3874
                 }
3875 3875
 	}
Please login to merge, or discard this patch.
Braces   +1252 added lines, -433 removed lines patch added patch discarded remove patch
@@ -36,7 +36,9 @@  discard block
 block discarded – undo
36 36
 		curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
37 37
 		curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
38 38
 		curl_setopt($ch, CURLOPT_TIMEOUT, 200);
39
-		if ($referer != '') curl_setopt($ch, CURLOPT_REFERER, $referer);
39
+		if ($referer != '') {
40
+			curl_setopt($ch, CURLOPT_REFERER, $referer);
41
+		}
40 42
 		curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.1.2) Gecko/20090729 Firefox/3.5.2 GTB5');
41 43
 		curl_setopt($ch, CURLOPT_FILE, $fp);
42 44
 		curl_exec($ch);
@@ -47,12 +49,16 @@  discard block
 block discarded – undo
47 49
 	public static function gunzip($in_file,$out_file_name = '') {
48 50
 		//echo $in_file.' -> '.$out_file_name."\n";
49 51
 		$buffer_size = 4096; // read 4kb at a time
50
-		if ($out_file_name == '') $out_file_name = str_replace('.gz', '', $in_file); 
52
+		if ($out_file_name == '') {
53
+			$out_file_name = str_replace('.gz', '', $in_file);
54
+		}
51 55
 		if ($in_file != '' && file_exists($in_file)) {
52 56
 			// PHP version of Ubuntu use gzopen64 instead of gzopen
53
-			if (function_exists('gzopen')) $file = gzopen($in_file,'rb');
54
-			elseif (function_exists('gzopen64')) $file = gzopen64($in_file,'rb');
55
-			else {
57
+			if (function_exists('gzopen')) {
58
+				$file = gzopen($in_file,'rb');
59
+			} elseif (function_exists('gzopen64')) {
60
+				$file = gzopen64($in_file,'rb');
61
+			} else {
56 62
 				echo 'gzopen not available';
57 63
 				die;
58 64
 			}
@@ -73,8 +79,12 @@  discard block
 block discarded – undo
73 79
 			if ($res === TRUE) {
74 80
 				$zip->extractTo($path);
75 81
 				$zip->close();
76
-			} else return false;
77
-		} else return false;
82
+			} else {
83
+				return false;
84
+			}
85
+		} else {
86
+			return false;
87
+		}
78 88
 	}
79 89
 	
80 90
 	public static function connect_sqlite($database) {
@@ -89,7 +99,9 @@  discard block
 block discarded – undo
89 99
 	public static function retrieve_route_sqlite_to_dest($database_file) {
90 100
 		global $globalDebug, $globalTransaction;
91 101
 		//$query = 'TRUNCATE TABLE routes';
92
-		if ($globalDebug) echo " - Delete previous routes from DB -";
102
+		if ($globalDebug) {
103
+			echo " - Delete previous routes from DB -";
104
+		}
93 105
 		$query = "DELETE FROM routes WHERE Source = '' OR Source = :source";
94 106
 		$Connection = new Connection();
95 107
 		try {
@@ -100,7 +112,9 @@  discard block
 block discarded – undo
100 112
                         return "error : ".$e->getMessage();
101 113
                 }
102 114
 
103
-    		if ($globalDebug) echo " - Add routes to DB -";
115
+    		if ($globalDebug) {
116
+    			echo " - Add routes to DB -";
117
+    		}
104 118
     		update_db::connect_sqlite($database_file);
105 119
 		//$query = 'select Route.RouteID, Route.callsign, operator.Icao AS operator_icao, FromAir.Icao AS FromAirportIcao, ToAir.Icao AS ToAirportIcao from Route inner join operator ON Route.operatorId = operator.operatorId LEFT JOIN Airport AS FromAir ON route.FromAirportId = FromAir.AirportId LEFT JOIN Airport AS ToAir ON ToAir.AirportID = route.ToAirportID';
106 120
 		$query = "select Route.RouteID, Route.callsign, operator.Icao AS operator_icao, FromAir.Icao AS FromAirportIcao, ToAir.Icao AS ToAirportIcao, rstp.allstop AS AllStop from Route inner join operator ON Route.operatorId = operator.operatorId LEFT JOIN Airport AS FromAir ON route.FromAirportId = FromAir.AirportId LEFT JOIN Airport AS ToAir ON ToAir.AirportID = route.ToAirportID LEFT JOIN (select RouteId,GROUP_CONCAT(icao,' ') as allstop from routestop left join Airport as air ON routestop.AirportId = air.AirportID group by RouteID) AS rstp ON Route.RouteID = rstp.RouteID";
@@ -115,15 +129,21 @@  discard block
 block discarded – undo
115 129
 		$Connection = new Connection();
116 130
 		$sth_dest = $Connection->db->prepare($query_dest);
117 131
 		try {
118
-			if ($globalTransaction) $Connection->db->beginTransaction();
132
+			if ($globalTransaction) {
133
+				$Connection->db->beginTransaction();
134
+			}
119 135
             		while ($values = $sth->fetch(PDO::FETCH_ASSOC)) {
120 136
 				//$query_dest_values = array(':RouteID' => $values['RouteId'],':CallSign' => $values['Callsign'],':Operator_ICAO' => $values['operator_icao'],':FromAirport_ICAO' => $values['FromAirportIcao'],':ToAirport_ICAO' => $values['ToAirportIcao'],':routestop' => $values['AllStop'],':source' => $database_file);
121 137
 				$query_dest_values = array(':CallSign' => $values['Callsign'],':Operator_ICAO' => $values['operator_icao'],':FromAirport_ICAO' => $values['FromAirportIcao'],':ToAirport_ICAO' => $values['ToAirportIcao'],':routestop' => $values['AllStop'],':source' => $database_file);
122 138
 				$sth_dest->execute($query_dest_values);
123 139
             		}
124
-			if ($globalTransaction) $Connection->db->commit();
140
+			if ($globalTransaction) {
141
+				$Connection->db->commit();
142
+			}
125 143
 		} catch(PDOException $e) {
126
-			if ($globalTransaction) $Connection->db->rollBack(); 
144
+			if ($globalTransaction) {
145
+				$Connection->db->rollBack();
146
+			}
127 147
 			return "error : ".$e->getMessage();
128 148
 		}
129 149
                 return '';
@@ -131,7 +151,9 @@  discard block
 block discarded – undo
131 151
 	public static function retrieve_route_oneworld($database_file) {
132 152
 		global $globalDebug, $globalTransaction;
133 153
 		//$query = 'TRUNCATE TABLE routes';
134
-		if ($globalDebug) echo " - Delete previous routes from DB -";
154
+		if ($globalDebug) {
155
+			echo " - Delete previous routes from DB -";
156
+		}
135 157
 		$query = "DELETE FROM routes WHERE Source = '' OR Source = :source";
136 158
 		$Connection = new Connection();
137 159
 		try {
@@ -142,14 +164,18 @@  discard block
 block discarded – undo
142 164
                         return "error : ".$e->getMessage();
143 165
                 }
144 166
 
145
-    		if ($globalDebug) echo " - Add routes to DB -";
167
+    		if ($globalDebug) {
168
+    			echo " - Add routes to DB -";
169
+    		}
146 170
 		require_once(dirname(__FILE__).'/../require/class.Spotter.php');
147 171
 		$Spotter = new Spotter();
148 172
 		if ($fh = fopen($database_file,"r")) {
149 173
 			$query_dest = 'INSERT INTO routes (CallSign,Operator_ICAO,FromAirport_ICAO,FromAirport_Time,ToAirport_ICAO,ToAirport_Time,RouteStop,Source) VALUES (:CallSign, :Operator_ICAO, :FromAirport_ICAO,:FromAirport_Time, :ToAirport_ICAO, :ToAirport_Time,:routestop, :source)';
150 174
 			$Connection = new Connection();
151 175
 			$sth_dest = $Connection->db->prepare($query_dest);
152
-			if ($globalTransaction) $Connection->db->beginTransaction();
176
+			if ($globalTransaction) {
177
+				$Connection->db->beginTransaction();
178
+			}
153 179
 			while (!feof($fh)) {
154 180
 				$line = fgetcsv($fh,9999,',');
155 181
 				if ($line[0] != '') {
@@ -158,13 +184,17 @@  discard block
 block discarded – undo
158 184
 							$query_dest_values = array(':CallSign' => str_replace('*','',$line[7]),':Operator_ICAO' => '',':FromAirport_ICAO' => $Spotter->getAirportICAO($line[0]),':FromAirport_Time' => $line[5],':ToAirport_ICAO' => $Spotter->getAirportICAO($line[1]),':ToAirport_Time' => $line[6],':routestop' => '',':source' => 'oneworld');
159 185
 							$sth_dest->execute($query_dest_values);
160 186
 						} catch(PDOException $e) {
161
-							if ($globalTransaction) $Connection->db->rollBack(); 
187
+							if ($globalTransaction) {
188
+								$Connection->db->rollBack();
189
+							}
162 190
 							return "error : ".$e->getMessage();
163 191
 						}
164 192
 					}
165 193
 				}
166 194
 			}
167
-			if ($globalTransaction) $Connection->db->commit();
195
+			if ($globalTransaction) {
196
+				$Connection->db->commit();
197
+			}
168 198
 		}
169 199
                 return '';
170 200
 	}
@@ -172,7 +202,9 @@  discard block
 block discarded – undo
172 202
 	public static function retrieve_route_skyteam($database_file) {
173 203
 		global $globalDebug, $globalTransaction;
174 204
 		//$query = 'TRUNCATE TABLE routes';
175
-		if ($globalDebug) echo " - Delete previous routes from DB -";
205
+		if ($globalDebug) {
206
+			echo " - Delete previous routes from DB -";
207
+		}
176 208
 		$query = "DELETE FROM routes WHERE Source = '' OR Source = :source";
177 209
 		$Connection = new Connection();
178 210
 		try {
@@ -183,7 +215,9 @@  discard block
 block discarded – undo
183 215
                         return "error : ".$e->getMessage();
184 216
                 }
185 217
 
186
-    		if ($globalDebug) echo " - Add routes to DB -";
218
+    		if ($globalDebug) {
219
+    			echo " - Add routes to DB -";
220
+    		}
187 221
 
188 222
 		require_once(dirname(__FILE__).'/../require/class.Spotter.php');
189 223
 		$Spotter = new Spotter();
@@ -192,7 +226,9 @@  discard block
 block discarded – undo
192 226
 			$Connection = new Connection();
193 227
 			$sth_dest = $Connection->db->prepare($query_dest);
194 228
 			try {
195
-				if ($globalTransaction) $Connection->db->beginTransaction();
229
+				if ($globalTransaction) {
230
+					$Connection->db->beginTransaction();
231
+				}
196 232
 				while (!feof($fh)) {
197 233
 					$line = fgetcsv($fh,9999,',');
198 234
 					if ($line[0] != '') {
@@ -203,9 +239,13 @@  discard block
 block discarded – undo
203 239
 						}
204 240
 					}
205 241
 				}
206
-				if ($globalTransaction) $Connection->db->commit();
242
+				if ($globalTransaction) {
243
+					$Connection->db->commit();
244
+				}
207 245
 			} catch(PDOException $e) {
208
-				if ($globalTransaction) $Connection->db->rollBack(); 
246
+				if ($globalTransaction) {
247
+					$Connection->db->rollBack();
248
+				}
209 249
 				return "error : ".$e->getMessage();
210 250
 			}
211 251
 		}
@@ -248,11 +288,16 @@  discard block
 block discarded – undo
248 288
 		$sth_dest = $Connection->db->prepare($query_dest);
249 289
 		$sth_dest_owner = $Connection->db->prepare($query_dest_owner);
250 290
 		try {
251
-			if ($globalTransaction) $Connection->db->beginTransaction();
291
+			if ($globalTransaction) {
292
+				$Connection->db->beginTransaction();
293
+			}
252 294
             		while ($values = $sth->fetch(PDO::FETCH_ASSOC)) {
253 295
 			//$query_dest_values = array(':AircraftID' => $values['AircraftID'],':FirstCreated' => $values['FirstCreated'],':LastModified' => $values['LastModified'],':ModeS' => $values['ModeS'],':ModeSCountry' => $values['ModeSCountry'],':Registration' => $values['Registration'],':ICAOTypeCode' => $values['ICAOTypeCode'],':SerialNo' => $values['SerialNo'], ':OperatorFlagCode' => $values['OperatorFlagCode'], ':Manufacturer' => $values['Manufacturer'], ':Type' => $values['Type'], ':FirstRegDate' => $values['FirstRegDate'], ':CurrentRegDate' => $values['CurrentRegDate'], ':Country' => $values['Country'], ':PreviousID' => $values['PreviousID'], ':DeRegDate' => $values['DeRegDate'], ':Status' => $values['Status'], ':PopularName' => $values['PopularName'],':GenericName' => $values['GenericName'],':AircraftClass' => $values['AircraftClass'], ':Engines' => $values['Engines'], ':OwnershipStatus' => $values['OwnershipStatus'],':RegisteredOwners' => $values['RegisteredOwners'],':MTOW' => $values['MTOW'], ':TotalHours' => $values['TotalHours'],':YearBuilt' => $values['YearBuilt'], ':CofACategory' => $values['CofACategory'], ':CofAExpiry' => $values['CofAExpiry'], ':UserNotes' => $values['UserNotes'], ':Interested' => $values['Interested'], ':UserTag' => $values['UserTag'], ':InfoUrl' => $values['InfoURL'], ':PictureUrl1' => $values['PictureURL1'], ':PictureUrl2' => $values['PictureURL2'], ':PictureUrl3' => $values['PictureURL3'], ':UserBool1' => $values['UserBool1'], ':UserBool2' => $values['UserBool2'], ':UserBool3' => $values['UserBool3'], ':UserBool4' => $values['UserBool4'], ':UserBool5' => $values['UserBool5'], ':UserString1' => $values['UserString1'], ':UserString2' => $values['UserString2'], ':UserString3' => $values['UserString3'], ':UserString4' => $values['UserString4'], ':UserString5' => $values['UserString5'], ':UserInt1' => $values['UserInt1'], ':UserInt2' => $values['UserInt2'], ':UserInt3' => $values['UserInt3'], ':UserInt4' => $values['UserInt4'], ':UserInt5' => $values['UserInt5']);
254
-				if ($values['UserString4'] == 'M') $type = 'military';
255
-				else $type = null;
296
+				if ($values['UserString4'] == 'M') {
297
+					$type = 'military';
298
+				} else {
299
+					$type = null;
300
+				}
256 301
 				$query_dest_values = array(':LastModified' => $values['LastModified'],':ModeS' => $values['ModeS'],':ModeSCountry' => $values['ModeSCountry'],':Registration' => $values['Registration'],':ICAOTypeCode' => $values['ICAOTypeCode'],':source' => $database_file,':type' => $type);
257 302
 				$sth_dest->execute($query_dest_values);
258 303
 				if ($values['RegisteredOwners'] != '' && $values['RegisteredOwners'] != NULL && $values['RegisteredOwners'] != 'Private') {
@@ -260,7 +305,9 @@  discard block
 block discarded – undo
260 305
 				    $sth_dest_owner->execute($query_dest_owner_values);
261 306
 				}
262 307
             		}
263
-			if ($globalTransaction) $Connection->db->commit();
308
+			if ($globalTransaction) {
309
+				$Connection->db->commit();
310
+			}
264 311
 		} catch(PDOException $e) {
265 312
 			return "error : ".$e->getMessage();
266 313
 		}
@@ -297,7 +344,9 @@  discard block
 block discarded – undo
297 344
 			$Connection = new Connection();
298 345
 			$sth_dest = $Connection->db->prepare($query_dest);
299 346
 			try {
300
-				if ($globalTransaction) $Connection->db->beginTransaction();
347
+				if ($globalTransaction) {
348
+					$Connection->db->beginTransaction();
349
+				}
301 350
             			while (!feof($fh)) {
302 351
             				$values = array();
303 352
             				$line = $Common->hex2str(fgets($fh,9999));
@@ -308,7 +357,9 @@  discard block
 block discarded – undo
308 357
             				// Check if we can find ICAO, else set it to GLID
309 358
             				$aircraft_name_split = explode(' ',$aircraft_name);
310 359
             				$search_more = '';
311
-            				if (count($aircraft_name) > 1 && strlen($aircraft_name_split[1]) > 3) $search_more .= " AND LIKE '%".$aircraft_name_split[0]."%'";
360
+            				if (count($aircraft_name) > 1 && strlen($aircraft_name_split[1]) > 3) {
361
+            					$search_more .= " AND LIKE '%".$aircraft_name_split[0]."%'";
362
+            				}
312 363
             				$query_search = "SELECT * FROM aircraft WHERE type LIKE '%".$aircraft_name."%'".$search_more;
313 364
             				$sth_search = $Connection->db->prepare($query_search);
314 365
 					try {
@@ -321,7 +372,9 @@  discard block
 block discarded – undo
321 372
 					} catch(PDOException $e) {
322 373
 						return "error : ".$e->getMessage();
323 374
 					}
324
-					if (!isset($values['ICAOTypeCode'])) $values['ICAOTypeCode'] = 'GLID';
375
+					if (!isset($values['ICAOTypeCode'])) {
376
+						$values['ICAOTypeCode'] = 'GLID';
377
+					}
325 378
 					// Add data to db
326 379
 					if ($values['Registration'] != '' && $values['Registration'] != '0000') {
327 380
 						//$query_dest_values = array(':AircraftID' => $values['AircraftID'],':FirstCreated' => $values['FirstCreated'],':LastModified' => $values['LastModified'],':ModeS' => $values['ModeS'],':ModeSCountry' => $values['ModeSCountry'],':Registration' => $values['Registration'],':ICAOTypeCode' => $values['ICAOTypeCode'],':SerialNo' => $values['SerialNo'], ':OperatorFlagCode' => $values['OperatorFlagCode'], ':Manufacturer' => $values['Manufacturer'], ':Type' => $values['Type'], ':FirstRegDate' => $values['FirstRegDate'], ':CurrentRegDate' => $values['CurrentRegDate'], ':Country' => $values['Country'], ':PreviousID' => $values['PreviousID'], ':DeRegDate' => $values['DeRegDate'], ':Status' => $values['Status'], ':PopularName' => $values['PopularName'],':GenericName' => $values['GenericName'],':AircraftClass' => $values['AircraftClass'], ':Engines' => $values['Engines'], ':OwnershipStatus' => $values['OwnershipStatus'],':RegisteredOwners' => $values['RegisteredOwners'],':MTOW' => $values['MTOW'], ':TotalHours' => $values['TotalHours'],':YearBuilt' => $values['YearBuilt'], ':CofACategory' => $values['CofACategory'], ':CofAExpiry' => $values['CofAExpiry'], ':UserNotes' => $values['UserNotes'], ':Interested' => $values['Interested'], ':UserTag' => $values['UserTag'], ':InfoUrl' => $values['InfoURL'], ':PictureUrl1' => $values['PictureURL1'], ':PictureUrl2' => $values['PictureURL2'], ':PictureUrl3' => $values['PictureURL3'], ':UserBool1' => $values['UserBool1'], ':UserBool2' => $values['UserBool2'], ':UserBool3' => $values['UserBool3'], ':UserBool4' => $values['UserBool4'], ':UserBool5' => $values['UserBool5'], ':UserString1' => $values['UserString1'], ':UserString2' => $values['UserString2'], ':UserString3' => $values['UserString3'], ':UserString4' => $values['UserString4'], ':UserString5' => $values['UserString5'], ':UserInt1' => $values['UserInt1'], ':UserInt2' => $values['UserInt2'], ':UserInt3' => $values['UserInt3'], ':UserInt4' => $values['UserInt4'], ':UserInt5' => $values['UserInt5']);
@@ -330,7 +383,9 @@  discard block
 block discarded – undo
330 383
 						$sth_dest->execute($query_dest_values);
331 384
 					}
332 385
 				}
333
-				if ($globalTransaction) $Connection->db->commit();
386
+				if ($globalTransaction) {
387
+					$Connection->db->commit();
388
+				}
334 389
 			} catch(PDOException $e) {
335 390
 				return "error : ".$e->getMessage();
336 391
 			}
@@ -366,7 +421,9 @@  discard block
 block discarded – undo
366 421
 			$Connection = new Connection();
367 422
 			$sth_dest = $Connection->db->prepare($query_dest);
368 423
 			try {
369
-				if ($globalTransaction) $Connection->db->beginTransaction();
424
+				if ($globalTransaction) {
425
+					$Connection->db->beginTransaction();
426
+				}
370 427
 				$tmp = fgetcsv($fh,9999,',',"'");
371 428
             			while (!feof($fh)) {
372 429
             				$line = fgetcsv($fh,9999,',',"'");
@@ -380,13 +437,17 @@  discard block
 block discarded – undo
380 437
             				// Check if we can find ICAO, else set it to GLID
381 438
             				$aircraft_name_split = explode(' ',$aircraft_name);
382 439
             				$search_more = '';
383
-            				if (count($aircraft_name) > 1 && strlen($aircraft_name_split[1]) > 3) $search_more .= " AND LIKE '%".$aircraft_name_split[0]."%'";
440
+            				if (count($aircraft_name) > 1 && strlen($aircraft_name_split[1]) > 3) {
441
+            					$search_more .= " AND LIKE '%".$aircraft_name_split[0]."%'";
442
+            				}
384 443
             				$query_search = "SELECT * FROM aircraft WHERE type LIKE '%".$aircraft_name."%'".$search_more;
385 444
             				$sth_search = $Connection->db->prepare($query_search);
386 445
 					try {
387 446
                                     		$sth_search->execute();
388 447
 	            				$result = $sth_search->fetch(PDO::FETCH_ASSOC);
389
-	            				if (isset($result['icao']) && $result['icao'] != '') $values['ICAOTypeCode'] = $result['icao'];
448
+	            				if (isset($result['icao']) && $result['icao'] != '') {
449
+	            					$values['ICAOTypeCode'] = $result['icao'];
450
+	            				}
390 451
 					} catch(PDOException $e) {
391 452
 						return "error : ".$e->getMessage();
392 453
 					}
@@ -399,7 +460,9 @@  discard block
 block discarded – undo
399 460
 						$sth_dest->execute($query_dest_values);
400 461
 					}
401 462
 				}
402
-				if ($globalTransaction) $Connection->db->commit();
463
+				if ($globalTransaction) {
464
+					$Connection->db->commit();
465
+				}
403 466
 			} catch(PDOException $e) {
404 467
 				return "error : ".$e->getMessage();
405 468
 			}
@@ -438,7 +501,9 @@  discard block
 block discarded – undo
438 501
 			$sth_dest = $Connection->db->prepare($query_dest);
439 502
 			$sth_modes = $Connection->db->prepare($query_modes);
440 503
 			try {
441
-				if ($globalTransaction) $Connection->db->beginTransaction();
504
+				if ($globalTransaction) {
505
+					$Connection->db->beginTransaction();
506
+				}
442 507
 				$tmp = fgetcsv($fh,9999,',','"');
443 508
             			while (!feof($fh)) {
444 509
             				$line = fgetcsv($fh,9999,',','"');
@@ -448,16 +513,22 @@  discard block
 block discarded – undo
448 513
             				    $values['registration'] = $line[0];
449 514
             				    $values['base'] = $line[4];
450 515
             				    $values['owner'] = $line[5];
451
-            				    if ($line[6] == '') $values['date_first_reg'] = null;
452
-					    else $values['date_first_reg'] = date("Y-m-d",strtotime($line[6]));
516
+            				    if ($line[6] == '') {
517
+            				    	$values['date_first_reg'] = null;
518
+            				    } else {
519
+					    	$values['date_first_reg'] = date("Y-m-d",strtotime($line[6]));
520
+					    }
453 521
 					    $values['cancel'] = $line[7];
454 522
 					} elseif ($country == 'EI') {
455 523
 					    // TODO : add modeS & reg to aircraft_modes
456 524
             				    $values['registration'] = $line[0];
457 525
             				    $values['base'] = $line[3];
458 526
             				    $values['owner'] = $line[2];
459
-            				    if ($line[1] == '') $values['date_first_reg'] = null;
460
-					    else $values['date_first_reg'] = date("Y-m-d",strtotime($line[1]));
527
+            				    if ($line[1] == '') {
528
+            				    	$values['date_first_reg'] = null;
529
+            				    } else {
530
+					    	$values['date_first_reg'] = date("Y-m-d",strtotime($line[1]));
531
+					    }
461 532
 					    $values['cancel'] = '';
462 533
 					    $values['modes'] = $line[7];
463 534
 					    $values['icao'] = $line[8];
@@ -476,16 +547,22 @@  discard block
 block discarded – undo
476 547
             				    $values['registration'] = $line[3];
477 548
             				    $values['base'] = null;
478 549
             				    $values['owner'] = $line[5];
479
-            				    if ($line[18] == '') $values['date_first_reg'] = null;
480
-					    else $values['date_first_reg'] = date("Y-m-d",strtotime($line[18]));
550
+            				    if ($line[18] == '') {
551
+            				    	$values['date_first_reg'] = null;
552
+            				    } else {
553
+					    	$values['date_first_reg'] = date("Y-m-d",strtotime($line[18]));
554
+					    }
481 555
 					    $values['cancel'] = '';
482 556
 					} elseif ($country == 'VH') {
483 557
 					    // TODO : add modeS & reg to aircraft_modes
484 558
             				    $values['registration'] = $line[0];
485 559
             				    $values['base'] = null;
486 560
             				    $values['owner'] = $line[12];
487
-            				    if ($line[28] == '') $values['date_first_reg'] = null;
488
-					    else $values['date_first_reg'] = date("Y-m-d",strtotime($line[28]));
561
+            				    if ($line[28] == '') {
562
+            				    	$values['date_first_reg'] = null;
563
+            				    } else {
564
+					    	$values['date_first_reg'] = date("Y-m-d",strtotime($line[28]));
565
+					    }
489 566
 
490 567
 					    $values['cancel'] = $line[39];
491 568
 					} elseif ($country == 'OE' || $country == '9A' || $country == 'VP' || $country == 'LX' || $country == 'P2' || $country == 'HC') {
@@ -504,29 +581,41 @@  discard block
 block discarded – undo
504 581
             				    $values['registration'] = $line[0];
505 582
             				    $values['base'] = null;
506 583
             				    $values['owner'] = $line[8];
507
-            				    if ($line[7] == '') $values['date_first_reg'] = null;
508
-					    else $values['date_first_reg'] = date("Y-m-d",strtotime($line[7]));
584
+            				    if ($line[7] == '') {
585
+            				    	$values['date_first_reg'] = null;
586
+            				    } else {
587
+					    	$values['date_first_reg'] = date("Y-m-d",strtotime($line[7]));
588
+					    }
509 589
 					    $values['cancel'] = '';
510 590
 					} elseif ($country == 'PP') {
511 591
             				    $values['registration'] = $line[0];
512 592
             				    $values['base'] = null;
513 593
             				    $values['owner'] = $line[4];
514
-            				    if ($line[6] == '') $values['date_first_reg'] = null;
515
-					    else $values['date_first_reg'] = date("Y-m-d",strtotime($line[6]));
594
+            				    if ($line[6] == '') {
595
+            				    	$values['date_first_reg'] = null;
596
+            				    } else {
597
+					    	$values['date_first_reg'] = date("Y-m-d",strtotime($line[6]));
598
+					    }
516 599
 					    $values['cancel'] = $line[7];
517 600
 					} elseif ($country == 'E7') {
518 601
             				    $values['registration'] = $line[0];
519 602
             				    $values['base'] = null;
520 603
             				    $values['owner'] = $line[4];
521
-            				    if ($line[5] == '') $values['date_first_reg'] = null;
522
-					    else $values['date_first_reg'] = date("Y-m-d",strtotime($line[5]));
604
+            				    if ($line[5] == '') {
605
+            				    	$values['date_first_reg'] = null;
606
+            				    } else {
607
+					    	$values['date_first_reg'] = date("Y-m-d",strtotime($line[5]));
608
+					    }
523 609
 					    $values['cancel'] = '';
524 610
 					} elseif ($country == '8Q') {
525 611
             				    $values['registration'] = $line[0];
526 612
             				    $values['base'] = null;
527 613
             				    $values['owner'] = $line[3];
528
-            				    if ($line[7] == '') $values['date_first_reg'] = null;
529
-					    else $values['date_first_reg'] = date("Y-m-d",strtotime($line[7]));
614
+            				    if ($line[7] == '') {
615
+            				    	$values['date_first_reg'] = null;
616
+            				    } else {
617
+					    	$values['date_first_reg'] = date("Y-m-d",strtotime($line[7]));
618
+					    }
530 619
 					    $values['cancel'] = '';
531 620
 					} elseif ($country == 'ZK') {
532 621
             				    $values['registration'] = $line[0];
@@ -571,7 +660,9 @@  discard block
 block discarded – undo
571 660
 						$sth_modes->execute($query_modes_values);
572 661
 					}
573 662
 				}
574
-				if ($globalTransaction) $Connection->db->commit();
663
+				if ($globalTransaction) {
664
+					$Connection->db->commit();
665
+				}
575 666
 			} catch(PDOException $e) {
576 667
 				return "error : ".$e->getMessage();
577 668
 			}
@@ -707,25 +798,45 @@  discard block
 block discarded – undo
707 798
 		    VALUES (:name, :city, :country, :iata, :icao, :latitude, :longitude, :altitude, :type, :home_link, :wikipedia_link, :image_thumb, :image)";
708 799
 		$Connection = new Connection();
709 800
 		$sth_dest = $Connection->db->prepare($query_dest);
710
-		if ($globalTransaction) $Connection->db->beginTransaction();
801
+		if ($globalTransaction) {
802
+			$Connection->db->beginTransaction();
803
+		}
711 804
   
712 805
 		$i = 0;
713 806
 		while($row = sparql_fetch_array($result))
714 807
 		{
715 808
 			if ($i >= 1) {
716 809
 			//print_r($row);
717
-			if (!isset($row['iata'])) $row['iata'] = '';
718
-			if (!isset($row['icao'])) $row['icao'] = '';
719
-			if (!isset($row['type'])) $row['type'] = '';
720
-			if (!isset($row['altitude'])) $row['altitude'] = '';
810
+			if (!isset($row['iata'])) {
811
+				$row['iata'] = '';
812
+			}
813
+			if (!isset($row['icao'])) {
814
+				$row['icao'] = '';
815
+			}
816
+			if (!isset($row['type'])) {
817
+				$row['type'] = '';
818
+			}
819
+			if (!isset($row['altitude'])) {
820
+				$row['altitude'] = '';
821
+			}
721 822
 			if (isset($row['city_bis'])) {
722 823
 				$row['city'] = $row['city_bis'];
723 824
 			}
724
-			if (!isset($row['city'])) $row['city'] = '';
725
-			if (!isset($row['country'])) $row['country'] = '';
726
-			if (!isset($row['homepage'])) $row['homepage'] = '';
727
-			if (!isset($row['wikipedia_page'])) $row['wikipedia_page'] = '';
728
-			if (!isset($row['name'])) continue;
825
+			if (!isset($row['city'])) {
826
+				$row['city'] = '';
827
+			}
828
+			if (!isset($row['country'])) {
829
+				$row['country'] = '';
830
+			}
831
+			if (!isset($row['homepage'])) {
832
+				$row['homepage'] = '';
833
+			}
834
+			if (!isset($row['wikipedia_page'])) {
835
+				$row['wikipedia_page'] = '';
836
+			}
837
+			if (!isset($row['name'])) {
838
+				continue;
839
+			}
729 840
 			if (!isset($row['image'])) {
730 841
 				$row['image'] = '';
731 842
 				$row['image_thumb'] = '';
@@ -781,7 +892,9 @@  discard block
 block discarded – undo
781 892
 
782 893
 			$i++;
783 894
 		}
784
-		if ($globalTransaction) $Connection->db->commit();
895
+		if ($globalTransaction) {
896
+			$Connection->db->commit();
897
+		}
785 898
 		/*
786 899
 		echo "Delete duplicate rows...\n";
787 900
 		$query = 'ALTER IGNORE TABLE airport ADD UNIQUE INDEX icaoidx (icao)';
@@ -824,7 +937,9 @@  discard block
 block discarded – undo
824 937
 		$delimiter = ',';
825 938
 		$out_file = $tmp_dir.'airports.csv';
826 939
 		update_db::download('http://ourairports.com/data/airports.csv',$out_file);
827
-		if (!file_exists($out_file) || !is_readable($out_file)) return FALSE;
940
+		if (!file_exists($out_file) || !is_readable($out_file)) {
941
+			return FALSE;
942
+		}
828 943
 		echo "Add data from ourairports.com...\n";
829 944
 
830 945
 		$header = NULL;
@@ -834,8 +949,9 @@  discard block
 block discarded – undo
834 949
 			//$Connection->db->beginTransaction();
835 950
 			while (($row = fgetcsv($handle, 1000, $delimiter)) !== FALSE)
836 951
 			{
837
-				if(!$header) $header = $row;
838
-				else {
952
+				if(!$header) {
953
+					$header = $row;
954
+				} else {
839 955
 					$data = array();
840 956
 					$data = array_combine($header, $row);
841 957
 					try {
@@ -876,7 +992,9 @@  discard block
 block discarded – undo
876 992
 		echo "Download data from another free database...\n";
877 993
 		$out_file = $tmp_dir.'GlobalAirportDatabase.zip';
878 994
 		update_db::download('http://www.partow.net/downloads/GlobalAirportDatabase.zip',$out_file);
879
-		if (!file_exists($out_file) || !is_readable($out_file)) return FALSE;
995
+		if (!file_exists($out_file) || !is_readable($out_file)) {
996
+			return FALSE;
997
+		}
880 998
 		update_db::unzip($out_file);
881 999
 		$header = NULL;
882 1000
 		echo "Add data from another free database...\n";
@@ -887,8 +1005,9 @@  discard block
 block discarded – undo
887 1005
 			//$Connection->db->beginTransaction();
888 1006
 			while (($row = fgetcsv($handle, 1000, $delimiter)) !== FALSE)
889 1007
 			{
890
-				if(!$header) $header = $row;
891
-				else {
1008
+				if(!$header) {
1009
+					$header = $row;
1010
+				} else {
892 1011
 					$data = $row;
893 1012
 
894 1013
 					$query = 'UPDATE airport SET city = :city, country = :country WHERE icao = :icao';
@@ -1082,7 +1201,9 @@  discard block
 block discarded – undo
1082 1201
 		if (($handle = fopen($tmp_dir.'MASTER.txt', 'r')) !== FALSE)
1083 1202
 		{
1084 1203
 			$i = 0;
1085
-			if ($globalTransaction) $Connection->db->beginTransaction();
1204
+			if ($globalTransaction) {
1205
+				$Connection->db->beginTransaction();
1206
+			}
1086 1207
 			while (($data = fgetcsv($handle, 1000, $delimiter)) !== FALSE)
1087 1208
 			{
1088 1209
 				if ($i > 0) {
@@ -1095,7 +1216,9 @@  discard block
 block discarded – undo
1095 1216
 					}
1096 1217
 					$result_search = $sths->fetchAll(PDO::FETCH_ASSOC);
1097 1218
 					if (!empty($result_search)) {
1098
-						if ($globalDebug) echo '.';
1219
+						if ($globalDebug) {
1220
+							echo '.';
1221
+						}
1099 1222
 							//if ($globalDBdriver == 'mysql') {
1100 1223
 							//	$queryi = 'INSERT INTO faamfr (mfr,icao) VALUES (:mfr,:icao) ON DUPLICATE KEY UPDATE icao = :icao';
1101 1224
 							//} else {
@@ -1117,8 +1240,12 @@  discard block
 block discarded – undo
1117 1240
 						}
1118 1241
 						$result_search_mfr = $sthsm->fetchAll(PDO::FETCH_ASSOC);
1119 1242
 						if (!empty($result_search_mfr)) {
1120
-							if (trim($data[16]) == '' && trim($data[23]) != '') $data[16] = $data[23];
1121
-							if (trim($data[16]) == '' && trim($data[15]) != '') $data[16] = $data[15];
1243
+							if (trim($data[16]) == '' && trim($data[23]) != '') {
1244
+								$data[16] = $data[23];
1245
+							}
1246
+							if (trim($data[16]) == '' && trim($data[15]) != '') {
1247
+								$data[16] = $data[15];
1248
+							}
1122 1249
 							$queryf = 'INSERT INTO aircraft_modes (FirstCreated,LastModified,ModeS,ModeSCountry,Registration,ICAOTypeCode,Source) VALUES (:FirstCreated,:LastModified,:ModeS,:ModeSCountry,:Registration,:ICAOTypeCode,:source)';
1123 1250
 							try {
1124 1251
 								$sthf = $Connection->db->prepare($queryf);
@@ -1129,7 +1256,9 @@  discard block
 block discarded – undo
1129 1256
 						}
1130 1257
 					}
1131 1258
 					if (strtotime($data[29]) > time()) {
1132
-						if ($globalDebug) echo 'i';
1259
+						if ($globalDebug) {
1260
+							echo 'i';
1261
+						}
1133 1262
 						$query = 'INSERT INTO aircraft_owner (registration,base,owner,date_first_reg,Source) VALUES (:registration,:base,:owner,:date_first_reg,:source)';
1134 1263
 						try {
1135 1264
 							$sth = $Connection->db->prepare($query);
@@ -1140,13 +1269,19 @@  discard block
 block discarded – undo
1140 1269
 					}
1141 1270
 				}
1142 1271
 				if ($i % 90 == 0) {
1143
-					if ($globalTransaction) $Connection->db->commit();
1144
-					if ($globalTransaction) $Connection->db->beginTransaction();
1272
+					if ($globalTransaction) {
1273
+						$Connection->db->commit();
1274
+					}
1275
+					if ($globalTransaction) {
1276
+						$Connection->db->beginTransaction();
1277
+					}
1145 1278
 				}
1146 1279
 				$i++;
1147 1280
 			}
1148 1281
 			fclose($handle);
1149
-			if ($globalTransaction) $Connection->db->commit();
1282
+			if ($globalTransaction) {
1283
+				$Connection->db->commit();
1284
+			}
1150 1285
 		}
1151 1286
 		return '';
1152 1287
 	}
@@ -1166,11 +1301,15 @@  discard block
 block discarded – undo
1166 1301
 		if (($handle = fopen($tmp_dir.'modes.tsv', 'r')) !== FALSE)
1167 1302
 		{
1168 1303
 			$i = 0;
1169
-			if ($globalTransaction) $Connection->db->beginTransaction();
1304
+			if ($globalTransaction) {
1305
+				$Connection->db->beginTransaction();
1306
+			}
1170 1307
 			while (($data = fgetcsv($handle, 1000, $delimiter)) !== FALSE)
1171 1308
 			{
1172 1309
 				if ($i > 0) {
1173
-					if ($data[1] == 'NULL') $data[1] = $data[0];
1310
+					if ($data[1] == 'NULL') {
1311
+						$data[1] = $data[0];
1312
+					}
1174 1313
 					$query = 'INSERT INTO aircraft_modes (FirstCreated,LastModified,ModeS,ModeSCountry,Registration,ICAOTypeCode,type_flight,Source) VALUES (:FirstCreated,:LastModified,:ModeS,:ModeSCountry,:Registration,:ICAOTypeCode,:type_flight,:source)';
1175 1314
 					try {
1176 1315
 						$sth = $Connection->db->prepare($query);
@@ -1182,7 +1321,9 @@  discard block
 block discarded – undo
1182 1321
 				$i++;
1183 1322
 			}
1184 1323
 			fclose($handle);
1185
-			if ($globalTransaction) $Connection->db->commit();
1324
+			if ($globalTransaction) {
1325
+				$Connection->db->commit();
1326
+			}
1186 1327
 		}
1187 1328
 		return '';
1188 1329
 	}
@@ -1214,11 +1355,15 @@  discard block
 block discarded – undo
1214 1355
 		if (($handle = fopen($tmp_dir.'airlines.tsv', 'r')) !== FALSE)
1215 1356
 		{
1216 1357
 			$i = 0;
1217
-			if ($globalTransaction) $Connection->db->beginTransaction();
1358
+			if ($globalTransaction) {
1359
+				$Connection->db->beginTransaction();
1360
+			}
1218 1361
 			while (($data = fgetcsv($handle, 1000, $delimiter)) !== FALSE)
1219 1362
 			{
1220 1363
 				if ($i > 0) {
1221
-					if ($data[1] == 'NULL') $data[1] = $data[0];
1364
+					if ($data[1] == 'NULL') {
1365
+						$data[1] = $data[0];
1366
+					}
1222 1367
 					$query = 'INSERT INTO airlines (airline_id,name,alias,iata,icao,callsign,country,active,type,home_link,wikipedia_link,alliance,ban_eu) VALUES (0,:name,:alias,:iata,:icao,:callsign,:country,:active,:type,:home,:wikipedia_link,:alliance,:ban_eu)';
1223 1368
 					try {
1224 1369
 						$sth = $Connection->db->prepare($query);
@@ -1230,7 +1375,9 @@  discard block
 block discarded – undo
1230 1375
 				$i++;
1231 1376
 			}
1232 1377
 			fclose($handle);
1233
-			if ($globalTransaction) $Connection->db->commit();
1378
+			if ($globalTransaction) {
1379
+				$Connection->db->commit();
1380
+			}
1234 1381
 		}
1235 1382
 		/*
1236 1383
 		$query = "UNLOCK TABLES";
@@ -1260,7 +1407,9 @@  discard block
 block discarded – undo
1260 1407
 		if (($handle = fopen($tmp_dir.'owners.tsv', 'r')) !== FALSE)
1261 1408
 		{
1262 1409
 			$i = 0;
1263
-			if ($globalTransaction) $Connection->db->beginTransaction();
1410
+			if ($globalTransaction) {
1411
+				$Connection->db->beginTransaction();
1412
+			}
1264 1413
 			while (($data = fgetcsv($handle, 1000, $delimiter)) !== FALSE)
1265 1414
 			{
1266 1415
 				if ($i > 0) {
@@ -1276,7 +1425,9 @@  discard block
 block discarded – undo
1276 1425
 				$i++;
1277 1426
 			}
1278 1427
 			fclose($handle);
1279
-			if ($globalTransaction) $Connection->db->commit();
1428
+			if ($globalTransaction) {
1429
+				$Connection->db->commit();
1430
+			}
1280 1431
 		}
1281 1432
 		return '';
1282 1433
         }
@@ -1296,7 +1447,9 @@  discard block
 block discarded – undo
1296 1447
 		if (($handle = fopen($tmp_dir.'routes.tsv', 'r')) !== FALSE)
1297 1448
 		{
1298 1449
 			$i = 0;
1299
-			if ($globalTransaction) $Connection->db->beginTransaction();
1450
+			if ($globalTransaction) {
1451
+				$Connection->db->beginTransaction();
1452
+			}
1300 1453
 			while (($data = fgetcsv($handle, 1000, $delimiter)) !== FALSE)
1301 1454
 			{
1302 1455
 				if ($i > 0) {
@@ -1306,19 +1459,25 @@  discard block
 block discarded – undo
1306 1459
 						$sth = $Connection->db->prepare($query);
1307 1460
 						$sth->execute(array(':CallSign' => $data[0],':Operator_ICAO' => $data[1],':FromAirport_ICAO' => $data[2],':FromAirport_Time' => $data[3], ':ToAirport_ICAO' => $data[4],':ToAirport_Time' => $data[5],':RouteStop' => $data[6],':source' => 'website_fam'));
1308 1461
 					} catch(PDOException $e) {
1309
-						if ($globalDebug) echo "error: ".$e->getMessage()." - data: ".implode(',',$data);
1462
+						if ($globalDebug) {
1463
+							echo "error: ".$e->getMessage()." - data: ".implode(',',$data);
1464
+						}
1310 1465
 						die();
1311 1466
 					}
1312 1467
 				}
1313 1468
 				if ($globalTransaction && $i % 2000 == 0) {
1314 1469
 					$Connection->db->commit();
1315
-					if ($globalDebug) echo '.';
1470
+					if ($globalDebug) {
1471
+						echo '.';
1472
+					}
1316 1473
 					$Connection->db->beginTransaction();
1317 1474
 				}
1318 1475
 				$i++;
1319 1476
 			}
1320 1477
 			fclose($handle);
1321
-			if ($globalTransaction) $Connection->db->commit();
1478
+			if ($globalTransaction) {
1479
+				$Connection->db->commit();
1480
+			}
1322 1481
 		}
1323 1482
 		return '';
1324 1483
 	}
@@ -1337,7 +1496,9 @@  discard block
 block discarded – undo
1337 1496
 		if (($handle = fopen($tmp_dir.'block.tsv', 'r')) !== FALSE)
1338 1497
 		{
1339 1498
 			$i = 0;
1340
-			if ($globalTransaction) $Connection->db->beginTransaction();
1499
+			if ($globalTransaction) {
1500
+				$Connection->db->beginTransaction();
1501
+			}
1341 1502
 			while (($data = fgets($handle, 1000)) !== FALSE)
1342 1503
 			{
1343 1504
 				$query = 'INSERT INTO aircraft_block (callSign,Source) VALUES (:callSign,:source)';
@@ -1345,18 +1506,24 @@  discard block
 block discarded – undo
1345 1506
 					$sth = $Connection->db->prepare($query);
1346 1507
 					$sth->execute(array(':callSign' => trim($data),':source' => 'website_fam'));
1347 1508
 				} catch(PDOException $e) {
1348
-					if ($globalDebug) echo "error: ".$e->getMessage()." - data: ".$data;
1509
+					if ($globalDebug) {
1510
+						echo "error: ".$e->getMessage()." - data: ".$data;
1511
+					}
1349 1512
 					die();
1350 1513
 				}
1351 1514
 				if ($globalTransaction && $i % 2000 == 0) {
1352 1515
 					$Connection->db->commit();
1353
-					if ($globalDebug) echo '.';
1516
+					if ($globalDebug) {
1517
+						echo '.';
1518
+					}
1354 1519
 					$Connection->db->beginTransaction();
1355 1520
 				}
1356 1521
 				$i++;
1357 1522
 			}
1358 1523
 			fclose($handle);
1359
-			if ($globalTransaction) $Connection->db->commit();
1524
+			if ($globalTransaction) {
1525
+				$Connection->db->commit();
1526
+			}
1360 1527
 		}
1361 1528
 		return '';
1362 1529
         }
@@ -1381,7 +1548,9 @@  discard block
 block discarded – undo
1381 1548
 			$i = 0;
1382 1549
 			//$Connection->db->setAttribute(PDO::ATTR_AUTOCOMMIT, FALSE);
1383 1550
 			//$Connection->db->beginTransaction();
1384
-			if ($globalTransaction) $Connection->db->beginTransaction();
1551
+			if ($globalTransaction) {
1552
+				$Connection->db->beginTransaction();
1553
+			}
1385 1554
 			while (($data = fgetcsv($handle, 1000, $delimiter)) !== FALSE)
1386 1555
 			{
1387 1556
 				if ($i > 0) {
@@ -1397,7 +1566,9 @@  discard block
 block discarded – undo
1397 1566
 				$i++;
1398 1567
 			}
1399 1568
 			fclose($handle);
1400
-			if ($globalTransaction) $Connection->db->commit();
1569
+			if ($globalTransaction) {
1570
+				$Connection->db->commit();
1571
+			}
1401 1572
 		}
1402 1573
 		return '';
1403 1574
         }
@@ -1417,7 +1588,9 @@  discard block
 block discarded – undo
1417 1588
 		if (($handle = fopen($tmp_dir.'satellite.tsv', 'r')) !== FALSE)
1418 1589
 		{
1419 1590
 			$i = 0;
1420
-			if ($globalTransaction) $Connection->db->beginTransaction();
1591
+			if ($globalTransaction) {
1592
+				$Connection->db->beginTransaction();
1593
+			}
1421 1594
 			while (($data = fgetcsv($handle, 1000, $delimiter)) !== FALSE)
1422 1595
 			{
1423 1596
 				if ($i > 0) {
@@ -1434,7 +1607,9 @@  discard block
 block discarded – undo
1434 1607
 				$i++;
1435 1608
 			}
1436 1609
 			fclose($handle);
1437
-			if ($globalTransaction) $Connection->db->commit();
1610
+			if ($globalTransaction) {
1611
+				$Connection->db->commit();
1612
+			}
1438 1613
 		}
1439 1614
 		return '';
1440 1615
 	}
@@ -1453,7 +1628,9 @@  discard block
 block discarded – undo
1453 1628
 		$Connection = new Connection();
1454 1629
 		if (($handle = fopen($tmp_dir.'ban_eu.csv', 'r')) !== FALSE)
1455 1630
 		{
1456
-			if ($globalTransaction) $Connection->db->beginTransaction();
1631
+			if ($globalTransaction) {
1632
+				$Connection->db->beginTransaction();
1633
+			}
1457 1634
 			while (($data = fgetcsv($handle, 1000)) !== FALSE)
1458 1635
 			{
1459 1636
 				$query = 'UPDATE airlines SET ban_eu = 1 WHERE icao = :icao AND forsource IS NULL';
@@ -1468,7 +1645,9 @@  discard block
 block discarded – undo
1468 1645
 				}
1469 1646
 			}
1470 1647
 			fclose($handle);
1471
-			if ($globalTransaction) $Connection->db->commit();
1648
+			if ($globalTransaction) {
1649
+				$Connection->db->commit();
1650
+			}
1472 1651
 		}
1473 1652
 		return '';
1474 1653
         }
@@ -1546,9 +1725,14 @@  discard block
 block discarded – undo
1546 1725
 				if ($i > 0 && $data[0] != '') {
1547 1726
 					$sources = trim($data[28].' '.$data[29].' '.$data[30].' '.$data[31].' '.$data[32].' '.$data[33]);
1548 1727
 					$period = str_replace(',','',$data[14]);
1549
-					if (!empty($period) && strpos($period,'days')) $period = str_replace(' days','',$period)*24*60;
1550
-					if ($data[18] != '') $launch_date = date('Y-m-d',strtotime($data[18]));
1551
-					else $launch_date = NULL;
1728
+					if (!empty($period) && strpos($period,'days')) {
1729
+						$period = str_replace(' days','',$period)*24*60;
1730
+					}
1731
+					if ($data[18] != '') {
1732
+						$launch_date = date('Y-m-d',strtotime($data[18]));
1733
+					} else {
1734
+						$launch_date = NULL;
1735
+					}
1552 1736
 					$data = array_map(function($value) {
1553 1737
 						return trim($value) === '' ? null : $value;
1554 1738
 					}, $data);
@@ -1740,10 +1924,14 @@  discard block
 block discarded – undo
1740 1924
 				$owner_code = trim(substr($data,49,5));
1741 1925
 				
1742 1926
 				if (!isset($satcat_sources[$owner_code]) && $owner_code != 'TBD') {
1743
-					if ($globalDebug) echo $data.'owner_code: '.$owner_code."\n";
1927
+					if ($globalDebug) {
1928
+						echo $data.'owner_code: '.$owner_code."\n";
1929
+					}
1744 1930
 				}
1745 1931
 				if (!isset($satcat_launch_site[trim(substr($data,68,5))])) {
1746
-					if ($globalDebug) echo 'launch_site_code: '.trim(substr($data,68,5))."\n";
1932
+					if ($globalDebug) {
1933
+						echo 'launch_site_code: '.trim(substr($data,68,5))."\n";
1934
+					}
1747 1935
 				}
1748 1936
 				
1749 1937
 				if ($owner_code != 'TBD' && isset($satcat_sources[$owner_code]) && isset($satcat_launch_site[trim(substr($data,68,5))])) {
@@ -1910,7 +2098,9 @@  discard block
 block discarded – undo
1910 2098
 		if (($handle = fopen($filename, 'r')) !== FALSE)
1911 2099
 		{
1912 2100
 			$i = 0;
1913
-			if ($globalTransaction) $Connection->db->beginTransaction();
2101
+			if ($globalTransaction) {
2102
+				$Connection->db->beginTransaction();
2103
+			}
1914 2104
 			while (($row = fgetcsv($handle, 1000, $delimiter)) !== FALSE)
1915 2105
 			{
1916 2106
 				$i++;
@@ -1938,7 +2128,9 @@  discard block
 block discarded – undo
1938 2128
 				}
1939 2129
 			}
1940 2130
 			fclose($handle);
1941
-			if ($globalTransaction) $Connection->db->commit();
2131
+			if ($globalTransaction) {
2132
+				$Connection->db->commit();
2133
+			}
1942 2134
 		}
1943 2135
 		return '';
1944 2136
 	}
@@ -1954,7 +2146,9 @@  discard block
 block discarded – undo
1954 2146
 		$Source->deleteLocationByType('fires');
1955 2147
 		$i = 0;
1956 2148
 		if (($handle = fopen($tmp_dir.'fires.csv','r')) !== false) {
1957
-			if ($globalTransaction) $Connection->db->beginTransaction();
2149
+			if ($globalTransaction) {
2150
+				$Connection->db->beginTransaction();
2151
+			}
1958 2152
 			while (($row = fgetcsv($handle,1000)) !== false) {
1959 2153
 				if ($i > 0 && $row[0] != '' && $row[8] != 'low') {
1960 2154
 					$description = array('bright_t14' => $row[2],'scan' => $row[3],'track' => $row[4],'sat' => $row[7],'confidence' => $row[8],'version' => $row[9],'bright_t15' => $row[10],'frp' => $row[11],'daynight' => $row[12]);
@@ -1969,7 +2163,9 @@  discard block
 block discarded – undo
1969 2163
 				}
1970 2164
 				$i++;
1971 2165
 			}
1972
-			if ($globalTransaction) $Connection->db->commit();
2166
+			if ($globalTransaction) {
2167
+				$Connection->db->commit();
2168
+			}
1973 2169
 		}
1974 2170
 	}
1975 2171
 
@@ -1990,7 +2186,9 @@  discard block
 block discarded – undo
1990 2186
 		$Connection = new Connection();
1991 2187
 		if (($handle = fopen($filename, 'r')) !== FALSE)
1992 2188
 		{
1993
-			if ($globalTransaction) $Connection->db->beginTransaction();
2189
+			if ($globalTransaction) {
2190
+				$Connection->db->beginTransaction();
2191
+			}
1994 2192
 			while (($row = fgetcsv($handle, 1000, $delimiter)) !== FALSE)
1995 2193
 			{
1996 2194
 				if(count($row) > 1) {
@@ -2004,7 +2202,9 @@  discard block
 block discarded – undo
2004 2202
 				}
2005 2203
 			}
2006 2204
 			fclose($handle);
2007
-			if ($globalTransaction) $Connection->db->commit();
2205
+			if ($globalTransaction) {
2206
+				$Connection->db->commit();
2207
+			}
2008 2208
 		}
2009 2209
 		return '';
2010 2210
         }
@@ -2024,8 +2224,9 @@  discard block
 block discarded – undo
2024 2224
 	        }
2025 2225
 
2026 2226
 
2027
-		if ($globalDBdriver == 'mysql') update_db::gunzip('../db/airspace.sql.gz',$tmp_dir.'airspace.sql');
2028
-		else {
2227
+		if ($globalDBdriver == 'mysql') {
2228
+			update_db::gunzip('../db/airspace.sql.gz',$tmp_dir.'airspace.sql');
2229
+		} else {
2029 2230
 			update_db::gunzip('../db/pgsql/airspace.sql.gz',$tmp_dir.'airspace.sql');
2030 2231
 			$query = "CREATE EXTENSION postgis";
2031 2232
 			$Connection = new Connection(null,null,$_SESSION['database_root'],$_SESSION['database_rootpass']);
@@ -2044,7 +2245,9 @@  discard block
 block discarded – undo
2044 2245
 		global $tmp_dir, $globalDebug;
2045 2246
 		include_once('class.create_db.php');
2046 2247
 		require_once(dirname(__FILE__).'/../require/class.NOTAM.php');
2047
-		if ($globalDebug) echo "NOTAM from FlightAirMap website : Download...";
2248
+		if ($globalDebug) {
2249
+			echo "NOTAM from FlightAirMap website : Download...";
2250
+		}
2048 2251
 		update_db::download('http://data.flightairmap.com/data/notam.txt.gz.md5',$tmp_dir.'notam.txt.gz.md5');
2049 2252
 		$error = '';
2050 2253
 		if (file_exists($tmp_dir.'notam.txt.gz.md5')) {
@@ -2054,20 +2257,34 @@  discard block
 block discarded – undo
2054 2257
 				update_db::download('http://data.flightairmap.com/data/notam.txt.gz',$tmp_dir.'notam.txt.gz');
2055 2258
 				if (file_exists($tmp_dir.'notam.txt.gz')) {
2056 2259
 					if (md5_file($tmp_dir.'notam.txt.gz') == $notam_md5) {
2057
-						if ($globalDebug) echo "Gunzip...";
2260
+						if ($globalDebug) {
2261
+							echo "Gunzip...";
2262
+						}
2058 2263
 						update_db::gunzip($tmp_dir.'notam.txt.gz');
2059
-						if ($globalDebug) echo "Add to DB...";
2264
+						if ($globalDebug) {
2265
+							echo "Add to DB...";
2266
+						}
2060 2267
 						//$error = create_db::import_file($tmp_dir.'notam.sql');
2061 2268
 						$NOTAM = new NOTAM();
2062 2269
 						$NOTAM->updateNOTAMfromTextFile($tmp_dir.'notam.txt');
2063 2270
 						update_db::insert_notam_version($notam_md5);
2064
-					} else $error = "File ".$tmp_dir.'notam.txt.gz'." md5 failed. Download failed.";
2065
-				} else $error = "File ".$tmp_dir.'notam.txt.gz'." doesn't exist. Download failed.";
2066
-			} elseif ($globalDebug) echo "No new version.";
2067
-		} else $error = "File ".$tmp_dir.'notam.txt.gz.md5'." doesn't exist. Download failed.";
2271
+					} else {
2272
+						$error = "File ".$tmp_dir.'notam.txt.gz'." md5 failed. Download failed.";
2273
+					}
2274
+				} else {
2275
+					$error = "File ".$tmp_dir.'notam.txt.gz'." doesn't exist. Download failed.";
2276
+				}
2277
+			} elseif ($globalDebug) {
2278
+				echo "No new version.";
2279
+			}
2280
+		} else {
2281
+			$error = "File ".$tmp_dir.'notam.txt.gz.md5'." doesn't exist. Download failed.";
2282
+		}
2068 2283
 		if ($error != '') {
2069 2284
 			return $error;
2070
-		} elseif ($globalDebug) echo "Done\n";
2285
+		} elseif ($globalDebug) {
2286
+			echo "Done\n";
2287
+		}
2071 2288
 		return '';
2072 2289
 	}
2073 2290
 
@@ -2122,68 +2339,114 @@  discard block
 block discarded – undo
2122 2339
 		//update_db::download('http://fr.mirror.ivao.aero/software/ivae_feb2013.zip',$tmp_dir.'ivae_feb2013.zip');
2123 2340
 		if (extension_loaded('zip')) {
2124 2341
 			if (file_exists($tmp_dir.'ivae_feb2013.zip')) {
2125
-				if ($globalDebug) echo "Unzip...";
2342
+				if ($globalDebug) {
2343
+					echo "Unzip...";
2344
+				}
2126 2345
 				update_db::unzip($tmp_dir.'ivae_feb2013.zip');
2127
-				if ($globalDebug) echo "Add to DB...";
2346
+				if ($globalDebug) {
2347
+					echo "Add to DB...";
2348
+				}
2128 2349
 				update_db::ivao_airlines($tmp_dir.'data/airlines.dat');
2129
-				if ($globalDebug) echo "Copy airlines logos to airlines images directory...";
2350
+				if ($globalDebug) {
2351
+					echo "Copy airlines logos to airlines images directory...";
2352
+				}
2130 2353
 				if (is_writable(dirname(__FILE__).'/../images/airlines')) {
2131
-					if (!$Common->xcopy($tmp_dir.'logos/',dirname(__FILE__).'/../images/airlines/')) $error = "Failed to copy airlines logo.";
2132
-				} else $error = "The directory ".dirname(__FILE__).'/../images/airlines'." must be writable";
2133
-			} else $error = "File ".$tmp_dir.'ivao.zip'." doesn't exist. Download failed.";
2134
-		} else $error = "ZIP module not loaded but required for IVAO.";
2354
+					if (!$Common->xcopy($tmp_dir.'logos/',dirname(__FILE__).'/../images/airlines/')) {
2355
+						$error = "Failed to copy airlines logo.";
2356
+					}
2357
+				} else {
2358
+					$error = "The directory ".dirname(__FILE__).'/../images/airlines'." must be writable";
2359
+				}
2360
+			} else {
2361
+				$error = "File ".$tmp_dir.'ivao.zip'." doesn't exist. Download failed.";
2362
+			}
2363
+		} else {
2364
+			$error = "ZIP module not loaded but required for IVAO.";
2365
+		}
2135 2366
 		if ($error != '') {
2136 2367
 			return $error;
2137
-		} elseif ($globalDebug) echo "Done\n";
2368
+		} elseif ($globalDebug) {
2369
+			echo "Done\n";
2370
+		}
2138 2371
 		return '';
2139 2372
 	}
2140 2373
 
2141 2374
 	public static function update_routes() {
2142 2375
 		global $tmp_dir, $globalDebug;
2143 2376
 		$error = '';
2144
-		if ($globalDebug) echo "Routes : Download...";
2377
+		if ($globalDebug) {
2378
+			echo "Routes : Download...";
2379
+		}
2145 2380
 		update_db::download('http://www.virtualradarserver.co.uk/Files/StandingData.sqb.gz',$tmp_dir.'StandingData.sqb.gz');
2146 2381
 		if (file_exists($tmp_dir.'StandingData.sqb.gz')) {
2147
-			if ($globalDebug) echo "Gunzip...";
2382
+			if ($globalDebug) {
2383
+				echo "Gunzip...";
2384
+			}
2148 2385
 			update_db::gunzip($tmp_dir.'StandingData.sqb.gz');
2149
-			if ($globalDebug) echo "Add to DB...";
2386
+			if ($globalDebug) {
2387
+				echo "Add to DB...";
2388
+			}
2150 2389
 			$error = update_db::retrieve_route_sqlite_to_dest($tmp_dir.'StandingData.sqb');
2151
-		} else $error = "File ".$tmp_dir.'StandingData.sqb.gz'." doesn't exist. Download failed.";
2390
+		} else {
2391
+			$error = "File ".$tmp_dir.'StandingData.sqb.gz'." doesn't exist. Download failed.";
2392
+		}
2152 2393
 		if ($error != '') {
2153 2394
 			return $error;
2154
-		} elseif ($globalDebug) echo "Done\n";
2395
+		} elseif ($globalDebug) {
2396
+			echo "Done\n";
2397
+		}
2155 2398
 		return '';
2156 2399
 	}
2157 2400
 	public static function update_oneworld() {
2158 2401
 		global $tmp_dir, $globalDebug;
2159 2402
 		$error = '';
2160
-		if ($globalDebug) echo "Schedules Oneworld : Download...";
2403
+		if ($globalDebug) {
2404
+			echo "Schedules Oneworld : Download...";
2405
+		}
2161 2406
 		update_db::download('http://data.flightairmap.com/data/schedules/oneworld.csv.gz',$tmp_dir.'oneworld.csv.gz');
2162 2407
 		if (file_exists($tmp_dir.'oneworld.csv.gz')) {
2163
-			if ($globalDebug) echo "Gunzip...";
2408
+			if ($globalDebug) {
2409
+				echo "Gunzip...";
2410
+			}
2164 2411
 			update_db::gunzip($tmp_dir.'oneworld.csv.gz');
2165
-			if ($globalDebug) echo "Add to DB...";
2412
+			if ($globalDebug) {
2413
+				echo "Add to DB...";
2414
+			}
2166 2415
 			$error = update_db::retrieve_route_oneworld($tmp_dir.'oneworld.csv');
2167
-		} else $error = "File ".$tmp_dir.'oneworld.csv.gz'." doesn't exist. Download failed.";
2416
+		} else {
2417
+			$error = "File ".$tmp_dir.'oneworld.csv.gz'." doesn't exist. Download failed.";
2418
+		}
2168 2419
 		if ($error != '') {
2169 2420
 			return $error;
2170
-		} elseif ($globalDebug) echo "Done\n";
2421
+		} elseif ($globalDebug) {
2422
+			echo "Done\n";
2423
+		}
2171 2424
 		return '';
2172 2425
 	}
2173 2426
 	public static function update_skyteam() {
2174 2427
 		global $tmp_dir, $globalDebug;
2175 2428
 		$error = '';
2176
-		if ($globalDebug) echo "Schedules Skyteam : Download...";
2429
+		if ($globalDebug) {
2430
+			echo "Schedules Skyteam : Download...";
2431
+		}
2177 2432
 		update_db::download('http://data.flightairmap.com/data/schedules/skyteam.csv.gz',$tmp_dir.'skyteam.csv.gz');
2178 2433
 		if (file_exists($tmp_dir.'skyteam.csv.gz')) {
2179
-			if ($globalDebug) echo "Gunzip...";
2434
+			if ($globalDebug) {
2435
+				echo "Gunzip...";
2436
+			}
2180 2437
 			update_db::gunzip($tmp_dir.'skyteam.csv.gz');
2181
-			if ($globalDebug) echo "Add to DB...";
2438
+			if ($globalDebug) {
2439
+				echo "Add to DB...";
2440
+			}
2182 2441
 			$error = update_db::retrieve_route_skyteam($tmp_dir.'skyteam.csv');
2183
-		} else $error = "File ".$tmp_dir.'skyteam.csv.gz'." doesn't exist. Download failed.";
2442
+		} else {
2443
+			$error = "File ".$tmp_dir.'skyteam.csv.gz'." doesn't exist. Download failed.";
2444
+		}
2184 2445
 		if ($error != '') {
2185 2446
 			return $error;
2186
-		} elseif ($globalDebug) echo "Done\n";
2447
+		} elseif ($globalDebug) {
2448
+			echo "Done\n";
2449
+		}
2187 2450
 		return '';
2188 2451
 	}
2189 2452
 	public static function update_ModeS() {
@@ -2200,340 +2463,590 @@  discard block
 block discarded – undo
2200 2463
 			exit;
2201 2464
 		} elseif ($globalDebug) echo "Done\n";
2202 2465
 */
2203
-		if ($globalDebug) echo "Modes : Download...";
2204
-//		update_db::download('http://planebase.biz/sqb.php?f=basestationall.zip',$tmp_dir.'basestation_latest.zip','http://planebase.biz/bstnsqb');
2466
+		if ($globalDebug) {
2467
+			echo "Modes : Download...";
2468
+		}
2469
+		//		update_db::download('http://planebase.biz/sqb.php?f=basestationall.zip',$tmp_dir.'basestation_latest.zip','http://planebase.biz/bstnsqb');
2205 2470
 		update_db::download('http://data.flightairmap.com/data/BaseStation.sqb.gz',$tmp_dir.'BaseStation.sqb.gz');
2206 2471
 
2207 2472
 //		if (file_exists($tmp_dir.'basestation_latest.zip')) {
2208 2473
 		if (file_exists($tmp_dir.'BaseStation.sqb.gz')) {
2209
-			if ($globalDebug) echo "Unzip...";
2210
-//			update_db::unzip($tmp_dir.'basestation_latest.zip');
2474
+			if ($globalDebug) {
2475
+				echo "Unzip...";
2476
+			}
2477
+			//			update_db::unzip($tmp_dir.'basestation_latest.zip');
2211 2478
 			update_db::gunzip($tmp_dir.'BaseStation.sqb.gz');
2212
-			if ($globalDebug) echo "Add to DB...";
2479
+			if ($globalDebug) {
2480
+				echo "Add to DB...";
2481
+			}
2213 2482
 			$error = update_db::retrieve_modes_sqlite_to_dest($tmp_dir.'BaseStation.sqb');
2214 2483
 //			$error = update_db::retrieve_modes_sqlite_to_dest($tmp_dir.'basestation.sqb');
2215
-		} else $error = "File ".$tmp_dir.'basestation_latest.zip'." doesn't exist. Download failed.";
2484
+		} else {
2485
+			$error = "File ".$tmp_dir.'basestation_latest.zip'." doesn't exist. Download failed.";
2486
+		}
2216 2487
 		if ($error != '') {
2217 2488
 			return $error;
2218
-		} elseif ($globalDebug) echo "Done\n";
2489
+		} elseif ($globalDebug) {
2490
+			echo "Done\n";
2491
+		}
2219 2492
 		return '';
2220 2493
 	}
2221 2494
 
2222 2495
 	public static function update_ModeS_faa() {
2223 2496
 		global $tmp_dir, $globalDebug;
2224
-		if ($globalDebug) echo "Modes FAA: Download...";
2497
+		if ($globalDebug) {
2498
+			echo "Modes FAA: Download...";
2499
+		}
2225 2500
 		update_db::download('http://registry.faa.gov/database/ReleasableAircraft.zip',$tmp_dir.'ReleasableAircraft.zip');
2226 2501
 		if (file_exists($tmp_dir.'ReleasableAircraft.zip')) {
2227
-			if ($globalDebug) echo "Unzip...";
2502
+			if ($globalDebug) {
2503
+				echo "Unzip...";
2504
+			}
2228 2505
 			update_db::unzip($tmp_dir.'ReleasableAircraft.zip');
2229
-			if ($globalDebug) echo "Add to DB...";
2506
+			if ($globalDebug) {
2507
+				echo "Add to DB...";
2508
+			}
2230 2509
 			$error = update_db::modes_faa();
2231
-		} else $error = "File ".$tmp_dir.'ReleasableAircraft.zip'." doesn't exist. Download failed.";
2510
+		} else {
2511
+			$error = "File ".$tmp_dir.'ReleasableAircraft.zip'." doesn't exist. Download failed.";
2512
+		}
2232 2513
 		if ($error != '') {
2233 2514
 			return $error;
2234
-		} elseif ($globalDebug) echo "Done\n";
2515
+		} elseif ($globalDebug) {
2516
+			echo "Done\n";
2517
+		}
2235 2518
 		return '';
2236 2519
 	}
2237 2520
 
2238 2521
 	public static function update_ModeS_flarm() {
2239 2522
 		global $tmp_dir, $globalDebug;
2240
-		if ($globalDebug) echo "Modes Flarmnet: Download...";
2523
+		if ($globalDebug) {
2524
+			echo "Modes Flarmnet: Download...";
2525
+		}
2241 2526
 		update_db::download('http://flarmnet.org/files/data.fln',$tmp_dir.'data.fln');
2242 2527
 		if (file_exists($tmp_dir.'data.fln')) {
2243
-			if ($globalDebug) echo "Add to DB...";
2528
+			if ($globalDebug) {
2529
+				echo "Add to DB...";
2530
+			}
2244 2531
 			$error = update_db::retrieve_modes_flarmnet($tmp_dir.'data.fln');
2245
-		} else $error = "File ".$tmp_dir.'data.fln'." doesn't exist. Download failed.";
2532
+		} else {
2533
+			$error = "File ".$tmp_dir.'data.fln'." doesn't exist. Download failed.";
2534
+		}
2246 2535
 		if ($error != '') {
2247 2536
 			return $error;
2248
-		} elseif ($globalDebug) echo "Done\n";
2537
+		} elseif ($globalDebug) {
2538
+			echo "Done\n";
2539
+		}
2249 2540
 		return '';
2250 2541
 	}
2251 2542
 
2252 2543
 	public static function update_ModeS_ogn() {
2253 2544
 		global $tmp_dir, $globalDebug;
2254
-		if ($globalDebug) echo "Modes OGN: Download...";
2545
+		if ($globalDebug) {
2546
+			echo "Modes OGN: Download...";
2547
+		}
2255 2548
 		update_db::download('http://ddb.glidernet.org/download/',$tmp_dir.'ogn.csv');
2256 2549
 		if (file_exists($tmp_dir.'ogn.csv')) {
2257
-			if ($globalDebug) echo "Add to DB...";
2550
+			if ($globalDebug) {
2551
+				echo "Add to DB...";
2552
+			}
2258 2553
 			$error = update_db::retrieve_modes_ogn($tmp_dir.'ogn.csv');
2259
-		} else $error = "File ".$tmp_dir.'ogn.csv'." doesn't exist. Download failed.";
2554
+		} else {
2555
+			$error = "File ".$tmp_dir.'ogn.csv'." doesn't exist. Download failed.";
2556
+		}
2260 2557
 		if ($error != '') {
2261 2558
 			return $error;
2262
-		} elseif ($globalDebug) echo "Done\n";
2559
+		} elseif ($globalDebug) {
2560
+			echo "Done\n";
2561
+		}
2263 2562
 		return '';
2264 2563
 	}
2265 2564
 
2266 2565
 	public static function update_owner() {
2267 2566
 		global $tmp_dir, $globalDebug, $globalMasterSource;
2268 2567
 		
2269
-		if ($globalDebug) echo "Owner France: Download...";
2568
+		if ($globalDebug) {
2569
+			echo "Owner France: Download...";
2570
+		}
2270 2571
 		update_db::download('http://antonakis.co.uk/registers/France.txt',$tmp_dir.'owner_f.csv');
2271 2572
 		if (file_exists($tmp_dir.'owner_f.csv')) {
2272
-			if ($globalDebug) echo "Add to DB...";
2573
+			if ($globalDebug) {
2574
+				echo "Add to DB...";
2575
+			}
2273 2576
 			$error = update_db::retrieve_owner($tmp_dir.'owner_f.csv','F');
2274
-		} else $error = "File ".$tmp_dir.'owner_f.csv'." doesn't exist. Download failed.";
2577
+		} else {
2578
+			$error = "File ".$tmp_dir.'owner_f.csv'." doesn't exist. Download failed.";
2579
+		}
2275 2580
 		if ($error != '') {
2276 2581
 			return $error;
2277
-		} elseif ($globalDebug) echo "Done\n";
2582
+		} elseif ($globalDebug) {
2583
+			echo "Done\n";
2584
+		}
2278 2585
 		
2279
-		if ($globalDebug) echo "Owner Ireland: Download...";
2586
+		if ($globalDebug) {
2587
+			echo "Owner Ireland: Download...";
2588
+		}
2280 2589
 		update_db::download('http://antonakis.co.uk/registers/Ireland.txt',$tmp_dir.'owner_ei.csv');
2281 2590
 		if (file_exists($tmp_dir.'owner_ei.csv')) {
2282
-			if ($globalDebug) echo "Add to DB...";
2591
+			if ($globalDebug) {
2592
+				echo "Add to DB...";
2593
+			}
2283 2594
 			$error = update_db::retrieve_owner($tmp_dir.'owner_ei.csv','EI');
2284
-		} else $error = "File ".$tmp_dir.'owner_ei.csv'." doesn't exist. Download failed.";
2595
+		} else {
2596
+			$error = "File ".$tmp_dir.'owner_ei.csv'." doesn't exist. Download failed.";
2597
+		}
2285 2598
 		if ($error != '') {
2286 2599
 			return $error;
2287
-		} elseif ($globalDebug) echo "Done\n";
2288
-		if ($globalDebug) echo "Owner Switzerland: Download...";
2600
+		} elseif ($globalDebug) {
2601
+			echo "Done\n";
2602
+		}
2603
+		if ($globalDebug) {
2604
+			echo "Owner Switzerland: Download...";
2605
+		}
2289 2606
 		update_db::download('http://antonakis.co.uk/registers/Switzerland.txt',$tmp_dir.'owner_hb.csv');
2290 2607
 		if (file_exists($tmp_dir.'owner_hb.csv')) {
2291
-			if ($globalDebug) echo "Add to DB...";
2608
+			if ($globalDebug) {
2609
+				echo "Add to DB...";
2610
+			}
2292 2611
 			$error = update_db::retrieve_owner($tmp_dir.'owner_hb.csv','HB');
2293
-		} else $error = "File ".$tmp_dir.'owner_hb.csv'." doesn't exist. Download failed.";
2612
+		} else {
2613
+			$error = "File ".$tmp_dir.'owner_hb.csv'." doesn't exist. Download failed.";
2614
+		}
2294 2615
 		if ($error != '') {
2295 2616
 			return $error;
2296
-		} elseif ($globalDebug) echo "Done\n";
2297
-		if ($globalDebug) echo "Owner Czech Republic: Download...";
2617
+		} elseif ($globalDebug) {
2618
+			echo "Done\n";
2619
+		}
2620
+		if ($globalDebug) {
2621
+			echo "Owner Czech Republic: Download...";
2622
+		}
2298 2623
 		update_db::download('http://antonakis.co.uk/registers/CzechRepublic.txt',$tmp_dir.'owner_ok.csv');
2299 2624
 		if (file_exists($tmp_dir.'owner_ok.csv')) {
2300
-			if ($globalDebug) echo "Add to DB...";
2625
+			if ($globalDebug) {
2626
+				echo "Add to DB...";
2627
+			}
2301 2628
 			$error = update_db::retrieve_owner($tmp_dir.'owner_ok.csv','OK');
2302
-		} else $error = "File ".$tmp_dir.'owner_ok.csv'." doesn't exist. Download failed.";
2629
+		} else {
2630
+			$error = "File ".$tmp_dir.'owner_ok.csv'." doesn't exist. Download failed.";
2631
+		}
2303 2632
 		if ($error != '') {
2304 2633
 			return $error;
2305
-		} elseif ($globalDebug) echo "Done\n";
2306
-		if ($globalDebug) echo "Owner Australia: Download...";
2634
+		} elseif ($globalDebug) {
2635
+			echo "Done\n";
2636
+		}
2637
+		if ($globalDebug) {
2638
+			echo "Owner Australia: Download...";
2639
+		}
2307 2640
 		update_db::download('http://antonakis.co.uk/registers/Australia.txt',$tmp_dir.'owner_vh.csv');
2308 2641
 		if (file_exists($tmp_dir.'owner_vh.csv')) {
2309
-			if ($globalDebug) echo "Add to DB...";
2642
+			if ($globalDebug) {
2643
+				echo "Add to DB...";
2644
+			}
2310 2645
 			$error = update_db::retrieve_owner($tmp_dir.'owner_vh.csv','VH');
2311
-		} else $error = "File ".$tmp_dir.'owner_vh.csv'." doesn't exist. Download failed.";
2646
+		} else {
2647
+			$error = "File ".$tmp_dir.'owner_vh.csv'." doesn't exist. Download failed.";
2648
+		}
2312 2649
 		if ($error != '') {
2313 2650
 			return $error;
2314
-		} elseif ($globalDebug) echo "Done\n";
2315
-		if ($globalDebug) echo "Owner Austria: Download...";
2651
+		} elseif ($globalDebug) {
2652
+			echo "Done\n";
2653
+		}
2654
+		if ($globalDebug) {
2655
+			echo "Owner Austria: Download...";
2656
+		}
2316 2657
 		update_db::download('http://antonakis.co.uk/registers/Austria.txt',$tmp_dir.'owner_oe.csv');
2317 2658
 		if (file_exists($tmp_dir.'owner_oe.csv')) {
2318
-			if ($globalDebug) echo "Add to DB...";
2659
+			if ($globalDebug) {
2660
+				echo "Add to DB...";
2661
+			}
2319 2662
 			$error = update_db::retrieve_owner($tmp_dir.'owner_oe.csv','OE');
2320
-		} else $error = "File ".$tmp_dir.'owner_oe.csv'." doesn't exist. Download failed.";
2663
+		} else {
2664
+			$error = "File ".$tmp_dir.'owner_oe.csv'." doesn't exist. Download failed.";
2665
+		}
2321 2666
 		if ($error != '') {
2322 2667
 			return $error;
2323
-		} elseif ($globalDebug) echo "Done\n";
2324
-		if ($globalDebug) echo "Owner Chile: Download...";
2668
+		} elseif ($globalDebug) {
2669
+			echo "Done\n";
2670
+		}
2671
+		if ($globalDebug) {
2672
+			echo "Owner Chile: Download...";
2673
+		}
2325 2674
 		update_db::download('http://antonakis.co.uk/registers/Chile.txt',$tmp_dir.'owner_cc.csv');
2326 2675
 		if (file_exists($tmp_dir.'owner_cc.csv')) {
2327
-			if ($globalDebug) echo "Add to DB...";
2676
+			if ($globalDebug) {
2677
+				echo "Add to DB...";
2678
+			}
2328 2679
 			$error = update_db::retrieve_owner($tmp_dir.'owner_cc.csv','CC');
2329
-		} else $error = "File ".$tmp_dir.'owner_cc.csv'." doesn't exist. Download failed.";
2680
+		} else {
2681
+			$error = "File ".$tmp_dir.'owner_cc.csv'." doesn't exist. Download failed.";
2682
+		}
2330 2683
 		if ($error != '') {
2331 2684
 			return $error;
2332
-		} elseif ($globalDebug) echo "Done\n";
2333
-		if ($globalDebug) echo "Owner Colombia: Download...";
2685
+		} elseif ($globalDebug) {
2686
+			echo "Done\n";
2687
+		}
2688
+		if ($globalDebug) {
2689
+			echo "Owner Colombia: Download...";
2690
+		}
2334 2691
 		update_db::download('http://antonakis.co.uk/registers/Colombia.txt',$tmp_dir.'owner_hj.csv');
2335 2692
 		if (file_exists($tmp_dir.'owner_hj.csv')) {
2336
-			if ($globalDebug) echo "Add to DB...";
2693
+			if ($globalDebug) {
2694
+				echo "Add to DB...";
2695
+			}
2337 2696
 			$error = update_db::retrieve_owner($tmp_dir.'owner_hj.csv','HJ');
2338
-		} else $error = "File ".$tmp_dir.'owner_hj.csv'." doesn't exist. Download failed.";
2697
+		} else {
2698
+			$error = "File ".$tmp_dir.'owner_hj.csv'." doesn't exist. Download failed.";
2699
+		}
2339 2700
 		if ($error != '') {
2340 2701
 			return $error;
2341
-		} elseif ($globalDebug) echo "Done\n";
2342
-		if ($globalDebug) echo "Owner Bosnia Herzegobina: Download...";
2702
+		} elseif ($globalDebug) {
2703
+			echo "Done\n";
2704
+		}
2705
+		if ($globalDebug) {
2706
+			echo "Owner Bosnia Herzegobina: Download...";
2707
+		}
2343 2708
 		update_db::download('http://antonakis.co.uk/registers/BosniaHerzegovina.txt',$tmp_dir.'owner_e7.csv');
2344 2709
 		if (file_exists($tmp_dir.'owner_e7.csv')) {
2345
-			if ($globalDebug) echo "Add to DB...";
2710
+			if ($globalDebug) {
2711
+				echo "Add to DB...";
2712
+			}
2346 2713
 			$error = update_db::retrieve_owner($tmp_dir.'owner_e7.csv','E7');
2347
-		} else $error = "File ".$tmp_dir.'owner_e7.csv'." doesn't exist. Download failed.";
2714
+		} else {
2715
+			$error = "File ".$tmp_dir.'owner_e7.csv'." doesn't exist. Download failed.";
2716
+		}
2348 2717
 		if ($error != '') {
2349 2718
 			return $error;
2350
-		} elseif ($globalDebug) echo "Done\n";
2351
-		if ($globalDebug) echo "Owner Brazil: Download...";
2719
+		} elseif ($globalDebug) {
2720
+			echo "Done\n";
2721
+		}
2722
+		if ($globalDebug) {
2723
+			echo "Owner Brazil: Download...";
2724
+		}
2352 2725
 		update_db::download('http://antonakis.co.uk/registers/Brazil.txt',$tmp_dir.'owner_pp.csv');
2353 2726
 		if (file_exists($tmp_dir.'owner_pp.csv')) {
2354
-			if ($globalDebug) echo "Add to DB...";
2727
+			if ($globalDebug) {
2728
+				echo "Add to DB...";
2729
+			}
2355 2730
 			$error = update_db::retrieve_owner($tmp_dir.'owner_pp.csv','PP');
2356
-		} else $error = "File ".$tmp_dir.'owner_pp.csv'." doesn't exist. Download failed.";
2731
+		} else {
2732
+			$error = "File ".$tmp_dir.'owner_pp.csv'." doesn't exist. Download failed.";
2733
+		}
2357 2734
 		if ($error != '') {
2358 2735
 			return $error;
2359
-		} elseif ($globalDebug) echo "Done\n";
2360
-		if ($globalDebug) echo "Owner Cayman Islands: Download...";
2736
+		} elseif ($globalDebug) {
2737
+			echo "Done\n";
2738
+		}
2739
+		if ($globalDebug) {
2740
+			echo "Owner Cayman Islands: Download...";
2741
+		}
2361 2742
 		update_db::download('http://antonakis.co.uk/registers/CaymanIslands.txt',$tmp_dir.'owner_vp.csv');
2362 2743
 		if (file_exists($tmp_dir.'owner_vp.csv')) {
2363
-			if ($globalDebug) echo "Add to DB...";
2744
+			if ($globalDebug) {
2745
+				echo "Add to DB...";
2746
+			}
2364 2747
 			$error = update_db::retrieve_owner($tmp_dir.'owner_vp.csv','VP');
2365
-		} else $error = "File ".$tmp_dir.'owner_vp.csv'." doesn't exist. Download failed.";
2748
+		} else {
2749
+			$error = "File ".$tmp_dir.'owner_vp.csv'." doesn't exist. Download failed.";
2750
+		}
2366 2751
 		if ($error != '') {
2367 2752
 			return $error;
2368
-		} elseif ($globalDebug) echo "Done\n";
2369
-		if ($globalDebug) echo "Owner Croatia: Download...";
2753
+		} elseif ($globalDebug) {
2754
+			echo "Done\n";
2755
+		}
2756
+		if ($globalDebug) {
2757
+			echo "Owner Croatia: Download...";
2758
+		}
2370 2759
 		update_db::download('http://antonakis.co.uk/registers/Croatia.txt',$tmp_dir.'owner_9a.csv');
2371 2760
 		if (file_exists($tmp_dir.'owner_9a.csv')) {
2372
-			if ($globalDebug) echo "Add to DB...";
2761
+			if ($globalDebug) {
2762
+				echo "Add to DB...";
2763
+			}
2373 2764
 			$error = update_db::retrieve_owner($tmp_dir.'owner_9a.csv','9A');
2374
-		} else $error = "File ".$tmp_dir.'owner_9a.csv'." doesn't exist. Download failed.";
2765
+		} else {
2766
+			$error = "File ".$tmp_dir.'owner_9a.csv'." doesn't exist. Download failed.";
2767
+		}
2375 2768
 		if ($error != '') {
2376 2769
 			return $error;
2377
-		} elseif ($globalDebug) echo "Done\n";
2378
-		if ($globalDebug) echo "Owner Luxembourg: Download...";
2770
+		} elseif ($globalDebug) {
2771
+			echo "Done\n";
2772
+		}
2773
+		if ($globalDebug) {
2774
+			echo "Owner Luxembourg: Download...";
2775
+		}
2379 2776
 		update_db::download('http://antonakis.co.uk/registers/Luxembourg.txt',$tmp_dir.'owner_lx.csv');
2380 2777
 		if (file_exists($tmp_dir.'owner_lx.csv')) {
2381
-			if ($globalDebug) echo "Add to DB...";
2778
+			if ($globalDebug) {
2779
+				echo "Add to DB...";
2780
+			}
2382 2781
 			$error = update_db::retrieve_owner($tmp_dir.'owner_lx.csv','LX');
2383
-		} else $error = "File ".$tmp_dir.'owner_lx.csv'." doesn't exist. Download failed.";
2782
+		} else {
2783
+			$error = "File ".$tmp_dir.'owner_lx.csv'." doesn't exist. Download failed.";
2784
+		}
2384 2785
 		if ($error != '') {
2385 2786
 			return $error;
2386
-		} elseif ($globalDebug) echo "Done\n";
2387
-		if ($globalDebug) echo "Owner Maldives: Download...";
2787
+		} elseif ($globalDebug) {
2788
+			echo "Done\n";
2789
+		}
2790
+		if ($globalDebug) {
2791
+			echo "Owner Maldives: Download...";
2792
+		}
2388 2793
 		update_db::download('http://antonakis.co.uk/registers/Maldives.txt',$tmp_dir.'owner_8q.csv');
2389 2794
 		if (file_exists($tmp_dir.'owner_8q.csv')) {
2390
-			if ($globalDebug) echo "Add to DB...";
2795
+			if ($globalDebug) {
2796
+				echo "Add to DB...";
2797
+			}
2391 2798
 			$error = update_db::retrieve_owner($tmp_dir.'owner_8q.csv','8Q');
2392
-		} else $error = "File ".$tmp_dir.'owner_8q.csv'." doesn't exist. Download failed.";
2799
+		} else {
2800
+			$error = "File ".$tmp_dir.'owner_8q.csv'." doesn't exist. Download failed.";
2801
+		}
2393 2802
 		if ($error != '') {
2394 2803
 			return $error;
2395
-		} elseif ($globalDebug) echo "Done\n";
2396
-		if ($globalDebug) echo "Owner New Zealand: Download...";
2804
+		} elseif ($globalDebug) {
2805
+			echo "Done\n";
2806
+		}
2807
+		if ($globalDebug) {
2808
+			echo "Owner New Zealand: Download...";
2809
+		}
2397 2810
 		update_db::download('http://antonakis.co.uk/registers/NewZealand.txt',$tmp_dir.'owner_zk.csv');
2398 2811
 		if (file_exists($tmp_dir.'owner_zk.csv')) {
2399
-			if ($globalDebug) echo "Add to DB...";
2812
+			if ($globalDebug) {
2813
+				echo "Add to DB...";
2814
+			}
2400 2815
 			$error = update_db::retrieve_owner($tmp_dir.'owner_zk.csv','ZK');
2401
-		} else $error = "File ".$tmp_dir.'owner_zk.csv'." doesn't exist. Download failed.";
2816
+		} else {
2817
+			$error = "File ".$tmp_dir.'owner_zk.csv'." doesn't exist. Download failed.";
2818
+		}
2402 2819
 		if ($error != '') {
2403 2820
 			return $error;
2404
-		} elseif ($globalDebug) echo "Done\n";
2405
-		if ($globalDebug) echo "Owner Papua New Guinea: Download...";
2821
+		} elseif ($globalDebug) {
2822
+			echo "Done\n";
2823
+		}
2824
+		if ($globalDebug) {
2825
+			echo "Owner Papua New Guinea: Download...";
2826
+		}
2406 2827
 		update_db::download('http://antonakis.co.uk/registers/PapuaNewGuinea.txt',$tmp_dir.'owner_p2.csv');
2407 2828
 		if (file_exists($tmp_dir.'owner_p2.csv')) {
2408
-			if ($globalDebug) echo "Add to DB...";
2829
+			if ($globalDebug) {
2830
+				echo "Add to DB...";
2831
+			}
2409 2832
 			$error = update_db::retrieve_owner($tmp_dir.'owner_p2.csv','P2');
2410
-		} else $error = "File ".$tmp_dir.'owner_p2.csv'." doesn't exist. Download failed.";
2833
+		} else {
2834
+			$error = "File ".$tmp_dir.'owner_p2.csv'." doesn't exist. Download failed.";
2835
+		}
2411 2836
 		if ($error != '') {
2412 2837
 			return $error;
2413
-		} elseif ($globalDebug) echo "Done\n";
2414
-		if ($globalDebug) echo "Owner Slovakia: Download...";
2838
+		} elseif ($globalDebug) {
2839
+			echo "Done\n";
2840
+		}
2841
+		if ($globalDebug) {
2842
+			echo "Owner Slovakia: Download...";
2843
+		}
2415 2844
 		update_db::download('http://antonakis.co.uk/registers/Slovakia.txt',$tmp_dir.'owner_om.csv');
2416 2845
 		if (file_exists($tmp_dir.'owner_om.csv')) {
2417
-			if ($globalDebug) echo "Add to DB...";
2846
+			if ($globalDebug) {
2847
+				echo "Add to DB...";
2848
+			}
2418 2849
 			$error = update_db::retrieve_owner($tmp_dir.'owner_om.csv','OM');
2419
-		} else $error = "File ".$tmp_dir.'owner_om.csv'." doesn't exist. Download failed.";
2850
+		} else {
2851
+			$error = "File ".$tmp_dir.'owner_om.csv'." doesn't exist. Download failed.";
2852
+		}
2420 2853
 		if ($error != '') {
2421 2854
 			return $error;
2422
-		} elseif ($globalDebug) echo "Done\n";
2423
-		if ($globalDebug) echo "Owner Ecuador: Download...";
2855
+		} elseif ($globalDebug) {
2856
+			echo "Done\n";
2857
+		}
2858
+		if ($globalDebug) {
2859
+			echo "Owner Ecuador: Download...";
2860
+		}
2424 2861
 		update_db::download('http://antonakis.co.uk/registers/Ecuador.txt',$tmp_dir.'owner_hc.csv');
2425 2862
 		if (file_exists($tmp_dir.'owner_hc.csv')) {
2426
-			if ($globalDebug) echo "Add to DB...";
2863
+			if ($globalDebug) {
2864
+				echo "Add to DB...";
2865
+			}
2427 2866
 			$error = update_db::retrieve_owner($tmp_dir.'owner_hc.csv','HC');
2428
-		} else $error = "File ".$tmp_dir.'owner_hc.csv'." doesn't exist. Download failed.";
2867
+		} else {
2868
+			$error = "File ".$tmp_dir.'owner_hc.csv'." doesn't exist. Download failed.";
2869
+		}
2429 2870
 		if ($error != '') {
2430 2871
 			return $error;
2431
-		} elseif ($globalDebug) echo "Done\n";
2432
-		if ($globalDebug) echo "Owner Iceland: Download...";
2872
+		} elseif ($globalDebug) {
2873
+			echo "Done\n";
2874
+		}
2875
+		if ($globalDebug) {
2876
+			echo "Owner Iceland: Download...";
2877
+		}
2433 2878
 		update_db::download('http://antonakis.co.uk/registers/Iceland.txt',$tmp_dir.'owner_tf.csv');
2434 2879
 		if (file_exists($tmp_dir.'owner_tf.csv')) {
2435
-			if ($globalDebug) echo "Add to DB...";
2880
+			if ($globalDebug) {
2881
+				echo "Add to DB...";
2882
+			}
2436 2883
 			$error = update_db::retrieve_owner($tmp_dir.'owner_tf.csv','TF');
2437
-		} else $error = "File ".$tmp_dir.'owner_tf.csv'." doesn't exist. Download failed.";
2884
+		} else {
2885
+			$error = "File ".$tmp_dir.'owner_tf.csv'." doesn't exist. Download failed.";
2886
+		}
2438 2887
 		if ($error != '') {
2439 2888
 			return $error;
2440
-		} elseif ($globalDebug) echo "Done\n";
2441
-		if ($globalDebug) echo "Owner Isle of Man: Download...";
2889
+		} elseif ($globalDebug) {
2890
+			echo "Done\n";
2891
+		}
2892
+		if ($globalDebug) {
2893
+			echo "Owner Isle of Man: Download...";
2894
+		}
2442 2895
 		update_db::download('http://antonakis.co.uk/registers/IsleOfMan.txt',$tmp_dir.'owner_m.csv');
2443 2896
 		if (file_exists($tmp_dir.'owner_m.csv')) {
2444
-			if ($globalDebug) echo "Add to DB...";
2897
+			if ($globalDebug) {
2898
+				echo "Add to DB...";
2899
+			}
2445 2900
 			$error = update_db::retrieve_owner($tmp_dir.'owner_m.csv','M');
2446
-		} else $error = "File ".$tmp_dir.'owner_m.csv'." doesn't exist. Download failed.";
2901
+		} else {
2902
+			$error = "File ".$tmp_dir.'owner_m.csv'." doesn't exist. Download failed.";
2903
+		}
2447 2904
 		if ($error != '') {
2448 2905
 			return $error;
2449
-		} elseif ($globalDebug) echo "Done\n";
2906
+		} elseif ($globalDebug) {
2907
+			echo "Done\n";
2908
+		}
2450 2909
 		if ($globalMasterSource) {
2451
-			if ($globalDebug) echo "ModeS Netherlands: Download...";
2910
+			if ($globalDebug) {
2911
+				echo "ModeS Netherlands: Download...";
2912
+			}
2452 2913
 			update_db::download('http://antonakis.co.uk/registers/Netherlands.txt',$tmp_dir.'owner_ph.csv');
2453 2914
 			if (file_exists($tmp_dir.'owner_ph.csv')) {
2454
-				if ($globalDebug) echo "Add to DB...";
2915
+				if ($globalDebug) {
2916
+					echo "Add to DB...";
2917
+				}
2455 2918
 				$error = update_db::retrieve_owner($tmp_dir.'owner_ph.csv','PH');
2456
-			} else $error = "File ".$tmp_dir.'owner_ph.csv'." doesn't exist. Download failed.";
2919
+			} else {
2920
+				$error = "File ".$tmp_dir.'owner_ph.csv'." doesn't exist. Download failed.";
2921
+			}
2457 2922
 			if ($error != '') {
2458 2923
 				return $error;
2459
-			} elseif ($globalDebug) echo "Done\n";
2460
-			if ($globalDebug) echo "ModeS Denmark: Download...";
2924
+			} elseif ($globalDebug) {
2925
+				echo "Done\n";
2926
+			}
2927
+			if ($globalDebug) {
2928
+				echo "ModeS Denmark: Download...";
2929
+			}
2461 2930
 			update_db::download('http://antonakis.co.uk/registers/Denmark.txt',$tmp_dir.'owner_oy.csv');
2462 2931
 			if (file_exists($tmp_dir.'owner_oy.csv')) {
2463
-				if ($globalDebug) echo "Add to DB...";
2932
+				if ($globalDebug) {
2933
+					echo "Add to DB...";
2934
+				}
2464 2935
 				$error = update_db::retrieve_owner($tmp_dir.'owner_oy.csv','OY');
2465
-			} else $error = "File ".$tmp_dir.'owner_oy.csv'." doesn't exist. Download failed.";
2936
+			} else {
2937
+				$error = "File ".$tmp_dir.'owner_oy.csv'." doesn't exist. Download failed.";
2938
+			}
2466 2939
 			if ($error != '') {
2467 2940
 				return $error;
2468
-			} elseif ($globalDebug) echo "Done\n";
2469
-		} elseif ($globalDebug) echo "Done\n";
2941
+			} elseif ($globalDebug) {
2942
+				echo "Done\n";
2943
+			}
2944
+		} elseif ($globalDebug) {
2945
+			echo "Done\n";
2946
+		}
2470 2947
 		return '';
2471 2948
 	}
2472 2949
 
2473 2950
 	public static function update_translation() {
2474 2951
 		global $tmp_dir, $globalDebug;
2475 2952
 		$error = '';
2476
-		if ($globalDebug) echo "Translation : Download...";
2953
+		if ($globalDebug) {
2954
+			echo "Translation : Download...";
2955
+		}
2477 2956
 		update_db::download('http://www.acarsd.org/download/translation.php',$tmp_dir.'translation.zip');
2478 2957
 		if (file_exists($tmp_dir.'translation.zip')) {
2479
-			if ($globalDebug) echo "Unzip...";
2958
+			if ($globalDebug) {
2959
+				echo "Unzip...";
2960
+			}
2480 2961
 			update_db::unzip($tmp_dir.'translation.zip');
2481
-			if ($globalDebug) echo "Add to DB...";
2962
+			if ($globalDebug) {
2963
+				echo "Add to DB...";
2964
+			}
2482 2965
 			$error = update_db::translation();
2483
-		} else $error = "File ".$tmp_dir.'translation.zip'." doesn't exist. Download failed.";
2966
+		} else {
2967
+			$error = "File ".$tmp_dir.'translation.zip'." doesn't exist. Download failed.";
2968
+		}
2484 2969
 		if ($error != '') {
2485 2970
 			return $error;
2486
-		} elseif ($globalDebug) echo "Done\n";
2971
+		} elseif ($globalDebug) {
2972
+			echo "Done\n";
2973
+		}
2487 2974
 		return '';
2488 2975
 	}
2489 2976
 
2490 2977
 	public static function update_translation_fam() {
2491 2978
 		global $tmp_dir, $globalDebug;
2492 2979
 		$error = '';
2493
-		if ($globalDebug) echo "Translation from FlightAirMap website : Download...";
2980
+		if ($globalDebug) {
2981
+			echo "Translation from FlightAirMap website : Download...";
2982
+		}
2494 2983
 		update_db::download('http://data.flightairmap.com/data/translation.tsv.gz',$tmp_dir.'translation.tsv.gz');
2495 2984
 		update_db::download('http://data.flightairmap.com/data/translation.tsv.gz.md5',$tmp_dir.'translation.tsv.gz.md5');
2496 2985
 		if (file_exists($tmp_dir.'translation.tsv.gz') && file_exists($tmp_dir.'translation.tsv.gz')) {
2497 2986
 			$translation_md5_file = explode(' ',file_get_contents($tmp_dir.'translation.tsv.gz.md5'));
2498 2987
 			$translation_md5 = $translation_md5_file[0];
2499 2988
 			if (md5_file($tmp_dir.'translation.tsv.gz') == $translation_md5) {
2500
-				if ($globalDebug) echo "Gunzip...";
2989
+				if ($globalDebug) {
2990
+					echo "Gunzip...";
2991
+				}
2501 2992
 				update_db::gunzip($tmp_dir.'translation.tsv.gz');
2502
-				if ($globalDebug) echo "Add to DB...";
2993
+				if ($globalDebug) {
2994
+					echo "Add to DB...";
2995
+				}
2503 2996
 				$error = update_db::translation_fam();
2504
-			} else $error = "File ".$tmp_dir.'translation.tsv.gz'." md5 failed. Download failed.";
2505
-		} else $error = "File ".$tmp_dir.'translation.tsv.gz'." doesn't exist. Download failed.";
2997
+			} else {
2998
+				$error = "File ".$tmp_dir.'translation.tsv.gz'." md5 failed. Download failed.";
2999
+			}
3000
+		} else {
3001
+			$error = "File ".$tmp_dir.'translation.tsv.gz'." doesn't exist. Download failed.";
3002
+		}
2506 3003
 		if ($error != '') {
2507 3004
 			return $error;
2508
-		} elseif ($globalDebug) echo "Done\n";
3005
+		} elseif ($globalDebug) {
3006
+			echo "Done\n";
3007
+		}
2509 3008
 		return '';
2510 3009
 	}
2511 3010
 	public static function update_ModeS_fam() {
2512 3011
 		global $tmp_dir, $globalDebug;
2513 3012
 		$error = '';
2514
-		if ($globalDebug) echo "ModeS from FlightAirMap website : Download...";
3013
+		if ($globalDebug) {
3014
+			echo "ModeS from FlightAirMap website : Download...";
3015
+		}
2515 3016
 		update_db::download('http://data.flightairmap.com/data/modes.tsv.gz',$tmp_dir.'modes.tsv.gz');
2516 3017
 		update_db::download('http://data.flightairmap.com/data/modes.tsv.gz.md5',$tmp_dir.'modes.tsv.gz.md5');
2517 3018
 		if (file_exists($tmp_dir.'modes.tsv.gz') && file_exists($tmp_dir.'modes.tsv.gz.md5')) {
2518 3019
 			$modes_md5_file = explode(' ',file_get_contents($tmp_dir.'modes.tsv.gz.md5'));
2519 3020
 			$modes_md5 = $modes_md5_file[0];
2520 3021
 			if (md5_file($tmp_dir.'modes.tsv.gz') == $modes_md5) {
2521
-				if ($globalDebug) echo "Gunzip...";
3022
+				if ($globalDebug) {
3023
+					echo "Gunzip...";
3024
+				}
2522 3025
 				update_db::gunzip($tmp_dir.'modes.tsv.gz');
2523
-				if ($globalDebug) echo "Add to DB...";
3026
+				if ($globalDebug) {
3027
+					echo "Add to DB...";
3028
+				}
2524 3029
 				$error = update_db::modes_fam();
2525
-			} else $error = "File ".$tmp_dir.'modes.tsv.gz'." md5 failed. Download failed.";
2526
-		} else $error = "File ".$tmp_dir.'modes.tsv.gz'." doesn't exist. Download failed.";
3030
+			} else {
3031
+				$error = "File ".$tmp_dir.'modes.tsv.gz'." md5 failed. Download failed.";
3032
+			}
3033
+		} else {
3034
+			$error = "File ".$tmp_dir.'modes.tsv.gz'." doesn't exist. Download failed.";
3035
+		}
2527 3036
 		if ($error != '') {
2528 3037
 			return $error;
2529
-		} elseif ($globalDebug) echo "Done\n";
3038
+		} elseif ($globalDebug) {
3039
+			echo "Done\n";
3040
+		}
2530 3041
 		return '';
2531 3042
 	}
2532 3043
 
2533 3044
 	public static function update_airlines_fam() {
2534 3045
 		global $tmp_dir, $globalDebug;
2535 3046
 		$error = '';
2536
-		if ($globalDebug) echo "Airlines from FlightAirMap website : Download...";
3047
+		if ($globalDebug) {
3048
+			echo "Airlines from FlightAirMap website : Download...";
3049
+		}
2537 3050
 		update_db::download('http://data.flightairmap.com/data/airlines.tsv.gz.md5',$tmp_dir.'airlines.tsv.gz.md5');
2538 3051
 		if (file_exists($tmp_dir.'airlines.tsv.gz.md5')) {
2539 3052
 			$airlines_md5_file = explode(' ',file_get_contents($tmp_dir.'airlines.tsv.gz.md5'));
@@ -2542,26 +3055,42 @@  discard block
 block discarded – undo
2542 3055
 				update_db::download('http://data.flightairmap.com/data/airlines.tsv.gz',$tmp_dir.'airlines.tsv.gz');
2543 3056
 				if (file_exists($tmp_dir.'airlines.tsv.gz')) {
2544 3057
 					if (md5_file($tmp_dir.'airlines.tsv.gz') == $airlines_md5) {
2545
-						if ($globalDebug) echo "Gunzip...";
3058
+						if ($globalDebug) {
3059
+							echo "Gunzip...";
3060
+						}
2546 3061
 						update_db::gunzip($tmp_dir.'airlines.tsv.gz');
2547
-						if ($globalDebug) echo "Add to DB...";
3062
+						if ($globalDebug) {
3063
+							echo "Add to DB...";
3064
+						}
2548 3065
 						$error = update_db::airlines_fam();
2549 3066
 						update_db::insert_airlines_version($airlines_md5);
2550
-					} else $error = "File ".$tmp_dir.'airlines.tsv.gz'." md5 failed. Download failed.";
2551
-			    } else $error = "File ".$tmp_dir.'airlines.tsv.gz'." doesn't exist. Download failed.";
2552
-			} elseif ($globalDebug) echo "No update.";
2553
-		} else $error = "File ".$tmp_dir.'airlines.tsv.gz.md5'." doesn't exist. Download failed.";
3067
+					} else {
3068
+						$error = "File ".$tmp_dir.'airlines.tsv.gz'." md5 failed. Download failed.";
3069
+					}
3070
+			    } else {
3071
+			    	$error = "File ".$tmp_dir.'airlines.tsv.gz'." doesn't exist. Download failed.";
3072
+			    }
3073
+			} elseif ($globalDebug) {
3074
+				echo "No update.";
3075
+			}
3076
+		} else {
3077
+			$error = "File ".$tmp_dir.'airlines.tsv.gz.md5'." doesn't exist. Download failed.";
3078
+		}
2554 3079
 		if ($error != '') {
2555 3080
 			return $error;
2556 3081
 		} else {
2557
-			if ($globalDebug) echo "Done\n";
3082
+			if ($globalDebug) {
3083
+				echo "Done\n";
3084
+			}
2558 3085
 		}
2559 3086
 		return '';
2560 3087
 	}
2561 3088
 
2562 3089
 	public static function update_owner_fam() {
2563 3090
 		global $tmp_dir, $globalDebug, $globalOwner;
2564
-		if ($globalDebug) echo "owner from FlightAirMap website : Download...";
3091
+		if ($globalDebug) {
3092
+			echo "owner from FlightAirMap website : Download...";
3093
+		}
2565 3094
 		$error = '';
2566 3095
 		if ($globalOwner === TRUE) {
2567 3096
 			update_db::download('http://data.flightairmap.com/data/owners_all.tsv.gz',$tmp_dir.'owners.tsv.gz');
@@ -2574,55 +3103,89 @@  discard block
 block discarded – undo
2574 3103
 			$owners_md5_file = explode(' ',file_get_contents($tmp_dir.'owners.tsv.gz.md5'));
2575 3104
 			$owners_md5 = $owners_md5_file[0];
2576 3105
 			if (md5_file($tmp_dir.'owners.tsv.gz') == $owners_md5) {
2577
-				if ($globalDebug) echo "Gunzip...";
3106
+				if ($globalDebug) {
3107
+					echo "Gunzip...";
3108
+				}
2578 3109
 				update_db::gunzip($tmp_dir.'owners.tsv.gz');
2579
-				if ($globalDebug) echo "Add to DB...";
3110
+				if ($globalDebug) {
3111
+					echo "Add to DB...";
3112
+				}
2580 3113
 				$error = update_db::owner_fam();
2581
-			} else $error = "File ".$tmp_dir.'owners.tsv.gz'." md5 failed. Download failed.";
2582
-		} else $error = "File ".$tmp_dir.'owners.tsv.gz'." doesn't exist. Download failed.";
3114
+			} else {
3115
+				$error = "File ".$tmp_dir.'owners.tsv.gz'." md5 failed. Download failed.";
3116
+			}
3117
+		} else {
3118
+			$error = "File ".$tmp_dir.'owners.tsv.gz'." doesn't exist. Download failed.";
3119
+		}
2583 3120
 		if ($error != '') {
2584 3121
 			return $error;
2585
-		} elseif ($globalDebug) echo "Done\n";
3122
+		} elseif ($globalDebug) {
3123
+			echo "Done\n";
3124
+		}
2586 3125
 		return '';
2587 3126
 	}
2588 3127
 	public static function update_routes_fam() {
2589 3128
 		global $tmp_dir, $globalDebug;
2590
-		if ($globalDebug) echo "Routes from FlightAirMap website : Download...";
3129
+		if ($globalDebug) {
3130
+			echo "Routes from FlightAirMap website : Download...";
3131
+		}
2591 3132
 		update_db::download('http://data.flightairmap.com/data/routes.tsv.gz',$tmp_dir.'routes.tsv.gz');
2592 3133
 		update_db::download('http://data.flightairmap.com/data/routes.tsv.gz.md5',$tmp_dir.'routes.tsv.gz.md5');
2593 3134
 		if (file_exists($tmp_dir.'routes.tsv.gz') && file_exists($tmp_dir.'routes.tsv.gz.md5')) {
2594 3135
 			$routes_md5_file = explode(' ',file_get_contents($tmp_dir.'routes.tsv.gz.md5'));
2595 3136
 			$routes_md5 = $routes_md5_file[0];
2596 3137
 			if (md5_file($tmp_dir.'routes.tsv.gz') == $routes_md5) {
2597
-				if ($globalDebug) echo "Gunzip...";
3138
+				if ($globalDebug) {
3139
+					echo "Gunzip...";
3140
+				}
2598 3141
 				update_db::gunzip($tmp_dir.'routes.tsv.gz');
2599
-				if ($globalDebug) echo "Add to DB...";
3142
+				if ($globalDebug) {
3143
+					echo "Add to DB...";
3144
+				}
2600 3145
 				$error = update_db::routes_fam();
2601
-			} else $error = "File ".$tmp_dir.'routes.tsv.gz'." md5 failed. Download failed.";
2602
-		} else $error = "File ".$tmp_dir.'routes.tsv.gz'." doesn't exist. Download failed.";
3146
+			} else {
3147
+				$error = "File ".$tmp_dir.'routes.tsv.gz'." md5 failed. Download failed.";
3148
+			}
3149
+		} else {
3150
+			$error = "File ".$tmp_dir.'routes.tsv.gz'." doesn't exist. Download failed.";
3151
+		}
2603 3152
 		if ($error != '') {
2604 3153
 			return $error;
2605
-		} elseif ($globalDebug) echo "Done\n";
3154
+		} elseif ($globalDebug) {
3155
+			echo "Done\n";
3156
+		}
2606 3157
 		return '';
2607 3158
 	}
2608 3159
 	public static function update_block_fam() {
2609 3160
 		global $tmp_dir, $globalDebug;
2610
-		if ($globalDebug) echo "Blocked aircraft from FlightAirMap website : Download...";
3161
+		if ($globalDebug) {
3162
+			echo "Blocked aircraft from FlightAirMap website : Download...";
3163
+		}
2611 3164
 		update_db::download('http://data.flightairmap.com/data/block.tsv.gz',$tmp_dir.'block.tsv.gz');
2612 3165
 		update_db::download('http://data.flightairmap.com/data/block.tsv.gz.md5',$tmp_dir.'block.tsv.gz.md5');
2613 3166
 		if (file_exists($tmp_dir.'block.tsv.gz') && file_exists($tmp_dir.'block.tsv.gz.md5')) {
2614 3167
 			$block_md5_file = explode(' ',file_get_contents($tmp_dir.'block.tsv.gz.md5'));
2615 3168
 			$block_md5 = $block_md5_file[0];
2616 3169
 			if (md5_file($tmp_dir.'block.tsv.gz') == $block_md5) {
2617
-				if ($globalDebug) echo "Gunzip...";
3170
+				if ($globalDebug) {
3171
+					echo "Gunzip...";
3172
+				}
2618 3173
 				update_db::gunzip($tmp_dir.'block.tsv.gz');
2619
-				if ($globalDebug) echo "Add to DB...";
3174
+				if ($globalDebug) {
3175
+					echo "Add to DB...";
3176
+				}
2620 3177
 				$error = update_db::block_fam();
2621
-			} else $error = "File ".$tmp_dir.'block.tsv.gz'." md5 failed. Download failed.";
2622
-		} else $error = "File ".$tmp_dir.'block.tsv.gz'." doesn't exist. Download failed.";
3178
+			} else {
3179
+				$error = "File ".$tmp_dir.'block.tsv.gz'." md5 failed. Download failed.";
3180
+			}
3181
+		} else {
3182
+			$error = "File ".$tmp_dir.'block.tsv.gz'." doesn't exist. Download failed.";
3183
+		}
2623 3184
 		if ($error != '') {
2624 3185
 			return $error;
2625
-		} elseif ($globalDebug) echo "Done\n";
3186
+		} elseif ($globalDebug) {
3187
+			echo "Done\n";
3188
+		}
2626 3189
 		return '';
2627 3190
 	}
2628 3191
 	public static function update_marine_identity_fam() {
@@ -2632,21 +3195,33 @@  discard block
 block discarded – undo
2632 3195
 			$marine_identity_md5_file = explode(' ',file_get_contents($tmp_dir.'marine_identity.tsv.gz.md5'));
2633 3196
 			$marine_identity_md5 = $marine_identity_md5_file[0];
2634 3197
 			if (!update_db::check_marine_identity_version($marine_identity_md5)) {
2635
-				if ($globalDebug) echo "Marine identity from FlightAirMap website : Download...";
3198
+				if ($globalDebug) {
3199
+					echo "Marine identity from FlightAirMap website : Download...";
3200
+				}
2636 3201
 				update_db::download('http://data.flightairmap.com/data/marine_identity.tsv.gz',$tmp_dir.'marine_identity.tsv.gz');
2637 3202
 				if (file_exists($tmp_dir.'marine_identity.tsv.gz')) {
2638 3203
 					if (md5_file($tmp_dir.'marine_identity.tsv.gz') == $marine_identity_md5) {
2639
-						if ($globalDebug) echo "Gunzip...";
3204
+						if ($globalDebug) {
3205
+							echo "Gunzip...";
3206
+						}
2640 3207
 						update_db::gunzip($tmp_dir.'marine_identity.tsv.gz');
2641
-						if ($globalDebug) echo "Add to DB...";
3208
+						if ($globalDebug) {
3209
+							echo "Add to DB...";
3210
+						}
2642 3211
 						$error = update_db::marine_identity_fam();
2643
-					} else $error = "File ".$tmp_dir.'marine_identity.tsv.gz'." md5 failed. Download failed.";
2644
-				} else $error = "File ".$tmp_dir.'marine_identity.tsv.gz'." doesn't exist. Download failed.";
3212
+					} else {
3213
+						$error = "File ".$tmp_dir.'marine_identity.tsv.gz'." md5 failed. Download failed.";
3214
+					}
3215
+				} else {
3216
+					$error = "File ".$tmp_dir.'marine_identity.tsv.gz'." doesn't exist. Download failed.";
3217
+				}
2645 3218
 				if ($error != '') {
2646 3219
 					return $error;
2647 3220
 				} else {
2648 3221
 					update_db::insert_marine_identity_version($marine_identity_md5);
2649
-					if ($globalDebug) echo "Done\n";
3222
+					if ($globalDebug) {
3223
+						echo "Done\n";
3224
+					}
2650 3225
 				}
2651 3226
 			}
2652 3227
 		}
@@ -2660,21 +3235,33 @@  discard block
 block discarded – undo
2660 3235
 			$satellite_md5_file = explode(' ',file_get_contents($tmp_dir.'satellite.tsv.gz.md5'));
2661 3236
 			$satellite_md5 = $satellite_md5_file[0];
2662 3237
 			if (!update_db::check_satellite_version($satellite_md5)) {
2663
-				if ($globalDebug) echo "Satellite from FlightAirMap website : Download...";
3238
+				if ($globalDebug) {
3239
+					echo "Satellite from FlightAirMap website : Download...";
3240
+				}
2664 3241
 				update_db::download('http://data.flightairmap.com/data/satellite.tsv.gz',$tmp_dir.'satellite.tsv.gz');
2665 3242
 				if (file_exists($tmp_dir.'satellite.tsv.gz')) {
2666 3243
 					if (md5_file($tmp_dir.'satellite.tsv.gz') == $satellite_md5) {
2667
-						if ($globalDebug) echo "Gunzip...";
3244
+						if ($globalDebug) {
3245
+							echo "Gunzip...";
3246
+						}
2668 3247
 						update_db::gunzip($tmp_dir.'satellite.tsv.gz');
2669
-						if ($globalDebug) echo "Add to DB...";
3248
+						if ($globalDebug) {
3249
+							echo "Add to DB...";
3250
+						}
2670 3251
 						$error = update_db::satellite_fam();
2671
-					} else $error = "File ".$tmp_dir.'satellite.tsv.gz'." md5 failed. Download failed.";
2672
-				} else $error = "File ".$tmp_dir.'satellite.tsv.gz'." doesn't exist. Download failed.";
3252
+					} else {
3253
+						$error = "File ".$tmp_dir.'satellite.tsv.gz'." md5 failed. Download failed.";
3254
+					}
3255
+				} else {
3256
+					$error = "File ".$tmp_dir.'satellite.tsv.gz'." doesn't exist. Download failed.";
3257
+				}
2673 3258
 				if ($error != '') {
2674 3259
 					return $error;
2675 3260
 				} else {
2676 3261
 					update_db::insert_satellite_version($satellite_md5);
2677
-					if ($globalDebug) echo "Done\n";
3262
+					if ($globalDebug) {
3263
+						echo "Done\n";
3264
+					}
2678 3265
 				}
2679 3266
 			}
2680 3267
 		}
@@ -2687,19 +3274,29 @@  discard block
 block discarded – undo
2687 3274
 			$diagrams_md5_file = explode(' ',file_get_contents($tmp_dir.'diagramspdf.md5'));
2688 3275
 			$diagrams_md5 = $diagrams_md5_file[0];
2689 3276
 			if (!update_db::check_diagrams_version($diagrams_md5)) {
2690
-				if ($globalDebug) echo "Airports diagrams from FlightAirMap website : Download...";
3277
+				if ($globalDebug) {
3278
+					echo "Airports diagrams from FlightAirMap website : Download...";
3279
+				}
2691 3280
 				update_db::download('http://data.flightairmap.com/data/diagrams/diagramspdf',$tmp_dir.'diagramspdf');
2692 3281
 				if (file_exists($tmp_dir.'diagramspdf')) {
2693 3282
 					if (md5_file($tmp_dir.'diagramspdf') == $diagrams_md5) {
2694
-						if ($globalDebug) echo "Add to DB...";
3283
+						if ($globalDebug) {
3284
+							echo "Add to DB...";
3285
+						}
2695 3286
 						$error = update_db::diagrams_fam();
2696
-					} else $error = "File ".$tmp_dir.'diagramspdf'." md5 failed. Download failed.";
2697
-				} else $error = "File ".$tmp_dir.'diagramspdf'." doesn't exist. Download failed.";
3287
+					} else {
3288
+						$error = "File ".$tmp_dir.'diagramspdf'." md5 failed. Download failed.";
3289
+					}
3290
+				} else {
3291
+					$error = "File ".$tmp_dir.'diagramspdf'." doesn't exist. Download failed.";
3292
+				}
2698 3293
 				if ($error != '') {
2699 3294
 					return $error;
2700 3295
 				} else {
2701 3296
 					update_db::insert_diagrams_version($diagrams_md5);
2702
-					if ($globalDebug) echo "Done\n";
3297
+					if ($globalDebug) {
3298
+						echo "Done\n";
3299
+					}
2703 3300
 				}
2704 3301
 			}
2705 3302
 		}
@@ -2707,17 +3304,25 @@  discard block
 block discarded – undo
2707 3304
 	}
2708 3305
 	public static function update_banned_fam() {
2709 3306
 		global $tmp_dir, $globalDebug;
2710
-		if ($globalDebug) echo "Banned airlines in Europe from FlightAirMap website : Download...";
3307
+		if ($globalDebug) {
3308
+			echo "Banned airlines in Europe from FlightAirMap website : Download...";
3309
+		}
2711 3310
 		update_db::download('http://data.flightairmap.com/data/ban-eu.csv',$tmp_dir.'ban_eu.csv');
2712 3311
 		if (file_exists($tmp_dir.'ban_eu.csv')) {
2713 3312
 			//if ($globalDebug) echo "Gunzip...";
2714 3313
 			//update_db::gunzip($tmp_dir.'ban_ue.csv');
2715
-			if ($globalDebug) echo "Add to DB...";
3314
+			if ($globalDebug) {
3315
+				echo "Add to DB...";
3316
+			}
2716 3317
 			$error = update_db::banned_fam();
2717
-		} else $error = "File ".$tmp_dir.'ban_eu.csv'." doesn't exist. Download failed.";
3318
+		} else {
3319
+			$error = "File ".$tmp_dir.'ban_eu.csv'." doesn't exist. Download failed.";
3320
+		}
2718 3321
 		if ($error != '') {
2719 3322
 			return $error;
2720
-		} elseif ($globalDebug) echo "Done\n";
3323
+		} elseif ($globalDebug) {
3324
+			echo "Done\n";
3325
+		}
2721 3326
 		return '';
2722 3327
 	}
2723 3328
 
@@ -2725,7 +3330,9 @@  discard block
 block discarded – undo
2725 3330
 		global $tmp_dir, $globalDebug, $globalDBdriver;
2726 3331
 		include_once('class.create_db.php');
2727 3332
 		$error = '';
2728
-		if ($globalDebug) echo "Airspace from FlightAirMap website : Download...";
3333
+		if ($globalDebug) {
3334
+			echo "Airspace from FlightAirMap website : Download...";
3335
+		}
2729 3336
 		if ($globalDBdriver == 'mysql') {
2730 3337
 			update_db::download('http://data.flightairmap.com/data/airspace_mysql.sql.gz.md5',$tmp_dir.'airspace.sql.gz.md5');
2731 3338
 		} else {
@@ -2742,9 +3349,13 @@  discard block
 block discarded – undo
2742 3349
 				}
2743 3350
 				if (file_exists($tmp_dir.'airspace.sql.gz')) {
2744 3351
 					if (md5_file($tmp_dir.'airspace.sql.gz') == $airspace_md5) {
2745
-						if ($globalDebug) echo "Gunzip...";
3352
+						if ($globalDebug) {
3353
+							echo "Gunzip...";
3354
+						}
2746 3355
 						update_db::gunzip($tmp_dir.'airspace.sql.gz');
2747
-						if ($globalDebug) echo "Add to DB...";
3356
+						if ($globalDebug) {
3357
+							echo "Add to DB...";
3358
+						}
2748 3359
 						$Connection = new Connection();
2749 3360
 						if ($Connection->tableExists('airspace')) {
2750 3361
 							$query = 'DROP TABLE airspace';
@@ -2757,20 +3368,30 @@  discard block
 block discarded – undo
2757 3368
 						}
2758 3369
 						$error = create_db::import_file($tmp_dir.'airspace.sql');
2759 3370
 						update_db::insert_airspace_version($airspace_md5);
2760
-					} else $error = "File ".$tmp_dir.'airspace.sql.gz'." md5 failed. Download failed.";
2761
-				} else $error = "File ".$tmp_dir.'airspace.sql.gz'." doesn't exist. Download failed.";
3371
+					} else {
3372
+						$error = "File ".$tmp_dir.'airspace.sql.gz'." md5 failed. Download failed.";
3373
+					}
3374
+				} else {
3375
+					$error = "File ".$tmp_dir.'airspace.sql.gz'." doesn't exist. Download failed.";
3376
+				}
2762 3377
 			}
2763
-		} else $error = "File ".$tmp_dir.'airspace.sql.gz.md5'." doesn't exist. Download failed.";
3378
+		} else {
3379
+			$error = "File ".$tmp_dir.'airspace.sql.gz.md5'." doesn't exist. Download failed.";
3380
+		}
2764 3381
 		if ($error != '') {
2765 3382
 			return $error;
2766
-		} elseif ($globalDebug) echo "Done\n";
3383
+		} elseif ($globalDebug) {
3384
+			echo "Done\n";
3385
+		}
2767 3386
 		return '';
2768 3387
 	}
2769 3388
 
2770 3389
 	public static function update_geoid_fam() {
2771 3390
 		global $tmp_dir, $globalDebug, $globalGeoidSource;
2772 3391
 		$error = '';
2773
-		if ($globalDebug) echo "Geoid from FlightAirMap website : Download...";
3392
+		if ($globalDebug) {
3393
+			echo "Geoid from FlightAirMap website : Download...";
3394
+		}
2774 3395
 		update_db::download('http://data.flightairmap.com/data/geoid/'.$globalGeoidSource.'.pgm.gz.md5',$tmp_dir.$globalGeoidSource.'.pgm.gz.md5');
2775 3396
 		if (file_exists($tmp_dir.$globalGeoidSource.'.pgm.gz.md5')) {
2776 3397
 			$geoid_md5_file = explode(' ',file_get_contents($tmp_dir.$globalGeoidSource.'.pgm.gz.md5'));
@@ -2779,80 +3400,126 @@  discard block
 block discarded – undo
2779 3400
 				update_db::download('http://data.flightairmap.com/data/geoid/'.$globalGeoidSource.'.pgm.gz',$tmp_dir.$globalGeoidSource.'.pgm.gz');
2780 3401
 				if (file_exists($tmp_dir.$globalGeoidSource.'.pgm.gz')) {
2781 3402
 					if (md5_file($tmp_dir.$globalGeoidSource.'.pgm.gz') == $geoid_md5) {
2782
-						if ($globalDebug) echo "Gunzip...";
3403
+						if ($globalDebug) {
3404
+							echo "Gunzip...";
3405
+						}
2783 3406
 						update_db::gunzip($tmp_dir.$globalGeoidSource.'.pgm.gz',dirname(__FILE__).'/../data/'.$globalGeoidSource.'.pgm');
2784 3407
 						if (file_exists(dirname(__FILE__).'/../data/'.$globalGeoidSource.'.pgm')) {
2785 3408
 							update_db::insert_geoid_version($geoid_md5);
2786
-						} else $error = "File data/".$globalGeoidSource.'.pgm'." doesn't exist. Gunzip failed.";
2787
-					} else $error = "File ".$tmp_dir.$globalGeoidSource.'.pgm.gz'." md5 failed. Download failed.";
2788
-				} else $error = "File ".$tmp_dir.$globalGeoidSource.'.pgm.gz'." doesn't exist. Download failed.";
2789
-			} elseif ($globalDebug) echo 'No new version'."\n";
2790
-		} else $error = "File ".$tmp_dir.$globalGeoidSource.'.pgm.gz.md5'." doesn't exist. Download failed.";
3409
+						} else {
3410
+							$error = "File data/".$globalGeoidSource.'.pgm'." doesn't exist. Gunzip failed.";
3411
+						}
3412
+					} else {
3413
+						$error = "File ".$tmp_dir.$globalGeoidSource.'.pgm.gz'." md5 failed. Download failed.";
3414
+					}
3415
+				} else {
3416
+					$error = "File ".$tmp_dir.$globalGeoidSource.'.pgm.gz'." doesn't exist. Download failed.";
3417
+				}
3418
+			} elseif ($globalDebug) {
3419
+				echo 'No new version'."\n";
3420
+			}
3421
+		} else {
3422
+			$error = "File ".$tmp_dir.$globalGeoidSource.'.pgm.gz.md5'." doesn't exist. Download failed.";
3423
+		}
2791 3424
 		if ($error != '') {
2792 3425
 			return $error;
2793
-		} elseif ($globalDebug) echo "Done\n";
3426
+		} elseif ($globalDebug) {
3427
+			echo "Done\n";
3428
+		}
2794 3429
 		return '';
2795 3430
 	}
2796 3431
 
2797 3432
 	public static function update_tle() {
2798 3433
 		global $tmp_dir, $globalDebug;
2799
-		if ($globalDebug) echo "Download TLE : Download...";
3434
+		if ($globalDebug) {
3435
+			echo "Download TLE : Download...";
3436
+		}
2800 3437
 		$alltle = array('stations.txt','gps-ops.txt','glo-ops.txt','galileo.txt','weather.txt','noaa.txt','goes.txt','resource.txt','dmc.txt','tdrss.txt','geo.txt','intelsat.txt','gorizont.txt',
2801 3438
 		'raduga.txt','molniya.txt','iridium.txt','orbcomm.txt','globalstar.txt','amateur.txt','x-comm.txt','other-comm.txt','sbas.txt','nnss.txt','musson.txt','science.txt','geodetic.txt',
2802 3439
 		'engineering.txt','education.txt','military.txt','radar.txt','cubesat.txt','other.txt','tle-new.txt','visual.txt','sarsat.txt','argos.txt','ses.txt','iridium-NEXT.txt','beidou.txt');
2803 3440
 		foreach ($alltle as $filename) {
2804
-			if ($globalDebug) echo "downloading ".$filename.'...';
3441
+			if ($globalDebug) {
3442
+				echo "downloading ".$filename.'...';
3443
+			}
2805 3444
 			update_db::download('http://celestrak.com/NORAD/elements/'.$filename,$tmp_dir.$filename);
2806 3445
 			if (file_exists($tmp_dir.$filename)) {
2807
-				if ($globalDebug) echo "Add to DB ".$filename."...";
3446
+				if ($globalDebug) {
3447
+					echo "Add to DB ".$filename."...";
3448
+				}
2808 3449
 				$error = update_db::tle($tmp_dir.$filename,str_replace('.txt','',$filename));
2809
-			} else $error = "File ".$tmp_dir.$filename." doesn't exist. Download failed.";
3450
+			} else {
3451
+				$error = "File ".$tmp_dir.$filename." doesn't exist. Download failed.";
3452
+			}
2810 3453
 			if ($error != '') {
2811 3454
 				echo $error."\n";
2812
-			} elseif ($globalDebug) echo "Done\n";
3455
+			} elseif ($globalDebug) {
3456
+				echo "Done\n";
3457
+			}
2813 3458
 		}
2814 3459
 		return '';
2815 3460
 	}
2816 3461
 
2817 3462
 	public static function update_ucsdb() {
2818 3463
 		global $tmp_dir, $globalDebug;
2819
-		if ($globalDebug) echo "Download UCS DB : Download...";
3464
+		if ($globalDebug) {
3465
+			echo "Download UCS DB : Download...";
3466
+		}
2820 3467
 		update_db::download('https://s3.amazonaws.com/ucs-documents/nuclear-weapons/sat-database/8-10-18-update/UCS_Satellite_Database_officialname_5-1-2018.txt',$tmp_dir.'UCS_Satellite_Database_officialname_9-1-2017.txt');
2821 3468
 		if (file_exists($tmp_dir.'UCS_Satellite_Database_officialname_5-1-2018.txt')) {
2822
-			if ($globalDebug) echo "Add to DB...";
3469
+			if ($globalDebug) {
3470
+				echo "Add to DB...";
3471
+			}
2823 3472
 			$error = update_db::satellite_ucsdb($tmp_dir.'UCS_Satellite_Database_officialname_5-1-2018.txt');
2824
-		} else $error = "File ".$tmp_dir.'UCS_Satellite_Database_officialname_5-1-2018.txt'." doesn't exist. Download failed.";
3473
+		} else {
3474
+			$error = "File ".$tmp_dir.'UCS_Satellite_Database_officialname_5-1-2018.txt'." doesn't exist. Download failed.";
3475
+		}
2825 3476
 		if ($error != '') {
2826 3477
 			echo $error."\n";
2827
-		} elseif ($globalDebug) echo "Done\n";
3478
+		} elseif ($globalDebug) {
3479
+			echo "Done\n";
3480
+		}
2828 3481
 		return '';
2829 3482
 	}
2830 3483
 
2831 3484
 	public static function update_celestrak() {
2832 3485
 		global $tmp_dir, $globalDebug;
2833
-		if ($globalDebug) echo "Download Celestrak DB : Download...";
3486
+		if ($globalDebug) {
3487
+			echo "Download Celestrak DB : Download...";
3488
+		}
2834 3489
 		update_db::download('http://celestrak.com/pub/satcat.txt',$tmp_dir.'satcat.txt');
2835 3490
 		if (file_exists($tmp_dir.'satcat.txt')) {
2836
-			if ($globalDebug) echo "Add to DB...";
3491
+			if ($globalDebug) {
3492
+				echo "Add to DB...";
3493
+			}
2837 3494
 			$error = update_db::satellite_celestrak($tmp_dir.'satcat.txt');
2838
-		} else $error = "File ".$tmp_dir.'satcat.txt'." doesn't exist. Download failed.";
3495
+		} else {
3496
+			$error = "File ".$tmp_dir.'satcat.txt'." doesn't exist. Download failed.";
3497
+		}
2839 3498
 		if ($error != '') {
2840 3499
 			echo $error."\n";
2841
-		} elseif ($globalDebug) echo "Done\n";
3500
+		} elseif ($globalDebug) {
3501
+			echo "Done\n";
3502
+		}
2842 3503
 		return '';
2843 3504
 	}
2844 3505
 
2845 3506
 	public static function update_models() {
2846 3507
 		global $tmp_dir, $globalDebug;
2847 3508
 		$error = '';
2848
-		if ($globalDebug) echo "Models from FlightAirMap website : Download...";
3509
+		if ($globalDebug) {
3510
+			echo "Models from FlightAirMap website : Download...";
3511
+		}
2849 3512
 		if (!is_writable(dirname(__FILE__).'/../models')) {
2850
-			if ($globalDebug) echo dirname(__FILE__).'/../models'.' is not writable !';
3513
+			if ($globalDebug) {
3514
+				echo dirname(__FILE__).'/../models'.' is not writable !';
3515
+			}
2851 3516
 			return '';
2852 3517
 		}
2853 3518
 		update_db::download('http://data.flightairmap.com/data/models/models.md5sum',$tmp_dir.'models.md5sum');
2854 3519
 		if (file_exists($tmp_dir.'models.md5sum')) {
2855
-			if ($globalDebug) echo "Check files...\n";
3520
+			if ($globalDebug) {
3521
+				echo "Check files...\n";
3522
+			}
2856 3523
 			$newmodelsdb = array();
2857 3524
 			if (($handle = fopen($tmp_dir.'models.md5sum','r')) !== FALSE) {
2858 3525
 				while (($row = fgetcsv($handle,1000," ")) !== FALSE) {
@@ -2871,18 +3538,28 @@  discard block
 block discarded – undo
2871 3538
 			}
2872 3539
 			$diff = array_diff($newmodelsdb,$modelsdb);
2873 3540
 			foreach ($diff as $key => $value) {
2874
-				if ($globalDebug) echo 'Downloading model '.$key.' ...'."\n";
3541
+				if ($globalDebug) {
3542
+					echo 'Downloading model '.$key.' ...'."\n";
3543
+				}
2875 3544
 				update_db::download('http://data.flightairmap.com/data/models/'.$key,dirname(__FILE__).'/../models/'.$key);
2876 3545
 			}
2877 3546
 			update_db::download('http://data.flightairmap.com/data/models/models.md5sum',dirname(__FILE__).'/../models/models.md5sum');
2878
-		} else $error = "File ".$tmp_dir.'models.md5sum'." doesn't exist. Download failed.";
3547
+		} else {
3548
+			$error = "File ".$tmp_dir.'models.md5sum'." doesn't exist. Download failed.";
3549
+		}
2879 3550
 		if ($error != '') {
2880 3551
 			return $error;
2881
-		} elseif ($globalDebug) echo "Done\n";
2882
-		if ($globalDebug) echo "glTF 2.0 Models from FlightAirMap website : Download...";
3552
+		} elseif ($globalDebug) {
3553
+			echo "Done\n";
3554
+		}
3555
+		if ($globalDebug) {
3556
+			echo "glTF 2.0 Models from FlightAirMap website : Download...";
3557
+		}
2883 3558
 		update_db::download('http://data.flightairmap.com/data/models/gltf2/models.md5sum',$tmp_dir.'modelsgltf2.md5sum');
2884 3559
 		if (file_exists($tmp_dir.'modelsgltf2.md5sum')) {
2885
-			if ($globalDebug) echo "Check files...\n";
3560
+			if ($globalDebug) {
3561
+				echo "Check files...\n";
3562
+			}
2886 3563
 			$newmodelsdb = array();
2887 3564
 			if (($handle = fopen($tmp_dir.'modelsgltf2.md5sum','r')) !== FALSE) {
2888 3565
 				while (($row = fgetcsv($handle,1000," ")) !== FALSE) {
@@ -2901,29 +3578,43 @@  discard block
 block discarded – undo
2901 3578
 			}
2902 3579
 			$diff = array_diff($newmodelsdb,$modelsdb);
2903 3580
 			foreach ($diff as $key => $value) {
2904
-				if ($globalDebug) echo 'Downloading model '.$key.' ...'."\n";
3581
+				if ($globalDebug) {
3582
+					echo 'Downloading model '.$key.' ...'."\n";
3583
+				}
2905 3584
 				update_db::download('http://data.flightairmap.com/data/models/gltf2/'.$key,dirname(__FILE__).'/../models/gltf2/'.$key);
2906 3585
 				
2907 3586
 			}
2908 3587
 			update_db::download('http://data.flightairmap.com/data/models/gltf2/models.md5sum',dirname(__FILE__).'/../models/gltf2/models.md5sum');
2909
-		} else $error = "File ".$tmp_dir.'modelsgltf2.md5sum'." doesn't exist. Download failed.";
3588
+		} else {
3589
+			$error = "File ".$tmp_dir.'modelsgltf2.md5sum'." doesn't exist. Download failed.";
3590
+		}
2910 3591
 		if ($error != '') {
2911 3592
 			return $error;
2912
-		} elseif ($globalDebug) echo "Done\n";
3593
+		} elseif ($globalDebug) {
3594
+			echo "Done\n";
3595
+		}
2913 3596
 		return '';
2914 3597
 	}
2915 3598
 	public static function update_weather_models() {
2916 3599
 		global $tmp_dir, $globalDebug;
2917 3600
 		$error = '';
2918
-		if ($globalDebug) echo "Models from FlightAirMap website : Download...";
3601
+		if ($globalDebug) {
3602
+			echo "Models from FlightAirMap website : Download...";
3603
+		}
2919 3604
 		if (!is_writable(dirname(__FILE__).'/../models/gltf2/weather')) {
2920
-			if ($globalDebug) echo dirname(__FILE__).'/../models/gltf2/weather'.' is not writable !';
3605
+			if ($globalDebug) {
3606
+				echo dirname(__FILE__).'/../models/gltf2/weather'.' is not writable !';
3607
+			}
2921 3608
 			return '';
2922 3609
 		}
2923
-		if ($globalDebug) echo "Weather Models from FlightAirMap website : Download...";
3610
+		if ($globalDebug) {
3611
+			echo "Weather Models from FlightAirMap website : Download...";
3612
+		}
2924 3613
 		update_db::download('http://data.flightairmap.com/data/models/gltf2/weather/models.md5sum',$tmp_dir.'modelsweather.md5sum');
2925 3614
 		if (file_exists($tmp_dir.'modelsweather.md5sum')) {
2926
-			if ($globalDebug) echo "Check files...\n";
3615
+			if ($globalDebug) {
3616
+				echo "Check files...\n";
3617
+			}
2927 3618
 			$newmodelsdb = array();
2928 3619
 			if (($handle = fopen($tmp_dir.'modelsweather.md5sum','r')) !== FALSE) {
2929 3620
 				while (($row = fgetcsv($handle,1000," ")) !== FALSE) {
@@ -2942,25 +3633,35 @@  discard block
 block discarded – undo
2942 3633
 			}
2943 3634
 			$diff = array_diff($newmodelsdb,$modelsdb);
2944 3635
 			foreach ($diff as $key => $value) {
2945
-				if ($globalDebug) echo 'Downloading model '.$key.' ...'."\n";
3636
+				if ($globalDebug) {
3637
+					echo 'Downloading model '.$key.' ...'."\n";
3638
+				}
2946 3639
 				update_db::download('http://data.flightairmap.com/data/models/gltf2/weather/'.$key,dirname(__FILE__).'/../models/gltf2/weather/'.$key);
2947 3640
 				
2948 3641
 			}
2949 3642
 			update_db::download('http://data.flightairmap.com/data/models/gltf2/weather/models.md5sum',dirname(__FILE__).'/../models/gltf2/weather/models.md5sum');
2950
-		} else $error = "File ".$tmp_dir.'modelsweather.md5sum'." doesn't exist. Download failed.";
3643
+		} else {
3644
+			$error = "File ".$tmp_dir.'modelsweather.md5sum'." doesn't exist. Download failed.";
3645
+		}
2951 3646
 		if ($error != '') {
2952 3647
 			return $error;
2953
-		} elseif ($globalDebug) echo "Done\n";
3648
+		} elseif ($globalDebug) {
3649
+			echo "Done\n";
3650
+		}
2954 3651
 		return '';
2955 3652
 	}
2956 3653
 
2957 3654
 	public static function update_liveries() {
2958 3655
 		global $tmp_dir, $globalDebug;
2959 3656
 		$error = '';
2960
-		if ($globalDebug) echo "Liveries from FlightAirMap website : Download...";
3657
+		if ($globalDebug) {
3658
+			echo "Liveries from FlightAirMap website : Download...";
3659
+		}
2961 3660
 		update_db::download('http://data.flightairmap.com/data/models/gltf2/liveries/liveries.md5sum',$tmp_dir.'liveries.md5sum');
2962 3661
 		if (file_exists($tmp_dir.'liveries.md5sum')) {
2963
-			if ($globalDebug) echo "Check files...\n";
3662
+			if ($globalDebug) {
3663
+				echo "Check files...\n";
3664
+			}
2964 3665
 			$newmodelsdb = array();
2965 3666
 			if (($handle = fopen($tmp_dir.'liveries.md5sum','r')) !== FALSE) {
2966 3667
 				while (($row = fgetcsv($handle,1000," ")) !== FALSE) {
@@ -2979,15 +3680,21 @@  discard block
 block discarded – undo
2979 3680
 			}
2980 3681
 			$diff = array_diff($newmodelsdb,$modelsdb);
2981 3682
 			foreach ($diff as $key => $value) {
2982
-				if ($globalDebug) echo 'Downloading liveries '.$key.' ...'."\n";
3683
+				if ($globalDebug) {
3684
+					echo 'Downloading liveries '.$key.' ...'."\n";
3685
+				}
2983 3686
 				update_db::download('http://data.flightairmap.com/data/models/gltf2/liveries/'.$key,dirname(__FILE__).'/../models/gltf2/liveries/'.$key);
2984 3687
 				
2985 3688
 			}
2986 3689
 			update_db::download('http://data.flightairmap.com/data/models/gltf2/liveries/liveries.md5sum',dirname(__FILE__).'/../models/gltf2/liveries/liveries.md5sum');
2987
-		} else $error = "File ".$tmp_dir.'models.md5sum'." doesn't exist. Download failed.";
3690
+		} else {
3691
+			$error = "File ".$tmp_dir.'models.md5sum'." doesn't exist. Download failed.";
3692
+		}
2988 3693
 		if ($error != '') {
2989 3694
 			return $error;
2990
-		} elseif ($globalDebug) echo "Done\n";
3695
+		} elseif ($globalDebug) {
3696
+			echo "Done\n";
3697
+		}
2991 3698
 		return '';
2992 3699
 	}
2993 3700
 
@@ -2995,13 +3702,19 @@  discard block
 block discarded – undo
2995 3702
 		global $tmp_dir, $globalDebug;
2996 3703
 		$error = '';
2997 3704
 		if (!is_writable(dirname(__FILE__).'/../models')) {
2998
-			if ($globalDebug) echo dirname(__FILE__).'/../models'.' is not writable !';
3705
+			if ($globalDebug) {
3706
+				echo dirname(__FILE__).'/../models'.' is not writable !';
3707
+			}
2999 3708
 			return '';
3000 3709
 		}
3001
-		if ($globalDebug) echo "Space models from FlightAirMap website : Download...";
3710
+		if ($globalDebug) {
3711
+			echo "Space models from FlightAirMap website : Download...";
3712
+		}
3002 3713
 		update_db::download('http://data.flightairmap.com/data/models/space/space_models.md5sum',$tmp_dir.'space_models.md5sum');
3003 3714
 		if (file_exists($tmp_dir.'space_models.md5sum')) {
3004
-			if ($globalDebug) echo "Check files...\n";
3715
+			if ($globalDebug) {
3716
+				echo "Check files...\n";
3717
+			}
3005 3718
 			$newmodelsdb = array();
3006 3719
 			if (($handle = fopen($tmp_dir.'space_models.md5sum','r')) !== FALSE) {
3007 3720
 				while (($row = fgetcsv($handle,1000," ")) !== FALSE) {
@@ -3020,15 +3733,21 @@  discard block
 block discarded – undo
3020 3733
 			}
3021 3734
 			$diff = array_diff($newmodelsdb,$modelsdb);
3022 3735
 			foreach ($diff as $key => $value) {
3023
-				if ($globalDebug) echo 'Downloading space model '.$key.' ...'."\n";
3736
+				if ($globalDebug) {
3737
+					echo 'Downloading space model '.$key.' ...'."\n";
3738
+				}
3024 3739
 				update_db::download('http://data.flightairmap.com/data/models/space/'.$key,dirname(__FILE__).'/../models/space/'.$key);
3025 3740
 				
3026 3741
 			}
3027 3742
 			update_db::download('http://data.flightairmap.com/data/models/space/space_models.md5sum',dirname(__FILE__).'/../models/space/space_models.md5sum');
3028
-		} else $error = "File ".$tmp_dir.'models.md5sum'." doesn't exist. Download failed.";
3743
+		} else {
3744
+			$error = "File ".$tmp_dir.'models.md5sum'." doesn't exist. Download failed.";
3745
+		}
3029 3746
 		if ($error != '') {
3030 3747
 			return $error;
3031
-		} elseif ($globalDebug) echo "Done\n";
3748
+		} elseif ($globalDebug) {
3749
+			echo "Done\n";
3750
+		}
3032 3751
 		return '';
3033 3752
 	}
3034 3753
 
@@ -3036,13 +3755,19 @@  discard block
 block discarded – undo
3036 3755
 		global $tmp_dir, $globalDebug;
3037 3756
 		$error = '';
3038 3757
 		if (!is_writable(dirname(__FILE__).'/../models/vehicules')) {
3039
-			if ($globalDebug) echo dirname(__FILE__).'/../models/vehicules'.' is not writable !';
3758
+			if ($globalDebug) {
3759
+				echo dirname(__FILE__).'/../models/vehicules'.' is not writable !';
3760
+			}
3040 3761
 			return '';
3041 3762
 		}
3042
-		if ($globalDebug) echo "Vehicules models from FlightAirMap website : Download...";
3763
+		if ($globalDebug) {
3764
+			echo "Vehicules models from FlightAirMap website : Download...";
3765
+		}
3043 3766
 		update_db::download('http://data.flightairmap.com/data/models/vehicules/vehicules_models.md5sum',$tmp_dir.'vehicules_models.md5sum');
3044 3767
 		if (file_exists($tmp_dir.'vehicules_models.md5sum')) {
3045
-			if ($globalDebug) echo "Check files...\n";
3768
+			if ($globalDebug) {
3769
+				echo "Check files...\n";
3770
+			}
3046 3771
 			$newmodelsdb = array();
3047 3772
 			if (($handle = fopen($tmp_dir.'vehicules_models.md5sum','r')) !== FALSE) {
3048 3773
 				while (($row = fgetcsv($handle,1000," ")) !== FALSE) {
@@ -3061,15 +3786,21 @@  discard block
 block discarded – undo
3061 3786
 			}
3062 3787
 			$diff = array_diff($newmodelsdb,$modelsdb);
3063 3788
 			foreach ($diff as $key => $value) {
3064
-				if ($globalDebug) echo 'Downloading vehicules model '.$key.' ...'."\n";
3789
+				if ($globalDebug) {
3790
+					echo 'Downloading vehicules model '.$key.' ...'."\n";
3791
+				}
3065 3792
 				update_db::download('http://data.flightairmap.com/data/models/vehicules/'.$key,dirname(__FILE__).'/../models/vehicules/'.$key);
3066 3793
 				
3067 3794
 			}
3068 3795
 			update_db::download('http://data.flightairmap.com/data/models/vehicules/vehicules_models.md5sum',dirname(__FILE__).'/../models/vehicules/vehicules_models.md5sum');
3069
-		} else $error = "File ".$tmp_dir.'models.md5sum'." doesn't exist. Download failed.";
3796
+		} else {
3797
+			$error = "File ".$tmp_dir.'models.md5sum'." doesn't exist. Download failed.";
3798
+		}
3070 3799
 		if ($error != '') {
3071 3800
 			return $error;
3072
-		} elseif ($globalDebug) echo "Done\n";
3801
+		} elseif ($globalDebug) {
3802
+			echo "Done\n";
3803
+		}
3073 3804
 		return '';
3074 3805
 	}
3075 3806
 
@@ -3142,7 +3873,9 @@  discard block
 block discarded – undo
3142 3873
                 }
3143 3874
 
3144 3875
 		$error = '';
3145
-		if ($globalDebug) echo "Notam : Download...";
3876
+		if ($globalDebug) {
3877
+			echo "Notam : Download...";
3878
+		}
3146 3879
 		update_db::download($globalNOTAMSource,$tmp_dir.'notam.rss');
3147 3880
 		if (file_exists($tmp_dir.'notam.rss')) {
3148 3881
 			$notams = json_decode(json_encode(simplexml_load_file($tmp_dir.'notam.rss')),true);
@@ -3157,14 +3890,30 @@  discard block
 block discarded – undo
3157 3890
 				$data['fir'] = $q[0];
3158 3891
 				$data['code'] = $q[1];
3159 3892
 				$ifrvfr = $q[2];
3160
-				if ($ifrvfr == 'IV') $data['rules'] = 'IFR/VFR';
3161
-				if ($ifrvfr == 'I') $data['rules'] = 'IFR';
3162
-				if ($ifrvfr == 'V') $data['rules'] = 'VFR';
3163
-				if ($q[4] == 'A') $data['scope'] = 'Airport warning';
3164
-				if ($q[4] == 'E') $data['scope'] = 'Enroute warning';
3165
-				if ($q[4] == 'W') $data['scope'] = 'Navigation warning';
3166
-				if ($q[4] == 'AE') $data['scope'] = 'Airport/Enroute warning';
3167
-				if ($q[4] == 'AW') $data['scope'] = 'Airport/Navigation warning';
3893
+				if ($ifrvfr == 'IV') {
3894
+					$data['rules'] = 'IFR/VFR';
3895
+				}
3896
+				if ($ifrvfr == 'I') {
3897
+					$data['rules'] = 'IFR';
3898
+				}
3899
+				if ($ifrvfr == 'V') {
3900
+					$data['rules'] = 'VFR';
3901
+				}
3902
+				if ($q[4] == 'A') {
3903
+					$data['scope'] = 'Airport warning';
3904
+				}
3905
+				if ($q[4] == 'E') {
3906
+					$data['scope'] = 'Enroute warning';
3907
+				}
3908
+				if ($q[4] == 'W') {
3909
+					$data['scope'] = 'Navigation warning';
3910
+				}
3911
+				if ($q[4] == 'AE') {
3912
+					$data['scope'] = 'Airport/Enroute warning';
3913
+				}
3914
+				if ($q[4] == 'AW') {
3915
+					$data['scope'] = 'Airport/Navigation warning';
3916
+				}
3168 3917
 				//$data['scope'] = $q[4];
3169 3918
 				$data['lower_limit'] = $q[5];
3170 3919
 				$data['upper_limit'] = $q[6];
@@ -3172,8 +3921,12 @@  discard block
 block discarded – undo
3172 3921
 				sscanf($latlonrad,'%4c%c%5c%c%3d',$las,$lac,$lns,$lnc,$radius);
3173 3922
 				$latitude = $Common->convertDec($las,'latitude');
3174 3923
 				$longitude = $Common->convertDec($lns,'longitude');
3175
-				if ($lac == 'S') $latitude = '-'.$latitude;
3176
-				if ($lnc == 'W') $longitude = '-'.$longitude;
3924
+				if ($lac == 'S') {
3925
+					$latitude = '-'.$latitude;
3926
+				}
3927
+				if ($lnc == 'W') {
3928
+					$longitude = '-'.$longitude;
3929
+				}
3177 3930
 				$data['center_latitude'] = $latitude;
3178 3931
 				$data['center_longitude'] = $longitude;
3179 3932
 				$data['radius'] = intval($radius);
@@ -3203,10 +3956,14 @@  discard block
 block discarded – undo
3203 3956
 				$NOTAM->addNOTAM($data['ref'],$data['title'],'',$data['fir'],$data['code'],'',$data['scope'],$data['lower_limit'],$data['upper_limit'],$data['center_latitude'],$data['center_longitude'],$data['radius'],$data['date_begin'],$data['date_end'],$data['permanent'],$data['text'],$data['full_notam']);
3204 3957
 				unset($data);
3205 3958
 			} 
3206
-		} else $error = "File ".$tmp_dir.'notam.rss'." doesn't exist. Download failed.";
3959
+		} else {
3960
+			$error = "File ".$tmp_dir.'notam.rss'." doesn't exist. Download failed.";
3961
+		}
3207 3962
 		if ($error != '') {
3208 3963
 			return $error;
3209
-		} elseif ($globalDebug) echo "Done\n";
3964
+		} elseif ($globalDebug) {
3965
+			echo "Done\n";
3966
+		}
3210 3967
 		return '';
3211 3968
 	}
3212 3969
 	
@@ -3231,7 +3988,9 @@  discard block
 block discarded – undo
3231 3988
 		$airspace_lst = $Common->getData('https://raw.githubusercontent.com/XCSoar/xcsoar-data-repository/master/data/airspace.json');
3232 3989
 		$airspace_json = json_decode($airspace_lst,true);
3233 3990
 		foreach ($airspace_json['records'] as $airspace) {
3234
-			if ($globalDebug) echo $airspace['name']."...\n";
3991
+			if ($globalDebug) {
3992
+				echo $airspace['name']."...\n";
3993
+			}
3235 3994
 			update_db::download($airspace['uri'],$tmp_dir.$airspace['name']);
3236 3995
 			if (file_exists($tmp_dir.$airspace['name'])) {
3237 3996
 				file_put_contents($tmp_dir.$airspace['name'], utf8_encode(file_get_contents($tmp_dir.$airspace['name'])));
@@ -3275,8 +4034,11 @@  discard block
 block discarded – undo
3275 4034
                         return "error : ".$e->getMessage();
3276 4035
                 }
3277 4036
                 $row = $sth->fetch(PDO::FETCH_ASSOC);
3278
-                if ($row['nb'] > 0) return false;
3279
-                else return true;
4037
+                if ($row['nb'] > 0) {
4038
+                	return false;
4039
+                } else {
4040
+                	return true;
4041
+                }
3280 4042
 	}
3281 4043
 
3282 4044
 	public static function insert_last_update() {
@@ -3301,8 +4063,11 @@  discard block
 block discarded – undo
3301 4063
                         return "error : ".$e->getMessage();
3302 4064
                 }
3303 4065
                 $row = $sth->fetch(PDO::FETCH_ASSOC);
3304
-                if ($row['nb'] > 0) return true;
3305
-                else return false;
4066
+                if ($row['nb'] > 0) {
4067
+                	return true;
4068
+                } else {
4069
+                	return false;
4070
+                }
3306 4071
 	}
3307 4072
 
3308 4073
 	public static function check_geoid_version($version) {
@@ -3315,8 +4080,11 @@  discard block
 block discarded – undo
3315 4080
                         return "error : ".$e->getMessage();
3316 4081
                 }
3317 4082
                 $row = $sth->fetch(PDO::FETCH_ASSOC);
3318
-                if ($row['nb'] > 0) return true;
3319
-                else return false;
4083
+                if ($row['nb'] > 0) {
4084
+                	return true;
4085
+                } else {
4086
+                	return false;
4087
+                }
3320 4088
 	}
3321 4089
 
3322 4090
 	public static function check_marine_identity_version($version) {
@@ -3329,8 +4097,11 @@  discard block
 block discarded – undo
3329 4097
 			return "error : ".$e->getMessage();
3330 4098
 		}
3331 4099
 		$row = $sth->fetch(PDO::FETCH_ASSOC);
3332
-		if ($row['nb'] > 0) return true;
3333
-		else return false;
4100
+		if ($row['nb'] > 0) {
4101
+			return true;
4102
+		} else {
4103
+			return false;
4104
+		}
3334 4105
 	}
3335 4106
 
3336 4107
 	public static function check_satellite_version($version) {
@@ -3343,8 +4114,11 @@  discard block
 block discarded – undo
3343 4114
 			return "error : ".$e->getMessage();
3344 4115
 		}
3345 4116
 		$row = $sth->fetch(PDO::FETCH_ASSOC);
3346
-		if ($row['nb'] > 0) return true;
3347
-		else return false;
4117
+		if ($row['nb'] > 0) {
4118
+			return true;
4119
+		} else {
4120
+			return false;
4121
+		}
3348 4122
 	}
3349 4123
 	public static function check_diagrams_version($version) {
3350 4124
 		$query = "SELECT COUNT(*) as nb FROM config WHERE name = 'diagrams_version' AND value = :version";
@@ -3356,8 +4130,11 @@  discard block
 block discarded – undo
3356 4130
 			return "error : ".$e->getMessage();
3357 4131
 		}
3358 4132
 		$row = $sth->fetch(PDO::FETCH_ASSOC);
3359
-		if ($row['nb'] > 0) return true;
3360
-		else return false;
4133
+		if ($row['nb'] > 0) {
4134
+			return true;
4135
+		} else {
4136
+			return false;
4137
+		}
3361 4138
 	}
3362 4139
 
3363 4140
 	public static function check_airlines_version($version) {
@@ -3370,8 +4147,11 @@  discard block
 block discarded – undo
3370 4147
 			return "error : ".$e->getMessage();
3371 4148
 		}
3372 4149
 		$row = $sth->fetch(PDO::FETCH_ASSOC);
3373
-		if ($row['nb'] > 0) return true;
3374
-		else return false;
4150
+		if ($row['nb'] > 0) {
4151
+			return true;
4152
+		} else {
4153
+			return false;
4154
+		}
3375 4155
 	}
3376 4156
 
3377 4157
 	public static function check_notam_version($version) {
@@ -3384,8 +4164,11 @@  discard block
 block discarded – undo
3384 4164
 			return "error : ".$e->getMessage();
3385 4165
 		}
3386 4166
 		$row = $sth->fetch(PDO::FETCH_ASSOC);
3387
-		if ($row['nb'] > 0) return true;
3388
-		else return false;
4167
+		if ($row['nb'] > 0) {
4168
+			return true;
4169
+		} else {
4170
+			return false;
4171
+		}
3389 4172
 	}
3390 4173
 
3391 4174
 	public static function insert_airlines_version($version) {
@@ -3486,8 +4269,11 @@  discard block
 block discarded – undo
3486 4269
                         return "error : ".$e->getMessage();
3487 4270
                 }
3488 4271
                 $row = $sth->fetch(PDO::FETCH_ASSOC);
3489
-                if ($row['nb'] > 0) return false;
3490
-                else return true;
4272
+                if ($row['nb'] > 0) {
4273
+                	return false;
4274
+                } else {
4275
+                	return true;
4276
+                }
3491 4277
 	}
3492 4278
 
3493 4279
 	public static function insert_last_notam_update() {
@@ -3517,8 +4303,11 @@  discard block
 block discarded – undo
3517 4303
                         return "error : ".$e->getMessage();
3518 4304
                 }
3519 4305
                 $row = $sth->fetch(PDO::FETCH_ASSOC);
3520
-                if ($row['nb'] > 0) return false;
3521
-                else return true;
4306
+                if ($row['nb'] > 0) {
4307
+                	return false;
4308
+                } else {
4309
+                	return true;
4310
+                }
3522 4311
 	}
3523 4312
 
3524 4313
 	public static function insert_last_airspace_update() {
@@ -3548,8 +4337,11 @@  discard block
 block discarded – undo
3548 4337
                         return "error : ".$e->getMessage();
3549 4338
                 }
3550 4339
                 $row = $sth->fetch(PDO::FETCH_ASSOC);
3551
-                if ($row['nb'] > 0) return false;
3552
-                else return true;
4340
+                if ($row['nb'] > 0) {
4341
+                	return false;
4342
+                } else {
4343
+                	return true;
4344
+                }
3553 4345
 	}
3554 4346
 
3555 4347
 	public static function insert_last_geoid_update() {
@@ -3579,8 +4371,11 @@  discard block
 block discarded – undo
3579 4371
 			return "error : ".$e->getMessage();
3580 4372
 		}
3581 4373
 		$row = $sth->fetch(PDO::FETCH_ASSOC);
3582
-		if ($row['nb'] > 0) return false;
3583
-		else return true;
4374
+		if ($row['nb'] > 0) {
4375
+			return false;
4376
+		} else {
4377
+			return true;
4378
+		}
3584 4379
 	}
3585 4380
 
3586 4381
 	public static function insert_last_owner_update() {
@@ -3610,8 +4405,11 @@  discard block
 block discarded – undo
3610 4405
 			return "error : ".$e->getMessage();
3611 4406
 		}
3612 4407
 		$row = $sth->fetch(PDO::FETCH_ASSOC);
3613
-		if ($row['nb'] > 0) return false;
3614
-		else return true;
4408
+		if ($row['nb'] > 0) {
4409
+			return false;
4410
+		} else {
4411
+			return true;
4412
+		}
3615 4413
 	}
3616 4414
 
3617 4415
 	public static function insert_last_fires_update() {
@@ -3641,8 +4439,11 @@  discard block
 block discarded – undo
3641 4439
 			return "error : ".$e->getMessage();
3642 4440
 		}
3643 4441
 		$row = $sth->fetch(PDO::FETCH_ASSOC);
3644
-		if ($row['nb'] > 0) return false;
3645
-		else return true;
4442
+		if ($row['nb'] > 0) {
4443
+			return false;
4444
+		} else {
4445
+			return true;
4446
+		}
3646 4447
 	}
3647 4448
 
3648 4449
 	public static function insert_last_airlines_update() {
@@ -3672,8 +4473,11 @@  discard block
 block discarded – undo
3672 4473
                         return "error : ".$e->getMessage();
3673 4474
                 }
3674 4475
                 $row = $sth->fetch(PDO::FETCH_ASSOC);
3675
-                if ($row['nb'] > 0) return false;
3676
-                else return true;
4476
+                if ($row['nb'] > 0) {
4477
+                	return false;
4478
+                } else {
4479
+                	return true;
4480
+                }
3677 4481
 	}
3678 4482
 
3679 4483
 	public static function insert_last_schedules_update() {
@@ -3703,8 +4507,11 @@  discard block
 block discarded – undo
3703 4507
 			return "error : ".$e->getMessage();
3704 4508
 		}
3705 4509
 		$row = $sth->fetch(PDO::FETCH_ASSOC);
3706
-		if ($row['nb'] > 0) return false;
3707
-		else return true;
4510
+		if ($row['nb'] > 0) {
4511
+			return false;
4512
+		} else {
4513
+			return true;
4514
+		}
3708 4515
 	}
3709 4516
 
3710 4517
 	public static function insert_last_tle_update() {
@@ -3734,8 +4541,11 @@  discard block
 block discarded – undo
3734 4541
 			return "error : ".$e->getMessage();
3735 4542
 		}
3736 4543
 		$row = $sth->fetch(PDO::FETCH_ASSOC);
3737
-		if ($row['nb'] > 0) return false;
3738
-		else return true;
4544
+		if ($row['nb'] > 0) {
4545
+			return false;
4546
+		} else {
4547
+			return true;
4548
+		}
3739 4549
 	}
3740 4550
 
3741 4551
 	public static function insert_last_ucsdb_update() {
@@ -3765,8 +4575,11 @@  discard block
 block discarded – undo
3765 4575
 			return "error : ".$e->getMessage();
3766 4576
 		}
3767 4577
 		$row = $sth->fetch(PDO::FETCH_ASSOC);
3768
-		if ($row['nb'] > 0) return false;
3769
-		else return true;
4578
+		if ($row['nb'] > 0) {
4579
+			return false;
4580
+		} else {
4581
+			return true;
4582
+		}
3770 4583
 	}
3771 4584
 
3772 4585
 	public static function insert_last_celestrak_update() {
@@ -3796,8 +4609,11 @@  discard block
 block discarded – undo
3796 4609
 			return "error : ".$e->getMessage();
3797 4610
 		}
3798 4611
 		$row = $sth->fetch(PDO::FETCH_ASSOC);
3799
-		if ($row['nb'] > 0) return false;
3800
-		else return true;
4612
+		if ($row['nb'] > 0) {
4613
+			return false;
4614
+		} else {
4615
+			return true;
4616
+		}
3801 4617
 	}
3802 4618
 
3803 4619
 	public static function check_last_satellite_update() {
@@ -3815,8 +4631,11 @@  discard block
 block discarded – undo
3815 4631
 			return "error : ".$e->getMessage();
3816 4632
 		}
3817 4633
 		$row = $sth->fetch(PDO::FETCH_ASSOC);
3818
-		if ($row['nb'] > 0) return false;
3819
-		else return true;
4634
+		if ($row['nb'] > 0) {
4635
+			return false;
4636
+		} else {
4637
+			return true;
4638
+		}
3820 4639
 	}
3821 4640
 
3822 4641
 	public static function insert_last_marine_identity_update() {
Please login to merge, or discard this patch.
index.php 3 patches
Indentation   +108 added lines, -108 removed lines patch added patch discarded remove patch
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
     <?php }; if (isset($globalSatellite) && $globalSatellite) { ?><td><div id="ibxsatellite"><h4><?php echo _("Satellites Displayed"); ?></h4><br /><i class="fa fa-spinner fa-pulse fa-fw"></i></div></td><?php } ?>
56 56
 </tr></table></div>
57 57
 <?php
58
-    if ((!isset($_COOKIE['MapFormat']) && isset($globalMap3Ddefault) && $globalMap3Ddefault) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d')) {
58
+	if ((!isset($_COOKIE['MapFormat']) && isset($globalMap3Ddefault) && $globalMap3Ddefault) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d')) {
59 59
 ?>
60 60
 <script src="<?php echo $globalURL; ?>/js/map.3d.js.php<?php if (isset($tsk)) print '?tsk='.$tsk; ?>"></script>
61 61
 <script src="<?php echo $globalURL; ?>/js/meuusjs.1.0.3.min.js"></script>
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
 <script src="<?php echo $globalURL; ?>/js/map-marine.3d.js.php"></script>
82 82
 <?php
83 83
 	}
84
-    }
84
+	}
85 85
 ?>
86 86
 
87 87
 <div id="sidebar" class="sidebar collapsed">
@@ -92,13 +92,13 @@  discard block
 block discarded – undo
92 92
 	<li><a href="" onclick="getUserLocation(); return false;" title="<?php echo _("Plot your Location"); ?>"><i class="fa fa-map-marker"></i></a></li>
93 93
 	<li><a href="" onclick="getCompassDirection(); return false;" title="<?php echo _("Compass Mode"); ?>"><i class="fa fa-compass"></i></a></li>
94 94
 <?php
95
-    //if ((isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d') || (isset($globalBeta) && $globalBeta === TRUE)) {
95
+	//if ((isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d') || (isset($globalBeta) && $globalBeta === TRUE)) {
96 96
 	if (isset($globalArchive) && $globalArchive == TRUE && (!isset($globalAircraft) || $globalAircraft === TRUE)) {
97 97
 ?>
98 98
 	<li><a href="#archive" role="tab" title="<?php echo _("Archive"); ?>"><i class="fa fa-archive"></i></a></li>
99 99
 <?php
100 100
 	}
101
-    //}
101
+	//}
102 102
 ?>
103 103
 	<li><a href="#home" role="tab" title="<?php echo _("Layers"); ?>"><i class="fa fa-map"></i></a></li>
104 104
 	<li><a href="#filters" role="tab" title="<?php echo _("Filters"); ?>"><i class="fa fa-filter"></i></a></li>
@@ -112,7 +112,7 @@  discard block
 block discarded – undo
112 112
 ?>
113 113
 
114 114
 <?php
115
-    if (isset($globalMap3D) && $globalMap3D) {
115
+	if (isset($globalMap3D) && $globalMap3D) {
116 116
 	if ((!isset($_COOKIE['MapFormat']) && (!isset($globalMap3Ddefault) || !$globalMap3Ddefault)) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] != '3d')) {
117 117
 ?>
118 118
 	<li><a href="" onclick="show3D(); return false;" role="tab" title="3D"><b>3D</b></a></li>
@@ -122,7 +122,7 @@  discard block
 block discarded – undo
122 122
 	<li><a href="" onclick="show2D(); return false;" role="tab" title="2D"><b>2D</b></a></li>
123 123
 <?php
124 124
 	}
125
-    }
125
+	}
126 126
 ?>
127 127
     </ul>
128 128
 
@@ -306,15 +306,15 @@  discard block
 block discarded – undo
306 306
 		    </div>
307 307
 		</li>
308 308
 		<?php
309
-		    if (isset($globalDemo) && $globalDemo) {
309
+			if (isset($globalDemo) && $globalDemo) {
310 310
 		?>
311 311
 		<li><button type="button" class="btn btn-primary disabled"><?php echo _("Show archive"); ?></button> Disabled in Demo mode</li>
312 312
 		<?php
313
-		    } else {
313
+			} else {
314 314
 		?>
315 315
 		<li><button type="button" onclick="addarchive(begindate,enddate);" class="btn btn-primary"><?php echo _("Show archive"); ?></button></li>
316 316
 		<?php
317
-		    }
317
+			}
318 318
 		?>
319 319
 	    </ul>
320 320
 	    <ul>
@@ -333,82 +333,82 @@  discard block
 block discarded – undo
333 333
 				if ((!isset($_COOKIE['MapFormat']) && (!isset($globalMap3Ddefault) || !$globalMap3Ddefault)) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] != '3d')) {
334 334
 					if (!isset($_COOKIE['MapType']) || $_COOKIE['MapType'] == '') $MapType = $globalMapProvider;
335 335
 					else $MapType = $_COOKIE['MapType'];
336
-			    ?>
336
+				?>
337 337
 			<select  class="selectpicker" onchange="mapType(this);">
338 338
 			    <?php
339 339
 				} else {
340 340
 					if (!isset($_COOKIE['MapType3D']) || $_COOKIE['MapType3D'] == '') $MapType = $globalMapProvider;
341 341
 					else $MapType = $_COOKIE['MapType3D'];
342
-			    ?>
342
+				?>
343 343
 			<select  class="selectpicker" onchange="mapType3D(this);">
344 344
 			    <?php
345 345
 				}
346
-			    ?>
346
+				?>
347 347
 			    <?php
348 348
 				if (isset($globalMapOffline) && $globalMapOffline === TRUE) {
349
-			    ?>
349
+				?>
350 350
 			    <option value="offline"<?php if ($MapType == 'offline') print ' selected'; ?>>Natural Earth (local)</option>
351 351
 			    <?php
352 352
 				} else {
353
-				    if (file_exists(dirname(__FILE__).'/js/Cesium/Assets/Textures/NaturalEarthII/tilemapresource.xml')) {
354
-			    ?>
353
+					if (file_exists(dirname(__FILE__).'/js/Cesium/Assets/Textures/NaturalEarthII/tilemapresource.xml')) {
354
+				?>
355 355
 			    <option value="offline"<?php if ($MapType == 'offline') print ' selected'; ?>>Natural Earth (local)</option>
356 356
 			    <?php
357
-				    }
358
-			    ?>
357
+					}
358
+				?>
359 359
 			    <option value="ArcGIS-Streetmap"<?php if ($MapType == 'ArcGIS-Streetmap') print ' selected'; ?>>ArcGIS Streetmap</option>
360 360
 			    <option value="ArcGIS-Satellite"<?php if ($MapType == 'ArcGIS-Satellite') print ' selected'; ?>>ArcGIS Satellite</option>
361 361
 			    <option value="ArcGIS-Satellite"<?php if ($MapType == 'ArcGIS-Ocean') print ' selected'; ?>>ArcGIS Ocean</option>
362 362
 			    <?php
363
-				    if (isset($globalBingMapKey) && $globalBingMapKey != '') {
364
-			    ?>
363
+					if (isset($globalBingMapKey) && $globalBingMapKey != '') {
364
+				?>
365 365
 			    <option value="Bing-Aerial"<?php if ($MapType == 'Bing-Aerial') print ' selected'; ?>>Bing-Aerial</option>
366 366
 			    <option value="Bing-Hybrid"<?php if ($MapType == 'Bing-Hybrid') print ' selected'; ?>>Bing-Hybrid</option>
367 367
 			    <option value="Bing-Road"<?php if ($MapType == 'Bing-Road') print ' selected'; ?>>Bing-Road</option>
368 368
 			    <?php
369
-				    }
370
-			    ?>
369
+					}
370
+				?>
371 371
 			    <?php
372
-				    if ((!isset($_COOKIE['MapFormat']) && (!isset($globalMap3Ddefault) || !$globalMap3Ddefault)) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] != '3d')) {
373
-			    ?>
372
+					if ((!isset($_COOKIE['MapFormat']) && (!isset($globalMap3Ddefault) || !$globalMap3Ddefault)) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] != '3d')) {
373
+				?>
374 374
 			    <?php
375 375
 					if (isset($globalHereappId) && $globalHereappId != '' && isset($globalHereappCode) && $globalHereappCode != '') {
376
-			    ?>
376
+				?>
377 377
 			    <option value="Here-Aerial"<?php if ($MapType == 'Here-Aerial') print ' selected'; ?>>Here-Aerial</option>
378 378
 			    <option value="Here-Hybrid"<?php if ($MapType == 'Here-Hybrid') print ' selected'; ?>>Here-Hybrid</option>
379 379
 			    <option value="Here-Road"<?php if ($MapType == 'Here-Road') print ' selected'; ?>>Here-Road</option>
380 380
 			    <?php
381 381
 					}
382
-			    ?>
382
+				?>
383 383
 			    <?php
384 384
 					if (isset($globalGoogleAPIKey) && $globalGoogleAPIKey != '') {
385
-			    ?>
385
+				?>
386 386
 			    <option value="Google-Roadmap"<?php if ($MapType == 'Google-Roadmap') print ' selected'; ?>>Google Roadmap</option>
387 387
 			    <option value="Google-Satellite"<?php if ($MapType == 'Google-Satellite') print ' selected'; ?>>Google Satellite</option>
388 388
 			    <option value="Google-Hybrid"<?php if ($MapType == 'Google-Hybrid') print ' selected'; ?>>Google Hybrid</option>
389 389
 			    <option value="Google-Terrain"<?php if ($MapType == 'Google-Terrain') print ' selected'; ?>>Google Terrain</option>
390 390
 			    <?php
391 391
 					}
392
-			    ?>
392
+				?>
393 393
 			    <?php
394 394
 					if (isset($globalMapQuestKey) && $globalMapQuestKey != '') {
395
-			    ?>
395
+				?>
396 396
 			    <option value="MapQuest-OSM"<?php if ($MapType == 'MapQuest-OSM') print ' selected'; ?>>MapQuest-OSM</option>
397 397
 			    <option value="MapQuest-Aerial"<?php if ($MapType == 'MapQuest-Aerial') print ' selected'; ?>>MapQuest-Aerial</option>
398 398
 			    <option value="MapQuest-Hybrid"<?php if ($MapType == 'MapQuest-Hybrid') print ' selected'; ?>>MapQuest-Hybrid</option>
399 399
 			    <?php
400 400
 					}
401
-			    ?>
401
+				?>
402 402
 			    <option value="offline"<?php if ($MapType == 'offline') print ' selected'; ?>>Natural Earth</option>
403 403
 			    <?php
404
-				    }
405
-			    ?>
404
+					}
405
+				?>
406 406
 			    <option value="NatGeo-Street"<?php if ($MapType == 'NatGeo-Street') print ' selected'; ?>>National Geographic Street</option>
407 407
 			    <?php
408
-				    if (isset($globalMapboxToken) && $globalMapboxToken != '') {
408
+					if (isset($globalMapboxToken) && $globalMapboxToken != '') {
409 409
 					if (!isset($_COOKIE['MapTypeId'])) $MapBoxId = 'default';
410 410
 					else $MapBoxId = $_COOKIE['MapTypeId'];
411
-			    ?>
411
+				?>
412 412
 			    <option value="MapboxGL"<?php if ($MapType == 'MapboxGL') print ' selected'; ?>>Mapbox GL</option>
413 413
 			    <option value="Mapbox-default"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'default') print ' selected'; ?>>Mapbox default</option>
414 414
 			    <option value="Mapbox-mapbox.streets"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.streets') print ' selected'; ?>>Mapbox streets</option>
@@ -423,17 +423,17 @@  discard block
 block discarded – undo
423 423
 			    <option value="Mapbox-mapbox.pirates"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.pirates') print ' selected'; ?>>Mapbox pirates</option>
424 424
 			    <option value="Mapbox-mapbox.emerald"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.emerald') print ' selected'; ?>>Mapbox emerald</option>
425 425
 			    <?php
426
-				    }
427
-			    ?>
426
+					}
427
+				?>
428 428
 			    <option value="OpenStreetMap"<?php if ($MapType == 'OpenStreetMap') print ' selected'; ?>>OpenStreetMap</option>
429 429
 			    <option value="Yandex"<?php if ($MapType == 'Yandex') print ' selected'; ?>>Yandex</option>
430 430
 			    <?php
431 431
 				}
432
-			    ?>
432
+				?>
433 433
 			</select>
434 434
 		    </li>
435 435
 <?php
436
-    if (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d' && (!isset($globalMapOffline) || $globalMapOffline === FALSE)) {
436
+	if (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d' && (!isset($globalMapOffline) || $globalMapOffline === FALSE)) {
437 437
 ?>
438 438
 		    <li><?php echo _("Type of Terrain:"); ?>
439 439
 			<select  class="selectpicker" onchange="terrainType(this);">
@@ -444,18 +444,18 @@  discard block
 block discarded – undo
444 444
 			</select>
445 445
 		    </li>
446 446
 <?php
447
-    }
447
+	}
448 448
 ?>
449 449
 
450 450
 <?php
451
-    if (isset($globalMap3D) && $globalMap3D) {
451
+	if (isset($globalMap3D) && $globalMap3D) {
452 452
 ?>
453 453
 		    <li><div class="checkbox"><label><input type="checkbox" name="synchro2d3d" value="1" onclick="clickSyncMap2D3D(this)" <?php if (isset($_COOKIE['Map2D3DSync']) && $_COOKIE['Map2D3DSync'] == 'true') print 'checked'; ?> ><?php echo _("Use same type of map for 2D & 3D"); ?></label></div></li>
454 454
 <?php
455
-    }
455
+	}
456 456
 ?>
457 457
 <?php
458
-    if (!isset($_COOKIE['MapFormat']) || $_COOKIE['MapFormat'] != '3d') {
458
+	if (!isset($_COOKIE['MapFormat']) || $_COOKIE['MapFormat'] != '3d') {
459 459
 ?>
460 460
 		    <li><div class="checkbox"><label><input type="checkbox" name="display2dbuildings" value="1" onclick="clickDisplay2DBuildings(this)" <?php if (isset($_COOKIE['Map2DBuildings']) && $_COOKIE['Map2DBuildings'] == 'true') print 'checked'; ?> ><?php echo _("Display 2.5D buidings on map"); ?></label></div></li>
461 461
 
@@ -478,12 +478,12 @@  discard block
 block discarded – undo
478 478
 		    <li><div class="checkbox"><label><input type="checkbox" name="satelliteestimation" value="1" onclick="clickSatelliteEstimation(this)" <?php if ((isset($_COOKIE['satelliteestimation']) && $_COOKIE['satelliteestimation'] == 'true') || (!isset($_COOKIE['satelliteestimation']) && !isset($globalMapEstimation)) || (!isset($_COOKIE['satelliteestimation']) && isset($globalMapEstimation) && $globalMapEstimation)) print 'checked'; ?> ><?php echo _("Satellites animate between updates"); ?></label></div></li>
479 479
 <?php
480 480
 	}
481
-    }
482
-    if (!isset($globalAircraft) || $globalAircraft === TRUE) {
481
+	}
482
+	if (!isset($globalAircraft) || $globalAircraft === TRUE) {
483 483
 ?>
484 484
 		    <li><div class="checkbox"><label><input type="checkbox" name="displayairports" value="1" onclick="clickDisplayAirports(this)" <?php if (isset($_COOKIE['displayairports']) && $_COOKIE['displayairports'] == 'true' || !isset($_COOKIE['displayairports'])) print 'checked'; ?> ><?php echo _("Display airports on map"); ?></label></div></li>
485 485
 <?php
486
-    }
486
+	}
487 487
 ?>
488 488
 		    <li><div class="checkbox"><label><input type="checkbox" name="displaygroundstation" value="1" onclick="clickDisplayGroundStation(this)" <?php if ((isset($_COOKIE['show_GroundStation']) && $_COOKIE['show_GroundStation'] == 'true') || (!isset($_COOKIE['show_GroundStation']) && (isset($globalMapGroundStation) && $globalMapGroundStation === TRUE))) print 'checked'; ?> ><?php echo _("Display ground station on map"); ?></label></div></li>
489 489
 		    <li><div class="checkbox"><label><input type="checkbox" name="displayweatherstation" value="1" onclick="clickDisplayWeatherStation(this)" <?php if ((isset($_COOKIE['show_WeatherStation']) && $_COOKIE['show_WeatherStation'] == 'true') || (!isset($_COOKIE['show_WeatherStation']) && (isset($globalMapWeatherStation) && $globalMapWeatherStation === TRUE))) print 'checked'; ?> ><?php echo _("Display weather station on map"); ?></label></div></li>
@@ -502,88 +502,88 @@  discard block
 block discarded – undo
502 502
 ?>
503 503
 		    <li><div class="checkbox"><label><input type="checkbox" name="truelight" value="1" onclick="clickTrueLight(this)" <?php if ((!isset($_COOKIE['truelight']) && (!isset($globalMapTrueLight) || $globalMapTrueLight)) || (isset($_COOKIE['truelight']) && $_COOKIE['truelight'] == 'true')) print 'checked'; ?> ><?php echo _("Enable globe sun lighting"); ?></label></div></li>
504 504
 <?php
505
-    if (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d') {
505
+	if (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d') {
506 506
 ?>
507 507
 		    <li><div class="checkbox"><label><input type="checkbox" name="displayminimap" value="1" onclick="clickDisplayMinimap(this)" <?php if (!isset($_COOKIE['displayminimap']) || (isset($_COOKIE['displayminimap']) && $_COOKIE['displayminimap'] == 'true')) print 'checked'; ?> ><?php echo _("Show mini-map"); ?></label></div></li>
508 508
 		    <li><div class="checkbox"><label><input type="checkbox" name="shadows" value="1" onclick="clickShadows(this)" <?php if ((!isset($_COOKIE['map3dnoshadows']) && (!isset($globalMap3DShadows) || $globalMap3DShadows)) || (isset($_COOKIE['map3dnoshadows']) && $_COOKIE['map3dnoshadows'] == 'false')) print 'checked'; ?> ><?php echo _("Use shadows"); ?></label></div></li>
509 509
 		    <li><div class="checkbox"><label><input type="checkbox" name="one3dmodel" value="1" onclick="useOne3Dmodel(this)" <?php if ((isset($_COOKIE['one3dmodel']) && $_COOKIE['one3dmodel'] == 'true') || (!isset($_COOKIE['one3dmodel']) && isset($globalMap3DOneModel) && $globalMap3DOneModel)) print 'checked'; ?> ><?php echo _("Use same 3D model for all aircraft (use fewer resources)"); ?></label></div></li>
510 510
 		    <li><div class="checkbox"><label><input type="checkbox" name="updaterealtime" value="1" onclick="clickUpdateRealtime(this)" <?php if ((isset($_COOKIE['updaterealtime']) && $_COOKIE['updaterealtime'] == 'true') || !isset($_COOKIE['updaterealtime'])) print 'checked'; ?> ><?php echo _("Display realtime data in infobox"); ?></label></div></li>
511 511
 <?php
512
-    }
513
-    if (time() > mktime(0,0,0,12,1,date("Y")) && time() < mktime(0,0,0,12,31,date("Y"))) {
512
+	}
513
+	if (time() > mktime(0,0,0,12,1,date("Y")) && time() < mktime(0,0,0,12,31,date("Y"))) {
514 514
 ?>
515 515
 		    <li><div class="checkbox"><label><input type="checkbox" name="displaysanta" value="1" onclick="clickSanta(this)"><i class="fa fa-snowflake-o" aria-hidden="true"></i> <?php echo _("Show Santa Claus now"); ?> <i class="fa fa-snowflake-o" aria-hidden="true"></i></label></div></li>
516 516
 <?php
517
-    }
517
+	}
518 518
 ?>
519 519
 		    <?php
520 520
 			if (function_exists('array_column')) {
521
-			    if (array_search(TRUE, array_column($globalSources, 'sourcestats')) !== FALSE) {
522
-		    ?>
521
+				if (array_search(TRUE, array_column($globalSources, 'sourcestats')) !== FALSE) {
522
+			?>
523 523
 		    <li><div class="checkbox"><label><input type="checkbox" name="flightpolar" value="1" onclick="clickPolar(this)" <?php if ((isset($_COOKIE['polar']) && $_COOKIE['polar'] == 'true')) print 'checked'; ?> ><?php echo _("Display polar on map"); ?></label></div></li>
524 524
 		    <?php
525
-			    }
525
+				}
526 526
 			} elseif (isset($globalSources)) {
527
-			    $dispolar = false;
528
-			    foreach ($globalSources as $testsource) {
529
-			        if (isset($globalSources['sourcestats']) && $globalSources['sourcestats'] !== FALSE) $dispolar = true;
530
-			    }
531
-			    if ($dispolar) {
532
-		    ?>
527
+				$dispolar = false;
528
+				foreach ($globalSources as $testsource) {
529
+					if (isset($globalSources['sourcestats']) && $globalSources['sourcestats'] !== FALSE) $dispolar = true;
530
+				}
531
+				if ($dispolar) {
532
+			?>
533 533
 		    <li><div class="checkbox"><label><input type="checkbox" name="flightpolar" value="1" onclick="clickPolar(this)" <?php if ((isset($_COOKIE['polar']) && $_COOKIE['polar'] == 'true')) print 'checked'; ?> ><?php echo _("Display polar on map"); ?></label></div></li>
534 534
 		    <?php
535
-			    }
536
-		        }
537
-		    ?>
535
+				}
536
+				}
537
+			?>
538 538
 <?php
539
-    if (!isset($_COOKIE['MapFormat']) || $_COOKIE['MapFormat'] != '3d') {
539
+	if (!isset($_COOKIE['MapFormat']) || $_COOKIE['MapFormat'] != '3d') {
540 540
 ?>
541 541
 		    <?php
542 542
 			if (!isset($globalAircraft) || $globalAircraft === TRUE) {
543
-		    ?>
543
+			?>
544 544
 		    <li><?php echo _("Max number of flights to display in 2D:"); ?> <input type="number" name="2dlimit" value="<?php if (isset($_COOKIE['map_2d_limit'])) print $_COOKIE['map_2d_limit']; elseif (isset($globalMap2DAircraftsLimit)) print $globalMap2DAircraftsLimit; else print 15000; ?>" onchange="map2dlimit(this.value);" /></li>
545 545
 		    <?php
546 546
 			}
547
-		    ?>
547
+			?>
548 548
 		    <?php
549 549
 			if (!isset($globalAircraft) || $globalAircraft === TRUE) {
550
-		    	    if (extension_loaded('gd') && function_exists('gd_info')) {
551
-		    ?>
550
+					if (extension_loaded('gd') && function_exists('gd_info')) {
551
+			?>
552 552
 		    <li><input type="checkbox" name="aircraftcoloraltitude" value="1" onclick="iconColorAltitude(this)" <?php if (isset($_COOKIE['IconColorAltitude']) && $_COOKIE['IconColorAltitude'] == 'true') print 'checked'; ?> ><?php echo _("Aircraft icon color based on altitude"); ?></li>
553 553
 		    <?php 
554 554
 				if (!isset($_COOKIE['IconColorAltitude']) || $_COOKIE['IconColorAltitude'] == 'false') {
555
-		    ?>
555
+			?>
556 556
 			<li><?php echo _("Aircraft icon color:"); ?> <input type="color" name="aircraftcolor" id="html5colorpicker" onchange="iconColor(this.value);" value="#<?php if (isset($_COOKIE['IconColor'])) print $_COOKIE['IconColor']; elseif (isset($globalAircraftIconColor)) print $globalAircraftIconColor; else print '1a3151'; ?>"></li>
557 557
 		    <?php
558 558
 				}
559
-			    }
560
-		        }
561
-		    ?>
559
+				}
560
+				}
561
+			?>
562 562
 		    <?php
563 563
 			if (isset($globalMarine) && $globalMarine === TRUE) {
564
-			    if (extension_loaded('gd') && function_exists('gd_info')) {
565
-		    ?>
564
+				if (extension_loaded('gd') && function_exists('gd_info')) {
565
+			?>
566 566
 		    <li><?php echo _("Marine icon color:"); ?>
567 567
 			<input type="color" name="marinecolor" id="html5colorpicker" onchange="MarineiconColor(marinecolor.value);" value="#<?php if (isset($_COOKIE['MarineIconColor'])) print $_COOKIE['MarineIconColor']; elseif (isset($globalMarineIconColor)) print $globalMarineIconColor; else print '1a3151'; ?>">
568 568
 		    </li>
569 569
 		    <?php
570
-			    }
571
-		        }
572
-		    ?>
570
+				}
571
+				}
572
+			?>
573 573
 		    <?php
574 574
 			if (isset($globalTracker) && $globalTracker === TRUE) {
575
-			    if (extension_loaded('gd') && function_exists('gd_info')) {
576
-		    ?>
575
+				if (extension_loaded('gd') && function_exists('gd_info')) {
576
+			?>
577 577
 		    <li><?php echo _("Tracker icon color:"); ?>
578 578
 			<input type="color" name="trackercolor" id="html5colorpicker" onchange="TrackericonColor(trackercolor.value);" value="#<?php if (isset($_COOKIE['TrackerIconColor'])) print $_COOKIE['TrackerIconColor']; elseif (isset($globalTrackerIconColor)) print $globalTrackerIconColor; else print '1a3151'; ?>">
579 579
 		    </li>
580 580
 		    <?php
581
-			    }
582
-		        }
583
-		    ?>
581
+				}
582
+				}
583
+			?>
584 584
 		    <?php
585 585
 			if (!isset($globalAircraft) || $globalAircraft === TRUE) {
586
-		    ?>
586
+			?>
587 587
 		    <li><?php echo _("Show airport icon at zoom level:"); ?>
588 588
 			<div class="range">
589 589
 			    <input type="range" min="0" max="19" step="1" name="airportzoom" onchange="range.value=value;airportDisplayZoom(airportzoom.value);" value="<?php if (isset($_COOKIE['AirportZoom'])) print $_COOKIE['AirportZoom']; elseif (isset($globalAirportZoom)) print $globalAirportZoom; else print '7'; ?>">
@@ -592,9 +592,9 @@  discard block
 block discarded – undo
592 592
 		    </li>
593 593
 		    <?php
594 594
 			}
595
-		    ?>
595
+			?>
596 596
 <?php
597
-    } elseif (isset($_COOKIE['MapFormat']) || $_COOKIE['MapFOrmat'] == '3d') {
597
+	} elseif (isset($_COOKIE['MapFormat']) || $_COOKIE['MapFOrmat'] == '3d') {
598 598
 ?>
599 599
 		    <li><?php echo _("Set scaling factor for rendering resolution:"); ?>
600 600
 			<div class="range">
@@ -633,7 +633,7 @@  discard block
 block discarded – undo
633 633
 		    </li>
634 634
 <?php
635 635
 	}
636
-    }
636
+	}
637 637
 ?>
638 638
 		    <li><?php echo _("Distance unit:"); ?>
639 639
 			<select class="selectpicker" onchange="unitdistance(this);">
@@ -673,19 +673,19 @@  discard block
 block discarded – undo
673 673
 		    <ul>
674 674
 		    <?php
675 675
 			if (!isset($globalAircraft) || $globalAircraft) {
676
-		    ?>
676
+			?>
677 677
 		    <?php
678 678
 			if (((isset($globalVATSIM) && $globalVATSIM) || isset($globalIVAO) && $globalIVAO || isset($globalphpVMS) && $globalphpVMS) && (!isset($globalMapVAchoose) || $globalMapVAchoose)) {
679
-		    ?>
679
+			?>
680 680
 			<?php if (isset($globalVATSIM) && $globalVATSIM) { ?><li><input type="checkbox" name="vatsim" value="1" onclick="clickVATSIM(this)" <?php if ((isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') || !isset($_COOKIE['filter_ShowVATSIM'])) print 'checked'; ?> ><?php echo _("Display VATSIM data"); ?></li><?php } ?>
681 681
 			<?php if (isset($globalIVAO) && $globalIVAO) { ?><li><input type="checkbox" name="ivao" value="1" onclick="clickIVAO(this)" <?php if ((isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') || !isset($_COOKIE['filter_ShowIVAO'])) print 'checked'; ?> ><?php echo _("Display IVAO data"); ?></li><?php } ?>
682 682
 			<?php if (isset($globalphpVMS) && $globalphpVMS) { ?><li><input type="checkbox" name="phpvms" value="1" onclick="clickphpVMS(this)" <?php if ((isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') || !isset($_COOKIE['filter_ShowVMS'])) print 'checked'; ?> ><?php echo _("Display phpVMS data"); ?></li><?php } ?>
683 683
 		    <?php
684 684
 			}
685
-		    ?>
685
+			?>
686 686
 		    <?php
687 687
 			if (!(isset($globalVA) && $globalVA) && !(isset($globalVATSIM) && $globalVATSIM) && !(isset($globalIVAO) && $globalIVAO) && !(isset($globalphpVMS) && $globalphpVMS) && isset($globalSBS1) && $globalSBS1 && isset($globalAPRS) && $globalAPRS && (!isset($globalMapchoose) || $globalMapchoose)) {
688
-		    ?>
688
+			?>
689 689
 			<?php if (isset($globalSBS1) && $globalSBS1) { ?>
690 690
 			    <li><div class="checkbox"><label><input type="checkbox" name="sbs" value="1" onclick="clickSBS1(this)" <?php if ((isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') || !isset($_COOKIE['filter_ShowSBS1'])) print 'checked'; ?> ><?php echo _("Display ADS-B data"); ?></label></div></li>
691 691
 			<?php } ?>
@@ -695,7 +695,7 @@  discard block
 block discarded – undo
695 695
 			<li><div class="checkbox"><label><input type="checkbox" name="blocked" value="1" onclick="clickBlocked(this)" <?php if (isset($_COOKIE['filter_blocked']) && $_COOKIE['filter_blocked'] == 'true') print 'checked'; ?> ><?php echo _("Only display FAA ASDI blocked aircrafts"); ?></label></div></li>
696 696
 		    <?php
697 697
 			}
698
-		    ?>
698
+			?>
699 699
 		    <li><?php echo _("Display airlines:"); ?>
700 700
 		    <br/>
701 701
 			<select class="selectpicker" multiple onchange="airlines(this);" id="display_airlines">
@@ -715,14 +715,14 @@  discard block
 block discarded – undo
715 715
 						echo '<option value="'.$airline['airline_icao'].'">'.$airline_name.'</option>';
716 716
 					}
717 717
 				}
718
-			    ?>
718
+				?>
719 719
 			</select>
720 720
 		    </li>
721 721
 		    <?php
722 722
 			$Spotter = new Spotter();
723 723
 			$allalliancenames = $Spotter->getAllAllianceNames();
724 724
 			if (!empty($allalliancenames)) {
725
-		    ?>
725
+			?>
726 726
 		    <li><?php echo _("Display alliance:"); ?>
727 727
 		    <br/>
728 728
 			<select class="selectpicker" onchange="alliance(this);" id="display_alliance">
@@ -736,18 +736,18 @@  discard block
 block discarded – undo
736 736
 						echo '<option value="'.$alliance_name.'">'.$alliance_name.'</option>';
737 737
 					}
738 738
 				}
739
-			    ?>
739
+				?>
740 740
 			</select>
741 741
 		    </li>
742 742
 		    <?php
743 743
 			}
744
-		    ?>
744
+			?>
745 745
 		    <?php
746 746
 			}
747
-		    ?>
747
+			?>
748 748
 		    <?php
749 749
 			if (isset($globalAPRS) && $globalAPRS) {
750
-		    ?>
750
+			?>
751 751
 		    <li><?php echo _("Display APRS sources name:"); ?>
752 752
 			<select class="selectpicker" multiple onchange="sources(this);">
753 753
 			    <?php
@@ -771,18 +771,18 @@  discard block
 block discarded – undo
771 771
 						echo '<option value="'.$src['name'].'">'.$src['name'].'</option>';
772 772
 					}
773 773
 				}
774
-			    ?>
774
+				?>
775 775
 			</select>
776 776
 		    </li>
777 777
 		    <?php
778 778
 			}
779
-		    ?>
779
+			?>
780 780
 		    <?php
781 781
 			if (!isset($globalAircraft) || $globalAircraft) {
782
-		    ?>
782
+			?>
783 783
 		    <?php
784
-			    if (!(isset($globalVATSIM) && $globalVATSIM) && !(isset($globalIVAO) && $globalIVAO) && !(isset($globalphpVMS) && $globalphpVMS)) {
785
-		    ?>
784
+				if (!(isset($globalVATSIM) && $globalVATSIM) && !(isset($globalIVAO) && $globalIVAO) && !(isset($globalphpVMS) && $globalphpVMS)) {
785
+			?>
786 786
 		    <li><?php echo _("Display airlines of type:"); ?><br/>
787 787
 			<select class="selectpicker" onchange="airlinestype(this);">
788 788
 			    <option value="all"<?php if (!isset($_COOKIE['filter_airlinestype']) || $_COOKIE['filter_airlinestype'] == 'all' || $_COOKIE['filter_airlinestype'] == '') echo ' selected'; ?>><?php echo _("All"); ?></option>
@@ -792,14 +792,14 @@  discard block
 block discarded – undo
792 792
 			</select>
793 793
 		    </li>
794 794
 		    <?php
795
-			    }
796
-		    ?>
795
+				}
796
+			?>
797 797
 		    <?php
798 798
 			}
799
-		    ?>
799
+			?>
800 800
 		    <?php
801 801
 			if (isset($globalMarine) && $globalMarine) {
802
-		    ?>
802
+			?>
803 803
 		    <li>
804 804
 			<?php echo _("Display vessels with MMSI:"); ?>
805 805
 			<input type="text" name="mmsifilter" onchange="mmsifilter();" id="mmsifilter" value="<?php if (isset($_COOKIE['filter_mmsi'])) print $_COOKIE['filter_mmsi']; ?>" />
@@ -822,7 +822,7 @@  discard block
 block discarded – undo
822 822
 								print '<option value="'.$race['race_id'].'">'.$race['race_name'].'</option>';
823 823
 							}
824 824
 						}
825
-			    ?>
825
+				?>
826 826
 			</select>
827 827
 		    </li>
828 828
 
@@ -830,7 +830,7 @@  discard block
 block discarded – undo
830 830
 					}
831 831
 				}
832 832
 			}
833
-		    ?>
833
+			?>
834 834
 		    <li>
835 835
 			<?php echo _("Display with ident:"); ?>
836 836
 			<input type="text" name="identfilter" onchange="identfilter();" id="identfilter" value="<?php if (isset($_COOKIE['filter_ident'])) print $_COOKIE['filter_ident']; ?>" />
@@ -843,7 +843,7 @@  discard block
 block discarded – undo
843 843
 	    </form>
844 844
     	</div>
845 845
 <?php
846
-    if (isset($globalSatellite) && $globalSatellite) {
846
+	if (isset($globalSatellite) && $globalSatellite) {
847 847
 ?>
848 848
         <div class="sidebar-pane" id="satellites">
849 849
 	    <h1 class="sidebar-header"><?php echo _("Satellites"); ?><span class="sidebar-close"><i class="fa fa-caret-left"></i></span></h1>
@@ -883,14 +883,14 @@  discard block
 block discarded – undo
883 883
 						print '<option value="'.$type['tle_type'].'">'.$type_name.'</option>';
884 884
 					}
885 885
 				}
886
-			    ?>
886
+				?>
887 887
 			</select>
888 888
 		    </li>
889 889
 		</ul>
890 890
 	    </form>
891 891
 	</div>
892 892
 <?php
893
-    }
893
+	}
894 894
 ?>
895 895
     </div>
896 896
 </div>
Please login to merge, or discard this patch.
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -4,7 +4,7 @@  discard block
 block discarded – undo
4 4
 require_once('require/class.Language.php');
5 5
 require_once('require/class.Satellite.php');
6 6
 
7
-$trackident = filter_input(INPUT_GET,'trackid',FILTER_SANITIZE_STRING);
7
+$trackident = filter_input(INPUT_GET, 'trackid', FILTER_SANITIZE_STRING);
8 8
 if ($trackident != '') {
9 9
 	require_once('require/class.SpotterLive.php');
10 10
 	$SpotterLive = new SpotterLive();
@@ -14,7 +14,7 @@  discard block
 block discarded – undo
14 14
 		$spotterid = $Spotter->getSpotterIDBasedOnFlightAwareID($trackident);
15 15
 		header('Location: '.$globalURL.'/flightid/'.$spotterid);
16 16
 	} else {
17
-		setcookie('MapTrack',$resulttrackident[0]['flightaware_id']);
17
+		setcookie('MapTrack', $resulttrackident[0]['flightaware_id']);
18 18
 	}
19 19
 /*
20 20
 } else {
@@ -23,9 +23,9 @@  discard block
 block discarded – undo
23 23
 */
24 24
 }
25 25
 
26
-$raceid = filter_input(INPUT_GET,'raceid',FILTER_SANITIZE_NUMBER_INT);
26
+$raceid = filter_input(INPUT_GET, 'raceid', FILTER_SANITIZE_NUMBER_INT);
27 27
 if ($raceid != '') {
28
-	setcookie('filter_race',$raceid);
28
+	setcookie('filter_race', $raceid);
29 29
 }
30 30
 
31 31
 $title = _("Home");
@@ -260,7 +260,7 @@  discard block
 block discarded – undo
260 260
 		    <div class="form-group">
261 261
 			<label><?php echo _("From:"); ?></label>
262 262
 			<div class='input-group date' id='datetimepicker1'>
263
-			    <input type='text' id="start_date" name="start_date" class="form-control" autocomplete="off" value="<?php if (isset($_COOKIE['archive_begin']) && $_COOKIE['archive_begin'] != '') print date("Y-m-d H:i",$_COOKIE['archive_begin']).' UTC'; ?>" required />
263
+			    <input type='text' id="start_date" name="start_date" class="form-control" autocomplete="off" value="<?php if (isset($_COOKIE['archive_begin']) && $_COOKIE['archive_begin'] != '') print date("Y-m-d H:i", $_COOKIE['archive_begin']).' UTC'; ?>" required />
264 264
 			    <span class="input-group-addon">
265 265
 				<span class="glyphicon glyphicon-calendar"></span>
266 266
 			    </span>
@@ -269,7 +269,7 @@  discard block
 block discarded – undo
269 269
 		    <div class="form-group">
270 270
 			<label><?php echo _("To:"); ?></label>
271 271
 			<div class='input-group date' id='datetimepicker2'>
272
-			    <input type='text' id="end_date" name="end_date" class="form-control" autocomplete="off" value="<?php if (isset($_COOKIE['archive_end']) && $_COOKIE['archive_end'] != '') print date("Y-m-d H:i",$_COOKIE['archive_end']).' UTC'; ?>" />
272
+			    <input type='text' id="end_date" name="end_date" class="form-control" autocomplete="off" value="<?php if (isset($_COOKIE['archive_end']) && $_COOKIE['archive_end'] != '') print date("Y-m-d H:i", $_COOKIE['archive_end']).' UTC'; ?>" />
273 273
 			    <span class="input-group-addon">
274 274
 				<span class="glyphicon glyphicon-calendar"></span>
275 275
 			    </span>
@@ -439,9 +439,9 @@  discard block
 block discarded – undo
439 439
 			<select  class="selectpicker" onchange="terrainType(this);">
440 440
 			    <option value="world"<?php if (!isset($_COOKIE['MapTerrain']) || $_COOKIE['MapTerrain'] == 'world') print ' selected'; ?>>world terrain</option>
441 441
 			    <option value="stk"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'stk') print ' selected'; ?>>stk terrain</option>
442
-			    <option value="ellipsoid"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'ellipsoid') print ' selected';?>>ellipsoid</option>
443
-			    <option value="vrterrain"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'vrterrain') print ' selected';?>>vr terrain</option>
444
-			    <option value="articdem"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'articdem') print ' selected';?>>ArticDEM</option>
442
+			    <option value="ellipsoid"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'ellipsoid') print ' selected'; ?>>ellipsoid</option>
443
+			    <option value="vrterrain"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'vrterrain') print ' selected'; ?>>vr terrain</option>
444
+			    <option value="articdem"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'articdem') print ' selected'; ?>>ArticDEM</option>
445 445
 			</select>
446 446
 		    </li>
447 447
 <?php
@@ -511,7 +511,7 @@  discard block
 block discarded – undo
511 511
 		    <li><div class="checkbox"><label><input type="checkbox" name="updaterealtime" value="1" onclick="clickUpdateRealtime(this)" <?php if ((isset($_COOKIE['updaterealtime']) && $_COOKIE['updaterealtime'] == 'true') || !isset($_COOKIE['updaterealtime'])) print 'checked'; ?> ><?php echo _("Display realtime data in infobox"); ?></label></div></li>
512 512
 <?php
513 513
     }
514
-    if (time() > mktime(0,0,0,12,1,date("Y")) && time() < mktime(0,0,0,12,31,date("Y"))) {
514
+    if (time() > mktime(0, 0, 0, 12, 1, date("Y")) && time() < mktime(0, 0, 0, 12, 31, date("Y"))) {
515 515
 ?>
516 516
 		    <li><div class="checkbox"><label><input type="checkbox" name="displaysanta" value="1" onclick="clickSanta(this)"><i class="fa fa-snowflake-o" aria-hidden="true"></i> <?php echo _("Show Santa Claus now"); ?> <i class="fa fa-snowflake-o" aria-hidden="true"></i></label></div></li>
517 517
 <?php
@@ -707,10 +707,10 @@  discard block
 block discarded – undo
707 707
 					$Spotter = new Spotter();
708 708
 					$allairlinenames = $Spotter->getAllAirlineNames();
709 709
 				}
710
-				foreach($allairlinenames as $airline) {
710
+				foreach ($allairlinenames as $airline) {
711 711
 					$airline_name = $airline['airline_name'];
712
-					if (strlen($airline_name) > 30) $airline_name = substr($airline_name,0,30).'...';
713
-					if (isset($_COOKIE['filter_Airlines']) && in_array($airline['airline_icao'],explode(',',$_COOKIE['filter_Airlines']))) {
712
+					if (strlen($airline_name) > 30) $airline_name = substr($airline_name, 0, 30).'...';
713
+					if (isset($_COOKIE['filter_Airlines']) && in_array($airline['airline_icao'], explode(',', $_COOKIE['filter_Airlines']))) {
714 714
 						echo '<option value="'.$airline['airline_icao'].'" selected>'.$airline_name.'</option>';
715 715
 					} else {
716 716
 						echo '<option value="'.$airline['airline_icao'].'">'.$airline_name.'</option>';
@@ -729,7 +729,7 @@  discard block
 block discarded – undo
729 729
 			<select class="selectpicker" onchange="alliance(this);" id="display_alliance">
730 730
 			    <option value="all"<?php if (!isset($_COOKIE['filter_alliance']) || $_COOKIE['filter_alliance'] == 'all' || $_COOKIE['filter_alliance'] == '') echo ' selected'; ?>><?php echo _("All"); ?></option>
731 731
 			    <?php
732
-				foreach($allalliancenames as $alliance) {
732
+				foreach ($allalliancenames as $alliance) {
733 733
 					$alliance_name = $alliance['alliance'];
734 734
 					if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] == $alliance_name) {
735 735
 						echo '<option value="'.$alliance_name.'" selected>'.$alliance_name.'</option>';
@@ -765,8 +765,8 @@  discard block
 block discarded – undo
765 765
 				*/
766 766
 				$Source = new Source();
767 767
 				$datasource = $Source->getLocationInfoByType('gs');
768
-				foreach($datasource as $src) {
769
-					if (isset($_COOKIE['filter_Sources']) && in_array($src['name'],explode(',',$_COOKIE['filter_Sources']))) {
768
+				foreach ($datasource as $src) {
769
+					if (isset($_COOKIE['filter_Sources']) && in_array($src['name'], explode(',', $_COOKIE['filter_Sources']))) {
770 770
 						echo '<option value="'.$src['name'].'" selected>'.$src['name'].'</option>';
771 771
 					} else {
772 772
 						echo '<option value="'.$src['name'].'">'.$src['name'].'</option>';
@@ -878,7 +878,7 @@  discard block
 block discarded – undo
878 878
 					else if ($type_name == 'radar') $type_name = 'Radar Calibration';
879 879
 					else if ($type_name == 'tle-new') $type_name = 'Last 30 days launches';
880 880
 					
881
-					if (isset($_COOKIE['sattypes']) && in_array($type['tle_type'],explode(',',$_COOKIE['sattypes']))) {
881
+					if (isset($_COOKIE['sattypes']) && in_array($type['tle_type'], explode(',', $_COOKIE['sattypes']))) {
882 882
 						print '<option value="'.$type['tle_type'].'" selected>'.$type_name.'</option>';
883 883
 					} else {
884 884
 						print '<option value="'.$type['tle_type'].'">'.$type_name.'</option>';
Please login to merge, or discard this patch.
Braces   +618 added lines, -154 removed lines patch added patch discarded remove patch
@@ -57,7 +57,10 @@  discard block
 block discarded – undo
57 57
 <?php
58 58
     if ((!isset($_COOKIE['MapFormat']) && isset($globalMap3Ddefault) && $globalMap3Ddefault) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d')) {
59 59
 ?>
60
-<script src="<?php echo $globalURL; ?>/js/map.3d.js.php<?php if (isset($tsk)) print '?tsk='.$tsk; ?>"></script>
60
+<script src="<?php echo $globalURL; ?>/js/map.3d.js.php<?php if (isset($tsk)) {
61
+	print '?tsk='.$tsk;
62
+}
63
+?>"></script>
61 64
 <script src="<?php echo $globalURL; ?>/js/meuusjs.1.0.3.min.js"></script>
62 65
 <script src="<?php echo $globalURL; ?>/js/map.3d.weather.js"></script>
63 66
 <?php
@@ -137,10 +140,22 @@  discard block
 block discarded – undo
137 140
 			<h1>Weather</h1>
138 141
 			<ul>
139 142
 			
140
-				<li><div class="checkbox"><label><input type="checkbox" name="wind" value="1" onclick="clickWind(this);" <?php if (isset($_COOKIE['weather_wind']) && $_COOKIE['weather_wind'] == 'true') print 'checked'; ?> /><?php echo _("Weather Winds"); ?></label></div></li>
141
-				<li><div class="checkbox"><label><input type="checkbox" name="wave" value="1" onclick="clickWave(this);" <?php if (isset($_COOKIE['weather_wave']) && $_COOKIE['weather_wave'] == 'true') print 'checked'; ?> /><?php echo _("Ocean surface currents"); ?></label></div></li>
142
-				<li><div class="checkbox"><label><input type="checkbox" name="fire" value="1" onclick="clickFire(this);" <?php if (isset($_COOKIE['weather_fire']) && $_COOKIE['weather_fire'] == 'true') print 'checked'; ?> /><?php echo _("NASA Fire Hotspots"); ?></label></div></li>
143
-				<!-- <li><div class="checkbox"><label><input type="checkbox" name="backwave" value="1" onclick="clickBackWave(this);" <?php if (isset($_COOKIE['weather_backwave']) && $_COOKIE['weather_backwave'] == 'true') print 'checked'; ?> /><?php echo _("Weather Waves height background"); ?></label></div></li> -->
143
+				<li><div class="checkbox"><label><input type="checkbox" name="wind" value="1" onclick="clickWind(this);" <?php if (isset($_COOKIE['weather_wind']) && $_COOKIE['weather_wind'] == 'true') {
144
+	print 'checked';
145
+}
146
+?> /><?php echo _("Weather Winds"); ?></label></div></li>
147
+				<li><div class="checkbox"><label><input type="checkbox" name="wave" value="1" onclick="clickWave(this);" <?php if (isset($_COOKIE['weather_wave']) && $_COOKIE['weather_wave'] == 'true') {
148
+	print 'checked';
149
+}
150
+?> /><?php echo _("Ocean surface currents"); ?></label></div></li>
151
+				<li><div class="checkbox"><label><input type="checkbox" name="fire" value="1" onclick="clickFire(this);" <?php if (isset($_COOKIE['weather_fire']) && $_COOKIE['weather_fire'] == 'true') {
152
+	print 'checked';
153
+}
154
+?> /><?php echo _("NASA Fire Hotspots"); ?></label></div></li>
155
+				<!-- <li><div class="checkbox"><label><input type="checkbox" name="backwave" value="1" onclick="clickBackWave(this);" <?php if (isset($_COOKIE['weather_backwave']) && $_COOKIE['weather_backwave'] == 'true') {
156
+	print 'checked';
157
+}
158
+?> /><?php echo _("Weather Waves height background"); ?></label></div></li> -->
144 159
 			
145 160
 <?php
146 161
 		if (isset($globalOpenWeatherMapKey) && $globalOpenWeatherMapKey != '') {
@@ -162,12 +177,18 @@  discard block
 block discarded – undo
162 177
 <?php
163 178
 		if (isset($globalMETAR) && isset($globalMETARcycle) && $globalMETAR && $globalMETARcycle) {
164 179
 ?>
165
-				<li><div class="checkbox"><label><input type="checkbox" name="displayweather" value="1" onclick="clickDisplayWeather(this)" <?php if ((isset($_COOKIE['show_Weather']) && $_COOKIE['show_Weather'] == 'true') || (!isset($_COOKIE['show_Weather']) && (isset($globalMapWeather) && $globalMapWeather === TRUE))) print 'checked'; ?> ><?php echo _("Display 3D weather"); ?></label></div></li>
180
+				<li><div class="checkbox"><label><input type="checkbox" name="displayweather" value="1" onclick="clickDisplayWeather(this)" <?php if ((isset($_COOKIE['show_Weather']) && $_COOKIE['show_Weather'] == 'true') || (!isset($_COOKIE['show_Weather']) && (isset($globalMapWeather) && $globalMapWeather === TRUE))) {
181
+	print 'checked';
182
+}
183
+?> ><?php echo _("Display 3D weather"); ?></label></div></li>
166 184
 			<!--	<li><div class="checkbox"><label><input type="checkbox" name="displayrain" value="1" onclick="clickDisplayRain(this)" ><?php echo _("Display rain on 3D map"); ?></label></div></li>-->
167 185
 <?php
168 186
 		}
169 187
 ?>
170
-				<li><div class="checkbox"><label><input type="checkbox" name="fire" value="1" onclick="clickFire(this);" <?php if (isset($_COOKIE['weather_fire']) && $_COOKIE['weather_fire'] == 'true') print 'checked'; ?> /><?php echo _("NASA Fire Hotspots"); ?></label></div></li>
188
+				<li><div class="checkbox"><label><input type="checkbox" name="fire" value="1" onclick="clickFire(this);" <?php if (isset($_COOKIE['weather_fire']) && $_COOKIE['weather_fire'] == 'true') {
189
+	print 'checked';
190
+}
191
+?> /><?php echo _("NASA Fire Hotspots"); ?></label></div></li>
171 192
 			</ul>
172 193
 <?php
173 194
 	}
@@ -183,13 +204,22 @@  discard block
 block discarded – undo
183 204
 <?php
184 205
 		if (!isset($globalAircraft) || $globalAircraft) {
185 206
 ?>
186
-				<li><div class="checkbox"><label><input type="checkbox" name="waypoints" value="1" onclick="showWaypoints(this);" <?php if (isset($_COOKIE['waypoints']) && $_COOKIE['waypoints'] == 'true') print 'checked'; ?> /><?php echo _("Display waypoints"); ?></label></div></li>
187
-				<li><div class="checkbox"><label><input type="checkbox" name="airspace" value="1" onclick="showAirspace(this);" <?php if (isset($_COOKIE['airspace']) && $_COOKIE['airspace'] == 'true') print 'checked'; ?> /><?php echo _("Display airspace"); ?></label></div></li>
207
+				<li><div class="checkbox"><label><input type="checkbox" name="waypoints" value="1" onclick="showWaypoints(this);" <?php if (isset($_COOKIE['waypoints']) && $_COOKIE['waypoints'] == 'true') {
208
+	print 'checked';
209
+}
210
+?> /><?php echo _("Display waypoints"); ?></label></div></li>
211
+				<li><div class="checkbox"><label><input type="checkbox" name="airspace" value="1" onclick="showAirspace(this);" <?php if (isset($_COOKIE['airspace']) && $_COOKIE['airspace'] == 'true') {
212
+	print 'checked';
213
+}
214
+?> /><?php echo _("Display airspace"); ?></label></div></li>
188 215
 <?php
189 216
 		}
190 217
 		if (isset($globalMarine) && $globalMarine) {
191 218
 ?>
192
-				<li><div class="checkbox"><label><input type="checkbox" name="openseamap" value="1" onclick="clickOpenSeaMap(this);" <?php if (isset($_COOKIE['openseamap']) && $_COOKIE['openseamap'] == 'true') print 'checked'; ?> /><?php echo _("Display OpenSeaMap"); ?></label></div></li>
219
+				<li><div class="checkbox"><label><input type="checkbox" name="openseamap" value="1" onclick="clickOpenSeaMap(this);" <?php if (isset($_COOKIE['openseamap']) && $_COOKIE['openseamap'] == 'true') {
220
+	print 'checked';
221
+}
222
+?> /><?php echo _("Display OpenSeaMap"); ?></label></div></li>
193 223
 <?php
194 224
 		}
195 225
 ?>
@@ -204,13 +234,22 @@  discard block
 block discarded – undo
204 234
 <?php
205 235
 		if (!isset($globalAircraft) || $globalAircraft) {
206 236
 ?>
207
-				<li><div class="checkbox"><label><input type="checkbox" name="waypoints" value="1" onclick="showWaypoints(this);" <?php if (isset($_COOKIE['waypoints']) && $_COOKIE['waypoints'] == 'true') print 'checked'; ?> /><?php echo _("Display waypoints"); ?> Beta</label></div></li>
208
-				<li><div class="checkbox"><label><input type="checkbox" name="airspace" value="1" onclick="showAirspace(this);" <?php if (isset($_COOKIE['airspace']) && $_COOKIE['airspace'] == 'true') print 'checked'; ?> /><?php echo _("Display airspace"); ?> Beta</label></div></li>
237
+				<li><div class="checkbox"><label><input type="checkbox" name="waypoints" value="1" onclick="showWaypoints(this);" <?php if (isset($_COOKIE['waypoints']) && $_COOKIE['waypoints'] == 'true') {
238
+	print 'checked';
239
+}
240
+?> /><?php echo _("Display waypoints"); ?> Beta</label></div></li>
241
+				<li><div class="checkbox"><label><input type="checkbox" name="airspace" value="1" onclick="showAirspace(this);" <?php if (isset($_COOKIE['airspace']) && $_COOKIE['airspace'] == 'true') {
242
+	print 'checked';
243
+}
244
+?> /><?php echo _("Display airspace"); ?> Beta</label></div></li>
209 245
 <?php
210 246
 		}
211 247
 		if (isset($globalMarine) && $globalMarine) {
212 248
 ?>
213
-				<li><div class="checkbox"><label><input type="checkbox" name="openseamap" value="1" onclick="clickOpenSeaMap(this);" <?php if (isset($_COOKIE['openseamap']) && $_COOKIE['openseamap'] == 'true') print 'checked'; ?> /><?php echo _("Display OpenSeaMap"); ?></label></div></li>
249
+				<li><div class="checkbox"><label><input type="checkbox" name="openseamap" value="1" onclick="clickOpenSeaMap(this);" <?php if (isset($_COOKIE['openseamap']) && $_COOKIE['openseamap'] == 'true') {
250
+	print 'checked';
251
+}
252
+?> /><?php echo _("Display OpenSeaMap"); ?></label></div></li>
214 253
 <?php
215 254
 		}
216 255
 ?>
@@ -225,14 +264,32 @@  discard block
 block discarded – undo
225 264
 		<h1>NOTAM</h1>
226 265
 		<form>
227 266
 			<ul>
228
-				<li><div class="checkbox"><label><input type="checkbox" name="notamcb" value="1" onclick="showNotam(this);" <?php if (isset($_COOKIE['notam']) && $_COOKIE['notam'] == 'true') print 'checked'; ?> /><?php echo _("Display NOTAM"); ?></label></div></li>
267
+				<li><div class="checkbox"><label><input type="checkbox" name="notamcb" value="1" onclick="showNotam(this);" <?php if (isset($_COOKIE['notam']) && $_COOKIE['notam'] == 'true') {
268
+	print 'checked';
269
+}
270
+?> /><?php echo _("Display NOTAM"); ?></label></div></li>
229 271
 				<li><?php echo _("NOTAM scope:"); ?>
230 272
 					<select class="selectpicker" onchange="notamscope(this);">
231
-						<option<?php if (!isset($_COOKIE['notamscope']) || $_COOKIE['notamscope'] == 'All') print ' selected'; ?>>All</option>
232
-						<option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Airport/Enroute warning') print ' selected'; ?>>Airport/Enroute warning</option>
233
-						<option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Airport warning') print ' selected'; ?>>Airport warning</option>
234
-						<option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Navigation warning') print ' selected'; ?>>Navigation warning</option>
235
-						<option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Enroute warning') print ' selected'; ?>>Enroute warning</option>
273
+						<option<?php if (!isset($_COOKIE['notamscope']) || $_COOKIE['notamscope'] == 'All') {
274
+	print ' selected';
275
+}
276
+?>>All</option>
277
+						<option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Airport/Enroute warning') {
278
+	print ' selected';
279
+}
280
+?>>Airport/Enroute warning</option>
281
+						<option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Airport warning') {
282
+	print ' selected';
283
+}
284
+?>>Airport warning</option>
285
+						<option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Navigation warning') {
286
+	print ' selected';
287
+}
288
+?>>Navigation warning</option>
289
+						<option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Enroute warning') {
290
+	print ' selected';
291
+}
292
+?>>Enroute warning</option>
236 293
 					</select
237 294
 				</li>
238 295
 			</ul>
@@ -260,7 +317,10 @@  discard block
 block discarded – undo
260 317
 		    <div class="form-group">
261 318
 			<label><?php echo _("From:"); ?></label>
262 319
 			<div class='input-group date' id='datetimepicker1'>
263
-			    <input type='text' id="start_date" name="start_date" class="form-control" autocomplete="off" value="<?php if (isset($_COOKIE['archive_begin']) && $_COOKIE['archive_begin'] != '') print date("Y-m-d H:i",$_COOKIE['archive_begin']).' UTC'; ?>" required />
320
+			    <input type='text' id="start_date" name="start_date" class="form-control" autocomplete="off" value="<?php if (isset($_COOKIE['archive_begin']) && $_COOKIE['archive_begin'] != '') {
321
+	print date("Y-m-d H:i",$_COOKIE['archive_begin']).' UTC';
322
+}
323
+?>" required />
264 324
 			    <span class="input-group-addon">
265 325
 				<span class="glyphicon glyphicon-calendar"></span>
266 326
 			    </span>
@@ -269,7 +329,10 @@  discard block
 block discarded – undo
269 329
 		    <div class="form-group">
270 330
 			<label><?php echo _("To:"); ?></label>
271 331
 			<div class='input-group date' id='datetimepicker2'>
272
-			    <input type='text' id="end_date" name="end_date" class="form-control" autocomplete="off" value="<?php if (isset($_COOKIE['archive_end']) && $_COOKIE['archive_end'] != '') print date("Y-m-d H:i",$_COOKIE['archive_end']).' UTC'; ?>" />
332
+			    <input type='text' id="end_date" name="end_date" class="form-control" autocomplete="off" value="<?php if (isset($_COOKIE['archive_end']) && $_COOKIE['archive_end'] != '') {
333
+	print date("Y-m-d H:i",$_COOKIE['archive_end']).' UTC';
334
+}
335
+?>" />
273 336
 			    <span class="input-group-addon">
274 337
 				<span class="glyphicon glyphicon-calendar"></span>
275 338
 			    </span>
@@ -301,8 +364,20 @@  discard block
 block discarded – undo
301 364
 		    </script>
302 365
 		<li><?php echo _("Playback speed:"); ?>
303 366
 		    <div class="range">
304
-			<input type="range" min="0" max="50" step="1" id="archivespeed" name="archivespeed" onChange="archivespeedrange.value=value;" value="<?php  if (isset($_POST['archivespeed'])) print $_POST['archivespeed']; elseif (isset($_COOKIE['archive_speed'])) print $_COOKIE['archive_speed']; else print '1'; ?>">
305
-			<output id="archivespeedrange"><?php  if (isset($_COOKIE['archive_speed'])) print $_COOKIE['archive_speed']; else print '1'; ?></output>
367
+			<input type="range" min="0" max="50" step="1" id="archivespeed" name="archivespeed" onChange="archivespeedrange.value=value;" value="<?php  if (isset($_POST['archivespeed'])) {
368
+	print $_POST['archivespeed'];
369
+} elseif (isset($_COOKIE['archive_speed'])) {
370
+	print $_COOKIE['archive_speed'];
371
+} else {
372
+	print '1';
373
+}
374
+?>">
375
+			<output id="archivespeedrange"><?php  if (isset($_COOKIE['archive_speed'])) {
376
+	print $_COOKIE['archive_speed'];
377
+} else {
378
+	print '1';
379
+}
380
+?></output>
306 381
 		    </div>
307 382
 		</li>
308 383
 		<?php
@@ -331,14 +406,20 @@  discard block
 block discarded – undo
331 406
 		    <li><?php echo _("Type of Map:"); ?>
332 407
 			    <?php
333 408
 				if ((!isset($_COOKIE['MapFormat']) && (!isset($globalMap3Ddefault) || !$globalMap3Ddefault)) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] != '3d')) {
334
-					if (!isset($_COOKIE['MapType']) || $_COOKIE['MapType'] == '') $MapType = $globalMapProvider;
335
-					else $MapType = $_COOKIE['MapType'];
409
+					if (!isset($_COOKIE['MapType']) || $_COOKIE['MapType'] == '') {
410
+						$MapType = $globalMapProvider;
411
+					} else {
412
+						$MapType = $_COOKIE['MapType'];
413
+					}
336 414
 			    ?>
337 415
 			<select  class="selectpicker" onchange="mapType(this);">
338 416
 			    <?php
339 417
 				} else {
340
-					if (!isset($_COOKIE['MapType3D']) || $_COOKIE['MapType3D'] == '') $MapType = $globalMapProvider;
341
-					else $MapType = $_COOKIE['MapType3D'];
418
+					if (!isset($_COOKIE['MapType3D']) || $_COOKIE['MapType3D'] == '') {
419
+						$MapType = $globalMapProvider;
420
+					} else {
421
+						$MapType = $_COOKIE['MapType3D'];
422
+					}
342 423
 			    ?>
343 424
 			<select  class="selectpicker" onchange="mapType3D(this);">
344 425
 			    <?php
@@ -347,24 +428,48 @@  discard block
 block discarded – undo
347 428
 			    <?php
348 429
 				if (isset($globalMapOffline) && $globalMapOffline === TRUE) {
349 430
 			    ?>
350
-			    <option value="offline"<?php if ($MapType == 'offline') print ' selected'; ?>>Natural Earth (local)</option>
431
+			    <option value="offline"<?php if ($MapType == 'offline') {
432
+	print ' selected';
433
+}
434
+?>>Natural Earth (local)</option>
351 435
 			    <?php
352 436
 				} else {
353 437
 				    if (file_exists(dirname(__FILE__).'/js/Cesium/Assets/Textures/NaturalEarthII/tilemapresource.xml')) {
354 438
 			    ?>
355
-			    <option value="offline"<?php if ($MapType == 'offline') print ' selected'; ?>>Natural Earth (local)</option>
439
+			    <option value="offline"<?php if ($MapType == 'offline') {
440
+	print ' selected';
441
+}
442
+?>>Natural Earth (local)</option>
356 443
 			    <?php
357 444
 				    }
358 445
 			    ?>
359
-			    <option value="ArcGIS-Streetmap"<?php if ($MapType == 'ArcGIS-Streetmap') print ' selected'; ?>>ArcGIS Streetmap</option>
360
-			    <option value="ArcGIS-Satellite"<?php if ($MapType == 'ArcGIS-Satellite') print ' selected'; ?>>ArcGIS Satellite</option>
361
-			    <option value="ArcGIS-Satellite"<?php if ($MapType == 'ArcGIS-Ocean') print ' selected'; ?>>ArcGIS Ocean</option>
446
+			    <option value="ArcGIS-Streetmap"<?php if ($MapType == 'ArcGIS-Streetmap') {
447
+	print ' selected';
448
+}
449
+?>>ArcGIS Streetmap</option>
450
+			    <option value="ArcGIS-Satellite"<?php if ($MapType == 'ArcGIS-Satellite') {
451
+	print ' selected';
452
+}
453
+?>>ArcGIS Satellite</option>
454
+			    <option value="ArcGIS-Satellite"<?php if ($MapType == 'ArcGIS-Ocean') {
455
+	print ' selected';
456
+}
457
+?>>ArcGIS Ocean</option>
362 458
 			    <?php
363 459
 				    if (isset($globalBingMapKey) && $globalBingMapKey != '') {
364 460
 			    ?>
365
-			    <option value="Bing-Aerial"<?php if ($MapType == 'Bing-Aerial') print ' selected'; ?>>Bing-Aerial</option>
366
-			    <option value="Bing-Hybrid"<?php if ($MapType == 'Bing-Hybrid') print ' selected'; ?>>Bing-Hybrid</option>
367
-			    <option value="Bing-Road"<?php if ($MapType == 'Bing-Road') print ' selected'; ?>>Bing-Road</option>
461
+			    <option value="Bing-Aerial"<?php if ($MapType == 'Bing-Aerial') {
462
+	print ' selected';
463
+}
464
+?>>Bing-Aerial</option>
465
+			    <option value="Bing-Hybrid"<?php if ($MapType == 'Bing-Hybrid') {
466
+	print ' selected';
467
+}
468
+?>>Bing-Hybrid</option>
469
+			    <option value="Bing-Road"<?php if ($MapType == 'Bing-Road') {
470
+	print ' selected';
471
+}
472
+?>>Bing-Road</option>
368 473
 			    <?php
369 474
 				    }
370 475
 			    ?>
@@ -374,59 +479,143 @@  discard block
 block discarded – undo
374 479
 			    <?php
375 480
 					if (isset($globalHereappId) && $globalHereappId != '' && isset($globalHereappCode) && $globalHereappCode != '') {
376 481
 			    ?>
377
-			    <option value="Here-Aerial"<?php if ($MapType == 'Here-Aerial') print ' selected'; ?>>Here-Aerial</option>
378
-			    <option value="Here-Hybrid"<?php if ($MapType == 'Here-Hybrid') print ' selected'; ?>>Here-Hybrid</option>
379
-			    <option value="Here-Road"<?php if ($MapType == 'Here-Road') print ' selected'; ?>>Here-Road</option>
482
+			    <option value="Here-Aerial"<?php if ($MapType == 'Here-Aerial') {
483
+	print ' selected';
484
+}
485
+?>>Here-Aerial</option>
486
+			    <option value="Here-Hybrid"<?php if ($MapType == 'Here-Hybrid') {
487
+	print ' selected';
488
+}
489
+?>>Here-Hybrid</option>
490
+			    <option value="Here-Road"<?php if ($MapType == 'Here-Road') {
491
+	print ' selected';
492
+}
493
+?>>Here-Road</option>
380 494
 			    <?php
381 495
 					}
382 496
 			    ?>
383 497
 			    <?php
384 498
 					if (isset($globalGoogleAPIKey) && $globalGoogleAPIKey != '') {
385 499
 			    ?>
386
-			    <option value="Google-Roadmap"<?php if ($MapType == 'Google-Roadmap') print ' selected'; ?>>Google Roadmap</option>
387
-			    <option value="Google-Satellite"<?php if ($MapType == 'Google-Satellite') print ' selected'; ?>>Google Satellite</option>
388
-			    <option value="Google-Hybrid"<?php if ($MapType == 'Google-Hybrid') print ' selected'; ?>>Google Hybrid</option>
389
-			    <option value="Google-Terrain"<?php if ($MapType == 'Google-Terrain') print ' selected'; ?>>Google Terrain</option>
500
+			    <option value="Google-Roadmap"<?php if ($MapType == 'Google-Roadmap') {
501
+	print ' selected';
502
+}
503
+?>>Google Roadmap</option>
504
+			    <option value="Google-Satellite"<?php if ($MapType == 'Google-Satellite') {
505
+	print ' selected';
506
+}
507
+?>>Google Satellite</option>
508
+			    <option value="Google-Hybrid"<?php if ($MapType == 'Google-Hybrid') {
509
+	print ' selected';
510
+}
511
+?>>Google Hybrid</option>
512
+			    <option value="Google-Terrain"<?php if ($MapType == 'Google-Terrain') {
513
+	print ' selected';
514
+}
515
+?>>Google Terrain</option>
390 516
 			    <?php
391 517
 					}
392 518
 			    ?>
393 519
 			    <?php
394 520
 					if (isset($globalMapQuestKey) && $globalMapQuestKey != '') {
395 521
 			    ?>
396
-			    <option value="MapQuest-OSM"<?php if ($MapType == 'MapQuest-OSM') print ' selected'; ?>>MapQuest-OSM</option>
397
-			    <option value="MapQuest-Aerial"<?php if ($MapType == 'MapQuest-Aerial') print ' selected'; ?>>MapQuest-Aerial</option>
398
-			    <option value="MapQuest-Hybrid"<?php if ($MapType == 'MapQuest-Hybrid') print ' selected'; ?>>MapQuest-Hybrid</option>
522
+			    <option value="MapQuest-OSM"<?php if ($MapType == 'MapQuest-OSM') {
523
+	print ' selected';
524
+}
525
+?>>MapQuest-OSM</option>
526
+			    <option value="MapQuest-Aerial"<?php if ($MapType == 'MapQuest-Aerial') {
527
+	print ' selected';
528
+}
529
+?>>MapQuest-Aerial</option>
530
+			    <option value="MapQuest-Hybrid"<?php if ($MapType == 'MapQuest-Hybrid') {
531
+	print ' selected';
532
+}
533
+?>>MapQuest-Hybrid</option>
399 534
 			    <?php
400 535
 					}
401 536
 			    ?>
402
-			    <option value="offline"<?php if ($MapType == 'offline') print ' selected'; ?>>Natural Earth</option>
537
+			    <option value="offline"<?php if ($MapType == 'offline') {
538
+	print ' selected';
539
+}
540
+?>>Natural Earth</option>
403 541
 			    <?php
404 542
 				    }
405 543
 			    ?>
406
-			    <option value="NatGeo-Street"<?php if ($MapType == 'NatGeo-Street') print ' selected'; ?>>National Geographic Street</option>
544
+			    <option value="NatGeo-Street"<?php if ($MapType == 'NatGeo-Street') {
545
+	print ' selected';
546
+}
547
+?>>National Geographic Street</option>
407 548
 			    <?php
408 549
 				    if (isset($globalMapboxToken) && $globalMapboxToken != '') {
409
-					if (!isset($_COOKIE['MapTypeId'])) $MapBoxId = 'default';
410
-					else $MapBoxId = $_COOKIE['MapTypeId'];
550
+					if (!isset($_COOKIE['MapTypeId'])) {
551
+						$MapBoxId = 'default';
552
+					} else {
553
+						$MapBoxId = $_COOKIE['MapTypeId'];
554
+					}
411 555
 			    ?>
412
-			    <option value="MapboxGL"<?php if ($MapType == 'MapboxGL') print ' selected'; ?>>Mapbox GL</option>
413
-			    <option value="Mapbox-default"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'default') print ' selected'; ?>>Mapbox default</option>
414
-			    <option value="Mapbox-mapbox.streets"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.streets') print ' selected'; ?>>Mapbox streets</option>
415
-			    <option value="Mapbox-mapbox.light"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.light') print ' selected'; ?>>Mapbox light</option>
416
-			    <option value="Mapbox-mapbox.dark"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.dark') print ' selected'; ?>>Mapbox dark</option>
417
-			    <option value="Mapbox-mapbox.satellite"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.satellite') print ' selected'; ?>>Mapbox satellite</option>
418
-			    <option value="Mapbox-mapbox.streets-satellite"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.streets-satellite') print ' selected'; ?>>Mapbox streets-satellite</option>
419
-			    <option value="Mapbox-mapbox.streets-basic"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.streets-basic') print ' selected'; ?>>Mapbox streets-basic</option>
420
-			    <option value="Mapbox-mapbox.comic"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.comic') print ' selected'; ?>>Mapbox comic</option>
421
-			    <option value="Mapbox-mapbox.outdoors"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.outdoors') print ' selected'; ?>>Mapbox outdoors</option>
422
-			    <option value="Mapbox-mapbox.pencil"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.pencil') print ' selected'; ?>>Mapbox pencil</option>
423
-			    <option value="Mapbox-mapbox.pirates"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.pirates') print ' selected'; ?>>Mapbox pirates</option>
424
-			    <option value="Mapbox-mapbox.emerald"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.emerald') print ' selected'; ?>>Mapbox emerald</option>
556
+			    <option value="MapboxGL"<?php if ($MapType == 'MapboxGL') {
557
+	print ' selected';
558
+}
559
+?>>Mapbox GL</option>
560
+			    <option value="Mapbox-default"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'default') {
561
+	print ' selected';
562
+}
563
+?>>Mapbox default</option>
564
+			    <option value="Mapbox-mapbox.streets"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.streets') {
565
+	print ' selected';
566
+}
567
+?>>Mapbox streets</option>
568
+			    <option value="Mapbox-mapbox.light"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.light') {
569
+	print ' selected';
570
+}
571
+?>>Mapbox light</option>
572
+			    <option value="Mapbox-mapbox.dark"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.dark') {
573
+	print ' selected';
574
+}
575
+?>>Mapbox dark</option>
576
+			    <option value="Mapbox-mapbox.satellite"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.satellite') {
577
+	print ' selected';
578
+}
579
+?>>Mapbox satellite</option>
580
+			    <option value="Mapbox-mapbox.streets-satellite"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.streets-satellite') {
581
+	print ' selected';
582
+}
583
+?>>Mapbox streets-satellite</option>
584
+			    <option value="Mapbox-mapbox.streets-basic"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.streets-basic') {
585
+	print ' selected';
586
+}
587
+?>>Mapbox streets-basic</option>
588
+			    <option value="Mapbox-mapbox.comic"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.comic') {
589
+	print ' selected';
590
+}
591
+?>>Mapbox comic</option>
592
+			    <option value="Mapbox-mapbox.outdoors"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.outdoors') {
593
+	print ' selected';
594
+}
595
+?>>Mapbox outdoors</option>
596
+			    <option value="Mapbox-mapbox.pencil"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.pencil') {
597
+	print ' selected';
598
+}
599
+?>>Mapbox pencil</option>
600
+			    <option value="Mapbox-mapbox.pirates"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.pirates') {
601
+	print ' selected';
602
+}
603
+?>>Mapbox pirates</option>
604
+			    <option value="Mapbox-mapbox.emerald"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.emerald') {
605
+	print ' selected';
606
+}
607
+?>>Mapbox emerald</option>
425 608
 			    <?php
426 609
 				    }
427 610
 			    ?>
428
-			    <option value="OpenStreetMap"<?php if ($MapType == 'OpenStreetMap') print ' selected'; ?>>OpenStreetMap</option>
429
-			    <option value="Yandex"<?php if ($MapType == 'Yandex') print ' selected'; ?>>Yandex</option>
611
+			    <option value="OpenStreetMap"<?php if ($MapType == 'OpenStreetMap') {
612
+	print ' selected';
613
+}
614
+?>>OpenStreetMap</option>
615
+			    <option value="Yandex"<?php if ($MapType == 'Yandex') {
616
+	print ' selected';
617
+}
618
+?>>Yandex</option>
430 619
 			    <?php
431 620
 				}
432 621
 			    ?>
@@ -437,11 +626,26 @@  discard block
 block discarded – undo
437 626
 ?>
438 627
 		    <li><?php echo _("Type of Terrain:"); ?>
439 628
 			<select  class="selectpicker" onchange="terrainType(this);">
440
-			    <option value="world"<?php if (!isset($_COOKIE['MapTerrain']) || $_COOKIE['MapTerrain'] == 'world') print ' selected'; ?>>world terrain</option>
441
-			    <option value="stk"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'stk') print ' selected'; ?>>stk terrain</option>
442
-			    <option value="ellipsoid"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'ellipsoid') print ' selected';?>>ellipsoid</option>
443
-			    <option value="vrterrain"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'vrterrain') print ' selected';?>>vr terrain</option>
444
-			    <option value="articdem"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'articdem') print ' selected';?>>ArticDEM</option>
629
+			    <option value="world"<?php if (!isset($_COOKIE['MapTerrain']) || $_COOKIE['MapTerrain'] == 'world') {
630
+	print ' selected';
631
+}
632
+?>>world terrain</option>
633
+			    <option value="stk"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'stk') {
634
+	print ' selected';
635
+}
636
+?>>stk terrain</option>
637
+			    <option value="ellipsoid"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'ellipsoid') {
638
+	print ' selected';
639
+}
640
+?>>ellipsoid</option>
641
+			    <option value="vrterrain"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'vrterrain') {
642
+	print ' selected';
643
+}
644
+?>>vr terrain</option>
645
+			    <option value="articdem"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'articdem') {
646
+	print ' selected';
647
+}
648
+?>>ArticDEM</option>
445 649
 			</select>
446 650
 		    </li>
447 651
 <?php
@@ -451,64 +655,124 @@  discard block
 block discarded – undo
451 655
 <?php
452 656
     if (isset($globalMap3D) && $globalMap3D) {
453 657
 ?>
454
-		    <li><div class="checkbox"><label><input type="checkbox" name="synchro2d3d" value="1" onclick="clickSyncMap2D3D(this)" <?php if (isset($_COOKIE['Map2D3DSync']) && $_COOKIE['Map2D3DSync'] == 'true') print 'checked'; ?> ><?php echo _("Use same type of map for 2D & 3D"); ?></label></div></li>
658
+		    <li><div class="checkbox"><label><input type="checkbox" name="synchro2d3d" value="1" onclick="clickSyncMap2D3D(this)" <?php if (isset($_COOKIE['Map2D3DSync']) && $_COOKIE['Map2D3DSync'] == 'true') {
659
+	print 'checked';
660
+}
661
+?> ><?php echo _("Use same type of map for 2D & 3D"); ?></label></div></li>
455 662
 <?php
456 663
     }
457 664
 ?>
458 665
 <?php
459 666
     if (!isset($_COOKIE['MapFormat']) || $_COOKIE['MapFormat'] != '3d') {
460 667
 ?>
461
-		    <li><div class="checkbox"><label><input type="checkbox" name="display2dbuildings" value="1" onclick="clickDisplay2DBuildings(this)" <?php if (isset($_COOKIE['Map2DBuildings']) && $_COOKIE['Map2DBuildings'] == 'true') print 'checked'; ?> ><?php echo _("Display 2.5D buidings on map"); ?></label></div></li>
668
+		    <li><div class="checkbox"><label><input type="checkbox" name="display2dbuildings" value="1" onclick="clickDisplay2DBuildings(this)" <?php if (isset($_COOKIE['Map2DBuildings']) && $_COOKIE['Map2DBuildings'] == 'true') {
669
+	print 'checked';
670
+}
671
+?> ><?php echo _("Display 2.5D buidings on map"); ?></label></div></li>
462 672
 
463 673
 <?php
464 674
 	if (!isset($globalAircraft) || $globalAircraft === TRUE) {
465 675
 ?>
466
-		    <!--<li><div class="checkbox"><label><input type="checkbox" name="flightpopup" value="1" onclick="clickFlightPopup(this)" <?php if (isset($_COOKIE['flightpopup']) && $_COOKIE['flightpopup'] == 'true') print 'checked'; ?> ><?php echo _("Display flight info as popup"); ?></label></div></li>-->
467
-		    <li><div class="checkbox"><label><input type="checkbox" name="flightpath" value="1" onclick="clickFlightPath(this)" <?php if ((isset($_COOKIE['flightpath']) && $_COOKIE['flightpath'] == 'true')) print 'checked'; ?> ><?php echo _("Display flight path"); ?></label></div></li>
468
-		    <li><div class="checkbox"><label><input type="checkbox" name="flightroute" value="1" onclick="clickFlightRoute(this)" <?php if ((isset($_COOKIE['MapRoute']) && $_COOKIE['MapRoute'] == 'true') || (!isset($_COOKIE['MapRoute']) && isset($globalMapRoute) && $globalMapRoute)) print 'checked'; ?> ><?php echo _("Display flight route on click"); ?></label></div></li>
469
-		    <li><div class="checkbox"><label><input type="checkbox" name="flightremainingroute" value="1" onclick="clickFlightRemainingRoute(this)" <?php if ((isset($_COOKIE['MapRemainingRoute']) && $_COOKIE['MapRemainingRoute'] == 'true') || (!isset($_COOKIE['MapRemainingRoute']) && isset($globalMapRemainingRoute) && $globalMapRemainingRoute)) print 'checked'; ?> ><?php echo _("Display flight remaining route on click"); ?></label></div></li>
470
-		    <li><div class="checkbox"><label><input type="checkbox" name="flightestimation" value="1" onclick="clickFlightEstimation(this)" <?php if ((isset($_COOKIE['flightestimation']) && $_COOKIE['flightestimation'] == 'true') || (!isset($_COOKIE['flightestimation']) && !isset($globalMapEstimation)) || (!isset($_COOKIE['flightestimation']) && isset($globalMapEstimation) && $globalMapEstimation)) print 'checked'; ?> ><?php echo _("Planes animate between updates"); ?></label></div></li>
676
+		    <!--<li><div class="checkbox"><label><input type="checkbox" name="flightpopup" value="1" onclick="clickFlightPopup(this)" <?php if (isset($_COOKIE['flightpopup']) && $_COOKIE['flightpopup'] == 'true') {
677
+	print 'checked';
678
+}
679
+?> ><?php echo _("Display flight info as popup"); ?></label></div></li>-->
680
+		    <li><div class="checkbox"><label><input type="checkbox" name="flightpath" value="1" onclick="clickFlightPath(this)" <?php if ((isset($_COOKIE['flightpath']) && $_COOKIE['flightpath'] == 'true')) {
681
+	print 'checked';
682
+}
683
+?> ><?php echo _("Display flight path"); ?></label></div></li>
684
+		    <li><div class="checkbox"><label><input type="checkbox" name="flightroute" value="1" onclick="clickFlightRoute(this)" <?php if ((isset($_COOKIE['MapRoute']) && $_COOKIE['MapRoute'] == 'true') || (!isset($_COOKIE['MapRoute']) && isset($globalMapRoute) && $globalMapRoute)) {
685
+	print 'checked';
686
+}
687
+?> ><?php echo _("Display flight route on click"); ?></label></div></li>
688
+		    <li><div class="checkbox"><label><input type="checkbox" name="flightremainingroute" value="1" onclick="clickFlightRemainingRoute(this)" <?php if ((isset($_COOKIE['MapRemainingRoute']) && $_COOKIE['MapRemainingRoute'] == 'true') || (!isset($_COOKIE['MapRemainingRoute']) && isset($globalMapRemainingRoute) && $globalMapRemainingRoute)) {
689
+	print 'checked';
690
+}
691
+?> ><?php echo _("Display flight remaining route on click"); ?></label></div></li>
692
+		    <li><div class="checkbox"><label><input type="checkbox" name="flightestimation" value="1" onclick="clickFlightEstimation(this)" <?php if ((isset($_COOKIE['flightestimation']) && $_COOKIE['flightestimation'] == 'true') || (!isset($_COOKIE['flightestimation']) && !isset($globalMapEstimation)) || (!isset($_COOKIE['flightestimation']) && isset($globalMapEstimation) && $globalMapEstimation)) {
693
+	print 'checked';
694
+}
695
+?> ><?php echo _("Planes animate between updates"); ?></label></div></li>
471 696
 <?php
472 697
 	} elseif (!isset($globalTracker) || $globalTracker === TRUE) {
473 698
 ?>
474
-		    <li><div class="checkbox"><label><input type="checkbox" name="mapmatching" value="1" onclick="clickMapMatching(this)" <?php if ((isset($_COOKIE['mapmatching']) && $_COOKIE['mapmatching'] == 'true') || (!isset($_COOKIE['mapmatching']) && isset($globalMapMatching) && $globalMapMatching)) print 'checked'; ?> ><?php echo _("Enable map matching"); ?></label></div></li>
699
+		    <li><div class="checkbox"><label><input type="checkbox" name="mapmatching" value="1" onclick="clickMapMatching(this)" <?php if ((isset($_COOKIE['mapmatching']) && $_COOKIE['mapmatching'] == 'true') || (!isset($_COOKIE['mapmatching']) && isset($globalMapMatching) && $globalMapMatching)) {
700
+	print 'checked';
701
+}
702
+?> ><?php echo _("Enable map matching"); ?></label></div></li>
475 703
 <?php
476 704
 	}
477 705
 	if (isset($globalSatellite) && $globalSatellite === TRUE) {
478 706
 ?>
479
-		    <li><div class="checkbox"><label><input type="checkbox" name="satelliteestimation" value="1" onclick="clickSatelliteEstimation(this)" <?php if ((isset($_COOKIE['satelliteestimation']) && $_COOKIE['satelliteestimation'] == 'true') || (!isset($_COOKIE['satelliteestimation']) && !isset($globalMapEstimation)) || (!isset($_COOKIE['satelliteestimation']) && isset($globalMapEstimation) && $globalMapEstimation)) print 'checked'; ?> ><?php echo _("Satellites animate between updates"); ?></label></div></li>
707
+		    <li><div class="checkbox"><label><input type="checkbox" name="satelliteestimation" value="1" onclick="clickSatelliteEstimation(this)" <?php if ((isset($_COOKIE['satelliteestimation']) && $_COOKIE['satelliteestimation'] == 'true') || (!isset($_COOKIE['satelliteestimation']) && !isset($globalMapEstimation)) || (!isset($_COOKIE['satelliteestimation']) && isset($globalMapEstimation) && $globalMapEstimation)) {
708
+	print 'checked';
709
+}
710
+?> ><?php echo _("Satellites animate between updates"); ?></label></div></li>
480 711
 <?php
481 712
 	}
482 713
     }
483 714
     if (!isset($globalAircraft) || $globalAircraft === TRUE) {
484 715
 ?>
485
-		    <li><div class="checkbox"><label><input type="checkbox" name="displayairports" value="1" onclick="clickDisplayAirports(this)" <?php if (isset($_COOKIE['displayairports']) && $_COOKIE['displayairports'] == 'true' || !isset($_COOKIE['displayairports'])) print 'checked'; ?> ><?php echo _("Display airports on map"); ?></label></div></li>
716
+		    <li><div class="checkbox"><label><input type="checkbox" name="displayairports" value="1" onclick="clickDisplayAirports(this)" <?php if (isset($_COOKIE['displayairports']) && $_COOKIE['displayairports'] == 'true' || !isset($_COOKIE['displayairports'])) {
717
+	print 'checked';
718
+}
719
+?> ><?php echo _("Display airports on map"); ?></label></div></li>
486 720
 <?php
487 721
     }
488 722
 ?>
489
-		    <li><div class="checkbox"><label><input type="checkbox" name="displaygroundstation" value="1" onclick="clickDisplayGroundStation(this)" <?php if ((isset($_COOKIE['show_GroundStation']) && $_COOKIE['show_GroundStation'] == 'true') || (!isset($_COOKIE['show_GroundStation']) && (isset($globalMapGroundStation) && $globalMapGroundStation === TRUE))) print 'checked'; ?> ><?php echo _("Display ground station on map"); ?></label></div></li>
490
-		    <li><div class="checkbox"><label><input type="checkbox" name="displayweatherstation" value="1" onclick="clickDisplayWeatherStation(this)" <?php if ((isset($_COOKIE['show_WeatherStation']) && $_COOKIE['show_WeatherStation'] == 'true') || (!isset($_COOKIE['show_WeatherStation']) && (isset($globalMapWeatherStation) && $globalMapWeatherStation === TRUE))) print 'checked'; ?> ><?php echo _("Display weather station on map"); ?></label></div></li>
491
-		    <li><div class="checkbox"><label><input type="checkbox" name="displaylightning" value="1" onclick="clickDisplayLightning(this)" <?php if ((isset($_COOKIE['show_Lightning']) && $_COOKIE['show_Lightning'] == 'true') || (!isset($_COOKIE['show_Lightning']) && (isset($globalMapLightning) && $globalMapLightning === TRUE))) print 'checked'; ?> ><?php echo _("Display lightning on map"); ?></label></div></li>
723
+		    <li><div class="checkbox"><label><input type="checkbox" name="displaygroundstation" value="1" onclick="clickDisplayGroundStation(this)" <?php if ((isset($_COOKIE['show_GroundStation']) && $_COOKIE['show_GroundStation'] == 'true') || (!isset($_COOKIE['show_GroundStation']) && (isset($globalMapGroundStation) && $globalMapGroundStation === TRUE))) {
724
+	print 'checked';
725
+}
726
+?> ><?php echo _("Display ground station on map"); ?></label></div></li>
727
+		    <li><div class="checkbox"><label><input type="checkbox" name="displayweatherstation" value="1" onclick="clickDisplayWeatherStation(this)" <?php if ((isset($_COOKIE['show_WeatherStation']) && $_COOKIE['show_WeatherStation'] == 'true') || (!isset($_COOKIE['show_WeatherStation']) && (isset($globalMapWeatherStation) && $globalMapWeatherStation === TRUE))) {
728
+	print 'checked';
729
+}
730
+?> ><?php echo _("Display weather station on map"); ?></label></div></li>
731
+		    <li><div class="checkbox"><label><input type="checkbox" name="displaylightning" value="1" onclick="clickDisplayLightning(this)" <?php if ((isset($_COOKIE['show_Lightning']) && $_COOKIE['show_Lightning'] == 'true') || (!isset($_COOKIE['show_Lightning']) && (isset($globalMapLightning) && $globalMapLightning === TRUE))) {
732
+	print 'checked';
733
+}
734
+?> ><?php echo _("Display lightning on map"); ?></label></div></li>
492 735
 <?php
493 736
 	if (isset($globalFires) && $globalFires) {
494 737
 ?>
495
-		    <li><div class="checkbox"><label><input type="checkbox" name="displayfires" value="1" onclick="clickDisplayFires(this)" <?php if ((isset($_COOKIE['show_Fires']) && $_COOKIE['show_Fires'] == 'true') || (!isset($_COOKIE['show_Fires']) && (isset($globalMapFires) && $globalMapFires === TRUE))) print 'checked'; ?> ><?php echo _("Display fires on map"); ?></label></div></li>
738
+		    <li><div class="checkbox"><label><input type="checkbox" name="displayfires" value="1" onclick="clickDisplayFires(this)" <?php if ((isset($_COOKIE['show_Fires']) && $_COOKIE['show_Fires'] == 'true') || (!isset($_COOKIE['show_Fires']) && (isset($globalMapFires) && $globalMapFires === TRUE))) {
739
+	print 'checked';
740
+}
741
+?> ><?php echo _("Display fires on map"); ?></label></div></li>
496 742
 <?php
497 743
 	}
498 744
 	if (isset($globalMap3D) && $globalMap3D) {
499 745
 ?>
500
-		    <li><div class="checkbox"><label><input type="checkbox" name="singlemodel" value="1" onclick="clickSingleModel(this)" <?php if ((isset($_COOKIE['singlemodel']) && $_COOKIE['singlemodel'] == 'true') || (!isset($_COOKIE['singlemodel']) && isset($globalMap3DSelected) && $globalMap3DSelected)) print 'checked'; ?> ><?php echo _("Only display selected flight on 3D mode"); ?></label></div></li>
746
+		    <li><div class="checkbox"><label><input type="checkbox" name="singlemodel" value="1" onclick="clickSingleModel(this)" <?php if ((isset($_COOKIE['singlemodel']) && $_COOKIE['singlemodel'] == 'true') || (!isset($_COOKIE['singlemodel']) && isset($globalMap3DSelected) && $globalMap3DSelected)) {
747
+	print 'checked';
748
+}
749
+?> ><?php echo _("Only display selected flight on 3D mode"); ?></label></div></li>
501 750
 <?php
502 751
 	}
503 752
 ?>
504
-		    <li><div class="checkbox"><label><input type="checkbox" name="truelight" value="1" onclick="clickTrueLight(this)" <?php if ((!isset($_COOKIE['truelight']) && (!isset($globalMapTrueLight) || $globalMapTrueLight)) || (isset($_COOKIE['truelight']) && $_COOKIE['truelight'] == 'true')) print 'checked'; ?> ><?php echo _("Enable globe sun lighting"); ?></label></div></li>
753
+		    <li><div class="checkbox"><label><input type="checkbox" name="truelight" value="1" onclick="clickTrueLight(this)" <?php if ((!isset($_COOKIE['truelight']) && (!isset($globalMapTrueLight) || $globalMapTrueLight)) || (isset($_COOKIE['truelight']) && $_COOKIE['truelight'] == 'true')) {
754
+	print 'checked';
755
+}
756
+?> ><?php echo _("Enable globe sun lighting"); ?></label></div></li>
505 757
 <?php
506 758
     if (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d') {
507 759
 ?>
508
-		    <li><div class="checkbox"><label><input type="checkbox" name="displayminimap" value="1" onclick="clickDisplayMinimap(this)" <?php if (!isset($_COOKIE['displayminimap']) || (isset($_COOKIE['displayminimap']) && $_COOKIE['displayminimap'] == 'true')) print 'checked'; ?> ><?php echo _("Show mini-map"); ?></label></div></li>
509
-		    <li><div class="checkbox"><label><input type="checkbox" name="shadows" value="1" onclick="clickShadows(this)" <?php if ((!isset($_COOKIE['map3dnoshadows']) && (!isset($globalMap3DShadows) || $globalMap3DShadows)) || (isset($_COOKIE['map3dnoshadows']) && $_COOKIE['map3dnoshadows'] == 'false')) print 'checked'; ?> ><?php echo _("Use shadows"); ?></label></div></li>
510
-		    <li><div class="checkbox"><label><input type="checkbox" name="one3dmodel" value="1" onclick="useOne3Dmodel(this)" <?php if ((isset($_COOKIE['one3dmodel']) && $_COOKIE['one3dmodel'] == 'true') || (!isset($_COOKIE['one3dmodel']) && isset($globalMap3DOneModel) && $globalMap3DOneModel)) print 'checked'; ?> ><?php echo _("Use same 3D model for all aircraft (use fewer resources)"); ?></label></div></li>
511
-		    <li><div class="checkbox"><label><input type="checkbox" name="updaterealtime" value="1" onclick="clickUpdateRealtime(this)" <?php if ((isset($_COOKIE['updaterealtime']) && $_COOKIE['updaterealtime'] == 'true') || !isset($_COOKIE['updaterealtime'])) print 'checked'; ?> ><?php echo _("Display realtime data in infobox"); ?></label></div></li>
760
+		    <li><div class="checkbox"><label><input type="checkbox" name="displayminimap" value="1" onclick="clickDisplayMinimap(this)" <?php if (!isset($_COOKIE['displayminimap']) || (isset($_COOKIE['displayminimap']) && $_COOKIE['displayminimap'] == 'true')) {
761
+	print 'checked';
762
+}
763
+?> ><?php echo _("Show mini-map"); ?></label></div></li>
764
+		    <li><div class="checkbox"><label><input type="checkbox" name="shadows" value="1" onclick="clickShadows(this)" <?php if ((!isset($_COOKIE['map3dnoshadows']) && (!isset($globalMap3DShadows) || $globalMap3DShadows)) || (isset($_COOKIE['map3dnoshadows']) && $_COOKIE['map3dnoshadows'] == 'false')) {
765
+	print 'checked';
766
+}
767
+?> ><?php echo _("Use shadows"); ?></label></div></li>
768
+		    <li><div class="checkbox"><label><input type="checkbox" name="one3dmodel" value="1" onclick="useOne3Dmodel(this)" <?php if ((isset($_COOKIE['one3dmodel']) && $_COOKIE['one3dmodel'] == 'true') || (!isset($_COOKIE['one3dmodel']) && isset($globalMap3DOneModel) && $globalMap3DOneModel)) {
769
+	print 'checked';
770
+}
771
+?> ><?php echo _("Use same 3D model for all aircraft (use fewer resources)"); ?></label></div></li>
772
+		    <li><div class="checkbox"><label><input type="checkbox" name="updaterealtime" value="1" onclick="clickUpdateRealtime(this)" <?php if ((isset($_COOKIE['updaterealtime']) && $_COOKIE['updaterealtime'] == 'true') || !isset($_COOKIE['updaterealtime'])) {
773
+	print 'checked';
774
+}
775
+?> ><?php echo _("Display realtime data in infobox"); ?></label></div></li>
512 776
 <?php
513 777
     }
514 778
     if (time() > mktime(0,0,0,12,1,date("Y")) && time() < mktime(0,0,0,12,31,date("Y"))) {
@@ -521,17 +785,25 @@  discard block
 block discarded – undo
521 785
 			if (function_exists('array_column')) {
522 786
 			    if (array_search(TRUE, array_column($globalSources, 'sourcestats')) !== FALSE) {
523 787
 		    ?>
524
-		    <li><div class="checkbox"><label><input type="checkbox" name="flightpolar" value="1" onclick="clickPolar(this)" <?php if ((isset($_COOKIE['polar']) && $_COOKIE['polar'] == 'true')) print 'checked'; ?> ><?php echo _("Display polar on map"); ?></label></div></li>
788
+		    <li><div class="checkbox"><label><input type="checkbox" name="flightpolar" value="1" onclick="clickPolar(this)" <?php if ((isset($_COOKIE['polar']) && $_COOKIE['polar'] == 'true')) {
789
+	print 'checked';
790
+}
791
+?> ><?php echo _("Display polar on map"); ?></label></div></li>
525 792
 		    <?php
526 793
 			    }
527 794
 			} elseif (isset($globalSources)) {
528 795
 			    $dispolar = false;
529 796
 			    foreach ($globalSources as $testsource) {
530
-			        if (isset($globalSources['sourcestats']) && $globalSources['sourcestats'] !== FALSE) $dispolar = true;
797
+			        if (isset($globalSources['sourcestats']) && $globalSources['sourcestats'] !== FALSE) {
798
+			        	$dispolar = true;
799
+			        }
531 800
 			    }
532 801
 			    if ($dispolar) {
533 802
 		    ?>
534
-		    <li><div class="checkbox"><label><input type="checkbox" name="flightpolar" value="1" onclick="clickPolar(this)" <?php if ((isset($_COOKIE['polar']) && $_COOKIE['polar'] == 'true')) print 'checked'; ?> ><?php echo _("Display polar on map"); ?></label></div></li>
803
+		    <li><div class="checkbox"><label><input type="checkbox" name="flightpolar" value="1" onclick="clickPolar(this)" <?php if ((isset($_COOKIE['polar']) && $_COOKIE['polar'] == 'true')) {
804
+	print 'checked';
805
+}
806
+?> ><?php echo _("Display polar on map"); ?></label></div></li>
535 807
 		    <?php
536 808
 			    }
537 809
 		        }
@@ -542,7 +814,14 @@  discard block
 block discarded – undo
542 814
 		    <?php
543 815
 			if (!isset($globalAircraft) || $globalAircraft === TRUE) {
544 816
 		    ?>
545
-		    <li><?php echo _("Max number of flights to display in 2D:"); ?> <input type="number" name="2dlimit" value="<?php if (isset($_COOKIE['map_2d_limit'])) print $_COOKIE['map_2d_limit']; elseif (isset($globalMap2DAircraftsLimit)) print $globalMap2DAircraftsLimit; else print 15000; ?>" onchange="map2dlimit(this.value);" /></li>
817
+		    <li><?php echo _("Max number of flights to display in 2D:"); ?> <input type="number" name="2dlimit" value="<?php if (isset($_COOKIE['map_2d_limit'])) {
818
+	print $_COOKIE['map_2d_limit'];
819
+} elseif (isset($globalMap2DAircraftsLimit)) {
820
+	print $globalMap2DAircraftsLimit;
821
+} else {
822
+	print 15000;
823
+}
824
+?>" onchange="map2dlimit(this.value);" /></li>
546 825
 		    <?php
547 826
 			}
548 827
 		    ?>
@@ -550,11 +829,21 @@  discard block
 block discarded – undo
550 829
 			if (!isset($globalAircraft) || $globalAircraft === TRUE) {
551 830
 		    	    if (extension_loaded('gd') && function_exists('gd_info')) {
552 831
 		    ?>
553
-		    <li><input type="checkbox" name="aircraftcoloraltitude" value="1" onclick="iconColorAltitude(this)" <?php if (isset($_COOKIE['IconColorAltitude']) && $_COOKIE['IconColorAltitude'] == 'true') print 'checked'; ?> ><?php echo _("Aircraft icon color based on altitude"); ?></li>
832
+		    <li><input type="checkbox" name="aircraftcoloraltitude" value="1" onclick="iconColorAltitude(this)" <?php if (isset($_COOKIE['IconColorAltitude']) && $_COOKIE['IconColorAltitude'] == 'true') {
833
+	print 'checked';
834
+}
835
+?> ><?php echo _("Aircraft icon color based on altitude"); ?></li>
554 836
 		    <?php 
555 837
 				if (!isset($_COOKIE['IconColorAltitude']) || $_COOKIE['IconColorAltitude'] == 'false') {
556 838
 		    ?>
557
-			<li><?php echo _("Aircraft icon color:"); ?> <input type="color" name="aircraftcolor" id="html5colorpicker" onchange="iconColor(this.value);" value="#<?php if (isset($_COOKIE['IconColor'])) print $_COOKIE['IconColor']; elseif (isset($globalAircraftIconColor)) print $globalAircraftIconColor; else print '1a3151'; ?>"></li>
839
+			<li><?php echo _("Aircraft icon color:"); ?> <input type="color" name="aircraftcolor" id="html5colorpicker" onchange="iconColor(this.value);" value="#<?php if (isset($_COOKIE['IconColor'])) {
840
+	print $_COOKIE['IconColor'];
841
+} elseif (isset($globalAircraftIconColor)) {
842
+	print $globalAircraftIconColor;
843
+} else {
844
+	print '1a3151';
845
+}
846
+?>"></li>
558 847
 		    <?php
559 848
 				}
560 849
 			    }
@@ -565,7 +854,14 @@  discard block
 block discarded – undo
565 854
 			    if (extension_loaded('gd') && function_exists('gd_info')) {
566 855
 		    ?>
567 856
 		    <li><?php echo _("Marine icon color:"); ?>
568
-			<input type="color" name="marinecolor" id="html5colorpicker" onchange="MarineiconColor(marinecolor.value);" value="#<?php if (isset($_COOKIE['MarineIconColor'])) print $_COOKIE['MarineIconColor']; elseif (isset($globalMarineIconColor)) print $globalMarineIconColor; else print '1a3151'; ?>">
857
+			<input type="color" name="marinecolor" id="html5colorpicker" onchange="MarineiconColor(marinecolor.value);" value="#<?php if (isset($_COOKIE['MarineIconColor'])) {
858
+	print $_COOKIE['MarineIconColor'];
859
+} elseif (isset($globalMarineIconColor)) {
860
+	print $globalMarineIconColor;
861
+} else {
862
+	print '1a3151';
863
+}
864
+?>">
569 865
 		    </li>
570 866
 		    <?php
571 867
 			    }
@@ -576,7 +872,14 @@  discard block
 block discarded – undo
576 872
 			    if (extension_loaded('gd') && function_exists('gd_info')) {
577 873
 		    ?>
578 874
 		    <li><?php echo _("Tracker icon color:"); ?>
579
-			<input type="color" name="trackercolor" id="html5colorpicker" onchange="TrackericonColor(trackercolor.value);" value="#<?php if (isset($_COOKIE['TrackerIconColor'])) print $_COOKIE['TrackerIconColor']; elseif (isset($globalTrackerIconColor)) print $globalTrackerIconColor; else print '1a3151'; ?>">
875
+			<input type="color" name="trackercolor" id="html5colorpicker" onchange="TrackericonColor(trackercolor.value);" value="#<?php if (isset($_COOKIE['TrackerIconColor'])) {
876
+	print $_COOKIE['TrackerIconColor'];
877
+} elseif (isset($globalTrackerIconColor)) {
878
+	print $globalTrackerIconColor;
879
+} else {
880
+	print '1a3151';
881
+}
882
+?>">
580 883
 		    </li>
581 884
 		    <?php
582 885
 			    }
@@ -587,8 +890,22 @@  discard block
 block discarded – undo
587 890
 		    ?>
588 891
 		    <li><?php echo _("Show airport icon at zoom level:"); ?>
589 892
 			<div class="range">
590
-			    <input type="range" min="0" max="19" step="1" name="airportzoom" onchange="range.value=value;airportDisplayZoom(airportzoom.value);" value="<?php if (isset($_COOKIE['AirportZoom'])) print $_COOKIE['AirportZoom']; elseif (isset($globalAirportZoom)) print $globalAirportZoom; else print '7'; ?>">
591
-			    <output id="range"><?php if (isset($_COOKIE['AirportZoom'])) print $_COOKIE['AirportZoom']; elseif (isset($globalAirportZoom)) print $globalAirportZoom; else print '7'; ?></output>
893
+			    <input type="range" min="0" max="19" step="1" name="airportzoom" onchange="range.value=value;airportDisplayZoom(airportzoom.value);" value="<?php if (isset($_COOKIE['AirportZoom'])) {
894
+	print $_COOKIE['AirportZoom'];
895
+} elseif (isset($globalAirportZoom)) {
896
+	print $globalAirportZoom;
897
+} else {
898
+	print '7';
899
+}
900
+?>">
901
+			    <output id="range"><?php if (isset($_COOKIE['AirportZoom'])) {
902
+	print $_COOKIE['AirportZoom'];
903
+} elseif (isset($globalAirportZoom)) {
904
+	print $globalAirportZoom;
905
+} else {
906
+	print '7';
907
+}
908
+?></output>
592 909
 			</div>
593 910
 		    </li>
594 911
 		    <?php
@@ -599,18 +916,48 @@  discard block
 block discarded – undo
599 916
 ?>
600 917
 		    <li><?php echo _("Set scaling factor for rendering resolution:"); ?>
601 918
 			<div class="range">
602
-			    <input type="range" min="0.5" max="2" step="0.5" name="resolutionscale" onchange="scale.value=value;resolutionScale(resolutionscale.value);" value="<?php if (isset($_COOKIE['resolutionScale'])) print $_COOKIE['resolutionScale']; else print '1'; ?>">
603
-			    <output id="scale"><?php if (isset($_COOKIE['resolutionScale'])) print $_COOKIE['resolutionScale']; else print '1'; ?></output>
919
+			    <input type="range" min="0.5" max="2" step="0.5" name="resolutionscale" onchange="scale.value=value;resolutionScale(resolutionscale.value);" value="<?php if (isset($_COOKIE['resolutionScale'])) {
920
+	print $_COOKIE['resolutionScale'];
921
+} else {
922
+	print '1';
923
+}
924
+?>">
925
+			    <output id="scale"><?php if (isset($_COOKIE['resolutionScale'])) {
926
+	print $_COOKIE['resolutionScale'];
927
+} else {
928
+	print '1';
929
+}
930
+?></output>
604 931
 			</div>
605 932
 		    </li>
606 933
 <?php
607 934
 	if (!isset($globalAircraft) || $globalAircraft === TRUE) {
608 935
 ?>
609
-		    <!-- <li><?php echo _("Max number of flights to display in 3D:"); ?> <input type="number" name="3dlimit" value="<?php if (isset($_COOKIE['map_3d_limit'])) print $_COOKIE['map_3d_limit']; elseif (isset($globalMap3DAircraftsLimit)) print $globalMap3DAircraftsLimit; else print 300; ?>" onchange="map3dlimit(this.value);" /></li> -->
610
-		    <li><input type="checkbox" name="useliveries" value="1" onclick="useLiveries(this)" <?php if (isset($_COOKIE['UseLiveries']) && $_COOKIE['UseLiveries'] == 'true') print 'checked'; ?> > <?php echo _("Use airlines liveries"); ?></li>
611
-		    <li><input type="checkbox" name="aircraftcolorforce" value="1" onclick="iconColorForce(this)" <?php if (isset($_COOKIE['IconColorForce']) && $_COOKIE['IconColorForce'] == 'true') print 'checked'; ?> > <?php echo _("Force Aircraft color"); ?>&nbsp;
936
+		    <!-- <li><?php echo _("Max number of flights to display in 3D:"); ?> <input type="number" name="3dlimit" value="<?php if (isset($_COOKIE['map_3d_limit'])) {
937
+	print $_COOKIE['map_3d_limit'];
938
+} elseif (isset($globalMap3DAircraftsLimit)) {
939
+	print $globalMap3DAircraftsLimit;
940
+} else {
941
+	print 300;
942
+}
943
+?>" onchange="map3dlimit(this.value);" /></li> -->
944
+		    <li><input type="checkbox" name="useliveries" value="1" onclick="useLiveries(this)" <?php if (isset($_COOKIE['UseLiveries']) && $_COOKIE['UseLiveries'] == 'true') {
945
+	print 'checked';
946
+}
947
+?> > <?php echo _("Use airlines liveries"); ?></li>
948
+		    <li><input type="checkbox" name="aircraftcolorforce" value="1" onclick="iconColorForce(this)" <?php if (isset($_COOKIE['IconColorForce']) && $_COOKIE['IconColorForce'] == 'true') {
949
+	print 'checked';
950
+}
951
+?> > <?php echo _("Force Aircraft color"); ?>&nbsp;
612 952
 		    <!--<li><?php echo _("Aircraft icon color:"); ?>-->
613
-			<input type="color" name="aircraftcolor" id="html5colorpicker" onchange="iconColor(aircraftcolor.value);" value="#<?php if (isset($_COOKIE['IconColor'])) print $_COOKIE['IconColor']; elseif (isset($globalAircraftIconColor)) print $globalAircraftIconColor; else print 'ff0000'; ?>">
953
+			<input type="color" name="aircraftcolor" id="html5colorpicker" onchange="iconColor(aircraftcolor.value);" value="#<?php if (isset($_COOKIE['IconColor'])) {
954
+	print $_COOKIE['IconColor'];
955
+} elseif (isset($globalAircraftIconColor)) {
956
+	print $globalAircraftIconColor;
957
+} else {
958
+	print 'ff0000';
959
+}
960
+?>">
614 961
 		    </li>
615 962
 <?php
616 963
 	}
@@ -618,9 +965,19 @@  discard block
 block discarded – undo
618 965
 <?php
619 966
 	if (isset($globalMarine) && $globalMarine === TRUE) {
620 967
 ?>
621
-		    <li><input type="checkbox" name="marinecolorforce" value="1" onclick="MarineiconColorForce(this)" <?php if (isset($_COOKIE['MarineIconColorForce']) && $_COOKIE['MarineIconColorForce'] == 'true') print 'checked'; ?> ><?php echo _("Force Marine color"); ?>&nbsp;
968
+		    <li><input type="checkbox" name="marinecolorforce" value="1" onclick="MarineiconColorForce(this)" <?php if (isset($_COOKIE['MarineIconColorForce']) && $_COOKIE['MarineIconColorForce'] == 'true') {
969
+	print 'checked';
970
+}
971
+?> ><?php echo _("Force Marine color"); ?>&nbsp;
622 972
 		    <!--<li><?php echo _("Marine icon color:"); ?>-->
623
-			<input type="color" name="marinecolor" id="html5colorpicker" onchange="MarineiconColor(marinecolor.value);" value="#<?php if (isset($_COOKIE['MarineIconColor'])) print $_COOKIE['MarineIconColor']; elseif (isset($globalMarineIconColor)) print $globalMarineIconColor; else print 'ff0000'; ?>">
973
+			<input type="color" name="marinecolor" id="html5colorpicker" onchange="MarineiconColor(marinecolor.value);" value="#<?php if (isset($_COOKIE['MarineIconColor'])) {
974
+	print $_COOKIE['MarineIconColor'];
975
+} elseif (isset($globalMarineIconColor)) {
976
+	print $globalMarineIconColor;
977
+} else {
978
+	print 'ff0000';
979
+}
980
+?>">
624 981
 		    </li>
625 982
 <?php
626 983
 	}
@@ -628,9 +985,19 @@  discard block
 block discarded – undo
628 985
 <?php
629 986
 	if (isset($globalTracker) && $globalTracker === TRUE) {
630 987
 ?>
631
-		    <li><input type="checkbox" name="trackercolorforce" value="1" onclick="TrackericonColorForce(this)" <?php if (isset($_COOKIE['TrackerIconColorForce']) && $_COOKIE['TrackerIconColorForce'] == 'true') print 'checked'; ?> ><?php echo _("Force Tracker color"); ?>&nbsp;
988
+		    <li><input type="checkbox" name="trackercolorforce" value="1" onclick="TrackericonColorForce(this)" <?php if (isset($_COOKIE['TrackerIconColorForce']) && $_COOKIE['TrackerIconColorForce'] == 'true') {
989
+	print 'checked';
990
+}
991
+?> ><?php echo _("Force Tracker color"); ?>&nbsp;
632 992
 		    <!--<li><?php echo _("Tracker icon color:"); ?>-->
633
-			<input type="color" name="trackercolor" id="html5colorpicker" onchange="TrackericonColor(trackercolor.value);" value="#<?php if (isset($_COOKIE['TrackerIconColor'])) print $_COOKIE['TrackerIconColor']; elseif (isset($globalTrackerIconColor)) print $globalTrackerIconColor; else print 'ff0000'; ?>">
993
+			<input type="color" name="trackercolor" id="html5colorpicker" onchange="TrackericonColor(trackercolor.value);" value="#<?php if (isset($_COOKIE['TrackerIconColor'])) {
994
+	print $_COOKIE['TrackerIconColor'];
995
+} elseif (isset($globalTrackerIconColor)) {
996
+	print $globalTrackerIconColor;
997
+} else {
998
+	print 'ff0000';
999
+}
1000
+?>">
634 1001
 		    </li>
635 1002
 <?php
636 1003
 	}
@@ -638,29 +1005,62 @@  discard block
 block discarded – undo
638 1005
 ?>
639 1006
 		    <li><?php echo _("Distance unit:"); ?>
640 1007
 			<select class="selectpicker" onchange="unitdistance(this);">
641
-			    <option value="km"<?php if ((!isset($_COOKIE['unitdistance']) && (!isset($globalUnitDistance) || (isset($globalUnitDistance) && $globalUnitDistance == 'km'))) || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'km')) echo ' selected'; ?>>km</option>
642
-			    <option value="nm"<?php if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'nm') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'nm')) echo ' selected'; ?>>nm</option>
643
-			    <option value="mi"<?php if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'mi') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'mi')) echo ' selected'; ?>>mi</option>
1008
+			    <option value="km"<?php if ((!isset($_COOKIE['unitdistance']) && (!isset($globalUnitDistance) || (isset($globalUnitDistance) && $globalUnitDistance == 'km'))) || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'km')) {
1009
+	echo ' selected';
1010
+}
1011
+?>>km</option>
1012
+			    <option value="nm"<?php if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'nm') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'nm')) {
1013
+	echo ' selected';
1014
+}
1015
+?>>nm</option>
1016
+			    <option value="mi"<?php if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'mi') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'mi')) {
1017
+	echo ' selected';
1018
+}
1019
+?>>mi</option>
644 1020
 		        </select>
645 1021
 		    </li>
646 1022
 		    <li><?php echo _("Altitude unit:"); ?>
647 1023
 			<select class="selectpicker" onchange="unitaltitude(this);">
648
-			    <option value="m"<?php if ((!isset($_COOKIE['unitaltitude']) && (!isset($globalUnitAltitude) || (isset($globalUnitAltitude) && $globalUnitAltitude == 'm'))) || (isset($_COOKIE['unitaltitude']) && $_COOKIE['unitaltitude'] == 'm')) echo ' selected'; ?>>m</option>
649
-			    <option value="feet"<?php if ((!isset($_COOKIE['unitaltitude']) && isset($globalUnitAltitude) && $globalUnitAltitude == 'feet') || (isset($_COOKIE['unitaltitude']) && $_COOKIE['unitaltitude'] == 'feet')) echo ' selected'; ?>>feet</option>
1024
+			    <option value="m"<?php if ((!isset($_COOKIE['unitaltitude']) && (!isset($globalUnitAltitude) || (isset($globalUnitAltitude) && $globalUnitAltitude == 'm'))) || (isset($_COOKIE['unitaltitude']) && $_COOKIE['unitaltitude'] == 'm')) {
1025
+	echo ' selected';
1026
+}
1027
+?>>m</option>
1028
+			    <option value="feet"<?php if ((!isset($_COOKIE['unitaltitude']) && isset($globalUnitAltitude) && $globalUnitAltitude == 'feet') || (isset($_COOKIE['unitaltitude']) && $_COOKIE['unitaltitude'] == 'feet')) {
1029
+	echo ' selected';
1030
+}
1031
+?>>feet</option>
650 1032
 		        </select>
651 1033
 		    </li>
652 1034
 		    <li><?php echo _("Speed unit:"); ?>
653 1035
 			<select class="selectpicker" onchange="unitspeed(this);">
654
-			    <option value="kmh"<?php if ((!isset($_COOKIE['unitspeed']) && (!isset($globalUnitSpeed) || (isset($globalUnitSpeed) && $globalUnitSpeed == 'kmh'))) || (isset($_COOKIE['unitspeed']) && $_COOKIE['unitspeed'] == 'kmh')) echo ' selected'; ?>>km/h</option>
655
-			    <option value="mph"<?php if ((!isset($_COOKIE['unitspeed']) && isset($globalUnitSpeed) && $globalUnitSpeed == 'mph') || (isset($_COOKIE['unitspeed']) && $_COOKIE['unitspeed'] == 'mph')) echo ' selected'; ?>>mph</option>
656
-			    <option value="knots"<?php if ((!isset($_COOKIE['unitspeed']) && isset($globalUnitSpeed) && $globalUnitSpeed == 'knots') || (isset($_COOKIE['unitspeed']) && $_COOKIE['unitspeed'] == 'knots')) echo ' selected'; ?>>knots</option>
1036
+			    <option value="kmh"<?php if ((!isset($_COOKIE['unitspeed']) && (!isset($globalUnitSpeed) || (isset($globalUnitSpeed) && $globalUnitSpeed == 'kmh'))) || (isset($_COOKIE['unitspeed']) && $_COOKIE['unitspeed'] == 'kmh')) {
1037
+	echo ' selected';
1038
+}
1039
+?>>km/h</option>
1040
+			    <option value="mph"<?php if ((!isset($_COOKIE['unitspeed']) && isset($globalUnitSpeed) && $globalUnitSpeed == 'mph') || (isset($_COOKIE['unitspeed']) && $_COOKIE['unitspeed'] == 'mph')) {
1041
+	echo ' selected';
1042
+}
1043
+?>>mph</option>
1044
+			    <option value="knots"<?php if ((!isset($_COOKIE['unitspeed']) && isset($globalUnitSpeed) && $globalUnitSpeed == 'knots') || (isset($_COOKIE['unitspeed']) && $_COOKIE['unitspeed'] == 'knots')) {
1045
+	echo ' selected';
1046
+}
1047
+?>>knots</option>
657 1048
 		        </select>
658 1049
 		    </li>
659 1050
 		    <li><?php echo _("Coordinate unit:"); ?>
660 1051
 			<select class="selectpicker" onchange="unitcoordinate(this);">
661
-			    <option value="dd"<?php if ((!isset($_COOKIE['unitcoordinate']) && (!isset($globalUnitCoordinate) || (isset($globalUnitCoordinate) && $globalUnitCoordinate == 'dd'))) || (isset($_COOKIE['unitcoordinate']) && $_COOKIE['unitcoordinate'] == 'dd')) echo ' selected'; ?>>DD</option>
662
-			    <option value="dms"<?php if ((!isset($_COOKIE['unitcoordinate']) && isset($globalUnitCoordinate) && $globalUnitCoordinate == 'dms') || (isset($_COOKIE['unitcoordinate']) && $_COOKIE['unitcoordinate'] == 'dms')) echo ' selected'; ?>>DMS</option>
663
-			    <option value="dm"<?php if ((!isset($_COOKIE['unitcoordinate']) && isset($globalUnitCoordinate) && $globalUnitCoordinate == 'dm') || (isset($_COOKIE['unitcoordinate']) && $_COOKIE['unitcoordinate'] == 'dm')) echo ' selected'; ?>>DM</option>
1052
+			    <option value="dd"<?php if ((!isset($_COOKIE['unitcoordinate']) && (!isset($globalUnitCoordinate) || (isset($globalUnitCoordinate) && $globalUnitCoordinate == 'dd'))) || (isset($_COOKIE['unitcoordinate']) && $_COOKIE['unitcoordinate'] == 'dd')) {
1053
+	echo ' selected';
1054
+}
1055
+?>>DD</option>
1056
+			    <option value="dms"<?php if ((!isset($_COOKIE['unitcoordinate']) && isset($globalUnitCoordinate) && $globalUnitCoordinate == 'dms') || (isset($_COOKIE['unitcoordinate']) && $_COOKIE['unitcoordinate'] == 'dms')) {
1057
+	echo ' selected';
1058
+}
1059
+?>>DMS</option>
1060
+			    <option value="dm"<?php if ((!isset($_COOKIE['unitcoordinate']) && isset($globalUnitCoordinate) && $globalUnitCoordinate == 'dm') || (isset($_COOKIE['unitcoordinate']) && $_COOKIE['unitcoordinate'] == 'dm')) {
1061
+	echo ' selected';
1062
+}
1063
+?>>DM</option>
664 1064
 		        </select>
665 1065
 		    </li>
666 1066
 
@@ -678,9 +1078,18 @@  discard block
 block discarded – undo
678 1078
 		    <?php
679 1079
 			if (((isset($globalVATSIM) && $globalVATSIM) || isset($globalIVAO) && $globalIVAO || isset($globalphpVMS) && $globalphpVMS) && (!isset($globalMapVAchoose) || $globalMapVAchoose)) {
680 1080
 		    ?>
681
-			<?php if (isset($globalVATSIM) && $globalVATSIM) { ?><li><input type="checkbox" name="vatsim" value="1" onclick="clickVATSIM(this)" <?php if ((isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') || !isset($_COOKIE['filter_ShowVATSIM'])) print 'checked'; ?> ><?php echo _("Display VATSIM data"); ?></li><?php } ?>
682
-			<?php if (isset($globalIVAO) && $globalIVAO) { ?><li><input type="checkbox" name="ivao" value="1" onclick="clickIVAO(this)" <?php if ((isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') || !isset($_COOKIE['filter_ShowIVAO'])) print 'checked'; ?> ><?php echo _("Display IVAO data"); ?></li><?php } ?>
683
-			<?php if (isset($globalphpVMS) && $globalphpVMS) { ?><li><input type="checkbox" name="phpvms" value="1" onclick="clickphpVMS(this)" <?php if ((isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') || !isset($_COOKIE['filter_ShowVMS'])) print 'checked'; ?> ><?php echo _("Display phpVMS data"); ?></li><?php } ?>
1081
+			<?php if (isset($globalVATSIM) && $globalVATSIM) { ?><li><input type="checkbox" name="vatsim" value="1" onclick="clickVATSIM(this)" <?php if ((isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') || !isset($_COOKIE['filter_ShowVATSIM'])) {
1082
+	print 'checked';
1083
+}
1084
+?> ><?php echo _("Display VATSIM data"); ?></li><?php } ?>
1085
+			<?php if (isset($globalIVAO) && $globalIVAO) { ?><li><input type="checkbox" name="ivao" value="1" onclick="clickIVAO(this)" <?php if ((isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') || !isset($_COOKIE['filter_ShowIVAO'])) {
1086
+	print 'checked';
1087
+}
1088
+?> ><?php echo _("Display IVAO data"); ?></li><?php } ?>
1089
+			<?php if (isset($globalphpVMS) && $globalphpVMS) { ?><li><input type="checkbox" name="phpvms" value="1" onclick="clickphpVMS(this)" <?php if ((isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') || !isset($_COOKIE['filter_ShowVMS'])) {
1090
+	print 'checked';
1091
+}
1092
+?> ><?php echo _("Display phpVMS data"); ?></li><?php } ?>
684 1093
 		    <?php
685 1094
 			}
686 1095
 		    ?>
@@ -688,12 +1097,21 @@  discard block
 block discarded – undo
688 1097
 			if (!(isset($globalVA) && $globalVA) && !(isset($globalVATSIM) && $globalVATSIM) && !(isset($globalIVAO) && $globalIVAO) && !(isset($globalphpVMS) && $globalphpVMS) && isset($globalSBS1) && $globalSBS1 && isset($globalAPRS) && $globalAPRS && (!isset($globalMapchoose) || $globalMapchoose)) {
689 1098
 		    ?>
690 1099
 			<?php if (isset($globalSBS1) && $globalSBS1) { ?>
691
-			    <li><div class="checkbox"><label><input type="checkbox" name="sbs" value="1" onclick="clickSBS1(this)" <?php if ((isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') || !isset($_COOKIE['filter_ShowSBS1'])) print 'checked'; ?> ><?php echo _("Display ADS-B data"); ?></label></div></li>
1100
+			    <li><div class="checkbox"><label><input type="checkbox" name="sbs" value="1" onclick="clickSBS1(this)" <?php if ((isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') || !isset($_COOKIE['filter_ShowSBS1'])) {
1101
+	print 'checked';
1102
+}
1103
+?> ><?php echo _("Display ADS-B data"); ?></label></div></li>
692 1104
 			<?php } ?>
693 1105
 			<?php if (isset($globalAPRS) && $globalAPRS) { ?>
694
-			    <li><div class="checkbox"><label><input type="checkbox" name="aprs" value="1" onclick="clickAPRS(this)" <?php if ((isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') || !isset($_COOKIE['filter_ShowAPRS'])) print 'checked'; ?> ><?php echo _("Display APRS data"); ?></label></div></li>
1106
+			    <li><div class="checkbox"><label><input type="checkbox" name="aprs" value="1" onclick="clickAPRS(this)" <?php if ((isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') || !isset($_COOKIE['filter_ShowAPRS'])) {
1107
+	print 'checked';
1108
+}
1109
+?> ><?php echo _("Display APRS data"); ?></label></div></li>
695 1110
 			<?php } ?>
696
-			<li><div class="checkbox"><label><input type="checkbox" name="blocked" value="1" onclick="clickBlocked(this)" <?php if (isset($_COOKIE['filter_blocked']) && $_COOKIE['filter_blocked'] == 'true') print 'checked'; ?> ><?php echo _("Only display FAA ASDI blocked aircrafts"); ?></label></div></li>
1111
+			<li><div class="checkbox"><label><input type="checkbox" name="blocked" value="1" onclick="clickBlocked(this)" <?php if (isset($_COOKIE['filter_blocked']) && $_COOKIE['filter_blocked'] == 'true') {
1112
+	print 'checked';
1113
+}
1114
+?> ><?php echo _("Only display FAA ASDI blocked aircrafts"); ?></label></div></li>
697 1115
 		    <?php
698 1116
 			}
699 1117
 		    ?>
@@ -709,7 +1127,9 @@  discard block
 block discarded – undo
709 1127
 				}
710 1128
 				foreach($allairlinenames as $airline) {
711 1129
 					$airline_name = $airline['airline_name'];
712
-					if (strlen($airline_name) > 30) $airline_name = substr($airline_name,0,30).'...';
1130
+					if (strlen($airline_name) > 30) {
1131
+						$airline_name = substr($airline_name,0,30).'...';
1132
+					}
713 1133
 					if (isset($_COOKIE['filter_Airlines']) && in_array($airline['airline_icao'],explode(',',$_COOKIE['filter_Airlines']))) {
714 1134
 						echo '<option value="'.$airline['airline_icao'].'" selected>'.$airline_name.'</option>';
715 1135
 					} else {
@@ -727,7 +1147,10 @@  discard block
 block discarded – undo
727 1147
 		    <li><?php echo _("Display alliance:"); ?>
728 1148
 		    <br/>
729 1149
 			<select class="selectpicker" onchange="alliance(this);" id="display_alliance">
730
-			    <option value="all"<?php if (!isset($_COOKIE['filter_alliance']) || $_COOKIE['filter_alliance'] == 'all' || $_COOKIE['filter_alliance'] == '') echo ' selected'; ?>><?php echo _("All"); ?></option>
1150
+			    <option value="all"<?php if (!isset($_COOKIE['filter_alliance']) || $_COOKIE['filter_alliance'] == 'all' || $_COOKIE['filter_alliance'] == '') {
1151
+	echo ' selected';
1152
+}
1153
+?>><?php echo _("All"); ?></option>
731 1154
 			    <?php
732 1155
 				foreach($allalliancenames as $alliance) {
733 1156
 					$alliance_name = $alliance['alliance'];
@@ -786,10 +1209,22 @@  discard block
 block discarded – undo
786 1209
 		    ?>
787 1210
 		    <li><?php echo _("Display airlines of type:"); ?><br/>
788 1211
 			<select class="selectpicker" onchange="airlinestype(this);">
789
-			    <option value="all"<?php if (!isset($_COOKIE['filter_airlinestype']) || $_COOKIE['filter_airlinestype'] == 'all' || $_COOKIE['filter_airlinestype'] == '') echo ' selected'; ?>><?php echo _("All"); ?></option>
790
-			    <option value="passenger"<?php if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] == 'passenger') echo ' selected'; ?>><?php echo _("Passenger"); ?></option>
791
-			    <option value="cargo"<?php if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] == 'cargo') echo ' selected'; ?>><?php echo _("Cargo"); ?></option>
792
-			    <option value="military"<?php if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] == 'military') echo ' selected'; ?>><?php echo _("Military"); ?></option>
1212
+			    <option value="all"<?php if (!isset($_COOKIE['filter_airlinestype']) || $_COOKIE['filter_airlinestype'] == 'all' || $_COOKIE['filter_airlinestype'] == '') {
1213
+	echo ' selected';
1214
+}
1215
+?>><?php echo _("All"); ?></option>
1216
+			    <option value="passenger"<?php if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] == 'passenger') {
1217
+	echo ' selected';
1218
+}
1219
+?>><?php echo _("Passenger"); ?></option>
1220
+			    <option value="cargo"<?php if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] == 'cargo') {
1221
+	echo ' selected';
1222
+}
1223
+?>><?php echo _("Cargo"); ?></option>
1224
+			    <option value="military"<?php if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] == 'military') {
1225
+	echo ' selected';
1226
+}
1227
+?>><?php echo _("Military"); ?></option>
793 1228
 			</select>
794 1229
 		    </li>
795 1230
 		    <?php
@@ -803,7 +1238,10 @@  discard block
 block discarded – undo
803 1238
 		    ?>
804 1239
 		    <li>
805 1240
 			<?php echo _("Display vessels with MMSI:"); ?>
806
-			<input type="text" name="mmsifilter" onchange="mmsifilter();" id="mmsifilter" value="<?php if (isset($_COOKIE['filter_mmsi'])) print $_COOKIE['filter_mmsi']; ?>" />
1241
+			<input type="text" name="mmsifilter" onchange="mmsifilter();" id="mmsifilter" value="<?php if (isset($_COOKIE['filter_mmsi'])) {
1242
+	print $_COOKIE['filter_mmsi'];
1243
+}
1244
+?>" />
807 1245
 		    </li>
808 1246
 			<?php
809 1247
 				if (isset($globalVM) && $globalVM) {
@@ -834,7 +1272,10 @@  discard block
 block discarded – undo
834 1272
 		    ?>
835 1273
 		    <li>
836 1274
 			<?php echo _("Display with ident:"); ?>
837
-			<input type="text" name="identfilter" onchange="identfilter();" id="identfilter" value="<?php if (isset($_COOKIE['filter_ident'])) print $_COOKIE['filter_ident']; ?>" />
1275
+			<input type="text" name="identfilter" onchange="identfilter();" id="identfilter" value="<?php if (isset($_COOKIE['filter_ident'])) {
1276
+	print $_COOKIE['filter_ident'];
1277
+}
1278
+?>" />
838 1279
 		    </li>
839 1280
 		</ul>
840 1281
 	    </form>
@@ -850,7 +1291,10 @@  discard block
 block discarded – undo
850 1291
 	    <h1 class="sidebar-header"><?php echo _("Satellites"); ?><span class="sidebar-close"><i class="fa fa-caret-left"></i></span></h1>
851 1292
 	    <form>
852 1293
 		<ul>
853
-		    <li><div class="checkbox"><label><input type="checkbox" name="displayiss" value="1" onclick="clickDisplayISS(this)" <?php if ((isset($_COOKIE['displayiss']) && $_COOKIE['displayiss'] == 'true') || !isset($_COOKIE['displayiss'])) print 'checked'; ?> ><?php echo _("Show ISS, Tiangong-1 and Tiangong-2 on map"); ?></label></div></li>
1294
+		    <li><div class="checkbox"><label><input type="checkbox" name="displayiss" value="1" onclick="clickDisplayISS(this)" <?php if ((isset($_COOKIE['displayiss']) && $_COOKIE['displayiss'] == 'true') || !isset($_COOKIE['displayiss'])) {
1295
+	print 'checked';
1296
+}
1297
+?> ><?php echo _("Show ISS, Tiangong-1 and Tiangong-2 on map"); ?></label></div></li>
854 1298
 		    <li><?php echo _("Type:"); ?>
855 1299
 			<select class="selectpicker" multiple onchange="sattypes(this);">
856 1300
 			    <?php
@@ -858,25 +1302,45 @@  discard block
 block discarded – undo
858 1302
 				$types = $Satellite->get_tle_types();
859 1303
 				foreach ($types as $type) {
860 1304
 					$type_name = $type['tle_type'];
861
-					if ($type_name == 'musson') $type_name = 'Russian LEO Navigation';
862
-					else if ($type_name == 'nnss') $type_name = 'Navi Navigation Satellite System';
863
-					else if ($type_name == 'sbas') $type_name = 'Satellite-Based Augmentation System';
864
-					else if ($type_name == 'glo-ops') $type_name = 'Glonass Operational';
865
-					else if ($type_name == 'gps-ops') $type_name = 'GPS Operational';
866
-					else if ($type_name == 'argos') $type_name = 'ARGOS Data Collection System';
867
-					else if ($type_name == 'tdrss') $type_name = 'Tracking and Data Relay Satellite System';
868
-					else if ($type_name == 'sarsat') $type_name = 'Search & Rescue';
869
-					else if ($type_name == 'dmc') $type_name = 'Disaster Monitoring';
870
-					else if ($type_name == 'resource') $type_name = 'Earth Resources';
871
-					else if ($type_name == 'stations') $type_name = 'Space Stations';
872
-					else if ($type_name == 'geo') $type_name = 'Geostationary';
873
-					else if ($type_name == 'amateur') $type_name = 'Amateur Radio';
874
-					else if ($type_name == 'x-comm') $type_name = 'Experimental';
875
-					else if ($type_name == 'other-comm') $type_name = 'Other Comm';
876
-					else if ($type_name == 'science') $type_name = 'Space & Earth Science';
877
-					else if ($type_name == 'military') $type_name = 'Miscellaneous Military';
878
-					else if ($type_name == 'radar') $type_name = 'Radar Calibration';
879
-					else if ($type_name == 'tle-new') $type_name = 'Last 30 days launches';
1305
+					if ($type_name == 'musson') {
1306
+						$type_name = 'Russian LEO Navigation';
1307
+					} else if ($type_name == 'nnss') {
1308
+						$type_name = 'Navi Navigation Satellite System';
1309
+					} else if ($type_name == 'sbas') {
1310
+						$type_name = 'Satellite-Based Augmentation System';
1311
+					} else if ($type_name == 'glo-ops') {
1312
+						$type_name = 'Glonass Operational';
1313
+					} else if ($type_name == 'gps-ops') {
1314
+						$type_name = 'GPS Operational';
1315
+					} else if ($type_name == 'argos') {
1316
+						$type_name = 'ARGOS Data Collection System';
1317
+					} else if ($type_name == 'tdrss') {
1318
+						$type_name = 'Tracking and Data Relay Satellite System';
1319
+					} else if ($type_name == 'sarsat') {
1320
+						$type_name = 'Search & Rescue';
1321
+					} else if ($type_name == 'dmc') {
1322
+						$type_name = 'Disaster Monitoring';
1323
+					} else if ($type_name == 'resource') {
1324
+						$type_name = 'Earth Resources';
1325
+					} else if ($type_name == 'stations') {
1326
+						$type_name = 'Space Stations';
1327
+					} else if ($type_name == 'geo') {
1328
+						$type_name = 'Geostationary';
1329
+					} else if ($type_name == 'amateur') {
1330
+						$type_name = 'Amateur Radio';
1331
+					} else if ($type_name == 'x-comm') {
1332
+						$type_name = 'Experimental';
1333
+					} else if ($type_name == 'other-comm') {
1334
+						$type_name = 'Other Comm';
1335
+					} else if ($type_name == 'science') {
1336
+						$type_name = 'Space & Earth Science';
1337
+					} else if ($type_name == 'military') {
1338
+						$type_name = 'Miscellaneous Military';
1339
+					} else if ($type_name == 'radar') {
1340
+						$type_name = 'Radar Calibration';
1341
+					} else if ($type_name == 'tle-new') {
1342
+						$type_name = 'Last 30 days launches';
1343
+					}
880 1344
 					
881 1345
 					if (isset($_COOKIE['sattypes']) && in_array($type['tle_type'],explode(',',$_COOKIE['sattypes']))) {
882 1346
 						print '<option value="'.$type['tle_type'].'" selected>'.$type_name.'</option>';
Please login to merge, or discard this patch.
install/index.php 3 patches
Indentation   +42 added lines, -42 removed lines patch added patch discarded remove patch
@@ -229,13 +229,13 @@  discard block
 block discarded – undo
229 229
 			<p>
230 230
 				<label for="siteurl">Site directory</label>
231 231
 				<?php
232
-				    // Try to detect site directory
233
-				    if ((!isset($globalURL) || $globalURL == '') && (!isset($globalDBuser) || $globalDBuser == '')) {
232
+					// Try to detect site directory
233
+					if ((!isset($globalURL) || $globalURL == '') && (!isset($globalDBuser) || $globalDBuser == '')) {
234 234
 					if (isset($_SERVER['REQUEST_URI'])) {
235 235
 						$URL = $_SERVER['REQUEST_URI'];
236 236
 						$globalURL = str_replace('/install','',str_replace('/install/','',str_replace('/install/index.php','',$URL)));
237 237
 					}
238
-				    }
238
+					}
239 239
 				?>
240 240
 				<input type="text" name="siteurl" id="siteurl" value="<?php if (isset($globalURL)) print $globalURL; ?>" />
241 241
 				<p class="help-block">ex : <i>/flightairmap</i> if complete URL is <i>http://toto.com/flightairmap</i></p>
@@ -416,17 +416,17 @@  discard block
 block discarded – undo
416 416
 				</thead>
417 417
 				<tbody>
418 418
 		<?php
419
-		    if (isset($globalDBuser) && isset($globalDBpass) && $globalDBuser != '' && $globalDBpass != '') {
419
+			if (isset($globalDBuser) && isset($globalDBpass) && $globalDBuser != '' && $globalDBpass != '') {
420 420
 		?>
421 421
 		<!--
422 422
 		<?php
423
-			    require_once(dirname(__FILE__).'/../require/class.Connection.php');
424
-			    $Connection = new Connection();
423
+				require_once(dirname(__FILE__).'/../require/class.Connection.php');
424
+				$Connection = new Connection();
425 425
 		?>
426 426
 		-->
427 427
 		<?php
428 428
 			if ($Connection->db != NULL) {
429
-			    if ($Connection->tableExists('source_location')) {
429
+				if ($Connection->tableExists('source_location')) {
430 430
 				require_once(dirname(__FILE__).'/../require/class.Source.php');
431 431
 				$Source = new Source();
432 432
 				//$alllocations = $Source->getAllLocationInfo();
@@ -446,9 +446,9 @@  discard block
 block discarded – undo
446 446
 		
447 447
 		<?php
448 448
 				}
449
-			    }
449
+				}
450
+			}
450 451
 			}
451
-		    }
452 452
 		?>
453 453
 
454 454
 				<tr>
@@ -577,12 +577,12 @@  discard block
 block discarded – undo
577 577
 ?>
578 578
 							<tr>
579 579
 								<?php
580
-								    if (filter_var($source['host'],FILTER_VALIDATE_URL)) {
580
+									if (filter_var($source['host'],FILTER_VALIDATE_URL)) {
581 581
 								?>
582 582
 								<td><input type="text" name="host[]" value="<?php print $source['host']; ?>" /></td>
583 583
 								<td><input type="text" name="port[]" class="col-xs-2" value="<?php if (isset($source['port'])) print $source['port']; ?>" /></td>
584 584
 								<?php
585
-								    } else {
585
+									} else {
586 586
 									$hostport = explode(':',$source['host']);
587 587
 									if (isset($hostport[1])) {
588 588
 										$host = $hostport[0];
@@ -595,7 +595,7 @@  discard block
 block discarded – undo
595 595
 								<td><input type="text" name="host[]" value="<?php print $host; ?>" /></td>
596 596
 								<td><input type="text" name="port[]" class="col-xs-2" value="<?php print $port; ?>" /></td>
597 597
 								<?php
598
-								    }
598
+									}
599 599
 								?>
600 600
 								<td>
601 601
 									<select name="format[]">
@@ -740,9 +740,9 @@  discard block
 block discarded – undo
740 740
 			    </thead>
741 741
 			    <tbody>
742 742
 				<?php
743
-				    if (isset($globalNewsFeeds) && !empty($globalNewsFeeds)) {
743
+					if (isset($globalNewsFeeds) && !empty($globalNewsFeeds)) {
744 744
 					foreach ($globalNewsFeeds as $type => $feedslng) {
745
-					    foreach ($feedslng as $lng => $feeds) {
745
+						foreach ($feedslng as $lng => $feeds) {
746 746
 						foreach ($feeds as $feed) {
747 747
 				?>
748 748
 				<tr>
@@ -767,9 +767,9 @@  discard block
 block discarded – undo
767 767
 				
768 768
 				<?php
769 769
 						}
770
-					    }
770
+						}
771
+					}
771 772
 					}
772
-				    }
773 773
 				?>
774 774
 				<tr>
775 775
 				    <td><input type="url" name="newsurl[]" /></td>
@@ -1184,7 +1184,7 @@  discard block
 block discarded – undo
1184 1184
 				<p class="help-block">tsk file can be loaded using http://yourflightairmap/tsk=http://yourtskfile</p>
1185 1185
 			</p>
1186 1186
 			<?php 
1187
-			    if (extension_loaded('gd') && function_exists('gd_info')) {
1187
+				if (extension_loaded('gd') && function_exists('gd_info')) {
1188 1188
 			?>
1189 1189
 			<br />
1190 1190
 			<p>
@@ -1215,14 +1215,14 @@  discard block
 block discarded – undo
1215 1215
 			</p>
1216 1216
 			<?php
1217 1217
 				}
1218
-			    } else {
1218
+				} else {
1219 1219
 			?>
1220 1220
 			<br />
1221 1221
 			<p>
1222 1222
 				<b>PHP GD is not installed, you can't change color of aircraft icon on map</b>
1223 1223
 			</p>
1224 1224
 			<?php
1225
-			    }
1225
+				}
1226 1226
 			?>
1227 1227
 			<br />
1228 1228
 			<p>
@@ -1245,7 +1245,7 @@  discard block
 block discarded – undo
1245 1245
 	</p>
1246 1246
 <?php
1247 1247
 	require('../footer.php');
1248
-        exit;
1248
+		exit;
1249 1249
 }
1250 1250
 // '	
1251 1251
 $settings = array();
@@ -1349,8 +1349,8 @@  discard block
 block discarded – undo
1349 1349
 	
1350 1350
 	$sources = array();
1351 1351
 	foreach ($source_name as $keys => $name) {
1352
-	    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]);
1353
-	    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]);
1352
+		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]);
1353
+		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]);
1354 1354
 	}
1355 1355
 	if (count($sources) > 0) $_SESSION['sources'] = $sources;
1356 1356
 
@@ -1360,13 +1360,13 @@  discard block
 block discarded – undo
1360 1360
 	
1361 1361
 	$newsfeeds = array();
1362 1362
 	foreach($newsurl as $newskey => $url) {
1363
-	    if ($url != '') {
1363
+		if ($url != '') {
1364 1364
 		$type = $newstype[$newskey];
1365 1365
 		$lng = $newslng[$newskey];
1366 1366
 		if (isset($newsfeeds[$type][$lng])) {
1367
-		    $newsfeeds[$type][$lng] = array_merge($newsfeeds[$type][$lng],array($url));
1367
+			$newsfeeds[$type][$lng] = array_merge($newsfeeds[$type][$lng],array($url));
1368 1368
 		} else $newsfeeds[$type][$lng] = array($url);
1369
-	    }
1369
+		}
1370 1370
 	}
1371 1371
 	$settings = array_merge($settings,array('globalNewsFeeds' => $newsfeeds));
1372 1372
 
@@ -1847,14 +1847,14 @@  discard block
 block discarded – undo
1847 1847
 
1848 1848
 	// Set some defaults values...
1849 1849
 	if (!isset($globalAircraftImageSources)) {
1850
-	    $globalAircraftImageSources = array('ivaomtl','wikimedia','airportdata','deviantart','flickr','bing','jetphotos','planepictures','planespotters');
1851
-	    $settings = array_merge($settings,array('globalAircraftImageSources' => $globalAircraftImageSources));
1850
+		$globalAircraftImageSources = array('ivaomtl','wikimedia','airportdata','deviantart','flickr','bing','jetphotos','planepictures','planespotters');
1851
+		$settings = array_merge($settings,array('globalAircraftImageSources' => $globalAircraftImageSources));
1852 1852
 	}
1853 1853
 
1854 1854
 	if (!isset($globalSchedulesSources)) {
1855
-	    $globalSchedulesSources = array('flightmapper','costtotravel','flightradar24','flightaware');
1856
-    	    $settings = array_merge($settings,array('globalSchedulesSources' => $globalSchedulesSources));
1857
-    	}
1855
+		$globalSchedulesSources = array('flightmapper','costtotravel','flightradar24','flightaware');
1856
+			$settings = array_merge($settings,array('globalSchedulesSources' => $globalSchedulesSources));
1857
+		}
1858 1858
 
1859 1859
 	$settings = array_merge($settings,array('globalInstalled' => 'TRUE'));
1860 1860
 
@@ -1902,21 +1902,21 @@  discard block
 block discarded – undo
1902 1902
 	$popi = false;
1903 1903
 	$popw = false;
1904 1904
 	foreach ($_SESSION['done'] as $done) {
1905
-	    print '<li>'.$done.'....<strong>SUCCESS</strong></li>';
1906
-	    if ($done == 'Create database') $pop = true;
1907
-	    if ($_SESSION['install'] == 'database_create') $pop = true;
1908
-	    if ($_SESSION['install'] == 'database_import') $popi = true;
1909
-	    if ($_SESSION['install'] == 'waypoints') $popw = true;
1905
+		print '<li>'.$done.'....<strong>SUCCESS</strong></li>';
1906
+		if ($done == 'Create database') $pop = true;
1907
+		if ($_SESSION['install'] == 'database_create') $pop = true;
1908
+		if ($_SESSION['install'] == 'database_import') $popi = true;
1909
+		if ($_SESSION['install'] == 'waypoints') $popw = true;
1910 1910
 	}
1911 1911
 	if ($pop) {
1912
-	    sleep(5);
1913
-	    print '<li>Create database....<img src="../images/loading.gif" /></li>';
1912
+		sleep(5);
1913
+		print '<li>Create database....<img src="../images/loading.gif" /></li>';
1914 1914
 	} else if ($popi) {
1915
-	    sleep(5);
1916
-	    print '<li>Create and import tables....<img src="../images/loading.gif" /></li>';
1915
+		sleep(5);
1916
+		print '<li>Create and import tables....<img src="../images/loading.gif" /></li>';
1917 1917
 	} else if ($popw) {
1918
-	    sleep(5);
1919
-	    print '<li>Populate waypoints database....<img src="../images/loading.gif" /></li>';
1918
+		sleep(5);
1919
+		print '<li>Populate waypoints database....<img src="../images/loading.gif" /></li>';
1920 1920
 	} else print '<li>Update schema if needed....<img src="../images/loading.gif" /></li>';
1921 1921
 	print '</div></ul>';
1922 1922
 	print '<div id="error"></div>';
@@ -1983,7 +1983,7 @@  discard block
 block discarded – undo
1983 1983
 	unset($_COOKIE['install']);
1984 1984
 	print '<div class="info column"><ul>';
1985 1985
 	foreach ($_SESSION['done'] as $done) {
1986
-	    print '<li>'.$done.'....<strong>SUCCESS</strong></li>';
1986
+		print '<li>'.$done.'....<strong>SUCCESS</strong></li>';
1987 1987
 	}
1988 1988
 	print '<li>Reloading page to check all is now ok....<strong>SUCCESS</strong></li>';
1989 1989
 	print '</ul></div>';
Please login to merge, or discard this patch.
Spacing   +316 added lines, -316 removed lines patch added patch discarded remove patch
@@ -23,13 +23,13 @@  discard block
 block discarded – undo
23 23
 require_once(dirname(__FILE__).'/class.create_db.php');
24 24
 require_once(dirname(__FILE__).'/class.update_schema.php');
25 25
 require_once(dirname(__FILE__).'/class.settings.php');
26
-$title="Install";
26
+$title = "Install";
27 27
 require(dirname(__FILE__).'/../require/settings.php');
28 28
 require_once(dirname(__FILE__).'/../require/class.Common.php');
29 29
 require(dirname(__FILE__).'/header.php');
30 30
 
31 31
 if (!isset($_SESSION['install']) && !isset($_SESSION['identified'])) {
32
-	$password = filter_input(INPUT_POST,'password',FILTER_SANITIZE_STRING);
32
+	$password = filter_input(INPUT_POST, 'password', FILTER_SANITIZE_STRING);
33 33
 	if ($password == '') {
34 34
 		if ($globalInstalled === TRUE && (!isset($globalInstallPassword) || $globalInstallPassword == '')) {
35 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>';
@@ -110,8 +110,8 @@  discard block
 block discarded – undo
110 110
 	if (!file_exists(dirname(__FILE__).'/../.htaccess')) {
111 111
 		$error[] = dirname(__FILE__).'/../.htaccess'." doesn't exist. The provided .htaccess must exist if you use Apache.";
112 112
 	}
113
-	if(function_exists('apache_get_modules') ){
114
-		if(!in_array('mod_rewrite',apache_get_modules())) {
113
+	if (function_exists('apache_get_modules')) {
114
+		if (!in_array('mod_rewrite', apache_get_modules())) {
115 115
 			$error[] = "mod_rewrite is not available.";
116 116
 		}
117 117
 	/*
@@ -130,22 +130,22 @@  discard block
 block discarded – undo
130 130
 		$alllng = $Language->listLocaleDir();
131 131
 		if (count($alllng) != count($availablelng)) {
132 132
 			$notavailable = array();
133
-			foreach($alllng as $lng) {
133
+			foreach ($alllng as $lng) {
134 134
 				if (!isset($availablelng[$lng])) $notavailable[] = $lng;
135 135
 			}
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>';
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>';
137 137
 		}
138 138
 	}
139 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 140
 	if (isset($_SERVER['REQUEST_SCHEME']) && isset($_SERVER['SERVER_NAME']) && isset($_SERVER['SERVER_PORT']) && isset($_SERVER['REQUEST_URI'])) {
141 141
 		if (function_exists('get_headers')) {
142 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")) {
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 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 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")) {
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 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>';
150 150
 				}
151 151
 			}
@@ -233,7 +233,7 @@  discard block
 block discarded – undo
233 233
 				    if ((!isset($globalURL) || $globalURL == '') && (!isset($globalDBuser) || $globalDBuser == '')) {
234 234
 					if (isset($_SERVER['REQUEST_URI'])) {
235 235
 						$URL = $_SERVER['REQUEST_URI'];
236
-						$globalURL = str_replace('/install','',str_replace('/install/','',str_replace('/install/index.php','',$URL)));
236
+						$globalURL = str_replace('/install', '', str_replace('/install/', '', str_replace('/install/index.php', '', $URL)));
237 237
 					}
238 238
 				    }
239 239
 				?>
@@ -583,13 +583,13 @@  discard block
 block discarded – undo
583 583
 ?>
584 584
 							<tr>
585 585
 								<?php
586
-								    if (filter_var($source['host'],FILTER_VALIDATE_URL)) {
586
+								    if (filter_var($source['host'], FILTER_VALIDATE_URL)) {
587 587
 								?>
588 588
 								<td><input type="text" name="host[]" value="<?php print $source['host']; ?>" /></td>
589 589
 								<td><input type="text" name="port[]" class="col-xs-2" value="<?php if (isset($source['port'])) print $source['port']; ?>" /></td>
590 590
 								<?php
591 591
 								    } else {
592
-									$hostport = explode(':',$source['host']);
592
+									$hostport = explode(':', $source['host']);
593 593
 									if (isset($hostport[1])) {
594 594
 										$host = $hostport[0];
595 595
 										$port = $hostport[1];
@@ -644,7 +644,7 @@  discard block
 block discarded – undo
644 644
 									<select name="timezones[]">
645 645
 								<?php
646 646
 									$timezonelist = DateTimeZone::listIdentifiers(DateTimeZone::ALL);
647
-									foreach($timezonelist as $timezones){
647
+									foreach ($timezonelist as $timezones) {
648 648
 										if (isset($source['timezone']) && $source['timezone'] == $timezones) {
649 649
 											print '<option selected>'.$timezones.'</option>';
650 650
 										} elseif (!isset($source['timezone']) && $timezones == 'UTC') {
@@ -704,7 +704,7 @@  discard block
 block discarded – undo
704 704
 									<select name="timezones[]" id="timezones">
705 705
 								<?php
706 706
 									$timezonelist = DateTimeZone::listIdentifiers(DateTimeZone::ALL);
707
-									foreach($timezonelist as $timezones){
707
+									foreach ($timezonelist as $timezones) {
708 708
 										if ($timezones == 'UTC') {
709 709
 											print '<option selected>'.$timezones.'</option>';
710 710
 										} else print '<option>'.$timezones.'</option>';
@@ -1184,7 +1184,7 @@  discard block
 block discarded – undo
1184 1184
 			<br />
1185 1185
 			<p>
1186 1186
 				<label for="aircraftsize">Size of aircraft icon on map (default to 30px if zoom > 7 else 15px), empty to default</label>
1187
-				<input type="number" name="aircraftsize" id="aircraftsize" value="<?php if (isset($globalAircraftSize)) echo $globalAircraftSize;?>" />
1187
+				<input type="number" name="aircraftsize" id="aircraftsize" value="<?php if (isset($globalAircraftSize)) echo $globalAircraftSize; ?>" />
1188 1188
 			</p>
1189 1189
 			<br />
1190 1190
 			<p>
@@ -1267,17 +1267,17 @@  discard block
 block discarded – undo
1267 1267
 $error = '';
1268 1268
 
1269 1269
 if (isset($_POST['dbtype'])) {
1270
-	$installpass = filter_input(INPUT_POST,'installpass',FILTER_SANITIZE_STRING);
1271
-	$settings = array_merge($settings,array('globalInstallPassword' => $installpass));
1270
+	$installpass = filter_input(INPUT_POST, 'installpass', FILTER_SANITIZE_STRING);
1271
+	$settings = array_merge($settings, array('globalInstallPassword' => $installpass));
1272 1272
 
1273
-	$dbtype = filter_input(INPUT_POST,'dbtype',FILTER_SANITIZE_STRING);
1274
-	$dbroot = filter_input(INPUT_POST,'dbroot',FILTER_SANITIZE_STRING);
1275
-	$dbrootpass = filter_input(INPUT_POST,'dbrootpass',FILTER_SANITIZE_STRING);
1276
-	$dbname = filter_input(INPUT_POST,'dbname',FILTER_SANITIZE_STRING);
1277
-	$dbuser = filter_input(INPUT_POST,'dbuser',FILTER_SANITIZE_STRING);
1278
-	$dbuserpass = filter_input(INPUT_POST,'dbuserpass',FILTER_SANITIZE_STRING);
1279
-	$dbhost = filter_input(INPUT_POST,'dbhost',FILTER_SANITIZE_STRING);
1280
-	$dbport = filter_input(INPUT_POST,'dbport',FILTER_SANITIZE_STRING);
1273
+	$dbtype = filter_input(INPUT_POST, 'dbtype', FILTER_SANITIZE_STRING);
1274
+	$dbroot = filter_input(INPUT_POST, 'dbroot', FILTER_SANITIZE_STRING);
1275
+	$dbrootpass = filter_input(INPUT_POST, 'dbrootpass', FILTER_SANITIZE_STRING);
1276
+	$dbname = filter_input(INPUT_POST, 'dbname', FILTER_SANITIZE_STRING);
1277
+	$dbuser = filter_input(INPUT_POST, 'dbuser', FILTER_SANITIZE_STRING);
1278
+	$dbuserpass = filter_input(INPUT_POST, 'dbuserpass', FILTER_SANITIZE_STRING);
1279
+	$dbhost = filter_input(INPUT_POST, 'dbhost', FILTER_SANITIZE_STRING);
1280
+	$dbport = filter_input(INPUT_POST, 'dbport', FILTER_SANITIZE_STRING);
1281 1281
 
1282 1282
 	if ($dbtype == 'mysql' && !extension_loaded('pdo_mysql')) $error .= 'Mysql driver for PDO must be loaded';
1283 1283
 	if ($dbtype == 'pgsql' && !extension_loaded('pdo_pgsql')) $error .= 'PosgreSQL driver for PDO must be loaded';
@@ -1297,60 +1297,60 @@  discard block
 block discarded – undo
1297 1297
 	} else $settings = array_merge($settings,array('globalDBdriver' => $dbtype,'globalDBhost' => $dbhost,'globalDBuser' => $dbuser,'globalDBport' => $dbport,'globalDBpass' => $dbuserpass,'globalDBname' => $dbname));
1298 1298
 	*/
1299 1299
 	
1300
-	$settings = array_merge($settings,array('globalDBdriver' => $dbtype,'globalDBhost' => $dbhost,'globalDBuser' => $dbuser,'globalDBport' => $dbport,'globalDBpass' => $dbuserpass,'globalDBname' => $dbname));
1300
+	$settings = array_merge($settings, array('globalDBdriver' => $dbtype, 'globalDBhost' => $dbhost, 'globalDBuser' => $dbuser, 'globalDBport' => $dbport, 'globalDBpass' => $dbuserpass, 'globalDBname' => $dbname));
1301 1301
 
1302
-	$sitename = filter_input(INPUT_POST,'sitename',FILTER_SANITIZE_STRING);
1303
-	$siteurl = filter_input(INPUT_POST,'siteurl',FILTER_SANITIZE_STRING);
1304
-	$timezone = filter_input(INPUT_POST,'timezone',FILTER_SANITIZE_STRING);
1305
-	$language = filter_input(INPUT_POST,'language',FILTER_SANITIZE_STRING);
1306
-	$settings = array_merge($settings,array('globalName' => $sitename,'globalURL' => $siteurl, 'globalTimezone' => $timezone,'globalLanguage' => $language));
1302
+	$sitename = filter_input(INPUT_POST, 'sitename', FILTER_SANITIZE_STRING);
1303
+	$siteurl = filter_input(INPUT_POST, 'siteurl', FILTER_SANITIZE_STRING);
1304
+	$timezone = filter_input(INPUT_POST, 'timezone', FILTER_SANITIZE_STRING);
1305
+	$language = filter_input(INPUT_POST, 'language', FILTER_SANITIZE_STRING);
1306
+	$settings = array_merge($settings, array('globalName' => $sitename, 'globalURL' => $siteurl, 'globalTimezone' => $timezone, 'globalLanguage' => $language));
1307 1307
 
1308
-	$mapprovider = filter_input(INPUT_POST,'mapprovider',FILTER_SANITIZE_STRING);
1309
-	$mapboxid = filter_input(INPUT_POST,'mapboxid',FILTER_SANITIZE_STRING);
1310
-	$mapboxtoken = filter_input(INPUT_POST,'mapboxtoken',FILTER_SANITIZE_STRING);
1311
-	$googlekey = filter_input(INPUT_POST,'googlekey',FILTER_SANITIZE_STRING);
1312
-	$bingkey = filter_input(INPUT_POST,'bingkey',FILTER_SANITIZE_STRING);
1313
-	$openweathermapkey = filter_input(INPUT_POST,'openweathermapkey',FILTER_SANITIZE_STRING);
1314
-	$mapquestkey = filter_input(INPUT_POST,'mapquestkey',FILTER_SANITIZE_STRING);
1315
-	$hereappid = filter_input(INPUT_POST,'hereappid',FILTER_SANITIZE_STRING);
1316
-	$hereappcode = filter_input(INPUT_POST,'hereappcode',FILTER_SANITIZE_STRING);
1317
-	$settings = array_merge($settings,array('globalMapProvider' => $mapprovider,'globalMapboxId' => $mapboxid,'globalMapboxToken' => $mapboxtoken,'globalGoogleAPIKey' => $googlekey,'globalBingMapKey' => $bingkey,'globalHereappID' => $hereappid,'globalHereappCode' => $hereappcode,'globalMapQuestKey' => $mapquestkey,'globalOpenWeatherMapKey' => $openweathermapkey));
1308
+	$mapprovider = filter_input(INPUT_POST, 'mapprovider', FILTER_SANITIZE_STRING);
1309
+	$mapboxid = filter_input(INPUT_POST, 'mapboxid', FILTER_SANITIZE_STRING);
1310
+	$mapboxtoken = filter_input(INPUT_POST, 'mapboxtoken', FILTER_SANITIZE_STRING);
1311
+	$googlekey = filter_input(INPUT_POST, 'googlekey', FILTER_SANITIZE_STRING);
1312
+	$bingkey = filter_input(INPUT_POST, 'bingkey', FILTER_SANITIZE_STRING);
1313
+	$openweathermapkey = filter_input(INPUT_POST, 'openweathermapkey', FILTER_SANITIZE_STRING);
1314
+	$mapquestkey = filter_input(INPUT_POST, 'mapquestkey', FILTER_SANITIZE_STRING);
1315
+	$hereappid = filter_input(INPUT_POST, 'hereappid', FILTER_SANITIZE_STRING);
1316
+	$hereappcode = filter_input(INPUT_POST, 'hereappcode', FILTER_SANITIZE_STRING);
1317
+	$settings = array_merge($settings, array('globalMapProvider' => $mapprovider, 'globalMapboxId' => $mapboxid, 'globalMapboxToken' => $mapboxtoken, 'globalGoogleAPIKey' => $googlekey, 'globalBingMapKey' => $bingkey, 'globalHereappID' => $hereappid, 'globalHereappCode' => $hereappcode, 'globalMapQuestKey' => $mapquestkey, 'globalOpenWeatherMapKey' => $openweathermapkey));
1318 1318
 	
1319
-	$latitudemax = filter_input(INPUT_POST,'latitudemax',FILTER_SANITIZE_STRING);
1320
-	$latitudemin = filter_input(INPUT_POST,'latitudemin',FILTER_SANITIZE_STRING);
1321
-	$longitudemax = filter_input(INPUT_POST,'longitudemax',FILTER_SANITIZE_STRING);
1322
-	$longitudemin = filter_input(INPUT_POST,'longitudemin',FILTER_SANITIZE_STRING);
1323
-	$livezoom = filter_input(INPUT_POST,'livezoom',FILTER_SANITIZE_NUMBER_INT);
1324
-	$settings = array_merge($settings,array('globalLatitudeMax' => $latitudemax,'globalLatitudeMin' => $latitudemin,'globalLongitudeMax' => $longitudemax,'globalLongitudeMin' => $longitudemin,'globalLiveZoom' => $livezoom));
1319
+	$latitudemax = filter_input(INPUT_POST, 'latitudemax', FILTER_SANITIZE_STRING);
1320
+	$latitudemin = filter_input(INPUT_POST, 'latitudemin', FILTER_SANITIZE_STRING);
1321
+	$longitudemax = filter_input(INPUT_POST, 'longitudemax', FILTER_SANITIZE_STRING);
1322
+	$longitudemin = filter_input(INPUT_POST, 'longitudemin', FILTER_SANITIZE_STRING);
1323
+	$livezoom = filter_input(INPUT_POST, 'livezoom', FILTER_SANITIZE_NUMBER_INT);
1324
+	$settings = array_merge($settings, array('globalLatitudeMax' => $latitudemax, 'globalLatitudeMin' => $latitudemin, 'globalLongitudeMax' => $longitudemax, 'globalLongitudeMin' => $longitudemin, 'globalLiveZoom' => $livezoom));
1325 1325
 
1326
-	$squawk_country = filter_input(INPUT_POST,'squawk_country',FILTER_SANITIZE_STRING);
1327
-	$settings = array_merge($settings,array('globalSquawkCountry' => $squawk_country));
1326
+	$squawk_country = filter_input(INPUT_POST, 'squawk_country', FILTER_SANITIZE_STRING);
1327
+	$settings = array_merge($settings, array('globalSquawkCountry' => $squawk_country));
1328 1328
 
1329
-	$latitudecenter = filter_input(INPUT_POST,'latitudecenter',FILTER_SANITIZE_STRING);
1330
-	$longitudecenter = filter_input(INPUT_POST,'longitudecenter',FILTER_SANITIZE_STRING);
1331
-	$settings = array_merge($settings,array('globalCenterLatitude' => $latitudecenter,'globalCenterLongitude' => $longitudecenter));
1329
+	$latitudecenter = filter_input(INPUT_POST, 'latitudecenter', FILTER_SANITIZE_STRING);
1330
+	$longitudecenter = filter_input(INPUT_POST, 'longitudecenter', FILTER_SANITIZE_STRING);
1331
+	$settings = array_merge($settings, array('globalCenterLatitude' => $latitudecenter, 'globalCenterLongitude' => $longitudecenter));
1332 1332
 
1333
-	$acars = filter_input(INPUT_POST,'acars',FILTER_SANITIZE_STRING);
1333
+	$acars = filter_input(INPUT_POST, 'acars', FILTER_SANITIZE_STRING);
1334 1334
 	if ($acars == 'acars') {
1335
-		$settings = array_merge($settings,array('globalACARS' => 'TRUE'));
1335
+		$settings = array_merge($settings, array('globalACARS' => 'TRUE'));
1336 1336
 	} else {
1337
-		$settings = array_merge($settings,array('globalACARS' => 'FALSE'));
1337
+		$settings = array_merge($settings, array('globalACARS' => 'FALSE'));
1338 1338
 	}
1339
-	$updatecheck = filter_input(INPUT_POST,'updatecheck',FILTER_SANITIZE_STRING);
1339
+	$updatecheck = filter_input(INPUT_POST, 'updatecheck', FILTER_SANITIZE_STRING);
1340 1340
 	if ($updatecheck == 'updatecheck') {
1341
-		$settings = array_merge($settings,array('globalDisableUpdateCheck' => 'TRUE'));
1341
+		$settings = array_merge($settings, array('globalDisableUpdateCheck' => 'TRUE'));
1342 1342
 	} else {
1343
-		$settings = array_merge($settings,array('globalDisableUpdateCheck' => 'FALSE'));
1343
+		$settings = array_merge($settings, array('globalDisableUpdateCheck' => 'FALSE'));
1344 1344
 	}
1345 1345
 
1346
-	$flightawareusername = filter_input(INPUT_POST,'flightawareusername',FILTER_SANITIZE_STRING);
1347
-	$flightawarepassword = filter_input(INPUT_POST,'flightawarepassword',FILTER_SANITIZE_STRING);
1348
-	$settings = array_merge($settings,array('globalFlightAwareUsername' => $flightawareusername,'globalFlightAwarePassword' => $flightawarepassword));
1346
+	$flightawareusername = filter_input(INPUT_POST, 'flightawareusername', FILTER_SANITIZE_STRING);
1347
+	$flightawarepassword = filter_input(INPUT_POST, 'flightawarepassword', FILTER_SANITIZE_STRING);
1348
+	$settings = array_merge($settings, array('globalFlightAwareUsername' => $flightawareusername, 'globalFlightAwarePassword' => $flightawarepassword));
1349 1349
 	
1350
-	$sailawayemail = filter_input(INPUT_POST,'sailawayemail',FILTER_SANITIZE_STRING);
1351
-	$sailawaypass = filter_input(INPUT_POST,'sailawaypassword',FILTER_SANITIZE_STRING);
1352
-	$sailawaykey = filter_input(INPUT_POST,'sailawaykey',FILTER_SANITIZE_STRING);
1353
-	$settings = array_merge($settings,array('globalSailaway' => array('email' => $sailawayemail,'password' => $sailawaypass,'key' => $sailawaykey)));
1350
+	$sailawayemail = filter_input(INPUT_POST, 'sailawayemail', FILTER_SANITIZE_STRING);
1351
+	$sailawaypass = filter_input(INPUT_POST, 'sailawaypassword', FILTER_SANITIZE_STRING);
1352
+	$sailawaykey = filter_input(INPUT_POST, 'sailawaykey', FILTER_SANITIZE_STRING);
1353
+	$settings = array_merge($settings, array('globalSailaway' => array('email' => $sailawayemail, 'password' => $sailawaypass, 'key' => $sailawaykey)));
1354 1354
 	
1355 1355
 	$source_name = $_POST['source_name'];
1356 1356
 	$source_latitude = $_POST['source_latitude'];
@@ -1364,8 +1364,8 @@  discard block
 block discarded – undo
1364 1364
 	
1365 1365
 	$sources = array();
1366 1366
 	foreach ($source_name as $keys => $name) {
1367
-	    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]);
1368
-	    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]);
1367
+	    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]);
1368
+	    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]);
1369 1369
 	}
1370 1370
 	if (count($sources) > 0) $_SESSION['sources'] = $sources;
1371 1371
 
@@ -1374,16 +1374,16 @@  discard block
 block discarded – undo
1374 1374
 	$newstype = $_POST['newstype'];
1375 1375
 	
1376 1376
 	$newsfeeds = array();
1377
-	foreach($newsurl as $newskey => $url) {
1377
+	foreach ($newsurl as $newskey => $url) {
1378 1378
 	    if ($url != '') {
1379 1379
 		$type = $newstype[$newskey];
1380 1380
 		$lng = $newslng[$newskey];
1381 1381
 		if (isset($newsfeeds[$type][$lng])) {
1382
-		    $newsfeeds[$type][$lng] = array_merge($newsfeeds[$type][$lng],array($url));
1382
+		    $newsfeeds[$type][$lng] = array_merge($newsfeeds[$type][$lng], array($url));
1383 1383
 		} else $newsfeeds[$type][$lng] = array($url);
1384 1384
 	    }
1385 1385
 	}
1386
-	$settings = array_merge($settings,array('globalNewsFeeds' => $newsfeeds));
1386
+	$settings = array_merge($settings, array('globalNewsFeeds' => $newsfeeds));
1387 1387
 
1388 1388
 	//$sbshost = filter_input(INPUT_POST,'sbshost',FILTER_SANITIZE_STRING);
1389 1389
 	//$sbsport = filter_input(INPUT_POST,'sbsport',FILTER_SANITIZE_NUMBER_INT);
@@ -1394,28 +1394,28 @@  discard block
 block discarded – undo
1394 1394
 	$sbsurl = $_POST['sbsurl'];
1395 1395
 	*/
1396 1396
 
1397
-	$globalvatsim = filter_input(INPUT_POST,'globalvatsim',FILTER_SANITIZE_STRING);
1398
-	$globalva = filter_input(INPUT_POST,'globalva',FILTER_SANITIZE_STRING);
1399
-	$globalvm = filter_input(INPUT_POST,'globalvm',FILTER_SANITIZE_STRING);
1400
-	$globalivao = filter_input(INPUT_POST,'globalivao',FILTER_SANITIZE_STRING);
1401
-	$globalphpvms = filter_input(INPUT_POST,'globalphpvms',FILTER_SANITIZE_STRING);
1402
-	$globalvam = filter_input(INPUT_POST,'globalvam',FILTER_SANITIZE_STRING);
1403
-	$globalsbs = filter_input(INPUT_POST,'globalsbs',FILTER_SANITIZE_STRING);
1404
-	$globalaprs = filter_input(INPUT_POST,'globalaprs',FILTER_SANITIZE_STRING);
1405
-	$datasource = filter_input(INPUT_POST,'datasource',FILTER_SANITIZE_STRING);
1397
+	$globalvatsim = filter_input(INPUT_POST, 'globalvatsim', FILTER_SANITIZE_STRING);
1398
+	$globalva = filter_input(INPUT_POST, 'globalva', FILTER_SANITIZE_STRING);
1399
+	$globalvm = filter_input(INPUT_POST, 'globalvm', FILTER_SANITIZE_STRING);
1400
+	$globalivao = filter_input(INPUT_POST, 'globalivao', FILTER_SANITIZE_STRING);
1401
+	$globalphpvms = filter_input(INPUT_POST, 'globalphpvms', FILTER_SANITIZE_STRING);
1402
+	$globalvam = filter_input(INPUT_POST, 'globalvam', FILTER_SANITIZE_STRING);
1403
+	$globalsbs = filter_input(INPUT_POST, 'globalsbs', FILTER_SANITIZE_STRING);
1404
+	$globalaprs = filter_input(INPUT_POST, 'globalaprs', FILTER_SANITIZE_STRING);
1405
+	$datasource = filter_input(INPUT_POST, 'datasource', FILTER_SANITIZE_STRING);
1406 1406
 
1407
-	$globalaircraft = filter_input(INPUT_POST,'globalaircraft',FILTER_SANITIZE_STRING);
1408
-	if ($globalaircraft == 'aircraft') $settings = array_merge($settings,array('globalAircraft' => 'TRUE'));
1409
-	else $settings = array_merge($settings,array('globalAircraft' => 'FALSE'));
1410
-	$globaltracker = filter_input(INPUT_POST,'globaltracker',FILTER_SANITIZE_STRING);
1411
-	if ($globaltracker == 'tracker') $settings = array_merge($settings,array('globalTracker' => 'TRUE'));
1412
-	else $settings = array_merge($settings,array('globalTracker' => 'FALSE'));
1413
-	$globalmarine = filter_input(INPUT_POST,'globalmarine',FILTER_SANITIZE_STRING);
1414
-	if ($globalmarine == 'marine') $settings = array_merge($settings,array('globalMarine' => 'TRUE'));
1415
-	else $settings = array_merge($settings,array('globalMarine' => 'FALSE'));
1416
-	$globalsatellite = filter_input(INPUT_POST,'globalsatellite',FILTER_SANITIZE_STRING);
1417
-	if ($globalsatellite == 'satellite') $settings = array_merge($settings,array('globalSatellite' => 'TRUE'));
1418
-	else $settings = array_merge($settings,array('globalSatellite' => 'FALSE'));
1407
+	$globalaircraft = filter_input(INPUT_POST, 'globalaircraft', FILTER_SANITIZE_STRING);
1408
+	if ($globalaircraft == 'aircraft') $settings = array_merge($settings, array('globalAircraft' => 'TRUE'));
1409
+	else $settings = array_merge($settings, array('globalAircraft' => 'FALSE'));
1410
+	$globaltracker = filter_input(INPUT_POST, 'globaltracker', FILTER_SANITIZE_STRING);
1411
+	if ($globaltracker == 'tracker') $settings = array_merge($settings, array('globalTracker' => 'TRUE'));
1412
+	else $settings = array_merge($settings, array('globalTracker' => 'FALSE'));
1413
+	$globalmarine = filter_input(INPUT_POST, 'globalmarine', FILTER_SANITIZE_STRING);
1414
+	if ($globalmarine == 'marine') $settings = array_merge($settings, array('globalMarine' => 'TRUE'));
1415
+	else $settings = array_merge($settings, array('globalMarine' => 'FALSE'));
1416
+	$globalsatellite = filter_input(INPUT_POST, 'globalsatellite', FILTER_SANITIZE_STRING);
1417
+	if ($globalsatellite == 'satellite') $settings = array_merge($settings, array('globalSatellite' => 'TRUE'));
1418
+	else $settings = array_merge($settings, array('globalSatellite' => 'FALSE'));
1419 1419
 
1420 1420
 /*	
1421 1421
 	$globalSBS1Hosts = array();
@@ -1431,7 +1431,7 @@  discard block
 block discarded – undo
1431 1431
 	}
1432 1432
 	$settings = array_merge($settings,array('globalSBS1Hosts' => $globalSBS1Hosts));
1433 1433
 */
1434
-	$settings_comment = array_merge($settings_comment,array('globalSBS1Hosts'));
1434
+	$settings_comment = array_merge($settings_comment, array('globalSBS1Hosts'));
1435 1435
 	$host = $_POST['host'];
1436 1436
 	$port = $_POST['port'];
1437 1437
 	$name = $_POST['name'];
@@ -1448,115 +1448,115 @@  discard block
 block discarded – undo
1448 1448
 		else $cov = 'FALSE';
1449 1449
 		if (isset($noarchive[$key]) && $noarchive[$key] == 1) $arch = 'TRUE';
1450 1450
 		else $arch = 'FALSE';
1451
-		if (strpos($format[$key],'_callback')) {
1452
-			$gSources[] = array('host' => $h, 'pass' => $port[$key],'name' => $name[$key],'format' => $format[$key],'sourcestats' => $cov,'noarchive' => $arch,'timezone' => $timezones[$key],'callback' => 'TRUE');
1451
+		if (strpos($format[$key], '_callback')) {
1452
+			$gSources[] = array('host' => $h, 'pass' => $port[$key], 'name' => $name[$key], 'format' => $format[$key], 'sourcestats' => $cov, 'noarchive' => $arch, 'timezone' => $timezones[$key], 'callback' => 'TRUE');
1453 1453
 		} elseif ($format[$key] != 'auto' || ($h != '' || $name[$key] != '')) {
1454
-			$gSources[] = array('host' => $h, 'port' => $port[$key],'name' => $name[$key],'format' => $format[$key],'sourcestats' => $cov,'noarchive' => $arch,'timezone' => $timezones[$key],'callback' => 'FALSE');
1454
+			$gSources[] = array('host' => $h, 'port' => $port[$key], 'name' => $name[$key], 'format' => $format[$key], 'sourcestats' => $cov, 'noarchive' => $arch, 'timezone' => $timezones[$key], 'callback' => 'FALSE');
1455 1455
 		}
1456 1456
 		if ($format[$key] == 'airwhere') $forcepilots = true;
1457 1457
 	}
1458
-	$settings = array_merge($settings,array('globalSources' => $gSources));
1458
+	$settings = array_merge($settings, array('globalSources' => $gSources));
1459 1459
 
1460 1460
 /*
1461 1461
 	$sbstimeout = filter_input(INPUT_POST,'sbstimeout',FILTER_SANITIZE_NUMBER_INT);
1462 1462
 	$settings = array_merge($settings,array('globalSourcesTimeOut' => $sbstimeout));
1463 1463
 */
1464
-	$acarshost = filter_input(INPUT_POST,'acarshost',FILTER_SANITIZE_STRING);
1465
-	$acarsport = filter_input(INPUT_POST,'acarsport',FILTER_SANITIZE_NUMBER_INT);
1466
-	$settings = array_merge($settings,array('globalACARSHost' => $acarshost,'globalACARSPort' => $acarsport));
1464
+	$acarshost = filter_input(INPUT_POST, 'acarshost', FILTER_SANITIZE_STRING);
1465
+	$acarsport = filter_input(INPUT_POST, 'acarsport', FILTER_SANITIZE_NUMBER_INT);
1466
+	$settings = array_merge($settings, array('globalACARSHost' => $acarshost, 'globalACARSPort' => $acarsport));
1467 1467
 
1468
-	$bitly = filter_input(INPUT_POST,'bitly',FILTER_SANITIZE_STRING);
1469
-	$settings = array_merge($settings,array('globalBitlyAccessToken' => $bitly));
1468
+	$bitly = filter_input(INPUT_POST, 'bitly', FILTER_SANITIZE_STRING);
1469
+	$settings = array_merge($settings, array('globalBitlyAccessToken' => $bitly));
1470 1470
 
1471
-	$customcss = filter_input(INPUT_POST,'customcss',FILTER_SANITIZE_STRING);
1472
-	$settings = array_merge($settings,array('globalCustomCSS' => $customcss));
1471
+	$customcss = filter_input(INPUT_POST, 'customcss', FILTER_SANITIZE_STRING);
1472
+	$settings = array_merge($settings, array('globalCustomCSS' => $customcss));
1473 1473
 
1474
-	$map3dtile = filter_input(INPUT_POST,'map3dtileset',FILTER_SANITIZE_STRING);
1475
-	$settings = array_merge($settings,array('globalMap3DTiles' => $map3dtile));
1474
+	$map3dtile = filter_input(INPUT_POST, 'map3dtileset', FILTER_SANITIZE_STRING);
1475
+	$settings = array_merge($settings, array('globalMap3DTiles' => $map3dtile));
1476 1476
 
1477
-	$notamsource = filter_input(INPUT_POST,'notamsource',FILTER_SANITIZE_STRING);
1478
-	$settings = array_merge($settings,array('globalNOTAMSource' => $notamsource));
1479
-	$metarsource = filter_input(INPUT_POST,'metarsource',FILTER_SANITIZE_STRING);
1480
-	$settings = array_merge($settings,array('globalMETARurl' => $metarsource));
1477
+	$notamsource = filter_input(INPUT_POST, 'notamsource', FILTER_SANITIZE_STRING);
1478
+	$settings = array_merge($settings, array('globalNOTAMSource' => $notamsource));
1479
+	$metarsource = filter_input(INPUT_POST, 'metarsource', FILTER_SANITIZE_STRING);
1480
+	$settings = array_merge($settings, array('globalMETARurl' => $metarsource));
1481 1481
 
1482
-	$zoilatitude = filter_input(INPUT_POST,'zoilatitude',FILTER_SANITIZE_STRING);
1483
-	$zoilongitude = filter_input(INPUT_POST,'zoilongitude',FILTER_SANITIZE_STRING);
1484
-	$zoidistance = filter_input(INPUT_POST,'zoidistance',FILTER_SANITIZE_NUMBER_INT);
1482
+	$zoilatitude = filter_input(INPUT_POST, 'zoilatitude', FILTER_SANITIZE_STRING);
1483
+	$zoilongitude = filter_input(INPUT_POST, 'zoilongitude', FILTER_SANITIZE_STRING);
1484
+	$zoidistance = filter_input(INPUT_POST, 'zoidistance', FILTER_SANITIZE_NUMBER_INT);
1485 1485
 	if ($zoilatitude != '' && $zoilongitude != '' && $zoidistance != '') {
1486
-		$settings = array_merge($settings,array('globalDistanceIgnore' => array('latitude' => $zoilatitude,'longitude' => $zoilongitude,'distance' => $zoidistance)));
1487
-	} else $settings = array_merge($settings,array('globalDistanceIgnore' => array()));
1486
+		$settings = array_merge($settings, array('globalDistanceIgnore' => array('latitude' => $zoilatitude, 'longitude' => $zoilongitude, 'distance' => $zoidistance)));
1487
+	} else $settings = array_merge($settings, array('globalDistanceIgnore' => array()));
1488 1488
 
1489
-	$refresh = filter_input(INPUT_POST,'refresh',FILTER_SANITIZE_NUMBER_INT);
1490
-	$settings = array_merge($settings,array('globalLiveInterval' => $refresh));
1491
-	$maprefresh = filter_input(INPUT_POST,'maprefresh',FILTER_SANITIZE_NUMBER_INT);
1492
-	$settings = array_merge($settings,array('globalMapRefresh' => $maprefresh));
1493
-	$mapidle = filter_input(INPUT_POST,'mapidle',FILTER_SANITIZE_NUMBER_INT);
1494
-	$settings = array_merge($settings,array('globalMapIdleTimeout' => $mapidle));
1495
-	$minfetch = filter_input(INPUT_POST,'minfetch',FILTER_SANITIZE_NUMBER_INT);
1496
-	$settings = array_merge($settings,array('globalMinFetch' => $minfetch));
1497
-	$closestmindist = filter_input(INPUT_POST,'closestmindist',FILTER_SANITIZE_NUMBER_INT);
1498
-	$settings = array_merge($settings,array('globalClosestMinDist' => $closestmindist));
1489
+	$refresh = filter_input(INPUT_POST, 'refresh', FILTER_SANITIZE_NUMBER_INT);
1490
+	$settings = array_merge($settings, array('globalLiveInterval' => $refresh));
1491
+	$maprefresh = filter_input(INPUT_POST, 'maprefresh', FILTER_SANITIZE_NUMBER_INT);
1492
+	$settings = array_merge($settings, array('globalMapRefresh' => $maprefresh));
1493
+	$mapidle = filter_input(INPUT_POST, 'mapidle', FILTER_SANITIZE_NUMBER_INT);
1494
+	$settings = array_merge($settings, array('globalMapIdleTimeout' => $mapidle));
1495
+	$minfetch = filter_input(INPUT_POST, 'minfetch', FILTER_SANITIZE_NUMBER_INT);
1496
+	$settings = array_merge($settings, array('globalMinFetch' => $minfetch));
1497
+	$closestmindist = filter_input(INPUT_POST, 'closestmindist', FILTER_SANITIZE_NUMBER_INT);
1498
+	$settings = array_merge($settings, array('globalClosestMinDist' => $closestmindist));
1499 1499
 
1500
-	$aircraftsize = filter_input(INPUT_POST,'aircraftsize',FILTER_SANITIZE_NUMBER_INT);
1501
-	$settings = array_merge($settings,array('globalAircraftSize' => $aircraftsize));
1500
+	$aircraftsize = filter_input(INPUT_POST, 'aircraftsize', FILTER_SANITIZE_NUMBER_INT);
1501
+	$settings = array_merge($settings, array('globalAircraftSize' => $aircraftsize));
1502 1502
 
1503
-	$archivemonths = filter_input(INPUT_POST,'archivemonths',FILTER_SANITIZE_NUMBER_INT);
1504
-	$settings = array_merge($settings,array('globalArchiveMonths' => $archivemonths));
1503
+	$archivemonths = filter_input(INPUT_POST, 'archivemonths', FILTER_SANITIZE_NUMBER_INT);
1504
+	$settings = array_merge($settings, array('globalArchiveMonths' => $archivemonths));
1505 1505
 	
1506
-	$archiveyear = filter_input(INPUT_POST,'archiveyear',FILTER_SANITIZE_STRING);
1506
+	$archiveyear = filter_input(INPUT_POST, 'archiveyear', FILTER_SANITIZE_STRING);
1507 1507
 	if ($archiveyear == "archiveyear") {
1508
-		$settings = array_merge($settings,array('globalArchiveYear' => 'TRUE'));
1508
+		$settings = array_merge($settings, array('globalArchiveYear' => 'TRUE'));
1509 1509
 	} else {
1510
-		$settings = array_merge($settings,array('globalArchiveYear' => 'FALSE'));
1510
+		$settings = array_merge($settings, array('globalArchiveYear' => 'FALSE'));
1511 1511
 	}
1512
-	$archivekeepmonths = filter_input(INPUT_POST,'archivekeepmonths',FILTER_SANITIZE_NUMBER_INT);
1513
-	$settings = array_merge($settings,array('globalArchiveKeepMonths' => $archivekeepmonths));
1514
-	$archivekeeptrackmonths = filter_input(INPUT_POST,'archivekeeptrackmonths',FILTER_SANITIZE_NUMBER_INT);
1515
-	$settings = array_merge($settings,array('globalArchiveKeepTrackMonths' => $archivekeeptrackmonths));
1512
+	$archivekeepmonths = filter_input(INPUT_POST, 'archivekeepmonths', FILTER_SANITIZE_NUMBER_INT);
1513
+	$settings = array_merge($settings, array('globalArchiveKeepMonths' => $archivekeepmonths));
1514
+	$archivekeeptrackmonths = filter_input(INPUT_POST, 'archivekeeptrackmonths', FILTER_SANITIZE_NUMBER_INT);
1515
+	$settings = array_merge($settings, array('globalArchiveKeepTrackMonths' => $archivekeeptrackmonths));
1516 1516
 
1517
-	$britishairways = filter_input(INPUT_POST,'britishairways',FILTER_SANITIZE_STRING);
1518
-	$settings = array_merge($settings,array('globalBritishAirwaysKey' => $britishairways));
1519
-	$transavia = filter_input(INPUT_POST,'transavia',FILTER_SANITIZE_STRING);
1520
-	$settings = array_merge($settings,array('globalTransaviaKey' => $transavia));
1517
+	$britishairways = filter_input(INPUT_POST, 'britishairways', FILTER_SANITIZE_STRING);
1518
+	$settings = array_merge($settings, array('globalBritishAirwaysKey' => $britishairways));
1519
+	$transavia = filter_input(INPUT_POST, 'transavia', FILTER_SANITIZE_STRING);
1520
+	$settings = array_merge($settings, array('globalTransaviaKey' => $transavia));
1521 1521
 
1522
-	$lufthansakey = filter_input(INPUT_POST,'lufthansakey',FILTER_SANITIZE_STRING);
1523
-	$lufthansasecret = filter_input(INPUT_POST,'lufthansasecret',FILTER_SANITIZE_STRING);
1524
-	$settings = array_merge($settings,array('globalLufthansaKey' => array('key' => $lufthansakey,'secret' => $lufthansasecret)));
1522
+	$lufthansakey = filter_input(INPUT_POST, 'lufthansakey', FILTER_SANITIZE_STRING);
1523
+	$lufthansasecret = filter_input(INPUT_POST, 'lufthansasecret', FILTER_SANITIZE_STRING);
1524
+	$settings = array_merge($settings, array('globalLufthansaKey' => array('key' => $lufthansakey, 'secret' => $lufthansasecret)));
1525 1525
 
1526 1526
 	// Create in settings.php keys not yet configurable if not already here
1527 1527
 	//if (!isset($globalImageBingKey)) $settings = array_merge($settings,array('globalImageBingKey' => ''));
1528
-	if (!isset($globalDebug)) $settings = array_merge($settings,array('globalDebug' => 'TRUE'));
1528
+	if (!isset($globalDebug)) $settings = array_merge($settings, array('globalDebug' => 'TRUE'));
1529 1529
 
1530
-	$resetyearstats = filter_input(INPUT_POST,'resetyearstats',FILTER_SANITIZE_STRING);
1530
+	$resetyearstats = filter_input(INPUT_POST, 'resetyearstats', FILTER_SANITIZE_STRING);
1531 1531
 	if ($resetyearstats == 'resetyearstats') {
1532
-		$settings = array_merge($settings,array('globalDeleteLastYearStats' => 'TRUE'));
1532
+		$settings = array_merge($settings, array('globalDeleteLastYearStats' => 'TRUE'));
1533 1533
 	} else {
1534
-		$settings = array_merge($settings,array('globalDeleteLastYearStats' => 'FALSE'));
1534
+		$settings = array_merge($settings, array('globalDeleteLastYearStats' => 'FALSE'));
1535 1535
 	}
1536 1536
 
1537
-	$archive = filter_input(INPUT_POST,'archive',FILTER_SANITIZE_STRING);
1537
+	$archive = filter_input(INPUT_POST, 'archive', FILTER_SANITIZE_STRING);
1538 1538
 	if ($archive == 'archive') {
1539
-		$settings = array_merge($settings,array('globalArchive' => 'TRUE'));
1539
+		$settings = array_merge($settings, array('globalArchive' => 'TRUE'));
1540 1540
 	} else {
1541
-		$settings = array_merge($settings,array('globalArchive' => 'FALSE'));
1541
+		$settings = array_merge($settings, array('globalArchive' => 'FALSE'));
1542 1542
 	}
1543
-	$archiveresults = filter_input(INPUT_POST,'archiveresults',FILTER_SANITIZE_STRING);
1543
+	$archiveresults = filter_input(INPUT_POST, 'archiveresults', FILTER_SANITIZE_STRING);
1544 1544
 	if ($archiveresults == 'archiveresults') {
1545
-		$settings = array_merge($settings,array('globalArchiveResults' => 'TRUE'));
1545
+		$settings = array_merge($settings, array('globalArchiveResults' => 'TRUE'));
1546 1546
 	} else {
1547
-		$settings = array_merge($settings,array('globalArchiveResults' => 'FALSE'));
1547
+		$settings = array_merge($settings, array('globalArchiveResults' => 'FALSE'));
1548 1548
 	}
1549
-	$daemon = filter_input(INPUT_POST,'daemon',FILTER_SANITIZE_STRING);
1549
+	$daemon = filter_input(INPUT_POST, 'daemon', FILTER_SANITIZE_STRING);
1550 1550
 	if ($daemon == 'daemon') {
1551
-		$settings = array_merge($settings,array('globalDaemon' => 'TRUE'));
1551
+		$settings = array_merge($settings, array('globalDaemon' => 'TRUE'));
1552 1552
 	} else {
1553
-		$settings = array_merge($settings,array('globalDaemon' => 'FALSE'));
1553
+		$settings = array_merge($settings, array('globalDaemon' => 'FALSE'));
1554 1554
 	}
1555
-	$schedules = filter_input(INPUT_POST,'schedules',FILTER_SANITIZE_STRING);
1555
+	$schedules = filter_input(INPUT_POST, 'schedules', FILTER_SANITIZE_STRING);
1556 1556
 	if ($schedules == 'schedules') {
1557
-		$settings = array_merge($settings,array('globalSchedulesFetch' => 'TRUE'));
1557
+		$settings = array_merge($settings, array('globalSchedulesFetch' => 'TRUE'));
1558 1558
 	} else {
1559
-		$settings = array_merge($settings,array('globalSchedulesFetch' => 'FALSE'));
1559
+		$settings = array_merge($settings, array('globalSchedulesFetch' => 'FALSE'));
1560 1560
 	}
1561 1561
 
1562 1562
 /*
@@ -1567,311 +1567,311 @@  discard block
 block discarded – undo
1567 1567
 		$settings = array_merge($settings,array('globalFlightAware' => 'FALSE','globalSBS1' => 'TRUE'));
1568 1568
 	}
1569 1569
 */
1570
-	$settings = array_merge($settings,array('globalFlightAware' => 'FALSE'));
1571
-	if ($globalsbs == 'sbs') $settings = array_merge($settings,array('globalSBS1' => 'TRUE'));
1572
-	else $settings = array_merge($settings,array('globalSBS1' => 'FALSE'));
1573
-	if ($globalaprs == 'aprs') $settings = array_merge($settings,array('globalAPRS' => 'TRUE'));
1574
-	else $settings = array_merge($settings,array('globalAPRS' => 'FALSE'));
1570
+	$settings = array_merge($settings, array('globalFlightAware' => 'FALSE'));
1571
+	if ($globalsbs == 'sbs') $settings = array_merge($settings, array('globalSBS1' => 'TRUE'));
1572
+	else $settings = array_merge($settings, array('globalSBS1' => 'FALSE'));
1573
+	if ($globalaprs == 'aprs') $settings = array_merge($settings, array('globalAPRS' => 'TRUE'));
1574
+	else $settings = array_merge($settings, array('globalAPRS' => 'FALSE'));
1575 1575
 	$va = false;
1576 1576
 	if ($globalivao == 'ivao') {
1577
-		$settings = array_merge($settings,array('globalIVAO' => 'TRUE'));
1577
+		$settings = array_merge($settings, array('globalIVAO' => 'TRUE'));
1578 1578
 		$va = true;
1579
-	} else $settings = array_merge($settings,array('globalIVAO' => 'FALSE'));
1579
+	} else $settings = array_merge($settings, array('globalIVAO' => 'FALSE'));
1580 1580
 	if ($globalvatsim == 'vatsim') {
1581
-		$settings = array_merge($settings,array('globalVATSIM' => 'TRUE'));
1581
+		$settings = array_merge($settings, array('globalVATSIM' => 'TRUE'));
1582 1582
 		$va = true;
1583
-	} else $settings = array_merge($settings,array('globalVATSIM' => 'FALSE'));
1583
+	} else $settings = array_merge($settings, array('globalVATSIM' => 'FALSE'));
1584 1584
 	if ($globalphpvms == 'phpvms') {
1585
-		$settings = array_merge($settings,array('globalphpVMS' => 'TRUE'));
1585
+		$settings = array_merge($settings, array('globalphpVMS' => 'TRUE'));
1586 1586
 		$va = true;
1587
-	} else $settings = array_merge($settings,array('globalphpVMS' => 'FALSE'));
1587
+	} else $settings = array_merge($settings, array('globalphpVMS' => 'FALSE'));
1588 1588
 	if ($globalvam == 'vam') {
1589
-		$settings = array_merge($settings,array('globalVAM' => 'TRUE'));
1589
+		$settings = array_merge($settings, array('globalVAM' => 'TRUE'));
1590 1590
 		$va = true;
1591
-	} else $settings = array_merge($settings,array('globalVAM' => 'FALSE'));
1591
+	} else $settings = array_merge($settings, array('globalVAM' => 'FALSE'));
1592 1592
 	if ($va) {
1593
-		$settings = array_merge($settings,array('globalSchedulesFetch' => 'FALSE','globalTranslationFetch' => 'FALSE'));
1594
-	} else $settings = array_merge($settings,array('globalSchedulesFetch' => 'TRUE','globalTranslationFetch' => 'TRUE'));
1593
+		$settings = array_merge($settings, array('globalSchedulesFetch' => 'FALSE', 'globalTranslationFetch' => 'FALSE'));
1594
+	} else $settings = array_merge($settings, array('globalSchedulesFetch' => 'TRUE', 'globalTranslationFetch' => 'TRUE'));
1595 1595
 	if ($globalva == 'va' || $va) {
1596
-		$settings = array_merge($settings,array('globalVA' => 'TRUE'));
1597
-		$settings = array_merge($settings,array('globalUsePilot' => 'TRUE','globalUseOwner' => 'FALSE'));
1596
+		$settings = array_merge($settings, array('globalVA' => 'TRUE'));
1597
+		$settings = array_merge($settings, array('globalUsePilot' => 'TRUE', 'globalUseOwner' => 'FALSE'));
1598 1598
 	} else {
1599
-		$settings = array_merge($settings,array('globalVA' => 'FALSE'));
1600
-		if ($forcepilots) $settings = array_merge($settings,array('globalUsePilot' => 'TRUE','globalUseOwner' => 'FALSE'));
1601
-		else $settings = array_merge($settings,array('globalUsePilot' => 'FALSE','globalUseOwner' => 'TRUE'));
1599
+		$settings = array_merge($settings, array('globalVA' => 'FALSE'));
1600
+		if ($forcepilots) $settings = array_merge($settings, array('globalUsePilot' => 'TRUE', 'globalUseOwner' => 'FALSE'));
1601
+		else $settings = array_merge($settings, array('globalUsePilot' => 'FALSE', 'globalUseOwner' => 'TRUE'));
1602 1602
 	}
1603 1603
 	if ($globalvm == 'vm') {
1604
-		$settings = array_merge($settings,array('globalVM' => 'TRUE'));
1604
+		$settings = array_merge($settings, array('globalVM' => 'TRUE'));
1605 1605
 	} else {
1606
-		$settings = array_merge($settings,array('globalVM' => 'FALSE'));
1606
+		$settings = array_merge($settings, array('globalVM' => 'FALSE'));
1607 1607
 	}
1608 1608
 	
1609
-	$mapoffline = filter_input(INPUT_POST,'mapoffline',FILTER_SANITIZE_STRING);
1609
+	$mapoffline = filter_input(INPUT_POST, 'mapoffline', FILTER_SANITIZE_STRING);
1610 1610
 	if ($mapoffline == 'mapoffline') {
1611
-		$settings = array_merge($settings,array('globalMapOffline' => 'TRUE'));
1611
+		$settings = array_merge($settings, array('globalMapOffline' => 'TRUE'));
1612 1612
 	} else {
1613
-		$settings = array_merge($settings,array('globalMapOffline' => 'FALSE'));
1613
+		$settings = array_merge($settings, array('globalMapOffline' => 'FALSE'));
1614 1614
 	}
1615
-	$globaloffline = filter_input(INPUT_POST,'globaloffline',FILTER_SANITIZE_STRING);
1615
+	$globaloffline = filter_input(INPUT_POST, 'globaloffline', FILTER_SANITIZE_STRING);
1616 1616
 	if ($globaloffline == 'globaloffline') {
1617
-		$settings = array_merge($settings,array('globalOffline' => 'TRUE'));
1617
+		$settings = array_merge($settings, array('globalOffline' => 'TRUE'));
1618 1618
 	} else {
1619
-		$settings = array_merge($settings,array('globalOffline' => 'FALSE'));
1619
+		$settings = array_merge($settings, array('globalOffline' => 'FALSE'));
1620 1620
 	}
1621 1621
 
1622
-	$notam = filter_input(INPUT_POST,'notam',FILTER_SANITIZE_STRING);
1622
+	$notam = filter_input(INPUT_POST, 'notam', FILTER_SANITIZE_STRING);
1623 1623
 	if ($notam == 'notam') {
1624
-		$settings = array_merge($settings,array('globalNOTAM' => 'TRUE'));
1624
+		$settings = array_merge($settings, array('globalNOTAM' => 'TRUE'));
1625 1625
 	} else {
1626
-		$settings = array_merge($settings,array('globalNOTAM' => 'FALSE'));
1626
+		$settings = array_merge($settings, array('globalNOTAM' => 'FALSE'));
1627 1627
 	}
1628
-	$owner = filter_input(INPUT_POST,'owner',FILTER_SANITIZE_STRING);
1628
+	$owner = filter_input(INPUT_POST, 'owner', FILTER_SANITIZE_STRING);
1629 1629
 	if ($owner == 'owner') {
1630
-		$settings = array_merge($settings,array('globalOwner' => 'TRUE'));
1630
+		$settings = array_merge($settings, array('globalOwner' => 'TRUE'));
1631 1631
 	} else {
1632
-		$settings = array_merge($settings,array('globalOwner' => 'FALSE'));
1632
+		$settings = array_merge($settings, array('globalOwner' => 'FALSE'));
1633 1633
 	}
1634
-	$map3d = filter_input(INPUT_POST,'map3d',FILTER_SANITIZE_STRING);
1634
+	$map3d = filter_input(INPUT_POST, 'map3d', FILTER_SANITIZE_STRING);
1635 1635
 	if ($map3d == 'map3d') {
1636
-		$settings = array_merge($settings,array('globalMap3D' => 'TRUE'));
1636
+		$settings = array_merge($settings, array('globalMap3D' => 'TRUE'));
1637 1637
 	} else {
1638
-		$settings = array_merge($settings,array('globalMap3D' => 'FALSE'));
1638
+		$settings = array_merge($settings, array('globalMap3D' => 'FALSE'));
1639 1639
 	}
1640
-	$crash = filter_input(INPUT_POST,'crash',FILTER_SANITIZE_STRING);
1640
+	$crash = filter_input(INPUT_POST, 'crash', FILTER_SANITIZE_STRING);
1641 1641
 	if ($crash == 'crash') {
1642
-		$settings = array_merge($settings,array('globalAccidents' => 'TRUE'));
1642
+		$settings = array_merge($settings, array('globalAccidents' => 'TRUE'));
1643 1643
 	} else {
1644
-		$settings = array_merge($settings,array('globalAccidents' => 'FALSE'));
1644
+		$settings = array_merge($settings, array('globalAccidents' => 'FALSE'));
1645 1645
 	}
1646
-	$fires = filter_input(INPUT_POST,'fires',FILTER_SANITIZE_STRING);
1646
+	$fires = filter_input(INPUT_POST, 'fires', FILTER_SANITIZE_STRING);
1647 1647
 	if ($fires == 'fires') {
1648
-		$settings = array_merge($settings,array('globalMapFires' => 'TRUE'));
1648
+		$settings = array_merge($settings, array('globalMapFires' => 'TRUE'));
1649 1649
 	} else {
1650
-		$settings = array_merge($settings,array('globalMapFires' => 'FALSE'));
1650
+		$settings = array_merge($settings, array('globalMapFires' => 'FALSE'));
1651 1651
 	}
1652
-	$firessupport = filter_input(INPUT_POST,'firessupport',FILTER_SANITIZE_STRING);
1652
+	$firessupport = filter_input(INPUT_POST, 'firessupport', FILTER_SANITIZE_STRING);
1653 1653
 	if ($firessupport == 'firessupport') {
1654
-		$settings = array_merge($settings,array('globalFires' => 'TRUE'));
1654
+		$settings = array_merge($settings, array('globalFires' => 'TRUE'));
1655 1655
 	} else {
1656
-		$settings = array_merge($settings,array('globalFires' => 'FALSE'));
1656
+		$settings = array_merge($settings, array('globalFires' => 'FALSE'));
1657 1657
 	}
1658
-	$mapsatellites = filter_input(INPUT_POST,'mapsatellites',FILTER_SANITIZE_STRING);
1658
+	$mapsatellites = filter_input(INPUT_POST, 'mapsatellites', FILTER_SANITIZE_STRING);
1659 1659
 	if ($mapsatellites == 'mapsatellites') {
1660
-		$settings = array_merge($settings,array('globalMapSatellites' => 'TRUE'));
1660
+		$settings = array_merge($settings, array('globalMapSatellites' => 'TRUE'));
1661 1661
 	} else {
1662
-		$settings = array_merge($settings,array('globalMapSatellites' => 'FALSE'));
1662
+		$settings = array_merge($settings, array('globalMapSatellites' => 'FALSE'));
1663 1663
 	}
1664
-	$map3ddefault = filter_input(INPUT_POST,'map3ddefault',FILTER_SANITIZE_STRING);
1664
+	$map3ddefault = filter_input(INPUT_POST, 'map3ddefault', FILTER_SANITIZE_STRING);
1665 1665
 	if ($map3ddefault == 'map3ddefault') {
1666
-		$settings = array_merge($settings,array('globalMap3Ddefault' => 'TRUE'));
1666
+		$settings = array_merge($settings, array('globalMap3Ddefault' => 'TRUE'));
1667 1667
 	} else {
1668
-		$settings = array_merge($settings,array('globalMap3Ddefault' => 'FALSE'));
1668
+		$settings = array_merge($settings, array('globalMap3Ddefault' => 'FALSE'));
1669 1669
 	}
1670
-	$one3dmodel = filter_input(INPUT_POST,'one3dmodel',FILTER_SANITIZE_STRING);
1670
+	$one3dmodel = filter_input(INPUT_POST, 'one3dmodel', FILTER_SANITIZE_STRING);
1671 1671
 	if ($one3dmodel == 'one3dmodel') {
1672
-		$settings = array_merge($settings,array('globalMap3DOneModel' => 'TRUE'));
1672
+		$settings = array_merge($settings, array('globalMap3DOneModel' => 'TRUE'));
1673 1673
 	} else {
1674
-		$settings = array_merge($settings,array('globalMap3DOneModel' => 'FALSE'));
1674
+		$settings = array_merge($settings, array('globalMap3DOneModel' => 'FALSE'));
1675 1675
 	}
1676
-	$map3dliveries = filter_input(INPUT_POST,'map3dliveries',FILTER_SANITIZE_STRING);
1676
+	$map3dliveries = filter_input(INPUT_POST, 'map3dliveries', FILTER_SANITIZE_STRING);
1677 1677
 	if ($map3dliveries == 'map3dliveries') {
1678
-		$settings = array_merge($settings,array('globalMap3DLiveries' => 'TRUE'));
1678
+		$settings = array_merge($settings, array('globalMap3DLiveries' => 'TRUE'));
1679 1679
 	} else {
1680
-		$settings = array_merge($settings,array('globalMap3DLiveries' => 'FALSE'));
1680
+		$settings = array_merge($settings, array('globalMap3DLiveries' => 'FALSE'));
1681 1681
 	}
1682
-	$map3dshadows = filter_input(INPUT_POST,'map3dshadows',FILTER_SANITIZE_STRING);
1682
+	$map3dshadows = filter_input(INPUT_POST, 'map3dshadows', FILTER_SANITIZE_STRING);
1683 1683
 	if ($map3dshadows == 'map3dshadows') {
1684
-		$settings = array_merge($settings,array('globalMap3DShadows' => 'TRUE'));
1684
+		$settings = array_merge($settings, array('globalMap3DShadows' => 'TRUE'));
1685 1685
 	} else {
1686
-		$settings = array_merge($settings,array('globalMap3DShadows' => 'FALSE'));
1686
+		$settings = array_merge($settings, array('globalMap3DShadows' => 'FALSE'));
1687 1687
 	}
1688
-	$translate = filter_input(INPUT_POST,'translate',FILTER_SANITIZE_STRING);
1688
+	$translate = filter_input(INPUT_POST, 'translate', FILTER_SANITIZE_STRING);
1689 1689
 	if ($translate == 'translate') {
1690
-		$settings = array_merge($settings,array('globalTranslate' => 'TRUE'));
1690
+		$settings = array_merge($settings, array('globalTranslate' => 'TRUE'));
1691 1691
 	} else {
1692
-		$settings = array_merge($settings,array('globalTranslate' => 'FALSE'));
1692
+		$settings = array_merge($settings, array('globalTranslate' => 'FALSE'));
1693 1693
 	}
1694
-	$realairlines = filter_input(INPUT_POST,'realairlines',FILTER_SANITIZE_STRING);
1694
+	$realairlines = filter_input(INPUT_POST, 'realairlines', FILTER_SANITIZE_STRING);
1695 1695
 	if ($realairlines == 'realairlines') {
1696
-		$settings = array_merge($settings,array('globalUseRealAirlines' => 'TRUE'));
1696
+		$settings = array_merge($settings, array('globalUseRealAirlines' => 'TRUE'));
1697 1697
 	} else {
1698
-		$settings = array_merge($settings,array('globalUseRealAirlines' => 'FALSE'));
1698
+		$settings = array_merge($settings, array('globalUseRealAirlines' => 'FALSE'));
1699 1699
 	}
1700
-	$estimation = filter_input(INPUT_POST,'estimation',FILTER_SANITIZE_STRING);
1700
+	$estimation = filter_input(INPUT_POST, 'estimation', FILTER_SANITIZE_STRING);
1701 1701
 	if ($estimation == 'estimation') {
1702
-		$settings = array_merge($settings,array('globalMapEstimation' => 'TRUE'));
1702
+		$settings = array_merge($settings, array('globalMapEstimation' => 'TRUE'));
1703 1703
 	} else {
1704
-		$settings = array_merge($settings,array('globalMapEstimation' => 'FALSE'));
1704
+		$settings = array_merge($settings, array('globalMapEstimation' => 'FALSE'));
1705 1705
 	}
1706
-	$metar = filter_input(INPUT_POST,'metar',FILTER_SANITIZE_STRING);
1706
+	$metar = filter_input(INPUT_POST, 'metar', FILTER_SANITIZE_STRING);
1707 1707
 	if ($metar == 'metar') {
1708
-		$settings = array_merge($settings,array('globalMETAR' => 'TRUE'));
1708
+		$settings = array_merge($settings, array('globalMETAR' => 'TRUE'));
1709 1709
 	} else {
1710
-		$settings = array_merge($settings,array('globalMETAR' => 'FALSE'));
1710
+		$settings = array_merge($settings, array('globalMETAR' => 'FALSE'));
1711 1711
 	}
1712
-	$metarcycle = filter_input(INPUT_POST,'metarcycle',FILTER_SANITIZE_STRING);
1712
+	$metarcycle = filter_input(INPUT_POST, 'metarcycle', FILTER_SANITIZE_STRING);
1713 1713
 	if ($metarcycle == 'metarcycle') {
1714
-		$settings = array_merge($settings,array('globalMETARcycle' => 'TRUE'));
1714
+		$settings = array_merge($settings, array('globalMETARcycle' => 'TRUE'));
1715 1715
 	} else {
1716
-		$settings = array_merge($settings,array('globalMETARcycle' => 'FALSE'));
1716
+		$settings = array_merge($settings, array('globalMETARcycle' => 'FALSE'));
1717 1717
 	}
1718
-	$fork = filter_input(INPUT_POST,'fork',FILTER_SANITIZE_STRING);
1718
+	$fork = filter_input(INPUT_POST, 'fork', FILTER_SANITIZE_STRING);
1719 1719
 	if ($fork == 'fork') {
1720
-		$settings = array_merge($settings,array('globalFork' => 'TRUE'));
1720
+		$settings = array_merge($settings, array('globalFork' => 'TRUE'));
1721 1721
 	} else {
1722
-		$settings = array_merge($settings,array('globalFork' => 'FALSE'));
1722
+		$settings = array_merge($settings, array('globalFork' => 'FALSE'));
1723 1723
 	}
1724 1724
 
1725
-	$colormap = filter_input(INPUT_POST,'colormap',FILTER_SANITIZE_STRING);
1725
+	$colormap = filter_input(INPUT_POST, 'colormap', FILTER_SANITIZE_STRING);
1726 1726
 	if ($colormap == 'colormap') {
1727
-		$settings = array_merge($settings,array('globalMapAltitudeColor' => 'TRUE'));
1727
+		$settings = array_merge($settings, array('globalMapAltitudeColor' => 'TRUE'));
1728 1728
 	} else {
1729
-		$settings = array_merge($settings,array('globalMapAltitudeColor' => 'FALSE'));
1729
+		$settings = array_merge($settings, array('globalMapAltitudeColor' => 'FALSE'));
1730 1730
 	}
1731 1731
 	
1732 1732
 	if (isset($_POST['aircrafticoncolor'])) {
1733
-		$aircrafticoncolor = filter_input(INPUT_POST,'aircrafticoncolor',FILTER_SANITIZE_STRING);
1734
-		$settings = array_merge($settings,array('globalAircraftIconColor' => substr($aircrafticoncolor,1)));
1733
+		$aircrafticoncolor = filter_input(INPUT_POST, 'aircrafticoncolor', FILTER_SANITIZE_STRING);
1734
+		$settings = array_merge($settings, array('globalAircraftIconColor' => substr($aircrafticoncolor, 1)));
1735 1735
 	}
1736 1736
 	if (isset($_POST['marineiconcolor'])) {
1737
-		$marineiconcolor = filter_input(INPUT_POST,'marineiconcolor',FILTER_SANITIZE_STRING);
1738
-		$settings = array_merge($settings,array('globalMarineIconColor' => substr($marineiconcolor,1)));
1737
+		$marineiconcolor = filter_input(INPUT_POST, 'marineiconcolor', FILTER_SANITIZE_STRING);
1738
+		$settings = array_merge($settings, array('globalMarineIconColor' => substr($marineiconcolor, 1)));
1739 1739
 	}
1740 1740
 	if (isset($_POST['trackericoncolor'])) {
1741
-		$trackericoncolor = filter_input(INPUT_POST,'trackericoncolor',FILTER_SANITIZE_STRING);
1742
-		$settings = array_merge($settings,array('globalTrackerIconColor' => substr($trackericoncolor,1)));
1741
+		$trackericoncolor = filter_input(INPUT_POST, 'trackericoncolor', FILTER_SANITIZE_STRING);
1742
+		$settings = array_merge($settings, array('globalTrackerIconColor' => substr($trackericoncolor, 1)));
1743 1743
 	}
1744 1744
 	if (isset($_POST['satelliteiconcolor'])) {
1745
-		$satelliteiconcolor = filter_input(INPUT_POST,'satelliteiconcolor',FILTER_SANITIZE_STRING);
1746
-		$settings = array_merge($settings,array('globalSatelliteIconColor' => substr($satelliteiconcolor,1)));
1745
+		$satelliteiconcolor = filter_input(INPUT_POST, 'satelliteiconcolor', FILTER_SANITIZE_STRING);
1746
+		$settings = array_merge($settings, array('globalSatelliteIconColor' => substr($satelliteiconcolor, 1)));
1747 1747
 	}
1748 1748
 
1749
-	$corsproxy = filter_input(INPUT_POST,'corsproxy',FILTER_SANITIZE_STRING);
1750
-	$settings = array_merge($settings,array('globalCORSproxy' => $corsproxy));
1749
+	$corsproxy = filter_input(INPUT_POST, 'corsproxy', FILTER_SANITIZE_STRING);
1750
+	$settings = array_merge($settings, array('globalCORSproxy' => $corsproxy));
1751 1751
 
1752
-	$airportzoom = filter_input(INPUT_POST,'airportzoom',FILTER_SANITIZE_NUMBER_INT);
1753
-	$settings = array_merge($settings,array('globalAirportZoom' => $airportzoom));
1752
+	$airportzoom = filter_input(INPUT_POST, 'airportzoom', FILTER_SANITIZE_NUMBER_INT);
1753
+	$settings = array_merge($settings, array('globalAirportZoom' => $airportzoom));
1754 1754
 
1755
-	$unitdistance = filter_input(INPUT_POST,'unitdistance',FILTER_SANITIZE_STRING);
1756
-	$settings = array_merge($settings,array('globalUnitDistance' => $unitdistance));
1757
-	$unitaltitude = filter_input(INPUT_POST,'unitaltitude',FILTER_SANITIZE_STRING);
1758
-	$settings = array_merge($settings,array('globalUnitAltitude' => $unitaltitude));
1759
-	$unitspeed = filter_input(INPUT_POST,'unitspeed',FILTER_SANITIZE_STRING);
1760
-	$settings = array_merge($settings,array('globalUnitSpeed' => $unitspeed));
1755
+	$unitdistance = filter_input(INPUT_POST, 'unitdistance', FILTER_SANITIZE_STRING);
1756
+	$settings = array_merge($settings, array('globalUnitDistance' => $unitdistance));
1757
+	$unitaltitude = filter_input(INPUT_POST, 'unitaltitude', FILTER_SANITIZE_STRING);
1758
+	$settings = array_merge($settings, array('globalUnitAltitude' => $unitaltitude));
1759
+	$unitspeed = filter_input(INPUT_POST, 'unitspeed', FILTER_SANITIZE_STRING);
1760
+	$settings = array_merge($settings, array('globalUnitSpeed' => $unitspeed));
1761 1761
 
1762
-	$mappopup = filter_input(INPUT_POST,'mappopup',FILTER_SANITIZE_STRING);
1762
+	$mappopup = filter_input(INPUT_POST, 'mappopup', FILTER_SANITIZE_STRING);
1763 1763
 	if ($mappopup == 'mappopup') {
1764
-		$settings = array_merge($settings,array('globalMapPopup' => 'TRUE'));
1764
+		$settings = array_merge($settings, array('globalMapPopup' => 'TRUE'));
1765 1765
 	} else {
1766
-		$settings = array_merge($settings,array('globalMapPopup' => 'FALSE'));
1766
+		$settings = array_merge($settings, array('globalMapPopup' => 'FALSE'));
1767 1767
 	}
1768
-	$airportpopup = filter_input(INPUT_POST,'airportpopup',FILTER_SANITIZE_STRING);
1768
+	$airportpopup = filter_input(INPUT_POST, 'airportpopup', FILTER_SANITIZE_STRING);
1769 1769
 	if ($airportpopup == 'airportpopup') {
1770
-		$settings = array_merge($settings,array('globalAirportPopup' => 'TRUE'));
1770
+		$settings = array_merge($settings, array('globalAirportPopup' => 'TRUE'));
1771 1771
 	} else {
1772
-		$settings = array_merge($settings,array('globalAirportPopup' => 'FALSE'));
1772
+		$settings = array_merge($settings, array('globalAirportPopup' => 'FALSE'));
1773 1773
 	}
1774
-	$maphistory = filter_input(INPUT_POST,'maphistory',FILTER_SANITIZE_STRING);
1774
+	$maphistory = filter_input(INPUT_POST, 'maphistory', FILTER_SANITIZE_STRING);
1775 1775
 	if ($maphistory == 'maphistory') {
1776
-		$settings = array_merge($settings,array('globalMapHistory' => 'TRUE'));
1776
+		$settings = array_merge($settings, array('globalMapHistory' => 'TRUE'));
1777 1777
 	} else {
1778
-		$settings = array_merge($settings,array('globalMapHistory' => 'FALSE'));
1778
+		$settings = array_merge($settings, array('globalMapHistory' => 'FALSE'));
1779 1779
 	}
1780
-	$maptooltip = filter_input(INPUT_POST,'maptooltip',FILTER_SANITIZE_STRING);
1780
+	$maptooltip = filter_input(INPUT_POST, 'maptooltip', FILTER_SANITIZE_STRING);
1781 1781
 	if ($maptooltip == 'maptooltip') {
1782
-		$settings = array_merge($settings,array('globalMapTooltip' => 'TRUE'));
1782
+		$settings = array_merge($settings, array('globalMapTooltip' => 'TRUE'));
1783 1783
 	} else {
1784
-		$settings = array_merge($settings,array('globalMapTooltip' => 'FALSE'));
1784
+		$settings = array_merge($settings, array('globalMapTooltip' => 'FALSE'));
1785 1785
 	}
1786
-	$flightroute = filter_input(INPUT_POST,'flightroute',FILTER_SANITIZE_STRING);
1786
+	$flightroute = filter_input(INPUT_POST, 'flightroute', FILTER_SANITIZE_STRING);
1787 1787
 	if ($flightroute == 'flightroute') {
1788
-		$settings = array_merge($settings,array('globalMapRoute' => 'TRUE'));
1788
+		$settings = array_merge($settings, array('globalMapRoute' => 'TRUE'));
1789 1789
 	} else {
1790
-		$settings = array_merge($settings,array('globalMapRoute' => 'FALSE'));
1790
+		$settings = array_merge($settings, array('globalMapRoute' => 'FALSE'));
1791 1791
 	}
1792
-	$flightremainingroute = filter_input(INPUT_POST,'flightremainingroute',FILTER_SANITIZE_STRING);
1792
+	$flightremainingroute = filter_input(INPUT_POST, 'flightremainingroute', FILTER_SANITIZE_STRING);
1793 1793
 	if ($flightremainingroute == 'flightremainingroute') {
1794
-		$settings = array_merge($settings,array('globalMapRemainingRoute' => 'TRUE'));
1794
+		$settings = array_merge($settings, array('globalMapRemainingRoute' => 'TRUE'));
1795 1795
 	} else {
1796
-		$settings = array_merge($settings,array('globalMapRemainingRoute' => 'FALSE'));
1796
+		$settings = array_merge($settings, array('globalMapRemainingRoute' => 'FALSE'));
1797 1797
 	}
1798
-	$allflights = filter_input(INPUT_POST,'allflights',FILTER_SANITIZE_STRING);
1798
+	$allflights = filter_input(INPUT_POST, 'allflights', FILTER_SANITIZE_STRING);
1799 1799
 	if ($allflights == 'allflights') {
1800
-		$settings = array_merge($settings,array('globalAllFlights' => 'TRUE'));
1800
+		$settings = array_merge($settings, array('globalAllFlights' => 'TRUE'));
1801 1801
 	} else {
1802
-		$settings = array_merge($settings,array('globalAllFlights' => 'FALSE'));
1802
+		$settings = array_merge($settings, array('globalAllFlights' => 'FALSE'));
1803 1803
 	}
1804
-	$bbox = filter_input(INPUT_POST,'bbox',FILTER_SANITIZE_STRING);
1804
+	$bbox = filter_input(INPUT_POST, 'bbox', FILTER_SANITIZE_STRING);
1805 1805
 	if ($bbox == 'bbox') {
1806
-		$settings = array_merge($settings,array('globalMapUseBbox' => 'TRUE'));
1806
+		$settings = array_merge($settings, array('globalMapUseBbox' => 'TRUE'));
1807 1807
 	} else {
1808
-		$settings = array_merge($settings,array('globalMapUseBbox' => 'FALSE'));
1808
+		$settings = array_merge($settings, array('globalMapUseBbox' => 'FALSE'));
1809 1809
 	}
1810
-	$singlemodel = filter_input(INPUT_POST,'singlemodel',FILTER_SANITIZE_STRING);
1810
+	$singlemodel = filter_input(INPUT_POST, 'singlemodel', FILTER_SANITIZE_STRING);
1811 1811
 	if ($singlemodel == 'singlemodel') {
1812
-		$settings = array_merge($settings,array('globalMap3DSelected' => 'TRUE'));
1812
+		$settings = array_merge($settings, array('globalMap3DSelected' => 'TRUE'));
1813 1813
 	} else {
1814
-		$settings = array_merge($settings,array('globalMap3DSelected' => 'FALSE'));
1814
+		$settings = array_merge($settings, array('globalMap3DSelected' => 'FALSE'));
1815 1815
 	}
1816
-	$groundaltitude = filter_input(INPUT_POST,'groundaltitude',FILTER_SANITIZE_STRING);
1816
+	$groundaltitude = filter_input(INPUT_POST, 'groundaltitude', FILTER_SANITIZE_STRING);
1817 1817
 	if ($groundaltitude == 'groundaltitude') {
1818
-		$settings = array_merge($settings,array('globalGroundAltitude' => 'TRUE'));
1818
+		$settings = array_merge($settings, array('globalGroundAltitude' => 'TRUE'));
1819 1819
 	} else {
1820
-		$settings = array_merge($settings,array('globalGroundAltitude' => 'FALSE'));
1820
+		$settings = array_merge($settings, array('globalGroundAltitude' => 'FALSE'));
1821 1821
 	}
1822
-	$waypoints = filter_input(INPUT_POST,'waypoints',FILTER_SANITIZE_STRING);
1822
+	$waypoints = filter_input(INPUT_POST, 'waypoints', FILTER_SANITIZE_STRING);
1823 1823
 	if ($waypoints == 'waypoints') {
1824
-		$settings = array_merge($settings,array('globalWaypoints' => 'TRUE'));
1824
+		$settings = array_merge($settings, array('globalWaypoints' => 'TRUE'));
1825 1825
 	} else {
1826
-		$settings = array_merge($settings,array('globalWaypoints' => 'FALSE'));
1826
+		$settings = array_merge($settings, array('globalWaypoints' => 'FALSE'));
1827 1827
 	}
1828
-	$geoid = filter_input(INPUT_POST,'geoid',FILTER_SANITIZE_STRING);
1828
+	$geoid = filter_input(INPUT_POST, 'geoid', FILTER_SANITIZE_STRING);
1829 1829
 	if ($geoid == 'geoid') {
1830
-		$settings = array_merge($settings,array('globalGeoid' => 'TRUE'));
1830
+		$settings = array_merge($settings, array('globalGeoid' => 'TRUE'));
1831 1831
 	} else {
1832
-		$settings = array_merge($settings,array('globalGeoid' => 'FALSE'));
1832
+		$settings = array_merge($settings, array('globalGeoid' => 'FALSE'));
1833 1833
 	}
1834
-	$geoid_source = filter_input(INPUT_POST,'geoid_source',FILTER_SANITIZE_STRING);
1835
-	$settings = array_merge($settings,array('globalGeoidSource' => $geoid_source));
1834
+	$geoid_source = filter_input(INPUT_POST, 'geoid_source', FILTER_SANITIZE_STRING);
1835
+	$settings = array_merge($settings, array('globalGeoidSource' => $geoid_source));
1836 1836
 
1837
-	$noairlines = filter_input(INPUT_POST,'noairlines',FILTER_SANITIZE_STRING);
1837
+	$noairlines = filter_input(INPUT_POST, 'noairlines', FILTER_SANITIZE_STRING);
1838 1838
 	if ($noairlines == 'noairlines') {
1839
-		$settings = array_merge($settings,array('globalNoAirlines' => 'TRUE'));
1839
+		$settings = array_merge($settings, array('globalNoAirlines' => 'TRUE'));
1840 1840
 	} else {
1841
-		$settings = array_merge($settings,array('globalNoAirlines' => 'FALSE'));
1841
+		$settings = array_merge($settings, array('globalNoAirlines' => 'FALSE'));
1842 1842
 	}
1843 1843
 
1844
-	$tsk = filter_input(INPUT_POST,'tsk',FILTER_SANITIZE_STRING);
1844
+	$tsk = filter_input(INPUT_POST, 'tsk', FILTER_SANITIZE_STRING);
1845 1845
 	if ($tsk == 'tsk') {
1846
-		$settings = array_merge($settings,array('globalTSK' => 'TRUE'));
1846
+		$settings = array_merge($settings, array('globalTSK' => 'TRUE'));
1847 1847
 	} else {
1848
-		$settings = array_merge($settings,array('globalTSK' => 'FALSE'));
1848
+		$settings = array_merge($settings, array('globalTSK' => 'FALSE'));
1849 1849
 	}
1850
-	$mapmatching = filter_input(INPUT_POST,'mapmatching',FILTER_SANITIZE_STRING);
1850
+	$mapmatching = filter_input(INPUT_POST, 'mapmatching', FILTER_SANITIZE_STRING);
1851 1851
 	if ($mapmatching == 'mapmatching') {
1852
-		$settings = array_merge($settings,array('globalMapMatching' => 'TRUE'));
1852
+		$settings = array_merge($settings, array('globalMapMatching' => 'TRUE'));
1853 1853
 	} else {
1854
-		$settings = array_merge($settings,array('globalMapMatching' => 'FALSE'));
1854
+		$settings = array_merge($settings, array('globalMapMatching' => 'FALSE'));
1855 1855
 	}
1856
-	$mapmatchingsource = filter_input(INPUT_POST,'mapmatchingsource',FILTER_SANITIZE_STRING);
1857
-	$settings = array_merge($settings,array('globalMapMatchingSource' => $mapmatchingsource));
1858
-	$graphhopper = filter_input(INPUT_POST,'graphhopper',FILTER_SANITIZE_STRING);
1859
-	$settings = array_merge($settings,array('globalGraphHopperKey' => $graphhopper));
1856
+	$mapmatchingsource = filter_input(INPUT_POST, 'mapmatchingsource', FILTER_SANITIZE_STRING);
1857
+	$settings = array_merge($settings, array('globalMapMatchingSource' => $mapmatchingsource));
1858
+	$graphhopper = filter_input(INPUT_POST, 'graphhopper', FILTER_SANITIZE_STRING);
1859
+	$settings = array_merge($settings, array('globalGraphHopperKey' => $graphhopper));
1860 1860
 
1861
-	if (!isset($globalTransaction)) $settings = array_merge($settings,array('globalTransaction' => 'TRUE'));
1861
+	if (!isset($globalTransaction)) $settings = array_merge($settings, array('globalTransaction' => 'TRUE'));
1862 1862
 
1863 1863
 	// Set some defaults values...
1864 1864
 	if (!isset($globalAircraftImageSources)) {
1865
-	    $globalAircraftImageSources = array('ivaomtl','wikimedia','airportdata','deviantart','flickr','bing','jetphotos','planepictures','planespotters');
1866
-	    $settings = array_merge($settings,array('globalAircraftImageSources' => $globalAircraftImageSources));
1865
+	    $globalAircraftImageSources = array('ivaomtl', 'wikimedia', 'airportdata', 'deviantart', 'flickr', 'bing', 'jetphotos', 'planepictures', 'planespotters');
1866
+	    $settings = array_merge($settings, array('globalAircraftImageSources' => $globalAircraftImageSources));
1867 1867
 	}
1868 1868
 
1869 1869
 	if (!isset($globalSchedulesSources)) {
1870
-	    $globalSchedulesSources = array('flightmapper','costtotravel','flightradar24','flightaware');
1871
-    	    $settings = array_merge($settings,array('globalSchedulesSources' => $globalSchedulesSources));
1870
+	    $globalSchedulesSources = array('flightmapper', 'costtotravel', 'flightradar24', 'flightaware');
1871
+    	    $settings = array_merge($settings, array('globalSchedulesSources' => $globalSchedulesSources));
1872 1872
     	}
1873 1873
 
1874
-	$settings = array_merge($settings,array('globalInstalled' => 'TRUE'));
1874
+	$settings = array_merge($settings, array('globalInstalled' => 'TRUE'));
1875 1875
 
1876 1876
 	if ($error == '') settings::modify_settings($settings);
1877 1877
 	if ($error == '') settings::comment_settings($settings_comment);
Please login to merge, or discard this patch.
Braces   +659 added lines, -175 removed lines patch added patch discarded remove patch
@@ -4,12 +4,22 @@  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
-	if (isset($_SESSION['identitied'])) unset($_SESSION['identified']);
12
-}
7
+	if (isset($_SESSION['error'])) {
8
+		unset($_SESSION['error']);
9
+	}
10
+	if (isset($_SESSION['errorlst'])) {
11
+		unset($_SESSION['errorlst']);
12
+	}
13
+	if (isset($_SESSION['next'])) {
14
+		unset($_SESSION['next']);
15
+	}
16
+	if (isset($_SESSION['install'])) {
17
+		unset($_SESSION['install']);
18
+	}
19
+	if (isset($_SESSION['identitied'])) {
20
+		unset($_SESSION['identified']);
21
+	}
22
+	}
13 23
 /*
14 24
 if (isset($_SESSION['errorlst'])) {
15 25
 	header('Content-Encoding: none;');
@@ -131,7 +141,9 @@  discard block
 block discarded – undo
131 141
 		if (count($alllng) != count($availablelng)) {
132 142
 			$notavailable = array();
133 143
 			foreach($alllng as $lng) {
134
-				if (!isset($availablelng[$lng])) $notavailable[] = $lng;
144
+				if (!isset($availablelng[$lng])) {
145
+					$notavailable[] = $lng;
146
+				}
135 147
 			}
136 148
 			print '<div class="alert alert-warning">The following translation can\'t be used on your system: '.implode(', ',$notavailable).'. You need to add the system locales: <a href="https://github.com/Ysurac/FlightAirMap/wiki/Translation">documentation</a>.</div>';
137 149
 		}
@@ -170,7 +182,10 @@  discard block
 block discarded – undo
170 182
 			<legend>Install script configuration</legend>
171 183
 			<p>
172 184
 				<label for="installpass">Install password</label>
173
-				<input type="password" name="installpass" id="installpass" value="<?php if (isset($globalInstallPassword)) print $globalInstallPassword; ?>" />
185
+				<input type="password" name="installpass" id="installpass" value="<?php if (isset($globalInstallPassword)) {
186
+	print $globalInstallPassword;
187
+}
188
+?>" />
174 189
 			</p>
175 190
 			<p class="help-block">Password needed to access this install script. If empty, to access this script,  you will need to change the $globalInstalled setting in require/settings.php to FALSE</p>
176 191
 		</fieldset>
@@ -200,31 +215,49 @@  discard block
 block discarded – undo
200 215
 			</div>
201 216
 			<p>
202 217
 				<label for="dbhost">Database hostname</label>
203
-				<input type="text" name="dbhost" id="dbhost" value="<?php if (isset($globalDBhost)) print $globalDBhost; ?>" />
218
+				<input type="text" name="dbhost" id="dbhost" value="<?php if (isset($globalDBhost)) {
219
+	print $globalDBhost;
220
+}
221
+?>" />
204 222
 			</p>
205 223
 			<p>
206 224
 				<label for="dbport">Database port</label>
207
-				<input type="text" name="dbport" id="dbport" value="<?php if (isset($globalDBport)) print $globalDBport; ?>" />
225
+				<input type="text" name="dbport" id="dbport" value="<?php if (isset($globalDBport)) {
226
+	print $globalDBport;
227
+}
228
+?>" />
208 229
 				<p class="help-block">Default is 3306 for MariaDB/MySQL, 5432 for PostgreSQL</p>
209 230
 			</p>
210 231
 			<p>
211 232
 				<label for="dbname">Database name</label>
212
-				<input type="text" name="dbname" id="dbname" value="<?php if (isset($globalDBname)) print $globalDBname; ?>" />
233
+				<input type="text" name="dbname" id="dbname" value="<?php if (isset($globalDBname)) {
234
+	print $globalDBname;
235
+}
236
+?>" />
213 237
 			</p>
214 238
 			<p>
215 239
 				<label for="dbuser">Database user</label>
216
-				<input type="text" name="dbuser" id="dbuser" value="<?php if (isset($globalDBuser)) print $globalDBuser; ?>" />
240
+				<input type="text" name="dbuser" id="dbuser" value="<?php if (isset($globalDBuser)) {
241
+	print $globalDBuser;
242
+}
243
+?>" />
217 244
 			</p>
218 245
 			<p>
219 246
 				<label for="dbuserpass">Database user password</label>
220
-				<input type="password" name="dbuserpass" id="dbuserpass" value="<?php if (isset($globalDBpass)) print $globalDBpass; ?>" />
247
+				<input type="password" name="dbuserpass" id="dbuserpass" value="<?php if (isset($globalDBpass)) {
248
+	print $globalDBpass;
249
+}
250
+?>" />
221 251
 			</p>
222 252
 		</fieldset>
223 253
 		<fieldset id="site">
224 254
 			<legend>Site configuration</legend>
225 255
 			<p>
226 256
 				<label for="sitename">Site name</label>
227
-				<input type="text" name="sitename" id="sitename" value="<?php if (isset($globalName)) print $globalName; ?>" />
257
+				<input type="text" name="sitename" id="sitename" value="<?php if (isset($globalName)) {
258
+	print $globalName;
259
+}
260
+?>" />
228 261
 			</p>
229 262
 			<p>
230 263
 				<label for="siteurl">Site directory</label>
@@ -237,18 +270,27 @@  discard block
 block discarded – undo
237 270
 					}
238 271
 				    }
239 272
 				?>
240
-				<input type="text" name="siteurl" id="siteurl" value="<?php if (isset($globalURL)) print $globalURL; ?>" />
273
+				<input type="text" name="siteurl" id="siteurl" value="<?php if (isset($globalURL)) {
274
+	print $globalURL;
275
+}
276
+?>" />
241 277
 				<p class="help-block">ex : <i>/flightairmap</i> if complete URL is <i>http://toto.com/flightairmap</i></p>
242 278
 				<p class="help-block">Can be empty</p>
243 279
 			</p>
244 280
 			<p>
245 281
 				<label for="timezone">Timezone</label>
246
-				<input type="text" name="timezone" id="timezone" value="<?php if (isset($globalTimezone)) print $globalTimezone; ?>" />
282
+				<input type="text" name="timezone" id="timezone" value="<?php if (isset($globalTimezone)) {
283
+	print $globalTimezone;
284
+}
285
+?>" />
247 286
 				<p class="help-block">ex : UTC, Europe/Paris,...</p>
248 287
 			</p>
249 288
 			<p>
250 289
 				<label for="language">Language</label>
251
-				<input type="text" name="language" id="language" value="<?php if (isset($globalLanguage)) print $globalLanguage; ?>" />
290
+				<input type="text" name="language" id="language" value="<?php if (isset($globalLanguage)) {
291
+	print $globalLanguage;
292
+}
293
+?>" />
252 294
 				<p class="help-block">Used only when link to wikipedia for now. Can be EN,DE,FR,...</p>
253 295
 			</p>
254 296
 		</fieldset>
@@ -268,11 +310,17 @@  discard block
 block discarded – undo
268 310
 			<div id="mapbox_data">
269 311
 				<p>
270 312
 					<label for="mapboxid">Mapbox id</label>
271
-					<input type="text" name="mapboxid" id="mapboxid" value="<?php if (isset($globalMapboxId)) print $globalMapboxId; ?>" />
313
+					<input type="text" name="mapboxid" id="mapboxid" value="<?php if (isset($globalMapboxId)) {
314
+	print $globalMapboxId;
315
+}
316
+?>" />
272 317
 				</p>
273 318
 				<p>
274 319
 					<label for="mapboxtoken">Mapbox token</label>
275
-					<input type="text" name="mapboxtoken" id="mapboxtoken" value="<?php if (isset($globalMapboxToken)) print $globalMapboxToken; ?>" />
320
+					<input type="text" name="mapboxtoken" id="mapboxtoken" value="<?php if (isset($globalMapboxToken)) {
321
+	print $globalMapboxToken;
322
+}
323
+?>" />
276 324
 				</p>
277 325
 				<p class="help-block">Get a key <a href="https://www.mapbox.com/developers/">here</a></p>
278 326
 			</div>
@@ -280,7 +328,10 @@  discard block
 block discarded – undo
280 328
 			<div id="google_data">
281 329
 				<p>
282 330
 					<label for="googlekey">Google API key</label>
283
-					<input type="text" name="googlekey" id="googlekey" value="<?php if (isset($globalGoogleAPIKey)) print $globalGoogleAPIKey; ?>" />
331
+					<input type="text" name="googlekey" id="googlekey" value="<?php if (isset($globalGoogleAPIKey)) {
332
+	print $globalGoogleAPIKey;
333
+}
334
+?>" />
284 335
 					<p class="help-block">Get a key <a href="https://developers.google.com/maps/documentation/javascript/get-api-key#get-an-api-key">here</a></p>
285 336
 				</p>
286 337
 			</div>
@@ -288,7 +339,10 @@  discard block
 block discarded – undo
288 339
 			<div id="bing_data">
289 340
 				<p>
290 341
 					<label for="bingkey">Bing Map key</label>
291
-					<input type="text" name="bingkey" id="bingkey" value="<?php if (isset($globalBingMapKey)) print $globalBingMapKey; ?>" />
342
+					<input type="text" name="bingkey" id="bingkey" value="<?php if (isset($globalBingMapKey)) {
343
+	print $globalBingMapKey;
344
+}
345
+?>" />
292 346
 					<p class="help-block">Get a key <a href="https://www.bingmapsportal.com/">here</a></p>
293 347
 				</p>
294 348
 			</div>
@@ -296,7 +350,10 @@  discard block
 block discarded – undo
296 350
 			<div id="mapquest_data">
297 351
 				<p>
298 352
 					<label for="mapquestkey">MapQuest key</label>
299
-					<input type="text" name="mapquestkey" id="mapquestkey" value="<?php if (isset($globalMapQuestKey)) print $globalMapQuestKey; ?>" />
353
+					<input type="text" name="mapquestkey" id="mapquestkey" value="<?php if (isset($globalMapQuestKey)) {
354
+	print $globalMapQuestKey;
355
+}
356
+?>" />
300 357
 					<p class="help-block">Get a key <a href="https://developer.mapquest.com/user/me/apps">here</a></p>
301 358
 				</p>
302 359
 			</div>
@@ -304,11 +361,17 @@  discard block
 block discarded – undo
304 361
 			<div id="here_data">
305 362
 				<p>
306 363
 					<label for="hereappid">Here App_Id</label>
307
-					<input type="text" name="hereappid" id="hereappid" value="<?php if (isset($globalHereappId)) print $globalHereappId; ?>" />
364
+					<input type="text" name="hereappid" id="hereappid" value="<?php if (isset($globalHereappId)) {
365
+	print $globalHereappId;
366
+}
367
+?>" />
308 368
 				</p>
309 369
 				<p>
310 370
 					<label for="hereappcode">Here App_Code</label>
311
-					<input type="text" name="hereappcode" id="hereappcode" value="<?php if (isset($globalHereappCode)) print $globalHereappCode; ?>" />
371
+					<input type="text" name="hereappcode" id="hereappcode" value="<?php if (isset($globalHereappCode)) {
372
+	print $globalHereappCode;
373
+}
374
+?>" />
312 375
 				</p>
313 376
 				<p class="help-block">Get a key <a href="https://developer.here.com/rest-apis/documentation/enterprise-map-tile/topics/quick-start.html">here</a></p>
314 377
 			</div>
@@ -316,7 +379,10 @@  discard block
 block discarded – undo
316 379
 			<div id="openweathermap_data">
317 380
 				<p>
318 381
 					<label for="openweathermapkey">OpenWeatherMap key (weather layer)</label>
319
-					<input type="text" name="openweathermapkey" id="openweathermapkey" value="<?php if (isset($globalOpenWeatherMapKey)) print $globalOpenWeatherMapKey; ?>" />
382
+					<input type="text" name="openweathermapkey" id="openweathermapkey" value="<?php if (isset($globalOpenWeatherMapKey)) {
383
+	print $globalOpenWeatherMapKey;
384
+}
385
+?>" />
320 386
 					<p class="help-block">Get a key <a href="https://openweathermap.org/">here</a></p>
321 387
 				</p>
322 388
 			</div>
@@ -345,42 +411,86 @@  discard block
 block discarded – undo
345 411
 			<legend>Coverage area</legend>
346 412
 			<p>
347 413
 				<label for="latitudemax">The maximum latitude (north)</label>
348
-				<input type="text" name="latitudemax" id="latitudemax" value="<?php if (isset($globalLatitudeMax)) print $globalLatitudeMax; ?>" />
414
+				<input type="text" name="latitudemax" id="latitudemax" value="<?php if (isset($globalLatitudeMax)) {
415
+	print $globalLatitudeMax;
416
+}
417
+?>" />
349 418
 			</p>
350 419
 			<p>
351 420
 				<label for="latitudemin">The minimum latitude (south)</label>
352
-				<input type="text" name="latitudemin" id="latitudemin" value="<?php if (isset($globalLatitudeMin)) print $globalLatitudeMin; ?>" />
421
+				<input type="text" name="latitudemin" id="latitudemin" value="<?php if (isset($globalLatitudeMin)) {
422
+	print $globalLatitudeMin;
423
+}
424
+?>" />
353 425
 			</p>
354 426
 			<p>
355 427
 				<label for="longitudemax">The maximum longitude (west)</label>
356
-				<input type="text" name="longitudemax" id="longitudemax" value="<?php if (isset($globalLongitudeMax)) print $globalLongitudeMax; ?>" />
428
+				<input type="text" name="longitudemax" id="longitudemax" value="<?php if (isset($globalLongitudeMax)) {
429
+	print $globalLongitudeMax;
430
+}
431
+?>" />
357 432
 			</p>
358 433
 			<p>
359 434
 				<label for="longitudemin">The minimum longitude (east)</label>
360
-				<input type="text" name="longitudemin" id="longitudemin" value="<?php if (isset($globalLongitudeMin)) print $globalLongitudeMin; ?>" />
435
+				<input type="text" name="longitudemin" id="longitudemin" value="<?php if (isset($globalLongitudeMin)) {
436
+	print $globalLongitudeMin;
437
+}
438
+?>" />
361 439
 			</p>
362 440
 			<p>
363 441
 				<label for="latitudecenter">The latitude center</label>
364
-				<input type="text" name="latitudecenter" id="latitudecenter" value="<?php if (isset($globalCenterLatitude)) print $globalCenterLatitude; ?>" />
442
+				<input type="text" name="latitudecenter" id="latitudecenter" value="<?php if (isset($globalCenterLatitude)) {
443
+	print $globalCenterLatitude;
444
+}
445
+?>" />
365 446
 			</p>
366 447
 			<p>
367 448
 				<label for="longitudecenter">The longitude center</label>
368
-				<input type="text" name="longitudecenter" id="longitudecenter" value="<?php if (isset($globalCenterLongitude)) print $globalCenterLongitude; ?>" />
449
+				<input type="text" name="longitudecenter" id="longitudecenter" value="<?php if (isset($globalCenterLongitude)) {
450
+	print $globalCenterLongitude;
451
+}
452
+?>" />
369 453
 			</p>
370 454
 			<p>
371 455
 				<label for="livezoom">Default Zoom on live map</label>
372
-				<input type="number" name="livezoom" id="livezoom" value="<?php if (isset($globalLiveZoom)) print $globalLiveZoom; else print '9'; ?>" />
456
+				<input type="number" name="livezoom" id="livezoom" value="<?php if (isset($globalLiveZoom)) {
457
+	print $globalLiveZoom;
458
+} else {
459
+	print '9';
460
+}
461
+?>" />
373 462
 			</p>
374 463
 			<p>
375 464
 				<label for="squawk_country">Country for squawk usage</label>
376 465
 				<select name="squawk_country" id="squawk_country">
377
-					<option value="UK"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'UK') print ' selected '; ?>>UK</option>
378
-					<option value="NZ"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'NZ') print ' selected '; ?>>NZ</option>
379
-					<option value="US"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'US') print ' selected '; ?>>US</option>
380
-					<option value="AU"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'AU') print ' selected '; ?>>AU</option>
381
-					<option value="NL"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'NL') print ' selected '; ?>>NL</option>
382
-					<option value="FR"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'FR') print ' selected '; ?>>FR</option>
383
-					<option value="TR"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'TR') print ' selected '; ?>>TR</option>
466
+					<option value="UK"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'UK') {
467
+	print ' selected ';
468
+}
469
+?>>UK</option>
470
+					<option value="NZ"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'NZ') {
471
+	print ' selected ';
472
+}
473
+?>>NZ</option>
474
+					<option value="US"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'US') {
475
+	print ' selected ';
476
+}
477
+?>>US</option>
478
+					<option value="AU"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'AU') {
479
+	print ' selected ';
480
+}
481
+?>>AU</option>
482
+					<option value="NL"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'NL') {
483
+	print ' selected ';
484
+}
485
+?>>NL</option>
486
+					<option value="FR"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'FR') {
487
+	print ' selected ';
488
+}
489
+?>>FR</option>
490
+					<option value="TR"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'TR') {
491
+	print ' selected ';
492
+}
493
+?>>TR</option>
384 494
 				</select>
385 495
 			</p>
386 496
 		</fieldset>
@@ -389,15 +499,24 @@  discard block
 block discarded – undo
389 499
 			<p><i>Only put in DB flights that are inside a circle</i></p>
390 500
 			<p>
391 501
 				<label for="latitude">Center latitude</label>
392
-				<input type="text" name="zoilatitude" id="latitude" value="<?php if (isset($globalDistanceIgnore['latitude'])) echo $globalDistanceIgnore['latitude']; ?>" />
502
+				<input type="text" name="zoilatitude" id="latitude" value="<?php if (isset($globalDistanceIgnore['latitude'])) {
503
+	echo $globalDistanceIgnore['latitude'];
504
+}
505
+?>" />
393 506
 			</p>
394 507
 			<p>
395 508
 				<label for="longitude">Center longitude</label>
396
-				<input type="text" name="zoilongitude" id="longitude" value="<?php if (isset($globalDistanceIgnore['longitude'])) echo $globalDistanceIgnore['longitude']; ?>" />
509
+				<input type="text" name="zoilongitude" id="longitude" value="<?php if (isset($globalDistanceIgnore['longitude'])) {
510
+	echo $globalDistanceIgnore['longitude'];
511
+}
512
+?>" />
397 513
 			</p>
398 514
 			<p>
399 515
 				<label for="Distance">Distance (in km)</label>
400
-				<input type="text" name="zoidistance" id="distance" value="<?php if (isset($globalDistanceIgnore['distance'])) echo $globalDistanceIgnore['distance']; ?>" />
516
+				<input type="text" name="zoidistance" id="distance" value="<?php if (isset($globalDistanceIgnore['distance'])) {
517
+	echo $globalDistanceIgnore['distance'];
518
+}
519
+?>" />
401 520
 			</p>
402 521
 		</fieldset>
403 522
 		<fieldset id="sourceloc">
@@ -523,28 +642,43 @@  discard block
 block discarded – undo
523 642
 			<div id="flightaware_data">
524 643
 				<p>
525 644
 					<label for="flightawareusername">FlightAware username</label>
526
-					<input type="text" name="flightawareusername" id="flightawareusername" value="<?php if (isset($globalFlightAwareUsername)) print $globalFlightAwareUsername; ?>" />
645
+					<input type="text" name="flightawareusername" id="flightawareusername" value="<?php if (isset($globalFlightAwareUsername)) {
646
+	print $globalFlightAwareUsername;
647
+}
648
+?>" />
527 649
 				</p>
528 650
 				<p>
529 651
 					<label for="flightawarepassword">FlightAware password/API key</label>
530
-					<input type="text" name="flightawarepassword" id="flightawarepassword" value="<?php if (isset($globalFlightAwarePassword)) print $globalFlightAwarePassword; ?>" />
652
+					<input type="text" name="flightawarepassword" id="flightawarepassword" value="<?php if (isset($globalFlightAwarePassword)) {
653
+	print $globalFlightAwarePassword;
654
+}
655
+?>" />
531 656
 				</p>
532 657
 			</div>
533 658
 -->
534 659
 			<div id="sailaway_data">
535 660
 				<p>
536 661
 					<label for="sailawayemail">Sailaway email</label>
537
-					<input type="text" name="sailawayemail" id="sailawayemail" value="<?php if (isset($globalSailaway['email'])) print $globalSailaway['email']; ?>" />
662
+					<input type="text" name="sailawayemail" id="sailawayemail" value="<?php if (isset($globalSailaway['email'])) {
663
+	print $globalSailaway['email'];
664
+}
665
+?>" />
538 666
 					<p class="help-block">Only needed for Sailaway full format</p>
539 667
 				</p>
540 668
 				<p>
541 669
 					<label for="sailawaypassword">Sailaway password</label>
542
-					<input type="text" name="sailawaypassword" id="sailawaypassword" value="<?php if (isset($globalSailaway['password'])) print $globalSailaway['password']; ?>" />
670
+					<input type="text" name="sailawaypassword" id="sailawaypassword" value="<?php if (isset($globalSailaway['password'])) {
671
+	print $globalSailaway['password'];
672
+}
673
+?>" />
543 674
 					<p class="help-block">Only needed for Sailaway full format</p>
544 675
 				</p>
545 676
 				<p>
546 677
 					<label for="sailawaykey">Sailaway API key</label>
547
-					<input type="text" name="sailawaykey" id="sailawaykey" value="<?php if (isset($globalSailaway['key'])) print $globalSailaway['key']; ?>" />
678
+					<input type="text" name="sailawaykey" id="sailawaykey" value="<?php if (isset($globalSailaway['key'])) {
679
+	print $globalSailaway['key'];
680
+}
681
+?>" />
548 682
 				</p>
549 683
 			</div>
550 684
 
@@ -586,7 +720,10 @@  discard block
 block discarded – undo
586 720
 								    if (filter_var($source['host'],FILTER_VALIDATE_URL)) {
587 721
 								?>
588 722
 								<td><input type="text" name="host[]" value="<?php print $source['host']; ?>" /></td>
589
-								<td><input type="text" name="port[]" class="col-xs-2" value="<?php if (isset($source['port'])) print $source['port']; ?>" /></td>
723
+								<td><input type="text" name="port[]" class="col-xs-2" value="<?php if (isset($source['port'])) {
724
+	print $source['port'];
725
+}
726
+?>" /></td>
590 727
 								<?php
591 728
 								    } else {
592 729
 									$hostport = explode(':',$source['host']);
@@ -605,41 +742,134 @@  discard block
 block discarded – undo
605 742
 								?>
606 743
 								<td>
607 744
 									<select name="format[]">
608
-										<option value="auto" <?php if (!isset($source['format'])) print 'selected'; ?>>Auto</option>
609
-										<option value="sbs" <?php if (isset($source['format']) && $source['format'] == 'sbs') print 'selected'; ?>>SBS</option>
610
-										<option value="tsv" <?php if (isset($source['format']) && $source['format'] == 'tsv') print 'selected'; ?>>TSV</option>
611
-										<option value="raw" <?php if (isset($source['format']) && $source['format'] == 'raw') print 'selected'; ?>>Raw</option>
612
-										<option value="aircraftjson" <?php if (isset($source['format']) && $source['format'] == 'aircraftjson') print 'selected'; ?>>Dump1090 aircraft.json</option>
613
-										<option value="planefinderclient" <?php if (isset($source['format']) && $source['format'] == 'planefinderclient') print 'selected'; ?>>Planefinder client</option>
614
-										<option value="aprs" <?php if (isset($source['format']) && $source['format'] == 'aprs') print 'selected'; ?>>APRS</option>
615
-										<option value="deltadbtxt" <?php if (isset($source['format']) && $source['format'] == 'deltadbtxt') print 'selected'; ?>>Radarcape deltadb.txt</option>
616
-                                        <option value="radarcapejson" <?php if (isset($source['format']) && $source['format'] == 'radarcapejson') print 'selected'; ?>>Radarcape json</option>
617
-										<option value="vatsimtxt" <?php if (isset($source['format']) && $source['format'] == 'vatsimtxt') print 'selected'; ?>>Vatsim</option>
618
-										<option value="aircraftlistjson" <?php if (isset($source['format']) && $source['format'] == 'aircraftlistjson') print 'selected'; ?>>Virtual Radar Server AircraftList.json</option>
619
-										<option value="vrstcp" <?php if (isset($source['format']) && $source['format'] == 'vrstcp') print 'selected'; ?>>Virtual Radar Server TCP</option>
620
-										<option value="phpvmacars" <?php if (isset($source['format']) && $source['format'] == 'phpvmacars') print 'selected'; ?>>phpVMS</option>
621
-										<option value="vaos" <?php if (isset($source['format']) && $source['format'] == 'phpvmacars') print 'selected'; ?>>Virtual Airline Operations System (VAOS)</option>
622
-										<option value="vam" <?php if (isset($source['format']) && $source['format'] == 'vam') print 'selected'; ?>>Virtual Airlines Manager</option>
623
-										<option value="whazzup" <?php if (isset($source['format']) && $source['format'] == 'whazzup') print 'selected'; ?>>IVAO</option>
624
-										<option value="flightgearmp" <?php if (isset($source['format']) && $source['format'] == 'flightgearmp') print 'selected'; ?>>FlightGear Multiplayer</option>
625
-										<option value="flightgearsp" <?php if (isset($source['format']) && $source['format'] == 'flightgearsp') print 'selected'; ?>>FlightGear Singleplayer</option>
626
-										<option value="acars" <?php if (isset($source['format']) && $source['format'] == 'acars') print 'selected'; ?>>ACARS from acarsdec/acarsdeco2 over UDP</option>
627
-										<option value="acarssbs3" <?php if (isset($source['format']) && $source['format'] == 'acarssbs3') print 'selected'; ?>>ACARS SBS-3 over TCP</option>
628
-										<option value="acarsjson" <?php if (isset($source['format']) && $source['format'] == 'acarsjson') print 'selected'; ?>>ACARS from acarsdec json and vdlm2dec</option>
629
-										<option value="acarsjsonudp" <?php if (isset($source['format']) && $source['format'] == 'acarsjsonudp') print 'selected'; ?>>ACARS from acarsdec json and vdlm2dec over UDP</option>
630
-										<option value="ais" <?php if (isset($source['format']) && $source['format'] == 'ais') print 'selected'; ?>>NMEA AIS over TCP</option>
631
-										<option value="airwhere" <?php if (isset($source['format']) && $source['format'] == 'airwhere') print 'selected'; ?>>AirWhere website</option>
632
-										<option value="hidnseek_callback" <?php if (isset($source['format']) && $source['format'] == 'hidnseek_callback') print 'selected'; ?>>HidnSeek Callback</option>
633
-										<option value="blitzortung" <?php if (isset($source['format']) && $source['format'] == 'blitzortung') print 'selected'; ?>>Blitzortung</option>
634
-										<option value="sailaway" <?php if (isset($source['format']) && $source['format'] == 'sailaway') print 'selected'; ?>>Sailaway</option>
635
-										<option value="sailawayfull" <?php if (isset($source['format']) && $source['format'] == 'sailawayfull') print 'selected'; ?>>Sailaway with missions, races,...</option>
745
+										<option value="auto" <?php if (!isset($source['format'])) {
746
+	print 'selected';
747
+}
748
+?>>Auto</option>
749
+										<option value="sbs" <?php if (isset($source['format']) && $source['format'] == 'sbs') {
750
+	print 'selected';
751
+}
752
+?>>SBS</option>
753
+										<option value="tsv" <?php if (isset($source['format']) && $source['format'] == 'tsv') {
754
+	print 'selected';
755
+}
756
+?>>TSV</option>
757
+										<option value="raw" <?php if (isset($source['format']) && $source['format'] == 'raw') {
758
+	print 'selected';
759
+}
760
+?>>Raw</option>
761
+										<option value="aircraftjson" <?php if (isset($source['format']) && $source['format'] == 'aircraftjson') {
762
+	print 'selected';
763
+}
764
+?>>Dump1090 aircraft.json</option>
765
+										<option value="planefinderclient" <?php if (isset($source['format']) && $source['format'] == 'planefinderclient') {
766
+	print 'selected';
767
+}
768
+?>>Planefinder client</option>
769
+										<option value="aprs" <?php if (isset($source['format']) && $source['format'] == 'aprs') {
770
+	print 'selected';
771
+}
772
+?>>APRS</option>
773
+										<option value="deltadbtxt" <?php if (isset($source['format']) && $source['format'] == 'deltadbtxt') {
774
+	print 'selected';
775
+}
776
+?>>Radarcape deltadb.txt</option>
777
+                                        <option value="radarcapejson" <?php if (isset($source['format']) && $source['format'] == 'radarcapejson') {
778
+	print 'selected';
779
+}
780
+?>>Radarcape json</option>
781
+										<option value="vatsimtxt" <?php if (isset($source['format']) && $source['format'] == 'vatsimtxt') {
782
+	print 'selected';
783
+}
784
+?>>Vatsim</option>
785
+										<option value="aircraftlistjson" <?php if (isset($source['format']) && $source['format'] == 'aircraftlistjson') {
786
+	print 'selected';
787
+}
788
+?>>Virtual Radar Server AircraftList.json</option>
789
+										<option value="vrstcp" <?php if (isset($source['format']) && $source['format'] == 'vrstcp') {
790
+	print 'selected';
791
+}
792
+?>>Virtual Radar Server TCP</option>
793
+										<option value="phpvmacars" <?php if (isset($source['format']) && $source['format'] == 'phpvmacars') {
794
+	print 'selected';
795
+}
796
+?>>phpVMS</option>
797
+										<option value="vaos" <?php if (isset($source['format']) && $source['format'] == 'phpvmacars') {
798
+	print 'selected';
799
+}
800
+?>>Virtual Airline Operations System (VAOS)</option>
801
+										<option value="vam" <?php if (isset($source['format']) && $source['format'] == 'vam') {
802
+	print 'selected';
803
+}
804
+?>>Virtual Airlines Manager</option>
805
+										<option value="whazzup" <?php if (isset($source['format']) && $source['format'] == 'whazzup') {
806
+	print 'selected';
807
+}
808
+?>>IVAO</option>
809
+										<option value="flightgearmp" <?php if (isset($source['format']) && $source['format'] == 'flightgearmp') {
810
+	print 'selected';
811
+}
812
+?>>FlightGear Multiplayer</option>
813
+										<option value="flightgearsp" <?php if (isset($source['format']) && $source['format'] == 'flightgearsp') {
814
+	print 'selected';
815
+}
816
+?>>FlightGear Singleplayer</option>
817
+										<option value="acars" <?php if (isset($source['format']) && $source['format'] == 'acars') {
818
+	print 'selected';
819
+}
820
+?>>ACARS from acarsdec/acarsdeco2 over UDP</option>
821
+										<option value="acarssbs3" <?php if (isset($source['format']) && $source['format'] == 'acarssbs3') {
822
+	print 'selected';
823
+}
824
+?>>ACARS SBS-3 over TCP</option>
825
+										<option value="acarsjson" <?php if (isset($source['format']) && $source['format'] == 'acarsjson') {
826
+	print 'selected';
827
+}
828
+?>>ACARS from acarsdec json and vdlm2dec</option>
829
+										<option value="acarsjsonudp" <?php if (isset($source['format']) && $source['format'] == 'acarsjsonudp') {
830
+	print 'selected';
831
+}
832
+?>>ACARS from acarsdec json and vdlm2dec over UDP</option>
833
+										<option value="ais" <?php if (isset($source['format']) && $source['format'] == 'ais') {
834
+	print 'selected';
835
+}
836
+?>>NMEA AIS over TCP</option>
837
+										<option value="airwhere" <?php if (isset($source['format']) && $source['format'] == 'airwhere') {
838
+	print 'selected';
839
+}
840
+?>>AirWhere website</option>
841
+										<option value="hidnseek_callback" <?php if (isset($source['format']) && $source['format'] == 'hidnseek_callback') {
842
+	print 'selected';
843
+}
844
+?>>HidnSeek Callback</option>
845
+										<option value="blitzortung" <?php if (isset($source['format']) && $source['format'] == 'blitzortung') {
846
+	print 'selected';
847
+}
848
+?>>Blitzortung</option>
849
+										<option value="sailaway" <?php if (isset($source['format']) && $source['format'] == 'sailaway') {
850
+	print 'selected';
851
+}
852
+?>>Sailaway</option>
853
+										<option value="sailawayfull" <?php if (isset($source['format']) && $source['format'] == 'sailawayfull') {
854
+	print 'selected';
855
+}
856
+?>>Sailaway with missions, races,...</option>
636 857
 									</select>
637 858
 								</td>
638 859
 								<td>
639
-									<input type="text" name="name[]" value="<?php if (isset($source['name'])) print $source['name']; ?>" />
860
+									<input type="text" name="name[]" value="<?php if (isset($source['name'])) {
861
+	print $source['name'];
862
+}
863
+?>" />
640 864
 								</td>
641
-								<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>
642
-								<td><input type="checkbox" name="noarchive[]" title="Don't archive this source" value="1" <?php if (isset($source['noarchive']) && $source['noarchive']) print 'checked'; ?> /></td>
865
+								<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']) {
866
+	print 'checked';
867
+}
868
+?> /></td>
869
+								<td><input type="checkbox" name="noarchive[]" title="Don't archive this source" value="1" <?php if (isset($source['noarchive']) && $source['noarchive']) {
870
+	print 'checked';
871
+}
872
+?> /></td>
643 873
 								<td>
644 874
 									<select name="timezones[]">
645 875
 								<?php
@@ -649,7 +879,9 @@  discard block
 block discarded – undo
649 879
 											print '<option selected>'.$timezones.'</option>';
650 880
 										} elseif (!isset($source['timezone']) && $timezones == 'UTC') {
651 881
 											print '<option selected>'.$timezones.'</option>';
652
-										} else print '<option>'.$timezones.'</option>';
882
+										} else {
883
+											print '<option>'.$timezones.'</option>';
884
+										}
653 885
 									}
654 886
 								?>
655 887
 									</select>
@@ -707,7 +939,9 @@  discard block
 block discarded – undo
707 939
 									foreach($timezonelist as $timezones){
708 940
 										if ($timezones == 'UTC') {
709 941
 											print '<option selected>'.$timezones.'</option>';
710
-										} else print '<option>'.$timezones.'</option>';
942
+										} else {
943
+											print '<option>'.$timezones.'</option>';
944
+										}
711 945
 									}
712 946
 								?>
713 947
 									</select>
@@ -732,11 +966,17 @@  discard block
 block discarded – undo
732 966
 					<p>Listen UDP server for acarsdec/acarsdeco2/... with <i>daemon-acars.php</i> script</p>
733 967
 					<p>
734 968
 						<label for="acarshost">ACARS UDP host</label>
735
-						<input type="text" name="acarshost" id="acarshost" value="<?php if (isset($globalACARSHost)) print $globalACARSHost; ?>" />
969
+						<input type="text" name="acarshost" id="acarshost" value="<?php if (isset($globalACARSHost)) {
970
+	print $globalACARSHost;
971
+}
972
+?>" />
736 973
 					</p>
737 974
 					<p>
738 975
 						<label for="acarsport">ACARS UDP port</label>
739
-						<input type="number" name="acarsport" id="acarsport" value="<?php if (isset($globalACARSPort)) print $globalACARSPort; ?>" />
976
+						<input type="number" name="acarsport" id="acarsport" value="<?php if (isset($globalACARSPort)) {
977
+	print $globalACARSPort;
978
+}
979
+?>" />
740 980
 					</p>
741 981
 					<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>
742 982
 				</fieldset>
@@ -763,17 +1003,38 @@  discard block
 block discarded – undo
763 1003
 				    <td><input type="url" name="newsurl[]" value="<?php print $feed; ?>"/></td>
764 1004
 				    <td>
765 1005
 					<select name="newslang[]">
766
-					    <option value="en"<?php if ($lng == 'en') print ' selected'; ?>>English</option>
767
-					    <option value="fr"<?php if ($lng == 'fr') print ' selected'; ?>>French</option>
1006
+					    <option value="en"<?php if ($lng == 'en') {
1007
+	print ' selected';
1008
+}
1009
+?>>English</option>
1010
+					    <option value="fr"<?php if ($lng == 'fr') {
1011
+	print ' selected';
1012
+}
1013
+?>>French</option>
768 1014
 					</select>
769 1015
 				    </td>
770 1016
 				    <td>
771 1017
 					<select name="newstype[]">
772
-					    <option value="global"<?php if ($type == 'global') print ' selected'; ?>>Global</option>
773
-					    <option value="aircraft"<?php if ($type == 'aircraft') print ' selected'; ?>>Aircraft</option>
774
-					    <option value="marine"<?php if ($type == 'marine') print ' selected'; ?>>Marine</option>
775
-					    <option value="tracker"<?php if ($type == 'tracker') print ' selected'; ?>>Tracker</option>
776
-					    <option value="satellite"<?php if ($type == 'Satellite') print ' selected'; ?>>Satellite</option>
1018
+					    <option value="global"<?php if ($type == 'global') {
1019
+	print ' selected';
1020
+}
1021
+?>>Global</option>
1022
+					    <option value="aircraft"<?php if ($type == 'aircraft') {
1023
+	print ' selected';
1024
+}
1025
+?>>Aircraft</option>
1026
+					    <option value="marine"<?php if ($type == 'marine') {
1027
+	print ' selected';
1028
+}
1029
+?>>Marine</option>
1030
+					    <option value="tracker"<?php if ($type == 'tracker') {
1031
+	print ' selected';
1032
+}
1033
+?>>Tracker</option>
1034
+					    <option value="satellite"<?php if ($type == 'Satellite') {
1035
+	print ' selected';
1036
+}
1037
+?>>Satellite</option>
777 1038
 					</select>
778 1039
 				    </td>
779 1040
 				    <td><input type="button" value="Delete" onclick="deleteRowNews(this)" /> <input type="button" value="Add" onclick="insRowNews()" /></td>
@@ -857,7 +1118,10 @@  discard block
 block discarded – undo
857 1118
 			</p>
858 1119
 			<p>
859 1120
 				<label for="corsproxy">CORS proxy</label>
860
-				<input type="text" name="corsproxy" id="corsproxy" value="<?php if (isset($globalCORSproxy)) print $globalCORSproxy; else print 'https://galvanize-cors-proxy.herokuapp.com/' ?>" />
1121
+				<input type="text" name="corsproxy" id="corsproxy" value="<?php if (isset($globalCORSproxy)) {
1122
+	print $globalCORSproxy;
1123
+} else {
1124
+	print 'https://galvanize-cors-proxy.herokuapp.com/' ?>" />
861 1125
 				<p class="help-block">CORS proxy used for some WMS servers</p>
862 1126
 			</p>
863 1127
 <!--
@@ -920,13 +1184,18 @@  discard block
 block discarded – undo
920 1184
 			<div id="schedules_options">
921 1185
 				<p>
922 1186
 					<label for="britishairways">British Airways API Key</label>
923
-					<input type="text" name="britishairways" id="britishairways" value="<?php if (isset($globalBritishAirwaysKey)) print $globalBritishAirwaysKey; ?>" />
1187
+					<input type="text" name="britishairways" id="britishairways" value="<?php if (isset($globalBritishAirwaysKey)) print $globalBritishAirwaysKey;
1188
+}
1189
+?>" />
924 1190
 					<p class="help-block">Register an account on <a href="https://developer.ba.com/">https://developer.ba.com/</a></p>
925 1191
 				</p>
926 1192
 				<!--
927 1193
 				<p>
928 1194
 					<label for="transavia">Transavia Test API Consumer Key</label>
929
-					<input type="text" name="transavia" id="transavia" value="<?php if (isset($globalTransaviaKey)) print $globalTransaviaKey; ?>" />
1195
+					<input type="text" name="transavia" id="transavia" value="<?php if (isset($globalTransaviaKey)) {
1196
+	print $globalTransaviaKey;
1197
+}
1198
+?>" />
930 1199
 					<p class="help-block">Register an account on <a href="https://developer.transavia.com">https://developer.transavia.com</a></p>
931 1200
 				</p>
932 1201
 				-->
@@ -935,10 +1204,16 @@  discard block
 block discarded – undo
935 1204
 						<b>Lufthansa API Key</b>
936 1205
 						<p>
937 1206
 							<label for="lufthansakey">Key</label>
938
-							<input type="text" name="lufthansakey" id="lufthansakey" value="<?php if (isset($globalLufthansaKey['key'])) print $globalLufthansaKey['key']; ?>" />
1207
+							<input type="text" name="lufthansakey" id="lufthansakey" value="<?php if (isset($globalLufthansaKey['key'])) {
1208
+	print $globalLufthansaKey['key'];
1209
+}
1210
+?>" />
939 1211
 						</p><p>
940 1212
 							<label for="lufthansasecret">Secret</label>
941
-							<input type="text" name="lufthansasecret" id="lufthansasecret" value="<?php if (isset($globalLufthansaKey['secret'])) print $globalLufthansaKey['secret']; ?>" />
1213
+							<input type="text" name="lufthansasecret" id="lufthansasecret" value="<?php if (isset($globalLufthansaKey['secret'])) {
1214
+	print $globalLufthansaKey['secret'];
1215
+}
1216
+?>" />
942 1217
 						</p>
943 1218
 					</div>
944 1219
 					<p class="help-block">Register an account on <a href="https://developer.lufthansa.com/page">https://developer.lufthansa.com/page</a></p>
@@ -948,11 +1223,17 @@  discard block
 block discarded – undo
948 1223
 						<b>FlightAware API Key</b>
949 1224
 						<p>
950 1225
 							<label for="flightawareusername">Username</label>
951
-							<input type="text" name="flightawareusername" id="flightawareusername" value="<?php if (isset($globalFlightAwareUsername)) print $globalFlightAwareUsername; ?>" />
1226
+							<input type="text" name="flightawareusername" id="flightawareusername" value="<?php if (isset($globalFlightAwareUsername)) {
1227
+	print $globalFlightAwareUsername;
1228
+}
1229
+?>" />
952 1230
 						</p>
953 1231
 						<p>
954 1232
 							<label for="flightawarepassword">API key</label>
955
-							<input type="text" name="flightawarepassword" id="flightawarepassword" value="<?php if (isset($globalFlightAwarePassword)) print $globalFlightAwarePassword; ?>" />
1233
+							<input type="text" name="flightawarepassword" id="flightawarepassword" value="<?php if (isset($globalFlightAwarePassword)) {
1234
+	print $globalFlightAwarePassword;
1235
+}
1236
+?>" />
956 1237
 						</p>
957 1238
 					</div>
958 1239
 					<p class="help-block">Register an account on <a href="https://www.flightaware.com/">https://www.flightaware.com/</a></p>
@@ -969,10 +1250,22 @@  discard block
 block discarded – undo
969 1250
 				<p>
970 1251
 					<label for="mapmatchingsource">Map Matching source</label>
971 1252
 					<select name="mapmatchingsource" id="mapmatchingsource">
972
-						<option value="fam" <?php if ((isset($globalMapMatchingSource) && $globalMapMatchingSource == 'fam') || !isset($globalMatchingSource)) print 'selected="selected" '; ?>>FlightAirMap Map Matching</option>
973
-						<option value="graphhopper" <?php if (isset($globalMapMatchingSource) && $globalMapMatchingSource == 'graphhopper') print 'selected="selected" '; ?>>GraphHopper</option>
974
-						<option value="osmr" <?php if (isset($globalMapMatchingSource) && $globalMapMatchingSource == 'osmr') print 'selected="selected" '; ?>>OSMR</option>
975
-						<option value="mapbox" <?php if (isset($globalMapMatchingSource) && $globalMapMatchingSource == 'mapbox') print 'selected="selected" '; ?>>Mapbox</option>
1253
+						<option value="fam" <?php if ((isset($globalMapMatchingSource) && $globalMapMatchingSource == 'fam') || !isset($globalMatchingSource)) {
1254
+	print 'selected="selected" ';
1255
+}
1256
+?>>FlightAirMap Map Matching</option>
1257
+						<option value="graphhopper" <?php if (isset($globalMapMatchingSource) && $globalMapMatchingSource == 'graphhopper') {
1258
+	print 'selected="selected" ';
1259
+}
1260
+?>>GraphHopper</option>
1261
+						<option value="osmr" <?php if (isset($globalMapMatchingSource) && $globalMapMatchingSource == 'osmr') {
1262
+	print 'selected="selected" ';
1263
+}
1264
+?>>OSMR</option>
1265
+						<option value="mapbox" <?php if (isset($globalMapMatchingSource) && $globalMapMatchingSource == 'mapbox') {
1266
+	print 'selected="selected" ';
1267
+}
1268
+?>>Mapbox</option>
976 1269
 					</select>
977 1270
 					<p class="help-block">Mapbox need the API Key defined in map section.</p>
978 1271
 					<p class="help-block">FlightAirMap Map Matching is free, without API key but limited to about 100 input points to keep fast results.</p>
@@ -980,7 +1273,10 @@  discard block
 block discarded – undo
980 1273
 				<br />
981 1274
 				<p>
982 1275
 					<label for="graphhopper">GraphHopper API Key</label>
983
-					<input type="text" name="graphhopper" id="graphhopper" value="<?php if (isset($globalGraphHopperKey)) print $globalGraphHopperKey; ?>" />
1276
+					<input type="text" name="graphhopper" id="graphhopper" value="<?php if (isset($globalGraphHopperKey)) {
1277
+	print $globalGraphHopperKey;
1278
+}
1279
+?>" />
984 1280
 					<p class="help-block">Register an account on <a href="https://www.graphhopper.com/">https://www.graphhopper.com/</a></p>
985 1281
 				</p>
986 1282
 			</div>
@@ -998,7 +1294,10 @@  discard block
 block discarded – undo
998 1294
 			</p>
999 1295
 			<p>
1000 1296
 				<label for="notamsource">URL of your feed from notaminfo.com</label>
1001
-				<input type="text" name="notamsource" id="notamsource" value="<?php if (isset($globalNOTAMSource)) print $globalNOTAMSource; ?>" />
1297
+				<input type="text" name="notamsource" id="notamsource" value="<?php if (isset($globalNOTAMSource)) {
1298
+	print $globalNOTAMSource;
1299
+}
1300
+?>" />
1002 1301
 				<p class="help-block">If you want to use world NOTAM from FlightAirMap website, leave it blank</p>
1003 1302
 			</p>
1004 1303
 			<br />
@@ -1014,14 +1313,20 @@  discard block
 block discarded – undo
1014 1313
 			<div id="metarsrc">
1015 1314
 				<p>
1016 1315
 					<label for="metarsource">URL of your METAR source</label>
1017
-					<input type="text" name="metarsource" id="metarsource" value="<?php if (isset($globalMETARurl)) print $globalMETARurl; ?>" />
1316
+					<input type="text" name="metarsource" id="metarsource" value="<?php if (isset($globalMETARurl)) {
1317
+	print $globalMETARurl;
1318
+}
1319
+?>" />
1018 1320
 					<p class="help-block">Use {icao} to specify where we replace by airport icao. ex : http://metar.vatsim.net/metar.php?id={icao}</p>
1019 1321
 				</p>
1020 1322
 			</div>
1021 1323
 			<br />
1022 1324
 			<p>
1023 1325
 				<label for="bitly">Bit.ly access token api (used in search page)</label>
1024
-				<input type="text" name="bitly" id="bitly" value="<?php if (isset($globalBitlyAccessToken)) print $globalBitlyAccessToken; ?>" />
1326
+				<input type="text" name="bitly" id="bitly" value="<?php if (isset($globalBitlyAccessToken)) {
1327
+	print $globalBitlyAccessToken;
1328
+}
1329
+?>" />
1025 1330
 			</p>
1026 1331
 			<br />
1027 1332
 			<p>
@@ -1037,11 +1342,26 @@  discard block
 block discarded – undo
1037 1342
 			<p>
1038 1343
 				<label for="geoid_source">Geoid Source</label>
1039 1344
 				<select name="geoid_source" id="geoid_source">
1040
-					<option value="egm96-15"<?php if (isset($globalGeoidSource) && $globalGeoidSource == 'egm96-15') print ' selected="selected"'; ?>>EGM96 15' (2.1MB)</option>
1041
-					<option value="egm96-5"<?php if (isset($globalGeoidSource) && $globalGeoidSource == 'egm96-5') print ' selected="selected"'; ?>>EGM96 5' (19MB)</option>
1042
-					<option value="egm2008-5"<?php if (isset($globalGeoidSource) && $globalGeoidSource == 'egm2008-5') print ' selected="selected"'; ?>>EGM2008 5' (19MB)</option>
1043
-					<option value="egm2008-2_5"<?php if (isset($globalGeoidSource) && $globalGeoidSource == 'egm2008-2_5') print ' selected="selected"'; ?>>EGM2008 2.5' (75MB)</option>
1044
-					<option value="egm2008-1"<?php if (isset($globalGeoidSource) && $globalGeoidSource == 'egm2008-1') print ' selected="selected"'; ?>>EGM2008 1' (470MB)</option>
1345
+					<option value="egm96-15"<?php if (isset($globalGeoidSource) && $globalGeoidSource == 'egm96-15') {
1346
+	print ' selected="selected"';
1347
+}
1348
+?>>EGM96 15' (2.1MB)</option>
1349
+					<option value="egm96-5"<?php if (isset($globalGeoidSource) && $globalGeoidSource == 'egm96-5') {
1350
+	print ' selected="selected"';
1351
+}
1352
+?>>EGM96 5' (19MB)</option>
1353
+					<option value="egm2008-5"<?php if (isset($globalGeoidSource) && $globalGeoidSource == 'egm2008-5') {
1354
+	print ' selected="selected"';
1355
+}
1356
+?>>EGM2008 5' (19MB)</option>
1357
+					<option value="egm2008-2_5"<?php if (isset($globalGeoidSource) && $globalGeoidSource == 'egm2008-2_5') {
1358
+	print ' selected="selected"';
1359
+}
1360
+?>>EGM2008 2.5' (75MB)</option>
1361
+					<option value="egm2008-1"<?php if (isset($globalGeoidSource) && $globalGeoidSource == 'egm2008-1') {
1362
+	print ' selected="selected"';
1363
+}
1364
+?>>EGM2008 1' (470MB)</option>
1045 1365
 				</select>
1046 1366
 				<p class="help-block">The geoid is approximated by an "earth gravity model" (EGM).</p>
1047 1367
 			</p>
@@ -1063,7 +1383,12 @@  discard block
 block discarded – undo
1063 1383
 			</p>
1064 1384
 			<p>
1065 1385
 				<label for="archivemonths">Generate statistics, delete or put in archive flights older than xx months</label>
1066
-				<input type="number" name="archivemonths" id="archivemonths" value="<?php if (isset($globalArchiveMonths)) print $globalArchiveMonths; else echo '1'; ?>" />
1386
+				<input type="number" name="archivemonths" id="archivemonths" value="<?php if (isset($globalArchiveMonths)) {
1387
+	print $globalArchiveMonths;
1388
+} else {
1389
+	echo '1';
1390
+}
1391
+?>" />
1067 1392
 				<p class="help-block">0 to disable, delete old flight if <i>Archive all flights data</i> is disabled</p>
1068 1393
 			</p>
1069 1394
 			<p>
@@ -1073,12 +1398,22 @@  discard block
 block discarded – undo
1073 1398
 			</p>
1074 1399
 			<p>
1075 1400
 				<label for="archivekeepmonths">Keep flights data for xx months in archive</label>
1076
-				<input type="number" name="archivekeepmonths" id="archivekeepmonths" value="<?php if (isset($globalArchiveKeepMonths)) print $globalArchiveKeepMonths; else echo '1'; ?>" />
1401
+				<input type="number" name="archivekeepmonths" id="archivekeepmonths" value="<?php if (isset($globalArchiveKeepMonths)) {
1402
+	print $globalArchiveKeepMonths;
1403
+} else {
1404
+	echo '1';
1405
+}
1406
+?>" />
1077 1407
 				<p class="help-block">0 to disable</p>
1078 1408
 			</p>
1079 1409
 			<p>
1080 1410
 				<label for="archivekeeptrackmonths">Keep flights track data for xx months in archive</label>
1081
-				<input type="number" name="archivekeeptrackmonths" id="archivekeeptrackmonths" value="<?php if (isset($globalArchiveKeepTrackMonths)) print $globalArchiveKeepTrackMonths; else echo '1'; ?>" />
1411
+				<input type="number" name="archivekeeptrackmonths" id="archivekeeptrackmonths" value="<?php if (isset($globalArchiveKeepTrackMonths)) {
1412
+	print $globalArchiveKeepTrackMonths;
1413
+} else {
1414
+	echo '1';
1415
+}
1416
+?>" />
1082 1417
 				<p class="help-block">0 to disable, should be less or egal to <i>Keep flights data</i> value</p>
1083 1418
 			</p>
1084 1419
 			<br />
@@ -1088,7 +1423,12 @@  discard block
 block discarded – undo
1088 1423
 				<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>
1089 1424
 				<div id="cronends"> 
1090 1425
 					<label for="cronend">Run script for xx seconds</label>
1091
-					<input type="number" name="cronend" id="cronend" value="<?php if (isset($globalCronEnd)) print $globalCronEnd; else print '0'; ?>" />
1426
+					<input type="number" name="cronend" id="cronend" value="<?php if (isset($globalCronEnd)) {
1427
+	print $globalCronEnd;
1428
+} else {
1429
+	print '0';
1430
+}
1431
+?>" />
1092 1432
 					<p class="help-block">Set to 0 to disable. Should be disabled if source is URL.</p>
1093 1433
 				</div>
1094 1434
 			</p>
@@ -1147,20 +1487,40 @@  discard block
 block discarded – undo
1147 1487
 			<br />
1148 1488
 			<p>
1149 1489
 				<label for="refresh">Show flights detected since xxx seconds</label>
1150
-				<input type="number" name="refresh" id="refresh" value="<?php if (isset($globalLiveInterval)) echo $globalLiveInterval; else echo '200'; ?>" />
1490
+				<input type="number" name="refresh" id="refresh" value="<?php if (isset($globalLiveInterval)) {
1491
+	echo $globalLiveInterval;
1492
+} else {
1493
+	echo '200';
1494
+}
1495
+?>" />
1151 1496
 			</p>
1152 1497
 			<p>
1153 1498
 				<label for="maprefresh">Live map refresh (in seconds)</label>
1154
-				<input type="number" name="maprefresh" id="maprefresh" value="<?php if (isset($globalMapRefresh)) echo $globalMapRefresh; else echo '30'; ?>" />
1499
+				<input type="number" name="maprefresh" id="maprefresh" value="<?php if (isset($globalMapRefresh)) {
1500
+	echo $globalMapRefresh;
1501
+} else {
1502
+	echo '30';
1503
+}
1504
+?>" />
1155 1505
 			</p>
1156 1506
 			<p>
1157 1507
 				<label for="mapidle">Map idle timeout (in minutes)</label>
1158
-				<input type="number" name="mapidle" id="mapidle" value="<?php if (isset($globalMapIdleTimeout)) echo $globalMapIdleTimeout; else echo '30'; ?>" />
1508
+				<input type="number" name="mapidle" id="mapidle" value="<?php if (isset($globalMapIdleTimeout)) {
1509
+	echo $globalMapIdleTimeout;
1510
+} else {
1511
+	echo '30';
1512
+}
1513
+?>" />
1159 1514
 				<p class="help-block">0 to disable</p>
1160 1515
 			</p>
1161 1516
 			<p>
1162 1517
 				<label for="minfetch">HTTP/file source fetch every xxx seconds</label>
1163
-				<input type="number" name="minfetch" id="minfetch" value="<?php if (isset($globalMinFetch)) echo $globalMinFetch; else echo '20'; ?>" />
1518
+				<input type="number" name="minfetch" id="minfetch" value="<?php if (isset($globalMinFetch)) {
1519
+	echo $globalMinFetch;
1520
+} else {
1521
+	echo '20';
1522
+}
1523
+?>" />
1164 1524
 			</p>
1165 1525
 			<p>
1166 1526
 				<label for="bbox">Only display flights that we can see on screen (bounding box)</label>
@@ -1179,12 +1539,20 @@  discard block
 block discarded – undo
1179 1539
 			<br />
1180 1540
 			<p>
1181 1541
 				<label for="closestmindist">Distance to airport set as arrival (in km)</label>
1182
-				<input type="number" name="closestmindist" id="closestmindist" value="<?php if (isset($globalClosestMinDist)) echo $globalClosestMinDist; else echo '50'; ?>" />
1542
+				<input type="number" name="closestmindist" id="closestmindist" value="<?php if (isset($globalClosestMinDist)) {
1543
+	echo $globalClosestMinDist;
1544
+} else {
1545
+	echo '50';
1546
+}
1547
+?>" />
1183 1548
 			</p>
1184 1549
 			<br />
1185 1550
 			<p>
1186 1551
 				<label for="aircraftsize">Size of aircraft icon on map (default to 30px if zoom > 7 else 15px), empty to default</label>
1187
-				<input type="number" name="aircraftsize" id="aircraftsize" value="<?php if (isset($globalAircraftSize)) echo $globalAircraftSize;?>" />
1552
+				<input type="number" name="aircraftsize" id="aircraftsize" value="<?php if (isset($globalAircraftSize)) {
1553
+	echo $globalAircraftSize;
1554
+}
1555
+?>" />
1188 1556
 			</p>
1189 1557
 			<br />
1190 1558
 			<p>
@@ -1203,22 +1571,42 @@  discard block
 block discarded – undo
1203 1571
 			<br />
1204 1572
 			<p>
1205 1573
 				<label for="aircrafticoncolor">Color of aircraft icon on map</label>
1206
-				<input type="color" name="aircrafticoncolor" id="aircrafticoncolor" value="#<?php if (isset($globalAircraftIconColor)) echo $globalAircraftIconColor; else echo '1a3151'; ?>" />
1574
+				<input type="color" name="aircrafticoncolor" id="aircrafticoncolor" value="#<?php if (isset($globalAircraftIconColor)) {
1575
+	echo $globalAircraftIconColor;
1576
+} else {
1577
+	echo '1a3151';
1578
+}
1579
+?>" />
1207 1580
 			</p>
1208 1581
 			<br />
1209 1582
 			<p>
1210 1583
 				<label for="marineiconcolor">Color of marine icon on map</label>
1211
-				<input type="color" name="marineiconcolor" id="marineiconcolor" value="#<?php if (isset($globalMarineIconColor)) echo $globalMarineIconColor; else echo '43d1d8'; ?>" />
1584
+				<input type="color" name="marineiconcolor" id="marineiconcolor" value="#<?php if (isset($globalMarineIconColor)) {
1585
+	echo $globalMarineIconColor;
1586
+} else {
1587
+	echo '43d1d8';
1588
+}
1589
+?>" />
1212 1590
 			</p>
1213 1591
 			<br />
1214 1592
 			<p>
1215 1593
 				<label for="trackericoncolor">Color of tracker icon on map</label>
1216
-				<input type="color" name="trackericoncolor" id="trackericoncolor" value="#<?php if (isset($globalTrackerIconColor)) echo $globalTrackerIconColor; else echo '1a3151'; ?>" />
1594
+				<input type="color" name="trackericoncolor" id="trackericoncolor" value="#<?php if (isset($globalTrackerIconColor)) {
1595
+	echo $globalTrackerIconColor;
1596
+} else {
1597
+	echo '1a3151';
1598
+}
1599
+?>" />
1217 1600
 			</p>
1218 1601
 			<br />
1219 1602
 			<p>
1220 1603
 				<label for="satelliteiconcolor">Color of satellite icon on map</label>
1221
-				<input type="color" name="satelliteiconcolor" id="satelliteiconcolor" value="#<?php if (isset($globalSatelliteIconColor)) echo $globalSatelliteIconColor; else echo '1a3151'; ?>" />
1604
+				<input type="color" name="satelliteiconcolor" id="satelliteiconcolor" value="#<?php if (isset($globalSatelliteIconColor)) {
1605
+	echo $globalSatelliteIconColor;
1606
+} else {
1607
+	echo '1a3151';
1608
+}
1609
+?>" />
1222 1610
 			</p>
1223 1611
 			<?php
1224 1612
 				if (!is_writable('../cache')) {
@@ -1242,14 +1630,27 @@  discard block
 block discarded – undo
1242 1630
 			<p>
1243 1631
 				<label for="airportzoom">Zoom level minimum to see airports icons</label>
1244 1632
 				<div class="range">
1245
-					<input type="range" name="airportzoom" id="airportzoom" value="<?php if (isset($globalAirportZoom)) echo $globalAirportZoom; else echo '7'; ?>" />
1246
-					<output id="range"><?php if (isset($globalAirportZoom)) echo $globalAirportZoom; else echo '7'; ?></output>
1633
+					<input type="range" name="airportzoom" id="airportzoom" value="<?php if (isset($globalAirportZoom)) {
1634
+	echo $globalAirportZoom;
1635
+} else {
1636
+	echo '7';
1637
+}
1638
+?>" />
1639
+					<output id="range"><?php if (isset($globalAirportZoom)) {
1640
+	echo $globalAirportZoom;
1641
+} else {
1642
+	echo '7';
1643
+}
1644
+?></output>
1247 1645
 				</div>
1248 1646
 			</p>
1249 1647
 			<br />
1250 1648
 			<p>
1251 1649
 				<label for="customcss">Custom CSS web path</label>
1252
-				<input type="text" name="customcss" id="customcss" value="<?php if (isset($globalCustomCSS)) echo $globalCustomCSS; ?>" />
1650
+				<input type="text" name="customcss" id="customcss" value="<?php if (isset($globalCustomCSS)) {
1651
+	echo $globalCustomCSS;
1652
+}
1653
+?>" />
1253 1654
 			</p>
1254 1655
 		</fieldset>
1255 1656
 		<input type="submit" name="submit" value="Create/Update database & write setup" />
@@ -1279,8 +1680,12 @@  discard block
 block discarded – undo
1279 1680
 	$dbhost = filter_input(INPUT_POST,'dbhost',FILTER_SANITIZE_STRING);
1280 1681
 	$dbport = filter_input(INPUT_POST,'dbport',FILTER_SANITIZE_STRING);
1281 1682
 
1282
-	if ($dbtype == 'mysql' && !extension_loaded('pdo_mysql')) $error .= 'Mysql driver for PDO must be loaded';
1283
-	if ($dbtype == 'pgsql' && !extension_loaded('pdo_pgsql')) $error .= 'PosgreSQL driver for PDO must be loaded';
1683
+	if ($dbtype == 'mysql' && !extension_loaded('pdo_mysql')) {
1684
+		$error .= 'Mysql driver for PDO must be loaded';
1685
+	}
1686
+	if ($dbtype == 'pgsql' && !extension_loaded('pdo_pgsql')) {
1687
+		$error .= 'PosgreSQL driver for PDO must be loaded';
1688
+	}
1284 1689
 	
1285 1690
 	$_SESSION['database_root'] = $dbroot;
1286 1691
 	$_SESSION['database_rootpass'] = $dbrootpass;
@@ -1359,15 +1764,23 @@  discard block
 block discarded – undo
1359 1764
 	$source_city = $_POST['source_city'];
1360 1765
 	$source_country = $_POST['source_country'];
1361 1766
 	$source_ref = $_POST['source_ref'];
1362
-	if (isset($source_id)) $source_id = $_POST['source_id'];
1363
-	else $source_id = array();
1767
+	if (isset($source_id)) {
1768
+		$source_id = $_POST['source_id'];
1769
+	} else {
1770
+		$source_id = array();
1771
+	}
1364 1772
 	
1365 1773
 	$sources = array();
1366 1774
 	foreach ($source_name as $keys => $name) {
1367
-	    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]);
1368
-	    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]);
1775
+	    if (isset($source_id[$keys])) {
1776
+	    	$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]);
1777
+	    } else {
1778
+	    	$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]);
1779
+	    }
1780
+	}
1781
+	if (count($sources) > 0) {
1782
+		$_SESSION['sources'] = $sources;
1369 1783
 	}
1370
-	if (count($sources) > 0) $_SESSION['sources'] = $sources;
1371 1784
 
1372 1785
 	$newsurl = $_POST['newsurl'];
1373 1786
 	$newslng = $_POST['newslang'];
@@ -1380,7 +1793,9 @@  discard block
 block discarded – undo
1380 1793
 		$lng = $newslng[$newskey];
1381 1794
 		if (isset($newsfeeds[$type][$lng])) {
1382 1795
 		    $newsfeeds[$type][$lng] = array_merge($newsfeeds[$type][$lng],array($url));
1383
-		} else $newsfeeds[$type][$lng] = array($url);
1796
+		} else {
1797
+			$newsfeeds[$type][$lng] = array($url);
1798
+		}
1384 1799
 	    }
1385 1800
 	}
1386 1801
 	$settings = array_merge($settings,array('globalNewsFeeds' => $newsfeeds));
@@ -1405,17 +1820,29 @@  discard block
 block discarded – undo
1405 1820
 	$datasource = filter_input(INPUT_POST,'datasource',FILTER_SANITIZE_STRING);
1406 1821
 
1407 1822
 	$globalaircraft = filter_input(INPUT_POST,'globalaircraft',FILTER_SANITIZE_STRING);
1408
-	if ($globalaircraft == 'aircraft') $settings = array_merge($settings,array('globalAircraft' => 'TRUE'));
1409
-	else $settings = array_merge($settings,array('globalAircraft' => 'FALSE'));
1823
+	if ($globalaircraft == 'aircraft') {
1824
+		$settings = array_merge($settings,array('globalAircraft' => 'TRUE'));
1825
+	} else {
1826
+		$settings = array_merge($settings,array('globalAircraft' => 'FALSE'));
1827
+	}
1410 1828
 	$globaltracker = filter_input(INPUT_POST,'globaltracker',FILTER_SANITIZE_STRING);
1411
-	if ($globaltracker == 'tracker') $settings = array_merge($settings,array('globalTracker' => 'TRUE'));
1412
-	else $settings = array_merge($settings,array('globalTracker' => 'FALSE'));
1829
+	if ($globaltracker == 'tracker') {
1830
+		$settings = array_merge($settings,array('globalTracker' => 'TRUE'));
1831
+	} else {
1832
+		$settings = array_merge($settings,array('globalTracker' => 'FALSE'));
1833
+	}
1413 1834
 	$globalmarine = filter_input(INPUT_POST,'globalmarine',FILTER_SANITIZE_STRING);
1414
-	if ($globalmarine == 'marine') $settings = array_merge($settings,array('globalMarine' => 'TRUE'));
1415
-	else $settings = array_merge($settings,array('globalMarine' => 'FALSE'));
1835
+	if ($globalmarine == 'marine') {
1836
+		$settings = array_merge($settings,array('globalMarine' => 'TRUE'));
1837
+	} else {
1838
+		$settings = array_merge($settings,array('globalMarine' => 'FALSE'));
1839
+	}
1416 1840
 	$globalsatellite = filter_input(INPUT_POST,'globalsatellite',FILTER_SANITIZE_STRING);
1417
-	if ($globalsatellite == 'satellite') $settings = array_merge($settings,array('globalSatellite' => 'TRUE'));
1418
-	else $settings = array_merge($settings,array('globalSatellite' => 'FALSE'));
1841
+	if ($globalsatellite == 'satellite') {
1842
+		$settings = array_merge($settings,array('globalSatellite' => 'TRUE'));
1843
+	} else {
1844
+		$settings = array_merge($settings,array('globalSatellite' => 'FALSE'));
1845
+	}
1419 1846
 
1420 1847
 /*	
1421 1848
 	$globalSBS1Hosts = array();
@@ -1437,23 +1864,37 @@  discard block
 block discarded – undo
1437 1864
 	$name = $_POST['name'];
1438 1865
 	$format = $_POST['format'];
1439 1866
 	$timezones = $_POST['timezones'];
1440
-	if (isset($_POST['sourcestats'])) $sourcestats = $_POST['sourcestats'];
1441
-	else $sourcestats = array();
1442
-	if (isset($_POST['noarchive'])) $noarchive = $_POST['noarchive'];
1443
-	else $noarchive = array();
1867
+	if (isset($_POST['sourcestats'])) {
1868
+		$sourcestats = $_POST['sourcestats'];
1869
+	} else {
1870
+		$sourcestats = array();
1871
+	}
1872
+	if (isset($_POST['noarchive'])) {
1873
+		$noarchive = $_POST['noarchive'];
1874
+	} else {
1875
+		$noarchive = array();
1876
+	}
1444 1877
 	$gSources = array();
1445 1878
 	$forcepilots = false;
1446 1879
 	foreach ($host as $key => $h) {
1447
-		if (isset($sourcestats[$key]) && $sourcestats[$key] == 1) $cov = 'TRUE';
1448
-		else $cov = 'FALSE';
1449
-		if (isset($noarchive[$key]) && $noarchive[$key] == 1) $arch = 'TRUE';
1450
-		else $arch = 'FALSE';
1880
+		if (isset($sourcestats[$key]) && $sourcestats[$key] == 1) {
1881
+			$cov = 'TRUE';
1882
+		} else {
1883
+			$cov = 'FALSE';
1884
+		}
1885
+		if (isset($noarchive[$key]) && $noarchive[$key] == 1) {
1886
+			$arch = 'TRUE';
1887
+		} else {
1888
+			$arch = 'FALSE';
1889
+		}
1451 1890
 		if (strpos($format[$key],'_callback')) {
1452 1891
 			$gSources[] = array('host' => $h, 'pass' => $port[$key],'name' => $name[$key],'format' => $format[$key],'sourcestats' => $cov,'noarchive' => $arch,'timezone' => $timezones[$key],'callback' => 'TRUE');
1453 1892
 		} elseif ($format[$key] != 'auto' || ($h != '' || $name[$key] != '')) {
1454 1893
 			$gSources[] = array('host' => $h, 'port' => $port[$key],'name' => $name[$key],'format' => $format[$key],'sourcestats' => $cov,'noarchive' => $arch,'timezone' => $timezones[$key],'callback' => 'FALSE');
1455 1894
 		}
1456
-		if ($format[$key] == 'airwhere') $forcepilots = true;
1895
+		if ($format[$key] == 'airwhere') {
1896
+			$forcepilots = true;
1897
+		}
1457 1898
 	}
1458 1899
 	$settings = array_merge($settings,array('globalSources' => $gSources));
1459 1900
 
@@ -1484,7 +1925,9 @@  discard block
 block discarded – undo
1484 1925
 	$zoidistance = filter_input(INPUT_POST,'zoidistance',FILTER_SANITIZE_NUMBER_INT);
1485 1926
 	if ($zoilatitude != '' && $zoilongitude != '' && $zoidistance != '') {
1486 1927
 		$settings = array_merge($settings,array('globalDistanceIgnore' => array('latitude' => $zoilatitude,'longitude' => $zoilongitude,'distance' => $zoidistance)));
1487
-	} else $settings = array_merge($settings,array('globalDistanceIgnore' => array()));
1928
+	} else {
1929
+		$settings = array_merge($settings,array('globalDistanceIgnore' => array()));
1930
+	}
1488 1931
 
1489 1932
 	$refresh = filter_input(INPUT_POST,'refresh',FILTER_SANITIZE_NUMBER_INT);
1490 1933
 	$settings = array_merge($settings,array('globalLiveInterval' => $refresh));
@@ -1525,7 +1968,9 @@  discard block
 block discarded – undo
1525 1968
 
1526 1969
 	// Create in settings.php keys not yet configurable if not already here
1527 1970
 	//if (!isset($globalImageBingKey)) $settings = array_merge($settings,array('globalImageBingKey' => ''));
1528
-	if (!isset($globalDebug)) $settings = array_merge($settings,array('globalDebug' => 'TRUE'));
1971
+	if (!isset($globalDebug)) {
1972
+		$settings = array_merge($settings,array('globalDebug' => 'TRUE'));
1973
+	}
1529 1974
 
1530 1975
 	$resetyearstats = filter_input(INPUT_POST,'resetyearstats',FILTER_SANITIZE_STRING);
1531 1976
 	if ($resetyearstats == 'resetyearstats') {
@@ -1568,37 +2013,56 @@  discard block
 block discarded – undo
1568 2013
 	}
1569 2014
 */
1570 2015
 	$settings = array_merge($settings,array('globalFlightAware' => 'FALSE'));
1571
-	if ($globalsbs == 'sbs') $settings = array_merge($settings,array('globalSBS1' => 'TRUE'));
1572
-	else $settings = array_merge($settings,array('globalSBS1' => 'FALSE'));
1573
-	if ($globalaprs == 'aprs') $settings = array_merge($settings,array('globalAPRS' => 'TRUE'));
1574
-	else $settings = array_merge($settings,array('globalAPRS' => 'FALSE'));
2016
+	if ($globalsbs == 'sbs') {
2017
+		$settings = array_merge($settings,array('globalSBS1' => 'TRUE'));
2018
+	} else {
2019
+		$settings = array_merge($settings,array('globalSBS1' => 'FALSE'));
2020
+	}
2021
+	if ($globalaprs == 'aprs') {
2022
+		$settings = array_merge($settings,array('globalAPRS' => 'TRUE'));
2023
+	} else {
2024
+		$settings = array_merge($settings,array('globalAPRS' => 'FALSE'));
2025
+	}
1575 2026
 	$va = false;
1576 2027
 	if ($globalivao == 'ivao') {
1577 2028
 		$settings = array_merge($settings,array('globalIVAO' => 'TRUE'));
1578 2029
 		$va = true;
1579
-	} else $settings = array_merge($settings,array('globalIVAO' => 'FALSE'));
2030
+	} else {
2031
+		$settings = array_merge($settings,array('globalIVAO' => 'FALSE'));
2032
+	}
1580 2033
 	if ($globalvatsim == 'vatsim') {
1581 2034
 		$settings = array_merge($settings,array('globalVATSIM' => 'TRUE'));
1582 2035
 		$va = true;
1583
-	} else $settings = array_merge($settings,array('globalVATSIM' => 'FALSE'));
2036
+	} else {
2037
+		$settings = array_merge($settings,array('globalVATSIM' => 'FALSE'));
2038
+	}
1584 2039
 	if ($globalphpvms == 'phpvms') {
1585 2040
 		$settings = array_merge($settings,array('globalphpVMS' => 'TRUE'));
1586 2041
 		$va = true;
1587
-	} else $settings = array_merge($settings,array('globalphpVMS' => 'FALSE'));
2042
+	} else {
2043
+		$settings = array_merge($settings,array('globalphpVMS' => 'FALSE'));
2044
+	}
1588 2045
 	if ($globalvam == 'vam') {
1589 2046
 		$settings = array_merge($settings,array('globalVAM' => 'TRUE'));
1590 2047
 		$va = true;
1591
-	} else $settings = array_merge($settings,array('globalVAM' => 'FALSE'));
2048
+	} else {
2049
+		$settings = array_merge($settings,array('globalVAM' => 'FALSE'));
2050
+	}
1592 2051
 	if ($va) {
1593 2052
 		$settings = array_merge($settings,array('globalSchedulesFetch' => 'FALSE','globalTranslationFetch' => 'FALSE'));
1594
-	} else $settings = array_merge($settings,array('globalSchedulesFetch' => 'TRUE','globalTranslationFetch' => 'TRUE'));
2053
+	} else {
2054
+		$settings = array_merge($settings,array('globalSchedulesFetch' => 'TRUE','globalTranslationFetch' => 'TRUE'));
2055
+	}
1595 2056
 	if ($globalva == 'va' || $va) {
1596 2057
 		$settings = array_merge($settings,array('globalVA' => 'TRUE'));
1597 2058
 		$settings = array_merge($settings,array('globalUsePilot' => 'TRUE','globalUseOwner' => 'FALSE'));
1598 2059
 	} else {
1599 2060
 		$settings = array_merge($settings,array('globalVA' => 'FALSE'));
1600
-		if ($forcepilots) $settings = array_merge($settings,array('globalUsePilot' => 'TRUE','globalUseOwner' => 'FALSE'));
1601
-		else $settings = array_merge($settings,array('globalUsePilot' => 'FALSE','globalUseOwner' => 'TRUE'));
2061
+		if ($forcepilots) {
2062
+			$settings = array_merge($settings,array('globalUsePilot' => 'TRUE','globalUseOwner' => 'FALSE'));
2063
+		} else {
2064
+			$settings = array_merge($settings,array('globalUsePilot' => 'FALSE','globalUseOwner' => 'TRUE'));
2065
+		}
1602 2066
 	}
1603 2067
 	if ($globalvm == 'vm') {
1604 2068
 		$settings = array_merge($settings,array('globalVM' => 'TRUE'));
@@ -1858,7 +2322,9 @@  discard block
 block discarded – undo
1858 2322
 	$graphhopper = filter_input(INPUT_POST,'graphhopper',FILTER_SANITIZE_STRING);
1859 2323
 	$settings = array_merge($settings,array('globalGraphHopperKey' => $graphhopper));
1860 2324
 
1861
-	if (!isset($globalTransaction)) $settings = array_merge($settings,array('globalTransaction' => 'TRUE'));
2325
+	if (!isset($globalTransaction)) {
2326
+		$settings = array_merge($settings,array('globalTransaction' => 'TRUE'));
2327
+	}
1862 2328
 
1863 2329
 	// Set some defaults values...
1864 2330
 	if (!isset($globalAircraftImageSources)) {
@@ -1873,15 +2339,23 @@  discard block
 block discarded – undo
1873 2339
 
1874 2340
 	$settings = array_merge($settings,array('globalInstalled' => 'TRUE'));
1875 2341
 
1876
-	if ($error == '') settings::modify_settings($settings);
1877
-	if ($error == '') settings::comment_settings($settings_comment);
2342
+	if ($error == '') {
2343
+		settings::modify_settings($settings);
2344
+	}
2345
+	if ($error == '') {
2346
+		settings::comment_settings($settings_comment);
2347
+	}
1878 2348
 	if ($error != '') {
1879 2349
 		print '<div class="info column">'.$error.'</div>';
1880 2350
 		require('../footer.php');
1881 2351
 		exit;
1882 2352
 	} else {
1883
-		if (isset($_POST['waypoints']) && $_POST['waypoints'] == 'waypoints') $_SESSION['waypoints'] = 1;
1884
-		if (isset($_POST['owner']) && $_POST['owner'] == 'owner') $_SESSION['owner'] = 1;
2353
+		if (isset($_POST['waypoints']) && $_POST['waypoints'] == 'waypoints') {
2354
+			$_SESSION['waypoints'] = 1;
2355
+		}
2356
+		if (isset($_POST['owner']) && $_POST['owner'] == 'owner') {
2357
+			$_SESSION['owner'] = 1;
2358
+		}
1885 2359
 		if (isset($_POST['createdb'])) {
1886 2360
 			$_SESSION['install'] = 'database_create';
1887 2361
 		} else {
@@ -1918,10 +2392,18 @@  discard block
 block discarded – undo
1918 2392
 	$popw = false;
1919 2393
 	foreach ($_SESSION['done'] as $done) {
1920 2394
 	    print '<li>'.$done.'....<strong>SUCCESS</strong></li>';
1921
-	    if ($done == 'Create database') $pop = true;
1922
-	    if ($_SESSION['install'] == 'database_create') $pop = true;
1923
-	    if ($_SESSION['install'] == 'database_import') $popi = true;
1924
-	    if ($_SESSION['install'] == 'waypoints') $popw = true;
2395
+	    if ($done == 'Create database') {
2396
+	    	$pop = true;
2397
+	    }
2398
+	    if ($_SESSION['install'] == 'database_create') {
2399
+	    	$pop = true;
2400
+	    }
2401
+	    if ($_SESSION['install'] == 'database_import') {
2402
+	    	$popi = true;
2403
+	    }
2404
+	    if ($_SESSION['install'] == 'waypoints') {
2405
+	    	$popw = true;
2406
+	    }
1925 2407
 	}
1926 2408
 	if ($pop) {
1927 2409
 	    sleep(5);
@@ -1932,7 +2414,9 @@  discard block
 block discarded – undo
1932 2414
 	} else if ($popw) {
1933 2415
 	    sleep(5);
1934 2416
 	    print '<li>Populate waypoints database....<img src="../images/loading.gif" /></li>';
1935
-	} else print '<li>Update schema if needed....<img src="../images/loading.gif" /></li>';
2417
+	} else {
2418
+		print '<li>Update schema if needed....<img src="../images/loading.gif" /></li>';
2419
+	}
1936 2420
 	print '</div></ul>';
1937 2421
 	print '<div id="error"></div>';
1938 2422
 /*	foreach ($_SESSION['done'] as $done) {
Please login to merge, or discard this patch.
aircraft-detailed.php 2 patches
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -5,16 +5,16 @@  discard block
 block discarded – undo
5 5
 require_once('require/class.Language.php');
6 6
 $Spotter = new Spotter();
7 7
 
8
-if (!isset($_GET['aircraft_type'])){
8
+if (!isset($_GET['aircraft_type'])) {
9 9
 	header('Location: '.$globalURL.'/aircraft');
10 10
 } else {
11 11
 	//calculuation for the pagination
12
-	if(!isset($_GET['limit']) || count(explode(",", $_GET['limit'])) < 2)
12
+	if (!isset($_GET['limit']) || count(explode(",", $_GET['limit'])) < 2)
13 13
 	{
14 14
 		$limit_start = 0;
15 15
 		$limit_end = 25;
16 16
 		$absolute_difference = 25;
17
-	}  else {
17
+	} else {
18 18
 		$limit_explode = explode(",", $_GET['limit']);
19 19
 		$limit_start = $limit_explode[0];
20 20
 		$limit_end = $limit_explode[1];
@@ -28,19 +28,19 @@  discard block
 block discarded – undo
28 28
 	$limit_previous_1 = $limit_start - $absolute_difference;
29 29
 	$limit_previous_2 = $limit_end - $absolute_difference;
30 30
 	
31
-	$aircraft_type = filter_input(INPUT_GET,'aircraft_type',FILTER_SANITIZE_STRING);
31
+	$aircraft_type = filter_input(INPUT_GET, 'aircraft_type', FILTER_SANITIZE_STRING);
32 32
 	$page_url = $globalURL.'/aircraft/'.$aircraft_type;
33 33
 	
34
-	$sort = htmlspecialchars(filter_input(INPUT_GET,'sort',FILTER_SANITIZE_STRING));
35
-	$spotter_array = $Spotter->getSpotterDataByAircraft($aircraft_type,$limit_start.",".$absolute_difference, $sort);
34
+	$sort = htmlspecialchars(filter_input(INPUT_GET, 'sort', FILTER_SANITIZE_STRING));
35
+	$spotter_array = $Spotter->getSpotterDataByAircraft($aircraft_type, $limit_start.",".$absolute_difference, $sort);
36 36
 	
37 37
 	$aircraft_info = $Spotter->getAllAircraftInfo($aircraft_type);
38 38
 	if (!empty($spotter_array) || !empty($aircraft_info))
39 39
 	{
40 40
 		if (!empty($aircraft_info)) {
41
-			$title = sprintf(_("Detailed View for %s (%s)"),$aircraft_info[0]['type'],$aircraft_info[0]['icao']);
41
+			$title = sprintf(_("Detailed View for %s (%s)"), $aircraft_info[0]['type'], $aircraft_info[0]['icao']);
42 42
 		} else {
43
-			$title = sprintf(_("Detailed View for %s (%s)"),$spotter_array[0]['aircraft_name'],$spotter_array[0]['aircraft_type']);
43
+			$title = sprintf(_("Detailed View for %s (%s)"), $spotter_array[0]['aircraft_name'], $spotter_array[0]['aircraft_type']);
44 44
 		}
45 45
 		require_once('header.php');
46 46
 	    
@@ -51,9 +51,9 @@  discard block
 block discarded – undo
51 51
 		$Stats = new Stats();
52 52
 		$aircraft_types = $Stats->getAllAircraftTypes();
53 53
 		if (empty($aircraft_types)) $aircraft_types = $Spotter->getAllAircraftTypes();
54
-		foreach($aircraft_types as $aircrafttype)
54
+		foreach ($aircraft_types as $aircrafttype)
55 55
 		{
56
-			if($aircraft_type == $aircrafttype['aircraft_icao'])
56
+			if ($aircraft_type == $aircrafttype['aircraft_icao'])
57 57
 			{
58 58
 				print '<option value="'.$aircrafttype['aircraft_icao'].'" selected="selected">'.$aircrafttype['aircraft_manufacturer'].' '.$aircrafttype['aircraft_name'].' ('.$aircrafttype['aircraft_icao'].')</option>';
59 59
 			} else {
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
 		if (!empty($spotter_array)) {
91 91
 			include('aircraft-sub-menu.php');
92 92
 			print '<div class="table column">';
93
-			print '<p>'.sprintf(_("The table below shows the detailed information of all flights from <strong>%s (%s)</strong>."),$spotter_array[0]['aircraft_name'],$spotter_array[0]['aircraft_type']).'</p>';
93
+			print '<p>'.sprintf(_("The table below shows the detailed information of all flights from <strong>%s (%s)</strong>."), $spotter_array[0]['aircraft_name'], $spotter_array[0]['aircraft_type']).'</p>';
94 94
 			include('table-output.php');
95 95
 			print '<div class="pagination">';
96 96
 			if ($limit_previous_1 >= 0)
Please login to merge, or discard this patch.
Braces   +16 added lines, -6 removed lines patch added patch discarded remove patch
@@ -14,7 +14,7 @@  discard block
 block discarded – undo
14 14
 		$limit_start = 0;
15 15
 		$limit_end = 25;
16 16
 		$absolute_difference = 25;
17
-	}  else {
17
+	} else {
18 18
 		$limit_explode = explode(",", $_GET['limit']);
19 19
 		$limit_start = $limit_explode[0];
20 20
 		$limit_end = $limit_explode[1];
@@ -50,7 +50,9 @@  discard block
 block discarded – undo
50 50
 		print '<option></option>';
51 51
 		$Stats = new Stats();
52 52
 		$aircraft_types = $Stats->getAllAircraftTypes();
53
-		if (empty($aircraft_types)) $aircraft_types = $Spotter->getAllAircraftTypes();
53
+		if (empty($aircraft_types)) {
54
+			$aircraft_types = $Spotter->getAllAircraftTypes();
55
+		}
54 56
 		foreach($aircraft_types as $aircrafttype)
55 57
 		{
56 58
 			if($aircraft_type == $aircrafttype['aircraft_icao'])
@@ -73,14 +75,22 @@  discard block
 block discarded – undo
73 75
 				print '<div><span class="label">'._("Name").'</span>'.$aircraft_info[0]['type'].'</div>';
74 76
 				print '<div><span class="label">'._("ICAO").'</span>'.$aircraft_info[0]['icao'].'</div>'; 
75 77
 				print '<div><span class="label">'._("Manufacturer").'</span><a href="'.$globalURL.'/manufacturer/'.strtolower(str_replace(" ", "-", $aircraft_info[0]['manufacturer'])).'">'.$aircraft_info[0]['manufacturer'].'</a></div>';
76
-				if ($aircraft_info[0]['aircraft_description'] != '' && $aircraft_info[0]['aircraft_description'] != 'None') print '<div><span class="label">'._("Description").'</span>'.$aircraft_info[0]['aircraft_description'].'</div>'; 
77
-				if ($aircraft_info[0]['engine_type'] != '' && $aircraft_info[0]['engine_type'] != 'None') print '<div><span class="label">'._("Engine").'</span>'.$aircraft_info[0]['engine_type'].'</div>'; 
78
-				if ($aircraft_info[0]['engine_count'] != '' && $aircraft_info[0]['engine_count'] != 0) print '<div><span class="label">'._("Engine count").'</span>'.$aircraft_info[0]['engine_count'].'</div>'; 
78
+				if ($aircraft_info[0]['aircraft_description'] != '' && $aircraft_info[0]['aircraft_description'] != 'None') {
79
+					print '<div><span class="label">'._("Description").'</span>'.$aircraft_info[0]['aircraft_description'].'</div>';
80
+				}
81
+				if ($aircraft_info[0]['engine_type'] != '' && $aircraft_info[0]['engine_type'] != 'None') {
82
+					print '<div><span class="label">'._("Engine").'</span>'.$aircraft_info[0]['engine_type'].'</div>';
83
+				}
84
+				if ($aircraft_info[0]['engine_count'] != '' && $aircraft_info[0]['engine_count'] != 0) {
85
+					print '<div><span class="label">'._("Engine count").'</span>'.$aircraft_info[0]['engine_count'].'</div>';
86
+				}
79 87
 			} else {
80 88
 				print '<h1>'.$spotter_array[0]['aircraft_name'].' ('.$spotter_array[0]['aircraft_type'].')</h1>';
81 89
 				print '<div><span class="label">'._("Name").'</span>'.$spotter_array[0]['aircraft_name'].'</div>';
82 90
 				print '<div><span class="label">'._("ICAO").'</span>'.$spotter_array[0]['aircraft_type'].'</div>'; 
83
-				if (isset($spotter_array[0]['aircraft_manufacturer'])) print '<div><span class="label">'._("Manufacturer").'</span><a href="'.$globalURL.'/manufacturer/'.strtolower(str_replace(" ", "-", $spotter_array[0]['aircraft_manufacturer'])).'">'.$spotter_array[0]['aircraft_manufacturer'].'</a></div>';
91
+				if (isset($spotter_array[0]['aircraft_manufacturer'])) {
92
+					print '<div><span class="label">'._("Manufacturer").'</span><a href="'.$globalURL.'/manufacturer/'.strtolower(str_replace(" ", "-", $spotter_array[0]['aircraft_manufacturer'])).'">'.$spotter_array[0]['aircraft_manufacturer'].'</a></div>';
93
+				}
84 94
 			}
85 95
 			print '</div>';
86 96
 		} else {
Please login to merge, or discard this patch.
owner-statistics-time.php 3 patches
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -4,8 +4,8 @@
 block discarded – undo
4 4
 require_once('require/class.SpotterArchive.php');
5 5
 require_once('require/class.Language.php');
6 6
 if (!isset($_GET['owner'])) {
7
-        header('Location: '.$globalURL.'/owner');
8
-        die();
7
+		header('Location: '.$globalURL.'/owner');
8
+		die();
9 9
 }
10 10
 $Spotter = new Spotter();
11 11
 $SpotterArchive = new SpotterArchive();
Please login to merge, or discard this patch.
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -9,22 +9,22 @@  discard block
 block discarded – undo
9 9
 }
10 10
 $Spotter = new Spotter();
11 11
 $SpotterArchive = new SpotterArchive();
12
-$sort = filter_input(INPUT_GET,'sort',FILTER_SANITIZE_STRING);
13
-$owner = urldecode(filter_input(INPUT_GET,'owner',FILTER_SANITIZE_STRING));
14
-$year = filter_input(INPUT_GET,'year',FILTER_SANITIZE_NUMBER_INT);
15
-$month = filter_input(INPUT_GET,'month',FILTER_SANITIZE_NUMBER_INT);
12
+$sort = filter_input(INPUT_GET, 'sort', FILTER_SANITIZE_STRING);
13
+$owner = urldecode(filter_input(INPUT_GET, 'owner', FILTER_SANITIZE_STRING));
14
+$year = filter_input(INPUT_GET, 'year', FILTER_SANITIZE_NUMBER_INT);
15
+$month = filter_input(INPUT_GET, 'month', FILTER_SANITIZE_NUMBER_INT);
16 16
 $filter = array();
17
-if ($year != '') $filter = array_merge($filter,array('year' => $year));
18
-if ($month != '') $filter = array_merge($filter,array('month' => $month));
17
+if ($year != '') $filter = array_merge($filter, array('year' => $year));
18
+if ($month != '') $filter = array_merge($filter, array('month' => $month));
19 19
 $archive = false;
20
-$spotter_array = $Spotter->getSpotterDataByOwner($owner,"0,1", $sort,$filter);
20
+$spotter_array = $Spotter->getSpotterDataByOwner($owner, "0,1", $sort, $filter);
21 21
 if (empty($spotter_array) && isset($globalArchiveResults) && $globalArchiveResults) {
22 22
 	$archive = true;
23
-	$spotter_array = $SpotterArchive->getSpotterDataByOwner($owner,"0,1", $sort,$filter);
23
+	$spotter_array = $SpotterArchive->getSpotterDataByOwner($owner, "0,1", $sort, $filter);
24 24
 }
25 25
 if (!empty($spotter_array))
26 26
 {
27
-	$title = sprintf(_("Most Common Time of Day of %s"),$spotter_array[0]['aircraft_owner']);
27
+	$title = sprintf(_("Most Common Time of Day of %s"), $spotter_array[0]['aircraft_owner']);
28 28
 	require_once('header.php');
29 29
 	print '<div class="info column">';
30 30
 	print '<h1>'.$spotter_array[0]['aircraft_owner'].'</h1>';
@@ -35,12 +35,12 @@  discard block
 block discarded – undo
35 35
 	include('owner-sub-menu.php');
36 36
 	print '<div class="column">';
37 37
 	print '<h2>'._("Most Common Time of Day").'</h2>';
38
-	print '<p>'.sprintf(_("The statistic below shows the most common time of day of flights owned by <strong>%s</strong>."),$spotter_array[0]['aircraft_owner']).'</p>';
38
+	print '<p>'.sprintf(_("The statistic below shows the most common time of day of flights owned by <strong>%s</strong>."), $spotter_array[0]['aircraft_owner']).'</p>';
39 39
 
40 40
 	if ($archive === false) {
41
-		$hour_array = $Spotter->countAllHoursByOwner($owner,$filter);
41
+		$hour_array = $Spotter->countAllHoursByOwner($owner, $filter);
42 42
 	} else {
43
-		$hour_array = $SpotterArchive->countAllHoursByOwner($owner,$filter);
43
+		$hour_array = $SpotterArchive->countAllHoursByOwner($owner, $filter);
44 44
 	}
45 45
 	print '<link href="'.$globalURL.'/css/c3.min.css" rel="stylesheet" type="text/css">';
46 46
 	print '<script type="text/javascript" src="'.$globalURL.'/js/d3.min.js"></script>';
@@ -49,9 +49,9 @@  discard block
 block discarded – undo
49 49
 	$hour_data = '';
50 50
 	$hour_cnt = '';
51 51
 	$last = 0;
52
-	foreach($hour_array as $hour_item)
52
+	foreach ($hour_array as $hour_item)
53 53
 	{
54
-		while($last != $hour_item['hour_name']) {
54
+		while ($last != $hour_item['hour_name']) {
55 55
 			$hour_data .= '"'.$last.':00",';
56 56
 			$hour_cnt .= '0,';
57 57
 			$last++;
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
 		$hour_cnt .= $hour_item['hour_count'].',';
62 62
 	}
63 63
 	$hour_data = "['x',".substr($hour_data, 0, -1)."]";
64
-	$hour_cnt = "['flights',".substr($hour_cnt,0,-1)."]";
64
+	$hour_cnt = "['flights',".substr($hour_cnt, 0, -1)."]";
65 65
 	print 'c3.generate({
66 66
 	    bindto: "#chartHour",
67 67
 	    data: {
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
 		print '</thead>';
87 87
 		print '<tbody>';
88 88
 		$i = 1;
89
-		foreach($hour_array as $hour_item)
89
+		foreach ($hour_array as $hour_item)
90 90
 		{
91 91
 			print '<tr>';
92 92
 			print '<td>'.$hour_item['hour_name'].':00</td>';
Please login to merge, or discard this patch.
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -14,8 +14,12 @@
 block discarded – undo
14 14
 $year = filter_input(INPUT_GET,'year',FILTER_SANITIZE_NUMBER_INT);
15 15
 $month = filter_input(INPUT_GET,'month',FILTER_SANITIZE_NUMBER_INT);
16 16
 $filter = array();
17
-if ($year != '') $filter = array_merge($filter,array('year' => $year));
18
-if ($month != '') $filter = array_merge($filter,array('month' => $month));
17
+if ($year != '') {
18
+	$filter = array_merge($filter,array('year' => $year));
19
+}
20
+if ($month != '') {
21
+	$filter = array_merge($filter,array('month' => $month));
22
+}
19 23
 $archive = false;
20 24
 $spotter_array = $Spotter->getSpotterDataByOwner($owner,"0,1", $sort,$filter);
21 25
 if (empty($spotter_array) && isset($globalArchiveResults) && $globalArchiveResults) {
Please login to merge, or discard this patch.
owner-statistics-registration.php 3 patches
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -9,21 +9,21 @@  discard block
 block discarded – undo
9 9
 }
10 10
 $Spotter = new Spotter();
11 11
 $SpotterArchive = new SpotterArchive();
12
-$owner = urldecode(filter_input(INPUT_GET,'owner',FILTER_SANITIZE_STRING));
13
-$sort = filter_input(INPUT_GET,'sort',FILTER_SANITIZE_STRING);
14
-$year = filter_input(INPUT_GET,'year',FILTER_SANITIZE_NUMBER_INT);
15
-$month = filter_input(INPUT_GET,'month',FILTER_SANITIZE_NUMBER_INT);
12
+$owner = urldecode(filter_input(INPUT_GET, 'owner', FILTER_SANITIZE_STRING));
13
+$sort = filter_input(INPUT_GET, 'sort', FILTER_SANITIZE_STRING);
14
+$year = filter_input(INPUT_GET, 'year', FILTER_SANITIZE_NUMBER_INT);
15
+$month = filter_input(INPUT_GET, 'month', FILTER_SANITIZE_NUMBER_INT);
16 16
 $filter = array();
17
-if ($year != '') $filter = array_merge($filter,array('year' => $year));
18
-if ($month != '') $filter = array_merge($filter,array('month' => $month));
17
+if ($year != '') $filter = array_merge($filter, array('year' => $year));
18
+if ($month != '') $filter = array_merge($filter, array('month' => $month));
19 19
 $archive = false;
20
-$spotter_array = $Spotter->getSpotterDataByOwner($owner,"0,1", $sort,$filter);
20
+$spotter_array = $Spotter->getSpotterDataByOwner($owner, "0,1", $sort, $filter);
21 21
 if (empty($spotter_array) && isset($globalArchiveResults) && $globalArchiveResults) {
22
-	$spotter_array = $SpotterArchive->getSpotterDataByOwner($owner,"0,1", $sort,$filter);
22
+	$spotter_array = $SpotterArchive->getSpotterDataByOwner($owner, "0,1", $sort, $filter);
23 23
 }
24 24
 if (!empty($spotter_array))
25 25
 {
26
-	$title = sprintf(_("Most Common Aircraft by Registration of %s"),$spotter_array[0]['aircraft_owner']);
26
+	$title = sprintf(_("Most Common Aircraft by Registration of %s"), $spotter_array[0]['aircraft_owner']);
27 27
 	require_once('header.php');
28 28
 	print '<div class="info column">';
29 29
 	print '<h1>'.$spotter_array[0]['aircraft_owner'].'</h1>';
@@ -34,11 +34,11 @@  discard block
 block discarded – undo
34 34
 	include('owner-sub-menu.php');
35 35
 	print '<div class="column">';
36 36
 	print '<h2>'._("Most Common Aircraft by Registration").'</h2>';
37
-	print '<p>'.sprintf(_("The statistic below shows the most common aircraft by Registration of flights owned by <strong>%s</strong>."),$spotter_array[0]['aircraft_owner']).'</p>';
37
+	print '<p>'.sprintf(_("The statistic below shows the most common aircraft by Registration of flights owned by <strong>%s</strong>."), $spotter_array[0]['aircraft_owner']).'</p>';
38 38
 	if ($archive === false) {
39
-		$aircraft_array = $Spotter->countAllAircraftRegistrationByOwner($owner,$filter);
39
+		$aircraft_array = $Spotter->countAllAircraftRegistrationByOwner($owner, $filter);
40 40
 	} else {
41
-		$aircraft_array = $SpotterArchive->countAllAircraftRegistrationByOwner($owner,$filter);
41
+		$aircraft_array = $SpotterArchive->countAllAircraftRegistrationByOwner($owner, $filter);
42 42
 	}
43 43
 	
44 44
 	if (!empty($aircraft_array))
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
 		print '</thead>';
56 56
 		print '<tbody>';
57 57
 		$i = 1;
58
-		foreach($aircraft_array as $aircraft_item)
58
+		foreach ($aircraft_array as $aircraft_item)
59 59
 		{
60 60
 			print '<tr>';
61 61
 			print '<td><strong>'.$i.'</strong></td>';
Please login to merge, or discard this patch.
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -4,8 +4,8 @@
 block discarded – undo
4 4
 require_once('require/class.SpotterArchive.php');
5 5
 require_once('require/class.Language.php');
6 6
 if (!isset($_GET['owner'])) {
7
-        header('Location: '.$globalURL.'/owner');
8
-        die();
7
+		header('Location: '.$globalURL.'/owner');
8
+		die();
9 9
 }
10 10
 $Spotter = new Spotter();
11 11
 $SpotterArchive = new SpotterArchive();
Please login to merge, or discard this patch.
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -14,8 +14,12 @@
 block discarded – undo
14 14
 $year = filter_input(INPUT_GET,'year',FILTER_SANITIZE_NUMBER_INT);
15 15
 $month = filter_input(INPUT_GET,'month',FILTER_SANITIZE_NUMBER_INT);
16 16
 $filter = array();
17
-if ($year != '') $filter = array_merge($filter,array('year' => $year));
18
-if ($month != '') $filter = array_merge($filter,array('month' => $month));
17
+if ($year != '') {
18
+	$filter = array_merge($filter,array('year' => $year));
19
+}
20
+if ($month != '') {
21
+	$filter = array_merge($filter,array('month' => $month));
22
+}
19 23
 $archive = false;
20 24
 $spotter_array = $Spotter->getSpotterDataByOwner($owner,"0,1", $sort,$filter);
21 25
 if (empty($spotter_array) && isset($globalArchiveResults) && $globalArchiveResults) {
Please login to merge, or discard this patch.