Completed
Push — master ( 05da79...c0278b )
by Yannick
09:24
created
js/map.2d.js.php 1 patch
Braces   +95 added lines, -25 removed lines patch added patch discarded remove patch
@@ -4,10 +4,15 @@  discard block
 block discarded – undo
4 4
 
5 5
 setcookie("MapFormat",'2d');
6 6
 
7
-if (!isset($globalOpenWeatherMapKey)) $globalOpenWeatherMapKey = '';
7
+if (!isset($globalOpenWeatherMapKey)) {
8
+	$globalOpenWeatherMapKey = '';
9
+}
8 10
 // Compressed GeoJson is used if true
9
-if (!isset($globalJsonCompress)) $compress = true;
10
-else $compress = $globalJsonCompress;
11
+if (!isset($globalJsonCompress)) {
12
+	$compress = true;
13
+} else {
14
+	$compress = $globalJsonCompress;
15
+}
11 16
 if (isset($_GET['archive'])) {
12 17
 	$archive = true;
13 18
 	//$archiveupdatetime = 50;
@@ -18,8 +23,11 @@  discard block
 block discarded – undo
18 23
 	//$lastupd = round(($_GET['enddate']-$_GET['begindate'])/(($_GET['during']*60)/10));
19 24
 	//$lastupd = 20;
20 25
 	$lastupd = $_GET['archivespeed']*$archiveupdatetime;
21
-	if (isset($_GET['enddate']) && $_GET['enddate'] != '') $enddate = $_GET['enddate'];
22
-	else $enddate = time();
26
+	if (isset($_GET['enddate']) && $_GET['enddate'] != '') {
27
+		$enddate = $_GET['enddate'];
28
+	} else {
29
+		$enddate = time();
30
+	}
23 31
 	setcookie("archive_begin",$begindate);
24 32
 	setcookie("archive_end",$enddate);
25 33
 	setcookie("archive_update",$lastupd);
@@ -106,7 +114,17 @@  discard block
 block discarded – undo
106 114
 	}
107 115
 
108 116
 	//create the map
109
-	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);
117
+	map = L.map('archive-map', { zoomControl:false }).setView([<?php if (isset($latitude)) {
118
+	print $latitude;
119
+} else {
120
+	print $globalCenterLatitude;
121
+}
122
+?>,<?php if (isset($longitude)) {
123
+	print $longitude;
124
+} else {
125
+	print $globalCenterLongitude;
126
+}
127
+?>], zoom);
110 128
 <?php
111 129
 	} else {
112 130
 ?>
@@ -119,9 +137,19 @@  discard block
 block discarded – undo
119 137
 	     || navigator.userAgent.match(/BlackBerry/i)
120 138
 	     || navigator.userAgent.match(/Windows Phone/i))
121 139
 	{
122
-		var zoom = <?php if (isset($globalLiveZoom)) print $globalLiveZoom-1; else print '8'; ?>;
140
+		var zoom = <?php if (isset($globalLiveZoom)) {
141
+	print $globalLiveZoom-1;
142
+} else {
143
+	print '8';
144
+}
145
+?>;
123 146
 	} else {
124
-		var zoom = <?php if (isset($globalLiveZoom)) print $globalLiveZoom; else print '9'; ?>;
147
+		var zoom = <?php if (isset($globalLiveZoom)) {
148
+	print $globalLiveZoom;
149
+} else {
150
+	print '9';
151
+}
152
+?>;
125 153
 	}
126 154
 
127 155
 	//create the map
@@ -146,16 +174,27 @@  discard block
 block discarded – undo
146 174
 	bounds = L.latLngBounds(southWest,northEast);
147 175
 	//a few title layers
148 176
 <?php
149
-	if (isset($_COOKIE['MapType'])) $MapType = $_COOKIE['MapType'];
150
-	else $MapType = $globalMapProvider;
177
+	if (isset($_COOKIE['MapType'])) {
178
+		$MapType = $_COOKIE['MapType'];
179
+	} else {
180
+		$MapType = $globalMapProvider;
181
+	}
151 182
 
152 183
 	if ($MapType == 'Mapbox') {
153
-		if ($_COOKIE['MapTypeId'] == 'default') $MapBoxId = $globalMapboxId;
154
-		else $MapBoxId = $_COOKIE['MapTypeId'];
155
-?>
184
+		if ($_COOKIE['MapTypeId'] == 'default') {
185
+			$MapBoxId = $globalMapboxId;
186
+		} else {
187
+			$MapBoxId = $_COOKIE['MapTypeId'];
188
+		}
189
+		?>
156 190
 	L.tileLayer('https://{s}.tiles.mapbox.com/v4/{id}/{z}/{x}/{y}.png?access_token={token}', {
157 191
 	    maxZoom: 18,
158
-	    noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) print 'false'; else print 'true'; ?>,
192
+	    noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) {
193
+	print 'false';
194
+} else {
195
+	print 'true';
196
+}
197
+?>,
159 198
 	    attribution: 'Map data &copy; <a href="http://openstreetmap.org">OpenStreetMap</a> contributors, ' +
160 199
 	      '<a href="http://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA</a>, ' +
161 200
 	      'Imagery © <a href="http://mapbox.com">Mapbox</a>',
@@ -167,7 +206,12 @@  discard block
 block discarded – undo
167 206
 ?>
168 207
 	L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
169 208
 	    maxZoom: 18,
170
-	    noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) print 'false'; else print 'true'; ?>,
209
+	    noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) {
210
+	print 'false';
211
+} else {
212
+	print 'true';
213
+}
214
+?>,
171 215
 	    attribution: 'Map data &copy; <a href="http://openstreetmap.org">OpenStreetMap</a> contributors, ' +
172 216
 	      '<a href="www.openstreetmap.org/copyright">Open Database Licence</a>'
173 217
 	}).addTo(map);
@@ -213,20 +257,26 @@  discard block
 block discarded – undo
213 257
 	map.addLayer(yandexLayer);
214 258
 <?php
215 259
 	} elseif ($MapType == 'Bing-Aerial') {
216
-		if (!isset($globalBingMapKey) || $globalBingMapKey == '') setcookie('MapType','OpenStreetMap');
217
-?>
260
+		if (!isset($globalBingMapKey) || $globalBingMapKey == '') {
261
+			setcookie('MapType','OpenStreetMap');
262
+		}
263
+		?>
218 264
 	var bingLayer = new L.tileLayer.bing({bingMapsKey: '<?php print $globalBingMapKey; ?>',imagerySet: 'Aerial'});
219 265
 	map.addLayer(bingLayer);
220 266
 <?php
221 267
 	} elseif ($MapType == 'Bing-Hybrid') {
222
-		if (!isset($globalBingMapKey) || $globalBingMapKey == '') setcookie('MapType','OpenStreetMap');
223
-?>
268
+		if (!isset($globalBingMapKey) || $globalBingMapKey == '') {
269
+			setcookie('MapType','OpenStreetMap');
270
+		}
271
+		?>
224 272
 	var bingLayer = new L.tileLayer.bing({bingMapsKey: '<?php print $globalBingMapKey; ?>',imagerySet: 'AerialWithLabels'});
225 273
 	map.addLayer(bingLayer);
226 274
 <?php
227 275
 	} elseif ($MapType == 'Bing-Road') {
228
-		if (!isset($globalBingMapKey) || $globalBingMapKey == '') setcookie('MapType','OpenStreetMap');
229
-?>
276
+		if (!isset($globalBingMapKey) || $globalBingMapKey == '') {
277
+			setcookie('MapType','OpenStreetMap');
278
+		}
279
+		?>
230 280
 	var bingLayer = new L.tileLayer.bing({bingMapsKey: '<?php print $globalBingMapKey; ?>',imagerySet: 'Road'});
231 281
 	map.addLayer(bingLayer);
232 282
 <?php
@@ -249,9 +299,24 @@  discard block
 block discarded – undo
249 299
 		$customid = $MapType;
250 300
 ?>
251 301
 	L.tileLayer('<?php print $globalMapCustomLayer[$customid]['url']; ?>/{z}/{x}/{y}.png', {
252
-	    maxZoom: <?php if (isset($globalMapCustomLayer[$customid]['maxZoom'])) print $globalMapCustomLayer[$customid]['maxZoom']; else print '18'; ?>,
253
-	    minZoom: <?php if (isset($globalMapCustomLayer[$customid]['minZoom'])) print $globalMapCustomLayer[$customid]['minZoom']; else print '0'; ?>,
254
-	    noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) print 'false'; else print 'true'; ?>,
302
+	    maxZoom: <?php if (isset($globalMapCustomLayer[$customid]['maxZoom'])) {
303
+	print $globalMapCustomLayer[$customid]['maxZoom'];
304
+} else {
305
+	print '18';
306
+}
307
+?>,
308
+	    minZoom: <?php if (isset($globalMapCustomLayer[$customid]['minZoom'])) {
309
+	print $globalMapCustomLayer[$customid]['minZoom'];
310
+} else {
311
+	print '0';
312
+}
313
+?>,
314
+	    noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) {
315
+	print 'false';
316
+} else {
317
+	print 'true';
318
+}
319
+?>,
255 320
 	    attribution: '<?php print $globalMapCustomLayer[$customid]['attribution']; ?>'
256 321
 	}).addTo(map);
257 322
 
@@ -285,7 +350,12 @@  discard block
 block discarded – undo
285 350
 		}
286 351
 	} elseif ($globalBounding == 'circle') {
287 352
 ?>
288
-	var circle = L.circle([<?php print $globalCenterLatitude; ?>, <?php print $globalCenterLongitude; ?>],<?php if (isset($globalBoundingCircleSize)) print $globalBoundingCircleSize; else print '70000'; ?>,{
353
+	var circle = L.circle([<?php print $globalCenterLatitude; ?>, <?php print $globalCenterLongitude; ?>],<?php if (isset($globalBoundingCircleSize)) {
354
+	print $globalBoundingCircleSize;
355
+} else {
356
+	print '70000';
357
+}
358
+?>,{
289 359
 	    color: '#92C7D1',
290 360
 	    fillColor: '#92C7D1',
291 361
 	    fillOpacity: 0.3,
Please login to merge, or discard this patch.
scripts/update_db.php 1 patch
Braces   +22 added lines, -8 removed lines patch added patch discarded remove patch
@@ -9,7 +9,9 @@  discard block
 block discarded – undo
9 9
 if (strtoupper(substr(PHP_OS, 0, 3)) != 'WIN') {
10 10
 	exec("ps ux", $output, $result);
11 11
 	$j = 0;
12
-	foreach ($output as $line) if(strpos($line, "update_db.php") && !strpos($line, "sh ")) $j++;
12
+	foreach ($output as $line) {
13
+		if(strpos($line, "update_db.php") && !strpos($line, "sh ")) $j++;
14
+	}
13 15
 	if ($j > 1) {
14 16
 		echo "Script is already runnning...";
15 17
 		die();
@@ -29,14 +31,18 @@  discard block
 block discarded – undo
29 31
 			$update_db->update_notam();
30 32
 		}
31 33
 		$update_db->insert_last_notam_update();
32
-	} elseif (isset($globalDebug) && $globalDebug && isset($globalNOTAM) && $globalNOTAM) echo "NOTAM are only updated once a day.\n";
34
+	} elseif (isset($globalDebug) && $globalDebug && isset($globalNOTAM) && $globalNOTAM) {
35
+		echo "NOTAM are only updated once a day.\n";
36
+	}
33 37
 	if ($update_db->check_last_update() && (!isset($globalVA) || !$globalVA) && (!isset($globalIVAO) || !$globalIVAO) && (!isset($globalVATSIM) || !$globalVATSIM) && (!isset($globalphpVMS) || !$globalphpVMS)) {
34 38
 		$update_db->update_all();
35 39
 	//	require_once(dirname(__FILE__).'/../require/class.Spotter.php');
36 40
 	//	$Spotter = new Spotter();
37 41
 	//	$Spotter->updateFieldsFromOtherTables();
38 42
 		$update_db->insert_last_update();
39
-	} 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";
43
+	} elseif (isset($globalDebug) && $globalDebug && (!isset($globalVA) || !$globalVA) && (!isset($globalphpVMS) || !$globalphpVMS) && (!isset($globalIVAO) || !$globalIVAO) && (!isset($globalVATSIM) || !$globalVATSIM)) {
44
+		echo "DB are populated with external data only every 15 days ! Files are not updated more often.\n";
45
+	}
40 46
 	if (isset($globalWaypoints) && $globalWaypoints && $update_db->check_last_airspace_update()) {
41 47
 		echo "Check if new airspace version exist...";
42 48
 		echo $update_db->update_airspace_fam();
@@ -56,7 +62,9 @@  discard block
 block discarded – undo
56 62
 			$update_db->delete_duplicateowner();
57 63
 		}
58 64
 		$update_db->insert_last_owner_update();
59
-	} 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";
65
+	} elseif (isset($globalDebug) && $globalDebug && (!isset($globalVA) || !$globalVA) && (!isset($globalIVAO) || !$globalIVAO) && (!isset($globalVATSIM) || !$globalVATSIM) && (!isset($globalphpVMS) || !$globalphpVMS)) {
66
+		echo "Owner are only updated every 15 days.\n";
67
+	}
60 68
 
61 69
 	if (isset($globalAccidents) && $globalAccidents && (!isset($globalVA) || !$globalVA) && (!isset($globalIVAO) || !$globalIVAO) && (!isset($globalVATSIM) || !$globalVATSIM) && (!isset($globalphpVMS) || !$globalphpVMS)) {
62 70
 		require_once(dirname(__FILE__).'/../require/class.Accident.php');
@@ -65,7 +73,9 @@  discard block
 block discarded – undo
65 73
 		if ($Accident->check_last_accidents_update()) {
66 74
 			$Accident->download_update();
67 75
 			$Accident->insert_last_accidents_update();
68
-		} else echo "Accidents are updated once a day.\n";
76
+		} else {
77
+			echo "Accidents are updated once a day.\n";
78
+		}
69 79
 	}
70 80
   
71 81
 }
@@ -78,15 +88,19 @@  discard block
 block discarded – undo
78 88
 	if ($METAR->check_last_update()) {
79 89
 		$METAR->addMETARCycle();
80 90
 		$METAR->insert_last_update();
81
-	} else echo "METAR are only updated every 30 minutes.\n";
82
-}
91
+	} else {
92
+		echo "METAR are only updated every 30 minutes.\n";
93
+	}
94
+	}
83 95
 
84 96
 if (isset($globalSchedules) && $globalSchedules && $update_db->check_last_schedules_update() && (!isset($globalVA) || !$globalVA) && (!isset($globalIVAO) || !$globalIVAO) && (!isset($globalVATSIM) || !$globalVATSIM) && (!isset($globalphpVMS) || !$globalphpVMS)) {
85 97
 	echo "Updating schedules...";
86 98
 	//$update_db->update_oneworld();
87 99
 	$update_db->update_skyteam();
88 100
 	$update_db->insert_last_schedules_update();
89
-} 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";
101
+} elseif (isset($globalDebug) && $globalDebug && isset($globalOwner) && $globalOwner && (!isset($globalVA) || !$globalVA) && (!isset($globalIVAO) || !$globalIVAO) && (!isset($globalVATSIM) || !$globalVATSIM) && (!isset($globalphpVMS) || !$globalphpVMS)) {
102
+	echo "Schedules are only updated every 15 days.\n";
103
+}
90 104
 
91 105
 if (isset($globalArchiveMonths) && $globalArchiveMonths > 0) {
92 106
 	echo "Updating statistics and archive old data...";
Please login to merge, or discard this patch.
search.php 1 patch
Braces   +128 added lines, -35 removed lines patch added patch discarded remove patch
@@ -30,8 +30,12 @@  discard block
 block discarded – undo
30 30
 		//$end_date = date("Y-m-d H:i:s", strtotime("2014-04-12")).",".$_GET['end_date']." 00:00:00";
31 31
 		$end_date = date("Y-m-d H:i:s", strtotime("2014-04-12")).",".date("Y-m-d",strtotime($_GET['end_date']))." 00:00:00";
32 32
 		$sql_date = $end_date;
33
-	} else $sql_date = '';
34
-} else $sql_date = '';
33
+	} else {
34
+		$sql_date = '';
35
+	}
36
+	} else {
37
+	$sql_date = '';
38
+}
35 39
 
36 40
 if (isset($_GET['highest_altitude'])) {
37 41
 	//for altitude manipulation
@@ -45,8 +49,12 @@  discard block
 block discarded – undo
45 49
 	} else if($_GET['highest_altitude'] == "" && $_GET['lowest_altitude'] != ""){
46 50
 		$start_altitude = filter_input(INPUT_GET,'lowest_altitude',FILTER_SANITIZE_NUMBER_INT).",60000";
47 51
 		$sql_altitude = $start_altitude;
48
-	} else $sql_altitude = '';
49
-} else $sql_altitude = '';
52
+	} else {
53
+		$sql_altitude = '';
54
+	}
55
+	} else {
56
+	$sql_altitude = '';
57
+}
50 58
 
