Completed
Push — master ( 8d07fb...f7956b )
by Yannick
56:50 queued 26:47
created
archive-geojson.php 1 patch
Braces   +234 added lines, -144 removed lines patch added patch discarded remove patch
@@ -22,12 +22,10 @@  discard block
 block discarded – undo
22 22
 if ($tracker) {
23 23
 	require_once('require/class.Tracker.php');
24 24
 	require_once('require/class.TrackerArchive.php');
25
-}
26
-elseif ($marine) {
25
+} elseif ($marine) {
27 26
 	require_once('require/class.Marine.php');
28 27
 	require_once('require/class.MarineArchive.php');
29
-}
30
-else {
28
+} else {
31 29
 	require_once('require/class.Spotter.php');
32 30
 	require_once('require/class.SpotterArchive.php');
33 31
 }
@@ -35,12 +33,10 @@  discard block
 block discarded – undo
35 33
 if ($tracker) {
36 34
 	$Tracker = new Tracker();
37 35
 	$TrackerArchive = new TrackerArchive();
38
-}
39
-elseif ($marine) {
36
+} elseif ($marine) {
40 37
 	$Marine = new Marine();
41 38
 	$MarineArchive = new MarineArchive();
42
-}
43
-else {
39
+} else {
44 40
 	$Spotter = new Spotter();
45 41
 	$SpotterArchive = new SpotterArchive();
46 42
 }
@@ -53,62 +49,86 @@  discard block
 block discarded – undo
53 49
 }
54 50
 header('Content-Type: text/javascript');
55 51
 
56
-if (!isset($globalJsonCompress)) $compress = true;
57
-else $compress = $globalJsonCompress;
52
+if (!isset($globalJsonCompress)) {
53
+	$compress = true;
54
+} else {
55
+	$compress = $globalJsonCompress;
56
+}
58 57
 
59 58
 $from_archive = false;
60 59
 $min = false;
61 60
 $allhistory = false;
62 61
 $filter['source'] = array();
63
-if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') $filter['source'] = array_merge($filter['source'],array('vatsimtxt'));
64
-if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') $filter['source'] = array_merge($filter['source'],array('whazzup'));
65
-if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') $filter['source'] = array_merge($filter['source'],array('phpvmacars'));
66
-if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') $filter['source'] = array_merge($filter['source'],array('sbs','famaprs'));
67
-if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') $filter['source'] = array_merge($filter['source'],array('aprs'));
68
-if (isset($_COOKIE['filter_ident']) && $_COOKIE['filter_ident'] != '') $filter['ident'] = filter_var($_COOKIE['filter_ident'],FILTER_SANITIZE_STRING);
69
-if (isset($_COOKIE['filter_mmsi']) && $_COOKIE['filter_mmsi'] != '') $filter['mmsi'] = filter_var($_COOKIE['filter_mmsi'],FILTER_SANITIZE_STRING);
70
-if (isset($_COOKIE['filter_Airlines']) && $_COOKIE['filter_Airlines'] != '') $filter['airlines'] = filter_var_array(explode(',',$_COOKIE['filter_Airlines']),FILTER_SANITIZE_STRING);
71
-if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') $filter['source_aprs'] = filter_var_array(explode(',',$_COOKIE['filter_Sources']),FILTER_SANITIZE_STRING);
72
-if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') $filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'],FILTER_SANITIZE_STRING);
73
-if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] != 'all') $filter['alliance'] = filter_var($_COOKIE['filter_alliance'],FILTER_SANITIZE_STRING);
62
+if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') {
63
+	$filter['source'] = array_merge($filter['source'],array('vatsimtxt'));
64
+}
65
+if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') {
66
+	$filter['source'] = array_merge($filter['source'],array('whazzup'));
67
+}
68
+if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') {
69
+	$filter['source'] = array_merge($filter['source'],array('phpvmacars'));
70
+}
71
+if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') {
72
+	$filter['source'] = array_merge($filter['source'],array('sbs','famaprs'));
73
+}
74
+if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') {
75
+	$filter['source'] = array_merge($filter['source'],array('aprs'));
76
+}
77
+if (isset($_COOKIE['filter_ident']) && $_COOKIE['filter_ident'] != '') {
78
+	$filter['ident'] = filter_var($_COOKIE['filter_ident'],FILTER_SANITIZE_STRING);
79
+}
80
+if (isset($_COOKIE['filter_mmsi']) && $_COOKIE['filter_mmsi'] != '') {
81
+	$filter['mmsi'] = filter_var($_COOKIE['filter_mmsi'],FILTER_SANITIZE_STRING);
82
+}
83
+if (isset($_COOKIE['filter_Airlines']) && $_COOKIE['filter_Airlines'] != '') {
84
+	$filter['airlines'] = filter_var_array(explode(',',$_COOKIE['filter_Airlines']),FILTER_SANITIZE_STRING);
85
+}
86
+if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') {
87
+	$filter['source_aprs'] = filter_var_array(explode(',',$_COOKIE['filter_Sources']),FILTER_SANITIZE_STRING);
88
+}
89
+if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') {
90
+	$filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'],FILTER_SANITIZE_STRING);
91
+}
92
+if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] != 'all') {
93
+	$filter['alliance'] = filter_var($_COOKIE['filter_alliance'],FILTER_SANITIZE_STRING);
94
+}
74 95
 
