Completed
Push — master ( 994fb6...2e5736 )
by Yannick
06:03
created
live-czml.php 1 patch
Braces   +56 added lines, -19 removed lines patch added patch discarded remove patch
@@ -40,22 +40,43 @@  discard block
 block discarded – undo
40 40
 }
41 41
 header('Content-Type: text/javascript');
42 42
 
43
-if (!isset($globalJsonCompress)) $compress = true;
44
-else $compress = $globalJsonCompress;
43
+if (!isset($globalJsonCompress)) {
44
+	$compress = true;
45
+} else {
46
+	$compress = $globalJsonCompress;
47
+}
45 48
 
46 49
 $from_archive = false;
47 50
 $min = false;
48 51
 $allhistory = false;
49 52
 $filter['source'] = array();
50
-if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') $filter['source'] = array_merge($filter['source'],array('vatsimtxt'));
51
-if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') $filter['source'] = array_merge($filter['source'],array('whazzup'));
52
-if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') $filter['source'] = array_merge($filter['source'],array('phpvmacars'));
53
-if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') $filter['source'] = array_merge($filter['source'],array('sbs'));
54
-if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') $filter['source'] = array_merge($filter['source'],array('aprs'));
55
-if (isset($_COOKIE['filter_ident']) && $_COOKIE['filter_ident'] != '') $filter['ident'] = filter_var($_COOKIE['filter_ident'],FILTER_SANITIZE_STRING);
56
-if (isset($_COOKIE['filter_Airlines']) && $_COOKIE['filter_Airlines'] != '') $filter['airlines'] = filter_var_array(explode(',',$_COOKIE['filter_Airlines']),FILTER_SANITIZE_STRING);
57
-if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') $filter['source_aprs'] = filter_var_array(explode(',',$_COOKIE['filter_Sources']),FILTER_SANITIZE_STRING);
58
-if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') $filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'],FILTER_SANITIZE_STRING);
53
+if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') {
54
+	$filter['source'] = array_merge($filter['source'],array('vatsimtxt'));
55
+}
56
+if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') {
57
+	$filter['source'] = array_merge($filter['source'],array('whazzup'));
58
+}
59
+if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') {
60
+	$filter['source'] = array_merge($filter['source'],array('phpvmacars'));
61
+}
62
+if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') {
63
+	$filter['source'] = array_merge($filter['source'],array('sbs'));
64
+}
65
+if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') {
66
+	$filter['source'] = array_merge($filter['source'],array('aprs'));
67
+}
68
+if (isset($_COOKIE['filter_ident']) && $_COOKIE['filter_ident'] != '') {
69
+	$filter['ident'] = filter_var($_COOKIE['filter_ident'],FILTER_SANITIZE_STRING);
70
+}
71
+if (isset($_COOKIE['filter_Airlines']) && $_COOKIE['filter_Airlines'] != '') {
72
+	$filter['airlines'] = filter_var_array(explode(',',$_COOKIE['filter_Airlines']),FILTER_SANITIZE_STRING);
73
+}
74
+if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') {
75
+	$filter['source_aprs'] = filter_var_array(explode(',',$_COOKIE['filter_Sources']),FILTER_SANITIZE_STRING);
76
+}
77
+if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') {
78
+	$filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'],FILTER_SANITIZE_STRING);
79
+}
59 80
 /*
60 81
 if (isset($globalMapPopup) && !$globalMapPopup && !(isset($_COOKIE['flightpopup']) && $_COOKIE['flightpopup'] == 'true')) {
61 82
 	$min = true;
@@ -132,8 +153,12 @@  discard block
 block discarded – undo
132 153
 	} else {
133 154
 		$flightcnt = $SpotterLive->getLiveSpotterCount($filter);
134 155
 	}
135
-	if ($flightcnt == '') $flightcnt = 0;
136
-} else $flightcnt = 0;
156
+	if ($flightcnt == '') {
157
+		$flightcnt = 0;
158
+	}
159
+	} else {
160
+	$flightcnt = 0;
161
+}
137 162
 
138 163
 $sqltime = round(microtime(true)-$begintime,2);
139 164
 $minitime = time();
@@ -155,7 +180,9 @@  discard block
 block discarded – undo
155 180
 $j = 0;
156 181
 $prev_flightaware_id = '';
157 182
 $speed = 1;
158
-if (isset($archivespeed)) $speed = $archivespeed;
183
+if (isset($archivespeed)) {
184
+	$speed = $archivespeed;
185
+}
159 186
 $output = '[';
160 187
 $output .= '{"id" : "document", "name" : "fam","version" : "1.0"';
161 188
 //	$output .= ',"clock": {"interval" : "'.date("c",time()-$globalLiveInterval).'/'.date("c").'","currentTime" : "'.date("c",time() - $globalLiveInterval).'","multiplier" : 1,"range" : "LOOP_STOP","step": "SYSTEM_CLOCK_MULTIPLIER"}';
@@ -296,8 +323,12 @@  discard block
 block discarded – undo
296 323
 				}
297 324
 			} else {
298 325
 				$output .= '"model": {"gltf" : "'.$globalURL.'/models/Cesium_Air.glb","scale" : 1.0,"minimumPixelSize": 20 },';
299
-				if ($spotter_item['aircraft_shadow'] != '') $output .= '"aircraft_shadow": "'.$spotter_item['aircraft_shadow'].'",';
300
-				if ($spotter_item['aircraft_icao'] != '') $output .= '"aircraft_icao": "'.$spotter_item['aircraft_icao'].'",';
326
+				if ($spotter_item['aircraft_shadow'] != '') {
327
+					$output .= '"aircraft_shadow": "'.$spotter_item['aircraft_shadow'].'",';
328
+				}
329
+				if ($spotter_item['aircraft_icao'] != '') {
330
+					$output .= '"aircraft_icao": "'.$spotter_item['aircraft_icao'].'",';
331
+				}
301 332
 			}
302 333
 	//		$output .= '"heightReference": "CLAMP_TO_GROUND",';
303 334
 			$output .= '"heightReference": "RELATIVE_TO_GROUND",';
@@ -308,8 +339,12 @@  discard block
 block discarded – undo
308 339
 	//		$output .= '"interpolationDegree" : 5,';
309 340
 	//		$output .= '"epoch" : "'.date("c",strtotime($spotter_item['date'])).'", ';
310 341
 			$output .= '"cartographicDegrees": [';
311
-			if ($minitime > strtotime($spotter_item['date'])) $minitime = strtotime($spotter_item['date']);
312
-			if ($maxitime < strtotime($spotter_item['date'])) $maxitime = strtotime($spotter_item['date']);
342
+			if ($minitime > strtotime($spotter_item['date'])) {
343
+				$minitime = strtotime($spotter_item['date']);
344
+			}
345
+			if ($maxitime < strtotime($spotter_item['date'])) {
346
+				$maxitime = strtotime($spotter_item['date']);
347
+			}
313 348
 			$output .= '"'.date("c",strtotime($spotter_item['date'])).'", ';
314 349
 			$output .= $spotter_item['longitude'].', ';
315 350
 			$output .= $spotter_item['latitude'].', ';
@@ -323,7 +358,9 @@  discard block
 block discarded – undo
323 358
 			//$orientation .= '"'.date("c",strtotime($spotter_item['date'])).'",'.$quat['x'].','.$quat['y'].','.$quat['z'].','.$quat['w'];
324 359
 		} else {
325 360
 			$output .= ',"'.date("c",strtotime($spotter_item['date'])).'", ';
326
-			if ($maxitime < strtotime($spotter_item['date'])) $maxitime = strtotime($spotter_item['date']);
361
+			if ($maxitime < strtotime($spotter_item['date'])) {
362
+				$maxitime = strtotime($spotter_item['date']);
363
+			}
327 364
 			if ($spotter_item['ground_speed'] == 0) {
328 365
 				$output .= $prevlong.', ';
329 366
 				$output .= $prevlat.', ';
Please login to merge, or discard this patch.
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.
require/class.SpotterImport.php 1 patch
Braces   +318 added lines, -113 removed lines patch added patch discarded remove patch
@@ -53,7 +53,9 @@  discard block
 block discarded – undo
53 53
 	$dbc = $this->db;
54 54
 	$this->all_flights[$id]['schedule_check'] = true;
55 55
 	if ($globalSchedulesFetch) {
56
-	if ($globalDebug) echo 'Getting schedule info...'."\n";
56
+	if ($globalDebug) {
57
+		echo 'Getting schedule info...'."\n";
58
+	}
57 59
 	$Spotter = new Spotter($dbc);
58 60
 	$Schedule = new Schedule($dbc);
59 61
 	$Translation = new Translation($dbc);
@@ -63,7 +65,9 @@  discard block
 block discarded – undo
63 65
 	    if ($Schedule->checkSchedule($operator) == 0) {
64 66
 		$schedule = $Schedule->fetchSchedule($operator);
65 67
 		if (count($schedule) > 0 && isset($schedule['DepartureTime']) && isset($schedule['ArrivalTime'])) {
66
-		    if ($globalDebug) echo "-> Schedule info for ".$operator." (".$ident.")\n";
68
+		    if ($globalDebug) {
69
+		    	echo "-> Schedule info for ".$operator." (".$ident.")\n";
70
+		    }
67 71
 		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('departure_airport_time' => $schedule['DepartureTime']));
68 72
 		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('arrival_airport_time' => $schedule['ArrivalTime']));
69 73
 		    // Should also check if route schedule = route from DB
@@ -72,7 +76,9 @@  discard block
 block discarded – undo
72 76
 			    $airport_icao = $Spotter->getAirportIcao($schedule['DepartureAirportIATA']);
73 77
 			    if ($airport_icao != '') {
74 78
 				$this->all_flights[$id]['departure_airport'] = $airport_icao;
75
-				if ($globalDebug) echo "-> Change departure airport to ".$airport_icao." for ".$ident."\n";
79
+				if ($globalDebug) {
80
+					echo "-> Change departure airport to ".$airport_icao." for ".$ident."\n";
81
+				}
76 82
 			    }
77 83
 			}
78 84
 		    }
@@ -81,7 +87,9 @@  discard block
 block discarded – undo
81 87
 			    $airport_icao = $Spotter->getAirportIcao($schedule['ArrivalAirportIATA']);
82 88
 			    if ($airport_icao != '') {
83 89
 				$this->all_flights[$id]['arrival_airport'] = $airport_icao;
84
-				if ($globalDebug) echo "-> Change arrival airport to ".$airport_icao." for ".$ident."\n";
90
+				if ($globalDebug) {
91
+					echo "-> Change arrival airport to ".$airport_icao." for ".$ident."\n";
92
+				}
85 93
 			    }
86 94
 			}
87 95
 		    }
@@ -109,7 +117,9 @@  discard block
 block discarded – undo
109 117
 
110 118
     public function checkAll() {
111 119
 	global $globalDebug;
112
-	if ($globalDebug) echo "Update last seen flights data...\n";
120
+	if ($globalDebug) {
121
+		echo "Update last seen flights data...\n";
122
+	}
113 123
 	foreach ($this->all_flights as $key => $flight) {
114 124
 	    if (isset($this->all_flights[$key]['id'])) {
115 125
 		//echo $this->all_flights[$key]['id'].' - '.$this->all_flights[$key]['latitude'].'  '.$this->all_flights[$key]['longitude']."\n";
@@ -122,24 +132,32 @@  discard block
 block discarded – undo
122 132
 
123 133
     public function arrival($key) {
124 134
 	global $globalClosestMinDist, $globalDebug;
125
-	if ($globalDebug) echo 'Update arrival...'."\n";
135
+	if ($globalDebug) {
136
+		echo 'Update arrival...'."\n";
137
+	}
126 138
 	$Spotter = new Spotter($this->db);
127 139
         $airport_icao = '';
128 140
         $airport_time = '';
129
-        if (!isset($globalClosestMinDist) || $globalClosestMinDist == '') $globalClosestMinDist = 50;
141
+        if (!isset($globalClosestMinDist) || $globalClosestMinDist == '') {
142
+        	$globalClosestMinDist = 50;
143
+        }
130 144
 	if ($this->all_flights[$key]['latitude'] != '' && $this->all_flights[$key]['longitude'] != '') {
131 145
 	    $closestAirports = $Spotter->closestAirports($this->all_flights[$key]['latitude'],$this->all_flights[$key]['longitude'],$globalClosestMinDist);
132 146
     	    if (isset($closestAirports[0])) {
133 147
         	if (isset($this->all_flights[$key]['arrival_airport']) && $this->all_flights[$key]['arrival_airport'] == $closestAirports[0]['icao']) {
134 148
         	    $airport_icao = $closestAirports[0]['icao'];
135 149
         	    $airport_time = $this->all_flights[$key]['datetime'];
136
-        	    if ($globalDebug) echo "---++ Find arrival airport. airport_icao : ".$airport_icao."\n";
150
+        	    if ($globalDebug) {
151
+        	    	echo "---++ Find arrival airport. airport_icao : ".$airport_icao."\n";
152
+        	    }
137 153
         	} elseif (count($closestAirports > 1) && isset($this->all_flights[$key]['arrival_airport']) && $this->all_flights[$key]['arrival_airport'] != '') {
138 154
         	    foreach ($closestAirports as $airport) {
139 155
         		if ($this->all_flights[$key]['arrival_airport'] == $airport['icao']) {
140 156
         		    $airport_icao = $airport['icao'];
141 157
         		    $airport_time = $this->all_flights[$key]['datetime'];
142
-        		    if ($globalDebug) echo "---++ Find arrival airport. airport_icao : ".$airport_icao."\n";
158
+        		    if ($globalDebug) {
159
+        		    	echo "---++ Find arrival airport. airport_icao : ".$airport_icao."\n";
160
+        		    }
143 161
         		    break;
144 162
         		}
145 163
         	    }
@@ -147,14 +165,20 @@  discard block
 block discarded – undo
147 165
         		$airport_icao = $closestAirports[0]['icao'];
148 166
         		$airport_time = $this->all_flights[$key]['datetime'];
149 167
         	} else {
150
-        		if ($globalDebug) echo "----- Can't find arrival airport. Airport altitude : ".$closestAirports[0]['altitude'].' - flight altitude : '.$this->all_flights[$key]['altitude_real']."\n";
168
+        		if ($globalDebug) {
169
+        			echo "----- Can't find arrival airport. Airport altitude : ".$closestAirports[0]['altitude'].' - flight altitude : '.$this->all_flights[$key]['altitude_real']."\n";
170
+        		}
151 171
         	}
152 172
     	    } else {
153
-    		    if ($globalDebug) echo "----- No Airport near last coord. Latitude : ".$this->all_flights[$key]['latitude'].' - Longitude : '.$this->all_flights[$key]['longitude'].' - MinDist : '.$globalClosestMinDist."\n";
173
+    		    if ($globalDebug) {
174
+    		    	echo "----- No Airport near last coord. Latitude : ".$this->all_flights[$key]['latitude'].' - Longitude : '.$this->all_flights[$key]['longitude'].' - MinDist : '.$globalClosestMinDist."\n";
175
+    		    }
154 176
     	    }
155 177
 
156 178
         } else {
157
-        	if ($globalDebug) echo "---- No latitude or longitude. Ident : ".$this->all_flights[$key]['ident']."\n";
179
+        	if ($globalDebug) {
180
+        		echo "---- No latitude or longitude. Ident : ".$this->all_flights[$key]['ident']."\n";
181
+        	}
158 182
         }
159 183
         return array('airport_icao' => $airport_icao,'airport_time' => $airport_time);
160 184
     }
@@ -164,12 +188,16 @@  discard block
 block discarded – undo
164 188
     public function del() {
165 189
 	global $globalDebug;
166 190
 	// Delete old infos
167
-	if ($globalDebug) echo 'Delete old values and update latest data...'."\n";
191
+	if ($globalDebug) {
192
+		echo 'Delete old values and update latest data...'."\n";
193
+	}
168 194
 	foreach ($this->all_flights as $key => $flight) {
169 195
     	    if (isset($flight['lastupdate'])) {
170 196
         	if ($flight['lastupdate'] < (time()-3000)) {
171 197
             	    if (isset($this->all_flights[$key]['id'])) {
172
-            		if ($globalDebug) echo "--- Delete old values with id ".$this->all_flights[$key]['id']."\n";
198
+            		if ($globalDebug) {
199
+            			echo "--- Delete old values with id ".$this->all_flights[$key]['id']."\n";
200
+            		}
173 201
 			/*
174 202
 			$SpotterLive = new SpotterLive();
175 203
             		$SpotterLive->deleteLiveSpotterDataById($this->all_flights[$key]['id']);
@@ -179,7 +207,9 @@  discard block
 block discarded – undo
179 207
             		$Spotter = new Spotter($this->db);
180 208
             		if ($this->all_flights[$key]['latitude'] != '' && $this->all_flights[$key]['longitude'] != '') {
181 209
 				$result = $Spotter->updateLatestSpotterData($this->all_flights[$key]['id'],$this->all_flights[$key]['ident'],$this->all_flights[$key]['latitude'],$this->all_flights[$key]['longitude'],$this->all_flights[$key]['altitude'],$this->all_flights[$key]['ground'],$this->all_flights[$key]['speed'],$this->all_flights[$key]['datetime'],$real_arrival['airport_icao'],$real_arrival['airport_time']);
182
-				if ($globalDebug && $result != 'success') echo '!!! ERROR : '.$result."\n";
210
+				if ($globalDebug && $result != 'success') {
211
+					echo '!!! ERROR : '.$result."\n";
212
+				}
183 213
 			}
184 214
 			// Put in archive
185 215
 //			$Spotter->db = null;
@@ -193,8 +223,10 @@  discard block
 block discarded – undo
193 223
     public function add($line) {
194 224
 	global $globalPilotIdAccept, $globalAirportAccept, $globalAirlineAccept, $globalAirlineIgnore, $globalAirportIgnore, $globalFork, $globalDistanceIgnore, $globalDaemon, $globalSBS1update, $globalDebug, $globalIVAO, $globalVATSIM, $globalphpVMS, $globalCoordMinChange, $globalDebugTimeElapsed, $globalCenterLatitude, $globalCenterLongitude, $globalBeta, $globalSourcesupdate, $globalAirlinesSource, $globalVAM, $globalAllFlights;
195 225
 	//if (!isset($globalDebugTimeElapsed) || $globalDebugTimeElapsed == '') $globalDebugTimeElapsed = FALSE;
196
-	if (!isset($globalCoordMinChange) || $globalCoordMinChange == '') $globalCoordMinChange = '0.02';
197
-/*
226
+	if (!isset($globalCoordMinChange) || $globalCoordMinChange == '') {
227
+		$globalCoordMinChange = '0.02';
228
+	}
229
+	/*
198 230
 	$Spotter = new Spotter();
199 231
 	$dbc = $Spotter->db;
200 232
 	$SpotterLive = new SpotterLive($dbc);
@@ -222,11 +254,15 @@  discard block
 block discarded – undo
222 254
 		if (isset($line['sourcestats']) && $line['sourcestats'] == TRUE) {
223 255
 		    $current_date = date('Y-m-d');
224 256
 		    $source = $line['source_name'];
225
-		    if ($source == '' || $line['format_source'] == 'aprs') $source = $line['format_source'];
257
+		    if ($source == '' || $line['format_source'] == 'aprs') {
258
+		    	$source = $line['format_source'];
259
+		    }
226 260
 		    if (!isset($this->stats[$current_date][$source]['msg'])) {
227 261
 		    	$this->stats[$current_date][$source]['msg']['date'] = time();
228 262
 		    	$this->stats[$current_date][$source]['msg']['nb'] = 1;
229
-		    } else $this->stats[$current_date][$source]['msg']['nb'] += 1;
263
+		    } else {
264
+		    	$this->stats[$current_date][$source]['msg']['nb'] += 1;
265
+		    }
230 266
 		}
231 267
 		
232 268
 		/*
@@ -242,8 +278,11 @@  discard block
 block discarded – undo
242 278
 		//$this->db = $dbc;
243 279
 
244 280
 		$hex = trim($line['hex']);
245
-	        if (!isset($line['id'])) $id = trim($line['hex']);
246
-	        else $id = trim($line['id']);
281
+	        if (!isset($line['id'])) {
282
+	        	$id = trim($line['hex']);
283
+	        } else {
284
+	        	$id = trim($line['id']);
285
+	        }
247 286
 		
248 287
 		//print_r($this->all_flights);
249 288
 		if (!isset($this->all_flights[$id]['hex']) && ctype_xdigit($hex)) {
@@ -258,13 +297,20 @@  discard block
 block discarded – undo
258 297
 			$Spotter = new Spotter($this->db);
259 298
 			$aircraft_icao = $Spotter->getAllAircraftType($hex);
260 299
 			$Spotter->db = null;
261
-			if ($globalDebugTimeElapsed) echo 'Time elapsed for update getallaircrattype : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
300
+			if ($globalDebugTimeElapsed) {
301
+				echo 'Time elapsed for update getallaircrattype : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
302
+			}
262 303
 
263 304
 			if ($aircraft_icao == '' && isset($line['aircraft_type'])) {
264
-			    if ($line['aircraft_type'] == 'PARA_GLIDER') $aircraft_icao = 'GLID';
265
-			    elseif ($line['aircraft_type'] == 'HELICOPTER_ROTORCRAFT') $aircraft_icao = 'UHEL';
266
-			    elseif ($line['aircraft_type'] == 'TOW_PLANE') $aircraft_icao = 'TOWPLANE';
267
-			    elseif ($line['aircraft_type'] == 'POWERED_AIRCRAFT') $aircraft_icao = 'POWAIRC';
305
+			    if ($line['aircraft_type'] == 'PARA_GLIDER') {
306
+			    	$aircraft_icao = 'GLID';
307
+			    } elseif ($line['aircraft_type'] == 'HELICOPTER_ROTORCRAFT') {
308
+			    	$aircraft_icao = 'UHEL';
309
+			    } elseif ($line['aircraft_type'] == 'TOW_PLANE') {
310
+			    	$aircraft_icao = 'TOWPLANE';
311
+			    } elseif ($line['aircraft_type'] == 'POWERED_AIRCRAFT') {
312
+			    	$aircraft_icao = 'POWAIRC';
313
+			    }
268 314
 			}
269 315
 			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('aircraft_icao' => $aircraft_icao));
270 316
 		    } else if (isset($line['aircraft_name'])) {
@@ -272,29 +318,47 @@  discard block
 block discarded – undo
272 318
 			$Spotter = new Spotter($this->db);
273 319
 			$aircraft_icao = $Spotter->getAircraftIcao($line['aircraft_name']);
274 320
 			$Spotter->db = null;
275
-			if ($aircraft_icao != '') $this->all_flights[$id] = array_merge($this->all_flights[$id],array('aircraft_icao' => $aircraft_icao));
276
-			else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('aircraft_icao' => 'NA'));
277
-		    } else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('aircraft_icao' => $line['aircraft_icao']));
321
+			if ($aircraft_icao != '') {
322
+				$this->all_flights[$id] = array_merge($this->all_flights[$id],array('aircraft_icao' => $aircraft_icao));
323
+			} else {
324
+				$this->all_flights[$id] = array_merge($this->all_flights[$id],array('aircraft_icao' => 'NA'));
325
+			}
326
+		    } else {
327
+		    	$this->all_flights[$id] = array_merge($this->all_flights[$id],array('aircraft_icao' => $line['aircraft_icao']));
328
+		    }
278 329
 		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('ident' => '','departure_airport' => '', 'arrival_airport' => '','latitude' => '', 'longitude' => '', 'speed' => '', 'altitude' => '','altitude_real' => '', 'heading' => '','departure_airport_time' => '','arrival_airport_time' => '','squawk' => '','route_stop' => '','registration' => '','pilot_id' => '','pilot_name' => '','waypoints' => '','ground' => '0', 'format_source' => '','source_name' => '','over_country' => '','verticalrate' => '','noarchive' => false,'putinarchive' => true));
279 330
 		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('lastupdate' => time()));
280 331
 		    if (!isset($line['id'])) {
281
-			if (!isset($globalDaemon)) $globalDaemon = TRUE;
282
-//			if (isset($line['format_source']) && ($line['format_source'] == 'sbs' || $line['format_source'] == 'tsv' || $line['format_source'] == 'raw') && $globalDaemon) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident'].'-'.date('YmdGi')));
332
+			if (!isset($globalDaemon)) {
333
+				$globalDaemon = TRUE;
334
+			}
335
+			//			if (isset($line['format_source']) && ($line['format_source'] == 'sbs' || $line['format_source'] == 'tsv' || $line['format_source'] == 'raw') && $globalDaemon) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident'].'-'.date('YmdGi')));
283 336
 //			if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw' || $line['format_source'] === 'deltadbtxt' || $line['format_source'] === 'planeupdatefaa' || $line['format_source'] === 'aprs') && $globalDaemon) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.date('YmdHi')));
284
-			if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw' || $line['format_source'] === 'deltadbtxt' || $line['format_source'] === 'planeupdatefaa' || $line['format_source'] === 'aprs' || $line['format_source'] === 'aircraftlistjson' || $line['format_source'] === 'radarvirtueljson')) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.date('YmdHi')));
337
+			if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw' || $line['format_source'] === 'deltadbtxt' || $line['format_source'] === 'planeupdatefaa' || $line['format_source'] === 'aprs' || $line['format_source'] === 'aircraftlistjson' || $line['format_source'] === 'radarvirtueljson')) {
338
+				$this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.date('YmdHi')));
339
+			}
285 340
 		        //else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident']));
286
-		     } else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $line['id']));
341
+		     } else {
342
+		     	$this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $line['id']));
343
+		     }
287 344
 
288
-		    if ($globalDebug) echo "*********** New aircraft hex : ".$hex." ***********\n";
289
-		    if ($globalAllFlights !== FALSE) $dataFound = true;
345
+		    if ($globalDebug) {
346
+		    	echo "*********** New aircraft hex : ".$hex." ***********\n";
347
+		    }
348
+		    if ($globalAllFlights !== FALSE) {
349
+		    	$dataFound = true;
350
+		    }
290 351
 		}
291 352
 		
292 353
 		if (isset($line['datetime']) && preg_match('/^(\d{4}(?:\-\d{2}){2} \d{2}(?:\:\d{2}){2})$/',$line['datetime'])) {
293 354
 		    if (!isset($this->all_flights[$id]['datetime']) || strtotime($line['datetime']) >= strtotime($this->all_flights[$id]['datetime'])) {
294 355
 			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('datetime' => $line['datetime']));
295 356
 		    } else {
296
-				if (strtotime($line['datetime']) == strtotime($this->all_flights[$id]['datetime']) && $globalDebug) echo "!!! Date is the same as previous data for ".$this->all_flights[$id]['hex']." - format : ".$line['format_source']."\n";
297
-				elseif (strtotime($line['datetime']) > strtotime($this->all_flights[$id]['datetime']) && $globalDebug) echo "!!! Date previous latest data (".$line['datetime']." > ".$this->all_flights[$id]['datetime'].") !!! for ".$this->all_flights[$id]['hex']." - format : ".$line['format_source']."\n";
357
+				if (strtotime($line['datetime']) == strtotime($this->all_flights[$id]['datetime']) && $globalDebug) {
358
+					echo "!!! Date is the same as previous data for ".$this->all_flights[$id]['hex']." - format : ".$line['format_source']."\n";
359
+				} elseif (strtotime($line['datetime']) > strtotime($this->all_flights[$id]['datetime']) && $globalDebug) {
360
+					echo "!!! Date previous latest data (".$line['datetime']." > ".$this->all_flights[$id]['datetime'].") !!! for ".$this->all_flights[$id]['hex']." - format : ".$line['format_source']."\n";
361
+				}
298 362
 				/*
299 363
 				echo strtotime($line['datetime']).' > '.strtotime($this->all_flights[$id]['datetime']);
300 364
 				print_r($this->all_flights[$id]);
@@ -302,7 +366,9 @@  discard block
 block discarded – undo
302 366
 				*/
