Completed
Push — master ( 708bc7...3d67e6 )
by Yannick
30:22
created
js/map.3d.js.php 1 patch
Braces   +40 added lines, -13 removed lines patch added patch discarded remove patch
@@ -5,21 +5,30 @@  discard block
 block discarded – undo
5 5
 
6 6
 document.cookie =  'MapFormat=3d; expires=Thu, 2 Aug 2100 20:47:11 UTC; path=/'
7 7
 <?php
8
-	if (isset($_COOKIE['MapType'])) $MapType = $_COOKIE['MapType'];
9
-	else $MapType = $globalMapProvider;
8
+	if (isset($_COOKIE['MapType'])) {
9
+		$MapType = $_COOKIE['MapType'];
10
+	} else {
11
+		$MapType = $globalMapProvider;
12
+	}
10 13
 
11 14
 //	unset($_COOKIE['MapType']);
12 15
 	if ($MapType != 'Mapbox' && $MapType != 'OpenStreetMap' && $MapType != 'Bing-Aerial' && $MapType != 'Bing-Hybrid' && $MapType != 'Bing-Road') {
13
-		if (isset($globalBingMapKey) && $globalBingMapKey != '') $MapType = 'Bing-Aerial';
14
-		else $MapType = 'OpenStreetMap';
16
+		if (isset($globalBingMapKey) && $globalBingMapKey != '') {
17
+			$MapType = 'Bing-Aerial';
18
+		} else {
19
+			$MapType = 'OpenStreetMap';
20
+		}
15 21
 	}
16 22
 	if (($MapType == 'Bing-Aerial' || $MapType == 'Bing-Hybrid' || $MapType == 'Bing-Road') && (!isset($globalBingMapKey) || $globalBingMapKey == '')) {
17 23
 		$MapType = 'OpenStreetMap';
18 24
 	}
