Completed
Push — master ( e14a40...cfb98e )
by Yannick
54:46 queued 27:34
created
manufacturer-statistics-airline-country.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -22,7 +22,9 @@
 block discarded – undo
22 22
 	print '<select name="aircraft_manufacturer" class="selectpicker" data-live-search="true">';
23 23
 	$Stats = new Stats();
24 24
 	$all_manufacturers = $Stats->getAllManufacturers();
25
-	if (empty($all_manufacturers)) $all_manufacturers = $Spotter->getAllManufacturers();
25
+	if (empty($all_manufacturers)) {
26
+		$all_manufacturers = $Spotter->getAllManufacturers();
27
+	}
26 28
 	foreach($all_manufacturers as $all_manufacturer)
27 29
 	{
28 30
 		if($manufacturer == ucwords($all_manufacturer['aircraft_manufacturer']))
Please login to merge, or discard this patch.
manufacturer-statistics-aircraft.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -22,7 +22,9 @@
 block discarded – undo
22 22
 	print '<select name="aircraft_manufacturer" class="selectpicker" data-live-search="true">';
23 23
 	$Stats = new Stats();
24 24
 	$all_manufacturers = $Stats->getAllManufacturers();
25
-	if (empty($all_manufacturers)) $all_manufacturers = $Spotter->getAllManufacturers();
25
+	if (empty($all_manufacturers)) {
26
+		$all_manufacturers = $Spotter->getAllManufacturers();
27
+	}
26 28
 	foreach($all_manufacturers as $all_manufacturer)
27 29
 	{
28 30
 		if($manufacturer == ucwords($all_manufacturer['aircraft_manufacturer']))
Please login to merge, or discard this patch.
ident.php 1 patch
Braces   +12 added lines, -5 removed lines patch added patch discarded remove patch
@@ -1,13 +1,20 @@
 block discarded – undo
1 1
 <?php
2 2
 require_once(dirname(__FILE__).'/require/settings.php');
3 3
 $ident = '';
4
-if (isset($_POST['ident'])) $ident = filter_input(INPUT_POST,'ident',FILTER_SANITIZE_STRING);
5
-if (isset($_GET['ident'])) $ident = filter_input(INPUT_GET,'ident',FILTER_SANITIZE_STRING);
4
+if (isset($_POST['ident'])) {
5
+	$ident = filter_input(INPUT_POST,'ident',FILTER_SANITIZE_STRING);
6
+}
7
+if (isset($_GET['ident'])) {
8
+	$ident = filter_input(INPUT_GET,'ident',FILTER_SANITIZE_STRING);
9
+}
6 10
 if ($ident != '')
7 11
 {
8
-	if (isset($_GET['marine'])) header('Location: '.$globalURL.'/marine/ident/'.$ident);
9
-	else header('Location: '.$globalURL.'/ident/'.$ident);
10
-} else {
12
+	if (isset($_GET['marine'])) {
13
+		header('Location: '.$globalURL.'/marine/ident/'.$ident);
14
+	} else {
15
+		header('Location: '.$globalURL.'/ident/'.$ident);
16
+	}
17
+	} else {
11 18
 	if ($globalURL == '') {
12 19
 		header('Location: /');
13 20
 	} else {
Please login to merge, or discard this patch.
pilot-detailed.php 1 patch
Braces   +24 added lines, -8 removed lines patch added patch discarded remove patch
@@ -37,8 +37,12 @@  discard block
 block discarded – undo
37 37
 	$year = filter_input(INPUT_GET,'year',FILTER_SANITIZE_NUMBER_INT);
38 38
 	$month = filter_input(INPUT_GET,'month',FILTER_SANITIZE_NUMBER_INT);
39 39
 	$filter = array();
40
-	if ($year != '') $filter = array_merge($filter,array('year' => $year));
41
-	if ($month != '') $filter = array_merge($filter,array('month' => $month));
40
+	if ($year != '') {
41
+		$filter = array_merge($filter,array('year' => $year));
42
+	}
43
+	if ($month != '') {
44
+		$filter = array_merge($filter,array('month' => $month));
45
+	}
42 46
 	if ($sort != '') 
43 47
 	{
44 48
 		$spotter_array = $Spotter->getSpotterDataByPilot($pilot,$limit_start.",".$absolute_difference, $sort,$filter);
@@ -56,8 +60,12 @@  discard block
 block discarded – undo
56 60
 	{
57 61
 		$title = sprintf(_("Detailed View for %s"),$spotter_array[0]['pilot_name']);
58 62
 		$ident = $spotter_array[0]['ident'];
59
-		if (isset($spotter_array[0]['latitude'])) $latitude = $spotter_array[0]['latitude'];
60
-		if (isset($spotter_array[0]['longitude'])) $longitude = $spotter_array[0]['longitude'];
63
+		if (isset($spotter_array[0]['latitude'])) {
64
+			$latitude = $spotter_array[0]['latitude'];
65
+		}
66
+		if (isset($spotter_array[0]['longitude'])) {
67
+			$longitude = $spotter_array[0]['longitude'];
68
+		}
61 69
 		require_once('header.php');
62 70
 		/*
63 71
 		if (isset($globalArchive) && $globalArchive) {
@@ -110,12 +118,18 @@  discard block
 block discarded – undo
110 118
 		*/
111 119
 		print '<div class="info column">';
112 120
 		print '<h1>'.$spotter_array[0]['pilot_name'].'</h1>';
113
-		if (isset($spotter_array[0]['pilot_id']) && $spotter_array[0]['pilot_id'] != '') print '<div><span class="label">'._("Pilot ID").'</span>'.$spotter_array[0]['pilot_id'].'</div>';
121
+		if (isset($spotter_array[0]['pilot_id']) && $spotter_array[0]['pilot_id'] != '') {
122
+			print '<div><span class="label">'._("Pilot ID").'</span>'.$spotter_array[0]['pilot_id'].'</div>';
123
+		}
114 124
 		if ($year == '' && $month == '') {
115 125
 			$Stats = new Stats();
116 126
 			$flights = $Stats->getStatsPilot($pilot);
117
-		} else $flights = 0;
118
-		if ($flights == 0) $flights = $Spotter->countFlightsByPilot($pilot,$filter);
127
+		} else {
128
+			$flights = 0;
129
+		}
130
+		if ($flights == 0) {
131
+			$flights = $Spotter->countFlightsByPilot($pilot,$filter);
132
+		}
119 133
 		print '<div><span class="label">'._("Flights").'</span>'.$flights.'</div>';
120 134
 		$aircraft_type = count($Spotter->countAllAircraftTypesByPilot($pilot,$filter));
121 135
 		print '<div><span class="label">'._("Aircrafts type").'</span>'.$aircraft_type.'</div>';
@@ -126,7 +140,9 @@  discard block
 block discarded – undo
126 140
 		$airlines = count($Spotter->countAllAirlinesByPilot($pilot,$filter));
127 141
 		print '<div><span class="label">'._("Airlines").'</span>'.$airlines.'</div>';
128 142
 		$duration = $Spotter->getFlightDurationByPilot($pilot,$filter);
129
-		if ($duration != '0') print '<div><span class="label">'._("Total flights spotted duration").'</span>'.$duration.'</div>';
143
+		if ($duration != '0') {
144
+			print '<div><span class="label">'._("Total flights spotted duration").'</span>'.$duration.'</div>';
145
+		}
130 146
 		print '</div>';
131 147
 	
132 148
 		include('pilot-sub-menu.php');
Please login to merge, or discard this patch.
footer.php 1 patch
Braces   +8 added lines, -3 removed lines patch added patch discarded remove patch
@@ -1,8 +1,10 @@  discard block
 block discarded – undo
1 1
 </section>
2 2
 <div class="pub onmap">
3 3
 <?php
4
-	if (isset($globalPub)) print $globalPub;
5
-?>
4
+	if (isset($globalPub)) {
5
+		print $globalPub;
6
+	}
7
+	?>
6 8
 </div>
7 9
 <footer class="container">
8 10
 	<?php
@@ -13,7 +15,10 @@  discard block
 block discarded – undo
13 15
 	<?php
14 16
 	    }
15 17
 	?>
16
-	<span>Developed in Barrie by <a href="http://mtru.nz/" target="_blank">Mario Trunz</a> & at <a href="http://www.zugaina.com" target="_blank">Zugaina</a> by Ycarus</span> - <span><a href="<?php if (isset($globalURL)) print $globalURL; ?>/about#source">Source &amp; Credits</a></span> - <span><a href="https://www.flightairmap.com/" target="_blank">Get source code</a></span>
18
+	<span>Developed in Barrie by <a href="http://mtru.nz/" target="_blank">Mario Trunz</a> & at <a href="http://www.zugaina.com" target="_blank">Zugaina</a> by Ycarus</span> - <span><a href="<?php if (isset($globalURL)) {
19
+	print $globalURL;
20
+}
21
+?>/about#source">Source &amp; Credits</a></span> - <span><a href="https://www.flightairmap.com/" target="_blank">Get source code</a></span>
17 22
 </footer>
18 23
 
19 24
 <div class="notifications bottom-left"></div>
Please login to merge, or discard this patch.
country-detailed.php 1 patch
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@
 block discarded – undo
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];
Please login to merge, or discard this patch.
search-kml.php 1 patch
Braces   +21 added lines, -8 removed lines patch added patch discarded remove patch
@@ -15,8 +15,12 @@  discard block
 block discarded – undo
15 15
 	} else if($_GET['start_date'] == "" && $_GET['end_date'] != ""){
16 16
 		$end_date = date("Y-m-d H:i:s", strtotime("2014-04-12")).",".$_GET['end_date'].":00";
17 17
 		$sql_date = $end_date;
18
-	} else $sql_date = '';
19
-} else $sql_date = '';
18
+	} else {
19
+		$sql_date = '';
20
+	}
21
+	} else {
22
+	$sql_date = '';
23
+}
20 24
 