51 59
 //calculuation for the pagination
52 60
 if(!isset($_GET['limit']))
@@ -64,7 +72,7 @@  discard block
 block discarded – undo
64 72
 		$limit_end = filter_input(INPUT_GET,'number_results',FILTER_SANITIZE_NUMBER_INT);
65 73
 		$absolute_difference = filter_input(INPUT_GET,'number_results',FILTER_SANITIZE_NUMBER_INT);
66 74
 	}
67
-}  else {
75
+} else {
68 76
 	$limit_explode = explode(",", $_GET['limit']);
69 77
 	$limit_start = filter_var($limit_explode[0],FILTER_SANITIZE_NUMBER_INT);
70 78
 	$limit_end = filter_var($limit_explode[1],FILTER_SANITIZE_NUMBER_INT);
@@ -97,10 +105,15 @@  discard block
 block discarded – undo
97 105
 	$origlon = filter_input(INPUT_GET,'origlon',FILTER_SANITIZE_STRING);
98 106
 	$dist = filter_input(INPUT_GET,'dist',FILTER_SANITIZE_NUMBER_INT);
99 107
 	if ($dist != '') {
100
-		if (isset($globalDistanceUnit) && $globalDistanceUnit == 'mi') $dist = $dist*1.60934;
101
-		elseif (isset($globalDistanceUnit) && $globalDistanceUnit == 'nm') $dist = $dist*1.852;
108
+		if (isset($globalDistanceUnit) && $globalDistanceUnit == 'mi') {
109
+			$dist = $dist*1.60934;
110
+		} elseif (isset($globalDistanceUnit) && $globalDistanceUnit == 'nm') {
111
+			$dist = $dist*1.852;
112
+		}
113
+	}
114
+	if (!isset($sql_date)) {
115
+		$sql_date = '';
102 116
 	}
103
-	if (!isset($sql_date)) $sql_date = '';
104 117
 	if ($archive == 1) {
105 118
 		$SpotterArchive = new SpotterArchive();
106 119
 		$spotter_array = $SpotterArchive->searchSpotterData($q,$registration,$aircraft,strtolower(str_replace("-", " ", $manufacturer)),$highlights,$airline,$airline_country,$airline_type,$airport,$airport_country,$callsign,$departure_airport_route,$arrival_airport_route,$owner,$pilot_id,$pilot_name,$sql_altitude,$sql_date,$limit_start.",".$absolute_difference,$sort,'',$origlat,$origlon,$dist);
@@ -168,7 +181,10 @@  discard block
 block discarded – undo
168 181
 		if (isset($_GET['aircraft']) && $_GET['aircraft'] != ""){ print _("Aircraft:").' <span>'.$aircraft.'</span> '; }
169 182
 		if (isset($_GET['manufacturer']) && $_GET['manufacturer'] != ""){ print _("Manufacturer:").' <span>'.$manufacturer.'</span> '; }
170 183
 		if (isset($_GET['registration']) && $_GET['registration'] != ""){ print _("Registration:").' <span>'.$registration.'</span> '; }
171
-		if (isset($_GET['highlights'])) if ($_GET['highlights'] == "true"){ print _("Highlights:").' <span>'.$highlights.'</span> '; }
184
+		if (isset($_GET['highlights'])) {
185
+			if ($_GET['highlights'] == "true"){ print _("Highlights:").' <span>'.$highlights.'</span> ';
186
+		}
187
+		}
172 188
 		if (isset($_GET['airline']) && $_GET['airline'] != ""){ print _("Airline:").' <span>'.$airline.'</span> '; }
173 189
 		if (isset($_GET['airline_country']) && $_GET['airline_country'] != ""){ print _("Airline country:").' <span>'.$airline_country.'</span> '; }
174 190
 		if (isset($_GET['airline_type']) && $_GET['airline_type'] != ""){ print _("Airline type:").' <span>'.$airline_type.'</span> '; }
@@ -279,7 +295,10 @@  discard block
 block discarded – undo
279 295
 			<div class="form-group">
280 296
 				<label class="control-label col-sm-2"><?php echo _("Keywords"); ?></label>
281 297
 				<div class="col-sm-10">
282
-					<input type="text" class="form-control" id="q" name="q" value="<?php if (isset($_GET['q'])) print $q; ?>" size="10" placeholder="<?php echo _("Keywords"); ?>" />
298
+					<input type="text" class="form-control" id="q" name="q" value="<?php if (isset($_GET['q'])) {
299
+	print $q;
300
+}
301
+?>" size="10" placeholder="<?php echo _("Keywords"); ?>" />
283 302
 				</div>
284 303
 			</div>
285 304
 		</fieldset>
@@ -294,7 +313,10 @@  discard block
 block discarded – undo
294 313
 					    </select>
295 314
 					</div>
296 315
 				</div>
297
-				<script type="text/javascript">getSelect('manufacturer','<?php if(isset($_GET['manufacturer'])) print $manufacturer; ?>')</script>
316
+				<script type="text/javascript">getSelect('manufacturer','<?php if(isset($_GET['manufacturer'])) {
317
+	print $manufacturer;
318
+}
319
+?>')</script>
298 320
 				<div class="form-group">
299 321
 					<label class="control-label col-sm-2"><?php echo _("Type"); ?></label>
300 322
 						<div class="col-sm-10">
@@ -303,11 +325,17 @@  discard block
 block discarded – undo
303 325
 							</select>
304 326
 						</div>
305 327
 				</div>
306
-				<script type="text/javascript">getSelect('aircrafttypes','<?php if(isset($_GET['aircraft_icao'])) print $aircraft_icao; ?>');</script>
328
+				<script type="text/javascript">getSelect('aircrafttypes','<?php if(isset($_GET['aircraft_icao'])) {
329
+	print $aircraft_icao;
330
+}
331
+?>');</script>
307 332
 				<div class="form-group">
308 333
 					<label class="control-label col-sm-2"><?php echo _("Registration"); ?></label> 
309 334
 					<div class="col-sm-10">
310
-						<input type="text" class="form-control" name="registration" value="<?php if (isset($_GET['registration'])) print $registration; ?>" size="8" placeholder="<?php echo _("Registration"); ?>" />
335
+						<input type="text" class="form-control" name="registration" value="<?php if (isset($_GET['registration'])) {
336
+	print $registration;
337
+}
338
+?>" size="8" placeholder="<?php echo _("Registration"); ?>" />
311 339
 					</div>
312 340
 				</div>
313 341
 <?php
@@ -316,22 +344,31 @@  discard block
 block discarded – undo
316 344
 				<div class="form-group">
317 345
 					<label class="control-label col-sm-2"><?php echo _("Pilot id"); ?></label> 
318 346
 					<div class="col-sm-10">
319
-						<input type="text" class="form-control" name="pilot_id" value="<?php if (isset($_GET['pilot_id'])) print $pilot_id; ?>" size="15" placeholder="<?php echo _("Pilot id"); ?>" />
347
+						<input type="text" class="form-control" name="pilot_id" value="<?php if (isset($_GET['pilot_id'])) {
348
+	print $pilot_id;
349
+}
350
+?>" size="15" placeholder="<?php echo _("Pilot id"); ?>" />
320 351
 					</div>
321 352
 				</div>
322 353
 				<div class="form-group">
323 354
 					<label class="control-label col-sm-2"><?php echo _("Pilot name"); ?></label> 
324 355
 					<div class="col-sm-10">
325
-						<input type="text" class="form-control" name="pilot_name" value="<?php if (isset($_GET['pilot_name'])) print $pilot_name; ?>" size="15" placeholder="<?php echo _("Pilot name"); ?>" />
356
+						<input type="text" class="form-control" name="pilot_name" value="<?php if (isset($_GET['pilot_name'])) {
357
+	print $pilot_name;
358
+}
359
+?>" size="15" placeholder="<?php echo _("Pilot name"); ?>" />
326 360
 					</div>
327 361
 				</div>
328 362
 <?php
329
-}else {
363
+} else {
330 364
 ?>
331 365
 				<div class="form-group">
332 366
 					<label class="control-label col-sm-2"><?php echo _("Owner name"); ?></label> 
333 367
 					<div class="col-sm-10">
334
-						<input type="text" class="form-control" name="owner" value="<?php if (isset($_GET['owner'])) print $owner; ?>" size="15" placeholder="<?php echo _("Owner name"); ?>" />
368
+						<input type="text" class="form-control" name="owner" value="<?php if (isset($_GET['owner'])) {
369
+	print $owner;
370
+}
371
+?>" size="15" placeholder="<?php echo _("Owner name"); ?>" />
335 372
 					</div>
336 373
 				</div>
337 374
 <?php
@@ -339,8 +376,14 @@  discard block
 block discarded – undo
339 376
 ?>
340 377
 				<div class="form-group">
341 378
 					<div class="col-sm-offset-2 col-sm-10">
342
-					<!--<div><input type="checkbox" class="form-control" name="highlights" value="true" id="highlights" <?php if (isset($_GET['highlights'])) if ($_GET['highlights'] == "true"){ print 'checked="checked"'; } ?>> <label for="highlights"><?php echo _("Include only aircrafts with special highlights (unique liveries, destinations etc.)"); ?></label></div>-->
343
-					<label class="checkbox-inline"><input type="checkbox" name="highlights" value="true" id="highlights" <?php if (isset($_GET['highlights'])) if ($_GET['highlights'] == "true"){ print 'checked="checked"'; } ?>> <?php echo _("Include only aircrafts with special highlights (unique liveries, destinations etc.)"); ?></label>
379
+					<!--<div><input type="checkbox" class="form-control" name="highlights" value="true" id="highlights" <?php if (isset($_GET['highlights'])) {
380
+	if ($_GET['highlights'] == "true"){ print 'checked="checked"';
381
+}
382
+} ?>> <label for="highlights"><?php echo _("Include only aircrafts with special highlights (unique liveries, destinations etc.)"); ?></label></div>-->
383
+					<label class="checkbox-inline"><input type="checkbox" name="highlights" value="true" id="highlights" <?php if (isset($_GET['highlights'])) {
384
+	if ($_GET['highlights'] == "true"){ print 'checked="checked"';
385
+}
386
+} ?>> <?php echo _("Include only aircrafts with special highlights (unique liveries, destinations etc.)"); ?></label>
344 387
 					</div>
345 388
 				</div>
346 389
 			</fieldset>
@@ -354,7 +397,10 @@  discard block
 block discarded – undo
354 397
 						</select>
355 398
 					</div>
356 399
 				</div>
357
-				<script type="text/javascript">getSelect('airlinenames','<?php if(isset($_GET['airline'])) print $airline; ?>');</script>
400
+				<script type="text/javascript">getSelect('airlinenames','<?php if(isset($_GET['airline'])) {
401
+	print $airline;
402
+}
403
+?>');</script>
358 404
 				<div class="form-group">
359 405
 					<label class="control-label col-sm-2"><?php echo _("Country"); ?></label> 
360 406
 					<div class="col-sm-10">
@@ -363,19 +409,34 @@  discard block
 block discarded – undo
363 409
 						</select>
364 410
 					</div>
365 411
 				</div>
366
-				<script type="text/javascript">getSelect('airlinecountries','<?php if(isset($_GET['airline_country'])) print $airline_country; ?>');</script>
412
+				<script type="text/javascript">getSelect('airlinecountries','<?php if(isset($_GET['airline_country'])) {
413
+	print $airline_country;
414
+}
415
+?>');</script>
367 416
 				<div class="form-group">
368 417
 					<label class="control-label col-sm-2"><?php echo _("Callsign"); ?></label> 
369 418
 					<div class="col-sm-10">
370
-						<input type="text" name="callsign" class="form-control" value="<?php if (isset($_GET['callsign'])) print $callsign; ?>" size="8" placeholder="<?php echo _("Callsign"); ?>" />
419
+						<input type="text" name="callsign" class="form-control" value="<?php if (isset($_GET['callsign'])) {
420
+	print $callsign;
421
+}
422
+?>" size="8" placeholder="<?php echo _("Callsign"); ?>" />
371 423
 					</div>
372 424
 				</div>
373 425
 				<div class="form-group">
374 426
 					<div class="col-sm-offset-2 col-sm-10">
375 427
 						<label class="radio-inline"><input type="radio" name="airline_type" value="all" id="airline_type_all" <?php if (!isset($_GET['airline_type']) || $_GET['airline_type'] == "all"){ print 'checked="checked"'; } ?>> <?php echo _("All airlines types"); ?></label>
376
-						<label class="radio-inline"><input type="radio" name="airline_type" value="passenger" id="airline_type_passenger" <?php if (isset($_GET['airline_type'])) if ($_GET['airline_type'] == "passenger"){ print 'checked="checked"'; } ?>> <?php echo _("Only Passenger airlines"); ?></label>
377
-						<label class="radio-inline"><input type="radio" name="airline_type" value="cargo" id="airline_type_cargo" <?php if (isset($_GET['airline_type'])) if ( $_GET['airline_type'] == "cargo"){ print 'checked="checked"'; } ?>> <?php echo _("Only Cargo airlines"); ?></label>
378
-						<label class="radio-inline"><input type="radio" name="airline_type" value="military" id="airline_type_military" <?php if (isset($_GET['airline_type'])) if ( $_GET['airline_type'] == "military"){ print 'checked="checked"'; } ?>> <?php echo _("Only Military airlines"); ?></label>
428
+						<label class="radio-inline"><input type="radio" name="airline_type" value="passenger" id="airline_type_passenger" <?php if (isset($_GET['airline_type'])) {
429
+	if ($_GET['airline_type'] == "passenger"){ print 'checked="checked"';
430
+}
431
+} ?>> <?php echo _("Only Passenger airlines"); ?></label>
432
+						<label class="radio-inline"><input type="radio" name="airline_type" value="cargo" id="airline_type_cargo" <?php if (isset($_GET['airline_type'])) {
433
+	if ( $_GET['airline_type'] == "cargo"){ print 'checked="checked"';
434
+}
435
+} ?>> <?php echo _("Only Cargo airlines"); ?></label>
436
+						<label class="radio-inline"><input type="radio" name="airline_type" value="military" id="airline_type_military" <?php if (isset($_GET['airline_type'])) {
437
+	if ( $_GET['airline_type'] == "military"){ print 'checked="checked"';
438
+}
439
+} ?>> <?php echo _("Only Military airlines"); ?></label>
379 440
 					</div>
380 441
 				</div>
381 442
 			</fieldset>
@@ -389,7 +450,10 @@  discard block
 block discarded – undo
389 450
 						</select>
390 451
 					</div>
391 452
 				</div>
392
-				<script type="text/javascript">getSelect('airportnames','<?php if(isset($_GET['airport_icao'])) print $airport_icao; ?>');</script>
453
+				<script type="text/javascript">getSelect('airportnames','<?php if(isset($_GET['airport_icao'])) {
454
+	print $airport_icao;
455
+}
456
+?>');</script>
393 457
 				<div class="form-group">
394 458
 					<label class="control-label col-sm-2"><?php echo _("Country"); ?></label> 
395 459
 					<div class="col-sm-10">
@@ -398,7 +462,10 @@  discard block
 block discarded – undo
398 462
 						</select>
399 463
 					</div>
400 464
 				</div>
401
-				<script type="text/javascript">getSelect('airportcountries','<?php if(isset($_GET['airport_country'])) print $airport_country; ?>');</script>
465
+				<script type="text/javascript">getSelect('airportcountries','<?php if(isset($_GET['airport_country'])) {
466
+	print $airport_country;
467
+}
468
+?>');</script>
402 469
 			</fieldset>
403 470
 			<fieldset>
404 471
 				<legend><?php echo _("Route"); ?></legend>
@@ -410,7 +477,10 @@  discard block
 block discarded – undo
410 477
 						</select>
411 478
 					</div>
412 479
 				</div>
413
-				<script type="text/javascript">getSelect('departureairportnames','<?php if(isset($_GET['departure_airport_route'])) print $departure_airport_route; ?>');</script>
480
+				<script type="text/javascript">getSelect('departureairportnames','<?php if(isset($_GET['departure_airport_route'])) {
481
+	print $departure_airport_route;
482
+}
483
+?>');</script>
414 484
 				<div class="form-group">
415 485
 					<label class="control-label col-sm-2"><?php echo _("Arrival Airport"); ?></label> 
416 486
 					<div class="col-sm-10">
@@ -419,7 +489,10 @@  discard block
 block discarded – undo
419 489
 						</select>
420 490
 					</div>
421 491
 				</div>
422
-				<script type="text/javascript">getSelect('arrivalairportnames','<?php if(isset($_GET['arrival_airport_route'])) print $arrival_airport_route; ?>');</script>
492
+				<script type="text/javascript">getSelect('arrivalairportnames','<?php if(isset($_GET['arrival_airport_route'])) {
493
+	print $arrival_airport_route;
494
+}
495
+?>');</script>
423 496
 			</fieldset>
424 497
 			<fieldset>
425 498
 				<legend><?php echo _("Date"); ?></legend>
@@ -427,7 +500,10 @@  discard block
 block discarded – undo
