Completed
Push — master ( ed2ab5...76a3f8 )
by Yannick
29:35
created
marine-data.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -63,7 +63,9 @@
 block discarded – undo
63 63
 {
64 64
 	if ($spotter_item['image_source'] == 'flickr' || $spotter_item['image_source'] == 'wikimedia' || $spotter_item['image_source'] == 'devianart') {
65 65
 		$image = preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']);
66
-	} else $image = $spotter_item['image_thumbnail'];
66
+	} else {
67
+		$image = $spotter_item['image_thumbnail'];
68
+	}
67 69
 
68 70
 }
69 71
 /* else {
Please login to merge, or discard this patch.
tracker-data.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -63,7 +63,9 @@
 block discarded – undo
63 63
 {
64 64
 	if ($spotter_item['image_source'] == 'flickr' || $spotter_item['image_source'] == 'wikimedia' || $spotter_item['image_source'] == 'devianart') {
65 65
 		$image = preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']);
66
-	} else $image = $spotter_item['image_thumbnail'];
66
+	} else {
67
+		$image = $spotter_item['image_thumbnail'];
68
+	}
67 69
 
68 70
 }
69 71
 /* else {
Please login to merge, or discard this patch.
accident.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,6 +1,8 @@
 block discarded – undo
1 1
 <?php
2 2
 require_once(dirname(__FILE__).'/require/settings.php');
3 3
 $date = filter_input(INPUT_POST,'date',FILTER_SANITIZE_STRING);
4
-if ($date == '') $date = date('Y-m-d');
4
+if ($date == '') {
5
+	$date = date('Y-m-d');
6
+}
5 7
 header('Location: '.$globalURL.'/accident/'.$date);
6 8
 ?>
7 9
\ No newline at end of file
Please login to merge, or discard this patch.
statistics-route-waypoint.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -5,7 +5,9 @@
 block discarded – undo
5 5
 $Spotter = new Spotter();
6 6
 $title = _("Statistics").' - '._("Most common Route by Waypoint");
7 7
 require_once('header.php');
8
-if (!isset($filter_name)) $filter_name = '';
8
+if (!isset($filter_name)) {
9
+	$filter_name = '';
10
+}
9 11
 include('statistics-sub-menu.php'); 
10 12
 
11 13
 print '<div class="info">
Please login to merge, or discard this patch.
statistics-route-airport.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -5,7 +5,9 @@
 block discarded – undo
5 5
 $Spotter = new Spotter();
6 6
 $title = _("Statistics").' - '._("Most common Route by Airport");
7 7
 require_once('header.php');
8
-if (!isset($filter_name)) $filter_name = '';
8
+if (!isset($filter_name)) {
9
+	$filter_name = '';
10
+}
9 11
 include('statistics-sub-menu.php'); 
10 12
 
11 13
 print '<script type="text/javascript" src="'.$globalURL.'/js/d3.min.js"></script>';
Please login to merge, or discard this patch.
require/class.Connection.php 1 patch
Braces   +80 added lines, -31 removed lines patch added patch discarded remove patch
@@ -72,8 +72,11 @@  discard block
 block discarded – undo
72 72
 				$globalDBSname = $globalDBname;
73 73
 				$globalDBSuser = $globalDBuser;
74 74
 				$globalDBSpass = $globalDBpass;
75
-				if (!isset($globalDBport) || $globalDBport === NULL || $globalDBport == '') $globalDBSport = 3306;
76
-				else $globalDBSport = $globalDBport;
75
+				if (!isset($globalDBport) || $globalDBport === NULL || $globalDBport == '') {
76
+					$globalDBSport = 3306;
77
+				} else {
78
+					$globalDBSport = $globalDBport;
79
+				}
77 80
 			} else {
78 81
 				$DBname = 'default';
79 82
 				$globalDBSdriver = $globalDBdriver;
@@ -81,8 +84,11 @@  discard block
 block discarded – undo
81 84
 				$globalDBSname = $globalDBname;
82 85
 				$globalDBSuser = $user;
83 86
 				$globalDBSpass = $pass;
84
-				if (!isset($globalDBport) || $globalDBport === NULL || $globalDBport == '') $globalDBSport = 3306;
85
-				else $globalDBSport = $globalDBport;
87
+				if (!isset($globalDBport) || $globalDBport === NULL || $globalDBport == '') {
88
+					$globalDBSport = 3306;
89
+				} else {
90
+					$globalDBSport = $globalDBport;
91
+				}
86 92
 			}
87 93
 		} else {
88 94
 			$globalDBSdriver = $globalDB[$DBname]['driver'];
@@ -90,11 +96,16 @@  discard block
 block discarded – undo
90 96
 			$globalDBSname = $globalDB[$DBname]['name'];
91 97
 			$globalDBSuser = $globalDB[$DBname]['user'];
92 98
 			$globalDBSpass = $globalDB[$DBname]['pass'];
93
-			if (isset($globalDB[$DBname]['port'])) $globalDBSport = $globalDB[$DBname]['port'];
94
-			else $globalDBSport = 3306;
99
+			if (isset($globalDB[$DBname]['port'])) {
100
+				$globalDBSport = $globalDB[$DBname]['port'];
101
+			} else {
102
+				$globalDBSport = 3306;
103
+			}
95 104
 		}
96 105
 		// Set number of try to connect to DB
97
-		if (!isset($globalDBretry) || $globalDBretry == '' || $globalDBretry === NULL) $globalDBretry = 5;
106
+		if (!isset($globalDBretry) || $globalDBretry == '' || $globalDBretry === NULL) {
107
+			$globalDBretry = 5;
108
+		}
98 109
 		$i = 0;
99 110
 		while (true) {
100 111
 			try {
@@ -103,10 +114,16 @@  discard block
 block discarded – undo
103 114
 					$this->dbs[$DBname]->setAttribute(PDO::MYSQL_ATTR_INIT_COMMAND, "SET NAMES 'utf8'");
104 115
 					$this->dbs[$DBname]->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
105 116
 					$this->dbs[$DBname]->setAttribute(PDO::ATTR_CASE,PDO::CASE_LOWER);
106
-					if (!isset($globalDBTimeOut)) $this->dbs[$DBname]->setAttribute(PDO::ATTR_TIMEOUT,500);
107
-					else $this->dbs[$DBname]->setAttribute(PDO::ATTR_TIMEOUT,$globalDBTimeOut);
108
-					if (!isset($globalDBPersistent)) $this->dbs[$DBname]->setAttribute(PDO::ATTR_PERSISTENT,true);
109
-					else $this->dbs[$DBname]->setAttribute(PDO::ATTR_PERSISTENT,$globalDBPersistent);
117
+					if (!isset($globalDBTimeOut)) {
118
+						$this->dbs[$DBname]->setAttribute(PDO::ATTR_TIMEOUT,500);
119
+					} else {
120
+						$this->dbs[$DBname]->setAttribute(PDO::ATTR_TIMEOUT,$globalDBTimeOut);
121
+					}
122
+					if (!isset($globalDBPersistent)) {
123
+						$this->dbs[$DBname]->setAttribute(PDO::ATTR_PERSISTENT,true);
124
+					} else {
125
+						$this->dbs[$DBname]->setAttribute(PDO::ATTR_PERSISTENT,$globalDBPersistent);
126
+					}
110 127
 					$this->dbs[$DBname]->setAttribute(PDO::ATTR_EMULATE_PREPARES, true);
111 128
 					$this->dbs[$DBname]->setAttribute(PDO::MYSQL_ATTR_USE_BUFFERED_QUERY, true);
112 129
 					// Workaround against "ONLY_FULL_GROUP_BY" mode
@@ -120,23 +137,35 @@  discard block
 block discarded – undo
120 137
 					//$this->dbs[$DBname]->setAttribute(PDO::MYSQL_ATTR_INIT_COMMAND, "SET NAMES 'utf8'");
121 138
 					$this->dbs[$DBname]->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
122 139
 					$this->dbs[$DBname]->setAttribute(PDO::ATTR_CASE,PDO::CASE_LOWER);
123
-					if (!isset($globalDBTimeOut)) $this->dbs[$DBname]->setAttribute(PDO::ATTR_TIMEOUT,200);
124
-					else $this->dbs[$DBname]->setAttribute(PDO::ATTR_TIMEOUT,$globalDBTimeOut);
125
-					if (!isset($globalDBPersistent)) $this->dbs[$DBname]->setAttribute(PDO::ATTR_PERSISTENT,true);
126
-					else $this->dbs[$DBname]->setAttribute(PDO::ATTR_PERSISTENT,$globalDBPersistent);
140
+					if (!isset($globalDBTimeOut)) {
141
+						$this->dbs[$DBname]->setAttribute(PDO::ATTR_TIMEOUT,200);
142
+					} else {
143
+						$this->dbs[$DBname]->setAttribute(PDO::ATTR_TIMEOUT,$globalDBTimeOut);
144
+					}
145
+					if (!isset($globalDBPersistent)) {
146
+						$this->dbs[$DBname]->setAttribute(PDO::ATTR_PERSISTENT,true);
147
+					} else {
148
+						$this->dbs[$DBname]->setAttribute(PDO::ATTR_PERSISTENT,$globalDBPersistent);
149
+					}
127 150
 					$this->dbs[$DBname]->setAttribute(PDO::ATTR_EMULATE_PREPARES, true);
128 151
 					$this->dbs[$DBname]->exec('SET timezone="UTC"');
129 152
 				}
130 153
 				break;
131 154
 			} catch(PDOException $e) {
132 155
 				$i++;
133
-				if (isset($globalDebug) && $globalDebug) echo 'Error connecting to DB: '.$globalDBSname.' - Error: '.$e->getMessage()."\n";
156
+				if (isset($globalDebug) && $globalDebug) {
157
+					echo 'Error connecting to DB: '.$globalDBSname.' - Error: '.$e->getMessage()."\n";
158
+				}
134 159
 				//exit;
135
-				if ($i > $globalDBretry) return false;
160
+				if ($i > $globalDBretry) {
161
+					return false;
162
+				}
136 163
 				//return false;
137 164
 			}
138 165
 		}
139
-		if ($DBname === 'default') $this->db = $this->dbs['default'];
166
+		if ($DBname === 'default') {
167
+			$this->db = $this->dbs['default'];
168
+		}
140 169
 		return true;
141 170
 	}
142 171
 
@@ -148,7 +177,9 @@  discard block
 block discarded – undo
148 177
 		} else {
149 178
 			$query = "SELECT * FROM pg_catalog.pg_tables WHERE tablename = '".$table."'";
150 179
 		}
151
-		if ($this->db == NULL) return false;
180
+		if ($this->db == NULL) {
181
+			return false;
182
+		}
152 183
 		try {
153 184
 			//$Connection = new Connection();
154 185
 			$results = $this->db->query($query);
@@ -157,21 +188,28 @@  discard block
 block discarded – undo
157 188
 		}
158 189
 		if($results->rowCount()>0) {
159 190
 		    return true; 
191
+		} else {
192
+			return false;
160 193
 		}
161
-		else return false;
162 194
 	}
163 195
 
164 196
 	public function connectionExists()
165 197
 	{
166 198
 		global $globalDBdriver, $globalDBCheckConnection;
167
-		if (isset($globalDBCheckConnection) && $globalDBCheckConnection === FALSE) return true;
199
+		if (isset($globalDBCheckConnection) && $globalDBCheckConnection === FALSE) {
200
+			return true;
201
+		}
168 202
 		$query = "SELECT 1 + 1";
169
-		if ($this->db === null) return false;
203
+		if ($this->db === null) {
204
+			return false;
205
+		}
170 206
 		try {
171 207
 			$sum = @$this->db->query($query);
172 208
 			if ($sum instanceof \PDOStatement) {
173 209
 				$sum = $sum->fetchColumn(0);
174
-			} else $sum = 0;
210
+			} else {
211
+				$sum = 0;
212
+			}
175 213
 			if (intval($sum) !== 2) {
176 214
 			     return false;
177 215
 			}
@@ -206,8 +244,9 @@  discard block
 block discarded – undo
206 244
 		$nb = $results->fetchAll(PDO::FETCH_ASSOC);
207 245
 		if($nb[0]['nb'] > 0) {
208 246
 			return true; 
247
+		} else {
248
+			return false;
209 249
 		}
210
-		else return false;
211 250
 	}
212 251
 
213 252
 	/*
@@ -257,9 +296,12 @@  discard block
 block discarded – undo
257 296
 			}
258 297
 			$result = $sth->fetch(PDO::FETCH_ASSOC);
259 298
 			$sth->closeCursor();
260
-			if ($result['nb'] > 0) return true;
261
-			else return false;
262
-/*		} else {
299
+			if ($result['nb'] > 0) {
300
+				return true;
301
+			} else {
302
+				return false;
303
+			}
304
+			/*		} else {
263 305
 			$query = "SELECT * FROM ".$table." LIMIT 0";
264 306
 			try {
265 307
 				$results = $this->db->query($query);
@@ -298,7 +340,9 @@  discard block
 block discarded – undo
298 340
 				$sth->closeCursor();
299 341
 				return $result['value'];
300 342
 			}
301
-		} else return $version;
343
+		} else {
344
+			return $version;
345
+		}
302 346
 	}
303 347
 	
304 348
 	/*
@@ -307,9 +351,14 @@  discard block
 block discarded – undo
307 351
 	*/