21 25
 if (isset($_GET['highest_altitude'])) {
22 26
 	//for altitude manipulation
@@ -30,8 +34,12 @@  discard block
 block discarded – undo
30 34
 	} else if($_GET['highest_altitude'] == "" && $_GET['lowest_altitude'] != ""){
31 35
 		$start_altitude = filter_input(INPUT_GET,'lowest_altitude',FILTER_SANITIZE_NUMBER_INT).",60000";
32 36
 		$sql_altitude = $start_altitude;
33
-	} else $sql_altitude = '';
34
-} else $sql_altitude = '';
37
+	} else {
38
+		$sql_altitude = '';
39
+	}
40
+	} else {
41
+	$sql_altitude = '';
42
+}
35 43
 
36 44
 //calculuation for the pagination
37 45
 if(!isset($_GET['limit']))
@@ -48,7 +56,7 @@  discard block
 block discarded – undo
48 56
 		$limit_end = filter_input(INPUT_GET,'number_results',FILTER_SANITIZE_NUMBER_INT);
49 57
 		$absolute_difference = filter_input(INPUT_GET,'number_results',FILTER_SANITIZE_NUMBER_INT);
50 58
 	}
51
-}  else {
59
+} else {
52 60
 	$limit_explode = explode(",", $_GET['limit']);
53 61
 	$limit_start = filter_var($limit_explode[0],FILTER_SANITIZE_NUMBER_INT);
54 62
 	$limit_end = filter_var($limit_explode[1],FILTER_SANITIZE_NUMBER_INT);
@@ -66,8 +74,11 @@  discard block
 block discarded – undo
66 74
 
67 75
 header('Content-Type: text/xml');
68 76
 
69
-if (isset($_GET['sort'])) $sort = $_GET['sort'];
70
-else $sort = '';
77
+if (isset($_GET['sort'])) {
78
+	$sort = $_GET['sort'];
79
+} else {
80
+	$sort = '';
81
+}
71 82
 $q = filter_input(INPUT_GET,'q',FILTER_SANITIZE_STRING);
72 83
 $registration = filter_input(INPUT_GET,'registratrion',FILTER_SANITIZE_STRING);
73 84
 $aircraft = filter_input(INPUT_GET,'aircraft',FILTER_SANITIZE_STRING);
@@ -123,7 +134,9 @@  discard block
 block discarded – undo
123 134
 			$waypoint_pieces = explode(' ', $spotter_item['waypoints']);
124 135
 			$waypoint_pieces = array_chunk($waypoint_pieces, 2);
125 136
 			foreach ($waypoint_pieces as $waypoint_coordinate) {
126
-				if (isset($waypoint_coordinate[1])) $output .=  $waypoint_coordinate[1].','.$waypoint_coordinate[0].','.$altitude.' ';
137
+				if (isset($waypoint_coordinate[1])) {
138
+					$output .=  $waypoint_coordinate[1].','.$waypoint_coordinate[0].','.$altitude.' ';
139
+				}
127 140
 			}
128 141
 			$output .= '</coordinates>';
129 142
 			$output .= '<altitudeMode>absolute</altitudeMode>';
Please login to merge, or discard this patch.
airline-statistics-registration.php 1 patch
Braces   +7 added lines, -4 removed lines patch added patch discarded remove patch
@@ -43,7 +43,9 @@  discard block
 block discarded – undo
43 43
 	}