303 367
 				return '';
304 368
 		    }
305
-		} else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('datetime' => date('Y-m-d H:i:s')));
369
+		} else {
370
+			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('datetime' => date('Y-m-d H:i:s')));
371
+		}
306 372
 
307 373
 		if (isset($line['registration']) && $line['registration'] != '' && $line['registration'] != 'z.NO-REG') {
308 374
 		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('registration' => $line['registration']));
@@ -323,15 +389,25 @@  discard block
 block discarded – undo
323 389
 			$timeelapsed = microtime(true);
324 390
             		$Spotter = new Spotter($this->db);
325 391
             		$fromsource = NULL;
326
-            		if (isset($globalAirlinesSource) && $globalAirlinesSource != '') $fromsource = $globalAirlinesSource;
327
-            		elseif (isset($line['format_source']) && $line['format_source'] == 'vatsimtxt') $fromsource = 'vatsim';
328
-			elseif (isset($line['format_source']) && $line['format_source'] == 'whazzup') $fromsource = 'ivao';
329
-			elseif (isset($globalVATSIM) && $globalVATSIM) $fromsource = 'vatsim';
330
-			elseif (isset($globalIVAO) && $globalIVAO) $fromsource = 'ivao';
392
+            		if (isset($globalAirlinesSource) && $globalAirlinesSource != '') {
393
+            			$fromsource = $globalAirlinesSource;
394
+            		} elseif (isset($line['format_source']) && $line['format_source'] == 'vatsimtxt') {
395
+            			$fromsource = 'vatsim';
396
+            		} elseif (isset($line['format_source']) && $line['format_source'] == 'whazzup') {
397
+				$fromsource = 'ivao';
398
+			} elseif (isset($globalVATSIM) && $globalVATSIM) {
399
+				$fromsource = 'vatsim';
400
+			} elseif (isset($globalIVAO) && $globalIVAO) {
401
+				$fromsource = 'ivao';
402
+			}
331 403
             		$result = $Spotter->updateIdentSpotterData($this->all_flights[$id]['id'],$this->all_flights[$id]['ident'],$fromsource);
