Completed
Push — master ( 294034...cc589d )
by Yannick
08:28
created
header.php 1 patch
Braces   +52 added lines, -12 removed lines patch added patch discarded remove patch
@@ -5,8 +5,11 @@  discard block
 block discarded – undo
5 5
 $file_path = pathinfo($_SERVER['SCRIPT_NAME']);
6 6
 $current_page = $file_path['filename'];
7 7
 date_default_timezone_set($globalTimezone);
8
-if (isset($_COOKIE['MapType']) && $_COOKIE['MapType'] != '') $MapType = $_COOKIE['MapType'];
9
-else $MapType = $globalMapProvider;
8
+if (isset($_COOKIE['MapType']) && $_COOKIE['MapType'] != '') {
9
+	$MapType = $_COOKIE['MapType'];
10
+} else {
11
+	$MapType = $globalMapProvider;
12
+}
10 13
 if (isset($_GET['3d'])) {
11 14
 	setcookie('MapFormat','3d');
12 15
 } else if (isset($_GET['2d'])) {
@@ -240,7 +243,13 @@  discard block
 block discarded – undo
240 243
 <script src="<?php print $globalURL; ?>/js/MovingMarker.js"></script>
241 244
 <script src="<?php print $globalURL; ?>/js/jquery.idle.min.js"></script>
242 245
 <script src="<?php print $globalURL; ?>/js/map.common.js"></script>
243
-<script src="<?php print $globalURL; ?>/js/map.2d.js.php?ident=<?php print $ident; ?><?php if(isset($latitude)) print '&latitude='.$latitude; ?><?php if(isset($longitude)) print '&longitude='.$longitude; ?>&<?php print time(); ?>"></script>
246
+<script src="<?php print $globalURL; ?>/js/map.2d.js.php?ident=<?php print $ident; ?><?php if(isset($latitude)) {
247
+	print '&latitude='.$latitude;
248
+}
249
+?><?php if(isset($longitude)) {
250
+	print '&longitude='.$longitude;
251
+}
252
+?>&<?php print time(); ?>"></script>
244 253
 <?php
245 254
 		if (!isset($type) || $type == 'aircraft') {
246 255
 ?>
@@ -310,7 +319,13 @@  discard block
 block discarded – undo
310 319
 <script src="<?php print $globalURL; ?>/js/MovingMarker.js"></script>
311 320
 <script src="<?php print $globalURL; ?>/js/jquery.idle.min.js"></script>
312 321
 <script src="<?php print $globalURL; ?>/js/map.common.js"></script>
313
-<script src="<?php print $globalURL; ?>/js/map.2d.js.php?flightaware_id=<?php print $flightaware_id; ?><?php if(isset($latitude)) print '&latitude='.$latitude; ?><?php if(isset($longitude)) print '&longitude='.$longitude; ?>&<?php print time(); ?>"></script>
322
+<script src="<?php print $globalURL; ?>/js/map.2d.js.php?flightaware_id=<?php print $flightaware_id; ?><?php if(isset($latitude)) {
323
+	print '&latitude='.$latitude;
324
+}
325
+?><?php if(isset($longitude)) {
326
+	print '&longitude='.$longitude;
327
+}
328
+?>&<?php print time(); ?>"></script>
314 329
 <script src="<?php print $globalURL; ?>/js/map-aircraft.2d.js.php?flightaware_id=<?php print $flightaware_id; ?>&<?php print time(); ?>"></script>
315 330
 <?php
316 331
 		if (isset($globalGoogleAPIKey) && $globalGoogleAPIKey != '' && ($MapType == 'Google-Roadmap' || $MapType == 'Google-Satellite' || $MapType == 'Google-Hybrid' || $MapType == 'Google-Terrain')) {
@@ -384,7 +399,12 @@  discard block
 block discarded – undo
384 399
         <span class="icon-bar"></span>
385 400
       </button>
386 401
       <a href="<?php print $globalURL; ?>/search" class="navbar-toggle navbar-toggle-search"><i class="fa fa-search"></i></a>
387
-      <a class="navbar-brand" href="<?php if ($globalURL == '') print '/'; else print $globalURL; ?>"><img src="<?php print $globalURL.$logoURL; ?>" height="30px" /></a>
402
+      <a class="navbar-brand" href="<?php if ($globalURL == '') {
403
+	print '/';
404
+} else {
405
+	print $globalURL;
406
+}
407
+?>"><img src="<?php print $globalURL.$logoURL; ?>" height="30px" /></a>
388 408
     </div>
389 409
     <div class="collapse navbar-collapse">
390 410
 
@@ -410,7 +430,10 @@  discard block
 block discarded – undo
410 430
 <?php
411 431
     }
412 432
 ?>
413
-          <a href="#" class="dropdown-toggle" data-toggle="dropdown"><?php echo _("Explore"); ?> <b class="<?php if ($sub) echo 'right-'; ?>caret"></b></a>
433
+          <a href="#" class="dropdown-toggle" data-toggle="dropdown"><?php echo _("Explore"); ?> <b class="<?php if ($sub) {
434
+	echo 'right-';
435
+}
436
+?>caret"></b></a>
414 437
           <ul class="dropdown-menu">
415 438
           	<li><a href="<?php print $globalURL; ?>/aircraft"><?php echo _("Aircrafts Types"); ?></a></li>
416 439
 			<li><a href="<?php print $globalURL; ?>/airline"><?php echo _("Airlines"); ?></a></li>
@@ -467,8 +490,14 @@  discard block
 block discarded – undo
467 490
         </li>
468 491
       	<li><a href="<?php print $globalURL; ?>/search"><?php echo _("Search"); ?></a></li>
469 492
       	<li><a href="<?php print $globalURL; ?>/statistics"><?php echo _("Statistics"); ?></a></li>
470
-        <li class="dropdown<?php if ($sub) echo '-submenu'; ?>">
471
-          <a href="#" class="dropdown-toggle" data-toggle="dropdown"><?php echo _("Tools"); ?> <b class="<?php if ($sub) echo 'right-'; ?>caret"></b></a>
493
+        <li class="dropdown<?php if ($sub) {
494
+	echo '-submenu';
495
+}
496
+?>">
497
+          <a href="#" class="dropdown-toggle" data-toggle="dropdown"><?php echo _("Tools"); ?> <b class="<?php if ($sub) {
498
+	echo 'right-';
499
+}
500
+?>caret"></b></a>
472 501
           <ul class="dropdown-menu">
473 502
           	<li><a href="<?php print $globalURL; ?>/tools/acars"><?php echo _("ACARS translator"); ?></a></li>
474 503
           	<li><a href="<?php print $globalURL; ?>/tools/metar"><?php echo _("METAR translator"); ?></a></li>
@@ -497,7 +526,10 @@  discard block
 block discarded – undo
497 526
 <?php
498 527
 	}
499 528
 ?>
500
-		<a href="#" class="dropdown-toggle" data-toggle="dropdown"><?php echo _("Explore"); ?> <b class="<?php if ($sub) echo 'right-'; ?>caret"></b></a>
529
+		<a href="#" class="dropdown-toggle" data-toggle="dropdown"><?php echo _("Explore"); ?> <b class="<?php if ($sub) {
530
+	echo 'right-';
531
+}
532
+?>caret"></b></a>
501 533
 		<ul class="dropdown-menu">
502 534
 		    <li><a href="<?php print $globalURL; ?>/marine/currently"><?php echo _("Current Activity"); ?></a></li>
503 535
 		    <li><a href="<?php print $globalURL; ?>/marine/latest"><?php echo _("Latest Activity"); ?></a></li>
@@ -528,7 +560,10 @@  discard block
 block discarded – undo
528 560
 <?php
529 561
 	}
530 562
 ?>
531
-		<a href="#" class="dropdown-toggle" data-toggle="dropdown"><?php echo _("Explore"); ?> <b class="<?php if ($sub) echo 'right-'; ?>caret"></b></a>
563
+		<a href="#" class="dropdown-toggle" data-toggle="dropdown"><?php echo _("Explore"); ?> <b class="<?php if ($sub) {
564
+	echo 'right-';
565
+}
566
+?>caret"></b></a>
532 567
 		<ul class="dropdown-menu">
533 568
 		    <li><a href="<?php print $globalURL; ?>/tracker/currently"><?php echo _("Current Activity"); ?></a></li>
534 569
 		    <li><a href="<?php print $globalURL; ?>/tracker/latest"><?php echo _("Latest Activity"); ?></a></li>
@@ -577,7 +612,9 @@  discard block
 block discarded – undo
577 612
   		        $alllang = $Language->getLanguages();
578 613
   		        foreach ($alllang as $key => $lang) {
579 614
   		            print '<option value="'.$key.'"';
580
-  		            if (isset($_COOKIE['language']) && $_COOKIE['language'] == $key) print ' selected ';
615
+  		            if (isset($_COOKIE['language']) && $_COOKIE['language'] == $key) {
616
+  		            	print ' selected ';
617
+  		            }
581 618
   		            print '>'.$lang[0].'</option>';
582 619
   		        }
583 620
   		    ?>
@@ -730,4 +767,7 @@  discard block
 block discarded – undo
730 767
 
731 768
 ?>
732 769
 
733
-<section class="container main-content <?php if (strtolower($current_page) == 'index') print 'index '; ?>clear">
770
+<section class="container main-content <?php if (strtolower($current_page) == 'index') {
771
+	print 'index ';
772
+}
773
+?>clear">
Please login to merge, or discard this patch.
require/class.TrackerLive.php 1 patch
Braces   +74 added lines, -25 removed lines patch added patch discarded remove patch
@@ -29,7 +29,9 @@  discard block
 block discarded – undo
29 29
 		if (isset($filter[0]['source'])) {
30 30
 			$filters = array_merge($filters,$filter);
31 31
 		}
32
-		if (is_array($globalFilter)) $filter = array_merge($filter,$globalFilter);
32
+		if (is_array($globalFilter)) {
33
+			$filter = array_merge($filter,$globalFilter);
34
+		}
33 35
 		$filter_query_join = '';
34 36
 		$filter_query_where = '';
35 37
 		foreach($filters as $flt) {
@@ -76,8 +78,11 @@  discard block
 block discarded – undo
76 78
 		if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) {
77 79
 			$filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')";
78 80
 		}
79
-		if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE';
80
-		elseif ($filter_query_where != '' && $and) $filter_query_where .= ' AND';
81
+		if ($filter_query_where == '' && $where) {
82
+			$filter_query_where = ' WHERE';
83
+		} elseif ($filter_query_where != '' && $and) {
84
+			$filter_query_where .= ' AND';
85
+		}
81 86
 		if ($filter_query_where != '') {
82 87
 			$filter_query_where = preg_replace('/^ AND/',' WHERE',$filter_query_where);
83 88
 		}
@@ -119,7 +124,9 @@  discard block
 block discarded – undo
119 124
 			}
120 125
 		}
121 126
 