44 44
 	$Stats = new Stats($Spotter->db);
45 45
 	$airline_names = $Stats->getAllAirlineNames();
46
-	if (empty($airline_names)) $airline_names = $Spotter->getAllAirlineNames();
46
+	if (empty($airline_names)) {
47
+		$airline_names = $Spotter->getAllAirlineNames();
48
+	}
47 49
 	foreach($airline_names as $airline_name)
48 50
 	{
49 51
 		if($airline == $airline_name['airline_icao'])
@@ -66,8 +68,7 @@  discard block
 block discarded – undo
66 68
 			if ($globalIVAO && @getimagesize($globalURL.'/images/airlines/'.$spotter_array[0]['airline_icao'].'.gif'))
67 69
 			{
68 70
 				print '<img src="'.$globalURL.'/images/airlines/'.$spotter_array[0]['airline_icao'].'.gif" alt="'.$spotter_array[0]['airline_name'].' ('.$spotter_array[0]['airline_icao'].')" title="'.$spotter_array[0]['airline_name'].' ('.$spotter_array[0]['airline_icao'].')" class="logo" />';
69
-			}
70
-			elseif (@getimagesize($globalURL.'/images/airlines/'.$spotter_array[0]['airline_icao'].'.png'))
71
+			} elseif (@getimagesize($globalURL.'/images/airlines/'.$spotter_array[0]['airline_icao'].'.png'))
71 72
 			{
72 73
 				print '<img src="'.$globalURL.'/images/airlines/'.$spotter_array[0]['airline_icao'].'.png" alt="'.$spotter_array[0]['airline_name'].' ('.$spotter_array[0]['airline_icao'].')" title="'.$spotter_array[0]['airline_name'].' ('.$spotter_array[0]['airline_icao'].')" class="logo" />';
73 74
 			}
