Completed
Push — master ( 64a0a6...a96b73 )
by Yannick
05:21
created
js/map.js.php 1 patch
Spacing   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -2,7 +2,7 @@  discard block
 block discarded – undo
2 2
 require_once('../require/settings.php');
3 3
 require_once('../require/class.Language.php'); 
4 4
 
5
-setcookie("MapFormat",'2d');
5
+setcookie("MapFormat", '2d');
6 6
 //$_COOKIE['MapFormat'] = '2d';
7 7
 
8 8
 // Compressed GeoJson is used if true
@@ -21,10 +21,10 @@  discard block
 block discarded – undo
21 21
 		$lastupd = $_GET['archivespeed']*$archiveupdatetime;
22 22
 		if (isset($_GET['enddate']) && $_GET['enddate'] != '') $enddate = $_GET['enddate'];
23 23
 		else $enddate = time();
24
-		setcookie("archive_begin",$begindate);
25
-		setcookie("archive_end",$enddate);
26
-		setcookie("archive_update",$lastupd);
27
-		setcookie("archive_speed",$archivespeed);
24
+		setcookie("archive_begin", $begindate);
25
+		setcookie("archive_end", $enddate);
26
+		setcookie("archive_update", $lastupd);
27
+		setcookie("archive_speed", $archivespeed);
28 28
 ?>
29 29
 
30 30
 document.cookie =  'archive_begin=<?php print $begindate; ?>; expires=Thu, 2 Aug 2100 20:47:11 UTC; path=/';
@@ -95,16 +95,16 @@  discard block
 block discarded – undo
95 95
 <?php
96 96
 	}
97 97
 	if (isset($_GET['ident'])) {
98
-		$ident = filter_input(INPUT_GET,'ident',FILTER_SANITIZE_STRING);
98
+		$ident = filter_input(INPUT_GET, 'ident', FILTER_SANITIZE_STRING);
99 99
 	}
100 100
 	if (isset($_GET['flightaware_id'])) {
101
-		$flightaware_id = filter_input(INPUT_GET,'flightaware_id',FILTER_SANITIZE_STRING);
101
+		$flightaware_id = filter_input(INPUT_GET, 'flightaware_id', FILTER_SANITIZE_STRING);
102 102
 	}
103 103
 	if (isset($_GET['latitude'])) {
104
-		$latitude = filter_input(INPUT_GET,'latitude',FILTER_SANITIZE_STRING);
104
+		$latitude = filter_input(INPUT_GET, 'latitude', FILTER_SANITIZE_STRING);
105 105
 	}
106 106
 	if (isset($_GET['longitude'])) {
107
-		$longitude = filter_input(INPUT_GET,'longitude',FILTER_SANITIZE_STRING);
107
+		$longitude = filter_input(INPUT_GET, 'longitude', FILTER_SANITIZE_STRING);
108 108
 	}
109 109
 ?>
110 110
 
@@ -139,7 +139,7 @@  discard block
 block discarded – undo
139 139
 	     || navigator.userAgent.match(/BlackBerry/i)
140 140
 	     || navigator.userAgent.match(/Windows Phone/i))
141 141
 	{
142
-		var zoom = <?php if (isset($globalLiveZoom)) print $globalLiveZoom-1; else print '8'; ?>;
142
+		var zoom = <?php if (isset($globalLiveZoom)) print $globalLiveZoom - 1; else print '8'; ?>;
143 143
 	} else {
144 144
 		var zoom = <?php if (isset($globalLiveZoom)) print $globalLiveZoom; else print '9'; ?>;
145 145
 	}
@@ -233,19 +233,19 @@  discard block
 block discarded – undo
233 233
 	map.addLayer(yandexLayer);
234 234
 <?php
235 235
 	} elseif ($MapType == 'Bing-Aerial') {
236
-		if (!isset($globalBingMapKey) || $globalBingMapKey == '') setcookie('MapType','OpenStreetMap');
236
+		if (!isset($globalBingMapKey) || $globalBingMapKey == '') setcookie('MapType', 'OpenStreetMap');
237 237
 ?>
238 238
 	var bingLayer = new L.tileLayer.bing({bingMapsKey: '<?php print $globalBingMapKey; ?>',imagerySet: 'Aerial'});
239 239
 	map.addLayer(bingLayer);
240 240
 <?php
241 241
 	} elseif ($MapType == 'Bing-Hybrid') {
242
-		if (!isset($globalBingMapKey) || $globalBingMapKey == '') setcookie('MapType','OpenStreetMap');
242
+		if (!isset($globalBingMapKey) || $globalBingMapKey == '') setcookie('MapType', 'OpenStreetMap');
243 243
 ?>
244 244
 	var bingLayer = new L.tileLayer.bing({bingMapsKey: '<?php print $globalBingMapKey; ?>',imagerySet: 'AerialWithLabels'});
245 245
 	map.addLayer(bingLayer);
246 246
 <?php
247 247
 	} elseif ($MapType == 'Bing-Road') {
248
-		if (!isset($globalBingMapKey) || $globalBingMapKey == '') setcookie('MapType','OpenStreetMap');
248
+		if (!isset($globalBingMapKey) || $globalBingMapKey == '') setcookie('MapType', 'OpenStreetMap');
249 249
 ?>
250 250
 	var bingLayer = new L.tileLayer.bing({bingMapsKey: '<?php print $globalBingMapKey; ?>',imagerySet: 'Road'});
251 251
 	map.addLayer(bingLayer);
@@ -535,10 +535,10 @@  discard block
 block discarded – undo
535 535
 	};
536 536
 	archive.update = function (props) {
537 537
 		if (typeof props != 'undefined') {
538
-			//this._div.innerHTML = '<h4><?php echo str_replace("'","\'",_("Archive Date & Time")); ?></h4>' +  '<b>' + props.archive_date + ' UTC </b>' + '<br/><i class="fa fa-fast-backward" aria-hidden="true"></i> <i class="fa fa-backward" aria-hidden="true"></i>  <a href="#" onClick="archivePause();"><i class="fa fa-pause" aria-hidden="true"></i></a> <a href="#" onClick="archivePlay();"><i class="fa fa-play" aria-hidden="true"></i></a>  <i class="fa fa-forward" aria-hidden="true"></i> <i class="fa fa-fast-forward" aria-hidden="true"></i>';
539
-			this._div.innerHTML = '<h4><?php echo str_replace("'","\'",_("Archive Date & Time")); ?></h4>' +  '<b>' + props.archive_date + ' UTC </b>' + '<br/><a href="#" onClick="archivePause();"><i class="fa fa-pause" aria-hidden="true"></i></a> <a href="#" onClick="archivePlay();"><i class="fa fa-play" aria-hidden="true"></i></a>';
538
+			//this._div.innerHTML = '<h4><?php echo str_replace("'", "\'", _("Archive Date & Time")); ?></h4>' +  '<b>' + props.archive_date + ' UTC </b>' + '<br/><i class="fa fa-fast-backward" aria-hidden="true"></i> <i class="fa fa-backward" aria-hidden="true"></i>  <a href="#" onClick="archivePause();"><i class="fa fa-pause" aria-hidden="true"></i></a> <a href="#" onClick="archivePlay();"><i class="fa fa-play" aria-hidden="true"></i></a>  <i class="fa fa-forward" aria-hidden="true"></i> <i class="fa fa-fast-forward" aria-hidden="true"></i>';
539
+			this._div.innerHTML = '<h4><?php echo str_replace("'", "\'", _("Archive Date & Time")); ?></h4>' +  '<b>' + props.archive_date + ' UTC </b>' + '<br/><a href="#" onClick="archivePause();"><i class="fa fa-pause" aria-hidden="true"></i></a> <a href="#" onClick="archivePlay();"><i class="fa fa-play" aria-hidden="true"></i></a>';
540 540
 		} else {
541
-			this._div.innerHTML = '<h4><?php echo str_replace("'","\'",_("Archive Date & Time")); ?></h4>' +  '<b><i class="fa fa-spinner fa-pulse fa-2x fa-fw margin-bottom"></i></b>';
541
+			this._div.innerHTML = '<h4><?php echo str_replace("'", "\'", _("Archive Date & Time")); ?></h4>' +  '<b><i class="fa fa-spinner fa-pulse fa-2x fa-fw margin-bottom"></i></b>';
542 542
 		}
543 543
 
544 544
 	};
@@ -738,7 +738,7 @@  discard block
 block discarded – undo
738 738
 <?php
739 739
 		} else {
740 740
 ?>
741
-		    var movingtime = Math.round(<?php if (isset($archiveupdatetime)) print $archiveupdatetime*1000; else print $globalMapRefresh*1000+20000; ?>+feature.properties.sqt*1000);
741
+		    var movingtime = Math.round(<?php if (isset($archiveupdatetime)) print $archiveupdatetime*1000; else print $globalMapRefresh*1000 + 20000; ?>+feature.properties.sqt*1000);
742 742
 		    return new L.Marker.movingMarker([latLng, feature.properties.nextlatlon],[movingtime],{
743 743
 <?php
744 744
 		}
@@ -753,7 +753,7 @@  discard block
 block discarded – undo
753 753
 			    iconAnchor: [<?php print $globalAircraftSize/2; ?>, <?php print $globalAircraftSize; ?>],
754 754
 			    shadowUrl: iconURLShadowpath,
755 755
 			    shadowSize: [<?php print $globalAircraftSize; ?>, <?php print $globalAircraftSize; ?>],
756
-			    shadowAnchor: [<?php print ($globalAircraftSize/2)+1; ?>, <?php print $globalAircraftSize; ?>]
756
+			    shadowAnchor: [<?php print ($globalAircraftSize/2) + 1; ?>, <?php print $globalAircraftSize; ?>]
757 757
 			})
758 758
 		    })
759 759
 <?php
@@ -785,7 +785,7 @@  discard block
 block discarded – undo
785 785
 <?php
786 786
 		} else {
787 787
 ?>
788
-			    var movingtime = Math.round(<?php if (isset($archiveupdatetime)) print $archiveupdatetime*1000; else print $globalMapRefresh*1000+20000; ?>+feature.properties.sqt*1000);
788
+			    var movingtime = Math.round(<?php if (isset($archiveupdatetime)) print $archiveupdatetime*1000; else print $globalMapRefresh*1000 + 20000; ?>+feature.properties.sqt*1000);
789 789
 			    return new L.Marker.movingMarker([latLng, feature.properties.nextlatlon],[movingtime],{
790 790
 <?php
791 791
 		}
@@ -831,7 +831,7 @@  discard block
 block discarded – undo
831 831
 <?php
832 832
 		} else {
833 833
 ?>
834
-			    var movingtime = Math.round(<?php if (isset($archiveupdatetime)) print $archiveupdatetime*1000; else print $globalMapRefresh*1000+20000; ?>+feature.properties.sqt*1000);
834
+			    var movingtime = Math.round(<?php if (isset($archiveupdatetime)) print $archiveupdatetime*1000; else print $globalMapRefresh*1000 + 20000; ?>+feature.properties.sqt*1000);
835 835
 			    return new L.Marker.movingMarker([latLng, feature.properties.nextlatlon],[movingtime],{
836 836
 <?php
837 837
 		}
@@ -1420,18 +1420,18 @@  discard block
 block discarded – undo
1420 1420
 	    airs.push(air.value);
1421 1421
 	}
1422 1422
     }
1423
-    document.cookie =  'filter_Airlines='+airs.join()+'; expires=<?php print date("D, j M Y G:i:s T",mktime(0, 0, 0, date("m")  , date("d")+1, date("Y"))); ?>; path=/'
1423
+    document.cookie =  'filter_Airlines='+airs.join()+'; expires=<?php print date("D, j M Y G:i:s T", mktime(0, 0, 0, date("m"), date("d") + 1, date("Y"))); ?>; path=/'
1424 1424
 }
1425 1425
 function airlinestype(selectObj) {
1426 1426
     var idx = selectObj.selectedIndex;
1427 1427
     var airtype = selectObj.options[idx].value;
1428
-    document.cookie =  'filter_airlinestype='+airtype+'; expires=<?php print date("D, j M Y G:i:s T",mktime(0, 0, 0, date("m")  , date("d")+1, date("Y"))); ?>; path=/'
1428
+    document.cookie =  'filter_airlinestype='+airtype+'; expires=<?php print date("D, j M Y G:i:s T", mktime(0, 0, 0, date("m"), date("d") + 1, date("Y"))); ?>; path=/'
1429 1429
 }
1430 1430
 
1431 1431
 function identfilter() {
1432 1432
     var ident = $('#identfilter').val();
1433 1433
     console.log('Filter with '+ident);
1434
-    document.cookie =  'filter_ident='+ident+'; expires=<?php print date("D, j M Y G:i:s T",mktime(0, 0, 0, date("m")  , date("d")+2, date("Y"))); ?>; path=/'
1434
+    document.cookie =  'filter_ident='+ident+'; expires=<?php print date("D, j M Y G:i:s T", mktime(0, 0, 0, date("m"), date("d") + 2, date("Y"))); ?>; path=/'
1435 1435
 }