122
-		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
127
+		if (!isset($globalLiveInterval)) {
128
+			$globalLiveInterval = '200';
129
+		}
123 130
 		if ($globalDBdriver == 'mysql') {
124 131
 			//$query  = "SELECT tracker_live.* FROM tracker_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL 30 SECOND) <= l.date GROUP BY l.famtrackid) s on tracker_live.famtrackid = s.famtrackid AND tracker_live.date = s.maxdate";
125 132
 			$query  = 'SELECT tracker_live.* FROM tracker_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.famtrackid) s on tracker_live.famtrackid = s.famtrackid AND tracker_live.date = s.maxdate'.$filter_query.$orderby_query;
@@ -144,7 +151,9 @@  discard block
 block discarded – undo
144 151
 
145 152
 		$filter_query = $this->getFilter($filter,true,true);
146 153
 
147
-		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
154
+		if (!isset($globalLiveInterval)) {
155
+			$globalLiveInterval = '200';
156
+		}
148 157
 		if ($globalDBdriver == 'mysql') {
149 158
 			$query  = 'SELECT tracker_live.ident, tracker_live.type,tracker_live.famtrackid, tracker_live.latitude, tracker_live.longitude, tracker_live.altitude, tracker_live.heading, tracker_live.ground_speed, tracker_live.date, tracker_live.format_source 
150 159
 			FROM tracker_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.famtrackid) s on tracker_live.famtrackid = s.famtrackid AND tracker_live.date = s.maxdate'.$filter_query." tracker_live.latitude <> 0 AND tracker_live.longitude <> 0";
@@ -182,7 +191,9 @@  discard block
 block discarded – undo
182 191
 
183 192
 		$filter_query = $this->getFilter($filter,true,true);
184 193
 
185
-		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
194
+		if (!isset($globalLiveInterval)) {
195
+			$globalLiveInterval = '200';
196
+		}
186 197
 		if ($globalDBdriver == 'mysql') {
187 198
 			$query  = 'SELECT tracker_live.ident, tracker_live.famtrackid,tracker_live.type, tracker_live.latitude, tracker_live.longitude, tracker_live.altitude, tracker_live.heading, tracker_live.ground_speed, tracker_live.date, tracker_live.format_source 
188 199
 			FROM tracker_live'.$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval." SECOND) <= tracker_live.date AND tracker_live.latitude <> '0' AND tracker_live.longitude <> '0' 
@@ -215,7 +226,9 @@  discard block
 block discarded – undo
215 226
 		global $globalDBdriver, $globalLiveInterval;
216 227
 		$filter_query = $this->getFilter($filter,true,true);
217 228
 
218
-		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
229
+		if (!isset($globalLiveInterval)) {
230
+			$globalLiveInterval = '200';
231
+		}
219 232
 		if ($globalDBdriver == 'mysql') {
220 233
 			$query = 'SELECT COUNT(DISTINCT tracker_live.famtrackid) as nb FROM tracker_live'.$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= date';
221 234
 		} else {
@@ -243,7 +256,9 @@  discard block
 block discarded – undo
243 256
 	{
244 257
 		global $globalDBdriver, $globalLiveInterval;
245 258
 		$Spotter = new Spotter($this->db);
246
-		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
259
+		if (!isset($globalLiveInterval)) {
260
+			$globalLiveInterval = '200';
261
+		}
247 262
 		$filter_query = $this->getFilter($filter);
248 263
 
249 264
 		if (is_array($coord)) {
@@ -251,7 +266,9 @@  discard block
 block discarded – undo
251 266
 			$minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
252 267
 			$maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
253 268
 			$maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
254
-		} else return array();
269
+		} else {
270
+			return array();
271
+		}
255 272
 		if ($globalDBdriver == 'mysql') {
256 273
 			$query  = 'SELECT tracker_live.* FROM tracker_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.famtrackid) s on tracker_live.famtrackid = s.famtrackid AND tracker_live.date = s.maxdate AND tracker_live.latitude BETWEEN '.$minlat.' AND '.$maxlat.' AND tracker_live.longitude BETWEEN '.$minlong.' AND '.$maxlong.' GROUP BY tracker_live.famtrackid'.$filter_query;
257 274
 		} else {
@@ -271,7 +288,9 @@  discard block
 block discarded – undo
271 288
 	{
272 289
 		global $globalDBdriver, $globalLiveInterval;
273 290
 		$Spotter = new Spotter($this->db);
274
-		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
291
+		if (!isset($globalLiveInterval)) {
292
+			$globalLiveInterval = '200';
293
+		}
275 294
 		$filter_query = $this->getFilter($filter);
276 295
 
277 296
 		if (is_array($coord)) {
@@ -279,7 +298,9 @@  discard block
 block discarded – undo
279 298
 			$minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
280 299
 			$maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
281 300
 			$maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
282
-		} else return array();
301
+		} else {
302
+			return array();
303
+		}
283 304
 		if ($globalDBdriver == 'mysql') {
284 305
 			$query  = 'SELECT tracker_live.ident, tracker_live.famtrackid,tracker_live.type, tracker_live.latitude, tracker_live.longitude, tracker_live.altitude, tracker_live.heading, tracker_live.ground_speed, tracker_live.date, tracker_live.format_source 
285 306
 			FROM tracker_live'.$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval." SECOND) <= tracker_live.date AND tracker_live.latitude <> '0' AND tracker_live.longitude <> '0' AND tracker_live.latitude BETWEEN ".$minlat.' AND '.$maxlat.' AND tracker_live.longitude BETWEEN '.$minlong.' AND '.$maxlong."
@@ -472,11 +493,15 @@  discard block
 block discarded – undo
472 493
 		//$query  = self::$global_query.' WHERE tracker_live.famtrackid = :id ORDER BY date';
473 494
 		if ($globalDBdriver == 'mysql') {
474 495
 			$query = 'SELECT tracker_live.* FROM tracker_live WHERE tracker_live.famtrackid = :id';
475
-			if ($liveinterval) $query .= ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= date';
496
+			if ($liveinterval) {
497
+				$query .= ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= date';
498
+			}
476 499
 			$query .= ' ORDER BY date';
477 500
 		} else {
478 501
 			$query = 'SELECT tracker_live.* FROM tracker_live WHERE tracker_live.famtrackid = :id';
479
-			if ($liveinterval) $query .= " AND CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= date";
502
+			if ($liveinterval) {
503
+				$query .= " AND CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= date";
504
+			}
480 505
 			$query .= ' ORDER BY date';
481 506
 		}
482 507
 
@@ -571,7 +596,9 @@  discard block
 block discarded – undo
571 596
 				$i++;
572 597
 				$j++;
573 598
 				if ($j == 30) {
574
-					if ($globalDebug) echo ".";
599
+					if ($globalDebug) {
600
+						echo ".";
601
+					}
575 602
 				    	try {
576 603
 						
577 604
 						$sth = $this->db->prepare(substr($query_delete,0,-1).")");
@@ -818,7 +845,9 @@  discard block
 block discarded – undo
818 845
 			{
819 846
 				return false;
820 847
 			}
821
-		} else return '';
848
+		} else {
849
+			return '';
850
+		}
822 851
 
823 852
 		if ($longitude != '')
824 853
 		{
@@ -826,7 +855,9 @@  discard block
 block discarded – undo
826 855
 			{
827 856
 				return false;
828 857
 			}
829
-		} else return '';
858
+		} else {
859
+			return '';
860
+		}
830 861
 
831 862
 		if ($altitude != '')
832 863
 		{
@@ -834,7 +865,9 @@  discard block
 block discarded – undo
834 865
 			{
835 866
 				return false;
836 867
 			}
837
-		} else $altitude = 0;
868
+		} else {
869
+			$altitude = 0;
870
+		}
838 871
 
839 872
 		if ($heading != '')
840 873
 		{
@@ -842,7 +875,9 @@  discard block
 block discarded – undo
842 875
 			{
843 876
 				return false;
844 877
 			}
845
-		} else $heading = 0;
878
+		} else {
879
+			$heading = 0;
880
+		}
846 881
 
847 882
 		if ($groundspeed != '')
848 883
 		{
@@ -850,9 +885,13 @@  discard block
 block discarded – undo
850 885
 			{
851 886
 				return false;
852 887
 			}
853
-		} else $groundspeed = 0;
888
+		} else {
889
+			$groundspeed = 0;
890
+		}
854 891
 		date_default_timezone_set('UTC');
855
-		if ($date == '') $date = date("Y-m-d H:i:s", time());
892
+		if ($date == '') {
893
+			$date = date("Y-m-d H:i:s", time());
894
+		}
856 895
 
857 896
         
858 897
 		$famtrackid = filter_var($famtrackid,FILTER_SANITIZE_STRING);
@@ -868,12 +907,18 @@  discard block
 block discarded – undo
868 907
 		$comment = filter_var($comment,FILTER_SANITIZE_STRING);
869 908
 		$type = filter_var($type,FILTER_SANITIZE_STRING);
870 909
 
871
-            	if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) $groundspeed = 0;
872
-            	if ($heading == '' || $Common->isInteger($heading) === false ) $heading = 0;
910
+            	if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) {
911
+            		$groundspeed = 0;
912
+            	}
913
+            	if ($heading == '' || $Common->isInteger($heading) === false ) {
914
+            		$heading = 0;
915
+            	}
873 916
             	
874 917
 		$query = '';
875 918
 		if ($globalArchive) {
876
-			if ($globalDebug) echo '-- Delete previous data -- ';
919
+			if ($globalDebug) {
920
+				echo '-- Delete previous data -- ';
921
+			}
877 922
 			$query .= 'DELETE FROM tracker_live WHERE famtrackid = :famtrackid;';
878 923
 		}
879 924
 		$query  .= 'INSERT INTO tracker_live (famtrackid, ident, latitude, longitude, altitude, heading, ground_speed, date, format_source, source_name, over_country, comment, type) 
@@ -890,10 +935,14 @@  discard block
 block discarded – undo
890 935
                 echo 'putinarchive : '.$putinarchive."\n";
891 936
                 echo 'noarchive : '.$noarchive."\n";
892 937
 		if (isset($globalArchive) && $globalArchive && $putinarchive && $noarchive !== true) {
893
-		    if ($globalDebug) echo '(Add to SBS archive : ';
938
+		    if ($globalDebug) {
939
+		    	echo '(Add to SBS archive : ';
940
+		    }
894 941
 		    $TrackerArchive = new TrackerArchive($this->db);
895 942
 		    $result =  $TrackerArchive->addTrackerArchiveData($famtrackid, $ident,$latitude, $longitude, $altitude, $heading, $groundspeed, $date, $putinarchive, $comment, $type,$noarchive,$format_source, $source_name, $over_country);
896
-		    if ($globalDebug) echo $result.')';
943
+		    if ($globalDebug) {
944
+		    	echo $result.')';
945
+		    }
897 946
 		}
898 947
 
899 948
 		return "success";
Please login to merge, or discard this patch.
pilot-detailed.php 1 patch
Braces   +24 added lines, -8 removed lines patch added patch discarded remove patch
@@ -40,8 +40,12 @@  discard block
 block discarded – undo
40 40
 	$year = filter_input(INPUT_GET,'year',FILTER_SANITIZE_NUMBER_INT);
41 41
 	$month = filter_input(INPUT_GET,'month',FILTER_SANITIZE_NUMBER_INT);
42 42
 	$filter = array();
43
-	if ($year != '') $filter = array_merge($filter,array('year' => $year));
44
-	if ($month != '') $filter = array_merge($filter,array('month' => $month));
43
+	if ($year != '') {
44
+		$filter = array_merge($filter,array('year' => $year));
45
+	}
46
+	if ($month != '') {
47
+		$filter = array_merge($filter,array('month' => $month));
48
+	}
45 49
 	if ($sort != '') 
46 50
 	{
47 51
 		$spotter_array = $Spotter->getSpotterDataByPilot($pilot,$limit_start.",".$absolute_difference, $sort,$filter);
@@ -59,8 +63,12 @@  discard block
 block discarded – undo
59 63
 	{
60 64
 		$title = sprintf(_("Detailed View for %s"),$spotter_array[0]['pilot_name']);
61 65
 		$ident = $spotter_array[0]['ident'];
62
-		if (isset($spotter_array[0]['latitude'])) $latitude = $spotter_array[0]['latitude'];
63
-		if (isset($spotter_array[0]['longitude'])) $longitude = $spotter_array[0]['longitude'];
66
+		if (isset($spotter_array[0]['latitude'])) {
67
+			$latitude = $spotter_array[0]['latitude'];
68
+		}
69
+		if (isset($spotter_array[0]['longitude'])) {
70
+			$longitude = $spotter_array[0]['longitude'];
71
+		}
64 72
 		require_once('header.php');
65 73
 		/*
66 74
 		if (isset($globalArchive) && $globalArchive) {
@@ -113,12 +121,18 @@  discard block
 block discarded – undo
113 121
 		*/
114 122
 		print '<div class="info column">';
115 123
 		print '<h1>'.$spotter_array[0]['pilot_name'].'</h1>';
116
-		if (isset($spotter_array[0]['pilot_id']) && $spotter_array[0]['pilot_id'] != '') print '<div><span class="label">'._("Pilot ID").'</span>'.$spotter_array[0]['pilot_id'].'</div>';
124
+		if (isset($spotter_array[0]['pilot_id']) && $spotter_array[0]['pilot_id'] != '') {
125
+			print '<div><span class="label">'._("Pilot ID").'</span>'.$spotter_array[0]['pilot_id'].'</div>';
126
+		}
117 127
 		if ($year == '' && $month == '') {
118 128
 			$Stats = new Stats();
119 129
 			$flights = $Stats->getStatsPilot($pilot);
120
-		} else $flights = 0;
121
-		if ($flights == 0) $flights = $Spotter->countFlightsByPilot($pilot,$filter);
130
+		} else {
131
+			$flights = 0;
132
+		}
133
+		if ($flights == 0) {
134
+			$flights = $Spotter->countFlightsByPilot($pilot,$filter);
135
+		}
122 136
 		print '<div><span class="label">'._("Flights").'</span>'.$flights.'</div>';
123 137
 		$aircraft_type = count($Spotter->countAllAircraftTypesByPilot($pilot,$filter));
124 138
 		print '<div><span class="label">'._("Aircrafts type").'</span>'.$aircraft_type.'</div>';
@@ -129,7 +143,9 @@  discard block
 block discarded – undo
129 143
 		$airlines = count($Spotter->countAllAirlinesByPilot($pilot,$filter));
130 144
 		print '<div><span class="label">'._("Airlines").'</span>'.$airlines.'</div>';
131 145
 		$duration = $Spotter->getFlightDurationByPilot($pilot,$filter);
132
-		if ($duration != '0') print '<div><span class="label">'._("Total flights spotted duration").'</span>'.$duration.'</div>';
146
+		if ($duration != '0') {
147
+			print '<div><span class="label">'._("Total flights spotted duration").'</span>'.$duration.'</div>';
148
+		}
133 149
 		print '</div>';
134 150
 	
135 151
 		include('owner-sub-menu.php');
Please login to merge, or discard this patch.
footer.php 1 patch
Braces   +4 added lines, -1 removed lines patch added patch discarded remove patch
@@ -9,7 +9,10 @@
 block discarded – undo
9 9
 	<?php
10 10
 	    }
11 11
 	?>
12
-	<span>Developed in Barrie by <a href="http://mtru.nz/" target="_blank">Mario Trunz</a> & at <a href="http://www.zugaina.com" target="_blank">Zugaina</a> by Ycarus</span> - <span><a href="<?php if (isset($globalURL)) print $globalURL; ?>/about#source">Source &amp; Credits</a></span> - <span><a href="https://www.flightairmap.fr/" target="_blank">Get source code</a></span>
12
+	<span>Developed in Barrie by <a href="http://mtru.nz/" target="_blank">Mario Trunz</a> & at <a href="http://www.zugaina.com" target="_blank">Zugaina</a> by Ycarus</span> - <span><a href="<?php if (isset($globalURL)) {
13
+	print $globalURL;
14
+}
15
+?>/about#source">Source &amp; Credits</a></span> - <span><a href="https://www.flightairmap.fr/" target="_blank">Get source code</a></span>
13 16
 </footer>
14 17
 
15 18
 <div class="notifications bottom-left"></div>
Please login to merge, or discard this patch.
require/class.SBS.php 1 patch
Braces   +248 added lines, -87 removed lines patch added patch discarded remove patch
@@ -7,9 +7,13 @@  discard block
 block discarded – undo
7 7
 	//echo $buffer."\n";
8 8
 	$data = array();
9 9
 	$typehex = substr($buffer,0,1);
