Completed
Push — master ( 9321a3...c66f20 )
by Yannick
05:39
created
live-geojson.php 1 patch
Braces   +133 added lines, -51 removed lines patch added patch discarded remove patch
@@ -18,22 +18,43 @@  discard block
 block discarded – undo
18 18
 }
19 19
 header('Content-Type: text/javascript');
20 20
 
21
-if (!isset($globalJsonCompress)) $compress = true;
22
-else $compress = $globalJsonCompress;
21
+if (!isset($globalJsonCompress)) {
22
+	$compress = true;
23
+} else {
24
+	$compress = $globalJsonCompress;
25
+}
23 26
 
24 27
 $from_archive = false;
25 28
 $min = false;
26 29
 $allhistory = false;
27 30
 $filter['source'] = array();
28
-if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') $filter['source'] = array_merge($filter['source'],array('vatsimtxt'));
29
-if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') $filter['source'] = array_merge($filter['source'],array('whazzup'));
30
-if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') $filter['source'] = array_merge($filter['source'],array('phpvmacars'));
31
-if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') $filter['source'] = array_merge($filter['source'],array('sbs'));
32
-if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') $filter['source'] = array_merge($filter['source'],array('aprs'));
33
-if (isset($_COOKIE['filter_ident']) && $_COOKIE['filter_ident'] != '') $filter['ident'] = filter_var($_COOKIE['filter_ident'],FILTER_SANITIZE_STRING);
34
-if (isset($_COOKIE['filter_Airlines']) && $_COOKIE['filter_Airlines'] != '') $filter['airlines'] = filter_var_array(explode(',',$_COOKIE['filter_Airlines']),FILTER_SANITIZE_STRING);
35
-if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') $filter['source_aprs'] = filter_var_array(explode(',',$_COOKIE['filter_Sources']),FILTER_SANITIZE_STRING);
36
-if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') $filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'],FILTER_SANITIZE_STRING);
31
+if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') {
32
+	$filter['source'] = array_merge($filter['source'],array('vatsimtxt'));
33
+}
34
+if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') {
35
+	$filter['source'] = array_merge($filter['source'],array('whazzup'));
36
+}
37
+if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') {
38
+	$filter['source'] = array_merge($filter['source'],array('phpvmacars'));
39
+}
40
+if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') {
41
+	$filter['source'] = array_merge($filter['source'],array('sbs'));
42
+}
43
+if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') {
44
+	$filter['source'] = array_merge($filter['source'],array('aprs'));
45
+}
46
+if (isset($_COOKIE['filter_ident']) && $_COOKIE['filter_ident'] != '') {
47
+	$filter['ident'] = filter_var($_COOKIE['filter_ident'],FILTER_SANITIZE_STRING);
48
+}
49
+if (isset($_COOKIE['filter_Airlines']) && $_COOKIE['filter_Airlines'] != '') {
50
+	$filter['airlines'] = filter_var_array(explode(',',$_COOKIE['filter_Airlines']),FILTER_SANITIZE_STRING);
51
+}
52
+if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') {
53
+	$filter['source_aprs'] = filter_var_array(explode(',',$_COOKIE['filter_Sources']),FILTER_SANITIZE_STRING);
54
+}
55
+if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') {
56
+	$filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'],FILTER_SANITIZE_STRING);
57
+}
37 58
 
38 59
 if (isset($globalMapPopup) && !$globalMapPopup && !(isset($_COOKIE['flightpopup']) && $_COOKIE['flightpopup'] == 'true')) {
39 60
 	$min = true;
@@ -84,8 +105,12 @@  discard block
 block discarded – undo
84 105
 	} else {
85 106
 		$flightcnt = $SpotterLive->getLiveSpotterCount($filter);
86 107
 	}
87
-	if ($flightcnt == '') $flightcnt = 0;
88
-} else $flightcnt = 0;
108
+	if ($flightcnt == '') {
109
+		$flightcnt = 0;
110
+	}
111
+	} else {
112
+	$flightcnt = 0;
113
+}
89 114
 
90 115
 $sqltime = round(microtime(true)-$begintime,2);
91 116
 
@@ -94,8 +119,11 @@  discard block
 block discarded – undo
94 119
 
95 120
 $output = '{';
96 121
 	$output .= '"type": "FeatureCollection",';
97
-		if ($min) $output .= '"minimal": "true",';
98
-		else $output .= '"minimal": "false",';
122
+		if ($min) {
123
+			$output .= '"minimal": "true",';
124
+		} else {
125
+			$output .= '"minimal": "false",';
126
+		}
99 127
 		$output .= '"fc": "'.$flightcnt.'",';
100 128
 		$output .= '"sqt": "'.$sqltime.'",';
101 129
 
@@ -132,11 +160,16 @@  discard block
 block discarded – undo
132 160
 						//$output .= '"sqt": "'.$sqltime.'",';
133 161
 						$output .= '"id": "'.$spotter_item['flightaware_id'].'",';
134 162
 						$output .= '"properties": {';
135
-							if ($compress) $output .= '"fi": "'.$spotter_item['flightaware_id'].'",';
136
-							else $output .= '"flightaware_id": "'.$spotter_item['flightaware_id'].'",';
163
+							if ($compress) {
164
+								$output .= '"fi": "'.$spotter_item['flightaware_id'].'",';
165
+							} else {
166
+								$output .= '"flightaware_id": "'.$spotter_item['flightaware_id'].'",';
167
+							}
137 168
 							$output .= '"fc": "'.$flightcnt.'",';
138 169
 							$output .= '"sqt": "'.$sqltime.'",';
139
-							if (isset($begindate)) $output .= '"archive_date": "'.$begindate.'",';
170
+							if (isset($begindate)) {
171
+								$output .= '"archive_date": "'.$begindate.'",';
172
+							}
140 173
 
141 174
 /*
142 175
 							if ($min) $output .= '"minimal": "true",';
@@ -144,13 +177,21 @@  discard block
 block discarded – undo
144 177
 */
145 178
 							//$output .= '"fc": "'.$spotter_item['nb'].'",';
146 179
 						if (isset($spotter_item['ident']) && $spotter_item['ident'] != '') {
147
-							if ($compress) $output .= '"c": "'.$spotter_item['ident'].'",';
148
-							else $output .= '"callsign": "'.$spotter_item['ident'].'",';
180
+							if ($compress) {
181
+								$output .= '"c": "'.$spotter_item['ident'].'",';
182
+							} else {
183
+								$output .= '"callsign": "'.$spotter_item['ident'].'",';
184
+							}
149 185
 						} else {
150
-							if ($compress) $output .= '"c": "NA",';
151
-							else $output .= '"callsign": "NA",';
186
+							if ($compress) {
187
+								$output .= '"c": "NA",';
188
+							} else {
189
+								$output .= '"callsign": "NA",';
190
+							}
191
+						}
192
+						if (isset($spotter_item['registration'])) {
193
+							$output .= '"registration": "'.$spotter_item['registration'].'",';
152 194
 						}
153
-						if (isset($spotter_item['registration'])) $output .= '"registration": "'.$spotter_item['registration'].'",';
154 195
 						if (isset($spotter_item['aircraft_name']) && isset($spotter_item['aircraft_type'])) {
155 196
 							$output .= '"aircraft_name": "'.$spotter_item['aircraft_name'].' ('.$spotter_item['aircraft_type'].')",';
156 197
 							$output .= '"aircraft_wiki": "http://'.strtolower($globalLanguage).'.wikipedia.org/wiki/'.urlencode(str_replace(' ','_',$spotter_item['aircraft_name'])).'",';
@@ -163,20 +204,31 @@  discard block
 block discarded – undo
163 204
 							$output .= '"aircraft_icao": "'.$spotter_item['aircraft_icao'].'",';
164 205
 						}
165 206
 						if (!isset($spotter_item['aircraft_shadow'])) {
166
-							if (!isset($spotter_item['aircraft_icao']) || $spotter_item['aircraft_icao'] == '') $spotter_item['aircraft_shadow'] = '';
167
-							else {
207
+							if (!isset($spotter_item['aircraft_icao']) || $spotter_item['aircraft_icao'] == '') {
208
+								$spotter_item['aircraft_shadow'] = '';
209
+							} else {
168 210
 								$aircraft_info = $Spotter->getAllAircraftInfo($spotter_item['aircraft_icao']);
169
-								if (count($aircraft_info) > 0) $spotter_item['aircraft_shadow'] = $aircraft_info[0]['aircraft_shadow'];
170
-								elseif (isset($spotter_item['format_source']) && $spotter_item['format_source'] == 'aprs') $spotter_item['aircraft_shadow'] = 'PA18.png';
171
-								else $spotter_item['aircraft_shadow'] = '';
211
+								if (count($aircraft_info) > 0) {
212
+									$spotter_item['aircraft_shadow'] = $aircraft_info[0]['aircraft_shadow'];
213
+								} elseif (isset($spotter_item['format_source']) && $spotter_item['format_source'] == 'aprs') {
214
+									$spotter_item['aircraft_shadow'] = 'PA18.png';
215
+								} else {
216
+									$spotter_item['aircraft_shadow'] = '';
217
+								}
172 218
 							}
173 219
 						}
174 220
 						if ($spotter_item['aircraft_shadow'] == '') {
175
-							if ($compress) $output .= '"as": "default.png",';
176
-							else $output .= '"aircraft_shadow": "default.png",';
221
+							if ($compress) {
222
+								$output .= '"as": "default.png",';
223
+							} else {
224
+								$output .= '"aircraft_shadow": "default.png",';
225
+							}
177 226
 						} else {
178
-							if ($compress) $output .= '"as": "'.$spotter_item['aircraft_shadow'].'",';
179
-							else $output .= '"aircraft_shadow": "'.$spotter_item['aircraft_shadow'].'",';
227
+							if ($compress) {
228
+								$output .= '"as": "'.$spotter_item['aircraft_shadow'].'",';
229
+							} else {
230
+								$output .= '"aircraft_shadow": "'.$spotter_item['aircraft_shadow'].'",';
231
+							}
180 232
 						}
181 233
 						if (isset($spotter_item['airline_name'])) {
182 234
 							$output .= '"airline_name": "'.$spotter_item['airline_name'].'",';
@@ -184,8 +236,11 @@  discard block
 block discarded – undo
184 236
 							$output .= '"airline_name": "NA",';
185 237
 						}
186 238
 						if (isset($spotter_item['departure_airport'])) {
187
-							if ($compress) $output .= '"dac": "'.$spotter_item['departure_airport'].'",';
188
-							else $output .= '"departure_airport_code": "'.$spotter_item['departure_airport'].'",';
239
+							if ($compress) {
240
+								$output .= '"dac": "'.$spotter_item['departure_airport'].'",';
241
+							} else {
242
+								$output .= '"departure_airport_code": "'.$spotter_item['departure_airport'].'",';
243
+							}
189 244
 						}
190 245
 						if (isset($spotter_item['departure_airport_city'])) {
191 246
 							$output .= '"departure_airport": "'.$spotter_item['departure_airport_city'].', '.$spotter_item['departure_airport_country'].'",';
@@ -197,8 +252,11 @@  discard block
 block discarded – undo
197 252
 							$output .= '"arrival_airport_time": "'.$spotter_item['arrival_airport_time'].'",';
198 253
 						}
199 254
 						if (isset($spotter_item['arrival_airport'])) {
200
-							if ($compress) $output .= '"aac": "'.$spotter_item['arrival_airport'].'",';
201
-							else $output .= '"arrival_airport_code": "'.$spotter_item['arrival_airport'].'",';
255
+							if ($compress) {
256
+								$output .= '"aac": "'.$spotter_item['arrival_airport'].'",';
257
+							} else {
258
+								$output .= '"arrival_airport_code": "'.$spotter_item['arrival_airport'].'",';
259
+							}
202 260
 						}
203 261
 						if (isset($spotter_item['arrival_airport_city'])) {
204 262
 							$output .= '"arrival_airport": "'.$spotter_item['arrival_airport_city'].', '.$spotter_item['arrival_airport_country'].'",';
@@ -216,19 +274,30 @@  discard block
 block discarded – undo
216 274
 							$output .= '"ground_speed": "'.$spotter_item['ground_speed'].'",';
217 275
 						}
218 276
 						
219
-						if ($compress) $output .= '"a": "'.$spotter_item['altitude'].'",';
220
-						else $output .= '"altitude": "'.$spotter_item['altitude'].'",';
221
-						if ($compress)$output .= '"h": "'.$spotter_item['heading'].'",';
222
-						else $output .= '"heading": "'.$spotter_item['heading'].'",';
277
+						if ($compress) {
278
+							$output .= '"a": "'.$spotter_item['altitude'].'",';
279
+						} else {
280
+							$output .= '"altitude": "'.$spotter_item['altitude'].'",';
281
+						}
282
+						if ($compress) {
283
+							$output .= '"h": "'.$spotter_item['heading'].'",';
284
+						} else {
285
+							$output .= '"heading": "'.$spotter_item['heading'].'",';
286
+						}
223 287
 						
224
-						if (isset($archivespeed)) $nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$spotter_item['heading'],$archivespeed);
225
-						else $nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$spotter_item['heading']);
288
+						if (isset($archivespeed)) {
289
+							$nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$spotter_item['heading'],$archivespeed);
290
+						} else {
291
+							$nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$spotter_item['heading']);
292
+						}
226 293
 						//$output .= '"nextlatitude": "'.$nextcoord['latitude'].'",';
227 294
 						//$output .= '"nextlongitude": "'.$nextcoord['longitude'].'",';
228 295
 						$output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],';
229 296
 						//$output .= '"nextlatlon": ['.$nextcoord['longitude'].','.$nextcoord['latitude'].'],';
230 297
 
231
-						if (!$min) $output .= '"image": "'.$image.'",';
298
+						if (!$min) {
299
+							$output .= '"image": "'.$image.'",';
300
+						}
232 301
 						if (isset($spotter_item['image_copyright']) && $spotter_item['image_copyright'] != '') {
233 302
 							$output .= '"image_copyright": "'.str_replace('"',"'",trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'',$spotter_item['image_copyright']))).'",';
234 303
 						}
@@ -236,8 +305,11 @@  discard block
 block discarded – undo
236 305
 							$output .= '"image_source_website": "'.urlencode($spotter_item['image_source_website']).'",';
237 306
 						}
238 307
 						if (isset($spotter_item['squawk'])) {
239
-							if ($compress) $output .= '"sq": "'.$spotter_item['squawk'].'",';
240
-							else $output .= '"squawk": "'.$spotter_item['squawk'].'",';
308
+							if ($compress) {
309
+								$output .= '"sq": "'.$spotter_item['squawk'].'",';
310
+							} else {
311
+								$output .= '"squawk": "'.$spotter_item['squawk'].'",';
312
+							}
241 313
 						}
242 314
 						if (isset($spotter_item['squawk_usage'])) {
243 315
 							$output .= '"squawk_usage": "'.$spotter_item['squawk_usage'].'",';
@@ -255,8 +327,11 @@  discard block
 block discarded – undo
255 327
 							$output .= '"acars": "'.trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"), '<br />',$spotter_item['acars']['message'])).'",';
256 328
 						}
257 329
 						// type when not aircraft ?
258
-						if ($compress) $output .= '"t": "aircraft"';
259
-						else $output .= '"type": "aircraft"';
330
+						if ($compress) {
331
+							$output .= '"t": "aircraft"';
332
+						} else {
333
+							$output .= '"type": "aircraft"';
334
+						}
260 335
 						$output .= '},';
261 336
 						$output .= '"geometry": {';
262 337
 							$output .= '"type": "Point",';
@@ -325,7 +400,9 @@  discard block
 block discarded – undo
325 400
 				//if ((isset($_COOKIE['flightpath']) && $_COOKIE['flightpath'] == 'true') || (!isset($_COOKIE['flightpath']) && (!isset($globalMapHistory) || $globalMapHistory || $allhistory) || (isset($_GET['history']) && $_GET['history'] != '' && $_GET['history'] != 'NA' && ($_GET['history'] == $spotter_item['ident'] || $_GET['history'] == $spotter_item['flightaware_id'])))) {
326 401
 				//if ((isset($_COOKIE['flightpath']) && $_COOKIE['flightpath'] == 'true') || (!isset($_COOKIE['flightpath']) && (!isset($globalMapHistory) || $globalMapHistory || $allhistory) || (isset($_GET['history']) && $_GET['history'] != '' && $_GET['history'] != 'NA' && ($_GET['history'] == $spotter_item['ident'] || $_GET['history'] == $spotter_item['flightaware_id']))) || (isset($_GET['history']) && $_GET['history'] == '' && isset($_GET['flightaware_id']) && $_GET['flightaware_id'] == $spotter_item['flightaware_id'])) {
327 402
 				$history = filter_input(INPUT_GET,'history',FILTER_SANITIZE_STRING);
328
-				if ($history == '' && isset($_COOKIE['history'])) $history = $_COOKIE['history'];
403
+				if ($history == '' && isset($_COOKIE['history'])) {
404
+					$history = $_COOKIE['history'];
405
+				}
329 406
 				if ((isset($_COOKIE['flightpath']) && $_COOKIE['flightpath'] == 'true') || (!isset($_COOKIE['flightpath']) && (!isset($globalMapHistory) || $globalMapHistory || $allhistory) 
330 407
 				|| (isset($history) && $history != '' && $history != 'NA' && ($history == $spotter_item['ident'] || $history == $spotter_item['flightaware_id']))) 
331 408
 				|| (isset($history) && $history == '' && isset($_GET['flightaware_id']) && $_GET['flightaware_id'] == $spotter_item['flightaware_id'])) {
@@ -350,8 +427,11 @@  discard block
 block discarded – undo
350 427
 						$output_history .= ']}},';
351 428
 						$output .= $output_history;
352 429
 					    }