1436 1436
 function removefilters() {
1437 1437
     // Get an array of all cookie names (the regex matches what we don't want)
@@ -1453,7 +1453,7 @@  discard block
 block discarded – undo
1453 1453
 	}
1454 1454
     }
1455 1455
     //document.cookie =  'Sources='+sources.join()+'; expires=Thu, 2 Aug 2100 20:47:11 UTC; path=/'
1456
-    document.cookie =  'filter_Sources='+sources.join()+'; expires=<?php print date("D, j M Y G:i:s T",mktime(0, 0, 0, date("m")  , date("d")+1, date("Y"))); ?>; path=/'
1456
+    document.cookie =  'filter_Sources='+sources.join()+'; expires=<?php print date("D, j M Y G:i:s T", mktime(0, 0, 0, date("m"), date("d") + 1, date("Y"))); ?>; path=/'
1457 1457
 }
1458 1458
 
1459 1459
 function show3D() {
@@ -1476,23 +1476,23 @@  discard block
 block discarded – undo
1476 1476
 
1477 1477
 function clickVATSIM(cb) {
1478 1478
     //document.cookie =  'ShowVATSIM='+cb.checked+'; expires=Thu, 2 Aug 2100 20:47:11 UTC; path=/'
1479
-    document.cookie =  'filter_ShowVATSIM='+cb.checked+'; expires=<?php print date("D, j M Y G:i:s T",mktime(0, 0, 0, date("m")  , date("d")+2, date("Y"))); ?>; path=/'
1479
+    document.cookie =  'filter_ShowVATSIM='+cb.checked+'; expires=<?php print date("D, j M Y G:i:s T", mktime(0, 0, 0, date("m"), date("d") + 2, date("Y"))); ?>; path=/'
1480 1480
 }
1481 1481
 function clickIVAO(cb) {
1482 1482
     //document.cookie =  'ShowIVAO='+cb.checked+'; expires=Thu, 2 Aug 2100 20:47:11 UTC; path=/'
1483
-    document.cookie =  'filter_ShowIVAO='+cb.checked+'; expires=<?php print date("D, j M Y G:i:s T",mktime(0, 0, 0, date("m")  , date("d")+2, date("Y"))); ?>; path=/'
1483
+    document.cookie =  'filter_ShowIVAO='+cb.checked+'; expires=<?php print date("D, j M Y G:i:s T", mktime(0, 0, 0, date("m"), date("d") + 2, date("Y"))); ?>; path=/'
1484 1484
 }
1485 1485
 function clickphpVMS(cb) {
1486 1486
     //document.cookie =  'ShowVMS='+cb.checked+'; expires=Thu, 2 Aug 2100 20:47:11 UTC; path=/'
1487
-    document.cookie =  'filter_ShowVMS='+cb.checked+'; expires=<?php print date("D, j M Y G:i:s T",mktime(0, 0, 0, date("m")  , date("d")+2, date("Y"))); ?>; path=/'
1487
+    document.cookie =  'filter_ShowVMS='+cb.checked+'; expires=<?php print date("D, j M Y G:i:s T", mktime(0, 0, 0, date("m"), date("d") + 2, date("Y"))); ?>; path=/'
1488 1488
 }
1489 1489
 function clickSBS1(cb) {
1490 1490
     //document.cookie =  'ShowSBS1='+cb.checked+'; expires=Thu, 2 Aug 2100 20:47:11 UTC; path=/'
1491
-    document.cookie =  'filter_ShowSBS1='+cb.checked+'; expires=<?php print date("D, j M Y G:i:s T",mktime(0, 0, 0, date("m")  , date("d")+2, date("Y"))); ?>; path=/'
1491
+    document.cookie =  'filter_ShowSBS1='+cb.checked+'; expires=<?php print date("D, j M Y G:i:s T", mktime(0, 0, 0, date("m"), date("d") + 2, date("Y"))); ?>; path=/'
1492 1492
 }
1493 1493
 function clickAPRS(cb) {
1494 1494
     //document.cookie =  'ShowAPRS='+cb.checked+'; expires=Thu, 2 Aug 2100 20:47:11 UTC; path=/'
1495
-    document.cookie =  'filter_ShowAPRS='+cb.checked+'; expires=<?php print date("D, j M Y G:i:s T",mktime(0, 0, 0, date("m")  , date("d")+2, date("Y"))); ?>; path=/'
1495
+    document.cookie =  'filter_ShowAPRS='+cb.checked+'; expires=<?php print date("D, j M Y G:i:s T", mktime(0, 0, 0, date("m"), date("d") + 2, date("Y"))); ?>; path=/'
1496 1496
 }
1497 1497
 function clickFlightPopup(cb) {
1498 1498
     document.cookie =  'flightpopup='+cb.checked+'; expires=Thu, 2 Aug 2100 20:47:11 UTC; path=/'
Please login to merge, or discard this patch.
aircraft-data.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -9,14 +9,14 @@  discard block
 block discarded – undo
9 9
 
10 10
 $from_archive = false;
11 11
 if (isset($_GET['ident'])) {
12
-	$ident = filter_input(INPUT_GET,'ident',FILTER_SANITIZE_STRING);
12
+	$ident = filter_input(INPUT_GET, 'ident', FILTER_SANITIZE_STRING);
13 13
 	if (isset($_GET['currenttime'])) {
14
-		$currenttime = filter_input(INPUT_GET,'currenttime',FILTER_SANITIZE_NUMBER_INT);
14
+		$currenttime = filter_input(INPUT_GET, 'currenttime', FILTER_SANITIZE_NUMBER_INT);
15 15
 		$currenttime = round($currenttime/1000);
16
-		$spotter_array = $SpotterLive->getDateLiveSpotterDataByIdent($ident,$currenttime);
16
+		$spotter_array = $SpotterLive->getDateLiveSpotterDataByIdent($ident, $currenttime);
17 17
 		if (empty($spotter_array)) {
18 18
 			$from_archive = true;
19
-			$spotter_array = $SpotterArchive->getDateArchiveSpotterDataByIdent($ident,$currenttime);
19
+			$spotter_array = $SpotterArchive->getDateArchiveSpotterDataByIdent($ident, $currenttime);
20 20
 		}
21 21
 	} else {
22 22
 		$spotter_array = $SpotterLive->getLastLiveSpotterDataByIdent($ident);
@@ -27,15 +27,15 @@  discard block
 block discarded – undo
27 27
 	}
28 28
 }
29 29
 if (isset($_GET['flightaware_id'])) {
30
-	$flightaware_id = filter_input(INPUT_GET,'flightaware_id',FILTER_SANITIZE_STRING);
30
+	$flightaware_id = filter_input(INPUT_GET, 'flightaware_id', FILTER_SANITIZE_STRING);
31 31
 	if (isset($_GET['currenttime'])) {
32
-		$currenttime = filter_input(INPUT_GET,'currenttime',FILTER_SANITIZE_NUMBER_INT);
32
+		$currenttime = filter_input(INPUT_GET, 'currenttime', FILTER_SANITIZE_NUMBER_INT);
33 33
 		$currenttime = round($currenttime/1000);
34
-		$spotter_array = $SpotterLive->getDateLiveSpotterDataById($flightaware_id,$currenttime);
34
+		$spotter_array = $SpotterLive->getDateLiveSpotterDataById($flightaware_id, $currenttime);
35 35
 		if (empty($spotter_array)) {
36 36
 			$from_archive = true;
37 37
 //			$spotter_array = $SpotterArchive->getLastArchiveSpotterDataById($flightaware_id);
38
-			$spotter_array = $SpotterArchive->getDateArchiveSpotterDataById($flightaware_id,$currenttime);
38
+			$spotter_array = $SpotterArchive->getDateArchiveSpotterDataById($flightaware_id, $currenttime);
39 39
 		}
40 40
 	} else {
41 41
 		$spotter_array = $SpotterLive->getLastLiveSpotterDataById($flightaware_id);
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
 if (isset($spotter_item['image_thumbnail']) && $spotter_item['image_thumbnail'] != "")
55 55
 {
56 56
 	if ($spotter_item['image_source'] == 'flickr' || $spotter_item['image_source'] == 'wikimedia' || $spotter_item['image_source'] == 'devianart') {
57
-		$image = preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']);
57
+		$image = preg_replace("/^http:/i", "https:", $spotter_item['image_thumbnail']);
58 58
 	} else $image = $spotter_item['image_thumbnail'];
59 59
 
60 60
 }
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
 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'];
73 73
 if (isset($spotter_item['departure_airport_time'])) {
74 74
 	if ($spotter_item['departure_airport_time'] > 2460) {
75
-		print '<br /><span class="time">'.date('H:m',$spotter_item['departure_airport_time']).'</span>';
75
+		print '<br /><span class="time">'.date('H:m', $spotter_item['departure_airport_time']).'</span>';
76 76
 	} else {
77 77
 		print '<br /><span class="time">'.$spotter_item['departure_airport_time'].'</span>';
78 78
 	}
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
 print '<span class="code"><a href="'.$globalURL.'/airport/'.$spotter_item['arrival_airport'].'" target="_blank">'.$spotter_item['arrival_airport'].'</a></span>'.$spotter_item['arrival_airport_city'].' '.$spotter_item['arrival_airport_country'];
82 82
 if (isset($spotter_item['arrival_airport_time'])) {
83 83
 	if ($spotter_item['arrival_airport_time'] > 2460) {
84
-		print '<br /><span class="time">'.date('H:m',$spotter_item['arrival_airport_time']).'</span>';
84
+		print '<br /><span class="time">'.date('H:m', $spotter_item['arrival_airport_time']).'</span>';
85 85
 	} else {
86 86
 		print '<br /><span class="time">'.$spotter_item['arrival_airport_time'].'</span>';
87 87
 	}
@@ -149,7 +149,7 @@  discard block
 block discarded – undo
149 149
 
150 150
 if (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>';
151 151
 if (isset($spotter_item['waypoints']) && $spotter_item['waypoints'] != '') print '<div class="waypoints"><span>'._("Route").'</span>'.$spotter_item['waypoints'].'</div>';
152
-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>';
152
+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>';
153 153
 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>';
154 154
 print '</div>';
155 155
 ?>
Please login to merge, or discard this patch.
live-geojson.php 1 patch
Spacing   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -25,22 +25,22 @@  discard block
 block discarded – undo
25 25
 $min = false;
26 26
 $allhistory = false;
27 27
 $filter['source'] = array();
28
-if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') $filter['source'] = array_merge($filter['source'],array('vatsimtxt'));
29
-if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') $filter['source'] = array_merge($filter['source'],array('whazzup'));
30
-if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') $filter['source'] = array_merge($filter['source'],array('phpvmacars'));
31
-if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') $filter['source'] = array_merge($filter['source'],array('sbs'));
32
-if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') $filter['source'] = array_merge($filter['source'],array('aprs'));
33
-if (isset($_COOKIE['filter_ident']) && $_COOKIE['filter_ident'] != '') $filter['ident'] = filter_var($_COOKIE['filter_ident'],FILTER_SANITIZE_STRING);
34
-if (isset($_COOKIE['filter_Airlines']) && $_COOKIE['filter_Airlines'] != '') $filter['airlines'] = filter_var_array(explode(',',$_COOKIE['filter_Airlines']),FILTER_SANITIZE_STRING);
35
-if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') $filter['source_aprs'] = filter_var_array(explode(',',$_COOKIE['filter_Sources']),FILTER_SANITIZE_STRING);
36
-if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') $filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'],FILTER_SANITIZE_STRING);
28
+if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') $filter['source'] = array_merge($filter['source'], array('vatsimtxt'));
29
+if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') $filter['source'] = array_merge($filter['source'], array('whazzup'));
30
+if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') $filter['source'] = array_merge($filter['source'], array('phpvmacars'));
31
+if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') $filter['source'] = array_merge($filter['source'], array('sbs'));
32
+if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') $filter['source'] = array_merge($filter['source'], array('aprs'));
33
+if (isset($_COOKIE['filter_ident']) && $_COOKIE['filter_ident'] != '') $filter['ident'] = filter_var($_COOKIE['filter_ident'], FILTER_SANITIZE_STRING);
34
+if (isset($_COOKIE['filter_Airlines']) && $_COOKIE['filter_Airlines'] != '') $filter['airlines'] = filter_var_array(explode(',', $_COOKIE['filter_Airlines']), FILTER_SANITIZE_STRING);
35
+if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') $filter['source_aprs'] = filter_var_array(explode(',', $_COOKIE['filter_Sources']), FILTER_SANITIZE_STRING);
36
+if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') $filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'], FILTER_SANITIZE_STRING);
37 37
 
38 38
 if (isset($globalMapPopup) && !$globalMapPopup && !(isset($_COOKIE['flightpopup']) && $_COOKIE['flightpopup'] == 'true')) {
39 39
 	$min = true;
40 40
 }
41 41
 
42 42
 if (isset($_GET['ident'])) {
43
-	$ident = filter_input(INPUT_GET,'ident',FILTER_SANITIZE_STRING);
43
+	$ident = filter_input(INPUT_GET, 'ident', FILTER_SANITIZE_STRING);
44 44
 	$spotter_array = $SpotterLive->getLastLiveSpotterDataByIdent($ident);
45 45
 	if (empty($spotter_array)) {
46 46
 		$from_archive = true;
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
 	}
49 49
 	$allhistory = true;
50 50
 } elseif (isset($_GET['flightaware_id'])) {
51
-	$flightaware_id = filter_input(INPUT_GET,'flightaware_id',FILTER_SANITIZE_STRING);
51
+	$flightaware_id = filter_input(INPUT_GET, 'flightaware_id', FILTER_SANITIZE_STRING);
52 52
 	$spotter_array = $SpotterLive->getLastLiveSpotterDataById($flightaware_id);
53 53
 	if (empty($spotter_array)) {
54 54
 		$from_archive = true;
@@ -57,37 +57,37 @@  discard block
 block discarded – undo
57 57
 	$allhistory = true;
58 58
 } elseif (isset($_GET['coord']) && (!isset($globalMapPopup) || $globalMapPopup || (isset($_COOKIE['flightpopup']) && $_COOKIE['flightpopup'] == 'true'))) {
59 59
 //if (isset($_GET['coord'])) {
60
-	$coord = explode(',',$_GET['coord']);
61
-	$spotter_array = $SpotterLive->getLiveSpotterDatabyCoord($coord,$filter);
60
+	$coord = explode(',', $_GET['coord']);
61
+	$spotter_array = $SpotterLive->getLiveSpotterDatabyCoord($coord, $filter);
62 62
 
63 63
 #} elseif (isset($globalMapPopup) && !$globalMapPopup) {
64 64
 } elseif (isset($_GET['archive']) && isset($_GET['begindate']) && isset($_GET['enddate']) && isset($_GET['speed'])) {
65 65
 	$from_archive = true;
66 66
 //	$begindate = filter_input(INPUT_GET,'begindate',FILTER_VALIDATE_REGEXP,array("options"=>array("regexp"=>'~^\d{4}/\d{2}/\d{2}$~')));
67 67
 //	$enddate = filter_input(INPUT_GET,'enddate',FILTER_VALIDATE_REGEXP,array("options"=>array("regexp"=>'~^\d{4}/\d{2}/\d{2}$~')));
68
-	$begindate = filter_input(INPUT_GET,'begindate',FILTER_SANITIZE_NUMBER_INT);
69
-	$enddate = filter_input(INPUT_GET,'enddate',FILTER_SANITIZE_NUMBER_INT);
70
-	$archivespeed = filter_input(INPUT_GET,'speed',FILTER_SANITIZE_NUMBER_INT);
71
-	$begindate = date('Y-m-d H:i:s',$begindate);
72
-	$enddate = date('Y-m-d H:i:s',$enddate);
73
-	$spotter_array = $SpotterArchive->getMinLiveSpotterData($begindate,$enddate,$filter);
68
+	$begindate = filter_input(INPUT_GET, 'begindate', FILTER_SANITIZE_NUMBER_INT);
69
+	$enddate = filter_input(INPUT_GET, 'enddate', FILTER_SANITIZE_NUMBER_INT);
70
+	$archivespeed = filter_input(INPUT_GET, 'speed', FILTER_SANITIZE_NUMBER_INT);
71
+	$begindate = date('Y-m-d H:i:s', $begindate);
72
+	$enddate = date('Y-m-d H:i:s', $enddate);
73
+	$spotter_array = $SpotterArchive->getMinLiveSpotterData($begindate, $enddate, $filter);
74 74
 } elseif ($min) {
75 75
 	$spotter_array = $SpotterLive->getMinLiveSpotterData($filter);
76 76
 #	$min = true;
77 77
 } else {
78
-	$spotter_array = $SpotterLive->getLiveSpotterData('','',$filter);
78
+	$spotter_array = $SpotterLive->getLiveSpotterData('', '', $filter);
79 79
 }
80 80
 
81 81
 if (!empty($spotter_array)) {
82 82
 	if (isset($_GET['archive'])) {
83
-		$flightcnt = $SpotterArchive->getLiveSpotterCount($begindate,$enddate,$filter);
83
+		$flightcnt = $SpotterArchive->getLiveSpotterCount($begindate, $enddate, $filter);
84 84
 	} else {
85 85
 		$flightcnt = $SpotterLive->getLiveSpotterCount($filter);
86 86
 	}
87 87
 	if ($flightcnt == '') $flightcnt = 0;
88 88
 } else $flightcnt = 0;
89 89
 
90
-$sqltime = round(microtime(true)-$begintime,2);
90
+$sqltime = round(microtime(true) - $begintime, 2);
91 91
 
92 92
 $j = 0;
93 93
 $prev_flightaware_id = '';
@@ -102,7 +102,7 @@  discard block
 block discarded – undo
102 102
 		if (!empty($spotter_array) && is_array($spotter_array))
103 103
 		{
104 104
 			$output .= '"features": [';
105
-			foreach($spotter_array as $spotter_item)
105
+			foreach ($spotter_array as $spotter_item)
106 106
 			{
107 107
 				$j++;
108 108
 				date_default_timezone_set('UTC');
@@ -153,7 +153,7 @@  discard block
 block discarded – undo
153 153
 						if (isset($spotter_item['registration'])) $output .= '"registration": "'.$spotter_item['registration'].'",';
154 154
 						if (isset($spotter_item['aircraft_name']) && isset($spotter_item['aircraft_type'])) {
155 155
 							$output .= '"aircraft_name": "'.$spotter_item['aircraft_name'].' ('.$spotter_item['aircraft_type'].')",';
156
-							$output .= '"aircraft_wiki": "http://'.strtolower($globalLanguage).'.wikipedia.org/wiki/'.urlencode(str_replace(' ','_',$spotter_item['aircraft_name'])).'",';
156
+							$output .= '"aircraft_wiki": "http://'.strtolower($globalLanguage).'.wikipedia.org/wiki/'.urlencode(str_replace(' ', '_', $spotter_item['aircraft_name'])).'",';
157 157
 						} elseif (isset($spotter_item['aircraft_type'])) {
158 158
 							$output .= '"aircraft_name": "NA ('.$spotter_item['aircraft_type'].')",';
159 159
 						} elseif (!$min) {
@@ -221,8 +221,8 @@  discard block
 block discarded – undo
221 221
 						if ($compress)$output .= '"h": "'.$spotter_item['heading'].'",';
222 222
 						else $output .= '"heading": "'.$spotter_item['heading'].'",';
223 223
 						
224
-						if (isset($archivespeed)) $nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$spotter_item['heading'],$archivespeed);
225
-						else $nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$spotter_item['heading']);
224
+						if (isset($archivespeed)) $nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $spotter_item['heading'], $archivespeed);
225
+						else $nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $spotter_item['heading']);
226 226
 						//$output .= '"nextlatitude": "'.$nextcoord['latitude'].'",';
227 227
 						//$output .= '"nextlongitude": "'.$nextcoord['longitude'].'",';
228 228
 						$output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],';
@@ -230,7 +230,7 @@  discard block
 block discarded – undo
230 230
 
231 231
 						if (!$min) $output .= '"image": "'.$image.'",';
232 232
 						if (isset($spotter_item['image_copyright']) && $spotter_item['image_copyright'] != '') {
233
-							$output .= '"image_copyright": "'.str_replace('"',"'",trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'',$spotter_item['image_copyright']))).'",';
233
+							$output .= '"image_copyright": "'.str_replace('"', "'", trim(str_replace(array("\r\n", "\r", "\n", "\\r", "\\n", "\\r\\n"), '', $spotter_item['image_copyright']))).'",';
234 234
 						}
