Completed
Push — master ( f1954e...8053db )
by Yannick
07:25
created
table-output.php 2 patches
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -264,7 +264,7 @@  discard block
 block discarded – undo
264 264
 				print '<th class="arrival"><span class="nomobile">'._("Going to").'</span><span class="mobile">'._("To").'</span></th>';
265 265
 			}
266 266
 		}
267
-    		if ($type == 'aircraft') {
267
+			if ($type == 'aircraft') {
268 268
 			if ((isset($globalVA) && $globalVA) || (isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalVAM) && $globalVAM) || (isset($globalphpVMS) && $globalphpVMS)) {
269 269
 				print '<th class="pilot"><span class="nomobile">'._("Pilot name").'</span><span class="mobile">'._("Pilot").'</span></a></th>';
270 270
 			} else {
@@ -530,7 +530,7 @@  discard block
 block discarded – undo
530 530
 	} elseif(strtolower($current_page) != "currently" && strtolower($current_page) != "upcoming" && strtolower($current_page) != "acars-latest" && strtolower($current_page) != "acars-archive" && strtolower($current_page) != "accident-latest" && strtolower($current_page) != "incident-latest" && strtolower($current_page) != "accident-detailed" && strtolower($current_page) != "incident-detailed"){
531 531
 		if ($type == 'aircraft') {
532 532
 			if (!isset($spotter_item['squawk']) || $spotter_item['squawk'] == 0) {
533
-			    $spotter_item['squawk'] = '-';
533
+				$spotter_item['squawk'] = '-';
534 534
 			}
535 535
 			if ($spotter_item['image_thumbnail'] != "")
536 536
 			{
@@ -569,7 +569,7 @@  discard block
 block discarded – undo
569 569
 				print '</td>'."\n";
570 570
 			} else {
571 571
 				print '<td class="aircraft_thumbnail">'."\n";
572
-	       //   	 	print '<a href="'.$globalURL.'/flightid/'.$spotter_item['spotter_id'].'"><img src="'.$globalURL.'/images/placeholder_thumb.png" alt="Click to see more information about this flight" title="Click to see more information about this flight" width="100px" /></a>';
572
+		   //   	 	print '<a href="'.$globalURL.'/flightid/'.$spotter_item['spotter_id'].'"><img src="'.$globalURL.'/images/placeholder_thumb.png" alt="Click to see more information about this flight" title="Click to see more information about this flight" width="100px" /></a>';
573 573
 		//}
574 574
 				if (!isset($spotter_item['airline_name']) && !isset($spotter_item['aircraft_name'])) {
575 575
 					print '<a href="'.$globalURL.'/flightid/'.$spotter_item['spotter_id'].'"><img src="'.$globalURL.'/images/placeholder_thumb.png" class="img-rounded" data-toggle="popover" title="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '._("Not available").'" alt="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '._("Not available").'" data-content="'._("Registration:").' '.$spotter_item['registration'].'<br />'._("Aircraft:").' '._("Not available").' ('.$spotter_item['aircraft_type'].')<br />'._("Airline:").' '._("Not available").'<br />'._("Squawk:").' '.$spotter_item['squawk'].'" data-html="true" width="100px" /></a>'."\n";
Please login to merge, or discard this patch.
Braces   +63 added lines, -23 removed lines patch added patch discarded remove patch
@@ -7,7 +7,9 @@  discard block
 block discarded – undo
7 7
 $showRouteStop = $Common->multiKeyExists($spotter_array,'route_stop');
8 8
 $showDuration = $Common->multiKeyExists($spotter_array,'duration');
9 9
 
10
-if (!isset($type)) $type = 'aircraft';
10
+if (!isset($type)) {
11
+	$type = 'aircraft';
12
+}
11 13
 
12 14
 if (!isset($_GET['sort'])) 
13 15
 {
@@ -440,7 +442,9 @@  discard block
 block discarded – undo
440 442
 	if (isset($globalTimezone))
441 443
 	{
442 444
 		date_default_timezone_set($globalTimezone);
443
-	} else date_default_timezone_set('UTC');
445
+	} else {
446
+		date_default_timezone_set('UTC');
447
+	}
444 448
 	if ($showSpecial === true)
445 449
 	{
446 450
 		print '<tr class="special">'."\n";
@@ -455,7 +459,9 @@  discard block
 block discarded – undo
455 459
 			print '<tr class="active">';
456 460
 		} elseif (isset($spotter_item['spotted_registration'])) {
457 461
 			print '<tr class="info">';
458
-		} else print '<tr>';
462
+		} else {
463
+			print '<tr>';
464
+		}
459 465
 	}
460 466
 	if (strtolower($current_page) == "acars-latest" || strtolower($current_page) == "acars-archive" || strtolower($current_page) == "currently" || strtolower($current_page) == "accident-latest" || strtolower($current_page) == "incident-latest" || strtolower($current_page) == "accident-detailed" || strtolower($current_page) == "incident-detailed") {
461 467
 		if ($type == 'aircraft') {
@@ -463,8 +469,9 @@  discard block
 block discarded – undo
463 469
 			{
464 470
 				print '<td class="aircraft_thumbnail">'."\n";
465 471
 				if ($spotter_item['image_source'] == 'planespotters') {
466
-					if ($spotter_item['image_source_website'] != '') $image_src = $spotter_item['image_source_website'];
467
-					else {
472
+					if ($spotter_item['image_source_website'] != '') {
473
+						$image_src = $spotter_item['image_source_website'];
474
+					} else {
468 475
 						$planespotter_url_array = explode("_", $spotter_item['image']);
469 476
 						$planespotter_id = str_replace(".jpg", "", $planespotter_url_array[1]);
470 477
 						$image_src = 'https://www.planespotters.net/Aviation_Photos/photo.show?id='.$planespotter_id;
@@ -477,7 +484,9 @@  discard block
 block discarded – undo
477 484
 				} else {
478 485
 					if ($spotter_item['image_source'] == 'wikimedia' || $spotter_item['image_source'] == 'devianart' || $spotter_item['image_source'] == 'flickr') {
479 486
 						$image_thumbnail = preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']);
480
-					} else 	$image_thumbnail = $spotter_item['image_thumbnail'];
487
+					} else {
488
+						$image_thumbnail = $spotter_item['image_thumbnail'];
489
+					}
481 490
 					if (isset($spotter_item['airline_name'])) {
482 491
 						print '<img src="'.$image_thumbnail.'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['registration'].' - '.$spotter_item['airline_name'].'" alt="'.$spotter_item['registration'].' - '.$spotter_item['airline_name'].'" data-content="'._("Registration:").' '.$spotter_item['registration'].'<br />'._("Airline:").' '.$spotter_item['airline_name'].'" data-html="true" width="100px" />'."\n".'<div class="thumbnail-copyright">&copy; '.$spotter_item['image_copyright'].'</div>';
483 492
 					} else {
@@ -496,7 +505,9 @@  discard block
 block discarded – undo
496 505
 				print '<td class="aircraft_thumbnail">'."\n";
497 506
 				if ($spotter_item['image_source'] == 'wikimedia' || $spotter_item['image_source'] == 'devianart' || $spotter_item['image_source'] == 'flickr') {
498 507
 					$image_thumbnail = preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']);
499
-				} else 	$image_thumbnail = $spotter_item['image_thumbnail'];
508
+				} else {
509
+					$image_thumbnail = $spotter_item['image_thumbnail'];
510
+				}
500 511
 				if (isset($spotter_item['airline_name'])) {
501 512
 					print '<img src="'.$image_thumbnail.'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['mmsi'].'" alt="'.$spotter_item['mmsi'].'" data-content="'._("MMSI:").' '.$spotter_item['mmsi'].'" data-html="true" width="100px" />'."\n".'<div class="thumbnail-copyright">&copy; '.$spotter_item['image_copyright'].'</div>';
502 513
 				} else {
@@ -514,7 +525,9 @@  discard block
 block discarded – undo
514 525
 				print '<td class="aircraft_thumbnail">'."\n";
515 526
 				if ($spotter_item['image_source'] == 'wikimedia' || $spotter_item['image_source'] == 'devianart' || $spotter_item['image_source'] == 'flickr') {
516 527
 					$image_thumbnail = preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']);
517
-				} else 	$image_thumbnail = $spotter_item['image_thumbnail'];
528
+				} else {
529
+					$image_thumbnail = $spotter_item['image_thumbnail'];
530
+				}
518 531
 				if (isset($spotter_item['airline_name'])) {
519 532
 					print '<img src="'.$image_thumbnail.'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['ident'].'" alt="'.$spotter_item['type'].'" data-content="'._("Type:").' '.$spotter_item['type'].'" data-html="true" width="100px" />'."\n".'<div class="thumbnail-copyright">&copy; '.$spotter_item['image_copyright'].'</div>';
520 533
 				} else {
@@ -537,8 +550,9 @@  discard block
 block discarded – undo
537 550
 				print '<td class="aircraft_thumbnail">'."\n";
538 551
 				//print '<a href="'.$globalURL.'/flightid/'.$spotter_item['spotter_id'].'"><img src="'.$spotter_item['image_thumbnail'].'" alt="Click to see more information about this flight" title="Click to see more information about this flight" width="100px" /></a>';
539 552
 				if ($spotter_item['image_source'] == 'planespotters') {
540
-					if ($spotter_item['image_source_website'] != '') $image_src = $spotter_item['image_source_website'];
541
-					else {
553
+					if ($spotter_item['image_source_website'] != '') {
554
+						$image_src = $spotter_item['image_source_website'];
555
+					} else {
542 556
 						$planespotter_url_array = explode("_", $spotter_array[0]['image']);
543 557
 						$planespotter_id = str_replace(".jpg", "", $planespotter_url_array[1]);
544 558
 						$image_src = 'https://www.planespotters.net/Aviation_Photos/photo.show?id='.$planespotter_id;
@@ -555,7 +569,9 @@  discard block
 block discarded – undo
555 569
 				} else {
556 570
 					if ($spotter_item['image_source'] == 'wikimedia' || $spotter_item['image_source'] == 'devianart' || $spotter_item['image_source'] == 'flickr') {
557 571
 						$image_thumbnail = preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']);
558
-					} else 	$image_thumbnail = $spotter_item['image_thumbnail'];
572
+					} else {
573
+						$image_thumbnail = $spotter_item['image_thumbnail'];
574
+					}
559 575
 					if (!isset($spotter_item['airline_name']) && isset($spotter_item['aircraft_name'])) {
560 576
 						print '<a href="'.$globalURL.'/flightid/'.$spotter_item['spotter_id'].'"><img src="'.$image_thumbnail.'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '._("Not available").'" alt="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '._("Not available").'" data-content="'._("Registration:").' '.$spotter_item['registration'].'<br />'._("Aircraft:").' '.$spotter_item['aircraft_name'].' ('.$spotter_item['aircraft_type'].')<br />'._("Airline:").' '._("Not available").'<br />'._("Squawk:").' '.$spotter_item['squawk'].'" data-html="true" width="100px" /></a>'."\n".'<div class="thumbnail-copyright">&copy; '.$spotter_item['image_copyright'].'</div>';
561 577
 					} elseif (!isset($spotter_item['aircraft_name']) && isset($spotter_item['airline_name'])) {
@@ -588,7 +604,9 @@  discard block
 block discarded – undo
588 604
 				print '<td class="aircraft_thumbnail">'."\n";
589 605
 				if ($spotter_item['image_source'] == 'wikimedia' || $spotter_item['image_source'] == 'devianart' || $spotter_item['image_source'] == 'flickr') {
590 606
 					$image_thumbnail = preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']);
591
-				} else 	$image_thumbnail = $spotter_item['image_thumbnail'];
607
+				} else {
608
+					$image_thumbnail = $spotter_item['image_thumbnail'];
609
+				}
592 610
 				print '<img src="'.$image_thumbnail.'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['mmsi'].'" alt="'.$spotter_item['mmsi'].'" data-content="'._("MMSI:").' '.$spotter_item['mmsi'].'" data-html="true" width="100px" />'."\n".'<div class="thumbnail-copyright">&copy; '.$spotter_item['image_copyright'].'</div>';
593 611
 				print '</td>'."\n";
594 612
 			} else {
@@ -602,7 +620,9 @@  discard block
 block discarded – undo
602 620
 				print '<td class="aircraft_thumbnail">'."\n";
603 621
 				if ($spotter_item['image_source'] == 'wikimedia' || $spotter_item['image_source'] == 'devianart' || $spotter_item['image_source'] == 'flickr') {
604 622
 					$image_thumbnail = preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']);
605
-				} else 	$image_thumbnail = $spotter_item['image_thumbnail'];
623
+				} else {
624
+					$image_thumbnail = $spotter_item['image_thumbnail'];
625
+				}
606 626
 				print '<img src="'.$image_thumbnail.'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['ident'].'" alt="'.$spotter_item['type'].'" data-content="'._("Type:").' '.$spotter_item['type'].'" data-html="true" width="100px" />'."\n".'<div class="thumbnail-copyright">&copy; '.$spotter_item['image_copyright'].'</div>';
607 627
 				print '</td>'."\n";
608 628
 			} else {
@@ -723,15 +743,21 @@  discard block
 block discarded – undo
723 743
 			if (isset($spotter_item['departure_airport_time']) && isset($spotter_item['real_departure_airport_time'])) {
724 744
 				if ($spotter_item['departure_airport_time'] > 2460) {
725 745
 					$departure_airport_time = date('H:m',$spotter_item['departure_airport_time']);
726
-				} else $departure_airport_time = substr($spotter_item['departure_airport_time'],0,-2).':'.substr($spotter_item['departure_airport_time'],-2);
746
+				} else {
747
+					$departure_airport_time = substr($spotter_item['departure_airport_time'],0,-2).':'.substr($spotter_item['departure_airport_time'],-2);
748
+				}
727 749
 				if ($spotter_item['real_departure_airport_time'] > 2460) {
728 750
 					$real_departure_airport_time = date('H:m',$spotter_item['real_departure_airport_time']);
729
-				} else $real_departure_airport_time = $spotter_item['real_departure_airport_time'];
751
+				} else {
752
+					$real_departure_airport_time = $spotter_item['real_departure_airport_time'];
753
+				}
730 754
 				print '<br /><span class="airport_time">'.$departure_airport_time.' ('.$real_departure_airport_time.')</span>'."\n";
731 755
 			} elseif (isset($spotter_item['real_departure_airport_time']) && $spotter_item['real_departure_airport_time'] != 'NULL') {
732 756
 				if ($spotter_item['real_departure_airport_time'] > 2460) {
733 757
 					$real_departure_airport_time = date('H:m',$spotter_item['real_departure_airport_time']);
734
-				} else $real_departure_airport_time = $spotter_item['real_departure_airport_time'];
758
+				} else {
759
+					$real_departure_airport_time = $spotter_item['real_departure_airport_time'];
760
+				}
735 761
 				print '<br /><span class="airport_time">'.$real_departure_airport_time.'</span>'."\n";
736 762
 			} elseif (isset($spotter_item['departure_airport_time']) && $spotter_item['departure_airport_time'] != 'NULL') {
737 763
 				if ($spotter_item['departure_airport_time'] > 2460) {
@@ -753,7 +779,9 @@  discard block
 block discarded – undo
753 779
 						$longitude = $spotter_item['longitude'];
754 780
 					}
755 781
 					$distance = $Spotter->getAirportDistance($spotter_item['departure_airport'],$latitude,$longitude);
756
-				} else $distance = '';
782
+				} else {
783
+					$distance = '';
784
+				}
757 785
 				if ($distance != '') {
758 786
 					if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'nm') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'nm')) {
759 787
 						echo '<br/><i>'.round($distance*0.539957).' nm</i>';
@@ -780,7 +808,9 @@  discard block
 block discarded – undo
780 808
 			} else {
781 809
 				if (isset($spotter_item['real_arrival_airport']) && $spotter_item['real_arrival_airport'] != $spotter_item['arrival_airport']) {
782 810
 					print '<span class="nomobile">Scheduled : <a href="'.$globalURL.'/airport/'.$spotter_item['arrival_airport'].'">'.$spotter_item['arrival_airport_city'].', '.$spotter_item['arrival_airport_country'].' ('.$spotter_item['arrival_airport'].')</a></span>'."\n";
783
-					if (!isset($Spotter)) $Spotter = new Spotter();
811
+					if (!isset($Spotter)) {
812
+						$Spotter = new Spotter();
813
+					}
784 814
 					$arrival_airport_info = $Spotter->getAllAirportInfo($spotter_item['real_arrival_airport']);
785 815
 					print '<br /><span class="nomobile">'._("Real:").' <a href="'.$globalURL.'/airport/'.$spotter_item['real_arrival_airport'].'">'.$arrival_airport_info[0]['city'].','.$arrival_airport_info[0]['country'].' ('.$spotter_item['real_arrival_airport'].')</a></span>'."\n";
786 816
 					print '<span class="mobile">'._("Scheduled:").' <a href="'.$globalURL.'/airport/'.$spotter_item['real_arrival_airport'].'">'.$spotter_item['real_arrival_airport'].'</a></span>'."\n";
@@ -796,20 +826,28 @@  discard block
 block discarded – undo
796 826
 			if (isset($spotter_item['arrival_airport_time']) && isset($spotter_item['real_arrival_airport_time'])) {
797 827
 				if ($spotter_item['arrival_airport_time'] > 2460) {
798 828
 					$arrival_airport_time = date('H:m',$spotter_item['arrival_airport_time']);
799
-				} else $arrival_airport_time = $spotter_item['arrival_airport_time'];
829
+				} else {
830
+					$arrival_airport_time = $spotter_item['arrival_airport_time'];
831
+				}
800 832
 				if ($spotter_item['real_arrival_airport_time'] > 2460) {
801 833
 					$real_arrival_airport_time = date('H:m',$spotter_item['real_arrival_airport_time']);
802
-				} else $real_arrival_airport_time = $spotter_item['real_arrival_airport_time'];
834
+				} else {
835
+					$real_arrival_airport_time = $spotter_item['real_arrival_airport_time'];
836
+				}
803 837
 				print '<br /><span class="airport_time">'.$spotter_item['arrival_airport_time'].' ('.$spotter_item['real_arrival_airport_time'].')</span>'."\n";
804 838
 			} elseif (isset($spotter_item['real_arrival_airport_time'])) {
805 839
 				if ($spotter_item['real_arrival_airport_time'] > 2460) {
806 840
 					$real_arrival_airport_time = date('H:m',$spotter_item['real_arrival_airport_time']);
807
-				} else $real_arrival_airport_time = $spotter_item['real_arrival_airport_time'];
841
+				} else {
842
+					$real_arrival_airport_time = $spotter_item['real_arrival_airport_time'];
843
+				}
808 844
 				print '<br /><span class="airport_time">'.$real_arrival_airport_time.'</span>'."\n";
809 845
 			} elseif (isset($spotter_item['arrival_airport_time']) && $spotter_item['arrival_airport_time'] != 'NULL') {
810 846
 				if ($spotter_item['arrival_airport_time'] > 2460) {
811 847
 					$arrival_airport_time = date('H:m',$spotter_item['arrival_airport_time']);
812
-				} else $arrival_airport_time = $spotter_item['arrival_airport_time'];
848
+				} else {
849
+					$arrival_airport_time = $spotter_item['arrival_airport_time'];
850
+				}
813 851
 				print '<br /><span class="airport_time">'.$arrival_airport_time.'</span>'."\n";
814 852
 			}
815 853
 			if (!isset($spotter_item['real_arrival_airport']) && $spotter_item['arrival_airport'] != 'NA') {
@@ -822,7 +860,9 @@  discard block
 block discarded – undo
822 860
 						$longitude = $spotter_item['longitude'];
823 861
 					}
824 862
 					$distance = $Spotter->getAirportDistance($spotter_item['arrival_airport'],$latitude,$longitude);
825
-				} else $distance = '';
863
+				} else {
864
+					$distance = '';
865
+				}
826 866
 				if ($distance != '') {
827 867
 					if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'nm') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'nm')) {
828 868
 						echo '<br/><i>'.round($distance*0.539957).' nm</i>';
Please login to merge, or discard this patch.
latest.php 1 patch
Braces   +9 added lines, -4 removed lines patch added patch discarded remove patch
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
 	$limit_start = 0;
29 29
 	$limit_end = 25;
30 30
 	$absolute_difference = 25;
31
-}  else {
31
+} else {
32 32
 	$limit_explode = explode(",", $_GET['limit']);
33 33
 	$limit_start = $limit_explode[0];
34 34
 	$limit_end = $limit_explode[1];
@@ -47,9 +47,14 @@  discard block
 block discarded – undo
47 47
 print '<h1>'._("Latest Activity").'</h1>';
48 48
 print '</div>';
49 49
 print '<div class="table column">';
50
-if ($type == 'marine') print '<p>'._("The table below shows the detailed information of all recent vessels.").'</p>';
51
-if ($type == 'tracker') print '<p>'._("The table below shows the detailed information of all recent trackers.").'</p>';
52
-else print '<p>'._("The table below shows the detailed information of all recent flights.").'</p>';
50
+if ($type == 'marine') {
51
+	print '<p>'._("The table below shows the detailed information of all recent vessels.").'</p>';
52
+}
53
+if ($type == 'tracker') {
54
+	print '<p>'._("The table below shows the detailed information of all recent trackers.").'</p>';
55
+} else {
56
+	print '<p>'._("The table below shows the detailed information of all recent flights.").'</p>';
57
+}
53 58
 
54 59
 $sort = filter_input(INPUT_GET,'sort',FILTER_SANITIZE_STRING);
55 60
 $sql_begin = microtime(true);
Please login to merge, or discard this patch.
ident-detailed.php 1 patch
Braces   +22 added lines, -8 removed lines patch added patch discarded remove patch
@@ -118,8 +118,12 @@  discard block
 block discarded – undo
118 118
 	{
119 119
 		$title = sprintf(_("Detailed View for %s"),$spotter_array[0]['ident']);
120 120
 		$ident = $spotter_array[0]['ident'];
121
-		if (isset($spotter_array[0]['latitude'])) $latitude = $spotter_array[0]['latitude'];
122
-		if (isset($spotter_array[0]['longitude'])) $longitude = $spotter_array[0]['longitude'];
121
+		if (isset($spotter_array[0]['latitude'])) {
122
+			$latitude = $spotter_array[0]['latitude'];
123
+		}
124
+		if (isset($spotter_array[0]['longitude'])) {
125
+			$longitude = $spotter_array[0]['longitude'];
126
+		}
123 127
 		require_once('header.php');
124 128
 		if (isset($globalArchive) && $globalArchive && $type == 'aircraft') {
125 129
 			// Requirement for altitude graph
@@ -127,7 +131,9 @@  discard block
 block discarded – undo
127 131
 			$all_data = $SpotterArchive->getAltitudeSpeedArchiveSpotterDataById($spotter_array[0]['flightaware_id']);
128 132
 			if (isset($globalTimezone)) {
129 133
 				date_default_timezone_set($globalTimezone);
130
-			} else date_default_timezone_set('UTC');
134
+			} else {
135
+				date_default_timezone_set('UTC');
136
+			}
131 137
 			if (count($all_data) > 0) {
132 138
 				print '<div id="chart6" class="chart" width="100%"></div>
133 139
                     <script> 
@@ -174,14 +180,22 @@  discard block
 block discarded – undo
174 180
 		if (isset($spotter_array[0]['airline_icao'])) {
175 181
 			print '<div><span class="label">'._("Airline").'</span><a href="'.$globalURL.'/airline/'.$spotter_array[0]['airline_icao'].'">'.$spotter_array[0]['airline_name'].'</a></div>'; 
176 182
 		}
177
-		if ($type == 'aircraft') print '<div><span class="label">'._("Flight History").'</span><a href="http://flightaware.com/live/flight/'.$spotter_array[0]['ident'].'" target="_blank">'._("View the Flight History of this callsign").'</a></div>';
183
+		if ($type == 'aircraft') {
184
+			print '<div><span class="label">'._("Flight History").'</span><a href="http://flightaware.com/live/flight/'.$spotter_array[0]['ident'].'" target="_blank">'._("View the Flight History of this callsign").'</a></div>';
185
+		}
178 186
 		print '</div>';
179 187
 	
180
-		if ($type == 'aircraft') include('ident-sub-menu.php');
188
+		if ($type == 'aircraft') {
189
+			include('ident-sub-menu.php');
190
+		}
181 191
 		print '<div class="table column">';
182
-		if ($type == 'aircraft') print '<p>'.sprintf(_("The table below shows the detailed information of all flights with the ident/callsign of <strong>%s</strong>."),$spotter_array[0]['ident']).'</p>';
183
-		elseif ($type == 'marine') print '<p>'.sprintf(_("The table below shows the detailed information of all vessels with the ident/callsign of <strong>%s</strong>."),$spotter_array[0]['ident']).'</p>';
184
-		elseif ($type == 'tracker') print '<p>'.sprintf(_("The table below shows the detailed information of all trackers with the ident/callsign of <strong>%s</strong>."),$spotter_array[0]['ident']).'</p>';
192
+		if ($type == 'aircraft') {
193
+			print '<p>'.sprintf(_("The table below shows the detailed information of all flights with the ident/callsign of <strong>%s</strong>."),$spotter_array[0]['ident']).'</p>';
194
+		} elseif ($type == 'marine') {
195
+			print '<p>'.sprintf(_("The table below shows the detailed information of all vessels with the ident/callsign of <strong>%s</strong>."),$spotter_array[0]['ident']).'</p>';
196
+		} elseif ($type == 'tracker') {
197
+			print '<p>'.sprintf(_("The table below shows the detailed information of all trackers with the ident/callsign of <strong>%s</strong>."),$spotter_array[0]['ident']).'</p>';
198
+		}
185 199
 
186 200
 		include('table-output.php'); 
187 201
 		print '<div class="pagination">';
Please login to merge, or discard this patch.
currently.php 1 patch
Braces   +24 added lines, -12 removed lines patch added patch discarded remove patch
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
 	$limit_start = 0;
32 32
 	$limit_end = 25;
33 33
 	$absolute_difference = 25;
34
-}  else {
34
+} else {
35 35
 	$limit_explode = explode(",", $_GET['limit']);
36 36
 	$limit_start = $limit_explode[0];
37 37
 	$limit_end = $limit_explode[1];
@@ -50,20 +50,32 @@  discard block
 block discarded – undo
50 50
 print '</div>';
51 51
 
52 52
 print '<div class="table column">';
53
-if ($type == 'aircraft') print '<p>'._("The table below shows the detailed information of all current flights.").'</p>';
54
-elseif ($type == 'marine') print '<p>'._("The table below shows the detailed information of all current vessels.").'</p>';
55
-elseif ($type == 'tracker') print '<p>'._("The table below shows the detailed information of all current trackers.").'</p>';
53
+if ($type == 'aircraft') {
54
+	print '<p>'._("The table below shows the detailed information of all current flights.").'</p>';
55
+} elseif ($type == 'marine') {
56
+	print '<p>'._("The table below shows the detailed information of all current vessels.").'</p>';
57
+} elseif ($type == 'tracker') {
58
+	print '<p>'._("The table below shows the detailed information of all current trackers.").'</p>';
59
+}
56 60
 
57 61
 $sort = filter_input(INPUT_GET,'sort',FILTER_SANITIZE_STRING);
58 62
 if ($sort != '') {
59
-	if ($type == 'aircraft') $spotter_array = $SpotterLive->getLiveSpotterData($limit_start.",".$absolute_difference, $sort);
60
-	elseif ($type == 'marine') $spotter_array = $MarineLive->getLiveMarineData($limit_start.",".$absolute_difference, $sort);
61
-	elseif ($type == 'tracker') $spotter_array = $TrackerLive->getLiveTrackerData($limit_start.",".$absolute_difference, $sort);
62
-} else {
63
-	if ($type == 'aircraft') $spotter_array = $SpotterLive->getLiveSpotterData($limit_start.",".$absolute_difference);
64
-	elseif ($type == 'marine') $spotter_array = $MarineLive->getLiveMarineData($limit_start.",".$absolute_difference);
65
-	elseif ($type == 'tracker') $spotter_array = $TrackerLive->getLiveTrackerData($limit_start.",".$absolute_difference);
66
-}
63
+	if ($type == 'aircraft') {
64
+		$spotter_array = $SpotterLive->getLiveSpotterData($limit_start.",".$absolute_difference, $sort);
65
+	} elseif ($type == 'marine') {
66
+		$spotter_array = $MarineLive->getLiveMarineData($limit_start.",".$absolute_difference, $sort);
67
+	} elseif ($type == 'tracker') {
68
+		$spotter_array = $TrackerLive->getLiveTrackerData($limit_start.",".$absolute_difference, $sort);
69
+	}
70
+	} else {
71
+	if ($type == 'aircraft') {
72
+		$spotter_array = $SpotterLive->getLiveSpotterData($limit_start.",".$absolute_difference);
73
+	} elseif ($type == 'marine') {
74
+		$spotter_array = $MarineLive->getLiveMarineData($limit_start.",".$absolute_difference);
75
+	} elseif ($type == 'tracker') {
76
+		$spotter_array = $TrackerLive->getLiveTrackerData($limit_start.",".$absolute_difference);
77
+	}
78
+	}
67 79
 
68 80
 if (!empty($spotter_array))
69 81
 {
Please login to merge, or discard this patch.
date.php 1 patch
Braces   +15 added lines, -6 removed lines patch added patch discarded remove patch
@@ -1,11 +1,20 @@
 block discarded – undo
1 1
 <?php
2 2
 require_once(dirname(__FILE__).'/require/settings.php');
3 3
 $type = 'aircraft';
4
-if (isset($_GET['marine'])) $type = 'marine';
5
-elseif (isset($_GET['tracker'])) $type = 'tracker';
4
+if (isset($_GET['marine'])) {
5
+	$type = 'marine';
6
+} elseif (isset($_GET['tracker'])) {
7
+	$type = 'tracker';
8
+}
6 9
 $date = filter_input(INPUT_POST,'date',FILTER_SANITIZE_STRING);
7
-if ($date == '') $date = date('Y-m-d');
8
-if ($type == 'marine') header('Location: '.$globalURL.'/marine/date/'.$date);
9
-elseif ($type == 'tracker') header('Location: '.$globalURL.'/tracker/date/'.$date);
10
-else header('Location: '.$globalURL.'/date/'.$date);
10
+if ($date == '') {
11
+	$date = date('Y-m-d');
12
+}
13
+if ($type == 'marine') {
14
+	header('Location: '.$globalURL.'/marine/date/'.$date);
15
+} elseif ($type == 'tracker') {
16
+	header('Location: '.$globalURL.'/tracker/date/'.$date);
17
+} else {
18
+	header('Location: '.$globalURL.'/date/'.$date);
19
+}
11 20
 ?>
12 21
\ No newline at end of file
Please login to merge, or discard this patch.
date-detailed.php 1 patch
Braces   +37 added lines, -16 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
 		$limit_start = 0;
30 30
 		$limit_end = 25;
31 31
 		$absolute_difference = 25;
32
-	}  else {
32
+	} else {
33 33
 		$limit_explode = explode(",", $_GET['limit']);
34 34
 		$limit_start = $limit_explode[0];
35 35
 		$limit_end = $limit_explode[1];
@@ -46,21 +46,33 @@  discard block
 block discarded – undo
46 46
 	$sort = filter_input(INPUT_GET,'sort',FILTER_SANITIZE_STRING);
47 47
 	if ($sort != '') 
48 48
 	{
49
-		if ($type == 'marine') $spotter_array = $Marine->getMarineDataByDate($date,$limit_start.",".$absolute_difference, $sort);
50
-		elseif ($type == 'tracker') $spotter_array = $Tracker->getTrackerDataByDate($date,$limit_start.",".$absolute_difference, $sort);
51
-		else $spotter_array = $Spotter->getSpotterDataByDate($date,$limit_start.",".$absolute_difference, $sort);
49
+		if ($type == 'marine') {
50
+			$spotter_array = $Marine->getMarineDataByDate($date,$limit_start.",".$absolute_difference, $sort);
51
+		} elseif ($type == 'tracker') {
52
+			$spotter_array = $Tracker->getTrackerDataByDate($date,$limit_start.",".$absolute_difference, $sort);
53
+		} else {
54
+			$spotter_array = $Spotter->getSpotterDataByDate($date,$limit_start.",".$absolute_difference, $sort);
55
+		}
52 56
 	} else {
53
-		if ($type == 'marine') $spotter_array = $Marine->getMarineDataByDate($date,$limit_start.",".$absolute_difference);
54
-		elseif ($type == 'tracker') $spotter_array = $Tracker->getTrackerDataByDate($date,$limit_start.",".$absolute_difference);
55
-		else $spotter_array = $Spotter->getSpotterDataByDate($date,$limit_start.",".$absolute_difference);
57
+		if ($type == 'marine') {
58
+			$spotter_array = $Marine->getMarineDataByDate($date,$limit_start.",".$absolute_difference);
59
+		} elseif ($type == 'tracker') {
60
+			$spotter_array = $Tracker->getTrackerDataByDate($date,$limit_start.",".$absolute_difference);
61
+		} else {
62
+			$spotter_array = $Spotter->getSpotterDataByDate($date,$limit_start.",".$absolute_difference);
63
+		}
56 64
 	}
57 65
 	
58 66
 	if (!empty($spotter_array))
59 67
 	{
60 68
 		date_default_timezone_set($globalTimezone);
61
-		if ($type == 'marine') $title = sprintf(_("Detailed View for vessels from %s"),date("l F j, Y", strtotime($spotter_array[0]['date_iso_8601'])));
62
-		elseif ($type == 'tracker') $title = sprintf(_("Detailed View for trackers from %s"),date("l F j, Y", strtotime($spotter_array[0]['date_iso_8601'])));
63
-		else $title = sprintf(_("Detailed View for flights from %s"),date("l F j, Y", strtotime($spotter_array[0]['date_iso_8601'])));
69
+		if ($type == 'marine') {
70
+			$title = sprintf(_("Detailed View for vessels from %s"),date("l F j, Y", strtotime($spotter_array[0]['date_iso_8601'])));
71
+		} elseif ($type == 'tracker') {
72
+			$title = sprintf(_("Detailed View for trackers from %s"),date("l F j, Y", strtotime($spotter_array[0]['date_iso_8601'])));
73
+		} else {
74
+			$title = sprintf(_("Detailed View for flights from %s"),date("l F j, Y", strtotime($spotter_array[0]['date_iso_8601'])));
75
+		}
64 76
 
65 77
 		require_once('header.php');
66 78
 		print '<div class="select-item">';
@@ -78,15 +90,24 @@  discard block
 block discarded – undo
78 90
 		print '<script type="text/javascript">$(function () { $("#datepicker").datetimepicker({ format: "YYYY-MM-DD", defaultDate: "'.$date.'" }); }); </script>';
79 91
 		print '<br />';
80 92
 		print '<div class="info column">';
81
-		if ($type == 'marine') print '<h1>'.sprintf(_("Vessels from %s"),date("l F j, Y", strtotime($spotter_array[0]['date_iso_8601']))).'</h1>';
82
-		else print '<h1>'.sprintf(_("Flights from %s"),date("l F j, Y", strtotime($spotter_array[0]['date_iso_8601']))).'</h1>';
93
+		if ($type == 'marine') {
94
+			print '<h1>'.sprintf(_("Vessels from %s"),date("l F j, Y", strtotime($spotter_array[0]['date_iso_8601']))).'</h1>';
95
+		} else {
96
+			print '<h1>'.sprintf(_("Flights from %s"),date("l F j, Y", strtotime($spotter_array[0]['date_iso_8601']))).'</h1>';
97
+		}
83 98
 		print '</div>';
84 99
 
85
-		if ($type == 'aircraft') include('date-sub-menu.php');
100
+		if ($type == 'aircraft') {
101
+			include('date-sub-menu.php');
102
+		}
86 103
 		print '<div class="table column">';
87
-		if ($type == 'marine') print '<p>'.sprintf(_("The table below shows the detailed information of all vessels on <strong>%s</strong>."),date("l M j, Y", strtotime($spotter_array[0]['date_iso_8601']))).'</p>';
88
-		elseif ($type == 'tracker') print '<p>'.sprintf(_("The table below shows the detailed information of all trackers on <strong>%s</strong>."),date("l M j, Y", strtotime($spotter_array[0]['date_iso_8601']))).'</p>';
89
-		else print '<p>'.sprintf(_("The table below shows the detailed information of all flights on <strong>%s</strong>."),date("l M j, Y", strtotime($spotter_array[0]['date_iso_8601']))).'</p>';
104
+		if ($type == 'marine') {
105
+			print '<p>'.sprintf(_("The table below shows the detailed information of all vessels on <strong>%s</strong>."),date("l M j, Y", strtotime($spotter_array[0]['date_iso_8601']))).'</p>';
106
+		} elseif ($type == 'tracker') {
107
+			print '<p>'.sprintf(_("The table below shows the detailed information of all trackers on <strong>%s</strong>."),date("l M j, Y", strtotime($spotter_array[0]['date_iso_8601']))).'</p>';
108
+		} else {
109
+			print '<p>'.sprintf(_("The table below shows the detailed information of all flights on <strong>%s</strong>."),date("l M j, Y", strtotime($spotter_array[0]['date_iso_8601']))).'</p>';
110
+		}
90 111
  
91 112
 		include('table-output.php');
92 113
 		print '<div class="pagination">';
Please login to merge, or discard this patch.
require/class.TrackerImport.php 2 patches
Indentation   +140 added lines, -140 removed lines patch added patch discarded remove patch
@@ -9,16 +9,16 @@  discard block
 block discarded – undo
9 9
 require_once(dirname(__FILE__).'/class.Source.php');
10 10
 
11 11
 class TrackerImport {
12
-    private $all_tracked = array();
13
-    private $last_delete_hourly = 0;
14
-    private $last_delete = 0;
15
-    private $stats = array();
16
-    private $tmd = 0;
17
-    private $source_location = array();
18
-    public $db = null;
19
-    public $nb = 0;
12
+	private $all_tracked = array();
13
+	private $last_delete_hourly = 0;
14
+	private $last_delete = 0;
15
+	private $stats = array();
16
+	private $tmd = 0;
17
+	private $source_location = array();
18
+	public $db = null;
19
+	public $nb = 0;
20 20
 
21
-    public function __construct($dbc = null) {
21
+	public function __construct($dbc = null) {
22 22
 	global $globalBeta;
23 23
 	$Connection = new Connection($dbc);
24 24
 	$this->db = $Connection->db();
@@ -40,50 +40,50 @@  discard block
 block discarded – undo
40 40
 	    }
41 41
 	}
42 42
 	*/
43
-    }
43
+	}
44 44
 
45
-    public function checkAll() {
45
+	public function checkAll() {
46 46
 	global $globalDebug;
47 47
 	if ($globalDebug) echo "Update last seen tracked data...\n";
48 48
 	foreach ($this->all_tracked as $key => $flight) {
49
-	    if (isset($this->all_tracked[$key]['id'])) {
49
+		if (isset($this->all_tracked[$key]['id'])) {
50 50
 		//echo $this->all_tracked[$key]['id'].' - '.$this->all_tracked[$key]['latitude'].'  '.$this->all_tracked[$key]['longitude']."\n";
51
-    		$Tracker = new Tracker($this->db);
52
-        	$Tracker->updateLatestTrackerData($this->all_tracked[$key]['id'],$this->all_tracked[$key]['ident'],$this->all_tracked[$key]['latitude'],$this->all_tracked[$key]['longitude'],$this->all_tracked[$key]['altitude'],$this->all_tracked[$key]['speed'],$this->all_tracked[$key]['datetime']);
53
-            }
51
+			$Tracker = new Tracker($this->db);
52
+			$Tracker->updateLatestTrackerData($this->all_tracked[$key]['id'],$this->all_tracked[$key]['ident'],$this->all_tracked[$key]['latitude'],$this->all_tracked[$key]['longitude'],$this->all_tracked[$key]['altitude'],$this->all_tracked[$key]['speed'],$this->all_tracked[$key]['datetime']);
53
+			}
54
+	}
54 55
 	}
55
-    }
56 56
 
57
-    public function del() {
57
+	public function del() {
58 58
 	global $globalDebug;
59 59
 	// Delete old infos
60 60
 	if ($globalDebug) echo 'Delete old values and update latest data...'."\n";
61 61
 	foreach ($this->all_tracked as $key => $flight) {
62
-    	    if (isset($flight['lastupdate'])) {
63
-        	if ($flight['lastupdate'] < (time()-3000)) {
64
-            	    if (isset($this->all_tracked[$key]['id'])) {
65
-            		if ($globalDebug) echo "--- Delete old values with id ".$this->all_tracked[$key]['id']."\n";
62
+			if (isset($flight['lastupdate'])) {
63
+			if ($flight['lastupdate'] < (time()-3000)) {
64
+					if (isset($this->all_tracked[$key]['id'])) {
65
+					if ($globalDebug) echo "--- Delete old values with id ".$this->all_tracked[$key]['id']."\n";
66 66
 			/*
67 67
 			$TrackerLive = new TrackerLive();
68 68
             		$TrackerLive->deleteLiveTrackerDataById($this->all_tracked[$key]['id']);
69 69
 			$TrackerLive->db = null;
70 70
 			*/
71
-            		//$real_arrival = $this->arrival($key);
72
-            		$Tracker = new Tracker($this->db);
73
-            		if ($this->all_tracked[$key]['latitude'] != '' && $this->all_tracked[$key]['longitude'] != '') {
71
+					//$real_arrival = $this->arrival($key);
72
+					$Tracker = new Tracker($this->db);
73
+					if ($this->all_tracked[$key]['latitude'] != '' && $this->all_tracked[$key]['longitude'] != '') {
74 74
 				$result = $Tracker->updateLatestTrackerData($this->all_tracked[$key]['id'],$this->all_tracked[$key]['ident'],$this->all_tracked[$key]['latitude'],$this->all_tracked[$key]['longitude'],$this->all_tracked[$key]['altitude'],$this->all_tracked[$key]['speed']);
75 75
 				if ($globalDebug && $result != 'success') echo '!!! ERROR : '.$result."\n";
76 76
 			}
77 77
 			// Put in archive
78 78
 //			$Tracker->db = null;
79
-            	    }
80
-            	    unset($this->all_tracked[$key]);
81
-    	        }
82
-	    }
83
-        }
84
-    }
79
+					}
80
+					unset($this->all_tracked[$key]);
81
+				}
82
+		}
83
+		}
84
+	}
85 85
 
86
-    public function add($line) {
86
+	public function add($line) {
87 87
 	global $globalFork, $globalDistanceIgnore, $globalDaemon, $globalDebug, $globalCoordMinChange, $globalDebugTimeElapsed, $globalCenterLatitude, $globalCenterLongitude, $globalBeta, $globalSourcesupdate, $globalAllTracked;
88 88
 	if (!isset($globalCoordMinChange) || $globalCoordMinChange == '') $globalCoordMinChange = '0.02';
89 89
 	date_default_timezone_set('UTC');
@@ -92,8 +92,8 @@  discard block
 block discarded – undo
92 92
 	
93 93
 	// SBS format is CSV format
94 94
 	if(is_array($line) && isset($line['ident'])) {
95
-	    //print_r($line);
96
-  	    if (isset($line['ident'])) {
95
+		//print_r($line);
96
+  		if (isset($line['ident'])) {
97 97
 
98 98
 		/*
99 99
 		// Increment message number
@@ -109,29 +109,29 @@  discard block
 block discarded – undo
109 109
 		*/
110 110
 		
111 111
 		$Common = new Common();
112
-	        if (!isset($line['id'])) $id = trim($line['ident']);
113
-	        else $id = trim($line['id']);
112
+			if (!isset($line['id'])) $id = trim($line['ident']);
113
+			else $id = trim($line['id']);
114 114
 		
115 115
 		if (!isset($this->all_tracked[$id])) {
116
-		    $this->all_tracked[$id] = array();
117
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('addedTracker' => 0));
118
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('ident' => '','latitude' => '', 'longitude' => '', 'speed' => '', 'altitude' => '', 'heading' => '', 'format_source' => '','source_name' => '','comment'=> '','type' => '','noarchive' => false,'putinarchive' => true,'over_country' => ''));
119
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('lastupdate' => time()));
120
-		    if (!isset($line['id'])) {
116
+			$this->all_tracked[$id] = array();
117
+			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('addedTracker' => 0));
118
+			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('ident' => '','latitude' => '', 'longitude' => '', 'speed' => '', 'altitude' => '', 'heading' => '', 'format_source' => '','source_name' => '','comment'=> '','type' => '','noarchive' => false,'putinarchive' => true,'over_country' => ''));
119
+			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('lastupdate' => time()));
120
+			if (!isset($line['id'])) {
121 121
 			if (!isset($globalDaemon)) $globalDaemon = TRUE;
122 122
 			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $id.'-'.date('YmdHi')));
123
-		     } else $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $line['id']));
124
-		    if ($globalAllTracked !== FALSE) $dataFound = true;
123
+			 } else $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $line['id']));
124
+			if ($globalAllTracked !== FALSE) $dataFound = true;
125 125
 		}
