Completed
Push — master ( e40365...d4de89 )
by Yannick
30:56
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' && $MapType != 'offline' && $MapType != 'ArcGIS-Streetmap' && $MapType != 'ArcGIS-Satellite' && $MapType != 'NatGeo-Street') {
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, ' +
@@ -147,13 +156,23 @@  discard block
 block discarded – undo
147 156
 */
148 157
 ?>
149 158
 <?php
150
-	}  elseif (isset($globalMapCustomLayer[$MapType])) {
159
+	} elseif (isset($globalMapCustomLayer[$MapType])) {
151 160
 		$customid = $MapType;
152 161
 ?>
153 162
 	var imProv = Cesium.createOpenStreetMapImageryProvider({
154 163
 		url : '<?php print $globalMapCustomLayer[$customid]['url']; ?>',
155
-		maximumLevel: <?php if (isset($globalMapCustomLayer[$customid]['maxZoom'])) print $globalMapCustomLayer[$customid]['maxZoom']; else print '99'; ?>,
156
-		minimumLevel: <?php if (isset($globalMapCustomLayer[$customid]['minZoom'])) print $globalMapCustomLayer[$customid]['minZoom']; else print '0'; ?>,
164
+		maximumLevel: <?php if (isset($globalMapCustomLayer[$customid]['maxZoom'])) {
165
+	print $globalMapCustomLayer[$customid]['maxZoom'];
166
+} else {
167
+	print '99';
168
+}
169
+?>,
170
+		minimumLevel: <?php if (isset($globalMapCustomLayer[$customid]['minZoom'])) {
171
+	print $globalMapCustomLayer[$customid]['minZoom'];
172
+} else {
173
+	print '0';
174
+}
175
+?>,
157 176
 		credit: '<?php print $globalMapCustomLayer[$customid]['attribution']; ?>'
158 177
 	});
159 178
 <?php
@@ -480,8 +499,11 @@  discard block
 block discarded – undo
480 499
 	if (isset($_COOKIE['lastcentercoord']) || (isset($globalCenterLatitude) && isset($globalCenterLongitude) && $globalCenterLatitude != '' && $globalCenterLongitude != '')) {
481 500
 		if (isset($_COOKIE['lastcentercoord'])) {
482 501
 			$lastcentercoord = explode(',',$_COOKIE['lastcentercoord']);
483
-			if (!isset($lastcentercoord[3])) $zoom = $lastcentercoord[2]*1000000.0;
484
-			else $zoom = $lastcentercoord[3];
502
+			if (!isset($lastcentercoord[3])) {
503
+				$zoom = $lastcentercoord[2]*1000000.0;
504
+			} else {
505
+				$zoom = $lastcentercoord[3];
506
+			}
485 507
 			$viewcenterlatitude = $lastcentercoord[0];
486 508
 			$viewcenterlongitude = $lastcentercoord[1];
487 509
 		} else {
@@ -602,7 +624,12 @@  discard block
 block discarded – undo
602 624
 ?>
603 625
 
604 626
 update_locationsLayer();
605
-setInterval(function(){update_locationsLayer()},<?php if (isset($globalMapRefresh)) print $globalMapRefresh*1000*2; else print '60000'; ?>);
627
+setInterval(function(){update_locationsLayer()},<?php if (isset($globalMapRefresh)) {
628
+	print $globalMapRefresh*1000*2;
629
+} else {
630
+	print '60000';
631
+}
632
+?>);
606 633
 /*
607 634
 var handlera = new Cesium.ScreenSpaceEventHandler(viewer.canvas, false);
608 635
 handlera.setInputAction(
Please login to merge, or discard this patch.
js/map.2d.js.php 1 patch
Braces   +127 added lines, -30 removed lines patch added patch discarded remove patch
@@ -4,10 +4,15 @@  discard block
 block discarded – undo
4 4
 
5 5
 setcookie("MapFormat",'2d');
6 6
 
7
-if (!isset($globalOpenWeatherMapKey)) $globalOpenWeatherMapKey = '';
7
+if (!isset($globalOpenWeatherMapKey)) {
8
+	$globalOpenWeatherMapKey = '';
9
+}
8 10
 // Compressed GeoJson is used if true
9
-if (!isset($globalJsonCompress)) $compress = true;
10
-else $compress = $globalJsonCompress;
11
+if (!isset($globalJsonCompress)) {
12
+	$compress = true;
13
+} else {
14
+	$compress = $globalJsonCompress;
15
+}
11 16
 if (isset($_GET['archive'])) {
12 17
 	$archive = true;
13 18
 	//$archiveupdatetime = 50;
@@ -18,8 +23,11 @@  discard block
 block discarded – undo
18 23
 	//$lastupd = round(($_GET['enddate']-$_GET['begindate'])/(($_GET['during']*60)/10));
19 24
 	//$lastupd = 20;
20 25
 	$lastupd = $_GET['archivespeed']*$archiveupdatetime;
21
-	if (isset($_GET['enddate']) && $_GET['enddate'] != '') $enddate = $_GET['enddate'];
22
-	else $enddate = time();
26
+	if (isset($_GET['enddate']) && $_GET['enddate'] != '') {
27
+		$enddate = $_GET['enddate'];
28
+	} else {
29
+		$enddate = time();
30
+	}
23 31
 	setcookie("archive_begin",$begindate);
24 32
 	setcookie("archive_end",$enddate);
25 33
 	setcookie("archive_update",$lastupd);
@@ -107,7 +115,17 @@  discard block
 block discarded – undo
107 115
 	}
108 116
 
109 117
 	//create the map
110
-	map = L.map('archive-map', { zoomControl:false }).setView([<?php if (isset($latitude)) print $latitude; else print $globalCenterLatitude; ?>,<?php if (isset($longitude)) print $longitude; else print $globalCenterLongitude; ?>], zoom);
118
+	map = L.map('archive-map', { zoomControl:false }).setView([<?php if (isset($latitude)) {
119
+	print $latitude;
120
+} else {
121
+	print $globalCenterLatitude;
122
+}
123
+?>,<?php if (isset($longitude)) {
124
+	print $longitude;
125
+} else {
126
+	print $globalCenterLongitude;
127
+}
128
+?>], zoom);
111 129
 <?php
112 130
 	} else {
113 131
 		if ((isset($globalCenterLatitude) && $globalCenterLatitude != '' && isset($globalCenterLongitude) && $globalCenterLongitude != '') || isset($_COOKIE['lastcentercoord'])) {
@@ -133,9 +151,21 @@  discard block
 block discarded – undo
133 151
 	     || navigator.userAgent.match(/BlackBerry/i)
134 152
 	     || navigator.userAgent.match(/Windows Phone/i))
135 153
 	{
136
-		var zoom = <?php if (isset($viewzoom) && $viewzoom == $globalLiveZoom) print $viewzoom-1; elseif (isset($viewzoom)) print $viewzoom; else print '8'; ?>;
154
+		var zoom = <?php if (isset($viewzoom) && $viewzoom == $globalLiveZoom) {
155
+	print $viewzoom-1;
156
+} elseif (isset($viewzoom)) {
157
+	print $viewzoom;
158
+} else {
159
+	print '8';
160
+}
161
+?>;
137 162
 	} else {
138
-		var zoom = <?php if (isset($viewzoom)) print $viewzoom; else print '9'; ?>;
163
+		var zoom = <?php if (isset($viewzoom)) {
164
+	print $viewzoom;
165
+} else {
166
+	print '9';
167
+}
168
+?>;
139 169
 	}
140 170
 
141 171
 	//create the map
@@ -161,16 +191,27 @@  discard block
 block discarded – undo
161 191
 	bounds = L.latLngBounds(southWest,northEast);
162 192
 	//a few title layers
163 193
 <?php
164
-	if (isset($_COOKIE['MapType'])) $MapType = $_COOKIE['MapType'];
165
-	else $MapType = $globalMapProvider;
194
+	if (isset($_COOKIE['MapType'])) {
195
+		$MapType = $_COOKIE['MapType'];
196
+	} else {
197
+		$MapType = $globalMapProvider;
198
+	}
166 199
 
167 200
 	if ($MapType == 'Mapbox') {
168
-		if ($_COOKIE['MapTypeId'] == 'default') $MapBoxId = $globalMapboxId;
169
-		else $MapBoxId = $_COOKIE['MapTypeId'];
170
-?>
201
+		if ($_COOKIE['MapTypeId'] == 'default') {
202
+			$MapBoxId = $globalMapboxId;
203
+		} else {
204
+			$MapBoxId = $_COOKIE['MapTypeId'];
205
+		}
206
+		?>
171 207
 	L.tileLayer('https://{s}.tiles.mapbox.com/v4/{id}/{z}/{x}/{y}.png?access_token={token}', {
172 208
 	    maxZoom: 18,
173
-	    noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) print 'false'; else print 'true'; ?>,
209
+	    noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) {
210
+	print 'false';
211
+} else {
212
+	print 'true';
213
+}
214
+?>,
174 215
 	    attribution: '© <a href="https://www.mapbox.com/about/maps/">Mapbox</a> © <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a> <strong><a href="https://www.mapbox.com/map-feedback/" target="_blank">Improve this map</a></strong>',
175 216
 	    id: '<?php print $MapBoxId; ?>',
176 217
 	    token: '<?php print $globalMapboxToken; ?>'
@@ -189,7 +230,12 @@  discard block
 block discarded – undo
189 230
 ?>
190 231
 	L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
191 232
 	    maxZoom: 18,
192
-	    noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) print 'false'; else print 'true'; ?>,
233
+	    noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) {
234
+	print 'false';
235
+} else {
236
+	print 'true';
237
+}
238
+?>,
193 239
 	    attribution: 'Map data &copy; <a href="http://openstreetmap.org">OpenStreetMap</a> contributors, ' +
194 240
 	      '<a href="www.openstreetmap.org/copyright">Open Database Licence</a>'
195 241
 	}).addTo(map);
@@ -198,7 +244,12 @@  discard block
 block discarded – undo
198 244
 ?>
199 245
 	L.tileLayer('https://server.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer/tile/{z}/{y}/{x}', {
200 246
 	    maxZoom: 18,
201
-	    noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) print 'false'; else print 'true'; ?>,
247
+	    noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) {
248
+	print 'false';
249
+} else {
250
+	print 'true';
251
+}
252
+?>,
202 253
 	    attribution: 'Tiles &copy; Esri &mdash; Source: Esri, DeLorme, NAVTEQ, USGS, Intermap, iPC, NRCAN, Esri Japan, METI, Esri China (Hong Kong), Esri (Thailand), TomTom, 2012'
203 254
 	}).addTo(map);
204 255
 <?php
@@ -206,7 +257,12 @@  discard block
 block discarded – undo
206 257
 ?>
207 258
 	L.tileLayer('https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}', {
208 259
 	    maxZoom: 18,
209
-	    noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) print 'false'; else print 'true'; ?>,
260
+	    noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) {
261
+	print 'false';
262
+} else {
263
+	print 'true';
264
+}
265
+?>,
210 266
 	    attribution: 'Tiles &copy; Esri &mdash; Source: Esri, i-cubed, USDA, USGS, AEX, GeoEye, Getmapping, Aerogrid, IGN, IGP, UPR-EGP, and the GIS User Community'
211 267
 	}).addTo(map);
212 268
 <?php
@@ -214,7 +270,12 @@  discard block
 block discarded – undo
214 270
 ?>
215 271
 	L.tileLayer('https://server.arcgisonline.com/ArcGIS/rest/services/NatGeo_World_Map/MapServer/tile/{z}/{y}/{x}', {
216 272
 	    maxZoom: 18,
217
-	    noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) print 'false'; else print 'true'; ?>,
273
+	    noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) {
274
+	print 'false';
275
+} else {
276
+	print 'true';
277
+}
278
+?>,
218 279
 	    attribution: 'Tiles &copy; Esri &mdash; National Geographic, Esri, DeLorme, NAVTEQ, UNEP-WCMC, USGS, NASA, ESA, METI, NRCAN, GEBCO, NOAA, iPC'
219 280
 	}).addTo(map);
220 281
 <?php
@@ -259,20 +320,26 @@  discard block
 block discarded – undo
259 320
 	map.addLayer(yandexLayer);
260 321
 <?php
261 322
 	} elseif ($MapType == 'Bing-Aerial') {
262
-		if (!isset($globalBingMapKey) || $globalBingMapKey == '') setcookie('MapType','OpenStreetMap');
263
-?>
323
+		if (!isset($globalBingMapKey) || $globalBingMapKey == '') {
324
+			setcookie('MapType','OpenStreetMap');
325
+		}
326
+		?>
264 327
 	var bingLayer = new L.tileLayer.bing({bingMapsKey: '<?php print $globalBingMapKey; ?>',imagerySet: 'Aerial'});
265 328
 	map.addLayer(bingLayer);
266 329
 <?php
267 330
 	} elseif ($MapType == 'Bing-Hybrid') {
268
-		if (!isset($globalBingMapKey) || $globalBingMapKey == '') setcookie('MapType','OpenStreetMap');
269
-?>
331
+		if (!isset($globalBingMapKey) || $globalBingMapKey == '') {
332
+			setcookie('MapType','OpenStreetMap');
333
+		}
334
+		?>
270 335
 	var bingLayer = new L.tileLayer.bing({bingMapsKey: '<?php print $globalBingMapKey; ?>',imagerySet: 'AerialWithLabels'});
271 336
 	map.addLayer(bingLayer);
272 337
 <?php
273 338
 	} elseif ($MapType == 'Bing-Road') {
274
-		if (!isset($globalBingMapKey) || $globalBingMapKey == '') setcookie('MapType','OpenStreetMap');
275
-?>
339
+		if (!isset($globalBingMapKey) || $globalBingMapKey == '') {
340
+			setcookie('MapType','OpenStreetMap');
341
+		}
342
+		?>
276 343
 	var bingLayer = new L.tileLayer.bing({bingMapsKey: '<?php print $globalBingMapKey; ?>',imagerySet: 'Road'});
277 344
 	map.addLayer(bingLayer);
278 345
 <?php
@@ -301,7 +368,12 @@  discard block
 block discarded – undo
301 368
 	    maxZoom: 5,
302 369
 	    tms : true,
303 370
 	    zindex : 3,
304
-	    noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) print 'false'; else print 'true'; ?>,
371
+	    noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) {
372
+	print 'false';
373
+} else {
374
+	print 'true';
375
+}
376
+?>,
305 377
 	    attribution: 'Natural Earth'
306 378
 	}).addTo(map);
307 379
 <?php
@@ -309,9 +381,24 @@  discard block
 block discarded – undo
309 381
 		$customid = $MapType;
310 382
 ?>
311 383
 	L.tileLayer('<?php print $globalMapCustomLayer[$customid]['url']; ?>/{z}/{x}/{y}.png', {
312
-	    maxZoom: <?php if (isset($globalMapCustomLayer[$customid]['maxZoom'])) print $globalMapCustomLayer[$customid]['maxZoom']; else print '18'; ?>,
313
-	    minZoom: <?php if (isset($globalMapCustomLayer[$customid]['minZoom'])) print $globalMapCustomLayer[$customid]['minZoom']; else print '0'; ?>,
314
-	    noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) print 'false'; else print 'true'; ?>,
384
+	    maxZoom: <?php if (isset($globalMapCustomLayer[$customid]['maxZoom'])) {
385
+	print $globalMapCustomLayer[$customid]['maxZoom'];
386
+} else {
387
+	print '18';
388
+}
389
+?>,
390
+	    minZoom: <?php if (isset($globalMapCustomLayer[$customid]['minZoom'])) {
391
+	print $globalMapCustomLayer[$customid]['minZoom'];
392
+} else {
393
+	print '0';
394
+}
395
+?>,
396
+	    noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) {
397
+	print 'false';
398
+} else {
399
+	print 'true';
400
+}
401
+?>,
315 402
 	    attribution: '<?php print $globalMapCustomLayer[$customid]['attribution']; ?>'
316 403
 	}).addTo(map);
317 404
 
@@ -351,7 +438,12 @@  discard block
 block discarded – undo
351 438
 		}
352 439
 	} elseif ($globalBounding == 'circle') {
353 440
 ?>
354
-	var circle = L.circle([<?php print $globalCenterLatitude; ?>, <?php print $globalCenterLongitude; ?>],<?php if (isset($globalBoundingCircleSize)) print $globalBoundingCircleSize; else print '70000'; ?>,{
441
+	var circle = L.circle([<?php print $globalCenterLatitude; ?>, <?php print $globalCenterLongitude; ?>],<?php if (isset($globalBoundingCircleSize)) {
442
+	print $globalBoundingCircleSize;
443
+} else {
444
+	print '70000';
445
+}
446
+?>,{
355 447
 	    color: '#92C7D1',
356 448
 	    fillColor: '#92C7D1',
357 449
 	    fillOpacity: 0.3,
@@ -443,7 +535,12 @@  discard block
 block discarded – undo
443 535
 		createCookie('lastcentercoord',map.getCenter().lat+','+map.getCenter().lng+','+map.getZoom(),2);
444 536
 	});
445 537
 update_locationsLayer();
446
-setInterval(function(){if (noTimeout) update_locationsLayer()},<?php if (isset($globalMapRefresh)) print $globalMapRefresh*1000*2; else print '60000'; ?>);
538
+setInterval(function(){if (noTimeout) update_locationsLayer()},<?php if (isset($globalMapRefresh)) {
539
+	print $globalMapRefresh*1000*2;
540
+} else {
541
+	print '60000';
542
+}
543
+?>);
447 544
 
448 545
 <?php
449 546
     // Add support for custom json via $globalMapJson
Please login to merge, or discard this patch.
aircraft-data.php 1 patch
Braces   +52 added lines, -19 removed lines patch added patch discarded remove patch
@@ -58,7 +58,9 @@  discard block
 block discarded – undo
58 58
 	{
59 59
 		if ($spotter_item['image_source'] == 'flickr' || $spotter_item['image_source'] == 'wikimedia' || $spotter_item['image_source'] == 'devianart') {
60 60
 			$image = preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']);
61
-		} else $image = $spotter_item['image_thumbnail'];
61
+		} else {
62
+			$image = $spotter_item['image_thumbnail'];
63
+		}
62 64
 	}
63 65
 	/* else {
64 66
 		$image = "images/placeholder_thumb.png";
@@ -73,8 +75,12 @@  discard block
 block discarded – undo
73 75
 	}
74 76
 	print '<div class="right">';
75 77
 	print '<div class="callsign-details">';
76
-	if ($spotter_item['ident'] != 'Not Available') print '<div class="callsign"><a href="'.$globalURL.'/redirect/'.$spotter_item['flightaware_id'].'" target="_blank">'.$spotter_item['ident'].'</a></div>';
77
-	if (isset($spotter_item['airline_name']) && $spotter_item['airline_name'] != 'Not Available') print '<div class="airline">'.$spotter_item['airline_name'].'</div>';
78
+	if ($spotter_item['ident'] != 'Not Available') {
79
+		print '<div class="callsign"><a href="'.$globalURL.'/redirect/'.$spotter_item['flightaware_id'].'" target="_blank">'.$spotter_item['ident'].'</a></div>';
80
+	}
81
+	if (isset($spotter_item['airline_name']) && $spotter_item['airline_name'] != 'Not Available') {
82
+		print '<div class="airline">'.$spotter_item['airline_name'].'</div>';
83
+	}
78 84
 	print '</div>';
79 85
 	if ($spotter_item['departure_airport'] != 'NA' && $spotter_item['arrival_airport'] != 'NA') {
80 86
 		print '<div class="nomobile airports"><div class="airport"><span class="code"><a href="'.$globalURL.'/airport/'.$spotter_item['departure_airport'].'" target="_blank">'.$spotter_item['departure_airport'].'</a></span>'.$spotter_item['departure_airport_city'].' '.$spotter_item['departure_airport_country'];
@@ -106,13 +112,21 @@  discard block
 block discarded – undo
106 112
 	print '</div>';
107 113
 	print '<div id="aircraft">';
108 114
 	print '<span>'._("Aircraft").'</span>';
109
-	if (isset($spotter_item['aircraft_wiki'])) print '<a href="'.$spotter_item['aircraft_wiki'].'">'.$spotter_item['aircraft_name'].'</a>';
115
+	if (isset($spotter_item['aircraft_wiki'])) {
116
+		print '<a href="'.$spotter_item['aircraft_wiki'].'">'.$spotter_item['aircraft_name'].'</a>';
117
+	}
110 118
 	if (isset($spotter_item['aircraft_type']) && isset($spotter_item['aircraft_manufacturer']) && $spotter_item['aircraft_manufacturer'] != 'N/A' && isset($spotter_item['aircraft_name']) && $spotter_item['aircraft_name'] != 'N/A') {
111 119
 		$aircraft_names = explode('/',$spotter_item['aircraft_name']);
112
-		if (count($aircraft_names) == 1) print '<a href="'.$globalURL.'/aircraft/'.$spotter_item['aircraft_type'].'">'.$spotter_item['aircraft_manufacturer'].' '.$spotter_item['aircraft_name'].' ('.$spotter_item['aircraft_type'].')</a>';
113
-		else print '<a href="'.$globalURL.'/aircraft/'.$spotter_item['aircraft_type'].'" title="'.$spotter_item['aircraft_name'].'">'.$spotter_item['aircraft_manufacturer'].' '.$aircraft_names[0].' ('.$spotter_item['aircraft_type'].')</a>';
114
-	} elseif (isset($spotter_item['aircraft_type'])) print '<a href="'.$globalURL.'/aircraft/'.$spotter_item['aircraft_type'].'">'.$spotter_item['aircraft_type'].'</a>';
115
-	else print $spotter_item['aircraft_manufacturer'].' '.$spotter_item['aircraft_name'];
120
+		if (count($aircraft_names) == 1) {
121
+			print '<a href="'.$globalURL.'/aircraft/'.$spotter_item['aircraft_type'].'">'.$spotter_item['aircraft_manufacturer'].' '.$spotter_item['aircraft_name'].' ('.$spotter_item['aircraft_type'].')</a>';
122
+		} else {
123
+			print '<a href="'.$globalURL.'/aircraft/'.$spotter_item['aircraft_type'].'" title="'.$spotter_item['aircraft_name'].'">'.$spotter_item['aircraft_manufacturer'].' '.$aircraft_names[0].' ('.$spotter_item['aircraft_type'].')</a>';
124
+		}
125
+	} elseif (isset($spotter_item['aircraft_type'])) {
126
+		print '<a href="'.$globalURL.'/aircraft/'.$spotter_item['aircraft_type'].'">'.$spotter_item['aircraft_type'].'</a>';
127
+	} else {
128
+		print $spotter_item['aircraft_manufacturer'].' '.$spotter_item['aircraft_name'];
129
+	}
116 130
 	
117 131
 	print '</div>';
118 132
 	print '<div id ="altitude"><span>'._("Altitude").'</span>';
@@ -125,11 +139,17 @@  discard block
 block discarded – undo
125 139
 	}
126 140
 
127 141
 	if ((!isset($_COOKIE['unitaltitude']) && isset($globalUnitAltitude) && $globalUnitAltitude == 'feet') || (isset($_COOKIE['unitaltitude']) && $_COOKIE['unitaltitude'] == 'feet')) {
128
-		if (isset($spotter_item['real_altitude']) && $spotter_item['real_altitude'] != '') print $spotter_item['real_altitude'].' feet (FL'.$spotter_item['altitude'].')';
129
-		else print $spotter_item['altitude'].'00 feet (FL'.$spotter_item['altitude'].')';
142
+		if (isset($spotter_item['real_altitude']) && $spotter_item['real_altitude'] != '') {
143
+			print $spotter_item['real_altitude'].' feet (FL'.$spotter_item['altitude'].')';
144
+		} else {
145
+			print $spotter_item['altitude'].'00 feet (FL'.$spotter_item['altitude'].')';
146
+		}
130 147
 	} else {
131
-		if (isset($spotter_item['real_altitude']) && $spotter_item['real_altitude'] != '') print round($spotter_item['real_altitude']*0.3048).' m (FL'.$spotter_item['altitude'].')';
132
-		else print round($spotter_item['altitude']*30.48).' m (FL'.$spotter_item['altitude'].')';
148
+		if (isset($spotter_item['real_altitude']) && $spotter_item['real_altitude'] != '') {
149
+			print round($spotter_item['real_altitude']*0.3048).' m (FL'.$spotter_item['altitude'].')';
150
+		} else {
151
+			print round($spotter_item['altitude']*30.48).' m (FL'.$spotter_item['altitude'].')';
152
+		}
133 153
 	}
134 154
 
135 155
 	if (isset($groundAltitude) && $groundAltitude < $spotter_item['altitude']*30.48) {
@@ -143,7 +163,9 @@  discard block
 block discarded – undo
143 163
 		print '</i>';
144 164
 	}
145 165
 	print '</div>';
146
-	if (isset($spotter_item['registration']) && $spotter_item['registration'] != '') print '<div><span>'._("Registration").'</span><a href="'.$globalURL.'/registration/'.$spotter_item['registration'].'" target="_blank">'.$spotter_item['registration'].'</a></div>';
166
+	if (isset($spotter_item['registration']) && $spotter_item['registration'] != '') {
167
+		print '<div><span>'._("Registration").'</span><a href="'.$globalURL.'/registration/'.$spotter_item['registration'].'" target="_blank">'.$spotter_item['registration'].'</a></div>';
168
+	}
147 169
 	print '<div id="speed"><span>'._("Speed").'</span>';
148 170
 	if ((!isset($_COOKIE['unitspeed']) && isset($globalUnitSpeed) && $globalUnitSpeed == 'mph') || (isset($_COOKIE['unitspeed']) && $_COOKIE['unitspeed'] == 'mph')) {
149 171
 		print round($spotter_item['ground_speed']*1.15078).' mph';
@@ -176,8 +198,11 @@  discard block
 block discarded – undo
176 198
 	print '<div id="heading"><span>'._("Heading").'</span>'.$spotter_item['heading'].'°</div>';
177 199
 	if (isset($spotter_item['pilot_name']) && $spotter_item['pilot_name'] != '') {
178 200
 		print '<div id="pilot"><span>'._("Pilot").'</span>';
179
-		if (isset($spotter_item['pilot_id'])) print $spotter_item['pilot_name'].' ('.$spotter_item['pilot_id'].')';
180
-		else print $spotter_item['pilot_name'];
201
+		if (isset($spotter_item['pilot_id'])) {
202
+			print $spotter_item['pilot_name'].' ('.$spotter_item['pilot_id'].')';
203
+		} else {
204
+			print $spotter_item['pilot_name'];
205
+		}
181 206
 		print '</div>';
182 207
 	}
183 208
 	if (isset($spotter_item['aircraft_owner']) && $spotter_item['aircraft_owner'] != '') {
@@ -203,10 +228,18 @@  discard block
 block discarded – undo
203 228
 	}
204 229
 	print '</div>';
205 230
 	print '</div>';
206
-	if (isset($globalVA) && $globalVA && isset($globalphpVMS) && $globalphpVMS && isset($globalVATSIM) && $globalVATSIM && isset($globalIVAO) && $globalIVAO && isset($spotter_item['format_source']) && $spotter_item['format_source'] != '' && $spotter_item['format_source'] != 'pireps') print '<div class="waypoints"><span>'._("Source").'</span>'.$spotter_item['format_source'].'</div>';
207
-	if (isset($spotter_item['waypoints']) && $spotter_item['waypoints'] != '') print '<div class="waypoints"><span>'._("Route").'</span>'.$spotter_item['waypoints'].'</div>';
208
-	if (isset($spotter_item['acars']['message'])) print '<div class="acars"><span>'._("Latest ACARS message").'</span>'.trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'<br/>',$spotter_item['acars']['message'])).'</div>';
209
-	if (isset($spotter_item['squawk']) && $spotter_item['squawk'] != '' && $spotter_item['squawk'] != 0) print '<div class="bottom">'._("Squawk:").' '.$spotter_item['squawk'].' - '.$spotter_item['squawk_usage'].'</div>';
231
+	if (isset($globalVA) && $globalVA && isset($globalphpVMS) && $globalphpVMS && isset($globalVATSIM) && $globalVATSIM && isset($globalIVAO) && $globalIVAO && isset($spotter_item['format_source']) && $spotter_item['format_source'] != '' && $spotter_item['format_source'] != 'pireps') {
232
+		print '<div class="waypoints"><span>'._("Source").'</span>'.$spotter_item['format_source'].'</div>';
233
+	}
234
+	if (isset($spotter_item['waypoints']) && $spotter_item['waypoints'] != '') {
235
+		print '<div class="waypoints"><span>'._("Route").'</span>'.$spotter_item['waypoints'].'</div>';
236
+	}
237
+	if (isset($spotter_item['acars']['message'])) {
238
+		print '<div class="acars"><span>'._("Latest ACARS message").'</span>'.trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'<br/>',$spotter_item['acars']['message'])).'</div>';
239
+	}
240
+	if (isset($spotter_item['squawk']) && $spotter_item['squawk'] != '' && $spotter_item['squawk'] != 0) {
241
+		print '<div class="bottom">'._("Squawk:").' '.$spotter_item['squawk'].' - '.$spotter_item['squawk_usage'].'</div>';
242
+	}
210 243
 	print '</div>';
211 244
 }
212 245
 ?>
Please login to merge, or discard this patch.
table-output.php 1 patch
Braces   +68 added lines, -25 removed lines patch added patch discarded remove patch
@@ -7,7 +7,9 @@  discard block
 block discarded – undo
7 7
 $showRouteStop = $Common->multiKeyExists($spotter_array,'route_stop');
8 8
 $showDuration = $Common->multiKeyExists($spotter_array,'duration');
9 9
 
10
-if (!isset($type)) $type = 'aircraft';
10
+if (!isset($type)) {
11
+	$type = 'aircraft';
12
+}
11 13
 
12 14
 if (!isset($_GET['sort'])) 
13 15
 {
@@ -492,7 +494,9 @@  discard block
 block discarded – undo
492 494
 	if (isset($globalTimezone))
493 495
 	{
494 496
 		date_default_timezone_set($globalTimezone);
495
-	} else date_default_timezone_set('UTC');
497
+	} else {
498
+		date_default_timezone_set('UTC');
499
+	}
496 500
 	if ($showSpecial === true)
497 501
 	{
498 502
 		print '<tr class="special">'."\n";
@@ -507,7 +511,9 @@  discard block
 block discarded – undo
507 511
 			print '<tr class="active">';
508 512
 		} elseif (isset($spotter_item['spotted_registration'])) {
509 513
 			print '<tr class="info">';
510
-		} else print '<tr>';
514
+		} else {
515
+			print '<tr>';
516
+		}
511 517
 	}
512 518
 	if (strtolower($current_page) == "acars-latest" || strtolower($current_page) == "acars-archive" || strtolower($current_page) == "currently" || strtolower($current_page) == "accident-latest" || strtolower($current_page) == "incident-latest" || strtolower($current_page) == "accident-detailed" || strtolower($current_page) == "incident-detailed") {
513 519
 		if ($type == 'aircraft') {
@@ -515,8 +521,9 @@  discard block
 block discarded – undo
515 521
 			{
516 522
 				print '<td class="aircraft_thumbnail">'."\n";
517 523
 				if ($spotter_item['image_source'] == 'planespotters') {
518
-					if ($spotter_item['image_source_website'] != '') $image_src = $spotter_item['image_source_website'];
519
-					else {
524
+					if ($spotter_item['image_source_website'] != '') {
525
+						$image_src = $spotter_item['image_source_website'];
526
+					} else {
520 527
 						$planespotter_url_array = explode("_", $spotter_item['image']);
521 528
 						$planespotter_id = str_replace(".jpg", "", $planespotter_url_array[1]);
522 529
 						$image_src = 'https://www.planespotters.net/Aviation_Photos/photo.show?id='.$planespotter_id;
@@ -529,7 +536,9 @@  discard block
 block discarded – undo
529 536
 				} else {
530 537
 					if ($spotter_item['image_source'] == 'wikimedia' || $spotter_item['image_source'] == 'devianart' || $spotter_item['image_source'] == 'flickr') {
531 538
 						$image_thumbnail = preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']);
532
-					} else 	$image_thumbnail = $spotter_item['image_thumbnail'];
539
+					} else {
540
+						$image_thumbnail = $spotter_item['image_thumbnail'];
541
+					}
533 542
 					if (isset($spotter_item['airline_name'])) {
534 543
 						print '<img src="'.$image_thumbnail.'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['registration'].' - '.$spotter_item['airline_name'].'" alt="'.$spotter_item['registration'].' - '.$spotter_item['airline_name'].'" data-content="'._("Registration:").' '.$spotter_item['registration'].'<br />'._("Airline:").' '.$spotter_item['airline_name'].'" data-html="true" width="100px" />'."\n".'<div class="thumbnail-copyright">&copy; '.$spotter_item['image_copyright'].'</div>';
535 544
 					} else {
@@ -548,7 +557,9 @@  discard block
 block discarded – undo
548 557
 				print '<td class="aircraft_thumbnail">'."\n";
549 558
 				if ($spotter_item['image_source'] == 'wikimedia' || $spotter_item['image_source'] == 'devianart' || $spotter_item['image_source'] == 'flickr') {
550 559
 					$image_thumbnail = preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']);
551
-				} else 	$image_thumbnail = $spotter_item['image_thumbnail'];
560
+				} else {
561
+					$image_thumbnail = $spotter_item['image_thumbnail'];
562
+				}
552 563
 				if (isset($spotter_item['airline_name'])) {
553 564
 					print '<img src="'.$image_thumbnail.'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['mmsi'].'" alt="'.$spotter_item['mmsi'].'" data-content="'._("MMSI:").' '.$spotter_item['mmsi'].'" data-html="true" width="100px" />'."\n".'<div class="thumbnail-copyright">&copy; '.$spotter_item['image_copyright'].'</div>';
554 565
 				} else {
@@ -566,7 +577,9 @@  discard block
 block discarded – undo
566 577
 				print '<td class="aircraft_thumbnail">'."\n";
567 578
 				if ($spotter_item['image_source'] == 'wikimedia' || $spotter_item['image_source'] == 'devianart' || $spotter_item['image_source'] == 'flickr') {
568 579
 					$image_thumbnail = preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']);
569
-				} else 	$image_thumbnail = $spotter_item['image_thumbnail'];
580
+				} else {
581
+					$image_thumbnail = $spotter_item['image_thumbnail'];
582
+				}
570 583
 				print '<img src="'.$image_thumbnail.'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['ident'].'" alt="'.$spotter_item['type'].'" data-content="'._("Type:").' '.$spotter_item['type'].'" data-html="true" width="100px" />'."\n".'<div class="thumbnail-copyright">&copy; '.$spotter_item['image_copyright'].'</div>';
571 584
 				print '</td>'."\n";
572 585
 			} else {
@@ -619,8 +632,9 @@  discard block
 block discarded – undo
619 632
 				print '<td class="aircraft_thumbnail">'."\n";
620 633
 				//print '<a href="'.$globalURL.'/flightid/'.$spotter_item['spotter_id'].'"><img src="'.$spotter_item['image_thumbnail'].'" alt="Click to see more information about this flight" title="Click to see more information about this flight" width="100px" /></a>';
621 634
 				if ($spotter_item['image_source'] == 'planespotters') {
622
-					if ($spotter_item['image_source_website'] != '') $image_src = $spotter_item['image_source_website'];
623
-					else {
635
+					if ($spotter_item['image_source_website'] != '') {
636
+						$image_src = $spotter_item['image_source_website'];
637
+					} else {
624 638
 						$planespotter_url_array = explode("_", $spotter_array[0]['image']);
625 639
 						$planespotter_id = str_replace(".jpg", "", $planespotter_url_array[1]);
626 640
 						$image_src = 'https://www.planespotters.net/Aviation_Photos/photo.show?id='.$planespotter_id;
@@ -637,7 +651,9 @@  discard block
 block discarded – undo
637 651
 				} else {
638 652
 					if ($spotter_item['image_source'] == 'wikimedia' || $spotter_item['image_source'] == 'devianart' || $spotter_item['image_source'] == 'flickr') {
639 653
 						$image_thumbnail = preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']);
640
-					} else 	$image_thumbnail = $spotter_item['image_thumbnail'];
654
+					} else {
655
+						$image_thumbnail = $spotter_item['image_thumbnail'];
656
+					}
641 657
 					if (!isset($spotter_item['airline_name']) && isset($spotter_item['aircraft_name'])) {
642 658
 						print '<a href="'.$globalURL.'/flightid/'.$spotter_item['spotter_id'].'"><img src="'.$image_thumbnail.'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '._("Not available").'" alt="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '._("Not available").'" data-content="'._("Registration:").' '.$spotter_item['registration'].'<br />'._("Aircraft:").' '.$spotter_item['aircraft_name'].' ('.$spotter_item['aircraft_type'].')<br />'._("Airline:").' '._("Not available").'<br />'._("Squawk:").' '.$spotter_item['squawk'].'" data-html="true" width="100px" /></a>'."\n".'<div class="thumbnail-copyright">&copy; '.$spotter_item['image_copyright'].'</div>';
643 659
 					} elseif (!isset($spotter_item['aircraft_name']) && isset($spotter_item['airline_name'])) {
@@ -670,7 +686,9 @@  discard block
 block discarded – undo
670 686
 				print '<td class="aircraft_thumbnail">'."\n";
671 687
 				if ($spotter_item['image_source'] == 'wikimedia' || $spotter_item['image_source'] == 'devianart' || $spotter_item['image_source'] == 'flickr') {
672 688
 					$image_thumbnail = preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']);
673
-				} else 	$image_thumbnail = $spotter_item['image_thumbnail'];
689
+				} else {
690
+					$image_thumbnail = $spotter_item['image_thumbnail'];
691
+				}
674 692
 				print '<img src="'.$image_thumbnail.'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['mmsi'].'" alt="'.$spotter_item['mmsi'].'" data-content="'._("MMSI:").' '.$spotter_item['mmsi'].'" data-html="true" width="100px" />'."\n".'<div class="thumbnail-copyright">&copy; '.$spotter_item['image_copyright'].'</div>';
675 693
 				print '</td>'."\n";
676 694
 			} else {
@@ -684,7 +702,9 @@  discard block
 block discarded – undo
684 702
 				print '<td class="aircraft_thumbnail">'."\n";
685 703
 				if ($spotter_item['image_source'] == 'wikimedia' || $spotter_item['image_source'] == 'devianart' || $spotter_item['image_source'] == 'flickr') {
686 704
 					$image_thumbnail = preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']);
687
-				} else 	$image_thumbnail = $spotter_item['image_thumbnail'];
705
+				} else {
706
+					$image_thumbnail = $spotter_item['image_thumbnail'];
707
+				}
688 708
 				print '<img src="'.$image_thumbnail.'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['ident'].'" alt="'.$spotter_item['type'].'" data-content="'._("Type:").' '.$spotter_item['type'].'" data-html="true" width="100px" />'."\n".'<div class="thumbnail-copyright">&copy; '.$spotter_item['image_copyright'].'</div>';
689 709
 				print '</td>'."\n";
690 710
 			} else {
@@ -802,8 +822,11 @@  discard block
 block discarded – undo
802 822
 				print '<span class="nomobile"><a href="'.$globalURL.'/aircraft/'.$spotter_item['aircraft_type'].'">'.$spotter_item['aircraft_type'].'</a></span>'."\n";
803 823
 			} else {
804 824
 				$aircraft_names = explode('/',$spotter_item['aircraft_name']);
805
-				if (count($aircraft_names) == 1) print '<span class="nomobile"><a href="'.$globalURL.'/aircraft/'.$spotter_item['aircraft_type'].'">'.$spotter_item['aircraft_manufacturer'].' '.$spotter_item['aircraft_name'].'</a></span>'."\n";
806
-				else print '<span class="nomobile"><a href="'.$globalURL.'/aircraft/'.$spotter_item['aircraft_type'].'" title="'.$spotter_item['aircraft_name'].'">'.$spotter_item['aircraft_manufacturer'].' '.$aircraft_names[0].'</a></span>'."\n";
825
+				if (count($aircraft_names) == 1) {
826
+					print '<span class="nomobile"><a href="'.$globalURL.'/aircraft/'.$spotter_item['aircraft_type'].'">'.$spotter_item['aircraft_manufacturer'].' '.$spotter_item['aircraft_name'].'</a></span>'."\n";
827
+				} else {
828
+					print '<span class="nomobile"><a href="'.$globalURL.'/aircraft/'.$spotter_item['aircraft_type'].'" title="'.$spotter_item['aircraft_name'].'">'.$spotter_item['aircraft_manufacturer'].' '.$aircraft_names[0].'</a></span>'."\n";
829
+				}
807 830
 			}
808 831
 			print '<span class="mobile"><a href="'.$globalURL.'/aircraft/'.$spotter_item['aircraft_type'].'">'.$spotter_item['aircraft_type'].'</a></span>'."\n";
809 832
 		} elseif ($type == 'marine') {
@@ -846,15 +869,21 @@  discard block
 block discarded – undo
846 869
 			if (isset($spotter_item['departure_airport_time']) && isset($spotter_item['real_departure_airport_time'])) {
847 870
 				if ($spotter_item['departure_airport_time'] > 2460) {
848 871
 					$departure_airport_time = date('H:m',$spotter_item['departure_airport_time']);
849
-				} else $departure_airport_time = substr($spotter_item['departure_airport_time'],0,-2).':'.substr($spotter_item['departure_airport_time'],-2);
872
+				} else {
873
+					$departure_airport_time = substr($spotter_item['departure_airport_time'],0,-2).':'.substr($spotter_item['departure_airport_time'],-2);
874
+				}
850 875
 				if ($spotter_item['real_departure_airport_time'] > 2460) {
851 876
 					$real_departure_airport_time = date('H:m',$spotter_item['real_departure_airport_time']);
852
-				} else $real_departure_airport_time = $spotter_item['real_departure_airport_time'];
877
+				} else {
878
+					$real_departure_airport_time = $spotter_item['real_departure_airport_time'];
879
+				}
853 880
 				print '<br /><span class="airport_time">'.$departure_airport_time.' ('.$real_departure_airport_time.')</span>'."\n";
854 881
 			} elseif (isset($spotter_item['real_departure_airport_time']) && $spotter_item['real_departure_airport_time'] != 'NULL') {
855 882
 				if ($spotter_item['real_departure_airport_time'] > 2460) {
856 883
 					$real_departure_airport_time = date('H:m',$spotter_item['real_departure_airport_time']);
857
-				} else $real_departure_airport_time = $spotter_item['real_departure_airport_time'];
884
+				} else {
885
+					$real_departure_airport_time = $spotter_item['real_departure_airport_time'];
886
+				}
858 887
 				print '<br /><span class="airport_time">'.$real_departure_airport_time.'</span>'."\n";
859 888
 			} elseif (isset($spotter_item['departure_airport_time']) && $spotter_item['departure_airport_time'] != 'NULL') {
860 889
 				if ($spotter_item['departure_airport_time'] > 2460) {
@@ -876,7 +905,9 @@  discard block
 block discarded – undo
876 905
 						$longitude = $spotter_item['longitude'];
877 906
 					}
878 907
 					$distance = $Spotter->getAirportDistance($spotter_item['departure_airport'],$latitude,$longitude);
879
-				} else $distance = '';
908
+				} else {
909
+					$distance = '';
910
+				}
880 911
 				if ($distance != '') {
881 912
 					if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'nm') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'nm')) {
882 913
 						echo '<br/><i>'.round($distance*0.539957).' nm</i>';
@@ -903,7 +934,9 @@  discard block
 block discarded – undo
903 934
 			} else {
904 935
 				if (isset($spotter_item['real_arrival_airport']) && $spotter_item['real_arrival_airport'] != $spotter_item['arrival_airport']) {
905 936
 					print '<span class="nomobile">Scheduled : <a href="'.$globalURL.'/airport/'.$spotter_item['arrival_airport'].'">'.$spotter_item['arrival_airport_city'].', '.$spotter_item['arrival_airport_country'].' ('.$spotter_item['arrival_airport'].')</a></span>'."\n";
906
-					if (!isset($Spotter)) $Spotter = new Spotter();
937
+					if (!isset($Spotter)) {
938
+						$Spotter = new Spotter();
939
+					}
907 940
 					$arrival_airport_info = $Spotter->getAllAirportInfo($spotter_item['real_arrival_airport']);
908 941
 					print '<br /><span class="nomobile">'._("Real:").' <a href="'.$globalURL.'/airport/'.$spotter_item['real_arrival_airport'].'">'.$arrival_airport_info[0]['city'].','.$arrival_airport_info[0]['country'].' ('.$spotter_item['real_arrival_airport'].')</a></span>'."\n";
909 942
 					print '<span class="mobile">'._("Scheduled:").' <a href="'.$globalURL.'/airport/'.$spotter_item['real_arrival_airport'].'">'.$spotter_item['real_arrival_airport'].'</a></span>'."\n";
@@ -919,20 +952,28 @@  discard block
 block discarded – undo
919 952
 			if (isset($spotter_item['arrival_airport_time']) && isset($spotter_item['real_arrival_airport_time'])) {
920 953
 				if ($spotter_item['arrival_airport_time'] > 2460) {
921 954
 					$arrival_airport_time = date('H:m',$spotter_item['arrival_airport_time']);
922
-				} else $arrival_airport_time = $spotter_item['arrival_airport_time'];
955
+				} else {
956
+					$arrival_airport_time = $spotter_item['arrival_airport_time'];
957
+				}
923 958
 				if ($spotter_item['real_arrival_airport_time'] > 2460) {
924 959
 					$real_arrival_airport_time = date('H:m',$spotter_item['real_arrival_airport_time']);
925
-				} else $real_arrival_airport_time = $spotter_item['real_arrival_airport_time'];
960
+				} else {
961
+					$real_arrival_airport_time = $spotter_item['real_arrival_airport_time'];
962
+				}
926 963
 				print '<br /><span class="airport_time">'.$spotter_item['arrival_airport_time'].' ('.$spotter_item['real_arrival_airport_time'].')</span>'."\n";
927 964
 			} elseif (isset($spotter_item['real_arrival_airport_time'])) {
928 965
 				if ($spotter_item['real_arrival_airport_time'] > 2460) {
929 966
 					$real_arrival_airport_time = date('H:m',$spotter_item['real_arrival_airport_time']);
930
-				} else $real_arrival_airport_time = $spotter_item['real_arrival_airport_time'];
967
+				} else {
968
+					$real_arrival_airport_time = $spotter_item['real_arrival_airport_time'];
969
+				}
931 970
 				print '<br /><span class="airport_time">'.$real_arrival_airport_time.'</span>'."\n";
932 971
 			} elseif (isset($spotter_item['arrival_airport_time']) && $spotter_item['arrival_airport_time'] != 'NULL') {
933 972
 				if ($spotter_item['arrival_airport_time'] > 2460) {
934 973
 					$arrival_airport_time = date('H:m',$spotter_item['arrival_airport_time']);
935
-				} else $arrival_airport_time = $spotter_item['arrival_airport_time'];
974
+				} else {
975
+					$arrival_airport_time = $spotter_item['arrival_airport_time'];
976
+				}
936 977
 				print '<br /><span class="airport_time">'.$arrival_airport_time.'</span>'."\n";
937 978
 			}
938 979
 			if (!isset($spotter_item['real_arrival_airport']) && $spotter_item['arrival_airport'] != 'NA') {
@@ -945,7 +986,9 @@  discard block
 block discarded – undo
945 986
 						$longitude = $spotter_item['longitude'];
946 987
 					}
947 988
 					$distance = $Spotter->getAirportDistance($spotter_item['arrival_airport'],$latitude,$longitude);
948
-				} else $distance = '';
989
+				} else {
990
+					$distance = '';
991
+				}
949 992
 				if ($distance != '') {
950 993
 					if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'nm') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'nm')) {
951 994
 						echo '<br/><i>'.round($distance*0.539957).' nm</i>';
Please login to merge, or discard this patch.
require/class.NOTAM.php 1 patch
Braces   +219 added lines, -92 removed lines patch added patch discarded remove patch
@@ -1036,8 +1036,11 @@  discard block
 block discarded – undo
1036 1036
 	public function parseNOTAMtextFile($filename) {
1037 1037
 		$data = file_get_contents($filename);
1038 1038
 		preg_match_all("/%%(.+?)%%/is", $data, $matches);
1039
-		if (isset($matches[1])) return $matches[1];
1040
-		else return array();
1039
+		if (isset($matches[1])) {
1040
+			return $matches[1];
1041
+		} else {
1042
+			return array();
1043
+		}
1041 1044
 	}
1042 1045
 	public function getAllNOTAMbyScope($scope) {
1043 1046
 		global $globalDBdriver;
@@ -1073,7 +1076,9 @@  discard block
 block discarded – undo
1073 1076
 				$minlong = $maxlong;
1074 1077
 				$maxlong = $tmplong;
1075 1078
 			}
1076
-		} else return array();
1079
+		} else {
1080
+			return array();
1081
+		}
1077 1082
 		if ($globalDBdriver == 'mysql') {
1078 1083
 			$query  = 'SELECT * FROM notam WHERE center_latitude BETWEEN '.$minlat.' AND '.$maxlat.' AND center_longitude BETWEEN '.$minlong.' AND '.$maxlong.' AND radius > 0 AND date_end > UTC_TIMESTAMP() AND date_begin < UTC_TIMESTAMP()';
1079 1084
 		} else {
@@ -1096,7 +1101,9 @@  discard block
 block discarded – undo
1096 1101
 			$minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
1097 1102
 			$maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
1098 1103
 			$maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
1099
-		} else return array();
1104
+		} else {
1105
+			return array();
1106
+		}
1100 1107
 		if ($globalDBdriver == 'mysql') {
1101 1108
 			$query  = 'SELECT * FROM notam WHERE center_latitude BETWEEN '.$minlat.' AND '.$maxlat.' AND center_longitude BETWEEN '.$minlong.' AND '.$maxlong.' AND radius > 0 AND date_end > UTC_TIMESTAMP() AND date_begin < UTC_TIMESTAMP() AND scope = :scope';
1102 1109
 		} else {
@@ -1122,8 +1129,11 @@  discard block
 block discarded – undo
1122 1129
 			return "error : ".$e->getMessage();
1123 1130
 		}
1124 1131
 		$all = $sth->fetchAll(PDO::FETCH_ASSOC);
1125
-		if (isset($all[0])) return $all[0];
1126
-		else return array();
1132
+		if (isset($all[0])) {
1133
+			return $all[0];
1134
+		} else {
1135
+			return array();
1136
+		}
1127 1137
 	}
1128 1138
 
1129 1139
 	public function addNOTAM($ref,$title,$type,$fir,$code,$rules,$scope,$lower_limit,$upper_limit,$center_latitude,$center_longitude,$radius,$date_begin,$date_end,$permanent,$text,$full_notam) {
@@ -1201,7 +1211,9 @@  discard block
 block discarded – undo
1201 1211
 					foreach ($alldata as $initial_data) {
1202 1212
 						$data = $this->parse($initial_data);
1203 1213
 						$notamref = $this->getNOTAMbyRef($data['ref']);
1204
-						if (count($notamref) == 0) $this->addNOTAM($data['ref'],$data['title'],'',$data['fir'],$data['code'],'',$data['scope'],$data['lower_limit'],$data['upper_limit'],$data['latitude'],$data['longitude'],$data['radius'],$data['date_begin'],$data['date_end'],$data['permanent'],$data['text'],$data['full_notam']);
1214
+						if (count($notamref) == 0) {
1215
+							$this->addNOTAM($data['ref'],$data['title'],'',$data['fir'],$data['code'],'',$data['scope'],$data['lower_limit'],$data['upper_limit'],$data['latitude'],$data['longitude'],$data['radius'],$data['date_begin'],$data['date_end'],$data['permanent'],$data['text'],$data['full_notam']);
1216
+						}
1205 1217
 					}
1206 1218
 				}
1207 1219
 			}
@@ -1212,20 +1224,28 @@  discard block
 block discarded – undo
1212 1224
 		$alldata = $this->parseNOTAMtextFile($filename);
1213 1225
 		if (count($alldata) > 0) {
1214 1226
 			$this->deleteOldNOTAM();
1215
-			if ($globalTransaction) $this->db->beginTransaction();
1227
+			if ($globalTransaction) {
1228
+				$this->db->beginTransaction();
1229
+			}
1216 1230
 			$j = 0;
1217 1231
 			foreach ($alldata as $initial_data) {
1218 1232
 				$j++;
1219 1233
 				$data = $this->parse($initial_data);
1220 1234
 				$notamref = $this->getNOTAMbyRef($data['ref']);
1221
-				if (!isset($notamref['notam_id'])) $this->addNOTAM($data['ref'],$data['title'],'',$data['fir'],$data['code'],'',$data['scope'],$data['lower_limit'],$data['upper_limit'],$data['latitude'],$data['longitude'],$data['radius'],$data['date_begin'],$data['date_end'],$data['permanent'],$data['text'],$data['full_notam']);
1235
+				if (!isset($notamref['notam_id'])) {
1236
+					$this->addNOTAM($data['ref'],$data['title'],'',$data['fir'],$data['code'],'',$data['scope'],$data['lower_limit'],$data['upper_limit'],$data['latitude'],$data['longitude'],$data['radius'],$data['date_begin'],$data['date_end'],$data['permanent'],$data['text'],$data['full_notam']);
1237
+				}
1222 1238
 				if ($globalTransaction && $j % 1000 == 0) {
1223 1239
 					$this->db->commit();
1224
-					if ($globalDebug) echo '.';
1240
+					if ($globalDebug) {
1241
+						echo '.';
1242
+					}
1225 1243
 					$this->db->beginTransaction();
1226 1244
 				}
1227 1245
 			}
1228
-			if ($globalTransaction) $this->db->commit();
1246
+			if ($globalTransaction) {
1247
+				$this->db->commit();
1248
+			}
1229 1249
 		}
1230 1250
 	}
1231 1251
 
@@ -1236,11 +1256,15 @@  discard block
 block discarded – undo
1236 1256
 		foreach (array_chunk($allairports,20) as $airport) {
1237 1257
 			$airports_icao = array();
1238 1258
 			foreach($airport as $icao) {
1239
-				if (isset($icao['icao'])) $airports_icao[] = $icao['icao'];
1259
+				if (isset($icao['icao'])) {
1260
+					$airports_icao[] = $icao['icao'];
1261
+				}
1240 1262
 			}
1241 1263
 			$airport_icao = implode(',',$airports_icao);
1242 1264
 			$alldata = $this->downloadNOTAM($airport_icao);
1243
-			if ($globalTransaction) $this->db->beginTransaction();
1265
+			if ($globalTransaction) {
1266
+				$this->db->beginTransaction();
1267
+			}
1244 1268
 			if (count($alldata) > 0) {
1245 1269
 				foreach ($alldata as $initial_data) {
1246 1270
 					//print_r($initial_data);
@@ -1249,14 +1273,23 @@  discard block
 block discarded – undo
1249 1273
 					if (isset($data['ref'])) {
1250 1274
 						$notamref = $this->getNOTAMbyRef($data['ref']);
1251 1275
 						if (count($notamref) == 0) {
1252
-							if (isset($data['ref_replaced'])) $this->deleteNOTAMbyRef($data['ref_replaced']);
1253
-							if (isset($data['ref_cancelled'])) $this->deleteNOTAMbyRef($data['ref_cancelled']);
1254
-							elseif (isset($data['latitude']) && isset($data['scope']) && isset($data['text']) && isset($data['permanent'])) echo $this->addNOTAM($data['ref'],'','',$data['fir'],$data['code'],'',$data['scope'],$data['lower_limit'],$data['upper_limit'],$data['latitude'],$data['longitude'],$data['radius'],$data['date_begin'],$data['date_end'],$data['permanent'],$data['text'],$data['full_notam']);
1276
+							if (isset($data['ref_replaced'])) {
1277
+								$this->deleteNOTAMbyRef($data['ref_replaced']);
1278
+							}
1279
+							if (isset($data['ref_cancelled'])) {
1280
+								$this->deleteNOTAMbyRef($data['ref_cancelled']);
1281
+							} elseif (isset($data['latitude']) && isset($data['scope']) && isset($data['text']) && isset($data['permanent'])) {
1282
+								echo $this->addNOTAM($data['ref'],'','',$data['fir'],$data['code'],'',$data['scope'],$data['lower_limit'],$data['upper_limit'],$data['latitude'],$data['longitude'],$data['radius'],$data['date_begin'],$data['date_end'],$data['permanent'],$data['text'],$data['full_notam']);
1283
+							}
1255 1284
 						}
1256 1285
 					}
1257 1286
 				}
1258
-			} else echo 'Error on download. Nothing matches for '.$airport_icao."\n";
1259
-			if ($globalTransaction) $this->db->commit();
1287
+			} else {
1288
+				echo 'Error on download. Nothing matches for '.$airport_icao."\n";
1289
+			}
1290
+			if ($globalTransaction) {
1291
+				$this->db->commit();
1292
+			}
1260 1293
 			sleep(5);
1261 1294
 		}
1262 1295
 	}
@@ -1269,8 +1302,11 @@  discard block
 block discarded – undo
1269 1302
 		$data = $Common->getData($url);
1270 1303
 		preg_match_all("/<pre>(.+?)<\/pre>/is", $data, $matches);
1271 1304
 		//print_r($matches);
1272
-		if (isset($matches[1])) return $matches[1];
1273
-		else return array();
1305
+		if (isset($matches[1])) {
1306
+			return $matches[1];
1307
+		} else {
1308
+			return array();
1309
+		}
1274 1310
 	}
1275 1311
 
1276 1312
 	public function parse($data) {
@@ -1301,99 +1337,156 @@  discard block
 block discarded – undo
1301 1337
 					$rules = str_split($matches[3]);
1302 1338
 					foreach ($rules as $rule) {
1303 1339
 						if ($rule == 'I') {
1304
-							if (isset($result['rules'])) $result['rules'] = $result['rules'].'/IFR';
1305
-							else $result['rules'] = 'IFR';
1340
+							if (isset($result['rules'])) {
1341
+								$result['rules'] = $result['rules'].'/IFR';
1342
+							} else {
1343
+								$result['rules'] = 'IFR';
1344
+							}
1306 1345
 						} elseif ($rule == 'V') {
1307
-							if (isset($result['rules'])) $result['rules'] = $result['rules'].'/VFR';
1308
-							else $result['rules'] = 'VFR';
1346
+							if (isset($result['rules'])) {
1347
+								$result['rules'] = $result['rules'].'/VFR';
1348
+							} else {
1349
+								$result['rules'] = 'VFR';
1350
+							}
1309 1351
 						} elseif ($rule == 'K') {
1310
-							if (isset($result['rules'])) $result['rules'] = $result['rules'].'/Checklist';
1311
-							else $result['rules'] = 'Checklist';
1352
+							if (isset($result['rules'])) {
1353
+								$result['rules'] = $result['rules'].'/Checklist';
1354
+							} else {
1355
+								$result['rules'] = 'Checklist';
1356
+							}
1312 1357
 						}
1313 1358
 					}
1314 1359
 					$attentions = str_split($matches[4]);
1315 1360
 					foreach ($attentions as $attention) {
1316 1361
 						if ($attention == 'N') {
1317
-							if (isset($result['attention'])) $result['attention'] = $result['attention'].' / Immediate attention';
1318
-							else $result['rules'] = 'Immediate attention';
1362
+							if (isset($result['attention'])) {
1363
+								$result['attention'] = $result['attention'].' / Immediate attention';
1364
+							} else {
1365
+								$result['rules'] = 'Immediate attention';
1366
+							}
1319 1367
 						} elseif ($attention == 'B') {
1320
-							if (isset($result['attention'])) $result['attention'] = $result['attention'].' / Operational significance';
1321
-							else $result['rules'] = 'Operational significance';
1368
+							if (isset($result['attention'])) {
1369
+								$result['attention'] = $result['attention'].' / Operational significance';
1370
+							} else {
1371
+								$result['rules'] = 'Operational significance';
1372
+							}
1322 1373
 						} elseif ($attention == 'O') {
1323
-							if (isset($result['attention'])) $result['attention'] = $result['attention'].' / Flight operations';
1324
-							else $result['rules'] = 'Flight operations';
1374
+							if (isset($result['attention'])) {
1375
+								$result['attention'] = $result['attention'].' / Flight operations';
1376
+							} else {
1377
+								$result['rules'] = 'Flight operations';
1378
+							}
1325 1379
 						} elseif ($attention == 'M') {
1326
-							if (isset($result['attention'])) $result['attention'] = $result['attention'].' / Misc';
1327
-							else $result['rules'] = 'Misc';
1380
+							if (isset($result['attention'])) {
1381
+								$result['attention'] = $result['attention'].' / Misc';
1382
+							} else {
1383
+								$result['rules'] = 'Misc';
1384
+							}
1328 1385
 						} elseif ($attention == 'K') {
1329
-							if (isset($result['attention'])) $result['attention'] = $result['attention'].' / Checklist';
1330
-							else $result['rules'] = 'Checklist';
1386
+							if (isset($result['attention'])) {
1387
+								$result['attention'] = $result['attention'].' / Checklist';
1388
+							} else {
1389
+								$result['rules'] = 'Checklist';
1390
+							}
1331 1391
 						}
1332 1392
 					}
1333
-					if ($matches[5] == 'A') $result['scope'] = 'Airport warning';
1334
-					elseif ($matches[5] == 'E') $result['scope'] = 'Enroute warning';
1335
-					elseif ($matches[5] == 'W') $result['scope'] = 'Navigation warning';
1336
-					elseif ($matches[5] == 'K') $result['scope'] = 'Checklist';
1337
-					elseif ($matches[5] == 'AE') $result['scope'] = 'Airport/Enroute warning';
1338
-					elseif ($matches[5] == 'AW') $result['scope'] = 'Airport/Navigation warning';
1393
+					if ($matches[5] == 'A') {
1394
+						$result['scope'] = 'Airport warning';
1395
+					} elseif ($matches[5] == 'E') {
1396
+						$result['scope'] = 'Enroute warning';
1397
+					} elseif ($matches[5] == 'W') {
1398
+						$result['scope'] = 'Navigation warning';
1399
+					} elseif ($matches[5] == 'K') {
1400
+						$result['scope'] = 'Checklist';
1401
+					} elseif ($matches[5] == 'AE') {
1402
+						$result['scope'] = 'Airport/Enroute warning';
1403
+					} elseif ($matches[5] == 'AW') {
1404
+						$result['scope'] = 'Airport/Navigation warning';
1405
+					}
1339 1406
 					$result['lower_limit'] = $matches[6];
1340 1407
 					$result['upper_limit'] = $matches[7];
1341 1408
 					$latitude = $Common->convertDec($matches[8],'latitude');
1342
-					if ($matches[9] == 'S') $latitude = -$latitude;
1409
+					if ($matches[9] == 'S') {
1410
+						$latitude = -$latitude;
1411
+					}
1343 1412
 					$longitude = $Common->convertDec($matches[10],'longitude');
1344
-					if ($matches[11] == 'W') $longitude = -$longitude;
1413
+					if ($matches[11] == 'W') {
1414
+						$longitude = -$longitude;
1415
+					}
1345 1416
 					$result['latitude'] = $latitude;
1346 1417
 					$result['longitude'] = $longitude;
1347
-					if ($matches[12] != '') $result['radius'] = intval($matches[12]);
1348
-					else $result['radius'] = 0;
1418
+					if ($matches[12] != '') {
1419
+						$result['radius'] = intval($matches[12]);
1420
+					} else {
1421
+						$result['radius'] = 0;
1422
+					}
1349 1423
 					$q = true;
1350 1424
 				} elseif ($globalDebug) {
1351 1425
 					echo 'NOTAM error : '.$result['full_notam']."\n";
1352 1426
 					echo "Can't parse : ".$line."\n";
1353 1427
 				}
1354
-			}
1355
-			elseif (preg_match('#(^|\s)A\) (.*)#',$line,$matches) && $a === false) {
1428
+			} elseif (preg_match('#(^|\s)A\) (.*)#',$line,$matches) && $a === false) {
1356 1429
 				$result['icao'] = $matches[2];
1357 1430
 				$a = true;
1358
-			}
1359
-			elseif (preg_match('#(^|\s)B\) ([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})#',$line,$matches) && $b === false) {
1360
-				if ($matches[1] > 50) $year = '19'.$matches[2];
1361
-				else $year = '20'.$matches[2];
1431
+			} elseif (preg_match('#(^|\s)B\) ([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})#',$line,$matches) && $b === false) {
1432
+				if ($matches[1] > 50) {
1433
+					$year = '19'.$matches[2];
1434
+				} else {
1435
+					$year = '20'.$matches[2];
1436
+				}
1362 1437
 				$result['date_begin'] = $year.'/'.$matches[3].'/'.$matches[4].' '.$matches[5].':'.$matches[6];
1363 1438
 				$b = true;
1364
-			}
1365
-			elseif (preg_match('#(^|\s)C\) ([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})$#',$line,$matches) && $c === false) {
1366
-				if ($matches[2] > 50) $year = '19'.$matches[2];
1367
-				else $year = '20'.$matches[2];
1439
+			} elseif (preg_match('#(^|\s)C\) ([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})$#',$line,$matches) && $c === false) {
1440
+				if ($matches[2] > 50) {
1441
+					$year = '19'.$matches[2];
1442
+				} else {
1443
+					$year = '20'.$matches[2];
1444
+				}
1368 1445
 				$result['date_end'] = $year.'/'.$matches[3].'/'.$matches[4].' '.$matches[5].':'.$matches[6];
1369 1446
 				$result['permanent'] = 0;
1370 1447
 				$c = true;
1371
-			}
1372
-			elseif (preg_match('#(^|\s)C\) ([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2}) (EST|PERM)$#',$line,$matches) && $c === false) {
1373
-				if ($matches[2] > 50) $year = '19'.$matches[2];
1374
-				else $year = '20'.$matches[2];
1448
+			} elseif (preg_match('#(^|\s)C\) ([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2}) (EST|PERM)$#',$line,$matches) && $c === false) {
1449
+				if ($matches[2] > 50) {
1450
+					$year = '19'.$matches[2];
1451
+				} else {
1452
+					$year = '20'.$matches[2];
1453
+				}
1375 1454
 				$result['date_end'] = $year.'/'.$matches[3].'/'.$matches[4].' '.$matches[5].':'.$matches[6];
1376
-				if ($matches[7] == 'EST') $result['estimated'] = 1;
1377
-				else $result['estimated'] = 0;
1378
-				if ($matches[7] == 'PERM') $result['permanent'] = 1;
1379
-				else $result['permanent'] = 0;
1455
+				if ($matches[7] == 'EST') {
1456
+					$result['estimated'] = 1;
1457
+				} else {
1458
+					$result['estimated'] = 0;
1459
+				}
1460
+				if ($matches[7] == 'PERM') {
1461
+					$result['permanent'] = 1;
1462
+				} else {
1463
+					$result['permanent'] = 0;
1464
+				}
1380 1465
 				$c = true;
1381
-			}
1382
-			elseif (preg_match('#(^|\s)C\) (EST|PERM)$#',$line,$matches) && $c === false) {
1466
+			} elseif (preg_match('#(^|\s)C\) (EST|PERM)$#',$line,$matches) && $c === false) {
1383 1467
 				$result['date_end'] = '2030/12/20 12:00';
1384
-				if ($matches[2] == 'EST') $result['estimated'] = 1;
1385
-				else $result['estimated'] = 0;
1386
-				if ($matches[2] == 'PERM') $result['permanent'] = 1;
1387
-				else $result['permanent'] = 0;
1468
+				if ($matches[2] == 'EST') {
1469
+					$result['estimated'] = 1;
1470
+				} else {
1471
+					$result['estimated'] = 0;
1472
+				}
1473
+				if ($matches[2] == 'PERM') {
1474
+					$result['permanent'] = 1;
1475
+				} else {
1476
+					$result['permanent'] = 0;
1477
+				}
1388 1478
 				$c = true;
1389
-			}
1390
-			elseif (preg_match('#(^|\s)E\) (.*)#',$line,$matches) && $e === false) {
1479
+			} elseif (preg_match('#(^|\s)E\) (.*)#',$line,$matches) && $e === false) {
1391 1480
 				$rtext = array();
1392 1481
 				$text = explode(' ',$matches[2]);
1393 1482
 				foreach ($text as $word) {
1394
-					if (isset($this->abbr[$word])) $rtext[] = strtoupper($this->abbr[$word]);
1395
-					elseif (ctype_digit(strval(substr($word,3))) && isset($this->abbr[substr($word,0,3)])) $rtext[] = strtoupper($this->abbr[substr($word,0,3)]).' '.substr($word,3);
1396
-					else $rtext[] = $word;
1483
+					if (isset($this->abbr[$word])) {
1484
+						$rtext[] = strtoupper($this->abbr[$word]);
1485
+					} elseif (ctype_digit(strval(substr($word,3))) && isset($this->abbr[substr($word,0,3)])) {
1486
+						$rtext[] = strtoupper($this->abbr[substr($word,0,3)]).' '.substr($word,3);
1487
+					} else {
1488
+						$rtext[] = $word;
1489
+					}
1397 1490
 				}
1398 1491
 				$result['text'] = implode(' ',$rtext);
1399 1492
 				$e = true;
@@ -1402,7 +1495,9 @@  discard block
 block discarded – undo
1402 1495
 			} elseif (preg_match('#(NOTAMN|NOTAMR|NOTAMC)#',$line,$matches)) {
1403 1496
 				$text = explode(' ',$line);
1404 1497
 				$result['ref'] = $text[0];
1405
-				if ($matches[1] == 'NOTAMN') $result['type'] = 'new';
1498
+				if ($matches[1] == 'NOTAMN') {
1499
+					$result['type'] = 'new';
1500
+				}
1406 1501
 				if ($matches[1] == 'NOTAMC') {
1407 1502
 					$result['type'] = 'cancel';
1408 1503
 					$result['ref_cancelled'] = $text[2];
@@ -1424,69 +1519,101 @@  discard block
 block discarded – undo
1424 1519
 		switch ($code[1]) {
1425 1520
 			case 'A':
1426 1521
 				$result = 'Airspace organization ';
1427
-				if (isset($this->code_airspace[$code_fp])) $result .= $this->code_airspace[$code_fp];
1522
+				if (isset($this->code_airspace[$code_fp])) {
1523
+					$result .= $this->code_airspace[$code_fp];
1524
+				}
1428 1525
 				break;
1429 1526
 			case 'C':
1430 1527
 				$result = 'Communications and radar facilities ';
1431
-				if (isset($this->code_comradar[$code_fp])) $result .= $this->code_comradar[$code_fp];
1528
+				if (isset($this->code_comradar[$code_fp])) {
1529
+					$result .= $this->code_comradar[$code_fp];
1530
+				}
1432 1531
 				break;
1433 1532
 			case 'F':
1434 1533
 				$result = 'Facilities and services ';
1435
-				if (isset($this->code_facilities[$code_fp])) $result .= $this->code_facilities[$code_fp];
1534
+				if (isset($this->code_facilities[$code_fp])) {
1535
+					$result .= $this->code_facilities[$code_fp];
1536
+				}
1436 1537
 				break;
1437 1538
 			case 'I':
1438 1539
 				$result = 'Instrument and Microwave Landing System ';
1439
-				if (isset($this->code_instrumentlanding[$code_fp])) $result .= $this->code_instrumentlanding[$code_fp];
1540
+				if (isset($this->code_instrumentlanding[$code_fp])) {
1541
+					$result .= $this->code_instrumentlanding[$code_fp];
1542
+				}
1440 1543
 				break;
1441 1544
 			case 'L':
1442 1545
 				$result = 'Lighting facilities ';
1443
-				if (isset($this->code_lightingfacilities[$code_fp])) $result .= $this->code_lightingfacilities[$code_fp];
1546
+				if (isset($this->code_lightingfacilities[$code_fp])) {
1547
+					$result .= $this->code_lightingfacilities[$code_fp];
1548
+				}
1444 1549
 				break;
1445 1550
 			case 'M':
1446 1551
 				$result = 'Movement and landing areas ';
1447
-				if (isset($this->code_movementareas[$code_fp])) $result .= $this->code_movementareas[$code_fp];
1552
+				if (isset($this->code_movementareas[$code_fp])) {
1553
+					$result .= $this->code_movementareas[$code_fp];
1554
+				}
1448 1555
 				break;
1449 1556
 			case 'N':
1450 1557
 				$result = 'Terminal and En Route Navigation Facilities ';
1451
-				if (isset($this->code_terminalfacilities[$code_fp])) $result .= $this->code_terminalfacilities[$code_fp];
1558
+				if (isset($this->code_terminalfacilities[$code_fp])) {
1559
+					$result .= $this->code_terminalfacilities[$code_fp];
1560
+				}
1452 1561
 				break;
1453 1562
 			case 'O':
1454 1563
 				$result = 'Other information ';
1455
-				if (isset($this->code_information[$code_fp])) $result .= $this->code_information[$code_fp];
1564
+				if (isset($this->code_information[$code_fp])) {
1565
+					$result .= $this->code_information[$code_fp];
1566
+				}
1456 1567
 				break;
1457 1568
 			case 'P':
1458 1569
 				$result = 'Air Traffic procedures ';
1459
-				if (isset($this->code_airtraffic[$code_fp])) $result .= $this->code_airtraffic[$code_fp];
1570
+				if (isset($this->code_airtraffic[$code_fp])) {
1571
+					$result .= $this->code_airtraffic[$code_fp];
1572
+				}
1460 1573
 				break;
1461 1574
 			case 'R':
1462 1575
 				$result = 'Navigation Warnings: Airspace Restrictions ';
1463
-				if (isset($this->code_navigationw[$code_fp])) $result .= $this->code_navigationw[$code_fp];
1576
+				if (isset($this->code_navigationw[$code_fp])) {
1577
+					$result .= $this->code_navigationw[$code_fp];
1578
+				}
1464 1579
 				break;
1465 1580
 			case 'S':
1466 1581
 				$result = 'Air Traffic and VOLMET Services ';
1467
-				if (isset($this->code_volmet[$code_fp])) $result .= $this->code_volmet[$code_fp];
1582
+				if (isset($this->code_volmet[$code_fp])) {
1583
+					$result .= $this->code_volmet[$code_fp];
1584
+				}
1468 1585
 				break;
1469 1586
 			case 'W':
1470 1587
 				$result = 'Navigation Warnings: Warnings ';
1471
-				if (isset($this->code_warnings[$code_fp])) $result .= $this->code_warnings[$code_fp];
1588
+				if (isset($this->code_warnings[$code_fp])) {
1589
+					$result .= $this->code_warnings[$code_fp];
1590
+				}
1472 1591
 				break;
1473 1592
 		}
1474 1593
 		switch ($code[3]) {
1475 1594
 			case 'A':
1476 1595
 				// Availability
1477
-				if (isset($this->code_sp_availabity[$code_sp])) $result .= ' '.$this->code_sp_availabity[$code_sp];
1596
+				if (isset($this->code_sp_availabity[$code_sp])) {
1597
+					$result .= ' '.$this->code_sp_availabity[$code_sp];
1598
+				}
1478 1599
 				break;
1479 1600
 			case 'C':
1480 1601
 				// Changes
1481
-				if (isset($this->code_sp_changes[$code_sp])) $result .= ' '.$this->code_sp_changes[$code_sp];
1602
+				if (isset($this->code_sp_changes[$code_sp])) {
1603
+					$result .= ' '.$this->code_sp_changes[$code_sp];
1604
+				}
1482 1605
 				break;
1483 1606
 			case 'H':
1484 1607
 				// Hazardous conditions
1485
-				if (isset($this->code_sp_hazardous[$code_sp])) $result .= ' '.$this->code_sp_hazardous[$code_sp];
1608
+				if (isset($this->code_sp_hazardous[$code_sp])) {
1609
+					$result .= ' '.$this->code_sp_hazardous[$code_sp];
1610
+				}
1486 1611
 				break;
1487 1612
 			case 'L':
1488 1613
 				// Limitations
1489
-				if (isset($this->code_sp_limitations[$code_sp])) $result .= ' '.$this->code_sp_limitations[$code_sp];
1614
+				if (isset($this->code_sp_limitations[$code_sp])) {
1615
+					$result .= ' '.$this->code_sp_limitations[$code_sp];
1616
+				}
1490 1617
 				break;
1491 1618
 			case 'X':
1492 1619
 				// Other Information
Please login to merge, or discard this patch.
require/class.Accident.php 1 patch
Braces   +87 added lines, -31 removed lines patch added patch discarded remove patch
@@ -20,7 +20,9 @@  discard block
 block discarded – undo
20 20
 	public function __construct($dbc = null) {
21 21
 		$Connection = new Connection($dbc);
22 22
 		$this->db = $Connection->db();
23
-		if ($this->db === null) die('Error: No DB connection. (Accident)');
23
+		if ($this->db === null) {
24
+			die('Error: No DB connection. (Accident)');
25
+		}
24 26
 	}
25 27
 
26 28
 	/*
@@ -125,8 +127,11 @@  discard block
 block discarded – undo
125 127
 				$data = array();
126 128
 				if ($row['registration'] != '') {
127 129
 					$image_array = $Image->getSpotterImage($row['registration']);
128
-					if (count($image_array) > 0) $data = array_merge($data,array('image' => $image_array[0]['image'],'image_thumbnail' => $image_array[0]['image_thumbnail'],'image_copyright' => $image_array[0]['image_copyright'],'image_source' => $image_array[0]['image_source'],'image_source_website' => $image_array[0]['image_source_website']));
129
-					else $data = array_merge($data,array('image' => '','image_thumbnail' => '','image_copyright' => '','image_source' => '','image_source_website' => ''));
130
+					if (count($image_array) > 0) {
131
+						$data = array_merge($data,array('image' => $image_array[0]['image'],'image_thumbnail' => $image_array[0]['image_thumbnail'],'image_copyright' => $image_array[0]['image_copyright'],'image_source' => $image_array[0]['image_source'],'image_source_website' => $image_array[0]['image_source_website']));
132
+					} else {
133
+						$data = array_merge($data,array('image' => '','image_thumbnail' => '','image_copyright' => '','image_source' => '','image_source_website' => ''));
134
+					}
130 135
 					$aircraft_type = $Spotter->getAllAircraftTypeByRegistration($row['registration']);
131 136
 					$aircraft_info = $Spotter->getAllAircraftInfo($aircraft_type);
132 137
 					if (!empty($aircraft_info)) {
@@ -142,17 +147,30 @@  discard block
 block discarded – undo
142 147
 						$data['aircraft_base'] = $owner_data['base'];
143 148
 						$data['aircraft_date_first_reg'] = $owner_data['date_first_reg'];
144 149
 					}
145
-				} else $data = array_merge($data,array('image' => '','image_thumbnail' => '','image_copyright' => '','image_source' => '','image_source_website' => ''));
146
-				if ($row['registration'] == '') $row['registration'] = 'NA';
147
-				if ($row['ident'] == '') $row['ident'] = 'NA';
150
+				} else {
151
+					$data = array_merge($data,array('image' => '','image_thumbnail' => '','image_copyright' => '','image_source' => '','image_source_website' => ''));
152
+				}
153
+				if ($row['registration'] == '') {
154
+					$row['registration'] = 'NA';
155
+				}
156
+				if ($row['ident'] == '') {
157
+					$row['ident'] = 'NA';
158
+				}
148 159
 				$identicao = $Spotter->getAllAirlineInfo(substr($row['ident'],0,3));
149 160
 				if (isset($identicao[0])) {
150 161
 					if (substr($row['ident'],0,2) == 'AF') {
151
-						if (filter_var(substr($row['ident'],2),FILTER_VALIDATE_INT,array("flags"=>FILTER_FLAG_ALLOW_OCTAL))) $icao = $row['ident'];
152
-						else $icao = 'AFR'.ltrim(substr($row['ident'],2),'0');
153
-					} else $icao = $identicao[0]['icao'].ltrim(substr($row['ident'],2),'0');
162
+						if (filter_var(substr($row['ident'],2),FILTER_VALIDATE_INT,array("flags"=>FILTER_FLAG_ALLOW_OCTAL))) {
163
+							$icao = $row['ident'];
164
+						} else {
165
+							$icao = 'AFR'.ltrim(substr($row['ident'],2),'0');
166
+						}
167
+					} else {
168
+						$icao = $identicao[0]['icao'].ltrim(substr($row['ident'],2),'0');
169
+					}
154 170
 					$data = array_merge($data,array('airline_icao' => $identicao[0]['icao'],'airline_name' => $identicao[0]['name']));
155
-				} else $icao = $row['ident'];
171
+				} else {
172
+					$icao = $row['ident'];
173
+				}
156 174
 				$icao = $Translation->checkTranslation($icao,false);
157 175
 				//$data = array_merge($data,array('registration' => $row['registration'], 'date' => $row['date'], 'ident' => $icao,'url' => $row['url']));
158 176
 				if ($row['airline_name'] != '' && !isset($data['airline_name'])) {
@@ -167,10 +185,14 @@  discard block
 block discarded – undo
167 185
 					//else echo 'No data...'."\n";
168 186
 				}
169 187
 				$data = array_merge($row,$data);
170
-				if ($data['ident'] == null) $data['ident'] = $icao;
188
+				if ($data['ident'] == null) {
189
+					$data['ident'] = $icao;
190
+				}
171 191
 				if ($data['title'] == null) {
172 192
 					$data['message'] = $row['type'].' of '.$row['registration'].' at '.$row['place'].','.$row['country'];
173
-				} else $data['message'] = strtolower($data['title']);
193
+				} else {
194
+					$data['message'] = strtolower($data['title']);
195
+				}
174 196
 				$ids = $Spotter->getAllIDByRegistration($data['registration'],true);
175 197
 				$date = $data['date'];
176 198
 				if (isset($ids[$date])) {
@@ -189,8 +211,9 @@  discard block
 block discarded – undo
189 211
 		if (isset($result)) {
190 212
 			$result[0]['query_number_rows'] = $i;
191 213
 			return $result;
214
+		} else {
215
+			return array();
192 216
 		}
193
-		else return array();
194 217
 	}
195 218
 
196 219
 	/*
@@ -235,7 +258,9 @@  discard block
 block discarded – undo
235 258
 	*/
236 259
 	public function import($file) {
237 260
 		global $globalTransaction, $globalDebug;
238
-		if ($globalDebug) echo 'Import '.$file."\n";
261
+		if ($globalDebug) {
262
+			echo 'Import '.$file."\n";
263
+		}
239 264
 		$result = array();
240 265
 		if (file_exists($file)) {
241 266
 			if (($handle = fopen($file,'r')) !== FALSE) {
@@ -246,8 +271,11 @@  discard block
 block discarded – undo
246 271
 				}
247 272
 				fclose($handle);
248 273
 			}
249
-			if (!empty($result)) $this->add($result,true);
250
-			elseif ($globalDebug) echo 'Nothing to import';
274
+			if (!empty($result)) {
275
+				$this->add($result,true);
276
+			} elseif ($globalDebug) {
277
+				echo 'Nothing to import';
278
+			}
251 279
 		}
252 280
 	}
253 281
 
@@ -283,14 +311,23 @@  discard block
 block discarded – undo
283 311
 					}
284 312
 				}
