Completed
Push — master ( e17801...597a61 )
by Yannick
25:55
created
require/class.TrackerLive.php 4 patches
Doc Comments   +1 added lines, -5 removed lines patch added patch discarded remove patch
@@ -14,7 +14,7 @@  discard block
 block discarded – undo
14 14
 	/**
15 15
 	* Get SQL query part for filter used
16 16
 	* @param Array $filter the filter
17
-	* @return Array the SQL part
17
+	* @return string the SQL part
18 18
 	*/
19 19
 	public function getFilter($filter = array(),$where = false,$and = false) {
20 20
 		global $globalFilter, $globalStatsFilters, $globalFilterName, $globalDBdriver;
@@ -759,10 +759,6 @@  discard block
 block discarded – undo
759 759
 	*
760 760
 	* @param String $famtrackid the ID from flightaware
761 761
 	* @param String $ident the flight ident
762
-	* @param String $aircraft_icao the aircraft type
763
-	* @param String $departure_airport_icao the departure airport
764
-	* @param String $arrival_airport_icao the arrival airport
765
-	* @return String success or false
766 762
 	*
767 763
 	*/
768 764
 	public function addLiveTrackerData($famtrackid = '', $ident = '', $latitude = '', $longitude = '', $altitude = '', $heading = '', $groundspeed = '', $date = '', $putinarchive = false, $comment = '', $type = '',$noarchive = false,$format_source = '', $source_name = '', $over_country = '')
Please login to merge, or discard this patch.
Indentation   +196 added lines, -196 removed lines patch added patch discarded remove patch
@@ -12,10 +12,10 @@  discard block
 block discarded – undo
12 12
 
13 13
 
14 14
 	/**
15
-	* Get SQL query part for filter used
16
-	* @param Array $filter the filter
17
-	* @return Array the SQL part
18
-	*/
15
+	 * Get SQL query part for filter used
16
+	 * @param Array $filter the filter
17
+	 * @return Array the SQL part
18
+	 */
19 19
 	public function getFilter($filter = array(),$where = false,$and = false) {
20 20
 		global $globalFilter, $globalStatsFilters, $globalFilterName, $globalDBdriver;
21 21
 		$filters = array();
@@ -86,11 +86,11 @@  discard block
 block discarded – undo
86 86
 	}
87 87
 
88 88
 	/**
89
-	* Gets all the spotter information based on the latest data entry
90
-	*
91
-	* @return Array the spotter information
92
-	*
93
-	*/
89
+	 * Gets all the spotter information based on the latest data entry
90
+	 *
91
+	 * @return Array the spotter information
92
+	 *
93
+	 */
94 94
 	public function getLiveTrackerData($limit = '', $sort = '', $filter = array())
95 95
 	{
96 96
 		global $globalDBdriver, $globalLiveInterval;
@@ -132,11 +132,11 @@  discard block
 block discarded – undo
132 132
 	}
133 133
 
134 134
 	/**
135
-	* Gets Minimal Live Spotter data
136
-	*
137
-	* @return Array the spotter information
138
-	*
139
-	*/
135
+	 * Gets Minimal Live Spotter data
136
+	 *
137
+	 * @return Array the spotter information
138
+	 *
139
+	 */
140 140
 	public function getMinLiveTrackerData($filter = array())
141 141
 	{
142 142
 		global $globalDBdriver, $globalLiveInterval;
@@ -170,11 +170,11 @@  discard block
 block discarded – undo
170 170
 	}
171 171
 
172 172
 	/**
173
-	* Gets Minimal Live Spotter data since xx seconds
174
-	*
175
-	* @return Array the spotter information
176
-	*
177
-	*/
173
+	 * Gets Minimal Live Spotter data since xx seconds
174
+	 *
175
+	 * @return Array the spotter information
176
+	 *
177
+	 */
178 178
 	public function getMinLastLiveTrackerData($filter = array())
179 179
 	{
180 180
 		global $globalDBdriver, $globalLiveInterval, $globalArchive;
@@ -230,11 +230,11 @@  discard block
 block discarded – undo
230 230
 	}
231 231
 
232 232
 	/**
233
-	* Gets number of latest data entry
234
-	*
235
-	* @return String number of entry
236
-	*
237
-	*/
233
+	 * Gets number of latest data entry
234
+	 *
235
+	 * @return String number of entry
236
+	 *
237
+	 */
238 238
 	public function getLiveTrackerCount($filter = array())
239 239
 	{
240 240
 		global $globalDBdriver, $globalLiveInterval;
@@ -259,11 +259,11 @@  discard block
 block discarded – undo
259 259
 	}
260 260
 
261 261
 	/**
262
-	* Gets all the spotter information based on the latest data entry and coord
263
-	*
264
-	* @return Array the spotter information
265
-	*
266
-	*/
262
+	 * Gets all the spotter information based on the latest data entry and coord
263
+	 *
264
+	 * @return Array the spotter information
265
+	 *
266
+	 */
267 267
 	public function getLiveTrackerDatabyCoord($coord, $filter = array())
268 268
 	{
269 269
 		global $globalDBdriver, $globalLiveInterval;
@@ -287,11 +287,11 @@  discard block
 block discarded – undo
287 287
 	}
288 288
 
289 289
 	/**
290
-	* Gets all the spotter information based on the latest data entry and coord
291
-	*
292
-	* @return Array the spotter information
293
-	*
294
-	*/
290
+	 * Gets all the spotter information based on the latest data entry and coord
291
+	 *
292
+	 * @return Array the spotter information
293
+	 *
294
+	 */
295 295
 	public function getMinLiveTrackerDatabyCoord($coord, $filter = array())
296 296
 	{
297 297
 		global $globalDBdriver, $globalLiveInterval;
@@ -318,11 +318,11 @@  discard block
 block discarded – undo
318 318
 	}
319 319
 
320 320
 	/**
321
-	* Gets all the spotter information based on a user's latitude and longitude
322
-	*
323
-	* @return Array the spotter information
324
-	*
325
-	*/
321
+	 * Gets all the spotter information based on a user's latitude and longitude
322
+	 *
323
+	 * @return Array the spotter information
324
+	 *
325
+	 */
326 326
 	public function getLatestTrackerForLayar($lat, $lng, $radius, $interval)
327 327
 	{
328 328
 		$Tracker = new Tracker($this->db);
@@ -335,142 +335,142 @@  discard block
 block discarded – undo
335 335
 		if ($lng != '')
336 336
 		{
337 337
 			if (!is_numeric($lng))
338
-                        {
339
-                                return false;
340
-                        }
341
-                }
342
-
343
-                if ($radius != '')
344
-                {
345
-                        if (!is_numeric($radius))
346
-                        {
347
-                                return false;
348
-                        }
349
-                }
338
+						{
339
+								return false;
340
+						}
341
+				}
342
+
343
+				if ($radius != '')
344
+				{
345
+						if (!is_numeric($radius))
346
+						{
347
+								return false;
348
+						}
349
+				}
350 350
 		$additional_query = '';
351 351
 		if ($interval != '')
352
-                {
353
-                        if (!is_string($interval))
354
-                        {
355
-                                //$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= tracker_live.date ';
356
-			        return false;
357
-                        } else {
358
-                if ($interval == '1m')
359
-                {
360
-                    $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= tracker_live.date ';
361
-                } else if ($interval == '15m'){
362
-                    $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 15 MINUTE) <= tracker_live.date ';
363
-                } 
364
-            }
365
-                } else {
366
-         $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= tracker_live.date ';   
367
-        }
368
-
369
-                $query  = "SELECT tracker_live.*, ( 6371 * acos( cos( radians(:lat) ) * cos( radians( latitude ) ) * cos( radians( longitude ) - radians(:lng) ) + sin( radians(:lat) ) * sin( radians( latitude ) ) ) ) AS distance FROM tracker_live 
352
+				{
353
+						if (!is_string($interval))
354
+						{
355
+								//$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= tracker_live.date ';
356
+					return false;
357
+						} else {
358
+				if ($interval == '1m')
359
+				{
360
+					$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= tracker_live.date ';
361
+				} else if ($interval == '15m'){
362
+					$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 15 MINUTE) <= tracker_live.date ';
363
+				} 
364
+			}
365
+				} else {
366
+		 $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= tracker_live.date ';   
367
+		}
368
+
369
+				$query  = "SELECT tracker_live.*, ( 6371 * acos( cos( radians(:lat) ) * cos( radians( latitude ) ) * cos( radians( longitude ) - radians(:lng) ) + sin( radians(:lat) ) * sin( radians( latitude ) ) ) ) AS distance FROM tracker_live 
370 370
                    WHERE tracker_live.latitude <> '' 
371 371
                                    AND tracker_live.longitude <> '' 
372 372
                    ".$additional_query."
373 373
                    HAVING distance < :radius  
374 374
                                    ORDER BY distance";
375 375
 
376
-                $spotter_array = $Tracker->getDataFromDB($query, array(':lat' => $lat, ':lng' => $lng,':radius' => $radius));
376
+				$spotter_array = $Tracker->getDataFromDB($query, array(':lat' => $lat, ':lng' => $lng,':radius' => $radius));
377 377
 
378
-                return $spotter_array;
379
-        }
378
+				return $spotter_array;
379
+		}
380 380
 
381 381
     
382
-        /**
383
-	* Gets all the spotter information based on a particular callsign
384
-	*
385
-	* @return Array the spotter information
386
-	*
387
-	*/
382
+		/**
383
+		 * Gets all the spotter information based on a particular callsign
384
+		 *
385
+		 * @return Array the spotter information
386
+		 *
387
+		 */
388 388
 	public function getLastLiveTrackerDataByIdent($ident)
389 389
 	{
390 390
 		$Tracker = new Tracker($this->db);
391 391
 		date_default_timezone_set('UTC');
392 392
 
393 393
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
394
-                $query  = 'SELECT tracker_live.* FROM tracker_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_live l WHERE l.ident = :ident GROUP BY l.famtrackid) s on tracker_live.famtrackid = s.famtrackid AND tracker_live.date = s.maxdate ORDER BY tracker_live.date DESC';
394
+				$query  = 'SELECT tracker_live.* FROM tracker_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_live l WHERE l.ident = :ident GROUP BY l.famtrackid) s on tracker_live.famtrackid = s.famtrackid AND tracker_live.date = s.maxdate ORDER BY tracker_live.date DESC';
395 395
 
396 396
 		$spotter_array = $Tracker->getDataFromDB($query,array(':ident' => $ident),'',true);
397 397
 
398 398
 		return $spotter_array;
399 399
 	}
400 400
 
401
-        /**
402
-	* Gets all the spotter information based on a particular callsign
403
-	*
404
-	* @return Array the spotter information
405
-	*
406
-	*/
401
+		/**
402
+		 * Gets all the spotter information based on a particular callsign
403
+		 *
404
+		 * @return Array the spotter information
405
+		 *
406
+		 */
407 407
 	public function getDateLiveTrackerDataByIdent($ident,$date)
408 408
 	{
409 409
 		$Tracker = new Tracker($this->db);
410 410
 		date_default_timezone_set('UTC');
411 411
 
412 412
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
413
-                $query  = 'SELECT tracker_live.* FROM tracker_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_live l WHERE l.ident = :ident AND l.date <= :date GROUP BY l.famtrackid) s on tracker_live.famtrackid = s.famtrackid AND tracker_live.date = s.maxdate ORDER BY tracker_live.date DESC';
413
+				$query  = 'SELECT tracker_live.* FROM tracker_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_live l WHERE l.ident = :ident AND l.date <= :date GROUP BY l.famtrackid) s on tracker_live.famtrackid = s.famtrackid AND tracker_live.date = s.maxdate ORDER BY tracker_live.date DESC';
414 414
 
415
-                $date = date('c',$date);
415
+				$date = date('c',$date);
416 416
 		$spotter_array = $Tracker->getDataFromDB($query,array(':ident' => $ident,':date' => $date));
417 417
 
418 418
 		return $spotter_array;
419 419
 	}
420 420
 
421
-        /**
422
-	* Gets last spotter information based on a particular callsign
423
-	*
424
-	* @return Array the spotter information
425
-	*
426
-	*/
421
+		/**
422
+		 * Gets last spotter information based on a particular callsign
423
+		 *
424
+		 * @return Array the spotter information
425
+		 *
426
+		 */
427 427
 	public function getLastLiveTrackerDataById($id)
428 428
 	{
429 429
 		$Tracker = new Tracker($this->db);
430 430
 		date_default_timezone_set('UTC');
431 431
 
432 432
 		$id = filter_var($id, FILTER_SANITIZE_STRING);
433
-                $query  = 'SELECT tracker_live.* FROM tracker_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_live l WHERE l.famtrackid = :id GROUP BY l.famtrackid) s on tracker_live.famtrackid = s.famtrackid AND tracker_live.date = s.maxdate ORDER BY tracker_live.date DESC';
433
+				$query  = 'SELECT tracker_live.* FROM tracker_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_live l WHERE l.famtrackid = :id GROUP BY l.famtrackid) s on tracker_live.famtrackid = s.famtrackid AND tracker_live.date = s.maxdate ORDER BY tracker_live.date DESC';
434 434
 
435 435
 		$spotter_array = $Tracker->getDataFromDB($query,array(':id' => $id),'',true);
436 436
 
437 437
 		return $spotter_array;
438 438
 	}
439 439
 
440
-        /**
441
-	* Gets last spotter information based on a particular callsign
442
-	*
443
-	* @return Array the spotter information
444
-	*
445
-	*/
440
+		/**
441
+		 * Gets last spotter information based on a particular callsign
442
+		 *
443
+		 * @return Array the spotter information
444
+		 *
445
+		 */
446 446
 	public function getDateLiveTrackerDataById($id,$date)
447 447
 	{
448 448
 		$Tracker = new Tracker($this->db);
449 449
 		date_default_timezone_set('UTC');
450 450
 
451 451
 		$id = filter_var($id, FILTER_SANITIZE_STRING);
452
-                $query  = 'SELECT tracker_live.* FROM tracker_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_live l WHERE l.famtrackid = :id AND l.date <= :date GROUP BY l.famtrackid) s on tracker_live.famtrackid = s.famtrackid AND tracker_live.date = s.maxdate ORDER BY tracker_live.date DESC';
453
-                $date = date('c',$date);
452
+				$query  = 'SELECT tracker_live.* FROM tracker_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_live l WHERE l.famtrackid = :id AND l.date <= :date GROUP BY l.famtrackid) s on tracker_live.famtrackid = s.famtrackid AND tracker_live.date = s.maxdate ORDER BY tracker_live.date DESC';
453
+				$date = date('c',$date);
454 454
 		$spotter_array = $Tracker->getDataFromDB($query,array(':id' => $id,':date' => $date),'',true);
455 455
 
456 456
 		return $spotter_array;
457 457
 	}
458 458
 
459
-        /**
460
-	* Gets altitude information based on a particular callsign
461
-	*
462
-	* @return Array the spotter information
463
-	*
464
-	*/
459
+		/**
460
+		 * Gets altitude information based on a particular callsign
461
+		 *
462
+		 * @return Array the spotter information
463
+		 *
464
+		 */
465 465
 	public function getAltitudeLiveTrackerDataByIdent($ident)