308 352
 	public function latest() {
309 353
 	    global $globalNoDB;
310
-	    if (isset($globalNoDB) && $globalNoDB === TRUE) return true;
311
-	    if ($this->check_schema_version() == $this->latest_schema) return true;
312
-	    else return false;
354
+	    if (isset($globalNoDB) && $globalNoDB === TRUE) {
355
+	    	return true;
356
+	    }
357
+	    if ($this->check_schema_version() == $this->latest_schema) {
358
+	    	return true;
359
+	    } else {
360
+	    	return false;
361
+	    }
313 362
 	}
314 363
 
315 364
 }
Please login to merge, or discard this patch.
incident.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,6 +1,8 @@
 block discarded – undo
1 1
 <?php
2 2
 require_once(dirname(__FILE__).'/require/settings.php');
3 3
 $date = filter_input(INPUT_POST,'date',FILTER_SANITIZE_STRING);
4
-if ($date == '') $date = date('Y-m-d');
4
+if ($date == '') {
5
+	$date = date('Y-m-d');
6
+}
5 7
 header('Location: '.$globalURL.'/incident/'.$date);
6 8
 ?>
7 9
\ No newline at end of file
Please login to merge, or discard this patch.
js/map-marine.2d.js.php 1 patch
Braces   +42 added lines, -10 removed lines patch added patch discarded remove patch
@@ -5,8 +5,11 @@  discard block
 block discarded – undo