235 235
 						if (isset($spotter_item['image_source_website'])) {
236 236
 							$output .= '"image_source_website": "'.urlencode($spotter_item['image_source_website']).'",';
@@ -252,7 +252,7 @@  discard block
 block discarded – undo
252 252
 							$output .= '"waypoints": "'.$spotter_item['waypoints'].'",';
253 253
 						}
254 254
 						if (isset($spotter_item['acars'])) {
255
-							$output .= '"acars": "'.trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"), '<br />',$spotter_item['acars']['message'])).'",';
255
+							$output .= '"acars": "'.trim(str_replace(array("\r\n", "\r", "\n", "\\r", "\\n", "\\r\\n"), '<br />', $spotter_item['acars']['message'])).'",';
256 256
 						}
257 257
 						// type when not aircraft ?
258 258
 						if ($compress) $output .= '"t": "aircraft"';
@@ -324,7 +324,7 @@  discard block
 block discarded – undo
324 324
 */
325 325
 				//if ((isset($_COOKIE['flightpath']) && $_COOKIE['flightpath'] == 'true') || (!isset($_COOKIE['flightpath']) && (!isset($globalMapHistory) || $globalMapHistory || $allhistory) || (isset($_GET['history']) && $_GET['history'] != '' && $_GET['history'] != 'NA' && ($_GET['history'] == $spotter_item['ident'] || $_GET['history'] == $spotter_item['flightaware_id'])))) {
326 326
 				//if ((isset($_COOKIE['flightpath']) && $_COOKIE['flightpath'] == 'true') || (!isset($_COOKIE['flightpath']) && (!isset($globalMapHistory) || $globalMapHistory || $allhistory) || (isset($_GET['history']) && $_GET['history'] != '' && $_GET['history'] != 'NA' && ($_GET['history'] == $spotter_item['ident'] || $_GET['history'] == $spotter_item['flightaware_id']))) || (isset($_GET['history']) && $_GET['history'] == '' && isset($_GET['flightaware_id']) && $_GET['flightaware_id'] == $spotter_item['flightaware_id'])) {
327
-				$history = filter_input(INPUT_GET,'history',FILTER_SANITIZE_STRING);
327
+				$history = filter_input(INPUT_GET, 'history', FILTER_SANITIZE_STRING);
328 328
 				if ($history == '' && isset($_COOKIE['history'])) $history = $_COOKIE['history'];