126 126
 		
127 127
 		if (isset($line['datetime']) && strtotime($line['datetime']) > time()-20*60 && strtotime($line['datetime']) < time()+20*60) {
128
-		    if (!isset($this->all_tracked[$id]['datetime']) || strtotime($line['datetime']) >= strtotime($this->all_tracked[$id]['datetime'])) {
128
+			if (!isset($this->all_tracked[$id]['datetime']) || strtotime($line['datetime']) >= strtotime($this->all_tracked[$id]['datetime'])) {
129 129
 			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('datetime' => $line['datetime']));
130
-		    } else {
130
+			} else {
131 131
 				if (strtotime($line['datetime']) == strtotime($this->all_tracked[$id]['datetime']) && $globalDebug) echo "!!! Date is the same as previous data for ".$this->all_tracked[$id]['hex']." - format : ".$line['format_source']."\n";
132 132
 				elseif (strtotime($line['datetime']) > strtotime($this->all_tracked[$id]['datetime']) && $globalDebug) echo "!!! Date previous latest data (".$line['datetime']." > ".$this->all_tracked[$id]['datetime'].") !!! for ".$this->all_tracked[$id]['hex']." - format : ".$line['format_source']."\n";
133 133
 				return '';
134
-		    }
134
+			}
135 135
 		} elseif (isset($line['datetime']) && strtotime($line['datetime']) < time()-20*60) {
136 136
 			if ($globalDebug) echo "!!! Date is too old ".$this->all_tracked[$id]['hex']." - format : ".$line['format_source']."!!!";
137 137
 			return '';
@@ -148,38 +148,38 @@  discard block
 block discarded – undo
148 148
 		
149 149
 		//if (isset($line['ident']) && $line['ident'] != '' && $line['ident'] != '????????' && $line['ident'] != '00000000' && ($this->all_tracked[$id]['ident'] != trim($line['ident'])) && preg_match('/^[a-zA-Z0-9-]+$/', $line['ident'])) {
150 150
 		if (isset($line['ident']) && $line['ident'] != '' && $line['ident'] != '????????' && $line['ident'] != '00000000' && ($this->all_tracked[$id]['ident'] != trim($line['ident']))) {
151
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('ident' => trim($line['ident'])));
152
-		    if ($this->all_tracked[$id]['addedTracker'] == 1) {
151
+			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('ident' => trim($line['ident'])));
152
+			if ($this->all_tracked[$id]['addedTracker'] == 1) {
153 153
 			$timeelapsed = microtime(true);
154
-            		$Tracker = new Tracker($this->db);
155
-            		$fromsource = NULL;
156
-            		$result = $Tracker->updateIdentTrackerData($this->all_tracked[$id]['id'],$this->all_tracked[$id]['ident'],$fromsource);
154
+					$Tracker = new Tracker($this->db);
155
+					$fromsource = NULL;
156
+					$result = $Tracker->updateIdentTrackerData($this->all_tracked[$id]['id'],$this->all_tracked[$id]['ident'],$fromsource);
157 157
 			if ($globalDebug && $result != 'success') echo '!!! ERROR : '.$result."\n";
158 158
 			$Tracker->db = null;
159 159
 			if ($globalDebugTimeElapsed) echo 'Time elapsed for update identspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
160
-		    }
161
-		    if (!isset($this->all_tracked[$id]['id'])) $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $this->all_tracked[$id]['ident']));
160
+			}
161
+			if (!isset($this->all_tracked[$id]['id'])) $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $this->all_tracked[$id]['ident']));
162 162
 		}