10
-	if ($typehex == '*' || $typehex == ':') $hex = substr($buffer,1,-1);
11
-	elseif ($typehex == '@' || $typehex == '%') $hex = substr($buffer,13,-13);
12
-	else $hex = substr($buffer,1,-1);
10
+	if ($typehex == '*' || $typehex == ':') {
11
+		$hex = substr($buffer,1,-1);
12
+	} elseif ($typehex == '@' || $typehex == '%') {
13
+		$hex = substr($buffer,13,-13);
14
+	} else {
15
+		$hex = substr($buffer,1,-1);
16
+	}
13 17
 	$bin = gmp_strval( gmp_init($hex,16), 2);
14 18
 	//if (strlen($hex) == 28 && $this->parityCheck($hex,$bin)) {
15 19
 	if (strlen($hex) == 28) {
@@ -52,8 +56,9 @@  discard block
 block discarded – undo
52 56
 		    //  131072 is 2^17 since CPR latitude and longitude are encoded in 17 bits.
53 57
 		    $cprlat = intval(substr($bin,54,17),2)/131072.0;
54 58
 		    $cprlon = intval(substr($bin,71,17),2)/131072.0;
55
-		    if ($oe == 0) $this::$latlon[$icao] = array('latitude' => $cprlat,'longitude' => $cprlon,'created' => time());
56
-		    elseif (isset($this::$latlon[$icao]) && (time() - $this::$latlon[$icao]['created']) < 10) {
59
+		    if ($oe == 0) {
60
+		    	$this::$latlon[$icao] = array('latitude' => $cprlat,'longitude' => $cprlon,'created' => time());
61
+		    } elseif (isset($this::$latlon[$icao]) && (time() - $this::$latlon[$icao]['created']) < 10) {
57 62
 			$cprlat_odd = $cprlat;
58 63
 			$cprlon_odd = $cprlon;
59 64
 			$cprlat_even = $this::$latlon[$icao]['latitude'];
@@ -62,8 +67,12 @@  discard block
 block discarded – undo
62 67
 			$j = 59*$cprlat_even-60*$cprlat_odd+0.5;
63 68
 			$lat_even = (360.0/60)*($j%60+$cprlat_even);
64 69
 			$lat_odd = (360.0/59)*($j%59+$cprlat_odd);
65
-			if ($lat_even >= 270) $lat_even = $lat_even - 360;
66
-			if ($lat_odd >= 270) $lat_odd = $lat_odd - 360;
70
+			if ($lat_even >= 270) {
71
+				$lat_even = $lat_even - 360;
72
+			}
73
+			if ($lat_odd >= 270) {
74
+				$lat_odd = $lat_odd - 360;
75
+			}
67 76
 			// check latitude zone
68 77
 			if ($this->cprNL($lat_even) == $this->cprNL($lat_odd)) {
69 78
 			    if ($this::$latlon[$icao]['created'] > time()) {
@@ -71,7 +80,9 @@  discard block
 block discarded – undo
71 80
 				$m = floor($cprlon_even*($this->cprNL($lat_even)-1) - $cprlon_odd * $this->cprNL($lat_even)+0.5);
72 81
 				$lon = (360.0/$ni)*($m%$ni+$cprlon_even);
73 82
 				$lat = $lat_even;
74
-				if ($lon > 180) $lon = $lon -360;
83
+				if ($lon > 180) {
84
+					$lon = $lon -360;
85
+				}
75 86
 				if ($lat > -91 && $lat < 91 && $lon > -181 && $lon < 181) {
76 87
 				    //if ($globalDebug) echo 'cs : '.$cs.' - hex : '.$hex.' - lat : '.$lat.' - lon : '.$lon;
77 88
 				    $data['latitude'] = $lat;
@@ -82,14 +93,18 @@  discard block
 block discarded – undo
82 93
 				$m = floor($cprlon_even*($this->cprNL($lat_odd)-1) - $cprlon_odd * $this->cprNL($lat_odd)+0.5);
83 94
 				$lon = (360.0/$ni)*($m%$ni+$cprlon_odd);
84 95
 				$lat = $lat_odd;
85
-				if ($lon > 180) $lon = $lon -360;
96
+				if ($lon > 180) {
97
+					$lon = $lon -360;
98
+				}
86 99
 				if ($lat > -91 && $lat < 91 && $lon > -181 && $lon < 181) {
87 100
 				    //if ($globalDebug) echo 'icao : '.$icao.' - hex : '.$hex.' - lat : '.$lat.' - lon : '.$lon.' second'."\n";
88 101
 				    $data['latitude'] = $lat;
89 102
 				    $data['longitude'] = $lon;
90 103
 				}
91 104
 			    }
92
-			} else echo "Not cprNL";
105
+			} else {
106
+				echo "Not cprNL";
107
+			}
93 108
 			unset($this::$latlon[$icao]);
94 109
 		    }
95 110
 		} elseif ($tc == 19) {
@@ -98,11 +113,17 @@  discard block
 block discarded – undo
98 113
 		    $v_ew = intval(substr($bin,46,10),2);
99 114
 		    $v_ns_dir = intval(substr($bin,56,1));
100 115
 		    $v_ns = intval(substr($bin,57,10),2);
101
-		    if ($v_ew_dir) $v_ew = -1*$v_ew;
102
-		    if ($v_ns_dir) $v_ns = -1*$v_ns;
116
+		    if ($v_ew_dir) {
117
+		    	$v_ew = -1*$v_ew;
118
+		    }
119
+		    if ($v_ns_dir) {
120
+		    	$v_ns = -1*$v_ns;
121
+		    }
103 122
 		    $speed = sqrt($v_ns*$v_ns+$v_ew*$v_ew);
104 123
 		    $heading = atan2($v_ew,$v_ns)*360.0/(2*pi());
105
-		    if ($heading <0) $heading = $heading+360;
124
+		    if ($heading <0) {
125
+		    	$heading = $heading+360;
126
+		    }
106 127
 		    $data['speed'] = $speed;
107 128
 		    $data['heading'] = $heading;
108 129
 		}
@@ -117,72 +138,194 @@  discard block
 block discarded – undo
117 138
 
118 139
 	public function cprNL($lat) {
119 140
 	//Lookup table to convert the latitude to index.
120
-	if ($lat < 0) $lat = -$lat;             // Table is simmetric about the equator.
121
-	if ($lat < 10.47047130) return 59;
122
-	if ($lat < 14.82817437) return 58;
123
-	if ($lat < 18.18626357) return 57;
124
-	if ($lat < 21.02939493) return 56;
125
-	if ($lat < 23.54504487) return 55;
126
-	if ($lat < 25.82924707) return 54;
127
-	if ($lat < 27.93898710) return 53;
128
-	if ($lat < 29.91135686) return 52;
129
-	if ($lat < 31.77209708) return 51;
130
-	if ($lat < 33.53993436) return 50;
131
-	if ($lat < 35.22899598) return 49;
132
-	if ($lat < 36.85025108) return 48;
133
-	if ($lat < 38.41241892) return 47;
134
-	if ($lat < 39.92256684) return 46;
135
-	if ($lat < 41.38651832) return 45;
136
-	if ($lat < 42.80914012) return 44;
137
-	if ($lat < 44.19454951) return 43;
138
-	if ($lat < 45.54626723) return 42;
139
-	if ($lat < 46.86733252) return 41;
140
-	if ($lat < 48.16039128) return 40;
141
-	if ($lat < 49.42776439) return 39;
142
-	if ($lat < 50.67150166) return 38;
143
-	if ($lat < 51.89342469) return 37;
144
-	if ($lat < 53.09516153) return 36;
145
-	if ($lat < 54.27817472) return 35;
146
-	if ($lat < 55.44378444) return 34;
147
-	if ($lat < 56.59318756) return 33;
148
-	if ($lat < 57.72747354) return 32;
149
-	if ($lat < 58.84763776) return 31;
150
-	if ($lat < 59.95459277) return 30;
151
-	if ($lat < 61.04917774) return 29;
152
-	if ($lat < 62.13216659) return 28;
153
-	if ($lat < 63.20427479) return 27;
154
-	if ($lat < 64.26616523) return 26;
155
-	if ($lat < 65.31845310) return 25;
156
-	if ($lat < 66.36171008) return 24;
157
-	if ($lat < 67.39646774) return 23;
158
-	if ($lat < 68.42322022) return 22;
159
-	if ($lat < 69.44242631) return 21;
160
-	if ($lat < 70.45451075) return 20;
161
-	if ($lat < 71.45986473) return 19;
162
-	if ($lat < 72.45884545) return 18;
163
-	if ($lat < 73.45177442) return 17;
164
-	if ($lat < 74.43893416) return 16;
165
-	if ($lat < 75.42056257) return 15;
166
-	if ($lat < 76.39684391) return 14;
167
-	if ($lat < 77.36789461) return 13;
168
-	if ($lat < 78.33374083) return 12;
169
-	if ($lat < 79.29428225) return 11;
170
-	if ($lat < 80.24923213) return 10;
171
-	if ($lat < 81.19801349) return 9;
172
-	if ($lat < 82.13956981) return 8;
173
-	if ($lat < 83.07199445) return 7;
174
-	if ($lat < 83.99173563) return 6;
175
-	if ($lat < 84.89166191) return 5;
176
-	if ($lat < 85.75541621) return 4;
177
-	if ($lat < 86.53536998) return 3;
178
-	if ($lat < 87.00000000) return 2;
141
+	if ($lat < 0) {
142
+		$lat = -$lat;
143
+	}
144
+	// Table is simmetric about the equator.
145
+	if ($lat < 10.47047130) {
146
+		return 59;
147
+	}
148
+	if ($lat < 14.82817437) {
149
+		return 58;
150
+	}
151
+	if ($lat < 18.18626357) {
152
+		return 57;
153
+	}
154
+	if ($lat < 21.02939493) {
155
+		return 56;
156
+	}
157
+	if ($lat < 23.54504487) {
158
+		return 55;
159
+	}
160
+	if ($lat < 25.82924707) {
161
+		return 54;
162
+	}
163
+	if ($lat < 27.93898710) {
164
+		return 53;
165
+	}
166
+	if ($lat < 29.91135686) {
167
+		return 52;
168
+	}
169
+	if ($lat < 31.77209708) {
170
+		return 51;
171
+	}
172
+	if ($lat < 33.53993436) {
173
+		return 50;
174
+	}
175
+	if ($lat < 35.22899598) {
176
+		return 49;
177
+	}
178
+	if ($lat < 36.85025108) {
179
+		return 48;
180
+	}
181
+	if ($lat < 38.41241892) {
182
+		return 47;
183
+	}
184
+	if ($lat < 39.92256684) {
185
+		return 46;
186
+	}
187
+	if ($lat < 41.38651832) {
188
+		return 45;
189
+	}
190
+	if ($lat < 42.80914012) {
191
+		return 44;
192
+	}
193
+	if ($lat < 44.19454951) {
194
+		return 43;
195
+	}
196
+	if ($lat < 45.54626723) {
197
+		return 42;
198
+	}
199
+	if ($lat < 46.86733252) {
200
+		return 41;
201
+	}
202
+	if ($lat < 48.16039128) {
203
+		return 40;
204
+	}
205
+	if ($lat < 49.42776439) {
206
+		return 39;
207
+	}
208
+	if ($lat < 50.67150166) {
209
+		return 38;
210
+	}
211
+	if ($lat < 51.89342469) {
212
+		return 37;
213
+	}
214
+	if ($lat < 53.09516153) {
215
+		return 36;
216
+	}
217
+	if ($lat < 54.27817472) {
218
+		return 35;
219
+	}
220
+	if ($lat < 55.44378444) {
221
+		return 34;
222
+	}
223
+	if ($lat < 56.59318756) {
224
+		return 33;
225
+	}
226
+	if ($lat < 57.72747354) {
227
+		return 32;
228
+	}
229
+	if ($lat < 58.84763776) {
230
+		return 31;
231
+	}
232
+	if ($lat < 59.95459277) {
233
+		return 30;
234
+	}
235
+	if ($lat < 61.04917774) {
236
+		return 29;
237
+	}
238
+	if ($lat < 62.13216659) {
239
+		return 28;
240
+	}
241
+	if ($lat < 63.20427479) {
242
+		return 27;
243
+	}
244
+	if ($lat < 64.26616523) {
245
+		return 26;
246
+	}
247
+	if ($lat < 65.31845310) {
248
+		return 25;
249
+	}
250
+	if ($lat < 66.36171008) {
251
+		return 24;
252
+	}
253
+	if ($lat < 67.39646774) {
254
+		return 23;
255
+	}
256
+	if ($lat < 68.42322022) {
257
+		return 22;
258
+	}
259
+	if ($lat < 69.44242631) {
260
+		return 21;
261
+	}
262
+	if ($lat < 70.45451075) {
263
+		return 20;
264
+	}
265
+	if ($lat < 71.45986473) {
266
+		return 19;
267
+	}
268
+	if ($lat < 72.45884545) {
269
+		return 18;
270
+	}
271
+	if ($lat < 73.45177442) {
272
+		return 17;
273
+	}
274
+	if ($lat < 74.43893416) {
275
+		return 16;
276
+	}
277
+	if ($lat < 75.42056257) {
278
+		return 15;
279
+	}
280
+	if ($lat < 76.39684391) {
281
+		return 14;
282
+	}
283
+	if ($lat < 77.36789461) {
284
+		return 13;
285
+	}
286
+	if ($lat < 78.33374083) {
287
+		return 12;
288
+	}
289
+	if ($lat < 79.29428225) {
290
+		return 11;
291
+	}
292
+	if ($lat < 80.24923213) {
293
+		return 10;
294
+	}
295
+	if ($lat < 81.19801349) {
296
+		return 9;
297
+	}
298
+	if ($lat < 82.13956981) {
299
+		return 8;
300
+	}
301
+	if ($lat < 83.07199445) {
302
+		return 7;
303
+	}
304
+	if ($lat < 83.99173563) {
305
+		return 6;
306
+	}
307
+	if ($lat < 84.89166191) {
308
+		return 5;
309
+	}
310
+	if ($lat < 85.75541621) {
311
+		return 4;
312
+	}
313
+	if ($lat < 86.53536998) {
314
+		return 3;
315
+	}
316
+	if ($lat < 87.00000000) {
317
+		return 2;
318
+	}
179 319
 	return 1;
180 320
     }
181 321
     
182 322
     public function cprN($lat,$isodd) {
183 323
 	$nl = $this->cprNL($lat) - $isodd;
184
-	if ($nl > 1) return $nl;
185
-	else return 1;
324
+	if ($nl > 1) {
325
+		return $nl;
326
+	} else {
327
+		return 1;
328
+	}
186 329
     }
187 330
 
188 331
 
@@ -208,10 +351,13 @@  discard block
 block discarded – undo
208 351
 	$checksum = intval(substr($msg,22,6),16);
209 352
 
210 353
 	for ($j = 0; $j < strlen($bin); $j++) {
211
-	    if ($bin[$j]) $crc = $crc^intval($modes_checksum_table[$j],0);
354
+	    if ($bin[$j]) {
355
+	    	$crc = $crc^intval($modes_checksum_table[$j],0);
356
+	    }
212 357
 	}
213
-	if ($crc == $checksum) return true;
214
-	else {
358
+	if ($crc == $checksum) {
359
+		return true;
360
+	} else {
215 361
 	    //echo "**** CRC ERROR ****\n";
216 362
 	    return false;
217 363
 	}
@@ -258,22 +404,37 @@  discard block
 block discarded – undo
258 404
 	    $msg['date_log'] = date('Y/m/d',$data['timestamp']);
259 405
 	    $msg['time_log'] = date('H:i:s',$data['timestamp']).'.180';
260 406
 	    $msg['callsign'] = '';
261
-	    if (isset($data['altitude'])) $msg['altitude'] = $data['altitude'];
262
-	    else $msg['altitude'] = '';
407
+	    if (isset($data['altitude'])) {
408
+	    	$msg['altitude'] = $data['altitude'];
409
+	    } else {
410
+	    	$msg['altitude'] = '';
411
+	    }
263 412
 	    $msg['speed'] = $data['speed'];
264
-	    if (isset($data['heading'])) $msg['track'] = $data['heading'];
265
-	    else $msg['track'] = '';
413
+	    if (isset($data['heading'])) {
414
+	    	$msg['track'] = $data['heading'];
415
+	    } else {
416
+	    	$msg['track'] = '';
417
+	    }
266 418
 	    $msg['latitude'] = $data['latitude'];
267 419
 	    $msg['longitude'] = $data['longitude'];
268
-	    if (isset($data['verticalrate'])) $msg['verticalrate'] = $data['verticalrate'];
269
-	    else $msg['verticalrate'] = '';
270
-	    if (isset($data['squawk'])) $msg['squawk'] = $data['squawk'];
271
-	    else $msg['squawk'] = 0;
420
+	    if (isset($data['verticalrate'])) {
421
+	    	$msg['verticalrate'] = $data['verticalrate'];
422
+	    } else {
423
+	    	$msg['verticalrate'] = '';
424
+	    }
425
+	    if (isset($data['squawk'])) {
426
+	    	$msg['squawk'] = $data['squawk'];
427
+	    } else {
428
+	    	$msg['squawk'] = 0;
429
+	    }
272 430
 	    $msg['alert'] = 0;
273 431
 	    $msg['emergency'] = 0;
274 432
 	    $msg['SPI'] = 0;
275
-	    if (isset($data['ground'])) $msg['ground'] = 1;
276
-	    else $msg['ground'] = 0;
433
+	    if (isset($data['ground'])) {
434
+	    	$msg['ground'] = 1;
435
+	    } else {
436
+	    	$msg['ground'] = 0;
437
+	    }
277 438
     	    $result[] = implode(',',$msg);
278 439
         }
279 440
         return $result;
Please login to merge, or discard this patch.
index.php 1 patch
Braces   +393 added lines, -101 removed lines patch added patch discarded remove patch
@@ -154,11 +154,26 @@  discard block
 block discarded – undo
154 154
 				<li><div class="checkbox"><label><input type="checkbox" name="notamcb" value="1" onclick="showNotam();" /><?php echo _("Display NOTAM"); ?></label></div></li>
155 155
 				<li><?php echo _("NOTAM scope:"); ?>
156 156
 					<select class="selectpicker" onchange="notamscope(this);">
157
-						<option<?php if (!isset($_COOKIE['notamscope']) || $_COOKIE['notamscope'] == 'All') print ' selected'; ?>>All</option>
158
-						<option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Airport/Enroute warning') print ' selected'; ?>>Airport/Enroute warning</option>
159
-						<option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Airport warning') print ' selected'; ?>>Airport warning</option>
160
-						<option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Navigation warning') print ' selected'; ?>>Navigation warning</option>
161
-						<option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Enroute warning') print ' selected'; ?>>Enroute warning</option>
157
+						<option<?php if (!isset($_COOKIE['notamscope']) || $_COOKIE['notamscope'] == 'All') {
158
+	print ' selected';
159
+}
160
+?>>All</option>
161
+						<option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Airport/Enroute warning') {
162
+	print ' selected';
163
+}
164
+?>>Airport/Enroute warning</option>
165
+						<option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Airport warning') {
166
+	print ' selected';
167
+}
168
+?>>Airport warning</option>
169
+						<option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Navigation warning') {
170
+	print ' selected';
171
+}
172
+?>>Navigation warning</option>
173
+						<option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Enroute warning') {
174
+	print ' selected';
175
+}
176
+?>>Enroute warning</option>
162 177
 					</select