353
-					    if ($compress) $output_history = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "history","a": "'.$alt.'"},"geometry": {"type": "LineString","coordinates": [';
354
-					    else $output_history = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "history","altitude": "'.$alt.'"},"geometry": {"type": "LineString","coordinates": [';
430
+					    if ($compress) {
431
+					    	$output_history = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "history","a": "'.$alt.'"},"geometry": {"type": "LineString","coordinates": [';
432
+					    } else {
433
+					    	$output_history = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "history","altitude": "'.$alt.'"},"geometry": {"type": "LineString","coordinates": [';
434
+					    }
355 435
 					}
356 436
 					$output_history .= '[';
357 437
 					$output_history .=  $spotter_history['longitude'].', ';
@@ -401,7 +481,9 @@  discard block
 block discarded – undo
401 481
 			$output .= ']';
402 482
 			$output .= ',"initial_sqltime": "'.$sqltime.'",';
403 483
 			$output .= '"totaltime": "'.round(microtime(true)-$begintime,2).'",';
404
-			if (isset($begindate)) $output .= '"archive_date": "'.$begindate.'",';
484
+			if (isset($begindate)) {
485
+				$output .= '"archive_date": "'.$begindate.'",';
486
+			}
405 487
 			$output .= '"fc": "'.$j.'"';
406 488
 		} else {
407 489
 			$output .= '"features": ';
Please login to merge, or discard this patch.
airline.php 1 patch
Braces   +18 added lines, -6 removed lines patch added patch discarded remove patch
@@ -24,13 +24,21 @@  discard block
 block discarded – undo
24 24
 
25 25
 	print '<div class="select-item"><form action="'.$globalURL.'/airline" method="post"><select name="airline_type" class="selectpicker" data-live-search="true">';
26 26
 	print '<option value="all"';
27
-	if ($airline_type == 'all') print 'selected="selected" ';
27
+	if ($airline_type == 'all') {
28
+		print 'selected="selected" ';
29
+	}
28 30
 	print '>'._("All").'</option><option value="passenger"';
29
-	if ($airline_type == 'passenger') print 'selected="selected" ';
31
+	if ($airline_type == 'passenger') {
32
+		print 'selected="selected" ';
33
+	}
30 34
 	print '>'._("Passenger").'</option><option value="cargo"';
31
-	if ($airline_type == 'cargo') print 'selected="selected" ';
35
+	if ($airline_type == 'cargo') {
36
+		print 'selected="selected" ';
37
+	}
32 38
 	print '>'._("Cargo").'</option><option value="military"';
33
-	if ($airline_type == 'military') print 'selected="selected" ';
39
+	if ($airline_type == 'military') {
40
+		print 'selected="selected" ';
41
+	}
34 42
 	print '>'._("Military").'</option></select>';
35 43
 	print '<button type="submit"><i class="fa fa-angle-double-right"></i></button></form></div>';
36 44
 
@@ -57,7 +65,9 @@  discard block
 block discarded – undo
57 65
 		$firstLetter = mb_strtoupper(mb_substr($value['airline_name'], 0, 1),'UTF-8');
58 66
 		if($previous !== $firstLetter)
59 67
 		{
60
-			if ($previous !== null) print ' | ';
68
+			if ($previous !== null) {
69
+				print ' | ';
70
+			}
61 71
 			print '<a href="#'.$firstLetter.'">'.$firstLetter.'</a>';
62 72
 		}
63 73
 		$previous = $firstLetter;
@@ -70,7 +80,9 @@  discard block
 block discarded – undo
70 80
 		{
71 81
 			if($previous !== $firstLetter)
72 82
 			{
73
-				if ($previous !== null) print '</div>';
83
+				if ($previous !== null) {
84
+					print '</div>';
85
+				}
74 86
 				print '<a name="'.$firstLetter.'"></a><h4 class="alphabet-header">'.$firstLetter.'</h4><div class="alphabet">';
75 87
 			}
76 88
 			$previous = $firstLetter;
Please login to merge, or discard this patch.
search.php 1 patch
Braces   +116 added lines, -32 removed lines patch added patch discarded remove patch
@@ -26,8 +26,12 @@  discard block
 block discarded – undo
26 26
 	} else if($_GET['start_date'] == "" && $_GET['end_date'] != ""){
27 27
 		$end_date = date("Y-m-d H:i:s", strtotime("2014-04-12")).",".$_GET['end_date']." 00:00:00";
28 28
 		$sql_date = $end_date;
29
-	} else $sql_date = '';
30
-} else $sql_date = '';
29
+	} else {
30
+		$sql_date = '';
31
+	}
32
+	} else {
33
+	$sql_date = '';
34
+}
31 35
 
32 36
 if (isset($_GET['highest_altitude'])) {
33 37
 	//for altitude manipulation
@@ -41,8 +45,12 @@  discard block
 block discarded – undo
41 45
 	} else if($_GET['highest_altitude'] == "" && $_GET['lowest_altitude'] != ""){
42 46
 		$start_altitude = $_GET['lowest_altitude'].",60000";
43 47
 		$sql_altitude = $start_altitude;
44
-	} else $sql_altitude = '';
45
-} else $sql_altitude = '';
48
+	} else {
49
+		$sql_altitude = '';
50
+	}
51
+	} else {
52
+	$sql_altitude = '';
53
+}
46 54
 
47 55
 //calculuation for the pagination
48 56
 if(!isset($_GET['limit']))
@@ -60,7 +68,7 @@  discard block
 block discarded – undo
60 68
 		$limit_end = $_GET['number_results'];
61 69
 		$absolute_difference = $_GET['number_results'];
62 70
 	}
63
-}  else {
71
+} else {
64 72
 	$limit_explode = explode(",", $_GET['limit']);
65 73
 	$limit_start = $limit_explode[0];
66 74
 	$limit_end = $limit_explode[1];
@@ -93,10 +101,15 @@  discard block
 block discarded – undo
93 101
 	$origlon = filter_input(INPUT_GET,'origlon',FILTER_SANITIZE_STRING);
94 102
 	$dist = filter_input(INPUT_GET,'dist',FILTER_SANITIZE_NUMBER_INT);
95 103
 	if ($dist != '') {
96
-		if (isset($globalDistanceUnit) && $globalDistanceUnit == 'mi') $dist = $dist*1.60934;
97
-		elseif (isset($globalDistanceUnit) && $globalDistanceUnit == 'nm') $dist = $dist*1.852;
104
+		if (isset($globalDistanceUnit) && $globalDistanceUnit == 'mi') {
105
+			$dist = $dist*1.60934;
106
+		} elseif (isset($globalDistanceUnit) && $globalDistanceUnit == 'nm') {
107
+			$dist = $dist*1.852;
108
+		}
109
+	}
110
+	if (!isset($sql_date)) {
111
+		$sql_date = '';
98 112
 	}
99
-	if (!isset($sql_date)) $sql_date = '';
100 113
 	if ($archive == 1) {
101 114
 		$SpotterArchive = new SpotterArchive();
102 115
 		$spotter_array = $SpotterArchive->searchSpotterData($q,$registration,$aircraft,strtolower(str_replace("-", " ", $manufacturer)),$highlights,$airline,$airline_country,$airline_type,$airport,$airport_country,$callsign,$departure_airport_route,$arrival_airport_route,$owner,$pilot_id,$pilot_name,$sql_altitude,$sql_date,$limit_start.",".$absolute_difference,$sort,'',$origlat,$origlon,$dist);
@@ -164,7 +177,10 @@  discard block
 block discarded – undo
164 177
 		if (isset($_GET['aircraft']) && $_GET['aircraft'] != ""){ print _("Aircraft:").' <span>'.$_GET['aircraft'].'</span> '; }
165 178
 		if (isset($_GET['manufacturer']) && $_GET['manufacturer'] != ""){ print _("Manufacturer:").' <span>'.$_GET['manufacturer'].'</span> '; }
166 179
 		if (isset($_GET['registration']) && $_GET['registration'] != ""){ print _("Registration:").' <span>'.$_GET['registration'].'</span> '; }
167
-		if (isset($_GET['highlights'])) if ($_GET['highlights'] == "true"){ print _("Highlights:").' <span>'.$_GET['highlights'].'</span> '; }
180
+		if (isset($_GET['highlights'])) {
181
+			if ($_GET['highlights'] == "true"){ print _("Highlights:").' <span>'.$_GET['highlights'].'</span> ';
182
+		}
183
+		}
168 184
 		if (isset($_GET['airline']) && $_GET['airline'] != ""){ print _("Airline:").' <span>'.$_GET['airline'].'</span> '; }
169 185
 		if (isset($_GET['airline_country']) && $_GET['airline_country'] != ""){ print _("Airline country:").' <span>'.$_GET['airline_country'].'</span> '; }
170 186
 		if (isset($_GET['airline_type']) && $_GET['airline_type'] != ""){ print _("Airline type:").' <span>'.$_GET['airline_type'].'</span> '; }
@@ -275,7 +291,10 @@  discard block
 block discarded – undo
275 291
 			<div class="form-group">
276 292
 				<label class="control-label col-sm-2"><?php echo _("Keywords"); ?></label>
277 293
 				<div class="col-sm-10">
278
-					<input type="text" class="form-control" id="q" name="q" value="<?php if (isset($_GET['q'])) print $_GET['q']; ?>" size="10" placeholder="<?php echo _("Keywords"); ?>" />
294
+					<input type="text" class="form-control" id="q" name="q" value="<?php if (isset($_GET['q'])) {
295
+	print $_GET['q'];
296
+}
297
+?>" size="10" placeholder="<?php echo _("Keywords"); ?>" />
279 298
 				</div>
280 299
 			</div>
281 300
 		</fieldset>
@@ -290,7 +309,10 @@  discard block
 block discarded – undo
290 309
 					    </select>
291 310
 					</div>
292 311
 				</div>
293
-				<script type="text/javascript">getSelect('manufacturer','<?php if(isset($_GET['manufacturer'])) print $_GET['manufacturer']; ?>')</script>
312
+				<script type="text/javascript">getSelect('manufacturer','<?php if(isset($_GET['manufacturer'])) {
313
+	print $_GET['manufacturer'];
314
+}
315
+?>')</script>
294 316
 				<div class="form-group">
295 317
 					<label class="control-label col-sm-2"><?php echo _("Type"); ?></label>
296 318
 						<div class="col-sm-10">
@@ -299,11 +321,17 @@  discard block
 block discarded – undo
299 321
 							</select>
300 322
 						</div>
301 323
 				</div>
302
-				<script type="text/javascript">getSelect('aircrafttypes','<?php if(isset($_GET['aircraft_icao'])) print $_GET['aircraft_icao']; ?>');</script>
324
+				<script type="text/javascript">getSelect('aircrafttypes','<?php if(isset($_GET['aircraft_icao'])) {
325
+	print $_GET['aircraft_icao'];
326
+}
327
+?>');</script>
303 328
 				<div class="form-group">
304 329
 					<label class="control-label col-sm-2"><?php echo _("Registration"); ?></label> 
305 330
 					<div class="col-sm-10">
306
-						<input type="text" class="form-control" name="registration" value="<?php if (isset($_GET['registration'])) print $_GET['registration']; ?>" size="8" />
331
+						<input type="text" class="form-control" name="registration" value="<?php if (isset($_GET['registration'])) {
332
+	print $_GET['registration'];
333
+}
334
+?>" size="8" />
307 335
 					</div>
308 336
 				</div>
309 337
 <?php
@@ -312,22 +340,31 @@  discard block
 block discarded – undo
312 340
 				<div class="form-group">
313 341
 					<label class="control-label col-sm-2"><?php echo _("Pilot id"); ?></label> 
314 342
 					<div class="col-sm-10">
315
-						<input type="text" class="form-control" name="pilot_id" value="<?php if (isset($_GET['pilot_id'])) print $_GET['pilot_id']; ?>" size="15" />
343
+						<input type="text" class="form-control" name="pilot_id" value="<?php if (isset($_GET['pilot_id'])) {
344
+	print $_GET['pilot_id'];
345
+}
346
+?>" size="15" />
316 347
 					</div>
317 348
 				</div>
318 349
 				<div class="form-group">
319 350
 					<label class="control-label col-sm-2"><?php echo _("Pilot name"); ?></label> 
320 351
 					<div class="col-sm-10">
321
-						<input type="text" class="form-control" name="pilot_name" value="<?php if (isset($_GET['pilot_name'])) print $_GET['pilot_name']; ?>" size="15" />
352
+						<input type="text" class="form-control" name="pilot_name" value="<?php if (isset($_GET['pilot_name'])) {
353
+	print $_GET['pilot_name'];
354
+}
355
+?>" size="15" />
322 356
 					</div>
323 357
 				</div>
324 358
 <?php
325
-}else {
359
+} else {
326 360
 ?>
327 361
 				<div class="form-group">
328 362
 					<label class="control-label col-sm-2"><?php echo _("Owner name"); ?></label> 
329 363
 					<div class="col-sm-10">
330
-						<input type="text" class="form-control" name="owner" value="<?php if (isset($_GET['owner'])) print $_GET['owner']; ?>" size="15" />
364
+						<input type="text" class="form-control" name="owner" value="<?php if (isset($_GET['owner'])) {
365
+	print $_GET['owner'];
366
+}
367
+?>" size="15" />
331 368
 					</div>
332 369
 				</div>
333 370
 <?php
@@ -335,8 +372,14 @@  discard block
 block discarded – undo
335 372
 ?>
336 373
 				<div class="form-group">
337 374
 					<div class="col-sm-offset-2 col-sm-10">
338
-					<!--<div><input type="checkbox" class="form-control" name="highlights" value="true" id="highlights" <?php if (isset($_GET['highlights'])) if ($_GET['highlights'] == "true"){ print 'checked="checked"'; } ?>> <label for="highlights"><?php echo _("Include only aircrafts with special highlights (unique liveries, destinations etc.)"); ?></label></div>-->
339
-					<label class="checkbox-inline"><input type="checkbox" name="highlights" value="true" id="highlights" <?php if (isset($_GET['highlights'])) if ($_GET['highlights'] == "true"){ print 'checked="checked"'; } ?>> <?php echo _("Include only aircrafts with special highlights (unique liveries, destinations etc.)"); ?></label>
375
+					<!--<div><input type="checkbox" class="form-control" name="highlights" value="true" id="highlights" <?php if (isset($_GET['highlights'])) {
376
+	if ($_GET['highlights'] == "true"){ print 'checked="checked"';
377
+}
378
+} ?>> <label for="highlights"><?php echo _("Include only aircrafts with special highlights (unique liveries, destinations etc.)"); ?></label></div>-->
379
+					<label class="checkbox-inline"><input type="checkbox" name="highlights" value="true" id="highlights" <?php if (isset($_GET['highlights'])) {
380
+	if ($_GET['highlights'] == "true"){ print 'checked="checked"';
381
+}
382
+} ?>> <?php echo _("Include only aircrafts with special highlights (unique liveries, destinations etc.)"); ?></label>
340 383
 					</div>
341 384
 				</div>
342 385
 			</fieldset>
@@ -350,7 +393,10 @@  discard block
 block discarded – undo
350 393
 						</select>
351 394
 					</div>
352 395
 				</div>
353
-				<script type="text/javascript">getSelect('airlinenames','<?php if(isset($_GET['airline'])) print $_GET['airline']; ?>');</script>
396
+				<script type="text/javascript">getSelect('airlinenames','<?php if(isset($_GET['airline'])) {
397
+	print $_GET['airline'];
398
+}
399
+?>');</script>
354 400
 				<div class="form-group">
355 401
 					<label class="control-label col-sm-2"><?php echo _("Country"); ?></label> 
356 402
 					<div class="col-sm-10">
@@ -359,19 +405,34 @@  discard block
 block discarded – undo
359 405
 						</select>
360 406
 					</div>
361 407
 				</div>
362
-				<script type="text/javascript">getSelect('airlinecountries','<?php if(isset($_GET['airline_country'])) print $_GET['airline_country']; ?>');</script>
408
+				<script type="text/javascript">getSelect('airlinecountries','<?php if(isset($_GET['airline_country'])) {
409
+	print $_GET['airline_country'];
410
+}
411
+?>');</script>
363 412
 				<div class="form-group">
364 413
 					<label class="control-label col-sm-2"><?php echo _("Callsign"); ?></label> 
365 414
 					<div class="col-sm-10">
366
-						<input type="text" name="callsign" class="form-control" value="<?php if (isset($_GET['callsign'])) print $_GET['callsign']; ?>" size="8" />
415
+						<input type="text" name="callsign" class="form-control" value="<?php if (isset($_GET['callsign'])) {
416
+	print $_GET['callsign'];
417
+}
418
+?>" size="8" />
367 419
 					</div>
368 420
 				</div>
369 421
 				<div class="form-group">
370 422
 					<div class="col-sm-offset-2 col-sm-10">
371 423
 						<label class="radio-inline"><input type="radio" name="airline_type" value="all" id="airline_type_all" <?php if (!isset($_GET['airline_type']) || $_GET['airline_type'] == "all"){ print 'checked="checked"'; } ?>> <?php echo _("All airlines types"); ?></label>
372
-						<label class="radio-inline"><input type="radio" name="airline_type" value="passenger" id="airline_type_passenger" <?php if (isset($_GET['airline_type'])) if ($_GET['airline_type'] == "passenger"){ print 'checked="checked"'; } ?>> <?php echo _("Only Passenger airlines"); ?></label>
373
-						<label class="radio-inline"><input type="radio" name="airline_type" value="cargo" id="airline_type_cargo" <?php if (isset($_GET['airline_type'])) if ( $_GET['airline_type'] == "cargo"){ print 'checked="checked"'; } ?>> <?php echo _("Only Cargo airlines"); ?></label>
374
-						<label class="radio-inline"><input type="radio" name="airline_type" value="military" id="airline_type_military" <?php if (isset($_GET['airline_type'])) if ( $_GET['airline_type'] == "military"){ print 'checked="checked"'; } ?>> <?php echo _("Only Military airlines"); ?></label>
424
+						<label class="radio-inline"><input type="radio" name="airline_type" value="passenger" id="airline_type_passenger" <?php if (isset($_GET['airline_type'])) {
425
+	if ($_GET['airline_type'] == "passenger"){ print 'checked="checked"';
426
+}
427
+} ?>> <?php echo _("Only Passenger airlines"); ?></label>
428
+						<label class="radio-inline"><input type="radio" name="airline_type" value="cargo" id="airline_type_cargo" <?php if (isset($_GET['airline_type'])) {
429
+	if ( $_GET['airline_type'] == "cargo"){ print 'checked="checked"';
430
+}
431
+} ?>> <?php echo _("Only Cargo airlines"); ?></label>
432
+						<label class="radio-inline"><input type="radio" name="airline_type" value="military" id="airline_type_military" <?php if (isset($_GET['airline_type'])) {
433
+	if ( $_GET['airline_type'] == "military"){ print 'checked="checked"';
434
+}
435
+} ?>> <?php echo _("Only Military airlines"); ?></label>
375 436
 					</div>
376 437
 				</div>
377 438
 			</fieldset>
@@ -385,7 +446,10 @@  discard block
 block discarded – undo
385 446
 						</select>
386 447
 					</div>
387 448
 				</div>
388
-				<script type="text/javascript">getSelect('airportnames','<?php if(isset($_GET['airport_icao'])) print $_GET['airport_icao']; ?>');</script>
449
+				<script type="text/javascript">getSelect('airportnames','<?php if(isset($_GET['airport_icao'])) {
450
+	print $_GET['airport_icao'];
451
+}
452
+?>');</script>
389 453
 				<div class="form-group">
390 454
 					<label class="control-label col-sm-2"><?php echo _("Country"); ?></label> 
391 455
 					<div class="col-sm-10">
@@ -394,7 +458,10 @@  discard block
 block discarded – undo
394 458
 						</select>
395 459
 					</div>
396 460
 				</div>
397
-				<script type="text/javascript">getSelect('airportcountries','<?php if(isset($_GET['airport_country'])) print $_GET['airport_country']; ?>');</script>
461
+				<script type="text/javascript">getSelect('airportcountries','<?php if(isset($_GET['airport_country'])) {
462
+	print $_GET['airport_country'];
463
+}
464
+?>');</script>
398 465
 			</fieldset>