332
-			if ($globalDebug && $result != 'success') echo '!!! ERROR : '.$result."\n";
404
+			if ($globalDebug && $result != 'success') {
405
+				echo '!!! ERROR : '.$result."\n";
406
+			}
333 407
 			$Spotter->db = null;
334
-			if ($globalDebugTimeElapsed) echo 'Time elapsed for update identspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
408
+			if ($globalDebugTimeElapsed) {
409
+				echo 'Time elapsed for update identspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
410
+			}
335 411
 		    }
336 412
 
337 413
 /*
@@ -342,7 +418,9 @@  discard block
 block discarded – undo
342 418
 		        else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident']));
343 419
 		     } else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $line['id']));
344 420
   */
345
-		    if (!isset($this->all_flights[$id]['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident']));
421
+		    if (!isset($this->all_flights[$id]['id'])) {
422
+		    	$this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident']));
423
+		    }
346 424
 
347 425
 		    //$putinarchive = true;
348 426
 		    if (isset($line['departure_airport_time']) && $line['departure_airport_time'] != 0) {
@@ -359,7 +437,9 @@  discard block
 block discarded – undo
359 437
 				$line['departure_airport_icao'] = $Spotter->getAirportIcao($line['departure_airport_iata']);
360 438
 				$line['arrival_airport_icao'] = $Spotter->getAirportIcao($line['arrival_airport_iata']);
361 439
 		    		$this->all_flights[$id] = array_merge($this->all_flights[$id],array('departure_airport' => $line['departure_airport_icao'],'arrival_airport' => $line['arrival_airport_icao'],'route_stop' => ''));
362
-				if ($globalDebugTimeElapsed) echo 'Time elapsed for update getAirportICAO : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
440
+				if ($globalDebugTimeElapsed) {
441
+					echo 'Time elapsed for update getAirportICAO : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
442
+				}
363 443
 
364 444
 		    } elseif (!isset($line['format_source']) || $line['format_source'] != 'aprs') {
365 445
 			$timeelapsed = microtime(true);
@@ -372,7 +452,9 @@  discard block
 block discarded – undo
372 452
 				$Translation->db = null;
373 453
 			}