163 163
 
164 164
 		if (isset($line['speed']) && $line['speed'] != '') {
165
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('speed' => round($line['speed'])));
166
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('speed_fromsrc' => true));
165
+			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('speed' => round($line['speed'])));
166
+			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('speed_fromsrc' => true));
167 167
 		} else if (!isset($this->all_tracked[$id]['speed_fromsrc']) && isset($this->all_tracked[$id]['time_last_coord']) && $this->all_tracked[$id]['time_last_coord'] != time() && isset($line['latitude']) && isset($line['longitude'])) {
168
-		    $distance = $Common->distance($line['latitude'],$line['longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],'m');
169
-		    if ($distance > 1000 && $distance < 10000) {
168
+			$distance = $Common->distance($line['latitude'],$line['longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],'m');
169
+			if ($distance > 1000 && $distance < 10000) {
170 170
 			$speed = $distance/(time() - $this->all_tracked[$id]['time_last_coord']);
171 171
 			$speed = $speed*3.6;
172 172
 			if ($speed < 1000) $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('speed' => round($speed)));
173 173
   			if ($globalDebug) echo "ø Calculated Speed for ".$this->all_tracked[$id]['ident']." : ".$speed." - distance : ".$distance."\n";
174
-		    }
174
+			}
175 175
 		}
176 176
 
177
-	        if (isset($line['latitude']) && isset($line['longitude']) && $line['latitude'] != '' && $line['longitude'] != '' && is_numeric($line['latitude']) && is_numeric($line['longitude'])) {
178
-	    	    if (isset($this->all_tracked[$id]['time_last_coord'])) $timediff = round(time()-$this->all_tracked[$id]['time_last_coord']);
179
-	    	    else unset($timediff);
180
-	    	    if ($this->tmd > 5 || !isset($timediff) || $timediff > 2000 || ($timediff > 30 && isset($this->all_tracked[$id]['latitude']) && isset($this->all_tracked[$id]['longitude']) && $Common->withinThreshold($timediff,$Common->distance($line['latitude'],$line['longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],'m')))) {
177
+			if (isset($line['latitude']) && isset($line['longitude']) && $line['latitude'] != '' && $line['longitude'] != '' && is_numeric($line['latitude']) && is_numeric($line['longitude'])) {
178
+				if (isset($this->all_tracked[$id]['time_last_coord'])) $timediff = round(time()-$this->all_tracked[$id]['time_last_coord']);
179
+				else unset($timediff);
180
+				if ($this->tmd > 5 || !isset($timediff) || $timediff > 2000 || ($timediff > 30 && isset($this->all_tracked[$id]['latitude']) && isset($this->all_tracked[$id]['longitude']) && $Common->withinThreshold($timediff,$Common->distance($line['latitude'],$line['longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],'m')))) {
181 181
 			if (isset($this->all_tracked[$id]['archive_latitude']) && isset($this->all_tracked[$id]['archive_longitude']) && isset($this->all_tracked[$id]['livedb_latitude']) && isset($this->all_tracked[$id]['livedb_longitude'])) {
182
-			    if (!$Common->checkLine($this->all_tracked[$id]['archive_latitude'],$this->all_tracked[$id]['archive_longitude'],$this->all_tracked[$id]['livedb_latitude'],$this->all_tracked[$id]['livedb_longitude'],$line['latitude'],$line['longitude'])) {
182
+				if (!$Common->checkLine($this->all_tracked[$id]['archive_latitude'],$this->all_tracked[$id]['archive_longitude'],$this->all_tracked[$id]['livedb_latitude'],$this->all_tracked[$id]['livedb_longitude'],$line['latitude'],$line['longitude'])) {
183 183
 				$this->all_tracked[$id]['archive_latitude'] = $line['latitude'];
184 184
 				$this->all_tracked[$id]['archive_longitude'] = $line['longitude'];
185 185
 				$this->all_tracked[$id]['putinarchive'] = true;
@@ -193,120 +193,120 @@  discard block
 block discarded – undo
193 193
 				if ($globalDebugTimeElapsed) echo 'Time elapsed for update getCountryFromlatitudeLongitude : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
194 194
 				$this->tmd = 0;
195 195
 				if ($globalDebug) echo 'FOUND : '.$this->all_tracked[$id]['over_country'].' ---------------'."\n";
196
-			    }
196
+				}
197 197
 			}
198 198
 
199 199
 			if (isset($line['latitude']) && $line['latitude'] != '' && $line['latitude'] != 0 && $line['latitude'] < 91 && $line['latitude'] > -90) {
200 200
 				if (!isset($this->all_tracked[$id]['archive_latitude'])) $this->all_tracked[$id]['archive_latitude'] = $line['latitude'];
201 201
 				if (!isset($this->all_tracked[$id]['livedb_latitude']) || abs($this->all_tracked[$id]['livedb_latitude']-$line['latitude']) > $globalCoordMinChange || $this->all_tracked[$id]['format_source'] == 'aprs') {
202
-				    $this->all_tracked[$id]['livedb_latitude'] = $line['latitude'];
203
-				    $dataFound = true;
204
-				    $this->all_tracked[$id]['time_last_coord'] = time();
202
+					$this->all_tracked[$id]['livedb_latitude'] = $line['latitude'];
203
+					$dataFound = true;
204
+					$this->all_tracked[$id]['time_last_coord'] = time();
205 205
 				}
206 206
 				$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('latitude' => $line['latitude']));
207 207
 			}
208 208
 			if (isset($line['longitude']) && $line['longitude'] != '' && $line['longitude'] != 0 && $line['longitude'] < 360 && $line['longitude'] > -180) {
209
-			    if ($line['longitude'] > 180) $line['longitude'] = $line['longitude'] - 360;
209
+				if ($line['longitude'] > 180) $line['longitude'] = $line['longitude'] - 360;
210 210
 				if (!isset($this->all_tracked[$id]['archive_longitude'])) $this->all_tracked[$id]['archive_longitude'] = $line['longitude'];
211 211
 				if (!isset($this->all_tracked[$id]['livedb_longitude']) || abs($this->all_tracked[$id]['livedb_longitude']-$line['longitude']) > $globalCoordMinChange || $this->all_tracked[$id]['format_source'] == 'aprs') {
212
-				    $this->all_tracked[$id]['livedb_longitude'] = $line['longitude'];
213
-				    $dataFound = true;
214
-				    $this->all_tracked[$id]['time_last_coord'] = time();
212
+					$this->all_tracked[$id]['livedb_longitude'] = $line['longitude'];
213
+					$dataFound = true;
214
+					$this->all_tracked[$id]['time_last_coord'] = time();
215 215
 				}
216 216
 				$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('longitude' => $line['longitude']));
217 217
 			}
218 218
 
219
-		    } else if ($globalDebug && $timediff > 20) {
219
+			} else if ($globalDebug && $timediff > 20) {
220 220
 			$this->tmd = $this->tmd + 1;
221 221
 			echo '!!! Too much distance in short time... for '.$this->all_tracked[$id]['ident']."\n";
222 222
 			echo 'Time : '.$timediff.'s - Distance : '.$Common->distance($line['latitude'],$line['longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],'m')."m -";
223 223
 			echo 'Speed : '.(($Common->distance($line['latitude'],$line['longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],'m')/$timediff)*3.6)." km/h - ";
224 224
 			echo 'Lat : '.$line['latitude'].' - long : '.$line['longitude'].' - prev lat : '.$this->all_tracked[$id]['latitude'].' - prev long : '.$this->all_tracked[$id]['longitude']." \n";
225
-		    }
225
+			}
226 226
 		}
227 227
 		if (isset($line['last_update']) && $line['last_update'] != '') {
228
-		    if (isset($this->all_tracked[$id]['last_update']) && $this->all_tracked[$id]['last_update'] != $line['last_update']) $dataFound = true;
229
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('last_update' => $line['last_update']));
228
+			if (isset($this->all_tracked[$id]['last_update']) && $this->all_tracked[$id]['last_update'] != $line['last_update']) $dataFound = true;
229
+			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('last_update' => $line['last_update']));
230 230
 		}
231 231
 		if (isset($line['format_source']) && $line['format_source'] != '') {
232
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('format_source' => $line['format_source']));
232
+			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('format_source' => $line['format_source']));
233 233
 		}
234 234
 		if (isset($line['source_name']) && $line['source_name'] != '') {
235
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('source_name' => $line['source_name']));
235
+			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('source_name' => $line['source_name']));
236 236
 		}
237 237
 		if (isset($line['comment']) && $line['comment'] != '') {
238
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('comment' => $line['comment']));
239
-		    //$dataFound = true;
238
+			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('comment' => $line['comment']));
239
+			//$dataFound = true;
240 240
 		}
241 241
 		if (isset($line['type']) && $line['type'] != '') {
242
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('type' => $line['type']));
243
-		    //$dataFound = true;
242
+			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('type' => $line['type']));
243
+			//$dataFound = true;
244 244
 		}
245 245
 
246 246
 		if (isset($line['altitude']) && $line['altitude'] != '') {
247
-		    //if (!isset($this->all_tracked[$id]['altitude']) || $this->all_tracked[$id]['altitude'] == '' || ($this->all_tracked[$id]['altitude'] > 0 && $line['altitude'] != 0)) {
247
+			//if (!isset($this->all_tracked[$id]['altitude']) || $this->all_tracked[$id]['altitude'] == '' || ($this->all_tracked[$id]['altitude'] > 0 && $line['altitude'] != 0)) {
248 248
 			if (is_int($this->all_tracked[$id]['altitude']) && abs(round($line['altitude']/100)-$this->all_tracked[$id]['altitude']) > 3) $this->all_tracked[$id]['putinarchive'] = true;
249 249
 			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('altitude' => round($line['altitude']/100)));
250 250
 			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('altitude_real' => $line['altitude']));
251 251
 			//$dataFound = true;
252
-		    //} elseif ($globalDebug) echo "!!! Strange altitude data... not added.\n";
252
+			//} elseif ($globalDebug) echo "!!! Strange altitude data... not added.\n";
253 253
   		}
254 254
 
255 255
 		if (isset($line['noarchive']) && $line['noarchive'] === true) {
256
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('noarchive' => true));
256
+			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('noarchive' => true));
257 257
 		}
258 258
 		
259 259
 		if (isset($line['heading']) && $line['heading'] != '') {
260
-		    if (is_int($this->all_tracked[$id]['heading']) && abs($this->all_tracked[$id]['heading']-round($line['heading'])) > 10) $this->all_tracked[$id]['putinarchive'] = true;
261
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('heading' => round($line['heading'])));
262
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('heading_fromsrc' => true));
263
-		    //$dataFound = true;
260
+			if (is_int($this->all_tracked[$id]['heading']) && abs($this->all_tracked[$id]['heading']-round($line['heading'])) > 10) $this->all_tracked[$id]['putinarchive'] = true;
261
+			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('heading' => round($line['heading'])));
262
+			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('heading_fromsrc' => true));
263
+			//$dataFound = true;
264 264
   		} elseif (!isset($this->all_tracked[$id]['heading_fromsrc']) && isset($this->all_tracked[$id]['archive_latitude']) && $this->all_tracked[$id]['archive_latitude'] != $this->all_tracked[$id]['latitude'] && isset($this->all_tracked[$id]['archive_longitude']) && $this->all_tracked[$id]['archive_longitude'] != $this->all_tracked[$id]['longitude']) {
265
-  		    $heading = $Common->getHeading($this->all_tracked[$id]['archive_latitude'],$this->all_tracked[$id]['archive_longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude']);
266
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('heading' => round($heading)));
267
-		    if (abs($this->all_tracked[$id]['heading']-round($heading)) > 10) $this->all_tracked[$id]['putinarchive'] = true;
268
-  		    if ($globalDebug) echo "ø Calculated Heading for ".$this->all_tracked[$id]['ident']." : ".$heading."\n";
265
+  			$heading = $Common->getHeading($this->all_tracked[$id]['archive_latitude'],$this->all_tracked[$id]['archive_longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude']);
266
+			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('heading' => round($heading)));
267
+			if (abs($this->all_tracked[$id]['heading']-round($heading)) > 10) $this->all_tracked[$id]['putinarchive'] = true;
268
+  			if ($globalDebug) echo "ø Calculated Heading for ".$this->all_tracked[$id]['ident']." : ".$heading."\n";
269 269
   		}
270 270
 		//if (isset($globalSourcesupdate) && $globalSourcesupdate != '' && isset($this->all_tracked[$id]['lastupdate']) && time()-$this->all_tracked[$id]['lastupdate'] < $globalSourcesupdate) $dataFound = false;
271 271
 
