Completed
Push — master ( f1043a...50fd5f )
by Yannick
30:17
created
archive-geojson.php 1 patch
Braces   +237 added lines, -145 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,19 +180,23 @@  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
 				$pfi = $spotter_item['flightaware_id'];
170
-			} else $spotter_history_array = 0;
197
+			} else {
198
+				$spotter_history_array = 0;
199
+			}
171 200
 		}
172 201
 		if (count($spotter_history_array) > 1) {
173 202
 			//location of aircraft
@@ -175,21 +204,29 @@  discard block
 block discarded – undo
175 204
 			$output .= '"type": "Feature",';
176 205
 			$output .= '"properties": {';
177 206
 			$output .= '"fi": "'.$pfi.'",';
178
-			if (isset($begindate)) $output .= '"archive_date": "'.$begindate.'",';
207
+			if (isset($begindate)) {
208
+				$output .= '"archive_date": "'.$begindate.'",';
209
+			}
179 210
 			if (isset($spotter_item['ident']) && $spotter_item['ident'] != '') {
180 211
 				$output .= '"c": "'.$spotter_item['ident'].'",';
181 212
 			} else {
182 213
 				$output .= '"c": "NA",';
183 214
 			}
184 215
 			if (!isset($spotter_item['aircraft_shadow']) && !$tracker && !$marine) {
185
-				if (!isset($spotter_item['aircraft_icao']) || $spotter_item['aircraft_icao'] == '') $spotter_item['aircraft_shadow'] = '';
186
-				else {
216
+				if (!isset($spotter_item['aircraft_icao']) || $spotter_item['aircraft_icao'] == '') {
217
+					$spotter_item['aircraft_shadow'] = '';
218
+				} else {
187 219
 					$aircraft_icao = $spotter_item['aircraft_icao'];
188 220
 					$aircraft_info = $Spotter->getAllAircraftInfo($spotter_item['aircraft_icao']);
189
-					if (count($aircraft_info) > 0) $spotter_item['aircraft_shadow'] = $aircraft_info[0]['aircraft_shadow'];
190
-					elseif (isset($spotter_item['format_source']) && $spotter_item['format_source'] == 'aprs') $spotter_item['aircraft_shadow'] = 'PA18.png';
191
-					elseif ($aircraft_icao == 'PARAGLIDER') $spotter_item['aircraft_shadow'] = 'PARAGLIDER.png';
192
-					else $spotter_item['aircraft_shadow'] = '';
221
+					if (count($aircraft_info) > 0) {
222
+						$spotter_item['aircraft_shadow'] = $aircraft_info[0]['aircraft_shadow'];
223
+					} elseif (isset($spotter_item['format_source']) && $spotter_item['format_source'] == 'aprs') {
224
+						$spotter_item['aircraft_shadow'] = 'PA18.png';
225
+					} elseif ($aircraft_icao == 'PARAGLIDER') {
226
+						$spotter_item['aircraft_shadow'] = 'PARAGLIDER.png';
227
+					} else {
228
+						$spotter_item['aircraft_shadow'] = '';
229
+					}
193 230
 					$aircrafts_shadow[$aircraft_icao] = $spotter_item['aircraft_shadow'];
194 231
 				}
195 232
 			}
@@ -197,93 +234,139 @@  discard block
 block discarded – undo
197 234
 			if (!isset($spotter_item['aircraft_shadow']) || $spotter_item['aircraft_shadow'] == '') {
198 235
 				if ($tracker) {
199 236
 					if (isset($spotter_item['type']) && $spotter_item['type'] == 'Ambulance') {
200
-						if ($compress) $output .= '"as": "ambulance.png",';
201
-						else $output .= '"aircraft_shadow": "ambulance.png",';
202
-					}
203
-					elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Police') {
204
-						if ($compress) $output .= '"as": "police.png",';
205
-						else $output .= '"aircraft_shadow": "police.png",';
206
-					}
207
-					elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Yacht (Sail)') {
208
-						if ($compress) $output .= '"as": "ship.png",';
209
-						else $output .= '"aircraft_shadow": "ship.png",';
210
-					}
211
-					elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Ship (Power Boat)') {
212
-						if ($compress) $output .= '"as": "ship.png",';
213
-						else $output .= '"aircraft_shadow": "ship.png",';
214
-					}
215
-					elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Shuttle') {
216
-						if ($compress) $output .= '"as": "ship.png",';
217
-						else $output .= '"aircraft_shadow": "ship.png",';
218
-					}
219
-					elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Truck') {
220
-						if ($compress) $output .= '"as": "truck.png",';
221
-						else $output .= '"aircraft_shadow": "truck.png",';
222
-					}
223
-					elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Truck (18 Wheeler)') {
224
-						if ($compress) $output .= '"as": "truck.png",';
225
-						else $output .= '"aircraft_shadow": "truck.png",';
226
-					}
227
-					elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Aircraft (small)') {
228
-						if ($compress) $output .= '"as": "aircraft.png",';
229
-						else $output .= '"aircraft_shadow": "aircraft.png",';
237
+						if ($compress) {
238
+							$output .= '"as": "ambulance.png",';
239
+						} else {
240
+							$output .= '"aircraft_shadow": "ambulance.png",';
241
+						}
242
+					} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Police') {
243
+						if ($compress) {
244
+							$output .= '"as": "police.png",';
245
+						} else {
246
+							$output .= '"aircraft_shadow": "police.png",';
247
+						}
248
+					} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Yacht (Sail)') {
249
+						if ($compress) {
250
+							$output .= '"as": "ship.png",';
251
+						} else {
252
+							$output .= '"aircraft_shadow": "ship.png",';
253
+						}
254
+					} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Ship (Power Boat)') {
255
+						if ($compress) {
256
+							$output .= '"as": "ship.png",';
257
+						} else {
258
+							$output .= '"aircraft_shadow": "ship.png",';
259
+						}
260
+					} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Shuttle') {
261
+						if ($compress) {
262
+							$output .= '"as": "ship.png",';
263
+						} else {
264
+							$output .= '"aircraft_shadow": "ship.png",';
265
+						}
266
+					} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Truck') {
267
+						if ($compress) {
268
+							$output .= '"as": "truck.png",';
269
+						} else {
270
+							$output .= '"aircraft_shadow": "truck.png",';
271
+						}
272
+					} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Truck (18 Wheeler)') {
273
+						if ($compress) {
274
+							$output .= '"as": "truck.png",';
275
+						} else {
276
+							$output .= '"aircraft_shadow": "truck.png",';
277
+						}
278
+					} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Aircraft (small)') {
279
+						if ($compress) {
280
+							$output .= '"as": "aircraft.png",';
281
+						} else {
282
+							$output .= '"aircraft_shadow": "aircraft.png",';
283
+						}
284
+					} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Large Aircraft') {
285
+						if ($compress) {
286
+							$output .= '"as": "aircraft.png",';
287
+						} else {
288
+							$output .= '"aircraft_shadow": "aircraft.png",';
289
+						}
290
+					} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Helicopter') {
291
+						if ($compress) {
292
+							$output .= '"as": "helico.png",';
293
+						} else {
294
+							$output .= '"aircraft_shadow": "helico.png",';
295
+						}
296
+					} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Railroad Engine') {
297
+						if ($compress) {
298
+							$output .= '"as": "rail.png",';
299
+						} else {
300
+							$output .= '"aircraft_shadow": "rail.png",';
301
+						}
302
+					} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Firetruck') {
303
+						if ($compress) {
304
+							$output .= '"as": "firetruck.png",';
305
+						} else {
306
+							$output .= '"aircraft_shadow": "firetruck.png",';
307
+						}
308
+					} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Bus') {
309
+						if ($compress) {
310
+							$output .= '"as": "bus.png",';
311
+						} else {
312
+							$output .= '"aircraft_shadow": "bus.png",';
313
+						}
314
+					} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Phone') {
315
+						if ($compress) {
316
+							$output .= '"as": "phone.png",';
317
+						} else {
318
+							$output .= '"aircraft_shadow": "phone.png",';
319
+						}
320
+					} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Jogger') {
321
+						if ($compress) {
322
+							$output .= '"as": "jogger.png",';
323
+						} else {
324
+							$output .= '"aircraft_shadow": "jogger.png",';
325
+						}
326
+					} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Bike') {
327
+						if ($compress) {
328
+							$output .= '"as": "bike.png",';
329
+						} else {
330
+							$output .= '"aircraft_shadow": "bike.png",';
331
+						}
332
+					} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Motorcycle') {
333
+						if ($compress) {
334
+							$output .= '"as": "motorcycle.png",';
335
+						} else {
336
+							$output .= '"aircraft_shadow": "motorcycle.png",';
337
+						}
338
+					} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Balloon') {
339
+						if ($compress) {
340
+							$output .= '"as": "balloon.png",';
341
+						} else {
342
+							$output .= '"aircraft_shadow": "balloon.png",';
343
+						}
344
+					} else {
345
+						if ($compress) {
346
+							$output .= '"as": "car.png",';
347
+						} else {
348
+							$output .= '"aircraft_shadow": "car.png",';
349
+						}
230 350
 					}