374 454
 			$Spotter->db = null;
375
-			if ($globalDebugTimeElapsed) echo 'Time elapsed for update getrouteinfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
455
+			if ($globalDebugTimeElapsed) {
456
+				echo 'Time elapsed for update getrouteinfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
457
+			}
376 458
 
377 459
 			if (isset($route['fromairport_icao']) && isset($route['toairport_icao'])) {
378 460
 			    //if ($route['FromAirport_ICAO'] != $route['ToAirport_ICAO']) {
@@ -381,9 +463,13 @@  discard block
 block discarded – undo
381 463
 		    		$this->all_flights[$id] = array_merge($this->all_flights[$id],array('departure_airport' => $route['fromairport_icao'],'arrival_airport' => $route['toairport_icao'],'route_stop' => $route['routestop']));
382 464
 		    	    }
383 465
 			}
384
-			if (!isset($globalFork)) $globalFork = TRUE;
466
+			if (!isset($globalFork)) {
467
+				$globalFork = TRUE;
468
+			}
385 469
 			if (!$globalIVAO && !$globalVATSIM && !$globalphpVMS && !$globalVAM && (!isset($line['format_source']) || $line['format_source'] != 'aprs')) {
386
-				if (!isset($this->all_flights[$id]['schedule_check']) || $this->all_flights[$id]['schedule_check'] === false) $this->get_Schedule($id,trim($line['ident']));
470
+				if (!isset($this->all_flights[$id]['schedule_check']) || $this->all_flights[$id]['schedule_check'] === false) {
471
+					$this->get_Schedule($id,trim($line['ident']));
472
+				}
387 473
 			}
388 474
 		    }
389 475
 		}
@@ -399,16 +485,23 @@  discard block
 block discarded – undo
399 485
 		    // use datetime
400 486
 			$speed = $distance/(time() - $this->all_flights[$id]['time_last_coord']);
401 487
 			$speed = $speed*3.6;
402
-			if ($speed < 1000) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('speed' => round($speed)));
403
-  			if ($globalDebug) echo "ø Calculated Speed for ".$this->all_flights[$id]['hex']." : ".$speed." - distance : ".$distance."\n";
488
+			if ($speed < 1000) {
489
+				$this->all_flights[$id] = array_merge($this->all_flights[$id],array('speed' => round($speed)));
490
+			}
491
+  			if ($globalDebug) {
492
+  				echo "ø Calculated Speed for ".$this->all_flights[$id]['hex']." : ".$speed." - distance : ".$distance."\n";
493
+  			}
404 494
 		    }
405 495
 		}
406 496
 
407 497
 
408 498
 
