Completed
Pull Request — master (#448)
by
unknown
10:23
created
table-output.php 1 patch
Braces   +78 added lines, -29 removed lines patch added patch discarded remove patch
@@ -7,8 +7,10 @@  discard block
 block discarded – undo
7 7
 $showRouteStop = $Common->multiKeyExists($spotter_array,'route_stop');
8 8
 if (isset($globalVM) && $globalVM && isset($type) && $type == 'marine') {
9 9
 	$showDuration = $Common->multiKeyExists($spotter_array,'race_time');
10
-	if ($showDuration === false) $showDuration = $Common->multiKeyExists($spotter_array,'duration');
11
-} else {
10
+	if ($showDuration === false) {
11
+		$showDuration = $Common->multiKeyExists($spotter_array,'duration');
12
+	}
13
+	} else {
12 14
 	$showDuration = $Common->multiKeyExists($spotter_array,'duration');
13 15
 }
14 16
 if (isset($globalVM) && $globalVM && isset($type) && $type == 'marine') {
@@ -16,7 +18,9 @@  discard block
 block discarded – undo
16 18
 }
17 19
 
18 20
 
19
-if (!isset($type)) $type = 'aircraft';
21
+if (!isset($type)) {
22
+	$type = 'aircraft';
23
+}
20 24
 
21 25
 if (!isset($_GET['sort'])) 
22 26
 {
@@ -592,7 +596,9 @@  discard block
 block discarded – undo
592 596
 	if (isset($globalTimezone))
593 597
 	{
594 598
 		date_default_timezone_set($globalTimezone);
595
-	} else date_default_timezone_set('UTC');
599
+	} else {
600
+		date_default_timezone_set('UTC');
601
+	}
596 602
 	if ($showSpecial === true)
597 603
 	{
598 604
 		print '<tr class="special">'."\n";
@@ -607,7 +613,9 @@  discard block
 block discarded – undo
607 613
 			print '<tr class="active">';
608 614
 		} elseif (isset($spotter_item['spotted_registration'])) {
609 615
 			print '<tr class="info">';
610
-		} else print '<tr>';
616
+		} else {
617
+			print '<tr>';
618
+		}
611 619
 	}
612 620
 	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") {
613 621
 		if ($type == 'aircraft') {
@@ -615,8 +623,9 @@  discard block
 block discarded – undo
615 623
 			{
616 624
 				print '<td class="aircraft_thumbnail">'."\n";
617 625
 				if ($spotter_item['image_source'] == 'planespotters') {
618
-					if ($spotter_item['image_source_website'] != '') $image_src = $spotter_item['image_source_website'];
619
-					else {
626
+					if ($spotter_item['image_source_website'] != '') {
627
+						$image_src = $spotter_item['image_source_website'];
628
+					} else {
620 629
 						$planespotter_url_array = explode("_", $spotter_item['image']);
621 630
 						$planespotter_id = str_replace(".jpg", "", $planespotter_url_array[1]);
622 631
 						$image_src = 'https://www.planespotters.net/Aviation_Photos/photo.show?id='.$planespotter_id;
@@ -629,7 +638,9 @@  discard block
 block discarded – undo
629 638
 				} else {
630 639
 					if ($spotter_item['image_source'] == 'wikimedia' || $spotter_item['image_source'] == 'devianart' || $spotter_item['image_source'] == 'flickr') {
631 640
 						$image_thumbnail = preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']);
632
-					} else 	$image_thumbnail = $spotter_item['image_thumbnail'];
641
+					} else {
642
+						$image_thumbnail = $spotter_item['image_thumbnail'];
643
+					}
633 644
 					if (isset($spotter_item['airline_name'])) {
634 645
 						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>';
635 646
 					} else {
@@ -655,7 +666,9 @@  discard block
 block discarded – undo
655 666
 				print '<td class="aircraft_thumbnail">'."\n";
656 667
 				if ($spotter_item['image_source'] == 'wikimedia' || $spotter_item['image_source'] == 'devianart' || $spotter_item['image_source'] == 'flickr') {
657 668
 					$image_thumbnail = preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']);
658
-				} else 	$image_thumbnail = $spotter_item['image_thumbnail'];
669
+				} else {
670
+					$image_thumbnail = $spotter_item['image_thumbnail'];
671
+				}
659 672
 				if (isset($spotter_item['mmsi']) && $spotter_item['mmsi'] != '') {
660 673
 					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>';
661 674
 				} else {
@@ -677,7 +690,9 @@  discard block
 block discarded – undo
677 690
 				print '<td class="aircraft_thumbnail">'."\n";
678 691
 				if ($spotter_item['image_source'] == 'wikimedia' || $spotter_item['image_source'] == 'devianart' || $spotter_item['image_source'] == 'flickr') {
679 692
 					$image_thumbnail = preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']);
680
-				} else 	$image_thumbnail = $spotter_item['image_thumbnail'];
693
+				} else {
694
+					$image_thumbnail = $spotter_item['image_thumbnail'];
695
+				}
681 696
 				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>';
682 697
 				print '</td>'."\n";
683 698
 			} else {
@@ -730,8 +745,9 @@  discard block
 block discarded – undo
730 745
 				print '<td class="aircraft_thumbnail">'."\n";
731 746
 				//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>';
732 747
 				if ($spotter_item['image_source'] == 'planespotters') {
733
-					if ($spotter_item['image_source_website'] != '') $image_src = $spotter_item['image_source_website'];
734
-					else {
748
+					if ($spotter_item['image_source_website'] != '') {
749
+						$image_src = $spotter_item['image_source_website'];
750
+					} else {
735 751
 						$planespotter_url_array = explode("_", $spotter_array[0]['image']);
736 752
 						$planespotter_id = str_replace(".jpg", "", $planespotter_url_array[1]);
737 753
 						$image_src = 'https://www.planespotters.net/Aviation_Photos/photo.show?id='.$planespotter_id;
@@ -748,7 +764,9 @@  discard block
 block discarded – undo
748 764
 				} else {
749 765
 					if ($spotter_item['image_source'] == 'wikimedia' || $spotter_item['image_source'] == 'devianart' || $spotter_item['image_source'] == 'flickr') {
750 766
 						$image_thumbnail = preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']);
751
-					} else 	$image_thumbnail = $spotter_item['image_thumbnail'];
767
+					} else {
768
+						$image_thumbnail = $spotter_item['image_thumbnail'];
769
+					}
752 770
 					if (!isset($spotter_item['airline_name']) && isset($spotter_item['aircraft_name'])) {
753 771
 						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>';
754 772
 					} elseif (!isset($spotter_item['aircraft_name']) && isset($spotter_item['airline_name'])) {
@@ -788,13 +806,19 @@  discard block
 block discarded – undo
788 806
 				print '<td class="aircraft_thumbnail">'."\n";
789 807
 				if ($spotter_item['image_source'] == 'wikimedia' || $spotter_item['image_source'] == 'devianart' || $spotter_item['image_source'] == 'flickr') {
790 808
 					$image_thumbnail = preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']);
791
-				} else 	$image_thumbnail = $spotter_item['image_thumbnail'];
809
+				} else {
810
+					$image_thumbnail = $spotter_item['image_thumbnail'];
811
+				}
792 812
 				if (isset($spotter_item['mmsi']) && $spotter_item['mmsi'] != '') {
793 813
 					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";
794
-					if ($spotter_item['image_copyright'] != '') print '<div class="thumbnail-copyright">&copy; '.$spotter_item['image_copyright'].'</div>';
814
+					if ($spotter_item['image_copyright'] != '') {
815
+						print '<div class="thumbnail-copyright">&copy; '.$spotter_item['image_copyright'].'</div>';
816
+					}
795 817
 				} else {
796 818
 					print '<img src="'.$image_thumbnail.'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['ident'].'" alt="'.$spotter_item['ident'].'" data-content="'._("Ident:").' '.$spotter_item['ident'].'" data-html="true" width="100px" />'."\n";
797
-					if ($spotter_item['image_copyright'] != '') print '<div class="thumbnail-copyright">&copy; '.$spotter_item['image_copyright'].'</div>';
819
+					if ($spotter_item['image_copyright'] != '') {
820
+						print '<div class="thumbnail-copyright">&copy; '.$spotter_item['image_copyright'].'</div>';
821
+					}
798 822
 				}
799 823
 				print '</td>'."\n";
800 824
 			} else {
@@ -812,7 +836,9 @@  discard block
 block discarded – undo
812 836
 				print '<td class="aircraft_thumbnail">'."\n";
813 837
 				if ($spotter_item['image_source'] == 'wikimedia' || $spotter_item['image_source'] == 'devianart' || $spotter_item['image_source'] == 'flickr') {
814 838
 					$image_thumbnail = preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']);
815
-				} else 	$image_thumbnail = $spotter_item['image_thumbnail'];
839
+				} else {
840
+					$image_thumbnail = $spotter_item['image_thumbnail'];
841
+				}
816 842
 				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>';
817 843
 				print '</td>'."\n";
818 844
 			} else {
@@ -930,8 +956,11 @@  discard block
 block discarded – undo
930 956
 				print '<span class="nomobile"><a href="'.$globalURL.'/aircraft/'.$spotter_item['aircraft_type'].'">'.$spotter_item['aircraft_type'].'</a></span>'."\n";
931 957
 			} else {
932 958
 				$aircraft_names = explode('/',$spotter_item['aircraft_name']);
933
-				if (count($aircraft_names) == 1) print '<span class="nomobile"><a href="'.$globalURL.'/aircraft/'.$spotter_item['aircraft_type'].'">'.$spotter_item['aircraft_manufacturer'].' '.$spotter_item['aircraft_name'].'</a></span>'."\n";
934
-				else print '<span class="nomobile"><a href="'.$globalURL.'/aircraft/'.$spotter_item['aircraft_type'].'" title="'.$spotter_item['aircraft_name'].'">'.$spotter_item['aircraft_manufacturer'].' '.$aircraft_names[0].'</a></span>'."\n";
959
+				if (count($aircraft_names) == 1) {
960
+					print '<span class="nomobile"><a href="'.$globalURL.'/aircraft/'.$spotter_item['aircraft_type'].'">'.$spotter_item['aircraft_manufacturer'].' '.$spotter_item['aircraft_name'].'</a></span>'."\n";
961
+				} else {
962
+					print '<span class="nomobile"><a href="'.$globalURL.'/aircraft/'.$spotter_item['aircraft_type'].'" title="'.$spotter_item['aircraft_name'].'">'.$spotter_item['aircraft_manufacturer'].' '.$aircraft_names[0].'</a></span>'."\n";
963
+				}
935 964
 			}
936 965
 			print '<span class="mobile"><a href="'.$globalURL.'/aircraft/'.$spotter_item['aircraft_type'].'">'.$spotter_item['aircraft_type'].'</a></span>'."\n";
937 966
 		} elseif ($type == 'marine') {
@@ -974,15 +1003,21 @@  discard block
 block discarded – undo
974 1003
 			if (isset($spotter_item['departure_airport_time']) && isset($spotter_item['real_departure_airport_time'])) {
975 1004
 				if ($spotter_item['departure_airport_time'] > 2460) {
976 1005
 					$departure_airport_time = date('H:m',$spotter_item['departure_airport_time']);
977
-				} else $departure_airport_time = substr($spotter_item['departure_airport_time'],0,-2).':'.substr($spotter_item['departure_airport_time'],-2);
1006
+				} else {
1007
+					$departure_airport_time = substr($spotter_item['departure_airport_time'],0,-2).':'.substr($spotter_item['departure_airport_time'],-2);
1008
+				}
978 1009
 				if ($spotter_item['real_departure_airport_time'] > 2460) {
979 1010
 					$real_departure_airport_time = date('H:m',$spotter_item['real_departure_airport_time']);
980
-				} else $real_departure_airport_time = $spotter_item['real_departure_airport_time'];
1011
+				} else {
1012
+					$real_departure_airport_time = $spotter_item['real_departure_airport_time'];
1013
+				}
981 1014
 				print '<br /><span class="airport_time">'.$departure_airport_time.' ('.$real_departure_airport_time.')</span>'."\n";
982 1015
 			} elseif (isset($spotter_item['real_departure_airport_time']) && $spotter_item['real_departure_airport_time'] != 'NULL') {
983 1016
 				if ($spotter_item['real_departure_airport_time'] > 2460) {
984 1017
 					$real_departure_airport_time = date('H:m',$spotter_item['real_departure_airport_time']);
985
-				} else $real_departure_airport_time = $spotter_item['real_departure_airport_time'];
1018
+				} else {
1019
+					$real_departure_airport_time = $spotter_item['real_departure_airport_time'];
1020
+				}
986 1021
 				print '<br /><span class="airport_time">'.$real_departure_airport_time.'</span>'."\n";
987 1022
 			} elseif (isset($spotter_item['departure_airport_time']) && $spotter_item['departure_airport_time'] != 'NULL') {
988 1023
 				if ($spotter_item['departure_airport_time'] > 2460) {
@@ -1004,7 +1039,9 @@  discard block
 block discarded – undo
1004 1039
 						$longitude = $spotter_item['longitude'];
1005 1040
 					}
1006 1041
 					$distance = $Spotter->getAirportDistance($spotter_item['departure_airport'],$latitude,$longitude);
1007
-				} else $distance = '';
1042
+				} else {
1043
+					$distance = '';
1044
+				}
1008 1045
 				if ($distance != '') {
1009 1046
 					if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'nm') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'nm')) {
1010 1047
 						echo '<br/><i>'.round($distance*0.539957).' nm</i>';
@@ -1031,7 +1068,9 @@  discard block
 block discarded – undo
1031 1068
 			} else {
1032 1069
 				if (isset($spotter_item['real_arrival_airport']) && $spotter_item['real_arrival_airport'] != $spotter_item['arrival_airport']) {
1033 1070
 					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";
1034
-					if (!isset($Spotter)) $Spotter = new Spotter();
1071
+					if (!isset($Spotter)) {
1072
+						$Spotter = new Spotter();
1073
+					}
1035 1074
 					$arrival_airport_info = $Spotter->getAllAirportInfo($spotter_item['real_arrival_airport']);
1036 1075
 					if (isset($arrival_airport_info[0])) {
1037 1076
                         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";
@@ -1051,20 +1090,28 @@  discard block
 block discarded – undo
1051 1090
 			if (isset($spotter_item['arrival_airport_time']) && isset($spotter_item['real_arrival_airport_time'])) {
1052 1091
 				if ($spotter_item['arrival_airport_time'] > 2460) {
1053 1092
 					$arrival_airport_time = date('H:m',$spotter_item['arrival_airport_time']);
1054
-				} else $arrival_airport_time = $spotter_item['arrival_airport_time'];
1093
+				} else {
1094
+					$arrival_airport_time = $spotter_item['arrival_airport_time'];
1095
+				}
1055 1096
 				if ($spotter_item['real_arrival_airport_time'] > 2460) {
1056 1097
 					$real_arrival_airport_time = date('H:m',$spotter_item['real_arrival_airport_time']);
1057
-				} else $real_arrival_airport_time = $spotter_item['real_arrival_airport_time'];
1098
+				} else {
1099
+					$real_arrival_airport_time = $spotter_item['real_arrival_airport_time'];
1100
+				}
1058 1101
 				print '<br /><span class="airport_time">'.$spotter_item['arrival_airport_time'].' ('.$spotter_item['real_arrival_airport_time'].')</span>'."\n";
1059 1102
 			} elseif (isset($spotter_item['real_arrival_airport_time'])) {
1060 1103
 				if ($spotter_item['real_arrival_airport_time'] > 2460) {
1061 1104
 					$real_arrival_airport_time = date('H:m',$spotter_item['real_arrival_airport_time']);
1062
-				} else $real_arrival_airport_time = $spotter_item['real_arrival_airport_time'];
1105
+				} else {
1106
+					$real_arrival_airport_time = $spotter_item['real_arrival_airport_time'];
1107
+				}
1063 1108
 				print '<br /><span class="airport_time">'.$real_arrival_airport_time.'</span>'."\n";
1064 1109
 			} elseif (isset($spotter_item['arrival_airport_time']) && $spotter_item['arrival_airport_time'] != 'NULL') {
1065 1110
 				if ($spotter_item['arrival_airport_time'] > 2460) {
1066 1111
 					$arrival_airport_time = date('H:m',$spotter_item['arrival_airport_time']);
1067
-				} else $arrival_airport_time = $spotter_item['arrival_airport_time'];
1112
+				} else {
1113
+					$arrival_airport_time = $spotter_item['arrival_airport_time'];
1114
+				}
1068 1115
 				print '<br /><span class="airport_time">'.$arrival_airport_time.'</span>'."\n";
