Completed
Push — master ( 465dcf...e879ed )
by Yannick
05:41
created
airport-statistics-manufacturer.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -23,7 +23,9 @@
 block discarded – undo
23 23
 	print '<option></option>';
24 24
 	$Stats = new Stats();
25 25
 	$airport_names = $tats->getAllAirportNames();
26
-	if (empty($airport_names)) $airport_names = $Spotter->getAllAirportNames();
26
+	if (empty($airport_names)) {
27
+		$airport_names = $Spotter->getAllAirportNames();
28
+	}
27 29
 	ksort($airport_names);
28 30
 	foreach($airport_names as $airport_name)
29 31
 	{
Please login to merge, or discard this patch.
airport-statistics-aircraft.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -23,7 +23,9 @@
 block discarded – undo
23 23
 	print '<option></option>';
24 24
 	$Stats = new Stats();
25 25
 	$airport_names = $tats->getAllAirportNames();
26
-	if (empty($airport_names)) $airport_names = $Spotter->getAllAirportNames();
26
+	if (empty($airport_names)) {
27
+		$airport_names = $Spotter->getAllAirportNames();
28
+	}
27 29
 	ksort($airport_names);
28 30
 	foreach($airport_names as $airport_name)
29 31
 	{
Please login to merge, or discard this patch.
airport-statistics-airline.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -23,7 +23,9 @@
 block discarded – undo
23 23
 	print '<option></option>';
24 24
 	$Stats = new Stats();
25 25
 	$airport_names = $tats->getAllAirportNames();
26
-	if (empty($airport_names)) $airport_names = $Spotter->getAllAirportNames();
26
+	if (empty($airport_names)) {
27
+		$airport_names = $Spotter->getAllAirportNames();
28
+	}
27 29
 	ksort($airport_names);
28 30
 	foreach($airport_names as $airport_name)
29 31
 	{
Please login to merge, or discard this patch.
aircraft-statistics-time.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -23,7 +23,9 @@
 block discarded – undo
23 23
 	print '<option></option>';
24 24
 	$Stats = new Stats();
25 25
 	$aircraft_types = $Stats->getAllAircraftTypes();
26
-	if (empty($aircraft_types)) $aircraft_types = $Spotter->getAllAircraftTypes();
26
+	if (empty($aircraft_types)) {
27
+		$aircraft_types = $Spotter->getAllAircraftTypes();
28
+	}
27 29
 	foreach($aircraft_types as $aircrafttype)
28 30
 	{
29 31
 		if($aircraft_type == $aircrafttype['aircraft_icao'])
Please login to merge, or discard this patch.
airport-statistics-arrival-airport.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -23,7 +23,9 @@
 block discarded – undo
23 23
 	print '<option></option>';
24 24
 	$Stats = new Stats();
25 25
 	$airport_names = $tats->getAllAirportNames();
26
-	if (empty($airport_names)) $airport_names = $Spotter->getAllAirportNames();
26
+	if (empty($airport_names)) {
27
+		$airport_names = $Spotter->getAllAirportNames();
28
+	}
27 29
 	ksort($airport_names);
28 30
 	foreach($airport_names as $airport_name)
29 31
 	{
Please login to merge, or discard this patch.
statistics-country.php 1 patch
Braces   +7 added lines, -3 removed lines patch added patch discarded remove patch
@@ -5,7 +5,9 @@  discard block
 block discarded – undo
5 5
 $Stats = new Stats();
6 6
 $title = _("Statistics").' - '._("Most common Callsign");
7 7
 
8
-if (!isset($filter_name)) $filter_name = '';
8
+if (!isset($filter_name)) {
9
+	$filter_name = '';
10
+}
9 11
 $airline_icao = (string)filter_input(INPUT_GET,'airline',FILTER_SANITIZE_STRING);
10 12
 if ($airline_icao == 'all') {
11 13
     unset($_COOKIE['stats_airline_icao']);
@@ -14,8 +16,10 @@  discard block
 block discarded – undo
14 16
 } elseif ($airline_icao == '' && isset($_COOKIE['stats_airline_icao'])) {
15 17
     $airline_icao = $_COOKIE['stats_airline_icao'];
16 18
 } elseif ($airline_icao == '' && isset($globalFilter)) {
17
-    if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0];
18
-}
19
+    if (isset($globalFilter['airline'])) {
20
+    	$airline_icao = $globalFilter['airline'][0];
21
+    }
22
+    }
19 23
 setcookie('stats_airline_icao',$airline_icao);
20 24
 
21 25
 require_once('header.php');
Please login to merge, or discard this patch.
airport.php 1 patch
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@
 block discarded – undo
13 13
 	  $limit_start = 0;
14 14
 	  $limit_end = 25;
15 15
 	  $absolute_difference = 25;
16
-	}  else {
16
+	} else {
17 17
 		$limit_explode = explode(",", $_GET['limit']);
18 18
 		$limit_start = $limit_explode[0];
19 19
 		$limit_end = $limit_explode[1];
Please login to merge, or discard this patch.
scripts/daemon-spotter.php 1 patch
Braces   +532 added lines, -182 removed lines patch added patch discarded remove patch
@@ -14,7 +14,9 @@  discard block
 block discarded – undo
14 14
 require_once(dirname(__FILE__).'/../require/class.Connection.php');
15 15
 require_once(dirname(__FILE__).'/../require/class.Common.php');
16 16
 
17
-if (!isset($globalDebug)) $globalDebug = FALSE;
17
+if (!isset($globalDebug)) {
18
+	$globalDebug = FALSE;
19
+}
18 20
 
19 21
 // Check if schema is at latest version
20 22
 $Connection = new Connection();
@@ -51,13 +53,22 @@  discard block
 block discarded – undo
51 53
     $globalSources = array();
52 54
     $globalSources[] = array('host' => $options['source']);
53 55
 }
54
-if (isset($options['server'])) $globalServer = TRUE;
55
-if (isset($options['idsource'])) $id_source = $options['idsource'];
56
-else $id_source = 1;
56
+if (isset($options['server'])) {
57
+	$globalServer = TRUE;
58
+}
59
+if (isset($options['idsource'])) {
60
+	$id_source = $options['idsource'];
61
+} else {
62
+	$id_source = 1;
63
+}
57 64
 if (isset($globalServer) && $globalServer) {
58
-    if ($globalDebug) echo "Using Server Mode\n";
65
+    if ($globalDebug) {
66
+    	echo "Using Server Mode\n";
67
+    }
59 68
     $SI=new SpotterServer();
60
-} else $SI=new SpotterImport($Connection->db);
69
+} else {
70
+	$SI=new SpotterImport($Connection->db);
71
+}
61 72
 //$APRS=new APRS($Connection->db);
62 73
 $SBS=new SBS();
63 74
 $ACARS=new ACARS($Connection->db);
@@ -75,7 +86,9 @@  discard block
 block discarded – undo
75 86
 }
76 87
 
77 88
 // let's try and connect
78
-if ($globalDebug) echo "Connecting...\n";
89
+if ($globalDebug) {
90
+	echo "Connecting...\n";
91
+}
79 92
 $use_aprs = false;
80 93
 $aprs_full = false;
81 94
 
@@ -83,7 +96,9 @@  discard block
 block discarded – undo
83 96
     $ip = gethostbyname($host);
84 97
     $s = socket_create(AF_INET, SOCK_STREAM, 0);
85 98
     $r = @socket_connect($s, $ip, $port);
86
-    if (!socket_set_nonblock($s)) echo "Unable to set nonblock on socket\n";
99
+    if (!socket_set_nonblock($s)) {
100
+    	echo "Unable to set nonblock on socket\n";
101
+    }
87 102
     if ($r || socket_last_error() == 114 || socket_last_error() == 115) {
88 103
         return $s;
89 104
     }
@@ -110,7 +125,9 @@  discard block
 block discarded – undo