19 25
 	if ($MapType == 'Mapbox') {
20
-		if ($_COOKIE['MapTypeId'] == 'default') $MapBoxId = $globalMapboxId;
21
-		else $MapBoxId = $_COOKIE['MapTypeId'];
22
-?>
26
+		if ($_COOKIE['MapTypeId'] == 'default') {
27
+			$MapBoxId = $globalMapboxId;
28
+		} else {
29
+			$MapBoxId = $_COOKIE['MapTypeId'];
30
+		}
31
+		?>
23 32
 	var imProv = Cesium.MapboxImageryProvider({
24 33
 		credit: 'Map data © OpenStreetMap contributors, ' +
25 34
 	      'CC-BY-SA, ' +
@@ -124,13 +133,23 @@  discard block
 block discarded – undo
124 133
 */
125 134
 ?>
126 135
 <?php
127
-	}  elseif (isset($globalMapCustomLayer[$MapType])) {
136
+	} elseif (isset($globalMapCustomLayer[$MapType])) {
128 137
 		$customid = $MapType;
129 138
 ?>
130 139
 	var imProv = Cesium.createOpenStreetMapImageryProvider({
131 140
 		url : '<?php print $globalMapCustomLayer[$customid]['url']; ?>',
132
-		maximumLevel: <?php if (isset($globalMapCustomLayer[$customid]['maxZoom'])) print $globalMapCustomLayer[$customid]['maxZoom']; else print '99'; ?>,
133
-		minimumLevel: <?php if (isset($globalMapCustomLayer[$customid]['minZoom'])) print $globalMapCustomLayer[$customid]['minZoom']; else print '0'; ?>,
141
+		maximumLevel: <?php if (isset($globalMapCustomLayer[$customid]['maxZoom'])) {
142
+	print $globalMapCustomLayer[$customid]['maxZoom'];
143
+} else {
144
+	print '99';
145
+}
146
+?>,
147
+		minimumLevel: <?php if (isset($globalMapCustomLayer[$customid]['minZoom'])) {
148
+	print $globalMapCustomLayer[$customid]['minZoom'];
149
+} else {
150
+	print '0';
151
+}
152
+?>,
134 153
 		credit: '<?php print $globalMapCustomLayer[$customid]['attribution']; ?>'
135 154
 	});
136 155
 <?php
@@ -414,8 +433,11 @@  discard block
 block discarded – undo
414 433
 	if (isset($_COOKIE['lastcentercoord']) || (isset($globalCenterLatitude) && isset($globalCenterLongitude) && $globalCenterLatitude != '' && $globalCenterLongitude != '')) {
415 434
 		if (isset($_COOKIE['lastcentercoord'])) {
416 435
 			$lastcentercoord = explode(',',$_COOKIE['lastcentercoord']);
417
-			if (!isset($lastcentercoord[3])) $zoom = $lastcentercoord[2]*1000000.0;
418
-			else $zoom = $lastcentercoord[3];
436
+			if (!isset($lastcentercoord[3])) {
437
+				$zoom = $lastcentercoord[2]*1000000.0;
438
+			} else {
439
+				$zoom = $lastcentercoord[3];
440
+			}
419 441
 			$viewcenterlatitude = $lastcentercoord[0];
420 442
 			$viewcenterlongitude = $lastcentercoord[1];
421 443
 		} else {
@@ -517,7 +539,12 @@  discard block
 block discarded – undo
517 539
 }
518 540
 
519 541
 update_locationsLayer();
520
-setInterval(function(){update_locationsLayer()},<?php if (isset($globalMapRefresh)) print $globalMapRefresh*1000*2; else print '60000'; ?>);
542
+setInterval(function(){update_locationsLayer()},<?php if (isset($globalMapRefresh)) {
543
+	print $globalMapRefresh*1000*2;
544
+} else {
545
+	print '60000';
546
+}
547
+?>);
521 548
 /*
522 549
 var handlera = new Cesium.ScreenSpaceEventHandler(viewer.canvas, false);
523 550
 handlera.setInputAction(
Please login to merge, or discard this patch.
live-geojson.php 1 patch
Braces   +300 added lines, -117 removed lines patch added patch discarded remove patch
@@ -48,28 +48,55 @@  discard block
 block discarded – undo
48 48
 }
49 49
 header('Content-Type: text/javascript');
50 50
 
51
-if (!isset($globalJsonCompress)) $compress = true;
52
-else $compress = $globalJsonCompress;
51
+if (!isset($globalJsonCompress)) {
52
+	$compress = true;
53
+} else {
54
+	$compress = $globalJsonCompress;
55
+}
53 56
 
54 57
 $from_archive = false;
55 58
 $min = true;
56 59
 $allhistory = false;
57 60
 $filter['source'] = array();
58
-if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') $filter['source'] = array_merge($filter['source'],array('vatsimtxt'));
59
-if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') $filter['source'] = array_merge($filter['source'],array('whazzup'));
60
-if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') $filter['source'] = array_merge($filter['source'],array('phpvmacars'));
61
-if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') $filter['source'] = array_merge($filter['source'],array('sbs','famaprs'));
62
-if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') $filter['source'] = array_merge($filter['source'],array('aprs'));
63
-if (isset($_COOKIE['filter_ident']) && $_COOKIE['filter_ident'] != '') $filter['ident'] = filter_var($_COOKIE['filter_ident'],FILTER_SANITIZE_STRING);
64
-if (isset($_COOKIE['filter_mmsi']) && $_COOKIE['filter_mmsi'] != '') $filter['mmsi'] = filter_var($_COOKIE['filter_mmsi'],FILTER_SANITIZE_STRING);
65
-if (isset($_COOKIE['filter_Airlines']) && $_COOKIE['filter_Airlines'] != '') $filter['airlines'] = filter_var_array(explode(',',$_COOKIE['filter_Airlines']),FILTER_SANITIZE_STRING);
66
-if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') $filter['source_aprs'] = filter_var_array(explode(',',$_COOKIE['filter_Sources']),FILTER_SANITIZE_STRING);
67
-if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') $filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'],FILTER_SANITIZE_STRING);
68
-if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] != 'all') $filter['alliance'] = filter_var($_COOKIE['filter_alliance'],FILTER_SANITIZE_STRING);
61
+if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') {
62
+	$filter['source'] = array_merge($filter['source'],array('vatsimtxt'));
63
+}
64
+if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') {
65
+	$filter['source'] = array_merge($filter['source'],array('whazzup'));
66
+}
67
+if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') {
68
+	$filter['source'] = array_merge($filter['source'],array('phpvmacars'));
69
+}
70
+if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') {
71
+	$filter['source'] = array_merge($filter['source'],array('sbs','famaprs'));
72
+}
73
+if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') {
74
+	$filter['source'] = array_merge($filter['source'],array('aprs'));
75
+}
76
+if (isset($_COOKIE['filter_ident']) && $_COOKIE['filter_ident'] != '') {
77
+	$filter['ident'] = filter_var($_COOKIE['filter_ident'],FILTER_SANITIZE_STRING);
78
+}
79
+if (isset($_COOKIE['filter_mmsi']) && $_COOKIE['filter_mmsi'] != '') {
80
+	$filter['mmsi'] = filter_var($_COOKIE['filter_mmsi'],FILTER_SANITIZE_STRING);
81
+}
82
+if (isset($_COOKIE['filter_Airlines']) && $_COOKIE['filter_Airlines'] != '') {
83
+	$filter['airlines'] = filter_var_array(explode(',',$_COOKIE['filter_Airlines']),FILTER_SANITIZE_STRING);
84
+}
85
+if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') {
86
+	$filter['source_aprs'] = filter_var_array(explode(',',$_COOKIE['filter_Sources']),FILTER_SANITIZE_STRING);
87
+}
88
+if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') {
89
+	$filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'],FILTER_SANITIZE_STRING);
90
+}
91
+if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] != 'all') {
92
+	$filter['alliance'] = filter_var($_COOKIE['filter_alliance'],FILTER_SANITIZE_STRING);
93
+}
69 94
 
70 95
 if (isset($globalMapPopup) && !$globalMapPopup && !(isset($_COOKIE['flightpopup']) && $_COOKIE['flightpopup'] == 'true')) {
71 96
 	$min = true;
72
-} else $min = false;
97
+} else {
98
+	$min = false;
99
+}
73 100
 
74 101
 $spotter_array = array();
75 102
 
@@ -171,24 +198,38 @@  discard block
 block discarded – undo
171 198
 			$flightcnt = $SpotterLive->getLiveSpotterCount($filter);
172 199
 		}
173 200
 	}
174
-	if ($flightcnt == '') $flightcnt = 0;
175
-} else $flightcnt = 0;
201
+	if ($flightcnt == '') {
202
+		$flightcnt = 0;
203
+	}
204
+	} else {
205
+	$flightcnt = 0;
206
+}
176 207
 
177 208
 $sqltime = round(microtime(true)-$begintime,2);
178 209
 
179 210
 $currenttime = filter_input(INPUT_GET,'currenttime',FILTER_SANITIZE_NUMBER_INT);
180
-if ($currenttime != '') $currenttime = round($currenttime/1000);
211
+if ($currenttime != '') {
212
+	$currenttime = round($currenttime/1000);
213
+}
181 214
 
182
-if ((!isset($_COOKIE['flightestimation']) && isset($globalMapEstimation) && $globalMapEstimation == FALSE) || (isset($_COOKIE['flightestimation']) && $_COOKIE['flightestimation'] == 'false')) $usenextlatlon = false;
183
-else $usenextlatlon = true;
184
-if ($usenextlatlon === false) $currenttime = '';
215
+if ((!isset($_COOKIE['flightestimation']) && isset($globalMapEstimation) && $globalMapEstimation == FALSE) || (isset($_COOKIE['flightestimation']) && $_COOKIE['flightestimation'] == 'false')) {
216
+	$usenextlatlon = false;
217
+} else {
218
+	$usenextlatlon = true;
219
+}
220
+if ($usenextlatlon === false) {
221
+	$currenttime = '';
222
+}
185 223
 $j = 0;
186 224
 $prev_flightaware_id = '';
187 225
 $aircrafts_shadow = array();
188 226
 $output = '{';
189 227
 	$output .= '"type": "FeatureCollection",';
190
-		if ($min) $output .= '"minimal": "true",';
191
-		else $output .= '"minimal": "false",';
228
+		if ($min) {
229
+			$output .= '"minimal": "true",';
230
+		} else {
231
+			$output .= '"minimal": "false",';
232
+		}
192 233
 		//$output .= '"fc": "'.$flightcnt.'",';
193 234
 		$output .= '"sqt": "'.$sqltime.'",';
194 235
 
@@ -232,18 +273,29 @@  discard block
 block discarded – undo
232 273
 						}
233 274
 						$output .= '"properties": {';
234 275
 						if (isset($spotter_item['flightaware_id'])) {
235
-							if ($compress) $output .= '"fi": "'.$spotter_item['flightaware_id'].'",';
236
-							else $output .= '"flightaware_id": "'.$spotter_item['flightaware_id'].'",';
276
+							if ($compress) {
277
+								$output .= '"fi": "'.$spotter_item['flightaware_id'].'",';
278
+							} else {
279
+								$output .= '"flightaware_id": "'.$spotter_item['flightaware_id'].'",';
280
+							}
237 281
 						} elseif (isset($spotter_item['famtrackid'])) {
238
-							if ($compress) $output .= '"fti": "'.$spotter_item['famtrackid'].'",';
239
-							else $output .= '"famtrackid": "'.$spotter_item['famtrackid'].'",';
282
+							if ($compress) {
283
+								$output .= '"fti": "'.$spotter_item['famtrackid'].'",';
284
+							} else {
285
+								$output .= '"famtrackid": "'.$spotter_item['famtrackid'].'",';
286
+							}
240 287
 						} elseif (isset($spotter_item['fammarine_id'])) {
241
-							if ($compress) $output .= '"fmi": "'.$spotter_item['fammarine_id'].'",';
242
-							else $output .= '"fammarineid": "'.$spotter_item['fammarine_id'].'",';
288
+							if ($compress) {
289
+								$output .= '"fmi": "'.$spotter_item['fammarine_id'].'",';
290
+							} else {
291
+								$output .= '"fammarineid": "'.$spotter_item['fammarine_id'].'",';
292
+							}
243 293
 						}
244 294
 							$output .= '"fc": "'.$flightcnt.'",';
245 295
 							$output .= '"sqt": "'.$sqltime.'",';
246
-							if (isset($begindate)) $output .= '"archive_date": "'.$begindate.'",';
296
+							if (isset($begindate)) {
297
+								$output .= '"archive_date": "'.$begindate.'",';
298
+							}
247 299
 
248 300
 /*
249 301
 							if ($min) $output .= '"minimal": "true",';
@@ -251,14 +303,22 @@  discard block
 block discarded – undo
251 303
 */
252 304
 							//$output .= '"fc": "'.$spotter_item['nb'].'",';
253 305
 						if (isset($spotter_item['ident']) && $spotter_item['ident'] != '') {
254
-							if ($compress) $output .= '"c": "'.str_replace('\\','',$spotter_item['ident']).'",';
255
-							else $output .= '"callsign": "'.str_replace('\\','',$spotter_item['ident']).'",';
306
+							if ($compress) {
307
+								$output .= '"c": "'.str_replace('\\','',$spotter_item['ident']).'",';
308
+							} else {
309
+								$output .= '"callsign": "'.str_replace('\\','',$spotter_item['ident']).'",';
310
+							}
256 311
 							//"
257 312
 						} else {
258
-							if ($compress) $output .= '"c": "NA",';
259
-							else $output .= '"callsign": "NA",';
313
+							if ($compress) {
314
+								$output .= '"c": "NA",';
315
+							} else {
316
+								$output .= '"callsign": "NA",';
317
+							}
318
+						}
319
+						if (isset($spotter_item['registration'])) {
320
+							$output .= '"registration": "'.$spotter_item['registration'].'",';
260 321
 						}
261
-						if (isset($spotter_item['registration'])) $output .= '"registration": "'.$spotter_item['registration'].'",';
262 322
 						if (isset($spotter_item['aircraft_name']) && isset($spotter_item['aircraft_type'])) {
263 323
 							$output .= '"aircraft_name": "'.$spotter_item['aircraft_name'].' ('.$spotter_item['aircraft_type'].')",';
264 324
 							$output .= '"aircraft_wiki": "http://'.strtolower($globalLanguage).'.wikipedia.org/wiki/'.urlencode(str_replace(' ','_',$spotter_item['aircraft_name'])).'",';
@@ -271,16 +331,23 @@  discard block
 block discarded – undo
271 331
 							$output .= '"aircraft_icao": "'.$spotter_item['aircraft_icao'].'",';
272 332
 						}
273 333
 						if (!isset($spotter_item['aircraft_shadow']) && !$tracker) {
274
-							if (!isset($spotter_item['aircraft_icao']) || $spotter_item['aircraft_icao'] == '') $spotter_item['aircraft_shadow'] = '';
275
-							else {
334
+							if (!isset($spotter_item['aircraft_icao']) || $spotter_item['aircraft_icao'] == '') {
335
+								$spotter_item['aircraft_shadow'] = '';
336
+							} else {
276 337
 								$aircraft_icao = $spotter_item['aircraft_icao'];
277
-								if (isset($aircrafts_shadow[$aircraft_icao])) $spotter_item['aircraft_shadow'] = $aircrafts_shadow[$aircraft_icao];
278
-								else {
338
+								if (isset($aircrafts_shadow[$aircraft_icao])) {
339
+									$spotter_item['aircraft_shadow'] = $aircrafts_shadow[$aircraft_icao];
340
+								} else {
279 341
 									$aircraft_info = $Spotter->getAllAircraftInfo($spotter_item['aircraft_icao']);
280
-									if (count($aircraft_info) > 0) $spotter_item['aircraft_shadow'] = $aircraft_info[0]['aircraft_shadow'];
281
-									elseif (isset($spotter_item['format_source']) && $spotter_item['format_source'] == 'aprs') $spotter_item['aircraft_shadow'] = 'PA18.png';
282
-									elseif ($aircraft_icao == 'PARAGLIDER') $spotter_item['aircraft_shadow'] = 'PARAGLIDER.png';
283
-									else $spotter_item['aircraft_shadow'] = '';
342
+									if (count($aircraft_info) > 0) {
343
+										$spotter_item['aircraft_shadow'] = $aircraft_info[0]['aircraft_shadow'];
344
+									} elseif (isset($spotter_item['format_source']) && $spotter_item['format_source'] == 'aprs') {
345
+										$spotter_item['aircraft_shadow'] = 'PA18.png';
346
+									} elseif ($aircraft_icao == 'PARAGLIDER') {
347
+										$spotter_item['aircraft_shadow'] = 'PARAGLIDER.png';
348
+									} else {
349
+										$spotter_item['aircraft_shadow'] = '';
350
+									}
284 351
 									$aircrafts_shadow[$aircraft_icao] = $spotter_item['aircraft_shadow'];
285 352
 								}
286 353
 							}
@@ -288,73 +355,139 @@  discard block
 block discarded – undo
288 355
 						if (!isset($spotter_item['aircraft_shadow']) || $spotter_item['aircraft_shadow'] == '') {
289 356
 							if ($tracker) {
290 357
 								if (isset($spotter_item['type']) && $spotter_item['type'] == 'Ambulance') {
291
-									if ($compress) $output .= '"as": "ambulance.png",';
292
-									else $output .= '"aircraft_shadow": "ambulance.png",';
358
+									if ($compress) {
359
+										$output .= '"as": "ambulance.png",';
360
+									} else {
361
+										$output .= '"aircraft_shadow": "ambulance.png",';
362
+									}
293 363
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Police') {
294
-									if ($compress) $output .= '"as": "police.png",';
295
-									else $output .= '"aircraft_shadow": "police.png",';
364
+									if ($compress) {
365
+										$output .= '"as": "police.png",';
366
+									} else {
367
+										$output .= '"aircraft_shadow": "police.png",';
368
+									}
296 369
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Yacht (Sail)') {
297
-									if ($compress) $output .= '"as": "ship.png",';
298
-									else $output .= '"aircraft_shadow": "ship.png",';
370
+									if ($compress) {
371
+										$output .= '"as": "ship.png",';
372
+									} else {
373
+										$output .= '"aircraft_shadow": "ship.png",';
374
+									}
299 375
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Ship (Power Boat)') {
300
-									if ($compress) $output .= '"as": "ship.png",';
301
-									else $output .= '"aircraft_shadow": "ship.png",';
376
+									if ($compress) {
377
+										$output .= '"as": "ship.png",';
378
+									} else {
379
+										$output .= '"aircraft_shadow": "ship.png",';
380
+									}
302 381
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Shuttle') {
303
-									if ($compress) $output .= '"as": "ship.png",';
304
-									else $output .= '"aircraft_shadow": "ship.png",';
382
+									if ($compress) {
383
+										$output .= '"as": "ship.png",';
384
+									} else {
385
+										$output .= '"aircraft_shadow": "ship.png",';
386
+									}
305 387
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Truck') {
306
-									if ($compress) $output .= '"as": "truck.png",';
307
-									else $output .= '"aircraft_shadow": "truck.png",';
388
+									if ($compress) {
389
+										$output .= '"as": "truck.png",';
390
+									} else {
391
+										$output .= '"aircraft_shadow": "truck.png",';
392
+									}
308 393
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Truck (18 Wheeler)') {
309
-									if ($compress) $output .= '"as": "truck.png",';
310
-									else $output .= '"aircraft_shadow": "truck.png",';
394
+									if ($compress) {
395
+										$output .= '"as": "truck.png",';
396
+									} else {
397
+										$output .= '"aircraft_shadow": "truck.png",';
398
+									}
311 399
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Aircraft (small)') {
312
-									if ($compress) $output .= '"as": "aircraft.png",';
313
-									else $output .= '"aircraft_shadow": "aircraft.png",';
400
+									if ($compress) {
401
+										$output .= '"as": "aircraft.png",';
402
+									} else {
403
+										$output .= '"aircraft_shadow": "aircraft.png",';
404
+									}
314 405
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Large Aircraft') {
315
-									if ($compress) $output .= '"as": "aircraft.png",';
316
-									else $output .= '"aircraft_shadow": "aircraft.png",';
406
+									if ($compress) {
407
+										$output .= '"as": "aircraft.png",';
408
+									} else {
409
+										$output .= '"aircraft_shadow": "aircraft.png",';
410
+									}
317 411
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Helicopter') {
318
-									if ($compress) $output .= '"as": "helico.png",';
319
-									else $output .= '"aircraft_shadow": "helico.png",';
412
+									if ($compress) {
413
+										$output .= '"as": "helico.png",';
414
+									} else {
415
+										$output .= '"aircraft_shadow": "helico.png",';
416
+									}
320 417
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Railroad Engine') {
321
-									if ($compress) $output .= '"as": "rail.png",';
322
-									else $output .= '"aircraft_shadow": "rail.png",';
418
+									if ($compress) {
419
+										$output .= '"as": "rail.png",';
420
+									} else {
421
+										$output .= '"aircraft_shadow": "rail.png",';
422
+									}
323 423
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Firetruck') {
324
-									if ($compress) $output .= '"as": "firetruck.png",';
325
-									else $output .= '"aircraft_shadow": "firetruck.png",';
424
+									if ($compress) {
425
+										$output .= '"as": "firetruck.png",';
426
+									} else {
427
+										$output .= '"aircraft_shadow": "firetruck.png",';
428
+									}
326 429
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Bus') {
327
-									if ($compress) $output .= '"as": "bus.png",';
328
-									else $output .= '"aircraft_shadow": "bus.png",';
430
+									if ($compress) {
431
+										$output .= '"as": "bus.png",';
432
+									} else {
433
+										$output .= '"aircraft_shadow": "bus.png",';
434
+									}
329 435
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Phone') {
330
-									if ($compress) $output .= '"as": "phone.png",';
331
-									else $output .= '"aircraft_shadow": "phone.png",';
436
+									if ($compress) {
437
+										$output .= '"as": "phone.png",';
438
+									} else {
439
+										$output .= '"aircraft_shadow": "phone.png",';
440
+									}
332 441
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Jogger') {
333
-									if ($compress) $output .= '"as": "jogger.png",';
334
-									else $output .= '"aircraft_shadow": "jogger.png",';
442
+									if ($compress) {
443
+										$output .= '"as": "jogger.png",';
444
+									} else {
445
+										$output .= '"aircraft_shadow": "jogger.png",';
446
+									}
335 447
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Bike') {
336
-									if ($compress) $output .= '"as": "bike.png",';
337
-									else $output .= '"aircraft_shadow": "bike.png",';
448
+									if ($compress) {
449
+										$output .= '"as": "bike.png",';
450
+									} else {
451
+										$output .= '"aircraft_shadow": "bike.png",';
452
+									}
338 453
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Motorcycle') {
339
-									if ($compress) $output .= '"as": "motorcycle.png",';
340
-									else $output .= '"aircraft_shadow": "motorcycle.png",';
454
+									if ($compress) {
455
+										$output .= '"as": "motorcycle.png",';
456
+									} else {
457
+										$output .= '"aircraft_shadow": "motorcycle.png",';
458
+									}
341 459
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Balloon') {
342
-									if ($compress) $output .= '"as": "balloon.png",';
343
-									else $output .= '"aircraft_shadow": "balloon.png",';
460
+									if ($compress) {
461
+										$output .= '"as": "balloon.png",';
462
+									} else {
463
+										$output .= '"aircraft_shadow": "balloon.png",';
464
+									}
344 465
 								} else {
345
-									if ($compress) $output .= '"as": "car.png",';
346
-									else $output .= '"aircraft_shadow": "car.png",';
466
+									if ($compress) {
467
+										$output .= '"as": "car.png",';
468
+									} else {
469
+										$output .= '"aircraft_shadow": "car.png",';
470
+									}
347 471
 								}
348 472
 							} elseif ($marine) {
349
-								if ($compress) $output .= '"as": "ship.png",';
350
-								else $output .= '"aircraft_shadow": "ship.png",';
473
+								if ($compress) {
474
+									$output .= '"as": "ship.png",';
475
+								} else {
476
+									$output .= '"aircraft_shadow": "ship.png",';
477
+								}
351 478
 							} else {
352
-								if ($compress) $output .= '"as": "default.png",';
353
-								else $output .= '"aircraft_shadow": "default.png",';
479
+								if ($compress) {
480
+									$output .= '"as": "default.png",';
481
+								} else {
482
+									$output .= '"aircraft_shadow": "default.png",';
483
+								}
354 484
 							}
355 485
 						} else {
356
-							if ($compress) $output .= '"as": "'.$spotter_item['aircraft_shadow'].'",';
357
-							else $output .= '"aircraft_shadow": "'.$spotter_item['aircraft_shadow'].'",';
486
+							if ($compress) {
487
+								$output .= '"as": "'.$spotter_item['aircraft_shadow'].'",';
488
+							} else {
489
+								$output .= '"aircraft_shadow": "'.$spotter_item['aircraft_shadow'].'",';
490
+							}
358 491
 						}
359 492
 						if (isset($spotter_item['airline_name'])) {
360 493
 							$output .= '"airline_name": "'.$spotter_item['airline_name'].'",';
@@ -362,8 +495,11 @@  discard block
 block discarded – undo
362 495
 							$output .= '"airline_name": "NA",';
363 496
 						}
364 497
 						if (isset($spotter_item['departure_airport'])) {
365
-							if ($compress) $output .= '"dac": "'.$spotter_item['departure_airport'].'",';
366
-							else $output .= '"departure_airport_code": "'.$spotter_item['departure_airport'].'",';
498
+							if ($compress) {
499
+								$output .= '"dac": "'.$spotter_item['departure_airport'].'",';
500
+							} else {
501
+								$output .= '"departure_airport_code": "'.$spotter_item['departure_airport'].'",';
502
+							}
367 503
 						}
368 504
 						if (isset($spotter_item['departure_airport_city'])) {
369 505
 							$output .= '"departure_airport": "'.$spotter_item['departure_airport_city'].', '.$spotter_item['departure_airport_country'].'",';
@@ -375,8 +511,11 @@  discard block
 block discarded – undo
375 511
 							$output .= '"arrival_airport_time": "'.$spotter_item['arrival_airport_time'].'",';
376 512
 						}
377 513
 						if (isset($spotter_item['arrival_airport'])) {
378
-							if ($compress) $output .= '"aac": "'.$spotter_item['arrival_airport'].'",';
379
-							else $output .= '"arrival_airport_code": "'.$spotter_item['arrival_airport'].'",';
514
+							if ($compress) {
515
+								$output .= '"aac": "'.$spotter_item['arrival_airport'].'",';
516
+							} else {
517
+								$output .= '"arrival_airport_code": "'.$spotter_item['arrival_airport'].'",';
518
+							}
380 519
 						}
381 520
 						if (isset($spotter_item['arrival_airport_city'])) {
382 521
 							$output .= '"arrival_airport": "'.$spotter_item['arrival_airport_city'].', '.$spotter_item['arrival_airport_country'].'",';
@@ -395,11 +534,17 @@  discard block
 block discarded – undo
395 534
 						}
396 535
 						
397 536
 						if (isset($spotter_item['altitude'])) {
398
-							if ($compress) $output .= '"a": "'.$spotter_item['altitude'].'",';
399
-							else $output .= '"altitude": "'.$spotter_item['altitude'].'",';
537
+							if ($compress) {
538
+								$output .= '"a": "'.$spotter_item['altitude'].'",';
539
+							} else {
540
+								$output .= '"altitude": "'.$spotter_item['altitude'].'",';
541
+							}
542
+						}
543
+						if ($compress) {
544
+							$output .= '"h": "'.$spotter_item['heading'].'",';
545
+						} else {
546
+							$output .= '"heading": "'.$spotter_item['heading'].'",';
400 547
 						}
401
-						if ($compress)$output .= '"h": "'.$spotter_item['heading'].'",';
402
-						else $output .= '"heading": "'.$spotter_item['heading'].'",';
403 548
 						
404 549
 						if ($currenttime != '') {
405 550
 							if (strtotime($spotter_item['date']) < $currenttime) {
@@ -421,7 +566,9 @@  discard block
 block discarded – undo
421 566
 							}
422 567
 						}
423 568
 
424
-						if (!$min) $output .= '"image": "'.$image.'",';
569
+						if (!$min) {
570
+							$output .= '"image": "'.$image.'",';
571
+						}
425 572
 						if (isset($spotter_item['image_copyright']) && $spotter_item['image_copyright'] != '') {
426 573
 							$output .= '"image_copyright": "'.str_replace('"',"'",trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'',$spotter_item['image_copyright']))).'",';
427 574
 						}
@@ -429,8 +576,11 @@  discard block
 block discarded – undo
429 576
 							$output .= '"image_source_website": "'.urlencode($spotter_item['image_source_website']).'",';
430 577
 						}
431 578
 						if (isset($spotter_item['squawk'])) {
432
-							if ($compress) $output .= '"sq": "'.$spotter_item['squawk'].'",';
433
-							else $output .= '"squawk": "'.$spotter_item['squawk'].'",';
579
+							if ($compress) {
580
+								$output .= '"sq": "'.$spotter_item['squawk'].'",';
581
+							} else {
582
+								$output .= '"squawk": "'.$spotter_item['squawk'].'",';
583
+							}
434 584
 						}
435 585
 						if (isset($spotter_item['squawk_usage'])) {
436 586
 							$output .= '"squawk_usage": "'.$spotter_item['squawk_usage'].'",';
@@ -449,14 +599,23 @@  discard block
 block discarded – undo
449 599
 						}
450 600
 						// type when not aircraft ?
451 601
 						if (isset($spotter_item['type'])) {
452
-							if ($compress) $output .= '"t": "'.$spotter_item['type'].'"';
453
-							else $output .= '"type": "'.$spotter_item['type'].'"';
602
+							if ($compress) {
603
+								$output .= '"t": "'.$spotter_item['type'].'"';
604
+							} else {
605
+								$output .= '"type": "'.$spotter_item['type'].'"';
606
+							}
454 607
 						} elseif ($marine) {
455
-							if ($compress) $output .= '"t": "ship"';
456
-							else $output .= '"type": "ship"';
608
+							if ($compress) {
609
+								$output .= '"t": "ship"';
610
+							} else {
611
+								$output .= '"type": "ship"';
612
+							}
457 613
 						} else {
458
-							if ($compress) $output .= '"t": "aircraft"';
459
-							else $output .= '"type": "aircraft"';
614
+							if ($compress) {
615
+								$output .= '"t": "aircraft"';
616
+							} else {
617
+								$output .= '"type": "aircraft"';
618
+							}
460 619
 						}
461 620
 						$output .= '},';
462 621
 						$output .= '"geometry": {';
@@ -464,7 +623,9 @@  discard block
 block discarded – undo
464 623
 								$output .= '"coordinates": [';
465 624
 								if ($currenttime != '') {
466 625
 									if (strtotime($spotter_item['date']) < $currenttime) {
467
-										if (!isset($archivespeed)) $archivespeed = 1;
626
+										if (!isset($archivespeed)) {
627
+											$archivespeed = 1;
628
+										}
468 629
 										$nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$spotter_item['heading'],$archivespeed,$currenttime-strtotime($spotter_item['date']));
469 630
 										$output .= $nextcoord['longitude'].','.$nextcoord['latitude'];
470 631
 									} else {
@@ -535,7 +696,9 @@  discard block
 block discarded – undo
535 696
 			}
536 697
 */
537 698
 				$history = filter_input(INPUT_GET,'history',FILTER_SANITIZE_STRING);
538
-				if ($history == '' && isset($_COOKIE['history'])) $history = $_COOKIE['history'];
699
+				if ($history == '' && isset($_COOKIE['history'])) {
700
+					$history = $_COOKIE['history'];
701
+				}
539 702
 				
540 703
 				if (
541 704
 				    (isset($_COOKIE['flightpath']) && $_COOKIE['flightpath'] == 'true') 
@@ -579,8 +742,11 @@  discard block
 block discarded – undo
579 742
 									$output_history .= ']}},';
580 743
 									$output .= $output_history;
581 744
 								}
582
-								if ($compress) $output_history = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "history","a": "'.$alt.'"},"geometry": {"type": "LineString","coordinates": [';
583
-								else $output_history = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "history","altitude": "'.$alt.'"},"geometry": {"type": "LineString","coordinates": [';
745
+								if ($compress) {
746
+									$output_history = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "history","a": "'.$alt.'"},"geometry": {"type": "LineString","coordinates": [';
747
+								} else {
748
+									$output_history = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "history","altitude": "'.$alt.'"},"geometry": {"type": "LineString","coordinates": [';
749
+								}
584 750
 							}
585 751
 							$output_history .= '[';
586 752
 							$output_history .=  $spotter_history['longitude'].', ';
@@ -599,9 +765,14 @@  discard block
 block discarded – undo
599 765
 							$prev_alt = $alt;
600 766
 						} else {
601 767
 							if ($d == false) {
602
-								if ($compress) $output_history = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "history"},"geometry": {"type": "LineString","coordinates": [';
603
-								else $output_history = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "history"},"geometry": {"type": "LineString","coordinates": [';
604
-							} else $d = true;
768
+								if ($compress) {
769
+									$output_history = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "history"},"geometry": {"type": "LineString","coordinates": [';
770
+								} else {
771
+									$output_history = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "history"},"geometry": {"type": "LineString","coordinates": [';
772
+								}
773
+							} else {
774
+								$d = true;
775
+							}
605 776
 							$output_history .= '[';
606 777
 							$output_history .=  $spotter_history['longitude'].', ';
607 778
 							$output_history .=  $spotter_history['latitude'];
@@ -622,7 +793,9 @@  discard block
 block discarded – undo
622 793
 							$output_historyd = '[';
623 794
 							$output_historyd .=  $spotter_item['longitude'].', ';
624 795
 							$output_historyd .=  $spotter_item['latitude'];
625
-							if (isset($spotter_history['altitude'])) $output_historyd .=  ','.$spotter_item['altitude']*30.48;
796
+							if (isset($spotter_history['altitude'])) {
797
+								$output_historyd .=  ','.$spotter_item['altitude']*30.48;
798
+							}
626 799
 							$output_historyd .= '],';
627 800
 							//$output_history = $output_historyd.$output_history;
628 801
 							$output_history = $output_history.$output_historyd;
@@ -644,8 +817,11 @@  discard block
 block discarded – undo
644 817
 				        && $spotter_item['arrival_airport'] != 'NA' 
645 818
 				        && ((isset($_COOKIE['MapRoute']) && $_COOKIE['MapRoute'] == "true") 
646 819
 				    	    || (!isset($_COOKIE['MapRoute']) && isset($globalMapRoute) && $globalMapRoute)))) {
647
-				    if ($compress) $output_air = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "route"},"geometry": {"type": "LineString","coordinates": [';
648
-				    else $output_air = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "route"},"geometry": {"type": "LineString","coordinates": [';
820
+				    if ($compress) {
821
+				    	$output_air = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "route"},"geometry": {"type": "LineString","coordinates": [';
822
+				    } else {
823
+				    	$output_air = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "route"},"geometry": {"type": "LineString","coordinates": [';
824
+				    }
649 825
 				    if (isset($spotter_item['departure_airport_latitude'])) {
650 826
 					$output_air .= '['.$spotter_item['departure_airport_longitude'].','.$spotter_item['departure_airport_latitude'].'],';
651 827
 				    } elseif (isset($spotter_item['departure_airport']) && $spotter_item['departure_airport'] != 'NA') {
@@ -678,8 +854,11 @@  discard block
 block discarded – undo
678 854
 				    	    || (!isset($_COOKIE['MapRemainaingRoute']) && (!isset($globalMapRemainingRoute) 
679 855
 				    	    || (isset($globalMapRemainingRoute) && $globalMapRemainingRoute)))))) {
680 856
 				    $havedata = false;
681
-				    if ($compress) $output_dest = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "routedest"},"geometry": {"type": "LineString","coordinates": [';
682
-				    else $output_dest = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "routedest"},"geometry": {"type": "LineString","coordinates": [';
857
+				    if ($compress) {
858
+				    	$output_dest = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "routedest"},"geometry": {"type": "LineString","coordinates": [';
859
+				    } else {
860
+				    	$output_dest = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "routedest"},"geometry": {"type": "LineString","coordinates": [';
861
+				    }
683 862
 				    $output_dest .= '['.$spotter_item['longitude'].','.$spotter_item['latitude'].'],';
684 863
 
685 864
 				    if (isset($spotter_item['arrival_airport_latitude'])) {
@@ -694,7 +873,9 @@  discard block
 block discarded – undo
694 873
 				    }
695 874
 				    //$output_dest  = substr($output_dest, 0, -1);
696 875
 				    $output_dest .= ']}},';
697
-				    if ($havedata) $output .= $output_dest;
876
+				    if ($havedata) {
877
+				    	$output .= $output_dest;
878
+				    }
698 879
 				    unset($output_dest);
699 880
 				}
700 881
 			}
@@ -702,7 +883,9 @@  discard block
 block discarded – undo
702 883
 			$output .= ']';
703 884
 			$output .= ',"initial_sqltime": "'.$sqltime.'",';
704 885
 			$output .= '"totaltime": "'.round(microtime(true)-$begintime,2).'",';
705
-			if (isset($begindate)) $output .= '"archive_date": "'.$begindate.'",';
886
+			if (isset($begindate)) {
887
+				$output .= '"archive_date": "'.$begindate.'",';
888
+			}
706 889
 			$output .= '"fc": "'.$j.'"';
707 890
 		} else {
708 891
 			$output .= '"features": ';
Please login to merge, or discard this patch.
install/index.php 1 patch
Braces   +523 added lines, -142 removed lines patch added patch discarded remove patch
@@ -4,11 +4,19 @@  discard block
 block discarded – undo
4 4
 if (isset($_SESSION['error'])) {
5 5
 	header('Content-Encoding: none;');
6 6
 	echo 'Error : '.$_SESSION['error'].' - Resetting install... You need to fix the problem and run install again.';
7
-	if (isset($_SESSION['error'])) unset($_SESSION['error']);
8
-	if (isset($_SESSION['errorlst'])) unset($_SESSION['errorlst']);
9
-	if (isset($_SESSION['next'])) unset($_SESSION['next']);
10
-	if (isset($_SESSION['install'])) unset($_SESSION['install']);
11
-}
7
+	if (isset($_SESSION['error'])) {
8
+		unset($_SESSION['error']);
9
+	}
10
+	if (isset($_SESSION['errorlst'])) {
11
+		unset($_SESSION['errorlst']);
12
+	}
13
+	if (isset($_SESSION['next'])) {
14
+		unset($_SESSION['next']);
15
+	}
16
+	if (isset($_SESSION['install'])) {
17
+		unset($_SESSION['install']);
18
+	}
19
+	}
12 20
 /*
13 21
 if (isset($_SESSION['errorlst'])) {
14 22
 	header('Content-Encoding: none;');
@@ -156,45 +164,72 @@  discard block
 block discarded – undo
156 164
 			</div>
157 165
 			<p>
158 166
 				<label for="dbhost">Database hostname</label>
159
-				<input type="text" name="dbhost" id="dbhost" value="<?php if (isset($globalDBhost)) print $globalDBhost; ?>" />
167
+				<input type="text" name="dbhost" id="dbhost" value="<?php if (isset($globalDBhost)) {
168
+	print $globalDBhost;
169
+}
170
+?>" />
160 171
 			</p>
161 172
 			<p>
162 173
 				<label for="dbport">Database port</label>
163
-				<input type="text" name="dbport" id="dbport" value="<?php if (isset($globalDBport)) print $globalDBport; ?>" />
174
+				<input type="text" name="dbport" id="dbport" value="<?php if (isset($globalDBport)) {
175
+	print $globalDBport;
176
+}
177
+?>" />
164 178
 				<p class="help-block">Default is 3306 for MariaDB/MySQL, 5432 for PostgreSQL</p>
165 179
 			</p>
166 180
 			<p>
167 181
 				<label for="dbname">Database name</label>
168
-				<input type="text" name="dbname" id="dbname" value="<?php if (isset($globalDBname)) print $globalDBname; ?>" />
182
+				<input type="text" name="dbname" id="dbname" value="<?php if (isset($globalDBname)) {
183
+	print $globalDBname;
184
+}
185
+?>" />
169 186
 			</p>
170 187
 			<p>
171 188
 				<label for="dbuser">Database user</label>
172
-				<input type="text" name="dbuser" id="dbuser" value="<?php if (isset($globalDBuser)) print $globalDBuser; ?>" />
189
+				<input type="text" name="dbuser" id="dbuser" value="<?php if (isset($globalDBuser)) {
190
+	print $globalDBuser;
191
+}
192
+?>" />
173 193
 			</p>
174 194
 			<p>
175 195
 				<label for="dbuserpass">Database user password</label>
176
-				<input type="password" name="dbuserpass" id="dbuserpass" value="<?php if (isset($globalDBpass)) print $globalDBpass; ?>" />
196
+				<input type="password" name="dbuserpass" id="dbuserpass" value="<?php if (isset($globalDBpass)) {
197
+	print $globalDBpass;
198
+}
199
+?>" />
177 200
 			</p>
178 201
 		</fieldset>
179 202
 		<fieldset id="site">
180 203
 			<legend>Site configuration</legend>
181 204
 			<p>
182 205
 				<label for="sitename">Site name</label>
183
-				<input type="text" name="sitename" id="sitename" value="<?php if (isset($globalName)) print $globalName; ?>" />
206
+				<input type="text" name="sitename" id="sitename" value="<?php if (isset($globalName)) {
207
+	print $globalName;
208
+}
209
+?>" />
184 210
 			</p>
185 211
 			<p>
186 212
 				<label for="siteurl">Site directory</label>
187
-				<input type="text" name="siteurl" id="siteurl" value="<?php if (isset($globalURL)) print $globalURL; ?>" />
213
+				<input type="text" name="siteurl" id="siteurl" value="<?php if (isset($globalURL)) {
214
+	print $globalURL;
215
+}
216
+?>" />
188 217
 				<p class="help-block">Can be null. ex : <i>flightairmap</i> if complete URL is <i>http://toto.com/flightairmap</i></p>
189 218
 			</p>
190 219
 			<p>
191 220
 				<label for="timezone">Timezone</label>
192
-				<input type="text" name="timezone" id="timezone" value="<?php if (isset($globalTimezone)) print $globalTimezone; ?>" />
221
+				<input type="text" name="timezone" id="timezone" value="<?php if (isset($globalTimezone)) {
222
+	print $globalTimezone;
223
+}
224
+?>" />
193 225
 				<p class="help-block">ex : UTC, Europe/Paris,...</p>
194 226
 			</p>
195 227
 			<p>
196 228
 				<label for="language">Language</label>
197
-				<input type="text" name="language" id="language" value="<?php if (isset($globalLanguage)) print $globalLanguage; ?>" />
229
+				<input type="text" name="language" id="language" value="<?php if (isset($globalLanguage)) {
230
+	print $globalLanguage;
231
+}
232
+?>" />
198 233
 				<p class="help-block">Used only when link to wikipedia for now. Can be EN,DE,FR,...</p>
199 234
 			</p>
200 235
 		</fieldset>
@@ -215,11 +250,17 @@  discard block
 block discarded – undo
215 250
 			<div id="mapbox_data">
216 251
 				<p>
217 252
 					<label for="mapboxid">Mapbox id</label>
218
-					<input type="text" name="mapboxid" id="mapboxid" value="<?php if (isset($globalMapboxId)) print $globalMapboxId; ?>" />
253
+					<input type="text" name="mapboxid" id="mapboxid" value="<?php if (isset($globalMapboxId)) {
254
+	print $globalMapboxId;
255
+}
256
+?>" />
219 257
 				</p>
220 258
 				<p>
221 259
 					<label for="mapboxtoken">Mapbox token</label>
222
-					<input type="text" name="mapboxtoken" id="mapboxtoken" value="<?php if (isset($globalMapboxToken)) print $globalMapboxToken; ?>" />
260
+					<input type="text" name="mapboxtoken" id="mapboxtoken" value="<?php if (isset($globalMapboxToken)) {
261
+	print $globalMapboxToken;
262
+}
263
+?>" />
223 264
 				</p>
224 265
 				<p class="help-block">Get a key <a href="https://www.mapbox.com/developers/">here</a></p>
225 266
 			</div>
@@ -227,7 +268,10 @@  discard block
 block discarded – undo
227 268
 			<div id="google_data">
228 269
 				<p>
229 270
 					<label for="googlekey">Google API key</label>
230
-					<input type="text" name="googlekey" id="googlekey" value="<?php if (isset($globalGoogleAPIKey)) print $globalGoogleAPIKey; ?>" />
271
+					<input type="text" name="googlekey" id="googlekey" value="<?php if (isset($globalGoogleAPIKey)) {
272
+	print $globalGoogleAPIKey;
273
+}
274
+?>" />
231 275
 					<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>
232 276
 				</p>
233 277
 			</div>
@@ -235,7 +279,10 @@  discard block
 block discarded – undo
235 279
 			<div id="bing_data">
236 280
 				<p>
237 281
 					<label for="bingkey">Bing Map key</label>
238
-					<input type="text" name="bingkey" id="bingkey" value="<?php if (isset($globalBingMapKey)) print $globalBingMapKey; ?>" />
282
+					<input type="text" name="bingkey" id="bingkey" value="<?php if (isset($globalBingMapKey)) {
283
+	print $globalBingMapKey;
284
+}
285
+?>" />
239 286
 					<p class="help-block">Get a key <a href="https://www.bingmapsportal.com/">here</a></p>
240 287
 				</p>
241 288
 			</div>
@@ -243,7 +290,10 @@  discard block
 block discarded – undo
243 290
 			<div id="mapquest_data">
244 291
 				<p>
245 292
 					<label for="mapquestkey">MapQuest key</label>
246
-					<input type="text" name="mapquestkey" id="mapquestkey" value="<?php if (isset($globalMapQuestKey)) print $globalMapQuestKey; ?>" />
293
+					<input type="text" name="mapquestkey" id="mapquestkey" value="<?php if (isset($globalMapQuestKey)) {
294
+	print $globalMapQuestKey;
295
+}
296
+?>" />
247 297
 					<p class="help-block">Get a key <a href="https://developer.mapquest.com/user/me/apps">here</a></p>
248 298
 				</p>
249 299
 			</div>
@@ -251,11 +301,17 @@  discard block
 block discarded – undo
251 301
 			<div id="here_data">
252 302
 				<p>
253 303
 					<label for="hereappid">Here App_Id</label>
254
-					<input type="text" name="hereappid" id="hereappid" value="<?php if (isset($globalHereappId)) print $globalHereappId; ?>" />
304
+					<input type="text" name="hereappid" id="hereappid" value="<?php if (isset($globalHereappId)) {
305
+	print $globalHereappId;
306
+}
307
+?>" />
255 308
 				</p>
256 309
 				<p>
257 310
 					<label for="hereappcode">Here App_Code</label>
258
-					<input type="text" name="hereappcode" id="hereappcode" value="<?php if (isset($globalHereappCode)) print $globalHereappCode; ?>" />
311
+					<input type="text" name="hereappcode" id="hereappcode" value="<?php if (isset($globalHereappCode)) {
312
+	print $globalHereappCode;
313
+}
314
+?>" />
259 315
 				</p>
260 316
 				<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>
261 317
 			</div>
@@ -263,7 +319,10 @@  discard block
 block discarded – undo
263 319
 			<div id="openweathermap_data">
264 320
 				<p>
265 321
 					<label for="openweathermapkey">OpenWeatherMap key (weather layer)</label>
266
-					<input type="text" name="openweathermapkey" id="openweathermapkey" value="<?php if (isset($globalOpenWeatherMapKey)) print $globalOpenWeatherMapKey; ?>" />
322
+					<input type="text" name="openweathermapkey" id="openweathermapkey" value="<?php if (isset($globalOpenWeatherMapKey)) {
323
+	print $globalOpenWeatherMapKey;
324
+}
325
+?>" />
267 326
 					<p class="help-block">Get a key <a href="https://openweathermap.org/">here</a></p>
268 327
 				</p>
269 328
 			</div>
@@ -273,42 +332,86 @@  discard block
 block discarded – undo
273 332
 			<legend>Coverage area</legend>
274 333
 			<p>
275 334
 				<label for="latitudemax">The maximum latitude (north)</label>
276
-				<input type="text" name="latitudemax" id="latitudemax" value="<?php if (isset($globalLatitudeMax)) print $globalLatitudeMax; ?>" />
335
+				<input type="text" name="latitudemax" id="latitudemax" value="<?php if (isset($globalLatitudeMax)) {
336
+	print $globalLatitudeMax;
337
+}
338
+?>" />
277 339
 			</p>
278 340
 			<p>
279 341
 				<label for="latitudemin">The minimum latitude (south)</label>
280
-				<input type="text" name="latitudemin" id="latitudemin" value="<?php if (isset($globalLatitudeMin)) print $globalLatitudeMin; ?>" />
342
+				<input type="text" name="latitudemin" id="latitudemin" value="<?php if (isset($globalLatitudeMin)) {
343
+	print $globalLatitudeMin;
344
+}
345
+?>" />
281 346
 			</p>
282 347
 			<p>
283 348
 				<label for="longitudemax">The maximum longitude (west)</label>
284
-				<input type="text" name="longitudemax" id="longitudemax" value="<?php if (isset($globalLongitudeMax)) print $globalLongitudeMax; ?>" />
349
+				<input type="text" name="longitudemax" id="longitudemax" value="<?php if (isset($globalLongitudeMax)) {
350
+	print $globalLongitudeMax;
351
+}
352
+?>" />
285 353
 			</p>
286 354
 			<p>
287 355
 				<label for="longitudemin">The minimum longitude (east)</label>
288
-				<input type="text" name="longitudemin" id="longitudemin" value="<?php if (isset($globalLongitudeMin)) print $globalLongitudeMin; ?>" />
356
+				<input type="text" name="longitudemin" id="longitudemin" value="<?php if (isset($globalLongitudeMin)) {
357
+	print $globalLongitudeMin;
358
+}
359
+?>" />
289 360
 			</p>
290 361
 			<p>
291 362
 				<label for="latitudecenter">The latitude center</label>
292
-				<input type="text" name="latitudecenter" id="latitudecenter" value="<?php if (isset($globalCenterLatitude)) print $globalCenterLatitude; ?>" />
363
+				<input type="text" name="latitudecenter" id="latitudecenter" value="<?php if (isset($globalCenterLatitude)) {
364
+	print $globalCenterLatitude;
365
+}
366
+?>" />
293 367
 			</p>
294 368
 			<p>
295 369
 				<label for="longitudecenter">The longitude center</label>
296
-				<input type="text" name="longitudecenter" id="longitudecenter" value="<?php if (isset($globalCenterLongitude)) print $globalCenterLongitude; ?>" />
370
+				<input type="text" name="longitudecenter" id="longitudecenter" value="<?php if (isset($globalCenterLongitude)) {
371
+	print $globalCenterLongitude;
372
+}
373
+?>" />
297 374
 			</p>
298 375
 			<p>
299 376
 				<label for="livezoom">Default Zoom on live map</label>
300
-				<input type="number" name="livezoom" id="livezoom" value="<?php if (isset($globalLiveZoom)) print $globalLiveZoom; else print '9'; ?>" />
377
+				<input type="number" name="livezoom" id="livezoom" value="<?php if (isset($globalLiveZoom)) {
378
+	print $globalLiveZoom;
379
+} else {
380
+	print '9';
381
+}
382
+?>" />
301 383
 			</p>
302 384
 			<p>
303 385
 				<label for="squawk_country">Country for squawk usage</label>
304 386
 				<select name="squawk_country" id="squawk_country">
305
-					<option value="UK"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'UK') print ' selected '; ?>>UK</option>
306
-					<option value="NZ"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'NZ') print ' selected '; ?>>NZ</option>
307
-					<option value="US"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'US') print ' selected '; ?>>US</option>
308
-					<option value="AU"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'AU') print ' selected '; ?>>AU</option>
309
-					<option value="NL"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'NL') print ' selected '; ?>>NL</option>
310
-					<option value="FR"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'FR') print ' selected '; ?>>FR</option>
311
-					<option value="TR"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'TR') print ' selected '; ?>>TR</option>
387
+					<option value="UK"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'UK') {
388
+	print ' selected ';
389
+}
390
+?>>UK</option>
391
+					<option value="NZ"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'NZ') {
392
+	print ' selected ';
393
+}
394
+?>>NZ</option>
395
+					<option value="US"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'US') {
396
+	print ' selected ';
397
+}
398
+?>>US</option>
399
+					<option value="AU"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'AU') {
400
+	print ' selected ';
401
+}
402
+?>>AU</option>
403
+					<option value="NL"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'NL') {
404
+	print ' selected ';
405
+}
406
+?>>NL</option>
407
+					<option value="FR"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'FR') {
408
+	print ' selected ';
409
+}
410
+?>>FR</option>
411
+					<option value="TR"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'TR') {
412
+	print ' selected ';
413
+}
414
+?>>TR</option>
312 415
 				</select>
313 416
 			</p>
314 417
 		</fieldset>
@@ -317,15 +420,24 @@  discard block
 block discarded – undo
317 420
 			<p><i>Only put in DB flights that are inside a circle</i></p>
318 421
 			<p>
319 422
 				<label for="latitude">Center latitude</label>
320
-				<input type="text" name="zoilatitude" id="latitude" value="<?php if (isset($globalDistanceIgnore['latitude'])) echo $globalDistanceIgnore['latitude']; ?>" />
423
+				<input type="text" name="zoilatitude" id="latitude" value="<?php if (isset($globalDistanceIgnore['latitude'])) {
424
+	echo $globalDistanceIgnore['latitude'];
425
+}
426
+?>" />
321 427
 			</p>
322 428
 			<p>
323 429
 				<label for="longitude">Center longitude</label>
324
-				<input type="text" name="zoilongitude" id="longitude" value="<?php if (isset($globalDistanceIgnore['longitude'])) echo $globalDistanceIgnore['longitude']; ?>" />
430
+				<input type="text" name="zoilongitude" id="longitude" value="<?php if (isset($globalDistanceIgnore['longitude'])) {
431
+	echo $globalDistanceIgnore['longitude'];
432
+}
433
+?>" />
325 434
 			</p>
326 435
 			<p>
327 436
 				<label for="Distance">Distance (in km)</label>
328
-				<input type="text" name="zoidistance" id="distance" value="<?php if (isset($globalDistanceIgnore['distance'])) echo $globalDistanceIgnore['distance']; ?>" />
437
+				<input type="text" name="zoidistance" id="distance" value="<?php if (isset($globalDistanceIgnore['distance'])) {
438
+	echo $globalDistanceIgnore['distance'];
439
+}
440
+?>" />
329 441
 			</p>
330 442
 		</fieldset>
331 443
 		<fieldset id="sourceloc">
@@ -438,11 +550,17 @@  discard block
 block discarded – undo
438 550
 			<div id="flightaware_data">
439 551
 				<p>
440 552
 					<label for="flightawareusername">FlightAware username</label>
441
-					<input type="text" name="flightawareusername" id="flightawareusername" value="<?php if (isset($globalFlightAwareUsername)) print $globalFlightAwareUsername; ?>" />
553
+					<input type="text" name="flightawareusername" id="flightawareusername" value="<?php if (isset($globalFlightAwareUsername)) {
554
+	print $globalFlightAwareUsername;
555
+}
556
+?>" />
442 557
 				</p>
443 558
 				<p>
444 559
 					<label for="flightawarepassword">FlightAware password/API key</label>
445
-					<input type="text" name="flightawarepassword" id="flightawarepassword" value="<?php if (isset($globalFlightAwarePassword)) print $globalFlightAwarePassword; ?>" />
560
+					<input type="text" name="flightawarepassword" id="flightawarepassword" value="<?php if (isset($globalFlightAwarePassword)) {
561
+	print $globalFlightAwarePassword;
562
+}
563
+?>" />
446 564
 				</p>
447 565
 			</div>
448 566
 -->
@@ -484,7 +602,10 @@  discard block
 block discarded – undo
484 602
 								    if (filter_var($source['host'],FILTER_VALIDATE_URL)) {
485 603
 								?>
486 604
 								<td><input type="text" name="host[]" id="host" value="<?php print $source['host']; ?>" /></td>
487
-								<td><input type="text" name="port[]" class="col-xs-2" id="port" value="<?php if (isset($source['port'])) print $source['port']; ?>" /></td>
605
+								<td><input type="text" name="port[]" class="col-xs-2" id="port" value="<?php if (isset($source['port'])) {
606
+	print $source['port'];
607
+}
608
+?>" /></td>
488 609
 								<?php
489 610
 								    } else {
490 611
 									$hostport = explode(':',$source['host']);
@@ -503,34 +624,106 @@  discard block
 block discarded – undo
503 624
 								?>
504 625
 								<td>
505 626
 									<select name="format[]" id="format">
506
-										<option value="auto" <?php if (!isset($source['format'])) print 'selected'; ?>>Auto</option>
507
-										<option value="sbs" <?php if (isset($source['format']) && $source['format'] == 'sbs') print 'selected'; ?>>SBS</option>
508
-										<option value="tsv" <?php if (isset($source['format']) && $source['format'] == 'tsv') print 'selected'; ?>>TSV</option>
509
-										<option value="raw" <?php if (isset($source['format']) && $source['format'] == 'raw') print 'selected'; ?>>Raw</option>
510
-										<option value="aprs" <?php if (isset($source['format']) && $source['format'] == 'aprs') print 'selected'; ?>>APRS</option>
511
-										<option value="deltadbtxt" <?php if (isset($source['format']) && $source['format'] == 'deltadbtxt') print 'selected'; ?>>Radarcape deltadb.txt</option>
512
-										<option value="vatsimtxt" <?php if (isset($source['format']) && $source['format'] == 'vatsimtxt') print 'selected'; ?>>Vatsim</option>
513
-										<option value="aircraftlistjson" <?php if (isset($source['format']) && $source['format'] == 'aircraftlistjson') print 'selected'; ?>>Virtual Radar Server AircraftList.json</option>
514
-										<option value="vrstcp" <?php if (isset($source['format']) && $source['format'] == 'vrstcp') print 'selected'; ?>>Virtual Radar Server TCP</option>
515
-										<option value="phpvmacars" <?php if (isset($source['format']) && $source['format'] == 'phpvmacars') print 'selected'; ?>>phpVMS</option>
516
-										<option value="vaos" <?php if (isset($source['format']) && $source['format'] == 'phpvmacars') print 'selected'; ?>>Virtual Airline Operations System (VAOS)</option>
517
-										<option value="vam" <?php if (isset($source['format']) && $source['format'] == 'vam') print 'selected'; ?>>Virtual Airlines Manager</option>
518
-										<option value="whazzup" <?php if (isset($source['format']) && $source['format'] == 'whazzup') print 'selected'; ?>>IVAO</option>
519
-										<option value="flightgearmp" <?php if (isset($source['format']) && $source['format'] == 'flightgearmp') print 'selected'; ?>>FlightGear Multiplayer</option>
520
-										<option value="flightgearsp" <?php if (isset($source['format']) && $source['format'] == 'flightgearsp') print 'selected'; ?>>FlightGear Singleplayer</option>
521
-										<option value="acars" <?php if (isset($source['format']) && $source['format'] == 'acars') print 'selected'; ?>>ACARS from acarsdec/acarsdeco2 over UDP</option>
522
-										<option value="acarssbs3" <?php if (isset($source['format']) && $source['format'] == 'acarssbs3') print 'selected'; ?>>ACARS SBS-3 over TCP</option>
523
-										<option value="ais" <?php if (isset($source['format']) && $source['format'] == 'ais') print 'selected'; ?>>NMEA AIS over TCP</option>
524
-										<option value="airwhere" <?php if (isset($source['format']) && $source['format'] == 'airwhere') print 'selected'; ?>>AirWhere website</option>
525
-										<option value="hidnseek_callback" <?php if (isset($source['format']) && $source['format'] == 'hidnseek_callback') print 'selected'; ?>>HidnSeek Callback</option>
526
-										<option value="blitzortung" <?php if (isset($source['format']) && $source['format'] == 'blitzortung') print 'selected'; ?>>Blitzortung</option>
627
+										<option value="auto" <?php if (!isset($source['format'])) {
628
+	print 'selected';
629
+}
630
+?>>Auto</option>
631
+										<option value="sbs" <?php if (isset($source['format']) && $source['format'] == 'sbs') {
632
+	print 'selected';
633
+}
634
+?>>SBS</option>
635
+										<option value="tsv" <?php if (isset($source['format']) && $source['format'] == 'tsv') {
636
+	print 'selected';
637
+}
638
+?>>TSV</option>
639
+										<option value="raw" <?php if (isset($source['format']) && $source['format'] == 'raw') {
640
+	print 'selected';
641
+}
642
+?>>Raw</option>
643
+										<option value="aprs" <?php if (isset($source['format']) && $source['format'] == 'aprs') {
644
+	print 'selected';
645
+}
646
+?>>APRS</option>
647
+										<option value="deltadbtxt" <?php if (isset($source['format']) && $source['format'] == 'deltadbtxt') {
648
+	print 'selected';
649
+}
650
+?>>Radarcape deltadb.txt</option>
651
+										<option value="vatsimtxt" <?php if (isset($source['format']) && $source['format'] == 'vatsimtxt') {
652
+	print 'selected';
653
+}
654
+?>>Vatsim</option>
655
+										<option value="aircraftlistjson" <?php if (isset($source['format']) && $source['format'] == 'aircraftlistjson') {
656
+	print 'selected';
657
+}
658
+?>>Virtual Radar Server AircraftList.json</option>
659
+										<option value="vrstcp" <?php if (isset($source['format']) && $source['format'] == 'vrstcp') {
660
+	print 'selected';
661
+}
662
+?>>Virtual Radar Server TCP</option>
663
+										<option value="phpvmacars" <?php if (isset($source['format']) && $source['format'] == 'phpvmacars') {
664
+	print 'selected';
665
+}
666
+?>>phpVMS</option>
667
+										<option value="vaos" <?php if (isset($source['format']) && $source['format'] == 'phpvmacars') {
668
+	print 'selected';
669
+}
670
+?>>Virtual Airline Operations System (VAOS)</option>
671
+										<option value="vam" <?php if (isset($source['format']) && $source['format'] == 'vam') {
672
+	print 'selected';
673
+}
674
+?>>Virtual Airlines Manager</option>
675
+										<option value="whazzup" <?php if (isset($source['format']) && $source['format'] == 'whazzup') {
676
+	print 'selected';
677
+}
678
+?>>IVAO</option>
679
+										<option value="flightgearmp" <?php if (isset($source['format']) && $source['format'] == 'flightgearmp') {
680
+	print 'selected';
681
+}
682
+?>>FlightGear Multiplayer</option>
683
+										<option value="flightgearsp" <?php if (isset($source['format']) && $source['format'] == 'flightgearsp') {
684
+	print 'selected';
685
+}
686
+?>>FlightGear Singleplayer</option>
687
+										<option value="acars" <?php if (isset($source['format']) && $source['format'] == 'acars') {
688
+	print 'selected';
689
+}
690
+?>>ACARS from acarsdec/acarsdeco2 over UDP</option>
691
+										<option value="acarssbs3" <?php if (isset($source['format']) && $source['format'] == 'acarssbs3') {
692
+	print 'selected';
693
+}
694
+?>>ACARS SBS-3 over TCP</option>
695
+										<option value="ais" <?php if (isset($source['format']) && $source['format'] == 'ais') {
696
+	print 'selected';
697
+}
698
+?>>NMEA AIS over TCP</option>
699
+										<option value="airwhere" <?php if (isset($source['format']) && $source['format'] == 'airwhere') {
700
+	print 'selected';
701
+}
702
+?>>AirWhere website</option>
703
+										<option value="hidnseek_callback" <?php if (isset($source['format']) && $source['format'] == 'hidnseek_callback') {
704
+	print 'selected';
705
+}
706
+?>>HidnSeek Callback</option>
707
+										<option value="blitzortung" <?php if (isset($source['format']) && $source['format'] == 'blitzortung') {
708
+	print 'selected';
709
+}
710
+?>>Blitzortung</option>
527 711
 									</select>
528 712
 								</td>
529 713
 								<td>
530
-									<input type="text" name="name[]" id="name" value="<?php if (isset($source['name'])) print $source['name']; ?>" />
714
+									<input type="text" name="name[]" id="name" value="<?php if (isset($source['name'])) {
715
+	print $source['name'];
716
+}
717
+?>" />
531 718
 								</td>
532
-								<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>
533
-								<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>
719
+								<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']) {
720
+	print 'checked';
721
+}
722
+?> /></td>
723
+								<td><input type="checkbox" name="noarchive[]" id="noarchive" title="Don't archive this source" value="1" <?php if (isset($source['noarchive']) && $source['noarchive']) {
724
+	print 'checked';
725
+}
726
+?> /></td>
534 727
 								<td>
535 728
 									<select name="timezones[]" id="timezones">
536 729
 								<?php
@@ -540,7 +733,9 @@  discard block
 block discarded – undo
540 733
 											print '<option selected>'.$timezones.'</option>';
541 734
 										} elseif (!isset($source['timezone']) && $timezones == 'UTC') {
542 735
 											print '<option selected>'.$timezones.'</option>';
543
-										} else print '<option>'.$timezones.'</option>';
736
+										} else {
737
+											print '<option>'.$timezones.'</option>';
738
+										}
544 739
 									}
545 740
 								?>
546 741
 									</select>
@@ -591,7 +786,9 @@  discard block
 block discarded – undo
591 786
 									foreach($timezonelist as $timezones){
592 787
 										if ($timezones == 'UTC') {
593 788
 											print '<option selected>'.$timezones.'</option>';
594
-										} else print '<option>'.$timezones.'</option>';
789
+										} else {
790
+											print '<option>'.$timezones.'</option>';
791
+										}
595 792
 									}
596 793
 								?>
597 794
 									</select>
@@ -614,11 +811,17 @@  discard block
 block discarded – undo
614 811
 					<p>Listen UDP server for acarsdec/acarsdeco2/... with <i>daemon-acars.php</i> script</p>
615 812
 					<p>
616 813
 						<label for="acarshost">ACARS UDP host</label>
617
-						<input type="text" name="acarshost" id="acarshost" value="<?php if (isset($globalACARSHost)) print $globalACARSHost; ?>" />
814
+						<input type="text" name="acarshost" id="acarshost" value="<?php if (isset($globalACARSHost)) {
815
+	print $globalACARSHost;
816
+}
817
+?>" />
618 818
 					</p>
619 819
 					<p>
620 820
 						<label for="acarsport">ACARS UDP port</label>
621
-						<input type="number" name="acarsport" id="acarsport" value="<?php if (isset($globalACARSPort)) print $globalACARSPort; ?>" />
821
+						<input type="number" name="acarsport" id="acarsport" value="<?php if (isset($globalACARSPort)) {
822
+	print $globalACARSPort;
823
+}
824
+?>" />
622 825
 					</p>
623 826
 				</fieldset>
624 827
 			</div>
@@ -721,13 +924,19 @@  discard block
 block discarded – undo
721 924
 			<div id="schedules_options">
722 925
 				<p>
723 926
 					<label for="britishairways">British Airways API Key</label>
724
-					<input type="text" name="britishairways" id="britishairways" value="<?php if (isset($globalBritishAirwaysKey)) print $globalBritishAirwaysKey; ?>" />
927
+					<input type="text" name="britishairways" id="britishairways" value="<?php if (isset($globalBritishAirwaysKey)) {
928
+	print $globalBritishAirwaysKey;
929
+}
930
+?>" />
725 931
 					<p class="help-block">Register an account on <a href="https://developer.ba.com/">https://developer.ba.com/</a></p>
726 932
 				</p>
727 933
 				<!--
728 934
 				<p>
729 935
 					<label for="transavia">Transavia Test API Consumer Key</label>
730
-					<input type="text" name="transavia" id="transavia" value="<?php if (isset($globalTransaviaKey)) print $globalTransaviaKey; ?>" />
936
+					<input type="text" name="transavia" id="transavia" value="<?php if (isset($globalTransaviaKey)) {
937
+	print $globalTransaviaKey;
938
+}
939
+?>" />
731 940
 					<p class="help-block">Register an account on <a href="https://developer.transavia.com">https://developer.transavia.com</a></p>
732 941
 				</p>
733 942
 				-->
@@ -736,10 +945,16 @@  discard block
 block discarded – undo
736 945
 						<b>Lufthansa API Key</b>
737 946
 						<p>
738 947
 							<label for="lufthansakey">Key</label>
739
-							<input type="text" name="lufthansakey" id="lufthansakey" value="<?php if (isset($globalLufthansaKey['key'])) print $globalLufthansaKey['key']; ?>" />
948
+							<input type="text" name="lufthansakey" id="lufthansakey" value="<?php if (isset($globalLufthansaKey['key'])) {
949
+	print $globalLufthansaKey['key'];
950
+}
951
+?>" />
740 952
 						</p><p>
741 953
 							<label for="lufthansasecret">Secret</label>
742
-							<input type="text" name="lufthansasecret" id="lufthansasecret" value="<?php if (isset($globalLufthansaKey['secret'])) print $globalLufthansaKey['secret']; ?>" />
954
+							<input type="text" name="lufthansasecret" id="lufthansasecret" value="<?php if (isset($globalLufthansaKey['secret'])) {
955
+	print $globalLufthansaKey['secret'];
956
+}
957
+?>" />
743 958
 						</p>
744 959
 					</div>
745 960
 					<p class="help-block">Register an account on <a href="https://developer.lufthansa.com/page">https://developer.lufthansa.com/page</a></p>
@@ -759,7 +974,10 @@  discard block
 block discarded – undo
759 974
 			</p>
760 975
 			<p>
761 976
 				<label for="notamsource">URL of your feed from notaminfo.com</label>
762
-				<input type="text" name="notamsource" id="notamsource" value="<?php if (isset($globalNOTAMSource)) print $globalNOTAMSource; ?>" />
977
+				<input type="text" name="notamsource" id="notamsource" value="<?php if (isset($globalNOTAMSource)) {
978
+	print $globalNOTAMSource;
979
+}
980
+?>" />
763 981
 				<p class="help-block">If you want to use world NOTAM from FlightAirMap website, leave it blank</p>
764 982
 			</p>
765 983
 			<br />
@@ -775,14 +993,20 @@  discard block
 block discarded – undo
775 993
 			<div id="metarsrc">
776 994
 				<p>
777 995
 					<label for="metarsource">URL of your METAR source</label>
778
-					<input type="text" name="metarsource" id="metarsource" value="<?php if (isset($globalMETARurl)) print $globalMETARurl; ?>" />
996
+					<input type="text" name="metarsource" id="metarsource" value="<?php if (isset($globalMETARurl)) {
997
+	print $globalMETARurl;
998
+}
999
+?>" />
779 1000
 					<p class="help-block">Use {icao} to specify where we replace by airport icao. ex : http://metar.vatsim.net/metar.php?id={icao}</p>
780 1001
 				</p>
781 1002
 			</div>
782 1003
 			<br />
783 1004
 			<p>
784 1005
 				<label for="bitly">Bit.ly access token api (used in search page)</label>
785
-				<input type="text" name="bitly" id="bitly" value="<?php if (isset($globalBitlyAccessToken)) print $globalBitlyAccessToken; ?>" />
1006
+				<input type="text" name="bitly" id="bitly" value="<?php if (isset($globalBitlyAccessToken)) {
1007
+	print $globalBitlyAccessToken;
1008
+}
1009
+?>" />
786 1010
 			</p>
787 1011
 			<br />
788 1012
 			<p>
@@ -798,11 +1022,26 @@  discard block
 block discarded – undo
798 1022
 			<p>
799 1023
 				<label for="geoid_source">Geoid Source</label>
800 1024
 				<select name="geoid_source" id="geoid_source">
801
-					<option value="egm96-15"<?php if (isset($globalGeoidSource) && $globalGeoidSource == 'egm96-15') print ' selected="selected"'; ?>>EGM96 15' (2.1MB)</option>
802
-					<option value="egm96-5"<?php if (isset($globalGeoidSource) && $globalGeoidSource == 'egm96-5') print ' selected="selected"'; ?>>EGM96 5' (19MB)</option>
803
-					<option value="egm2008-5"<?php if (isset($globalGeoidSource) && $globalGeoidSource == 'egm2008-5') print ' selected="selected"'; ?>>EGM2008 5' (19MB)</option>
804
-					<option value="egm2008-2_5"<?php if (isset($globalGeoidSource) && $globalGeoidSource == 'egm2008-2_5') print ' selected="selected"'; ?>>EGM2008 2.5' (75MB)</option>
805
-					<option value="egm2008-1"<?php if (isset($globalGeoidSource) && $globalGeoidSource == 'egm2008-1') print ' selected="selected"'; ?>>EGM2008 1' (470MB)</option>
1025
+					<option value="egm96-15"<?php if (isset($globalGeoidSource) && $globalGeoidSource == 'egm96-15') {
1026
+	print ' selected="selected"';
1027
+}
1028
+?>>EGM96 15' (2.1MB)</option>
1029
+					<option value="egm96-5"<?php if (isset($globalGeoidSource) && $globalGeoidSource == 'egm96-5') {
1030
+	print ' selected="selected"';
1031
+}
1032
+?>>EGM96 5' (19MB)</option>
1033
+					<option value="egm2008-5"<?php if (isset($globalGeoidSource) && $globalGeoidSource == 'egm2008-5') {
1034
+	print ' selected="selected"';
1035
+}
1036
+?>>EGM2008 5' (19MB)</option>
1037
+					<option value="egm2008-2_5"<?php if (isset($globalGeoidSource) && $globalGeoidSource == 'egm2008-2_5') {
1038
+	print ' selected="selected"';
1039
+}
1040
+?>>EGM2008 2.5' (75MB)</option>
1041
+					<option value="egm2008-1"<?php if (isset($globalGeoidSource) && $globalGeoidSource == 'egm2008-1') {
1042
+	print ' selected="selected"';
1043
+}
1044
+?>>EGM2008 1' (470MB)</option>
806 1045
 				</select>
807 1046
 				<p class="help-block">The geoid is approximated by an "earth gravity model" (EGM).</p>
808 1047
 			</p>
@@ -824,7 +1063,12 @@  discard block
 block discarded – undo
824 1063
 			</p>
825 1064
 			<p>
826 1065
 				<label for="archivemonths">Generate statistics, delete or put in archive flights older than xx months</label>
827
-				<input type="number" name="archivemonths" id="archivemonths" value="<?php if (isset($globalArchiveMonths)) print $globalArchiveMonths; else echo '1'; ?>" />
1066
+				<input type="number" name="archivemonths" id="archivemonths" value="<?php if (isset($globalArchiveMonths)) {
1067
+	print $globalArchiveMonths;
1068
+} else {
1069
+	echo '1';
1070
+}
1071
+?>" />
828 1072
 				<p class="help-block">0 to disable, delete old flight if <i>Archive all flights data</i> is disabled</p>
829 1073
 			</p>
830 1074
 			<p>
@@ -834,12 +1078,22 @@  discard block
 block discarded – undo
834 1078
 			</p>
835 1079
 			<p>
836 1080
 				<label for="archivekeepmonths">Keep flights data for xx months in archive</label>
837
-				<input type="number" name="archivekeepmonths" id="archivekeepmonths" value="<?php if (isset($globalArchiveKeepMonths)) print $globalArchiveKeepMonths; else echo '1'; ?>" />
1081
+				<input type="number" name="archivekeepmonths" id="archivekeepmonths" value="<?php if (isset($globalArchiveKeepMonths)) {
1082
+	print $globalArchiveKeepMonths;
1083
+} else {
1084
+	echo '1';
1085
+}
1086
+?>" />
838 1087
 				<p class="help-block">0 to disable</p>
839 1088
 			</p>
840 1089
 			<p>
841 1090
 				<label for="archivekeeptrackmonths">Keep flights track data for xx months in archive</label>
842
-				<input type="number" name="archivekeeptrackmonths" id="archivekeeptrackmonths" value="<?php if (isset($globalArchiveKeepTrackMonths)) print $globalArchiveKeepTrackMonths; else echo '1'; ?>" />
1091
+				<input type="number" name="archivekeeptrackmonths" id="archivekeeptrackmonths" value="<?php if (isset($globalArchiveKeepTrackMonths)) {
1092
+	print $globalArchiveKeepTrackMonths;
1093
+} else {
1094
+	echo '1';
1095
+}
1096
+?>" />
843 1097
 				<p class="help-block">0 to disable, should be less or egal to <i>Keep flights data</i> value</p>
844 1098
 			</p>
845 1099
 			<br />
@@ -849,7 +1103,12 @@  discard block
 block discarded – undo
849 1103
 				<p class="help-block">Uncheck if the script is running as cron job</p>
850 1104
 				<div id="cronends"> 
851 1105
 					<label for="cronend">Run script for xx seconds</label>
852
-					<input type="number" name="cronend" id="cronend" value="<?php if (isset($globalCronEnd)) print $globalCronEnd; else print '0'; ?>" />
1106
+					<input type="number" name="cronend" id="cronend" value="<?php if (isset($globalCronEnd)) {
1107
+	print $globalCronEnd;
1108
+} else {
1109
+	print '0';
1110
+}
1111
+?>" />
853 1112
 					<p class="help-block">Set to 0 to disable. Should be disabled if source is URL.</p>
854 1113
 				</div>
855 1114
 			</p>
@@ -902,15 +1161,30 @@  discard block
 block discarded – undo
902 1161
 			<br />
903 1162
 			<p>
904 1163
 				<label for="refresh">Show flights detected since xxx seconds</label>
905
-				<input type="number" name="refresh" id="refresh" value="<?php if (isset($globalLiveInterval)) echo $globalLiveInterval; else echo '200'; ?>" />
1164
+				<input type="number" name="refresh" id="refresh" value="<?php if (isset($globalLiveInterval)) {
1165
+	echo $globalLiveInterval;
1166
+} else {
1167
+	echo '200';
1168
+}
1169
+?>" />
906 1170
 			</p>
907 1171
 			<p>
908 1172
 				<label for="maprefresh">Live map refresh (in seconds)</label>
909
-				<input type="number" name="maprefresh" id="maprefresh" value="<?php if (isset($globalMapRefresh)) echo $globalMapRefresh; else echo '30'; ?>" />
1173
+				<input type="number" name="maprefresh" id="maprefresh" value="<?php if (isset($globalMapRefresh)) {
1174
+	echo $globalMapRefresh;
1175
+} else {
1176
+	echo '30';
1177
+}
1178
+?>" />
910 1179
 			</p>
911 1180
 			<p>
912 1181
 				<label for="mapidle">Map idle timeout (in minutes)</label>
913
-				<input type="number" name="mapidle" id="mapidle" value="<?php if (isset($globalMapIdleTimeout)) echo $globalMapIdleTimeout; else echo '30'; ?>" />
1182
+				<input type="number" name="mapidle" id="mapidle" value="<?php if (isset($globalMapIdleTimeout)) {
1183
+	echo $globalMapIdleTimeout;
1184
+} else {
1185
+	echo '30';
1186
+}
1187
+?>" />
914 1188
 				<p class="help-block">0 to disable</p>
915 1189
 			</p>
916 1190
 			<p>
@@ -925,12 +1199,20 @@  discard block
 block discarded – undo
925 1199
 			<br />
926 1200
 			<p>
927 1201
 				<label for="closestmindist">Distance to airport set as arrival (in km)</label>
928
-				<input type="number" name="closestmindist" id="closestmindist" value="<?php if (isset($globalClosestMinDist)) echo $globalClosestMinDist; else echo '50'; ?>" />
1202
+				<input type="number" name="closestmindist" id="closestmindist" value="<?php if (isset($globalClosestMinDist)) {
1203
+	echo $globalClosestMinDist;
1204
+} else {
1205
+	echo '50';
1206
+}
1207
+?>" />
929 1208
 			</p>
930 1209
 			<br />
931 1210
 			<p>
932 1211
 				<label for="aircraftsize">Size of aircraft icon on map (default to 30px if zoom > 7 else 15px), empty to default</label>
933
-				<input type="number" name="aircraftsize" id="aircraftsize" value="<?php if (isset($globalAircraftSize)) echo $globalAircraftSize;?>" />
1212
+				<input type="number" name="aircraftsize" id="aircraftsize" value="<?php if (isset($globalAircraftSize)) {
1213
+	echo $globalAircraftSize;
1214
+}
1215
+?>" />
934 1216
 			</p>
935 1217
 			<br />
936 1218
 			<p>
@@ -943,7 +1225,12 @@  discard block
 block discarded – undo
943 1225
 			    if (extension_loaded('gd') && function_exists('gd_info')) {
944 1226
 			?>
945 1227
 				<label for="aircrafticoncolor">Color of aircraft icon on map</label>
946
-				<input type="color" name="aircrafticoncolor" id="aircrafticoncolor" value="#<?php if (isset($globalAircraftIconColor)) echo $globalAircraftIconColor; else echo '1a3151'; ?>" />
1228
+				<input type="color" name="aircrafticoncolor" id="aircrafticoncolor" value="#<?php if (isset($globalAircraftIconColor)) {
1229
+	echo $globalAircraftIconColor;
1230
+} else {
1231
+	echo '1a3151';
1232
+}
1233
+?>" />
947 1234
 			<?php
948 1235
 				if (!is_writable('../cache')) {
949 1236
 			?>
@@ -961,14 +1248,27 @@  discard block
 block discarded – undo
961 1248
 			<p>
962 1249
 				<label for="airportzoom">Zoom level minimum to see airports icons</label>
963 1250
 				<div class="range">
964
-					<input type="range" name="airportzoom" id="airportzoom" value="<?php if (isset($globalAirportZoom)) echo $globalAirportZoom; else echo '7'; ?>" />
965
-					<output id="range"><?php if (isset($globalAirportZoom)) echo $globalAirportZoom; else echo '7'; ?></output>
1251
+					<input type="range" name="airportzoom" id="airportzoom" value="<?php if (isset($globalAirportZoom)) {
1252
+	echo $globalAirportZoom;
1253
+} else {
1254
+	echo '7';
1255
+}
1256
+?>" />
1257
+					<output id="range"><?php if (isset($globalAirportZoom)) {
1258
+	echo $globalAirportZoom;
1259
+} else {
1260
+	echo '7';
1261
+}
1262
+?></output>
966 1263
 				</div>
967 1264
 			</p>
968 1265
 			<br />
969 1266
 			<p>
970 1267
 				<label for="customcss">Custom CSS web path</label>
971
-				<input type="text" name="customcss" id="customcss" value="<?php if (isset($globalCustomCSS)) echo $globalCustomCSS; ?>" />
1268
+				<input type="text" name="customcss" id="customcss" value="<?php if (isset($globalCustomCSS)) {
1269
+	echo $globalCustomCSS;
1270
+}
1271
+?>" />
972 1272
 			</p>
973 1273
 		</fieldset>
974 1274
 		<input type="submit" name="submit" value="Create/Update database & write setup" />
@@ -995,8 +1295,12 @@  discard block
 block discarded – undo
995 1295
 	$dbhost = filter_input(INPUT_POST,'dbhost',FILTER_SANITIZE_STRING);
996 1296
 	$dbport = filter_input(INPUT_POST,'dbport',FILTER_SANITIZE_STRING);
997 1297
 
998
-	if ($dbtype == 'mysql' && !extension_loaded('pdo_mysql')) $error .= 'Mysql driver for PDO must be loaded';
999
-	if ($dbtype == 'pgsql' && !extension_loaded('pdo_pgsql')) $error .= 'PosgreSQL driver for PDO must be loaded';
1298
+	if ($dbtype == 'mysql' && !extension_loaded('pdo_mysql')) {
1299
+		$error .= 'Mysql driver for PDO must be loaded';
1300
+	}
1301
+	if ($dbtype == 'pgsql' && !extension_loaded('pdo_pgsql')) {
1302
+		$error .= 'PosgreSQL driver for PDO must be loaded';
1303
+	}
1000 1304
 	
1001 1305
 	$_SESSION['database_root'] = $dbroot;
1002 1306
 	$_SESSION['database_rootpass'] = $dbrootpass;
@@ -1064,15 +1368,23 @@  discard block
 block discarded – undo
1064 1368
 	$source_city = $_POST['source_city'];
1065 1369
 	$source_country = $_POST['source_country'];
1066 1370
 	$source_ref = $_POST['source_ref'];
1067
-	if (isset($source_id)) $source_id = $_POST['source_id'];
1068
-	else $source_id = array();
1371
+	if (isset($source_id)) {
1372
+		$source_id = $_POST['source_id'];
1373
+	} else {
1374
+		$source_id = array();
1375
+	}
1069 1376
 	
1070 1377
 	$sources = array();
1071 1378
 	foreach ($source_name as $keys => $name) {
1072
-	    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]);
1073
-	    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]);
1379
+	    if (isset($source_id[$keys])) {
1380
+	    	$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]);
1381
+	    } else {
1382
+	    	$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]);
1383
+	    }
1384
+	}
1385
+	if (count($sources) > 0) {
1386
+		$_SESSION['sources'] = $sources;
1074 1387
 	}
1075
-	if (count($sources) > 0) $_SESSION['sources'] = $sources;
1076 1388
 
1077 1389
 	//$sbshost = filter_input(INPUT_POST,'sbshost',FILTER_SANITIZE_STRING);
1078 1390
 	//$sbsport = filter_input(INPUT_POST,'sbsport',FILTER_SANITIZE_NUMBER_INT);
@@ -1093,17 +1405,29 @@  discard block
 block discarded – undo
1093 1405
 	$datasource = filter_input(INPUT_POST,'datasource',FILTER_SANITIZE_STRING);
1094 1406
 
1095 1407
 	$globalaircraft = filter_input(INPUT_POST,'globalaircraft',FILTER_SANITIZE_STRING);
1096
-	if ($globalaircraft == 'aircraft') $settings = array_merge($settings,array('globalAircraft' => 'TRUE'));
1097
-	else $settings = array_merge($settings,array('globalAircraft' => 'FALSE'));
1408
+	if ($globalaircraft == 'aircraft') {
1409
+		$settings = array_merge($settings,array('globalAircraft' => 'TRUE'));
1410
+	} else {
1411
+		$settings = array_merge($settings,array('globalAircraft' => 'FALSE'));
1412
+	}
1098 1413
 	$globaltracker = filter_input(INPUT_POST,'globaltracker',FILTER_SANITIZE_STRING);
1099
-	if ($globaltracker == 'tracker') $settings = array_merge($settings,array('globalTracker' => 'TRUE'));
1100
-	else $settings = array_merge($settings,array('globalTracker' => 'FALSE'));
1414
+	if ($globaltracker == 'tracker') {
1415
+		$settings = array_merge($settings,array('globalTracker' => 'TRUE'));
1416
+	} else {
1417
+		$settings = array_merge($settings,array('globalTracker' => 'FALSE'));
1418
+	}
1101 1419
 	$globalmarine = filter_input(INPUT_POST,'globalmarine',FILTER_SANITIZE_STRING);
1102
-	if ($globalmarine == 'marine') $settings = array_merge($settings,array('globalMarine' => 'TRUE'));
1103
-	else $settings = array_merge($settings,array('globalMarine' => 'FALSE'));
1420
+	if ($globalmarine == 'marine') {
1421
+		$settings = array_merge($settings,array('globalMarine' => 'TRUE'));
1422
+	} else {
1423
+		$settings = array_merge($settings,array('globalMarine' => 'FALSE'));
1424
+	}
1104 1425
 	$globalsatellite = filter_input(INPUT_POST,'globalsatellite',FILTER_SANITIZE_STRING);
1105
-	if ($globalsatellite == 'satellite') $settings = array_merge($settings,array('globalSatellite' => 'TRUE'));
1106
-	else $settings = array_merge($settings,array('globalSatellite' => 'FALSE'));
1426
+	if ($globalsatellite == 'satellite') {
1427
+		$settings = array_merge($settings,array('globalSatellite' => 'TRUE'));
1428
+	} else {
1429
+		$settings = array_merge($settings,array('globalSatellite' => 'FALSE'));
1430
+	}
1107 1431
 
1108 1432
 /*	
1109 1433
 	$globalSBS1Hosts = array();
@@ -1125,23 +1449,37 @@  discard block
 block discarded – undo
1125 1449
 	$name = $_POST['name'];
1126 1450
 	$format = $_POST['format'];
1127 1451
 	$timezones = $_POST['timezones'];
1128
-	if (isset($_POST['sourcestats'])) $sourcestats = $_POST['sourcestats'];
1129
-	else $sourcestats = array();
1130
-	if (isset($_POST['noarchive'])) $noarchive = $_POST['noarchive'];
1131
-	else $noarchive = array();
1452
+	if (isset($_POST['sourcestats'])) {
1453
+		$sourcestats = $_POST['sourcestats'];
1454
+	} else {
1455
+		$sourcestats = array();
1456
+	}
1457
+	if (isset($_POST['noarchive'])) {
1458
+		$noarchive = $_POST['noarchive'];
1459
+	} else {
1460
+		$noarchive = array();
1461
+	}
1132 1462
 	$gSources = array();
1133 1463
 	$forcepilots = false;
1134 1464
 	foreach ($host as $key => $h) {
1135
-		if (isset($sourcestats[$key]) && $sourcestats[$key] == 1) $cov = 'TRUE';
1136
-		else $cov = 'FALSE';
1137
-		if (isset($noarchive[$key]) && $noarchive[$key] == 1) $arch = 'TRUE';
1138
-		else $arch = 'FALSE';
1465
+		if (isset($sourcestats[$key]) && $sourcestats[$key] == 1) {
1466
+			$cov = 'TRUE';
1467
+		} else {
1468
+			$cov = 'FALSE';
1469
+		}
1470
+		if (isset($noarchive[$key]) && $noarchive[$key] == 1) {
1471
+			$arch = 'TRUE';
1472
+		} else {
1473
+			$arch = 'FALSE';
1474
+		}
1139 1475
 		if (strpos($format[$key],'_callback')) {
1140 1476
 			$gSources[] = array('host' => $h, 'pass' => $port[$key],'name' => $name[$key],'format' => $format[$key],'sourcestats' => $cov,'noarchive' => $arch,'timezone' => $timezones[$key],'callback' => 'TRUE');
1141 1477
 		} elseif ($h != '' || $name[$key] != '') {
1142 1478
 			$gSources[] = array('host' => $h, 'port' => $port[$key],'name' => $name[$key],'format' => $format[$key],'sourcestats' => $cov,'noarchive' => $arch,'timezone' => $timezones[$key],'callback' => 'FALSE');
1143 1479
 		}
1144
-		if ($format[$key] == 'airwhere') $forcepilots = true;
1480
+		if ($format[$key] == 'airwhere') {
1481
+			$forcepilots = true;
1482
+		}
1145 1483
 	}
1146 1484
 	$settings = array_merge($settings,array('globalSources' => $gSources));
1147 1485
 
@@ -1172,7 +1510,9 @@  discard block
 block discarded – undo
1172 1510
 	$zoidistance = filter_input(INPUT_POST,'zoidistance',FILTER_SANITIZE_NUMBER_INT);
1173 1511
 	if ($zoilatitude != '' && $zoilongitude != '' && $zoidistance != '') {
1174 1512
 		$settings = array_merge($settings,array('globalDistanceIgnore' => array('latitude' => $zoilatitude,'longitude' => $zoilongitude,'distance' => $zoidistance)));
1175
-	} else $settings = array_merge($settings,array('globalDistanceIgnore' => array()));
1513
+	} else {
1514
+		$settings = array_merge($settings,array('globalDistanceIgnore' => array()));
1515
+	}
1176 1516
 
1177 1517
 	$refresh = filter_input(INPUT_POST,'refresh',FILTER_SANITIZE_NUMBER_INT);
1178 1518
 	$settings = array_merge($settings,array('globalLiveInterval' => $refresh));
@@ -1211,7 +1551,9 @@  discard block
 block discarded – undo
1211 1551
 
1212 1552
 	// Create in settings.php keys not yet configurable if not already here
1213 1553
 	//if (!isset($globalImageBingKey)) $settings = array_merge($settings,array('globalImageBingKey' => ''));
1214
-	if (!isset($globalDebug)) $settings = array_merge($settings,array('globalDebug' => 'TRUE'));
1554
+	if (!isset($globalDebug)) {
1555
+		$settings = array_merge($settings,array('globalDebug' => 'TRUE'));
1556
+	}
1215 1557
 
1216 1558
 	$resetyearstats = filter_input(INPUT_POST,'resetyearstats',FILTER_SANITIZE_STRING);
1217 1559
 	if ($resetyearstats == 'resetyearstats') {
@@ -1254,37 +1596,56 @@  discard block
 block discarded – undo
1254 1596
 	}
1255 1597
 */
1256 1598
 	$settings = array_merge($settings,array('globalFlightAware' => 'FALSE'));
1257
-	if ($globalsbs == 'sbs') $settings = array_merge($settings,array('globalSBS1' => 'TRUE'));
1258
-	else $settings = array_merge($settings,array('globalSBS1' => 'FALSE'));
1259
-	if ($globalaprs == 'aprs') $settings = array_merge($settings,array('globalAPRS' => 'TRUE'));
1260
-	else $settings = array_merge($settings,array('globalAPRS' => 'FALSE'));
1599
+	if ($globalsbs == 'sbs') {
1600
+		$settings = array_merge($settings,array('globalSBS1' => 'TRUE'));
1601
+	} else {
1602
+		$settings = array_merge($settings,array('globalSBS1' => 'FALSE'));
1603
+	}
1604
+	if ($globalaprs == 'aprs') {
1605
+		$settings = array_merge($settings,array('globalAPRS' => 'TRUE'));
1606
+	} else {
1607
+		$settings = array_merge($settings,array('globalAPRS' => 'FALSE'));
1608
+	}
1261 1609
 	$va = false;
1262 1610
 	if ($globalivao == 'ivao') {
1263 1611
 		$settings = array_merge($settings,array('globalIVAO' => 'TRUE'));
1264 1612
 		$va = true;
1265
-	} else $settings = array_merge($settings,array('globalIVAO' => 'FALSE'));
1613
+	} else {
1614
+		$settings = array_merge($settings,array('globalIVAO' => 'FALSE'));
1615
+	}
1266 1616
 	if ($globalvatsim == 'vatsim') {
1267 1617
 		$settings = array_merge($settings,array('globalVATSIM' => 'TRUE'));
1268 1618
 		$va = true;
1269
-	} else $settings = array_merge($settings,array('globalVATSIM' => 'FALSE'));
1619
+	} else {
1620
+		$settings = array_merge($settings,array('globalVATSIM' => 'FALSE'));
1621
+	}
1270 1622
 	if ($globalphpvms == 'phpvms') {
1271 1623
 		$settings = array_merge($settings,array('globalphpVMS' => 'TRUE'));
1272 1624
 		$va = true;
1273
-	} else $settings = array_merge($settings,array('globalphpVMS' => 'FALSE'));
1625
+	} else {
1626
+		$settings = array_merge($settings,array('globalphpVMS' => 'FALSE'));
1627
+	}
1274 1628
 	if ($globalvam == 'vam') {
1275 1629
 		$settings = array_merge($settings,array('globalVAM' => 'TRUE'));
1276 1630
 		$va = true;
1277
-	} else $settings = array_merge($settings,array('globalVAM' => 'FALSE'));
1631
+	} else {
1632
+		$settings = array_merge($settings,array('globalVAM' => 'FALSE'));
1633
+	}
1278 1634
 	if ($va) {
1279 1635
 		$settings = array_merge($settings,array('globalSchedulesFetch' => 'FALSE','globalTranslationFetch' => 'FALSE'));
1280
-	} else $settings = array_merge($settings,array('globalSchedulesFetch' => 'TRUE','globalTranslationFetch' => 'TRUE'));
1636
+	} else {
1637
+		$settings = array_merge($settings,array('globalSchedulesFetch' => 'TRUE','globalTranslationFetch' => 'TRUE'));
1638
+	}
1281 1639
 	if ($globalva == 'va' || $va) {
1282 1640
 		$settings = array_merge($settings,array('globalVA' => 'TRUE'));
1283 1641
 		$settings = array_merge($settings,array('globalUsePilot' => 'TRUE','globalUseOwner' => 'FALSE'));
1284 1642
 	} else {
1285 1643
 		$settings = array_merge($settings,array('globalVA' => 'FALSE'));
1286
-		if ($forcepilots) $settings = array_merge($settings,array('globalUsePilot' => 'TRUE','globalUseOwner' => 'FALSE'));
1287
-		else $settings = array_merge($settings,array('globalUsePilot' => 'FALSE','globalUseOwner' => 'TRUE'));
1644
+		if ($forcepilots) {
1645
+			$settings = array_merge($settings,array('globalUsePilot' => 'TRUE','globalUseOwner' => 'FALSE'));
1646
+		} else {
1647
+			$settings = array_merge($settings,array('globalUsePilot' => 'FALSE','globalUseOwner' => 'TRUE'));
1648
+		}
1288 1649
 	}
1289 1650
 	
1290 1651
 	
@@ -1478,7 +1839,9 @@  discard block
 block discarded – undo
1478 1839
 		$settings = array_merge($settings,array('globalNoAirlines' => 'FALSE'));
1479 1840
 	}
1480 1841
 
1481
-	if (!isset($globalTransaction)) $settings = array_merge($settings,array('globalTransaction' => 'TRUE'));
1842
+	if (!isset($globalTransaction)) {
1843
+		$settings = array_merge($settings,array('globalTransaction' => 'TRUE'));
1844
+	}
1482 1845
 
1483 1846
 	// Set some defaults values...
1484 1847
 	if (!isset($globalAircraftImageSources)) {
@@ -1493,15 +1856,23 @@  discard block
 block discarded – undo
1493 1856
 
1494 1857
 	$settings = array_merge($settings,array('globalInstalled' => 'TRUE'));
1495 1858
 
1496
-	if ($error == '') settings::modify_settings($settings);
1497
-	if ($error == '') settings::comment_settings($settings_comment);
1859
+	if ($error == '') {
1860
+		settings::modify_settings($settings);
1861
+	}
1862
+	if ($error == '') {
1863
+		settings::comment_settings($settings_comment);
1864
+	}
1498 1865
 	if ($error != '') {
1499 1866
 		print '<div class="info column">'.$error.'</div>';
1500 1867
 		require('../footer.php');
1501 1868
 		exit;
1502 1869
 	} else {
1503
-		if (isset($_POST['waypoints']) && $_POST['waypoints'] == 'waypoints') $_SESSION['waypoints'] = 1;
1504
-		if (isset($_POST['owner']) && $_POST['owner'] == 'owner') $_SESSION['owner'] = 1;
1870
+		if (isset($_POST['waypoints']) && $_POST['waypoints'] == 'waypoints') {
1871
+			$_SESSION['waypoints'] = 1;
1872
+		}
1873
+		if (isset($_POST['owner']) && $_POST['owner'] == 'owner') {
1874
+			$_SESSION['owner'] = 1;
1875
+		}
1505 1876
 		if (isset($_POST['createdb'])) {
1506 1877
 			$_SESSION['install'] = 'database_create';
1507 1878
 		} else {
@@ -1538,10 +1909,18 @@  discard block
 block discarded – undo
1538 1909
 	$popw = false;
1539 1910
 	foreach ($_SESSION['done'] as $done) {
1540 1911
 	    print '<li>'.$done.'....<strong>SUCCESS</strong></li>';
1541
-	    if ($done == 'Create database') $pop = true;
1542
-	    if ($_SESSION['install'] == 'database_create') $pop = true;
1543
-	    if ($_SESSION['install'] == 'database_import') $popi = true;
1544
-	    if ($_SESSION['install'] == 'waypoints') $popw = true;
1912
+	    if ($done == 'Create database') {
1913
+	    	$pop = true;
1914
+	    }
1915
+	    if ($_SESSION['install'] == 'database_create') {
1916
+	    	$pop = true;
1917
+	    }
1918
+	    if ($_SESSION['install'] == 'database_import') {
1919
+	    	$popi = true;
1920
+	    }
1921
+	    if ($_SESSION['install'] == 'waypoints') {
1922
+	    	$popw = true;
1923
+	    }
1545 1924
 	}
1546 1925
 	if ($pop) {
1547 1926
 	    sleep(5);
@@ -1552,7 +1931,9 @@  discard block
 block discarded – undo
1552 1931
 	} else if ($popw) {
1553 1932
 	    sleep(5);
1554 1933
 	    print '<li>Populate waypoints database....<img src="../images/loading.gif" /></li>';
1555
-	} else print '<li>Update schema if needed....<img src="../images/loading.gif" /></li>';
1934
+	} else {
1935
+		print '<li>Update schema if needed....<img src="../images/loading.gif" /></li>';
1936
+	}
1556 1937
 	print '</div></ul>';
1557 1938
 	print '<div id="error"></div>';
1558 1939
 /*	foreach ($_SESSION['done'] as $done) {
Please login to merge, or discard this patch.
airline-statistics-registration.php 1 patch
Braces   +7 added lines, -4 removed lines patch added patch discarded remove patch
@@ -43,7 +43,9 @@  discard block
 block discarded – undo
43 43
 	}
44 44
 	$Stats = new Stats($Spotter->db);
45 45
 	$airline_names = $Stats->getAllAirlineNames();
46
-	if (empty($airline_names)) $airline_names = $Spotter->getAllAirlineNames();
46
+	if (empty($airline_names)) {
47
+		$airline_names = $Spotter->getAllAirlineNames();
48
+	}
47 49
 	foreach($airline_names as $airline_name)
48 50
 	{
49 51
 		if($airline == $airline_name['airline_icao'])
@@ -66,8 +68,7 @@  discard block
 block discarded – undo
66 68
 			if ($globalIVAO && @getimagesize($globalURL.'/images/airlines/'.$spotter_array[0]['airline_icao'].'.gif'))
67 69
 			{
68 70
 				print '<img src="'.$globalURL.'/images/airlines/'.$spotter_array[0]['airline_icao'].'.gif" alt="'.$spotter_array[0]['airline_name'].' ('.$spotter_array[0]['airline_icao'].')" title="'.$spotter_array[0]['airline_name'].' ('.$spotter_array[0]['airline_icao'].')" class="logo" />';
69
-			}
70
-			elseif (@getimagesize($globalURL.'/images/airlines/'.$spotter_array[0]['airline_icao'].'.png'))
71
+			} elseif (@getimagesize($globalURL.'/images/airlines/'.$spotter_array[0]['airline_icao'].'.png'))
71 72
 			{
72 73
 				print '<img src="'.$globalURL.'/images/airlines/'.$spotter_array[0]['airline_icao'].'.png" alt="'.$spotter_array[0]['airline_name'].' ('.$spotter_array[0]['airline_icao'].')" title="'.$spotter_array[0]['airline_name'].' ('.$spotter_array[0]['airline_icao'].')" class="logo" />';
73 74
 			}
@@ -131,7 +132,9 @@  discard block
 block discarded – undo
131 132
 				$images = $Image->getSpotterImage($aircraft_item['registration']);
132 133
 				if (isset($images['image_thumbnail'])) {
133 134
 					$aircraft_item['image_thumbnail'] = $images['image_thumbnail'];
134
-				} else $aircraft_item['image_thumbnail'] = '';
135
+				} else {
136
+					$aircraft_item['image_thumbnail'] = '';
137
+				}
135 138
 			}
136 139
 			if ($aircraft_item['image_thumbnail'] != "")
137 140
 			{
Please login to merge, or discard this patch.
require/class.Image.php 1 patch
Braces   +220 added lines, -81 removed lines patch added patch discarded remove patch
@@ -9,7 +9,9 @@  discard block
 block discarded – undo
9 9
 	public function __construct($dbc = null) {
10 10
 		$Connection = new Connection($dbc);
11 11
 		$this->db = $Connection->db();
12
-		if ($this->db === null) die('Error: No DB connection. (Image)');
12
+		if ($this->db === null) {
13
+			die('Error: No DB connection. (Image)');
14
+		}
13 15
 	}
14 16
 
15 17
 	/**
@@ -24,7 +26,9 @@  discard block
 block discarded – undo
24 26
 		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
25 27
 		$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
26 28
 		$reg = $registration;
27
-		if (($reg == '' || $reg == 'NA') && $aircraft_icao != '') $reg = $aircraft_icao.$airline_icao;
29
+		if (($reg == '' || $reg == 'NA') && $aircraft_icao != '') {
30
+			$reg = $aircraft_icao.$airline_icao;
31
+		}
28 32
 		$reg = trim($reg);
29 33
 		$query  = "SELECT spotter_image.image, spotter_image.image_thumbnail, spotter_image.image_source, spotter_image.image_source_website,spotter_image.image_copyright, spotter_image.registration 
30 34
 			FROM spotter_image 
@@ -32,9 +36,13 @@  discard block
 block discarded – undo
32 36
 		$sth = $this->db->prepare($query);
33 37
 		$sth->execute(array(':registration' => $reg));
34 38
 		$result = $sth->fetchAll(PDO::FETCH_ASSOC);
35
-		if (!empty($result)) return $result;
36
-		elseif ($registration != '' && ($aircraft_icao != '' || $airline_icao != '')) return $this->getSpotterImage('',$aircraft_icao,$airline_icao);
37
-		else return array();
39
+		if (!empty($result)) {
40
+			return $result;
41
+		} elseif ($registration != '' && ($aircraft_icao != '' || $airline_icao != '')) {
42
+			return $this->getSpotterImage('',$aircraft_icao,$airline_icao);
43
+		} else {
44
+			return array();
45
+		}
38 46
 	}
39 47
 
40 48
 	/**
@@ -77,8 +85,11 @@  discard block
 block discarded – undo
77 85
 	public function getExifCopyright($url) {
78 86
 		$exif = exif_read_data($url);
79 87
 		$copyright = '';
80
-		if (isset($exif['COMPUTED']['copyright'])) $copyright = $exif['COMPUTED']['copyright'];
81
-		elseif (isset($exif['copyright'])) $copyright = $exif['copyright'];
88
+		if (isset($exif['COMPUTED']['copyright'])) {
89
+			$copyright = $exif['COMPUTED']['copyright'];
90
+		} elseif (isset($exif['copyright'])) {
91
+			$copyright = $exif['copyright'];
92
+		}
82 93
 		if ($copyright != '') {
83 94
 			$copyright = str_replace('Copyright ','',$copyright);
84 95
 			$copyright = str_replace('© ','',$copyright);
@@ -96,17 +107,27 @@  discard block
 block discarded – undo
96 107
 	public function addSpotterImage($registration,$aircraft_icao = '', $airline_icao = '')
97 108
 	{
98 109
 		global $globalDebug,$globalAircraftImageFetch;
99
-		if (isset($globalAircraftImageFetch) && !$globalAircraftImageFetch) return '';
110
+		if (isset($globalAircraftImageFetch) && !$globalAircraftImageFetch) {
111
+			return '';
112
+		}
100 113
 		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
101 114
 		$registration = trim($registration);
102 115
 		//getting the aircraft image
103
-		if ($globalDebug && $registration != '') echo 'Try to find an aircraft image for '.$registration.'...';
104
-		elseif ($globalDebug && $aircraft_icao != '') echo 'Try to find an aircraft image for '.$aircraft_icao.'...';
105
-		elseif ($globalDebug && $airline_icao != '') echo 'Try to find an aircraft image for '.$airline_icao.'...';
116
+		if ($globalDebug && $registration != '') {
117
+			echo 'Try to find an aircraft image for '.$registration.'...';
118
+		} elseif ($globalDebug && $aircraft_icao != '') {
119
+			echo 'Try to find an aircraft image for '.$aircraft_icao.'...';
120
+		} elseif ($globalDebug && $airline_icao != '') {
121
+			echo 'Try to find an aircraft image for '.$airline_icao.'...';
122
+		}
106 123
 		$image_url = $this->findAircraftImage($registration,$aircraft_icao,$airline_icao);
107
-		if ($registration == '' && $aircraft_icao != '') $registration = $aircraft_icao.$airline_icao;
124
+		if ($registration == '' && $aircraft_icao != '') {
125
+			$registration = $aircraft_icao.$airline_icao;
126
+		}
108 127
 		if ($image_url['original'] != '') {
109
-			if ($globalDebug) echo 'Found !'."\n";
128
+			if ($globalDebug) {
129
+				echo 'Found !'."\n";
130
+			}
110 131
 			$query  = "INSERT INTO spotter_image (registration, image, image_thumbnail, image_copyright, image_source,image_source_website) VALUES (:registration,:image,:image_thumbnail,:copyright,:source,:source_website)";
111 132
 			try {
112 133
 				$sth = $this->db->prepare($query);
@@ -115,7 +136,9 @@  discard block
 block discarded – undo
115 136
 				echo $e->getMessage()."\n";
116 137
 				return "error";
117 138
 			}
118
-		} elseif ($globalDebug) echo "Not found :'(\n";
139
+		} elseif ($globalDebug) {
140
+			echo "Not found :'(\n";
141
+		}
119 142
 		return "success";
120 143
 	}
121 144
 
@@ -128,7 +151,9 @@  discard block
 block discarded – undo
128 151
 	public function addMarineImage($mmsi,$imo = '',$name = '')
129 152
 	{
130 153
 		global $globalDebug,$globalMarineImageFetch;
131
-		if (isset($globalMarineImageFetch) && !$globalMarineImageFetch) return '';
154
+		if (isset($globalMarineImageFetch) && !$globalMarineImageFetch) {
155
+			return '';
156
+		}
132 157
 		$mmsi = filter_var($mmsi,FILTER_SANITIZE_STRING);
133 158
 		$imo = filter_var($imo,FILTER_SANITIZE_STRING);
134 159
 		$name = filter_var($name,FILTER_SANITIZE_STRING);
@@ -138,16 +163,22 @@  discard block
 block discarded – undo
138 163
 			$identity = $Marine->getIdentity($mmsi);
139 164
 			if (isset($identity[0]['mmsi'])) {
140 165
 				$imo = $identity[0]['imo'];
141
-				if ($identity[0]['ship_name'] != '') $name = $identity[0]['ship_name'];
166
+				if ($identity[0]['ship_name'] != '') {
167
+					$name = $identity[0]['ship_name'];
168
+				}
142 169
 			}
143 170
 		}
144 171
 		unset($Marine);
145 172
 
146 173
 		//getting the aircraft image
147
-		if ($globalDebug && $name != '') echo 'Try to find an vessel image for '.$name.'...';
174
+		if ($globalDebug && $name != '') {
175
+			echo 'Try to find an vessel image for '.$name.'...';
176
+		}
148 177
 		$image_url = $this->findMarineImage($mmsi,$imo,$name);
149 178
 		if ($image_url['original'] != '') {
150
-			if ($globalDebug) echo 'Found !'."\n";
179
+			if ($globalDebug) {
180
+				echo 'Found !'."\n";
181
+			}
151 182
 			$query  = "INSERT INTO marine_image (mmsi,imo,name, image, image_thumbnail, image_copyright, image_source,image_source_website) VALUES (:mmsi,:imo,:name,:image,:image_thumbnail,:copyright,:source,:source_website)";
152 183
 			try {
153 184
 				$sth = $this->db->prepare($query);
@@ -156,7 +187,9 @@  discard block
 block discarded – undo
156 187
 				echo $e->getMessage()."\n";
157 188
 				return "error";
158 189
 			}
159
-		} elseif ($globalDebug) echo "Not found :'(\n";
190
+		} elseif ($globalDebug) {
191
+			echo "Not found :'(\n";
192
+		}
160 193
 		return "success";
161 194
 	}
162 195
 
@@ -171,41 +204,85 @@  discard block
 block discarded – undo
171 204
 	{
172 205
 		global $globalAircraftImageSources, $globalIVAO, $globalAircraftImageCheckICAO, $globalVA;
173 206
 		$Spotter = new Spotter($this->db);
174
-		if (!isset($globalIVAO)) $globalIVAO = FALSE;
207
+		if (!isset($globalIVAO)) {
208
+			$globalIVAO = FALSE;
209
+		}
175 210
 		$aircraft_registration = filter_var($aircraft_registration,FILTER_SANITIZE_STRING);
176 211
 		if ($aircraft_registration != '' && $aircraft_registration != 'NA' && (!isset($globalVA) || $globalVA !== TRUE)) {
177
-			if (strpos($aircraft_registration,'/') !== false) return array('thumbnail' => '','original' => '', 'copyright' => '','source' => '','source_website' => '');
212
+			if (strpos($aircraft_registration,'/') !== false) {
213
+				return array('thumbnail' => '','original' => '', 'copyright' => '','source' => '','source_website' => '');
214
+			}
178 215
 			$aircraft_registration = urlencode(trim($aircraft_registration));
179 216
 			$aircraft_info = $Spotter->getAircraftInfoByRegistration($aircraft_registration);
180
-			if (isset($aircraft_info[0]['aircraft_name'])) $aircraft_name = $aircraft_info[0]['aircraft_name'];
181
-			else $aircraft_name = '';
182
-			if (isset($aircraft_info[0]['aircraft_icao'])) $aircraft_name = $aircraft_info[0]['aircraft_icao'];
183
-			else $aircraft_icao = '';
184
-			if (isset($aircraft_info[0]['airline_icao'])) $airline_icao = $aircraft_info[0]['airline_icao'];
185
-			else $airline_icao = '';
217
+			if (isset($aircraft_info[0]['aircraft_name'])) {
218
+				$aircraft_name = $aircraft_info[0]['aircraft_name'];
219
+			} else {
220
+				$aircraft_name = '';
221
+			}
222
+			if (isset($aircraft_info[0]['aircraft_icao'])) {
223
+				$aircraft_name = $aircraft_info[0]['aircraft_icao'];
224
+			} else {
225
+				$aircraft_icao = '';
226
+			}
227
+			if (isset($aircraft_info[0]['airline_icao'])) {
228
+				$airline_icao = $aircraft_info[0]['airline_icao'];
229
+			} else {
230
+				$airline_icao = '';
231
+			}
186 232
 		} elseif ($aircraft_icao != '') {
187 233
 			$aircraft_info = $Spotter->getAllAircraftInfo($aircraft_icao);
188
-			if (isset($aircraft_info[0]['type'])) $aircraft_name = $aircraft_info[0]['type'];
189
-			else $aircraft_name = '';
234
+			if (isset($aircraft_info[0]['type'])) {
235
+				$aircraft_name = $aircraft_info[0]['type'];
236
+			} else {
237
+				$aircraft_name = '';
238
+			}
190 239
 			$aircraft_registration = $aircraft_icao;
191
-		} else return array('thumbnail' => '','original' => '', 'copyright' => '', 'source' => '','source_website' => '');
240
+		} else {
241
+			return array('thumbnail' => '','original' => '', 'copyright' => '', 'source' => '','source_website' => '');
242
+		}
192 243
 		unset($Spotter);
193
-		if (!isset($globalAircraftImageSources)) $globalAircraftImageSources = array('ivaomtl','wikimedia','airportdata','deviantart','flickr','bing','jetphotos','planepictures','planespotters');
244
+		if (!isset($globalAircraftImageSources)) {
245
+			$globalAircraftImageSources = array('ivaomtl','wikimedia','airportdata','deviantart','flickr','bing','jetphotos','planepictures','planespotters');
246
+		}
194 247
 		foreach ($globalAircraftImageSources as $source) {
195 248
 			$source = strtolower($source);
196
-			if ($source == 'ivaomtl' && $globalIVAO && $aircraft_icao != '' && $airline_icao != '') $images_array = $this->fromIvaoMtl('aircraft',$aircraft_icao,$airline_icao);
197
-			if ($source == 'planespotters' && !$globalIVAO && extension_loaded('simplexml')) $images_array = $this->fromPlanespotters('aircraft',$aircraft_registration,$aircraft_name);
198
-			if ($source == 'flickr' && extension_loaded('simplexml')) $images_array = $this->fromFlickr('aircraft',$aircraft_registration,$aircraft_name);
199
-			if ($source == 'bing') $images_array = $this->fromBing('aircraft',$aircraft_registration,$aircraft_name);
200
-			if ($source == 'deviantart' && extension_loaded('simplexml')) $images_array = $this->fromDeviantart('aircraft',$aircraft_registration,$aircraft_name);
201
-			if ($source == 'wikimedia') $images_array = $this->fromWikimedia('aircraft',$aircraft_registration,$aircraft_name);
202
-			if ($source == 'jetphotos' && !$globalIVAO && class_exists("DomDocument")) $images_array = $this->fromJetPhotos('aircraft',$aircraft_registration,$aircraft_name);
203
-			if ($source == 'planepictures' && !$globalIVAO && class_exists("DomDocument")) $images_array = $this->fromPlanePictures('aircraft',$aircraft_registration,$aircraft_name);
204
-			if ($source == 'airportdata' && !$globalIVAO) $images_array = $this->fromAirportData('aircraft',$aircraft_registration,$aircraft_name);
205
-			if ($source == 'customsources') $images_array = $this->fromCustomSource('aircraft',$aircraft_registration,$aircraft_name);
206
-			if (isset($images_array) && $images_array['original'] != '') return $images_array;
207
-		}
208
-		if ((!isset($globalAircraftImageCheckICAO) || $globalAircraftImageCheckICAO === TRUE) && isset($aircraft_icao)) return $this->findAircraftImage($aircraft_icao);
249
+			if ($source == 'ivaomtl' && $globalIVAO && $aircraft_icao != '' && $airline_icao != '') {
250
+				$images_array = $this->fromIvaoMtl('aircraft',$aircraft_icao,$airline_icao);
251
+			}
252
+			if ($source == 'planespotters' && !$globalIVAO && extension_loaded('simplexml')) {
253
+				$images_array = $this->fromPlanespotters('aircraft',$aircraft_registration,$aircraft_name);
254
+			}
255
+			if ($source == 'flickr' && extension_loaded('simplexml')) {
256
+				$images_array = $this->fromFlickr('aircraft',$aircraft_registration,$aircraft_name);
257
+			}
258
+			if ($source == 'bing') {
259
+				$images_array = $this->fromBing('aircraft',$aircraft_registration,$aircraft_name);
260
+			}
261
+			if ($source == 'deviantart' && extension_loaded('simplexml')) {
262
+				$images_array = $this->fromDeviantart('aircraft',$aircraft_registration,$aircraft_name);
263
+			}
264
+			if ($source == 'wikimedia') {
265
+				$images_array = $this->fromWikimedia('aircraft',$aircraft_registration,$aircraft_name);
266
+			}
267
+			if ($source == 'jetphotos' && !$globalIVAO && class_exists("DomDocument")) {
268
+				$images_array = $this->fromJetPhotos('aircraft',$aircraft_registration,$aircraft_name);
269
+			}
270
+			if ($source == 'planepictures' && !$globalIVAO && class_exists("DomDocument")) {
271
+				$images_array = $this->fromPlanePictures('aircraft',$aircraft_registration,$aircraft_name);
272
+			}
273
+			if ($source == 'airportdata' && !$globalIVAO) {
274
+				$images_array = $this->fromAirportData('aircraft',$aircraft_registration,$aircraft_name);
275
+			}
276
+			if ($source == 'customsources') {
277
+				$images_array = $this->fromCustomSource('aircraft',$aircraft_registration,$aircraft_name);
278
+			}
279
+			if (isset($images_array) && $images_array['original'] != '') {
280
+				return $images_array;
281
+			}
282
+		}
283
+		if ((!isset($globalAircraftImageCheckICAO) || $globalAircraftImageCheckICAO === TRUE) && isset($aircraft_icao)) {
284
+			return $this->findAircraftImage($aircraft_icao);
285
+		}
209 286
 		return array('thumbnail' => '','original' => '', 'copyright' => '','source' => '','source_website' => '');
210 287
 	}
211 288
 
@@ -225,7 +302,9 @@  discard block
 block discarded – undo
225 302
 		//$imo = filter_var($imo,FILTER_SANITIZE_STRING);
226 303
 		$name = filter_var($name,FILTER_SANITIZE_STRING);
227 304
 		$name = trim($name);
228
-		if (strlen($name) < 4) return array('thumbnail' => '','original' => '', 'copyright' => '', 'source' => '','source_website' => '');
305
+		if (strlen($name) < 4) {
306
+			return array('thumbnail' => '','original' => '', 'copyright' => '', 'source' => '','source_website' => '');
307
+		}
229 308
 		/*
230 309
 		$Marine = new Marine($this->db);
231 310
 		if ($imo == '' || $name == '') {
@@ -237,15 +316,29 @@  discard block
 block discarded – undo
237 316
 		}
238 317
 		unset($Marine);
239 318
 		*/
240
-		if (!isset($globalMarineImageSources)) $globalMarineImageSources = array('wikimedia','deviantart','flickr','bing');
319
+		if (!isset($globalMarineImageSources)) {
320
+			$globalMarineImageSources = array('wikimedia','deviantart','flickr','bing');
321
+		}
241 322
 		foreach ($globalMarineImageSources as $source) {
242 323
 			$source = strtolower($source);
243
-			if ($source == 'flickr') $images_array = $this->fromFlickr('marine',$mmsi,$name);
244
-			if ($source == 'bing') $images_array = $this->fromBing('marine',$mmsi,$name);
245
-			if ($source == 'deviantart') $images_array = $this->fromDeviantart('marine',$mmsi,$name);
246
-			if ($source == 'wikimedia') $images_array = $this->fromWikimedia('marine',$mmsi,$name);
247
-			if ($source == 'customsources') $images_array = $this->fromCustomSource('marine',$mmsi,$name);
248
-			if (isset($images_array) && $images_array['original'] != '') return $images_array;
324
+			if ($source == 'flickr') {
325
+				$images_array = $this->fromFlickr('marine',$mmsi,$name);
326
+			}
327
+			if ($source == 'bing') {
328
+				$images_array = $this->fromBing('marine',$mmsi,$name);
329
+			}
330
+			if ($source == 'deviantart') {
331
+				$images_array = $this->fromDeviantart('marine',$mmsi,$name);
332
+			}
333
+			if ($source == 'wikimedia') {
334
+				$images_array = $this->fromWikimedia('marine',$mmsi,$name);
335
+			}
336
+			if ($source == 'customsources') {
337
+				$images_array = $this->fromCustomSource('marine',$mmsi,$name);
338
+			}
339
+			if (isset($images_array) && $images_array['original'] != '') {
340
+				return $images_array;
341
+			}
249 342
 		}
250 343
 		return array('thumbnail' => '','original' => '', 'copyright' => '','source' => '','source_website' => '');
251 344
 	}
@@ -268,7 +361,9 @@  discard block
 block discarded – undo
268 361
 			$url= 'http://www.planespotters.net/Aviation_Photos/search.php?reg='.$aircraft_registration.'&output=rss';
269 362
 		}
270 363
 		$data = $Common->getData($url);
271
-		if (substr($data, 0, 5) != "<?xml") return false;
364
+		if (substr($data, 0, 5) != "<?xml") {
365
+			return false;
366
+		}
272 367
 		if ($xml = simplexml_load_string($data)) {
273 368
 			if (isset($xml->channel->item)) {
274 369
 				$image_url = array();
@@ -307,7 +402,9 @@  discard block
 block discarded – undo
307 402
 			$url= 'http://backend.deviantart.com/rss.xml?type=deviation&q="'.urlencode($name).'"';
308 403
 		}
309 404
 		$data = $Common->getData($url);
310
-		if (substr($data, 0, 5) != "<?xml") return false;
405
+		if (substr($data, 0, 5) != "<?xml") {
406
+			return false;
407
+		}
311 408
 		if ($xml = simplexml_load_string($data)) {
312 409
 			if (isset($xml->channel->item->link)) {
313 410
 				$image_url = array();
@@ -411,14 +508,22 @@  discard block
 block discarded – undo
411 508
 	public function fromFlickr($type,$registration,$name='') {
412 509
 		$Common = new Common();
413 510
 		if ($type == 'aircraft') {
414
-			if ($name != '') $url = 'https://api.flickr.com/services/feeds/photos_public.gne?format=rss2&license=1,2,3,4,5,6,7&per_page=1&tags='.$registration.','.urlencode($name);
415
-			else $url = 'https://api.flickr.com/services/feeds/photos_public.gne?format=rss2&license=1,2,3,4,5,6,7&per_page=1&tags='.$registration.',aircraft';
511
+			if ($name != '') {
512
+				$url = 'https://api.flickr.com/services/feeds/photos_public.gne?format=rss2&license=1,2,3,4,5,6,7&per_page=1&tags='.$registration.','.urlencode($name);
513
+			} else {
514
+				$url = 'https://api.flickr.com/services/feeds/photos_public.gne?format=rss2&license=1,2,3,4,5,6,7&per_page=1&tags='.$registration.',aircraft';
515
+			}
416 516
 		} elseif ($type == 'marine') {
417
-			if ($name != '') $url = 'https://api.flickr.com/services/feeds/photos_public.gne?format=rss2&license=1,2,3,4,5,6,7&per_page=1&tags=ship,'.urlencode($name);
418
-			else $url = 'https://api.flickr.com/services/feeds/photos_public.gne?format=rss2&license=1,2,3,4,5,6,7&per_page=1&tags='.$registration.',ship';
517
+			if ($name != '') {
518
+				$url = 'https://api.flickr.com/services/feeds/photos_public.gne?format=rss2&license=1,2,3,4,5,6,7&per_page=1&tags=ship,'.urlencode($name);
519
+			} else {
520
+				$url = 'https://api.flickr.com/services/feeds/photos_public.gne?format=rss2&license=1,2,3,4,5,6,7&per_page=1&tags='.$registration.',ship';
521
+			}
419 522
 		}
420 523
 		$data = $Common->getData($url);
421
-		if (substr($data, 0, 5) != "<?xml") return false;
524
+		if (substr($data, 0, 5) != "<?xml") {
525
+			return false;
526
+		}
422 527
 		if ($xml = simplexml_load_string($data)) {
423 528
 			if (isset($xml->channel->item)) {
424 529
 				$original_url = trim((string)$xml->channel->item->enclosure->attributes()->url);
@@ -461,13 +566,21 @@  discard block
 block discarded – undo
461 566
 	public function fromBing($type,$aircraft_registration,$aircraft_name='') {
462 567
 		global $globalImageBingKey;
463 568
 		$Common = new Common();
464
-		if (!isset($globalImageBingKey) || $globalImageBingKey == '') return false;
569
+		if (!isset($globalImageBingKey) || $globalImageBingKey == '') {
570
+			return false;
571
+		}
465 572
 		if ($type == 'aircraft') {
466
-			if ($aircraft_name != '') $url = 'https://api.datamarket.azure.com/Bing/Search/v1/Image?$format=json&$top=1&Query=%27'.$aircraft_registration.'%20'.urlencode($aircraft_name).'%20-site:planespotters.com%20-site:flickr.com%27';
467
-			else $url = 'https://api.datamarket.azure.com/Bing/Search/v1/Image?$format=json&$top=1&Query=%27%2B'.$aircraft_registration.'%20%2Baircraft%20-site:planespotters.com%20-site:flickr.com%27';
573
+			if ($aircraft_name != '') {
574
+				$url = 'https://api.datamarket.azure.com/Bing/Search/v1/Image?$format=json&$top=1&Query=%27'.$aircraft_registration.'%20'.urlencode($aircraft_name).'%20-site:planespotters.com%20-site:flickr.com%27';
575
+			} else {
576
+				$url = 'https://api.datamarket.azure.com/Bing/Search/v1/Image?$format=json&$top=1&Query=%27%2B'.$aircraft_registration.'%20%2Baircraft%20-site:planespotters.com%20-site:flickr.com%27';
577
+			}
468 578
 		} elseif ($type == 'marine') {
469
-			if ($aircraft_name != '') $url = 'https://api.datamarket.azure.com/Bing/Search/v1/Image?$format=json&$top=1&Query=%27'.urlencode($aircraft_name).'%20%2Bship%20-site:flickr.com%27';
470
-			else $url = 'https://api.datamarket.azure.com/Bing/Search/v1/Image?$format=json&$top=1&Query=%27%2B'.$aircraft_registration.'%20%2Bship%20-site:flickr.com%27';
579
+			if ($aircraft_name != '') {
580
+				$url = 'https://api.datamarket.azure.com/Bing/Search/v1/Image?$format=json&$top=1&Query=%27'.urlencode($aircraft_name).'%20%2Bship%20-site:flickr.com%27';
581
+			} else {
582
+				$url = 'https://api.datamarket.azure.com/Bing/Search/v1/Image?$format=json&$top=1&Query=%27%2B'.$aircraft_registration.'%20%2Bship%20-site:flickr.com%27';
583
+			}
471 584
 		}
472 585
 		$headers = array("Authorization: Basic " . base64_encode("ignored:".$globalImageBingKey));
473 586
 		$data = $Common->getData($url,'get','',$headers);
@@ -523,17 +636,25 @@  discard block
 block discarded – undo
523 636
 	public function fromWikimedia($type,$registration,$name='') {
524 637
 		$Common = new Common();
525 638
 		if ($type == 'aircraft') {
526
-			if ($name != '') $url = 'https://commons.wikimedia.org/w/api.php?action=query&list=search&format=json&srlimit=1&srnamespace=6&continue&srsearch="'.$registration.'"%20'.urlencode($name);
527
-			else $url = 'https://commons.wikimedia.org/w/api.php?action=query&list=search&format=json&srlimit=1&srnamespace=6&continue&srsearch="'.$registration.'"%20aircraft';
639
+			if ($name != '') {
640
+				$url = 'https://commons.wikimedia.org/w/api.php?action=query&list=search&format=json&srlimit=1&srnamespace=6&continue&srsearch="'.$registration.'"%20'.urlencode($name);
641
+			} else {
642
+				$url = 'https://commons.wikimedia.org/w/api.php?action=query&list=search&format=json&srlimit=1&srnamespace=6&continue&srsearch="'.$registration.'"%20aircraft';
643
+			}
528 644
 		} elseif ($type == 'marine') {
529
-			if ($name != '') $url = 'https://commons.wikimedia.org/w/api.php?action=query&list=search&format=json&srlimit=1&srnamespace=6&continue&srsearch="'.urlencode($name).'%20ship"';
530
-			else return false;
645
+			if ($name != '') {
646
+				$url = 'https://commons.wikimedia.org/w/api.php?action=query&list=search&format=json&srlimit=1&srnamespace=6&continue&srsearch="'.urlencode($name).'%20ship"';
647
+			} else {
648
+				return false;
649
+			}
531 650
 		}
532 651
 		$data = $Common->getData($url);
533 652
 		$result = json_decode($data);
534 653
 		if (isset($result->query->search[0]->title)) {
535 654
 			$fileo = $result->query->search[0]->title;
536
-			if (substr($fileo,-3) == 'pdf') return false;
655
+			if (substr($fileo,-3) == 'pdf') {
656
+				return false;
657
+			}
537 658
 			$file = urlencode($fileo);
538 659
 			$url2 = 'https://commons.wikimedia.org/w/api.php?action=query&format=json&continue&iilimit=500&prop=imageinfo&iiprop=user|url|size|mime|sha1|timestamp&iiurlwidth=200%27&titles='.$file;
539 660
 			$data2 = $Common->getData($url2);
@@ -604,18 +725,27 @@  discard block
 block discarded – undo
604 725
 					$image_url = array();
605 726
 					$image_url['thumbnail'] = $url_thumbnail;
606 727
 					$image_url['original'] = $url;
607
-					if ($source['exif'] && exif_imagetype($url) == IMAGETYPE_JPEG) $exifCopyright = $this->getExifCopyright($url);
608
-					else $exifCopyright = '';
609
-					if ($exifCopyright  != '') $image_url['copyright'] = $exifCopyright;
610
-					elseif (isset($source['copyright'])) $image_url['copyright'] = $source['copyright'];
611
-					else $image_url['copyright'] = $source['source_website'];
728
+					if ($source['exif'] && exif_imagetype($url) == IMAGETYPE_JPEG) {
729
+						$exifCopyright = $this->getExifCopyright($url);
730
+					} else {
731
+						$exifCopyright = '';
732
+					}
733
+					if ($exifCopyright  != '') {
734
+						$image_url['copyright'] = $exifCopyright;
735
+					} elseif (isset($source['copyright'])) {
736
+						$image_url['copyright'] = $source['copyright'];
737
+					} else {
738
+						$image_url['copyright'] = $source['source_website'];
739
+					}
612 740
 					$image_url['source_website'] = $source['source_website'];
613 741
 					$image_url['source'] = $source['source'];
614 742
 					return $image_url;
615 743
 				}
616 744
 			}
617 745
 			return false;
618
-		} else return false;
746
+		} else {
747
+			return false;
748
+		}
619 749
 		if (!empty($globalMarineImageCustomSources) && $type == 'marine') {
620 750
 			$customsources = array();
621 751
 			if (!isset($globalMarineImageCustomSources[0])) {
@@ -640,18 +770,27 @@  discard block
 block discarded – undo
640 770
 					$image_url = array();
641 771
 					$image_url['thumbnail'] = $url_thumbnail;
642 772
 					$image_url['original'] = $url;
643
-					if ($source['exif'] && exif_imagetype($url) == IMAGETYPE_JPEG) $exifCopyright = $this->getExifCopyright($url);
644
-					else $exifCopyright = '';
645
-					if ($exifCopyright  != '') $image_url['copyright'] = $exifCopyright;
646
-					elseif (isset($source['copyright'])) $image_url['copyright'] = $source['copyright'];
647
-					else $image_url['copyright'] = $source['source_website'];
773
+					if ($source['exif'] && exif_imagetype($url) == IMAGETYPE_JPEG) {
774
+						$exifCopyright = $this->getExifCopyright($url);
775
+					} else {
776
+						$exifCopyright = '';
777
+					}
778
+					if ($exifCopyright  != '') {
779
+						$image_url['copyright'] = $exifCopyright;
780
+					} elseif (isset($source['copyright'])) {
781
+						$image_url['copyright'] = $source['copyright'];
782
+					} else {
783
+						$image_url['copyright'] = $source['source_website'];
784
+					}
648 785
 					$image_url['source_website'] = $source['source_website'];
649 786
 					$image_url['source'] = $source['source'];
650 787
 					return $image_url;
651 788
 				}
652 789
 			}
653 790
 			return false;
654
-		} else return false;
791
+		} else {
792
+			return false;
793
+		}
655 794
 	}
656 795
 }
657 796
 
Please login to merge, or discard this patch.
header.php 1 patch
Braces   +77 added lines, -17 removed lines patch added patch discarded remove patch
@@ -6,10 +6,15 @@  discard block
 block discarded – undo
6 6
 //gets the page file and stores it in a variable
7 7
 $file_path = pathinfo($_SERVER['SCRIPT_NAME']);
8 8
 $current_page = $file_path['filename'];
9
-if ($globalTimezone == '') $globalTimezone = 'UTC';
9
+if ($globalTimezone == '') {
10
+	$globalTimezone = 'UTC';
11
+}
10 12
 date_default_timezone_set($globalTimezone);
11
-if (isset($_COOKIE['MapType']) && $_COOKIE['MapType'] != '') $MapType = $_COOKIE['MapType'];
12
-else $MapType = $globalMapProvider;
13
+if (isset($_COOKIE['MapType']) && $_COOKIE['MapType'] != '') {
14
+	$MapType = $_COOKIE['MapType'];
15
+} else {
16
+	$MapType = $globalMapProvider;
17
+}
13 18
 
14 19
 
15 20
 if (isset($_GET['3d'])) {
@@ -241,7 +246,13 @@  discard block
 block discarded – undo
241 246
 <script src="<?php print $globalURL; ?>/js/MovingMarker.js"></script>
242 247
 <script src="<?php print $globalURL; ?>/js/jquery.idle.min.js"></script>
243 248
 <script src="<?php print $globalURL; ?>/js/map.common.js"></script>
244
-<script src="<?php print $globalURL; ?>/js/map.2d.js.php?ident=<?php print $ident; ?><?php if(isset($latitude)) print '&latitude='.$latitude; ?><?php if(isset($longitude)) print '&longitude='.$longitude; ?>&<?php print time(); ?>"></script>
249
+<script src="<?php print $globalURL; ?>/js/map.2d.js.php?ident=<?php print $ident; ?><?php if(isset($latitude)) {
250
+	print '&latitude='.$latitude;
251
+}
252
+?><?php if(isset($longitude)) {
253
+	print '&longitude='.$longitude;
254
+}
255
+?>&<?php print time(); ?>"></script>
245 256
 <?php
246 257
 		if (!isset($type) || $type == 'aircraft') {
247 258
 ?>
@@ -314,7 +325,13 @@  discard block
 block discarded – undo
314 325
 <script src="<?php print $globalURL; ?>/js/MovingMarker.js"></script>
315 326
 <script src="<?php print $globalURL; ?>/js/jquery.idle.min.js"></script>
316 327
 <script src="<?php print $globalURL; ?>/js/map.common.js"></script>
317
-<script src="<?php print $globalURL; ?>/js/map.2d.js.php?flightaware_id=<?php print $flightaware_id; ?><?php if(isset($latitude)) print '&latitude='.$latitude; ?><?php if(isset($longitude)) print '&longitude='.$longitude; ?>&<?php print time(); ?>"></script>
328
+<script src="<?php print $globalURL; ?>/js/map.2d.js.php?flightaware_id=<?php print $flightaware_id; ?><?php if(isset($latitude)) {
329
+	print '&latitude='.$latitude;
330
+}
331
+?><?php if(isset($longitude)) {
332
+	print '&longitude='.$longitude;
333
+}
334
+?>&<?php print time(); ?>"></script>
318 335
 <script src="<?php print $globalURL; ?>/js/map-aircraft.2d.js.php?flightaware_id=<?php print $flightaware_id; ?>&<?php print time(); ?>"></script>
319 336
 <?php
320 337
 		if (isset($globalGoogleAPIKey) && $globalGoogleAPIKey != '' && ($MapType == 'Google-Roadmap' || $MapType == 'Google-Satellite' || $MapType == 'Google-Hybrid' || $MapType == 'Google-Terrain')) {
@@ -395,7 +412,12 @@  discard block
 block discarded – undo
395 412
         <span class="icon-bar"></span>
396 413
       </button>
397 414
       <a href="<?php print $globalURL; ?>/search" class="navbar-toggle navbar-toggle-search"><i class="fa fa-search"></i></a>
398
-      <a class="navbar-brand" href="<?php if ($globalURL == '') print '/'; else print $globalURL; ?>"><img src="<?php print $globalURL.$logoURL; ?>" height="30px" /></a>
415
+      <a class="navbar-brand" href="<?php if ($globalURL == '') {
416
+	print '/';
417
+} else {
418
+	print $globalURL;
419
+}
420
+?>"><img src="<?php print $globalURL.$logoURL; ?>" height="30px" /></a>
399 421
     </div>
400 422
     <div class="collapse navbar-collapse">
401 423
 
@@ -434,7 +456,10 @@  discard block
 block discarded – undo
434 456
 <?php
435 457
     }
436 458
 ?>
437
-          <a href="#" class="dropdown-toggle" data-toggle="dropdown"><?php echo _("Explore"); ?> <b class="<?php if ($sub) echo 'right-'; ?>caret"></b></a>
459
+          <a href="#" class="dropdown-toggle" data-toggle="dropdown"><?php echo _("Explore"); ?> <b class="<?php if ($sub) {
460
+	echo 'right-';
461
+}
462
+?>caret"></b></a>
438 463
           <ul class="dropdown-menu">
439 464
           	<li><a href="<?php print $globalURL; ?>/aircraft"><?php echo _("Aircrafts Types"); ?></a></li>
440 465
 <?php
@@ -505,8 +530,14 @@  discard block
 block discarded – undo
505 530
         </li>
506 531
       	<li><a href="<?php print $globalURL; ?>/search"><?php echo _("Search"); ?></a></li>
507 532
       	<li><a href="<?php print $globalURL; ?>/statistics"><?php echo _("Statistics"); ?></a></li>
508
-        <li class="dropdown<?php if ($sub) echo '-submenu'; ?>">
509
-          <a href="#" class="dropdown-toggle" data-toggle="dropdown"><?php echo _("Tools"); ?> <b class="<?php if ($sub) echo 'right-'; ?>caret"></b></a>
533
+        <li class="dropdown<?php if ($sub) {
534
+	echo '-submenu';
535
+}
536
+?>">
537
+          <a href="#" class="dropdown-toggle" data-toggle="dropdown"><?php echo _("Tools"); ?> <b class="<?php if ($sub) {
538
+	echo 'right-';
539
+}
540
+?>caret"></b></a>
510 541
           <ul class="dropdown-menu">
511 542
           	<li><a href="<?php print $globalURL; ?>/tools/acars"><?php echo _("ACARS translator"); ?></a></li>
512 543
           	<li><a href="<?php print $globalURL; ?>/tools/metar"><?php echo _("METAR translator"); ?></a></li>
@@ -542,7 +573,10 @@  discard block
 block discarded – undo
542 573
 <?php
543 574
 	}
544 575
 ?>
545
-		<a href="#" class="dropdown-toggle" data-toggle="dropdown"><?php echo _("Explore"); ?> <b class="<?php if ($sub) echo 'right-'; ?>caret"></b></a>
576
+		<a href="#" class="dropdown-toggle" data-toggle="dropdown"><?php echo _("Explore"); ?> <b class="<?php if ($sub) {
577
+	echo 'right-';
578
+}
579
+?>caret"></b></a>
546 580
 		<ul class="dropdown-menu">
547 581
 		    <li><a href="<?php print $globalURL; ?>/marine/currently"><?php echo _("Current Activity"); ?></a></li>
548 582
 		    <li><a href="<?php print $globalURL; ?>/marine/latest"><?php echo _("Latest Activity"); ?></a></li>
@@ -575,7 +609,10 @@  discard block
 block discarded – undo
575 609
 <?php
576 610
 	}
577 611
 ?>
578
-		<a href="#" class="dropdown-toggle" data-toggle="dropdown"><?php echo _("Explore"); ?> <b class="<?php if ($sub) echo 'right-'; ?>caret"></b></a>
612
+		<a href="#" class="dropdown-toggle" data-toggle="dropdown"><?php echo _("Explore"); ?> <b class="<?php if ($sub) {
613
+	echo 'right-';
614
+}
615
+?>caret"></b></a>
579 616
 		<ul class="dropdown-menu">