1069 1116
 			}
1070 1117
 			if (!isset($spotter_item['real_arrival_airport']) && $spotter_item['arrival_airport'] != 'NA') {
@@ -1077,7 +1124,9 @@  discard block
 block discarded – undo
1077 1124
 						$longitude = $spotter_item['longitude'];
1078 1125
 					}
1079 1126
 					$distance = $Spotter->getAirportDistance($spotter_item['arrival_airport'],$latitude,$longitude);
1080
-				} else $distance = '';
1127
+				} else {
1128
+					$distance = '';
1129
+				}
1081 1130
 				if ($distance != '') {
1082 1131
 					if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'nm') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'nm')) {
1083 1132
 						echo '<br/><i>'.round($distance*0.539957).' nm</i>';
Please login to merge, or discard this patch.
require/class.MarineLive.php 1 patch
Braces   +164 added lines, -55 removed lines patch added patch discarded remove patch
@@ -16,7 +16,9 @@  discard block
 block discarded – undo
16 16
 	public function __construct($dbc = null) {
17 17
 		$Connection = new Connection($dbc);
18 18
 		$this->db = $Connection->db();
19
-		if ($this->db === null) die('Error: No DB connection. (MarineLive)');
19
+		if ($this->db === null) {
20
+			die('Error: No DB connection. (MarineLive)');
21
+		}
20 22
 	}
21 23
 
22 24
 
@@ -40,7 +42,9 @@  discard block
 block discarded – undo
40 42
 		if (isset($filter[0]['source'])) {
41 43
 			$filters = array_merge($filters,$filter);
42 44
 		}
43
-		if (is_array($globalFilter)) $filter = array_merge($filter,$globalFilter);
45
+		if (is_array($globalFilter)) {
46
+			$filter = array_merge($filter,$globalFilter);
47
+		}
44 48
 		$filter_query_join = '';
45 49
 		$filter_query_where = '';
46 50
 		foreach($filters as $flt) {
@@ -96,8 +100,11 @@  discard block
 block discarded – undo
96 100
 		if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) {
97 101
 			$filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')";
98 102
 		}
99
-		if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE';
100
-		elseif ($filter_query_where != '' && $and) $filter_query_where .= ' AND';
103
+		if ($filter_query_where == '' && $where) {
104
+			$filter_query_where = ' WHERE';
105
+		} elseif ($filter_query_where != '' && $and) {
106
+			$filter_query_where .= ' AND';
107
+		}
101 108
 		if ($filter_query_where != '') {
102 109
 			$filter_query_where = preg_replace('/^ AND/',' WHERE',$filter_query_where);
103 110
 		}
@@ -140,9 +147,13 @@  discard block
 block discarded – undo
140 147
 				$orderby_query = ' '.$search_orderby_array[$sort]['sql'];
141 148
 			}
142 149
 		}
143
-		if ($orderby_query == '') $orderby_query= ' ORDER BY date DESC';
150
+		if ($orderby_query == '') {
151
+			$orderby_query= ' ORDER BY date DESC';
152
+		}
144 153
 