110 125
 function connect_all($hosts) {
111 126
     //global $sockets, $formats, $globalDebug,$aprs_connect,$last_exec, $globalSourcesRights, $use_aprs;
112 127
     global $sockets, $globalSources, $globalDebug,$aprs_connect,$last_exec, $globalSourcesRights, $use_aprs;
113
-    if ($globalDebug) echo 'Connect to all...'."\n";
128
+    if ($globalDebug) {
129
+    	echo 'Connect to all...'."\n";
130
+    }
114 131
     foreach ($hosts as $id => $value) {
115 132
 	$host = $value['host'];
116 133
 	$globalSources[$id]['last_exec'] = 0;
@@ -120,27 +137,37 @@  discard block
 block discarded – undo
120 137
         	//$formats[$id] = 'deltadbtxt';
121 138
         	$globalSources[$id]['format'] = 'deltadbtxt';
122 139
         	//$last_exec['deltadbtxt'] = 0;
123
-        	if ($globalDebug) echo "Connect to deltadb source (".$host.")...\n";
140
+        	if ($globalDebug) {
141
+        		echo "Connect to deltadb source (".$host.")...\n";
142
+        	}
124 143
             } else if (preg_match('/vatsim-data.txt$/i',$host)) {
125 144
         	//$formats[$id] = 'vatsimtxt';
126 145
         	$globalSources[$id]['format'] = 'vatsimtxt';
127 146
         	//$last_exec['vatsimtxt'] = 0;
128
-        	if ($globalDebug) echo "Connect to vatsim source (".$host.")...\n";
147
+        	if ($globalDebug) {
148
+        		echo "Connect to vatsim source (".$host.")...\n";
149
+        	}
129 150
     	    } else if (preg_match('/aircraftlist.json$/i',$host)) {
130 151
         	//$formats[$id] = 'aircraftlistjson';
131 152
         	$globalSources[$id]['format'] = 'aircraftlistjson';
132 153
         	//$last_exec['aircraftlistjson'] = 0;
133
-        	if ($globalDebug) echo "Connect to aircraftlist.json source (".$host.")...\n";
154
+        	if ($globalDebug) {
155
+        		echo "Connect to aircraftlist.json source (".$host.")...\n";
156
+        	}
134 157
     	    } else if (preg_match('/opensky/i',$host)) {
135 158
         	//$formats[$id] = 'aircraftlistjson';
136 159
         	$globalSources[$id]['format'] = 'opensky';
137 160
         	//$last_exec['aircraftlistjson'] = 0;
138
-        	if ($globalDebug) echo "Connect to opensky source (".$host.")...\n";
161
+        	if ($globalDebug) {
162
+        		echo "Connect to opensky source (".$host.")...\n";
163
+        	}
139 164
     	    } else if (preg_match('/radarvirtuel.com\/file.json$/i',$host)) {
140 165
         	//$formats[$id] = 'radarvirtueljson';
141 166
         	$globalSources[$id]['format'] = 'radarvirtueljson';
142 167
         	//$last_exec['radarvirtueljson'] = 0;
143
-        	if ($globalDebug) echo "Connect to radarvirtuel.com/file.json source (".$host.")...\n";
168
+        	if ($globalDebug) {
169
+        		echo "Connect to radarvirtuel.com/file.json source (".$host.")...\n";
170
+        	}
144 171
         	if (!isset($globalSourcesRights) || (isset($globalSourcesRights) && !$globalSourcesRights)) {
145 172
         	    echo '!!! You MUST set $globalSourcesRights = TRUE in settings.php if you have the right to use this feed !!!'."\n";
146 173
         	    exit(0);
@@ -149,7 +176,9 @@  discard block
 block discarded – undo
149 176
         	//$formats[$id] = 'planeupdatefaa';
150 177
         	$globalSources[$id]['format'] = 'planeupdatefaa';
151 178
         	//$last_exec['planeupdatefaa'] = 0;
152
-        	if ($globalDebug) echo "Connect to planeUpdateFAA.php source (".$host.")...\n";
179
+        	if ($globalDebug) {
180
+        		echo "Connect to planeUpdateFAA.php source (".$host.")...\n";
181
+        	}
153 182
         	if (!isset($globalSourcesRights) || (isset($globalSourcesRights) && !$globalSourcesRights)) {
154 183
         	    echo '!!! You MUST set $globalSourcesRights = TRUE in settings.php if you have the right to use this feed !!!'."\n";
155 184
         	    exit(0);
@@ -158,26 +187,36 @@  discard block
 block discarded – undo
158 187
         	//$formats[$id] = 'phpvmacars';
159 188
         	$globalSources[$id]['format'] = 'phpvmacars';
160 189
         	//$last_exec['phpvmacars'] = 0;
161
-        	if ($globalDebug) echo "Connect to phpvmacars source (".$host.")...\n";
190
+        	if ($globalDebug) {
191
+        		echo "Connect to phpvmacars source (".$host.")...\n";
192
+        	}
162 193
             } else if (preg_match('/VAM-json.php$/i',$host)) {
163 194
         	//$formats[$id] = 'phpvmacars';
164 195
         	$globalSources[$id]['format'] = 'vam';
165
-        	if ($globalDebug) echo "Connect to Vam source (".$host.")...\n";
196
+        	if ($globalDebug) {
197
+        		echo "Connect to Vam source (".$host.")...\n";
198
+        	}
166 199
             } else if (preg_match('/whazzup/i',$host)) {
167 200
         	//$formats[$id] = 'whazzup';
168 201
         	$globalSources[$id]['format'] = 'whazzup';
169 202
         	//$last_exec['whazzup'] = 0;
170
-        	if ($globalDebug) echo "Connect to whazzup source (".$host.")...\n";
203
+        	if ($globalDebug) {
204
+        		echo "Connect to whazzup source (".$host.")...\n";
205
+        	}
171 206
             } else if (preg_match('/recentpireps/i',$host)) {
172 207
         	//$formats[$id] = 'pirepsjson';
173 208
         	$globalSources[$id]['format'] = 'pirepsjson';
174 209
         	//$last_exec['pirepsjson'] = 0;
175
-        	if ($globalDebug) echo "Connect to pirepsjson source (".$host.")...\n";
210
+        	if ($globalDebug) {
211
+        		echo "Connect to pirepsjson source (".$host.")...\n";
212
+        	}
176 213
             } else if (preg_match(':data.fr24.com/zones/fcgi/feed.js:i',$host)) {
177 214
         	//$formats[$id] = 'fr24json';
178 215
         	$globalSources[$id]['format'] = 'fr24json';
179 216
         	//$last_exec['fr24json'] = 0;
180
-        	if ($globalDebug) echo "Connect to fr24 source (".$host.")...\n";
217
+        	if ($globalDebug) {
218
+        		echo "Connect to fr24 source (".$host.")...\n";
219
+        	}
181 220
         	if (!isset($globalSourcesRights) || (isset($globalSourcesRights) && !$globalSourcesRights)) {
182 221
         	    echo '!!! You MUST set $globalSourcesRights = TRUE in settings.php if you have the right to use this feed !!!'."\n";
183 222
         	    exit(0);
@@ -186,10 +225,14 @@  discard block
 block discarded – undo
186 225
             } else if (preg_match('/10001/',$host) || (isset($globalSources[$id]['port']) && $globalSources[$id]['port'] == '10001')) {
187 226
         	//$formats[$id] = 'tsv';
188 227
         	$globalSources[$id]['format'] = 'tsv';
189
-        	if ($globalDebug) echo "Connect to tsv source (".$host.")...\n";
228
+        	if ($globalDebug) {
229
+        		echo "Connect to tsv source (".$host.")...\n";
230
+        	}
190 231
             }
191 232
         } elseif (filter_var($host,FILTER_VALIDATE_URL)) {
192
-        	if ($globalDebug) echo "Connect to ".$globalSources[$id]['format']." source (".$host.")...\n";
233
+        	if ($globalDebug) {
234
+        		echo "Connect to ".$globalSources[$id]['format']." source (".$host.")...\n";
235
+        	}
193 236
         } elseif (!filter_var($host,FILTER_VALIDATE_URL)) {
194 237
 	    $hostport = explode(':',$host);
195 238
 	    if (isset($hostport[1])) {
@@ -226,17 +269,25 @@  discard block
 block discarded – undo
226 269
         		//$formats[$id] = 'beast';
227 270
         		$globalSources[$id]['format'] = 'beast';
228 271
 		    //} else $formats[$id] = 'sbs';
229
-		    } else $globalSources[$id]['format'] = 'sbs';
272
+		    } else {
273
+		    	$globalSources[$id]['format'] = 'sbs';
274
+		    }
230 275
 		    //if ($globalDebug) echo 'Connection in progress to '.$host.'('.$formats[$id].')....'."\n";
231 276
 		}
232
-		if ($globalDebug) echo 'Connection in progress to '.$hostn.':'.$port.' ('.$globalSources[$id]['format'].')....'."\n";
277
+		if ($globalDebug) {
278
+			echo 'Connection in progress to '.$hostn.':'.$port.' ('.$globalSources[$id]['format'].')....'."\n";
279
+		}
233 280
             } else {
234
-		if ($globalDebug) echo 'Connection failed to '.$hostn.':'.$port.' : '.$errno.' '.$errstr."\n";
281
+		if ($globalDebug) {
282
+			echo 'Connection failed to '.$hostn.':'.$port.' : '.$errno.' '.$errstr."\n";
283
+		}
235 284
     	    }
236 285
         }
237 286
     }
238 287
 }
239
-if (!isset($globalMinFetch)) $globalMinFetch = 15;
288
+if (!isset($globalMinFetch)) {
289
+	$globalMinFetch = 15;
290
+}
240 291
 
241 292
 // Initialize all
242 293
 $status = array();
@@ -244,13 +295,19 @@  discard block
 block discarded – undo
244 295
 $formats = array();
245 296
 $last_exec = array();
246 297
 $time = time();
247
-if (isset($globalSourcesTimeout)) $timeout = $globalSourcesTimeOut;
248
-else if (isset($globalSBS1TimeOut)) $timeout = $globalSBS1TimeOut;
249
-else $timeout = 20;
298
+if (isset($globalSourcesTimeout)) {
299
+	$timeout = $globalSourcesTimeOut;
300
+} else if (isset($globalSBS1TimeOut)) {
301
+	$timeout = $globalSBS1TimeOut;
302
+} else {
303
+	$timeout = 20;
304
+}
250 305
 $errno = '';
251 306
 $errstr='';
252 307
 
253
-if (!isset($globalDaemon)) $globalDaemon = TRUE;
308
+if (!isset($globalDaemon)) {
309
+	$globalDaemon = TRUE;
310
+}
254 311
 /* Initiate connections to all the hosts simultaneously */
255 312
 //connect_all($hosts);
256 313
 //connect_all($globalSources);
@@ -270,7 +327,9 @@  discard block
 block discarded – undo
270 327
     if (isset($source['format']) && $source['format'] == 'aprs') {
271 328
 	$aprs_connect = 0;
272 329
 	$use_aprs = true;
273
-	if (isset($source['port']) && $source['port'] == '10152') $aprs_full = true;
330
+	if (isset($source['port']) && $source['port'] == '10152') {
331
+		$aprs_full = true;
332
+	}
274 333
 	break;
275 334
     }
276 335
 }
@@ -281,24 +340,44 @@  discard block
 block discarded – undo
281 340
 	$aprs_connect = 0;
282 341
 	$aprs_keep = 120;
283 342
 	$aprs_last_tx = time();
284
-	if (isset($globalAPRSversion)) $aprs_version = $globalAPRSversion;
285
-	else $aprs_version = $globalName.' using FlightAirMap';
343
+	if (isset($globalAPRSversion)) {
344
+		$aprs_version = $globalAPRSversion;
345
+	} else {
346
+		$aprs_version = $globalName.' using FlightAirMap';
347
+	}
286 348
 	//else $aprs_version = 'Perl Example App';
287
-	if (isset($globalAPRSssid)) $aprs_ssid = $globalAPRSssid;
288
-	else $aprs_ssid = 'FAM';
349
+	if (isset($globalAPRSssid)) {
350
+		$aprs_ssid = $globalAPRSssid;
351
+	} else {
352
+		$aprs_ssid = 'FAM';
353
+	}
289 354
 	//else $aprs_ssid = 'PerlEx';