399 466
 			<fieldset>
400 467
 				<legend><?php echo _("Route"); ?></legend>
@@ -406,7 +473,10 @@  discard block
 block discarded – undo
406 473
 						</select>
407 474
 					</div>
408 475
 				</div>
409
-				<script type="text/javascript">getSelect('departureairportnames','<?php if(isset($_GET['departure_airport_route'])) print $_GET['departure_airport_route']; ?>');</script>
476
+				<script type="text/javascript">getSelect('departureairportnames','<?php if(isset($_GET['departure_airport_route'])) {
477
+	print $_GET['departure_airport_route'];
478
+}
479
+?>');</script>
410 480
 				<div class="form-group">
411 481
 					<label class="control-label col-sm-2"><?php echo _("Arrival Airport"); ?></label> 
412 482
 					<div class="col-sm-10">
@@ -415,7 +485,10 @@  discard block
 block discarded – undo
415 485
 						</select>
416 486
 					</div>
417 487
 				</div>
418
-				<script type="text/javascript">getSelect('arrivalairportnames','<?php if(isset($_GET['arrival_airport_route'])) print $_GET['arrival_airport_route']; ?>');</script>
488
+				<script type="text/javascript">getSelect('arrivalairportnames','<?php if(isset($_GET['arrival_airport_route'])) {
489
+	print $_GET['arrival_airport_route'];
490
+}
491
+?>');</script>
419 492
 			</fieldset>
420 493
 			<fieldset>
421 494
 				<legend><?php echo _("Date"); ?></legend>
@@ -423,7 +496,10 @@  discard block
 block discarded – undo
423 496
 					<label class="control-label col-sm-2"><?php echo _("Start Date"); ?></label>
424 497
 					<div class="col-sm-10">
425 498
 						<div class='input-group date' id='datetimepicker1'>
426
-							<input type='text' name="start_date" class="form-control" value="<?php if (isset($_GET['start_date'])) print $_GET['start_date']; ?>" placeholder="<?php echo _("Start Date/Time"); ?>" />
499
+							<input type='text' name="start_date" class="form-control" value="<?php if (isset($_GET['start_date'])) {
500
+	print $_GET['start_date'];
501
+}
502
+?>" placeholder="<?php echo _("Start Date/Time"); ?>" />
427 503
 							<span class="input-group-addon">
428 504
 								<span class="glyphicon glyphicon-calendar"></span>
429 505
 							</span>
@@ -434,7 +510,10 @@  discard block
 block discarded – undo
434 510
 					<label class="control-label col-sm-2"><?php echo _("End Date"); ?></label>
435 511
 					<div class="col-sm-10">
436 512
 						<div class='input-group date' id='datetimepicker2'>
437
-						<input type='text' name="end_date" class="form-control" value="<?php if (isset($_GET['end_date'])) print $_GET['end_date']; ?>" placeholder="<?php echo _("End Date/Time"); ?>" />
513
+						<input type='text' name="end_date" class="form-control" value="<?php if (isset($_GET['end_date'])) {
514
+	print $_GET['end_date'];
515
+}
516
+?>" placeholder="<?php echo _("End Date/Time"); ?>" />
438 517
 						<span class="input-group-addon">
439 518
 							<span class="glyphicon glyphicon-calendar"></span>
440 519
 						</span>
@@ -517,7 +596,12 @@  discard block
 block discarded – undo
517 596
 				</div>
518 597
 			</div>
519 598
 			<div class="form-group">
520
-				<label class="control-label col-sm-2"><?php echo _("Distance").' ('; if (isset($globalDistanceUnit)) print $globalDistanceUnit; else print 'km'; print ')'; ?></label>
599
+				<label class="control-label col-sm-2"><?php echo _("Distance").' ('; if (isset($globalDistanceUnit)) {
600
+	print $globalDistanceUnit;
601
+} else {
602
+	print 'km';
603
+}
604
+print ')'; ?></label>
521 605
 				<div class="col-sm-10">
522 606
 					<input type="text" name="dist" class="form-control" placeholder="<?php echo _("Distance from center point"); ?>" />
523 607
 				</div>
Please login to merge, or discard this patch.
scripts/daemon-spotter.php 1 patch
Braces   +535 added lines, -183 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();
@@ -54,13 +56,22 @@  discard block
 block discarded – undo
54 56
     $globalSources = array();
55 57
     $globalSources[] = array('host' => $options['source']);
56 58
 }
57
-if (isset($options['server'])) $globalServer = TRUE;
58
-if (isset($options['idsource'])) $id_source = $options['idsource'];
59
-else $id_source = 1;
59
+if (isset($options['server'])) {
60
+	$globalServer = TRUE;
61
+}
62
+if (isset($options['idsource'])) {
63
+	$id_source = $options['idsource'];
64
+} else {
65
+	$id_source = 1;
66
+}
60 67
 if (isset($globalServer) && $globalServer) {
61
-    if ($globalDebug) echo "Using Server Mode\n";
68
+    if ($globalDebug) {
69
+    	echo "Using Server Mode\n";
70
+    }
62 71
     $SI=new SpotterServer();
63
-} else $SI=new SpotterImport($Connection->db);
72
+} else {
73
+	$SI=new SpotterImport($Connection->db);
74
+}
64 75
 //$APRS=new APRS($Connection->db);
65 76
 $SBS=new SBS();
66 77
 $ACARS=new ACARS($Connection->db);
@@ -78,7 +89,9 @@  discard block
 block discarded – undo
78 89
 }
79 90
 
80 91
 // let's try and connect
81
-if ($globalDebug) echo "Connecting...\n";
92
+if ($globalDebug) {
93
+	echo "Connecting...\n";
94
+}
82 95
 $use_aprs = false;
83 96
 $aprs_full = false;
84 97
 
@@ -86,7 +99,9 @@  discard block
 block discarded – undo
86 99
     $ip = gethostbyname($host);
87 100
     $s = socket_create(AF_INET, SOCK_STREAM, 0);
88 101
     $r = @socket_connect($s, $ip, $port);
89
-    if (!socket_set_nonblock($s)) echo "Unable to set nonblock on socket\n";
102
+    if (!socket_set_nonblock($s)) {
103
+    	echo "Unable to set nonblock on socket\n";
104
+    }
90 105
     if ($r || socket_last_error() == 114 || socket_last_error() == 115) {
91 106
         return $s;
92 107
     }
@@ -113,7 +128,9 @@  discard block
 block discarded – undo
113 128
 function connect_all($hosts) {
114 129
     //global $sockets, $formats, $globalDebug,$aprs_connect,$last_exec, $globalSourcesRights, $use_aprs;
115 130
     global $sockets, $globalSources, $globalDebug,$aprs_connect,$last_exec, $globalSourcesRights, $use_aprs;
116
-    if ($globalDebug) echo 'Connect to all...'."\n";
131
+    if ($globalDebug) {
132
+    	echo 'Connect to all...'."\n";
133
+    }
117 134
     foreach ($hosts as $id => $value) {
118 135
 	$host = $value['host'];
119 136
 	$globalSources[$id]['last_exec'] = 0;
@@ -123,27 +140,37 @@  discard block
 block discarded – undo
123 140
         	//$formats[$id] = 'deltadbtxt';
124 141
         	$globalSources[$id]['format'] = 'deltadbtxt';
125 142
         	//$last_exec['deltadbtxt'] = 0;
126
-        	if ($globalDebug) echo "Connect to deltadb source (".$host.")...\n";
143
+        	if ($globalDebug) {
144
+        		echo "Connect to deltadb source (".$host.")...\n";
145
+        	}
127 146
             } else if (preg_match('/vatsim-data.txt$/i',$host)) {
128 147
         	//$formats[$id] = 'vatsimtxt';
129 148
         	$globalSources[$id]['format'] = 'vatsimtxt';
130 149
         	//$last_exec['vatsimtxt'] = 0;
131
-        	if ($globalDebug) echo "Connect to vatsim source (".$host.")...\n";
150
+        	if ($globalDebug) {
151
+        		echo "Connect to vatsim source (".$host.")...\n";
152
+        	}
132 153
     	    } else if (preg_match('/aircraftlist.json$/i',$host)) {
133 154
         	//$formats[$id] = 'aircraftlistjson';
134 155
         	$globalSources[$id]['format'] = 'aircraftlistjson';
135 156
         	//$last_exec['aircraftlistjson'] = 0;
136
-        	if ($globalDebug) echo "Connect to aircraftlist.json source (".$host.")...\n";
157
+        	if ($globalDebug) {
158
+        		echo "Connect to aircraftlist.json source (".$host.")...\n";
159
+        	}
137 160
     	    } else if (preg_match('/opensky/i',$host)) {
138 161
         	//$formats[$id] = 'aircraftlistjson';
139 162
         	$globalSources[$id]['format'] = 'opensky';
140 163
         	//$last_exec['aircraftlistjson'] = 0;
141
-        	if ($globalDebug) echo "Connect to opensky source (".$host.")...\n";
164
+        	if ($globalDebug) {
165
+        		echo "Connect to opensky source (".$host.")...\n";
166
+        	}
142 167
     	    } else if (preg_match('/radarvirtuel.com\/file.json$/i',$host)) {
143 168
         	//$formats[$id] = 'radarvirtueljson';
144 169
         	$globalSources[$id]['format'] = 'radarvirtueljson';
145 170
         	//$last_exec['radarvirtueljson'] = 0;
146
-        	if ($globalDebug) echo "Connect to radarvirtuel.com/file.json source (".$host.")...\n";
171
+        	if ($globalDebug) {
172
+        		echo "Connect to radarvirtuel.com/file.json source (".$host.")...\n";
173
+        	}
147 174
         	if (!isset($globalSourcesRights) || (isset($globalSourcesRights) && !$globalSourcesRights)) {
148 175
         	    echo '!!! You MUST set $globalSourcesRights = TRUE in settings.php if you have the right to use this feed !!!'."\n";
149 176
         	    exit(0);
@@ -152,7 +179,9 @@  discard block
 block discarded – undo
152 179
         	//$formats[$id] = 'planeupdatefaa';
153 180
         	$globalSources[$id]['format'] = 'planeupdatefaa';
154 181
         	//$last_exec['planeupdatefaa'] = 0;
155
-        	if ($globalDebug) echo "Connect to planeUpdateFAA.php source (".$host.")...\n";
182
+        	if ($globalDebug) {
183
+        		echo "Connect to planeUpdateFAA.php source (".$host.")...\n";
184
+        	}
156 185
         	if (!isset($globalSourcesRights) || (isset($globalSourcesRights) && !$globalSourcesRights)) {
157 186
         	    echo '!!! You MUST set $globalSourcesRights = TRUE in settings.php if you have the right to use this feed !!!'."\n";
158 187
         	    exit(0);
@@ -161,26 +190,36 @@  discard block
 block discarded – undo
161 190
         	//$formats[$id] = 'phpvmacars';
162 191
         	$globalSources[$id]['format'] = 'phpvmacars';
163 192
         	//$last_exec['phpvmacars'] = 0;
164
-        	if ($globalDebug) echo "Connect to phpvmacars source (".$host.")...\n";
193
+        	if ($globalDebug) {
194
+        		echo "Connect to phpvmacars source (".$host.")...\n";
195
+        	}
165 196
             } else if (preg_match('/VAM-json.php$/i',$host)) {
166 197
         	//$formats[$id] = 'phpvmacars';
167 198
         	$globalSources[$id]['format'] = 'vam';
168
-        	if ($globalDebug) echo "Connect to Vam source (".$host.")...\n";
199
+        	if ($globalDebug) {
200
+        		echo "Connect to Vam source (".$host.")...\n";
201
+        	}
169 202
             } else if (preg_match('/whazzup/i',$host)) {
170 203
         	//$formats[$id] = 'whazzup';
171 204
         	$globalSources[$id]['format'] = 'whazzup';
172 205
         	//$last_exec['whazzup'] = 0;
173
-        	if ($globalDebug) echo "Connect to whazzup source (".$host.")...\n";
206
+        	if ($globalDebug) {
207
+        		echo "Connect to whazzup source (".$host.")...\n";
208
+        	}
174 209
             } else if (preg_match('/recentpireps/i',$host)) {
175 210
         	//$formats[$id] = 'pirepsjson';
176 211
         	$globalSources[$id]['format'] = 'pirepsjson';
177 212
         	//$last_exec['pirepsjson'] = 0;
178
-        	if ($globalDebug) echo "Connect to pirepsjson source (".$host.")...\n";
213
+        	if ($globalDebug) {
214
+        		echo "Connect to pirepsjson source (".$host.")...\n";
215
+        	}
179 216
             } else if (preg_match(':data.fr24.com/zones/fcgi/feed.js:i',$host)) {
180 217
         	//$formats[$id] = 'fr24json';
181 218
         	$globalSources[$id]['format'] = 'fr24json';
182 219
         	//$last_exec['fr24json'] = 0;
183
-        	if ($globalDebug) echo "Connect to fr24 source (".$host.")...\n";
220
+        	if ($globalDebug) {
221
+        		echo "Connect to fr24 source (".$host.")...\n";
222
+        	}
184 223
         	if (!isset($globalSourcesRights) || (isset($globalSourcesRights) && !$globalSourcesRights)) {
185 224
         	    echo '!!! You MUST set $globalSourcesRights = TRUE in settings.php if you have the right to use this feed !!!'."\n";
186 225
         	    exit(0);
@@ -189,10 +228,14 @@  discard block
 block discarded – undo
189 228
             } else if (preg_match('/10001/',$host) || (isset($globalSources[$id]['port']) && $globalSources[$id]['port'] == '10001')) {
190 229
         	//$formats[$id] = 'tsv';
191 230
         	$globalSources[$id]['format'] = 'tsv';
192
-        	if ($globalDebug) echo "Connect to tsv source (".$host.")...\n";
231
+        	if ($globalDebug) {
232
+        		echo "Connect to tsv source (".$host.")...\n";
233
+        	}
193 234
             }
194 235
         } elseif (filter_var($host,FILTER_VALIDATE_URL)) {
195
-        	if ($globalDebug) echo "Connect to ".$globalSources[$id]['format']." source (".$host.")...\n";
236
+        	if ($globalDebug) {
237
+        		echo "Connect to ".$globalSources[$id]['format']." source (".$host.")...\n";
238
+        	}
196 239
         } elseif (!filter_var($host,FILTER_VALIDATE_URL)) {
197 240
 	    $hostport = explode(':',$host);
198 241
 	    if (isset($hostport[1])) {
@@ -229,17 +272,25 @@  discard block
 block discarded – undo
229 272
         		//$formats[$id] = 'beast';
230 273
         		$globalSources[$id]['format'] = 'beast';
231 274
 		    //} else $formats[$id] = 'sbs';
232
-		    } else $globalSources[$id]['format'] = 'sbs';
275
+		    } else {
276
+		    	$globalSources[$id]['format'] = 'sbs';
277
+		    }
233 278
 		    //if ($globalDebug) echo 'Connection in progress to '.$host.'('.$formats[$id].')....'."\n";
234 279
 		}
235
-		if ($globalDebug) echo 'Connection in progress to '.$hostn.':'.$port.' ('.$globalSources[$id]['format'].')....'."\n";
280
+		if ($globalDebug) {
281
+			echo 'Connection in progress to '.$hostn.':'.$port.' ('.$globalSources[$id]['format'].')....'."\n";
282
+		}
236 283
             } else {
237
-		if ($globalDebug) echo 'Connection failed to '.$hostn.':'.$port.' : '.$errno.' '.$errstr."\n";
284
+		if ($globalDebug) {
285
+			echo 'Connection failed to '.$hostn.':'.$port.' : '.$errno.' '.$errstr."\n";
286
+		}
238 287
     	    }
239 288
         }
240 289
     }
241 290
 }
242
-if (!isset($globalMinFetch)) $globalMinFetch = 15;
291
+if (!isset($globalMinFetch)) {
292
+	$globalMinFetch = 15;
293
+}
243 294
 
244 295
 // Initialize all
245 296
 $status = array();
@@ -247,13 +298,19 @@  discard block
 block discarded – undo
247 298
 $formats = array();
248 299
 $last_exec = array();
249 300
 $time = time();
250
-if (isset($globalSourcesTimeout)) $timeout = $globalSourcesTimeOut;
251
-else if (isset($globalSBS1TimeOut)) $timeout = $globalSBS1TimeOut;
252
-else $timeout = 20;
301
+if (isset($globalSourcesTimeout)) {
302
+	$timeout = $globalSourcesTimeOut;
303
+} else if (isset($globalSBS1TimeOut)) {
304
+	$timeout = $globalSBS1TimeOut;
305
+} else {
306
+	$timeout = 20;
307
+}
253 308
 $errno = '';
254 309
 $errstr='';
255 310
 
256
-if (!isset($globalDaemon)) $globalDaemon = TRUE;
311
+if (!isset($globalDaemon)) {
312
+	$globalDaemon = TRUE;
313
+}
257 314
 /* Initiate connections to all the hosts simultaneously */
258 315
 //connect_all($hosts);
259 316
 //connect_all($globalSources);
@@ -273,7 +330,9 @@  discard block
 block discarded – undo
273 330
     if (isset($source['format']) && $source['format'] == 'aprs') {
274 331
 	$aprs_connect = 0;
275 332
 	$use_aprs = true;
276
-	if (isset($source['port']) && $source['port'] == '10152') $aprs_full = true;
333
+	if (isset($source['port']) && $source['port'] == '10152') {
334
+		$aprs_full = true;
335
+	}
277 336
 	break;
278 337
     }
279 338
 }
@@ -284,24 +343,44 @@  discard block
 block discarded – undo
284 343
 	$aprs_connect = 0;
285 344
 	$aprs_keep = 120;
286 345
 	$aprs_last_tx = time();
287
-	if (isset($globalAPRSversion)) $aprs_version = $globalAPRSversion;
288
-	else $aprs_version = $globalName.' using FlightAirMap';
346
+	if (isset($globalAPRSversion)) {
347
+		$aprs_version = $globalAPRSversion;
348
+	} else {
349
+		$aprs_version = $globalName.' using FlightAirMap';
350
+	}
289 351
 	//else $aprs_version = 'Perl Example App';
290
-	if (isset($globalAPRSssid)) $aprs_ssid = $globalAPRSssid;
291
-	else $aprs_ssid = 'FAM';
352
+	if (isset($globalAPRSssid)) {
353
+		$aprs_ssid = $globalAPRSssid;
354
+	} else {
355
+		$aprs_ssid = 'FAM';
356
+	}
292 357
 	//else $aprs_ssid = 'PerlEx';