272 272
 		if ($dataFound === true && isset($this->all_tracked[$id]['ident'])) {
273
-		    $this->all_tracked[$id]['lastupdate'] = time();
274
-		    if ($this->all_tracked[$id]['addedTracker'] == 0) {
275
-		        if (!isset($globalDistanceIgnore['latitude']) || $this->all_tracked[$id]['longitude'] == ''  || $this->all_tracked[$id]['latitude'] == '' || (isset($globalDistanceIgnore['latitude']) && $Common->distance($this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude']) < $globalDistanceIgnore['distance'])) {
276
-			    if (!isset($this->all_tracked[$id]['forcenew']) || $this->all_tracked[$id]['forcenew'] == 0) {
273
+			$this->all_tracked[$id]['lastupdate'] = time();
274
+			if ($this->all_tracked[$id]['addedTracker'] == 0) {
275
+				if (!isset($globalDistanceIgnore['latitude']) || $this->all_tracked[$id]['longitude'] == ''  || $this->all_tracked[$id]['latitude'] == '' || (isset($globalDistanceIgnore['latitude']) && $Common->distance($this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude']) < $globalDistanceIgnore['distance'])) {
276
+				if (!isset($this->all_tracked[$id]['forcenew']) || $this->all_tracked[$id]['forcenew'] == 0) {
277 277
 				if ($globalDebug) echo "Check if aircraft is already in DB...";
278 278
 				$timeelapsed = microtime(true);
279 279
 				$TrackerLive = new TrackerLive($this->db);
280 280
 				if (isset($line['id'])) {
281
-				    $recent_ident = $TrackerLive->checkIdRecent($line['id']);
282
-				    if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
281
+					$recent_ident = $TrackerLive->checkIdRecent($line['id']);
282
+					if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
283 283
 				} elseif (isset($this->all_tracked[$id]['ident']) && $this->all_tracked[$id]['ident'] != '') {
284
-				    $recent_ident = $TrackerLive->checkIdentRecent($this->all_tracked[$id]['ident']);
285
-				    if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdentRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
284
+					$recent_ident = $TrackerLive->checkIdentRecent($this->all_tracked[$id]['ident']);
285
+					if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdentRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
286 286
 				} else $recent_ident = '';
287 287
 				$TrackerLive->db=null;
288 288
 
289 289
 				if ($globalDebug && $recent_ident == '') echo " Not in DB.\n";
290 290
 				elseif ($globalDebug && $recent_ident != '') echo " Already in DB.\n";
291
-			    } else {
291
+				} else {
292 292
 				$recent_ident = '';
293 293
 				$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('forcenew' => 0));
294
-			    }
295
-			    //if there was no aircraft with the same callsign within the last hour and go post it into the archive
296
-			    if($recent_ident == "")
297
-			    {
294
+				}
295
+				//if there was no aircraft with the same callsign within the last hour and go post it into the archive
296
+				if($recent_ident == "")
297
+				{
298 298
 				if ($globalDebug) echo "\o/ Add ".$this->all_tracked[$id]['ident']." in archive DB : ";
299 299
 				//adds the spotter data for the archive
300
-				    $highlight = '';
301
-				    if (!isset($this->all_tracked[$id]['id'])) $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $this->all_tracked[$id]['ident'].'-'.date('YmdHi')));
302
-				    $timeelapsed = microtime(true);
303
-				    $Tracker = new Tracker($this->db);
304
-				    $result = $Tracker->addTrackerData($this->all_tracked[$id]['id'], $this->all_tracked[$id]['ident'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], $this->all_tracked[$id]['altitude'], $this->all_tracked[$id]['heading'], $this->all_tracked[$id]['speed'], $this->all_tracked[$id]['datetime'], $this->all_tracked[$id]['comment'],$this->all_tracked[$id]['type'],$this->all_tracked[$id]['format_source'],$this->all_tracked[$id]['source_name']);
305
-				    $Tracker->db = null;
306
-				    if ($globalDebug && isset($result)) echo $result."\n";
307
-				    if ($globalDebugTimeElapsed) echo 'Time elapsed for update addspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
300
+					$highlight = '';
301
+					if (!isset($this->all_tracked[$id]['id'])) $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $this->all_tracked[$id]['ident'].'-'.date('YmdHi')));
302
+					$timeelapsed = microtime(true);
303
+					$Tracker = new Tracker($this->db);
304
+					$result = $Tracker->addTrackerData($this->all_tracked[$id]['id'], $this->all_tracked[$id]['ident'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], $this->all_tracked[$id]['altitude'], $this->all_tracked[$id]['heading'], $this->all_tracked[$id]['speed'], $this->all_tracked[$id]['datetime'], $this->all_tracked[$id]['comment'],$this->all_tracked[$id]['type'],$this->all_tracked[$id]['format_source'],$this->all_tracked[$id]['source_name']);
305
+					$Tracker->db = null;
306
+					if ($globalDebug && isset($result)) echo $result."\n";
307
+					if ($globalDebugTimeElapsed) echo 'Time elapsed for update addspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
308 308
 				    
309
-				    /*
309
+					/*
310 310
 				    // Add source stat in DB
311 311
 				    $Stats = new Stats($this->db);
312 312
 				    if (!empty($this->stats)) {
@@ -333,20 +333,20 @@  discard block
 block discarded – undo
333 333
 				    }
334 334
 				    $Stats->db = null;
335 335
 				    */
336
-				    $this->del();
336
+					$this->del();
337 337
 				//$ignoreImport = false;
338 338
 				$this->all_tracked[$id]['addedTracker'] = 1;
339 339
 				//print_r($this->all_tracked[$id]);
340 340
 				if ($this->last_delete == 0 || time() - $this->last_delete > 1800) {
341
-				    if ($globalDebug) echo "---- Deleting Live Tracker data older than 9 hours...";
342
-				    //TrackerLive->deleteLiveTrackerDataNotUpdated();
343
-				    $TrackerLive = new TrackerLive($this->db);
344
-				    $TrackerLive->deleteLiveTrackerData();
345
-				    $TrackerLive->db=null;
346
-				    if ($globalDebug) echo " Done\n";
347
-				    $this->last_delete = time();
341
+					if ($globalDebug) echo "---- Deleting Live Tracker data older than 9 hours...";
342
+					//TrackerLive->deleteLiveTrackerDataNotUpdated();
343
+					$TrackerLive = new TrackerLive($this->db);
344
+					$TrackerLive->deleteLiveTrackerData();
345
+					$TrackerLive->db=null;
346
+					if ($globalDebug) echo " Done\n";
347
+					$this->last_delete = time();
348 348
 				}
349
-			    } else {
349
+				} else {
350 350
 				$this->all_tracked[$id]['id'] = $recent_ident;
351 351
 				$this->all_tracked[$id]['addedTracker'] = 1;
352 352
 				if (isset($globalDaemon) && !$globalDaemon) {
@@ -355,16 +355,16 @@  discard block
 block discarded – undo
355 355
 					$Tracker->db = null;
356 356
 				}
357 357
 				
358
-			    }
358
+				}
359
+			}
359 360
 			}
360
-		    }
361
-		    //adds the spotter LIVE data
362
-		    if ($globalDebug) {
361
+			//adds the spotter LIVE data
362
+			if ($globalDebug) {
363 363
 			echo 'DATA : ident : '.$this->all_tracked[$id]['ident'].' - type : '.$this->all_tracked[$id]['type'].' - Latitude : '.$this->all_tracked[$id]['latitude'].' - Longitude : '.$this->all_tracked[$id]['longitude'].' - Altitude : '.$this->all_tracked[$id]['altitude'].' - Heading : '.$this->all_tracked[$id]['heading'].' - Speed : '.$this->all_tracked[$id]['speed']."\n";
364
-		    }
365
-		    $ignoreImport = false;
364
+			}
365
+			$ignoreImport = false;
366 366
 
367
-		    if (!$ignoreImport) {
367
+			if (!$ignoreImport) {
368 368
 			if (!isset($globalDistanceIgnore['latitude']) || (isset($globalDistanceIgnore['latitude']) && $Common->distance($this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude']) < $globalDistanceIgnore['distance'])) {
369 369
 				if ($globalDebug) echo "\o/ Add ".$this->all_tracked[$id]['ident']." from ".$this->all_tracked[$id]['format_source']." in Live DB : ";
370 370
 				$timeelapsed = microtime(true);
@@ -436,22 +436,22 @@  discard block
 block discarded – undo
436 436
 			
437 437
 			
438 438
 			if ($this->last_delete_hourly == 0 || time() - $this->last_delete_hourly > 900) {
439
-			    if ($globalDebug) echo "---- Deleting Live Tracker data Not updated since 2 hour...";
440
-			    $TrackerLive = new TrackerLive($this->db);
441
-			    $TrackerLive->deleteLiveTrackerDataNotUpdated();
442
-			    $TrackerLive->db = null;
443
-			    //TrackerLive->deleteLiveTrackerData();
444
-			    if ($globalDebug) echo " Done\n";
445
-			    $this->last_delete_hourly = time();
439
+				if ($globalDebug) echo "---- Deleting Live Tracker data Not updated since 2 hour...";
440
+				$TrackerLive = new TrackerLive($this->db);
441
+				$TrackerLive->deleteLiveTrackerDataNotUpdated();
442
+				$TrackerLive->db = null;
443
+				//TrackerLive->deleteLiveTrackerData();
444
+				if ($globalDebug) echo " Done\n";
445
+				$this->last_delete_hourly = time();
446 446
 			}
447 447
 			
448
-		    }
449
-		    //$ignoreImport = false;
448
+			}
449
+			//$ignoreImport = false;
450 450
 		}
451 451
 		//if (function_exists('pcntl_fork') && $globalFork) pcntl_signal(SIGCHLD, SIG_IGN);
452 452
 		if ($send) return $this->all_tracked[$id];
453
-	    }
453
+		}
454
+	}
454 455
 	}
455
-    }
456 456
 }
457 457
 ?>
Please login to merge, or discard this patch.
Braces   +158 added lines, -54 removed lines patch added patch discarded remove patch
@@ -44,7 +44,9 @@  discard block
 block discarded – undo
44 44
 
45 45
     public function checkAll() {
46 46
 	global $globalDebug;
47
-	if ($globalDebug) echo "Update last seen tracked data...\n";
47
+	if ($globalDebug) {
48
+		echo "Update last seen tracked data...\n";
49
+	}
48 50
 	foreach ($this->all_tracked as $key => $flight) {
49 51
 	    if (isset($this->all_tracked[$key]['id'])) {
50 52
 		//echo $this->all_tracked[$key]['id'].' - '.$this->all_tracked[$key]['latitude'].'  '.$this->all_tracked[$key]['longitude']."\n";
@@ -57,12 +59,16 @@  discard block
 block discarded – undo
57 59
     public function del() {
58 60
 	global $globalDebug;
59 61
 	// Delete old infos
60
-	if ($globalDebug) echo 'Delete old values and update latest data...'."\n";
62
+	if ($globalDebug) {
63
+		echo 'Delete old values and update latest data...'."\n";
64
+	}
61 65
 	foreach ($this->all_tracked as $key => $flight) {
62 66
     	    if (isset($flight['lastupdate'])) {
63 67
         	if ($flight['lastupdate'] < (time()-3000)) {
64 68
             	    if (isset($this->all_tracked[$key]['id'])) {
65
-            		if ($globalDebug) echo "--- Delete old values with id ".$this->all_tracked[$key]['id']."\n";
69
+            		if ($globalDebug) {
70
+            			echo "--- Delete old values with id ".$this->all_tracked[$key]['id']."\n";
71
+            		}
66 72
 			/*
67 73
 			$TrackerLive = new TrackerLive();
68 74
             		$TrackerLive->deleteLiveTrackerDataById($this->all_tracked[$key]['id']);
@@ -72,7 +78,9 @@  discard block
 block discarded – undo
72 78
             		$Tracker = new Tracker($this->db);
73 79
             		if ($this->all_tracked[$key]['latitude'] != '' && $this->all_tracked[$key]['longitude'] != '') {
74 80
 				$result = $Tracker->updateLatestTrackerData($this->all_tracked[$key]['id'],$this->all_tracked[$key]['ident'],$this->all_tracked[$key]['latitude'],$this->all_tracked[$key]['longitude'],$this->all_tracked[$key]['altitude'],$this->all_tracked[$key]['speed']);
75
-				if ($globalDebug && $result != 'success') echo '!!! ERROR : '.$result."\n";
81
+				if ($globalDebug && $result != 'success') {
82
+					echo '!!! ERROR : '.$result."\n";
83
+				}
76 84
 			}
77 85
 			// Put in archive
78 86
 //			$Tracker->db = null;
@@ -85,7 +93,9 @@  discard block
 block discarded – undo
85 93
 
86 94
     public function add($line) {
87 95
 	global $globalFork, $globalDistanceIgnore, $globalDaemon, $globalDebug, $globalCoordMinChange, $globalDebugTimeElapsed, $globalCenterLatitude, $globalCenterLongitude, $globalBeta, $globalSourcesupdate, $globalAllTracked;
88
-	if (!isset($globalCoordMinChange) || $globalCoordMinChange == '') $globalCoordMinChange = '0.02';
96
+	if (!isset($globalCoordMinChange) || $globalCoordMinChange == '') {
97
+		$globalCoordMinChange = '0.02';
98
+	}
89 99
 	date_default_timezone_set('UTC');
90 100
 	$dataFound = false;
91 101
 	$send = false;
@@ -109,8 +119,11 @@  discard block
 block discarded – undo
109 119
 		*/
110 120
 		
111 121
 		$Common = new Common();
112
-	        if (!isset($line['id'])) $id = trim($line['ident']);
113
-	        else $id = trim($line['id']);
122
+	        if (!isset($line['id'])) {
123
+	        	$id = trim($line['ident']);
124
+	        } else {
125
+	        	$id = trim($line['id']);
126
+	        }
114 127
 		
115 128
 		if (!isset($this->all_tracked[$id])) {
116 129
 		    $this->all_tracked[$id] = array();
@@ -118,31 +131,46 @@  discard block
 block discarded – undo
118 131
 		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('ident' => '','latitude' => '', 'longitude' => '', 'speed' => '', 'altitude' => '', 'heading' => '', 'format_source' => '','source_name' => '','comment'=> '','type' => '','noarchive' => false,'putinarchive' => true,'over_country' => ''));
119 132
 		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('lastupdate' => time()));
120 133
 		    if (!isset($line['id'])) {
121
-			if (!isset($globalDaemon)) $globalDaemon = TRUE;
134
+			if (!isset($globalDaemon)) {
135
+				$globalDaemon = TRUE;
136
+			}
122 137
 			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $id.'-'.date('YmdHi')));
123
-		     } else $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $line['id']));
124
-		    if ($globalAllTracked !== FALSE) $dataFound = true;
138
+		     } else {
139
+		     	$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $line['id']));
140
+		     }
141
+		    if ($globalAllTracked !== FALSE) {
142
+		    	$dataFound = true;
143
+		    }
125 144
 		}
126 145
 		
127 146
 		if (isset($line['datetime']) && strtotime($line['datetime']) > time()-20*60 && strtotime($line['datetime']) < time()+20*60) {
128 147
 		    if (!isset($this->all_tracked[$id]['datetime']) || strtotime($line['datetime']) >= strtotime($this->all_tracked[$id]['datetime'])) {
129 148
 			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('datetime' => $line['datetime']));
130 149
 		    } else {
131
-				if (strtotime($line['datetime']) == strtotime($this->all_tracked[$id]['datetime']) && $globalDebug) echo "!!! Date is the same as previous data for ".$this->all_tracked[$id]['hex']." - format : ".$line['format_source']."\n";
132
-				elseif (strtotime($line['datetime']) > strtotime($this->all_tracked[$id]['datetime']) && $globalDebug) echo "!!! Date previous latest data (".$line['datetime']." > ".$this->all_tracked[$id]['datetime'].") !!! for ".$this->all_tracked[$id]['hex']." - format : ".$line['format_source']."\n";
150
+				if (strtotime($line['datetime']) == strtotime($this->all_tracked[$id]['datetime']) && $globalDebug) {
151
+					echo "!!! Date is the same as previous data for ".$this->all_tracked[$id]['hex']." - format : ".$line['format_source']."\n";
152
+				} elseif (strtotime($line['datetime']) > strtotime($this->all_tracked[$id]['datetime']) && $globalDebug) {
153
+					echo "!!! Date previous latest data (".$line['datetime']." > ".$this->all_tracked[$id]['datetime'].") !!! for ".$this->all_tracked[$id]['hex']." - format : ".$line['format_source']."\n";
154
+				}
133 155
 				return '';
134 156
 		    }
135 157
 		} elseif (isset($line['datetime']) && strtotime($line['datetime']) < time()-20*60) {
136
-			if ($globalDebug) echo "!!! Date is too old ".$this->all_tracked[$id]['hex']." - format : ".$line['format_source']."!!!";
158
+			if ($globalDebug) {
159
+				echo "!!! Date is too old ".$this->all_tracked[$id]['hex']." - format : ".$line['format_source']."!!!";
160
+			}
137 161
 			return '';
138 162
 		} elseif (isset($line['datetime']) && strtotime($line['datetime']) > time()+20*60) {
139
-			if ($globalDebug) echo "!!! Date is in the future ".$this->all_tracked[$id]['hex']." - format : ".$line['format_source']."!!!";
163
+			if ($globalDebug) {
164
+				echo "!!! Date is in the future ".$this->all_tracked[$id]['hex']." - format : ".$line['format_source']."!!!";
165
+			}
140 166
 			return '';
141 167
 		} elseif (!isset($line['datetime'])) {
142 168
 			date_default_timezone_set('UTC');
143 169
 			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('datetime' => date('Y-m-d H:i:s')));
144 170
 		} else {
145
-			if ($globalDebug) echo "!!! Unknow date error ".$this->all_tracked[$id]['hex']." - format : ".$line['format_source']."!!!";
171
+			if ($globalDebug) {
172
+				echo "!!! Unknow date error ".$this->all_tracked[$id]['hex']." - format : ".$line['format_source']."!!!";
173
+			}
146 174
 			return '';
147 175
 		}
148 176
 		
@@ -154,11 +182,17 @@  discard block
 block discarded – undo
154 182
             		$Tracker = new Tracker($this->db);
155 183
             		$fromsource = NULL;
156 184
             		$result = $Tracker->updateIdentTrackerData($this->all_tracked[$id]['id'],$this->all_tracked[$id]['ident'],$fromsource);
157
-			if ($globalDebug && $result != 'success') echo '!!! ERROR : '.$result."\n";
185
+			if ($globalDebug && $result != 'success') {
186
+				echo '!!! ERROR : '.$result."\n";
187
+			}
158 188
 			$Tracker->db = null;
159
-			if ($globalDebugTimeElapsed) echo 'Time elapsed for update identspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
189
+			if ($globalDebugTimeElapsed) {
190
+				echo 'Time elapsed for update identspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
191
+			}
192
+		    }
193
+		    if (!isset($this->all_tracked[$id]['id'])) {
194
+		    	$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $this->all_tracked[$id]['ident']));
160 195
 		    }
161
-		    if (!isset($this->all_tracked[$id]['id'])) $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $this->all_tracked[$id]['ident']));
162 196
 		}
163 197
 
164 198
 		if (isset($line['speed']) && $line['speed'] != '') {
@@ -169,14 +203,21 @@  discard block
 block discarded – undo
169 203
 		    if ($distance > 1000 && $distance < 10000) {
170 204
 			$speed = $distance/(time() - $this->all_tracked[$id]['time_last_coord']);
171 205
 			$speed = $speed*3.6;
172
-			if ($speed < 1000) $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('speed' => round($speed)));
173
-  			if ($globalDebug) echo "ø Calculated Speed for ".$this->all_tracked[$id]['ident']." : ".$speed." - distance : ".$distance."\n";
206
+			if ($speed < 1000) {
207
+				$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('speed' => round($speed)));
208
+			}
209
+  			if ($globalDebug) {
210
+  				echo "ø Calculated Speed for ".$this->all_tracked[$id]['ident']." : ".$speed." - distance : ".$distance."\n";
211
+  			}
174 212
 		    }
175 213
 		}
176 214
 
