Completed
Push — master ( 87b863...3be42e )
by Yannick
104:15 queued 75:58
created
header.php 1 patch
Braces   +95 added lines, -22 removed lines patch added patch discarded remove patch
@@ -6,12 +6,19 @@  discard block
 block discarded – undo
6 6
 //gets the page file and stores it in a variable
7 7
 $file_path = pathinfo($_SERVER['SCRIPT_NAME']);
8 8
 $current_page = $file_path['filename'];
9
-if ($globalTimezone == '') $globalTimezone = 'UTC';
9
+if ($globalTimezone == '') {
10
+	$globalTimezone = 'UTC';
11
+}
10 12
 date_default_timezone_set($globalTimezone);
11
-if (isset($_COOKIE['MapType']) && $_COOKIE['MapType'] != '') $MapType = $_COOKIE['MapType'];
12
-else $MapType = $globalMapProvider;
13
+if (isset($_COOKIE['MapType']) && $_COOKIE['MapType'] != '') {
14
+	$MapType = $_COOKIE['MapType'];
15
+} else {
16
+	$MapType = $globalMapProvider;
17
+}
13 18
 
14
-if (isset($globalMapOffline) && $globalMapOffline) $MapType = 'offline';
19
+if (isset($globalMapOffline) && $globalMapOffline) {
20
+	$MapType = 'offline';
21
+}
15 22
 
16 23
 if (isset($_GET['3d'])) {
17 24
 	setcookie('MapFormat','3d');
@@ -204,7 +211,10 @@  discard block
 block discarded – undo
204 211
 <?php
205 212
 		} else {
206 213
 ?>
207
-<script src="<?php print $globalURL; ?>/js/map.2d.js.php?<?php print time(); ?><?php if (isset($tsk)) print '&tsk='.$tsk; ?>"></script>
214
+<script src="<?php print $globalURL; ?>/js/map.2d.js.php?<?php print time(); ?><?php if (isset($tsk)) {
215
+	print '&tsk='.$tsk;
216
+}
217
+?>"></script>
208 218
 <?php
209 219
 		}
210 220
 		if (!isset($globalAircraft) || $globalAircraft) {
@@ -244,7 +254,13 @@  discard block
 block discarded – undo
244 254
 <script src="<?php print $globalURL; ?>/js/MovingMarker.js"></script>
245 255
 <script src="<?php print $globalURL; ?>/js/jquery.idle.min.js"></script>
246 256
 <script src="<?php print $globalURL; ?>/js/map.common.js"></script>
247
-<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>
257
+<script src="<?php print $globalURL; ?>/js/map.2d.js.php?ident=<?php print $ident; ?><?php if(isset($latitude)) {
258
+	print '&latitude='.$latitude;
259
+}
260
+?><?php if(isset($longitude)) {
261
+	print '&longitude='.$longitude;
262
+}
263
+?>&<?php print time(); ?>"></script>
248 264
 <?php
249 265
 		if (!isset($type) || $type == 'aircraft') {
250 266
 ?>
@@ -317,7 +333,13 @@  discard block
 block discarded – undo
317 333
 <script src="<?php print $globalURL; ?>/js/MovingMarker.js"></script>
318 334
 <script src="<?php print $globalURL; ?>/js/jquery.idle.min.js"></script>
319 335
 <script src="<?php print $globalURL; ?>/js/map.common.js"></script>
320
-<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>
336
+<script src="<?php print $globalURL; ?>/js/map.2d.js.php?flightaware_id=<?php print $flightaware_id; ?><?php if(isset($latitude)) {
337
+	print '&latitude='.$latitude;
338
+}
339
+?><?php if(isset($longitude)) {
340
+	print '&longitude='.$longitude;
341
+}
342
+?>&<?php print time(); ?>"></script>
321 343
 <script src="<?php print $globalURL; ?>/js/map-aircraft.2d.js.php?flightaware_id=<?php print $flightaware_id; ?>&<?php print time(); ?>"></script>
322 344
 <?php
323 345
 		if (isset($globalGoogleAPIKey) && $globalGoogleAPIKey != '' && ($MapType == 'Google-Roadmap' || $MapType == 'Google-Satellite' || $MapType == 'Google-Hybrid' || $MapType == 'Google-Terrain')) {
@@ -398,7 +420,12 @@  discard block
 block discarded – undo
398 420
         <span class="icon-bar"></span>
399 421
       </button>
400 422
       <a href="<?php print $globalURL; ?>/search" class="navbar-toggle search"><i class="fa fa-search"></i></a>
401
-      <a class="navbar-brand" href="<?php if ($globalURL == '') print '/'; else print $globalURL; ?>"><img src="<?php print $globalURL.$logoURL; ?>" height="30px" /></a>
423
+      <a class="navbar-brand" href="<?php if ($globalURL == '') {
424
+	print '/';
425
+} else {
426
+	print $globalURL;
427
+}
428
+?>"><img src="<?php print $globalURL.$logoURL; ?>" height="30px" /></a>
402 429
     </div>
403 430
     <div class="collapse navbar-collapse">
404 431
 
@@ -453,7 +480,10 @@  discard block
 block discarded – undo
453 480
 	}
454 481
 ?>
455 482
 
456
-          <a href="#" class="dropdown-toggle" data-toggle="dropdown"><?php echo _("Explore"); ?> <b class="<?php if ($sub) echo 'right-'; ?>caret"></b></a>
483
+          <a href="#" class="dropdown-toggle" data-toggle="dropdown"><?php echo _("Explore"); ?> <b class="<?php if ($sub) {
484
+	echo 'right-';
485
+}
486
+?>caret"></b></a>
457 487
           <ul class="dropdown-menu">
458 488
           	<li><a href="<?php print $globalURL; ?>/aircraft"><?php echo _("Aircraft Types"); ?></a></li>
459 489
 <?php
@@ -524,8 +554,14 @@  discard block
 block discarded – undo
524 554
         </li>
525 555
       	<li><a href="<?php print $globalURL; ?>/search"><?php echo _("Search"); ?></a></li>
526 556
       	<li><a href="<?php print $globalURL; ?>/statistics"><?php echo _("Statistics"); ?></a></li>
527
-        <li class="dropdown<?php if ($sub) echo '-submenu'; ?>">
528
-          <a href="#" class="dropdown-toggle" data-toggle="dropdown"><?php echo _("Tools"); ?> <b class="<?php if ($sub) echo 'right-'; ?>caret"></b></a>
557
+        <li class="dropdown<?php if ($sub) {
558
+	echo '-submenu';
559
+}
560
+?>">
561
+          <a href="#" class="dropdown-toggle" data-toggle="dropdown"><?php echo _("Tools"); ?> <b class="<?php if ($sub) {
562
+	echo 'right-';
563
+}
564
+?>caret"></b></a>
529 565
           <ul class="dropdown-menu">
530 566
           	<li><a href="<?php print $globalURL; ?>/tools/acars"><?php echo _("ACARS translator"); ?></a></li>
531 567
           	<li><a href="<?php print $globalURL; ?>/tools/metar"><?php echo _("METAR translator"); ?></a></li>
@@ -569,7 +605,10 @@  discard block
 block discarded – undo
569 605
 <?php
570 606
 	}
571 607
 ?>
572
-		<a href="#" class="dropdown-toggle" data-toggle="dropdown"><?php echo _("Explore"); ?> <b class="<?php if ($sub) echo 'right-'; ?>caret"></b></a>
608
+		<a href="#" class="dropdown-toggle" data-toggle="dropdown"><?php echo _("Explore"); ?> <b class="<?php if ($sub) {
609
+	echo 'right-';
610
+}
611
+?>caret"></b></a>
573 612
 		<ul class="dropdown-menu">
574 613
 		    <li><a href="<?php print $globalURL; ?>/marine/currently"><?php echo _("Current Activity"); ?></a></li>
575 614
 		    <li><a href="<?php print $globalURL; ?>/marine/latest"><?php echo _("Latest Activity"); ?></a></li>
@@ -610,7 +649,10 @@  discard block
 block discarded – undo
610 649
 <?php
611 650
 	}
612 651
 ?>
613
-		<a href="#" class="dropdown-toggle" data-toggle="dropdown"><?php echo _("Explore"); ?> <b class="<?php if ($sub) echo 'right-'; ?>caret"></b></a>
652
+		<a href="#" class="dropdown-toggle" data-toggle="dropdown"><?php echo _("Explore"); ?> <b class="<?php if ($sub) {
653
+	echo 'right-';
654
+}
655
+?>caret"></b></a>
614 656
 		<ul class="dropdown-menu">
615 657
 		    <li><a href="<?php print $globalURL; ?>/tracker/currently"><?php echo _("Current Activity"); ?></a></li>
616 658
 		    <li><a href="<?php print $globalURL; ?>/tracker/latest"><?php echo _("Latest Activity"); ?></a></li>
@@ -653,7 +695,10 @@  discard block
 block discarded – undo
653 695
 ?>
654 696
 
655 697
 <!--
656
-		<a href="#" class="dropdown-toggle" data-toggle="dropdown"><?php echo _("Explore"); ?> <b class="<?php if ($sub) echo 'right-'; ?>caret"></b></a>
698
+		<a href="#" class="dropdown-toggle" data-toggle="dropdown"><?php echo _("Explore"); ?> <b class="<?php if ($sub) {
699
+	echo 'right-';
700
+}
701
+?>caret"></b></a>
657 702
 		<ul class="dropdown-menu">
658 703
 		    <li><a href="<?php print $globalURL; ?>/satellite/currently"><?php echo _("Current Activity"); ?></a></li>
659 704
 		    <li><a href="<?php print $globalURL; ?>/satellite/latest"><?php echo _("Latest Activity"); ?></a></li>
@@ -711,9 +756,14 @@  discard block
 block discarded – undo
711 756
   		    <?php
712 757
   		        foreach ($alllang as $key => $lang) {
713 758
   		            print '<option value="'.$key.'"';
714
-  		            if (isset($_COOKIE['language']) && $_COOKIE['language'] == $key) print ' selected ';
715
-  		            if ($lang[0] == 'Deutsch') print '>'.$lang[0].' (&beta;eta)</option>';
716
-  		            else print '>'.$lang[0].'</option>';
759
+  		            if (isset($_COOKIE['language']) && $_COOKIE['language'] == $key) {
760
+  		            	print ' selected ';
761
+  		            }
762
+  		            if ($lang[0] == 'Deutsch') {
763
+  		            	print '>'.$lang[0].' (&beta;eta)</option>';
764
+  		            } else {
765
+  		            	print '>'.$lang[0].'</option>';
766
+  		            }
717 767
   		        }
718 768
   		    ?>
719 769
   		</select>
@@ -861,9 +911,24 @@  discard block
 block discarded – undo
861 911
 	$customid = $globalMapProvider;
862 912
 ?>
863 913
     L.tileLayer('<?php print $globalMapCustomLayer[$customid]['url']; ?>/{z}/{x}/{y}.png', {
864
-        maxZoom: <?php if (isset($globalMapCustomLayer[$customid]['maxZoom'])) print $globalMapCustomLayer[$customid]['maxZoom']; else print '18'; ?>,
865
-        minZoom: <?php if (isset($globalMapCustomLayer[$customid]['minZoom'])) print $globalMapCustomLayer[$customid]['minZoom']; else print '0'; ?>,
866
-        noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) print 'false'; else print 'true'; ?>,
914
+        maxZoom: <?php if (isset($globalMapCustomLayer[$customid]['maxZoom'])) {
915
+	print $globalMapCustomLayer[$customid]['maxZoom'];
916
+} else {
917
+	print '18';
918
+}
919
+?>,
920
+        minZoom: <?php if (isset($globalMapCustomLayer[$customid]['minZoom'])) {
921
+	print $globalMapCustomLayer[$customid]['minZoom'];
922
+} else {
923
+	print '0';
924
+}
925
+?>,
926
+        noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) {
927
+	print 'false';
928
+} else {
929
+	print 'true';
930
+}
931
+?>,
867 932
         attribution: '<?php print $globalMapCustomLayer[$customid]['attribution']; ?>'
868 933
     }).addTo(map);
869 934
 <?php
@@ -878,7 +943,12 @@  discard block
 block discarded – undo
878 943
         maxZoom: 5,
879 944
         tms : true,
880 945
         zindex : 3,
881
-        noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) print 'false'; else print 'true'; ?>,
946
+        noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) {
947
+	print 'false';
948
+} else {
949
+	print 'true';
950
+}
951
+?>,
882 952
         attribution: 'Natural Earth'
883 953
     }).addTo(map);
884 954
 <?php
@@ -901,4 +971,7 @@  discard block
 block discarded – undo
901 971
 
902 972
 ?>
903 973
 
904
-<section class="container main-content <?php if (strtolower($current_page) == 'index') print 'index '; ?>clear">
974
+<section class="container main-content <?php if (strtolower($current_page) == 'index') {
975
+	print 'index ';
976
+}
977
+?>clear">
Please login to merge, or discard this patch.
scripts/daemon-spotter.php 1 patch
Braces   +1192 added lines, -400 removed lines patch added patch discarded remove patch
@@ -14,13 +14,17 @@  discard block
 block discarded – undo
14 14
 require_once(dirname(__FILE__).'/../require/class.Source.php');
15 15
 require_once(dirname(__FILE__).'/../require/class.Connection.php');
16 16
 require_once(dirname(__FILE__).'/../require/class.Common.php');
17
-if (isset($globalTracker) && $globalTracker) require_once(dirname(__FILE__).'/../require/class.TrackerImport.php');
17
+if (isset($globalTracker) && $globalTracker) {
18
+	require_once(dirname(__FILE__).'/../require/class.TrackerImport.php');
19
+}
18 20
 if (isset($globalMarine) && $globalMarine) {
19 21
     require_once(dirname(__FILE__).'/../require/class.AIS.php');
20 22
     require_once(dirname(__FILE__).'/../require/class.MarineImport.php');
21 23
 }
22 24
 
23
-if (!isset($globalDebug)) $globalDebug = FALSE;
25
+if (!isset($globalDebug)) {
26
+	$globalDebug = FALSE;
27
+}
24 28
 
25 29
 // Check if schema is at latest version
26 30
 $Connection = new Connection();
@@ -59,66 +63,107 @@  discard block
 block discarded – undo
59 63
 //elseif (isset($options['source'])) $hosts = array($options['source']);
60 64
 if (isset($options['s'])) {
61 65
     $globalSources = array();
62
-    if (isset($options['format'])) $globalSources[] = array('host' => $options['s'],'format' => $options['format']);
63
-    else $globalSources[] = array('host' => $options['s']);
64
-} elseif (isset($options['source'])) {
66
+    if (isset($options['format'])) {
67
+    	$globalSources[] = array('host' => $options['s'],'format' => $options['format']);
68
+    } else {
69
+    	$globalSources[] = array('host' => $options['s']);
70
+    }
71
+    } elseif (isset($options['source'])) {
65 72
     $globalSources = array();
66
-    if (isset($options['format'])) $globalSources[] = array('host' => $options['source'],'format' => $options['format']);
67
-    else $globalSources[] = array('host' => $options['source']);
68
-}
73
+    if (isset($options['format'])) {
74
+    	$globalSources[] = array('host' => $options['source'],'format' => $options['format']);
75
+    } else {
76
+    	$globalSources[] = array('host' => $options['source']);
77
+    }
78
+    }
69 79
 if (isset($options['aprsserverhost'])) {
70 80
 	$globalServerAPRS = TRUE;
71 81
 	$globalServerAPRShost = $options['aprsserverhost'];
72 82
 }
73
-if (isset($options['aprsserverport'])) $globalServerAPRSport = $options['aprsserverport'];
74
-if (isset($options['aprsserverssid'])) $globalServerAPRSssid = $options['aprsserverssid'];
75
-if (isset($options['aprsserverpass'])) $globalServerAPRSpass = $options['aprsserverpass'];
76
-if (isset($options['noaprsserver'])) $globalServerAPRS = FALSE; 
83
+if (isset($options['aprsserverport'])) {
84
+	$globalServerAPRSport = $options['aprsserverport'];
85
+}
86
+if (isset($options['aprsserverssid'])) {
87
+	$globalServerAPRSssid = $options['aprsserverssid'];
88
+}
89
+if (isset($options['aprsserverpass'])) {
90
+	$globalServerAPRSpass = $options['aprsserverpass'];
91
+}
92
+if (isset($options['noaprsserver'])) {
93
+	$globalServerAPRS = FALSE;
94
+}
77 95
 if (isset($options['enable-aircraft'])) {
78
-	if ($globalDebug) echo 'Enable Aircraft mode'."\n";
96
+	if ($globalDebug) {
97
+		echo 'Enable Aircraft mode'."\n";
98
+	}
79 99
 	$globalAircraft = TRUE; 
80 100
 }
81 101
 if (isset($options['disable-aircraft'])) {
82
-	if ($globalDebug) echo 'Disable Aircraft mode'."\n";
102
+	if ($globalDebug) {
103
+		echo 'Disable Aircraft mode'."\n";
104
+	}
83 105
 	$globalAircraft = FALSE;
84 106
 }
85 107
 if (isset($options['enable-tracker'])) {
86
-	if ($globalDebug) echo 'Enable Tracker mode'."\n";
108
+	if ($globalDebug) {
109
+		echo 'Enable Tracker mode'."\n";
110
+	}
87 111
 	$globalTracker = TRUE; 
88 112
 }
89 113
 if (isset($options['disable-tracker'])) {
90
-	if ($globalDebug) echo 'Disable Tracker mode'."\n";
114
+	if ($globalDebug) {
115
+		echo 'Disable Tracker mode'."\n";
116
+	}
91 117
 	$globalTracker = FALSE;
92 118
 }
93 119
 if (isset($options['enable-marine'])) {
94
-	if ($globalDebug) echo 'Enable Marine mode'."\n";
120
+	if ($globalDebug) {
121
+		echo 'Enable Marine mode'."\n";
122
+	}
95 123
 	$globalMarine = TRUE;
96 124
 }
97 125
 if (isset($options['disable-marine'])) {
98
-	if ($globalDebug) echo 'Disable Marine mode'."\n";
126
+	if ($globalDebug) {
127
+		echo 'Disable Marine mode'."\n";
128
+	}
99 129
 	$globalMarine = FALSE;
100 130
 }
101
-if (isset($options['nodaemon'])) $globalDaemon = FALSE;
102
-if (isset($options['server'])) $globalServer = TRUE;
103
-if (isset($options['idsource'])) $id_source = $options['idsource'];
104
-else $id_source = 1;
131
+if (isset($options['nodaemon'])) {
132
+	$globalDaemon = FALSE;
133
+}
134
+if (isset($options['server'])) {
135
+	$globalServer = TRUE;
136
+}
137
+if (isset($options['idsource'])) {
138
+	$id_source = $options['idsource'];
139
+} else {
140
+	$id_source = 1;
141
+}
105 142
 if (isset($globalServer) && $globalServer) {
106
-    if ($globalDebug) echo "Using Server Mode\n";
143
+    if ($globalDebug) {
144
+    	echo "Using Server Mode\n";
145
+    }
107 146
     $SI=new SpotterServer();
108 147
 /*
109 148
     require_once(dirname(__FILE__).'/../require/class.APRS.php');
110 149
     $SI = new adsb2aprs();
111 150
     $SI->connect();
112 151
 */
113
-} else $SI=new SpotterImport($Connection->db);
152
+} else {
153
+	$SI=new SpotterImport($Connection->db);
154
+}
114 155
 
115
-if (isset($globalTracker) && $globalTracker) require_once(dirname(__FILE__).'/../require/class.TrackerImport.php');
156
+if (isset($globalTracker) && $globalTracker) {
157
+	require_once(dirname(__FILE__).'/../require/class.TrackerImport.php');
158
+}
116 159
 if (isset($globalMarine) && $globalMarine) {
117 160
     require_once(dirname(__FILE__).'/../require/class.AIS.php');
118 161
     require_once(dirname(__FILE__).'/../require/class.MarineImport.php');
119 162
 }
120 163
 
121
-if (isset($globalTracker) && $globalTracker) $TI = new TrackerImport($Connection->db);
164
+if (isset($globalTracker) && $globalTracker) {
165
+	$TI = new TrackerImport($Connection->db);
166
+}
122 167
 if (isset($globalMarine) && $globalMarine) {
123 168
     $AIS = new AIS();
124 169
     $MI = new MarineImport($Connection->db);
@@ -143,7 +188,9 @@  discard block
 block discarded – undo
143 188
 }
144 189
 
145 190
 // let's try and connect
146
-if ($globalDebug) echo "Connecting...\n";
191
+if ($globalDebug) {
192
+	echo "Connecting...\n";
193
+}
147 194
 $use_aprs = false;
148 195
 $aprs_full = false;
149 196
 $reset = 0;
@@ -152,7 +199,9 @@  discard block
 block discarded – undo
152 199
     //global $sockets, $formats, $globalDebug,$aprs_connect,$last_exec, $globalSourcesRights, $use_aprs;
153 200
     global $sockets,$httpfeeds, $globalSources, $globalDebug,$aprs_connect,$last_exec, $globalSourcesRights, $use_aprs, $reset,$context;
154 201
     $reset++;
155
-    if ($globalDebug) echo 'Connect to all...'."\n";
202
+    if ($globalDebug) {
203
+    	echo 'Connect to all...'."\n";
204
+    }
156 205
     foreach ($hosts as $id => $value) {
157 206
 	$host = $value['host'];
158 207
 	$globalSources[$id]['last_exec'] = 0;
@@ -162,32 +211,44 @@  discard block
 block discarded – undo
162 211
         	//$formats[$id] = 'deltadbtxt';
163 212
         	$globalSources[$id]['format'] = 'deltadbtxt';
164 213
         	//$last_exec['deltadbtxt'] = 0;
165
-        	if ($globalDebug) echo "Connect to deltadb source (".$host.")...\n";
214
+        	if ($globalDebug) {
215
+        		echo "Connect to deltadb source (".$host.")...\n";
216
+        	}
166 217
             } else if (preg_match('/vatsim-data.txt$/i',$host)) {
167 218
         	//$formats[$id] = 'vatsimtxt';
168 219
         	$globalSources[$id]['format'] = 'vatsimtxt';
169 220
         	//$last_exec['vatsimtxt'] = 0;
170
-        	if ($globalDebug) echo "Connect to vatsim source (".$host.")...\n";
221
+        	if ($globalDebug) {
222
+        		echo "Connect to vatsim source (".$host.")...\n";
223
+        	}
171 224
     	    } else if (preg_match('/aircraftlist.json$/i',$host)) {
172 225
         	//$formats[$id] = 'aircraftlistjson';
173 226
         	$globalSources[$id]['format'] = 'aircraftlistjson';
174 227
         	//$last_exec['aircraftlistjson'] = 0;
175
-        	if ($globalDebug) echo "Connect to aircraftlist.json source (".$host.")...\n";
228
+        	if ($globalDebug) {
229
+        		echo "Connect to aircraftlist.json source (".$host.")...\n";
230
+        	}
176 231
     	    } else if (preg_match('/aircraft.json$/i',$host)) {
177 232
         	//$formats[$id] = 'aircraftjson';
178 233
         	$globalSources[$id]['format'] = 'aircraftjson';
179 234
         	//$last_exec['aircraftlistjson'] = 0;
180
-        	if ($globalDebug) echo "Connect to aircraft.json source (".$host.")...\n";
235
+        	if ($globalDebug) {
236
+        		echo "Connect to aircraft.json source (".$host.")...\n";
237
+        	}
181 238
     	    } else if (preg_match('/aircraft$/i',$host)) {
182 239
         	//$formats[$id] = 'planefinderclient';
183 240
         	$globalSources[$id]['format'] = 'planefinderclient';
184 241
         	//$last_exec['aircraftlistjson'] = 0;
185
-        	if ($globalDebug) echo "Connect to planefinderclient source (".$host.")...\n";
242
+        	if ($globalDebug) {
243
+        		echo "Connect to planefinderclient source (".$host.")...\n";
244
+        	}
186 245
     	    } else if (preg_match('/opensky/i',$host)) {
187 246
         	//$formats[$id] = 'aircraftlistjson';
188 247
         	$globalSources[$id]['format'] = 'opensky';
189 248
         	//$last_exec['aircraftlistjson'] = 0;
190
-        	if ($globalDebug) echo "Connect to opensky source (".$host.")...\n";
249
+        	if ($globalDebug) {
250
+        		echo "Connect to opensky source (".$host.")...\n";
251
+        	}
191 252
     	    /*
192 253
     	    // Disabled for now, site change source format
193 254
     	    } else if (preg_match('/radarvirtuel.com\/list_aircrafts$/i',$host)) {
@@ -204,7 +265,9 @@  discard block
 block discarded – undo
204 265
         	//$formats[$id] = 'planeupdatefaa';
205 266
         	$globalSources[$id]['format'] = 'planeupdatefaa';
206 267
         	//$last_exec['planeupdatefaa'] = 0;
207
-        	if ($globalDebug) echo "Connect to planeUpdateFAA.php source (".$host.")...\n";
268
+        	if ($globalDebug) {
269
+        		echo "Connect to planeUpdateFAA.php source (".$host.")...\n";
270
+        	}
208 271
         	if (!isset($globalSourcesRights) || (isset($globalSourcesRights) && !$globalSourcesRights)) {
209 272
         	    echo '!!! You MUST set $globalSourcesRights = TRUE in settings.php if you have the right to use this feed !!!'."\n";
210 273
         	    exit(0);
@@ -213,37 +276,53 @@  discard block
 block discarded – undo
213 276
         	//$formats[$id] = 'phpvmacars';
214 277
         	$globalSources[$id]['format'] = 'phpvmacars';
215 278
         	//$last_exec['phpvmacars'] = 0;
216
-        	if ($globalDebug) echo "Connect to phpvmacars source (".$host.")...\n";
279
+        	if ($globalDebug) {
280
+        		echo "Connect to phpvmacars source (".$host.")...\n";
281
+        	}
217 282
             } else if (preg_match('/\/api\/v1\/acars\/data$/i',$host)) {
218 283
         	//$formats[$id] = 'phpvmacars';
219 284
         	$globalSources[$id]['format'] = 'vaos';
220 285
         	//$last_exec['phpvmacars'] = 0;
221
-        	if ($globalDebug) echo "Connect to vaos source (".$host.")...\n";
286
+        	if ($globalDebug) {
287
+        		echo "Connect to vaos source (".$host.")...\n";
288
+        	}
222 289
             } else if (preg_match('/VAM-json.php$/i',$host)) {
223 290
         	//$formats[$id] = 'phpvmacars';
224 291
         	$globalSources[$id]['format'] = 'vam';
225
-        	if ($globalDebug) echo "Connect to Vam source (".$host.")...\n";
292
+        	if ($globalDebug) {
293
+        		echo "Connect to Vam source (".$host.")...\n";
294
+        	}
226 295
             } else if (preg_match('/whazzup/i',$host)) {
227 296
         	//$formats[$id] = 'whazzup';
228 297
         	$globalSources[$id]['format'] = 'whazzup';
229 298
         	//$last_exec['whazzup'] = 0;
230
-        	if ($globalDebug) echo "Connect to whazzup source (".$host.")...\n";
299
+        	if ($globalDebug) {
300
+        		echo "Connect to whazzup source (".$host.")...\n";
301
+        	}
231 302
             } else if (preg_match('/blitzortung/i',$host)) {
232 303
         	$globalSources[$id]['format'] = 'blitzortung';
233
-        	if ($globalDebug) echo "Connect to blitzortung source (".$host.")...\n";
304
+        	if ($globalDebug) {
305
+        		echo "Connect to blitzortung source (".$host.")...\n";
306
+        	}
234 307
             } else if (preg_match('/airwhere/i',$host)) {
235 308
         	$globalSources[$id]['format'] = 'airwhere';
236
-        	if ($globalDebug) echo "Connect to airwhere source (".$host.")...\n";
309
+        	if ($globalDebug) {
310
+        		echo "Connect to airwhere source (".$host.")...\n";
311
+        	}
237 312
             } else if (preg_match('/recentpireps/i',$host)) {
238 313
         	//$formats[$id] = 'pirepsjson';
239 314
         	$globalSources[$id]['format'] = 'pirepsjson';
240 315
         	//$last_exec['pirepsjson'] = 0;
241
-        	if ($globalDebug) echo "Connect to pirepsjson source (".$host.")...\n";
316
+        	if ($globalDebug) {
317
+        		echo "Connect to pirepsjson source (".$host.")...\n";
318
+        	}
242 319
             } else if (preg_match(':data.fr24.com/zones/fcgi/feed.js:i',$host)) {
243 320
         	//$formats[$id] = 'fr24json';
244 321
         	$globalSources[$id]['format'] = 'fr24json';
245 322
         	//$last_exec['fr24json'] = 0;
246
-        	if ($globalDebug) echo "Connect to fr24 source (".$host.")...\n";
323
+        	if ($globalDebug) {
324
+        		echo "Connect to fr24 source (".$host.")...\n";
325
+        	}
247 326
         	if (!isset($globalSourcesRights) || (isset($globalSourcesRights) && !$globalSourcesRights)) {
248 327
         	    echo '!!! You MUST set $globalSourcesRights = TRUE in settings.php if you have the right to use this feed !!!'."\n";
249 328
         	    exit(0);
@@ -252,7 +331,9 @@  discard block
 block discarded – undo
252 331
         	//$formats[$id] = 'fr24json';
253 332
         	$globalSources[$id]['format'] = 'myshiptracking';
254 333
         	//$last_exec['fr24json'] = 0;
255
-        	if ($globalDebug) echo "Connect to myshiptracking source (".$host.")...\n";
334
+        	if ($globalDebug) {
335
+        		echo "Connect to myshiptracking source (".$host.")...\n";
336
+        	}
256 337
         	if (!isset($globalSourcesRights) || (isset($globalSourcesRights) && !$globalSourcesRights)) {
257 338
         	    echo '!!! You MUST set $globalSourcesRights = TRUE in settings.php if you have the right to use this feed !!!'."\n";
258 339
         	    exit(0);
@@ -261,16 +342,24 @@  discard block
 block discarded – undo
261 342
             } else if (preg_match('/10001/',$host) || (isset($globalSources[$id]['port']) && $globalSources[$id]['port'] == '10001')) {
262 343
         	//$formats[$id] = 'tsv';
263 344
         	$globalSources[$id]['format'] = 'tsv';
264
-        	if ($globalDebug) echo "Connect to tsv source (".$host.")...\n";
345
+        	if ($globalDebug) {
346
+        		echo "Connect to tsv source (".$host.")...\n";
347
+        	}
265 348
             }
266 349
         } elseif (filter_var($host,FILTER_VALIDATE_URL)) {
267 350
     		if ($globalSources[$id]['format'] == 'aisnmeahttp') {
268 351
     		    $idf = fopen($globalSources[$id]['host'],'r',false,$context);
269 352
     		    if ($idf !== false) {
270 353
     			$httpfeeds[$id] = $idf;
271
-        		if ($globalDebug) echo "Connected to ".$globalSources[$id]['format']." source (".$host.")...\n";
272
-    		    } elseif ($globalDebug) echo "Can't connect to ".$globalSources[$id]['host']."\n";
273
-    		} elseif ($globalDebug) echo "Connect to ".$globalSources[$id]['format']." source (".$host.")...\n";
354
+        		if ($globalDebug) {
355
+        			echo "Connected to ".$globalSources[$id]['format']." source (".$host.")...\n";
356
+        		}
357
+    		    } elseif ($globalDebug) {
358
+    		    	echo "Can't connect to ".$globalSources[$id]['host']."\n";
359
+    		    }
360
+    		} elseif ($globalDebug) {
361
+    			echo "Connect to ".$globalSources[$id]['format']." source (".$host.")...\n";
362
+    		}
274 363
         } elseif (!filter_var($host,FILTER_VALIDATE_URL)) {
275 364
 	    $hostport = explode(':',$host);
276 365
 	    if (isset($hostport[1])) {
@@ -310,19 +399,27 @@  discard block
 block discarded – undo
310 399
         		//$formats[$id] = 'beast';
311 400
         		$globalSources[$id]['format'] = 'beast';
312 401
 		    //} else $formats[$id] = 'sbs';
313
-		    } else $globalSources[$id]['format'] = 'sbs';
402
+		    } else {
403
+		    	$globalSources[$id]['format'] = 'sbs';
404
+		    }
314 405
 		    //if ($globalDebug) echo 'Connection in progress to '.$host.'('.$formats[$id].')....'."\n";
315 406
 		}
316
-		if ($globalDebug) echo 'Connection in progress to '.$hostn.':'.$port.' ('.$globalSources[$id]['format'].')....'."\n";
407
+		if ($globalDebug) {
408
+			echo 'Connection in progress to '.$hostn.':'.$port.' ('.$globalSources[$id]['format'].')....'."\n";
409
+		}
317 410
             } else {
318
-		if ($globalDebug) echo 'Connection failed to '.$hostn.':'.$port.' : '.$errno.' '.$errstr."\n";
411
+		if ($globalDebug) {
412
+			echo 'Connection failed to '.$hostn.':'.$port.' : '.$errno.' '.$errstr."\n";
413
+		}
319 414
 		sleep(10);
320 415
 		connect_all($hosts);
321 416
     	    }
322 417
         }
323 418
     }
324 419
 }
325
-if (!isset($globalMinFetch)) $globalMinFetch = 15;
420
+if (!isset($globalMinFetch)) {
421
+	$globalMinFetch = 15;
422
+}
326 423
 
327 424
 // Initialize all
328 425
 $status = array();
@@ -331,13 +428,19 @@  discard block
 block discarded – undo
331 428
 $formats = array();
332 429
 $last_exec = array();
333 430
 $time = time();
334
-if (isset($globalSourcesTimeout)) $timeout = $globalSourcesTimeOut;
335
-else if (isset($globalSBS1TimeOut)) $timeout = $globalSBS1TimeOut;
336
-else $timeout = 20;
431
+if (isset($globalSourcesTimeout)) {
432
+	$timeout = $globalSourcesTimeOut;
433
+} else if (isset($globalSBS1TimeOut)) {
434
+	$timeout = $globalSBS1TimeOut;
435
+} else {
436
+	$timeout = 20;
437
+}
337 438
 $errno = '';
338 439
 $errstr='';
339 440
 
340
-if (!isset($globalDaemon)) $globalDaemon = TRUE;
441
+if (!isset($globalDaemon)) {
442
+	$globalDaemon = TRUE;
443
+}
341 444
 /* Initiate connections to all the hosts simultaneously */
342 445
 //connect_all($hosts);
343 446
 //connect_all($globalSources);
@@ -366,7 +469,9 @@  discard block
 block discarded – undo
366 469
     if (isset($source['format']) && $source['format'] == 'aprs') {
367 470
 	$aprs_connect = 0;
368 471
 	$use_aprs = true;
369
-	if (isset($source['port']) && $source['port'] == '10152') $aprs_full = true;
472
+	if (isset($source['port']) && $source['port'] == '10152') {
473
+		$aprs_full = true;
474
+	}
370 475
 	break;
371 476
     }
372 477
 }
@@ -377,25 +482,46 @@  discard block
 block discarded – undo
377 482
 	$aprs_connect = 0;
378 483
 	$aprs_keep = 120;
379 484
 	$aprs_last_tx = time();
380
-	if (isset($globalAPRSversion)) $aprs_version = $globalAPRSversion;
381
-	else $aprs_version = 'FlightAirMap '.str_replace(' ','_',$globalName);
382
-	if (isset($globalAPRSssid)) $aprs_ssid = $globalAPRSssid;
383
-	else $aprs_ssid = substr('FAM'.strtoupper(str_replace(' ','_',$globalName)),0,8);
384
-	if (isset($globalAPRSfilter)) $aprs_filter = $globalAPRSfilter;
385
-	else $aprs_filter =  'r/'.$globalCenterLatitude.'/'.$globalCenterLongitude.'/250.0';
386
-	if ($aprs_full) $aprs_filter = '';
387
-	if (isset($globalAPRSpass)) $aprs_pass = $globalAPRSpass;
388
-	else $aprs_pass = '-1';
485
+	if (isset($globalAPRSversion)) {
486
+		$aprs_version = $globalAPRSversion;
487
+	} else {
488
+		$aprs_version = 'FlightAirMap '.str_replace(' ','_',$globalName);
489
+	}
490
+	if (isset($globalAPRSssid)) {
491
+		$aprs_ssid = $globalAPRSssid;
492
+	} else {
493
+		$aprs_ssid = substr('FAM'.strtoupper(str_replace(' ','_',$globalName)),0,8);
494
+	}
495
+	if (isset($globalAPRSfilter)) {
496
+		$aprs_filter = $globalAPRSfilter;
497
+	} else {
498
+		$aprs_filter =  'r/'.$globalCenterLatitude.'/'.$globalCenterLongitude.'/250.0';
499
+	}
500
+	if ($aprs_full) {
501
+		$aprs_filter = '';
502
+	}
503
+	if (isset($globalAPRSpass)) {
504
+		$aprs_pass = $globalAPRSpass;
505
+	} else {
506
+		$aprs_pass = '-1';
507
+	}
389 508
 
390
-	if ($aprs_filter != '') $aprs_login = "user {$aprs_ssid} pass {$aprs_pass} vers {$aprs_version} filter {$aprs_filter}\n";
391
-	else $aprs_login = "user {$aprs_ssid} pass {$aprs_pass} vers {$aprs_version}\n";
392
-}
509
+	if ($aprs_filter != '') {
510
+		$aprs_login = "user {$aprs_ssid} pass {$aprs_pass} vers {$aprs_version} filter {$aprs_filter}\n";
511
+	} else {
512
+		$aprs_login = "user {$aprs_ssid} pass {$aprs_pass} vers {$aprs_version}\n";
513
+	}
514
+	}
393 515
 
394 516
 // connected - lets do some work
395 517
 //if ($globalDebug) echo "Connected!\n";
396 518
 sleep(1);
397
-if ($globalDebug) echo "SCAN MODE \n\n";
398
-if (!isset($globalCronEnd)) $globalCronEnd = 60;
519
+if ($globalDebug) {
520
+	echo "SCAN MODE \n\n";
521
+}
522
+if (!isset($globalCronEnd)) {
523
+	$globalCronEnd = 60;
524
+}
399 525
 $endtime = time()+$globalCronEnd;
400 526
 $i = 1;
401 527
 $tt = array();
@@ -409,22 +535,32 @@  discard block
 block discarded – undo
409 535
 
410 536
 // Infinite loop if daemon, else work for time defined in $globalCronEnd or only one time.
411 537
 while ($i > 0) {
412
-    if (function_exists('pcntl_fork')) pcntl_signal_dispatch();
538
+    if (function_exists('pcntl_fork')) {
539
+    	pcntl_signal_dispatch();
540
+    }
413 541
 
414
-    if (!$globalDaemon) $i = $endtime-time();
542
+    if (!$globalDaemon) {
543
+    	$i = $endtime-time();
544
+    }
415 545
     // Delete old ATC
416 546
     if ($globalDaemon && ((isset($globalVA) && $globalVA) || (isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM))) {
417
-	if ($globalDebug) echo 'Delete old ATC...'."\n";
547
+	if ($globalDebug) {
548
+		echo 'Delete old ATC...'."\n";
549
+	}
418 550
         $ATC->deleteOldATC();
419 551
     }
420 552
     
421 553
     if (count($last_exec) == count($globalSources)) {
422 554
 	$max = $globalMinFetch;
423 555
 	foreach ($last_exec as $last) {
424
-	    if ((time() - $last['last']) < $max) $max = time() - $last['last'];
556
+	    if ((time() - $last['last']) < $max) {
557
+	    	$max = time() - $last['last'];
558
+	    }
425 559
 	}
426 560
 	if ($max < $globalMinFetch) {
427
-	    if ($globalDebug) echo 'Sleeping...'."\n";
561
+	    if ($globalDebug) {
562
+	    	echo 'Sleeping...'."\n";
563
+	    }
428 564
 	    sleep($globalMinFetch-$max+2);
429 565
 	}
430 566
     }
@@ -434,7 +570,9 @@  discard block
 block discarded – undo
434 570
     foreach ($globalSources as $id => $value) {
435 571
 	date_default_timezone_set('UTC');
436 572
 	//if ($globalDebug) echo 'Source host : '.$value['host'].' - Source format: '.$value['format']."\n";
437
-	if (!isset($last_exec[$id]['last'])) $last_exec[$id]['last'] = 0;
573
+	if (!isset($last_exec[$id]['last'])) {
574
+		$last_exec[$id]['last'] = 0;
575
+	}
438 576
 	if ($value['format'] === 'deltadbtxt' && 
439 577
 	    (
440 578
 		(isset($globalSources[$id]['minfetch']) && (time() - $last_exec[$id]['last'] > $globalSources[$id]['minfetch'])) || 
@@ -443,7 +581,9 @@  discard block
 block discarded – undo
443 581
 	) {
444 582
 	    //$buffer = $Common->getData($hosts[$id]);
445 583
 	    $buffer = $Common->getData($value['host']);
446
-	    if ($buffer != '') $reset = 0;
584
+	    if ($buffer != '') {
585
+	    	$reset = 0;
586
+	    }
447 587
     	    $buffer=trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'\n',$buffer));
448 588
 	    $buffer = explode('\n',$buffer);
449 589
 	    foreach ($buffer as $line) {
@@ -452,20 +592,41 @@  discard block
 block discarded – undo
452 592
 	            $data = array();
453 593
 	            $data['hex'] = $line[1]; // hex
454 594
 	            $data['ident'] = $line[2]; // ident
455
-	            if (isset($line[3])) $data['altitude'] = $line[3]; // altitude
456
-	            if (isset($line[4])) $data['speed'] = $line[4]; // speed
457
-	            if (isset($line[5])) $data['heading'] = $line[5]; // heading
458
-	            if (isset($line[6])) $data['latitude'] = $line[6]; // lat
459
-	            if (isset($line[7])) $data['longitude'] = $line[7]; // long
595
+	            if (isset($line[3])) {
596
+	            	$data['altitude'] = $line[3];
597
+	            }
598
+	            // altitude
599
+	            if (isset($line[4])) {
600
+	            	$data['speed'] = $line[4];
601
+	            }
602
+	            // speed
603
+	            if (isset($line[5])) {
604
+	            	$data['heading'] = $line[5];
605
+	            }
606
+	            // heading
607
+	            if (isset($line[6])) {
608
+	            	$data['latitude'] = $line[6];
609
+	            }
610
+	            // lat
611
+	            if (isset($line[7])) {
612
+	            	$data['longitude'] = $line[7];
613
+	            }
614
+	            // long
460 615
 	            $data['verticalrate'] = ''; // vertical rate
461 616
 	            //if (isset($line[9])) $data['squawk'] = $line[9]; // squawk
462 617
 	            $data['emergency'] = ''; // emergency
463 618
 		    $data['datetime'] = date('Y-m-d H:i:s');
464 619
 		    $data['format_source'] = 'deltadbtxt';
465 620
     		    $data['id_source'] = $id_source;
466
-		    if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name'];
467
-		    if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true;
468
-		    if (isset($value['sourcestats'])) $data['sourcestats'] = $value['sourcestats'];
621
+		    if (isset($value['name']) && $value['name'] != '') {
622
+		    	$data['source_name'] = $value['name'];
623
+		    }
624
+		    if (isset($value['noarchive']) && $value['noarchive'] === TRUE) {
625
+		    	$data['noarchive'] = true;
626
+		    }
627
+		    if (isset($value['sourcestats'])) {
628
+		    	$data['sourcestats'] = $value['sourcestats'];
629
+		    }
469 630
     		    $SI->add($data);
470 631
 		    unset($data);
471 632
     		}
@@ -480,7 +641,9 @@  discard block
 block discarded – undo
480 641
 	    date_default_timezone_set('CET');
481 642
 	    $buffer = $Common->getData(str_replace('{date}',date('Ymd'),$value['host']));
482 643
 	    date_default_timezone_set('UTC');
483
-	    if ($buffer != '') $reset = 0;
644
+	    if ($buffer != '') {
645
+	    	$reset = 0;
646
+	    }
484 647
     	    $buffer=trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'\n',$buffer));
485 648
 	    $buffer = explode('\n',$buffer);
486 649
 	    foreach ($buffer as $line) {
@@ -489,18 +652,42 @@  discard block
 block discarded – undo
489 652
 		    $add = false;
490 653
 		    $ais_data = $AIS->parse_line(trim($line));
491 654
 		    $data = array();
492
-		    if (isset($ais_data['ident'])) $data['ident'] = $ais_data['ident'];
493
-		    if (isset($ais_data['mmsi'])) $data['mmsi'] = substr($ais_data['mmsi'],-9);
494
-		    if (isset($ais_data['speed'])) $data['speed'] = $ais_data['speed'];
495
-		    if (isset($ais_data['heading'])) $data['heading'] = $ais_data['heading'];
496
-		    if (isset($ais_data['latitude'])) $data['latitude'] = $ais_data['latitude'];
497
-		    if (isset($ais_data['longitude'])) $data['longitude'] = $ais_data['longitude'];
498
-		    if (isset($ais_data['status'])) $data['status'] = $ais_data['status'];
499
-		    if (isset($ais_data['statusid'])) $data['status_id'] = $ais_data['statusid'];
500
-		    if (isset($ais_data['type'])) $data['type'] = $ais_data['type'];
501
-		    if (isset($ais_data['typeid'])) $data['type_id'] = $ais_data['typeid'];
502
-		    if (isset($ais_data['imo'])) $data['imo'] = $ais_data['imo'];
503
-		    if (isset($ais_data['callsign'])) $data['callsign'] = $ais_data['callsign'];
655
+		    if (isset($ais_data['ident'])) {
656
+		    	$data['ident'] = $ais_data['ident'];
657
+		    }
658
+		    if (isset($ais_data['mmsi'])) {
659
+		    	$data['mmsi'] = substr($ais_data['mmsi'],-9);
660
+		    }
661
+		    if (isset($ais_data['speed'])) {
662
+		    	$data['speed'] = $ais_data['speed'];
663
+		    }
664
+		    if (isset($ais_data['heading'])) {
665
+		    	$data['heading'] = $ais_data['heading'];
666
+		    }
667
+		    if (isset($ais_data['latitude'])) {
668
+		    	$data['latitude'] = $ais_data['latitude'];
669
+		    }
670
+		    if (isset($ais_data['longitude'])) {
671
+		    	$data['longitude'] = $ais_data['longitude'];
672
+		    }
673
+		    if (isset($ais_data['status'])) {
674
+		    	$data['status'] = $ais_data['status'];
675
+		    }
676
+		    if (isset($ais_data['statusid'])) {
677
+		    	$data['status_id'] = $ais_data['statusid'];
678
+		    }
679
+		    if (isset($ais_data['type'])) {
680
+		    	$data['type'] = $ais_data['type'];
681
+		    }
682
+		    if (isset($ais_data['typeid'])) {
683
+		    	$data['type_id'] = $ais_data['typeid'];
684
+		    }
685
+		    if (isset($ais_data['imo'])) {
686
+		    	$data['imo'] = $ais_data['imo'];
687
+		    }
688
+		    if (isset($ais_data['callsign'])) {
689
+		    	$data['callsign'] = $ais_data['callsign'];
690
+		    }
504 691
 		    if (isset($ais_data['timestamp'])) {
505 692
 			$data['datetime'] = date('Y-m-d H:i:s',$ais_data['timestamp']);
506 693
 			if (!isset($last_exec[$id]['timestamp']) || $ais_data['timestamp'] >= $last_exec[$id]['timestamp']) {
@@ -514,8 +701,12 @@  discard block
 block discarded – undo
514 701
 		    $data['format_source'] = 'aisnmeatxt';
515 702
     		    $data['id_source'] = $id_source;
516 703
 		    //print_r($data);
517
-		    if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true;
518
-		    if ($add && isset($ais_data['mmsi_type']) && $ais_data['mmsi_type'] === 'Ship') $MI->add($data);
704
+		    if (isset($value['noarchive']) && $value['noarchive'] === TRUE) {
705
+		    	$data['noarchive'] = true;
706
+		    }
707
+		    if ($add && isset($ais_data['mmsi_type']) && $ais_data['mmsi_type'] === 'Ship') {
708
+		    	$MI->add($data);
709
+		    }
519 710
 		    unset($data);
520 711
 		}
521 712
     	    }
@@ -538,20 +729,48 @@  discard block
 block discarded – undo
538 729
 			    if ($line != '') {
539 730
 				$ais_data = $AIS->parse_line(trim($line));
540 731
 				$data = array();
541
-				if (isset($ais_data['ident'])) $data['ident'] = $ais_data['ident'];
542
-				if (isset($ais_data['mmsi'])) $data['mmsi'] = substr($ais_data['mmsi'],-9);
543
-				if (isset($ais_data['speed'])) $data['speed'] = $ais_data['speed'];
544
-				if (isset($ais_data['heading'])) $data['heading'] = $ais_data['heading'];
545
-				if (isset($ais_data['latitude'])) $data['latitude'] = $ais_data['latitude'];
546
-				if (isset($ais_data['longitude'])) $data['longitude'] = $ais_data['longitude'];
547
-				if (isset($ais_data['status'])) $data['status'] = $ais_data['status'];
548
-				if (isset($ais_data['statusid'])) $data['status_id'] = $ais_data['statusid'];
549
-				if (isset($ais_data['type'])) $data['type'] = $ais_data['type'];
550
-				if (isset($ais_data['typeid'])) $data['type_id'] = $ais_data['typeid'];
551
-				if (isset($ais_data['imo'])) $data['imo'] = $ais_data['imo'];
552
-				if (isset($ais_data['callsign'])) $data['callsign'] = $ais_data['callsign'];
553
-				if (isset($ais_data['destination'])) $data['arrival_code'] = $ais_data['destination'];
554
-				if (isset($ais_data['eta_ts'])) $data['arrival_date'] = date('Y-m-d H:i:s',$ais_data['eta_ts']);
732
+				if (isset($ais_data['ident'])) {
733
+					$data['ident'] = $ais_data['ident'];
734
+				}
735
+				if (isset($ais_data['mmsi'])) {
736
+					$data['mmsi'] = substr($ais_data['mmsi'],-9);
737
+				}
738
+				if (isset($ais_data['speed'])) {
739
+					$data['speed'] = $ais_data['speed'];
740
+				}
741
+				if (isset($ais_data['heading'])) {
742
+					$data['heading'] = $ais_data['heading'];
743
+				}
744
+				if (isset($ais_data['latitude'])) {
745
+					$data['latitude'] = $ais_data['latitude'];
746
+				}
747
+				if (isset($ais_data['longitude'])) {
748
+					$data['longitude'] = $ais_data['longitude'];
749
+				}
750
+				if (isset($ais_data['status'])) {
751
+					$data['status'] = $ais_data['status'];
752
+				}
753
+				if (isset($ais_data['statusid'])) {
754
+					$data['status_id'] = $ais_data['statusid'];
755
+				}
756
+				if (isset($ais_data['type'])) {
757
+					$data['type'] = $ais_data['type'];
758
+				}
759
+				if (isset($ais_data['typeid'])) {
760
+					$data['type_id'] = $ais_data['typeid'];
761
+				}
762
+				if (isset($ais_data['imo'])) {
763
+					$data['imo'] = $ais_data['imo'];
764
+				}
765
+				if (isset($ais_data['callsign'])) {
766
+					$data['callsign'] = $ais_data['callsign'];
767
+				}
768
+				if (isset($ais_data['destination'])) {
769
+					$data['arrival_code'] = $ais_data['destination'];
770
+				}
771
+				if (isset($ais_data['eta_ts'])) {
772
+					$data['arrival_date'] = date('Y-m-d H:i:s',$ais_data['eta_ts']);
773
+				}
555 774
 				if (isset($ais_data['timestamp'])) {
556 775
 				    $data['datetime'] = date('Y-m-d H:i:s',$ais_data['timestamp']);
557 776
 				} else {
@@ -559,18 +778,27 @@  discard block
 block discarded – undo
559 778
 				}
560 779
 				$data['format_source'] = 'aisnmeahttp';
561 780
 				$data['id_source'] = $id_source;
562
-				if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true;
563
-				if (isset($ais_data['mmsi_type']) && $ais_data['mmsi_type'] === 'Ship') $MI->add($data);
781
+				if (isset($value['noarchive']) && $value['noarchive'] === TRUE) {
782
+					$data['noarchive'] = true;
783
+				}
784
+				if (isset($ais_data['mmsi_type']) && $ais_data['mmsi_type'] === 'Ship') {
785
+					$MI->add($data);
786
+				}
564 787
 				unset($data);
565 788
 			    }
566 789
 			}
567 790
 		    }
568 791
 		} else {
569 792
 		    $format = $value['format'];
570
-		    if (isset($tt[$format])) $tt[$format]++;
571
-		    else $tt[$format] = 0;
793
+		    if (isset($tt[$format])) {
794
+		    	$tt[$format]++;
795
+		    } else {
796
+		    	$tt[$format] = 0;
797
+		    }
572 798
 		    if ($tt[$format] > 30) {
573
-			if ($globalDebug) echo 'Reconnect...'."\n";
799
+			if ($globalDebug) {
800
+				echo 'Reconnect...'."\n";
801
+			}
574 802
 			sleep(2);
575 803
 			//$sourceeen[] = $value;
576 804
 			//connect_all($sourceeen);
@@ -606,12 +834,18 @@  discard block
 block discarded – undo
606 834
 			    //    if (isset($ais_data['type'])) $data['type'] = $ais_data['type'];
607 835
 			    //$data['type_id'] = $line['TYPE'];
608 836
 			    $data['imo'] = $line['IMO'];
609
-			    if ($line['DEST'] != '') $data['arrival_code'] = $line['DEST'];
610
-			    if ($line['ARV'] != '') $data['arrival_time'] = date('Y-m-d H:i:s',strtotime($line['ARV']));
837
+			    if ($line['DEST'] != '') {
838
+			    	$data['arrival_code'] = $line['DEST'];
839
+			    }
840
+			    if ($line['ARV'] != '') {
841
+			    	$data['arrival_time'] = date('Y-m-d H:i:s',strtotime($line['ARV']));
842
+			    }
611 843
 			    $data['datetime'] = date('Y-m-d H:i:s',$line['T']);
612 844
 			    $data['format_source'] = 'myshiptracking';
613 845
 			    $data['id_source'] = $id_source;
614
-			    if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true;
846
+			    if (isset($value['noarchive']) && $value['noarchive'] === TRUE) {
847
+			    	$data['noarchive'] = true;
848
+			    }
615 849
 			    $MI->add($data);
616 850
 			    unset($data);
617 851
 			}
@@ -636,7 +870,9 @@  discard block
 block discarded – undo
636 870
 			    $data['callsign'] = $line['callsign'];
637 871
 			    $data['mmsi'] = substr($line['mmsi'],-9);
638 872
 			    $data['speed'] = $line['sog'];
639
-			    if ($line['heading'] != '511') $data['heading'] = $line['heading'];
873
+			    if ($line['heading'] != '511') {
874
+			    	$data['heading'] = $line['heading'];
875
+			    }
640 876
 			    $data['latitude'] = $line['latitude'];
641 877
 			    $data['longitude'] = $line['longitude'];
642 878
 			    $data['type_id'] = $line['shiptype'];
@@ -644,7 +880,9 @@  discard block
 block discarded – undo
644 880
 			    $data['datetime'] = $line['time'];
645 881
 			    $data['format_source'] = 'boatbeaconapp';
646 882
 			    $data['id_source'] = $id_source;
647
-			    if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true;
883
+			    if (isset($value['noarchive']) && $value['noarchive'] === TRUE) {
884
+			    	$data['noarchive'] = true;
885
+			    }
648 886
 			    $MI->add($data);
649 887
 			    unset($data);
650 888
 			}
@@ -666,22 +904,44 @@  discard block
 block discarded – undo
666 904
 		    foreach ($all_data['features'] as $line) {
667 905
 			print_r($line);
668 906
 			$data = array();
669
-			if (isset($line['properties']['name'])) $data['ident'] = $line['properties']['name'];
670
-			if (isset($line['properties']['callsign'])) $data['callsign'] = $line['properties']['callsign'];
671
-			if (isset($line['properties']['mmsi'])) $data['mmsi'] = substr($line['properties']['mmsi'],-9);
672
-			if (isset($line['properties']['imo'])) $data['imo'] = $line['properties']['imo'];
673
-			if (isset($line['properties']['speed'])) $data['speed'] = $line['properties']['speed'];
674
-			if (isset($line['properties']['heading']) && $line['properties']['heading'] != 0) $data['heading'] = $line['properties']['heading'];
907
+			if (isset($line['properties']['name'])) {
908
+				$data['ident'] = $line['properties']['name'];
909
+			}
910
+			if (isset($line['properties']['callsign'])) {
911
+				$data['callsign'] = $line['properties']['callsign'];
912
+			}
913
+			if (isset($line['properties']['mmsi'])) {
914
+				$data['mmsi'] = substr($line['properties']['mmsi'],-9);
915
+			}
916
+			if (isset($line['properties']['imo'])) {
917
+				$data['imo'] = $line['properties']['imo'];
918
+			}
919
+			if (isset($line['properties']['speed'])) {
920
+				$data['speed'] = $line['properties']['speed'];
921
+			}
922
+			if (isset($line['properties']['heading']) && $line['properties']['heading'] != 0) {
923
+				$data['heading'] = $line['properties']['heading'];
924
+			}
675 925
 			$data['latitude'] = $line['geometry']['coordinates'][1];
676 926
 			$data['longitude'] = $line['geometry']['coordinates'][0];
677
-			if (isset($line['properties']['vesselType'])) $data['type'] = $line['properties']['vesselType'];
678
-			if (isset($line['properties']['destination'])) $data['arrival_code'] = $line['properties']['destination'];
679
-			if (isset($line['properties']['eta']) && $line['properties']['eta'] != '') $data['arrival_date'] = $line['properties']['eta'];
927
+			if (isset($line['properties']['vesselType'])) {
928
+				$data['type'] = $line['properties']['vesselType'];
929
+			}
930
+			if (isset($line['properties']['destination'])) {
931
+				$data['arrival_code'] = $line['properties']['destination'];
932
+			}
933
+			if (isset($line['properties']['eta']) && $line['properties']['eta'] != '') {
934
+				$data['arrival_date'] = $line['properties']['eta'];
935
+			}
680 936
 			$data['format_source'] = 'boatnerd';
681 937
 			$data['id_source'] = $id_source;
682 938
 			$data['datetime'] = date('Y-m-d H:i:s');
683
-			if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true;
684
-			if ($line['properties']['vesselType'] != 'Navigation Aid') $MI->add($data);
939
+			if (isset($value['noarchive']) && $value['noarchive'] === TRUE) {
940
+				$data['noarchive'] = true;
941
+			}
942
+			if ($line['properties']['vesselType'] != 'Navigation Aid') {
943
+				$MI->add($data);
944
+			}
685 945
 			unset($data);
686 946
 		    }
687 947
 		}
@@ -698,7 +958,9 @@  discard block
 block discarded – undo
698 958
 	    $buffer = $Common->getData($value['host'],'post',$value['post'],'','','','','ShipPlotter');
699 959
 	    echo 'done !'."\n";
700 960
 	    // FIXME: Need more work
701
-	    if ($buffer != '') $reset = 0;
961
+	    if ($buffer != '') {
962
+	    	$reset = 0;
963
+	    }
702 964
     	    $buffer=trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'\n',$buffer));
703 965
 	    $buffer = explode('\n',$buffer);
704 966
 	    foreach ($buffer as $line) {
@@ -724,7 +986,9 @@  discard block
 block discarded – undo
724 986
 		    //$data['etaTime'] = substr($line,135,5);
725 987
 		    $data['format_source'] = 'shipplotter';
726 988
     		    $data['id_source'] = $id_source;
727
-		    if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true;
989
+		    if (isset($value['noarchive']) && $value['noarchive'] === TRUE) {
990
+		    	$data['noarchive'] = true;
991
+		    }
728 992
 		    //print_r($data);
729 993
 		    echo 'Add...'."\n";
730 994
 		    $MI->add($data);
@@ -758,16 +1022,28 @@  discard block
 block discarded – undo
758 1022
     		    $line = explode(':', $line);
759 1023
     		    if (count($line) > 30 && $line[0] != 'callsign') {
760 1024
 			$data = array();
761
-			if (isset($line[37]) && $line[37] != '') $data['id'] = $value['format'].'-'.$line[1].'-'.$line[0].'-'.$line[37];
762
-			else $data['id'] = $value['format'].'-'.$line[1].'-'.$line[0];
1025
+			if (isset($line[37]) && $line[37] != '') {
1026
+				$data['id'] = $value['format'].'-'.$line[1].'-'.$line[0].'-'.$line[37];
1027
+			} else {
1028
+				$data['id'] = $value['format'].'-'.$line[1].'-'.$line[0];
1029
+			}
763 1030
 			$data['pilot_id'] = $line[1];
764 1031
 			$data['pilot_name'] = $line[2];
765 1032
 			$data['hex'] = str_pad(dechex($Common->str2int($line[1])),6,'000000',STR_PAD_LEFT);
766 1033
 			$data['ident'] = $line[0]; // ident
767
-			if ($line[7] != '' && $line[7] != 0) $data['altitude'] = $line[7]; // altitude
1034
+			if ($line[7] != '' && $line[7] != 0) {
1035
+				$data['altitude'] = $line[7];
1036
+			}
1037
+			// altitude
768 1038
 			$data['speed'] = $line[8]; // speed
769
-			if (isset($line[45])) $data['heading'] = $line[45]; // heading
770
-			elseif (isset($line[38])) $data['heading'] = $line[38]; // heading
1039
+			if (isset($line[45])) {
1040
+				$data['heading'] = $line[45];
1041
+			}
1042
+			// heading
1043
+			elseif (isset($line[38])) {
1044
+				$data['heading'] = $line[38];
1045
+			}
1046
+			// heading
771 1047
 			$data['latitude'] = $line[5]; // lat
772 1048
 	        	$data['longitude'] = $line[6]; // long
773 1049
 	        	$data['verticalrate'] = ''; // vertical rate
@@ -783,7 +1059,9 @@  discard block
 block discarded – undo
783 1059
 			$data['frequency'] = $line[4];
784 1060
 			$data['type'] = $line[18];
785 1061
 			$data['range'] = $line[19];
786
-			if (isset($line[35])) $data['info'] = $line[35];
1062
+			if (isset($line[35])) {
1063
+				$data['info'] = $line[35];
1064
+			}
787 1065
     			$data['id_source'] = $id_source;
788 1066
 	    		//$data['arrival_airport_time'] = ;
789 1067
 	    		if ($line[9] != '') {
@@ -797,27 +1075,47 @@  discard block
 block discarded – undo
797 1075
 	    		elseif ($value === 'vatsimtxt') $data['format_source'] = 'vatsimtxt';
798 1076
 	    		*/
799 1077
 	    		$data['format_source'] = $value['format'];
800
-			if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true;
801
-			if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name'];
802
-    			if ($line[3] === 'PILOT') $SI->add($data);
803
-			elseif ($line[3] === 'ATC') {
1078
+			if (isset($value['noarchive']) && $value['noarchive'] === TRUE) {
1079
+				$data['noarchive'] = true;
1080
+			}
1081
+			if (isset($value['name']) && $value['name'] != '') {
1082
+				$data['source_name'] = $value['name'];
1083
+			}
1084
+    			if ($line[3] === 'PILOT') {
1085
+    				$SI->add($data);
1086
+    			} elseif ($line[3] === 'ATC') {
804 1087
 				//print_r($data);
805 1088
 				$data['info'] = str_replace('^&sect;','<br />',$data['info']);
806 1089
 				$data['info'] = str_replace('&amp;sect;','',$data['info']);
807 1090
 				$typec = substr($data['ident'],-3);
808
-				if ($typec === 'APP') $data['type'] = 'Approach';
809
-				elseif ($typec === 'TWR') $data['type'] = 'Tower';
810
-				elseif ($typec === 'OBS') $data['type'] = 'Observer';
811
-				elseif ($typec === 'GND') $data['type'] = 'Ground';
812
-				elseif ($typec === 'DEL') $data['type'] = 'Delivery';
813
-				elseif ($typec === 'DEP') $data['type'] = 'Departure';
814
-				elseif ($typec === 'FSS') $data['type'] = 'Flight Service Station';
815
-				elseif ($typec === 'CTR') $data['type'] = 'Control Radar or Centre';
816
-				elseif ($data['type'] === '') $data['type'] = 'Observer';
817
-				if (!isset($data['source_name'])) $data['source_name'] = '';
1091
+				if ($typec === 'APP') {
1092
+					$data['type'] = 'Approach';
1093
+				} elseif ($typec === 'TWR') {
1094
+					$data['type'] = 'Tower';
1095
+				} elseif ($typec === 'OBS') {
1096
+					$data['type'] = 'Observer';
1097
+				} elseif ($typec === 'GND') {
1098
+					$data['type'] = 'Ground';
1099
+				} elseif ($typec === 'DEL') {
1100
+					$data['type'] = 'Delivery';
1101
+				} elseif ($typec === 'DEP') {
1102
+					$data['type'] = 'Departure';
1103
+				} elseif ($typec === 'FSS') {
1104
+					$data['type'] = 'Flight Service Station';
1105
+				} elseif ($typec === 'CTR') {
1106
+					$data['type'] = 'Control Radar or Centre';
1107
+				} elseif ($data['type'] === '') {
1108
+					$data['type'] = 'Observer';
1109
+				}
1110
+				if (!isset($data['source_name'])) {
1111
+					$data['source_name'] = '';
1112
+				}
818 1113
 				if (isset($ATC)) {
819
-					if (count($ATC->getByIdent($data['ident'],$data['format_source'])) > 0) echo $ATC->update($data['ident'],$data['frequency'],$data['latitude'],$data['longitude'],$data['range'],$data['info'],$data['datetime'],$data['type'],$data['pilot_id'],$data['pilot_name'],$data['format_source'],$data['source_name']);
820
-					else echo $ATC->add($data['ident'],$data['frequency'],$data['latitude'],$data['longitude'],$data['range'],$data['info'],$data['datetime'],$data['type'],$data['pilot_id'],$data['pilot_name'],$data['format_source'],$data['source_name']);
1114
+					if (count($ATC->getByIdent($data['ident'],$data['format_source'])) > 0) {
1115
+						echo $ATC->update($data['ident'],$data['frequency'],$data['latitude'],$data['longitude'],$data['range'],$data['info'],$data['datetime'],$data['type'],$data['pilot_id'],$data['pilot_name'],$data['format_source'],$data['source_name']);
1116
+					} else {
1117
+						echo $ATC->add($data['ident'],$data['frequency'],$data['latitude'],$data['longitude'],$data['range'],$data['info'],$data['datetime'],$data['type'],$data['pilot_id'],$data['pilot_name'],$data['format_source'],$data['source_name']);
1118
+					}
821 1119
 				}
822 1120
 			}
823 1121
     			unset($data);
@@ -844,14 +1142,20 @@  discard block
 block discarded – undo
844 1142
 			$data['datetime'] = date('Y-m-d H:i:s',strtotime((string)$line['entryTime'].' BST'));
845 1143
 			$data['latitude'] = (float)$line['pktLatitude'];
846 1144
 			$data['longitude'] = (float)$line['pktLongitude'];
847
-			if ((float)$line['pktTrack'] != 0) $data['heading'] = (float)$line['pktTrack'];
848
-			if ((int)$line['pktSpeed'] != 0) $data['speed'] = (int)$line['pktSpeed'];
1145
+			if ((float)$line['pktTrack'] != 0) {
1146
+				$data['heading'] = (float)$line['pktTrack'];
1147
+			}
1148
+			if ((int)$line['pktSpeed'] != 0) {
1149
+				$data['speed'] = (int)$line['pktSpeed'];
1150
+			}
849 1151
 			$data['altitude'] = round((int)$line['pktAltitude']*3.28084);
850 1152
 			$data['altitude_relative'] = 'AMSL';
851 1153
 			$data['pilot_id'] = (int)$line['pktPilotID'];
852 1154
 			$data['aircraft_icao'] = 'PARAGLIDER';
853 1155
 			$pilot_data = explode(',',$Common->getData('http://www.airwhere.co.uk/pilotdetails.php?pilot='.$data['pilot_id']));
854
-			if (isset($pilot_data[4])) $data['pilot_name'] = $pilot_data[4];
1156
+			if (isset($pilot_data[4])) {
1157
+				$data['pilot_name'] = $pilot_data[4];
1158
+			}
855 1159
 			$data['format_source'] = $value['format'];
856 1160
 			$SI->add($data);
857 1161
 			unset($data);
@@ -899,25 +1203,59 @@  discard block
 block discarded – undo
899 1203
 		    foreach ($all_data['acList'] as $line) {
900 1204
 			$data = array();
901 1205
 			$data['hex'] = $line['Icao']; // hex
902
-			if (isset($line['Call'])) $data['ident'] = $line['Call']; // ident
903
-			if (isset($line['Alt'])) $data['altitude'] = $line['Alt']; // altitude
904
-			if (isset($line['Spd'])) $data['speed'] = $line['Spd']; // speed
905
-			if (isset($line['Trak'])) $data['heading'] = $line['Trak']; // heading
906
-			if (isset($line['Lat'])) $data['latitude'] = $line['Lat']; // lat
907
-			if (isset($line['Long'])) $data['longitude'] = $line['Long']; // long
1206
+			if (isset($line['Call'])) {
1207
+				$data['ident'] = $line['Call'];
1208
+			}
1209
+			// ident
1210
+			if (isset($line['Alt'])) {
1211
+				$data['altitude'] = $line['Alt'];
1212
+			}
1213
+			// altitude
1214
+			if (isset($line['Spd'])) {
1215
+				$data['speed'] = $line['Spd'];
1216
+			}
1217
+			// speed
1218
+			if (isset($line['Trak'])) {
1219
+				$data['heading'] = $line['Trak'];
1220
+			}
1221
+			// heading
1222
+			if (isset($line['Lat'])) {
1223
+				$data['latitude'] = $line['Lat'];
1224
+			}
1225
+			// lat
1226
+			if (isset($line['Long'])) {
1227
+				$data['longitude'] = $line['Long'];
1228
+			}
1229
+			// long
908 1230
 			//$data['verticalrate'] = $line['']; // verticale rate
909
-			if (isset($line['Sqk'])) $data['squawk'] = $line['Sqk']; // squawk
1231
+			if (isset($line['Sqk'])) {
1232
+				$data['squawk'] = $line['Sqk'];
1233
+			}
1234
+			// squawk
910 1235
 			$data['emergency'] = ''; // emergency
911
-			if (isset($line['Reg'])) $data['registration'] = $line['Reg'];
912
-			if (isset($line['PosTime'])) $data['datetime'] = date('Y-m-d H:i:s',round($line['PosTime']/1000));
913
-			else $data['datetime'] = date('Y-m-d H:i:s');
1236
+			if (isset($line['Reg'])) {
1237
+				$data['registration'] = $line['Reg'];
1238
+			}
1239
+			if (isset($line['PosTime'])) {
1240
+				$data['datetime'] = date('Y-m-d H:i:s',round($line['PosTime']/1000));
1241
+			} else {
1242
+				$data['datetime'] = date('Y-m-d H:i:s');
1243
+			}
914 1244
 			//$data['datetime'] = date('Y-m-d H:i:s');
915
-			if (isset($line['Type'])) $data['aircraft_icao'] = $line['Type'];
1245
+			if (isset($line['Type'])) {
1246
+				$data['aircraft_icao'] = $line['Type'];
1247
+			}
916 1248
 			$data['format_source'] = 'aircraftlistjson';
917 1249
 			$data['id_source'] = $id_source;
918
-			if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name'];
919
-			if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true;
920
-			if (isset($data['latitude'])) $SI->add($data);
1250
+			if (isset($value['name']) && $value['name'] != '') {
1251
+				$data['source_name'] = $value['name'];
1252
+			}
1253
+			if (isset($value['noarchive']) && $value['noarchive'] === TRUE) {
1254
+				$data['noarchive'] = true;
1255
+			}
1256
+			if (isset($data['latitude'])) {
1257
+				$SI->add($data);
1258
+			}
921 1259
 			unset($data);
922 1260
 		    }
923 1261
 		} elseif (is_array($all_data)) {
@@ -934,17 +1272,26 @@  discard block
 block discarded – undo
934 1272
 			$data['verticalrate'] = $line['vrt']; // verticale rate
935 1273
 			$data['squawk'] = $line['squawk']; // squawk
936 1274
 			$data['emergency'] = ''; // emergency
937
-			if (isset($line['PosTime'])) $data['datetime'] = date('Y-m-d H:i:s',round($line['PosTime']/1000));
938
-			else $data['datetime'] = date('Y-m-d H:i:s');
1275
+			if (isset($line['PosTime'])) {
1276
+				$data['datetime'] = date('Y-m-d H:i:s',round($line['PosTime']/1000));
1277
+			} else {
1278
+				$data['datetime'] = date('Y-m-d H:i:s');
1279
+			}
939 1280
 			$data['format_source'] = 'aircraftlistjson';
940 1281
 			$data['id_source'] = $id_source;
941
-			if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true;
942
-			if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name'];
1282
+			if (isset($value['noarchive']) && $value['noarchive'] === TRUE) {
1283
+				$data['noarchive'] = true;
1284
+			}
1285
+			if (isset($value['name']) && $value['name'] != '') {
1286
+				$data['source_name'] = $value['name'];
1287
+			}
943 1288
 			$SI->add($data);
944 1289
 			unset($data);
945 1290
 		    }
946 1291
 		}
947
-	    } elseif ($globalDebug) echo 'No data'."\n";
1292
+	    } elseif ($globalDebug) {
1293
+	    	echo 'No data'."\n";
1294
+	    }
948 1295
     	    //$last_exec['aircraftlistjson'] = time();
949 1296
     	    $last_exec[$id]['last'] = time();
950 1297
     	//} elseif ($value === 'planeupdatefaa' && (time() - $last_exec['planeupdatefaa'] > $globalMinFetch)) {
@@ -980,8 +1327,12 @@  discard block
 block discarded – undo
980 1327
 		    $data['datetime'] = date('Y-m-d H:i:s',$line[9]);
981 1328
 	    	    $data['format_source'] = 'planeupdatefaa';
982 1329
     		    $data['id_source'] = $id_source;
983
-		    if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true;
984
-		    if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name'];
1330
+		    if (isset($value['noarchive']) && $value['noarchive'] === TRUE) {
1331
+		    	$data['noarchive'] = true;
1332
+		    }
1333
+		    if (isset($value['name']) && $value['name'] != '') {
1334
+		    	$data['source_name'] = $value['name'];
1335
+		    }
985 1336
 		    $SI->add($data);
986 1337
 		    unset($data);
987 1338
 		}
@@ -1015,7 +1366,9 @@  discard block
 block discarded – undo
1015 1366
 		    $data['datetime'] = date('Y-m-d H:i:s',$line[3]);
1016 1367
 		    $data['format_source'] = 'opensky';
1017 1368
 		    $data['id_source'] = $id_source;
1018
-		    if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true;
1369
+		    if (isset($value['noarchive']) && $value['noarchive'] === TRUE) {
1370
+		    	$data['noarchive'] = true;
1371
+		    }
1019 1372
 		    $SI->add($data);
1020 1373
 		    unset($data);
1021 1374
 		}
@@ -1035,15 +1388,42 @@  discard block
 block discarded – undo
1035 1388
 		foreach ($all_data['aircraft'] as $key => $line) {
1036 1389
 		    $data = array();
1037 1390
 		    // add support for ground vehicule with ~ in front of hex
1038
-		    if (isset($line['hex'])) $data['hex'] = $line['hex']; // hex
1039
-		    if (isset($line['flight'])) $data['ident'] = trim($line['flight']); // ident
1040
-		    if (isset($line['altitude'])) $data['altitude'] = $line['altitude']; // altitude
1041
-		    if (isset($line['speed'])) $data['speed'] = $line['speed']; // speed
1042
-		    if (isset($line['track'])) $data['heading'] = $line['track']; // heading
1043
-		    if (isset($line['lat'])) $data['latitude'] = $line['lat']; // lat
1044
-		    if (isset($line['lon'])) $data['longitude'] = $line['lon']; // long
1045
-		    if (isset($line['vert_rate'])) $data['verticalrate'] = $line['vert_rate']; // verticale rate
1046
-		    if (isset($line['squawk'])) $data['squawk'] = $line['squawk']; // squawk
1391
+		    if (isset($line['hex'])) {
1392
+		    	$data['hex'] = $line['hex'];
1393
+		    }
1394
+		    // hex
1395
+		    if (isset($line['flight'])) {
1396
+		    	$data['ident'] = trim($line['flight']);
1397
+		    }
1398
+		    // ident
1399
+		    if (isset($line['altitude'])) {
1400
+		    	$data['altitude'] = $line['altitude'];
1401
+		    }
1402
+		    // altitude
1403
+		    if (isset($line['speed'])) {
1404
+		    	$data['speed'] = $line['speed'];
1405
+		    }
1406
+		    // speed
1407
+		    if (isset($line['track'])) {
1408
+		    	$data['heading'] = $line['track'];
1409
+		    }
1410
+		    // heading
1411
+		    if (isset($line['lat'])) {
1412
+		    	$data['latitude'] = $line['lat'];
1413
+		    }
1414
+		    // lat
1415
+		    if (isset($line['lon'])) {
1416
+		    	$data['longitude'] = $line['lon'];
1417
+		    }
1418
+		    // long
1419
+		    if (isset($line['vert_rate'])) {
1420
+		    	$data['verticalrate'] = $line['vert_rate'];
1421
+		    }
1422
+		    // verticale rate
1423
+		    if (isset($line['squawk'])) {
1424
+		    	$data['squawk'] = $line['squawk'];
1425
+		    }
1426
+		    // squawk
1047 1427
 		    //$data['emergency'] = ''; // emergency
1048 1428
 		    //$data['registration'] = $line[2];
1049 1429
 		    //$data['aircraft_icao'] = $line[0];
@@ -1051,10 +1431,17 @@  discard block
 block discarded – undo
1051 1431
 		    $data['format_source'] = 'aircraftjson';
1052 1432
 		    $data['id_source'] = $id_source;
1053 1433
 		    if (isset($value['name']) && $value['name'] != '') {
1054
-			    if (isset($line['mlat']) && !empty($line['mlat'])) $data['source_name'] = $value['name'].'_MLAT';
1055
-			    else $data['source_name'] = $value['name'];
1056
-		    } elseif (isset($line['mlat']) && !empty($line['mlat'])) $data['source_name'] = 'MLAT';
1057
-		    if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true;
1434
+			    if (isset($line['mlat']) && !empty($line['mlat'])) {
1435
+			    	$data['source_name'] = $value['name'].'_MLAT';
1436
+			    } else {
1437
+			    	$data['source_name'] = $value['name'];
1438
+			    }
1439
+		    } elseif (isset($line['mlat']) && !empty($line['mlat'])) {
1440
+		    	$data['source_name'] = 'MLAT';
1441
+		    }
1442
+		    if (isset($value['noarchive']) && $value['noarchive'] === TRUE) {
1443
+		    	$data['noarchive'] = true;
1444
+		    }
1058 1445
 		    $SI->add($data);
1059 1446
 		    unset($data);
1060 1447
 		}
@@ -1074,22 +1461,54 @@  discard block
 block discarded – undo
1074 1461
 		foreach ($all_data['aircraft'] as $key => $line) {
1075 1462
 		    $data = array();
1076 1463
 		    $data['hex'] = $key; // hex
1077
-		    if (isset($line['callsign'])) $data['ident'] = trim($line['callsign']); // ident
1078
-		    if (isset($line['altitude'])) $data['altitude'] = $line['altitude']; // altitude
1079
-		    if (isset($line['speed'])) $data['speed'] = $line['speed']; // speed
1080
-		    if (isset($line['heading'])) $data['heading'] = $line['heading']; // heading
1081
-		    if (isset($line['lat'])) $data['latitude'] = $line['lat']; // lat
1082
-		    if (isset($line['lon'])) $data['longitude'] = $line['lon']; // long
1083
-		    if (isset($line['vert_rate'])) $data['verticalrate'] = $line['vert_rate']; // verticale rate
1084
-		    if (isset($line['squawk'])) $data['squawk'] = $line['squawk']; // squawk
1464
+		    if (isset($line['callsign'])) {
1465
+		    	$data['ident'] = trim($line['callsign']);
1466
+		    }
1467
+		    // ident
1468
+		    if (isset($line['altitude'])) {
1469
+		    	$data['altitude'] = $line['altitude'];
1470
+		    }
1471
+		    // altitude
1472
+		    if (isset($line['speed'])) {
1473
+		    	$data['speed'] = $line['speed'];
1474
+		    }
1475
+		    // speed
1476
+		    if (isset($line['heading'])) {
1477
+		    	$data['heading'] = $line['heading'];
1478
+		    }
1479
+		    // heading
1480
+		    if (isset($line['lat'])) {
1481
+		    	$data['latitude'] = $line['lat'];
1482
+		    }
1483
+		    // lat
1484
+		    if (isset($line['lon'])) {
1485
+		    	$data['longitude'] = $line['lon'];
1486
+		    }
1487
+		    // long
1488
+		    if (isset($line['vert_rate'])) {
1489
+		    	$data['verticalrate'] = $line['vert_rate'];
1490
+		    }
1491
+		    // verticale rate
1492
+		    if (isset($line['squawk'])) {
1493
+		    	$data['squawk'] = $line['squawk'];
1494
+		    }
1495
+		    // squawk
1085 1496
 		    //$data['emergency'] = ''; // emergency
1086
-		    if (isset($line['reg'])) $data['registration'] = $line['reg'];
1087
-		    if (isset($line['type'])) $data['aircraft_icao'] = $line['type'];
1497
+		    if (isset($line['reg'])) {
1498
+		    	$data['registration'] = $line['reg'];
1499
+		    }
1500
+		    if (isset($line['type'])) {
1501
+		    	$data['aircraft_icao'] = $line['type'];
1502
+		    }
1088 1503
 		    $data['datetime'] = date('Y-m-d H:i:s',$line['pos_update_time']);
1089 1504
 		    $data['format_source'] = 'planefinderclient';
1090 1505
 		    $data['id_source'] = $id_source;
1091
-		    if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name'];
1092
-		    if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true;
1506
+		    if (isset($value['name']) && $value['name'] != '') {
1507
+		    	$data['source_name'] = $value['name'];
1508
+		    }
1509
+		    if (isset($value['noarchive']) && $value['noarchive'] === TRUE) {
1510
+		    	$data['noarchive'] = true;
1511
+		    }
1093 1512
 		    $SI->add($data);
1094 1513
 		    unset($data);
1095 1514
 		}
@@ -1105,7 +1524,9 @@  discard block
 block discarded – undo
1105 1524
 	    //$buffer = $Common->getData($hosts[$id]);
1106 1525
 	    $buffer = $Common->getData($value['host']);
1107 1526
 	    $all_data = json_decode($buffer,true);
1108
-	    if (!empty($all_data)) $reset = 0;
1527
+	    if (!empty($all_data)) {
1528
+	    	$reset = 0;
1529
+	    }
1109 1530
 	    foreach ($all_data as $key => $line) {
1110 1531
 		if ($key != 'full_count' && $key != 'version' && $key != 'stats') {
1111 1532
 		    $data = array();
@@ -1126,8 +1547,12 @@  discard block
 block discarded – undo
1126 1547
 		    $data['datetime'] = date('Y-m-d H:i:s'); //$line[10]
1127 1548
 	    	    $data['format_source'] = 'fr24json';
1128 1549
     		    $data['id_source'] = $id_source;
1129
-		    if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true;
1130
-		    if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name'];
1550
+		    if (isset($value['noarchive']) && $value['noarchive'] === TRUE) {
1551
+		    	$data['noarchive'] = true;
1552
+		    }
1553
+		    if (isset($value['name']) && $value['name'] != '') {
1554
+		    	$data['source_name'] = $value['name'];
1555
+		    }
1131 1556
 		    $SI->add($data);
1132 1557
 		    unset($data);
1133 1558
 		}
@@ -1156,24 +1581,42 @@  discard block
 block discarded – undo
1156 1581
 		    if (isset($line['inf'])) {
1157 1582
 			$data = array();
1158 1583
 			$data['hex'] = $line['inf']['ia'];
1159
-			if (isset($line['inf']['cs'])) $data['ident'] = $line['inf']['cs']; //$line[13]
1584
+			if (isset($line['inf']['cs'])) {
1585
+				$data['ident'] = $line['inf']['cs'];
1586
+			}
1587
+			//$line[13]
1160 1588
 	    		$data['altitude'] = round($line['inf']['al']*3.28084); // altitude
1161
-	    		if (isset($line['inf']['gs'])) $data['speed'] = round($line['inf']['gs']*0.539957); // speed
1162
-	    		if (isset($line['inf']['tr'])) $data['heading'] = $line['inf']['tr']; // heading
1589
+	    		if (isset($line['inf']['gs'])) {
1590
+	    			$data['speed'] = round($line['inf']['gs']*0.539957);
1591
+	    		}
1592
+	    		// speed
1593
+	    		if (isset($line['inf']['tr'])) {
1594
+	    			$data['heading'] = $line['inf']['tr'];
1595
+	    		}
1596
+	    		// heading
1163 1597
 	    		$data['latitude'] = $line['pt'][0]; // lat
1164 1598
 	    		$data['longitude'] = $line['pt'][1]; // long
1165 1599
 	    		//if (isset($line['inf']['vs'])) $data['verticalrate'] = $line['inf']['vs']; // verticale rate
1166
-	    		if (isset($line['inf']['sq'])) $data['squawk'] = $line['inf']['sq']; // squawk
1600
+	    		if (isset($line['inf']['sq'])) {
1601
+	    			$data['squawk'] = $line['inf']['sq'];
1602
+	    		}
1603
+	    		// squawk
1167 1604
 	    		//$data['aircraft_icao'] = $line[8];
1168
-	    		if (isset($line['inf']['rc'])) $data['registration'] = $line['inf']['rc'];
1605
+	    		if (isset($line['inf']['rc'])) {
1606
+	    			$data['registration'] = $line['inf']['rc'];
1607
+	    		}
1169 1608
 			//$data['departure_airport_iata'] = $line[11];
1170 1609
 			//$data['arrival_airport_iata'] = $line[12];
1171 1610
 	    		//$data['emergency'] = ''; // emergency
1172 1611
 			$data['datetime'] = date('Y-m-d H:i:s',$line['inf']['dt']); //$line[10]
1173 1612
 	    		$data['format_source'] = 'radarvirtueljson';
1174 1613
     			$data['id_source'] = $id_source;
1175
-			if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true;
1176
-			if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name'];
1614
+			if (isset($value['noarchive']) && $value['noarchive'] === TRUE) {
1615
+				$data['noarchive'] = true;
1616
+			}
1617
+			if (isset($value['name']) && $value['name'] != '') {
1618
+				$data['source_name'] = $value['name'];
1619
+			}
1177 1620
 			$SI->add($data);
1178 1621
 			unset($data);
1179 1622
 		    }
@@ -1199,30 +1642,65 @@  discard block
 block discarded – undo
1199 1642
 		    $data['id'] = $line['id'];
1200 1643
 		    $data['hex'] = substr(str_pad(dechex($line['id']),6,'000000',STR_PAD_LEFT),0,6);
1201 1644
 		    $data['ident'] = $line['callsign']; // ident
1202
-		    if (isset($line['pilotid'])) $data['pilot_id'] = $line['pilotid']; // pilot id
1203
-		    if (isset($line['name'])) $data['pilot_name'] = $line['name']; // pilot name
1204
-		    if (isset($line['alt'])) $data['altitude'] = $line['alt']; // altitude
1205
-		    if (isset($line['gs'])) $data['speed'] = $line['gs']; // speed
1206
-		    if (isset($line['heading'])) $data['heading'] = $line['heading']; // heading
1207
-		    if (isset($line['route'])) $data['waypoints'] = $line['route']; // route
1645
+		    if (isset($line['pilotid'])) {
1646
+		    	$data['pilot_id'] = $line['pilotid'];
1647
+		    }
1648
+		    // pilot id
1649
+		    if (isset($line['name'])) {
1650
+		    	$data['pilot_name'] = $line['name'];
1651
+		    }
1652
+		    // pilot name
1653
+		    if (isset($line['alt'])) {
1654
+		    	$data['altitude'] = $line['alt'];
1655
+		    }
1656
+		    // altitude
1657
+		    if (isset($line['gs'])) {
1658
+		    	$data['speed'] = $line['gs'];
1659
+		    }
1660
+		    // speed
1661
+		    if (isset($line['heading'])) {
1662
+		    	$data['heading'] = $line['heading'];
1663
+		    }
1664
+		    // heading
1665
+		    if (isset($line['route'])) {
1666
+		    	$data['waypoints'] = $line['route'];
1667
+		    }
1668
+		    // route
1208 1669
 		    $data['latitude'] = $line['lat']; // lat
1209 1670
 		    $data['longitude'] = $line['lon']; // long
1210 1671
 		    //$data['verticalrate'] = $line['vrt']; // verticale rate
1211 1672
 		    //$data['squawk'] = $line['squawk']; // squawk
1212 1673
 		    //$data['emergency'] = ''; // emergency
1213
-		    if (isset($line['depicao'])) $data['departure_airport_icao'] = $line['depicao'];
1214
-		    if (isset($line['deptime'])) $data['departure_airport_time'] = $line['deptime'];
1215
-		    if (isset($line['arricao'])) $data['arrival_airport_icao'] = $line['arricao'];
1674
+		    if (isset($line['depicao'])) {
1675
+		    	$data['departure_airport_icao'] = $line['depicao'];
1676
+		    }
1677
+		    if (isset($line['deptime'])) {
1678
+		    	$data['departure_airport_time'] = $line['deptime'];
1679
+		    }
1680
+		    if (isset($line['arricao'])) {
1681
+		    	$data['arrival_airport_icao'] = $line['arricao'];
1682
+		    }
1216 1683
 		    //$data['arrival_airport_time'] = $line['arrtime'];
1217
-		    if (isset($line['aircraft'])) $data['aircraft_icao'] = $line['aircraft'];
1218
-		    if (isset($line['transponder'])) $data['squawk'] = $line['transponder'];
1219
-		    if (isset($line['atis'])) $data['info'] = $line['atis'];
1220
-		    else $data['info'] = '';
1684
+		    if (isset($line['aircraft'])) {
1685
+		    	$data['aircraft_icao'] = $line['aircraft'];
1686
+		    }
1687
+		    if (isset($line['transponder'])) {
1688
+		    	$data['squawk'] = $line['transponder'];
1689
+		    }
1690
+		    if (isset($line['atis'])) {
1691
+		    	$data['info'] = $line['atis'];
1692
+		    } else {
1693
+		    	$data['info'] = '';
1694
+		    }
1221 1695
 		    $data['format_source'] = 'pireps';
1222 1696
     		    $data['id_source'] = $id_source;
1223 1697
 		    $data['datetime'] = date('Y-m-d H:i:s');
1224
-		    if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true;
1225
-		    if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name'];
1698
+		    if (isset($value['noarchive']) && $value['noarchive'] === TRUE) {
1699
+		    	$data['noarchive'] = true;
1700
+		    }
1701
+		    if (isset($value['name']) && $value['name'] != '') {
1702
+		    	$data['source_name'] = $value['name'];
1703
+		    }
1226 1704
 		    if ($line['icon'] === 'plane') {
1227 1705
 			$SI->add($data);
1228 1706
 		    //    print_r($data);
@@ -1231,16 +1709,28 @@  discard block
 block discarded – undo
1231 1709
 			$data['info'] = str_replace('&amp;sect;','',$data['info']);
1232 1710
 			$typec = substr($data['ident'],-3);
1233 1711
 			$data['type'] = '';
1234
-			if ($typec === 'APP') $data['type'] = 'Approach';
1235
-			elseif ($typec === 'TWR') $data['type'] = 'Tower';
1236
-			elseif ($typec === 'OBS') $data['type'] = 'Observer';
1237
-			elseif ($typec === 'GND') $data['type'] = 'Ground';
1238
-			elseif ($typec === 'DEL') $data['type'] = 'Delivery';
1239
-			elseif ($typec === 'DEP') $data['type'] = 'Departure';
1240
-			elseif ($typec === 'FSS') $data['type'] = 'Flight Service Station';
1241
-			elseif ($typec === 'CTR') $data['type'] = 'Control Radar or Centre';
1242
-			else $data['type'] = 'Observer';
1243
-			if (isset($ATC)) echo $ATC->add($data['ident'],'',$data['latitude'],$data['longitude'],'0',$data['info'],$data['datetime'],$data['type'],$data['pilot_id'],$data['pilot_name'],$data['format_source']);
1712
+			if ($typec === 'APP') {
1713
+				$data['type'] = 'Approach';
1714
+			} elseif ($typec === 'TWR') {
1715
+				$data['type'] = 'Tower';
1716
+			} elseif ($typec === 'OBS') {
1717
+				$data['type'] = 'Observer';
1718
+			} elseif ($typec === 'GND') {
1719
+				$data['type'] = 'Ground';
1720
+			} elseif ($typec === 'DEL') {
1721
+				$data['type'] = 'Delivery';
1722
+			} elseif ($typec === 'DEP') {
1723
+				$data['type'] = 'Departure';
1724
+			} elseif ($typec === 'FSS') {
1725
+				$data['type'] = 'Flight Service Station';
1726
+			} elseif ($typec === 'CTR') {
1727
+				$data['type'] = 'Control Radar or Centre';
1728
+			} else {
1729
+				$data['type'] = 'Observer';
1730
+			}
1731
+			if (isset($ATC)) {
1732
+				echo $ATC->add($data['ident'],'',$data['latitude'],$data['longitude'],'0',$data['info'],$data['datetime'],$data['type'],$data['pilot_id'],$data['pilot_name'],$data['format_source']);
1733
+			}
1244 1734
 		    }
1245 1735
 		    unset($data);
1246 1736
 		}
@@ -1255,7 +1745,9 @@  discard block
 block discarded – undo
1255 1745
 	    )
1256 1746
 	) {
1257 1747
 	    //$buffer = $Common->getData($hosts[$id]);
1258
-	    if ($globalDebug) echo 'Get Data...'."\n";
1748
+	    if ($globalDebug) {
1749
+	    	echo 'Get Data...'."\n";
1750
+	    }
1259 1751
 	    $buffer = $Common->getData($value['host']);
1260 1752
 	    $all_data = json_decode($buffer,true);
1261 1753
 	    if ($buffer != '' && is_array($all_data)) {
@@ -1263,10 +1755,16 @@  discard block
 block discarded – undo
1263 1755
 		foreach ($all_data as $line) {
1264 1756
 	    	    $data = array();
1265 1757
 	    	    //$data['id'] = $line['id']; // id not usable
1266
-	    	    if (isset($line['pilotid'])) $data['id'] = $line['pilotid'].$line['flightnum'];
1758
+	    	    if (isset($line['pilotid'])) {
1759
+	    	    	$data['id'] = $line['pilotid'].$line['flightnum'];
1760
+	    	    }
1267 1761
 	    	    $data['hex'] = substr(str_pad(bin2hex($line['flightnum']),6,'000000',STR_PAD_LEFT),-6); // hex
1268
-	    	    if (isset($line['pilotname'])) $data['pilot_name'] = $line['pilotname'];
1269
-	    	    if (isset($line['pilotid'])) $data['pilot_id'] = $line['pilotid'];
1762
+	    	    if (isset($line['pilotname'])) {
1763
+	    	    	$data['pilot_name'] = $line['pilotname'];
1764
+	    	    }
1765
+	    	    if (isset($line['pilotid'])) {
1766
+	    	    	$data['pilot_id'] = $line['pilotid'];
1767
+	    	    }
1270 1768
 	    	    $data['ident'] = $line['flightnum']; // ident
1271 1769
 	    	    $data['altitude'] = $line['alt']; // altitude
1272 1770
 	    	    $data['speed'] = $line['gs']; // speed
@@ -1282,7 +1780,9 @@  discard block
 block discarded – undo
1282 1780
 	    		$datetime = new DateTime($line['lastupdate'],new DateTimeZone($value['timezone']));
1283 1781
 	    		$datetime->setTimeZone(new DateTimeZone('UTC'));
1284 1782
 	    		$data['datetime'] = $datetime->format('Y-m-d H:i:s');
1285
-	    	    } else $data['datetime'] = date('Y-m-d H:i:s');
1783
+	    	    } else {
1784
+	    	    	$data['datetime'] = date('Y-m-d H:i:s');
1785
+	    	    }
1286 1786
 	    	    $data['departure_airport_icao'] = $line['depicao'];
1287 1787
 	    	    $data['departure_airport_time'] = $line['deptime'];
1288 1788
 	    	    $data['arrival_airport_icao'] = $line['arricao'];
@@ -1290,29 +1790,47 @@  discard block
 block discarded – undo
1290 1790
     		    if (isset($line['registration'])) {
1291 1791
     			$data['registration'] = $line['registration'];
1292 1792
     			//if (isset($line['aircraft'])) $data['id'] = $line['aircraft'];
1293
-    		    } else $data['registration'] = $line['aircraft'];
1294
-		    if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true;
1295
-		    if (isset($line['route'])) $data['waypoints'] = $line['route']; // route
1793
+    		    } else {
1794
+    		    	$data['registration'] = $line['aircraft'];
1795
+    		    }
1796
+		    if (isset($value['noarchive']) && $value['noarchive'] === TRUE) {
1797
+		    	$data['noarchive'] = true;
1798
+		    }
1799
+		    if (isset($line['route'])) {
1800
+		    	$data['waypoints'] = $line['route'];
1801
+		    }
1802
+		    // route
1296 1803
 		    if (isset($line['aircraftname'])) {
1297 1804
 			$line['aircraftname'] = strtoupper($line['aircraftname']);
1298 1805
 			$line['aircraftname'] = str_replace('BOEING ','B',$line['aircraftname']);
1299 1806
 	    		$aircraft_data = explode('-',$line['aircraftname']);
1300
-	    		if (isset($aircraft_data[1]) && strlen($aircraft_data[0]) >= 3 && strlen($aircraft_data[0]) <= 4) $data['aircraft_icao'] = $aircraft_data[0];
1301
-	    		elseif (isset($aircraft_data[1]) && strlen($aircraft_data[1]) >= 3 && strlen($aircraft_data[1]) <= 4) $data['aircraft_icao'] = $aircraft_data[1];
1302
-	    		else {
1807
+	    		if (isset($aircraft_data[1]) && strlen($aircraft_data[0]) >= 3 && strlen($aircraft_data[0]) <= 4) {
1808
+	    			$data['aircraft_icao'] = $aircraft_data[0];
1809
+	    		} elseif (isset($aircraft_data[1]) && strlen($aircraft_data[1]) >= 3 && strlen($aircraft_data[1]) <= 4) {
1810
+	    			$data['aircraft_icao'] = $aircraft_data[1];
1811
+	    		} else {
1303 1812
 	    		    $aircraft_data = explode(' ',$line['aircraftname']);
1304
-	    		    if (isset($aircraft_data[1])) $data['aircraft_icao'] = str_replace('-','',$aircraft_data[1]);
1305
-	    		    else $data['aircraft_icao'] = str_replace('-','',$line['aircraftname']);
1813
+	    		    if (isset($aircraft_data[1])) {
1814
+	    		    	$data['aircraft_icao'] = str_replace('-','',$aircraft_data[1]);
1815
+	    		    } else {
1816
+	    		    	$data['aircraft_icao'] = str_replace('-','',$line['aircraftname']);
1817
+	    		    }
1306 1818
 	    		}
1307 1819
 	    	    }
1308
-    		    if (isset($line['route'])) $data['waypoints'] = $line['route'];
1820
+    		    if (isset($line['route'])) {
1821
+    		    	$data['waypoints'] = $line['route'];
1822
+    		    }
1309 1823
     		    $data['id_source'] = $id_source;
1310 1824
 	    	    $data['format_source'] = 'phpvmacars';
1311
-		    if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name'];
1825
+		    if (isset($value['name']) && $value['name'] != '') {
1826
+		    	$data['source_name'] = $value['name'];
1827
+		    }
1312 1828
 		    $SI->add($data);
1313 1829
 		    unset($data);
1314 1830
 		}
1315
-		if ($globalDebug) echo 'No more data...'."\n";
1831
+		if ($globalDebug) {
1832
+			echo 'No more data...'."\n";
1833
+		}
1316 1834
 		unset($buffer);
1317 1835
 		unset($all_data);
1318 1836
 	    }
@@ -1325,7 +1843,9 @@  discard block
 block discarded – undo
1325 1843
 	    )
1326 1844
 	) {
1327 1845
 	    //$buffer = $Common->getData($hosts[$id]);
1328
-	    if ($globalDebug) echo 'Get Data...'."\n";
1846
+	    if ($globalDebug) {
1847
+	    	echo 'Get Data...'."\n";
1848
+	    }
1329 1849
 	    $buffer = $Common->getData($value['host']);
1330 1850
 	    $all_data = json_decode($buffer,true);
1331 1851
 	    if ($buffer != '' && is_array($all_data) && isset($all_data['ACARSData'])) {
@@ -1336,10 +1856,16 @@  discard block
 block discarded – undo
1336 1856
 	    	    //$data['id'] = $line['id']; // id not usable
1337 1857
 	    	    $data['id'] = $line['id'];
1338 1858
 	    	    //$data['hex'] = substr(str_pad(bin2hex($line['flightnum']),6,'000000',STR_PAD_LEFT),-6); // hex
1339
-	    	    if (isset($line['user']['username'])) $data['pilot_name'] = $line['user']['username'];
1340
-	    	    if (isset($line['user_id'])) $data['pilot_id'] = $line['user_id'];
1859
+	    	    if (isset($line['user']['username'])) {
1860
+	    	    	$data['pilot_name'] = $line['user']['username'];
1861
+	    	    }
1862
+	    	    if (isset($line['user_id'])) {
1863
+	    	    	$data['pilot_id'] = $line['user_id'];
1864
+	    	    }
1341 1865
 	    	    $data['ident'] = str_replace(' ','',$line['bid']['flightnum']); // ident
1342
-	    	    if (is_numeric($data['ident'])) $data['ident'] = $line['bid']['airline']['icao'].$data['ident'];
1866
+	    	    if (is_numeric($data['ident'])) {
1867
+	    	    	$data['ident'] = $line['bid']['airline']['icao'].$data['ident'];
1868
+	    	    }
1343 1869
 	    	    $data['altitude'] = $line['altitude']; // altitude
1344 1870
 	    	    $data['speed'] = $line['groundspeed']; // speed
1345 1871
 	    	    $data['heading'] = $line['heading']; // heading
@@ -1352,7 +1878,9 @@  discard block
 block discarded – undo
1352 1878
 	    		$datetime = new DateTime($line['updated_at'],new DateTimeZone($value['timezone']));
1353 1879
 	    		$datetime->setTimeZone(new DateTimeZone('UTC'));
1354 1880
 	    		$data['datetime'] = $datetime->format('Y-m-d H:i:s');
1355
-	    	    } else $data['datetime'] = date('Y-m-d H:i:s');
1881
+	    	    } else {
1882
+	    	    	$data['datetime'] = date('Y-m-d H:i:s');
1883
+	    	    }
1356 1884
 	    	    
1357 1885
 	    	    $data['departure_airport_icao'] = $line['bid']['depapt']['icao'];
1358 1886
 	    	    $data['departure_airport_time'] = $line['bid']['deptime'];
@@ -1360,17 +1888,26 @@  discard block
 block discarded – undo
1360 1888
 		    $data['arrival_airport_time'] = $line['bid']['arrtime'];
1361 1889
 		    $data['registration'] = $line['bid']['aircraft']['registration'];
1362 1890
 
1363
-		    if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true;
1364
-		    if (isset($line['bid']['route']) && $line['bid']['route'] != '') $data['waypoints'] = $line['bid']['route']; // route
1891
+		    if (isset($value['noarchive']) && $value['noarchive'] === TRUE) {
1892
+		    	$data['noarchive'] = true;
1893
+		    }
1894
+		    if (isset($line['bid']['route']) && $line['bid']['route'] != '') {
1895
+		    	$data['waypoints'] = $line['bid']['route'];
1896
+		    }
1897
+		    // route
1365 1898
 	    	    $data['aircraft_icao'] = $line['bid']['aircraft']['icao'];
1366 1899
 
1367 1900
     		    $data['id_source'] = $id_source;
1368 1901
 	    	    $data['format_source'] = 'vaos';
1369
-		    if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name'];
1902
+		    if (isset($value['name']) && $value['name'] != '') {
1903
+		    	$data['source_name'] = $value['name'];
1904
+		    }
1370 1905
 		    $SI->add($data);
1371 1906
 		    unset($data);
1372 1907
 		}
1373
-		if ($globalDebug) echo 'No more data...'."\n";
1908
+		if ($globalDebug) {
1909
+			echo 'No more data...'."\n";
1910
+		}
1374 1911
 		unset($buffer);
1375 1912
 		unset($all_data);
1376 1913
 	    }
@@ -1383,7 +1920,9 @@  discard block
 block discarded – undo
1383 1920
 	    )
1384 1921
 	) {
1385 1922
 	    //$buffer = $Common->getData($hosts[$id]);
1386
-	    if ($globalDebug) echo 'Get Data...'."\n";
1923
+	    if ($globalDebug) {
1924
+	    	echo 'Get Data...'."\n";
1925
+	    }
1387 1926
 	    $buffer = $Common->getData($value['host']);
1388 1927
 	    $all_data = json_decode($buffer,true);
1389 1928
 	    if ($buffer != '' && is_array($all_data)) {
@@ -1412,16 +1951,25 @@  discard block
 block discarded – undo
1412 1951
 	    	    $data['arrival_airport_icao'] = $line['arrival'];
1413 1952
     		    //$data['arrival_airport_time'] = $line['arrival_time'];
1414 1953
     		    //$data['registration'] = $line['aircraft'];
1415
-		    if (isset($line['route'])) $data['waypoints'] = $line['route']; // route
1954
+		    if (isset($line['route'])) {
1955
+		    	$data['waypoints'] = $line['route'];
1956
+		    }
1957
+		    // route
1416 1958
 	    	    $data['aircraft_icao'] = $line['plane_type'];
1417 1959
     		    $data['id_source'] = $id_source;
1418 1960
 	    	    $data['format_source'] = 'vam';
1419
-		    if (isset($value['noarchive']) && $value['noarchive'] === TRUE) $data['noarchive'] = true;
1420
-		    if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name'];
1961
+		    if (isset($value['noarchive']) && $value['noarchive'] === TRUE) {
1962
+		    	$data['noarchive'] = true;
1963
+		    }
1964
+		    if (isset($value['name']) && $value['name'] != '') {
1965
+		    	$data['source_name'] = $value['name'];
1966
+		    }
1421 1967
 		    $SI->add($data);
1422 1968
 		    unset($data);
1423 1969
 		}
1424
-		if ($globalDebug) echo 'No more data...'."\n";
1970
+		if ($globalDebug) {
1971
+			echo 'No more data...'."\n";
1972
+		}
1425 1973
 		unset($buffer);
1426 1974
 		unset($all_data);
1427 1975
 	    }
@@ -1434,7 +1982,9 @@  discard block
 block discarded – undo
1434 1982
 	    )
1435 1983
 	) {
1436 1984
 	    //$buffer = $Common->getData($hosts[$id]);
1437
-	    if ($globalDebug) echo 'Get Data...'."\n";
1985
+	    if ($globalDebug) {
1986
+	    	echo 'Get Data...'."\n";
1987
+	    }
1438 1988
 	    $buffer = $Common->getData($value['host']);
1439 1989
 	    $all_data = json_decode($buffer,true);
1440 1990
 	    if ($buffer != '') {
@@ -1452,12 +2002,16 @@  discard block
 block discarded – undo
1452 2002
 			$data['id_source'] = $id_source;
1453 2003
 			$data['format_source'] = 'blitzortung';
1454 2004
 			$SI->add($data);
1455
-			if ($globalDebug) echo '☈ Lightning added'."\n";
2005
+			if ($globalDebug) {
2006
+				echo '☈ Lightning added'."\n";
2007
+			}
1456 2008
 			$Source->addLocation('',$data['latitude'],$data['longitude'],0,'','','blitzortung','weather/thunderstorm.png','lightning',$id,0,$data['datetime']);
1457 2009
 			unset($data);
1458 2010
 		    }
1459 2011
 		}
1460
-		if ($globalDebug) echo 'No more data...'."\n";
2012
+		if ($globalDebug) {
2013
+			echo 'No more data...'."\n";
2014
+		}
1461 2015
 		unset($buffer);
1462 2016
 	    }
1463 2017
 	    $last_exec[$id]['last'] = time();
@@ -1469,7 +2023,9 @@  discard block
 block discarded – undo
1469 2023
 	    $write = NULL;
1470 2024
 	    $e = NULL;
1471 2025
 	    $n = socket_select($read, $write, $e, $timeout);
1472
-	    if ($e != NULL) var_dump($e);
2026
+	    if ($e != NULL) {
2027
+	    	var_dump($e);
2028
+	    }
1473 2029
 	    if ($n > 0) {
1474 2030
 		$reset = 0;
1475 2031
 		foreach ($read as $nb => $r) {
@@ -1491,13 +2047,17 @@  discard block
 block discarded – undo
1491 2047
 		    if ($buffer !== FALSE) {
1492 2048
 			if ($format === 'vrstcp') {
1493 2049
 			    $buffer = explode('},{',$buffer);
1494
-			} else $buffer=trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'',$buffer));
2050
+			} else {
2051
+				$buffer=trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'',$buffer));
2052
+			}
1495 2053
 		    }
1496 2054
 		    // SBS format is CSV format
1497 2055
 		    if ($buffer !== FALSE && $buffer !== '') {
1498 2056
 			$tt[$format] = 0;
1499 2057
 			if ($format === 'acarssbs3') {
1500
-			    if ($globalDebug) echo 'ACARS : '.$buffer."\n";
2058
+			    if ($globalDebug) {
2059
+			    	echo 'ACARS : '.$buffer."\n";
2060
+			    }
1501 2061
 			    $ACARS->add(trim($buffer));
1502 2062
 			    $ACARS->deleteLiveAcarsData();
1503 2063
 			} elseif ($format === 'raw') {
@@ -1506,30 +2066,70 @@  discard block
 block discarded – undo
1506 2066
 			    if (is_array($data)) {
1507 2067
 				$data['datetime'] = date('Y-m-d H:i:s');
1508 2068
 				$data['format_source'] = 'raw';
1509
-				if (isset($globalSources[$nb]['name']) && $globalSources[$nb]['name'] != '') $data['source_name'] = $globalSources[$nb]['name'];
1510
-				if (isset($globalSources[$nb]['sourcestats'])) $data['sourcestats'] = $globalSources[$nb]['sourcestats'];
1511
-				if (isset($globalSources[$nb]['noarchive']) && $globalSources[$nb]['noarchive'] === TRUE) $data['noarchive'] = true;
1512
-				if (($data['latitude'] === '' && $data['longitude'] === '') || (is_numeric($data['latitude']) && is_numeric($data['longitude']))) $SI->add($data);
2069
+				if (isset($globalSources[$nb]['name']) && $globalSources[$nb]['name'] != '') {
2070
+					$data['source_name'] = $globalSources[$nb]['name'];
2071
+				}
2072
+				if (isset($globalSources[$nb]['sourcestats'])) {
2073
+					$data['sourcestats'] = $globalSources[$nb]['sourcestats'];
2074
+				}
2075
+				if (isset($globalSources[$nb]['noarchive']) && $globalSources[$nb]['noarchive'] === TRUE) {
2076
+					$data['noarchive'] = true;
2077
+				}
2078
+				if (($data['latitude'] === '' && $data['longitude'] === '') || (is_numeric($data['latitude']) && is_numeric($data['longitude']))) {
2079
+					$SI->add($data);
2080
+				}
1513 2081
 			    }
1514 2082
 			} elseif ($format === 'ais') {
1515 2083
 			    $ais_data = $AIS->parse_line(trim($buffer));
1516 2084
 			    $data = array();
1517
-			    if (isset($ais_data['ident'])) $data['ident'] = $ais_data['ident'];
1518
-			    if (isset($ais_data['mmsi'])) $data['mmsi'] = substr($ais_data['mmsi'],-9);
1519
-			    if (isset($ais_data['speed'])) $data['speed'] = $ais_data['speed'];
1520
-			    if (isset($ais_data['heading'])) $data['heading'] = $ais_data['heading'];
1521
-			    if (isset($ais_data['latitude'])) $data['latitude'] = $ais_data['latitude'];
1522
-			    if (isset($ais_data['longitude'])) $data['longitude'] = $ais_data['longitude'];
1523
-			    if (isset($ais_data['status'])) $data['status'] = $ais_data['status'];
1524
-			    if (isset($ais_data['statusid'])) $data['status_id'] = $ais_data['statusid'];
1525
-			    if (isset($ais_data['type'])) $data['type'] = $ais_data['type'];
1526
-			    if (isset($ais_data['imo'])) $data['imo'] = $ais_data['imo'];
1527
-			    if (isset($ais_data['callsign'])) $data['callsign'] = $ais_data['callsign'];
1528
-			    if (isset($ais_data['destination'])) $data['arrival_code'] = $ais_data['destination'];
1529
-			    if (isset($ais_data['eta_ts'])) $data['arrival_date'] = date('Y-m-d H:i:s',$ais_data['eta_ts']);
1530
-			    if (isset($globalSources[$nb]['noarchive']) && $globalSources[$nb]['noarchive'] === TRUE) $data['noarchive'] = true;
1531
-			    if (isset($globalSources[$nb]['name']) && $globalSources[$nb]['name'] != '') $data['source_name'] = $globalSources[$nb]['name'];
1532
-			    if (isset($globalSources[$nb]['sourcestats'])) $data['sourcestats'] = $globalSources[$nb]['sourcestats'];
2085
+			    if (isset($ais_data['ident'])) {
2086
+			    	$data['ident'] = $ais_data['ident'];
2087
+			    }
2088
+			    if (isset($ais_data['mmsi'])) {
2089
+			    	$data['mmsi'] = substr($ais_data['mmsi'],-9);
2090
+			    }
2091
+			    if (isset($ais_data['speed'])) {
2092
+			    	$data['speed'] = $ais_data['speed'];
2093
+			    }
2094
+			    if (isset($ais_data['heading'])) {
2095
+			    	$data['heading'] = $ais_data['heading'];
2096
+			    }
2097
+			    if (isset($ais_data['latitude'])) {
2098
+			    	$data['latitude'] = $ais_data['latitude'];
2099
+			    }
2100
+			    if (isset($ais_data['longitude'])) {
2101
+			    	$data['longitude'] = $ais_data['longitude'];
2102
+			    }
2103
+			    if (isset($ais_data['status'])) {
2104
+			    	$data['status'] = $ais_data['status'];
2105
+			    }
2106
+			    if (isset($ais_data['statusid'])) {
2107
+			    	$data['status_id'] = $ais_data['statusid'];
2108
+			    }
2109
+			    if (isset($ais_data['type'])) {
2110
+			    	$data['type'] = $ais_data['type'];
2111
+			    }
2112
+			    if (isset($ais_data['imo'])) {
2113
+			    	$data['imo'] = $ais_data['imo'];
2114
+			    }
2115
+			    if (isset($ais_data['callsign'])) {
2116
+			    	$data['callsign'] = $ais_data['callsign'];
2117
+			    }
2118
+			    if (isset($ais_data['destination'])) {
2119
+			    	$data['arrival_code'] = $ais_data['destination'];
2120
+			    }
2121
+			    if (isset($ais_data['eta_ts'])) {
2122
+			    	$data['arrival_date'] = date('Y-m-d H:i:s',$ais_data['eta_ts']);
2123
+			    }
2124
+			    if (isset($globalSources[$nb]['noarchive']) && $globalSources[$nb]['noarchive'] === TRUE) {
2125
+			    	$data['noarchive'] = true;
2126
+			    }
2127
+			    if (isset($globalSources[$nb]['name']) && $globalSources[$nb]['name'] != '') {
2128
+			    	$data['source_name'] = $globalSources[$nb]['name'];
2129
+			    }
2130
+			    if (isset($globalSources[$nb]['sourcestats'])) {
2131
+			    	$data['sourcestats'] = $globalSources[$nb]['sourcestats'];
2132
+			    }
1533 2133
 
1534 2134
 			    if (isset($ais_data['timestamp'])) {
1535 2135
 				$data['datetime'] = date('Y-m-d H:i:s',$ais_data['timestamp']);
@@ -1538,7 +2138,9 @@  discard block
 block discarded – undo
1538 2138
 			    }
1539 2139
 			    $data['format_source'] = 'aisnmea';
1540 2140
     			    $data['id_source'] = $id_source;
1541
-			    if (isset($ais_data['mmsi_type']) && $ais_data['mmsi_type'] === 'Ship') $MI->add($data);
2141
+			    if (isset($ais_data['mmsi_type']) && $ais_data['mmsi_type'] === 'Ship') {
2142
+			    	$MI->add($data);
2143
+			    }
1542 2144
 			    unset($data);
1543 2145
                         } elseif ($format === 'flightgearsp') {
1544 2146
                     	    //echo $buffer."\n";
@@ -1556,12 +2158,18 @@  discard block
 block discarded – undo
1556 2158
 				$data['speed'] = round($line[5]*1.94384);
1557 2159
 				$data['datetime'] = date('Y-m-d H:i:s');
1558 2160
 				$data['format_source'] = 'flightgearsp';
1559
-				if (isset($globalSources[$nb]['noarchive']) && $globalSources[$nb]['noarchive'] === TRUE) $data['noarchive'] = true;
1560
-				if (($data['latitude'] === '' && $data['longitude'] === '') || (is_numeric($data['latitude']) && is_numeric($data['longitude']))) $SI->add($data);
2161
+				if (isset($globalSources[$nb]['noarchive']) && $globalSources[$nb]['noarchive'] === TRUE) {
2162
+					$data['noarchive'] = true;
2163
+				}
2164
+				if (($data['latitude'] === '' && $data['longitude'] === '') || (is_numeric($data['latitude']) && is_numeric($data['longitude']))) {
2165
+					$SI->add($data);
2166
+				}
1561 2167
 				//$send = @ socket_send( $r  , $data_aprs , strlen($data_aprs) , 0 );
1562 2168
 			    }
1563 2169
                         } elseif ($format === 'acars') {
1564
-                    	    if ($globalDebug) echo 'ACARS : '.$buffer."\n";
2170
+                    	    if ($globalDebug) {
2171
+                    	    	echo 'ACARS : '.$buffer."\n";
2172
+                    	    }
1565 2173
 			    $ACARS->add(trim($buffer));
1566 2174
 			    socket_sendto($r, "OK " . $buffer , 100 , 0 , $remote_ip , $remote_port);
1567 2175
 			    $ACARS->deleteLiveAcarsData();
@@ -1582,8 +2190,12 @@  discard block
 block discarded – undo
1582 2190
 				    $aircraft_type = $line[10];
1583 2191
 				    $aircraft_type = preg_split(':/:',$aircraft_type);
1584 2192
 				    $data['aircraft_name'] = substr(end($aircraft_type),0,-4);
1585
-				    if (isset($globalSources[$nb]['noarchive']) && $globalSources[$nb]['noarchive'] === TRUE) $data['noarchive'] = true;
1586
-				    if (($data['latitude'] === '' && $data['longitude'] === '') || (is_numeric($data['latitude']) && is_numeric($data['longitude']))) $SI->add($data);
2193
+				    if (isset($globalSources[$nb]['noarchive']) && $globalSources[$nb]['noarchive'] === TRUE) {
2194
+				    	$data['noarchive'] = true;
2195
+				    }
2196
+				    if (($data['latitude'] === '' && $data['longitude'] === '') || (is_numeric($data['latitude']) && is_numeric($data['longitude']))) {
2197
+				    	$SI->add($data);
2198
+				    }
1587 2199
 				}
1588 2200
 			    }
1589 2201
 			} elseif ($format === 'beast') {
@@ -1593,28 +2205,62 @@  discard block
 block discarded – undo
1593 2205
 			    foreach($buffer as $all_data) {
1594 2206
 				$line = json_decode('{'.$all_data.'}',true);
1595 2207
 				$data = array();
1596
-				if (isset($line['Icao'])) $data['hex'] = $line['Icao']; // hex
1597
-				if (isset($line['Call'])) $data['ident'] = $line['Call']; // ident
1598
-				if (isset($line['Alt'])) $data['altitude'] = $line['Alt']; // altitude
1599
-				if (isset($line['Spd'])) $data['speed'] = $line['Spd']; // speed
1600
-				if (isset($line['Trak'])) $data['heading'] = $line['Trak']; // heading
1601
-				if (isset($line['Lat'])) $data['latitude'] = $line['Lat']; // lat
1602
-				if (isset($line['Long'])) $data['longitude'] = $line['Long']; // long
2208
+				if (isset($line['Icao'])) {
2209
+					$data['hex'] = $line['Icao'];
2210
+				}
2211
+				// hex
2212
+				if (isset($line['Call'])) {
2213
+					$data['ident'] = $line['Call'];
2214
+				}
2215
+				// ident
2216
+				if (isset($line['Alt'])) {
2217
+					$data['altitude'] = $line['Alt'];
2218
+				}
2219
+				// altitude
2220
+				if (isset($line['Spd'])) {
2221
+					$data['speed'] = $line['Spd'];
2222
+				}
2223
+				// speed
2224
+				if (isset($line['Trak'])) {
2225
+					$data['heading'] = $line['Trak'];
2226
+				}
2227
+				// heading
2228
+				if (isset($line['Lat'])) {
2229
+					$data['latitude'] = $line['Lat'];
2230
+				}
2231
+				// lat
2232
+				if (isset($line['Long'])) {
2233
+					$data['longitude'] = $line['Long'];
2234
+				}
2235
+				// long
1603 2236
 				//$data['verticalrate'] = $line['']; // verticale rate
1604
-				if (isset($line['Sqk'])) $data['squawk'] = $line['Sqk']; // squawk
2237
+				if (isset($line['Sqk'])) {
2238
+					$data['squawk'] = $line['Sqk'];
2239
+				}
2240
+				// squawk
1605 2241
 				$data['emergency'] = ''; // emergency
1606
-				if (isset($line['Reg'])) $data['registration'] = $line['Reg'];
2242
+				if (isset($line['Reg'])) {
2243
+					$data['registration'] = $line['Reg'];
2244
+				}
1607 2245
 				/*
1608 2246
 				if (isset($line['PosTime'])) $data['datetime'] = date('Y-m-d H:i:s',$line['PosTime']/1000);
1609 2247
 				else $data['datetime'] = date('Y-m-d H:i:s');
1610 2248
 				*/
1611 2249
 				$data['datetime'] = date('Y-m-d H:i:s');
1612
-				if (isset($line['Type'])) $data['aircraft_icao'] = $line['Type'];
2250
+				if (isset($line['Type'])) {
2251
+					$data['aircraft_icao'] = $line['Type'];
2252
+				}
1613 2253
 		    		$data['format_source'] = 'vrstcp';
1614 2254
 				$data['id_source'] = $id_source;
1615
-				if (isset($globalSources[$nb]['noarchive']) && $globalSources[$nb]['noarchive'] === TRUE) $data['noarchive'] = true;
1616
-				if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name'];
1617
-				if (isset($data['latitude']) && isset($data['hex'])) $SI->add($data);
2255
+				if (isset($globalSources[$nb]['noarchive']) && $globalSources[$nb]['noarchive'] === TRUE) {
2256
+					$data['noarchive'] = true;
2257
+				}
2258
+				if (isset($value['name']) && $value['name'] != '') {
2259
+					$data['source_name'] = $value['name'];
2260
+				}
2261
+				if (isset($data['latitude']) && isset($data['hex'])) {
2262
+					$SI->add($data);
2263
+				}
1618 2264
 				unset($data);
1619 2265
 			    }
1620 2266
 			} elseif ($format === 'tsv' || substr($buffer,0,4) === 'clock') {
@@ -1627,22 +2273,46 @@  discard block
 block discarded – undo
1627 2273
     				$data['hex'] = $lined['hexid'];
1628 2274
     				//$data['datetime'] = date('Y-m-d H:i:s',strtotime($lined['clock']));;
1629 2275
     				$data['datetime'] = date('Y-m-d H:i:s');;
1630
-    				if (isset($lined['ident'])) $data['ident'] = $lined['ident'];
1631
-    				if (isset($lined['lat'])) $data['latitude'] = $lined['lat'];
1632
-    				if (isset($lined['lon'])) $data['longitude'] = $lined['lon'];
1633
-    				if (isset($lined['speed'])) $data['speed'] = $lined['speed'];
1634
-    				if (isset($lined['squawk'])) $data['squawk'] = $lined['squawk'];
1635
-    				if (isset($lined['alt'])) $data['altitude'] = $lined['alt'];
1636
-    				if (isset($lined['heading'])) $data['heading'] = $lined['heading'];
2276
+    				if (isset($lined['ident'])) {
2277
+    					$data['ident'] = $lined['ident'];
2278
+    				}
2279
+    				if (isset($lined['lat'])) {
2280
+    					$data['latitude'] = $lined['lat'];
2281
+    				}
2282
+    				if (isset($lined['lon'])) {
2283
+    					$data['longitude'] = $lined['lon'];
2284
+    				}
2285
+    				if (isset($lined['speed'])) {
2286
+    					$data['speed'] = $lined['speed'];
2287
+    				}
2288
+    				if (isset($lined['squawk'])) {
2289
+    					$data['squawk'] = $lined['squawk'];
2290
+    				}
2291
+    				if (isset($lined['alt'])) {
2292
+    					$data['altitude'] = $lined['alt'];
2293
+    				}
2294
+    				if (isset($lined['heading'])) {
2295
+    					$data['heading'] = $lined['heading'];
2296
+    				}
1637 2297
     				$data['id_source'] = $id_source;
1638 2298
     				$data['format_source'] = 'tsv';
1639
-    				if (isset($globalSources[$nb]['name']) && $globalSources[$nb]['name'] != '') $data['source_name'] = $globalSources[$nb]['name'];
1640
-    				if (isset($globalSources[$nb]['sourcestats'])) $data['sourcestats'] = $globalSources[$nb]['sourcestats'];
1641
-				if (isset($globalSources[$nb]['noarchive']) && $globalSources[$nb]['noarchive'] === TRUE) $data['noarchive'] = true;
1642
-    				if (($data['latitude'] === '' && $data['longitude'] === '') || (is_numeric($data['latitude']) && is_numeric($data['longitude']))) $SI->add($data);
2299
+    				if (isset($globalSources[$nb]['name']) && $globalSources[$nb]['name'] != '') {
2300
+    					$data['source_name'] = $globalSources[$nb]['name'];
2301
+    				}
2302
+    				if (isset($globalSources[$nb]['sourcestats'])) {
2303
+    					$data['sourcestats'] = $globalSources[$nb]['sourcestats'];
2304
+    				}
2305
+				if (isset($globalSources[$nb]['noarchive']) && $globalSources[$nb]['noarchive'] === TRUE) {
2306
+					$data['noarchive'] = true;
2307
+				}
2308
+    				if (($data['latitude'] === '' && $data['longitude'] === '') || (is_numeric($data['latitude']) && is_numeric($data['longitude']))) {
2309
+    					$SI->add($data);
2310
+    				}
1643 2311
     				unset($lined);
1644 2312
     				unset($data);
1645
-    			    } else $error = true;
2313
+    			    } else {
2314
+    			    	$error = true;
2315
+    			    }
1646 2316
 			} elseif ($format === 'aprs' && $use_aprs) {
1647 2317
 			    if ($aprs_connect === 0) {
1648 2318
 				$send = @ socket_send( $r  , $aprs_login , strlen($aprs_login) , 0 );
@@ -1668,63 +2338,121 @@  discard block
 block discarded – undo
1668 2338
 				    $aprs_last_tx = time();
1669 2339
 				    $data = array();
1670 2340
 				    //print_r($line);
1671
-				    if (isset($line['address'])) $data['hex'] = $line['address'];
1672
-				    if (isset($line['mmsi'])) $data['mmsi'] = $line['mmsi'];
1673
-				    if (isset($line['imo'])) $data['imo'] = $line['imo'];
1674
-				    if (isset($line['squawk'])) $data['squawk'] = $line['squawk'];
1675
-				    if (isset($line['arrival_code'])) $data['arrival_code'] = $line['arrival_code'];
1676
-				    if (isset($line['arrival_date'])) $data['arrival_date'] = $line['arrival_date'];
1677
-				    if (isset($line['typeid'])) $data['type_id'] = $line['typeid'];
1678
-				    if (isset($line['statusid'])) $data['status_id'] = $line['statusid'];
1679
-				    if (isset($line['timestamp'])) $data['datetime'] = date('Y-m-d H:i:s',$line['timestamp']);
1680
-				    else $data['datetime'] = date('Y-m-d H:i:s');
2341
+				    if (isset($line['address'])) {
2342
+				    	$data['hex'] = $line['address'];
2343
+				    }
2344
+				    if (isset($line['mmsi'])) {
2345
+				    	$data['mmsi'] = $line['mmsi'];
2346
+				    }
2347
+				    if (isset($line['imo'])) {
2348
+				    	$data['imo'] = $line['imo'];
2349
+				    }
2350
+				    if (isset($line['squawk'])) {
2351
+				    	$data['squawk'] = $line['squawk'];
2352
+				    }
2353
+				    if (isset($line['arrival_code'])) {
2354
+				    	$data['arrival_code'] = $line['arrival_code'];
2355
+				    }
2356
+				    if (isset($line['arrival_date'])) {
2357
+				    	$data['arrival_date'] = $line['arrival_date'];
2358
+				    }
2359
+				    if (isset($line['typeid'])) {
2360
+				    	$data['type_id'] = $line['typeid'];
2361
+				    }
2362
+				    if (isset($line['statusid'])) {
2363
+				    	$data['status_id'] = $line['statusid'];
2364
+				    }
2365
+				    if (isset($line['timestamp'])) {
2366
+				    	$data['datetime'] = date('Y-m-d H:i:s',$line['timestamp']);
2367
+				    } else {
2368
+				    	$data['datetime'] = date('Y-m-d H:i:s');
2369
+				    }
1681 2370
 				    //$data['datetime'] = date('Y-m-d H:i:s');
1682
-				    if (isset($line['ident'])) $data['ident'] = $line['ident'];
2371
+				    if (isset($line['ident'])) {
2372
+				    	$data['ident'] = $line['ident'];
2373
+				    }
1683 2374
 				    $data['latitude'] = $line['latitude'];
1684 2375
 				    $data['longitude'] = $line['longitude'];
1685 2376
 				    //$data['verticalrate'] = $line[16];
1686
-				    if (isset($line['speed'])) $data['speed'] = $line['speed'];
2377
+				    if (isset($line['speed'])) {
2378
+				    	$data['speed'] = $line['speed'];
2379
+				    }
1687 2380
 				    //else $data['speed'] = 0;
1688
-				    if (isset($line['altitude'])) $data['altitude'] = $line['altitude'];
1689
-				    if (isset($line['comment'])) $data['comment'] = $line['comment'];
1690
-				    if (isset($line['symbol'])) $data['type'] = $line['symbol'];
2381
+				    if (isset($line['altitude'])) {
2382
+				    	$data['altitude'] = $line['altitude'];
2383
+				    }
2384
+				    if (isset($line['comment'])) {
2385
+				    	$data['comment'] = $line['comment'];
2386
+				    }
2387
+				    if (isset($line['symbol'])) {
2388
+				    	$data['type'] = $line['symbol'];
2389
+				    }
1691 2390
 				    //if (isset($line['heading'])) $data['heading'] = $line['heading'];
1692 2391
 				    
1693
-				    if (isset($line['heading']) && isset($line['format_source'])) $data['heading'] = $line['heading'];
2392
+				    if (isset($line['heading']) && isset($line['format_source'])) {
2393
+				    	$data['heading'] = $line['heading'];
2394
+				    }
1694 2395
 				    //else echo 'No heading...'."\n";
1695 2396
 				    //else $data['heading'] = 0;
1696
-				    if (isset($line['stealth'])) $data['aircraft_type'] = $line['stealth'];
2397
+				    if (isset($line['stealth'])) {
2398
+				    	$data['aircraft_type'] = $line['stealth'];
2399
+				    }
1697 2400
 				    //if (!isset($line['source_type']) && (!isset($globalAPRSarchive) || (isset($globalAPRSarchive) && $globalAPRSarchive === FALSE))) $data['noarchive'] = true;
1698
-				    if (isset($globalAPRSarchive) && $globalAPRSarchive === FALSE) $data['noarchive'] = true;
1699
-				    elseif (isset($globalAPRSarchive) && $globalAPRSarchive === TRUE) $data['noarchive'] = false;
1700
-				    if (isset($globalSources[$nb]['noarchive']) && $globalSources[$nb]['noarchive'] === TRUE) $data['noarchive'] = true;
1701
-				    elseif (isset($globalSources[$nb]['noarchive']) && $globalSources[$nb]['noarchive'] === FALSE) $data['noarchive'] = false;
2401
+				    if (isset($globalAPRSarchive) && $globalAPRSarchive === FALSE) {
2402
+				    	$data['noarchive'] = true;
2403
+				    } elseif (isset($globalAPRSarchive) && $globalAPRSarchive === TRUE) {
2404
+				    	$data['noarchive'] = false;
2405
+				    }
2406
+				    if (isset($globalSources[$nb]['noarchive']) && $globalSources[$nb]['noarchive'] === TRUE) {
2407
+				    	$data['noarchive'] = true;
2408
+				    } elseif (isset($globalSources[$nb]['noarchive']) && $globalSources[$nb]['noarchive'] === FALSE) {
2409
+				    	$data['noarchive'] = false;
2410
+				    }
1702 2411
     				    $data['id_source'] = $id_source;
1703
-    				    if (isset($line['format_source'])) $data['format_source'] = $line['format_source'];
1704
-				    else $data['format_source'] = 'aprs';
2412
+    				    if (isset($line['format_source'])) {
2413
+    				    	$data['format_source'] = $line['format_source'];
2414
+    				    } else {
2415
+				    	$data['format_source'] = 'aprs';
2416
+				    }
1705 2417
 				    $data['source_name'] = $line['source'];
1706
-				    if (isset($line['source_type'])) $data['source_type'] = $line['source_type'];
1707
-				    else $data['source_type'] = 'flarm';
1708
-    				    if (isset($globalSources[$nb]['sourcestats'])) $data['sourcestats'] = $globalSources[$nb]['sourcestats'];
2418
+				    if (isset($line['source_type'])) {
2419
+				    	$data['source_type'] = $line['source_type'];
2420
+				    } else {
2421
+				    	$data['source_type'] = 'flarm';
2422
+				    }
2423
+    				    if (isset($globalSources[$nb]['sourcestats'])) {
2424
+    				    	$data['sourcestats'] = $globalSources[$nb]['sourcestats'];
2425
+    				    }
1709 2426
 				    $currentdate = date('Y-m-d H:i:s');
1710 2427
 				    $aprsdate = strtotime($data['datetime']);
1711
-				    if ($data['source_type'] != 'modes' && $data['source_type'] != 'ais') $data['altitude_relative'] = 'AMSL';
2428
+				    if ($data['source_type'] != 'modes' && $data['source_type'] != 'ais') {
2429
+				    	$data['altitude_relative'] = 'AMSL';
2430
+				    }
1712 2431
 				    // Accept data if time <= system time + 20s
1713 2432
 				    //if (($data['source_type'] === 'modes') || isset($line['stealth']) && ($line['stealth'] === 0 || $line['stealth'] === '') && (strtotime($data['datetime']) <= strtotime($currentdate)+20) && (($data['latitude'] === '' && $data['longitude'] === '') || (is_numeric($data['latitude']) && is_numeric($data['longitude'])))) {
1714 2433
 				    if (($data['source_type'] === 'modes') || isset($line['stealth']) && (!isset($data['hex']) || $data['hex'] != 'FFFFFF') && ($line['stealth'] === 0 || $line['stealth'] === '') && (($data['latitude'] === '' && $data['longitude'] === '') || (is_numeric($data['latitude']) && is_numeric($data['longitude'])))) {
1715 2434
 					$send = $SI->add($data);
1716 2435
 				    } elseif ($data['source_type'] === 'ais') {
1717 2436
 					$data['type'] = '';
1718
-					if (isset($globalMarine) && $globalMarine) $send = $MI->add($data);
2437
+					if (isset($globalMarine) && $globalMarine) {
2438
+						$send = $MI->add($data);
2439
+					}
1719 2440
 				    } elseif (isset($line['stealth'])) {
1720
-					if ($line['stealth'] != 0) echo '-------- '.$data['ident'].' : APRS stealth ON => not adding'."\n";
1721
-					else echo '--------- '.$data['ident'].' : Date APRS : '.$data['datetime'].' - Current date : '.$currentdate.' => not adding future event'."\n";
2441
+					if ($line['stealth'] != 0) {
2442
+						echo '-------- '.$data['ident'].' : APRS stealth ON => not adding'."\n";
2443
+					} else {
2444
+						echo '--------- '.$data['ident'].' : Date APRS : '.$data['datetime'].' - Current date : '.$currentdate.' => not adding future event'."\n";
2445
+					}
1722 2446
 				    } elseif (isset($globalAircraft) && $globalAircraft && isset($line['symbol']) && isset($line['latitude']) && isset($line['longitude']) && (
1723 2447
 					    //$line['symbol'] === 'Balloon' ||
1724 2448
 					    $line['symbol'] === 'Glider' || 
1725 2449
 					    $line['symbol'] === 'Aircraft (small)' || $line['symbol'] === 'Helicopter')) {
1726
-					    if ($line['symbol'] === 'Ballon') $data['aircraft_icao'] = 'BALL';
1727
-					    if ($line['symbol'] === 'Glider') $data['aircraft_icao'] = 'PARAGLIDER';
2450
+					    if ($line['symbol'] === 'Ballon') {
2451
+					    	$data['aircraft_icao'] = 'BALL';
2452
+					    }
2453
+					    if ($line['symbol'] === 'Glider') {
2454
+					    	$data['aircraft_icao'] = 'PARAGLIDER';
2455
+					    }
1728 2456
 					    $send = $SI->add($data);
1729 2457
 				    } elseif (isset($globalMarine) && $globalMarine && isset($line['symbol']) && isset($line['latitude']) && isset($line['longitude']) && (
1730 2458
 					    $line['symbol'] === 'Yacht (Sail)' || 
@@ -1755,9 +2483,13 @@  discard block
 block discarded – undo
1755 2483
 				    //} elseif (isset($line['symbol']) && isset($line['latitude']) && isset($line['longitude']) && isset($line['speed']) && $line['symbol'] != 'Weather Station' && $line['symbol'] != 'House QTH (VHF)' && $line['symbol'] != 'Dot' && $line['symbol'] != 'TCP-IP' && $line['symbol'] != 'xAPRS (UNIX)' && $line['symbol'] != 'Antenna' && $line['symbol'] != 'Cloudy' && $line['symbol'] != 'HF Gateway' && $line['symbol'] != 'Yagi At QTH' && $line['symbol'] != 'Digi' && $line['symbol'] != '8' && $line['symbol'] != 'MacAPRS') {
1756 2484
 				//    } elseif (isset($line['symbol']) && isset($line['latitude']) && isset($line['longitude']) && $line['symbol'] != 'Weather Station' && $line['symbol'] != 'House QTH (VHF)' && $line['symbol'] != 'Dot' && $line['symbol'] != 'TCP-IP' && $line['symbol'] != 'xAPRS (UNIX)' && $line['symbol'] != 'Antenna' && $line['symbol'] != 'Cloudy' && $line['symbol'] != 'HF Gateway' && $line['symbol'] != 'Yagi At QTH' && $line['symbol'] != 'Digi' && $line['symbol'] != '8' && $line['symbol'] != 'MacAPRS') {
1757 2485
 					//echo '!!!!!!!!!!!!!!!! SEND !!!!!!!!!!!!!!!!!!!!'."\n";
1758
-					if (isset($globalTracker) && $globalTracker) $send = $TI->add($data);
2486
+					if (isset($globalTracker) && $globalTracker) {
2487
+						$send = $TI->add($data);
2488
+					}
1759 2489
 				    } elseif (!isset($line['stealth']) && is_numeric($data['latitude']) && is_numeric($data['longitude']) && isset($data['ident']) && isset($data['altitude'])) {
1760
-					if (!isset($data['altitude'])) $data['altitude'] = 0;
2490
+					if (!isset($data['altitude'])) {
2491
+						$data['altitude'] = 0;
2492
+					}
1761 2493
 					$Source->deleteOldLocationByType('gs');
1762 2494
 					if (count($Source->getLocationInfoByNameType($data['ident'],'gs')) > 0) {
1763 2495
 						$Source->updateLocation($data['ident'],$data['latitude'],$data['longitude'],$data['altitude'],'','',$data['source_name'],'antenna.png','gs',$id,0,$data['datetime']);
@@ -1766,7 +2498,9 @@  discard block
 block discarded – undo
1766 2498
 					}
1767 2499
 				    } elseif (isset($line['symbol']) && $line['symbol'] === 'Weather Station') {
1768 2500
 					//if ($globalDebug) echo '!! Weather Station not yet supported'."\n";
1769
-					if ($globalDebug) echo '# Weather Station added'."\n";
2501
+					if ($globalDebug) {
2502
+						echo '# Weather Station added'."\n";
2503
+					}
1770 2504
 					$Source->deleteOldLocationByType('wx');
1771 2505
 					$weather_data = json_encode($line);
1772 2506
 					if (count($Source->getLocationInfoByNameType($data['ident'],'wx')) > 0) {
@@ -1776,7 +2510,9 @@  discard block
 block discarded – undo
1776 2510
 					}
1777 2511
 				    } elseif (isset($line['symbol']) && ($line['symbol'] === 'Lightning' || $line['symbol'] === 'Thunderstorm')) {
1778 2512
 					//if ($globalDebug) echo '!! Weather Station not yet supported'."\n";
1779
-					if ($globalDebug) echo '☈ Lightning added'."\n";
2513
+					if ($globalDebug) {
2514
+						echo '☈ Lightning added'."\n";
2515
+					}
1780 2516
 					$Source->deleteOldLocationByType('lightning');
1781 2517
 					if (count($Source->getLocationInfoByNameType($data['ident'],'lightning')) > 0) {
1782 2518
 						$Source->updateLocation($data['ident'],$data['latitude'],$data['longitude'],0,'','',$data['source_name'],'weather/thunderstorm.png','lightning',$id,0,$data['datetime'],$data['comment']);
@@ -1788,8 +2524,7 @@  discard block
 block discarded – undo
1788 2524
 				    	print_r($line);
1789 2525
 				    }
1790 2526
 				    unset($data);
1791
-				}
1792
-				elseif (is_array($line) && isset($line['ident']) && $line['ident'] != '') {
2527
+				} elseif (is_array($line) && isset($line['ident']) && $line['ident'] != '') {
1793 2528
 					$Source->updateLocationDescByName($line['ident'],$line['source'],$id,$line['comment']);
1794 2529
 				}
1795 2530
 				/*
@@ -1798,7 +2533,9 @@  discard block
 block discarded – undo
1798 2533
 				}
1799 2534
 				*/
1800 2535
 				//elseif ($line === false && $globalDebug) echo 'Ignored ('.$buffer.")\n";
1801
-				elseif ($line === true && $globalDebug) echo '!! Failed : '.$buffer."!!\n";
2536
+				elseif ($line === true && $globalDebug) {
2537
+					echo '!! Failed : '.$buffer."!!\n";
2538
+				}
1802 2539
 				if (isset($globalSources[$nb]['last_weather_clean']) && time()-$globalSources[$nb]['last_weather_clean'] > 60*5) {
1803 2540
 					$Source->deleteOldLocationByType('lightning');
1804 2541
 					$Source->deleteOldLocationByType('wx');
@@ -1834,27 +2571,47 @@  discard block
 block discarded – undo
1834 2571
     				$data['ground'] = $line[21];
1835 2572
     				$data['emergency'] = $line[19];
1836 2573
     				$data['format_source'] = 'sbs';
1837
-				if (isset($globalSources[$nb]['name']) && $globalSources[$nb]['name'] != '') $data['source_name'] = $globalSources[$nb]['name'];
1838
-				elseif ($line[0] == 'MLAT') $data['source_name'] = 'MLAT';
1839
-    				if (isset($globalSources[$nb]['sourcestats'])) $data['sourcestats'] = $globalSources[$nb]['sourcestats'];
1840
-				if (isset($globalSources[$nb]['noarchive']) && $globalSources[$nb]['noarchive'] === TRUE) $data['noarchive'] = true;
2574
+				if (isset($globalSources[$nb]['name']) && $globalSources[$nb]['name'] != '') {
2575
+					$data['source_name'] = $globalSources[$nb]['name'];
2576
+				} elseif ($line[0] == 'MLAT') {
2577
+					$data['source_name'] = 'MLAT';
2578
+				}
2579
+    				if (isset($globalSources[$nb]['sourcestats'])) {
2580
+    					$data['sourcestats'] = $globalSources[$nb]['sourcestats'];
2581
+    				}
2582
+				if (isset($globalSources[$nb]['noarchive']) && $globalSources[$nb]['noarchive'] === TRUE) {
2583
+					$data['noarchive'] = true;
2584
+				}
1841 2585
     				$data['id_source'] = $id_source;
1842
-    				if (($data['latitude'] === '' && $data['longitude'] === '') || (is_numeric($data['latitude']) && is_numeric($data['longitude']))) $send = $SI->add($data);
1843
-    				else $error = true;
2586
+    				if (($data['latitude'] === '' && $data['longitude'] === '') || (is_numeric($data['latitude']) && is_numeric($data['longitude']))) {
2587
+    					$send = $SI->add($data);
2588
+    				} else {
2589
+    					$error = true;
2590
+    				}
1844 2591
     				unset($data);
1845
-    			    } else $error = true;
2592
+    			    } else {
2593
+    			    	$error = true;
2594
+    			    }
1846 2595
 			    if ($error) {
1847 2596
 				if (count($line) > 1 && ($line[0] === 'STA' || $line[0] === 'AIR' || $line[0] === 'SEL' || $line[0] === 'ID' || $line[0] === 'CLK')) { 
1848
-					if ($globalDebug) echo "Not a message. Ignoring... \n";
2597
+					if ($globalDebug) {
2598
+						echo "Not a message. Ignoring... \n";
2599
+					}
1849 2600
 				} else {
1850
-					if ($globalDebug) echo "Wrong line format. Ignoring... \n";
2601
+					if ($globalDebug) {
2602
+						echo "Wrong line format. Ignoring... \n";
2603
+					}
1851 2604
 					if ($globalDebug) {
1852 2605
 						echo $buffer;
1853 2606
 						//print_r($line);
1854 2607
 					}
1855 2608
 					//socket_close($r);
1856
-					if ($globalDebug) echo "Reconnect after an error...\n";
1857
-					if ($format === 'aprs') $aprs_connect = 0;
2609
+					if ($globalDebug) {
2610
+						echo "Reconnect after an error...\n";
2611
+					}
2612
+					if ($format === 'aprs') {
2613
+						$aprs_connect = 0;
2614
+					}
1858 2615
 					$sourceer[$nb] = $globalSources[$nb];
1859 2616
 					connect_all($sourceer);
1860 2617
 					$sourceer = array();
@@ -1862,10 +2619,14 @@  discard block
 block discarded – undo
1862 2619
 			    }
1863 2620
 			}
1864 2621
 			// Sleep for xxx microseconds
1865
-			if (isset($globalSBSSleep)) usleep($globalSBSSleep);
2622
+			if (isset($globalSBSSleep)) {
2623
+				usleep($globalSBSSleep);
2624
+			}
1866 2625
 		    } else {
1867 2626
 			if ($format === 'flightgearmp') {
1868
-			    	if ($globalDebug) echo "Reconnect FlightGear MP...";
2627
+			    	if ($globalDebug) {
2628
+			    		echo "Reconnect FlightGear MP...";
2629
+			    	}
1869 2630
 				//@socket_close($r);
1870 2631
 				sleep($globalMinFetch);
1871 2632
 				$sourcefg[$nb] = $globalSources[$nb];
@@ -1874,10 +2635,15 @@  discard block
 block discarded – undo
1874 2635
 				break;
1875 2636
 				
1876 2637
 			} elseif ($format != 'acars' && $format != 'flightgearsp') {
1877
-			    if (isset($tt[$format])) $tt[$format]++;
1878
-			    else $tt[$format] = 0;
2638
+			    if (isset($tt[$format])) {
2639
+			    	$tt[$format]++;
2640
+			    } else {
2641
+			    	$tt[$format] = 0;
2642
+			    }
1879 2643
 			    if ($tt[$format] > 30 || $buffer === FALSE) {
1880
-				if ($globalDebug) echo "ERROR : Reconnect ".$format."...";
2644
+				if ($globalDebug) {
2645
+					echo "ERROR : Reconnect ".$format."...";
2646
+				}
1881 2647
 				//@socket_close($r);
1882 2648
 				sleep(2);
1883 2649
 				$aprs_connect = 0;
@@ -1895,11 +2661,17 @@  discard block
 block discarded – undo
1895 2661
 	    } else {
1896 2662
 		$error = socket_strerror(socket_last_error());
1897 2663
 		if (($error != SOCKET_EINPROGRESS && $error != SOCKET_EALREADY && $error != 'Success') || (time() - $time >= $timeout && $error != 'Success')) {
1898
-			if ($globalDebug) echo "ERROR : socket_select give this error ".$error . "\n";
1899
-			if (isset($globalDebug)) echo "Restarting...\n";
2664
+			if ($globalDebug) {
2665
+				echo "ERROR : socket_select give this error ".$error . "\n";
2666
+			}
2667
+			if (isset($globalDebug)) {
2668
+				echo "Restarting...\n";
2669
+			}
1900 2670
 			// Restart the script if possible
1901 2671
 			if (is_array($sockets)) {
1902
-			    if ($globalDebug) echo "Shutdown all sockets...";
2672
+			    if ($globalDebug) {
2673
+			    	echo "Shutdown all sockets...";
2674
+			    }
1903 2675
 			    
1904 2676
 			    foreach ($sockets as $sock) {
1905 2677
 				@socket_shutdown($sock,2);
@@ -1907,25 +2679,45 @@  discard block
 block discarded – undo
1907 2679
 			    }
1908 2680
 			    
1909 2681
 			}
1910
-			if ($globalDebug) echo "Waiting...";
2682
+			if ($globalDebug) {
2683
+				echo "Waiting...";
2684
+			}
1911 2685
 			sleep(2);
1912 2686
 			$time = time();
1913 2687
 			//connect_all($hosts);
1914 2688
 			$aprs_connect = 0;
1915
-			if ($reset%5 === 0) sleep(20);
1916
-			if ($reset%10 === 0) sleep(100);
1917
-			if ($reset%20 === 0) sleep(200);
1918
-			if ($reset > 100) exit('Too many attempts...');
1919
-			if ($globalDebug) echo "Restart all connections...";
2689
+			if ($reset%5 === 0) {
2690
+				sleep(20);
2691
+			}
2692
+			if ($reset%10 === 0) {
2693
+				sleep(100);
2694
+			}
2695
+			if ($reset%20 === 0) {
2696
+				sleep(200);
2697
+			}
2698
+			if ($reset > 100) {
2699
+				exit('Too many attempts...');
2700
+			}
2701
+			if ($globalDebug) {
2702
+				echo "Restart all connections...";
2703
+			}
1920 2704
 			connect_all($globalSources);
1921 2705
 		}
1922 2706
 	    }
1923 2707
 	}
1924 2708
 	if ($globalDaemon === false) {
1925
-	    if ($globalDebug) echo 'Check all...'."\n";
1926
-	    if (isset($SI)) $SI->checkAll();
1927
-	    if (isset($TI)) $TI->checkAll();
1928
-	    if (isset($MI)) $MI->checkAll();
2709
+	    if ($globalDebug) {
2710
+	    	echo 'Check all...'."\n";
2711
+	    }
2712
+	    if (isset($SI)) {
2713
+	    	$SI->checkAll();
2714
+	    }
2715
+	    if (isset($TI)) {
2716
+	    	$TI->checkAll();
2717
+	    }
2718
+	    if (isset($MI)) {
2719
+	    	$MI->checkAll();
2720
+	    }
1929 2721
 	}
1930 2722
     }
1931 2723
 }
Please login to merge, or discard this patch.
js/map-aircraft.2d.js.php 1 patch
Braces   +63 added lines, -17 removed lines patch added patch discarded remove patch
@@ -3,18 +3,31 @@  discard block
 block discarded – undo
3 3
 require_once('../require/class.Language.php'); 
4 4
 
5 5
 // Compressed GeoJson is used if true
6
-if (!isset($globalJsonCompress)) $compress = true;
7
-else $compress = $globalJsonCompress;
6
+if (!isset($globalJsonCompress)) {
7
+	$compress = true;
8
+} else {
9
+	$compress = $globalJsonCompress;
10
+}
8 11
 
9
-if (isset($_GET['ident'])) $ident = filter_input(INPUT_GET,'ident',FILTER_SANITIZE_STRING);
10
-if (isset($_GET['flightaware_id'])) $flightaware_id = filter_input(INPUT_GET,'flightaware_id',FILTER_SANITIZE_STRING);
12
+if (isset($_GET['ident'])) {
13
+	$ident = filter_input(INPUT_GET,'ident',FILTER_SANITIZE_STRING);
14
+}
15
+if (isset($_GET['flightaware_id'])) {
16
+	$flightaware_id = filter_input(INPUT_GET,'flightaware_id',FILTER_SANITIZE_STRING);
17
+}
11 18
 $archive = false;
12
-if (isset($_COOKIE['archive_begin']) && $_COOKIE['archive_begin'] != '') $archive = true;
19
+if (isset($_COOKIE['archive_begin']) && $_COOKIE['archive_begin'] != '') {
20
+	$archive = true;
21
+}
13 22
 ?>
14 23
 <?php
15
-if (isset($_COOKIE['IconColor'])) $IconColor = $_COOKIE['IconColor'];
16
-elseif (isset($globalAircraftIconColor)) $IconColor = $globalAircraftIconColor;
17
-else $IconColor = '1a3151';
24
+if (isset($_COOKIE['IconColor'])) {
25
+	$IconColor = $_COOKIE['IconColor'];
26
+} elseif (isset($globalAircraftIconColor)) {
27
+	$IconColor = $globalAircraftIconColor;
28
+} else {
29
+	$IconColor = '1a3151';
30
+}
18 31
 ?>
19 32
 
20 33
 
@@ -81,9 +94,12 @@  discard block
 block discarded – undo
81 94
 
82 95
 function update_airportsLayer() {
83 96
 <?php
84
-	if (isset($_COOKIE['AirportZoom'])) $getZoom = $_COOKIE['AirportZoom'];
85
-	else $getZoom = '7';
86
-?>
97
+	if (isset($_COOKIE['AirportZoom'])) {
98
+		$getZoom = $_COOKIE['AirportZoom'];
99
+	} else {
100
+		$getZoom = '7';
101
+	}
102
+	?>
87 103
 	if (typeof airportsLayer != 'undefined') {
88 104
 		if (map.hasLayer(airportsLayer) == true) {
89 105
 			map.removeLayer(airportsLayer);
@@ -366,7 +382,12 @@  discard block
 block discarded – undo
366 382
 <?php
367 383
 		} else {
368 384
 ?>
369
-					var movingtime = Math.round(<?php if (isset($archiveupdatetime)) print $archiveupdatetime*1000; else print $globalMapRefresh*1000+20000; ?>+feature.properties.sqt*1000);
385
+					var movingtime = Math.round(<?php if (isset($archiveupdatetime)) {
386
+	print $archiveupdatetime*1000;
387
+} else {
388
+	print $globalMapRefresh*1000+20000;
389
+}
390
+?>+feature.properties.sqt*1000);
370 391
 					return new L.Marker.movingMarker([latLng, feature.properties.nextlatlon],[movingtime],{
371 392
 <?php
372 393
 		}
@@ -416,7 +437,12 @@  discard block
 block discarded – undo
416 437
 <?php
417 438
 		} else {
418 439
 ?>
419
-						var movingtime = Math.round(<?php if (isset($archiveupdatetime)) print $archiveupdatetime*1000; else print $globalMapRefresh*1000+20000; ?>+feature.properties.sqt*1000);
440
+						var movingtime = Math.round(<?php if (isset($archiveupdatetime)) {
441
+	print $archiveupdatetime*1000;
442
+} else {
443
+	print $globalMapRefresh*1000+20000;
444
+}
445
+?>+feature.properties.sqt*1000);
420 446
 						return new L.Marker.movingMarker([latLng, feature.properties.nextlatlon],[movingtime],{
421 447
 <?php
422 448
 		}
@@ -463,7 +489,12 @@  discard block
 block discarded – undo
463 489
 <?php
464 490
 		} else {
465 491
 ?>
466
-							var movingtime = Math.round(<?php if (isset($archiveupdatetime)) print $archiveupdatetime*1000; else print $globalMapRefresh*1000+20000; ?>+feature.properties.sqt*1000);
492
+							var movingtime = Math.round(<?php if (isset($archiveupdatetime)) {
493
+	print $archiveupdatetime*1000;
494
+} else {
495
+	print $globalMapRefresh*1000+20000;
496
+}
497
+?>+feature.properties.sqt*1000);
467 498
 							return new L.Marker.movingMarker([latLng, feature.properties.nextlatlon],[movingtime],{
468 499
 <?php
469 500
 		}
@@ -916,7 +947,12 @@  discard block
 block discarded – undo
916 947
 	} else {
917 948
 ?>
918 949
 	//then load it again every 30 seconds
919
-	reloadPage = setInterval(function(){if (noTimeout) getLiveData(0)},<?php if (isset($globalMapRefresh)) print $globalMapRefresh*1000; else print '30000'; ?>);
950
+	reloadPage = setInterval(function(){if (noTimeout) getLiveData(0)},<?php if (isset($globalMapRefresh)) {
951
+	print $globalMapRefresh*1000;
952
+} else {
953
+	print '30000';
954
+}
955
+?>);
920 956
 	var currentdate = new Date();
921 957
 	var currentyear = new Date().getFullYear();
922 958
 	var begindate = new Date(Date.UTC(currentyear,11,24,2,0,0,0));
@@ -928,7 +964,12 @@  discard block
 block discarded – undo
928 964
 		if (!((isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS)) && (isset($_COOKIE['polar']) && $_COOKIE['polar'] == 'true')) {
929 965
 ?>
930 966
 	update_polarLayer();
931
-	setInterval(function(){map.removeLayer(polarLayer);update_polarLayer()},<?php if (isset($globalMapRefresh)) print $globalMapRefresh*1000*2; else print '60000'; ?>);
967
+	setInterval(function(){map.removeLayer(polarLayer);update_polarLayer()},<?php if (isset($globalMapRefresh)) {
968
+	print $globalMapRefresh*1000*2;
969
+} else {
970
+	print '60000';
971
+}
972
+?>);
932 973
 <?php
933 974
 		}
934 975
 ?>
@@ -943,7 +984,12 @@  discard block
 block discarded – undo
943 984
 	if ((isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM)) {
944 985
 ?>
945 986
 	update_atcLayer();
946
-	setInterval(function(){map.removeLayer(atcLayer);update_atcLayer()},<?php if (isset($globalMapRefresh)) print $globalMapRefresh*1000*2; else print '60000'; ?>);
987
+	setInterval(function(){map.removeLayer(atcLayer);update_atcLayer()},<?php if (isset($globalMapRefresh)) {
988
+	print $globalMapRefresh*1000*2;
989
+} else {
990
+	print '60000';
991
+}
992
+?>);
947 993
 <?php
948 994
 	}
949 995
 ?>
Please login to merge, or discard this patch.
live-geojson.php 1 patch
Braces   +321 added lines, -130 removed lines patch added patch discarded remove patch
@@ -12,7 +12,9 @@  discard block
 block discarded – undo
12 12
 $tracker = false;
13 13
 $marine = false;
14 14
 $usecoord = false;
15
-if (isset($_GET['test'])) exit();
15
+if (isset($_GET['test'])) {
16
+	exit();
17
+}
16 18
 if (isset($_GET['tracker'])) {
17 19
     $tracker = true;
18 20
 }
@@ -57,28 +59,55 @@  discard block
 block discarded – undo
57 59
 }
58 60
 header('Content-Type: text/javascript');
59 61
 
60
-if (!isset($globalJsonCompress)) $compress = true;
61
-else $compress = $globalJsonCompress;
62
+if (!isset($globalJsonCompress)) {
63
+	$compress = true;
64
+} else {
65
+	$compress = $globalJsonCompress;
66
+}
62 67
 
63 68
 $from_archive = false;
64 69
 $min = true;
65 70
 $allhistory = false;
66 71
 $filter['source'] = array();
67
-if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') $filter['source'] = array_merge($filter['source'],array('vatsimtxt'));
68
-if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') $filter['source'] = array_merge($filter['source'],array('whazzup'));
69
-if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') $filter['source'] = array_merge($filter['source'],array('phpvmacars'));
70
-if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') $filter['source'] = array_merge($filter['source'],array('sbs','famaprs'));
71
-if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') $filter['source'] = array_merge($filter['source'],array('aprs'));
72
-if (isset($_COOKIE['filter_ident']) && $_COOKIE['filter_ident'] != '') $filter['ident'] = filter_var($_COOKIE['filter_ident'],FILTER_SANITIZE_STRING);
73
-if (isset($_COOKIE['filter_mmsi']) && $_COOKIE['filter_mmsi'] != '') $filter['mmsi'] = filter_var($_COOKIE['filter_mmsi'],FILTER_SANITIZE_STRING);
74
-if (isset($_COOKIE['filter_Airlines']) && $_COOKIE['filter_Airlines'] != '') $filter['airlines'] = filter_var_array(explode(',',$_COOKIE['filter_Airlines']),FILTER_SANITIZE_STRING);
75
-if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') $filter['source_aprs'] = filter_var_array(explode(',',$_COOKIE['filter_Sources']),FILTER_SANITIZE_STRING);
76
-if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') $filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'],FILTER_SANITIZE_STRING);
77
-if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] != 'all') $filter['alliance'] = filter_var($_COOKIE['filter_alliance'],FILTER_SANITIZE_STRING);
72
+if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') {
73
+	$filter['source'] = array_merge($filter['source'],array('vatsimtxt'));
74
+}
75
+if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') {
76
+	$filter['source'] = array_merge($filter['source'],array('whazzup'));
77
+}
78
+if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') {
79
+	$filter['source'] = array_merge($filter['source'],array('phpvmacars'));
80
+}
81
+if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') {
82
+	$filter['source'] = array_merge($filter['source'],array('sbs','famaprs'));
83
+}
84
+if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') {
85
+	$filter['source'] = array_merge($filter['source'],array('aprs'));
86
+}
87
+if (isset($_COOKIE['filter_ident']) && $_COOKIE['filter_ident'] != '') {
88
+	$filter['ident'] = filter_var($_COOKIE['filter_ident'],FILTER_SANITIZE_STRING);
89
+}
90
+if (isset($_COOKIE['filter_mmsi']) && $_COOKIE['filter_mmsi'] != '') {
91
+	$filter['mmsi'] = filter_var($_COOKIE['filter_mmsi'],FILTER_SANITIZE_STRING);
92
+}
93
+if (isset($_COOKIE['filter_Airlines']) && $_COOKIE['filter_Airlines'] != '') {
94
+	$filter['airlines'] = filter_var_array(explode(',',$_COOKIE['filter_Airlines']),FILTER_SANITIZE_STRING);
95
+}
96
+if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') {
97
+	$filter['source_aprs'] = filter_var_array(explode(',',$_COOKIE['filter_Sources']),FILTER_SANITIZE_STRING);
98
+}
99
+if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') {
100
+	$filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'],FILTER_SANITIZE_STRING);
101
+}
102
+if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] != 'all') {
103
+	$filter['alliance'] = filter_var($_COOKIE['filter_alliance'],FILTER_SANITIZE_STRING);
104
+}
78 105
 
79 106
 if (isset($globalMapPopup) && !$globalMapPopup && !(isset($_COOKIE['flightpopup']) && $_COOKIE['flightpopup'] == 'true')) {
80 107
 	$min = true;
81
-} else $min = false;
108
+} else {
109
+	$min = false;
110
+}
82 111
 
83 112
 $spotter_array = array();
84 113
 
@@ -189,24 +218,38 @@  discard block
 block discarded – undo
189 218
 			$flightcnt = $SpotterLive->getLiveSpotterCount($filter);
190 219
 		}
191 220
 	}
192
-	if ($flightcnt == '') $flightcnt = 0;
193
-} else $flightcnt = 0;
221
+	if ($flightcnt == '') {
222
+		$flightcnt = 0;
223
+	}
224
+	} else {
225
+	$flightcnt = 0;
226
+}
194 227
 
195 228
 $sqltime = round(microtime(true)-$begintime,2);
196 229
 
197 230
 $currenttime = filter_input(INPUT_GET,'currenttime',FILTER_SANITIZE_NUMBER_INT);
198
-if ($currenttime != '') $currenttime = round($currenttime/1000);
231
+if ($currenttime != '') {
232
+	$currenttime = round($currenttime/1000);
233
+}
199 234
 
200
-if ((!isset($_COOKIE['flightestimation']) && isset($globalMapEstimation) && $globalMapEstimation == FALSE) || (isset($_COOKIE['flightestimation']) && $_COOKIE['flightestimation'] == 'false')) $usenextlatlon = false;
201
-else $usenextlatlon = true;
202
-if ($usenextlatlon === false) $currenttime = '';
235
+if ((!isset($_COOKIE['flightestimation']) && isset($globalMapEstimation) && $globalMapEstimation == FALSE) || (isset($_COOKIE['flightestimation']) && $_COOKIE['flightestimation'] == 'false')) {
236
+	$usenextlatlon = false;
237
+} else {
238
+	$usenextlatlon = true;
239
+}
240
+if ($usenextlatlon === false) {
241
+	$currenttime = '';
242
+}
203 243
 $j = 0;
204 244
 $prev_flightaware_id = '';
205 245
 $aircrafts_shadow = array();
206 246
 $output = '{';
207 247
 	$output .= '"type": "FeatureCollection",';
208
-		if ($min) $output .= '"minimal": "true",';
209
-		else $output .= '"minimal": "false",';
248
+		if ($min) {
249
+			$output .= '"minimal": "true",';
250
+		} else {
251
+			$output .= '"minimal": "false",';
252
+		}
210 253
 		//$output .= '"fc": "'.$flightcnt.'",';
211 254
 		$output .= '"sqt": "'.$sqltime.'",';
212 255
 
@@ -251,18 +294,29 @@  discard block
 block discarded – undo
251 294
 						}
252 295
 						$output .= '"properties": {';
253 296
 						if (isset($spotter_item['flightaware_id'])) {
254
-							if ($compress) $output .= '"fi": "'.$spotter_item['flightaware_id'].'",';
255
-							else $output .= '"flightaware_id": "'.$spotter_item['flightaware_id'].'",';
297
+							if ($compress) {
298
+								$output .= '"fi": "'.$spotter_item['flightaware_id'].'",';
299
+							} else {
300
+								$output .= '"flightaware_id": "'.$spotter_item['flightaware_id'].'",';
301
+							}
256 302
 						} elseif (isset($spotter_item['famtrackid'])) {
257
-							if ($compress) $output .= '"fti": "'.$spotter_item['famtrackid'].'",';
258
-							else $output .= '"famtrackid": "'.$spotter_item['famtrackid'].'",';
303
+							if ($compress) {
304
+								$output .= '"fti": "'.$spotter_item['famtrackid'].'",';
305
+							} else {
306
+								$output .= '"famtrackid": "'.$spotter_item['famtrackid'].'",';
307
+							}
259 308
 						} elseif (isset($spotter_item['fammarine_id'])) {
260
-							if ($compress) $output .= '"fmi": "'.$spotter_item['fammarine_id'].'",';
261
-							else $output .= '"fammarineid": "'.$spotter_item['fammarine_id'].'",';
309
+							if ($compress) {
310
+								$output .= '"fmi": "'.$spotter_item['fammarine_id'].'",';
311
+							} else {
312
+								$output .= '"fammarineid": "'.$spotter_item['fammarine_id'].'",';
313
+							}
262 314
 						}
263 315
 						$output .= '"fc": "'.$flightcnt.'",';
264 316
 						$output .= '"sqt": "'.$sqltime.'",';
265
-						if (isset($begindate)) $output .= '"archive_date": "'.$begindate.'",';
317
+						if (isset($begindate)) {
318
+							$output .= '"archive_date": "'.$begindate.'",';
319
+						}
266 320
 
267 321
 /*
268 322
 							if ($min) $output .= '"minimal": "true",';
@@ -270,14 +324,22 @@  discard block
 block discarded – undo
270 324
 */
271 325
 							//$output .= '"fc": "'.$spotter_item['nb'].'",';
272 326
 						if (isset($spotter_item['ident']) && $spotter_item['ident'] != '') {
273
-							if ($compress) $output .= '"c": "'.str_replace('\\','',$spotter_item['ident']).'",';
274
-							else $output .= '"callsign": "'.str_replace('\\','',$spotter_item['ident']).'",';
327
+							if ($compress) {
328
+								$output .= '"c": "'.str_replace('\\','',$spotter_item['ident']).'",';
329
+							} else {
330
+								$output .= '"callsign": "'.str_replace('\\','',$spotter_item['ident']).'",';
331
+							}
275 332
 							//"
276 333
 						} else {
277
-							if ($compress) $output .= '"c": "NA",';
278
-							else $output .= '"callsign": "NA",';
334
+							if ($compress) {
335
+								$output .= '"c": "NA",';
336
+							} else {
337
+								$output .= '"callsign": "NA",';
338
+							}
339
+						}
340
+						if (isset($spotter_item['registration'])) {
341
+							$output .= '"registration": "'.$spotter_item['registration'].'",';
279 342
 						}
280
-						if (isset($spotter_item['registration'])) $output .= '"registration": "'.$spotter_item['registration'].'",';
281 343
 						if (isset($spotter_item['aircraft_name']) && isset($spotter_item['aircraft_type'])) {
282 344
 							$output .= '"aircraft_name": "'.$spotter_item['aircraft_name'].' ('.$spotter_item['aircraft_type'].')",';
283 345
 							$output .= '"aircraft_wiki": "http://'.strtolower($globalLanguage).'.wikipedia.org/wiki/'.urlencode(str_replace(' ','_',$spotter_item['aircraft_name'])).'",';
@@ -290,16 +352,23 @@  discard block
 block discarded – undo
290 352
 							$output .= '"aircraft_icao": "'.$spotter_item['aircraft_icao'].'",';
291 353
 						}
292 354
 						if (!isset($spotter_item['aircraft_shadow']) && !$tracker && !$marine) {
293
-							if (!isset($spotter_item['aircraft_icao']) || $spotter_item['aircraft_icao'] == '') $spotter_item['aircraft_shadow'] = '';
294
-							else {
355
+							if (!isset($spotter_item['aircraft_icao']) || $spotter_item['aircraft_icao'] == '') {
356
+								$spotter_item['aircraft_shadow'] = '';
357
+							} else {
295 358
 								$aircraft_icao = $spotter_item['aircraft_icao'];
296
-								if (isset($aircrafts_shadow[$aircraft_icao])) $spotter_item['aircraft_shadow'] = $aircrafts_shadow[$aircraft_icao];
297
-								else {
359
+								if (isset($aircrafts_shadow[$aircraft_icao])) {
360
+									$spotter_item['aircraft_shadow'] = $aircrafts_shadow[$aircraft_icao];
361
+								} else {
298 362
 									$aircraft_info = $Spotter->getAllAircraftInfo($spotter_item['aircraft_icao']);
299
-									if (count($aircraft_info) > 0) $spotter_item['aircraft_shadow'] = $aircraft_info[0]['aircraft_shadow'];
300
-									elseif (isset($spotter_item['format_source']) && $spotter_item['format_source'] == 'aprs') $spotter_item['aircraft_shadow'] = 'PA18.png';
301
-									elseif ($aircraft_icao == 'PARAGLIDER') $spotter_item['aircraft_shadow'] = 'PARAGLIDER.png';
302
-									else $spotter_item['aircraft_shadow'] = '';
363
+									if (count($aircraft_info) > 0) {
364
+										$spotter_item['aircraft_shadow'] = $aircraft_info[0]['aircraft_shadow'];
365
+									} elseif (isset($spotter_item['format_source']) && $spotter_item['format_source'] == 'aprs') {
366
+										$spotter_item['aircraft_shadow'] = 'PA18.png';
367
+									} elseif ($aircraft_icao == 'PARAGLIDER') {
368
+										$spotter_item['aircraft_shadow'] = 'PARAGLIDER.png';
369
+									} else {
370
+										$spotter_item['aircraft_shadow'] = '';
371
+									}
303 372
 									$aircrafts_shadow[$aircraft_icao] = $spotter_item['aircraft_shadow'];
304 373
 								}
305 374
 							}
@@ -307,73 +376,139 @@  discard block
 block discarded – undo
307 376
 						if (!isset($spotter_item['aircraft_shadow']) || $spotter_item['aircraft_shadow'] == '') {
308 377
 							if ($tracker) {
309 378
 								if (isset($spotter_item['type']) && $spotter_item['type'] == 'Ambulance') {
310
-									if ($compress) $output .= '"as": "ambulance.png",';
311
-									else $output .= '"aircraft_shadow": "ambulance.png",';
379
+									if ($compress) {
380
+										$output .= '"as": "ambulance.png",';
381
+									} else {
382
+										$output .= '"aircraft_shadow": "ambulance.png",';
383
+									}
312 384
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Police') {
313
-									if ($compress) $output .= '"as": "police.png",';
314
-									else $output .= '"aircraft_shadow": "police.png",';
385
+									if ($compress) {
386
+										$output .= '"as": "police.png",';
387
+									} else {
388
+										$output .= '"aircraft_shadow": "police.png",';
389
+									}
315 390
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Yacht (Sail)') {
316
-									if ($compress) $output .= '"as": "ship.png",';
317
-									else $output .= '"aircraft_shadow": "ship.png",';
391
+									if ($compress) {
392
+										$output .= '"as": "ship.png",';
393
+									} else {
394
+										$output .= '"aircraft_shadow": "ship.png",';
395
+									}
318 396
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Ship (Power Boat)') {
319
-									if ($compress) $output .= '"as": "ship.png",';
320
-									else $output .= '"aircraft_shadow": "ship.png",';
397
+									if ($compress) {
398
+										$output .= '"as": "ship.png",';
399
+									} else {
400
+										$output .= '"aircraft_shadow": "ship.png",';
401
+									}
321 402
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Shuttle') {
322
-									if ($compress) $output .= '"as": "ship.png",';
323
-									else $output .= '"aircraft_shadow": "ship.png",';
403
+									if ($compress) {
404
+										$output .= '"as": "ship.png",';
405
+									} else {
406
+										$output .= '"aircraft_shadow": "ship.png",';
407
+									}
324 408
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Truck') {
325
-									if ($compress) $output .= '"as": "truck.png",';
326
-									else $output .= '"aircraft_shadow": "truck.png",';
409
+									if ($compress) {
410
+										$output .= '"as": "truck.png",';
411
+									} else {
412
+										$output .= '"aircraft_shadow": "truck.png",';
413
+									}
327 414
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Truck (18 Wheeler)') {
328
-									if ($compress) $output .= '"as": "truck.png",';
329
-									else $output .= '"aircraft_shadow": "truck.png",';
415
+									if ($compress) {
416
+										$output .= '"as": "truck.png",';
417
+									} else {
418
+										$output .= '"aircraft_shadow": "truck.png",';
419
+									}
330 420
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Aircraft (small)') {
331
-									if ($compress) $output .= '"as": "aircraft.png",';
332
-									else $output .= '"aircraft_shadow": "aircraft.png",';
421
+									if ($compress) {
422
+										$output .= '"as": "aircraft.png",';
423
+									} else {
424
+										$output .= '"aircraft_shadow": "aircraft.png",';
425
+									}
333 426
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Large Aircraft') {
334
-									if ($compress) $output .= '"as": "aircraft.png",';
335
-									else $output .= '"aircraft_shadow": "aircraft.png",';
427
+									if ($compress) {
428
+										$output .= '"as": "aircraft.png",';
429
+									} else {
430
+										$output .= '"aircraft_shadow": "aircraft.png",';
431
+									}
336 432
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Helicopter') {
337
-									if ($compress) $output .= '"as": "helico.png",';
338
-									else $output .= '"aircraft_shadow": "helico.png",';
433
+									if ($compress) {
434
+										$output .= '"as": "helico.png",';
435
+									} else {
436
+										$output .= '"aircraft_shadow": "helico.png",';
437
+									}
339 438
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Railroad Engine') {
340
-									if ($compress) $output .= '"as": "rail.png",';
341
-									else $output .= '"aircraft_shadow": "rail.png",';
439
+									if ($compress) {
440
+										$output .= '"as": "rail.png",';
441
+									} else {
442
+										$output .= '"aircraft_shadow": "rail.png",';
443
+									}
342 444
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Firetruck') {
343
-									if ($compress) $output .= '"as": "firetruck.png",';
344
-									else $output .= '"aircraft_shadow": "firetruck.png",';
445
+									if ($compress) {
446
+										$output .= '"as": "firetruck.png",';
447
+									} else {
448
+										$output .= '"aircraft_shadow": "firetruck.png",';
449
+									}
345 450
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Bus') {
346
-									if ($compress) $output .= '"as": "bus.png",';
347
-									else $output .= '"aircraft_shadow": "bus.png",';
451
+									if ($compress) {
452
+										$output .= '"as": "bus.png",';
453
+									} else {
454
+										$output .= '"aircraft_shadow": "bus.png",';
455
+									}
348 456
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Phone') {
349
-									if ($compress) $output .= '"as": "phone.png",';
350
-									else $output .= '"aircraft_shadow": "phone.png",';
457
+									if ($compress) {
458
+										$output .= '"as": "phone.png",';
459
+									} else {
460
+										$output .= '"aircraft_shadow": "phone.png",';
461
+									}
351 462
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Jogger') {
352
-									if ($compress) $output .= '"as": "jogger.png",';
353
-									else $output .= '"aircraft_shadow": "jogger.png",';
463
+									if ($compress) {
464
+										$output .= '"as": "jogger.png",';
465
+									} else {
466
+										$output .= '"aircraft_shadow": "jogger.png",';
467
+									}
354 468
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Bike') {
355
-									if ($compress) $output .= '"as": "bike.png",';
356
-									else $output .= '"aircraft_shadow": "bike.png",';
469
+									if ($compress) {
470
+										$output .= '"as": "bike.png",';
471
+									} else {
472
+										$output .= '"aircraft_shadow": "bike.png",';
473
+									}
357 474
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Motorcycle') {
358
-									if ($compress) $output .= '"as": "motorcycle.png",';
359
-									else $output .= '"aircraft_shadow": "motorcycle.png",';
475
+									if ($compress) {
476
+										$output .= '"as": "motorcycle.png",';
477
+									} else {
478
+										$output .= '"aircraft_shadow": "motorcycle.png",';
479
+									}
360 480
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Balloon') {
361
-									if ($compress) $output .= '"as": "balloon.png",';
362
-									else $output .= '"aircraft_shadow": "balloon.png",';
481
+									if ($compress) {
482
+										$output .= '"as": "balloon.png",';
483
+									} else {
484
+										$output .= '"aircraft_shadow": "balloon.png",';
485
+									}
363 486
 								} else {
364
-									if ($compress) $output .= '"as": "car.png",';
365
-									else $output .= '"aircraft_shadow": "car.png",';
487
+									if ($compress) {
488
+										$output .= '"as": "car.png",';
489
+									} else {
490
+										$output .= '"aircraft_shadow": "car.png",';
491
+									}
366 492
 								}
367 493
 							} elseif ($marine) {
368
-								if ($compress) $output .= '"as": "ship.png",';
369
-								else $output .= '"aircraft_shadow": "ship.png",';
494
+								if ($compress) {
495
+									$output .= '"as": "ship.png",';
496
+								} else {
497
+									$output .= '"aircraft_shadow": "ship.png",';
498
+								}
370 499
 							} else {
371
-								if ($compress) $output .= '"as": "default.png",';
372
-								else $output .= '"aircraft_shadow": "default.png",';
500
+								if ($compress) {
501
+									$output .= '"as": "default.png",';
502
+								} else {
503
+									$output .= '"aircraft_shadow": "default.png",';
504
+								}
373 505
 							}
374 506
 						} else {
375
-							if ($compress) $output .= '"as": "'.$spotter_item['aircraft_shadow'].'",';
376
-							else $output .= '"aircraft_shadow": "'.$spotter_item['aircraft_shadow'].'",';
507
+							if ($compress) {
508
+								$output .= '"as": "'.$spotter_item['aircraft_shadow'].'",';
509
+							} else {
510
+								$output .= '"aircraft_shadow": "'.$spotter_item['aircraft_shadow'].'",';
511
+							}
377 512
 						}
378 513
 						if (isset($spotter_item['airline_name'])) {
379 514
 							$output .= '"airline_name": "'.$spotter_item['airline_name'].'",';
@@ -381,8 +516,11 @@  discard block
 block discarded – undo
381 516
 							$output .= '"airline_name": "NA",';
382 517
 						}
383 518
 						if (isset($spotter_item['departure_airport'])) {
384
-							if ($compress) $output .= '"dac": "'.$spotter_item['departure_airport'].'",';
385
-							else $output .= '"departure_airport_code": "'.$spotter_item['departure_airport'].'",';
519
+							if ($compress) {
520
+								$output .= '"dac": "'.$spotter_item['departure_airport'].'",';
521
+							} else {
522
+								$output .= '"departure_airport_code": "'.$spotter_item['departure_airport'].'",';
523
+							}
386 524
 						}
387 525
 						if (isset($spotter_item['departure_airport_city'])) {
388 526
 							$output .= '"departure_airport": "'.$spotter_item['departure_airport_city'].', '.$spotter_item['departure_airport_country'].'",';
@@ -394,8 +532,11 @@  discard block
 block discarded – undo
394 532
 							$output .= '"arrival_airport_time": "'.$spotter_item['arrival_airport_time'].'",';
395 533
 						}
396 534
 						if (isset($spotter_item['arrival_airport'])) {
397
-							if ($compress) $output .= '"aac": "'.$spotter_item['arrival_airport'].'",';
398
-							else $output .= '"arrival_airport_code": "'.$spotter_item['arrival_airport'].'",';
535
+							if ($compress) {
536
+								$output .= '"aac": "'.$spotter_item['arrival_airport'].'",';
537
+							} else {
538
+								$output .= '"arrival_airport_code": "'.$spotter_item['arrival_airport'].'",';
539
+							}
399 540
 						}
400 541
 						if (isset($spotter_item['arrival_airport_city'])) {
401 542
 							$output .= '"arrival_airport": "'.$spotter_item['arrival_airport_city'].', '.$spotter_item['arrival_airport_country'].'",';
@@ -414,8 +555,11 @@  discard block
 block discarded – undo
414 555
 						}
415 556
 						
416 557
 						if (isset($spotter_item['altitude'])) {
417
-							if ($compress) $output .= '"a": "'.$spotter_item['altitude'].'",';
418
-							else $output .= '"altitude": "'.$spotter_item['altitude'].'",';
558
+							if ($compress) {
559
+								$output .= '"a": "'.$spotter_item['altitude'].'",';
560
+							} else {
561
+								$output .= '"altitude": "'.$spotter_item['altitude'].'",';
562
+							}
419 563
 						}
420 564
 						
421 565
 						$heading = $spotter_item['heading'];
@@ -439,19 +583,24 @@  discard block
 block discarded – undo
439 583
 							}
440 584
 						}
441 585
 						
442
-						if ($compress)$output .= '"h": "'.$heading.'",';
443
-						else $output .= '"heading": "'.$heading.'",';
586
+						if ($compress) {
587
+							$output .= '"h": "'.$heading.'",';
588
+						} else {
589
+							$output .= '"heading": "'.$heading.'",';
590
+						}
444 591
 						if ($currenttime != '') {
445 592
 							if (strtotime($spotter_item['date']) < $currenttime) {
446 593
 								if (isset($archivespeed)) {
447 594
 									$nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$heading,$archivespeed,($currenttime-strtotime($spotter_item['date'])+$globalMapRefresh));
448 595
 									$fdistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$nextcoord['latitude'],$nextcoord['longitude']);
449
-									if (!isset($idistance) || $fdistance < $idistance) $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],';
450
-									else {
596
+									if (!isset($idistance) || $fdistance < $idistance) {
597
+										$output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],';
598
+									} else {
451 599
 										$nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$cheading,$archivespeed,($currenttime-strtotime($spotter_item['date'])+$globalMapRefresh));
452 600
 										$fdistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$nextcoord['latitude'],$nextcoord['longitude']);
453
-										if (!isset($idistance) || $fdistance < $idistance) $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],';
454
-										else {
601
+										if (!isset($idistance) || $fdistance < $idistance) {
602
+											$output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],';
603
+										} else {
455 604
 											$nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$heading,$archivespeed);
456 605
 											$output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],';
457 606
 										}
@@ -459,12 +608,14 @@  discard block
 block discarded – undo
459 608
 								} elseif ($usenextlatlon) {
460 609
 									$nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$heading,1,($currenttime-strtotime($spotter_item['date'])+$globalMapRefresh));
461 610
 									$fdistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$nextcoord['latitude'],$nextcoord['longitude']);
462
-									if (!isset($idistance) || $fdistance < $idistance) $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],';
463
-									else {
611
+									if (!isset($idistance) || $fdistance < $idistance) {
612
+										$output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],';
613
+									} else {
464 614
 										$nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$cheading,1,($currenttime-strtotime($spotter_item['date'])+$globalMapRefresh));
465 615
 										$fdistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$nextcoord['latitude'],$nextcoord['longitude']);
466
-										if (!isset($idistance) || $fdistance < $idistance) $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],';
467
-										else {
616
+										if (!isset($idistance) || $fdistance < $idistance) {
617
+											$output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],';
618
+										} else {
468 619
 											$nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$heading);
469 620
 											$output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],';
470 621
 										}
@@ -503,7 +654,9 @@  discard block
 block discarded – undo
503 654
 							}
504 655
 						}
505 656
 
506
-						if (!$min) $output .= '"image": "'.$image.'",';
657
+						if (!$min) {
658
+							$output .= '"image": "'.$image.'",';
659
+						}
507 660
 						if (isset($spotter_item['image_copyright']) && $spotter_item['image_copyright'] != '') {
508 661
 							$output .= '"image_copyright": "'.str_replace('"',"'",trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'',$spotter_item['image_copyright']))).'",';
509 662
 						}
@@ -511,8 +664,11 @@  discard block
 block discarded – undo
511 664
 							$output .= '"image_source_website": "'.urlencode($spotter_item['image_source_website']).'",';
512 665
 						}
513 666
 						if (isset($spotter_item['squawk'])) {
514
-							if ($compress) $output .= '"sq": "'.$spotter_item['squawk'].'",';
515
-							else $output .= '"squawk": "'.$spotter_item['squawk'].'",';
667
+							if ($compress) {
668
+								$output .= '"sq": "'.$spotter_item['squawk'].'",';
669
+							} else {
670
+								$output .= '"squawk": "'.$spotter_item['squawk'].'",';
671
+							}
516 672
 						}
517 673
 						if (isset($spotter_item['squawk_usage'])) {
518 674
 							$output .= '"squawk_usage": "'.$spotter_item['squawk_usage'].'",';
@@ -531,14 +687,23 @@  discard block
 block discarded – undo
531 687
 						}
532 688
 						// type when not aircraft ?
533 689
 						if (isset($spotter_item['type'])) {
534
-							if ($compress) $output .= '"t": "'.$spotter_item['type'].'"';
535
-							else $output .= '"type": "'.$spotter_item['type'].'"';
690
+							if ($compress) {
691
+								$output .= '"t": "'.$spotter_item['type'].'"';
692
+							} else {
693
+								$output .= '"type": "'.$spotter_item['type'].'"';
694
+							}
536 695
 						} elseif ($marine) {
537
-							if ($compress) $output .= '"t": "ship"';
538
-							else $output .= '"type": "ship"';
696
+							if ($compress) {
697
+								$output .= '"t": "ship"';
698
+							} else {
699
+								$output .= '"type": "ship"';
700
+							}
539 701
 						} else {
540
-							if ($compress) $output .= '"t": "aircraft"';
541
-							else $output .= '"type": "aircraft"';
702
+							if ($compress) {
703
+								$output .= '"t": "aircraft"';
704
+							} else {
705
+								$output .= '"type": "aircraft"';
706
+							}
542 707
 						}
543 708
 						$output .= '},';
544 709
 						$output .= '"geometry": {';
@@ -546,15 +711,19 @@  discard block
 block discarded – undo
546 711
 								$output .= '"coordinates": [';
547 712
 								if ($currenttime != '') {
548 713
 									if (strtotime($spotter_item['date']) < $currenttime) {
549
-										if (!isset($archivespeed)) $archivespeed = 1;
714
+										if (!isset($archivespeed)) {
715
+											$archivespeed = 1;
716
+										}
550 717
 										$nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$heading,$archivespeed,($currenttime-strtotime($spotter_item['date'])));
551 718
 										$fdistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$nextcoord['latitude'],$nextcoord['longitude']);
552
-										if (!isset($idistance) || $fdistance < $idistance) $output .= $nextcoord['longitude'].','.$nextcoord['latitude'];
553
-										else {
719
+										if (!isset($idistance) || $fdistance < $idistance) {
720
+											$output .= $nextcoord['longitude'].','.$nextcoord['latitude'];
721
+										} else {
554 722
 											$nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$cheading,$archivespeed,($currenttime-strtotime($spotter_item['date'])));
555 723
 											$fdistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$nextcoord['latitude'],$nextcoord['longitude']);
556
-											if (!isset($idistance) || $fdistance < $idistance) $output .= $nextcoord['longitude'].','.$nextcoord['latitude'];
557
-											else {
724
+											if (!isset($idistance) || $fdistance < $idistance) {
725
+												$output .= $nextcoord['longitude'].','.$nextcoord['latitude'];
726
+											} else {
558 727
 												$output .= $spotter_item['longitude'].', ';
559 728
 												$output .= $spotter_item['latitude'];
560 729
 											}
@@ -632,7 +801,9 @@  discard block
 block discarded – undo
632 801
 			}
633 802
 */
634 803
 				$history = filter_input(INPUT_GET,'history',FILTER_SANITIZE_STRING);
635
-				if ($history == '' && isset($_COOKIE['history'])) $history = $_COOKIE['history'];
804
+				if ($history == '' && isset($_COOKIE['history'])) {
805
+					$history = $_COOKIE['history'];
806
+				}
636 807
 				
637 808
 				if (
638 809
 				    (isset($_COOKIE['flightpath']) && $_COOKIE['flightpath'] == 'true') 
@@ -702,8 +873,11 @@  discard block
 block discarded – undo
702 873
 									$output_history .= ']}},';
703 874
 									$output .= $output_history;
704 875
 								}
705
-								if ($compress) $output_history = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "history","a": "'.$alt.'"},"geometry": {"type": "LineString","coordinates": [';
706
-								else $output_history = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "history","altitude": "'.$alt.'"},"geometry": {"type": "LineString","coordinates": [';
876
+								if ($compress) {
877
+									$output_history = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "history","a": "'.$alt.'"},"geometry": {"type": "LineString","coordinates": [';
878
+								} else {
879
+									$output_history = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "history","altitude": "'.$alt.'"},"geometry": {"type": "LineString","coordinates": [';
880
+								}
707 881
 							}
708 882
 							$output_history .= '[';
709 883
 							$output_history .=  $spotter_history['longitude'].', ';
@@ -724,10 +898,15 @@  discard block
 block discarded – undo
724 898
 							if ($d == false) {
725 899
 								if ($compress) {
726 900
 									$output_history = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'",';
727
-									if (isset($spotter_history_array[0]['mapmatching_engine']) && $spotter_history_array[0]['mapmatching_engine'] == 'graphhopper') $output_history .= '"atr": "Powered by <a href=\"https://www.graphhopper.com/\">GraphHopper API</a>", Map matching engine use data from © <a href=\"http://www.openstreetmap.org/copyright\">OpenStreetMap</a>",';
728
-									elseif (isset($spotter_history_array[0]['mapmatching_engine'])) $output_history .= '"atr": "Map matching engine use data from © <a href=\"http://www.openstreetmap.org/copyright\">OpenStreetMap</a>",';
901
+									if (isset($spotter_history_array[0]['mapmatching_engine']) && $spotter_history_array[0]['mapmatching_engine'] == 'graphhopper') {
902
+										$output_history .= '"atr": "Powered by <a href=\"https://www.graphhopper.com/\">GraphHopper API</a>", Map matching engine use data from © <a href=\"http://www.openstreetmap.org/copyright\">OpenStreetMap</a>",';
903
+									} elseif (isset($spotter_history_array[0]['mapmatching_engine'])) {
904
+										$output_history .= '"atr": "Map matching engine use data from © <a href=\"http://www.openstreetmap.org/copyright\">OpenStreetMap</a>",';
905
+									}
729 906
 									$output_history .= '"t": "history"},"geometry": {"type": "LineString","coordinates": [';
730
-								} else $output_history = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "history"},"geometry": {"type": "LineString","coordinates": [';
907
+								} else {
908
+									$output_history = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "history"},"geometry": {"type": "LineString","coordinates": [';
909
+								}
731 910
 								$d = true;
732 911
 							}
733 912
 							$output_history .= '[';
@@ -750,7 +929,9 @@  discard block
 block discarded – undo
750 929
 							$output_historyd = '[';
751 930
 							$output_historyd .=  $spotter_item['longitude'].', ';
752 931
 							$output_historyd .=  $spotter_item['latitude'];
753
-							if (isset($spotter_history['altitude'])) $output_historyd .=  ','.$spotter_item['altitude']*30.48;
932
+							if (isset($spotter_history['altitude'])) {
933
+								$output_historyd .=  ','.$spotter_item['altitude']*30.48;
934
+							}
754 935
 							$output_historyd .= '],';
755 936
 							//$output_history = $output_historyd.$output_history;
756 937
 							$output_history = $output_history.$output_historyd;
@@ -777,8 +958,11 @@  discard block
 block discarded – undo
777 958
 				        && $spotter_item['arrival_airport'] != 'NA' 
778 959
 				        && ((isset($_COOKIE['MapRoute']) && $_COOKIE['MapRoute'] == "true") 
779 960
 				    	    || (!isset($_COOKIE['MapRoute']) && isset($globalMapRoute) && $globalMapRoute)))) {
780
-				    if ($compress) $output_air = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "route"},"geometry": {"type": "LineString","coordinates": [';
781
-				    else $output_air = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "route"},"geometry": {"type": "LineString","coordinates": [';
961
+				    if ($compress) {
962
+				    	$output_air = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "route"},"geometry": {"type": "LineString","coordinates": [';
963
+				    } else {
964
+				    	$output_air = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "route"},"geometry": {"type": "LineString","coordinates": [';
965
+				    }
782 966
 				    if (isset($spotter_item['departure_airport_latitude'])) {
783 967
 					$output_air .= '['.$spotter_item['departure_airport_longitude'].','.$spotter_item['departure_airport_latitude'].'],';
784 968
 				    } elseif (isset($spotter_item['departure_airport']) && $spotter_item['departure_airport'] != 'NA') {
@@ -811,8 +995,11 @@  discard block
 block discarded – undo
811 995
 				    	    || (!isset($_COOKIE['MapRemainingRoute']) && (!isset($globalMapRemainingRoute) 
812 996
 				    	    || (isset($globalMapRemainingRoute) && $globalMapRemainingRoute)))))) {
813 997
 				    $havedata = false;
814
-				    if ($compress) $output_dest = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "routedest"},"geometry": {"type": "LineString","coordinates": [';
815
-				    else $output_dest = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "routedest"},"geometry": {"type": "LineString","coordinates": [';
998
+				    if ($compress) {
999
+				    	$output_dest = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "routedest"},"geometry": {"type": "LineString","coordinates": [';
1000
+				    } else {
1001
+				    	$output_dest = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "routedest"},"geometry": {"type": "LineString","coordinates": [';
1002
+				    }
816 1003
 				    
817 1004
 				    //$output_dest .= '['.$spotter_item['longitude'].','.$spotter_item['latitude'].'],';
818 1005
 				    if (isset($spotter_item['arrival_airport_latitude'])) {
@@ -837,7 +1024,9 @@  discard block
 block discarded – undo
837 1024
 					$output_dest  = substr($output_dest, 0, -1);
838 1025
 				    }
839 1026
 				    $output_dest .= ']}},';
840
-				    if ($havedata) $output .= $output_dest;
1027
+				    if ($havedata) {
1028
+				    	$output .= $output_dest;
1029
+				    }
841 1030
 				    unset($output_dest);
842 1031
 				}
843 1032
 			}
@@ -845,7 +1034,9 @@  discard block
 block discarded – undo
845 1034
 			$output .= ']';
846 1035
 			$output .= ',"initial_sqltime": "'.$sqltime.'",';
847 1036
 			$output .= '"totaltime": "'.round(microtime(true)-$begintime,2).'",';
848
-			if (isset($begindate)) $output .= '"archive_date": "'.$begindate.'",';
1037
+			if (isset($begindate)) {
1038
+				$output .= '"archive_date": "'.$begindate.'",';
1039
+			}
849 1040
 			$output .= '"fc": "'.$j.'"';
850 1041
 		} else {
851 1042
 			$output .= '"features": ';
Please login to merge, or discard this patch.
require/class.SpotterArchive.php 1 patch
Braces   +40 added lines, -14 removed lines patch added patch discarded remove patch
@@ -6,7 +6,9 @@  discard block
 block discarded – undo
6 6
 	public function __construct($dbc = null) {
7 7
 		$Connection = new Connection($dbc);
8 8
 		$this->db = $Connection->db;
9
-		if ($this->db === null) die('Error: No DB connection. (SpotterArchive)');
9
+		if ($this->db === null) {
10
+			die('Error: No DB connection. (SpotterArchive)');
11
+		}
10 12
 	}
11 13
 
12 14
 	/**
@@ -27,7 +29,9 @@  discard block
 block discarded – undo
27 29
 		if (isset($filter[0]['source'])) {
28 30
 			$filters = array_merge($filters,$filter);
29 31
 		}
30
-		if (is_array($globalFilter)) $filter = array_merge($filter,$globalFilter);
32
+		if (is_array($globalFilter)) {
33
+			$filter = array_merge($filter,$globalFilter);
34
+		}
31 35
 		$filter_query_join = '';
32 36
 		$filter_query_where = '';
33 37
 		foreach($filters as $flt) {
@@ -119,8 +123,11 @@  discard block
 block discarded – undo
119 123
 			}
120 124
 			$filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output".preg_replace('/^ AND/',' WHERE',$filter_query_date).") sd ON sd.flightaware_id = spotter_archive_output.flightaware_id";
121 125
 		}
122
-		if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE';
123
-		elseif ($filter_query_where != '' && $and) $filter_query_where .= ' AND';
126
+		if ($filter_query_where == '' && $where) {
127
+			$filter_query_where = ' WHERE';
128
+		} elseif ($filter_query_where != '' && $and) {
129
+			$filter_query_where .= ' AND';
130
+		}
124 131
 		if ($filter_query_where != '') {
125 132
 			$filter_query_where = preg_replace('/^ AND/',' WHERE',$filter_query_where);
126 133
 		}
@@ -134,10 +141,17 @@  discard block
 block discarded – undo
134 141
 		if ($over_country == '') {
135 142
 			$Spotter = new Spotter($this->db);
136 143
 			$data_country = $Spotter->getCountryFromLatitudeLongitude($latitude,$longitude);
137
-			if (!empty($data_country)) $country = $data_country['iso2'];
138
-			else $country = '';
139
-		} else $country = $over_country;
140
-		if ($airline_type === NULL) $airline_type ='';
144
+			if (!empty($data_country)) {
145
+				$country = $data_country['iso2'];
146
+			} else {
147
+				$country = '';
148
+			}
149
+		} else {
150
+			$country = $over_country;
151
+		}
152
+		if ($airline_type === NULL) {
153
+			$airline_type ='';
154
+		}
141 155
 
142 156
 		//if ($country == '') echo "\n".'************ UNKNOW COUNTRY ****************'."\n";
143 157
 		//else echo "\n".'*/*/*/*/*/*/*/ Country : '.$country.' */*/*/*/*/*/*/*/*/'."\n";
@@ -598,7 +612,9 @@  discard block
 block discarded – undo
598 612
 					$additional_query .= "(spotter_archive_output.pilot_name like '%".$q_item."%') OR ";
599 613
 					$additional_query .= "(spotter_archive_output.ident like '%".$q_item."%') OR ";
600 614
 					$translate = $Translation->ident2icao($q_item);
601
-					if ($translate != $q_item) $additional_query .= "(spotter_archive_output.ident like '%".$translate."%') OR ";
615
+					if ($translate != $q_item) {
616
+						$additional_query .= "(spotter_archive_output.ident like '%".$translate."%') OR ";
617
+					}
602 618
 					$additional_query .= "(spotter_archive_output.highlight like '%".$q_item."%')";
603 619
 					$additional_query .= ")";
604 620
 				}
@@ -778,7 +794,9 @@  discard block
 block discarded – undo
778 794
 				date_default_timezone_set($globalTimezone);
779 795
 				$datetime = new DateTime();
780 796
 				$offset = $datetime->format('P');
781
-			} else $offset = '+00:00';
797
+			} else {
798
+				$offset = '+00:00';
799
+			}
782 800
 			if ($date_array[1] != "") {
783 801
 				$date_array[0] = date("Y-m-d H:i:s", strtotime($date_array[0]));
784 802
 				$date_array[1] = date("Y-m-d H:i:s", strtotime($date_array[1]));
@@ -1021,9 +1039,13 @@  discard block
 block discarded – undo
1021 1039
 				$query .= "AND date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
1022 1040
 			}
1023 1041
 		}
1024
-		if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
1042
+		if ($sincedate != '') {
1043
+			$query .= "AND date > '".$sincedate."' ";
1044
+		}
1025 1045
 		$query .= "GROUP BY c.name, c.iso3, c.iso2 ORDER BY nb DESC";
1026
-		if ($limit) $query .= " LIMIT 0,10";
1046
+		if ($limit) {
1047
+			$query .= " LIMIT 0,10";
1048
+		}
1027 1049
 
1028 1050
 
1029 1051
 		$sth = $this->db->prepare($query);
@@ -1065,9 +1087,13 @@  discard block
 block discarded – undo
1065 1087
 				$query .= "AND s.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
1066 1088
 			}
1067 1089
 		}
1068
-		if ($sincedate != '') $query .= "AND s.date > '".$sincedate."' ";
1090
+		if ($sincedate != '') {
1091
+			$query .= "AND s.date > '".$sincedate."' ";
1092
+		}
1069 1093
 		$query .= "GROUP BY o.airline_icao,c.name, c.iso3, c.iso2 ORDER BY nb DESC";
1070
-		if ($limit) $query .= " LIMIT 0,10";
1094
+		if ($limit) {
1095
+			$query .= " LIMIT 0,10";
1096
+		}
1071 1097
 
1072 1098
 
1073 1099
 		$sth = $this->db->prepare($query);
Please login to merge, or discard this patch.
js/map-aircraft.3d.js.php 1 patch
Braces   +24 added lines, -4 removed lines patch added patch discarded remove patch
@@ -275,7 +275,12 @@  discard block
 block discarded – undo
275 275
 			<?php
276 276
 			    } else {
277 277
 			?>
278
-			if (parseInt(lastupdateentity) < Math.floor(Date.now()-<?php if (isset($globalMapRefresh)) print $globalMapRefresh*2000; else print '60000'; ?>)) {
278
+			if (parseInt(lastupdateentity) < Math.floor(Date.now()-<?php if (isset($globalMapRefresh)) {
279
+	print $globalMapRefresh*2000;
280
+} else {
281
+	print '60000';
282
+}
283
+?>)) {
279 284
 				viewer.dataSources.get(dsn).entities.remove(entity);
280 285
 				czmlds.entities.removeById(entityid);
281 286
 			}
@@ -564,7 +569,12 @@  discard block
 block discarded – undo
564 569
 		if (!((isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS)) && (isset($_COOKIE['polar']) && $_COOKIE['polar'] == 'true')) {
565 570
 ?>
566 571
 update_polarLayer();
567
-setInterval(function(){update_polarLayer()},<?php if (isset($globalMapRefresh)) print $globalMapRefresh*1000*2; else print '60000'; ?>);
572
+setInterval(function(){update_polarLayer()},<?php if (isset($globalMapRefresh)) {
573
+	print $globalMapRefresh*1000*2;
574
+} else {
575
+	print '60000';
576
+}
577
+?>);
568 578
 <?php
569 579
 		}
570 580
 ?>
@@ -695,7 +705,12 @@  discard block
 block discarded – undo
695 705
 				}
696 706
 			}
697 707
 		}
698
-	,<?php if (isset($globalMapRefresh)) print $globalMapRefresh*1000; else print '30000'; ?>);
708
+	,<?php if (isset($globalMapRefresh)) {
709
+	print $globalMapRefresh*1000;
710
+} else {
711
+	print '30000';
712
+}
713
+?>);
699 714
 } else {
700 715
 	var clockViewModel = new Cesium.ClockViewModel(viewer.clock);
701 716
 	var animationViewModel = new Cesium.AnimationViewModel(clockViewModel);
@@ -724,7 +739,12 @@  discard block
 block discarded – undo
724 739
     if ((isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM)) {
725 740
 ?>
726 741
 update_atcLayer();
727
-setInterval(function(){update_atcLayer()},<?php if (isset($globalMapRefresh)) print $globalMapRefresh*1000*2; else print '60000'; ?>);
742
+setInterval(function(){update_atcLayer()},<?php if (isset($globalMapRefresh)) {
743
+	print $globalMapRefresh*1000*2;
744
+} else {
745
+	print '60000';
746
+}
747
+?>);
728 748
 <?php
729 749
     }
730 750
 ?>
Please login to merge, or discard this patch.
index.php 1 patch
Braces   +513 added lines, -130 removed lines patch added patch discarded remove patch
@@ -51,7 +51,10 @@  discard block
 block discarded – undo
51 51
 <?php
52 52
     if ((!isset($_COOKIE['MapFormat']) && isset($globalMap3Ddefault) && $globalMap3Ddefault) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d')) {
53 53
 ?>
54
-<script src="<?php echo $globalURL; ?>/js/map.3d.js.php<?php if (isset($tsk)) print '?tsk='.$tsk; ?>"></script>
54
+<script src="<?php echo $globalURL; ?>/js/map.3d.js.php<?php if (isset($tsk)) {
55
+	print '?tsk='.$tsk;
56
+}
57
+?>"></script>
55 58
 <?php
56 59
 	if (!isset($globalAircraft) || $globalAircraft) {
57 60
 ?>
@@ -141,8 +144,14 @@  discard block
 block discarded – undo
141 144
 ?>
142 145
 		<form>
143 146
 			<ul>
144
-				<li><div class="checkbox"><label><input type="checkbox" name="waypoints" value="1" onclick="showWaypoints(this);" <?php if (isset($_COOKIE['waypoints']) && $_COOKIE['waypoints'] == 'true') print 'checked'; ?> /><?php echo _("Display waypoints"); ?></label></div></li>
145
-				<li><div class="checkbox"><label><input type="checkbox" name="airspace" value="1" onclick="showAirspace(this);" <?php if (isset($_COOKIE['airspace']) && $_COOKIE['airspace'] == 'true') print 'checked'; ?> /><?php echo _("Display airspace"); ?></label></div></li>
147
+				<li><div class="checkbox"><label><input type="checkbox" name="waypoints" value="1" onclick="showWaypoints(this);" <?php if (isset($_COOKIE['waypoints']) && $_COOKIE['waypoints'] == 'true') {
148
+	print 'checked';
149
+}
150
+?> /><?php echo _("Display waypoints"); ?></label></div></li>
151
+				<li><div class="checkbox"><label><input type="checkbox" name="airspace" value="1" onclick="showAirspace(this);" <?php if (isset($_COOKIE['airspace']) && $_COOKIE['airspace'] == 'true') {
152
+	print 'checked';
153
+}
154
+?> /><?php echo _("Display airspace"); ?></label></div></li>
146 155
 			</ul>
147 156
 		</form>
148 157
 <?php
@@ -150,8 +159,14 @@  discard block
 block discarded – undo
150 159
 ?>
151 160
 		<form>
152 161
 			<ul>
153
-				<li><div class="checkbox"><label><input type="checkbox" name="waypoints" value="1" onclick="showWaypoints(this);" <?php if (isset($_COOKIE['waypoints']) && $_COOKIE['waypoints'] == 'true') print 'checked'; ?> /><?php echo _("Display waypoints"); ?> Beta</label></div></li>
154
-				<li><div class="checkbox"><label><input type="checkbox" name="airspace" value="1" onclick="showAirspace(this);" <?php if (isset($_COOKIE['airspace']) && $_COOKIE['airspace'] == 'true') print 'checked'; ?> /><?php echo _("Display airspace"); ?> Beta</label></div></li>
162
+				<li><div class="checkbox"><label><input type="checkbox" name="waypoints" value="1" onclick="showWaypoints(this);" <?php if (isset($_COOKIE['waypoints']) && $_COOKIE['waypoints'] == 'true') {
163
+	print 'checked';
164
+}
165
+?> /><?php echo _("Display waypoints"); ?> Beta</label></div></li>
166
+				<li><div class="checkbox"><label><input type="checkbox" name="airspace" value="1" onclick="showAirspace(this);" <?php if (isset($_COOKIE['airspace']) && $_COOKIE['airspace'] == 'true') {
167
+	print 'checked';
168
+}
169
+?> /><?php echo _("Display airspace"); ?> Beta</label></div></li>
155 170
 			</ul>
156 171
 			<p>This layers are in Beta, this can and will crash.</p>
157 172
 		</form>
@@ -162,14 +177,32 @@  discard block
 block discarded – undo
162 177
 		<h1>NOTAM</h1>
163 178
 		<form>
164 179
 			<ul>
165
-				<li><div class="checkbox"><label><input type="checkbox" name="notamcb" value="1" onclick="showNotam(this);" <?php if (isset($_COOKIE['notam']) && $_COOKIE['notam'] == 'true') print 'checked'; ?> /><?php echo _("Display NOTAM"); ?></label></div></li>
180
+				<li><div class="checkbox"><label><input type="checkbox" name="notamcb" value="1" onclick="showNotam(this);" <?php if (isset($_COOKIE['notam']) && $_COOKIE['notam'] == 'true') {
181
+	print 'checked';
182
+}
183
+?> /><?php echo _("Display NOTAM"); ?></label></div></li>
166 184
 				<li><?php echo _("NOTAM scope:"); ?>
167 185
 					<select class="selectpicker" onchange="notamscope(this);">
168
-						<option<?php if (!isset($_COOKIE['notamscope']) || $_COOKIE['notamscope'] == 'All') print ' selected'; ?>>All</option>
169
-						<option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Airport/Enroute warning') print ' selected'; ?>>Airport/Enroute warning</option>
170
-						<option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Airport warning') print ' selected'; ?>>Airport warning</option>
171
-						<option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Navigation warning') print ' selected'; ?>>Navigation warning</option>
172
-						<option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Enroute warning') print ' selected'; ?>>Enroute warning</option>
186
+						<option<?php if (!isset($_COOKIE['notamscope']) || $_COOKIE['notamscope'] == 'All') {
187
+	print ' selected';
188
+}
189
+?>>All</option>
190
+						<option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Airport/Enroute warning') {
191
+	print ' selected';
192
+}
193
+?>>Airport/Enroute warning</option>
194
+						<option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Airport warning') {
195
+	print ' selected';
196
+}
197
+?>>Airport warning</option>
198
+						<option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Navigation warning') {
199
+	print ' selected';
200
+}
201
+?>>Navigation warning</option>
202
+						<option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Enroute warning') {
203
+	print ' selected';
204
+}
205
+?>>Enroute warning</option>
173 206
 					</select
174 207
 				</li>
175 208
 			</ul>
@@ -197,7 +230,10 @@  discard block
 block discarded – undo
197 230
 		    <div class="form-group">
198 231
 			<label><?php echo _("From:"); ?></label>
199 232
 			<div class='input-group date' id='datetimepicker1'>
200
-			    <input type='text' id="start_date" name="start_date" class="form-control" autocomplete="off" value="<?php if (isset($_COOKIE['archive_begin']) && $_COOKIE['archive_begin'] != '') print date("Y-m-d H:i",$_COOKIE['archive_begin']).' UTC'; ?>" required />
233
+			    <input type='text' id="start_date" name="start_date" class="form-control" autocomplete="off" value="<?php if (isset($_COOKIE['archive_begin']) && $_COOKIE['archive_begin'] != '') {
234
+	print date("Y-m-d H:i",$_COOKIE['archive_begin']).' UTC';
235
+}
236
+?>" required />
201 237
 			    <span class="input-group-addon">
202 238
 				<span class="glyphicon glyphicon-calendar"></span>
203 239
 			    </span>
@@ -206,7 +242,10 @@  discard block
 block discarded – undo
206 242
 		    <div class="form-group">
207 243
 			<label><?php echo _("To:"); ?></label>
208 244
 			<div class='input-group date' id='datetimepicker2'>
209
-			    <input type='text' id="end_date" name="end_date" class="form-control" autocomplete="off" value="<?php if (isset($_COOKIE['archive_end']) && $_COOKIE['archive_end'] != '') print date("Y-m-d H:i",$_COOKIE['archive_end']).' UTC'; ?>" />
245
+			    <input type='text' id="end_date" name="end_date" class="form-control" autocomplete="off" value="<?php if (isset($_COOKIE['archive_end']) && $_COOKIE['archive_end'] != '') {
246
+	print date("Y-m-d H:i",$_COOKIE['archive_end']).' UTC';
247
+}
248
+?>" />
210 249
 			    <span class="input-group-addon">
211 250
 				<span class="glyphicon glyphicon-calendar"></span>
212 251
 			    </span>
@@ -238,8 +277,20 @@  discard block
 block discarded – undo
238 277
 		    </script>
239 278
 		<li><?php echo _("Playback speed:"); ?>
240 279
 		    <div class="range">
241
-			<input type="range" min="0" max="50" step="1" id="archivespeed" 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'; ?>">
242
-			<output id="archivespeedrange"><?php  if (isset($_COOKIE['archive_speed'])) print $_COOKIE['archive_speed']; else print '1'; ?></output>
280
+			<input type="range" min="0" max="50" step="1" id="archivespeed" name="archivespeed" onChange="archivespeedrange.value=value;" value="<?php  if (isset($_POST['archivespeed'])) {
281
+	print $_POST['archivespeed'];
282
+} elseif (isset($_COOKIE['archive_speed'])) {
283
+	print $_COOKIE['archive_speed'];
284
+} else {
285
+	print '1';
286
+}
287
+?>">
288
+			<output id="archivespeedrange"><?php  if (isset($_COOKIE['archive_speed'])) {
289
+	print $_COOKIE['archive_speed'];
290
+} else {
291
+	print '1';
292
+}
293
+?></output>
243 294
 		    </div>
244 295
 		</li>
245 296
 		<li><button type="button" onclick="addarchive(begindate,enddate);" class="btn btn-primary"><?php echo _("Show archive"); ?></button></li>
@@ -258,29 +309,53 @@  discard block
 block discarded – undo
258 309
 		    <li><?php echo _("Type of Map:"); ?>
259 310
 			<select  class="selectpicker" onchange="mapType(this);">
260 311
 			    <?php
261
-				if (!isset($_COOKIE['MapType']) || $_COOKIE['MapType'] == '') $MapType = $globalMapProvider;
262
-				else $MapType = $_COOKIE['MapType'];
312
+				if (!isset($_COOKIE['MapType']) || $_COOKIE['MapType'] == '') {
313
+					$MapType = $globalMapProvider;
314
+				} else {
315
+					$MapType = $_COOKIE['MapType'];
316
+				}
263 317
 			    ?>
264 318
 			    <?php
265 319
 				if (isset($globalMapOffline) && $globalMapOffline === TRUE) {
266 320
 			    ?>
267
-			    <option value="offline"<?php if ($MapType == 'offline') print ' selected'; ?>>Natural Earth (local)</option>
321
+			    <option value="offline"<?php if ($MapType == 'offline') {
322
+	print ' selected';
323
+}
324
+?>>Natural Earth (local)</option>
268 325
 			    <?php
269 326
 				} else {
270 327
 				    if (file_exists(dirname(__FILE__).'/js/Cesium/Assets/Textures/NaturalEarthII/tilemapresource.xml')) {
271 328
 			    ?>
272
-			    <option value="offline"<?php if ($MapType == 'offline') print ' selected'; ?>>Natural Earth (local)</option>
329
+			    <option value="offline"<?php if ($MapType == 'offline') {
330
+	print ' selected';
331
+}
332
+?>>Natural Earth (local)</option>
273 333
 			    <?php
274 334
 				    }
275 335
 			    ?>
276
-			    <option value="ArcGIS-Streetmap"<?php if ($MapType == 'ArcGIS-Streetmap') print ' selected'; ?>>ArcGIS Streetmap</option>
277
-			    <option value="ArcGIS-Satellite"<?php if ($MapType == 'ArcGIS-Satellite') print ' selected'; ?>>ArcGIS Satellite</option>
336
+			    <option value="ArcGIS-Streetmap"<?php if ($MapType == 'ArcGIS-Streetmap') {
337
+	print ' selected';
338
+}
339
+?>>ArcGIS Streetmap</option>
340
+			    <option value="ArcGIS-Satellite"<?php if ($MapType == 'ArcGIS-Satellite') {
341
+	print ' selected';
342
+}
343
+?>>ArcGIS Satellite</option>
278 344
 			    <?php
279 345
 				    if (isset($globalBingMapKey) && $globalBingMapKey != '') {
280 346
 			    ?>
281
-			    <option value="Bing-Aerial"<?php if ($MapType == 'Bing-Aerial') print ' selected'; ?>>Bing-Aerial</option>
282
-			    <option value="Bing-Hybrid"<?php if ($MapType == 'Bing-Hybrid') print ' selected'; ?>>Bing-Hybrid</option>
283
-			    <option value="Bing-Road"<?php if ($MapType == 'Bing-Road') print ' selected'; ?>>Bing-Road</option>
347
+			    <option value="Bing-Aerial"<?php if ($MapType == 'Bing-Aerial') {
348
+	print ' selected';
349
+}
350
+?>>Bing-Aerial</option>
351
+			    <option value="Bing-Hybrid"<?php if ($MapType == 'Bing-Hybrid') {
352
+	print ' selected';
353
+}
354
+?>>Bing-Hybrid</option>
355
+			    <option value="Bing-Road"<?php if ($MapType == 'Bing-Road') {
356
+	print ' selected';
357
+}
358
+?>>Bing-Road</option>
284 359
 			    <?php
285 360
 				    }
286 361
 			    ?>
@@ -290,59 +365,143 @@  discard block
 block discarded – undo
290 365
 			    <?php
291 366
 					if (isset($globalHereappId) && $globalHereappId != '' && isset($globalHereappCode) && $globalHereappCode != '') {
292 367
 			    ?>
293
-			    <option value="Here-Aerial"<?php if ($MapType == 'Here') print ' selected'; ?>>Here-Aerial</option>
294
-			    <option value="Here-Hybrid"<?php if ($MapType == 'Here') print ' selected'; ?>>Here-Hybrid</option>
295
-			    <option value="Here-Road"<?php if ($MapType == 'Here') print ' selected'; ?>>Here-Road</option>
368
+			    <option value="Here-Aerial"<?php if ($MapType == 'Here') {
369
+	print ' selected';
370
+}
371
+?>>Here-Aerial</option>
372
+			    <option value="Here-Hybrid"<?php if ($MapType == 'Here') {
373
+	print ' selected';
374
+}
375
+?>>Here-Hybrid</option>
376
+			    <option value="Here-Road"<?php if ($MapType == 'Here') {
377
+	print ' selected';
378
+}
379
+?>>Here-Road</option>
296 380
 			    <?php
297 381
 					}
298 382
 			    ?>
299 383
 			    <?php
300 384
 					if (isset($globalGoogleAPIKey) && $globalGoogleAPIKey != '') {
301 385
 			    ?>
302
-			    <option value="Google-Roadmap"<?php if ($MapType == 'Google-Roadmap') print ' selected'; ?>>Google Roadmap</option>
303
-			    <option value="Google-Satellite"<?php if ($MapType == 'Google-Satellite') print ' selected'; ?>>Google Satellite</option>
304
-			    <option value="Google-Hybrid"<?php if ($MapType == 'Google-Hybrid') print ' selected'; ?>>Google Hybrid</option>
305
-			    <option value="Google-Terrain"<?php if ($MapType == 'Google-Terrain') print ' selected'; ?>>Google Terrain</option>
386
+			    <option value="Google-Roadmap"<?php if ($MapType == 'Google-Roadmap') {
387
+	print ' selected';
388
+}
389
+?>>Google Roadmap</option>
390
+			    <option value="Google-Satellite"<?php if ($MapType == 'Google-Satellite') {
391
+	print ' selected';
392
+}
393
+?>>Google Satellite</option>
394
+			    <option value="Google-Hybrid"<?php if ($MapType == 'Google-Hybrid') {
395
+	print ' selected';
396
+}
397
+?>>Google Hybrid</option>
398
+			    <option value="Google-Terrain"<?php if ($MapType == 'Google-Terrain') {
399
+	print ' selected';
400
+}
401
+?>>Google Terrain</option>
306 402
 			    <?php
307 403
 					}
308 404
 			    ?>
309 405
 			    <?php
310 406
 					if (isset($globalMapQuestKey) && $globalMapQuestKey != '') {
311 407
 			    ?>
312
-			    <option value="MapQuest-OSM"<?php if ($MapType == 'MapQuest-OSM') print ' selected'; ?>>MapQuest-OSM</option>
313
-			    <option value="MapQuest-Aerial"<?php if ($MapType == 'MapQuest-Aerial') print ' selected'; ?>>MapQuest-Aerial</option>
314
-			    <option value="MapQuest-Hybrid"<?php if ($MapType == 'MapQuest-Hybrid') print ' selected'; ?>>MapQuest-Hybrid</option>
408
+			    <option value="MapQuest-OSM"<?php if ($MapType == 'MapQuest-OSM') {
409
+	print ' selected';
410
+}
411
+?>>MapQuest-OSM</option>
412
+			    <option value="MapQuest-Aerial"<?php if ($MapType == 'MapQuest-Aerial') {
413
+	print ' selected';
414
+}
415
+?>>MapQuest-Aerial</option>
416
+			    <option value="MapQuest-Hybrid"<?php if ($MapType == 'MapQuest-Hybrid') {
417
+	print ' selected';
418
+}
419
+?>>MapQuest-Hybrid</option>
315 420
 			    <?php
316 421
 					}
317 422
 			    ?>
318
-			    <option value="Yandex"<?php if ($MapType == 'Yandex') print ' selected'; ?>>Yandex</option>
319
-			    <option value="offline"<?php if ($MapType == 'offline') print ' selected'; ?>>Natural Earth</option>
423
+			    <option value="Yandex"<?php if ($MapType == 'Yandex') {
424
+	print ' selected';
425
+}
426
+?>>Yandex</option>
427
+			    <option value="offline"<?php if ($MapType == 'offline') {
428
+	print ' selected';
429
+}
430
+?>>Natural Earth</option>
320 431
 			    <?php
321 432
 				    }
322 433
 			    ?>
323
-			    <option value="NatGeo-Street"<?php if ($MapType == 'NatGeo-Street') print ' selected'; ?>>National Geographic Street</option>
434
+			    <option value="NatGeo-Street"<?php if ($MapType == 'NatGeo-Street') {
435
+	print ' selected';
436
+}
437
+?>>National Geographic Street</option>
324 438
 			    <?php
325 439
 				    if (isset($globalMapboxToken) && $globalMapboxToken != '') {
326
-					if (!isset($_COOKIE['MapTypeId'])) $MapBoxId = 'default';
327
-					else $MapBoxId = $_COOKIE['MapTypeId'];
440
+					if (!isset($_COOKIE['MapTypeId'])) {
441
+						$MapBoxId = 'default';
442
+					} else {
443
+						$MapBoxId = $_COOKIE['MapTypeId'];
444
+					}
328 445
 			    ?>
329
-			    <option value="MapboxGL"<?php if ($MapType == 'MapboxGL') print ' selected'; ?>>Mapbox GL</option>
330
-			    <option value="Mapbox-default"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'default') print ' selected'; ?>>Mapbox default</option>
331
-			    <option value="Mapbox-mapbox.streets"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.streets') print ' selected'; ?>>Mapbox streets</option>
332
-			    <option value="Mapbox-mapbox.light"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.light') print ' selected'; ?>>Mapbox light</option>
333
-			    <option value="Mapbox-mapbox.dark"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.dark') print ' selected'; ?>>Mapbox dark</option>
334
-			    <option value="Mapbox-mapbox.satellite"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.satellite') print ' selected'; ?>>Mapbox satellite</option>
335
-			    <option value="Mapbox-mapbox.streets-satellite"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.streets-satellite') print ' selected'; ?>>Mapbox streets-satellite</option>
336
-			    <option value="Mapbox-mapbox.streets-basic"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.streets-basic') print ' selected'; ?>>Mapbox streets-basic</option>
337
-			    <option value="Mapbox-mapbox.comic"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.comic') print ' selected'; ?>>Mapbox comic</option>
338
-			    <option value="Mapbox-mapbox.outdoors"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.outdoors') print ' selected'; ?>>Mapbox outdoors</option>
339
-			    <option value="Mapbox-mapbox.pencil"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.pencil') print ' selected'; ?>>Mapbox pencil</option>
340
-			    <option value="Mapbox-mapbox.pirates"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.pirates') print ' selected'; ?>>Mapbox pirates</option>
341
-			    <option value="Mapbox-mapbox.emerald"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.emerald') print ' selected'; ?>>Mapbox emerald</option>
446
+			    <option value="MapboxGL"<?php if ($MapType == 'MapboxGL') {
447
+	print ' selected';
448
+}
449
+?>>Mapbox GL</option>
450
+			    <option value="Mapbox-default"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'default') {
451
+	print ' selected';
452
+}
453
+?>>Mapbox default</option>
454
+			    <option value="Mapbox-mapbox.streets"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.streets') {
455
+	print ' selected';
456
+}
457
+?>>Mapbox streets</option>
458
+			    <option value="Mapbox-mapbox.light"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.light') {
459
+	print ' selected';
460
+}
461
+?>>Mapbox light</option>
462
+			    <option value="Mapbox-mapbox.dark"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.dark') {
463
+	print ' selected';
464
+}
465
+?>>Mapbox dark</option>
466
+			    <option value="Mapbox-mapbox.satellite"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.satellite') {
467
+	print ' selected';
468
+}
469
+?>>Mapbox satellite</option>
470
+			    <option value="Mapbox-mapbox.streets-satellite"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.streets-satellite') {
471
+	print ' selected';
472
+}
473
+?>>Mapbox streets-satellite</option>
474
+			    <option value="Mapbox-mapbox.streets-basic"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.streets-basic') {
475
+	print ' selected';
476
+}
477
+?>>Mapbox streets-basic</option>
478
+			    <option value="Mapbox-mapbox.comic"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.comic') {
479
+	print ' selected';
480
+}
481
+?>>Mapbox comic</option>
482
+			    <option value="Mapbox-mapbox.outdoors"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.outdoors') {
483
+	print ' selected';
484
+}
485
+?>>Mapbox outdoors</option>
486
+			    <option value="Mapbox-mapbox.pencil"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.pencil') {
487
+	print ' selected';
488
+}
489
+?>>Mapbox pencil</option>
490
+			    <option value="Mapbox-mapbox.pirates"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.pirates') {
491
+	print ' selected';
492
+}
493
+?>>Mapbox pirates</option>
494
+			    <option value="Mapbox-mapbox.emerald"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.emerald') {
495
+	print ' selected';
496
+}
497
+?>>Mapbox emerald</option>
342 498
 			    <?php
343 499
 				    }
344 500
 			    ?>
345
-			    <option value="OpenStreetMap"<?php if ($MapType == 'OpenStreetMap') print ' selected'; ?>>OpenStreetMap</option>
501
+			    <option value="OpenStreetMap"<?php if ($MapType == 'OpenStreetMap') {
502
+	print ' selected';
503
+}
504
+?>>OpenStreetMap</option>
346 505
 			    <?php
347 506
 				}
348 507
 			    ?>
@@ -353,10 +512,22 @@  discard block
 block discarded – undo
353 512
 ?>
354 513
 		    <li><?php echo _("Type of Terrain:"); ?>
355 514
 			<select  class="selectpicker" onchange="terrainType(this);">
356
-			    <option value="stk"<?php if (!isset($_COOKIE['MapTerrain']) || $_COOKIE['MapTerrain'] == 'stk') print ' selected'; ?>>stk terrain</option>
357
-			    <option value="ellipsoid"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'ellipsoid') print ' selected';?>>ellipsoid</option>
358
-			    <option value="vrterrain"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'vrterrain') print ' selected';?>>vr terrain</option>
359
-			    <option value="articdem"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'articdem') print ' selected';?>>ArticDEM</option>
515
+			    <option value="stk"<?php if (!isset($_COOKIE['MapTerrain']) || $_COOKIE['MapTerrain'] == 'stk') {
516
+	print ' selected';
517
+}
518
+?>>stk terrain</option>
519
+			    <option value="ellipsoid"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'ellipsoid') {
520
+	print ' selected';
521
+}
522
+?>>ellipsoid</option>
523
+			    <option value="vrterrain"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'vrterrain') {
524
+	print ' selected';
525
+}
526
+?>>vr terrain</option>
527
+			    <option value="articdem"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'articdem') {
528
+	print ' selected';
529
+}
530
+?>>ArticDEM</option>
360 531
 			</select>
361 532
 		    </li>
362 533
 <?php
@@ -365,50 +536,98 @@  discard block
 block discarded – undo
365 536
 <?php
366 537
     if (!isset($_COOKIE['MapFormat']) || $_COOKIE['MapFormat'] != '3d') {
367 538
 ?>
368
-		    <li><div class="checkbox"><label><input type="checkbox" name="display2dbuildings" value="1" onclick="clickDisplay2DBuildings(this)" <?php if (isset($_COOKIE['Map2DBuildings']) && $_COOKIE['Map2DBuildings'] == 'true') print 'checked'; ?> ><?php echo _("Display 2.5D buidings on map"); ?></label></div></li>
539
+		    <li><div class="checkbox"><label><input type="checkbox" name="display2dbuildings" value="1" onclick="clickDisplay2DBuildings(this)" <?php if (isset($_COOKIE['Map2DBuildings']) && $_COOKIE['Map2DBuildings'] == 'true') {
540
+	print 'checked';
541
+}
542
+?> ><?php echo _("Display 2.5D buidings on map"); ?></label></div></li>
369 543
 
370 544
 <?php
371 545
 	if (!isset($globalAircraft) || $globalAircraft === TRUE) {
372 546
 ?>
373
-		    <!--<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>-->
374
-		    <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>
375
-		    <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']) && isset($globalMapRoute) && $globalMapRoute)) print 'checked'; ?> ><?php echo _("Display flight route on click"); ?></label></div></li>
376
-		    <li><div class="checkbox"><label><input type="checkbox" name="flightremainingroute" value="1" onclick="clickFlightRemainingRoute(this)" <?php if ((isset($_COOKIE['MapRemainingRoute']) && $_COOKIE['MapRemainingRoute'] == 'true') || (!isset($_COOKIE['MapRemainingRoute']) && isset($globalMapRemainingRoute) && $globalMapRemainingRoute)) print 'checked'; ?> ><?php echo _("Display flight remaining route on click"); ?></label></div></li>
377
-		    <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>
547
+		    <!--<li><div class="checkbox"><label><input type="checkbox" name="flightpopup" value="1" onclick="clickFlightPopup(this)" <?php if (isset($_COOKIE['flightpopup']) && $_COOKIE['flightpopup'] == 'true') {
548
+	print 'checked';
549
+}
550
+?> ><?php echo _("Display flight info as popup"); ?></label></div></li>-->
551
+		    <li><div class="checkbox"><label><input type="checkbox" name="flightpath" value="1" onclick="clickFlightPath(this)" <?php if ((isset($_COOKIE['flightpath']) && $_COOKIE['flightpath'] == 'true')) {
552
+	print 'checked';
553
+}
554
+?> ><?php echo _("Display flight path"); ?></label></div></li>
555
+		    <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']) && isset($globalMapRoute) && $globalMapRoute)) {
556
+	print 'checked';
557
+}
558
+?> ><?php echo _("Display flight route on click"); ?></label></div></li>
559
+		    <li><div class="checkbox"><label><input type="checkbox" name="flightremainingroute" value="1" onclick="clickFlightRemainingRoute(this)" <?php if ((isset($_COOKIE['MapRemainingRoute']) && $_COOKIE['MapRemainingRoute'] == 'true') || (!isset($_COOKIE['MapRemainingRoute']) && isset($globalMapRemainingRoute) && $globalMapRemainingRoute)) {
560
+	print 'checked';
561
+}
562
+?> ><?php echo _("Display flight remaining route on click"); ?></label></div></li>
563
+		    <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)) {
564
+	print 'checked';
565
+}
566
+?> ><?php echo _("Planes animate between updates"); ?></label></div></li>
378 567
 <?php
379 568
 	} elseif (!isset($globalTracker) || $globalTracker === TRUE) {
380 569
 ?>
381
-		    <li><div class="checkbox"><label><input type="checkbox" name="mapmatching" value="1" onclick="clickMapMatching(this)" <?php if ((isset($_COOKIE['mapmatching']) && $_COOKIE['mapmatching'] == 'true') || (!isset($_COOKIE['mapmatching']) && isset($globalMapMatching) && $globalMapMatching)) print 'checked'; ?> ><?php echo _("Enable map matching"); ?></label></div></li>
570
+		    <li><div class="checkbox"><label><input type="checkbox" name="mapmatching" value="1" onclick="clickMapMatching(this)" <?php if ((isset($_COOKIE['mapmatching']) && $_COOKIE['mapmatching'] == 'true') || (!isset($_COOKIE['mapmatching']) && isset($globalMapMatching) && $globalMapMatching)) {
571
+	print 'checked';
572
+}
573
+?> ><?php echo _("Enable map matching"); ?></label></div></li>
382 574
 <?php
383 575
 	}
384 576
 	if (isset($globalSatellite) && $globalSatellite === TRUE) {
385 577
 ?>
386
-		    <li><div class="checkbox"><label><input type="checkbox" name="satelliteestimation" value="1" onclick="clickSatelliteEstimation(this)" <?php if ((isset($_COOKIE['satelliteestimation']) && $_COOKIE['satelliteestimation'] == 'true') || (!isset($_COOKIE['satelliteestimation']) && !isset($globalMapEstimation)) || (!isset($_COOKIE['satelliteestimation']) && isset($globalMapEstimation) && $globalMapEstimation)) print 'checked'; ?> ><?php echo _("Satellites animate between updates"); ?></label></div></li>
578
+		    <li><div class="checkbox"><label><input type="checkbox" name="satelliteestimation" value="1" onclick="clickSatelliteEstimation(this)" <?php if ((isset($_COOKIE['satelliteestimation']) && $_COOKIE['satelliteestimation'] == 'true') || (!isset($_COOKIE['satelliteestimation']) && !isset($globalMapEstimation)) || (!isset($_COOKIE['satelliteestimation']) && isset($globalMapEstimation) && $globalMapEstimation)) {
579
+	print 'checked';
580
+}
581
+?> ><?php echo _("Satellites animate between updates"); ?></label></div></li>
387 582
 <?php
388 583
 	}
389 584
     }
390 585
 ?>
391
-		    <li><div class="checkbox"><label><input type="checkbox" name="displayairports" value="1" onclick="clickDisplayAirports(this)" <?php if (isset($_COOKIE['displayairports']) && $_COOKIE['displayairports'] == 'true' || !isset($_COOKIE['displayairports'])) print 'checked'; ?> ><?php echo _("Display airports on map"); ?></label></div></li>
392
-		    <li><div class="checkbox"><label><input type="checkbox" name="displaygroundstation" value="1" onclick="clickDisplayGroundStation(this)" <?php if ((isset($_COOKIE['show_GroundStation']) && $_COOKIE['show_GroundStation'] == 'true') || (!isset($_COOKIE['show_GroundStation']) && (isset($globalMapGroundStation) && $globalMapGroundStation === TRUE))) print 'checked'; ?> ><?php echo _("Display ground station on map"); ?></label></div></li>
393
-		    <li><div class="checkbox"><label><input type="checkbox" name="displayweatherstation" value="1" onclick="clickDisplayWeatherStation(this)" <?php if ((isset($_COOKIE['show_WeatherStation']) && $_COOKIE['show_WeatherStation'] == 'true') || (!isset($_COOKIE['show_WeatherStation']) && (isset($globalMapWeatherStation) && $globalMapWeatherStation === TRUE))) print 'checked'; ?> ><?php echo _("Display weather station on map"); ?></label></div></li>
394
-		    <li><div class="checkbox"><label><input type="checkbox" name="displaylightning" value="1" onclick="clickDisplayLightning(this)" <?php if ((isset($_COOKIE['show_Lightning']) && $_COOKIE['show_Lightning'] == 'true') || (!isset($_COOKIE['show_Lightning']) && (isset($globalMapLightning) && $globalMapLightning === TRUE))) print 'checked'; ?> ><?php echo _("Display lightning on map"); ?></label></div></li>
586
+		    <li><div class="checkbox"><label><input type="checkbox" name="displayairports" value="1" onclick="clickDisplayAirports(this)" <?php if (isset($_COOKIE['displayairports']) && $_COOKIE['displayairports'] == 'true' || !isset($_COOKIE['displayairports'])) {
587
+	print 'checked';
588
+}
589
+?> ><?php echo _("Display airports on map"); ?></label></div></li>
590
+		    <li><div class="checkbox"><label><input type="checkbox" name="displaygroundstation" value="1" onclick="clickDisplayGroundStation(this)" <?php if ((isset($_COOKIE['show_GroundStation']) && $_COOKIE['show_GroundStation'] == 'true') || (!isset($_COOKIE['show_GroundStation']) && (isset($globalMapGroundStation) && $globalMapGroundStation === TRUE))) {
591
+	print 'checked';
592
+}
593
+?> ><?php echo _("Display ground station on map"); ?></label></div></li>
594
+		    <li><div class="checkbox"><label><input type="checkbox" name="displayweatherstation" value="1" onclick="clickDisplayWeatherStation(this)" <?php if ((isset($_COOKIE['show_WeatherStation']) && $_COOKIE['show_WeatherStation'] == 'true') || (!isset($_COOKIE['show_WeatherStation']) && (isset($globalMapWeatherStation) && $globalMapWeatherStation === TRUE))) {
595
+	print 'checked';
596
+}
597
+?> ><?php echo _("Display weather station on map"); ?></label></div></li>
598
+		    <li><div class="checkbox"><label><input type="checkbox" name="displaylightning" value="1" onclick="clickDisplayLightning(this)" <?php if ((isset($_COOKIE['show_Lightning']) && $_COOKIE['show_Lightning'] == 'true') || (!isset($_COOKIE['show_Lightning']) && (isset($globalMapLightning) && $globalMapLightning === TRUE))) {
599
+	print 'checked';
600
+}
601
+?> ><?php echo _("Display lightning on map"); ?></label></div></li>
395 602
 <?php
396 603
 	if (isset($globalFires)) {
397 604
 ?>
398
-		    <li><div class="checkbox"><label><input type="checkbox" name="displayfires" value="1" onclick="clickDisplayFires(this)" <?php if ((isset($_COOKIE['show_Fires']) && $_COOKIE['show_Fires'] == 'true') || (!isset($_COOKIE['show_Fires']) && (isset($globalMapFires) && $globalMapFires === TRUE))) print 'checked'; ?> ><?php echo _("Display fires on map"); ?></label></div></li>
605
+		    <li><div class="checkbox"><label><input type="checkbox" name="displayfires" value="1" onclick="clickDisplayFires(this)" <?php if ((isset($_COOKIE['show_Fires']) && $_COOKIE['show_Fires'] == 'true') || (!isset($_COOKIE['show_Fires']) && (isset($globalMapFires) && $globalMapFires === TRUE))) {
606
+	print 'checked';
607
+}
608
+?> ><?php echo _("Display fires on map"); ?></label></div></li>
399 609
 <?php
400 610
 	}
401 611
 	if (isset($globalMap3D) && $globalMap3D) {
402 612
 ?>
403
-		    <li><div class="checkbox"><label><input type="checkbox" name="singlemodel" value="1" onclick="clickSingleModel(this)" <?php if (isset($_COOKIE['singlemodel']) && $_COOKIE['singlemodel'] == 'true') print 'checked'; ?> ><?php echo _("Only display selected flight on 3D mode"); ?></label></div></li>
613
+		    <li><div class="checkbox"><label><input type="checkbox" name="singlemodel" value="1" onclick="clickSingleModel(this)" <?php if (isset($_COOKIE['singlemodel']) && $_COOKIE['singlemodel'] == 'true') {
614
+	print 'checked';
615
+}
616
+?> ><?php echo _("Only display selected flight on 3D mode"); ?></label></div></li>
404 617
 <?php
405 618
 	}
406 619
 ?>
407 620
 <?php
408 621
     if (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d') {
409 622
 ?>
410
-		    <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>
411
-		    <li><div class="checkbox"><label><input type="checkbox" name="one3dmodel" value="1" onclick="useOne3Dmodel(this)" <?php if ((isset($_COOKIE['one3dmodel']) && $_COOKIE['one3dmodel'] == 'true') || (!isset($_COOKIE['one3dmodel']) && isset($globalMap3DOneModel) && $globalMap3DOneModel)) print 'checked'; ?> ><?php echo _("Use same 3D model for all aircraft (use fewer resources)"); ?></label></div></li>
623
+		    <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')) {
624
+	print 'checked';
625
+}
626
+?> ><?php echo _("Show mini-map"); ?></label></div></li>
627
+		    <li><div class="checkbox"><label><input type="checkbox" name="one3dmodel" value="1" onclick="useOne3Dmodel(this)" <?php if ((isset($_COOKIE['one3dmodel']) && $_COOKIE['one3dmodel'] == 'true') || (!isset($_COOKIE['one3dmodel']) && isset($globalMap3DOneModel) && $globalMap3DOneModel)) {
628
+	print 'checked';
629
+}
630
+?> ><?php echo _("Use same 3D model for all aircraft (use fewer resources)"); ?></label></div></li>
412 631
 <?php
413 632
     }
414 633
     if (time() > mktime(0,0,0,12,1,date("Y")) && time() < mktime(0,0,0,12,31,date("Y"))) {
@@ -421,17 +640,25 @@  discard block
 block discarded – undo
421 640
 			if (function_exists('array_column')) {
422 641
 			    if (array_search(TRUE, array_column($globalSources, 'sourcestats')) !== FALSE) {
423 642
 		    ?>
424
-		    <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>
643
+		    <li><div class="checkbox"><label><input type="checkbox" name="flightpolar" value="1" onclick="clickPolar(this)" <?php if ((isset($_COOKIE['polar']) && $_COOKIE['polar'] == 'true')) {
644
+	print 'checked';
645
+}
646
+?> ><?php echo _("Display polar on map"); ?></label></div></li>
425 647
 		    <?php
426 648
 			    }
427 649
 			} elseif (isset($globalSources)) {
428 650
 			    $dispolar = false;
429 651
 			    foreach ($globalSources as $testsource) {
430
-			        if (isset($globalSources['sourcestats']) && $globalSources['sourcestats'] !== FALSE) $dispolar = true;
652
+			        if (isset($globalSources['sourcestats']) && $globalSources['sourcestats'] !== FALSE) {
653
+			        	$dispolar = true;
654
+			        }
431 655
 			    }
432 656
 			    if ($dispolar) {
433 657
 		    ?>
434
-		    <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>
658
+		    <li><div class="checkbox"><label><input type="checkbox" name="flightpolar" value="1" onclick="clickPolar(this)" <?php if ((isset($_COOKIE['polar']) && $_COOKIE['polar'] == 'true')) {
659
+	print 'checked';
660
+}
661
+?> ><?php echo _("Display polar on map"); ?></label></div></li>
435 662
 		    <?php
436 663
 			    }
437 664
 		        }
@@ -444,11 +671,21 @@  discard block
 block discarded – undo
444 671
 			if (!isset($globalAircraft) || $globalAircraft === TRUE) {
445 672
 		    	    if (extension_loaded('gd') && function_exists('gd_info')) {
446 673
 		    ?>
447
-		    <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>
674
+		    <li><input type="checkbox" name="aircraftcoloraltitude" value="1" onclick="iconColorAltitude(this)" <?php if (isset($_COOKIE['IconColorAltitude']) && $_COOKIE['IconColorAltitude'] == 'true') {
675
+	print 'checked';
676
+}
677
+?> ><?php echo _("Aircraft icon color based on altitude"); ?></li>
448 678
 		    <?php 
449 679
 				if (!isset($_COOKIE['IconColorAltitude']) || $_COOKIE['IconColorAltitude'] == 'false') {
450 680
 		    ?>
451
-			<li><?php echo _("Aircraft icon color:"); ?><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'; ?>"></li>
681
+			<li><?php echo _("Aircraft icon color:"); ?><input type="color" name="aircraftcolor" id="html5colorpicker" onchange="iconColor(aircraftcolor.value);" value="#<?php if (isset($_COOKIE['IconColor'])) {
682
+	print $_COOKIE['IconColor'];
683
+} elseif (isset($globalAircraftIconColor)) {
684
+	print $globalAircraftIconColor;
685
+} else {
686
+	print '1a3151';
687
+}
688
+?>"></li>
452 689
 		    <?php
453 690
 				}
454 691
 			    }
@@ -459,7 +696,14 @@  discard block
 block discarded – undo
459 696
 			    if (extension_loaded('gd') && function_exists('gd_info')) {
460 697
 		    ?>
461 698
 		    <li><?php echo _("Marine icon color:"); ?>
462
-			<input type="color" name="marinecolor" id="html5colorpicker" onchange="MarineiconColor(marinecolor.value);" value="#<?php if (isset($_COOKIE['MarineIconColor'])) print $_COOKIE['MarineIconColor']; elseif (isset($globalMarineIconColor)) print $globalMarineIconColor; else print '1a3151'; ?>">
699
+			<input type="color" name="marinecolor" id="html5colorpicker" onchange="MarineiconColor(marinecolor.value);" value="#<?php if (isset($_COOKIE['MarineIconColor'])) {
700
+	print $_COOKIE['MarineIconColor'];
701
+} elseif (isset($globalMarineIconColor)) {
702
+	print $globalMarineIconColor;
703
+} else {
704
+	print '1a3151';
705
+}
706
+?>">
463 707
 		    </li>
464 708
 		    <?php
465 709
 			    }
@@ -470,7 +714,14 @@  discard block
 block discarded – undo
470 714
 			    if (extension_loaded('gd') && function_exists('gd_info')) {
471 715
 		    ?>
472 716
 		    <li><?php echo _("Tracker icon color:"); ?>
473
-			<input type="color" name="trackercolor" id="html5colorpicker" onchange="TrackericonColor(trackercolor.value);" value="#<?php if (isset($_COOKIE['TrackerIconColor'])) print $_COOKIE['TrackerIconColor']; elseif (isset($globalTrackerIconColor)) print $globalTrackerIconColor; else print '1a3151'; ?>">
717
+			<input type="color" name="trackercolor" id="html5colorpicker" onchange="TrackericonColor(trackercolor.value);" value="#<?php if (isset($_COOKIE['TrackerIconColor'])) {
718
+	print $_COOKIE['TrackerIconColor'];
719
+} elseif (isset($globalTrackerIconColor)) {
720
+	print $globalTrackerIconColor;
721
+} else {
722
+	print '1a3151';
723
+}
724
+?>">
474 725
 		    </li>
475 726
 		    <?php
476 727
 			    }
@@ -481,8 +732,22 @@  discard block
 block discarded – undo
481 732
 		    ?>
482 733
 		    <li><?php echo _("Show airport icon at zoom level:"); ?>
483 734
 			<div class="range">
484
-			    <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'; ?>">
485
-			    <output id="range"><?php if (isset($_COOKIE['AirportZoom'])) print $_COOKIE['AirportZoom']; elseif (isset($globalAirportZoom)) print $globalAirportZoom; else print '7'; ?></output>
735
+			    <input type="range" min="0" max="19" step="1" name="airportzoom" onchange="range.value=value;airportDisplayZoom(airportzoom.value);" value="<?php if (isset($_COOKIE['AirportZoom'])) {
736
+	print $_COOKIE['AirportZoom'];
737
+} elseif (isset($globalAirportZoom)) {
738
+	print $globalAirportZoom;
739
+} else {
740
+	print '7';
741
+}
742
+?>">
743
+			    <output id="range"><?php if (isset($_COOKIE['AirportZoom'])) {
744
+	print $_COOKIE['AirportZoom'];
745
+} elseif (isset($globalAirportZoom)) {
746
+	print $globalAirportZoom;
747
+} else {
748
+	print '7';
749
+}
750
+?></output>
486 751
 			</div>
487 752
 		    </li>
488 753
 		    <?php
@@ -494,10 +759,23 @@  discard block
 block discarded – undo
494 759
 <?php
495 760
 	if (!isset($globalAircraft) || $globalAircraft === TRUE) {
496 761
 ?>
497
-		    <li><input type="checkbox" name="useliveries" value="1" onclick="useLiveries(this)" <?php if (isset($_COOKIE['UseLiveries']) && $_COOKIE['UseLiveries'] == 'true') print 'checked'; ?> ><?php echo _("Use airlines liveries"); ?></li>
498
-		    <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"); ?>&nbsp;
762
+		    <li><input type="checkbox" name="useliveries" value="1" onclick="useLiveries(this)" <?php if (isset($_COOKIE['UseLiveries']) && $_COOKIE['UseLiveries'] == 'true') {
763
+	print 'checked';
764
+}
765
+?> ><?php echo _("Use airlines liveries"); ?></li>
766
+		    <li><input type="checkbox" name="aircraftcolorforce" value="1" onclick="iconColorForce(this)" <?php if (isset($_COOKIE['IconColorForce']) && $_COOKIE['IconColorForce'] == 'true') {
767
+	print 'checked';
768
+}
769
+?> ><?php echo _("Force Aircraft color"); ?>&nbsp;
499 770
 		    <!--<li><?php echo _("Aircraft icon color:"); ?>-->
500
-			<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'; ?>">
771
+			<input type="color" name="aircraftcolor" id="html5colorpicker" onchange="iconColor(aircraftcolor.value);" value="#<?php if (isset($_COOKIE['IconColor'])) {
772
+	print $_COOKIE['IconColor'];
773
+} elseif (isset($globalAircraftIconColor)) {
774
+	print $globalAircraftIconColor;
775
+} else {
776
+	print 'ff0000';
777
+}
778
+?>">
501 779
 		    </li>
502 780
 <?php
503 781
 	}
@@ -505,9 +783,19 @@  discard block
 block discarded – undo
505 783
 <?php
506 784
 	if (isset($globalMarine) && $globalMarine === TRUE) {
507 785
 ?>
508
-		    <li><input type="checkbox" name="marinecolorforce" value="1" onclick="MarineiconColorForce(this)" <?php if (isset($_COOKIE['MarineIconColorForce']) && $_COOKIE['MarineIconColorForce'] == 'true') print 'checked'; ?> ><?php echo _("Force Marine color"); ?>&nbsp;
786
+		    <li><input type="checkbox" name="marinecolorforce" value="1" onclick="MarineiconColorForce(this)" <?php if (isset($_COOKIE['MarineIconColorForce']) && $_COOKIE['MarineIconColorForce'] == 'true') {
787
+	print 'checked';
788
+}
789
+?> ><?php echo _("Force Marine color"); ?>&nbsp;
509 790
 		    <!--<li><?php echo _("Marine icon color:"); ?>-->
510
-			<input type="color" name="marinecolor" id="html5colorpicker" onchange="MarineiconColor(marinecolor.value);" value="#<?php if (isset($_COOKIE['MarineIconColor'])) print $_COOKIE['MarineIconColor']; elseif (isset($globalMarineIconColor)) print $globalMarineIconColor; else print 'ff0000'; ?>">
791
+			<input type="color" name="marinecolor" id="html5colorpicker" onchange="MarineiconColor(marinecolor.value);" value="#<?php if (isset($_COOKIE['MarineIconColor'])) {
792
+	print $_COOKIE['MarineIconColor'];
793
+} elseif (isset($globalMarineIconColor)) {
794
+	print $globalMarineIconColor;
795
+} else {
796
+	print 'ff0000';
797
+}
798
+?>">
511 799
 		    </li>
512 800
 <?php
513 801
 	}
@@ -515,9 +803,19 @@  discard block
 block discarded – undo
515 803
 <?php
516 804
 	if (isset($globalTracker) && $globalTracker === TRUE) {
517 805
 ?>
518
-		    <li><input type="checkbox" name="trackercolorforce" value="1" onclick="TrackericonColorForce(this)" <?php if (isset($_COOKIE['TrackerIconColorForce']) && $_COOKIE['TrackerIconColorForce'] == 'true') print 'checked'; ?> ><?php echo _("Force Tracker color"); ?>&nbsp;
806
+		    <li><input type="checkbox" name="trackercolorforce" value="1" onclick="TrackericonColorForce(this)" <?php if (isset($_COOKIE['TrackerIconColorForce']) && $_COOKIE['TrackerIconColorForce'] == 'true') {
807
+	print 'checked';
808
+}
809
+?> ><?php echo _("Force Tracker color"); ?>&nbsp;
519 810
 		    <!--<li><?php echo _("Tracker icon color:"); ?>-->
520
-			<input type="color" name="trackercolor" id="html5colorpicker" onchange="TrackericonColor(trackercolor.value);" value="#<?php if (isset($_COOKIE['TrackerIconColor'])) print $_COOKIE['TrackerIconColor']; elseif (isset($globalTrackerIconColor)) print $globalTrackerIconColor; else print 'ff0000'; ?>">
811
+			<input type="color" name="trackercolor" id="html5colorpicker" onchange="TrackericonColor(trackercolor.value);" value="#<?php if (isset($_COOKIE['TrackerIconColor'])) {
812
+	print $_COOKIE['TrackerIconColor'];
813
+} elseif (isset($globalTrackerIconColor)) {
814
+	print $globalTrackerIconColor;
815
+} else {
816
+	print 'ff0000';
817
+}
818
+?>">
521 819
 		    </li>
522 820
 <?php
523 821
 	}
@@ -525,22 +823,46 @@  discard block
 block discarded – undo
525 823
 ?>
526 824
 		    <li><?php echo _("Distance unit:"); ?>
527 825
 			<select class="selectpicker" onchange="unitdistance(this);">
528
-			    <option value="km"<?php if ((!isset($_COOKIE['unitdistance']) && (!isset($globalUnitDistance) || (isset($globalUnitDistance) && $globalUnitDistance == 'km'))) || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'km')) echo ' selected'; ?>>km</option>
529
-			    <option value="nm"<?php if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'nm') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'nm')) echo ' selected'; ?>>nm</option>
530
-			    <option value="mi"<?php if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'mi') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'mi')) echo ' selected'; ?>>mi</option>
826
+			    <option value="km"<?php if ((!isset($_COOKIE['unitdistance']) && (!isset($globalUnitDistance) || (isset($globalUnitDistance) && $globalUnitDistance == 'km'))) || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'km')) {
827
+	echo ' selected';
828
+}
829
+?>>km</option>
830
+			    <option value="nm"<?php if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'nm') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'nm')) {
831
+	echo ' selected';
832
+}
833
+?>>nm</option>
834
+			    <option value="mi"<?php if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'mi') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'mi')) {
835
+	echo ' selected';
836
+}
837
+?>>mi</option>
531 838
 		        </select>
532 839
 		    </li>
533 840
 		    <li><?php echo _("Altitude unit:"); ?>
534 841
 			<select class="selectpicker" onchange="unitaltitude(this);">
535
-			    <option value="m"<?php if ((!isset($_COOKIE['unitaltitude']) && (!isset($globalUnitAltitude) || (isset($globalUnitAltitude) && $globalUnitAltitude == 'm'))) || (isset($_COOKIE['unitaltitude']) && $_COOKIE['unitaltitude'] == 'm')) echo ' selected'; ?>>m</option>
536
-			    <option value="feet"<?php if ((!isset($_COOKIE['unitaltitude']) && isset($globalUnitAltitude) && $globalUnitAltitude == 'feet') || (isset($_COOKIE['unitaltitude']) && $_COOKIE['unitaltitude'] == 'feet')) echo ' selected'; ?>>feet</option>
842
+			    <option value="m"<?php if ((!isset($_COOKIE['unitaltitude']) && (!isset($globalUnitAltitude) || (isset($globalUnitAltitude) && $globalUnitAltitude == 'm'))) || (isset($_COOKIE['unitaltitude']) && $_COOKIE['unitaltitude'] == 'm')) {
843
+	echo ' selected';
844
+}
845
+?>>m</option>
846
+			    <option value="feet"<?php if ((!isset($_COOKIE['unitaltitude']) && isset($globalUnitAltitude) && $globalUnitAltitude == 'feet') || (isset($_COOKIE['unitaltitude']) && $_COOKIE['unitaltitude'] == 'feet')) {
847
+	echo ' selected';
848
+}
849
+?>>feet</option>
537 850
 		        </select>
538 851
 		    </li>
539 852
 		    <li><?php echo _("Speed unit:"); ?>
540 853
 			<select class="selectpicker" onchange="unitspeed(this);">
541
-			    <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>
542
-			    <option value="mph"<?php if ((!isset($_COOKIE['unitspeed']) && isset($globalUnitSpeed) && $globalUnitSpeed == 'mph') || (isset($_COOKIE['unitspeed']) && $_COOKIE['unitspeed'] == 'mph')) echo ' selected'; ?>>mph</option>
543
-			    <option value="knots"<?php if ((!isset($_COOKIE['unitspeed']) && isset($globalUnitSpeed) && $globalUnitSpeed == 'knots') || (isset($_COOKIE['unitspeed']) && $_COOKIE['unitspeed'] == 'knots')) echo ' selected'; ?>>knots</option>
854
+			    <option value="kmh"<?php if ((!isset($_COOKIE['unitspeed']) && (!isset($globalUnitSpeed) || (isset($globalUnitSpeed) && $globalUnitSpeed == 'kmh'))) || (isset($_COOKIE['unitspeed']) && $_COOKIE['unitspeed'] == 'kmh')) {
855
+	echo ' selected';
856
+}
857
+?>>km/h</option>
858
+			    <option value="mph"<?php if ((!isset($_COOKIE['unitspeed']) && isset($globalUnitSpeed) && $globalUnitSpeed == 'mph') || (isset($_COOKIE['unitspeed']) && $_COOKIE['unitspeed'] == 'mph')) {
859
+	echo ' selected';
860
+}
861
+?>>mph</option>
862
+			    <option value="knots"<?php if ((!isset($_COOKIE['unitspeed']) && isset($globalUnitSpeed) && $globalUnitSpeed == 'knots') || (isset($_COOKIE['unitspeed']) && $_COOKIE['unitspeed'] == 'knots')) {
863
+	echo ' selected';
864
+}
865
+?>>knots</option>
544 866
 		        </select>
545 867
 		    </li>
546 868
 
@@ -558,9 +880,18 @@  discard block
 block discarded – undo
558 880
 		    <?php
559 881
 			if (((isset($globalVATSIM) && $globalVATSIM) || isset($globalIVAO) && $globalIVAO || isset($globalphpVMS) && $globalphpVMS) && (!isset($globalMapVAchoose) || $globalMapVAchoose)) {
560 882
 		    ?>
561
-			<?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 } ?>
562
-			<?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 } ?>
563
-			<?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 } ?>
883
+			<?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'])) {
884
+	print 'checked';
885
+}
886
+?> ><?php echo _("Display VATSIM data"); ?></li><?php } ?>
887
+			<?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'])) {
888
+	print 'checked';
889
+}
890
+?> ><?php echo _("Display IVAO data"); ?></li><?php } ?>
891
+			<?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'])) {
892
+	print 'checked';
893
+}
894
+?> ><?php echo _("Display phpVMS data"); ?></li><?php } ?>
564 895
 		    <?php
565 896
 			}
566 897
 		    ?>
@@ -568,10 +899,16 @@  discard block
 block discarded – undo
568 899
 			if (!(isset($globalVA) && $globalVA) && !(isset($globalVATSIM) && $globalVATSIM) && !(isset($globalIVAO) && $globalIVAO) && !(isset($globalphpVMS) && $globalphpVMS) && isset($globalSBS1) && $globalSBS1 && isset($globalAPRS) && $globalAPRS && (!isset($globalMapchoose) || $globalMapchoose)) {
569 900
 		    ?>
570 901
 			<?php if (isset($globalSBS1) && $globalSBS1) { ?>
571
-			    <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>
902
+			    <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'])) {
903
+	print 'checked';
904
+}
905
+?> ><?php echo _("Display ADS-B data"); ?></label></div></li>
572 906
 			<?php } ?>
573 907
 			<?php if (isset($globalAPRS) && $globalAPRS) { ?>
574
-			    <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>
908
+			    <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'])) {
909
+	print 'checked';
910
+}
911
+?> ><?php echo _("Display APRS data"); ?></label></div></li>
575 912
 			<?php } ?>
576 913
 		    <?php
577 914
 			}
@@ -588,7 +925,9 @@  discard block
 block discarded – undo
588 925
 				}
589 926
 				foreach($allairlinenames as $airline) {
590 927
 					$airline_name = $airline['airline_name'];
591
-					if (strlen($airline_name) > 30) $airline_name = substr($airline_name,0,30).'...';
928
+					if (strlen($airline_name) > 30) {
929
+						$airline_name = substr($airline_name,0,30).'...';
930
+					}
592 931
 					if (isset($_COOKIE['filter_Airlines']) && in_array($airline['airline_icao'],explode(',',$_COOKIE['filter_Airlines']))) {
593 932
 						echo '<option value="'.$airline['airline_icao'].'" selected>'.$airline_name.'</option>';
594 933
 					} else {
@@ -606,7 +945,10 @@  discard block
 block discarded – undo
606 945
 		    <li><?php echo _("Display alliance:"); ?>
607 946
 		    <br/>
608 947
 			<select class="selectpicker" onchange="alliance(this);" id="display_alliance">
609
-			    <option value="all"<?php if (!isset($_COOKIE['filter_alliance']) || $_COOKIE['filter_alliance'] == 'all' || $_COOKIE['filter_alliance'] == '') echo ' selected'; ?>><?php echo _("All"); ?></option>
948
+			    <option value="all"<?php if (!isset($_COOKIE['filter_alliance']) || $_COOKIE['filter_alliance'] == 'all' || $_COOKIE['filter_alliance'] == '') {
949
+	echo ' selected';
950
+}
951
+?>><?php echo _("All"); ?></option>
610 952
 			    <?php
611 953
 				foreach($allalliancenames as $alliance) {
612 954
 					$alliance_name = $alliance['alliance'];
@@ -665,10 +1007,22 @@  discard block
 block discarded – undo
665 1007
 		    ?>
666 1008
 		    <li><?php echo _("Display airlines of type:"); ?><br/>
667 1009
 			<select class="selectpicker" onchange="airlinestype(this);">
668
-			    <option value="all"<?php if (!isset($_COOKIE['filter_airlinestype']) || $_COOKIE['filter_airlinestype'] == 'all' || $_COOKIE['filter_airlinestype'] == '') echo ' selected'; ?>><?php echo _("All"); ?></option>
669
-			    <option value="passenger"<?php if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] == 'passenger') echo ' selected'; ?>><?php echo _("Passenger"); ?></option>
670
-			    <option value="cargo"<?php if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] == 'cargo') echo ' selected'; ?>><?php echo _("Cargo"); ?></option>
671
-			    <option value="military"<?php if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] == 'military') echo ' selected'; ?>><?php echo _("Military"); ?></option>
1010
+			    <option value="all"<?php if (!isset($_COOKIE['filter_airlinestype']) || $_COOKIE['filter_airlinestype'] == 'all' || $_COOKIE['filter_airlinestype'] == '') {
1011
+	echo ' selected';
1012
+}
1013
+?>><?php echo _("All"); ?></option>
1014
+			    <option value="passenger"<?php if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] == 'passenger') {
1015
+	echo ' selected';
1016
+}
1017
+?>><?php echo _("Passenger"); ?></option>
1018
+			    <option value="cargo"<?php if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] == 'cargo') {
1019
+	echo ' selected';
1020
+}
1021
+?>><?php echo _("Cargo"); ?></option>
1022
+			    <option value="military"<?php if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] == 'military') {
1023
+	echo ' selected';
1024
+}
1025
+?>><?php echo _("Military"); ?></option>
672 1026
 			</select>
673 1027
 		    </li>
674 1028
 		    <?php
@@ -682,14 +1036,20 @@  discard block
 block discarded – undo
682 1036
 		    ?>
683 1037
 		    <li>
684 1038
 			<?php echo _("Display vessels with MMSI:"); ?>
685
-			<input type="text" name="mmsifilter" onchange="mmsifilter();" id="mmsifilter" value="<?php if (isset($_COOKIE['filter_mmsi'])) print $_COOKIE['filter_mmsi']; ?>" />
1039
+			<input type="text" name="mmsifilter" onchange="mmsifilter();" id="mmsifilter" value="<?php if (isset($_COOKIE['filter_mmsi'])) {
1040
+	print $_COOKIE['filter_mmsi'];
1041
+}
1042
+?>" />
686 1043
 		    </li>
687 1044
 		    <?php
688 1045
 			}
689 1046
 		    ?>
690 1047
 		    <li>
691 1048
 			<?php echo _("Display with ident:"); ?>
692
-			<input type="text" name="identfilter" onchange="identfilter();" id="identfilter" value="<?php if (isset($_COOKIE['filter_ident'])) print $_COOKIE['filter_ident']; ?>" />
1049
+			<input type="text" name="identfilter" onchange="identfilter();" id="identfilter" value="<?php if (isset($_COOKIE['filter_ident'])) {
1050
+	print $_COOKIE['filter_ident'];
1051
+}
1052
+?>" />
693 1053
 		    </li>
694 1054
 		</ul>
695 1055
 	    </form>
@@ -705,7 +1065,10 @@  discard block
 block discarded – undo
705 1065
 	    <h1 class="sidebar-header"><?php echo _("Satellites"); ?><span class="sidebar-close"><i class="fa fa-caret-left"></i></span></h1>
706 1066
 	    <form>
707 1067
 		<ul>
708
-		    <li><div class="checkbox"><label><input type="checkbox" name="displayiss" value="1" onclick="clickDisplayISS(this)" <?php if ((isset($_COOKIE['displayiss']) && $_COOKIE['displayiss'] == 'true') || !isset($_COOKIE['displayiss'])) print 'checked'; ?> ><?php echo _("Show ISS, Tiangong-1 and Tiangong-2 on map"); ?></label></div></li>
1068
+		    <li><div class="checkbox"><label><input type="checkbox" name="displayiss" value="1" onclick="clickDisplayISS(this)" <?php if ((isset($_COOKIE['displayiss']) && $_COOKIE['displayiss'] == 'true') || !isset($_COOKIE['displayiss'])) {
1069
+	print 'checked';
1070
+}
1071
+?> ><?php echo _("Show ISS, Tiangong-1 and Tiangong-2 on map"); ?></label></div></li>
709 1072
 		    <li><?php echo _("Type:"); ?>
710 1073
 			<select class="selectpicker" multiple onchange="sattypes(this);">
711 1074
 			    <?php
@@ -713,25 +1076,45 @@  discard block
 block discarded – undo
713 1076
 				$types = $Satellite->get_tle_types();
714 1077
 				foreach ($types as $type) {
715 1078
 					$type_name = $type['tle_type'];
716
-					if ($type_name == 'musson') $type_name = 'Russian LEO Navigation';
717
-					else if ($type_name == 'nnss') $type_name = 'Navi Navigation Satellite System';
718
-					else if ($type_name == 'sbas') $type_name = 'Satellite-Based Augmentation System';
719
-					else if ($type_name == 'glo-ops') $type_name = 'Glonass Operational';
720
-					else if ($type_name == 'gps-ops') $type_name = 'GPS Operational';
721
-					else if ($type_name == 'argos') $type_name = 'ARGOS Data Collection System';
722
-					else if ($type_name == 'tdrss') $type_name = 'Tracking and Data Relay Satellite System';
723
-					else if ($type_name == 'sarsat') $type_name = 'Search & Rescue';
724
-					else if ($type_name == 'dmc') $type_name = 'Disaster Monitoring';
725
-					else if ($type_name == 'resource') $type_name = 'Earth Resources';
726
-					else if ($type_name == 'stations') $type_name = 'Space Stations';
727
-					else if ($type_name == 'geo') $type_name = 'Geostationary';
728
-					else if ($type_name == 'amateur') $type_name = 'Amateur Radio';
729
-					else if ($type_name == 'x-comm') $type_name = 'Experimental';
730
-					else if ($type_name == 'other-comm') $type_name = 'Other Comm';
731
-					else if ($type_name == 'science') $type_name = 'Space & Earth Science';
732
-					else if ($type_name == 'military') $type_name = 'Miscellaneous Military';
733
-					else if ($type_name == 'radar') $type_name = 'Radar Calibration';
734
-					else if ($type_name == 'tle-new') $type_name = 'Last 30 days launches';
1079
+					if ($type_name == 'musson') {
1080
+						$type_name = 'Russian LEO Navigation';
1081
+					} else if ($type_name == 'nnss') {
1082
+						$type_name = 'Navi Navigation Satellite System';
1083
+					} else if ($type_name == 'sbas') {
1084
+						$type_name = 'Satellite-Based Augmentation System';
1085
+					} else if ($type_name == 'glo-ops') {
1086
+						$type_name = 'Glonass Operational';
1087
+					} else if ($type_name == 'gps-ops') {
1088
+						$type_name = 'GPS Operational';
1089
+					} else if ($type_name == 'argos') {
1090
+						$type_name = 'ARGOS Data Collection System';
1091
+					} else if ($type_name == 'tdrss') {
1092
+						$type_name = 'Tracking and Data Relay Satellite System';
1093
+					} else if ($type_name == 'sarsat') {
1094
+						$type_name = 'Search & Rescue';
1095
+					} else if ($type_name == 'dmc') {
1096
+						$type_name = 'Disaster Monitoring';
1097
+					} else if ($type_name == 'resource') {
1098
+						$type_name = 'Earth Resources';
1099
+					} else if ($type_name == 'stations') {
1100
+						$type_name = 'Space Stations';
1101
+					} else if ($type_name == 'geo') {
1102
+						$type_name = 'Geostationary';
1103
+					} else if ($type_name == 'amateur') {
1104
+						$type_name = 'Amateur Radio';
1105
+					} else if ($type_name == 'x-comm') {
1106
+						$type_name = 'Experimental';
1107
+					} else if ($type_name == 'other-comm') {
1108
+						$type_name = 'Other Comm';
1109
+					} else if ($type_name == 'science') {
1110
+						$type_name = 'Space & Earth Science';
1111
+					} else if ($type_name == 'military') {
1112
+						$type_name = 'Miscellaneous Military';
1113
+					} else if ($type_name == 'radar') {
1114
+						$type_name = 'Radar Calibration';
1115
+					} else if ($type_name == 'tle-new') {
1116
+						$type_name = 'Last 30 days launches';
1117
+					}
735 1118
 					
736 1119
 					if (isset($_COOKIE['sattypes']) && in_array($type['tle_type'],explode(',',$_COOKIE['sattypes']))) {
737 1120
 						print '<option value="'.$type['tle_type'].'" selected>'.$type_name.'</option>';
Please login to merge, or discard this patch.
live-czml.php 1 patch
Braces   +123 added lines, -45 removed lines patch added patch discarded remove patch
@@ -19,8 +19,12 @@  discard block
 block discarded – undo
19 19
 }
20 20
 $tracker = false;
21 21
 $marine = false;
22
-if (isset($_GET['tracker'])) $tracker = true;
23
-if (isset($_GET['marine'])) $marine = true;
22
+if (isset($_GET['tracker'])) {
23
+	$tracker = true;
24
+}
25
+if (isset($_GET['marine'])) {
26
+	$marine = true;
27
+}
24 28
 if ($tracker) {
25 29
 	require_once('require/class.Tracker.php');
26 30
 	require_once('require/class.TrackerLive.php');
@@ -77,24 +81,49 @@  discard block
 block discarded – undo
77 81
 }
78 82
 header('Content-Type: text/javascript');
79 83
 
80
-if (!isset($globalJsonCompress)) $compress = true;
81
-else $compress = $globalJsonCompress;
84
+if (!isset($globalJsonCompress)) {
85
+	$compress = true;
86
+} else {
87
+	$compress = $globalJsonCompress;
88
+}
82 89
 
83 90
 $from_archive = false;
84 91
 $min = false;
85 92
 $allhistory = false;
86 93
 $filter['source'] = array();
87
-if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') $filter['source'] = array_merge($filter['source'],array('vatsimtxt'));
88
-if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') $filter['source'] = array_merge($filter['source'],array('whazzup'));
89
-if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') $filter['source'] = array_merge($filter['source'],array('phpvmacars'));
90
-if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') $filter['source'] = array_merge($filter['source'],array('sbs','famaprs'));
91
-if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') $filter['source'] = array_merge($filter['source'],array('aprs'));
92
-if (isset($_COOKIE['filter_ident']) && $_COOKIE['filter_ident'] != '') $filter['ident'] = filter_var($_COOKIE['filter_ident'],FILTER_SANITIZE_STRING);
93
-if (isset($_COOKIE['filter_mmsi']) && $_COOKIE['filter_mmsi'] != '') $filter['mmsi'] = filter_var($_COOKIE['filter_mmsi'],FILTER_SANITIZE_STRING);
94
-if (isset($_COOKIE['filter_Airlines']) && $_COOKIE['filter_Airlines'] != '') $filter['airlines'] = filter_var_array(explode(',',$_COOKIE['filter_Airlines']),FILTER_SANITIZE_STRING);
95
-if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') $filter['source_aprs'] = filter_var_array(explode(',',$_COOKIE['filter_Sources']),FILTER_SANITIZE_STRING);
96
-if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') $filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'],FILTER_SANITIZE_STRING);
97
-if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] != 'all') $filter['alliance'] = filter_var($_COOKIE['filter_alliance'],FILTER_SANITIZE_STRING);
94
+if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') {
95
+	$filter['source'] = array_merge($filter['source'],array('vatsimtxt'));
96
+}
97
+if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') {
98
+	$filter['source'] = array_merge($filter['source'],array('whazzup'));
99
+}
100
+if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') {
101
+	$filter['source'] = array_merge($filter['source'],array('phpvmacars'));
102
+}
103
+if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') {
104
+	$filter['source'] = array_merge($filter['source'],array('sbs','famaprs'));
105
+}
106
+if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') {
107
+	$filter['source'] = array_merge($filter['source'],array('aprs'));
108
+}
109
+if (isset($_COOKIE['filter_ident']) && $_COOKIE['filter_ident'] != '') {
110
+	$filter['ident'] = filter_var($_COOKIE['filter_ident'],FILTER_SANITIZE_STRING);
111
+}
112
+if (isset($_COOKIE['filter_mmsi']) && $_COOKIE['filter_mmsi'] != '') {
113
+	$filter['mmsi'] = filter_var($_COOKIE['filter_mmsi'],FILTER_SANITIZE_STRING);
114
+}
115
+if (isset($_COOKIE['filter_Airlines']) && $_COOKIE['filter_Airlines'] != '') {
116
+	$filter['airlines'] = filter_var_array(explode(',',$_COOKIE['filter_Airlines']),FILTER_SANITIZE_STRING);
117
+}
118
+if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') {
119
+	$filter['source_aprs'] = filter_var_array(explode(',',$_COOKIE['filter_Sources']),FILTER_SANITIZE_STRING);
120
+}
121
+if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') {
122
+	$filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'],FILTER_SANITIZE_STRING);
123
+}
124
+if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] != 'all') {
125
+	$filter['alliance'] = filter_var($_COOKIE['filter_alliance'],FILTER_SANITIZE_STRING);
126
+}
98 127
 /*
99 128
 if (isset($globalMapPopup) && !$globalMapPopup && !(isset($_COOKIE['flightpopup']) && $_COOKIE['flightpopup'] == 'true')) {
100 129
 	$min = true;
@@ -218,8 +247,12 @@  discard block
 block discarded – undo
218 247
 	} else {
219 248
 		$flightcnt = $SpotterLive->getLiveSpotterCount($filter);
220 249
 	}
221
-	if ($flightcnt == '') $flightcnt = 0;
222
-} else $flightcnt = 0;
250
+	if ($flightcnt == '') {
251
+		$flightcnt = 0;
252
+	}
253
+	} else {
254
+	$flightcnt = 0;
255
+}
223 256
 
224 257
 $sqltime = round(microtime(true)-$begintime,2);
225 258
 $minitime = time();
@@ -263,7 +296,9 @@  discard block
 block discarded – undo
263 296
 $prev_flightaware_id = '';
264 297
 $speed = 1;
265 298
 $gltf2 = false;
266
-if (isset($archivespeed)) $speed = $archivespeed;
299
+if (isset($archivespeed)) {
300
+	$speed = $archivespeed;
301
+}
267 302
 $output = '[';
268 303
 if ($tracker) {
269 304
 	$output .= '{"id" : "document", "name" : "tracker","version" : "1.0"';
@@ -299,9 +334,13 @@  discard block
 block discarded – undo
299 334
 			$image = "images/placeholder_thumb.png";
300 335
 		}
301 336
 
302
-                if (isset($spotter_item['flightaware_id'])) $id = $spotter_item['flightaware_id'];
303
-                elseif (isset($spotter_item['famtrackid'])) $id = $spotter_item['famtrackid'];
304
-                elseif (isset($spotter_item['fammarine_id'])) $id = $spotter_item['fammarine_id'];
337
+                if (isset($spotter_item['flightaware_id'])) {
338
+                	$id = $spotter_item['flightaware_id'];
339
+                } elseif (isset($spotter_item['famtrackid'])) {
340
+                	$id = $spotter_item['famtrackid'];
341
+                } elseif (isset($spotter_item['fammarine_id'])) {
342
+                	$id = $spotter_item['fammarine_id'];
343
+                }
305 344
                 if ($prev_flightaware_id != $id) {
306 345
 			if ($prev_flightaware_id != '') {
307 346
 				/*
@@ -327,7 +366,9 @@  discard block
 block discarded – undo
327 366
 			$output .= '"flightcnt": "'.$flightcnt.'",';
328 367
 			$output .= '"onground": %onground%,';
329 368
 			$output .= '"lastupdate": "'.$lastupdate.'",';
330
-			if (isset($spotter_item['format_source'])) $output .= '"format": "'.$spotter_item['format_source'].'",';
369
+			if (isset($spotter_item['format_source'])) {
370
+				$output .= '"format": "'.$spotter_item['format_source'].'",';
371
+			}
331 372
 			if ($tracker) {
332 373
 				$output.= '"type": "tracker"';
333 374
 			} elseif ($marine) {
@@ -349,7 +390,9 @@  discard block
 block discarded – undo
349 390
 							}
350 391
 						}
351 392
 					}
352
-					if ($ident != '') $output.= '"ident": "'.$ident.'",';
393
+					if ($ident != '') {
394
+						$output.= '"ident": "'.$ident.'",';
395
+					}
353 396
 				}
354 397
 				$output.= '"gltf2": %gltf2%,';
355 398
 				$output.= '"type": "flight"';
@@ -381,7 +424,9 @@  discard block
 block discarded – undo
381 424
 							$spotter_item['engine_type'] = $aircraft_info[0]['engine_type'];
382 425
 							$spotter_item['wake_category'] = $aircraft_info[0]['wake_category'];
383 426
 							$spotter_item['engine_count'] = $aircraft_info[0]['engine_count'];
384
-						} else $aircraft_shadow = '';
427
+						} else {
428
+							$aircraft_shadow = '';
429
+						}
385 430
 	    					$output .= ' "billboard" : {"image" : "'.$globalURL.'/images/aircrafts/new/'.$aircraft_shadow.'","scale" : 0.5';
386 431
 						if (isset($_COOKIE['IconColorForce']) && $_COOKIE['IconColorForce'] == 'true' && isset($_COOKIE['IconColor'])) {
387 432
 							$rgb = $Common->hex2rgb($_COOKIE['IconColor']);
@@ -389,7 +434,9 @@  discard block
 block discarded – undo
389 434
 						}
390 435
 						$output .= '},';
391 436
 					}
392
-				} else $output .= ' "billboard" : {"image" : "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACgAAAAfCAYAAACVgY94AAAACXBIWXMAAC4jAAAuIwF4pT92AAAKT2lDQ1BQaG90b3Nob3AgSUNDIHByb2ZpbGUAAHjanVNnVFPpFj333vRCS4iAlEtvUhUIIFJCi4AUkSYqIQkQSoghodkVUcERRUUEG8igiAOOjoCMFVEsDIoK2AfkIaKOg6OIisr74Xuja9a89+bN/rXXPues852zzwfACAyWSDNRNYAMqUIeEeCDx8TG4eQuQIEKJHAAEAizZCFz/SMBAPh+PDwrIsAHvgABeNMLCADATZvAMByH/w/qQplcAYCEAcB0kThLCIAUAEB6jkKmAEBGAYCdmCZTAKAEAGDLY2LjAFAtAGAnf+bTAICd+Jl7AQBblCEVAaCRACATZYhEAGg7AKzPVopFAFgwABRmS8Q5ANgtADBJV2ZIALC3AMDOEAuyAAgMADBRiIUpAAR7AGDIIyN4AISZABRG8lc88SuuEOcqAAB4mbI8uSQ5RYFbCC1xB1dXLh4ozkkXKxQ2YQJhmkAuwnmZGTKBNA/g88wAAKCRFRHgg/P9eM4Ors7ONo62Dl8t6r8G/yJiYuP+5c+rcEAAAOF0ftH+LC+zGoA7BoBt/qIl7gRoXgugdfeLZrIPQLUAoOnaV/Nw+H48PEWhkLnZ2eXk5NhKxEJbYcpXff5nwl/AV/1s+X48/Pf14L7iJIEyXYFHBPjgwsz0TKUcz5IJhGLc5o9H/LcL//wd0yLESWK5WCoU41EScY5EmozzMqUiiUKSKcUl0v9k4t8s+wM+3zUAsGo+AXuRLahdYwP2SycQWHTA4vcAAPK7b8HUKAgDgGiD4c93/+8//UegJQCAZkmScQAAXkQkLlTKsz/HCAAARKCBKrBBG/TBGCzABhzBBdzBC/xgNoRCJMTCQhBCCmSAHHJgKayCQiiGzbAdKmAv1EAdNMBRaIaTcA4uwlW4Dj1wD/phCJ7BKLyBCQRByAgTYSHaiAFiilgjjggXmYX4IcFIBBKLJCDJiBRRIkuRNUgxUopUIFVIHfI9cgI5h1xGupE7yAAygvyGvEcxlIGyUT3UDLVDuag3GoRGogvQZHQxmo8WoJvQcrQaPYw2oefQq2gP2o8+Q8cwwOgYBzPEbDAuxsNCsTgsCZNjy7EirAyrxhqwVqwDu4n1Y8+xdwQSgUXACTYEd0IgYR5BSFhMWE7YSKggHCQ0EdoJNwkDhFHCJyKTqEu0JroR+cQYYjIxh1hILCPWEo8TLxB7iEPENyQSiUMyJ7mQAkmxpFTSEtJG0m5SI+ksqZs0SBojk8naZGuyBzmULCAryIXkneTD5DPkG+Qh8lsKnWJAcaT4U+IoUspqShnlEOU05QZlmDJBVaOaUt2ooVQRNY9aQq2htlKvUYeoEzR1mjnNgxZJS6WtopXTGmgXaPdpr+h0uhHdlR5Ol9BX0svpR+iX6AP0dwwNhhWDx4hnKBmbGAcYZxl3GK+YTKYZ04sZx1QwNzHrmOeZD5lvVVgqtip8FZHKCpVKlSaVGyovVKmqpqreqgtV81XLVI+pXlN9rkZVM1PjqQnUlqtVqp1Q61MbU2epO6iHqmeob1Q/pH5Z/YkGWcNMw09DpFGgsV/jvMYgC2MZs3gsIWsNq4Z1gTXEJrHN2Xx2KruY/R27iz2qqaE5QzNKM1ezUvOUZj8H45hx+Jx0TgnnKKeX836K3hTvKeIpG6Y0TLkxZVxrqpaXllirSKtRq0frvTau7aedpr1Fu1n7gQ5Bx0onXCdHZ4/OBZ3nU9lT3acKpxZNPTr1ri6qa6UbobtEd79up+6Ynr5egJ5Mb6feeb3n+hx9L/1U/W36p/VHDFgGswwkBtsMzhg8xTVxbzwdL8fb8VFDXcNAQ6VhlWGX4YSRudE8o9VGjUYPjGnGXOMk423GbcajJgYmISZLTepN7ppSTbmmKaY7TDtMx83MzaLN1pk1mz0x1zLnm+eb15vft2BaeFostqi2uGVJsuRaplnutrxuhVo5WaVYVVpds0atna0l1rutu6cRp7lOk06rntZnw7Dxtsm2qbcZsOXYBtuutm22fWFnYhdnt8Wuw+6TvZN9un2N/T0HDYfZDqsdWh1+c7RyFDpWOt6azpzuP33F9JbpL2dYzxDP2DPjthPLKcRpnVOb00dnF2e5c4PziIuJS4LLLpc+Lpsbxt3IveRKdPVxXeF60vWdm7Obwu2o26/uNu5p7ofcn8w0nymeWTNz0MPIQ+BR5dE/C5+VMGvfrH5PQ0+BZ7XnIy9jL5FXrdewt6V3qvdh7xc+9j5yn+M+4zw33jLeWV/MN8C3yLfLT8Nvnl+F30N/I/9k/3r/0QCngCUBZwOJgUGBWwL7+Hp8Ib+OPzrbZfay2e1BjKC5QRVBj4KtguXBrSFoyOyQrSH355jOkc5pDoVQfujW0Adh5mGLw34MJ4WHhVeGP45wiFga0TGXNXfR3ENz30T6RJZE3ptnMU85ry1KNSo+qi5qPNo3ujS6P8YuZlnM1VidWElsSxw5LiquNm5svt/87fOH4p3iC+N7F5gvyF1weaHOwvSFpxapLhIsOpZATIhOOJTwQRAqqBaMJfITdyWOCnnCHcJnIi/RNtGI2ENcKh5O8kgqTXqS7JG8NXkkxTOlLOW5hCepkLxMDUzdmzqeFpp2IG0yPTq9MYOSkZBxQqohTZO2Z+pn5mZ2y6xlhbL+xW6Lty8elQfJa7OQrAVZLQq2QqboVFoo1yoHsmdlV2a/zYnKOZarnivN7cyzytuQN5zvn//tEsIS4ZK2pYZLVy0dWOa9rGo5sjxxedsK4xUFK4ZWBqw8uIq2Km3VT6vtV5eufr0mek1rgV7ByoLBtQFr6wtVCuWFfevc1+1dT1gvWd+1YfqGnRs+FYmKrhTbF5cVf9go3HjlG4dvyr+Z3JS0qavEuWTPZtJm6ebeLZ5bDpaql+aXDm4N2dq0Dd9WtO319kXbL5fNKNu7g7ZDuaO/PLi8ZafJzs07P1SkVPRU+lQ27tLdtWHX+G7R7ht7vPY07NXbW7z3/T7JvttVAVVN1WbVZftJ+7P3P66Jqun4lvttXa1ObXHtxwPSA/0HIw6217nU1R3SPVRSj9Yr60cOxx++/p3vdy0NNg1VjZzG4iNwRHnk6fcJ3/ceDTradox7rOEH0x92HWcdL2pCmvKaRptTmvtbYlu6T8w+0dbq3nr8R9sfD5w0PFl5SvNUyWna6YLTk2fyz4ydlZ19fi753GDborZ752PO32oPb++6EHTh0kX/i+c7vDvOXPK4dPKy2+UTV7hXmq86X23qdOo8/pPTT8e7nLuarrlca7nuer21e2b36RueN87d9L158Rb/1tWeOT3dvfN6b/fF9/XfFt1+cif9zsu72Xcn7q28T7xf9EDtQdlD3YfVP1v+3Njv3H9qwHeg89HcR/cGhYPP/pH1jw9DBY+Zj8uGDYbrnjg+OTniP3L96fynQ89kzyaeF/6i/suuFxYvfvjV69fO0ZjRoZfyl5O/bXyl/erA6xmv28bCxh6+yXgzMV70VvvtwXfcdx3vo98PT+R8IH8o/2j5sfVT0Kf7kxmTk/8EA5jz/GMzLdsAAAAgY0hSTQAAeiUAAICDAAD5/wAAgOkAAHUwAADqYAAAOpgAABdvkl/FRgAAA7VJREFUeNrEl2uIlWUQx39nXUu0m2uQbZYrbabdLKMs/VBkmHQjioqFIhBS+hKEQpQRgVAf2u5RQkGBRUllRH4I2e5ZUBJlEZVt5i0tTfHStrZ6fn35L70d9n7Obg88vOedmWfmf2bmmZkXlRrtq9V16mZ1iVqqhd5agXvQf1c5zw/V8dXqrqO6dQKwBrgdWApsCb0VqAc2AnOrMVANwIsD4BLgTOBPYB2wHJgEzAG+ANqAu4ZsZYiuX5QwfqI2hvaNulA9J7zLQn8o76vUuuHOwXHqSzH4aIF+TWjnBkSH+nCBf716SP1KPWO4AJ6ltgfIjRW8p9U/1KPz/ry6RT2mIDNF3Zjz19Ya4G1R/J16dgWvQd2pPlXhMdVZPUTgxfCW1wJgXUJpQlvfg8zs8K8r0Caom9QHetG7NGfa1ElDBThRXRtFd/Qh16puKIS3e7+clBjdy7kL1b3q4fzJQQGck5z6Nb97kxujblWf64HXov7Vl/E4YXWccP9AAd6dAx+ox/WTArNzY1t64B0f8K0DyLXuUvRGZfcpCo1VX4tg6wB76WMB0dALf526foAX8cqUot2pGP8B2Kz+krBeNYjS8636dh/8Beo2deoA9TWp76pd6g0q9cDNwKvAD8A84EfglLRBe2g+JWAfcEF68bPABOCoAl/gIPA5MA64FVgGnNhP292W3r0SeB1YVlJXAjcBP8XwyQUj9AKwAzg2+/fQSsBhoJxBAaALaIzenZGnD911wA7gEDAD2FFSpwOzgDHZ5T7+ZSlGd2d6AXgi5+qAn+O5U0PbBVwKtAD3AHuB8f3YGBUdncCGoQ4LE9XtGRqK9LnduVPRIu2BPqwD65IYbS7Qpql7Ql9YoJcy9bwzkgPrfOCj5G33+h54E/g0PAr5thq4ApgyEgNrc27aWwVaPTA1QJ4BjgTGFvhteV40EgPrgvTP7qlmZqFnl9WD+b2posN83E/NrEkOjlI/U1fkfUYa/pe5IE3qZPW8jFOqiyN7p3pAPX04c7AxYSoDDcAjKT2LgLXA6IR2M3Bviv59wDTgQGTPH84Qd8+HXfHcoUws2zM0HMjuUPep+xP2PWpnwtw0GJsldbBpewQwE/gbeDyt7H1gcW53O7AC+A3Yn6+/W+Ld9SnWA15DAVhc8xK2TuA9YHrCuhV4EngFuBx4YagG6qv8cF+T52kB2Zy+e1I8taUacNV+uBdXO7ABmJwJpwx8XQvF9TUCWM64tiQhbq/oMv+7BwFWpQzNT8vbVQul/wwAGzzdmXU1xuUAAAAASUVORK5CYII=","scale" : 0.5},';
437
+				} else {
438
+					$output .= ' "billboard" : {"image" : "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACgAAAAfCAYAAACVgY94AAAACXBIWXMAAC4jAAAuIwF4pT92AAAKT2lDQ1BQaG90b3Nob3AgSUNDIHByb2ZpbGUAAHjanVNnVFPpFj333vRCS4iAlEtvUhUIIFJCi4AUkSYqIQkQSoghodkVUcERRUUEG8igiAOOjoCMFVEsDIoK2AfkIaKOg6OIisr74Xuja9a89+bN/rXXPues852zzwfACAyWSDNRNYAMqUIeEeCDx8TG4eQuQIEKJHAAEAizZCFz/SMBAPh+PDwrIsAHvgABeNMLCADATZvAMByH/w/qQplcAYCEAcB0kThLCIAUAEB6jkKmAEBGAYCdmCZTAKAEAGDLY2LjAFAtAGAnf+bTAICd+Jl7AQBblCEVAaCRACATZYhEAGg7AKzPVopFAFgwABRmS8Q5ANgtADBJV2ZIALC3AMDOEAuyAAgMADBRiIUpAAR7AGDIIyN4AISZABRG8lc88SuuEOcqAAB4mbI8uSQ5RYFbCC1xB1dXLh4ozkkXKxQ2YQJhmkAuwnmZGTKBNA/g88wAAKCRFRHgg/P9eM4Ors7ONo62Dl8t6r8G/yJiYuP+5c+rcEAAAOF0ftH+LC+zGoA7BoBt/qIl7gRoXgugdfeLZrIPQLUAoOnaV/Nw+H48PEWhkLnZ2eXk5NhKxEJbYcpXff5nwl/AV/1s+X48/Pf14L7iJIEyXYFHBPjgwsz0TKUcz5IJhGLc5o9H/LcL//wd0yLESWK5WCoU41EScY5EmozzMqUiiUKSKcUl0v9k4t8s+wM+3zUAsGo+AXuRLahdYwP2SycQWHTA4vcAAPK7b8HUKAgDgGiD4c93/+8//UegJQCAZkmScQAAXkQkLlTKsz/HCAAARKCBKrBBG/TBGCzABhzBBdzBC/xgNoRCJMTCQhBCCmSAHHJgKayCQiiGzbAdKmAv1EAdNMBRaIaTcA4uwlW4Dj1wD/phCJ7BKLyBCQRByAgTYSHaiAFiilgjjggXmYX4IcFIBBKLJCDJiBRRIkuRNUgxUopUIFVIHfI9cgI5h1xGupE7yAAygvyGvEcxlIGyUT3UDLVDuag3GoRGogvQZHQxmo8WoJvQcrQaPYw2oefQq2gP2o8+Q8cwwOgYBzPEbDAuxsNCsTgsCZNjy7EirAyrxhqwVqwDu4n1Y8+xdwQSgUXACTYEd0IgYR5BSFhMWE7YSKggHCQ0EdoJNwkDhFHCJyKTqEu0JroR+cQYYjIxh1hILCPWEo8TLxB7iEPENyQSiUMyJ7mQAkmxpFTSEtJG0m5SI+ksqZs0SBojk8naZGuyBzmULCAryIXkneTD5DPkG+Qh8lsKnWJAcaT4U+IoUspqShnlEOU05QZlmDJBVaOaUt2ooVQRNY9aQq2htlKvUYeoEzR1mjnNgxZJS6WtopXTGmgXaPdpr+h0uhHdlR5Ol9BX0svpR+iX6AP0dwwNhhWDx4hnKBmbGAcYZxl3GK+YTKYZ04sZx1QwNzHrmOeZD5lvVVgqtip8FZHKCpVKlSaVGyovVKmqpqreqgtV81XLVI+pXlN9rkZVM1PjqQnUlqtVqp1Q61MbU2epO6iHqmeob1Q/pH5Z/YkGWcNMw09DpFGgsV/jvMYgC2MZs3gsIWsNq4Z1gTXEJrHN2Xx2KruY/R27iz2qqaE5QzNKM1ezUvOUZj8H45hx+Jx0TgnnKKeX836K3hTvKeIpG6Y0TLkxZVxrqpaXllirSKtRq0frvTau7aedpr1Fu1n7gQ5Bx0onXCdHZ4/OBZ3nU9lT3acKpxZNPTr1ri6qa6UbobtEd79up+6Ynr5egJ5Mb6feeb3n+hx9L/1U/W36p/VHDFgGswwkBtsMzhg8xTVxbzwdL8fb8VFDXcNAQ6VhlWGX4YSRudE8o9VGjUYPjGnGXOMk423GbcajJgYmISZLTepN7ppSTbmmKaY7TDtMx83MzaLN1pk1mz0x1zLnm+eb15vft2BaeFostqi2uGVJsuRaplnutrxuhVo5WaVYVVpds0atna0l1rutu6cRp7lOk06rntZnw7Dxtsm2qbcZsOXYBtuutm22fWFnYhdnt8Wuw+6TvZN9un2N/T0HDYfZDqsdWh1+c7RyFDpWOt6azpzuP33F9JbpL2dYzxDP2DPjthPLKcRpnVOb00dnF2e5c4PziIuJS4LLLpc+Lpsbxt3IveRKdPVxXeF60vWdm7Obwu2o26/uNu5p7ofcn8w0nymeWTNz0MPIQ+BR5dE/C5+VMGvfrH5PQ0+BZ7XnIy9jL5FXrdewt6V3qvdh7xc+9j5yn+M+4zw33jLeWV/MN8C3yLfLT8Nvnl+F30N/I/9k/3r/0QCngCUBZwOJgUGBWwL7+Hp8Ib+OPzrbZfay2e1BjKC5QRVBj4KtguXBrSFoyOyQrSH355jOkc5pDoVQfujW0Adh5mGLw34MJ4WHhVeGP45wiFga0TGXNXfR3ENz30T6RJZE3ptnMU85ry1KNSo+qi5qPNo3ujS6P8YuZlnM1VidWElsSxw5LiquNm5svt/87fOH4p3iC+N7F5gvyF1weaHOwvSFpxapLhIsOpZATIhOOJTwQRAqqBaMJfITdyWOCnnCHcJnIi/RNtGI2ENcKh5O8kgqTXqS7JG8NXkkxTOlLOW5hCepkLxMDUzdmzqeFpp2IG0yPTq9MYOSkZBxQqohTZO2Z+pn5mZ2y6xlhbL+xW6Lty8elQfJa7OQrAVZLQq2QqboVFoo1yoHsmdlV2a/zYnKOZarnivN7cyzytuQN5zvn//tEsIS4ZK2pYZLVy0dWOa9rGo5sjxxedsK4xUFK4ZWBqw8uIq2Km3VT6vtV5eufr0mek1rgV7ByoLBtQFr6wtVCuWFfevc1+1dT1gvWd+1YfqGnRs+FYmKrhTbF5cVf9go3HjlG4dvyr+Z3JS0qavEuWTPZtJm6ebeLZ5bDpaql+aXDm4N2dq0Dd9WtO319kXbL5fNKNu7g7ZDuaO/PLi8ZafJzs07P1SkVPRU+lQ27tLdtWHX+G7R7ht7vPY07NXbW7z3/T7JvttVAVVN1WbVZftJ+7P3P66Jqun4lvttXa1ObXHtxwPSA/0HIw6217nU1R3SPVRSj9Yr60cOxx++/p3vdy0NNg1VjZzG4iNwRHnk6fcJ3/ceDTradox7rOEH0x92HWcdL2pCmvKaRptTmvtbYlu6T8w+0dbq3nr8R9sfD5w0PFl5SvNUyWna6YLTk2fyz4ydlZ19fi753GDborZ752PO32oPb++6EHTh0kX/i+c7vDvOXPK4dPKy2+UTV7hXmq86X23qdOo8/pPTT8e7nLuarrlca7nuer21e2b36RueN87d9L158Rb/1tWeOT3dvfN6b/fF9/XfFt1+cif9zsu72Xcn7q28T7xf9EDtQdlD3YfVP1v+3Njv3H9qwHeg89HcR/cGhYPP/pH1jw9DBY+Zj8uGDYbrnjg+OTniP3L96fynQ89kzyaeF/6i/suuFxYvfvjV69fO0ZjRoZfyl5O/bXyl/erA6xmv28bCxh6+yXgzMV70VvvtwXfcdx3vo98PT+R8IH8o/2j5sfVT0Kf7kxmTk/8EA5jz/GMzLdsAAAAgY0hSTQAAeiUAAICDAAD5/wAAgOkAAHUwAADqYAAAOpgAABdvkl/FRgAAA7VJREFUeNrEl2uIlWUQx39nXUu0m2uQbZYrbabdLKMs/VBkmHQjioqFIhBS+hKEQpQRgVAf2u5RQkGBRUllRH4I2e5ZUBJlEZVt5i0tTfHStrZ6fn35L70d9n7Obg88vOedmWfmf2bmmZkXlRrtq9V16mZ1iVqqhd5agXvQf1c5zw/V8dXqrqO6dQKwBrgdWApsCb0VqAc2AnOrMVANwIsD4BLgTOBPYB2wHJgEzAG+ANqAu4ZsZYiuX5QwfqI2hvaNulA9J7zLQn8o76vUuuHOwXHqSzH4aIF+TWjnBkSH+nCBf716SP1KPWO4AJ6ltgfIjRW8p9U/1KPz/ry6RT2mIDNF3Zjz19Ya4G1R/J16dgWvQd2pPlXhMdVZPUTgxfCW1wJgXUJpQlvfg8zs8K8r0Caom9QHetG7NGfa1ElDBThRXRtFd/Qh16puKIS3e7+clBjdy7kL1b3q4fzJQQGck5z6Nb97kxujblWf64HXov7Vl/E4YXWccP9AAd6dAx+ox/WTArNzY1t64B0f8K0DyLXuUvRGZfcpCo1VX4tg6wB76WMB0dALf526foAX8cqUot2pGP8B2Kz+krBeNYjS8636dh/8Beo2deoA9TWp76pd6g0q9cDNwKvAD8A84EfglLRBe2g+JWAfcEF68bPABOCoAl/gIPA5MA64FVgGnNhP292W3r0SeB1YVlJXAjcBP8XwyQUj9AKwAzg2+/fQSsBhoJxBAaALaIzenZGnD911wA7gEDAD2FFSpwOzgDHZ5T7+ZSlGd2d6AXgi5+qAn+O5U0PbBVwKtAD3AHuB8f3YGBUdncCGoQ4LE9XtGRqK9LnduVPRIu2BPqwD65IYbS7Qpql7Ql9YoJcy9bwzkgPrfOCj5G33+h54E/g0PAr5thq4ApgyEgNrc27aWwVaPTA1QJ4BjgTGFvhteV40EgPrgvTP7qlmZqFnl9WD+b2posN83E/NrEkOjlI/U1fkfUYa/pe5IE3qZPW8jFOqiyN7p3pAPX04c7AxYSoDDcAjKT2LgLXA6IR2M3Bviv59wDTgQGTPH84Qd8+HXfHcoUws2zM0HMjuUPep+xP2PWpnwtw0GJsldbBpewQwE/gbeDyt7H1gcW53O7AC+A3Yn6+/W+Ld9SnWA15DAVhc8xK2TuA9YHrCuhV4EngFuBx4YagG6qv8cF+T52kB2Zy+e1I8taUacNV+uBdXO7ABmJwJpwx8XQvF9TUCWM64tiQhbq/oMv+7BwFWpQzNT8vbVQul/wwAGzzdmXU1xuUAAAAASUVORK5CYII=","scale" : 0.5},';
439
+				}
393 440
 			} elseif ($one3dmodel) {
394 441
 				if (isset($globalMap3DForceModel) && $globalMap3DForceModel != '') {
395 442
 					$output .= '"model": {"gltf" : "'.$globalURL.'/models/'.$globalMap3DForceModel.'","scale" : 1.0,"minimumPixelSize": 20';
@@ -429,7 +476,9 @@  discard block
 block discarded – undo
429 476
 							$spotter_item['engine_type'] = $aircraft_info[0]['engine_type'];
430 477
 							$spotter_item['wake_category'] = $aircraft_info[0]['wake_category'];
431 478
 							$spotter_item['engine_count'] = $aircraft_info[0]['engine_count'];
432
-						} else $aircraft_shadow = '';
479
+						} else {
480
+							$aircraft_shadow = '';
481
+						}
433 482
 						if ($aircraft_shadow != '') {
434 483
 							if (isset($modelsdb2[$aircraft_shadow])) {
435 484
 								$output .= '"model": {"gltf" : "'.$globalURL.'/models/gltf2/'.$modelsdb2[$aircraft_shadow]['glb'].'","scale" : 1.0,"minimumPixelSize": '.$modelsdb2[$aircraft_shadow]['size'];
@@ -584,7 +633,9 @@  discard block
 block discarded – undo
584 633
 								}
585 634
 								$output .= '},';
586 635
 								//if ($spotter_item['aircraft_shadow'] != '') $output .= '"aircraft_shadow": "'.$spotter_item['aircraft_shadow'].'",';
587
-								if ($spotter_item['aircraft_icao'] != '') $output .= '"aircraft_icao": "'.$spotter_item['aircraft_icao'].'",';
636
+								if ($spotter_item['aircraft_icao'] != '') {
637
+									$output .= '"aircraft_icao": "'.$spotter_item['aircraft_icao'].'",';
638
+								}
588 639
 								$modelsdb[$aircraft_icao] = 'Cesium_Air.glb';
589 640
 							}
590 641
 						} elseif (isset($spotter_item['format_source']) && $spotter_item['format_source'] == 'aprs') {
@@ -606,7 +657,9 @@  discard block
 block discarded – undo
606 657
 							}
607 658
 							$output .= '},';
608 659
 							//if ($spotter_item['aircraft_shadow'] != '') $output .= '"aircraft_shadow": "'.$spotter_item['aircraft_shadow'].'",';
609
-							if ($spotter_item['aircraft_icao'] != '') $output .= '"aircraft_icao": "'.$spotter_item['aircraft_icao'].'",';
660
+							if ($spotter_item['aircraft_icao'] != '') {
661
+								$output .= '"aircraft_icao": "'.$spotter_item['aircraft_icao'].'",';
662
+							}
610 663
 							$modelsdb[$aircraft_icao] = 'Cesium_Air.glb';
611 664
 						}
612 665
 					} else {
@@ -619,7 +672,9 @@  discard block
 block discarded – undo
619 672
 						}
620 673
 						$output .= '},';
621 674
 						//if ($spotter_item['aircraft_shadow'] != '') $output .= '"aircraft_shadow": "'.$spotter_item['aircraft_shadow'].'",';
622
-						if ($spotter_item['aircraft_icao'] != '') $output .= '"aircraft_icao": "'.$spotter_item['aircraft_icao'].'",';
675
+						if ($spotter_item['aircraft_icao'] != '') {
676
+							$output .= '"aircraft_icao": "'.$spotter_item['aircraft_icao'].'",';
677
+						}
623 678
 						$modelsdb[$aircraft_icao] = 'Cesium_Air.glb';
624 679
 					}
625 680
 				} elseif ($tracker && isset($spotter_item['type'])) {
@@ -723,8 +778,11 @@  discard block
 block discarded – undo
723 778
 					$output .= '},';
724 779
 				}
725 780
 			}
726
-			if (isset($onground) && $onground) $output = str_replace('%onground%','true',$output);
727
-			else $output = str_replace('%onground%','false',$output);
781
+			if (isset($onground) && $onground) {
782
+				$output = str_replace('%onground%','true',$output);
783
+			} else {
784
+				$output = str_replace('%onground%','false',$output);
785
+			}
728 786
 
729 787
 	//		$output .= '"heightReference": "CLAMP_TO_GROUND",';
730 788
 			//$output .= '"heightReference": "'.$heightrelative.'",';
@@ -737,9 +795,15 @@  discard block
 block discarded – undo
737 795
 	//		$output .= '"interpolationDegree" : 5,';
738 796
 	//		$output .= '"epoch" : "'.date("c",strtotime($spotter_item['date'])).'", ';
739 797
 			$output .= '"cartographicDegrees": [';
740
-			if ($minitime > strtotime($spotter_item['date'])) $minitime = strtotime($spotter_item['date']);
741
-			if (isset($_COOKIE['MapTrack']) && $id == $_COOKIE['MapTrack'] && $minitracktime > strtotime($spotter_item['date'])) $minitracktime = strtotime($spotter_item['date']);
742
-			if ($maxitime < strtotime($spotter_item['date'])) $maxitime = strtotime($spotter_item['date']);
798
+			if ($minitime > strtotime($spotter_item['date'])) {
799
+				$minitime = strtotime($spotter_item['date']);
800
+			}
801
+			if (isset($_COOKIE['MapTrack']) && $id == $_COOKIE['MapTrack'] && $minitracktime > strtotime($spotter_item['date'])) {
802
+				$minitracktime = strtotime($spotter_item['date']);
803
+			}
804
+			if ($maxitime < strtotime($spotter_item['date'])) {
805
+				$maxitime = strtotime($spotter_item['date']);
806
+			}
743 807
 			$output .= '"'.date("c",strtotime($spotter_item['date'])).'", ';
744 808
 			$output .= $spotter_item['longitude'].', ';
745 809
 			$output .= $spotter_item['latitude'];
@@ -762,7 +826,9 @@  discard block
 block discarded – undo
762 826
 					$output .= ', '.round($spotter_item['altitude']*30.48);
763 827
 					$prevalt = round($spotter_item['altitude']*30.48);
764 828
 				}
765
-			} else $output .= ', 0';
829
+			} else {
830
+				$output .= ', 0';
831
+			}
766 832
 			//$orientation = '"orientation" : { ';
767 833
 			//$orientation .= '"unitQuaternion": [';
768 834
 			//$quat = quaternionrotate(deg2rad($spotter_item['heading']),deg2rad(0),deg2rad(0));
@@ -770,13 +836,18 @@  discard block
 block discarded – undo
770 836
 		} else {
771 837
 			$nblatlong = $nblatlong+1;
772 838
 			$output .= ',"'.date("c",strtotime($spotter_item['date'])).'", ';
773
-			if ($maxitime < strtotime($spotter_item['date'])) $maxitime = strtotime($spotter_item['date']);
839
+			if ($maxitime < strtotime($spotter_item['date'])) {
840
+				$maxitime = strtotime($spotter_item['date']);
841
+			}
774 842
 			if ($spotter_item['ground_speed'] == 0) {
775 843
 				$output .= $prevlong.', ';
776 844
 				$output .= $prevlat;
777 845
 				//if (!$marine && (!isset($onground) || !$onground)) $output .= ', '.$prevalt;
778
-				if (!$marine) $output .= ', '.$prevalt;
779
-				else $output .= ', 0';
846
+				if (!$marine) {
847
+					$output .= ', '.$prevalt;
848
+				} else {
849
+					$output .= ', 0';
850
+				}
780 851
 			} else {
781 852
 				$output .= $spotter_item['longitude'].', ';
782 853
 				$output .= $spotter_item['latitude'];
@@ -789,14 +860,17 @@  discard block
 block discarded – undo
789 860
 							$output .= ', 0';
790 861
 						}
791 862
 					} else {
792
-						if (isset($spotter_item['real_altitude']) && $spotter_item['real_altitude'] != '') $output .= ', '.round($spotter_item['real_altitude']*0.3048);
793
-						elseif ($tracker) {
863
+						if (isset($spotter_item['real_altitude']) && $spotter_item['real_altitude'] != '') {
864
+							$output .= ', '.round($spotter_item['real_altitude']*0.3048);
865
+						} elseif ($tracker) {
794 866
 							$output .= ', '.round($spotter_item['altitude']*0.3048);
795 867
 						} else {
796 868
 							$output .= ', '.round($spotter_item['altitude']*30.48);
797 869
 						}
798 870
 					}
799
-				} else $output .= ', 0';
871
+				} else {
872
+					$output .= ', 0';
873
+				}
800 874
 			}
801 875
 			//$quat = quaternionrotate(deg2rad($spotter_item['heading']),deg2rad(0),deg2rad(0));
802 876
 			//$orientation .= ',"'.date("c",strtotime($spotter_item['date'])).'",'.$quat['x'].','.$quat['y'].','.$quat['z'].','.$quat['w'];
@@ -817,9 +891,10 @@  discard block
 block discarded – undo
817 891
 		} else {
818 892
 			$output = str_replace('%minitime%',date("c",time()-$globalLiveInterval),$output);
819 893
 		}
894
+	} else {
895
+		$output = str_replace('%minitime%',date("c",$minitime),$output);
820 896
 	}
821
-	else $output = str_replace('%minitime%',date("c",$minitime),$output);
822
-} elseif (isset($_COOKIE['MapTrack']) && $_COOKIE['MapTrack'] != '' && $minitracktime != $minitracktime_begin) {
897
+	} elseif (isset($_COOKIE['MapTrack']) && $_COOKIE['MapTrack'] != '' && $minitracktime != $minitracktime_begin) {
823 898
 	$output = str_replace('%minitime%',date("c",$minitracktime),$output);
824 899
 } else {
825 900
 	$output = str_replace('%minitime%',date("c",$minitime),$output);
@@ -829,7 +904,10 @@  discard block
 block discarded – undo
829 904
 } else {
830 905
 	$output = str_replace('%maxitime%',date("c",$maxitime),$output);
831 906
 }
832
-if ($gltf2) $output = str_replace('%gltf2%','true',$output);
833
-else $output = str_replace('%gltf2%','false',$output);
907
+if ($gltf2) {
908
+	$output = str_replace('%gltf2%','true',$output);
909
+} else {
910
+	$output = str_replace('%gltf2%','false',$output);
911
+}
834 912
 print $output;
835 913
 ?>
Please login to merge, or discard this patch.
js/map.2d.js.php 1 patch
Braces   +122 added lines, -28 removed lines patch added patch discarded remove patch
@@ -4,10 +4,15 @@  discard block
 block discarded – undo
4 4
 
5 5
 setcookie("MapFormat",'2d');
6 6
 
7
-if (!isset($globalOpenWeatherMapKey)) $globalOpenWeatherMapKey = '';
7
+if (!isset($globalOpenWeatherMapKey)) {
8
+	$globalOpenWeatherMapKey = '';
9
+}
8 10
 // Compressed GeoJson is used if true
9
-if (!isset($globalJsonCompress)) $compress = true;
10
-else $compress = $globalJsonCompress;
11
+if (!isset($globalJsonCompress)) {
12
+	$compress = true;
13
+} else {
14
+	$compress = $globalJsonCompress;
15
+}
11 16
 
12 17
 if (isset($_COOKIE['archive_begin']) && $_COOKIE['archive_begin'] != '') {
13 18
 	echo "console.log('Archive mode');";
@@ -88,7 +93,17 @@  discard block
 block discarded – undo
88 93
 	}
89 94
 
90 95
 	//create the map
91
-	map = L.map('archive-map', { zoomControl:false }).setView([<?php if (isset($latitude)) print $latitude; else print $globalCenterLatitude; ?>,<?php if (isset($longitude)) print $longitude; else print $globalCenterLongitude; ?>], zoom);
96
+	map = L.map('archive-map', { zoomControl:false }).setView([<?php if (isset($latitude)) {
97
+	print $latitude;
98
+} else {
99
+	print $globalCenterLatitude;
100
+}
101
+?>,<?php if (isset($longitude)) {
102
+	print $longitude;
103
+} else {
104
+	print $globalCenterLongitude;
105
+}
106
+?>], zoom);
92 107
 <?php
93 108
 	} else {
94 109
 		if ((isset($globalCenterLatitude) && $globalCenterLatitude != '' && isset($globalCenterLongitude) && $globalCenterLongitude != '') || isset($_COOKIE['lastcentercoord'])) {
@@ -114,9 +129,21 @@  discard block
 block discarded – undo
114 129
 	     || navigator.userAgent.match(/BlackBerry/i)
115 130
 	     || navigator.userAgent.match(/Windows Phone/i))
116 131
 	{
117
-		var zoom = <?php if (isset($viewzoom) && $viewzoom == $globalLiveZoom) print $viewzoom-1; elseif (isset($viewzoom)) print $viewzoom; else print '8'; ?>;
132
+		var zoom = <?php if (isset($viewzoom) && $viewzoom == $globalLiveZoom) {
133
+	print $viewzoom-1;
134
+} elseif (isset($viewzoom)) {
135
+	print $viewzoom;
136
+} else {
137
+	print '8';
138
+}
139
+?>;
118 140
 	} else {
119
-		var zoom = <?php if (isset($viewzoom)) print $viewzoom; else print '9'; ?>;
141
+		var zoom = <?php if (isset($viewzoom)) {
142
+	print $viewzoom;
143
+} else {
144
+	print '9';
145
+}
146
+?>;
120 147
 	}
121 148
 
122 149
 	//create the map
@@ -142,16 +169,27 @@  discard block
 block discarded – undo
142 169
 	bounds = L.latLngBounds(southWest,northEast);
143 170
 	//a few title layers
144 171
 <?php
145
-	if (isset($_COOKIE['MapType'])) $MapType = $_COOKIE['MapType'];
146
-	else $MapType = $globalMapProvider;
172
+	if (isset($_COOKIE['MapType'])) {
173
+		$MapType = $_COOKIE['MapType'];
174
+	} else {
175
+		$MapType = $globalMapProvider;
176
+	}
147 177
 
148 178
 	if ($MapType == 'Mapbox') {
149
-		if ($_COOKIE['MapTypeId'] == 'default') $MapBoxId = $globalMapboxId;
150
-		else $MapBoxId = $_COOKIE['MapTypeId'];
151
-?>
179
+		if ($_COOKIE['MapTypeId'] == 'default') {
180
+			$MapBoxId = $globalMapboxId;
181
+		} else {
182
+			$MapBoxId = $_COOKIE['MapTypeId'];
183
+		}
184
+		?>
152 185
 	L.tileLayer('https://{s}.tiles.mapbox.com/v4/{id}/{z}/{x}/{y}.png?access_token={token}', {
153 186
 	    maxZoom: 18,
154
-	    noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) print 'false'; else print 'true'; ?>,
187
+	    noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) {
188
+	print 'false';
189
+} else {
190
+	print 'true';
191
+}
192
+?>,
155 193
 	    attribution: '© <a href="https://www.mapbox.com/about/maps/">Mapbox</a> © <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a> <strong><a href="https://www.mapbox.com/map-feedback/" target="_blank">Improve this map</a></strong>',
156 194
 	    id: '<?php print $MapBoxId; ?>',
157 195
 	    token: '<?php print $globalMapboxToken; ?>'
@@ -170,7 +208,12 @@  discard block
 block discarded – undo
170 208
 ?>
171 209
 	L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
172 210
 	    maxZoom: 18,
173
-	    noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) print 'false'; else print 'true'; ?>,
211
+	    noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) {
212
+	print 'false';
213
+} else {
214
+	print 'true';
215
+}
216
+?>,
174 217
 	    attribution: 'Map data &copy; <a href="http://openstreetmap.org">OpenStreetMap</a> contributors, ' +
175 218
 	      '<a href="www.openstreetmap.org/copyright">Open Database Licence</a>'
176 219
 	}).addTo(map);
@@ -179,7 +222,12 @@  discard block
 block discarded – undo
179 222
 ?>
180 223
 	L.tileLayer('https://server.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer/tile/{z}/{y}/{x}', {
181 224
 	    maxZoom: 18,
182
-	    noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) print 'false'; else print 'true'; ?>,
225
+	    noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) {
226
+	print 'false';
227
+} else {
228
+	print 'true';
229
+}
230
+?>,
183 231
 	    attribution: 'Tiles &copy; Esri &mdash; Source: Esri, DeLorme, NAVTEQ, USGS, Intermap, iPC, NRCAN, Esri Japan, METI, Esri China (Hong Kong), Esri (Thailand), TomTom, 2012'
184 232
 	}).addTo(map);
185 233
 <?php
@@ -187,7 +235,12 @@  discard block
 block discarded – undo
187 235
 ?>
188 236
 	L.tileLayer('https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}', {
189 237
 	    maxZoom: 18,
190
-	    noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) print 'false'; else print 'true'; ?>,
238
+	    noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) {
239
+	print 'false';
240
+} else {
241
+	print 'true';
242
+}
243
+?>,
191 244
 	    attribution: 'Tiles &copy; Esri &mdash; Source: Esri, i-cubed, USDA, USGS, AEX, GeoEye, Getmapping, Aerogrid, IGN, IGP, UPR-EGP, and the GIS User Community'
192 245
 	}).addTo(map);
193 246
 <?php
@@ -195,7 +248,12 @@  discard block
 block discarded – undo
195 248
 ?>
196 249
 	L.tileLayer('https://server.arcgisonline.com/ArcGIS/rest/services/NatGeo_World_Map/MapServer/tile/{z}/{y}/{x}', {
197 250
 	    maxZoom: 18,
198
-	    noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) print 'false'; else print 'true'; ?>,
251
+	    noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) {
252
+	print 'false';
253
+} else {
254
+	print 'true';
255
+}
256
+?>,
199 257
 	    attribution: 'Tiles &copy; Esri &mdash; National Geographic, Esri, DeLorme, NAVTEQ, UNEP-WCMC, USGS, NASA, ESA, METI, NRCAN, GEBCO, NOAA, iPC'
200 258
 	}).addTo(map);
201 259
 <?php
@@ -240,20 +298,26 @@  discard block
 block discarded – undo
240 298
 	map.addLayer(yandexLayer);
241 299
 <?php
242 300
 	} elseif ($MapType == 'Bing-Aerial') {
243
-		if (!isset($globalBingMapKey) || $globalBingMapKey == '') setcookie('MapType','OpenStreetMap');
244
-?>
301
+		if (!isset($globalBingMapKey) || $globalBingMapKey == '') {
302
+			setcookie('MapType','OpenStreetMap');
303
+		}
304
+		?>
245 305
 	var bingLayer = new L.tileLayer.bing({bingMapsKey: '<?php print $globalBingMapKey; ?>',imagerySet: 'Aerial'});
246 306
 	map.addLayer(bingLayer);
247 307
 <?php
248 308
 	} elseif ($MapType == 'Bing-Hybrid') {
249
-		if (!isset($globalBingMapKey) || $globalBingMapKey == '') setcookie('MapType','OpenStreetMap');
250
-?>
309
+		if (!isset($globalBingMapKey) || $globalBingMapKey == '') {
310
+			setcookie('MapType','OpenStreetMap');
311
+		}
312
+		?>
251 313
 	var bingLayer = new L.tileLayer.bing({bingMapsKey: '<?php print $globalBingMapKey; ?>',imagerySet: 'AerialWithLabels'});
252 314
 	map.addLayer(bingLayer);
253 315
 <?php
254 316
 	} elseif ($MapType == 'Bing-Road') {
255
-		if (!isset($globalBingMapKey) || $globalBingMapKey == '') setcookie('MapType','OpenStreetMap');
256
-?>
317
+		if (!isset($globalBingMapKey) || $globalBingMapKey == '') {
318
+			setcookie('MapType','OpenStreetMap');
319
+		}
320
+		?>
257 321
 	var bingLayer = new L.tileLayer.bing({bingMapsKey: '<?php print $globalBingMapKey; ?>',imagerySet: 'Road'});
258 322
 	map.addLayer(bingLayer);
259 323
 <?php
@@ -282,7 +346,12 @@  discard block
 block discarded – undo
282 346
 	    maxZoom: 5,
283 347
 	    tms : true,
284 348
 	    zindex : 3,
285
-	    noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) print 'false'; else print 'true'; ?>,
349
+	    noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) {
350
+	print 'false';
351
+} else {
352
+	print 'true';
353
+}
354
+?>,
286 355
 	    attribution: 'Natural Earth'
287 356
 	}).addTo(map);
288 357
 <?php
@@ -290,9 +359,24 @@  discard block
 block discarded – undo
290 359
 		$customid = $MapType;
291 360
 ?>
292 361
 	L.tileLayer('<?php print $globalMapCustomLayer[$customid]['url']; ?>/{z}/{x}/{y}.png', {
293
-	    maxZoom: <?php if (isset($globalMapCustomLayer[$customid]['maxZoom'])) print $globalMapCustomLayer[$customid]['maxZoom']; else print '18'; ?>,
294
-	    minZoom: <?php if (isset($globalMapCustomLayer[$customid]['minZoom'])) print $globalMapCustomLayer[$customid]['minZoom']; else print '0'; ?>,
295
-	    noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) print 'false'; else print 'true'; ?>,
362
+	    maxZoom: <?php if (isset($globalMapCustomLayer[$customid]['maxZoom'])) {
363
+	print $globalMapCustomLayer[$customid]['maxZoom'];
364
+} else {
365
+	print '18';
366
+}
367
+?>,
368
+	    minZoom: <?php if (isset($globalMapCustomLayer[$customid]['minZoom'])) {
369
+	print $globalMapCustomLayer[$customid]['minZoom'];
370
+} else {
371
+	print '0';
372
+}
373
+?>,
374
+	    noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) {
375
+	print 'false';
376
+} else {
377
+	print 'true';
378
+}
379
+?>,
296 380
 	    attribution: '<?php print $globalMapCustomLayer[$customid]['attribution']; ?>'
297 381
 	}).addTo(map);
298 382
 
@@ -332,7 +416,12 @@  discard block
 block discarded – undo
332 416
 		}
333 417
 	} elseif ($globalBounding == 'circle') {
334 418
 ?>
335
-	var circle = L.circle([<?php print $globalCenterLatitude; ?>, <?php print $globalCenterLongitude; ?>],<?php if (isset($globalBoundingCircleSize)) print $globalBoundingCircleSize; else print '70000'; ?>,{
419
+	var circle = L.circle([<?php print $globalCenterLatitude; ?>, <?php print $globalCenterLongitude; ?>],<?php if (isset($globalBoundingCircleSize)) {
420
+	print $globalBoundingCircleSize;
421
+} else {
422
+	print '70000';
423
+}
424
+?>,{
336 425
 	    color: '#92C7D1',
337 426
 	    fillColor: '#92C7D1',
338 427
 	    fillOpacity: 0.3,
@@ -424,7 +513,12 @@  discard block
 block discarded – undo
424 513
 	if (!isset($archive) || $archive === false) {
425 514
 ?>
426 515
 update_locationsLayer();
427
-setInterval(function(){if (noTimeout) { map.removeLayer(locationsLayer); update_locationsLayer();} },<?php if (isset($globalMapRefresh)) print $globalMapRefresh*1000*2; else print '60000'; ?>);
516
+setInterval(function(){if (noTimeout) { map.removeLayer(locationsLayer); update_locationsLayer();} },<?php if (isset($globalMapRefresh)) {
517
+	print $globalMapRefresh*1000*2;
518
+} else {
519
+	print '60000';
520
+}
521
+?>);
428 522
 <?php
429 523
 	}
430 524
 ?>
Please login to merge, or discard this patch.