293
-	if (isset($globalAPRSfilter)) $aprs_filter = $globalAPRSfilter;
294
-	else $aprs_filter =  'r/'.$globalCenterLatitude.'/'.$globalCenterLongitude.'/250.0';
295
-	if ($aprs_full) $aprs_filter = '';
296
-	if ($aprs_filter != '') $aprs_login = "user {$aprs_ssid} appid {$aprs_version} filter {$aprs_filter}\n";
297
-	else $aprs_login = "user {$aprs_ssid} appid {$aprs_version}\n";
298
-}
358
+	if (isset($globalAPRSfilter)) {
359
+		$aprs_filter = $globalAPRSfilter;
360
+	} else {
361
+		$aprs_filter =  'r/'.$globalCenterLatitude.'/'.$globalCenterLongitude.'/250.0';
362
+	}
363
+	if ($aprs_full) {
364
+		$aprs_filter = '';
365
+	}
366
+	if ($aprs_filter != '') {
367
+		$aprs_login = "user {$aprs_ssid} appid {$aprs_version} filter {$aprs_filter}\n";
368
+	} else {
369
+		$aprs_login = "user {$aprs_ssid} appid {$aprs_version}\n";
370
+	}
371
+	}
299 372
 
300 373
 // connected - lets do some work
301
-if ($globalDebug) echo "Connected!\n";
374
+if ($globalDebug) {
375
+	echo "Connected!\n";
376
+}
302 377
 sleep(1);
303
-if ($globalDebug) echo "SCAN MODE \n\n";
304
-if (!isset($globalCronEnd)) $globalCronEnd = 60;
378
+if ($globalDebug) {
379
+	echo "SCAN MODE \n\n";
380
+}
381
+if (!isset($globalCronEnd)) {
382
+	$globalCronEnd = 60;
383
+}
305 384
 $endtime = time()+$globalCronEnd;
306 385
 $i = 1;
307 386
 $tt = array();
@@ -315,20 +394,28 @@  discard block
 block discarded – undo
315 394
 
316 395
 // Infinite loop if daemon, else work for time defined in $globalCronEnd or only one time.
317 396
 while ($i > 0) {
318
-    if (!$globalDaemon) $i = $endtime-time();
397
+    if (!$globalDaemon) {
398
+    	$i = $endtime-time();
399
+    }
319 400
     // Delete old ATC
320 401
     if ($globalDaemon && ((isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM))) {
321
-	if ($globalDebug) echo 'Delete old ATC...'."\n";
402
+	if ($globalDebug) {
403
+		echo 'Delete old ATC...'."\n";
404
+	}
322 405
         $ATC->deleteOldATC();
323 406
     }
324 407
     
325 408
     if (count($last_exec) > 0) {
326 409
 	$max = $globalMinFetch;
327 410
 	foreach ($last_exec as $last) {
328
-	    if ((time() - $last['last']) < $max) $max = time() - $last['last'];
411
+	    if ((time() - $last['last']) < $max) {
412
+	    	$max = time() - $last['last'];
413
+	    }
329 414
 	}
330 415
 	if ($max != $globalMinFetch) {
331
-	    if ($globalDebug) echo 'Sleeping...'."\n";
416
+	    if ($globalDebug) {
417
+	    	echo 'Sleeping...'."\n";
418
+	    }
332 419
 	    sleep($globalMinFetch-$max+2);
333 420
 	}
334 421
     }
@@ -336,7 +423,9 @@  discard block
 block discarded – undo
336 423
     
337 424
     //foreach ($formats as $id => $value) {
338 425
     foreach ($globalSources as $id => $value) {
339
-	if (!isset($last_exec[$id]['last'])) $last_exec[$id]['last'] = 0;
426
+	if (!isset($last_exec[$id]['last'])) {
427
+		$last_exec[$id]['last'] = 0;
428
+	}
340 429
 	if ($value['format'] == 'deltadbtxt' && (time() - $last_exec[$id]['last'] > $globalMinFetch)) {
341 430
 	    //$buffer = $Common->getData($hosts[$id]);
342 431
 	    $buffer = $Common->getData($value['host']);
@@ -348,19 +437,38 @@  discard block
 block discarded – undo
348 437
 	            $data = array();
349 438
 	            $data['hex'] = $line[1]; // hex
350 439
 	            $data['ident'] = $line[2]; // ident
351
-	            if (isset($line[3])) $data['altitude'] = $line[3]; // altitude
352
-	            if (isset($line[4])) $data['speed'] = $line[4]; // speed
353
-	            if (isset($line[5])) $data['heading'] = $line[5]; // heading
354
-	            if (isset($line[6])) $data['latitude'] = $line[6]; // lat
355
-	            if (isset($line[7])) $data['longitude'] = $line[7]; // long
440
+	            if (isset($line[3])) {
441
+	            	$data['altitude'] = $line[3];
442
+	            }
443
+	            // altitude
444
+	            if (isset($line[4])) {
445
+	            	$data['speed'] = $line[4];
446
+	            }
447
+	            // speed
448
+	            if (isset($line[5])) {
449
+	            	$data['heading'] = $line[5];
450
+	            }
451
+	            // heading
452
+	            if (isset($line[6])) {
453
+	            	$data['latitude'] = $line[6];
454
+	            }
455
+	            // lat
456
+	            if (isset($line[7])) {
457
+	            	$data['longitude'] = $line[7];
458
+	            }
459
+	            // long
356 460
 	            $data['verticalrate'] = ''; // vertical rate
357 461
 	            //if (isset($line[9])) $data['squawk'] = $line[9]; // squawk
358 462
 	            $data['emergency'] = ''; // emergency
359 463
 		    $data['datetime'] = date('Y-m-d H:i:s');
360 464
 		    $data['format_source'] = 'deltadbtxt';
361 465
     		    $data['id_source'] = $id_source;
362
-		    if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name'];
363
-		    if (isset($value['sourcestats'])) $data['sourcestats'] = $value['sourcestats'];
466
+		    if (isset($value['name']) && $value['name'] != '') {
467
+		    	$data['source_name'] = $value['name'];
468
+		    }
469
+		    if (isset($value['sourcestats'])) {
470
+		    	$data['sourcestats'] = $value['sourcestats'];
471
+		    }
364 472
     		    $SI->add($data);
365 473
 		    unset($data);
366 474
     		}
@@ -382,10 +490,19 @@  discard block
 block discarded – undo
382 490
 			$data['pilot_name'] = $line[2];
383 491
 			$data['hex'] = str_pad(dechex($line[1]),6,'000000',STR_PAD_LEFT);
384 492
 			$data['ident'] = $line[0]; // ident
385
-			if ($line[7] != '' && $line[7] != 0) $data['altitude'] = $line[7]; // altitude
493
+			if ($line[7] != '' && $line[7] != 0) {
494
+				$data['altitude'] = $line[7];
495
+			}
496
+			// altitude
386 497
 			$data['speed'] = $line[8]; // speed
387
-			if (isset($line[45])) $data['heading'] = $line[45]; // heading
388
-			elseif (isset($line[38])) $data['heading'] = $line[38]; // heading
498
+			if (isset($line[45])) {
499
+				$data['heading'] = $line[45];
500
+			}
501
+			// heading
502
+			elseif (isset($line[38])) {
503
+				$data['heading'] = $line[38];
504
+			}
505
+			// heading
389 506
 			$data['latitude'] = $line[5]; // lat
390 507
 	        	$data['longitude'] = $line[6]; // long
391 508
 	        	$data['verticalrate'] = ''; // vertical rate
@@ -394,14 +511,18 @@  discard block
 block discarded – undo
394 511
 	        	$data['waypoints'] = $line[30];
395 512
 			$data['datetime'] = date('Y-m-d H:i:s');
396 513
 			//$data['datetime'] = date('Y-m-d H:i:s',strtotime($line[37]));
397
-			if (isset($line[37])) $data['last_update'] = $line[37];
514
+			if (isset($line[37])) {
515
+				$data['last_update'] = $line[37];
516
+			}
398 517
 		        $data['departure_airport_icao'] = $line[11];
399 518
 		        $data['departure_airport_time'] = rtrim(chunk_split($line[22],2,':'),':');
400 519
 		        $data['arrival_airport_icao'] = $line[13];
401 520
 			$data['frequency'] = $line[4];
402 521
 			$data['type'] = $line[18];
403 522
 			$data['range'] = $line[19];
404
-			if (isset($line[35])) $data['info'] = $line[35];
523
+			if (isset($line[35])) {
524
+				$data['info'] = $line[35];
525
+			}
405 526
     			$data['id_source'] = $id_source;
406 527
 	    		//$data['arrival_airport_time'] = ;
407 528
 	    		if ($line[9] != '') {
@@ -415,23 +536,38 @@  discard block
 block discarded – undo
415 536
 	    		elseif ($value == 'vatsimtxt') $data['format_source'] = 'vatsimtxt';
416 537
 	    		*/
417 538
 	    		$data['format_source'] = $value['format'];
418
-			if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name'];
419
-    			if ($line[3] == 'PILOT') $SI->add($data);
420
-			elseif ($line[3] == 'ATC') {
539
+			if (isset($value['name']) && $value['name'] != '') {
540
+				$data['source_name'] = $value['name'];
541
+			}
542
+    			if ($line[3] == 'PILOT') {
543
+    				$SI->add($data);
544
+    			} elseif ($line[3] == 'ATC') {
421 545
 				//print_r($data);
422 546
 				$data['info'] = str_replace('^&sect;','<br />',$data['info']);
423 547
 				$data['info'] = str_replace('&amp;sect;','',$data['info']);
424 548
 				$typec = substr($data['ident'],-3);
425
-				if ($typec == 'APP') $data['type'] = 'Approach';
426
-				elseif ($typec == 'TWR') $data['type'] = 'Tower';
427
-				elseif ($typec == 'OBS') $data['type'] = 'Observer';
428
-				elseif ($typec == 'GND') $data['type'] = 'Ground';
429
-				elseif ($typec == 'DEL') $data['type'] = 'Delivery';
430
-				elseif ($typec == 'DEP') $data['type'] = 'Departure';
431
-				elseif ($typec == 'FSS') $data['type'] = 'Flight Service Station';
432
-				elseif ($typec == 'CTR') $data['type'] = 'Control Radar or Centre';
433
-				elseif ($data['type'] == '') $data['type'] = 'Observer';
434
-				if (!isset($data['source_name'])) $data['source_name'] = '';
549
+				if ($typec == 'APP') {
550
+					$data['type'] = 'Approach';
551
+				} elseif ($typec == 'TWR') {
552
+					$data['type'] = 'Tower';
553
+				} elseif ($typec == 'OBS') {
554
+					$data['type'] = 'Observer';
555
+				} elseif ($typec == 'GND') {
556
+					$data['type'] = 'Ground';
557
+				} elseif ($typec == 'DEL') {
558
+					$data['type'] = 'Delivery';
559
+				} elseif ($typec == 'DEP') {
560
+					$data['type'] = 'Departure';
561
+				} elseif ($typec == 'FSS') {
562
+					$data['type'] = 'Flight Service Station';
563
+				} elseif ($typec == 'CTR') {
564
+					$data['type'] = 'Control Radar or Centre';
565
+				} elseif ($data['type'] == '') {
566
+					$data['type'] = 'Observer';
567
+				}
568
+				if (!isset($data['source_name'])) {
569
+					$data['source_name'] = '';
570
+				}
435 571
 				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']);
436 572
 			}
437 573
     			unset($data);
@@ -450,26 +586,55 @@  discard block
 block discarded – undo
450 586
 		foreach ($all_data['acList'] as $line) {
451 587
 		    $data = array();
452 588
 		    $data['hex'] = $line['Icao']; // hex
453
-		    if (isset($line['Call'])) $data['ident'] = $line['Call']; // ident
454
-		    if (isset($line['Alt'])) $data['altitude'] = $line['Alt']; // altitude
455
-		    if (isset($line['Spd'])) $data['speed'] = $line['Spd']; // speed
456
-		    if (isset($line['Trak'])) $data['heading'] = $line['Trak']; // heading
457
-		    if (isset($line['Lat'])) $data['latitude'] = $line['Lat']; // lat
458
-		    if (isset($line['Long'])) $data['longitude'] = $line['Long']; // long
589
+		    if (isset($line['Call'])) {
590
+		    	$data['ident'] = $line['Call'];
591
+		    }
592
+		    // ident
593
+		    if (isset($line['Alt'])) {
594
+		    	$data['altitude'] = $line['Alt'];
595
+		    }
596
+		    // altitude
597
+		    if (isset($line['Spd'])) {
598
+		    	$data['speed'] = $line['Spd'];
599
+		    }
600
+		    // speed
601
+		    if (isset($line['Trak'])) {
602
+		    	$data['heading'] = $line['Trak'];
603
+		    }
604
+		    // heading
605
+		    if (isset($line['Lat'])) {
606
+		    	$data['latitude'] = $line['Lat'];
607
+		    }
608
+		    // lat
609
+		    if (isset($line['Long'])) {
610
+		    	$data['longitude'] = $line['Long'];
611
+		    }
612
+		    // long
459 613
 		    //$data['verticalrate'] = $line['']; // verticale rate
460
-		    if (isset($line['Sqk'])) $data['squawk'] = $line['Sqk']; // squawk
614
+		    if (isset($line['Sqk'])) {
615
+		    	$data['squawk'] = $line['Sqk'];
616
+		    }
617
+		    // squawk
461 618
 		    $data['emergency'] = ''; // emergency
462
-		    if (isset($line['Reg'])) $data['registration'] = $line['Reg'];
619
+		    if (isset($line['Reg'])) {
620
+		    	$data['registration'] = $line['Reg'];
621
+		    }
463 622
 		    /*
464 623
 		    if (isset($line['PosTime'])) $data['datetime'] = date('Y-m-d H:i:s',$line['PosTime']/1000);
465 624
 		    else $data['datetime'] = date('Y-m-d H:i:s');
466 625
 		    */
467 626
 		    $data['datetime'] = date('Y-m-d H:i:s');
468
-		    if (isset($line['Type'])) $data['aircraft_icao'] = $line['Type'];
627
+		    if (isset($line['Type'])) {
628
+		    	$data['aircraft_icao'] = $line['Type'];
629
+		    }
469 630
 	    	    $data['format_source'] = 'aircraftlistjson';
470 631
 		    $data['id_source'] = $id_source;
471
-		    if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name'];
472
-		    if (isset($data['datetime'])) $SI->add($data);
632
+		    if (isset($value['name']) && $value['name'] != '') {
633
+		    	$data['source_name'] = $value['name'];
634
+		    }
635
+		    if (isset($data['datetime'])) {
636
+		    	$SI->add($data);
637
+		    }
473 638
 		    unset($data);
474 639
 		}
475 640
 	    } else {
@@ -488,7 +653,9 @@  discard block
 block discarded – undo
488 653
 		    $data['datetime'] = date('Y-m-d H:i:s');
489 654
 	    	    $data['format_source'] = 'aircraftlistjson';
490 655
     		    $data['id_source'] = $id_source;
491
-		    if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name'];
656
+		    if (isset($value['name']) && $value['name'] != '') {
657
+		    	$data['source_name'] = $value['name'];
658
+		    }
492 659
 		    $SI->add($data);
493 660
 		    unset($data);
494 661
 		}
@@ -523,7 +690,9 @@  discard block
 block discarded – undo
523 690
 		    $data['datetime'] = date('Y-m-d H:i:s',$line[9]);
524 691
 	    	    $data['format_source'] = 'planeupdatefaa';
525 692
     		    $data['id_source'] = $id_source;
526
-		    if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name'];
693
+		    if (isset($value['name']) && $value['name'] != '') {
694
+		    	$data['source_name'] = $value['name'];
695
+		    }
527 696
 		    $SI->add($data);
528 697
 		    unset($data);
529 698
 		}
@@ -582,7 +751,9 @@  discard block
 block discarded – undo
582 751
 		    $data['datetime'] = date('Y-m-d H:i:s'); //$line[10]
583 752
 	    	    $data['format_source'] = 'fr24json';
584 753
     		    $data['id_source'] = $id_source;
585
-		    if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name'];
754
+		    if (isset($value['name']) && $value['name'] != '') {
755
+		    	$data['source_name'] = $value['name'];
756
+		    }
586 757
 		    $SI->add($data);
587 758
 		    unset($data);
588 759
 		}
@@ -605,23 +776,39 @@  discard block
 block discarded – undo
605 776
 		    if (isset($line['inf'])) {
606 777
 			$data = array();
607 778
 			$data['hex'] = $line['inf']['ia'];
608
-			if (isset($line['inf']['cs'])) $data['ident'] = $line['inf']['cs']; //$line[13]
779
+			if (isset($line['inf']['cs'])) {
780
+				$data['ident'] = $line['inf']['cs'];
781
+			}
782
+			//$line[13]
609 783
 	    		$data['altitude'] = round($line['inf']['al']*3.28084); // altitude
610
-	    		if (isset($line['inf']['gs'])) $data['speed'] = round($line['inf']['gs']*0.539957); // speed
611
-	    		if (isset($line['inf']['tr'])) $data['heading'] = $line['inf']['tr']; // heading
784
+	    		if (isset($line['inf']['gs'])) {
785
+	    			$data['speed'] = round($line['inf']['gs']*0.539957);
786
+	    		}
787
+	    		// speed
788
+	    		if (isset($line['inf']['tr'])) {
789
+	    			$data['heading'] = $line['inf']['tr'];
790
+	    		}
791
+	    		// heading
612 792
 	    		$data['latitude'] = $line['pt'][0]; // lat
613 793
 	    		$data['longitude'] = $line['pt'][1]; // long
614 794
 	    		//if (isset($line['inf']['vs'])) $data['verticalrate'] = $line['inf']['vs']; // verticale rate
615
-	    		if (isset($line['inf']['sq'])) $data['squawk'] = $line['inf']['sq']; // squawk
795
+	    		if (isset($line['inf']['sq'])) {
796
+	    			$data['squawk'] = $line['inf']['sq'];
797
+	    		}
798
+	    		// squawk
616 799
 	    		//$data['aircraft_icao'] = $line[8];
617
-	    		if (isset($line['inf']['rc'])) $data['registration'] = $line['inf']['rc'];
800
+	    		if (isset($line['inf']['rc'])) {
801
+	    			$data['registration'] = $line['inf']['rc'];
802
+	    		}
618 803
 			//$data['departure_airport_iata'] = $line[11];
619 804
 			//$data['arrival_airport_iata'] = $line[12];
620 805
 	    		//$data['emergency'] = ''; // emergency
621 806
 			$data['datetime'] = date('Y-m-d H:i:s',$line['inf']['dt']); //$line[10]
622 807
 	    		$data['format_source'] = 'radarvirtueljson';
623 808
     			$data['id_source'] = $id_source;
624
-			if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name'];
809
+			if (isset($value['name']) && $value['name'] != '') {
810
+				$data['source_name'] = $value['name'];
811
+			}
625 812
 			$SI->add($data);
626 813
 			unset($data);
627 814
 		    }
@@ -641,29 +828,62 @@  discard block
 block discarded – undo
641 828
 		    $data['id'] = $line['id'];
642 829
 		    $data['hex'] = substr(str_pad(dechex($line['id']),6,'000000',STR_PAD_LEFT),0,6);
643 830
 		    $data['ident'] = $line['callsign']; // ident
644
-		    if (isset($line['pilotid'])) $data['pilot_id'] = $line['pilotid']; // pilot id
645
-		    if (isset($line['name'])) $data['pilot_name'] = $line['name']; // pilot name
646
-		    if (isset($line['alt'])) $data['altitude'] = $line['alt']; // altitude
647
-		    if (isset($line['gs'])) $data['speed'] = $line['gs']; // speed
648
-		    if (isset($line['heading'])) $data['heading'] = $line['heading']; // heading
649
-		    if (isset($line['route'])) $data['waypoints'] = $line['route']; // route
831
+		    if (isset($line['pilotid'])) {
832
+		    	$data['pilot_id'] = $line['pilotid'];
833
+		    }
834
+		    // pilot id
835
+		    if (isset($line['name'])) {
836
+		    	$data['pilot_name'] = $line['name'];
837
+		    }
838
+		    // pilot name
839
+		    if (isset($line['alt'])) {
840
+		    	$data['altitude'] = $line['alt'];
841
+		    }
842
+		    // altitude
843
+		    if (isset($line['gs'])) {
844
+		    	$data['speed'] = $line['gs'];
845
+		    }
846
+		    // speed
847
+		    if (isset($line['heading'])) {
848
+		    	$data['heading'] = $line['heading'];
849
+		    }
850
+		    // heading
851
+		    if (isset($line['route'])) {
852
+		    	$data['waypoints'] = $line['route'];
853
+		    }
854
+		    // route
650 855
 		    $data['latitude'] = $line['lat']; // lat
651 856
 		    $data['longitude'] = $line['lon']; // long
652 857
 		    //$data['verticalrate'] = $line['vrt']; // verticale rate
653 858
 		    //$data['squawk'] = $line['squawk']; // squawk
654 859
 		    //$data['emergency'] = ''; // emergency
655
-		    if (isset($line['depicao'])) $data['departure_airport_icao'] = $line['depicao'];
656
-		    if (isset($line['deptime'])) $data['departure_airport_time'] = $line['deptime'];
657
-		    if (isset($line['arricao'])) $data['arrival_airport_icao'] = $line['arricao'];
860
+		    if (isset($line['depicao'])) {
861
+		    	$data['departure_airport_icao'] = $line['depicao'];
862
+		    }
863
+		    if (isset($line['deptime'])) {
864
+		    	$data['departure_airport_time'] = $line['deptime'];
865
+		    }
866
+		    if (isset($line['arricao'])) {
867
+		    	$data['arrival_airport_icao'] = $line['arricao'];
868
+		    }
658 869
 		    //$data['arrival_airport_time'] = $line['arrtime'];
659
-		    if (isset($line['aircraft'])) $data['aircraft_icao'] = $line['aircraft'];
660
-		    if (isset($line['transponder'])) $data['squawk'] = $line['transponder'];
661
-		    if (isset($line['atis'])) $data['info'] = $line['atis'];
662
-		    else $data['info'] = '';
870
+		    if (isset($line['aircraft'])) {
871
+		    	$data['aircraft_icao'] = $line['aircraft'];
872
+		    }
873
+		    if (isset($line['transponder'])) {
874
+		    	$data['squawk'] = $line['transponder'];
875
+		    }
876
+		    if (isset($line['atis'])) {
877
+		    	$data['info'] = $line['atis'];
878
+		    } else {
879
+		    	$data['info'] = '';
880
+		    }
663 881
 		    $data['format_source'] = 'pireps';
664 882
     		    $data['id_source'] = $id_source;
665 883
 		    $data['datetime'] = date('Y-m-d H:i:s');
666
-		    if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name'];
884
+		    if (isset($value['name']) && $value['name'] != '') {
885
+		    	$data['source_name'] = $value['name'];
886
+		    }
667 887
 		    if ($line['icon'] == 'plane') {
668 888
 			$SI->add($data);
669 889
 		    //    print_r($data);
@@ -672,15 +892,25 @@  discard block
 block discarded – undo
672 892
 			$data['info'] = str_replace('&amp;sect;','',$data['info']);
673 893
 			$typec = substr($data['ident'],-3);
674 894
 			$data['type'] = '';
675
-			if ($typec == 'APP') $data['type'] = 'Approach';
676
-			elseif ($typec == 'TWR') $data['type'] = 'Tower';
677
-			elseif ($typec == 'OBS') $data['type'] = 'Observer';
678
-			elseif ($typec == 'GND') $data['type'] = 'Ground';
679
-			elseif ($typec == 'DEL') $data['type'] = 'Delivery';
680
-			elseif ($typec == 'DEP') $data['type'] = 'Departure';
681
-			elseif ($typec == 'FSS') $data['type'] = 'Flight Service Station';
682
-			elseif ($typec == 'CTR') $data['type'] = 'Control Radar or Centre';
683
-			else $data['type'] = 'Observer';
895
+			if ($typec == 'APP') {
896
+				$data['type'] = 'Approach';
897
+			} elseif ($typec == 'TWR') {
898
+				$data['type'] = 'Tower';
899
+			} elseif ($typec == 'OBS') {
900
+				$data['type'] = 'Observer';
901
+			} elseif ($typec == 'GND') {
902
+				$data['type'] = 'Ground';
903
+			} elseif ($typec == 'DEL') {
904
+				$data['type'] = 'Delivery';
905
+			} elseif ($typec == 'DEP') {
906
+				$data['type'] = 'Departure';
907
+			} elseif ($typec == 'FSS') {
908
+				$data['type'] = 'Flight Service Station';
909
+			} elseif ($typec == 'CTR') {
910
+				$data['type'] = 'Control Radar or Centre';
911
+			} else {
912
+				$data['type'] = 'Observer';
913
+			}
684 914
 			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']);
685 915
 		    }
686 916
 		    unset($data);
@@ -691,17 +921,25 @@  discard block
 block discarded – undo
691 921
     	//} elseif ($value == 'phpvmacars' && (time() - $last_exec['phpvmacars'] > $globalMinFetch)) {
692 922
     	} elseif ($value['format'] == 'phpvmacars' && (time() - $last_exec[$id]['last'] > $globalMinFetch)) {
693 923
 	    //$buffer = $Common->getData($hosts[$id]);
694
-	    if ($globalDebug) echo 'Get Data...'."\n";
924
+	    if ($globalDebug) {
925
+	    	echo 'Get Data...'."\n";
926
+	    }
695 927
 	    $buffer = $Common->getData($value['host']);
696 928
 	    $all_data = json_decode($buffer,true);
697 929
 	    if ($buffer != '' && is_array($all_data)) {
698 930
 		foreach ($all_data as $line) {
699 931
 	    	    $data = array();
700 932
 	    	    //$data['id'] = $line['id']; // id not usable
701
-	    	    if (isset($line['pilotid'])) $data['id'] = $line['pilotid'].$line['flightnum'];
933
+	    	    if (isset($line['pilotid'])) {
934
+	    	    	$data['id'] = $line['pilotid'].$line['flightnum'];
935
+	    	    }
702 936
 	    	    $data['hex'] = substr(str_pad(bin2hex($line['flightnum']),6,'000000',STR_PAD_LEFT),-6); // hex
703
-	    	    if (isset($line['pilotname'])) $data['pilot_name'] = $line['pilotname'];
704
-	    	    if (isset($line['pilotid'])) $data['pilot_id'] = $line['pilotid'];
937
+	    	    if (isset($line['pilotname'])) {
938
+	    	    	$data['pilot_name'] = $line['pilotname'];
939
+	    	    }
940
+	    	    if (isset($line['pilotid'])) {
941
+	    	    	$data['pilot_id'] = $line['pilotid'];
942
+	    	    }
705 943
 	    	    $data['ident'] = $line['flightnum']; // ident
706 944
 	    	    $data['altitude'] = $line['alt']; // altitude
707 945
 	    	    $data['speed'] = $line['gs']; // speed
@@ -719,27 +957,41 @@  discard block
 block discarded – undo
719 957
 	    	    $data['arrival_airport_icao'] = $line['arricao'];
720 958
     		    $data['arrival_airport_time'] = $line['arrtime'];
721 959
     		    $data['registration'] = $line['aircraft'];
722
-		    if (isset($line['route'])) $data['waypoints'] = $line['route']; // route
960
+		    if (isset($line['route'])) {
961
+		    	$data['waypoints'] = $line['route'];
962
+		    }
963
+		    // route
723 964
 		    if (isset($line['aircraftname'])) {
724 965
 			$line['aircraftname'] = strtoupper($line['aircraftname']);
725 966
 			$line['aircraftname'] = str_replace('BOEING ','B',$line['aircraftname']);
726 967
 	    		$aircraft_data = explode('-',$line['aircraftname']);
727
-	    		if (isset($aircraft_data[1]) && strlen($aircraft_data[0]) < 5) $data['aircraft_icao'] = $aircraft_data[0];
728
-	    		elseif (isset($aircraft_data[1]) && strlen($aircraft_data[1]) < 5) $data['aircraft_icao'] = $aircraft_data[1];
729
-	    		else {
968
+	    		if (isset($aircraft_data[1]) && strlen($aircraft_data[0]) < 5) {
969
+	    			$data['aircraft_icao'] = $aircraft_data[0];
970
+	    		} elseif (isset($aircraft_data[1]) && strlen($aircraft_data[1]) < 5) {
971
+	    			$data['aircraft_icao'] = $aircraft_data[1];
972
+	    		} else {
730 973
 	    		    $aircraft_data = explode(' ',$line['aircraftname']);
731
-	    		    if (isset($aircraft_data[1])) $data['aircraft_icao'] = $aircraft_data[1];
732
-	    		    else $data['aircraft_icao'] = $line['aircraftname'];
974
+	    		    if (isset($aircraft_data[1])) {
975
+	    		    	$data['aircraft_icao'] = $aircraft_data[1];
976
+	    		    } else {
977
+	    		    	$data['aircraft_icao'] = $line['aircraftname'];
978
+	    		    }
733 979
 	    		}
734 980
 	    	    }
735
-    		    if (isset($line['route'])) $data['waypoints'] = $line['route'];
981
+    		    if (isset($line['route'])) {
982
+    		    	$data['waypoints'] = $line['route'];
983
+    		    }
736 984
     		    $data['id_source'] = $id_source;
737 985
 	    	    $data['format_source'] = 'phpvmacars';
738
-		    if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name'];
986
+		    if (isset($value['name']) && $value['name'] != '') {
987
+		    	$data['source_name'] = $value['name'];
988
+		    }
739 989
 		    $SI->add($data);
740 990
 		    unset($data);
741 991
 		}
742
-		if ($globalDebug) echo 'No more data...'."\n";
992
+		if ($globalDebug) {
993
+			echo 'No more data...'."\n";
994
+		}
743 995
 		unset($buffer);
744 996
 		unset($all_data);
745 997
 	    }
@@ -747,7 +999,9 @@  discard block
 block discarded – undo
747 999
     	    $last_exec[$id]['last'] = time();
748 1000
     	} elseif ($value['format'] == 'vam' && (time() - $last_exec[$id]['last'] > $globalMinFetch)) {
749 1001
 	    //$buffer = $Common->getData($hosts[$id]);
750
-	    if ($globalDebug) echo 'Get Data...'."\n";
1002
+	    if ($globalDebug) {
1003
+	    	echo 'Get Data...'."\n";
1004
+	    }
751 1005
 	    $buffer = $Common->getData($value['host']);
752 1006
 	    $all_data = json_decode($buffer,true);
753 1007
 	    if ($buffer != '' && is_array($all_data)) {
@@ -775,15 +1029,22 @@  discard block
 block discarded – undo
775 1029
 	    	    $data['arrival_airport_icao'] = $line['arrival'];
776 1030
     		    //$data['arrival_airport_time'] = $line['arrival_time'];
777 1031
     		    //$data['registration'] = $line['aircraft'];
778
-		    if (isset($line['route'])) $data['waypoints'] = $line['route']; // route
1032
+		    if (isset($line['route'])) {
1033
+		    	$data['waypoints'] = $line['route'];
1034
+		    }
1035
+		    // route
779 1036
 	    	    $data['aircraft_icao'] = $line['plane_type'];
780 1037
     		    $data['id_source'] = $id_source;
781 1038
 	    	    $data['format_source'] = 'vam';
782
-		    if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name'];
1039
+		    if (isset($value['name']) && $value['name'] != '') {
1040
+		    	$data['source_name'] = $value['name'];
1041
+		    }
783 1042
 		    $SI->add($data);
784 1043
 		    unset($data);
785 1044
 		}
786
-		if ($globalDebug) echo 'No more data...'."\n";
1045
+		if ($globalDebug) {
1046
+			echo 'No more data...'."\n";
1047
+		}
787 1048
 		unset($buffer);
788 1049
 		unset($all_data);
789 1050
 	    }
@@ -791,7 +1052,9 @@  discard block
 block discarded – undo
791 1052
     	    $last_exec[$id]['last'] = time();
792 1053
 	//} elseif ($value == 'sbs' || $value == 'tsv' || $value == 'raw' || $value == 'aprs' || $value == 'beast') {
793 1054
 	} 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') {