409 499
 	        if (isset($line['latitude']) && isset($line['longitude']) && $line['latitude'] != '' && $line['longitude'] != '' && is_numeric($line['latitude']) && is_numeric($line['longitude'])) {
410
-	    	    if (isset($this->all_flights[$id]['time_last_coord'])) $timediff = round(time()-$this->all_flights[$id]['time_last_coord']);
411
-	    	    else unset($timediff);
500
+	    	    if (isset($this->all_flights[$id]['time_last_coord'])) {
501
+	    	    	$timediff = round(time()-$this->all_flights[$id]['time_last_coord']);
502
+	    	    } else {
503
+	    	    	unset($timediff);
504
+	    	    }
412 505
 	    	    if ($this->tmd > 5 || (isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS) || (isset($globalVAM) && $globalVAM) || !isset($timediff) || $timediff > 800 || ($timediff > 10 && isset($this->all_flights[$id]['latitude']) && isset($this->all_flights[$id]['longitude']) && $Common->withinThreshold($timediff,$Common->distance($line['latitude'],$line['longitude'],$this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],'m')))) {
413 506
 			if (isset($this->all_flights[$id]['archive_latitude']) && isset($this->all_flights[$id]['archive_longitude']) && isset($this->all_flights[$id]['livedb_latitude']) && isset($this->all_flights[$id]['livedb_longitude'])) {
414 507
 			    if (!$Common->checkLine($this->all_flights[$id]['archive_latitude'],$this->all_flights[$id]['archive_longitude'],$this->all_flights[$id]['livedb_latitude'],$this->all_flights[$id]['livedb_longitude'],$line['latitude'],$line['longitude'])) {
@@ -416,21 +509,31 @@  discard block
 block discarded – undo
416 509
 				$this->all_flights[$id]['archive_longitude'] = $line['longitude'];
417 510
 				$this->all_flights[$id]['putinarchive'] = true;
418 511
 				
419
-				if ($globalDebug) echo "\n".' ------- Check Country.... ';
512
+				if ($globalDebug) {
513
+					echo "\n".' ------- Check Country.... ';
514
+				}
420 515
 				$timeelapsed = microtime(true);
421 516
 				$Spotter = new Spotter($this->db);
422 517
 				$all_country = $Spotter->getCountryFromLatitudeLongitude($line['latitude'],$line['longitude']);
423
-				if (!empty($all_country)) $this->all_flights[$id]['over_country'] = $all_country['iso2'];
518
+				if (!empty($all_country)) {
519
+					$this->all_flights[$id]['over_country'] = $all_country['iso2'];
520
+				}
424 521
 				$Spotter->db = null;
425
-				if ($globalDebugTimeElapsed) echo 'Time elapsed for update getCountryFromlatitudeLongitude : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
522
+				if ($globalDebugTimeElapsed) {
523
+					echo 'Time elapsed for update getCountryFromlatitudeLongitude : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
524
+				}
426 525
 				$this->tmd = 0;
427
-				if ($globalDebug) echo 'FOUND : '.$this->all_flights[$id]['over_country'].' ---------------'."\n";
526
+				if ($globalDebug) {
527
+					echo 'FOUND : '.$this->all_flights[$id]['over_country'].' ---------------'."\n";
528
+				}
428 529
 			    }
429 530
 			}
430 531
 
431 532
 			if (isset($line['latitude']) && $line['latitude'] != '' && $line['latitude'] != 0 && $line['latitude'] < 91 && $line['latitude'] > -90) {
432 533
 			    //if (!isset($this->all_flights[$id]['latitude']) || $this->all_flights[$id]['latitude'] == '' || abs($this->all_flights[$id]['latitude']-$line['latitude']) < 3 || $line['format_source'] != 'sbs' || time() - $this->all_flights[$id]['lastupdate'] > 30) {
433
-				if (!isset($this->all_flights[$id]['archive_latitude'])) $this->all_flights[$id]['archive_latitude'] = $line['latitude'];
534
+				if (!isset($this->all_flights[$id]['archive_latitude'])) {
535
+					$this->all_flights[$id]['archive_latitude'] = $line['latitude'];
536
+				}
434 537
 				if (!isset($this->all_flights[$id]['livedb_latitude']) || abs($this->all_flights[$id]['livedb_latitude']-$line['latitude']) > $globalCoordMinChange || $this->all_flights[$id]['format_source'] == 'aprs') {
435 538
 				    $this->all_flights[$id]['livedb_latitude'] = $line['latitude'];
436 539
 				    $dataFound = true;
@@ -452,9 +555,13 @@  discard block
 block discarded – undo
452 555
 			    */
453 556
 			}
454 557
 			if (isset($line['longitude']) && $line['longitude'] != '' && $line['longitude'] != 0 && $line['longitude'] < 360 && $line['longitude'] > -180) {
455
-			    if ($line['longitude'] > 180) $line['longitude'] = $line['longitude'] - 360;
558
+			    if ($line['longitude'] > 180) {
559
+			    	$line['longitude'] = $line['longitude'] - 360;
560
+			    }
456 561
 			    //if (!isset($this->all_flights[$id]['longitude']) || $this->all_flights[$id]['longitude'] == ''  || abs($this->all_flights[$id]['longitude']-$line['longitude']) < 2 || $line['format_source'] != 'sbs' || time() - $this->all_flights[$id]['lastupdate'] > 30) {
457
-				if (!isset($this->all_flights[$id]['archive_longitude'])) $this->all_flights[$id]['archive_longitude'] = $line['longitude'];
562
+				if (!isset($this->all_flights[$id]['archive_longitude'])) {
563
+					$this->all_flights[$id]['archive_longitude'] = $line['longitude'];
564
+				}
458 565
 				if (!isset($this->all_flights[$id]['livedb_longitude']) || abs($this->all_flights[$id]['livedb_longitude']-$line['longitude']) > $globalCoordMinChange || $this->all_flights[$id]['format_source'] == 'aprs') {
459 566
 				    $this->all_flights[$id]['livedb_longitude'] = $line['longitude'];
460 567
 				    $dataFound = true;
@@ -485,7 +592,9 @@  discard block
 block discarded – undo
485 592
 		    }
486 593
 		}
487 594
 		if (isset($line['last_update']) && $line['last_update'] != '') {
488
-		    if (isset($this->all_flights[$id]['last_update']) && $this->all_flights[$id]['last_update'] != $line['last_update']) $dataFound = true;
595
+		    if (isset($this->all_flights[$id]['last_update']) && $this->all_flights[$id]['last_update'] != $line['last_update']) {
596
+		    	$dataFound = true;
597
+		    }
489 598
 		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('last_update' => $line['last_update']));
490 599
 		}
491 600
 		if (isset($line['verticalrate']) && $line['verticalrate'] != '') {
@@ -507,11 +616,17 @@  discard block
 block discarded – undo
507 616
 			// Here we force archive of flight because after ground it's a new one (or should be)
508 617
 			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('addedSpotter' => 0));
509 618
 			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('forcenew' => 1));
510
-			if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw') && $globalDaemon) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.date('YmdGi')));
511
-		        elseif (isset($line['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $line['id']));
512
-			elseif (isset($this->all_flights[$id]['ident'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident']));
619
+			if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw') && $globalDaemon) {
620
+				$this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.date('YmdGi')));
621
+			} elseif (isset($line['id'])) {
622
+		        	$this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $line['id']));
623
+		        } elseif (isset($this->all_flights[$id]['ident'])) {
624
+				$this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident']));
625
+			}
626
+		    }
627
+		    if ($line['ground'] != 1) {
628
+		    	$line['ground'] = 0;
513 629
 		    }
514
-		    if ($line['ground'] != 1) $line['ground'] = 0;
515 630
 		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('ground' => $line['ground']));
516 631
 		    //$dataFound = true;
517 632
 		}
@@ -519,28 +634,40 @@  discard block
 block discarded – undo
519 634
 		    if (isset($this->all_flights[$id]['squawk']) && $this->all_flights[$id]['squawk'] != '7500' && $this->all_flights[$id]['squawk'] != '7600' && $this->all_flights[$id]['squawk'] != '7700' && isset($this->all_flights[$id]['id'])) {
520 635
 			    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('squawk' => $line['squawk']));
521 636
 			    $highlight = '';
522
-			    if ($this->all_flights[$id]['squawk'] == '7500') $highlight = 'Squawk 7500 : Hijack at '.date('Y-m-d G:i').' UTC';
523
-			    if ($this->all_flights[$id]['squawk'] == '7600') $highlight = 'Squawk 7600 : Lost Comm (radio failure) at '.date('Y-m-d G:i').' UTC';
524
-			    if ($this->all_flights[$id]['squawk'] == '7700') $highlight = 'Squawk 7700 : Emergency at '.date('Y-m-d G:i').' UTC';
637
+			    if ($this->all_flights[$id]['squawk'] == '7500') {
638
+			    	$highlight = 'Squawk 7500 : Hijack at '.date('Y-m-d G:i').' UTC';
639
+			    }
640
+			    if ($this->all_flights[$id]['squawk'] == '7600') {
641
+			    	$highlight = 'Squawk 7600 : Lost Comm (radio failure) at '.date('Y-m-d G:i').' UTC';
642
+			    }
643
+			    if ($this->all_flights[$id]['squawk'] == '7700') {
644
+			    	$highlight = 'Squawk 7700 : Emergency at '.date('Y-m-d G:i').' UTC';
645
+			    }
525 646
 			    if ($highlight != '') {
526 647
 				$timeelapsed = microtime(true);
527 648
 				$Spotter = new Spotter($this->db);
528 649
 				$Spotter->setHighlightFlight($this->all_flights[$id]['id'],$highlight);
529 650
 				$Spotter->db = null;
530
-				if ($globalDebugTimeElapsed) echo 'Time elapsed for update sethighlightflight : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
651
+				if ($globalDebugTimeElapsed) {
652
+					echo 'Time elapsed for update sethighlightflight : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
653
+				}
531 654
 
532 655
 				$this->all_flights[$id]['putinarchive'] = true;
533 656
 				//$putinarchive = true;
534 657
 				//$highlight = '';
535 658
 			    }
536 659
 			    
537
-		    } else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('squawk' => $line['squawk']));
660
+		    } else {
661
+		    	$this->all_flights[$id] = array_merge($this->all_flights[$id],array('squawk' => $line['squawk']));
662
+		    }
538 663
 		    //$dataFound = true;
539 664
 		}
540 665
 
541 666
 		if (isset($line['altitude']) && $line['altitude'] != '') {
542 667
 		    //if (!isset($this->all_flights[$id]['altitude']) || $this->all_flights[$id]['altitude'] == '' || ($this->all_flights[$id]['altitude'] > 0 && $line['altitude'] != 0)) {
543
-			if (abs(round($line['altitude']/100)-$this->all_flights[$id]['altitude']) > 2) $this->all_flights[$id]['putinarchive'] = true;
668
+			if (abs(round($line['altitude']/100)-$this->all_flights[$id]['altitude']) > 2) {
669
+				$this->all_flights[$id]['putinarchive'] = true;
670
+			}
544 671
 			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('altitude' => round($line['altitude']/100)));
545 672
 			$this->all_flights[$id] = array_merge($this->all_flights[$id],array('altitude_real' => $line['altitude']));
546 673
 			//$dataFound = true;
@@ -552,21 +679,30 @@  discard block
 block discarded – undo
552 679
 		}
553 680
 		
554 681
 		if (isset($line['heading']) && $line['heading'] != '') {
555
-		    if (abs($this->all_flights[$id]['heading']-round($line['heading'])) > 2) $this->all_flights[$id]['putinarchive'] = true;
682
+		    if (abs($this->all_flights[$id]['heading']-round($line['heading'])) > 2) {
683
+		    	$this->all_flights[$id]['putinarchive'] = true;
684
+		    }
556 685
 		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('heading' => round($line['heading'])));
557 686
 		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('heading_fromsrc' => true));
558 687
 		    //$dataFound = true;