163 178
 				</li>
164 179
 			</ul>
@@ -186,7 +201,12 @@  discard block
 block discarded – undo
186 201
 		        <div class="form-group">
187 202
 			    <label>From (UTC):</label>
188 203
 		            <div class='input-group date' id='datetimepicker1'>
189
-            			<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 />
204
+            			<input type='text' name="start_date" class="form-control" value="<?php if (isset($_POST['start_date'])) {
205
+	print $_POST['start_date'];
206
+} elseif (isset($_COOKIE['archive_begin'])) {
207
+	print date("m/d/Y h:i a",$_COOKIE['archive_begin']);
208
+}
209
+?>" required />
190 210
 		                <span class="input-group-addon">
191 211
             			    <span class="glyphicon glyphicon-calendar"></span>
192 212
 		                </span>
@@ -195,7 +215,12 @@  discard block
 block discarded – undo
195 215
 		        <div class="form-group">
196 216
 			    <label>To (UTC):</label>
197 217
 		            <div class='input-group date' id='datetimepicker2'>
198
-		                <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']); ?>" />
218
+		                <input type='text' name="end_date" class="form-control" value="<?php if (isset($_POST['end_date'])) {
219
+	print $_POST['end_date'];
220
+} elseif (isset($_COOKIE['archive_end'])) {
221
+	print date("m/d/Y h:i a",$_COOKIE['archive_end']);
222
+}
223
+?>" />
199 224
             			<span class="input-group-addon">
200 225
 		                    <span class="glyphicon glyphicon-calendar"></span>
201 226
             			</span>
@@ -221,8 +246,20 @@  discard block
 block discarded – undo
221 246
 
222 247
 		    <li><?php echo _("Playback speed:"); ?>
223 248
 			<div class="range">
224
-			    <input type="range" min="0" max="50" step="1" name="archivespeed" onChange="archivespeedrange.value=value;" value="<?php  if (isset($_POST['archivespeed'])) print $_POST['archivespeed']; elseif (isset($_COOKIE['archive_speed'])) print $_COOKIE['archive_speed']; else print '1'; ?>">
225
-			    <output id="archivespeedrange"><?php  if (isset($_COOKIE['archive_speed'])) print $_COOKIE['archive_speed']; else print '1'; ?></output>
249
+			    <input type="range" min="0" max="50" step="1" name="archivespeed" onChange="archivespeedrange.value=value;" value="<?php  if (isset($_POST['archivespeed'])) {
250
+	print $_POST['archivespeed'];
251
+} elseif (isset($_COOKIE['archive_speed'])) {
252
+	print $_COOKIE['archive_speed'];
253
+} else {
254
+	print '1';
255
+}
256
+?>">
257
+			    <output id="archivespeedrange"><?php  if (isset($_COOKIE['archive_speed'])) {
258
+	print $_COOKIE['archive_speed'];
259
+} else {
260
+	print '1';
261
+}
262
+?></output>
226 263
 			</div>
227 264
 		    </li>
228 265
 		    <li><input type="submit" name="archive" value="Show archive" class="btn btn-primary" /></li>
@@ -244,15 +281,27 @@  discard block
 block discarded – undo
244 281
 		    <li><?php echo _("Type of Map:"); ?>
245 282
 			<select  class="selectpicker" onchange="mapType(this);">
246 283
 			    <?php
247
-				if (!isset($_COOKIE['MapType']) || $_COOKIE['MapType'] == '') $MapType = $globalMapProvider;
248
-				else $MapType = $_COOKIE['MapType'];
284
+				if (!isset($_COOKIE['MapType']) || $_COOKIE['MapType'] == '') {
285
+					$MapType = $globalMapProvider;
286
+				} else {
287
+					$MapType = $_COOKIE['MapType'];
288
+				}
249 289
 			    ?>
250 290
 			    <?php
251 291
 				if (isset($globalBingMapKey) && $globalBingMapKey != '') {
252 292
 			    ?>
253
-			    <option value="Bing-Aerial"<?php if ($MapType == 'Bing-Aerial') print ' selected'; ?>>Bing-Aerial</option>
254
-			    <option value="Bing-Hybrid"<?php if ($MapType == 'Bing-Hybrid') print ' selected'; ?>>Bing-Hybrid</option>
255
-			    <option value="Bing-Road"<?php if ($MapType == 'Bing-Road') print ' selected'; ?>>Bing-Road</option>
293
+			    <option value="Bing-Aerial"<?php if ($MapType == 'Bing-Aerial') {
294
+	print ' selected';
295
+}
296
+?>>Bing-Aerial</option>
297
+			    <option value="Bing-Hybrid"<?php if ($MapType == 'Bing-Hybrid') {
298
+	print ' selected';
299
+}
300
+?>>Bing-Hybrid</option>
301
+			    <option value="Bing-Road"<?php if ($MapType == 'Bing-Road') {
302
+	print ' selected';
303
+}
304
+?>>Bing-Road</option>
256 305
 			    <?php
257 306
 				}
258 307
 			    ?>
@@ -262,56 +311,131 @@  discard block
 block discarded – undo
262 311
 			    <?php
263 312
 				    if (isset($globalHereappId) && $globalHereappId != '' && isset($globalHereappCode) && $globalHereappCode != '') {
264 313
 			    ?>
265
-			    <option value="Here-Aerial"<?php if ($MapType == 'Here') print ' selected'; ?>>Here-Aerial</option>
266
-			    <option value="Here-Hybrid"<?php if ($MapType == 'Here') print ' selected'; ?>>Here-Hybrid</option>
267
-			    <option value="Here-Road"<?php if ($MapType == 'Here') print ' selected'; ?>>Here-Road</option>
314
+			    <option value="Here-Aerial"<?php if ($MapType == 'Here') {
315
+	print ' selected';
316
+}
317
+?>>Here-Aerial</option>
318
+			    <option value="Here-Hybrid"<?php if ($MapType == 'Here') {
319
+	print ' selected';
320
+}
321
+?>>Here-Hybrid</option>
322
+			    <option value="Here-Road"<?php if ($MapType == 'Here') {
323
+	print ' selected';
324
+}
325
+?>>Here-Road</option>
268 326
 			    <?php
269 327
 				    }
270 328
 			    ?>
271 329
 			    <?php
272 330
 				    if (isset($globalGoogleAPIKey) && $globalGoogleAPIKey != '') {
273 331
 			    ?>
274
-			    <option value="Google-Roadmap"<?php if ($MapType == 'Google-Roadmap') print ' selected'; ?>>Google Roadmap</option>
275
-			    <option value="Google-Satellite"<?php if ($MapType == 'Google-Satellite') print ' selected'; ?>>Google Satellite</option>
276
-			    <option value="Google-Hybrid"<?php if ($MapType == 'Google-Hybrid') print ' selected'; ?>>Google Hybrid</option>
277
-			    <option value="Google-Terrain"<?php if ($MapType == 'Google-Terrain') print ' selected'; ?>>Google Terrain</option>
332
+			    <option value="Google-Roadmap"<?php if ($MapType == 'Google-Roadmap') {
333
+	print ' selected';
334
+}
335
+?>>Google Roadmap</option>
336
+			    <option value="Google-Satellite"<?php if ($MapType == 'Google-Satellite') {
337
+	print ' selected';
338
+}
339
+?>>Google Satellite</option>
340
+			    <option value="Google-Hybrid"<?php if ($MapType == 'Google-Hybrid') {
341
+	print ' selected';
342
+}
343
+?>>Google Hybrid</option>
344
+			    <option value="Google-Terrain"<?php if ($MapType == 'Google-Terrain') {
345
+	print ' selected';
346
+}
347
+?>>Google Terrain</option>
278 348
 			    <?php
279 349
 				    }
280 350
 			    ?>
281 351
 			    <?php
282 352
 				    if (isset($globalMapQuestKey) && $globalMapQuestKey != '') {
283 353
 			    ?>
284
-			    <option value="MapQuest-OSM"<?php if ($MapType == 'MapQuest-OSM') print ' selected'; ?>>MapQuest-OSM</option>
285
-			    <option value="MapQuest-Aerial"<?php if ($MapType == 'MapQuest-Aerial') print ' selected'; ?>>MapQuest-Aerial</option>
286
-			    <option value="MapQuest-Hybrid"<?php if ($MapType == 'MapQuest-Hybrid') print ' selected'; ?>>MapQuest-Hybrid</option>
354
+			    <option value="MapQuest-OSM"<?php if ($MapType == 'MapQuest-OSM') {
355
+	print ' selected';
356
+}
357
+?>>MapQuest-OSM</option>
358
+			    <option value="MapQuest-Aerial"<?php if ($MapType == 'MapQuest-Aerial') {
359
+	print ' selected';
360
+}
361
+?>>MapQuest-Aerial</option>
362
+			    <option value="MapQuest-Hybrid"<?php if ($MapType == 'MapQuest-Hybrid') {
363
+	print ' selected';
364
+}
365
+?>>MapQuest-Hybrid</option>
287 366
 			    <?php
288 367
 				    }