75 96
 if (isset($globalMapPopup) && !$globalMapPopup && !(isset($_COOKIE['flightpopup']) && $_COOKIE['flightpopup'] == 'true')) {
76 97
 	$min = true;
77
-} else $min = false;
98
+} else {
99
+	$min = false;
100
+}
78 101
 
79 102
 if (isset($_GET['ident'])) {
80 103
 	$ident = filter_input(INPUT_GET,'ident',FILTER_SANITIZE_STRING);
81 104
 	$from_archive = true;
82 105
 	if ($tracker) {
83 106
 		$spotter_array = $TrackerArchive->getLastArchiveTrackerDataByIdent($ident);
84
-	}
85
-	elseif ($marine) {
107
+	} elseif ($marine) {
86 108
 		$spotter_array = $MarineArchive->getLastArchiveMarineDataByIdent($ident);
87
-	}
88
-	else {
109
+	} else {
89 110
 		$spotter_array = $SpotterArchive->getLastArchiveSpotterDataByIdent($ident);
90 111
 	}
91 112
 	$allhistory = true;
92
-}
93
-elseif (isset($_GET['flightaware_id'])) {
113
+} elseif (isset($_GET['flightaware_id'])) {
94 114
 	$flightaware_id = filter_input(INPUT_GET,'flightaware_id',FILTER_SANITIZE_STRING);
95 115
 	$from_archive = true;
96 116
 	if ($tracker) {
97 117
 		$spotter_array = $TrackerArchive->getLastArchiveTrackerDataById($flightaware_id);
98
-	}
99
-	elseif ($marine) {
118
+	} elseif ($marine) {
100 119
 		$spotter_array = $MarineArchive->getLastArchiveMarineDataById($flightaware_id);
101
-	}
102
-	else {
120
+	} else {
103 121
 		$spotter_array = $SpotterArchive->getLastArchiveSpotterDataById($flightaware_id);
104 122
 	}
105 123
 	$allhistory = true;
106
-}
107
-elseif (isset($_GET['archive']) && isset($_GET['begindate']) && isset($_GET['enddate']) && isset($_GET['speed'])) {
124
+} elseif (isset($_GET['archive']) && isset($_GET['begindate']) && isset($_GET['enddate']) && isset($_GET['speed'])) {
108 125
 	$from_archive = true;
109 126
 	$begindate = filter_input(INPUT_GET,'begindate',FILTER_SANITIZE_NUMBER_INT);
110
-	if (isset($globalAircraftMaxUpdate)) $begindate = $begindate - $globalAircraftMaxUpdate;
111
-	else $begindate = $begindate - 3000;
127
+	if (isset($globalAircraftMaxUpdate)) {
128
+		$begindate = $begindate - $globalAircraftMaxUpdate;
129
+	} else {
130
+		$begindate = $begindate - 3000;
131
+	}
112 132
 	$enddate = filter_input(INPUT_GET,'enddate',FILTER_SANITIZE_NUMBER_INT);
113 133
 	$archivespeed = filter_input(INPUT_GET,'speed',FILTER_SANITIZE_NUMBER_INT);
114 134
 	if ($begindate != '' && $enddate != '') {
@@ -117,11 +137,9 @@  discard block
 block discarded – undo
117 137
 		//$spotter_array = $SpotterArchive->getMinLiveSpotterDataPlayback($begindate,$enddate,$filter);
118 138
 		if ($tracker) {
119 139
 			$spotter_array = $TrackerArchive->getMinLiveTrackerData($begindate,$enddate,$filter);
120
-		}
121
-		elseif ($marine) {
140
+		} elseif ($marine) {
122 141
 			$spotter_array = $MarineArchive->getMinLiveMarineData($begindate,$enddate,$filter);
123
-		}
124
-		else {
142
+		} else {
125 143
 			$spotter_array = $SpotterArchive->getMinLiveSpotterData($begindate,$enddate,$filter);
126 144
 		}
127 145
 	}
@@ -130,8 +148,12 @@  discard block
 block discarded – undo
130 148
 if (!empty($spotter_array)) {
131 149
 	//$flightcnt = $SpotterArchive->getLiveSpotterCount($begindate,$enddate,$filter);
132 150
 	$flightcnt = 0;
133
-	if ($flightcnt == '') $flightcnt = 0;
134
-} else $flightcnt = 0;
151
+	if ($flightcnt == '') {
152
+		$flightcnt = 0;
153
+	}
154
+	} else {
155
+	$flightcnt = 0;
156
+}
135 157
 