177 215
 	        if (isset($line['latitude']) && isset($line['longitude']) && $line['latitude'] != '' && $line['longitude'] != '' && is_numeric($line['latitude']) && is_numeric($line['longitude'])) {
178
-	    	    if (isset($this->all_tracked[$id]['time_last_coord'])) $timediff = round(time()-$this->all_tracked[$id]['time_last_coord']);
179
-	    	    else unset($timediff);
216
+	    	    if (isset($this->all_tracked[$id]['time_last_coord'])) {
217
+	    	    	$timediff = round(time()-$this->all_tracked[$id]['time_last_coord']);
218
+	    	    } else {
219
+	    	    	unset($timediff);
220
+	    	    }
180 221
 	    	    if ($this->tmd > 5 || !isset($timediff) || $timediff > 2000 || ($timediff > 30 && isset($this->all_tracked[$id]['latitude']) && isset($this->all_tracked[$id]['longitude']) && $Common->withinThreshold($timediff,$Common->distance($line['latitude'],$line['longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],'m')))) {
181 222
 			if (isset($this->all_tracked[$id]['archive_latitude']) && isset($this->all_tracked[$id]['archive_longitude']) && isset($this->all_tracked[$id]['livedb_latitude']) && isset($this->all_tracked[$id]['livedb_longitude'])) {
182 223
 			    if (!$Common->checkLine($this->all_tracked[$id]['archive_latitude'],$this->all_tracked[$id]['archive_longitude'],$this->all_tracked[$id]['livedb_latitude'],$this->all_tracked[$id]['livedb_longitude'],$line['latitude'],$line['longitude'])) {
@@ -184,20 +225,30 @@  discard block
 block discarded – undo
184 225
 				$this->all_tracked[$id]['archive_longitude'] = $line['longitude'];
185 226
 				$this->all_tracked[$id]['putinarchive'] = true;
186 227
 				
187
-				if ($globalDebug) echo "\n".' ------- Check Country for '.$this->all_tracked[$id]['ident'].' with latitude : '.$line['latitude'].' and longitude : '.$line['longitude'].'.... ';
228
+				if ($globalDebug) {
229
+					echo "\n".' ------- Check Country for '.$this->all_tracked[$id]['ident'].' with latitude : '.$line['latitude'].' and longitude : '.$line['longitude'].'.... ';
230
+				}
188 231
 				$timeelapsed = microtime(true);
189 232
 				$Tracker = new Tracker($this->db);
190 233
 				$all_country = $Tracker->getCountryFromLatitudeLongitude($line['latitude'],$line['longitude']);
191
-				if (!empty($all_country)) $this->all_tracked[$id]['over_country'] = $all_country['iso2'];
234
+				if (!empty($all_country)) {
235
+					$this->all_tracked[$id]['over_country'] = $all_country['iso2'];
236
+				}
192 237
 				$Tracker->db = null;
193
-				if ($globalDebugTimeElapsed) echo 'Time elapsed for update getCountryFromlatitudeLongitude : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
238
+				if ($globalDebugTimeElapsed) {
239
+					echo 'Time elapsed for update getCountryFromlatitudeLongitude : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
240
+				}
194 241
 				$this->tmd = 0;
195
-				if ($globalDebug) echo 'FOUND : '.$this->all_tracked[$id]['over_country'].' ---------------'."\n";
242
+				if ($globalDebug) {
243
+					echo 'FOUND : '.$this->all_tracked[$id]['over_country'].' ---------------'."\n";
244
+				}
196 245
 			    }
197 246
 			}
198 247
 
199 248
 			if (isset($line['latitude']) && $line['latitude'] != '' && $line['latitude'] != 0 && $line['latitude'] < 91 && $line['latitude'] > -90) {
200
-				if (!isset($this->all_tracked[$id]['archive_latitude'])) $this->all_tracked[$id]['archive_latitude'] = $line['latitude'];
249
+				if (!isset($this->all_tracked[$id]['archive_latitude'])) {
250
+					$this->all_tracked[$id]['archive_latitude'] = $line['latitude'];
251
+				}
201 252
 				if (!isset($this->all_tracked[$id]['livedb_latitude']) || abs($this->all_tracked[$id]['livedb_latitude']-$line['latitude']) > $globalCoordMinChange || $this->all_tracked[$id]['format_source'] == 'aprs') {
202 253
 				    $this->all_tracked[$id]['livedb_latitude'] = $line['latitude'];
203 254
 				    $dataFound = true;
@@ -206,8 +257,12 @@  discard block
 block discarded – undo
206 257
 				$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('latitude' => $line['latitude']));
207 258
 			}
208 259
 			if (isset($line['longitude']) && $line['longitude'] != '' && $line['longitude'] != 0 && $line['longitude'] < 360 && $line['longitude'] > -180) {
209
-			    if ($line['longitude'] > 180) $line['longitude'] = $line['longitude'] - 360;
210
-				if (!isset($this->all_tracked[$id]['archive_longitude'])) $this->all_tracked[$id]['archive_longitude'] = $line['longitude'];
260
+			    if ($line['longitude'] > 180) {
261
+			    	$line['longitude'] = $line['longitude'] - 360;
262
+			    }
263
+				if (!isset($this->all_tracked[$id]['archive_longitude'])) {
264
+					$this->all_tracked[$id]['archive_longitude'] = $line['longitude'];
265
+				}
211 266
 				if (!isset($this->all_tracked[$id]['livedb_longitude']) || abs($this->all_tracked[$id]['livedb_longitude']-$line['longitude']) > $globalCoordMinChange || $this->all_tracked[$id]['format_source'] == 'aprs') {
212 267
 				    $this->all_tracked[$id]['livedb_longitude'] = $line['longitude'];
213 268
 				    $dataFound = true;
@@ -225,7 +280,9 @@  discard block
 block discarded – undo
225 280
 		    }
226 281
 		}
227 282
 		if (isset($line['last_update']) && $line['last_update'] != '') {
228
-		    if (isset($this->all_tracked[$id]['last_update']) && $this->all_tracked[$id]['last_update'] != $line['last_update']) $dataFound = true;
283
+		    if (isset($this->all_tracked[$id]['last_update']) && $this->all_tracked[$id]['last_update'] != $line['last_update']) {
284
+		    	$dataFound = true;
285
+		    }
229 286
 		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('last_update' => $line['last_update']));
230 287
 		}
231 288
 		if (isset($line['format_source']) && $line['format_source'] != '') {
@@ -245,7 +302,9 @@  discard block
 block discarded – undo
245 302
 
246 303
 		if (isset($line['altitude']) && $line['altitude'] != '') {
247 304
 		    //if (!isset($this->all_tracked[$id]['altitude']) || $this->all_tracked[$id]['altitude'] == '' || ($this->all_tracked[$id]['altitude'] > 0 && $line['altitude'] != 0)) {
248
-			if (is_int($this->all_tracked[$id]['altitude']) && abs(round($line['altitude']/100)-$this->all_tracked[$id]['altitude']) > 3) $this->all_tracked[$id]['putinarchive'] = true;
305
+			if (is_int($this->all_tracked[$id]['altitude']) && abs(round($line['altitude']/100)-$this->all_tracked[$id]['altitude']) > 3) {
306
+				$this->all_tracked[$id]['putinarchive'] = true;
307
+			}
249 308
 			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('altitude' => round($line['altitude']/100)));
250 309
 			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('altitude_real' => $line['altitude']));
251 310
 			//$dataFound = true;
@@ -257,15 +316,21 @@  discard block
 block discarded – undo
257 316
 		}
258 317
 		
259 318
 		if (isset($line['heading']) && $line['heading'] != '') {
260
-		    if (is_int($this->all_tracked[$id]['heading']) && abs($this->all_tracked[$id]['heading']-round($line['heading'])) > 10) $this->all_tracked[$id]['putinarchive'] = true;
319
+		    if (is_int($this->all_tracked[$id]['heading']) && abs($this->all_tracked[$id]['heading']-round($line['heading'])) > 10) {
320
+		    	$this->all_tracked[$id]['putinarchive'] = true;
321
+		    }
261 322
 		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('heading' => round($line['heading'])));
262 323
 		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('heading_fromsrc' => true));
263 324
 		    //$dataFound = true;
264 325
   		} elseif (!isset($this->all_tracked[$id]['heading_fromsrc']) && isset($this->all_tracked[$id]['archive_latitude']) && $this->all_tracked[$id]['archive_latitude'] != $this->all_tracked[$id]['latitude'] && isset($this->all_tracked[$id]['archive_longitude']) && $this->all_tracked[$id]['archive_longitude'] != $this->all_tracked[$id]['longitude']) {
265 326
   		    $heading = $Common->getHeading($this->all_tracked[$id]['archive_latitude'],$this->all_tracked[$id]['archive_longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude']);
266 327
 		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('heading' => round($heading)));
267
-		    if (abs($this->all_tracked[$id]['heading']-round($heading)) > 10) $this->all_tracked[$id]['putinarchive'] = true;
268
-  		    if ($globalDebug) echo "ø Calculated Heading for ".$this->all_tracked[$id]['ident']." : ".$heading."\n";
328
+		    if (abs($this->all_tracked[$id]['heading']-round($heading)) > 10) {
329
+		    	$this->all_tracked[$id]['putinarchive'] = true;
330
+		    }
331
+  		    if ($globalDebug) {
332
+  		    	echo "ø Calculated Heading for ".$this->all_tracked[$id]['ident']." : ".$heading."\n";
333
+  		    }
269 334
   		}
270 335
 		//if (isset($globalSourcesupdate) && $globalSourcesupdate != '' && isset($this->all_tracked[$id]['lastupdate']) && time()-$this->all_tracked[$id]['lastupdate'] < $globalSourcesupdate) $dataFound = false;
271 336
 
@@ -274,20 +339,31 @@  discard block
 block discarded – undo
274 339
 		    if ($this->all_tracked[$id]['addedTracker'] == 0) {
275 340
 		        if (!isset($globalDistanceIgnore['latitude']) || $this->all_tracked[$id]['longitude'] == ''  || $this->all_tracked[$id]['latitude'] == '' || (isset($globalDistanceIgnore['latitude']) && $Common->distance($this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude']) < $globalDistanceIgnore['distance'])) {
276 341
 			    if (!isset($this->all_tracked[$id]['forcenew']) || $this->all_tracked[$id]['forcenew'] == 0) {
277
-				if ($globalDebug) echo "Check if aircraft is already in DB...";
342
+				if ($globalDebug) {
343
+					echo "Check if aircraft is already in DB...";
344
+				}
278 345
 				$timeelapsed = microtime(true);
279 346
 				$TrackerLive = new TrackerLive($this->db);
280 347
 				if (isset($line['id'])) {
281 348
 				    $recent_ident = $TrackerLive->checkIdRecent($line['id']);
282
-				    if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
349
+				    if ($globalDebugTimeElapsed) {
350
+				    	echo 'Time elapsed for update checkIdRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
351
+				    }
283 352
 				} elseif (isset($this->all_tracked[$id]['ident']) && $this->all_tracked[$id]['ident'] != '') {
284 353
 				    $recent_ident = $TrackerLive->checkIdentRecent($this->all_tracked[$id]['ident']);
285
-				    if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdentRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
286
-				} else $recent_ident = '';
354
+				    if ($globalDebugTimeElapsed) {
355
+				    	echo 'Time elapsed for update checkIdentRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
356
+				    }
357
+				} else {
358
+					$recent_ident = '';
359
+				}
287 360
 				$TrackerLive->db=null;
288 361
 
289
-				if ($globalDebug && $recent_ident == '') echo " Not in DB.\n";
290
-				elseif ($globalDebug && $recent_ident != '') echo " Already in DB.\n";
362
+				if ($globalDebug && $recent_ident == '') {
363
+					echo " Not in DB.\n";
364
+				} elseif ($globalDebug && $recent_ident != '') {
365
+					echo " Already in DB.\n";
366
+				}
291 367
 			    } else {
292 368
 				$recent_ident = '';
293 369
 				$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('forcenew' => 0));
@@ -295,16 +371,24 @@  discard block
 block discarded – undo
295 371
 			    //if there was no aircraft with the same callsign within the last hour and go post it into the archive
296 372
 			    if($recent_ident == "")
297 373
 			    {
298
-				if ($globalDebug) echo "\o/ Add ".$this->all_tracked[$id]['ident']." in archive DB : ";
374
+				if ($globalDebug) {
375
+					echo "\o/ Add ".$this->all_tracked[$id]['ident']." in archive DB : ";
376
+				}
299 377
 				//adds the spotter data for the archive
300 378
 				    $highlight = '';
301
-				    if (!isset($this->all_tracked[$id]['id'])) $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $this->all_tracked[$id]['ident'].'-'.date('YmdHi')));
379
+				    if (!isset($this->all_tracked[$id]['id'])) {
380
+				    	$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $this->all_tracked[$id]['ident'].'-'.date('YmdHi')));
381
+				    }
302 382
 				    $timeelapsed = microtime(true);
303 383
 				    $Tracker = new Tracker($this->db);
304 384
 				    $result = $Tracker->addTrackerData($this->all_tracked[$id]['id'], $this->all_tracked[$id]['ident'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], $this->all_tracked[$id]['altitude'], $this->all_tracked[$id]['heading'], $this->all_tracked[$id]['speed'], $this->all_tracked[$id]['datetime'], $this->all_tracked[$id]['comment'],$this->all_tracked[$id]['type'],$this->all_tracked[$id]['format_source'],$this->all_tracked[$id]['source_name']);
305 385
 				    $Tracker->db = null;
306
-				    if ($globalDebug && isset($result)) echo $result."\n";
307
-				    if ($globalDebugTimeElapsed) echo 'Time elapsed for update addspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
386
+				    if ($globalDebug && isset($result)) {
387
+				    	echo $result."\n";
388
+				    }
389
+				    if ($globalDebugTimeElapsed) {
390
+				    	echo 'Time elapsed for update addspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
391
+				    }
308 392
 				    
309 393
 				    /*
310 394
 				    // Add source stat in DB
@@ -338,12 +422,16 @@  discard block
 block discarded – undo
338 422
 				$this->all_tracked[$id]['addedTracker'] = 1;
339 423
 				//print_r($this->all_tracked[$id]);
340 424
 				if ($this->last_delete == 0 || time() - $this->last_delete > 1800) {
341
-				    if ($globalDebug) echo "---- Deleting Live Tracker data older than 9 hours...";
425
+				    if ($globalDebug) {
426
+				    	echo "---- Deleting Live Tracker data older than 9 hours...";
427
+				    }
342 428
 				    //TrackerLive->deleteLiveTrackerDataNotUpdated();
343 429
 				    $TrackerLive = new TrackerLive($this->db);
344 430
 				    $TrackerLive->deleteLiveTrackerData();
345 431
 				    $TrackerLive->db=null;
346
-				    if ($globalDebug) echo " Done\n";
432
+				    if ($globalDebug) {
433
+				    	echo " Done\n";
434
+				    }
347 435
 				    $this->last_delete = time();
348 436
 				}
349 437
 			    } else {
@@ -366,13 +454,17 @@  discard block
 block discarded – undo
366 454
 
367 455
 		    if (!$ignoreImport) {
368 456
 			if (!isset($globalDistanceIgnore['latitude']) || (isset($globalDistanceIgnore['latitude']) && $Common->distance($this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude']) < $globalDistanceIgnore['distance'])) {
369
-				if ($globalDebug) echo "\o/ Add ".$this->all_tracked[$id]['ident']." from ".$this->all_tracked[$id]['format_source']." in Live DB : ";
457
+				if ($globalDebug) {
458
+					echo "\o/ Add ".$this->all_tracked[$id]['ident']." from ".$this->all_tracked[$id]['format_source']." in Live DB : ";
459
+				}
370 460
 				$timeelapsed = microtime(true);
371 461
 				$TrackerLive = new TrackerLive($this->db);
372 462
 				$result = $TrackerLive->addLiveTrackerData($this->all_tracked[$id]['id'], $this->all_tracked[$id]['ident'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], $this->all_tracked[$id]['altitude'], $this->all_tracked[$id]['heading'], $this->all_tracked[$id]['speed'],$this->all_tracked[$id]['datetime'], $this->all_tracked[$id]['putinarchive'],$this->all_tracked[$id]['comment'],$this->all_tracked[$id]['type'],$this->all_tracked[$id]['noarchive'],$this->all_tracked[$id]['format_source'],$this->all_tracked[$id]['source_name'],$this->all_tracked[$id]['over_country']);
373 463
 				$TrackerLive->db = null;
374 464
 				$this->all_tracked[$id]['putinarchive'] = false;
375
-				if ($globalDebugTimeElapsed) echo 'Time elapsed for update addlivespotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
465
+				if ($globalDebugTimeElapsed) {
466
+					echo 'Time elapsed for update addlivespotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
467
+				}
376 468
 
377 469
 				// Put statistics in $this->stats variable
378 470
 				/*
@@ -429,19 +521,29 @@  discard block
 block discarded – undo
429 521
 				*/
430 522
 
431 523
 				$this->all_tracked[$id]['lastupdate'] = time();
432
-				if ($this->all_tracked[$id]['putinarchive']) $send = true;
433
-				if ($globalDebug) echo $result."\n";
434
-			} elseif (isset($this->all_tracked[$id]['latitude']) && isset($globalDistanceIgnore['latitude']) && $globalDebug) echo "!! Too far -> Distance : ".$Common->distance($this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude'])."\n";
524
+				if ($this->all_tracked[$id]['putinarchive']) {
525
+					$send = true;
526
+				}
527
+				if ($globalDebug) {
528
+					echo $result."\n";
529
+				}
530
+			} elseif (isset($this->all_tracked[$id]['latitude']) && isset($globalDistanceIgnore['latitude']) && $globalDebug) {
531
+				echo "!! Too far -> Distance : ".$Common->distance($this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude'])."\n";
532
+			}
435 533
 			//$this->del();
436 534
 			
437 535
 			
438 536
 			if ($this->last_delete_hourly == 0 || time() - $this->last_delete_hourly > 900) {
439
-			    if ($globalDebug) echo "---- Deleting Live Tracker data Not updated since 2 hour...";
537
+			    if ($globalDebug) {
538
+			    	echo "---- Deleting Live Tracker data Not updated since 2 hour...";
539
+			    }
440 540
 			    $TrackerLive = new TrackerLive($this->db);
441 541
 			    $TrackerLive->deleteLiveTrackerDataNotUpdated();
442 542
 			    $TrackerLive->db = null;
443 543
 			    //TrackerLive->deleteLiveTrackerData();
444
-			    if ($globalDebug) echo " Done\n";
544
+			    if ($globalDebug) {
545
+			    	echo " Done\n";
546
+			    }
445 547
 			    $this->last_delete_hourly = time();
446 548
 			}
447 549
 			
@@ -449,7 +551,9 @@  discard block
 block discarded – undo
449 551
 		    //$ignoreImport = false;
450 552
 		}
451 553
 		//if (function_exists('pcntl_fork') && $globalFork) pcntl_signal(SIGCHLD, SIG_IGN);
452
-		if ($send) return $this->all_tracked[$id];
554
+		if ($send) {
555
+			return $this->all_tracked[$id];
556
+		}
453 557
 	    }
454 558
 	}
455 559
     }
Please login to merge, or discard this patch.
require/class.MarineImport.php 1 patch
Indentation   +173 added lines, -173 removed lines patch added patch discarded remove patch
@@ -9,25 +9,25 @@  discard block
 block discarded – undo
9 9
 require_once(dirname(__FILE__).'/class.Stats.php');
10 10
 require_once(dirname(__FILE__).'/class.Source.php');
11 11
 if (isset($globalServerAPRS) && $globalServerAPRS) {
12
-    require_once(dirname(__FILE__).'/class.APRS.php');
12
+	require_once(dirname(__FILE__).'/class.APRS.php');
13 13
 }
14 14
 
15 15
 class MarineImport {
16
-    private $all_tracked = array();
17
-    private $last_delete_hourly = 0;
18
-    private $last_delete = 0;
19
-    private $stats = array();
20
-    private $tmd = 0;
21
-    private $source_location = array();
22
-    public $db = null;
23
-    public $nb = 0;
16
+	private $all_tracked = array();
17
+	private $last_delete_hourly = 0;
18
+	private $last_delete = 0;
19
+	private $stats = array();
20
+	private $tmd = 0;
21
+	private $source_location = array();
22
+	public $db = null;
23
+	public $nb = 0;
24 24
 
25
-    public function __construct($dbc = null) {
25
+	public function __construct($dbc = null) {
26 26
 	global $globalBeta, $globalServerAPRS, $APRSMarine, $globalNoDB;
27 27
 	if (!isset($globalNoDB) || $globalNoDB !== TRUE) {
28
-	    $Connection = new Connection($dbc);
29
-	    $this->db = $Connection->db();
30
-	    date_default_timezone_set('UTC');
28
+		$Connection = new Connection($dbc);
29
+		$this->db = $Connection->db();
30
+		date_default_timezone_set('UTC');
31 31
 	}
32 32
 	// Get previous source stats
33 33
 	/*
@@ -46,55 +46,55 @@  discard block
 block discarded – undo
46 46
 	}
47 47
 	*/
48 48
 	if (isset($globalServerAPRS) && $globalServerAPRS) {
49
-	    $APRSMarine = new APRSMarine();
50
-	    //$APRSSpotter->connect();
49
+		$APRSMarine = new APRSMarine();
50
+		//$APRSSpotter->connect();
51
+	}
51 52
 	}
52
-    }
53 53
 
54
-    public function checkAll() {
54
+	public function checkAll() {
55 55
 	global $globalDebug;
56 56
 	if ($globalDebug) echo "Update last seen tracked data...\n";
57 57
 	foreach ($this->all_tracked as $key => $flight) {
58
-	    if (isset($this->all_tracked[$key]['id'])) {
58
+		if (isset($this->all_tracked[$key]['id'])) {
59 59
 		//echo $this->all_tracked[$key]['id'].' - '.$this->all_tracked[$key]['latitude'].'  '.$this->all_tracked[$key]['longitude']."\n";
60
-    		$Marine = new Marine($this->db);
61
-        	$Marine->updateLatestMarineData($this->all_tracked[$key]['id'],$this->all_tracked[$key]['ident'],$this->all_tracked[$key]['latitude'],$this->all_tracked[$key]['longitude'],$this->all_tracked[$key]['speed'],$this->all_tracked[$key]['datetime']);
62
-            }
60
+			$Marine = new Marine($this->db);
61
+			$Marine->updateLatestMarineData($this->all_tracked[$key]['id'],$this->all_tracked[$key]['ident'],$this->all_tracked[$key]['latitude'],$this->all_tracked[$key]['longitude'],$this->all_tracked[$key]['speed'],$this->all_tracked[$key]['datetime']);
62
+			}
63
+	}
63 64
 	}
64
-    }
65 65
 
66
-    public function del() {
66
+	public function del() {
67 67
 	global $globalDebug, $globalNoDB, $globalNoImport;
68 68
 	// Delete old infos
69 69
 	if ($globalDebug) echo 'Delete old values and update latest data...'."\n";
70 70
 	foreach ($this->all_tracked as $key => $flight) {
71
-    	    if (isset($flight['lastupdate'])) {
72
-        	if ($flight['lastupdate'] < (time()-3000)) {
73
-            	    if ((!isset($globalNoImport) || $globalNoImport !== TRUE) && (!isset($globalNoDB) || $globalNoDB !== TRUE)) {
74
-            		if (isset($this->all_tracked[$key]['id'])) {
75
-            		    if ($globalDebug) echo "--- Delete old values with id ".$this->all_tracked[$key]['id']."\n";
76
-			    /*
71
+			if (isset($flight['lastupdate'])) {
72
+			if ($flight['lastupdate'] < (time()-3000)) {
73
+					if ((!isset($globalNoImport) || $globalNoImport !== TRUE) && (!isset($globalNoDB) || $globalNoDB !== TRUE)) {
74
+					if (isset($this->all_tracked[$key]['id'])) {
75
+						if ($globalDebug) echo "--- Delete old values with id ".$this->all_tracked[$key]['id']."\n";
76
+				/*
77 77
 			    $MarineLive = new MarineLive();
78 78
             		    $MarineLive->deleteLiveMarineDataById($this->all_tracked[$key]['id']);
79 79
 			    $MarineLive->db = null;
80 80
 			    */
81
-            		    //$real_arrival = $this->arrival($key);
82
-            		    $Marine = new Marine($this->db);
83
-            		    if ($this->all_tracked[$key]['latitude'] != '' && $this->all_tracked[$key]['longitude'] != '') {
81
+						//$real_arrival = $this->arrival($key);
82
+						$Marine = new Marine($this->db);
83
+						if ($this->all_tracked[$key]['latitude'] != '' && $this->all_tracked[$key]['longitude'] != '') {
84 84
 				$result = $Marine->updateLatestMarineData($this->all_tracked[$key]['id'],$this->all_tracked[$key]['ident'],$this->all_tracked[$key]['latitude'],$this->all_tracked[$key]['longitude'],$this->all_tracked[$key]['speed'],$this->all_tracked[$key]['datetime']);
85 85
 				if ($globalDebug && $result != 'success') echo '!!! ERROR : '.$result."\n";
86
-			    }
87
-			    // Put in archive
86
+				}
87
+				// Put in archive
88 88
 //				$Marine->db = null;
89 89
 			}
90
-            	    }
91
-            	    unset($this->all_tracked[$key]);
92
-    	        }
93
-	    }
94
-        }
95
-    }
90
+					}
91
+					unset($this->all_tracked[$key]);
92
+				}
93
+		}
94
+		}
95
+	}
96 96
 