427 500
 					<label class="control-label col-sm-2"><?php echo _("Start Date"); ?></label>
428 501
 					<div class="col-sm-10">
429 502
 						<div class='input-group date' id='datetimepicker1'>
430
-							<input type='text' name="start_date" class="form-control" value="<?php if (isset($_GET['start_date'])) print $start_date; ?>" placeholder="<?php echo _("Start Date/Time"); ?>" />
503
+							<input type='text' name="start_date" class="form-control" value="<?php if (isset($_GET['start_date'])) {
504
+	print $start_date;
505
+}
506
+?>" placeholder="<?php echo _("Start Date/Time"); ?>" />
431 507
 							<span class="input-group-addon">
432 508
 								<span class="glyphicon glyphicon-calendar"></span>
433 509
 							</span>
@@ -438,7 +514,10 @@  discard block
 block discarded – undo
438 514
 					<label class="control-label col-sm-2"><?php echo _("End Date"); ?></label>
439 515
 					<div class="col-sm-10">
440 516
 						<div class='input-group date' id='datetimepicker2'>
441
-						<input type='text' name="end_date" class="form-control" value="<?php if (isset($_GET['end_date'])) print $end_date; ?>" placeholder="<?php echo _("End Date/Time"); ?>" />
517
+						<input type='text' name="end_date" class="form-control" value="<?php if (isset($_GET['end_date'])) {
518
+	print $end_date;
519
+}
520
+?>" placeholder="<?php echo _("End Date/Time"); ?>" />
442 521
 						<span class="input-group-addon">
443 522
 							<span class="glyphicon glyphicon-calendar"></span>
444 523
 						</span>
@@ -511,19 +590,33 @@  discard block
 block discarded – undo
511 590
 			<div class="form-group">
512 591
 				<label class="control-label col-sm-2"><?php echo _("Latitude"); ?></label>
513 592
 				<div class="col-sm-10">
514
-					<input type="text" name="origlat" class="form-control" placeholder="<?php echo _("Center point latitude"); ?>" value="<?php if (isset($_GET['origlat'])) print $origlat; ?>" />
593
+					<input type="text" name="origlat" class="form-control" placeholder="<?php echo _("Center point latitude"); ?>" value="<?php if (isset($_GET['origlat'])) {
594
+	print $origlat;
595
+}
596
+?>" />
515 597
 				</div>
516 598
 			</div>
517 599
 			<div class="form-group">
518 600
 				<label class="control-label col-sm-2"><?php echo _("Longitude"); ?></label>
519 601
 				<div class="col-sm-10">
520
-					<input type="text" name="origlon" class="form-control" placeholder="<?php echo _("Center point longitude"); ?>" value="<?php if (isset($_GET['origlon'])) print $origlon; ?>" />
602
+					<input type="text" name="origlon" class="form-control" placeholder="<?php echo _("Center point longitude"); ?>" value="<?php if (isset($_GET['origlon'])) {
603
+	print $origlon;
604
+}
605
+?>" />
521 606
 				</div>
522 607
 			</div>
523 608
 			<div class="form-group">
524
-				<label class="control-label col-sm-2"><?php echo _("Distance").' ('; if (isset($globalDistanceUnit)) print $globalDistanceUnit; else print 'km'; print ')'; ?></label>
609
+				<label class="control-label col-sm-2"><?php echo _("Distance").' ('; if (isset($globalDistanceUnit)) {
610
+	print $globalDistanceUnit;
611
+} else {
612
+	print 'km';
613
+}
614
+print ')'; ?></label>
525 615
 				<div class="col-sm-10">
526
-					<input type="text" name="dist" class="form-control" placeholder="<?php echo _("Distance from center point"); ?>" value="<?php if (isset($_GET['distance'])) print $distance; ?>" />
616
+					<input type="text" name="dist" class="form-control" placeholder="<?php echo _("Distance from center point"); ?>" value="<?php if (isset($_GET['distance'])) {
617
+	print $distance;
618
+}
619
+?>" />
527 620
 				</div>
528 621
 			</div>
529 622
 		</fieldset>
Please login to merge, or discard this patch.
install/index.php 1 patch
Braces   +466 added lines, -125 removed lines patch added patch discarded remove patch
@@ -131,45 +131,72 @@  discard block
 block discarded – undo
131 131
 			</div>
132 132
 			<p>
133 133
 				<label for="dbhost">Database hostname</label>
134
-				<input type="text" name="dbhost" id="dbhost" value="<?php if (isset($globalDBhost)) print $globalDBhost; ?>" />
134
+				<input type="text" name="dbhost" id="dbhost" value="<?php if (isset($globalDBhost)) {
135
+	print $globalDBhost;
136
+}
137
+?>" />
135 138
 			</p>
136 139
 			<p>
137 140
 				<label for="dbport">Database port</label>
138
-				<input type="text" name="dbport" id="dbport" value="<?php if (isset($globalDBport)) print $globalDBport; ?>" />
141
+				<input type="text" name="dbport" id="dbport" value="<?php if (isset($globalDBport)) {
142
+	print $globalDBport;
143
+}
144
+?>" />
139 145
 				<p class="help-block">Default is 3306 for MariaDB/MySQL, 5432 for PostgreSQL</p>
140 146
 			</p>
141 147
 			<p>
142 148
 				<label for="dbname">Database name</label>
143
-				<input type="text" name="dbname" id="dbname" value="<?php if (isset($globalDBname)) print $globalDBname; ?>" />
149
+				<input type="text" name="dbname" id="dbname" value="<?php if (isset($globalDBname)) {
150
+	print $globalDBname;
151
+}
152
+?>" />
144 153
 			</p>
145 154
 			<p>
146 155
 				<label for="dbuser">Database user</label>
147
-				<input type="text" name="dbuser" id="dbuser" value="<?php if (isset($globalDBuser)) print $globalDBuser; ?>" />
156
+				<input type="text" name="dbuser" id="dbuser" value="<?php if (isset($globalDBuser)) {
157
+	print $globalDBuser;
158
+}
159
+?>" />
148 160
 			</p>
149 161
 			<p>
150 162
 				<label for="dbuserpass">Database user password</label>
151
-				<input type="password" name="dbuserpass" id="dbuserpass" value="<?php if (isset($globalDBpass)) print $globalDBpass; ?>" />
163
+				<input type="password" name="dbuserpass" id="dbuserpass" value="<?php if (isset($globalDBpass)) {
164
+	print $globalDBpass;
165
+}
166
+?>" />
152 167
 			</p>
153 168
 		</fieldset>
154 169
 		<fieldset id="site">
155 170
 			<legend>Site configuration</legend>
156 171
 			<p>
157 172
 				<label for="sitename">Site name</label>
158
-				<input type="text" name="sitename" id="sitename" value="<?php if (isset($globalName)) print $globalName; ?>" />
173
+				<input type="text" name="sitename" id="sitename" value="<?php if (isset($globalName)) {
174
+	print $globalName;
175
+}
176
+?>" />
159 177
 			</p>
160 178
 			<p>
161 179
 				<label for="siteurl">Site directory</label>
162
-				<input type="text" name="siteurl" id="siteurl" value="<?php if (isset($globalURL)) print $globalURL; ?>" />
180
+				<input type="text" name="siteurl" id="siteurl" value="<?php if (isset($globalURL)) {
181
+	print $globalURL;
182
+}
183
+?>" />
163 184
 				<p class="help-block">Can be null. ex : <i>flightairmap</i> if complete URL is <i>http://toto.com/flightairmap</i></p>
164 185
 			</p>
165 186
 			<p>
166 187
 				<label for="timezone">Timezone</label>
167
-				<input type="text" name="timezone" id="timezone" value="<?php if (isset($globalTimezone)) print $globalTimezone; ?>" />
188
+				<input type="text" name="timezone" id="timezone" value="<?php if (isset($globalTimezone)) {
189
+	print $globalTimezone;
190
+}
191
+?>" />
168 192
 				<p class="help-block">ex : UTC, Europe/Paris,...</p>
169 193
 			</p>
170 194
 			<p>
171 195
 				<label for="language">Language</label>
172
-				<input type="text" name="language" id="language" value="<?php if (isset($globalLanguage)) print $globalLanguage; ?>" />
196
+				<input type="text" name="language" id="language" value="<?php if (isset($globalLanguage)) {
197
+	print $globalLanguage;
198
+}
199
+?>" />
173 200
 				<p class="help-block">Used only when link to wikipedia for now. Can be EN,DE,FR,...</p>
174 201
 			</p>
175 202
 		</fieldset>
@@ -190,11 +217,17 @@  discard block
 block discarded – undo
190 217
 			<div id="mapbox_data">
191 218
 				<p>
192 219
 					<label for="mapboxid">Mapbox id</label>
193
-					<input type="text" name="mapboxid" id="mapboxid" value="<?php if (isset($globalMapboxId)) print $globalMapboxId; ?>" />
220
+					<input type="text" name="mapboxid" id="mapboxid" value="<?php if (isset($globalMapboxId)) {
221
+	print $globalMapboxId;
222
+}
223
+?>" />
194 224
 				</p>
195 225
 				<p>
196 226
 					<label for="mapboxtoken">Mapbox token</label>
197
-					<input type="text" name="mapboxtoken" id="mapboxtoken" value="<?php if (isset($globalMapboxToken)) print $globalMapboxToken; ?>" />
227
+					<input type="text" name="mapboxtoken" id="mapboxtoken" value="<?php if (isset($globalMapboxToken)) {
228
+	print $globalMapboxToken;
229
+}
230
+?>" />
198 231
 				</p>
199 232
 				<p class="help-block">Get a key <a href="https://www.mapbox.com/developers/">here</a></p>
200 233
 			</div>
@@ -202,7 +235,10 @@  discard block
 block discarded – undo
202 235
 			<div id="google_data">
203 236
 				<p>
204 237
 					<label for="googlekey">Google API key</label>
205
-					<input type="text" name="googlekey" id="googlekey" value="<?php if (isset($globalGoogleAPIKey)) print $globalGoogleAPIKey; ?>" />
238
+					<input type="text" name="googlekey" id="googlekey" value="<?php if (isset($globalGoogleAPIKey)) {
239
+	print $globalGoogleAPIKey;
240
+}
241
+?>" />
206 242
 					<p class="help-block">Get a key <a href="https://developers.google.com/maps/documentation/javascript/get-api-key#get-an-api-key">here</a></p>
207 243
 				</p>
208 244
 			</div>
@@ -210,7 +246,10 @@  discard block
 block discarded – undo
210 246
 			<div id="bing_data">
211 247
 				<p>
212 248
 					<label for="bingkey">Bing Map key</label>
213
-					<input type="text" name="bingkey" id="bingkey" value="<?php if (isset($globalBingMapKey)) print $globalBingMapKey; ?>" />
249
+					<input type="text" name="bingkey" id="bingkey" value="<?php if (isset($globalBingMapKey)) {
250
+	print $globalBingMapKey;
251
+}
252
+?>" />
214 253
 					<p class="help-block">Get a key <a href="https://www.bingmapsportal.com/">here</a></p>
215 254
 				</p>
216 255
 			</div>
@@ -218,7 +257,10 @@  discard block
 block discarded – undo
218 257
 			<div id="mapquest_data">
219 258
 				<p>
220 259
 					<label for="mapquestkey">MapQuest key</label>
221
-					<input type="text" name="mapquestkey" id="mapquestkey" value="<?php if (isset($globalMapQuestKey)) print $globalMapQuestKey; ?>" />
260
+					<input type="text" name="mapquestkey" id="mapquestkey" value="<?php if (isset($globalMapQuestKey)) {
261
+	print $globalMapQuestKey;
262
+}
263
+?>" />
222 264
 					<p class="help-block">Get a key <a href="https://developer.mapquest.com/user/me/apps">here</a></p>
223 265
 				</p>
224 266
 			</div>
@@ -226,11 +268,17 @@  discard block
 block discarded – undo
226 268
 			<div id="here_data">
227 269
 				<p>
228 270
 					<label for="hereappid">Here App_Id</label>
229
-					<input type="text" name="hereappid" id="hereappid" value="<?php if (isset($globalHereappId)) print $globalHereappId; ?>" />
271
+					<input type="text" name="hereappid" id="hereappid" value="<?php if (isset($globalHereappId)) {
272
+	print $globalHereappId;
273
+}
274
+?>" />
230 275
 				</p>
231 276
 				<p>
232 277
 					<label for="hereappcode">Here App_Code</label>
233
-					<input type="text" name="hereappcode" id="hereappcode" value="<?php if (isset($globalHereappCode)) print $globalHereappCode; ?>" />
278
+					<input type="text" name="hereappcode" id="hereappcode" value="<?php if (isset($globalHereappCode)) {
279
+	print $globalHereappCode;
280
+}
281
+?>" />
234 282
 				</p>
235 283
 				<p class="help-block">Get a key <a href="https://developer.here.com/rest-apis/documentation/enterprise-map-tile/topics/quick-start.html">here</a></p>
236 284
 			</div>
@@ -238,7 +286,10 @@  discard block
 block discarded – undo
238 286
 			<div id="openweathermap_data">
239 287
 				<p>
240 288
 					<label for="openweathermapkey">OpenWeatherMap key (weather layer)</label>
241
-					<input type="text" name="oepnweathermapkey" id="openweathermapkey" value="<?php if (isset($globalOpenWeatherMapKey)) print $globalOpenWeatherMapKey; ?>" />
289
+					<input type="text" name="oepnweathermapkey" id="openweathermapkey" value="<?php if (isset($globalOpenWeatherMapKey)) {
290
+	print $globalOpenWeatherMapKey;
291
+}
292
+?>" />
242 293
 					<p class="help-block">Get a key <a href="https://openweathermap.org/">here</a></p>
243 294
 				</p>
244 295
 			</div>
@@ -248,42 +299,86 @@  discard block
 block discarded – undo
248 299
 			<legend>Coverage area</legend>
249 300
 			<p>
250 301
 				<label for="latitudemax">The maximum latitude (north)</label>
251
-				<input type="text" name="latitudemax" id="latitudemax" value="<?php if (isset($globalLatitudeMax)) print $globalLatitudeMax; ?>" />
302
+				<input type="text" name="latitudemax" id="latitudemax" value="<?php if (isset($globalLatitudeMax)) {
303
+	print $globalLatitudeMax;
304
+}
305
+?>" />
252 306
 			</p>
253 307
 			<p>
254 308
 				<label for="latitudemin">The minimum latitude (south)</label>
255
-				<input type="text" name="latitudemin" id="latitudemin" value="<?php if (isset($globalLatitudeMin)) print $globalLatitudeMin; ?>" />
309
+				<input type="text" name="latitudemin" id="latitudemin" value="<?php if (isset($globalLatitudeMin)) {
310
+	print $globalLatitudeMin;
311
+}
312
+?>" />
256 313
 			</p>
257 314
 			<p>
258 315
 				<label for="longitudemax">The maximum longitude (west)</label>
259
-				<input type="text" name="longitudemax" id="longitudemax" value="<?php if (isset($globalLongitudeMax)) print $globalLongitudeMax; ?>" />
316
+				<input type="text" name="longitudemax" id="longitudemax" value="<?php if (isset($globalLongitudeMax)) {
317
+	print $globalLongitudeMax;
318
+}
319
+?>" />
260 320
 			</p>
261 321
 			<p>
262 322
 				<label for="longitudemin">The minimum longitude (east)</label>
263
-				<input type="text" name="longitudemin" id="longitudemin" value="<?php if (isset($globalLongitudeMin)) print $globalLongitudeMin; ?>" />
323
+				<input type="text" name="longitudemin" id="longitudemin" value="<?php if (isset($globalLongitudeMin)) {
324
+	print $globalLongitudeMin;
325
+}
326
+?>" />
264 327
 			</p>
265 328
 			<p>
266 329
 				<label for="latitudecenter">The latitude center</label>
267
-				<input type="text" name="latitudecenter" id="latitudecenter" value="<?php if (isset($globalCenterLatitude)) print $globalCenterLatitude; ?>" />
330
+				<input type="text" name="latitudecenter" id="latitudecenter" value="<?php if (isset($globalCenterLatitude)) {
331
+	print $globalCenterLatitude;
332
+}
333
+?>" />
268 334
 			</p>
269 335
 			<p>
270 336
 				<label for="longitudecenter">The longitude center</label>
271
-				<input type="text" name="longitudecenter" id="longitudecenter" value="<?php if (isset($globalCenterLongitude)) print $globalCenterLongitude; ?>" />
337
+				<input type="text" name="longitudecenter" id="longitudecenter" value="<?php if (isset($globalCenterLongitude)) {
338
+	print $globalCenterLongitude;
339
+}
340
+?>" />
272 341
 			</p>
273 342
 			<p>
274 343
 				<label for="livezoom">Default Zoom on live map</label>