145
-		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
154
+		if (!isset($globalLiveInterval)) {
155
+			$globalLiveInterval = '200';
156
+		}
146 157
 		if ($globalDBdriver == 'mysql') {
147 158
 			//$query  = "SELECT marine_live.* FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL 30 SECOND) <= l.date GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate";
148 159
 			$query  = 'SELECT marine_live.* FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate'.$filter_query.$orderby_query;
@@ -167,7 +178,9 @@  discard block
 block discarded – undo
167 178
 
168 179
 		$filter_query = $this->getFilter($filter,true,true);
169 180
 
170
-		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
181
+		if (!isset($globalLiveInterval)) {
182
+			$globalLiveInterval = '200';
183
+		}
171 184
 		if ($globalDBdriver == 'mysql') {
172 185
 			$query  = 'SELECT marine_live.mmsi, marine_live.ident, marine_live.type,marine_live.fammarine_id, marine_live.latitude, marine_live.longitude, marine_live.heading, marine_live.ground_speed, marine_live.date, marine_live.format_source, marine_live.captain_name, marine_live.race_id, marine_live.race_rank, marine_live.race_name 
173 186
 			FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate'.$filter_query." marine_live.latitude <> 0 AND marine_live.longitude <> 0 ORDER BY marine_live.race_rank";
@@ -212,58 +225,96 @@  discard block
 block discarded – undo
212 225
 		$id = filter_var($id,FILTER_SANITIZE_STRING);
213 226
 		$filter_query = $this->getFilter($filter,true,true);
214 227
 
215
-		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
216
-		if (!isset($globalMap3DMarinesLimit) || $globalMap3DMarinesLimit == '') $globalMap3DMarinesLimit = '300';
228
+		if (!isset($globalLiveInterval)) {
229
+			$globalLiveInterval = '200';
230
+		}
231
+		if (!isset($globalMap3DMarinesLimit) || $globalMap3DMarinesLimit == '') {
232
+			$globalMap3DMarinesLimit = '300';
233
+		}
217 234
 		if ($globalDBdriver == 'mysql') {
218 235
 			if (isset($globalArchive) && $globalArchive === TRUE) {
219 236
 				$query  = 'SELECT * FROM (SELECT marine_archive.ident, marine_archive.fammarine_id,marine_archive.type_id,marine_archive.type, marine_archive.latitude, marine_archive.longitude, marine_archive.heading, marine_archive.ground_speed, marine_archive.date, marine_archive.format_source, marine_archive.captain_name, marine_archive.race_id, marine_archive.race_rank, marine_archive.race_name 
220 237
 				    FROM marine_archive INNER JOIN (SELECT fammarine_id FROM marine_live'.$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval." SECOND) <= marine_live.date) l ON l.fammarine_id = marine_archive.fammarine_id ";
221
-				if ($usecoord) $query .= "AND marine_archive.latitude BETWEEN ".$minlat." AND ".$maxlat." AND marine_archive.longitude BETWEEN ".$minlong." AND ".$maxlong." ";
222
-				if ($id != '') $query .= "OR marine_archive.fammarine_id = :id ";
238
+				if ($usecoord) {
239
+					$query .= "AND marine_archive.latitude BETWEEN ".$minlat." AND ".$maxlat." AND marine_archive.longitude BETWEEN ".$minlong." AND ".$maxlong." ";
240
+				}
241
+				if ($id != '') {
242
+					$query .= "OR marine_archive.fammarine_id = :id ";
243
+				}
223 244
 				$query .= "UNION
224 245
 				    SELECT marine_live.ident, marine_live.fammarine_id,marine_live.type_id,marine_live.type, marine_live.latitude, marine_live.longitude, marine_live.heading, marine_live.ground_speed, marine_live.date, marine_live.format_source, marine_live.captain_name, marine_live.race_id, marine_live.race_rank, marine_live.race_name 
225 246
 				    FROM marine_live".$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval." SECOND) <= marine_live.date";
226
-				if ($usecoord) $query .= " AND marine_live.latitude BETWEEN ".$minlat." AND ".$maxlat." AND marine_live.longitude BETWEEN ".$minlong." AND ".$maxlong;
227
-				if ($id != '') $query .= "OR marine_live.fammarine_id = :id ";
247
+				if ($usecoord) {
248
+					$query .= " AND marine_live.latitude BETWEEN ".$minlat." AND ".$maxlat." AND marine_live.longitude BETWEEN ".$minlong." AND ".$maxlong;
249
+				}
250
+				if ($id != '') {
251
+					$query .= "OR marine_live.fammarine_id = :id ";
252
+				}
228 253
 				$query .= ") AS marine 
229 254
 				    WHERE latitude <> '0' AND longitude <> '0' 
230 255
 				    ORDER BY fammarine_id, date";
231
-				if ($limit) $query .= " LIMIT ".$globalMap3DMarinesLimit;
256
+				if ($limit) {
257
+					$query .= " LIMIT ".$globalMap3DMarinesLimit;
258
+				}
232 259
 			} else {
233 260
 				$query  = 'SELECT marine_live.ident, marine_live.fammarine_id,marine_live.type_id,marine_live.type, marine_live.latitude, marine_live.longitude, marine_live.heading, marine_live.ground_speed, marine_live.date, marine_live.format_source, marine_live.captain_name, marine_live.race_id, marine_live.race_rank, marine_live.race_name 
234 261
 				    FROM marine_live'.$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval." SECOND) <= marine_live.date ";
235
-				if ($usecoord) $query .= "AND marine_live.latitude BETWEEN ".$minlat." AND ".$maxlat." AND marine_live.longitude BETWEEN ".$minlong." AND ".$maxlong." ";
236
-				if ($id != '') $query .= "OR marine_live.fammarine_id = :id ";
262
+				if ($usecoord) {
263
+					$query .= "AND marine_live.latitude BETWEEN ".$minlat." AND ".$maxlat." AND marine_live.longitude BETWEEN ".$minlong." AND ".$maxlong." ";
264
+				}
265
+				if ($id != '') {
266
+					$query .= "OR marine_live.fammarine_id = :id ";
267
+				}
237 268
 				$query .= "AND marine_live.latitude <> '0' AND marine_live.longitude <> '0' 
238 269
 				ORDER BY marine_live.fammarine_id, marine_live.date";
239
-				if ($limit) $query .= " LIMIT ".$globalMap3DMarinesLimit;
270
+				if ($limit) {
271
+					$query .= " LIMIT ".$globalMap3DMarinesLimit;
272
+				}
240 273
 			}
241 274
 		} else {
242 275
 			if (isset($globalArchive) && $globalArchive === TRUE) {
243 276
 				$query  = "SELECT * FROM (SELECT marine_archive.ident, marine_archive.fammarine_id, marine_archive.type_id, marine_archive.type,marine_archive.latitude, marine_archive.longitude, marine_archive.heading, marine_archive.ground_speed, marine_archive.date, marine_archive.format_source, marine_archive.captain_name, marine_archive.race_id, marine_archive.race_rank, marine_archive.race_name 
244 277
 				    FROM marine_archive INNER JOIN (SELECT fammarine_id FROM marine_live".$filter_query." CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= marine_live.date) l ON l.fammarine_id = marine_archive.fammarine_id ";
245
-				if ($usecoord) $query .= "AND (marine_archive.latitude BETWEEN ".$minlat." AND ".$maxlat." AND marine_archive.longitude BETWEEN ".$minlong." AND ".$maxlong.") ";
246
-				if ($id != '') $query .= "OR marine_archive.fammarine_id = :id ";
278
+				if ($usecoord) {
279
+					$query .= "AND (marine_archive.latitude BETWEEN ".$minlat." AND ".$maxlat." AND marine_archive.longitude BETWEEN ".$minlong." AND ".$maxlong.") ";
280
+				}
281
+				if ($id != '') {
282
+					$query .= "OR marine_archive.fammarine_id = :id ";
283
+				}
247 284
 				$query .= "UNION
248 285
 				    SELECT marine_live.ident, marine_live.fammarine_id, marine_live.type_id, marine_live.type,marine_live.latitude, marine_live.longitude, marine_live.heading, marine_live.ground_speed, marine_live.date, marine_live.format_source, marine_live.captain_name, marine_live.race_id, marine_live.race_rank, marine_live.race_name 
249 286
 				    FROM marine_live".$filter_query." CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= marine_live.date";
250
-				if ($usecoord) $query .= " AND (marine_live.latitude BETWEEN ".$minlat." AND ".$maxlat." AND marine_live.longitude BETWEEN ".$minlong." AND ".$maxlong.")";
251
-				if ($id != '') $query .= " OR marine_live.fammarine_id = :id";
287
+				if ($usecoord) {
288
+					$query .= " AND (marine_live.latitude BETWEEN ".$minlat." AND ".$maxlat." AND marine_live.longitude BETWEEN ".$minlong." AND ".$maxlong.")";
289
+				}
290
+				if ($id != '') {
291
+					$query .= " OR marine_live.fammarine_id = :id";
292
+				}
252 293
 				$query .= ") AS marine WHERE latitude <> '0' AND longitude <> '0' ";
253 294
 				$query .= "ORDER BY fammarine_id, date";
254
-				if ($limit) $query .= " LIMIT ".$globalMap3DMarinesLimit;
295
+				if ($limit) {
296
+					$query .= " LIMIT ".$globalMap3DMarinesLimit;
297
+				}
255 298
 			} else {
256 299
 				$query  = "SELECT marine_live.ident, marine_live.fammarine_id, marine_live.type_id, marine_live.type,marine_live.latitude, marine_live.longitude, marine_live.heading, marine_live.ground_speed, marine_live.date, marine_live.format_source, marine_live.captain_name, marine_live.race_id, marine_live.race_rank, marine_live.race_name 
257 300
 				    FROM marine_live".$filter_query." CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= marine_live.date ";
258
-				if ($usecoord) $query .= "AND (marine_live.latitude BETWEEN ".$minlat." AND ".$maxlat." AND marine_live.longitude BETWEEN ".$minlong." AND ".$maxlong.") ";
259
-				if ($id != '') $query .= "OR marine_live.fammarine_id = :id ";
301
+				if ($usecoord) {
302
+					$query .= "AND (marine_live.latitude BETWEEN ".$minlat." AND ".$maxlat." AND marine_live.longitude BETWEEN ".$minlong." AND ".$maxlong.") ";
303
+				}
304
+				if ($id != '') {
305
+					$query .= "OR marine_live.fammarine_id = :id ";
306
+				}
260 307
 				$query .= "AND marine_live.latitude <> '0' AND marine_live.longitude <> '0' 
261 308
 				ORDER BY marine_live.fammarine_id, marine_live.date";
262
-				if ($limit) $query .= " LIMIT ".$globalMap3DMarinesLimit;
309
+				if ($limit) {
310
+					$query .= " LIMIT ".$globalMap3DMarinesLimit;
311
+				}
263 312
 			}
264 313
 		}
265 314
 		$query_values = array();
266
-		if ($id != '') $query_values = array(':id' => $id);
315
+		if ($id != '') {
316
+			$query_values = array(':id' => $id);
317
+		}
267 318
 		try {
268 319
 			$sth = $this->db->prepare($query);
269 320
 			$sth->execute($query_values);
@@ -290,8 +341,12 @@  discard block
 block discarded – undo
290 341
 		$id = filter_var($id,FILTER_SANITIZE_STRING);
291 342
 		$filter_query = $this->getFilter($filter,true,true);
292 343
 
293
-		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
294
-		if (!isset($globalMap3DMarinesLimit) || $globalMap3DMarinesLimit == '') $globalMap3DMarinesLimit = '300';
344
+		if (!isset($globalLiveInterval)) {
345
+			$globalLiveInterval = '200';
346
+		}
347
+		if (!isset($globalMap3DMarinesLimit) || $globalMap3DMarinesLimit == '') {
348
+			$globalMap3DMarinesLimit = '300';
349
+		}
295 350
 		if ($globalDBdriver == 'mysql') {
296 351
 			if (isset($globalArchive) && $globalArchive === TRUE) {
297 352
 				$query  = 'SELECT * FROM (SELECT marine_archive.ident, marine_archive.fammarine_id,marine_archive.type_id,marine_archive.type, marine_archive.latitude, marine_archive.longitude, marine_archive.heading, marine_archive.ground_speed, marine_archive.date, marine_archive.format_source, marine_archive.captain_name, marine_archive.race_id, marine_archive.race_rank, marine_archive.race_name 
@@ -302,13 +357,17 @@  discard block
 block discarded – undo
302 357
 				$query .= ") AS marine 
303 358
 				    WHERE latitude <> '0' AND longitude <> '0' 
304 359
 				    ORDER BY fammarine_id, date";
305
-				if ($limit) $query .= " LIMIT ".$globalMap3DMarinesLimit;
360
+				if ($limit) {
361
+					$query .= " LIMIT ".$globalMap3DMarinesLimit;
362
+				}
306 363
 			} else {
307 364
 				$query  = 'SELECT marine_live.ident, marine_live.fammarine_id,marine_live.type_id,marine_live.type, marine_live.latitude, marine_live.longitude, marine_live.heading, marine_live.ground_speed, marine_live.date, marine_live.format_source, marine_live.captain_name, marine_live.race_id, marine_live.race_rank, marine_live.race_name 
308 365
 				    FROM marine_live'.$filter_query.' marine_live.fammarine_id = :id ';
309 366
 				$query .= "AND marine_live.latitude <> '0' AND marine_live.longitude <> '0' 
310 367
 				ORDER BY marine_live.fammarine_id, marine_live.date";
311
-				if ($limit) $query .= " LIMIT ".$globalMap3DMarinesLimit;
368
+				if ($limit) {
369
+					$query .= " LIMIT ".$globalMap3DMarinesLimit;
370
+				}
312 371
 			}
313 372
 		} else {
314 373
 			if (isset($globalArchive) && $globalArchive === TRUE) {
@@ -320,13 +379,17 @@  discard block
 block discarded – undo
320 379
 				$query .= ") AS marine 
321 380
 				    WHERE latitude <> '0' AND longitude <> '0' 
322 381
 				    ORDER BY fammarine_id, date";
323
-				if ($limit) $query .= " LIMIT ".$globalMap3DMarinesLimit;
382
+				if ($limit) {
383
+					$query .= " LIMIT ".$globalMap3DMarinesLimit;
384
+				}
324 385
 			} else {
325 386
 				$query  = "SELECT marine_live.ident, marine_live.fammarine_id, marine_live.type_id, marine_live.type,marine_live.latitude, marine_live.longitude, marine_live.heading, marine_live.ground_speed, marine_live.date, marine_live.format_source, marine_live.captain_name, marine_live.race_id, marine_live.race_rank, marine_live.race_name 
326 387
 				    FROM marine_live".$filter_query." marine_live.fammarine_id = :id ";
327 388
 				$query .= "AND marine_live.latitude <> '0' AND marine_live.longitude <> '0' 
328 389
 				ORDER BY marine_live.fammarine_id, marine_live.date";
329
-				if ($limit) $query .= " LIMIT ".$globalMap3DMarinesLimit;
390
+				if ($limit) {
391
+					$query .= " LIMIT ".$globalMap3DMarinesLimit;
392
+				}
330 393
 			}
331 394
 		}
332 395
 		$query_values = array(':id' => $id);
@@ -352,7 +415,9 @@  discard block
 block discarded – undo
352 415
 		global $globalDBdriver, $globalLiveInterval;
353 416
 		$filter_query = $this->getFilter($filter,true,true);
354 417
 
355
-		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
418
+		if (!isset($globalLiveInterval)) {
419
+			$globalLiveInterval = '200';
420
+		}
356 421
 		if ($globalDBdriver == 'mysql') {
357 422
 			$query = 'SELECT COUNT(DISTINCT marine_live.fammarine_id) as nb FROM marine_live'.$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= date';
358 423
 		} else {
@@ -381,7 +446,9 @@  discard block
 block discarded – undo
381 446
 	{
382 447
 		global $globalDBdriver, $globalLiveInterval;
383 448
 		$Marine = new Marine($this->db);
384
-		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
449
+		if (!isset($globalLiveInterval)) {
450
+			$globalLiveInterval = '200';
451
+		}
385 452
 		$filter_query = $this->getFilter($filter);
386 453
 
387 454
 		if (is_array($coord)) {
@@ -389,7 +456,9 @@  discard block
 block discarded – undo
389 456
 			$minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
390 457
 			$maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
391 458
 			$maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
392
-		} else return array();
459
+		} else {
460
+			return array();
461
+		}
393 462
 		if ($globalDBdriver == 'mysql') {
394 463
 			$query  = 'SELECT marine_live.* FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate AND marine_live.latitude BETWEEN '.$minlat.' AND '.$maxlat.' AND marine_live.longitude BETWEEN '.$minlong.' AND '.$maxlong.' GROUP BY marine_live.fammarine_id ORDER BY date DESC'.$filter_query;
395 464
 		} else {
@@ -410,7 +479,9 @@  discard block
 block discarded – undo
410 479
 	{
411 480
 		global $globalDBdriver, $globalLiveInterval, $globalArchive;
412 481
 		$Marine = new Marine($this->db);
413
-		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
482
+		if (!isset($globalLiveInterval)) {
483
+			$globalLiveInterval = '200';
484
+		}
414 485
 		$filter_query = $this->getFilter($filter,true,true);
415 486
 
416 487
 		if (is_array($coord)) {
@@ -418,7 +489,9 @@  discard block
 block discarded – undo
418 489
 			$minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
419 490
 			$maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
420 491
 			$maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
421
-		} else return array();
492
+		} else {
493
+			return array();
494
+		}
422 495
 		/*
423 496
 		if ($globalDBdriver == 'mysql') {
424 497
 			$query  = 'SELECT marine_live.ident, marine_live.fammarine_id,marine_live.type, marine_live.latitude, marine_live.longitude, marine_live.heading, marine_live.ground_speed, marine_live.date, marine_live.format_source 
@@ -648,11 +721,15 @@  discard block
 block discarded – undo
648 721
 		//$query  = self::$global_query.' WHERE marine_live.fammarine_id = :id ORDER BY date';
649 722
 		if ($globalDBdriver == 'mysql') {
650 723
 			$query = 'SELECT marine_live.* FROM marine_live WHERE marine_live.fammarine_id = :id';
651
-			if ($liveinterval) $query .= ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= date';
724
+			if ($liveinterval) {
725
+				$query .= ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= date';
726
+			}
652 727
 			$query .= ' ORDER BY date';
653 728
 		} else {
654 729
 			$query = 'SELECT marine_live.* FROM marine_live WHERE marine_live.fammarine_id = :id';
655
-			if ($liveinterval) $query .= " AND CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= date";
730
+			if ($liveinterval) {
731
+				$query .= " AND CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= date";
732
+			}
656 733
 			$query .= ' ORDER BY date';
657 734
 		}
658 735
 
@@ -747,7 +824,9 @@  discard block
 block discarded – undo
747 824
 				$i++;
748 825
 				$j++;
749 826
 				if ($j == 30) {
750
-					if ($globalDebug) echo ".";
827
+					if ($globalDebug) {
828
+						echo ".";
829
+					}
751 830
 				    	try {
752 831
 						
753 832
 						$sth = $this->db->prepare(substr($query_delete,0,-1).")");
@@ -1064,7 +1143,9 @@  discard block
 block discarded – undo
1064 1143
 			{
1065 1144
 				return false;
1066 1145
 			}
1067
-		} else return '';
1146
+		} else {
1147
+			return '';
1148
+		}
1068 1149
 
1069 1150
 		if ($longitude != '')
1070 1151
 		{
@@ -1072,7 +1153,9 @@  discard block
 block discarded – undo
1072 1153
 			{
1073 1154
 				return false;
1074 1155
 			}
1075
-		} else return '';
1156
+		} else {
1157
+			return '';
1158
+		}
1076 1159
 
1077 1160
 
1078 1161
 		if ($heading != '')
@@ -1081,7 +1164,9 @@  discard block
 block discarded – undo
1081 1164
 			{
1082 1165
 				return false;
1083 1166
 			}
1084
-		} else $heading = 0;
1167
+		} else {
1168
+			$heading = 0;
1169
+		}
1085 1170
 
1086 1171
 		if ($groundspeed != '')
1087 1172
 		{
@@ -1089,9 +1174,13 @@  discard block
 block discarded – undo
1089 1174
 			{
1090 1175
 				return false;
1091 1176
 			}
1092
-		} else $groundspeed = 0;
1177
+		} else {
1178
+			$groundspeed = 0;
1179
+		}
1093 1180
 		date_default_timezone_set('UTC');
1094
-		if ($date == '') $date = date("Y-m-d H:i:s", time());
1181
+		if ($date == '') {
1182
+			$date = date("Y-m-d H:i:s", time());
1183
+		}
1095 1184
 
1096 1185
         
1097 1186
 		$fammarine_id = filter_var($fammarine_id,FILTER_SANITIZE_STRING);
@@ -1118,19 +1207,35 @@  discard block
 block discarded – undo
1118 1207
 		$race_id = filter_var($race_id,FILTER_SANITIZE_STRING);
1119 1208
 		$race_name = filter_var($race_name,FILTER_SANITIZE_STRING);
1120 1209
 		$race_rank = filter_var($race_rank,FILTER_SANITIZE_NUMBER_INT);
1121
-		if ($race_rank == '') $race_rank = NULL;
1210
+		if ($race_rank == '') {
1211
+			$race_rank = NULL;
1212
+		}
1122 1213
 		$race_time = filter_var($race_time,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
1123
-		if ($race_time == '') $race_time = NULL;
1124
-		if ($typeid == '') $typeid = NULL;
1125
-		if ($statusid == '') $statusid = NULL;
1126
-		if ($distance == '') $distance = NULL;
1214
+		if ($race_time == '') {
1215
+			$race_time = NULL;
1216
+		}
1217
+		if ($typeid == '') {
1218
+			$typeid = NULL;
1219
+		}
1220
+		if ($statusid == '') {
1221
+			$statusid = NULL;
1222
+		}
1223
+		if ($distance == '') {
1224
+			$distance = NULL;
1225
+		}
1127 1226
 
1128 1227
             	//if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) $groundspeed = 0;
1129
-            	if ($heading == '' || $Common->isInteger($heading) === false ) $heading = 0;
1130
-            	if ($arrival_date == '') $arrival_date = NULL;
1228
+            	if ($heading == '' || $Common->isInteger($heading) === false ) {
1229
+            		$heading = 0;
1230
+            	}
1231
+            	if ($arrival_date == '') {
1232
+            		$arrival_date = NULL;
1233
+            	}
1131 1234
             	$query = '';
1132 1235
 		if ($globalArchive) {
1133
-			if ($globalDebug) echo '-- Delete previous data -- ';
1236
+			if ($globalDebug) {
1237
+				echo '-- Delete previous data -- ';
1238
+			}
1134 1239
 			$query .= 'DELETE FROM marine_live WHERE fammarine_id = :fammarine_id;';
1135 1240
 		}
1136 1241
 		$query .= 'INSERT INTO marine_live (fammarine_id, ident, latitude, longitude, heading, ground_speed, date, format_source, source_name, over_country, mmsi, type,type_id,status,status_id,imo,arrival_port_name,arrival_port_date,captain_id,captain_name,race_id,race_name,distance,race_rank,race_time) 
@@ -1145,10 +1250,14 @@  discard block
 block discarded – undo
1145 1250
 		}
1146 1251
 		
1147 1252
 		if (isset($globalArchive) && $globalArchive && $putinarchive && $noarchive !== true) {
1148
-			if ($globalDebug) echo '(Add to Marine archive : ';
1253
+			if ($globalDebug) {
1254
+				echo '(Add to Marine archive : ';
1255
+			}
1149 1256
 			$MarineArchive = new MarineArchive($this->db);
1150 1257
 			$result =  $MarineArchive->addMarineArchiveData($fammarine_id, $ident, $latitude, $longitude, $heading, $groundspeed, $date, $putinarchive, $mmsi,$type,$typeid,$imo, $callsign,$arrival_code,$arrival_date,$status,$statusid,$noarchive,$format_source, $source_name, $over_country,$captain_id,$captain_name,$race_id,$race_name,$distance,$race_rank,$race_time);
1151
-			if ($globalDebug) echo $result.')';
1258
+			if ($globalDebug) {
1259
+				echo $result.')';
1260
+			}
1152 1261
 		}
1153 1262
 		return "success";
1154 1263
 	}
Please login to merge, or discard this patch.
footer.php 1 patch
Braces   +8 added lines, -3 removed lines patch added patch discarded remove patch
@@ -1,8 +1,10 @@  discard block
 block discarded – undo
1 1
 </section>
2 2
 <div class="pub onmap">
3 3
 <?php
4
-	if (isset($globalPubFooter)) print $globalPubFooter;
5
-?>
4
+	if (isset($globalPubFooter)) {
5
+		print $globalPubFooter;
6
+	}
7
+	?>
6 8
 </div>
7 9
 <footer class="container">
8 10
 	<?php
@@ -13,7 +15,10 @@  discard block
 block discarded – undo
13 15
 	<?php
14 16
 	    }
15 17
 	?>
16
-	<span>Developed in Barrie by <a href="http://www.mariotrunz.me/" target="_blank">Mario Trunz</a> & at <a href="http://www.zugaina.com" target="_blank">Zugaina</a> by Ycarus</span> - <span><a href="<?php if (isset($globalURL)) print $globalURL; ?>/about#source">Source &amp; Credits</a></span> - <span><a href="https://www.flightairmap.com/" target="_blank">Get source code</a></span>
18
+	<span>Developed in Barrie by <a href="http://www.mariotrunz.me/" target="_blank">Mario Trunz</a> & at <a href="http://www.zugaina.com" target="_blank">Zugaina</a> by Ycarus</span> - <span><a href="<?php if (isset($globalURL)) {
19
+	print $globalURL;
20
+}
21
+?>/about#source">Source &amp; Credits</a></span> - <span><a href="https://www.flightairmap.com/" target="_blank">Get source code</a></span>
17 22
 </footer>
18 23
 
19 24
 <div class="notifications bottom-left"></div>
Please login to merge, or discard this patch.
require/class.MarineImport.php 1 patch
Braces   +225 added lines, -78 removed lines patch added patch discarded remove patch
@@ -61,7 +61,9 @@  discard block
 block discarded – undo
61 61
     public function checkAll() {
62 62
 	global $globalDebug, $globalNoDB, $globalVM;
63 63
 	if (!isset($globalNoDB) || $globalNoDB !== TRUE) {
64
-	    if ($globalDebug) echo "Update last seen tracked data...\n";
64
+	    if ($globalDebug) {
65
+	    	echo "Update last seen tracked data...\n";
66
+	    }
65 67
 	    foreach ($this->all_tracked as $key => $flight) {
66 68
 		if (isset($this->all_tracked[$key]['id'])) {
67 69
 		    //echo $this->all_tracked[$key]['id'].' - '.$this->all_tracked[$key]['latitude'].'  '.$this->all_tracked[$key]['longitude']."\n";
@@ -71,8 +73,11 @@  discard block
 block discarded – undo
71 73
     			    $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'],$this->all_tracked[$key]['distance'],$this->all_tracked[$key]['race_rank'],$this->all_tracked[$key]['race_time'],$this->all_tracked[$key]['status'],$this->all_tracked[$key]['race_begin']);
72 74
     			} else {
73 75
     			    $timerace = (strtotime($this->all_tracked[$key]['race_begin'])+$this->all_tracked[$key]['race_time']);
74
-    			    if ($timerace > time()) $finaldatetime = NULL;
75
-    			    else $finaldatetime = date('Y-m-d H:i:s',$timerace);
76
+    			    if ($timerace > time()) {
77
+    			    	$finaldatetime = NULL;
78
+    			    } else {
79
+    			    	$finaldatetime = date('Y-m-d H:i:s',$timerace);
80
+    			    }
76 81
     			    $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'],$finaldatetime,$this->all_tracked[$key]['distance'],$this->all_tracked[$key]['race_rank'],$this->all_tracked[$key]['race_time'],$this->all_tracked[$key]['status'],$this->all_tracked[$key]['race_begin']);
77 82
     			}
78 83
     		    } else {
@@ -86,13 +91,17 @@  discard block
 block discarded – undo
86 91
     public function del() {
87 92
 	global $globalDebug, $globalNoDB, $globalNoImport;
88 93
 	// Delete old infos
89
-	if ($globalDebug) echo 'Delete old values and update latest data...'."\n";
94
+	if ($globalDebug) {
95
+		echo 'Delete old values and update latest data...'."\n";
96
+	}
90 97
 	foreach ($this->all_tracked as $key => $flight) {
91 98
     	    if (isset($flight['lastupdate'])) {
92 99
         	if ($flight['lastupdate'] < (time()-3000)) {
93 100
             	    if ((!isset($globalNoImport) || $globalNoImport !== TRUE) && (!isset($globalNoDB) || $globalNoDB !== TRUE)) {
94 101
             		if (isset($this->all_tracked[$key]['id'])) {
95
-            		    if ($globalDebug) echo "--- Delete old values with id ".$this->all_tracked[$key]['id']."\n";
102
+            		    if ($globalDebug) {
103
+            		    	echo "--- Delete old values with id ".$this->all_tracked[$key]['id']."\n";
104
+            		    }
96 105
 			    /*
97 106
 			    $MarineLive = new MarineLive();
98 107
             		    $MarineLive->deleteLiveMarineDataById($this->all_tracked[$key]['id']);
@@ -106,14 +115,19 @@  discard block
 block discarded – undo
106 115
 					$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'],$this->all_tracked[$key]['distance'],$this->all_tracked[$key]['race_rank'],$this->all_tracked[$key]['race_time'],$this->all_tracked[$key]['status'],$this->all_tracked[$key]['race_begin']);
107 116
 				    } else {
108 117
 					$timerace = strtotime($this->all_tracked[$key]['race_begin'])+$this->all_tracked[$key]['race_time'];
109
-	        			if ($timerace > time()) $finaldatetime = NULL;
110
-					else $finaldatetime = date('Y-m-d H:i:s',$timerace);
118
+	        			if ($timerace > time()) {
119
+	        				$finaldatetime = NULL;
120
+	        			} else {
121
+						$finaldatetime = date('Y-m-d H:i:s',$timerace);
122
+					}
111 123
 					$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'],$finaldatetime,$this->all_tracked[$key]['distance'],$this->all_tracked[$key]['race_rank'],$this->all_tracked[$key]['race_time'],$this->all_tracked[$key]['status'],$this->all_tracked[$key]['race_begin']);
112 124
 				    }
113 125
 				} else {
114 126
 					$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'],$this->all_tracked[$key]['distance'],$this->all_tracked[$key]['race_rank'],$this->all_tracked[$key]['race_time'],$this->all_tracked[$key]['status'],$this->all_tracked[$key]['race_begin']);
115 127
 				}
116
-				if ($globalDebug && $result != 'success') echo '!!! ERROR : '.$result."\n";
128
+				if ($globalDebug && $result != 'success') {
129
+					echo '!!! ERROR : '.$result."\n";
130
+				}
117 131
 			    }
118 132
 			    // Put in archive
119 133
 //				$Marine->db = null;
@@ -127,7 +141,9 @@  discard block
 block discarded – undo
127 141
 
128 142
     public function add($line) {
129 143
 	global $globalFork, $globalDistanceIgnore, $globalDaemon, $globalDebug, $globalCoordMinChange, $globalDebugTimeElapsed, $globalCenterLatitude, $globalCenterLongitude, $globalBeta, $globalSourcesupdate, $globalAllTracked, $globalNoImport, $globalNoDB, $globalServerAPRS,$APRSMarine, $globalLiveInterval, $globalVM, $globalOnlyID;
130
-	if (!isset($globalCoordMinChange) || $globalCoordMinChange == '') $globalCoordMinChange = '0.02';
144
+	if (!isset($globalCoordMinChange) || $globalCoordMinChange == '') {
145
+		$globalCoordMinChange = '0.02';
146
+	}
131 147
 	date_default_timezone_set('UTC');
132 148
 	$dataFound = false;
133 149
 	$send = false;
@@ -141,20 +157,30 @@  discard block
 block discarded – undo
141 157
 		// Increment message number
142 158
 		if (isset($line['sourcestats']) && $line['sourcestats'] == TRUE) {
143 159
 		    $current_date = date('Y-m-d');
144
-		    if (isset($line['source_name'])) $source = $line['source_name'];
145
-		    else $source = '';
146
-		    if ($source == '' || $line['format_source'] == 'aprs') $source = $line['format_source'];
160
+		    if (isset($line['source_name'])) {
161
+		    	$source = $line['source_name'];
162
+		    } else {
163
+		    	$source = '';
164
+		    }
165
+		    if ($source == '' || $line['format_source'] == 'aprs') {
166
+		    	$source = $line['format_source'];
167
+		    }
147 168
 		    if (!isset($this->stats[$current_date][$source]['msg'])) {
148 169
 		    	$this->stats[$current_date][$source]['msg']['date'] = time();
149 170
 		    	$this->stats[$current_date][$source]['msg']['nb'] = 1;
150
-		    } else $this->stats[$current_date][$source]['msg']['nb'] += 1;
171
+		    } else {
172
+		    	$this->stats[$current_date][$source]['msg']['nb'] += 1;
173
+		    }
151 174
 		}
152 175
 		
153 176
 		
154 177
 		$Common = new Common();
155 178
 		$AIS = new AIS();
156
-	        if (!isset($line['id'])) $id = trim($line['mmsi']);
157
-	        else $id = trim($line['id']);
179
+	        if (!isset($line['id'])) {
180
+	        	$id = trim($line['mmsi']);
181
+	        } else {
182
+	        	$id = trim($line['id']);
183
+	        }
158 184
 		
159 185
 		if (!isset($this->all_tracked[$id])) {
160 186
 		    $this->all_tracked[$id] = array();
@@ -162,10 +188,16 @@  discard block
 block discarded – undo
162 188
 		    $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' => '','captain_id' => '','captain_name' => '','race_id' => '','race_name' => '','distance' => NULL,'race_rank' => NULL,'race_time' => NULL,'race_begin' => ''));
163 189
 		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('lastupdate' => time()));
164 190
 		    if (!isset($line['id'])) {
165
-			if (!isset($globalDaemon)) $globalDaemon = TRUE;
191
+			if (!isset($globalDaemon)) {
192
+				$globalDaemon = TRUE;
193
+			}
166 194
 			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $id.'-'.date('YmdHi')));
167
-		     } else $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $line['id']));
168
-		    if ($globalAllTracked !== FALSE) $dataFound = true;
195
+		     } else {
196
+		     	$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $line['id']));
197
+		     }
198
+		    if ($globalAllTracked !== FALSE) {
199
+		    	$dataFound = true;
200
+		    }
169 201
 		}
170 202
 		
171 203
 		if (isset($line['mmsi']) && $line['mmsi'] != '' && $line['mmsi'] != $this->all_tracked[$id]['mmsi']) {
@@ -222,7 +254,9 @@  discard block
 block discarded – undo
222 254
 		if (isset($line['arrival_code']) && $line['arrival_code'] != '') {
223 255
 		    if (!isset($this->all_tracked[$id]['arrival_code'])) {
224 256
 			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('arrival_code' => $line['arrival_code']));
225
-			if ($globalDebug) echo $this->all_tracked[$id]['id'].' => New arrival: '.$line['arrival_code']."\n";
257
+			if ($globalDebug) {
258
+				echo $this->all_tracked[$id]['id'].' => New arrival: '.$line['arrival_code']."\n";
259
+			}
226 260
 			if ($this->all_tracked[$id]['addedMarine'] != 0) {
227 261
 			    if (!isset($globalNoImport) || $globalNoImport !== TRUE) {
228 262
 				if (!isset($globalNoDB) || $globalNoDB !== TRUE) {
@@ -235,7 +269,9 @@  discard block
 block discarded – undo
235 269
 			}
236 270
 		    } elseif ($this->all_tracked[$id]['arrival_code'] != $line['arrival_code']) {
237 271
 			$this->all_tracked[$id]['arrival_code'] = $line['arrival_code'];
238
-			if ($globalDebug) echo $this->all_tracked[$id]['id'].' => New arrival: '.$line['arrival_code']."\n";
272
+			if ($globalDebug) {
273
+				echo $this->all_tracked[$id]['id'].' => New arrival: '.$line['arrival_code']."\n";
274
+			}
239 275
 			if (!isset($line['id'])) {
240 276
 				$this->all_tracked[$id]['id'] = $id.'-'.date('YmdHi');
241 277
 				$this->all_tracked[$id]['forcenew'] = 1;
@@ -244,7 +280,9 @@  discard block
 block discarded – undo
244 280
 		    }
245 281
 		}
246 282
 		if (isset($line['arrival_date']) && $line['arrival_date'] != '') {
247
-		    if (strtotime($line['arrival_date']) > time()) $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('arrival_date' => $line['arrival_date']));
283
+		    if (strtotime($line['arrival_date']) > time()) {
284
+		    	$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('arrival_date' => $line['arrival_date']));
285
+		    }
248 286
 		}
249 287
 		if (isset($line['captain_id']) && $line['captain_id'] != '') {
250 288
 		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('captain_id' => $line['captain_id']));
@@ -289,34 +327,49 @@  discard block
 block discarded – undo
289 327
 				$Marine = new Marine($this->db);
290 328
 				$fromsource = NULL;
291 329
 				$result = $Marine->updateIdentMarineData($this->all_tracked[$id]['id'],$this->all_tracked[$id]['ident'],$fromsource);
292
-				if ($globalDebug && $result != 'success') echo '!!! ERROR : '.$result."\n";
330
+				if ($globalDebug && $result != 'success') {
331
+					echo '!!! ERROR : '.$result."\n";
332
+				}
293 333
 				$Marine->db = null;
294
-				if ($globalDebugTimeElapsed) echo 'Time elapsed for update identspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
334
+				if ($globalDebugTimeElapsed) {
335
+					echo 'Time elapsed for update identspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
336
+				}
295 337
 			    }
296 338
 			}
297 339
 		    }
298
-		    if (!isset($this->all_tracked[$id]['id'])) $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $this->all_tracked[$id]['ident']));
340
+		    if (!isset($this->all_tracked[$id]['id'])) {
341
+		    	$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $this->all_tracked[$id]['ident']));
342
+		    }
299 343
 		}
300 344
 
301 345
 		if (isset($line['datetime']) && strtotime($line['datetime']) > time()-30*60 && strtotime($line['datetime']) < time()+20*60) {
302 346
 		    if (!isset($this->all_tracked[$id]['datetime']) || strtotime($line['datetime']) > strtotime($this->all_tracked[$id]['datetime'])) {
303 347
 			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('datetime' => $line['datetime']));
304 348
 		    } else {
305
-				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";
306
-				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";
349
+				if (strtotime($line['datetime']) == strtotime($this->all_tracked[$id]['datetime']) && $globalDebug) {
350
+					echo "!!! Date is the same as previous data for ".$this->all_tracked[$id]['mmsi']."\n";
351
+				} elseif (strtotime($line['datetime']) > strtotime($this->all_tracked[$id]['datetime']) && $globalDebug) {
352
+					echo "!!! Date previous latest data (".$line['datetime']." > ".$this->all_tracked[$id]['datetime'].") !!! for ".$this->all_tracked[$id]['hex']." - format : ".$line['format_source']."\n";
353
+				}
307 354
 				return '';
308 355
 		    }
309 356
 		} elseif (isset($line['datetime']) && strtotime($line['datetime']) <= time()-30*60) {
310
-			if ($globalDebug) echo "!!! Date is too old ".$this->all_tracked[$id]['mmsi']." - format : ".$line['format_source']."!!!\n";
357
+			if ($globalDebug) {
358
+				echo "!!! Date is too old ".$this->all_tracked[$id]['mmsi']." - format : ".$line['format_source']."!!!\n";
359
+			}
311 360
 			return '';
312 361
 		} elseif (isset($line['datetime']) && strtotime($line['datetime']) >= time()+20*60) {
313
-			if ($globalDebug) echo "!!! Date is in the future ".$this->all_tracked[$id]['mmsi']." - format : ".$line['format_source']."!!!\n";
362
+			if ($globalDebug) {
363
+				echo "!!! Date is in the future ".$this->all_tracked[$id]['mmsi']." - format : ".$line['format_source']."!!!\n";
364
+			}
314 365
 			return '';
315 366
 		} elseif (!isset($line['datetime'])) {
316 367
 			date_default_timezone_set('UTC');
317 368
 			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('datetime' => date('Y-m-d H:i:s')));
318 369
 		} else {
319
-			if ($globalDebug) echo "!!! Unknow date error ".$this->all_tracked[$id]['mmsi']." date: ".$line['datetime']." - format : ".$line['format_source']."!!!\n";
370
+			if ($globalDebug) {
371
+				echo "!!! Unknow date error ".$this->all_tracked[$id]['mmsi']." date: ".$line['datetime']." - format : ".$line['format_source']."!!!\n";
372
+			}
320 373
 			return '';
321 374
 		}
322 375
 
@@ -329,14 +382,21 @@  discard block
 block discarded – undo
329 382
 		    if ($distance > 1000 && $distance < 10000) {
330 383
 			$speed = $distance/(time() - $this->all_tracked[$id]['time_last_coord']);
331 384
 			$speed = $speed*3.6;
332
-			if ($speed < 1000) $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('speed' => round($speed,2)));
333
-  			if ($globalDebug) echo "ø Calculated Speed for ".$this->all_tracked[$id]['id']." : ".$speed." - distance : ".$distance."\n";
385
+			if ($speed < 1000) {
386
+				$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('speed' => round($speed,2)));
387
+			}
388
+  			if ($globalDebug) {
389
+  				echo "ø Calculated Speed for ".$this->all_tracked[$id]['id']." : ".$speed." - distance : ".$distance."\n";
390
+  			}
334 391
 		    }
335 392
 		}
336 393
 
337 394
 	        if (isset($line['latitude']) && isset($line['longitude']) && $line['latitude'] != '' && $line['longitude'] != '' && is_numeric($line['latitude']) && is_numeric($line['longitude'])) {
338
-	    	    if (isset($this->all_tracked[$id]['time_last_coord'])) $timediff = round(time()-$this->all_tracked[$id]['time_last_coord']);
339
-	    	    else unset($timediff);
395
+	    	    if (isset($this->all_tracked[$id]['time_last_coord'])) {
396
+	    	    	$timediff = round(time()-$this->all_tracked[$id]['time_last_coord']);
397
+	    	    } else {
398
+	    	    	unset($timediff);
399
+	    	    }
340 400
 	    	    if ($this->tmd > 5 ||
341 401
 	    		!isset($timediff) ||
342 402
 	    		$timediff > $globalLiveInterval ||
@@ -353,22 +413,32 @@  discard block
 block discarded – undo
353 413
 				$this->all_tracked[$id]['archive_longitude'] = $line['longitude'];
354 414
 				$this->all_tracked[$id]['putinarchive'] = true;
355 415
 				
356
-				if ($globalDebug) echo "\n".' ------- Check Country for '.$this->all_tracked[$id]['ident'].' with latitude : '.$line['latitude'].' and longitude : '.$line['longitude'].'.... ';
416
+				if ($globalDebug) {
417
+					echo "\n".' ------- Check Country for '.$this->all_tracked[$id]['ident'].' with latitude : '.$line['latitude'].' and longitude : '.$line['longitude'].'.... ';
418
+				}
357 419
 				$timeelapsed = microtime(true);
358 420
 				if (!isset($globalNoDB) || $globalNoDB !== TRUE) {
359 421
 				    $Marine = new Marine($this->db);
360 422
 				    $all_country = $Marine->getCountryFromLatitudeLongitude($line['latitude'],$line['longitude']);
361
-				    if (!empty($all_country)) $this->all_tracked[$id]['over_country'] = $all_country['iso2'];
423
+				    if (!empty($all_country)) {
424
+				    	$this->all_tracked[$id]['over_country'] = $all_country['iso2'];
425
+				    }
362 426
 				    $Marine->db = null;
363
-				    if ($globalDebugTimeElapsed) echo 'Time elapsed for update getCountryFromlatitudeLongitude : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
427
+				    if ($globalDebugTimeElapsed) {
428
+				    	echo 'Time elapsed for update getCountryFromlatitudeLongitude : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
429
+				    }
364 430
 				}
365 431
 				$this->tmd = 0;
366
-				if ($globalDebug) echo 'FOUND : '.$this->all_tracked[$id]['over_country'].' ---------------'."\n";
432
+				if ($globalDebug) {
433
+					echo 'FOUND : '.$this->all_tracked[$id]['over_country'].' ---------------'."\n";
434
+				}
367 435
 			    }
368 436
 			}
369 437
 
370 438
 			if (isset($line['latitude']) && $line['latitude'] != '' && $line['latitude'] != 0 && $line['latitude'] < 91 && $line['latitude'] > -90) {
371
-				if (!isset($this->all_tracked[$id]['archive_latitude'])) $this->all_tracked[$id]['archive_latitude'] = $line['latitude'];
439
+				if (!isset($this->all_tracked[$id]['archive_latitude'])) {
440
+					$this->all_tracked[$id]['archive_latitude'] = $line['latitude'];
441
+				}
372 442
 				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') {
373 443
 				    $this->all_tracked[$id]['livedb_latitude'] = $line['latitude'];
374 444
 				    $dataFound = true;
@@ -377,8 +447,12 @@  discard block
 block discarded – undo
377 447
 				$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('latitude' => $line['latitude']));
378 448
 			}
379 449
 			if (isset($line['longitude']) && $line['longitude'] != '' && $line['longitude'] != 0 && $line['longitude'] < 360 && $line['longitude'] > -180) {
380
-			    if ($line['longitude'] > 180) $line['longitude'] = $line['longitude'] - 360;
381
-				if (!isset($this->all_tracked[$id]['archive_longitude'])) $this->all_tracked[$id]['archive_longitude'] = $line['longitude'];
450
+			    if ($line['longitude'] > 180) {
451
+			    	$line['longitude'] = $line['longitude'] - 360;
452
+			    }
453
+				if (!isset($this->all_tracked[$id]['archive_longitude'])) {
454
+					$this->all_tracked[$id]['archive_longitude'] = $line['longitude'];
455
+				}
382 456
 				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') {
383 457
 				    $this->all_tracked[$id]['livedb_longitude'] = $line['longitude'];
384 458
 				    $dataFound = true;
@@ -396,7 +470,9 @@  discard block
 block discarded – undo
396 470
 		    }
397 471
 		}
398 472
 		if (isset($line['last_update']) && $line['last_update'] != '') {
399
-		    if (isset($this->all_tracked[$id]['last_update']) && $this->all_tracked[$id]['last_update'] != $line['last_update']) $dataFound = true;
473
+		    if (isset($this->all_tracked[$id]['last_update']) && $this->all_tracked[$id]['last_update'] != $line['last_update']) {
474
+		    	$dataFound = true;
475
+		    }
400 476
 		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('last_update' => $line['last_update']));
401 477
 		}
402 478
 		if (isset($line['format_source']) && $line['format_source'] != '') {
@@ -410,15 +486,21 @@  discard block
 block discarded – undo
410 486
 		}
411 487
 		
412 488
 		if (isset($line['heading']) && $line['heading'] != '') {
413
-		    if (is_int($this->all_tracked[$id]['heading']) && abs($this->all_tracked[$id]['heading']-round($line['heading'])) > 10) $this->all_tracked[$id]['putinarchive'] = true;
489
+		    if (is_int($this->all_tracked[$id]['heading']) && abs($this->all_tracked[$id]['heading']-round($line['heading'])) > 10) {
490
+		    	$this->all_tracked[$id]['putinarchive'] = true;
491
+		    }
414 492
 		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('heading' => round($line['heading'])));
415 493
 		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('heading_fromsrc' => true));
416 494
 		    //$dataFound = true;
417 495
   		} 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']) {
418 496
   		    $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']);
419 497
 		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('heading' => round($heading)));
420
-		    if (abs($this->all_tracked[$id]['heading']-round($heading)) > 10) $this->all_tracked[$id]['putinarchive'] = true;
421
-  		    if ($globalDebug) echo "ø Calculated Heading for ".$this->all_tracked[$id]['ident']." : ".$heading."\n";
498
+		    if (abs($this->all_tracked[$id]['heading']-round($heading)) > 10) {
499
+		    	$this->all_tracked[$id]['putinarchive'] = true;
500
+		    }
501
+  		    if ($globalDebug) {
502
+  		    	echo "ø Calculated Heading for ".$this->all_tracked[$id]['ident']." : ".$heading."\n";
503
+  		    }
422 504
   		}
423 505
 		//if (isset($globalSourcesupdate) && $globalSourcesupdate != '' && isset($this->all_tracked[$id]['lastupdate']) && time()-$this->all_tracked[$id]['lastupdate'] < $globalSourcesupdate) $dataFound = false;
424 506
 
@@ -430,28 +512,45 @@  discard block
 block discarded – undo
430 512
 		        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'])) && (!isset($globalOnlyID) || in_array($id,$globalOnlyID))) {
431 513
 			    if (!isset($this->all_tracked[$id]['forcenew']) || $this->all_tracked[$id]['forcenew'] == 0) {
432 514
 				if (!isset($globalNoDB) || $globalNoDB !== TRUE) {
433
-				    if ($globalDebug) echo "Check if vessel is already in DB...";
515
+				    if ($globalDebug) {
516
+				    	echo "Check if vessel is already in DB...";
517
+				    }
434 518
 				    $timeelapsed = microtime(true);
435 519
 				    $MarineLive = new MarineLive($this->db);
436 520
 				    if (isset($line['id']) && isset($globalVM) && $globalVM) {
437 521
 					$Marine = new Marine($this->db);
438 522
 					$recent_ident = $Marine->checkId($line['id']);
439
-					if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkId : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
523
+					if ($globalDebugTimeElapsed) {
524
+						echo 'Time elapsed for update checkId : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
525
+					}
440 526
 					$Marine->db=null;
441 527
 				    } elseif (isset($line['id'])) {
442 528
 					$recent_ident = $MarineLive->checkIdRecent($line['id']);
443
-					if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
529
+					if ($globalDebugTimeElapsed) {
530
+						echo 'Time elapsed for update checkIdRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
531
+					}
444 532
 				    } elseif (isset($this->all_tracked[$id]['mmsi']) && $this->all_tracked[$id]['mmsi'] != '') {
445 533
 					$recent_ident = $MarineLive->checkMMSIRecent($this->all_tracked[$id]['mmsi']);
446
-					if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdentRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
534
+					if ($globalDebugTimeElapsed) {
535
+						echo 'Time elapsed for update checkIdentRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
536
+					}
447 537
 				    } elseif (isset($this->all_tracked[$id]['ident']) && $this->all_tracked[$id]['ident'] != '') {
448 538
 					$recent_ident = $MarineLive->checkIdentRecent($this->all_tracked[$id]['ident']);
449
-					if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdentRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
450
-				    } else $recent_ident = '';
539
+					if ($globalDebugTimeElapsed) {
540
+						echo 'Time elapsed for update checkIdentRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
541
+					}
542
+				    } else {
543
+				    	$recent_ident = '';
544
+				    }
451 545
 				    $MarineLive->db=null;
452
-				    if ($globalDebug && $recent_ident == '') echo " Not in DB.\n";
453
-				    elseif ($globalDebug && $recent_ident != '') echo " Already in DB.\n";
454
-				} else $recent_ident = '';
546
+				    if ($globalDebug && $recent_ident == '') {
547
+				    	echo " Not in DB.\n";
548
+				    } elseif ($globalDebug && $recent_ident != '') {
549
+				    	echo " Already in DB.\n";
550
+				    }
551
+				} else {
552
+					$recent_ident = '';
553
+				}
455 554
 			    } else {
456 555
 				$recent_ident = '';
457 556
 				$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('forcenew' => 0));
@@ -460,12 +559,17 @@  discard block
 block discarded – undo
460 559
 			    if($recent_ident == "" && (($this->all_tracked[$id]['latitude'] != '' && $this->all_tracked[$id]['longitude'] != '') || (isset($globalVM) && $globalVM)))
461 560
 			    {
462 561
 				if ($globalDebug) {
463
-					if ($this->all_tracked[$id]['mmsi'] != '') echo "\o/ Add ".$this->all_tracked[$id]['mmsi']." in archive DB : ";
464
-					else echo "\o/ Add ".$this->all_tracked[$id]['ident']." in archive DB : ";
562
+					if ($this->all_tracked[$id]['mmsi'] != '') {
563
+						echo "\o/ Add ".$this->all_tracked[$id]['mmsi']." in archive DB : ";
564
+					} else {
565
+						echo "\o/ Add ".$this->all_tracked[$id]['ident']." in archive DB : ";
566
+					}
465 567
 				}
466 568
 				//adds the spotter data for the archive
467 569
 				    $highlight = '';
468
-				    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')));
570
+				    if (!isset($this->all_tracked[$id]['id'])) {
571
+				    	$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $this->all_tracked[$id]['mmsi'].'-'.date('YmdHi')));
572
+				    }
469 573
 				    if (!isset($globalNoImport) || $globalNoImport !== TRUE) {
470 574
 					if (!isset($globalNoDB) || $globalNoDB !== TRUE) {
471 575
 					    $timeelapsed = microtime(true);
@@ -476,20 +580,30 @@  discard block
 block discarded – undo
476 580
 						$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'],$this->all_tracked[$id]['captain_id'],$this->all_tracked[$id]['captain_name'],$this->all_tracked[$id]['race_id'],$this->all_tracked[$id]['race_name'],$this->all_tracked[$id]['distance'],$this->all_tracked[$id]['race_rank'],$this->all_tracked[$id]['race_time']);
477 581
 					    }
478 582
 					    $Marine->db = null;
479
-					    if ($globalDebug && isset($result)) echo $result."\n";
480
-					    if ($globalDebugTimeElapsed) echo 'Time elapsed for update addspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
583
+					    if ($globalDebug && isset($result)) {
584
+					    	echo $result."\n";
585
+					    }
586
+					    if ($globalDebugTimeElapsed) {
587
+					    	echo 'Time elapsed for update addspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
588
+					    }
481 589
 					}
482 590
 				    }
483 591
 				    if (isset($line['sourcestats']) && $line['sourcestats'] == TRUE && $this->all_tracked[$id]['latitude'] != '' && $this->all_tracked[$id]['longitude'] != '') {
484 592
 					// Add source stat in DB
485 593
 					$Stats = new Stats($this->db);
486 594
 					if (!empty($this->stats)) {
487
-					    if ($globalDebug) echo 'Add source stats : ';
595
+					    if ($globalDebug) {
596
+					    	echo 'Add source stats : ';
597
+					    }
488 598
 				    	    foreach($this->stats as $date => $data) {
489 599
 						foreach($data as $source => $sourced) {
490 600
 					    	    //print_r($sourced);
491
-				    	    	    if (isset($sourced['polar'])) echo $Stats->addStatSource(json_encode($sourced['polar']),$source,'polar_marine',$date);
492
-				    	    	    if (isset($sourced['hist'])) echo $Stats->addStatSource(json_encode($sourced['hist']),$source,'hist_marine',$date);
601
+				    	    	    if (isset($sourced['polar'])) {
602
+				    	    	    	echo $Stats->addStatSource(json_encode($sourced['polar']),$source,'polar_marine',$date);
603
+				    	    	    }
604
+				    	    	    if (isset($sourced['hist'])) {
605
+				    	    	    	echo $Stats->addStatSource(json_encode($sourced['hist']),$source,'hist_marine',$date);
606
+				    	    	    }
493 607
 				    		    if (isset($sourced['msg'])) {
494 608
 				    			if (time() - $sourced['msg']['date'] > 10) {
495 609
 				    		    	    $nbmsg = round($sourced['msg']['nb']/(time() - $sourced['msg']['date']));
@@ -502,7 +616,9 @@  discard block
 block discarded – undo
502 616
 			    			    unset($this->stats[$date]);
503 617
 			    			}
504 618
 				    	    }
505
-				    	    if ($globalDebug) echo 'Done'."\n";
619
+				    	    if ($globalDebug) {
620
+				    	    	echo 'Done'."\n";
621
+				    	    }
506 622
 					}
507 623
 					$Stats->db = null;
508 624
 				    }
@@ -512,13 +628,17 @@  discard block
 block discarded – undo
512 628
 				$this->all_tracked[$id]['addedMarine'] = 1;
513 629
 				//print_r($this->all_tracked[$id]);
514 630
 				if ($this->last_delete == 0 || time() - $this->last_delete > 1800) {
515
-				    if ($globalDebug) echo "---- Deleting Live Marine data older than 12 hours...";
631
+				    if ($globalDebug) {
632
+				    	echo "---- Deleting Live Marine data older than 12 hours...";
633
+				    }
516 634
 				    //MarineLive->deleteLiveMarineDataNotUpdated();
517 635
 				    if (!isset($globalNoDB) || $globalNoDB !== TRUE) {
518 636
 					$MarineLive = new MarineLive($this->db);
519 637
 					$MarineLive->deleteLiveMarineData();
520 638
 					$MarineLive->db=null;
521
-					if ($globalDebug) echo " Done\n";
639
+					if ($globalDebug) {
640
+						echo " Done\n";
641
+					}
522 642
 				    }
523 643
 				    $this->last_delete = time();
524 644
 				}
@@ -534,8 +654,11 @@  discard block
 block discarded – undo
534 654
 					    } else {
535 655
 						//$finaldatetime = date('Y-m-d H:i:s',strtotime($this->all_tracked[$id]['race_begin'])+$this->all_tracked[$id]['race_time']);
536 656
 						$timerace = (strtotime($this->all_tracked[$id]['race_begin'])+$this->all_tracked[$id]['race_time']);
537
-						if ($timerace > time()) $finaldatetime = NULL;
538
-						else $finaldatetime = date('Y-m-d H:i:s',$timerace);
657
+						if ($timerace > time()) {
658
+							$finaldatetime = NULL;
659
+						} else {
660
+							$finaldatetime = date('Y-m-d H:i:s',$timerace);
661
+						}
539 662
 
540 663
 						$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'],$finaldatetime,$this->all_tracked[$id]['distance'],$this->all_tracked[$id]['race_rank'],$this->all_tracked[$id]['race_time'],$this->all_tracked[$id]['status'],$this->all_tracked[$id]['race_begin']);
541 664
 					    }
@@ -554,18 +677,26 @@  discard block
 block discarded – undo
554 677
 			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";
555 678
 		    }
556 679
 		    $ignoreImport = false;
557
-		    if ((isset($globalVM) && $globalVM) && $this->all_tracked[$id]['status'] == 'sailawayfull' && $this->all_tracked[$id]['status'] != 'Racing') $ignoreImport = true;
680
+		    if ((isset($globalVM) && $globalVM) && $this->all_tracked[$id]['status'] == 'sailawayfull' && $this->all_tracked[$id]['status'] != 'Racing') {
681
+		    	$ignoreImport = true;
682
+		    }
558 683
 		    if (!$ignoreImport) {
559 684
 			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'])) && (!isset($globalOnlyID) || in_array($id,$globalOnlyID))) {
560
-				if ($globalDebug) echo "\o/ Add ".$this->all_tracked[$id]['ident']." from ".$this->all_tracked[$id]['format_source']." in Live DB : ";
685
+				if ($globalDebug) {
686
+					echo "\o/ Add ".$this->all_tracked[$id]['ident']." from ".$this->all_tracked[$id]['format_source']." in Live DB : ";
687
+				}
561 688
 				if (!isset($globalNoImport) || $globalNoImport !== TRUE) {
562 689
 				    if (!isset($globalNoDB) || $globalNoDB !== TRUE) {
563 690
 					$timeelapsed = microtime(true);
564 691
 					$MarineLive = new MarineLive($this->db);
565 692
 					$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'],$this->all_tracked[$id]['captain_id'],$this->all_tracked[$id]['captain_name'],$this->all_tracked[$id]['race_id'],$this->all_tracked[$id]['race_name'],$this->all_tracked[$id]['distance'],$this->all_tracked[$id]['race_rank'],$this->all_tracked[$id]['race_time']);
566 693
 					$MarineLive->db = null;
567
-					if ($globalDebug) echo $result."\n";
568
-					if ($globalDebugTimeElapsed) echo 'Time elapsed for update addlivespotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
694
+					if ($globalDebug) {
695
+						echo $result."\n";
696
+					}
697
+					if ($globalDebugTimeElapsed) {
698
+						echo 'Time elapsed for update addlivespotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
699
+					}
569 700
 				    }
570 701
 				}
571 702
 				if (isset($globalServerAPRS) && $globalServerAPRS && $this->all_tracked[$id]['putinarchive']) {
@@ -577,7 +708,9 @@  discard block
 block discarded – undo
577 708
 				
578 709
 				if (isset($line['sourcestats']) && $line['sourcestats'] == TRUE && $line['format_source'] != 'aprs' && $this->all_tracked[$id]['latitude'] != '' && $this->all_tracked[$id]['longitude'] != '') {
579 710
 					$source = $this->all_tracked[$id]['source_name'];
580
-					if ($source == '') $source = $this->all_tracked[$id]['format_source'];
711
+					if ($source == '') {
712
+						$source = $this->all_tracked[$id]['format_source'];
713
+					}
581 714
 					if (!isset($this->source_location[$source])) {
582 715
 						$Location = new Source($this->db);
583 716
 						$coord = $Location->getLocationInfobySourceName($source);
@@ -598,7 +731,9 @@  discard block
 block discarded – undo
598 731
 					$stats_heading = round($stats_heading/22.5);
599 732
 					$stats_distance = $Common->distance($latitude,$longitude,$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude']);
600 733
 					$current_date = date('Y-m-d');
601
-					if ($stats_heading == 16) $stats_heading = 0;
734
+					if ($stats_heading == 16) {
735
+						$stats_heading = 0;
736
+					}
602 737
 					if (!isset($this->stats[$current_date][$source]['polar'][1])) {
603 738
 						for ($i=0;$i<=15;$i++) {
604 739
 						    $this->stats[$current_date][$source]['polar'][$i] = 0;
@@ -616,7 +751,9 @@  discard block
 block discarded – undo
616 751
 						if (isset($this->stats[$current_date][$source]['hist'][0])) {
617 752
 						    end($this->stats[$current_date][$source]['hist']);
618 753
 						    $mini = key($this->stats[$current_date][$source]['hist'])+10;
619
-						} else $mini = 0;
754
+						} else {
755
+							$mini = 0;
756
+						}
620 757
 						for ($i=$mini;$i<=$distance;$i+=10) {
621 758
 						    $this->stats[$current_date][$source]['hist'][$i] = 0;
622 759
 						}
@@ -628,19 +765,27 @@  discard block
 block discarded – undo
628 765
 				
629 766
 
630 767
 				$this->all_tracked[$id]['lastupdate'] = time();
631
-				if ($this->all_tracked[$id]['putinarchive']) $send = true;
632
-			} 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";
768
+				if ($this->all_tracked[$id]['putinarchive']) {
769
+					$send = true;
770
+				}
771
+			} elseif (isset($this->all_tracked[$id]['latitude']) && isset($globalDistanceIgnore['latitude']) && $globalDebug) {
772
+				echo "!! Too far -> Distance : ".$Common->distance($this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude'])."\n";
773
+			}
633 774
 			//$this->del();
634 775
 			
635 776
 			
636 777
 			if ($this->last_delete_hourly == 0 || time() - $this->last_delete_hourly > 900) {
637 778
 			    if (!isset($globalNoDB) || $globalNoDB !== TRUE) {
638
-				if ($globalDebug) echo "---- Deleting Live Marine data Not updated since 2 hour...";
779
+				if ($globalDebug) {
780
+					echo "---- Deleting Live Marine data Not updated since 2 hour...";
781
+				}
639 782
 				$MarineLive = new MarineLive($this->db);
640 783
 				$MarineLive->deleteLiveMarineDataNotUpdated();
641 784
 				$MarineLive->db = null;
642 785
 				//MarineLive->deleteLiveMarineData();
643
-				if ($globalDebug) echo " Done\n";
786
+				if ($globalDebug) {
787
+					echo " Done\n";
788
+				}
644 789
 			    }
645 790
 			    $this->last_delete_hourly = time();
646 791
 			}
@@ -649,7 +794,9 @@  discard block
 block discarded – undo
649 794
 		    //$ignoreImport = false;
650 795
 		}
651 796
 		//if (function_exists('pcntl_fork') && $globalFork) pcntl_signal(SIGCHLD, SIG_IGN);
652
-		if ($send) return $this->all_tracked[$id];
797
+		if ($send) {
798
+			return $this->all_tracked[$id];
799
+		}
653 800
 	    }
654 801
 	}
655 802
     }
Please login to merge, or discard this patch.
require/class.METAR.php 1 patch
Braces   +130 added lines, -51 removed lines patch added patch discarded remove patch
@@ -73,8 +73,11 @@  discard block
 block discarded – undo
73 73
 		}
74 74
 		$row = $sth->fetch(PDO::FETCH_ASSOC);
75 75
 		$sth->closeCursor();
76
-		if ($row['nb'] > 0) return false;
77
-		else return true;
76
+		if ($row['nb'] > 0) {
77
+			return false;
78
+		} else {
79
+			return true;
80
+		}
78 81
 	}
79 82
 
80 83
 	/*
@@ -105,29 +108,48 @@  discard block
 block discarded – undo
105 108
 		//$pieces = explode(' ',$data);
106 109
 		$pieces = preg_split('/\s/',$data);
107 110
 		$pos = 0;
108
-		if ($pieces[0] == 'METAR') $pos++;
109
-		elseif ($pieces[0] == 'SPECI') $pos++;
110
-		if (strlen($pieces[$pos]) != 4) $pos++;
111
+		if ($pieces[0] == 'METAR') {
112
+			$pos++;
113
+		} elseif ($pieces[0] == 'SPECI') {
114
+			$pos++;
115
+		}
116
+		if (strlen($pieces[$pos]) != 4) {
117
+			$pos++;
118
+		}
111 119
 		$result = array();
112
-		if (!isset($pieces[$pos])) return $result;
120
+		if (!isset($pieces[$pos])) {
121
+			return $result;
122
+		}
113 123
 		$result['location'] = $pieces[$pos];
114 124
 		$pos++;
115
-		if (!isset($pieces[$pos])) return $result;
125
+		if (!isset($pieces[$pos])) {
126
+			return $result;
127
+		}
116 128
 		$result['dayofmonth'] = substr($pieces[$pos],0,2);
117 129
 		$result['time'] = substr($pieces[$pos],2,4);
118 130
 		$c = count($pieces);
119 131
 		for($pos++; $pos < $c; $pos++) {
120 132
 			$piece = $pieces[$pos];
121
-			if ($piece == 'RMK') break;
122
-			if ($piece == 'AUTO') $result['auto'] = true;
123
-			if ($piece == 'COR') $result['correction'] = true;
133
+			if ($piece == 'RMK') {
134
+				break;
135
+			}
136
+			if ($piece == 'AUTO') {
137
+				$result['auto'] = true;
138
+			}
139
+			if ($piece == 'COR') {
140
+				$result['correction'] = true;
141
+			}
124 142
 			// Wind Speed
125 143
 			if (preg_match('#(VRB|\d\d\d)(\d\d)(?:G(\d\d))?(KT|MPS|KPH)(?: (\d{1,3})V(\d{1,3}))?$#', $piece, $matches)) {
126 144
 				$result['wind']['direction'] = (float)$matches[1];
127 145
 				$result['wind']['unit'] = $matches[4];
128
-				if ($result['wind']['unit'] == 'KT') $result['wind']['speed'] = round(((float)$matches[2])*0.51444444444,2);
129
-				elseif ($result['wind']['unit'] == 'KPH') $result['wind']['speed'] = round(((float)$matches[2])*1000,2);
130
-				elseif ($result['wind']['unit'] == 'MPS') $result['wind']['speed'] = round(((float)$matches[2]),2);
146
+				if ($result['wind']['unit'] == 'KT') {
147
+					$result['wind']['speed'] = round(((float)$matches[2])*0.51444444444,2);
148
+				} elseif ($result['wind']['unit'] == 'KPH') {
149
+					$result['wind']['speed'] = round(((float)$matches[2])*1000,2);
150
+				} elseif ($result['wind']['unit'] == 'MPS') {
151
+					$result['wind']['speed'] = round(((float)$matches[2]),2);
152
+				}
131 153
 				$result['wind']['gust'] = (float)$matches[3];
132 154
 				$result['wind']['unit'] = $matches[4];
133 155
 				$result['wind']['min_variation'] = array_key_exists(5,$matches) ? $matches[5] : 0;
@@ -212,27 +234,49 @@  discard block
 block discarded – undo
212 234
 				//$this->addCloudCover($matches[1], ((float)$matches[2]) * 100, isset($matches[3]) ? $matches[3] : '');
213 235
 				$type = $matches[1];
214 236
 				$cloud = array();
215
-				if ($type == 'SKC') $cloud['type'] = 'No cloud/Sky clear';
216
-				elseif ($type == 'CLR') $cloud['type'] = 'No cloud below 12,000ft (3700m)';
217
-				elseif ($type == 'NSC') $cloud['type'] = 'No significant cloud';
218
-				elseif ($type == 'FEW') $cloud['type'] = 'Few';
219
-				elseif ($type == 'SCT') $cloud['type'] = 'Scattered';
220
-				elseif ($type == 'BKN') $cloud['type'] = 'Broken';
221
-				elseif ($type == 'OVC') $cloud['type'] = 'Overcast/Full cloud coverage';
222
-				elseif ($type == 'VV') $cloud['type'] = 'Vertical visibility';
237
+				if ($type == 'SKC') {
238
+					$cloud['type'] = 'No cloud/Sky clear';
239
+				} elseif ($type == 'CLR') {
240
+					$cloud['type'] = 'No cloud below 12,000ft (3700m)';
241
+				} elseif ($type == 'NSC') {
242
+					$cloud['type'] = 'No significant cloud';
243
+				} elseif ($type == 'FEW') {
244
+					$cloud['type'] = 'Few';
245
+				} elseif ($type == 'SCT') {
246
+					$cloud['type'] = 'Scattered';
247
+				} elseif ($type == 'BKN') {
248
+					$cloud['type'] = 'Broken';
249
+				} elseif ($type == 'OVC') {
250
+					$cloud['type'] = 'Overcast/Full cloud coverage';
251
+				} elseif ($type == 'VV') {
252
+					$cloud['type'] = 'Vertical visibility';
253
+				}
223 254
 				$cloud['type_code'] = $type;
224 255
 				$cloud['level'] = round(((float)$matches[2]) * 100 * 0.3048);
225
-				if (isset($matches[3])) $significant = $matches[3];
226
-				else $significant = '';
227
-				if ($significant == 'CB') $cloud['significant'] = 'Cumulonimbus';
228
-				elseif ($significant == 'AC') $cloud['significant'] = 'Altocumulus';
229
-				elseif ($significant == 'CBS') $cloud['significant'] = 'Cumulonimbus';
230
-				elseif ($significant == 'CC') $cloud['significant'] = 'Cirrocumulus';
231
-				elseif ($significant == 'CU') $cloud['significant'] = 'Cumulus';
232
-				elseif ($significant == 'CI') $cloud['significant'] = 'Cirrus';
233
-				elseif ($significant == 'CS') $cloud['significant'] = 'Cirrostratus';
234
-				elseif ($significant == 'TCU') $cloud['significant'] = 'Towering Cumulus';
235
-				else $cloud['significant'] = $significant;
256
+				if (isset($matches[3])) {
257
+					$significant = $matches[3];
258
+				} else {
259
+					$significant = '';
260
+				}
261
+				if ($significant == 'CB') {
262
+					$cloud['significant'] = 'Cumulonimbus';
263
+				} elseif ($significant == 'AC') {
264
+					$cloud['significant'] = 'Altocumulus';
265
+				} elseif ($significant == 'CBS') {
266
+					$cloud['significant'] = 'Cumulonimbus';
267
+				} elseif ($significant == 'CC') {
268
+					$cloud['significant'] = 'Cirrocumulus';
269
+				} elseif ($significant == 'CU') {
270
+					$cloud['significant'] = 'Cumulus';
271
+				} elseif ($significant == 'CI') {
272
+					$cloud['significant'] = 'Cirrus';
273
+				} elseif ($significant == 'CS') {
274
+					$cloud['significant'] = 'Cirrostratus';
275
+				} elseif ($significant == 'TCU') {
276
+					$cloud['significant'] = 'Towering Cumulus';
277
+				} else {
278
+					$cloud['significant'] = $significant;
279
+				}
236 280
 				//$cloud['significant'] = isset($matches[3]) ? $matches[3] : '';
237 281
 				$result['cloud'][] = $cloud;
238 282
 			}
@@ -256,8 +300,11 @@  discard block
 block discarded – undo
256 300
 				$result['RVR']['friction'] = $matches[5];
257 301
 			}
258 302
 			if (preg_match('#^(R[A-Z0-9]{2,3})/([0-9]{4})(V([0-9]{4}))?(FT)?$#', $piece, $matches)) {
259
-				if (isset($matches[5])) $range = array('exact' => (float)$matches[2], 'unit' => $matches[5] ? 'FT' : 'M');
260
-				else $range = array('exact' => (float)$matches[2], 'unit' => 'M');
303
+				if (isset($matches[5])) {
304
+					$range = array('exact' => (float)$matches[2], 'unit' => $matches[5] ? 'FT' : 'M');
305
+				} else {
306
+					$range = array('exact' => (float)$matches[2], 'unit' => 'M');
307
+				}
261 308
 				if (isset($matches[3])) {
262 309
 					$range = Array(
263 310
 					    'from' => (float)$matches[2],
@@ -290,8 +337,11 @@  discard block
 block discarded – undo
290 337
 				if (isset($matches[3])) {
291 338
 					$text[] = $this->texts[$matches[3]];
292 339
 				}
293
-				if (!isset($result['weather'])) $result['weather'] = implode(' ', $text);
294
-				else $result['weather'] = $result['weather'].' / '.implode(' ', $text);
340
+				if (!isset($result['weather'])) {
341
+					$result['weather'] = implode(' ', $text);
342
+				} else {
343
+					$result['weather'] = $result['weather'].' / '.implode(' ', $text);
344
+				}
295 345
 			}
296 346
 		}
297 347
 		return $result;
@@ -307,8 +357,11 @@  discard block
 block discarded – undo
307 357
 		if (isset($globalMETARcycle) && $globalMETARcycle) {
308 358
 			$query = "SELECT * FROM metar WHERE metar_location = :icao";
309 359
 		} else {
310
-			if ($globalDBdriver == 'mysql') $query = "SELECT * FROM metar WHERE metar_location = :icao AND metar_date >= DATE_SUB(UTC_TIMESTAMP(), INTERVAL 10 HOUR) LIMIT 1";
311
-			else $query = "SELECT * FROM metar WHERE metar_location = :icao AND metar_date >= now() AT TIMEZONE 'UTC' - '10 HOUR'->INTERVAL LIMIT 0,1";
360
+			if ($globalDBdriver == 'mysql') {
361
+				$query = "SELECT * FROM metar WHERE metar_location = :icao AND metar_date >= DATE_SUB(UTC_TIMESTAMP(), INTERVAL 10 HOUR) LIMIT 1";
362
+			} else {
363
+				$query = "SELECT * FROM metar WHERE metar_location = :icao AND metar_date >= now() AT TIMEZONE 'UTC' - '10 HOUR'->INTERVAL LIMIT 0,1";
364
+			}
312 365
 		}
313 366
 		$query_values = array(':icao' => $icao);
314 367
 		try {
@@ -383,7 +436,9 @@  discard block
 block discarded – undo
383 436
 	*/
384 437
 	public function addMETARCycle() {
385 438
 		global $globalDebug, $globalIVAO, $globalTransaction;
386
-		if (isset($globalDebug) && $globalDebug) echo "Downloading METAR cycle...";
439
+		if (isset($globalDebug) && $globalDebug) {
440
+			echo "Downloading METAR cycle...";
441
+		}
387 442
 		date_default_timezone_set("UTC");
388 443
 		$Common = new Common();
389 444
 		if (isset($globalIVAO) && $globalIVAO) {
@@ -394,19 +449,29 @@  discard block
 block discarded – undo
394 449
 			$handle = fopen(dirname(__FILE__).'/../install/tmp/'.date('H').'Z.TXT',"r");
395 450
 		}
396 451
 		if ($handle) {
397
-			if (isset($globalDebug) && $globalDebug) echo "Done - Updating DB...";
452
+			if (isset($globalDebug) && $globalDebug) {
453
+				echo "Done - Updating DB...";
454
+			}
398 455
 			$date = '';
399
-			if ($globalTransaction) $this->db->beginTransaction();
456
+			if ($globalTransaction) {
457
+				$this->db->beginTransaction();
458
+			}
400 459
 			while(($line = fgets($handle,4096)) !== false) {
401 460
 				$line = str_replace(array("\r\n","\r", "\n"), '', $line);
402 461
 				if (preg_match('#^([0-9]{4})/([0-9]{2})/([0-9]{2}) ([0-9]{2}):([0-9]{2})$#',$line)) {
403 462
 					$date = $line;
404 463
 				} elseif (trim($line) != '') {
405
-					if ($date == '') $date = date('Y/m/d H:m');
464
+					if ($date == '') {
465
+						$date = date('Y/m/d H:m');
466
+					}
406 467
 					$pos = 0;
407 468
 					$pieces = preg_split('/\s/',$line);
408
-					if ($pieces[0] == 'METAR') $pos++;
409
-					if (strlen($pieces[$pos]) != 4) $pos++;
469
+					if ($pieces[0] == 'METAR') {
470
+						$pos++;
471
+					}
472
+					if (strlen($pieces[$pos]) != 4) {
473
+						$pos++;
474
+					}
410 475
 					if (isset($pieces[$pos])) {
411 476
 						$location = $pieces[$pos];
412 477
 						//if ($location == 'LFLL') echo 'location: '.$location.' - date: '.$date.' - data: '.$line."\n";
@@ -415,9 +480,13 @@  discard block
 block discarded – undo
415 480
 				}
416 481
 			}
417 482
 			fclose($handle);
418
-			if ($globalTransaction) $this->db->commit();
483
+			if ($globalTransaction) {
484
+				$this->db->commit();
485
+			}
486
+		}
487
+		if (isset($globalDebug) && $globalDebug) {
488
+			echo "Done\n";
419 489
 		}
420
-		if (isset($globalDebug) && $globalDebug) echo "Done\n";
421 490
 	}
422 491
 
423 492
 	/*
@@ -427,7 +496,9 @@  discard block
 block discarded – undo
427 496
 	*/
428 497
 	public function downloadMETAR($icao) {
429 498
 		global $globalMETARurl;
430
-		if ($globalMETARurl == '') return array();
499
+		if ($globalMETARurl == '') {
500
+			return array();
501
+		}
431 502
 		date_default_timezone_set("UTC");
432 503
 		$Common = new Common();
433 504
 		$url = str_replace('{icao}',$icao,$globalMETARurl);
@@ -439,16 +510,24 @@  discard block
 block discarded – undo
439 510
 				$date = $line;
440 511
 			} 
441 512
 			if (trim($line) != '') {
442
-				if ($date == '') $date = date('Y/m/d H:m');
513
+				if ($date == '') {
514
+					$date = date('Y/m/d H:m');
515
+				}
443 516
 				$pos = 0;
444 517
 				$pieces = preg_split('/\s/',$line);
445
-				if ($pieces[0] == 'METAR') $pos++;
446
-				if (strlen($pieces[$pos]) != 4) $pos++;
518
+				if ($pieces[0] == 'METAR') {
519
+					$pos++;
520
+				}
521
+				if (strlen($pieces[$pos]) != 4) {
522
+					$pos++;
523
+				}
447 524
 				$location = $pieces[$pos];
448 525
 				if (strlen($location == 4)) {
449 526
 					$this->addMETAR($location,$line,$date);
450 527
 					return array('0' => array('metar_date' => $date, 'metar_location' => $location, 'metar' => $line));
451
-				} else return array();
528
+				} else {
529
+					return array();
530
+				}
452 531
 			}
453 532
 		}
454 533
 		return array();
Please login to merge, or discard this patch.
search-gpx.php 1 patch
Braces   +18 added lines, -7 removed lines patch added patch discarded remove patch
@@ -16,8 +16,12 @@  discard block
 block discarded – undo
16 16
 	} else if($_GET['start_date'] == "" && $_GET['end_date'] != ""){
17 17
 		$end_date = date("Y-m-d H:i:s", strtotime("2014-04-12")).",".date("Y-m-d",strtotime($_GET['end_date']))." 00:00:00";
18 18
 		$sql_date = $end_date;
19
-	} else $sql_date = '';
20
-} else $sql_date = '';
19
+	} else {
20
+		$sql_date = '';
21
+	}
22
+	} else {
23
+	$sql_date = '';
24
+}
21 25
 