580 617
 		    <li><a href="<?php print $globalURL; ?>/tracker/currently"><?php echo _("Current Activity"); ?></a></li>
581 618
 		    <li><a href="<?php print $globalURL; ?>/tracker/latest"><?php echo _("Latest Activity"); ?></a></li>
@@ -609,7 +646,10 @@  discard block
 block discarded – undo
609 646
 	}
610 647
 ?>
611 648
 <!--
612
-		<a href="#" class="dropdown-toggle" data-toggle="dropdown"><?php echo _("Explore"); ?> <b class="<?php if ($sub) echo 'right-'; ?>caret"></b></a>
649
+		<a href="#" class="dropdown-toggle" data-toggle="dropdown"><?php echo _("Explore"); ?> <b class="<?php if ($sub) {
650
+	echo 'right-';
651
+}
652
+?>caret"></b></a>
613 653
 		<ul class="dropdown-menu">
614 654
 		    <li><a href="<?php print $globalURL; ?>/satellite/currently"><?php echo _("Current Activity"); ?></a></li>
615 655
 		    <li><a href="<?php print $globalURL; ?>/satellite/latest"><?php echo _("Latest Activity"); ?></a></li>
@@ -666,7 +706,9 @@  discard block
 block discarded – undo
666 706
   		        $alllang = $Language->getLanguages();
