Completed
Push — master ( 7dfb92...6193f6 )
by Yannick
35:52
created
archive-geojson.php 1 patch
Braces   +229 added lines, -142 removed lines patch added patch discarded remove patch
@@ -25,12 +25,10 @@  discard block
 block discarded – undo
25 25
 if ($tracker) {
26 26
 	require_once('require/class.Tracker.php');
27 27
 	require_once('require/class.TrackerArchive.php');
28
-}
29
-elseif ($marine) {
28
+} elseif ($marine) {
30 29
 	require_once('require/class.Marine.php');
31 30
 	require_once('require/class.MarineArchive.php');
32
-}
33
-else {
31
+} else {
34 32
 	require_once('require/class.Spotter.php');
35 33
 	require_once('require/class.SpotterArchive.php');
36 34
 }
@@ -38,12 +36,10 @@  discard block
 block discarded – undo
38 36
 if ($tracker) {
39 37
 	$Tracker = new Tracker();
40 38
 	$TrackerArchive = new TrackerArchive();
41
-}
42
-elseif ($marine) {
39
+} elseif ($marine) {
43 40
 	$Marine = new Marine();
44 41
 	$MarineArchive = new MarineArchive();
45
-}
46
-else {
42
+} else {
47 43
 	$Spotter = new Spotter();
48 44
 	$SpotterArchive = new SpotterArchive();
49 45
 }
@@ -56,66 +52,92 @@  discard block
 block discarded – undo
56 52
 }
57 53
 header('Content-Type: text/javascript');
58 54
 
59
-if (!isset($globalJsonCompress)) $compress = true;
60
-else $compress = $globalJsonCompress;
55
+if (!isset($globalJsonCompress)) {
56
+	$compress = true;
57
+} else {
58
+	$compress = $globalJsonCompress;
59
+}
61 60
 
62 61
 $from_archive = false;
63 62
 $min = false;
64 63
 $allhistory = false;
65 64
 $filter['source'] = array();
66
-if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') $filter['source'] = array_merge($filter['source'],array('vatsimtxt'));
67
-if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') $filter['source'] = array_merge($filter['source'],array('whazzup'));
68
-if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') $filter['source'] = array_merge($filter['source'],array('phpvmacars'));
69
-if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') $filter['source'] = array_merge($filter['source'],array('sbs','famaprs'));
70
-if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') $filter['source'] = array_merge($filter['source'],array('aprs'));
71
-if (isset($_COOKIE['filter_ident']) && $_COOKIE['filter_ident'] != '') $filter['ident'] = filter_var($_COOKIE['filter_ident'],FILTER_SANITIZE_STRING);
72
-if (isset($_COOKIE['filter_mmsi']) && $_COOKIE['filter_mmsi'] != '') $filter['mmsi'] = filter_var($_COOKIE['filter_mmsi'],FILTER_SANITIZE_STRING);
73
-if (isset($_COOKIE['filter_Airlines']) && $_COOKIE['filter_Airlines'] != '') $filter['airlines'] = filter_var_array(explode(',',$_COOKIE['filter_Airlines']),FILTER_SANITIZE_STRING);
74
-if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') $filter['source_aprs'] = filter_var_array(explode(',',$_COOKIE['filter_Sources']),FILTER_SANITIZE_STRING);
75
-if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') $filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'],FILTER_SANITIZE_STRING);
76
-if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] != 'all') $filter['alliance'] = filter_var($_COOKIE['filter_alliance'],FILTER_SANITIZE_STRING);
65
+if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') {
66
+	$filter['source'] = array_merge($filter['source'],array('vatsimtxt'));
67
+}
68
+if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') {
69
+	$filter['source'] = array_merge($filter['source'],array('whazzup'));
70
+}
71
+if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') {
72
+	$filter['source'] = array_merge($filter['source'],array('phpvmacars'));
73
+}
74
+if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') {
75
+	$filter['source'] = array_merge($filter['source'],array('sbs','famaprs'));
76
+}
77
+if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') {
78
+	$filter['source'] = array_merge($filter['source'],array('aprs'));
79
+}
80
+if (isset($_COOKIE['filter_ident']) && $_COOKIE['filter_ident'] != '') {
81
+	$filter['ident'] = filter_var($_COOKIE['filter_ident'],FILTER_SANITIZE_STRING);
82
+}
83
+if (isset($_COOKIE['filter_mmsi']) && $_COOKIE['filter_mmsi'] != '') {
84
+	$filter['mmsi'] = filter_var($_COOKIE['filter_mmsi'],FILTER_SANITIZE_STRING);
85
+}
86
+if (isset($_COOKIE['filter_Airlines']) && $_COOKIE['filter_Airlines'] != '') {
87
+	$filter['airlines'] = filter_var_array(explode(',',$_COOKIE['filter_Airlines']),FILTER_SANITIZE_STRING);
88
+}
89
+if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') {
90
+	$filter['source_aprs'] = filter_var_array(explode(',',$_COOKIE['filter_Sources']),FILTER_SANITIZE_STRING);
91
+}
92
+if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') {
93
+	$filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'],FILTER_SANITIZE_STRING);
94
+}
95
+if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] != 'all') {
96
+	$filter['alliance'] = filter_var($_COOKIE['filter_alliance'],FILTER_SANITIZE_STRING);
97
+}
77 98
 
78 99
 if (isset($globalMapPopup) && !$globalMapPopup && !(isset($_COOKIE['flightpopup']) && $_COOKIE['flightpopup'] == 'true')) {
79 100
 	$min = true;
80
-} else $min = false;
101
+} else {
102
+	$min = false;
103
+}
81 104
 
82 105
 if (isset($_GET['ident'])) {
83 106
 	$ident = filter_input(INPUT_GET,'ident',FILTER_SANITIZE_STRING);
84 107
 	$from_archive = true;
85 108
 	if ($tracker) {
86 109
 		$spotter_array = $TrackerArchive->getLastArchiveTrackerDataByIdent($ident);
87
-	}
88
-	elseif ($marine) {
110
+	} elseif ($marine) {
89 111
 		$spotter_array = $MarineArchive->getLastArchiveMarineDataByIdent($ident);
90
-	}
91
-	else {
112
+	} else {
92 113
 		$spotter_array = $SpotterArchive->getLastArchiveSpotterDataByIdent($ident);
93 114
 	}
94 115
 	$allhistory = true;
95
-}
96
-elseif (isset($_GET['flightaware_id'])) {
116
+} elseif (isset($_GET['flightaware_id'])) {
97 117
 	$flightaware_id = filter_input(INPUT_GET,'flightaware_id',FILTER_SANITIZE_STRING);
98 118
 	$from_archive = true;
99 119
 	if ($tracker) {
100 120
 		$spotter_array = $TrackerArchive->getLastArchiveTrackerDataById($flightaware_id);
101
-	}
102
-	elseif ($marine) {
121
+	} elseif ($marine) {
103 122
 		$spotter_array = $MarineArchive->getLastArchiveMarineDataById($flightaware_id);
104
-	}
105
-	else {
123
+	} else {
106 124
 		$spotter_array = $SpotterArchive->getLastArchiveSpotterDataById($flightaware_id);
107 125
 	}
108 126
 	$allhistory = true;
109
-}
110
-elseif (isset($_GET['archive']) && isset($_GET['begindate']) && isset($_GET['enddate']) && isset($_GET['speed'])) {
127
+} elseif (isset($_GET['archive']) && isset($_GET['begindate']) && isset($_GET['enddate']) && isset($_GET['speed'])) {
111 128
 	$from_archive = true;
112 129
 	$begindate = filter_input(INPUT_GET,'begindate',FILTER_SANITIZE_NUMBER_INT);
113
-	if (isset($globalAircraftMaxUpdate)) $begindate = $begindate - $globalAircraftMaxUpdate;
114
-	else $begindate = $begindate - 3000;
130
+	if (isset($globalAircraftMaxUpdate)) {
131
+		$begindate = $begindate - $globalAircraftMaxUpdate;
132
+	} else {
133
+		$begindate = $begindate - 3000;
134
+	}
115 135
 	$enddate = filter_input(INPUT_GET,'enddate',FILTER_SANITIZE_NUMBER_INT);
116 136
 	$archivespeed = filter_input(INPUT_GET,'speed',FILTER_SANITIZE_NUMBER_INT);
117 137
 	$part = filter_input(INPUT_GET,'part',FILTER_SANITIZE_NUMBER_INT);
118
-	if ($part == '') $part = 0;
138
+	if ($part == '') {
139
+		$part = 0;
140
+	}
119 141
 	
120 142
 	if ($begindate != '' && $enddate != '') {
121 143
 		$begindate = date('Y-m-d H:i:s',$begindate);
@@ -123,11 +145,9 @@  discard block
 block discarded – undo
123 145
 		//$spotter_array = $SpotterArchive->getMinLiveSpotterDataPlayback($begindate,$enddate,$filter);
124 146
 		if ($tracker) {
125 147
 			$spotter_array = $TrackerArchive->getMinLiveTrackerData($begindate,$enddate,$filter);
126
-		}
127
-		elseif ($marine) {
148
+		} elseif ($marine) {
128 149
 			$spotter_array = $MarineArchive->getMinLiveMarineData($begindate,$enddate,$filter);
129
-		}
130
-		else {
150
+		} else {
131 151
 			$spotter_array = $SpotterArchive->getMinLiveSpotterData($begindate,$enddate,$filter,$part);
132 152
 		}
133 153
 	}
@@ -136,8 +156,12 @@  discard block
 block discarded – undo
136 156
 if (!empty($spotter_array)) {
137 157
 	//$flightcnt = $SpotterArchive->getLiveSpotterCount($begindate,$enddate,$filter);
138 158
 	$flightcnt = 0;
139
-	if ($flightcnt == '') $flightcnt = 0;
140
-} else $flightcnt = 0;
159
+	if ($flightcnt == '') {
160
+		$flightcnt = 0;
161
+	}
162
+	} else {
163
+	$flightcnt = 0;
164
+}
141 165
 
142 166
 $sqltime = round(microtime(true)-$begintime,2);
143 167
 
@@ -147,8 +171,11 @@  discard block
 block discarded – undo
147 171
 $aircrafts_shadow = array();
148 172
 $output = '{';
149 173
 $output .= '"type": "FeatureCollection",';
150
-if ($min) $output .= '"minimal": "true",';
151
-else $output .= '"minimal": "false",';
174
+if ($min) {
175
+	$output .= '"minimal": "true",';
176
+} else {
177
+	$output .= '"minimal": "false",';
178
+}
152 179
 $output .= '"fc": "'.$flightcnt.'",';
153 180
 $output .= '"sqt": "'.$sqltime.'",';
154 181
 $begin = true;
@@ -161,15 +188,17 @@  discard block
 block discarded – undo
161 188
 			if ($pfi != $spotter_item['famtrackid']) {
162 189
 				$pfi = $spotter_item['famtrackid'];
163 190
 				$begin = true;
164
-			} else $spotter_history_array = 0;
165
-		}
166
-		elseif ($marine) {
191
+			} else {
192
+				$spotter_history_array = 0;
193
+			}
194
+		} elseif ($marine) {
167 195
 			if ($pfi != $spotter_item['fammarine_d']) {
168 196
 				$pfi = $spotter_item['fammarine_id'];
169 197
 				$begin = true;
170
-			} else $spotter_history_array = 0;
171
-		}
172
-		else {
198
+			} else {
199
+				$spotter_history_array = 0;
200
+			}
201
+		} else {
173 202
 			if ($pfi != $spotter_item['flightaware_id']) {
174 203
 				$pfi = $spotter_item['flightaware_id'];
175 204
 				$begin = true;
@@ -206,7 +235,9 @@  discard block
 block discarded – undo
206 235
 			$output_history .= '['.$spotter_item['longitude'].', '.$spotter_item['latitude'].'],';
207 236
 			$output_time .= (strtotime($spotter_item['date'])*1000).',';
208 237
 			$previousts = strtotime($spotter_item['date']);
209
-			if ($k > 1 && (strtotime($spotter_item['date'])*1000 > $enddate)) $end = true;
238
+			if ($k > 1 && (strtotime($spotter_item['date'])*1000 > $enddate)) {
239
+				$end = true;
240
+			}
210 241
 		}
211 242
 
212 243
 		if ($begin) {
@@ -216,7 +247,9 @@  discard block
 block discarded – undo
216 247
 			$output .= '"type": "Feature",';
217 248
 			$output .= '"properties": {';
218 249
 			$output .= '"fi": "'.$pfi.'",';
219
-			if (isset($begindate)) $output .= '"archive_date": "'.$begindate.'",';
250
+			if (isset($begindate)) {
251
+				$output .= '"archive_date": "'.$begindate.'",';
252
+			}
220 253
 			if (isset($spotter_item['ident']) && $spotter_item['ident'] != '') {
221 254
 				$output .= '"c": "'.str_replace('\\','',$spotter_item['ident']).'",';
222 255
 				//"
@@ -224,14 +257,20 @@  discard block
 block discarded – undo
224 257
 				$output .= '"c": "NA",';
225 258
 			}
226 259
 			if (!isset($spotter_item['aircraft_shadow']) && !$tracker && !$marine) {
227
-				if (!isset($spotter_item['aircraft_icao']) || $spotter_item['aircraft_icao'] == '') $spotter_item['aircraft_shadow'] = '';
228
-				else {
260
+				if (!isset($spotter_item['aircraft_icao']) || $spotter_item['aircraft_icao'] == '') {
261
+					$spotter_item['aircraft_shadow'] = '';
262
+				} else {
229 263
 					$aircraft_icao = $spotter_item['aircraft_icao'];
230 264
 					$aircraft_info = $Spotter->getAllAircraftInfo($spotter_item['aircraft_icao']);
231
-					if (count($aircraft_info) > 0) $spotter_item['aircraft_shadow'] = $aircraft_info[0]['aircraft_shadow'];
232
-					elseif (isset($spotter_item['format_source']) && $spotter_item['format_source'] == 'aprs') $spotter_item['aircraft_shadow'] = 'PA18.png';
233
-					elseif ($aircraft_icao == 'PARAGLIDER') $spotter_item['aircraft_shadow'] = 'PARAGLIDER.png';
234
-					else $spotter_item['aircraft_shadow'] = '';
265
+					if (count($aircraft_info) > 0) {
266
+						$spotter_item['aircraft_shadow'] = $aircraft_info[0]['aircraft_shadow'];
267
+					} elseif (isset($spotter_item['format_source']) && $spotter_item['format_source'] == 'aprs') {
268
+						$spotter_item['aircraft_shadow'] = 'PA18.png';
269
+					} elseif ($aircraft_icao == 'PARAGLIDER') {
270
+						$spotter_item['aircraft_shadow'] = 'PARAGLIDER.png';
271
+					} else {
272
+						$spotter_item['aircraft_shadow'] = '';
273
+					}
235 274
 					$aircrafts_shadow[$aircraft_icao] = $spotter_item['aircraft_shadow'];
236 275
 				}
237 276
 			}
@@ -239,93 +278,139 @@  discard block
 block discarded – undo
239 278
 			if (!isset($spotter_item['aircraft_shadow']) || $spotter_item['aircraft_shadow'] == '') {
240 279
 				if ($tracker) {
241 280
 					if (isset($spotter_item['type']) && $spotter_item['type'] == 'Ambulance') {
242
-						if ($compress) $output .= '"as": "ambulance.png",';
243
-						else $output .= '"aircraft_shadow": "ambulance.png",';
244
-					}
245
-					elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Police') {
246
-						if ($compress) $output .= '"as": "police.png",';
247
-						else $output .= '"aircraft_shadow": "police.png",';
248
-					}
249
-					elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Yacht (Sail)') {
250
-						if ($compress) $output .= '"as": "ship.png",';
251
-						else $output .= '"aircraft_shadow": "ship.png",';
252
-					}
253
-					elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Ship (Power Boat)') {
254
-						if ($compress) $output .= '"as": "ship.png",';
255
-						else $output .= '"aircraft_shadow": "ship.png",';
256
-					}
257
-					elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Shuttle') {
258
-						if ($compress) $output .= '"as": "ship.png",';
259
-						else $output .= '"aircraft_shadow": "ship.png",';
281
+						if ($compress) {
282
+							$output .= '"as": "ambulance.png",';
283
+						} else {
284
+							$output .= '"aircraft_shadow": "ambulance.png",';
285
+						}
286
+					} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Police') {
287
+						if ($compress) {
288
+							$output .= '"as": "police.png",';
289
+						} else {
290
+							$output .= '"aircraft_shadow": "police.png",';
291
+						}
292
+					} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Yacht (Sail)') {
293
+						if ($compress) {
294
+							$output .= '"as": "ship.png",';
295
+						} else {
296
+							$output .= '"aircraft_shadow": "ship.png",';
297
+						}
298
+					} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Ship (Power Boat)') {
299
+						if ($compress) {
300
+							$output .= '"as": "ship.png",';
301
+						} else {
302
+							$output .= '"aircraft_shadow": "ship.png",';
303
+						}
304
+					} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Shuttle') {
305
+						if ($compress) {
306
+							$output .= '"as": "ship.png",';
307
+						} else {
308
+							$output .= '"aircraft_shadow": "ship.png",';
309
+						}
310
+					} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Truck') {
311
+						if ($compress) {
312
+							$output .= '"as": "truck.png",';
313
+						} else {
314
+							$output .= '"aircraft_shadow": "truck.png",';
315
+						}
316
+					} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Truck (18 Wheeler)') {
317
+						if ($compress) {
318
+							$output .= '"as": "truck.png",';
319
+						} else {
320
+							$output .= '"aircraft_shadow": "truck.png",';
321
+						}
322
+					} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Aircraft (small)') {
323
+						if ($compress) {
324
+							$output .= '"as": "aircraft.png",';
325
+						} else {
326
+							$output .= '"aircraft_shadow": "aircraft.png",';
327
+						}
328
+					} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Large Aircraft') {
329
+						if ($compress) {
330
+							$output .= '"as": "aircraft.png",';
331
+						} else {
332
+							$output .= '"aircraft_shadow": "aircraft.png",';
333
+						}
334
+					} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Helicopter') {
335
+						if ($compress) {
336
+							$output .= '"as": "helico.png",';
337
+						} else {
338
+							$output .= '"aircraft_shadow": "helico.png",';
339
+						}
340
+					} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Railroad Engine') {
341
+						if ($compress) {
342
+							$output .= '"as": "rail.png",';
343
+						} else {
344
+							$output .= '"aircraft_shadow": "rail.png",';
345
+						}
346
+					} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Firetruck') {
347
+						if ($compress) {
348
+							$output .= '"as": "firetruck.png",';
349
+						} else {
350
+							$output .= '"aircraft_shadow": "firetruck.png",';
351
+						}
352
+					} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Bus') {
353
+						if ($compress) {
354
+							$output .= '"as": "bus.png",';
355
+						} else {
356
+							$output .= '"aircraft_shadow": "bus.png",';
357
+						}
358
+					} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Phone') {
359
+						if ($compress) {
360
+							$output .= '"as": "phone.png",';
361
+						} else {
362
+							$output .= '"aircraft_shadow": "phone.png",';
363
+						}
364
+					} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Jogger') {
365
+						if ($compress) {
366
+							$output .= '"as": "jogger.png",';
367
+						} else {
368
+							$output .= '"aircraft_shadow": "jogger.png",';
369
+						}
370
+					} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Bike') {
371
+						if ($compress) {
372
+							$output .= '"as": "bike.png",';
373
+						} else {
374
+							$output .= '"aircraft_shadow": "bike.png",';
375
+						}
376
+					} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Motorcycle') {
377
+						if ($compress) {
378
+							$output .= '"as": "motorcycle.png",';
379
+						} else {
380
+							$output .= '"aircraft_shadow": "motorcycle.png",';
381
+						}
382
+					} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Balloon') {
383
+						if ($compress) {
384
+							$output .= '"as": "balloon.png",';
385
+						} else {
386
+							$output .= '"aircraft_shadow": "balloon.png",';
387
+						}
388
+					} else {
389
+						if ($compress) {
390
+							$output .= '"as": "car.png",';
391
+						} else {
392
+							$output .= '"aircraft_shadow": "car.png",';
393
+						}
260 394
 					}