22 26
 if (isset($_GET['highest_altitude'])) {
23 27
 	//for altitude manipulation
@@ -31,8 +35,12 @@  discard block
 block discarded – undo
31 35
 	} else if($_GET['highest_altitude'] == "" && $_GET['lowest_altitude'] != ""){
32 36
 		$start_altitude = filter_input(INPUT_GET,'lowest_altitude',FILTER_SANITIZE_NUMBER_INT).",60000";
33 37
 		$sql_altitude = $start_altitude;
34
-	} else $sql_altitude = '';
35
-} else $sql_altitude = '';
38
+	} else {
39
+		$sql_altitude = '';
40
+	}
41
+	} else {
42
+	$sql_altitude = '';
43
+}
36 44
 
37 45
 //calculuation for the pagination
38 46
 if(!isset($_GET['limit']))
@@ -49,7 +57,7 @@  discard block
 block discarded – undo
49 57
 		$limit_end = filter_input(INPUT_GET,'number_results',FILTER_SANITIZE_NUMBER_INT);
50 58
 		$absolute_difference = filter_input(INPUT_GET,'number_results',FILTER_SANITIZE_NUMBER_INT);
51 59
 	}
52
-}  else {
60
+} else {
53 61
 	$limit_explode = explode(",", $_GET['limit']);
54 62
 	$limit_start = filter_var($limit_explode[0],FILTER_SANITIZE_NUMBER_INT);
55 63
 	$limit_end = filter_var($limit_explode[1],FILTER_SANITIZE_NUMBER_INT);
@@ -67,8 +75,11 @@  discard block
 block discarded – undo
67 75
 
68 76
 header('Content-Type: text/xml');
69 77
 
70
-if (isset($_GET['sort'])) $sort = $_GET['sort'];
71
-else $sort = '';
78
+if (isset($_GET['sort'])) {
79
+	$sort = $_GET['sort'];
80
+} else {
81
+	$sort = '';
82
+}
72 83
 $q = filter_input(INPUT_GET,'q',FILTER_SANITIZE_STRING);
73 84
 $id = filter_input(INPUT_GET,'id',FILTER_SANITIZE_NUMBER_INT);
74 85
 $registration = filter_input(INPUT_GET,'registratrion',FILTER_SANITIZE_STRING);
Please login to merge, or discard this patch.
search-geojson.php 1 patch
Braces   +18 added lines, -7 removed lines patch added patch discarded remove patch
@@ -16,8 +16,12 @@  discard block
 block discarded – undo
16 16
 	} else if($_GET['start_date'] == "" && $_GET['end_date'] != ""){
17 17
 		$end_date = date("Y-m-d H:i:s", strtotime("2014-04-12")).",".date("Y-m-d",strtotime($_GET['end_date']))." 00:00:00";
18 18
 		$sql_date = $end_date;
19
-	} else $sql_date = '';
20
-} else $sql_date = '';
19
+	} else {
20
+		$sql_date = '';
21
+	}
22
+	} else {
23
+	$sql_date = '';
24
+}
21 25
 