285 313
 				fclose($handle);
286
-			} elseif ($globalDebug) echo "Can't open ".dirname(__FILE__).'/../install/tmp/cr-all.md5';
287
-		} elseif ($globalDebug) echo 'Download cr-all.md5 failed. '.dirname(__FILE__).'/../install/tmp/cr-all.md5 not here.';
314
+			} elseif ($globalDebug) {
315
+				echo "Can't open ".dirname(__FILE__).'/../install/tmp/cr-all.md5';
316
+			}
317
+		} elseif ($globalDebug) {
318
+			echo 'Download cr-all.md5 failed. '.dirname(__FILE__).'/../install/tmp/cr-all.md5 not here.';
319
+		}
288 320
 		$result = $Common->arr_diff($all_md5_new,$all_md5);
289
-		if (empty($result) && $globalDebug) echo 'Nothing to update';
321
+		if (empty($result) && $globalDebug) {
322
+			echo 'Nothing to update';
323
+		}
290 324
 		foreach ($result as $file => $md5) {
291 325
 			$Common->download('http://data.flightairmap.fr/data/cr/'.$file,dirname(__FILE__).'/../install/tmp/'.$file);
292
-			if (file_exists(dirname(__FILE__).'/../install/tmp/'.$file)) $this->import(dirname(__FILE__).'/../install/tmp/'.$file);
293
-			elseif ($globalDebug) echo 'Download '.$file.' failed';
326
+			if (file_exists(dirname(__FILE__).'/../install/tmp/'.$file)) {
327
+				$this->import(dirname(__FILE__).'/../install/tmp/'.$file);
328
+			} elseif ($globalDebug) {
329
+				echo 'Download '.$file.' failed';
330
+			}
294 331
 		}
