Completed
Push — master ( aa8319...e96b22 )
by Yannick
07:18
created
require/class.TrackerArchive.php 4 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -14,7 +14,7 @@
 block discarded – undo
14 14
 	/**
15 15
 	* Get SQL query part for filter used
16 16
 	* @param Array $filter the filter
17
-	* @return Array the SQL part
17
+	* @return string the SQL part
18 18
 	*/
19 19
 	public function getFilter($filter = array(),$where = false,$and = false) {
20 20
 		global $globalFilter, $globalStatsFilters, $globalFilterName, $globalDBdriver;
Please login to merge, or discard this patch.
Indentation   +603 added lines, -603 removed lines patch added patch discarded remove patch
@@ -9,10 +9,10 @@  discard block
 block discarded – undo
9 9
 	}
10 10
 
11 11
 	/**
12
-	* Get SQL query part for filter used
13
-	* @param Array $filter the filter
14
-	* @return Array the SQL part
15
-	*/
12
+	 * Get SQL query part for filter used
13
+	 * @param Array $filter the filter
14
+	 * @return Array the SQL part
15
+	 */
16 16
 	public function getFilter($filter = array(),$where = false,$and = false) {
17 17
 		global $globalFilter, $globalStatsFilters, $globalFilterName, $globalDBdriver;
18 18
 		$filters = array();
@@ -108,44 +108,44 @@  discard block
 block discarded – undo
108 108
 	}
109 109
 
110 110
 
111
-        /**
112
-        * Gets all the spotter information based on a particular callsign
113
-        *
114
-        * @return Array the spotter information
115
-        *
116
-        */
117
-        public function getLastArchiveTrackerDataByIdent($ident)
118
-        {
111
+		/**
112
+		 * Gets all the spotter information based on a particular callsign
113
+		 *
114
+		 * @return Array the spotter information
115
+		 *
116
+		 */
117
+		public function getLastArchiveTrackerDataByIdent($ident)
118
+		{
119 119
 		$Tracker = new Tracker($this->db);
120
-                date_default_timezone_set('UTC');
120
+				date_default_timezone_set('UTC');
121 121
 
122
-                $ident = filter_var($ident, FILTER_SANITIZE_STRING);
123
-                //$query  = "SELECT tracker_archive.* FROM tracker_archive INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_archive l WHERE l.ident = :ident GROUP BY l.famtrackid) s on tracker_archive.famtrackid = s.famtrackid AND tracker_archive.date = s.maxdate LIMIT 1";
124
-                $query  = "SELECT tracker_archive.* FROM tracker_archive WHERE ident = :ident ORDER BY date DESC LIMIT 1";
122
+				$ident = filter_var($ident, FILTER_SANITIZE_STRING);
123
+				//$query  = "SELECT tracker_archive.* FROM tracker_archive INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_archive l WHERE l.ident = :ident GROUP BY l.famtrackid) s on tracker_archive.famtrackid = s.famtrackid AND tracker_archive.date = s.maxdate LIMIT 1";
124
+				$query  = "SELECT tracker_archive.* FROM tracker_archive WHERE ident = :ident ORDER BY date DESC LIMIT 1";
125 125
 
126
-                $spotter_array = $Tracker->getDataFromDB($query,array(':ident' => $ident));
126
+				$spotter_array = $Tracker->getDataFromDB($query,array(':ident' => $ident));
127 127
 
128
-                return $spotter_array;
129
-        }
128
+				return $spotter_array;
129
+		}
130 130
 
131 131
 
132
-        /**
133
-        * Gets last the spotter information based on a particular id
134
-        *
135
-        * @return Array the spotter information
136
-        *
137
-        */
138
-        public function getLastArchiveTrackerDataById($id)
139
-        {
140
-    		$Tracker = new Tracker($this->db);
141
-                date_default_timezone_set('UTC');
142
-                $id = filter_var($id, FILTER_SANITIZE_STRING);
143
-                //$query  = TrackerArchive->$global_query." WHERE tracker_archive.famtrackid = :id";
144
-                //$query  = "SELECT tracker_archive.* FROM tracker_archive INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_archive l WHERE l.famtrackid = :id GROUP BY l.famtrackid) s on tracker_archive.famtrackid = s.famtrackid AND tracker_archive.date = s.maxdate LIMIT 1";
145
-                $query  = "SELECT * FROM tracker_archive WHERE famtrackid = :id ORDER BY date DESC LIMIT 1";
132
+		/**
133
+		 * Gets last the spotter information based on a particular id
134
+		 *
135
+		 * @return Array the spotter information
136
+		 *
137
+		 */
138
+		public function getLastArchiveTrackerDataById($id)
139
+		{
140
+			$Tracker = new Tracker($this->db);
141
+				date_default_timezone_set('UTC');
142
+				$id = filter_var($id, FILTER_SANITIZE_STRING);
143
+				//$query  = TrackerArchive->$global_query." WHERE tracker_archive.famtrackid = :id";
144
+				//$query  = "SELECT tracker_archive.* FROM tracker_archive INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_archive l WHERE l.famtrackid = :id GROUP BY l.famtrackid) s on tracker_archive.famtrackid = s.famtrackid AND tracker_archive.date = s.maxdate LIMIT 1";
145
+				$query  = "SELECT * FROM tracker_archive WHERE famtrackid = :id ORDER BY date DESC LIMIT 1";
146 146
 
147 147
 //              $spotter_array = Tracker->getDataFromDB($query,array(':id' => $id));
148
-                  /*
148
+				  /*
149 149
                 try {
150 150
                         $Connection = new Connection();
151 151
                         $sth = Connection->$db->prepare($query);
@@ -155,232 +155,232 @@  discard block
 block discarded – undo
155 155
                 }
156 156
                 $spotter_array = $sth->fetchAll(PDO->FETCH_ASSOC);
157 157
                 */
158
-                $spotter_array = $Tracker->getDataFromDB($query,array(':id' => $id));
159
-
160
-                return $spotter_array;
161
-        }
162
-
163
-        /**
164
-        * Gets all the spotter information based on a particular id
165
-        *
166
-        * @return Array the spotter information
167
-        *
168
-        */
169
-        public function getAllArchiveTrackerDataById($id)
158
+				$spotter_array = $Tracker->getDataFromDB($query,array(':id' => $id));
159
+
160
+				return $spotter_array;
161
+		}
162
+
163
+		/**
164
+		 * Gets all the spotter information based on a particular id
165
+		 *
166
+		 * @return Array the spotter information
167
+		 *
168
+		 */
169
+		public function getAllArchiveTrackerDataById($id)
170 170
 	{
171
-                date_default_timezone_set('UTC');
172
-                $id = filter_var($id, FILTER_SANITIZE_STRING);
173
-                $query  = $this->global_query." WHERE tracker_archive.famtrackid = :id ORDER BY date";
171
+				date_default_timezone_set('UTC');
172
+				$id = filter_var($id, FILTER_SANITIZE_STRING);
173
+				$query  = $this->global_query." WHERE tracker_archive.famtrackid = :id ORDER BY date";
174 174
 
175 175
 //              $spotter_array = Tracker->getDataFromDB($query,array(':id' => $id));
176 176
 
177
-                try {
178
-                        $sth = $this->db->prepare($query);
179
-                        $sth->execute(array(':id' => $id));
180
-                } catch(PDOException $e) {
181
-                        echo $e->getMessage();
182
-                        die;
183
-                }
184
-                $spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC);
185
-
186
-                return $spotter_array;
187
-        }
188
-
189
-        /**
190
-        * Gets coordinate & time spotter information based on a particular id
191
-        *
192
-        * @return Array the spotter information
193
-        *
194
-        */
195
-        public function getCoordArchiveTrackerDataById($id)
196
-        {
197
-                date_default_timezone_set('UTC');
198
-                $id = filter_var($id, FILTER_SANITIZE_STRING);
199
-                $query  = "SELECT tracker_archive.latitude, tracker_archive.longitude, tracker_archive.date FROM tracker_archive WHERE tracker_archive.famtrackid = :id";
177
+				try {
178
+						$sth = $this->db->prepare($query);
179
+						$sth->execute(array(':id' => $id));
180
+				} catch(PDOException $e) {
181
+						echo $e->getMessage();
182
+						die;
183
+				}
184
+				$spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC);
185
+
186
+				return $spotter_array;
187
+		}
188
+
189
+		/**
190
+		 * Gets coordinate & time spotter information based on a particular id
191
+		 *
192
+		 * @return Array the spotter information
193
+		 *
194
+		 */
195
+		public function getCoordArchiveTrackerDataById($id)
196
+		{
197
+				date_default_timezone_set('UTC');
198
+				$id = filter_var($id, FILTER_SANITIZE_STRING);
199
+				$query  = "SELECT tracker_archive.latitude, tracker_archive.longitude, tracker_archive.date FROM tracker_archive WHERE tracker_archive.famtrackid = :id";
200 200
 
201 201
 //              $spotter_array = Tracker->getDataFromDB($query,array(':id' => $id));
202 202
 
203
-                try {
204
-                        $sth = $this->db->prepare($query);
205
-                        $sth->execute(array(':id' => $id));
206
-                } catch(PDOException $e) {
207
-                        echo $e->getMessage();
208
-                        die;
209
-                }
210
-                $spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC);
203
+				try {
204
+						$sth = $this->db->prepare($query);
205
+						$sth->execute(array(':id' => $id));
206
+				} catch(PDOException $e) {
207
+						echo $e->getMessage();
208
+						die;
209
+				}
210
+				$spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC);
211 211
 
212
-                return $spotter_array;
213
-        }
212
+				return $spotter_array;
213
+		}
214 214
 
215 215
 
216
-        /**
217
-        * Gets altitude information based on a particular callsign
218
-        *
219
-        * @return Array the spotter information
220
-        *
221
-        */
222
-        public function getAltitudeArchiveTrackerDataByIdent($ident)
223
-        {
216
+		/**
217
+		 * Gets altitude information based on a particular callsign
218
+		 *
219
+		 * @return Array the spotter information
220
+		 *
221
+		 */
222
+		public function getAltitudeArchiveTrackerDataByIdent($ident)
223
+		{
224 224
 
225
-                date_default_timezone_set('UTC');
225
+				date_default_timezone_set('UTC');
226 226
 
227
-                $ident = filter_var($ident, FILTER_SANITIZE_STRING);
228
-                $query  = "SELECT tracker_archive.altitude, tracker_archive.date FROM tracker_archive WHERE tracker_archive.ident = :ident AND tracker_archive.latitude <> 0 AND tracker_archive.longitude <> 0 ORDER BY date";
227
+				$ident = filter_var($ident, FILTER_SANITIZE_STRING);
228
+				$query  = "SELECT tracker_archive.altitude, tracker_archive.date FROM tracker_archive WHERE tracker_archive.ident = :ident AND tracker_archive.latitude <> 0 AND tracker_archive.longitude <> 0 ORDER BY date";
229 229
 
230
-                try {
231
-                        $sth = $this->db->prepare($query);
232
-                        $sth->execute(array(':ident' => $ident));
233
-                } catch(PDOException $e) {
234
-                        echo $e->getMessage();
235
-                        die;
236
-                }
237
-                $spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC);
230
+				try {
231
+						$sth = $this->db->prepare($query);
232
+						$sth->execute(array(':ident' => $ident));
233
+				} catch(PDOException $e) {
234
+						echo $e->getMessage();
235
+						die;
236
+				}
237
+				$spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC);
238 238
 
239
-                return $spotter_array;
240
-        }
239
+				return $spotter_array;
240
+		}
241 241
 
242
-        /**
243
-        * Gets altitude information based on a particular id
244
-        *
245
-        * @return Array the spotter information
246
-        *
247
-        */
248
-        public function getAltitudeArchiveTrackerDataById($id)
249
-        {
242
+		/**
243
+		 * Gets altitude information based on a particular id
244
+		 *
245
+		 * @return Array the spotter information
246
+		 *
247
+		 */
248
+		public function getAltitudeArchiveTrackerDataById($id)
249
+		{
250 250
 
251
-                date_default_timezone_set('UTC');
251
+				date_default_timezone_set('UTC');
252 252
 
253
-                $id = filter_var($id, FILTER_SANITIZE_STRING);
254
-                $query  = "SELECT tracker_archive.altitude, tracker_archive.date FROM tracker_archive WHERE tracker_archive.famtrackid = :id AND tracker_archive.latitude <> 0 AND tracker_archive.longitude <> 0 ORDER BY date";
253
+				$id = filter_var($id, FILTER_SANITIZE_STRING);
254
+				$query  = "SELECT tracker_archive.altitude, tracker_archive.date FROM tracker_archive WHERE tracker_archive.famtrackid = :id AND tracker_archive.latitude <> 0 AND tracker_archive.longitude <> 0 ORDER BY date";
255 255
 
256
-                try {
257
-                        $sth = $this->db->prepare($query);
258
-                        $sth->execute(array(':id' => $id));
259
-                } catch(PDOException $e) {
260
-                        echo $e->getMessage();
261
-                        die;
262
-                }
263
-                $spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC);
256
+				try {
257
+						$sth = $this->db->prepare($query);
258
+						$sth->execute(array(':id' => $id));
259
+				} catch(PDOException $e) {
260
+						echo $e->getMessage();
261
+						die;
262
+				}
263
+				$spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC);
264 264
 
265
-                return $spotter_array;
266
-        }
265
+				return $spotter_array;
266
+		}
267 267
 
268
-        /**
269
-        * Gets altitude & speed information based on a particular id
270
-        *
271
-        * @return Array the spotter information
272
-        *
273
-        */
274
-        public function getAltitudeSpeedArchiveTrackerDataById($id)
275
-        {
268
+		/**
269
+		 * Gets altitude & speed information based on a particular id
270
+		 *
271
+		 * @return Array the spotter information
272
+		 *
273
+		 */
274
+		public function getAltitudeSpeedArchiveTrackerDataById($id)
275
+		{
276 276
 
277
-                date_default_timezone_set('UTC');
277
+				date_default_timezone_set('UTC');
278 278
 
279
-                $id = filter_var($id, FILTER_SANITIZE_STRING);
280
-                $query  = "SELECT tracker_archive.altitude, tracker_archive.ground_speed, tracker_archive.date FROM tracker_archive WHERE tracker_archive.famtrackid = :id ORDER BY date";
279
+				$id = filter_var($id, FILTER_SANITIZE_STRING);
280
+				$query  = "SELECT tracker_archive.altitude, tracker_archive.ground_speed, tracker_archive.date FROM tracker_archive WHERE tracker_archive.famtrackid = :id ORDER BY date";
281 281
 
282
-                try {
283
-                        $sth = $this->db->prepare($query);
284
-                        $sth->execute(array(':id' => $id));
285
-                } catch(PDOException $e) {
286
-                        echo $e->getMessage();
287
-                        die;
288
-                }
289
-                $spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC);
282
+				try {
283
+						$sth = $this->db->prepare($query);
284
+						$sth->execute(array(':id' => $id));
285
+				} catch(PDOException $e) {
286
+						echo $e->getMessage();
287
+						die;
288
+				}
289
+				$spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC);
290 290
 
291
-                return $spotter_array;
292
-        }
291
+				return $spotter_array;
292
+		}
293 293
 
294 294
 
295
-        /**
296
-        * Gets altitude information based on a particular callsign
297
-        *
298
-        * @return Array the spotter information
299
-        *
300
-        */
301
-        public function getLastAltitudeArchiveTrackerDataByIdent($ident)
302
-        {
295
+		/**
296
+		 * Gets altitude information based on a particular callsign
297
+		 *
298
+		 * @return Array the spotter information
299
+		 *
300
+		 */
301
+		public function getLastAltitudeArchiveTrackerDataByIdent($ident)
302
+		{
303 303
 
304
-                date_default_timezone_set('UTC');
304
+				date_default_timezone_set('UTC');
305 305
 
306
-                $ident = filter_var($ident, FILTER_SANITIZE_STRING);
307
-                $query  = "SELECT tracker_archive.altitude, tracker_archive.date FROM tracker_archive INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_archive l WHERE l.ident = :ident GROUP BY l.famtrackid) s on tracker_archive.famtrackid = s.famtrackid AND tracker_archive.date = s.maxdate LIMIT 1";
306
+				$ident = filter_var($ident, FILTER_SANITIZE_STRING);
307
+				$query  = "SELECT tracker_archive.altitude, tracker_archive.date FROM tracker_archive INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_archive l WHERE l.ident = :ident GROUP BY l.famtrackid) s on tracker_archive.famtrackid = s.famtrackid AND tracker_archive.date = s.maxdate LIMIT 1";
308 308
 //                $query  = "SELECT tracker_archive.altitude, tracker_archive.date FROM tracker_archive WHERE tracker_archive.ident = :ident";
309 309
 
310
-                try {
311
-                        $sth = $this->db->prepare($query);
312
-                        $sth->execute(array(':ident' => $ident));
313
-                } catch(PDOException $e) {
314
-                        echo $e->getMessage();
315
-                        die;
316
-                }
317
-                $spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC);
310
+				try {
311
+						$sth = $this->db->prepare($query);
312
+						$sth->execute(array(':ident' => $ident));
313
+				} catch(PDOException $e) {
314
+						echo $e->getMessage();
315
+						die;
316
+				}
317
+				$spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC);
318 318
 
319
-                return $spotter_array;
320
-        }
319
+				return $spotter_array;
320
+		}
321 321
 
322 322
 
323 323
 
324
-       /**
325
-        * Gets all the archive spotter information
326
-        *
327
-        * @return Array the spotter information
328
-        *
329
-        */
330
-        public function getTrackerArchiveData($ident,$famtrackid,$date)
331
-        {
332
-    		$Tracker = new Tracker($this->db);
333
-                $ident = filter_var($ident, FILTER_SANITIZE_STRING);
334
-                $query  = "SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM spotter_live l WHERE l.ident = :ident AND l.famtrackid = :famtrackid AND l.date LIKE :date GROUP BY l.famtrackid) s on spotter_live.famtrackid = s.famtrackid AND spotter_live.date = s.maxdate";
324
+	   /**
325
+	    * Gets all the archive spotter information
326
+	    *
327
+	    * @return Array the spotter information
328
+	    *
329
+	    */
330
+		public function getTrackerArchiveData($ident,$famtrackid,$date)
331
+		{
332
+			$Tracker = new Tracker($this->db);
333
+				$ident = filter_var($ident, FILTER_SANITIZE_STRING);
334
+				$query  = "SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM spotter_live l WHERE l.ident = :ident AND l.famtrackid = :famtrackid AND l.date LIKE :date GROUP BY l.famtrackid) s on spotter_live.famtrackid = s.famtrackid AND spotter_live.date = s.maxdate";
335 335
 
336
-                $spotter_array = $Tracker->getDataFromDB($query,array(':ident' => $ident,':famtrackid' => $famtrackid,':date' => $date.'%'));
336
+				$spotter_array = $Tracker->getDataFromDB($query,array(':ident' => $ident,':famtrackid' => $famtrackid,':date' => $date.'%'));
337 337
 
338
-                return $spotter_array;
339
-        }
338
+				return $spotter_array;
339
+		}
340 340
         
341
-        public function deleteTrackerArchiveTrackData()
342
-        {
341
+		public function deleteTrackerArchiveTrackData()
342
+		{
343 343
 		global $globalArchiveKeepTrackMonths;
344
-                date_default_timezone_set('UTC');
344
+				date_default_timezone_set('UTC');
345 345
 		$query = 'DELETE FROM tracker_archive WHERE tracker_archive.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$globalArchiveKeepTrackMonths.' MONTH)';
346
-                try {
347
-                        $sth = $this->db->prepare($query);
348
-                        $sth->execute();
349
-                } catch(PDOException $e) {
350
-                        echo $e->getMessage();
351
-                        die;
352
-                }
346
+				try {
347
+						$sth = $this->db->prepare($query);
348
+						$sth->execute();
349
+				} catch(PDOException $e) {
350
+						echo $e->getMessage();
351
+						die;
352
+				}
353 353
 	}
354 354
 
355 355
 	/**
356
-        * Gets Minimal Live Tracker data
357
-        *
358
-        * @return Array the spotter information
359
-        *
360
-        */
361
-        public function getMinLiveTrackerData($begindate,$enddate,$filter = array())
362
-        {
363
-                global $globalDBdriver, $globalLiveInterval;
364
-                date_default_timezone_set('UTC');
365
-
366
-                $filter_query = '';
367
-                if (isset($filter['source']) && !empty($filter['source'])) {
368
-                        $filter_query .= " AND format_source IN ('".implode("','",$filter['source'])."') ";
369
-                }
370
-                // Use spotter_output also ?
371
-                if (isset($filter['airlines']) && !empty($filter['airlines'])) {
372
-                        $filter_query .= " INNER JOIN (SELECT famtrackid FROM tracker_archive_output WHERE tracker_archive_output.airline_icao IN ('".implode("','",$filter['airlines'])."')) so ON so.famtrackid = tracker_archive.famtrackid ";
373
-                }
374
-                if (isset($filter['airlinestype']) && !empty($filter['airlinestype'])) {
375
-                        $filter_query .= " INNER JOIN (SELECT famtrackid FROM tracker_archive_output WHERE tracker_archive_output.airline_type = '".$filter['airlinestype']."') sa ON sa.famtrackid = tracker_archive.famtrackid ";
376
-                }
377
-                if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) {
378
-                        $filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')";
379
-                }
356
+	 * Gets Minimal Live Tracker data
357
+	 *
358
+	 * @return Array the spotter information
359
+	 *
360
+	 */
361
+		public function getMinLiveTrackerData($begindate,$enddate,$filter = array())
362
+		{
363
+				global $globalDBdriver, $globalLiveInterval;
364
+				date_default_timezone_set('UTC');
365
+
366
+				$filter_query = '';
367
+				if (isset($filter['source']) && !empty($filter['source'])) {
368
+						$filter_query .= " AND format_source IN ('".implode("','",$filter['source'])."') ";
369
+				}
370
+				// Use spotter_output also ?
371
+				if (isset($filter['airlines']) && !empty($filter['airlines'])) {
372
+						$filter_query .= " INNER JOIN (SELECT famtrackid FROM tracker_archive_output WHERE tracker_archive_output.airline_icao IN ('".implode("','",$filter['airlines'])."')) so ON so.famtrackid = tracker_archive.famtrackid ";
373
+				}
374
+				if (isset($filter['airlinestype']) && !empty($filter['airlinestype'])) {
375
+						$filter_query .= " INNER JOIN (SELECT famtrackid FROM tracker_archive_output WHERE tracker_archive_output.airline_type = '".$filter['airlinestype']."') sa ON sa.famtrackid = tracker_archive.famtrackid ";
376
+				}
377
+				if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) {
378
+						$filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')";
379
+				}
380 380
 
381
-                //if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
382
-                if ($globalDBdriver == 'mysql') {
383
-                        /*
381
+				//if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
382
+				if ($globalDBdriver == 'mysql') {
383
+						/*
384 384
                         $query  = 'SELECT a.aircraft_shadow, tracker_archive.ident, tracker_archive.famtrackid, tracker_archive.aircraft_icao, tracker_archive.departure_airport_icao as departure_airport, tracker_archive.arrival_airport_icao as arrival_airport, tracker_archive.latitude, tracker_archive.longitude, tracker_archive.altitude, tracker_archive.heading, tracker_archive.ground_speed, tracker_archive.squawk 
385 385
                     		    FROM tracker_archive 
386 386
                     		    INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_archive l WHERE (l.date BETWEEN '."'".$begindate."'".' AND '."'".$enddate."'".') GROUP BY l.famtrackid) s on tracker_archive.famtrackid = s.famtrackid AND tracker_archive.date = s.maxdate '.$filter_query.'LEFT JOIN (SELECT aircraft_shadow,icao FROM aircraft) a ON tracker_archive.aircraft_icao = a.icao';
@@ -399,56 +399,56 @@  discard block
 block discarded – undo
399 399
 				    INNER JOIN (SELECT * FROM aircraft) a on tracker_archive.aircraft_icao = a.icao
400 400
 				    WHERE tracker_archive.date BETWEEN '."'".$begindate."'".' AND '."'".$begindate."'".' 
401 401
                         	    '.$filter_query.' ORDER BY famtrackid';
402
-                } else {
403
-                        //$query  = 'SELECT tracker_archive.ident, tracker_archive.famtrackid, tracker_archive.aircraft_icao, tracker_archive.departure_airport_icao as departure_airport, tracker_archive.arrival_airport_icao as arrival_airport, tracker_archive.latitude, tracker_archive.longitude, tracker_archive.altitude, tracker_archive.heading, tracker_archive.ground_speed, tracker_archive.squawk, a.aircraft_shadow FROM tracker_archive INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_archive l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.famtrackid) s on tracker_archive.famtrackid = s.famtrackid AND tracker_archive.date = s.maxdate '.$filter_query.'INNER JOIN (SELECT * FROM aircraft) a on tracker_archive.aircraft_icao = a.icao';
404
-                        $query  = 'SELECT tracker_archive.date,tracker_archive.famtrackid, tracker_archive.ident, tracker_archive.aircraft_icao, tracker_archive.departure_airport_icao as departure_airport, tracker_archive.arrival_airport_icao as arrival_airport, tracker_archive.latitude, tracker_archive.longitude, tracker_archive.altitude, tracker_archive.heading, tracker_archive.ground_speed, tracker_archive.squawk, a.aircraft_shadow,a.engine_type, a.engine_count, a.wake_category 
402
+				} else {
403
+						//$query  = 'SELECT tracker_archive.ident, tracker_archive.famtrackid, tracker_archive.aircraft_icao, tracker_archive.departure_airport_icao as departure_airport, tracker_archive.arrival_airport_icao as arrival_airport, tracker_archive.latitude, tracker_archive.longitude, tracker_archive.altitude, tracker_archive.heading, tracker_archive.ground_speed, tracker_archive.squawk, a.aircraft_shadow FROM tracker_archive INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_archive l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.famtrackid) s on tracker_archive.famtrackid = s.famtrackid AND tracker_archive.date = s.maxdate '.$filter_query.'INNER JOIN (SELECT * FROM aircraft) a on tracker_archive.aircraft_icao = a.icao';
404
+						$query  = 'SELECT tracker_archive.date,tracker_archive.famtrackid, tracker_archive.ident, tracker_archive.aircraft_icao, tracker_archive.departure_airport_icao as departure_airport, tracker_archive.arrival_airport_icao as arrival_airport, tracker_archive.latitude, tracker_archive.longitude, tracker_archive.altitude, tracker_archive.heading, tracker_archive.ground_speed, tracker_archive.squawk, a.aircraft_shadow,a.engine_type, a.engine_count, a.wake_category 
405 405
                         	    FROM tracker_archive 
406 406
                         	    INNER JOIN (SELECT * FROM aircraft) a on tracker_archive.aircraft_icao = a.icao
407 407
                         	    WHERE tracker_archive.date >= '."'".$begindate."'".' AND tracker_archive.date <= '."'".$enddate."'".'
408 408
                         	    '.$filter_query.' ORDER BY famtrackid';
409
-                }
410
-                //echo $query;
411
-                try {
412
-                        $sth = $this->db->prepare($query);
413
-                        $sth->execute();
414
-                } catch(PDOException $e) {
415
-                        echo $e->getMessage();
416
-                        die;
417
-                }
418
-                $spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC);
409
+				}
410
+				//echo $query;
411
+				try {
412
+						$sth = $this->db->prepare($query);
413
+						$sth->execute();
414
+				} catch(PDOException $e) {
415
+						echo $e->getMessage();
416
+						die;
417
+				}
418
+				$spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC);
419 419
 
420
-                return $spotter_array;
421
-        }
420
+				return $spotter_array;
421
+		}
422 422
 
423 423
 	/**
424
-        * Gets Minimal Live Tracker data
425
-        *
426
-        * @return Array the spotter information
427
-        *
428
-        */
429
-        public function getMinLiveTrackerDataPlayback($begindate,$enddate,$filter = array())
430
-        {
431
-                global $globalDBdriver, $globalLiveInterval;
432
-                date_default_timezone_set('UTC');
433
-
434
-                $filter_query = '';
435
-                if (isset($filter['source']) && !empty($filter['source'])) {
436
-                        $filter_query .= " AND format_source IN ('".implode("','",$filter['source'])."') ";
437
-                }
438
-                // Should use spotter_output also ?
439
-                if (isset($filter['airlines']) && !empty($filter['airlines'])) {
440
-                        $filter_query .= " INNER JOIN (SELECT famtrackid FROM tracker_archive_output WHERE tracker_archive_output.airline_icao IN ('".implode("','",$filter['airlines'])."')) so ON so.famtrackid = tracker_archive.famtrackid ";
441
-                }
442
-                if (isset($filter['airlinestype']) && !empty($filter['airlinestype'])) {
443
-                        $filter_query .= " INNER JOIN (SELECT famtrackid FROM tracker_archive_output WHERE tracker_archive_output.airline_type = '".$filter['airlinestype']."') sa ON sa.famtrackid = tracker_archive.famtrackid ";
444
-                }
445
-                if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) {
446
-                        $filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')";
447
-                }
424
+	 * Gets Minimal Live Tracker data
425
+	 *
426
+	 * @return Array the spotter information
427
+	 *
428
+	 */
429
+		public function getMinLiveTrackerDataPlayback($begindate,$enddate,$filter = array())
430
+		{
431
+				global $globalDBdriver, $globalLiveInterval;
432
+				date_default_timezone_set('UTC');
433
+
434
+				$filter_query = '';
435
+				if (isset($filter['source']) && !empty($filter['source'])) {
436
+						$filter_query .= " AND format_source IN ('".implode("','",$filter['source'])."') ";
437
+				}
438
+				// Should use spotter_output also ?
439
+				if (isset($filter['airlines']) && !empty($filter['airlines'])) {
440
+						$filter_query .= " INNER JOIN (SELECT famtrackid FROM tracker_archive_output WHERE tracker_archive_output.airline_icao IN ('".implode("','",$filter['airlines'])."')) so ON so.famtrackid = tracker_archive.famtrackid ";
441
+				}
442
+				if (isset($filter['airlinestype']) && !empty($filter['airlinestype'])) {
443
+						$filter_query .= " INNER JOIN (SELECT famtrackid FROM tracker_archive_output WHERE tracker_archive_output.airline_type = '".$filter['airlinestype']."') sa ON sa.famtrackid = tracker_archive.famtrackid ";
444
+				}
445
+				if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) {
446
+						$filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')";
447
+				}
448 448
 
449
-                //if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
450
-                if ($globalDBdriver == 'mysql') {
451
-                        /*
449
+				//if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
450
+				if ($globalDBdriver == 'mysql') {
451
+						/*
452 452
                         $query  = 'SELECT a.aircraft_shadow, tracker_archive.ident, tracker_archive.famtrackid, tracker_archive.aircraft_icao, tracker_archive.departure_airport_icao as departure_airport, tracker_archive.arrival_airport_icao as arrival_airport, tracker_archive.latitude, tracker_archive.longitude, tracker_archive.altitude, tracker_archive.heading, tracker_archive.ground_speed, tracker_archive.squawk 
453 453
                     		    FROM tracker_archive 
454 454
                     		    INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_archive l WHERE (l.date BETWEEN '."'".$begindate."'".' AND '."'".$enddate."'".') GROUP BY l.famtrackid) s on tracker_archive.famtrackid = s.famtrackid AND tracker_archive.date = s.maxdate '.$filter_query.'LEFT JOIN (SELECT aircraft_shadow,icao FROM aircraft) a ON tracker_archive.aircraft_icao = a.icao';
@@ -459,95 +459,95 @@  discard block
 block discarded – undo
459 459
 				    WHERE (tracker_archive_output.date BETWEEN '."'".$begindate."'".' AND '."'".$enddate."'".') 
460 460
                         	    '.$filter_query.' GROUP BY tracker_archive_output.famtrackid, tracker_archive_output.ident, tracker_archive_output.aircraft_icao, tracker_archive_output.departure_airport_icao, tracker_archive_output.arrival_airport_icao, tracker_archive_output.latitude, tracker_archive_output.longitude, tracker_archive_output.altitude, tracker_archive_output.heading, tracker_archive_output.ground_speed, tracker_archive_output.squawk, a.aircraft_shadow';
461 461
 
462
-                } else {
463
-                        //$query  = 'SELECT tracker_archive_output.ident, tracker_archive_output.famtrackid, tracker_archive_output.aircraft_icao, tracker_archive_output.departure_airport_icao as departure_airport, tracker_archive_output.arrival_airport_icao as arrival_airport, tracker_archive_output.latitude, tracker_archive_output.longitude, tracker_archive_output.altitude, tracker_archive_output.heading, tracker_archive_output.ground_speed, tracker_archive_output.squawk, a.aircraft_shadow FROM tracker_archive_output INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_archive_output l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.famtrackid) s on tracker_archive_output.famtrackid = s.famtrackid AND tracker_archive_output.date = s.maxdate '.$filter_query.'INNER JOIN (SELECT * FROM aircraft) a on tracker_archive_output.aircraft_icao = a.icao';
464
-                       /*
462
+				} else {
463
+						//$query  = 'SELECT tracker_archive_output.ident, tracker_archive_output.famtrackid, tracker_archive_output.aircraft_icao, tracker_archive_output.departure_airport_icao as departure_airport, tracker_archive_output.arrival_airport_icao as arrival_airport, tracker_archive_output.latitude, tracker_archive_output.longitude, tracker_archive_output.altitude, tracker_archive_output.heading, tracker_archive_output.ground_speed, tracker_archive_output.squawk, a.aircraft_shadow FROM tracker_archive_output INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_archive_output l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.famtrackid) s on tracker_archive_output.famtrackid = s.famtrackid AND tracker_archive_output.date = s.maxdate '.$filter_query.'INNER JOIN (SELECT * FROM aircraft) a on tracker_archive_output.aircraft_icao = a.icao';
464
+					   /*
465 465
                         $query  = 'SELECT tracker_archive_output.ident, tracker_archive_output.famtrackid, tracker_archive_output.aircraft_icao, tracker_archive_output.departure_airport_icao as departure_airport, tracker_archive_output.arrival_airport_icao as arrival_airport, tracker_archive_output.latitude, tracker_archive_output.longitude, tracker_archive_output.altitude, tracker_archive_output.heading, tracker_archive_output.ground_speed, tracker_archive_output.squawk, a.aircraft_shadow
466 466
                         	    FROM tracker_archive_output 
467 467
                         	    INNER JOIN (SELECT * FROM aircraft) a on tracker_archive_output.aircraft_icao = a.icao
468 468
                         	    WHERE tracker_archive_output.date >= '."'".$begindate."'".' AND tracker_archive_output.date <= '."'".$enddate."'".'
469 469
                         	    '.$filter_query.' GROUP BY tracker_archive_output.famtrackid, tracker_archive_output.ident, tracker_archive_output.aircraft_icao, tracker_archive_output.departure_airport_icao, tracker_archive_output.arrival_airport_icao, tracker_archive_output.latitude, tracker_archive_output.longitude, tracker_archive_output.altitude, tracker_archive_output.heading, tracker_archive_output.ground_speed, tracker_archive_output.squawk, a.aircraft_shadow';
470 470
                         */
471
-                        $query  = 'SELECT DISTINCT tracker_archive_output.famtrackid, tracker_archive_output.ident, tracker_archive_output.aircraft_icao, tracker_archive_output.departure_airport_icao as departure_airport, tracker_archive_output.arrival_airport_icao as arrival_airport, tracker_archive_output.latitude, tracker_archive_output.longitude, tracker_archive_output.altitude, tracker_archive_output.heading, tracker_archive_output.ground_speed, tracker_archive_output.squawk, a.aircraft_shadow
471
+						$query  = 'SELECT DISTINCT tracker_archive_output.famtrackid, tracker_archive_output.ident, tracker_archive_output.aircraft_icao, tracker_archive_output.departure_airport_icao as departure_airport, tracker_archive_output.arrival_airport_icao as arrival_airport, tracker_archive_output.latitude, tracker_archive_output.longitude, tracker_archive_output.altitude, tracker_archive_output.heading, tracker_archive_output.ground_speed, tracker_archive_output.squawk, a.aircraft_shadow
472 472
                         	    FROM tracker_archive_output 
473 473
                         	    INNER JOIN (SELECT * FROM aircraft) a on tracker_archive_output.aircraft_icao = a.icao
474 474
                         	    WHERE tracker_archive_output.date >= '."'".$begindate."'".' AND tracker_archive_output.date <= '."'".$enddate."'".'
475 475
                         	    '.$filter_query.' LIMIT 200 OFFSET 0';
476 476
 //                        	    .' GROUP BY spotter_output.famtrackid, spotter_output.ident, spotter_output.aircraft_icao, spotter_output.departure_airport_icao, spotter_output.arrival_airport_icao, spotter_output.latitude, spotter_output.longitude, spotter_output.altitude, spotter_output.heading, spotter_output.ground_speed, spotter_output.squawk, a.aircraft_shadow';
477 477
                         	    
478
-                }
479
-                //echo $query;
480
-                try {
481
-                        $sth = $this->db->prepare($query);
482
-                        $sth->execute();
483
-                } catch(PDOException $e) {
484
-                        echo $e->getMessage();
485
-                        die;
486
-                }
487
-                $spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC);
478
+				}
479
+				//echo $query;
480
+				try {
481
+						$sth = $this->db->prepare($query);
482
+						$sth->execute();
483
+				} catch(PDOException $e) {
484
+						echo $e->getMessage();
485
+						die;
486
+				}
487
+				$spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC);
488 488
 