22 26
 if (isset($_GET['highest_altitude'])) {
23 27
 	//for altitude manipulation
@@ -31,8 +35,12 @@  discard block
 block discarded – undo
31 35
 	} else if($_GET['highest_altitude'] == "" && $_GET['lowest_altitude'] != ""){
32 36
 		$start_altitude = filter_input(INPUT_GET,'lowest_altitude',FILTER_SANITIZE_NUMBER_INT).",60000";
33 37
 		$sql_altitude = $start_altitude;
34
-	} else $sql_altitude = '';
35
-} else $sql_altitude = '';
38
+	} else {
39
+		$sql_altitude = '';
40
+	}
41
+	} else {
42
+	$sql_altitude = '';
43
+}
36 44
 
37 45
 //calculuation for the pagination
38 46
 if(!isset($_GET['limit']))
@@ -50,7 +58,7 @@  discard block
 block discarded – undo
50 58
 		$limit_end = filter_input(INPUT_GET,'number_results',FILTER_SANITIZE_NUMBER_INT);
51 59
 		$absolute_difference = filter_input(INPUT_GET,'number_results',FILTER_SANITIZE_NUMBER_INT);
52 60
 	}
53
-}  else {
61
+} else {
54 62
 	$limit_explode = explode(",", $_GET['limit']);
55 63
 	$limit_start = filter_var($limit_explode[0],FILTER_SANITIZE_NUMBER_INT);
56 64
 	$limit_end = filter_var($limit_explode[1],FILTER_SANITIZE_NUMBER_INT);
@@ -68,8 +76,11 @@  discard block
 block discarded – undo
68 76
 
69 77
 header('Content-Type: application/json');
70 78
 
71
-if (isset($_GET['sort'])) $sort = $_GET['sort'];
72
-else $sort = '';
79
+if (isset($_GET['sort'])) {
80
+	$sort = $_GET['sort'];
81
+} else {
82
+	$sort = '';
83
+}
73 84
 $q = filter_input(INPUT_GET,'q',FILTER_SANITIZE_STRING);
74 85
 $id = filter_input(INPUT_GET,'id',FILTER_SANITIZE_NUMBER_INT);
75 86
 $registration = filter_input(INPUT_GET,'registratrion',FILTER_SANITIZE_STRING);
Please login to merge, or discard this patch.
search-xml.php 1 patch
Braces   +18 added lines, -7 removed lines patch added patch discarded remove patch
@@ -15,8 +15,12 @@  discard block
 block discarded – undo
15 15
 	} else if($_GET['start_date'] == "" && $_GET['end_date'] != ""){
16 16
 		$end_date = date("Y-m-d H:i:s", strtotime("2014-04-12")).",".date("Y-m-d",strtotime($_GET['end_date']))." 00:00:00";
17 17
 		$sql_date = $end_date;
18
-	} else $sql_date = '';
19
-} else $sql_date = '';
18
+	} else {
19
+		$sql_date = '';
20
+	}
21
+	} else {
22
+	$sql_date = '';
23
+}
20 24
 