290
-	if (isset($globalAPRSfilter)) $aprs_filter = $globalAPRSfilter;
291
-	else $aprs_filter =  'r/'.$globalCenterLatitude.'/'.$globalCenterLongitude.'/250.0';
292
-	if ($aprs_full) $aprs_filter = '';
293
-	if ($aprs_filter != '') $aprs_login = "user {$aprs_ssid} appid {$aprs_version} filter {$aprs_filter}\n";
294
-	else $aprs_login = "user {$aprs_ssid} appid {$aprs_version}\n";
295
-}
355
+	if (isset($globalAPRSfilter)) {
356
+		$aprs_filter = $globalAPRSfilter;
357
+	} else {
358
+		$aprs_filter =  'r/'.$globalCenterLatitude.'/'.$globalCenterLongitude.'/250.0';
359
+	}
360
+	if ($aprs_full) {
361
+		$aprs_filter = '';
362
+	}
363
+	if ($aprs_filter != '') {
364
+		$aprs_login = "user {$aprs_ssid} appid {$aprs_version} filter {$aprs_filter}\n";
365
+	} else {
366
+		$aprs_login = "user {$aprs_ssid} appid {$aprs_version}\n";
367
+	}
368
+	}
296 369
 
297 370
 // connected - lets do some work
298
-if ($globalDebug) echo "Connected!\n";
371
+if ($globalDebug) {
372
+	echo "Connected!\n";
373
+}
299 374
 sleep(1);
300
-if ($globalDebug) echo "SCAN MODE \n\n";
301
-if (!isset($globalCronEnd)) $globalCronEnd = 60;
375
+if ($globalDebug) {
376
+	echo "SCAN MODE \n\n";
377
+}
378
+if (!isset($globalCronEnd)) {
379
+	$globalCronEnd = 60;
380
+}
302 381
 $endtime = time()+$globalCronEnd;
303 382
 $i = 1;
304 383
 $tt = array();
@@ -312,20 +391,28 @@  discard block
 block discarded – undo
312 391
 
313 392
 // Infinite loop if daemon, else work for time defined in $globalCronEnd or only one time.