794
-	    if (function_exists('pcntl_fork')) pcntl_signal_dispatch();
1055
+	    if (function_exists('pcntl_fork')) {
1056
+	    	pcntl_signal_dispatch();
1057
+	    }
795 1058
     	    //$last_exec[$id]['last'] = time();
796 1059
 
797 1060
 	    //$read = array( $sockets[$id] );
@@ -799,7 +1062,9 @@  discard block
 block discarded – undo
799 1062
 	    $write = NULL;
800 1063
 	    $e = NULL;
801 1064
 	    $n = socket_select($read, $write, $e, $timeout);
802
-	    if ($e != NULL) var_dump($e);
1065
+	    if ($e != NULL) {
1066
+	    	var_dump($e);
1067
+	    }
803 1068
 	    if ($n > 0) {
804 1069
 		foreach ($read as $nb => $r) {
805 1070
 		    //$value = $formats[$nb];
@@ -820,7 +1085,9 @@  discard block
 block discarded – undo
820 1085
 		    if ($buffer != '') {
821 1086
 			$tt[$format] = 0;
822 1087
 			if ($format == 'acarssbs3') {
823
-                    	    if ($globalDebug) echo 'ACARS : '.$buffer."\n";
1088
+                    	    if ($globalDebug) {
1089
+                    	    	echo 'ACARS : '.$buffer."\n";
1090
+                    	    }
824 1091
 			    $ACARS->add(trim($buffer));
825 1092
 			    $ACARS->deleteLiveAcarsData();
826 1093
 			} elseif ($format == 'raw') {
@@ -829,9 +1096,15 @@  discard block
 block discarded – undo
829 1096
 			    if (is_array($data)) {
830 1097
 				$data['datetime'] = date('Y-m-d H:i:s');
831 1098
 				$data['format_source'] = 'raw';
832
-				if (isset($globalSources[$nb]['name']) && $globalSources[$nb]['name'] != '') $data['source_name'] = $globalSources[$nb]['name'];
833
-    				if (isset($globalSources[$nb]['sourcestats'])) $data['sourcestats'] = $globalSources[$nb]['sourcestats'];
834
-                                if (($data['latitude'] == '' && $data['longitude'] == '') || (is_numeric($data['latitude']) && is_numeric($data['longitude']))) $SI->add($data);
1099
+				if (isset($globalSources[$nb]['name']) && $globalSources[$nb]['name'] != '') {
1100
+					$data['source_name'] = $globalSources[$nb]['name'];
1101
+				}
1102
+    				if (isset($globalSources[$nb]['sourcestats'])) {
1103
+    					$data['sourcestats'] = $globalSources[$nb]['sourcestats'];
1104
+    				}
1105
+                                if (($data['latitude'] == '' && $data['longitude'] == '') || (is_numeric($data['latitude']) && is_numeric($data['longitude']))) {
1106
+                                	$SI->add($data);
1107
+                                }
835 1108
                             }
836 1109
                         } elseif ($format == 'flightgearsp') {
837 1110
                     	    //echo $buffer."\n";
@@ -849,11 +1122,15 @@  discard block
 block discarded – undo
849 1122
 				$data['speed'] = round($line[5]*1.94384);
850 1123
 				$data['datetime'] = date('Y-m-d H:i:s');
851 1124
 				$data['format_source'] = 'flightgearsp';
852
-				if (($data['latitude'] == '' && $data['longitude'] == '') || (is_numeric($data['latitude']) && is_numeric($data['longitude']))) $SI->add($data);
1125
+				if (($data['latitude'] == '' && $data['longitude'] == '') || (is_numeric($data['latitude']) && is_numeric($data['longitude']))) {
1126
+					$SI->add($data);
1127
+				}
853 1128
 				$send = @ socket_send( $r  , $data_aprs , strlen($data_aprs) , 0 );
854 1129
 			    }
855 1130
                         } elseif ($format == 'acars') {
856
-                    	    if ($globalDebug) echo 'ACARS : '.$buffer."\n";
1131
+                    	    if ($globalDebug) {
1132
+                    	    	echo 'ACARS : '.$buffer."\n";
1133
+                    	    }
857 1134
 			    $ACARS->add(trim($buffer));
858 1135
 			    socket_sendto($r, "OK " . $buffer , 100 , 0 , $remote_ip , $remote_port);
859 1136
 			    $ACARS->deleteLiveAcarsData();
@@ -874,7 +1151,9 @@  discard block
 block discarded – undo
874 1151
 				    $aircraft_type = $line[10];
875 1152
 				    $aircraft_type = preg_split(':/:',$aircraft_type);
876 1153
 				    $data['aircraft_name'] = substr(end($aircraft_type),0,-4);
877
-				    if (($data['latitude'] == '' && $data['longitude'] == '') || (is_numeric($data['latitude']) && is_numeric($data['longitude']))) $SI->add($data);
1154
+				    if (($data['latitude'] == '' && $data['longitude'] == '') || (is_numeric($data['latitude']) && is_numeric($data['longitude']))) {
1155
+				    	$SI->add($data);
1156
+				    }
878 1157
 				}
879 1158
 			    }
880 1159
 			} elseif ($format == 'beast') {
@@ -890,21 +1169,43 @@  discard block
 block discarded – undo
890 1169
     				$data['hex'] = $lined['hexid'];
891 1170
     				//$data['datetime'] = date('Y-m-d H:i:s',strtotime($lined['clock']));;
892 1171
     				$data['datetime'] = date('Y-m-d H:i:s');;
893
-    				if (isset($lined['ident'])) $data['ident'] = $lined['ident'];
894
-    				if (isset($lined['lat'])) $data['latitude'] = $lined['lat'];
895
-    				if (isset($lined['lon'])) $data['longitude'] = $lined['lon'];
896
-    				if (isset($lined['speed'])) $data['speed'] = $lined['speed'];
897
-    				if (isset($lined['squawk'])) $data['squawk'] = $lined['squawk'];
898
-    				if (isset($lined['alt'])) $data['altitude'] = $lined['alt'];
899
-    				if (isset($lined['heading'])) $data['heading'] = $lined['heading'];
1172
+    				if (isset($lined['ident'])) {
1173
+    					$data['ident'] = $lined['ident'];
1174
+    				}
1175
+    				if (isset($lined['lat'])) {
1176
+    					$data['latitude'] = $lined['lat'];
1177
+    				}
1178
+    				if (isset($lined['lon'])) {
1179
+    					$data['longitude'] = $lined['lon'];
1180
+    				}
1181
+    				if (isset($lined['speed'])) {
1182
+    					$data['speed'] = $lined['speed'];
1183
+    				}
1184
+    				if (isset($lined['squawk'])) {
1185
+    					$data['squawk'] = $lined['squawk'];
1186
+    				}
1187
+    				if (isset($lined['alt'])) {
1188
+    					$data['altitude'] = $lined['alt'];
1189
+    				}
1190
+    				if (isset($lined['heading'])) {
1191
+    					$data['heading'] = $lined['heading'];
1192
+    				}
900 1193
     				$data['id_source'] = $id_source;
901 1194
     				$data['format_source'] = 'tsv';
902
-    				if (isset($globalSources[$nb]['name']) && $globalSources[$nb]['name'] != '') $data['source_name'] = $globalSources[$nb]['name'];
903
-    				if (isset($globalSources[$nb]['sourcestats'])) $data['sourcestats'] = $globalSources[$nb]['sourcestats'];
904
-    				if (($data['latitude'] == '' && $data['longitude'] == '') || (is_numeric($data['latitude']) && is_numeric($data['longitude']))) $SI->add($data);
1195
+    				if (isset($globalSources[$nb]['name']) && $globalSources[$nb]['name'] != '') {
1196
+    					$data['source_name'] = $globalSources[$nb]['name'];
1197
+    				}
1198
+    				if (isset($globalSources[$nb]['sourcestats'])) {
1199
+    					$data['sourcestats'] = $globalSources[$nb]['sourcestats'];
1200
+    				}
1201
+    				if (($data['latitude'] == '' && $data['longitude'] == '') || (is_numeric($data['latitude']) && is_numeric($data['longitude']))) {
1202
+    					$SI->add($data);
1203
+    				}
905 1204
     				unset($lined);
906 1205
     				unset($data);
907
-    			    } else $error = true;
1206
+    			    } else {
1207
+    			    	$error = true;
1208
+    			    }
908 1209
 			} elseif ($format == 'aprs' && $use_aprs) {
909 1210
 			    if ($aprs_connect == 0) {
910 1211
 				$send = @ socket_send( $r  , $aprs_login , strlen($aprs_login) , 0 );
@@ -930,29 +1231,44 @@  discard block
 block discarded – undo
930 1231
 				    $data['latitude'] = $line['latitude'];
931 1232
 				    $data['longitude'] = $line['longitude'];
932 1233
 				    //$data['verticalrate'] = $line[16];
933
-				    if (isset($line['speed'])) $data['speed'] = $line['speed'];
934
-				    else $data['speed'] = 0;
1234
+				    if (isset($line['speed'])) {
1235
+				    	$data['speed'] = $line['speed'];
1236
+				    } else {
1237
+				    	$data['speed'] = 0;
1238
+				    }
935 1239
 				    $data['altitude'] = $line['altitude'];
936
-				    if (isset($line['course'])) $data['heading'] = $line['course'];
1240
+				    if (isset($line['course'])) {
1241
+				    	$data['heading'] = $line['course'];
1242
+				    }
937 1243
 				    //else $data['heading'] = 0;
938 1244
 				    $data['aircraft_type'] = $line['stealth'];
939
-				    if (!isset($globalAPRSarchive) || (isset($globalAPRSarchive) && $globalAPRSarchive == FALSE)) $data['noarchive'] = true;
1245
+				    if (!isset($globalAPRSarchive) || (isset($globalAPRSarchive) && $globalAPRSarchive == FALSE)) {
1246
+				    	$data['noarchive'] = true;
1247
+				    }
940 1248
     				    $data['id_source'] = $id_source;
941 1249
 				    $data['format_source'] = 'aprs';
942 1250
 				    $data['source_name'] = $line['source'];
943
-    				    if (isset($globalSources[$nb]['sourcestats'])) $data['sourcestats'] = $globalSources[$nb]['sourcestats'];
1251
+    				    if (isset($globalSources[$nb]['sourcestats'])) {
1252
+    				    	$data['sourcestats'] = $globalSources[$nb]['sourcestats'];
1253
+    				    }
944 1254
 				    $currentdate = date('Y-m-d H:i:s');
945 1255
 				    $aprsdate = strtotime($data['datetime']);
946 1256
 				    // Accept data if time <= system time + 20s
947
-				    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);
948
-				    else {
949
-					if ($line['stealth'] != 0) echo '-------- '.$data['ident'].' : APRS stealth ON => not adding'."\n";
950
-					else echo '--------- '.$data['ident'].' : Date APRS : '.$data['datetime'].' - Current date : '.$currentdate.' => not adding future event'."\n";
1257
+				    if ($line['stealth'] == 0 && (strtotime($data['datetime']) <= strtotime($currentdate)+20) && (($data['latitude'] == '' && $data['longitude'] == '') || (is_numeric($data['latitude']) && is_numeric($data['longitude'])))) {
1258
+				    	$send = $SI->add($data);
1259
+				    } else {
1260
+					if ($line['stealth'] != 0) {
1261
+						echo '-------- '.$data['ident'].' : APRS stealth ON => not adding'."\n";
1262
+					} else {
1263
+						echo '--------- '.$data['ident'].' : Date APRS : '.$data['datetime'].' - Current date : '.$currentdate.' => not adding future event'."\n";
1264
+					}
951 1265
 				    }
952 1266
 				    unset($data);
953 1267
 				} 
954 1268
 				//elseif ($line == false && $globalDebug) echo 'Ignored ('.$buffer.")\n";
955
-				elseif ($line == true && $globalDebug) echo '!! Failed : '.$buffer."!!\n";
1269
+				elseif ($line == true && $globalDebug) {
1270
+					echo '!! Failed : '.$buffer."!!\n";
1271
+				}
956 1272
 			    }