289 368
 			    ?>
290
-			    <option value="Yandex"<?php if ($MapType == 'Yandex') print ' selected'; ?>>Yandex</option>
369
+			    <option value="Yandex"<?php if ($MapType == 'Yandex') {
370
+	print ' selected';
371
+}
372
+?>>Yandex</option>
291 373
 			    <?php
292 374
 				}
293 375
 			    ?>
294 376
 			    <?php
295 377
 				    if (isset($globalMapboxToken) && $globalMapboxToken != '') {
296
-					if (!isset($_COOKIE['MapTypeId'])) $MapBoxId = 'default';
297
-					else $MapBoxId = $_COOKIE['MapTypeId'];
378
+					if (!isset($_COOKIE['MapTypeId'])) {
379
+						$MapBoxId = 'default';
380
+					} else {
381
+						$MapBoxId = $_COOKIE['MapTypeId'];
382
+					}
298 383
 			    ?>
299
-			    <option value="Mapbox-default"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'default') print ' selected'; ?>>Mapbox default</option>
300
-			    <option value="Mapbox-mapbox.streets"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.streets') print ' selected'; ?>>Mapbox streets</option>
301
-			    <option value="Mapbox-mapbox.light"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.light') print ' selected'; ?>>Mapbox light</option>
302
-			    <option value="Mapbox-mapbox.dark"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.dark') print ' selected'; ?>>Mapbox dark</option>
303
-			    <option value="Mapbox-mapbox.satellite"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.satellite') print ' selected'; ?>>Mapbox satellite</option>
304
-			    <option value="Mapbox-mapbox.streets-satellite"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.streets-satellite') print ' selected'; ?>>Mapbox streets-satellite</option>
305
-			    <option value="Mapbox-mapbox.streets-basic"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.streets-basic') print ' selected'; ?>>Mapbox streets-basic</option>
306
-			    <option value="Mapbox-mapbox.comic"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.comic') print ' selected'; ?>>Mapbox comic</option>
307
-			    <option value="Mapbox-mapbox.outdoors"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.outdoors') print ' selected'; ?>>Mapbox outdoors</option>
308
-			    <option value="Mapbox-mapbox.pencil"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.pencil') print ' selected'; ?>>Mapbox pencil</option>
309
-			    <option value="Mapbox-mapbox.pirates"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.pirates') print ' selected'; ?>>Mapbox pirates</option>
310
-			    <option value="Mapbox-mapbox.emerald"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.emerald') print ' selected'; ?>>Mapbox emerald</option>
384
+			    <option value="Mapbox-default"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'default') {
385
+	print ' selected';
386
+}
387
+?>>Mapbox default</option>
388
+			    <option value="Mapbox-mapbox.streets"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.streets') {
389
+	print ' selected';
390
+}
391
+?>>Mapbox streets</option>
392
+			    <option value="Mapbox-mapbox.light"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.light') {
393
+	print ' selected';
394
+}
395
+?>>Mapbox light</option>
396
+			    <option value="Mapbox-mapbox.dark"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.dark') {
397
+	print ' selected';
398
+}
399
+?>>Mapbox dark</option>
400
+			    <option value="Mapbox-mapbox.satellite"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.satellite') {
401
+	print ' selected';
402
+}
403
+?>>Mapbox satellite</option>
404
+			    <option value="Mapbox-mapbox.streets-satellite"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.streets-satellite') {
405
+	print ' selected';
406
+}
407
+?>>Mapbox streets-satellite</option>
408
+			    <option value="Mapbox-mapbox.streets-basic"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.streets-basic') {
409
+	print ' selected';
410
+}
411
+?>>Mapbox streets-basic</option>
412
+			    <option value="Mapbox-mapbox.comic"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.comic') {
413
+	print ' selected';
414
+}
415
+?>>Mapbox comic</option>
416
+			    <option value="Mapbox-mapbox.outdoors"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.outdoors') {
417
+	print ' selected';
418
+}
419
+?>>Mapbox outdoors</option>
420
+			    <option value="Mapbox-mapbox.pencil"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.pencil') {
421
+	print ' selected';
422
+}
423
+?>>Mapbox pencil</option>
424
+			    <option value="Mapbox-mapbox.pirates"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.pirates') {
425
+	print ' selected';
426
+}
427
+?>>Mapbox pirates</option>
428
+			    <option value="Mapbox-mapbox.emerald"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.emerald') {
429
+	print ' selected';
430
+}
431
+?>>Mapbox emerald</option>
311 432
 			    <?php
312 433
 				    }
313 434
 			    ?>
314
-			    <option value="OpenStreetMap"<?php if ($MapType == 'OpenStreetMap') print ' selected'; ?>>OpenStreetMap</option>
435
+			    <option value="OpenStreetMap"<?php if ($MapType == 'OpenStreetMap') {
436
+	print ' selected';
437
+}
438
+?>>OpenStreetMap</option>
315 439
 			</select>
316 440
 		    </li>
317 441
 <?php
@@ -319,9 +443,18 @@  discard block
 block discarded – undo
319 443
 ?>
320 444
 		    <li><?php echo _("Type of Terrain:"); ?>
321 445
 			<select  class="selectpicker" onchange="terrainType(this);">
322
-			    <option value="stk"<?php if (!isset($_COOKIE['MapTerrain']) || $_COOKIE['MapTerrain'] == 'stk') print ' selected'; ?>>stk terrain</option>
323
-			    <option value="ellipsoid"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'ellipsoid') print ' selected';?>>ellipsoid</option>
324
-			    <option value="vrterrain"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'vrterrain') print ' selected';?>>vr terrain</option>
446
+			    <option value="stk"<?php if (!isset($_COOKIE['MapTerrain']) || $_COOKIE['MapTerrain'] == 'stk') {
447
+	print ' selected';
448
+}
449
+?>>stk terrain</option>
450
+			    <option value="ellipsoid"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'ellipsoid') {
451
+	print ' selected';
452
+}
453
+?>>ellipsoid</option>
454
+			    <option value="vrterrain"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'vrterrain') {
455
+	print ' selected';
456
+}
457
+?>>vr terrain</option>
325 458
 			</select>
326 459
 		    </li>
327 460
 <?php
@@ -331,18 +464,36 @@  discard block
 block discarded – undo
331 464
     if (!isset($_COOKIE['MapFormat']) || $_COOKIE['MapFormat'] != '3d') {
332 465
 ?>
333 466
 		    
334
-		    <li><div class="checkbox"><label><input type="checkbox" name="flightpopup" value="1" onclick="clickFlightPopup(this)" <?php if (isset($_COOKIE['flightpopup']) && $_COOKIE['flightpopup'] == 'true') print 'checked'; ?> ><?php echo _("Display flight info as popup"); ?></label></div></li>
335
-		    <li><div class="checkbox"><label><input type="checkbox" name="flightpath" value="1" onclick="clickFlightPath(this)" <?php if ((isset($_COOKIE['flightpath']) && $_COOKIE['flightpath'] == 'true')) print 'checked'; ?> ><?php echo _("Display flight path"); ?></label></div></li>
336
-		    <li><div class="checkbox"><label><input type="checkbox" name="flightroute" value="1" onclick="clickFlightRoute(this)" <?php if ((isset($_COOKIE['MapRoute']) && $_COOKIE['MapRoute'] == 'true') || !isset($_COOKIE['MapRoute'])) print 'checked'; ?> ><?php echo _("Display flight route on click"); ?></label></div></li>
337
-		    <li><div class="checkbox"><label><input type="checkbox" name="flightestimation" value="1" onclick="clickFlightEstimation(this)" <?php if ((isset($_COOKIE['flightestimation']) && $_COOKIE['flightestimation'] == 'true') || (!isset($_COOKIE['flightestimation']) && !isset($globalMapEstimation)) || (!isset($_COOKIE['flightestimation']) && isset($globalMapEstimation) && $globalMapEstimation)) print 'checked'; ?> ><?php echo _("Planes animate between updates"); ?></label></div></li>
467
+		    <li><div class="checkbox"><label><input type="checkbox" name="flightpopup" value="1" onclick="clickFlightPopup(this)" <?php if (isset($_COOKIE['flightpopup']) && $_COOKIE['flightpopup'] == 'true') {
468
+	print 'checked';
469
+}
470
+?> ><?php echo _("Display flight info as popup"); ?></label></div></li>
471
+		    <li><div class="checkbox"><label><input type="checkbox" name="flightpath" value="1" onclick="clickFlightPath(this)" <?php if ((isset($_COOKIE['flightpath']) && $_COOKIE['flightpath'] == 'true')) {
472
+	print 'checked';
473
+}
474
+?> ><?php echo _("Display flight path"); ?></label></div></li>
475
+		    <li><div class="checkbox"><label><input type="checkbox" name="flightroute" value="1" onclick="clickFlightRoute(this)" <?php if ((isset($_COOKIE['MapRoute']) && $_COOKIE['MapRoute'] == 'true') || !isset($_COOKIE['MapRoute'])) {
476
+	print 'checked';
477
+}
478
+?> ><?php echo _("Display flight route on click"); ?></label></div></li>
479
+		    <li><div class="checkbox"><label><input type="checkbox" name="flightestimation" value="1" onclick="clickFlightEstimation(this)" <?php if ((isset($_COOKIE['flightestimation']) && $_COOKIE['flightestimation'] == 'true') || (!isset($_COOKIE['flightestimation']) && !isset($globalMapEstimation)) || (!isset($_COOKIE['flightestimation']) && isset($globalMapEstimation) && $globalMapEstimation)) {
480
+	print 'checked';
481
+}
482
+?> ><?php echo _("Planes animate between updates"); ?></label></div></li>
338 483
 <?php
339 484
     }
340 485
 ?>
341
-		    <li><div class="checkbox"><label><input type="checkbox" name="displayairports" value="1" onclick="clickDisplayAirports(this)" <?php if (isset($_COOKIE['displayairports']) && $_COOKIE['displayairports'] == 'true') print 'checked'; ?> ><?php echo _("Display airports on map"); ?></label></div></li>
486
+		    <li><div class="checkbox"><label><input type="checkbox" name="displayairports" value="1" onclick="clickDisplayAirports(this)" <?php if (isset($_COOKIE['displayairports']) && $_COOKIE['displayairports'] == 'true') {
487
+	print 'checked';
488
+}
489
+?> ><?php echo _("Display airports on map"); ?></label></div></li>
342 490
 <?php
343 491
     if (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d') {
344 492
 ?>
345
-		    <li><div class="checkbox"><label><input type="checkbox" name="displayminimap" value="1" onclick="clickDisplayMinimap(this)" <?php if (!isset($_COOKIE['displayminimap']) || (isset($_COOKIE['displayminimap']) && $_COOKIE['displayminimap'] == 'true')) print 'checked'; ?> ><?php echo _("Show mini-map"); ?></label></div></li>
493
+		    <li><div class="checkbox"><label><input type="checkbox" name="displayminimap" value="1" onclick="clickDisplayMinimap(this)" <?php if (!isset($_COOKIE['displayminimap']) || (isset($_COOKIE['displayminimap']) && $_COOKIE['displayminimap'] == 'true')) {
494
+	print 'checked';
495
+}
496
+?> ><?php echo _("Show mini-map"); ?></label></div></li>
346 497
 <?php
347 498
     }