136 158
 $sqltime = round(microtime(true)-$begintime,2);
137 159
 
@@ -141,8 +163,11 @@  discard block
 block discarded – undo
141 163
 $aircrafts_shadow = array();
142 164
 $output = '{';
143 165
 $output .= '"type": "FeatureCollection",';
144
-if ($min) $output .= '"minimal": "true",';
145
-else $output .= '"minimal": "false",';
166
+if ($min) {
167
+	$output .= '"minimal": "true",';
168
+} else {
169
+	$output .= '"minimal": "false",';
170
+}
146 171
 $output .= '"fc": "'.$flightcnt.'",';
147 172
 $output .= '"sqt": "'.$sqltime.'",';
148 173
 
@@ -155,20 +180,24 @@  discard block
 block discarded – undo
155 180
 			if ($pfi != $spotter_item['famtrackid']) {
156 181
 				$spotter_history_array = $TrackerArchive->getCoordArchiveTrackerDataById($spotter_item['famtrackid']);
157 182
 				$pfi = $spotter_item['famtrackid'];
158
-			} else $spotter_history_array = 0;
159
-		}
160
-		elseif ($marine) {
183
+			} else {
184
+				$spotter_history_array = 0;
185
+			}
186
+		} elseif ($marine) {
161 187
 			if ($pfi != $spotter_item['fammarine_d']) {
162 188
 				$spotter_history_array = $MarineArchive->getCoordArchiveMarineDataById($spotter_item['fammarine_id']);
163 189
 				$pfi = $spotter_item['fammarine_id'];
164
-			} else $spotter_history_array = 0;
165
-		}
166
-		else {
190
+			} else {
191
+				$spotter_history_array = 0;
192
+			}
193
+		} else {
167 194
 			if ($pfi != $spotter_item['flightaware_id']) {
168 195
 				//$spotter_history_array = $SpotterArchive->getCoordArchiveSpotterDataById($spotter_item['flightaware_id']);
169 196
 				$spotter_history_array = $SpotterArchive->getCoordArchiveSpotterDataByIdDate($spotter_item['flightaware_id'],$begindate,$enddate);
170 197
 				$pfi = $spotter_item['flightaware_id'];
171
-			} else $spotter_history_array = 0;
198
+			} else {
199
+				$spotter_history_array = 0;
200
+			}
172 201
 		}