957 1273
 			} else {
958 1274
 			    $line = explode(',', $buffer);
@@ -980,25 +1296,42 @@  discard block
 block discarded – undo
980 1296
     				$data['ground'] = $line[21];
981 1297
     				$data['emergency'] = $line[19];
982 1298
     				$data['format_source'] = 'sbs';
983
-				if (isset($globalSources[$nb]['name']) && $globalSources[$nb]['name'] != '') $data['source_name'] = $globalSources[$nb]['name'];
984
-    				if (isset($globalSources[$nb]['sourcestats'])) $data['sourcestats'] = $globalSources[$nb]['sourcestats'];
1299
+				if (isset($globalSources[$nb]['name']) && $globalSources[$nb]['name'] != '') {
1300
+					$data['source_name'] = $globalSources[$nb]['name'];
1301
+				}
1302
+    				if (isset($globalSources[$nb]['sourcestats'])) {
1303
+    					$data['sourcestats'] = $globalSources[$nb]['sourcestats'];
1304
+    				}
985 1305
     				$data['id_source'] = $id_source;
986
-    				if (($data['latitude'] == '' && $data['longitude'] == '') || (is_numeric($data['latitude']) && is_numeric($data['longitude']))) $send = $SI->add($data);
987
-    				else $error = true;
1306
+    				if (($data['latitude'] == '' && $data['longitude'] == '') || (is_numeric($data['latitude']) && is_numeric($data['longitude']))) {
1307
+    					$send = $SI->add($data);
1308
+    				} else {
1309
+    					$error = true;
1310
+    				}
988 1311
     				unset($data);
989
-    			    } else $error = true;
1312
+    			    } else {
1313
+    			    	$error = true;
1314
+    			    }
990 1315
 			    if ($error) {
991 1316
 				if (count($line) > 1 && ($line[0] == 'STA' || $line[0] == 'AIR' || $line[0] == 'SEL' || $line[0] == 'ID' || $line[0] == 'CLK')) { 
992
-					if ($globalDebug) echo "Not a message. Ignoring... \n";
1317
+					if ($globalDebug) {
1318
+						echo "Not a message. Ignoring... \n";
1319
+					}
993 1320
 				} else {
994
-					if ($globalDebug) echo "Wrong line format. Ignoring... \n";
1321
+					if ($globalDebug) {
1322
+						echo "Wrong line format. Ignoring... \n";
1323
+					}
995 1324
 					if ($globalDebug) {
996 1325
 						echo $buffer;
997 1326
 						print_r($line);
998 1327
 					}
999 1328
 					//socket_close($r);
1000
-					if ($globalDebug) echo "Reconnect after an error...\n";
1001
-					if ($format == 'aprs') $aprs_connect = 0;
1329
+					if ($globalDebug) {
1330
+						echo "Reconnect after an error...\n";
1331
+					}
1332
+					if ($format == 'aprs') {
1333
+						$aprs_connect = 0;
1334
+					}
1002 1335
 					$sourceer[$nb] = $globalSources[$nb];
1003 1336
 					connect_all($sourceer);
1004 1337
 					$sourceer = array();
@@ -1006,10 +1339,14 @@  discard block
 block discarded – undo
1006 1339
 			    }
1007 1340
 			}
1008 1341
 			// Sleep for xxx microseconds
1009
-			if (isset($globalSBSSleep)) usleep($globalSBSSleep);
1342
+			if (isset($globalSBSSleep)) {
1343
+				usleep($globalSBSSleep);
1344
+			}
1010 1345
 		    } else {
1011 1346
 			if ($format == 'flightgearmp') {
1012
-			    	if ($globalDebug) echo "Reconnect FlightGear MP...";
1347
+			    	if ($globalDebug) {
1348
+			    		echo "Reconnect FlightGear MP...";
1349
+			    	}
1013 1350
 				//@socket_close($r);
1014 1351
 				sleep($globalMinFetch);
1015 1352
 				$sourcefg[$nb] = $globalSources[$nb];
@@ -1018,10 +1355,15 @@  discard block
 block discarded – undo
1018 1355
 				break;
1019 1356
 				
1020 1357
 			} elseif ($format != 'acars' && $format != 'flightgearsp') {
1021
-			    if (isset($tt[$format])) $tt[$format]++;
1022
-			    else $tt[$format] = 0;
1358
+			    if (isset($tt[$format])) {
1359
+			    	$tt[$format]++;
1360
+			    } else {
1361
+			    	$tt[$format] = 0;
1362
+			    }
1023 1363
 			    if ($tt[$format] > 30) {
1024
-				if ($globalDebug) echo "ERROR : Reconnect ".$format."...";
1364
+				if ($globalDebug) {
1365
+					echo "ERROR : Reconnect ".$format."...";
1366
+				}
1025 1367
 				//@socket_close($r);
1026 1368
 				sleep(2);
1027 1369
 				$aprs_connect = 0;
@@ -1037,12 +1379,18 @@  discard block
 block discarded – undo
1037 1379
 		}
1038 1380
 	    } else {
1039 1381
 		$error = socket_strerror(socket_last_error());
1040
-		if ($globalDebug) echo "ERROR : socket_select give this error ".$error . "\n";
1382
+		if ($globalDebug) {
1383
+			echo "ERROR : socket_select give this error ".$error . "\n";
1384
+		}
1041 1385
 		if (($error != SOCKET_EINPROGRESS && $error != SOCKET_EALREADY && $error != 'Success') || time() - $time >= $timeout) {
1042
-			if (isset($globalDebug)) echo "Restarting...\n";
1386
+			if (isset($globalDebug)) {
1387
+				echo "Restarting...\n";
1388
+			}
1043 1389
 			// Restart the script if possible
1044 1390
 			if (is_array($sockets)) {
1045
-			    if ($globalDebug) echo "Shutdown all sockets...";
1391
+			    if ($globalDebug) {
1392
+			    	echo "Shutdown all sockets...";
1393
+			    }
1046 1394
 			    
1047 1395
 			    foreach ($sockets as $sock) {
1048 1396
 				@socket_shutdown($sock,2);
@@ -1050,7 +1398,9 @@  discard block
 block discarded – undo
1050 1398
 			    }
1051 1399
 			    
1052 1400
 			}
1053
-			    if ($globalDebug) echo "Restart all connections...";
1401
+			    if ($globalDebug) {
1402
+			    	echo "Restart all connections...";
1403
+			    }
1054 1404
 			    sleep(2);
1055 1405
 			    $time = time();
1056 1406
 			    //connect_all($hosts);
@@ -1061,7 +1411,9 @@  discard block
 block discarded – undo
1061 1411
 	    }
1062 1412
 	}
1063 1413
 	if ($globalDaemon === false) {
1064
-	    if ($globalDebug) echo 'Check all...'."\n";
1414
+	    if ($globalDebug) {
1415
+	    	echo 'Check all...'."\n";
1416
+	    }
1065 1417
 	    $SI->checkAll();
1066 1418
 	}
1067 1419
     }
Please login to merge, or discard this patch.
index.php 1 patch
Braces   +357 added lines, -95 removed lines patch added patch discarded remove patch
@@ -135,11 +135,26 @@  discard block
 block discarded – undo
135 135
 				<li><div class="checkbox"><label><input type="checkbox" name="notamcb" value="1" onclick="showNotam();" /><?php echo _("Display NOTAM"); ?></label></div></li>
136 136
 				<li><?php echo _("NOTAM scope:"); ?>
137 137
 					<select class="selectpicker" onchange="notamscope(this);">
138
-						<option<?php if (!isset($_COOKIE['notamscope']) || $_COOKIE['notamscope'] == 'All') print ' selected'; ?>>All</option>
139
-						<option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Airport/Enroute warning') print ' selected'; ?>>Airport/Enroute warning</option>
140
-						<option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Airport warning') print ' selected'; ?>>Airport warning</option>
141
-						<option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Navigation warning') print ' selected'; ?>>Navigation warning</option>
142
-						<option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Enroute warning') print ' selected'; ?>>Enroute warning</option>
138
+						<option<?php if (!isset($_COOKIE['notamscope']) || $_COOKIE['notamscope'] == 'All') {
139
+	print ' selected';
140
+}
141
+?>>All</option>
142
+						<option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Airport/Enroute warning') {
143
+	print ' selected';
144
+}
145
+?>>Airport/Enroute warning</option>
146
+						<option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Airport warning') {
147
+	print ' selected';
148
+}
149
+?>>Airport warning</option>
150
+						<option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Navigation warning') {
151
+	print ' selected';
152
+}
153
+?>>Navigation warning</option>
154
+						<option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Enroute warning') {
155
+	print ' selected';
156
+}
157
+?>>Enroute warning</option>
143 158
 					</select
144 159
 				</li>
145 160
 			</ul>
@@ -167,7 +182,12 @@  discard block
 block discarded – undo
167 182
 		        <div class="form-group">
168 183
 			    <label>From (UTC):</label>
169 184
 		            <div class='input-group date' id='datetimepicker1'>
170
-            			<input type='text' name="start_date" class="form-control" value="<?php if (isset($_POST['start_date'])) print $_POST['start_date']; elseif (isset($_COOKIE['archive_begin'])) print date("m/d/Y h:i a",$_COOKIE['archive_begin']); ?>" required />
185
+            			<input type='text' name="start_date" class="form-control" value="<?php if (isset($_POST['start_date'])) {
186
+	print $_POST['start_date'];
187
+} elseif (isset($_COOKIE['archive_begin'])) {
188
+	print date("m/d/Y h:i a",$_COOKIE['archive_begin']);
189
+}
190
+?>" required />
171 191
 		                <span class="input-group-addon">
172 192
             			    <span class="glyphicon glyphicon-calendar"></span>
173 193
 		                </span>
@@ -176,7 +196,12 @@  discard block
 block discarded – undo
176 196
 		        <div class="form-group">
177 197
 			    <label>To (UTC):</label>
178 198
 		            <div class='input-group date' id='datetimepicker2'>
179
-		                <input type='text' name="end_date" class="form-control" value="<?php if (isset($_POST['end_date'])) print $_POST['end_date']; elseif (isset($_COOKIE['archive_end'])) print date("m/d/Y h:i a",$_COOKIE['archive_end']); ?>" />
199
+		                <input type='text' name="end_date" class="form-control" value="<?php if (isset($_POST['end_date'])) {
200
+	print $_POST['end_date'];
201
+} elseif (isset($_COOKIE['archive_end'])) {
202
+	print date("m/d/Y h:i a",$_COOKIE['archive_end']);
203
+}
204
+?>" />
180 205
             			<span class="input-group-addon">
181 206
 		                    <span class="glyphicon glyphicon-calendar"></span>
182 207
             			</span>
@@ -202,8 +227,20 @@  discard block
 block discarded – undo
202 227
 
203 228
 		    <li><?php echo _("Playback speed:"); ?>
204 229
 			<div class="range">
205
-			    <input type="range" min="0" max="50" step="1" name="archivespeed" onChange="archivespeedrange.value=value;" value="<?php  if (isset($_POST['archivespeed'])) print $_POST['archivespeed']; elseif (isset($_COOKIE['archive_speed'])) print $_COOKIE['archive_speed']; else print '1'; ?>">
206
-			    <output id="archivespeedrange"><?php  if (isset($_COOKIE['archive_speed'])) print $_COOKIE['archive_speed']; else print '1'; ?></output>
230
+			    <input type="range" min="0" max="50" step="1" name="archivespeed" onChange="archivespeedrange.value=value;" value="<?php  if (isset($_POST['archivespeed'])) {
231
+	print $_POST['archivespeed'];
232
+} elseif (isset($_COOKIE['archive_speed'])) {
233
+	print $_COOKIE['archive_speed'];
234
+} else {
235
+	print '1';
236
+}
237
+?>">
238
+			    <output id="archivespeedrange"><?php  if (isset($_COOKIE['archive_speed'])) {
239
+	print $_COOKIE['archive_speed'];
240
+} else {
241
+	print '1';
242
+}
243
+?></output>
207 244
 			</div>
208 245
 		    </li>
209 246
 		    <li><input type="submit" name="archive" value="Show archive" class="btn btn-primary" /></li>
@@ -225,15 +262,27 @@  discard block
 block discarded – undo
225 262
 		    <li><?php echo _("Type of Map:"); ?>
226 263
 			<select  class="selectpicker" onchange="mapType(this);">
227 264
 			    <?php
228
-				if (!isset($_COOKIE['MapType']) || $_COOKIE['MapType'] == '') $MapType = $globalMapProvider;
229
-				else $MapType = $_COOKIE['MapType'];
265
+				if (!isset($_COOKIE['MapType']) || $_COOKIE['MapType'] == '') {
266
+					$MapType = $globalMapProvider;
267
+				} else {
268
+					$MapType = $_COOKIE['MapType'];
269
+				}
230 270
 			    ?>