559 688
   		} elseif (!isset($this->all_flights[$id]['heading_fromsrc']) && isset($this->all_flights[$id]['archive_latitude']) && $this->all_flights[$id]['archive_latitude'] != $this->all_flights[$id]['latitude'] && isset($this->all_flights[$id]['archive_longitude']) && $this->all_flights[$id]['archive_longitude'] != $this->all_flights[$id]['longitude']) {
560 689
   		    $heading = $Common->getHeading($this->all_flights[$id]['archive_latitude'],$this->all_flights[$id]['archive_longitude'],$this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude']);
561 690
 		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('heading' => round($heading)));
562
-		    if (abs($this->all_flights[$id]['heading']-round($heading)) > 2) $this->all_flights[$id]['putinarchive'] = true;
563
-  		    if ($globalDebug) echo "ø Calculated Heading for ".$this->all_flights[$id]['hex']." : ".$heading."\n";
691
+		    if (abs($this->all_flights[$id]['heading']-round($heading)) > 2) {
692
+		    	$this->all_flights[$id]['putinarchive'] = true;
693
+		    }
694
+  		    if ($globalDebug) {
695
+  		    	echo "ø Calculated Heading for ".$this->all_flights[$id]['hex']." : ".$heading."\n";
696
+  		    }
564 697
   		} elseif (isset($this->all_flights[$id]['format_source']) && $this->all_flights[$id]['format_source'] == 'ACARS') {
565 698
   		    // If not enough messages and ACARS set heading to 0
566 699
   		    $this->all_flights[$id] = array_merge($this->all_flights[$id],array('heading' => 0));
567 700
   		}
568
-		if (isset($globalSourcesupdate) && $globalSourcesupdate != '' && isset($this->all_flights[$id]['lastupdate']) && time()-$this->all_flights[$id]['lastupdate'] < $globalSourcesupdate) $dataFound = false;
569
-		elseif (isset($globalSBS1update) && $globalSBS1update != '' && isset($this->all_flights[$id]['lastupdate']) && time()-$this->all_flights[$id]['lastupdate'] < $globalSBS1update) $dataFound = false;
701
+		if (isset($globalSourcesupdate) && $globalSourcesupdate != '' && isset($this->all_flights[$id]['lastupdate']) && time()-$this->all_flights[$id]['lastupdate'] < $globalSourcesupdate) {
702
+			$dataFound = false;
703
+		} elseif (isset($globalSBS1update) && $globalSBS1update != '' && isset($this->all_flights[$id]['lastupdate']) && time()-$this->all_flights[$id]['lastupdate'] < $globalSBS1update) {
704
+			$dataFound = false;
705
+		}
570 706
 
571 707
 //		print_r($this->all_flights[$id]);
572 708
 		//gets the callsign from the last hour
@@ -581,23 +717,36 @@  discard block
 block discarded – undo
581 717
 			    //echo $this->all_flights[$id]['id'].' - '.$this->all_flights[$id]['addedSpotter']."\n";
582 718
 			    //$last_hour_ident = Spotter->getIdentFromLastHour($this->all_flights[$id]['ident']);
583 719
 			    if (!isset($this->all_flights[$id]['forcenew']) || $this->all_flights[$id]['forcenew'] == 0) {
584
-				if ($globalDebug) echo "Check if aircraft is already in DB...";
720
+				if ($globalDebug) {
721
+					echo "Check if aircraft is already in DB...";
722
+				}
585 723
 				$timeelapsed = microtime(true);
586 724
 				$SpotterLive = new SpotterLive($this->db);
587 725
 				if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw' || $line['format_source'] === 'deltadbtxt' || $line['format_source'] === 'planeupdatefaa' || $line['format_source'] === 'aprs' || $line['format_source'] === 'aircraftlistjson' || $line['format_source'] === 'radarvirtueljson')) {
588 726
 				    $recent_ident = $SpotterLive->checkModeSRecent($this->all_flights[$id]['hex']);
589
-				    if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkModeSRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
727
+				    if ($globalDebugTimeElapsed) {
728
+				    	echo 'Time elapsed for update checkModeSRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
729
+				    }
590 730
 				} elseif (isset($line['id'])) {
591 731
 				    $recent_ident = $SpotterLive->checkIdRecent($line['id']);
592
-				    if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
732
+				    if ($globalDebugTimeElapsed) {
733
+				    	echo 'Time elapsed for update checkIdRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
734
+				    }
593 735
 				} elseif (isset($this->all_flights[$id]['ident']) && $this->all_flights[$id]['ident'] != '') {
594 736
 				    $recent_ident = $SpotterLive->checkIdentRecent($this->all_flights[$id]['ident']);
595
-				    if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdentRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
596
-				} else $recent_ident = '';
737
+				    if ($globalDebugTimeElapsed) {
738
+				    	echo 'Time elapsed for update checkIdentRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
739
+				    }
740
+				} else {
741
+					$recent_ident = '';
742
+				}
597 743
 				$SpotterLive->db=null;
598 744
 