@@ -131,7 +132,9 @@  discard block
 block discarded – undo
131 132
 				$images = $Image->getSpotterImage($aircraft_item['registration']);
132 133
 				if (isset($images['image_thumbnail'])) {
133 134
 					$aircraft_item['image_thumbnail'] = $images['image_thumbnail'];
134
-				} else $aircraft_item['image_thumbnail'] = '';
135
+				} else {
136
+					$aircraft_item['image_thumbnail'] = '';
137
+				}
135 138
 			}
136 139
 			if ($aircraft_item['image_thumbnail'] != "")
137 140
 			{
Please login to merge, or discard this patch.
require/class.MarineLive.php 1 patch
Braces   +119 added lines, -40 removed lines patch added patch discarded remove patch
@@ -8,7 +8,9 @@  discard block
 block discarded – undo
8 8
 	public function __construct($dbc = null) {
9 9
 		$Connection = new Connection($dbc);
10 10
 		$this->db = $Connection->db();
11
-		if ($this->db === null) die('Error: No DB connection. (MarineLive)');
11
+		if ($this->db === null) {
12
+			die('Error: No DB connection. (MarineLive)');
13
+		}
12 14
 	}
13 15
 
14 16
 
@@ -30,7 +32,9 @@  discard block
 block discarded – undo
30 32
 		if (isset($filter[0]['source'])) {
31 33
 			$filters = array_merge($filters,$filter);
32 34
 		}
33
-		if (is_array($globalFilter)) $filter = array_merge($filter,$globalFilter);
35
+		if (is_array($globalFilter)) {
36
+			$filter = array_merge($filter,$globalFilter);
37
+		}
34 38
 		$filter_query_join = '';
35 39
 		$filter_query_where = '';
36 40
 		foreach($filters as $flt) {
@@ -80,8 +84,11 @@  discard block
 block discarded – undo
80 84
 		if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) {
81 85
 			$filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')";
82 86
 		}
83
-		if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE';
84
-		elseif ($filter_query_where != '' && $and) $filter_query_where .= ' AND';
87
+		if ($filter_query_where == '' && $where) {
88
+			$filter_query_where = ' WHERE';
89
+		} elseif ($filter_query_where != '' && $and) {
90
+			$filter_query_where .= ' AND';
91
+		}
85 92
 		if ($filter_query_where != '') {
86 93
 			$filter_query_where = preg_replace('/^ AND/',' WHERE',$filter_query_where);
87 94
 		}
@@ -122,9 +129,13 @@  discard block
 block discarded – undo
122 129
 				$orderby_query = ' '.$search_orderby_array[$sort]['sql'];
123 130
 			}