173 202
 		if (count($spotter_history_array) > 1) {
174 203
 			//location of aircraft
@@ -176,21 +205,29 @@  discard block
 block discarded – undo
176 205
 			$output .= '"type": "Feature",';
177 206
 			$output .= '"properties": {';
178 207
 			$output .= '"fi": "'.$pfi.'",';
179
-			if (isset($begindate)) $output .= '"archive_date": "'.$begindate.'",';
208
+			if (isset($begindate)) {
209
+				$output .= '"archive_date": "'.$begindate.'",';
210
+			}
180 211
 			if (isset($spotter_item['ident']) && $spotter_item['ident'] != '') {
181 212
 				$output .= '"c": "'.$spotter_item['ident'].'",';
182 213
 			} else {
183 214
 				$output .= '"c": "NA",';
184 215
 			}
185 216
 			if (!isset($spotter_item['aircraft_shadow']) && !$tracker && !$marine) {
186
-				if (!isset($spotter_item['aircraft_icao']) || $spotter_item['aircraft_icao'] == '') $spotter_item['aircraft_shadow'] = '';
187
-				else {
217
+				if (!isset($spotter_item['aircraft_icao']) || $spotter_item['aircraft_icao'] == '') {
218
+					$spotter_item['aircraft_shadow'] = '';
219
+				} else {
188 220
 					$aircraft_icao = $spotter_item['aircraft_icao'];
189 221
 					$aircraft_info = $Spotter->getAllAircraftInfo($spotter_item['aircraft_icao']);
190
-					if (count($aircraft_info) > 0) $spotter_item['aircraft_shadow'] = $aircraft_info[0]['aircraft_shadow'];
191
-					elseif (isset($spotter_item['format_source']) && $spotter_item['format_source'] == 'aprs') $spotter_item['aircraft_shadow'] = 'PA18.png';
192
-					elseif ($aircraft_icao == 'PARAGLIDER') $spotter_item['aircraft_shadow'] = 'PARAGLIDER.png';
193
-					else $spotter_item['aircraft_shadow'] = '';
222
+					if (count($aircraft_info) > 0) {
223
+						$spotter_item['aircraft_shadow'] = $aircraft_info[0]['aircraft_shadow'];
224
+					} elseif (isset($spotter_item['format_source']) && $spotter_item['format_source'] == 'aprs') {
225
+						$spotter_item['aircraft_shadow'] = 'PA18.png';
226
+					} elseif ($aircraft_icao == 'PARAGLIDER') {
227
+						$spotter_item['aircraft_shadow'] = 'PARAGLIDER.png';
228
+					} else {
229
+						$spotter_item['aircraft_shadow'] = '';
230
+					}
194 231
 					$aircrafts_shadow[$aircraft_icao] = $spotter_item['aircraft_shadow'];
195 232
 				}
196 233
 			}
@@ -198,93 +235,139 @@  discard block
 block discarded – undo
198 235
 			if (!isset($spotter_item['aircraft_shadow']) || $spotter_item['aircraft_shadow'] == '') {
199 236
 				if ($tracker) {
200 237
 					if (isset($spotter_item['type']) && $spotter_item['type'] == 'Ambulance') {
201
-						if ($compress) $output .= '"as": "ambulance.png",';
202
-						else $output .= '"aircraft_shadow": "ambulance.png",';
203
-					}
204
-					elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Police') {
205
-						if ($compress) $output .= '"as": "police.png",';
206
-						else $output .= '"aircraft_shadow": "police.png",';
207
-					}
208
-					elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Yacht (Sail)') {
209
-						if ($compress) $output .= '"as": "ship.png",';
210
-						else $output .= '"aircraft_shadow": "ship.png",';
211
-					}
212
-					elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Ship (Power Boat)') {
213
-						if ($compress) $output .= '"as": "ship.png",';
214
-						else $output .= '"aircraft_shadow": "ship.png",';
215
-					}
216
-					elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Shuttle') {
217
-						if ($compress) $output .= '"as": "ship.png",';
218
-						else $output .= '"aircraft_shadow": "ship.png",';
219
-					}
220
-					elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Truck') {
221
-						if ($compress) $output .= '"as": "truck.png",';
222
-						else $output .= '"aircraft_shadow": "truck.png",';
223
-					}
224
-					elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Truck (18 Wheeler)') {
225
-						if ($compress) $output .= '"as": "truck.png",';
226
-						else $output .= '"aircraft_shadow": "truck.png",';
238
+						if ($compress) {
239
+							$output .= '"as": "ambulance.png",';
240
+						} else {
241
+							$output .= '"aircraft_shadow": "ambulance.png",';
242
+						}
243
+					} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Police') {
244
+						if ($compress) {
245
+							$output .= '"as": "police.png",';
246
+						} else {
247
+							$output .= '"aircraft_shadow": "police.png",';
248
+						}
249
+					} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Yacht (Sail)') {
250
+						if ($compress) {
251
+							$output .= '"as": "ship.png",';
252
+						} else {
253
+							$output .= '"aircraft_shadow": "ship.png",';
254
+						}
255
+					} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Ship (Power Boat)') {
256
+						if ($compress) {
257
+							$output .= '"as": "ship.png",';
258
+						} else {
259
+							$output .= '"aircraft_shadow": "ship.png",';
260
+						}
261
+					} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Shuttle') {
262
+						if ($compress) {
263
+							$output .= '"as": "ship.png",';
264
+						} else {
265
+							$output .= '"aircraft_shadow": "ship.png",';
266
+						}
267
+					} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Truck') {
268
+						if ($compress) {
269
+							$output .= '"as": "truck.png",';
270
+						} else {
271
+							$output .= '"aircraft_shadow": "truck.png",';
272
+						}
273
+					} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Truck (18 Wheeler)') {
274
+						if ($compress) {
275
+							$output .= '"as": "truck.png",';
276
+						} else {
277
+							$output .= '"aircraft_shadow": "truck.png",';
278
+						}
279
+					} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Aircraft (small)') {
280
+						if ($compress) {
281
+							$output .= '"as": "aircraft.png",';
282
+						} else {
283
+							$output .= '"aircraft_shadow": "aircraft.png",';
284
+						}
285
+					} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Large Aircraft') {
286
+						if ($compress) {
287
+							$output .= '"as": "aircraft.png",';
288
+						} else {
289
+							$output .= '"aircraft_shadow": "aircraft.png",';
290
+						}
291
+					} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Helicopter') {
292
+						if ($compress) {
293
+							$output .= '"as": "helico.png",';
294
+						} else {
295
+							$output .= '"aircraft_shadow": "helico.png",';
296
+						}
297
+					} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Railroad Engine') {
298
+						if ($compress) {
299
+							$output .= '"as": "rail.png",';
300
+						} else {
301
+							$output .= '"aircraft_shadow": "rail.png",';
302
+						}
303
+					} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Firetruck') {
304
+						if ($compress) {
305
+							$output .= '"as": "firetruck.png",';
306
+						} else {
307
+							$output .= '"aircraft_shadow": "firetruck.png",';
308
+						}
309
+					} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Bus') {
310
+						if ($compress) {
311
+							$output .= '"as": "bus.png",';
312
+						} else {
313
+							$output .= '"aircraft_shadow": "bus.png",';
314
+						}
315
+					} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Phone') {
316
+						if ($compress) {
317
+							$output .= '"as": "phone.png",';
318
+						} else {
319
+							$output .= '"aircraft_shadow": "phone.png",';
320
+						}
321
+					} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Jogger') {
322
+						if ($compress) {
323
+							$output .= '"as": "jogger.png",';
324
+						} else {
325
+							$output .= '"aircraft_shadow": "jogger.png",';
326
+						}
327
+					} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Bike') {
328
+						if ($compress) {
329
+							$output .= '"as": "bike.png",';
330
+						} else {
331
+							$output .= '"aircraft_shadow": "bike.png",';
332
+						}
333
+					} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Motorcycle') {
334
+						if ($compress) {
335
+							$output .= '"as": "motorcycle.png",';
336
+						} else {
337
+							$output .= '"aircraft_shadow": "motorcycle.png",';
338
+						}
339
+					} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Balloon') {
340
+						if ($compress) {
341
+							$output .= '"as": "balloon.png",';
342
+						} else {
343
+							$output .= '"aircraft_shadow": "balloon.png",';
344
+						}
345
+					} else {
346
+						if ($compress) {
347
+							$output .= '"as": "car.png",';
348
+						} else {
349
+							$output .= '"aircraft_shadow": "car.png",';
350
+						}
227 351
 					}