261
-					elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Truck') {
262
-						if ($compress) $output .= '"as": "truck.png",';
263
-						else $output .= '"aircraft_shadow": "truck.png",';
395
+				} elseif ($marine) {
396
+					if ($compress) {
397
+						$output .= '"as": "ship.png",';
398
+					} else {
399
+						$output .= '"aircraft_shadow": "ship.png",';
264 400
 					}
265
-					elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Truck (18 Wheeler)') {
266
-						if ($compress) $output .= '"as": "truck.png",';
267
-						else $output .= '"aircraft_shadow": "truck.png",';
268
-					}
269
-					elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Aircraft (small)') {
270
-						if ($compress) $output .= '"as": "aircraft.png",';
271
-						else $output .= '"aircraft_shadow": "aircraft.png",';
272
-					}
273
-					elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Large Aircraft') {
274
-						if ($compress) $output .= '"as": "aircraft.png",';
275
-						else $output .= '"aircraft_shadow": "aircraft.png",';
276
-					}
277
-					elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Helicopter') {
278
-						if ($compress) $output .= '"as": "helico.png",';
279
-						else $output .= '"aircraft_shadow": "helico.png",';
280
-					}
281
-					elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Railroad Engine') {
282
-						if ($compress) $output .= '"as": "rail.png",';
283
-						else $output .= '"aircraft_shadow": "rail.png",';
284
-					}
285
-					elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Firetruck') {
286
-						if ($compress) $output .= '"as": "firetruck.png",';
287
-						else $output .= '"aircraft_shadow": "firetruck.png",';
288
-					}
289
-					elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Bus') {
290
-						if ($compress) $output .= '"as": "bus.png",';
291
-						else $output .= '"aircraft_shadow": "bus.png",';
292
-					}
293
-					elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Phone') {
294
-						if ($compress) $output .= '"as": "phone.png",';
295
-						else $output .= '"aircraft_shadow": "phone.png",';
296
-					}
297
-					elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Jogger') {
298
-						if ($compress) $output .= '"as": "jogger.png",';
299
-						else $output .= '"aircraft_shadow": "jogger.png",';
300
-					}
301
-					elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Bike') {
302
-						if ($compress) $output .= '"as": "bike.png",';
303
-						else $output .= '"aircraft_shadow": "bike.png",';
304
-					}
305
-					elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Motorcycle') {
306
-						if ($compress) $output .= '"as": "motorcycle.png",';
307
-						else $output .= '"aircraft_shadow": "motorcycle.png",';
308
-					}
309
-					elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Balloon') {
310
-						if ($compress) $output .= '"as": "balloon.png",';
311
-						else $output .= '"aircraft_shadow": "balloon.png",';
312
-					}
313
-					else {
314
-						if ($compress) $output .= '"as": "car.png",';
315
-						else $output .= '"aircraft_shadow": "car.png",';
401
+				} else {
402
+					if ($compress) {
403
+						$output .= '"as": "default.png",';
404
+					} else {
405
+						$output .= '"aircraft_shadow": "default.png",';
316 406
 					}
317 407
 				}
318
-				elseif ($marine) {
319
-					if ($compress) $output .= '"as": "ship.png",';
320
-					else $output .= '"aircraft_shadow": "ship.png",';
321
-				}
322
-				else {
323
-					if ($compress) $output .= '"as": "default.png",';
324
-					else $output .= '"aircraft_shadow": "default.png",';
325
-				}
326 408
 			} else {
327
-				if ($compress) $output .= '"as": "'.$spotter_item['aircraft_shadow'].'",';
328
-				else $output .= '"aircraft_shadow": "'.$spotter_item['aircraft_shadow'].'",';
409
+				if ($compress) {
410
+					$output .= '"as": "'.$spotter_item['aircraft_shadow'].'",';
411
+				} else {
412
+					$output .= '"aircraft_shadow": "'.$spotter_item['aircraft_shadow'].'",';
413
+				}
329 414
 			}
330 415
 