466 466
 	{
467 467
 
468 468
 		date_default_timezone_set('UTC');
469 469
 
470 470
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
471
-                $query  = 'SELECT tracker_live.altitude, tracker_live.date FROM tracker_live WHERE tracker_live.ident = :ident';
471
+				$query  = 'SELECT tracker_live.altitude, tracker_live.date FROM tracker_live WHERE tracker_live.ident = :ident';
472 472
 
473
-    		try {
473
+			try {
474 474
 			
475 475
 			$sth = $this->db->prepare($query);
476 476
 			$sth->execute(array(':ident' => $ident));
@@ -483,12 +483,12 @@  discard block
 block discarded – undo
483 483
 		return $spotter_array;
484 484
 	}
485 485
 
486
-        /**
487
-	* Gets all the spotter information based on a particular id
488
-	*
489
-	* @return Array the spotter information
490
-	*
491
-	*/
486
+		/**
487
+		 * Gets all the spotter information based on a particular id
488
+		 *
489
+		 * @return Array the spotter information
490
+		 *
491
+		 */
492 492
 	public function getAllLiveTrackerDataById($id,$liveinterval = false)
493 493
 	{
494 494
 		global $globalDBdriver, $globalLiveInterval;
@@ -516,18 +516,18 @@  discard block
 block discarded – undo
516 516
 		return $spotter_array;
517 517
 	}
518 518
 
519
-        /**
520
-	* Gets all the spotter information based on a particular ident
521
-	*
522
-	* @return Array the spotter information
523
-	*
524
-	*/
519
+		/**
520
+		 * Gets all the spotter information based on a particular ident
521
+		 *
522
+		 * @return Array the spotter information
523
+		 *
524
+		 */
525 525
 	public function getAllLiveTrackerDataByIdent($ident)
526 526
 	{
527 527
 		date_default_timezone_set('UTC');
528 528
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
529 529
 		$query  = self::$global_query.' WHERE tracker_live.ident = :ident';
530
-    		try {
530
+			try {
531 531
 			
532 532
 			$sth = $this->db->prepare($query);
533 533
 			$sth->execute(array(':ident' => $ident));
@@ -541,23 +541,23 @@  discard block
 block discarded – undo
541 541
 
542 542
 
543 543
 	/**
544
-	* Deletes all info in the table
545
-	*
546
-	* @return String success or false
547
-	*
548
-	*/
544
+	 * Deletes all info in the table
545
+	 *
546
+	 * @return String success or false
547
+	 *
548
+	 */
549 549
 	public function deleteLiveTrackerData()
550 550
 	{
551 551
 		global $globalDBdriver;
552 552
 		if ($globalDBdriver == 'mysql') {
553 553
 			//$query  = "DELETE FROM tracker_live WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL 30 MINUTE) >= tracker_live.date";
554 554
 			$query  = 'DELETE FROM tracker_live WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL 9 HOUR) >= tracker_live.date';
555
-            		//$query  = "DELETE FROM tracker_live WHERE tracker_live.id IN (SELECT tracker_live.id FROM tracker_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_live l GROUP BY l.famtrackid) s on tracker_live.famtrackid = s.famtrackid AND tracker_live.date = s.maxdate AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 HOUR) >= tracker_live.date)";
555
+					//$query  = "DELETE FROM tracker_live WHERE tracker_live.id IN (SELECT tracker_live.id FROM tracker_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_live l GROUP BY l.famtrackid) s on tracker_live.famtrackid = s.famtrackid AND tracker_live.date = s.maxdate AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 HOUR) >= tracker_live.date)";
556 556
 		} else {
557 557
 			$query  = "DELETE FROM tracker_live WHERE NOW() AT TIME ZONE 'UTC' - INTERVAL '9 HOURS' >= tracker_live.date";
558 558
 		}
559 559
         
560
-    		try {
560
+			try {
561 561
 			
562 562
 			$sth = $this->db->prepare($query);
563 563
 			$sth->execute();
@@ -569,18 +569,18 @@  discard block
 block discarded – undo
569 569
 	}
570 570
 
571 571
 	/**
572
-	* Deletes all info in the table for aircraft not seen since 2 HOUR
573
-	*
574
-	* @return String success or false
575
-	*
576
-	*/
572
+	 * Deletes all info in the table for aircraft not seen since 2 HOUR
573
+	 *
574
+	 * @return String success or false
575
+	 *
576
+	 */
577 577
 	public function deleteLiveTrackerDataNotUpdated()
578 578
 	{
579 579
 		global $globalDBdriver, $globalDebug;
580 580
 		if ($globalDBdriver == 'mysql') {
581 581
 			//$query = 'SELECT famtrackid FROM tracker_live WHERE DATE_SUB(UTC_TIMESTAMP(), INTERVAL 1 HOUR) >= tracker_live.date AND tracker_live.famtrackid NOT IN (SELECT famtrackid FROM tracker_live WHERE DATE_SUB(UTC_TIMESTAMP(), INTERVAL 1 HOUR) < tracker_live.date) LIMIT 800 OFFSET 0';
582
-    			$query = "SELECT tracker_live.famtrackid FROM tracker_live INNER JOIN (SELECT famtrackid,MAX(date) as max_date FROM tracker_live GROUP BY famtrackid) s ON s.famtrackid = tracker_live.famtrackid AND DATE_SUB(UTC_TIMESTAMP(), INTERVAL 2 HOUR) >= s.max_date LIMIT 1200 OFFSET 0";
583
-    			try {
582
+				$query = "SELECT tracker_live.famtrackid FROM tracker_live INNER JOIN (SELECT famtrackid,MAX(date) as max_date FROM tracker_live GROUP BY famtrackid) s ON s.famtrackid = tracker_live.famtrackid AND DATE_SUB(UTC_TIMESTAMP(), INTERVAL 2 HOUR) >= s.max_date LIMIT 1200 OFFSET 0";
583
+				try {
584 584
 				
585 585
 				$sth = $this->db->prepare($query);
586 586
 				$sth->execute();
@@ -588,8 +588,8 @@  discard block
 block discarded – undo
588 588
 				return "error";
589 589
 			}
590 590
 			$query_delete = 'DELETE FROM tracker_live WHERE famtrackid IN (';
591
-                        $i = 0;
592
-                        $j =0;
591
+						$i = 0;
592
+						$j =0;
593 593
 			$all = $sth->fetchAll(PDO::FETCH_ASSOC);
594 594
 			foreach($all as $row)
595 595
 			{
@@ -597,20 +597,20 @@  discard block
 block discarded – undo
597 597
 				$j++;
598 598
 				if ($j == 30) {
599 599
 					if ($globalDebug) echo ".";
600
-				    	try {
600
+						try {
601 601
 						
602 602
 						$sth = $this->db->prepare(substr($query_delete,0,-1).")");
603 603
 						$sth->execute();
604 604
 					} catch(PDOException $e) {
605 605
 						return "error";
606 606
 					}
607
-                                	$query_delete = 'DELETE FROM tracker_live WHERE famtrackid IN (';
608
-                                	$j = 0;
607
+									$query_delete = 'DELETE FROM tracker_live WHERE famtrackid IN (';
608
+									$j = 0;
609 609
 				}
610 610
 				$query_delete .= "'".$row['famtrackid']."',";
611 611
 			}
612 612
 			if ($i > 0) {
613
-    				try {
613
+					try {
614 614
 					
615 615
 					$sth = $this->db->prepare(substr($query_delete,0,-1).")");
616 616
 					$sth->execute();
@@ -621,9 +621,9 @@  discard block
 block discarded – undo
621 621
 			return "success";
622 622
 		} elseif ($globalDBdriver == 'pgsql') {
623 623
 			//$query = "SELECT famtrackid FROM tracker_live WHERE NOW() AT TIME ZONE 'UTC' - INTERVAL '9 HOURS' >= tracker_live.date AND tracker_live.famtrackid NOT IN (SELECT famtrackid FROM tracker_live WHERE NOW() AT TIME ZONE 'UTC' - INTERVAL '9 HOURS' < tracker_live.date) LIMIT 800 OFFSET 0";
624
-    			//$query = "SELECT tracker_live.famtrackid FROM tracker_live INNER JOIN (SELECT famtrackid,MAX(date) as max_date FROM tracker_live GROUP BY famtrackid) s ON s.famtrackid = tracker_live.famtrackid AND NOW() AT TIME ZONE 'UTC' - INTERVAL '2 HOURS' >= s.max_date LIMIT 800 OFFSET 0";
625
-    			$query = "DELETE FROM tracker_live WHERE famtrackid IN (SELECT tracker_live.famtrackid FROM tracker_live INNER JOIN (SELECT famtrackid,MAX(date) as max_date FROM tracker_live GROUP BY famtrackid) s ON s.famtrackid = tracker_live.famtrackid AND NOW() AT TIME ZONE 'UTC' - INTERVAL '2 HOURS' >= s.max_date LIMIT 800 OFFSET 0)";
626
-    			try {
624
+				//$query = "SELECT tracker_live.famtrackid FROM tracker_live INNER JOIN (SELECT famtrackid,MAX(date) as max_date FROM tracker_live GROUP BY famtrackid) s ON s.famtrackid = tracker_live.famtrackid AND NOW() AT TIME ZONE 'UTC' - INTERVAL '2 HOURS' >= s.max_date LIMIT 800 OFFSET 0";
625
+				$query = "DELETE FROM tracker_live WHERE famtrackid IN (SELECT tracker_live.famtrackid FROM tracker_live INNER JOIN (SELECT famtrackid,MAX(date) as max_date FROM tracker_live GROUP BY famtrackid) s ON s.famtrackid = tracker_live.famtrackid AND NOW() AT TIME ZONE 'UTC' - INTERVAL '2 HOURS' >= s.max_date LIMIT 800 OFFSET 0)";
626
+				try {
627 627
 				
628 628
 				$sth = $this->db->prepare($query);
629 629
 				$sth->execute();
@@ -667,17 +667,17 @@  discard block
 block discarded – undo
667 667
 	}
668 668
 
669 669
 	/**
670
-	* Deletes all info in the table for an ident
671
-	*
672
-	* @return String success or false
673
-	*
674
-	*/
670
+	 * Deletes all info in the table for an ident
671
+	 *
672
+	 * @return String success or false
673
+	 *
674
+	 */
675 675
 	public function deleteLiveTrackerDataByIdent($ident)
676 676
 	{
677 677
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
678 678
 		$query  = 'DELETE FROM tracker_live WHERE ident = :ident';
679 679
         
680
-    		try {
680
+			try {
681 681
 			
682 682
 			$sth = $this->db->prepare($query);
683 683
 			$sth->execute(array(':ident' => $ident));
@@ -689,17 +689,17 @@  discard block
 block discarded – undo
689 689
 	}
690 690
 
691 691
 	/**
692
-	* Deletes all info in the table for an id
693
-	*
694
-	* @return String success or false
695
-	*
696
-	*/
692
+	 * Deletes all info in the table for an id
693
+	 *
694
+	 * @return String success or false
695
+	 *
696
+	 */
697 697
 	public function deleteLiveTrackerDataById($id)
698 698
 	{
699 699
 		$id = filter_var($id, FILTER_SANITIZE_STRING);
700 700
 		$query  = 'DELETE FROM tracker_live WHERE famtrackid = :id';
701 701
         
702
-    		try {
702
+			try {
703 703
 			
704 704
 			$sth = $this->db->prepare($query);
705 705
 			$sth->execute(array(':id' => $id));
@@ -712,11 +712,11 @@  discard block
 block discarded – undo
712 712
 
713 713
 
714 714
 	/**
715
-	* Gets the aircraft ident within the last hour
716
-	*
717
-	* @return String the ident
718
-	*
719
-	*/
715
+	 * Gets the aircraft ident within the last hour
716
+	 *
717
+	 * @return String the ident
718
+	 *
719
+	 */
720 720
 	public function getIdentFromLastHour($ident)
721 721
 	{
722 722
 		global $globalDBdriver, $globalTimezone;
@@ -742,14 +742,14 @@  discard block
 block discarded – undo
742 742
 			$ident_result = $row['ident'];
743 743
 		}
744 744
 		return $ident_result;
745
-        }
745
+		}
746 746
 
747 747
 	/**
748
-	* Check recent aircraft
749
-	*
750
-	* @return String the ident
751
-	*
752
-	*/
748
+	 * Check recent aircraft
749
+	 *
750
+	 * @return String the ident
751
+	 *
752
+	 */
753 753
 	public function checkIdentRecent($ident)
754 754
 	{
755 755
 		global $globalDBdriver, $globalTimezone;
@@ -775,14 +775,14 @@  discard block
 block discarded – undo
775 775
 			$ident_result = $row['famtrackid'];
776 776
 		}
777 777
 		return $ident_result;
778
-        }
778
+		}
779 779
 
780 780
 	/**
781
-	* Check recent aircraft by id
782
-	*
783
-	* @return String the ident
784
-	*
785
-	*/
781
+	 * Check recent aircraft by id
782
+	 *
783
+	 * @return String the ident
784
+	 *
785
+	 */
786 786
 	public function checkIdRecent($id)
787 787
 	{
788 788
 		global $globalDBdriver, $globalTimezone;
@@ -808,19 +808,19 @@  discard block
 block discarded – undo
808 808
 			$ident_result = $row['famtrackid'];
809 809
 		}
810 810
 		return $ident_result;
811
-        }
811
+		}
812 812
 
813 813
 	/**
814
-	* Adds a new spotter data
815
-	*
816
-	* @param String $famtrackid the ID from flightaware
817
-	* @param String $ident the flight ident
818
-	* @param String $aircraft_icao the aircraft type
819
-	* @param String $departure_airport_icao the departure airport
820
-	* @param String $arrival_airport_icao the arrival airport
821
-	* @return String success or false
822
-	*
823
-	*/
814
+	 * Adds a new spotter data
815
+	 *
816
+	 * @param String $famtrackid the ID from flightaware
817
+	 * @param String $ident the flight ident
818
+	 * @param String $aircraft_icao the aircraft type
819
+	 * @param String $departure_airport_icao the departure airport
820
+	 * @param String $arrival_airport_icao the arrival airport
821
+	 * @return String success or false
822
+	 *
823
+	 */
824 824
 	public function addLiveTrackerData($famtrackid = '', $ident = '', $latitude = '', $longitude = '', $altitude = '', $heading = '', $groundspeed = '', $date = '', $putinarchive = false, $comment = '', $type = '',$noarchive = false,$format_source = '', $source_name = '', $over_country = '')
825 825
 	{
826 826
 		global $globalURL, $globalArchive, $globalDebug;
@@ -893,8 +893,8 @@  discard block
 block discarded – undo
893 893
 		$comment = filter_var($comment,FILTER_SANITIZE_STRING);
894 894
 		$type = filter_var($type,FILTER_SANITIZE_STRING);
895 895
 
896
-            	if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) $groundspeed = 0;
897
-            	if ($heading == '' || $Common->isInteger($heading) === false ) $heading = 0;
896
+				if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) $groundspeed = 0;
897
+				if ($heading == '' || $Common->isInteger($heading) === false ) $heading = 0;
898 898
             	
899 899
 		$query = '';
900 900
 		if ($globalArchive) {
@@ -909,18 +909,18 @@  discard block
 block discarded – undo
909 909
 			
910 910
 			$sth = $this->db->prepare($query);
911 911
 			$sth->execute($query_values);
912
-                } catch(PDOException $e) {
913
-                	return "error : ".$e->getMessage();
914
-                }
915
-                /*
912
+				} catch(PDOException $e) {
913
+					return "error : ".$e->getMessage();
914
+				}
915
+				/*
916 916
                 echo 'putinarchive : '.$putinarchive."\n";
917 917
                 echo 'noarchive : '.$noarchive."\n";
918 918
                 */
919 919
 		if (isset($globalArchive) && $globalArchive && $putinarchive && $noarchive !== true) {
920
-		    if ($globalDebug) echo '(Add to Tracker archive '.$famtrackid.' : ';
921
-		    $TrackerArchive = new TrackerArchive($this->db);
922
-		    $result =  $TrackerArchive->addTrackerArchiveData($famtrackid, $ident,$latitude, $longitude, $altitude, $heading, $groundspeed, $date, $putinarchive, $comment, $type,$noarchive,$format_source, $source_name, $over_country);
923
-		    if ($globalDebug) echo $result.')';
920
+			if ($globalDebug) echo '(Add to Tracker archive '.$famtrackid.' : ';
921
+			$TrackerArchive = new TrackerArchive($this->db);
922
+			$result =  $TrackerArchive->addTrackerArchiveData($famtrackid, $ident,$latitude, $longitude, $altitude, $heading, $groundspeed, $date, $putinarchive, $comment, $type,$noarchive,$format_source, $source_name, $over_country);
923
+			if ($globalDebug) echo $result.')';
924 924
 		}
925 925
 
926 926
 		return "success";
Please login to merge, or discard this patch.
Spacing   +99 added lines, -99 removed lines patch added patch discarded remove patch
@@ -16,33 +16,33 @@  discard block
 block discarded – undo
16 16
 	* @param Array $filter the filter
17 17
 	* @return Array the SQL part
18 18
 	*/
19
-	public function getFilter($filter = array(),$where = false,$and = false) {
19
+	public function getFilter($filter = array(), $where = false, $and = false) {
20 20
 		global $globalFilter, $globalStatsFilters, $globalFilterName, $globalDBdriver;
21 21
 		$filters = array();
22 22
 		if (is_array($globalStatsFilters) && isset($globalStatsFilters[$globalFilterName])) {
23 23
 			if (isset($globalStatsFilters[$globalFilterName][0]['source'])) {
24 24
 				$filters = $globalStatsFilters[$globalFilterName];
25 25
 			} else {
26
-				$filter = array_merge($filter,$globalStatsFilters[$globalFilterName]);
26
+				$filter = array_merge($filter, $globalStatsFilters[$globalFilterName]);
27 27
 			}
28 28
 		}
29 29
 		if (isset($filter[0]['source'])) {
30
-			$filters = array_merge($filters,$filter);
30
+			$filters = array_merge($filters, $filter);
31 31
 		}
32
-		if (is_array($globalFilter)) $filter = array_merge($filter,$globalFilter);
32
+		if (is_array($globalFilter)) $filter = array_merge($filter, $globalFilter);
33 33
 		$filter_query_join = '';
34 34
 		$filter_query_where = '';
35
-		foreach($filters as $flt) {
35
+		foreach ($filters as $flt) {
36 36
 			if (isset($flt['idents']) && !empty($flt['idents'])) {
37 37
 				if (isset($flt['source'])) {
38
-					$filter_query_join .= " INNER JOIN (SELECT famtrackid FROM tracker_output WHERE tracker_output.ident IN ('".implode("','",$flt['idents'])."') AND tracker_output.format_source IN ('".implode("','",$flt['source'])."')) spid ON spid.famtrackid = tracker_live.famtrackid";
38
+					$filter_query_join .= " INNER JOIN (SELECT famtrackid FROM tracker_output WHERE tracker_output.ident IN ('".implode("','", $flt['idents'])."') AND tracker_output.format_source IN ('".implode("','", $flt['source'])."')) spid ON spid.famtrackid = tracker_live.famtrackid";
39 39
 				} else {
40
-					$filter_query_join .= " INNER JOIN (SELECT famtrackid FROM tracker_output WHERE tracker_output.ident IN ('".implode("','",$flt['idents'])."')) spid ON spid.famtrackid = tracker_live.famtrackid";
40
+					$filter_query_join .= " INNER JOIN (SELECT famtrackid FROM tracker_output WHERE tracker_output.ident IN ('".implode("','", $flt['idents'])."')) spid ON spid.famtrackid = tracker_live.famtrackid";
41 41
 				}
42 42
 			}
43 43
 		}
44 44
 		if (isset($filter['source']) && !empty($filter['source'])) {
45
-			$filter_query_where .= " AND format_source IN ('".implode("','",$filter['source'])."')";
45
+			$filter_query_where .= " AND format_source IN ('".implode("','", $filter['source'])."')";
46 46
 		}
47 47
 		if (isset($filter['ident']) && !empty($filter['ident'])) {
48 48
 			$filter_query_where .= " AND ident = '".$filter['ident']."'";
@@ -71,15 +71,15 @@  discard block
 block discarded – undo
71 71
 					$filter_query_date .= " AND EXTRACT(DAY FROM tracker_output.date) = '".$filter['day']."'";
72 72
 				}
73 73
 			}
74
-			$filter_query_join .= " INNER JOIN (SELECT famtrackid FROM tracker_output".preg_replace('/^ AND/',' WHERE',$filter_query_date).") sd ON sd.famtrackid = tracker_live.famtrackid";
74
+			$filter_query_join .= " INNER JOIN (SELECT famtrackid FROM tracker_output".preg_replace('/^ AND/', ' WHERE', $filter_query_date).") sd ON sd.famtrackid = tracker_live.famtrackid";
75 75
 		}
76 76
 		if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) {
77
-			$filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')";
77
+			$filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','", $filter['source_aprs'])."')";
78 78
 		}
79 79
 		if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE';
80 80
 		elseif ($filter_query_where != '' && $and) $filter_query_where .= ' AND';
81 81
 		if ($filter_query_where != '') {
82
-			$filter_query_where = preg_replace('/^ AND/',' WHERE',$filter_query_where);
82
+			$filter_query_where = preg_replace('/^ AND/', ' WHERE', $filter_query_where);
83 83
 		}
84 84
 		$filter_query = $filter_query_join.$filter_query_where;
85 85
 		return $filter_query;
@@ -102,8 +102,8 @@  discard block
 block discarded – undo
102 102
 		if ($limit != '')
103 103
 		{
104 104
 			$limit_array = explode(',', $limit);
105
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
106
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
105
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
106
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
107 107
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
108 108
 			{
109 109
 				$limit_query = ' LIMIT '.$limit_array[1].' OFFSET '.$limit_array[0];
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
 		} else {
127 127
 			$query  = "SELECT tracker_live.* FROM tracker_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_live l WHERE CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= l.date GROUP BY l.famtrackid) s on tracker_live.famtrackid = s.famtrackid AND tracker_live.date = s.maxdate".$filter_query.$orderby_query;
128 128
 		}
129
-		$spotter_array = $Tracker->getDataFromDB($query.$limit_query,array(),'',true);
129
+		$spotter_array = $Tracker->getDataFromDB($query.$limit_query, array(), '', true);
130 130
 
131 131
 		return $spotter_array;
132 132
 	}
@@ -142,7 +142,7 @@  discard block
 block discarded – undo
142 142
 		global $globalDBdriver, $globalLiveInterval;
143 143
 		date_default_timezone_set('UTC');
144 144
 
145
-		$filter_query = $this->getFilter($filter,true,true);
145
+		$filter_query = $this->getFilter($filter, true, true);
146 146
 
147 147
 		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
148 148
 		if ($globalDBdriver == 'mysql') {
@@ -160,7 +160,7 @@  discard block
 block discarded – undo
160 160
 		try {
161 161
 			$sth = $this->db->prepare($query);
162 162
 			$sth->execute();
163
-		} catch(PDOException $e) {
163
+		} catch (PDOException $e) {
164 164
 			echo $e->getMessage();
165 165
 			die;
166 166
 		}
@@ -180,12 +180,12 @@  discard block
 block discarded – undo
180 180
 		global $globalDBdriver, $globalLiveInterval, $globalArchive;
181 181
 		date_default_timezone_set('UTC');
182 182
 
183
-		$filter_query = $this->getFilter($filter,true,true);
183
+		$filter_query = $this->getFilter($filter, true, true);
184 184
 
185 185
 		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
186 186
 		if ($globalDBdriver == 'mysql') {
187 187
 			if (isset($globalArchive) && $globalArchive) {
188
-				$query  = "SELECT * FROM (
188
+				$query = "SELECT * FROM (
189 189
 					SELECT tracker_archive.ident, tracker_archive.famtrackid,tracker_archive.type,tracker_archive.latitude, tracker_archive.longitude, tracker_archive.altitude, tracker_archive.heading, tracker_archive.ground_speed, tracker_archive.date, tracker_archive.format_source 
190 190
 					FROM tracker_archive INNER JOIN (SELECT famtrackid FROM tracker_live".$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval." SECOND) <= tracker_live.date) l ON l.famtrackid = tracker_archive.famtrackid 
191 191
 				    UNION
@@ -195,14 +195,14 @@  discard block
 block discarded – undo
195 195
 				    WHERE latitude <> '0' AND longitude <> '0' 
196 196
 				    ORDER BY famtrackid, date";
197 197
 			} else {
198
-				$query  = 'SELECT tracker_live.ident, tracker_live.famtrackid,tracker_live.type, tracker_live.latitude, tracker_live.longitude, tracker_live.altitude, tracker_live.heading, tracker_live.ground_speed, tracker_live.date, tracker_live.format_source 
198
+				$query = 'SELECT tracker_live.ident, tracker_live.famtrackid,tracker_live.type, tracker_live.latitude, tracker_live.longitude, tracker_live.altitude, tracker_live.heading, tracker_live.ground_speed, tracker_live.date, tracker_live.format_source 
199 199
 				    FROM tracker_live'.$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval." SECOND) <= tracker_live.date 
200 200
 				    AND tracker_live.latitude <> '0' AND tracker_live.longitude <> '0' 
201 201
 				    ORDER BY tracker_live.famtrackid, tracker_live.date";
202 202
 			}
203 203
 		} else {
204 204
 			if (isset($globalArchive) && $globalArchive) {
205
-				$query  = "SELECT * FROM (
205
+				$query = "SELECT * FROM (
206 206
 					SELECT tracker_archive.ident, tracker_archive.famtrackid,tracker_archive.type,tracker_archive.latitude, tracker_archive.longitude, tracker_archive.altitude, tracker_archive.heading, tracker_archive.ground_speed, tracker_archive.date, tracker_archive.format_source 
207 207
 					FROM tracker_archive INNER JOIN (SELECT famtrackid FROM tracker_live".$filter_query." CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= tracker_live.date) l ON l.famtrackid = tracker_archive.famtrackid 
208 208
 				    UNION
@@ -212,7 +212,7 @@  discard block
 block discarded – undo
212 212
 				    WHERE latitude <> '0' AND longitude <> '0' 
213 213
 				    ORDER BY famtrackid, date";
214 214
 			} else {
215
-				$query  = "SELECT tracker_live.ident, tracker_live.famtrackid, tracker_live.type,tracker_live.latitude, tracker_live.longitude, tracker_live.altitude, tracker_live.heading, tracker_live.ground_speed, tracker_live.date, tracker_live.format_source 
215
+				$query = "SELECT tracker_live.ident, tracker_live.famtrackid, tracker_live.type,tracker_live.latitude, tracker_live.longitude, tracker_live.altitude, tracker_live.heading, tracker_live.ground_speed, tracker_live.date, tracker_live.format_source 
216 216
 				    FROM tracker_live".$filter_query." CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= tracker_live.date AND tracker_live.latitude <> '0' AND tracker_live.longitude <> '0' 
217 217
 				    ORDER BY tracker_live.famtrackid, tracker_live.date";
218 218
 			}
@@ -221,7 +221,7 @@  discard block
 block discarded – undo
221 221
 		try {
222 222
 			$sth = $this->db->prepare($query);
223 223
 			$sth->execute();
224
-		} catch(PDOException $e) {
224
+		} catch (PDOException $e) {
225 225
 			echo $e->getMessage();
226 226
 			die;
227 227
 		}
@@ -238,7 +238,7 @@  discard block
 block discarded – undo
238 238
 	public function getLiveTrackerCount($filter = array())
239 239
 	{
240 240
 		global $globalDBdriver, $globalLiveInterval;
241
-		$filter_query = $this->getFilter($filter,true,true);
241
+		$filter_query = $this->getFilter($filter, true, true);
242 242
 
243 243
 		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
244 244
 		if ($globalDBdriver == 'mysql') {
@@ -249,7 +249,7 @@  discard block
 block discarded – undo
249 249
 		try {
250 250
 			$sth = $this->db->prepare($query);
251 251
 			$sth->execute();
252
-		} catch(PDOException $e) {
252
+		} catch (PDOException $e) {
253 253
 			echo $e->getMessage();
254 254
 			die;
255 255
 		}
@@ -272,10 +272,10 @@  discard block
 block discarded – undo
272 272
 		$filter_query = $this->getFilter($filter);
273 273
 
274 274
 		if (is_array($coord)) {
275
-			$minlong = filter_var($coord[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
276
-			$minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
277
-			$maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
278
-			$maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
275
+			$minlong = filter_var($coord[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
276
+			$minlat = filter_var($coord[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
277
+			$maxlong = filter_var($coord[2], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
278
+			$maxlat = filter_var($coord[3], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
279 279
 		} else return array();
280 280
 		if ($globalDBdriver == 'mysql') {
281 281
 			$query  = 'SELECT tracker_live.* FROM tracker_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.famtrackid) s on tracker_live.famtrackid = s.famtrackid AND tracker_live.date = s.maxdate AND tracker_live.latitude BETWEEN '.$minlat.' AND '.$maxlat.' AND tracker_live.longitude BETWEEN '.$minlong.' AND '.$maxlong.' GROUP BY tracker_live.famtrackid'.$filter_query;
@@ -300,17 +300,17 @@  discard block
 block discarded – undo
300 300
 		$filter_query = $this->getFilter($filter);
301 301
 
302 302
 		if (is_array($coord)) {
303
-			$minlong = filter_var($coord[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
304
-			$minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
305
-			$maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
306
-			$maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
303
+			$minlong = filter_var($coord[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
304
+			$minlat = filter_var($coord[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
305
+			$maxlong = filter_var($coord[2], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
306
+			$maxlat = filter_var($coord[3], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
307 307
 		} else return array();
308 308
 		if ($globalDBdriver == 'mysql') {
309 309
 			$query  = 'SELECT tracker_live.ident, tracker_live.famtrackid,tracker_live.type, tracker_live.latitude, tracker_live.longitude, tracker_live.altitude, tracker_live.heading, tracker_live.ground_speed, tracker_live.date, tracker_live.format_source 
310 310
 			FROM tracker_live'.$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval." SECOND) <= tracker_live.date AND tracker_live.latitude <> '0' AND tracker_live.longitude <> '0' AND tracker_live.latitude BETWEEN ".$minlat.' AND '.$maxlat.' AND tracker_live.longitude BETWEEN '.$minlong.' AND '.$maxlong."
311 311
 			ORDER BY tracker_live.famtrackid, tracker_live.date";
312 312
 		} else {
313
-			$query  = "SELECT tracker_live.ident, tracker_live.type,tracker_live.famtrackid, tracker_live.latitude, tracker_live.longitude, tracker_live.altitude, tracker_live.heading, tracker_live.ground_speed, tracker_live.date, tracker_live.format_source 
313
+			$query = "SELECT tracker_live.ident, tracker_live.type,tracker_live.famtrackid, tracker_live.latitude, tracker_live.longitude, tracker_live.altitude, tracker_live.heading, tracker_live.ground_speed, tracker_live.date, tracker_live.format_source 
314 314
 			FROM tracker_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_live l WHERE CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= l.date l.latitude BETWEEN ".$minlat." AND ".$maxlat." AND l.longitude BETWEEN ".$minlong." AND ".$maxlong." GROUP BY l.famtrackid) s on tracker_live.famtrackid = s.famtrackid AND tracker_live.date = s.maxdate".$filter_query." tracker_live.latitude <> '0' AND tracker_live.longitude <> '0'";
315 315
 		}
316 316
 		$spotter_array = $Spotter->getDataFromDB($query);
@@ -358,7 +358,7 @@  discard block
 block discarded – undo
358 358
                 if ($interval == '1m')
359 359
                 {
360 360
                     $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= tracker_live.date ';
361
-                } else if ($interval == '15m'){
361
+                } else if ($interval == '15m') {
362 362
                     $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 15 MINUTE) <= tracker_live.date ';
363 363
                 } 
364 364
             }
@@ -366,14 +366,14 @@  discard block
 block discarded – undo
366 366
          $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= tracker_live.date ';   
367 367
         }
368 368
 
369
-                $query  = "SELECT tracker_live.*, ( 6371 * acos( cos( radians(:lat) ) * cos( radians( latitude ) ) * cos( radians( longitude ) - radians(:lng) ) + sin( radians(:lat) ) * sin( radians( latitude ) ) ) ) AS distance FROM tracker_live 
369
+                $query = "SELECT tracker_live.*, ( 6371 * acos( cos( radians(:lat) ) * cos( radians( latitude ) ) * cos( radians( longitude ) - radians(:lng) ) + sin( radians(:lat) ) * sin( radians( latitude ) ) ) ) AS distance FROM tracker_live 
370 370
                    WHERE tracker_live.latitude <> '' 
371 371
                                    AND tracker_live.longitude <> '' 
372 372
                    ".$additional_query."
373 373
                    HAVING distance < :radius  
374 374
                                    ORDER BY distance";
375 375
 
376
-                $spotter_array = $Tracker->getDataFromDB($query, array(':lat' => $lat, ':lng' => $lng,':radius' => $radius));
376
+                $spotter_array = $Tracker->getDataFromDB($query, array(':lat' => $lat, ':lng' => $lng, ':radius' => $radius));
377 377
 
378 378
                 return $spotter_array;
379 379
         }
@@ -391,9 +391,9 @@  discard block
 block discarded – undo
391 391
 		date_default_timezone_set('UTC');
392 392
 
393 393
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
394
-                $query  = 'SELECT tracker_live.* FROM tracker_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_live l WHERE l.ident = :ident GROUP BY l.famtrackid) s on tracker_live.famtrackid = s.famtrackid AND tracker_live.date = s.maxdate ORDER BY tracker_live.date DESC';
394
+                $query = 'SELECT tracker_live.* FROM tracker_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_live l WHERE l.ident = :ident GROUP BY l.famtrackid) s on tracker_live.famtrackid = s.famtrackid AND tracker_live.date = s.maxdate ORDER BY tracker_live.date DESC';
395 395
 
396
-		$spotter_array = $Tracker->getDataFromDB($query,array(':ident' => $ident),'',true);
396
+		$spotter_array = $Tracker->getDataFromDB($query, array(':ident' => $ident), '', true);
397 397
 
398 398
 		return $spotter_array;
399 399
 	}
@@ -404,16 +404,16 @@  discard block
 block discarded – undo
404 404
 	* @return Array the spotter information
405 405
 	*
406 406
 	*/
407
-	public function getDateLiveTrackerDataByIdent($ident,$date)
407
+	public function getDateLiveTrackerDataByIdent($ident, $date)
408 408
 	{
409 409
 		$Tracker = new Tracker($this->db);
410 410
 		date_default_timezone_set('UTC');
411 411
 
412 412
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
413
-                $query  = 'SELECT tracker_live.* FROM tracker_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_live l WHERE l.ident = :ident AND l.date <= :date GROUP BY l.famtrackid) s on tracker_live.famtrackid = s.famtrackid AND tracker_live.date = s.maxdate ORDER BY tracker_live.date DESC';
413
+                $query = 'SELECT tracker_live.* FROM tracker_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_live l WHERE l.ident = :ident AND l.date <= :date GROUP BY l.famtrackid) s on tracker_live.famtrackid = s.famtrackid AND tracker_live.date = s.maxdate ORDER BY tracker_live.date DESC';
414 414
 
415
-                $date = date('c',$date);
416
-		$spotter_array = $Tracker->getDataFromDB($query,array(':ident' => $ident,':date' => $date));
415
+                $date = date('c', $date);
416
+		$spotter_array = $Tracker->getDataFromDB($query, array(':ident' => $ident, ':date' => $date));
417 417
 
418 418
 		return $spotter_array;
419 419
 	}
@@ -430,9 +430,9 @@  discard block
 block discarded – undo
430 430
 		date_default_timezone_set('UTC');
431 431
 
432 432
 		$id = filter_var($id, FILTER_SANITIZE_STRING);
433
-                $query  = 'SELECT tracker_live.* FROM tracker_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_live l WHERE l.famtrackid = :id GROUP BY l.famtrackid) s on tracker_live.famtrackid = s.famtrackid AND tracker_live.date = s.maxdate ORDER BY tracker_live.date DESC';
433
+                $query = 'SELECT tracker_live.* FROM tracker_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_live l WHERE l.famtrackid = :id GROUP BY l.famtrackid) s on tracker_live.famtrackid = s.famtrackid AND tracker_live.date = s.maxdate ORDER BY tracker_live.date DESC';
434 434
 
435
-		$spotter_array = $Tracker->getDataFromDB($query,array(':id' => $id),'',true);
435
+		$spotter_array = $Tracker->getDataFromDB($query, array(':id' => $id), '', true);
436 436
 
437 437
 		return $spotter_array;
438 438
 	}
@@ -443,15 +443,15 @@  discard block
 block discarded – undo
443 443
 	* @return Array the spotter information
444 444
 	*
445 445
 	*/
446
-	public function getDateLiveTrackerDataById($id,$date)
446
+	public function getDateLiveTrackerDataById($id, $date)
447 447
 	{
448 448
 		$Tracker = new Tracker($this->db);
449 449
 		date_default_timezone_set('UTC');
450 450
 
451 451
 		$id = filter_var($id, FILTER_SANITIZE_STRING);
452
-                $query  = 'SELECT tracker_live.* FROM tracker_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_live l WHERE l.famtrackid = :id AND l.date <= :date GROUP BY l.famtrackid) s on tracker_live.famtrackid = s.famtrackid AND tracker_live.date = s.maxdate ORDER BY tracker_live.date DESC';
453
-                $date = date('c',$date);
454
-		$spotter_array = $Tracker->getDataFromDB($query,array(':id' => $id,':date' => $date),'',true);
452
+                $query = 'SELECT tracker_live.* FROM tracker_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_live l WHERE l.famtrackid = :id AND l.date <= :date GROUP BY l.famtrackid) s on tracker_live.famtrackid = s.famtrackid AND tracker_live.date = s.maxdate ORDER BY tracker_live.date DESC';
453
+                $date = date('c', $date);
454
+		$spotter_array = $Tracker->getDataFromDB($query, array(':id' => $id, ':date' => $date), '', true);
455 455
 
456 456
 		return $spotter_array;
457 457
 	}
@@ -468,13 +468,13 @@  discard block
 block discarded – undo
468 468
 		date_default_timezone_set('UTC');
469 469
 
470 470
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
471
-                $query  = 'SELECT tracker_live.altitude, tracker_live.date FROM tracker_live WHERE tracker_live.ident = :ident';
471
+                $query = 'SELECT tracker_live.altitude, tracker_live.date FROM tracker_live WHERE tracker_live.ident = :ident';
472 472
 
473 473
     		try {
474 474
 			
475 475
 			$sth = $this->db->prepare($query);
476 476
 			$sth->execute(array(':ident' => $ident));
477
-		} catch(PDOException $e) {
477
+		} catch (PDOException $e) {
478 478
 			echo $e->getMessage();
479 479
 			die;
480 480
 		}
@@ -489,7 +489,7 @@  discard block
 block discarded – undo
489 489
 	* @return Array the spotter information
490 490
 	*
491 491
 	*/
492
-	public function getAllLiveTrackerDataById($id,$liveinterval = false)
492
+	public function getAllLiveTrackerDataById($id, $liveinterval = false)
493 493
 	{
494 494
 		global $globalDBdriver, $globalLiveInterval;
495 495
 		date_default_timezone_set('UTC');
@@ -508,7 +508,7 @@  discard block
 block discarded – undo
508 508
 		try {
509 509
 			$sth = $this->db->prepare($query);
510 510
 			$sth->execute(array(':id' => $id));
511
-		} catch(PDOException $e) {
511
+		} catch (PDOException $e) {
512 512
 			echo $e->getMessage();
513 513
 			die;
514 514
 		}
@@ -526,12 +526,12 @@  discard block
 block discarded – undo
526 526
 	{
527 527
 		date_default_timezone_set('UTC');
528 528
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
529
-		$query  = self::$global_query.' WHERE tracker_live.ident = :ident';
529
+		$query = self::$global_query.' WHERE tracker_live.ident = :ident';
530 530
     		try {
531 531
 			
532 532
 			$sth = $this->db->prepare($query);
533 533
 			$sth->execute(array(':ident' => $ident));
534
-		} catch(PDOException $e) {
534
+		} catch (PDOException $e) {
535 535
 			echo $e->getMessage();
536 536
 			die;
537 537
 		}
@@ -561,7 +561,7 @@  discard block
 block discarded – undo
561 561
 			
562 562
 			$sth = $this->db->prepare($query);
563 563
 			$sth->execute();
564
-		} catch(PDOException $e) {
564
+		} catch (PDOException $e) {
565 565
 			return "error";
566 566
 		}
567 567
 
@@ -584,14 +584,14 @@  discard block
 block discarded – undo
584 584
 				
585 585
 				$sth = $this->db->prepare($query);
586 586
 				$sth->execute();
587
-			} catch(PDOException $e) {
587
+			} catch (PDOException $e) {
588 588
 				return "error";
589 589
 			}
590 590
 			$query_delete = 'DELETE FROM tracker_live WHERE famtrackid IN (';
591 591
                         $i = 0;
592
-                        $j =0;
592
+                        $j = 0;
593 593
 			$all = $sth->fetchAll(PDO::FETCH_ASSOC);
594
-			foreach($all as $row)
594
+			foreach ($all as $row)
595 595
 			{
596 596
 				$i++;
597 597
 				$j++;
@@ -599,9 +599,9 @@  discard block
 block discarded – undo
599 599
 					if ($globalDebug) echo ".";
600 600
 				    	try {
601 601
 						
602
-						$sth = $this->db->prepare(substr($query_delete,0,-1).")");
602
+						$sth = $this->db->prepare(substr($query_delete, 0, -1).")");
603 603
 						$sth->execute();
604
-					} catch(PDOException $e) {
604
+					} catch (PDOException $e) {
605 605
 						return "error";
606 606
 					}
607 607
                                 	$query_delete = 'DELETE FROM tracker_live WHERE famtrackid IN (';
@@ -612,9 +612,9 @@  discard block
 block discarded – undo
612 612
 			if ($i > 0) {
613 613
     				try {
614 614
 					
615
-					$sth = $this->db->prepare(substr($query_delete,0,-1).")");
615
+					$sth = $this->db->prepare(substr($query_delete, 0, -1).")");
616 616
 					$sth->execute();
617
-				} catch(PDOException $e) {
617
+				} catch (PDOException $e) {
618 618
 					return "error";
619 619
 				}
620 620
 			}
@@ -627,7 +627,7 @@  discard block
 block discarded – undo
627 627
 				
628 628
 				$sth = $this->db->prepare($query);
629 629
 				$sth->execute();
630
-			} catch(PDOException $e) {
630
+			} catch (PDOException $e) {
631 631
 				return "error";
632 632
 			}
633 633
 /*			$query_delete = "DELETE FROM tracker_live WHERE famtrackid IN (";
@@ -675,13 +675,13 @@  discard block
 block discarded – undo
675 675
 	public function deleteLiveTrackerDataByIdent($ident)
676 676
 	{
677 677
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
678
-		$query  = 'DELETE FROM tracker_live WHERE ident = :ident';
678
+		$query = 'DELETE FROM tracker_live WHERE ident = :ident';
679 679
         
680 680
     		try {
681 681
 			
682 682
 			$sth = $this->db->prepare($query);
683 683
 			$sth->execute(array(':ident' => $ident));
684
-		} catch(PDOException $e) {
684
+		} catch (PDOException $e) {
685 685
 			return "error";
686 686
 		}
687 687
 
@@ -697,13 +697,13 @@  discard block
 block discarded – undo
697 697
 	public function deleteLiveTrackerDataById($id)
698 698
 	{
699 699
 		$id = filter_var($id, FILTER_SANITIZE_STRING);
700
-		$query  = 'DELETE FROM tracker_live WHERE famtrackid = :id';
700
+		$query = 'DELETE FROM tracker_live WHERE famtrackid = :id';
701 701
         
702 702
     		try {
703 703
 			
704 704
 			$sth = $this->db->prepare($query);
705 705
 			$sth->execute(array(':id' => $id));
706
-		} catch(PDOException $e) {
706
+		} catch (PDOException $e) {
707 707
 			return "error";
708 708
 		}
709 709
 
@@ -721,13 +721,13 @@  discard block
 block discarded – undo
721 721
 	{
722 722
 		global $globalDBdriver, $globalTimezone;
723 723
 		if ($globalDBdriver == 'mysql') {
724
-			$query  = 'SELECT tracker_live.ident FROM tracker_live 
724
+			$query = 'SELECT tracker_live.ident FROM tracker_live 
725 725
 				WHERE tracker_live.ident = :ident 
726 726
 				AND tracker_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 HOUR) 
727 727
 				AND tracker_live.date < UTC_TIMESTAMP()';
728 728
 			$query_data = array(':ident' => $ident);
729 729
 		} else {
730
-			$query  = "SELECT tracker_live.ident FROM tracker_live 
730
+			$query = "SELECT tracker_live.ident FROM tracker_live 
731 731
 				WHERE tracker_live.ident = :ident 
732 732
 				AND tracker_live.date >= now() AT TIME ZONE 'UTC' - INTERVAL '1 HOURS'
733 733
 				AND tracker_live.date < now() AT TIME ZONE 'UTC'";
@@ -736,8 +736,8 @@  discard block
 block discarded – undo
736 736
 		
737 737
 		$sth = $this->db->prepare($query);
738 738
 		$sth->execute($query_data);
739
-		$ident_result='';
740
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
739
+		$ident_result = '';
740
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
741 741
 		{
742 742
 			$ident_result = $row['ident'];
743 743
 		}
@@ -754,13 +754,13 @@  discard block
 block discarded – undo
754 754
 	{
755 755
 		global $globalDBdriver, $globalTimezone;
756 756
 		if ($globalDBdriver == 'mysql') {
757
-			$query  = 'SELECT tracker_live.ident, tracker_live.famtrackid FROM tracker_live 
757
+			$query = 'SELECT tracker_live.ident, tracker_live.famtrackid FROM tracker_live 
758 758
 				WHERE tracker_live.ident = :ident 
759 759
 				AND tracker_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 30 MINUTE)'; 
760 760
 //				AND tracker_live.date < UTC_TIMESTAMP()";
761 761
 			$query_data = array(':ident' => $ident);
762 762
 		} else {
763
-			$query  = "SELECT tracker_live.ident, tracker_live.famtrackid FROM tracker_live 
763
+			$query = "SELECT tracker_live.ident, tracker_live.famtrackid FROM tracker_live 
764 764
 				WHERE tracker_live.ident = :ident 
765 765
 				AND tracker_live.date >= now() AT TIME ZONE 'UTC' - INTERVAL '30 MINUTES'";
766 766
 //				AND tracker_live.date < now() AT TIME ZONE 'UTC'";
@@ -769,8 +769,8 @@  discard block
 block discarded – undo
769 769
 		
770 770
 		$sth = $this->db->prepare($query);
771 771
 		$sth->execute($query_data);
772
-		$ident_result='';
773
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
772
+		$ident_result = '';
773
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
774 774
 		{
775 775
 			$ident_result = $row['famtrackid'];
776 776
 		}
@@ -787,13 +787,13 @@  discard block
 block discarded – undo
787 787
 	{
788 788
 		global $globalDBdriver, $globalTimezone;
789 789
 		if ($globalDBdriver == 'mysql') {
790
-			$query  = 'SELECT tracker_live.ident, tracker_live.famtrackid FROM tracker_live 
790
+			$query = 'SELECT tracker_live.ident, tracker_live.famtrackid FROM tracker_live 
791 791
 				WHERE tracker_live.famtrackid = :id 
792 792
 				AND tracker_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 10 HOUR)'; 
793 793
 //				AND tracker_live.date < UTC_TIMESTAMP()";
794 794
 			$query_data = array(':id' => $id);
795 795
 		} else {
796
-			$query  = "SELECT tracker_live.ident, tracker_live.famtrackid FROM tracker_live 
796
+			$query = "SELECT tracker_live.ident, tracker_live.famtrackid FROM tracker_live 
797 797
 				WHERE tracker_live.famtrackid = :id 
798 798
 				AND tracker_live.date >= now() AT TIME ZONE 'UTC' - INTERVAL '10 HOUR'";
799 799
 //				AND tracker_live.date < now() AT TIME ZONE 'UTC'";
@@ -802,8 +802,8 @@  discard block
 block discarded – undo
802 802
 		
803 803
 		$sth = $this->db->prepare($query);
804 804
 		$sth->execute($query_data);
805
-		$ident_result='';
806
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
805
+		$ident_result = '';
806
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
807 807
 		{
808 808
 			$ident_result = $row['famtrackid'];
809 809
 		}
@@ -821,7 +821,7 @@  discard block
 block discarded – undo
821 821
 	* @return String success or false
822 822
 	*
823 823
 	*/
824
-	public function addLiveTrackerData($famtrackid = '', $ident = '', $latitude = '', $longitude = '', $altitude = '', $heading = '', $groundspeed = '', $date = '', $putinarchive = false, $comment = '', $type = '',$noarchive = false,$format_source = '', $source_name = '', $over_country = '')
824
+	public function addLiveTrackerData($famtrackid = '', $ident = '', $latitude = '', $longitude = '', $altitude = '', $heading = '', $groundspeed = '', $date = '', $putinarchive = false, $comment = '', $type = '', $noarchive = false, $format_source = '', $source_name = '', $over_country = '')
825 825
 	{
826 826
 		global $globalURL, $globalArchive, $globalDebug;
827 827
 		$Common = new Common();
@@ -880,21 +880,21 @@  discard block
 block discarded – undo
880 880
 		if ($date == '') $date = date("Y-m-d H:i:s", time());
881 881
 
882 882
         
883
-		$famtrackid = filter_var($famtrackid,FILTER_SANITIZE_STRING);
884
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
885
-		$latitude = filter_var($latitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
886
-		$longitude = filter_var($longitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
887
-		$altitude = filter_var($altitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
888
-		$heading = filter_var($heading,FILTER_SANITIZE_NUMBER_INT);
889
-		$groundspeed = filter_var($groundspeed,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
890
-		$format_source = filter_var($format_source,FILTER_SANITIZE_STRING);
891
-		$source_name = filter_var($source_name,FILTER_SANITIZE_STRING);
892
-		$over_country = filter_var($over_country,FILTER_SANITIZE_STRING);
893
-		$comment = filter_var($comment,FILTER_SANITIZE_STRING);
894
-		$type = filter_var($type,FILTER_SANITIZE_STRING);
895
-
896
-            	if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) $groundspeed = 0;
897
-            	if ($heading == '' || $Common->isInteger($heading) === false ) $heading = 0;
883
+		$famtrackid = filter_var($famtrackid, FILTER_SANITIZE_STRING);
884
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
885
+		$latitude = filter_var($latitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
886
+		$longitude = filter_var($longitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
887
+		$altitude = filter_var($altitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
888
+		$heading = filter_var($heading, FILTER_SANITIZE_NUMBER_INT);
889
+		$groundspeed = filter_var($groundspeed, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
890
+		$format_source = filter_var($format_source, FILTER_SANITIZE_STRING);
891
+		$source_name = filter_var($source_name, FILTER_SANITIZE_STRING);
892
+		$over_country = filter_var($over_country, FILTER_SANITIZE_STRING);
893
+		$comment = filter_var($comment, FILTER_SANITIZE_STRING);
894
+		$type = filter_var($type, FILTER_SANITIZE_STRING);
895
+
896
+            	if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0;
897
+            	if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0;
898 898
             	
899 899
 		$query = '';
900 900
 		if ($globalArchive) {
@@ -904,12 +904,12 @@  discard block
 block discarded – undo
904 904
 		$query  .= 'INSERT INTO tracker_live (famtrackid, ident, latitude, longitude, altitude, heading, ground_speed, date, format_source, source_name, over_country, comment, type) 
905 905
 		VALUES (:famtrackid,:ident,:latitude,:longitude,:altitude,:heading,:groundspeed,:date,:format_source, :source_name, :over_country,:comment,:type)';
906 906
 
907
-		$query_values = array(':famtrackid' => $famtrackid,':ident' => $ident,':latitude' => $latitude,':longitude' => $longitude,':altitude' => $altitude,':heading' => $heading,':groundspeed' => $groundspeed,':date' => $date, ':format_source' => $format_source, ':source_name' => $source_name, ':over_country' => $over_country,':comment' => $comment,':type' => $type);
907
+		$query_values = array(':famtrackid' => $famtrackid, ':ident' => $ident, ':latitude' => $latitude, ':longitude' => $longitude, ':altitude' => $altitude, ':heading' => $heading, ':groundspeed' => $groundspeed, ':date' => $date, ':format_source' => $format_source, ':source_name' => $source_name, ':over_country' => $over_country, ':comment' => $comment, ':type' => $type);
908 908
 		try {
909 909
 			
910 910
 			$sth = $this->db->prepare($query);
911 911
 			$sth->execute($query_values);
912
-                } catch(PDOException $e) {
912
+                } catch (PDOException $e) {
913 913
                 	return "error : ".$e->getMessage();
914 914
                 }
915 915
                 /*
@@ -919,7 +919,7 @@  discard block
 block discarded – undo
919 919
 		if (isset($globalArchive) && $globalArchive && $putinarchive && $noarchive !== true) {
920 920
 		    if ($globalDebug) echo '(Add to Tracker archive '.$famtrackid.' : ';
921 921
 		    $TrackerArchive = new TrackerArchive($this->db);
922
-		    $result =  $TrackerArchive->addTrackerArchiveData($famtrackid, $ident,$latitude, $longitude, $altitude, $heading, $groundspeed, $date, $putinarchive, $comment, $type,$noarchive,$format_source, $source_name, $over_country);
922
+		    $result = $TrackerArchive->addTrackerArchiveData($famtrackid, $ident, $latitude, $longitude, $altitude, $heading, $groundspeed, $date, $putinarchive, $comment, $type, $noarchive, $format_source, $source_name, $over_country);
923 923
 		    if ($globalDebug) echo $result.')';
924 924
 		}
925 925
 
@@ -929,7 +929,7 @@  discard block
 block discarded – undo
929 929
 
930 930
 	public function getOrderBy()
931 931
 	{
932
-		$orderby = array("aircraft_asc" => array("key" => "aircraft_asc", "value" => "Aircraft Type - ASC", "sql" => "ORDER BY tracker_live.aircraft_icao ASC"), "aircraft_desc" => array("key" => "aircraft_desc", "value" => "Aircraft Type - DESC", "sql" => "ORDER BY tracker_live.aircraft_icao DESC"),"manufacturer_asc" => array("key" => "manufacturer_asc", "value" => "Aircraft Manufacturer - ASC", "sql" => "ORDER BY tracker_live.aircraft_manufacturer ASC"), "manufacturer_desc" => array("key" => "manufacturer_desc", "value" => "Aircraft Manufacturer - DESC", "sql" => "ORDER BY tracker_live.aircraft_manufacturer DESC"),"airline_name_asc" => array("key" => "airline_name_asc", "value" => "Airline Name - ASC", "sql" => "ORDER BY tracker_live.airline_name ASC"), "airline_name_desc" => array("key" => "airline_name_desc", "value" => "Airline Name - DESC", "sql" => "ORDER BY tracker_live.airline_name DESC"), "ident_asc" => array("key" => "ident_asc", "value" => "Ident - ASC", "sql" => "ORDER BY tracker_live.ident ASC"), "ident_desc" => array("key" => "ident_desc", "value" => "Ident - DESC", "sql" => "ORDER BY tracker_live.ident DESC"), "airport_departure_asc" => array("key" => "airport_departure_asc", "value" => "Departure Airport - ASC", "sql" => "ORDER BY tracker_live.departure_airport_city ASC"), "airport_departure_desc" => array("key" => "airport_departure_desc", "value" => "Departure Airport - DESC", "sql" => "ORDER BY tracker_live.departure_airport_city DESC"), "airport_arrival_asc" => array("key" => "airport_arrival_asc", "value" => "Arrival Airport - ASC", "sql" => "ORDER BY tracker_live.arrival_airport_city ASC"), "airport_arrival_desc" => array("key" => "airport_arrival_desc", "value" => "Arrival Airport - DESC", "sql" => "ORDER BY tracker_live.arrival_airport_city DESC"), "date_asc" => array("key" => "date_asc", "value" => "Date - ASC", "sql" => "ORDER BY tracker_live.date ASC"), "date_desc" => array("key" => "date_desc", "value" => "Date - DESC", "sql" => "ORDER BY tracker_live.date DESC"));
932
+		$orderby = array("aircraft_asc" => array("key" => "aircraft_asc", "value" => "Aircraft Type - ASC", "sql" => "ORDER BY tracker_live.aircraft_icao ASC"), "aircraft_desc" => array("key" => "aircraft_desc", "value" => "Aircraft Type - DESC", "sql" => "ORDER BY tracker_live.aircraft_icao DESC"), "manufacturer_asc" => array("key" => "manufacturer_asc", "value" => "Aircraft Manufacturer - ASC", "sql" => "ORDER BY tracker_live.aircraft_manufacturer ASC"), "manufacturer_desc" => array("key" => "manufacturer_desc", "value" => "Aircraft Manufacturer - DESC", "sql" => "ORDER BY tracker_live.aircraft_manufacturer DESC"), "airline_name_asc" => array("key" => "airline_name_asc", "value" => "Airline Name - ASC", "sql" => "ORDER BY tracker_live.airline_name ASC"), "airline_name_desc" => array("key" => "airline_name_desc", "value" => "Airline Name - DESC", "sql" => "ORDER BY tracker_live.airline_name DESC"), "ident_asc" => array("key" => "ident_asc", "value" => "Ident - ASC", "sql" => "ORDER BY tracker_live.ident ASC"), "ident_desc" => array("key" => "ident_desc", "value" => "Ident - DESC", "sql" => "ORDER BY tracker_live.ident DESC"), "airport_departure_asc" => array("key" => "airport_departure_asc", "value" => "Departure Airport - ASC", "sql" => "ORDER BY tracker_live.departure_airport_city ASC"), "airport_departure_desc" => array("key" => "airport_departure_desc", "value" => "Departure Airport - DESC", "sql" => "ORDER BY tracker_live.departure_airport_city DESC"), "airport_arrival_asc" => array("key" => "airport_arrival_asc", "value" => "Arrival Airport - ASC", "sql" => "ORDER BY tracker_live.arrival_airport_city ASC"), "airport_arrival_desc" => array("key" => "airport_arrival_desc", "value" => "Arrival Airport - DESC", "sql" => "ORDER BY tracker_live.arrival_airport_city DESC"), "date_asc" => array("key" => "date_asc", "value" => "Date - ASC", "sql" => "ORDER BY tracker_live.date ASC"), "date_desc" => array("key" => "date_desc", "value" => "Date - DESC", "sql" => "ORDER BY tracker_live.date DESC"));
933 933
 		return $orderby;
934 934
 	}
935 935
 
Please login to merge, or discard this patch.
Braces   +74 added lines, -25 removed lines patch added patch discarded remove patch
@@ -29,7 +29,9 @@  discard block
 block discarded – undo
29 29
 		if (isset($filter[0]['source'])) {
30 30
 			$filters = array_merge($filters,$filter);
31 31
 		}
32
-		if (is_array($globalFilter)) $filter = array_merge($filter,$globalFilter);
32
+		if (is_array($globalFilter)) {
33
+			$filter = array_merge($filter,$globalFilter);
34
+		}
33 35
 		$filter_query_join = '';
34 36
 		$filter_query_where = '';
35 37
 		foreach($filters as $flt) {
@@ -76,8 +78,11 @@  discard block
 block discarded – undo
76 78
 		if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) {
77 79
 			$filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')";
78 80
 		}
79
-		if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE';
80
-		elseif ($filter_query_where != '' && $and) $filter_query_where .= ' AND';
81
+		if ($filter_query_where == '' && $where) {
82
+			$filter_query_where = ' WHERE';
83
+		} elseif ($filter_query_where != '' && $and) {
84
+			$filter_query_where .= ' AND';
85
+		}
81 86
 		if ($filter_query_where != '') {
82 87
 			$filter_query_where = preg_replace('/^ AND/',' WHERE',$filter_query_where);
83 88
 		}
@@ -119,7 +124,9 @@  discard block
 block discarded – undo
119 124
 			}
120 125
 		}
121 126
 
122
-		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
127
+		if (!isset($globalLiveInterval)) {
128
+			$globalLiveInterval = '200';
129
+		}
123 130
 		if ($globalDBdriver == 'mysql') {
124 131
 			//$query  = "SELECT tracker_live.* FROM tracker_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL 30 SECOND) <= l.date GROUP BY l.famtrackid) s on tracker_live.famtrackid = s.famtrackid AND tracker_live.date = s.maxdate";
125 132
 			$query  = 'SELECT tracker_live.* FROM tracker_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.famtrackid) s on tracker_live.famtrackid = s.famtrackid AND tracker_live.date = s.maxdate'.$filter_query.$orderby_query;
@@ -144,7 +151,9 @@  discard block
 block discarded – undo
144 151
 
145 152
 		$filter_query = $this->getFilter($filter,true,true);
146 153
 
147
-		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
154
+		if (!isset($globalLiveInterval)) {
155
+			$globalLiveInterval = '200';
156
+		}
148 157
 		if ($globalDBdriver == 'mysql') {
149 158
 			$query  = 'SELECT tracker_live.ident, tracker_live.type,tracker_live.famtrackid, tracker_live.latitude, tracker_live.longitude, tracker_live.altitude, tracker_live.heading, tracker_live.ground_speed, tracker_live.date, tracker_live.format_source 
150 159
 			FROM tracker_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.famtrackid) s on tracker_live.famtrackid = s.famtrackid AND tracker_live.date = s.maxdate'.$filter_query." tracker_live.latitude <> 0 AND tracker_live.longitude <> 0";
@@ -182,7 +191,9 @@  discard block
 block discarded – undo
182 191
 
183 192
 		$filter_query = $this->getFilter($filter,true,true);
184 193
 
185
-		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
194
+		if (!isset($globalLiveInterval)) {
195
+			$globalLiveInterval = '200';
196
+		}
186 197
 		if ($globalDBdriver == 'mysql') {
187 198
 			if (isset($globalArchive) && $globalArchive) {
188 199
 				$query  = "SELECT * FROM (
@@ -240,7 +251,9 @@  discard block
 block discarded – undo
240 251
 		global $globalDBdriver, $globalLiveInterval;
241 252
 		$filter_query = $this->getFilter($filter,true,true);
242 253
 
243
-		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
254
+		if (!isset($globalLiveInterval)) {
255
+			$globalLiveInterval = '200';
256
+		}
244 257
 		if ($globalDBdriver == 'mysql') {
245 258
 			$query = 'SELECT COUNT(DISTINCT tracker_live.famtrackid) as nb FROM tracker_live'.$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= date';
246 259
 		} else {
@@ -268,7 +281,9 @@  discard block
 block discarded – undo
268 281
 	{
269 282
 		global $globalDBdriver, $globalLiveInterval;
270 283
 		$Spotter = new Spotter($this->db);
271
-		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
284
+		if (!isset($globalLiveInterval)) {
285
+			$globalLiveInterval = '200';
286
+		}
272 287
 		$filter_query = $this->getFilter($filter);
273 288
 
274 289
 		if (is_array($coord)) {
@@ -276,7 +291,9 @@  discard block
 block discarded – undo
276 291
 			$minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
277 292
 			$maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
278 293
 			$maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
279
-		} else return array();
294
+		} else {
295
+			return array();
296
+		}
280 297
 		if ($globalDBdriver == 'mysql') {
281 298
 			$query  = 'SELECT tracker_live.* FROM tracker_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.famtrackid) s on tracker_live.famtrackid = s.famtrackid AND tracker_live.date = s.maxdate AND tracker_live.latitude BETWEEN '.$minlat.' AND '.$maxlat.' AND tracker_live.longitude BETWEEN '.$minlong.' AND '.$maxlong.' GROUP BY tracker_live.famtrackid'.$filter_query;
282 299
 		} else {
@@ -296,7 +313,9 @@  discard block
 block discarded – undo
296 313
 	{
297 314
 		global $globalDBdriver, $globalLiveInterval;
298 315
 		$Spotter = new Spotter($this->db);
299
-		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
316
+		if (!isset($globalLiveInterval)) {
317
+			$globalLiveInterval = '200';
318
+		}
300 319
 		$filter_query = $this->getFilter($filter);
301 320
 
302 321
 		if (is_array($coord)) {
@@ -304,7 +323,9 @@  discard block
 block discarded – undo
304 323
 			$minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
305 324
 			$maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
306 325
 			$maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
307
-		} else return array();
326
+		} else {
327
+			return array();
328
+		}
308 329
 		if ($globalDBdriver == 'mysql') {
309 330
 			$query  = 'SELECT tracker_live.ident, tracker_live.famtrackid,tracker_live.type, tracker_live.latitude, tracker_live.longitude, tracker_live.altitude, tracker_live.heading, tracker_live.ground_speed, tracker_live.date, tracker_live.format_source 
310 331
 			FROM tracker_live'.$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval." SECOND) <= tracker_live.date AND tracker_live.latitude <> '0' AND tracker_live.longitude <> '0' AND tracker_live.latitude BETWEEN ".$minlat.' AND '.$maxlat.' AND tracker_live.longitude BETWEEN '.$minlong.' AND '.$maxlong."
@@ -497,11 +518,15 @@  discard block
 block discarded – undo
497 518
 		//$query  = self::$global_query.' WHERE tracker_live.famtrackid = :id ORDER BY date';
498 519
 		if ($globalDBdriver == 'mysql') {
499 520
 			$query = 'SELECT tracker_live.* FROM tracker_live WHERE tracker_live.famtrackid = :id';
500
-			if ($liveinterval) $query .= ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= date';
521
+			if ($liveinterval) {
522
+				$query .= ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= date';
523
+			}
501 524
 			$query .= ' ORDER BY date';
502 525
 		} else {
503 526
 			$query = 'SELECT tracker_live.* FROM tracker_live WHERE tracker_live.famtrackid = :id';
504
-			if ($liveinterval) $query .= " AND CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= date";
527
+			if ($liveinterval) {
528
+				$query .= " AND CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= date";
529
+			}
505 530
 			$query .= ' ORDER BY date';
506 531
 		}
507 532
 
@@ -596,7 +621,9 @@  discard block
 block discarded – undo
596 621
 				$i++;
597 622
 				$j++;
598 623
 				if ($j == 30) {
599
-					if ($globalDebug) echo ".";
624
+					if ($globalDebug) {
625
+						echo ".";
626
+					}
600 627
 				    	try {
601 628
 						
602 629
 						$sth = $this->db->prepare(substr($query_delete,0,-1).")");
@@ -843,7 +870,9 @@  discard block
 block discarded – undo
843 870
 			{
844 871
 				return false;
845 872
 			}
846
-		} else return '';
873
+		} else {
874
+			return '';
875
+		}
847 876
 
848 877
 		if ($longitude != '')
849 878
 		{
@@ -851,7 +880,9 @@  discard block
 block discarded – undo
851 880
 			{
852 881
 				return false;
853 882
 			}
854
-		} else return '';
883
+		} else {
884
+			return '';
885
+		}
855 886
 
856 887
 		if ($altitude != '')
857 888
 		{
@@ -859,7 +890,9 @@  discard block
 block discarded – undo
859 890
 			{
860 891
 				return false;
861 892
 			}
862
-		} else $altitude = 0;
893
+		} else {
894
+			$altitude = 0;
895
+		}
863 896
 
864 897
 		if ($heading != '')
865 898
 		{
@@ -867,7 +900,9 @@  discard block
 block discarded – undo
867 900
 			{
868 901
 				return false;
869 902
 			}
870
-		} else $heading = 0;
903
+		} else {
904
+			$heading = 0;
905
+		}
871 906
 
872 907
 		if ($groundspeed != '')
873 908
 		{
@@ -875,9 +910,13 @@  discard block
 block discarded – undo
875 910
 			{
876 911
 				return false;
877 912
 			}
878
-		} else $groundspeed = 0;
913
+		} else {
914
+			$groundspeed = 0;
915
+		}
879 916
 		date_default_timezone_set('UTC');
880
-		if ($date == '') $date = date("Y-m-d H:i:s", time());
917
+		if ($date == '') {
918
+			$date = date("Y-m-d H:i:s", time());
919
+		}
881 920
 
882 921
         
883 922
 		$famtrackid = filter_var($famtrackid,FILTER_SANITIZE_STRING);
@@ -893,12 +932,18 @@  discard block
 block discarded – undo
893 932
 		$comment = filter_var($comment,FILTER_SANITIZE_STRING);
894 933
 		$type = filter_var($type,FILTER_SANITIZE_STRING);
895 934
 
896
-            	if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) $groundspeed = 0;
897
-            	if ($heading == '' || $Common->isInteger($heading) === false ) $heading = 0;
935
+            	if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) {
936
+            		$groundspeed = 0;
937
+            	}
938
+            	if ($heading == '' || $Common->isInteger($heading) === false ) {
939
+            		$heading = 0;
940
+            	}
898 941
             	
899 942
 		$query = '';
900 943
 		if ($globalArchive) {
901
-			if ($globalDebug) echo '-- Delete previous data -- ';
944
+			if ($globalDebug) {
945
+				echo '-- Delete previous data -- ';
946
+			}
902 947
 			$query .= 'DELETE FROM tracker_live WHERE famtrackid = :famtrackid;';
903 948
 		}
904 949
 		$query  .= 'INSERT INTO tracker_live (famtrackid, ident, latitude, longitude, altitude, heading, ground_speed, date, format_source, source_name, over_country, comment, type) 
@@ -917,10 +962,14 @@  discard block
 block discarded – undo
917 962
                 echo 'noarchive : '.$noarchive."\n";
918 963
                 */
919 964
 		if (isset($globalArchive) && $globalArchive && $putinarchive && $noarchive !== true) {
920
-		    if ($globalDebug) echo '(Add to Tracker archive '.$famtrackid.' : ';
965
+		    if ($globalDebug) {
966
+		    	echo '(Add to Tracker archive '.$famtrackid.' : ';
967
+		    }
921 968
 		    $TrackerArchive = new TrackerArchive($this->db);
922 969
 		    $result =  $TrackerArchive->addTrackerArchiveData($famtrackid, $ident,$latitude, $longitude, $altitude, $heading, $groundspeed, $date, $putinarchive, $comment, $type,$noarchive,$format_source, $source_name, $over_country);
923
-		    if ($globalDebug) echo $result.')';
970
+		    if ($globalDebug) {
971
+		    	echo $result.')';
972
+		    }
924 973
 		}
925 974
 
926 975
 		return "success";
Please login to merge, or discard this patch.
js/map-marine.3d.js.php 2 patches
Braces   +12 added lines, -2 removed lines patch added patch discarded remove patch
@@ -53,7 +53,12 @@  discard block
 block discarded – undo
53 53
 	} else {
54 54
 		for (var i = 0; i < viewer.dataSources.get(dsn).entities.values.length; i++) {
55 55
 			var entity = viewer.dataSources.get(dsn).entities.values[i];
56
-			if (parseInt(entity.lastupdate) < Math.floor(Date.now()-<?php if (isset($globalMapRefresh)) print $globalMapRefresh*2000; else print '60000'; ?>)) {
56
+			if (parseInt(entity.lastupdate) < Math.floor(Date.now()-<?php if (isset($globalMapRefresh)) {
57
+	print $globalMapRefresh*2000;
58
+} else {
59
+	print '60000';
60
+}
61
+?>)) {
57 62
 				viewer.dataSources.get(dsn).entities.remove(entity);
58 63
 			} else {
59 64
 				//console.log(parseInt(entity.lastupdate)+' > '+Math.floor(Date.now()-100));
@@ -127,7 +132,12 @@  discard block
 block discarded – undo
127 132
 		function(){
128 133
 			updateMarineData();
129 134
 		}
130
-	,<?php if (isset($globalMapRefresh)) print $globalMapRefresh*1000; else print '30000'; ?>);
135
+	,<?php if (isset($globalMapRefresh)) {
136
+	print $globalMapRefresh*1000;
137
+} else {
138
+	print '30000';
139
+}
140
+?>);
131 141
 } else {
132 142
 	var clockViewModel = new Cesium.ClockViewModel(viewer.clock);
133 143
 	var animationViewModel = new Cesium.AnimationViewModel(clockViewModel);
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -131,7 +131,7 @@
 block discarded – undo
131 131
 } else {
132 132
 	var clockViewModel = new Cesium.ClockViewModel(viewer.clock);
133 133
 	var animationViewModel = new Cesium.AnimationViewModel(clockViewModel);
134
-	$(".archivebox").html('<h4><?php echo str_replace("'","\'",_("Archive")); ?></h4>' + '<br/><form id="noarchive" method="post"><input type="hidden" name="noarchive" /></form><a href="#" onClick="animationViewModel.playReverseViewModel.command();"><i class="fa fa-play fa-flip-horizontal" aria-hidden="true"></i></a> <a href="#" onClick="'+"document.getElementById('noarchive').submit();"+'"><i class="fa fa-eject" aria-hidden="true"></i></a> <a href="#" onClick="animationViewModel.pauseViewModel.command();"><i class="fa fa-pause" aria-hidden="true"></i></a> <a href="#" onClick="animationViewModel.playForwardViewModel.command();"><i class="fa fa-play" aria-hidden="true"></i></a>');
134
+	$(".archivebox").html('<h4><?php echo str_replace("'", "\'", _("Archive")); ?></h4>' + '<br/><form id="noarchive" method="post"><input type="hidden" name="noarchive" /></form><a href="#" onClick="animationViewModel.playReverseViewModel.command();"><i class="fa fa-play fa-flip-horizontal" aria-hidden="true"></i></a> <a href="#" onClick="'+"document.getElementById('noarchive').submit();"+'"><i class="fa fa-eject" aria-hidden="true"></i></a> <a href="#" onClick="animationViewModel.pauseViewModel.command();"><i class="fa fa-pause" aria-hidden="true"></i></a> <a href="#" onClick="animationViewModel.playForwardViewModel.command();"><i class="fa fa-play" aria-hidden="true"></i></a>');
135 135
 }
136 136
 function MarineiconColor(color) {
137 137
 	document.cookie =  'MarineIconColor='+color.substring(1)+'; expires=Thu, 2 Aug 2100 20:47:11 UTC; path=/'
Please login to merge, or discard this patch.
js/map-aircraft.2d.js.php 2 patches
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -6,8 +6,8 @@  discard block
 block discarded – undo
6 6
 if (!isset($globalJsonCompress)) $compress = true;
7 7
 else $compress = $globalJsonCompress;
8 8
 
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);
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);
11 11
 ?>
12 12
 
13 13
 
@@ -176,10 +176,10 @@  discard block
 block discarded – undo
176 176
 	};
177 177
 	archive.update = function (props) {
178 178
 		if (typeof props != 'undefined') {
179
-			//this._div.innerHTML = '<h4><?php echo str_replace("'","\'",_("Archive Date & Time")); ?></h4>' +  '<b>' + props.archive_date + ' UTC </b>' + '<br/><i class="fa fa-fast-backward" aria-hidden="true"></i> <i class="fa fa-backward" aria-hidden="true"></i>  <a href="#" onClick="archivePause();"><i class="fa fa-pause" aria-hidden="true"></i></a> <a href="#" onClick="archivePlay();"><i class="fa fa-play" aria-hidden="true"></i></a>  <i class="fa fa-forward" aria-hidden="true"></i> <i class="fa fa-fast-forward" aria-hidden="true"></i>';
180
-			this._div.innerHTML = '<h4><?php echo str_replace("'","\'",_("Archive Date & Time")); ?></h4>' +  '<b>' + props.archive_date + ' UTC </b>' + '<br/><a href="#" onClick="archivePause();"><i class="fa fa-pause" aria-hidden="true"></i></a> <a href="#" onClick="archivePlay();"><i class="fa fa-play" aria-hidden="true"></i></a>';
179
+			//this._div.innerHTML = '<h4><?php echo str_replace("'", "\'", _("Archive Date & Time")); ?></h4>' +  '<b>' + props.archive_date + ' UTC </b>' + '<br/><i class="fa fa-fast-backward" aria-hidden="true"></i> <i class="fa fa-backward" aria-hidden="true"></i>  <a href="#" onClick="archivePause();"><i class="fa fa-pause" aria-hidden="true"></i></a> <a href="#" onClick="archivePlay();"><i class="fa fa-play" aria-hidden="true"></i></a>  <i class="fa fa-forward" aria-hidden="true"></i> <i class="fa fa-fast-forward" aria-hidden="true"></i>';
180
+			this._div.innerHTML = '<h4><?php echo str_replace("'", "\'", _("Archive Date & Time")); ?></h4>' +  '<b>' + props.archive_date + ' UTC </b>' + '<br/><a href="#" onClick="archivePause();"><i class="fa fa-pause" aria-hidden="true"></i></a> <a href="#" onClick="archivePlay();"><i class="fa fa-play" aria-hidden="true"></i></a>';
181 181
 		} else {
182
-			this._div.innerHTML = '<h4><?php echo str_replace("'","\'",_("Archive Date & Time")); ?></h4>' +  '<b><i class="fa fa-spinner fa-pulse fa-2x fa-fw margin-bottom"></i></b>';
182
+			this._div.innerHTML = '<h4><?php echo str_replace("'", "\'", _("Archive Date & Time")); ?></h4>' +  '<b><i class="fa fa-spinner fa-pulse fa-2x fa-fw margin-bottom"></i></b>';
183 183
 		}
184 184
 
185 185
 	};
@@ -340,7 +340,7 @@  discard block
 block discarded – undo
340 340
 <?php
341 341
 		} else {
342 342
 ?>
343
-					var movingtime = Math.round(<?php if (isset($archiveupdatetime)) print $archiveupdatetime*1000; else print $globalMapRefresh*1000+20000; ?>+feature.properties.sqt*1000);
343
+					var movingtime = Math.round(<?php if (isset($archiveupdatetime)) print $archiveupdatetime*1000; else print $globalMapRefresh*1000 + 20000; ?>+feature.properties.sqt*1000);
344 344
 					return new L.Marker.movingMarker([latLng, feature.properties.nextlatlon],[movingtime],{
345 345
 <?php
346 346
 		}
@@ -356,7 +356,7 @@  discard block
 block discarded – undo
356 356
 							/*
357 357
 							shadowUrl: iconURLShadowpath,
358 358
 							shadowSize: [<?php print $globalAircraftSize; ?>, <?php print $globalAircraftSize; ?>],
359
-							shadowAnchor: [<?php print ($globalAircraftSize/2)+1; ?>, <?php print $globalAircraftSize; ?>]
359
+							shadowAnchor: [<?php print ($globalAircraftSize/2) + 1; ?>, <?php print $globalAircraftSize; ?>]
360 360
 							*/
361 361
 						})
362 362
 					})
@@ -382,7 +382,7 @@  discard block
 block discarded – undo
382 382
 <?php
383 383
 		} else {
384 384
 ?>
385
-						var movingtime = Math.round(<?php if (isset($archiveupdatetime)) print $archiveupdatetime*1000; else print $globalMapRefresh*1000+20000; ?>+feature.properties.sqt*1000);
385
+						var movingtime = Math.round(<?php if (isset($archiveupdatetime)) print $archiveupdatetime*1000; else print $globalMapRefresh*1000 + 20000; ?>+feature.properties.sqt*1000);
386 386
 						return new L.Marker.movingMarker([latLng, feature.properties.nextlatlon],[movingtime],{
387 387
 <?php
388 388
 		}
@@ -422,7 +422,7 @@  discard block
 block discarded – undo
422 422
 <?php
423 423
 		} else {
424 424
 ?>
425
-							var movingtime = Math.round(<?php if (isset($archiveupdatetime)) print $archiveupdatetime*1000; else print $globalMapRefresh*1000+20000; ?>+feature.properties.sqt*1000);
425
+							var movingtime = Math.round(<?php if (isset($archiveupdatetime)) print $archiveupdatetime*1000; else print $globalMapRefresh*1000 + 20000; ?>+feature.properties.sqt*1000);
426 426
 							return new L.Marker.movingMarker([latLng, feature.properties.nextlatlon],[movingtime],{
427 427
 <?php
428 428
 		}
Please login to merge, or discard this patch.
Braces   +66 added lines, -17 removed lines patch added patch discarded remove patch
@@ -3,11 +3,18 @@  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
 
13 20
 
@@ -72,9 +79,12 @@  discard block
 block discarded – undo
72 79
 
73 80
 function update_airportsLayer() {
74 81
 <?php
75
-	if (isset($_COOKIE['AirportZoom'])) $getZoom = $_COOKIE['AirportZoom'];
76
-	else $getZoom = '7';
77
-?>
82
+	if (isset($_COOKIE['AirportZoom'])) {
83
+		$getZoom = $_COOKIE['AirportZoom'];
84
+	} else {
85
+		$getZoom = '7';
86
+	}
87
+	?>
78 88
 	if (typeof airportsLayer != 'undefined') {
79 89
 		if (map.hasLayer(airportsLayer) == true) {
80 90
 			map.removeLayer(airportsLayer);
@@ -290,9 +300,13 @@  discard block
 block discarded – undo
290 300
 					if (callsign != ""){ markerLabel += callsign; }
291 301
 					if (departure_airport_code != "" && arrival_airport_code != "" && departure_airport_code != "NA" && arrival_airport_code != "NA"){ markerLabel += ' ( '+departure_airport_code+' - '+arrival_airport_code+' )'; }
292 302
 <?php
293
-	if (isset($_COOKIE['IconColor'])) $IconColor = $_COOKIE['IconColor'];
294
-	elseif (isset($globalAircraftIconColor)) $IconColor = $globalAircraftIconColor;
295
-	else $IconColor = '1a3151';
303
+	if (isset($_COOKIE['IconColor'])) {
304
+		$IconColor = $_COOKIE['IconColor'];
305
+	} elseif (isset($globalAircraftIconColor)) {
306
+		$IconColor = $globalAircraftIconColor;
307
+	} else {
308
+		$IconColor = '1a3151';
309
+	}
296 310
 	if (!isset($ident) && !isset($flightaware_id)) {
297 311
 ?>
298 312
 					info_update(feature.properties.fc);
@@ -340,7 +354,12 @@  discard block
 block discarded – undo
340 354
 <?php
341 355
 		} else {
342 356
 ?>
343
-					var movingtime = Math.round(<?php if (isset($archiveupdatetime)) print $archiveupdatetime*1000; else print $globalMapRefresh*1000+20000; ?>+feature.properties.sqt*1000);
357
+					var movingtime = Math.round(<?php if (isset($archiveupdatetime)) {
358
+	print $archiveupdatetime*1000;
359
+} else {
360
+	print $globalMapRefresh*1000+20000;
361
+}
362
+?>+feature.properties.sqt*1000);
344 363
 					return new L.Marker.movingMarker([latLng, feature.properties.nextlatlon],[movingtime],{
345 364
 <?php
346 365
 		}
@@ -382,7 +401,12 @@  discard block
 block discarded – undo
382 401
 <?php
383 402
 		} else {
384 403
 ?>
385
-						var movingtime = Math.round(<?php if (isset($archiveupdatetime)) print $archiveupdatetime*1000; else print $globalMapRefresh*1000+20000; ?>+feature.properties.sqt*1000);
404
+						var movingtime = Math.round(<?php if (isset($archiveupdatetime)) {
405
+	print $archiveupdatetime*1000;
406
+} else {
407
+	print $globalMapRefresh*1000+20000;
408
+}
409
+?>+feature.properties.sqt*1000);
386 410
 						return new L.Marker.movingMarker([latLng, feature.properties.nextlatlon],[movingtime],{
387 411
 <?php
388 412
 		}
@@ -422,7 +446,12 @@  discard block
 block discarded – undo
422 446
 <?php
423 447
 		} else {
424 448
 ?>
425
-							var movingtime = Math.round(<?php if (isset($archiveupdatetime)) print $archiveupdatetime*1000; else print $globalMapRefresh*1000+20000; ?>+feature.properties.sqt*1000);
449
+							var movingtime = Math.round(<?php if (isset($archiveupdatetime)) {
450
+	print $archiveupdatetime*1000;
451
+} else {
452
+	print $globalMapRefresh*1000+20000;
453
+}
454
+?>+feature.properties.sqt*1000);
426 455
 							return new L.Marker.movingMarker([latLng, feature.properties.nextlatlon],[movingtime],{
427 456
 <?php
428 457
 		}
@@ -759,13 +788,23 @@  discard block
 block discarded – undo
759 788
 	if (isset($archive) && $archive) {
760 789
 ?>
761 790
 	//then load it again every 30 seconds
762
-	//  var reload = setInterval(function(){if (noTimeout) getLiveData(0)},<?php if (isset($globalMapRefresh)) print ($globalMapRefresh*1000)/2; else print '15000'; ?>);
791
+	//  var reload = setInterval(function(){if (noTimeout) getLiveData(0)},<?php if (isset($globalMapRefresh)) {
792
+	print ($globalMapRefresh*1000)/2;
793
+} else {
794
+	print '15000';
795
+}
796
+?>);
763 797
 	reloadPage = setInterval(function(){if (noTimeout) getLiveData(0)},<?php print $archiveupdatetime*1000; ?>);
764 798
 <?php
765 799
 	} else {
766 800
 ?>
767 801
 	//then load it again every 30 seconds
768
-	reloadPage = setInterval(function(){if (noTimeout) getLiveData(0)},<?php if (isset($globalMapRefresh)) print $globalMapRefresh*1000; else print '30000'; ?>);
802
+	reloadPage = setInterval(function(){if (noTimeout) getLiveData(0)},<?php if (isset($globalMapRefresh)) {
803
+	print $globalMapRefresh*1000;
804
+} else {
805
+	print '30000';
806
+}
807
+?>);
769 808
 	var currentdate = new Date();
770 809
 	var currentyear = new Date().getFullYear();
771 810
 	var begindate = new Date(Date.UTC(currentyear,11,24,2,0,0,0));
@@ -777,7 +816,12 @@  discard block
 block discarded – undo
777 816
 		if (!((isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS)) && (isset($_COOKIE['polar']) && $_COOKIE['polar'] == 'true')) {
778 817
 ?>
779 818
 	update_polarLayer();
780
-	setInterval(function(){map.removeLayer(polarLayer);update_polarLayer()},<?php if (isset($globalMapRefresh)) print $globalMapRefresh*1000*2; else print '60000'; ?>);
819
+	setInterval(function(){map.removeLayer(polarLayer);update_polarLayer()},<?php if (isset($globalMapRefresh)) {
820
+	print $globalMapRefresh*1000*2;
821
+} else {
822
+	print '60000';
823
+}
824
+?>);
781 825
 <?php
782 826
 		}
783 827
 ?>
@@ -792,7 +836,12 @@  discard block
 block discarded – undo
792 836
 	if ((isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM)) {
793 837
 ?>
794 838
 	update_atcLayer();
795
-	setInterval(function(){map.removeLayer(atcLayer);update_atcLayer()},<?php if (isset($globalMapRefresh)) print $globalMapRefresh*1000*2; else print '60000'; ?>);
839
+	setInterval(function(){map.removeLayer(atcLayer);update_atcLayer()},<?php if (isset($globalMapRefresh)) {
840
+	print $globalMapRefresh*1000*2;
841
+} else {
842
+	print '60000';
843
+}
844
+?>);
796 845
 <?php
797 846
 	}
798 847
 ?>
Please login to merge, or discard this patch.
js/map-tracker.3d.js.php 2 patches
Braces   +12 added lines, -2 removed lines patch added patch discarded remove patch
@@ -53,7 +53,12 @@  discard block
 block discarded – undo
53 53
 	} else {
54 54
 		for (var i = 0; i < viewer.dataSources.get(dsn).entities.values.length; i++) {
55 55
 			var entity = viewer.dataSources.get(dsn).entities.values[i];
56
-			if (parseInt(entity.lastupdate) < Math.floor(Date.now()-<?php if (isset($globalMapRefresh)) print $globalMapRefresh*2000; else print '60000'; ?>)) {
56
+			if (parseInt(entity.lastupdate) < Math.floor(Date.now()-<?php if (isset($globalMapRefresh)) {
57
+	print $globalMapRefresh*2000;
58
+} else {
59
+	print '60000';
60
+}
61
+?>)) {
57 62
 				viewer.dataSources.get(dsn).entities.remove(entity);
58 63
 			} else {
59 64
 				//console.log(parseInt(entity.lastupdate)+' > '+Math.floor(Date.now()-100));
@@ -127,7 +132,12 @@  discard block
 block discarded – undo
127 132
 		function(){
128 133
 			updateTrackerData();
129 134
 		}
130
-	,<?php if (isset($globalMapRefresh)) print $globalMapRefresh*1000; else print '30000'; ?>);
135
+	,<?php if (isset($globalMapRefresh)) {
136
+	print $globalMapRefresh*1000;
137
+} else {
138
+	print '30000';
139
+}
140
+?>);
131 141
 } else {
132 142
 	var clockViewModel = new Cesium.ClockViewModel(viewer.clock);
133 143
 	var animationViewModel = new Cesium.AnimationViewModel(clockViewModel);
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -177,7 +177,7 @@
 block discarded – undo
177 177
 } else {
178 178
 	var clockViewModel = new Cesium.ClockViewModel(viewer.clock);
179 179
 	var animationViewModel = new Cesium.AnimationViewModel(clockViewModel);
180
-	$(".archivebox").html('<h4><?php echo str_replace("'","\'",_("Archive")); ?></h4>' + '<br/><form id="noarchive" method="post"><input type="hidden" name="noarchive" /></form><a href="#" onClick="animationViewModel.playReverseViewModel.command();"><i class="fa fa-play fa-flip-horizontal" aria-hidden="true"></i></a> <a href="#" onClick="'+"document.getElementById('noarchive').submit();"+'"><i class="fa fa-eject" aria-hidden="true"></i></a> <a href="#" onClick="animationViewModel.pauseViewModel.command();"><i class="fa fa-pause" aria-hidden="true"></i></a> <a href="#" onClick="animationViewModel.playForwardViewModel.command();"><i class="fa fa-play" aria-hidden="true"></i></a>');
180
+	$(".archivebox").html('<h4><?php echo str_replace("'", "\'", _("Archive")); ?></h4>' + '<br/><form id="noarchive" method="post"><input type="hidden" name="noarchive" /></form><a href="#" onClick="animationViewModel.playReverseViewModel.command();"><i class="fa fa-play fa-flip-horizontal" aria-hidden="true"></i></a> <a href="#" onClick="'+"document.getElementById('noarchive').submit();"+'"><i class="fa fa-eject" aria-hidden="true"></i></a> <a href="#" onClick="animationViewModel.pauseViewModel.command();"><i class="fa fa-pause" aria-hidden="true"></i></a> <a href="#" onClick="animationViewModel.playForwardViewModel.command();"><i class="fa fa-play" aria-hidden="true"></i></a>');
181 181
 }
182 182
 function TrackericonColor(color) {
183 183
 	document.cookie =  'TrackerIconColor='+color.substring(1)+'; expires=Thu, 2 Aug 2100 20:47:11 UTC; path=/'
Please login to merge, or discard this patch.
js/map-marine.2d.js.php 3 patches
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -516,8 +516,8 @@  discard block
 block discarded – undo
516 516
 			}
517 517
                     }
518 518
 		    <?php
519
-            		} else {
520
-            	    ?>
519
+					} else {
520
+					?>
521 521
 		    if (map.getZoom() > 7) {
522 522
                 	var style = {
523 523
                     	    "color": "#1a3151",
@@ -536,7 +536,7 @@  discard block
 block discarded – undo
536 536
                 	layer_marine_data.addLayer(layer);
537 537
 		    }
538 538
 <?php
539
-            		}
539
+					}
540 540
 ?>
541 541
 				}
542 542
 			    }
Please login to merge, or discard this patch.
Braces   +42 added lines, -10 removed lines patch added patch discarded remove patch
@@ -5,8 +5,11 @@  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
 ?>
11 14
 
12 15
 
@@ -142,9 +145,13 @@  discard block
 block discarded – undo
142 145
 		    if (callsign != ""){ markerMarineLabel += callsign; }
143 146
 		    if (type != ""){ markerMarineLabel += ' - '+type; }
144 147
 <?php
145
-	if (isset($_COOKIE['MarineIconColor'])) $MarineIconColor = $_COOKIE['MarineIconColor'];
146
-	elseif (isset($globalMarineIconColor)) $MarineIconColor = $globalMarineIconColor;
147
-	else $MarineIconColor = '1a3151';
148
+	if (isset($_COOKIE['MarineIconColor'])) {
149
+		$MarineIconColor = $_COOKIE['MarineIconColor'];
150
+	} elseif (isset($globalMarineIconColor)) {
151
+		$MarineIconColor = $globalMarineIconColor;
152
+	} else {
153
+		$MarineIconColor = '1a3151';
154
+	}
148 155
 	if (!isset($ident) && !isset($fammarine_id)) {
149 156
 ?>
150 157
 		    info_marine_update(feature.properties.fc);
@@ -179,7 +186,12 @@  discard block
 block discarded – undo
179 186
 <?php
180 187
 		} else {
181 188
 ?>
182
-		    var movingtime = Math.round(<?php if (isset($archiveupdatetime)) print $archiveupdatetime*1000; else print $globalMapRefresh*1000+20000; ?>+feature.properties.sqt*1000);
189
+		    var movingtime = Math.round(<?php if (isset($archiveupdatetime)) {
190
+	print $archiveupdatetime*1000;
191
+} else {
192
+	print $globalMapRefresh*1000+20000;
193
+}
194
+?>+feature.properties.sqt*1000);
183 195
 		    return new L.Marker.movingMarker([latLng, feature.properties.nextlatlon],[movingtime],{
184 196
 <?php
185 197
 		}
@@ -228,7 +240,12 @@  discard block
 block discarded – undo
228 240
 <?php
229 241
 		} else {
230 242
 ?>
231
-			    var movingtime = Math.round(<?php if (isset($archiveupdatetime)) print $archiveupdatetime*1000; else print $globalMapRefresh*1000+20000; ?>+feature.properties.sqt*1000);
243
+			    var movingtime = Math.round(<?php if (isset($archiveupdatetime)) {
244
+	print $archiveupdatetime*1000;
245
+} else {
246
+	print $globalMapRefresh*1000+20000;
247
+}
248
+?>+feature.properties.sqt*1000);
232 249
 			    return new L.Marker.movingMarker([latLng, feature.properties.nextlatlon],[movingtime],{
233 250
 <?php
234 251
 		}
@@ -276,7 +293,12 @@  discard block
 block discarded – undo
276 293
 <?php
277 294
 		} else {
278 295
 ?>
279
-			    var movingtime = Math.round(<?php if (isset($archiveupdatetime)) print $archiveupdatetime*1000; else print $globalMapRefresh*1000+20000; ?>+feature.properties.sqt*1000);
296
+			    var movingtime = Math.round(<?php if (isset($archiveupdatetime)) {
297
+	print $archiveupdatetime*1000;
298
+} else {
299
+	print $globalMapRefresh*1000+20000;
300
+}
301
+?>+feature.properties.sqt*1000);
280 302
 			    return new L.Marker.movingMarker([latLng, feature.properties.nextlatlon],[movingtime],{
281 303
 <?php
282 304
 		}
@@ -559,14 +581,24 @@  discard block
 block discarded – undo
559 581
 	if (isset($archive) && $archive) {
560 582
 ?>
561 583
 //then load it again every 30 seconds
562
-//  var reload = setInterval(function(){if (noTimeout) getLiveMarineData(0)},<?php if (isset($globalMapRefresh)) print ($globalMapRefresh*1000)/2; else print '15000'; ?>);
584
+//  var reload = setInterval(function(){if (noTimeout) getLiveMarineData(0)},<?php if (isset($globalMapRefresh)) {
585
+	print ($globalMapRefresh*1000)/2;
586
+} else {
587
+	print '15000';
588
+}
589
+?>);
563 590
 reloadMarinePage = setInterval(function(){if (noTimeout) getLiveMarineData(0)},<?php print $archiveupdatetime*1000; ?>);
564 591
 <?php
565 592
 	} else {
566 593
 ?>
567 594
 //then load it again every 30 seconds
568 595
 reloadMarinePage = setInterval(
569
-    function(){if (noTimeout) getLiveMarineData(0)},<?php if (isset($globalMapRefresh)) print $globalMapRefresh*1000; else print '30000'; ?>);
596
+    function(){if (noTimeout) getLiveMarineData(0)},<?php if (isset($globalMapRefresh)) {
597
+	print $globalMapRefresh*1000;
598
+} else {
599
+	print '30000';
600
+}
601
+?>);
570 602
 <?php
571 603
 	}
572 604
 ?>
Please login to merge, or discard this patch.
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -2,7 +2,7 @@  discard block
 block discarded – undo
2 2
 require_once('../require/settings.php');
3 3
 require_once('../require/class.Language.php'); 
4 4
 
5
-setcookie("MapFormat",'2d');
5
+setcookie("MapFormat", '2d');
6 6
 
7 7
 // Compressed GeoJson is used if true
8 8
 if (!isset($globalJsonCompress)) $compress = true;
@@ -16,10 +16,10 @@  discard block
 block discarded – undo
16 16
 
17 17
 <?php
18 18
 	if (isset($_GET['fammarine_id'])) {
19
-		$fammarine_id = filter_input(INPUT_GET,'fammarine_id',FILTER_SANITIZE_STRING);
19
+		$fammarine_id = filter_input(INPUT_GET, 'fammarine_id', FILTER_SANITIZE_STRING);
20 20
 	}
21 21
 	if (isset($_GET['ident'])) {
22
-		$ident = filter_input(INPUT_GET,'ident',FILTER_SANITIZE_STRING);
22
+		$ident = filter_input(INPUT_GET, 'ident', FILTER_SANITIZE_STRING);
23 23
 	}
24 24
 	if (!isset($ident) && !isset($fammarine_id)) {
25 25
 ?>
@@ -182,7 +182,7 @@  discard block
 block discarded – undo
182 182
 <?php
183 183
 		} else {
184 184
 ?>
185
-		    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)) print $archiveupdatetime*1000; else print $globalMapRefresh*1000 + 20000; ?>+feature.properties.sqt*1000);
186 186
 		    return new L.Marker.movingMarker([latLng, feature.properties.nextlatlon],[movingtime],{
187 187
 <?php
188 188
 		}
@@ -198,7 +198,7 @@  discard block
 block discarded – undo
198 198
 			    /*
199 199
 			    shadowUrl: iconURLShadowpath,
200 200
 			    shadowSize: [<?php print $globalAircraftSize; ?>, <?php print $globalAircraftSize; ?>],
201
-			    shadowAnchor: [<?php print ($globalAircraftSize/2)+1; ?>, <?php print $globalAircraftSize; ?>]
201
+			    shadowAnchor: [<?php print ($globalAircraftSize/2) + 1; ?>, <?php print $globalAircraftSize; ?>]
202 202
 			    */
203 203
 			})
204 204
 		    })
@@ -231,7 +231,7 @@  discard block
 block discarded – undo
231 231
 <?php
232 232
 		} else {
233 233
 ?>
234
-			    var movingtime = Math.round(<?php if (isset($archiveupdatetime)) print $archiveupdatetime*1000; else print $globalMapRefresh*1000+20000; ?>+feature.properties.sqt*1000);
234
+			    var movingtime = Math.round(<?php if (isset($archiveupdatetime)) print $archiveupdatetime*1000; else print $globalMapRefresh*1000 + 20000; ?>+feature.properties.sqt*1000);
235 235
 			    return new L.Marker.movingMarker([latLng, feature.properties.nextlatlon],[movingtime],{
236 236
 <?php
237 237
 		}
@@ -279,7 +279,7 @@  discard block
 block discarded – undo
279 279
 <?php
280 280
 		} else {
281 281
 ?>
282
-			    var movingtime = Math.round(<?php if (isset($archiveupdatetime)) print $archiveupdatetime*1000; else print $globalMapRefresh*1000+20000; ?>+feature.properties.sqt*1000);
282
+			    var movingtime = Math.round(<?php if (isset($archiveupdatetime)) print $archiveupdatetime*1000; else print $globalMapRefresh*1000 + 20000; ?>+feature.properties.sqt*1000);
283 283
 			    return new L.Marker.movingMarker([latLng, feature.properties.nextlatlon],[movingtime],{
284 284
 <?php
285 285
 		}
Please login to merge, or discard this patch.
js/map-tracker.2d.js.php 3 patches
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -517,8 +517,8 @@  discard block
 block discarded – undo
517 517
 			}
518 518
                     }
519 519
 		    <?php
520
-            		} else {
521
-            	    ?>
520
+					} else {
521
+					?>
522 522
 		    if (map.getZoom() > 7) {
523 523
                 	var style = {
524 524
                     	    "color": "#1a3151",
@@ -537,7 +537,7 @@  discard block
 block discarded – undo
537 537
                 	layer_tracker_data.addLayer(layer);
538 538
 		    }
539 539
 <?php
540
-            		}
540
+					}
541 541
 ?>
542 542
 				}
543 543
 			    }
Please login to merge, or discard this patch.
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -2,7 +2,7 @@  discard block
 block discarded – undo
2 2
 require_once('../require/settings.php');
3 3
 require_once('../require/class.Language.php'); 
4 4
 
5
-setcookie("MapFormat",'2d');
5
+setcookie("MapFormat", '2d');
6 6
 
7 7
 // Compressed GeoJson is used if true
8 8
 if (!isset($globalJsonCompress)) $compress = true;
@@ -17,10 +17,10 @@  discard block
 block discarded – undo
17 17
 
18 18
 <?php
19 19
 	if (isset($_GET['famtrackid'])) {
20
-		$famtrackid = filter_input(INPUT_GET,'famtrackid',FILTER_SANITIZE_STRING);
20
+		$famtrackid = filter_input(INPUT_GET, 'famtrackid', FILTER_SANITIZE_STRING);
21 21
 	}
22 22
 	if (isset($_GET['ident'])) {
23
-		$ident = filter_input(INPUT_GET,'ident',FILTER_SANITIZE_STRING);
23
+		$ident = filter_input(INPUT_GET, 'ident', FILTER_SANITIZE_STRING);
24 24
 	}
25 25
 	if (!isset($ident) && !isset($famtrackid)) {
26 26
 ?>
@@ -182,7 +182,7 @@  discard block
 block discarded – undo
182 182
 <?php
183 183
 		} else {
184 184
 ?>
185
-		    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)) print $archiveupdatetime*1000; else print $globalMapRefresh*1000 + 20000; ?>+feature.properties.sqt*1000);
186 186
 		    return new L.Marker.movingMarker([latLng, feature.properties.nextlatlon],[movingtime],{
187 187
 <?php
188 188
 		}
@@ -198,7 +198,7 @@  discard block
 block discarded – undo
198 198
 			    /*
199 199
 			    shadowUrl: iconURLShadowpath,
200 200
 			    shadowSize: [<?php print $globalAircraftSize; ?>, <?php print $globalAircraftSize; ?>],
201
-			    shadowAnchor: [<?php print ($globalAircraftSize/2)+1; ?>, <?php print $globalAircraftSize; ?>]
201
+			    shadowAnchor: [<?php print ($globalAircraftSize/2) + 1; ?>, <?php print $globalAircraftSize; ?>]
202 202
 			    */
203 203
 			})
204 204
 		    })
@@ -231,7 +231,7 @@  discard block
 block discarded – undo
231 231
 <?php
232 232
 		} else {
233 233
 ?>
234
-			    var movingtime = Math.round(<?php if (isset($archiveupdatetime)) print $archiveupdatetime*1000; else print $globalMapRefresh*1000+20000; ?>+feature.properties.sqt*1000);
234
+			    var movingtime = Math.round(<?php if (isset($archiveupdatetime)) print $archiveupdatetime*1000; else print $globalMapRefresh*1000 + 20000; ?>+feature.properties.sqt*1000);
235 235
 			    return new L.Marker.movingMarker([latLng, feature.properties.nextlatlon],[movingtime],{
236 236
 <?php
237 237
 		}
@@ -279,7 +279,7 @@  discard block
 block discarded – undo
279 279
 <?php
280 280
 		} else {
281 281
 ?>
282
-			    var movingtime = Math.round(<?php if (isset($archiveupdatetime)) print $archiveupdatetime*1000; else print $globalMapRefresh*1000+20000; ?>+feature.properties.sqt*1000);
282
+			    var movingtime = Math.round(<?php if (isset($archiveupdatetime)) print $archiveupdatetime*1000; else print $globalMapRefresh*1000 + 20000; ?>+feature.properties.sqt*1000);
283 283
 			    return new L.Marker.movingMarker([latLng, feature.properties.nextlatlon],[movingtime],{
284 284
 <?php
285 285
 		}
Please login to merge, or discard this patch.
Braces   +42 added lines, -10 removed lines patch added patch discarded remove patch
@@ -5,8 +5,11 @@  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
 ?>
11 14
 
12 15
 
@@ -155,9 +158,13 @@  discard block
 block discarded – undo
155 158
 		    if (callsign != ""){ markerTrackerLabel += callsign; }
156 159
 		    if (type != ""){ markerTrackerLabel += ' - '+type; }
157 160
 <?php
158
-	if (isset($_COOKIE['TrackerIconColor'])) $IconColor = $_COOKIE['TrackerIconColor'];
159
-	elseif (isset($globalTrackerIconColor)) $IconColor = $globalTrackerIconColor;
160
-	else $IconColor = '1a3151';
161
+	if (isset($_COOKIE['TrackerIconColor'])) {
162
+		$IconColor = $_COOKIE['TrackerIconColor'];
163
+	} elseif (isset($globalTrackerIconColor)) {
164
+		$IconColor = $globalTrackerIconColor;
165
+	} else {
166
+		$IconColor = '1a3151';
167
+	}
161 168
 	if (!isset($ident) && !isset($famtrackid)) {
162 169
 ?>
163 170
 		    info_tracker_update(feature.properties.fc);
@@ -191,7 +198,12 @@  discard block
 block discarded – undo
191 198
 <?php
192 199
 		} else {
193 200
 ?>
194
-		    var movingtime = Math.round(<?php if (isset($archiveupdatetime)) print $archiveupdatetime*1000; else print $globalMapRefresh*1000+20000; ?>+feature.properties.sqt*1000);
201
+		    var movingtime = Math.round(<?php if (isset($archiveupdatetime)) {
202
+	print $archiveupdatetime*1000;
203
+} else {
204
+	print $globalMapRefresh*1000+20000;
205
+}
206
+?>+feature.properties.sqt*1000);
195 207
 		    return new L.Marker.movingMarker([latLng, feature.properties.nextlatlon],[movingtime],{
196 208
 <?php
197 209
 		}
@@ -247,7 +259,12 @@  discard block
 block discarded – undo
247 259
 <?php
248 260
 		} else {
249 261
 ?>
250
-			    var movingtime = Math.round(<?php if (isset($archiveupdatetime)) print $archiveupdatetime*1000; else print $globalMapRefresh*1000+20000; ?>+feature.properties.sqt*1000);
262
+			    var movingtime = Math.round(<?php if (isset($archiveupdatetime)) {
263
+	print $archiveupdatetime*1000;
264
+} else {
265
+	print $globalMapRefresh*1000+20000;
266
+}
267
+?>+feature.properties.sqt*1000);
251 268
 			    return new L.Marker.movingMarker([latLng, feature.properties.nextlatlon],[movingtime],{
252 269
 <?php
253 270
 		}
@@ -302,7 +319,12 @@  discard block
 block discarded – undo
302 319
 <?php
303 320
 		} else {
304 321
 ?>
305
-			    var movingtime = Math.round(<?php if (isset($archiveupdatetime)) print $archiveupdatetime*1000; else print $globalMapRefresh*1000+20000; ?>+feature.properties.sqt*1000);
322
+			    var movingtime = Math.round(<?php if (isset($archiveupdatetime)) {
323
+	print $archiveupdatetime*1000;
324
+} else {
325
+	print $globalMapRefresh*1000+20000;
326
+}
327
+?>+feature.properties.sqt*1000);
306 328
 			    return new L.Marker.movingMarker([latLng, feature.properties.nextlatlon],[movingtime],{
307 329
 <?php
308 330
 		}
@@ -592,14 +614,24 @@  discard block
 block discarded – undo
592 614
 	if (isset($archive) && $archive) {
593 615
 ?>
594 616
 //then load it again every 30 seconds
595
-//  var reload = setInterval(function(){if (noTimeout) getLiveTrackerData(0)},<?php if (isset($globalMapRefresh)) print ($globalMapRefresh*1000)/2; else print '15000'; ?>);
617
+//  var reload = setInterval(function(){if (noTimeout) getLiveTrackerData(0)},<?php if (isset($globalMapRefresh)) {
618
+	print ($globalMapRefresh*1000)/2;
619
+} else {
620
+	print '15000';
621
+}
622
+?>);
596 623
 reloadTrackerPage = setInterval(function(){if (noTimeout) getLiveTrackerData(0)},<?php print $archiveupdatetime*1000; ?>);
597 624
 <?php
598 625
 	} else {
599 626
 ?>
600 627
 //then load it again every 30 seconds
601 628
 reloadTrackerPage = setInterval(
602
-    function(){if (noTimeout) getLiveTrackerData(0)},<?php if (isset($globalMapRefresh)) print $globalMapRefresh*1000; else print '30000'; ?>);
629
+    function(){if (noTimeout) getLiveTrackerData(0)},<?php if (isset($globalMapRefresh)) {
630
+	print $globalMapRefresh*1000;
631
+} else {
632
+	print '30000';
633
+}
634
+?>);
603 635
 <?php
604 636
 	}
605 637
 ?>
Please login to merge, or discard this patch.
js/map-aircraft.3d.js.php 3 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -662,9 +662,9 @@
 block discarded – undo
662 662
 //	var timeline = new Cesium.Timeline(viewer);
663 663
 	var clockViewModel = new Cesium.ClockViewModel(viewer.clock);
664 664
 	var animationViewModel = new Cesium.AnimationViewModel(clockViewModel);
665
-	//this._div.innerHTML = '<h4><?php echo str_replace("'","\'",_("Archive Date & Time")); ?></h4>' +  '<b>' + props.archive_date + ' UTC </b>' + '<br/><i class="fa fa-fast-backward" aria-hidden="true"></i> <i class="fa fa-backward" aria-hidden="true"></i>  <a href="#" onClick="archivePause();"><i class="fa fa-pause" aria-hidden="true"></i></a> <a href="#" onClick="archivePlay();"><i class="fa fa-play" aria-hidden="true"></i></a>  <i class="fa fa-forward" aria-hidden="true"></i> <i class="fa fa-fast-forward" aria-hidden="true"></i>';
666
-	$(".archivebox").html('<h4><?php echo str_replace("'","\'",_("Archive")); ?></h4>' + '<br/><form id="noarchive" method="post"><input type="hidden" name="noarchive" /></form><a href="#" onClick="animationViewModel.playReverseViewModel.command();"><i class="fa fa-play fa-flip-horizontal" aria-hidden="true"></i></a> <a href="#" onClick="'+"document.getElementById('noarchive').submit();"+'"><i class="fa fa-eject" aria-hidden="true"></i></a> <a href="#" onClick="animationViewModel.pauseViewModel.command();"><i class="fa fa-pause" aria-hidden="true"></i></a> <a href="#" onClick="animationViewModel.playForwardViewModel.command();"><i class="fa fa-play" aria-hidden="true"></i></a>');
667
-	//		this._div.innerHTML = '<h4><?php echo str_replace("'","\'",_("Archive Date & Time")); ?></h4>' +  '<b><i class="fa fa-spinner fa-pulse fa-2x fa-fw margin-bottom"></i></b>';
665
+	//this._div.innerHTML = '<h4><?php echo str_replace("'", "\'", _("Archive Date & Time")); ?></h4>' +  '<b>' + props.archive_date + ' UTC </b>' + '<br/><i class="fa fa-fast-backward" aria-hidden="true"></i> <i class="fa fa-backward" aria-hidden="true"></i>  <a href="#" onClick="archivePause();"><i class="fa fa-pause" aria-hidden="true"></i></a> <a href="#" onClick="archivePlay();"><i class="fa fa-play" aria-hidden="true"></i></a>  <i class="fa fa-forward" aria-hidden="true"></i> <i class="fa fa-fast-forward" aria-hidden="true"></i>';
666
+	$(".archivebox").html('<h4><?php echo str_replace("'", "\'", _("Archive")); ?></h4>' + '<br/><form id="noarchive" method="post"><input type="hidden" name="noarchive" /></form><a href="#" onClick="animationViewModel.playReverseViewModel.command();"><i class="fa fa-play fa-flip-horizontal" aria-hidden="true"></i></a> <a href="#" onClick="'+"document.getElementById('noarchive').submit();"+'"><i class="fa fa-eject" aria-hidden="true"></i></a> <a href="#" onClick="animationViewModel.pauseViewModel.command();"><i class="fa fa-pause" aria-hidden="true"></i></a> <a href="#" onClick="animationViewModel.playForwardViewModel.command();"><i class="fa fa-play" aria-hidden="true"></i></a>');
667
+	//		this._div.innerHTML = '<h4><?php echo str_replace("'", "\'", _("Archive Date & Time")); ?></h4>' +  '<b><i class="fa fa-spinner fa-pulse fa-2x fa-fw margin-bottom"></i></b>';
668 668
 
669 669
 }
670 670
 
Please login to merge, or discard this patch.
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -720,12 +720,12 @@
 block discarded – undo
720 720
 	update_airportsLayer();
721 721
 }
722 722
 <?php
723
-    if ((isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM)) {
723
+	if ((isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM)) {
724 724
 ?>
725 725
 update_atcLayer();
726 726
 setInterval(function(){update_atcLayer()},<?php if (isset($globalMapRefresh)) print $globalMapRefresh*1000*2; else print '60000'; ?>);
727 727
 <?php
728
-    }
728
+	}
729 729
 ?>
730 730
 
731 731
 function iconColor(color) {
Please login to merge, or discard this patch.
Braces   +30 added lines, -5 removed lines patch added patch discarded remove patch
@@ -202,7 +202,12 @@  discard block
 block discarded – undo
202 202
 //				viewer.dataSources.get(dsn).entities.remove(entity);
203 203
 //			}
204 204
 			//console.log(entity.lastupdate);
205
-			if (parseInt(entity.lastupdate) < Math.floor(Date.now()-<?php if (isset($globalMapRefresh)) print $globalMapRefresh*2000; else print '60000'; ?>)) {
205
+			if (parseInt(entity.lastupdate) < Math.floor(Date.now()-<?php if (isset($globalMapRefresh)) {
206
+	print $globalMapRefresh*2000;
207
+} else {
208
+	print '60000';
209
+}
210
+?>)) {
206 211
 //				console.log('Remove an entity date');
207 212
 				viewer.dataSources.get(dsn).entities.remove(entity);
208 213
 			} else {
@@ -276,7 +281,12 @@  discard block
 block discarded – undo
276 281
 	} else {
277 282
 		for (var i = 0; i < viewer.dataSources.get(dsn).entities.values.length; i++) {
278 283
 			var entity = viewer.dataSources.get(dsn).entities.values[i];
279
-			if (parseInt(entity.lastupdatesat) < Math.floor(Date.now()-<?php if (isset($globalMapRefresh)) print $globalMapRefresh*2000; else print '60000'; ?>)) {
284
+			if (parseInt(entity.lastupdatesat) < Math.floor(Date.now()-<?php if (isset($globalMapRefresh)) {
285
+	print $globalMapRefresh*2000;
286
+} else {
287
+	print '60000';
288
+}
289
+?>)) {
280 290
 				viewer.dataSources.get(dsn).entities.remove(entity);
281 291
 			}
282 292
 		}
@@ -606,7 +616,12 @@  discard block
 block discarded – undo
606 616
 		if (!((isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS)) && (isset($_COOKIE['polar']) && $_COOKIE['polar'] == 'true')) {
607 617
 ?>
608 618
 update_polarLayer();
609
-setInterval(function(){update_polarLayer()},<?php if (isset($globalMapRefresh)) print $globalMapRefresh*1000*2; else print '60000'; ?>);
619
+setInterval(function(){update_polarLayer()},<?php if (isset($globalMapRefresh)) {
620
+	print $globalMapRefresh*1000*2;
621
+} else {
622
+	print '60000';
623
+}
624
+?>);
610 625
 <?php
611 626
 		}
612 627
 ?>
@@ -704,7 +719,12 @@  discard block
 block discarded – undo
704 719
 				}
705 720
 			}
706 721
 		}
707
-	,<?php if (isset($globalMapRefresh)) print $globalMapRefresh*1000; else print '30000'; ?>);
722
+	,<?php if (isset($globalMapRefresh)) {
723
+	print $globalMapRefresh*1000;
724
+} else {
725
+	print '30000';
726
+}
727
+?>);
708 728
 } else {
709 729
 	//var widget = new Cesium.CesiumWidget('archivebox');
710 730
 //	var timeline = new Cesium.Timeline(viewer);
@@ -723,7 +743,12 @@  discard block
 block discarded – undo
723 743
     if ((isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM)) {
724 744
 ?>
725 745
 update_atcLayer();
726
-setInterval(function(){update_atcLayer()},<?php if (isset($globalMapRefresh)) print $globalMapRefresh*1000*2; else print '60000'; ?>);
746
+setInterval(function(){update_atcLayer()},<?php if (isset($globalMapRefresh)) {
747
+	print $globalMapRefresh*1000*2;
748
+} else {
749
+	print '60000';
750
+}
751
+?>);
727 752
 <?php
728 753
     }
729 754
 ?>
Please login to merge, or discard this patch.
marine-data.php 2 patches
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -9,11 +9,11 @@  discard block
 block discarded – undo
9 9
 
10 10
 $from_archive = false;
11 11
 if (isset($_GET['ident'])) {
12
-	$ident = filter_input(INPUT_GET,'ident',FILTER_SANITIZE_STRING);
12
+	$ident = filter_input(INPUT_GET, 'ident', FILTER_SANITIZE_STRING);
13 13
 	if (isset($_GET['currenttime'])) {
14
-		$currenttime = filter_input(INPUT_GET,'currenttime',FILTER_SANITIZE_NUMBER_INT);
14
+		$currenttime = filter_input(INPUT_GET, 'currenttime', FILTER_SANITIZE_NUMBER_INT);
15 15
 		$currenttime = round($currenttime/1000);
16
-		$spotter_array = $MarineLive->getDateLiveMarineDataByIdent($ident,$currenttime);
16
+		$spotter_array = $MarineLive->getDateLiveMarineDataByIdent($ident, $currenttime);
17 17
 		/*
18 18
 		if (empty($spotter_array)) {
19 19
 			$from_archive = true;
@@ -31,11 +31,11 @@  discard block
 block discarded – undo
31 31
 	}
32 32
 }
33 33
 if (isset($_GET['fammarine_id'])) {
34
-	$fammarine_id = filter_input(INPUT_GET,'fammarine_id',FILTER_SANITIZE_STRING);
34
+	$fammarine_id = filter_input(INPUT_GET, 'fammarine_id', FILTER_SANITIZE_STRING);
35 35
 	if (isset($_GET['currenttime'])) {
36
-		$currenttime = filter_input(INPUT_GET,'currenttime',FILTER_SANITIZE_NUMBER_INT);
36
+		$currenttime = filter_input(INPUT_GET, 'currenttime', FILTER_SANITIZE_NUMBER_INT);
37 37
 		$currenttime = round($currenttime/1000);
38
-		$spotter_array = $MarineLive->getDateLiveMarineDataById($fammarine_id,$currenttime);
38
+		$spotter_array = $MarineLive->getDateLiveMarineDataById($fammarine_id, $currenttime);
39 39
 		/*
40 40
 		if (empty($spotter_array)) {
41 41
 			$from_archive = true;
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
 if (isset($spotter_item['image_thumbnail']) && $spotter_item['image_thumbnail'] != "")
63 63
 {
64 64
 	if ($spotter_item['image_source'] == 'flickr' || $spotter_item['image_source'] == 'wikimedia' || $spotter_item['image_source'] == 'devianart') {
65
-		$image = preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']);
65
+		$image = preg_replace("/^http:/i", "https:", $spotter_item['image_thumbnail']);
66 66
 	} else $image = $spotter_item['image_thumbnail'];
67 67
 
68 68
 }
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -63,7 +63,9 @@
 block discarded – undo
63 63
 {
64 64
 	if ($spotter_item['image_source'] == 'flickr' || $spotter_item['image_source'] == 'wikimedia' || $spotter_item['image_source'] == 'devianart') {
65 65
 		$image = preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']);
66
-	} else $image = $spotter_item['image_thumbnail'];
66
+	} else {
67
+		$image = $spotter_item['image_thumbnail'];
68
+	}
67 69
 
68 70
 }
69 71
 /* else {
Please login to merge, or discard this patch.
tracker-data.php 3 patches
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -63,7 +63,9 @@
 block discarded – undo
63 63
 {
64 64
 	if ($spotter_item['image_source'] == 'flickr' || $spotter_item['image_source'] == 'wikimedia' || $spotter_item['image_source'] == 'devianart') {
65 65
 		$image = preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']);
66
-	} else $image = $spotter_item['image_thumbnail'];
66
+	} else {
67
+		$image = $spotter_item['image_thumbnail'];
68
+	}
67 69
 
68 70
 }
69 71
 /* else {
Please login to merge, or discard this patch.
Indentation   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -78,10 +78,10 @@  discard block
 block discarded – undo
78 78
 print '<div class="details">';
79 79
 print '<div><span>'._("Altitude").'</span>';
80 80
 if (isset($globalGroundAltitude) && $globalGroundAltitude) {
81
-    try {
81
+	try {
82 82
 	$groundAltitude = $Elevation->getElevation($spotter_item['latitude'],$spotter_item['longitude']);
83
-    } catch(Exception $e) {
84
-    }
83
+	} catch(Exception $e) {
84
+	}
85 85
 }
86 86
 if ((!isset($_COOKIE['unitaltitude']) && isset($globalUnitAltitude) && $globalUnitAltitude == 'feet') || (isset($_COOKIE['unitaltitude']) && $_COOKIE['unitaltitude'] == 'feet')) {
87 87
 	print $spotter_item['altitude'].' feet (FL'.$spotter_item['altitude'].')';
@@ -89,14 +89,14 @@  discard block
 block discarded – undo
89 89
 	print round($spotter_item['altitude']*0.3048).' m (FL'.round($spotter_item['altitude']/100).')';
90 90
 }
91 91
 if (isset($groundAltitude) && $groundAltitude < $spotter_item['altitude']*0.3048) {
92
-    print '<br>';
93
-    print '<span>'._("Ground Altitude").'</span>';
94
-    if ((!isset($_COOKIE['unitaltitude']) && isset($globalUnitAltitude) && $globalUnitAltitude == 'feet') || (isset($_COOKIE['unitaltitude']) && $_COOKIE['unitaltitude'] == 'feet')) {
92
+	print '<br>';
93
+	print '<span>'._("Ground Altitude").'</span>';
94
+	if ((!isset($_COOKIE['unitaltitude']) && isset($globalUnitAltitude) && $globalUnitAltitude == 'feet') || (isset($_COOKIE['unitaltitude']) && $_COOKIE['unitaltitude'] == 'feet')) {
95 95
 	print round($groundAltitude*3.28084).' feet';
96
-    } else {
96
+	} else {
97 97
 	print round($groundAltitude).' m';
98
-    }
99
-    print '</i>';
98
+	}
99
+	print '</i>';
100 100
 }
101 101
 print '</div>';
102 102
 print '<div><span>'._("Speed").'</span>';
Please login to merge, or discard this patch.
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -11,14 +11,14 @@  discard block
 block discarded – undo
11 11
 
12 12
 $from_archive = false;
13 13
 if (isset($_GET['ident'])) {
14
-	$ident = urldecode(filter_input(INPUT_GET,'ident',FILTER_SANITIZE_STRING));
14
+	$ident = urldecode(filter_input(INPUT_GET, 'ident', FILTER_SANITIZE_STRING));
15 15
 	if (isset($_GET['currenttime'])) {
16
-		$currenttime = filter_input(INPUT_GET,'currenttime',FILTER_SANITIZE_NUMBER_INT);
16
+		$currenttime = filter_input(INPUT_GET, 'currenttime', FILTER_SANITIZE_NUMBER_INT);
17 17
 		$currenttime = round($currenttime/1000);
18
-		$spotter_array = $TrackerLive->getDateLiveTrackerDataByIdent($ident,$currenttime);
18
+		$spotter_array = $TrackerLive->getDateLiveTrackerDataByIdent($ident, $currenttime);
19 19
 		if (empty($spotter_array)) {
20 20
 			$from_archive = true;
21
-			$spotter_array = $TrackerArchive->getDateArchiveTrackerDataByIdent($ident,$currenttime);
21
+			$spotter_array = $TrackerArchive->getDateArchiveTrackerDataByIdent($ident, $currenttime);
22 22
 		}
23 23
 		
24 24
 	} else {
@@ -30,16 +30,16 @@  discard block
 block discarded – undo
30 30
 	}
31 31
 }
32 32
 if (isset($_GET['famtrackid'])) {
33
-	$famtrackid = urldecode(filter_input(INPUT_GET,'famtrackid',FILTER_SANITIZE_STRING));
33
+	$famtrackid = urldecode(filter_input(INPUT_GET, 'famtrackid', FILTER_SANITIZE_STRING));
34 34
 	if (isset($_GET['currenttime'])) {
35
-		$currenttime = filter_input(INPUT_GET,'currenttime',FILTER_SANITIZE_NUMBER_INT);
35
+		$currenttime = filter_input(INPUT_GET, 'currenttime', FILTER_SANITIZE_NUMBER_INT);
36 36
 		$currenttime = round($currenttime/1000);
37
-		$spotter_array = $TrackerLive->getDateLiveTrackerDataById($famtrackid,$currenttime);
37
+		$spotter_array = $TrackerLive->getDateLiveTrackerDataById($famtrackid, $currenttime);
38 38
 		
39 39
 		if (empty($spotter_array)) {
40 40
 			$from_archive = true;
41 41
 //			$spotter_array = $SpotterArchive->getLastArchiveSpotterDataById($flightaware_id);
42
-			$spotter_array = $TrackerArchive->getDateArchiveTrackerDataById($famtrackid,$currenttime);
42
+			$spotter_array = $TrackerArchive->getDateArchiveTrackerDataById($famtrackid, $currenttime);
43 43
 		}
44 44
 		
45 45
 	} else {
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
 if (isset($spotter_item['image_thumbnail']) && $spotter_item['image_thumbnail'] != "")
60 60
 {
61 61
 	if ($spotter_item['image_source'] == 'flickr' || $spotter_item['image_source'] == 'wikimedia' || $spotter_item['image_source'] == 'devianart') {
62
-		$image = preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']);
62
+		$image = preg_replace("/^http:/i", "https:", $spotter_item['image_thumbnail']);
63 63
 	} else $image = $spotter_item['image_thumbnail'];
64 64
 
65 65
 }
@@ -79,8 +79,8 @@  discard block
 block discarded – undo
79 79
 print '<div><span>'._("Altitude").'</span>';
80 80
 if (isset($globalGroundAltitude) && $globalGroundAltitude) {
81 81
     try {
82
-	$groundAltitude = $Elevation->getElevation($spotter_item['latitude'],$spotter_item['longitude']);
83
-    } catch(Exception $e) {
82
+	$groundAltitude = $Elevation->getElevation($spotter_item['latitude'], $spotter_item['longitude']);
83
+    } catch (Exception $e) {
84 84
     }
85 85
 }
86 86
 if ((!isset($_COOKIE['unitaltitude']) && isset($globalUnitAltitude) && $globalUnitAltitude == 'feet') || (isset($_COOKIE['unitaltitude']) && $_COOKIE['unitaltitude'] == 'feet')) {
Please login to merge, or discard this patch.