275
-				<input type="number" name="livezoom" id="livezoom" value="<?php if (isset($globalLiveZoom)) print $globalLiveZoom; else print '9'; ?>" />
344
+				<input type="number" name="livezoom" id="livezoom" value="<?php if (isset($globalLiveZoom)) {
345
+	print $globalLiveZoom;
346
+} else {
347
+	print '9';
348
+}
349
+?>" />
276 350
 			</p>
277 351
 			<p>
278 352
 				<label for="squawk_country">Country for squawk usage</label>
279 353
 				<select name="squawk_country" id="squawk_country">
280
-					<option value="UK"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'UK') print ' selected '; ?>>UK</option>
281
-					<option value="NZ"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'NZ') print ' selected '; ?>>NZ</option>
282
-					<option value="US"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'US') print ' selected '; ?>>US</option>
283
-					<option value="AU"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'AU') print ' selected '; ?>>AU</option>
284
-					<option value="NL"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'NL') print ' selected '; ?>>NL</option>
285
-					<option value="FR"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'FR') print ' selected '; ?>>FR</option>
286
-					<option value="TR"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'TR') print ' selected '; ?>>TR</option>
354
+					<option value="UK"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'UK') {
355
+	print ' selected ';
356
+}
357
+?>>UK</option>
358
+					<option value="NZ"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'NZ') {
359
+	print ' selected ';
360
+}
361
+?>>NZ</option>
362
+					<option value="US"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'US') {
363
+	print ' selected ';
364
+}
365
+?>>US</option>
366
+					<option value="AU"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'AU') {
367
+	print ' selected ';
368
+}
369
+?>>AU</option>
370
+					<option value="NL"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'NL') {
371
+	print ' selected ';
372
+}
373
+?>>NL</option>
374
+					<option value="FR"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'FR') {
375
+	print ' selected ';
376
+}
377
+?>>FR</option>
378
+					<option value="TR"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'TR') {
379
+	print ' selected ';
380
+}
381
+?>>TR</option>
287 382
 				</select>
288 383
 			</p>
289 384
 		</fieldset>
@@ -292,15 +387,24 @@  discard block
 block discarded – undo
292 387
 			<p><i>Only put in DB flights that are inside a circle</i></p>
293 388
 			<p>
294 389
 				<label for="latitude">Center latitude</label>
295
-				<input type="text" name="zoilatitude" id="latitude" value="<?php if (isset($globalDistanceIgnore['latitude'])) echo $globalDistanceIgnore['latitude']; ?>" />
390
+				<input type="text" name="zoilatitude" id="latitude" value="<?php if (isset($globalDistanceIgnore['latitude'])) {
391
+	echo $globalDistanceIgnore['latitude'];
392
+}
393
+?>" />
296 394
 			</p>
297 395
 			<p>
298 396
 				<label for="longitude">Center longitude</label>
299
-				<input type="text" name="zoilongitude" id="longitude" value="<?php if (isset($globalDistanceIgnore['longitude'])) echo $globalDistanceIgnore['longitude']; ?>" />
397
+				<input type="text" name="zoilongitude" id="longitude" value="<?php if (isset($globalDistanceIgnore['longitude'])) {
398
+	echo $globalDistanceIgnore['longitude'];
399
+}
400
+?>" />
300 401
 			</p>
301 402
 			<p>
302 403
 				<label for="Distance">Distance (in km)</label>
303
-				<input type="text" name="zoidistance" id="distance" value="<?php if (isset($globalDistanceIgnore['distance'])) echo $globalDistanceIgnore['distance']; ?>" />
404
+				<input type="text" name="zoidistance" id="distance" value="<?php if (isset($globalDistanceIgnore['distance'])) {
405
+	echo $globalDistanceIgnore['distance'];
406
+}
407
+?>" />
304 408
 			</p>
305 409
 		</fieldset>
306 410
 		<fieldset id="sourceloc">
@@ -409,11 +513,17 @@  discard block
 block discarded – undo
409 513
 			<div id="flightaware_data">
410 514
 				<p>
411 515
 					<label for="flightawareusername">FlightAware username</label>
412
-					<input type="text" name="flightawareusername" id="flightawareusername" value="<?php if (isset($globalFlightAwareUsername)) print $globalFlightAwareUsername; ?>" />
516
+					<input type="text" name="flightawareusername" id="flightawareusername" value="<?php if (isset($globalFlightAwareUsername)) {
517
+	print $globalFlightAwareUsername;
518
+}
519
+?>" />
413 520
 				</p>
414 521
 				<p>
415 522
 					<label for="flightawarepassword">FlightAware password/API key</label>
416
-					<input type="text" name="flightawarepassword" id="flightawarepassword" value="<?php if (isset($globalFlightAwarePassword)) print $globalFlightAwarePassword; ?>" />
523
+					<input type="text" name="flightawarepassword" id="flightawarepassword" value="<?php if (isset($globalFlightAwarePassword)) {
524
+	print $globalFlightAwarePassword;
525
+}
526
+?>" />
417 527
 				</p>
418 528
 			</div>
419 529
 -->
@@ -473,29 +583,92 @@  discard block
 block discarded – undo
473 583
 								?>
474 584
 								<td>
475 585
 									<select name="format[]" id="format">
476
-										<option value="auto" <?php if (!isset($source['format'])) print 'selected'; ?>>Auto</option>
477
-										<option value="sbs" <?php if (isset($source['format']) && $source['format'] == 'sbs') print 'selected'; ?>>SBS</option>
478
-										<option value="tsv" <?php if (isset($source['format']) && $source['format'] == 'tsv') print 'selected'; ?>>TSV</option>
479
-										<option value="raw" <?php if (isset($source['format']) && $source['format'] == 'raw') print 'selected'; ?>>Raw</option>
480
-										<option value="aprs" <?php if (isset($source['format']) && $source['format'] == 'aprs') print 'selected'; ?>>APRS</option>
481
-										<option value="deltadbtxt" <?php if (isset($source['format']) && $source['format'] == 'deltadbtxt') print 'selected'; ?>>Radarcape deltadb.txt</option>
482
-										<option value="vatsimtxt" <?php if (isset($source['format']) && $source['format'] == 'vatsimtxt') print 'selected'; ?>>Vatsim</option>
483
-										<option value="aircraftlistjson" <?php if (isset($source['format']) && $source['format'] == 'aircraftlistjson') print 'selected'; ?>>Virtual Radar Server AircraftList.json</option>
484
-										<option value="vrstcp" <?php if (isset($source['format']) && $source['format'] == 'vrstcp') print 'selected'; ?>>Virtual Radar Server TCP</option>
485
-										<option value="phpvmacars" <?php if (isset($source['format']) && $source['format'] == 'phpvmacars') print 'selected'; ?>>phpVMS</option>
486
-										<option value="vam" <?php if (isset($source['format']) && $source['format'] == 'vam') print 'selected'; ?>>Virtual Airlines Manager</option>
487
-										<option value="whazzup" <?php if (isset($source['format']) && $source['format'] == 'whazzup') print 'selected'; ?>>IVAO</option>
488
-										<option value="flightgearmp" <?php if (isset($source['format']) && $source['format'] == 'flightgearmp') print 'selected'; ?>>FlightGear Multiplayer</option>
489
-										<option value="flightgearsp" <?php if (isset($source['format']) && $source['format'] == 'flightgearsp') print 'selected'; ?>>FlightGear Singleplayer</option>
490
-										<option value="acars" <?php if (isset($source['format']) && $source['format'] == 'acars') print 'selected'; ?>>ACARS from acarsdec/acarsdeco2 over UDP</option>
491
-										<option value="acarssbs3" <?php if (isset($source['format']) && $source['format'] == 'acarssbs3') print 'selected'; ?>>ACARS SBS-3 over TCP</option>
492
-										<option value="ais" <?php if (isset($source['format']) && $source['format'] == 'ais') print 'selected'; ?>>NMEA AIS over TCP</option>
493
-										<option value="airwhere" <?php if (isset($source['format']) && $source['format'] == 'airwhere') print 'selected'; ?>>AirWhere website</option>
586
+										<option value="auto" <?php if (!isset($source['format'])) {
587
+	print 'selected';
588
+}
589
+?>>Auto</option>
590
+										<option value="sbs" <?php if (isset($source['format']) && $source['format'] == 'sbs') {
591
+	print 'selected';
592
+}
593
+?>>SBS</option>
594
+										<option value="tsv" <?php if (isset($source['format']) && $source['format'] == 'tsv') {
595
+	print 'selected';
596
+}
597
+?>>TSV</option>
598
+										<option value="raw" <?php if (isset($source['format']) && $source['format'] == 'raw') {
599
+	print 'selected';
600
+}
601
+?>>Raw</option>
602
+										<option value="aprs" <?php if (isset($source['format']) && $source['format'] == 'aprs') {
603
+	print 'selected';
604
+}
605
+?>>APRS</option>
606
+										<option value="deltadbtxt" <?php if (isset($source['format']) && $source['format'] == 'deltadbtxt') {
607
+	print 'selected';
608
+}
609
+?>>Radarcape deltadb.txt</option>
610
+										<option value="vatsimtxt" <?php if (isset($source['format']) && $source['format'] == 'vatsimtxt') {
611
+	print 'selected';
612
+}
613
+?>>Vatsim</option>
614
+										<option value="aircraftlistjson" <?php if (isset($source['format']) && $source['format'] == 'aircraftlistjson') {
615
+	print 'selected';
616
+}
617
+?>>Virtual Radar Server AircraftList.json</option>
618
+										<option value="vrstcp" <?php if (isset($source['format']) && $source['format'] == 'vrstcp') {
619
+	print 'selected';
620
+}
621
+?>>Virtual Radar Server TCP</option>
622
+										<option value="phpvmacars" <?php if (isset($source['format']) && $source['format'] == 'phpvmacars') {
623
+	print 'selected';
624
+}
625
+?>>phpVMS</option>
626
+										<option value="vam" <?php if (isset($source['format']) && $source['format'] == 'vam') {
627
+	print 'selected';
628
+}
629
+?>>Virtual Airlines Manager</option>
630
+										<option value="whazzup" <?php if (isset($source['format']) && $source['format'] == 'whazzup') {
631
+	print 'selected';
632
+}
633
+?>>IVAO</option>
634
+										<option value="flightgearmp" <?php if (isset($source['format']) && $source['format'] == 'flightgearmp') {
635
+	print 'selected';
636
+}
637
+?>>FlightGear Multiplayer</option>
638
+										<option value="flightgearsp" <?php if (isset($source['format']) && $source['format'] == 'flightgearsp') {
639
+	print 'selected';
640
+}
641
+?>>FlightGear Singleplayer</option>
642
+										<option value="acars" <?php if (isset($source['format']) && $source['format'] == 'acars') {
643
+	print 'selected';
644
+}
645
+?>>ACARS from acarsdec/acarsdeco2 over UDP</option>
646
+										<option value="acarssbs3" <?php if (isset($source['format']) && $source['format'] == 'acarssbs3') {
647
+	print 'selected';
648
+}
649
+?>>ACARS SBS-3 over TCP</option>
650
+										<option value="ais" <?php if (isset($source['format']) && $source['format'] == 'ais') {
651
+	print 'selected';
652
+}
653
+?>>NMEA AIS over TCP</option>
654
+										<option value="airwhere" <?php if (isset($source['format']) && $source['format'] == 'airwhere') {
655
+	print 'selected';
656
+}
657
+?>>AirWhere website</option>
494 658
 									</select>
495 659
 								</td>
496
-								<td><input type="text" name="name[]" id="name" value="<?php if (isset($source['name'])) print $source['name']; ?>" /></td>
497
-								<td><input type="checkbox" name="sourcestats[]" id="sourcestats" title="Create statistics for the source like number of messages, distance,..." value="1" <?php if (isset($source['sourcestats']) && $source['sourcestats']) print 'checked'; ?> /></td>
498
-								<td><input type="checkbox" name="noarchive[]" id="noarchive" title="Don't archive this source" value="1" <?php if (isset($source['noarchive']) && $source['noarchive']) print 'checked'; ?> /></td>
660
+								<td><input type="text" name="name[]" id="name" value="<?php if (isset($source['name'])) {
661
+	print $source['name'];
662
+}
663
+?>" /></td>
664
+								<td><input type="checkbox" name="sourcestats[]" id="sourcestats" title="Create statistics for the source like number of messages, distance,..." value="1" <?php if (isset($source['sourcestats']) && $source['sourcestats']) {
665
+	print 'checked';
666
+}
667
+?> /></td>
668
+								<td><input type="checkbox" name="noarchive[]" id="noarchive" title="Don't archive this source" value="1" <?php if (isset($source['noarchive']) && $source['noarchive']) {
669
+	print 'checked';
670
+}
671
+?> /></td>
499 672
 								<td><input type="button" id="delhost" value="Delete" onclick="deleteRow(this)" /> <input type="button" id="addhost" value="Add" onclick="insRow()" /></td>
500 673
 							</tr>
501 674
 <?php
@@ -545,11 +718,17 @@  discard block
 block discarded – undo
545 718
 					<p>Listen UDP server for acarsdec/acarsdeco2/... with <i>daemon-acars.php</i> script</p>
546 719
 					<p>
547 720
 						<label for="acarshost">ACARS UDP host</label>
548
-						<input type="text" name="acarshost" id="acarshost" value="<?php if (isset($globalACARSHost)) print $globalACARSHost; ?>" />
721
+						<input type="text" name="acarshost" id="acarshost" value="<?php if (isset($globalACARSHost)) {
722
+	print $globalACARSHost;
723
+}
724
+?>" />
549 725
 					</p>
550 726
 					<p>
551 727
 						<label for="acarsport">ACARS UDP port</label>
552
-						<input type="number" name="acarsport" id="acarsport" value="<?php if (isset($globalACARSPort)) print $globalACARSPort; ?>" />
728
+						<input type="number" name="acarsport" id="acarsport" value="<?php if (isset($globalACARSPort)) {
729
+	print $globalACARSPort;
730
+}
731
+?>" />
553 732
 					</p>
554 733
 				</fieldset>
555 734
 			</div>
@@ -629,13 +808,19 @@  discard block
 block discarded – undo
629 808
 			<div id="schedules_options">
630 809
 				<p>
631 810
 					<label for="britishairways">British Airways API Key</label>
632
-					<input type="text" name="britishairways" id="britishairways" value="<?php if (isset($globalBritishAirwaysKey)) print $globalBritishAirwaysKey; ?>" />
811
+					<input type="text" name="britishairways" id="britishairways" value="<?php if (isset($globalBritishAirwaysKey)) {
812
+	print $globalBritishAirwaysKey;
813
+}
814
+?>" />
633 815
 					<p class="help-block">Register an account on <a href="https://developer.ba.com/">https://developer.ba.com/</a></p>
634 816
 				</p>
635 817
 				<!--
636 818
 				<p>
637 819
 					<label for="transavia">Transavia Test API Consumer Key</label>
638
-					<input type="text" name="transavia" id="transavia" value="<?php if (isset($globalTransaviaKey)) print $globalTransaviaKey; ?>" />
820
+					<input type="text" name="transavia" id="transavia" value="<?php if (isset($globalTransaviaKey)) {
821
+	print $globalTransaviaKey;
822
+}
823
+?>" />
639 824
 					<p class="help-block">Register an account on <a href="https://developer.transavia.com">https://developer.transavia.com</a></p>
640 825
 				</p>
641 826
 				-->
@@ -644,10 +829,16 @@  discard block
 block discarded – undo
644 829
 						<b>Lufthansa API Key</b>
645 830
 						<p>
646 831
 							<label for="lufthansakey">Key</label>
647
-							<input type="text" name="lufthansakey" id="lufthansakey" value="<?php if (isset($globalLufthansaKey['key'])) print $globalLufthansaKey['key']; ?>" />
832
+							<input type="text" name="lufthansakey" id="lufthansakey" value="<?php if (isset($globalLufthansaKey['key'])) {
833
+	print $globalLufthansaKey['key'];
834
+}
835
+?>" />
648 836
 						</p><p>
649 837
 							<label for="lufthansasecret">Secret</label>
650
-							<input type="text" name="lufthansasecret" id="lufthansasecret" value="<?php if (isset($globalLufthansaKey['secret'])) print $globalLufthansaKey['secret']; ?>" />
838
+							<input type="text" name="lufthansasecret" id="lufthansasecret" value="<?php if (isset($globalLufthansaKey['secret'])) {
839
+	print $globalLufthansaKey['secret'];
840
+}
841
+?>" />
651 842
 						</p>
652 843
 					</div>
653 844
 					<p class="help-block">Register an account on <a href="https://developer.lufthansa.com/page">https://developer.lufthansa.com/page</a></p>
@@ -667,7 +858,10 @@  discard block
 block discarded – undo
667 858
 			</p>
668 859
 			<p>
669 860
 				<label for="notamsource">URL of your feed from notaminfo.com</label>
670
-				<input type="text" name="notamsource" id="notamsource" value="<?php if (isset($globalNOTAMSource)) print $globalNOTAMSource; ?>" />
861
+				<input type="text" name="notamsource" id="notamsource" value="<?php if (isset($globalNOTAMSource)) {
862
+	print $globalNOTAMSource;
863
+}
864
+?>" />
671 865
 				<p class="help-block">If you want to use world NOTAM from FlightAirMap website, leave it blank</p>