295 332
 	}
296 333
 
@@ -307,13 +344,17 @@  discard block
 block discarded – undo
307 344
 		$Image = new Image($this->db);
308 345
 		$Spotter = new Spotter($this->db);
309 346
 
310
-		if (empty($crash)) return false;
347
+		if (empty($crash)) {
348
+			return false;
349
+		}
311 350
 		if (!$new) {
312 351
 			$query_delete = 'DELETE FROM accidents WHERE source = :source';
313 352
 			$sthd = $Connection->db->prepare($query_delete);
314 353
 			$sthd->execute(array(':source' => $crash[0]['source']));
315 354
 		}
316
-		if ($globalTransaction) $Connection->db->beginTransaction();
355
+		if ($globalTransaction) {
356
+			$Connection->db->beginTransaction();
357
+		}
317 358
 		$initial_array = array('ident' => null,'type' => 'accident','url' => null,'registration' => null, 'date' => null, 'place' => null,'country' => null, 'latitude' => null, 'longitude' => null, 'fatalities' => null, 'title' => '','source' => '','aircraft_manufacturer' => null,'aircraft_name' => null,'operator' => null);
318 359
 		$query_check = 'SELECT COUNT(*) as nb FROM accidents WHERE registration = :registration AND date = :date AND type = :type AND source = :source';