228
-					elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Aircraft (small)') {
229
-						if ($compress) $output .= '"as": "aircraft.png",';
230
-						else $output .= '"aircraft_shadow": "aircraft.png",';
352
+				} elseif ($marine) {
353
+					if ($compress) {
354
+						$output .= '"as": "ship.png",';
355
+					} else {
356
+						$output .= '"aircraft_shadow": "ship.png",';
231 357
 					}
232
-					elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Large Aircraft') {
233
-						if ($compress) $output .= '"as": "aircraft.png",';
234
-						else $output .= '"aircraft_shadow": "aircraft.png",';
358
+				} else {
359
+					if ($compress) {
360
+						$output .= '"as": "default.png",';
361
+					} else {
362
+						$output .= '"aircraft_shadow": "default.png",';
235 363
 					}
236
-					elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Helicopter') {
237
-						if ($compress) $output .= '"as": "helico.png",';
238
-						else $output .= '"aircraft_shadow": "helico.png",';
239
-					}
240
-					elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Railroad Engine') {
241
-						if ($compress) $output .= '"as": "rail.png",';
242
-						else $output .= '"aircraft_shadow": "rail.png",';
243
-					}
244
-					elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Firetruck') {
245
-						if ($compress) $output .= '"as": "firetruck.png",';
246
-						else $output .= '"aircraft_shadow": "firetruck.png",';
247
-					}
248
-					elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Bus') {
249
-						if ($compress) $output .= '"as": "bus.png",';
250
-						else $output .= '"aircraft_shadow": "bus.png",';
251
-					}
252
-					elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Phone') {
253
-						if ($compress) $output .= '"as": "phone.png",';
254
-						else $output .= '"aircraft_shadow": "phone.png",';
255
-					}
256
-					elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Jogger') {
257
-						if ($compress) $output .= '"as": "jogger.png",';
258
-						else $output .= '"aircraft_shadow": "jogger.png",';
259
-					}
260
-					elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Bike') {
261
-						if ($compress) $output .= '"as": "bike.png",';
262
-						else $output .= '"aircraft_shadow": "bike.png",';
263
-					}
264
-					elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Motorcycle') {
265
-						if ($compress) $output .= '"as": "motorcycle.png",';
266
-						else $output .= '"aircraft_shadow": "motorcycle.png",';
267
-					}
268
-					elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Balloon') {
269
-						if ($compress) $output .= '"as": "balloon.png",';
270
-						else $output .= '"aircraft_shadow": "balloon.png",';
271
-					}
272
-					else {
273
-						if ($compress) $output .= '"as": "car.png",';
274
-						else $output .= '"aircraft_shadow": "car.png",';
275
-					}
276
-				}
277
-				elseif ($marine) {
278
-					if ($compress) $output .= '"as": "ship.png",';
279
-					else $output .= '"aircraft_shadow": "ship.png",';
280
-				}
281
-				else {
282
-					if ($compress) $output .= '"as": "default.png",';
283
-					else $output .= '"aircraft_shadow": "default.png",';
284 364
 				}