314 393
 while ($i > 0) {
315
-    if (!$globalDaemon) $i = $endtime-time();
394
+    if (!$globalDaemon) {
395
+    	$i = $endtime-time();
396
+    }
316 397
     // Delete old ATC
317 398
     if ($globalDaemon && ((isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM))) {
318
-	if ($globalDebug) echo 'Delete old ATC...'."\n";
399
+	if ($globalDebug) {
400
+		echo 'Delete old ATC...'."\n";
401
+	}
319 402
         $ATC->deleteOldATC();
320 403
     }
321 404
     
322 405
     if (count($last_exec) > 0) {
323 406
 	$max = $globalMinFetch;
324 407
 	foreach ($last_exec as $last) {
325
-	    if ((time() - $last['last']) < $max) $max = time() - $last['last'];
408
+	    if ((time() - $last['last']) < $max) {
409
+	    	$max = time() - $last['last'];
410
+	    }
326 411
 	}
327 412
 	if ($max != $globalMinFetch) {
328
-	    if ($globalDebug) echo 'Sleeping...'."\n";
413
+	    if ($globalDebug) {
414
+	    	echo 'Sleeping...'."\n";
415
+	    }
329 416
 	    sleep($globalMinFetch-$max+2);
330 417
 	}
331 418
     }
@@ -333,7 +420,9 @@  discard block
 block discarded – undo
333 420
     
334 421
     //foreach ($formats as $id => $value) {
335 422
     foreach ($globalSources as $id => $value) {
336
-	if (!isset($last_exec[$id]['last'])) $last_exec[$id]['last'] = 0;
423
+	if (!isset($last_exec[$id]['last'])) {
424
+		$last_exec[$id]['last'] = 0;
425
+	}
337 426
 	if ($value['format'] == 'deltadbtxt' && (time() - $last_exec[$id]['last'] > $globalMinFetch)) {
338 427
 	    //$buffer = $Common->getData($hosts[$id]);
339 428
 	    $buffer = $Common->getData($value['host']);
@@ -345,19 +434,38 @@  discard block
 block discarded – undo
345 434
 	            $data = array();
346 435
 	            $data['hex'] = $line[1]; // hex
347 436
 	            $data['ident'] = $line[2]; // ident
348
-	            if (isset($line[3])) $data['altitude'] = $line[3]; // altitude
349
-	            if (isset($line[4])) $data['speed'] = $line[4]; // speed
350
-	            if (isset($line[5])) $data['heading'] = $line[5]; // heading
351
-	            if (isset($line[6])) $data['latitude'] = $line[6]; // lat
352
-	            if (isset($line[7])) $data['longitude'] = $line[7]; // long
437
+	            if (isset($line[3])) {
438
+	            	$data['altitude'] = $line[3];
439
+	            }
440
+	            // altitude
441
+	            if (isset($line[4])) {
442
+	            	$data['speed'] = $line[4];
443
+	            }
444
+	            // speed
445
+	            if (isset($line[5])) {
446
+	            	$data['heading'] = $line[5];
447
+	            }
448
+	            // heading
449
+	            if (isset($line[6])) {
450
+	            	$data['latitude'] = $line[6];
451
+	            }
452
+	            // lat
453
+	            if (isset($line[7])) {
454
+	            	$data['longitude'] = $line[7];
455
+	            }
456
+	            // long
353 457
 	            $data['verticalrate'] = ''; // vertical rate
354 458
 	            //if (isset($line[9])) $data['squawk'] = $line[9]; // squawk
355 459
 	            $data['emergency'] = ''; // emergency
356 460
 		    $data['datetime'] = date('Y-m-d H:i:s');
357 461
 		    $data['format_source'] = 'deltadbtxt';
358 462
     		    $data['id_source'] = $id_source;
359
-		    if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name'];
360
-		    if (isset($value['sourcestats'])) $data['sourcestats'] = $value['sourcestats'];
463
+		    if (isset($value['name']) && $value['name'] != '') {
464
+		    	$data['source_name'] = $value['name'];
465
+		    }
466
+		    if (isset($value['sourcestats'])) {
467
+		    	$data['sourcestats'] = $value['sourcestats'];
468
+		    }
361 469
     		    $SI->add($data);
362 470
 		    unset($data);
363 471
     		}
@@ -379,10 +487,19 @@  discard block
 block discarded – undo
379 487
 			$data['pilot_name'] = $line[2];
380 488
 			$data['hex'] = str_pad(dechex($line[1]),6,'000000',STR_PAD_LEFT);
381 489
 			$data['ident'] = $line[0]; // ident
382
-			if ($line[7] != '' && $line[7] != 0) $data['altitude'] = $line[7]; // altitude
490
+			if ($line[7] != '' && $line[7] != 0) {
491
+				$data['altitude'] = $line[7];
492
+			}
493
+			// altitude
383 494
 			$data['speed'] = $line[8]; // speed
384
-			if (isset($line[45])) $data['heading'] = $line[45]; // heading
385
-			elseif (isset($line[38])) $data['heading'] = $line[38]; // heading
495
+			if (isset($line[45])) {
496
+				$data['heading'] = $line[45];
497
+			}
498
+			// heading
499
+			elseif (isset($line[38])) {
500
+				$data['heading'] = $line[38];
501
+			}
502
+			// heading
386 503
 			$data['latitude'] = $line[5]; // lat
387 504
 	        	$data['longitude'] = $line[6]; // long
388 505
 	        	$data['verticalrate'] = ''; // vertical rate
@@ -391,14 +508,18 @@  discard block
 block discarded – undo
391 508
 	        	$data['waypoints'] = $line[30];
392 509
 			$data['datetime'] = date('Y-m-d H:i:s');
393 510
 			//$data['datetime'] = date('Y-m-d H:i:s',strtotime($line[37]));
394
-			if (isset($line[37])) $data['last_update'] = $line[37];
511
+			if (isset($line[37])) {
512
+				$data['last_update'] = $line[37];
513
+			}
395 514
 		        $data['departure_airport_icao'] = $line[11];
396 515
 		        $data['departure_airport_time'] = rtrim(chunk_split($line[22],2,':'),':');
397 516
 		        $data['arrival_airport_icao'] = $line[13];
398 517
 			$data['frequency'] = $line[4];
399 518
 			$data['type'] = $line[18];
400 519
 			$data['range'] = $line[19];
401
-			if (isset($line[35])) $data['info'] = $line[35];
520
+			if (isset($line[35])) {
521
+				$data['info'] = $line[35];
522
+			}
402 523
     			$data['id_source'] = $id_source;
403 524
 	    		//$data['arrival_airport_time'] = ;
404 525
 	    		if ($line[9] != '') {
@@ -412,22 +533,35 @@  discard block
 block discarded – undo
412 533
 	    		elseif ($value == 'vatsimtxt') $data['format_source'] = 'vatsimtxt';
413 534
 	    		*/
414 535
 	    		$data['format_source'] = $value['format'];
415
-			if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name'];
416
-    			if ($line[3] == 'PILOT') $SI->add($data);
417
-			elseif ($line[3] == 'ATC') {
536
+			if (isset($value['name']) && $value['name'] != '') {
537
+				$data['source_name'] = $value['name'];
538
+			}
539
+    			if ($line[3] == 'PILOT') {
540
+    				$SI->add($data);
541
+    			} elseif ($line[3] == 'ATC') {
418 542
 				//print_r($data);
419 543
 				$data['info'] = str_replace('^&sect;','<br />',$data['info']);
420 544
 				$data['info'] = str_replace('&amp;sect;','',$data['info']);
421 545
 				$typec = substr($data['ident'],-3);
422
-				if ($typec == 'APP') $data['type'] = 'Approach';
423
-				elseif ($typec == 'TWR') $data['type'] = 'Tower';
424
-				elseif ($typec == 'OBS') $data['type'] = 'Observer';
425
-				elseif ($typec == 'GND') $data['type'] = 'Ground';
426
-				elseif ($typec == 'DEL') $data['type'] = 'Delivery';
427
-				elseif ($typec == 'DEP') $data['type'] = 'Departure';
428
-				elseif ($typec == 'FSS') $data['type'] = 'Flight Service Station';
429
-				elseif ($typec == 'CTR') $data['type'] = 'Control Radar or Centre';
430
-				elseif ($data['type'] == '') $data['type'] = 'Observer';
546
+				if ($typec == 'APP') {
547
+					$data['type'] = 'Approach';
548
+				} elseif ($typec == 'TWR') {
549
+					$data['type'] = 'Tower';
550
+				} elseif ($typec == 'OBS') {
551
+					$data['type'] = 'Observer';
552
+				} elseif ($typec == 'GND') {
553
+					$data['type'] = 'Ground';
554
+				} elseif ($typec == 'DEL') {
555
+					$data['type'] = 'Delivery';
556
+				} elseif ($typec == 'DEP') {
557
+					$data['type'] = 'Departure';
558
+				} elseif ($typec == 'FSS') {
559
+					$data['type'] = 'Flight Service Station';
560
+				} elseif ($typec == 'CTR') {
561
+					$data['type'] = 'Control Radar or Centre';
562
+				} elseif ($data['type'] == '') {
563
+					$data['type'] = 'Observer';
564
+				}
431 565
 				
432 566
 				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']);
433 567
 			}
@@ -447,26 +581,55 @@  discard block
 block discarded – undo
447 581
 		foreach ($all_data['acList'] as $line) {
448 582
 		    $data = array();
449 583
 		    $data['hex'] = $line['Icao']; // hex
450
-		    if (isset($line['Call'])) $data['ident'] = $line['Call']; // ident
451
-		    if (isset($line['Alt'])) $data['altitude'] = $line['Alt']; // altitude
452
-		    if (isset($line['Spd'])) $data['speed'] = $line['Spd']; // speed
453
-		    if (isset($line['Trak'])) $data['heading'] = $line['Trak']; // heading
454
-		    if (isset($line['Lat'])) $data['latitude'] = $line['Lat']; // lat
455
-		    if (isset($line['Long'])) $data['longitude'] = $line['Long']; // long
584
+		    if (isset($line['Call'])) {
585
+		    	$data['ident'] = $line['Call'];
586
+		    }
587
+		    // ident
588
+		    if (isset($line['Alt'])) {
589
+		    	$data['altitude'] = $line['Alt'];
590
+		    }
591
+		    // altitude
592
+		    if (isset($line['Spd'])) {
593
+		    	$data['speed'] = $line['Spd'];
594
+		    }
595
+		    // speed
596
+		    if (isset($line['Trak'])) {
597
+		    	$data['heading'] = $line['Trak'];
598
+		    }
599
+		    // heading
600
+		    if (isset($line['Lat'])) {
601
+		    	$data['latitude'] = $line['Lat'];
602
+		    }
603
+		    // lat
604
+		    if (isset($line['Long'])) {
605
+		    	$data['longitude'] = $line['Long'];
606
+		    }
607
+		    // long
456 608
 		    //$data['verticalrate'] = $line['']; // verticale rate
457
-		    if (isset($line['Sqk'])) $data['squawk'] = $line['Sqk']; // squawk
609
+		    if (isset($line['Sqk'])) {
610
+		    	$data['squawk'] = $line['Sqk'];
611
+		    }
612
+		    // squawk
458 613
 		    $data['emergency'] = ''; // emergency
459
-		    if (isset($line['Reg'])) $data['registration'] = $line['Reg'];
614
+		    if (isset($line['Reg'])) {
615
+		    	$data['registration'] = $line['Reg'];
616
+		    }
460 617
 		    /*
461 618
 		    if (isset($line['PosTime'])) $data['datetime'] = date('Y-m-d H:i:s',$line['PosTime']/1000);
462 619
 		    else $data['datetime'] = date('Y-m-d H:i:s');
463 620
 		    */
464 621
 		    $data['datetime'] = date('Y-m-d H:i:s');
465
-		    if (isset($line['Type'])) $data['aircraft_icao'] = $line['Type'];
622
+		    if (isset($line['Type'])) {
623
+		    	$data['aircraft_icao'] = $line['Type'];
624
+		    }
466 625
 	    	    $data['format_source'] = 'aircraftlistjson';
467 626
 		    $data['id_source'] = $id_source;
468
-		    if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name'];
469
-		    if (isset($data['datetime'])) $SI->add($data);
627
+		    if (isset($value['name']) && $value['name'] != '') {
628
+		    	$data['source_name'] = $value['name'];
629
+		    }
630
+		    if (isset($data['datetime'])) {
631
+		    	$SI->add($data);
632
+		    }
470 633
 		    unset($data);
471 634
 		}
472 635
 	    } else {
@@ -485,7 +648,9 @@  discard block
 block discarded – undo
485 648
 		    $data['datetime'] = date('Y-m-d H:i:s');
486 649
 	    	    $data['format_source'] = 'aircraftlistjson';
487 650
     		    $data['id_source'] = $id_source;
488
-		    if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name'];
651
+		    if (isset($value['name']) && $value['name'] != '') {
652
+		    	$data['source_name'] = $value['name'];
653
+		    }
489 654
 		    $SI->add($data);
490 655
 		    unset($data);
491 656
 		}
@@ -520,7 +685,9 @@  discard block
 block discarded – undo
520 685
 		    $data['datetime'] = date('Y-m-d H:i:s',$line[9]);
521 686
 	    	    $data['format_source'] = 'planeupdatefaa';
522 687
     		    $data['id_source'] = $id_source;
523
-		    if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name'];
688
+		    if (isset($value['name']) && $value['name'] != '') {
689
+		    	$data['source_name'] = $value['name'];
690
+		    }
524 691
 		    $SI->add($data);
525 692
 		    unset($data);
526 693
 		}
@@ -579,7 +746,9 @@  discard block
 block discarded – undo
579 746
 		    $data['datetime'] = date('Y-m-d H:i:s'); //$line[10]
580 747
 	    	    $data['format_source'] = 'fr24json';
581 748
     		    $data['id_source'] = $id_source;
582
-		    if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name'];
749
+		    if (isset($value['name']) && $value['name'] != '') {
750
+		    	$data['source_name'] = $value['name'];
751
+		    }
583 752
 		    $SI->add($data);
584 753
 		    unset($data);
585 754
 		}
@@ -602,23 +771,39 @@  discard block
 block discarded – undo
602 771
 		    if (isset($line['inf'])) {
603 772
 			$data = array();
604 773
 			$data['hex'] = $line['inf']['ia'];
605
-			if (isset($line['inf']['cs'])) $data['ident'] = $line['inf']['cs']; //$line[13]
774
+			if (isset($line['inf']['cs'])) {
775
+				$data['ident'] = $line['inf']['cs'];
776
+			}
777
+			//$line[13]
606 778
 	    		$data['altitude'] = round($line['inf']['al']*3.28084); // altitude
607
-	    		if (isset($line['inf']['gs'])) $data['speed'] = round($line['inf']['gs']*0.539957); // speed
608
-	    		if (isset($line['inf']['tr'])) $data['heading'] = $line['inf']['tr']; // heading
779
+	    		if (isset($line['inf']['gs'])) {
780
+	    			$data['speed'] = round($line['inf']['gs']*0.539957);
781
+	    		}
782
+	    		// speed
783
+	    		if (isset($line['inf']['tr'])) {
784
+	    			$data['heading'] = $line['inf']['tr'];
785
+	    		}
786
+	    		// heading
609 787
 	    		$data['latitude'] = $line['pt'][0]; // lat
610 788
 	    		$data['longitude'] = $line['pt'][1]; // long
611 789
 	    		//if (isset($line['inf']['vs'])) $data['verticalrate'] = $line['inf']['vs']; // verticale rate
612
-	    		if (isset($line['inf']['sq'])) $data['squawk'] = $line['inf']['sq']; // squawk
790
+	    		if (isset($line['inf']['sq'])) {
791
+	    			$data['squawk'] = $line['inf']['sq'];
792
+	    		}
793
+	    		// squawk
613 794
 	    		//$data['aircraft_icao'] = $line[8];
614
-	    		if (isset($line['inf']['rc'])) $data['registration'] = $line['inf']['rc'];
795
+	    		if (isset($line['inf']['rc'])) {
796
+	    			$data['registration'] = $line['inf']['rc'];
797
+	    		}
615 798
 			//$data['departure_airport_iata'] = $line[11];
616 799
 			//$data['arrival_airport_iata'] = $line[12];
617 800
 	    		//$data['emergency'] = ''; // emergency
618 801
 			$data['datetime'] = date('Y-m-d H:i:s',$line['inf']['dt']); //$line[10]
619 802
 	    		$data['format_source'] = 'radarvirtueljson';
620 803
     			$data['id_source'] = $id_source;
621
-			if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name'];
804
+			if (isset($value['name']) && $value['name'] != '') {
805
+				$data['source_name'] = $value['name'];
806
+			}
622 807
 			$SI->add($data);
623 808
 			unset($data);
624 809
 		    }
@@ -638,29 +823,62 @@  discard block
 block discarded – undo
638 823
 		    $data['id'] = $line['id'];
639 824
 		    $data['hex'] = substr(str_pad(dechex($line['id']),6,'000000',STR_PAD_LEFT),0,6);
640 825
 		    $data['ident'] = $line['callsign']; // ident
641
-		    if (isset($line['pilotid'])) $data['pilot_id'] = $line['pilotid']; // pilot id
642
-		    if (isset($line['name'])) $data['pilot_name'] = $line['name']; // pilot name
643
-		    if (isset($line['alt'])) $data['altitude'] = $line['alt']; // altitude
644
-		    if (isset($line['gs'])) $data['speed'] = $line['gs']; // speed
645
-		    if (isset($line['heading'])) $data['heading'] = $line['heading']; // heading
646
-		    if (isset($line['route'])) $data['waypoints'] = $line['route']; // route
826
+		    if (isset($line['pilotid'])) {
827
+		    	$data['pilot_id'] = $line['pilotid'];
828
+		    }
829
+		    // pilot id
830
+		    if (isset($line['name'])) {
831
+		    	$data['pilot_name'] = $line['name'];
832
+		    }
833
+		    // pilot name
834
+		    if (isset($line['alt'])) {
835
+		    	$data['altitude'] = $line['alt'];
836
+		    }
837
+		    // altitude
838
+		    if (isset($line['gs'])) {
839
+		    	$data['speed'] = $line['gs'];
840
+		    }
841
+		    // speed
842
+		    if (isset($line['heading'])) {
843
+		    	$data['heading'] = $line['heading'];
844
+		    }
845
+		    // heading
846
+		    if (isset($line['route'])) {
847
+		    	$data['waypoints'] = $line['route'];
848
+		    }
849
+		    // route
647 850
 		    $data['latitude'] = $line['lat']; // lat
648 851
 		    $data['longitude'] = $line['lon']; // long
649 852
 		    //$data['verticalrate'] = $line['vrt']; // verticale rate
650 853
 		    //$data['squawk'] = $line['squawk']; // squawk
651 854
 		    //$data['emergency'] = ''; // emergency
652
-		    if (isset($line['depicao'])) $data['departure_airport_icao'] = $line['depicao'];
653
-		    if (isset($line['deptime'])) $data['departure_airport_time'] = $line['deptime'];
654
-		    if (isset($line['arricao'])) $data['arrival_airport_icao'] = $line['arricao'];
855
+		    if (isset($line['depicao'])) {
856
+		    	$data['departure_airport_icao'] = $line['depicao'];
857
+		    }
858
+		    if (isset($line['deptime'])) {
859
+		    	$data['departure_airport_time'] = $line['deptime'];
860
+		    }
861
+		    if (isset($line['arricao'])) {
862
+		    	$data['arrival_airport_icao'] = $line['arricao'];
863
+		    }
655 864
 		    //$data['arrival_airport_time'] = $line['arrtime'];
656
-		    if (isset($line['aircraft'])) $data['aircraft_icao'] = $line['aircraft'];
657
-		    if (isset($line['transponder'])) $data['squawk'] = $line['transponder'];
658
-		    if (isset($line['atis'])) $data['info'] = $line['atis'];
659
-		    else $data['info'] = '';
865
+		    if (isset($line['aircraft'])) {
866
+		    	$data['aircraft_icao'] = $line['aircraft'];
867
+		    }
868
+		    if (isset($line['transponder'])) {
869
+		    	$data['squawk'] = $line['transponder'];
870
+		    }
871
+		    if (isset($line['atis'])) {
872
+		    	$data['info'] = $line['atis'];
873
+		    } else {
874
+		    	$data['info'] = '';
875
+		    }
660 876
 		    $data['format_source'] = 'pireps';
661 877
     		    $data['id_source'] = $id_source;
662 878
 		    $data['datetime'] = date('Y-m-d H:i:s');
663
-		    if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name'];
879
+		    if (isset($value['name']) && $value['name'] != '') {
880
+		    	$data['source_name'] = $value['name'];
881
+		    }
664 882
 		    if ($line['icon'] == 'plane') {
665 883
 			$SI->add($data);
666 884
 		    //    print_r($data);
@@ -669,15 +887,25 @@  discard block
 block discarded – undo
669 887
 			$data['info'] = str_replace('&amp;sect;','',$data['info']);
670 888
 			$typec = substr($data['ident'],-3);
671 889
 			$data['type'] = '';
672
-			if ($typec == 'APP') $data['type'] = 'Approach';
673
-			elseif ($typec == 'TWR') $data['type'] = 'Tower';
674
-			elseif ($typec == 'OBS') $data['type'] = 'Observer';
675
-			elseif ($typec == 'GND') $data['type'] = 'Ground';
676
-			elseif ($typec == 'DEL') $data['type'] = 'Delivery';
677
-			elseif ($typec == 'DEP') $data['type'] = 'Departure';
678
-			elseif ($typec == 'FSS') $data['type'] = 'Flight Service Station';
679
-			elseif ($typec == 'CTR') $data['type'] = 'Control Radar or Centre';
680
-			else $data['type'] = 'Observer';
890
+			if ($typec == 'APP') {
891
+				$data['type'] = 'Approach';
892
+			} elseif ($typec == 'TWR') {
893
+				$data['type'] = 'Tower';
894
+			} elseif ($typec == 'OBS') {
895
+				$data['type'] = 'Observer';
896
+			} elseif ($typec == 'GND') {
897
+				$data['type'] = 'Ground';
898
+			} elseif ($typec == 'DEL') {
899
+				$data['type'] = 'Delivery';
900
+			} elseif ($typec == 'DEP') {
901
+				$data['type'] = 'Departure';
902
+			} elseif ($typec == 'FSS') {
903
+				$data['type'] = 'Flight Service Station';
904
+			} elseif ($typec == 'CTR') {
905
+				$data['type'] = 'Control Radar or Centre';
906
+			} else {
907
+				$data['type'] = 'Observer';
908
+			}
681 909
 			echo $ATC->add($data['ident'],'',$data['latitude'],$data['longitude'],'0',$data['info'],$data['datetime'],$data['type'],$data['pilot_id'],$data['pilot_name']);
682 910
 		    }
683 911
 		    unset($data);
@@ -688,17 +916,25 @@  discard block
 block discarded – undo
688 916
     	//} elseif ($value == 'phpvmacars' && (time() - $last_exec['phpvmacars'] > $globalMinFetch)) {
689 917
     	} elseif ($value['format'] == 'phpvmacars' && (time() - $last_exec[$id]['last'] > $globalMinFetch)) {
690 918
 	    //$buffer = $Common->getData($hosts[$id]);
691
-	    if ($globalDebug) echo 'Get Data...'."\n";
919
+	    if ($globalDebug) {
920
+	    	echo 'Get Data...'."\n";
921
+	    }
692 922
 	    $buffer = $Common->getData($value['host']);
693 923
 	    $all_data = json_decode($buffer,true);
694 924
 	    if ($buffer != '' && is_array($all_data)) {
695 925
 		foreach ($all_data as $line) {
696 926
 	    	    $data = array();
697 927
 	    	    //$data['id'] = $line['id']; // id not usable
698
-	    	    if (isset($line['pilotid'])) $data['id'] = $line['pilotid'].$line['flightnum'];
928
+	    	    if (isset($line['pilotid'])) {
929
+	    	    	$data['id'] = $line['pilotid'].$line['flightnum'];
930
+	    	    }
699 931
 	    	    $data['hex'] = substr(str_pad(bin2hex($line['flightnum']),6,'000000',STR_PAD_LEFT),-6); // hex
700
-	    	    if (isset($line['pilotname'])) $data['pilot_name'] = $line['pilotname'];
701
-	    	    if (isset($line['pilotid'])) $data['pilot_id'] = $line['pilotid'];
932
+	    	    if (isset($line['pilotname'])) {
933
+	    	    	$data['pilot_name'] = $line['pilotname'];
934
+	    	    }
935
+	    	    if (isset($line['pilotid'])) {
936
+	    	    	$data['pilot_id'] = $line['pilotid'];
937
+	    	    }
702 938
 	    	    $data['ident'] = $line['flightnum']; // ident
703 939
 	    	    $data['altitude'] = $line['alt']; // altitude
704 940
 	    	    $data['speed'] = $line['gs']; // speed
@@ -716,27 +952,41 @@  discard block
 block discarded – undo
716 952
 	    	    $data['arrival_airport_icao'] = $line['arricao'];
717 953
     		    $data['arrival_airport_time'] = $line['arrtime'];
718 954
     		    $data['registration'] = $line['aircraft'];
719
-		    if (isset($line['route'])) $data['waypoints'] = $line['route']; // route
955
+		    if (isset($line['route'])) {
956
+		    	$data['waypoints'] = $line['route'];
957
+		    }
958
+		    // route
720 959
 		    if (isset($line['aircraftname'])) {
721 960
 			$line['aircraftname'] = strtoupper($line['aircraftname']);
722 961
 			$line['aircraftname'] = str_replace('BOEING ','B',$line['aircraftname']);
723 962
 	    		$aircraft_data = explode('-',$line['aircraftname']);
724
-	    		if (isset($aircraft_data[1]) && strlen($aircraft_data[0]) < 5) $data['aircraft_icao'] = $aircraft_data[0];
725
-	    		elseif (isset($aircraft_data[1]) && strlen($aircraft_data[1]) < 5) $data['aircraft_icao'] = $aircraft_data[1];
726
-	    		else {
963
+	    		if (isset($aircraft_data[1]) && strlen($aircraft_data[0]) < 5) {
964
+	    			$data['aircraft_icao'] = $aircraft_data[0];
965
+	    		} elseif (isset($aircraft_data[1]) && strlen($aircraft_data[1]) < 5) {
966
+	    			$data['aircraft_icao'] = $aircraft_data[1];
967
+	    		} else {
727 968
 	    		    $aircraft_data = explode(' ',$line['aircraftname']);
728
-	    		    if (isset($aircraft_data[1])) $data['aircraft_icao'] = $aircraft_data[1];
729
-	    		    else $data['aircraft_icao'] = $line['aircraftname'];
969
+	    		    if (isset($aircraft_data[1])) {
970
+	    		    	$data['aircraft_icao'] = $aircraft_data[1];
971
+	    		    } else {
972
+	    		    	$data['aircraft_icao'] = $line['aircraftname'];
973
+	    		    }
730 974
 	    		}
731 975
 	    	    }
732
-    		    if (isset($line['route'])) $data['waypoints'] = $line['route'];
976
+    		    if (isset($line['route'])) {
977
+    		    	$data['waypoints'] = $line['route'];
978
+    		    }
733 979
     		    $data['id_source'] = $id_source;
734 980
 	    	    $data['format_source'] = 'phpvmacars';
735
-		    if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name'];
981
+		    if (isset($value['name']) && $value['name'] != '') {
982
+		    	$data['source_name'] = $value['name'];
983
+		    }
736 984
 		    $SI->add($data);
737 985
 		    unset($data);
738 986
 		}
739
-		if ($globalDebug) echo 'No more data...'."\n";
987
+		if ($globalDebug) {
988
+			echo 'No more data...'."\n";
989
+		}
740 990
 		unset($buffer);
741 991
 		unset($all_data);
742 992
 	    }
@@ -744,7 +994,9 @@  discard block
 block discarded – undo
744 994
     	    $last_exec[$id]['last'] = time();
745 995
     	} elseif ($value['format'] == 'vam' && (time() - $last_exec[$id]['last'] > $globalMinFetch)) {
746 996
 	    //$buffer = $Common->getData($hosts[$id]);
747
-	    if ($globalDebug) echo 'Get Data...'."\n";
997
+	    if ($globalDebug) {
998
+	    	echo 'Get Data...'."\n";
999
+	    }
748 1000
 	    $buffer = $Common->getData($value['host']);
749 1001
 	    $all_data = json_decode($buffer,true);
750 1002
 	    if ($buffer != '' && is_array($all_data)) {
@@ -772,15 +1024,22 @@  discard block
 block discarded – undo
772 1024
 	    	    $data['arrival_airport_icao'] = $line['arrival'];
773 1025
     		    //$data['arrival_airport_time'] = $line['arrival_time'];
774 1026
     		    //$data['registration'] = $line['aircraft'];
775
-		    if (isset($line['route'])) $data['waypoints'] = $line['route']; // route
1027
+		    if (isset($line['route'])) {
1028
+		    	$data['waypoints'] = $line['route'];
1029
+		    }
1030
+		    // route
776 1031
 	    	    $data['aircraft_icao'] = $line['plane_type'];
777 1032
     		    $data['id_source'] = $id_source;
778 1033
 	    	    $data['format_source'] = 'vam';
779
-		    if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name'];
1034
+		    if (isset($value['name']) && $value['name'] != '') {
1035
+		    	$data['source_name'] = $value['name'];
1036
+		    }
780 1037
 		    $SI->add($data);
781 1038
 		    unset($data);
782 1039
 		}
783
-		if ($globalDebug) echo 'No more data...'."\n";
1040
+		if ($globalDebug) {
1041
+			echo 'No more data...'."\n";
1042
+		}
784 1043
 		unset($buffer);
785 1044
 		unset($all_data);
786 1045
 	    }
@@ -788,7 +1047,9 @@  discard block
 block discarded – undo
788 1047
     	    $last_exec[$id]['last'] = time();
789 1048
 	//} elseif ($value == 'sbs' || $value == 'tsv' || $value == 'raw' || $value == 'aprs' || $value == 'beast') {
790 1049
 	} elseif ($value['format'] == 'sbs' || $value['format'] == 'tsv' || $value['format'] == 'raw' || $value['format'] == 'aprs' || $value['format'] == 'beast' || $value['format'] == 'flightgearmp' || $value['format'] == 'flightgearsp' || $value['format'] == 'acars' || $value['format'] == 'acarssbs3') {
791
-	    if (function_exists('pcntl_fork')) pcntl_signal_dispatch();
1050
+	    if (function_exists('pcntl_fork')) {
1051
+	    	pcntl_signal_dispatch();
1052
+	    }
792 1053
     	    //$last_exec[$id]['last'] = time();
793 1054
 
794 1055
 	    //$read = array( $sockets[$id] );
@@ -796,7 +1057,9 @@  discard block
 block discarded – undo
796 1057
 	    $write = NULL;
797 1058
 	    $e = NULL;
798 1059
 	    $n = socket_select($read, $write, $e, $timeout);
799
-	    if ($e != NULL) var_dump($e);
1060
+	    if ($e != NULL) {
1061
+	    	var_dump($e);
1062
+	    }
800 1063
 	    if ($n > 0) {
801 1064
 		foreach ($read as $nb => $r) {
802 1065
 		    //$value = $formats[$nb];
@@ -817,7 +1080,9 @@  discard block
 block discarded – undo
817 1080
 		    if ($buffer != '') {
818 1081
 			$tt[$format] = 0;
819 1082
 			if ($format == 'acarssbs3') {
820
-                    	    if ($globalDebug) echo 'ACARS : '.$buffer."\n";
1083
+                    	    if ($globalDebug) {
1084
+                    	    	echo 'ACARS : '.$buffer."\n";
1085
+                    	    }
821 1086
 			    $ACARS->add(trim($buffer));
822 1087
 			    $ACARS->deleteLiveAcarsData();
823 1088
 			} elseif ($format == 'raw') {
@@ -826,9 +1091,15 @@  discard block
 block discarded – undo
826 1091
 			    if (is_array($data)) {
827 1092
 				$data['datetime'] = date('Y-m-d H:i:s');
828 1093
 				$data['format_source'] = 'raw';
829
-				if (isset($globalSources[$nb]['name']) && $globalSources[$nb]['name'] != '') $data['source_name'] = $globalSources[$nb]['name'];
830
-    				if (isset($globalSources[$nb]['sourcestats'])) $data['sourcestats'] = $globalSources[$nb]['sourcestats'];
831
-                                if (($data['latitude'] == '' && $data['longitude'] == '') || (is_numeric($data['latitude']) && is_numeric($data['longitude']))) $SI->add($data);
1094
+				if (isset($globalSources[$nb]['name']) && $globalSources[$nb]['name'] != '') {
1095
+					$data['source_name'] = $globalSources[$nb]['name'];
1096
+				}
1097
+    				if (isset($globalSources[$nb]['sourcestats'])) {
1098
+    					$data['sourcestats'] = $globalSources[$nb]['sourcestats'];
1099
+    				}
1100
+                                if (($data['latitude'] == '' && $data['longitude'] == '') || (is_numeric($data['latitude']) && is_numeric($data['longitude']))) {
1101
+                                	$SI->add($data);
1102
+                                }
832 1103
                             }
833 1104
                         } elseif ($format == 'flightgearsp') {
834 1105
                     	    //echo $buffer."\n";
@@ -846,11 +1117,15 @@  discard block
 block discarded – undo
846 1117
 				$data['speed'] = round($line[5]*1.94384);
847 1118
 				$data['datetime'] = date('Y-m-d H:i:s');
848 1119
 				$data['format_source'] = 'flightgearsp';
849
-				if (($data['latitude'] == '' && $data['longitude'] == '') || (is_numeric($data['latitude']) && is_numeric($data['longitude']))) $SI->add($data);
1120
+				if (($data['latitude'] == '' && $data['longitude'] == '') || (is_numeric($data['latitude']) && is_numeric($data['longitude']))) {
1121
+					$SI->add($data);
1122
+				}
850 1123
 				$send = @ socket_send( $r  , $data_aprs , strlen($data_aprs) , 0 );
851 1124
 			    }
852 1125
                         } elseif ($format == 'acars') {
853
-                    	    if ($globalDebug) echo 'ACARS : '.$buffer."\n";
1126
+                    	    if ($globalDebug) {
1127
+                    	    	echo 'ACARS : '.$buffer."\n";
1128
+                    	    }
854 1129
 			    $ACARS->add(trim($buffer));
855 1130
 			    socket_sendto($r, "OK " . $buffer , 100 , 0 , $remote_ip , $remote_port);
856 1131
 			    $ACARS->deleteLiveAcarsData();
@@ -871,7 +1146,9 @@  discard block
 block discarded – undo
871 1146
 				    $aircraft_type = $line[10];
872 1147
 				    $aircraft_type = preg_split(':/:',$aircraft_type);
873 1148
 				    $data['aircraft_name'] = substr(end($aircraft_type),0,-4);
874
-				    if (($data['latitude'] == '' && $data['longitude'] == '') || (is_numeric($data['latitude']) && is_numeric($data['longitude']))) $SI->add($data);
1149
+				    if (($data['latitude'] == '' && $data['longitude'] == '') || (is_numeric($data['latitude']) && is_numeric($data['longitude']))) {
1150
+				    	$SI->add($data);
1151
+				    }
875 1152
 				}
876 1153
 			    }
877 1154
 			} elseif ($format == 'beast') {
@@ -887,21 +1164,43 @@  discard block
 block discarded – undo
887 1164
     				$data['hex'] = $lined['hexid'];
888 1165
     				//$data['datetime'] = date('Y-m-d H:i:s',strtotime($lined['clock']));;
889 1166
     				$data['datetime'] = date('Y-m-d H:i:s');;
890
-    				if (isset($lined['ident'])) $data['ident'] = $lined['ident'];
891
-    				if (isset($lined['lat'])) $data['latitude'] = $lined['lat'];
892
-    				if (isset($lined['lon'])) $data['longitude'] = $lined['lon'];
893
-    				if (isset($lined['speed'])) $data['speed'] = $lined['speed'];
894
-    				if (isset($lined['squawk'])) $data['squawk'] = $lined['squawk'];
895
-    				if (isset($lined['alt'])) $data['altitude'] = $lined['alt'];
896
-    				if (isset($lined['heading'])) $data['heading'] = $lined['heading'];
1167
+    				if (isset($lined['ident'])) {
1168
+    					$data['ident'] = $lined['ident'];
1169
+    				}
1170
+    				if (isset($lined['lat'])) {
1171
+    					$data['latitude'] = $lined['lat'];
1172
+    				}
1173
+    				if (isset($lined['lon'])) {
1174
+    					$data['longitude'] = $lined['lon'];
1175
+    				}
1176
+    				if (isset($lined['speed'])) {
1177
+    					$data['speed'] = $lined['speed'];
1178
+    				}
1179
+    				if (isset($lined['squawk'])) {
1180
+    					$data['squawk'] = $lined['squawk'];
1181
+    				}
1182
+    				if (isset($lined['alt'])) {
1183
+    					$data['altitude'] = $lined['alt'];
1184
+    				}
1185
+    				if (isset($lined['heading'])) {
1186
+    					$data['heading'] = $lined['heading'];
1187
+    				}
897 1188
     				$data['id_source'] = $id_source;
898 1189
     				$data['format_source'] = 'tsv';
899
-    				if (isset($globalSources[$nb]['name']) && $globalSources[$nb]['name'] != '') $data['source_name'] = $globalSources[$nb]['name'];
900
-    				if (isset($globalSources[$nb]['sourcestats'])) $data['sourcestats'] = $globalSources[$nb]['sourcestats'];
901
-    				if (($data['latitude'] == '' && $data['longitude'] == '') || (is_numeric($data['latitude']) && is_numeric($data['longitude']))) $SI->add($data);
1190
+    				if (isset($globalSources[$nb]['name']) && $globalSources[$nb]['name'] != '') {
1191
+    					$data['source_name'] = $globalSources[$nb]['name'];
1192
+    				}
1193
+    				if (isset($globalSources[$nb]['sourcestats'])) {
1194
+    					$data['sourcestats'] = $globalSources[$nb]['sourcestats'];
1195
+    				}
1196
+    				if (($data['latitude'] == '' && $data['longitude'] == '') || (is_numeric($data['latitude']) && is_numeric($data['longitude']))) {
1197
+    					$SI->add($data);
1198
+    				}
902 1199
     				unset($lined);
903 1200
     				unset($data);
904
-    			    } else $error = true;
1201
+    			    } else {
1202
+    			    	$error = true;
1203
+    			    }
905 1204
 			} elseif ($format == 'aprs' && $use_aprs) {
906 1205
 			    if ($aprs_connect == 0) {
907 1206
 				$send = @ socket_send( $r  , $aprs_login , strlen($aprs_login) , 0 );
@@ -927,29 +1226,44 @@  discard block
 block discarded – undo
927 1226
 				    $data['latitude'] = $line['latitude'];
928 1227
 				    $data['longitude'] = $line['longitude'];
929 1228
 				    //$data['verticalrate'] = $line[16];
930
-				    if (isset($line['speed'])) $data['speed'] = $line['speed'];
931
-				    else $data['speed'] = 0;
1229
+				    if (isset($line['speed'])) {
1230
+				    	$data['speed'] = $line['speed'];
1231
+				    } else {
1232
+				    	$data['speed'] = 0;
1233
+				    }
932 1234
 				    $data['altitude'] = $line['altitude'];
933
-				    if (isset($line['course'])) $data['heading'] = $line['course'];
1235
+				    if (isset($line['course'])) {
1236
+				    	$data['heading'] = $line['course'];
1237
+				    }
934 1238
 				    //else $data['heading'] = 0;
935 1239
 				    $data['aircraft_type'] = $line['stealth'];
936
-				    if (!isset($globalAPRSarchive) || (isset($globalAPRSarchive) && $globalAPRSarchive == FALSE)) $data['noarchive'] = true;
1240
+				    if (!isset($globalAPRSarchive) || (isset($globalAPRSarchive) && $globalAPRSarchive == FALSE)) {
1241
+				    	$data['noarchive'] = true;
1242
+				    }
937 1243
     				    $data['id_source'] = $id_source;
938 1244
 				    $data['format_source'] = 'aprs';
939 1245
 				    $data['source_name'] = $line['source'];
940
-    				    if (isset($globalSources[$nb]['sourcestats'])) $data['sourcestats'] = $globalSources[$nb]['sourcestats'];
1246
+    				    if (isset($globalSources[$nb]['sourcestats'])) {
1247
+    				    	$data['sourcestats'] = $globalSources[$nb]['sourcestats'];
1248
+    				    }
941 1249
 				    $currentdate = date('Y-m-d H:i:s');
942 1250
 				    $aprsdate = strtotime($data['datetime']);
943 1251
 				    // Accept data if time <= system time + 20s
944
-				    if ($line['stealth'] == 0 && (strtotime($data['datetime']) <= strtotime($currentdate)+20) && (($data['latitude'] == '' && $data['longitude'] == '') || (is_numeric($data['latitude']) && is_numeric($data['longitude'])))) $send = $SI->add($data);
945
-				    else {
946
-					if ($line['stealth'] != 0) echo '-------- '.$data['ident'].' : APRS stealth ON => not adding'."\n";
947
-					else echo '--------- '.$data['ident'].' : Date APRS : '.$data['datetime'].' - Current date : '.$currentdate.' => not adding future event'."\n";
1252
+				    if ($line['stealth'] == 0 && (strtotime($data['datetime']) <= strtotime($currentdate)+20) && (($data['latitude'] == '' && $data['longitude'] == '') || (is_numeric($data['latitude']) && is_numeric($data['longitude'])))) {
1253
+				    	$send = $SI->add($data);
1254
+				    } else {
1255
+					if ($line['stealth'] != 0) {
1256
+						echo '-------- '.$data['ident'].' : APRS stealth ON => not adding'."\n";
1257
+					} else {
1258
+						echo '--------- '.$data['ident'].' : Date APRS : '.$data['datetime'].' - Current date : '.$currentdate.' => not adding future event'."\n";
1259
+					}
948 1260
 				    }
949 1261
 				    unset($data);
950 1262
 				} 
951 1263
 				//elseif ($line == false && $globalDebug) echo 'Ignored ('.$buffer.")\n";
952
-				elseif ($line == true && $globalDebug) echo '!! Failed : '.$buffer."!!\n";
1264
+				elseif ($line == true && $globalDebug) {
1265
+					echo '!! Failed : '.$buffer."!!\n";
1266
+				}
953 1267
 			    }
954 1268
 			} else {
955 1269
 			    $line = explode(',', $buffer);
@@ -977,25 +1291,42 @@  discard block
 block discarded – undo
977 1291
     				$data['ground'] = $line[21];
978 1292
     				$data['emergency'] = $line[19];
979 1293
     				$data['format_source'] = 'sbs';
980
-				if (isset($globalSources[$nb]['name']) && $globalSources[$nb]['name'] != '') $data['source_name'] = $globalSources[$nb]['name'];
981
-    				if (isset($globalSources[$nb]['sourcestats'])) $data['sourcestats'] = $globalSources[$nb]['sourcestats'];
1294
+				if (isset($globalSources[$nb]['name']) && $globalSources[$nb]['name'] != '') {
1295
+					$data['source_name'] = $globalSources[$nb]['name'];
1296
+				}
1297
+    				if (isset($globalSources[$nb]['sourcestats'])) {
1298
+    					$data['sourcestats'] = $globalSources[$nb]['sourcestats'];
1299
+    				}
982 1300
     				$data['id_source'] = $id_source;
983
-    				if (($data['latitude'] == '' && $data['longitude'] == '') || (is_numeric($data['latitude']) && is_numeric($data['longitude']))) $send = $SI->add($data);
984
-    				else $error = true;
1301
+    				if (($data['latitude'] == '' && $data['longitude'] == '') || (is_numeric($data['latitude']) && is_numeric($data['longitude']))) {
1302
+    					$send = $SI->add($data);
1303
+    				} else {
1304
+    					$error = true;
1305
+    				}
985 1306
     				unset($data);
986
-    			    } else $error = true;
1307
+    			    } else {
1308
+    			    	$error = true;
1309
+    			    }
987 1310
 			    if ($error) {
988 1311
 				if (count($line) > 1 && ($line[0] == 'STA' || $line[0] == 'AIR' || $line[0] == 'SEL' || $line[0] == 'ID' || $line[0] == 'CLK')) { 
989
-					if ($globalDebug) echo "Not a message. Ignoring... \n";
1312
+					if ($globalDebug) {
1313
+						echo "Not a message. Ignoring... \n";
1314
+					}
990 1315
 				} else {
991
-					if ($globalDebug) echo "Wrong line format. Ignoring... \n";
1316
+					if ($globalDebug) {
1317
+						echo "Wrong line format. Ignoring... \n";
1318
+					}
992 1319
 					if ($globalDebug) {
993 1320
 						echo $buffer;
994 1321
 						print_r($line);
995 1322
 					}
996 1323
 					//socket_close($r);
997
-					if ($globalDebug) echo "Reconnect after an error...\n";
998
-					if ($format == 'aprs') $aprs_connect = 0;
1324
+					if ($globalDebug) {
1325
+						echo "Reconnect after an error...\n";
1326
+					}
1327
+					if ($format == 'aprs') {
1328
+						$aprs_connect = 0;
1329
+					}
999 1330
 					$sourceer[$nb] = $globalSources[$nb];
1000 1331
 					connect_all($sourceer);
1001 1332
 					$sourceer = array();
@@ -1003,10 +1334,14 @@  discard block
 block discarded – undo
1003 1334
 			    }
1004 1335
 			}