331 416
 			if (isset($spotter_item['date_iso_8601'])) {
@@ -373,7 +458,9 @@  discard block
 block discarded – undo
373 458
 	$output .= ']';
374 459
 	$output .= ',"initial_sqltime": "'.$sqltime.'",';
375 460
 	$output .= '"totaltime": "'.round(microtime(true)-$begintime,2).'",';
376
-	if (isset($begindate)) $output .= '"archive_date": "'.$begindate.'",';
461
+	if (isset($begindate)) {
462
+		$output .= '"archive_date": "'.$begindate.'",';
463
+	}
377 464
 	$output .= '"fc": "'.$flightcnt.'"';
378 465
 } else {
379 466
 	$output .= '"features": ';
Please login to merge, or discard this patch.
ident-detailed.php 1 patch
Braces   +25 added lines, -9 removed lines patch added patch discarded remove patch
@@ -123,15 +123,21 @@  discard block
 block discarded – undo
123 123
 	{
124 124
 		$title = sprintf(_("Detailed View for %s"),$spotter_array[0]['ident']);
125 125
 		$ident = $spotter_array[0]['ident'];
126
-		if (isset($spotter_array[0]['latitude'])) $latitude = $spotter_array[0]['latitude'];
127
-		if (isset($spotter_array[0]['longitude'])) $longitude = $spotter_array[0]['longitude'];
126
+		if (isset($spotter_array[0]['latitude'])) {
127
+			$latitude = $spotter_array[0]['latitude'];
128
+		}
129
+		if (isset($spotter_array[0]['longitude'])) {
130
+			$longitude = $spotter_array[0]['longitude'];
131
+		}
128 132
 		require_once('header.php');
129 133
 		if (isset($globalArchive) && $globalArchive && $type == 'aircraft') {
130 134
 			// Requirement for altitude graph
131 135
 			$all_data = $SpotterArchive->getAltitudeSpeedArchiveSpotterDataById($spotter_array[0]['flightaware_id']);
132 136
 			if (isset($globalTimezone)) {
133 137
 				date_default_timezone_set($globalTimezone);
134
-			} else date_default_timezone_set('UTC');
138
+			} else {
139
+				date_default_timezone_set('UTC');
140
+			}
135 141
 			if (is_array($all_data) && count($all_data) > 1) {
136 142
 				print '<link href="'.$globalURL.'/css/c3.min.css" rel="stylesheet" type="text/css">';
137 143
 				print '<script type="text/javascript" src="'.$globalURL.'/js/d3.min.js"></script>';
@@ -205,18 +211,28 @@  discard block
 block discarded – undo
205 211
 		print '<br/><br/><br/>';
206 212
 		print '<h1>'.$spotter_array[0]['ident'].'</h1>';
207 213
 		print '<div><span class="label">'._("Ident").'</span>'.$spotter_array[0]['ident'].'</div>';
208
-		if (isset($spotter_array[0]['blocked']) && $spotter_array[0]['blocked'] === true) print '<div>'._("Callsign is in blocked FAA list").'</div>';
214
+		if (isset($spotter_array[0]['blocked']) && $spotter_array[0]['blocked'] === true) {
215
+			print '<div>'._("Callsign is in blocked FAA list").'</div>';
216
+		}
209 217
 		if (isset($spotter_array[0]['airline_icao'])) {
210 218
 			print '<div><span class="label">'._("Airline").'</span><a href="'.$globalURL.'/airline/'.$spotter_array[0]['airline_icao'].'">'.$spotter_array[0]['airline_name'].'</a></div>'; 
211 219
 		}
212
-		if ($type == 'aircraft') print '<div><span class="label">'._("Flight History").'</span><a href="http://flightaware.com/live/flight/'.$spotter_array[0]['ident'].'" target="_blank">'._("View the Flight History of this callsign").'</a></div>';
220
+		if ($type == 'aircraft') {
221
+			print '<div><span class="label">'._("Flight History").'</span><a href="http://flightaware.com/live/flight/'.$spotter_array[0]['ident'].'" target="_blank">'._("View the Flight History of this callsign").'</a></div>';
222
+		}
213 223
 		print '</div>';
214 224
 	
215
-		if ($type == 'aircraft') include('ident-sub-menu.php');
225
+		if ($type == 'aircraft') {
226
+			include('ident-sub-menu.php');
227
+		}
216 228
 		print '<div class="table column">';
217
-		if ($type == 'aircraft') print '<p>'.sprintf(_("The table below shows the detailed information of all flights with the ident/callsign of <strong>%s</strong>."),$spotter_array[0]['ident']).'</p>';
218
-		elseif ($type == 'marine') print '<p>'.sprintf(_("The table below shows the detailed information of all vessels with the ident/callsign of <strong>%s</strong>."),$spotter_array[0]['ident']).'</p>';
219
-		elseif ($type == 'tracker') print '<p>'.sprintf(_("The table below shows the detailed information of all trackers with the ident/callsign of <strong>%s</strong>."),$spotter_array[0]['ident']).'</p>';
229
+		if ($type == 'aircraft') {
230
+			print '<p>'.sprintf(_("The table below shows the detailed information of all flights with the ident/callsign of <strong>%s</strong>."),$spotter_array[0]['ident']).'</p>';
231
+		} elseif ($type == 'marine') {
232
+			print '<p>'.sprintf(_("The table below shows the detailed information of all vessels with the ident/callsign of <strong>%s</strong>."),$spotter_array[0]['ident']).'</p>';
233
+		} elseif ($type == 'tracker') {
234
+			print '<p>'.sprintf(_("The table below shows the detailed information of all trackers with the ident/callsign of <strong>%s</strong>."),$spotter_array[0]['ident']).'</p>';
235
+		}
220 236
 
221 237
 		include('table-output.php'); 
222 238
 		print '<div class="pagination">';
Please login to merge, or discard this patch.
js/map-aircraft.2d.js.php 1 patch
Braces   +60 added lines, -16 removed lines patch added patch discarded remove patch
@@ -3,16 +3,27 @@  discard block
 block discarded – undo
3 3
 require_once('../require/class.Language.php'); 
4 4
 
5 5
 // Compressed GeoJson is used if true
6
-if (!isset($globalJsonCompress)) $compress = true;
7
-else $compress = $globalJsonCompress;
6
+if (!isset($globalJsonCompress)) {
7
+	$compress = true;
8
+} else {
9
+	$compress = $globalJsonCompress;
10
+}
8 11
 
9
-if (isset($_GET['ident'])) $ident = filter_input(INPUT_GET,'ident',FILTER_SANITIZE_STRING);
10
-if (isset($_GET['flightaware_id'])) $flightaware_id = filter_input(INPUT_GET,'flightaware_id',FILTER_SANITIZE_STRING);
12
+if (isset($_GET['ident'])) {
13
+	$ident = filter_input(INPUT_GET,'ident',FILTER_SANITIZE_STRING);
14
+}
15
+if (isset($_GET['flightaware_id'])) {
16
+	$flightaware_id = filter_input(INPUT_GET,'flightaware_id',FILTER_SANITIZE_STRING);
17
+}
11 18
 ?>
12 19
 <?php
13
-if (isset($_COOKIE['IconColor'])) $IconColor = $_COOKIE['IconColor'];
14
-elseif (isset($globalAircraftIconColor)) $IconColor = $globalAircraftIconColor;
15
-else $IconColor = '1a3151';
20
+if (isset($_COOKIE['IconColor'])) {
21
+	$IconColor = $_COOKIE['IconColor'];
22
+} elseif (isset($globalAircraftIconColor)) {
23
+	$IconColor = $globalAircraftIconColor;
24
+} else {
25
+	$IconColor = '1a3151';
26
+}
16 27
 ?>
17 28
 <?php
18 29
 if (isset($globalDebug) && $globalDebug === TRUE) {
@@ -90,9 +101,12 @@  discard block
 block discarded – undo
90 101
 
91 102
 function update_airportsLayer() {
92 103
 <?php
93
-	if (isset($_COOKIE['AirportZoom'])) $getZoom = $_COOKIE['AirportZoom'];
94
-	else $getZoom = '7';
95
-?>
104
+	if (isset($_COOKIE['AirportZoom'])) {
105
+		$getZoom = $_COOKIE['AirportZoom'];
106
+	} else {
107
+		$getZoom = '7';
108
+	}
109
+	?>
96 110
 	if (typeof airportsLayer != 'undefined') {
97 111
 		if (map.hasLayer(airportsLayer) == true) {
98 112
 			map.removeLayer(airportsLayer);
@@ -373,7 +387,12 @@  discard block
 block discarded – undo
373 387
 <?php
374 388
 		} else {
375 389
 ?>
376
-					var movingtime = Math.round(<?php if (isset($archiveupdatetime)) print $archiveupdatetime*1000; else print $globalMapRefresh*1000+20000; ?>+feature.properties.sqt*1000);
390
+					var movingtime = Math.round(<?php if (isset($archiveupdatetime)) {
391
+	print $archiveupdatetime*1000;
392
+} else {
393
+	print $globalMapRefresh*1000+20000;
394
+}
395
+?>+feature.properties.sqt*1000);
377 396
 					return new L.Marker.movingMarker([latLng, feature.properties.nextlatlon],[movingtime],{
378 397
 <?php
379 398
 		}
@@ -424,7 +443,12 @@  discard block
 block discarded – undo
424 443
 <?php
425 444
 		} else {
426 445
 ?>
427
-						var movingtime = Math.round(<?php if (isset($archiveupdatetime)) print $archiveupdatetime*1000; else print $globalMapRefresh*1000+20000; ?>+feature.properties.sqt*1000);
446
+						var movingtime = Math.round(<?php if (isset($archiveupdatetime)) {
447
+	print $archiveupdatetime*1000;
448
+} else {
449
+	print $globalMapRefresh*1000+20000;
450
+}
451
+?>+feature.properties.sqt*1000);
428 452
 						return new L.Marker.movingMarker([latLng, feature.properties.nextlatlon],[movingtime],{
429 453
 <?php
430 454
 		}
@@ -472,7 +496,12 @@  discard block
 block discarded – undo
472 496
 <?php
473 497
 		} else {
474 498
 ?>
475
-							var movingtime = Math.round(<?php if (isset($archiveupdatetime)) print $archiveupdatetime*1000; else print $globalMapRefresh*1000+20000; ?>+feature.properties.sqt*1000);
499
+							var movingtime = Math.round(<?php if (isset($archiveupdatetime)) {
500
+	print $archiveupdatetime*1000;
501
+} else {
502
+	print $globalMapRefresh*1000+20000;
503
+}
504
+?>+feature.properties.sqt*1000);
476 505
 							return new L.Marker.movingMarker([latLng, feature.properties.nextlatlon],[movingtime],{
477 506
 <?php
478 507
 		}
@@ -975,7 +1004,12 @@  discard block
 block discarded – undo
975 1004
 		update_archiveLayer(0);
976 1005
 	} else {
977 1006
 		//then load it again every 30 seconds
978
-		reloadPage = setInterval(function(){if (noTimeout) getLiveData(0)},<?php if (isset($globalMapRefresh)) print $globalMapRefresh*1000; else print '30000'; ?>);
1007
+		reloadPage = setInterval(function(){if (noTimeout) getLiveData(0)},<?php if (isset($globalMapRefresh)) {
1008
+	print $globalMapRefresh*1000;
1009
+} else {
1010
+	print '30000';
1011
+}
1012
+?>);
979 1013
 		var currentdate = new Date();
980 1014
 		var currentyear = new Date().getFullYear();
981 1015
 		var begindate = new Date(Date.UTC(currentyear,11,24,2,0,0,0));
@@ -987,7 +1021,12 @@  discard block
 block discarded – undo
987 1021
 		if (!((isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS)) && (isset($_COOKIE['polar']) && $_COOKIE['polar'] == 'true')) {
988 1022
 ?>
989 1023
 		update_polarLayer();
990
-		setInterval(function(){map.removeLayer(polarLayer);update_polarLayer()},<?php if (isset($globalMapRefresh)) print $globalMapRefresh*1000*2; else print '60000'; ?>);
1024
+		setInterval(function(){map.removeLayer(polarLayer);update_polarLayer()},<?php if (isset($globalMapRefresh)) {
1025
+	print $globalMapRefresh*1000*2;
1026
+} else {
1027
+	print '60000';
1028
+}
1029
+?>);
991 1030
 <?php
992 1031
 		}
993 1032
 ?>
@@ -1000,7 +1039,12 @@  discard block
 block discarded – undo
1000 1039
 	if ((isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM)) {
1001 1040
 ?>
1002 1041
 	update_atcLayer();
1003
-	setInterval(function(){map.removeLayer(atcLayer);update_atcLayer()},<?php if (isset($globalMapRefresh)) print $globalMapRefresh*1000*2; else print '60000'; ?>);
1042
+	setInterval(function(){map.removeLayer(atcLayer);update_atcLayer()},<?php if (isset($globalMapRefresh)) {
1043
+	print $globalMapRefresh*1000*2;
1044
+} else {
1045
+	print '60000';
1046
+}
1047
+?>);
1004 1048
 <?php
1005 1049
 	}
1006 1050
 ?>
Please login to merge, or discard this patch.
js/map-tracker.2d.js.php 1 patch
Braces   +39 added lines, -10 removed lines patch added patch discarded remove patch
@@ -5,10 +5,15 @@  discard block
 block discarded – undo
5 5
 setcookie("MapFormat",'2d');
6 6
 
7 7
 // Compressed GeoJson is used if true
8
-if (!isset($globalJsonCompress)) $compress = true;
9
-else $compress = $globalJsonCompress;
8
+if (!isset($globalJsonCompress)) {
9
+	$compress = true;
10
+} else {
11
+	$compress = $globalJsonCompress;
12
+}
10 13
 $archive = false;
11
-if (isset($_COOKIE['archive_begin']) && $_COOKIE['archive_begin'] != '') $archive = true;
14
+if (isset($_COOKIE['archive_begin']) && $_COOKIE['archive_begin'] != '') {
15
+	$archive = true;
16
+}
12 17
 ?>
13 18
 
14 19
 
@@ -166,9 +171,13 @@  discard block
 block discarded – undo
166 171
 		    if (callsign != ""){ markerTrackerLabel += callsign; }
167 172
 		    if (type != ""){ markerTrackerLabel += ' - '+type; }
168 173
 <?php
169
-	if (isset($_COOKIE['TrackerIconColor'])) $IconColor = $_COOKIE['TrackerIconColor'];
170
-	elseif (isset($globalTrackerIconColor)) $IconColor = $globalTrackerIconColor;
171
-	else $IconColor = '1a3151';
174
+	if (isset($_COOKIE['TrackerIconColor'])) {
175
+		$IconColor = $_COOKIE['TrackerIconColor'];
176
+	} elseif (isset($globalTrackerIconColor)) {
177
+		$IconColor = $globalTrackerIconColor;
178
+	} else {
179
+		$IconColor = '1a3151';
180
+	}
172 181
 	if (!isset($ident) && !isset($famtrackid)) {
173 182
 ?>
174 183
 		    //info_tracker_update(feature.properties.fc);
@@ -202,7 +211,12 @@  discard block
 block discarded – undo
202 211
 <?php
203 212
 		} else {
204 213
 ?>
205
-		    var movingtime = Math.round(<?php if (isset($archiveupdatetime)) print $archiveupdatetime*1000; else print $globalMapRefresh*1000+20000; ?>+feature.properties.sqt*1000);
214
+		    var movingtime = Math.round(<?php if (isset($archiveupdatetime)) {
215
+	print $archiveupdatetime*1000;
216
+} else {
217
+	print $globalMapRefresh*1000+20000;
218
+}
219
+?>+feature.properties.sqt*1000);
206 220
 		    return new L.Marker.movingMarker([latLng, feature.properties.nextlatlon],[movingtime],{
207 221
 <?php
208 222
 		}
@@ -259,7 +273,12 @@  discard block
 block discarded – undo
259 273
 <?php
260 274
 		} else {
261 275
 ?>
262
-			    var movingtime = Math.round(<?php if (isset($archiveupdatetime)) print $archiveupdatetime*1000; else print $globalMapRefresh*1000+20000; ?>+feature.properties.sqt*1000);
276
+			    var movingtime = Math.round(<?php if (isset($archiveupdatetime)) {
277
+	print $archiveupdatetime*1000;
278
+} else {
279
+	print $globalMapRefresh*1000+20000;
280
+}
281
+?>+feature.properties.sqt*1000);
263 282
 			    return new L.Marker.movingMarker([latLng, feature.properties.nextlatlon],[movingtime],{
264 283
 <?php
265 284
 		}
@@ -315,7 +334,12 @@  discard block
 block discarded – undo
315 334
 <?php
316 335
 		} else {
317 336
 ?>
318
-			    var movingtime = Math.round(<?php if (isset($archiveupdatetime)) print $archiveupdatetime*1000; else print $globalMapRefresh*1000+20000; ?>+feature.properties.sqt*1000);
337
+			    var movingtime = Math.round(<?php if (isset($archiveupdatetime)) {
338
+	print $archiveupdatetime*1000;
339
+} else {
340
+	print $globalMapRefresh*1000+20000;
341
+}
342
+?>+feature.properties.sqt*1000);
319 343
 			    return new L.Marker.movingMarker([latLng, feature.properties.nextlatlon],[movingtime],{
320 344
 <?php
321 345
 		}
@@ -762,7 +786,12 @@  discard block
 block discarded – undo
762 786
 getLiveTrackerData(0);
763 787
 //then load it again every 30 seconds
764 788
 reloadTrackerPage = setInterval(
765
-    function(){if (noTimeout) getLiveTrackerData(0)},<?php if (isset($globalMapRefresh)) print $globalMapRefresh*1000; else print '30000'; ?>);
789
+    function(){if (noTimeout) getLiveTrackerData(0)},<?php if (isset($globalMapRefresh)) {
790
+	print $globalMapRefresh*1000;
791
+} else {
792
+	print '30000';
793
+}
794
+?>);
766 795
 <?php
767 796
 	}
768 797
 ?>
Please login to merge, or discard this patch.
js/map-marine.2d.js.php 1 patch
Braces   +36 added lines, -9 removed lines patch added patch discarded remove patch
@@ -5,11 +5,18 @@  discard block
 block discarded – undo
5 5
 setcookie("MapFormat",'2d');
6 6
 
7 7
 // Compressed GeoJson is used if true
8
-if (!isset($globalJsonCompress)) $compress = true;
9
-else $compress = $globalJsonCompress;
10
-if (isset($_COOKIE['MarineIconColor'])) $MarineIconColor = $_COOKIE['MarineIconColor'];
11
-elseif (isset($globalMarineIconColor)) $MarineIconColor = $globalMarineIconColor;
12
-else $MarineIconColor = '1a3151';
8
+if (!isset($globalJsonCompress)) {
9
+	$compress = true;
10
+} else {
11
+	$compress = $globalJsonCompress;
12
+}
13
+if (isset($_COOKIE['MarineIconColor'])) {
14
+	$MarineIconColor = $_COOKIE['MarineIconColor'];
15
+} elseif (isset($globalMarineIconColor)) {
16
+	$MarineIconColor = $globalMarineIconColor;
17
+} else {
18
+	$MarineIconColor = '1a3151';
19
+}
13 20
 
14 21
 ?>
15 22
 
@@ -175,7 +182,12 @@  discard block
 block discarded – undo
175 182
 <?php
176 183
 		} else {
177 184
 ?>
178
-		    var movingtime = Math.round(<?php if (isset($archiveupdatetime)) print $archiveupdatetime*1000; else print $globalMapRefresh*1000+20000; ?>+feature.properties.sqt*1000);
185
+		    var movingtime = Math.round(<?php if (isset($archiveupdatetime)) {
186
+	print $archiveupdatetime*1000;
187
+} else {
188
+	print $globalMapRefresh*1000+20000;
189
+}
190
+?>+feature.properties.sqt*1000);
179 191
 		    return new L.Marker.movingMarker([latLng, feature.properties.nextlatlon],[movingtime],{
180 192
 <?php
181 193
 		}
@@ -232,7 +244,12 @@  discard block
 block discarded – undo
232 244
 <?php
233 245
 		} else {
234 246
 ?>
235
-			    var movingtime = Math.round(<?php if (isset($archiveupdatetime)) print $archiveupdatetime*1000; else print $globalMapRefresh*1000+20000; ?>+feature.properties.sqt*1000);
247
+			    var movingtime = Math.round(<?php if (isset($archiveupdatetime)) {
248
+	print $archiveupdatetime*1000;
249
+} else {
250
+	print $globalMapRefresh*1000+20000;
251
+}
252
+?>+feature.properties.sqt*1000);
236 253
 			    return new L.Marker.movingMarker([latLng, feature.properties.nextlatlon],[movingtime],{
237 254
 <?php
238 255
 		}
@@ -288,7 +305,12 @@  discard block
 block discarded – undo
288 305
 <?php
289 306
 		} else {
290 307
 ?>
291
-			    var movingtime = Math.round(<?php if (isset($archiveupdatetime)) print $archiveupdatetime*1000; else print $globalMapRefresh*1000+20000; ?>+feature.properties.sqt*1000);
308
+			    var movingtime = Math.round(<?php if (isset($archiveupdatetime)) {
309
+	print $archiveupdatetime*1000;
310
+} else {
311
+	print $globalMapRefresh*1000+20000;
312
+}
313
+?>+feature.properties.sqt*1000);
292 314
 			    return new L.Marker.movingMarker([latLng, feature.properties.nextlatlon],[movingtime],{
293 315
 <?php
294 316
 		}
@@ -696,7 +718,12 @@  discard block
 block discarded – undo
696 718
 } else {
697 719
 	//then load it again every 30 seconds
698 720
 	reloadMarinePage = setInterval(
699
-	function(){if (noTimeout) getLiveMarineData(0)},<?php if (isset($globalMapRefresh)) print $globalMapRefresh*1000; else print '30000'; ?>);
721
+	function(){if (noTimeout) getLiveMarineData(0)},<?php if (isset($globalMapRefresh)) {
722
+	print $globalMapRefresh*1000;
723
+} else {
724
+	print '30000';
725
+}
726
+?>);
700 727
 }
701 728
 
702 729
 function MarineiconColor(color) {
Please login to merge, or discard this patch.
js/map.2d.js.php 1 patch
Braces   +122 added lines, -28 removed lines patch added patch discarded remove patch
@@ -4,10 +4,15 @@  discard block
 block discarded – undo
4 4
 
5 5
 setcookie("MapFormat",'2d');
6 6
 
7
-if (!isset($globalOpenWeatherMapKey)) $globalOpenWeatherMapKey = '';
7
+if (!isset($globalOpenWeatherMapKey)) {
8
+	$globalOpenWeatherMapKey = '';
9
+}
8 10
 // Compressed GeoJson is used if true
9
-if (!isset($globalJsonCompress)) $compress = true;
10
-else $compress = $globalJsonCompress;
11
+if (!isset($globalJsonCompress)) {
12
+	$compress = true;
13
+} else {
14
+	$compress = $globalJsonCompress;
15
+}
11 16
 
12 17
 /*
13 18
 if (isset($_COOKIE['archive_begin']) && $_COOKIE['archive_begin'] != '') {
@@ -97,7 +102,17 @@  discard block
 block discarded – undo
97 102
 	}
98 103
 
99 104
 	//create the map
100
-	map = L.map('archive-map', { zoomControl:false }).setView([<?php if (isset($latitude)) print $latitude; else print $globalCenterLatitude; ?>,<?php if (isset($longitude)) print $longitude; else print $globalCenterLongitude; ?>], zoom);
105
+	map = L.map('archive-map', { zoomControl:false }).setView([<?php if (isset($latitude)) {
106
+	print $latitude;
107
+} else {
108
+	print $globalCenterLatitude;
109
+}
110
+?>,<?php if (isset($longitude)) {
111
+	print $longitude;
112
+} else {
113
+	print $globalCenterLongitude;
114
+}
115
+?>], zoom);
101 116
 <?php
102 117
 	} else {
103 118
 		if ((isset($globalCenterLatitude) && $globalCenterLatitude != '' && isset($globalCenterLongitude) && $globalCenterLongitude != '') || isset($_COOKIE['lastcentercoord'])) {
@@ -123,9 +138,21 @@  discard block
 block discarded – undo
123 138
 	     || navigator.userAgent.match(/BlackBerry/i)
124 139
 	     || navigator.userAgent.match(/Windows Phone/i))
125 140
 	{
126
-		var zoom = <?php if (isset($viewzoom) && $viewzoom == $globalLiveZoom) print $viewzoom-1; elseif (isset($viewzoom)) print $viewzoom; else print '8'; ?>;
141
+		var zoom = <?php if (isset($viewzoom) && $viewzoom == $globalLiveZoom) {
142
+	print $viewzoom-1;
143
+} elseif (isset($viewzoom)) {
144
+	print $viewzoom;
145
+} else {
146
+	print '8';
147
+}
148
+?>;
127 149
 	} else {
128
-		var zoom = <?php if (isset($viewzoom)) print $viewzoom; else print '9'; ?>;
150
+		var zoom = <?php if (isset($viewzoom)) {
151
+	print $viewzoom;
152
+} else {
153
+	print '9';
154
+}
155
+?>;
129 156
 	}
130 157
 
131 158
 	//create the map
@@ -151,16 +178,27 @@  discard block
 block discarded – undo
151 178
 	bounds = L.latLngBounds(southWest,northEast);
152 179
 	//a few title layers
153 180
 <?php
154
-	if (isset($_COOKIE['MapType'])) $MapType = $_COOKIE['MapType'];
155
-	else $MapType = $globalMapProvider;
181
+	if (isset($_COOKIE['MapType'])) {
182
+		$MapType = $_COOKIE['MapType'];
183
+	} else {
184
+		$MapType = $globalMapProvider;
185
+	}
156 186
 
157 187
 	if ($MapType == 'Mapbox') {
158
-		if ($_COOKIE['MapTypeId'] == 'default') $MapBoxId = $globalMapboxId;
159
-		else $MapBoxId = $_COOKIE['MapTypeId'];
160
-?>
188
+		if ($_COOKIE['MapTypeId'] == 'default') {
189
+			$MapBoxId = $globalMapboxId;
190
+		} else {
191
+			$MapBoxId = $_COOKIE['MapTypeId'];
192
+		}
193
+		?>
161 194
 	L.tileLayer('https://{s}.tiles.mapbox.com/v4/{id}/{z}/{x}/{y}.png?access_token={token}', {
162 195
 	    maxZoom: 18,
163
-	    noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) print 'false'; else print 'true'; ?>,
196
+	    noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) {
197
+	print 'false';
198
+} else {
199
+	print 'true';
200
+}
201
+?>,
164 202
 	    attribution: '© <a href="https://www.mapbox.com/about/maps/">Mapbox</a> © <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a> <strong><a href="https://www.mapbox.com/map-feedback/" target="_blank">Improve this map</a></strong>',
165 203
 	    id: '<?php print $MapBoxId; ?>',
166 204
 	    token: '<?php print $globalMapboxToken; ?>'
@@ -179,7 +217,12 @@  discard block
 block discarded – undo
179 217
 ?>
180 218
 	L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
181 219
 	    maxZoom: 18,
182
-	    noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) print 'false'; else print 'true'; ?>,
220
+	    noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) {
221
+	print 'false';
222
+} else {
223
+	print 'true';
224
+}
225
+?>,
183 226
 	    attribution: 'Map data &copy; <a href="http://openstreetmap.org">OpenStreetMap</a> contributors, ' +
184 227
 	      '<a href="www.openstreetmap.org/copyright">Open Database Licence</a>'
185 228
 	}).addTo(map);
@@ -188,7 +231,12 @@  discard block
 block discarded – undo
188 231
 ?>
189 232
 	L.tileLayer('https://server.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer/tile/{z}/{y}/{x}', {
190 233
 	    maxZoom: 18,
191
-	    noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) print 'false'; else print 'true'; ?>,
234
+	    noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) {
235
+	print 'false';
236
+} else {
237
+	print 'true';
238
+}
239
+?>,
192 240
 	    attribution: 'Tiles &copy; Esri &mdash; Source: Esri, DeLorme, NAVTEQ, USGS, Intermap, iPC, NRCAN, Esri Japan, METI, Esri China (Hong Kong), Esri (Thailand), TomTom, 2012'
193 241
 	}).addTo(map);
194 242
 <?php
@@ -196,7 +244,12 @@  discard block
 block discarded – undo
196 244
 ?>
197 245
 	L.tileLayer('https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}', {
198 246
 	    maxZoom: 18,
199
-	    noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) print 'false'; else print 'true'; ?>,
247
+	    noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) {
248
+	print 'false';
249
+} else {
250
+	print 'true';
251
+}
252
+?>,
200 253
 	    attribution: 'Tiles &copy; Esri &mdash; Source: Esri, i-cubed, USDA, USGS, AEX, GeoEye, Getmapping, Aerogrid, IGN, IGP, UPR-EGP, and the GIS User Community'
201 254
 	}).addTo(map);
202 255
 <?php
@@ -204,7 +257,12 @@  discard block
 block discarded – undo
204 257
 ?>
205 258
 	L.tileLayer('https://server.arcgisonline.com/ArcGIS/rest/services/NatGeo_World_Map/MapServer/tile/{z}/{y}/{x}', {
206 259
 	    maxZoom: 18,
207
-	    noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) print 'false'; else print 'true'; ?>,
260
+	    noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) {
261
+	print 'false';
262
+} else {
263
+	print 'true';
264
+}
265
+?>,
208 266
 	    attribution: 'Tiles &copy; Esri &mdash; National Geographic, Esri, DeLorme, NAVTEQ, UNEP-WCMC, USGS, NASA, ESA, METI, NRCAN, GEBCO, NOAA, iPC'
209 267
 	}).addTo(map);
210 268
 <?php
@@ -249,20 +307,26 @@  discard block
 block discarded – undo
249 307
 	map.addLayer(yandexLayer);
250 308
 <?php
251 309
 	} elseif ($MapType == 'Bing-Aerial') {
252
-		if (!isset($globalBingMapKey) || $globalBingMapKey == '') setcookie('MapType','OpenStreetMap');
253
-?>
310
+		if (!isset($globalBingMapKey) || $globalBingMapKey == '') {
311
+			setcookie('MapType','OpenStreetMap');
312
+		}
313
+		?>
254 314
 	var bingLayer = new L.tileLayer.bing({bingMapsKey: '<?php print $globalBingMapKey; ?>',imagerySet: 'Aerial'});
255 315
 	map.addLayer(bingLayer);
256 316
 <?php
257 317
 	} elseif ($MapType == 'Bing-Hybrid') {
258
-		if (!isset($globalBingMapKey) || $globalBingMapKey == '') setcookie('MapType','OpenStreetMap');
259
-?>
318
+		if (!isset($globalBingMapKey) || $globalBingMapKey == '') {
319
+			setcookie('MapType','OpenStreetMap');
320
+		}
321
+		?>
260 322
 	var bingLayer = new L.tileLayer.bing({bingMapsKey: '<?php print $globalBingMapKey; ?>',imagerySet: 'AerialWithLabels'});
261 323
 	map.addLayer(bingLayer);
262 324
 <?php
263 325
 	} elseif ($MapType == 'Bing-Road') {
264
-		if (!isset($globalBingMapKey) || $globalBingMapKey == '') setcookie('MapType','OpenStreetMap');
265
-?>
326
+		if (!isset($globalBingMapKey) || $globalBingMapKey == '') {
327
+			setcookie('MapType','OpenStreetMap');
328
+		}
329
+		?>
266 330
 	var bingLayer = new L.tileLayer.bing({bingMapsKey: '<?php print $globalBingMapKey; ?>',imagerySet: 'Road'});
267 331
 	map.addLayer(bingLayer);
268 332
 <?php
@@ -291,7 +355,12 @@  discard block
 block discarded – undo
291 355
 	    maxZoom: 5,
292 356
 	    tms : true,
293 357
 	    zindex : 3,
294
-	    noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) print 'false'; else print 'true'; ?>,
358
+	    noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) {
359
+	print 'false';
360
+} else {
361
+	print 'true';
362
+}
363
+?>,
295 364
 	    attribution: 'Natural Earth'
296 365
 	}).addTo(map);
297 366
 <?php
@@ -299,9 +368,24 @@  discard block
 block discarded – undo
299 368
 		$customid = $MapType;
300 369
 ?>
301 370
 	L.tileLayer('<?php print $globalMapCustomLayer[$customid]['url']; ?>/{z}/{x}/{y}.png', {
302
-	    maxZoom: <?php if (isset($globalMapCustomLayer[$customid]['maxZoom'])) print $globalMapCustomLayer[$customid]['maxZoom']; else print '18'; ?>,
303
-	    minZoom: <?php if (isset($globalMapCustomLayer[$customid]['minZoom'])) print $globalMapCustomLayer[$customid]['minZoom']; else print '0'; ?>,
304
-	    noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) print 'false'; else print 'true'; ?>,
371
+	    maxZoom: <?php if (isset($globalMapCustomLayer[$customid]['maxZoom'])) {
372
+	print $globalMapCustomLayer[$customid]['maxZoom'];
373
+} else {
374
+	print '18';
375
+}
376
+?>,
377
+	    minZoom: <?php if (isset($globalMapCustomLayer[$customid]['minZoom'])) {
378
+	print $globalMapCustomLayer[$customid]['minZoom'];
379
+} else {
380
+	print '0';
381
+}
382
+?>,
383
+	    noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) {
384
+	print 'false';
385
+} else {
386
+	print 'true';
387
+}
388
+?>,
305 389
 	    attribution: '<?php print $globalMapCustomLayer[$customid]['attribution']; ?>'
306 390
 	}).addTo(map);
307 391
 
@@ -341,7 +425,12 @@  discard block
 block discarded – undo
341 425
 		}
342 426
 	} elseif ($globalBounding == 'circle') {
343 427
 ?>
344
-	var circle = L.circle([<?php print $globalCenterLatitude; ?>, <?php print $globalCenterLongitude; ?>],<?php if (isset($globalBoundingCircleSize)) print $globalBoundingCircleSize; else print '70000'; ?>,{
428
+	var circle = L.circle([<?php print $globalCenterLatitude; ?>, <?php print $globalCenterLongitude; ?>],<?php if (isset($globalBoundingCircleSize)) {
429
+	print $globalBoundingCircleSize;
430
+} else {
431
+	print '70000';
432
+}
433
+?>,{
345 434
 	    color: '#92C7D1',
346 435
 	    fillColor: '#92C7D1',
347 436
 	    fillOpacity: 0.3,
@@ -431,7 +520,12 @@  discard block
 block discarded – undo
431 520
 	});
432 521
 	if (archive === false) {
433 522
 		update_locationsLayer();
434
-		setInterval(function(){if (noTimeout) { map.removeLayer(locationsLayer); update_locationsLayer();} },<?php if (isset($globalMapRefresh)) print $globalMapRefresh*1000*2; else print '60000'; ?>);
523
+		setInterval(function(){if (noTimeout) { map.removeLayer(locationsLayer); update_locationsLayer();} },<?php if (isset($globalMapRefresh)) {
524
+	print $globalMapRefresh*1000*2;
525
+} else {
526
+	print '60000';
527
+}
528
+?>);
435 529
 	}
436 530
 <?php
437 531
     // Add support for custom json via $globalMapJson
Please login to merge, or discard this patch.
live-czml.php 1 patch
Braces   +132 added lines, -48 removed lines patch added patch discarded remove patch
@@ -19,8 +19,12 @@  discard block
 block discarded – undo
19 19
 }
20 20
 $tracker = false;
21 21
 $marine = false;
22
-if (isset($_GET['tracker'])) $tracker = true;
23
-if (isset($_GET['marine'])) $marine = true;
22
+if (isset($_GET['tracker'])) {
23
+	$tracker = true;
24
+}
25
+if (isset($_GET['marine'])) {
26
+	$marine = true;
27
+}
24 28
 if ($tracker) {
25 29
 	require_once('require/class.Tracker.php');
26 30
 	require_once('require/class.TrackerLive.php');
@@ -77,24 +81,49 @@  discard block
 block discarded – undo
77 81
 }
78 82
 header('Content-Type: text/javascript');
79 83
 
80
-if (!isset($globalJsonCompress)) $compress = true;
81
-else $compress = $globalJsonCompress;
84
+if (!isset($globalJsonCompress)) {
85
+	$compress = true;
86
+} else {
87
+	$compress = $globalJsonCompress;
88
+}
82 89
 
83 90
 $from_archive = false;
84 91
 $min = false;
85 92
 $allhistory = false;
86 93
 $filter['source'] = array();
87
-if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') $filter['source'] = array_merge($filter['source'],array('vatsimtxt'));
88
-if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') $filter['source'] = array_merge($filter['source'],array('whazzup'));
89
-if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') $filter['source'] = array_merge($filter['source'],array('phpvmacars'));
90
-if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') $filter['source'] = array_merge($filter['source'],array('sbs','famaprs'));
91
-if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') $filter['source'] = array_merge($filter['source'],array('aprs'));
92
-if (isset($_COOKIE['filter_ident']) && $_COOKIE['filter_ident'] != '') $filter['ident'] = filter_var($_COOKIE['filter_ident'],FILTER_SANITIZE_STRING);
93
-if (isset($_COOKIE['filter_mmsi']) && $_COOKIE['filter_mmsi'] != '') $filter['mmsi'] = filter_var($_COOKIE['filter_mmsi'],FILTER_SANITIZE_STRING);
94
-if (isset($_COOKIE['filter_Airlines']) && $_COOKIE['filter_Airlines'] != '') $filter['airlines'] = filter_var_array(explode(',',$_COOKIE['filter_Airlines']),FILTER_SANITIZE_STRING);
95
-if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') $filter['source_aprs'] = filter_var_array(explode(',',$_COOKIE['filter_Sources']),FILTER_SANITIZE_STRING);
96
-if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') $filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'],FILTER_SANITIZE_STRING);
97
-if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] != 'all') $filter['alliance'] = filter_var($_COOKIE['filter_alliance'],FILTER_SANITIZE_STRING);
94
+if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') {
95
+	$filter['source'] = array_merge($filter['source'],array('vatsimtxt'));
96
+}
97
+if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') {
98
+	$filter['source'] = array_merge($filter['source'],array('whazzup'));
99
+}
100
+if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') {
101
+	$filter['source'] = array_merge($filter['source'],array('phpvmacars'));
102
+}
103
+if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') {
104
+	$filter['source'] = array_merge($filter['source'],array('sbs','famaprs'));
105
+}
106
+if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') {
107
+	$filter['source'] = array_merge($filter['source'],array('aprs'));
108
+}
109
+if (isset($_COOKIE['filter_ident']) && $_COOKIE['filter_ident'] != '') {
110
+	$filter['ident'] = filter_var($_COOKIE['filter_ident'],FILTER_SANITIZE_STRING);
111
+}
112
+if (isset($_COOKIE['filter_mmsi']) && $_COOKIE['filter_mmsi'] != '') {
113
+	$filter['mmsi'] = filter_var($_COOKIE['filter_mmsi'],FILTER_SANITIZE_STRING);
114
+}
115
+if (isset($_COOKIE['filter_Airlines']) && $_COOKIE['filter_Airlines'] != '') {
116
+	$filter['airlines'] = filter_var_array(explode(',',$_COOKIE['filter_Airlines']),FILTER_SANITIZE_STRING);
117
+}
118
+if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') {
119
+	$filter['source_aprs'] = filter_var_array(explode(',',$_COOKIE['filter_Sources']),FILTER_SANITIZE_STRING);
120
+}
121
+if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') {
122
+	$filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'],FILTER_SANITIZE_STRING);
123
+}
124
+if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] != 'all') {
125
+	$filter['alliance'] = filter_var($_COOKIE['filter_alliance'],FILTER_SANITIZE_STRING);
126
+}
98 127
 /*
99 128
 if (isset($globalMapPopup) && !$globalMapPopup && !(isset($_COOKIE['flightpopup']) && $_COOKIE['flightpopup'] == 'true')) {
100 129
 	$min = true;
@@ -268,8 +297,12 @@  discard block
 block discarded – undo
268 297
 			$flightcnt = $SpotterLive->getLiveSpotterCount($filter);
269 298
 		}
270 299
 	}
271
-	if ($flightcnt == '') $flightcnt = 0;
272
-} else $flightcnt = 0;
300
+	if ($flightcnt == '') {
301
+		$flightcnt = 0;
302
+	}
303
+	} else {
304
+	$flightcnt = 0;
305
+}
273 306
 
274 307
 $sqltime = round(microtime(true)-$begintime,2);
275 308
 $minitime = time();
@@ -315,7 +348,9 @@  discard block
 block discarded – undo
315 348
 $gltf2 = false;
316 349
 $scale = 1.0;
317 350
 $minimumpixelsize = 20;
318
-if (isset($archivespeed)) $speed = $archivespeed;
351
+if (isset($archivespeed)) {
352
+	$speed = $archivespeed;
353
+}
319 354
 $output = '[';
320 355
 if ($tracker) {
321 356
 	$output .= '{"id" : "document", "name" : "tracker","version" : "1.0"';
@@ -351,9 +386,13 @@  discard block
 block discarded – undo
351 386
 			$image = "images/placeholder_thumb.png";
352 387
 		}
353 388
 
354
-                if (isset($spotter_item['flightaware_id'])) $id = $spotter_item['flightaware_id'];
355
-                elseif (isset($spotter_item['famtrackid'])) $id = $spotter_item['famtrackid'];
356
-                elseif (isset($spotter_item['fammarine_id'])) $id = $spotter_item['fammarine_id'];
389
+                if (isset($spotter_item['flightaware_id'])) {
390
+                	$id = $spotter_item['flightaware_id'];
391
+                } elseif (isset($spotter_item['famtrackid'])) {
392
+                	$id = $spotter_item['famtrackid'];
393
+                } elseif (isset($spotter_item['fammarine_id'])) {
394
+                	$id = $spotter_item['fammarine_id'];
395
+                }
357 396
                 if ($prev_flightaware_id != $id) {
358 397
 			if ($prev_flightaware_id != '') {
359 398
 				/*
@@ -391,14 +430,24 @@  discard block
 block discarded – undo
391 430
 			if (isset($spotter_item['squawk'])) {
392 431
 				$output .= '"squawk": "'.$spotter_item['squawk'].'",';
393 432
 			}
394
-			if (isset($spotter_item['registration'])) $output .= '"registration": "'.$spotter_item['registration'].'",';
395
-			if (isset($spotter_item['format_source'])) $output .= '"format": "'.$spotter_item['format_source'].'",';
396
-			if (isset($spotter_item['ident'])) $output.= '"ident": "'.$spotter_item['ident'].'",';
433
+			if (isset($spotter_item['registration'])) {
434
+				$output .= '"registration": "'.$spotter_item['registration'].'",';
435
+			}
436
+			if (isset($spotter_item['format_source'])) {
437
+				$output .= '"format": "'.$spotter_item['format_source'].'",';
438
+			}
439
+			if (isset($spotter_item['ident'])) {
440
+				$output.= '"ident": "'.$spotter_item['ident'].'",';
441
+			}
397 442
 			if ($tracker) {
398
-				if (isset($spotter_item['type'])) $output .= '"tracker_type": "'.$spotter_item['type'].'",';
443
+				if (isset($spotter_item['type'])) {
444
+					$output .= '"tracker_type": "'.$spotter_item['type'].'",';
445
+				}
399 446
 				$output.= '"type": "tracker"';
400 447
 			} elseif ($marine) {
401
-				if (isset($spotter_item['type'])) $output .= '"marine_type": "'.$spotter_item['type'].'",';
448
+				if (isset($spotter_item['type'])) {
449
+					$output .= '"marine_type": "'.$spotter_item['type'].'",';
450
+				}
402 451
 				$output.= '"type": "marine"';
403 452
 			} else {
404 453
 				if ($one3dmodel === false && isset($globalMap3DLiveries) && $globalMap3DLiveries) {
@@ -449,7 +498,9 @@  discard block
 block discarded – undo
449 498
 							$spotter_item['engine_type'] = $aircraft_info[0]['engine_type'];
450 499
 							$spotter_item['wake_category'] = $aircraft_info[0]['wake_category'];
451 500
 							$spotter_item['engine_count'] = $aircraft_info[0]['engine_count'];
452
-						} else $aircraft_shadow = '';
501
+						} else {
502
+							$aircraft_shadow = '';
503
+						}
453 504
 	    					$output .= ' "billboard" : {"image" : "'.$globalURL.'/images/aircrafts/new/'.$aircraft_shadow.'","scale" : 0.5';
454 505
 						if (isset($_COOKIE['IconColorForce']) && $_COOKIE['IconColorForce'] == 'true' && isset($_COOKIE['IconColor'])) {
455 506
 							$rgb = $Common->hex2rgb($_COOKIE['IconColor']);
@@ -457,7 +508,9 @@  discard block
 block discarded – undo
457 508
 						}
458 509
 						$output .= '},';
459 510
 					}
460
-				} else $output .= ' "billboard" : {"image" : "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACgAAAAfCAYAAACVgY94AAAACXBIWXMAAC4jAAAuIwF4pT92AAAKT2lDQ1BQaG90b3Nob3AgSUNDIHByb2ZpbGUAAHjanVNnVFPpFj333vRCS4iAlEtvUhUIIFJCi4AUkSYqIQkQSoghodkVUcERRUUEG8igiAOOjoCMFVEsDIoK2AfkIaKOg6OIisr74Xuja9a89+bN/rXXPues852zzwfACAyWSDNRNYAMqUIeEeCDx8TG4eQuQIEK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ApgyEgNrc27aWwVaPTA1QJ4BjgTGFvhteV40EgPrgvTP7qlmZqFnl9WD+b2posN83E/NrEkOjlI/U1fkfUYa/pe5IE3qZPW8jFOqiyN7p3pAPX04c7AxYSoDDcAjKT2LgLXA6IR2M3Bviv59wDTgQGTPH84Qd8+HXfHcoUws2zM0HMjuUPep+xP2PWpnwtw0GJsldbBpewQwE/gbeDyt7H1gcW53O7AC+A3Yn6+/W+Ld9SnWA15DAVhc8xK2TuA9YHrCuhV4EngFuBx4YagG6qv8cF+T52kB2Zy+e1I8taUacNV+uBdXO7ABmJwJpwx8XQvF9TUCWM64tiQhbq/oMv+7BwFWpQzNT8vbVQul/wwAGzzdmXU1xuUAAAAASUVORK5CYII=","scale" : 0.5},';
511
+				} else {
512
+					$output .= ' "billboard" : {"image" : "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACgAAAAfCAYAAACVgY94AAAACXBIWXMAAC4jAAAuIwF4pT92AAAKT2lDQ1BQaG90b3Nob3AgSUNDIHByb2ZpbGUAAHjanVNnVFPpFj333vRCS4iAlEtvUhUIIFJCi4AUkSYqIQkQSoghodkVUcERRUUEG8igiAOOjoCMFVEsDIoK2AfkIaKOg6OIisr74Xuja9a89+bN/rXXPues852zzwfACAyWSDNRNYAMqUIeEeCDx8TG4eQuQIEKJHAAEAizZCFz/SMBAPh+PDwrIsAHvgABeNMLCADATZvAMByH/w/qQplcAYCEAcB0kThLCIAUAEB6jkKmAEBGAYCdmCZTAKAEAGDLY2LjAFAtAGAnf+bTAICd+Jl7AQBblCEVAaCRACATZYhEAGg7AKzPVopFAFgwABRmS8Q5ANgtADBJV2ZIALC3AMDOEAuyAAgMADBRiIUpAAR7AGDIIyN4AISZABRG8lc88SuuEOcqAAB4mbI8uSQ5RYFbCC1xB1dXLh4ozkkXKxQ2YQJhmkAuwnmZGTKBNA/g88wAAKCRFRHgg/P9eM4Ors7ONo62Dl8t6r8G/yJiYuP+5c+rcEAAAOF0ftH+LC+zGoA7BoBt/q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mXU1xuUAAAAASUVORK5CYII=","scale" : 0.5},';
513
+				}
461 514
 			} elseif ($one3dmodel) {
462 515
 				if (isset($globalMap3DForceModel) && $globalMap3DForceModel != '') {
463 516
 					$output .= '"model": {"gltf" : "'.$globalURL.'/models/'.$globalMap3DForceModel.'","scale" : '.$scale.',"minimumPixelSize": '.$minimumpixelsize.'';
@@ -497,7 +550,9 @@  discard block
 block discarded – undo
497 550
 							$spotter_item['engine_type'] = $aircraft_info[0]['engine_type'];
498 551
 							$spotter_item['wake_category'] = $aircraft_info[0]['wake_category'];
499 552
 							$spotter_item['engine_count'] = $aircraft_info[0]['engine_count'];
500
-						} else $aircraft_shadow = '';
553
+						} else {
554
+							$aircraft_shadow = '';
555
+						}
501 556
 						if ($aircraft_shadow != '') {
502 557
 							if (isset($modelsdb2[$aircraft_shadow])) {
503 558
 								$output .= '"model": {"gltf" : "'.$globalURL.'/models/gltf2/'.$modelsdb2[$aircraft_shadow]['glb'].'","scale" : '.$scale.',"minimumPixelSize": '.$modelsdb2[$aircraft_shadow]['size'];
@@ -652,7 +707,9 @@  discard block
 block discarded – undo
652 707
 								}
653 708
 								$output .= '},';
654 709
 								//if ($spotter_item['aircraft_shadow'] != '') $output .= '"aircraft_shadow": "'.$spotter_item['aircraft_shadow'].'",';
655
-								if ($spotter_item['aircraft_icao'] != '') $output .= '"aircraft_icao": "'.$spotter_item['aircraft_icao'].'",';
710
+								if ($spotter_item['aircraft_icao'] != '') {
711
+									$output .= '"aircraft_icao": "'.$spotter_item['aircraft_icao'].'",';
712
+								}
656 713
 								$modelsdb[$aircraft_icao] = 'Cesium_Air.glb';
657 714
 							}
658 715
 						} elseif (isset($spotter_item['format_source']) && $spotter_item['format_source'] == 'aprs') {
@@ -674,7 +731,9 @@  discard block
 block discarded – undo
674 731
 							}
675 732
 							$output .= '},';
676 733
 							//if ($spotter_item['aircraft_shadow'] != '') $output .= '"aircraft_shadow": "'.$spotter_item['aircraft_shadow'].'",';
677
-							if ($spotter_item['aircraft_icao'] != '') $output .= '"aircraft_icao": "'.$spotter_item['aircraft_icao'].'",';
734
+							if ($spotter_item['aircraft_icao'] != '') {
735
+								$output .= '"aircraft_icao": "'.$spotter_item['aircraft_icao'].'",';
736
+							}
678 737
 							$modelsdb[$aircraft_icao] = 'Cesium_Air.glb';
679 738
 						}
680 739
 					} else {
@@ -687,7 +746,9 @@  discard block
 block discarded – undo
687 746
 						}
688 747
 						$output .= '},';
689 748
 						//if ($spotter_item['aircraft_shadow'] != '') $output .= '"aircraft_shadow": "'.$spotter_item['aircraft_shadow'].'",';
690
-						if ($spotter_item['aircraft_icao'] != '') $output .= '"aircraft_icao": "'.$spotter_item['aircraft_icao'].'",';
749
+						if ($spotter_item['aircraft_icao'] != '') {
750
+							$output .= '"aircraft_icao": "'.$spotter_item['aircraft_icao'].'",';
751
+						}
691 752
 						$modelsdb[$aircraft_icao] = 'Cesium_Air.glb';
692 753
 					}
693 754
 				} elseif ($tracker && isset($spotter_item['type'])) {
@@ -791,8 +852,11 @@  discard block
 block discarded – undo
791 852
 					$output .= '},';
792 853
 				}
793 854
 			}
794
-			if (isset($onground) && $onground) $output = str_replace('%onground%','true',$output);
795
-			else $output = str_replace('%onground%','false',$output);
855
+			if (isset($onground) && $onground) {
856
+				$output = str_replace('%onground%','true',$output);
857
+			} else {
858
+				$output = str_replace('%onground%','false',$output);
859
+			}
796 860
 
797 861
 	//		$output .= '"heightReference": "CLAMP_TO_GROUND",';
798 862
 			//$output .= '"heightReference": "'.$heightrelative.'",';
@@ -805,9 +869,15 @@  discard block
 block discarded – undo
805 869
 	//		$output .= '"interpolationDegree" : 5,';
806 870
 	//		$output .= '"epoch" : "'.date("c",strtotime($spotter_item['date'])).'", ';
807 871
 			$output .= '"cartographicDegrees": [';
808
-			if ($minitime > strtotime($spotter_item['date'])) $minitime = strtotime($spotter_item['date']);
809
-			if (isset($_COOKIE['MapTrack']) && $id == $_COOKIE['MapTrack'] && $minitracktime > strtotime($spotter_item['date'])) $minitracktime = strtotime($spotter_item['date']);
810
-			if ($maxitime < strtotime($spotter_item['date'])) $maxitime = strtotime($spotter_item['date']);
872
+			if ($minitime > strtotime($spotter_item['date'])) {
873
+				$minitime = strtotime($spotter_item['date']);
874
+			}
875
+			if (isset($_COOKIE['MapTrack']) && $id == $_COOKIE['MapTrack'] && $minitracktime > strtotime($spotter_item['date'])) {
876
+				$minitracktime = strtotime($spotter_item['date']);
877
+			}
878
+			if ($maxitime < strtotime($spotter_item['date'])) {
879
+				$maxitime = strtotime($spotter_item['date']);
880
+			}
811 881
 			$output .= '"'.date("c",strtotime($spotter_item['date'])).'", ';
812 882
 			$output .= $spotter_item['longitude'].', ';
813 883
 			$output .= $spotter_item['latitude'];
@@ -830,7 +900,9 @@  discard block
 block discarded – undo
830 900
 					$output .= ', '.round($spotter_item['altitude']*30.48);
831 901
 					$prevalt = round($spotter_item['altitude']*30.48);
832 902
 				}
833
-			} else $output .= ', 0';
903
+			} else {
904
+				$output .= ', 0';
905
+			}
834 906
 			//$orientation = '"orientation" : { ';
835 907
 			//$orientation .= '"unitQuaternion": [';
836 908
 			//$quat = quaternionrotate(deg2rad($spotter_item['heading']),deg2rad(0),deg2rad(0));
@@ -838,13 +910,18 @@  discard block
 block discarded – undo
838 910
 		} else {
839 911
 			$nblatlong = $nblatlong+1;
840 912
 			$output .= ',"'.date("c",strtotime($spotter_item['date'])).'", ';
841
-			if ($maxitime < strtotime($spotter_item['date'])) $maxitime = strtotime($spotter_item['date']);
913
+			if ($maxitime < strtotime($spotter_item['date'])) {
914
+				$maxitime = strtotime($spotter_item['date']);
915
+			}
842 916
 			if ($spotter_item['ground_speed'] == 0) {
843 917
 				$output .= $prevlong.', ';
844 918
 				$output .= $prevlat;
845 919
 				//if (!$marine && (!isset($onground) || !$onground)) $output .= ', '.$prevalt;
846
-				if (!$marine) $output .= ', '.$prevalt;
847
-				else $output .= ', 0';
920
+				if (!$marine) {
921
+					$output .= ', '.$prevalt;
922
+				} else {
923
+					$output .= ', 0';
924
+				}
848 925
 			} else {
849 926
 				$output .= $spotter_item['longitude'].', ';
850 927
 				$output .= $spotter_item['latitude'];
@@ -857,14 +934,17 @@  discard block
 block discarded – undo
857 934
 							$output .= ', 0';
858 935
 						}
859 936
 					} else {
860
-						if (isset($spotter_item['real_altitude']) && $spotter_item['real_altitude'] != '') $output .= ', '.round($spotter_item['real_altitude']*0.3048);
861
-						elseif ($tracker) {
937
+						if (isset($spotter_item['real_altitude']) && $spotter_item['real_altitude'] != '') {
938
+							$output .= ', '.round($spotter_item['real_altitude']*0.3048);
939
+						} elseif ($tracker) {
862 940
 							$output .= ', '.round($spotter_item['altitude']*0.3048);
863 941
 						} else {
864 942
 							$output .= ', '.round($spotter_item['altitude']*30.48);
865 943
 						}
866 944
 					}
867
-				} else $output .= ', 0';
945
+				} else {
946
+					$output .= ', 0';
947
+				}
868 948
 			}
869 949
 			//$quat = quaternionrotate(deg2rad($spotter_item['heading']),deg2rad(0),deg2rad(0));
870 950
 			//$orientation .= ',"'.date("c",strtotime($spotter_item['date'])).'",'.$quat['x'].','.$quat['y'].','.$quat['z'].','.$quat['w'];
@@ -885,9 +965,10 @@  discard block
 block discarded – undo
885 965
 		} else {
886 966
 			$output = str_replace('%minitime%',date("c",time()-$globalLiveInterval),$output);
887 967
 		}
968
+	} else {
969
+		$output = str_replace('%minitime%',date("c",$minitime),$output);
888 970
 	}
889
-	else $output = str_replace('%minitime%',date("c",$minitime),$output);
890
-} elseif (isset($_COOKIE['MapTrack']) && $_COOKIE['MapTrack'] != '' && $minitracktime != $minitracktime_begin) {
971
+	} elseif (isset($_COOKIE['MapTrack']) && $_COOKIE['MapTrack'] != '' && $minitracktime != $minitracktime_begin) {
891 972
 	$output = str_replace('%minitime%',date("c",$minitracktime),$output);
892 973
 } else {
893 974
 	$output = str_replace('%minitime%',date("c",$minitime),$output);
@@ -897,7 +978,10 @@  discard block
 block discarded – undo
897 978
 } else {
898 979
 	$output = str_replace('%maxitime%',date("c",$maxitime),$output);
899 980
 }
900
-if ($gltf2) $output = str_replace('%gltf2%','true',$output);
901
-else $output = str_replace('%gltf2%','false',$output);
981
+if ($gltf2) {
982
+	$output = str_replace('%gltf2%','true',$output);
983
+} else {
984
+	$output = str_replace('%gltf2%','false',$output);
985
+}
902 986
 print $output;
903 987
 ?>
Please login to merge, or discard this patch.
require/class.SpotterLive.php 1 patch
Braces   +143 added lines, -48 removed lines patch added patch discarded remove patch
@@ -8,7 +8,9 @@  discard block
 block discarded – undo
8 8
 	public function __construct($dbc = null) {
9 9
 		$Connection = new Connection($dbc);
10 10
 		$this->db = $Connection->db();
11
-		if ($this->db === null) die('Error: No DB connection. (SpotterLive)');
11
+		if ($this->db === null) {
12
+			die('Error: No DB connection. (SpotterLive)');
13
+		}
12 14
 	}
13 15
 
14 16
 
@@ -30,7 +32,9 @@  discard block
 block discarded – undo
30 32
 		if (isset($filter[0]['source'])) {
31 33
 			$filters = array_merge($filters,$filter);
32 34
 		}
33
-		if (is_array($globalFilter)) $filter = array_merge($filter,$globalFilter);
35
+		if (is_array($globalFilter)) {
36
+			$filter = array_merge($filter,$globalFilter);
37
+		}
34 38
 		$filter_query_join = '';
35 39
 		$filter_query_where = '';
36 40
 		foreach($filters as $flt) {
@@ -126,8 +130,11 @@  discard block
 block discarded – undo
126 130
 		if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) {
127 131
 			$filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')";
128 132
 		}
129
-		if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE';
130
-		elseif ($filter_query_where != '' && $and) $filter_query_where .= ' AND';
133
+		if ($filter_query_where == '' && $where) {
134
+			$filter_query_where = ' WHERE';
135
+		} elseif ($filter_query_where != '' && $and) {
136
+			$filter_query_where .= ' AND';
137
+		}
131 138
 		if ($filter_query_where != '') {
132 139
 			$filter_query_where = preg_replace('/^ AND/',' WHERE',$filter_query_where);
133 140
 		}
@@ -168,9 +175,13 @@  discard block
 block discarded – undo
168 175
 				$orderby_query = ' '.$search_orderby_array[$sort]['sql'];
169 176
 			}
170 177
 		}
171
-		if ($orderby_query == '') $orderby_query = ' ORDER BY date DESC';
178
+		if ($orderby_query == '') {
179
+			$orderby_query = ' ORDER BY date DESC';
180
+		}
172 181
 
173
-		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
182
+		if (!isset($globalLiveInterval)) {
183
+			$globalLiveInterval = '200';
184
+		}
174 185
 		if ($globalDBdriver == 'mysql') {
175 186
 			//$query  = "SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL 30 SECOND) <= l.date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate";
176 187
 			$query  = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate'.$filter_query.$orderby_query;
@@ -193,7 +204,9 @@  discard block
 block discarded – undo
193 204
 		global $globalDBdriver, $globalLiveInterval, $globalArchive;
194 205
 		date_default_timezone_set('UTC');
195 206
 		$filter_query = $this->getFilter($filter,true,true);
196
-		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
207
+		if (!isset($globalLiveInterval)) {
208
+			$globalLiveInterval = '200';
209
+		}
197 210
 		if ($globalDBdriver == 'mysql') {
198 211
 			if (isset($globalArchive) && $globalArchive === TRUE) {
199 212
 				$query  = 'SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.real_altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source, spotter_live.registration 
@@ -244,8 +257,12 @@  discard block
 block discarded – undo
244 257
 		$id = filter_var($id,FILTER_SANITIZE_STRING);
245 258
 		$filter_query = $this->getFilter($filter,true,true);
246 259
 
247
-		if (!isset($globalLiveInterval) || $globalLiveInterval == '') $globalLiveInterval = '200';
248
-		if (!isset($globalMap3DAircraftsLimit) || $globalMap3DAircraftsLimit == '') $globalMap3DAircraftsLimit = '300';
260
+		if (!isset($globalLiveInterval) || $globalLiveInterval == '') {
261
+			$globalLiveInterval = '200';
262
+		}
263
+		if (!isset($globalMap3DAircraftsLimit) || $globalMap3DAircraftsLimit == '') {
264
+			$globalMap3DAircraftsLimit = '300';
265
+		}
249 266
 		if ($globalDBdriver == 'mysql') {
250 267
 			if (isset($globalArchive) && $globalArchive === TRUE) {
251 268
 				/*
@@ -256,25 +273,41 @@  discard block
 block discarded – undo
256 273
 				*/
257 274
 				$query  = 'SELECT * FROM (SELECT spotter_archive.ident, spotter_archive.flightaware_id, spotter_archive.aircraft_icao, spotter_archive.departure_airport_icao as departure_airport, spotter_archive.arrival_airport_icao as arrival_airport, spotter_archive.latitude, spotter_archive.longitude, spotter_archive.altitude, spotter_archive.heading, spotter_archive.ground_speed, spotter_archive.squawk, spotter_archive.date, spotter_archive.format_source, spotter_archive.registration 
258 275
 				FROM spotter_archive INNER JOIN (SELECT flightaware_id FROM spotter_live'.$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval." SECOND) <= spotter_live.date) l ON l.flightaware_id = spotter_archive.flightaware_id ";
259
-				if ($usecoord) $query .= "AND (spotter_archive.latitude BETWEEN ".$minlat." AND ".$maxlat." AND spotter_archive.longitude BETWEEN ".$minlong." AND ".$maxlong.") ";
260
-				if ($id != '') $query .= "OR spotter_archive.flightaware_id = :id ";
276
+				if ($usecoord) {
277
+					$query .= "AND (spotter_archive.latitude BETWEEN ".$minlat." AND ".$maxlat." AND spotter_archive.longitude BETWEEN ".$minlong." AND ".$maxlong.") ";
278
+				}
279
+				if ($id != '') {
280
+					$query .= "OR spotter_archive.flightaware_id = :id ";
281
+				}
261 282
 				$query .= "UNION
262 283
 				SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source, spotter_live.registration 
263 284
 				FROM spotter_live".$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval." SECOND) <= spotter_live.date";
264
-				if ($usecoord) $query .= " AND (spotter_live.latitude BETWEEN ".$minlat." AND ".$maxlat." AND spotter_live.longitude BETWEEN ".$minlong." AND ".$maxlong.")";
265
-				if ($id != '') $query .= " OR spotter_live.flightaware_id = :id";
285
+				if ($usecoord) {
286
+					$query .= " AND (spotter_live.latitude BETWEEN ".$minlat." AND ".$maxlat." AND spotter_live.longitude BETWEEN ".$minlong." AND ".$maxlong.")";
287
+				}
288
+				if ($id != '') {
289
+					$query .= " OR spotter_live.flightaware_id = :id";
290
+				}
266 291
 				$query .= ") AS spotter 
267 292
 				WHERE latitude <> '0' AND longitude <> '0' 
268 293
 				ORDER BY flightaware_id, date";
269
-				if ($limit) $query .= " LIMIT ".$globalMap3DAircraftsLimit;
294
+				if ($limit) {
295
+					$query .= " LIMIT ".$globalMap3DAircraftsLimit;
296
+				}
270 297
 			} else {
271 298
 				$query  = 'SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source, spotter_live.registration 
272 299
 				FROM spotter_live'.$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval." SECOND) <= spotter_live.date ";
273
-				if ($usecoord) $query .= "AND (spotter_live.latitude BETWEEN ".$minlat." AND ".$maxlat." AND spotter_live.longitude BETWEEN ".$minlong." AND ".$maxlong.") ";
274
-				if ($id != '') $query .= "OR spotter_live.flightaware_id = :id ";
300
+				if ($usecoord) {
301
+					$query .= "AND (spotter_live.latitude BETWEEN ".$minlat." AND ".$maxlat." AND spotter_live.longitude BETWEEN ".$minlong." AND ".$maxlong.") ";
302
+				}
303
+				if ($id != '') {
304
+					$query .= "OR spotter_live.flightaware_id = :id ";
305
+				}
275 306
 				$query .= "AND spotter_live.latitude <> '0' AND spotter_live.longitude <> '0' 
276 307
 				ORDER BY spotter_live.flightaware_id, spotter_live.date";
277
-				if ($limit) $query .= " LIMIT ".$globalMap3DAircraftsLimit;
308
+				if ($limit) {
309
+					$query .= " LIMIT ".$globalMap3DAircraftsLimit;
310
+				}
278 311
 			}
279 312
 		} else {
280 313
 			if (isset($globalArchive) && $globalArchive === TRUE) {
@@ -286,28 +319,46 @@  discard block
 block discarded – undo
286 319
                                */
287 320
 				$query  = "SELECT * FROM (SELECT spotter_archive.ident, spotter_archive.flightaware_id, spotter_archive.aircraft_icao, spotter_archive.departure_airport_icao as departure_airport, spotter_archive.arrival_airport_icao as arrival_airport, spotter_archive.latitude, spotter_archive.longitude, spotter_archive.altitude, spotter_archive.heading, spotter_archive.ground_speed, spotter_archive.squawk, spotter_archive.date, spotter_archive.format_source, spotter_archive.registration 
288 321
 				FROM spotter_archive INNER JOIN (SELECT flightaware_id FROM spotter_live".$filter_query." CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= spotter_live.date) l ON l.flightaware_id = spotter_archive.flightaware_id ";
289
-				if ($usecoord) $query .= "AND (spotter_archive.latitude BETWEEN ".$minlat." AND ".$maxlat." AND spotter_archive.longitude BETWEEN ".$minlong." AND ".$maxlong.") ";
290
-				if ($id != '') $query .= "OR spotter_archive.flightaware_id = :id ";
322
+				if ($usecoord) {
323
+					$query .= "AND (spotter_archive.latitude BETWEEN ".$minlat." AND ".$maxlat." AND spotter_archive.longitude BETWEEN ".$minlong." AND ".$maxlong.") ";
324
+				}
325
+				if ($id != '') {
326
+					$query .= "OR spotter_archive.flightaware_id = :id ";
327
+				}
291 328
 				$query .= "UNION
292 329
 				SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source, spotter_live.registration 
293 330
 				FROM spotter_live".$filter_query." CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= spotter_live.date";
294
-				if ($usecoord) $query .= " AND (spotter_live.latitude BETWEEN ".$minlat." AND ".$maxlat." AND spotter_live.longitude BETWEEN ".$minlong." AND ".$maxlong.")";
295
-				if ($id != '') $query .= " OR spotter_live.flightaware_id = :id";
331
+				if ($usecoord) {
332
+					$query .= " AND (spotter_live.latitude BETWEEN ".$minlat." AND ".$maxlat." AND spotter_live.longitude BETWEEN ".$minlong." AND ".$maxlong.")";
333
+				}
334
+				if ($id != '') {
335
+					$query .= " OR spotter_live.flightaware_id = :id";
336
+				}
296 337
 				$query .= ") AS spotter WHERE latitude <> '0' AND longitude <> '0' ";
297 338
 				$query .= "ORDER BY flightaware_id, date";
298
-				if ($limit) $query .= " LIMIT ".$globalMap3DAircraftsLimit;
339
+				if ($limit) {
340
+					$query .= " LIMIT ".$globalMap3DAircraftsLimit;
341
+				}
299 342
 			} else {
300 343
 				$query  = "SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source, spotter_live.registration 
301 344
 				FROM spotter_live".$filter_query." CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= spotter_live.date ";
302
-				if ($usecoord) $query .= "AND (spotter_live.latitude BETWEEN ".$minlat." AND ".$maxlat." AND spotter_live.longitude BETWEEN ".$minlong." AND ".$maxlong.") ";
303
-				if ($id != '') $query .= "OR spotter_live.flightaware_id = :id ";
345
+				if ($usecoord) {
346
+					$query .= "AND (spotter_live.latitude BETWEEN ".$minlat." AND ".$maxlat." AND spotter_live.longitude BETWEEN ".$minlong." AND ".$maxlong.") ";
347
+				}
348
+				if ($id != '') {
349
+					$query .= "OR spotter_live.flightaware_id = :id ";
350
+				}
304 351
 				$query .= "AND spotter_live.latitude <> '0' AND spotter_live.longitude <> '0' 
305 352
 				ORDER BY spotter_live.flightaware_id, spotter_live.date";
306
-				if ($limit) $query .= " LIMIT ".$globalMap3DAircraftsLimit;
353
+				if ($limit) {
354
+					$query .= " LIMIT ".$globalMap3DAircraftsLimit;
355
+				}
307 356
 			}
308 357
 		}
309 358
 		$query_values = array();
310
-		if ($id != '') $query_values = array(':id' => $id);
359
+		if ($id != '') {
360
+			$query_values = array(':id' => $id);
361
+		}
311 362
 		try {
312 363
 			$sth = $this->db->prepare($query);
313 364
 			$sth->execute($query_values);
@@ -330,7 +381,9 @@  discard block
 block discarded – undo
330 381
 		global $globalDBdriver, $globalLiveInterval;
331 382
 		$filter_query = $this->getFilter($filter,true,true);
332 383
 
333
-		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
384
+		if (!isset($globalLiveInterval)) {
385
+			$globalLiveInterval = '200';
386
+		}
334 387
 		if ($globalDBdriver == 'mysql') {
335 388
 			//$query  = 'SELECT COUNT(*) as nb FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate'.$filter_query;
336 389
 			$query = 'SELECT COUNT(DISTINCT spotter_live.flightaware_id) as nb FROM spotter_live'.$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= date';
@@ -360,7 +413,9 @@  discard block
 block discarded – undo
360 413
 	{
361 414
 		global $globalDBdriver, $globalLiveInterval;
362 415
 		$Spotter = new Spotter($this->db);
363
-		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
416
+		if (!isset($globalLiveInterval)) {
417
+			$globalLiveInterval = '200';
418
+		}
364 419
 		$filter_query = $this->getFilter($filter);
365 420
 
366 421
 		if (is_array($coord)) {
@@ -368,7 +423,9 @@  discard block
 block discarded – undo
368 423
 			$minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
369 424
 			$maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
370 425
 			$maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
371
-		} else return array();
426
+		} else {
427
+			return array();
428
+		}
372 429
 		if ($globalDBdriver == 'mysql') {
373 430
 			$query  = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate AND spotter_live.latitude BETWEEN '.$minlat.' AND '.$maxlat.' AND spotter_live.longitude BETWEEN '.$minlong.' AND '.$maxlong.' GROUP BY spotter_live.flightaware_id'.$filter_query;
374 431
 		} else {
@@ -389,7 +446,9 @@  discard block
 block discarded – undo
389 446
 	{
390 447
 		global $globalDBdriver, $globalLiveInterval, $globalArchive;
391 448
 		$Spotter = new Spotter($this->db);
392
-		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
449
+		if (!isset($globalLiveInterval)) {
450
+			$globalLiveInterval = '200';
451
+		}
393 452
 		$filter_query = $this->getFilter($filter,true,true);
394 453
 
395 454
 		if (is_array($coord)) {
@@ -397,7 +456,9 @@  discard block
 block discarded – undo
397 456
 			$minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
398 457
 			$maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
399 458
 			$maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
400
-		} else return array();
459
+		} else {
460
+			return array();
461
+		}
401 462
 		if ($globalDBdriver == 'mysql') {
402 463
 			if (isset($globalArchive) && $globalArchive === TRUE) {
403 464
 				$query  = 'SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.real_altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source, spotter_live.registration 
@@ -624,11 +685,15 @@  discard block
 block discarded – undo
624 685
 		//$query  = self::$global_query.' WHERE spotter_live.flightaware_id = :id ORDER BY date';
625 686
 		if ($globalDBdriver == 'mysql') {
626 687
 			$query = 'SELECT spotter_live.* FROM spotter_live WHERE spotter_live.flightaware_id = :id';
627
-			if ($liveinterval) $query .= ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= date';
688
+			if ($liveinterval) {
689
+				$query .= ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= date';
690
+			}
628 691
 			$query .= ' ORDER BY date';
629 692
 		} else {
630 693
 			$query = 'SELECT spotter_live.* FROM spotter_live WHERE spotter_live.flightaware_id = :id';
631
-			if ($liveinterval) $query .= " AND CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= date";
694
+			if ($liveinterval) {
695
+				$query .= " AND CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= date";
696
+			}
632 697
 			$query .= ' ORDER BY date';
633 698
 		}
634 699
 
@@ -723,7 +788,9 @@  discard block
 block discarded – undo
723 788
 				$i++;
724 789
 				$j++;
725 790
 				if ($j == 30) {
726
-					if ($globalDebug) echo ".";
791
+					if ($globalDebug) {
792
+						echo ".";
793
+					}
727 794
 				    	try {
728 795
 						
729 796
 						$sth = $this->db->prepare(substr($query_delete,0,-1).")");
@@ -1076,7 +1143,9 @@  discard block
 block discarded – undo
1076 1143
 			{
1077 1144
 				return false;
1078 1145
 			}
1079
-		} else return '';
1146
+		} else {
1147
+			return '';
1148
+		}
1080 1149
 
1081 1150
 		if ($longitude != '')
1082 1151
 		{
@@ -1084,7 +1153,9 @@  discard block
 block discarded – undo
1084 1153
 			{
1085 1154
 				return false;
1086 1155
 			}
1087
-		} else return '';
1156
+		} else {
1157
+			return '';
1158
+		}
1088 1159
 
1089 1160
 		if ($waypoints != '')
1090 1161
 		{
@@ -1100,14 +1171,18 @@  discard block
 block discarded – undo
1100 1171
 			{
1101 1172
 				return false;
1102 1173
 			}
1103
-		} else $altitude = 0;
1174
+		} else {
1175
+			$altitude = 0;
1176
+		}
1104 1177
 		if ($altitude_real != '')
1105 1178
 		{
1106 1179
 			if (!is_numeric($altitude_real))
1107 1180
 			{
1108 1181
 				return false;
1109 1182
 			}
1110
-		} else $altitude_real = 0;
1183
+		} else {
1184
+			$altitude_real = 0;
1185
+		}
1111 1186
 
1112 1187
 		if ($heading != '')
1113 1188
 		{
@@ -1115,7 +1190,9 @@  discard block
 block discarded – undo
1115 1190
 			{
1116 1191
 				return false;
1117 1192
 			}
1118
-		} else $heading = 0;
1193
+		} else {
1194
+			$heading = 0;
1195
+		}
1119 1196
 
1120 1197
 		if ($groundspeed != '')
1121 1198
 		{
@@ -1123,9 +1200,13 @@  discard block
 block discarded – undo
1123 1200
 			{
1124 1201
 				return false;
1125 1202
 			}
1126
-		} else $groundspeed = 0;
1203
+		} else {
1204
+			$groundspeed = 0;
1205
+		}
1127 1206
 		date_default_timezone_set('UTC');
1128
-		if ($date == '') $date = date("Y-m-d H:i:s", time());
1207
+		if ($date == '') {
1208
+			$date = date("Y-m-d H:i:s", time());
1209
+		}
1129 1210
 
1130 1211
         
1131 1212
 		$flightaware_id = filter_var($flightaware_id,FILTER_SANITIZE_STRING);
@@ -1170,14 +1251,24 @@  discard block
 block discarded – undo
1170 1251
 		$arrival_airport_country = '';
1171 1252
 		
1172 1253
             	
1173
-            	if ($squawk == '' || $Common->isInteger($squawk) === false ) $squawk = NULL;
1174
-            	if ($verticalrate == '' || $Common->isInteger($verticalrate) === false ) $verticalrate = NULL;
1175
-            	if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) $groundspeed = 0;
1176
-            	if ($heading == '' || $Common->isInteger($heading) === false ) $heading = 0;
1254
+            	if ($squawk == '' || $Common->isInteger($squawk) === false ) {
1255
+            		$squawk = NULL;
1256
+            	}
1257
+            	if ($verticalrate == '' || $Common->isInteger($verticalrate) === false ) {
1258
+            		$verticalrate = NULL;
1259
+            	}
1260
+            	if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) {
1261
+            		$groundspeed = 0;
1262
+            	}
1263
+            	if ($heading == '' || $Common->isInteger($heading) === false ) {
1264
+            		$heading = 0;
1265
+            	}
1177 1266
 		
1178 1267
 		$query = '';
1179 1268
 		if ($globalArchive) {
1180
-			if ($globalDebug) echo '-- Delete previous data -- ';
1269
+			if ($globalDebug) {
1270
+				echo '-- Delete previous data -- ';
1271
+			}
1181 1272
 			$query .= 'DELETE FROM spotter_live WHERE flightaware_id = :flightaware_id;';
1182 1273
 		}
1183 1274
 
@@ -1194,10 +1285,14 @@  discard block
 block discarded – undo
1194 1285
 			return "error : ".$e->getMessage();
1195 1286
 		}
1196 1287
 		if (isset($globalArchive) && $globalArchive && $putinarchive && $noarchive !== true) {
1197
-		    if ($globalDebug) echo '(Add to SBS archive : ';
1288
+		    if ($globalDebug) {
1289
+		    	echo '(Add to SBS archive : ';
1290
+		    }
1198 1291
 		    $SpotterArchive = new SpotterArchive($this->db);
1199 1292
 		    $result =  $SpotterArchive->addSpotterArchiveData($flightaware_id, $ident, $registration, $airline_name, $airline_icao, $airline_country, $airline_type, $aircraft_icao, $aircraft_shadow, $aircraft_name, $aircraft_manufacturer, $departure_airport_icao, $departure_airport_name, $departure_airport_city, $departure_airport_country, $departure_airport_time,$arrival_airport_icao, $arrival_airport_name, $arrival_airport_city, $arrival_airport_country, $arrival_airport_time, $route_stop, $date,$latitude, $longitude, $waypoints, $altitude, $altitude_real,$heading, $groundspeed, $squawk, $ModeS, $pilot_id, $pilot_name,$verticalrate,$format_source,$source_name, $over_country);
1200
-		    if ($globalDebug) echo $result.')';
1293
+		    if ($globalDebug) {
1294
+		    	echo $result.')';
1295
+		    }
1201 1296
 		} elseif ($globalDebug && $putinarchive !== true) {
1202 1297
 			echo '(Not adding to archive)';
1203 1298
 		} elseif ($globalDebug && $noarchive === true) {
Please login to merge, or discard this patch.
require/class.MarineLive.php 1 patch
Braces   +119 added lines, -40 removed lines patch added patch discarded remove patch
@@ -8,7 +8,9 @@  discard block
 block discarded – undo
8 8
 	public function __construct($dbc = null) {
9 9
 		$Connection = new Connection($dbc);
10 10
 		$this->db = $Connection->db();
11
-		if ($this->db === null) die('Error: No DB connection. (MarineLive)');
11
+		if ($this->db === null) {
12
+			die('Error: No DB connection. (MarineLive)');
13
+		}
12 14
 	}
13 15
 
14 16
 
@@ -30,7 +32,9 @@  discard block
 block discarded – undo
30 32
 		if (isset($filter[0]['source'])) {
31 33
 			$filters = array_merge($filters,$filter);
32 34
 		}
33
-		if (is_array($globalFilter)) $filter = array_merge($filter,$globalFilter);
35
+		if (is_array($globalFilter)) {
36
+			$filter = array_merge($filter,$globalFilter);
37
+		}
34 38
 		$filter_query_join = '';
35 39
 		$filter_query_where = '';
36 40
 		foreach($filters as $flt) {
@@ -83,8 +87,11 @@  discard block
 block discarded – undo
83 87
 		if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) {
84 88
 			$filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')";
85 89
 		}
86
-		if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE';
87
-		elseif ($filter_query_where != '' && $and) $filter_query_where .= ' AND';
90
+		if ($filter_query_where == '' && $where) {
91
+			$filter_query_where = ' WHERE';
92
+		} elseif ($filter_query_where != '' && $and) {
93
+			$filter_query_where .= ' AND';
94
+		}
88 95
 		if ($filter_query_where != '') {
89 96
 			$filter_query_where = preg_replace('/^ AND/',' WHERE',$filter_query_where);
90 97
 		}
@@ -125,9 +132,13 @@  discard block
 block discarded – undo
125 132
 				$orderby_query = ' '.$search_orderby_array[$sort]['sql'];
126 133
 			}
127 134
 		}
128
-		if ($orderby_query == '') $orderby_query= ' ORDER BY date DESC';
135
+		if ($orderby_query == '') {
136
+			$orderby_query= ' ORDER BY date DESC';
137
+		}
129 138
 
130
-		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
139
+		if (!isset($globalLiveInterval)) {
140
+			$globalLiveInterval = '200';
141
+		}
131 142
 		if ($globalDBdriver == 'mysql') {
132 143
 			//$query  = "SELECT marine_live.* FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL 30 SECOND) <= l.date GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate";
133 144
 			$query  = 'SELECT marine_live.* FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate'.$filter_query.$orderby_query;
@@ -152,7 +163,9 @@  discard block
 block discarded – undo
152 163
 
153 164
 		$filter_query = $this->getFilter($filter,true,true);
154 165
 
155
-		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
166
+		if (!isset($globalLiveInterval)) {
167
+			$globalLiveInterval = '200';
168
+		}
156 169
 		if ($globalDBdriver == 'mysql') {
157 170
 			$query  = 'SELECT marine_live.mmsi, marine_live.ident, marine_live.type,marine_live.fammarine_id, marine_live.latitude, marine_live.longitude, marine_live.heading, marine_live.ground_speed, marine_live.date, marine_live.format_source 
158 171
 			FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate'.$filter_query." marine_live.latitude <> 0 AND marine_live.longitude <> 0";
@@ -193,48 +206,72 @@  discard block
 block discarded – undo
193 206
 		}
194 207
 		$filter_query = $this->getFilter($filter,true,true);
195 208
 
196
-		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
197
-		if (!isset($globalMap3DMarinesLimit) || $globalMap3DMarinesLimit == '') $globalMap3DMarinesLimit = '300';
209
+		if (!isset($globalLiveInterval)) {
210
+			$globalLiveInterval = '200';
211
+		}
212
+		if (!isset($globalMap3DMarinesLimit) || $globalMap3DMarinesLimit == '') {
213
+			$globalMap3DMarinesLimit = '300';
214
+		}
198 215
 		if ($globalDBdriver == 'mysql') {
199 216
 			if (isset($globalArchive) && $globalArchive === TRUE) {
200 217
 				$query  = 'SELECT * FROM (SELECT marine_archive.ident, marine_archive.fammarine_id,marine_archive.type, marine_archive.latitude, marine_archive.longitude, marine_archive.heading, marine_archive.ground_speed, marine_archive.date, marine_archive.format_source 
201 218
 				    FROM marine_archive INNER JOIN (SELECT fammarine_id FROM marine_live'.$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval." SECOND) <= marine_live.date) l ON l.fammarine_id = marine_archive.fammarine_id ";
202
-				if ($usecoord) $query .= "AND marine_archive.latitude BETWEEN ".$minlat." AND ".$maxlat." AND marine_archive.longitude BETWEEN ".$minlong." AND ".$maxlong." ";
219
+				if ($usecoord) {
220
+					$query .= "AND marine_archive.latitude BETWEEN ".$minlat." AND ".$maxlat." AND marine_archive.longitude BETWEEN ".$minlong." AND ".$maxlong." ";
221
+				}
203 222
 				$query .= "UNION
204 223
 				    SELECT marine_live.ident, marine_live.fammarine_id,marine_live.type, marine_live.latitude, marine_live.longitude, marine_live.heading, marine_live.ground_speed, marine_live.date, marine_live.format_source 
205 224
 				    FROM marine_live".$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval." SECOND) <= marine_live.date";
206
-				if ($usecoord) $query .= " AND marine_live.latitude BETWEEN ".$minlat." AND ".$maxlat." AND marine_live.longitude BETWEEN ".$minlong." AND ".$maxlong;
225
+				if ($usecoord) {
226
+					$query .= " AND marine_live.latitude BETWEEN ".$minlat." AND ".$maxlat." AND marine_live.longitude BETWEEN ".$minlong." AND ".$maxlong;
227
+				}
207 228
 				$query .= ") AS marine 
208 229
 				    WHERE latitude <> '0' AND longitude <> '0' 
209 230
 				    ORDER BY fammarine_id, date";
210
-				if ($limit) $query .= " LIMIT ".$globalMap3DMarinesLimit;
231
+				if ($limit) {
232
+					$query .= " LIMIT ".$globalMap3DMarinesLimit;
233
+				}
211 234
 			} else {
212 235
 				$query  = 'SELECT marine_live.ident, marine_live.fammarine_id,marine_live.type, marine_live.latitude, marine_live.longitude, marine_live.heading, marine_live.ground_speed, marine_live.date, marine_live.format_source 
213 236
 				    FROM marine_live'.$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval." SECOND) <= marine_live.date ";
214
-				if ($usecoord) $query .= "AND marine_live.latitude BETWEEN ".$minlat." AND ".$maxlat." AND marine_live.longitude BETWEEN ".$minlong." AND ".$maxlong." ";
237
+				if ($usecoord) {
238
+					$query .= "AND marine_live.latitude BETWEEN ".$minlat." AND ".$maxlat." AND marine_live.longitude BETWEEN ".$minlong." AND ".$maxlong." ";
239
+				}
215 240
 				$query .= "AND marine_live.latitude <> '0' AND marine_live.longitude <> '0' 
216 241
 				ORDER BY marine_live.fammarine_id, marine_live.date";
217
-				if ($limit) $query .= " LIMIT ".$globalMap3DMarinesLimit;
242
+				if ($limit) {
243
+					$query .= " LIMIT ".$globalMap3DMarinesLimit;
244
+				}
218 245
 			}
219 246
 		} else {
220 247
 			if (isset($globalArchive) && $globalArchive === TRUE) {
221 248
 				$query  = "SELECT * FROM (SELECT marine_archive.ident, marine_archive.fammarine_id, marine_archive.type,marine_archive.latitude, marine_archive.longitude, marine_archive.heading, marine_archive.ground_speed, marine_archive.date, marine_archive.format_source 
222 249
 				    FROM marine_archive INNER JOIN (SELECT fammarine_id FROM marine_live".$filter_query." CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= marine_live.date) l ON l.fammarine_id = marine_archive.fammarine_id ";
223
-				if ($usecoord) $query .= "AND marine_archive.latitude BETWEEN ".$minlat." AND ".$maxlat." AND marine_archive.longitude BETWEEN ".$minlong." AND ".$maxlong." ";
250
+				if ($usecoord) {
251
+					$query .= "AND marine_archive.latitude BETWEEN ".$minlat." AND ".$maxlat." AND marine_archive.longitude BETWEEN ".$minlong." AND ".$maxlong." ";
252
+				}
224 253
 				$query .= "UNION
225 254
 				    SELECT marine_live.ident, marine_live.fammarine_id, marine_live.type,marine_live.latitude, marine_live.longitude, marine_live.heading, marine_live.ground_speed, marine_live.date, marine_live.format_source 
226 255
 				    FROM marine_live".$filter_query." CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= marine_live.date";
227
-				if ($usecoord) $query .= " AND marine_live.latitude BETWEEN ".$minlat." AND ".$maxlat." AND marine_live.longitude BETWEEN ".$minlong." AND ".$maxlong;
256
+				if ($usecoord) {
257
+					$query .= " AND marine_live.latitude BETWEEN ".$minlat." AND ".$maxlat." AND marine_live.longitude BETWEEN ".$minlong." AND ".$maxlong;
258
+				}
228 259
 				$query .= ") AS marine WHERE latitude <> '0' AND longitude <> '0' ";
229 260
 				$query .= "ORDER BY fammarine_id, date";
230
-				if ($limit) $query .= " LIMIT ".$globalMap3DMarinesLimit;
261
+				if ($limit) {
262
+					$query .= " LIMIT ".$globalMap3DMarinesLimit;
263
+				}
231 264
 			} else {
232 265
 				$query  = "SELECT marine_live.ident, marine_live.fammarine_id, marine_live.type,marine_live.latitude, marine_live.longitude, marine_live.heading, marine_live.ground_speed, marine_live.date, marine_live.format_source 
233 266
 				    FROM marine_live".$filter_query." CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= marine_live.date ";
234
-				if ($usecoord) $query .= "AND marine_live.latitude BETWEEN ".$minlat." AND ".$maxlat." AND marine_live.longitude BETWEEN ".$minlong." AND ".$maxlong." ";
267
+				if ($usecoord) {
268
+					$query .= "AND marine_live.latitude BETWEEN ".$minlat." AND ".$maxlat." AND marine_live.longitude BETWEEN ".$minlong." AND ".$maxlong." ";
269
+				}
235 270
 				$query .= "AND marine_live.latitude <> '0' AND marine_live.longitude <> '0' 
236 271
 				ORDER BY marine_live.fammarine_id, marine_live.date";
237
-				if ($limit) $query .= " LIMIT ".$globalMap3DMarinesLimit;
272
+				if ($limit) {
273
+					$query .= " LIMIT ".$globalMap3DMarinesLimit;
274
+				}
238 275
 			}
239 276
 		}
240 277
 		try {
@@ -259,7 +296,9 @@  discard block
 block discarded – undo
259 296
 		global $globalDBdriver, $globalLiveInterval;
260 297
 		$filter_query = $this->getFilter($filter,true,true);
261 298
 
262
-		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
299
+		if (!isset($globalLiveInterval)) {
300
+			$globalLiveInterval = '200';
301
+		}
263 302
 		if ($globalDBdriver == 'mysql') {
264 303
 			$query = 'SELECT COUNT(DISTINCT marine_live.fammarine_id) as nb FROM marine_live'.$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= date';
265 304
 		} else {
@@ -287,7 +326,9 @@  discard block
 block discarded – undo
287 326
 	{
288 327
 		global $globalDBdriver, $globalLiveInterval;
289 328
 		$Marine = new Marine($this->db);
290
-		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
329
+		if (!isset($globalLiveInterval)) {
330
+			$globalLiveInterval = '200';
331
+		}
291 332
 		$filter_query = $this->getFilter($filter);
292 333
 
293 334
 		if (is_array($coord)) {
@@ -295,7 +336,9 @@  discard block
 block discarded – undo
295 336
 			$minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
296 337
 			$maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
297 338
 			$maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
298
-		} else return array();
339
+		} else {
340
+			return array();
341
+		}
299 342
 		if ($globalDBdriver == 'mysql') {
300 343
 			$query  = 'SELECT marine_live.* FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate AND marine_live.latitude BETWEEN '.$minlat.' AND '.$maxlat.' AND marine_live.longitude BETWEEN '.$minlong.' AND '.$maxlong.' GROUP BY marine_live.fammarine_id ORDER BY date DESC'.$filter_query;
301 344
 		} else {
@@ -315,7 +358,9 @@  discard block
 block discarded – undo
315 358
 	{
316 359
 		global $globalDBdriver, $globalLiveInterval, $globalArchive;
317 360
 		$Marine = new Marine($this->db);
318
-		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
361
+		if (!isset($globalLiveInterval)) {
362
+			$globalLiveInterval = '200';
363
+		}
319 364
 		$filter_query = $this->getFilter($filter,true,true);
320 365
 
321 366
 		if (is_array($coord)) {
@@ -323,7 +368,9 @@  discard block
 block discarded – undo
323 368
 			$minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
324 369
 			$maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
325 370
 			$maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
326
-		} else return array();
371
+		} else {
372
+			return array();
373
+		}
327 374
 		/*
328 375
 		if ($globalDBdriver == 'mysql') {
329 376
 			$query  = 'SELECT marine_live.ident, marine_live.fammarine_id,marine_live.type, marine_live.latitude, marine_live.longitude, marine_live.heading, marine_live.ground_speed, marine_live.date, marine_live.format_source 
@@ -546,11 +593,15 @@  discard block
 block discarded – undo
546 593
 		//$query  = self::$global_query.' WHERE marine_live.fammarine_id = :id ORDER BY date';
547 594
 		if ($globalDBdriver == 'mysql') {
548 595
 			$query = 'SELECT marine_live.* FROM marine_live WHERE marine_live.fammarine_id = :id';
549
-			if ($liveinterval) $query .= ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= date';
596
+			if ($liveinterval) {
597
+				$query .= ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= date';
598
+			}
550 599
 			$query .= ' ORDER BY date';
551 600
 		} else {
552 601
 			$query = 'SELECT marine_live.* FROM marine_live WHERE marine_live.fammarine_id = :id';
553
-			if ($liveinterval) $query .= " AND CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= date";
602
+			if ($liveinterval) {
603
+				$query .= " AND CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= date";
604
+			}
554 605
 			$query .= ' ORDER BY date';
555 606
 		}
556 607
 
@@ -645,7 +696,9 @@  discard block
 block discarded – undo
645 696
 				$i++;
646 697
 				$j++;
647 698
 				if ($j == 30) {
648
-					if ($globalDebug) echo ".";
699
+					if ($globalDebug) {
700
+						echo ".";
701
+					}
649 702
 				    	try {
650 703
 						
651 704
 						$sth = $this->db->prepare(substr($query_delete,0,-1).")");
@@ -925,7 +978,9 @@  discard block
 block discarded – undo
925 978
 			{
926 979
 				return false;
927 980
 			}
928
-		} else return '';
981
+		} else {
982
+			return '';
983
+		}
929 984
 
930 985
 		if ($longitude != '')
931 986
 		{
@@ -933,7 +988,9 @@  discard block
 block discarded – undo
933 988
 			{
934 989
 				return false;
935 990
 			}
936
-		} else return '';
991
+		} else {
992
+			return '';
993
+		}
937 994
 
938 995
 
939 996
 		if ($heading != '')
@@ -942,7 +999,9 @@  discard block
 block discarded – undo
942 999
 			{
943 1000
 				return false;
944 1001
 			}
945
-		} else $heading = 0;
1002
+		} else {
1003
+			$heading = 0;
1004
+		}
946 1005
 
947 1006
 		if ($groundspeed != '')
948 1007
 		{
@@ -950,9 +1009,13 @@  discard block
 block discarded – undo
950 1009
 			{
951 1010
 				return false;
952 1011
 			}
953
-		} else $groundspeed = 0;
1012
+		} else {
1013
+			$groundspeed = 0;
1014
+		}
954 1015
 		date_default_timezone_set('UTC');
955
-		if ($date == '') $date = date("Y-m-d H:i:s", time());
1016
+		if ($date == '') {
1017
+			$date = date("Y-m-d H:i:s", time());
1018
+		}
956 1019
 
957 1020
         
958 1021
 		$fammarine_id = filter_var($fammarine_id,FILTER_SANITIZE_STRING);
@@ -973,15 +1036,27 @@  discard block
 block discarded – undo
973 1036
 		$callsign = filter_var($callsign,FILTER_SANITIZE_STRING);
974 1037
 		$arrival_code = filter_var($arrival_code,FILTER_SANITIZE_STRING);
975 1038
 		$arrival_date = filter_var($arrival_date,FILTER_SANITIZE_STRING);
976
-		if ($typeid == '') $typeid = NULL;
977
-		if ($statusid == '') $statusid = NULL;
1039
+		if ($typeid == '') {
1040
+			$typeid = NULL;
1041
+		}
1042
+		if ($statusid == '') {
1043
+			$statusid = NULL;
1044
+		}
978 1045
 
979
-            	if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) $groundspeed = 0;
980
-            	if ($heading == '' || $Common->isInteger($heading) === false ) $heading = 0;
981
-            	if ($arrival_date == '') $arrival_date = NULL;
1046
+            	if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) {
1047
+            		$groundspeed = 0;
1048
+            	}
1049
+            	if ($heading == '' || $Common->isInteger($heading) === false ) {
1050
+            		$heading = 0;
1051
+            	}
1052
+            	if ($arrival_date == '') {
1053
+            		$arrival_date = NULL;
1054
+            	}
982 1055
             	$query = '';
983 1056
 		if ($globalArchive) {
984
-			if ($globalDebug) echo '-- Delete previous data -- ';
1057
+			if ($globalDebug) {
1058
+				echo '-- Delete previous data -- ';
1059
+			}
985 1060
 			$query .= 'DELETE FROM marine_live WHERE fammarine_id = :fammarine_id;';
986 1061
 		}
987 1062
 		$query .= 'INSERT INTO marine_live (fammarine_id, ident, latitude, longitude, heading, ground_speed, date, format_source, source_name, over_country, mmsi, type,type_id,status,status_id,imo,arrival_port_name,arrival_port_date) 
@@ -996,10 +1071,14 @@  discard block
 block discarded – undo
996 1071
 		}
997 1072
 		
998 1073
 		if (isset($globalArchive) && $globalArchive && $putinarchive && $noarchive !== true) {
999
-			if ($globalDebug) echo '(Add to Marine archive : ';
1074
+			if ($globalDebug) {
1075
+				echo '(Add to Marine archive : ';
1076
+			}
1000 1077
 			$MarineArchive = new MarineArchive($this->db);
1001 1078
 			$result =  $MarineArchive->addMarineArchiveData($fammarine_id, $ident, $latitude, $longitude, $heading, $groundspeed, $date, $putinarchive, $mmsi,$type,$typeid,$imo, $callsign,$arrival_code,$arrival_date,$status,$statusid,$noarchive,$format_source, $source_name, $over_country);
1002
-			if ($globalDebug) echo $result.')';
1079
+			if ($globalDebug) {
1080
+				echo $result.')';
1081
+			}
1003 1082
 		}
1004 1083
 		return "success";
1005 1084
 	}
Please login to merge, or discard this patch.