21 25
 if (isset($_GET['highest_altitude'])) {
22 26
 	//for altitude manipulation
@@ -30,8 +34,12 @@  discard block
 block discarded – undo
30 34
 	} else if($_GET['highest_altitude'] == "" && $_GET['lowest_altitude'] != ""){
31 35
 		$start_altitude = filter_input(INPUT_GET,'lowest_altitude',FILTER_SANITIZE_NUMBER_INT).",60000";
32 36
 		$sql_altitude = $start_altitude;
33
-	} else $sql_altitude = '';
34
-} else $sql_altitude = '';
37
+	} else {
38
+		$sql_altitude = '';
39
+	}
40
+	} else {
41
+	$sql_altitude = '';
42
+}
35 43
 
36 44
 //calculuation for the pagination
37 45
 if(!isset($_GET['limit'])) {
@@ -47,7 +55,7 @@  discard block
 block discarded – undo
47 55
 		$limit_end = filter_input(INPUT_GET,'number_results',FILTER_SANITIZE_NUMBER_INT);
48 56
 		$absolute_difference = filter_input(INPUT_GET,'number_results',FILTER_SANITIZE_NUMBER_INT);
49 57
 	}
50
-}  else {
58
+} else {
51 59
 	$limit_explode = explode(",", $_GET['limit']);
52 60
 	$limit_start = filter_var($limit_explode[0],FILTER_SANITIZE_NUMBER_INT);
53 61
 	$limit_end = filter_var($limit_explode[1],FILTER_SANITIZE_NUMBER_INT);
@@ -65,8 +73,11 @@  discard block
 block discarded – undo
65 73
 
66 74
 header('Content-Type: application/xml');
67 75
 
68
-if (isset($_GET['sort'])) $sort = $_GET['sort'];
69
-else $sort = '';
76
+if (isset($_GET['sort'])) {
77
+	$sort = $_GET['sort'];
78
+} else {
79
+	$sort = '';
80
+}
70 81
 $q = filter_input(INPUT_GET,'q',FILTER_SANITIZE_STRING);
71 82
 $id = filter_input(INPUT_GET,'id',FILTER_SANITIZE_NUMBER_INT);
72 83
 $registration = filter_input(INPUT_GET,'registratrion',FILTER_SANITIZE_STRING);
Please login to merge, or discard this patch.
search-kml.php 1 patch
Braces   +18 added lines, -7 removed lines patch added patch discarded remove patch
@@ -16,8 +16,12 @@  discard block
 block discarded – undo
16 16
 	} else if($_GET['start_date'] == "" && $_GET['end_date'] != ""){
17 17
 		$end_date = date("Y-m-d H:i:s", strtotime("2014-04-12")).",".date("Y-m-d",strtotime($_GET['end_date']))." 00:00:00";
18 18
 		$sql_date = $end_date;
19
-	} else $sql_date = '';
20
-} else $sql_date = '';
19
+	} else {
20
+		$sql_date = '';
21
+	}
22
+	} else {
23
+	$sql_date = '';
24
+}
21 25
 