667 707
   		        foreach ($alllang as $key => $lang) {
668 708
   		            print '<option value="'.$key.'"';
669
-  		            if (isset($_COOKIE['language']) && $_COOKIE['language'] == $key) print ' selected ';
709
+  		            if (isset($_COOKIE['language']) && $_COOKIE['language'] == $key) {
710
+  		            	print ' selected ';
711
+  		            }
670 712
   		            print '>'.$lang[0].'</option>';
671 713
   		        }
672 714
   		    ?>
@@ -806,9 +848,24 @@  discard block
 block discarded – undo
806 848
 	$customid = $globalMapProvider;
807 849
 ?>
808 850
     L.tileLayer('<?php print $globalMapCustomLayer[$customid]['url']; ?>/{z}/{x}/{y}.png', {
809
-        maxZoom: <?php if (isset($globalMapCustomLayer[$customid]['maxZoom'])) print $globalMapCustomLayer[$customid]['maxZoom']; else print '18'; ?>,
810
-        minZoom: <?php if (isset($globalMapCustomLayer[$customid]['minZoom'])) print $globalMapCustomLayer[$customid]['minZoom']; else print '0'; ?>,
811
-        noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) print 'false'; else print 'true'; ?>,
851
+        maxZoom: <?php if (isset($globalMapCustomLayer[$customid]['maxZoom'])) {
852
+	print $globalMapCustomLayer[$customid]['maxZoom'];
853
+} else {
854
+	print '18';
855
+}
856
+?>,
857
+        minZoom: <?php if (isset($globalMapCustomLayer[$customid]['minZoom'])) {
858
+	print $globalMapCustomLayer[$customid]['minZoom'];
859
+} else {
860
+	print '0';
861
+}
862
+?>,
863
+        noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) {
864
+	print 'false';
865
+} else {
866
+	print 'true';
867
+}
868
+?>,
812 869
         attribution: '<?php print $globalMapCustomLayer[$customid]['attribution']; ?>'