489
-                return $spotter_array;
490
-        }
489
+				return $spotter_array;
490
+		}
491 491
 
492 492
 	 /**
493
-        * Gets count Live Tracker data
494
-        *
495
-        * @return Array the spotter information
496
-        *
497
-        */
498
-        public function getLiveTrackerCount($begindate,$enddate,$filter = array())
499
-        {
500
-                global $globalDBdriver, $globalLiveInterval;
501
-                date_default_timezone_set('UTC');
502
-
503
-                $filter_query = '';
504
-                if (isset($filter['source']) && !empty($filter['source'])) {
505
-                        $filter_query .= " AND format_source IN ('".implode("','",$filter['source'])."') ";
506
-                }
507
-                if (isset($filter['airlines']) && !empty($filter['airlines'])) {
508
-                        $filter_query .= " INNER JOIN (SELECT famtrackid FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','",$filter['airlines'])."')) so ON so.famtrackid = tracker_archive.famtrackid ";
509
-                }
510
-                if (isset($filter['airlinestype']) && !empty($filter['airlinestype'])) {
511
-                        $filter_query .= " INNER JOIN (SELECT famtrackid FROM spotter_output WHERE spotter_output.airline_type = '".$filter['airlinestype']."') sa ON sa.famtrackid = tracker_archive.famtrackid ";
512
-                }
513
-                if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) {
514
-                        $filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')";
515
-                }
493
+	  * Gets count Live Tracker data
494
+	  *
495
+	  * @return Array the spotter information
496
+	  *
497
+	  */
498
+		public function getLiveTrackerCount($begindate,$enddate,$filter = array())
499
+		{
500
+				global $globalDBdriver, $globalLiveInterval;
501
+				date_default_timezone_set('UTC');
516 502
 
517
-                //if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
518
-                if ($globalDBdriver == 'mysql') {
503
+				$filter_query = '';
504
+				if (isset($filter['source']) && !empty($filter['source'])) {
505
+						$filter_query .= " AND format_source IN ('".implode("','",$filter['source'])."') ";
506
+				}
507
+				if (isset($filter['airlines']) && !empty($filter['airlines'])) {
508
+						$filter_query .= " INNER JOIN (SELECT famtrackid FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','",$filter['airlines'])."')) so ON so.famtrackid = tracker_archive.famtrackid ";
509
+				}
510
+				if (isset($filter['airlinestype']) && !empty($filter['airlinestype'])) {
511
+						$filter_query .= " INNER JOIN (SELECT famtrackid FROM spotter_output WHERE spotter_output.airline_type = '".$filter['airlinestype']."') sa ON sa.famtrackid = tracker_archive.famtrackid ";
512
+				}
513
+				if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) {
514
+						$filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')";
515
+				}
516
+
517
+				//if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
518
+				if ($globalDBdriver == 'mysql') {
519 519
 			$query = 'SELECT COUNT(DISTINCT famtrackid) as nb 
520 520
 			FROM tracker_archive l 
521 521
 			WHERE (l.date BETWEEN DATE_SUB('."'".$begindate."'".',INTERVAL '.$globalLiveInterval.' SECOND) AND '."'".$begindate."'".')'.$filter_query;
522
-                } else {
522
+				} else {
523 523
 			$query = 'SELECT COUNT(DISTINCT famtrackid) as nb FROM tracker_archive l WHERE (l.date BETWEEN '."'".$begindate."' - INTERVAL '".$globalLiveInterval." SECONDS' AND "."'".$enddate."'".')'.$filter_query;
524
-                }
525
-                //echo $query;
526
-                try {
527
-                        $sth = $this->db->prepare($query);
528
-                        $sth->execute();
529
-                } catch(PDOException $e) {
530
-                        echo $e->getMessage();
531
-                        die;
532
-                }
524
+				}
525
+				//echo $query;
526
+				try {
527
+						$sth = $this->db->prepare($query);
528
+						$sth->execute();
529
+				} catch(PDOException $e) {
530
+						echo $e->getMessage();
531
+						die;
532
+				}
533 533
 		$result = $sth->fetch(PDO::FETCH_ASSOC);
534 534
 		$sth->closeCursor();
535
-                return $result['nb'];
535
+				return $result['nb'];
536 536
 
537
-        }
537
+		}
538 538
 
539 539
 
540 540
 
541 541
 	// tracker_archive_output
542 542
 	