231 271
 			    <?php
232 272
 				if (isset($globalBingMapKey) && $globalBingMapKey != '') {
233 273
 			    ?>
234
-			    <option value="Bing-Aerial"<?php if ($MapType == 'Bing-Aerial') print ' selected'; ?>>Bing-Aerial</option>
235
-			    <option value="Bing-Hybrid"<?php if ($MapType == 'Bing-Hybrid') print ' selected'; ?>>Bing-Hybrid</option>
236
-			    <option value="Bing-Road"<?php if ($MapType == 'Bing-Road') print ' selected'; ?>>Bing-Road</option>
274
+			    <option value="Bing-Aerial"<?php if ($MapType == 'Bing-Aerial') {
275
+	print ' selected';
276
+}
277
+?>>Bing-Aerial</option>
278
+			    <option value="Bing-Hybrid"<?php if ($MapType == 'Bing-Hybrid') {
279
+	print ' selected';
280
+}
281
+?>>Bing-Hybrid</option>
282
+			    <option value="Bing-Road"<?php if ($MapType == 'Bing-Road') {
283
+	print ' selected';
284
+}
285
+?>>Bing-Road</option>
237 286
 			    <?php
238 287
 				}
239 288
 			    ?>
@@ -243,56 +292,131 @@  discard block
 block discarded – undo
243 292
 			    <?php
244 293
 				    if (isset($globalHereappId) && $globalHereappId != '' && isset($globalHereappCode) && $globalHereappCode != '') {
245 294
 			    ?>
246
-			    <option value="Here-Aerial"<?php if ($MapType == 'Here') print ' selected'; ?>>Here-Aerial</option>
247
-			    <option value="Here-Hybrid"<?php if ($MapType == 'Here') print ' selected'; ?>>Here-Hybrid</option>
248
-			    <option value="Here-Road"<?php if ($MapType == 'Here') print ' selected'; ?>>Here-Road</option>
295
+			    <option value="Here-Aerial"<?php if ($MapType == 'Here') {
296
+	print ' selected';
297
+}
298
+?>>Here-Aerial</option>
299
+			    <option value="Here-Hybrid"<?php if ($MapType == 'Here') {
300
+	print ' selected';
301
+}
302
+?>>Here-Hybrid</option>
303
+			    <option value="Here-Road"<?php if ($MapType == 'Here') {
304
+	print ' selected';
305
+}
306
+?>>Here-Road</option>
249 307
 			    <?php
250 308
 				    }
251 309
 			    ?>
252 310
 			    <?php
253 311
 				    if (isset($globalGoogleAPIKey) && $globalGoogleAPIKey != '') {
254 312
 			    ?>
255
-			    <option value="Google-Roadmap"<?php if ($MapType == 'Google-Roadmap') print ' selected'; ?>>Google Roadmap</option>
256
-			    <option value="Google-Satellite"<?php if ($MapType == 'Google-Satellite') print ' selected'; ?>>Google Satellite</option>
257
-			    <option value="Google-Hybrid"<?php if ($MapType == 'Google-Hybrid') print ' selected'; ?>>Google Hybrid</option>
258
-			    <option value="Google-Terrain"<?php if ($MapType == 'Google-Terrain') print ' selected'; ?>>Google Terrain</option>
313
+			    <option value="Google-Roadmap"<?php if ($MapType == 'Google-Roadmap') {
314
+	print ' selected';
315
+}
316
+?>>Google Roadmap</option>
317
+			    <option value="Google-Satellite"<?php if ($MapType == 'Google-Satellite') {
318
+	print ' selected';
319
+}
320
+?>>Google Satellite</option>
321
+			    <option value="Google-Hybrid"<?php if ($MapType == 'Google-Hybrid') {
322
+	print ' selected';
323
+}
324
+?>>Google Hybrid</option>
325
+			    <option value="Google-Terrain"<?php if ($MapType == 'Google-Terrain') {
326
+	print ' selected';
327
+}
328
+?>>Google Terrain</option>
259 329
 			    <?php
260 330
 				    }
261 331
 			    ?>
262 332
 			    <?php
263 333
 				    if (isset($globalMapQuestKey) && $globalMapQuestKey != '') {
264 334
 			    ?>
265
-			    <option value="MapQuest-OSM"<?php if ($MapType == 'MapQuest-OSM') print ' selected'; ?>>MapQuest-OSM</option>
266
-			    <option value="MapQuest-Aerial"<?php if ($MapType == 'MapQuest-Aerial') print ' selected'; ?>>MapQuest-Aerial</option>
267
-			    <option value="MapQuest-Hybrid"<?php if ($MapType == 'MapQuest-Hybrid') print ' selected'; ?>>MapQuest-Hybrid</option>
335
+			    <option value="MapQuest-OSM"<?php if ($MapType == 'MapQuest-OSM') {
336
+	print ' selected';
337
+}
338
+?>>MapQuest-OSM</option>
339
+			    <option value="MapQuest-Aerial"<?php if ($MapType == 'MapQuest-Aerial') {
340
+	print ' selected';
341
+}
342
+?>>MapQuest-Aerial</option>
343
+			    <option value="MapQuest-Hybrid"<?php if ($MapType == 'MapQuest-Hybrid') {
344
+	print ' selected';
345
+}
346
+?>>MapQuest-Hybrid</option>
268 347
 			    <?php
269 348
 				    }
270 349
 			    ?>
271
-			    <option value="Yandex"<?php if ($MapType == 'Yandex') print ' selected'; ?>>Yandex</option>
350
+			    <option value="Yandex"<?php if ($MapType == 'Yandex') {
351
+	print ' selected';
352
+}
353
+?>>Yandex</option>
272 354
 			    <?php
273 355
 				}
274 356
 			    ?>
275 357
 			    <?php
276 358
 				    if (isset($globalMapboxToken) && $globalMapboxToken != '') {
277
-					if (!isset($_COOKIE['MapTypeId'])) $MapBoxId = 'default';
278
-					else $MapBoxId = $_COOKIE['MapTypeId'];
359
+					if (!isset($_COOKIE['MapTypeId'])) {
360
+						$MapBoxId = 'default';
361
+					} else {
362
+						$MapBoxId = $_COOKIE['MapTypeId'];
363
+					}
279 364
 			    ?>
280
-			    <option value="Mapbox-default"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'default') print ' selected'; ?>>Mapbox default</option>
281
-			    <option value="Mapbox-mapbox.streets"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.streets') print ' selected'; ?>>Mapbox streets</option>
282
-			    <option value="Mapbox-mapbox.light"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.light') print ' selected'; ?>>Mapbox light</option>
283
-			    <option value="Mapbox-mapbox.dark"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.dark') print ' selected'; ?>>Mapbox dark</option>
284
-			    <option value="Mapbox-mapbox.satellite"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.satellite') print ' selected'; ?>>Mapbox satellite</option>
285
-			    <option value="Mapbox-mapbox.streets-satellite"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.streets-satellite') print ' selected'; ?>>Mapbox streets-satellite</option>
286
-			    <option value="Mapbox-mapbox.streets-basic"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.streets-basic') print ' selected'; ?>>Mapbox streets-basic</option>
287
-			    <option value="Mapbox-mapbox.comic"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.comic') print ' selected'; ?>>Mapbox comic</option>
288
-			    <option value="Mapbox-mapbox.outdoors"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.outdoors') print ' selected'; ?>>Mapbox outdoors</option>
289
-			    <option value="Mapbox-mapbox.pencil"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.pencil') print ' selected'; ?>>Mapbox pencil</option>
290
-			    <option value="Mapbox-mapbox.pirates"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.pirates') print ' selected'; ?>>Mapbox pirates</option>
291
-			    <option value="Mapbox-mapbox.emerald"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.emerald') print ' selected'; ?>>Mapbox emerald</option>
365
+			    <option value="Mapbox-default"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'default') {
366
+	print ' selected';
367
+}
368
+?>>Mapbox default</option>
369
+			    <option value="Mapbox-mapbox.streets"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.streets') {
370
+	print ' selected';
371
+}
372
+?>>Mapbox streets</option>
373
+			    <option value="Mapbox-mapbox.light"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.light') {
374
+	print ' selected';
375
+}
376
+?>>Mapbox light</option>
377
+			    <option value="Mapbox-mapbox.dark"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.dark') {
378
+	print ' selected';
379
+}
380
+?>>Mapbox dark</option>
381
+			    <option value="Mapbox-mapbox.satellite"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.satellite') {
382
+	print ' selected';
383
+}
384
+?>>Mapbox satellite</option>
385
+			    <option value="Mapbox-mapbox.streets-satellite"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.streets-satellite') {
386
+	print ' selected';
387
+}
388
+?>>Mapbox streets-satellite</option>
389
+			    <option value="Mapbox-mapbox.streets-basic"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.streets-basic') {
390
+	print ' selected';
391
+}
392
+?>>Mapbox streets-basic</option>
393
+			    <option value="Mapbox-mapbox.comic"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.comic') {
394
+	print ' selected';
395
+}
396
+?>>Mapbox comic</option>
397
+			    <option value="Mapbox-mapbox.outdoors"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.outdoors') {
398
+	print ' selected';
399
+}
400
+?>>Mapbox outdoors</option>
401
+			    <option value="Mapbox-mapbox.pencil"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.pencil') {
402
+	print ' selected';
403
+}
404
+?>>Mapbox pencil</option>
405
+			    <option value="Mapbox-mapbox.pirates"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.pirates') {
406
+	print ' selected';
407
+}
408
+?>>Mapbox pirates</option>
409
+			    <option value="Mapbox-mapbox.emerald"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.emerald') {
410
+	print ' selected';
411
+}
412
+?>>Mapbox emerald</option>
292 413
 			    <?php
293 414
 				    }
294 415
 			    ?>
295
-			    <option value="OpenStreetMap"<?php if ($MapType == 'OpenStreetMap') print ' selected'; ?>>OpenStreetMap</option>
416
+			    <option value="OpenStreetMap"<?php if ($MapType == 'OpenStreetMap') {
417
+	print ' selected';
418
+}
419
+?>>OpenStreetMap</option>
296 420
 			</select>
297 421
 		    </li>
298 422
 <?php
@@ -300,9 +424,18 @@  discard block
 block discarded – undo
300 424
 ?>
301 425
 		    <li><?php echo _("Type of Terrain:"); ?>
302 426
 			<select  class="selectpicker" onchange="terrainType(this);">
303
-			    <option value="stk"<?php if (!isset($_COOKIE['MapTerrain']) || $_COOKIE['MapTerrain'] == 'stk') print ' selected'; ?>>stk terrain</option>
304
-			    <option value="ellipsoid"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'ellipsoid') print ' selected';?>>ellipsoid</option>
305
-			    <option value="vrterrain"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'vrterrain') print ' selected';?>>vr terrain</option>
427
+			    <option value="stk"<?php if (!isset($_COOKIE['MapTerrain']) || $_COOKIE['MapTerrain'] == 'stk') {
428
+	print ' selected';
429
+}
430
+?>>stk terrain</option>
431
+			    <option value="ellipsoid"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'ellipsoid') {
432
+	print ' selected';
433
+}
434
+?>>ellipsoid</option>
435
+			    <option value="vrterrain"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'vrterrain') {
436
+	print ' selected';
437
+}
438
+?>>vr terrain</option>
306 439
 			</select>
307 440
 		    </li>
308 441
 <?php
@@ -312,18 +445,36 @@  discard block
 block discarded – undo
312 445
     if (!isset($_COOKIE['MapFormat']) || $_COOKIE['MapFormat'] != '3d') {
313 446
 ?>
314 447
 		    
315
-		    <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>
316
-		    <li><div class="checkbox"><label><input type="checkbox" name="flightpath" value="1" onclick="clickFlightPath(this)" <?php if ((isset($_COOKIE['flightpath']) && $_COOKIE['flightpath'] == 'true') || !isset($_COOKIE['flightpath'])) print 'checked'; ?> ><?php echo _("Display flight path"); ?></label></div></li>
317
-		    <li><div class="checkbox"><label><input type="checkbox" name="flightroute" value="1" onclick="clickFlightRoute(this)" <?php if ((isset($_COOKIE['MapRoute']) && $_COOKIE['MapRoute'] == 'true') || !isset($_COOKIE['MapRoute'])) print 'checked'; ?> ><?php echo _("Display flight route on click"); ?></label></div></li>
318
-		    <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>
448
+		    <li><div class="checkbox"><label><input type="checkbox" name="flightpopup" value="1" onclick="clickFlightPopup(this)" <?php if (isset($_COOKIE['flightpopup']) && $_COOKIE['flightpopup'] == 'true') {
449
+	print 'checked';
450
+}
451
+?> ><?php echo _("Display flight info as popup"); ?></label></div></li>
452
+		    <li><div class="checkbox"><label><input type="checkbox" name="flightpath" value="1" onclick="clickFlightPath(this)" <?php if ((isset($_COOKIE['flightpath']) && $_COOKIE['flightpath'] == 'true') || !isset($_COOKIE['flightpath'])) {
453
+	print 'checked';
454
+}
455
+?> ><?php echo _("Display flight path"); ?></label></div></li>
456
+		    <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'])) {
457
+	print 'checked';
458
+}
459
+?> ><?php echo _("Display flight route on click"); ?></label></div></li>
460
+		    <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)) {
461
+	print 'checked';
462
+}
463
+?> ><?php echo _("Planes animate between updates"); ?></label></div></li>
319 464
 <?php
320 465
     }
321 466
 ?>
322
-		    <li><div class="checkbox"><label><input type="checkbox" name="displayairports" value="1" onclick="clickDisplayAirports(this)" <?php if (isset($_COOKIE['displayairports']) && $_COOKIE['displayairports'] == 'true') print 'checked'; ?> ><?php echo _("Display airports on map"); ?></label></div></li>
467
+		    <li><div class="checkbox"><label><input type="checkbox" name="displayairports" value="1" onclick="clickDisplayAirports(this)" <?php if (isset($_COOKIE['displayairports']) && $_COOKIE['displayairports'] == 'true') {
468
+	print 'checked';
469
+}
470
+?> ><?php echo _("Display airports on map"); ?></label></div></li>
323 471
 <?php
324 472
     if (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d') {
325 473
 ?>
326
-		    <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>
474
+		    <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')) {
475
+	print 'checked';
476
+}
477
+?> ><?php echo _("Show mini-map"); ?></label></div></li>
327 478
 <?php
328 479
     }
329 480
 ?>
@@ -332,17 +483,25 @@  discard block
 block discarded – undo
332 483
 			if (function_exists('array_column')) {
333 484
 			    if (array_search(TRUE, array_column($globalSources, 'sourcestats')) !== FALSE) {
334 485
 		    ?>
335
-		    <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>
486
+		    <li><div class="checkbox"><label><input type="checkbox" name="flightpolar" value="1" onclick="clickPolar(this)" <?php if ((isset($_COOKIE['polar']) && $_COOKIE['polar'] == 'true')) {
487
+	print 'checked';
488
+}
489
+?> ><?php echo _("Display polar on map"); ?></label></div></li>
336 490
 		    <?php
337 491
 			    }
338 492
 			} elseif (isset($globalSources)) {
339 493
 			    $dispolar = false;
340 494
 			    foreach ($globalSources as $testsource) {
341
-			        if (isset($globalSources['sourcestats']) && $globalSources['sourcestats'] !== FALSE) $dispolar = true;
495
+			        if (isset($globalSources['sourcestats']) && $globalSources['sourcestats'] !== FALSE) {
496
+			        	$dispolar = true;
497
+			        }
342 498
 			    }
343 499
 			    if ($dispolar) {
344 500
 		    ?>
345
-		    <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>
501
+		    <li><div class="checkbox"><label><input type="checkbox" name="flightpolar" value="1" onclick="clickPolar(this)" <?php if ((isset($_COOKIE['polar']) && $_COOKIE['polar'] == 'true')) {
502
+	print 'checked';
503
+}
504
+?> ><?php echo _("Display polar on map"); ?></label></div></li>
346 505
 		    <?php
347 506
 			    }
348 507
 		        }
@@ -354,12 +513,22 @@  discard block
 block discarded – undo
354 513
 		    <?php
355 514
 		        if (extension_loaded('gd') && function_exists('gd_info')) {
356 515
 		    ?>
357
-		    <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>
516
+		    <li><input type="checkbox" name="aircraftcoloraltitude" value="1" onclick="iconColorAltitude(this)" <?php if (isset($_COOKIE['IconColorAltitude']) && $_COOKIE['IconColorAltitude'] == 'true') {
517
+	print 'checked';
518
+}
519
+?> ><?php echo _("Aircraft icon color based on altitude"); ?></li>
358 520
 		    <?php 
359 521
 			if (!isset($_COOKIE['IconColorAltitude']) || $_COOKIE['IconColorAltitude'] == 'false') {
360 522
 		    ?>
361 523
 		    <li><?php echo _("Aircraft icon color:"); ?>
362
-			<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'; ?>">
524
+			<input type="color" name="aircraftcolor" id="html5colorpicker" onchange="iconColor(aircraftcolor.value);" value="#<?php if (isset($_COOKIE['IconColor'])) {
525
+	print $_COOKIE['IconColor'];
526
+} elseif (isset($globalAircraftIconColor)) {
527
+	print $globalAircraftIconColor;
528
+} else {
529
+	print '1a3151';
530
+}
531
+?>">
363 532
 		    </li>
364 533
 		    <?php
365 534
 			    }
@@ -367,8 +536,22 @@  discard block
 block discarded – undo
367 536
 		    ?>
368 537
 		    <li><?php echo _("Show airport icon at zoom level:"); ?>
369 538
 			<div class="range">
370
-			    <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'; ?>">
371
-			    <output id="range"><?php if (isset($_COOKIE['AirportZoom'])) print $_COOKIE['AirportZoom']; elseif (isset($globalAirportZoom)) print $globalAirportZoom; else print '7'; ?></output>
539
+			    <input type="range" min="0" max="19" step="1" name="airportzoom" onchange="range.value=value;airportDisplayZoom(airportzoom.value);" value="<?php if (isset($_COOKIE['AirportZoom'])) {
540
+	print $_COOKIE['AirportZoom'];
541
+} elseif (isset($globalAirportZoom)) {
542
+	print $globalAirportZoom;
543
+} else {
544
+	print '7';
545
+}
546
+?>">
547
+			    <output id="range"><?php if (isset($_COOKIE['AirportZoom'])) {
548
+	print $_COOKIE['AirportZoom'];
549
+} elseif (isset($globalAirportZoom)) {
550
+	print $globalAirportZoom;
551
+} else {
552
+	print '7';
553
+}
554
+?></output>
372 555
 			</div>
373 556
 		    </li>
374 557
 <?php
@@ -376,22 +559,46 @@  discard block
 block discarded – undo
376 559
 ?>