231
-					elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Large Aircraft') {
232
-						if ($compress) $output .= '"as": "aircraft.png",';
233
-						else $output .= '"aircraft_shadow": "aircraft.png",';
351
+				} elseif ($marine) {
352
+					if ($compress) {
353
+						$output .= '"as": "ship.png",';
354
+					} else {
355
+						$output .= '"aircraft_shadow": "ship.png",';
234 356
 					}
235
-					elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Helicopter') {
236
-						if ($compress) $output .= '"as": "helico.png",';
237
-						else $output .= '"aircraft_shadow": "helico.png",';
238
-					}
239
-					elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Railroad Engine') {
240
-						if ($compress) $output .= '"as": "rail.png",';
241
-						else $output .= '"aircraft_shadow": "rail.png",';
242
-					}
243
-					elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Firetruck') {
244
-						if ($compress) $output .= '"as": "firetruck.png",';
245
-						else $output .= '"aircraft_shadow": "firetruck.png",';
246
-					}
247
-					elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Bus') {
248
-						if ($compress) $output .= '"as": "bus.png",';
249
-						else $output .= '"aircraft_shadow": "bus.png",';
250
-					}
251
-					elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Phone') {
252
-						if ($compress) $output .= '"as": "phone.png",';
253
-						else $output .= '"aircraft_shadow": "phone.png",';
254
-					}
255
-					elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Jogger') {
256
-						if ($compress) $output .= '"as": "jogger.png",';
257
-						else $output .= '"aircraft_shadow": "jogger.png",';
258
-					}
259
-					elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Bike') {
260
-						if ($compress) $output .= '"as": "bike.png",';
261
-						else $output .= '"aircraft_shadow": "bike.png",';
262
-					}
263
-					elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Motorcycle') {
264
-						if ($compress) $output .= '"as": "motorcycle.png",';
265
-						else $output .= '"aircraft_shadow": "motorcycle.png",';
266
-					}
267
-					elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Balloon') {
268
-						if ($compress) $output .= '"as": "balloon.png",';
269
-						else $output .= '"aircraft_shadow": "balloon.png",';
270
-					}
271
-					else {
272
-						if ($compress) $output .= '"as": "car.png",';
273
-						else $output .= '"aircraft_shadow": "car.png",';
357
+				} else {
358
+					if ($compress) {
359
+						$output .= '"as": "default.png",';
360
+					} else {
361
+						$output .= '"aircraft_shadow": "default.png",';
274 362
 					}
275 363
 				}