599
-				if ($globalDebug && $recent_ident == '') echo " Not in DB.\n";
600
-				elseif ($globalDebug && $recent_ident != '') echo " Already in DB.\n";
745
+				if ($globalDebug && $recent_ident == '') {
746
+					echo " Not in DB.\n";
747
+				} elseif ($globalDebug && $recent_ident != '') {
748
+					echo " Already in DB.\n";
749
+				}
601 750
 			    } else {
602 751
 				$recent_ident = '';
603 752
 				$this->all_flights[$id] = array_merge($this->all_flights[$id],array('forcenew' => 0));
@@ -605,7 +754,9 @@  discard block
 block discarded – undo
605 754
 			    //if there was no aircraft with the same callsign within the last hour and go post it into the archive
606 755
 			    if($recent_ident == "")
607 756
 			    {
608
-				if ($globalDebug) echo "\o/ Add ".$this->all_flights[$id]['ident']." in archive DB : ";
757
+				if ($globalDebug) {
758
+					echo "\o/ Add ".$this->all_flights[$id]['ident']." in archive DB : ";
759
+				}
609 760
 				if ($this->all_flights[$id]['departure_airport'] == "") { $this->all_flights[$id]['departure_airport'] = "NA"; }
610 761
 				if ($this->all_flights[$id]['arrival_airport'] == "") { $this->all_flights[$id]['arrival_airport'] = "NA"; }
611 762
 				//adds the spotter data for the archive
@@ -649,26 +800,44 @@  discard block
 block discarded – undo
649 800
 				
650 801
 				if (!$ignoreImport) {
651 802
 				    $highlight = '';
652
-				    if ($this->all_flights[$id]['squawk'] == '7500') $highlight = 'Squawk 7500 : Hijack';
653
-				    if ($this->all_flights[$id]['squawk'] == '7600') $highlight = 'Squawk 7600 : Lost Comm (radio failure)';
654
-				    if ($this->all_flights[$id]['squawk'] == '7700') $highlight = 'Squawk 7700 : Emergency';
655
-				    if (!isset($this->all_flights[$id]['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.date('YmdHi')));
803
+				    if ($this->all_flights[$id]['squawk'] == '7500') {
804
+				    	$highlight = 'Squawk 7500 : Hijack';
805
+				    }
806
+				    if ($this->all_flights[$id]['squawk'] == '7600') {
807
+				    	$highlight = 'Squawk 7600 : Lost Comm (radio failure)';
808
+				    }
809
+				    if ($this->all_flights[$id]['squawk'] == '7700') {
810
+				    	$highlight = 'Squawk 7700 : Emergency';
811
+				    }
812
+				    if (!isset($this->all_flights[$id]['id'])) {
813
+				    	$this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.date('YmdHi')));
814
+				    }
656 815
 				    $timeelapsed = microtime(true);
657 816
 				    $Spotter = new Spotter($this->db);
658 817
 				    $result = $Spotter->addSpotterData($this->all_flights[$id]['id'], $this->all_flights[$id]['ident'], $this->all_flights[$id]['aircraft_icao'], $this->all_flights[$id]['departure_airport'], $this->all_flights[$id]['arrival_airport'], $this->all_flights[$id]['latitude'], $this->all_flights[$id]['longitude'], $this->all_flights[$id]['waypoints'], $this->all_flights[$id]['altitude'], $this->all_flights[$id]['heading'], $this->all_flights[$id]['speed'], $this->all_flights[$id]['datetime'], $this->all_flights[$id]['departure_airport_time'], $this->all_flights[$id]['arrival_airport_time'],$this->all_flights[$id]['squawk'],$this->all_flights[$id]['route_stop'],$highlight,$this->all_flights[$id]['hex'],$this->all_flights[$id]['registration'],$this->all_flights[$id]['pilot_id'],$this->all_flights[$id]['pilot_name'],$this->all_flights[$id]['verticalrate'],$this->all_flights[$id]['ground'],$this->all_flights[$id]['format_source'],$this->all_flights[$id]['source_name']);
659 818
 				    $Spotter->db = null;
660
-				    if ($globalDebug && isset($result)) echo $result."\n";
661
-				    if ($globalDebugTimeElapsed) echo 'Time elapsed for update addspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
819
+				    if ($globalDebug && isset($result)) {
820
+				    	echo $result."\n";
821
+				    }
822
+				    if ($globalDebugTimeElapsed) {
823
+				    	echo 'Time elapsed for update addspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
824
+				    }
662 825
 				    
663 826
 				    // Add source stat in DB
664 827
 				    $Stats = new Stats($this->db);
665 828
 				    if (!empty($this->stats)) {
666
-					if ($globalDebug) echo 'Add source stats : ';
829
+					if ($globalDebug) {
830
+						echo 'Add source stats : ';
831
+					}
667 832
 				        foreach($this->stats as $date => $data) {
668 833
 					    foreach($data as $source => $sourced) {
669 834
 					        //print_r($sourced);
670
-				    	        if (isset($sourced['polar'])) echo $Stats->addStatSource(json_encode($sourced['polar']),$source,'polar',$date);
671
-				    	        if (isset($sourced['hist'])) echo $Stats->addStatSource(json_encode($sourced['hist']),$source,'hist',$date);
835
+				    	        if (isset($sourced['polar'])) {
836
+				    	        	echo $Stats->addStatSource(json_encode($sourced['polar']),$source,'polar',$date);
837
+				    	        }
838
+				    	        if (isset($sourced['hist'])) {
839
+				    	        	echo $Stats->addStatSource(json_encode($sourced['hist']),$source,'hist',$date);
840
+				    	        }
672 841
 				    		if (isset($sourced['msg'])) {
673 842
 				    		    if (time() - $sourced['msg']['date'] > 10) {
674 843
 				    		        $nbmsg = round($sourced['msg']['nb']/(time() - $sourced['msg']['date']));
@@ -681,13 +850,17 @@  discard block
 block discarded – undo
681 850
 			    			unset($this->stats[$date]);
682 851
 			    		    }
683 852
 				    	}
684
-				    	if ($globalDebug) echo 'Done'."\n";
853
+				    	if ($globalDebug) {
854
+				    		echo 'Done'."\n";
855
+				    	}
685 856
 
686 857
 				    }
687 858
 				    $Stats->db = null;
688 859
 				    
689 860
 				    $this->del();
690
-				} elseif ($globalDebug) echo 'Ignore data'."\n";
861
+				} elseif ($globalDebug) {
862
+					echo 'Ignore data'."\n";
863
+				}
691 864
 				//$ignoreImport = false;
692 865
 				$this->all_flights[$id]['addedSpotter'] = 1;
693 866
 				//print_r($this->all_flights[$id]);
@@ -704,12 +877,16 @@  discard block
 block discarded – undo
704 877
 			*/
705 878
 			//SpotterLive->deleteLiveSpotterDataByIdent($this->all_flights[$id]['ident']);
706 879
 				if ($this->last_delete == 0 || time() - $this->last_delete > 1800) {
707
-				    if ($globalDebug) echo "---- Deleting Live Spotter data older than 9 hours...";
880
+				    if ($globalDebug) {
881
+				    	echo "---- Deleting Live Spotter data older than 9 hours...";
882
+				    }
708 883
 				    //SpotterLive->deleteLiveSpotterDataNotUpdated();
709 884
 				    $SpotterLive = new SpotterLive($this->db);
710 885
 				    $SpotterLive->deleteLiveSpotterData();
711 886
 				    $SpotterLive->db=null;
712
-				    if ($globalDebug) echo " Done\n";
887
+				    if ($globalDebug) {
888
+				    	echo " Done\n";
889
+				    }
713 890
 				    $this->last_delete = time();
714 891
 				}
715 892
 			    } else {
@@ -732,11 +909,17 @@  discard block
 block discarded – undo
732 909
 		    //echo "{$line[8]} {$line[7]} - MODES:{$line[4]}  CALLSIGN:{$line[10]}   ALT:{$line[11]}   VEL:{$line[12]}   HDG:{$line[13]}   LAT:{$line[14]}   LON:{$line[15]}   VR:{$line[16]}   SQUAWK:{$line[17]}\n";
733 910
 		    if ($globalDebug) {
734 911
 			if ((isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS) || (isset($globalVAM) && $globalVAM)) {
735
-				if (isset($this->all_flights[$id]['source_name'])) echo 'DATA : hex : '.$this->all_flights[$id]['hex'].' - ident : '.$this->all_flights[$id]['ident'].' - ICAO : '.$this->all_flights[$id]['aircraft_icao'].' - Departure Airport : '.$this->all_flights[$id]['departure_airport'].' - Arrival Airport : '.$this->all_flights[$id]['arrival_airport'].' - Latitude : '.$this->all_flights[$id]['latitude'].' - Longitude : '.$this->all_flights[$id]['longitude'].' - waypoints : '.$this->all_flights[$id]['waypoints'].' - Altitude : '.$this->all_flights[$id]['altitude'].' - Heading : '.$this->all_flights[$id]['heading'].' - Speed : '.$this->all_flights[$id]['speed'].' - Departure Airport Time : '.$this->all_flights[$id]['departure_airport_time'].' - Arrival Airport time : '.$this->all_flights[$id]['arrival_airport_time'].' - Pilot : '.$this->all_flights[$id]['pilot_name'].' - Source name : '.$this->all_flights[$id]['source_name']."\n";
736
-				else echo 'DATA : hex : '.$this->all_flights[$id]['hex'].' - ident : '.$this->all_flights[$id]['ident'].' - ICAO : '.$this->all_flights[$id]['aircraft_icao'].' - Departure Airport : '.$this->all_flights[$id]['departure_airport'].' - Arrival Airport : '.$this->all_flights[$id]['arrival_airport'].' - Latitude : '.$this->all_flights[$id]['latitude'].' - Longitude : '.$this->all_flights[$id]['longitude'].' - waypoints : '.$this->all_flights[$id]['waypoints'].' - Altitude : '.$this->all_flights[$id]['altitude'].' - Heading : '.$this->all_flights[$id]['heading'].' - Speed : '.$this->all_flights[$id]['speed'].' - Departure Airport Time : '.$this->all_flights[$id]['departure_airport_time'].' - Arrival Airport time : '.$this->all_flights[$id]['arrival_airport_time'].' - Pilot : '.$this->all_flights[$id]['pilot_name']."\n";
912
+				if (isset($this->all_flights[$id]['source_name'])) {
913
+					echo 'DATA : hex : '.$this->all_flights[$id]['hex'].' - ident : '.$this->all_flights[$id]['ident'].' - ICAO : '.$this->all_flights[$id]['aircraft_icao'].' - Departure Airport : '.$this->all_flights[$id]['departure_airport'].' - Arrival Airport : '.$this->all_flights[$id]['arrival_airport'].' - Latitude : '.$this->all_flights[$id]['latitude'].' - Longitude : '.$this->all_flights[$id]['longitude'].' - waypoints : '.$this->all_flights[$id]['waypoints'].' - Altitude : '.$this->all_flights[$id]['altitude'].' - Heading : '.$this->all_flights[$id]['heading'].' - Speed : '.$this->all_flights[$id]['speed'].' - Departure Airport Time : '.$this->all_flights[$id]['departure_airport_time'].' - Arrival Airport time : '.$this->all_flights[$id]['arrival_airport_time'].' - Pilot : '.$this->all_flights[$id]['pilot_name'].' - Source name : '.$this->all_flights[$id]['source_name']."\n";
914
+				} else {
915
+					echo 'DATA : hex : '.$this->all_flights[$id]['hex'].' - ident : '.$this->all_flights[$id]['ident'].' - ICAO : '.$this->all_flights[$id]['aircraft_icao'].' - Departure Airport : '.$this->all_flights[$id]['departure_airport'].' - Arrival Airport : '.$this->all_flights[$id]['arrival_airport'].' - Latitude : '.$this->all_flights[$id]['latitude'].' - Longitude : '.$this->all_flights[$id]['longitude'].' - waypoints : '.$this->all_flights[$id]['waypoints'].' - Altitude : '.$this->all_flights[$id]['altitude'].' - Heading : '.$this->all_flights[$id]['heading'].' - Speed : '.$this->all_flights[$id]['speed'].' - Departure Airport Time : '.$this->all_flights[$id]['departure_airport_time'].' - Arrival Airport time : '.$this->all_flights[$id]['arrival_airport_time'].' - Pilot : '.$this->all_flights[$id]['pilot_name']."\n";
916
+				}
737 917
 			} else {
738
-				if (isset($this->all_flights[$id]['source_name'])) echo 'DATA : hex : '.$this->all_flights[$id]['hex'].' - ident : '.$this->all_flights[$id]['ident'].' - ICAO : '.$this->all_flights[$id]['aircraft_icao'].' - Departure Airport : '.$this->all_flights[$id]['departure_airport'].' - Arrival Airport : '.$this->all_flights[$id]['arrival_airport'].' - Latitude : '.$this->all_flights[$id]['latitude'].' - Longitude : '.$this->all_flights[$id]['longitude'].' - waypoints : '.$this->all_flights[$id]['waypoints'].' - Altitude : '.$this->all_flights[$id]['altitude'].' - Heading : '.$this->all_flights[$id]['heading'].' - Speed : '.$this->all_flights[$id]['speed'].' - Departure Airport Time : '.$this->all_flights[$id]['departure_airport_time'].' - Arrival Airport time : '.$this->all_flights[$id]['arrival_airport_time'].' - Source Name : '.$this->all_flights[$id]['source_name']."\n";
739
-				else echo 'DATA : hex : '.$this->all_flights[$id]['hex'].' - ident : '.$this->all_flights[$id]['ident'].' - ICAO : '.$this->all_flights[$id]['aircraft_icao'].' - Departure Airport : '.$this->all_flights[$id]['departure_airport'].' - Arrival Airport : '.$this->all_flights[$id]['arrival_airport'].' - Latitude : '.$this->all_flights[$id]['latitude'].' - Longitude : '.$this->all_flights[$id]['longitude'].' - waypoints : '.$this->all_flights[$id]['waypoints'].' - Altitude : '.$this->all_flights[$id]['altitude'].' - Heading : '.$this->all_flights[$id]['heading'].' - Speed : '.$this->all_flights[$id]['speed'].' - Departure Airport Time : '.$this->all_flights[$id]['departure_airport_time'].' - Arrival Airport time : '.$this->all_flights[$id]['arrival_airport_time']."\n";
918
+				if (isset($this->all_flights[$id]['source_name'])) {
919
+					echo 'DATA : hex : '.$this->all_flights[$id]['hex'].' - ident : '.$this->all_flights[$id]['ident'].' - ICAO : '.$this->all_flights[$id]['aircraft_icao'].' - Departure Airport : '.$this->all_flights[$id]['departure_airport'].' - Arrival Airport : '.$this->all_flights[$id]['arrival_airport'].' - Latitude : '.$this->all_flights[$id]['latitude'].' - Longitude : '.$this->all_flights[$id]['longitude'].' - waypoints : '.$this->all_flights[$id]['waypoints'].' - Altitude : '.$this->all_flights[$id]['altitude'].' - Heading : '.$this->all_flights[$id]['heading'].' - Speed : '.$this->all_flights[$id]['speed'].' - Departure Airport Time : '.$this->all_flights[$id]['departure_airport_time'].' - Arrival Airport time : '.$this->all_flights[$id]['arrival_airport_time'].' - Source Name : '.$this->all_flights[$id]['source_name']."\n";
920
+				} else {
921
+					echo 'DATA : hex : '.$this->all_flights[$id]['hex'].' - ident : '.$this->all_flights[$id]['ident'].' - ICAO : '.$this->all_flights[$id]['aircraft_icao'].' - Departure Airport : '.$this->all_flights[$id]['departure_airport'].' - Arrival Airport : '.$this->all_flights[$id]['arrival_airport'].' - Latitude : '.$this->all_flights[$id]['latitude'].' - Longitude : '.$this->all_flights[$id]['longitude'].' - waypoints : '.$this->all_flights[$id]['waypoints'].' - Altitude : '.$this->all_flights[$id]['altitude'].' - Heading : '.$this->all_flights[$id]['heading'].' - Speed : '.$this->all_flights[$id]['speed'].' - Departure Airport Time : '.$this->all_flights[$id]['departure_airport_time'].' - Arrival Airport time : '.$this->all_flights[$id]['arrival_airport_time']."\n";
922
+				}
740 923
 			}
741 924
 		    }
742 925
 		    $ignoreImport = false;
@@ -782,19 +965,25 @@  discard block
 block discarded – undo
782 965
 
783 966
 		    if (!$ignoreImport) {
784 967
 			if (!isset($globalDistanceIgnore['latitude']) || (isset($globalDistanceIgnore['latitude']) && $Common->distance($this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude']) < $globalDistanceIgnore['distance'])) {
785
-				if ($globalDebug) echo "\o/ Add ".$this->all_flights[$id]['ident']." from ".$this->all_flights[$id]['format_source']." in Live DB : ";
968
+				if ($globalDebug) {
969
+					echo "\o/ Add ".$this->all_flights[$id]['ident']." from ".$this->all_flights[$id]['format_source']." in Live DB : ";
970
+				}
786 971
 				$timeelapsed = microtime(true);
787 972
 				$SpotterLive = new SpotterLive($this->db);
788 973
 				$result = $SpotterLive->addLiveSpotterData($this->all_flights[$id]['id'], $this->all_flights[$id]['ident'], $this->all_flights[$id]['aircraft_icao'], $this->all_flights[$id]['departure_airport'], $this->all_flights[$id]['arrival_airport'], $this->all_flights[$id]['latitude'], $this->all_flights[$id]['longitude'], $this->all_flights[$id]['waypoints'], $this->all_flights[$id]['altitude'], $this->all_flights[$id]['heading'], $this->all_flights[$id]['speed'],$this->all_flights[$id]['datetime'], $this->all_flights[$id]['departure_airport_time'], $this->all_flights[$id]['arrival_airport_time'], $this->all_flights[$id]['squawk'],$this->all_flights[$id]['route_stop'],$this->all_flights[$id]['hex'],$this->all_flights[$id]['putinarchive'],$this->all_flights[$id]['registration'],$this->all_flights[$id]['pilot_id'],$this->all_flights[$id]['pilot_name'], $this->all_flights[$id]['verticalrate'], $this->all_flights[$id]['noarchive'], $this->all_flights[$id]['ground'],$this->all_flights[$id]['format_source'],$this->all_flights[$id]['source_name'],$this->all_flights[$id]['over_country']);
789 974
 				$SpotterLive->db = null;
790
-				if ($globalDebugTimeElapsed) echo 'Time elapsed for update addlivespotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
975
+				if ($globalDebugTimeElapsed) {
976
+					echo 'Time elapsed for update addlivespotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
977
+				}
791 978
 
792 979
 				// Put statistics in $this->stats variable
793 980
 				//if ($line['format_source'] != 'aprs') {
794 981
 				//if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw' || $line['format_source'] === 'deltadbtxt')) {
795 982
 				if (isset($line['sourcestats']) && $line['sourcestats'] == TRUE && $line['format_source'] != 'aprs' && $this->all_flights[$id]['latitude'] != '' && $this->all_flights[$id]['longitude'] != '') {
796 983
 					$source = $this->all_flights[$id]['source_name'];
797
-					if ($source == '') $source = $this->all_flights[$id]['format_source'];
984
+					if ($source == '') {
985
+						$source = $this->all_flights[$id]['format_source'];
986
+					}
798 987
 					if (!isset($this->source_location[$source])) {
799 988
 						$Location = new Source();
800 989
 						$coord = $Location->getLocationInfobySourceName($source);
@@ -815,7 +1004,9 @@  discard block
 block discarded – undo
815 1004
 					$stats_heading = round($stats_heading/22.5);
816 1005
 					$stats_distance = $Common->distance($latitude,$longitude,$this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude']);
817 1006
 					$current_date = date('Y-m-d');
818
-					if ($stats_heading == 16) $stats_heading = 0;
1007
+					if ($stats_heading == 16) {
1008
+						$stats_heading = 0;
1009
+					}
819 1010
 					if (!isset($this->stats[$current_date][$source]['polar'][1])) {
820 1011
 						for ($i=0;$i<=15;$i++) {
821 1012
 						    $this->stats[$current_date][$source]['polar'][$i] = 0;
@@ -833,7 +1024,9 @@  discard block
 block discarded – undo
833 1024
 						if (isset($this->stats[$current_date][$source]['hist'][0])) {
834 1025
 						    end($this->stats[$current_date][$source]['hist']);
835 1026
 						    $mini = key($this->stats[$current_date][$source]['hist'])+10;
836
-						} else $mini = 0;
1027
+						} else {
1028
+							$mini = 0;
1029
+						}
837 1030
 						for ($i=$mini;$i<=$distance;$i+=10) {
838 1031
 						    $this->stats[$current_date][$source]['hist'][$i] = 0;
839 1032
 						}
@@ -844,20 +1037,30 @@  discard block
 block discarded – undo
844 1037
 				}
845 1038
 
846 1039
 				$this->all_flights[$id]['lastupdate'] = time();
847
-				if ($this->all_flights[$id]['putinarchive']) $send = true;
1040
+				if ($this->all_flights[$id]['putinarchive']) {
1041
+					$send = true;
1042
+				}
848 1043
 				//if ($globalDebug) echo "Distance : ".Common->distance($this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude'])."\n";
849
-				if ($globalDebug) echo $result."\n";
850
-			} elseif (isset($this->all_flights[$id]['latitude']) && isset($globalDistanceIgnore['latitude']) && $globalDebug) echo "!! Too far -> Distance : ".$Common->distance($this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude'])."\n";
1044
+				if ($globalDebug) {
1045
+					echo $result."\n";
1046
+				}
1047
+			} elseif (isset($this->all_flights[$id]['latitude']) && isset($globalDistanceIgnore['latitude']) && $globalDebug) {
1048
+				echo "!! Too far -> Distance : ".$Common->distance($this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude'])."\n";
1049
+			}
851 1050
 			//$this->del();
852 1051
 			
853 1052
 			
854 1053
 			if ($this->last_delete_hourly == 0 || time() - $this->last_delete_hourly > 900) {
855
-			    if ($globalDebug) echo "---- Deleting Live Spotter data Not updated since 2 hour...";
1054
+			    if ($globalDebug) {
1055
+			    	echo "---- Deleting Live Spotter data Not updated since 2 hour...";
1056
+			    }
856 1057
 			    $SpotterLive = new SpotterLive($this->db);
857 1058
 			    $SpotterLive->deleteLiveSpotterDataNotUpdated();
858 1059
 			    $SpotterLive->db = null;
859 1060
 			    //SpotterLive->deleteLiveSpotterData();
860
-			    if ($globalDebug) echo " Done\n";
1061
+			    if ($globalDebug) {
1062
+			    	echo " Done\n";
1063
+			    }
861 1064
 			    $this->last_delete_hourly = time();
862 1065
 			}
863 1066
 			
@@ -865,7 +1068,9 @@  discard block
 block discarded – undo
865 1068
 		    //$ignoreImport = false;
866 1069
 		}
867 1070
 		//if (function_exists('pcntl_fork') && $globalFork) pcntl_signal(SIGCHLD, SIG_IGN);
868
-		if ($send) return $this->all_flights[$id];
1071
+		if ($send) {
1072
+			return $this->all_flights[$id];
1073
+		}
869 1074
 	    }
870 1075
 	}
871 1076
     }
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.