97
-    public function add($line) {
97
+	public function add($line) {
98 98
 	global $globalFork, $globalDistanceIgnore, $globalDaemon, $globalDebug, $globalCoordMinChange, $globalDebugTimeElapsed, $globalCenterLatitude, $globalCenterLongitude, $globalBeta, $globalSourcesupdate, $globalAllTracked, $globalNoImport, $globalNoDB, $globalServerAPRS,$APRSMarine;
99 99
 	if (!isset($globalCoordMinChange) || $globalCoordMinChange == '') $globalCoordMinChange = '0.02';
100 100
 	date_default_timezone_set('UTC');
@@ -103,8 +103,8 @@  discard block
 block discarded – undo
103 103
 	
104 104
 	// SBS format is CSV format
105 105
 	if(is_array($line) && isset($line['mmsi'])) {
106
-	    //print_r($line);
107
-  	    if (isset($line['mmsi'])) {
106
+		//print_r($line);
107
+  		if (isset($line['mmsi'])) {
108 108
 
109 109
 		/*
110 110
 		// Increment message number
@@ -121,64 +121,64 @@  discard block
 block discarded – undo
121 121
 		
122 122
 		$Common = new Common();
123 123
 		$AIS = new AIS();
124
-	        if (!isset($line['id'])) $id = trim($line['mmsi']);
125
-	        else $id = trim($line['id']);
124
+			if (!isset($line['id'])) $id = trim($line['mmsi']);
125
+			else $id = trim($line['id']);
126 126
 		
127 127
 		if (!isset($this->all_tracked[$id])) {
128
-		    $this->all_tracked[$id] = array();
129
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('addedMarine' => 0));
130
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('ident' => '','latitude' => '', 'longitude' => '', 'speed' => '0', 'heading' => '', 'format_source' => '','source_name' => '','comment'=> '','type' => '','typeid' => '','noarchive' => false,'putinarchive' => true,'over_country' => '','mmsi' => '','status' => '','status_id' => '','imo' => '','callsign' => '','arrival_code' => '','arrival_date' => '','mmsi_type' => ''));
131
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('lastupdate' => time()));
132
-		    if (!isset($line['id'])) {
128
+			$this->all_tracked[$id] = array();
129
+			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('addedMarine' => 0));
130
+			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('ident' => '','latitude' => '', 'longitude' => '', 'speed' => '0', 'heading' => '', 'format_source' => '','source_name' => '','comment'=> '','type' => '','typeid' => '','noarchive' => false,'putinarchive' => true,'over_country' => '','mmsi' => '','status' => '','status_id' => '','imo' => '','callsign' => '','arrival_code' => '','arrival_date' => '','mmsi_type' => ''));
131
+			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('lastupdate' => time()));
132
+			if (!isset($line['id'])) {
133 133
 			if (!isset($globalDaemon)) $globalDaemon = TRUE;
134 134
 			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $id.'-'.date('YmdHi')));
135
-		     } else $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $line['id']));
136
-		    if ($globalAllTracked !== FALSE) $dataFound = true;
135
+			 } else $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $line['id']));
136
+			if ($globalAllTracked !== FALSE) $dataFound = true;
137 137
 		}
138 138
 		
139 139
 		if (isset($line['mmsi']) && $line['mmsi'] != '' && $line['mmsi'] != $this->all_tracked[$id]['mmsi']) {
140
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('mmsi' => $line['mmsi']));
141
-		    if (!isset($globalNoDB) || $globalNoDB !== TRUE) {
140
+			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('mmsi' => $line['mmsi']));
141
+			if (!isset($globalNoDB) || $globalNoDB !== TRUE) {
142 142
 			$Marine = new Marine($this->db);
143 143
 			$identity = $Marine->getIdentity($line['mmsi']);
144 144
 			if (!empty($identity)) {
145
-			    $this->all_tracked[$id]['ident'] = $identity['ship_name'];
146
-			    $this->all_tracked[$id]['type'] = $identity['type'];
145
+				$this->all_tracked[$id]['ident'] = $identity['ship_name'];
146
+				$this->all_tracked[$id]['type'] = $identity['type'];
147 147
 			}
148 148
 			//print_r($identity);
149 149
 			unset($Marine);
150 150
 			//$dataFound = true;
151
-		    }
151
+			}
152 152
 		}
153 153
 		if (isset($line['type_id'])) {
154
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('type' => $AIS->getShipType($line['type_id'])));
154
+			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('type' => $AIS->getShipType($line['type_id'])));
155 155
 		}
156 156
 		if (isset($line['type']) && $line['type'] != '') {
157
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('type' => $line['type']));
157
+			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('type' => $line['type']));
158 158
 		}
159 159
 		if (isset($line['mmsi_type']) && $line['mmsi_type'] != '') {
160
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('mmsi_type' => $line['mmsi_type']));
160
+			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('mmsi_type' => $line['mmsi_type']));
161 161
 		}
162 162
 		if (isset($line['imo']) && $line['imo'] != '') {
163
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('imo' => $line['imo']));
163
+			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('imo' => $line['imo']));
164 164
 		}
165 165
 		if (isset($line['callsign']) && $line['callsign'] != '') {
166
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('callsign' => $line['callsign']));
166
+			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('callsign' => $line['callsign']));
167 167
 		}
168 168
 		if (isset($line['arrival_code']) && $line['arrival_code'] != '') {
169
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('arrival_code' => $line['arrival_code']));
169
+			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('arrival_code' => $line['arrival_code']));
170 170
 		}
171 171
 		if (isset($line['arrival_date']) && $line['arrival_date'] != '') {
172
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('arrival_date' => $line['arrival_date']));
172
+			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('arrival_date' => $line['arrival_date']));
173 173
 		}
174 174
 
175 175
 
176 176
 		//if (isset($line['ident']) && $line['ident'] != '' && $line['ident'] != '????????' && $line['ident'] != '00000000' && ($this->all_tracked[$id]['ident'] != trim($line['ident'])) && preg_match('/^[a-zA-Z0-9-]+$/', $line['ident'])) {
177 177
 		if (isset($line['ident']) && $line['ident'] != '' && $line['ident'] != '????????' && $line['ident'] != '00000000' && ($this->all_tracked[$id]['ident'] != trim($line['ident']))) {
178
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('ident' => trim($line['ident'])));
179
-		    if ($this->all_tracked[$id]['addedMarine'] == 1) {
178
+			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('ident' => trim($line['ident'])));
179
+			if ($this->all_tracked[$id]['addedMarine'] == 1) {
180 180
 			if (!isset($globalNoImport) || $globalNoImport !== TRUE) {
181
-			    if (!isset($globalNoDB) || $globalNoDB !== TRUE) {
181
+				if (!isset($globalNoDB) || $globalNoDB !== TRUE) {
182 182
 				$timeelapsed = microtime(true);
183 183
 				$Marine = new Marine($this->db);
184 184
 				$fromsource = NULL;
@@ -186,20 +186,20 @@  discard block
 block discarded – undo
186 186
 				if ($globalDebug && $result != 'success') echo '!!! ERROR : '.$result."\n";
187 187
 				$Marine->db = null;
188 188
 				if ($globalDebugTimeElapsed) echo 'Time elapsed for update identspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
189
-			    }
189
+				}
190
+			}
190 191
 			}
191
-		    }
192
-		    if (!isset($this->all_tracked[$id]['id'])) $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $this->all_tracked[$id]['ident']));
192
+			if (!isset($this->all_tracked[$id]['id'])) $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $this->all_tracked[$id]['ident']));
193 193
 		}
194 194
 
195 195
 		if (isset($line['datetime']) && strtotime($line['datetime']) > time()-20*60 && strtotime($line['datetime']) < time()+20*60) {
196
-		    if (!isset($this->all_tracked[$id]['datetime']) || strtotime($line['datetime']) > strtotime($this->all_tracked[$id]['datetime'])) {
196
+			if (!isset($this->all_tracked[$id]['datetime']) || strtotime($line['datetime']) > strtotime($this->all_tracked[$id]['datetime'])) {
197 197
 			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('datetime' => $line['datetime']));
198
-		    } else {
198
+			} else {
199 199
 				if (strtotime($line['datetime']) == strtotime($this->all_tracked[$id]['datetime']) && $globalDebug) echo "!!! Date is the same as previous data for ".$this->all_tracked[$id]['mmsi']."\n";
200 200
 				elseif (strtotime($line['datetime']) > strtotime($this->all_tracked[$id]['datetime']) && $globalDebug) echo "!!! Date previous latest data (".$line['datetime']." > ".$this->all_tracked[$id]['datetime'].") !!! for ".$this->all_tracked[$id]['hex']." - format : ".$line['format_source']."\n";
201 201
 				return '';
202
-		    }
202
+			}
203 203
 		} elseif (isset($line['datetime']) && strtotime($line['datetime']) < time()-20*60) {
204 204
 			if ($globalDebug) echo "!!! Date is too old ".$this->all_tracked[$id]['mmsi']." - format : ".$line['format_source']."!!!";
205 205
 			return '';
@@ -216,24 +216,24 @@  discard block
 block discarded – undo
216 216
 
217 217
 
218 218
 		if (isset($line['speed'])) {
219
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('speed' => round($line['speed'])));
220
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('speed_fromsrc' => true));
219
+			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('speed' => round($line['speed'])));
220
+			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('speed_fromsrc' => true));
221 221
 		} else if (!isset($this->all_tracked[$id]['speed_fromsrc']) && isset($this->all_tracked[$id]['time_last_coord']) && $this->all_tracked[$id]['time_last_coord'] != time() && isset($line['latitude']) && isset($line['longitude'])) {
222
-		    $distance = $Common->distance($line['latitude'],$line['longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],'m');
223
-		    if ($distance > 1000 && $distance < 10000) {
222
+			$distance = $Common->distance($line['latitude'],$line['longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],'m');
223
+			if ($distance > 1000 && $distance < 10000) {
224 224
 			$speed = $distance/(time() - $this->all_tracked[$id]['time_last_coord']);
225 225
 			$speed = $speed*3.6;
226 226
 			if ($speed < 1000) $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('speed' => round($speed)));
227 227
   			if ($globalDebug) echo "ø Calculated Speed for ".$this->all_tracked[$id]['hex']." : ".$speed." - distance : ".$distance."\n";
228
-		    }
228
+			}
229 229
 		}
230 230
 
231
-	        if (isset($line['latitude']) && isset($line['longitude']) && $line['latitude'] != '' && $line['longitude'] != '' && is_numeric($line['latitude']) && is_numeric($line['longitude'])) {
232
-	    	    if (isset($this->all_tracked[$id]['time_last_coord'])) $timediff = round(time()-$this->all_tracked[$id]['time_last_coord']);
233
-	    	    else unset($timediff);
234
-	    	    if ($this->tmd > 5 || !isset($timediff) || $timediff > 2000 || ($timediff > 30 && isset($this->all_tracked[$id]['latitude']) && isset($this->all_tracked[$id]['longitude']) && $Common->withinThreshold($timediff,$Common->distance($line['latitude'],$line['longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],'m')))) {
231
+			if (isset($line['latitude']) && isset($line['longitude']) && $line['latitude'] != '' && $line['longitude'] != '' && is_numeric($line['latitude']) && is_numeric($line['longitude'])) {
232
+				if (isset($this->all_tracked[$id]['time_last_coord'])) $timediff = round(time()-$this->all_tracked[$id]['time_last_coord']);
233
+				else unset($timediff);
234
+				if ($this->tmd > 5 || !isset($timediff) || $timediff > 2000 || ($timediff > 30 && isset($this->all_tracked[$id]['latitude']) && isset($this->all_tracked[$id]['longitude']) && $Common->withinThreshold($timediff,$Common->distance($line['latitude'],$line['longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],'m')))) {
235 235
 			if (isset($this->all_tracked[$id]['archive_latitude']) && isset($this->all_tracked[$id]['archive_longitude']) && isset($this->all_tracked[$id]['livedb_latitude']) && isset($this->all_tracked[$id]['livedb_longitude'])) {
236
-			    if (!$Common->checkLine($this->all_tracked[$id]['archive_latitude'],$this->all_tracked[$id]['archive_longitude'],$this->all_tracked[$id]['livedb_latitude'],$this->all_tracked[$id]['livedb_longitude'],$line['latitude'],$line['longitude'])) {
236
+				if (!$Common->checkLine($this->all_tracked[$id]['archive_latitude'],$this->all_tracked[$id]['archive_longitude'],$this->all_tracked[$id]['livedb_latitude'],$this->all_tracked[$id]['livedb_longitude'],$line['latitude'],$line['longitude'])) {
237 237
 				$this->all_tracked[$id]['archive_latitude'] = $line['latitude'];
238 238
 				$this->all_tracked[$id]['archive_longitude'] = $line['longitude'];
239 239
 				$this->all_tracked[$id]['putinarchive'] = true;
@@ -241,135 +241,135 @@  discard block
 block discarded – undo
241 241
 				if ($globalDebug) echo "\n".' ------- Check Country for '.$this->all_tracked[$id]['ident'].' with latitude : '.$line['latitude'].' and longitude : '.$line['longitude'].'.... ';
242 242
 				$timeelapsed = microtime(true);
243 243
 				if (!isset($globalNoDB) || $globalNoDB !== TRUE) {
244
-				    $Marine = new Marine($this->db);
245
-				    $all_country = $Marine->getCountryFromLatitudeLongitude($line['latitude'],$line['longitude']);
246
-				    if (!empty($all_country)) $this->all_tracked[$id]['over_country'] = $all_country['iso2'];
247
-				    $Marine->db = null;
248
-				    if ($globalDebugTimeElapsed) echo 'Time elapsed for update getCountryFromlatitudeLongitude : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
244
+					$Marine = new Marine($this->db);
245
+					$all_country = $Marine->getCountryFromLatitudeLongitude($line['latitude'],$line['longitude']);
246
+					if (!empty($all_country)) $this->all_tracked[$id]['over_country'] = $all_country['iso2'];
247
+					$Marine->db = null;
248
+					if ($globalDebugTimeElapsed) echo 'Time elapsed for update getCountryFromlatitudeLongitude : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
249 249
 				}
250 250
 				$this->tmd = 0;
251 251
 				if ($globalDebug) echo 'FOUND : '.$this->all_tracked[$id]['over_country'].' ---------------'."\n";
252
-			    }
252
+				}
253 253
 			}
254 254
 
255 255
 			if (isset($line['latitude']) && $line['latitude'] != '' && $line['latitude'] != 0 && $line['latitude'] < 91 && $line['latitude'] > -90) {
256 256
 				if (!isset($this->all_tracked[$id]['archive_latitude'])) $this->all_tracked[$id]['archive_latitude'] = $line['latitude'];
257 257
 				if (!isset($this->all_tracked[$id]['livedb_latitude']) || abs($this->all_tracked[$id]['livedb_latitude']-$line['latitude']) > $globalCoordMinChange || $this->all_tracked[$id]['format_source'] == 'aprs') {
258
-				    $this->all_tracked[$id]['livedb_latitude'] = $line['latitude'];
259
-				    $dataFound = true;
260
-				    $this->all_tracked[$id]['time_last_coord'] = time();
258
+					$this->all_tracked[$id]['livedb_latitude'] = $line['latitude'];
259
+					$dataFound = true;
260
+					$this->all_tracked[$id]['time_last_coord'] = time();
261 261
 				}
262 262
 				$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('latitude' => $line['latitude']));
263 263
 			}
264 264
 			if (isset($line['longitude']) && $line['longitude'] != '' && $line['longitude'] != 0 && $line['longitude'] < 360 && $line['longitude'] > -180) {
265
-			    if ($line['longitude'] > 180) $line['longitude'] = $line['longitude'] - 360;
265
+				if ($line['longitude'] > 180) $line['longitude'] = $line['longitude'] - 360;
266 266
 				if (!isset($this->all_tracked[$id]['archive_longitude'])) $this->all_tracked[$id]['archive_longitude'] = $line['longitude'];
267 267
 				if (!isset($this->all_tracked[$id]['livedb_longitude']) || abs($this->all_tracked[$id]['livedb_longitude']-$line['longitude']) > $globalCoordMinChange || $this->all_tracked[$id]['format_source'] == 'aprs') {
268
-				    $this->all_tracked[$id]['livedb_longitude'] = $line['longitude'];
269
-				    $dataFound = true;
270
-				    $this->all_tracked[$id]['time_last_coord'] = time();
268
+					$this->all_tracked[$id]['livedb_longitude'] = $line['longitude'];
269
+					$dataFound = true;
270
+					$this->all_tracked[$id]['time_last_coord'] = time();
271 271
 				}
272 272
 				$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('longitude' => $line['longitude']));
273 273
 			}
274 274
 
275
-		    } else if ($globalDebug && $timediff > 20) {
275
+			} else if ($globalDebug && $timediff > 20) {
276 276
 			$this->tmd = $this->tmd + 1;
277 277
 			echo '!!! Too much distance in short time... for '.$this->all_tracked[$id]['ident']."\n";
278 278
 			echo 'Time : '.$timediff.'s - Distance : '.$Common->distance($line['latitude'],$line['longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],'m')."m -";
279 279
 			echo 'Speed : '.(($Common->distance($line['latitude'],$line['longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],'m')/$timediff)*3.6)." km/h - ";
280 280
 			echo 'Lat : '.$line['latitude'].' - long : '.$line['longitude'].' - prev lat : '.$this->all_tracked[$id]['latitude'].' - prev long : '.$this->all_tracked[$id]['longitude']." \n";
281
-		    }
281
+			}
282 282
 		}
283 283
 		if (isset($line['last_update']) && $line['last_update'] != '') {
284
-		    if (isset($this->all_tracked[$id]['last_update']) && $this->all_tracked[$id]['last_update'] != $line['last_update']) $dataFound = true;
285
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('last_update' => $line['last_update']));
284
+			if (isset($this->all_tracked[$id]['last_update']) && $this->all_tracked[$id]['last_update'] != $line['last_update']) $dataFound = true;
285
+			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('last_update' => $line['last_update']));
286 286
 		}
287 287
 		if (isset($line['format_source']) && $line['format_source'] != '') {
288
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('format_source' => $line['format_source']));
288
+			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('format_source' => $line['format_source']));
289 289
 		}
290 290
 		if (isset($line['source_name']) && $line['source_name'] != '') {
291
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('source_name' => $line['source_name']));
291
+			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('source_name' => $line['source_name']));
292 292
 		}
293 293
 		if (isset($line['status']) && $line['status'] != '') {
294
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('status' => $line['status']));
294
+			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('status' => $line['status']));
295 295
 		}
296 296
 		if (isset($line['status_id']) && (!isset($this->all_tracked[$id]['status_id']) || $this->all_tracked[$id]['status_id'] != $line['status_id'])) {
297
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('status_id' => $line['status_id']));
298
-		    if ($this->all_tracked[$id]['addedMarine'] == 1) {
297
+			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('status_id' => $line['status_id']));
298
+			if ($this->all_tracked[$id]['addedMarine'] == 1) {
299 299
 			if (!isset($globalNoImport) || $globalNoImport !== TRUE) {
300
-			    if (!isset($globalNoDB) || $globalNoDB !== TRUE) {
300
+				if (!isset($globalNoDB) || $globalNoDB !== TRUE) {
301 301
 				$Marine = new Marine($this->db);
302 302
 				$Marine->updateStatusMarineData($this->all_tracked[$id]['id'],$this->all_tracked[$id]['status_id'],$this->all_tracked[$id]['status']);
303 303
 				unset($Marine);
304
-			    }
304
+				}
305
+			}
305 306
 			}
306
-		    }
307 307
 		}
308 308
 
309 309
 		if (isset($line['noarchive']) && $line['noarchive'] === true) {
310
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('noarchive' => true));
310
+			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('noarchive' => true));
311 311
 		}
312 312
 		
313 313
 		if (isset($line['heading']) && $line['heading'] != '') {
314
-		    if (is_int($this->all_tracked[$id]['heading']) && abs($this->all_tracked[$id]['heading']-round($line['heading'])) > 10) $this->all_tracked[$id]['putinarchive'] = true;
315
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('heading' => round($line['heading'])));
316
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('heading_fromsrc' => true));
317
-		    //$dataFound = true;
314
+			if (is_int($this->all_tracked[$id]['heading']) && abs($this->all_tracked[$id]['heading']-round($line['heading'])) > 10) $this->all_tracked[$id]['putinarchive'] = true;
315
+			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('heading' => round($line['heading'])));
316
+			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('heading_fromsrc' => true));
317
+			//$dataFound = true;
318 318
   		} elseif (!isset($this->all_tracked[$id]['heading_fromsrc']) && isset($this->all_tracked[$id]['archive_latitude']) && $this->all_tracked[$id]['archive_latitude'] != $this->all_tracked[$id]['latitude'] && isset($this->all_tracked[$id]['archive_longitude']) && $this->all_tracked[$id]['archive_longitude'] != $this->all_tracked[$id]['longitude']) {
319
-  		    $heading = $Common->getHeading($this->all_tracked[$id]['archive_latitude'],$this->all_tracked[$id]['archive_longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude']);
320
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('heading' => round($heading)));
321
-		    if (abs($this->all_tracked[$id]['heading']-round($heading)) > 10) $this->all_tracked[$id]['putinarchive'] = true;
322
-  		    if ($globalDebug) echo "ø Calculated Heading for ".$this->all_tracked[$id]['ident']." : ".$heading."\n";
319
+  			$heading = $Common->getHeading($this->all_tracked[$id]['archive_latitude'],$this->all_tracked[$id]['archive_longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude']);
320
+			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('heading' => round($heading)));
321
+			if (abs($this->all_tracked[$id]['heading']-round($heading)) > 10) $this->all_tracked[$id]['putinarchive'] = true;
322
+  			if ($globalDebug) echo "ø Calculated Heading for ".$this->all_tracked[$id]['ident']." : ".$heading."\n";
323 323
   		}
324 324
 		//if (isset($globalSourcesupdate) && $globalSourcesupdate != '' && isset($this->all_tracked[$id]['lastupdate']) && time()-$this->all_tracked[$id]['lastupdate'] < $globalSourcesupdate) $dataFound = false;
325 325
 
326 326
 
327 327
 
328 328
 		if ($dataFound === true && isset($this->all_tracked[$id]['mmsi'])) {
329
-		    $this->all_tracked[$id]['lastupdate'] = time();
330
-		    if ($this->all_tracked[$id]['addedMarine'] == 0) {
331
-		        if (!isset($globalDistanceIgnore['latitude']) || $this->all_tracked[$id]['longitude'] == ''  || $this->all_tracked[$id]['latitude'] == '' || (isset($globalDistanceIgnore['latitude']) && $Common->distance($this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude']) < $globalDistanceIgnore['distance'])) {
332
-			    if (!isset($this->all_tracked[$id]['forcenew']) || $this->all_tracked[$id]['forcenew'] == 0) {
329
+			$this->all_tracked[$id]['lastupdate'] = time();
330
+			if ($this->all_tracked[$id]['addedMarine'] == 0) {
331
+				if (!isset($globalDistanceIgnore['latitude']) || $this->all_tracked[$id]['longitude'] == ''  || $this->all_tracked[$id]['latitude'] == '' || (isset($globalDistanceIgnore['latitude']) && $Common->distance($this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude']) < $globalDistanceIgnore['distance'])) {
332
+				if (!isset($this->all_tracked[$id]['forcenew']) || $this->all_tracked[$id]['forcenew'] == 0) {
333 333
 				if (!isset($globalNoDB) || $globalNoDB !== TRUE) {
334
-				    if ($globalDebug) echo "Check if aircraft is already in DB...";
335
-				    $timeelapsed = microtime(true);
336
-				    $MarineLive = new MarineLive($this->db);
337
-				    if (isset($line['id'])) {
334
+					if ($globalDebug) echo "Check if aircraft is already in DB...";
335
+					$timeelapsed = microtime(true);
336
+					$MarineLive = new MarineLive($this->db);
337
+					if (isset($line['id'])) {
338 338
 					$recent_ident = $MarineLive->checkIdRecent($line['id']);
339 339
 					if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
340
-				    } elseif (isset($this->all_tracked[$id]['mmsi']) && $this->all_tracked[$id]['mmsi'] != '') {
340
+					} elseif (isset($this->all_tracked[$id]['mmsi']) && $this->all_tracked[$id]['mmsi'] != '') {
341 341
 					$recent_ident = $MarineLive->checkMMSIRecent($this->all_tracked[$id]['mmsi']);
342 342
 					if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdentRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
343
-				    } elseif (isset($this->all_tracked[$id]['ident']) && $this->all_tracked[$id]['ident'] != '') {
343
+					} elseif (isset($this->all_tracked[$id]['ident']) && $this->all_tracked[$id]['ident'] != '') {
344 344
 					$recent_ident = $MarineLive->checkIdentRecent($this->all_tracked[$id]['ident']);
345 345
 					if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdentRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
346
-				    } else $recent_ident = '';
347
-				    $MarineLive->db=null;
348
-				    if ($globalDebug && $recent_ident == '') echo " Not in DB.\n";
349
-				    elseif ($globalDebug && $recent_ident != '') echo " Already in DB.\n";
346
+					} else $recent_ident = '';
347
+					$MarineLive->db=null;
348
+					if ($globalDebug && $recent_ident == '') echo " Not in DB.\n";
349
+					elseif ($globalDebug && $recent_ident != '') echo " Already in DB.\n";
350 350
 				} else $recent_ident = '';
351
-			    } else {
351
+				} else {
352 352
 				$recent_ident = '';
353 353
 				$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('forcenew' => 0));
354
-			    }
355
-			    //if there was no aircraft with the same callsign within the last hour and go post it into the archive
356
-			    if($recent_ident == "" && $this->all_tracked[$id]['latitude'] != '' && $this->all_tracked[$id]['longitude'] != '')
357
-			    {
354
+				}
355
+				//if there was no aircraft with the same callsign within the last hour and go post it into the archive
356
+				if($recent_ident == "" && $this->all_tracked[$id]['latitude'] != '' && $this->all_tracked[$id]['longitude'] != '')
357
+				{
358 358
 				if ($globalDebug) echo "\o/ Add ".$this->all_tracked[$id]['mmsi']." in archive DB : ";
359 359
 				//adds the spotter data for the archive
360
-				    $highlight = '';
361
-				    if (!isset($this->all_tracked[$id]['id'])) $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $this->all_tracked[$id]['mmsi'].'-'.date('YmdHi')));
362
-				    if (!isset($globalNoImport) || $globalNoImport !== TRUE) {
360
+					$highlight = '';
361
+					if (!isset($this->all_tracked[$id]['id'])) $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $this->all_tracked[$id]['mmsi'].'-'.date('YmdHi')));
362
+					if (!isset($globalNoImport) || $globalNoImport !== TRUE) {
363 363
 					if (!isset($globalNoDB) || $globalNoDB !== TRUE) {
364
-					    $timeelapsed = microtime(true);
365
-					    $Marine = new Marine($this->db);
366
-					    $result = $Marine->addMarineData($this->all_tracked[$id]['id'], $this->all_tracked[$id]['ident'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], $this->all_tracked[$id]['heading'], $this->all_tracked[$id]['speed'], $this->all_tracked[$id]['datetime'], $this->all_tracked[$id]['mmsi'], $this->all_tracked[$id]['type'],$this->all_tracked[$id]['typeid'],$this->all_tracked[$id]['imo'],$this->all_tracked[$id]['callsign'],$this->all_tracked[$id]['arrival_code'],$this->all_tracked[$id]['arrival_date'], $this->all_tracked[$id]['status'], $this->all_tracked[$id]['status_id'],$this->all_tracked[$id]['format_source'],$this->all_tracked[$id]['source_name']);
367
-					    $Marine->db = null;
368
-					    if ($globalDebug && isset($result)) echo $result."\n";
369
-					    if ($globalDebugTimeElapsed) echo 'Time elapsed for update addspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
364
+						$timeelapsed = microtime(true);
365
+						$Marine = new Marine($this->db);
366
+						$result = $Marine->addMarineData($this->all_tracked[$id]['id'], $this->all_tracked[$id]['ident'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], $this->all_tracked[$id]['heading'], $this->all_tracked[$id]['speed'], $this->all_tracked[$id]['datetime'], $this->all_tracked[$id]['mmsi'], $this->all_tracked[$id]['type'],$this->all_tracked[$id]['typeid'],$this->all_tracked[$id]['imo'],$this->all_tracked[$id]['callsign'],$this->all_tracked[$id]['arrival_code'],$this->all_tracked[$id]['arrival_date'], $this->all_tracked[$id]['status'], $this->all_tracked[$id]['status_id'],$this->all_tracked[$id]['format_source'],$this->all_tracked[$id]['source_name']);
367
+						$Marine->db = null;
368
+						if ($globalDebug && isset($result)) echo $result."\n";
369
+						if ($globalDebugTimeElapsed) echo 'Time elapsed for update addspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
370 370
 					}
371
-				    }
372
-				    /*
371
+					}
372
+					/*
373 373
 				    // Add source stat in DB
374 374
 				    $Stats = new Stats($this->db);
375 375
 				    if (!empty($this->stats)) {
@@ -396,56 +396,56 @@  discard block
 block discarded – undo
396 396
 				    }
397 397
 				    $Stats->db = null;
398 398
 				    */
399
-				    $this->del();
399
+					$this->del();
400 400
 				//$ignoreImport = false;
401 401
 				$this->all_tracked[$id]['addedMarine'] = 1;
402 402
 				//print_r($this->all_tracked[$id]);
403 403
 				if ($this->last_delete == 0 || time() - $this->last_delete > 1800) {
404
-				    if ($globalDebug) echo "---- Deleting Live Marine data older than 9 hours...";
405
-				    //MarineLive->deleteLiveMarineDataNotUpdated();
406
-				    if (!isset($globalNoDB) || $globalNoDB !== TRUE) {
404
+					if ($globalDebug) echo "---- Deleting Live Marine data older than 9 hours...";
405
+					//MarineLive->deleteLiveMarineDataNotUpdated();
406
+					if (!isset($globalNoDB) || $globalNoDB !== TRUE) {
407 407
 					$MarineLive = new MarineLive($this->db);
408 408
 					$MarineLive->deleteLiveMarineData();
409 409
 					$MarineLive->db=null;
410 410
 					if ($globalDebug) echo " Done\n";
411
-				    }
412
-				    $this->last_delete = time();
411
+					}
412
+					$this->last_delete = time();
413 413
 				}
414
-			    } elseif ($recent_ident != '') {
414
+				} elseif ($recent_ident != '') {
415 415
 				$this->all_tracked[$id]['id'] = $recent_ident;
416 416
 				$this->all_tracked[$id]['addedMarine'] = 1;
417 417
 				if (!isset($globalNoDB) || $globalNoDB !== TRUE) {
418
-				    if (isset($globalDaemon) && !$globalDaemon) {
418
+					if (isset($globalDaemon) && !$globalDaemon) {
419 419
 					$Marine = new Marine($this->db);
420 420
 					$Marine->updateLatestMarineData($this->all_tracked[$id]['id'],$this->all_tracked[$id]['ident'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],$this->all_tracked[$id]['speed'],$this->all_tracked[$id]['datetime']);
421 421
 					$Marine->db = null;
422
-				    }
422
+					}
423 423
 				}
424 424
 				
425
-			    }
425
+				}
426
+			}
426 427
 			}
427
-		    }
428
-		    //adds the spotter LIVE data
429
-		    if ($globalDebug) {
428
+			//adds the spotter LIVE data
429
+			if ($globalDebug) {
430 430
 			echo 'DATA : ident : '.$this->all_tracked[$id]['ident'].' - type : '.$this->all_tracked[$id]['type'].' - Latitude : '.$this->all_tracked[$id]['latitude'].' - Longitude : '.$this->all_tracked[$id]['longitude'].' - Heading : '.$this->all_tracked[$id]['heading'].' - Speed : '.$this->all_tracked[$id]['speed']."\n";
431
-		    }
432
-		    $ignoreImport = false;
431
+			}
432
+			$ignoreImport = false;
433 433
 