124 131
 		}
125
-		if ($orderby_query == '') $orderby_query= ' ORDER BY date DESC';
132
+		if ($orderby_query == '') {
133
+			$orderby_query= ' ORDER BY date DESC';
134
+		}
126 135
 
127
-		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
136
+		if (!isset($globalLiveInterval)) {
137
+			$globalLiveInterval = '200';
138
+		}
128 139
 		if ($globalDBdriver == 'mysql') {
129 140
 			//$query  = "SELECT marine_live.* FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL 30 SECOND) <= l.date GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate";
130 141
 			$query  = 'SELECT marine_live.* FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate'.$filter_query.$orderby_query;
@@ -149,7 +160,9 @@  discard block
 block discarded – undo
149 160
 
150 161
 		$filter_query = $this->getFilter($filter,true,true);
151 162
 
152
-		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
163
+		if (!isset($globalLiveInterval)) {
164
+			$globalLiveInterval = '200';
165
+		}
153 166
 		if ($globalDBdriver == 'mysql') {
154 167
 			$query  = 'SELECT marine_live.mmsi, marine_live.ident, marine_live.type,marine_live.fammarine_id, marine_live.latitude, marine_live.longitude, marine_live.heading, marine_live.ground_speed, marine_live.date, marine_live.format_source 
155 168
 			FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate'.$filter_query." marine_live.latitude <> 0 AND marine_live.longitude <> 0";
@@ -190,48 +203,72 @@  discard block
 block discarded – undo
190 203
 		}
191 204
 		$filter_query = $this->getFilter($filter,true,true);
192 205
 
193
-		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
194
-		if (!isset($globalMap3DMarinesLimit) || $globalMap3DMarinesLimit == '') $globalMap3DMarinesLimit = '300';
206
+		if (!isset($globalLiveInterval)) {
207
+			$globalLiveInterval = '200';
208
+		}
209
+		if (!isset($globalMap3DMarinesLimit) || $globalMap3DMarinesLimit == '') {
210
+			$globalMap3DMarinesLimit = '300';
211
+		}
195 212
 		if ($globalDBdriver == 'mysql') {
196 213
 			if (isset($globalArchive) && $globalArchive === TRUE) {
197 214
 				$query  = 'SELECT * FROM (SELECT marine_archive.ident, marine_archive.fammarine_id,marine_archive.type, marine_archive.latitude, marine_archive.longitude, marine_archive.heading, marine_archive.ground_speed, marine_archive.date, marine_archive.format_source 
198 215
 				    FROM marine_archive INNER JOIN (SELECT fammarine_id FROM marine_live'.$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval." SECOND) <= marine_live.date) l ON l.fammarine_id = marine_archive.fammarine_id ";
199
-				if ($usecoord) $query .= "AND marine_archive.latitude BETWEEN ".$minlat." AND ".$maxlat." AND marine_archive.longitude BETWEEN ".$minlong." AND ".$maxlong." ";
216
+				if ($usecoord) {
217
+					$query .= "AND marine_archive.latitude BETWEEN ".$minlat." AND ".$maxlat." AND marine_archive.longitude BETWEEN ".$minlong." AND ".$maxlong." ";
218
+				}
200 219
 				$query .= "UNION
201 220
 				    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 
202 221
 				    FROM marine_live".$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval." SECOND) <= marine_live.date";
203
-				if ($usecoord) $query .= " AND marine_live.latitude BETWEEN ".$minlat." AND ".$maxlat." AND marine_live.longitude BETWEEN ".$minlong." AND ".$maxlong;
222
+				if ($usecoord) {
223
+					$query .= " AND marine_live.latitude BETWEEN ".$minlat." AND ".$maxlat." AND marine_live.longitude BETWEEN ".$minlong." AND ".$maxlong;
224
+				}
204 225
 				$query .= ") AS marine 
205 226
 				    WHERE latitude <> '0' AND longitude <> '0' 
206 227
 				    ORDER BY fammarine_id, date";
207
-				if ($limit) $query .= " LIMIT ".$globalMap3DMarinesLimit;
228
+				if ($limit) {
229
+					$query .= " LIMIT ".$globalMap3DMarinesLimit;
230
+				}
208 231
 			} else {
209 232
 				$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 
210 233
 				    FROM marine_live'.$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval." SECOND) <= marine_live.date ";
211
-				if ($usecoord) $query .= "AND marine_live.latitude BETWEEN ".$minlat." AND ".$maxlat." AND marine_live.longitude BETWEEN ".$minlong." AND ".$maxlong." ";
234
+				if ($usecoord) {
235
+					$query .= "AND marine_live.latitude BETWEEN ".$minlat." AND ".$maxlat." AND marine_live.longitude BETWEEN ".$minlong." AND ".$maxlong." ";
236
+				}
212 237
 				$query .= "AND marine_live.latitude <> '0' AND marine_live.longitude <> '0' 
213 238
 				ORDER BY marine_live.fammarine_id, marine_live.date";
214
-				if ($limit) $query .= " LIMIT ".$globalMap3DMarinesLimit;
239
+				if ($limit) {
240
+					$query .= " LIMIT ".$globalMap3DMarinesLimit;
241
+				}
215 242
 			}
216 243
 		} else {
217 244
 			if (isset($globalArchive) && $globalArchive === TRUE) {
218 245
 				$query  = "SELECT * FROM (SELECT marine_archive.ident, marine_archive.fammarine_id, marine_archive.type,marine_archive.latitude, marine_archive.longitude, marine_archive.heading, marine_archive.ground_speed, marine_archive.date, marine_archive.format_source 
219 246
 				    FROM marine_archive INNER JOIN (SELECT fammarine_id FROM marine_live".$filter_query." CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= marine_live.date) l ON l.fammarine_id = marine_archive.fammarine_id ";
220
-				if ($usecoord) $query .= "AND marine_archive.latitude BETWEEN ".$minlat." AND ".$maxlat." AND marine_archive.longitude BETWEEN ".$minlong." AND ".$maxlong." ";
247
+				if ($usecoord) {
248
+					$query .= "AND marine_archive.latitude BETWEEN ".$minlat." AND ".$maxlat." AND marine_archive.longitude BETWEEN ".$minlong." AND ".$maxlong." ";
249
+				}
221 250
 				$query .= "UNION
222 251
 				    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 
223 252
 				    FROM marine_live".$filter_query." CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= marine_live.date";
224
-				if ($usecoord) $query .= " AND marine_live.latitude BETWEEN ".$minlat." AND ".$maxlat." AND marine_live.longitude BETWEEN ".$minlong." AND ".$maxlong;
253
+				if ($usecoord) {
254
+					$query .= " AND marine_live.latitude BETWEEN ".$minlat." AND ".$maxlat." AND marine_live.longitude BETWEEN ".$minlong." AND ".$maxlong;
255
+				}
225 256
 				$query .= ") AS marine WHERE latitude <> '0' AND longitude <> '0' ";
226 257
 				$query .= "ORDER BY fammarine_id, date";
227
-				if ($limit) $query .= " LIMIT ".$globalMap3DMarinesLimit;
258
+				if ($limit) {
259
+					$query .= " LIMIT ".$globalMap3DMarinesLimit;
260
+				}
228 261
 			} else {
229 262
 				$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 
230 263
 				    FROM marine_live".$filter_query." CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= marine_live.date ";
231
-				if ($usecoord) $query .= "AND marine_live.latitude BETWEEN ".$minlat." AND ".$maxlat." AND marine_live.longitude BETWEEN ".$minlong." AND ".$maxlong." ";
264
+				if ($usecoord) {
265
+					$query .= "AND marine_live.latitude BETWEEN ".$minlat." AND ".$maxlat." AND marine_live.longitude BETWEEN ".$minlong." AND ".$maxlong." ";
266
+				}
232 267
 				$query .= "AND marine_live.latitude <> '0' AND marine_live.longitude <> '0' 
233 268
 				ORDER BY marine_live.fammarine_id, marine_live.date";
234
-				if ($limit) $query .= " LIMIT ".$globalMap3DMarinesLimit;
269
+				if ($limit) {
270
+					$query .= " LIMIT ".$globalMap3DMarinesLimit;
271
+				}
235 272
 			}
236 273
 		}
237 274
 		try {
@@ -256,7 +293,9 @@  discard block
 block discarded – undo
256 293
 		global $globalDBdriver, $globalLiveInterval;
257 294
 		$filter_query = $this->getFilter($filter,true,true);
258 295
 
259
-		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
296
+		if (!isset($globalLiveInterval)) {
297
+			$globalLiveInterval = '200';
298
+		}
260 299
 		if ($globalDBdriver == 'mysql') {
261 300
 			$query = 'SELECT COUNT(DISTINCT marine_live.fammarine_id) as nb FROM marine_live'.$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= date';
262 301
 		} else {
@@ -284,7 +323,9 @@  discard block
 block discarded – undo
284 323
 	{
285 324
 		global $globalDBdriver, $globalLiveInterval;
286 325
 		$Marine = new Marine($this->db);
287
-		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
326
+		if (!isset($globalLiveInterval)) {
327
+			$globalLiveInterval = '200';
328
+		}
288 329
 		$filter_query = $this->getFilter($filter);
289 330
 
290 331
 		if (is_array($coord)) {
@@ -292,7 +333,9 @@  discard block
 block discarded – undo
292 333
 			$minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
293 334
 			$maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
294 335
 			$maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
295
-		} else return array();
336
+		} else {
337
+			return array();
338
+		}
296 339
 		if ($globalDBdriver == 'mysql') {
297 340
 			$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;
298 341
 		} else {
@@ -312,7 +355,9 @@  discard block
 block discarded – undo
312 355
 	{
313 356
 		global $globalDBdriver, $globalLiveInterval, $globalArchive;
314 357
 		$Marine = new Marine($this->db);
315
-		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
358
+		if (!isset($globalLiveInterval)) {
359
+			$globalLiveInterval = '200';
360
+		}
316 361
 		$filter_query = $this->getFilter($filter,true,true);
317 362
 
318 363
 		if (is_array($coord)) {
@@ -320,7 +365,9 @@  discard block
 block discarded – undo
320 365
 			$minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
321 366
 			$maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
322 367
 			$maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
323
-		} else return array();
368
+		} else {
369
+			return array();
370
+		}
324 371
 		/*
325 372
 		if ($globalDBdriver == 'mysql') {
326 373
 			$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 
@@ -543,11 +590,15 @@  discard block
 block discarded – undo
543 590
 		//$query  = self::$global_query.' WHERE marine_live.fammarine_id = :id ORDER BY date';
544 591
 		if ($globalDBdriver == 'mysql') {
545 592
 			$query = 'SELECT marine_live.* FROM marine_live WHERE marine_live.fammarine_id = :id';
546
-			if ($liveinterval) $query .= ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= date';
593
+			if ($liveinterval) {
594
+				$query .= ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= date';
595
+			}
547 596
 			$query .= ' ORDER BY date';
548 597
 		} else {
549 598
 			$query = 'SELECT marine_live.* FROM marine_live WHERE marine_live.fammarine_id = :id';
550
-			if ($liveinterval) $query .= " AND CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= date";
599
+			if ($liveinterval) {
600
+				$query .= " AND CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= date";
601
+			}
551 602
 			$query .= ' ORDER BY date';
552 603
 		}
553 604
 
@@ -642,7 +693,9 @@  discard block
 block discarded – undo
642 693
 				$i++;
643 694
 				$j++;
644 695
 				if ($j == 30) {
645
-					if ($globalDebug) echo ".";
696
+					if ($globalDebug) {
697
+						echo ".";
698
+					}
646 699
 				    	try {
647 700
 						
648 701
 						$sth = $this->db->prepare(substr($query_delete,0,-1).")");
@@ -922,7 +975,9 @@  discard block
 block discarded – undo
922 975
 			{
923 976
 				return false;
924 977
 			}
925
-		} else return '';
978
+		} else {
979
+			return '';
980
+		}
926 981
 
927 982
 		if ($longitude != '')
928 983
 		{
@@ -930,7 +985,9 @@  discard block
 block discarded – undo
930 985
 			{
931 986
 				return false;
932 987
 			}
933
-		} else return '';
988
+		} else {
989
+			return '';
990
+		}
934 991
 
935 992
 
936 993
 		if ($heading != '')
@@ -939,7 +996,9 @@  discard block
 block discarded – undo
939 996
 			{
940 997
 				return false;
941 998
 			}
942
-		} else $heading = 0;
999
+		} else {
1000
+			$heading = 0;
1001
+		}
943 1002
 
944 1003
 		if ($groundspeed != '')
945 1004
 		{
@@ -947,9 +1006,13 @@  discard block
 block discarded – undo
947 1006
 			{
948 1007
 				return false;
949 1008
 			}
950
-		} else $groundspeed = 0;
1009
+		} else {
1010
+			$groundspeed = 0;
1011
+		}
951 1012
 		date_default_timezone_set('UTC');
952
-		if ($date == '') $date = date("Y-m-d H:i:s", time());
1013
+		if ($date == '') {
1014
+			$date = date("Y-m-d H:i:s", time());
1015
+		}
953 1016
 
954 1017
         
955 1018
 		$fammarine_id = filter_var($fammarine_id,FILTER_SANITIZE_STRING);
@@ -970,15 +1033,27 @@  discard block
 block discarded – undo
970 1033
 		$callsign = filter_var($callsign,FILTER_SANITIZE_STRING);
971 1034
 		$arrival_code = filter_var($arrival_code,FILTER_SANITIZE_STRING);
972 1035
 		$arrival_date = filter_var($arrival_date,FILTER_SANITIZE_STRING);
973
-		if ($typeid == '') $typeid = NULL;
974
-		if ($statusid == '') $statusid = NULL;
1036
+		if ($typeid == '') {
1037
+			$typeid = NULL;
1038
+		}
1039
+		if ($statusid == '') {
1040
+			$statusid = NULL;
1041
+		}
975 1042
 
976
-            	if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) $groundspeed = 0;
977
-            	if ($heading == '' || $Common->isInteger($heading) === false ) $heading = 0;
978
-            	if ($arrival_date == '') $arrival_date = NULL;
1043
+            	if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) {
1044
+            		$groundspeed = 0;
1045
+            	}
1046
+            	if ($heading == '' || $Common->isInteger($heading) === false ) {
1047
+            		$heading = 0;
1048
+            	}
1049
+            	if ($arrival_date == '') {
1050
+            		$arrival_date = NULL;
1051
+            	}
979 1052
             	$query = '';
980 1053
 		if ($globalArchive) {
981
-			if ($globalDebug) echo '-- Delete previous data -- ';
1054
+			if ($globalDebug) {
1055
+				echo '-- Delete previous data -- ';
1056
+			}
982 1057
 			$query .= 'DELETE FROM marine_live WHERE fammarine_id = :fammarine_id;';
983 1058
 		}
984 1059
 		$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) 
@@ -993,10 +1068,14 @@  discard block
 block discarded – undo
993 1068
 		}
994 1069
 		
995 1070
 		if (isset($globalArchive) && $globalArchive && $putinarchive && $noarchive !== true) {
996
-			if ($globalDebug) echo '(Add to Marine archive : ';
1071
+			if ($globalDebug) {
1072
+				echo '(Add to Marine archive : ';
1073
+			}
997 1074
 			$MarineArchive = new MarineArchive($this->db);
998 1075
 			$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
-			if ($globalDebug) echo $result.')';
1076
+			if ($globalDebug) {
1077
+				echo $result.')';
1078
+			}
1000 1079
 		}
1001 1080
 		return "success";
1002 1081
 	}
Please login to merge, or discard this patch.