329 329
 				if ((isset($_COOKIE['flightpath']) && $_COOKIE['flightpath'] == 'true') || (!isset($_COOKIE['flightpath']) && (!isset($globalMapHistory) || $globalMapHistory || $allhistory) 
330 330
 				|| (isset($history) && $history != '' && $history != 'NA' && ($history == $spotter_item['ident'] || $history == $spotter_item['flightaware_id']))) 
@@ -354,9 +354,9 @@  discard block
 block discarded – undo
354 354
 					    else $output_history = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "history","altitude": "'.$alt.'"},"geometry": {"type": "LineString","coordinates": [';
355 355
 					}
356 356
 					$output_history .= '[';
357
-					$output_history .=  $spotter_history['longitude'].', ';
358
-					$output_history .=  $spotter_history['latitude'].', ';
359
-					$output_history .=  $spotter_history['altitude']*30.48;
357
+					$output_history .= $spotter_history['longitude'].', ';
358
+					$output_history .= $spotter_history['latitude'].', ';
359
+					$output_history .= $spotter_history['altitude']*30.48;
360 360
 					$output_history .= '],';
361 361
 					$prev_alt = $alt;
362 362
 				    //}
@@ -400,7 +400,7 @@  discard block
 block discarded – undo
400 400
 			//$output .= ']}}';
401 401
 			$output .= ']';
402 402
 			$output .= ',"initial_sqltime": "'.$sqltime.'",';
403
-			$output .= '"totaltime": "'.round(microtime(true)-$begintime,2).'",';
403
+			$output .= '"totaltime": "'.round(microtime(true) - $begintime, 2).'",';
404 404
 			if (isset($begindate)) $output .= '"archive_date": "'.$begindate.'",';
405 405
 			$output .= '"fc": "'.$j.'"';
406 406
 		} else {
Please login to merge, or discard this patch.
header.php 1 patch
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -8,31 +8,31 @@  discard block
 block discarded – undo
8 8
 if (isset($_COOKIE['MapType']) && $_COOKIE['MapType'] != '') $MapType = $_COOKIE['MapType'];
9 9
 else $MapType = $globalMapProvider;
10 10
 if (isset($_GET['3d'])) {
11
-	setcookie('MapFormat','3d');
11
+	setcookie('MapFormat', '3d');
12 12
 } else if (isset($_GET['2d'])) {
13
-	setcookie('MapFormat','2d');
13
+	setcookie('MapFormat', '2d');
14 14
 }
15 15
 
16 16
 if (isset($_POST['archive'])) {
17
-	setcookie('archive','true');
18
-	setcookie('archive_begin',strtotime($_POST['start_date']));
19
-	setcookie('archive_end',strtotime($_POST['end_date']));
20
-	setcookie('archive_speed',$_POST['archivespeed']);
17
+	setcookie('archive', 'true');
18
+	setcookie('archive_begin', strtotime($_POST['start_date']));
19
+	setcookie('archive_end', strtotime($_POST['end_date']));
20
+	setcookie('archive_speed', $_POST['archivespeed']);
21 21
 }
22 22
 if (isset($_POST['noarchive'])) {
23
-	setcookie('archive','false',-1);
24
-	setcookie('archive_begin','',-1);
25
-	setcookie('archive_end','',-1);
26
-	setcookie('archive_speed','',-1);
23
+	setcookie('archive', 'false', -1);
24
+	setcookie('archive_begin', '', -1);
25
+	setcookie('archive_end', '', -1);
26
+	setcookie('archive_speed', '', -1);
27 27
 }
28 28
 // When button "Remove all filters" is clicked
29 29
 if (isset($_POST['removefilters'])) {
30
-	$allfilters = array_filter(array_keys($_COOKIE),function($key) {
31
-	    return strpos($key,'filter_') === 0;
30
+	$allfilters = array_filter(array_keys($_COOKIE), function($key) {
31
+	    return strpos($key, 'filter_') === 0;
32 32
 	});
33 33
 	foreach ($allfilters as $filt) {
34 34
 		unset($_COOKIE[$filt]);
35
-		setcookie($filt,null,-1);
35
+		setcookie($filt, null, -1);
36 36
 	}
37 37
 }
38 38
 
@@ -216,7 +216,7 @@  discard block
 block discarded – undo
216 216
 <script src="<?php print $globalURL; ?>/js/Marker.Rotate.js"></script>
217 217
 <script src="<?php print $globalURL; ?>/js/MovingMarker.js"></script>
218 218
 <script src="<?php print $globalURL; ?>/js/jquery.idle.min.js"></script>
219
-<script src="<?php print $globalURL; ?>/js/map.js.php?ident=<?php print $ident; ?><?php if(isset($latitude)) print '&latitude='.$latitude; ?><?php if(isset($longitude)) print '&longitude='.$longitude; ?>&<?php print time(); ?>"></script>
219
+<script src="<?php print $globalURL; ?>/js/map.js.php?ident=<?php print $ident; ?><?php if (isset($latitude)) print '&latitude='.$latitude; ?><?php if (isset($longitude)) print '&longitude='.$longitude; ?>&<?php print time(); ?>"></script>
220 220
 <?php
221 221
 		if (isset($globalGoogleAPIKey) && $globalGoogleAPIKey != '' && ($MapType == 'Google-Roadmap' || $MapType == 'Google-Satellite' || $MapType == 'Google-Hybrid' || $MapType == 'Google-Terrain')) {
222 222
 ?>
@@ -270,7 +270,7 @@  discard block
 block discarded – undo
270 270
 <script src="<?php print $globalURL; ?>/js/Marker.Rotate.js"></script>
271 271
 <script src="<?php print $globalURL; ?>/js/MovingMarker.js"></script>
272 272
 <script src="<?php print $globalURL; ?>/js/jquery.idle.min.js"></script>
273
-<script src="<?php print $globalURL; ?>/js/map.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>
273
+<script src="<?php print $globalURL; ?>/js/map.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>
274 274
 <?php
275 275
 		if (isset($globalGoogleAPIKey) && $globalGoogleAPIKey != '' && ($MapType == 'Google-Roadmap' || $MapType == 'Google-Satellite' || $MapType == 'Google-Hybrid' || $MapType == 'Google-Terrain')) {
276 276
 ?>
@@ -433,7 +433,7 @@  discard block
 block discarded – undo
433 433
 ?>
434 434
       <div class="search">
435 435
       <form action="<?php print $globalURL; ?>/search" method="get">
436
-		<input type="text" name="q" value="<?php if (isset($GET['q'])) { if ($_GET['q'] != ""){ print $_GET['q']; } else { print _("Search"); } } else { print _("Search"); } ?>" onfocus="if (this.value=='search'){this.value='';}" /><button type="submit"><i class="fa fa-search"></i></button>
436
+		<input type="text" name="q" value="<?php if (isset($GET['q'])) { if ($_GET['q'] != "") { print $_GET['q']; } else { print _("Search"); } } else { print _("Search"); } ?>" onfocus="if (this.value=='search'){this.value='';}" /><button type="submit"><i class="fa fa-search"></i></button>
437 437
 	</form>
438 438
 	</div>
439 439
   	<div class="social">
@@ -451,14 +451,14 @@  discard block
 block discarded – undo
451 451
 	print '</div>';
452 452
 }
453 453
 
454
-if (strtolower($current_page) =='ident-detailed' || strtolower($current_page) == 'flightid-overview') {
454
+if (strtolower($current_page) == 'ident-detailed' || strtolower($current_page) == 'flightid-overview') {
455 455
 ?>
456 456
     <div class="top-header clear" role="main">
457 457
     <div id="archive-map"></div>
458 458
     </div>
459 459
 <?php
460 460
 }
461
-if ((strpos(strtolower($current_page),'airport-') !== false && strpos(strtolower($current_page),'statistics-') === false) || (strpos(strtolower($current_page),'route-') !== false && strpos(strtolower($current_page),'statistics-') === false))
461
+if ((strpos(strtolower($current_page), 'airport-') !== false && strpos(strtolower($current_page), 'statistics-') === false) || (strpos(strtolower($current_page), 'route-') !== false && strpos(strtolower($current_page), 'statistics-') === false))
462 462
 {
463 463
     ?>
464 464
     <div class="top-header clear" role="main">
@@ -471,15 +471,15 @@  discard block
 block discarded – undo
471 471
         var zoom = 13;
472 472
 //create the map
473 473
 <?php
474
-    if (strpos(strtolower($current_page),'airport-') !== false && strpos(strtolower($current_page),'statistics-') === false && isset($airport_array[0]['latitude'])) {
474
+    if (strpos(strtolower($current_page), 'airport-') !== false && strpos(strtolower($current_page), 'statistics-') === false && isset($airport_array[0]['latitude'])) {
475 475
 ?>
476 476
   map = L.map('map', { zoomControl:true }).setView([<?php print $airport_array[0]['latitude']; ?>,<?php print $airport_array[0]['longitude']; ?>], zoom);
477 477
 <?php
478
-    } elseif (strpos(strtolower($current_page),'airport-') !== false && strpos(strtolower($current_page),'statistics-') === false) {
478
+    } elseif (strpos(strtolower($current_page), 'airport-') !== false && strpos(strtolower($current_page), 'statistics-') === false) {
479 479
 ?>
480 480
   map = L.map('map', { zoomControl:true });
481 481
 <?php
482
-    } elseif (strpos(strtolower($current_page),'route-') !== false && strpos(strtolower($current_page),'statistics-') === false && isset($spotter_array[0]['departure_airport_latitude'])) {
482
+    } elseif (strpos(strtolower($current_page), 'route-') !== false && strpos(strtolower($current_page), 'statistics-') === false && isset($spotter_array[0]['departure_airport_latitude'])) {
483 483
 ?>
484 484
   map = L.map('map', { zoomControl:true }).setView([<?php print $spotter_array[0]['departure_airport_latitude']; ?>,<?php print $spotter_array[0]['arrival_airport_longitude']; ?>]);
485 485
     var line = L.polyline([[<?php print $spotter_array[0]['departure_airport_latitude']; ?>, <?php print $spotter_array[0]['departure_airport_longitude']; ?>],[<?php print $spotter_array[0]['arrival_airport_latitude']; ?>, <?php print $spotter_array[0]['arrival_airport_longitude']; ?>]]).addTo(map);
@@ -487,7 +487,7 @@  discard block
 block discarded – undo
487 487
     var departure_airport = L.marker([<?php print $spotter_array[0]['departure_airport_latitude']; ?>, <?php print $spotter_array[0]['departure_airport_longitude']; ?>], {icon: L.icon({iconUrl: '<?php print $globalURL; ?>/images/departure_airport.png',iconSize: [16,18],iconAnchor: [8,16]})}).addTo(map);
488 488
     var arrival_airport = L.marker([<?php print $spotter_array[0]['arrival_airport_latitude']; ?>, <?php print $spotter_array[0]['arrival_airport_longitude']; ?>], {icon: L.icon({iconUrl: '<?php print $globalURL; ?>/images/arrival_airport.png',iconSize: [16,18],iconAnchor: [8,16]})}).addTo(map);
489 489
 <?php
490
-    } elseif (strpos(strtolower($current_page),'route-') !== false && strpos(strtolower($current_page),'statistics-') === false && !isset($spotter_array[0]['departure_airport_latitude'])) {
490
+    } elseif (strpos(strtolower($current_page), 'route-') !== false && strpos(strtolower($current_page), 'statistics-') === false && !isset($spotter_array[0]['departure_airport_latitude'])) {
491 491
 ?>
492 492
   map = L.map('map', { zoomControl:true }).setView([<?php print $spotter_array[0]['latitude']; ?>,<?php print $spotter_array[0]['longitude']; ?>]);
493 493
 <?php
Please login to merge, or discard this patch.
index.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -4,7 +4,7 @@  discard block
 block discarded – undo
4 4
 require_once('require/class.Language.php');
5 5
 require_once('require/class.Satellite.php');
6 6
 
7
-$trackident = filter_input(INPUT_GET,'trackid',FILTER_SANITIZE_STRING);
7
+$trackident = filter_input(INPUT_GET, 'trackid', FILTER_SANITIZE_STRING);
8 8
 if ($trackident != '') {
9 9
 	require_once('require/class.SpotterLive.php');
10 10
 	$SpotterLive = new SpotterLive();
@@ -14,7 +14,7 @@  discard block
 block discarded – undo
14 14
 		$spotterid = $Spotter->getSpotterIDBasedOnFlightAwareID($trackident);
15 15
 		header('Location: '.$globalURL.'/flightid/'.$spotterid);
16 16
 	} else {
17
-		setcookie('MapTrack',$resulttrackident[0]['flightaware_id']);
17
+		setcookie('MapTrack', $resulttrackident[0]['flightaware_id']);
18 18
 	}
19 19
 } else {
20 20
 	unset($_COOKIE['MapTrack']);
@@ -167,7 +167,7 @@  discard block
 block discarded – undo
167 167
 		        <div class="form-group">
168 168
 			    <label>From (UTC):</label>
169 169
 		            <div class='input-group date' id='datetimepicker1'>
170
-            			<input type='text' name="start_date" class="form-control" value="<?php if (isset($_POST['start_date'])) print $_POST['start_date']; elseif (isset($_COOKIE['archive_begin'])) print date("m/d/Y h:i a",$_COOKIE['archive_begin']); ?>" required />
170
+            			<input type='text' name="start_date" class="form-control" value="<?php if (isset($_POST['start_date'])) print $_POST['start_date']; elseif (isset($_COOKIE['archive_begin'])) print date("m/d/Y h:i a", $_COOKIE['archive_begin']); ?>" required />
171 171
 		                <span class="input-group-addon">
172 172
             			    <span class="glyphicon glyphicon-calendar"></span>
173 173
 		                </span>
@@ -176,7 +176,7 @@  discard block
 block discarded – undo
176 176
 		        <div class="form-group">
177 177
 			    <label>To (UTC):</label>
178 178
 		            <div class='input-group date' id='datetimepicker2'>
179
-		                <input type='text' name="end_date" class="form-control" value="<?php if (isset($_POST['end_date'])) print $_POST['end_date']; elseif (isset($_COOKIE['archive_end'])) print date("m/d/Y h:i a",$_COOKIE['archive_end']); ?>" />
179
+		                <input type='text' name="end_date" class="form-control" value="<?php if (isset($_POST['end_date'])) print $_POST['end_date']; elseif (isset($_COOKIE['archive_end'])) print date("m/d/Y h:i a", $_COOKIE['archive_end']); ?>" />
180 180
             			<span class="input-group-addon">
181 181
 		                    <span class="glyphicon glyphicon-calendar"></span>
182 182
             			</span>
@@ -301,8 +301,8 @@  discard block
 block discarded – undo
301 301
 		    <li><?php echo _("Type of Terrain:"); ?>
302 302
 			<select  class="selectpicker" onchange="terrainType(this);">
303 303
 			    <option value="stk"<?php if (!isset($_COOKIE['MapTerrain']) || $_COOKIE['MapTerrain'] == 'stk') print ' selected'; ?>>stk terrain</option>
304
-			    <option value="ellipsoid"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'ellipsoid') print ' selected';?>>ellipsoid</option>
305
-			    <option value="vrterrain"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'vrterrain') print ' selected';?>>vr terrain</option>
304
+			    <option value="ellipsoid"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'ellipsoid') print ' selected'; ?>>ellipsoid</option>
305
+			    <option value="vrterrain"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'vrterrain') print ' selected'; ?>>vr terrain</option>
306 306
 			</select>
307 307
 		    </li>
308 308
 <?php
@@ -429,10 +429,10 @@  discard block
 block discarded – undo
429 429
 			<select class="selectpicker" multiple onchange="airlines(this);" id="display_airlines">
430 430
 			    <?php
431 431
 				$Spotter = new Spotter();
432
-				foreach($Spotter->getAllAirlineNames() as $airline) {
432
+				foreach ($Spotter->getAllAirlineNames() as $airline) {
433 433
 					$airline_name = $airline['airline_name'];
434
-					if (strlen($airline_name) > 30) $airline_name = substr($airline_name,0,30).'...';
435
-					if (isset($_COOKIE['Airlines']) && in_array($airline['airline_icao'],explode(',',$_COOKIE['Airlines']))) {
434
+					if (strlen($airline_name) > 30) $airline_name = substr($airline_name, 0, 30).'...';
435
+					if (isset($_COOKIE['Airlines']) && in_array($airline['airline_icao'], explode(',', $_COOKIE['Airlines']))) {
436 436
 						echo '<option value="'.$airline['airline_icao'].'" selected>'.$airline_name.'</option>';
437 437
 					} else {
438 438
 						echo '<option value="'.$airline['airline_icao'].'">'.$airline_name.'</option>';
@@ -448,8 +448,8 @@  discard block
 block discarded – undo
448 448
 			<select class="selectpicker" multiple onchange="sources(this);">
449 449
 			    <?php
450 450
 				$Spotter = new Spotter();
451
-				foreach($Spotter->getAllSourceName('aprs') as $source) {
452
-					if (isset($_COOKIE['Sources']) && in_array($source['source_name'],explode(',',$_COOKIE['Sources']))) {
451
+				foreach ($Spotter->getAllSourceName('aprs') as $source) {
452
+					if (isset($_COOKIE['Sources']) && in_array($source['source_name'], explode(',', $_COOKIE['Sources']))) {
453 453
 						echo '<option value="'.$source['source_name'].'" selected>'.$source['source_name'].'</option>';
454 454
 					} else {
455 455
 						echo '<option value="'.$source['source_name'].'">'.$source['source_name'].'</option>';
@@ -521,7 +521,7 @@  discard block
 block discarded – undo
521 521
 					else if ($type_name == 'radar') $type_name = 'Radar Calibration';
522 522
 					else if ($type_name == 'tle-new') $type_name = 'Last 30 days launches';
523 523
 					
524
-					if (isset($_COOKIE['sattypes']) && in_array($type['tle_type'],explode(',',$_COOKIE['sattypes']))) {
524
+					if (isset($_COOKIE['sattypes']) && in_array($type['tle_type'], explode(',', $_COOKIE['sattypes']))) {
525 525
 						print '<option value="'.$type['tle_type'].'" selected>'.$type_name.'</option>';
526 526
 					} else {
527 527
 						print '<option value="'.$type['tle_type'].'">'.$type_name.'</option>';
Please login to merge, or discard this patch.
require/class.METAR.php 1 patch
Spacing   +44 added lines, -44 removed lines patch added patch discarded remove patch
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
                         $Connection = new Connection();
55 55
                         $sth = $Connection->db->prepare($query);
56 56
                         $sth->execute();
57
-                } catch(PDOException $e) {
57
+                } catch (PDOException $e) {
58 58
                         return "error : ".$e->getMessage();
59 59
                 }
60 60
                 $row = $sth->fetch(PDO::FETCH_ASSOC);
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
                         $Connection = new Connection();
71 71
                         $sth = $Connection->db->prepare($query);
72 72
                         $sth->execute();
73
-                } catch(PDOException $e) {
73
+                } catch (PDOException $e) {
74 74
                         return "error : ".$e->getMessage();
75 75
                 }
76 76
         }
@@ -80,9 +80,9 @@  discard block
 block discarded – undo
80 80
         public function parse($data) {
81 81
     		//$data = str_replace(array('\n','\r','\r','\n'),'',$data);
82 82
     		$codes = implode('|', array_keys($this->texts));
83
-    		$regWeather = '#^(\+|\-|VC)?(' . $codes . ')(' . $codes . ')?$#';
83
+    		$regWeather = '#^(\+|\-|VC)?('.$codes.')('.$codes.')?$#';
84 84
     		//$pieces = explode(' ',$data);
85
-    		$pieces = preg_split('/\s/',$data);
85
+    		$pieces = preg_split('/\s/', $data);
86 86
     		$pos = 0;
87 87
     		if ($pieces[0] == 'METAR') $pos++;
88 88
     		elseif ($pieces[0] == 'SPECI') $pos++;
@@ -90,25 +90,25 @@  discard block
 block discarded – undo
90 90
     		$result = array();
91 91
     		$result['location'] = $pieces[$pos];
92 92
     		$pos++;
93
-    		$result['dayofmonth'] = substr($pieces[$pos],0,2);
94
-    		$result['time'] = substr($pieces[$pos],2,4);
93
+    		$result['dayofmonth'] = substr($pieces[$pos], 0, 2);
94
+    		$result['time'] = substr($pieces[$pos], 2, 4);
95 95
     		$c = count($pieces);
96
-    		for($pos++; $pos < $c; $pos++) {
96
+    		for ($pos++; $pos < $c; $pos++) {
97 97
     			$piece = $pieces[$pos];
98 98
     			if ($piece == 'RMK') break;
99 99
     			if ($piece == 'AUTO') $result['auto'] = true;
100 100
     			if ($piece == 'COR') $result['correction'] = true;
101 101
     			// Wind Speed
102 102
     			if (preg_match('#(VRB|\d\d\d)(\d\d)(?:G(\d\d))?(KT|MPS|KPH)(?: (\d{1,3})V(\d{1,3}))?$#', $piece, $matches)) {
103
-    				$result['wind']['direction'] = (float)$matches[1];
103
+    				$result['wind']['direction'] = (float) $matches[1];
104 104
 				$result['wind']['unit'] = $matches[4];
105
-    				if ($result['wind']['unit'] == 'KT') $result['wind']['speed'] = round(((float)$matches[2])*0.51444444444,2);
106
-    				elseif ($result['wind']['unit'] == 'KPH') $result['wind']['speed'] = round(((float)$matches[2])*1000,2);
107
-    				elseif ($result['wind']['unit'] == 'MPS') $result['wind']['speed'] = round(((float)$matches[2]),2);
108
-				$result['wind']['gust'] = (float)$matches[3];
105
+    				if ($result['wind']['unit'] == 'KT') $result['wind']['speed'] = round(((float) $matches[2])*0.51444444444, 2);
106
+    				elseif ($result['wind']['unit'] == 'KPH') $result['wind']['speed'] = round(((float) $matches[2])*1000, 2);
107
+    				elseif ($result['wind']['unit'] == 'MPS') $result['wind']['speed'] = round(((float) $matches[2]), 2);
108
+				$result['wind']['gust'] = (float) $matches[3];
109 109
 				$result['wind']['unit'] = $matches[4];
110
-				$result['wind']['min_variation'] = array_key_exists(5,$matches) ? $matches[5] : 0;
111
-				$result['wind']['max_variation'] = array_key_exists(6,$matches) ? $matches[6] : 0;
110
+				$result['wind']['min_variation'] = array_key_exists(5, $matches) ? $matches[5] : 0;
111
+				$result['wind']['max_variation'] = array_key_exists(6, $matches) ? $matches[6] : 0;
112 112
     			}
113 113
 
114 114
 /*    			if (preg_match('#^([0-9]{3})([0-9]{2})(G([0-9]{2}))?(KT|MPS)$#', $piece, $matches)) {
@@ -128,14 +128,14 @@  discard block
 block discarded – undo
128 128
     			*/
129 129
     			// Temperature
130 130
     			if (preg_match('#^(M?[0-9]{2,})/(M?[0-9]{2,})$#', $piece, $matches)) {
131
-    				$temp = (float)$matches[1];
131
+    				$temp = (float) $matches[1];
132 132
 				if ($matches[1]{0} == 'M') {
133
-					$temp = ((float)substr($matches[1], 1)) * -1;
133
+					$temp = ((float) substr($matches[1], 1))*-1;
134 134
 				}
135 135
     				$result['temperature'] = $temp;
136
-    				$dew = (float)$matches[2];
136
+    				$dew = (float) $matches[2];
137 137
 				if ($matches[2]{0} == 'M') {
138
-					$dew = ((float)substr($matches[2], 1)) * -1;
138
+					$dew = ((float) substr($matches[2], 1))*-1;
139 139
 				}
140 140
 				$result['dew'] = $dew;
141 141
     			}
@@ -147,7 +147,7 @@  discard block
 block discarded – undo
147 147
     					$result['QNH'] = $matches[2];
148 148
     				} else {
149 149
     					// inHg
150
-    					$result['QNH'] = round(($matches[2] / 100)*33.86389,2);
150
+    					$result['QNH'] = round(($matches[2]/100)*33.86389, 2);
151 151
 				}
152 152
     				/*
153 153
     				$result['QNH'] = $matches[1] == 'Q' ? $matches[2] : ($matches[2] / 100);
@@ -168,12 +168,12 @@  discard block
 block discarded – undo
168 168
     			// Visibility
169 169
     			if (preg_match('#^([0-9]{4})|(([0-9]{1,4})SM)$#', $piece, $matches)) {
170 170
     				if (isset($matches[3]) && strlen($matches[3]) > 0) {
171
-					$result['visibility'] = (float)$matches[3] * 1609.34;
171
+					$result['visibility'] = (float) $matches[3]*1609.34;
172 172
 				} else {
173 173
 					if ($matches[1] == '9999') {
174 174
 						$result['visibility'] = '> 10000';
175 175
 					} else {
176
-						$result['visibility'] = (float)$matches[1];
176
+						$result['visibility'] = (float) $matches[1];
177 177
 					}
178 178
 				}
179 179
 				if (preg_match('#^CAVOK$#', $piece, $matches)) {
@@ -195,7 +195,7 @@  discard block
 block discarded – undo
195 195
     				elseif ($type == 'OVC') $cloud['type'] = 'Overcast/Full cloud coverage';
196 196
     				elseif ($type == 'VV') $cloud['type'] = 'Vertical visibility';
197 197
     				$cloud['type_code'] = $type;
198
-    				$cloud['level'] = round(((float)$matches[2]) * 100 * 0.3048);
198
+    				$cloud['level'] = round(((float) $matches[2])*100*0.3048);
199 199
     				$cloud['significant'] = isset($matches[3]) ? $matches[3] : '';
200 200
     				$result['cloud'][] = $cloud;
201 201
     			}
@@ -205,8 +205,8 @@  discard block
 block discarded – undo
205 205
 				$rvr['runway'] = $matches[1];
206 206
 				$rvr['assessment'] = $matches[2];
207 207
 				$rvr['rvr'] = $matches[3];
208
-				$rvr['rvr_max'] = array_key_exists(4,$matches) ? $matches[4] : 0;
209
-				$rvr['unit'] = array_key_exists(5,$matches) ? $matches[5] : '';
208
+				$rvr['rvr_max'] = array_key_exists(4, $matches) ? $matches[4] : 0;
209
+				$rvr['unit'] = array_key_exists(5, $matches) ? $matches[5] : '';
210 210
 				$result['RVR'] = $rvr;
211 211
 			}
212 212
     			
@@ -223,12 +223,12 @@  discard block
 block discarded – undo
223 223
     			if (preg_match('#^(R[A-Z0-9]{2,3})/([0-9]{4})(V([0-9]{4}))?(FT)?$#', $piece, $matches)) {
224 224
     				//echo $piece;
225 225
     				//print_r($matches);
226
-    				if (isset($matches[5])) $range = array('exact' => (float)$matches[2], 'unit' => $matches[5] ? 'FT' : 'M');
227
-    				else $range = array('exact' => (float)$matches[2], 'unit' => 'M');
226
+    				if (isset($matches[5])) $range = array('exact' => (float) $matches[2], 'unit' => $matches[5] ? 'FT' : 'M');
227
+    				else $range = array('exact' => (float) $matches[2], 'unit' => 'M');
228 228
 				if (isset($matches[3])) {
229 229
 					$range = Array(
230
-					    'from' => (float)$matches[2],
231
-					    'to'   => (float)$matches[4],
230
+					    'from' => (float) $matches[2],
231
+					    'to'   => (float) $matches[4],
232 232
 					    'unit' => $matches[5] ? 'FT' : 'M'
233 233
 					);
234 234
 				}
@@ -277,7 +277,7 @@  discard block
 block discarded – undo
277 277
                  try {
278 278
                         $sth = $this->db->prepare($query);
279 279
                         $sth->execute($query_values);
280
-                } catch(PDOException $e) {
280
+                } catch (PDOException $e) {
281 281
                         return "error : ".$e->getMessage();
282 282
                 }
283 283
                 $all = $sth->fetchAll(PDO::FETCH_ASSOC);
@@ -287,19 +287,19 @@  discard block
 block discarded – undo
287 287
                 return $all;
288 288
         }
289 289
 
290
-       public function addMETAR($location,$metar,$date) {
290
+       public function addMETAR($location, $metar, $date) {
291 291
 		global $globalDBdriver;
292
-		$date = date('Y-m-d H:i:s',strtotime($date));
292
+		$date = date('Y-m-d H:i:s', strtotime($date));
293 293
 		if ($globalDBdriver == 'mysql') {
294 294
 			$query = "INSERT INTO metar (metar_location,metar_date,metar) VALUES (:location,:date,:metar) ON DUPLICATE KEY UPDATE metar_date = :date, metar = :metar";
295 295
 		} else {
296 296
 			$query = "UPDATE metar SET metar_date = :date, metar = metar WHERE metar_location = :location;INSERT INTO metar (metar_location,metar_date,metar) SELECT :location,:date,:metar WHERE NOT EXISTS (SELECT 1 FROM metar WHERE metar_location = :location);";
297 297
 		}
298
-                $query_values = array(':location' => $location,':date' => $date,':metar' => utf8_encode($metar));
298
+                $query_values = array(':location' => $location, ':date' => $date, ':metar' => utf8_encode($metar));
299 299
                  try {
300 300
                         $sth = $this->db->prepare($query);
301 301
                         $sth->execute($query_values);
302
-                } catch(PDOException $e) {
302
+                } catch (PDOException $e) {
303 303
                         return "error : ".$e->getMessage();
304 304
                 }
305 305
         }
@@ -310,7 +310,7 @@  discard block
 block discarded – undo
310 310
                  try {
311 311
                         $sth = $this->db->prepare($query);
312 312
                         $sth->execute($query_values);
313
-                } catch(PDOException $e) {
313
+                } catch (PDOException $e) {
314 314
                         return "error : ".$e->getMessage();
315 315
                 }
316 316
         }
@@ -319,7 +319,7 @@  discard block
 block discarded – undo
319 319
                  try {
320 320
                         $sth = $this->db->prepare($query);
321 321
                         $sth->execute();
322
-                } catch(PDOException $e) {
322
+                } catch (PDOException $e) {
323 323
                         return "error : ".$e->getMessage();
324 324
                 }
325 325
         }
@@ -336,8 +336,8 @@  discard block
 block discarded – undo
336 336
     		}
337 337
     		if (isset($globalDebug) && $globalDebug) echo "Done - Updating DB...";
338 338
     		$date = '';
339
-    		foreach(explode("\n",$cycle) as $line) {
340
-    			if (preg_match('#^([0-9]{4})/([0-9]{2})/([0-9]{2}) ([0-9]{2}):([0-9]{2})$#',$line)) {
339
+    		foreach (explode("\n", $cycle) as $line) {
340
+    			if (preg_match('#^([0-9]{4})/([0-9]{2})/([0-9]{2}) ([0-9]{2}):([0-9]{2})$#', $line)) {
341 341
     				//echo "date : ".$line."\n";
342 342
     				$date = $line;
343 343
     			} 
@@ -346,11 +346,11 @@  discard block
 block discarded – undo
346 346
     			    //echo $line;
347 347
     			    if ($date == '') $date = date('Y/m/d H:m');
348 348
     			    $pos = 0;
349
-    			    $pieces = preg_split('/\s/',$line);
349
+    			    $pieces = preg_split('/\s/', $line);
350 350
     			    if ($pieces[0] == 'METAR') $pos++;
351 351
     			    if (strlen($pieces[$pos]) != 4) $pos++;
352 352
 	        	    $location = $pieces[$pos];
353
-	        	    echo $this->addMETAR($location,$line,$date);
353
+	        	    echo $this->addMETAR($location, $line, $date);
354 354
     			}
355 355
     			//echo $line."\n";
356 356
     		}
@@ -362,11 +362,11 @@  discard block
 block discarded – undo
362 362
     		if ($globalMETARurl == '') return array();
363 363
     		date_default_timezone_set("UTC");
364 364
     		$Common = new Common();
365
-    		$url = str_replace('{icao}',$icao,$globalMETARurl);
365
+    		$url = str_replace('{icao}', $icao, $globalMETARurl);
366 366
     		$cycle = $Common->getData($url);
367 367
     		$date = '';
368
-    		foreach(explode("\n",$cycle) as $line) {
369
-    			if (preg_match('#^([0-9]{4})/([0-9]{2})/([0-9]{2}) ([0-9]{2}):([0-9]{2})$#',$line)) {
368
+    		foreach (explode("\n", $cycle) as $line) {
369
+    			if (preg_match('#^([0-9]{4})/([0-9]{2})/([0-9]{2}) ([0-9]{2}):([0-9]{2})$#', $line)) {
370 370
     				//echo "date : ".$line."\n";
371 371
     				$date = $line;
372 372
     			} 
@@ -375,12 +375,12 @@  discard block
 block discarded – undo
375 375
     			    //echo $line;
376 376
     			    if ($date == '') $date = date('Y/m/d H:m');
377 377
     			    $pos = 0;
378
-    			    $pieces = preg_split('/\s/',$line);
378
+    			    $pieces = preg_split('/\s/', $line);
379 379
     			    if ($pieces[0] == 'METAR') $pos++;
380 380
     			    if (strlen($pieces[$pos]) != 4) $pos++;
381 381
 	        	    $location = $pieces[$pos];
382 382
 	        	    if (strlen($location == 4)) {
383
-	        		$this->addMETAR($location,$line,$date);
383
+	        		$this->addMETAR($location, $line, $date);
384 384
 	        		return array('0' => array('metar_date' => $date, 'metar_location' => $location, 'metar' => $line));
385 385
 	        	    } else return array();
386 386
     			}
Please login to merge, or discard this patch.
statistics.php 1 patch
Spacing   +69 added lines, -69 removed lines patch added patch discarded remove patch
@@ -7,17 +7,17 @@  discard block
 block discarded – undo
7 7
 $title = _("Statistics");
8 8
 
9 9
 if (!isset($filter_name)) $filter_name = '';
10
-$airline_icao = (string)filter_input(INPUT_GET,'airline',FILTER_SANITIZE_STRING);
10
+$airline_icao = (string) filter_input(INPUT_GET, 'airline', FILTER_SANITIZE_STRING);
11 11
 if ($airline_icao == 'all') {
12 12
 	unset($_COOKIE['stats_airline_icao']);
13
-	setcookie('stats_airline_icao', '', time()-3600);
13
+	setcookie('stats_airline_icao', '', time() - 3600);
14 14
 	$airline_icao = '';
15 15
 } elseif ($airline_icao == '' && isset($_COOKIE['stats_airline_icao'])) {
16 16
 	$airline_icao = $_COOKIE['stats_airline_icao'];
17 17
 } elseif ($airline_icao == '' && isset($globalFilter)) {
18 18
 	if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0];
19 19
 }
20
-setcookie('stats_airline_icao',$airline_icao);
20
+setcookie('stats_airline_icao', $airline_icao);
21 21
 require_once('header.php');
22 22
 
23 23
 ?>
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
 		date_default_timezone_set('UTC');
38 38
 		$lastupdate = strtotime($last_update[0]['value']);
39 39
 		if (isset($globalTimezone) && $globalTimezone != '') date_default_timezone_set($globalTimezone);
40
-		print '<i>Last update: '.date('Y-m-d G:i:s',$lastupdate).'</i>';
40
+		print '<i>Last update: '.date('Y-m-d G:i:s', $lastupdate).'</i>';
41 41
 	}
42 42
     ?>
43 43
     </div>
@@ -46,30 +46,30 @@  discard block
 block discarded – undo
46 46
     ?>
47 47
     <?php include('statistics-sub-menu.php'); ?>
48 48
     <div class="row global-stats">
49
-        <div class="col-md-2"><span class="type"><?php echo _("Flights"); ?></span><span><?php print number_format($Stats->countOverallFlights($airline_icao,$filter_name)); ?></span></div> 
50
-	<!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
51
-        <div class="col-md-2"><span class="type"><?php echo _("Arrivals seen"); ?></span><span><?php print number_format($Stats->countOverallArrival($airline_icao,$filter_name)); ?></span></div> 
52
-        <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
49
+        <div class="col-md-2"><span class="type"><?php echo _("Flights"); ?></span><span><?php print number_format($Stats->countOverallFlights($airline_icao, $filter_name)); ?></span></div> 
50
+	<!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
51
+        <div class="col-md-2"><span class="type"><?php echo _("Arrivals seen"); ?></span><span><?php print number_format($Stats->countOverallArrival($airline_icao, $filter_name)); ?></span></div> 
52
+        <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
53 53
 	<?php
54 54
 	    if ((isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS)) {
55 55
 	?>
56
-    	    <div class="col-md-2"><span class="type"><?php echo _("Pilots"); ?></span><span><?php print number_format($Stats->countOverallPilots($airline_icao,$filter_name)); ?></span></div> 
57
-	    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
56
+    	    <div class="col-md-2"><span class="type"><?php echo _("Pilots"); ?></span><span><?php print number_format($Stats->countOverallPilots($airline_icao, $filter_name)); ?></span></div> 
57
+	    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
58 58
         <?php
59 59
     	    } else {
60 60
     	?>
61
-    	    <div class="col-md-2"><span class="type"><?php echo _("Owners"); ?></span><span><?php print number_format($Stats->countOverallOwners($airline_icao,$filter_name)); ?></span></div> 
62
-	    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
61
+    	    <div class="col-md-2"><span class="type"><?php echo _("Owners"); ?></span><span><?php print number_format($Stats->countOverallOwners($airline_icao, $filter_name)); ?></span></div> 
62
+	    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
63 63
     	<?php
64 64
     	    }
65 65
     	?>
66
-        <div class="col-md-2"><span class="type"><?php echo _("Aircrafts"); ?></span><span><?php print number_format($Stats->countOverallAircrafts($airline_icao,$filter_name)); ?></span></div> 
67
-        <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
66
+        <div class="col-md-2"><span class="type"><?php echo _("Aircrafts"); ?></span><span><?php print number_format($Stats->countOverallAircrafts($airline_icao, $filter_name)); ?></span></div> 
67
+        <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
68 68
         <?php
69 69
     		if ($airline_icao == '') {
70 70
     	?>
71 71
         <div class="col-md-2"><span class="type"><?php echo _("Airlines"); ?></span><span><?php print number_format($Stats->countOverallAirlines($filter_name)); ?></span></div>
72
-	<!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
72
+	<!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
73 73
 	<?php
74 74
 		}
75 75
 	?>
@@ -77,18 +77,18 @@  discard block
 block discarded – undo
77 77
 		if (!(isset($globalIVAO) && $globalIVAO) && !(isset($globalVATSIM) && $globalVATSIM) && !(isset($globalphpVMS) && $globalphpVMS)) {
78 78
 	?>
79 79
         <div class="col-md-2"><span class="type"><?php echo _("Military"); ?></span><span><?php print number_format($Stats->countOverallMilitaryFlights($filter_name)); ?></span></div> 
80
-	<!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
80
+	<!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
81 81
 	<?php
82 82
 		}
83 83
 	?>
84 84
     </div>
85
-    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
85
+    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
86 86
     <div class="specific-stats">
87 87
         <div class="row column">
88 88
             <div class="col-md-6">
89 89
                 <h2><?php echo _("Top 10 Most Common Aircraft Type"); ?></h2>
90 90
                  <?php
91
-                  $aircraft_array = $Stats->countAllAircraftTypes(true,$airline_icao,$filter_name);
91
+                  $aircraft_array = $Stats->countAllAircraftTypes(true, $airline_icao, $filter_name);
92 92
 		    if (count($aircraft_array) == 0) print _("No data available");
93 93
 		    else {
94 94
 
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
                         var data = google.visualization.arrayToDataTable([
101 101
                             ["'._("Aircraft").'", "'._("# of times").'"], ';
102 102
                             $aircraft_data = '';
103
-                          foreach($aircraft_array as $aircraft_item)
103
+                          foreach ($aircraft_array as $aircraft_item)
104 104
                                     {
105 105
                                             $aircraft_data .= '[ "'.$aircraft_item['aircraft_name'].' ('.$aircraft_item['aircraft_icao'].')",'.$aircraft_item['aircraft_icao_count'].'],';
106 106
                                     }
@@ -127,7 +127,7 @@  discard block
 block discarded – undo
127 127
                     <a href="<?php print $globalURL; ?>/statistics/aircraft" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
128 128
                 </div>
129 129
             </div>
130
-    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
130
+    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
131 131
 <?php
132 132
 //    echo $airline_icao;
133 133
     if ($airline_icao == '' || $airline_icao == 'all') {
@@ -135,7 +135,7 @@  discard block
 block discarded – undo
135 135
             <div class="col-md-6">
136 136
                 <h2><?php echo _("Top 10 Most Common Airline"); ?></h2>
137 137
                  <?php
138
-                  $airline_array = $Stats->countAllAirlines(true,$filter_name);
138
+                  $airline_array = $Stats->countAllAirlines(true, $filter_name);
139 139
 		    if (count($airline_array) == 0) print _("No data available");
140 140
 		    else {
141 141
 
@@ -147,7 +147,7 @@  discard block
 block discarded – undo
147 147
                         var data = google.visualization.arrayToDataTable([
148 148
                             ["'._("Airline").'", "'._("# of times").'"], ';
149 149
                             $airline_data = '';
150
-                          foreach($airline_array as $airline_item)
150
+                          foreach ($airline_array as $airline_item)
151 151
                                     {
152 152
                                             $airline_data .= '[ "'.$airline_item['airline_name'].' ('.$airline_item['airline_icao'].')",'.$airline_item['airline_count'].'],';
153 153
                                     }
@@ -175,14 +175,14 @@  discard block
 block discarded – undo
175 175
                 </div>
176 176
             </div>
177 177
         </div>
178
-    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
178
+    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
179 179
 <?php
180 180
     }
181 181
 ?>
182 182
         <div class="row column">
183 183
 
184 184
 	    <?php
185
-                 $flightover_array = $Stats->countAllFlightOverCountries($airline_icao,$filter_name);
185
+                 $flightover_array = $Stats->countAllFlightOverCountries($airline_icao, $filter_name);
186 186
 		if ((isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS)) {
187 187
 		    if (empty($flightover_array)) {
188 188
 	    ?>
@@ -196,7 +196,7 @@  discard block
 block discarded – undo
196 196
             ?>
197 197
                 <h2><?php echo _("Top 10 Most Common Pilots"); ?></h2>
198 198
                  <?php
199
-                  $pilot_array = $Stats->countAllPilots(true,$airline_icao,$filter_name);
199
+                  $pilot_array = $Stats->countAllPilots(true, $airline_icao, $filter_name);
200 200
 		    if (count($pilot_array) == 0) print _("No data available");
201 201
 		    else {
202 202
 
@@ -208,7 +208,7 @@  discard block
 block discarded – undo
208 208
                         var data = google.visualization.arrayToDataTable([
209 209
                             ["'._("Pilots").'", "'._("# of times").'"], ';
210 210
                             $pilot_data = '';
211
-                          foreach($pilot_array as $pilot_item)
211
+                          foreach ($pilot_array as $pilot_item)
212 212
                                     {
213 213
                                             $pilot_data .= '[ "'.$pilot_item['pilot_name'].' ('.$pilot_item['pilot_id'].')",'.$pilot_item['pilot_count'].'],';
214 214
                                     }
@@ -236,14 +236,14 @@  discard block
 block discarded – undo
236 236
                 </div>
237 237
             </div>
238 238
         
239
-    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
239
+    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
240 240
         <?php
241 241
     	    } else {
242 242
     	?>
243 243
             <div class="col-md-6">
244 244
                 <h2><?php echo _("Top 10 Most Common Owners"); ?></h2>
245 245
                  <?php
246
-                  $owner_array = $Stats->countAllOwners(true,$airline_icao,$filter_name);
246
+                  $owner_array = $Stats->countAllOwners(true, $airline_icao, $filter_name);
247 247
 		    if (count($owner_array) == 0) print _("No data available");
248 248
 		    else {
249 249
 
@@ -255,7 +255,7 @@  discard block
 block discarded – undo
255 255
                         var data = google.visualization.arrayToDataTable([
256 256
                             ["'._("Owner").'", "'._("# of times").'"], ';
257 257
                             $owner_data = '';
258
-                          foreach($owner_array as $owner_item)
258
+                          foreach ($owner_array as $owner_item)
259 259
                                     {
260 260
                                             $owner_data .= '[ "'.$owner_item['owner_name'].'",'.$owner_item['owner_count'].'],';
261 261
                                     }
@@ -283,7 +283,7 @@  discard block
 block discarded – undo
283 283
                 </div>
284 284
             </div>
285 285
         
286
-    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
286
+    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
287 287
         <?php
288 288
     	    }
289 289
     	    if (!empty($flightover_array)) {
@@ -304,7 +304,7 @@  discard block
 block discarded – undo
304 304
                         var data = google.visualization.arrayToDataTable([
305 305
                             ["'._("Country").'", "'._("# of times").'"], ';
306 306
                             $flightover_data = '';
307
-                          foreach($flightover_array as $flightover_item)
307
+                          foreach ($flightover_array as $flightover_item)
308 308
                                     {
309 309
                                             $flightover_data .= '[ "'.$flightover_item['flight_country'].' ('.$flightover_item['flight_country_iso2'].')",'.$flightover_item['flight_count'].'],';
310 310
                                     }
@@ -337,7 +337,7 @@  discard block
 block discarded – undo
337 337
             }
338 338
         ?>
339 339
         </div>
340
-    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
340
+    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
341 341
 
342 342
     	
343 343
         </div>
@@ -345,7 +345,7 @@  discard block
 block discarded – undo
345 345
             <div class="col-md-6">
346 346
                 <h2><?php echo _("Top 10 Most Common Departure Airports"); ?></h2>
347 347
                 <?php
348
-                $airport_airport_array = $Stats->countAllDepartureAirports(true,$airline_icao,$filter_name);
348
+                $airport_airport_array = $Stats->countAllDepartureAirports(true, $airline_icao, $filter_name);
349 349
 		    if (count($airport_airport_array) == 0) print _("No data available");
350 350
 		    else {
351 351
 
@@ -361,7 +361,7 @@  discard block
 block discarded – undo
361 361
                 var data = google.visualization.arrayToDataTable([ 
362 362
                     ["'._("Airport").'", "'._("# of times").'"],';
363 363
                     $airport_data = '';
364
-                  foreach($airport_airport_array as $airport_item)
364
+                  foreach ($airport_airport_array as $airport_item)
365 365
                         {
366 366
                             $name = $airport_item['airport_departure_city'].', '.$airport_item['airport_departure_country'].' ('.$airport_item['airport_departure_icao'].')';
367 367
                             $name = str_replace("'", "", $name);
@@ -390,12 +390,12 @@  discard block
 block discarded – undo
390 390
                 <a href="<?php print $globalURL; ?>/statistics/airport-departure" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
391 391
               </div>
392 392
             </div>
393
-    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
393
+    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
394 394
 
395 395
             <div class="col-md-6">
396 396
                 <h2><?php echo _("Top 10 Most Common Arrival Airports"); ?></h2>
397 397
                 <?php
398
-                $airport_airport_array2 = $Stats->countAllArrivalAirports(true,$airline_icao,$filter_name);
398
+                $airport_airport_array2 = $Stats->countAllArrivalAirports(true, $airline_icao, $filter_name);
399 399
 		    if (count($airport_airport_array2) == 0) print _("No data available");
400 400
 		    else {
401 401
 
@@ -411,7 +411,7 @@  discard block
 block discarded – undo
411 411
                 var data = google.visualization.arrayToDataTable([ 
412 412
                     ["'._("Airport").'", "'._("# of times").'"],';
413 413
                     $airport_data2 = '';
414
-                  foreach($airport_airport_array2 as $airport_item2)
414
+                  foreach ($airport_airport_array2 as $airport_item2)
415 415
                         {
416 416
                             $name2 = $airport_item2['airport_arrival_city'].', '.$airport_item2['airport_arrival_country'].' ('.$airport_item2['airport_arrival_icao'].')';
417 417
                             $name2 = str_replace("'", "", $name2);
@@ -441,13 +441,13 @@  discard block
 block discarded – undo
441 441
               </div>
442 442
             </div>
443 443
         </div>
444
-    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
444
+    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
445 445
 
446 446
         <div class="row column">
447 447
             <div class="col-md-6">
448 448
                 <h2><?php echo _("Busiest Months of the last 12 Months"); ?></h2>
449 449
                 <?php
450
-                  $year_array = $Stats->countAllMonthsLastYear(true,$airline_icao,$filter_name);
450
+                  $year_array = $Stats->countAllMonthsLastYear(true, $airline_icao, $filter_name);
451 451
 		    if (count($year_array) == 0) print _("No data available");
452 452
 		    else {
453 453
                   print '<div id="chart8" class="chart" width="100%"></div>
@@ -458,9 +458,9 @@  discard block
 block discarded – undo
458 458
                         var data = google.visualization.arrayToDataTable([
459 459
                             ["'._("Month").'", "'._("# of Flights").'"], ';
460 460
                             $year_data = '';
461
-                          foreach($year_array as $year_item)
461
+                          foreach ($year_array as $year_item)
462 462
                                     {
463
-                                        $year_data .= '[ "'.date('F, Y',strtotime($year_item['year_name'].'-'.$year_item['month_name'].'-01')).'",'.$year_item['date_count'].'],';
463
+                                        $year_data .= '[ "'.date('F, Y', strtotime($year_item['year_name'].'-'.$year_item['month_name'].'-01')).'",'.$year_item['date_count'].'],';
464 464
                                     }
465 465
                                     $year_data = substr($year_data, 0, -1);
466 466
                                     print $year_data;
@@ -488,12 +488,12 @@  discard block
 block discarded – undo
488 488
                     <a href="<?php print $globalURL; ?>/statistics/year" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
489 489
                 </div>
490 490
             </div>
491
-    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
491
+    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
492 492
 
493 493
             <div class="col-md-6">
494 494
                 <h2><?php echo _("Busiest Day in the last Month"); ?></h2>
495 495
                 <?php
496
-                  $month_array = $Stats->countAllDatesLastMonth($airline_icao,$filter_name);
496
+                  $month_array = $Stats->countAllDatesLastMonth($airline_icao, $filter_name);
497 497
 		    if (count($month_array) == 0) print _("No data available");
498 498
 		    else {
499 499
                   print '<div id="chart9" class="chart" width="100%"></div>
@@ -504,9 +504,9 @@  discard block
 block discarded – undo
504 504
                         var data = google.visualization.arrayToDataTable([
505 505
                             ["'._("Day").'", "'._("# of Flights").'"], ';
506 506
                             $month_data = '';
507
-                          foreach($month_array as $month_item)
507
+                          foreach ($month_array as $month_item)
508 508
                                     {
509
-                                        $month_data .= '[ "'.date('F j, Y',strtotime($month_item['date_name'])).'",'.$month_item['date_count'].'],';
509
+                                        $month_data .= '[ "'.date('F j, Y', strtotime($month_item['date_name'])).'",'.$month_item['date_count'].'],';
510 510
                                     }
511 511
                                     $month_data = substr($month_data, 0, -1);
512 512
                                     print $month_data;
@@ -534,12 +534,12 @@  discard block
 block discarded – undo
534 534
                     <a href="<?php print $globalURL; ?>/statistics/month" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
535 535
                 </div>
536 536
             </div>
537
-    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
537
+    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
538 538
 
539 539
             <div class="col-md-6">
540 540
                 <h2><?php echo _("Busiest Day in the last 7 Days"); ?></h2>
541 541
                 <?php
542
-                    $date_array = $Stats->countAllDatesLast7Days($airline_icao,$filter_name);
542
+                    $date_array = $Stats->countAllDatesLast7Days($airline_icao, $filter_name);
543 543
 		    if (empty($date_array)) print _("No data available");
544 544
 		    else {
545 545
                   print '<div id="chart5" class="chart" width="100%"></div>
@@ -551,7 +551,7 @@  discard block
 block discarded – undo
551 551
                             ["'._("Date").'", "'._("# of Flights").'"], ';
552 552
                             $date_data = '';
553 553
                         
554
-                          foreach($date_array as $date_item)
554
+                          foreach ($date_array as $date_item)
555 555
                                     {
556 556
                                         $date_data .= '[ "'.date("F j, Y", strtotime($date_item['date_name'])).'",'.$date_item['date_count'].'],';
557 557
                                     }
@@ -581,12 +581,12 @@  discard block
 block discarded – undo
581 581
                     <a href="<?php print $globalURL; ?>/statistics/date" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
582 582
                 </div>
583 583
             </div>
584
-    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
584
+    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
585 585
 
586 586
             <div class="col-md-6">
587 587
                 <h2><?php echo _("Busiest Time of the Day"); ?></h2>
588 588
                 <?php
589
-                  $hour_array = $Stats->countAllHours('hour',true,$airline_icao,$filter_name);
589
+                  $hour_array = $Stats->countAllHours('hour', true, $airline_icao, $filter_name);
590 590
 		    if (empty($hour_array)) print _("No data available");
591 591
 		    else {
592 592
 
@@ -598,7 +598,7 @@  discard block
 block discarded – undo
598 598
                         var data = google.visualization.arrayToDataTable([
599 599
                             ["'._("Hour").'", "'._("# of Flights").'"], ';
600 600
                             $hour_data = '';
601
-                          foreach($hour_array as $hour_item)
601
+                          foreach ($hour_array as $hour_item)
602 602
                                     {
603 603
                                         $hour_data .= '[ "'.$hour_item['hour_name'].':00",'.$hour_item['hour_count'].'],';
604 604
                                     }
@@ -628,21 +628,21 @@  discard block
 block discarded – undo
628 628
                     <a href="<?php print $globalURL; ?>/statistics/time" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>&raquo;</a>
629 629
                 </div>
630 630
             </div>
631
-    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
631
+    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
632 632
         </div>
633 633
 <?php
634 634
     if ($airline_icao == '' && $filter_name == '') {
635 635
 ?>
636 636
         <div class="row column">
637 637
         	<?php
638
-        	    $polar = $Stats->getStatsSource(date('Y-m-d'),'polar');
638
+        	    $polar = $Stats->getStatsSource(date('Y-m-d'), 'polar');
639 639
         	    if (!empty($polar)) {
640 640
             		print '<h2>'._("Coverage pattern").'</h2>';
641 641
         		foreach ($polar as $eachpolar) {
642 642
         		    unset($polar_data);
643 643
 	        	    $Spotter = new Spotter();
644 644
         		    $data = json_decode($eachpolar['source_data']);
645
-        		    foreach($data as $value => $key) {
645
+        		    foreach ($data as $value => $key) {
646 646
         			$direction = $Spotter->parseDirection(($value*22.5));
647 647
         			$distance = $key;
648 648
         			$unit = 'km';
@@ -662,7 +662,7 @@  discard block
 block discarded – undo
662 662
         	?>
663 663
             <div class="col-md-6">
664 664
                 <h4><?php print $eachpolar['source_name']; ?></h4>
665
-        	<div id="polar-<?php print str_replace(' ','_',strtolower($eachpolar['source_name'])); ?>" class="chart" width="100%"></div>
665
+        	<div id="polar-<?php print str_replace(' ', '_', strtolower($eachpolar['source_name'])); ?>" class="chart" width="100%"></div>
666 666
         	<script>
667 667
         	    (function() {
668 668
         	    var margin = {top: 100, right: 100, bottom: 100, left: 100},
@@ -686,7 +686,7 @@  discard block
 block discarded – undo
686 686
 		      color: color,
687 687
 		      unit: '<?php echo $unit; ?>'
688 688
 		    };
689
-		    RadarChart("#polar-<?php print str_replace(' ','_',strtolower($eachpolar['source_name'])); ?>", data, radarChartOptions);
689
+		    RadarChart("#polar-<?php print str_replace(' ', '_', strtolower($eachpolar['source_name'])); ?>", data, radarChartOptions);
690 690
 		    })();
691 691
 		</script>
692 692
             </div>
@@ -698,19 +698,19 @@  discard block
 block discarded – undo
698 698
         <div class="row column">
699 699
             <div class="col-md-6">
700 700
         	<?php
701
-        	    $msg = $Stats->getStatsSource(date('Y-m-d'),'msg');
701
+        	    $msg = $Stats->getStatsSource(date('Y-m-d'), 'msg');
702 702
         	    if (!empty($msg)) {
703 703
             		print '<h2>'._("Messages received").'</h2>';
704 704
         		foreach ($msg as $eachmsg) {
705 705
         		    //$eachmsg = $msg[0];
706 706
         		    $data = $eachmsg['source_data'];
707
-        		    if ($data > 500) $max = (round(($data+100)/100))*100;
707
+        		    if ($data > 500) $max = (round(($data + 100)/100))*100;
708 708
         		    else $max = 500;
709 709
         	?>
710
-        	<div id="msg-<?php print str_replace(' ','_',strtolower($eachmsg['source_name'])); ?>" class="col-md-4"></div>
710
+        	<div id="msg-<?php print str_replace(' ', '_', strtolower($eachmsg['source_name'])); ?>" class="col-md-4"></div>
711 711
         	<script>
712 712
 		      var g = new JustGage({
713
-			    id: "msg-<?php print str_replace(' ','_',strtolower($eachmsg['source_name'])); ?>",
713
+			    id: "msg-<?php print str_replace(' ', '_', strtolower($eachmsg['source_name'])); ?>",
714 714
 			    value: <?php echo $data; ?>,
715 715
 			    min: 0,
716 716
 			    max: <?php print $max; ?>,
@@ -730,12 +730,12 @@  discard block
 block discarded – undo
730 730
         <div class="row column">
731 731
 
732 732
             <?php
733
-		$hist = $Stats->getStatsSource(date('Y-m-d'),'hist');
733
+		$hist = $Stats->getStatsSource(date('Y-m-d'), 'hist');
734 734
 		foreach ($hist as $hists) {
735 735
 			$hist_data = '';
736 736
 			$source = $hists['source_name'];
737 737
 			$hist_array = json_decode($hists['source_data']);
738
-			foreach($hist_array as $distance => $nb)
738
+			foreach ($hist_array as $distance => $nb)
739 739
 			{
740 740
 				$unit = 'km';
741 741
 				if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'nm') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'nm')) {
@@ -753,13 +753,13 @@  discard block
 block discarded – undo
753 753
 			$hist_data = substr($hist_data, 0, -1);
754 754
             ?>
755 755
             <div class="col-md-6">
756
-                <h2><?php echo sprintf(_("Flights Distance for %s"),$source); ?></h2>
756
+                <h2><?php echo sprintf(_("Flights Distance for %s"), $source); ?></h2>
757 757
                 <?php
758
-                  print '<div id="charthist-'.str_replace(' ','_',strtolower($source)).'" class="chart" width="100%"></div>
758
+                  print '<div id="charthist-'.str_replace(' ', '_', strtolower($source)).'" class="chart" width="100%"></div>
759 759
                     <script> 
760 760
                         google.load("visualization", "1", {packages:["corechart"]});
761
-                      google.setOnLoadCallback(drawCharthist_'.str_replace(' ','_',strtolower($source)).');
762
-                      function drawCharthist_'.str_replace(' ','_',strtolower($source)).'() {
761
+                      google.setOnLoadCallback(drawCharthist_'.str_replace(' ', '_', strtolower($source)).');
762
+                      function drawCharthist_'.str_replace(' ', '_', strtolower($source)).'() {
763 763
                         var data = google.visualization.arrayToDataTable([
764 764
                             ["'._("Distance").'", "'._("# of Flights").'"], ';
765 765
                             print $hist_data;
@@ -774,16 +774,16 @@  discard block
 block discarded – undo
774 774
                             colors: ["#1a3151"]
775 775
                         };
776 776
 
777
-                        var chart = new google.visualization.AreaChart(document.getElementById("charthist-'.str_replace(' ','_',strtolower($source)).'"));
777
+                        var chart = new google.visualization.AreaChart(document.getElementById("charthist-'.str_replace(' ', '_', strtolower($source)).'"));
778 778
                         chart.draw(data, options);
779 779
                       }
780 780
                       $(window).resize(function(){
781
-                              drawCharthist_'.str_replace(' ','_',strtolower($source)).'();
781
+                              drawCharthist_'.str_replace(' ', '_', strtolower($source)).'();
782 782
                             });
783 783
                   </script>';
784 784
         	?>
785 785
     	    </div>
786
-	    <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> -->
786
+	    <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> -->
787 787
         	<?php
788 788
                   }
789 789
                 ?>
Please login to merge, or discard this patch.
airport-statistics-route.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -7,14 +7,14 @@  discard block
 block discarded – undo
7 7
         header('Location: '.$globalURL.'/airport');
8 8
         die();
9 9
 }
10
-$airport = filter_input(INPUT_GET,'airport',FILTER_SANITIZE_STRING);
10
+$airport = filter_input(INPUT_GET, 'airport', FILTER_SANITIZE_STRING);
11 11
 $Spotter = new Spotter();
12
-$spotter_array = $Spotter->getSpotterDataByAirport($airport,"0,1","");
12
+$spotter_array = $Spotter->getSpotterDataByAirport($airport, "0,1", "");
13 13
 $airport_array = $Spotter->getAllAirportInfo($airport);
14 14
 
15 15
 if (!empty($airport_array))
16 16
 {
17
-	$title = sprintf(_("Most Common Routes to/from %s, %s (%s)"),$airport_array[0]['city'],$airport_array[0]['name'],$airport_array[0]['icao']);
17
+	$title = sprintf(_("Most Common Routes to/from %s, %s (%s)"), $airport_array[0]['city'], $airport_array[0]['name'], $airport_array[0]['icao']);
18 18
 
19 19
 	require_once('header.php');
20 20
 	print '<div class="select-item">';
@@ -25,9 +25,9 @@  discard block
 block discarded – undo
25 25
 	$airport_names = $Stats->getAllAirportNames();
26 26
 	if (empty($airport_names)) $airport_names = $Spotter->getAllAirportNames();
27 27
 	ksort($airport_names);
28
-	foreach($airport_names as $airport_name)
28
+	foreach ($airport_names as $airport_name)
29 29
 	{
30
-		if($airport == $airport_name['airport_icao'])
30
+		if ($airport == $airport_name['airport_icao'])
31 31
 		{
32 32
 			print '<option value="'.$airport_name['airport_icao'].'" selected="selected">'.$airport_name['airport_city'].', '.$airport_name['airport_name'].', '.$airport_name['airport_country'].' ('.$airport_name['airport_icao'].')</option>';
33 33
 		} else {
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
 	include('airport-sub-menu.php');
59 59
 	print '<div class="column">';
60 60
 	print '<h2>'._("Most Common Routes").'</h2>';
61
-	print '<p>'.sprintf(_("The statistic below shows the most common routes to/from <strong>%s, %s (%s)</strong>."),$airport_array[0]['city'],$airport_array[0]['name'],$airport_array[0]['icao']).'</p>';
61
+	print '<p>'.sprintf(_("The statistic below shows the most common routes to/from <strong>%s, %s (%s)</strong>."), $airport_array[0]['city'], $airport_array[0]['name'], $airport_array[0]['icao']).'</p>';
62 62
 
63 63
 	$route_array = $Spotter->countAllRoutesByAirport($airport);
64 64
 	if (!empty($route_array))
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
 		print '</thead>';
75 75
 		print '<tbody>';
76 76
 		$i = 1;
77
-		foreach($route_array as $route_item)
77
+		foreach ($route_array as $route_item)
78 78
 		{
79 79
 			print '<tr>';
80 80
 			print '<td><strong>'.$i.'</strong></td>';
Please login to merge, or discard this patch.
aircraft-statistics-departure-airport.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -7,14 +7,14 @@  discard block
 block discarded – undo
7 7
         header('Location: '.$globalURL.'/aircraft');
8 8
         die();
9 9
 }
10
-$aircraft_type = filter_input(INPUT_GET,'aircraft_type',FILTER_SANITIZE_STRING);
10
+$aircraft_type = filter_input(INPUT_GET, 'aircraft_type', FILTER_SANITIZE_STRING);
11 11
 $Spotter = new Spotter();
12
-$spotter_array = $Spotter->getSpotterDataByAircraft($aircraft_type,"0,1","");
12
+$spotter_array = $Spotter->getSpotterDataByAircraft($aircraft_type, "0,1", "");
13 13
 
14 14
 
15 15
 if (!empty($spotter_array))
16 16
 {
17
-	$title = sprintf(_("Most Common Departure Airports for %s (%s)"),$spotter_array[0]['aircraft_name'],$spotter_array[0]['aircraft_type']);
17
+	$title = sprintf(_("Most Common Departure Airports for %s (%s)"), $spotter_array[0]['aircraft_name'], $spotter_array[0]['aircraft_type']);
18 18
 	require_once('header.php');
19 19
 	print '<div class="select-item">';
20 20
 	print '<form action="'.$globalURL.'/aircraft" method="post">';
@@ -23,9 +23,9 @@  discard block
 block discarded – undo
23 23
 	$Stats = new Stats();
24 24
 	$aircraft_types = $Stats->getAllAircraftTypes();
25 25
 	if (empty($aircraft_types)) $aircraft_types = $Spotter->getAllAircraftTypes();
26
-	foreach($aircraft_types as $aircrafttype)
26
+	foreach ($aircraft_types as $aircrafttype)
27 27
 	{
28
-		if($aircraft_type == $aircrafttype['aircraft_icao'])
28
+		if ($aircraft_type == $aircrafttype['aircraft_icao'])
29 29
 		{
30 30
 			print '<option value="'.$aircrafttype['aircraft_icao'].'" selected="selected">'.$aircrafttype['aircraft_name'].' ('.$aircrafttype['aircraft_icao'].')</option>';
31 31
 		} else {
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
 	include('aircraft-sub-menu.php');
53 53
 	print '<div class="column">';
54 54
 	print '<h2>'._("Most Common Departure Airports").'</h2>';
55
-	print '<p>'.sprintf(_("The statistic below shows all departure airports of flights from <strong>%s (%s)</strong>."),$spotter_array[0]['aircraft_name'],$spotter_array[0]['aircraft_type']).'</p>';
55
+	print '<p>'.sprintf(_("The statistic below shows all departure airports of flights from <strong>%s (%s)</strong>."), $spotter_array[0]['aircraft_name'], $spotter_array[0]['aircraft_type']).'</p>';
56 56
 	$airport_airport_array = $Spotter->countAllDepartureAirportsByAircraft($aircraft_type);
57 57
     	print '
58 58
     	<script type="text/javascript" src="https://www.google.com/jsapi"></script>
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
         var data = google.visualization.arrayToDataTable([ 
68 68
         	["'._("Airport").'", "'._("# of times").'"],';
69 69
         $airport_data = '';
70
-	foreach($airport_airport_array as $airport_item)
70
+	foreach ($airport_airport_array as $airport_item)
71 71
 	{
72 72
 		$name = $airport_item['airport_departure_city'].', '.$airport_item['airport_departure_country'].' ('.$airport_item['airport_departure_icao'].')';
73 73
 		$name = str_replace("'", "", $name);
@@ -106,7 +106,7 @@  discard block
 block discarded – undo
106 106
 	print '</thead>';
107 107
 	print '<tbody>';
108 108
 	$i = 1;
109
-	foreach($airport_airport_array as $airport_item)
109
+	foreach ($airport_airport_array as $airport_item)
110 110
 	{
111 111
 		print '<tr>';
112 112
 		print '<td><strong>'.$i.'</strong></td>';
Please login to merge, or discard this patch.