1005 1336
 			// Sleep for xxx microseconds
1006
-			if (isset($globalSBSSleep)) usleep($globalSBSSleep);
1337
+			if (isset($globalSBSSleep)) {
1338
+				usleep($globalSBSSleep);
1339
+			}
1007 1340
 		    } else {
1008 1341
 			if ($format == 'flightgearmp') {
1009
-			    	if ($globalDebug) echo "Reconnect FlightGear MP...";
1342
+			    	if ($globalDebug) {
1343
+			    		echo "Reconnect FlightGear MP...";
1344
+			    	}
1010 1345
 				//@socket_close($r);
1011 1346
 				sleep($globalMinFetch);
1012 1347
 				$sourcefg[$nb] = $globalSources[$nb];
@@ -1015,10 +1350,15 @@  discard block
 block discarded – undo
1015 1350
 				break;
1016 1351
 				
1017 1352
 			} elseif ($format != 'acars' && $format != 'flightgearsp') {
1018
-			    if (isset($tt[$format])) $tt[$format]++;
1019
-			    else $tt[$format] = 0;
1353
+			    if (isset($tt[$format])) {
1354
+			    	$tt[$format]++;
1355
+			    } else {
1356
+			    	$tt[$format] = 0;
1357
+			    }
1020 1358
 			    if ($tt[$format] > 30) {
1021
-				if ($globalDebug) echo "ERROR : Reconnect ".$format."...";
1359
+				if ($globalDebug) {
1360
+					echo "ERROR : Reconnect ".$format."...";
1361
+				}
1022 1362
 				//@socket_close($r);
1023 1363
 				sleep(2);
1024 1364
 				$aprs_connect = 0;
@@ -1034,12 +1374,18 @@  discard block
 block discarded – undo
1034 1374
 		}
1035 1375
 	    } else {
1036 1376
 		$error = socket_strerror(socket_last_error());
1037
-		if ($globalDebug) echo "ERROR : socket_select give this error ".$error . "\n";
1377
+		if ($globalDebug) {
1378
+			echo "ERROR : socket_select give this error ".$error . "\n";
1379
+		}
1038 1380
 		if (($error != SOCKET_EINPROGRESS && $error != SOCKET_EALREADY && $error != 'Success') || time() - $time >= $timeout) {
1039
-			if (isset($globalDebug)) echo "Restarting...\n";
1381
+			if (isset($globalDebug)) {
1382
+				echo "Restarting...\n";
1383
+			}
1040 1384
 			// Restart the script if possible
1041 1385
 			if (is_array($sockets)) {
1042
-			    if ($globalDebug) echo "Shutdown all sockets...";
1386
+			    if ($globalDebug) {
1387
+			    	echo "Shutdown all sockets...";
1388
+			    }
1043 1389
 			    
1044 1390
 			    foreach ($sockets as $sock) {
1045 1391
 				@socket_shutdown($sock,2);
@@ -1047,7 +1393,9 @@  discard block
 block discarded – undo
1047 1393
 			    }
1048 1394
 			    
1049 1395
 			}
1050
-			    if ($globalDebug) echo "Restart all connections...";
1396
+			    if ($globalDebug) {
1397
+			    	echo "Restart all connections...";
1398
+			    }
1051 1399
 			    sleep(2);
1052 1400
 			    $time = time();
1053 1401
 			    //connect_all($hosts);
@@ -1058,7 +1406,9 @@  discard block
 block discarded – undo
1058 1406
 	    }
1059 1407
 	}
1060 1408
 	if ($globalDaemon === false) {
1061
-	    if ($globalDebug) echo 'Check all...'."\n";
1409
+	    if ($globalDebug) {
1410
+	    	echo 'Check all...'."\n";
1411
+	    }
1062 1412
 	    $SI->checkAll();
1063 1413
 	}
1064 1414
     }