348 499
     if (time() > mktime(0,0,0,12,1,date("Y")) && time() < mktime(0,0,0,12,31,date("Y"))) {
@@ -356,17 +507,25 @@  discard block
 block discarded – undo
356 507
 			if (function_exists('array_column')) {
357 508
 			    if (array_search(TRUE, array_column($globalSources, 'sourcestats')) !== FALSE) {
358 509
 		    ?>
359
-		    <li><div class="checkbox"><label><input type="checkbox" name="flightpolar" value="1" onclick="clickPolar(this)" <?php if ((isset($_COOKIE['polar']) && $_COOKIE['polar'] == 'true')) print 'checked'; ?> ><?php echo _("Display polar on map"); ?></label></div></li>
510
+		    <li><div class="checkbox"><label><input type="checkbox" name="flightpolar" value="1" onclick="clickPolar(this)" <?php if ((isset($_COOKIE['polar']) && $_COOKIE['polar'] == 'true')) {
511
+	print 'checked';
512
+}
513
+?> ><?php echo _("Display polar on map"); ?></label></div></li>
360 514
 		    <?php
361 515
 			    }
362 516
 			} elseif (isset($globalSources)) {
363 517
 			    $dispolar = false;
364 518
 			    foreach ($globalSources as $testsource) {
365
-			        if (isset($globalSources['sourcestats']) && $globalSources['sourcestats'] !== FALSE) $dispolar = true;
519
+			        if (isset($globalSources['sourcestats']) && $globalSources['sourcestats'] !== FALSE) {
520
+			        	$dispolar = true;
521
+			        }
366 522
 			    }
367 523
 			    if ($dispolar) {
368 524
 		    ?>
369
-		    <li><div class="checkbox"><label><input type="checkbox" name="flightpolar" value="1" onclick="clickPolar(this)" <?php if ((isset($_COOKIE['polar']) && $_COOKIE['polar'] == 'true')) print 'checked'; ?> ><?php echo _("Display polar on map"); ?></label></div></li>
525
+		    <li><div class="checkbox"><label><input type="checkbox" name="flightpolar" value="1" onclick="clickPolar(this)" <?php if ((isset($_COOKIE['polar']) && $_COOKIE['polar'] == 'true')) {
526
+	print 'checked';
527
+}
528
+?> ><?php echo _("Display polar on map"); ?></label></div></li>
370 529
 		    <?php
371 530
 			    }
372 531
 		        }
@@ -379,12 +538,22 @@  discard block
 block discarded – undo
379 538
 			if (!isset($globalAircraft) || $globalAircraft === TRUE) {
380 539
 		    	    if (extension_loaded('gd') && function_exists('gd_info')) {
381 540
 		    ?>
382
-		    <li><input type="checkbox" name="aircraftcoloraltitude" value="1" onclick="iconColorAltitude(this)" <?php if (isset($_COOKIE['IconColorAltitude']) && $_COOKIE['IconColorAltitude'] == 'true') print 'checked'; ?> ><?php echo _("Aircraft icon color based on altitude"); ?></li>
541
+		    <li><input type="checkbox" name="aircraftcoloraltitude" value="1" onclick="iconColorAltitude(this)" <?php if (isset($_COOKIE['IconColorAltitude']) && $_COOKIE['IconColorAltitude'] == 'true') {
542
+	print 'checked';
543
+}
544
+?> ><?php echo _("Aircraft icon color based on altitude"); ?></li>
383 545
 		    <?php 
384 546
 				if (!isset($_COOKIE['IconColorAltitude']) || $_COOKIE['IconColorAltitude'] == 'false') {
385 547
 		    ?>
386 548
 		    <li><?php echo _("Aircraft icon color:"); ?>
387
-			<input type="color" name="aircraftcolor" id="html5colorpicker" onchange="iconColor(aircraftcolor.value);" value="#<?php if (isset($_COOKIE['IconColor'])) print $_COOKIE['IconColor']; elseif (isset($globalAircraftIconColor)) print $globalAircraftIconColor; else print '1a3151'; ?>">
549
+			<input type="color" name="aircraftcolor" id="html5colorpicker" onchange="iconColor(aircraftcolor.value);" value="#<?php if (isset($_COOKIE['IconColor'])) {
550
+	print $_COOKIE['IconColor'];
551
+} elseif (isset($globalAircraftIconColor)) {
552
+	print $globalAircraftIconColor;
553
+} else {
554
+	print '1a3151';
555
+}
556
+?>">
388 557
 		    </li>
389 558
 		    <?php
390 559
 				}
@@ -396,7 +565,14 @@  discard block
 block discarded – undo
396 565
 			    if (extension_loaded('gd') && function_exists('gd_info')) {
397 566
 		    ?>
398 567
 		    <li><?php echo _("Marine icon color:"); ?>
399
-			<input type="color" name="marinecolor" id="html5colorpicker" onchange="iconColor(marinecolor.value);" value="#<?php if (isset($_COOKIE['MarineIconColor'])) print $_COOKIE['MarineIconColor']; elseif (isset($globalMarineIconColor)) print $globalMarineIconColor; else print '1a3151'; ?>">
568
+			<input type="color" name="marinecolor" id="html5colorpicker" onchange="iconColor(marinecolor.value);" value="#<?php if (isset($_COOKIE['MarineIconColor'])) {
569
+	print $_COOKIE['MarineIconColor'];
570
+} elseif (isset($globalMarineIconColor)) {
571
+	print $globalMarineIconColor;
572
+} else {
573
+	print '1a3151';
574
+}
575
+?>">
400 576
 		    </li>
401 577
 		    <?php
402 578
 			    }
@@ -407,8 +583,22 @@  discard block
 block discarded – undo
407 583
 		    ?>
408 584
 		    <li><?php echo _("Show airport icon at zoom level:"); ?>
409 585
 			<div class="range">
410
-			    <input type="range" min="0" max="19" step="1" name="airportzoom" onchange="range.value=value;airportDisplayZoom(airportzoom.value);" value="<?php if (isset($_COOKIE['AirportZoom'])) print $_COOKIE['AirportZoom']; elseif (isset($globalAirportZoom)) print $globalAirportZoom; else print '7'; ?>">
411
-			    <output id="range"><?php if (isset($_COOKIE['AirportZoom'])) print $_COOKIE['AirportZoom']; elseif (isset($globalAirportZoom)) print $globalAirportZoom; else print '7'; ?></output>
586
+			    <input type="range" min="0" max="19" step="1" name="airportzoom" onchange="range.value=value;airportDisplayZoom(airportzoom.value);" value="<?php if (isset($_COOKIE['AirportZoom'])) {
587
+	print $_COOKIE['AirportZoom'];
588
+} elseif (isset($globalAirportZoom)) {
589
+	print $globalAirportZoom;
590
+} else {
591
+	print '7';
592
+}
593
+?>">
594
+			    <output id="range"><?php if (isset($_COOKIE['AirportZoom'])) {
595
+	print $_COOKIE['AirportZoom'];
596
+} elseif (isset($globalAirportZoom)) {
597
+	print $globalAirportZoom;
598
+} else {
599
+	print '7';
600
+}
601
+?></output>
412 602
 			</div>
413 603
 		    </li>
414 604
 		    <?php
@@ -420,9 +610,19 @@  discard block
 block discarded – undo
420 610
 <?php
421 611
 	if (!isset($globalAircraft) || $globalAircraft === TRUE) {
422 612
 ?>
423
-		    <li><input type="checkbox" name="aircraftcolorforce" value="1" onclick="iconColorForce(this)" <?php if (isset($_COOKIE['IconColorForce']) && $_COOKIE['IconColorForce'] == 'true') print 'checked'; ?> ><?php echo _("Force Aircraft color"); ?></li>
613
+		    <li><input type="checkbox" name="aircraftcolorforce" value="1" onclick="iconColorForce(this)" <?php if (isset($_COOKIE['IconColorForce']) && $_COOKIE['IconColorForce'] == 'true') {
614
+	print 'checked';
615
+}
616
+?> ><?php echo _("Force Aircraft color"); ?></li>
424 617
 		    <li><?php echo _("Aircraft icon color:"); ?>
425
-			<input type="color" name="aircraftcolor" id="html5colorpicker" onchange="iconColor(aircraftcolor.value);" value="#<?php if (isset($_COOKIE['IconColor'])) print $_COOKIE['IconColor']; elseif (isset($globalAircraftIconColor)) print $globalAircraftIconColor; else print 'ff0000'; ?>">
618
+			<input type="color" name="aircraftcolor" id="html5colorpicker" onchange="iconColor(aircraftcolor.value);" value="#<?php if (isset($_COOKIE['IconColor'])) {
619
+	print $_COOKIE['IconColor'];
620
+} elseif (isset($globalAircraftIconColor)) {
621
+	print $globalAircraftIconColor;
622
+} else {
623
+	print 'ff0000';
624
+}
625
+?>">
426 626
 		    </li>
427 627
 <?php
428 628
 	}
@@ -430,9 +630,19 @@  discard block
 block discarded – undo
430 630
 <?php
431 631
 	if (isset($globalMarine) && $globalMarine === TRUE) {
432 632
 ?>
433
-		    <li><input type="checkbox" name="marinecolorforce" value="1" onclick="iconColorForce(this)" <?php if (isset($_COOKIE['MarineIconColorForce']) && $_COOKIE['MarineIconColorForce'] == 'true') print 'checked'; ?> ><?php echo _("Force Marine color"); ?></li>
633
+		    <li><input type="checkbox" name="marinecolorforce" value="1" onclick="iconColorForce(this)" <?php if (isset($_COOKIE['MarineIconColorForce']) && $_COOKIE['MarineIconColorForce'] == 'true') {
634
+	print 'checked';
635
+}
636
+?> ><?php echo _("Force Marine color"); ?></li>
434 637
 		    <li><?php echo _("Marine icon color:"); ?>
435
-			<input type="color" name="marinecolor" id="html5colorpicker" onchange="iconColor(marinecolor.value);" value="#<?php if (isset($_COOKIE['MarineIconColor'])) print $_COOKIE['MarineIconColor']; elseif (isset($globalMarineIconColor)) print $globalMarineIconColor; else print 'ff0000'; ?>">
638
+			<input type="color" name="marinecolor" id="html5colorpicker" onchange="iconColor(marinecolor.value);" value="#<?php if (isset($_COOKIE['MarineIconColor'])) {
639
+	print $_COOKIE['MarineIconColor'];
640
+} elseif (isset($globalMarineIconColor)) {
641
+	print $globalMarineIconColor;
642
+} else {
643
+	print 'ff0000';
644
+}
645
+?>">
436 646
 		    </li>
437 647
 <?php
438 648
 	}
@@ -440,22 +650,46 @@  discard block
 block discarded – undo
440 650
 ?>
441 651
 		    <li><?php echo _("Distance unit:"); ?>
442 652
 			<select class="selectpicker" onchange="unitdistance(this);">
443
-			    <option value="km"<?php if ((!isset($_COOKIE['unitdistance']) && (!isset($globalUnitDistance) || (isset($globalUnitDistance) && $globalUnitDistance == 'km'))) || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'km')) echo ' selected'; ?>>km</option>
444
-			    <option value="nm"<?php if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'nm') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'nm')) echo ' selected'; ?>>nm</option>
445
-			    <option value="mi"<?php if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'mi') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'mi')) echo ' selected'; ?>>mi</option>
653
+			    <option value="km"<?php if ((!isset($_COOKIE['unitdistance']) && (!isset($globalUnitDistance) || (isset($globalUnitDistance) && $globalUnitDistance == 'km'))) || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'km')) {
654
+	echo ' selected';
655
+}
656
+?>>km</option>
657
+			    <option value="nm"<?php if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'nm') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'nm')) {
658
+	echo ' selected';
659
+}
660
+?>>nm</option>
661
+			    <option value="mi"<?php if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'mi') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'mi')) {
662
+	echo ' selected';
663
+}
664
+?>>mi</option>
446 665
 		        </select>
447 666
 		    </li>
448 667
 		    <li><?php echo _("Altitude unit:"); ?>
449 668
 			<select class="selectpicker" onchange="unitaltitude(this);">
450
-			    <option value="m"<?php if ((!isset($_COOKIE['unitaltitude']) && (!isset($globalUnitAltitude) || (isset($globalUnitAltitude) && $globalUnitAltitude == 'm'))) || (isset($_COOKIE['unitaltitude']) && $_COOKIE['unitaltitude'] == 'm')) echo ' selected'; ?>>m</option>
451
-			    <option value="feet"<?php if ((!isset($_COOKIE['unitaltitude']) && isset($globalUnitAltitude) && $globalUnitAltitude == 'feet') || (isset($_COOKIE['unitaltitude']) && $_COOKIE['unitaltitude'] == 'feet')) echo ' selected'; ?>>feet</option>
669
+			    <option value="m"<?php if ((!isset($_COOKIE['unitaltitude']) && (!isset($globalUnitAltitude) || (isset($globalUnitAltitude) && $globalUnitAltitude == 'm'))) || (isset($_COOKIE['unitaltitude']) && $_COOKIE['unitaltitude'] == 'm')) {
670
+	echo ' selected';
671
+}
672
+?>>m</option>
673
+			    <option value="feet"<?php if ((!isset($_COOKIE['unitaltitude']) && isset($globalUnitAltitude) && $globalUnitAltitude == 'feet') || (isset($_COOKIE['unitaltitude']) && $_COOKIE['unitaltitude'] == 'feet')) {
674
+	echo ' selected';
675
+}
676
+?>>feet</option>
452 677
 		        </select>
453 678
 		    </li>
454 679
 		    <li><?php echo _("Speed unit:"); ?>
455 680
 			<select class="selectpicker" onchange="unitspeed(this);">
456
-			    <option value="kmh"<?php if ((!isset($_COOKIE['unitspeed']) && (!isset($globalUnitSpeed) || (isset($globalUnitSpeed) && $globalUnitSpeed == 'kmh'))) || (isset($_COOKIE['unitspeed']) && $_COOKIE['unitspeed'] == 'kmh')) echo ' selected'; ?>>km/h</option>
457
-			    <option value="mph"<?php if ((!isset($_COOKIE['unitspeed']) && isset($globalUnitSpeed) && $globalUnitSpeed == 'mph') || (isset($_COOKIE['unitspeed']) && $_COOKIE['unitspeed'] == 'mph')) echo ' selected'; ?>>mph</option>
458
-			    <option value="knots"<?php if ((!isset($_COOKIE['unitspeed']) && isset($globalUnitSpeed) && $globalUnitSpeed == 'knots') || (isset($_COOKIE['unitspeed']) && $_COOKIE['unitspeed'] == 'knots')) echo ' selected'; ?>>knots</option>
681
+			    <option value="kmh"<?php if ((!isset($_COOKIE['unitspeed']) && (!isset($globalUnitSpeed) || (isset($globalUnitSpeed) && $globalUnitSpeed == 'kmh'))) || (isset($_COOKIE['unitspeed']) && $_COOKIE['unitspeed'] == 'kmh')) {
682
+	echo ' selected';
683
+}
684
+?>>km/h</option>
685
+			    <option value="mph"<?php if ((!isset($_COOKIE['unitspeed']) && isset($globalUnitSpeed) && $globalUnitSpeed == 'mph') || (isset($_COOKIE['unitspeed']) && $_COOKIE['unitspeed'] == 'mph')) {
686
+	echo ' selected';
687
+}
688
+?>>mph</option>
689
+			    <option value="knots"<?php if ((!isset($_COOKIE['unitspeed']) && isset($globalUnitSpeed) && $globalUnitSpeed == 'knots') || (isset($_COOKIE['unitspeed']) && $_COOKIE['unitspeed'] == 'knots')) {
690
+	echo ' selected';
691
+}
692
+?>>knots</option>
459 693
 		        </select>
460 694
 		    </li>
461 695
 
@@ -473,9 +707,18 @@  discard block
 block discarded – undo
473 707
 		    <?php