672 866
 			</p>
673 867
 			<br />
@@ -683,14 +877,20 @@  discard block
 block discarded – undo
683 877
 			<div id="metarsrc">
684 878
 				<p>
685 879
 					<label for="metarsource">URL of your METAR source</label>
686
-					<input type="text" name="metarsource" id="metarsource" value="<?php if (isset($globalMETARurl)) print $globalMETARurl; ?>" />
880
+					<input type="text" name="metarsource" id="metarsource" value="<?php if (isset($globalMETARurl)) {
881
+	print $globalMETARurl;
882
+}
883
+?>" />
687 884
 					<p class="help-block">Use {icao} to specify where we replace by airport icao. ex : http://metar.vatsim.net/metar.php?id={icao}</p>
688 885
 				</p>
689 886
 			</div>
690 887
 			<br />
691 888
 			<p>
692 889
 				<label for="bitly">Bit.ly access token api (used in search page)</label>
693
-				<input type="text" name="bitly" id="bitly" value="<?php if (isset($globalBitlyAccessToken)) print $globalBitlyAccessToken; ?>" />
890
+				<input type="text" name="bitly" id="bitly" value="<?php if (isset($globalBitlyAccessToken)) {
891
+	print $globalBitlyAccessToken;
892
+}
893
+?>" />
694 894
 			</p>
695 895
 			<br />
696 896
 			<p>
@@ -710,7 +910,12 @@  discard block
 block discarded – undo
710 910
 			</p>
711 911
 			<p>
712 912
 				<label for="archivemonths">Generate statistics, delete or put in archive flights older than xx months</label>
713
-				<input type="number" name="archivemonths" id="archivemonths" value="<?php if (isset($globalArchiveMonths)) print $globalArchiveMonths; else echo '0'; ?>" />
913
+				<input type="number" name="archivemonths" id="archivemonths" value="<?php if (isset($globalArchiveMonths)) {
914
+	print $globalArchiveMonths;
915
+} else {
916
+	echo '0';
917
+}
918
+?>" />
714 919
 				<p class="help-block">0 to disable, delete old flight if <i>Archive all flights data</i> is disabled</p>
715 920
 			</p>
716 921
 			<p>
@@ -720,12 +925,22 @@  discard block
 block discarded – undo
720 925
 			</p>
721 926
 			<p>
722 927
 				<label for="archivekeepmonths">Keep flights data for xx months in archive</label>
723
-				<input type="number" name="archivekeepmonths" id="archivekeepmonths" value="<?php if (isset($globalArchiveKeepMonths)) print $globalArchiveKeepMonths; else echo '0'; ?>" />
928
+				<input type="number" name="archivekeepmonths" id="archivekeepmonths" value="<?php if (isset($globalArchiveKeepMonths)) {
929
+	print $globalArchiveKeepMonths;
930
+} else {
931
+	echo '0';
932
+}
933
+?>" />
724 934
 				<p class="help-block">0 to disable</p>
725 935
 			</p>
726 936
 			<p>
727 937
 				<label for="archivekeeptrackmonths">Keep flights track data for xx months in archive</label>
728
-				<input type="number" name="archivekeeptrackmonths" id="archivekeeptrackmonths" value="<?php if (isset($globalArchiveKeepTrackMonths)) print $globalArchiveKeepTrackMonths; else echo '0'; ?>" />
938
+				<input type="number" name="archivekeeptrackmonths" id="archivekeeptrackmonths" value="<?php if (isset($globalArchiveKeepTrackMonths)) {
939
+	print $globalArchiveKeepTrackMonths;
940
+} else {
941
+	echo '0';
942
+}
943
+?>" />
729 944
 				<p class="help-block">0 to disable, should be less or egal to <i>Keep flights data</i> value</p>
730 945
 			</p>
731 946
 			<br />
@@ -735,7 +950,12 @@  discard block
 block discarded – undo
735 950
 				<p class="help-block">Uncheck if the script is running as cron job</p>
736 951
 				<div id="cronends"> 
737 952
 					<label for="cronend">Run script for xx seconds</label>
738
-					<input type="number" name="cronend" id="cronend" value="<?php if (isset($globalCronEnd)) print $globalCronEnd; else print '0'; ?>" />
953
+					<input type="number" name="cronend" id="cronend" value="<?php if (isset($globalCronEnd)) {
954
+	print $globalCronEnd;
955
+} else {
956
+	print '0';
957
+}
958
+?>" />
739 959
 					<p class="help-block">Set to 0 to disable. Should be disabled if source is URL.</p>
740 960
 				</div>
741 961
 			</p>
@@ -788,15 +1008,30 @@  discard block
 block discarded – undo
788 1008
 			<br />
789 1009
 			<p>
790 1010
 				<label for="refresh">Show flights detected since xxx seconds</label>
791
-				<input type="number" name="refresh" id="refresh" value="<?php if (isset($globalLiveInterval)) echo $globalLiveInterval; else echo '200'; ?>" />
1011
+				<input type="number" name="refresh" id="refresh" value="<?php if (isset($globalLiveInterval)) {
1012
+	echo $globalLiveInterval;
1013
+} else {
1014
+	echo '200';
1015
+}
1016
+?>" />
792 1017
 			</p>
793 1018
 			<p>
794 1019
 				<label for="maprefresh">Live map refresh (in seconds)</label>
795
-				<input type="number" name="maprefresh" id="maprefresh" value="<?php if (isset($globalMapRefresh)) echo $globalMapRefresh; else echo '30'; ?>" />
1020
+				<input type="number" name="maprefresh" id="maprefresh" value="<?php if (isset($globalMapRefresh)) {
1021
+	echo $globalMapRefresh;
1022
+} else {
1023
+	echo '30';
1024
+}
1025
+?>" />
796 1026
 			</p>
797 1027
 			<p>
798 1028
 				<label for="mapidle">Map idle timeout (in minutes)</label>
799
-				<input type="number" name="mapidle" id="mapidle" value="<?php if (isset($globalMapIdleTimeout)) echo $globalMapIdleTimeout; else echo '30'; ?>" />
1029
+				<input type="number" name="mapidle" id="mapidle" value="<?php if (isset($globalMapIdleTimeout)) {
1030
+	echo $globalMapIdleTimeout;
1031
+} else {
1032
+	echo '30';
1033
+}
1034
+?>" />
800 1035
 				<p class="help-block">0 to disable</p>
801 1036
 			</p>
802 1037
 			<p>
@@ -806,12 +1041,20 @@  discard block
 block discarded – undo
806 1041
 			<br />
807 1042
 			<p>
808 1043
 				<label for="closestmindist">Distance to airport set as arrival (in km)</label>
809
-				<input type="number" name="closestmindist" id="closestmindist" value="<?php if (isset($globalClosestMinDist)) echo $globalClosestMinDist; else echo '50'; ?>" />
1044
+				<input type="number" name="closestmindist" id="closestmindist" value="<?php if (isset($globalClosestMinDist)) {
1045
+	echo $globalClosestMinDist;
1046
+} else {
1047
+	echo '50';
1048
+}
1049
+?>" />
810 1050
 			</p>
811 1051
 			<br />
812 1052
 			<p>
813 1053
 				<label for="aircraftsize">Size of aircraft icon on map (default to 30px if zoom > 7 else 15px), empty to default</label>
814
-				<input type="number" name="aircraftsize" id="aircraftsize" value="<?php if (isset($globalAircraftSize)) echo $globalAircraftSize;?>" />
1054
+				<input type="number" name="aircraftsize" id="aircraftsize" value="<?php if (isset($globalAircraftSize)) {
1055
+	echo $globalAircraftSize;
1056
+}
1057
+?>" />
815 1058
 			</p>
816 1059
 			<br />
817 1060
 			<p>
@@ -824,7 +1067,12 @@  discard block
 block discarded – undo
824 1067
 			    if (extension_loaded('gd') && function_exists('gd_info')) {
825 1068
 			?>
826 1069
 				<label for="aircrafticoncolor">Color of aircraft icon on map</label>
827
-				<input type="color" name="aircrafticoncolor" id="aircrafticoncolor" value="#<?php if (isset($globalAircraftIconColor)) echo $globalAircraftIconColor; else echo '1a3151'; ?>" />
1070
+				<input type="color" name="aircrafticoncolor" id="aircrafticoncolor" value="#<?php if (isset($globalAircraftIconColor)) {
1071
+	echo $globalAircraftIconColor;
1072
+} else {
1073
+	echo '1a3151';
1074
+}
1075
+?>" />
828 1076
 			<?php
829 1077
 				if (!is_writable('../cache')) {
830 1078
 			?>
@@ -842,14 +1090,27 @@  discard block
 block discarded – undo
842 1090
 			<p>
843 1091
 				<label for="airportzoom">Zoom level minimum to see airports icons</label>
844 1092
 				<div class="range">
845
-					<input type="range" name="airportzoom" id="airportzoom" value="<?php if (isset($globalAirportZoom)) echo $globalAirportZoom; else echo '7'; ?>" />
846
-					<output id="range"><?php if (isset($globalAirportZoom)) echo $globalAirportZoom; else echo '7'; ?></output>
1093
+					<input type="range" name="airportzoom" id="airportzoom" value="<?php if (isset($globalAirportZoom)) {
1094
+	echo $globalAirportZoom;
1095
+} else {
1096
+	echo '7';
1097
+}
1098
+?>" />
1099
+					<output id="range"><?php if (isset($globalAirportZoom)) {
1100
+	echo $globalAirportZoom;
1101
+} else {
1102
+	echo '7';
1103
+}
1104
+?></output>
847 1105
 				</div>
848 1106
 			</p>
849 1107
 			<br />
850 1108
 			<p>
851 1109
 				<label for="customcss">Custom CSS web path</label>
852
-				<input type="text" name="customcss" id="customcss" value="<?php if (isset($globalCustomCSS)) echo $globalCustomCSS; ?>" />
1110
+				<input type="text" name="customcss" id="customcss" value="<?php if (isset($globalCustomCSS)) {
1111
+	echo $globalCustomCSS;
1112
+}
1113
+?>" />
853 1114
 			</p>
854 1115
 		</fieldset>
855 1116
 		<input type="submit" name="submit" value="Create/Update database & write setup" />
@@ -876,8 +1137,12 @@  discard block
 block discarded – undo
876 1137
 	$dbhost = filter_input(INPUT_POST,'dbhost',FILTER_SANITIZE_STRING);
877 1138
 	$dbport = filter_input(INPUT_POST,'dbport',FILTER_SANITIZE_STRING);
878 1139
 
879
-	if ($dbtype == 'mysql' && !extension_loaded('pdo_mysql')) $error .= 'Mysql driver for PDO must be loaded';
880
-	if ($dbtype == 'pgsql' && !extension_loaded('pdo_pgsql')) $error .= 'PosgreSQL driver for PDO must be loaded';
1140
+	if ($dbtype == 'mysql' && !extension_loaded('pdo_mysql')) {
1141
+		$error .= 'Mysql driver for PDO must be loaded';
1142
+	}
1143
+	if ($dbtype == 'pgsql' && !extension_loaded('pdo_pgsql')) {
1144
+		$error .= 'PosgreSQL driver for PDO must be loaded';
1145
+	}
881 1146
 	
882 1147
 	$_SESSION['database_root'] = $dbroot;
883 1148
 	$_SESSION['database_rootpass'] = $dbrootpass;
@@ -945,15 +1210,23 @@  discard block
 block discarded – undo
945 1210
 	$source_city = $_POST['source_city'];
946 1211
 	$source_country = $_POST['source_country'];
947 1212
 	$source_ref = $_POST['source_ref'];
948
-	if (isset($source_id)) $source_id = $_POST['source_id'];
949
-	else $source_id = array();
1213
+	if (isset($source_id)) {
1214
+		$source_id = $_POST['source_id'];
1215
+	} else {
1216
+		$source_id = array();
1217
+	}
950 1218
 	
951 1219
 	$sources = array();
952 1220
 	foreach ($source_name as $keys => $name) {
953
-	    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]);
954
-	    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]);
1221
+	    if (isset($source_id[$keys])) {
1222
+	    	$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]);
1223
+	    } else {
1224
+	    	$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]);
1225
+	    }
1226
+	}
1227
+	if (count($sources) > 0) {
1228
+		$_SESSION['sources'] = $sources;
955 1229
 	}
956
-	if (count($sources) > 0) $_SESSION['sources'] = $sources;
957 1230
 
958 1231
 	//$sbshost = filter_input(INPUT_POST,'sbshost',FILTER_SANITIZE_STRING);
959 1232
 	//$sbsport = filter_input(INPUT_POST,'sbsport',FILTER_SANITIZE_NUMBER_INT);
@@ -974,14 +1247,23 @@  discard block
 block discarded – undo
974 1247
 	$datasource = filter_input(INPUT_POST,'datasource',FILTER_SANITIZE_STRING);
975 1248
 
976 1249
 	$globalaircraft = filter_input(INPUT_POST,'globalaircraft',FILTER_SANITIZE_STRING);
977
-	if ($globalaircraft == 'aircraft') $settings = array_merge($settings,array('globalAircraft' => 'TRUE'));
978
-	else $settings = array_merge($settings,array('globalAircraft' => 'FALSE'));
1250
+	if ($globalaircraft == 'aircraft') {
1251
+		$settings = array_merge($settings,array('globalAircraft' => 'TRUE'));
1252
+	} else {
1253
+		$settings = array_merge($settings,array('globalAircraft' => 'FALSE'));
1254
+	}
979 1255
 	$globaltracker = filter_input(INPUT_POST,'globaltracker',FILTER_SANITIZE_STRING);
980
-	if ($globaltracker == 'tracker') $settings = array_merge($settings,array('globalTracker' => 'TRUE'));
981
-	else $settings = array_merge($settings,array('globalTracker' => 'FALSE'));
1256
+	if ($globaltracker == 'tracker') {
1257
+		$settings = array_merge($settings,array('globalTracker' => 'TRUE'));
1258
+	} else {
1259
+		$settings = array_merge($settings,array('globalTracker' => 'FALSE'));
1260
+	}
982 1261
 	$globalmarine = filter_input(INPUT_POST,'globalmarine',FILTER_SANITIZE_STRING);
983
-	if ($globalmarine == 'marine') $settings = array_merge($settings,array('globalMarine' => 'TRUE'));
984
-	else $settings = array_merge($settings,array('globalMarine' => 'FALSE'));
1262
+	if ($globalmarine == 'marine') {
1263
+		$settings = array_merge($settings,array('globalMarine' => 'TRUE'));
1264
+	} else {
1265
+		$settings = array_merge($settings,array('globalMarine' => 'FALSE'));
1266
+	}
985 1267
 
986 1268
 /*	
987 1269
 	$globalSBS1Hosts = array();
@@ -1002,19 +1284,35 @@  discard block
 block discarded – undo
1002 1284
 	$port = $_POST['port'];
1003 1285
 	$name = $_POST['name'];
1004 1286
 	$format = $_POST['format'];
1005
-	if (isset($_POST['sourcestats'])) $sourcestats = $_POST['sourcestats'];
1006
-	else $sourcestats = array();
1007
-	if (isset($_POST['noarchive'])) $noarchive = $_POST['noarchive'];
1008
-	else $noarchive = array();
1287
+	if (isset($_POST['sourcestats'])) {
1288
+		$sourcestats = $_POST['sourcestats'];
1289
+	} else {
1290
+		$sourcestats = array();
1291
+	}
1292
+	if (isset($_POST['noarchive'])) {
1293
+		$noarchive = $_POST['noarchive'];
1294
+	} else {
1295
+		$noarchive = array();
1296
+	}
1009 1297
 	$gSources = array();
1010 1298
 	$forcepilots = false;
1011 1299
 	foreach ($host as $key => $h) {
1012
-		if (isset($sourcestats[$key]) && $sourcestats[$key] == 1) $cov = 'TRUE';
1013
-		else $cov = 'FALSE';
1014
-		if (isset($noarchive[$key]) && $noarchive[$key] == 1) $arch = 'TRUE';
1015
-		else $arch = 'FALSE';
1016
-		if ($h != '') $gSources[] = array('host' => $h, 'port' => $port[$key],'name' => $name[$key],'format' => $format[$key],'sourcestats' => $cov,'noarchive' => $arch);
1017
-		if ($format[$key] == 'airwhere') $forcepilots = true;
1300
+		if (isset($sourcestats[$key]) && $sourcestats[$key] == 1) {
1301
+			$cov = 'TRUE';
1302
+		} else {
1303
+			$cov = 'FALSE';
1304
+		}
1305
+		if (isset($noarchive[$key]) && $noarchive[$key] == 1) {
1306
+			$arch = 'TRUE';
1307
+		} else {
1308
+			$arch = 'FALSE';
1309
+		}
1310
+		if ($h != '') {
1311
+			$gSources[] = array('host' => $h, 'port' => $port[$key],'name' => $name[$key],'format' => $format[$key],'sourcestats' => $cov,'noarchive' => $arch);
1312
+		}
1313
+		if ($format[$key] == 'airwhere') {
1314
+			$forcepilots = true;
1315
+		}
1018 1316
 	}
1019 1317
 	$settings = array_merge($settings,array('globalSources' => $gSources));
1020 1318
 
@@ -1042,7 +1340,9 @@  discard block
 block discarded – undo
1042 1340
 	$zoidistance = filter_input(INPUT_POST,'zoidistance',FILTER_SANITIZE_NUMBER_INT);
1043 1341
 	if ($zoilatitude != '' && $zoilongitude != '' && $zoidistance != '') {
1044 1342
 		$settings = array_merge($settings,array('globalDistanceIgnore' => array('latitude' => $zoilatitude,'longitude' => $zoilongitude,'distance' => $zoidistance)));
1045
-	} else $settings = array_merge($settings,array('globalDistanceIgnore' => array()));
1343
+	} else {
1344
+		$settings = array_merge($settings,array('globalDistanceIgnore' => array()));
1345
+	}
1046 1346
 
1047 1347
 	$refresh = filter_input(INPUT_POST,'refresh',FILTER_SANITIZE_NUMBER_INT);
1048 1348
 	$settings = array_merge($settings,array('globalLiveInterval' => $refresh));
@@ -1081,7 +1381,9 @@  discard block
 block discarded – undo
1081 1381
 
1082 1382
 	// Create in settings.php keys not yet configurable if not already here
1083 1383
 	//if (!isset($globalImageBingKey)) $settings = array_merge($settings,array('globalImageBingKey' => ''));
1084
-	if (!isset($globalDebug)) $settings = array_merge($settings,array('globalDebug' => 'TRUE'));
1384
+	if (!isset($globalDebug)) {
1385
+		$settings = array_merge($settings,array('globalDebug' => 'TRUE'));
1386
+	}
1085 1387
 
1086 1388
 	$resetyearstats = filter_input(INPUT_POST,'resetyearstats',FILTER_SANITIZE_STRING);
1087 1389
 	if ($resetyearstats == 'resetyearstats') {
@@ -1118,37 +1420,56 @@  discard block
 block discarded – undo
1118 1420
 	}
1119 1421
 */