319 360
 		$sth_check = $Connection->db->prepare($query_check);
@@ -328,7 +369,9 @@  discard block
 block discarded – undo
328 369
 					return $value === "" ? NULL : $value;
329 370
 				}, $cr);
330 371
 				if ($cr['date'] != '' && $cr['registration'] != null && $cr['registration'] != '' && $cr['registration'] != '?' && $cr['registration'] != '-' && strtolower($cr['registration']) != 'unknown' && $cr['date'] < time() && !preg_match('/\s/',$cr['registration'])) {
331
-					if (strpos($cr['registration'],'-') === FALSE) $cr['registration'] = $Spotter->convertAircraftRegistration($cr['registration']);
372
+					if (strpos($cr['registration'],'-') === FALSE) {
373
+						$cr['registration'] = $Spotter->convertAircraftRegistration($cr['registration']);
374
+					}
332 375
 					$query_check_values = array(':registration' => $cr['registration'],':date' => date('Y-m-d',$cr['date']),':type' => $cr['type'],':source' => $cr['source']);
333 376
 					$sth_check->execute($query_check_values);
334 377
 					$result_check = $sth_check->fetchAll(PDO::FETCH_ASSOC);
@@ -338,13 +381,19 @@  discard block
 block discarded – undo
338 381
 						if ($globalAircraftImageFetch && $cr['date'] > time()-(30*86400)) {
339 382
 							$imgchk = $Image->getSpotterImage($cr['registration']);
340 383
 							if (empty($imgchk)) {
341
-								if ($globalDebug) echo "\t".'Get image for '.$cr['registration'].'...';
384
+								if ($globalDebug) {
385
+									echo "\t".'Get image for '.$cr['registration'].'...';
386
+								}
342 387
 								$Image->addSpotterImage($cr['registration']);
343
-								if ($globalDebug) echo "\t".'Done'."\n";
388
+								if ($globalDebug) {
389
+									echo "\t".'Done'."\n";
390
+								}
344 391
 							}
345 392
 							// elseif ($globalDebug) echo 'Image already in DB'."\n";
346 393
 						}
347
-						if ($cr['title'] == '') $cr['title'] = $cr['registration'].' '.$cr['type'];
394
+						if ($cr['title'] == '') {
395
+							$cr['title'] = $cr['registration'].' '.$cr['type'];
396
+						}
348 397
 						$Spotter->setHighlightFlightByRegistration($cr['registration'],$cr['title'],date('Y-m-d',$cr['date']));
349 398
 					}