474 708
 			if (((isset($globalVATSIM) && $globalVATSIM) || isset($globalIVAO) && $globalIVAO || isset($globalphpVMS) && $globalphpVMS) && (!isset($globalMapVAchoose) || $globalMapVAchoose)) {
475 709
 		    ?>
476
-			<?php if (isset($globalVATSIM) && $globalVATSIM) { ?><li><input type="checkbox" name="vatsim" value="1" onclick="clickVATSIM(this)" <?php if ((isset($_COOKIE['ShowVATSIM']) && $_COOKIE['ShowVATSIM'] == 'true') || !isset($_COOKIE['ShowVATSIM'])) print 'checked'; ?> ><?php echo _("Display VATSIM data"); ?></li><?php } ?>
477
-			<?php if (isset($globalIVAO) && $globalIVAO) { ?><li><input type="checkbox" name="ivao" value="1" onclick="clickIVAO(this)" <?php if ((isset($_COOKIE['ShowIVAO']) && $_COOKIE['ShowIVAO'] == 'true') || !isset($_COOKIE['ShowIVAO'])) print 'checked'; ?> ><?php echo _("Display IVAO data"); ?></li><?php } ?>
478
-			<?php if (isset($globalphpVMS) && $globalphpVMS) { ?><li><input type="checkbox" name="phpvms" value="1" onclick="clickphpVMS(this)" <?php if ((isset($_COOKIE['ShowVMS']) && $_COOKIE['ShowVMS'] == 'true') || !isset($_COOKIE['ShowVMS'])) print 'checked'; ?> ><?php echo _("Display phpVMS data"); ?></li><?php } ?>
710
+			<?php if (isset($globalVATSIM) && $globalVATSIM) { ?><li><input type="checkbox" name="vatsim" value="1" onclick="clickVATSIM(this)" <?php if ((isset($_COOKIE['ShowVATSIM']) && $_COOKIE['ShowVATSIM'] == 'true') || !isset($_COOKIE['ShowVATSIM'])) {
711
+	print 'checked';
712
+}
713
+?> ><?php echo _("Display VATSIM data"); ?></li><?php } ?>
714
+			<?php if (isset($globalIVAO) && $globalIVAO) { ?><li><input type="checkbox" name="ivao" value="1" onclick="clickIVAO(this)" <?php if ((isset($_COOKIE['ShowIVAO']) && $_COOKIE['ShowIVAO'] == 'true') || !isset($_COOKIE['ShowIVAO'])) {
715
+	print 'checked';
716
+}
717
+?> ><?php echo _("Display IVAO data"); ?></li><?php } ?>
718
+			<?php if (isset($globalphpVMS) && $globalphpVMS) { ?><li><input type="checkbox" name="phpvms" value="1" onclick="clickphpVMS(this)" <?php if ((isset($_COOKIE['ShowVMS']) && $_COOKIE['ShowVMS'] == 'true') || !isset($_COOKIE['ShowVMS'])) {
719
+	print 'checked';
720
+}
721
+?> ><?php echo _("Display phpVMS data"); ?></li><?php } ?>
479 722
 		    <?php
480 723
 			}
481 724
 		    ?>
@@ -483,10 +726,16 @@  discard block
 block discarded – undo
483 726
 			if (!(isset($globalVA) && $globalVA) && !(isset($globalVATSIM) && $globalVATSIM) && !(isset($globalIVAO) && $globalIVAO) && !(isset($globalphpVMS) && $globalphpVMS) && isset($globalSBS1) && $globalSBS1 && isset($globalAPRS) && $globalAPRS && (!isset($globalMapchoose) || $globalMapchoose)) {
484 727
 		    ?>
485 728
 			<?php if (isset($globalSBS1) && $globalSBS1) { ?>
486
-			    <li><div class="checkbox"><label><input type="checkbox" name="sbs" value="1" onclick="clickSBS1(this)" <?php if ((isset($_COOKIE['ShowSBS1']) && $_COOKIE['ShowSBS1'] == 'true') || !isset($_COOKIE['ShowSBS1'])) print 'checked'; ?> ><?php echo _("Display ADS-B data"); ?></label></div></li>
729
+			    <li><div class="checkbox"><label><input type="checkbox" name="sbs" value="1" onclick="clickSBS1(this)" <?php if ((isset($_COOKIE['ShowSBS1']) && $_COOKIE['ShowSBS1'] == 'true') || !isset($_COOKIE['ShowSBS1'])) {
730
+	print 'checked';
731
+}
732
+?> ><?php echo _("Display ADS-B data"); ?></label></div></li>
487 733
 			<?php } ?>
488 734
 			<?php if (isset($globalAPRS) && $globalAPRS) { ?>
489
-			    <li><div class="checkbox"><label><input type="checkbox" name="aprs" value="1" onclick="clickAPRS(this)" <?php if ((isset($_COOKIE['ShowAPRS']) && $_COOKIE['ShowAPRS'] == 'true') || !isset($_COOKIE['ShowAPRS'])) print 'checked'; ?> ><?php echo _("Display APRS data"); ?></label></div></li>
735
+			    <li><div class="checkbox"><label><input type="checkbox" name="aprs" value="1" onclick="clickAPRS(this)" <?php if ((isset($_COOKIE['ShowAPRS']) && $_COOKIE['ShowAPRS'] == 'true') || !isset($_COOKIE['ShowAPRS'])) {
736
+	print 'checked';
737
+}
738
+?> ><?php echo _("Display APRS data"); ?></label></div></li>
490 739
 			<?php } ?>
491 740
 		    <?php
492 741
 			}
@@ -503,7 +752,9 @@  discard block
 block discarded – undo
503 752
 				}
504 753
 				foreach($allairlinenames as $airline) {
505 754
 					$airline_name = $airline['airline_name'];
506
-					if (strlen($airline_name) > 30) $airline_name = substr($airline_name,0,30).'...';
755
+					if (strlen($airline_name) > 30) {
756
+						$airline_name = substr($airline_name,0,30).'...';
757
+					}
507 758
 					if (isset($_COOKIE['filter_Airlines']) && in_array($airline['airline_icao'],explode(',',$_COOKIE['filter_Airlines']))) {
508 759
 						echo '<option value="'.$airline['airline_icao'].'" selected>'.$airline_name.'</option>';
509 760
 					} else {
@@ -521,7 +772,10 @@  discard block
 block discarded – undo
521 772
 		    <li><?php echo _("Display alliance:"); ?>
522 773
 		    <br/>
523 774
 			<select class="selectpicker" onchange="alliance(this);" id="display_alliance">
524
-			    <option value="all"<?php if (!isset($_COOKIE['filter_alliance']) || $_COOKIE['filter_alliance'] == 'all' || $_COOKIE['filter_alliance'] == '') echo ' selected'; ?>><?php echo _("All"); ?></option>
775
+			    <option value="all"<?php if (!isset($_COOKIE['filter_alliance']) || $_COOKIE['filter_alliance'] == 'all' || $_COOKIE['filter_alliance'] == '') {
776
+	echo ' selected';
777
+}
778
+?>><?php echo _("All"); ?></option>
525 779
 			    <?php
526 780
 				foreach($allalliancenames as $alliance) {
527 781
 					$alliance_name = $alliance['alliance'];
@@ -568,10 +822,22 @@  discard block
 block discarded – undo
568 822
 		    ?>
569 823
 		    <li><?php echo _("Display airlines of type:"); ?><br/>
570 824
 			<select class="selectpicker" onchange="airlinestype(this);">
571
-			    <option value="all"<?php if (!isset($_COOKIE['filter_airlinestype']) || $_COOKIE['filter_airlinestype'] == 'all' || $_COOKIE['filter_airlinestype'] == '') echo ' selected'; ?>><?php echo _("All"); ?></option>
572
-			    <option value="passenger"<?php if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] == 'passenger') echo ' selected'; ?>><?php echo _("Passenger"); ?></option>
573
-			    <option value="cargo"<?php if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] == 'cargo') echo ' selected'; ?>><?php echo _("Cargo"); ?></option>
574
-			    <option value="military"<?php if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] == 'military') echo ' selected'; ?>><?php echo _("Military"); ?></option>
825
+			    <option value="all"<?php if (!isset($_COOKIE['filter_airlinestype']) || $_COOKIE['filter_airlinestype'] == 'all' || $_COOKIE['filter_airlinestype'] == '') {
826
+	echo ' selected';
827
+}
828
+?>><?php echo _("All"); ?></option>
829
+			    <option value="passenger"<?php if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] == 'passenger') {
830
+	echo ' selected';
831
+}
832
+?>><?php echo _("Passenger"); ?></option>
833
+			    <option value="cargo"<?php if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] == 'cargo') {
834
+	echo ' selected';
835
+}
836
+?>><?php echo _("Cargo"); ?></option>
837
+			    <option value="military"<?php if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] == 'military') {
838
+	echo ' selected';
839
+}
840
+?>><?php echo _("Military"); ?></option>
575 841
 			</select>
576 842
 		    </li>
577 843
 		    <?php
@@ -579,7 +845,10 @@  discard block
 block discarded – undo
579 845
 		    ?>
580 846
 		    <li>
581 847
 			<?php echo _("Display flight with ident:"); ?>
582
-			<input type="text" name="identfilter" onchange="identfilter();" id="identfilter" value="<?php if (isset($_COOKIE['filter_ident'])) print $_COOKIE['filter_ident']; ?>" />
848
+			<input type="text" name="identfilter" onchange="identfilter();" id="identfilter" value="<?php if (isset($_COOKIE['filter_ident'])) {
849
+	print $_COOKIE['filter_ident'];
850
+}
851
+?>" />
583 852
 		    </li>
584 853
 		    <?php
585 854
 			}
@@ -598,7 +867,10 @@  discard block
 block discarded – undo
598 867
 	    <h1 class="sidebar-header"><?php echo _("Satellites"); ?><span class="sidebar-close"><i class="fa fa-caret-left"></i></span></h1>
599 868
 	    <form>
600 869
 		<ul>
601
-		    <li><div class="checkbox"><label><input type="checkbox" name="displayiss" value="1" onclick="clickDisplayISS(this)" <?php if (isset($_COOKIE['displayiss']) && $_COOKIE['displayiss'] == 'true') print 'checked'; ?> ><?php echo _("Show ISS, Tiangong-1 and Tiangong-2 on map"); ?></label></div></li>
870
+		    <li><div class="checkbox"><label><input type="checkbox" name="displayiss" value="1" onclick="clickDisplayISS(this)" <?php if (isset($_COOKIE['displayiss']) && $_COOKIE['displayiss'] == 'true') {
871
+	print 'checked';
872
+}
873
+?> ><?php echo _("Show ISS, Tiangong-1 and Tiangong-2 on map"); ?></label></div></li>
602 874
 		    <li><?php echo _("Type:"); ?>
603 875
 			<select class="selectpicker" multiple onchange="sattypes(this);">
604 876
 			    <?php
@@ -606,25 +878,45 @@  discard block
 block discarded – undo
606 878
 				$types = $Satellite->get_tle_types();