813 870
     }).addTo(map);
814 871
 <?php
@@ -831,4 +888,7 @@  discard block
 block discarded – undo
831 888
 
832 889
 ?>
833 890
 
834
-<section class="container main-content <?php if (strtolower($current_page) == 'index') print 'index '; ?>clear">
891
+<section class="container main-content <?php if (strtolower($current_page) == 'index') {
892
+	print 'index ';
893
+}
894
+?>clear">
Please login to merge, or discard this patch.
require/class.MarineLive.php 1 patch
Braces   +119 added lines, -40 removed lines patch added patch discarded remove patch
@@ -8,7 +8,9 @@  discard block
 block discarded – undo
8 8
 	public function __construct($dbc = null) {
9 9
 		$Connection = new Connection($dbc);
10 10
 		$this->db = $Connection->db();
11
-		if ($this->db === null) die('Error: No DB connection. (MarineLive)');
11
+		if ($this->db === null) {
12
+			die('Error: No DB connection. (MarineLive)');
13
+		}
12 14
 	}
13 15
 
14 16
 
@@ -30,7 +32,9 @@  discard block
 block discarded – undo
30 32
 		if (isset($filter[0]['source'])) {
31 33
 			$filters = array_merge($filters,$filter);
32 34
 		}
33
-		if (is_array($globalFilter)) $filter = array_merge($filter,$globalFilter);
35
+		if (is_array($globalFilter)) {
36
+			$filter = array_merge($filter,$globalFilter);
37
+		}
34 38
 		$filter_query_join = '';