434
-		    if (!$ignoreImport) {
434
+			if (!$ignoreImport) {
435 435
 			if (!isset($globalDistanceIgnore['latitude']) || (isset($globalDistanceIgnore['latitude']) && $Common->distance($this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude']) < $globalDistanceIgnore['distance'])) {
436 436
 				if ($globalDebug) echo "\o/ Add ".$this->all_tracked[$id]['ident']." from ".$this->all_tracked[$id]['format_source']." in Live DB : ";
437 437
 				if (!isset($globalNoImport) || $globalNoImport !== TRUE) {
438
-				    if (!isset($globalNoDB) || $globalNoDB !== TRUE) {
438
+					if (!isset($globalNoDB) || $globalNoDB !== TRUE) {
439 439
 					$timeelapsed = microtime(true);
440 440
 					$MarineLive = new MarineLive($this->db);
441 441
 					$result = $MarineLive->addLiveMarineData($this->all_tracked[$id]['id'], $this->all_tracked[$id]['ident'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], $this->all_tracked[$id]['heading'], $this->all_tracked[$id]['speed'],$this->all_tracked[$id]['datetime'], $this->all_tracked[$id]['putinarchive'],$this->all_tracked[$id]['mmsi'],$this->all_tracked[$id]['type'],$this->all_tracked[$id]['typeid'],$this->all_tracked[$id]['imo'],$this->all_tracked[$id]['callsign'],$this->all_tracked[$id]['arrival_code'],$this->all_tracked[$id]['arrival_date'],$this->all_tracked[$id]['status'],$this->all_tracked[$id]['status_id'],$this->all_tracked[$id]['noarchive'],$this->all_tracked[$id]['format_source'],$this->all_tracked[$id]['source_name'],$this->all_tracked[$id]['over_country']);
442 442
 					$MarineLive->db = null;
443 443
 					if ($globalDebug) echo $result."\n";
444 444
 					if ($globalDebugTimeElapsed) echo 'Time elapsed for update addlivespotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
445
-				    }
445
+					}
446 446
 				}
447 447
 				if (isset($globalServerAPRS) && $globalServerAPRS && $this->all_tracked[$id]['putinarchive']) {
448
-				    $APRSMarine->addLiveMarineData($this->all_tracked[$id]['id'], $this->all_tracked[$id]['ident'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], $this->all_tracked[$id]['heading'], $this->all_tracked[$id]['speed'],$this->all_tracked[$id]['datetime'], $this->all_tracked[$id]['putinarchive'],$this->all_tracked[$id]['mmsi'],$this->all_tracked[$id]['type'],$this->all_tracked[$id]['typeid'],$this->all_tracked[$id]['imo'],$this->all_tracked[$id]['callsign'],$this->all_tracked[$id]['arrival_code'],$this->all_tracked[$id]['arrival_date'],$this->all_tracked[$id]['status'],$this->all_tracked[$id]['status_id'],$this->all_tracked[$id]['noarchive'],$this->all_tracked[$id]['format_source'],$this->all_tracked[$id]['source_name'],$this->all_tracked[$id]['over_country']);
448
+					$APRSMarine->addLiveMarineData($this->all_tracked[$id]['id'], $this->all_tracked[$id]['ident'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], $this->all_tracked[$id]['heading'], $this->all_tracked[$id]['speed'],$this->all_tracked[$id]['datetime'], $this->all_tracked[$id]['putinarchive'],$this->all_tracked[$id]['mmsi'],$this->all_tracked[$id]['type'],$this->all_tracked[$id]['typeid'],$this->all_tracked[$id]['imo'],$this->all_tracked[$id]['callsign'],$this->all_tracked[$id]['arrival_code'],$this->all_tracked[$id]['arrival_date'],$this->all_tracked[$id]['status'],$this->all_tracked[$id]['status_id'],$this->all_tracked[$id]['noarchive'],$this->all_tracked[$id]['format_source'],$this->all_tracked[$id]['source_name'],$this->all_tracked[$id]['over_country']);
449 449
 				}
450 450
 				$this->all_tracked[$id]['putinarchive'] = false;
451 451
 
@@ -510,24 +510,24 @@  discard block
 block discarded – undo
510 510
 			
511 511
 			
512 512
 			if ($this->last_delete_hourly == 0 || time() - $this->last_delete_hourly > 900) {
513
-			    if (!isset($globalNoDB) || $globalNoDB !== TRUE) {
513
+				if (!isset($globalNoDB) || $globalNoDB !== TRUE) {
514 514
 				if ($globalDebug) echo "---- Deleting Live Marine data Not updated since 2 hour...";
515 515
 				$MarineLive = new MarineLive($this->db);
516 516
 				$MarineLive->deleteLiveMarineDataNotUpdated();
517 517
 				$MarineLive->db = null;
518 518
 				//MarineLive->deleteLiveMarineData();
519 519
 				if ($globalDebug) echo " Done\n";
520
-			    }
521
-			    $this->last_delete_hourly = time();
520
+				}
521
+				$this->last_delete_hourly = time();
522 522
 			}
523 523
 			
524
-		    }
525
-		    //$ignoreImport = false;
524
+			}
525
+			//$ignoreImport = false;
526 526
 		}
527 527
 		//if (function_exists('pcntl_fork') && $globalFork) pcntl_signal(SIGCHLD, SIG_IGN);
528 528
 		if ($send) return $this->all_tracked[$id];
529
-	    }
529
+		}
530
+	}
530 531
 	}
531
-    }
532 532
 }
533 533
 ?>
Please login to merge, or discard this patch.
require/class.Marine.php 1 patch
Indentation   +205 added lines, -205 removed lines patch added patch discarded remove patch
@@ -11,10 +11,10 @@  discard block
 block discarded – undo
11 11
 	}
12 12
 
13 13
 	/**
14
-	* Get SQL query part for filter used
15
-	* @param Array $filter the filter
16
-	* @return Array the SQL part
17
-	*/
14
+	 * Get SQL query part for filter used
15
+	 * @param Array $filter the filter
16
+	 * @return Array the SQL part
17
+	 */
18 18
 	
19 19
 	public function getFilter($filter = array(),$where = false,$and = false) {
20 20
 		global $globalFilter, $globalStatsFilters, $globalFilterName, $globalDBdriver;
@@ -78,14 +78,14 @@  discard block
 block discarded – undo
78 78
 	}
79 79
 
80 80
 	/**
81
-	* Executes the SQL statements to get the spotter information
82
-	*
83
-	* @param String $query the SQL query
84
-	* @param Array $params parameter of the query
85
-	* @param String $limitQuery the limit query
86
-	* @return Array the spotter information
87
-	*
88
-	*/
81
+	 * Executes the SQL statements to get the spotter information
82
+	 *
83
+	 * @param String $query the SQL query
84
+	 * @param Array $params parameter of the query
85
+	 * @param String $limitQuery the limit query
86
+	 * @return Array the spotter information
87
+	 *
88
+	 */
89 89
 	public function getDataFromDB($query, $params = array(), $limitQuery = '',$schedules = false)