350 399
 				}
@@ -353,9 +402,13 @@  discard block
 block discarded – undo
353 402
 					$Connection->db->beginTransaction();
354 403
 				}
355 404
 			}
356
-			if ($globalTransaction) $Connection->db->commit();
405
+			if ($globalTransaction) {
406
+				$Connection->db->commit();
407
+			}
357 408
 		} catch(PDOException $e) {
358
-			if ($globalTransaction) $Connection->db->rollBack();
409
+			if ($globalTransaction) {
410
+				$Connection->db->rollBack();
411
+			}
359 412
 			echo $e->getMessage();
360 413
 		}
361 414
 		$sth_check->closeCursor();
@@ -394,8 +447,11 @@  discard block
 block discarded – undo
394 447
 			return "error : ".$e->getMessage();
395 448
 		}
396 449
 		$row = $sth->fetch(PDO::FETCH_ASSOC);
397
-		if ($row['nb'] > 0) return false;
398
-		else return true;
450
+		if ($row['nb'] > 0) {
451
+			return false;
452
+		} else {
453
+			return true;
454
+		}
399 455
 	}
400 456
 
401 457
 	public static function insert_last_accidents_update() {
Please login to merge, or discard this patch.
search.php 1 patch
Braces   +142 added lines, -39 removed lines patch added patch discarded remove patch
@@ -46,8 +46,10 @@  discard block
 block discarded – undo
46 46
 			$end_date = date("Y-m-d H:i:s", strtotime("2014-04-12")).",".date("Y-m-d",strtotime($_GET['end_date']))." 00:00:00";
47 47
 			$sql_date = $end_date;
48 48
 		}