1120 1422
 	$settings = array_merge($settings,array('globalFlightAware' => 'FALSE'));
1121
-	if ($globalsbs == 'sbs') $settings = array_merge($settings,array('globalSBS1' => 'TRUE'));
1122
-	else $settings = array_merge($settings,array('globalSBS1' => 'FALSE'));
1123
-	if ($globalaprs == 'aprs') $settings = array_merge($settings,array('globalAPRS' => 'TRUE'));
1124
-	else $settings = array_merge($settings,array('globalAPRS' => 'FALSE'));
1423
+	if ($globalsbs == 'sbs') {
1424
+		$settings = array_merge($settings,array('globalSBS1' => 'TRUE'));
1425
+	} else {
1426
+		$settings = array_merge($settings,array('globalSBS1' => 'FALSE'));
1427
+	}
1428
+	if ($globalaprs == 'aprs') {
1429
+		$settings = array_merge($settings,array('globalAPRS' => 'TRUE'));
1430
+	} else {
1431
+		$settings = array_merge($settings,array('globalAPRS' => 'FALSE'));
1432
+	}
1125 1433
 	$va = false;
1126 1434
 	if ($globalivao == 'ivao') {
1127 1435
 		$settings = array_merge($settings,array('globalIVAO' => 'TRUE'));
1128 1436
 		$va = true;
1129
-	} else $settings = array_merge($settings,array('globalIVAO' => 'FALSE'));
1437
+	} else {
1438
+		$settings = array_merge($settings,array('globalIVAO' => 'FALSE'));
1439
+	}
1130 1440
 	if ($globalvatsim == 'vatsim') {
1131 1441
 		$settings = array_merge($settings,array('globalVATSIM' => 'TRUE'));
1132 1442
 		$va = true;
1133
-	} else $settings = array_merge($settings,array('globalVATSIM' => 'FALSE'));
1443
+	} else {
1444
+		$settings = array_merge($settings,array('globalVATSIM' => 'FALSE'));
1445
+	}
1134 1446
 	if ($globalphpvms == 'phpvms') {
1135 1447
 		$settings = array_merge($settings,array('globalphpVMS' => 'TRUE'));
1136 1448
 		$va = true;
1137
-	} else $settings = array_merge($settings,array('globalphpVMS' => 'FALSE'));
1449
+	} else {
1450
+		$settings = array_merge($settings,array('globalphpVMS' => 'FALSE'));
1451
+	}
1138 1452
 	if ($globalvam == 'vam') {
1139 1453
 		$settings = array_merge($settings,array('globalVAM' => 'TRUE'));
1140 1454
 		$va = true;
1141
-	} else $settings = array_merge($settings,array('globalVAM' => 'FALSE'));
1455
+	} else {
1456
+		$settings = array_merge($settings,array('globalVAM' => 'FALSE'));
1457
+	}
1142 1458
 	if ($va) {
1143 1459
 		$settings = array_merge($settings,array('globalSchedulesFetch' => 'FALSE','globalTranslationFetch' => 'FALSE'));
1144
-	} else $settings = array_merge($settings,array('globalSchedulesFetch' => 'TRUE','globalTranslationFetch' => 'TRUE'));
1460
+	} else {
1461
+		$settings = array_merge($settings,array('globalSchedulesFetch' => 'TRUE','globalTranslationFetch' => 'TRUE'));
1462
+	}
1145 1463
 	if ($globalva == 'va' || $va) {
1146 1464
 		$settings = array_merge($settings,array('globalVA' => 'TRUE'));
1147 1465
 		$settings = array_merge($settings,array('globalUsePilot' => 'TRUE','globalUseOwner' => 'FALSE'));
1148 1466
 	} else {
1149 1467
 		$settings = array_merge($settings,array('globalVA' => 'FALSE'));
1150
-		if ($forcepilots) $settings = array_merge($settings,array('globalUsePilot' => 'TRUE','globalUseOwner' => 'FALSE'));
1151
-		else $settings = array_merge($settings,array('globalUsePilot' => 'FALSE','globalUseOwner' => 'TRUE'));
1468
+		if ($forcepilots) {
1469
+			$settings = array_merge($settings,array('globalUsePilot' => 'TRUE','globalUseOwner' => 'FALSE'));
1470
+		} else {
1471
+			$settings = array_merge($settings,array('globalUsePilot' => 'FALSE','globalUseOwner' => 'TRUE'));
1472
+		}
1152 1473
 	}
1153 1474
 	
1154 1475
 	
@@ -1309,7 +1630,9 @@  discard block
 block discarded – undo
1309 1630
 		$settings = array_merge($settings,array('globalNoAirlines' => 'FALSE'));
1310 1631
 	}
1311 1632
 
1312
-	if (!isset($globalTransaction)) $settings = array_merge($settings,array('globalTransaction' => 'TRUE'));
1633
+	if (!isset($globalTransaction)) {
1634
+		$settings = array_merge($settings,array('globalTransaction' => 'TRUE'));
1635
+	}
1313 1636
 
1314 1637
 	// Set some defaults values...
1315 1638
 	if (!isset($globalAircraftImageSources)) {
@@ -1324,15 +1647,23 @@  discard block
 block discarded – undo
1324 1647
 
1325 1648
 	$settings = array_merge($settings,array('globalInstalled' => 'TRUE'));
1326 1649
 
1327
-	if ($error == '') settings::modify_settings($settings);
1328
-	if ($error == '') settings::comment_settings($settings_comment);
1650
+	if ($error == '') {
1651
+		settings::modify_settings($settings);
1652
+	}
1653
+	if ($error == '') {
1654
+		settings::comment_settings($settings_comment);
1655
+	}
1329 1656
 	if ($error != '') {
1330 1657
 		print '<div class="info column">'.$error.'</div>';
1331 1658
 		require('../footer.php');
1332 1659
 		exit;
1333 1660
 	} else {
1334
-		if (isset($_POST['waypoints']) && $_POST['waypoints'] == 'waypoints') $_SESSION['waypoints'] = 1;
1335
-		if (isset($_POST['owner']) && $_POST['owner'] == 'owner') $_SESSION['owner'] = 1;
1661
+		if (isset($_POST['waypoints']) && $_POST['waypoints'] == 'waypoints') {
1662
+			$_SESSION['waypoints'] = 1;
1663
+		}
1664
+		if (isset($_POST['owner']) && $_POST['owner'] == 'owner') {
1665
+			$_SESSION['owner'] = 1;
1666
+		}
1336 1667
 		if (isset($_POST['createdb'])) {
1337 1668
 			$_SESSION['install'] = 'database_create';
1338 1669
 		} else {
@@ -1373,10 +1704,18 @@  discard block
 block discarded – undo
1373 1704
 	$popw = false;
1374 1705
 	foreach ($_SESSION['done'] as $done) {
1375 1706
 	    print '<li>'.$done.'....<strong>SUCCESS</strong></li>';
1376
-	    if ($done == 'Create database') $pop = true;
1377
-	    if ($_SESSION['install'] == 'database_create') $pop = true;
1378
-	    if ($_SESSION['install'] == 'database_import') $popi = true;
1379
-	    if ($_SESSION['install'] == 'waypoints') $popw = true;
1707
+	    if ($done == 'Create database') {
1708
+	    	$pop = true;
1709
+	    }
1710
+	    if ($_SESSION['install'] == 'database_create') {
1711
+	    	$pop = true;
1712
+	    }
1713
+	    if ($_SESSION['install'] == 'database_import') {
1714
+	    	$popi = true;
1715
+	    }
1716
+	    if ($_SESSION['install'] == 'waypoints') {
1717
+	    	$popw = true;
1718
+	    }
1380 1719
 	}
1381 1720
 	if ($pop) {
1382 1721
 	    sleep(5);
@@ -1387,7 +1726,9 @@  discard block
 block discarded – undo
1387 1726
 	} else if ($popw) {
1388 1727
 	    sleep(5);
1389 1728
 	    print '<li>Populate waypoints database....<img src="../images/loading.gif" /></li>';
1390
-	} else print '<li>Update schema if needed....<img src="../images/loading.gif" /></li>';
1729
+	} else {
1730
+		print '<li>Update schema if needed....<img src="../images/loading.gif" /></li>';
1731
+	}
1391 1732
 	print '</div></ul>';
1392 1733
 	print '<div id="error"></div>';
1393 1734
 /*	foreach ($_SESSION['done'] as $done) {
Please login to merge, or discard this patch.
require/class.Accident.php 1 patch
Braces   +84 added lines, -30 removed lines patch added patch discarded remove patch
@@ -113,8 +113,11 @@  discard block
 block discarded – undo
113 113
 				$data = array();
114 114
 				if ($row['registration'] != '') {
115 115
 					$image_array = $Image->getSpotterImage($row['registration']);
116
-					if (count($image_array) > 0) $data = array_merge($data,array('image' => $image_array[0]['image'],'image_thumbnail' => $image_array[0]['image_thumbnail'],'image_copyright' => $image_array[0]['image_copyright'],'image_source' => $image_array[0]['image_source'],'image_source_website' => $image_array[0]['image_source_website']));
117
-					else $data = array_merge($data,array('image' => '','image_thumbnail' => '','image_copyright' => '','image_source' => '','image_source_website' => ''));
116
+					if (count($image_array) > 0) {
117
+						$data = array_merge($data,array('image' => $image_array[0]['image'],'image_thumbnail' => $image_array[0]['image_thumbnail'],'image_copyright' => $image_array[0]['image_copyright'],'image_source' => $image_array[0]['image_source'],'image_source_website' => $image_array[0]['image_source_website']));
118
+					} else {
119
+						$data = array_merge($data,array('image' => '','image_thumbnail' => '','image_copyright' => '','image_source' => '','image_source_website' => ''));
120
+					}
118 121
 					$aircraft_type = $Spotter->getAllAircraftTypeByRegistration($row['registration']);
119 122
 					$aircraft_info = $Spotter->getAllAircraftInfo($aircraft_type);
120 123
 					if (!empty($aircraft_info)) {
@@ -130,17 +133,30 @@  discard block
 block discarded – undo
130 133
 						$data['aircraft_base'] = $owner_data['base'];
131 134
 						$data['aircraft_date_first_reg'] = $owner_data['date_first_reg'];
132 135
 					}
133
-				} else $data = array_merge($data,array('image' => '','image_thumbnail' => '','image_copyright' => '','image_source' => '','image_source_website' => ''));
134
-				if ($row['registration'] == '') $row['registration'] = 'NA';
135
-				if ($row['ident'] == '') $row['ident'] = 'NA';
136
+				} else {
137
+					$data = array_merge($data,array('image' => '','image_thumbnail' => '','image_copyright' => '','image_source' => '','image_source_website' => ''));
138
+				}
139
+				if ($row['registration'] == '') {
140
+					$row['registration'] = 'NA';
141
+				}
142
+				if ($row['ident'] == '') {
143
+					$row['ident'] = 'NA';
144
+				}
136 145
 				$identicao = $Spotter->getAllAirlineInfo(substr($row['ident'],0,3));
137 146
 				if (isset($identicao[0])) {
138 147
 					if (substr($row['ident'],0,2) == 'AF') {
139
-						if (filter_var(substr($row['ident'],2),FILTER_VALIDATE_INT,array("flags"=>FILTER_FLAG_ALLOW_OCTAL))) $icao = $row['ident'];
140
-						else $icao = 'AFR'.ltrim(substr($row['ident'],2),'0');
141
-					} else $icao = $identicao[0]['icao'].ltrim(substr($row['ident'],2),'0');
148
+						if (filter_var(substr($row['ident'],2),FILTER_VALIDATE_INT,array("flags"=>FILTER_FLAG_ALLOW_OCTAL))) {
149
+							$icao = $row['ident'];
150
+						} else {
151
+							$icao = 'AFR'.ltrim(substr($row['ident'],2),'0');
152
+						}
153
+					} else {
154
+						$icao = $identicao[0]['icao'].ltrim(substr($row['ident'],2),'0');
155
+					}
142 156
 					$data = array_merge($data,array('airline_icao' => $identicao[0]['icao'],'airline_name' => $identicao[0]['name']));
143
-				} else $icao = $row['ident'];
157
+				} else {
158
+					$icao = $row['ident'];
159
+				}
144 160
 				$icao = $Translation->checkTranslation($icao,false);
145 161
 				//$data = array_merge($data,array('registration' => $row['registration'], 'date' => $row['date'], 'ident' => $icao,'url' => $row['url']));
146 162
 				if ($row['airline_name'] != '' && !isset($data['airline_name'])) {
@@ -155,10 +171,14 @@  discard block
 block discarded – undo
155 171
 					//else echo 'No data...'."\n";
156 172
 				}
157 173
 				$data = array_merge($row,$data);
158
-				if ($data['ident'] == null) $data['ident'] = $icao;
174
+				if ($data['ident'] == null) {
175
+					$data['ident'] = $icao;
176
+				}
159 177
 				if ($data['title'] == null) {
160 178
 					$data['message'] = $row['type'].' of '.$row['registration'].' at '.$row['place'].','.$row['country'];
161
-				} else $data['message'] = strtolower($data['title']);
179
+				} else {
180
+					$data['message'] = strtolower($data['title']);
181
+				}
162 182
 				$ids = $Spotter->getAllIDByRegistration($data['registration']);
163 183
 				$date = $data['date'];
164 184
 				if (isset($ids[$date])) {
@@ -177,8 +197,9 @@  discard block
 block discarded – undo
177 197
 		if (isset($result)) {
178 198
 			$result[0]['query_number_rows'] = $i;
179 199
 			return $result;
200
+		} else {
201
+			return array();
180 202
 		}
181
-		else return array();
182 203
 	}
183 204
 	
184 205
 	/*
@@ -222,7 +243,9 @@  discard block
 block discarded – undo
222 243
 	*/
223 244
 	public function import($file) {
224 245
 		global $globalTransaction, $globalDebug;
225
-		if ($globalDebug) echo 'Import '.$file."\n";
246
+		if ($globalDebug) {
247
+			echo 'Import '.$file."\n";
248
+		}
226 249
 		$result = array();
227 250
 		if (file_exists($file)) {
228 251
 			if (($handle = fopen($file,'r')) !== FALSE) {
@@ -233,8 +256,11 @@  discard block
 block discarded – undo
233 256
 				}
234 257
 				fclose($handle);
235 258
 			}
236
-			if (!empty($result)) $this->add($result,true);
237
-			elseif ($globalDebug) echo 'Nothing to import';
259
+			if (!empty($result)) {
260
+				$this->add($result,true);
261
+			} elseif ($globalDebug) {
262
+				echo 'Nothing to import';
263
+			}
238 264
 		}
239 265
 	}
240 266
 
@@ -270,14 +296,23 @@  discard block
 block discarded – undo
270 296
 					}
271 297
 				}
272 298
 				fclose($handle);