35 39
 		$filter_query_where = '';
36 40
 		foreach($filters as $flt) {
@@ -80,8 +84,11 @@  discard block
 block discarded – undo
80 84
 		if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) {
81 85
 			$filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')";
82 86
 		}
83
-		if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE';
84
-		elseif ($filter_query_where != '' && $and) $filter_query_where .= ' AND';
87
+		if ($filter_query_where == '' && $where) {
88
+			$filter_query_where = ' WHERE';
89
+		} elseif ($filter_query_where != '' && $and) {
90
+			$filter_query_where .= ' AND';
91
+		}
85 92
 		if ($filter_query_where != '') {
86 93
 			$filter_query_where = preg_replace('/^ AND/',' WHERE',$filter_query_where);
87 94
 		}
@@ -122,9 +129,13 @@  discard block
 block discarded – undo
122 129
 				$orderby_query = ' '.$search_orderby_array[$sort]['sql'];
123 130
 			}
124 131
 		}
125
-		if ($orderby_query == '') $orderby_query= ' ORDER BY date DESC';
132
+		if ($orderby_query == '') {
133
+			$orderby_query= ' ORDER BY date DESC';
134
+		}
126 135
 
127
-		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
136
+		if (!isset($globalLiveInterval)) {
137
+			$globalLiveInterval = '200';
138
+		}
128 139
 		if ($globalDBdriver == 'mysql') {
129 140
 			//$query  = "SELECT marine_live.* FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL 30 SECOND) <= l.date GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate";
130 141
 			$query  = 'SELECT marine_live.* FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate'.$filter_query.$orderby_query;
@@ -149,7 +160,9 @@  discard block
 block discarded – undo
149 160
 
150 161
 		$filter_query = $this->getFilter($filter,true,true);
151 162
 
152
-		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
163
+		if (!isset($globalLiveInterval)) {
164
+			$globalLiveInterval = '200';
165
+		}
153 166
 		if ($globalDBdriver == 'mysql') {
154 167
 			$query  = 'SELECT marine_live.mmsi, marine_live.ident, marine_live.type,marine_live.fammarine_id, marine_live.latitude, marine_live.longitude, marine_live.heading, marine_live.ground_speed, marine_live.date, marine_live.format_source 
155 168
 			FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate'.$filter_query." marine_live.latitude <> 0 AND marine_live.longitude <> 0";
@@ -190,48 +203,72 @@  discard block
 block discarded – undo
190 203
 		}
191 204
 		$filter_query = $this->getFilter($filter,true,true);
192 205
 
193
-		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
194
-		if (!isset($globalMap3DMarinesLimit) || $globalMap3DMarinesLimit == '') $globalMap3DMarinesLimit = '300';
206
+		if (!isset($globalLiveInterval)) {
207
+			$globalLiveInterval = '200';
208
+		}
209
+		if (!isset($globalMap3DMarinesLimit) || $globalMap3DMarinesLimit == '') {
210
+			$globalMap3DMarinesLimit = '300';
211
+		}
195 212
 		if ($globalDBdriver == 'mysql') {
196 213
 			if (isset($globalArchive) && $globalArchive === TRUE) {
197 214
 				$query  = 'SELECT * FROM (SELECT marine_archive.ident, marine_archive.fammarine_id,marine_archive.type, marine_archive.latitude, marine_archive.longitude, marine_archive.heading, marine_archive.ground_speed, marine_archive.date, marine_archive.format_source 
198 215
 				    FROM marine_archive INNER JOIN (SELECT fammarine_id FROM marine_live'.$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval." SECOND) <= marine_live.date) l ON l.fammarine_id = marine_archive.fammarine_id ";
199
-				if ($usecoord) $query .= "AND marine_archive.latitude BETWEEN ".$minlat." AND ".$maxlat." AND marine_archive.longitude BETWEEN ".$minlong." AND ".$maxlong." ";
216
+				if ($usecoord) {
217
+					$query .= "AND marine_archive.latitude BETWEEN ".$minlat." AND ".$maxlat." AND marine_archive.longitude BETWEEN ".$minlong." AND ".$maxlong." ";
218
+				}
200 219
 				$query .= "UNION
201 220
 				    SELECT marine_live.ident, marine_live.fammarine_id,marine_live.type, marine_live.latitude, marine_live.longitude, marine_live.heading, marine_live.ground_speed, marine_live.date, marine_live.format_source 
202 221
 				    FROM marine_live".$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval." SECOND) <= marine_live.date";
203
-				if ($usecoord) $query .= " AND marine_live.latitude BETWEEN ".$minlat." AND ".$maxlat." AND marine_live.longitude BETWEEN ".$minlong." AND ".$maxlong;
222
+				if ($usecoord) {
223
+					$query .= " AND marine_live.latitude BETWEEN ".$minlat." AND ".$maxlat." AND marine_live.longitude BETWEEN ".$minlong." AND ".$maxlong;
224
+				}
204 225
 				$query .= ") AS marine 
205 226
 				    WHERE latitude <> '0' AND longitude <> '0' 
206 227
 				    ORDER BY fammarine_id, date";
207
-				if ($limit) $query .= " LIMIT ".$globalMap3DMarinesLimit;
228
+				if ($limit) {
229
+					$query .= " LIMIT ".$globalMap3DMarinesLimit;
230
+				}
208 231
 			} else {
209 232
 				$query  = 'SELECT marine_live.ident, marine_live.fammarine_id,marine_live.type, marine_live.latitude, marine_live.longitude, marine_live.heading, marine_live.ground_speed, marine_live.date, marine_live.format_source 
210 233
 				    FROM marine_live'.$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval." SECOND) <= marine_live.date ";
211
-				if ($usecoord) $query .= "AND marine_live.latitude BETWEEN ".$minlat." AND ".$maxlat." AND marine_live.longitude BETWEEN ".$minlong." AND ".$maxlong." ";
234
+				if ($usecoord) {
235
+					$query .= "AND marine_live.latitude BETWEEN ".$minlat." AND ".$maxlat." AND marine_live.longitude BETWEEN ".$minlong." AND ".$maxlong." ";
236
+				}
212 237
 				$query .= "AND marine_live.latitude <> '0' AND marine_live.longitude <> '0' 
213 238
 				ORDER BY marine_live.fammarine_id, marine_live.date";
214
-				if ($limit) $query .= " LIMIT ".$globalMap3DMarinesLimit;
239
+				if ($limit) {
240
+					$query .= " LIMIT ".$globalMap3DMarinesLimit;
241
+				}
215 242
 			}
216 243
 		} else {
217 244
 			if (isset($globalArchive) && $globalArchive === TRUE) {
218 245
 				$query  = "SELECT * FROM (SELECT marine_archive.ident, marine_archive.fammarine_id, marine_archive.type,marine_archive.latitude, marine_archive.longitude, marine_archive.heading, marine_archive.ground_speed, marine_archive.date, marine_archive.format_source 
219 246
 				    FROM marine_archive INNER JOIN (SELECT fammarine_id FROM marine_live".$filter_query." CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= marine_live.date) l ON l.fammarine_id = marine_archive.fammarine_id ";
220
-				if ($usecoord) $query .= "AND marine_archive.latitude BETWEEN ".$minlat." AND ".$maxlat." AND marine_archive.longitude BETWEEN ".$minlong." AND ".$maxlong." ";
247
+				if ($usecoord) {
248
+					$query .= "AND marine_archive.latitude BETWEEN ".$minlat." AND ".$maxlat." AND marine_archive.longitude BETWEEN ".$minlong." AND ".$maxlong." ";
249
+				}
221 250
 				$query .= "UNION
222 251
 				    SELECT marine_live.ident, marine_live.fammarine_id, marine_live.type,marine_live.latitude, marine_live.longitude, marine_live.heading, marine_live.ground_speed, marine_live.date, marine_live.format_source 
223 252
 				    FROM marine_live".$filter_query." CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= marine_live.date";
224
-				if ($usecoord) $query .= " AND marine_live.latitude BETWEEN ".$minlat." AND ".$maxlat." AND marine_live.longitude BETWEEN ".$minlong." AND ".$maxlong;
253
+				if ($usecoord) {
254
+					$query .= " AND marine_live.latitude BETWEEN ".$minlat." AND ".$maxlat." AND marine_live.longitude BETWEEN ".$minlong." AND ".$maxlong;
255
+				}
225 256
 				$query .= ") AS marine WHERE latitude <> '0' AND longitude <> '0' ";
226 257
 				$query .= "ORDER BY fammarine_id, date";
227
-				if ($limit) $query .= " LIMIT ".$globalMap3DMarinesLimit;
258
+				if ($limit) {
259
+					$query .= " LIMIT ".$globalMap3DMarinesLimit;
260
+				}
228 261
 			} else {
229 262
 				$query  = "SELECT marine_live.ident, marine_live.fammarine_id, marine_live.type,marine_live.latitude, marine_live.longitude, marine_live.heading, marine_live.ground_speed, marine_live.date, marine_live.format_source 
230 263
 				    FROM marine_live".$filter_query." CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= marine_live.date ";
231
-				if ($usecoord) $query .= "AND marine_live.latitude BETWEEN ".$minlat." AND ".$maxlat." AND marine_live.longitude BETWEEN ".$minlong." AND ".$maxlong." ";
264
+				if ($usecoord) {
265
+					$query .= "AND marine_live.latitude BETWEEN ".$minlat." AND ".$maxlat." AND marine_live.longitude BETWEEN ".$minlong." AND ".$maxlong." ";
266
+				}
232 267
 				$query .= "AND marine_live.latitude <> '0' AND marine_live.longitude <> '0' 
233 268
 				ORDER BY marine_live.fammarine_id, marine_live.date";
234
-				if ($limit) $query .= " LIMIT ".$globalMap3DMarinesLimit;
269
+				if ($limit) {
270
+					$query .= " LIMIT ".$globalMap3DMarinesLimit;
271
+				}
235 272
 			}
236 273
 		}
237 274
 		try {
@@ -256,7 +293,9 @@  discard block
 block discarded – undo
256 293
 		global $globalDBdriver, $globalLiveInterval;
257 294
 		$filter_query = $this->getFilter($filter,true,true);
258 295
 
259
-		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
296
+		if (!isset($globalLiveInterval)) {
297
+			$globalLiveInterval = '200';
298
+		}
260 299
 		if ($globalDBdriver == 'mysql') {
261 300
 			$query = 'SELECT COUNT(DISTINCT marine_live.fammarine_id) as nb FROM marine_live'.$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= date';
262 301
 		} else {
@@ -284,7 +323,9 @@  discard block
 block discarded – undo
284 323
 	{
285 324
 		global $globalDBdriver, $globalLiveInterval;
286 325
 		$Marine = new Marine($this->db);
287
-		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
326
+		if (!isset($globalLiveInterval)) {
327
+			$globalLiveInterval = '200';
328
+		}
288 329
 		$filter_query = $this->getFilter($filter);
289 330
 
290 331
 		if (is_array($coord)) {
@@ -292,7 +333,9 @@  discard block
 block discarded – undo
292 333
 			$minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
293 334
 			$maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
294 335
 			$maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
295
-		} else return array();
336
+		} else {
337
+			return array();
338
+		}
296 339
 		if ($globalDBdriver == 'mysql') {
297 340
 			$query  = 'SELECT marine_live.* FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate AND marine_live.latitude BETWEEN '.$minlat.' AND '.$maxlat.' AND marine_live.longitude BETWEEN '.$minlong.' AND '.$maxlong.' GROUP BY marine_live.fammarine_id'.$filter_query;
298 341
 		} else {
@@ -312,7 +355,9 @@  discard block
 block discarded – undo
312 355
 	{
313 356
 		global $globalDBdriver, $globalLiveInterval, $globalArchive;
314 357
 		$Marine = new Marine($this->db);
315
-		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
358
+		if (!isset($globalLiveInterval)) {
359
+			$globalLiveInterval = '200';
360
+		}
316 361
 		$filter_query = $this->getFilter($filter,true,true);
317 362
 
318 363
 		if (is_array($coord)) {
@@ -320,7 +365,9 @@  discard block
 block discarded – undo
320 365
 			$minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
321 366
 			$maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
322 367
 			$maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
323
-		} else return array();
368
+		} else {
369
+			return array();
370
+		}
324 371
 		/*
325 372
 		if ($globalDBdriver == 'mysql') {
326 373
 			$query  = 'SELECT marine_live.ident, marine_live.fammarine_id,marine_live.type, marine_live.latitude, marine_live.longitude, marine_live.heading, marine_live.ground_speed, marine_live.date, marine_live.format_source 
@@ -543,11 +590,15 @@  discard block
 block discarded – undo
543 590
 		//$query  = self::$global_query.' WHERE marine_live.fammarine_id = :id ORDER BY date';
544 591
 		if ($globalDBdriver == 'mysql') {
545 592
 			$query = 'SELECT marine_live.* FROM marine_live WHERE marine_live.fammarine_id = :id';
546
-			if ($liveinterval) $query .= ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= date';
593
+			if ($liveinterval) {
594
+				$query .= ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= date';
595
+			}
547 596
 			$query .= ' ORDER BY date';
548 597
 		} else {
549 598
 			$query = 'SELECT marine_live.* FROM marine_live WHERE marine_live.fammarine_id = :id';
550
-			if ($liveinterval) $query .= " AND CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= date";
599
+			if ($liveinterval) {
600
+				$query .= " AND CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= date";
601
+			}
551 602
 			$query .= ' ORDER BY date';
552 603
 		}
553 604
 
@@ -642,7 +693,9 @@  discard block
 block discarded – undo
642 693
 				$i++;
643 694
 				$j++;
644 695
 				if ($j == 30) {
645
-					if ($globalDebug) echo ".";
696
+					if ($globalDebug) {
697
+						echo ".";
698
+					}
646 699
 				    	try {
647 700
 						
648 701
 						$sth = $this->db->prepare(substr($query_delete,0,-1).")");
@@ -922,7 +975,9 @@  discard block
 block discarded – undo
922 975
 			{
923 976
 				return false;
924 977
 			}
925
-		} else return '';
978
+		} else {
979
+			return '';
980
+		}
926 981
 
927 982
 		if ($longitude != '')
928 983
 		{
@@ -930,7 +985,9 @@  discard block
 block discarded – undo
930 985
 			{
931 986
 				return false;
932 987
 			}
933
-		} else return '';
988
+		} else {
989
+			return '';
990
+		}
934 991
 
935 992
 
936 993
 		if ($heading != '')
@@ -939,7 +996,9 @@  discard block
 block discarded – undo
939 996
 			{
940 997
 				return false;
941 998
 			}
942
-		} else $heading = 0;
999
+		} else {
1000
+			$heading = 0;
1001
+		}
943 1002
 
944 1003
 		if ($groundspeed != '')
945 1004
 		{
@@ -947,9 +1006,13 @@  discard block
 block discarded – undo
947 1006
 			{
948 1007
 				return false;
949 1008
 			}
950
-		} else $groundspeed = 0;
1009
+		} else {
1010
+			$groundspeed = 0;
1011
+		}
951 1012
 		date_default_timezone_set('UTC');
952
-		if ($date == '') $date = date("Y-m-d H:i:s", time());
1013
+		if ($date == '') {
1014
+			$date = date("Y-m-d H:i:s", time());
1015
+		}
953 1016
 
954 1017
         
955 1018
 		$fammarine_id = filter_var($fammarine_id,FILTER_SANITIZE_STRING);
@@ -970,15 +1033,27 @@  discard block
 block discarded – undo
970 1033
 		$callsign = filter_var($callsign,FILTER_SANITIZE_STRING);
971 1034
 		$arrival_code = filter_var($arrival_code,FILTER_SANITIZE_STRING);
972 1035
 		$arrival_date = filter_var($arrival_date,FILTER_SANITIZE_STRING);
973
-		if ($typeid == '') $typeid = NULL;
974
-		if ($statusid == '') $statusid = NULL;
1036
+		if ($typeid == '') {
1037
+			$typeid = NULL;
1038
+		}
1039
+		if ($statusid == '') {
1040
+			$statusid = NULL;
1041
+		}
975 1042
 
976
-            	if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) $groundspeed = 0;
977
-            	if ($heading == '' || $Common->isInteger($heading) === false ) $heading = 0;
978
-            	if ($arrival_date == '') $arrival_date = NULL;
1043
+            	if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) {
1044
+            		$groundspeed = 0;
1045
+            	}
1046
+            	if ($heading == '' || $Common->isInteger($heading) === false ) {
1047
+            		$heading = 0;
1048
+            	}
1049
+            	if ($arrival_date == '') {
1050
+            		$arrival_date = NULL;
1051
+            	}
979 1052
             	$query = '';
980 1053
 		if ($globalArchive) {
981
-			if ($globalDebug) echo '-- Delete previous data -- ';
1054
+			if ($globalDebug) {
1055
+				echo '-- Delete previous data -- ';
1056
+			}
982 1057
 			$query .= 'DELETE FROM marine_live WHERE fammarine_id = :fammarine_id;';
983 1058
 		}
984 1059
 		$query .= 'INSERT INTO marine_live (fammarine_id, ident, latitude, longitude, heading, ground_speed, date, format_source, source_name, over_country, mmsi, type,type_id,status,status_id,imo,arrival_port_name,arrival_port_date) 
@@ -993,10 +1068,14 @@  discard block
 block discarded – undo
993 1068
 		}
994 1069
 		
995 1070
 		if (isset($globalArchive) && $globalArchive && $putinarchive && $noarchive !== true) {
996
-			if ($globalDebug) echo '(Add to Marine archive : ';
1071
+			if ($globalDebug) {
1072
+				echo '(Add to Marine archive : ';
1073
+			}
997 1074
 			$MarineArchive = new MarineArchive($this->db);
998 1075
 			$result =  $MarineArchive->addMarineArchiveData($fammarine_id, $ident, $latitude, $longitude, $heading, $groundspeed, $date, $putinarchive, $mmsi,$type,$typeid,$imo, $callsign,$arrival_code,$arrival_date,$status,$statusid,$noarchive,$format_source, $source_name, $over_country);
999
-			if ($globalDebug) echo $result.')';
1076
+			if ($globalDebug) {
1077
+				echo $result.')';
1078
+			}
1000 1079
 		}
1001 1080
 		return "success";
1002 1081
 	}
Please login to merge, or discard this patch.
marine-type-detailed.php 1 patch
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -14,7 +14,7 @@
 block discarded – undo
14 14
 		$limit_start = 0;
15 15
 		$limit_end = 25;
16 16
 		$absolute_difference = 25;
17
-	}  else {
17
+	} else {
18 18
 		$limit_explode = explode(",", $_GET['limit']);
19 19
 		$limit_start = $limit_explode[0];
20 20
 		$limit_end = $limit_explode[1];
Please login to merge, or discard this patch.
statistics-type.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -6,7 +6,9 @@
 block discarded – undo
6 6
 $title = _("Statistics").' - '._("Most common Vessel Type");
7 7
 
8 8
 $type = 'marine';
9
-if (!isset($filter_name)) $filter_name = '';
9
+if (!isset($filter_name)) {
10
+	$filter_name = '';
11
+}
10 12
 $year = filter_input(INPUT_GET,'year',FILTER_SANITIZE_NUMBER_INT);
11 13
 $month = filter_input(INPUT_GET,'month',FILTER_SANITIZE_NUMBER_INT);
12 14
 
Please login to merge, or discard this patch.