5 5
 setcookie("MapFormat",'2d');
6 6
 
7 7
 // Compressed GeoJson is used if true
8
-if (!isset($globalJsonCompress)) $compress = true;
9
-else $compress = $globalJsonCompress;
8
+if (!isset($globalJsonCompress)) {
9
+	$compress = true;
10
+} else {
11
+	$compress = $globalJsonCompress;
12
+}
10 13
 ?>
11 14
 
12 15
 
@@ -142,9 +145,13 @@  discard block
 block discarded – undo
142 145
 		    if (callsign != ""){ markerMarineLabel += callsign; }
143 146
 		    if (type != ""){ markerMarineLabel += ' - '+type; }
144 147
 <?php
145
-	if (isset($_COOKIE['MarineIconColor'])) $MarineIconColor = $_COOKIE['MarineIconColor'];
146
-	elseif (isset($globalMarineIconColor)) $MarineIconColor = $globalMarineIconColor;
147
-	else $MarineIconColor = '1a3151';
148
+	if (isset($_COOKIE['MarineIconColor'])) {
149
+		$MarineIconColor = $_COOKIE['MarineIconColor'];
150
+	} elseif (isset($globalMarineIconColor)) {
151
+		$MarineIconColor = $globalMarineIconColor;
152
+	} else {
153
+		$MarineIconColor = '1a3151';
154
+	}
148 155
 	if (!isset($ident) && !isset($fammarine_id)) {
149 156
 ?>
150 157
 		    info_marine_update(feature.properties.fc);
@@ -179,7 +186,12 @@  discard block
 block discarded – undo
179 186
 <?php
180 187
 		} else {
181 188
 ?>
182
-		    var movingtime = Math.round(<?php if (isset($archiveupdatetime)) print $archiveupdatetime*1000; else print $globalMapRefresh*1000+20000; ?>+feature.properties.sqt*1000);
189
+		    var movingtime = Math.round(<?php if (isset($archiveupdatetime)) {
190
+	print $archiveupdatetime*1000;
191
+} else {
192
+	print $globalMapRefresh*1000+20000;
193
+}
194
+?>+feature.properties.sqt*1000);
183 195
 		    return new L.Marker.movingMarker([latLng, feature.properties.nextlatlon],[movingtime],{
184 196
 <?php
185 197
 		}
@@ -228,7 +240,12 @@  discard block
 block discarded – undo
228 240
 <?php
229 241
 		} else {
230 242
 ?>
231
-			    var movingtime = Math.round(<?php if (isset($archiveupdatetime)) print $archiveupdatetime*1000; else print $globalMapRefresh*1000+20000; ?>+feature.properties.sqt*1000);
243
+			    var movingtime = Math.round(<?php if (isset($archiveupdatetime)) {
244
+	print $archiveupdatetime*1000;
245
+} else {
246
+	print $globalMapRefresh*1000+20000;
247
+}
248
+?>+feature.properties.sqt*1000);
232 249
 			    return new L.Marker.movingMarker([latLng, feature.properties.nextlatlon],[movingtime],{
233 250
 <?php
234 251
 		}
@@ -276,7 +293,12 @@  discard block
 block discarded – undo
276 293
 <?php
277 294
 		} else {
278 295
 ?>
279
-			    var movingtime = Math.round(<?php if (isset($archiveupdatetime)) print $archiveupdatetime*1000; else print $globalMapRefresh*1000+20000; ?>+feature.properties.sqt*1000);
296
+			    var movingtime = Math.round(<?php if (isset($archiveupdatetime)) {
297
+	print $archiveupdatetime*1000;
298
+} else {
299
+	print $globalMapRefresh*1000+20000;
300
+}
301
+?>+feature.properties.sqt*1000);
280 302
 			    return new L.Marker.movingMarker([latLng, feature.properties.nextlatlon],[movingtime],{
281 303
 <?php
282 304
 		}
@@ -559,14 +581,24 @@  discard block
 block discarded – undo
559 581
 	if (isset($archive) && $archive) {
560 582
 ?>
561 583
 //then load it again every 30 seconds
562
-//  var reload = setInterval(function(){if (noTimeout) getLiveMarineData(0)},<?php if (isset($globalMapRefresh)) print ($globalMapRefresh*1000)/2; else print '15000'; ?>);
584
+//  var reload = setInterval(function(){if (noTimeout) getLiveMarineData(0)},<?php if (isset($globalMapRefresh)) {
585
+	print ($globalMapRefresh*1000)/2;
586
+} else {
587
+	print '15000';
588
+}
589
+?>);
563 590
 reloadMarinePage = setInterval(function(){if (noTimeout) getLiveMarineData(0)},<?php print $archiveupdatetime*1000; ?>);
564 591
 <?php
565 592
 	} else {
566 593
 ?>
567 594
 //then load it again every 30 seconds
568 595
 reloadMarinePage = setInterval(
569
-    function(){if (noTimeout) getLiveMarineData(0)},<?php if (isset($globalMapRefresh)) print $globalMapRefresh*1000; else print '30000'; ?>);
596
+    function(){if (noTimeout) getLiveMarineData(0)},<?php if (isset($globalMapRefresh)) {
597
+	print $globalMapRefresh*1000;
598
+} else {
599
+	print '30000';
600
+}
601
+?>);
570 602
 <?php
571 603
 	}
572 604
 ?>
Please login to merge, or discard this patch.
require/class.MarineLive.php 1 patch
Braces   +77 added lines, -26 removed lines patch added patch discarded remove patch
@@ -29,7 +29,9 @@  discard block
 block discarded – undo
29 29
 		if (isset($filter[0]['source'])) {
30 30
 			$filters = array_merge($filters,$filter);
31 31
 		}
32
-		if (is_array($globalFilter)) $filter = array_merge($filter,$globalFilter);
32
+		if (is_array($globalFilter)) {
33
+			$filter = array_merge($filter,$globalFilter);
34
+		}
33 35
 		$filter_query_join = '';
34 36
 		$filter_query_where = '';
35 37
 		foreach($filters as $flt) {
@@ -76,8 +78,11 @@  discard block
 block discarded – undo
76 78
 		if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) {
77 79
 			$filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')";
78 80
 		}
79
-		if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE';
80
-		elseif ($filter_query_where != '' && $and) $filter_query_where .= ' AND';
81
+		if ($filter_query_where == '' && $where) {
82
+			$filter_query_where = ' WHERE';
83
+		} elseif ($filter_query_where != '' && $and) {
84
+			$filter_query_where .= ' AND';
85
+		}
81 86
 		if ($filter_query_where != '') {
82 87
 			$filter_query_where = preg_replace('/^ AND/',' WHERE',$filter_query_where);
83 88
 		}
@@ -118,9 +123,13 @@  discard block
 block discarded – undo
118 123
 				$orderby_query = ' '.$search_orderby_array[$sort]['sql'];
119 124
 			}
