Completed
Push — master ( 994417...89e41e )
by Yannick
34:04 queued 01:34
created
require/class.MarineLive.php 1 patch
Spacing   +112 added lines, -112 removed lines patch added patch discarded remove patch
@@ -17,33 +17,33 @@  discard block
 block discarded – undo
17 17
 	* @param Array $filter the filter
18 18
 	* @return Array the SQL part
19 19
 	*/
20
-	public function getFilter($filter = array(),$where = false,$and = false) {
20
+	public function getFilter($filter = array(), $where = false, $and = false) {
21 21
 		global $globalFilter, $globalStatsFilters, $globalFilterName, $globalDBdriver;
22 22
 		$filters = array();
23 23
 		if (is_array($globalStatsFilters) && isset($globalStatsFilters[$globalFilterName])) {
24 24
 			if (isset($globalStatsFilters[$globalFilterName][0]['source'])) {
25 25
 				$filters = $globalStatsFilters[$globalFilterName];
26 26
 			} else {
27
-				$filter = array_merge($filter,$globalStatsFilters[$globalFilterName]);
27
+				$filter = array_merge($filter, $globalStatsFilters[$globalFilterName]);
28 28
 			}
29 29
 		}
30 30
 		if (isset($filter[0]['source'])) {
31
-			$filters = array_merge($filters,$filter);
31
+			$filters = array_merge($filters, $filter);
32 32
 		}
33
-		if (is_array($globalFilter)) $filter = array_merge($filter,$globalFilter);
33
+		if (is_array($globalFilter)) $filter = array_merge($filter, $globalFilter);
34 34
 		$filter_query_join = '';
35 35
 		$filter_query_where = '';
36
-		foreach($filters as $flt) {
36
+		foreach ($filters as $flt) {
37 37
 			if (isset($flt['idents']) && !empty($flt['idents'])) {
38 38
 				if (isset($flt['source'])) {
39
-					$filter_query_join .= " INNER JOIN (SELECT fammarine_id FROM marine_output WHERE marine_output.ident IN ('".implode("','",$flt['idents'])."') AND marine_output.format_source IN ('".implode("','",$flt['source'])."')) spid ON spid.fammarine_id = marine_live.fammarine_id";
39
+					$filter_query_join .= " INNER JOIN (SELECT fammarine_id FROM marine_output WHERE marine_output.ident IN ('".implode("','", $flt['idents'])."') AND marine_output.format_source IN ('".implode("','", $flt['source'])."')) spid ON spid.fammarine_id = marine_live.fammarine_id";
40 40
 				} else {
41
-					$filter_query_join .= " INNER JOIN (SELECT fammarine_id FROM marine_output WHERE marine_output.ident IN ('".implode("','",$flt['idents'])."')) spid ON spid.fammarine_id = marine_live.fammarine_id";
41
+					$filter_query_join .= " INNER JOIN (SELECT fammarine_id FROM marine_output WHERE marine_output.ident IN ('".implode("','", $flt['idents'])."')) spid ON spid.fammarine_id = marine_live.fammarine_id";
42 42
 				}
43 43
 			}
44 44
 		}
45 45
 		if (isset($filter['source']) && !empty($filter['source'])) {
46
-			$filter_query_where .= " AND format_source IN ('".implode("','",$filter['source'])."')";
46
+			$filter_query_where .= " AND format_source IN ('".implode("','", $filter['source'])."')";
47 47
 		}
48 48
 		if (isset($filter['ident']) && !empty($filter['ident'])) {
49 49
 			$filter_query_where .= " AND ident = '".$filter['ident']."'";
@@ -75,15 +75,15 @@  discard block
 block discarded – undo
75 75
 					$filter_query_date .= " AND EXTRACT(DAY FROM marine_output.date) = '".$filter['day']."'";
76 76
 				}
77 77
 			}
78
-			$filter_query_join .= " INNER JOIN (SELECT fammarine_id FROM marine_output".preg_replace('/^ AND/',' WHERE',$filter_query_date).") sd ON sd.fammarine_id = marine_live.fammarine_id";
78
+			$filter_query_join .= " INNER JOIN (SELECT fammarine_id FROM marine_output".preg_replace('/^ AND/', ' WHERE', $filter_query_date).") sd ON sd.fammarine_id = marine_live.fammarine_id";
79 79
 		}
80 80
 		if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) {
81
-			$filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')";
81
+			$filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','", $filter['source_aprs'])."')";
82 82
 		}
83 83
 		if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE';
84 84
 		elseif ($filter_query_where != '' && $and) $filter_query_where .= ' AND';
85 85
 		if ($filter_query_where != '') {
86
-			$filter_query_where = preg_replace('/^ AND/',' WHERE',$filter_query_where);
86
+			$filter_query_where = preg_replace('/^ AND/', ' WHERE', $filter_query_where);
87 87
 		}
88 88
 		$filter_query = $filter_query_join.$filter_query_where;
89 89
 		return $filter_query;
@@ -106,8 +106,8 @@  discard block
 block discarded – undo
106 106
 		if ($limit != '')
107 107
 		{
108 108
 			$limit_array = explode(',', $limit);
109
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
110
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
109
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
110
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
111 111
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
112 112
 			{
113 113
 				$limit_query = ' LIMIT '.$limit_array[1].' OFFSET '.$limit_array[0];
@@ -122,7 +122,7 @@  discard block
 block discarded – undo
122 122
 				$orderby_query = ' '.$search_orderby_array[$sort]['sql'];
123 123
 			}
124 124
 		}
125
-		if ($orderby_query == '') $orderby_query= ' ORDER BY date DESC';
125
+		if ($orderby_query == '') $orderby_query = ' ORDER BY date DESC';
126 126
 
127 127
 		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
128 128
 		if ($globalDBdriver == 'mysql') {
@@ -131,7 +131,7 @@  discard block
 block discarded – undo
131 131
 		} else {
132 132
 			$query  = "SELECT marine_live.* FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l WHERE CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= 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;
133 133
 		}
134
-		$spotter_array = $Marine->getDataFromDB($query.$limit_query,array(),'',true);
134
+		$spotter_array = $Marine->getDataFromDB($query.$limit_query, array(), '', true);
135 135
 
136 136
 		return $spotter_array;
137 137
 	}
@@ -147,7 +147,7 @@  discard block
 block discarded – undo
147 147
 		global $globalDBdriver, $globalLiveInterval;
148 148
 		date_default_timezone_set('UTC');
149 149
 
150
-		$filter_query = $this->getFilter($filter,true,true);
150
+		$filter_query = $this->getFilter($filter, true, true);
151 151
 
152 152
 		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
