Completed
Push — master ( e14a40...cfb98e )
by Yannick
54:46 queued 27:34
created
owner-detailed.php 1 patch
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -7,14 +7,14 @@  discard block
 block discarded – undo
7 7
 //require_once('require/class.SpotterLive.php');
8 8
 require_once('require/class.SpotterArchive.php');
9 9
 
10
-if (!isset($_GET['owner'])){
10
+if (!isset($_GET['owner'])) {
11 11
 	header('Location: '.$globalURL.'');
12 12
 } else {
13 13
 	$Spotter = new Spotter();
14 14
 	$SpotterArchive = new SpotterArchive();
15 15
 	//$Translation = new Translation();
16 16
 	//calculuation for the pagination
17
-	if(!isset($_GET['limit']))
17
+	if (!isset($_GET['limit']))
18 18
 	{
19 19
 		$limit_start = 0;
20 20
 		$limit_end = 25;
@@ -22,8 +22,8 @@  discard block
 block discarded – undo
22 22
 	} else {
23 23
 		$limit_explode = explode(",", $_GET['limit']);
24 24
 		if (isset($limit_explode[1])) {
25
-			$limit_start = filter_var($limit_explode[0],FILTER_SANITIZE_NUMBER_INT);
26
-			$limit_end = filter_var($limit_explode[1],FILTER_SANITIZE_NUMBER_INT);
25
+			$limit_start = filter_var($limit_explode[0], FILTER_SANITIZE_NUMBER_INT);
26
+			$limit_end = filter_var($limit_explode[1], FILTER_SANITIZE_NUMBER_INT);
27 27
 		} else {
28 28
 			$limit_start = 0;
29 29
 			$limit_end = 25;
@@ -40,29 +40,29 @@  discard block
 block discarded – undo
40 40
 	
41 41
 	$page_url = $globalURL.'/owner/'.$_GET['owner'];
42 42
 	
43
-	$owner = urldecode(filter_input(INPUT_GET,'owner',FILTER_SANITIZE_STRING));
44
-	$sort = filter_input(INPUT_GET,'sort',FILTER_SANITIZE_STRING);
45
-	$year = filter_input(INPUT_GET,'year',FILTER_SANITIZE_NUMBER_INT);
46
-	$month = filter_input(INPUT_GET,'month',FILTER_SANITIZE_NUMBER_INT);
43
+	$owner = urldecode(filter_input(INPUT_GET, 'owner', FILTER_SANITIZE_STRING));
44
+	$sort = filter_input(INPUT_GET, 'sort', FILTER_SANITIZE_STRING);
45
+	$year = filter_input(INPUT_GET, 'year', FILTER_SANITIZE_NUMBER_INT);
46
+	$month = filter_input(INPUT_GET, 'month', FILTER_SANITIZE_NUMBER_INT);
47 47
 	$filter = array();
48
-	if ($year != '') $filter = array_merge($filter,array('year' => $year));
49
-	if ($month != '') $filter = array_merge($filter,array('month' => $month));
48
+	if ($year != '') $filter = array_merge($filter, array('year' => $year));
49
+	if ($month != '') $filter = array_merge($filter, array('month' => $month));
50 50
 	if ($sort != '') 
51 51
 	{
52
-		$spotter_array = $Spotter->getSpotterDataByOwner($owner,$limit_start.",".$absolute_difference, $sort,$filter);
52
+		$spotter_array = $Spotter->getSpotterDataByOwner($owner, $limit_start.",".$absolute_difference, $sort, $filter);
53 53
 		if (empty($spotter_array) && isset($globalArchiveResults) && $globalArchiveResults) {
54
-			$spotter_array = $SpotterArchive->getSpotterDataByOwner($owner,$limit_start.",".$absolute_difference, $sort,$filter);
54
+			$spotter_array = $SpotterArchive->getSpotterDataByOwner($owner, $limit_start.",".$absolute_difference, $sort, $filter);
55 55
 		}
56 56
 	} else {
57
-		$spotter_array = $Spotter->getSpotterDataByOwner($owner,$limit_start.",".$absolute_difference,'',$filter);
57
+		$spotter_array = $Spotter->getSpotterDataByOwner($owner, $limit_start.",".$absolute_difference, '', $filter);
58 58
 		if (empty($spotter_array) && isset($globalArchiveResults) && $globalArchiveResults) {
59
-			$spotter_array = $SpotterArchive->getSpotterDataByOwner($owner,$limit_start.",".$absolute_difference,'',$filter);
59
+			$spotter_array = $SpotterArchive->getSpotterDataByOwner($owner, $limit_start.",".$absolute_difference, '', $filter);
60 60
 		}
61 61
 	}
62 62
 
63 63
 	if (!empty($spotter_array))
64 64
 	{
65
-		$title = sprintf(_("Detailed View for %s"),$spotter_array[0]['aircraft_owner']);
65
+		$title = sprintf(_("Detailed View for %s"), $spotter_array[0]['aircraft_owner']);
66 66
 		//$ident = $spotter_array[0]['ident'];
67 67
 		if (isset($spotter_array[0]['latitude'])) $latitude = $spotter_array[0]['latitude'];
68 68
 		if (isset($spotter_array[0]['longitude'])) $longitude = $spotter_array[0]['longitude'];
@@ -122,23 +122,23 @@  discard block
 block discarded – undo
122 122
 		$Stats = new Stats();
123 123
 		if ($year == '' && $month == '') $flights = $Stats->getStatsOwner($owner);
124 124
 		else $flights = 0;
125
-		if ($flights == 0) $flights = $Spotter->countFlightsByOwner($owner,$filter);
125
+		if ($flights == 0) $flights = $Spotter->countFlightsByOwner($owner, $filter);
126 126
 		print '<div><span class="label">'._("Flights").'</span>'.$flights.'</div>';
127
-		$aircraft_type = count($Spotter->countAllAircraftTypesByOwner($owner,$filter));
127
+		$aircraft_type = count($Spotter->countAllAircraftTypesByOwner($owner, $filter));
128 128
 		print '<div><span class="label">'._("Aircrafts type").'</span>'.$aircraft_type.'</div>';
129
-		$aircraft_registration = count($Spotter->countAllAircraftRegistrationByOwner($owner,$filter));
129
+		$aircraft_registration = count($Spotter->countAllAircraftRegistrationByOwner($owner, $filter));
130 130
 		print '<div><span class="label">'._("Aircrafts").'</span>'.$aircraft_registration.'</div>';
131
-		$aircraft_manufacturer = count($Spotter->countAllAircraftManufacturerByOwner($owner,$filter));
131
+		$aircraft_manufacturer = count($Spotter->countAllAircraftManufacturerByOwner($owner, $filter));
132 132
 		print '<div><span class="label">'._("Manufacturers").'</span>'.$aircraft_manufacturer.'</div>';
133
-		$airlines = count($Spotter->countAllAirlinesByOwner($owner,$filter));
133
+		$airlines = count($Spotter->countAllAirlinesByOwner($owner, $filter));
134 134
 		print '<div><span class="label">'._("Airlines").'</span>'.$airlines.'</div>';
135
-		$duration = $Spotter->getFlightDurationByOwner($owner,$filter);
135
+		$duration = $Spotter->getFlightDurationByOwner($owner, $filter);
136 136
 		if ($duration != '0') print '<div><span class="label">'._("Total flights spotted duration").'</span>'.$duration.'</div>';
137 137
 		print '</div>';
138 138
 	
139 139
 		include('owner-sub-menu.php');
140 140
 		print '<div class="table column">';
141
-		print '<p>'.sprintf(_("The table below shows the detailed information of all flights with the owner <strong>%s</strong>."),$spotter_array[0]['aircraft_owner']).'</p>';
141
+		print '<p>'.sprintf(_("The table below shows the detailed information of all flights with the owner <strong>%s</strong>."), $spotter_array[0]['aircraft_owner']).'</p>';
142 142
 
143 143
 		include('table-output.php'); 
144 144
 		print '<div class="pagination">';
Please login to merge, or discard this patch.
country-detailed.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -3,17 +3,17 @@  discard block
 block discarded – undo
3 3
 require_once('require/class.Spotter.php');
4 4
 require_once('require/class.Language.php');
5 5
 
6
-if (!isset($_GET['country'])){
6
+if (!isset($_GET['country'])) {
7 7
 	header('Location: '.$globalURL.'');
8 8
 } else {
9 9
 	$Spotter = new Spotter();
10 10
 	//calculuation for the pagination
11
-	if(!isset($_GET['limit']))
11
+	if (!isset($_GET['limit']))
12 12
 	{
13 13
 		$limit_start = 0;
14 14
 		$limit_end = 25;
15 15
 		$absolute_difference = 25;
16
-	}  else {
16
+	} else {
17 17
 		$limit_explode = explode(",", $_GET['limit']);
18 18
 		if (isset($limit_explode[1])) {
19 19
 			$limit_start = $limit_explode[0];
@@ -32,10 +32,10 @@  discard block
 block discarded – undo
32 32
 	$limit_previous_1 = $limit_start - $absolute_difference;
33 33
 	$limit_previous_2 = $limit_end - $absolute_difference;
34 34
 	
35
-	$country = ucwords(str_replace("-", " ", urldecode(filter_input(INPUT_GET,'country',FILTER_SANITIZE_STRING))));
35
+	$country = ucwords(str_replace("-", " ", urldecode(filter_input(INPUT_GET, 'country', FILTER_SANITIZE_STRING))));
36 36
 	
37 37
 	$page_url = $globalURL.'/country/'.$_GET['country'];
38
-	$sort = filter_input(INPUT_GET,'sort',FILTER_SANITIZE_STRING);
38
+	$sort = filter_input(INPUT_GET, 'sort', FILTER_SANITIZE_STRING);
39 39
 	if ($country == 'Na') {
40 40
 		$spotter_array = array();
41 41
 	} else {
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
 
49 49
 	if (!empty($spotter_array))
50 50
 	{
51
-		$title = sprintf(_("Detailed View for Airports &amp; Airlines from %s"),$country);
51
+		$title = sprintf(_("Detailed View for Airports &amp; Airlines from %s"), $country);
52 52
 
53 53
 		require_once('header.php');
54 54
 		print '<div class="select-item">';
@@ -56,9 +56,9 @@  discard block
 block discarded – undo
56 56
 		print '<select name="country" class="selectpicker" data-live-search="true">';
57 57
 		print '<option></option>';
58 58
 		$all_countries = $Spotter->getAllCountries();
59
-		foreach($all_countries as $all_country)
59
+		foreach ($all_countries as $all_country)
60 60
 		{
61
-			if($country == $all_country['country'])
61
+			if ($country == $all_country['country'])
62 62
 			{
63 63
 				print '<option value="'.strtolower(str_replace(" ", "-", $all_country['country'])).'" selected="selected">'.$all_country['country'].'</option>';
64 64
 			} else {
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
 		if ($_GET['country'] != "NA")
74 74
 		{
75 75
 			print '<div class="info column">';
76
-			print '<h1>'.sprintf(_("Airports &amp; Airlines from %s"),$country).'</h1>';
76
+			print '<h1>'.sprintf(_("Airports &amp; Airlines from %s"), $country).'</h1>';
77 77
 			print '</div>';
78 78
 		} else {
79 79
 			print '<div class="alert alert-warning">'._("This special country profile shows all flights that do <u>not</u> have a country of a airline or departure/arrival airport associated with them.").'</div>';
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
 
82 82
 		include('country-sub-menu.php');
83 83
 		print '<div class="table column">';
84
-		print '<p>'.sprintf(_("The table below shows the detailed information of all flights of airports (both departure &amp; arrival) OR airlines from <strong>%s</strong>."),$country).'</p>';
84
+		print '<p>'.sprintf(_("The table below shows the detailed information of all flights of airports (both departure &amp; arrival) OR airlines from <strong>%s</strong>."), $country).'</p>';
85 85
 
86 86
 		include('table-output.php');
87 87
 		print '<div class="pagination">';
Please login to merge, or discard this patch.
search-kml.php 1 patch
Spacing   +39 added lines, -39 removed lines patch added patch discarded remove patch
@@ -5,14 +5,14 @@  discard block
 block discarded – undo
5 5
 $Spotter = new Spotter();
6 6
 if (isset($_GET['start_date'])) {
7 7
 	//for the date manipulation into the query
8
-	if($_GET['start_date'] != "" && $_GET['end_date'] != ""){
8
+	if ($_GET['start_date'] != "" && $_GET['end_date'] != "") {
9 9
 		$start_date = $_GET['start_date'].":00";
10 10
 		$end_date = $_GET['end_date'].":00";
11 11
 		$sql_date = $start_date.",".$end_date;
12
-	} else if($_GET['start_date'] != ""){
12
+	} else if ($_GET['start_date'] != "") {
13 13
 		$start_date = $_GET['start_date'].":00";
14 14
 		$sql_date = $start_date;
15
-	} else if($_GET['start_date'] == "" && $_GET['end_date'] != ""){
15
+	} else if ($_GET['start_date'] == "" && $_GET['end_date'] != "") {
16 16
 		$end_date = date("Y-m-d H:i:s", strtotime("2014-04-12")).",".$_GET['end_date'].":00";
17 17
 		$sql_date = $end_date;
18 18
 	} else $sql_date = '';
@@ -20,38 +20,38 @@  discard block
 block discarded – undo
20 20
 
21 21
 if (isset($_GET['highest_altitude'])) {
22 22
 	//for altitude manipulation
23
-	if($_GET['highest_altitude'] != "" && $_GET['lowest_altitude'] != ""){
24
-		$end_altitude = filter_input(INPUT_GET,'highest_altitude',FILTER_SANITIZE_NUMBER_INT);
25
-		$start_altitude = filter_input(INPUT_GET,'lowest_altitude',FILTER_SANITIZE_NUMBER_INT);
23
+	if ($_GET['highest_altitude'] != "" && $_GET['lowest_altitude'] != "") {
24
+		$end_altitude = filter_input(INPUT_GET, 'highest_altitude', FILTER_SANITIZE_NUMBER_INT);
25
+		$start_altitude = filter_input(INPUT_GET, 'lowest_altitude', FILTER_SANITIZE_NUMBER_INT);
26 26
 		$sql_altitude = $start_altitude.",".$end_altitude;
27
-	} else if($_GET['highest_altitude'] != ""){
28
-		$end_altitude = filter_input(INPUT_GET,'highest_altitude',FILTER_SANITIZE_NUMBER_INT);
27
+	} else if ($_GET['highest_altitude'] != "") {
28
+		$end_altitude = filter_input(INPUT_GET, 'highest_altitude', FILTER_SANITIZE_NUMBER_INT);
29 29
 		$sql_altitude = $end_altitude;
30
-	} else if($_GET['highest_altitude'] == "" && $_GET['lowest_altitude'] != ""){
31
-		$start_altitude = filter_input(INPUT_GET,'lowest_altitude',FILTER_SANITIZE_NUMBER_INT).",60000";
30
+	} else if ($_GET['highest_altitude'] == "" && $_GET['lowest_altitude'] != "") {
31
+		$start_altitude = filter_input(INPUT_GET, 'lowest_altitude', FILTER_SANITIZE_NUMBER_INT).",60000";
32 32
 		$sql_altitude = $start_altitude;
33 33
 	} else $sql_altitude = '';
34 34
 } else $sql_altitude = '';
35 35
 
36 36
 //calculuation for the pagination
37
-if(!isset($_GET['limit']))
37
+if (!isset($_GET['limit']))
38 38
 {
39 39
 	if (!isset($_GET['number_results'])) {
40 40
 		$limit_start = 0;
41 41
 		$limit_end = 25;
42 42
 		$absolute_difference = 25;
43 43
 	} else {
44
-		if ($_GET['number_results'] > 1000){
44
+		if ($_GET['number_results'] > 1000) {
45 45
 			$_GET['number_results'] = 1000;
46 46
 		}
47 47
 		$limit_start = 0;
48
-		$limit_end = filter_input(INPUT_GET,'number_results',FILTER_SANITIZE_NUMBER_INT);
49
-		$absolute_difference = filter_input(INPUT_GET,'number_results',FILTER_SANITIZE_NUMBER_INT);
48
+		$limit_end = filter_input(INPUT_GET, 'number_results', FILTER_SANITIZE_NUMBER_INT);
49
+		$absolute_difference = filter_input(INPUT_GET, 'number_results', FILTER_SANITIZE_NUMBER_INT);
50 50
 	}
51
-}  else {
51
+} else {
52 52
 	$limit_explode = explode(",", $_GET['limit']);
53
-	$limit_start = filter_var($limit_explode[0],FILTER_SANITIZE_NUMBER_INT);
54
-	$limit_end = filter_var($limit_explode[1],FILTER_SANITIZE_NUMBER_INT);
53
+	$limit_start = filter_var($limit_explode[0], FILTER_SANITIZE_NUMBER_INT);
54
+	$limit_end = filter_var($limit_explode[1], FILTER_SANITIZE_NUMBER_INT);
55 55
 }
56 56
 
57 57
 $absolute_difference = abs($limit_start - $limit_end);
@@ -68,23 +68,23 @@  discard block
 block discarded – undo
68 68
 
69 69
 if (isset($_GET['sort'])) $sort = $_GET['sort'];
70 70
 else $sort = '';
71
-$q = filter_input(INPUT_GET,'q',FILTER_SANITIZE_STRING);
72
-$registration = filter_input(INPUT_GET,'registratrion',FILTER_SANITIZE_STRING);
73
-$aircraft = filter_input(INPUT_GET,'aircraft',FILTER_SANITIZE_STRING);
74
-$manufacturer = filter_input(INPUT_GET,'manufacturer',FILTER_SANITIZE_STRING);
75
-$highlights = filter_input(INPUT_GET,'highlights',FILTER_SANITIZE_STRING);
76
-$airline = filter_input(INPUT_GET,'airline',FILTER_SANITIZE_STRING);
77
-$airline_country = filter_input(INPUT_GET,'airline_country',FILTER_SANITIZE_STRING);
78
-$airline_type = filter_input(INPUT_GET,'airline_type',FILTER_SANITIZE_STRING);
79
-$airport = filter_input(INPUT_GET,'airport',FILTER_SANITIZE_STRING);
80
-$airport_country = filter_input(INPUT_GET,'airport_country',FILTER_SANITIZE_STRING);
81
-$callsign = filter_input(INPUT_GET,'callsign',FILTER_SANITIZE_STRING);
82
-$owner = filter_input(INPUT_GET,'owner',FILTER_SANITIZE_STRING);
83
-$pilot_id = filter_input(INPUT_GET,'pilot_id',FILTER_SANITIZE_STRING);
84
-$pilot_name = filter_input(INPUT_GET,'pilot_name',FILTER_SANITIZE_STRING);
85
-$departure_airport_route = filter_input(INPUT_GET,'departure_airport_route',FILTER_SANITIZE_STRING);
86
-$arrival_airport_route = filter_input(INPUT_GET,'arrival_airport_route',FILTER_SANITIZE_STRING);
87
-$spotter_array = $Spotter->searchSpotterData($q,$registration,$aircraft,strtolower(str_replace("-", " ", $manufacturer)),$highlights,$airline,$airline_country,$airline_type,$airport,$airport_country,$callsign,$departure_airport_route,$arrival_airport_route,$owner,$pilot_id,$pilot_name,$sql_altitude,$sql_date,$limit_start.",".$absolute_difference,$sort,'');
71
+$q = filter_input(INPUT_GET, 'q', FILTER_SANITIZE_STRING);
72
+$registration = filter_input(INPUT_GET, 'registratrion', FILTER_SANITIZE_STRING);
73
+$aircraft = filter_input(INPUT_GET, 'aircraft', FILTER_SANITIZE_STRING);
74
+$manufacturer = filter_input(INPUT_GET, 'manufacturer', FILTER_SANITIZE_STRING);
75
+$highlights = filter_input(INPUT_GET, 'highlights', FILTER_SANITIZE_STRING);
76
+$airline = filter_input(INPUT_GET, 'airline', FILTER_SANITIZE_STRING);
77
+$airline_country = filter_input(INPUT_GET, 'airline_country', FILTER_SANITIZE_STRING);
78
+$airline_type = filter_input(INPUT_GET, 'airline_type', FILTER_SANITIZE_STRING);
79
+$airport = filter_input(INPUT_GET, 'airport', FILTER_SANITIZE_STRING);
80
+$airport_country = filter_input(INPUT_GET, 'airport_country', FILTER_SANITIZE_STRING);
81
+$callsign = filter_input(INPUT_GET, 'callsign', FILTER_SANITIZE_STRING);
82
+$owner = filter_input(INPUT_GET, 'owner', FILTER_SANITIZE_STRING);
83
+$pilot_id = filter_input(INPUT_GET, 'pilot_id', FILTER_SANITIZE_STRING);
84
+$pilot_name = filter_input(INPUT_GET, 'pilot_name', FILTER_SANITIZE_STRING);
85
+$departure_airport_route = filter_input(INPUT_GET, 'departure_airport_route', FILTER_SANITIZE_STRING);
86
+$arrival_airport_route = filter_input(INPUT_GET, 'arrival_airport_route', FILTER_SANITIZE_STRING);
87
+$spotter_array = $Spotter->searchSpotterData($q, $registration, $aircraft, strtolower(str_replace("-", " ", $manufacturer)), $highlights, $airline, $airline_country, $airline_type, $airport, $airport_country, $callsign, $departure_airport_route, $arrival_airport_route, $owner, $pilot_id, $pilot_name, $sql_altitude, $sql_date, $limit_start.",".$absolute_difference, $sort, '');
88 88
 
89 89
 $output = '<?xml version="1.0" encoding="UTF-8"?>';
90 90
 $output .= '<kml xmlns="http://www.opengis.net/kml/2.2">';
@@ -112,7 +112,7 @@  discard block
 block discarded – undo
112 112
 $output .= '</Style>';
113 113
 
114 114
 if (!empty($spotter_array)) {
115
-	foreach($spotter_array as $spotter_item) {
115
+	foreach ($spotter_array as $spotter_item) {
116 116
 		$altitude = $spotter_item['altitude'].'00';
117 117
 		if ($spotter_item['waypoints'] != '') {
118 118
 			//waypoint plotting
@@ -123,7 +123,7 @@  discard block
 block discarded – undo
123 123
 			$waypoint_pieces = explode(' ', $spotter_item['waypoints']);
124 124
 			$waypoint_pieces = array_chunk($waypoint_pieces, 2);
125 125
 			foreach ($waypoint_pieces as $waypoint_coordinate) {
126
-				if (isset($waypoint_coordinate[1])) $output .=  $waypoint_coordinate[1].','.$waypoint_coordinate[0].','.$altitude.' ';
126
+				if (isset($waypoint_coordinate[1])) $output .= $waypoint_coordinate[1].','.$waypoint_coordinate[0].','.$altitude.' ';
127 127
 			}
128 128
 			$output .= '</coordinates>';
129 129
 			$output .= '<altitudeMode>absolute</altitudeMode>';
@@ -167,7 +167,7 @@  discard block
 block discarded – undo
167 167
 		$output .= ' ]]></description>';
168 168
 		$output .= '<styleUrl>#departureAirport</styleUrl>';
169 169
 		$output .= '<Point>';
170
-		$output .=  '<coordinates>'.$spotter_item['departure_airport_longitude'].', '.$spotter_item['departure_airport_latitude'].', '.$spotter_item['departure_airport_altitude'].'</coordinates>';
170
+		$output .= '<coordinates>'.$spotter_item['departure_airport_longitude'].', '.$spotter_item['departure_airport_latitude'].', '.$spotter_item['departure_airport_altitude'].'</coordinates>';
171 171
 		$output .= '<altitudeMode>absolute</altitudeMode>';
172 172
 		$output .= '</Point>';
173 173
 		$output .= '</Placemark>'; 
@@ -208,7 +208,7 @@  discard block
 block discarded – undo
208 208
 		$output .= ' ]]></description>';
209 209
 		$output .= '<styleUrl>#arrivalAirport</styleUrl>';
210 210
 		$output .= '<Point>';
211
-		$output .=  '<coordinates>'.$spotter_item['arrival_airport_longitude'].', '.$spotter_item['arrival_airport_latitude'].', '.$spotter_item['arrival_airport_altitude'].'</coordinates>';
211
+		$output .= '<coordinates>'.$spotter_item['arrival_airport_longitude'].', '.$spotter_item['arrival_airport_latitude'].', '.$spotter_item['arrival_airport_altitude'].'</coordinates>';
212 212
 		$output .= '<altitudeMode>absolute</altitudeMode>';
213 213
 		$output .= '</Point>';
214 214
 		$output .= '</Placemark>'; 
@@ -252,7 +252,7 @@  discard block
 block discarded – undo
252 252
 		$output .= ' ]]></description>';
253 253
 		$output .= '<styleUrl>#aircraft_'.$spotter_item['spotter_id'].'</styleUrl>';
254 254
 		$output .= '<Point>';
255
-		$output .=  '<coordinates>'.$spotter_item['longitude'].', '.$spotter_item['latitude'].', '.$altitude.'</coordinates>';
255
+		$output .= '<coordinates>'.$spotter_item['longitude'].', '.$spotter_item['latitude'].', '.$altitude.'</coordinates>';
256 256
 		$output .= '<altitudeMode>absolute</altitudeMode>';
257 257
 		$output .= '</Point>';
258 258
 		$output .= '</Placemark>'; 
Please login to merge, or discard this patch.
pilot-statistics-route.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -7,18 +7,18 @@  discard block
 block discarded – undo
7 7
         die();
8 8
 }
9 9
 $Spotter = new Spotter();
10
-$sort = filter_input(INPUT_GET,'sort',FILTER_SANITIZE_STRING);
11
-$pilot = filter_input(INPUT_GET,'pilot',FILTER_SANITIZE_STRING);
12
-$year = filter_input(INPUT_GET,'year',FILTER_SANITIZE_NUMBER_INT);
13
-$month = filter_input(INPUT_GET,'month',FILTER_SANITIZE_NUMBER_INT);
10
+$sort = filter_input(INPUT_GET, 'sort', FILTER_SANITIZE_STRING);
11
+$pilot = filter_input(INPUT_GET, 'pilot', FILTER_SANITIZE_STRING);
12
+$year = filter_input(INPUT_GET, 'year', FILTER_SANITIZE_NUMBER_INT);
13
+$month = filter_input(INPUT_GET, 'month', FILTER_SANITIZE_NUMBER_INT);
14 14
 $filter = array();
15
-if ($year != '') $filter = array_merge($filter,array('year' => $year));
16
-if ($month != '') $filter = array_merge($filter,array('month' => $month));
17
-$spotter_array = $Spotter->getSpotterDataByPilot($pilot,"0,1", $sort,$filter);
15
+if ($year != '') $filter = array_merge($filter, array('year' => $year));
16
+if ($month != '') $filter = array_merge($filter, array('month' => $month));
17
+$spotter_array = $Spotter->getSpotterDataByPilot($pilot, "0,1", $sort, $filter);
18 18
 
19 19
 if (!empty($spotter_array))
20 20
 {
21
-	$title = sprintf(_("Most Common Routes of %s"),$spotter_array[0]['pilot_name']);
21
+	$title = sprintf(_("Most Common Routes of %s"), $spotter_array[0]['pilot_name']);
22 22
 	require_once('header.php');
23 23
 	print '<div class="info column">';
24 24
 	print '<h1>'.$spotter_array[0]['pilot_name'].'</h1>';
@@ -29,9 +29,9 @@  discard block
 block discarded – undo
29 29
 	include('pilot-sub-menu.php');
30 30
 	print '<div class="column">';
31 31
 	print '<h2>'._("Most Common Routes").'</h2>';
32
-	print '<p>'.sprintf(_("The statistic below shows the most common routes from flights piloted by <strong>%s</strong>."),$spotter_array[0]['pilot_name']).'</p>';
32
+	print '<p>'.sprintf(_("The statistic below shows the most common routes from flights piloted by <strong>%s</strong>."), $spotter_array[0]['pilot_name']).'</p>';
33 33
 
34
-	$route_array = $Spotter->countAllRoutesByPilot($pilot,$filter);
34
+	$route_array = $Spotter->countAllRoutesByPilot($pilot, $filter);
35 35
 	if (!empty($route_array))
36 36
 	{
37 37
 		print '<div class="table-responsive">';
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
 		print '</thead>';
47 47
 		print '<tbody>';
48 48
 		$i = 1;
49
-		foreach($route_array as $route_item)
49
+		foreach ($route_array as $route_item)
50 50
 		{
51 51
 			print '<tr>';
52 52
 			print '<td><strong>'.$i.'</strong></td>';
Please login to merge, or discard this patch.
flightid-overview.php 1 patch
Spacing   +32 added lines, -32 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-$id = filter_input(INPUT_GET,'id',FILTER_SANITIZE_STRING);
2
+$id = filter_input(INPUT_GET, 'id', FILTER_SANITIZE_STRING);
3 3
 if ($id == "")
4 4
 {
5 5
 	header('Location: /');
@@ -16,30 +16,30 @@  discard block
 block discarded – undo
16 16
 
17 17
 if (!empty($spotter_array))
18 18
 {
19
-	if(isset($spotter_array[0]['flightaware_id'])) {
19
+	if (isset($spotter_array[0]['flightaware_id'])) {
20 20
 		$flightaware_id = $spotter_array[0]['flightaware_id'];
21 21
 	}
22
-	if(isset($spotter_array[0]['last_latitude']) && $spotter_array[0]['last_latitude'] != '') {
22
+	if (isset($spotter_array[0]['last_latitude']) && $spotter_array[0]['last_latitude'] != '') {
23 23
 		$latitude = $spotter_array[0]['last_latitude'];
24
-	} elseif(isset($spotter_array[0]['latitude'])) {
24
+	} elseif (isset($spotter_array[0]['latitude'])) {
25 25
 		$latitude = $spotter_array[0]['latitude'];
26 26
 	}
27
-	if(isset($spotter_array[0]['last_longitude']) && $spotter_array[0]['last_longitude'] != '') {
27
+	if (isset($spotter_array[0]['last_longitude']) && $spotter_array[0]['last_longitude'] != '') {
28 28
 		$longitude = $spotter_array[0]['last_longitude'];
29
-	} elseif(isset($spotter_array[0]['longitude'])) {
29
+	} elseif (isset($spotter_array[0]['longitude'])) {
30 30
 		$longitude = $spotter_array[0]['longitude'];
31 31
 	}
32 32
 	$title = '';
33
-	if(isset($spotter_array[0]['ident'])) {
33
+	if (isset($spotter_array[0]['ident'])) {
34 34
 		$title .= $spotter_array[0]['ident'];
35 35
 	}
36
-	if(isset($spotter_array[0]['airline_name'])) {
36
+	if (isset($spotter_array[0]['airline_name'])) {
37 37
 		$title .= ' - '.$spotter_array[0]['airline_name'];
38 38
 	}
39
-	if(isset($spotter_array[0]['aircraft_name']) && $spotter_array[0]['aircraft_name'] != 'Not Available') {
39
+	if (isset($spotter_array[0]['aircraft_name']) && $spotter_array[0]['aircraft_name'] != 'Not Available') {
40 40
 		$title .= ' - '.$spotter_array[0]['aircraft_name'].' ('.$spotter_array[0]['aircraft_type'].')';
41 41
 	}
42
-	if(isset($spotter_array[0]['registration']) && $spotter_array[0]['registration'] != 'NA' && $spotter_array[0]['registration'] != 'N/A') {
42
+	if (isset($spotter_array[0]['registration']) && $spotter_array[0]['registration'] != 'NA' && $spotter_array[0]['registration'] != 'N/A') {
43 43
 		$title .= ' - '.$spotter_array[0]['registration'];
44 44
 	}
45 45
 	//$facebook_meta_image = $spotter_array[0]['image'];
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
 			$altitude_data = '';
60 60
 			$hour_data = '';
61 61
 			$speed_data = '';
62
-			foreach($all_data as $data)
62
+			foreach ($all_data as $data)
63 63
 			{
64 64
 				$hour_data .= '"'.$data['date'].'",';
65 65
 				if (isset($data['real_altitude']) && $data['real_altitude'] != '') {
@@ -87,8 +87,8 @@  discard block
 block discarded – undo
87 87
 				$speed_data .= $speed.',';
88 88
 			}
89 89
 			$hour_data = "['x',".substr($hour_data, 0, -1)."]";
90
-			$altitude_data = "['altitude',".substr($altitude_data,0,-1)."]";
91
-			$speed_data = "['speed',".substr($speed_data,0,-1)."]";
90
+			$altitude_data = "['altitude',".substr($altitude_data, 0, -1)."]";
91
+			$speed_data = "['speed',".substr($speed_data, 0, -1)."]";
92 92
 			print 'c3.generate({
93 93
 			    bindto: "#chart",
94 94
 			    data: {
@@ -134,16 +134,16 @@  discard block
 block discarded – undo
134 134
 			print '<a href="'.$globalURL.'/airline/'.$spotter_array[0]['airline_icao'].'">'.$spotter_array[0]['airline_name'].'</a> ';
135 135
 		}
136 136
 	}
137
-	if(isset($spotter_array[0]['ident'])) {
137
+	if (isset($spotter_array[0]['ident'])) {
138 138
 		print $spotter_array[0]['ident'];
139 139
 	}
140
-	if(isset($spotter_array[0]['airline_name'])) {
140
+	if (isset($spotter_array[0]['airline_name'])) {
141 141
 		print ' - '.$spotter_array[0]['airline_name'];
142 142
 	}
143
-	if(isset($spotter_array[0]['aircraft_name']) && $spotter_array[0]['aircraft_name'] != 'Not Available') {
143
+	if (isset($spotter_array[0]['aircraft_name']) && $spotter_array[0]['aircraft_name'] != 'Not Available') {
144 144
 		print ' - '.$spotter_array[0]['aircraft_name'].' ('.$spotter_array[0]['aircraft_type'].')';
145 145
 	}
146
-	if(isset($spotter_array[0]['registration']) && $spotter_array[0]['registration'] != 'NA') {
146
+	if (isset($spotter_array[0]['registration']) && $spotter_array[0]['registration'] != 'NA') {
147 147
 		print ' - '.$spotter_array[0]['registration'];
148 148
 	}
149 149
 	print '</h1>';
@@ -297,7 +297,7 @@  discard block
 block discarded – undo
297 297
 	 print '</div>';
298 298
 */
299 299
 
300
-	foreach($spotter_array as $spotter_item)
300
+	foreach ($spotter_array as $spotter_item)
301 301
 	{
302 302
 		print '<div class="details">';
303 303
 		print '<h3>'._("Flight Information").'</h3>';
@@ -397,7 +397,7 @@  discard block
 block discarded – undo
397 397
 			if (isset($spotter_item['departure_airport_time']) && $spotter_item['departure_airport_time'] != '') {
398 398
 				if ($spotter_item['departure_airport_time'] > 2460) {
399 399
 					print '<div class="time">';
400
-					print 'at '.date('H:m',$spotter_item['departure_airport_time']);
400
+					print 'at '.date('H:m', $spotter_item['departure_airport_time']);
401 401
 					print '</div>';
402 402
 				} else {
403 403
 					print '<div class="time">';
@@ -547,19 +547,19 @@  discard block
 block discarded – undo
547 547
 			if (count($departure_airport_info) > 0) {
548 548
 				if (isset($spotter_item['last_latitude']) && $spotter_item['last_latitude'] != '') {
549 549
 					if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'nm') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'nm')) {
550
-						print $Common->distance($spotter_item['last_latitude'],$spotter_item['last_longitude'],$departure_airport_info[0]['latitude'],$departure_airport_info[0]['longitude'],'nm').' nm';
550
+						print $Common->distance($spotter_item['last_latitude'], $spotter_item['last_longitude'], $departure_airport_info[0]['latitude'], $departure_airport_info[0]['longitude'], 'nm').' nm';
551 551
 					} elseif ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'mi') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'mi')) {
552
-						print $Common->distance($spotter_item['last_latitude'],$spotter_item['last_longitude'],$departure_airport_info[0]['latitude'],$departure_airport_info[0]['longitude'],'mi').' mi';
552
+						print $Common->distance($spotter_item['last_latitude'], $spotter_item['last_longitude'], $departure_airport_info[0]['latitude'], $departure_airport_info[0]['longitude'], 'mi').' mi';
553 553
 					} else {
554
-						print $Common->distance($spotter_item['last_latitude'],$spotter_item['last_longitude'],$departure_airport_info[0]['latitude'],$departure_airport_info[0]['longitude'],'km').' km';
554
+						print $Common->distance($spotter_item['last_latitude'], $spotter_item['last_longitude'], $departure_airport_info[0]['latitude'], $departure_airport_info[0]['longitude'], 'km').' km';
555 555
 					}
556 556
 				} else {
557 557
 					if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'nm') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'nm')) {
558
-						print $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$departure_airport_info[0]['latitude'],$departure_airport_info[0]['longitude'],'nm').' nm';
558
+						print $Common->distance($spotter_item['latitude'], $spotter_item['longitude'], $departure_airport_info[0]['latitude'], $departure_airport_info[0]['longitude'], 'nm').' nm';
559 559
 					} elseif ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'mi') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'mi')) {
560
-						print $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$departure_airport_info[0]['latitude'],$departure_airport_info[0]['longitude'],'mi').' mi';
560
+						print $Common->distance($spotter_item['latitude'], $spotter_item['longitude'], $departure_airport_info[0]['latitude'], $departure_airport_info[0]['longitude'], 'mi').' mi';
561 561
 					} else {
562
-						print $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$departure_airport_info[0]['latitude'],$departure_airport_info[0]['longitude'],'km').' km';
562
+						print $Common->distance($spotter_item['latitude'], $spotter_item['longitude'], $departure_airport_info[0]['latitude'], $departure_airport_info[0]['longitude'], 'km').' km';
563 563
 					}
564 564
 				}
565 565
 			}
@@ -575,19 +575,19 @@  discard block
 block discarded – undo
575 575
 			if (count($arrival_airport_info) > 0) {
576 576
 				if (isset($spotter_item['last_latitude']) && $spotter_item['last_latitude'] != '') {
577 577
 					if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'nm') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'nm')) {
578
-						print $Common->distance($spotter_item['last_latitude'],$spotter_item['last_longitude'],$arrival_airport_info[0]['latitude'],$arrival_airport_info[0]['longitude'],'nm').' nm';
578
+						print $Common->distance($spotter_item['last_latitude'], $spotter_item['last_longitude'], $arrival_airport_info[0]['latitude'], $arrival_airport_info[0]['longitude'], 'nm').' nm';
579 579
 					} elseif ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'mi') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'mi')) {
580
-						print $Common->distance($spotter_item['last_latitude'],$spotter_item['last_longitude'],$arrival_airport_info[0]['latitude'],$arrival_airport_info[0]['longitude'],'mi').' mi';
580
+						print $Common->distance($spotter_item['last_latitude'], $spotter_item['last_longitude'], $arrival_airport_info[0]['latitude'], $arrival_airport_info[0]['longitude'], 'mi').' mi';
581 581
 					} else {
582
-						print $Common->distance($spotter_item['last_latitude'],$spotter_item['last_longitude'],$arrival_airport_info[0]['latitude'],$arrival_airport_info[0]['longitude'],'km').' km';
582
+						print $Common->distance($spotter_item['last_latitude'], $spotter_item['last_longitude'], $arrival_airport_info[0]['latitude'], $arrival_airport_info[0]['longitude'], 'km').' km';
583 583
 					}
584 584
 				} else {
585 585
 					if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'nm') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'nm')) {
586
-						print $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$arrival_airport_info[0]['latitude'],$arrival_airport_info[0]['longitude'],'nm').' nm';
586
+						print $Common->distance($spotter_item['latitude'], $spotter_item['longitude'], $arrival_airport_info[0]['latitude'], $arrival_airport_info[0]['longitude'], 'nm').' nm';
587 587
 					} elseif ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'mi') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'mi')) {
588
-						print $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$arrival_airport_info[0]['latitude'],$arrival_airport_info[0]['longitude'],'mi').' mi';
588
+						print $Common->distance($spotter_item['latitude'], $spotter_item['longitude'], $arrival_airport_info[0]['latitude'], $arrival_airport_info[0]['longitude'], 'mi').' mi';
589 589
 					} else {
590
-						print $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$arrival_airport_info[0]['latitude'],$arrival_airport_info[0]['longitude'],'km').' km';
590
+						print $Common->distance($spotter_item['latitude'], $spotter_item['longitude'], $arrival_airport_info[0]['latitude'], $arrival_airport_info[0]['longitude'], 'km').' km';
591 591
 					}
592 592
 				}
593 593
 			}
@@ -606,7 +606,7 @@  discard block
 block discarded – undo
606 606
 		print '<div class="last-flights">';
607 607
 		print '<h3>'._("Last 5 Flights of this Aircraft").' ('.$registration.')</h3>';
608 608
 		$hide_th_links = true;
609
-		$spotter_array = $Spotter->getSpotterDataByRegistration($registration,"0,5", "");
609
+		$spotter_array = $Spotter->getSpotterDataByRegistration($registration, "0,5", "");
610 610
 		include('table-output.php'); 
611 611
 		print '<div class="more">';
612 612
 		print '<a href="'.$globalURL.'/registration/'.$registration.'" class="btn btn-default btn" role="button">See all Flights&raquo;</a>';
Please login to merge, or discard this patch.
airline-statistics-registration.php 1 patch
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -8,21 +8,21 @@  discard block
 block discarded – undo
8 8
 	header('Location: '.$globalURL.'/airline');
9 9
 	die();
10 10
 }
11
-$airline = urldecode(filter_input(INPUT_GET,'airline',FILTER_SANITIZE_STRING));
11
+$airline = urldecode(filter_input(INPUT_GET, 'airline', FILTER_SANITIZE_STRING));
12 12
 $Spotter = new Spotter();
13 13
 $alliance = false;
14
-if (strpos($airline,'alliance_') !== FALSE) {
14
+if (strpos($airline, 'alliance_') !== FALSE) {
15 15
 	$alliance = true;
16 16
 } else {
17
-	$spotter_array = $Spotter->getSpotterDataByAirline($airline,"0,1","");
17
+	$spotter_array = $Spotter->getSpotterDataByAirline($airline, "0,1", "");
18 18
 }
19 19
 
20 20
 if (!empty($spotter_array) || $alliance === true)
21 21
 {
22 22
 	if ($alliance) {
23
-		$title = sprintf(_("Most Common Aircraft by Registration from %s"),str_replace('_',' ',str_replace('alliance_','',$airline)));
23
+		$title = sprintf(_("Most Common Aircraft by Registration from %s"), str_replace('_', ' ', str_replace('alliance_', '', $airline)));
24 24
 	} else {
25
-		$title = sprintf(_("Most Common Aircraft by Registration from %s (%s)"),$spotter_array[0]['airline_name'],$spotter_array[0]['airline_icao']);
25
+		$title = sprintf(_("Most Common Aircraft by Registration from %s (%s)"), $spotter_array[0]['airline_name'], $spotter_array[0]['airline_icao']);
26 26
 	}
27 27
 	require_once('header.php');
28 28
 
@@ -33,10 +33,10 @@  discard block
 block discarded – undo
33 33
 	$alliances = $Spotter->getAllAllianceNames();
34 34
 	if (!empty($alliances)) {
35 35
 		foreach ($alliances as $al) {
36
-			if ($alliance && str_replace('_',' ',str_replace('alliance_','',$airline)) == $al['alliance']) {
37
-				print '<option value="'.str_replace(' ','_',$al['alliance']).'" selected>'.$al['alliance'].'</option>';
36
+			if ($alliance && str_replace('_', ' ', str_replace('alliance_', '', $airline)) == $al['alliance']) {
37
+				print '<option value="'.str_replace(' ', '_', $al['alliance']).'" selected>'.$al['alliance'].'</option>';
38 38
 			} else {
39
-				print '<option value="'.str_replace(' ','_',$al['alliance']).'">'.$al['alliance'].'</option>';
39
+				print '<option value="'.str_replace(' ', '_', $al['alliance']).'">'.$al['alliance'].'</option>';
40 40
 			}
41 41
 		}
42 42
 		print '<option disabled>──────────────────</option>';
@@ -44,9 +44,9 @@  discard block
 block discarded – undo
44 44
 	$Stats = new Stats($Spotter->db);
45 45
 	$airline_names = $Stats->getAllAirlineNames();
46 46
 	if (empty($airline_names)) $airline_names = $Spotter->getAllAirlineNames();
47
-	foreach($airline_names as $airline_name)
47
+	foreach ($airline_names as $airline_name)
48 48
 	{
49
-		if($airline == $airline_name['airline_icao'])
49
+		if ($airline == $airline_name['airline_icao'])
50 50
 		{
51 51
 			print '<option value="'.$airline_name['airline_icao'].'" selected="selected">'.$airline_name['airline_name'].' ('.$airline_name['airline_icao'].')</option>';
52 52
 		} else {
@@ -80,12 +80,12 @@  discard block
 block discarded – undo
80 80
 			print '</div>';
81 81
 		} else {
82 82
 			print '<div class="info column">';
83
-			print '<h1>'.str_replace('_',' ',str_replace('alliance_','',$airline)).'</h1>';
84
-			if (@getimagesize($globalURL.'/images/airlines/'.str_replace('alliance_','',$airline).'.png') || @getimagesize('images/airlines/'.str_replace('alliance_','',$airline).'.png'))
83
+			print '<h1>'.str_replace('_', ' ', str_replace('alliance_', '', $airline)).'</h1>';
84
+			if (@getimagesize($globalURL.'/images/airlines/'.str_replace('alliance_', '', $airline).'.png') || @getimagesize('images/airlines/'.str_replace('alliance_', '', $airline).'.png'))
85 85
 			{
86
-				print '<img src="'.$globalURL.'/images/airlines/'.str_replace('alliance_','',$airline).'.png" alt="'.str_replace('_',' ',str_replace('alliance_','',$airline)).'" title="'.str_replace('_',' ',str_replace('alliance_','',$airline)).'" class="logo" />';
86
+				print '<img src="'.$globalURL.'/images/airlines/'.str_replace('alliance_', '', $airline).'.png" alt="'.str_replace('_', ' ', str_replace('alliance_', '', $airline)).'" title="'.str_replace('_', ' ', str_replace('alliance_', '', $airline)).'" class="logo" />';
87 87
 			}
88
-			print '<div><span class="label">'._("Name").'</span>'.str_replace('_',' ',str_replace('alliance_','',$airline)).'</div>';
88
+			print '<div><span class="label">'._("Name").'</span>'.str_replace('_', ' ', str_replace('alliance_', '', $airline)).'</div>';
89 89
 			print '</div>';
90 90
 		}
91 91
 	} else {
@@ -96,9 +96,9 @@  discard block
 block discarded – undo
96 96
 	print '<div class="column">';
97 97
 	print '<h2>'._("Most Common Aircraft by Registration").'</h2>';
98 98
 	if ($alliance) {
99
-		print '<p>'.sprintf(_("The statistic below shows the most common aircraft by their registration of flights from <strong>%s</strong>."),str_replace('_',' ',str_replace('alliance_','',$airline))).'</p>';
99
+		print '<p>'.sprintf(_("The statistic below shows the most common aircraft by their registration of flights from <strong>%s</strong>."), str_replace('_', ' ', str_replace('alliance_', '', $airline))).'</p>';
100 100
 	} else {
101
-		print '<p>'.sprintf(_("The statistic below shows the most common aircraft by their registration of flights from <strong>%s</strong>."),$spotter_array[0]['airline_name']).'</p>';
101
+		print '<p>'.sprintf(_("The statistic below shows the most common aircraft by their registration of flights from <strong>%s</strong>."), $spotter_array[0]['airline_name']).'</p>';
102 102
 	}
103 103
 	/*
104 104
 	if ($alliance) {
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
 		$aircraft_array = $Spotter->countAllAircraftRegistrationByAirline($airline);
108 108
 	}
109 109
 	*/
110
-	$aircraft_array = $Stats->countAllAircraftRegistrations(true,$airline);
110
+	$aircraft_array = $Stats->countAllAircraftRegistrations(true, $airline);
111 111
 	if (!empty($aircraft_array))
112 112
 	{
113 113
 		print '<div class="table-responsive">';
@@ -122,7 +122,7 @@  discard block
 block discarded – undo
122 122
 		print '</thead>';
123 123
 		print '<tbody>';
124 124
 		$i = 1;
125
-		foreach($aircraft_array as $aircraft_item)
125
+		foreach ($aircraft_array as $aircraft_item)
126 126
 		{
127 127
 			print '<tr>';
128 128
 			print '<td><strong>'.$i.'</strong></td>';
Please login to merge, or discard this patch.
require/class.MarineArchive.php 1 patch
Spacing   +104 added lines, -104 removed lines patch added patch discarded remove patch
@@ -14,33 +14,33 @@  discard block
 block discarded – undo
14 14
 	* @param Array $filter the filter
15 15
 	* @return Array the SQL part
16 16
 	*/
17
-	public function getFilter($filter = array(),$where = false,$and = false) {
17
+	public function getFilter($filter = array(), $where = false, $and = false) {
18 18
 		global $globalFilter, $globalStatsFilters, $globalFilterName, $globalDBdriver;
19 19
 		$filters = array();
20 20
 		if (is_array($globalStatsFilters) && isset($globalStatsFilters[$globalFilterName])) {
21 21
 			if (isset($globalStatsFilters[$globalFilterName][0]['source'])) {
22 22
 				$filters = $globalStatsFilters[$globalFilterName];
23 23
 			} else {
24
-				$filter = array_merge($filter,$globalStatsFilters[$globalFilterName]);
24
+				$filter = array_merge($filter, $globalStatsFilters[$globalFilterName]);
25 25
 			}
26 26
 		}
27 27
 		if (isset($filter[0]['source'])) {
28
-			$filters = array_merge($filters,$filter);
28
+			$filters = array_merge($filters, $filter);
29 29
 		}
30
-		if (is_array($globalFilter)) $filter = array_merge($filter,$globalFilter);
30
+		if (is_array($globalFilter)) $filter = array_merge($filter, $globalFilter);
31 31
 		$filter_query_join = '';
32 32
 		$filter_query_where = '';
33
-		foreach($filters as $flt) {
33
+		foreach ($filters as $flt) {
34 34
 			if (isset($flt['idents']) && !empty($flt['idents'])) {
35 35
 				if (isset($flt['source'])) {
36
-					$filter_query_join .= " INNER JOIN (SELECT fammarine_id FROM marine_archive_output WHERE marine_archive_output.ident IN ('".implode("','",$flt['idents'])."') AND marine_archive_output.format_source IN ('".implode("','",$flt['source'])."')) spid ON spid.fammarine_id = marine_archive.fammarine_id";
36
+					$filter_query_join .= " INNER JOIN (SELECT fammarine_id FROM marine_archive_output WHERE marine_archive_output.ident IN ('".implode("','", $flt['idents'])."') AND marine_archive_output.format_source IN ('".implode("','", $flt['source'])."')) spid ON spid.fammarine_id = marine_archive.fammarine_id";
37 37
 				} else {
38
-					$filter_query_join .= " INNER JOIN (SELECT fammarine_id FROM marine_archive_output WHERE marine_archive_output.ident IN ('".implode("','",$flt['idents'])."')) spid ON spid.fammarine_id = marine_archive.fammarine_id";
38
+					$filter_query_join .= " INNER JOIN (SELECT fammarine_id FROM marine_archive_output WHERE marine_archive_output.ident IN ('".implode("','", $flt['idents'])."')) spid ON spid.fammarine_id = marine_archive.fammarine_id";
39 39
 				}
40 40
 			}
41 41
 		}
42 42
 		if (isset($filter['source']) && !empty($filter['source'])) {
43
-			$filter_query_where .= " AND format_source IN ('".implode("','",$filter['source'])."')";
43
+			$filter_query_where .= " AND format_source IN ('".implode("','", $filter['source'])."')";
44 44
 		}
45 45
 		if (isset($filter['ident']) && !empty($filter['ident'])) {
46 46
 			$filter_query_where .= " AND ident = '".$filter['ident']."'";
@@ -68,42 +68,42 @@  discard block
 block discarded – undo
68 68
 					$filter_query_date .= " AND EXTRACT(DAY FROM marine_archive_output.date) = '".$filter['day']."'";
69 69
 				}
70 70
 			}
71
-			$filter_query_join .= " INNER JOIN (SELECT fammarine_id FROM marine_archive_output".preg_replace('/^ AND/',' WHERE',$filter_query_date).") sd ON sd.fammarine_id = marine_archive.fammarine_id";
71
+			$filter_query_join .= " INNER JOIN (SELECT fammarine_id FROM marine_archive_output".preg_replace('/^ AND/', ' WHERE', $filter_query_date).") sd ON sd.fammarine_id = marine_archive.fammarine_id";
72 72
 		}
73 73
 		if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) {
74
-			$filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')";
74
+			$filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','", $filter['source_aprs'])."')";
75 75
 		}
76 76
 		if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE';
77 77
 		elseif ($filter_query_where != '' && $and) $filter_query_where .= ' AND';
78 78
 		if ($filter_query_where != '') {
79
-			$filter_query_where = preg_replace('/^ AND/',' WHERE',$filter_query_where);
79
+			$filter_query_where = preg_replace('/^ AND/', ' WHERE', $filter_query_where);
80 80
 		}
81 81
 		$filter_query = $filter_query_join.$filter_query_where;
82 82
 		return $filter_query;
83 83
 	}
84 84
 
85 85
 	// marine_archive
86
-	public function addMarineArchiveData($fammarine_id = '', $ident = '', $latitude = '', $longitude = '', $heading = '', $groundspeed = '', $date = '', $putinarchive = false, $mmsi = '',$type = '',$typeid = '',$imo = '', $callsign = '',$arrival_code = '',$arrival_date = '',$status = '',$statusid = '',$noarchive = false,$format_source = '', $source_name = '', $over_country = '') {
86
+	public function addMarineArchiveData($fammarine_id = '', $ident = '', $latitude = '', $longitude = '', $heading = '', $groundspeed = '', $date = '', $putinarchive = false, $mmsi = '', $type = '', $typeid = '', $imo = '', $callsign = '', $arrival_code = '', $arrival_date = '', $status = '', $statusid = '', $noarchive = false, $format_source = '', $source_name = '', $over_country = '') {
87 87
 		require_once(dirname(__FILE__).'/class.Marine.php');
88 88
 		if ($over_country == '') {
89 89
 			$Marine = new Marine($this->db);
90
-			$data_country = $Marine->getCountryFromLatitudeLongitude($latitude,$longitude);
90
+			$data_country = $Marine->getCountryFromLatitudeLongitude($latitude, $longitude);
91 91
 			if (!empty($data_country)) $country = $data_country['iso2'];
92 92
 			else $country = '';
93 93
 		} else $country = $over_country;
94 94
 		
95 95
 		//$country = $over_country;
96 96
 		// Route is not added in marine_archive
97
-		$query  = 'INSERT INTO marine_archive (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) 
97
+		$query = 'INSERT INTO marine_archive (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) 
98 98
 		    VALUES (:fammarine_id,:ident,:latitude,:longitude,:heading,:groundspeed,:date,:format_source, :source_name, :over_country,:mmsi,:type,:type_id,:status,:status_id,:imo,:arrival_port_name,:arrival_port_date)';
99 99
 
100
-		$query_values = array(':fammarine_id' => $fammarine_id,':ident' => $ident,':latitude' => $latitude,':longitude' => $longitude,':heading' => $heading,':groundspeed' => $groundspeed,':date' => $date, ':format_source' => $format_source, ':source_name' => $source_name, ':over_country' => $country,':mmsi' => $mmsi,':type' => $type,':type_id' => $typeid,':status' => $status,':status_id' => $statusid,':imo' => $imo,':arrival_port_name' => $arrival_code,':arrival_port_date' => $arrival_date);
100
+		$query_values = array(':fammarine_id' => $fammarine_id, ':ident' => $ident, ':latitude' => $latitude, ':longitude' => $longitude, ':heading' => $heading, ':groundspeed' => $groundspeed, ':date' => $date, ':format_source' => $format_source, ':source_name' => $source_name, ':over_country' => $country, ':mmsi' => $mmsi, ':type' => $type, ':type_id' => $typeid, ':status' => $status, ':status_id' => $statusid, ':imo' => $imo, ':arrival_port_name' => $arrival_code, ':arrival_port_date' => $arrival_date);
101 101
 
102 102
 		try {
103 103
 			$sth = $this->db->prepare($query);
104 104
 			$sth->execute($query_values);
105 105
 			$sth->closeCursor();
106
-		} catch(PDOException $e) {
106
+		} catch (PDOException $e) {
107 107
 			return "error : ".$e->getMessage();
108 108
 		}
109 109
 		return "success";
@@ -123,9 +123,9 @@  discard block
 block discarded – undo
123 123
 
124 124
                 $ident = filter_var($ident, FILTER_SANITIZE_STRING);
125 125
                 //$query  = "SELECT marine_archive.* FROM marine_archive INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_archive l WHERE l.ident = :ident GROUP BY l.fammarine_id) s on marine_archive.fammarine_id = s.fammarine_id AND marine_archive.date = s.maxdate LIMIT 1";
126
-                $query  = "SELECT marine_archive.* FROM marine_archive WHERE ident = :ident ORDER BY date DESC LIMIT 1";
126
+                $query = "SELECT marine_archive.* FROM marine_archive WHERE ident = :ident ORDER BY date DESC LIMIT 1";
127 127
 
128
-                $spotter_array = $Marine->getDataFromDB($query,array(':ident' => $ident));
128
+                $spotter_array = $Marine->getDataFromDB($query, array(':ident' => $ident));
129 129
 
130 130
                 return $spotter_array;
131 131
         }
@@ -144,7 +144,7 @@  discard block
 block discarded – undo
144 144
                 $id = filter_var($id, FILTER_SANITIZE_STRING);
145 145
                 //$query  = MarineArchive->$global_query." WHERE marine_archive.fammarine_id = :id";
146 146
                 //$query  = "SELECT marine_archive.* FROM marine_archive INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_archive l WHERE l.fammarine_id = :id GROUP BY l.fammarine_id) s on marine_archive.fammarine_id = s.fammarine_id AND marine_archive.date = s.maxdate LIMIT 1";
147
-                $query  = "SELECT * FROM marine_archive WHERE fammarine_id = :id ORDER BY date DESC LIMIT 1";
147
+                $query = "SELECT * FROM marine_archive WHERE fammarine_id = :id ORDER BY date DESC LIMIT 1";
148 148
 
149 149
 //              $spotter_array = Marine->getDataFromDB($query,array(':id' => $id));
150 150
                   /*
@@ -157,7 +157,7 @@  discard block
 block discarded – undo
157 157
                 }
158 158
                 $spotter_array = $sth->fetchAll(PDO->FETCH_ASSOC);
159 159
                 */
160
-                $spotter_array = $Marine->getDataFromDB($query,array(':id' => $id));
160
+                $spotter_array = $Marine->getDataFromDB($query, array(':id' => $id));
161 161
 
162 162
                 return $spotter_array;
163 163
         }
@@ -172,14 +172,14 @@  discard block
 block discarded – undo
172 172
 	{
173 173
                 date_default_timezone_set('UTC');
174 174
                 $id = filter_var($id, FILTER_SANITIZE_STRING);
175
-                $query  = $this->global_query." WHERE marine_archive.fammarine_id = :id ORDER BY date";
175
+                $query = $this->global_query." WHERE marine_archive.fammarine_id = :id ORDER BY date";
176 176
 
177 177
 //              $spotter_array = Marine->getDataFromDB($query,array(':id' => $id));
178 178
 
179 179
                 try {
180 180
                         $sth = $this->db->prepare($query);
181 181
                         $sth->execute(array(':id' => $id));
182
-                } catch(PDOException $e) {
182
+                } catch (PDOException $e) {
183 183
                         echo $e->getMessage();
184 184
                         die;
185 185
                 }
@@ -198,14 +198,14 @@  discard block
 block discarded – undo
198 198
         {
199 199
                 date_default_timezone_set('UTC');
200 200
                 $id = filter_var($id, FILTER_SANITIZE_STRING);
201
-                $query  = "SELECT marine_archive.latitude, marine_archive.longitude, marine_archive.date FROM marine_archive WHERE marine_archive.fammarine_id = :id";
201
+                $query = "SELECT marine_archive.latitude, marine_archive.longitude, marine_archive.date FROM marine_archive WHERE marine_archive.fammarine_id = :id";
202 202
 
203 203
 //              $spotter_array = Marine->getDataFromDB($query,array(':id' => $id));
204 204
 
205 205
                 try {
206 206
                         $sth = $this->db->prepare($query);
207 207
                         $sth->execute(array(':id' => $id));
208
-                } catch(PDOException $e) {
208
+                } catch (PDOException $e) {
209 209
                         echo $e->getMessage();
210 210
                         die;
211 211
                 }
@@ -227,12 +227,12 @@  discard block
 block discarded – undo
227 227
                 date_default_timezone_set('UTC');
228 228
 
229 229
                 $ident = filter_var($ident, FILTER_SANITIZE_STRING);
230
-                $query  = "SELECT marine_archive.altitude, marine_archive.date FROM marine_archive WHERE marine_archive.ident = :ident AND marine_archive.latitude <> 0 AND marine_archive.longitude <> 0 ORDER BY date";
230
+                $query = "SELECT marine_archive.altitude, marine_archive.date FROM marine_archive WHERE marine_archive.ident = :ident AND marine_archive.latitude <> 0 AND marine_archive.longitude <> 0 ORDER BY date";
231 231
 
232 232
                 try {
233 233
                         $sth = $this->db->prepare($query);
234 234
                         $sth->execute(array(':ident' => $ident));
235
-                } catch(PDOException $e) {
235
+                } catch (PDOException $e) {
236 236
                         echo $e->getMessage();
237 237
                         die;
238 238
                 }
@@ -253,12 +253,12 @@  discard block
 block discarded – undo
253 253
                 date_default_timezone_set('UTC');
254 254
 
255 255
                 $id = filter_var($id, FILTER_SANITIZE_STRING);
256
-                $query  = "SELECT marine_archive.altitude, marine_archive.date FROM marine_archive WHERE marine_archive.fammarine_id = :id AND marine_archive.latitude <> 0 AND marine_archive.longitude <> 0 ORDER BY date";
256
+                $query = "SELECT marine_archive.altitude, marine_archive.date FROM marine_archive WHERE marine_archive.fammarine_id = :id AND marine_archive.latitude <> 0 AND marine_archive.longitude <> 0 ORDER BY date";
257 257
 
258 258
                 try {
259 259
                         $sth = $this->db->prepare($query);
260 260
                         $sth->execute(array(':id' => $id));
261
-                } catch(PDOException $e) {
261
+                } catch (PDOException $e) {
262 262
                         echo $e->getMessage();
263 263
                         die;
264 264
                 }
@@ -279,12 +279,12 @@  discard block
 block discarded – undo
279 279
                 date_default_timezone_set('UTC');
280 280
 
281 281
                 $id = filter_var($id, FILTER_SANITIZE_STRING);
282
-                $query  = "SELECT marine_archive.altitude, marine_archive.ground_speed, marine_archive.date FROM marine_archive WHERE marine_archive.fammarine_id = :id ORDER BY date";
282
+                $query = "SELECT marine_archive.altitude, marine_archive.ground_speed, marine_archive.date FROM marine_archive WHERE marine_archive.fammarine_id = :id ORDER BY date";
283 283
 
284 284
                 try {
285 285
                         $sth = $this->db->prepare($query);
286 286
                         $sth->execute(array(':id' => $id));
287
-                } catch(PDOException $e) {
287
+                } catch (PDOException $e) {
288 288
                         echo $e->getMessage();
289 289
                         die;
290 290
                 }
@@ -306,13 +306,13 @@  discard block
 block discarded – undo
306 306
                 date_default_timezone_set('UTC');
307 307
 
308 308
                 $ident = filter_var($ident, FILTER_SANITIZE_STRING);
309
-                $query  = "SELECT marine_archive.altitude, marine_archive.date FROM marine_archive INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_archive l WHERE l.ident = :ident GROUP BY l.fammarine_id) s on marine_archive.fammarine_id = s.fammarine_id AND marine_archive.date = s.maxdate LIMIT 1";
309
+                $query = "SELECT marine_archive.altitude, marine_archive.date FROM marine_archive INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_archive l WHERE l.ident = :ident GROUP BY l.fammarine_id) s on marine_archive.fammarine_id = s.fammarine_id AND marine_archive.date = s.maxdate LIMIT 1";
310 310
 //                $query  = "SELECT marine_archive.altitude, marine_archive.date FROM marine_archive WHERE marine_archive.ident = :ident";
311 311
 
312 312
                 try {
313 313
                         $sth = $this->db->prepare($query);
314 314
                         $sth->execute(array(':ident' => $ident));
315
-                } catch(PDOException $e) {
315
+                } catch (PDOException $e) {
316 316
                         echo $e->getMessage();
317 317
                         die;
318 318
                 }
@@ -329,12 +329,12 @@  discard block
 block discarded – undo
329 329
         * @return Array the spotter information
330 330
         *
331 331
         */
332
-	public function getMarineArchiveData($ident,$fammarine_id,$date)
332
+	public function getMarineArchiveData($ident, $fammarine_id, $date)
333 333
 	{
334 334
 		$Marine = new Marine($this->db);
335 335
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
336 336
 		$query  = "SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM spotter_live l WHERE l.ident = :ident AND l.fammarine_id = :fammarine_id AND l.date LIKE :date GROUP BY l.fammarine_id) s on spotter_live.fammarine_id = s.fammarine_id AND spotter_live.date = s.maxdate";
337
-		$spotter_array = $Marine->getDataFromDB($query,array(':ident' => $ident,':fammarine_id' => $fammarine_id,':date' => $date.'%'));
337
+		$spotter_array = $Marine->getDataFromDB($query, array(':ident' => $ident, ':fammarine_id' => $fammarine_id, ':date' => $date.'%'));
338 338
 		return $spotter_array;
339 339
 	}
340 340
 
@@ -353,7 +353,7 @@  discard block
 block discarded – undo
353 353
 		try {
354 354
 			$sth = $this->db->prepare($query);
355 355
 			$sth->execute();
356
-		} catch(PDOException $e) {
356
+		} catch (PDOException $e) {
357 357
 			echo $e->getMessage();
358 358
 			die;
359 359
 		}
@@ -365,24 +365,24 @@  discard block
 block discarded – undo
365 365
         * @return Array the spotter information
366 366
         *
367 367
         */
368
-        public function getMinLiveMarineData($begindate,$enddate,$filter = array())
368
+        public function getMinLiveMarineData($begindate, $enddate, $filter = array())
369 369
         {
370 370
                 global $globalDBdriver, $globalLiveInterval;
371 371
                 date_default_timezone_set('UTC');
372 372
 
373 373
                 $filter_query = '';
374 374
                 if (isset($filter['source']) && !empty($filter['source'])) {
375
-                        $filter_query .= " AND format_source IN ('".implode("','",$filter['source'])."') ";
375
+                        $filter_query .= " AND format_source IN ('".implode("','", $filter['source'])."') ";
376 376
                 }
377 377
                 // Use spotter_output also ?
378 378
                 if (isset($filter['airlines']) && !empty($filter['airlines'])) {
379
-                        $filter_query .= " INNER JOIN (SELECT fammarine_id FROM marine_archive_output WHERE marine_archive_output.airline_icao IN ('".implode("','",$filter['airlines'])."')) so ON so.fammarine_id = marine_archive.fammarine_id ";
379
+                        $filter_query .= " INNER JOIN (SELECT fammarine_id FROM marine_archive_output WHERE marine_archive_output.airline_icao IN ('".implode("','", $filter['airlines'])."')) so ON so.fammarine_id = marine_archive.fammarine_id ";
380 380
                 }
381 381
                 if (isset($filter['airlinestype']) && !empty($filter['airlinestype'])) {
382 382
                         $filter_query .= " INNER JOIN (SELECT fammarine_id FROM marine_archive_output WHERE marine_archive_output.airline_type = '".$filter['airlinestype']."') sa ON sa.fammarine_id = marine_archive.fammarine_id ";
383 383
                 }
384 384
                 if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) {
385
-                        $filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')";
385
+                        $filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','", $filter['source_aprs'])."')";
386 386
                 }
387 387
 
388 388
                 //if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
@@ -401,14 +401,14 @@  discard block
 block discarded – undo
401 401
 						GROUP BY l.fammarine_id) s on marine_archive.fammarine_id = s.fammarine_id 
402 402
 				    AND marine_archive.date = s.maxdate '.$filter_query.'LEFT JOIN (SELECT aircraft_shadow,icao FROM aircraft) a ON marine_archive.aircraft_icao = a.icao';
403 403
 */
404
-			$query  = 'SELECT marine_archive.date,marine_archive.fammarine_id, marine_archive.ident, marine_archive.aircraft_icao, marine_archive.departure_airport_icao as departure_airport, marine_archive.arrival_airport_icao as arrival_airport, marine_archive.latitude, marine_archive.longitude, marine_archive.altitude, marine_archive.heading, marine_archive.ground_speed, marine_archive.squawk, a.aircraft_shadow,a.engine_type, a.engine_count, a.wake_category 
404
+			$query = 'SELECT marine_archive.date,marine_archive.fammarine_id, marine_archive.ident, marine_archive.aircraft_icao, marine_archive.departure_airport_icao as departure_airport, marine_archive.arrival_airport_icao as arrival_airport, marine_archive.latitude, marine_archive.longitude, marine_archive.altitude, marine_archive.heading, marine_archive.ground_speed, marine_archive.squawk, a.aircraft_shadow,a.engine_type, a.engine_count, a.wake_category 
405 405
 				    FROM marine_archive 
406 406
 				    INNER JOIN (SELECT * FROM aircraft) a on marine_archive.aircraft_icao = a.icao
407 407
 				    WHERE marine_archive.date BETWEEN '."'".$begindate."'".' AND '."'".$begindate."'".' 
408 408
                         	    '.$filter_query.' ORDER BY fammarine_id';
409 409
                 } else {
410 410
                         //$query  = 'SELECT marine_archive.ident, marine_archive.fammarine_id, marine_archive.aircraft_icao, marine_archive.departure_airport_icao as departure_airport, marine_archive.arrival_airport_icao as arrival_airport, marine_archive.latitude, marine_archive.longitude, marine_archive.altitude, marine_archive.heading, marine_archive.ground_speed, marine_archive.squawk, a.aircraft_shadow FROM marine_archive INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_archive l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.fammarine_id) s on marine_archive.fammarine_id = s.fammarine_id AND marine_archive.date = s.maxdate '.$filter_query.'INNER JOIN (SELECT * FROM aircraft) a on marine_archive.aircraft_icao = a.icao';
411
-                        $query  = 'SELECT marine_archive.date,marine_archive.fammarine_id, marine_archive.ident, marine_archive.aircraft_icao, marine_archive.departure_airport_icao as departure_airport, marine_archive.arrival_airport_icao as arrival_airport, marine_archive.latitude, marine_archive.longitude, marine_archive.altitude, marine_archive.heading, marine_archive.ground_speed, marine_archive.squawk, a.aircraft_shadow,a.engine_type, a.engine_count, a.wake_category 
411
+                        $query = 'SELECT marine_archive.date,marine_archive.fammarine_id, marine_archive.ident, marine_archive.aircraft_icao, marine_archive.departure_airport_icao as departure_airport, marine_archive.arrival_airport_icao as arrival_airport, marine_archive.latitude, marine_archive.longitude, marine_archive.altitude, marine_archive.heading, marine_archive.ground_speed, marine_archive.squawk, a.aircraft_shadow,a.engine_type, a.engine_count, a.wake_category 
412 412
                         	    FROM marine_archive 
413 413
                         	    INNER JOIN (SELECT * FROM aircraft) a on marine_archive.aircraft_icao = a.icao
414 414
                         	    WHERE marine_archive.date >= '."'".$begindate."'".' AND marine_archive.date <= '."'".$enddate."'".'
@@ -418,7 +418,7 @@  discard block
 block discarded – undo
418 418
                 try {
419 419
                         $sth = $this->db->prepare($query);
420 420
                         $sth->execute();
421
-                } catch(PDOException $e) {
421
+                } catch (PDOException $e) {
422 422
                         echo $e->getMessage();
423 423
                         die;
424 424
                 }
@@ -433,24 +433,24 @@  discard block
 block discarded – undo
433 433
         * @return Array the spotter information
434 434
         *
435 435
         */
436
-        public function getMinLiveMarineDataPlayback($begindate,$enddate,$filter = array())
436
+        public function getMinLiveMarineDataPlayback($begindate, $enddate, $filter = array())
437 437
         {
438 438
                 global $globalDBdriver, $globalLiveInterval;
439 439
                 date_default_timezone_set('UTC');
440 440
 
441 441
                 $filter_query = '';
442 442
                 if (isset($filter['source']) && !empty($filter['source'])) {
443
-                        $filter_query .= " AND format_source IN ('".implode("','",$filter['source'])."') ";
443
+                        $filter_query .= " AND format_source IN ('".implode("','", $filter['source'])."') ";
444 444
                 }
445 445
                 // Should use spotter_output also ?
446 446
                 if (isset($filter['airlines']) && !empty($filter['airlines'])) {
447
-                        $filter_query .= " INNER JOIN (SELECT fammarine_id FROM marine_archive_output WHERE marine_archive_output.airline_icao IN ('".implode("','",$filter['airlines'])."')) so ON so.fammarine_id = marine_archive.fammarine_id ";
447
+                        $filter_query .= " INNER JOIN (SELECT fammarine_id FROM marine_archive_output WHERE marine_archive_output.airline_icao IN ('".implode("','", $filter['airlines'])."')) so ON so.fammarine_id = marine_archive.fammarine_id ";
448 448
                 }
449 449
                 if (isset($filter['airlinestype']) && !empty($filter['airlinestype'])) {
450 450
                         $filter_query .= " INNER JOIN (SELECT fammarine_id FROM marine_archive_output WHERE marine_archive_output.airline_type = '".$filter['airlinestype']."') sa ON sa.fammarine_id = marine_archive.fammarine_id ";
451 451
                 }
452 452
                 if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) {
453
-                        $filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')";
453
+                        $filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','", $filter['source_aprs'])."')";
454 454
                 }
455 455
 
456 456
                 //if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
@@ -460,7 +460,7 @@  discard block
 block discarded – undo
460 460
                     		    FROM marine_archive 
461 461
                     		    INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_archive l WHERE (l.date BETWEEN '."'".$begindate."'".' AND '."'".$enddate."'".') GROUP BY l.fammarine_id) s on marine_archive.fammarine_id = s.fammarine_id AND marine_archive.date = s.maxdate '.$filter_query.'LEFT JOIN (SELECT aircraft_shadow,icao FROM aircraft) a ON marine_archive.aircraft_icao = a.icao';
462 462
 			*/
463
-			$query  = 'SELECT a.aircraft_shadow, marine_archive_output.ident, marine_archive_output.fammarine_id, marine_archive_output.aircraft_icao, marine_archive_output.departure_airport_icao as departure_airport, marine_archive_output.arrival_airport_icao as arrival_airport, marine_archive_output.latitude, marine_archive_output.longitude, marine_archive_output.altitude, marine_archive_output.heading, marine_archive_output.ground_speed, marine_archive_output.squawk 
463
+			$query = 'SELECT a.aircraft_shadow, marine_archive_output.ident, marine_archive_output.fammarine_id, marine_archive_output.aircraft_icao, marine_archive_output.departure_airport_icao as departure_airport, marine_archive_output.arrival_airport_icao as arrival_airport, marine_archive_output.latitude, marine_archive_output.longitude, marine_archive_output.altitude, marine_archive_output.heading, marine_archive_output.ground_speed, marine_archive_output.squawk 
464 464
 				    FROM marine_archive_output 
465 465
 				    LEFT JOIN (SELECT aircraft_shadow,icao FROM aircraft) a ON marine_archive_output.aircraft_icao = a.icao 
466 466
 				    WHERE (marine_archive_output.date BETWEEN '."'".$begindate."'".' AND '."'".$enddate."'".') 
@@ -475,7 +475,7 @@  discard block
 block discarded – undo
475 475
                         	    WHERE marine_archive_output.date >= '."'".$begindate."'".' AND marine_archive_output.date <= '."'".$enddate."'".'
476 476
                         	    '.$filter_query.' GROUP BY marine_archive_output.fammarine_id, marine_archive_output.ident, marine_archive_output.aircraft_icao, marine_archive_output.departure_airport_icao, marine_archive_output.arrival_airport_icao, marine_archive_output.latitude, marine_archive_output.longitude, marine_archive_output.altitude, marine_archive_output.heading, marine_archive_output.ground_speed, marine_archive_output.squawk, a.aircraft_shadow';
477 477
                         */
478
-                        $query  = 'SELECT DISTINCT marine_archive_output.fammarine_id, marine_archive_output.ident, marine_archive_output.aircraft_icao, marine_archive_output.departure_airport_icao as departure_airport, marine_archive_output.arrival_airport_icao as arrival_airport, marine_archive_output.latitude, marine_archive_output.longitude, marine_archive_output.altitude, marine_archive_output.heading, marine_archive_output.ground_speed, marine_archive_output.squawk, a.aircraft_shadow
478
+                        $query = 'SELECT DISTINCT marine_archive_output.fammarine_id, marine_archive_output.ident, marine_archive_output.aircraft_icao, marine_archive_output.departure_airport_icao as departure_airport, marine_archive_output.arrival_airport_icao as arrival_airport, marine_archive_output.latitude, marine_archive_output.longitude, marine_archive_output.altitude, marine_archive_output.heading, marine_archive_output.ground_speed, marine_archive_output.squawk, a.aircraft_shadow
479 479
                         	    FROM marine_archive_output 
480 480
                         	    INNER JOIN (SELECT * FROM aircraft) a on marine_archive_output.aircraft_icao = a.icao
481 481
                         	    WHERE marine_archive_output.date >= '."'".$begindate."'".' AND marine_archive_output.date <= '."'".$enddate."'".'
@@ -487,7 +487,7 @@  discard block
 block discarded – undo
487 487
                 try {
488 488
                         $sth = $this->db->prepare($query);
489 489
                         $sth->execute();
490
-                } catch(PDOException $e) {
490
+                } catch (PDOException $e) {
491 491
                         echo $e->getMessage();
492 492
                         die;
493 493
                 }
@@ -502,23 +502,23 @@  discard block
 block discarded – undo
502 502
         * @return Array the spotter information
503 503
         *
504 504
         */
505
-        public function getLiveMarineCount($begindate,$enddate,$filter = array())
505
+        public function getLiveMarineCount($begindate, $enddate, $filter = array())
506 506
         {
507 507
                 global $globalDBdriver, $globalLiveInterval;
508 508
                 date_default_timezone_set('UTC');
509 509
 
510 510
                 $filter_query = '';
511 511
                 if (isset($filter['source']) && !empty($filter['source'])) {
512
-                        $filter_query .= " AND format_source IN ('".implode("','",$filter['source'])."') ";
512
+                        $filter_query .= " AND format_source IN ('".implode("','", $filter['source'])."') ";
513 513
                 }
514 514
                 if (isset($filter['airlines']) && !empty($filter['airlines'])) {
515
-                        $filter_query .= " INNER JOIN (SELECT fammarine_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','",$filter['airlines'])."')) so ON so.fammarine_id = marine_archive.fammarine_id ";
515
+                        $filter_query .= " INNER JOIN (SELECT fammarine_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','", $filter['airlines'])."')) so ON so.fammarine_id = marine_archive.fammarine_id ";
516 516
                 }
517 517
                 if (isset($filter['airlinestype']) && !empty($filter['airlinestype'])) {
518 518
                         $filter_query .= " INNER JOIN (SELECT fammarine_id FROM spotter_output WHERE spotter_output.airline_type = '".$filter['airlinestype']."') sa ON sa.fammarine_id = marine_archive.fammarine_id ";
519 519
                 }
520 520
                 if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) {
521
-                        $filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')";
521
+                        $filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','", $filter['source_aprs'])."')";
522 522
                 }
523 523
 
524 524
                 //if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
@@ -533,7 +533,7 @@  discard block
 block discarded – undo
533 533
                 try {
534 534
                         $sth = $this->db->prepare($query);
535 535
                         $sth->execute();
536
-                } catch(PDOException $e) {
536
+                } catch (PDOException $e) {
537 537
                         echo $e->getMessage();
538 538
                         die;
539 539
                 }
@@ -553,7 +553,7 @@  discard block
 block discarded – undo
553 553
     * @return Array the spotter information
554 554
     *
555 555
     */
556
-    public function searchMarineData($q = '', $registration = '', $aircraft_icao = '', $aircraft_manufacturer = '', $highlights = '', $airline_icao = '', $airline_country = '', $airline_type = '', $airport = '', $airport_country = '', $callsign = '', $departure_airport_route = '', $arrival_airport_route = '', $owner = '',$pilot_id = '',$pilot_name = '',$altitude = '', $date_posted = '', $limit = '', $sort = '', $includegeodata = '',$origLat = '',$origLon = '',$dist = '', $filters=array())
556
+    public function searchMarineData($q = '', $registration = '', $aircraft_icao = '', $aircraft_manufacturer = '', $highlights = '', $airline_icao = '', $airline_country = '', $airline_type = '', $airport = '', $airport_country = '', $callsign = '', $departure_airport_route = '', $arrival_airport_route = '', $owner = '', $pilot_id = '', $pilot_name = '', $altitude = '', $date_posted = '', $limit = '', $sort = '', $includegeodata = '', $origLat = '', $origLon = '', $dist = '', $filters = array())
557 557
     {
558 558
 	global $globalTimezone, $globalDBdriver;
559 559
 	require_once(dirname(__FILE__).'/class.Translation.php');
@@ -575,7 +575,7 @@  discard block
 block discarded – undo
575 575
 	        
576 576
 		$q_array = explode(" ", $q);
577 577
 		
578
-		foreach ($q_array as $q_item){
578
+		foreach ($q_array as $q_item) {
579 579
 		    $additional_query .= " AND (";
580 580
 		    $additional_query .= "(marine_archive_output.spotter_id like '%".$q_item."%') OR ";
581 581
 		    $additional_query .= "(marine_archive_output.aircraft_icao like '%".$q_item."%') OR ";
@@ -607,7 +607,7 @@  discard block
 block discarded – undo
607 607
 	
608 608
 	if ($registration != "")
609 609
 	{
610
-	    $registration = filter_var($registration,FILTER_SANITIZE_STRING);
610
+	    $registration = filter_var($registration, FILTER_SANITIZE_STRING);
611 611
 	    if (!is_string($registration))
612 612
 	    {
613 613
 		return false;
@@ -618,7 +618,7 @@  discard block
 block discarded – undo
618 618
 	
619 619
 	if ($aircraft_icao != "")
620 620
 	{
621
-	    $aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
621
+	    $aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
622 622
 	    if (!is_string($aircraft_icao))
623 623
 	    {
624 624
 		return false;
@@ -629,7 +629,7 @@  discard block
 block discarded – undo
629 629
 	
630 630
 	if ($aircraft_manufacturer != "")
631 631
 	{
632
-	    $aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
632
+	    $aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING);
633 633
 	    if (!is_string($aircraft_manufacturer))
634 634
 	    {
635 635
 		return false;
@@ -650,7 +650,7 @@  discard block
 block discarded – undo
650 650
 	
651 651
 	if ($airline_icao != "")
652 652
 	{
653
-	    $airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
653
+	    $airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING);
654 654
 	    if (!is_string($airline_icao))
655 655
 	    {
656 656
 		return false;
@@ -661,7 +661,7 @@  discard block
 block discarded – undo
661 661
 	
662 662
 	if ($airline_country != "")
663 663
 	{
664
-	    $airline_country = filter_var($airline_country,FILTER_SANITIZE_STRING);
664
+	    $airline_country = filter_var($airline_country, FILTER_SANITIZE_STRING);
665 665
 	    if (!is_string($airline_country))
666 666
 	    {
667 667
 		return false;
@@ -672,7 +672,7 @@  discard block
 block discarded – undo
672 672
 	
673 673
 	if ($airline_type != "")
674 674
 	{
675
-	    $airline_type = filter_var($airline_type,FILTER_SANITIZE_STRING);
675
+	    $airline_type = filter_var($airline_type, FILTER_SANITIZE_STRING);
676 676
 	    if (!is_string($airline_type))
677 677
 	    {
678 678
 		return false;
@@ -694,7 +694,7 @@  discard block
 block discarded – undo
694 694
 	
695 695
 	if ($airport != "")
696 696
 	{
697
-	    $airport = filter_var($airport,FILTER_SANITIZE_STRING);
697
+	    $airport = filter_var($airport, FILTER_SANITIZE_STRING);
698 698
 	    if (!is_string($airport))
699 699
 	    {
700 700
 		return false;
@@ -705,7 +705,7 @@  discard block
 block discarded – undo
705 705
 	
706 706
 	if ($airport_country != "")
707 707
 	{
708
-	    $airport_country = filter_var($airport_country,FILTER_SANITIZE_STRING);
708
+	    $airport_country = filter_var($airport_country, FILTER_SANITIZE_STRING);
709 709
 	    if (!is_string($airport_country))
710 710
 	    {
711 711
 		return false;
@@ -716,7 +716,7 @@  discard block
 block discarded – undo
716 716
     
717 717
 	if ($callsign != "")
718 718
 	{
719
-	    $callsign = filter_var($callsign,FILTER_SANITIZE_STRING);
719
+	    $callsign = filter_var($callsign, FILTER_SANITIZE_STRING);
720 720
 	    if (!is_string($callsign))
721 721
 	    {
722 722
 		return false;
@@ -724,7 +724,7 @@  discard block
 block discarded – undo
724 724
 		$translate = $Translation->ident2icao($callsign);
725 725
 		if ($translate != $callsign) {
726 726
 			$additional_query .= " AND (marine_archive_output.ident = :callsign OR marine_archive_output.ident = :translate)";
727
-			$query_values = array_merge($query_values,array(':callsign' => $callsign,':translate' => $translate));
727
+			$query_values = array_merge($query_values, array(':callsign' => $callsign, ':translate' => $translate));
728 728
 		} else {
729 729
 			$additional_query .= " AND (marine_archive_output.ident = '".$callsign."')";
730 730
 		}
@@ -733,7 +733,7 @@  discard block
 block discarded – undo
733 733
 
734 734
 	if ($owner != "")
735 735
 	{
736
-	    $owner = filter_var($owner,FILTER_SANITIZE_STRING);
736
+	    $owner = filter_var($owner, FILTER_SANITIZE_STRING);
737 737
 	    if (!is_string($owner))
738 738
 	    {
739 739
 		return false;
@@ -744,7 +744,7 @@  discard block
 block discarded – undo
744 744
 
745 745
 	if ($pilot_name != "")
746 746
 	{
747
-	    $pilot_name = filter_var($pilot_name,FILTER_SANITIZE_STRING);
747
+	    $pilot_name = filter_var($pilot_name, FILTER_SANITIZE_STRING);
748 748
 	    if (!is_string($pilot_name))
749 749
 	    {
750 750
 		return false;
@@ -755,7 +755,7 @@  discard block
 block discarded – undo
755 755
 	
756 756
 	if ($pilot_id != "")
757 757
 	{
758
-	    $pilot_id = filter_var($pilot_id,FILTER_SANITIZE_NUMBER_INT);
758
+	    $pilot_id = filter_var($pilot_id, FILTER_SANITIZE_NUMBER_INT);
759 759
 	    if (!is_string($pilot_id))
760 760
 	    {
761 761
 		return false;
@@ -766,7 +766,7 @@  discard block
 block discarded – undo
766 766
 	
767 767
 	if ($departure_airport_route != "")
768 768
 	{
769
-	    $departure_airport_route = filter_var($departure_airport_route,FILTER_SANITIZE_STRING);
769
+	    $departure_airport_route = filter_var($departure_airport_route, FILTER_SANITIZE_STRING);
770 770
 	    if (!is_string($departure_airport_route))
771 771
 	    {
772 772
 		return false;
@@ -777,7 +777,7 @@  discard block
 block discarded – undo
777 777
 	
778 778
 	if ($arrival_airport_route != "")
779 779
 	{
780
-	    $arrival_airport_route = filter_var($arrival_airport_route,FILTER_SANITIZE_STRING);
780
+	    $arrival_airport_route = filter_var($arrival_airport_route, FILTER_SANITIZE_STRING);
781 781
 	    if (!is_string($arrival_airport_route))
782 782
 	    {
783 783
 		return false;
@@ -790,8 +790,8 @@  discard block
 block discarded – undo
790 790
 	{
791 791
 	    $altitude_array = explode(",", $altitude);
792 792
 	    
793
-	    $altitude_array[0] = filter_var($altitude_array[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
794
-	    $altitude_array[1] = filter_var($altitude_array[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
793
+	    $altitude_array[0] = filter_var($altitude_array[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
794
+	    $altitude_array[1] = filter_var($altitude_array[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
795 795
 	    
796 796
 
797 797
 	    if ($altitude_array[1] != "")
@@ -809,8 +809,8 @@  discard block
 block discarded – undo
809 809
 	{
810 810
 	    $date_array = explode(",", $date_posted);
811 811
 	    
812
-	    $date_array[0] = filter_var($date_array[0],FILTER_SANITIZE_STRING);
813
-	    $date_array[1] = filter_var($date_array[1],FILTER_SANITIZE_STRING);
812
+	    $date_array[0] = filter_var($date_array[0], FILTER_SANITIZE_STRING);
813
+	    $date_array[1] = filter_var($date_array[1], FILTER_SANITIZE_STRING);
814 814
 	    
815 815
 	    if ($globalTimezone != '') {
816 816
 		date_default_timezone_set($globalTimezone);
@@ -842,8 +842,8 @@  discard block
 block discarded – undo
842 842
 	{
843 843
 	    $limit_array = explode(",", $limit);
844 844
 	    
845
-	    $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
846
-	    $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
845
+	    $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
846
+	    $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
847 847
 	    
848 848
 	    if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
849 849
 	    {
@@ -854,8 +854,8 @@  discard block
 block discarded – undo
854 854
 	
855 855
 
856 856
 	if ($origLat != "" && $origLon != "" && $dist != "") {
857
-		$dist = number_format($dist*0.621371,2,'.','');
858
-		$query="SELECT marine_archive_output.*, 3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - ABS(CAST(marine_archive.latitude as double precision)))*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(ABS(CAST(marine_archive.latitude as double precision))*pi()/180)*POWER(SIN(($origLon-CAST(marine_archive.longitude as double precision))*pi()/180/2),2))) as distance 
857
+		$dist = number_format($dist*0.621371, 2, '.', '');
858
+		$query = "SELECT marine_archive_output.*, 3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - ABS(CAST(marine_archive.latitude as double precision)))*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(ABS(CAST(marine_archive.latitude as double precision))*pi()/180)*POWER(SIN(($origLon-CAST(marine_archive.longitude as double precision))*pi()/180/2),2))) as distance 
859 859
                           FROM marine_archive_output, marine_archive WHERE spotter_output_archive.fammarine_id = marine_archive.fammarine_id AND spotter_output.ident <> '' ".$additional_query."AND CAST(marine_archive.longitude as double precision) between ($origLon-$dist/ABS(cos(radians($origLat))*69)) and ($origLon+$dist/ABS(cos(radians($origLat))*69)) and CAST(marine_archive.latitude as double precision) between ($origLat-($dist/69)) and ($origLat+($dist/69)) 
860 860
                           AND (3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - ABS(CAST(marine_archive.latitude as double precision)))*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(ABS(CAST(marine_archive.latitude as double precision))*pi()/180)*POWER(SIN(($origLon-CAST(marine_archive.longitude as double precision))*pi()/180/2),2)))) < $dist".$filter_query." ORDER BY distance";
861 861
 	} else {
@@ -872,12 +872,12 @@  discard block
 block discarded – undo
872 872
 			$additional_query .= " AND (marine_archive_output.waypoints <> '')";
873 873
 		}
874 874
 
875
-		$query  = "SELECT marine_archive_output.* FROM marine_archive_output 
875
+		$query = "SELECT marine_archive_output.* FROM marine_archive_output 
876 876
 		    WHERE marine_archive_output.ident <> '' 
877 877
 		    ".$additional_query."
878 878
 		    ".$filter_query.$orderby_query;
879 879
 	}
880
-	$spotter_array = $Marine->getDataFromDB($query, $query_values,$limit_query);
880
+	$spotter_array = $Marine->getDataFromDB($query, $query_values, $limit_query);
881 881
 
882 882
 	return $spotter_array;
883 883
     }
@@ -894,7 +894,7 @@  discard block
 block discarded – undo
894 894
                 try {
895 895
                         $sth = $this->db->prepare($query);
896 896
                         $sth->execute();
897
-                } catch(PDOException $e) {
897
+                } catch (PDOException $e) {
898 898
                         return "error";
899 899
                 }
900 900
 	}
@@ -931,8 +931,8 @@  discard block
 block discarded – undo
931 931
 	{
932 932
 	    $limit_array = explode(",", $limit);
933 933
 	    
934
-	    $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
935
-	    $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
934
+	    $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
935
+	    $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
936 936
 	    
937 937
 	    if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
938 938
 	    {
@@ -973,7 +973,7 @@  discard block
 block discarded – undo
973 973
 	$query_values = array();
974 974
 	$limit_query = '';
975 975
 	$additional_query = '';
976
-	$filter_query = $this->getFilter($filter,true,true);
976
+	$filter_query = $this->getFilter($filter, true, true);
977 977
 	
978 978
 	if ($owner != "")
979 979
 	{
@@ -990,8 +990,8 @@  discard block
 block discarded – undo
990 990
 	{
991 991
 	    $limit_array = explode(",", $limit);
992 992
 	    
993
-	    $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
994
-	    $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
993
+	    $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
994
+	    $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
995 995
 	    
996 996
 	    if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
997 997
 	    {
@@ -1031,7 +1031,7 @@  discard block
 block discarded – undo
1031 1031
 	$query_values = array();
1032 1032
 	$limit_query = '';
1033 1033
 	$additional_query = '';
1034
-	$filter_query = $this->getFilter($filter,true,true);
1034
+	$filter_query = $this->getFilter($filter, true, true);
1035 1035
 	
1036 1036
 	if ($pilot != "")
1037 1037
 	{
@@ -1043,8 +1043,8 @@  discard block
 block discarded – undo
1043 1043
 	{
1044 1044
 	    $limit_array = explode(",", $limit);
1045 1045
 	    
1046
-	    $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1047
-	    $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1046
+	    $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1047
+	    $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1048 1048
 	    
1049 1049
 	    if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1050 1050
 	    {
@@ -1074,7 +1074,7 @@  discard block
 block discarded – undo
1074 1074
     * @return Array the airline country list
1075 1075
     *
1076 1076
     */
1077
-    public function countAllFlightOverCountries($limit = true,$olderthanmonths = 0,$sincedate = '')
1077
+    public function countAllFlightOverCountries($limit = true, $olderthanmonths = 0, $sincedate = '')
1078 1078
     {
1079 1079
 	global $globalDBdriver;
1080 1080
 	/*
@@ -1103,7 +1103,7 @@  discard block
 block discarded – undo
1103 1103
 	$flight_array = array();
1104 1104
 	$temp_array = array();
1105 1105
         
1106
-	while($row = $sth->fetch(PDO::FETCH_ASSOC))
1106
+	while ($row = $sth->fetch(PDO::FETCH_ASSOC))
1107 1107
 	{
1108 1108
 	    $temp_array['flight_count'] = $row['nb'];
1109 1109
 	    $temp_array['flight_country'] = $row['name'];
@@ -1120,7 +1120,7 @@  discard block
 block discarded – undo
1120 1120
     * @return Array the airline country list
1121 1121
     *
1122 1122
     */
1123
-    public function countAllFlightOverCountriesByAirlines($limit = true,$olderthanmonths = 0,$sincedate = '')
1123
+    public function countAllFlightOverCountriesByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '')
1124 1124
     {
1125 1125
 	global $globalDBdriver;
1126 1126
 	/*
@@ -1149,7 +1149,7 @@  discard block
 block discarded – undo
1149 1149
 	$flight_array = array();
1150 1150
 	$temp_array = array();
1151 1151
         
1152
-	while($row = $sth->fetch(PDO::FETCH_ASSOC))
1152
+	while ($row = $sth->fetch(PDO::FETCH_ASSOC))
1153 1153
 	{
1154 1154
 	    $temp_array['airline_icao'] = $row['airline_icao'];
1155 1155
 	    $temp_array['flight_count'] = $row['nb'];
@@ -1167,14 +1167,14 @@  discard block
 block discarded – undo
1167 1167
     * @return Array the spotter information
1168 1168
     *
1169 1169
     */
1170
-    public function getDateArchiveMarineDataById($id,$date)
1170
+    public function getDateArchiveMarineDataById($id, $date)
1171 1171
     {
1172 1172
 	$Marine = new Marine($this->db);
1173 1173
 	date_default_timezone_set('UTC');
1174 1174
 	$id = filter_var($id, FILTER_SANITIZE_STRING);
1175 1175
 	$query  = 'SELECT marine_archive.* FROM marine_archive INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_archive l WHERE l.fammarine_id = :id AND l.date <= :date GROUP BY l.fammarine_id) s on marine_archive.fammarine_id = s.fammarine_id AND marine_archive.date = s.maxdate ORDER BY marine_archive.date DESC';
1176
-	$date = date('c',$date);
1177
-	$spotter_array = $Marine->getDataFromDB($query,array(':id' => $id,':date' => $date));
1176
+	$date = date('c', $date);
1177
+	$spotter_array = $Marine->getDataFromDB($query, array(':id' => $id, ':date' => $date));
1178 1178
 	return $spotter_array;
1179 1179
     }
1180 1180
 
@@ -1184,14 +1184,14 @@  discard block
 block discarded – undo
1184 1184
     * @return Array the spotter information
1185 1185
     *
1186 1186
     */
1187
-    public function getDateArchiveMarineDataByIdent($ident,$date)
1187
+    public function getDateArchiveMarineDataByIdent($ident, $date)
1188 1188
     {
1189 1189
 	$Marine = new Marine($this->db);
1190 1190
 	date_default_timezone_set('UTC');
1191 1191
 	$ident = filter_var($ident, FILTER_SANITIZE_STRING);
1192 1192
 	$query  = 'SELECT marine_archive.* FROM marine_archive INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_archive l WHERE l.ident = :ident AND l.date <= :date GROUP BY l.fammarine_id) s on marine_archive.fammarine_id = s.fammarine_id AND marine_archive.date = s.maxdate ORDER BY marine_archive.date DESC';
1193
-	$date = date('c',$date);
1194
-	$spotter_array = $Marine->getDataFromDB($query,array(':ident' => $ident,':date' => $date));
1193
+	$date = date('c', $date);
1194
+	$spotter_array = $Marine->getDataFromDB($query, array(':ident' => $ident, ':date' => $date));
1195 1195
 	return $spotter_array;
1196 1196
     }
1197 1197
 
@@ -1201,7 +1201,7 @@  discard block
 block discarded – undo
1201 1201
     * @return Array the spotter information
1202 1202
     *
1203 1203
     */
1204
-    public function getMarineDataByAirport($airport = '', $limit = '', $sort = '',$filters = array())
1204
+    public function getMarineDataByAirport($airport = '', $limit = '', $sort = '', $filters = array())
1205 1205
     {
1206 1206
 	global $global_query;
1207 1207
 	$Marine = new Marine($this->db);
@@ -1209,7 +1209,7 @@  discard block
 block discarded – undo
1209 1209
 	$query_values = array();
1210 1210
 	$limit_query = '';
1211 1211
 	$additional_query = '';
1212
-	$filter_query = $this->getFilter($filters,true,true);
1212
+	$filter_query = $this->getFilter($filters, true, true);
1213 1213
 	
1214 1214
 	if ($airport != "")
1215 1215
 	{
@@ -1226,8 +1226,8 @@  discard block
 block discarded – undo
1226 1226
 	{
1227 1227
 	    $limit_array = explode(",", $limit);
1228 1228
 	    
1229
-	    $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1230
-	    $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1229
+	    $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1230
+	    $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1231 1231
 	    
1232 1232
 	    if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1233 1233
 	    {
Please login to merge, or discard this patch.
require/class.MarineLive.php 1 patch
Spacing   +114 added lines, -114 removed lines patch added patch discarded remove patch
@@ -17,33 +17,33 @@  discard block
 block discarded – undo
17 17
 	* @param Array $filter the filter
18 18
 	* @return Array the SQL part
19 19
 	*/
20
-	public function getFilter($filter = array(),$where = false,$and = false) {
20
+	public function getFilter($filter = array(), $where = false, $and = false) {
21 21
 		global $globalFilter, $globalStatsFilters, $globalFilterName, $globalDBdriver;
22 22
 		$filters = array();
23 23
 		if (is_array($globalStatsFilters) && isset($globalStatsFilters[$globalFilterName])) {
24 24
 			if (isset($globalStatsFilters[$globalFilterName][0]['source'])) {
25 25
 				$filters = $globalStatsFilters[$globalFilterName];
26 26
 			} else {
27
-				$filter = array_merge($filter,$globalStatsFilters[$globalFilterName]);
27
+				$filter = array_merge($filter, $globalStatsFilters[$globalFilterName]);
28 28
 			}
29 29
 		}
30 30
 		if (isset($filter[0]['source'])) {
31
-			$filters = array_merge($filters,$filter);
31
+			$filters = array_merge($filters, $filter);
32 32
 		}
33
-		if (is_array($globalFilter)) $filter = array_merge($filter,$globalFilter);
33
+		if (is_array($globalFilter)) $filter = array_merge($filter, $globalFilter);
34 34
 		$filter_query_join = '';
35 35
 		$filter_query_where = '';
36
-		foreach($filters as $flt) {
36
+		foreach ($filters as $flt) {
37 37
 			if (isset($flt['idents']) && !empty($flt['idents'])) {
38 38
 				if (isset($flt['source'])) {
39
-					$filter_query_join .= " INNER JOIN (SELECT fammarine_id FROM marine_output WHERE marine_output.ident IN ('".implode("','",$flt['idents'])."') AND marine_output.format_source IN ('".implode("','",$flt['source'])."')) spid ON spid.fammarine_id = marine_live.fammarine_id";
39
+					$filter_query_join .= " INNER JOIN (SELECT fammarine_id FROM marine_output WHERE marine_output.ident IN ('".implode("','", $flt['idents'])."') AND marine_output.format_source IN ('".implode("','", $flt['source'])."')) spid ON spid.fammarine_id = marine_live.fammarine_id";
40 40
 				} else {
41
-					$filter_query_join .= " INNER JOIN (SELECT fammarine_id FROM marine_output WHERE marine_output.ident IN ('".implode("','",$flt['idents'])."')) spid ON spid.fammarine_id = marine_live.fammarine_id";
41
+					$filter_query_join .= " INNER JOIN (SELECT fammarine_id FROM marine_output WHERE marine_output.ident IN ('".implode("','", $flt['idents'])."')) spid ON spid.fammarine_id = marine_live.fammarine_id";
42 42
 				}
43 43
 			}
44 44
 		}
45 45
 		if (isset($filter['source']) && !empty($filter['source'])) {
46
-			$filter_query_where .= " AND format_source IN ('".implode("','",$filter['source'])."')";
46
+			$filter_query_where .= " AND format_source IN ('".implode("','", $filter['source'])."')";
47 47
 		}
48 48
 		if (isset($filter['ident']) && !empty($filter['ident'])) {
49 49
 			$filter_query_where .= " AND ident = '".$filter['ident']."'";
@@ -75,15 +75,15 @@  discard block
 block discarded – undo
75 75
 					$filter_query_date .= " AND EXTRACT(DAY FROM marine_output.date) = '".$filter['day']."'";
76 76
 				}
77 77
 			}
78
-			$filter_query_join .= " INNER JOIN (SELECT fammarine_id FROM marine_output".preg_replace('/^ AND/',' WHERE',$filter_query_date).") sd ON sd.fammarine_id = marine_live.fammarine_id";
78
+			$filter_query_join .= " INNER JOIN (SELECT fammarine_id FROM marine_output".preg_replace('/^ AND/', ' WHERE', $filter_query_date).") sd ON sd.fammarine_id = marine_live.fammarine_id";
79 79
 		}
80 80
 		if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) {
81
-			$filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')";
81
+			$filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','", $filter['source_aprs'])."')";
82 82
 		}
83 83
 		if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE';
84 84
 		elseif ($filter_query_where != '' && $and) $filter_query_where .= ' AND';
85 85
 		if ($filter_query_where != '') {
86
-			$filter_query_where = preg_replace('/^ AND/',' WHERE',$filter_query_where);
86
+			$filter_query_where = preg_replace('/^ AND/', ' WHERE', $filter_query_where);
87 87
 		}
88 88
 		$filter_query = $filter_query_join.$filter_query_where;
89 89
 		return $filter_query;
@@ -106,8 +106,8 @@  discard block
 block discarded – undo
106 106
 		if ($limit != '')
107 107
 		{
108 108
 			$limit_array = explode(',', $limit);
109
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
110
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
109
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
110
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
111 111
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
112 112
 			{
113 113
 				$limit_query = ' LIMIT '.$limit_array[1].' OFFSET '.$limit_array[0];
@@ -122,7 +122,7 @@  discard block
 block discarded – undo
122 122
 				$orderby_query = ' '.$search_orderby_array[$sort]['sql'];
123 123
 			}
124 124
 		}
125
-		if ($orderby_query == '') $orderby_query= ' ORDER BY date DESC';
125
+		if ($orderby_query == '') $orderby_query = ' ORDER BY date DESC';
126 126
 
127 127
 		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
128 128
 		if ($globalDBdriver == 'mysql') {
@@ -131,7 +131,7 @@  discard block
 block discarded – undo
131 131
 		} else {
132 132
 			$query  = "SELECT marine_live.* FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l WHERE CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= l.date GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate".$filter_query.$orderby_query;
133 133
 		}
134
-		$spotter_array = $Marine->getDataFromDB($query.$limit_query,array(),'',true);
134
+		$spotter_array = $Marine->getDataFromDB($query.$limit_query, array(), '', true);
135 135
 
136 136
 		return $spotter_array;
137 137
 	}
@@ -147,7 +147,7 @@  discard block
 block discarded – undo
147 147
 		global $globalDBdriver, $globalLiveInterval;
148 148
 		date_default_timezone_set('UTC');
149 149
 
150
-		$filter_query = $this->getFilter($filter,true,true);
150
+		$filter_query = $this->getFilter($filter, true, true);
151 151
 
152 152
 		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
153 153
 		if ($globalDBdriver == 'mysql') {
@@ -161,7 +161,7 @@  discard block
 block discarded – undo
161 161
 		try {
162 162
 			$sth = $this->db->prepare($query);
163 163
 			$sth->execute();
164
-		} catch(PDOException $e) {
164
+		} catch (PDOException $e) {
165 165
 			echo $e->getMessage();
166 166
 			die;
167 167
 		}
@@ -176,19 +176,19 @@  discard block
 block discarded – undo
176 176
 	* @return Array the spotter information
177 177
 	*
178 178
 	*/
179
-	public function getMinLastLiveMarineData($coord = array(),$filter = array(), $limit = false)
179
+	public function getMinLastLiveMarineData($coord = array(), $filter = array(), $limit = false)
180 180
 	{
181 181
 		global $globalDBdriver, $globalLiveInterval, $globalMap3DMarinesLimit, $globalArchive;
182 182
 		date_default_timezone_set('UTC');
183 183
 		$usecoord = false;
184 184
 		if (is_array($coord) && !empty($coord)) {
185
-			$minlong = filter_var($coord[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
186
-			$minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
187
-			$maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
188
-			$maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
185
+			$minlong = filter_var($coord[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
186
+			$minlat = filter_var($coord[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
187
+			$maxlong = filter_var($coord[2], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
188
+			$maxlat = filter_var($coord[3], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
189 189
 			$usecoord = true;
190 190
 		}
191
-		$filter_query = $this->getFilter($filter,true,true);
191
+		$filter_query = $this->getFilter($filter, true, true);
192 192
 
193 193
 		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
194 194
 		if (!isset($globalMap3DMarinesLimit) || $globalMap3DMarinesLimit == '') $globalMap3DMarinesLimit = '300';
@@ -237,7 +237,7 @@  discard block
 block discarded – undo
237 237
 		try {
238 238
 			$sth = $this->db->prepare($query);
239 239
 			$sth->execute();
240
-		} catch(PDOException $e) {
240
+		} catch (PDOException $e) {
241 241
 			echo $e->getMessage();
242 242
 			die;
243 243
 		}
@@ -254,7 +254,7 @@  discard block
 block discarded – undo
254 254
 	public function getLiveMarineCount($filter = array())
255 255
 	{
256 256
 		global $globalDBdriver, $globalLiveInterval;
257
-		$filter_query = $this->getFilter($filter,true,true);
257
+		$filter_query = $this->getFilter($filter, true, true);
258 258
 
259 259
 		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
260 260
 		if ($globalDBdriver == 'mysql') {
@@ -265,7 +265,7 @@  discard block
 block discarded – undo
265 265
 		try {
266 266
 			$sth = $this->db->prepare($query);
267 267
 			$sth->execute();
268
-		} catch(PDOException $e) {
268
+		} catch (PDOException $e) {
269 269
 			echo $e->getMessage();
270 270
 			die;
271 271
 		}
@@ -288,10 +288,10 @@  discard block
 block discarded – undo
288 288
 		$filter_query = $this->getFilter($filter);
289 289
 
290 290
 		if (is_array($coord)) {
291
-			$minlong = filter_var($coord[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
292
-			$minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
293
-			$maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
294
-			$maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
291
+			$minlong = filter_var($coord[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
292
+			$minlat = filter_var($coord[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
293
+			$maxlong = filter_var($coord[2], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
294
+			$maxlat = filter_var($coord[3], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
295 295
 		} else return array();
296 296
 		if ($globalDBdriver == 'mysql') {
297 297
 			$query  = 'SELECT marine_live.* FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate AND marine_live.latitude BETWEEN '.$minlat.' AND '.$maxlat.' AND marine_live.longitude BETWEEN '.$minlong.' AND '.$maxlong.' GROUP BY marine_live.fammarine_id'.$filter_query;
@@ -313,13 +313,13 @@  discard block
 block discarded – undo
313 313
 		global $globalDBdriver, $globalLiveInterval, $globalArchive;
314 314
 		$Marine = new Marine($this->db);
315 315
 		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
316
-		$filter_query = $this->getFilter($filter,true,true);
316
+		$filter_query = $this->getFilter($filter, true, true);
317 317
 
318 318
 		if (is_array($coord)) {
319
-			$minlong = filter_var($coord[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
320
-			$minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
321
-			$maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
322
-			$maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
319
+			$minlong = filter_var($coord[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
320
+			$minlat = filter_var($coord[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
321
+			$maxlong = filter_var($coord[2], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
322
+			$maxlat = filter_var($coord[3], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
323 323
 		} else return array();
324 324
 		/*
325 325
 		if ($globalDBdriver == 'mysql') {
@@ -334,13 +334,13 @@  discard block
 block discarded – undo
334 334
 		*/
335 335
 		if ($globalDBdriver == 'mysql') {
336 336
 			if (isset($globalArchive) && $globalArchive === TRUE) {
337
-				$query  = 'SELECT marine_live.ident, marine_live.fammarine_id,marine_live.type, marine_live.latitude, marine_live.longitude, marine_live.heading, marine_live.ground_speed, marine_live.date, marine_live.format_source 
337
+				$query = 'SELECT marine_live.ident, marine_live.fammarine_id,marine_live.type, marine_live.latitude, marine_live.longitude, marine_live.heading, marine_live.ground_speed, marine_live.date, marine_live.format_source 
338 338
 				    FROM marine_live 
339 339
 				    '.$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= marine_live.date 
340 340
 				    AND marine_live.latitude BETWEEN '.$minlat.' AND '.$maxlat.' AND marine_live.longitude BETWEEN '.$minlong.' AND '.$maxlong.'
341 341
 				    AND marine_live.latitude <> 0 AND marine_live.longitude <> 0';
342 342
 			} else {
343
-				$query  = 'SELECT marine_live.ident, marine_live.fammarine_id,marine_live.type, marine_live.latitude, marine_live.longitude, marine_live.heading, marine_live.ground_speed, marine_live.date, marine_live.format_source 
343
+				$query = 'SELECT marine_live.ident, marine_live.fammarine_id,marine_live.type, marine_live.latitude, marine_live.longitude, marine_live.heading, marine_live.ground_speed, marine_live.date, marine_live.format_source 
344 344
 				    FROM marine_live 
345 345
 				    INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate 
346 346
 				    FROM marine_live l 
@@ -352,14 +352,14 @@  discard block
 block discarded – undo
352 352
 			}
353 353
 		} else {
354 354
 			if (isset($globalArchive) && $globalArchive === TRUE) {
355
-				$query  = "SELECT marine_live.ident, marine_live.fammarine_id,marine_live.type, marine_live.latitude, marine_live.longitude, marine_live.heading, marine_live.ground_speed, marine_live.date, marine_live.format_source 
355
+				$query = "SELECT marine_live.ident, marine_live.fammarine_id,marine_live.type, marine_live.latitude, marine_live.longitude, marine_live.heading, marine_live.ground_speed, marine_live.date, marine_live.format_source 
356 356
 				    FROM marine_live 
357 357
 				    ".$filter_query." CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= marine_live.date 
358 358
 				    AND marine_live.latitude BETWEEN ".$minlat." AND ".$maxlat." 
359 359
 				    AND marine_live.longitude BETWEEN ".$minlong." AND ".$maxlong." 
360 360
 				    AND marine_live.latitude <> '0' AND marine_live.longitude <> '0'";
361 361
 			} else {
362
-				$query  = "SELECT marine_live.ident, marine_live.fammarine_id,marine_live.type, marine_live.latitude, marine_live.longitude, marine_live.heading, marine_live.ground_speed, marine_live.date, marine_live.format_source 
362
+				$query = "SELECT marine_live.ident, marine_live.fammarine_id,marine_live.type, marine_live.latitude, marine_live.longitude, marine_live.heading, marine_live.ground_speed, marine_live.date, marine_live.format_source 
363 363
 				    FROM marine_live 
364 364
 				    INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate 
365 365
 				    FROM marine_live l 
@@ -416,7 +416,7 @@  discard block
 block discarded – undo
416 416
                 if ($interval == '1m')
417 417
                 {
418 418
                     $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= marine_live.date ';
419
-                } else if ($interval == '15m'){
419
+                } else if ($interval == '15m') {
420 420
                     $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 15 MINUTE) <= marine_live.date ';
421 421
                 } 
422 422
             }
@@ -424,14 +424,14 @@  discard block
 block discarded – undo
424 424
          $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= marine_live.date ';   
425 425
         }
426 426
 
427
-                $query  = "SELECT marine_live.*, ( 6371 * acos( cos( radians(:lat) ) * cos( radians( latitude ) ) * cos( radians( longitude ) - radians(:lng) ) + sin( radians(:lat) ) * sin( radians( latitude ) ) ) ) AS distance FROM marine_live 
427
+                $query = "SELECT marine_live.*, ( 6371 * acos( cos( radians(:lat) ) * cos( radians( latitude ) ) * cos( radians( longitude ) - radians(:lng) ) + sin( radians(:lat) ) * sin( radians( latitude ) ) ) ) AS distance FROM marine_live 
428 428
                    WHERE marine_live.latitude <> '' 
429 429
                                    AND marine_live.longitude <> '' 
430 430
                    ".$additional_query."
431 431
                    HAVING distance < :radius  
432 432
                                    ORDER BY distance";
433 433
 
434
-                $spotter_array = $Marine->getDataFromDB($query, array(':lat' => $lat, ':lng' => $lng,':radius' => $radius));
434
+                $spotter_array = $Marine->getDataFromDB($query, array(':lat' => $lat, ':lng' => $lng, ':radius' => $radius));
435 435
 
436 436
                 return $spotter_array;
437 437
         }
@@ -449,9 +449,9 @@  discard block
 block discarded – undo
449 449
 		date_default_timezone_set('UTC');
450 450
 
451 451
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
452
-                $query  = 'SELECT marine_live.* FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l WHERE l.ident = :ident GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate ORDER BY marine_live.date DESC';
452
+                $query = 'SELECT marine_live.* FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l WHERE l.ident = :ident GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate ORDER BY marine_live.date DESC';
453 453
 
454
-		$spotter_array = $Marine->getDataFromDB($query,array(':ident' => $ident),'',true);
454
+		$spotter_array = $Marine->getDataFromDB($query, array(':ident' => $ident), '', true);
455 455
 
456 456
 		return $spotter_array;
457 457
 	}
@@ -462,14 +462,14 @@  discard block
 block discarded – undo
462 462
 	* @return Array the spotter information
463 463
 	*
464 464
 	*/
465
-	public function getDateLiveMarineDataByIdent($ident,$date)
465
+	public function getDateLiveMarineDataByIdent($ident, $date)
466 466
 	{
467 467
 		$Marine = new Marine($this->db);
468 468
 		date_default_timezone_set('UTC');
469 469
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
470 470
 		$query  = 'SELECT marine_live.* FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l WHERE l.ident = :ident AND l.date <= :date GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate ORDER BY marine_live.date DESC';
471
-		$date = date('c',$date);
472
-		$spotter_array = $Marine->getDataFromDB($query,array(':ident' => $ident,':date' => $date));
471
+		$date = date('c', $date);
472
+		$spotter_array = $Marine->getDataFromDB($query, array(':ident' => $ident, ':date' => $date));
473 473
 		return $spotter_array;
474 474
 	}
475 475
 
@@ -479,14 +479,14 @@  discard block
 block discarded – undo
479 479
 	* @return Array the spotter information
480 480
 	*
481 481
 	*/
482
-	public function getDateLiveMarineDataByMMSI($mmsi,$date)
482
+	public function getDateLiveMarineDataByMMSI($mmsi, $date)
483 483
 	{
484 484
 		$Marine = new Marine($this->db);
485 485
 		date_default_timezone_set('UTC');
486 486
 		$mmsi = filter_var($mmsi, FILTER_SANITIZE_NUMBER_INT);
487 487
 		$query  = 'SELECT marine_live.* FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l WHERE l.mmsi = :mmsi AND l.date <= :date GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate ORDER BY marine_live.date DESC';
488
-		$date = date('c',$date);
489
-		$spotter_array = $Marine->getDataFromDB($query,array(':mmsi' => $mmsi,':date' => $date));
488
+		$date = date('c', $date);
489
+		$spotter_array = $Marine->getDataFromDB($query, array(':mmsi' => $mmsi, ':date' => $date));
490 490
 		return $spotter_array;
491 491
 	}
492 492
 
@@ -502,9 +502,9 @@  discard block
 block discarded – undo
502 502
 		date_default_timezone_set('UTC');
503 503
 
504 504
 		$id = filter_var($id, FILTER_SANITIZE_STRING);
505
-                $query  = 'SELECT marine_live.* FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l WHERE l.fammarine_id = :id GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate ORDER BY marine_live.date DESC';
505
+                $query = 'SELECT marine_live.* FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l WHERE l.fammarine_id = :id GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate ORDER BY marine_live.date DESC';
506 506
 
507
-		$spotter_array = $Marine->getDataFromDB($query,array(':id' => $id),'',true);
507
+		$spotter_array = $Marine->getDataFromDB($query, array(':id' => $id), '', true);
508 508
 
509 509
 		return $spotter_array;
510 510
 	}
@@ -515,15 +515,15 @@  discard block
 block discarded – undo
515 515
 	* @return Array the spotter information
516 516
 	*
517 517
 	*/
518
-	public function getDateLiveMarineDataById($id,$date)
518
+	public function getDateLiveMarineDataById($id, $date)
519 519
 	{
520 520
 		$Marine = new Marine($this->db);
521 521
 		date_default_timezone_set('UTC');
522 522
 
523 523
 		$id = filter_var($id, FILTER_SANITIZE_STRING);
524
-                $query  = 'SELECT marine_live.* FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l WHERE l.fammarine_id = :id AND l.date <= :date GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate ORDER BY marine_live.date DESC';
525
-                $date = date('c',$date);
526
-		$spotter_array = $Marine->getDataFromDB($query,array(':id' => $id,':date' => $date),'',true);
524
+                $query = 'SELECT marine_live.* FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l WHERE l.fammarine_id = :id AND l.date <= :date GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate ORDER BY marine_live.date DESC';
525
+                $date = date('c', $date);
526
+		$spotter_array = $Marine->getDataFromDB($query, array(':id' => $id, ':date' => $date), '', true);
527 527
 
528 528
 		return $spotter_array;
529 529
 	}
@@ -535,7 +535,7 @@  discard block
 block discarded – undo
535 535
 	* @return Array the spotter information
536 536
 	*
537 537
 	*/
538
-	public function getAllLiveMarineDataById($id,$liveinterval = false)
538
+	public function getAllLiveMarineDataById($id, $liveinterval = false)
539 539
 	{
540 540
 		global $globalDBdriver, $globalLiveInterval;
541 541
 		date_default_timezone_set('UTC');
@@ -554,7 +554,7 @@  discard block
 block discarded – undo
554 554
 		try {
555 555
 			$sth = $this->db->prepare($query);
556 556
 			$sth->execute(array(':id' => $id));
557
-		} catch(PDOException $e) {
557
+		} catch (PDOException $e) {
558 558
 			echo $e->getMessage();
559 559
 			die;
560 560
 		}
@@ -572,12 +572,12 @@  discard block
 block discarded – undo
572 572
 	{
573 573
 		date_default_timezone_set('UTC');
574 574
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
575
-		$query  = self::$global_query.' WHERE marine_live.ident = :ident';
575
+		$query = self::$global_query.' WHERE marine_live.ident = :ident';
576 576
     		try {
577 577
 			
578 578
 			$sth = $this->db->prepare($query);
579 579
 			$sth->execute(array(':ident' => $ident));
580
-		} catch(PDOException $e) {
580
+		} catch (PDOException $e) {
581 581
 			echo $e->getMessage();
582 582
 			die;
583 583
 		}
@@ -607,7 +607,7 @@  discard block
 block discarded – undo
607 607
 			
608 608
 			$sth = $this->db->prepare($query);
609 609
 			$sth->execute();
610
-		} catch(PDOException $e) {
610
+		} catch (PDOException $e) {
611 611
 			return "error";
612 612
 		}
613 613
 
@@ -630,14 +630,14 @@  discard block
 block discarded – undo
630 630
 				
631 631
 				$sth = $this->db->prepare($query);
632 632
 				$sth->execute();
633
-			} catch(PDOException $e) {
633
+			} catch (PDOException $e) {
634 634
 				return "error";
635 635
 			}
636 636
 			$query_delete = 'DELETE FROM marine_live WHERE fammarine_id IN (';
637 637
                         $i = 0;
638
-                        $j =0;
638
+                        $j = 0;
639 639
 			$all = $sth->fetchAll(PDO::FETCH_ASSOC);
640
-			foreach($all as $row)
640
+			foreach ($all as $row)
641 641
 			{
642 642
 				$i++;
643 643
 				$j++;
@@ -645,9 +645,9 @@  discard block
 block discarded – undo
645 645
 					if ($globalDebug) echo ".";
646 646
 				    	try {
647 647
 						
648
-						$sth = $this->db->prepare(substr($query_delete,0,-1).")");
648
+						$sth = $this->db->prepare(substr($query_delete, 0, -1).")");
649 649
 						$sth->execute();
650
-					} catch(PDOException $e) {
650
+					} catch (PDOException $e) {
651 651
 						return "error";
652 652
 					}
653 653
                                 	$query_delete = 'DELETE FROM marine_live WHERE fammarine_id IN (';
@@ -658,9 +658,9 @@  discard block
 block discarded – undo
658 658
 			if ($i > 0) {
659 659
     				try {
660 660
 					
661
-					$sth = $this->db->prepare(substr($query_delete,0,-1).")");
661
+					$sth = $this->db->prepare(substr($query_delete, 0, -1).")");
662 662
 					$sth->execute();
663
-				} catch(PDOException $e) {
663
+				} catch (PDOException $e) {
664 664
 					return "error";
665 665
 				}
666 666
 			}
@@ -673,7 +673,7 @@  discard block
 block discarded – undo
673 673
 				
674 674
 				$sth = $this->db->prepare($query);
675 675
 				$sth->execute();
676
-			} catch(PDOException $e) {
676
+			} catch (PDOException $e) {
677 677
 				return "error";
678 678
 			}
679 679
 /*			$query_delete = "DELETE FROM marine_live WHERE fammarine_id IN (";
@@ -721,13 +721,13 @@  discard block
 block discarded – undo
721 721
 	public function deleteLiveMarineDataByIdent($ident)
722 722
 	{
723 723
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
724
-		$query  = 'DELETE FROM marine_live WHERE ident = :ident';
724
+		$query = 'DELETE FROM marine_live WHERE ident = :ident';
725 725
         
726 726
     		try {
727 727
 			
728 728
 			$sth = $this->db->prepare($query);
729 729
 			$sth->execute(array(':ident' => $ident));
730
-		} catch(PDOException $e) {
730
+		} catch (PDOException $e) {
731 731
 			return "error";
732 732
 		}
733 733
 
@@ -743,13 +743,13 @@  discard block
 block discarded – undo
743 743
 	public function deleteLiveMarineDataById($id)
744 744
 	{
745 745
 		$id = filter_var($id, FILTER_SANITIZE_STRING);
746
-		$query  = 'DELETE FROM marine_live WHERE fammarine_id = :id';
746
+		$query = 'DELETE FROM marine_live WHERE fammarine_id = :id';
747 747
         
748 748
     		try {
749 749
 			
750 750
 			$sth = $this->db->prepare($query);
751 751
 			$sth->execute(array(':id' => $id));
752
-		} catch(PDOException $e) {
752
+		} catch (PDOException $e) {
753 753
 			return "error";
754 754
 		}
755 755
 
@@ -767,13 +767,13 @@  discard block
 block discarded – undo
767 767
 	{
768 768
 		global $globalDBdriver, $globalTimezone;
769 769
 		if ($globalDBdriver == 'mysql') {
770
-			$query  = 'SELECT marine_live.ident FROM marine_live 
770
+			$query = 'SELECT marine_live.ident FROM marine_live 
771 771
 				WHERE marine_live.ident = :ident 
772 772
 				AND marine_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 HOUR) 
773 773
 				AND marine_live.date < UTC_TIMESTAMP()';
774 774
 			$query_data = array(':ident' => $ident);
775 775
 		} else {
776
-			$query  = "SELECT marine_live.ident FROM marine_live 
776
+			$query = "SELECT marine_live.ident FROM marine_live 
777 777
 				WHERE marine_live.ident = :ident 
778 778
 				AND marine_live.date >= now() AT TIME ZONE 'UTC' - INTERVAL '1 HOURS'
779 779
 				AND marine_live.date < now() AT TIME ZONE 'UTC'";
@@ -782,8 +782,8 @@  discard block
 block discarded – undo
782 782
 		
783 783
 		$sth = $this->db->prepare($query);
784 784
 		$sth->execute($query_data);
785
-		$ident_result='';
786
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
785
+		$ident_result = '';
786
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
787 787
 		{
788 788
 			$ident_result = $row['ident'];
789 789
 		}
@@ -800,13 +800,13 @@  discard block
 block discarded – undo
800 800
 	{
801 801
 		global $globalDBdriver, $globalTimezone;
802 802
 		if ($globalDBdriver == 'mysql') {
803
-			$query  = 'SELECT marine_live.ident, marine_live.fammarine_id FROM marine_live 
803
+			$query = 'SELECT marine_live.ident, marine_live.fammarine_id FROM marine_live 
804 804
 				WHERE marine_live.ident = :ident 
805 805
 				AND marine_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 30 MINUTE)'; 
806 806
 //				AND marine_live.date < UTC_TIMESTAMP()";
807 807
 			$query_data = array(':ident' => $ident);
808 808
 		} else {
809
-			$query  = "SELECT marine_live.ident, marine_live.fammarine_id FROM marine_live 
809
+			$query = "SELECT marine_live.ident, marine_live.fammarine_id FROM marine_live 
810 810
 				WHERE marine_live.ident = :ident 
811 811
 				AND marine_live.date >= now() AT TIME ZONE 'UTC' - INTERVAL '30 MINUTES'";
812 812
 //				AND marine_live.date < now() AT TIME ZONE 'UTC'";
@@ -815,8 +815,8 @@  discard block
 block discarded – undo
815 815
 		
816 816
 		$sth = $this->db->prepare($query);
817 817
 		$sth->execute($query_data);
818
-		$ident_result='';
819
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
818
+		$ident_result = '';
819
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
820 820
 		{
821 821
 			$ident_result = $row['fammarine_id'];
822 822
 		}
@@ -833,13 +833,13 @@  discard block
 block discarded – undo
833 833
 	{
834 834
 		global $globalDBdriver, $globalTimezone;
835 835
 		if ($globalDBdriver == 'mysql') {
836
-			$query  = 'SELECT marine_live.ident, marine_live.fammarine_id FROM marine_live 
836
+			$query = 'SELECT marine_live.ident, marine_live.fammarine_id FROM marine_live 
837 837
 				WHERE marine_live.fammarine_id = :id 
838 838
 				AND marine_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 10 HOUR)'; 
839 839
 //				AND marine_live.date < UTC_TIMESTAMP()";
840 840
 			$query_data = array(':id' => $id);
841 841
 		} else {
842
-			$query  = "SELECT marine_live.ident, marine_live.fammarine_id FROM marine_live 
842
+			$query = "SELECT marine_live.ident, marine_live.fammarine_id FROM marine_live 
843 843
 				WHERE marine_live.fammarine_id = :id 
844 844
 				AND marine_live.date >= now() AT TIME ZONE 'UTC' - INTERVAL '10 HOUR'";
845 845
 //				AND marine_live.date < now() AT TIME ZONE 'UTC'";
@@ -848,8 +848,8 @@  discard block
 block discarded – undo
848 848
 		
849 849
 		$sth = $this->db->prepare($query);
850 850
 		$sth->execute($query_data);
851
-		$ident_result='';
852
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
851
+		$ident_result = '';
852
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
853 853
 		{
854 854
 			$ident_result = $row['fammarine_id'];
855 855
 		}
@@ -866,13 +866,13 @@  discard block
 block discarded – undo
866 866
 	{
867 867
 		global $globalDBdriver, $globalTimezone;
868 868
 		if ($globalDBdriver == 'mysql') {
869
-			$query  = 'SELECT marine_live.fammarine_id FROM marine_live 
869
+			$query = 'SELECT marine_live.fammarine_id FROM marine_live 
870 870
 				WHERE marine_live.mmsi = :mmsi 
871 871
 				AND marine_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 10 HOUR)'; 
872 872
 //				AND marine_live.date < UTC_TIMESTAMP()";
873 873
 			$query_data = array(':mmsi' => $mmsi);
874 874
 		} else {
875
-			$query  = "SELECT marine_live.fammarine_id FROM marine_live 
875
+			$query = "SELECT marine_live.fammarine_id FROM marine_live 
876 876
 				WHERE marine_live.mmsi = :mmsi 
877 877
 				AND marine_live.date >= now() AT TIME ZONE 'UTC' - INTERVAL '10 HOUR'";
878 878
 //				AND marine_live.date < now() AT TIME ZONE 'UTC'";
@@ -881,8 +881,8 @@  discard block
 block discarded – undo
881 881
 		
882 882
 		$sth = $this->db->prepare($query);
883 883
 		$sth->execute($query_data);
884
-		$ident_result='';
885
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
884
+		$ident_result = '';
885
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
886 886
 		{
887 887
 			$ident_result = $row['fammarine_id'];
888 888
 		}
@@ -900,7 +900,7 @@  discard block
 block discarded – undo
900 900
 	* @return String success or false
901 901
 	*
902 902
 	*/
903
-	public function addLiveMarineData($fammarine_id = '', $ident = '', $latitude = '', $longitude = '', $heading = '', $groundspeed = '', $date = '', $putinarchive = false, $mmsi = '',$type = '',$typeid = '',$imo = '', $callsign = '',$arrival_code = '',$arrival_date = '',$status = '',$statusid = '',$noarchive = false,$format_source = '', $source_name = '', $over_country = '')
903
+	public function addLiveMarineData($fammarine_id = '', $ident = '', $latitude = '', $longitude = '', $heading = '', $groundspeed = '', $date = '', $putinarchive = false, $mmsi = '', $type = '', $typeid = '', $imo = '', $callsign = '', $arrival_code = '', $arrival_date = '', $status = '', $statusid = '', $noarchive = false, $format_source = '', $source_name = '', $over_country = '')
904 904
 	{
905 905
 		global $globalURL, $globalArchive, $globalDebug;
906 906
 		$Common = new Common();
@@ -952,29 +952,29 @@  discard block
 block discarded – undo
952 952
 		if ($date == '') $date = date("Y-m-d H:i:s", time());
953 953
 
954 954
         
955
-		$fammarine_id = filter_var($fammarine_id,FILTER_SANITIZE_STRING);
956
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
957
-		$latitude = filter_var($latitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
958
-		$longitude = filter_var($longitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
959
-		$heading = filter_var($heading,FILTER_SANITIZE_NUMBER_INT);
960
-		$groundspeed = filter_var($groundspeed,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
961
-		$format_source = filter_var($format_source,FILTER_SANITIZE_STRING);
962
-		$source_name = filter_var($source_name,FILTER_SANITIZE_STRING);
963
-		$over_country = filter_var($over_country,FILTER_SANITIZE_STRING);
964
-		$type = filter_var($type,FILTER_SANITIZE_STRING);
965
-		$typeid = filter_var($typeid,FILTER_SANITIZE_NUMBER_INT);
966
-		$mmsi = filter_var($mmsi,FILTER_SANITIZE_NUMBER_INT);
967
-		$status = filter_var($status,FILTER_SANITIZE_STRING);
968
-		$statusid = filter_var($statusid,FILTER_SANITIZE_NUMBER_INT);
969
-		$imo = filter_var($imo,FILTER_SANITIZE_STRING);
970
-		$callsign = filter_var($callsign,FILTER_SANITIZE_STRING);
971
-		$arrival_code = filter_var($arrival_code,FILTER_SANITIZE_STRING);
972
-		$arrival_date = filter_var($arrival_date,FILTER_SANITIZE_STRING);
955
+		$fammarine_id = filter_var($fammarine_id, FILTER_SANITIZE_STRING);
956
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
957
+		$latitude = filter_var($latitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
958
+		$longitude = filter_var($longitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
959
+		$heading = filter_var($heading, FILTER_SANITIZE_NUMBER_INT);
960
+		$groundspeed = filter_var($groundspeed, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
961
+		$format_source = filter_var($format_source, FILTER_SANITIZE_STRING);
962
+		$source_name = filter_var($source_name, FILTER_SANITIZE_STRING);
963
+		$over_country = filter_var($over_country, FILTER_SANITIZE_STRING);
964
+		$type = filter_var($type, FILTER_SANITIZE_STRING);
965
+		$typeid = filter_var($typeid, FILTER_SANITIZE_NUMBER_INT);
966
+		$mmsi = filter_var($mmsi, FILTER_SANITIZE_NUMBER_INT);
967
+		$status = filter_var($status, FILTER_SANITIZE_STRING);
968
+		$statusid = filter_var($statusid, FILTER_SANITIZE_NUMBER_INT);
969
+		$imo = filter_var($imo, FILTER_SANITIZE_STRING);
970
+		$callsign = filter_var($callsign, FILTER_SANITIZE_STRING);
971
+		$arrival_code = filter_var($arrival_code, FILTER_SANITIZE_STRING);
972
+		$arrival_date = filter_var($arrival_date, FILTER_SANITIZE_STRING);
973 973
 		if ($typeid == '') $typeid = NULL;
974 974
 		if ($statusid == '') $statusid = NULL;
975 975
 
976
-            	if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) $groundspeed = 0;
977
-            	if ($heading == '' || $Common->isInteger($heading) === false ) $heading = 0;
976
+            	if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0;
977
+            	if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0;
978 978
             	if ($arrival_date == '') $arrival_date = NULL;
979 979
             	$query = '';
980 980
 		if ($globalArchive) {
@@ -983,19 +983,19 @@  discard block
 block discarded – undo
983 983
 		}
984 984
 		$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) 
985 985
 		    VALUES (:fammarine_id,:ident,:latitude,:longitude,:heading,:groundspeed,:date,:format_source, :source_name, :over_country,:mmsi,:type,:typeid,:status,:statusid,:imo,:arrival_port_name,:arrival_port_date)';
986
-		$query_values = array(':fammarine_id' => $fammarine_id,':ident' => $ident,':latitude' => $latitude,':longitude' => $longitude,':heading' => $heading,':groundspeed' => $groundspeed,':date' => $date, ':format_source' => $format_source, ':source_name' => $source_name, ':over_country' => $over_country,':mmsi' => $mmsi,':type' => $type,':typeid' => $typeid,':status' => $status,':statusid' => $statusid,':imo' => $imo,':arrival_port_name' => $arrival_code,':arrival_port_date' => $arrival_date);
986
+		$query_values = array(':fammarine_id' => $fammarine_id, ':ident' => $ident, ':latitude' => $latitude, ':longitude' => $longitude, ':heading' => $heading, ':groundspeed' => $groundspeed, ':date' => $date, ':format_source' => $format_source, ':source_name' => $source_name, ':over_country' => $over_country, ':mmsi' => $mmsi, ':type' => $type, ':typeid' => $typeid, ':status' => $status, ':statusid' => $statusid, ':imo' => $imo, ':arrival_port_name' => $arrival_code, ':arrival_port_date' => $arrival_date);
987 987
 		try {
988 988
 			$sth = $this->db->prepare($query);
989 989
 			$sth->execute($query_values);
990 990
 			$sth->closeCursor();
991
-		} catch(PDOException $e) {
991
+		} catch (PDOException $e) {
992 992
 			return "error : ".$e->getMessage();
993 993
 		}
994 994
 		
995 995
 		if (isset($globalArchive) && $globalArchive && $putinarchive && $noarchive !== true) {
996 996
 			if ($globalDebug) echo '(Add to Marine archive : ';
997 997
 			$MarineArchive = new MarineArchive($this->db);
998
-			$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);
998
+			$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);
999 999
 			if ($globalDebug) echo $result.')';
1000 1000
 		}
1001 1001
 		return "success";
@@ -1003,7 +1003,7 @@  discard block
 block discarded – undo
1003 1003
 
1004 1004
 	public function getOrderBy()
1005 1005
 	{
1006
-		$orderby = array("aircraft_asc" => array("key" => "aircraft_asc", "value" => "Aircraft Type - ASC", "sql" => "ORDER BY marine_live.aircraft_icao ASC"), "aircraft_desc" => array("key" => "aircraft_desc", "value" => "Aircraft Type - DESC", "sql" => "ORDER BY marine_live.aircraft_icao DESC"),"manufacturer_asc" => array("key" => "manufacturer_asc", "value" => "Aircraft Manufacturer - ASC", "sql" => "ORDER BY marine_live.aircraft_manufacturer ASC"), "manufacturer_desc" => array("key" => "manufacturer_desc", "value" => "Aircraft Manufacturer - DESC", "sql" => "ORDER BY marine_live.aircraft_manufacturer DESC"),"airline_name_asc" => array("key" => "airline_name_asc", "value" => "Airline Name - ASC", "sql" => "ORDER BY marine_live.airline_name ASC"), "airline_name_desc" => array("key" => "airline_name_desc", "value" => "Airline Name - DESC", "sql" => "ORDER BY marine_live.airline_name DESC"), "ident_asc" => array("key" => "ident_asc", "value" => "Ident - ASC", "sql" => "ORDER BY marine_live.ident ASC"), "ident_desc" => array("key" => "ident_desc", "value" => "Ident - DESC", "sql" => "ORDER BY marine_live.ident DESC"), "airport_departure_asc" => array("key" => "airport_departure_asc", "value" => "Departure Airport - ASC", "sql" => "ORDER BY marine_live.departure_airport_city ASC"), "airport_departure_desc" => array("key" => "airport_departure_desc", "value" => "Departure Airport - DESC", "sql" => "ORDER BY marine_live.departure_airport_city DESC"), "airport_arrival_asc" => array("key" => "airport_arrival_asc", "value" => "Arrival Airport - ASC", "sql" => "ORDER BY marine_live.arrival_airport_city ASC"), "airport_arrival_desc" => array("key" => "airport_arrival_desc", "value" => "Arrival Airport - DESC", "sql" => "ORDER BY marine_live.arrival_airport_city DESC"), "date_asc" => array("key" => "date_asc", "value" => "Date - ASC", "sql" => "ORDER BY marine_live.date ASC"), "date_desc" => array("key" => "date_desc", "value" => "Date - DESC", "sql" => "ORDER BY marine_live.date DESC"));
1006
+		$orderby = array("aircraft_asc" => array("key" => "aircraft_asc", "value" => "Aircraft Type - ASC", "sql" => "ORDER BY marine_live.aircraft_icao ASC"), "aircraft_desc" => array("key" => "aircraft_desc", "value" => "Aircraft Type - DESC", "sql" => "ORDER BY marine_live.aircraft_icao DESC"), "manufacturer_asc" => array("key" => "manufacturer_asc", "value" => "Aircraft Manufacturer - ASC", "sql" => "ORDER BY marine_live.aircraft_manufacturer ASC"), "manufacturer_desc" => array("key" => "manufacturer_desc", "value" => "Aircraft Manufacturer - DESC", "sql" => "ORDER BY marine_live.aircraft_manufacturer DESC"), "airline_name_asc" => array("key" => "airline_name_asc", "value" => "Airline Name - ASC", "sql" => "ORDER BY marine_live.airline_name ASC"), "airline_name_desc" => array("key" => "airline_name_desc", "value" => "Airline Name - DESC", "sql" => "ORDER BY marine_live.airline_name DESC"), "ident_asc" => array("key" => "ident_asc", "value" => "Ident - ASC", "sql" => "ORDER BY marine_live.ident ASC"), "ident_desc" => array("key" => "ident_desc", "value" => "Ident - DESC", "sql" => "ORDER BY marine_live.ident DESC"), "airport_departure_asc" => array("key" => "airport_departure_asc", "value" => "Departure Airport - ASC", "sql" => "ORDER BY marine_live.departure_airport_city ASC"), "airport_departure_desc" => array("key" => "airport_departure_desc", "value" => "Departure Airport - DESC", "sql" => "ORDER BY marine_live.departure_airport_city DESC"), "airport_arrival_asc" => array("key" => "airport_arrival_asc", "value" => "Arrival Airport - ASC", "sql" => "ORDER BY marine_live.arrival_airport_city ASC"), "airport_arrival_desc" => array("key" => "airport_arrival_desc", "value" => "Arrival Airport - DESC", "sql" => "ORDER BY marine_live.arrival_airport_city DESC"), "date_asc" => array("key" => "date_asc", "value" => "Date - ASC", "sql" => "ORDER BY marine_live.date ASC"), "date_desc" => array("key" => "date_desc", "value" => "Date - DESC", "sql" => "ORDER BY marine_live.date DESC"));
1007 1007
 		return $orderby;
1008 1008
 	}
1009 1009
 
Please login to merge, or discard this patch.
aircraft-statistics-registration.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -7,14 +7,14 @@  discard block
 block discarded – undo
7 7
         header('Location: '.$globalURL.'/aircraft');
8 8
         die();
9 9
 }
10
-$aircraft_type = filter_input(INPUT_GET,'aircraft_type',FILTER_SANITIZE_STRING);
10
+$aircraft_type = filter_input(INPUT_GET, 'aircraft_type', FILTER_SANITIZE_STRING);
11 11
 $Spotter = new Spotter();
12
-$spotter_array = $Spotter->getSpotterDataByAircraft($aircraft_type,"0,1","");
12
+$spotter_array = $Spotter->getSpotterDataByAircraft($aircraft_type, "0,1", "");
13 13
 
14 14
 
15 15
 if (!empty($spotter_array))
16 16
 {
17
-	$title = sprintf(_("Most Common Aircraft by Registration from %s (%s)"),$spotter_array[0]['aircraft_name'],$spotter_array[0]['aircraft_type']);
17
+	$title = sprintf(_("Most Common Aircraft by Registration from %s (%s)"), $spotter_array[0]['aircraft_name'], $spotter_array[0]['aircraft_type']);
18 18
 	require_once('header.php');
19 19
 	print '<div class="select-item">';
20 20
 	print '<form action="'.$globalURL.'/aircraft" method="get">';
@@ -23,9 +23,9 @@  discard block
 block discarded – undo
23 23
 	$Stats = new Stats();
24 24
 	$aircraft_types = $Stats->getAllAircraftTypes();
25 25
 	if (empty($aircraft_types)) $aircraft_types = $Spotter->getAllAircraftTypes();
26
-	foreach($aircraft_types as $aircrafttype)
26
+	foreach ($aircraft_types as $aircrafttype)
27 27
 	{
28
-		if($aircraft_type == $aircrafttype['aircraft_icao'])
28
+		if ($aircraft_type == $aircrafttype['aircraft_icao'])
29 29
 		{
30 30
 			print '<option value="'.$aircrafttype['aircraft_icao'].'" selected="selected">'.$aircrafttype['aircraft_name'].' ('.$aircrafttype['aircraft_icao'].')</option>';
31 31
 		} else {
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
 	include('aircraft-sub-menu.php');
52 52
 	print '<div class="column">';
53 53
 	print '<h2>'._("Most Common Aircraft by Registration").'</h2>';
54
-	print '<p>'.sprintf(_("The statistic below shows the most common aircraft by registration of flights from aircraft type <strong>%s (%s)</strong>."),$spotter_array[0]['aircraft_name'],$spotter_array[0]['aircraft_type']).'</p>';
54
+	print '<p>'.sprintf(_("The statistic below shows the most common aircraft by registration of flights from aircraft type <strong>%s (%s)</strong>."), $spotter_array[0]['aircraft_name'], $spotter_array[0]['aircraft_type']).'</p>';
55 55
 
56 56
 	$aircraft_array = $Spotter->countAllAircraftRegistrationByAircraft($aircraft_type);
57 57
 	if (!empty($aircraft_array))
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
 		print '</thead>';
69 69
 		print '<tbody>';
70 70
 		$i = 1;
71
-		foreach($aircraft_array as $aircraft_item)
71
+		foreach ($aircraft_array as $aircraft_item)
72 72
 		{
73 73
 			print '<tr>';
74 74
 			print '<td><strong>'.$i.'</strong></td>';
Please login to merge, or discard this patch.