276
-				elseif ($marine) {
277
-					if ($compress) $output .= '"as": "ship.png",';
278
-					else $output .= '"aircraft_shadow": "ship.png",';
279
-				}
280
-				else {
281
-					if ($compress) $output .= '"as": "default.png",';
282
-					else $output .= '"aircraft_shadow": "default.png",';
283
-				}
284 364
 			} else {
285
-				if ($compress) $output .= '"as": "'.$spotter_item['aircraft_shadow'].'",';
286
-				else $output .= '"aircraft_shadow": "'.$spotter_item['aircraft_shadow'].'",';
365
+				if ($compress) {
366
+					$output .= '"as": "'.$spotter_item['aircraft_shadow'].'",';
367
+				} else {
368
+					$output .= '"aircraft_shadow": "'.$spotter_item['aircraft_shadow'].'",';
369
+				}
287 370
 			}
288 371
 
289 372
 			if (isset($spotter_item['date_iso_8601'])) {
@@ -311,9 +394,13 @@  discard block
 block discarded – undo
311 394
 					$k++;
312 395
 					$output_history .= '['.$spotter_history['longitude'].', '.$spotter_history['latitude'].'],';
313 396
 					$output_time .= (strtotime($spotter_history['date'])*1000).',';
314
-					if ($previousts != 0) $output_timediff .= (strtotime($spotter_history['date'])-$previousts).',';
397
+					if ($previousts != 0) {
398
+						$output_timediff .= (strtotime($spotter_history['date'])-$previousts).',';
399
+					}
315 400
 					$previousts = strtotime($spotter_history['date']);
316
-					if ($k > 1 && (strtotime($spotter_history['date'])*1000 > $enddate)) $end = true;
401
+					if ($k > 1 && (strtotime($spotter_history['date'])*1000 > $enddate)) {
402
+						$end = true;
403
+					}
317 404
 				}
318 405
 			}
319 406
 			if (isset($output_time)) {
@@ -325,8 +412,11 @@  discard block
 block discarded – undo
325 412
 				$output .= '"timediff": ['.$output_timediff.'],';
326 413
 			}
327 414
 			// FIXME : type when not aircraft ?
328
-			if ($compress) $output .= '"t": "aircraft"';
329
-			else $output .= '"type": "aircraft"';
415
+			if ($compress) {
416
+				$output .= '"t": "aircraft"';
417
+			} else {
418
+				$output .= '"type": "aircraft"';
419
+			}
330 420
 			$output .= '},';
331 421
 			$output .= '"geometry": {';
332 422
 			//$output .= '"type": "MultiPoint",';
@@ -346,7 +436,9 @@  discard block
 block discarded – undo
346 436
 	$output .= ']';
347 437
 	$output .= ',"initial_sqltime": "'.$sqltime.'",';
348 438
 	$output .= '"totaltime": "'.round(microtime(true)-$begintime,2).'",';
349
-	if (isset($begindate)) $output .= '"archive_date": "'.$begindate.'",';
439
+	if (isset($begindate)) {
440
+		$output .= '"archive_date": "'.$begindate.'",';
441
+	}
350 442
 	$output .= '"fc": "'.$flightcnt.'"';
351 443
 } else {
352 444
 	$output .= '"features": ';
Please login to merge, or discard this patch.