607 879
 				foreach ($types as $type) {
608 880
 					$type_name = $type['tle_type'];
609
-					if ($type_name == 'musson') $type_name = 'Russian LEO Navigation';
610
-					else if ($type_name == 'nnss') $type_name = 'Navi Navigation Satellite System';
611
-					else if ($type_name == 'sbas') $type_name = 'Satellite-Based Augmentation System';
612
-					else if ($type_name == 'glo-ops') $type_name = 'Glonass Operational';
613
-					else if ($type_name == 'gps-ops') $type_name = 'GPS Operational';
614
-					else if ($type_name == 'argos') $type_name = 'ARGOS Data Collection System';
615
-					else if ($type_name == 'tdrss') $type_name = 'Tracking and Data Relay Satellite System';
616
-					else if ($type_name == 'sarsat') $type_name = 'Search & Rescue';
617
-					else if ($type_name == 'dmc') $type_name = 'Disaster Monitoring';
618
-					else if ($type_name == 'resource') $type_name = 'Earth Resources';
619
-					else if ($type_name == 'stations') $type_name = 'Space Stations';
620
-					else if ($type_name == 'geo') $type_name = 'Geostationary';
621
-					else if ($type_name == 'amateur') $type_name = 'Amateur Radio';
622
-					else if ($type_name == 'x-comm') $type_name = 'Experimental';
623
-					else if ($type_name == 'other-comm') $type_name = 'Other Comm';
624
-					else if ($type_name == 'science') $type_name = 'Space & Earth Science';
625
-					else if ($type_name == 'military') $type_name = 'Miscellaneous Military';
626
-					else if ($type_name == 'radar') $type_name = 'Radar Calibration';
627
-					else if ($type_name == 'tle-new') $type_name = 'Last 30 days launches';
881
+					if ($type_name == 'musson') {
882
+						$type_name = 'Russian LEO Navigation';
883
+					} else if ($type_name == 'nnss') {
884
+						$type_name = 'Navi Navigation Satellite System';
885
+					} else if ($type_name == 'sbas') {
886
+						$type_name = 'Satellite-Based Augmentation System';
887
+					} else if ($type_name == 'glo-ops') {
888
+						$type_name = 'Glonass Operational';
889
+					} else if ($type_name == 'gps-ops') {
890
+						$type_name = 'GPS Operational';
891
+					} else if ($type_name == 'argos') {
892
+						$type_name = 'ARGOS Data Collection System';
893
+					} else if ($type_name == 'tdrss') {
894
+						$type_name = 'Tracking and Data Relay Satellite System';
895
+					} else if ($type_name == 'sarsat') {
896
+						$type_name = 'Search & Rescue';
897
+					} else if ($type_name == 'dmc') {
898
+						$type_name = 'Disaster Monitoring';
899
+					} else if ($type_name == 'resource') {
900
+						$type_name = 'Earth Resources';
901
+					} else if ($type_name == 'stations') {
902
+						$type_name = 'Space Stations';
903
+					} else if ($type_name == 'geo') {
904
+						$type_name = 'Geostationary';
905
+					} else if ($type_name == 'amateur') {
906
+						$type_name = 'Amateur Radio';
907
+					} else if ($type_name == 'x-comm') {
908
+						$type_name = 'Experimental';
909
+					} else if ($type_name == 'other-comm') {
910
+						$type_name = 'Other Comm';
911
+					} else if ($type_name == 'science') {
912
+						$type_name = 'Space & Earth Science';
913
+					} else if ($type_name == 'military') {
914
+						$type_name = 'Miscellaneous Military';
915
+					} else if ($type_name == 'radar') {
916
+						$type_name = 'Radar Calibration';
917
+					} else if ($type_name == 'tle-new') {
918
+						$type_name = 'Last 30 days launches';
919
+					}
628 920
 					
629 921
 					if (isset($_COOKIE['sattypes']) && in_array($type['tle_type'],explode(',',$_COOKIE['sattypes']))) {
630 922
 						print '<option value="'.$type['tle_type'].'" selected>'.$type_name.'</option>';
Please login to merge, or discard this patch.
require/class.TrackerArchive.php 1 patch
Braces   +34 added lines, -12 removed lines patch added patch discarded remove patch
@@ -26,7 +26,9 @@  discard block
 block discarded – undo
26 26
 		if (isset($filter[0]['source'])) {
27 27
 			$filters = array_merge($filters,$filter);
28 28
 		}
29
-		if (is_array($globalFilter)) $filter = array_merge($filter,$globalFilter);
29
+		if (is_array($globalFilter)) {
30
+			$filter = array_merge($filter,$globalFilter);
31
+		}
30 32
 		$filter_query_join = '';
31 33
 		$filter_query_where = '';
32 34
 		foreach($filters as $flt) {
@@ -72,8 +74,11 @@  discard block
 block discarded – undo
72 74
 		if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) {
73 75
 			$filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')";
74 76
 		}
75
-		if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE';
76
-		elseif ($filter_query_where != '' && $and) $filter_query_where .= ' AND';
77
+		if ($filter_query_where == '' && $where) {
78
+			$filter_query_where = ' WHERE';
79
+		} elseif ($filter_query_where != '' && $and) {
80
+			$filter_query_where .= ' AND';
81
+		}
77 82
 		if ($filter_query_where != '') {
78 83
 			$filter_query_where = preg_replace('/^ AND/',' WHERE',$filter_query_where);
79 84
 		}
@@ -87,9 +92,14 @@  discard block
 block discarded – undo
87 92
 		if ($over_country == '') {
88 93
 			$Tracker = new Tracker($this->db);
89 94
 			$data_country = $Tracker->getCountryFromLatitudeLongitude($latitude,$longitude);
90
-			if (!empty($data_country)) $country = $data_country['iso2'];
91
-			else $country = '';
92
-		} else $country = $over_country;
95
+			if (!empty($data_country)) {
96
+				$country = $data_country['iso2'];
97
+			} else {
98
+				$country = '';
99
+			}
100
+		} else {
101
+			$country = $over_country;
102
+		}
93 103
 		// Route is not added in tracker_archive
94 104
 		$query  = 'INSERT INTO tracker_archive (famtrackid, ident, latitude, longitude, altitude, heading, ground_speed, date, format_source, source_name, over_country, comment, type) 
95 105
 		    VALUES (:famtrackid,:ident,:latitude,:longitude,:altitude,:heading,:groundspeed,:date,:format_source, :source_name, :over_country,:comment,:type)';
@@ -588,7 +598,9 @@  discard block
 block discarded – undo
588 598
 		    $additional_query .= "(tracker_archive_output.pilot_name like '%".$q_item."%') OR ";
589 599
 		    $additional_query .= "(tracker_archive_output.ident like '%".$q_item."%') OR ";
590 600
 		    $translate = $Translation->ident2icao($q_item);
591
-		    if ($translate != $q_item) $additional_query .= "(tracker_archive_output.ident like '%".$translate."%') OR ";
601
+		    if ($translate != $q_item) {
602
+		    	$additional_query .= "(tracker_archive_output.ident like '%".$translate."%') OR ";
603
+		    }
592 604
 		    $additional_query .= "(tracker_archive_output.highlight like '%".$q_item."%')";
593 605
 		    $additional_query .= ")";
594 606
 		}
@@ -806,7 +818,9 @@  discard block
 block discarded – undo
806 818
 		date_default_timezone_set($globalTimezone);
807 819
 		$datetime = new DateTime();
808 820
 		$offset = $datetime->format('P');
809
-	    } else $offset = '+00:00';
821
+	    } else {
822
+	    	$offset = '+00:00';
823
+	    }
810 824
 
811 825
 
812 826
 	    if ($date_array[1] != "")
@@ -1082,9 +1096,13 @@  discard block
 block discarded – undo
1082 1096
 				$query .= "AND date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
1083 1097
 			}
1084 1098
 		}
1085
-                if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
1099
+                if ($sincedate != '') {
1100
+                	$query .= "AND date > '".$sincedate."' ";
1101
+                }
1086 1102
 	$query .= "GROUP BY c.name, c.iso3, c.iso2 ORDER BY nb DESC";
1087
-	if ($limit) $query .= " LIMIT 0,10";
1103
+	if ($limit) {
1104
+		$query .= " LIMIT 0,10";
1105
+	}
1088 1106
       
1089 1107
 	
1090 1108
 	$sth = $this->db->prepare($query);
@@ -1128,9 +1146,13 @@  discard block
 block discarded – undo
1128 1146
 				$query .= "AND s.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
1129 1147
 			}
1130 1148
 		}
1131
-                if ($sincedate != '') $query .= "AND s.date > '".$sincedate."' ";
1149
+                if ($sincedate != '') {
1150
+                	$query .= "AND s.date > '".$sincedate."' ";
1151
+                }
1132 1152
 	$query .= "GROUP BY o.airline_icao,c.name, c.iso3, c.iso2 ORDER BY nb DESC";
1133
-	if ($limit) $query .= " LIMIT 0,10";
1153
+	if ($limit) {
1154
+		$query .= " LIMIT 0,10";
1155
+	}
1134 1156
       
1135 1157
 	
1136 1158
 	$sth = $this->db->prepare($query);
Please login to merge, or discard this patch.
require/class.MarineArchive.php 1 patch
Braces   +34 added lines, -12 removed lines patch added patch discarded remove patch
@@ -26,7 +26,9 @@  discard block
 block discarded – undo
26 26
 		if (isset($filter[0]['source'])) {
27 27
 			$filters = array_merge($filters,$filter);
28 28
 		}
29
-		if (is_array($globalFilter)) $filter = array_merge($filter,$globalFilter);
29
+		if (is_array($globalFilter)) {
30
+			$filter = array_merge($filter,$globalFilter);
31
+		}
30 32
 		$filter_query_join = '';
31 33
 		$filter_query_where = '';
32 34
 		foreach($filters as $flt) {
@@ -72,8 +74,11 @@  discard block
 block discarded – undo
72 74
 		if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) {
73 75
 			$filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')";
74 76
 		}
75
-		if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE';
76
-		elseif ($filter_query_where != '' && $and) $filter_query_where .= ' AND';
77
+		if ($filter_query_where == '' && $where) {
78
+			$filter_query_where = ' WHERE';
79
+		} elseif ($filter_query_where != '' && $and) {
80
+			$filter_query_where .= ' AND';
81
+		}
77 82
 		if ($filter_query_where != '') {
78 83
 			$filter_query_where = preg_replace('/^ AND/',' WHERE',$filter_query_where);
79 84
 		}
@@ -88,9 +93,14 @@  discard block
 block discarded – undo
88 93
 		if ($over_country == '') {
89 94
 			$Marine = new Marine($this->db);
90 95
 			$data_country = $Marine->getCountryFromLatitudeLongitude($latitude,$longitude);
91
-			if (!empty($data_country)) $country = $data_country['iso2'];
92
-			else $country = '';
93
-		} else $country = $over_country;
96
+			if (!empty($data_country)) {
97
+				$country = $data_country['iso2'];
98
+			} else {
99
+				$country = '';
100
+			}
101
+		} else {
102
+			$country = $over_country;
103
+		}
94 104
 		
95 105
 		//$country = $over_country;
96 106
 		// Route is not added in marine_archive
@@ -593,7 +603,9 @@  discard block
 block discarded – undo
593 603
 		    $additional_query .= "(marine_archive_output.pilot_name like '%".$q_item."%') OR ";
594 604
 		    $additional_query .= "(marine_archive_output.ident like '%".$q_item."%') OR ";
595 605
 		    $translate = $Translation->ident2icao($q_item);
596
-		    if ($translate != $q_item) $additional_query .= "(marine_archive_output.ident like '%".$translate."%') OR ";
606
+		    if ($translate != $q_item) {
607
+		    	$additional_query .= "(marine_archive_output.ident like '%".$translate."%') OR ";
608
+		    }
597 609
 		    $additional_query .= "(marine_archive_output.highlight like '%".$q_item."%')";
598 610
 		    $additional_query .= ")";
599 611
 		}
@@ -811,7 +823,9 @@  discard block
 block discarded – undo
811 823
 		date_default_timezone_set($globalTimezone);
812 824
 		$datetime = new DateTime();
813 825
 		$offset = $datetime->format('P');
814
-	    } else $offset = '+00:00';
826
+	    } else {
827
+	    	$offset = '+00:00';
828
+	    }
815 829
 
816 830
 
817 831
 	    if ($date_array[1] != "")
@@ -1087,9 +1101,13 @@  discard block
 block discarded – undo
1087 1101
 				$query .= "AND date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
1088 1102
 			}
1089 1103
 		}
1090
-                if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
1104
+                if ($sincedate != '') {
1105
+                	$query .= "AND date > '".$sincedate."' ";
1106
+                }
1091 1107
 	$query .= "GROUP BY c.name, c.iso3, c.iso2 ORDER BY nb DESC";
1092
-	if ($limit) $query .= " LIMIT 0,10";
1108
+	if ($limit) {
1109
+		$query .= " LIMIT 0,10";
1110
+	}
1093 1111
       
1094 1112
 	
1095 1113
 	$sth = $this->db->prepare($query);
@@ -1133,9 +1151,13 @@  discard block
 block discarded – undo
1133 1151
 				$query .= "AND s.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
1134 1152
 			}
1135 1153
 		}
1136
-                if ($sincedate != '') $query .= "AND s.date > '".$sincedate."' ";
1154
+                if ($sincedate != '') {
1155
+                	$query .= "AND s.date > '".$sincedate."' ";
1156
+                }
1137 1157
 	$query .= "GROUP BY o.airline_icao,c.name, c.iso3, c.iso2 ORDER BY nb DESC";
1138
-	if ($limit) $query .= " LIMIT 0,10";
1158
+	if ($limit) {
1159
+		$query .= " LIMIT 0,10";
1160
+	}
1139 1161
       
1140 1162
 	
1141 1163
 	$sth = $this->db->prepare($query);
Please login to merge, or discard this patch.
statistics-date.php 1 patch
Braces   +21 added lines, -9 removed lines patch added patch discarded remove patch
@@ -16,11 +16,15 @@  discard block
 block discarded – undo
16 16
 	$Tracker = new Tracker();
17 17
 }
18 18
 
19
-if (!isset($filter_name)) $filter_name = '';
19
+if (!isset($filter_name)) {
20
+	$filter_name = '';
21
+}
20 22
 $airline_icao = (string)filter_input(INPUT_GET,'airline',FILTER_SANITIZE_STRING);
21 23
 if ($airline_icao == '' && isset($globalFilter)) {
22
-    if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0];
23
-}
24
+    if (isset($globalFilter['airline'])) {
25
+    	$airline_icao = $globalFilter['airline'][0];
26
+    }
27
+    }
24 28
 
25 29
 require_once('header.php');
26 30
 include('statistics-sub-menu.php'); 
@@ -33,9 +37,13 @@  discard block
 block discarded – undo
33 37
 	  </div>
34 38
       <p>'._("Below is a chart that plots the busiest day during the <strong>last 7 days</strong>.").'</p>';
35 39
 
36
-if ($type == 'aircraft') $date_array = $Stats->countAllDatesLast7Days($airline_icao,$filter_name);
37
-elseif ($type == 'marine') $date_array = $Marine->countAllDatesLast7Days();
38
-elseif ($type == 'tracker') $date_array = $Tracker->countAllDatesLast7Days();
40
+if ($type == 'aircraft') {
41
+	$date_array = $Stats->countAllDatesLast7Days($airline_icao,$filter_name);
42
+} elseif ($type == 'marine') {
43
+	$date_array = $Marine->countAllDatesLast7Days();
44
+} elseif ($type == 'tracker') {
45
+	$date_array = $Tracker->countAllDatesLast7Days();
46
+}
39 47
 if (count($date_array) == 0) {
40 48
 	print _("No data available");
41 49
 } else {
@@ -61,9 +69,13 @@  discard block
 block discarded – undo
61 69
 } else {
62 70
 	print '<p>'._("Below are the <strong>Top 10</strong> most busiest dates.").'</p>';
63 71
 }
64
-if ($type == 'aircraft') $date_array = $Stats->countAllDates($airline_icao,$filter_name);
65
-elseif ($type == 'marine') $date_array = $Marine->countAllDates();
66
-elseif ($type == 'tracker') $date_array = $Tracker->countAllDates();
72
+if ($type == 'aircraft') {
73
+	$date_array = $Stats->countAllDates($airline_icao,$filter_name);
74
+} elseif ($type == 'marine') {
75
+	$date_array = $Marine->countAllDates();
76
+} elseif ($type == 'tracker') {
77
+	$date_array = $Tracker->countAllDates();
78
+}
67 79
 if (!empty($date_array))
68 80
 {
69 81
 	print '<div class="table-responsive">';
Please login to merge, or discard this patch.