543
-    /**
544
-    * Gets all the spotter information
545
-    *
546
-    * @return Array the spotter information
547
-    *
548
-    */
549
-    public function searchTrackerData($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())
550
-    {
543
+	/**
544
+	 * Gets all the spotter information
545
+	 *
546
+	 * @return Array the spotter information
547
+	 *
548
+	 */
549
+	public function searchTrackerData($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())
550
+	{
551 551
 	global $globalTimezone, $globalDBdriver;
552 552
 	require_once(dirname(__FILE__).'/class.Translation.php');
553 553
 	$Translation = new Translation();
@@ -561,159 +561,159 @@  discard block
 block discarded – undo
561 561
 	$filter_query = $this->getFilter($filters);
562 562
 	if ($q != "")
563 563
 	{
564
-	    if (!is_string($q))
565
-	    {
564
+		if (!is_string($q))
565
+		{
566 566
 		return false;
567
-	    } else {
567
+		} else {
568 568
 	        
569 569
 		$q_array = explode(" ", $q);
570 570
 		
571 571
 		foreach ($q_array as $q_item){
572
-		    $additional_query .= " AND (";
573
-		    $additional_query .= "(tracker_archive_output.spotter_id like '%".$q_item."%') OR ";
574
-		    $additional_query .= "(tracker_archive_output.aircraft_icao like '%".$q_item."%') OR ";
575
-		    $additional_query .= "(tracker_archive_output.aircraft_name like '%".$q_item."%') OR ";
576
-		    $additional_query .= "(tracker_archive_output.aircraft_manufacturer like '%".$q_item."%') OR ";
577
-		    $additional_query .= "(tracker_archive_output.airline_icao like '%".$q_item."%') OR ";
578
-		    $additional_query .= "(tracker_archive_output.airline_name like '%".$q_item."%') OR ";
579
-		    $additional_query .= "(tracker_archive_output.airline_country like '%".$q_item."%') OR ";
580
-		    $additional_query .= "(tracker_archive_output.departure_airport_icao like '%".$q_item."%') OR ";
581
-		    $additional_query .= "(tracker_archive_output.departure_airport_name like '%".$q_item."%') OR ";
582
-		    $additional_query .= "(tracker_archive_output.departure_airport_city like '%".$q_item."%') OR ";
583
-		    $additional_query .= "(tracker_archive_output.departure_airport_country like '%".$q_item."%') OR ";
584
-		    $additional_query .= "(tracker_archive_output.arrival_airport_icao like '%".$q_item."%') OR ";
585
-		    $additional_query .= "(tracker_archive_output.arrival_airport_name like '%".$q_item."%') OR ";
586
-		    $additional_query .= "(tracker_archive_output.arrival_airport_city like '%".$q_item."%') OR ";
587
-		    $additional_query .= "(tracker_archive_output.arrival_airport_country like '%".$q_item."%') OR ";
588
-		    $additional_query .= "(tracker_archive_output.registration like '%".$q_item."%') OR ";
589
-		    $additional_query .= "(tracker_archive_output.owner_name like '%".$q_item."%') OR ";
590
-		    $additional_query .= "(tracker_archive_output.pilot_id like '%".$q_item."%') OR ";
591
-		    $additional_query .= "(tracker_archive_output.pilot_name like '%".$q_item."%') OR ";
592
-		    $additional_query .= "(tracker_archive_output.ident like '%".$q_item."%') OR ";
593
-		    $translate = $Translation->ident2icao($q_item);
594
-		    if ($translate != $q_item) $additional_query .= "(tracker_archive_output.ident like '%".$translate."%') OR ";
595
-		    $additional_query .= "(tracker_archive_output.highlight like '%".$q_item."%')";
596
-		    $additional_query .= ")";
572
+			$additional_query .= " AND (";
573
+			$additional_query .= "(tracker_archive_output.spotter_id like '%".$q_item."%') OR ";
574
+			$additional_query .= "(tracker_archive_output.aircraft_icao like '%".$q_item."%') OR ";
575
+			$additional_query .= "(tracker_archive_output.aircraft_name like '%".$q_item."%') OR ";
576
+			$additional_query .= "(tracker_archive_output.aircraft_manufacturer like '%".$q_item."%') OR ";
577
+			$additional_query .= "(tracker_archive_output.airline_icao like '%".$q_item."%') OR ";
578
+			$additional_query .= "(tracker_archive_output.airline_name like '%".$q_item."%') OR ";
579
+			$additional_query .= "(tracker_archive_output.airline_country like '%".$q_item."%') OR ";
580
+			$additional_query .= "(tracker_archive_output.departure_airport_icao like '%".$q_item."%') OR ";
581
+			$additional_query .= "(tracker_archive_output.departure_airport_name like '%".$q_item."%') OR ";
582
+			$additional_query .= "(tracker_archive_output.departure_airport_city like '%".$q_item."%') OR ";
583
+			$additional_query .= "(tracker_archive_output.departure_airport_country like '%".$q_item."%') OR ";
584
+			$additional_query .= "(tracker_archive_output.arrival_airport_icao like '%".$q_item."%') OR ";
585
+			$additional_query .= "(tracker_archive_output.arrival_airport_name like '%".$q_item."%') OR ";
586
+			$additional_query .= "(tracker_archive_output.arrival_airport_city like '%".$q_item."%') OR ";
587
+			$additional_query .= "(tracker_archive_output.arrival_airport_country like '%".$q_item."%') OR ";
588
+			$additional_query .= "(tracker_archive_output.registration like '%".$q_item."%') OR ";
589
+			$additional_query .= "(tracker_archive_output.owner_name like '%".$q_item."%') OR ";
590
+			$additional_query .= "(tracker_archive_output.pilot_id like '%".$q_item."%') OR ";
591
+			$additional_query .= "(tracker_archive_output.pilot_name like '%".$q_item."%') OR ";
592
+			$additional_query .= "(tracker_archive_output.ident like '%".$q_item."%') OR ";
593
+			$translate = $Translation->ident2icao($q_item);
594
+			if ($translate != $q_item) $additional_query .= "(tracker_archive_output.ident like '%".$translate."%') OR ";
595
+			$additional_query .= "(tracker_archive_output.highlight like '%".$q_item."%')";
596
+			$additional_query .= ")";
597
+		}
597 598
 		}
598
-	    }
599 599
 	}
600 600
 	
601 601
 	if ($registration != "")
602 602
 	{
603
-	    $registration = filter_var($registration,FILTER_SANITIZE_STRING);
604
-	    if (!is_string($registration))
605
-	    {
603
+		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
604
+		if (!is_string($registration))
605
+		{
606 606
 		return false;
607
-	    } else {
607
+		} else {
608 608
 		$additional_query .= " AND (tracker_archive_output.registration = '".$registration."')";
609
-	    }
609
+		}
610 610
 	}
611 611
 	
612 612
 	if ($aircraft_icao != "")
613 613
 	{
614
-	    $aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
615
-	    if (!is_string($aircraft_icao))
616
-	    {
614
+		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
615
+		if (!is_string($aircraft_icao))
616
+		{
617 617
 		return false;
618
-	    } else {
618
+		} else {
619 619
 		$additional_query .= " AND (tracker_archive_output.aircraft_icao = '".$aircraft_icao."')";
620
-	    }
620
+		}
621 621
 	}
622 622
 	
623 623
 	if ($aircraft_manufacturer != "")
624 624
 	{
625
-	    $aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
626
-	    if (!is_string($aircraft_manufacturer))
627
-	    {
625
+		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
626
+		if (!is_string($aircraft_manufacturer))
627
+		{
628 628
 		return false;
629
-	    } else {
629
+		} else {
630 630
 		$additional_query .= " AND (tracker_archive_output.aircraft_manufacturer = '".$aircraft_manufacturer."')";
631
-	    }
631
+		}
632 632
 	}
633 633
 	
634 634
 	if ($highlights == "true")
635 635
 	{
636
-	    if (!is_string($highlights))
637
-	    {
636
+		if (!is_string($highlights))
637
+		{
638 638
 		return false;
639
-	    } else {
639
+		} else {
640 640
 		$additional_query .= " AND (tracker_archive_output.highlight <> '')";
641
-	    }
641
+		}
642 642
 	}
643 643
 	
644 644
 	if ($airline_icao != "")
645 645
 	{
646
-	    $airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
647
-	    if (!is_string($airline_icao))
648
-	    {
646
+		$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
647
+		if (!is_string($airline_icao))
648
+		{
649 649
 		return false;
650
-	    } else {
650
+		} else {
651 651
 		$additional_query .= " AND (tracker_archive_output.airline_icao = '".$airline_icao."')";
652
-	    }
652
+		}
653 653
 	}
654 654
 	
655 655
 	if ($airline_country != "")
656 656
 	{
657
-	    $airline_country = filter_var($airline_country,FILTER_SANITIZE_STRING);
658
-	    if (!is_string($airline_country))
659
-	    {
657
+		$airline_country = filter_var($airline_country,FILTER_SANITIZE_STRING);
658
+		if (!is_string($airline_country))
659
+		{
660 660
 		return false;
661
-	    } else {
661
+		} else {
662 662
 		$additional_query .= " AND (tracker_archive_output.airline_country = '".$airline_country."')";
663
-	    }
663
+		}
664 664
 	}
665 665
 	
666 666
 	if ($airline_type != "")
667 667
 	{
668
-	    $airline_type = filter_var($airline_type,FILTER_SANITIZE_STRING);
669
-	    if (!is_string($airline_type))
670
-	    {
668
+		$airline_type = filter_var($airline_type,FILTER_SANITIZE_STRING);
669
+		if (!is_string($airline_type))
670
+		{
671 671
 		return false;
672
-	    } else {
672
+		} else {
673 673
 		if ($airline_type == "passenger")
674 674
 		{
675
-		    $additional_query .= " AND (tracker_archive_output.airline_type = 'passenger')";
675
+			$additional_query .= " AND (tracker_archive_output.airline_type = 'passenger')";
676 676
 		}
677 677
 		if ($airline_type == "cargo")
678 678
 		{
679
-		    $additional_query .= " AND (tracker_archive_output.airline_type = 'cargo')";
679
+			$additional_query .= " AND (tracker_archive_output.airline_type = 'cargo')";
680 680
 		}
681 681
 		if ($airline_type == "military")
682 682
 		{
683
-		    $additional_query .= " AND (tracker_archive_output.airline_type = 'military')";
683
+			$additional_query .= " AND (tracker_archive_output.airline_type = 'military')";
684
+		}
684 685
 		}
685
-	    }
686 686
 	}
687 687
 	
688 688
 	if ($airport != "")
689 689
 	{
690
-	    $airport = filter_var($airport,FILTER_SANITIZE_STRING);
691
-	    if (!is_string($airport))
692
-	    {
690
+		$airport = filter_var($airport,FILTER_SANITIZE_STRING);
691
+		if (!is_string($airport))
692
+		{
693 693
 		return false;
694
-	    } else {
694
+		} else {
695 695
 		$additional_query .= " AND ((tracker_archive_output.departure_airport_icao = '".$airport."') OR (tracker_archive_output.arrival_airport_icao = '".$airport."'))";
696
-	    }
696
+		}
697 697
 	}
698 698
 	
699 699
 	if ($airport_country != "")
700 700
 	{
701
-	    $airport_country = filter_var($airport_country,FILTER_SANITIZE_STRING);
702
-	    if (!is_string($airport_country))
703
-	    {
701
+		$airport_country = filter_var($airport_country,FILTER_SANITIZE_STRING);
702
+		if (!is_string($airport_country))
703
+		{
704 704
 		return false;
705
-	    } else {
705
+		} else {
706 706
 		$additional_query .= " AND ((tracker_archive_output.departure_airport_country = '".$airport_country."') OR (tracker_archive_output.arrival_airport_country = '".$airport_country."'))";
707
-	    }
707
+		}
708 708
 	}
709 709
     
710 710
 	if ($callsign != "")
711 711
 	{
712
-	    $callsign = filter_var($callsign,FILTER_SANITIZE_STRING);
713
-	    if (!is_string($callsign))
714
-	    {
712
+		$callsign = filter_var($callsign,FILTER_SANITIZE_STRING);
713
+		if (!is_string($callsign))
714
+		{
715 715
 		return false;
716
-	    } else {
716
+		} else {
717 717
 		$translate = $Translation->ident2icao($callsign);
718 718
 		if ($translate != $callsign) {
719 719
 			$additional_query .= " AND (tracker_archive_output.ident = :callsign OR tracker_archive_output.ident = :translate)";
@@ -721,99 +721,99 @@  discard block
 block discarded – undo
721 721
 		} else {
722 722
 			$additional_query .= " AND (tracker_archive_output.ident = '".$callsign."')";
723 723
 		}
724
-	    }
724
+		}
725 725
 	}
726 726
 
727 727
 	if ($owner != "")
728 728
 	{
729
-	    $owner = filter_var($owner,FILTER_SANITIZE_STRING);
730
-	    if (!is_string($owner))
731
-	    {
729
+		$owner = filter_var($owner,FILTER_SANITIZE_STRING);
730
+		if (!is_string($owner))
731
+		{
732 732
 		return false;
733
-	    } else {
733
+		} else {
734 734
 		$additional_query .= " AND (tracker_archive_output.owner_name = '".$owner."')";
735
-	    }
735
+		}
736 736
 	}
737 737
 
738 738
 	if ($pilot_name != "")
739 739
 	{
740
-	    $pilot_name = filter_var($pilot_name,FILTER_SANITIZE_STRING);
741
-	    if (!is_string($pilot_name))
742
-	    {
740
+		$pilot_name = filter_var($pilot_name,FILTER_SANITIZE_STRING);
741
+		if (!is_string($pilot_name))
742
+		{
743 743
 		return false;
744
-	    } else {
744
+		} else {
745 745
 		$additional_query .= " AND (tracker_archive_output.pilot_name = '".$pilot_name."')";
746
-	    }
746
+		}
747 747
 	}
748 748
 	
749 749
 	if ($pilot_id != "")
750 750
 	{
751
-	    $pilot_id = filter_var($pilot_id,FILTER_SANITIZE_NUMBER_INT);
752
-	    if (!is_string($pilot_id))
753
-	    {
751
+		$pilot_id = filter_var($pilot_id,FILTER_SANITIZE_NUMBER_INT);
752
+		if (!is_string($pilot_id))
753
+		{
754 754
 		return false;
755
-	    } else {
755
+		} else {
756 756
 		$additional_query .= " AND (tracker_archive_output.pilot_id = '".$pilot_id."')";
757
-	    }
757
+		}
758 758
 	}
759 759
 	
760 760
 	if ($departure_airport_route != "")
761 761
 	{
762
-	    $departure_airport_route = filter_var($departure_airport_route,FILTER_SANITIZE_STRING);
763
-	    if (!is_string($departure_airport_route))
764
-	    {
762
+		$departure_airport_route = filter_var($departure_airport_route,FILTER_SANITIZE_STRING);
763
+		if (!is_string($departure_airport_route))
764
+		{
765 765
 		return false;
766
-	    } else {
766
+		} else {
767 767
 		$additional_query .= " AND (tracker_archive_output.departure_airport_icao = '".$departure_airport_route."')";
768
-	    }
768
+		}
769 769
 	}
770 770
 	
771 771
 	if ($arrival_airport_route != "")
772 772
 	{
773
-	    $arrival_airport_route = filter_var($arrival_airport_route,FILTER_SANITIZE_STRING);
774
-	    if (!is_string($arrival_airport_route))
775
-	    {
773
+		$arrival_airport_route = filter_var($arrival_airport_route,FILTER_SANITIZE_STRING);
774
+		if (!is_string($arrival_airport_route))
775
+		{
776 776
 		return false;
777
-	    } else {
777
+		} else {
778 778
 		$additional_query .= " AND (tracker_archive_output.arrival_airport_icao = '".$arrival_airport_route."')";
779
-	    }
779
+		}
780 780
 	}
781 781
 	
782 782
 	if ($altitude != "")
783 783
 	{
784
-	    $altitude_array = explode(",", $altitude);
784
+		$altitude_array = explode(",", $altitude);
785 785
 	    
786
-	    $altitude_array[0] = filter_var($altitude_array[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
787
-	    $altitude_array[1] = filter_var($altitude_array[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
786
+		$altitude_array[0] = filter_var($altitude_array[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
787
+		$altitude_array[1] = filter_var($altitude_array[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
788 788
 	    
789 789
 
790
-	    if ($altitude_array[1] != "")
791
-	    {                
790
+		if ($altitude_array[1] != "")
791
+		{                
792 792
 		$altitude_array[0] = substr($altitude_array[0], 0, -2);
793 793
 		$altitude_array[1] = substr($altitude_array[1], 0, -2);
794 794
 		$additional_query .= " AND altitude BETWEEN '".$altitude_array[0]."' AND '".$altitude_array[1]."' ";
795
-	    } else {
795
+		} else {
796 796
 		$altitude_array[0] = substr($altitude_array[0], 0, -2);
797 797
 		$additional_query .= " AND altitude <= '".$altitude_array[0]."' ";
798
-	    }
798
+		}
799 799
 	}
800 800
 	
801 801
 	if ($date_posted != "")
802 802
 	{
803
-	    $date_array = explode(",", $date_posted);
803
+		$date_array = explode(",", $date_posted);
804 804
 	    
805
-	    $date_array[0] = filter_var($date_array[0],FILTER_SANITIZE_STRING);
806
-	    $date_array[1] = filter_var($date_array[1],FILTER_SANITIZE_STRING);
805
+		$date_array[0] = filter_var($date_array[0],FILTER_SANITIZE_STRING);
806
+		$date_array[1] = filter_var($date_array[1],FILTER_SANITIZE_STRING);
807 807
 	    
808
-	    if ($globalTimezone != '') {
808
+		if ($globalTimezone != '') {
809 809
 		date_default_timezone_set($globalTimezone);
810 810
 		$datetime = new DateTime();
811 811
 		$offset = $datetime->format('P');
812
-	    } else $offset = '+00:00';
812
+		} else $offset = '+00:00';
813 813
 
814 814
 
815
-	    if ($date_array[1] != "")
816
-	    {                
815
+		if ($date_array[1] != "")
816
+		{                
817 817
 		$date_array[0] = date("Y-m-d H:i:s", strtotime($date_array[0]));
818 818
 		$date_array[1] = date("Y-m-d H:i:s", strtotime($date_array[1]));
819 819
 		if ($globalDBdriver == 'mysql') {
@@ -821,28 +821,28 @@  discard block
 block discarded – undo
821 821
 		} else {
822 822
 			$additional_query .= " AND tracker_archive_output.date::timestamp AT TIME ZONE INTERVAL ".$offset." >= CAST('".$date_array[0]."' AS TIMESTAMP) AND tracker_archive_output.date::timestamp AT TIME ZONE INTERVAL ".$offset." <= CAST('".$date_array[1]."' AS TIMESTAMP) ";
823 823
 		}
824
-	    } else {
824
+		} else {
825 825
 		$date_array[0] = date("Y-m-d H:i:s", strtotime($date_array[0]));
826
-                if ($globalDBdriver == 'mysql') {
826
+				if ($globalDBdriver == 'mysql') {
827 827
 			$additional_query .= " AND TIMESTAMP(CONVERT_TZ(tracker_archive_output.date,'+00:00', '".$offset."')) >= '".$date_array[0]."' ";
828 828
 		} else {
829 829
 			$additional_query .= " AND tracker_archive_output.date::timestamp AT TIME ZONE INTERVAL ".$offset." >= CAST('".$date_array[0]."' AS TIMESTAMP) ";
830 830
 		}
831
-	    }
831
+		}
832 832
 	}
833 833
 	
834 834
 	if ($limit != "")
835 835
 	{
836
-	    $limit_array = explode(",", $limit);
836
+		$limit_array = explode(",", $limit);
837 837
 	    
838
-	    $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
839
-	    $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
838
+		$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
839
+		$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
840 840
 	    
841
-	    if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
842
-	    {
841
+		if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
842
+		{
843 843
 		//$limit_query = " LIMIT ".$limit_array[0].",".$limit_array[1];
844 844
 		$limit_query = " LIMIT ".$limit_array[1]." OFFSET ".$limit_array[0];
845
-	    }
845
+		}
846 846
 	}
847 847
 	
848 848
 
@@ -873,33 +873,33 @@  discard block
 block discarded – undo
873 873
 	$spotter_array = $Tracker->getDataFromDB($query, $query_values,$limit_query);
874 874
 
875 875
 	return $spotter_array;
876
-    }
876
+	}
877 877
 
878
-    public function deleteTrackerArchiveData()
879
-    {
878
+	public function deleteTrackerArchiveData()
879
+	{
880 880
 		global $globalArchiveKeepMonths, $globalDBdriver;
881
-                date_default_timezone_set('UTC');
882
-                if ($globalDBdriver == 'mysql') {
881
+				date_default_timezone_set('UTC');
882
+				if ($globalDBdriver == 'mysql') {
883 883
 			$query = 'DELETE FROM tracker_archive_output WHERE tracker_archive_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$globalArchiveKeepMonths.' MONTH)';
884 884
 		} else {
885 885
 			$query = "DELETE FROM tracker_archive_output WHERE tracker_archive_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalArchiveKeepMonths." MONTH'";
886 886
 		}
887
-                try {
888
-                        $sth = $this->db->prepare($query);
889
-                        $sth->execute();
890
-                } catch(PDOException $e) {
891
-                        return "error";
892
-                }
887
+				try {
888
+						$sth = $this->db->prepare($query);
889
+						$sth->execute();
890
+				} catch(PDOException $e) {
891
+						return "error";
892
+				}
893 893
 	}
894 894
 
895
-    /**
896
-    * Gets all the spotter information based on the callsign
897
-    *
898
-    * @return Array the spotter information
899
-    *
900
-    */
901
-    public function getTrackerDataByIdent($ident = '', $limit = '', $sort = '')
902
-    {
895
+	/**
896
+	 * Gets all the spotter information based on the callsign
897
+	 *
898
+	 * @return Array the spotter information
899
+	 *
900
+	 */
901
+	public function getTrackerDataByIdent($ident = '', $limit = '', $sort = '')
902
+	{
903 903
 	$global_query = "SELECT tracker_archive_output.* FROM tracker_archive_output";
904 904
 	
905 905
 	date_default_timezone_set('UTC');
@@ -911,35 +911,35 @@  discard block
 block discarded – undo
911 911
 	
912 912
 	if ($ident != "")
913 913
 	{
914
-	    if (!is_string($ident))
915
-	    {
914
+		if (!is_string($ident))
915
+		{
916 916
 		return false;
917
-	    } else {
917
+		} else {
918 918
 		$additional_query = " AND (tracker_archive_output.ident = :ident)";
919 919
 		$query_values = array(':ident' => $ident);
920
-	    }
920
+		}
921 921
 	}
922 922
 	
923 923
 	if ($limit != "")
924 924
 	{
925
-	    $limit_array = explode(",", $limit);
925
+		$limit_array = explode(",", $limit);
926 926
 	    
927
-	    $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
928
-	    $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
927
+		$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
928
+		$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
929 929
 	    
930
-	    if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
931
-	    {
930
+		if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
931
+		{
932 932
 		//$limit_query = " LIMIT ".$limit_array[0].",".$limit_array[1];
933 933
 		$limit_query = " LIMIT ".$limit_array[1]." OFFSET ".$limit_array[0];
934
-	    }
934
+		}
935 935
 	}
936 936
 
937 937
 	if ($sort != "")
938 938
 	{
939
-	    $search_orderby_array = $Tracker->getOrderBy();
940
-	    $orderby_query = $search_orderby_array[$sort]['sql'];
939
+		$search_orderby_array = $Tracker->getOrderBy();
940
+		$orderby_query = $search_orderby_array[$sort]['sql'];
941 941
 	} else {
942
-	    $orderby_query = " ORDER BY tracker_archive_output.date DESC";
942
+		$orderby_query = " ORDER BY tracker_archive_output.date DESC";
943 943
 	}
944 944
 
945 945
 	$query = $global_query." WHERE tracker_archive_output.ident <> '' ".$additional_query." ".$orderby_query;
@@ -947,17 +947,17 @@  discard block
 block discarded – undo
947 947
 	$spotter_array = $Tracker->getDataFromDB($query, $query_values, $limit_query);
948 948
 
949 949
 	return $spotter_array;
950
-    }
950
+	}
951 951
 
952 952
 
953
-    /**
954
-    * Gets all the spotter information based on the owner
955
-    *
956
-    * @return Array the spotter information
957
-    *
958
-    */
959
-    public function getTrackerDataByOwner($owner = '', $limit = '', $sort = '', $filter = array())
960
-    {
953
+	/**
954
+	 * Gets all the spotter information based on the owner
955
+	 *
956
+	 * @return Array the spotter information
957
+	 *
958
+	 */
959
+	public function getTrackerDataByOwner($owner = '', $limit = '', $sort = '', $filter = array())
960
+	{
961 961
 	$global_query = "SELECT tracker_archive_output.* FROM tracker_archive_output";
962 962
 	
963 963
 	date_default_timezone_set('UTC');
@@ -970,35 +970,35 @@  discard block
 block discarded – undo
970 970
 	
971 971
 	if ($owner != "")
972 972
 	{
973
-	    if (!is_string($owner))
974
-	    {
973
+		if (!is_string($owner))
974
+		{
975 975
 		return false;
976
-	    } else {
976
+		} else {
977 977
 		$additional_query = " AND (tracker_archive_output.owner_name = :owner)";
978 978
 		$query_values = array(':owner' => $owner);
979
-	    }
979
+		}
980 980
 	}
981 981
 	
982 982
 	if ($limit != "")
983 983
 	{
984
-	    $limit_array = explode(",", $limit);
984
+		$limit_array = explode(",", $limit);
985 985
 	    
986
-	    $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
987
-	    $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
986
+		$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
987
+		$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
988 988
 	    
989
-	    if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
990
-	    {
989
+		if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
990
+		{
991 991
 		//$limit_query = " LIMIT ".$limit_array[0].",".$limit_array[1];
992 992
 		$limit_query = " LIMIT ".$limit_array[1]." OFFSET ".$limit_array[0];
993
-	    }
993
+		}
994 994
 	}
995 995
 
996 996
 	if ($sort != "")
997 997
 	{
998
-	    $search_orderby_array = $Tracker->getOrderBy();
999
-	    $orderby_query = $search_orderby_array[$sort]['sql'];
998
+		$search_orderby_array = $Tracker->getOrderBy();
999
+		$orderby_query = $search_orderby_array[$sort]['sql'];
1000 1000
 	} else {
1001
-	    $orderby_query = " ORDER BY tracker_archive_output.date DESC";
1001
+		$orderby_query = " ORDER BY tracker_archive_output.date DESC";
1002 1002
 	}
1003 1003
 
1004 1004
 	$query = $global_query.$filter_query." tracker_archive_output.owner_name <> '' ".$additional_query." ".$orderby_query;
@@ -1006,16 +1006,16 @@  discard block
 block discarded – undo
1006 1006
 	$spotter_array = $Tracker->getDataFromDB($query, $query_values, $limit_query);
1007 1007
 
1008 1008
 	return $spotter_array;
1009
-    }
1010
-
1011
-    /**
1012
-    * Gets all the spotter information based on the pilot
1013
-    *
1014
-    * @return Array the spotter information
1015
-    *
1016
-    */
1017
-    public function getTrackerDataByPilot($pilot = '', $limit = '', $sort = '', $filter = array())
1018
-    {
1009
+	}
1010
+
1011
+	/**
1012
+	 * Gets all the spotter information based on the pilot
1013
+	 *
1014
+	 * @return Array the spotter information
1015
+	 *
1016
+	 */
1017
+	public function getTrackerDataByPilot($pilot = '', $limit = '', $sort = '', $filter = array())
1018
+	{
1019 1019
 	$global_query = "SELECT tracker_archive_output.* FROM tracker_archive_output";
1020 1020
 	
1021 1021
 	date_default_timezone_set('UTC');
@@ -1034,24 +1034,24 @@  discard block
 block discarded – undo
1034 1034
 	
1035 1035
 	if ($limit != "")
1036 1036
 	{
1037
-	    $limit_array = explode(",", $limit);
1037
+		$limit_array = explode(",", $limit);
1038 1038
 	    
1039
-	    $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1040
-	    $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1039
+		$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1040
+		$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1041 1041
 	    
1042
-	    if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1043
-	    {
1042
+		if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1043
+		{
1044 1044
 		//$limit_query = " LIMIT ".$limit_array[0].",".$limit_array[1];
1045 1045
 		$limit_query = " LIMIT ".$limit_array[1]." OFFSET ".$limit_array[0];
1046
-	    }
1046
+		}
1047 1047
 	}
1048 1048
 
1049 1049
 	if ($sort != "")
1050 1050
 	{
1051
-	    $search_orderby_array = $Tracker->getOrderBy();
1052
-	    $orderby_query = $search_orderby_array[$sort]['sql'];
1051
+		$search_orderby_array = $Tracker->getOrderBy();
1052
+		$orderby_query = $search_orderby_array[$sort]['sql'];
1053 1053
 	} else {
1054
-	    $orderby_query = " ORDER BY tracker_archive_output.date DESC";
1054
+		$orderby_query = " ORDER BY tracker_archive_output.date DESC";
1055 1055
 	}
1056 1056
 
1057 1057
 	$query = $global_query.$filter_query." tracker_archive_output.pilot_name <> '' ".$additional_query." ".$orderby_query;
@@ -1059,16 +1059,16 @@  discard block
 block discarded – undo
1059 1059
 	$spotter_array = $Tracker->getDataFromDB($query, $query_values, $limit_query);
1060 1060
 
1061 1061
 	return $spotter_array;
1062
-    }
1063
-
1064
-    /**
1065
-    * Gets all number of flight over countries
1066
-    *
1067
-    * @return Array the airline country list
1068
-    *
1069
-    */
1070
-    public function countAllFlightOverCountries($limit = true,$olderthanmonths = 0,$sincedate = '')
1071
-    {
1062
+	}
1063
+
1064
+	/**
1065
+	 * Gets all number of flight over countries
1066
+	 *
1067
+	 * @return Array the airline country list
1068
+	 *
1069
+	 */
1070
+	public function countAllFlightOverCountries($limit = true,$olderthanmonths = 0,$sincedate = '')
1071
+	{
1072 1072
 	global $globalDBdriver;
1073 1073
 	/*
1074 1074
 	$query = "SELECT c.name, c.iso3, c.iso2, count(c.name) as nb 
@@ -1078,14 +1078,14 @@  discard block
 block discarded – undo
1078 1078
 	$query = "SELECT c.name, c.iso3, c.iso2, count(c.name) as nb
1079 1079
 		    FROM countries c, tracker_archive s
1080 1080
 		    WHERE c.iso2 = s.over_country ";
1081
-                if ($olderthanmonths > 0) {
1082
-            		if ($globalDBdriver == 'mysql') {
1081
+				if ($olderthanmonths > 0) {
1082
+					if ($globalDBdriver == 'mysql') {
1083 1083
 				$query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
1084 1084
 			} else {
1085 1085
 				$query .= "AND date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
1086 1086
 			}
1087 1087
 		}
1088
-                if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
1088
+				if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
1089 1089
 	$query .= "GROUP BY c.name, c.iso3, c.iso2 ORDER BY nb DESC";
1090 1090
 	if ($limit) $query .= " LIMIT 0,10";
1091 1091
       
@@ -1098,23 +1098,23 @@  discard block
 block discarded – undo
1098 1098
         
1099 1099
 	while($row = $sth->fetch(PDO::FETCH_ASSOC))
1100 1100
 	{
1101
-	    $temp_array['flight_count'] = $row['nb'];
1102
-	    $temp_array['flight_country'] = $row['name'];
1103
-	    $temp_array['flight_country_iso3'] = $row['iso3'];
1104
-	    $temp_array['flight_country_iso2'] = $row['iso2'];
1105
-	    $flight_array[] = $temp_array;
1101
+		$temp_array['flight_count'] = $row['nb'];
1102
+		$temp_array['flight_country'] = $row['name'];
1103
+		$temp_array['flight_country_iso3'] = $row['iso3'];
1104
+		$temp_array['flight_country_iso2'] = $row['iso2'];
1105
+		$flight_array[] = $temp_array;
1106 1106
 	}
1107 1107
 	return $flight_array;
1108
-    }
1109
-
1110
-    /**
1111
-    * Gets all number of flight over countries
1112
-    *
1113
-    * @return Array the airline country list
1114
-    *
1115
-    */
1116
-    public function countAllFlightOverCountriesByAirlines($limit = true,$olderthanmonths = 0,$sincedate = '')
1117
-    {
1108
+	}
1109
+
1110
+	/**
1111
+	 * Gets all number of flight over countries
1112
+	 *
1113
+	 * @return Array the airline country list
1114
+	 *
1115
+	 */
1116
+	public function countAllFlightOverCountriesByAirlines($limit = true,$olderthanmonths = 0,$sincedate = '')
1117
+	{
1118 1118
 	global $globalDBdriver;
1119 1119
 	/*
1120 1120
 	$query = "SELECT c.name, c.iso3, c.iso2, count(c.name) as nb 
@@ -1124,14 +1124,14 @@  discard block
 block discarded – undo
1124 1124
 	$query = "SELECT o.airline_icao,c.name, c.iso3, c.iso2, count(c.name) as nb
1125 1125
 		    FROM countries c, tracker_archive s, spotter_output o
1126 1126
 		    WHERE c.iso2 = s.over_country AND o.airline_icao <> '' AND o.famtrackid = s.famtrackid ";
1127
-                if ($olderthanmonths > 0) {
1128
-            		if ($globalDBdriver == 'mysql') {
1127
+				if ($olderthanmonths > 0) {
1128
+					if ($globalDBdriver == 'mysql') {
1129 1129
 				$query .= 'AND s.date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
1130 1130
 			} else {
1131 1131
 				$query .= "AND s.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
1132 1132
 			}
1133 1133
 		}
1134
-                if ($sincedate != '') $query .= "AND s.date > '".$sincedate."' ";
1134
+				if ($sincedate != '') $query .= "AND s.date > '".$sincedate."' ";
1135 1135
 	$query .= "GROUP BY o.airline_icao,c.name, c.iso3, c.iso2 ORDER BY nb DESC";
1136 1136
 	if ($limit) $query .= " LIMIT 0,10";
1137 1137
       
@@ -1144,24 +1144,24 @@  discard block
 block discarded – undo
1144 1144
         
1145 1145
 	while($row = $sth->fetch(PDO::FETCH_ASSOC))
1146 1146
 	{
1147
-	    $temp_array['airline_icao'] = $row['airline_icao'];
1148
-	    $temp_array['flight_count'] = $row['nb'];
1149
-	    $temp_array['flight_country'] = $row['name'];
1150
-	    $temp_array['flight_country_iso3'] = $row['iso3'];
1151
-	    $temp_array['flight_country_iso2'] = $row['iso2'];
1152
-	    $flight_array[] = $temp_array;
1147
+		$temp_array['airline_icao'] = $row['airline_icao'];
1148
+		$temp_array['flight_count'] = $row['nb'];
1149
+		$temp_array['flight_country'] = $row['name'];
1150
+		$temp_array['flight_country_iso3'] = $row['iso3'];
1151
+		$temp_array['flight_country_iso2'] = $row['iso2'];
1152
+		$flight_array[] = $temp_array;
1153 1153
 	}
1154 1154
 	return $flight_array;
1155
-    }
1156
-
1157
-    /**
1158
-    * Gets last spotter information based on a particular callsign
1159
-    *
1160
-    * @return Array the spotter information
1161
-    *
1162
-    */
1163
-    public function getDateArchiveTrackerDataById($id,$date)
1164
-    {
1155
+	}
1156
+
1157
+	/**
1158
+	 * Gets last spotter information based on a particular callsign
1159
+	 *
1160
+	 * @return Array the spotter information
1161
+	 *
1162
+	 */
1163
+	public function getDateArchiveTrackerDataById($id,$date)
1164
+	{
1165 1165
 	$Tracker = new Tracker($this->db);
1166 1166
 	date_default_timezone_set('UTC');
1167 1167
 	$id = filter_var($id, FILTER_SANITIZE_STRING);
@@ -1169,16 +1169,16 @@  discard block
 block discarded – undo
1169 1169
 	$date = date('c',$date);
1170 1170
 	$spotter_array = $Tracker->getDataFromDB($query,array(':id' => $id,':date' => $date));
1171 1171
 	return $spotter_array;
1172
-    }
1173
-
1174
-    /**
1175
-    * Gets all the spotter information based on a particular callsign
1176
-    *
1177
-    * @return Array the spotter information
1178
-    *
1179
-    */
1180
-    public function getDateArchiveTrackerDataByIdent($ident,$date)
1181
-    {
1172
+	}
1173
+
1174
+	/**
1175
+	 * Gets all the spotter information based on a particular callsign
1176
+	 *
1177
+	 * @return Array the spotter information
1178
+	 *
1179
+	 */
1180
+	public function getDateArchiveTrackerDataByIdent($ident,$date)
1181
+	{
1182 1182
 	$Tracker = new Tracker($this->db);
1183 1183
 	date_default_timezone_set('UTC');
1184 1184
 	$ident = filter_var($ident, FILTER_SANITIZE_STRING);
@@ -1186,16 +1186,16 @@  discard block
 block discarded – undo
1186 1186
 	$date = date('c',$date);
1187 1187
 	$spotter_array = $Tracker->getDataFromDB($query,array(':ident' => $ident,':date' => $date));
1188 1188
 	return $spotter_array;
1189
-    }
1190
-
1191
-    /**
1192
-    * Gets all the spotter information based on the airport
1193
-    *
1194
-    * @return Array the spotter information
1195
-    *
1196
-    */
1197
-    public function getTrackerDataByAirport($airport = '', $limit = '', $sort = '',$filters = array())
1198
-    {
1189
+	}
1190
+
1191
+	/**
1192
+	 * Gets all the spotter information based on the airport
1193
+	 *
1194
+	 * @return Array the spotter information
1195
+	 *
1196
+	 */
1197
+	public function getTrackerDataByAirport($airport = '', $limit = '', $sort = '',$filters = array())
1198
+	{
1199 1199
 	global $global_query;
1200 1200
 	$Tracker = new Tracker();
1201 1201
 	date_default_timezone_set('UTC');
@@ -1206,35 +1206,35 @@  discard block
 block discarded – undo
1206 1206
 	
1207 1207
 	if ($airport != "")
1208 1208
 	{
1209
-	    if (!is_string($airport))
1210
-	    {
1209
+		if (!is_string($airport))
1210
+		{
1211 1211
 		return false;
1212
-	    } else {
1212
+		} else {
1213 1213
 		$additional_query .= " AND ((tracker_archive_output.departure_airport_icao = :airport) OR (tracker_archive_output.arrival_airport_icao = :airport))";
1214 1214
 		$query_values = array(':airport' => $airport);
1215
-	    }
1215
+		}
1216 1216
 	}
1217 1217
 	
1218 1218
 	if ($limit != "")
1219 1219
 	{
1220
-	    $limit_array = explode(",", $limit);
1220
+		$limit_array = explode(",", $limit);
1221 1221
 	    
1222
-	    $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1223
-	    $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1222
+		$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1223
+		$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1224 1224
 	    
1225
-	    if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1226
-	    {
1225
+		if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1226
+		{
1227 1227
 		//$limit_query = " LIMIT ".$limit_array[0].",".$limit_array[1];
1228 1228
 		$limit_query = " LIMIT ".$limit_array[1]." OFFSET ".$limit_array[0];
1229
-	    }
1229
+		}
1230 1230
 	}
1231 1231
 	
1232 1232
 	if ($sort != "")
1233 1233
 	{
1234
-	    $search_orderby_array = $Tracker->getOrderBy();
1235
-	    $orderby_query = $search_orderby_array[$sort]['sql'];
1234
+		$search_orderby_array = $Tracker->getOrderBy();
1235
+		$orderby_query = $search_orderby_array[$sort]['sql'];
1236 1236
 	} else {
1237
-	    $orderby_query = " ORDER BY tracker_archive_output.date DESC";
1237
+		$orderby_query = " ORDER BY tracker_archive_output.date DESC";
1238 1238
 	}
1239 1239
 
1240 1240
 	$query = $global_query.$filter_query." tracker_archive_output.ident <> '' ".$additional_query." AND ((tracker_archive_output.departure_airport_icao <> 'NA') AND (tracker_archive_output.arrival_airport_icao <> 'NA')) ".$orderby_query;
@@ -1242,6 +1242,6 @@  discard block
 block discarded – undo
1242 1242
 	$spotter_array = $Tracker->getDataFromDB($query, $query_values, $limit_query);
1243 1243
 
1244 1244
 	return $spotter_array;
1245
-    }
1245
+	}
1246 1246
 }
1247 1247
 ?>
1248 1248
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +105 added lines, -105 removed lines patch added patch discarded remove patch
@@ -13,33 +13,33 @@  discard block
 block discarded – undo
13 13
 	* @param Array $filter the filter
14 14
 	* @return Array the SQL part
15 15
 	*/
16
-	public function getFilter($filter = array(),$where = false,$and = false) {
16
+	public function getFilter($filter = array(), $where = false, $and = false) {
17 17
 		global $globalFilter, $globalStatsFilters, $globalFilterName, $globalDBdriver;
18 18
 		$filters = array();
19 19
 		if (is_array($globalStatsFilters) && isset($globalStatsFilters[$globalFilterName])) {
20 20
 			if (isset($globalStatsFilters[$globalFilterName][0]['source'])) {
21 21
 				$filters = $globalStatsFilters[$globalFilterName];
22 22
 			} else {
23
-				$filter = array_merge($filter,$globalStatsFilters[$globalFilterName]);
23
+				$filter = array_merge($filter, $globalStatsFilters[$globalFilterName]);
24 24
 			}
25 25
 		}
26 26
 		if (isset($filter[0]['source'])) {
27
-			$filters = array_merge($filters,$filter);
27
+			$filters = array_merge($filters, $filter);
28 28
 		}
29
-		if (is_array($globalFilter)) $filter = array_merge($filter,$globalFilter);
29
+		if (is_array($globalFilter)) $filter = array_merge($filter, $globalFilter);
30 30
 		$filter_query_join = '';
31 31
 		$filter_query_where = '';
32
-		foreach($filters as $flt) {
32
+		foreach ($filters as $flt) {
33 33
 			if (isset($flt['idents']) && !empty($flt['idents'])) {
34 34
 				if (isset($flt['source'])) {
35
-					$filter_query_join .= " INNER JOIN (SELECT famtrackid FROM tracker_archive_output WHERE tracker_archive_output.ident IN ('".implode("','",$flt['idents'])."') AND tracker_archive_output.format_source IN ('".implode("','",$flt['source'])."')) spid ON spid.famtrackid = tracker_archive.famtrackid";
35
+					$filter_query_join .= " INNER JOIN (SELECT famtrackid FROM tracker_archive_output WHERE tracker_archive_output.ident IN ('".implode("','", $flt['idents'])."') AND tracker_archive_output.format_source IN ('".implode("','", $flt['source'])."')) spid ON spid.famtrackid = tracker_archive.famtrackid";
36 36
 				} else {
37
-					$filter_query_join .= " INNER JOIN (SELECT famtrackid FROM tracker_archive_output WHERE tracker_archive_output.ident IN ('".implode("','",$flt['idents'])."')) spid ON spid.famtrackid = tracker_archive.famtrackid";
37
+					$filter_query_join .= " INNER JOIN (SELECT famtrackid FROM tracker_archive_output WHERE tracker_archive_output.ident IN ('".implode("','", $flt['idents'])."')) spid ON spid.famtrackid = tracker_archive.famtrackid";
38 38
 				}
39 39
 			}
40 40
 		}
41 41
 		if (isset($filter['source']) && !empty($filter['source'])) {
42
-			$filter_query_where .= " AND format_source IN ('".implode("','",$filter['source'])."')";
42
+			$filter_query_where .= " AND format_source IN ('".implode("','", $filter['source'])."')";
43 43
 		}
44 44
 		if (isset($filter['ident']) && !empty($filter['ident'])) {
45 45
 			$filter_query_where .= " AND ident = '".$filter['ident']."'";
@@ -67,22 +67,22 @@  discard block
 block discarded – undo
67 67
 					$filter_query_date .= " AND EXTRACT(DAY FROM tracker_archive_output.date) = '".$filter['day']."'";
68 68
 				}
69 69
 			}
70
-			$filter_query_join .= " INNER JOIN (SELECT famtrackid FROM tracker_archive_output".preg_replace('/^ AND/',' WHERE',$filter_query_date).") sd ON sd.famtrackid = tracker_archive.famtrackid";
70
+			$filter_query_join .= " INNER JOIN (SELECT famtrackid FROM tracker_archive_output".preg_replace('/^ AND/', ' WHERE', $filter_query_date).") sd ON sd.famtrackid = tracker_archive.famtrackid";
71 71
 		}
72 72
 		if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) {
73
-			$filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')";
73
+			$filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','", $filter['source_aprs'])."')";
74 74
 		}
75 75
 		if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE';
76 76
 		elseif ($filter_query_where != '' && $and) $filter_query_where .= ' AND';
77 77
 		if ($filter_query_where != '') {
78
-			$filter_query_where = preg_replace('/^ AND/',' WHERE',$filter_query_where);
78
+			$filter_query_where = preg_replace('/^ AND/', ' WHERE', $filter_query_where);
79 79
 		}
80 80
 		$filter_query = $filter_query_join.$filter_query_where;
81 81
 		return $filter_query;
82 82
 	}
83 83
 
84 84
 	// tracker_archive
85
-	public function addTrackerArchiveData($famtrackid = '', $ident = '', $latitude = '', $longitude = '', $altitude = '', $heading = '', $groundspeed = '', $date = '', $putinarchive = false, $comment = '', $type = '',$noarchive = false,$format_source = '', $source_name = '', $over_country = '') {
85
+	public function addTrackerArchiveData($famtrackid = '', $ident = '', $latitude = '', $longitude = '', $altitude = '', $heading = '', $groundspeed = '', $date = '', $putinarchive = false, $comment = '', $type = '', $noarchive = false, $format_source = '', $source_name = '', $over_country = '') {
86 86
 		/*
87 87
 		require_once(dirname(__FILE__).'/class.Tracker.php');
88 88
 		if ($over_country == '') {
@@ -96,12 +96,12 @@  discard block
 block discarded – undo
96 96
 		// Route is not added in tracker_archive
97 97
 		$query  .= 'INSERT INTO tracker_archive (famtrackid, ident, latitude, longitude, altitude, heading, ground_speed, date, format_source, source_name, over_country, comment, type) 
98 98
 		    VALUES (:famtrackid,:ident,:latitude,:longitude,:altitude,:heading,:groundspeed,:date,:format_source, :source_name, :over_country,:comment,:type)';
99
-		$query_values = array(':famtrackid' => $famtrackid,':ident' => $ident,':latitude' => $latitude,':longitude' => $longitude,':altitude' => $altitude,':heading' => $heading,':groundspeed' => $groundspeed,':date' => $date, ':format_source' => $format_source, ':source_name' => $source_name, ':over_country' => $over_country,':comment' => $comment,':type' => $type);
99
+		$query_values = array(':famtrackid' => $famtrackid, ':ident' => $ident, ':latitude' => $latitude, ':longitude' => $longitude, ':altitude' => $altitude, ':heading' => $heading, ':groundspeed' => $groundspeed, ':date' => $date, ':format_source' => $format_source, ':source_name' => $source_name, ':over_country' => $over_country, ':comment' => $comment, ':type' => $type);
100 100
 		try {
101 101
 			$sth = $this->db->prepare($query);
102 102
 			$sth->execute($query_values);
103 103
 			$sth->closeCursor();
104
-		} catch(PDOException $e) {
104
+		} catch (PDOException $e) {
105 105
 			return "error : ".$e->getMessage();
106 106
 		}
107 107
 		return "success";
@@ -121,9 +121,9 @@  discard block
 block discarded – undo
121 121
 
122 122
                 $ident = filter_var($ident, FILTER_SANITIZE_STRING);
123 123
                 //$query  = "SELECT tracker_archive.* FROM tracker_archive INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_archive l WHERE l.ident = :ident GROUP BY l.famtrackid) s on tracker_archive.famtrackid = s.famtrackid AND tracker_archive.date = s.maxdate LIMIT 1";
124
-                $query  = "SELECT tracker_archive.* FROM tracker_archive WHERE ident = :ident ORDER BY date DESC LIMIT 1";
124
+                $query = "SELECT tracker_archive.* FROM tracker_archive WHERE ident = :ident ORDER BY date DESC LIMIT 1";
125 125
 
126
-                $spotter_array = $Tracker->getDataFromDB($query,array(':ident' => $ident));
126
+                $spotter_array = $Tracker->getDataFromDB($query, array(':ident' => $ident));
127 127
 
128 128
                 return $spotter_array;
129 129
         }
@@ -142,7 +142,7 @@  discard block
 block discarded – undo
142 142
                 $id = filter_var($id, FILTER_SANITIZE_STRING);
143 143
                 //$query  = TrackerArchive->$global_query." WHERE tracker_archive.famtrackid = :id";
144 144
                 //$query  = "SELECT tracker_archive.* FROM tracker_archive INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_archive l WHERE l.famtrackid = :id GROUP BY l.famtrackid) s on tracker_archive.famtrackid = s.famtrackid AND tracker_archive.date = s.maxdate LIMIT 1";
145
-                $query  = "SELECT * FROM tracker_archive WHERE famtrackid = :id ORDER BY date DESC LIMIT 1";
145
+                $query = "SELECT * FROM tracker_archive WHERE famtrackid = :id ORDER BY date DESC LIMIT 1";
146 146
 
147 147
 //              $spotter_array = Tracker->getDataFromDB($query,array(':id' => $id));
148 148
                   /*
@@ -155,7 +155,7 @@  discard block
 block discarded – undo
155 155
                 }
156 156
                 $spotter_array = $sth->fetchAll(PDO->FETCH_ASSOC);
157 157
                 */
158
-                $spotter_array = $Tracker->getDataFromDB($query,array(':id' => $id));
158
+                $spotter_array = $Tracker->getDataFromDB($query, array(':id' => $id));
159 159
 
160 160
                 return $spotter_array;
161 161
         }
@@ -170,14 +170,14 @@  discard block
 block discarded – undo
170 170
 	{
171 171
                 date_default_timezone_set('UTC');
172 172
                 $id = filter_var($id, FILTER_SANITIZE_STRING);
173
-                $query  = $this->global_query." WHERE tracker_archive.famtrackid = :id ORDER BY date";
173
+                $query = $this->global_query." WHERE tracker_archive.famtrackid = :id ORDER BY date";
174 174
 
175 175
 //              $spotter_array = Tracker->getDataFromDB($query,array(':id' => $id));
176 176
 
177 177
                 try {
178 178
                         $sth = $this->db->prepare($query);
179 179
                         $sth->execute(array(':id' => $id));
180
-                } catch(PDOException $e) {
180
+                } catch (PDOException $e) {
181 181
                         echo $e->getMessage();
182 182
                         die;
183 183
                 }
@@ -196,14 +196,14 @@  discard block
 block discarded – undo
196 196
         {
197 197
                 date_default_timezone_set('UTC');
198 198
                 $id = filter_var($id, FILTER_SANITIZE_STRING);
199
-                $query  = "SELECT tracker_archive.latitude, tracker_archive.longitude, tracker_archive.date FROM tracker_archive WHERE tracker_archive.famtrackid = :id";
199
+                $query = "SELECT tracker_archive.latitude, tracker_archive.longitude, tracker_archive.date FROM tracker_archive WHERE tracker_archive.famtrackid = :id";
200 200
 
201 201
 //              $spotter_array = Tracker->getDataFromDB($query,array(':id' => $id));
202 202
 
203 203
                 try {
204 204
                         $sth = $this->db->prepare($query);
205 205
                         $sth->execute(array(':id' => $id));
206
-                } catch(PDOException $e) {
206
+                } catch (PDOException $e) {
207 207
                         echo $e->getMessage();
208 208
                         die;
209 209
                 }
@@ -225,12 +225,12 @@  discard block
 block discarded – undo
225 225
                 date_default_timezone_set('UTC');
226 226
 
227 227
                 $ident = filter_var($ident, FILTER_SANITIZE_STRING);
228
-                $query  = "SELECT tracker_archive.altitude, tracker_archive.date FROM tracker_archive WHERE tracker_archive.ident = :ident AND tracker_archive.latitude <> 0 AND tracker_archive.longitude <> 0 ORDER BY date";
228
+                $query = "SELECT tracker_archive.altitude, tracker_archive.date FROM tracker_archive WHERE tracker_archive.ident = :ident AND tracker_archive.latitude <> 0 AND tracker_archive.longitude <> 0 ORDER BY date";
229 229
 
230 230
                 try {
231 231
                         $sth = $this->db->prepare($query);
232 232
                         $sth->execute(array(':ident' => $ident));
233
-                } catch(PDOException $e) {
233
+                } catch (PDOException $e) {
234 234
                         echo $e->getMessage();
235 235
                         die;
236 236
                 }
@@ -251,12 +251,12 @@  discard block
 block discarded – undo
251 251
                 date_default_timezone_set('UTC');
252 252
 
253 253
                 $id = filter_var($id, FILTER_SANITIZE_STRING);
254
-                $query  = "SELECT tracker_archive.altitude, tracker_archive.date FROM tracker_archive WHERE tracker_archive.famtrackid = :id AND tracker_archive.latitude <> 0 AND tracker_archive.longitude <> 0 ORDER BY date";
254
+                $query = "SELECT tracker_archive.altitude, tracker_archive.date FROM tracker_archive WHERE tracker_archive.famtrackid = :id AND tracker_archive.latitude <> 0 AND tracker_archive.longitude <> 0 ORDER BY date";
255 255
 
256 256
                 try {
257 257
                         $sth = $this->db->prepare($query);
258 258
                         $sth->execute(array(':id' => $id));
259
-                } catch(PDOException $e) {
259
+                } catch (PDOException $e) {
260 260
                         echo $e->getMessage();
261 261
                         die;
262 262
                 }
@@ -277,12 +277,12 @@  discard block
 block discarded – undo
277 277
                 date_default_timezone_set('UTC');
278 278
 
279 279
                 $id = filter_var($id, FILTER_SANITIZE_STRING);
280
-                $query  = "SELECT tracker_archive.altitude, tracker_archive.ground_speed, tracker_archive.date FROM tracker_archive WHERE tracker_archive.famtrackid = :id ORDER BY date";
280
+                $query = "SELECT tracker_archive.altitude, tracker_archive.ground_speed, tracker_archive.date FROM tracker_archive WHERE tracker_archive.famtrackid = :id ORDER BY date";
281 281
 
282 282
                 try {
283 283
                         $sth = $this->db->prepare($query);
284 284
                         $sth->execute(array(':id' => $id));
285
-                } catch(PDOException $e) {
285
+                } catch (PDOException $e) {
286 286
                         echo $e->getMessage();
287 287
                         die;
288 288
                 }
@@ -304,13 +304,13 @@  discard block
 block discarded – undo
304 304
                 date_default_timezone_set('UTC');
305 305
 
306 306
                 $ident = filter_var($ident, FILTER_SANITIZE_STRING);
307
-                $query  = "SELECT tracker_archive.altitude, tracker_archive.date FROM tracker_archive INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_archive l WHERE l.ident = :ident GROUP BY l.famtrackid) s on tracker_archive.famtrackid = s.famtrackid AND tracker_archive.date = s.maxdate LIMIT 1";
307
+                $query = "SELECT tracker_archive.altitude, tracker_archive.date FROM tracker_archive INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_archive l WHERE l.ident = :ident GROUP BY l.famtrackid) s on tracker_archive.famtrackid = s.famtrackid AND tracker_archive.date = s.maxdate LIMIT 1";
308 308
 //                $query  = "SELECT tracker_archive.altitude, tracker_archive.date FROM tracker_archive WHERE tracker_archive.ident = :ident";
309 309
 
310 310
                 try {
311 311
                         $sth = $this->db->prepare($query);
312 312
                         $sth->execute(array(':ident' => $ident));
313
-                } catch(PDOException $e) {
313
+                } catch (PDOException $e) {
314 314
                         echo $e->getMessage();
315 315
                         die;
316 316
                 }
@@ -327,13 +327,13 @@  discard block
 block discarded – undo
327 327
         * @return Array the spotter information
328 328
         *
329 329
         */
330
-        public function getTrackerArchiveData($ident,$famtrackid,$date)
330
+        public function getTrackerArchiveData($ident, $famtrackid, $date)
331 331
         {
332 332
     		$Tracker = new Tracker($this->db);
333 333
                 $ident = filter_var($ident, FILTER_SANITIZE_STRING);
334
-                $query  = "SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM spotter_live l WHERE l.ident = :ident AND l.famtrackid = :famtrackid AND l.date LIKE :date GROUP BY l.famtrackid) s on spotter_live.famtrackid = s.famtrackid AND spotter_live.date = s.maxdate";
334
+                $query = "SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM spotter_live l WHERE l.ident = :ident AND l.famtrackid = :famtrackid AND l.date LIKE :date GROUP BY l.famtrackid) s on spotter_live.famtrackid = s.famtrackid AND spotter_live.date = s.maxdate";
335 335
 
336
-                $spotter_array = $Tracker->getDataFromDB($query,array(':ident' => $ident,':famtrackid' => $famtrackid,':date' => $date.'%'));
336
+                $spotter_array = $Tracker->getDataFromDB($query, array(':ident' => $ident, ':famtrackid' => $famtrackid, ':date' => $date.'%'));
337 337
 
338 338
                 return $spotter_array;
339 339
         }
@@ -346,7 +346,7 @@  discard block
 block discarded – undo
346 346
                 try {
347 347
                         $sth = $this->db->prepare($query);
348 348
                         $sth->execute();
349
-                } catch(PDOException $e) {
349
+                } catch (PDOException $e) {
350 350
                         echo $e->getMessage();
351 351
                         die;
352 352
                 }
@@ -358,24 +358,24 @@  discard block
 block discarded – undo
358 358
         * @return Array the spotter information
359 359
         *
360 360
         */
361
-        public function getMinLiveTrackerData($begindate,$enddate,$filter = array())
361
+        public function getMinLiveTrackerData($begindate, $enddate, $filter = array())
362 362
         {
363 363
                 global $globalDBdriver, $globalLiveInterval;
364 364
                 date_default_timezone_set('UTC');
365 365
 
366 366
                 $filter_query = '';
367 367
                 if (isset($filter['source']) && !empty($filter['source'])) {
368
-                        $filter_query .= " AND format_source IN ('".implode("','",$filter['source'])."') ";
368
+                        $filter_query .= " AND format_source IN ('".implode("','", $filter['source'])."') ";
369 369
                 }
370 370
                 // Use spotter_output also ?
371 371
                 if (isset($filter['airlines']) && !empty($filter['airlines'])) {
372
-                        $filter_query .= " INNER JOIN (SELECT famtrackid FROM tracker_archive_output WHERE tracker_archive_output.airline_icao IN ('".implode("','",$filter['airlines'])."')) so ON so.famtrackid = tracker_archive.famtrackid ";
372
+                        $filter_query .= " INNER JOIN (SELECT famtrackid FROM tracker_archive_output WHERE tracker_archive_output.airline_icao IN ('".implode("','", $filter['airlines'])."')) so ON so.famtrackid = tracker_archive.famtrackid ";
373 373
                 }
374 374
                 if (isset($filter['airlinestype']) && !empty($filter['airlinestype'])) {
375 375
                         $filter_query .= " INNER JOIN (SELECT famtrackid FROM tracker_archive_output WHERE tracker_archive_output.airline_type = '".$filter['airlinestype']."') sa ON sa.famtrackid = tracker_archive.famtrackid ";
376 376
                 }
377 377
                 if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) {
378
-                        $filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')";
378
+                        $filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','", $filter['source_aprs'])."')";
379 379
                 }
380 380
 
381 381
                 //if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
@@ -394,14 +394,14 @@  discard block
 block discarded – undo
394 394
 						GROUP BY l.famtrackid) s on tracker_archive.famtrackid = s.famtrackid 
395 395
 				    AND tracker_archive.date = s.maxdate '.$filter_query.'LEFT JOIN (SELECT aircraft_shadow,icao FROM aircraft) a ON tracker_archive.aircraft_icao = a.icao';
396 396
 */
397
-			$query  = 'SELECT tracker_archive.date,tracker_archive.famtrackid, tracker_archive.ident, tracker_archive.aircraft_icao, tracker_archive.departure_airport_icao as departure_airport, tracker_archive.arrival_airport_icao as arrival_airport, tracker_archive.latitude, tracker_archive.longitude, tracker_archive.altitude, tracker_archive.heading, tracker_archive.ground_speed, tracker_archive.squawk, a.aircraft_shadow,a.engine_type, a.engine_count, a.wake_category 
397
+			$query = 'SELECT tracker_archive.date,tracker_archive.famtrackid, tracker_archive.ident, tracker_archive.aircraft_icao, tracker_archive.departure_airport_icao as departure_airport, tracker_archive.arrival_airport_icao as arrival_airport, tracker_archive.latitude, tracker_archive.longitude, tracker_archive.altitude, tracker_archive.heading, tracker_archive.ground_speed, tracker_archive.squawk, a.aircraft_shadow,a.engine_type, a.engine_count, a.wake_category 
398 398
 				    FROM tracker_archive 
399 399
 				    INNER JOIN (SELECT * FROM aircraft) a on tracker_archive.aircraft_icao = a.icao
400 400
 				    WHERE tracker_archive.date BETWEEN '."'".$begindate."'".' AND '."'".$begindate."'".' 
401 401
                         	    '.$filter_query.' ORDER BY famtrackid';
402 402
                 } else {
403 403
                         //$query  = 'SELECT tracker_archive.ident, tracker_archive.famtrackid, tracker_archive.aircraft_icao, tracker_archive.departure_airport_icao as departure_airport, tracker_archive.arrival_airport_icao as arrival_airport, tracker_archive.latitude, tracker_archive.longitude, tracker_archive.altitude, tracker_archive.heading, tracker_archive.ground_speed, tracker_archive.squawk, a.aircraft_shadow FROM tracker_archive INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_archive l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.famtrackid) s on tracker_archive.famtrackid = s.famtrackid AND tracker_archive.date = s.maxdate '.$filter_query.'INNER JOIN (SELECT * FROM aircraft) a on tracker_archive.aircraft_icao = a.icao';
404
-                        $query  = 'SELECT tracker_archive.date,tracker_archive.famtrackid, tracker_archive.ident, tracker_archive.aircraft_icao, tracker_archive.departure_airport_icao as departure_airport, tracker_archive.arrival_airport_icao as arrival_airport, tracker_archive.latitude, tracker_archive.longitude, tracker_archive.altitude, tracker_archive.heading, tracker_archive.ground_speed, tracker_archive.squawk, a.aircraft_shadow,a.engine_type, a.engine_count, a.wake_category 
404
+                        $query = 'SELECT tracker_archive.date,tracker_archive.famtrackid, tracker_archive.ident, tracker_archive.aircraft_icao, tracker_archive.departure_airport_icao as departure_airport, tracker_archive.arrival_airport_icao as arrival_airport, tracker_archive.latitude, tracker_archive.longitude, tracker_archive.altitude, tracker_archive.heading, tracker_archive.ground_speed, tracker_archive.squawk, a.aircraft_shadow,a.engine_type, a.engine_count, a.wake_category 
405 405
                         	    FROM tracker_archive 
406 406
                         	    INNER JOIN (SELECT * FROM aircraft) a on tracker_archive.aircraft_icao = a.icao
407 407
                         	    WHERE tracker_archive.date >= '."'".$begindate."'".' AND tracker_archive.date <= '."'".$enddate."'".'
@@ -411,7 +411,7 @@  discard block
 block discarded – undo
411 411
                 try {
412 412
                         $sth = $this->db->prepare($query);
413 413
                         $sth->execute();
414
-                } catch(PDOException $e) {
414
+                } catch (PDOException $e) {
415 415
                         echo $e->getMessage();
416 416
                         die;
417 417
                 }
@@ -426,24 +426,24 @@  discard block
 block discarded – undo
426 426
         * @return Array the spotter information
427 427
         *
428 428
         */
429
-        public function getMinLiveTrackerDataPlayback($begindate,$enddate,$filter = array())
429
+        public function getMinLiveTrackerDataPlayback($begindate, $enddate, $filter = array())
430 430
         {
431 431
                 global $globalDBdriver, $globalLiveInterval;
432 432
                 date_default_timezone_set('UTC');
433 433
 
434 434
                 $filter_query = '';
435 435
                 if (isset($filter['source']) && !empty($filter['source'])) {
436
-                        $filter_query .= " AND format_source IN ('".implode("','",$filter['source'])."') ";
436
+                        $filter_query .= " AND format_source IN ('".implode("','", $filter['source'])."') ";
437 437
                 }
438 438
                 // Should use spotter_output also ?
439 439
                 if (isset($filter['airlines']) && !empty($filter['airlines'])) {
440
-                        $filter_query .= " INNER JOIN (SELECT famtrackid FROM tracker_archive_output WHERE tracker_archive_output.airline_icao IN ('".implode("','",$filter['airlines'])."')) so ON so.famtrackid = tracker_archive.famtrackid ";
440
+                        $filter_query .= " INNER JOIN (SELECT famtrackid FROM tracker_archive_output WHERE tracker_archive_output.airline_icao IN ('".implode("','", $filter['airlines'])."')) so ON so.famtrackid = tracker_archive.famtrackid ";
441 441
                 }
442 442
                 if (isset($filter['airlinestype']) && !empty($filter['airlinestype'])) {
443 443
                         $filter_query .= " INNER JOIN (SELECT famtrackid FROM tracker_archive_output WHERE tracker_archive_output.airline_type = '".$filter['airlinestype']."') sa ON sa.famtrackid = tracker_archive.famtrackid ";
444 444
                 }
445 445
                 if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) {
446
-                        $filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')";
446
+                        $filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','", $filter['source_aprs'])."')";
447 447
                 }
448 448
 
449 449
                 //if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
@@ -453,7 +453,7 @@  discard block
 block discarded – undo
453 453
                     		    FROM tracker_archive 
454 454
                     		    INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_archive l WHERE (l.date BETWEEN '."'".$begindate."'".' AND '."'".$enddate."'".') GROUP BY l.famtrackid) s on tracker_archive.famtrackid = s.famtrackid AND tracker_archive.date = s.maxdate '.$filter_query.'LEFT JOIN (SELECT aircraft_shadow,icao FROM aircraft) a ON tracker_archive.aircraft_icao = a.icao';
455 455
 			*/
456
-			$query  = 'SELECT a.aircraft_shadow, tracker_archive_output.ident, tracker_archive_output.famtrackid, tracker_archive_output.aircraft_icao, tracker_archive_output.departure_airport_icao as departure_airport, tracker_archive_output.arrival_airport_icao as arrival_airport, tracker_archive_output.latitude, tracker_archive_output.longitude, tracker_archive_output.altitude, tracker_archive_output.heading, tracker_archive_output.ground_speed, tracker_archive_output.squawk 
456
+			$query = 'SELECT a.aircraft_shadow, tracker_archive_output.ident, tracker_archive_output.famtrackid, tracker_archive_output.aircraft_icao, tracker_archive_output.departure_airport_icao as departure_airport, tracker_archive_output.arrival_airport_icao as arrival_airport, tracker_archive_output.latitude, tracker_archive_output.longitude, tracker_archive_output.altitude, tracker_archive_output.heading, tracker_archive_output.ground_speed, tracker_archive_output.squawk 
457 457
 				    FROM tracker_archive_output 
458 458
 				    LEFT JOIN (SELECT aircraft_shadow,icao FROM aircraft) a ON tracker_archive_output.aircraft_icao = a.icao 
459 459
 				    WHERE (tracker_archive_output.date BETWEEN '."'".$begindate."'".' AND '."'".$enddate."'".') 
@@ -468,7 +468,7 @@  discard block
 block discarded – undo
468 468
                         	    WHERE tracker_archive_output.date >= '."'".$begindate."'".' AND tracker_archive_output.date <= '."'".$enddate."'".'
469 469
                         	    '.$filter_query.' GROUP BY tracker_archive_output.famtrackid, tracker_archive_output.ident, tracker_archive_output.aircraft_icao, tracker_archive_output.departure_airport_icao, tracker_archive_output.arrival_airport_icao, tracker_archive_output.latitude, tracker_archive_output.longitude, tracker_archive_output.altitude, tracker_archive_output.heading, tracker_archive_output.ground_speed, tracker_archive_output.squawk, a.aircraft_shadow';
470 470
                         */
471
-                        $query  = 'SELECT DISTINCT tracker_archive_output.famtrackid, tracker_archive_output.ident, tracker_archive_output.aircraft_icao, tracker_archive_output.departure_airport_icao as departure_airport, tracker_archive_output.arrival_airport_icao as arrival_airport, tracker_archive_output.latitude, tracker_archive_output.longitude, tracker_archive_output.altitude, tracker_archive_output.heading, tracker_archive_output.ground_speed, tracker_archive_output.squawk, a.aircraft_shadow
471
+                        $query = 'SELECT DISTINCT tracker_archive_output.famtrackid, tracker_archive_output.ident, tracker_archive_output.aircraft_icao, tracker_archive_output.departure_airport_icao as departure_airport, tracker_archive_output.arrival_airport_icao as arrival_airport, tracker_archive_output.latitude, tracker_archive_output.longitude, tracker_archive_output.altitude, tracker_archive_output.heading, tracker_archive_output.ground_speed, tracker_archive_output.squawk, a.aircraft_shadow
472 472
                         	    FROM tracker_archive_output 
473 473
                         	    INNER JOIN (SELECT * FROM aircraft) a on tracker_archive_output.aircraft_icao = a.icao
474 474
                         	    WHERE tracker_archive_output.date >= '."'".$begindate."'".' AND tracker_archive_output.date <= '."'".$enddate."'".'
@@ -480,7 +480,7 @@  discard block
 block discarded – undo
480 480
                 try {
481 481
                         $sth = $this->db->prepare($query);
482 482
                         $sth->execute();
483
-                } catch(PDOException $e) {
483
+                } catch (PDOException $e) {
484 484
                         echo $e->getMessage();
485 485
                         die;
486 486
                 }
@@ -495,23 +495,23 @@  discard block
 block discarded – undo
495 495
         * @return Array the spotter information
496 496
         *
497 497
         */
498
-        public function getLiveTrackerCount($begindate,$enddate,$filter = array())
498
+        public function getLiveTrackerCount($begindate, $enddate, $filter = array())
499 499
         {
500 500
                 global $globalDBdriver, $globalLiveInterval;
501 501
                 date_default_timezone_set('UTC');
502 502
 
503 503
                 $filter_query = '';
504 504
                 if (isset($filter['source']) && !empty($filter['source'])) {
505
-                        $filter_query .= " AND format_source IN ('".implode("','",$filter['source'])."') ";
505
+                        $filter_query .= " AND format_source IN ('".implode("','", $filter['source'])."') ";
506 506
                 }
507 507
                 if (isset($filter['airlines']) && !empty($filter['airlines'])) {
508
-                        $filter_query .= " INNER JOIN (SELECT famtrackid FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','",$filter['airlines'])."')) so ON so.famtrackid = tracker_archive.famtrackid ";
508
+                        $filter_query .= " INNER JOIN (SELECT famtrackid FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','", $filter['airlines'])."')) so ON so.famtrackid = tracker_archive.famtrackid ";
509 509
                 }
510 510
                 if (isset($filter['airlinestype']) && !empty($filter['airlinestype'])) {
511 511
                         $filter_query .= " INNER JOIN (SELECT famtrackid FROM spotter_output WHERE spotter_output.airline_type = '".$filter['airlinestype']."') sa ON sa.famtrackid = tracker_archive.famtrackid ";
512 512
                 }
513 513
                 if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) {
514
-                        $filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')";
514
+                        $filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','", $filter['source_aprs'])."')";
515 515
                 }
516 516
 
517 517
                 //if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
@@ -526,7 +526,7 @@  discard block
 block discarded – undo
526 526
                 try {
527 527
                         $sth = $this->db->prepare($query);
528 528
                         $sth->execute();
529
-                } catch(PDOException $e) {
529
+                } catch (PDOException $e) {
530 530
                         echo $e->getMessage();
531 531
                         die;
532 532
                 }
@@ -546,7 +546,7 @@  discard block
 block discarded – undo
546 546
     * @return Array the spotter information
547 547
     *
548 548
     */
549
-    public function searchTrackerData($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())
549
+    public function searchTrackerData($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())
550 550
     {
551 551
 	global $globalTimezone, $globalDBdriver;
552 552
 	require_once(dirname(__FILE__).'/class.Translation.php');
@@ -568,7 +568,7 @@  discard block
 block discarded – undo
568 568
 	        
569 569
 		$q_array = explode(" ", $q);
570 570
 		
571
-		foreach ($q_array as $q_item){
571
+		foreach ($q_array as $q_item) {
572 572
 		    $additional_query .= " AND (";
573 573
 		    $additional_query .= "(tracker_archive_output.spotter_id like '%".$q_item."%') OR ";
574 574
 		    $additional_query .= "(tracker_archive_output.aircraft_icao like '%".$q_item."%') OR ";
@@ -600,7 +600,7 @@  discard block
 block discarded – undo
600 600
 	
601 601
 	if ($registration != "")
602 602
 	{
603
-	    $registration = filter_var($registration,FILTER_SANITIZE_STRING);
603
+	    $registration = filter_var($registration, FILTER_SANITIZE_STRING);
604 604
 	    if (!is_string($registration))
605 605
 	    {
606 606
 		return false;
@@ -611,7 +611,7 @@  discard block
 block discarded – undo
611 611
 	
612 612
 	if ($aircraft_icao != "")
613 613
 	{
614
-	    $aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
614
+	    $aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
615 615
 	    if (!is_string($aircraft_icao))
616 616
 	    {
617 617
 		return false;
@@ -622,7 +622,7 @@  discard block
 block discarded – undo
622 622
 	
623 623
 	if ($aircraft_manufacturer != "")
624 624
 	{
625
-	    $aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
625
+	    $aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING);
626 626
 	    if (!is_string($aircraft_manufacturer))
627 627
 	    {
628 628
 		return false;
@@ -643,7 +643,7 @@  discard block
 block discarded – undo
643 643
 	
644 644
 	if ($airline_icao != "")
645 645
 	{
646
-	    $airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
646
+	    $airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING);
647 647
 	    if (!is_string($airline_icao))
648 648
 	    {
649 649
 		return false;
@@ -654,7 +654,7 @@  discard block
 block discarded – undo
654 654
 	
655 655
 	if ($airline_country != "")
656 656
 	{
657
-	    $airline_country = filter_var($airline_country,FILTER_SANITIZE_STRING);
657
+	    $airline_country = filter_var($airline_country, FILTER_SANITIZE_STRING);
658 658
 	    if (!is_string($airline_country))
659 659
 	    {
660 660
 		return false;
@@ -665,7 +665,7 @@  discard block
 block discarded – undo
665 665
 	
666 666
 	if ($airline_type != "")
667 667
 	{
668
-	    $airline_type = filter_var($airline_type,FILTER_SANITIZE_STRING);
668
+	    $airline_type = filter_var($airline_type, FILTER_SANITIZE_STRING);
669 669
 	    if (!is_string($airline_type))
670 670
 	    {
671 671
 		return false;
@@ -687,7 +687,7 @@  discard block
 block discarded – undo
687 687
 	
688 688
 	if ($airport != "")
689 689
 	{
690
-	    $airport = filter_var($airport,FILTER_SANITIZE_STRING);
690
+	    $airport = filter_var($airport, FILTER_SANITIZE_STRING);
691 691
 	    if (!is_string($airport))
692 692
 	    {
693 693
 		return false;
@@ -698,7 +698,7 @@  discard block
 block discarded – undo
698 698
 	
699 699
 	if ($airport_country != "")
700 700
 	{
701
-	    $airport_country = filter_var($airport_country,FILTER_SANITIZE_STRING);
701
+	    $airport_country = filter_var($airport_country, FILTER_SANITIZE_STRING);
702 702
 	    if (!is_string($airport_country))
703 703
 	    {
704 704
 		return false;
@@ -709,7 +709,7 @@  discard block
 block discarded – undo
709 709
     
710 710
 	if ($callsign != "")
711 711
 	{
712
-	    $callsign = filter_var($callsign,FILTER_SANITIZE_STRING);
712
+	    $callsign = filter_var($callsign, FILTER_SANITIZE_STRING);
713 713
 	    if (!is_string($callsign))
714 714
 	    {
715 715
 		return false;
@@ -717,7 +717,7 @@  discard block
 block discarded – undo
717 717
 		$translate = $Translation->ident2icao($callsign);
718 718
 		if ($translate != $callsign) {
719 719
 			$additional_query .= " AND (tracker_archive_output.ident = :callsign OR tracker_archive_output.ident = :translate)";
720
-			$query_values = array_merge($query_values,array(':callsign' => $callsign,':translate' => $translate));
720
+			$query_values = array_merge($query_values, array(':callsign' => $callsign, ':translate' => $translate));
721 721
 		} else {
722 722
 			$additional_query .= " AND (tracker_archive_output.ident = '".$callsign."')";
723 723
 		}
@@ -726,7 +726,7 @@  discard block
 block discarded – undo
726 726
 
727 727
 	if ($owner != "")
728 728
 	{
729
-	    $owner = filter_var($owner,FILTER_SANITIZE_STRING);
729
+	    $owner = filter_var($owner, FILTER_SANITIZE_STRING);
730 730
 	    if (!is_string($owner))
731 731
 	    {
732 732
 		return false;
@@ -737,7 +737,7 @@  discard block
 block discarded – undo
737 737
 
738 738
 	if ($pilot_name != "")
739 739
 	{
740
-	    $pilot_name = filter_var($pilot_name,FILTER_SANITIZE_STRING);
740
+	    $pilot_name = filter_var($pilot_name, FILTER_SANITIZE_STRING);
741 741
 	    if (!is_string($pilot_name))
742 742
 	    {
743 743
 		return false;
@@ -748,7 +748,7 @@  discard block
 block discarded – undo
748 748
 	
749 749
 	if ($pilot_id != "")
750 750
 	{
751
-	    $pilot_id = filter_var($pilot_id,FILTER_SANITIZE_NUMBER_INT);
751
+	    $pilot_id = filter_var($pilot_id, FILTER_SANITIZE_NUMBER_INT);
752 752
 	    if (!is_string($pilot_id))
753 753
 	    {
754 754
 		return false;
@@ -759,7 +759,7 @@  discard block
 block discarded – undo
759 759
 	
760 760
 	if ($departure_airport_route != "")
761 761
 	{
762
-	    $departure_airport_route = filter_var($departure_airport_route,FILTER_SANITIZE_STRING);
762
+	    $departure_airport_route = filter_var($departure_airport_route, FILTER_SANITIZE_STRING);
763 763
 	    if (!is_string($departure_airport_route))
764 764
 	    {
765 765
 		return false;
@@ -770,7 +770,7 @@  discard block
 block discarded – undo
770 770
 	
771 771
 	if ($arrival_airport_route != "")
772 772
 	{
773
-	    $arrival_airport_route = filter_var($arrival_airport_route,FILTER_SANITIZE_STRING);
773
+	    $arrival_airport_route = filter_var($arrival_airport_route, FILTER_SANITIZE_STRING);
774 774
 	    if (!is_string($arrival_airport_route))
775 775
 	    {
776 776
 		return false;
@@ -783,8 +783,8 @@  discard block
 block discarded – undo
783 783
 	{
784 784
 	    $altitude_array = explode(",", $altitude);
785 785
 	    
786
-	    $altitude_array[0] = filter_var($altitude_array[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
787
-	    $altitude_array[1] = filter_var($altitude_array[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
786
+	    $altitude_array[0] = filter_var($altitude_array[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
787
+	    $altitude_array[1] = filter_var($altitude_array[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
788 788
 	    
789 789
 
790 790
 	    if ($altitude_array[1] != "")
@@ -802,8 +802,8 @@  discard block
 block discarded – undo
802 802
 	{
803 803
 	    $date_array = explode(",", $date_posted);
804 804
 	    
805
-	    $date_array[0] = filter_var($date_array[0],FILTER_SANITIZE_STRING);
806
-	    $date_array[1] = filter_var($date_array[1],FILTER_SANITIZE_STRING);
805
+	    $date_array[0] = filter_var($date_array[0], FILTER_SANITIZE_STRING);
806
+	    $date_array[1] = filter_var($date_array[1], FILTER_SANITIZE_STRING);
807 807
 	    
808 808
 	    if ($globalTimezone != '') {
809 809
 		date_default_timezone_set($globalTimezone);
@@ -835,8 +835,8 @@  discard block
 block discarded – undo
835 835
 	{
836 836
 	    $limit_array = explode(",", $limit);
837 837
 	    
838
-	    $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
839
-	    $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
838
+	    $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
839
+	    $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
840 840
 	    
841 841
 	    if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
842 842
 	    {
@@ -847,8 +847,8 @@  discard block
 block discarded – undo
847 847
 	
848 848
 
849 849
 	if ($origLat != "" && $origLon != "" && $dist != "") {
850
-		$dist = number_format($dist*0.621371,2,'.','');
851
-		$query="SELECT tracker_archive_output.*, 3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - ABS(CAST(tracker_archive.latitude as double precision)))*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(ABS(CAST(tracker_archive.latitude as double precision))*pi()/180)*POWER(SIN(($origLon-CAST(tracker_archive.longitude as double precision))*pi()/180/2),2))) as distance 
850
+		$dist = number_format($dist*0.621371, 2, '.', '');
851
+		$query = "SELECT tracker_archive_output.*, 3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - ABS(CAST(tracker_archive.latitude as double precision)))*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(ABS(CAST(tracker_archive.latitude as double precision))*pi()/180)*POWER(SIN(($origLon-CAST(tracker_archive.longitude as double precision))*pi()/180/2),2))) as distance 
852 852
                           FROM tracker_archive_output, tracker_archive WHERE spotter_output_archive.famtrackid = tracker_archive.famtrackid AND spotter_output.ident <> '' ".$additional_query."AND CAST(tracker_archive.longitude as double precision) between ($origLon-$dist/ABS(cos(radians($origLat))*69)) and ($origLon+$dist/ABS(cos(radians($origLat))*69)) and CAST(tracker_archive.latitude as double precision) between ($origLat-($dist/69)) and ($origLat+($dist/69)) 
853 853
                           AND (3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - ABS(CAST(tracker_archive.latitude as double precision)))*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(ABS(CAST(tracker_archive.latitude as double precision))*pi()/180)*POWER(SIN(($origLon-CAST(tracker_archive.longitude as double precision))*pi()/180/2),2)))) < $dist".$filter_query." ORDER BY distance";
854 854
 	} else {
@@ -865,12 +865,12 @@  discard block
 block discarded – undo
865 865
 			$additional_query .= " AND (tracker_archive_output.waypoints <> '')";
866 866
 		}
867 867
 
868
-		$query  = "SELECT tracker_archive_output.* FROM tracker_archive_output 
868
+		$query = "SELECT tracker_archive_output.* FROM tracker_archive_output 
869 869
 		    WHERE tracker_archive_output.ident <> '' 
870 870
 		    ".$additional_query."
871 871
 		    ".$filter_query.$orderby_query;
872 872
 	}
873
-	$spotter_array = $Tracker->getDataFromDB($query, $query_values,$limit_query);
873
+	$spotter_array = $Tracker->getDataFromDB($query, $query_values, $limit_query);
874 874
 
875 875
 	return $spotter_array;
876 876
     }
@@ -887,7 +887,7 @@  discard block
 block discarded – undo
887 887
                 try {
888 888
                         $sth = $this->db->prepare($query);
889 889
                         $sth->execute();
890
-                } catch(PDOException $e) {
890
+                } catch (PDOException $e) {
891 891
                         return "error";
892 892
                 }
893 893
 	}
@@ -924,8 +924,8 @@  discard block
 block discarded – undo
924 924
 	{
925 925
 	    $limit_array = explode(",", $limit);
926 926
 	    
927
-	    $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
928
-	    $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
927
+	    $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
928
+	    $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
929 929
 	    
930 930
 	    if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
931 931
 	    {
@@ -966,7 +966,7 @@  discard block
 block discarded – undo
966 966
 	$query_values = array();
967 967
 	$limit_query = '';
968 968
 	$additional_query = '';
969
-	$filter_query = $this->getFilter($filter,true,true);
969
+	$filter_query = $this->getFilter($filter, true, true);
970 970
 	
971 971
 	if ($owner != "")
972 972
 	{
@@ -983,8 +983,8 @@  discard block
 block discarded – undo
983 983
 	{
984 984
 	    $limit_array = explode(",", $limit);
985 985
 	    
986
-	    $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
987
-	    $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
986
+	    $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
987
+	    $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
988 988
 	    
989 989
 	    if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
990 990
 	    {
@@ -1024,7 +1024,7 @@  discard block
 block discarded – undo
1024 1024
 	$query_values = array();
1025 1025
 	$limit_query = '';
1026 1026
 	$additional_query = '';
1027
-	$filter_query = $this->getFilter($filter,true,true);
1027
+	$filter_query = $this->getFilter($filter, true, true);
1028 1028
 	
1029 1029
 	if ($pilot != "")
1030 1030
 	{
@@ -1036,8 +1036,8 @@  discard block
 block discarded – undo
1036 1036
 	{
1037 1037
 	    $limit_array = explode(",", $limit);
1038 1038
 	    
1039
-	    $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1040
-	    $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1039
+	    $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1040
+	    $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1041 1041
 	    
1042 1042
 	    if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1043 1043
 	    {
@@ -1067,7 +1067,7 @@  discard block
 block discarded – undo
1067 1067
     * @return Array the airline country list
1068 1068
     *
1069 1069
     */
1070
-    public function countAllFlightOverCountries($limit = true,$olderthanmonths = 0,$sincedate = '')
1070
+    public function countAllFlightOverCountries($limit = true, $olderthanmonths = 0, $sincedate = '')
1071 1071
     {
1072 1072
 	global $globalDBdriver;
1073 1073
 	/*
@@ -1096,7 +1096,7 @@  discard block
 block discarded – undo
1096 1096
 	$flight_array = array();
1097 1097
 	$temp_array = array();
1098 1098
         
1099
-	while($row = $sth->fetch(PDO::FETCH_ASSOC))
1099
+	while ($row = $sth->fetch(PDO::FETCH_ASSOC))
1100 1100
 	{
1101 1101
 	    $temp_array['flight_count'] = $row['nb'];
1102 1102
 	    $temp_array['flight_country'] = $row['name'];
@@ -1113,7 +1113,7 @@  discard block
 block discarded – undo
1113 1113
     * @return Array the airline country list
1114 1114
     *
1115 1115
     */
1116
-    public function countAllFlightOverCountriesByAirlines($limit = true,$olderthanmonths = 0,$sincedate = '')
1116
+    public function countAllFlightOverCountriesByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '')
1117 1117
     {
1118 1118
 	global $globalDBdriver;
1119 1119
 	/*
@@ -1142,7 +1142,7 @@  discard block
 block discarded – undo
1142 1142
 	$flight_array = array();
1143 1143
 	$temp_array = array();
1144 1144
         
1145
-	while($row = $sth->fetch(PDO::FETCH_ASSOC))
1145
+	while ($row = $sth->fetch(PDO::FETCH_ASSOC))
1146 1146
 	{
1147 1147
 	    $temp_array['airline_icao'] = $row['airline_icao'];
1148 1148
 	    $temp_array['flight_count'] = $row['nb'];
@@ -1160,14 +1160,14 @@  discard block
 block discarded – undo
1160 1160
     * @return Array the spotter information
1161 1161
     *
1162 1162
     */
1163
-    public function getDateArchiveTrackerDataById($id,$date)
1163
+    public function getDateArchiveTrackerDataById($id, $date)
1164 1164
     {
1165 1165
 	$Tracker = new Tracker($this->db);
1166 1166
 	date_default_timezone_set('UTC');
1167 1167
 	$id = filter_var($id, FILTER_SANITIZE_STRING);
1168
-	$query  = 'SELECT tracker_archive.* FROM tracker_archive INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_archive l WHERE l.famtrackid = :id AND l.date <= :date GROUP BY l.famtrackid) s on tracker_archive.famtrackid = s.famtrackid AND tracker_archive.date = s.maxdate ORDER BY tracker_archive.date DESC';
1169
-	$date = date('c',$date);
1170
-	$spotter_array = $Tracker->getDataFromDB($query,array(':id' => $id,':date' => $date));
1168
+	$query = 'SELECT tracker_archive.* FROM tracker_archive INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_archive l WHERE l.famtrackid = :id AND l.date <= :date GROUP BY l.famtrackid) s on tracker_archive.famtrackid = s.famtrackid AND tracker_archive.date = s.maxdate ORDER BY tracker_archive.date DESC';
1169
+	$date = date('c', $date);
1170
+	$spotter_array = $Tracker->getDataFromDB($query, array(':id' => $id, ':date' => $date));
1171 1171
 	return $spotter_array;
1172 1172
     }
1173 1173
 
@@ -1177,14 +1177,14 @@  discard block
 block discarded – undo
1177 1177
     * @return Array the spotter information
1178 1178
     *
1179 1179
     */
1180
-    public function getDateArchiveTrackerDataByIdent($ident,$date)
1180
+    public function getDateArchiveTrackerDataByIdent($ident, $date)
1181 1181
     {
1182 1182
 	$Tracker = new Tracker($this->db);
1183 1183
 	date_default_timezone_set('UTC');
1184 1184
 	$ident = filter_var($ident, FILTER_SANITIZE_STRING);
1185
-	$query  = 'SELECT tracker_archive.* FROM tracker_archive INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_archive l WHERE l.ident = :ident AND l.date <= :date GROUP BY l.famtrackid) s on tracker_archive.famtrackid = s.famtrackid AND tracker_archive.date = s.maxdate ORDER BY tracker_archive.date DESC';
1186
-	$date = date('c',$date);
1187
-	$spotter_array = $Tracker->getDataFromDB($query,array(':ident' => $ident,':date' => $date));
1185
+	$query = 'SELECT tracker_archive.* FROM tracker_archive INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_archive l WHERE l.ident = :ident AND l.date <= :date GROUP BY l.famtrackid) s on tracker_archive.famtrackid = s.famtrackid AND tracker_archive.date = s.maxdate ORDER BY tracker_archive.date DESC';
1186
+	$date = date('c', $date);
1187
+	$spotter_array = $Tracker->getDataFromDB($query, array(':ident' => $ident, ':date' => $date));
1188 1188
 	return $spotter_array;
1189 1189
     }
1190 1190
 
@@ -1194,7 +1194,7 @@  discard block
 block discarded – undo
1194 1194
     * @return Array the spotter information
1195 1195
     *
1196 1196
     */
1197
-    public function getTrackerDataByAirport($airport = '', $limit = '', $sort = '',$filters = array())
1197
+    public function getTrackerDataByAirport($airport = '', $limit = '', $sort = '', $filters = array())
1198 1198
     {
1199 1199
 	global $global_query;
1200 1200
 	$Tracker = new Tracker();
@@ -1202,7 +1202,7 @@  discard block
 block discarded – undo
1202 1202
 	$query_values = array();
1203 1203
 	$limit_query = '';
1204 1204
 	$additional_query = '';
1205
-	$filter_query = $this->getFilter($filters,true,true);
1205
+	$filter_query = $this->getFilter($filters, true, true);
1206 1206
 	
1207 1207
 	if ($airport != "")
1208 1208
 	{
@@ -1219,8 +1219,8 @@  discard block
 block discarded – undo
1219 1219
 	{
1220 1220
 	    $limit_array = explode(",", $limit);
1221 1221
 	    
1222
-	    $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1223
-	    $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1222
+	    $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1223
+	    $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1224 1224
 	    
1225 1225
 	    if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1226 1226
 	    {
Please login to merge, or discard this patch.
Braces   +26 added lines, -9 removed lines patch added patch discarded remove patch
@@ -26,7 +26,9 @@  discard block
 block discarded – undo
26 26
 		if (isset($filter[0]['source'])) {
27 27
 			$filters = array_merge($filters,$filter);
28 28
 		}
29
-		if (is_array($globalFilter)) $filter = array_merge($filter,$globalFilter);
29
+		if (is_array($globalFilter)) {
30
+			$filter = array_merge($filter,$globalFilter);
31
+		}
30 32
 		$filter_query_join = '';
31 33
 		$filter_query_where = '';
32 34
 		foreach($filters as $flt) {
@@ -72,8 +74,11 @@  discard block
 block discarded – undo
72 74
 		if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) {
73 75
 			$filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')";
74 76
 		}
75
-		if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE';
76
-		elseif ($filter_query_where != '' && $and) $filter_query_where .= ' AND';
77
+		if ($filter_query_where == '' && $where) {
78
+			$filter_query_where = ' WHERE';
79
+		} elseif ($filter_query_where != '' && $and) {
80
+			$filter_query_where .= ' AND';
81
+		}
77 82
 		if ($filter_query_where != '') {
78 83
 			$filter_query_where = preg_replace('/^ AND/',' WHERE',$filter_query_where);
79 84
 		}
@@ -591,7 +596,9 @@  discard block
 block discarded – undo
591 596
 		    $additional_query .= "(tracker_archive_output.pilot_name like '%".$q_item."%') OR ";
592 597
 		    $additional_query .= "(tracker_archive_output.ident like '%".$q_item."%') OR ";
593 598
 		    $translate = $Translation->ident2icao($q_item);
594
-		    if ($translate != $q_item) $additional_query .= "(tracker_archive_output.ident like '%".$translate."%') OR ";
599
+		    if ($translate != $q_item) {
600
+		    	$additional_query .= "(tracker_archive_output.ident like '%".$translate."%') OR ";
601
+		    }
595 602
 		    $additional_query .= "(tracker_archive_output.highlight like '%".$q_item."%')";
596 603
 		    $additional_query .= ")";
597 604
 		}
@@ -809,7 +816,9 @@  discard block
 block discarded – undo
809 816
 		date_default_timezone_set($globalTimezone);
810 817
 		$datetime = new DateTime();
811 818
 		$offset = $datetime->format('P');
812
-	    } else $offset = '+00:00';
819
+	    } else {
820
+	    	$offset = '+00:00';
821
+	    }
813 822
 
814 823
 
815 824
 	    if ($date_array[1] != "")
@@ -1085,9 +1094,13 @@  discard block
 block discarded – undo
1085 1094
 				$query .= "AND date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
1086 1095
 			}
1087 1096
 		}
1088
-                if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
1097
+                if ($sincedate != '') {
1098
+                	$query .= "AND date > '".$sincedate."' ";
1099
+                }
1089 1100
 	$query .= "GROUP BY c.name, c.iso3, c.iso2 ORDER BY nb DESC";
1090
-	if ($limit) $query .= " LIMIT 0,10";
1101
+	if ($limit) {
1102
+		$query .= " LIMIT 0,10";
1103
+	}
1091 1104
       
1092 1105
 	
1093 1106
 	$sth = $this->db->prepare($query);
@@ -1131,9 +1144,13 @@  discard block
 block discarded – undo
1131 1144
 				$query .= "AND s.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
1132 1145
 			}
1133 1146
 		}
1134
-                if ($sincedate != '') $query .= "AND s.date > '".$sincedate."' ";
1147
+                if ($sincedate != '') {
1148
+                	$query .= "AND s.date > '".$sincedate."' ";
1149
+                }
1135 1150
 	$query .= "GROUP BY o.airline_icao,c.name, c.iso3, c.iso2 ORDER BY nb DESC";
1136
-	if ($limit) $query .= " LIMIT 0,10";
1151
+	if ($limit) {
1152
+		$query .= " LIMIT 0,10";
1153
+	}
1137 1154
       
1138 1155
 	
1139 1156
 	$sth = $this->db->prepare($query);
Please login to merge, or discard this patch.
table-output.php 2 patches
Spacing   +47 added lines, -47 removed lines patch added patch discarded remove patch
@@ -4,8 +4,8 @@  discard block
 block discarded – undo
4 4
 
5 5
 require_once(dirname(__FILE__).'/require/class.Common.php');
6 6
 $Common = new Common();
7
-$showRouteStop = $Common->multiKeyExists($spotter_array,'route_stop');
8
-$showDuration = $Common->multiKeyExists($spotter_array,'duration');
7
+$showRouteStop = $Common->multiKeyExists($spotter_array, 'route_stop');
8
+$showDuration = $Common->multiKeyExists($spotter_array, 'duration');
9 9
 
10 10
 if (!isset($type)) $type = 'aircraft';
11 11
 
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
 	}
102 102
 	print '<th class="more"></th>';
103 103
 	print '</thead>';
104
-} else if (strtolower($current_page) == "upcoming"){
104
+} else if (strtolower($current_page) == "upcoming") {
105 105
 	print '<thead>';
106 106
 	if ($_GET['sort'] == "airline_name_asc")
107 107
 	{
@@ -151,7 +151,7 @@  discard block
 block discarded – undo
151 151
 	}
152 152
 	*/
153 153
 	print '</thead>';
154
-} else if (strtolower($current_page) == "acars-latest" || strtolower($current_page) == "acars-archive"){
154
+} else if (strtolower($current_page) == "acars-latest" || strtolower($current_page) == "acars-archive") {
155 155
 	print '<thead>';
156 156
 	print '<th class="aircraft_thumbnail"></th>';
157 157
 	print '<th class="logo">'._("Airline").'</th>';
@@ -188,7 +188,7 @@  discard block
 block discarded – undo
188 188
 	print '</thead>';
189 189
 } else {
190 190
 
191
-	if ($hide_th_links === true){
191
+	if ($hide_th_links === true) {
192 192
 		print '<thead>';
193 193
 		print '<th class="aircraft_thumbnail"></th>';
194 194
 		if ($type == 'aircraft') {
@@ -435,7 +435,7 @@  discard block
 block discarded – undo
435 435
 }
436 436
 
437 437
 print '<tbody>'."\n";
438
-foreach($spotter_array as $spotter_item)
438
+foreach ($spotter_array as $spotter_item)
439 439
 {
440 440
 	if (isset($globalTimezone))
441 441
 	{
@@ -470,13 +470,13 @@  discard block
 block discarded – undo
470 470
 						$image_src = 'https://www.planespotters.net/Aviation_Photos/photo.show?id='.$planespotter_id;
471 471
 					}
472 472
 					if (isset($spotter_item['airline_name'])) {
473
-						print '<a href="'.$image_src.'"><img src="'.preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']).'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['registration'].' - '.$spotter_item['airline_name'].'" alt="'.$spotter_item['registration'].' - '.$spotter_item['airline_name'].'" data-content="'._("Registration:").' '.$spotter_item['registration'].'<br />'._("Airline:").' '.$spotter_item['airline_name'].'" data-html="true" width="100px" /></a>'."\n".'<div class="thumbnail-copyright">&copy; '.$spotter_item['image_copyright'].'</div>';
473
+						print '<a href="'.$image_src.'"><img src="'.preg_replace("/^http:/i", "https:", $spotter_item['image_thumbnail']).'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['registration'].' - '.$spotter_item['airline_name'].'" alt="'.$spotter_item['registration'].' - '.$spotter_item['airline_name'].'" data-content="'._("Registration:").' '.$spotter_item['registration'].'<br />'._("Airline:").' '.$spotter_item['airline_name'].'" data-html="true" width="100px" /></a>'."\n".'<div class="thumbnail-copyright">&copy; '.$spotter_item['image_copyright'].'</div>';
474 474
 					} else {
475
-						print '<a href="'.$image_src.'"><img src="'.preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']).'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['registration'].' - '._("Not available").'" alt="'.$spotter_item['registration'].' - '._("Not available").'" data-content="'._("Registration:").' '.$spotter_item['registration'].'<br />'._("Airline:").' '._("Not available").'" data-html="true" width="100px" /></a>'."\n".'<div class="thumbnail-copyright">&copy; '.$spotter_item['image_copyright'].'</div>';
475
+						print '<a href="'.$image_src.'"><img src="'.preg_replace("/^http:/i", "https:", $spotter_item['image_thumbnail']).'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['registration'].' - '._("Not available").'" alt="'.$spotter_item['registration'].' - '._("Not available").'" data-content="'._("Registration:").' '.$spotter_item['registration'].'<br />'._("Airline:").' '._("Not available").'" data-html="true" width="100px" /></a>'."\n".'<div class="thumbnail-copyright">&copy; '.$spotter_item['image_copyright'].'</div>';
476 476
 					}
477 477
 				} else {
478 478
 					if ($spotter_item['image_source'] == 'wikimedia' || $spotter_item['image_source'] == 'devianart' || $spotter_item['image_source'] == 'flickr') {
479
-						$image_thumbnail = preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']);
479
+						$image_thumbnail = preg_replace("/^http:/i", "https:", $spotter_item['image_thumbnail']);
480 480
 					} else 	$image_thumbnail = $spotter_item['image_thumbnail'];
481 481
 					if (isset($spotter_item['airline_name'])) {
482 482
 						print '<img src="'.$image_thumbnail.'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['registration'].' - '.$spotter_item['airline_name'].'" alt="'.$spotter_item['registration'].' - '.$spotter_item['airline_name'].'" data-content="'._("Registration:").' '.$spotter_item['registration'].'<br />'._("Airline:").' '.$spotter_item['airline_name'].'" data-html="true" width="100px" />'."\n".'<div class="thumbnail-copyright">&copy; '.$spotter_item['image_copyright'].'</div>';
@@ -495,7 +495,7 @@  discard block
 block discarded – undo
495 495
 			{
496 496
 				print '<td class="aircraft_thumbnail">'."\n";
497 497
 				if ($spotter_item['image_source'] == 'wikimedia' || $spotter_item['image_source'] == 'devianart' || $spotter_item['image_source'] == 'flickr') {
498
-					$image_thumbnail = preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']);
498
+					$image_thumbnail = preg_replace("/^http:/i", "https:", $spotter_item['image_thumbnail']);
499 499
 				} else 	$image_thumbnail = $spotter_item['image_thumbnail'];
500 500
 				if (isset($spotter_item['airline_name'])) {
501 501
 					print '<img src="'.$image_thumbnail.'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['mmsi'].'" alt="'.$spotter_item['mmsi'].'" data-content="'._("MMSI:").' '.$spotter_item['mmsi'].'" data-html="true" width="100px" />'."\n".'<div class="thumbnail-copyright">&copy; '.$spotter_item['image_copyright'].'</div>';
@@ -513,7 +513,7 @@  discard block
 block discarded – undo
513 513
 			{
514 514
 				print '<td class="aircraft_thumbnail">'."\n";
515 515
 				if ($spotter_item['image_source'] == 'wikimedia' || $spotter_item['image_source'] == 'devianart' || $spotter_item['image_source'] == 'flickr') {
516
-					$image_thumbnail = preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']);
516
+					$image_thumbnail = preg_replace("/^http:/i", "https:", $spotter_item['image_thumbnail']);
517 517
 				} else 	$image_thumbnail = $spotter_item['image_thumbnail'];
518 518
 				print '<img src="'.$image_thumbnail.'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['ident'].'" alt="'.$spotter_item['type'].'" data-content="'._("Type:").' '.$spotter_item['type'].'" data-html="true" width="100px" />'."\n".'<div class="thumbnail-copyright">&copy; '.$spotter_item['image_copyright'].'</div>';
519 519
 				print '</td>'."\n";
@@ -555,7 +555,7 @@  discard block
 block discarded – undo
555 555
 				print '</td>'."\n";
556 556
 			}
557 557
 		}
558
-	} elseif(strtolower($current_page) != "currently" && strtolower($current_page) != "upcoming" && strtolower($current_page) != "acars-latest" && strtolower($current_page) != "acars-archive" && strtolower($current_page) != "accident-latest" && strtolower($current_page) != "incident-latest" && strtolower($current_page) != "accident-detailed" && strtolower($current_page) != "incident-detailed"){
558
+	} elseif (strtolower($current_page) != "currently" && strtolower($current_page) != "upcoming" && strtolower($current_page) != "acars-latest" && strtolower($current_page) != "acars-archive" && strtolower($current_page) != "accident-latest" && strtolower($current_page) != "incident-latest" && strtolower($current_page) != "accident-detailed" && strtolower($current_page) != "incident-detailed") {
559 559
 		if ($type == 'aircraft') {
560 560
 			if (!isset($spotter_item['squawk']) || $spotter_item['squawk'] == 0) {
561 561
 			    $spotter_item['squawk'] = '-';
@@ -572,17 +572,17 @@  discard block
 block discarded – undo
572 572
 						$image_src = 'https://www.planespotters.net/Aviation_Photos/photo.show?id='.$planespotter_id;
573 573
 					}
574 574
 					if (!isset($spotter_item['airline_name']) && isset($spotter_item['aircraft_name'])) {
575
-						print '<a href="'.$image_src.'"><img src="'.preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']).'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '._("Not available").'" alt="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '._("Not available").'" data-content="'._("Registration:").' '.$spotter_item['registration'].'<br />'._("Aircraft:").' '.$spotter_item['aircraft_name'].' ('.$spotter_item['aircraft_type'].')<br />'._("Airline:").' '._("Not available").'<br />'._("Squawk:").' '.$spotter_item['squawk'].'" data-html="true" width="100px" /></a>'."\n".'<div class="thumbnail-copyright">&copy; '.$spotter_item['image_copyright'].'</div>';
575
+						print '<a href="'.$image_src.'"><img src="'.preg_replace("/^http:/i", "https:", $spotter_item['image_thumbnail']).'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '._("Not available").'" alt="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '._("Not available").'" data-content="'._("Registration:").' '.$spotter_item['registration'].'<br />'._("Aircraft:").' '.$spotter_item['aircraft_name'].' ('.$spotter_item['aircraft_type'].')<br />'._("Airline:").' '._("Not available").'<br />'._("Squawk:").' '.$spotter_item['squawk'].'" data-html="true" width="100px" /></a>'."\n".'<div class="thumbnail-copyright">&copy; '.$spotter_item['image_copyright'].'</div>';
576 576
 					} elseif (!isset($spotter_item['aircraft_name']) && isset($spotter_item['airline_name'])) {
577
-						print '<a href="'.$image_src.'"><img src="'.preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']).'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '.$spotter_item['airline_name'].'" alt="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '.$spotter_item['airline_name'].'" data-content="'._("Registration:").' '.$spotter_item['registration'].'<br />'._("Aircraft:").' ('.$spotter_item['aircraft_type'].')<br />'._("Airline:").' '.$spotter_item['airline_name'].'<br />'._("Squawk:").' '.$spotter_item['squawk'].'" data-html="true" width="100px" /></a>'."\n".'<div class="thumbnail-copyright">&copy; '.$spotter_item['image_copyright'].'</div>';
577
+						print '<a href="'.$image_src.'"><img src="'.preg_replace("/^http:/i", "https:", $spotter_item['image_thumbnail']).'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '.$spotter_item['airline_name'].'" alt="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '.$spotter_item['airline_name'].'" data-content="'._("Registration:").' '.$spotter_item['registration'].'<br />'._("Aircraft:").' ('.$spotter_item['aircraft_type'].')<br />'._("Airline:").' '.$spotter_item['airline_name'].'<br />'._("Squawk:").' '.$spotter_item['squawk'].'" data-html="true" width="100px" /></a>'."\n".'<div class="thumbnail-copyright">&copy; '.$spotter_item['image_copyright'].'</div>';
578 578
 					} elseif (!isset($spotter_item['aircraft_name']) && !isset($spotter_item['airline_name'])) {
579
-						print '<a href="'.$image_src.'"><img src="'.preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']).'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '._("Not available").'" alt="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '._("Not available").'" data-content="'._("Registration:").' '.$spotter_item['registration'].'<br />'._("Aircraft:").' ('.$spotter_item['aircraft_type'].')<br />'._("Airline:").' '._("Not available").'<br />'._("Squawk:").' '.$spotter_item['squawk'].'" data-html="true" width="100px" /></a>'."\n".'<div class="thumbnail-copyright">&copy; '.$spotter_item['image_copyright'].'</div>';
579
+						print '<a href="'.$image_src.'"><img src="'.preg_replace("/^http:/i", "https:", $spotter_item['image_thumbnail']).'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '._("Not available").'" alt="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '._("Not available").'" data-content="'._("Registration:").' '.$spotter_item['registration'].'<br />'._("Aircraft:").' ('.$spotter_item['aircraft_type'].')<br />'._("Airline:").' '._("Not available").'<br />'._("Squawk:").' '.$spotter_item['squawk'].'" data-html="true" width="100px" /></a>'."\n".'<div class="thumbnail-copyright">&copy; '.$spotter_item['image_copyright'].'</div>';
580 580
 					} else {
581
-						print '<a href="'.$image_src.'"><img src="'.preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']).'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '.$spotter_item['airline_name'].'" alt="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '.$spotter_item['airline_name'].'" data-content="'._("Registration:").' '.$spotter_item['registration'].'<br />'._("Aircraft:").' '.$spotter_item['aircraft_name'].' ('.$spotter_item['aircraft_type'].')<br />'._("Airline:").' '.$spotter_item['airline_name'].'<br />'._("Squawk:").' '.$spotter_item['squawk'].'" data-html="true" width="100px" /></a>'."\n".'<div class="thumbnail-copyright">&copy; '.$spotter_item['image_copyright'].'</div>';
581
+						print '<a href="'.$image_src.'"><img src="'.preg_replace("/^http:/i", "https:", $spotter_item['image_thumbnail']).'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '.$spotter_item['airline_name'].'" alt="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '.$spotter_item['airline_name'].'" data-content="'._("Registration:").' '.$spotter_item['registration'].'<br />'._("Aircraft:").' '.$spotter_item['aircraft_name'].' ('.$spotter_item['aircraft_type'].')<br />'._("Airline:").' '.$spotter_item['airline_name'].'<br />'._("Squawk:").' '.$spotter_item['squawk'].'" data-html="true" width="100px" /></a>'."\n".'<div class="thumbnail-copyright">&copy; '.$spotter_item['image_copyright'].'</div>';
582 582
 					}
583 583
 				} else {
584 584
 					if ($spotter_item['image_source'] == 'wikimedia' || $spotter_item['image_source'] == 'devianart' || $spotter_item['image_source'] == 'flickr') {
585
-						$image_thumbnail = preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']);
585
+						$image_thumbnail = preg_replace("/^http:/i", "https:", $spotter_item['image_thumbnail']);
586 586
 					} else 	$image_thumbnail = $spotter_item['image_thumbnail'];
587 587
 					if (!isset($spotter_item['airline_name']) && isset($spotter_item['aircraft_name'])) {
588 588
 						print '<a href="'.$globalURL.'/flightid/'.$spotter_item['spotter_id'].'"><img src="'.$image_thumbnail.'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '._("Not available").'" alt="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '._("Not available").'" data-content="'._("Registration:").' '.$spotter_item['registration'].'<br />'._("Aircraft:").' '.$spotter_item['aircraft_name'].' ('.$spotter_item['aircraft_type'].')<br />'._("Airline:").' '._("Not available").'<br />'._("Squawk:").' '.$spotter_item['squawk'].'" data-html="true" width="100px" /></a>'."\n".'<div class="thumbnail-copyright">&copy; '.$spotter_item['image_copyright'].'</div>';
@@ -615,7 +615,7 @@  discard block
 block discarded – undo
615 615
 			{
616 616
 				print '<td class="aircraft_thumbnail">'."\n";
617 617
 				if ($spotter_item['image_source'] == 'wikimedia' || $spotter_item['image_source'] == 'devianart' || $spotter_item['image_source'] == 'flickr') {
618
-					$image_thumbnail = preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']);
618
+					$image_thumbnail = preg_replace("/^http:/i", "https:", $spotter_item['image_thumbnail']);
619 619
 				} else 	$image_thumbnail = $spotter_item['image_thumbnail'];
620 620
 				print '<img src="'.$image_thumbnail.'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['mmsi'].'" alt="'.$spotter_item['mmsi'].'" data-content="'._("MMSI:").' '.$spotter_item['mmsi'].'" data-html="true" width="100px" />'."\n".'<div class="thumbnail-copyright">&copy; '.$spotter_item['image_copyright'].'</div>';
621 621
 				print '</td>'."\n";
@@ -629,7 +629,7 @@  discard block
 block discarded – undo
629 629
 			{
630 630
 				print '<td class="aircraft_thumbnail">'."\n";
631 631
 				if ($spotter_item['image_source'] == 'wikimedia' || $spotter_item['image_source'] == 'devianart' || $spotter_item['image_source'] == 'flickr') {
632
-					$image_thumbnail = preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']);
632
+					$image_thumbnail = preg_replace("/^http:/i", "https:", $spotter_item['image_thumbnail']);
633 633
 				} else 	$image_thumbnail = $spotter_item['image_thumbnail'];
634 634
 				print '<img src="'.$image_thumbnail.'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['ident'].'" alt="'.$spotter_item['type'].'" data-content="'._("Type:").' '.$spotter_item['type'].'" data-html="true" width="100px" />'."\n".'<div class="thumbnail-copyright">&copy; '.$spotter_item['image_copyright'].'</div>';
635 635
 				print '</td>'."\n";
@@ -732,7 +732,7 @@  discard block
 block discarded – undo
732 732
 	}
733 733
 	print '</td>'."\n";
734 734
 	// Aircraft type
735
-	if(strtolower($current_page) != "upcoming" && strtolower($current_page) != "acars-latest" && strtolower($current_page) != "acars-archive"){
735
+	if (strtolower($current_page) != "upcoming" && strtolower($current_page) != "acars-latest" && strtolower($current_page) != "acars-archive") {
736 736
 		print '<td class="type">'."\n";
737 737
 		if ($type == 'aircraft') {
738 738
 			if (!isset($spotter_item['aircraft_type']) && isset($spotter_item['aircraft_name'])) {
@@ -782,22 +782,22 @@  discard block
 block discarded – undo
782 782
 			}
783 783
 			if (isset($spotter_item['departure_airport_time']) && isset($spotter_item['real_departure_airport_time'])) {
784 784
 				if ($spotter_item['departure_airport_time'] > 2460) {
785
-					$departure_airport_time = date('H:m',$spotter_item['departure_airport_time']);
786
-				} else $departure_airport_time = substr($spotter_item['departure_airport_time'],0,-2).':'.substr($spotter_item['departure_airport_time'],-2);
785
+					$departure_airport_time = date('H:m', $spotter_item['departure_airport_time']);
786
+				} else $departure_airport_time = substr($spotter_item['departure_airport_time'], 0, -2).':'.substr($spotter_item['departure_airport_time'], -2);
787 787
 				if ($spotter_item['real_departure_airport_time'] > 2460) {
788
-					$real_departure_airport_time = date('H:m',$spotter_item['real_departure_airport_time']);
788
+					$real_departure_airport_time = date('H:m', $spotter_item['real_departure_airport_time']);
789 789
 				} else $real_departure_airport_time = $spotter_item['real_departure_airport_time'];
790 790
 				print '<br /><span class="airport_time">'.$departure_airport_time.' ('.$real_departure_airport_time.')</span>'."\n";
791 791
 			} elseif (isset($spotter_item['real_departure_airport_time']) && $spotter_item['real_departure_airport_time'] != 'NULL') {
792 792
 				if ($spotter_item['real_departure_airport_time'] > 2460) {
793
-					$real_departure_airport_time = date('H:m',$spotter_item['real_departure_airport_time']);
793
+					$real_departure_airport_time = date('H:m', $spotter_item['real_departure_airport_time']);
794 794
 				} else $real_departure_airport_time = $spotter_item['real_departure_airport_time'];
795 795
 				print '<br /><span class="airport_time">'.$real_departure_airport_time.'</span>'."\n";
796 796
 			} elseif (isset($spotter_item['departure_airport_time']) && $spotter_item['departure_airport_time'] != 'NULL') {
797 797
 				if ($spotter_item['departure_airport_time'] > 2460) {
798
-					$departure_airport_time = date('H:m',$spotter_item['departure_airport_time']);
798
+					$departure_airport_time = date('H:m', $spotter_item['departure_airport_time']);
799 799
 				} else {
800
-					$departure_airport_time = substr($spotter_item['departure_airport_time'],0,-2).':'.substr($spotter_item['departure_airport_time'],-2);
800
+					$departure_airport_time = substr($spotter_item['departure_airport_time'], 0, -2).':'.substr($spotter_item['departure_airport_time'], -2);
801 801
 				}
802 802
 				print '<br /><span class="airport_time">'.$departure_airport_time.'</span>'."\n";
803 803
 			}
@@ -812,7 +812,7 @@  discard block
 block discarded – undo
812 812
 						$latitude = $spotter_item['latitude'];
813 813
 						$longitude = $spotter_item['longitude'];
814 814
 					}
815
-					$distance = $Spotter->getAirportDistance($spotter_item['departure_airport'],$latitude,$longitude);
815
+					$distance = $Spotter->getAirportDistance($spotter_item['departure_airport'], $latitude, $longitude);
816 816
 				} else $distance = '';
817 817
 				if ($distance != '') {
818 818
 					if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'nm') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'nm')) {
@@ -855,20 +855,20 @@  discard block
 block discarded – undo
855 855
 			}
856 856
 			if (isset($spotter_item['arrival_airport_time']) && isset($spotter_item['real_arrival_airport_time'])) {
857 857
 				if ($spotter_item['arrival_airport_time'] > 2460) {
858
-					$arrival_airport_time = date('H:m',$spotter_item['arrival_airport_time']);
858
+					$arrival_airport_time = date('H:m', $spotter_item['arrival_airport_time']);
859 859
 				} else $arrival_airport_time = $spotter_item['arrival_airport_time'];
860 860
 				if ($spotter_item['real_arrival_airport_time'] > 2460) {
861
-					$real_arrival_airport_time = date('H:m',$spotter_item['real_arrival_airport_time']);
861
+					$real_arrival_airport_time = date('H:m', $spotter_item['real_arrival_airport_time']);
862 862
 				} else $real_arrival_airport_time = $spotter_item['real_arrival_airport_time'];
863 863
 				print '<br /><span class="airport_time">'.$spotter_item['arrival_airport_time'].' ('.$spotter_item['real_arrival_airport_time'].')</span>'."\n";
864 864
 			} elseif (isset($spotter_item['real_arrival_airport_time'])) {
865 865
 				if ($spotter_item['real_arrival_airport_time'] > 2460) {
866
-					$real_arrival_airport_time = date('H:m',$spotter_item['real_arrival_airport_time']);
866
+					$real_arrival_airport_time = date('H:m', $spotter_item['real_arrival_airport_time']);
867 867
 				} else $real_arrival_airport_time = $spotter_item['real_arrival_airport_time'];
868 868
 				print '<br /><span class="airport_time">'.$real_arrival_airport_time.'</span>'."\n";
869 869
 			} elseif (isset($spotter_item['arrival_airport_time']) && $spotter_item['arrival_airport_time'] != 'NULL') {
870 870
 				if ($spotter_item['arrival_airport_time'] > 2460) {
871
-					$arrival_airport_time = date('H:m',$spotter_item['arrival_airport_time']);
871
+					$arrival_airport_time = date('H:m', $spotter_item['arrival_airport_time']);
872 872
 				} else $arrival_airport_time = $spotter_item['arrival_airport_time'];
873 873
 				print '<br /><span class="airport_time">'.$arrival_airport_time.'</span>'."\n";
874 874
 			}
@@ -881,7 +881,7 @@  discard block
 block discarded – undo
881 881
 						$latitude = $spotter_item['latitude'];
882 882
 						$longitude = $spotter_item['longitude'];
883 883
 					}
884
-					$distance = $Spotter->getAirportDistance($spotter_item['arrival_airport'],$latitude,$longitude);
884
+					$distance = $Spotter->getAirportDistance($spotter_item['arrival_airport'], $latitude, $longitude);
885 885
 				} else $distance = '';
886 886
 				if ($distance != '') {
887 887
 					if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'nm') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'nm')) {
@@ -924,19 +924,19 @@  discard block
 block discarded – undo
924 924
 				print '<span class="mobile">-</span>'."\n";
925 925
 			} else {
926 926
 				if ((!isset($_COOKIE['unitdistance']) && ((isset($globalUnitDistance) && $globalUnitDistance == 'km') || !isset($globalUnitDistance))) || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'km')) {
927
-					print '<span class="nomobile">'.round($spotter_item['distance'],2).' km</span>'."\n";
928
-					print '<span class="mobile">'.round($spotter_item['distance'],2).' km</span><br />'."\n";
927
+					print '<span class="nomobile">'.round($spotter_item['distance'], 2).' km</span>'."\n";
928
+					print '<span class="mobile">'.round($spotter_item['distance'], 2).' km</span><br />'."\n";
929 929
 				} elseif ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'mi') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'mi')) {
930
-					print '<span class="nomobile">'.round($spotter_item['distance']*0.621371,2).' mi</span>'."\n";
931
-					print '<span class="mobile">'.round($spotter_item['distance']*0.621371,2).' mi</span><br />'."\n";
930
+					print '<span class="nomobile">'.round($spotter_item['distance']*0.621371, 2).' mi</span>'."\n";
931
+					print '<span class="mobile">'.round($spotter_item['distance']*0.621371, 2).' mi</span><br />'."\n";
932 932
 				} elseif ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'nm') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'nm')) {
933
-					print '<span class="nomobile">'.round($spotter_item['distance']*0.539957,2).' nm</span>'."\n";
934
-					print '<span class="mobile">'.round($spotter_item['distance']*0.539957,2).' nm</span><br />'."\n";
933
+					print '<span class="nomobile">'.round($spotter_item['distance']*0.539957, 2).' nm</span>'."\n";
934
+					print '<span class="mobile">'.round($spotter_item['distance']*0.539957, 2).' nm</span><br />'."\n";
935 935
 				}
936 936
 			}
937 937
 			print '</td>'."\n";
938 938
 		}
939
-		if(strtolower($current_page) != "upcoming"){
939
+		if (strtolower($current_page) != "upcoming") {
940 940
 			if ($type == 'aircraft') {
941 941
 				if ((isset($globalVA) && $globalVA) || (isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS)) {
942 942
 					print '<td class="pilot">'."\n";
@@ -972,7 +972,7 @@  discard block
 block discarded – undo
972 972
 		
973 973
 		if ($showRouteStop) {
974 974
 		// Route stop
975
-			if(strtolower($current_page) != "upcoming"){
975
+			if (strtolower($current_page) != "upcoming") {
976 976
 				print '<td class="route_stop">'."\n";
977 977
 				if (!isset($spotter_item['route_stop']) || $spotter_item['route_stop'] == '' || $spotter_item['route_stop'] == 'NULL') {
978 978
 					print '<span class="nomobile">-</span>'."\n";
@@ -991,11 +991,11 @@  discard block
 block discarded – undo
991 991
 		}
992 992
 		if ($showDuration) {
993 993
 		// Duration
994
-			if(strtolower($current_page) != "upcoming"){
994
+			if (strtolower($current_page) != "upcoming") {
995 995
 				print '<td class="duration">'."\n";
996 996
 				if (isset($spotter_item['duration'])) {
997
-					print '<span class="nomobile">'.gmdate('H:i:s',$spotter_item['duration']).'</span>'."\n";
998
-					print '<span class="mobile">'.gmdate('H:i:s',$spotter_item['duration']).'</span>'."\n";
997
+					print '<span class="nomobile">'.gmdate('H:i:s', $spotter_item['duration']).'</span>'."\n";
998
+					print '<span class="mobile">'.gmdate('H:i:s', $spotter_item['duration']).'</span>'."\n";
999 999
 				} else {
1000 1000
 					print '<span class="nomobile">-</span>'."\n";
1001 1001
 					print '<span class="mobile">-</span>'."\n";
@@ -1008,7 +1008,7 @@  discard block
 block discarded – undo
1008 1008
 	if (strtolower($current_page) == "acars-latest" || strtolower($current_page) == "acars-archive") {
1009 1009
 		if (isset($spotter_item['decode']) && $spotter_item['decode'] != '') {
1010 1010
 			print '<td class="message"><p>'."\n";
1011
-			print str_replace(array("\r\n", "\n", "\r"),'<br />',$spotter_item['message']);
1011
+			print str_replace(array("\r\n", "\n", "\r"), '<br />', $spotter_item['message']);
1012 1012
 			print '</p><p class="decode">';
1013 1013
 			$decode_array = json_decode($spotter_item['decode']);
1014 1014
 			foreach ($decode_array as $key => $value) {
@@ -1018,7 +1018,7 @@  discard block
 block discarded – undo
1018 1018
 			print '</td>'."\n";
1019 1019
 		} else {
1020 1020
 			print '<td class="message">'."\n";
1021
-			print str_replace(array("\r\n", "\n", "\r"),'<br />',$spotter_item['message']);
1021
+			print str_replace(array("\r\n", "\n", "\r"), '<br />', $spotter_item['message']);
1022 1022
 			print '</td>'."\n";
1023 1023
 		}
1024 1024
 	}
@@ -1043,7 +1043,7 @@  discard block
 block discarded – undo
1043 1043
 		}
1044 1044
 		print '</td>'."\n";
1045 1045
 		print '<td class="message">'."\n";
1046
-		print str_replace(array("\r\n", "\n", "\r"),'<br />',$spotter_item['message']);
1046
+		print str_replace(array("\r\n", "\n", "\r"), '<br />', $spotter_item['message']);
1047 1047
 		print '</td>'."\n";
1048 1048
 	}
1049 1049
 	if (strtolower($current_page) == "incident-latest" || strtolower($current_page) == "incident-detailed") {
@@ -1069,7 +1069,7 @@  discard block
 block discarded – undo
1069 1069
 		print '</td>'."\n";
1070 1070
 		*/
1071 1071
 		print '<td class="message">'."\n";
1072
-		print str_replace(array("\r\n", "\n", "\r"),'<br />',$spotter_item['message']);
1072
+		print str_replace(array("\r\n", "\n", "\r"), '<br />', $spotter_item['message']);
1073 1073
 		print '</td>'."\n";
1074 1074
 	}
1075 1075
 
Please login to merge, or discard this patch.
Braces   +63 added lines, -23 removed lines patch added patch discarded remove patch
@@ -7,7 +7,9 @@  discard block
 block discarded – undo
7 7
 $showRouteStop = $Common->multiKeyExists($spotter_array,'route_stop');
8 8
 $showDuration = $Common->multiKeyExists($spotter_array,'duration');
9 9
 
10
-if (!isset($type)) $type = 'aircraft';
10
+if (!isset($type)) {
11
+	$type = 'aircraft';
12
+}
11 13
 
12 14
 if (!isset($_GET['sort'])) 
13 15
 {
@@ -440,7 +442,9 @@  discard block
 block discarded – undo
440 442
 	if (isset($globalTimezone))
441 443
 	{
442 444
 		date_default_timezone_set($globalTimezone);
443
-	} else date_default_timezone_set('UTC');
445
+	} else {
446
+		date_default_timezone_set('UTC');
447
+	}
444 448
 	if ($showSpecial === true)
445 449
 	{
446 450
 		print '<tr class="special">'."\n";
@@ -455,7 +459,9 @@  discard block
 block discarded – undo
455 459
 			print '<tr class="active">';
456 460
 		} elseif (isset($spotter_item['spotted_registration'])) {
457 461
 			print '<tr class="info">';
458
-		} else print '<tr>';
462
+		} else {
463
+			print '<tr>';
464
+		}
459 465
 	}
460 466
 	if (strtolower($current_page) == "acars-latest" || strtolower($current_page) == "acars-archive" || strtolower($current_page) == "currently" || strtolower($current_page) == "accident-latest" || strtolower($current_page) == "incident-latest" || strtolower($current_page) == "accident-detailed" || strtolower($current_page) == "incident-detailed") {
461 467
 		if ($type == 'aircraft') {
@@ -463,8 +469,9 @@  discard block
 block discarded – undo
463 469
 			{
464 470
 				print '<td class="aircraft_thumbnail">'."\n";
465 471
 				if ($spotter_item['image_source'] == 'planespotters') {
466
-					if ($spotter_item['image_source_website'] != '') $image_src = $spotter_item['image_source_website'];
467
-					else {
472
+					if ($spotter_item['image_source_website'] != '') {
473
+						$image_src = $spotter_item['image_source_website'];
474
+					} else {
468 475
 						$planespotter_url_array = explode("_", $spotter_item['image']);
469 476
 						$planespotter_id = str_replace(".jpg", "", $planespotter_url_array[1]);
470 477
 						$image_src = 'https://www.planespotters.net/Aviation_Photos/photo.show?id='.$planespotter_id;
@@ -477,7 +484,9 @@  discard block
 block discarded – undo
477 484
 				} else {
478 485
 					if ($spotter_item['image_source'] == 'wikimedia' || $spotter_item['image_source'] == 'devianart' || $spotter_item['image_source'] == 'flickr') {
479 486
 						$image_thumbnail = preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']);
480
-					} else 	$image_thumbnail = $spotter_item['image_thumbnail'];
487
+					} else {
488
+						$image_thumbnail = $spotter_item['image_thumbnail'];
489
+					}
481 490
 					if (isset($spotter_item['airline_name'])) {
482 491
 						print '<img src="'.$image_thumbnail.'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['registration'].' - '.$spotter_item['airline_name'].'" alt="'.$spotter_item['registration'].' - '.$spotter_item['airline_name'].'" data-content="'._("Registration:").' '.$spotter_item['registration'].'<br />'._("Airline:").' '.$spotter_item['airline_name'].'" data-html="true" width="100px" />'."\n".'<div class="thumbnail-copyright">&copy; '.$spotter_item['image_copyright'].'</div>';
483 492
 					} else {
@@ -496,7 +505,9 @@  discard block
 block discarded – undo
496 505
 				print '<td class="aircraft_thumbnail">'."\n";
497 506
 				if ($spotter_item['image_source'] == 'wikimedia' || $spotter_item['image_source'] == 'devianart' || $spotter_item['image_source'] == 'flickr') {
498 507
 					$image_thumbnail = preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']);
499
-				} else 	$image_thumbnail = $spotter_item['image_thumbnail'];
508
+				} else {
509
+					$image_thumbnail = $spotter_item['image_thumbnail'];
510
+				}
500 511
 				if (isset($spotter_item['airline_name'])) {
501 512
 					print '<img src="'.$image_thumbnail.'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['mmsi'].'" alt="'.$spotter_item['mmsi'].'" data-content="'._("MMSI:").' '.$spotter_item['mmsi'].'" data-html="true" width="100px" />'."\n".'<div class="thumbnail-copyright">&copy; '.$spotter_item['image_copyright'].'</div>';
502 513
 				} else {
@@ -514,7 +525,9 @@  discard block
 block discarded – undo
514 525
 				print '<td class="aircraft_thumbnail">'."\n";
515 526
 				if ($spotter_item['image_source'] == 'wikimedia' || $spotter_item['image_source'] == 'devianart' || $spotter_item['image_source'] == 'flickr') {
516 527
 					$image_thumbnail = preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']);
517
-				} else 	$image_thumbnail = $spotter_item['image_thumbnail'];
528
+				} else {
529
+					$image_thumbnail = $spotter_item['image_thumbnail'];
530
+				}
518 531
 				print '<img src="'.$image_thumbnail.'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['ident'].'" alt="'.$spotter_item['type'].'" data-content="'._("Type:").' '.$spotter_item['type'].'" data-html="true" width="100px" />'."\n".'<div class="thumbnail-copyright">&copy; '.$spotter_item['image_copyright'].'</div>';
519 532
 				print '</td>'."\n";
520 533
 			} else {
@@ -565,8 +578,9 @@  discard block
 block discarded – undo
565 578
 				print '<td class="aircraft_thumbnail">'."\n";
566 579
 				//print '<a href="'.$globalURL.'/flightid/'.$spotter_item['spotter_id'].'"><img src="'.$spotter_item['image_thumbnail'].'" alt="Click to see more information about this flight" title="Click to see more information about this flight" width="100px" /></a>';
567 580
 				if ($spotter_item['image_source'] == 'planespotters') {
568
-					if ($spotter_item['image_source_website'] != '') $image_src = $spotter_item['image_source_website'];
569
-					else {
581
+					if ($spotter_item['image_source_website'] != '') {
582
+						$image_src = $spotter_item['image_source_website'];
583
+					} else {
570 584
 						$planespotter_url_array = explode("_", $spotter_array[0]['image']);
571 585
 						$planespotter_id = str_replace(".jpg", "", $planespotter_url_array[1]);
572 586
 						$image_src = 'https://www.planespotters.net/Aviation_Photos/photo.show?id='.$planespotter_id;
@@ -583,7 +597,9 @@  discard block
 block discarded – undo
583 597
 				} else {
584 598
 					if ($spotter_item['image_source'] == 'wikimedia' || $spotter_item['image_source'] == 'devianart' || $spotter_item['image_source'] == 'flickr') {
585 599
 						$image_thumbnail = preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']);
586
-					} else 	$image_thumbnail = $spotter_item['image_thumbnail'];
600
+					} else {
601
+						$image_thumbnail = $spotter_item['image_thumbnail'];
602
+					}
587 603
 					if (!isset($spotter_item['airline_name']) && isset($spotter_item['aircraft_name'])) {
588 604
 						print '<a href="'.$globalURL.'/flightid/'.$spotter_item['spotter_id'].'"><img src="'.$image_thumbnail.'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '._("Not available").'" alt="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '._("Not available").'" data-content="'._("Registration:").' '.$spotter_item['registration'].'<br />'._("Aircraft:").' '.$spotter_item['aircraft_name'].' ('.$spotter_item['aircraft_type'].')<br />'._("Airline:").' '._("Not available").'<br />'._("Squawk:").' '.$spotter_item['squawk'].'" data-html="true" width="100px" /></a>'."\n".'<div class="thumbnail-copyright">&copy; '.$spotter_item['image_copyright'].'</div>';
589 605
 					} elseif (!isset($spotter_item['aircraft_name']) && isset($spotter_item['airline_name'])) {
@@ -616,7 +632,9 @@  discard block
 block discarded – undo
616 632
 				print '<td class="aircraft_thumbnail">'."\n";
617 633
 				if ($spotter_item['image_source'] == 'wikimedia' || $spotter_item['image_source'] == 'devianart' || $spotter_item['image_source'] == 'flickr') {
618 634
 					$image_thumbnail = preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']);
619
-				} else 	$image_thumbnail = $spotter_item['image_thumbnail'];
635
+				} else {
636
+					$image_thumbnail = $spotter_item['image_thumbnail'];
637
+				}
620 638
 				print '<img src="'.$image_thumbnail.'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['mmsi'].'" alt="'.$spotter_item['mmsi'].'" data-content="'._("MMSI:").' '.$spotter_item['mmsi'].'" data-html="true" width="100px" />'."\n".'<div class="thumbnail-copyright">&copy; '.$spotter_item['image_copyright'].'</div>';
621 639
 				print '</td>'."\n";
622 640
 			} else {
@@ -630,7 +648,9 @@  discard block
 block discarded – undo
630 648
 				print '<td class="aircraft_thumbnail">'."\n";
631 649
 				if ($spotter_item['image_source'] == 'wikimedia' || $spotter_item['image_source'] == 'devianart' || $spotter_item['image_source'] == 'flickr') {
632 650
 					$image_thumbnail = preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']);
633
-				} else 	$image_thumbnail = $spotter_item['image_thumbnail'];
651
+				} else {
652
+					$image_thumbnail = $spotter_item['image_thumbnail'];
653
+				}
634 654
 				print '<img src="'.$image_thumbnail.'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['ident'].'" alt="'.$spotter_item['type'].'" data-content="'._("Type:").' '.$spotter_item['type'].'" data-html="true" width="100px" />'."\n".'<div class="thumbnail-copyright">&copy; '.$spotter_item['image_copyright'].'</div>';
635 655
 				print '</td>'."\n";
636 656
 			} else {
@@ -783,15 +803,21 @@  discard block
 block discarded – undo
783 803
 			if (isset($spotter_item['departure_airport_time']) && isset($spotter_item['real_departure_airport_time'])) {
784 804
 				if ($spotter_item['departure_airport_time'] > 2460) {
785 805
 					$departure_airport_time = date('H:m',$spotter_item['departure_airport_time']);
786
-				} else $departure_airport_time = substr($spotter_item['departure_airport_time'],0,-2).':'.substr($spotter_item['departure_airport_time'],-2);
806
+				} else {
807
+					$departure_airport_time = substr($spotter_item['departure_airport_time'],0,-2).':'.substr($spotter_item['departure_airport_time'],-2);
808
+				}
787 809
 				if ($spotter_item['real_departure_airport_time'] > 2460) {
788 810
 					$real_departure_airport_time = date('H:m',$spotter_item['real_departure_airport_time']);
789
-				} else $real_departure_airport_time = $spotter_item['real_departure_airport_time'];
811
+				} else {
812
+					$real_departure_airport_time = $spotter_item['real_departure_airport_time'];
813
+				}
790 814
 				print '<br /><span class="airport_time">'.$departure_airport_time.' ('.$real_departure_airport_time.')</span>'."\n";
791 815
 			} elseif (isset($spotter_item['real_departure_airport_time']) && $spotter_item['real_departure_airport_time'] != 'NULL') {
792 816
 				if ($spotter_item['real_departure_airport_time'] > 2460) {
793 817
 					$real_departure_airport_time = date('H:m',$spotter_item['real_departure_airport_time']);
794
-				} else $real_departure_airport_time = $spotter_item['real_departure_airport_time'];
818
+				} else {
819
+					$real_departure_airport_time = $spotter_item['real_departure_airport_time'];
820
+				}
795 821
 				print '<br /><span class="airport_time">'.$real_departure_airport_time.'</span>'."\n";
796 822
 			} elseif (isset($spotter_item['departure_airport_time']) && $spotter_item['departure_airport_time'] != 'NULL') {
797 823
 				if ($spotter_item['departure_airport_time'] > 2460) {
@@ -813,7 +839,9 @@  discard block
 block discarded – undo
813 839
 						$longitude = $spotter_item['longitude'];
814 840
 					}
815 841
 					$distance = $Spotter->getAirportDistance($spotter_item['departure_airport'],$latitude,$longitude);
816
-				} else $distance = '';
842
+				} else {
843
+					$distance = '';
844
+				}
817 845
 				if ($distance != '') {
818 846
 					if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'nm') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'nm')) {
819 847
 						echo '<br/><i>'.round($distance*0.539957).' nm</i>';
@@ -840,7 +868,9 @@  discard block
 block discarded – undo
840 868
 			} else {
841 869
 				if (isset($spotter_item['real_arrival_airport']) && $spotter_item['real_arrival_airport'] != $spotter_item['arrival_airport']) {
842 870
 					print '<span class="nomobile">Scheduled : <a href="'.$globalURL.'/airport/'.$spotter_item['arrival_airport'].'">'.$spotter_item['arrival_airport_city'].', '.$spotter_item['arrival_airport_country'].' ('.$spotter_item['arrival_airport'].')</a></span>'."\n";
843
-					if (!isset($Spotter)) $Spotter = new Spotter();
871
+					if (!isset($Spotter)) {
872
+						$Spotter = new Spotter();
873
+					}
844 874
 					$arrival_airport_info = $Spotter->getAllAirportInfo($spotter_item['real_arrival_airport']);
845 875
 					print '<br /><span class="nomobile">'._("Real:").' <a href="'.$globalURL.'/airport/'.$spotter_item['real_arrival_airport'].'">'.$arrival_airport_info[0]['city'].','.$arrival_airport_info[0]['country'].' ('.$spotter_item['real_arrival_airport'].')</a></span>'."\n";
846 876
 					print '<span class="mobile">'._("Scheduled:").' <a href="'.$globalURL.'/airport/'.$spotter_item['real_arrival_airport'].'">'.$spotter_item['real_arrival_airport'].'</a></span>'."\n";
@@ -856,20 +886,28 @@  discard block
 block discarded – undo
856 886
 			if (isset($spotter_item['arrival_airport_time']) && isset($spotter_item['real_arrival_airport_time'])) {
857 887
 				if ($spotter_item['arrival_airport_time'] > 2460) {
858 888
 					$arrival_airport_time = date('H:m',$spotter_item['arrival_airport_time']);
859
-				} else $arrival_airport_time = $spotter_item['arrival_airport_time'];
889
+				} else {
890
+					$arrival_airport_time = $spotter_item['arrival_airport_time'];
891
+				}
860 892
 				if ($spotter_item['real_arrival_airport_time'] > 2460) {
861 893
 					$real_arrival_airport_time = date('H:m',$spotter_item['real_arrival_airport_time']);
862
-				} else $real_arrival_airport_time = $spotter_item['real_arrival_airport_time'];
894
+				} else {
895
+					$real_arrival_airport_time = $spotter_item['real_arrival_airport_time'];
896
+				}
863 897
 				print '<br /><span class="airport_time">'.$spotter_item['arrival_airport_time'].' ('.$spotter_item['real_arrival_airport_time'].')</span>'."\n";
864 898
 			} elseif (isset($spotter_item['real_arrival_airport_time'])) {
865 899
 				if ($spotter_item['real_arrival_airport_time'] > 2460) {
866 900
 					$real_arrival_airport_time = date('H:m',$spotter_item['real_arrival_airport_time']);
867
-				} else $real_arrival_airport_time = $spotter_item['real_arrival_airport_time'];
901
+				} else {
902
+					$real_arrival_airport_time = $spotter_item['real_arrival_airport_time'];
903
+				}
868 904
 				print '<br /><span class="airport_time">'.$real_arrival_airport_time.'</span>'."\n";
869 905
 			} elseif (isset($spotter_item['arrival_airport_time']) && $spotter_item['arrival_airport_time'] != 'NULL') {
870 906
 				if ($spotter_item['arrival_airport_time'] > 2460) {
871 907
 					$arrival_airport_time = date('H:m',$spotter_item['arrival_airport_time']);
872
-				} else $arrival_airport_time = $spotter_item['arrival_airport_time'];
908
+				} else {
909
+					$arrival_airport_time = $spotter_item['arrival_airport_time'];
910
+				}
873 911
 				print '<br /><span class="airport_time">'.$arrival_airport_time.'</span>'."\n";
874 912
 			}
875 913
 			if (!isset($spotter_item['real_arrival_airport']) && $spotter_item['arrival_airport'] != 'NA') {
@@ -882,7 +920,9 @@  discard block
 block discarded – undo
882 920
 						$longitude = $spotter_item['longitude'];
883 921
 					}
884 922
 					$distance = $Spotter->getAirportDistance($spotter_item['arrival_airport'],$latitude,$longitude);
885
-				} else $distance = '';
923
+				} else {
924
+					$distance = '';
925
+				}
886 926
 				if ($distance != '') {
887 927
 					if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'nm') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'nm')) {
888 928
 						echo '<br/><i>'.round($distance*0.539957).' nm</i>';
Please login to merge, or discard this patch.
header.php 2 patches
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -8,31 +8,31 @@  discard block
 block discarded – undo
8 8
 if (isset($_COOKIE['MapType']) && $_COOKIE['MapType'] != '') $MapType = $_COOKIE['MapType'];
9 9
 else $MapType = $globalMapProvider;
10 10
 if (isset($_GET['3d'])) {
11
-	setcookie('MapFormat','3d');
11
+	setcookie('MapFormat', '3d');
12 12
 } else if (isset($_GET['2d'])) {
13
-	setcookie('MapFormat','2d');
13
+	setcookie('MapFormat', '2d');
14 14
 }
15 15
 
16 16
 if (isset($_POST['archive'])) {
17
-	setcookie('archive','true');
18
-	setcookie('archive_begin',strtotime($_POST['start_date']));
19
-	setcookie('archive_end',strtotime($_POST['end_date']));
20
-	setcookie('archive_speed',$_POST['archivespeed']);
17
+	setcookie('archive', 'true');
18
+	setcookie('archive_begin', strtotime($_POST['start_date']));
19
+	setcookie('archive_end', strtotime($_POST['end_date']));
20
+	setcookie('archive_speed', $_POST['archivespeed']);
21 21
 }
22 22
 if (isset($_POST['noarchive'])) {
23
-	setcookie('archive','false',-1);
24
-	setcookie('archive_begin','',-1);
25
-	setcookie('archive_end','',-1);
26
-	setcookie('archive_speed','',-1);
23
+	setcookie('archive', 'false', -1);
24
+	setcookie('archive_begin', '', -1);
25
+	setcookie('archive_end', '', -1);
26
+	setcookie('archive_speed', '', -1);
27 27
 }
28 28
 // When button "Remove all filters" is clicked
29 29
 if (isset($_POST['removefilters'])) {
30
-	$allfilters = array_filter(array_keys($_COOKIE),function($key) {
31
-	    return strpos($key,'filter_') === 0;
30
+	$allfilters = array_filter(array_keys($_COOKIE), function($key) {
31
+	    return strpos($key, 'filter_') === 0;
32 32
 	});
33 33
 	foreach ($allfilters as $filt) {
34 34
 		unset($_COOKIE[$filt]);
35
-		setcookie($filt,null,-1);
35
+		setcookie($filt, null, -1);
36 36
 	}
37 37
 }
38 38
 ?>
@@ -240,7 +240,7 @@  discard block
 block discarded – undo
240 240
 <script src="<?php print $globalURL; ?>/js/MovingMarker.js"></script>
241 241
 <script src="<?php print $globalURL; ?>/js/jquery.idle.min.js"></script>
242 242
 <script src="<?php print $globalURL; ?>/js/map.common.js"></script>
243
-<script src="<?php print $globalURL; ?>/js/map.2d.js.php?ident=<?php print $ident; ?><?php if(isset($latitude)) print '&latitude='.$latitude; ?><?php if(isset($longitude)) print '&longitude='.$longitude; ?>&<?php print time(); ?>"></script>
243
+<script src="<?php print $globalURL; ?>/js/map.2d.js.php?ident=<?php print $ident; ?><?php if (isset($latitude)) print '&latitude='.$latitude; ?><?php if (isset($longitude)) print '&longitude='.$longitude; ?>&<?php print time(); ?>"></script>
244 244
 <?php
245 245
 		if (!isset($type) || $type == 'aircraft') {
246 246
 ?>
@@ -310,7 +310,7 @@  discard block
 block discarded – undo
310 310
 <script src="<?php print $globalURL; ?>/js/MovingMarker.js"></script>
311 311
 <script src="<?php print $globalURL; ?>/js/jquery.idle.min.js"></script>
312 312
 <script src="<?php print $globalURL; ?>/js/map.common.js"></script>
313
-<script src="<?php print $globalURL; ?>/js/map.2d.js.php?flightaware_id=<?php print $flightaware_id; ?><?php if(isset($latitude)) print '&latitude='.$latitude; ?><?php if(isset($longitude)) print '&longitude='.$longitude; ?>&<?php print time(); ?>"></script>
313
+<script src="<?php print $globalURL; ?>/js/map.2d.js.php?flightaware_id=<?php print $flightaware_id; ?><?php if (isset($latitude)) print '&latitude='.$latitude; ?><?php if (isset($longitude)) print '&longitude='.$longitude; ?>&<?php print time(); ?>"></script>
314 314
 <script src="<?php print $globalURL; ?>/js/map-aircraft.2d.js.php?flightaware_id=<?php print $flightaware_id; ?>&<?php print time(); ?>"></script>
315 315
 <?php
316 316
 		if (isset($globalGoogleAPIKey) && $globalGoogleAPIKey != '' && ($MapType == 'Google-Roadmap' || $MapType == 'Google-Satellite' || $MapType == 'Google-Hybrid' || $MapType == 'Google-Terrain')) {
@@ -589,7 +589,7 @@  discard block
 block discarded – undo
589 589
 ?>
590 590
       <div class="search">
591 591
       <form action="<?php print $globalURL; ?>/search" method="get">
592
-		<input type="text" name="q" value="<?php if (isset($GET['q'])) { if ($_GET['q'] != ""){ print $_GET['q']; } else { print _("Search"); } } else { print _("Search"); } ?>" onfocus="if (this.value=='search'){this.value='';}" /><button type="submit"><i class="fa fa-search"></i></button>
592
+		<input type="text" name="q" value="<?php if (isset($GET['q'])) { if ($_GET['q'] != "") { print $_GET['q']; } else { print _("Search"); } } else { print _("Search"); } ?>" onfocus="if (this.value=='search'){this.value='';}" /><button type="submit"><i class="fa fa-search"></i></button>
593 593
 	</form>
594 594
 	</div>
595 595
   	<div class="social">
@@ -607,7 +607,7 @@  discard block
 block discarded – undo
607 607
 	print '</div>';
608 608
 }
609 609
 
610
-if (strtolower($current_page) =='ident-detailed' || strtolower($current_page) == 'flightid-overview') {
610
+if (strtolower($current_page) == 'ident-detailed' || strtolower($current_page) == 'flightid-overview') {
611 611
 ?>
612 612
     <div class="top-header clear" role="main">
613 613
 <?php
@@ -620,7 +620,7 @@  discard block
 block discarded – undo
620 620
     </div>
621 621
 <?php
622 622
 }
623
-if ((strpos(strtolower($current_page),'airport-') !== false && strpos(strtolower($current_page),'statistics-') === false) || (strpos(strtolower($current_page),'route-') !== false && strpos(strtolower($current_page),'statistics-') === false))
623
+if ((strpos(strtolower($current_page), 'airport-') !== false && strpos(strtolower($current_page), 'statistics-') === false) || (strpos(strtolower($current_page), 'route-') !== false && strpos(strtolower($current_page), 'statistics-') === false))
624 624
 {
625 625
     ?>
626 626
     <div class="top-header clear" role="main">
@@ -633,15 +633,15 @@  discard block
 block discarded – undo
633 633
         var zoom = 13;
634 634
 //create the map
635 635
 <?php
636
-    if (strpos(strtolower($current_page),'airport-') !== false && strpos(strtolower($current_page),'statistics-') === false && isset($airport_array[0]['latitude'])) {
636
+    if (strpos(strtolower($current_page), 'airport-') !== false && strpos(strtolower($current_page), 'statistics-') === false && isset($airport_array[0]['latitude'])) {
637 637
 ?>
638 638
   map = L.map('map', { zoomControl:true }).setView([<?php print $airport_array[0]['latitude']; ?>,<?php print $airport_array[0]['longitude']; ?>], zoom);
639 639
 <?php
640
-    } elseif (strpos(strtolower($current_page),'airport-') !== false && strpos(strtolower($current_page),'statistics-') === false) {
640
+    } elseif (strpos(strtolower($current_page), 'airport-') !== false && strpos(strtolower($current_page), 'statistics-') === false) {
641 641
 ?>
642 642
   map = L.map('map', { zoomControl:true });
643 643
 <?php
644
-    } elseif (strpos(strtolower($current_page),'route-') !== false && strpos(strtolower($current_page),'statistics-') === false && isset($spotter_array[0]['departure_airport_latitude'])) {
644
+    } elseif (strpos(strtolower($current_page), 'route-') !== false && strpos(strtolower($current_page), 'statistics-') === false && isset($spotter_array[0]['departure_airport_latitude'])) {
645 645
 ?>
646 646
   map = L.map('map', { zoomControl:true }).setView([<?php print $spotter_array[0]['departure_airport_latitude']; ?>,<?php print $spotter_array[0]['arrival_airport_longitude']; ?>]);
647 647
     var line = L.polyline([[<?php print $spotter_array[0]['departure_airport_latitude']; ?>, <?php print $spotter_array[0]['departure_airport_longitude']; ?>],[<?php print $spotter_array[0]['arrival_airport_latitude']; ?>, <?php print $spotter_array[0]['arrival_airport_longitude']; ?>]]).addTo(map);
@@ -649,7 +649,7 @@  discard block
 block discarded – undo
649 649
     var departure_airport = L.marker([<?php print $spotter_array[0]['departure_airport_latitude']; ?>, <?php print $spotter_array[0]['departure_airport_longitude']; ?>], {icon: L.icon({iconUrl: '<?php print $globalURL; ?>/images/departure_airport.png',iconSize: [16,18],iconAnchor: [8,16]})}).addTo(map);
650 650
     var arrival_airport = L.marker([<?php print $spotter_array[0]['arrival_airport_latitude']; ?>, <?php print $spotter_array[0]['arrival_airport_longitude']; ?>], {icon: L.icon({iconUrl: '<?php print $globalURL; ?>/images/arrival_airport.png',iconSize: [16,18],iconAnchor: [8,16]})}).addTo(map);
651 651
 <?php
652
-    } elseif (strpos(strtolower($current_page),'route-') !== false && strpos(strtolower($current_page),'statistics-') === false && !isset($spotter_array[0]['departure_airport_latitude'])) {
652
+    } elseif (strpos(strtolower($current_page), 'route-') !== false && strpos(strtolower($current_page), 'statistics-') === false && !isset($spotter_array[0]['departure_airport_latitude'])) {
653 653
 ?>
654 654
   map = L.map('map', { zoomControl:true }).setView([<?php print $spotter_array[0]['latitude']; ?>,<?php print $spotter_array[0]['longitude']; ?>]);
655 655
 <?php
Please login to merge, or discard this patch.
Braces   +52 added lines, -12 removed lines patch added patch discarded remove patch
@@ -5,8 +5,11 @@  discard block
 block discarded – undo
5 5
 $file_path = pathinfo($_SERVER['SCRIPT_NAME']);
6 6
 $current_page = $file_path['filename'];
7 7
 date_default_timezone_set($globalTimezone);
8
-if (isset($_COOKIE['MapType']) && $_COOKIE['MapType'] != '') $MapType = $_COOKIE['MapType'];
9
-else $MapType = $globalMapProvider;
8
+if (isset($_COOKIE['MapType']) && $_COOKIE['MapType'] != '') {
9
+	$MapType = $_COOKIE['MapType'];
10
+} else {
11
+	$MapType = $globalMapProvider;
12
+}
10 13
 if (isset($_GET['3d'])) {
11 14
 	setcookie('MapFormat','3d');
12 15
 } else if (isset($_GET['2d'])) {
@@ -240,7 +243,13 @@  discard block
 block discarded – undo
240 243
 <script src="<?php print $globalURL; ?>/js/MovingMarker.js"></script>
241 244
 <script src="<?php print $globalURL; ?>/js/jquery.idle.min.js"></script>
242 245
 <script src="<?php print $globalURL; ?>/js/map.common.js"></script>
243
-<script src="<?php print $globalURL; ?>/js/map.2d.js.php?ident=<?php print $ident; ?><?php if(isset($latitude)) print '&latitude='.$latitude; ?><?php if(isset($longitude)) print '&longitude='.$longitude; ?>&<?php print time(); ?>"></script>
246
+<script src="<?php print $globalURL; ?>/js/map.2d.js.php?ident=<?php print $ident; ?><?php if(isset($latitude)) {
247
+	print '&latitude='.$latitude;
248
+}
249
+?><?php if(isset($longitude)) {
250
+	print '&longitude='.$longitude;
251
+}
252
+?>&<?php print time(); ?>"></script>
244 253
 <?php
245 254
 		if (!isset($type) || $type == 'aircraft') {
246 255
 ?>
@@ -310,7 +319,13 @@  discard block
 block discarded – undo
310 319
 <script src="<?php print $globalURL; ?>/js/MovingMarker.js"></script>
311 320
 <script src="<?php print $globalURL; ?>/js/jquery.idle.min.js"></script>
312 321
 <script src="<?php print $globalURL; ?>/js/map.common.js"></script>
313
-<script src="<?php print $globalURL; ?>/js/map.2d.js.php?flightaware_id=<?php print $flightaware_id; ?><?php if(isset($latitude)) print '&latitude='.$latitude; ?><?php if(isset($longitude)) print '&longitude='.$longitude; ?>&<?php print time(); ?>"></script>
322
+<script src="<?php print $globalURL; ?>/js/map.2d.js.php?flightaware_id=<?php print $flightaware_id; ?><?php if(isset($latitude)) {
323
+	print '&latitude='.$latitude;
324
+}
325
+?><?php if(isset($longitude)) {
326
+	print '&longitude='.$longitude;
327
+}
328
+?>&<?php print time(); ?>"></script>
314 329
 <script src="<?php print $globalURL; ?>/js/map-aircraft.2d.js.php?flightaware_id=<?php print $flightaware_id; ?>&<?php print time(); ?>"></script>
315 330
 <?php
316 331
 		if (isset($globalGoogleAPIKey) && $globalGoogleAPIKey != '' && ($MapType == 'Google-Roadmap' || $MapType == 'Google-Satellite' || $MapType == 'Google-Hybrid' || $MapType == 'Google-Terrain')) {
@@ -384,7 +399,12 @@  discard block
 block discarded – undo
384 399
         <span class="icon-bar"></span>
385 400
       </button>
386 401
       <a href="<?php print $globalURL; ?>/search" class="navbar-toggle navbar-toggle-search"><i class="fa fa-search"></i></a>
387
-      <a class="navbar-brand" href="<?php if ($globalURL == '') print '/'; else print $globalURL; ?>"><img src="<?php print $globalURL.$logoURL; ?>" height="30px" /></a>
402
+      <a class="navbar-brand" href="<?php if ($globalURL == '') {
403
+	print '/';
404
+} else {
405
+	print $globalURL;
406
+}
407
+?>"><img src="<?php print $globalURL.$logoURL; ?>" height="30px" /></a>
388 408
     </div>
389 409
     <div class="collapse navbar-collapse">
390 410
 
@@ -410,7 +430,10 @@  discard block
 block discarded – undo
410 430
 <?php
411 431
     }
412 432
 ?>
413
-          <a href="#" class="dropdown-toggle" data-toggle="dropdown"><?php echo _("Explore"); ?> <b class="<?php if ($sub) echo 'right-'; ?>caret"></b></a>
433
+          <a href="#" class="dropdown-toggle" data-toggle="dropdown"><?php echo _("Explore"); ?> <b class="<?php if ($sub) {
434
+	echo 'right-';
435
+}
436
+?>caret"></b></a>
414 437
           <ul class="dropdown-menu">
415 438
           	<li><a href="<?php print $globalURL; ?>/aircraft"><?php echo _("Aircrafts Types"); ?></a></li>
416 439
 			<li><a href="<?php print $globalURL; ?>/airline"><?php echo _("Airlines"); ?></a></li>
@@ -467,8 +490,14 @@  discard block
 block discarded – undo
467 490
         </li>
468 491
       	<li><a href="<?php print $globalURL; ?>/search"><?php echo _("Search"); ?></a></li>
469 492
       	<li><a href="<?php print $globalURL; ?>/statistics"><?php echo _("Statistics"); ?></a></li>
470
-        <li class="dropdown<?php if ($sub) echo '-submenu'; ?>">
471
-          <a href="#" class="dropdown-toggle" data-toggle="dropdown"><?php echo _("Tools"); ?> <b class="<?php if ($sub) echo 'right-'; ?>caret"></b></a>
493
+        <li class="dropdown<?php if ($sub) {
494
+	echo '-submenu';
495
+}
496
+?>">
497
+          <a href="#" class="dropdown-toggle" data-toggle="dropdown"><?php echo _("Tools"); ?> <b class="<?php if ($sub) {
498
+	echo 'right-';
499
+}
500
+?>caret"></b></a>
472 501
           <ul class="dropdown-menu">
473 502
           	<li><a href="<?php print $globalURL; ?>/tools/acars"><?php echo _("ACARS translator"); ?></a></li>
474 503
           	<li><a href="<?php print $globalURL; ?>/tools/metar"><?php echo _("METAR translator"); ?></a></li>
@@ -497,7 +526,10 @@  discard block
 block discarded – undo
497 526
 <?php
498 527
 	}
499 528
 ?>
500
-		<a href="#" class="dropdown-toggle" data-toggle="dropdown"><?php echo _("Explore"); ?> <b class="<?php if ($sub) echo 'right-'; ?>caret"></b></a>
529
+		<a href="#" class="dropdown-toggle" data-toggle="dropdown"><?php echo _("Explore"); ?> <b class="<?php if ($sub) {
530
+	echo 'right-';
531
+}
532
+?>caret"></b></a>
501 533
 		<ul class="dropdown-menu">
502 534
 		    <li><a href="<?php print $globalURL; ?>/marine/currently"><?php echo _("Current Activity"); ?></a></li>
503 535
 		    <li><a href="<?php print $globalURL; ?>/marine/latest"><?php echo _("Latest Activity"); ?></a></li>
@@ -528,7 +560,10 @@  discard block
 block discarded – undo
528 560
 <?php
529 561
 	}
530 562
 ?>
531
-		<a href="#" class="dropdown-toggle" data-toggle="dropdown"><?php echo _("Explore"); ?> <b class="<?php if ($sub) echo 'right-'; ?>caret"></b></a>
563
+		<a href="#" class="dropdown-toggle" data-toggle="dropdown"><?php echo _("Explore"); ?> <b class="<?php if ($sub) {
564
+	echo 'right-';
565
+}
566
+?>caret"></b></a>
532 567
 		<ul class="dropdown-menu">
533 568
 		    <li><a href="<?php print $globalURL; ?>/tracker/currently"><?php echo _("Current Activity"); ?></a></li>
534 569
 		    <li><a href="<?php print $globalURL; ?>/tracker/latest"><?php echo _("Latest Activity"); ?></a></li>
@@ -577,7 +612,9 @@  discard block
 block discarded – undo
577 612
   		        $alllang = $Language->getLanguages();
578 613
   		        foreach ($alllang as $key => $lang) {
579 614
   		            print '<option value="'.$key.'"';
580
-  		            if (isset($_COOKIE['language']) && $_COOKIE['language'] == $key) print ' selected ';
615
+  		            if (isset($_COOKIE['language']) && $_COOKIE['language'] == $key) {
616
+  		            	print ' selected ';
617
+  		            }
581 618
   		            print '>'.$lang[0].'</option>';
582 619
   		        }
583 620
   		    ?>
@@ -730,4 +767,7 @@  discard block
 block discarded – undo
730 767
 
731 768
 ?>
732 769
 
733
-<section class="container main-content <?php if (strtolower($current_page) == 'index') print 'index '; ?>clear">
770
+<section class="container main-content <?php if (strtolower($current_page) == 'index') {
771
+	print 'index ';
772
+}
773
+?>clear">
Please login to merge, or discard this patch.
require/class.TrackerLive.php 3 patches
Indentation   +197 added lines, -197 removed lines patch added patch discarded remove patch
@@ -12,10 +12,10 @@  discard block
 block discarded – undo
12 12
 
13 13
 
14 14
 	/**
15
-	* Get SQL query part for filter used
16
-	* @param Array $filter the filter
17
-	* @return Array the SQL part
18
-	*/
15
+	 * Get SQL query part for filter used
16
+	 * @param Array $filter the filter
17
+	 * @return Array the SQL part
18
+	 */
19 19
 	public function getFilter($filter = array(),$where = false,$and = false) {
20 20
 		global $globalFilter, $globalStatsFilters, $globalFilterName, $globalDBdriver;
21 21
 		$filters = array();
@@ -86,11 +86,11 @@  discard block
 block discarded – undo
86 86
 	}
87 87
 
88 88
 	/**
89
-	* Gets all the spotter information based on the latest data entry
90
-	*
91
-	* @return Array the spotter information
92
-	*
93
-	*/
89
+	 * Gets all the spotter information based on the latest data entry
90
+	 *
91
+	 * @return Array the spotter information
92
+	 *
93
+	 */
94 94
 	public function getLiveTrackerData($limit = '', $sort = '', $filter = array())
95 95
 	{
96 96
 		global $globalDBdriver, $globalLiveInterval;
@@ -132,11 +132,11 @@  discard block
 block discarded – undo
132 132
 	}
133 133
 
134 134
 	/**
135
-	* Gets Minimal Live Spotter data
136
-	*
137
-	* @return Array the spotter information
138
-	*
139
-	*/
135
+	 * Gets Minimal Live Spotter data
136
+	 *
137
+	 * @return Array the spotter information
138
+	 *
139
+	 */
140 140
 	public function getMinLiveTrackerData($filter = array())
141 141
 	{
142 142
 		global $globalDBdriver, $globalLiveInterval;
@@ -170,11 +170,11 @@  discard block
 block discarded – undo
170 170
 	}
171 171
 
172 172
 	/**
173
-	* Gets Minimal Live Spotter data since xx seconds
174
-	*
175
-	* @return Array the spotter information
176
-	*
177
-	*/
173
+	 * Gets Minimal Live Spotter data since xx seconds
174
+	 *
175
+	 * @return Array the spotter information
176
+	 *
177
+	 */
178 178
 	public function getMinLastLiveTrackerData($filter = array())
179 179
 	{
180 180
 		global $globalDBdriver, $globalLiveInterval;
@@ -187,13 +187,13 @@  discard block
 block discarded – undo
187 187
 			$query  = 'SELECT tracker_live.ident, tracker_live.famtrackid,tracker_live.type, tracker_live.latitude, tracker_live.longitude, tracker_live.altitude, tracker_live.heading, tracker_live.ground_speed, tracker_live.date, tracker_live.format_source 
188 188
 			FROM tracker_live'.$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval." SECOND) <= tracker_live.date AND tracker_live.latitude <> '0' AND tracker_live.longitude <> '0' 
189 189
 			ORDER BY tracker_live.famtrackid, tracker_live.date";
190
-                } else {
190
+				} else {
191 191
 			$query  = "SELECT tracker_live.ident, tracker_live.famtrackid, tracker_live.type,tracker_live.latitude, tracker_live.longitude, tracker_live.altitude, tracker_live.heading, tracker_live.ground_speed, tracker_live.date, tracker_live.format_source 
192 192
 			FROM tracker_live".$filter_query." CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= tracker_live.date AND tracker_live.latitude <> '0' AND tracker_live.longitude <> '0' 
193 193
 			ORDER BY tracker_live.famtrackid, tracker_live.date";
194 194
 		}
195 195
 
196
-    		try {
196
+			try {
197 197
 			$sth = $this->db->prepare($query);
198 198
 			$sth->execute();
199 199
 		} catch(PDOException $e) {
@@ -205,11 +205,11 @@  discard block
 block discarded – undo
205 205
 	}
206 206
 
207 207
 	/**
208
-	* Gets number of latest data entry
209
-	*
210
-	* @return String number of entry
211
-	*
212
-	*/
208
+	 * Gets number of latest data entry
209
+	 *
210
+	 * @return String number of entry
211
+	 *
212
+	 */
213 213
 	public function getLiveTrackerCount($filter = array())
214 214
 	{
215 215
 		global $globalDBdriver, $globalLiveInterval;
@@ -234,11 +234,11 @@  discard block
 block discarded – undo
234 234
 	}
235 235
 
236 236
 	/**
237
-	* Gets all the spotter information based on the latest data entry and coord
238
-	*
239
-	* @return Array the spotter information
240
-	*
241
-	*/
237
+	 * Gets all the spotter information based on the latest data entry and coord
238
+	 *
239
+	 * @return Array the spotter information
240
+	 *
241
+	 */
242 242
 	public function getLiveTrackerDatabyCoord($coord, $filter = array())
243 243
 	{
244 244
 		global $globalDBdriver, $globalLiveInterval;
@@ -262,11 +262,11 @@  discard block
 block discarded – undo
262 262
 	}
263 263
 
264 264
 	/**
265
-	* Gets all the spotter information based on the latest data entry and coord
266
-	*
267
-	* @return Array the spotter information
268
-	*
269
-	*/
265
+	 * Gets all the spotter information based on the latest data entry and coord
266
+	 *
267
+	 * @return Array the spotter information
268
+	 *
269
+	 */
270 270
 	public function getMinLiveTrackerDatabyCoord($coord, $filter = array())
271 271
 	{
272 272
 		global $globalDBdriver, $globalLiveInterval;
@@ -293,11 +293,11 @@  discard block
 block discarded – undo
293 293
 	}
294 294
 
295 295
 	/**
296
-	* Gets all the spotter information based on a user's latitude and longitude
297
-	*
298
-	* @return Array the spotter information
299
-	*
300
-	*/
296
+	 * Gets all the spotter information based on a user's latitude and longitude
297
+	 *
298
+	 * @return Array the spotter information
299
+	 *
300
+	 */
301 301
 	public function getLatestTrackerForLayar($lat, $lng, $radius, $interval)
302 302
 	{
303 303
 		$Tracker = new Tracker($this->db);
@@ -310,142 +310,142 @@  discard block
 block discarded – undo
310 310
 		if ($lng != '')
311 311
 		{
312 312
 			if (!is_numeric($lng))
313
-                        {
314
-                                return false;
315
-                        }
316
-                }
317
-
318
-                if ($radius != '')
319
-                {
320
-                        if (!is_numeric($radius))
321
-                        {
322
-                                return false;
323
-                        }
324
-                }
313
+						{
314
+								return false;
315
+						}
316
+				}
317
+
318
+				if ($radius != '')
319
+				{
320
+						if (!is_numeric($radius))
321
+						{
322
+								return false;
323
+						}
324
+				}
325 325
 		$additional_query = '';
326 326
 		if ($interval != '')
327
-                {
328
-                        if (!is_string($interval))
329
-                        {
330
-                                //$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= tracker_live.date ';
331
-			        return false;
332
-                        } else {
333
-                if ($interval == '1m')
334
-                {
335
-                    $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= tracker_live.date ';
336
-                } else if ($interval == '15m'){
337
-                    $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 15 MINUTE) <= tracker_live.date ';
338
-                } 
339
-            }
340
-                } else {
341
-         $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= tracker_live.date ';   
342
-        }
343
-
344
-                $query  = "SELECT tracker_live.*, ( 6371 * acos( cos( radians(:lat) ) * cos( radians( latitude ) ) * cos( radians( longitude ) - radians(:lng) ) + sin( radians(:lat) ) * sin( radians( latitude ) ) ) ) AS distance FROM tracker_live 
327
+				{
328
+						if (!is_string($interval))
329
+						{
330
+								//$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= tracker_live.date ';
331
+					return false;
332
+						} else {
333
+				if ($interval == '1m')
334
+				{
335
+					$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= tracker_live.date ';
336
+				} else if ($interval == '15m'){
337
+					$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 15 MINUTE) <= tracker_live.date ';
338
+				} 
339
+			}
340
+				} else {
341
+		 $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= tracker_live.date ';   
342
+		}
343
+
344
+				$query  = "SELECT tracker_live.*, ( 6371 * acos( cos( radians(:lat) ) * cos( radians( latitude ) ) * cos( radians( longitude ) - radians(:lng) ) + sin( radians(:lat) ) * sin( radians( latitude ) ) ) ) AS distance FROM tracker_live 
345 345
                    WHERE tracker_live.latitude <> '' 
346 346
                                    AND tracker_live.longitude <> '' 
347 347
                    ".$additional_query."
348 348
                    HAVING distance < :radius  
349 349
                                    ORDER BY distance";
350 350
 
351
-                $spotter_array = $Tracker->getDataFromDB($query, array(':lat' => $lat, ':lng' => $lng,':radius' => $radius));
351
+				$spotter_array = $Tracker->getDataFromDB($query, array(':lat' => $lat, ':lng' => $lng,':radius' => $radius));
352 352
 
353
-                return $spotter_array;
354
-        }
353
+				return $spotter_array;
354
+		}
355 355
 
356 356
     
357
-        /**
358
-	* Gets all the spotter information based on a particular callsign
359
-	*
360
-	* @return Array the spotter information
361
-	*
362
-	*/
357
+		/**
358
+		 * Gets all the spotter information based on a particular callsign
359
+		 *
360
+		 * @return Array the spotter information
361
+		 *
362
+		 */
363 363
 	public function getLastLiveTrackerDataByIdent($ident)
364 364
 	{
365 365
 		$Tracker = new Tracker($this->db);
366 366
 		date_default_timezone_set('UTC');
367 367
 
368 368
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
369
-                $query  = 'SELECT tracker_live.* FROM tracker_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_live l WHERE l.ident = :ident GROUP BY l.famtrackid) s on tracker_live.famtrackid = s.famtrackid AND tracker_live.date = s.maxdate ORDER BY tracker_live.date DESC';
369
+				$query  = 'SELECT tracker_live.* FROM tracker_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_live l WHERE l.ident = :ident GROUP BY l.famtrackid) s on tracker_live.famtrackid = s.famtrackid AND tracker_live.date = s.maxdate ORDER BY tracker_live.date DESC';
370 370
 
371 371
 		$spotter_array = $Tracker->getDataFromDB($query,array(':ident' => $ident),'',true);
372 372
 
373 373
 		return $spotter_array;
374 374
 	}
375 375
 
376
-        /**
377
-	* Gets all the spotter information based on a particular callsign
378
-	*
379
-	* @return Array the spotter information
380
-	*
381
-	*/
376
+		/**
377
+		 * Gets all the spotter information based on a particular callsign
378
+		 *
379
+		 * @return Array the spotter information
380
+		 *
381
+		 */
382 382
 	public function getDateLiveTrackerDataByIdent($ident,$date)
383 383
 	{
384 384
 		$Tracker = new Tracker($this->db);
385 385
 		date_default_timezone_set('UTC');
386 386
 
387 387
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
388
-                $query  = 'SELECT tracker_live.* FROM tracker_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_live l WHERE l.ident = :ident AND l.date <= :date GROUP BY l.famtrackid) s on tracker_live.famtrackid = s.famtrackid AND tracker_live.date = s.maxdate ORDER BY tracker_live.date DESC';
388
+				$query  = 'SELECT tracker_live.* FROM tracker_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_live l WHERE l.ident = :ident AND l.date <= :date GROUP BY l.famtrackid) s on tracker_live.famtrackid = s.famtrackid AND tracker_live.date = s.maxdate ORDER BY tracker_live.date DESC';
389 389
 
390
-                $date = date('c',$date);
390
+				$date = date('c',$date);
391 391
 		$spotter_array = $Tracker->getDataFromDB($query,array(':ident' => $ident,':date' => $date));
392 392
 
393 393
 		return $spotter_array;
394 394
 	}
395 395
 
396
-        /**
397
-	* Gets last spotter information based on a particular callsign
398
-	*
399
-	* @return Array the spotter information
400
-	*
401
-	*/
396
+		/**
397
+		 * Gets last spotter information based on a particular callsign
398
+		 *
399
+		 * @return Array the spotter information
400
+		 *
401
+		 */
402 402
 	public function getLastLiveTrackerDataById($id)
403 403
 	{
404 404
 		$Tracker = new Tracker($this->db);
405 405
 		date_default_timezone_set('UTC');
406 406
 
407 407
 		$id = filter_var($id, FILTER_SANITIZE_STRING);
408
-                $query  = 'SELECT tracker_live.* FROM tracker_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_live l WHERE l.famtrackid = :id GROUP BY l.famtrackid) s on tracker_live.famtrackid = s.famtrackid AND tracker_live.date = s.maxdate ORDER BY tracker_live.date DESC';
408
+				$query  = 'SELECT tracker_live.* FROM tracker_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_live l WHERE l.famtrackid = :id GROUP BY l.famtrackid) s on tracker_live.famtrackid = s.famtrackid AND tracker_live.date = s.maxdate ORDER BY tracker_live.date DESC';
409 409
 
410 410
 		$spotter_array = $Tracker->getDataFromDB($query,array(':id' => $id),'',true);
411 411
 
412 412
 		return $spotter_array;
413 413
 	}
414 414
 
415
-        /**
416
-	* Gets last spotter information based on a particular callsign
417
-	*
418
-	* @return Array the spotter information
419
-	*
420
-	*/
415
+		/**
416
+		 * Gets last spotter information based on a particular callsign
417
+		 *
418
+		 * @return Array the spotter information
419
+		 *
420
+		 */
421 421
 	public function getDateLiveTrackerDataById($id,$date)
422 422
 	{
423 423
 		$Tracker = new Tracker($this->db);
424 424
 		date_default_timezone_set('UTC');
425 425
 
426 426
 		$id = filter_var($id, FILTER_SANITIZE_STRING);
427
-                $query  = 'SELECT tracker_live.* FROM tracker_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_live l WHERE l.famtrackid = :id AND l.date <= :date GROUP BY l.famtrackid) s on tracker_live.famtrackid = s.famtrackid AND tracker_live.date = s.maxdate ORDER BY tracker_live.date DESC';
428
-                $date = date('c',$date);
427
+				$query  = 'SELECT tracker_live.* FROM tracker_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_live l WHERE l.famtrackid = :id AND l.date <= :date GROUP BY l.famtrackid) s on tracker_live.famtrackid = s.famtrackid AND tracker_live.date = s.maxdate ORDER BY tracker_live.date DESC';
428
+				$date = date('c',$date);
429 429
 		$spotter_array = $Tracker->getDataFromDB($query,array(':id' => $id,':date' => $date),'',true);
430 430
 
431 431
 		return $spotter_array;
432 432
 	}
433 433
 
434
-        /**
435
-	* Gets altitude information based on a particular callsign
436
-	*
437
-	* @return Array the spotter information
438
-	*
439
-	*/
434
+		/**
435
+		 * Gets altitude information based on a particular callsign
436
+		 *
437
+		 * @return Array the spotter information
438
+		 *
439
+		 */
440 440
 	public function getAltitudeLiveTrackerDataByIdent($ident)
441 441
 	{
442 442
 
443 443
 		date_default_timezone_set('UTC');
444 444
 
445 445
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
446
-                $query  = 'SELECT tracker_live.altitude, tracker_live.date FROM tracker_live WHERE tracker_live.ident = :ident';
446
+				$query  = 'SELECT tracker_live.altitude, tracker_live.date FROM tracker_live WHERE tracker_live.ident = :ident';
447 447
 
448
-    		try {
448
+			try {
449 449
 			
450 450
 			$sth = $this->db->prepare($query);
451 451
 			$sth->execute(array(':ident' => $ident));
@@ -458,12 +458,12 @@  discard block
 block discarded – undo
458 458
 		return $spotter_array;
459 459
 	}
460 460
 
461
-        /**
462
-	* Gets all the spotter information based on a particular id
463
-	*
464
-	* @return Array the spotter information
465
-	*
466
-	*/
461
+		/**
462
+		 * Gets all the spotter information based on a particular id
463
+		 *
464
+		 * @return Array the spotter information
465
+		 *
466
+		 */
467 467
 	public function getAllLiveTrackerDataById($id,$liveinterval = false)
468 468
 	{
469 469
 		global $globalDBdriver, $globalLiveInterval;
@@ -491,18 +491,18 @@  discard block
 block discarded – undo
491 491
 		return $spotter_array;
492 492
 	}
493 493
 
494
-        /**
495
-	* Gets all the spotter information based on a particular ident
496
-	*
497
-	* @return Array the spotter information
498
-	*
499
-	*/
494
+		/**
495
+		 * Gets all the spotter information based on a particular ident
496
+		 *
497
+		 * @return Array the spotter information
498
+		 *
499
+		 */
500 500
 	public function getAllLiveTrackerDataByIdent($ident)
501 501
 	{
502 502
 		date_default_timezone_set('UTC');
503 503
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
504 504
 		$query  = self::$global_query.' WHERE tracker_live.ident = :ident';
505
-    		try {
505
+			try {
506 506
 			
507 507
 			$sth = $this->db->prepare($query);
508 508
 			$sth->execute(array(':ident' => $ident));
@@ -516,23 +516,23 @@  discard block
 block discarded – undo
516 516
 
517 517
 
518 518
 	/**
519
-	* Deletes all info in the table
520
-	*
521
-	* @return String success or false
522
-	*
523
-	*/
519
+	 * Deletes all info in the table
520
+	 *
521
+	 * @return String success or false
522
+	 *
523
+	 */
524 524
 	public function deleteLiveTrackerData()
525 525
 	{
526 526
 		global $globalDBdriver;
527 527
 		if ($globalDBdriver == 'mysql') {
528 528
 			//$query  = "DELETE FROM tracker_live WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL 30 MINUTE) >= tracker_live.date";
529 529
 			$query  = 'DELETE FROM tracker_live WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL 9 HOUR) >= tracker_live.date';
530
-            		//$query  = "DELETE FROM tracker_live WHERE tracker_live.id IN (SELECT tracker_live.id FROM tracker_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_live l GROUP BY l.famtrackid) s on tracker_live.famtrackid = s.famtrackid AND tracker_live.date = s.maxdate AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 HOUR) >= tracker_live.date)";
530
+					//$query  = "DELETE FROM tracker_live WHERE tracker_live.id IN (SELECT tracker_live.id FROM tracker_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_live l GROUP BY l.famtrackid) s on tracker_live.famtrackid = s.famtrackid AND tracker_live.date = s.maxdate AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 HOUR) >= tracker_live.date)";
531 531
 		} else {
532 532
 			$query  = "DELETE FROM tracker_live WHERE NOW() AT TIME ZONE 'UTC' - INTERVAL '9 HOURS' >= tracker_live.date";
533 533
 		}
534 534
         
535
-    		try {
535
+			try {
536 536
 			
537 537
 			$sth = $this->db->prepare($query);
538 538
 			$sth->execute();
@@ -544,18 +544,18 @@  discard block
 block discarded – undo
544 544
 	}
545 545
 
546 546
 	/**
547
-	* Deletes all info in the table for aircraft not seen since 2 HOUR
548
-	*
549
-	* @return String success or false
550
-	*
551
-	*/
547
+	 * Deletes all info in the table for aircraft not seen since 2 HOUR
548
+	 *
549
+	 * @return String success or false
550
+	 *
551
+	 */
552 552
 	public function deleteLiveTrackerDataNotUpdated()
553 553
 	{
554 554
 		global $globalDBdriver, $globalDebug;
555 555
 		if ($globalDBdriver == 'mysql') {
556 556
 			//$query = 'SELECT famtrackid FROM tracker_live WHERE DATE_SUB(UTC_TIMESTAMP(), INTERVAL 1 HOUR) >= tracker_live.date AND tracker_live.famtrackid NOT IN (SELECT famtrackid FROM tracker_live WHERE DATE_SUB(UTC_TIMESTAMP(), INTERVAL 1 HOUR) < tracker_live.date) LIMIT 800 OFFSET 0';
557
-    			$query = "SELECT tracker_live.famtrackid FROM tracker_live INNER JOIN (SELECT famtrackid,MAX(date) as max_date FROM tracker_live GROUP BY famtrackid) s ON s.famtrackid = tracker_live.famtrackid AND DATE_SUB(UTC_TIMESTAMP(), INTERVAL 2 HOUR) >= s.max_date LIMIT 1200 OFFSET 0";
558
-    			try {
557
+				$query = "SELECT tracker_live.famtrackid FROM tracker_live INNER JOIN (SELECT famtrackid,MAX(date) as max_date FROM tracker_live GROUP BY famtrackid) s ON s.famtrackid = tracker_live.famtrackid AND DATE_SUB(UTC_TIMESTAMP(), INTERVAL 2 HOUR) >= s.max_date LIMIT 1200 OFFSET 0";
558
+				try {
559 559
 				
560 560
 				$sth = $this->db->prepare($query);
561 561
 				$sth->execute();
@@ -563,8 +563,8 @@  discard block
 block discarded – undo
563 563
 				return "error";
564 564
 			}
565 565
 			$query_delete = 'DELETE FROM tracker_live WHERE famtrackid IN (';
566
-                        $i = 0;
567
-                        $j =0;
566
+						$i = 0;
567
+						$j =0;
568 568
 			$all = $sth->fetchAll(PDO::FETCH_ASSOC);
569 569
 			foreach($all as $row)
570 570
 			{
@@ -572,20 +572,20 @@  discard block
 block discarded – undo
572 572
 				$j++;
573 573
 				if ($j == 30) {
574 574
 					if ($globalDebug) echo ".";
575
-				    	try {
575
+						try {
576 576
 						
577 577
 						$sth = $this->db->prepare(substr($query_delete,0,-1).")");
578 578
 						$sth->execute();
579 579
 					} catch(PDOException $e) {
580 580
 						return "error";
581 581
 					}
582
-                                	$query_delete = 'DELETE FROM tracker_live WHERE famtrackid IN (';
583
-                                	$j = 0;
582
+									$query_delete = 'DELETE FROM tracker_live WHERE famtrackid IN (';
583
+									$j = 0;
584 584
 				}
585 585
 				$query_delete .= "'".$row['famtrackid']."',";
586 586
 			}
587 587
 			if ($i > 0) {
588
-    				try {
588
+					try {
589 589
 					
590 590
 					$sth = $this->db->prepare(substr($query_delete,0,-1).")");
591 591
 					$sth->execute();
@@ -596,9 +596,9 @@  discard block
 block discarded – undo
596 596
 			return "success";
597 597
 		} elseif ($globalDBdriver == 'pgsql') {
598 598
 			//$query = "SELECT famtrackid FROM tracker_live WHERE NOW() AT TIME ZONE 'UTC' - INTERVAL '9 HOURS' >= tracker_live.date AND tracker_live.famtrackid NOT IN (SELECT famtrackid FROM tracker_live WHERE NOW() AT TIME ZONE 'UTC' - INTERVAL '9 HOURS' < tracker_live.date) LIMIT 800 OFFSET 0";
599
-    			//$query = "SELECT tracker_live.famtrackid FROM tracker_live INNER JOIN (SELECT famtrackid,MAX(date) as max_date FROM tracker_live GROUP BY famtrackid) s ON s.famtrackid = tracker_live.famtrackid AND NOW() AT TIME ZONE 'UTC' - INTERVAL '2 HOURS' >= s.max_date LIMIT 800 OFFSET 0";
600
-    			$query = "DELETE FROM tracker_live WHERE famtrackid IN (SELECT tracker_live.famtrackid FROM tracker_live INNER JOIN (SELECT famtrackid,MAX(date) as max_date FROM tracker_live GROUP BY famtrackid) s ON s.famtrackid = tracker_live.famtrackid AND NOW() AT TIME ZONE 'UTC' - INTERVAL '2 HOURS' >= s.max_date LIMIT 800 OFFSET 0)";
601
-    			try {
599
+				//$query = "SELECT tracker_live.famtrackid FROM tracker_live INNER JOIN (SELECT famtrackid,MAX(date) as max_date FROM tracker_live GROUP BY famtrackid) s ON s.famtrackid = tracker_live.famtrackid AND NOW() AT TIME ZONE 'UTC' - INTERVAL '2 HOURS' >= s.max_date LIMIT 800 OFFSET 0";
600
+				$query = "DELETE FROM tracker_live WHERE famtrackid IN (SELECT tracker_live.famtrackid FROM tracker_live INNER JOIN (SELECT famtrackid,MAX(date) as max_date FROM tracker_live GROUP BY famtrackid) s ON s.famtrackid = tracker_live.famtrackid AND NOW() AT TIME ZONE 'UTC' - INTERVAL '2 HOURS' >= s.max_date LIMIT 800 OFFSET 0)";
601
+				try {
602 602
 				
603 603
 				$sth = $this->db->prepare($query);
604 604
 				$sth->execute();
@@ -642,17 +642,17 @@  discard block
 block discarded – undo
642 642
 	}
643 643
 
644 644
 	/**
645
-	* Deletes all info in the table for an ident
646
-	*
647
-	* @return String success or false
648
-	*
649
-	*/
645
+	 * Deletes all info in the table for an ident
646
+	 *
647
+	 * @return String success or false
648
+	 *
649
+	 */
650 650
 	public function deleteLiveTrackerDataByIdent($ident)
651 651
 	{
652 652
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
653 653
 		$query  = 'DELETE FROM tracker_live WHERE ident = :ident';
654 654
         
655
-    		try {
655
+			try {
656 656
 			
657 657
 			$sth = $this->db->prepare($query);
658 658
 			$sth->execute(array(':ident' => $ident));
@@ -664,17 +664,17 @@  discard block
 block discarded – undo
664 664
 	}
665 665
 
666 666
 	/**
667
-	* Deletes all info in the table for an id
668
-	*
669
-	* @return String success or false
670
-	*
671
-	*/
667
+	 * Deletes all info in the table for an id
668
+	 *
669
+	 * @return String success or false
670
+	 *
671
+	 */
672 672
 	public function deleteLiveTrackerDataById($id)
673 673
 	{
674 674
 		$id = filter_var($id, FILTER_SANITIZE_STRING);
675 675
 		$query  = 'DELETE FROM tracker_live WHERE famtrackid = :id';
676 676
         
677
-    		try {
677
+			try {
678 678
 			
679 679
 			$sth = $this->db->prepare($query);
680 680
 			$sth->execute(array(':id' => $id));
@@ -687,11 +687,11 @@  discard block
 block discarded – undo
687 687
 
688 688
 
689 689
 	/**
690
-	* Gets the aircraft ident within the last hour
691
-	*
692
-	* @return String the ident
693
-	*
694
-	*/
690
+	 * Gets the aircraft ident within the last hour
691
+	 *
692
+	 * @return String the ident
693
+	 *
694
+	 */
695 695
 	public function getIdentFromLastHour($ident)
696 696
 	{
697 697
 		global $globalDBdriver, $globalTimezone;
@@ -717,14 +717,14 @@  discard block
 block discarded – undo
717 717
 			$ident_result = $row['ident'];
718 718
 		}
719 719
 		return $ident_result;
720
-        }
720
+		}
721 721
 
722 722
 	/**
723
-	* Check recent aircraft
724
-	*
725
-	* @return String the ident
726
-	*
727
-	*/
723
+	 * Check recent aircraft
724
+	 *
725
+	 * @return String the ident
726
+	 *
727
+	 */
728 728
 	public function checkIdentRecent($ident)
729 729
 	{
730 730
 		global $globalDBdriver, $globalTimezone;
@@ -750,14 +750,14 @@  discard block
 block discarded – undo
750 750
 			$ident_result = $row['famtrackid'];
751 751
 		}
752 752
 		return $ident_result;
753
-        }
753
+		}
754 754
 
755 755
 	/**
756
-	* Check recent aircraft by id
757
-	*
758
-	* @return String the ident
759
-	*
760
-	*/
756
+	 * Check recent aircraft by id
757
+	 *
758
+	 * @return String the ident
759
+	 *
760
+	 */
761 761
 	public function checkIdRecent($id)
762 762
 	{
763 763
 		global $globalDBdriver, $globalTimezone;
@@ -783,19 +783,19 @@  discard block
 block discarded – undo
783 783
 			$ident_result = $row['famtrackid'];
784 784
 		}
785 785
 		return $ident_result;
786
-        }
786
+		}
787 787
 
788 788
 	/**
789
-	* Adds a new spotter data
790
-	*
791
-	* @param String $famtrackid the ID from flightaware
792
-	* @param String $ident the flight ident
793
-	* @param String $aircraft_icao the aircraft type
794
-	* @param String $departure_airport_icao the departure airport
795
-	* @param String $arrival_airport_icao the arrival airport
796
-	* @return String success or false
797
-	*
798
-	*/
789
+	 * Adds a new spotter data
790
+	 *
791
+	 * @param String $famtrackid the ID from flightaware
792
+	 * @param String $ident the flight ident
793
+	 * @param String $aircraft_icao the aircraft type
794
+	 * @param String $departure_airport_icao the departure airport
795
+	 * @param String $arrival_airport_icao the arrival airport
796
+	 * @return String success or false
797
+	 *
798
+	 */
799 799
 	public function addLiveTrackerData($famtrackid = '', $ident = '', $latitude = '', $longitude = '', $altitude = '', $heading = '', $groundspeed = '', $date = '', $putinarchive = false, $comment = '', $type = '',$noarchive = false,$format_source = '', $source_name = '', $over_country = '')
800 800
 	{
801 801
 		global $globalURL, $globalArchive, $globalDebug;
@@ -868,8 +868,8 @@  discard block
 block discarded – undo
868 868
 		$comment = filter_var($comment,FILTER_SANITIZE_STRING);
869 869
 		$type = filter_var($type,FILTER_SANITIZE_STRING);
870 870
 
871
-            	if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) $groundspeed = 0;
872
-            	if ($heading == '' || $Common->isInteger($heading) === false ) $heading = 0;
871
+				if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) $groundspeed = 0;
872
+				if ($heading == '' || $Common->isInteger($heading) === false ) $heading = 0;
873 873
             	
874 874
 		$query = '';
875 875
 		if ($globalArchive) {
@@ -884,14 +884,14 @@  discard block
 block discarded – undo
884 884
 			
885 885
 			$sth = $this->db->prepare($query);
886 886
 			$sth->execute($query_values);
887
-                } catch(PDOException $e) {
888
-                	return "error : ".$e->getMessage();
889
-                }
887
+				} catch(PDOException $e) {
888
+					return "error : ".$e->getMessage();
889
+				}
890 890
 		if (isset($globalArchive) && $globalArchive && $putinarchive && $noarchive !== true) {
891
-		    if ($globalDebug) echo '(Add to SBS archive : ';
892
-		    $TrackerArchive = new TrackerArchive($this->db);
893
-		    $result =  $TrackerArchive->addTrackerArchiveData($famtrackid, $ident,$latitude, $longitude, $altitude, $heading, $groundspeed, $date, $putinarchive, $comment, $type,$noarchive,$format_source, $source_name, $over_country);
894
-		    if ($globalDebug) echo $result.')';
891
+			if ($globalDebug) echo '(Add to SBS archive : ';
892
+			$TrackerArchive = new TrackerArchive($this->db);
893
+			$result =  $TrackerArchive->addTrackerArchiveData($famtrackid, $ident,$latitude, $longitude, $altitude, $heading, $groundspeed, $date, $putinarchive, $comment, $type,$noarchive,$format_source, $source_name, $over_country);
894
+			if ($globalDebug) echo $result.')';
895 895
 		}
896 896
 
897 897
 		return "success";
Please login to merge, or discard this patch.
Spacing   +97 added lines, -97 removed lines patch added patch discarded remove patch
@@ -16,33 +16,33 @@  discard block
 block discarded – undo
16 16
 	* @param Array $filter the filter
17 17
 	* @return Array the SQL part
18 18
 	*/
19
-	public function getFilter($filter = array(),$where = false,$and = false) {
19
+	public function getFilter($filter = array(), $where = false, $and = false) {
20 20
 		global $globalFilter, $globalStatsFilters, $globalFilterName, $globalDBdriver;
21 21
 		$filters = array();
22 22
 		if (is_array($globalStatsFilters) && isset($globalStatsFilters[$globalFilterName])) {
23 23
 			if (isset($globalStatsFilters[$globalFilterName][0]['source'])) {
24 24
 				$filters = $globalStatsFilters[$globalFilterName];
25 25
 			} else {
26
-				$filter = array_merge($filter,$globalStatsFilters[$globalFilterName]);
26
+				$filter = array_merge($filter, $globalStatsFilters[$globalFilterName]);
27 27
 			}
28 28
 		}
29 29
 		if (isset($filter[0]['source'])) {
30
-			$filters = array_merge($filters,$filter);
30
+			$filters = array_merge($filters, $filter);
31 31
 		}
32
-		if (is_array($globalFilter)) $filter = array_merge($filter,$globalFilter);
32
+		if (is_array($globalFilter)) $filter = array_merge($filter, $globalFilter);
33 33
 		$filter_query_join = '';
34 34
 		$filter_query_where = '';
35
-		foreach($filters as $flt) {
35
+		foreach ($filters as $flt) {
36 36
 			if (isset($flt['idents']) && !empty($flt['idents'])) {
37 37
 				if (isset($flt['source'])) {
38
-					$filter_query_join .= " INNER JOIN (SELECT famtrackid FROM tracker_output WHERE tracker_output.ident IN ('".implode("','",$flt['idents'])."') AND tracker_output.format_source IN ('".implode("','",$flt['source'])."')) spid ON spid.famtrackid = tracker_live.famtrackid";
38
+					$filter_query_join .= " INNER JOIN (SELECT famtrackid FROM tracker_output WHERE tracker_output.ident IN ('".implode("','", $flt['idents'])."') AND tracker_output.format_source IN ('".implode("','", $flt['source'])."')) spid ON spid.famtrackid = tracker_live.famtrackid";
39 39
 				} else {
40
-					$filter_query_join .= " INNER JOIN (SELECT famtrackid FROM tracker_output WHERE tracker_output.ident IN ('".implode("','",$flt['idents'])."')) spid ON spid.famtrackid = tracker_live.famtrackid";
40
+					$filter_query_join .= " INNER JOIN (SELECT famtrackid FROM tracker_output WHERE tracker_output.ident IN ('".implode("','", $flt['idents'])."')) spid ON spid.famtrackid = tracker_live.famtrackid";
41 41
 				}
42 42
 			}
43 43
 		}
44 44
 		if (isset($filter['source']) && !empty($filter['source'])) {
45
-			$filter_query_where .= " AND format_source IN ('".implode("','",$filter['source'])."')";
45
+			$filter_query_where .= " AND format_source IN ('".implode("','", $filter['source'])."')";
46 46
 		}
47 47
 		if (isset($filter['ident']) && !empty($filter['ident'])) {
48 48
 			$filter_query_where .= " AND ident = '".$filter['ident']."'";
@@ -71,15 +71,15 @@  discard block
 block discarded – undo
71 71
 					$filter_query_date .= " AND EXTRACT(DAY FROM tracker_output.date) = '".$filter['day']."'";
72 72
 				}
73 73
 			}
74
-			$filter_query_join .= " INNER JOIN (SELECT famtrackid FROM tracker_output".preg_replace('/^ AND/',' WHERE',$filter_query_date).") sd ON sd.famtrackid = tracker_live.famtrackid";
74
+			$filter_query_join .= " INNER JOIN (SELECT famtrackid FROM tracker_output".preg_replace('/^ AND/', ' WHERE', $filter_query_date).") sd ON sd.famtrackid = tracker_live.famtrackid";
75 75
 		}
76 76
 		if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) {
77
-			$filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')";
77
+			$filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','", $filter['source_aprs'])."')";
78 78
 		}
79 79
 		if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE';
80 80
 		elseif ($filter_query_where != '' && $and) $filter_query_where .= ' AND';
81 81
 		if ($filter_query_where != '') {
82
-			$filter_query_where = preg_replace('/^ AND/',' WHERE',$filter_query_where);
82
+			$filter_query_where = preg_replace('/^ AND/', ' WHERE', $filter_query_where);
83 83
 		}
84 84
 		$filter_query = $filter_query_join.$filter_query_where;
85 85
 		return $filter_query;
@@ -102,8 +102,8 @@  discard block
 block discarded – undo
102 102
 		if ($limit != '')
103 103
 		{
104 104
 			$limit_array = explode(',', $limit);
105
-			$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
106
-			$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
105
+			$limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
106
+			$limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
107 107
 			if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
108 108
 			{
109 109
 				$limit_query = ' LIMIT '.$limit_array[1].' OFFSET '.$limit_array[0];
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
 		} else {
127 127
 			$query  = "SELECT tracker_live.* FROM tracker_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_live l WHERE CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= l.date GROUP BY l.famtrackid) s on tracker_live.famtrackid = s.famtrackid AND tracker_live.date = s.maxdate".$filter_query.$orderby_query;
128 128
 		}
129
-		$spotter_array = $Tracker->getDataFromDB($query.$limit_query,array(),'',true);
129
+		$spotter_array = $Tracker->getDataFromDB($query.$limit_query, array(), '', true);
130 130
 
131 131
 		return $spotter_array;
132 132
 	}
@@ -142,7 +142,7 @@  discard block
 block discarded – undo
142 142
 		global $globalDBdriver, $globalLiveInterval;
143 143
 		date_default_timezone_set('UTC');
144 144
 
145
-		$filter_query = $this->getFilter($filter,true,true);
145
+		$filter_query = $this->getFilter($filter, true, true);
146 146
 
147 147
 		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
148 148
 		if ($globalDBdriver == 'mysql') {
@@ -160,7 +160,7 @@  discard block
 block discarded – undo
160 160
 		try {
161 161
 			$sth = $this->db->prepare($query);
162 162
 			$sth->execute();
163
-		} catch(PDOException $e) {
163
+		} catch (PDOException $e) {
164 164
 			echo $e->getMessage();
165 165
 			die;
166 166
 		}
@@ -180,15 +180,15 @@  discard block
 block discarded – undo
180 180
 		global $globalDBdriver, $globalLiveInterval;
181 181
 		date_default_timezone_set('UTC');
182 182
 
183
-		$filter_query = $this->getFilter($filter,true,true);
183
+		$filter_query = $this->getFilter($filter, true, true);
184 184
 
185 185
 		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
186 186
 		if ($globalDBdriver == 'mysql') {
187
-			$query  = 'SELECT tracker_live.ident, tracker_live.famtrackid,tracker_live.type, tracker_live.latitude, tracker_live.longitude, tracker_live.altitude, tracker_live.heading, tracker_live.ground_speed, tracker_live.date, tracker_live.format_source 
187
+			$query = 'SELECT tracker_live.ident, tracker_live.famtrackid,tracker_live.type, tracker_live.latitude, tracker_live.longitude, tracker_live.altitude, tracker_live.heading, tracker_live.ground_speed, tracker_live.date, tracker_live.format_source 
188 188
 			FROM tracker_live'.$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval." SECOND) <= tracker_live.date AND tracker_live.latitude <> '0' AND tracker_live.longitude <> '0' 
189 189
 			ORDER BY tracker_live.famtrackid, tracker_live.date";
190 190
                 } else {
191
-			$query  = "SELECT tracker_live.ident, tracker_live.famtrackid, tracker_live.type,tracker_live.latitude, tracker_live.longitude, tracker_live.altitude, tracker_live.heading, tracker_live.ground_speed, tracker_live.date, tracker_live.format_source 
191
+			$query = "SELECT tracker_live.ident, tracker_live.famtrackid, tracker_live.type,tracker_live.latitude, tracker_live.longitude, tracker_live.altitude, tracker_live.heading, tracker_live.ground_speed, tracker_live.date, tracker_live.format_source 
192 192
 			FROM tracker_live".$filter_query." CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= tracker_live.date AND tracker_live.latitude <> '0' AND tracker_live.longitude <> '0' 
193 193
 			ORDER BY tracker_live.famtrackid, tracker_live.date";
194 194
 		}
@@ -196,7 +196,7 @@  discard block
 block discarded – undo
196 196
     		try {
197 197
 			$sth = $this->db->prepare($query);
198 198
 			$sth->execute();
199
-		} catch(PDOException $e) {
199
+		} catch (PDOException $e) {
200 200
 			echo $e->getMessage();
201 201
 			die;
202 202
 		}
@@ -213,7 +213,7 @@  discard block
 block discarded – undo
213 213
 	public function getLiveTrackerCount($filter = array())
214 214
 	{
215 215
 		global $globalDBdriver, $globalLiveInterval;
216
-		$filter_query = $this->getFilter($filter,true,true);
216
+		$filter_query = $this->getFilter($filter, true, true);
217 217
 
218 218
 		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
219 219
 		if ($globalDBdriver == 'mysql') {
@@ -224,7 +224,7 @@  discard block
 block discarded – undo
224 224
 		try {
225 225
 			$sth = $this->db->prepare($query);
226 226
 			$sth->execute();
227
-		} catch(PDOException $e) {
227
+		} catch (PDOException $e) {
228 228
 			echo $e->getMessage();
229 229
 			die;
230 230
 		}
@@ -247,10 +247,10 @@  discard block
 block discarded – undo
247 247
 		$filter_query = $this->getFilter($filter);
248 248
 
249 249
 		if (is_array($coord)) {
250
-			$minlong = filter_var($coord[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
251
-			$minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
252
-			$maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
253
-			$maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
250
+			$minlong = filter_var($coord[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
251
+			$minlat = filter_var($coord[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
252
+			$maxlong = filter_var($coord[2], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
253
+			$maxlat = filter_var($coord[3], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
254 254
 		} else return array();
255 255
 		if ($globalDBdriver == 'mysql') {
256 256
 			$query  = 'SELECT tracker_live.* FROM tracker_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.famtrackid) s on tracker_live.famtrackid = s.famtrackid AND tracker_live.date = s.maxdate AND tracker_live.latitude BETWEEN '.$minlat.' AND '.$maxlat.' AND tracker_live.longitude BETWEEN '.$minlong.' AND '.$maxlong.' GROUP BY tracker_live.famtrackid'.$filter_query;
@@ -275,17 +275,17 @@  discard block
 block discarded – undo
275 275
 		$filter_query = $this->getFilter($filter);
276 276
 
277 277
 		if (is_array($coord)) {
278
-			$minlong = filter_var($coord[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
279
-			$minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
280
-			$maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
281
-			$maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
278
+			$minlong = filter_var($coord[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
279
+			$minlat = filter_var($coord[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
280
+			$maxlong = filter_var($coord[2], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
281
+			$maxlat = filter_var($coord[3], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
282 282
 		} else return array();
283 283
 		if ($globalDBdriver == 'mysql') {
284 284
 			$query  = 'SELECT tracker_live.ident, tracker_live.famtrackid,tracker_live.type, tracker_live.latitude, tracker_live.longitude, tracker_live.altitude, tracker_live.heading, tracker_live.ground_speed, tracker_live.date, tracker_live.format_source 
285 285
 			FROM tracker_live'.$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval." SECOND) <= tracker_live.date AND tracker_live.latitude <> '0' AND tracker_live.longitude <> '0' AND tracker_live.latitude BETWEEN ".$minlat.' AND '.$maxlat.' AND tracker_live.longitude BETWEEN '.$minlong.' AND '.$maxlong."
286 286
 			ORDER BY tracker_live.famtrackid, tracker_live.date";
287 287
 		} else {
288
-			$query  = "SELECT tracker_live.ident, tracker_live.type,tracker_live.famtrackid, tracker_live.latitude, tracker_live.longitude, tracker_live.altitude, tracker_live.heading, tracker_live.ground_speed, tracker_live.date, tracker_live.format_source 
288
+			$query = "SELECT tracker_live.ident, tracker_live.type,tracker_live.famtrackid, tracker_live.latitude, tracker_live.longitude, tracker_live.altitude, tracker_live.heading, tracker_live.ground_speed, tracker_live.date, tracker_live.format_source 
289 289
 			FROM tracker_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_live l WHERE CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= l.date l.latitude BETWEEN ".$minlat." AND ".$maxlat." AND l.longitude BETWEEN ".$minlong." AND ".$maxlong." GROUP BY l.famtrackid) s on tracker_live.famtrackid = s.famtrackid AND tracker_live.date = s.maxdate".$filter_query." tracker_live.latitude <> '0' AND tracker_live.longitude <> '0'";
290 290
 		}
291 291
 		$spotter_array = $Spotter->getDataFromDB($query);
@@ -333,7 +333,7 @@  discard block
 block discarded – undo
333 333
                 if ($interval == '1m')
334 334
                 {
335 335
                     $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= tracker_live.date ';
336
-                } else if ($interval == '15m'){
336
+                } else if ($interval == '15m') {
337 337
                     $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 15 MINUTE) <= tracker_live.date ';
338 338
                 } 
339 339
             }
@@ -341,14 +341,14 @@  discard block
 block discarded – undo
341 341
          $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= tracker_live.date ';   
342 342
         }
343 343
 
344
-                $query  = "SELECT tracker_live.*, ( 6371 * acos( cos( radians(:lat) ) * cos( radians( latitude ) ) * cos( radians( longitude ) - radians(:lng) ) + sin( radians(:lat) ) * sin( radians( latitude ) ) ) ) AS distance FROM tracker_live 
344
+                $query = "SELECT tracker_live.*, ( 6371 * acos( cos( radians(:lat) ) * cos( radians( latitude ) ) * cos( radians( longitude ) - radians(:lng) ) + sin( radians(:lat) ) * sin( radians( latitude ) ) ) ) AS distance FROM tracker_live 
345 345
                    WHERE tracker_live.latitude <> '' 
346 346
                                    AND tracker_live.longitude <> '' 
347 347
                    ".$additional_query."
348 348
                    HAVING distance < :radius  
349 349
                                    ORDER BY distance";
350 350
 
351
-                $spotter_array = $Tracker->getDataFromDB($query, array(':lat' => $lat, ':lng' => $lng,':radius' => $radius));
351
+                $spotter_array = $Tracker->getDataFromDB($query, array(':lat' => $lat, ':lng' => $lng, ':radius' => $radius));
352 352
 
353 353
                 return $spotter_array;
354 354
         }
@@ -366,9 +366,9 @@  discard block
 block discarded – undo
366 366
 		date_default_timezone_set('UTC');
367 367
 
368 368
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
369
-                $query  = 'SELECT tracker_live.* FROM tracker_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_live l WHERE l.ident = :ident GROUP BY l.famtrackid) s on tracker_live.famtrackid = s.famtrackid AND tracker_live.date = s.maxdate ORDER BY tracker_live.date DESC';
369
+                $query = 'SELECT tracker_live.* FROM tracker_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_live l WHERE l.ident = :ident GROUP BY l.famtrackid) s on tracker_live.famtrackid = s.famtrackid AND tracker_live.date = s.maxdate ORDER BY tracker_live.date DESC';
370 370
 
371
-		$spotter_array = $Tracker->getDataFromDB($query,array(':ident' => $ident),'',true);
371
+		$spotter_array = $Tracker->getDataFromDB($query, array(':ident' => $ident), '', true);
372 372
 
373 373
 		return $spotter_array;
374 374
 	}
@@ -379,16 +379,16 @@  discard block
 block discarded – undo
379 379
 	* @return Array the spotter information
380 380
 	*
381 381
 	*/
382
-	public function getDateLiveTrackerDataByIdent($ident,$date)
382
+	public function getDateLiveTrackerDataByIdent($ident, $date)
383 383
 	{
384 384
 		$Tracker = new Tracker($this->db);
385 385
 		date_default_timezone_set('UTC');
386 386
 
387 387
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
388
-                $query  = 'SELECT tracker_live.* FROM tracker_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_live l WHERE l.ident = :ident AND l.date <= :date GROUP BY l.famtrackid) s on tracker_live.famtrackid = s.famtrackid AND tracker_live.date = s.maxdate ORDER BY tracker_live.date DESC';
388
+                $query = 'SELECT tracker_live.* FROM tracker_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_live l WHERE l.ident = :ident AND l.date <= :date GROUP BY l.famtrackid) s on tracker_live.famtrackid = s.famtrackid AND tracker_live.date = s.maxdate ORDER BY tracker_live.date DESC';
389 389
 
390
-                $date = date('c',$date);
391
-		$spotter_array = $Tracker->getDataFromDB($query,array(':ident' => $ident,':date' => $date));
390
+                $date = date('c', $date);
391
+		$spotter_array = $Tracker->getDataFromDB($query, array(':ident' => $ident, ':date' => $date));
392 392
 
393 393
 		return $spotter_array;
394 394
 	}
@@ -405,9 +405,9 @@  discard block
 block discarded – undo
405 405
 		date_default_timezone_set('UTC');
406 406
 
407 407
 		$id = filter_var($id, FILTER_SANITIZE_STRING);
408
-                $query  = 'SELECT tracker_live.* FROM tracker_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_live l WHERE l.famtrackid = :id GROUP BY l.famtrackid) s on tracker_live.famtrackid = s.famtrackid AND tracker_live.date = s.maxdate ORDER BY tracker_live.date DESC';
408
+                $query = 'SELECT tracker_live.* FROM tracker_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_live l WHERE l.famtrackid = :id GROUP BY l.famtrackid) s on tracker_live.famtrackid = s.famtrackid AND tracker_live.date = s.maxdate ORDER BY tracker_live.date DESC';
409 409
 
410
-		$spotter_array = $Tracker->getDataFromDB($query,array(':id' => $id),'',true);
410
+		$spotter_array = $Tracker->getDataFromDB($query, array(':id' => $id), '', true);
411 411
 
412 412
 		return $spotter_array;
413 413
 	}
@@ -418,15 +418,15 @@  discard block
 block discarded – undo
418 418
 	* @return Array the spotter information
419 419
 	*
420 420
 	*/
421
-	public function getDateLiveTrackerDataById($id,$date)
421
+	public function getDateLiveTrackerDataById($id, $date)
422 422
 	{
423 423
 		$Tracker = new Tracker($this->db);
424 424
 		date_default_timezone_set('UTC');
425 425
 
426 426
 		$id = filter_var($id, FILTER_SANITIZE_STRING);
427
-                $query  = 'SELECT tracker_live.* FROM tracker_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_live l WHERE l.famtrackid = :id AND l.date <= :date GROUP BY l.famtrackid) s on tracker_live.famtrackid = s.famtrackid AND tracker_live.date = s.maxdate ORDER BY tracker_live.date DESC';
428
-                $date = date('c',$date);
429
-		$spotter_array = $Tracker->getDataFromDB($query,array(':id' => $id,':date' => $date),'',true);
427
+                $query = 'SELECT tracker_live.* FROM tracker_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_live l WHERE l.famtrackid = :id AND l.date <= :date GROUP BY l.famtrackid) s on tracker_live.famtrackid = s.famtrackid AND tracker_live.date = s.maxdate ORDER BY tracker_live.date DESC';
428
+                $date = date('c', $date);
429
+		$spotter_array = $Tracker->getDataFromDB($query, array(':id' => $id, ':date' => $date), '', true);
430 430
 
431 431
 		return $spotter_array;
432 432
 	}
@@ -443,13 +443,13 @@  discard block
 block discarded – undo
443 443
 		date_default_timezone_set('UTC');
444 444
 
445 445
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
446
-                $query  = 'SELECT tracker_live.altitude, tracker_live.date FROM tracker_live WHERE tracker_live.ident = :ident';
446
+                $query = 'SELECT tracker_live.altitude, tracker_live.date FROM tracker_live WHERE tracker_live.ident = :ident';
447 447
 
448 448
     		try {
449 449
 			
450 450
 			$sth = $this->db->prepare($query);
451 451
 			$sth->execute(array(':ident' => $ident));
452
-		} catch(PDOException $e) {
452
+		} catch (PDOException $e) {
453 453
 			echo $e->getMessage();
454 454
 			die;
455 455
 		}
@@ -464,7 +464,7 @@  discard block
 block discarded – undo
464 464
 	* @return Array the spotter information
465 465
 	*
466 466
 	*/
467
-	public function getAllLiveTrackerDataById($id,$liveinterval = false)
467
+	public function getAllLiveTrackerDataById($id, $liveinterval = false)
468 468
 	{
469 469
 		global $globalDBdriver, $globalLiveInterval;
470 470
 		date_default_timezone_set('UTC');
@@ -483,7 +483,7 @@  discard block
 block discarded – undo
483 483
 		try {
484 484
 			$sth = $this->db->prepare($query);
485 485
 			$sth->execute(array(':id' => $id));
486
-		} catch(PDOException $e) {
486
+		} catch (PDOException $e) {
487 487
 			echo $e->getMessage();
488 488
 			die;
489 489
 		}
@@ -501,12 +501,12 @@  discard block
 block discarded – undo
501 501
 	{
502 502
 		date_default_timezone_set('UTC');
503 503
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
504
-		$query  = self::$global_query.' WHERE tracker_live.ident = :ident';
504
+		$query = self::$global_query.' WHERE tracker_live.ident = :ident';
505 505
     		try {
506 506
 			
507 507
 			$sth = $this->db->prepare($query);
508 508
 			$sth->execute(array(':ident' => $ident));
509
-		} catch(PDOException $e) {
509
+		} catch (PDOException $e) {
510 510
 			echo $e->getMessage();
511 511
 			die;
512 512
 		}
@@ -536,7 +536,7 @@  discard block
 block discarded – undo
536 536
 			
537 537
 			$sth = $this->db->prepare($query);
538 538
 			$sth->execute();
539
-		} catch(PDOException $e) {
539
+		} catch (PDOException $e) {
540 540
 			return "error";
541 541
 		}
542 542
 
@@ -559,14 +559,14 @@  discard block
 block discarded – undo
559 559
 				
560 560
 				$sth = $this->db->prepare($query);
561 561
 				$sth->execute();
562
-			} catch(PDOException $e) {
562
+			} catch (PDOException $e) {
563 563
 				return "error";
564 564
 			}
565 565
 			$query_delete = 'DELETE FROM tracker_live WHERE famtrackid IN (';
566 566
                         $i = 0;
567
-                        $j =0;
567
+                        $j = 0;
568 568
 			$all = $sth->fetchAll(PDO::FETCH_ASSOC);
569
-			foreach($all as $row)
569
+			foreach ($all as $row)
570 570
 			{
571 571
 				$i++;
572 572
 				$j++;
@@ -574,9 +574,9 @@  discard block
 block discarded – undo
574 574
 					if ($globalDebug) echo ".";
575 575
 				    	try {
576 576
 						
577
-						$sth = $this->db->prepare(substr($query_delete,0,-1).")");
577
+						$sth = $this->db->prepare(substr($query_delete, 0, -1).")");
578 578
 						$sth->execute();
579
-					} catch(PDOException $e) {
579
+					} catch (PDOException $e) {
580 580
 						return "error";
581 581
 					}
582 582
                                 	$query_delete = 'DELETE FROM tracker_live WHERE famtrackid IN (';
@@ -587,9 +587,9 @@  discard block
 block discarded – undo
587 587
 			if ($i > 0) {
588 588
     				try {
589 589
 					
590
-					$sth = $this->db->prepare(substr($query_delete,0,-1).")");
590
+					$sth = $this->db->prepare(substr($query_delete, 0, -1).")");
591 591
 					$sth->execute();
592
-				} catch(PDOException $e) {
592
+				} catch (PDOException $e) {
593 593
 					return "error";
594 594
 				}
595 595
 			}
@@ -602,7 +602,7 @@  discard block
 block discarded – undo
602 602
 				
603 603
 				$sth = $this->db->prepare($query);
604 604
 				$sth->execute();
605
-			} catch(PDOException $e) {
605
+			} catch (PDOException $e) {
606 606
 				return "error";
607 607
 			}
608 608
 /*			$query_delete = "DELETE FROM tracker_live WHERE famtrackid IN (";
@@ -650,13 +650,13 @@  discard block
 block discarded – undo
650 650
 	public function deleteLiveTrackerDataByIdent($ident)
651 651
 	{
652 652
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
653
-		$query  = 'DELETE FROM tracker_live WHERE ident = :ident';
653
+		$query = 'DELETE FROM tracker_live WHERE ident = :ident';
654 654
         
655 655
     		try {
656 656
 			
657 657
 			$sth = $this->db->prepare($query);
658 658
 			$sth->execute(array(':ident' => $ident));
659
-		} catch(PDOException $e) {
659
+		} catch (PDOException $e) {
660 660
 			return "error";
661 661
 		}
662 662
 
@@ -672,13 +672,13 @@  discard block
 block discarded – undo
672 672
 	public function deleteLiveTrackerDataById($id)
673 673
 	{
674 674
 		$id = filter_var($id, FILTER_SANITIZE_STRING);
675
-		$query  = 'DELETE FROM tracker_live WHERE famtrackid = :id';
675
+		$query = 'DELETE FROM tracker_live WHERE famtrackid = :id';
676 676
         
677 677
     		try {
678 678
 			
679 679
 			$sth = $this->db->prepare($query);
680 680
 			$sth->execute(array(':id' => $id));
681
-		} catch(PDOException $e) {
681
+		} catch (PDOException $e) {
682 682
 			return "error";
683 683
 		}
684 684
 
@@ -696,13 +696,13 @@  discard block
 block discarded – undo
696 696
 	{
697 697
 		global $globalDBdriver, $globalTimezone;
698 698
 		if ($globalDBdriver == 'mysql') {
699
-			$query  = 'SELECT tracker_live.ident FROM tracker_live 
699
+			$query = 'SELECT tracker_live.ident FROM tracker_live 
700 700
 				WHERE tracker_live.ident = :ident 
701 701
 				AND tracker_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 HOUR) 
702 702
 				AND tracker_live.date < UTC_TIMESTAMP()';
703 703
 			$query_data = array(':ident' => $ident);
704 704
 		} else {
705
-			$query  = "SELECT tracker_live.ident FROM tracker_live 
705
+			$query = "SELECT tracker_live.ident FROM tracker_live 
706 706
 				WHERE tracker_live.ident = :ident 
707 707
 				AND tracker_live.date >= now() AT TIME ZONE 'UTC' - INTERVAL '1 HOURS'
708 708
 				AND tracker_live.date < now() AT TIME ZONE 'UTC'";
@@ -711,8 +711,8 @@  discard block
 block discarded – undo
711 711
 		
712 712
 		$sth = $this->db->prepare($query);
713 713
 		$sth->execute($query_data);
714
-		$ident_result='';
715
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
714
+		$ident_result = '';
715
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
716 716
 		{
717 717
 			$ident_result = $row['ident'];
718 718
 		}
@@ -729,13 +729,13 @@  discard block
 block discarded – undo
729 729
 	{
730 730
 		global $globalDBdriver, $globalTimezone;
731 731
 		if ($globalDBdriver == 'mysql') {
732
-			$query  = 'SELECT tracker_live.ident, tracker_live.famtrackid FROM tracker_live 
732
+			$query = 'SELECT tracker_live.ident, tracker_live.famtrackid FROM tracker_live 
733 733
 				WHERE tracker_live.ident = :ident 
734 734
 				AND tracker_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 30 MINUTE)'; 
735 735
 //				AND tracker_live.date < UTC_TIMESTAMP()";
736 736
 			$query_data = array(':ident' => $ident);
737 737
 		} else {
738
-			$query  = "SELECT tracker_live.ident, tracker_live.famtrackid FROM tracker_live 
738
+			$query = "SELECT tracker_live.ident, tracker_live.famtrackid FROM tracker_live 
739 739
 				WHERE tracker_live.ident = :ident 
740 740
 				AND tracker_live.date >= now() AT TIME ZONE 'UTC' - INTERVAL '30 MINUTES'";
741 741
 //				AND tracker_live.date < now() AT TIME ZONE 'UTC'";
@@ -744,8 +744,8 @@  discard block
 block discarded – undo
744 744
 		
745 745
 		$sth = $this->db->prepare($query);
746 746
 		$sth->execute($query_data);
747
-		$ident_result='';
748
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
747
+		$ident_result = '';
748
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
749 749
 		{
750 750
 			$ident_result = $row['famtrackid'];
751 751
 		}
@@ -762,13 +762,13 @@  discard block
 block discarded – undo
762 762
 	{
763 763
 		global $globalDBdriver, $globalTimezone;
764 764
 		if ($globalDBdriver == 'mysql') {
765
-			$query  = 'SELECT tracker_live.ident, tracker_live.famtrackid FROM tracker_live 
765
+			$query = 'SELECT tracker_live.ident, tracker_live.famtrackid FROM tracker_live 
766 766
 				WHERE tracker_live.famtrackid = :id 
767 767
 				AND tracker_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 10 HOUR)'; 
768 768
 //				AND tracker_live.date < UTC_TIMESTAMP()";
769 769
 			$query_data = array(':id' => $id);
770 770
 		} else {
771
-			$query  = "SELECT tracker_live.ident, tracker_live.famtrackid FROM tracker_live 
771
+			$query = "SELECT tracker_live.ident, tracker_live.famtrackid FROM tracker_live 
772 772
 				WHERE tracker_live.famtrackid = :id 
773 773
 				AND tracker_live.date >= now() AT TIME ZONE 'UTC' - INTERVAL '10 HOUR'";
774 774
 //				AND tracker_live.date < now() AT TIME ZONE 'UTC'";
@@ -777,8 +777,8 @@  discard block
 block discarded – undo
777 777
 		
778 778
 		$sth = $this->db->prepare($query);
779 779
 		$sth->execute($query_data);
780
-		$ident_result='';
781
-		while($row = $sth->fetch(PDO::FETCH_ASSOC))
780
+		$ident_result = '';
781
+		while ($row = $sth->fetch(PDO::FETCH_ASSOC))
782 782
 		{
783 783
 			$ident_result = $row['famtrackid'];
784 784
 		}
@@ -796,7 +796,7 @@  discard block
 block discarded – undo
796 796
 	* @return String success or false
797 797
 	*
798 798
 	*/
799
-	public function addLiveTrackerData($famtrackid = '', $ident = '', $latitude = '', $longitude = '', $altitude = '', $heading = '', $groundspeed = '', $date = '', $putinarchive = false, $comment = '', $type = '',$noarchive = false,$format_source = '', $source_name = '', $over_country = '')
799
+	public function addLiveTrackerData($famtrackid = '', $ident = '', $latitude = '', $longitude = '', $altitude = '', $heading = '', $groundspeed = '', $date = '', $putinarchive = false, $comment = '', $type = '', $noarchive = false, $format_source = '', $source_name = '', $over_country = '')
800 800
 	{
801 801
 		global $globalURL, $globalArchive, $globalDebug;
802 802
 		$Common = new Common();
@@ -855,21 +855,21 @@  discard block
 block discarded – undo
855 855
 		if ($date == '') $date = date("Y-m-d H:i:s", time());
856 856
 
857 857
         
858
-		$famtrackid = filter_var($famtrackid,FILTER_SANITIZE_STRING);
859
-		$ident = filter_var($ident,FILTER_SANITIZE_STRING);
860
-		$latitude = filter_var($latitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
861
-		$longitude = filter_var($longitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
862
-		$altitude = filter_var($altitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
863
-		$heading = filter_var($heading,FILTER_SANITIZE_NUMBER_INT);
864
-		$groundspeed = filter_var($groundspeed,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
865
-		$format_source = filter_var($format_source,FILTER_SANITIZE_STRING);
866
-		$source_name = filter_var($source_name,FILTER_SANITIZE_STRING);
867
-		$over_country = filter_var($over_country,FILTER_SANITIZE_STRING);
868
-		$comment = filter_var($comment,FILTER_SANITIZE_STRING);
869
-		$type = filter_var($type,FILTER_SANITIZE_STRING);
870
-
871
-            	if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) $groundspeed = 0;
872
-            	if ($heading == '' || $Common->isInteger($heading) === false ) $heading = 0;
858
+		$famtrackid = filter_var($famtrackid, FILTER_SANITIZE_STRING);
859
+		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
860
+		$latitude = filter_var($latitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
861
+		$longitude = filter_var($longitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
862
+		$altitude = filter_var($altitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
863
+		$heading = filter_var($heading, FILTER_SANITIZE_NUMBER_INT);
864
+		$groundspeed = filter_var($groundspeed, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
865
+		$format_source = filter_var($format_source, FILTER_SANITIZE_STRING);
866
+		$source_name = filter_var($source_name, FILTER_SANITIZE_STRING);
867
+		$over_country = filter_var($over_country, FILTER_SANITIZE_STRING);
868
+		$comment = filter_var($comment, FILTER_SANITIZE_STRING);
869
+		$type = filter_var($type, FILTER_SANITIZE_STRING);
870
+
871
+            	if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0;
872
+            	if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0;
873 873
             	
874 874
 		$query = '';
875 875
 		if ($globalArchive) {
@@ -879,18 +879,18 @@  discard block
 block discarded – undo
879 879
 		$query  .= 'INSERT INTO tracker_live (famtrackid, ident, latitude, longitude, altitude, heading, ground_speed, date, format_source, source_name, over_country, comment, type) 
880 880
 		VALUES (:famtrackid,:ident,:latitude,:longitude,:altitude,:heading,:groundspeed,:date,:format_source, :source_name, :over_country,:comment,:type)';
881 881
 
882
-		$query_values = array(':famtrackid' => $famtrackid,':ident' => $ident,':latitude' => $latitude,':longitude' => $longitude,':altitude' => $altitude,':heading' => $heading,':groundspeed' => $groundspeed,':date' => $date, ':format_source' => $format_source, ':source_name' => $source_name, ':over_country' => $over_country,':comment' => $comment,':type' => $type);
882
+		$query_values = array(':famtrackid' => $famtrackid, ':ident' => $ident, ':latitude' => $latitude, ':longitude' => $longitude, ':altitude' => $altitude, ':heading' => $heading, ':groundspeed' => $groundspeed, ':date' => $date, ':format_source' => $format_source, ':source_name' => $source_name, ':over_country' => $over_country, ':comment' => $comment, ':type' => $type);
883 883
 		try {
884 884
 			
885 885
 			$sth = $this->db->prepare($query);
886 886
 			$sth->execute($query_values);
887
-                } catch(PDOException $e) {
887
+                } catch (PDOException $e) {
888 888
                 	return "error : ".$e->getMessage();
889 889
                 }
890 890
 		if (isset($globalArchive) && $globalArchive && $putinarchive && $noarchive !== true) {
891 891
 		    if ($globalDebug) echo '(Add to SBS archive : ';
892 892
 		    $TrackerArchive = new TrackerArchive($this->db);
893
-		    $result =  $TrackerArchive->addTrackerArchiveData($famtrackid, $ident,$latitude, $longitude, $altitude, $heading, $groundspeed, $date, $putinarchive, $comment, $type,$noarchive,$format_source, $source_name, $over_country);
893
+		    $result = $TrackerArchive->addTrackerArchiveData($famtrackid, $ident, $latitude, $longitude, $altitude, $heading, $groundspeed, $date, $putinarchive, $comment, $type, $noarchive, $format_source, $source_name, $over_country);
894 894
 		    if ($globalDebug) echo $result.')';
895 895
 		}
896 896
 
@@ -900,7 +900,7 @@  discard block
 block discarded – undo
900 900
 
901 901
 	public function getOrderBy()
902 902
 	{
903
-		$orderby = array("aircraft_asc" => array("key" => "aircraft_asc", "value" => "Aircraft Type - ASC", "sql" => "ORDER BY tracker_live.aircraft_icao ASC"), "aircraft_desc" => array("key" => "aircraft_desc", "value" => "Aircraft Type - DESC", "sql" => "ORDER BY tracker_live.aircraft_icao DESC"),"manufacturer_asc" => array("key" => "manufacturer_asc", "value" => "Aircraft Manufacturer - ASC", "sql" => "ORDER BY tracker_live.aircraft_manufacturer ASC"), "manufacturer_desc" => array("key" => "manufacturer_desc", "value" => "Aircraft Manufacturer - DESC", "sql" => "ORDER BY tracker_live.aircraft_manufacturer DESC"),"airline_name_asc" => array("key" => "airline_name_asc", "value" => "Airline Name - ASC", "sql" => "ORDER BY tracker_live.airline_name ASC"), "airline_name_desc" => array("key" => "airline_name_desc", "value" => "Airline Name - DESC", "sql" => "ORDER BY tracker_live.airline_name DESC"), "ident_asc" => array("key" => "ident_asc", "value" => "Ident - ASC", "sql" => "ORDER BY tracker_live.ident ASC"), "ident_desc" => array("key" => "ident_desc", "value" => "Ident - DESC", "sql" => "ORDER BY tracker_live.ident DESC"), "airport_departure_asc" => array("key" => "airport_departure_asc", "value" => "Departure Airport - ASC", "sql" => "ORDER BY tracker_live.departure_airport_city ASC"), "airport_departure_desc" => array("key" => "airport_departure_desc", "value" => "Departure Airport - DESC", "sql" => "ORDER BY tracker_live.departure_airport_city DESC"), "airport_arrival_asc" => array("key" => "airport_arrival_asc", "value" => "Arrival Airport - ASC", "sql" => "ORDER BY tracker_live.arrival_airport_city ASC"), "airport_arrival_desc" => array("key" => "airport_arrival_desc", "value" => "Arrival Airport - DESC", "sql" => "ORDER BY tracker_live.arrival_airport_city DESC"), "date_asc" => array("key" => "date_asc", "value" => "Date - ASC", "sql" => "ORDER BY tracker_live.date ASC"), "date_desc" => array("key" => "date_desc", "value" => "Date - DESC", "sql" => "ORDER BY tracker_live.date DESC"));
903
+		$orderby = array("aircraft_asc" => array("key" => "aircraft_asc", "value" => "Aircraft Type - ASC", "sql" => "ORDER BY tracker_live.aircraft_icao ASC"), "aircraft_desc" => array("key" => "aircraft_desc", "value" => "Aircraft Type - DESC", "sql" => "ORDER BY tracker_live.aircraft_icao DESC"), "manufacturer_asc" => array("key" => "manufacturer_asc", "value" => "Aircraft Manufacturer - ASC", "sql" => "ORDER BY tracker_live.aircraft_manufacturer ASC"), "manufacturer_desc" => array("key" => "manufacturer_desc", "value" => "Aircraft Manufacturer - DESC", "sql" => "ORDER BY tracker_live.aircraft_manufacturer DESC"), "airline_name_asc" => array("key" => "airline_name_asc", "value" => "Airline Name - ASC", "sql" => "ORDER BY tracker_live.airline_name ASC"), "airline_name_desc" => array("key" => "airline_name_desc", "value" => "Airline Name - DESC", "sql" => "ORDER BY tracker_live.airline_name DESC"), "ident_asc" => array("key" => "ident_asc", "value" => "Ident - ASC", "sql" => "ORDER BY tracker_live.ident ASC"), "ident_desc" => array("key" => "ident_desc", "value" => "Ident - DESC", "sql" => "ORDER BY tracker_live.ident DESC"), "airport_departure_asc" => array("key" => "airport_departure_asc", "value" => "Departure Airport - ASC", "sql" => "ORDER BY tracker_live.departure_airport_city ASC"), "airport_departure_desc" => array("key" => "airport_departure_desc", "value" => "Departure Airport - DESC", "sql" => "ORDER BY tracker_live.departure_airport_city DESC"), "airport_arrival_asc" => array("key" => "airport_arrival_asc", "value" => "Arrival Airport - ASC", "sql" => "ORDER BY tracker_live.arrival_airport_city ASC"), "airport_arrival_desc" => array("key" => "airport_arrival_desc", "value" => "Arrival Airport - DESC", "sql" => "ORDER BY tracker_live.arrival_airport_city DESC"), "date_asc" => array("key" => "date_asc", "value" => "Date - ASC", "sql" => "ORDER BY tracker_live.date ASC"), "date_desc" => array("key" => "date_desc", "value" => "Date - DESC", "sql" => "ORDER BY tracker_live.date DESC"));
904 904
 		return $orderby;
905 905
 	}
906 906
 
Please login to merge, or discard this patch.
Braces   +74 added lines, -25 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
 		}
@@ -119,7 +124,9 @@  discard block
 block discarded – undo
119 124
 			}
120 125
 		}
121 126
 
122
-		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
127
+		if (!isset($globalLiveInterval)) {
128
+			$globalLiveInterval = '200';
129
+		}
123 130
 		if ($globalDBdriver == 'mysql') {
124 131
 			//$query  = "SELECT tracker_live.* FROM tracker_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL 30 SECOND) <= l.date GROUP BY l.famtrackid) s on tracker_live.famtrackid = s.famtrackid AND tracker_live.date = s.maxdate";
125 132
 			$query  = 'SELECT tracker_live.* FROM tracker_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.famtrackid) s on tracker_live.famtrackid = s.famtrackid AND tracker_live.date = s.maxdate'.$filter_query.$orderby_query;
@@ -144,7 +151,9 @@  discard block
 block discarded – undo
144 151
 
145 152
 		$filter_query = $this->getFilter($filter,true,true);
146 153
 
147
-		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
154
+		if (!isset($globalLiveInterval)) {
155
+			$globalLiveInterval = '200';
156
+		}
148 157
 		if ($globalDBdriver == 'mysql') {
149 158
 			$query  = 'SELECT tracker_live.ident, tracker_live.type,tracker_live.famtrackid, tracker_live.latitude, tracker_live.longitude, tracker_live.altitude, tracker_live.heading, tracker_live.ground_speed, tracker_live.date, tracker_live.format_source 
150 159
 			FROM tracker_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.famtrackid) s on tracker_live.famtrackid = s.famtrackid AND tracker_live.date = s.maxdate'.$filter_query." tracker_live.latitude <> 0 AND tracker_live.longitude <> 0";
@@ -182,7 +191,9 @@  discard block
 block discarded – undo
182 191
 
183 192
 		$filter_query = $this->getFilter($filter,true,true);
184 193
 
185
-		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
194
+		if (!isset($globalLiveInterval)) {
195
+			$globalLiveInterval = '200';
196
+		}
186 197
 		if ($globalDBdriver == 'mysql') {
187 198
 			$query  = 'SELECT tracker_live.ident, tracker_live.famtrackid,tracker_live.type, tracker_live.latitude, tracker_live.longitude, tracker_live.altitude, tracker_live.heading, tracker_live.ground_speed, tracker_live.date, tracker_live.format_source 
188 199
 			FROM tracker_live'.$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval." SECOND) <= tracker_live.date AND tracker_live.latitude <> '0' AND tracker_live.longitude <> '0' 
@@ -215,7 +226,9 @@  discard block
 block discarded – undo
215 226
 		global $globalDBdriver, $globalLiveInterval;
216 227
 		$filter_query = $this->getFilter($filter,true,true);
217 228
 
218
-		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
229
+		if (!isset($globalLiveInterval)) {
230
+			$globalLiveInterval = '200';
231
+		}
219 232
 		if ($globalDBdriver == 'mysql') {
220 233
 			$query = 'SELECT COUNT(DISTINCT tracker_live.famtrackid) as nb FROM tracker_live'.$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= date';
221 234
 		} else {
@@ -243,7 +256,9 @@  discard block
 block discarded – undo
243 256
 	{
244 257
 		global $globalDBdriver, $globalLiveInterval;
245 258
 		$Spotter = new Spotter($this->db);
246
-		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
259
+		if (!isset($globalLiveInterval)) {
260
+			$globalLiveInterval = '200';
261
+		}
247 262
 		$filter_query = $this->getFilter($filter);
248 263
 
249 264
 		if (is_array($coord)) {
@@ -251,7 +266,9 @@  discard block
 block discarded – undo
251 266
 			$minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
252 267
 			$maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
253 268
 			$maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
254
-		} else return array();
269
+		} else {
270
+			return array();
271
+		}
255 272
 		if ($globalDBdriver == 'mysql') {
256 273
 			$query  = 'SELECT tracker_live.* FROM tracker_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.famtrackid) s on tracker_live.famtrackid = s.famtrackid AND tracker_live.date = s.maxdate AND tracker_live.latitude BETWEEN '.$minlat.' AND '.$maxlat.' AND tracker_live.longitude BETWEEN '.$minlong.' AND '.$maxlong.' GROUP BY tracker_live.famtrackid'.$filter_query;
257 274
 		} else {
@@ -271,7 +288,9 @@  discard block
 block discarded – undo
271 288
 	{
272 289
 		global $globalDBdriver, $globalLiveInterval;
273 290
 		$Spotter = new Spotter($this->db);
274
-		if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
291
+		if (!isset($globalLiveInterval)) {
292
+			$globalLiveInterval = '200';
293
+		}
275 294
 		$filter_query = $this->getFilter($filter);
276 295
 
277 296
 		if (is_array($coord)) {
@@ -279,7 +298,9 @@  discard block
 block discarded – undo
279 298
 			$minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
280 299
 			$maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
281 300
 			$maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
282
-		} else return array();
301
+		} else {
302
+			return array();
303
+		}
283 304
 		if ($globalDBdriver == 'mysql') {
284 305
 			$query  = 'SELECT tracker_live.ident, tracker_live.famtrackid,tracker_live.type, tracker_live.latitude, tracker_live.longitude, tracker_live.altitude, tracker_live.heading, tracker_live.ground_speed, tracker_live.date, tracker_live.format_source 
285 306
 			FROM tracker_live'.$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval." SECOND) <= tracker_live.date AND tracker_live.latitude <> '0' AND tracker_live.longitude <> '0' AND tracker_live.latitude BETWEEN ".$minlat.' AND '.$maxlat.' AND tracker_live.longitude BETWEEN '.$minlong.' AND '.$maxlong."
@@ -472,11 +493,15 @@  discard block
 block discarded – undo
472 493
 		//$query  = self::$global_query.' WHERE tracker_live.famtrackid = :id ORDER BY date';
473 494
 		if ($globalDBdriver == 'mysql') {
474 495
 			$query = 'SELECT tracker_live.* FROM tracker_live WHERE tracker_live.famtrackid = :id';
475
-			if ($liveinterval) $query .= ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= date';
496
+			if ($liveinterval) {
497
+				$query .= ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= date';
498
+			}
476 499
 			$query .= ' ORDER BY date';
477 500
 		} else {
478 501
 			$query = 'SELECT tracker_live.* FROM tracker_live WHERE tracker_live.famtrackid = :id';
479
-			if ($liveinterval) $query .= " AND CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= date";
502
+			if ($liveinterval) {
503
+				$query .= " AND CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= date";
504
+			}
480 505
 			$query .= ' ORDER BY date';
481 506
 		}
482 507
 
@@ -571,7 +596,9 @@  discard block
 block discarded – undo
571 596
 				$i++;
572 597
 				$j++;
573 598
 				if ($j == 30) {
574
-					if ($globalDebug) echo ".";
599
+					if ($globalDebug) {
600
+						echo ".";
601
+					}
575 602
 				    	try {
576 603
 						
577 604
 						$sth = $this->db->prepare(substr($query_delete,0,-1).")");
@@ -818,7 +845,9 @@  discard block
 block discarded – undo
818 845
 			{
819 846
 				return false;
820 847
 			}
821
-		} else return '';
848
+		} else {
849
+			return '';
850
+		}
822 851
 
823 852
 		if ($longitude != '')
824 853
 		{
@@ -826,7 +855,9 @@  discard block
 block discarded – undo
826 855
 			{
827 856
 				return false;
828 857
 			}
829
-		} else return '';
858
+		} else {
859
+			return '';
860
+		}
830 861
 
831 862
 		if ($altitude != '')
832 863
 		{
@@ -834,7 +865,9 @@  discard block
 block discarded – undo
834 865
 			{
835 866
 				return false;
836 867
 			}
837
-		} else $altitude = 0;
868
+		} else {
869
+			$altitude = 0;
870
+		}
838 871
 
839 872
 		if ($heading != '')
840 873
 		{
@@ -842,7 +875,9 @@  discard block
 block discarded – undo
842 875
 			{
843 876
 				return false;
844 877
 			}
845
-		} else $heading = 0;
878
+		} else {
879
+			$heading = 0;
880
+		}
846 881
 
847 882
 		if ($groundspeed != '')
848 883
 		{
@@ -850,9 +885,13 @@  discard block
 block discarded – undo
850 885
 			{
851 886
 				return false;
852 887
 			}
853
-		} else $groundspeed = 0;
888
+		} else {
889
+			$groundspeed = 0;
890
+		}
854 891
 		date_default_timezone_set('UTC');
855
-		if ($date == '') $date = date("Y-m-d H:i:s", time());
892
+		if ($date == '') {
893
+			$date = date("Y-m-d H:i:s", time());
894
+		}
856 895
 
857 896
         
858 897
 		$famtrackid = filter_var($famtrackid,FILTER_SANITIZE_STRING);
@@ -868,12 +907,18 @@  discard block
 block discarded – undo
868 907
 		$comment = filter_var($comment,FILTER_SANITIZE_STRING);
869 908
 		$type = filter_var($type,FILTER_SANITIZE_STRING);
870 909
 
871
-            	if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) $groundspeed = 0;
872
-            	if ($heading == '' || $Common->isInteger($heading) === false ) $heading = 0;
910
+            	if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) {
911
+            		$groundspeed = 0;
912
+            	}
913
+            	if ($heading == '' || $Common->isInteger($heading) === false ) {
914
+            		$heading = 0;
915
+            	}
873 916
             	
874 917
 		$query = '';
875 918
 		if ($globalArchive) {
876
-			if ($globalDebug) echo '-- Delete previous data -- ';
919
+			if ($globalDebug) {
920
+				echo '-- Delete previous data -- ';
921
+			}
877 922
 			$query .= 'DELETE FROM tracker_live WHERE famtrackid = :famtrackid;';
878 923
 		}
879 924
 		$query  .= 'INSERT INTO tracker_live (famtrackid, ident, latitude, longitude, altitude, heading, ground_speed, date, format_source, source_name, over_country, comment, type) 
@@ -888,10 +933,14 @@  discard block
 block discarded – undo
888 933
                 	return "error : ".$e->getMessage();
889 934
                 }
890 935
 		if (isset($globalArchive) && $globalArchive && $putinarchive && $noarchive !== true) {
891
-		    if ($globalDebug) echo '(Add to SBS archive : ';
936
+		    if ($globalDebug) {
937
+		    	echo '(Add to SBS archive : ';
938
+		    }
892 939
 		    $TrackerArchive = new TrackerArchive($this->db);
893 940
 		    $result =  $TrackerArchive->addTrackerArchiveData($famtrackid, $ident,$latitude, $longitude, $altitude, $heading, $groundspeed, $date, $putinarchive, $comment, $type,$noarchive,$format_source, $source_name, $over_country);
894
-		    if ($globalDebug) echo $result.')';
941
+		    if ($globalDebug) {
942
+		    	echo $result.')';
943
+		    }
895 944
 		}
896 945
 
897 946
 		return "success";
Please login to merge, or discard this patch.