120 125
 		}
121
-		if ($orderby_query == '') $orderby_query= ' ORDER BY date DESC';
126
+		if ($orderby_query == '') {
127
+			$orderby_query= ' ORDER BY date DESC';
128
+		}
122 129
 
123
-		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
130
+		if (!isset($globalLiveInterval)) {
131
+			$globalLiveInterval = '200';
132
+		}
124 133
 		if ($globalDBdriver == 'mysql') {
125 134
 			//$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";
126 135
 			$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;
@@ -145,7 +154,9 @@  discard block
 block discarded – undo
145 154
 
146 155
 		$filter_query = $this->getFilter($filter,true,true);
147 156
 
148
-		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
157
+		if (!isset($globalLiveInterval)) {
158
+			$globalLiveInterval = '200';
159
+		}
149 160
 		if ($globalDBdriver == 'mysql') {
150 161
 			$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 
151 162
 			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";
@@ -179,7 +190,9 @@  discard block
 block discarded – undo
179 190
 
180 191
 		$filter_query = $this->getFilter($filter,true,true);
181 192
 
182
-		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
193
+		if (!isset($globalLiveInterval)) {
194
+			$globalLiveInterval = '200';
195
+		}
183 196
 		if ($globalDBdriver == 'mysql') {
184 197
 			$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 
185 198
 			FROM marine_live'.$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval." SECOND) <= marine_live.date AND marine_live.latitude <> '0' AND marine_live.longitude <> '0' 
@@ -212,7 +225,9 @@  discard block
 block discarded – undo
212 225
 		global $globalDBdriver, $globalLiveInterval;
213 226
 		$filter_query = $this->getFilter($filter,true,true);
214 227
 
215
-		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
228
+		if (!isset($globalLiveInterval)) {
229
+			$globalLiveInterval = '200';
230
+		}
216 231
 		if ($globalDBdriver == 'mysql') {
217 232
 			$query = 'SELECT COUNT(DISTINCT marine_live.fammarine_id) as nb FROM marine_live'.$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= date';
218 233
 		} else {
@@ -240,7 +255,9 @@  discard block
 block discarded – undo
240 255
 	{
241 256
 		global $globalDBdriver, $globalLiveInterval;
242 257
 		$Spotter = new Spotter($this->db);
243
-		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
258
+		if (!isset($globalLiveInterval)) {
259
+			$globalLiveInterval = '200';
260
+		}
244 261
 		$filter_query = $this->getFilter($filter);
245 262
 
246 263
 		if (is_array($coord)) {
@@ -248,7 +265,9 @@  discard block
 block discarded – undo
248 265
 			$minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
249 266
 			$maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
250 267
 			$maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
251
-		} else return array();
268
+		} else {
269
+			return array();
270
+		}
252 271
 		if ($globalDBdriver == 'mysql') {
253 272
 			$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;
254 273
 		} else {
@@ -268,7 +287,9 @@  discard block
 block discarded – undo
268 287
 	{
269 288
 		global $globalDBdriver, $globalLiveInterval;
270 289
 		$Spotter = new Spotter($this->db);
271
-		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
290
+		if (!isset($globalLiveInterval)) {
291
+			$globalLiveInterval = '200';
292
+		}
272 293
 		$filter_query = $this->getFilter($filter);
273 294
 
274 295
 		if (is_array($coord)) {
@@ -276,7 +297,9 @@  discard block
 block discarded – undo
276 297
 			$minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
277 298
 			$maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
278 299
 			$maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
279
-		} else return array();
300
+		} else {
301
+			return array();
302
+		}
280 303
 		if ($globalDBdriver == 'mysql') {
281 304
 			$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 
282 305
 			FROM marine_live'.$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval." SECOND) <= marine_live.date AND marine_live.latitude <> '0' AND marine_live.longitude <> '0' AND marine_live.latitude BETWEEN ".$minlat.' AND '.$maxlat.' AND marine_live.longitude BETWEEN '.$minlong.' AND '.$maxlong."
@@ -444,11 +467,15 @@  discard block
 block discarded – undo
444 467
 		//$query  = self::$global_query.' WHERE marine_live.fammarine_id = :id ORDER BY date';
445 468
 		if ($globalDBdriver == 'mysql') {
446 469
 			$query = 'SELECT marine_live.* FROM marine_live WHERE marine_live.fammarine_id = :id';
447
-			if ($liveinterval) $query .= ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= date';
470
+			if ($liveinterval) {
471
+				$query .= ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= date';
472
+			}
448 473
 			$query .= ' ORDER BY date';
449 474
 		} else {
450 475
 			$query = 'SELECT marine_live.* FROM marine_live WHERE marine_live.fammarine_id = :id';
451
-			if ($liveinterval) $query .= " AND CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= date";
476
+			if ($liveinterval) {
477
+				$query .= " AND CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= date";
478
+			}
452 479
 			$query .= ' ORDER BY date';
453 480
 		}
454 481
 
@@ -543,7 +570,9 @@  discard block
 block discarded – undo
543 570
 				$i++;
544 571
 				$j++;
545 572
 				if ($j == 30) {
546
-					if ($globalDebug) echo ".";
573
+					if ($globalDebug) {
574
+						echo ".";
575
+					}
547 576
 				    	try {
548 577
 						
549 578
 						$sth = $this->db->prepare(substr($query_delete,0,-1).")");
@@ -823,7 +852,9 @@  discard block
 block discarded – undo
823 852
 			{
824 853
 				return false;
825 854
 			}
826
-		} else return '';
855
+		} else {
856
+			return '';
857
+		}
827 858
 
828 859
 		if ($longitude != '')
829 860
 		{
@@ -831,7 +862,9 @@  discard block
 block discarded – undo
831 862
 			{
832 863
 				return false;
833 864
 			}
834
-		} else return '';
865
+		} else {
866
+			return '';
867
+		}
835 868
 
836 869
 
837 870
 		if ($heading != '')
@@ -840,7 +873,9 @@  discard block
 block discarded – undo
840 873
 			{
841 874
 				return false;
842 875
 			}
843
-		} else $heading = 0;
876
+		} else {
877
+			$heading = 0;
878
+		}
844 879
 
845 880
 		if ($groundspeed != '')
846 881
 		{
@@ -848,9 +883,13 @@  discard block
 block discarded – undo
848 883
 			{
849 884
 				return false;
850 885
 			}
851
-		} else $groundspeed = 0;
886
+		} else {
887
+			$groundspeed = 0;
888
+		}
852 889
 		date_default_timezone_set('UTC');
853
-		if ($date == '') $date = date("Y-m-d H:i:s", time());
890
+		if ($date == '') {
891
+			$date = date("Y-m-d H:i:s", time());
892
+		}
854 893
 
855 894
         
856 895
 		$fammarine_id = filter_var($fammarine_id,FILTER_SANITIZE_STRING);
@@ -871,12 +910,20 @@  discard block
 block discarded – undo
871 910
 		$arrival_date = filter_var($arrival_date,FILTER_SANITIZE_STRING);
872 911
 		
873 912
 
874
-            	if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) $groundspeed = 0;
875
-            	if ($heading == '' || $Common->isInteger($heading) === false ) $heading = 0;
876
-            	if ($arrival_date == '') $arrival_date = NULL;
913
+            	if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) {
914
+            		$groundspeed = 0;
915
+            	}
916
+            	if ($heading == '' || $Common->isInteger($heading) === false ) {
917
+            		$heading = 0;
918
+            	}
919
+            	if ($arrival_date == '') {
920
+            		$arrival_date = NULL;
921
+            	}
877 922
             	$query = '';