49
-	} else $sql_date = '';
50
-}
49
+	} else {
50
+		$sql_date = '';
51
+	}
52
+	}
51 53
 
52 54
 if (isset($_GET['highest_altitude'])) {
53 55
 	//for altitude manipulation
@@ -61,8 +63,12 @@  discard block
 block discarded – undo
61 63
 	} else if($_GET['highest_altitude'] == "" && $_GET['lowest_altitude'] != ""){
62 64
 		$start_altitude = filter_input(INPUT_GET,'lowest_altitude',FILTER_SANITIZE_NUMBER_INT).",60000";
63 65
 		$sql_altitude = $start_altitude;
64
-	} else $sql_altitude = '';
65
-} else $sql_altitude = '';
66
+	} else {
67
+		$sql_altitude = '';
68
+	}
69
+	} else {
70
+	$sql_altitude = '';
71
+}
66 72
 
67 73
 //calculuation for the pagination
68 74
 if(!isset($_GET['limit']))
@@ -80,7 +86,7 @@  discard block
 block discarded – undo
80 86
 		$limit_end = filter_input(INPUT_GET,'number_results',FILTER_SANITIZE_NUMBER_INT);
81 87
 		$absolute_difference = filter_input(INPUT_GET,'number_results',FILTER_SANITIZE_NUMBER_INT);
82 88
 	}
83
-}  else {
89
+} else {
84 90
 	$limit_explode = explode(",", $_GET['limit']);
85 91
 	$limit_start = filter_var($limit_explode[0],FILTER_SANITIZE_NUMBER_INT);
86 92
 	$limit_end = filter_var($limit_explode[1],FILTER_SANITIZE_NUMBER_INT);
@@ -138,10 +144,15 @@  discard block
 block discarded – undo
138 144
 	$dist = filter_input(INPUT_GET,'dist',FILTER_SANITIZE_NUMBER_INT);
139 145
 	$number_results = filter_input(INPUT_GET,'number_results',FILTER_SANITIZE_NUMBER_INT);
140 146
 	if ($dist != '') {
141
-		if (isset($globalDistanceUnit) && $globalDistanceUnit == 'mi') $dist = $dist*1.60934;
142
-		elseif (isset($globalDistanceUnit) && $globalDistanceUnit == 'nm') $dist = $dist*1.852;
147
+		if (isset($globalDistanceUnit) && $globalDistanceUnit == 'mi') {
148
+			$dist = $dist*1.60934;
149
+		} elseif (isset($globalDistanceUnit) && $globalDistanceUnit == 'nm') {
150
+			$dist = $dist*1.852;
151
+		}
152
+	}
153
+	if (!isset($sql_date)) {
154
+		$sql_date = '';
143 155
 	}
144
-	if (!isset($sql_date)) $sql_date = '';
145 156
 	if ($archive == 1) {
146 157
 		if ($type == 'aircraft') {
147 158
 			$SpotterArchive = new SpotterArchive();
@@ -219,7 +230,10 @@  discard block
 block discarded – undo
219 230
 		if (isset($_GET['aircraft']) && $_GET['aircraft'] != ""){ print _("Aircraft:").' <span>'.$aircraft.'</span> '; }
220 231
 		if (isset($_GET['manufacturer']) && $_GET['manufacturer'] != ""){ print _("Manufacturer:").' <span>'.$manufacturer.'</span> '; }
221 232
 		if (isset($_GET['registration']) && $_GET['registration'] != ""){ print _("Registration:").' <span>'.$registration.'</span> '; }
222
-		if (isset($_GET['highlights'])) if ($_GET['highlights'] == "true"){ print _("Highlights:").' <span>'.$highlights.'</span> '; }
233
+		if (isset($_GET['highlights'])) {
234
+			if ($_GET['highlights'] == "true"){ print _("Highlights:").' <span>'.$highlights.'</span> ';
235
+		}
236
+		}
223 237
 		if (isset($_GET['airline']) && $_GET['airline'] != ""){ print _("Airline:").' <span>'.$airline.'</span> '; }
224 238
 		if (isset($_GET['airline_country']) && $_GET['airline_country'] != ""){ print _("Airline country:").' <span>'.$airline_country.'</span> '; }
225 239
 		if (isset($_GET['airline_type']) && $_GET['airline_type'] != ""){ print _("Airline type:").' <span>'.$airline_type.'</span> '; }
@@ -355,7 +369,10 @@  discard block
 block discarded – undo
355 369
 			<div class="form-group">
356 370
 				<label class="control-label col-sm-2"><?php echo _("Keywords"); ?></label>
357 371
 				<div class="col-sm-10">
358
-					<input type="text" class="form-control" id="q" name="q" value="<?php if (isset($_GET['q'])) print $q; ?>" size="10" placeholder="<?php echo _("Keywords"); ?>" />
372
+					<input type="text" class="form-control" id="q" name="q" value="<?php if (isset($_GET['q'])) {
373
+	print $q;
374
+}
375
+?>" size="10" placeholder="<?php echo _("Keywords"); ?>" />
359 376
 				</div>
360 377
 			</div>
361 378
 		</fieldset>
@@ -374,7 +391,10 @@  discard block
 block discarded – undo
374 391
 					    </select>
375 392
 					</div>
376 393
 				</div>
377
-				<script type="text/javascript">getSelect('manufacturer','<?php if(isset($_GET['manufacturer'])) print $manufacturer; ?>')</script>
394
+				<script type="text/javascript">getSelect('manufacturer','<?php if(isset($_GET['manufacturer'])) {
395
+	print $manufacturer;
396
+}
397
+?>')</script>
378 398
 				<div class="form-group">
379 399
 					<label class="control-label col-sm-2"><?php echo _("Type"); ?></label>
380 400
 						<div class="col-sm-10">
@@ -383,11 +403,17 @@  discard block
 block discarded – undo
383 403
 							</select>
384 404
 						</div>
385 405
 				</div>
386
-				<script type="text/javascript">getSelect('aircrafttypes','<?php if(isset($_GET['aircraft_icao'])) print $aircraft_icao; ?>');</script>
406
+				<script type="text/javascript">getSelect('aircrafttypes','<?php if(isset($_GET['aircraft_icao'])) {
407
+	print $aircraft_icao;
408
+}
409
+?>');</script>
387 410
 				<div class="form-group">
388 411
 					<label class="control-label col-sm-2"><?php echo _("Registration"); ?></label> 
389 412
 					<div class="col-sm-10">
390
-						<input type="text" class="form-control" name="registration" value="<?php if (isset($_GET['registration'])) print $registration; ?>" size="8" placeholder="<?php echo _("Registration"); ?>" />
413
+						<input type="text" class="form-control" name="registration" value="<?php if (isset($_GET['registration'])) {
414
+	print $registration;
415
+}
416
+?>" size="8" placeholder="<?php echo _("Registration"); ?>" />
391 417
 					</div>
392 418
 				</div>
393 419
 <?php
@@ -396,22 +422,31 @@  discard block
 block discarded – undo
396 422
 				<div class="form-group">
397 423
 					<label class="control-label col-sm-2"><?php echo _("Pilot id"); ?></label> 
398 424
 					<div class="col-sm-10">
399
-						<input type="text" class="form-control" name="pilot_id" value="<?php if (isset($_GET['pilot_id'])) print $pilot_id; ?>" size="15" placeholder="<?php echo _("Pilot id"); ?>" />
425
+						<input type="text" class="form-control" name="pilot_id" value="<?php if (isset($_GET['pilot_id'])) {
426
+	print $pilot_id;
427
+}
428
+?>" size="15" placeholder="<?php echo _("Pilot id"); ?>" />
400 429
 					</div>