273
-			} elseif ($globalDebug) echo "Can't open ".dirname(__FILE__).'/../install/tmp/cr-all.md5';
274
-		} elseif ($globalDebug) echo 'Download cr-all.md5 failed. '.dirname(__FILE__).'/../install/tmp/cr-all.md5 not here.';
299
+			} elseif ($globalDebug) {
300
+				echo "Can't open ".dirname(__FILE__).'/../install/tmp/cr-all.md5';
301
+			}
302
+		} elseif ($globalDebug) {
303
+			echo 'Download cr-all.md5 failed. '.dirname(__FILE__).'/../install/tmp/cr-all.md5 not here.';
304
+		}
275 305
 		$result = $Common->arr_diff($all_md5_new,$all_md5);
276
-		if (empty($result) && $globalDebug) echo 'Nothing to update';
306
+		if (empty($result) && $globalDebug) {
307
+			echo 'Nothing to update';
308
+		}
277 309
 		foreach ($result as $file => $md5) {
278 310
 			$Common->download('http://data.flightairmap.fr/data/cr/'.$file,dirname(__FILE__).'/../install/tmp/'.$file);
279
-			if (file_exists(dirname(__FILE__).'/../install/tmp/'.$file)) $this->import(dirname(__FILE__).'/../install/tmp/'.$file);
280
-			elseif ($globalDebug) echo 'Download '.$file.' failed';
311
+			if (file_exists(dirname(__FILE__).'/../install/tmp/'.$file)) {
312
+				$this->import(dirname(__FILE__).'/../install/tmp/'.$file);
313
+			} elseif ($globalDebug) {
314
+				echo 'Download '.$file.' failed';
315
+			}
281 316
 		}
282 317
 	}
283 318
 
@@ -294,13 +329,17 @@  discard block
 block discarded – undo
294 329
 		$Image = new Image();
295 330
 		$Spotter = new Spotter();
296 331
 
297
-		if (empty($crash)) return false;
332
+		if (empty($crash)) {
333
+			return false;
334
+		}
298 335
 		if (!$new) {
299 336
 			$query_delete = 'DELETE FROM accidents WHERE source = :source';
300 337
 			$sthd = $Connection->db->prepare($query_delete);
301 338
 			$sthd->execute(array(':source' => $crash[0]['source']));
302 339
 		}
303
-		if ($globalTransaction) $Connection->db->beginTransaction();
340
+		if ($globalTransaction) {
341
+			$Connection->db->beginTransaction();
342
+		}
304 343
 		$initial_array = array('ident' => null,'type' => 'accident','url' => null,'registration' => null, 'date' => null, 'place' => null,'country' => null, 'latitude' => null, 'longitude' => null, 'fatalities' => null, 'title' => '','source' => '','aircraft_manufacturer' => null,'aircraft_name' => null,'operator' => null);
305 344
 		$query_check = 'SELECT COUNT(*) as nb FROM accidents WHERE registration = :registration AND date = :date AND type = :type AND source = :source';
306 345
 		$sth_check = $Connection->db->prepare($query_check);
@@ -315,7 +354,9 @@  discard block
 block discarded – undo
315 354
 					return $value === "" ? NULL : $value;
316 355
 				}, $cr);
317 356
 				if ($cr['date'] != '' && $cr['registration'] != null && $cr['registration'] != '' && $cr['registration'] != '?' && $cr['registration'] != '-' && strtolower($cr['registration']) != 'unknown' && $cr['date'] < time() && !preg_match('/\s/',$cr['registration'])) {
318
-					if (strpos($cr['registration'],'-') === FALSE) $cr['registration'] = $Spotter->convertAircraftRegistration($cr['registration']);
357
+					if (strpos($cr['registration'],'-') === FALSE) {
358
+						$cr['registration'] = $Spotter->convertAircraftRegistration($cr['registration']);
359
+					}
319 360
 					$query_check_values = array(':registration' => $cr['registration'],':date' => date('Y-m-d',$cr['date']),':type' => $cr['type'],':source' => $cr['source']);
320 361
 					$sth_check->execute($query_check_values);
321 362
 					$result_check = $sth_check->fetch(PDO::FETCH_ASSOC);
@@ -324,13 +365,19 @@  discard block
 block discarded – undo
324 365
 						$sth->execute($query_values);
325 366
 						if ($cr['date'] > time()-(30*86400)) {
326 367
 							if (empty($Image->getSpotterImage($cr['registration']))) {
327
-								if ($globalDebug) echo "\t".'Get image for '.$cr['registration'].'...';
368
+								if ($globalDebug) {
369
+									echo "\t".'Get image for '.$cr['registration'].'...';
370
+								}
328 371
 								$Image->addSpotterImage($cr['registration']);
329
-								if ($globalDebug) echo "\t".'Done'."\n";
372
+								if ($globalDebug) {
373
+									echo "\t".'Done'."\n";
374
+								}
330 375
 							}
331 376
 							// elseif ($globalDebug) echo 'Image already in DB'."\n";
332 377
 						}
333
-						if ($cr['title'] == '') $cr['title'] = $cr['registration'].' '.$cr['type'];
378
+						if ($cr['title'] == '') {
379
+							$cr['title'] = $cr['registration'].' '.$cr['type'];
380
+						}
334 381
 						$Spotter->setHighlightFlightByRegistration($cr['registration'],$cr['title'],date('Y-m-d',$cr['date']));
335 382
 					}
336 383
 				}
@@ -339,9 +386,13 @@  discard block
 block discarded – undo
339 386
 					$Connection->db->beginTransaction();
340 387
 				}
341 388
 			}
342
-			if ($globalTransaction) $Connection->db->commit();
389
+			if ($globalTransaction) {
390
+				$Connection->db->commit();
391
+			}
343 392
 		} catch(PDOException $e) {
344
-			if ($globalTransaction) $Connection->db->rollBack();
393
+			if ($globalTransaction) {
394
+				$Connection->db->rollBack();
395
+			}
345 396
 			echo $e->getMessage();
346 397
 		}
347 398
 		$sth_check->closeCursor();
@@ -380,8 +431,11 @@  discard block
 block discarded – undo
380 431
 			return "error : ".$e->getMessage();
381 432
 		}
382 433
 		$row = $sth->fetch(PDO::FETCH_ASSOC);
383
-		if ($row['nb'] > 0) return false;
384
-		else return true;
434
+		if ($row['nb'] > 0) {
435
+			return false;
436
+		} else {
437
+			return true;
438
+		}
385 439
 	}
386 440
 
387 441
 	public static function insert_last_accidents_update() {
Please login to merge, or discard this patch.
require/class.NOTAM.php 1 patch
Braces   +210 added lines, -89 removed lines patch added patch discarded remove patch
@@ -1033,8 +1033,11 @@  discard block
 block discarded – undo
1033 1033
 		$data = file_get_contents($filename);
1034 1034
 		preg_match_all("/%%(.+?)%%/is", $data, $matches);
1035 1035
 		//print_r($matches);
1036
-		if (isset($matches[1])) return $matches[1];
1037
-		else return array();
1036
+		if (isset($matches[1])) {
1037
+			return $matches[1];
1038
+		} else {
1039
+			return array();
1040
+		}
1038 1041
 	}
1039 1042
 	public function getAllNOTAMbyScope($scope) {
1040 1043
 		global $globalDBdriver;
@@ -1071,7 +1074,9 @@  discard block
 block discarded – undo
1071 1074
 				$minlong = $maxlong;
1072 1075
 				$maxlong = $tmplong;
1073 1076
 			}
1074
-		} else return array();
1077
+		} else {
1078
+			return array();
1079
+		}
1075 1080
 		if ($globalDBdriver == 'mysql') {
1076 1081
 			$query  = 'SELECT * FROM notam WHERE center_latitude BETWEEN '.$minlat.' AND '.$maxlat.' AND center_longitude BETWEEN '.$minlong.' AND '.$maxlong.' AND radius > 0 AND date_end > UTC_TIMESTAMP() AND date_begin < UTC_TIMESTAMP()';
1077 1082
 		} else {
@@ -1095,7 +1100,9 @@  discard block
 block discarded – undo
1095 1100
 			$minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
1096 1101
 			$maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
1097 1102
 			$maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
1098
-		} else return array();
1103
+		} else {
1104
+			return array();
1105
+		}
1099 1106
 		if ($globalDBdriver == 'mysql') {
1100 1107
 			$query  = 'SELECT * FROM notam WHERE center_latitude BETWEEN '.$minlat.' AND '.$maxlat.' AND center_longitude BETWEEN '.$minlong.' AND '.$maxlong.' AND radius > 0 AND date_end > UTC_TIMESTAMP() AND date_begin < UTC_TIMESTAMP() AND scope = :scope';
1101 1108
 		} else {
@@ -1122,8 +1129,11 @@  discard block
 block discarded – undo
1122 1129
 			return "error : ".$e->getMessage();
1123 1130
 		}
1124 1131
 		$all = $sth->fetchAll(PDO::FETCH_ASSOC);
1125
-		if (isset($all[0])) return $all[0];
1126
-		else return array();
1132
+		if (isset($all[0])) {
1133
+			return $all[0];
1134
+		} else {
1135
+			return array();
1136
+		}
1127 1137
 	}
1128 1138
 
1129 1139
 	public function addNOTAM($ref,$title,$type,$fir,$code,$rules,$scope,$lower_limit,$upper_limit,$center_latitude,$center_longitude,$radius,$date_begin,$date_end,$permanent,$text,$full_notam) {
@@ -1201,7 +1211,9 @@  discard block
 block discarded – undo
1201 1211
 					foreach ($alldata as $initial_data) {
1202 1212
 						$data = $this->parse($initial_data);
1203 1213
 						$notamref = $this->getNOTAMbyRef($data['ref']);
1204
-						if (count($notamref) == 0) $this->addNOTAM($data['ref'],$data['title'],'',$data['fir'],$data['code'],'',$data['scope'],$data['lower_limit'],$data['upper_limit'],$data['latitude'],$data['longitude'],$data['radius'],$data['date_begin'],$data['date_end'],$data['permanent'],$data['text'],$data['full_notam']);
1214
+						if (count($notamref) == 0) {
1215
+							$this->addNOTAM($data['ref'],$data['title'],'',$data['fir'],$data['code'],'',$data['scope'],$data['lower_limit'],$data['upper_limit'],$data['latitude'],$data['longitude'],$data['radius'],$data['date_begin'],$data['date_end'],$data['permanent'],$data['text'],$data['full_notam']);
1216
+						}
1205 1217
 					}
1206 1218
 				}
1207 1219
 			}
@@ -1214,7 +1226,9 @@  discard block
 block discarded – undo
1214 1226
 			foreach ($alldata as $initial_data) {
1215 1227
 				$data = $this->parse($initial_data);
1216 1228
 				$notamref = $this->getNOTAMbyRef($data['ref']);
1217
-				if (!isset($notamref['notam_id'])) $this->addNOTAM($data['ref'],$data['title'],'',$data['fir'],$data['code'],'',$data['scope'],$data['lower_limit'],$data['upper_limit'],$data['latitude'],$data['longitude'],$data['radius'],$data['date_begin'],$data['date_end'],$data['permanent'],$data['text'],$data['full_notam']);
1229
+				if (!isset($notamref['notam_id'])) {
1230
+					$this->addNOTAM($data['ref'],$data['title'],'',$data['fir'],$data['code'],'',$data['scope'],$data['lower_limit'],$data['upper_limit'],$data['latitude'],$data['longitude'],$data['radius'],$data['date_begin'],$data['date_end'],$data['permanent'],$data['text'],$data['full_notam']);
1231
+				}
1218 1232
 			}
1219 1233
 		}
1220 1234
 	}
@@ -1226,11 +1240,15 @@  discard block
 block discarded – undo
1226 1240
 		foreach (array_chunk($allairports,20) as $airport) {
1227 1241
 			$airports_icao = array();
1228 1242
 			foreach($airport as $icao) {
1229
-				if (isset($icao['icao'])) $airports_icao[] = $icao['icao'];
1243
+				if (isset($icao['icao'])) {
1244
+					$airports_icao[] = $icao['icao'];
1245
+				}
1230 1246
 			}
1231 1247
 			$airport_icao = implode(',',$airports_icao);
1232 1248
 			$alldata = $this->downloadNOTAM($airport_icao);
1233
-			if ($globalTransaction) $this->db->beginTransaction();
1249
+			if ($globalTransaction) {
1250
+				$this->db->beginTransaction();
1251
+			}
1234 1252
 			if (count($alldata) > 0) {
1235 1253
 				foreach ($alldata as $initial_data) {
1236 1254
 					//print_r($initial_data);
@@ -1239,14 +1257,23 @@  discard block
 block discarded – undo
1239 1257
 					if (isset($data['ref'])) {
1240 1258
 						$notamref = $this->getNOTAMbyRef($data['ref']);
1241 1259
 						if (count($notamref) == 0) {
1242
-							if (isset($data['ref_replaced'])) $this->deleteNOTAMbyRef($data['ref_replaced']);
1243
-							if (isset($data['ref_cancelled'])) $this->deleteNOTAMbyRef($data['ref_cancelled']);
1244
-							elseif (isset($data['latitude']) && isset($data['scope']) && isset($data['text']) && isset($data['permanent'])) echo $this->addNOTAM($data['ref'],'','',$data['fir'],$data['code'],'',$data['scope'],$data['lower_limit'],$data['upper_limit'],$data['latitude'],$data['longitude'],$data['radius'],$data['date_begin'],$data['date_end'],$data['permanent'],$data['text'],$data['full_notam']);
1260
+							if (isset($data['ref_replaced'])) {
1261
+								$this->deleteNOTAMbyRef($data['ref_replaced']);
1262
+							}
1263
+							if (isset($data['ref_cancelled'])) {
1264
+								$this->deleteNOTAMbyRef($data['ref_cancelled']);
1265
+							} elseif (isset($data['latitude']) && isset($data['scope']) && isset($data['text']) && isset($data['permanent'])) {
1266
+								echo $this->addNOTAM($data['ref'],'','',$data['fir'],$data['code'],'',$data['scope'],$data['lower_limit'],$data['upper_limit'],$data['latitude'],$data['longitude'],$data['radius'],$data['date_begin'],$data['date_end'],$data['permanent'],$data['text'],$data['full_notam']);
1267
+							}
1245 1268
 						}
1246 1269
 					}
1247 1270
 				}
1248
-			} else echo 'Error on download. Nothing matches for '.$airport_icao."\n";
1249
-			if ($globalTransaction) $this->db->commit();
1271
+			} else {
1272
+				echo 'Error on download. Nothing matches for '.$airport_icao."\n";
1273
+			}
1274
+			if ($globalTransaction) {
1275
+				$this->db->commit();
1276
+			}
1250 1277
 			sleep(5);
1251 1278
 		}
1252 1279
 	}
@@ -1259,8 +1286,11 @@  discard block
 block discarded – undo
1259 1286
 		$data = $Common->getData($url);
1260 1287
 		preg_match_all("/<pre>(.+?)<\/pre>/is", $data, $matches);
1261 1288
 		//print_r($matches);
1262
-		if (isset($matches[1])) return $matches[1];
1263
-		else return array();
1289
+		if (isset($matches[1])) {
1290
+			return $matches[1];
1291
+		} else {
1292
+			return array();
1293
+		}
1264 1294
 	}
1265 1295
 