285 365
 			} else {
286
-				if ($compress) $output .= '"as": "'.$spotter_item['aircraft_shadow'].'",';
287
-				else $output .= '"aircraft_shadow": "'.$spotter_item['aircraft_shadow'].'",';
366
+				if ($compress) {
367
+					$output .= '"as": "'.$spotter_item['aircraft_shadow'].'",';
368
+				} else {
369
+					$output .= '"aircraft_shadow": "'.$spotter_item['aircraft_shadow'].'",';
370
+				}
288 371
 			}
289 372
 
290 373
 			if (isset($spotter_item['date_iso_8601'])) {
@@ -314,7 +397,9 @@  discard block
 block discarded – undo
314 397
 					$output_time .= (strtotime($spotter_history['date'])*1000).',';
315 398
 					//if ($previousts != 0) $output_timediff .= (strtotime($spotter_history['date'])-$previousts).',';
316 399
 					$previousts = strtotime($spotter_history['date']);
317
-					if ($k > 1 && (strtotime($spotter_history['date'])*1000 > $enddate)) $end = true;
400
+					if ($k > 1 && (strtotime($spotter_history['date'])*1000 > $enddate)) {
401
+						$end = true;
402
+					}
318 403
 				}
319 404
 			}
320 405
 			if (isset($output_time)) {
@@ -328,8 +413,11 @@  discard block
 block discarded – undo
328 413
 			}
329 414
 			*/
330 415
 			// FIXME : type when not aircraft ?
331
-			if ($compress) $output .= '"t": "aircraft"';
332
-			else $output .= '"type": "aircraft"';
416
+			if ($compress) {
417
+				$output .= '"t": "aircraft"';
418
+			} else {
419
+				$output .= '"type": "aircraft"';
420
+			}
333 421
 			$output .= '},';
334 422
 			$output .= '"geometry": {';
335 423
 			//$output .= '"type": "MultiPoint",';
@@ -349,7 +437,9 @@  discard block
 block discarded – undo
349 437
 	$output .= ']';
350 438
 	$output .= ',"initial_sqltime": "'.$sqltime.'",';
351 439
 	$output .= '"totaltime": "'.round(microtime(true)-$begintime,2).'",';
352
-	if (isset($begindate)) $output .= '"archive_date": "'.$begindate.'",';
440
+	if (isset($begindate)) {
441
+		$output .= '"archive_date": "'.$begindate.'",';
442
+	}
353 443
 	$output .= '"fc": "'.$flightcnt.'"';
354 444
 } else {
355 445
 	$output .= '"features": ';
Please login to merge, or discard this patch.