377 560
 		    <li><?php echo _("Distance unit:"); ?>
378 561
 			<select class="selectpicker" onchange="unitdistance(this);">
379
-			    <option value="km"<?php if ((!isset($_COOKIE['unitdistance']) && (!isset($globalUnitDistance) || (isset($globalUnitDistance) && $globalUnitDistance == 'km'))) || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'km')) echo ' selected'; ?>>km</option>
380
-			    <option value="nm"<?php if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'nm') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'nm')) echo ' selected'; ?>>nm</option>
381
-			    <option value="mi"<?php if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'mi') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'mi')) echo ' selected'; ?>>mi</option>
562
+			    <option value="km"<?php if ((!isset($_COOKIE['unitdistance']) && (!isset($globalUnitDistance) || (isset($globalUnitDistance) && $globalUnitDistance == 'km'))) || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'km')) {
563
+	echo ' selected';
564
+}
565
+?>>km</option>
566
+			    <option value="nm"<?php if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'nm') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'nm')) {
567
+	echo ' selected';
568
+}
569
+?>>nm</option>
570
+			    <option value="mi"<?php if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'mi') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'mi')) {
571
+	echo ' selected';
572
+}
573
+?>>mi</option>
382 574
 		        </select>
383 575
 		    </li>
384 576
 		    <li><?php echo _("Altitude unit:"); ?>
385 577
 			<select class="selectpicker" onchange="unitaltitude(this);">
386
-			    <option value="m"<?php if ((!isset($_COOKIE['unitaltitude']) && (!isset($globalUnitAltitude) || (isset($globalUnitAltitude) && $globalUnitAltitude == 'm'))) || (isset($_COOKIE['unitaltitude']) && $_COOKIE['unitaltitude'] == 'm')) echo ' selected'; ?>>m</option>
387
-			    <option value="feet"<?php if ((!isset($_COOKIE['unitaltitude']) && isset($globalUnitAltitude) && $globalUnitAltitude == 'feet') || (isset($_COOKIE['unitaltitude']) && $_COOKIE['unitaltitude'] == 'feet')) echo ' selected'; ?>>feet</option>
578
+			    <option value="m"<?php if ((!isset($_COOKIE['unitaltitude']) && (!isset($globalUnitAltitude) || (isset($globalUnitAltitude) && $globalUnitAltitude == 'm'))) || (isset($_COOKIE['unitaltitude']) && $_COOKIE['unitaltitude'] == 'm')) {
579
+	echo ' selected';
580
+}
581
+?>>m</option>
582
+			    <option value="feet"<?php if ((!isset($_COOKIE['unitaltitude']) && isset($globalUnitAltitude) && $globalUnitAltitude == 'feet') || (isset($_COOKIE['unitaltitude']) && $_COOKIE['unitaltitude'] == 'feet')) {
583
+	echo ' selected';
584
+}
585
+?>>feet</option>
388 586
 		        </select>
389 587
 		    </li>
390 588
 		    <li><?php echo _("Speed unit:"); ?>
391 589
 			<select class="selectpicker" onchange="unitspeed(this);">
392
-			    <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>
393
-			    <option value="mph"<?php if ((!isset($_COOKIE['unitspeed']) && isset($globalUnitSpeed) && $globalUnitSpeed == 'mph') || (isset($_COOKIE['unitspeed']) && $_COOKIE['unitspeed'] == 'mph')) echo ' selected'; ?>>mph</option>
394
-			    <option value="knots"<?php if ((!isset($_COOKIE['unitspeed']) && isset($globalUnitSpeed) && $globalUnitSpeed == 'knots') || (isset($_COOKIE['unitspeed']) && $_COOKIE['unitspeed'] == 'knots')) echo ' selected'; ?>>knots</option>
590
+			    <option value="kmh"<?php if ((!isset($_COOKIE['unitspeed']) && (!isset($globalUnitSpeed) || (isset($globalUnitSpeed) && $globalUnitSpeed == 'kmh'))) || (isset($_COOKIE['unitspeed']) && $_COOKIE['unitspeed'] == 'kmh')) {
591
+	echo ' selected';
592
+}
593
+?>>km/h</option>
594
+			    <option value="mph"<?php if ((!isset($_COOKIE['unitspeed']) && isset($globalUnitSpeed) && $globalUnitSpeed == 'mph') || (isset($_COOKIE['unitspeed']) && $_COOKIE['unitspeed'] == 'mph')) {
595
+	echo ' selected';
596
+}
597
+?>>mph</option>
598
+			    <option value="knots"<?php if ((!isset($_COOKIE['unitspeed']) && isset($globalUnitSpeed) && $globalUnitSpeed == 'knots') || (isset($_COOKIE['unitspeed']) && $_COOKIE['unitspeed'] == 'knots')) {
599
+	echo ' selected';
600
+}
601
+?>>knots</option>
395 602
 		        </select>
396 603
 		    </li>
397 604
 
@@ -406,9 +613,18 @@  discard block
 block discarded – undo
406 613
 		    <?php
407 614
 			if (((isset($globalVATSIM) && $globalVATSIM) || isset($globalIVAO) && $globalIVAO || isset($globalphpVMS) && $globalphpVMS) && (!isset($globalMapVAchoose) || $globalMapVAchoose)) {
408 615
 		    ?>
409
-			<?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 } ?>
410
-			<?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 } ?>
411
-			<?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 } ?>
616
+			<?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'])) {
617
+	print 'checked';
618
+}
619
+?> ><?php echo _("Display VATSIM data"); ?></li><?php } ?>
620
+			<?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'])) {
621
+	print 'checked';
622
+}
623
+?> ><?php echo _("Display IVAO data"); ?></li><?php } ?>
624
+			<?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'])) {
625
+	print 'checked';
626
+}
627
+?> ><?php echo _("Display phpVMS data"); ?></li><?php } ?>
412 628
 		    <?php
413 629
 			}
414 630
 		    ?>
@@ -416,10 +632,16 @@  discard block
 block discarded – undo
416 632
 			if (!(isset($globalVATSIM) && $globalVATSIM) && !(isset($globalIVAO) && $globalIVAO) && !(isset($globalphpVMS) && $globalphpVMS) && isset($globalSBS1) && $globalSBS1 && isset($globalAPRS) && $globalAPRS && (!isset($globalMapchoose) || $globalMapchoose)) {
417 633
 		    ?>
418 634
 			<?php if (isset($globalSBS1) && $globalSBS1) { ?>
419
-			    <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>
635
+			    <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'])) {
636
+	print 'checked';
637
+}
638
+?> ><?php echo _("Display ADS-B data"); ?></label></div></li>
420 639
 			<?php } ?>
421 640
 			<?php if (isset($globalAPRS) && $globalAPRS) { ?>
422
-			    <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>
641
+			    <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'])) {
642
+	print 'checked';
643
+}
644
+?> ><?php echo _("Display APRS data"); ?></label></div></li>
423 645
 			<?php } ?>
424 646
 		    <?php
425 647
 			}
@@ -431,7 +653,9 @@  discard block
 block discarded – undo
431 653
 				$Spotter = new Spotter();
432 654
 				foreach($Spotter->getAllAirlineNames() as $airline) {
433 655
 					$airline_name = $airline['airline_name'];
434
-					if (strlen($airline_name) > 30) $airline_name = substr($airline_name,0,30).'...';
656
+					if (strlen($airline_name) > 30) {
657
+						$airline_name = substr($airline_name,0,30).'...';
658
+					}
435 659
 					if (isset($_COOKIE['Airlines']) && in_array($airline['airline_icao'],explode(',',$_COOKIE['Airlines']))) {
436 660
 						echo '<option value="'.$airline['airline_icao'].'" selected>'.$airline_name.'</option>';
437 661
 					} else {
@@ -466,10 +690,22 @@  discard block
 block discarded – undo
466 690
 		    ?>
467 691
 		    <li><?php echo _("Display airlines of type:"); ?><br/>
468 692
 			<select class="selectpicker" onchange="airlinestype(this);">
469
-			    <option value="all"<?php if (!isset($_COOKIE['airlinestype']) || $_COOKIE['airlinestype'] == 'all' || $_COOKIE['airlinestype'] == '') echo ' selected'; ?>><?php echo _("All"); ?></option>
470
-			    <option value="passenger"<?php if (isset($_COOKIE['airlinestype']) && $_COOKIE['airlinestype'] == 'passenger') echo ' selected'; ?>><?php echo _("Passenger"); ?></option>
471
-			    <option value="cargo"<?php if (isset($_COOKIE['airlinestype']) && $_COOKIE['airlinestype'] == 'cargo') echo ' selected'; ?>><?php echo _("Cargo"); ?></option>
472
-			    <option value="military"<?php if (isset($_COOKIE['airlinestype']) && $_COOKIE['airlinestype'] == 'military') echo ' selected'; ?>><?php echo _("Military"); ?></option>
693
+			    <option value="all"<?php if (!isset($_COOKIE['airlinestype']) || $_COOKIE['airlinestype'] == 'all' || $_COOKIE['airlinestype'] == '') {
694
+	echo ' selected';
695
+}
696
+?>><?php echo _("All"); ?></option>
697
+			    <option value="passenger"<?php if (isset($_COOKIE['airlinestype']) && $_COOKIE['airlinestype'] == 'passenger') {
698
+	echo ' selected';
699
+}
700
+?>><?php echo _("Passenger"); ?></option>
701
+			    <option value="cargo"<?php if (isset($_COOKIE['airlinestype']) && $_COOKIE['airlinestype'] == 'cargo') {
702
+	echo ' selected';
703
+}
704
+?>><?php echo _("Cargo"); ?></option>
705
+			    <option value="military"<?php if (isset($_COOKIE['airlinestype']) && $_COOKIE['airlinestype'] == 'military') {
706
+	echo ' selected';
707
+}
708
+?>><?php echo _("Military"); ?></option>
473 709
 			</select>
474 710
 		    </li>
475 711
 		    <?php
@@ -477,7 +713,10 @@  discard block
 block discarded – undo
477 713
 		    ?>
478 714
 		    <li>
479 715
 			<?php echo _("Display flight with ident:"); ?>
480
-			<input type="text" name="identfilter" onchange="identfilter();" id="identfilter" value="<?php if (isset($_COOKIE['identfilter'])) print $_COOKIE['identfilter']; ?>" />
716
+			<input type="text" name="identfilter" onchange="identfilter();" id="identfilter" value="<?php if (isset($_COOKIE['identfilter'])) {
717
+	print $_COOKIE['identfilter'];
718
+}
719
+?>" />
481 720
 		    </li>
482 721
 		</ul>
483 722
 	    </form>
@@ -493,7 +732,10 @@  discard block
 block discarded – undo
493 732
 	    <h1 class="sidebar-header"><?php echo _("Satellites"); ?><span class="sidebar-close"><i class="fa fa-caret-left"></i></span></h1>
494 733
 	    <form>
495 734
 		<ul>
496
-		    <li><div class="checkbox"><label><input type="checkbox" name="displayiss" value="1" onclick="clickDisplayISS(this)" <?php if (isset($_COOKIE['displayiss']) && $_COOKIE['displayiss'] == 'true') print 'checked'; ?> ><?php echo _("Show ISS, Tiangong-1 and Tiangong-2 on map"); ?></label></div></li>
735
+		    <li><div class="checkbox"><label><input type="checkbox" name="displayiss" value="1" onclick="clickDisplayISS(this)" <?php if (isset($_COOKIE['displayiss']) && $_COOKIE['displayiss'] == 'true') {
736
+	print 'checked';
737
+}
738
+?> ><?php echo _("Show ISS, Tiangong-1 and Tiangong-2 on map"); ?></label></div></li>
497 739
 		    <li><?php echo _("Type:"); ?>
498 740
 			<select class="selectpicker" multiple onchange="sattypes(this);">
499 741
 			    <?php
@@ -501,25 +743,45 @@  discard block
 block discarded – undo
501 743
 				$types = $Satellite->get_tle_types();
502 744
 				foreach ($types as $type) {
503 745
 					$type_name = $type['tle_type'];
504
-					if ($type_name == 'musson') $type_name = 'Russian LEO Navigation';
505
-					else if ($type_name == 'nnss') $type_name = 'Navi Navigation Satellite System';
506
-					else if ($type_name == 'sbas') $type_name = 'Satellite-Based Augmentation System';
507
-					else if ($type_name == 'glo-ops') $type_name = 'Glonass Operational';
508
-					else if ($type_name == 'gps-ops') $type_name = 'GPS Operational';
509
-					else if ($type_name == 'argos') $type_name = 'ARGOS Data Collection System';
510
-					else if ($type_name == 'tdrss') $type_name = 'Tracking and Data Relay Satellite System';
511
-					else if ($type_name == 'sarsat') $type_name = 'Search & Rescue';
512
-					else if ($type_name == 'dmc') $type_name = 'Disaster Monitoring';
513
-					else if ($type_name == 'resource') $type_name = 'Earth Resources';
514
-					else if ($type_name == 'stations') $type_name = 'Space Stations';
515
-					else if ($type_name == 'geo') $type_name = 'Geostationary';
516
-					else if ($type_name == 'amateur') $type_name = 'Amateur Radio';
517
-					else if ($type_name == 'x-comm') $type_name = 'Experimental';
518
-					else if ($type_name == 'other-comm') $type_name = 'Other Comm';
519
-					else if ($type_name == 'science') $type_name = 'Space & Earth Science';
520
-					else if ($type_name == 'military') $type_name = 'Miscellaneous Military';
521
-					else if ($type_name == 'radar') $type_name = 'Radar Calibration';
522
-					else if ($type_name == 'tle-new') $type_name = 'Last 30 days launches';
746
+					if ($type_name == 'musson') {
747
+						$type_name = 'Russian LEO Navigation';
748
+					} else if ($type_name == 'nnss') {
749
+						$type_name = 'Navi Navigation Satellite System';
750
+					} else if ($type_name == 'sbas') {
751
+						$type_name = 'Satellite-Based Augmentation System';
752
+					} else if ($type_name == 'glo-ops') {
753
+						$type_name = 'Glonass Operational';
754
+					} else if ($type_name == 'gps-ops') {
755
+						$type_name = 'GPS Operational';
756
+					} else if ($type_name == 'argos') {
757
+						$type_name = 'ARGOS Data Collection System';
758
+					} else if ($type_name == 'tdrss') {
759
+						$type_name = 'Tracking and Data Relay Satellite System';
760
+					} else if ($type_name == 'sarsat') {
761
+						$type_name = 'Search & Rescue';
762
+					} else if ($type_name == 'dmc') {
763
+						$type_name = 'Disaster Monitoring';
764
+					} else if ($type_name == 'resource') {
765
+						$type_name = 'Earth Resources';
766
+					} else if ($type_name == 'stations') {
767
+						$type_name = 'Space Stations';
768
+					} else if ($type_name == 'geo') {
769
+						$type_name = 'Geostationary';
770
+					} else if ($type_name == 'amateur') {
771
+						$type_name = 'Amateur Radio';
772
+					} else if ($type_name == 'x-comm') {
773
+						$type_name = 'Experimental';
774
+					} else if ($type_name == 'other-comm') {
775
+						$type_name = 'Other Comm';
776
+					} else if ($type_name == 'science') {
777
+						$type_name = 'Space & Earth Science';
778
+					} else if ($type_name == 'military') {
779
+						$type_name = 'Miscellaneous Military';
780
+					} else if ($type_name == 'radar') {
781
+						$type_name = 'Radar Calibration';
782
+					} else if ($type_name == 'tle-new') {
783
+						$type_name = 'Last 30 days launches';
784
+					}
523 785
 					
524 786
 					if (isset($_COOKIE['sattypes']) && in_array($type['tle_type'],explode(',',$_COOKIE['sattypes']))) {
525 787
 						print '<option value="'.$type['tle_type'].'" selected>'.$type_name.'</option>';
Please login to merge, or discard this patch.
manufacturer-detailed.php 1 patch
Braces   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@  discard block
 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];
@@ -47,7 +47,9 @@  discard block
 block discarded – undo
47 47
 		print '<select name="aircraft_manufacturer" class="selectpicker" data-live-search="true">';
48 48
 		$Stats = new Stats();
49 49
 		$all_manufacturers = $Stats->getAllManufacturers();
50
-		if (empty($all_manufacturers)) $all_manufacturers = $Spotter->getAllManufacturers();
50
+		if (empty($all_manufacturers)) {
51
+			$all_manufacturers = $Spotter->getAllManufacturers();
52
+		}
51 53
 		foreach($all_manufacturers as $all_manufacturer)
52 54
 		{
53 55
 			if($_GET['aircraft_manufacturer'] == strtolower(str_replace(" ", "-", $all_manufacturer['aircraft_manufacturer'])))
Please login to merge, or discard this patch.
manufacturer-statistics-route.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 '<select name="aircraft_manufacturer" class="selectpicker" data-live-search="true">';
24 24
 	$Stats = new Stats();
25 25
 	$all_manufacturers = $Stats->getAllManufacturers();
26
-	if (empty($all_manufacturers)) $all_manufacturers = $Spotter->getAllManufacturers();
26
+	if (empty($all_manufacturers)) {
27
+		$all_manufacturers = $Spotter->getAllManufacturers();
28
+	}
27 29
 	foreach($all_manufacturers as $all_manufacturer)
28 30
 	{
29 31
 		if($_GET['aircraft_manufacturer'] == strtolower(str_replace(" ", "-", $all_manufacturer['aircraft_manufacturer'])))
Please login to merge, or discard this patch.
manufacturer-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 '<select name="aircraft_manufacturer" class="selectpicker" data-live-search="true">';
24 24
 	$Stats = new Stats();
25 25
 	$all_manufacturers = $Stats->getAllManufacturers();
26
-	if (empty($all_manufacturers)) $all_manufacturers = $Spotter->getAllManufacturers();
26
+	if (empty($all_manufacturers)) {
27
+		$all_manufacturers = $Spotter->getAllManufacturers();
28
+	}
27 29
 	foreach($all_manufacturers as $all_manufacturer)
28 30
 	{
29 31
 		if($_GET['aircraft_manufacturer'] == strtolower(str_replace(" ", "-", $all_manufacturer['aircraft_manufacturer'])))
Please login to merge, or discard this patch.
manufacturer-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 '<select name="aircraft_manufacturer" class="selectpicker" data-live-search="true">';
24 24
 	$Stats = new Stats();
25 25
 	$all_manufacturers = $Stats->getAllManufacturers();
26
-	if (empty($all_manufacturers)) $all_manufacturers = $Spotter->getAllManufacturers();
26
+	if (empty($all_manufacturers)) {
27
+		$all_manufacturers = $Spotter->getAllManufacturers();
28
+	}
27 29
 	foreach($all_manufacturers as $all_manufacturer)
28 30
 	{
29 31
 		if($_GET['aircraft_manufacturer'] == strtolower(str_replace(" ", "-", $all_manufacturer['aircraft_manufacturer'])))
Please login to merge, or discard this patch.