401 430
 				</div>
402 431
 				<div class="form-group">
403 432
 					<label class="control-label col-sm-2"><?php echo _("Pilot name"); ?></label> 
404 433
 					<div class="col-sm-10">
405
-						<input type="text" class="form-control" name="pilot_name" value="<?php if (isset($_GET['pilot_name'])) print $pilot_name; ?>" size="15" placeholder="<?php echo _("Pilot name"); ?>" />
434
+						<input type="text" class="form-control" name="pilot_name" value="<?php if (isset($_GET['pilot_name'])) {
435
+	print $pilot_name;
436
+}
437
+?>" size="15" placeholder="<?php echo _("Pilot name"); ?>" />
406 438
 					</div>
407 439
 				</div>
408 440
 <?php
409
-	}else {
441
+	} else {
410 442
 ?>
411 443
 				<div class="form-group">
412 444
 					<label class="control-label col-sm-2"><?php echo _("Owner name"); ?></label> 
413 445
 					<div class="col-sm-10">
414
-						<input type="text" class="form-control" name="owner" value="<?php if (isset($_GET['owner'])) print $owner; ?>" size="15" placeholder="<?php echo _("Owner name"); ?>" />
446
+						<input type="text" class="form-control" name="owner" value="<?php if (isset($_GET['owner'])) {
447
+	print $owner;
448
+}
449
+?>" size="15" placeholder="<?php echo _("Owner name"); ?>" />
415 450
 					</div>
416 451
 				</div>
417 452
 <?php
@@ -419,8 +454,14 @@  discard block
 block discarded – undo
419 454
 ?>
420 455
 				<div class="form-group">
421 456
 					<div class="col-sm-offset-2 col-sm-10">
422
-					<!--<div><input type="checkbox" class="form-control" name="highlights" value="true" id="highlights" <?php if (isset($_GET['highlights'])) if ($_GET['highlights'] == "true"){ print 'checked="checked"'; } ?>> <label for="highlights"><?php echo _("Include only aircraft with special highlights (unique liveries, destinations etc.)"); ?></label></div>-->
423
-					<label class="checkbox-inline"><input type="checkbox" name="highlights" value="true" id="highlights" <?php if (isset($_GET['highlights'])) if ($_GET['highlights'] == "true"){ print 'checked="checked"'; } ?>> <?php echo _("Include only aircraft with special highlights (unique liveries, destinations etc.)"); ?></label>
457
+					<!--<div><input type="checkbox" class="form-control" name="highlights" value="true" id="highlights" <?php if (isset($_GET['highlights'])) {
458
+	if ($_GET['highlights'] == "true"){ print 'checked="checked"';
459
+}
460
+} ?>> <label for="highlights"><?php echo _("Include only aircraft with special highlights (unique liveries, destinations etc.)"); ?></label></div>-->
461
+					<label class="checkbox-inline"><input type="checkbox" name="highlights" value="true" id="highlights" <?php if (isset($_GET['highlights'])) {
462
+	if ($_GET['highlights'] == "true"){ print 'checked="checked"';
463
+}
464
+} ?>> <?php echo _("Include only aircraft with special highlights (unique liveries, destinations etc.)"); ?></label>
424 465
 					</div>
425 466
 				</div>
426 467
 			</fieldset>
@@ -434,7 +475,10 @@  discard block
 block discarded – undo
434 475
 						</select>
435 476
 					</div>
436 477
 				</div>
437
-				<script type="text/javascript">getSelect('airlinenames','<?php if(isset($_GET['airline'])) print $airline; ?>');</script>
478
+				<script type="text/javascript">getSelect('airlinenames','<?php if(isset($_GET['airline'])) {
479
+	print $airline;
480
+}
481
+?>');</script>
438 482
 				<div class="form-group">
439 483
 					<label class="control-label col-sm-2"><?php echo _("Country"); ?></label> 
440 484
 					<div class="col-sm-10">
@@ -443,19 +487,34 @@  discard block
 block discarded – undo
443 487
 						</select>
444 488
 					</div>
445 489
 				</div>
446
-				<script type="text/javascript">getSelect('airlinecountries','<?php if(isset($_GET['airline_country'])) print $airline_country; ?>');</script>
490
+				<script type="text/javascript">getSelect('airlinecountries','<?php if(isset($_GET['airline_country'])) {
491
+	print $airline_country;
492
+}
493
+?>');</script>
447 494
 				<div class="form-group">
448 495
 					<label class="control-label col-sm-2"><?php echo _("Callsign"); ?></label> 
449 496
 					<div class="col-sm-10">
450
-						<input type="text" name="callsign" class="form-control" value="<?php if (isset($_GET['callsign'])) print $callsign; ?>" size="8" placeholder="<?php echo _("Callsign"); ?>" />
497
+						<input type="text" name="callsign" class="form-control" value="<?php if (isset($_GET['callsign'])) {
498
+	print $callsign;
499
+}
500
+?>" size="8" placeholder="<?php echo _("Callsign"); ?>" />
451 501
 					</div>
452 502
 				</div>
453 503
 				<div class="form-group">
454 504
 					<div class="col-sm-offset-2 col-sm-10">
455 505
 						<label class="radio-inline"><input type="radio" name="airline_type" value="all" id="airline_type_all" <?php if (!isset($_GET['airline_type']) || $_GET['airline_type'] == "all"){ print 'checked="checked"'; } ?>> <?php echo _("All airlines types"); ?></label>
456
-						<label class="radio-inline"><input type="radio" name="airline_type" value="passenger" id="airline_type_passenger" <?php if (isset($_GET['airline_type'])) if ($_GET['airline_type'] == "passenger"){ print 'checked="checked"'; } ?>> <?php echo _("Only Passenger airlines"); ?></label>
457
-						<label class="radio-inline"><input type="radio" name="airline_type" value="cargo" id="airline_type_cargo" <?php if (isset($_GET['airline_type'])) if ( $_GET['airline_type'] == "cargo"){ print 'checked="checked"'; } ?>> <?php echo _("Only Cargo airlines"); ?></label>
458
-						<label class="radio-inline"><input type="radio" name="airline_type" value="military" id="airline_type_military" <?php if (isset($_GET['airline_type'])) if ( $_GET['airline_type'] == "military"){ print 'checked="checked"'; } ?>> <?php echo _("Only Military airlines"); ?></label>
506
+						<label class="radio-inline"><input type="radio" name="airline_type" value="passenger" id="airline_type_passenger" <?php if (isset($_GET['airline_type'])) {
507
+	if ($_GET['airline_type'] == "passenger"){ print 'checked="checked"';
508
+}
509
+} ?>> <?php echo _("Only Passenger airlines"); ?></label>
510
+						<label class="radio-inline"><input type="radio" name="airline_type" value="cargo" id="airline_type_cargo" <?php if (isset($_GET['airline_type'])) {
511
+	if ( $_GET['airline_type'] == "cargo"){ print 'checked="checked"';
512
+}
513
+} ?>> <?php echo _("Only Cargo airlines"); ?></label>
514
+						<label class="radio-inline"><input type="radio" name="airline_type" value="military" id="airline_type_military" <?php if (isset($_GET['airline_type'])) {
515
+	if ( $_GET['airline_type'] == "military"){ print 'checked="checked"';
516
+}
517
+} ?>> <?php echo _("Only Military airlines"); ?></label>
459 518
 					</div>
460 519
 				</div>
461 520
 			</fieldset>
@@ -469,7 +528,10 @@  discard block
 block discarded – undo
469 528
 						</select>
470 529
 					</div>
471 530
 				</div>
472
-				<script type="text/javascript">getSelect('airportnames','<?php if(isset($_GET['airport_icao'])) print $airport_icao; ?>');</script>
531
+				<script type="text/javascript">getSelect('airportnames','<?php if(isset($_GET['airport_icao'])) {
532
+	print $airport_icao;
533
+}
534
+?>');</script>
473 535
 				<div class="form-group">
474 536
 					<label class="control-label col-sm-2"><?php echo _("Country"); ?></label> 
475 537
 					<div class="col-sm-10">
@@ -478,7 +540,10 @@  discard block
 block discarded – undo
478 540
 						</select>
479 541
 					</div>
480 542
 				</div>
481
-				<script type="text/javascript">getSelect('airportcountries','<?php if(isset($_GET['airport_country'])) print $airport_country; ?>');</script>
543
+				<script type="text/javascript">getSelect('airportcountries','<?php if(isset($_GET['airport_country'])) {
544
+	print $airport_country;
545
+}
546
+?>');</script>
482 547
 			</fieldset>
483 548
 			<fieldset>
484 549
 				<legend><?php echo _("Route"); ?></legend>
@@ -490,7 +555,10 @@  discard block
 block discarded – undo
490 555
 						</select>
491 556
 					</div>
492 557
 				</div>
493
-				<script type="text/javascript">getSelect('departureairportnames','<?php if(isset($_GET['departure_airport_route'])) print $departure_airport_route; ?>');</script>
558
+				<script type="text/javascript">getSelect('departureairportnames','<?php if(isset($_GET['departure_airport_route'])) {
559
+	print $departure_airport_route;
560
+}
561
+?>');</script>
494 562
 				<div class="form-group">
495 563
 					<label class="control-label col-sm-2"><?php echo _("Arrival Airport"); ?></label> 
496 564
 					<div class="col-sm-10">
@@ -499,7 +567,10 @@  discard block
 block discarded – undo
499 567
 						</select>
500 568
 					</div>
501 569
 				</div>
502
-				<script type="text/javascript">getSelect('arrivalairportnames','<?php if(isset($_GET['arrival_airport_route'])) print $arrival_airport_route; ?>');</script>
570
+				<script type="text/javascript">getSelect('arrivalairportnames','<?php if(isset($_GET['arrival_airport_route'])) {
571
+	print $arrival_airport_route;
572
+}
573
+?>');</script>
503 574
 			</fieldset>
504 575
 			<fieldset>
505 576
 				<legend>Altitude</legend>
@@ -549,19 +620,33 @@  discard block
 block discarded – undo
549 620
 				<div class="form-group">
550 621
 					<label class="control-label col-sm-2"><?php echo _("Latitude"); ?></label>
551 622
 					<div class="col-sm-10">
552
-						<input type="text" name="origlat" class="form-control" placeholder="<?php echo _("Center point latitude"); ?>" value="<?php if (isset($_GET['origlat'])) print $origlat; ?>" />
623
+						<input type="text" name="origlat" class="form-control" placeholder="<?php echo _("Center point latitude"); ?>" value="<?php if (isset($_GET['origlat'])) {
624
+	print $origlat;
625
+}
626
+?>" />
553 627
 					</div>
554 628
 				</div>
555 629
 				<div class="form-group">
556 630
 					<label class="control-label col-sm-2"><?php echo _("Longitude"); ?></label>
557 631
 					<div class="col-sm-10">
558
-						<input type="text" name="origlon" class="form-control" placeholder="<?php echo _("Center point longitude"); ?>" value="<?php if (isset($_GET['origlon'])) print $origlon; ?>" />
632
+						<input type="text" name="origlon" class="form-control" placeholder="<?php echo _("Center point longitude"); ?>" value="<?php if (isset($_GET['origlon'])) {
633
+	print $origlon;
634
+}
635
+?>" />
559 636
 					</div>
560 637
 				</div>
561 638
 				<div class="form-group">
562
-					<label class="control-label col-sm-2"><?php echo _("Distance").' ('; if (isset($globalDistanceUnit)) print $globalDistanceUnit; else print 'km'; print ')'; ?></label>
639
+					<label class="control-label col-sm-2"><?php echo _("Distance").' ('; if (isset($globalDistanceUnit)) {
640
+	print $globalDistanceUnit;
641
+} else {
642
+	print 'km';
643
+}
644
+print ')'; ?></label>
563 645
 					<div class="col-sm-10">
564
-						<input type="text" name="dist" class="form-control" placeholder="<?php echo _("Distance from center point"); ?>" value="<?php if (isset($_GET['distance'])) print $distance; ?>" />
646
+						<input type="text" name="dist" class="form-control" placeholder="<?php echo _("Distance from center point"); ?>" value="<?php if (isset($_GET['distance'])) {
647
+	print $distance;
648
+}
649
+?>" />
565 650
 					</div>
566 651
 				</div>
567 652
 			</fieldset>
@@ -572,7 +657,10 @@  discard block
 block discarded – undo
572 657
 				<div class="form-group">
573 658
 					<label class="control-label col-sm-2"><?php echo _("Callsign"); ?></label> 
574 659
 					<div class="col-sm-10">
575
-						<input type="text" name="callsign" class="form-control" value="<?php if (isset($_GET['callsign'])) print $callsign; ?>" size="8" placeholder="<?php echo _("Callsign"); ?>" />
660
+						<input type="text" name="callsign" class="form-control" value="<?php if (isset($_GET['callsign'])) {
661
+	print $callsign;
662
+}
663
+?>" size="8" placeholder="<?php echo _("Callsign"); ?>" />
576 664
 					</div>
577 665
 				</div>
578 666
 			</fieldset>
@@ -583,7 +671,10 @@  discard block
 block discarded – undo
583 671
 				<div class="form-group">
584 672
 					<label class="control-label col-sm-2"><?php echo _("Callsign"); ?></label> 
585 673
 					<div class="col-sm-10">
586
-						<input type="text" name="callsign" class="form-control" value="<?php if (isset($_GET['callsign'])) print $callsign; ?>" size="8" placeholder="<?php echo _("Callsign"); ?>" />
674
+						<input type="text" name="callsign" class="form-control" value="<?php if (isset($_GET['callsign'])) {
675
+	print $callsign;
676
+}
677
+?>" size="8" placeholder="<?php echo _("Callsign"); ?>" />
587 678
 					</div>
588 679
 				</div>
589 680
 			</fieldset>
@@ -591,7 +682,10 @@  discard block
 block discarded – undo
591 682
 				<div class="form-group">
592 683
 					<label class="control-label col-sm-2"><?php echo _("MMSI"); ?></label> 
593 684
 					<div class="col-sm-10">
594
-						<input type="text" name="mmsi" class="form-control" value="<?php if (isset($_GET['mmsi'])) print $mmsi; ?>" size="8" placeholder="<?php echo _("MMSI"); ?>" />
685
+						<input type="text" name="mmsi" class="form-control" value="<?php if (isset($_GET['mmsi'])) {
686
+	print $mmsi;
687
+}
688
+?>" size="8" placeholder="<?php echo _("MMSI"); ?>" />
595 689
 					</div>
596 690
 				</div>
597 691
 			</fieldset>
@@ -599,7 +693,10 @@  discard block
 block discarded – undo
599 693
 				<div class="form-group">
600 694
 					<label class="control-label col-sm-2"><?php echo _("IMO"); ?></label> 
601 695
 					<div class="col-sm-10">
602
-						<input type="text" name="imo" class="form-control" value="<?php if (isset($_GET['imo'])) print $imo; ?>" size="8" placeholder="<?php echo _("IMO"); ?>" />
696
+						<input type="text" name="imo" class="form-control" value="<?php if (isset($_GET['imo'])) {
697
+	print $imo;
698
+}
699
+?>" size="8" placeholder="<?php echo _("IMO"); ?>" />
603 700
 					</div>
604 701
 				</div>
605 702
 			</fieldset>
@@ -612,7 +709,10 @@  discard block
 block discarded – undo
612 709
 					<label class="control-label col-sm-2"><?php echo _("Start Date"); ?></label>
613 710
 					<div class="col-sm-10">
614 711
 						<div class='input-group date' id='datetimepicker1'>
615
-							<input type='text' name="start_date" class="form-control" value="<?php if (isset($_GET['start_date']) && $_GET['start_date'] != '') print $start_date; ?>" placeholder="<?php echo _("Start Date/Time"); ?>" />
712
+							<input type='text' name="start_date" class="form-control" value="<?php if (isset($_GET['start_date']) && $_GET['start_date'] != '') {
713
+	print $start_date;
714
+}
715
+?>" placeholder="<?php echo _("Start Date/Time"); ?>" />
616 716
 							<span class="input-group-addon">
617 717
 								<span class="glyphicon glyphicon-calendar"></span>
618 718
 							</span>
@@ -623,7 +723,10 @@  discard block
 block discarded – undo
623 723
 					<label class="control-label col-sm-2"><?php echo _("End Date"); ?></label>
624 724
 					<div class="col-sm-10">
625 725
 						<div class='input-group date' id='datetimepicker2'>