90 90
 	{
91 91
 		date_default_timezone_set('UTC');
@@ -213,11 +213,11 @@  discard block
 block discarded – undo
213 213
 	
214 214
 	
215 215
 	/**
216
-	* Gets all the spotter information based on the latest data entry
217
-	*
218
-	* @return Array the spotter information
219
-	*
220
-	*/
216
+	 * Gets all the spotter information based on the latest data entry
217
+	 *
218
+	 * @return Array the spotter information
219
+	 *
220
+	 */
221 221
 	public function getLatestMarineData($limit = '', $sort = '', $filter = array())
222 222
 	{
223 223
 		global $global_query;
@@ -266,11 +266,11 @@  discard block
 block discarded – undo
266 266
 	}
267 267
 
268 268
 	/**
269
-	* Gets all the spotter information based on the callsign
270
-	*
271
-	* @return Array the spotter information
272
-	*
273
-	*/
269
+	 * Gets all the spotter information based on the callsign
270
+	 *
271
+	 * @return Array the spotter information
272
+	 *
273
+	 */
274 274
 	public function getMarineDataByIdent($ident = '', $limit = '', $sort = '', $filter = array())
275 275
 	{
276 276
 		global $global_query;
@@ -381,12 +381,12 @@  discard block
 block discarded – undo
381 381
 
382 382
 
383 383
 	/**
384
-	* Gets all source name
385
-	*
386
-	* @param String type format of source
387
-	* @return Array list of source name
388
-	*
389
-	*/
384
+	 * Gets all source name
385
+	 *
386
+	 * @param String type format of source
387
+	 * @return Array list of source name
388
+	 *
389
+	 */
390 390
 	public function getAllSourceName($type = '',$filters = array())
391 391
 	{
392 392
 		$filter_query = $this->getFilter($filters,true,true);
@@ -416,11 +416,11 @@  discard block
 block discarded – undo
416 416
 
417 417
 
418 418
 	/**
419
-	* Gets a list of all idents/callsigns
420
-	*
421
-	* @return Array list of ident/callsign names
422
-	*
423
-	*/
419
+	 * Gets a list of all idents/callsigns
420
+	 *
421
+	 * @return Array list of ident/callsign names
422
+	 *
423
+	 */
424 424
 	public function getAllIdents($filters = array())
425 425
 	{
426 426
 		$filter_query = $this->getFilter($filters,true,true);
@@ -444,11 +444,11 @@  discard block
 block discarded – undo
444 444
 	}
445 445
 
446 446
 	/**
447
-	* Gets all info from a mmsi
448
-	*
449
-	* @return Array list of mmsi info
450
-	*
451
-	*/
447
+	 * Gets all info from a mmsi
448
+	 *
449
+	 * @return Array list of mmsi info
450
+	 *
451
+	 */
452 452
 	public function getIdentity($mmsi)
453 453
 	{
454 454
 		$mmsi = filter_var($mmsi,FILTER_SANITIZE_NUMBER_INT);
@@ -505,18 +505,18 @@  discard block
 block discarded – undo
505 505
 	
506 506
 	
507 507
 	/**
508
-	* Update ident tracker data
509
-	*
510
-	* @param String $fammarine_id the ID
511
-	* @param String $ident the marine ident
512
-	* @return String success or false
513
-	*
514
-	*/	
508
+	 * Update ident tracker data
509
+	 *
510
+	 * @param String $fammarine_id the ID
511
+	 * @param String $ident the marine ident
512
+	 * @return String success or false
513
+	 *
514
+	 */	
515 515
 	public function updateIdentMarineData($fammarine_id = '', $ident = '',$fromsource = NULL)
516 516
 	{
517 517
 
518 518
 		$query = 'UPDATE marine_output SET ident = :ident WHERE fammarine_id = :fammarine_id';
519
-                $query_values = array(':fammarine_id' => $fammarine_id,':ident' => $ident);
519
+				$query_values = array(':fammarine_id' => $fammarine_id,':ident' => $ident);
520 520
 
521 521
 		try {
522 522
 			$sth = $this->db->prepare($query);
@@ -530,19 +530,19 @@  discard block
 block discarded – undo
530 530
 	}
531 531
 
532 532
 	/**
533
-	* Update Status data
534
-	*
535
-	* @param String $fammarine_id the ID
536
-	* @param String $status_id the marine status id
537
-	* @param String $status the marine status
538
-	* @return String success or false
539
-	*
540
-	*/	
533
+	 * Update Status data
534
+	 *
535
+	 * @param String $fammarine_id the ID
536
+	 * @param String $status_id the marine status id
537
+	 * @param String $status the marine status
538
+	 * @return String success or false
539
+	 *
540
+	 */	
541 541
 	public function updateStatusMarineData($fammarine_id = '', $status_id = '',$status = '')
542 542
 	{
543 543
 
544 544
 		$query = 'UPDATE marine_output SET status = :status, status_id = :status_id WHERE fammarine_id = :fammarine_id';
545
-                $query_values = array(':fammarine_id' => $fammarine_id,':status' => $status,':status_id' => $status_id);
545
+				$query_values = array(':fammarine_id' => $fammarine_id,':status' => $status,':status_id' => $status_id);
546 546
 
547 547
 		try {
548 548
 			$sth = $this->db->prepare($query);
@@ -555,17 +555,17 @@  discard block
 block discarded – undo
555 555
 
556 556
 	}
557 557
 	/**
558
-	* Update latest marine data
559
-	*
560
-	* @param String $fammarine_id the ID
561
-	* @param String $ident the marine ident
562
-	* @return String success or false
563
-	*
564
-	*/	
558
+	 * Update latest marine data
559
+	 *
560
+	 * @param String $fammarine_id the ID
561
+	 * @param String $ident the marine ident
562
+	 * @return String success or false
563
+	 *
564
+	 */	
565 565
 	public function updateLatestMarineData($fammarine_id = '', $ident = '', $latitude = '', $longitude = '', $groundspeed = NULL, $date = '')
566 566
 	{
567 567
 		$query = 'UPDATE marine_output SET ident = :ident, last_latitude = :last_latitude, last_longitude = :last_longitude, last_seen = :last_seen, last_ground_speed = :last_ground_speed WHERE fammarine_id = :fammarine_id';
568
-                $query_values = array(':fammarine_id' => $fammarine_id,':last_latitude' => $latitude,':last_longitude' => $longitude, ':last_ground_speed' => $groundspeed,':last_seen' => $date,':ident' => $ident);
568
+				$query_values = array(':fammarine_id' => $fammarine_id,':last_latitude' => $latitude,':last_longitude' => $longitude, ':last_ground_speed' => $groundspeed,':last_seen' => $date,':ident' => $ident);
569 569
 
570 570
 		try {
571 571
 			$sth = $this->db->prepare($query);
@@ -579,30 +579,30 @@  discard block
 block discarded – undo
579 579
 	}
580 580
 
581 581
 	/**
582
-	* Adds a new spotter data
583
-	*
584
-	* @param String $fammarine_id the ID
585
-	* @param String $ident the marine ident
586
-	* @param String $departure_airport_icao the departure airport
587
-	* @param String $arrival_airport_icao the arrival airport
588
-	* @param String $latitude latitude of flight
589
-	* @param String $longitude latitude of flight
590
-	* @param String $waypoints waypoints of flight
591
-	* @param String $heading heading of flight
592
-	* @param String $groundspeed speed of flight
593
-	* @param String $date date of flight
594
-	* @param String $departure_airport_time departure time of flight
595
-	* @param String $arrival_airport_time arrival time of flight
596
-	* @param String $squawk squawk code of flight
597
-	* @param String $route_stop route stop of flight
598
-	* @param String $highlight highlight or not
599
-	* @param String $ModeS ModesS code of flight
600
-	* @param String $registration registration code of flight
601
-	* @param String $pilot_id pilot id of flight (for virtual airlines)
602
-	* @param String $pilot_name pilot name of flight (for virtual airlines)
603
-	* @param String $verticalrate vertival rate of flight
604
-	* @return String success or false
605
-	*/
582
+	 * Adds a new spotter data
583
+	 *
584
+	 * @param String $fammarine_id the ID
585
+	 * @param String $ident the marine ident
586
+	 * @param String $departure_airport_icao the departure airport
587
+	 * @param String $arrival_airport_icao the arrival airport
588
+	 * @param String $latitude latitude of flight
589
+	 * @param String $longitude latitude of flight
590
+	 * @param String $waypoints waypoints of flight
591
+	 * @param String $heading heading of flight
592
+	 * @param String $groundspeed speed of flight
593
+	 * @param String $date date of flight
594
+	 * @param String $departure_airport_time departure time of flight
595
+	 * @param String $arrival_airport_time arrival time of flight
596
+	 * @param String $squawk squawk code of flight
597
+	 * @param String $route_stop route stop of flight
598
+	 * @param String $highlight highlight or not
599
+	 * @param String $ModeS ModesS code of flight
600
+	 * @param String $registration registration code of flight
601
+	 * @param String $pilot_id pilot id of flight (for virtual airlines)
602
+	 * @param String $pilot_name pilot name of flight (for virtual airlines)
603
+	 * @param String $verticalrate vertival rate of flight
604
+	 * @return String success or false
605
+	 */
606 606
 	public function addMarineData($fammarine_id = '', $ident = '', $latitude = '', $longitude = '', $heading = '', $groundspeed = '', $date = '', $mmsi = '',$type = '',$typeid = '',$imo = '',$callsign = '',$arrival_code = '',$arrival_date = '',$status = '',$statusid = '',$format_source = '', $source_name = '')
607 607
 	{
608 608
 		global $globalURL, $globalMarineImageFetch;
@@ -699,13 +699,13 @@  discard block
 block discarded – undo
699 699
 			unset($Image);
700 700
 		}
701 701
 		
702
-                if ($latitude == '' && $longitude == '') {
703
-            		$latitude = 0;
704
-            		$longitude = 0;
705
-            	}
706
-                if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0;
707
-                if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0;
708
-                if ($arrival_date == '') $arrival_date = NULL;
702
+				if ($latitude == '' && $longitude == '') {
703
+					$latitude = 0;
704
+					$longitude = 0;
705
+				}
706
+				if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0;
707
+				if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0;
708
+				if ($arrival_date == '') $arrival_date = NULL;
709 709
 		$query  = "INSERT INTO marine_output (fammarine_id, ident, latitude, longitude, heading, ground_speed, date, format_source, source_name, mmsi, type, status,imo,arrival_port_name,arrival_port_date) 
710 710
 		    VALUES (:fammarine_id,:ident,:latitude,:longitude,:heading,:speed,:date,:format_source, :source_name,:mmsi,:type,:status,:imo,:arrival_port_name,:arrival_port_date)";
711 711
 
@@ -716,7 +716,7 @@  discard block
 block discarded – undo
716 716
 			$sth->execute($query_values);
717 717
 			$this->db = null;
718 718
 		} catch (PDOException $e) {
719
-		    return "error : ".$e->getMessage();
719
+			return "error : ".$e->getMessage();
720 720
 		}
721 721
 		
722 722
 		return "success";
@@ -725,11 +725,11 @@  discard block
 block discarded – undo
725 725
 	
726 726
   
727 727
 	/**
728
-	* Gets the aircraft ident within the last hour
729
-	*
730
-	* @return String the ident
731
-	*
732
-	*/
728
+	 * Gets the aircraft ident within the last hour
729
+	 *
730
+	 * @return String the ident
731
+	 *
732
+	 */
733 733
 	public function getIdentFromLastHour($ident)
734 734
 	{
735 735
 		global $globalDBdriver, $globalTimezone;
@@ -745,11 +745,11 @@  discard block
 block discarded – undo
745 745
 								AND marine_output.date >= now() AT TIME ZONE 'UTC' - INTERVAL '1 HOURS'
746 746
 								AND marine_output.date < now() AT TIME ZONE 'UTC'";
747 747
 			$query_data = array(':ident' => $ident);
748
-    		}
748
+			}
749 749
 		
750 750
 		$sth = $this->db->prepare($query);
751 751
 		$sth->execute($query_data);
752
-    		$ident_result='';
752
+			$ident_result='';
753 753
 		while($row = $sth->fetch(PDO::FETCH_ASSOC))
754 754
 		{
755 755
 			$ident_result = $row['ident'];
@@ -760,11 +760,11 @@  discard block
 block discarded – undo
760 760
 	
761 761
 	
762 762
 	/**
763
-	* Gets the aircraft data from the last 20 seconds
764
-	*
765
-	* @return Array the spotter data
766
-	*
767
-	*/
763
+	 * Gets the aircraft data from the last 20 seconds
764
+	 *
765
+	 * @return Array the spotter data
766
+	 *
767
+	 */
768 768
 	public function getRealTimeData($q = '')
769 769
 	{
770 770
 		global $globalDBdriver;
@@ -802,11 +802,11 @@  discard block
 block discarded – undo
802 802
 	
803 803
 
804 804
 	/**
805
-	* Gets all number of flight over countries
806
-	*
807
-	* @return Array the airline country list
808
-	*
809
-	*/
805
+	 * Gets all number of flight over countries
806
+	 *
807
+	 * @return Array the airline country list
808
+	 *
809
+	 */
810 810
 /*
811 811
 	public function countAllTrackedOverCountries($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array())
812 812
 	{
@@ -857,11 +857,11 @@  discard block
 block discarded – undo
857 857
 	
858 858
 	
859 859
 	/**
860
-	* Gets all callsigns that have flown over
861
-	*
862
-	* @return Array the callsign list
863
-	*
864
-	*/
860
+	 * Gets all callsigns that have flown over
861
+	 *
862
+	 * @return Array the callsign list
863
+	 *
864
+	 */
865 865
 	public function countAllCallsigns($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array(),$year = '', $month = '', $day = '')
866 866
 	{
867 867
 		global $globalDBdriver;
@@ -928,11 +928,11 @@  discard block
 block discarded – undo
928 928
 
929 929
 
930 930
 	/**
931
-	* Counts all dates
932
-	*
933
-	* @return Array the date list
934
-	*
935
-	*/
931
+	 * Counts all dates
932
+	 *
933
+	 * @return Array the date list
934
+	 *
935
+	 */
936 936
 	public function countAllDates($filters = array())
937 937
 	{
938 938
 		global $globalTimezone, $globalDBdriver;
@@ -978,11 +978,11 @@  discard block
 block discarded – undo
978 978
 	
979 979
 	
980 980
 	/**
981
-	* Counts all dates during the last 7 days
982
-	*
983
-	* @return Array the date list
984
-	*
985
-	*/
981
+	 * Counts all dates during the last 7 days
982
+	 *
983
+	 * @return Array the date list
984
+	 *
985
+	 */
986 986
 	public function countAllDatesLast7Days($filters = array())
987 987
 	{
988 988
 		global $globalTimezone, $globalDBdriver;
@@ -1004,7 +1004,7 @@  discard block
 block discarded – undo
1004 1004
 			$query .= " GROUP BY date_name 
1005 1005
 								ORDER BY date_name ASC";
1006 1006
 			$query_data = array(':offset' => $offset);
1007
-    		}
1007
+			}
1008 1008
 		
1009 1009
 		$sth = $this->db->prepare($query);
1010 1010
 		$sth->execute($query_data);
@@ -1024,11 +1024,11 @@  discard block
 block discarded – undo
1024 1024
 	}
1025 1025
 
1026 1026
 	/**
1027
-	* Counts all dates during the last month
1028
-	*
1029
-	* @return Array the date list
1030
-	*
1031
-	*/
1027
+	 * Counts all dates during the last month
1028
+	 *
1029
+	 * @return Array the date list
1030
+	 *
1031
+	 */
1032 1032
 	public function countAllDatesLastMonth($filters = array())
1033 1033
 	{
1034 1034
 		global $globalTimezone, $globalDBdriver;
@@ -1050,7 +1050,7 @@  discard block
 block discarded – undo
1050 1050
 			$query .= " GROUP BY date_name 
1051 1051
 								ORDER BY date_name ASC";
1052 1052
 			$query_data = array(':offset' => $offset);
1053
-    		}
1053
+			}
1054 1054
 		
1055 1055
 		$sth = $this->db->prepare($query);
1056 1056
 		$sth->execute($query_data);
@@ -1072,11 +1072,11 @@  discard block
 block discarded – undo
1072 1072
 
1073 1073
 
1074 1074
 	/**
1075
-	* Counts all month
1076
-	*
1077
-	* @return Array the month list
1078
-	*
1079
-	*/
1075
+	 * Counts all month
1076
+	 *
1077
+	 * @return Array the month list
1078
+	 *
1079
+	 */
1080 1080
 	public function countAllMonths($filters = array())
1081 1081
 	{
1082 1082
 		global $globalTimezone, $globalDBdriver;
@@ -1121,11 +1121,11 @@  discard block
 block discarded – undo
1121 1121
 	
1122 1122
 
1123 1123
 	/**
1124
-	* Counts all dates during the last year
1125
-	*
1126
-	* @return Array the date list
1127
-	*
1128
-	*/
1124
+	 * Counts all dates during the last year
1125
+	 *
1126
+	 * @return Array the date list
1127
+	 *
1128
+	 */
1129 1129
 	public function countAllMonthsLastYear($filters)
1130 1130
 	{
1131 1131
 		global $globalTimezone, $globalDBdriver;
@@ -1147,7 +1147,7 @@  discard block
 block discarded – undo
1147 1147
 			$query .= " GROUP BY year_name, month_name
1148 1148
 								ORDER BY year_name, month_name ASC";
1149 1149
 			$query_data = array(':offset' => $offset);
1150
-    		}
1150
+			}
1151 1151
 		
1152 1152
 		$sth = $this->db->prepare($query);
1153 1153
 		$sth->execute($query_data);
@@ -1170,11 +1170,11 @@  discard block
 block discarded – undo
1170 1170
 	
1171 1171
 	
1172 1172
 	/**
1173
-	* Counts all hours
1174
-	*
1175
-	* @return Array the hour list
1176
-	*
1177
-	*/
1173
+	 * Counts all hours
1174
+	 *
1175
+	 * @return Array the hour list
1176
+	 *
1177
+	 */
1178 1178
 	public function countAllHours($orderby,$filters = array())
1179 1179
 	{
1180 1180
 		global $globalTimezone, $globalDBdriver;
@@ -1237,11 +1237,11 @@  discard block
 block discarded – undo
1237 1237
 	
1238 1238
 	
1239 1239
 	/**
1240
-	* Counts all hours by date
1241
-	*
1242
-	* @return Array the hour list
1243
-	*
1244
-	*/
1240
+	 * Counts all hours by date
1241
+	 *
1242
+	 * @return Array the hour list
1243
+	 *
1244
+	 */
1245 1245
 	public function countAllHoursByDate($date, $filters = array())
1246 1246
 	{
1247 1247
 		global $globalTimezone, $globalDBdriver;
@@ -1285,11 +1285,11 @@  discard block
 block discarded – undo
1285 1285
 	
1286 1286
 	
1287 1287
 	/**
1288
-	* Counts all hours by a ident/callsign
1289
-	*
1290
-	* @return Array the hour list
1291
-	*
1292
-	*/
1288
+	 * Counts all hours by a ident/callsign
1289
+	 *
1290
+	 * @return Array the hour list
1291
+	 *
1292
+	 */
1293 1293
 	public function countAllHoursByIdent($ident, $filters = array())
1294 1294
 	{
1295 1295
 		global $globalTimezone, $globalDBdriver;
@@ -1334,11 +1334,11 @@  discard block
 block discarded – undo
1334 1334
 	
1335 1335
 	
1336 1336
 	/**
1337
-	* Counts all flights that have flown over
1338
-	*
1339
-	* @return Integer the number of flights
1340
-	*
1341
-	*/
1337
+	 * Counts all flights that have flown over
1338
+	 *
1339
+	 * @return Integer the number of flights
1340
+	 *
1341
+	 */
1342 1342
 	public function countOverallTracked($filters = array(),$year = '',$month = '')
1343 1343
 	{
1344 1344
 		global $globalDBdriver;
@@ -1373,11 +1373,11 @@  discard block
 block discarded – undo
1373 1373
 	
1374 1374
   
1375 1375
 	/**
1376
-	* Counts all hours of today
1377
-	*
1378
-	* @return Array the hour list
1379
-	*
1380
-	*/
1376
+	 * Counts all hours of today
1377
+	 *
1378
+	 * @return Array the hour list
1379
+	 *
1380
+	 */
1381 1381
 	public function countAllHoursFromToday($filters = array())
1382 1382
 	{
1383 1383
 		global $globalTimezone, $globalDBdriver;
@@ -1417,12 +1417,12 @@  discard block
 block discarded – undo
1417 1417
 	}
1418 1418
     
1419 1419
     
1420
-     /**
1421
-	* Gets the Barrie Spotter ID based on the FlightAware ID
1422
-	*
1423
-	* @return Integer the Barrie Spotter ID
1420
+	 /**
1421
+	  * Gets the Barrie Spotter ID based on the FlightAware ID
1422
+	  *
1423
+	  * @return Integer the Barrie Spotter ID
1424 1424
 q	*
1425
-	*/
1425
+	  */
1426 1426
 	public function getMarineIDBasedOnFamMarineID($fammarine_id)
1427 1427
 	{
1428 1428
 		$fammarine_id = filter_var($fammarine_id,FILTER_SANITIZE_STRING);
@@ -1443,13 +1443,13 @@  discard block
 block discarded – undo
1443 1443
   
1444 1444
  
1445 1445
 	/**
1446
-	* Parses a date string
1447
-	*
1448
-	* @param String $dateString the date string
1449
-	* @param String $timezone the timezone of a user
1450
-	* @return Array the time information
1451
-	*
1452
-	*/
1446
+	 * Parses a date string
1447
+	 *
1448
+	 * @param String $dateString the date string
1449
+	 * @param String $timezone the timezone of a user
1450
+	 * @return Array the time information
1451
+	 *
1452
+	 */
1453 1453
 	public function parseDateString($dateString, $timezone = '')
1454 1454
 	{
1455 1455
 		$time_array = array();
@@ -1482,12 +1482,12 @@  discard block
 block discarded – undo
1482 1482
 	}
1483 1483
 	
1484 1484
 	/**
1485
-	* Parses the direction degrees to working
1486
-	*
1487
-	* @param Float $direction the direction in degrees
1488
-	* @return Array the direction information
1489
-	*
1490
-	*/
1485
+	 * Parses the direction degrees to working
1486
+	 *
1487
+	 * @param Float $direction the direction in degrees
1488
+	 * @return Array the direction information
1489
+	 *
1490
+	 */
1491 1491
 	public function parseDirection($direction = 0)
1492 1492
 	{
1493 1493
 		if ($direction == '') $direction = 0;
@@ -1566,12 +1566,12 @@  discard block
 block discarded – undo
1566 1566
 	
1567 1567
 	
1568 1568
 	/**
1569
-	* Gets Country from latitude/longitude
1570
-	*
1571
-	* @param Float $latitude latitute of the flight
1572
-	* @param Float $longitude longitute of the flight
1573
-	* @return String the countrie
1574
-	*/
1569
+	 * Gets Country from latitude/longitude
1570
+	 *
1571
+	 * @param Float $latitude latitute of the flight
1572
+	 * @param Float $longitude longitute of the flight
1573
+	 * @return String the countrie
1574
+	 */
1575 1575
 	public function getCountryFromLatitudeLongitude($latitude,$longitude)
1576 1576
 	{
1577 1577
 		global $globalDBdriver, $globalDebug;
@@ -1608,11 +1608,11 @@  discard block
 block discarded – undo
1608 1608
 	}
1609 1609
 
1610 1610
 	/**
1611
-	* Gets Country from iso2
1612
-	*
1613
-	* @param String $iso2 ISO2 country code
1614
-	* @return String the countrie
1615
-	*/
1611
+	 * Gets Country from iso2
1612
+	 *
1613
+	 * @param String $iso2 ISO2 country code
1614
+	 * @return String the countrie
1615
+	 */
1616 1616
 	public function getCountryFromISO2($iso2)
1617 1617
 	{
1618 1618
 		global $globalDBdriver, $globalDebug;
@@ -1641,12 +1641,12 @@  discard block
 block discarded – undo
1641 1641
 
1642 1642
 	
1643 1643
 	/**
1644
-	* Gets the short url from bit.ly
1645
-	*
1646
-	* @param String $url the full url
1647
-	* @return String the bit.ly url
1648
-	*
1649
-	*/
1644
+	 * Gets the short url from bit.ly
1645
+	 *
1646
+	 * @param String $url the full url
1647
+	 * @return String the bit.ly url
1648
+	 *
1649
+	 */
1650 1650
 	public function getBitlyURL($url)
1651 1651
 	{
1652 1652
 		global $globalBitlyAccessToken;
Please login to merge, or discard this patch.