22 26
 if (isset($_GET['highest_altitude'])) {
23 27
 	//for altitude manipulation
@@ -31,8 +35,12 @@  discard block
 block discarded – undo
31 35
 	} else if($_GET['highest_altitude'] == "" && $_GET['lowest_altitude'] != ""){
32 36
 		$start_altitude = filter_input(INPUT_GET,'lowest_altitude',FILTER_SANITIZE_NUMBER_INT).",60000";
33 37
 		$sql_altitude = $start_altitude;
34
-	} else $sql_altitude = '';
35
-} else $sql_altitude = '';
38
+	} else {
39
+		$sql_altitude = '';
40
+	}
41
+	} else {
42
+	$sql_altitude = '';
43
+}
36 44
 
37 45
 //calculuation for the pagination
38 46
 if(!isset($_GET['limit']))
@@ -49,7 +57,7 @@  discard block
 block discarded – undo
49 57
 		$limit_end = filter_input(INPUT_GET,'number_results',FILTER_SANITIZE_NUMBER_INT);
50 58
 		$absolute_difference = filter_input(INPUT_GET,'number_results',FILTER_SANITIZE_NUMBER_INT);
51 59
 	}
52
-}  else {
60
+} else {
53 61
 	$limit_explode = explode(",", $_GET['limit']);
54 62
 	$limit_start = filter_var($limit_explode[0],FILTER_SANITIZE_NUMBER_INT);
55 63
 	$limit_end = filter_var($limit_explode[1],FILTER_SANITIZE_NUMBER_INT);
@@ -67,8 +75,11 @@  discard block
 block discarded – undo
67 75
 
68 76
 header('Content-Type: text/xml');
69 77
 
70
-if (isset($_GET['sort'])) $sort = $_GET['sort'];
71
-else $sort = '';
78
+if (isset($_GET['sort'])) {
79
+	$sort = $_GET['sort'];
80
+} else {
81
+	$sort = '';
82
+}
72 83
 $q = filter_input(INPUT_GET,'q',FILTER_SANITIZE_STRING);
73 84
 $id = filter_input(INPUT_GET,'id',FILTER_SANITIZE_STRING);
74 85
 $registration = filter_input(INPUT_GET,'registratrion',FILTER_SANITIZE_STRING);
Please login to merge, or discard this patch.