626
-						<input type='text' name="end_date" class="form-control" value="<?php if (isset($_GET['end_date']) && $_GET['end_date'] != '') print $end_date; ?>" placeholder="<?php echo _("End Date/Time"); ?>" />
726
+						<input type='text' name="end_date" class="form-control" value="<?php if (isset($_GET['end_date']) && $_GET['end_date'] != '') {
727
+	print $end_date;
728
+}
729
+?>" placeholder="<?php echo _("End Date/Time"); ?>" />
627 730
 						<span class="input-group-addon">
628 731
 							<span class="glyphicon glyphicon-calendar"></span>
629 732
 						</span>
Please login to merge, or discard this patch.
pilot-detailed.php 1 patch
Braces   +24 added lines, -8 removed lines patch added patch discarded remove patch
@@ -37,8 +37,12 @@  discard block
 block discarded – undo
37 37
 	$year = filter_input(INPUT_GET,'year',FILTER_SANITIZE_NUMBER_INT);
38 38
 	$month = filter_input(INPUT_GET,'month',FILTER_SANITIZE_NUMBER_INT);
39 39
 	$filter = array();
40
-	if ($year != '') $filter = array_merge($filter,array('year' => $year));
41
-	if ($month != '') $filter = array_merge($filter,array('month' => $month));
40
+	if ($year != '') {
41
+		$filter = array_merge($filter,array('year' => $year));
42
+	}
43
+	if ($month != '') {
44
+		$filter = array_merge($filter,array('month' => $month));
45
+	}
42 46
 	if ($sort != '') 
43 47
 	{
44 48
 		$spotter_array = $Spotter->getSpotterDataByPilot($pilot,$limit_start.",".$absolute_difference, $sort,$filter);
@@ -56,8 +60,12 @@  discard block
 block discarded – undo
56 60
 	{
57 61
 		$title = sprintf(_("Detailed View for %s"),$spotter_array[0]['pilot_name']);
58 62
 		$ident = $spotter_array[0]['ident'];
59
-		if (isset($spotter_array[0]['latitude'])) $latitude = $spotter_array[0]['latitude'];
60
-		if (isset($spotter_array[0]['longitude'])) $longitude = $spotter_array[0]['longitude'];
63
+		if (isset($spotter_array[0]['latitude'])) {
64
+			$latitude = $spotter_array[0]['latitude'];
65
+		}
66
+		if (isset($spotter_array[0]['longitude'])) {
67
+			$longitude = $spotter_array[0]['longitude'];
68
+		}
61 69
 		require_once('header.php');
62 70
 		/*
63 71
 		if (isset($globalArchive) && $globalArchive) {
@@ -110,12 +118,18 @@  discard block
 block discarded – undo
110 118
 		*/
111 119
 		print '<div class="info column">';
112 120
 		print '<h1>'.$spotter_array[0]['pilot_name'].'</h1>';
113
-		if (isset($spotter_array[0]['pilot_id']) && $spotter_array[0]['pilot_id'] != '') print '<div><span class="label">'._("Pilot ID").'</span>'.$spotter_array[0]['pilot_id'].'</div>';
121
+		if (isset($spotter_array[0]['pilot_id']) && $spotter_array[0]['pilot_id'] != '') {
122
+			print '<div><span class="label">'._("Pilot ID").'</span>'.$spotter_array[0]['pilot_id'].'</div>';
123
+		}
114 124
 		if ($year == '' && $month == '') {
115 125
 			$Stats = new Stats();
116 126
 			$flights = $Stats->getStatsPilot($pilot);
117
-		} else $flights = 0;
118
-		if ($flights == 0) $flights = $Spotter->countFlightsByPilot($pilot,$filter);
127
+		} else {
128
+			$flights = 0;
129
+		}
130
+		if ($flights == 0) {
131
+			$flights = $Spotter->countFlightsByPilot($pilot,$filter);
132
+		}
119 133
 		print '<div><span class="label">'._("Flights").'</span>'.$flights.'</div>';
120 134
 		$aircraft_type = count($Spotter->countAllAircraftTypesByPilot($pilot,$filter));
121 135
 		print '<div><span class="label">'._("Aircraft type").'</span>'.$aircraft_type.'</div>';
@@ -126,7 +140,9 @@  discard block
 block discarded – undo
126 140
 		$airlines = count($Spotter->countAllAirlinesByPilot($pilot,$filter));
127 141
 		print '<div><span class="label">'._("Airlines").'</span>'.$airlines.'</div>';
128 142
 		$duration = $Spotter->getFlightDurationByPilot($pilot,$filter);
129
-		if ($duration != '0') print '<div><span class="label">'._("Total flights spotted duration").'</span>'.$duration.'</div>';
143
+		if ($duration != '0') {
144
+			print '<div><span class="label">'._("Total flights spotted duration").'</span>'.$duration.'</div>';
145
+		}
130 146
 		print '</div>';
131 147
 	
132 148
 		include('pilot-sub-menu.php');
Please login to merge, or discard this patch.
header.php 1 patch
Braces   +90 added lines, -20 removed lines patch added patch discarded remove patch
@@ -6,12 +6,19 @@  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
-if (isset($globalMapOffline) && $globalMapOffline) $MapType = 'offline';
19
+if (isset($globalMapOffline) && $globalMapOffline) {
20
+	$MapType = 'offline';
21
+}
15 22
 
16 23
 if (isset($_GET['3d'])) {
17 24
 	setcookie('MapFormat','3d');
@@ -219,7 +226,10 @@  discard block
 block discarded – undo
219 226
 <?php
220 227
 //		}
221 228
 ?>
222
-<script src="<?php print $globalURL; ?>/js/map.2d.js.php?<?php print time(); ?><?php if (isset($tsk)) print '&tsk='.$tsk; ?>"></script>
229
+<script src="<?php print $globalURL; ?>/js/map.2d.js.php?<?php print time(); ?><?php if (isset($tsk)) {
230
+	print '&tsk='.$tsk;
231
+}
232
+?>"></script>
223 233
 <?php
224 234
 		if (!isset($globalAircraft) || $globalAircraft) {
225 235
 ?>
@@ -264,7 +274,13 @@  discard block
 block discarded – undo
264 274
 <script src="<?php print $globalURL; ?>/js/MovingMarker.js"></script>
265 275
 <script src="<?php print $globalURL; ?>/js/jquery.idle.min.js"></script>
266 276
 <script src="<?php print $globalURL; ?>/js/map.common.js"></script>
267
-<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>
277
+<script src="<?php print $globalURL; ?>/js/map.2d.js.php?ident=<?php print $ident; ?><?php if(isset($latitude)) {
278
+	print '&latitude='.$latitude;
279
+}
280
+?><?php if(isset($longitude)) {
281
+	print '&longitude='.$longitude;
282
+}
283
+?>&<?php print time(); ?>"></script>
268 284
 <?php
269 285
 		if (!isset($type) || $type == 'aircraft') {
270 286
 ?>
@@ -337,7 +353,13 @@  discard block
 block discarded – undo
337 353
 <script src="<?php print $globalURL; ?>/js/MovingMarker.js"></script>
338 354
 <script src="<?php print $globalURL; ?>/js/jquery.idle.min.js"></script>
339 355
 <script src="<?php print $globalURL; ?>/js/map.common.js"></script>
340
-<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>
356
+<script src="<?php print $globalURL; ?>/js/map.2d.js.php?flightaware_id=<?php print $flightaware_id; ?><?php if(isset($latitude)) {
357
+	print '&latitude='.$latitude;
358
+}
359
+?><?php if(isset($longitude)) {
360
+	print '&longitude='.$longitude;
361
+}
362
+?>&<?php print time(); ?>"></script>
341 363
 <script src="<?php print $globalURL; ?>/js/map-aircraft.2d.js.php?flightaware_id=<?php print $flightaware_id; ?>&<?php print time(); ?>"></script>
342 364
 <?php
343 365
 		if (isset($globalGoogleAPIKey) && $globalGoogleAPIKey != '' && ($MapType == 'Google-Roadmap' || $MapType == 'Google-Satellite' || $MapType == 'Google-Hybrid' || $MapType == 'Google-Terrain')) {
@@ -418,7 +440,12 @@  discard block
 block discarded – undo
418 440
         <span class="icon-bar"></span>
419 441
       </button>
420 442
       <a href="<?php print $globalURL; ?>/search" class="navbar-toggle search"><i class="fa fa-search"></i></a>
421
-      <a class="navbar-brand" href="<?php if ($globalURL == '') print '/'; else print $globalURL; ?>"><img src="<?php print $globalURL.$logoURL; ?>" height="30px" /></a>
443
+      <a class="navbar-brand" href="<?php if ($globalURL == '') {
444
+	print '/';
445
+} else {
446
+	print $globalURL;
447
+}
448
+?>"><img src="<?php print $globalURL.$logoURL; ?>" height="30px" /></a>
422 449
     </div>
423 450
     <div class="collapse navbar-collapse">
424 451
 
@@ -473,7 +500,10 @@  discard block
 block discarded – undo
473 500
 	}
474 501
 ?>
475 502
 
476
-          <a href="#" class="dropdown-toggle" data-toggle="dropdown"><?php echo _("Explore"); ?> <b class="<?php if ($sub) echo 'right-'; ?>caret"></b></a>
503
+          <a href="#" class="dropdown-toggle" data-toggle="dropdown"><?php echo _("Explore"); ?> <b class="<?php if ($sub) {
504
+	echo 'right-';
505
+}
506
+?>caret"></b></a>
477 507
           <ul class="dropdown-menu">
478 508
           	<li><a href="<?php print $globalURL; ?>/aircraft"><?php echo _("Aircraft Types"); ?></a></li>
479 509
 <?php
@@ -544,8 +574,14 @@  discard block
 block discarded – undo
544 574
         </li>
545 575
       	<li><a href="<?php print $globalURL; ?>/search"><?php echo _("Search"); ?></a></li>
546 576
       	<li><a href="<?php print $globalURL; ?>/statistics"><?php echo _("Statistics"); ?></a></li>
547
-        <li class="dropdown<?php if ($sub) echo '-submenu'; ?>">
548
-          <a href="#" class="dropdown-toggle" data-toggle="dropdown"><?php echo _("Tools"); ?> <b class="<?php if ($sub) echo 'right-'; ?>caret"></b></a>
577
+        <li class="dropdown<?php if ($sub) {
578
+	echo '-submenu';
579
+}
580
+?>">
581
+          <a href="#" class="dropdown-toggle" data-toggle="dropdown"><?php echo _("Tools"); ?> <b class="<?php if ($sub) {
582
+	echo 'right-';
583
+}
584
+?>caret"></b></a>
549 585
           <ul class="dropdown-menu">
550 586
           	<li><a href="<?php print $globalURL; ?>/tools/acars"><?php echo _("ACARS translator"); ?></a></li>
551 587
           	<li><a href="<?php print $globalURL; ?>/tools/metar"><?php echo _("METAR translator"); ?></a></li>
@@ -589,7 +625,10 @@  discard block
 block discarded – undo
589 625
 <?php
590 626
 	}
591 627
 ?>
592
-		<a href="#" class="dropdown-toggle" data-toggle="dropdown"><?php echo _("Explore"); ?> <b class="<?php if ($sub) echo 'right-'; ?>caret"></b></a>
628
+		<a href="#" class="dropdown-toggle" data-toggle="dropdown"><?php echo _("Explore"); ?> <b class="<?php if ($sub) {
629
+	echo 'right-';
630
+}
631
+?>caret"></b></a>
593 632
 		<ul class="dropdown-menu">
594 633
 		    <li><a href="<?php print $globalURL; ?>/marine/currently"><?php echo _("Current Activity"); ?></a></li>
595 634
 		    <li><a href="<?php print $globalURL; ?>/marine/latest"><?php echo _("Latest Activity"); ?></a></li>
@@ -630,7 +669,10 @@  discard block
 block discarded – undo
630 669
 <?php
631 670
 	}
632 671
 ?>
633
-		<a href="#" class="dropdown-toggle" data-toggle="dropdown"><?php echo _("Explore"); ?> <b class="<?php if ($sub) echo 'right-'; ?>caret"></b></a>
672
+		<a href="#" class="dropdown-toggle" data-toggle="dropdown"><?php echo _("Explore"); ?> <b class="<?php if ($sub) {
673
+	echo 'right-';
674
+}
675
+?>caret"></b></a>
634 676
 		<ul class="dropdown-menu">
635 677
 		    <li><a href="<?php print $globalURL; ?>/tracker/currently"><?php echo _("Current Activity"); ?></a></li>
636 678
 		    <li><a href="<?php print $globalURL; ?>/tracker/latest"><?php echo _("Latest Activity"); ?></a></li>
@@ -673,7 +715,10 @@  discard block
 block discarded – undo
673 715
 ?>
674 716
 
675 717
 <!--
676
-		<a href="#" class="dropdown-toggle" data-toggle="dropdown"><?php echo _("Explore"); ?> <b class="<?php if ($sub) echo 'right-'; ?>caret"></b></a>
718
+		<a href="#" class="dropdown-toggle" data-toggle="dropdown"><?php echo _("Explore"); ?> <b class="<?php if ($sub) {
719
+	echo 'right-';
720
+}
721
+?>caret"></b></a>
677 722
 		<ul class="dropdown-menu">
678 723
 		    <li><a href="<?php print $globalURL; ?>/satellite/currently"><?php echo _("Current Activity"); ?></a></li>
679 724
 		    <li><a href="<?php print $globalURL; ?>/satellite/latest"><?php echo _("Latest Activity"); ?></a></li>
@@ -730,7 +775,9 @@  discard block
 block discarded – undo
730 775
   		        $alllang = $Language->getLanguages();
731 776
   		        foreach ($alllang as $key => $lang) {
732 777
   		            print '<option value="'.$key.'"';
733
-  		            if (isset($_COOKIE['language']) && $_COOKIE['language'] == $key) print ' selected ';
778
+  		            if (isset($_COOKIE['language']) && $_COOKIE['language'] == $key) {
779
+  		            	print ' selected ';
780
+  		            }
734 781
   		            print '>'.$lang[0].'</option>';
735 782
   		        }
736 783
   		    ?>
@@ -878,9 +925,24 @@  discard block
 block discarded – undo
878 925
 	$customid = $globalMapProvider;
879 926
 ?>
880 927
     L.tileLayer('<?php print $globalMapCustomLayer[$customid]['url']; ?>/{z}/{x}/{y}.png', {
881
-        maxZoom: <?php if (isset($globalMapCustomLayer[$customid]['maxZoom'])) print $globalMapCustomLayer[$customid]['maxZoom']; else print '18'; ?>,
882
-        minZoom: <?php if (isset($globalMapCustomLayer[$customid]['minZoom'])) print $globalMapCustomLayer[$customid]['minZoom']; else print '0'; ?>,
883
-        noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) print 'false'; else print 'true'; ?>,
928
+        maxZoom: <?php if (isset($globalMapCustomLayer[$customid]['maxZoom'])) {
929
+	print $globalMapCustomLayer[$customid]['maxZoom'];
930
+} else {
931
+	print '18';
932
+}
933
+?>,
934
+        minZoom: <?php if (isset($globalMapCustomLayer[$customid]['minZoom'])) {
935
+	print $globalMapCustomLayer[$customid]['minZoom'];
936
+} else {
937
+	print '0';
938
+}
939
+?>,
940
+        noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) {
941
+	print 'false';
942
+} else {
943
+	print 'true';
944
+}
945
+?>,
884 946
         attribution: '<?php print $globalMapCustomLayer[$customid]['attribution']; ?>'
885 947
     }).addTo(map);
886 948
 <?php
@@ -895,7 +957,12 @@  discard block
 block discarded – undo
895 957
         maxZoom: 5,
896 958
         tms : true,
897 959
         zindex : 3,
898
-        noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) print 'false'; else print 'true'; ?>,
960
+        noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) {
961
+	print 'false';
962
+} else {
963
+	print 'true';
964
+}
965
+?>,
899 966
         attribution: 'Natural Earth'
900 967
     }).addTo(map);
901 968
 <?php
@@ -918,4 +985,7 @@  discard block
 block discarded – undo
918 985
 
919 986
 ?>
920 987
 
921
-<section class="container main-content <?php if (strtolower($current_page) == 'index') print 'index '; ?>clear">
988
+<section class="container main-content <?php if (strtolower($current_page) == 'index') {
989
+	print 'index ';
990
+}
991
+?>clear">
Please login to merge, or discard this patch.