153 153
 		if ($globalDBdriver == 'mysql') {
@@ -161,7 +161,7 @@  discard block
 block discarded – undo
161 161
 		try {
162 162
 			$sth = $this->db->prepare($query);
163 163
 			$sth->execute();
164
-		} catch(PDOException $e) {
164
+		} catch (PDOException $e) {
165 165
 			echo $e->getMessage();
166 166
 			die;
167 167
 		}
@@ -176,19 +176,19 @@  discard block
 block discarded – undo
176 176
 	* @return Array the spotter information
177 177
 	*
178 178
 	*/
179
-	public function getMinLastLiveMarineData($coord = array(),$filter = array(), $limit = false)
179
+	public function getMinLastLiveMarineData($coord = array(), $filter = array(), $limit = false)
180 180
 	{
181 181
 		global $globalDBdriver, $globalLiveInterval, $globalMap3DMarinesLimit, $globalArchive;
182 182
 		date_default_timezone_set('UTC');
183 183
 		$usecoord = false;
184 184
 		if (is_array($coord) && !empty($coord)) {
185
-			$minlong = filter_var($coord[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
186
-			$minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
187
-			$maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
188
-			$maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
185
+			$minlong = filter_var($coord[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
186
+			$minlat = filter_var($coord[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
187
+			$maxlong = filter_var($coord[2], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
188
+			$maxlat = filter_var($coord[3], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
189 189
 			$usecoord = true;
190 190
 		}
191
-		$filter_query = $this->getFilter($filter,true,true);
191
+		$filter_query = $this->getFilter($filter, true, true);
192 192
 
193 193
 		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
194 194
 		if (!isset($globalMap3DMarinesLimit) || $globalMap3DMarinesLimit == '') $globalMap3DMarinesLimit = '300';
@@ -237,7 +237,7 @@  discard block
 block discarded – undo
237 237
 		try {
238 238
 			$sth = $this->db->prepare($query);
239 239
 			$sth->execute();
240
-		} catch(PDOException $e) {
240
+		} catch (PDOException $e) {
241 241
 			echo $e->getMessage();
242 242
 			die;
243 243
 		}
@@ -254,7 +254,7 @@  discard block
 block discarded – undo
254 254
 	public function getLiveMarineCount($filter = array())
255 255
 	{
256 256
 		global $globalDBdriver, $globalLiveInterval;
257
-		$filter_query = $this->getFilter($filter,true,true);
257
+		$filter_query = $this->getFilter($filter, true, true);
258 258
 
259 259
 		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
260 260
 		if ($globalDBdriver == 'mysql') {
@@ -265,7 +265,7 @@  discard block
 block discarded – undo
265 265
 		try {
266 266
 			$sth = $this->db->prepare($query);
267 267
 			$sth->execute();
268
-		} catch(PDOException $e) {
268
+		} catch (PDOException $e) {
269 269
 			echo $e->getMessage();
270 270
 			die;
271 271
 		}
@@ -288,10 +288,10 @@  discard block
 block discarded – undo
288 288
 		$filter_query = $this->getFilter($filter);
289 289
 
290 290
 		if (is_array($coord)) {
291
-			$minlong = filter_var($coord[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
292
-			$minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
293
-			$maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
294
-			$maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
291
+			$minlong = filter_var($coord[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
292
+			$minlat = filter_var($coord[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
293
+			$maxlong = filter_var($coord[2], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
294
+			$maxlat = filter_var($coord[3], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
295 295
 		} else return array();
296 296
 		if ($globalDBdriver == 'mysql') {
297 297
 			$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'.$filter_query;
@@ -313,13 +313,13 @@  discard block
 block discarded – undo
313 313
 		global $globalDBdriver, $globalLiveInterval, $globalArchive;
314 314
 		$Marine = new Marine($this->db);
315 315
 		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
316
-		$filter_query = $this->getFilter($filter,true,true);
316
+		$filter_query = $this->getFilter($filter, true, true);
317 317
 
318 318
 		if (is_array($coord)) {
319
-			$minlong = filter_var($coord[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
320
-			$minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
321
-			$maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
322
-			$maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
319
+			$minlong = filter_var($coord[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
320
+			$minlat = filter_var($coord[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
321
+			$maxlong = filter_var($coord[2], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
322
+			$maxlat = filter_var($coord[3], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
323 323
 		} else return array();
324 324
 		/*
325 325
 		if ($globalDBdriver == 'mysql') {
@@ -334,13 +334,13 @@  discard block
 block discarded – undo
334 334
 		*/
335 335
 		if ($globalDBdriver == 'mysql') {
336 336
 			if (isset($globalArchive) && $globalArchive === TRUE) {
337
-				$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 
337
+				$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 
338 338
 				    FROM marine_live 
339 339
 				    '.$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= marine_live.date 
340 340
 				    AND marine_live.latitude BETWEEN '.$minlat.' AND '.$maxlat.' AND marine_live.longitude BETWEEN '.$minlong.' AND '.$maxlong.'
341 341
 				    AND marine_live.latitude <> 0 AND marine_live.longitude <> 0';
342 342
 			} else {
343
-				$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 
343
+				$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 
344 344
 				    FROM marine_live 
345 345
 				    INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate 
346 346
 				    FROM marine_live l 
@@ -352,14 +352,14 @@  discard block
 block discarded – undo
352 352
 			}
353 353
 		} else {
354 354
 			if (isset($globalArchive) && $globalArchive === TRUE) {
355
-				$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 
355
+				$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 
356 356
 				    FROM marine_live 
357 357
 				    ".$filter_query." CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= marine_live.date 
358 358
 				    AND marine_live.latitude BETWEEN ".$minlat." AND ".$maxlat." 
359 359
 				    AND marine_live.longitude BETWEEN ".$minlong." AND ".$maxlong." 
360 360
 				    AND marine_live.latitude <> '0' AND marine_live.longitude <> '0'";
361 361
 			} else {
362
-				$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 
362
+				$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 
363 363
 				    FROM marine_live 
364 364
 				    INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate 
365 365
 				    FROM marine_live l 
@@ -416,7 +416,7 @@  discard block
 block discarded – undo
416 416
                 if ($interval == '1m')
417 417
                 {
418 418
                     $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= marine_live.date ';
419
-                } else if ($interval == '15m'){
419
+                } else if ($interval == '15m') {
420 420
                     $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 15 MINUTE) <= marine_live.date ';
421 421
                 } 
422 422
             }
@@ -424,14 +424,14 @@  discard block
 block discarded – undo
424 424
          $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= marine_live.date ';   
425 425
         }
426 426
 
427
-                $query  = "SELECT marine_live.*, ( 6371 * acos( cos( radians(:lat) ) * cos( radians( latitude ) ) * cos( radians( longitude ) - radians(:lng) ) + sin( radians(:lat) ) * sin( radians( latitude ) ) ) ) AS distance FROM marine_live 
427
+                $query = "SELECT marine_live.*, ( 6371 * acos( cos( radians(:lat) ) * cos( radians( latitude ) ) * cos( radians( longitude ) - radians(:lng) ) + sin( radians(:lat) ) * sin( radians( latitude ) ) ) ) AS distance FROM marine_live 
428 428
                    WHERE marine_live.latitude <> '' 
429 429
                                    AND marine_live.longitude <> '' 
430 430
                    ".$additional_query."
431 431
                    HAVING distance < :radius  
432 432
                                    ORDER BY distance";
433 433
 
434
-                $spotter_array = $Marine->getDataFromDB($query, array(':lat' => $lat, ':lng' => $lng,':radius' => $radius));
434
+                $spotter_array = $Marine->getDataFromDB($query, array(':lat' => $lat, ':lng' => $lng, ':radius' => $radius));
435 435
 
436 436
                 return $spotter_array;
437 437
         }
@@ -449,9 +449,9 @@  discard block
 block discarded – undo
449 449
 		date_default_timezone_set('UTC');
450 450
 
451 451
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
452
-                $query  = 'SELECT marine_live.* FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l WHERE l.ident = :ident GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate ORDER BY marine_live.date DESC';
452
+                $query = 'SELECT marine_live.* FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l WHERE l.ident = :ident GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate ORDER BY marine_live.date DESC';
453 453
 
454
-		$spotter_array = $Marine->getDataFromDB($query,array(':ident' => $ident),'',true);
454
+		$spotter_array = $Marine->getDataFromDB($query, array(':ident' => $ident), '', true);
455 455
 
456 456
 		return $spotter_array;
457 457
 	}
@@ -462,14 +462,14 @@  discard block
 block discarded – undo
462 462
 	* @return Array the spotter information
463 463
 	*
464 464
 	*/
465
-	public function getDateLiveMarineDataByIdent($ident,$date)
465
+	public function getDateLiveMarineDataByIdent($ident, $date)
466 466
 	{
467 467
 		$Marine = new Marine($this->db);
468 468
 		date_default_timezone_set('UTC');
469 469
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
470 470
 		$query  = 'SELECT marine_live.* FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l WHERE l.ident = :ident AND l.date <= :date GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate ORDER BY marine_live.date DESC';
471
-		$date = date('c',$date);
472
-		$spotter_array = $Marine->getDataFromDB($query,array(':ident' => $ident,':date' => $date));
471
+		$date = date('c', $date);
472
+		$spotter_array = $Marine->getDataFromDB($query, array(':ident' => $ident, ':date' => $date));
473 473
 		return $spotter_array;
474 474
 	}
475 475
 
@@ -479,14 +479,14 @@  discard block
 block discarded – undo
479 479
 	* @return Array the spotter information
480 480
 	*
481 481
 	*/
482
-	public function getDateLiveMarineDataByMMSI($mmsi,$date)
482
+	public function getDateLiveMarineDataByMMSI($mmsi, $date)
483 483
 	{
484 484
 		$Marine = new Marine($this->db);
485 485
 		date_default_timezone_set('UTC');
486 486
 		$mmsi = filter_var($mmsi, FILTER_SANITIZE_NUMBER_INT);
487 487
 		$query  = 'SELECT marine_live.* FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l WHERE l.mmsi = :mmsi AND l.date <= :date GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate ORDER BY marine_live.date DESC';
488
-		$date = date('c',$date);
489
-		$spotter_array = $Marine->getDataFromDB($query,array(':mmsi' => $mmsi,':date' => $date));
488
+		$date = date('c', $date);
489
+		$spotter_array = $Marine->getDataFromDB($query, array(':mmsi' => $mmsi, ':date' => $date));
490 490
 		return $spotter_array;
491 491
 	}
492 492
 
@@ -502,9 +502,9 @@  discard block
 block discarded – undo
502 502
 		date_default_timezone_set('UTC');
503 503
 
504 504
 		$id = filter_var($id, FILTER_SANITIZE_STRING);
505
-                $query  = 'SELECT marine_live.* FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l WHERE l.fammarine_id = :id GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate ORDER BY marine_live.date DESC';
505
+                $query = 'SELECT marine_live.* FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l WHERE l.fammarine_id = :id GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate ORDER BY marine_live.date DESC';
506 506
 
507
-		$spotter_array = $Marine->getDataFromDB($query,array(':id' => $id),'',true);
507
+		$spotter_array = $Marine->getDataFromDB($query, array(':id' => $id), '', true);
508 508
 
509 509
 		return $spotter_array;
510 510
 	}
@@ -515,15 +515,15 @@  discard block
 block discarded – undo
515 515
 	* @return Array the spotter information
516 516
 	*
517 517
 	*/
518
-	public function getDateLiveMarineDataById($id,$date)
518
+	public function getDateLiveMarineDataById($id, $date)
519 519
 	{
520 520
 		$Marine = new Marine($this->db);
521 521
 		date_default_timezone_set('UTC');
522 522
 
523 523
 		$id = filter_var($id, FILTER_SANITIZE_STRING);
524
-                $query  = 'SELECT marine_live.* FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l WHERE l.fammarine_id = :id AND l.date <= :date GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate ORDER BY marine_live.date DESC';
525
-                $date = date('c',$date);
526
-		$spotter_array = $Marine->getDataFromDB($query,array(':id' => $id,':date' => $date),'',true);
524
+                $query = 'SELECT marine_live.* FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l WHERE l.fammarine_id = :id AND l.date <= :date GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate ORDER BY marine_live.date DESC';
525
+                $date = date('c', $date);
526
+		$spotter_array = $Marine->getDataFromDB($query, array(':id' => $id, ':date' => $date), '', true);
527 527
 
528 528
 		return $spotter_array;
529 529
 	}
@@ -535,7 +535,7 @@  discard block
 block discarded – undo
535 535
 	* @return Array the spotter information
536 536
 	*
537 537
 	*/
538
-	public function getAllLiveMarineDataById($id,$liveinterval = false)
538
+	public function getAllLiveMarineDataById($id, $liveinterval = false)
539 539
 	{
540 540
 		global $globalDBdriver, $globalLiveInterval;
541 541
 		date_default_timezone_set('UTC');
@@ -554,7 +554,7 @@  discard block
 block discarded – undo
554 554
 		try {
555 555
 			$sth = $this->db->prepare($query);
556 556
 			$sth->execute(array(':id' => $id));
557
-		} catch(PDOException $e) {
557
+		} catch (PDOException $e) {
558 558
 			echo $e->getMessage();
559 559
 			die;
560 560
 		}
@@ -572,12 +572,12 @@  discard block
 block discarded – undo
572 572
 	{
573 573
 		date_default_timezone_set('UTC');
574 574
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
575
-		$query  = self::$global_query.' WHERE marine_live.ident = :ident';
575
+		$query = self::$global_query.' WHERE marine_live.ident = :ident';
576 576
     		try {
577 577
 			
578 578
 			$sth = $this->db->prepare($query);
579 579
 			$sth->execute(array(':ident' => $ident));
580
-		} catch(PDOException $e) {
580
+		} catch (PDOException $e) {
581 581
 			echo $e->getMessage();
582 582
 			die;
583 583
 		}
@@ -607,7 +607,7 @@  discard block
 block discarded – undo
607 607
 			
608 608
 			$sth = $this->db->prepare($query);
609 609
 			$sth->execute();
610
-		} catch(PDOException $e) {
610
+		} catch (PDOException $e) {
611 611
 			return "error";
612 612
 		}
613 613
 
@@ -630,14 +630,14 @@  discard block
 block discarded – undo
630 630
 				
631 631
 				$sth = $this->db->prepare($query);
632 632
 				$sth->execute();
633
-			} catch(PDOException $e) {
633
+			} catch (PDOException $e) {
634 634
 				return "error";
635 635
 			}
636 636
 			$query_delete = 'DELETE FROM marine_live WHERE fammarine_id IN (';
637 637
                         $i = 0;
638
-                        $j =0;
638
+                        $j = 0;
639 639
 			$all = $sth->fetchAll(PDO::FETCH_ASSOC);
640
-			foreach($all as $row)
640
+			foreach ($all as $row)
641 641
 			{
642 642
 				$i++;
643 643
 				$j++;
@@ -645,9 +645,9 @@  discard block
 block discarded – undo
645 645
 					if ($globalDebug) echo ".";
646 646
 				    	try {
647 647
 						
648
-						$sth = $this->db->prepare(substr($query_delete,0,-1).")");
648
+						$sth = $this->db->prepare(substr($query_delete, 0, -1).")");
649 649
 						$sth->execute();
650
-					} catch(PDOException $e) {
650
+					} catch (PDOException $e) {
651 651
 						return "error";
652 652
 					}
653 653
                                 	$query_delete = 'DELETE FROM marine_live WHERE fammarine_id IN (';
@@ -658,9 +658,9 @@  discard block
 block discarded – undo
658 658
 			if ($i > 0) {
659 659
     				try {
660 660
 					
661
-					$sth = $this->db->prepare(substr($query_delete,0,-1).")");
661
+					$sth = $this->db->prepare(substr($query_delete, 0, -1).")");
662 662
 					$sth->execute();
663
-				} catch(PDOException $e) {
663
+				} catch (PDOException $e) {
664 664
 					return "error";
665 665
 				}
666 666
 			}
@@ -673,7 +673,7 @@  discard block
 block discarded – undo
673 673
 				
674 674
 				$sth = $this->db->prepare($query);
675 675
 				$sth->execute();
676
-			} catch(PDOException $e) {
676
+			} catch (PDOException $e) {
677 677
 				return "error";
678 678
 			}
679 679
 /*			$query_delete = "DELETE FROM marine_live WHERE fammarine_id IN (";
@@ -721,13 +721,13 @@  discard block
 block discarded – undo
721 721
 	public function deleteLiveMarineDataByIdent($ident)
722 722
 	{
723 723
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
724
-		$query  = 'DELETE FROM marine_live WHERE ident = :ident';
724
+		$query = 'DELETE FROM marine_live WHERE ident = :ident';
725 725
         
726 726
     		try {
727 727
 			
728 728
 			$sth = $this->db->prepare($query);
729 729
 			$sth->execute(array(':ident' => $ident));
730
-		} catch(PDOException $e) {
730
+		} catch (PDOException $e) {
731 731
 			return "error";
732 732
 		}
733 733
 
@@ -743,13 +743,13 @@  discard block
 block discarded – undo
743 743
 	public function deleteLiveMarineDataById($id)
744 744
 	{
745 745
 		$id = filter_var($id, FILTER_SANITIZE_STRING);
746
-		$query  = 'DELETE FROM marine_live WHERE fammarine_id = :id';
746
+		$query = 'DELETE FROM marine_live WHERE fammarine_id = :id';
747 747
         
748 748
     		try {
749 749
 			
750 750
 			$sth = $this->db->prepare($query);
751 751
 			$sth->execute(array(':id' => $id));
752
-		} catch(PDOException $e) {
752
+		} catch (PDOException $e) {
753 753
 			return "error";
754 754
 		}
755 755
 
@@ -767,13 +767,13 @@  discard block
 block discarded – undo
767 767
 	{
768 768
 		global $globalDBdriver, $globalTimezone;
769 769
 		if ($globalDBdriver == 'mysql') {
770
-			$query  = 'SELECT marine_live.ident FROM marine_live 
770
+			$query = 'SELECT marine_live.ident FROM marine_live 
771 771
 				WHERE marine_live.ident = :ident 
772 772
 				AND marine_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 HOUR) 
773 773
 				AND marine_live.date < UTC_TIMESTAMP()';
774 774
 			$query_data = array(':ident' => $ident);
775 775
 		} else {
776
-			$query  = "SELECT marine_live.ident FROM marine_live 
776
+			$query = "SELECT marine_live.ident FROM marine_live 
777 777
 				WHERE marine_live.ident = :ident 
778 778
 				AND marine_live.date >= now() AT TIME ZONE 'UTC' - INTERVAL '1 HOURS'
779 779
 				AND marine_live.date < now() AT TIME ZONE 'UTC'";
@@ -782,8 +782,8 @@  discard block
 block discarded – undo
782 782
 		
783 783
 		$sth = $this->db->prepare($query);
784 784
 		$sth->execute($query_data);
785
-		$ident_result='';
786
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
785
+		$ident_result = '';
786
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
787 787
 		{
788 788
 			$ident_result = $row['ident'];
789 789
 		}
@@ -800,13 +800,13 @@  discard block
 block discarded – undo
800 800
 	{
801 801
 		global $globalDBdriver, $globalTimezone;
802 802
 		if ($globalDBdriver == 'mysql') {
803
-			$query  = 'SELECT marine_live.ident, marine_live.fammarine_id FROM marine_live 
803
+			$query = 'SELECT marine_live.ident, marine_live.fammarine_id FROM marine_live 
804 804
 				WHERE marine_live.ident = :ident 
805 805
 				AND marine_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 30 MINUTE)'; 
806 806
 //				AND marine_live.date < UTC_TIMESTAMP()";
807 807
 			$query_data = array(':ident' => $ident);
808 808
 		} else {
809
-			$query  = "SELECT marine_live.ident, marine_live.fammarine_id FROM marine_live 
809
+			$query = "SELECT marine_live.ident, marine_live.fammarine_id FROM marine_live 
810 810
 				WHERE marine_live.ident = :ident 
811 811
 				AND marine_live.date >= now() AT TIME ZONE 'UTC' - INTERVAL '30 MINUTES'";
812 812
 //				AND marine_live.date < now() AT TIME ZONE 'UTC'";
@@ -815,8 +815,8 @@  discard block
 block discarded – undo
815 815
 		
816 816
 		$sth = $this->db->prepare($query);
817 817
 		$sth->execute($query_data);
818
-		$ident_result='';
819
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
818
+		$ident_result = '';
819
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
820 820
 		{
821 821
 			$ident_result = $row['fammarine_id'];
822 822
 		}
@@ -833,13 +833,13 @@  discard block
 block discarded – undo
833 833
 	{
834 834
 		global $globalDBdriver, $globalTimezone;
835 835
 		if ($globalDBdriver == 'mysql') {
836
-			$query  = 'SELECT marine_live.ident, marine_live.fammarine_id FROM marine_live 
836
+			$query = 'SELECT marine_live.ident, marine_live.fammarine_id FROM marine_live 
837 837
 				WHERE marine_live.fammarine_id = :id 
838 838
 				AND marine_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 10 HOUR)'; 
839 839
 //				AND marine_live.date < UTC_TIMESTAMP()";
840 840
 			$query_data = array(':id' => $id);
841 841
 		} else {
842
-			$query  = "SELECT marine_live.ident, marine_live.fammarine_id FROM marine_live 
842
+			$query = "SELECT marine_live.ident, marine_live.fammarine_id FROM marine_live 
843 843
 				WHERE marine_live.fammarine_id = :id 
844 844
 				AND marine_live.date >= now() AT TIME ZONE 'UTC' - INTERVAL '10 HOUR'";
845 845
 //				AND marine_live.date < now() AT TIME ZONE 'UTC'";
@@ -848,8 +848,8 @@  discard block
 block discarded – undo
848 848
 		
849 849
 		$sth = $this->db->prepare($query);
850 850
 		$sth->execute($query_data);
851
-		$ident_result='';
852
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
851
+		$ident_result = '';
852
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
853 853
 		{
854 854
 			$ident_result = $row['fammarine_id'];
855 855
 		}
@@ -866,13 +866,13 @@  discard block
 block discarded – undo
866 866
 	{
867 867
 		global $globalDBdriver, $globalTimezone;
868 868
 		if ($globalDBdriver == 'mysql') {
869
-			$query  = 'SELECT marine_live.fammarine_id FROM marine_live 
869
+			$query = 'SELECT marine_live.fammarine_id FROM marine_live 
870 870
 				WHERE marine_live.mmsi = :mmsi 
871 871
 				AND marine_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 10 HOUR)'; 
872 872
 //				AND marine_live.date < UTC_TIMESTAMP()";
873 873
 			$query_data = array(':mmsi' => $mmsi);
874 874
 		} else {
875
-			$query  = "SELECT marine_live.fammarine_id FROM marine_live 
875
+			$query = "SELECT marine_live.fammarine_id FROM marine_live 
876 876
 				WHERE marine_live.mmsi = :mmsi 
877 877
 				AND marine_live.date >= now() AT TIME ZONE 'UTC' - INTERVAL '10 HOUR'";
878 878
 //				AND marine_live.date < now() AT TIME ZONE 'UTC'";
@@ -881,8 +881,8 @@  discard block
 block discarded – undo
881 881
 		
882 882
 		$sth = $this->db->prepare($query);
883 883
 		$sth->execute($query_data);
884
-		$ident_result='';
885
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
884
+		$ident_result = '';
885
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
886 886
 		{
887 887
 			$ident_result = $row['fammarine_id'];
888 888
 		}
@@ -900,7 +900,7 @@  discard block
 block discarded – undo
900 900
 	* @return String success or false
901 901
 	*
902 902
 	*/
903
-	public function addLiveMarineData($fammarine_id = '', $ident = '', $latitude = '', $longitude = '', $heading = '', $groundspeed = '', $date = '', $putinarchive = false, $mmsi = '',$type = '',$typeid = '',$imo = '', $callsign = '',$arrival_code = '',$arrival_date = '',$status = '',$statusid = '',$noarchive = false,$format_source = '', $source_name = '', $over_country = '')
903
+	public function addLiveMarineData($fammarine_id = '', $ident = '', $latitude = '', $longitude = '', $heading = '', $groundspeed = '', $date = '', $putinarchive = false, $mmsi = '', $type = '', $typeid = '', $imo = '', $callsign = '', $arrival_code = '', $arrival_date = '', $status = '', $statusid = '', $noarchive = false, $format_source = '', $source_name = '', $over_country = '')
904 904
 	{
905 905
 		global $globalURL, $globalArchive, $globalDebug;
906 906
 		$Common = new Common();
@@ -952,26 +952,26 @@  discard block
 block discarded – undo
952 952
 		if ($date == '') $date = date("Y-m-d H:i:s", time());
953 953
 
954 954
         
955
-		$fammarine_id = filter_var($fammarine_id,FILTER_SANITIZE_STRING);
956
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
957
-		$latitude = filter_var($latitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
958
-		$longitude = filter_var($longitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
959
-		$heading = filter_var($heading,FILTER_SANITIZE_NUMBER_INT);
960
-		$groundspeed = filter_var($groundspeed,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
961
-		$format_source = filter_var($format_source,FILTER_SANITIZE_STRING);
962
-		$source_name = filter_var($source_name,FILTER_SANITIZE_STRING);
963
-		$over_country = filter_var($over_country,FILTER_SANITIZE_STRING);
964
-		$type = filter_var($type,FILTER_SANITIZE_STRING);
965
-		$mmsi = filter_var($mmsi,FILTER_SANITIZE_NUMBER_INT);
966
-		$status = filter_var($status,FILTER_SANITIZE_STRING);
967
-		$imo = filter_var($imo,FILTER_SANITIZE_STRING);
968
-		$callsign = filter_var($callsign,FILTER_SANITIZE_STRING);
969
-		$arrival_code = filter_var($arrival_code,FILTER_SANITIZE_STRING);
970
-		$arrival_date = filter_var($arrival_date,FILTER_SANITIZE_STRING);
955
+		$fammarine_id = filter_var($fammarine_id, FILTER_SANITIZE_STRING);
956
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
957
+		$latitude = filter_var($latitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
958
+		$longitude = filter_var($longitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
959
+		$heading = filter_var($heading, FILTER_SANITIZE_NUMBER_INT);
960
+		$groundspeed = filter_var($groundspeed, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
961
+		$format_source = filter_var($format_source, FILTER_SANITIZE_STRING);
962
+		$source_name = filter_var($source_name, FILTER_SANITIZE_STRING);
963
+		$over_country = filter_var($over_country, FILTER_SANITIZE_STRING);
964
+		$type = filter_var($type, FILTER_SANITIZE_STRING);
965
+		$mmsi = filter_var($mmsi, FILTER_SANITIZE_NUMBER_INT);
966
+		$status = filter_var($status, FILTER_SANITIZE_STRING);
967
+		$imo = filter_var($imo, FILTER_SANITIZE_STRING);
968
+		$callsign = filter_var($callsign, FILTER_SANITIZE_STRING);
969
+		$arrival_code = filter_var($arrival_code, FILTER_SANITIZE_STRING);
970
+		$arrival_date = filter_var($arrival_date, FILTER_SANITIZE_STRING);
971 971
 		
972 972
 
973
-            	if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) $groundspeed = 0;
974
-            	if ($heading == '' || $Common->isInteger($heading) === false ) $heading = 0;
973
+            	if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0;
974
+            	if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0;
975 975
             	if ($arrival_date == '') $arrival_date = NULL;
976 976
             	$query = '';
977 977
 		if ($globalArchive) {
@@ -981,19 +981,19 @@  discard block
 block discarded – undo
981 981
 		$query .= 'INSERT INTO marine_live (fammarine_id, ident, latitude, longitude, heading, ground_speed, date, format_source, source_name, over_country, mmsi, type,status,imo,arrival_port_name,arrival_port_date) 
982 982
 		    VALUES (:fammarine_id,:ident,:latitude,:longitude,:heading,:groundspeed,:date,:format_source, :source_name, :over_country,:mmsi,:type,:status,:imo,:arrival_port_name,:arrival_port_date)';
983 983
 
984
-		$query_values = array(':fammarine_id' => $fammarine_id,':ident' => $ident,':latitude' => $latitude,':longitude' => $longitude,':heading' => $heading,':groundspeed' => $groundspeed,':date' => $date, ':format_source' => $format_source, ':source_name' => $source_name, ':over_country' => $over_country,':mmsi' => $mmsi,':type' => $type,':status' => $status,':imo' => $imo,':arrival_port_name' => $arrival_code,':arrival_port_date' => $arrival_date);
984
+		$query_values = array(':fammarine_id' => $fammarine_id, ':ident' => $ident, ':latitude' => $latitude, ':longitude' => $longitude, ':heading' => $heading, ':groundspeed' => $groundspeed, ':date' => $date, ':format_source' => $format_source, ':source_name' => $source_name, ':over_country' => $over_country, ':mmsi' => $mmsi, ':type' => $type, ':status' => $status, ':imo' => $imo, ':arrival_port_name' => $arrival_code, ':arrival_port_date' => $arrival_date);
985 985
 		try {
986 986
 			$sth = $this->db->prepare($query);
987 987
 			$sth->execute($query_values);
988 988
 			$sth->closeCursor();
989
-		} catch(PDOException $e) {
989
+		} catch (PDOException $e) {
990 990
 			return "error : ".$e->getMessage();
991 991
 		}
992 992
 		
993 993
 		if (isset($globalArchive) && $globalArchive && $putinarchive && $noarchive !== true) {
994 994
 			if ($globalDebug) echo '(Add to Marine archive : ';
995 995
 			$MarineArchive = new MarineArchive($this->db);
996
-			$result =  $MarineArchive->addMarineArchiveData($fammarine_id, $ident, $latitude, $longitude, $heading, $groundspeed, $date, $putinarchive, $mmsi,$type,$typeid,$imo, $callsign,$arrival_code,$arrival_date,$status,$noarchive,$format_source, $source_name, $over_country);
996
+			$result = $MarineArchive->addMarineArchiveData($fammarine_id, $ident, $latitude, $longitude, $heading, $groundspeed, $date, $putinarchive, $mmsi, $type, $typeid, $imo, $callsign, $arrival_code, $arrival_date, $status, $noarchive, $format_source, $source_name, $over_country);
997 997
 			if ($globalDebug) echo $result.')';
998 998
 		}
999 999
 		return "success";
@@ -1001,7 +1001,7 @@  discard block
 block discarded – undo
1001 1001
 
1002 1002
 	public function getOrderBy()
1003 1003
 	{
1004
-		$orderby = array("aircraft_asc" => array("key" => "aircraft_asc", "value" => "Aircraft Type - ASC", "sql" => "ORDER BY marine_live.aircraft_icao ASC"), "aircraft_desc" => array("key" => "aircraft_desc", "value" => "Aircraft Type - DESC", "sql" => "ORDER BY marine_live.aircraft_icao DESC"),"manufacturer_asc" => array("key" => "manufacturer_asc", "value" => "Aircraft Manufacturer - ASC", "sql" => "ORDER BY marine_live.aircraft_manufacturer ASC"), "manufacturer_desc" => array("key" => "manufacturer_desc", "value" => "Aircraft Manufacturer - DESC", "sql" => "ORDER BY marine_live.aircraft_manufacturer DESC"),"airline_name_asc" => array("key" => "airline_name_asc", "value" => "Airline Name - ASC", "sql" => "ORDER BY marine_live.airline_name ASC"), "airline_name_desc" => array("key" => "airline_name_desc", "value" => "Airline Name - DESC", "sql" => "ORDER BY marine_live.airline_name DESC"), "ident_asc" => array("key" => "ident_asc", "value" => "Ident - ASC", "sql" => "ORDER BY marine_live.ident ASC"), "ident_desc" => array("key" => "ident_desc", "value" => "Ident - DESC", "sql" => "ORDER BY marine_live.ident DESC"), "airport_departure_asc" => array("key" => "airport_departure_asc", "value" => "Departure Airport - ASC", "sql" => "ORDER BY marine_live.departure_airport_city ASC"), "airport_departure_desc" => array("key" => "airport_departure_desc", "value" => "Departure Airport - DESC", "sql" => "ORDER BY marine_live.departure_airport_city DESC"), "airport_arrival_asc" => array("key" => "airport_arrival_asc", "value" => "Arrival Airport - ASC", "sql" => "ORDER BY marine_live.arrival_airport_city ASC"), "airport_arrival_desc" => array("key" => "airport_arrival_desc", "value" => "Arrival Airport - DESC", "sql" => "ORDER BY marine_live.arrival_airport_city DESC"), "date_asc" => array("key" => "date_asc", "value" => "Date - ASC", "sql" => "ORDER BY marine_live.date ASC"), "date_desc" => array("key" => "date_desc", "value" => "Date - DESC", "sql" => "ORDER BY marine_live.date DESC"));
1004
+		$orderby = array("aircraft_asc" => array("key" => "aircraft_asc", "value" => "Aircraft Type - ASC", "sql" => "ORDER BY marine_live.aircraft_icao ASC"), "aircraft_desc" => array("key" => "aircraft_desc", "value" => "Aircraft Type - DESC", "sql" => "ORDER BY marine_live.aircraft_icao DESC"), "manufacturer_asc" => array("key" => "manufacturer_asc", "value" => "Aircraft Manufacturer - ASC", "sql" => "ORDER BY marine_live.aircraft_manufacturer ASC"), "manufacturer_desc" => array("key" => "manufacturer_desc", "value" => "Aircraft Manufacturer - DESC", "sql" => "ORDER BY marine_live.aircraft_manufacturer DESC"), "airline_name_asc" => array("key" => "airline_name_asc", "value" => "Airline Name - ASC", "sql" => "ORDER BY marine_live.airline_name ASC"), "airline_name_desc" => array("key" => "airline_name_desc", "value" => "Airline Name - DESC", "sql" => "ORDER BY marine_live.airline_name DESC"), "ident_asc" => array("key" => "ident_asc", "value" => "Ident - ASC", "sql" => "ORDER BY marine_live.ident ASC"), "ident_desc" => array("key" => "ident_desc", "value" => "Ident - DESC", "sql" => "ORDER BY marine_live.ident DESC"), "airport_departure_asc" => array("key" => "airport_departure_asc", "value" => "Departure Airport - ASC", "sql" => "ORDER BY marine_live.departure_airport_city ASC"), "airport_departure_desc" => array("key" => "airport_departure_desc", "value" => "Departure Airport - DESC", "sql" => "ORDER BY marine_live.departure_airport_city DESC"), "airport_arrival_asc" => array("key" => "airport_arrival_asc", "value" => "Arrival Airport - ASC", "sql" => "ORDER BY marine_live.arrival_airport_city ASC"), "airport_arrival_desc" => array("key" => "airport_arrival_desc", "value" => "Arrival Airport - DESC", "sql" => "ORDER BY marine_live.arrival_airport_city DESC"), "date_asc" => array("key" => "date_asc", "value" => "Date - ASC", "sql" => "ORDER BY marine_live.date ASC"), "date_desc" => array("key" => "date_desc", "value" => "Date - DESC", "sql" => "ORDER BY marine_live.date DESC"));
1005 1005
 		return $orderby;
1006 1006
 	}
1007 1007
 
Please login to merge, or discard this patch.
live-czml.php 1 patch
Spacing   +62 added lines, -62 removed lines patch added patch discarded remove patch
@@ -48,11 +48,11 @@  discard block
 block discarded – undo
48 48
     $s3 = sin($bank/2);
49 49
     $c1c2 = $c1*$c2;
50 50
     $s1s2 = $s1*$s2;
51
-    $w =$c1c2*$c3 - $s1s2*$s3;
52
-    $x =$c1c2*$s3 + $s1s2*$c3;
53
-    $y =$s1*$c2*$c3 + $c1*$s2*$s3;
54
-    $z =$c1*$s2*$c3 - $s1*$c2*$s3;
55
-    return array('x' => $x,'y' => $y,'z' => $z,'w' => $w);
51
+    $w = $c1c2*$c3 - $s1s2*$s3;
52
+    $x = $c1c2*$s3 + $s1s2*$c3;
53
+    $y = $s1*$c2*$c3 + $c1*$s2*$s3;
54
+    $z = $c1*$s2*$c3 - $s1*$c2*$s3;
55
+    return array('x' => $x, 'y' => $y, 'z' => $z, 'w' => $w);
56 56
 //    return array('x' => '0.0','y' => '-0.931','z' => '0.0','w' => '0.365');
57 57
 
58 58
 }
@@ -73,17 +73,17 @@  discard block
 block discarded – undo
73 73
 $min = false;
74 74
 $allhistory = false;
75 75
 $filter['source'] = array();
76
-if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') $filter['source'] = array_merge($filter['source'],array('vatsimtxt'));
77
-if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') $filter['source'] = array_merge($filter['source'],array('whazzup'));
78
-if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') $filter['source'] = array_merge($filter['source'],array('phpvmacars'));
79
-if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') $filter['source'] = array_merge($filter['source'],array('sbs','famaprs'));
80
-if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') $filter['source'] = array_merge($filter['source'],array('aprs'));
81
-if (isset($_COOKIE['filter_ident']) && $_COOKIE['filter_ident'] != '') $filter['ident'] = filter_var($_COOKIE['filter_ident'],FILTER_SANITIZE_STRING);
82
-if (isset($_COOKIE['filter_mmsi']) && $_COOKIE['filter_mmsi'] != '') $filter['mmsi'] = filter_var($_COOKIE['filter_mmsi'],FILTER_SANITIZE_STRING);
83
-if (isset($_COOKIE['filter_Airlines']) && $_COOKIE['filter_Airlines'] != '') $filter['airlines'] = filter_var_array(explode(',',$_COOKIE['filter_Airlines']),FILTER_SANITIZE_STRING);
84
-if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') $filter['source_aprs'] = filter_var_array(explode(',',$_COOKIE['filter_Sources']),FILTER_SANITIZE_STRING);
85
-if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') $filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'],FILTER_SANITIZE_STRING);
86
-if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] != 'all') $filter['alliance'] = filter_var($_COOKIE['filter_alliance'],FILTER_SANITIZE_STRING);
76
+if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') $filter['source'] = array_merge($filter['source'], array('vatsimtxt'));
77
+if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') $filter['source'] = array_merge($filter['source'], array('whazzup'));
78
+if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') $filter['source'] = array_merge($filter['source'], array('phpvmacars'));
79
+if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') $filter['source'] = array_merge($filter['source'], array('sbs', 'famaprs'));
80
+if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') $filter['source'] = array_merge($filter['source'], array('aprs'));
81
+if (isset($_COOKIE['filter_ident']) && $_COOKIE['filter_ident'] != '') $filter['ident'] = filter_var($_COOKIE['filter_ident'], FILTER_SANITIZE_STRING);
82
+if (isset($_COOKIE['filter_mmsi']) && $_COOKIE['filter_mmsi'] != '') $filter['mmsi'] = filter_var($_COOKIE['filter_mmsi'], FILTER_SANITIZE_STRING);
83
+if (isset($_COOKIE['filter_Airlines']) && $_COOKIE['filter_Airlines'] != '') $filter['airlines'] = filter_var_array(explode(',', $_COOKIE['filter_Airlines']), FILTER_SANITIZE_STRING);
84
+if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') $filter['source_aprs'] = filter_var_array(explode(',', $_COOKIE['filter_Sources']), FILTER_SANITIZE_STRING);
85
+if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') $filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'], FILTER_SANITIZE_STRING);
86
+if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] != 'all') $filter['alliance'] = filter_var($_COOKIE['filter_alliance'], FILTER_SANITIZE_STRING);
87 87
 /*
88 88
 if (isset($globalMapPopup) && !$globalMapPopup && !(isset($_COOKIE['flightpopup']) && $_COOKIE['flightpopup'] == 'true')) {
89 89
 	$min = true;
@@ -130,12 +130,12 @@  discard block
 block discarded – undo
130 130
 	$from_archive = true;
131 131
 //	$begindate = filter_input(INPUT_GET,'begindate',FILTER_VALIDATE_REGEXP,array("options"=>array("regexp"=>'~^\d{4}/\d{2}/\d{2}$~')));
132 132
 //	$enddate = filter_input(INPUT_GET,'enddate',FILTER_VALIDATE_REGEXP,array("options"=>array("regexp"=>'~^\d{4}/\d{2}/\d{2}$~')));
133
-	$begindate = filter_input(INPUT_GET,'begindate',FILTER_SANITIZE_NUMBER_INT);
134
-	$enddate = filter_input(INPUT_GET,'enddate',FILTER_SANITIZE_NUMBER_INT);
135
-	$archivespeed = filter_input(INPUT_GET,'speed',FILTER_SANITIZE_NUMBER_INT);
136
-	$begindate = date('Y-m-d H:i:s',$begindate);
137
-	$enddate = date('Y-m-d H:i:s',$enddate);
138
-	$spotter_array = $SpotterArchive->getMinLiveSpotterDataPlayback($begindate,$enddate,$filter);
133
+	$begindate = filter_input(INPUT_GET, 'begindate', FILTER_SANITIZE_NUMBER_INT);
134
+	$enddate = filter_input(INPUT_GET, 'enddate', FILTER_SANITIZE_NUMBER_INT);
135
+	$archivespeed = filter_input(INPUT_GET, 'speed', FILTER_SANITIZE_NUMBER_INT);
136
+	$begindate = date('Y-m-d H:i:s', $begindate);
137
+	$enddate = date('Y-m-d H:i:s', $enddate);
138
+	$spotter_array = $SpotterArchive->getMinLiveSpotterDataPlayback($begindate, $enddate, $filter);
139 139
 } elseif (isset($_COOKIE['archive']) && isset($_COOKIE['archive_begin']) && isset($_COOKIE['archive_end']) && isset($_COOKIE['archive_speed'])) {
140 140
 	$from_archive = true;
141 141
 //	$begindate = filter_input(INPUT_GET,'begindate',FILTER_VALIDATE_REGEXP,array("options"=>array("regexp"=>'~^\d{4}/\d{2}/\d{2}$~')));
@@ -145,34 +145,34 @@  discard block
 block discarded – undo
145 145
 	$begindate = $_COOKIE['archive_begin'];
146 146
 	$enddate = $_COOKIE['archive_end'];
147 147
 
148
-	$archivespeed = filter_var($_COOKIE['archive_speed'],FILTER_SANITIZE_NUMBER_INT);
149
-	$begindate = date('Y-m-d H:i:s',$begindate);
150
-	$enddate = date('Y-m-d H:i:s',$enddate);
148
+	$archivespeed = filter_var($_COOKIE['archive_speed'], FILTER_SANITIZE_NUMBER_INT);
149
+	$begindate = date('Y-m-d H:i:s', $begindate);
150
+	$enddate = date('Y-m-d H:i:s', $enddate);
151 151
 //	echo 'Begin : '.$begindate.' - End : '.$enddate."\n";
152
-	$spotter_array = $SpotterArchive->getMinLiveSpotterData($begindate,$enddate,$filter);
152
+	$spotter_array = $SpotterArchive->getMinLiveSpotterData($begindate, $enddate, $filter);
153 153
 } elseif ($tracker) {
154 154
 	$coord = array();
155 155
 	if (isset($_GET['coord']) && $_GET['coord'] != '') {
156
-		$coord = explode(',',$_GET['coord']);
156
+		$coord = explode(',', $_GET['coord']);
157 157
 	}
158
-	$spotter_array = $TrackerLive->getMinLastLiveTrackerData($coord,$filter,true);
158
+	$spotter_array = $TrackerLive->getMinLastLiveTrackerData($coord, $filter, true);
159 159
 } elseif ($marine) {
160 160
 	$coord = array();
161 161
 	if (isset($_GET['coord']) && $_GET['coord'] != '') {
162
-		$coord = explode(',',$_GET['coord']);
162
+		$coord = explode(',', $_GET['coord']);
163 163
 	}
164
-	$spotter_array = $MarineLive->getMinLastLiveMarineData($coord,$filter,true);
164
+	$spotter_array = $MarineLive->getMinLastLiveMarineData($coord, $filter, true);
165 165
 } else {
166 166
 	$coord = array();
167 167
 	if (isset($_GET['coord']) && $_GET['coord'] != '') {
168
-		$coord = explode(',',$_GET['coord']);
168
+		$coord = explode(',', $_GET['coord']);
169 169
 	}
170
-	$spotter_array = $SpotterLive->getMinLastLiveSpotterData($coord,$filter,true);
170
+	$spotter_array = $SpotterLive->getMinLastLiveSpotterData($coord, $filter, true);
171 171
 }
172 172
 //print_r($spotter_array);
173 173
 if (!empty($spotter_array) && isset($coord)) {
174 174
 	if (isset($_GET['archive'])) {
175
-		$flightcnt = $SpotterArchive->getLiveSpotterCount($begindate,$enddate,$filter);
175
+		$flightcnt = $SpotterArchive->getLiveSpotterCount($begindate, $enddate, $filter);
176 176
 	} elseif ($tracker) {
177 177
 		$flightcnt = $TrackerLive->getLiveTrackerCount($filter);
178 178
 	} elseif ($marine) {
@@ -183,15 +183,15 @@  discard block
 block discarded – undo
183 183
 	if ($flightcnt == '') $flightcnt = 0;
184 184
 } else $flightcnt = 0;
185 185
 
186
-$sqltime = round(microtime(true)-$begintime,2);
186
+$sqltime = round(microtime(true) - $begintime, 2);
187 187
 $minitime = time();
188 188
 $maxitime = 0;
189
-$lastupdate = filter_input(INPUT_GET,'update',FILTER_SANITIZE_NUMBER_INT);
189
+$lastupdate = filter_input(INPUT_GET, 'update', FILTER_SANITIZE_NUMBER_INT);
190 190
 $modelsdb = array();
191 191
 if (file_exists(dirname(__FILE__).'/models/modelsdb')) {
192
-	if (($handle = fopen(dirname(__FILE__).'/models/modelsdb','r')) !== FALSE) {
193
-		while (($row = fgetcsv($handle,1000)) !== FALSE) {
194
-			if (isset($row[1]) ){
192
+	if (($handle = fopen(dirname(__FILE__).'/models/modelsdb', 'r')) !== FALSE) {
193
+		while (($row = fgetcsv($handle, 1000)) !== FALSE) {
194
+			if (isset($row[1])) {
195 195
 				$model = $row[0];
196 196
 				$modelsdb[$model] = $row[1];
197 197
 			}
@@ -201,9 +201,9 @@  discard block
 block discarded – undo
201 201
 }
202 202
 $modelsdb2 = array();
203 203
 if (file_exists(dirname(__FILE__).'/models/gltf2/modelsdb')) {
204
-	if (($handle = fopen(dirname(__FILE__).'/models/gltf2/modelsdb','r')) !== FALSE) {
205
-		while (($row = fgetcsv($handle,1000)) !== FALSE) {
206
-			if (isset($row[1]) ){
204
+	if (($handle = fopen(dirname(__FILE__).'/models/gltf2/modelsdb', 'r')) !== FALSE) {
205
+		while (($row = fgetcsv($handle, 1000)) !== FALSE) {
206
+			if (isset($row[1])) {
207 207
 				$model = $row[0];
208 208
 				$modelsdb2[$model] = $row[1];
209 209
 			}
@@ -241,7 +241,7 @@  discard block
 block discarded – undo
241 241
 if (!empty($spotter_array) && is_array($spotter_array))
242 242
 {
243 243
 	$nblatlong = 0;
244
-	foreach($spotter_array as $spotter_item)
244
+	foreach ($spotter_array as $spotter_item)
245 245
 	{
246 246
 		$j++;
247 247
 		//if (isset($spotter_item['format_source']) && $spotter_item['format_source'] == 'airwhere') $heightrelative = 'RELATIVE_TO_GROUND';
@@ -283,9 +283,9 @@  discard block
 block discarded – undo
283 283
 			$output .= '"lastupdate": "'.$lastupdate.'",';
284 284
 			$output .= '"format": "'.$spotter_item['format_source'].'",';
285 285
 			if ($tracker) {
286
-				$output.= '"type": "tracker"';
286
+				$output .= '"type": "tracker"';
287 287
 			} elseif ($marine) {
288
-				$output.= '"type": "marine"';
288
+				$output .= '"type": "marine"';
289 289
 			} else {
290 290
 				if (isset($globalMap3DLiveries) && $globalMap3DLiveries) {
291 291
 					$aircraft_icao = $spotter_item['aircraft_icao'];
@@ -299,14 +299,14 @@  discard block
 block discarded – undo
299 299
 						if (isset($airline_icao)) {
300 300
 							$imagefile = $aircraft_icao.'-'.$airline_icao.'.png';
301 301
 							if (file_exists(dirname(__FILE__).'/models/gltf2/liveries/'.$imagefile)) {
302
-								$output.= '"liveries": "'.$globalURL.'/models/gltf2/liveries/'.$imagefile.'",';
302
+								$output .= '"liveries": "'.$globalURL.'/models/gltf2/liveries/'.$imagefile.'",';
303 303
 							}
304 304
 						}
305 305
 					}
306
-					if ($ident != '') $output.= '"ident": "'.$ident.'",';
306
+					if ($ident != '') $output .= '"ident": "'.$ident.'",';
307 307
 				}
308
-				$output.= '"gltf2": %gltf2%,';
309
-				$output.= '"type": "flight"';
308
+				$output .= '"gltf2": %gltf2%,';
309
+				$output .= '"type": "flight"';
310 310
 			}
311 311
 			$output .= '},';
312 312
 
@@ -659,8 +659,8 @@  discard block
 block discarded – undo
659 659
 					$output .= '},';
660 660
 				}
661 661
 			}
662
-			if (isset($onground) && $onground) $output = str_replace('%onground%','true',$output);
663
-			else $output = str_replace('%onground%','false',$output);
662
+			if (isset($onground) && $onground) $output = str_replace('%onground%', 'true', $output);
663
+			else $output = str_replace('%onground%', 'false', $output);
664 664
 
665 665
 	//		$output .= '"heightReference": "CLAMP_TO_GROUND",';
666 666
 			//$output .= '"heightReference": "'.$heightrelative.'",';
@@ -675,7 +675,7 @@  discard block
 block discarded – undo
675 675
 			$output .= '"cartographicDegrees": [';
676 676
 			if ($minitime > strtotime($spotter_item['date'])) $minitime = strtotime($spotter_item['date']);
677 677
 			if ($maxitime < strtotime($spotter_item['date'])) $maxitime = strtotime($spotter_item['date']);
678
-			$output .= '"'.date("c",strtotime($spotter_item['date'])).'", ';
678
+			$output .= '"'.date("c", strtotime($spotter_item['date'])).'", ';
679 679
 			$output .= $spotter_item['longitude'].', ';
680 680
 			$output .= $spotter_item['latitude'];
681 681
 			$prevlong = $spotter_item['longitude'];
@@ -703,8 +703,8 @@  discard block
 block discarded – undo
703 703
 			//$quat = quaternionrotate(deg2rad($spotter_item['heading']),deg2rad(0),deg2rad(0));
704 704
 			//$orientation .= '"'.date("c",strtotime($spotter_item['date'])).'",'.$quat['x'].','.$quat['y'].','.$quat['z'].','.$quat['w'];
705 705
 		} else {
706
-			$nblatlong = $nblatlong+1;
707
-			$output .= ',"'.date("c",strtotime($spotter_item['date'])).'", ';
706
+			$nblatlong = $nblatlong + 1;
707
+			$output .= ',"'.date("c", strtotime($spotter_item['date'])).'", ';
708 708
 			if ($maxitime < strtotime($spotter_item['date'])) $maxitime = strtotime($spotter_item['date']);
709 709
 			if ($spotter_item['ground_speed'] == 0) {
710 710
 				$output .= $prevlong.', ';
@@ -744,17 +744,17 @@  discard block
 block discarded – undo
744 744
 }
745 745
 $output .= ']';
746 746
 if (isset($globalArchive) && $globalArchive === TRUE) {
747
-	if ((time()-$globalLiveInterval) > $minitime) {
748
-		if (time()-$globalLiveInterval > $maxitime) {
749
-			$output = str_replace('%minitime%',date("c",$maxitime),$output);
747
+	if ((time() - $globalLiveInterval) > $minitime) {
748
+		if (time() - $globalLiveInterval > $maxitime) {
749
+			$output = str_replace('%minitime%', date("c", $maxitime), $output);
750 750
 		} else {
751
-			$output = str_replace('%minitime%',date("c",time()-$globalLiveInterval),$output);
751
+			$output = str_replace('%minitime%', date("c", time() - $globalLiveInterval), $output);
752 752
 		}
753 753
 	}
754
-	else $output = str_replace('%minitime%',date("c",$minitime),$output);
755
-} else $output = str_replace('%minitime%',date("c",$minitime),$output);
756
-$output = str_replace('%maxitime%',date("c",$maxitime),$output);
757
-if ($gltf2) $output = str_replace('%gltf2%','true',$output);
758
-else $output = str_replace('%gltf2%','false',$output);
754
+	else $output = str_replace('%minitime%', date("c", $minitime), $output);
755
+} else $output = str_replace('%minitime%', date("c", $minitime), $output);
756
+$output = str_replace('%maxitime%', date("c", $maxitime), $output);
757
+if ($gltf2) $output = str_replace('%gltf2%', 'true', $output);
758
+else $output = str_replace('%gltf2%', 'false', $output);
759 759
 print $output;
760 760
 ?>
Please login to merge, or discard this patch.
live-geojson.php 1 patch
Spacing   +61 added lines, -61 removed lines patch added patch discarded remove patch
@@ -55,24 +55,24 @@  discard block
 block discarded – undo
55 55
 $min = true;
56 56
 $allhistory = false;
57 57
 $filter['source'] = array();
58
-if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') $filter['source'] = array_merge($filter['source'],array('vatsimtxt'));
59
-if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') $filter['source'] = array_merge($filter['source'],array('whazzup'));
60
-if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') $filter['source'] = array_merge($filter['source'],array('phpvmacars'));
61
-if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') $filter['source'] = array_merge($filter['source'],array('sbs','famaprs'));
62
-if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') $filter['source'] = array_merge($filter['source'],array('aprs'));
63
-if (isset($_COOKIE['filter_ident']) && $_COOKIE['filter_ident'] != '') $filter['ident'] = filter_var($_COOKIE['filter_ident'],FILTER_SANITIZE_STRING);
64
-if (isset($_COOKIE['filter_mmsi']) && $_COOKIE['filter_mmsi'] != '') $filter['mmsi'] = filter_var($_COOKIE['filter_mmsi'],FILTER_SANITIZE_STRING);
65
-if (isset($_COOKIE['filter_Airlines']) && $_COOKIE['filter_Airlines'] != '') $filter['airlines'] = filter_var_array(explode(',',$_COOKIE['filter_Airlines']),FILTER_SANITIZE_STRING);
66
-if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') $filter['source_aprs'] = filter_var_array(explode(',',$_COOKIE['filter_Sources']),FILTER_SANITIZE_STRING);
67
-if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') $filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'],FILTER_SANITIZE_STRING);
68
-if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] != 'all') $filter['alliance'] = filter_var($_COOKIE['filter_alliance'],FILTER_SANITIZE_STRING);
58
+if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') $filter['source'] = array_merge($filter['source'], array('vatsimtxt'));
59
+if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') $filter['source'] = array_merge($filter['source'], array('whazzup'));
60
+if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') $filter['source'] = array_merge($filter['source'], array('phpvmacars'));
61
+if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') $filter['source'] = array_merge($filter['source'], array('sbs', 'famaprs'));
62
+if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') $filter['source'] = array_merge($filter['source'], array('aprs'));
63
+if (isset($_COOKIE['filter_ident']) && $_COOKIE['filter_ident'] != '') $filter['ident'] = filter_var($_COOKIE['filter_ident'], FILTER_SANITIZE_STRING);
64
+if (isset($_COOKIE['filter_mmsi']) && $_COOKIE['filter_mmsi'] != '') $filter['mmsi'] = filter_var($_COOKIE['filter_mmsi'], FILTER_SANITIZE_STRING);
65
+if (isset($_COOKIE['filter_Airlines']) && $_COOKIE['filter_Airlines'] != '') $filter['airlines'] = filter_var_array(explode(',', $_COOKIE['filter_Airlines']), FILTER_SANITIZE_STRING);
66
+if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') $filter['source_aprs'] = filter_var_array(explode(',', $_COOKIE['filter_Sources']), FILTER_SANITIZE_STRING);
67
+if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') $filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'], FILTER_SANITIZE_STRING);
68
+if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] != 'all') $filter['alliance'] = filter_var($_COOKIE['filter_alliance'], FILTER_SANITIZE_STRING);
69 69
 
70 70
 if (isset($globalMapPopup) && !$globalMapPopup && !(isset($_COOKIE['flightpopup']) && $_COOKIE['flightpopup'] == 'true')) {
71 71
 	$min = true;
72 72
 } else $min = false;
73 73
 
74 74
 if (isset($_GET['ident'])) {
75
-	$ident = urldecode(filter_input(INPUT_GET,'ident',FILTER_SANITIZE_STRING));
75
+	$ident = urldecode(filter_input(INPUT_GET, 'ident', FILTER_SANITIZE_STRING));
76 76
 	if ($tracker) {
77 77
 		$spotter_array = $TrackerLive->getLastLiveTrackerDataByIdent($ident);
78 78
 	} elseif ($marine) {
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
 	}
87 87
 	$allhistory = true;
88 88
 } elseif (isset($_GET['flightaware_id'])) {
89
-	$flightaware_id = filter_input(INPUT_GET,'flightaware_id',FILTER_SANITIZE_STRING);
89
+	$flightaware_id = filter_input(INPUT_GET, 'flightaware_id', FILTER_SANITIZE_STRING);
90 90
 	$spotter_array = $SpotterLive->getLastLiveSpotterDataById($flightaware_id);
91 91
 	if (empty($spotter_array)) {
92 92
 		$from_archive = true;
@@ -94,44 +94,44 @@  discard block
 block discarded – undo
94 94
 	}
95 95
 	$allhistory = true;
96 96
 } elseif (isset($_GET['famtrack_id'])) {
97
-	$famtrack_id = urldecode(filter_input(INPUT_GET,'famtrack_id',FILTER_SANITIZE_STRING));
97
+	$famtrack_id = urldecode(filter_input(INPUT_GET, 'famtrack_id', FILTER_SANITIZE_STRING));
98 98
 	$spotter_array = $TrackerLive->getLastLiveTrackerDataById($famtrack_id);
99 99
 	$allhistory = true;
100 100
 } elseif (isset($_GET['fammarine_id'])) {
101
-	$fammarine_id = urldecode(filter_input(INPUT_GET,'fammarine_id',FILTER_SANITIZE_STRING));
101
+	$fammarine_id = urldecode(filter_input(INPUT_GET, 'fammarine_id', FILTER_SANITIZE_STRING));
102 102
 	$spotter_array = $MarineLive->getLastLiveMarineDataById($fammarine_id);
103 103
 	$allhistory = true;
104 104
 } elseif (isset($globalMapUseBbox) && $globalMapUseBbox && isset($_GET['coord']) && (!isset($globalMapPopup) || $globalMapPopup || (isset($_COOKIE['flightpopup']) && $_COOKIE['flightpopup'] == 'true'))) {
105 105
 //} elseif (isset($_GET['coord'])) {
106 106
 	$usecoord = true;
107
-	$coord = explode(',',$_GET['coord']);
107
+	$coord = explode(',', $_GET['coord']);
108 108
 	if ($tracker) {
109
-		$spotter_array = $TrackerLive->getLiveTrackerDatabyCoord($coord,$filter);
109
+		$spotter_array = $TrackerLive->getLiveTrackerDatabyCoord($coord, $filter);
110 110
 	} elseif ($marine) {
111
-		$spotter_array = $MarineLive->getLiveMarineDatabyCoord($coord,$filter);
111
+		$spotter_array = $MarineLive->getLiveMarineDatabyCoord($coord, $filter);
112 112
 	} else {
113
-		$spotter_array = $SpotterLive->getLiveSpotterDatabyCoord($coord,$filter);
113
+		$spotter_array = $SpotterLive->getLiveSpotterDatabyCoord($coord, $filter);
114 114
 	}
115 115
 } elseif (isset($globalMapUseBbox) && $globalMapUseBbox && isset($_GET['coord']) && $min) {
116 116
 	$usecoord = true;
117
-	$coord = explode(',',$_GET['coord']);
117
+	$coord = explode(',', $_GET['coord']);
118 118
 	if ($tracker) {
119
-		$spotter_array = $TrackerLive->getMinLiveTrackerDatabyCoord($coord,$filter);
119
+		$spotter_array = $TrackerLive->getMinLiveTrackerDatabyCoord($coord, $filter);
120 120
 	} elseif ($marine) {
121
-		$spotter_array = $MarineLive->getMinLiveMarineDatabyCoord($coord,$filter);
121
+		$spotter_array = $MarineLive->getMinLiveMarineDatabyCoord($coord, $filter);
122 122
 	} else {
123
-		$spotter_array = $SpotterLive->getMinLiveSpotterDatabyCoord($coord,$filter);
123
+		$spotter_array = $SpotterLive->getMinLiveSpotterDatabyCoord($coord, $filter);
124 124
 	}
125 125
 } elseif (isset($_GET['archive']) && isset($_GET['begindate']) && isset($_GET['enddate']) && isset($_GET['speed']) && !isset($_GET['tracker']) && !isset($_GET['marine'])) {
126 126
 	$from_archive = true;
127 127
 //	$begindate = filter_input(INPUT_GET,'begindate',FILTER_VALIDATE_REGEXP,array("options"=>array("regexp"=>'~^\d{4}/\d{2}/\d{2}$~')));
128 128
 //	$enddate = filter_input(INPUT_GET,'enddate',FILTER_VALIDATE_REGEXP,array("options"=>array("regexp"=>'~^\d{4}/\d{2}/\d{2}$~')));
129
-	$begindate = filter_input(INPUT_GET,'begindate',FILTER_SANITIZE_NUMBER_INT);
130
-	$enddate = filter_input(INPUT_GET,'enddate',FILTER_SANITIZE_NUMBER_INT);
131
-	$archivespeed = filter_input(INPUT_GET,'speed',FILTER_SANITIZE_NUMBER_INT);
132
-	$begindate = date('Y-m-d H:i:s',$begindate);
133
-	$enddate = date('Y-m-d H:i:s',$enddate);
134
-	$spotter_array = $SpotterArchive->getMinLiveSpotterData($begindate,$enddate,$filter);
129
+	$begindate = filter_input(INPUT_GET, 'begindate', FILTER_SANITIZE_NUMBER_INT);
130
+	$enddate = filter_input(INPUT_GET, 'enddate', FILTER_SANITIZE_NUMBER_INT);
131
+	$archivespeed = filter_input(INPUT_GET, 'speed', FILTER_SANITIZE_NUMBER_INT);
132
+	$begindate = date('Y-m-d H:i:s', $begindate);
133
+	$enddate = date('Y-m-d H:i:s', $enddate);
134
+	$spotter_array = $SpotterArchive->getMinLiveSpotterData($begindate, $enddate, $filter);
135 135
 } elseif ($min) {
136 136
 	if ($tracker) {
137 137
 		$spotter_array = $TrackerLive->getMinLiveTrackerData($filter);
@@ -143,17 +143,17 @@  discard block
 block discarded – undo
143 143
 #	$min = true;
144 144
 } else {
145 145
 	if ($tracker) {
146
-		$spotter_array = $TrackerLive->getLiveTrackerData('','',$filter);
146
+		$spotter_array = $TrackerLive->getLiveTrackerData('', '', $filter);
147 147
 	} elseif ($marine) {
148
-		$spotter_array = $marineLive->getLiveMarineData('','',$filter);
148
+		$spotter_array = $marineLive->getLiveMarineData('', '', $filter);
149 149
 	} else {
150
-		$spotter_array = $SpotterLive->getLiveSpotterData('','',$filter);
150
+		$spotter_array = $SpotterLive->getLiveSpotterData('', '', $filter);
151 151
 	}
152 152
 }
153 153
 
154 154
 if ($usecoord) {
155 155
 	if (isset($_GET['archive'])) {
156
-		$flightcnt = $SpotterArchive->getLiveSpotterCount($begindate,$enddate,$filter);
156
+		$flightcnt = $SpotterArchive->getLiveSpotterCount($begindate, $enddate, $filter);
157 157
 	} else {
158 158
 		if ($tracker) {
159 159
 			$flightcnt = $TrackerLive->getLiveTrackerCount($filter);
@@ -166,9 +166,9 @@  discard block
 block discarded – undo
166 166
 	if ($flightcnt == '') $flightcnt = 0;
167 167
 } else $flightcnt = 0;
168 168
 
169
-$sqltime = round(microtime(true)-$begintime,2);
169
+$sqltime = round(microtime(true) - $begintime, 2);
170 170
 
171
-$currenttime = filter_input(INPUT_GET,'currenttime',FILTER_SANITIZE_NUMBER_INT);
171
+$currenttime = filter_input(INPUT_GET, 'currenttime', FILTER_SANITIZE_NUMBER_INT);
172 172
 if ($currenttime != '') $currenttime = round($currenttime/1000);
173 173
 
174 174
 if ((!isset($_COOKIE['flightestimation']) && isset($globalMapEstimation) && $globalMapEstimation == FALSE) || (isset($_COOKIE['flightestimation']) && $_COOKIE['flightestimation'] == 'false')) $usenextlatlon = false;
@@ -187,7 +187,7 @@  discard block
 block discarded – undo
187 187
 		if (!empty($spotter_array) && is_array($spotter_array))
188 188
 		{
189 189
 			$output .= '"features": [';
190
-			foreach($spotter_array as $spotter_item)
190
+			foreach ($spotter_array as $spotter_item)
191 191
 			{
192 192
 				$j++;
193 193
 				date_default_timezone_set('UTC');
@@ -243,8 +243,8 @@  discard block
 block discarded – undo
243 243
 */
244 244
 							//$output .= '"fc": "'.$spotter_item['nb'].'",';
245 245
 						if (isset($spotter_item['ident']) && $spotter_item['ident'] != '') {
246
-							if ($compress) $output .= '"c": "'.str_replace('\\','',$spotter_item['ident']).'",';
247
-							else $output .= '"callsign": "'.str_replace('\\','',$spotter_item['ident']).'",';
246
+							if ($compress) $output .= '"c": "'.str_replace('\\', '', $spotter_item['ident']).'",';
247
+							else $output .= '"callsign": "'.str_replace('\\', '', $spotter_item['ident']).'",';
248 248
 							//"
249 249
 						} else {
250 250
 							if ($compress) $output .= '"c": "NA",';
@@ -253,7 +253,7 @@  discard block
 block discarded – undo
253 253
 						if (isset($spotter_item['registration'])) $output .= '"registration": "'.$spotter_item['registration'].'",';
254 254
 						if (isset($spotter_item['aircraft_name']) && isset($spotter_item['aircraft_type'])) {
255 255
 							$output .= '"aircraft_name": "'.$spotter_item['aircraft_name'].' ('.$spotter_item['aircraft_type'].')",';
256
-							$output .= '"aircraft_wiki": "http://'.strtolower($globalLanguage).'.wikipedia.org/wiki/'.urlencode(str_replace(' ','_',$spotter_item['aircraft_name'])).'",';
256
+							$output .= '"aircraft_wiki": "http://'.strtolower($globalLanguage).'.wikipedia.org/wiki/'.urlencode(str_replace(' ', '_', $spotter_item['aircraft_name'])).'",';
257 257
 						} elseif (isset($spotter_item['aircraft_type'])) {
258 258
 							$output .= '"aircraft_name": "NA ('.$spotter_item['aircraft_type'].')",';
259 259
 						} elseif (!$min) {
@@ -396,26 +396,26 @@  discard block
 block discarded – undo
396 396
 						if ($currenttime != '') {
397 397
 							if (strtotime($spotter_item['date']) < $currenttime) {
398 398
 								if (isset($archivespeed)) {
399
-									$nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$spotter_item['heading'],$archivespeed,($currenttime-strtotime($spotter_item['date'])+$globalMapRefresh));
399
+									$nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $spotter_item['heading'], $archivespeed, ($currenttime - strtotime($spotter_item['date']) + $globalMapRefresh));
400 400
 									$output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],';
401 401
 								} elseif ($usenextlatlon) {
402
-									$nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$spotter_item['heading'],1,($currenttime-strtotime($spotter_item['date'])+$globalMapRefresh));
402
+									$nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $spotter_item['heading'], 1, ($currenttime - strtotime($spotter_item['date']) + $globalMapRefresh));
403 403
 									$output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],';
404 404
 								}
405 405
 							}
406 406
 						} else {
407 407
 							if (isset($archivespeed)) {
408
-								$nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$spotter_item['heading'],$archivespeed);
408
+								$nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $spotter_item['heading'], $archivespeed);
409 409
 								$output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],';
410 410
 							} elseif ($usenextlatlon) {
411
-								$nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$spotter_item['heading']);
411
+								$nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $spotter_item['heading']);
412 412
 								$output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],';
413 413
 							}
414 414
 						}
415 415
 
416 416
 						if (!$min) $output .= '"image": "'.$image.'",';
417 417
 						if (isset($spotter_item['image_copyright']) && $spotter_item['image_copyright'] != '') {
418
-							$output .= '"image_copyright": "'.str_replace('"',"'",trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'',$spotter_item['image_copyright']))).'",';
418
+							$output .= '"image_copyright": "'.str_replace('"', "'", trim(str_replace(array("\r\n", "\r", "\n", "\\r", "\\n", "\\r\\n"), '', $spotter_item['image_copyright']))).'",';
419 419
 						}
420 420
 						if (isset($spotter_item['image_source_website'])) {
421 421
 							$output .= '"image_source_website": "'.urlencode($spotter_item['image_source_website']).'",';
@@ -437,7 +437,7 @@  discard block
 block discarded – undo
437 437
 							$output .= '"waypoints": "'.$spotter_item['waypoints'].'",';
438 438
 						}
439 439
 						if (isset($spotter_item['acars'])) {
440
-							$output .= '"acars": "'.trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"), '<br />',$spotter_item['acars']['message'])).'",';
440
+							$output .= '"acars": "'.trim(str_replace(array("\r\n", "\r", "\n", "\\r", "\\n", "\\r\\n"), '<br />', $spotter_item['acars']['message'])).'",';
441 441
 						}
442 442
 						// type when not aircraft ?
443 443
 						if (isset($spotter_item['type'])) {
@@ -457,7 +457,7 @@  discard block
 block discarded – undo
457 457
 								if ($currenttime != '') {
458 458
 									if (strtotime($spotter_item['date']) < $currenttime) {
459 459
 										if (!isset($archivespeed)) $archivespeed = 1;
460
-										$nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$spotter_item['heading'],$archivespeed,$currenttime-strtotime($spotter_item['date']));
460
+										$nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $spotter_item['heading'], $archivespeed, $currenttime - strtotime($spotter_item['date']));
461 461
 										$output .= $nextcoord['longitude'].','.$nextcoord['latitude'];
462 462
 									} else {
463 463
 										$output .= $spotter_item['longitude'].', ';
@@ -526,7 +526,7 @@  discard block
 block discarded – undo
526 526
                 
527 527
 			}
528 528
 */
529
-				$history = filter_input(INPUT_GET,'history',FILTER_SANITIZE_STRING);
529
+				$history = filter_input(INPUT_GET, 'history', FILTER_SANITIZE_STRING);
530 530
 				if ($history == '' && isset($_COOKIE['history'])) $history = $_COOKIE['history'];
531 531
 				
532 532
 				if (
@@ -534,11 +534,11 @@  discard block
 block discarded – undo
534 534
 				    || ((isset($globalMapHistory) && $globalMapHistory) || $allhistory)
535 535
 				//    || (isset($history) && $history != '' && $history != 'NA' && ($history == $spotter_item['ident'] || $history == $spotter_item['flightaware_id']))
536 536
 				//    || (isset($history) && $history != '' && $history != 'NA' && $history == $spotter_item['ident'])
537
-				    || (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['flightaware_id']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['flightaware_id']))
537
+				    || (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['flightaware_id']) && str_replace('-', '', $history) == str_replace('-', '', $spotter_item['flightaware_id']))
538 538
 				    || (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['flightaware_id']) && $_GET['flightaware_id'] == $spotter_item['flightaware_id'])
539
-				    || (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['fammarine_id']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['fammarine_id']))
539
+				    || (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['fammarine_id']) && str_replace('-', '', $history) == str_replace('-', '', $spotter_item['fammarine_id']))
540 540
 				    || (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['fammarine_id']) && $_GET['fammarine_id'] == $spotter_item['fammarine_id'])
541
-				    || (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['famtrackid']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['famtrackid']))
541
+				    || (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['famtrackid']) && str_replace('-', '', $history) == str_replace('-', '', $spotter_item['famtrackid']))
542 542
 				    || (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['famtrackid']) && $_GET['famtrackid'] == $spotter_item['famtrackid'])
543 543
 				    ) {
544 544
 					if ($tracker) {
@@ -575,9 +575,9 @@  discard block
 block discarded – undo
575 575
 								else $output_history = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "history","altitude": "'.$alt.'"},"geometry": {"type": "LineString","coordinates": [';
576 576
 							}
577 577
 							$output_history .= '[';
578
-							$output_history .=  $spotter_history['longitude'].', ';
579
-							$output_history .=  $spotter_history['latitude'].', ';
580
-							$output_history .=  $spotter_history['altitude']*30.48;
578
+							$output_history .= $spotter_history['longitude'].', ';
579
+							$output_history .= $spotter_history['latitude'].', ';
580
+							$output_history .= $spotter_history['altitude']*30.48;
581 581
 							$output_history .= '],';
582 582
 							/*
583 583
 							if ($from_archive === false) {
@@ -595,8 +595,8 @@  discard block
 block discarded – undo
595 595
 								else $output_history = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "history"},"geometry": {"type": "LineString","coordinates": [';
596 596
 							} else $d = true;
597 597
 							$output_history .= '[';
598
-							$output_history .=  $spotter_history['longitude'].', ';
599
-							$output_history .=  $spotter_history['latitude'];
598
+							$output_history .= $spotter_history['longitude'].', ';
599
+							$output_history .= $spotter_history['latitude'];
600 600
 							$output_history .= '],';
601 601
 							/*
602 602
 							if ($from_archive === false) {
@@ -612,9 +612,9 @@  discard block
 block discarded – undo
612 612
 					
613 613
 						if ($from_archive === false) {
614 614
 							$output_historyd = '[';
615
-							$output_historyd .=  $spotter_item['longitude'].', ';
616
-							$output_historyd .=  $spotter_item['latitude'];
617
-							if (isset($spotter_history['altitude'])) $output_historyd .=  ','.$spotter_item['altitude']*30.48;
615
+							$output_historyd .= $spotter_item['longitude'].', ';
616
+							$output_historyd .= $spotter_item['latitude'];
617
+							if (isset($spotter_history['altitude'])) $output_historyd .= ','.$spotter_item['altitude']*30.48;
618 618
 							$output_historyd .= '],';
619 619
 							//$output_history = $output_historyd.$output_history;
620 620
 							$output_history = $output_history.$output_historyd;
@@ -628,7 +628,7 @@  discard block
 block discarded – undo
628 628
 					}
629 629
 				}
630 630
 				
631
-				if (((isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['flightaware_id']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['flightaware_id']))
631
+				if (((isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['flightaware_id']) && str_replace('-', '', $history) == str_replace('-', '', $spotter_item['flightaware_id']))
632 632
 				    || (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['flightaware_id']) && $_GET['flightaware_id'] == $spotter_item['flightaware_id']))
633 633
 				     && (isset($spotter_item['departure_airport']) 
634 634
 				        && $spotter_item['departure_airport'] != 'NA' 
@@ -662,7 +662,7 @@  discard block
 block discarded – undo
662 662
 
663 663
 				//if (isset($history) && $history != '' && $history == $spotter_item['ident'] && isset($spotter_item['departure_airport']) && $spotter_item['departure_airport'] != 'NA' && isset($spotter_item['arrival_airport']) && $spotter_item['arrival_airport'] != 'NA' && ((isset($_COOKIE['MapRoute']) && $_COOKIE['MapRoute'] == "true") || (!isset($_COOKIE['MapRoute']) && (!isset($globalMapRoute) || (isset($globalMapRoute) && $globalMapRoute))))) {
664 664
 				//if (isset($history) && $history != '' && $history == $spotter_item['ident'] && isset($spotter_item['arrival_airport']) && $spotter_item['arrival_airport'] != 'NA' && ((isset($_COOKIE['MapRoute']) && $_COOKIE['MapRoute'] == "true") || (!isset($_COOKIE['MapRoute']) && (!isset($globalMapRoute) || (isset($globalMapRoute) && $globalMapRoute))))) {
665
-				if (((isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['flightaware_id']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['flightaware_id']))
665
+				if (((isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['flightaware_id']) && str_replace('-', '', $history) == str_replace('-', '', $spotter_item['flightaware_id']))
666 666
 				    || (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['flightaware_id']) && $_GET['flightaware_id'] == $spotter_item['flightaware_id']))
667 667
 				     && (isset($spotter_item['arrival_airport']) 
668 668
 				        && $spotter_item['arrival_airport'] != 'NA' 
@@ -693,7 +693,7 @@  discard block
 block discarded – undo
693 693
 			$output  = substr($output, 0, -1);
694 694
 			$output .= ']';
695 695
 			$output .= ',"initial_sqltime": "'.$sqltime.'",';
696
-			$output .= '"totaltime": "'.round(microtime(true)-$begintime,2).'",';
696
+			$output .= '"totaltime": "'.round(microtime(true) - $begintime, 2).'",';
697 697
 			if (isset($begindate)) $output .= '"archive_date": "'.$begindate.'",';
698 698
 			$output .= '"fc": "'.$j.'"';
699 699
 		} else {
Please login to merge, or discard this patch.