Please login to merge, or discard this patch.
live-czml.php 1 patch
Braces   +56 added lines, -19 removed lines patch added patch discarded remove patch
@@ -40,22 +40,43 @@  discard block
 block discarded – undo
40 40
 }
41 41
 header('Content-Type: text/javascript');
42 42
 
43
-if (!isset($globalJsonCompress)) $compress = true;
44
-else $compress = $globalJsonCompress;
43
+if (!isset($globalJsonCompress)) {
44
+	$compress = true;
45
+} else {
46
+	$compress = $globalJsonCompress;
47
+}
45 48
 
46 49
 $from_archive = false;
47 50
 $min = false;
48 51
 $allhistory = false;
49 52
 $filter['source'] = array();
50
-if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') $filter['source'] = array_merge($filter['source'],array('vatsimtxt'));
51
-if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') $filter['source'] = array_merge($filter['source'],array('whazzup'));
52
-if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') $filter['source'] = array_merge($filter['source'],array('phpvmacars'));
53
-if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') $filter['source'] = array_merge($filter['source'],array('sbs'));
54
-if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') $filter['source'] = array_merge($filter['source'],array('aprs'));
55
-if (isset($_COOKIE['filter_ident']) && $_COOKIE['filter_ident'] != '') $filter['ident'] = filter_var($_COOKIE['filter_ident'],FILTER_SANITIZE_STRING);
56
-if (isset($_COOKIE['filter_Airlines']) && $_COOKIE['filter_Airlines'] != '') $filter['airlines'] = filter_var_array(explode(',',$_COOKIE['filter_Airlines']),FILTER_SANITIZE_STRING);
57
-if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') $filter['source_aprs'] = filter_var_array(explode(',',$_COOKIE['filter_Sources']),FILTER_SANITIZE_STRING);
58
-if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') $filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'],FILTER_SANITIZE_STRING);
53
+if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') {
54
+	$filter['source'] = array_merge($filter['source'],array('vatsimtxt'));
55
+}
56
+if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') {
57
+	$filter['source'] = array_merge($filter['source'],array('whazzup'));
58
+}
59
+if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') {
60
+	$filter['source'] = array_merge($filter['source'],array('phpvmacars'));
61
+}
62
+if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') {
63
+	$filter['source'] = array_merge($filter['source'],array('sbs'));
64
+}
65
+if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') {
66
+	$filter['source'] = array_merge($filter['source'],array('aprs'));
67
+}
68
+if (isset($_COOKIE['filter_ident']) && $_COOKIE['filter_ident'] != '') {
69
+	$filter['ident'] = filter_var($_COOKIE['filter_ident'],FILTER_SANITIZE_STRING);
70
+}
71
+if (isset($_COOKIE['filter_Airlines']) && $_COOKIE['filter_Airlines'] != '') {
72
+	$filter['airlines'] = filter_var_array(explode(',',$_COOKIE['filter_Airlines']),FILTER_SANITIZE_STRING);
73
+}
74
+if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') {
75
+	$filter['source_aprs'] = filter_var_array(explode(',',$_COOKIE['filter_Sources']),FILTER_SANITIZE_STRING);
76
+}
77
+if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') {
78
+	$filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'],FILTER_SANITIZE_STRING);
79
+}
59 80
 /*
60 81
 if (isset($globalMapPopup) && !$globalMapPopup && !(isset($_COOKIE['flightpopup']) && $_COOKIE['flightpopup'] == 'true')) {
61 82
 	$min = true;
@@ -132,8 +153,12 @@  discard block
 block discarded – undo
132 153
 	} else {
133 154
 		$flightcnt = $SpotterLive->getLiveSpotterCount($filter);
134 155
 	}
135
-	if ($flightcnt == '') $flightcnt = 0;
136
-} else $flightcnt = 0;
156
+	if ($flightcnt == '') {
157
+		$flightcnt = 0;
158
+	}
159
+	} else {
160
+	$flightcnt = 0;
161
+}
137 162
 
138 163
 $sqltime = round(microtime(true)-$begintime,2);
139 164
 $minitime = time();
@@ -155,7 +180,9 @@  discard block
 block discarded – undo
155 180
 $j = 0;
156 181
 $prev_flightaware_id = '';
157 182
 $speed = 1;
158
-if (isset($archivespeed)) $speed = $archivespeed;
183
+if (isset($archivespeed)) {
184
+	$speed = $archivespeed;
185
+}
159 186
 $output = '[';
160 187
 $output .= '{"id" : "document", "name" : "fam","version" : "1.0"';
161 188
 //	$output .= ',"clock": {"interval" : "'.date("c",time()-$globalLiveInterval).'/'.date("c").'","currentTime" : "'.date("c",time() - $globalLiveInterval).'","multiplier" : 1,"range" : "LOOP_STOP","step": "SYSTEM_CLOCK_MULTIPLIER"}';
@@ -296,8 +323,12 @@  discard block
 block discarded – undo
296 323
 				}
297 324
 			} else {
298 325
 				$output .= '"model": {"gltf" : "'.$globalURL.'/models/Cesium_Air.glb","scale" : 1.0,"minimumPixelSize": 20 },';
299
-				if ($spotter_item['aircraft_shadow'] != '') $output .= '"aircraft_shadow": "'.$spotter_item['aircraft_shadow'].'",';
300
-				if ($spotter_item['aircraft_icao'] != '') $output .= '"aircraft_icao": "'.$spotter_item['aircraft_icao'].'",';
326
+				if ($spotter_item['aircraft_shadow'] != '') {
327
+					$output .= '"aircraft_shadow": "'.$spotter_item['aircraft_shadow'].'",';
328
+				}
329
+				if ($spotter_item['aircraft_icao'] != '') {
330
+					$output .= '"aircraft_icao": "'.$spotter_item['aircraft_icao'].'",';
331
+				}
301 332
 			}
302 333
 	//		$output .= '"heightReference": "CLAMP_TO_GROUND",';
303 334
 			$output .= '"heightReference": "RELATIVE_TO_GROUND",';
@@ -308,8 +339,12 @@  discard block
 block discarded – undo
308 339
 	//		$output .= '"interpolationDegree" : 5,';
309 340
 	//		$output .= '"epoch" : "'.date("c",strtotime($spotter_item['date'])).'", ';
310 341
 			$output .= '"cartographicDegrees": [';
311
-			if ($minitime > strtotime($spotter_item['date'])) $minitime = strtotime($spotter_item['date']);
312
-			if ($maxitime < strtotime($spotter_item['date'])) $maxitime = strtotime($spotter_item['date']);
342
+			if ($minitime > strtotime($spotter_item['date'])) {
343
+				$minitime = strtotime($spotter_item['date']);
344
+			}
345
+			if ($maxitime < strtotime($spotter_item['date'])) {
346
+				$maxitime = strtotime($spotter_item['date']);
347
+			}
313 348
 			$output .= '"'.date("c",strtotime($spotter_item['date'])).'", ';
314 349
 			$output .= $spotter_item['longitude'].', ';
315 350
 			$output .= $spotter_item['latitude'].', ';
@@ -323,7 +358,9 @@  discard block
 block discarded – undo
323 358
 			//$orientation .= '"'.date("c",strtotime($spotter_item['date'])).'",'.$quat['x'].','.$quat['y'].','.$quat['z'].','.$quat['w'];
324 359
 		} else {
325 360
 			$output .= ',"'.date("c",strtotime($spotter_item['date'])).'", ';
326
-			if ($maxitime < strtotime($spotter_item['date'])) $maxitime = strtotime($spotter_item['date']);
361
+			if ($maxitime < strtotime($spotter_item['date'])) {
362
+				$maxitime = strtotime($spotter_item['date']);
363
+			}
327 364
 			if ($spotter_item['ground_speed'] == 0) {
328 365
 				$output .= $prevlong.', ';
329 366
 				$output .= $prevlat.', ';
Please login to merge, or discard this patch.