878 923
 		if ($globalArchive) {
879
-			if ($globalDebug) echo '-- Delete previous data -- ';
924
+			if ($globalDebug) {
925
+				echo '-- Delete previous data -- ';
926
+			}
880 927
 			$query .= 'DELETE FROM marine_live WHERE fammarine_id = :fammarine_id;';
881 928
 		}
882 929
 		$query .= 'INSERT INTO marine_live (fammarine_id, ident, latitude, longitude, heading, ground_speed, date, format_source, source_name, over_country, mmsi, type,status,imo,arrival_port_name,arrival_port_date) 
@@ -891,10 +938,14 @@  discard block
 block discarded – undo
891 938
 		}
892 939
 		
893 940
 		if (isset($globalArchive) && $globalArchive && $putinarchive && $noarchive !== true) {
894
-			if ($globalDebug) echo '(Add to Marine archive : ';
941
+			if ($globalDebug) {
942
+				echo '(Add to Marine archive : ';
943
+			}
895 944
 			$MarineArchive = new MarineArchive($this->db);
896 945
 			$result =  $MarineArchive->addMarineArchiveData($fammarine_id, $ident, $latitude, $longitude, $heading, $groundspeed, $date, $putinarchive, $mmsi,$type,$typeid,$imo, $callsign,$arrival_code,$arrival_date,$status,$noarchive,$format_source, $source_name, $over_country);
897
-			if ($globalDebug) echo $result.')';
946
+			if ($globalDebug) {
947
+				echo $result.')';
948
+			}
898 949
 		}
899 950
 		return "success";
900 951
 	}
Please login to merge, or discard this patch.