1266 1296
 	public function parse($data) {
@@ -1289,93 +1319,150 @@  discard block
 block discarded – undo
1289 1319
 					$rules = str_split($matches[3]);
1290 1320
 					foreach ($rules as $rule) {
1291 1321
 						if ($rule == 'I') {
1292
-							if (isset($result['rules'])) $result['rules'] = $result['rules'].'/IFR';
1293
-							else $result['rules'] = 'IFR';
1322
+							if (isset($result['rules'])) {
1323
+								$result['rules'] = $result['rules'].'/IFR';
1324
+							} else {
1325
+								$result['rules'] = 'IFR';
1326
+							}
1294 1327
 						} elseif ($rule == 'V') {
1295
-							if (isset($result['rules'])) $result['rules'] = $result['rules'].'/VFR';
1296
-							else $result['rules'] = 'VFR';
1328
+							if (isset($result['rules'])) {
1329
+								$result['rules'] = $result['rules'].'/VFR';
1330
+							} else {
1331
+								$result['rules'] = 'VFR';
1332
+							}
1297 1333
 						} elseif ($rule == 'K') {
1298
-							if (isset($result['rules'])) $result['rules'] = $result['rules'].'/Checklist';
1299
-							else $result['rules'] = 'Checklist';
1334
+							if (isset($result['rules'])) {
1335
+								$result['rules'] = $result['rules'].'/Checklist';
1336
+							} else {
1337
+								$result['rules'] = 'Checklist';
1338
+							}
1300 1339
 						}
1301 1340
 					}
1302 1341
 					$attentions = str_split($matches[4]);
1303 1342
 					foreach ($attentions as $attention) {
1304 1343
 						if ($attention == 'N') {
1305
-							if (isset($result['attention'])) $result['attention'] = $result['attention'].' / Immediate attention';
1306
-							else $result['rules'] = 'Immediate attention';
1344
+							if (isset($result['attention'])) {
1345
+								$result['attention'] = $result['attention'].' / Immediate attention';
1346
+							} else {
1347
+								$result['rules'] = 'Immediate attention';
1348
+							}
1307 1349
 						} elseif ($attention == 'B') {
1308
-							if (isset($result['attention'])) $result['attention'] = $result['attention'].' / Operational significance';
1309
-							else $result['rules'] = 'Operational significance';
1350
+							if (isset($result['attention'])) {
1351
+								$result['attention'] = $result['attention'].' / Operational significance';
1352
+							} else {
1353
+								$result['rules'] = 'Operational significance';
1354
+							}
1310 1355
 						} elseif ($attention == 'O') {
1311
-							if (isset($result['attention'])) $result['attention'] = $result['attention'].' / Flight operations';
1312
-							else $result['rules'] = 'Flight operations';
1356
+							if (isset($result['attention'])) {
1357
+								$result['attention'] = $result['attention'].' / Flight operations';
1358
+							} else {
1359
+								$result['rules'] = 'Flight operations';
1360
+							}
1313 1361
 						} elseif ($attention == 'M') {
1314
-							if (isset($result['attention'])) $result['attention'] = $result['attention'].' / Misc';
1315
-							else $result['rules'] = 'Misc';
1362
+							if (isset($result['attention'])) {
1363
+								$result['attention'] = $result['attention'].' / Misc';
1364
+							} else {
1365
+								$result['rules'] = 'Misc';
1366
+							}
1316 1367
 						} elseif ($attention == 'K') {
1317
-							if (isset($result['attention'])) $result['attention'] = $result['attention'].' / Checklist';
1318
-							else $result['rules'] = 'Checklist';
1368
+							if (isset($result['attention'])) {
1369
+								$result['attention'] = $result['attention'].' / Checklist';
1370
+							} else {
1371
+								$result['rules'] = 'Checklist';
1372
+							}
1319 1373
 						}
1320 1374
 					}
1321
-					if ($matches[5] == 'A') $result['scope'] = 'Airport warning';
1322
-					elseif ($matches[5] == 'E') $result['scope'] = 'Enroute warning';
1323
-					elseif ($matches[5] == 'W') $result['scope'] = 'Navigation warning';
1324
-					elseif ($matches[5] == 'K') $result['scope'] = 'Checklist';
1325
-					elseif ($matches[5] == 'AE') $result['scope'] = 'Airport/Enroute warning';
1326
-					elseif ($matches[5] == 'AW') $result['scope'] = 'Airport/Navigation warning';
1375
+					if ($matches[5] == 'A') {
1376
+						$result['scope'] = 'Airport warning';
1377
+					} elseif ($matches[5] == 'E') {
1378
+						$result['scope'] = 'Enroute warning';
1379
+					} elseif ($matches[5] == 'W') {
1380
+						$result['scope'] = 'Navigation warning';
1381
+					} elseif ($matches[5] == 'K') {
1382
+						$result['scope'] = 'Checklist';
1383
+					} elseif ($matches[5] == 'AE') {
1384
+						$result['scope'] = 'Airport/Enroute warning';
1385
+					} elseif ($matches[5] == 'AW') {
1386
+						$result['scope'] = 'Airport/Navigation warning';
1387
+					}
1327 1388
 					$result['lower_limit'] = $matches[6];
1328 1389
 					$result['upper_limit'] = $matches[7];
1329 1390
 					$latitude = $Common->convertDec($matches[8],'latitude');
1330
-					if ($matches[9] == 'S') $latitude = -$latitude;
1391
+					if ($matches[9] == 'S') {
1392
+						$latitude = -$latitude;
1393
+					}
1331 1394
 					$longitude = $Common->convertDec($matches[10],'longitude');
1332
-					if ($matches[11] == 'W') $longitude = -$longitude;
1395
+					if ($matches[11] == 'W') {
1396
+						$longitude = -$longitude;
1397
+					}
1333 1398
 					$result['latitude'] = $latitude;
1334 1399
 					$result['longitude'] = $longitude;
1335
-					if ($matches[12] != '') $result['radius'] = intval($matches[12]);
1336
-					else $result['radius'] = 0;
1400
+					if ($matches[12] != '') {
1401
+						$result['radius'] = intval($matches[12]);
1402
+					} else {
1403
+						$result['radius'] = 0;
1404
+					}
1337 1405
 				} elseif ($globalDebug) {
1338 1406
 					echo 'ERROR NOTAM : '.$data."\n";
1339 1407
 					echo "Can't parse : ".$line."\n";
1340 1408
 				}
1341
-			}
1342
-			elseif (preg_match('#A\) (.*)#',$line,$matches)) {
1409
+			} elseif (preg_match('#A\) (.*)#',$line,$matches)) {
1343 1410
 				$result['icao'] = $matches[1];
1344
-			}
1345
-			elseif (preg_match('#B\) ([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})#',$line,$matches)) {
1346
-				if ($matches[1] > 50) $year = '19'.$matches[1];
1347
-				else $year = '20'.$matches[1];
1411
+			} elseif (preg_match('#B\) ([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})#',$line,$matches)) {
1412
+				if ($matches[1] > 50) {
1413
+					$year = '19'.$matches[1];
1414
+				} else {
1415
+					$year = '20'.$matches[1];
1416
+				}
1348 1417
 				$result['date_begin'] = $year.'/'.$matches[2].'/'.$matches[3].' '.$matches[4].':'.$matches[5];
1349
-			}
1350
-			elseif (preg_match('#C\) ([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})$#',$line,$matches)) {
1351
-				if ($matches[1] > 50) $year = '19'.$matches[1];
1352
-				else $year = '20'.$matches[1];
1418
+			} elseif (preg_match('#C\) ([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})$#',$line,$matches)) {
1419
+				if ($matches[1] > 50) {
1420
+					$year = '19'.$matches[1];
1421
+				} else {
1422
+					$year = '20'.$matches[1];
1423
+				}
1353 1424
 				$result['date_end'] = $year.'/'.$matches[2].'/'.$matches[3].' '.$matches[4].':'.$matches[5];
1354 1425
 				$result['permanent'] = 0;
1355
-			}
1356
-			elseif (preg_match('#C\) ([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2}) (EST|PERM)$#',$line,$matches)) {
1357
-				if ($matches[1] > 50) $year = '19'.$matches[1];
1358
-				else $year = '20'.$matches[1];
1426
+			} elseif (preg_match('#C\) ([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2}) (EST|PERM)$#',$line,$matches)) {
1427
+				if ($matches[1] > 50) {
1428
+					$year = '19'.$matches[1];
1429
+				} else {
1430
+					$year = '20'.$matches[1];
1431
+				}
1359 1432
 				$result['date_end'] = $year.'/'.$matches[2].'/'.$matches[3].' '.$matches[4].':'.$matches[5];
1360
-				if ($matches[6] == 'EST') $result['estimated'] = 1;
1361
-				else $result['estimated'] = 0;
1362
-				if ($matches[6] == 'PERM') $result['permanent'] = 1;
1363
-				else $result['permanent'] = 0;
1364
-			}
1365
-			elseif (preg_match('#C\) (EST|PERM)$#',$line,$matches)) {
1433
+				if ($matches[6] == 'EST') {
1434
+					$result['estimated'] = 1;
1435
+				} else {
1436
+					$result['estimated'] = 0;
1437
+				}
1438
+				if ($matches[6] == 'PERM') {
1439
+					$result['permanent'] = 1;
1440
+				} else {
1441
+					$result['permanent'] = 0;
1442
+				}
1443
+			} elseif (preg_match('#C\) (EST|PERM)$#',$line,$matches)) {
1366 1444
 				$result['date_end'] = '2030/12/20 12:00';
1367
-				if ($matches[1] == 'EST') $result['estimated'] = 1;
1368
-				else $result['estimated'] = 0;
1369
-				if ($matches[1] == 'PERM') $result['permanent'] = 1;
1370
-				else $result['permanent'] = 0;
1371
-			}
1372
-			elseif (preg_match('#E\) (.*)#',$line,$matches)) {
1445
+				if ($matches[1] == 'EST') {
1446
+					$result['estimated'] = 1;
1447
+				} else {
1448
+					$result['estimated'] = 0;
1449
+				}
1450
+				if ($matches[1] == 'PERM') {
1451
+					$result['permanent'] = 1;
1452
+				} else {
1453
+					$result['permanent'] = 0;
1454
+				}
1455
+			} elseif (preg_match('#E\) (.*)#',$line,$matches)) {
1373 1456
 				$rtext = array();
1374 1457
 				$text = explode(' ',$matches[1]);
1375 1458
 				foreach ($text as $word) {
1376
-					if (isset($this->abbr[$word])) $rtext[] = strtoupper($this->abbr[$word]);
1377
-					elseif (ctype_digit(strval(substr($word,3))) && isset($this->abbr[substr($word,0,3)])) $rtext[] = strtoupper($this->abbr[substr($word,0,3)]).' '.substr($word,3);
1378
-					else $rtext[] = $word;
1459
+					if (isset($this->abbr[$word])) {
1460
+						$rtext[] = strtoupper($this->abbr[$word]);
1461
+					} elseif (ctype_digit(strval(substr($word,3))) && isset($this->abbr[substr($word,0,3)])) {
1462
+						$rtext[] = strtoupper($this->abbr[substr($word,0,3)]).' '.substr($word,3);
1463
+					} else {
1464
+						$rtext[] = $word;
1465
+					}
1379 1466
 				}
1380 1467
 				$result['text'] = implode(' ',$rtext);
1381 1468
 			//} elseif (preg_match('#F\) (.*)#',$line,$matches)) {
@@ -1383,7 +1470,9 @@  discard block
 block discarded – undo
1383 1470
 			} elseif (preg_match('#(NOTAMN|NOTAMR|NOTAMC)#',$line,$matches)) {
1384 1471
 				$text = explode(' ',$line);
1385 1472
 				$result['ref'] = $text[0];
1386
-				if ($matches[1] == 'NOTAMN') $result['type'] = 'new';
1473
+				if ($matches[1] == 'NOTAMN') {
1474
+					$result['type'] = 'new';
1475
+				}
1387 1476
 				if ($matches[1] == 'NOTAMC') {
1388 1477
 					$result['type'] = 'cancel';
1389 1478
 					$result['ref_cancelled'] = $text[2];
@@ -1405,69 +1494,101 @@  discard block
 block discarded – undo
1405 1494
 		switch ($code[1]) {
1406 1495
 			case 'A':
1407 1496
 				$result = 'Airspace organization ';
1408
-				if (isset($this->code_airspace[$code_fp])) $result .= $this->code_airspace[$code_fp];
1497
+				if (isset($this->code_airspace[$code_fp])) {
1498
+					$result .= $this->code_airspace[$code_fp];
1499
+				}
1409 1500
 				break;
1410 1501
 			case 'C':
1411 1502
 				$result = 'Communications and radar facilities ';
1412
-				if (isset($this->code_comradar[$code_fp])) $result .= $this->code_comradar[$code_fp];
1503
+				if (isset($this->code_comradar[$code_fp])) {
1504
+					$result .= $this->code_comradar[$code_fp];
1505
+				}
1413 1506
 				break;
1414 1507
 			case 'F':
1415 1508
 				$result = 'Facilities and services ';
1416
-				if (isset($this->code_facilities[$code_fp])) $result .= $this->code_facilities[$code_fp];
1509
+				if (isset($this->code_facilities[$code_fp])) {
1510
+					$result .= $this->code_facilities[$code_fp];
1511
+				}
1417 1512
 				break;
1418 1513
 			case 'I':
1419 1514
 				$result = 'Instrument and Microwave Landing System ';
1420
-				if (isset($this->code_instrumentlanding[$code_fp])) $result .= $this->code_instrumentlanding[$code_fp];
1515
+				if (isset($this->code_instrumentlanding[$code_fp])) {
1516
+					$result .= $this->code_instrumentlanding[$code_fp];
1517
+				}
1421 1518
 				break;
1422 1519
 			case 'L':
1423 1520
 				$result = 'Lighting facilities ';
1424
-				if (isset($this->code_lightingfacilities[$code_fp])) $result .= $this->code_lightingfacilities[$code_fp];
1521
+				if (isset($this->code_lightingfacilities[$code_fp])) {
1522
+					$result .= $this->code_lightingfacilities[$code_fp];
1523
+				}
1425 1524
 				break;
1426 1525
 			case 'M':
1427 1526
 				$result = 'Movement and landing areas ';
1428
-				if (isset($this->code_movementareas[$code_fp])) $result .= $this->code_movementareas[$code_fp];
1527
+				if (isset($this->code_movementareas[$code_fp])) {
1528
+					$result .= $this->code_movementareas[$code_fp];
1529
+				}
1429 1530
 				break;
1430 1531
 			case 'N':
1431 1532
 				$result = 'Terminal and En Route Navigation Facilities ';
1432
-				if (isset($this->code_terminalfacilities[$code_fp])) $result .= $this->code_terminalfacilities[$code_fp];
1533
+				if (isset($this->code_terminalfacilities[$code_fp])) {
1534
+					$result .= $this->code_terminalfacilities[$code_fp];
1535
+				}
1433 1536
 				break;
1434 1537
 			case 'O':
1435 1538
 				$result = 'Other information ';
1436
-				if (isset($this->code_information[$code_fp])) $result .= $this->code_information[$code_fp];
1539
+				if (isset($this->code_information[$code_fp])) {
1540
+					$result .= $this->code_information[$code_fp];
1541
+				}
1437 1542
 				break;
1438 1543
 			case 'P':
1439 1544
 				$result = 'Air Traffic procedures ';
1440
-				if (isset($this->code_airtraffic[$code_fp])) $result .= $this->code_airtraffic[$code_fp];
1545
+				if (isset($this->code_airtraffic[$code_fp])) {
1546
+					$result .= $this->code_airtraffic[$code_fp];
1547
+				}
1441 1548
 				break;
1442 1549
 			case 'R':
1443 1550
 				$result = 'Navigation Warnings: Airspace Restrictions ';
1444
-				if (isset($this->code_navigationw[$code_fp])) $result .= $this->code_navigationw[$code_fp];
1551
+				if (isset($this->code_navigationw[$code_fp])) {
1552
+					$result .= $this->code_navigationw[$code_fp];
1553
+				}
1445 1554
 				break;
1446 1555
 			case 'S':
1447 1556
 				$result = 'Air Traffic and VOLMET Services ';
1448
-				if (isset($this->code_volmet[$code_fp])) $result .= $this->code_volmet[$code_fp];
1557
+				if (isset($this->code_volmet[$code_fp])) {
1558
+					$result .= $this->code_volmet[$code_fp];
1559
+				}
1449 1560
 				break;
1450 1561
 			case 'W':
1451 1562
 				$result = 'Navigation Warnings: Warnings ';
1452
-				if (isset($this->code_warnings[$code_fp])) $result .= $this->code_warnings[$code_fp];
1563
+				if (isset($this->code_warnings[$code_fp])) {
1564
+					$result .= $this->code_warnings[$code_fp];
1565
+				}
1453 1566
 				break;
1454 1567
 		}
1455 1568
 		switch ($code[3]) {
1456 1569
 			case 'A':
1457 1570
 				// Availability
1458
-				if (isset($this->code_sp_availabity[$code_sp])) $result .= ' '.$this->code_sp_availabity[$code_sp];
1571
+				if (isset($this->code_sp_availabity[$code_sp])) {
1572
+					$result .= ' '.$this->code_sp_availabity[$code_sp];
1573
+				}
1459 1574
 				break;
1460 1575
 			case 'C':
1461 1576
 				// Changes
1462
-				if (isset($this->code_sp_changes[$code_sp])) $result .= ' '.$this->code_sp_changes[$code_sp];
1577
+				if (isset($this->code_sp_changes[$code_sp])) {
1578
+					$result .= ' '.$this->code_sp_changes[$code_sp];
1579
+				}
1463 1580
 				break;
1464 1581
 			case 'H':
1465 1582
 				// Hazardous conditions
1466
-				if (isset($this->code_sp_hazardous[$code_sp])) $result .= ' '.$this->code_sp_hazardous[$code_sp];
1583
+				if (isset($this->code_sp_hazardous[$code_sp])) {
1584
+					$result .= ' '.$this->code_sp_hazardous[$code_sp];
1585
+				}
1467 1586
 				break;
1468 1587
 			case 'L':
1469 1588
 				// Limitations
1470
-				if (isset($this->code_sp_limitations[$code_sp])) $result .= ' '.$this->code_sp_limitations[$code_sp];
1589
+				if (isset($this->code_sp_limitations[$code_sp])) {
1590
+					$result .= ' '.$this->code_sp_limitations[$code_sp];
1591
+				}
1471 1592
 				break;
1472 1593
 			case 'X':
1473 1594
 				// Other Information
Please login to merge, or discard this patch.