Completed
Push — master ( 637022...8149d9 )
by Yannick
55:10 queued 27:13
created
require/class.MarineArchive.php 1 patch
Indentation   +589 added lines, -589 removed lines patch added patch discarded remove patch
@@ -10,10 +10,10 @@  discard block
 block discarded – undo
10 10
 	}
11 11
 
12 12
 	/**
13
-	* Get SQL query part for filter used
14
-	* @param Array $filter the filter
15
-	* @return Array the SQL part
16
-	*/
13
+	 * Get SQL query part for filter used
14
+	 * @param Array $filter the filter
15
+	 * @return Array the SQL part
16
+	 */
17 17
 	public function getFilter($filter = array(),$where = false,$and = false) {
18 18
 		global $globalFilter, $globalStatsFilters, $globalFilterName, $globalDBdriver;
19 19
 		$filters = array();
@@ -110,44 +110,44 @@  discard block
 block discarded – undo
110 110
 	}
111 111
 
112 112
 
113
-        /**
114
-        * Gets all the spotter information based on a particular callsign
115
-        *
116
-        * @return Array the spotter information
117
-        *
118
-        */
119
-        public function getLastArchiveMarineDataByIdent($ident)
120
-        {
113
+		/**
114
+		 * Gets all the spotter information based on a particular callsign
115
+		 *
116
+		 * @return Array the spotter information
117
+		 *
118
+		 */
119
+		public function getLastArchiveMarineDataByIdent($ident)
120
+		{
121 121
 		$Marine = new Marine($this->db);
122
-                date_default_timezone_set('UTC');
122
+				date_default_timezone_set('UTC');
123 123
 
124
-                $ident = filter_var($ident, FILTER_SANITIZE_STRING);
125
-                //$query  = "SELECT marine_archive.* FROM marine_archive INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_archive l WHERE l.ident = :ident GROUP BY l.fammarine_id) s on marine_archive.fammarine_id = s.fammarine_id AND marine_archive.date = s.maxdate LIMIT 1";
126
-                $query  = "SELECT marine_archive.* FROM marine_archive WHERE ident = :ident ORDER BY date DESC LIMIT 1";
124
+				$ident = filter_var($ident, FILTER_SANITIZE_STRING);
125
+				//$query  = "SELECT marine_archive.* FROM marine_archive INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_archive l WHERE l.ident = :ident GROUP BY l.fammarine_id) s on marine_archive.fammarine_id = s.fammarine_id AND marine_archive.date = s.maxdate LIMIT 1";
126
+				$query  = "SELECT marine_archive.* FROM marine_archive WHERE ident = :ident ORDER BY date DESC LIMIT 1";
127 127
 
128
-                $spotter_array = $Marine->getDataFromDB($query,array(':ident' => $ident));
128
+				$spotter_array = $Marine->getDataFromDB($query,array(':ident' => $ident));
129 129
 
130
-                return $spotter_array;
131
-        }
130
+				return $spotter_array;
131
+		}
132 132
 
133 133
 
134
-        /**
135
-        * Gets last the spotter information based on a particular id
136
-        *
137
-        * @return Array the spotter information
138
-        *
139
-        */
140
-        public function getLastArchiveMarineDataById($id)
141
-        {
142
-    		$Marine = new Marine($this->db);
143
-                date_default_timezone_set('UTC');
144
-                $id = filter_var($id, FILTER_SANITIZE_STRING);
145
-                //$query  = MarineArchive->$global_query." WHERE marine_archive.fammarine_id = :id";
146
-                //$query  = "SELECT marine_archive.* FROM marine_archive INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_archive l WHERE l.fammarine_id = :id GROUP BY l.fammarine_id) s on marine_archive.fammarine_id = s.fammarine_id AND marine_archive.date = s.maxdate LIMIT 1";
147
-                $query  = "SELECT * FROM marine_archive WHERE fammarine_id = :id ORDER BY date DESC LIMIT 1";
134
+		/**
135
+		 * Gets last the spotter information based on a particular id
136
+		 *
137
+		 * @return Array the spotter information
138
+		 *
139
+		 */
140
+		public function getLastArchiveMarineDataById($id)
141
+		{
142
+			$Marine = new Marine($this->db);
143
+				date_default_timezone_set('UTC');
144
+				$id = filter_var($id, FILTER_SANITIZE_STRING);
145
+				//$query  = MarineArchive->$global_query." WHERE marine_archive.fammarine_id = :id";
146
+				//$query  = "SELECT marine_archive.* FROM marine_archive INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_archive l WHERE l.fammarine_id = :id GROUP BY l.fammarine_id) s on marine_archive.fammarine_id = s.fammarine_id AND marine_archive.date = s.maxdate LIMIT 1";
147
+				$query  = "SELECT * FROM marine_archive WHERE fammarine_id = :id ORDER BY date DESC LIMIT 1";
148 148
 
149 149
 //              $spotter_array = Marine->getDataFromDB($query,array(':id' => $id));
150
-                  /*
150
+				  /*
151 151
                 try {
152 152
                         $Connection = new Connection();
153 153
                         $sth = Connection->$db->prepare($query);
@@ -157,178 +157,178 @@  discard block
 block discarded – undo
157 157
                 }
158 158
                 $spotter_array = $sth->fetchAll(PDO->FETCH_ASSOC);
159 159
                 */
160
-                $spotter_array = $Marine->getDataFromDB($query,array(':id' => $id));
161
-
162
-                return $spotter_array;
163
-        }
164
-
165
-        /**
166
-        * Gets all the spotter information based on a particular id
167
-        *
168
-        * @return Array the spotter information
169
-        *
170
-        */
171
-        public function getAllArchiveMarineDataById($id)
160
+				$spotter_array = $Marine->getDataFromDB($query,array(':id' => $id));
161
+
162
+				return $spotter_array;
163
+		}
164
+
165
+		/**
166
+		 * Gets all the spotter information based on a particular id
167
+		 *
168
+		 * @return Array the spotter information
169
+		 *
170
+		 */
171
+		public function getAllArchiveMarineDataById($id)
172 172
 	{
173
-                date_default_timezone_set('UTC');
174
-                $id = filter_var($id, FILTER_SANITIZE_STRING);
175
-                $query  = $this->global_query." WHERE marine_archive.fammarine_id = :id ORDER BY date";
173
+				date_default_timezone_set('UTC');
174
+				$id = filter_var($id, FILTER_SANITIZE_STRING);
175
+				$query  = $this->global_query." WHERE marine_archive.fammarine_id = :id ORDER BY date";
176 176
 
177 177
 //              $spotter_array = Marine->getDataFromDB($query,array(':id' => $id));
178 178
 
179
-                try {
180
-                        $sth = $this->db->prepare($query);
181
-                        $sth->execute(array(':id' => $id));
182
-                } catch(PDOException $e) {
183
-                        echo $e->getMessage();
184
-                        die;
185
-                }
186
-                $spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC);
187
-
188
-                return $spotter_array;
189
-        }
190
-
191
-        /**
192
-        * Gets coordinate & time spotter information based on a particular id
193
-        *
194
-        * @return Array the spotter information
195
-        *
196
-        */
197
-        public function getCoordArchiveMarineDataById($id)
198
-        {
199
-                date_default_timezone_set('UTC');
200
-                $id = filter_var($id, FILTER_SANITIZE_STRING);
201
-                $query  = "SELECT marine_archive.latitude, marine_archive.longitude, marine_archive.date FROM marine_archive WHERE marine_archive.fammarine_id = :id";
179
+				try {
180
+						$sth = $this->db->prepare($query);
181
+						$sth->execute(array(':id' => $id));
182
+				} catch(PDOException $e) {
183
+						echo $e->getMessage();
184
+						die;
185
+				}
186
+				$spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC);
187
+
188
+				return $spotter_array;
189
+		}
190
+
191
+		/**
192
+		 * Gets coordinate & time spotter information based on a particular id
193
+		 *
194
+		 * @return Array the spotter information
195
+		 *
196
+		 */
197
+		public function getCoordArchiveMarineDataById($id)
198
+		{
199
+				date_default_timezone_set('UTC');
200
+				$id = filter_var($id, FILTER_SANITIZE_STRING);
201
+				$query  = "SELECT marine_archive.latitude, marine_archive.longitude, marine_archive.date FROM marine_archive WHERE marine_archive.fammarine_id = :id";
202 202
 
203 203
 //              $spotter_array = Marine->getDataFromDB($query,array(':id' => $id));
204 204
 
205
-                try {
206
-                        $sth = $this->db->prepare($query);
207
-                        $sth->execute(array(':id' => $id));
208
-                } catch(PDOException $e) {
209
-                        echo $e->getMessage();
210
-                        die;
211
-                }
212
-                $spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC);
205
+				try {
206
+						$sth = $this->db->prepare($query);
207
+						$sth->execute(array(':id' => $id));
208
+				} catch(PDOException $e) {
209
+						echo $e->getMessage();
210
+						die;
211
+				}
212
+				$spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC);
213 213
 
214
-                return $spotter_array;
215
-        }
214
+				return $spotter_array;
215
+		}
216 216
 
217 217
 
218
-        /**
219
-        * Gets altitude information based on a particular callsign
220
-        *
221
-        * @return Array the spotter information
222
-        *
223
-        */
224
-        public function getAltitudeArchiveMarineDataByIdent($ident)
225
-        {
218
+		/**
219
+		 * Gets altitude information based on a particular callsign
220
+		 *
221
+		 * @return Array the spotter information
222
+		 *
223
+		 */
224
+		public function getAltitudeArchiveMarineDataByIdent($ident)
225
+		{
226 226
 
227
-                date_default_timezone_set('UTC');
227
+				date_default_timezone_set('UTC');
228 228
 
229
-                $ident = filter_var($ident, FILTER_SANITIZE_STRING);
230
-                $query  = "SELECT marine_archive.altitude, marine_archive.date FROM marine_archive WHERE marine_archive.ident = :ident AND marine_archive.latitude <> 0 AND marine_archive.longitude <> 0 ORDER BY date";
229
+				$ident = filter_var($ident, FILTER_SANITIZE_STRING);
230
+				$query  = "SELECT marine_archive.altitude, marine_archive.date FROM marine_archive WHERE marine_archive.ident = :ident AND marine_archive.latitude <> 0 AND marine_archive.longitude <> 0 ORDER BY date";
231 231
 
232
-                try {
233
-                        $sth = $this->db->prepare($query);
234
-                        $sth->execute(array(':ident' => $ident));
235
-                } catch(PDOException $e) {
236
-                        echo $e->getMessage();
237
-                        die;
238
-                }
239
-                $spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC);
232
+				try {
233
+						$sth = $this->db->prepare($query);
234
+						$sth->execute(array(':ident' => $ident));
235
+				} catch(PDOException $e) {
236
+						echo $e->getMessage();
237
+						die;
238
+				}
239
+				$spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC);
240 240
 
241
-                return $spotter_array;
242
-        }
241
+				return $spotter_array;
242
+		}
243 243
 
244
-        /**
245
-        * Gets altitude information based on a particular id
246
-        *
247
-        * @return Array the spotter information
248
-        *
249
-        */
250
-        public function getAltitudeArchiveMarineDataById($id)
251
-        {
244
+		/**
245
+		 * Gets altitude information based on a particular id
246
+		 *
247
+		 * @return Array the spotter information
248
+		 *
249
+		 */
250
+		public function getAltitudeArchiveMarineDataById($id)
251
+		{
252 252
 
253
-                date_default_timezone_set('UTC');
253
+				date_default_timezone_set('UTC');
254 254
 
255
-                $id = filter_var($id, FILTER_SANITIZE_STRING);
256
-                $query  = "SELECT marine_archive.altitude, marine_archive.date FROM marine_archive WHERE marine_archive.fammarine_id = :id AND marine_archive.latitude <> 0 AND marine_archive.longitude <> 0 ORDER BY date";
255
+				$id = filter_var($id, FILTER_SANITIZE_STRING);
256
+				$query  = "SELECT marine_archive.altitude, marine_archive.date FROM marine_archive WHERE marine_archive.fammarine_id = :id AND marine_archive.latitude <> 0 AND marine_archive.longitude <> 0 ORDER BY date";
257 257
 
258
-                try {
259
-                        $sth = $this->db->prepare($query);
260
-                        $sth->execute(array(':id' => $id));
261
-                } catch(PDOException $e) {
262
-                        echo $e->getMessage();
263
-                        die;
264
-                }
265
-                $spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC);
258
+				try {
259
+						$sth = $this->db->prepare($query);
260
+						$sth->execute(array(':id' => $id));
261
+				} catch(PDOException $e) {
262
+						echo $e->getMessage();
263
+						die;
264
+				}
265
+				$spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC);
266 266
 
267
-                return $spotter_array;
268
-        }
267
+				return $spotter_array;
268
+		}
269 269
 
270
-        /**
271
-        * Gets altitude & speed information based on a particular id
272
-        *
273
-        * @return Array the spotter information
274
-        *
275
-        */
276
-        public function getAltitudeSpeedArchiveMarineDataById($id)
277
-        {
270
+		/**
271
+		 * Gets altitude & speed information based on a particular id
272
+		 *
273
+		 * @return Array the spotter information
274
+		 *
275
+		 */
276
+		public function getAltitudeSpeedArchiveMarineDataById($id)
277
+		{
278 278
 
279
-                date_default_timezone_set('UTC');
279
+				date_default_timezone_set('UTC');
280 280
 
281
-                $id = filter_var($id, FILTER_SANITIZE_STRING);
282
-                $query  = "SELECT marine_archive.altitude, marine_archive.ground_speed, marine_archive.date FROM marine_archive WHERE marine_archive.fammarine_id = :id ORDER BY date";
281
+				$id = filter_var($id, FILTER_SANITIZE_STRING);
282
+				$query  = "SELECT marine_archive.altitude, marine_archive.ground_speed, marine_archive.date FROM marine_archive WHERE marine_archive.fammarine_id = :id ORDER BY date";
283 283
 
284
-                try {
285
-                        $sth = $this->db->prepare($query);
286
-                        $sth->execute(array(':id' => $id));
287
-                } catch(PDOException $e) {
288
-                        echo $e->getMessage();
289
-                        die;
290
-                }
291
-                $spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC);
284
+				try {
285
+						$sth = $this->db->prepare($query);
286
+						$sth->execute(array(':id' => $id));
287
+				} catch(PDOException $e) {
288
+						echo $e->getMessage();
289
+						die;
290
+				}
291
+				$spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC);
292 292
 
293
-                return $spotter_array;
294
-        }
293
+				return $spotter_array;
294
+		}
295 295
 
296 296
 
297
-        /**
298
-        * Gets altitude information based on a particular callsign
299
-        *
300
-        * @return Array the spotter information
301
-        *
302
-        */
303
-        public function getLastAltitudeArchiveMarineDataByIdent($ident)
304
-        {
297
+		/**
298
+		 * Gets altitude information based on a particular callsign
299
+		 *
300
+		 * @return Array the spotter information
301
+		 *
302
+		 */
303
+		public function getLastAltitudeArchiveMarineDataByIdent($ident)
304
+		{
305 305
 
306
-                date_default_timezone_set('UTC');
306
+				date_default_timezone_set('UTC');
307 307
 
308
-                $ident = filter_var($ident, FILTER_SANITIZE_STRING);
309
-                $query  = "SELECT marine_archive.altitude, marine_archive.date FROM marine_archive INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_archive l WHERE l.ident = :ident GROUP BY l.fammarine_id) s on marine_archive.fammarine_id = s.fammarine_id AND marine_archive.date = s.maxdate LIMIT 1";
308
+				$ident = filter_var($ident, FILTER_SANITIZE_STRING);
309
+				$query  = "SELECT marine_archive.altitude, marine_archive.date FROM marine_archive INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_archive l WHERE l.ident = :ident GROUP BY l.fammarine_id) s on marine_archive.fammarine_id = s.fammarine_id AND marine_archive.date = s.maxdate LIMIT 1";
310 310
 //                $query  = "SELECT marine_archive.altitude, marine_archive.date FROM marine_archive WHERE marine_archive.ident = :ident";
311 311
 
312
-                try {
313
-                        $sth = $this->db->prepare($query);
314
-                        $sth->execute(array(':ident' => $ident));
315
-                } catch(PDOException $e) {
316
-                        echo $e->getMessage();
317
-                        die;
318
-                }
319
-                $spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC);
312
+				try {
313
+						$sth = $this->db->prepare($query);
314
+						$sth->execute(array(':ident' => $ident));
315
+				} catch(PDOException $e) {
316
+						echo $e->getMessage();
317
+						die;
318
+				}
319
+				$spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC);
320 320
 
321
-                return $spotter_array;
322
-        }
321
+				return $spotter_array;
322
+		}
323 323
 
324 324
 
325 325
 
326
-       /**
327
-        * Gets all the archive spotter information
328
-        *
329
-        * @return Array the spotter information
330
-        *
331
-        */
326
+	   /**
327
+	    * Gets all the archive spotter information
328
+	    *
329
+	    * @return Array the spotter information
330
+	    *
331
+	    */
332 332
 	public function getMarineArchiveData($ident,$fammarine_id,$date)
333 333
 	{
334 334
 		$Marine = new Marine($this->db);
@@ -338,10 +338,10 @@  discard block
 block discarded – undo
338 338
 		return $spotter_array;
339 339
 	}
340 340
 
341
-       /**
342
-        * Delete all tracking data
343
-        *
344
-        */
341
+	   /**
342
+	    * Delete all tracking data
343
+	    *
344
+	    */
345 345
 	public function deleteMarineArchiveTrackData()
346 346
 	{
347 347
 		global $globalArchiveKeepTrackMonths, $globalDBdriver;
@@ -360,34 +360,34 @@  discard block
 block discarded – undo
360 360
 	}
361 361
 
362 362
 	/**
363
-        * Gets Minimal Live Marine data
364
-        *
365
-        * @return Array the spotter information
366
-        *
367
-        */
368
-        public function getMinLiveMarineData($begindate,$enddate,$filter = array())
369
-        {
370
-                global $globalDBdriver, $globalLiveInterval;
371
-                date_default_timezone_set('UTC');
372
-
373
-                $filter_query = '';
374
-                if (isset($filter['source']) && !empty($filter['source'])) {
375
-                        $filter_query .= " AND format_source IN ('".implode("','",$filter['source'])."') ";
376
-                }
377
-                // Use spotter_output also ?
378
-                if (isset($filter['airlines']) && !empty($filter['airlines'])) {
379
-                        $filter_query .= " INNER JOIN (SELECT fammarine_id FROM marine_archive_output WHERE marine_archive_output.airline_icao IN ('".implode("','",$filter['airlines'])."')) so ON so.fammarine_id = marine_archive.fammarine_id ";
380
-                }
381
-                if (isset($filter['airlinestype']) && !empty($filter['airlinestype'])) {
382
-                        $filter_query .= " INNER JOIN (SELECT fammarine_id FROM marine_archive_output WHERE marine_archive_output.airline_type = '".$filter['airlinestype']."') sa ON sa.fammarine_id = marine_archive.fammarine_id ";
383
-                }
384
-                if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) {
385
-                        $filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')";
386
-                }
363
+	 * Gets Minimal Live Marine data
364
+	 *
365
+	 * @return Array the spotter information
366
+	 *
367
+	 */
368
+		public function getMinLiveMarineData($begindate,$enddate,$filter = array())
369
+		{
370
+				global $globalDBdriver, $globalLiveInterval;
371
+				date_default_timezone_set('UTC');
387 372
 
388
-                //if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
389
-                if ($globalDBdriver == 'mysql') {
390
-                        /*
373
+				$filter_query = '';
374
+				if (isset($filter['source']) && !empty($filter['source'])) {
375
+						$filter_query .= " AND format_source IN ('".implode("','",$filter['source'])."') ";
376
+				}
377
+				// Use spotter_output also ?
378
+				if (isset($filter['airlines']) && !empty($filter['airlines'])) {
379
+						$filter_query .= " INNER JOIN (SELECT fammarine_id FROM marine_archive_output WHERE marine_archive_output.airline_icao IN ('".implode("','",$filter['airlines'])."')) so ON so.fammarine_id = marine_archive.fammarine_id ";
380
+				}
381
+				if (isset($filter['airlinestype']) && !empty($filter['airlinestype'])) {
382
+						$filter_query .= " INNER JOIN (SELECT fammarine_id FROM marine_archive_output WHERE marine_archive_output.airline_type = '".$filter['airlinestype']."') sa ON sa.fammarine_id = marine_archive.fammarine_id ";
383
+				}
384
+				if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) {
385
+						$filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')";
386
+				}
387
+
388
+				//if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
389
+				if ($globalDBdriver == 'mysql') {
390
+						/*
391 391
                         $query  = 'SELECT a.aircraft_shadow, marine_archive.ident, marine_archive.fammarine_id, marine_archive.aircraft_icao, marine_archive.departure_airport_icao as departure_airport, marine_archive.arrival_airport_icao as arrival_airport, marine_archive.latitude, marine_archive.longitude, marine_archive.altitude, marine_archive.heading, marine_archive.ground_speed, marine_archive.squawk 
392 392
                     		    FROM marine_archive 
393 393
                     		    INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_archive l WHERE (l.date BETWEEN '."'".$begindate."'".' AND '."'".$enddate."'".') GROUP BY l.fammarine_id) s on marine_archive.fammarine_id = s.fammarine_id AND marine_archive.date = s.maxdate '.$filter_query.'LEFT JOIN (SELECT aircraft_shadow,icao FROM aircraft) a ON marine_archive.aircraft_icao = a.icao';
@@ -406,56 +406,56 @@  discard block
 block discarded – undo
406 406
 				    INNER JOIN (SELECT * FROM aircraft) a on marine_archive.aircraft_icao = a.icao
407 407
 				    WHERE marine_archive.date BETWEEN '."'".$begindate."'".' AND '."'".$begindate."'".' 
408 408
                         	    '.$filter_query.' ORDER BY fammarine_id';
409
-                } else {
410
-                        //$query  = 'SELECT marine_archive.ident, marine_archive.fammarine_id, marine_archive.aircraft_icao, marine_archive.departure_airport_icao as departure_airport, marine_archive.arrival_airport_icao as arrival_airport, marine_archive.latitude, marine_archive.longitude, marine_archive.altitude, marine_archive.heading, marine_archive.ground_speed, marine_archive.squawk, a.aircraft_shadow FROM marine_archive INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_archive l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.fammarine_id) s on marine_archive.fammarine_id = s.fammarine_id AND marine_archive.date = s.maxdate '.$filter_query.'INNER JOIN (SELECT * FROM aircraft) a on marine_archive.aircraft_icao = a.icao';
411
-                        $query  = 'SELECT marine_archive.date,marine_archive.fammarine_id, marine_archive.ident, marine_archive.aircraft_icao, marine_archive.departure_airport_icao as departure_airport, marine_archive.arrival_airport_icao as arrival_airport, marine_archive.latitude, marine_archive.longitude, marine_archive.altitude, marine_archive.heading, marine_archive.ground_speed, marine_archive.squawk, a.aircraft_shadow,a.engine_type, a.engine_count, a.wake_category 
409
+				} else {
410
+						//$query  = 'SELECT marine_archive.ident, marine_archive.fammarine_id, marine_archive.aircraft_icao, marine_archive.departure_airport_icao as departure_airport, marine_archive.arrival_airport_icao as arrival_airport, marine_archive.latitude, marine_archive.longitude, marine_archive.altitude, marine_archive.heading, marine_archive.ground_speed, marine_archive.squawk, a.aircraft_shadow FROM marine_archive INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_archive l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.fammarine_id) s on marine_archive.fammarine_id = s.fammarine_id AND marine_archive.date = s.maxdate '.$filter_query.'INNER JOIN (SELECT * FROM aircraft) a on marine_archive.aircraft_icao = a.icao';
411
+						$query  = 'SELECT marine_archive.date,marine_archive.fammarine_id, marine_archive.ident, marine_archive.aircraft_icao, marine_archive.departure_airport_icao as departure_airport, marine_archive.arrival_airport_icao as arrival_airport, marine_archive.latitude, marine_archive.longitude, marine_archive.altitude, marine_archive.heading, marine_archive.ground_speed, marine_archive.squawk, a.aircraft_shadow,a.engine_type, a.engine_count, a.wake_category 
412 412
                         	    FROM marine_archive 
413 413
                         	    INNER JOIN (SELECT * FROM aircraft) a on marine_archive.aircraft_icao = a.icao
414 414
                         	    WHERE marine_archive.date >= '."'".$begindate."'".' AND marine_archive.date <= '."'".$enddate."'".'
415 415
                         	    '.$filter_query.' ORDER BY fammarine_id';
416
-                }
417
-                //echo $query;
418
-                try {
419
-                        $sth = $this->db->prepare($query);
420
-                        $sth->execute();
421
-                } catch(PDOException $e) {
422
-                        echo $e->getMessage();
423
-                        die;
424
-                }
425
-                $spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC);
416
+				}
417
+				//echo $query;
418
+				try {
419
+						$sth = $this->db->prepare($query);
420
+						$sth->execute();
421
+				} catch(PDOException $e) {
422
+						echo $e->getMessage();
423
+						die;
424
+				}
425
+				$spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC);
426 426
 
427
-                return $spotter_array;
428
-        }
427
+				return $spotter_array;
428
+		}
429 429
 
430 430
 	/**
431
-        * Gets Minimal Live Marine data
432
-        *
433
-        * @return Array the spotter information
434
-        *
435
-        */
436
-        public function getMinLiveMarineDataPlayback($begindate,$enddate,$filter = array())
437
-        {
438
-                global $globalDBdriver, $globalLiveInterval;
439
-                date_default_timezone_set('UTC');
440
-
441
-                $filter_query = '';
442
-                if (isset($filter['source']) && !empty($filter['source'])) {
443
-                        $filter_query .= " AND format_source IN ('".implode("','",$filter['source'])."') ";
444
-                }
445
-                // Should use spotter_output also ?
446
-                if (isset($filter['airlines']) && !empty($filter['airlines'])) {
447
-                        $filter_query .= " INNER JOIN (SELECT fammarine_id FROM marine_archive_output WHERE marine_archive_output.airline_icao IN ('".implode("','",$filter['airlines'])."')) so ON so.fammarine_id = marine_archive.fammarine_id ";
448
-                }
449
-                if (isset($filter['airlinestype']) && !empty($filter['airlinestype'])) {
450
-                        $filter_query .= " INNER JOIN (SELECT fammarine_id FROM marine_archive_output WHERE marine_archive_output.airline_type = '".$filter['airlinestype']."') sa ON sa.fammarine_id = marine_archive.fammarine_id ";
451
-                }
452
-                if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) {
453
-                        $filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')";
454
-                }
431
+	 * Gets Minimal Live Marine data
432
+	 *
433
+	 * @return Array the spotter information
434
+	 *
435
+	 */
436
+		public function getMinLiveMarineDataPlayback($begindate,$enddate,$filter = array())
437
+		{
438
+				global $globalDBdriver, $globalLiveInterval;
439
+				date_default_timezone_set('UTC');
455 440
 
456
-                //if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
457
-                if ($globalDBdriver == 'mysql') {
458
-                        /*
441
+				$filter_query = '';
442
+				if (isset($filter['source']) && !empty($filter['source'])) {
443
+						$filter_query .= " AND format_source IN ('".implode("','",$filter['source'])."') ";
444
+				}
445
+				// Should use spotter_output also ?
446
+				if (isset($filter['airlines']) && !empty($filter['airlines'])) {
447
+						$filter_query .= " INNER JOIN (SELECT fammarine_id FROM marine_archive_output WHERE marine_archive_output.airline_icao IN ('".implode("','",$filter['airlines'])."')) so ON so.fammarine_id = marine_archive.fammarine_id ";
448
+				}
449
+				if (isset($filter['airlinestype']) && !empty($filter['airlinestype'])) {
450
+						$filter_query .= " INNER JOIN (SELECT fammarine_id FROM marine_archive_output WHERE marine_archive_output.airline_type = '".$filter['airlinestype']."') sa ON sa.fammarine_id = marine_archive.fammarine_id ";
451
+				}
452
+				if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) {
453
+						$filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')";
454
+				}
455
+
456
+				//if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
457
+				if ($globalDBdriver == 'mysql') {
458
+						/*
459 459
                         $query  = 'SELECT a.aircraft_shadow, marine_archive.ident, marine_archive.fammarine_id, marine_archive.aircraft_icao, marine_archive.departure_airport_icao as departure_airport, marine_archive.arrival_airport_icao as arrival_airport, marine_archive.latitude, marine_archive.longitude, marine_archive.altitude, marine_archive.heading, marine_archive.ground_speed, marine_archive.squawk 
460 460
                     		    FROM marine_archive 
461 461
                     		    INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_archive l WHERE (l.date BETWEEN '."'".$begindate."'".' AND '."'".$enddate."'".') GROUP BY l.fammarine_id) s on marine_archive.fammarine_id = s.fammarine_id AND marine_archive.date = s.maxdate '.$filter_query.'LEFT JOIN (SELECT aircraft_shadow,icao FROM aircraft) a ON marine_archive.aircraft_icao = a.icao';
@@ -466,95 +466,95 @@  discard block
 block discarded – undo
466 466
 				    WHERE (marine_archive_output.date BETWEEN '."'".$begindate."'".' AND '."'".$enddate."'".') 
467 467
                         	    '.$filter_query.' GROUP BY marine_archive_output.fammarine_id, marine_archive_output.ident, marine_archive_output.aircraft_icao, marine_archive_output.departure_airport_icao, marine_archive_output.arrival_airport_icao, marine_archive_output.latitude, marine_archive_output.longitude, marine_archive_output.altitude, marine_archive_output.heading, marine_archive_output.ground_speed, marine_archive_output.squawk, a.aircraft_shadow';
468 468
 
469
-                } else {
470
-                        //$query  = 'SELECT marine_archive_output.ident, marine_archive_output.fammarine_id, marine_archive_output.aircraft_icao, marine_archive_output.departure_airport_icao as departure_airport, marine_archive_output.arrival_airport_icao as arrival_airport, marine_archive_output.latitude, marine_archive_output.longitude, marine_archive_output.altitude, marine_archive_output.heading, marine_archive_output.ground_speed, marine_archive_output.squawk, a.aircraft_shadow FROM marine_archive_output INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_archive_output l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.fammarine_id) s on marine_archive_output.fammarine_id = s.fammarine_id AND marine_archive_output.date = s.maxdate '.$filter_query.'INNER JOIN (SELECT * FROM aircraft) a on marine_archive_output.aircraft_icao = a.icao';
471
-                       /*
469
+				} else {
470
+						//$query  = 'SELECT marine_archive_output.ident, marine_archive_output.fammarine_id, marine_archive_output.aircraft_icao, marine_archive_output.departure_airport_icao as departure_airport, marine_archive_output.arrival_airport_icao as arrival_airport, marine_archive_output.latitude, marine_archive_output.longitude, marine_archive_output.altitude, marine_archive_output.heading, marine_archive_output.ground_speed, marine_archive_output.squawk, a.aircraft_shadow FROM marine_archive_output INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_archive_output l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.fammarine_id) s on marine_archive_output.fammarine_id = s.fammarine_id AND marine_archive_output.date = s.maxdate '.$filter_query.'INNER JOIN (SELECT * FROM aircraft) a on marine_archive_output.aircraft_icao = a.icao';
471
+					   /*
472 472
                         $query  = 'SELECT marine_archive_output.ident, marine_archive_output.fammarine_id, marine_archive_output.aircraft_icao, marine_archive_output.departure_airport_icao as departure_airport, marine_archive_output.arrival_airport_icao as arrival_airport, marine_archive_output.latitude, marine_archive_output.longitude, marine_archive_output.altitude, marine_archive_output.heading, marine_archive_output.ground_speed, marine_archive_output.squawk, a.aircraft_shadow
473 473
                         	    FROM marine_archive_output 
474 474
                         	    INNER JOIN (SELECT * FROM aircraft) a on marine_archive_output.aircraft_icao = a.icao
475 475
                         	    WHERE marine_archive_output.date >= '."'".$begindate."'".' AND marine_archive_output.date <= '."'".$enddate."'".'
476 476
                         	    '.$filter_query.' GROUP BY marine_archive_output.fammarine_id, marine_archive_output.ident, marine_archive_output.aircraft_icao, marine_archive_output.departure_airport_icao, marine_archive_output.arrival_airport_icao, marine_archive_output.latitude, marine_archive_output.longitude, marine_archive_output.altitude, marine_archive_output.heading, marine_archive_output.ground_speed, marine_archive_output.squawk, a.aircraft_shadow';
477 477
                         */
478
-                        $query  = 'SELECT DISTINCT marine_archive_output.fammarine_id, marine_archive_output.ident, marine_archive_output.aircraft_icao, marine_archive_output.departure_airport_icao as departure_airport, marine_archive_output.arrival_airport_icao as arrival_airport, marine_archive_output.latitude, marine_archive_output.longitude, marine_archive_output.altitude, marine_archive_output.heading, marine_archive_output.ground_speed, marine_archive_output.squawk, a.aircraft_shadow
478
+						$query  = 'SELECT DISTINCT marine_archive_output.fammarine_id, marine_archive_output.ident, marine_archive_output.aircraft_icao, marine_archive_output.departure_airport_icao as departure_airport, marine_archive_output.arrival_airport_icao as arrival_airport, marine_archive_output.latitude, marine_archive_output.longitude, marine_archive_output.altitude, marine_archive_output.heading, marine_archive_output.ground_speed, marine_archive_output.squawk, a.aircraft_shadow
479 479
                         	    FROM marine_archive_output 
480 480
                         	    INNER JOIN (SELECT * FROM aircraft) a on marine_archive_output.aircraft_icao = a.icao
481 481
                         	    WHERE marine_archive_output.date >= '."'".$begindate."'".' AND marine_archive_output.date <= '."'".$enddate."'".'
482 482
                         	    '.$filter_query.' LIMIT 200 OFFSET 0';
483 483
 //                        	    .' GROUP BY spotter_output.fammarine_id, 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';
484 484
                         	    
485
-                }
486
-                //echo $query;
487
-                try {
488
-                        $sth = $this->db->prepare($query);
489
-                        $sth->execute();
490
-                } catch(PDOException $e) {
491
-                        echo $e->getMessage();
492
-                        die;
493
-                }
494
-                $spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC);
485
+				}
486
+				//echo $query;
487
+				try {
488
+						$sth = $this->db->prepare($query);
489
+						$sth->execute();
490
+				} catch(PDOException $e) {
491
+						echo $e->getMessage();
492
+						die;
493
+				}
494
+				$spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC);
495 495
 
496
-                return $spotter_array;
497
-        }
496
+				return $spotter_array;
497
+		}
498 498
 
499 499
 	 /**
500
-        * Gets count Live Marine data
501
-        *
502
-        * @return Array the spotter information
503
-        *
504
-        */
505
-        public function getLiveMarineCount($begindate,$enddate,$filter = array())
506
-        {
507
-                global $globalDBdriver, $globalLiveInterval;
508
-                date_default_timezone_set('UTC');
509
-
510
-                $filter_query = '';
511
-                if (isset($filter['source']) && !empty($filter['source'])) {
512
-                        $filter_query .= " AND format_source IN ('".implode("','",$filter['source'])."') ";
513
-                }
514
-                if (isset($filter['airlines']) && !empty($filter['airlines'])) {
515
-                        $filter_query .= " INNER JOIN (SELECT fammarine_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','",$filter['airlines'])."')) so ON so.fammarine_id = marine_archive.fammarine_id ";
516
-                }
517
-                if (isset($filter['airlinestype']) && !empty($filter['airlinestype'])) {
518
-                        $filter_query .= " INNER JOIN (SELECT fammarine_id FROM spotter_output WHERE spotter_output.airline_type = '".$filter['airlinestype']."') sa ON sa.fammarine_id = marine_archive.fammarine_id ";
519
-                }
520
-                if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) {
521
-                        $filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')";
522
-                }
500
+	  * Gets count Live Marine data
501
+	  *
502
+	  * @return Array the spotter information
503
+	  *
504
+	  */
505
+		public function getLiveMarineCount($begindate,$enddate,$filter = array())
506
+		{
507
+				global $globalDBdriver, $globalLiveInterval;
508
+				date_default_timezone_set('UTC');
523 509
 
524
-                //if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
525
-                if ($globalDBdriver == 'mysql') {
510
+				$filter_query = '';
511
+				if (isset($filter['source']) && !empty($filter['source'])) {
512
+						$filter_query .= " AND format_source IN ('".implode("','",$filter['source'])."') ";
513
+				}
514
+				if (isset($filter['airlines']) && !empty($filter['airlines'])) {
515
+						$filter_query .= " INNER JOIN (SELECT fammarine_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','",$filter['airlines'])."')) so ON so.fammarine_id = marine_archive.fammarine_id ";
516
+				}
517
+				if (isset($filter['airlinestype']) && !empty($filter['airlinestype'])) {
518
+						$filter_query .= " INNER JOIN (SELECT fammarine_id FROM spotter_output WHERE spotter_output.airline_type = '".$filter['airlinestype']."') sa ON sa.fammarine_id = marine_archive.fammarine_id ";
519
+				}
520
+				if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) {
521
+						$filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')";
522
+				}
523
+
524
+				//if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
525
+				if ($globalDBdriver == 'mysql') {
526 526
 			$query = 'SELECT COUNT(DISTINCT fammarine_id) as nb 
527 527
 			FROM marine_archive l 
528 528
 			WHERE (l.date BETWEEN DATE_SUB('."'".$begindate."'".',INTERVAL '.$globalLiveInterval.' SECOND) AND '."'".$begindate."'".')'.$filter_query;
529
-                } else {
529
+				} else {
530 530
 			$query = 'SELECT COUNT(DISTINCT fammarine_id) as nb FROM marine_archive l WHERE (l.date BETWEEN '."'".$begindate."' - INTERVAL '".$globalLiveInterval." SECONDS' AND "."'".$enddate."'".')'.$filter_query;
531
-                }
532
-                //echo $query;
533
-                try {
534
-                        $sth = $this->db->prepare($query);
535
-                        $sth->execute();
536
-                } catch(PDOException $e) {
537
-                        echo $e->getMessage();
538
-                        die;
539
-                }
531
+				}
532
+				//echo $query;
533
+				try {
534
+						$sth = $this->db->prepare($query);
535
+						$sth->execute();
536
+				} catch(PDOException $e) {
537
+						echo $e->getMessage();
538
+						die;
539
+				}
540 540
 		$result = $sth->fetch(PDO::FETCH_ASSOC);
541 541
 		$sth->closeCursor();
542
-                return $result['nb'];
542
+				return $result['nb'];
543 543
 
544
-        }
544
+		}
545 545
 
546 546
 
547 547
 
548 548
 	// marine_archive_output
549 549
 	
550
-    /**
551
-    * Gets all the spotter information
552
-    *
553
-    * @return Array the spotter information
554
-    *
555
-    */
556
-    public function searchMarineData($q = '', $registration = '', $aircraft_icao = '', $aircraft_manufacturer = '', $highlights = '', $airline_icao = '', $airline_country = '', $airline_type = '', $airport = '', $airport_country = '', $callsign = '', $departure_airport_route = '', $arrival_airport_route = '', $owner = '',$pilot_id = '',$pilot_name = '',$altitude = '', $date_posted = '', $limit = '', $sort = '', $includegeodata = '',$origLat = '',$origLon = '',$dist = '', $filters=array())
557
-    {
550
+	/**
551
+	 * Gets all the spotter information
552
+	 *
553
+	 * @return Array the spotter information
554
+	 *
555
+	 */
556
+	public function searchMarineData($q = '', $registration = '', $aircraft_icao = '', $aircraft_manufacturer = '', $highlights = '', $airline_icao = '', $airline_country = '', $airline_type = '', $airport = '', $airport_country = '', $callsign = '', $departure_airport_route = '', $arrival_airport_route = '', $owner = '',$pilot_id = '',$pilot_name = '',$altitude = '', $date_posted = '', $limit = '', $sort = '', $includegeodata = '',$origLat = '',$origLon = '',$dist = '', $filters=array())
557
+	{
558 558
 	global $globalTimezone, $globalDBdriver;
559 559
 	require_once(dirname(__FILE__).'/class.Translation.php');
560 560
 	$Translation = new Translation($this->db);
@@ -568,159 +568,159 @@  discard block
 block discarded – undo
568 568
 	$filter_query = $this->getFilter($filters);
569 569
 	if ($q != "")
570 570
 	{
571
-	    if (!is_string($q))
572
-	    {
571
+		if (!is_string($q))
572
+		{
573 573
 		return false;
574
-	    } else {
574
+		} else {
575 575
 	        
576 576
 		$q_array = explode(" ", $q);
577 577
 		
578 578
 		foreach ($q_array as $q_item){
579
-		    $additional_query .= " AND (";
580
-		    $additional_query .= "(marine_archive_output.spotter_id like '%".$q_item."%') OR ";
581
-		    $additional_query .= "(marine_archive_output.aircraft_icao like '%".$q_item."%') OR ";
582
-		    $additional_query .= "(marine_archive_output.aircraft_name like '%".$q_item."%') OR ";
583
-		    $additional_query .= "(marine_archive_output.aircraft_manufacturer like '%".$q_item."%') OR ";
584
-		    $additional_query .= "(marine_archive_output.airline_icao like '%".$q_item."%') OR ";
585
-		    $additional_query .= "(marine_archive_output.airline_name like '%".$q_item."%') OR ";
586
-		    $additional_query .= "(marine_archive_output.airline_country like '%".$q_item."%') OR ";
587
-		    $additional_query .= "(marine_archive_output.departure_airport_icao like '%".$q_item."%') OR ";
588
-		    $additional_query .= "(marine_archive_output.departure_airport_name like '%".$q_item."%') OR ";
589
-		    $additional_query .= "(marine_archive_output.departure_airport_city like '%".$q_item."%') OR ";
590
-		    $additional_query .= "(marine_archive_output.departure_airport_country like '%".$q_item."%') OR ";
591
-		    $additional_query .= "(marine_archive_output.arrival_airport_icao like '%".$q_item."%') OR ";
592
-		    $additional_query .= "(marine_archive_output.arrival_airport_name like '%".$q_item."%') OR ";
593
-		    $additional_query .= "(marine_archive_output.arrival_airport_city like '%".$q_item."%') OR ";
594
-		    $additional_query .= "(marine_archive_output.arrival_airport_country like '%".$q_item."%') OR ";
595
-		    $additional_query .= "(marine_archive_output.registration like '%".$q_item."%') OR ";
596
-		    $additional_query .= "(marine_archive_output.owner_name like '%".$q_item."%') OR ";
597
-		    $additional_query .= "(marine_archive_output.pilot_id like '%".$q_item."%') OR ";
598
-		    $additional_query .= "(marine_archive_output.pilot_name like '%".$q_item."%') OR ";
599
-		    $additional_query .= "(marine_archive_output.ident like '%".$q_item."%') OR ";
600
-		    $translate = $Translation->ident2icao($q_item);
601
-		    if ($translate != $q_item) $additional_query .= "(marine_archive_output.ident like '%".$translate."%') OR ";
602
-		    $additional_query .= "(marine_archive_output.highlight like '%".$q_item."%')";
603
-		    $additional_query .= ")";
579
+			$additional_query .= " AND (";
580
+			$additional_query .= "(marine_archive_output.spotter_id like '%".$q_item."%') OR ";
581
+			$additional_query .= "(marine_archive_output.aircraft_icao like '%".$q_item."%') OR ";
582
+			$additional_query .= "(marine_archive_output.aircraft_name like '%".$q_item."%') OR ";
583
+			$additional_query .= "(marine_archive_output.aircraft_manufacturer like '%".$q_item."%') OR ";
584
+			$additional_query .= "(marine_archive_output.airline_icao like '%".$q_item."%') OR ";
585
+			$additional_query .= "(marine_archive_output.airline_name like '%".$q_item."%') OR ";
586
+			$additional_query .= "(marine_archive_output.airline_country like '%".$q_item."%') OR ";
587
+			$additional_query .= "(marine_archive_output.departure_airport_icao like '%".$q_item."%') OR ";
588
+			$additional_query .= "(marine_archive_output.departure_airport_name like '%".$q_item."%') OR ";
589
+			$additional_query .= "(marine_archive_output.departure_airport_city like '%".$q_item."%') OR ";
590
+			$additional_query .= "(marine_archive_output.departure_airport_country like '%".$q_item."%') OR ";
591
+			$additional_query .= "(marine_archive_output.arrival_airport_icao like '%".$q_item."%') OR ";
592
+			$additional_query .= "(marine_archive_output.arrival_airport_name like '%".$q_item."%') OR ";
593
+			$additional_query .= "(marine_archive_output.arrival_airport_city like '%".$q_item."%') OR ";
594
+			$additional_query .= "(marine_archive_output.arrival_airport_country like '%".$q_item."%') OR ";
595
+			$additional_query .= "(marine_archive_output.registration like '%".$q_item."%') OR ";
596
+			$additional_query .= "(marine_archive_output.owner_name like '%".$q_item."%') OR ";
597
+			$additional_query .= "(marine_archive_output.pilot_id like '%".$q_item."%') OR ";
598
+			$additional_query .= "(marine_archive_output.pilot_name like '%".$q_item."%') OR ";
599
+			$additional_query .= "(marine_archive_output.ident like '%".$q_item."%') OR ";
600
+			$translate = $Translation->ident2icao($q_item);
601
+			if ($translate != $q_item) $additional_query .= "(marine_archive_output.ident like '%".$translate."%') OR ";
602
+			$additional_query .= "(marine_archive_output.highlight like '%".$q_item."%')";
603
+			$additional_query .= ")";
604
+		}
604 605
 		}
605
-	    }
606 606
 	}
607 607
 	
608 608
 	if ($registration != "")
609 609
 	{
610
-	    $registration = filter_var($registration,FILTER_SANITIZE_STRING);
611
-	    if (!is_string($registration))
612
-	    {
610
+		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
611
+		if (!is_string($registration))
612
+		{
613 613
 		return false;
614
-	    } else {
614
+		} else {
615 615
 		$additional_query .= " AND (marine_archive_output.registration = '".$registration."')";
616
-	    }
616
+		}
617 617
 	}
618 618
 	
619 619
 	if ($aircraft_icao != "")
620 620
 	{
621
-	    $aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
622
-	    if (!is_string($aircraft_icao))
623
-	    {
621
+		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
622
+		if (!is_string($aircraft_icao))
623
+		{
624 624
 		return false;
625
-	    } else {
625
+		} else {
626 626
 		$additional_query .= " AND (marine_archive_output.aircraft_icao = '".$aircraft_icao."')";
627
-	    }
627
+		}
628 628
 	}
629 629
 	
630 630
 	if ($aircraft_manufacturer != "")
631 631
 	{
632
-	    $aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
633
-	    if (!is_string($aircraft_manufacturer))
634
-	    {
632
+		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
633
+		if (!is_string($aircraft_manufacturer))
634
+		{
635 635
 		return false;
636
-	    } else {
636
+		} else {
637 637
 		$additional_query .= " AND (marine_archive_output.aircraft_manufacturer = '".$aircraft_manufacturer."')";
638
-	    }
638
+		}
639 639
 	}
640 640
 	
641 641
 	if ($highlights == "true")
642 642
 	{
643
-	    if (!is_string($highlights))
644
-	    {
643
+		if (!is_string($highlights))
644
+		{
645 645
 		return false;
646
-	    } else {
646
+		} else {
647 647
 		$additional_query .= " AND (marine_archive_output.highlight <> '')";
648
-	    }
648
+		}
649 649
 	}
650 650
 	
651 651
 	if ($airline_icao != "")
652 652
 	{
653
-	    $airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
654
-	    if (!is_string($airline_icao))
655
-	    {
653
+		$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
654
+		if (!is_string($airline_icao))
655
+		{
656 656
 		return false;
657
-	    } else {
657
+		} else {
658 658
 		$additional_query .= " AND (marine_archive_output.airline_icao = '".$airline_icao."')";
659
-	    }
659
+		}
660 660
 	}
661 661
 	
662 662
 	if ($airline_country != "")
663 663
 	{
664
-	    $airline_country = filter_var($airline_country,FILTER_SANITIZE_STRING);
665
-	    if (!is_string($airline_country))
666
-	    {
664
+		$airline_country = filter_var($airline_country,FILTER_SANITIZE_STRING);
665
+		if (!is_string($airline_country))
666
+		{
667 667
 		return false;
668
-	    } else {
668
+		} else {
669 669
 		$additional_query .= " AND (marine_archive_output.airline_country = '".$airline_country."')";
670
-	    }
670
+		}
671 671
 	}
672 672
 	
673 673
 	if ($airline_type != "")
674 674
 	{
675
-	    $airline_type = filter_var($airline_type,FILTER_SANITIZE_STRING);
676
-	    if (!is_string($airline_type))
677
-	    {
675
+		$airline_type = filter_var($airline_type,FILTER_SANITIZE_STRING);
676
+		if (!is_string($airline_type))
677
+		{
678 678
 		return false;
679
-	    } else {
679
+		} else {
680 680
 		if ($airline_type == "passenger")
681 681
 		{
682
-		    $additional_query .= " AND (marine_archive_output.airline_type = 'passenger')";
682
+			$additional_query .= " AND (marine_archive_output.airline_type = 'passenger')";
683 683
 		}
684 684
 		if ($airline_type == "cargo")
685 685
 		{
686
-		    $additional_query .= " AND (marine_archive_output.airline_type = 'cargo')";
686
+			$additional_query .= " AND (marine_archive_output.airline_type = 'cargo')";
687 687
 		}
688 688
 		if ($airline_type == "military")
689 689
 		{
690
-		    $additional_query .= " AND (marine_archive_output.airline_type = 'military')";
690
+			$additional_query .= " AND (marine_archive_output.airline_type = 'military')";
691
+		}
691 692
 		}
692
-	    }
693 693
 	}
694 694
 	
695 695
 	if ($airport != "")
696 696
 	{
697
-	    $airport = filter_var($airport,FILTER_SANITIZE_STRING);
698
-	    if (!is_string($airport))
699
-	    {
697
+		$airport = filter_var($airport,FILTER_SANITIZE_STRING);
698
+		if (!is_string($airport))
699
+		{
700 700
 		return false;
701
-	    } else {
701
+		} else {
702 702
 		$additional_query .= " AND ((marine_archive_output.departure_airport_icao = '".$airport."') OR (marine_archive_output.arrival_airport_icao = '".$airport."'))";
703
-	    }
703
+		}
704 704
 	}
705 705
 	
706 706
 	if ($airport_country != "")
707 707
 	{
708
-	    $airport_country = filter_var($airport_country,FILTER_SANITIZE_STRING);
709
-	    if (!is_string($airport_country))
710
-	    {
708
+		$airport_country = filter_var($airport_country,FILTER_SANITIZE_STRING);
709
+		if (!is_string($airport_country))
710
+		{
711 711
 		return false;
712
-	    } else {
712
+		} else {
713 713
 		$additional_query .= " AND ((marine_archive_output.departure_airport_country = '".$airport_country."') OR (marine_archive_output.arrival_airport_country = '".$airport_country."'))";
714
-	    }
714
+		}
715 715
 	}
716 716
     
717 717
 	if ($callsign != "")
718 718
 	{
719
-	    $callsign = filter_var($callsign,FILTER_SANITIZE_STRING);
720
-	    if (!is_string($callsign))
721
-	    {
719
+		$callsign = filter_var($callsign,FILTER_SANITIZE_STRING);
720
+		if (!is_string($callsign))
721
+		{
722 722
 		return false;
723
-	    } else {
723
+		} else {
724 724
 		$translate = $Translation->ident2icao($callsign);
725 725
 		if ($translate != $callsign) {
726 726
 			$additional_query .= " AND (marine_archive_output.ident = :callsign OR marine_archive_output.ident = :translate)";
@@ -728,99 +728,99 @@  discard block
 block discarded – undo
728 728
 		} else {
729 729
 			$additional_query .= " AND (marine_archive_output.ident = '".$callsign."')";
730 730
 		}
731
-	    }
731
+		}
732 732
 	}
733 733
 
734 734
 	if ($owner != "")
735 735
 	{
736
-	    $owner = filter_var($owner,FILTER_SANITIZE_STRING);
737
-	    if (!is_string($owner))
738
-	    {
736
+		$owner = filter_var($owner,FILTER_SANITIZE_STRING);
737
+		if (!is_string($owner))
738
+		{
739 739
 		return false;
740
-	    } else {
740
+		} else {
741 741
 		$additional_query .= " AND (marine_archive_output.owner_name = '".$owner."')";
742
-	    }
742
+		}
743 743
 	}
744 744
 
745 745
 	if ($pilot_name != "")
746 746
 	{
747
-	    $pilot_name = filter_var($pilot_name,FILTER_SANITIZE_STRING);
748
-	    if (!is_string($pilot_name))
749
-	    {
747
+		$pilot_name = filter_var($pilot_name,FILTER_SANITIZE_STRING);
748
+		if (!is_string($pilot_name))
749
+		{
750 750
 		return false;
751
-	    } else {
751
+		} else {
752 752
 		$additional_query .= " AND (marine_archive_output.pilot_name = '".$pilot_name."')";
753
-	    }
753
+		}
754 754
 	}
755 755
 	
756 756
 	if ($pilot_id != "")
757 757
 	{
758
-	    $pilot_id = filter_var($pilot_id,FILTER_SANITIZE_NUMBER_INT);
759
-	    if (!is_string($pilot_id))
760
-	    {
758
+		$pilot_id = filter_var($pilot_id,FILTER_SANITIZE_NUMBER_INT);
759
+		if (!is_string($pilot_id))
760
+		{
761 761
 		return false;
762
-	    } else {
762
+		} else {
763 763
 		$additional_query .= " AND (marine_archive_output.pilot_id = '".$pilot_id."')";
764
-	    }
764
+		}
765 765
 	}
766 766
 	
767 767
 	if ($departure_airport_route != "")
768 768
 	{
769
-	    $departure_airport_route = filter_var($departure_airport_route,FILTER_SANITIZE_STRING);
770
-	    if (!is_string($departure_airport_route))
771
-	    {
769
+		$departure_airport_route = filter_var($departure_airport_route,FILTER_SANITIZE_STRING);
770
+		if (!is_string($departure_airport_route))
771
+		{
772 772
 		return false;
773
-	    } else {
773
+		} else {
774 774
 		$additional_query .= " AND (marine_archive_output.departure_airport_icao = '".$departure_airport_route."')";
775
-	    }
775
+		}
776 776
 	}
777 777
 	
778 778
 	if ($arrival_airport_route != "")
779 779
 	{
780
-	    $arrival_airport_route = filter_var($arrival_airport_route,FILTER_SANITIZE_STRING);
781
-	    if (!is_string($arrival_airport_route))
782
-	    {
780
+		$arrival_airport_route = filter_var($arrival_airport_route,FILTER_SANITIZE_STRING);
781
+		if (!is_string($arrival_airport_route))
782
+		{
783 783
 		return false;
784
-	    } else {
784
+		} else {
785 785
 		$additional_query .= " AND (marine_archive_output.arrival_airport_icao = '".$arrival_airport_route."')";
786
-	    }
786
+		}
787 787
 	}
788 788
 	
789 789
 	if ($altitude != "")
790 790
 	{
791
-	    $altitude_array = explode(",", $altitude);
791
+		$altitude_array = explode(",", $altitude);
792 792
 	    
793
-	    $altitude_array[0] = filter_var($altitude_array[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
794
-	    $altitude_array[1] = filter_var($altitude_array[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
793
+		$altitude_array[0] = filter_var($altitude_array[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
794
+		$altitude_array[1] = filter_var($altitude_array[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
795 795
 	    
796 796
 
797
-	    if ($altitude_array[1] != "")
798
-	    {                
797
+		if ($altitude_array[1] != "")
798
+		{                
799 799
 		$altitude_array[0] = substr($altitude_array[0], 0, -2);
800 800
 		$altitude_array[1] = substr($altitude_array[1], 0, -2);
801 801
 		$additional_query .= " AND altitude BETWEEN '".$altitude_array[0]."' AND '".$altitude_array[1]."' ";
802
-	    } else {
802
+		} else {
803 803
 		$altitude_array[0] = substr($altitude_array[0], 0, -2);
804 804
 		$additional_query .= " AND altitude <= '".$altitude_array[0]."' ";
805
-	    }
805
+		}
806 806
 	}
807 807
 	
808 808
 	if ($date_posted != "")
809 809
 	{
810
-	    $date_array = explode(",", $date_posted);
810
+		$date_array = explode(",", $date_posted);
811 811
 	    
812
-	    $date_array[0] = filter_var($date_array[0],FILTER_SANITIZE_STRING);
813
-	    $date_array[1] = filter_var($date_array[1],FILTER_SANITIZE_STRING);
812
+		$date_array[0] = filter_var($date_array[0],FILTER_SANITIZE_STRING);
813
+		$date_array[1] = filter_var($date_array[1],FILTER_SANITIZE_STRING);
814 814
 	    
815
-	    if ($globalTimezone != '') {
815
+		if ($globalTimezone != '') {
816 816
 		date_default_timezone_set($globalTimezone);
817 817
 		$datetime = new DateTime();
818 818
 		$offset = $datetime->format('P');
819
-	    } else $offset = '+00:00';
819
+		} else $offset = '+00:00';
820 820
 
821 821
 
822
-	    if ($date_array[1] != "")
823
-	    {                
822
+		if ($date_array[1] != "")
823
+		{                
824 824
 		$date_array[0] = date("Y-m-d H:i:s", strtotime($date_array[0]));
825 825
 		$date_array[1] = date("Y-m-d H:i:s", strtotime($date_array[1]));
826 826
 		if ($globalDBdriver == 'mysql') {
@@ -828,28 +828,28 @@  discard block
 block discarded – undo
828 828
 		} else {
829 829
 			$additional_query .= " AND marine_archive_output.date::timestamp AT TIME ZONE INTERVAL ".$offset." >= CAST('".$date_array[0]."' AS TIMESTAMP) AND marine_archive_output.date::timestamp AT TIME ZONE INTERVAL ".$offset." <= CAST('".$date_array[1]."' AS TIMESTAMP) ";
830 830
 		}
831
-	    } else {
831
+		} else {
832 832
 		$date_array[0] = date("Y-m-d H:i:s", strtotime($date_array[0]));
833
-                if ($globalDBdriver == 'mysql') {
833
+				if ($globalDBdriver == 'mysql') {
834 834
 			$additional_query .= " AND TIMESTAMP(CONVERT_TZ(marine_archive_output.date,'+00:00', '".$offset."')) >= '".$date_array[0]."' ";
835 835
 		} else {
836 836
 			$additional_query .= " AND marine_archive_output.date::timestamp AT TIME ZONE INTERVAL ".$offset." >= CAST('".$date_array[0]."' AS TIMESTAMP) ";
837 837
 		}
838
-	    }
838
+		}
839 839
 	}
840 840
 	
841 841
 	if ($limit != "")
842 842
 	{
843
-	    $limit_array = explode(",", $limit);
843
+		$limit_array = explode(",", $limit);
844 844
 	    
845
-	    $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
846
-	    $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
845
+		$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
846
+		$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
847 847
 	    
848
-	    if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
849
-	    {
848
+		if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
849
+		{
850 850
 		//$limit_query = " LIMIT ".$limit_array[0].",".$limit_array[1];
851 851
 		$limit_query = " LIMIT ".$limit_array[1]." OFFSET ".$limit_array[0];
852
-	    }
852
+		}
853 853
 	}
854 854
 	
855 855
 
@@ -880,33 +880,33 @@  discard block
 block discarded – undo
880 880
 	$spotter_array = $Marine->getDataFromDB($query, $query_values,$limit_query);
881 881
 
882 882
 	return $spotter_array;
883
-    }
883
+	}
884 884
 
885
-    public function deleteMarineArchiveData()
886
-    {
885
+	public function deleteMarineArchiveData()
886
+	{
887 887
 		global $globalArchiveKeepMonths, $globalDBdriver;
888
-                date_default_timezone_set('UTC');
889
-                if ($globalDBdriver == 'mysql') {
888
+				date_default_timezone_set('UTC');
889
+				if ($globalDBdriver == 'mysql') {
890 890
 			$query = 'DELETE FROM marine_archive_output WHERE marine_archive_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$globalArchiveKeepMonths.' MONTH)';
891 891
 		} else {
892 892
 			$query = "DELETE FROM marine_archive_output WHERE marine_archive_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalArchiveKeepMonths." MONTH'";
893 893
 		}
894
-                try {
895
-                        $sth = $this->db->prepare($query);
896
-                        $sth->execute();
897
-                } catch(PDOException $e) {
898
-                        return "error";
899
-                }
894
+				try {
895
+						$sth = $this->db->prepare($query);
896
+						$sth->execute();
897
+				} catch(PDOException $e) {
898
+						return "error";
899
+				}
900 900
 	}
901 901
 
902
-    /**
903
-    * Gets all the spotter information based on the callsign
904
-    *
905
-    * @return Array the spotter information
906
-    *
907
-    */
908
-    public function getMarineDataByIdent($ident = '', $limit = '', $sort = '')
909
-    {
902
+	/**
903
+	 * Gets all the spotter information based on the callsign
904
+	 *
905
+	 * @return Array the spotter information
906
+	 *
907
+	 */
908
+	public function getMarineDataByIdent($ident = '', $limit = '', $sort = '')
909
+	{
910 910
 	$global_query = "SELECT marine_archive_output.* FROM marine_archive_output";
911 911
 	
912 912
 	date_default_timezone_set('UTC');
@@ -918,35 +918,35 @@  discard block
 block discarded – undo
918 918
 	
919 919
 	if ($ident != "")
920 920
 	{
921
-	    if (!is_string($ident))
922
-	    {
921
+		if (!is_string($ident))
922
+		{
923 923
 		return false;
924
-	    } else {
924
+		} else {
925 925
 		$additional_query = " AND (marine_archive_output.ident = :ident)";
926 926
 		$query_values = array(':ident' => $ident);
927
-	    }
927
+		}
928 928
 	}
929 929
 	
930 930
 	if ($limit != "")
931 931
 	{
932
-	    $limit_array = explode(",", $limit);
932
+		$limit_array = explode(",", $limit);
933 933
 	    
934
-	    $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
935
-	    $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
934
+		$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
935
+		$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
936 936
 	    
937
-	    if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
938
-	    {
937
+		if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
938
+		{
939 939
 		//$limit_query = " LIMIT ".$limit_array[0].",".$limit_array[1];
940 940
 		$limit_query = " LIMIT ".$limit_array[1]." OFFSET ".$limit_array[0];
941
-	    }
941
+		}
942 942
 	}
943 943
 
944 944
 	if ($sort != "")
945 945
 	{
946
-	    $search_orderby_array = $Marine->getOrderBy();
947
-	    $orderby_query = $search_orderby_array[$sort]['sql'];
946
+		$search_orderby_array = $Marine->getOrderBy();
947
+		$orderby_query = $search_orderby_array[$sort]['sql'];
948 948
 	} else {
949
-	    $orderby_query = " ORDER BY marine_archive_output.date DESC";
949
+		$orderby_query = " ORDER BY marine_archive_output.date DESC";
950 950
 	}
951 951
 
952 952
 	$query = $global_query." WHERE marine_archive_output.ident <> '' ".$additional_query." ".$orderby_query;
@@ -954,17 +954,17 @@  discard block
 block discarded – undo
954 954
 	$spotter_array = $Marine->getDataFromDB($query, $query_values, $limit_query);
955 955
 
956 956
 	return $spotter_array;
957
-    }
957
+	}
958 958
 
959 959
 
960
-    /**
961
-    * Gets all the spotter information based on the owner
962
-    *
963
-    * @return Array the spotter information
964
-    *
965
-    */
966
-    public function getMarineDataByOwner($owner = '', $limit = '', $sort = '', $filter = array())
967
-    {
960
+	/**
961
+	 * Gets all the spotter information based on the owner
962
+	 *
963
+	 * @return Array the spotter information
964
+	 *
965
+	 */
966
+	public function getMarineDataByOwner($owner = '', $limit = '', $sort = '', $filter = array())
967
+	{
968 968
 	$global_query = "SELECT marine_archive_output.* FROM marine_archive_output";
969 969
 	
970 970
 	date_default_timezone_set('UTC');
@@ -977,35 +977,35 @@  discard block
 block discarded – undo
977 977
 	
978 978
 	if ($owner != "")
979 979
 	{
980
-	    if (!is_string($owner))
981
-	    {
980
+		if (!is_string($owner))
981
+		{
982 982
 		return false;
983
-	    } else {
983
+		} else {
984 984
 		$additional_query = " AND (marine_archive_output.owner_name = :owner)";
985 985
 		$query_values = array(':owner' => $owner);
986
-	    }
986
+		}
987 987
 	}
988 988
 	
989 989
 	if ($limit != "")
990 990
 	{
991
-	    $limit_array = explode(",", $limit);
991
+		$limit_array = explode(",", $limit);
992 992
 	    
993
-	    $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
994
-	    $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
993
+		$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
994
+		$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
995 995
 	    
996
-	    if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
997
-	    {
996
+		if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
997
+		{
998 998
 		//$limit_query = " LIMIT ".$limit_array[0].",".$limit_array[1];
999 999
 		$limit_query = " LIMIT ".$limit_array[1]." OFFSET ".$limit_array[0];
1000
-	    }
1000
+		}
1001 1001
 	}
1002 1002
 
1003 1003
 	if ($sort != "")
1004 1004
 	{
1005
-	    $search_orderby_array = $Marine->getOrderBy();
1006
-	    $orderby_query = $search_orderby_array[$sort]['sql'];
1005
+		$search_orderby_array = $Marine->getOrderBy();
1006
+		$orderby_query = $search_orderby_array[$sort]['sql'];
1007 1007
 	} else {
1008
-	    $orderby_query = " ORDER BY marine_archive_output.date DESC";
1008
+		$orderby_query = " ORDER BY marine_archive_output.date DESC";
1009 1009
 	}
1010 1010
 
1011 1011
 	$query = $global_query.$filter_query." marine_archive_output.owner_name <> '' ".$additional_query." ".$orderby_query;
@@ -1013,16 +1013,16 @@  discard block
 block discarded – undo
1013 1013
 	$spotter_array = $Marine->getDataFromDB($query, $query_values, $limit_query);
1014 1014
 
1015 1015
 	return $spotter_array;
1016
-    }
1017
-
1018
-    /**
1019
-    * Gets all the spotter information based on the pilot
1020
-    *
1021
-    * @return Array the spotter information
1022
-    *
1023
-    */
1024
-    public function getMarineDataByPilot($pilot = '', $limit = '', $sort = '', $filter = array())
1025
-    {
1016
+	}
1017
+
1018
+	/**
1019
+	 * Gets all the spotter information based on the pilot
1020
+	 *
1021
+	 * @return Array the spotter information
1022
+	 *
1023
+	 */
1024
+	public function getMarineDataByPilot($pilot = '', $limit = '', $sort = '', $filter = array())
1025
+	{
1026 1026
 	$global_query = "SELECT marine_archive_output.* FROM marine_archive_output";
1027 1027
 	
1028 1028
 	date_default_timezone_set('UTC');
@@ -1041,24 +1041,24 @@  discard block
 block discarded – undo
1041 1041
 	
1042 1042
 	if ($limit != "")
1043 1043
 	{
1044
-	    $limit_array = explode(",", $limit);
1044
+		$limit_array = explode(",", $limit);
1045 1045
 	    
1046
-	    $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1047
-	    $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1046
+		$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1047
+		$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1048 1048
 	    
1049
-	    if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1050
-	    {
1049
+		if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1050
+		{
1051 1051
 		//$limit_query = " LIMIT ".$limit_array[0].",".$limit_array[1];
1052 1052
 		$limit_query = " LIMIT ".$limit_array[1]." OFFSET ".$limit_array[0];
1053
-	    }
1053
+		}
1054 1054
 	}
1055 1055
 
1056 1056
 	if ($sort != "")
1057 1057
 	{
1058
-	    $search_orderby_array = $Marine->getOrderBy();
1059
-	    $orderby_query = $search_orderby_array[$sort]['sql'];
1058
+		$search_orderby_array = $Marine->getOrderBy();
1059
+		$orderby_query = $search_orderby_array[$sort]['sql'];
1060 1060
 	} else {
1061
-	    $orderby_query = " ORDER BY marine_archive_output.date DESC";
1061
+		$orderby_query = " ORDER BY marine_archive_output.date DESC";
1062 1062
 	}
1063 1063
 
1064 1064
 	$query = $global_query.$filter_query." marine_archive_output.pilot_name <> '' ".$additional_query." ".$orderby_query;
@@ -1066,16 +1066,16 @@  discard block
 block discarded – undo
1066 1066
 	$spotter_array = $Marine->getDataFromDB($query, $query_values, $limit_query);
1067 1067
 
1068 1068
 	return $spotter_array;
1069
-    }
1070
-
1071
-    /**
1072
-    * Gets all number of flight over countries
1073
-    *
1074
-    * @return Array the airline country list
1075
-    *
1076
-    */
1077
-    public function countAllFlightOverCountries($limit = true,$olderthanmonths = 0,$sincedate = '')
1078
-    {
1069
+	}
1070
+
1071
+	/**
1072
+	 * Gets all number of flight over countries
1073
+	 *
1074
+	 * @return Array the airline country list
1075
+	 *
1076
+	 */
1077
+	public function countAllFlightOverCountries($limit = true,$olderthanmonths = 0,$sincedate = '')
1078
+	{
1079 1079
 	global $globalDBdriver;
1080 1080
 	/*
1081 1081
 	$query = "SELECT c.name, c.iso3, c.iso2, count(c.name) as nb 
@@ -1085,14 +1085,14 @@  discard block
 block discarded – undo
1085 1085
 	$query = "SELECT c.name, c.iso3, c.iso2, count(c.name) as nb
1086 1086
 		    FROM countries c, marine_archive s
1087 1087
 		    WHERE c.iso2 = s.over_country ";
1088
-                if ($olderthanmonths > 0) {
1089
-            		if ($globalDBdriver == 'mysql') {
1088
+				if ($olderthanmonths > 0) {
1089
+					if ($globalDBdriver == 'mysql') {
1090 1090
 				$query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
1091 1091
 			} else {
1092 1092
 				$query .= "AND date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
1093 1093
 			}
1094 1094
 		}
1095
-                if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
1095
+				if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
1096 1096
 	$query .= "GROUP BY c.name, c.iso3, c.iso2 ORDER BY nb DESC";
1097 1097
 	if ($limit) $query .= " LIMIT 0,10";
1098 1098
       
@@ -1105,23 +1105,23 @@  discard block
 block discarded – undo
1105 1105
         
1106 1106
 	while($row = $sth->fetch(PDO::FETCH_ASSOC))
1107 1107
 	{
1108
-	    $temp_array['flight_count'] = $row['nb'];
1109
-	    $temp_array['flight_country'] = $row['name'];
1110
-	    $temp_array['flight_country_iso3'] = $row['iso3'];
1111
-	    $temp_array['flight_country_iso2'] = $row['iso2'];
1112
-	    $flight_array[] = $temp_array;
1108
+		$temp_array['flight_count'] = $row['nb'];
1109
+		$temp_array['flight_country'] = $row['name'];
1110
+		$temp_array['flight_country_iso3'] = $row['iso3'];
1111
+		$temp_array['flight_country_iso2'] = $row['iso2'];
1112
+		$flight_array[] = $temp_array;
1113 1113
 	}
1114 1114
 	return $flight_array;
1115
-    }
1116
-
1117
-    /**
1118
-    * Gets all number of flight over countries
1119
-    *
1120
-    * @return Array the airline country list
1121
-    *
1122
-    */
1123
-    public function countAllFlightOverCountriesByAirlines($limit = true,$olderthanmonths = 0,$sincedate = '')
1124
-    {
1115
+	}
1116
+
1117
+	/**
1118
+	 * Gets all number of flight over countries
1119
+	 *
1120
+	 * @return Array the airline country list
1121
+	 *
1122
+	 */
1123
+	public function countAllFlightOverCountriesByAirlines($limit = true,$olderthanmonths = 0,$sincedate = '')
1124
+	{
1125 1125
 	global $globalDBdriver;
1126 1126
 	/*
1127 1127
 	$query = "SELECT c.name, c.iso3, c.iso2, count(c.name) as nb 
@@ -1131,14 +1131,14 @@  discard block
 block discarded – undo
1131 1131
 	$query = "SELECT o.airline_icao,c.name, c.iso3, c.iso2, count(c.name) as nb
1132 1132
 		    FROM countries c, marine_archive s, spotter_output o
1133 1133
 		    WHERE c.iso2 = s.over_country AND o.airline_icao <> '' AND o.fammarine_id = s.fammarine_id ";
1134
-                if ($olderthanmonths > 0) {
1135
-            		if ($globalDBdriver == 'mysql') {
1134
+				if ($olderthanmonths > 0) {
1135
+					if ($globalDBdriver == 'mysql') {
1136 1136
 				$query .= 'AND s.date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
1137 1137
 			} else {
1138 1138
 				$query .= "AND s.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
1139 1139
 			}
1140 1140
 		}
1141
-                if ($sincedate != '') $query .= "AND s.date > '".$sincedate."' ";
1141
+				if ($sincedate != '') $query .= "AND s.date > '".$sincedate."' ";
1142 1142
 	$query .= "GROUP BY o.airline_icao,c.name, c.iso3, c.iso2 ORDER BY nb DESC";
1143 1143
 	if ($limit) $query .= " LIMIT 0,10";
1144 1144
       
@@ -1151,24 +1151,24 @@  discard block
 block discarded – undo
1151 1151
         
1152 1152
 	while($row = $sth->fetch(PDO::FETCH_ASSOC))
1153 1153
 	{
1154
-	    $temp_array['airline_icao'] = $row['airline_icao'];
1155
-	    $temp_array['flight_count'] = $row['nb'];
1156
-	    $temp_array['flight_country'] = $row['name'];
1157
-	    $temp_array['flight_country_iso3'] = $row['iso3'];
1158
-	    $temp_array['flight_country_iso2'] = $row['iso2'];
1159
-	    $flight_array[] = $temp_array;
1154
+		$temp_array['airline_icao'] = $row['airline_icao'];
1155
+		$temp_array['flight_count'] = $row['nb'];
1156
+		$temp_array['flight_country'] = $row['name'];
1157
+		$temp_array['flight_country_iso3'] = $row['iso3'];
1158
+		$temp_array['flight_country_iso2'] = $row['iso2'];
1159
+		$flight_array[] = $temp_array;
1160 1160
 	}
1161 1161
 	return $flight_array;
1162
-    }
1163
-
1164
-    /**
1165
-    * Gets last spotter information based on a particular callsign
1166
-    *
1167
-    * @return Array the spotter information
1168
-    *
1169
-    */
1170
-    public function getDateArchiveMarineDataById($id,$date)
1171
-    {
1162
+	}
1163
+
1164
+	/**
1165
+	 * Gets last spotter information based on a particular callsign
1166
+	 *
1167
+	 * @return Array the spotter information
1168
+	 *
1169
+	 */
1170
+	public function getDateArchiveMarineDataById($id,$date)
1171
+	{
1172 1172
 	$Marine = new Marine($this->db);
1173 1173
 	date_default_timezone_set('UTC');
1174 1174
 	$id = filter_var($id, FILTER_SANITIZE_STRING);
@@ -1176,16 +1176,16 @@  discard block
 block discarded – undo
1176 1176
 	$date = date('c',$date);
1177 1177
 	$spotter_array = $Marine->getDataFromDB($query,array(':id' => $id,':date' => $date));
1178 1178
 	return $spotter_array;
1179
-    }
1180
-
1181
-    /**
1182
-    * Gets all the spotter information based on a particular callsign
1183
-    *
1184
-    * @return Array the spotter information
1185
-    *
1186
-    */
1187
-    public function getDateArchiveMarineDataByIdent($ident,$date)
1188
-    {
1179
+	}
1180
+
1181
+	/**
1182
+	 * Gets all the spotter information based on a particular callsign
1183
+	 *
1184
+	 * @return Array the spotter information
1185
+	 *
1186
+	 */
1187
+	public function getDateArchiveMarineDataByIdent($ident,$date)
1188
+	{
1189 1189
 	$Marine = new Marine($this->db);
1190 1190
 	date_default_timezone_set('UTC');
1191 1191
 	$ident = filter_var($ident, FILTER_SANITIZE_STRING);
@@ -1193,16 +1193,16 @@  discard block
 block discarded – undo
1193 1193
 	$date = date('c',$date);
1194 1194
 	$spotter_array = $Marine->getDataFromDB($query,array(':ident' => $ident,':date' => $date));
1195 1195
 	return $spotter_array;
1196
-    }
1197
-
1198
-    /**
1199
-    * Gets all the spotter information based on the airport
1200
-    *
1201
-    * @return Array the spotter information
1202
-    *
1203
-    */
1204
-    public function getMarineDataByAirport($airport = '', $limit = '', $sort = '',$filters = array())
1205
-    {
1196
+	}
1197
+
1198
+	/**
1199
+	 * Gets all the spotter information based on the airport
1200
+	 *
1201
+	 * @return Array the spotter information
1202
+	 *
1203
+	 */
1204
+	public function getMarineDataByAirport($airport = '', $limit = '', $sort = '',$filters = array())
1205
+	{
1206 1206
 	global $global_query;
1207 1207
 	$Marine = new Marine($this->db);
1208 1208
 	date_default_timezone_set('UTC');
@@ -1213,35 +1213,35 @@  discard block
 block discarded – undo
1213 1213
 	
1214 1214
 	if ($airport != "")
1215 1215
 	{
1216
-	    if (!is_string($airport))
1217
-	    {
1216
+		if (!is_string($airport))
1217
+		{
1218 1218
 		return false;
1219
-	    } else {
1219
+		} else {
1220 1220
 		$additional_query .= " AND ((marine_archive_output.departure_airport_icao = :airport) OR (marine_archive_output.arrival_airport_icao = :airport))";
1221 1221
 		$query_values = array(':airport' => $airport);
1222
-	    }
1222
+		}
1223 1223
 	}
1224 1224
 	
1225 1225
 	if ($limit != "")
1226 1226
 	{
1227
-	    $limit_array = explode(",", $limit);
1227
+		$limit_array = explode(",", $limit);
1228 1228
 	    
1229
-	    $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1230
-	    $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1229
+		$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1230
+		$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1231 1231
 	    
1232
-	    if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1233
-	    {
1232
+		if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1233
+		{
1234 1234
 		//$limit_query = " LIMIT ".$limit_array[0].",".$limit_array[1];
1235 1235
 		$limit_query = " LIMIT ".$limit_array[1]." OFFSET ".$limit_array[0];
1236
-	    }
1236
+		}
1237 1237
 	}
1238 1238
 	
1239 1239
 	if ($sort != "")
1240 1240
 	{
1241
-	    $search_orderby_array = $Marine->getOrderBy();
1242
-	    $orderby_query = $search_orderby_array[$sort]['sql'];
1241
+		$search_orderby_array = $Marine->getOrderBy();
1242
+		$orderby_query = $search_orderby_array[$sort]['sql'];
1243 1243
 	} else {
1244
-	    $orderby_query = " ORDER BY marine_archive_output.date DESC";
1244
+		$orderby_query = " ORDER BY marine_archive_output.date DESC";
1245 1245
 	}
1246 1246
 
1247 1247
 	$query = $global_query.$filter_query." marine_archive_output.ident <> '' ".$additional_query." AND ((marine_archive_output.departure_airport_icao <> 'NA') AND (marine_archive_output.arrival_airport_icao <> 'NA')) ".$orderby_query;
@@ -1249,6 +1249,6 @@  discard block
 block discarded – undo
1249 1249
 	$spotter_array = $Marine->getDataFromDB($query, $query_values, $limit_query);
1250 1250
 
1251 1251
 	return $spotter_array;
1252
-    }
1252
+	}
1253 1253
 }
1254 1254
 ?>
1255 1255
\ No newline at end of file
Please login to merge, or discard this patch.
js/map-tracker.2d.js.php 1 patch
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -554,8 +554,8 @@  discard block
 block discarded – undo
554 554
 			}
555 555
                     }
556 556
 		    <?php
557
-            		} else {
558
-            	    ?>
557
+					} else {
558
+					?>
559 559
 		    if (map.getZoom() > 7) {
560 560
                 	var style = {
561 561
                     	    "color": "#1a3151",
@@ -574,7 +574,7 @@  discard block
 block discarded – undo
574 574
                 	layer_tracker_data.addLayer(layer);
575 575
 		    }
576 576
 <?php
577
-            		}
577
+					}
578 578
 ?>
579 579
 				}
580 580
 			    }
@@ -599,11 +599,11 @@  discard block
 block discarded – undo
599 599
 $( document ).ready(function() {
600 600
 	map.on('moveend', function() {
601 601
 <?php
602
-    if (isset($globalMapUseBbox) && $globalMapUseBbox) {
602
+	if (isset($globalMapUseBbox) && $globalMapUseBbox) {
603 603
 ?>
604 604
 		getLiveTrackerData(1);
605 605
 <?php
606
-    }
606
+	}
607 607
 ?>
608 608
 	});
609 609
  //load the function on startup
Please login to merge, or discard this patch.
require/class.TrackerLive.php 1 patch
Indentation   +193 added lines, -193 removed lines patch added patch discarded remove patch
@@ -13,10 +13,10 @@  discard block
 block discarded – undo
13 13
 
14 14
 
15 15
 	/**
16
-	* Get SQL query part for filter used
17
-	* @param Array $filter the filter
18
-	* @return Array the SQL part
19
-	*/
16
+	 * Get SQL query part for filter used
17
+	 * @param Array $filter the filter
18
+	 * @return Array the SQL part
19
+	 */
20 20
 	public function getFilter($filter = array(),$where = false,$and = false) {
21 21
 		global $globalFilter, $globalStatsFilters, $globalFilterName, $globalDBdriver;
22 22
 		$filters = array();
@@ -87,11 +87,11 @@  discard block
 block discarded – undo
87 87
 	}
88 88
 
89 89
 	/**
90
-	* Gets all the spotter information based on the latest data entry
91
-	*
92
-	* @return Array the spotter information
93
-	*
94
-	*/
90
+	 * Gets all the spotter information based on the latest data entry
91
+	 *
92
+	 * @return Array the spotter information
93
+	 *
94
+	 */
95 95
 	public function getLiveTrackerData($limit = '', $sort = '', $filter = array())
96 96
 	{
97 97
 		global $globalDBdriver, $globalLiveInterval;
@@ -133,11 +133,11 @@  discard block
 block discarded – undo
133 133
 	}
134 134
 
135 135
 	/**
136
-	* Gets Minimal Live Spotter data
137
-	*
138
-	* @return Array the spotter information
139
-	*
140
-	*/
136
+	 * Gets Minimal Live Spotter data
137
+	 *
138
+	 * @return Array the spotter information
139
+	 *
140
+	 */
141 141
 	public function getMinLiveTrackerData($filter = array())
142 142
 	{
143 143
 		global $globalDBdriver, $globalLiveInterval;
@@ -171,11 +171,11 @@  discard block
 block discarded – undo
171 171
 	}
172 172
 
173 173
 	/**
174
-	* Gets Minimal Live Spotter data since xx seconds
175
-	*
176
-	* @return Array the spotter information
177
-	*
178
-	*/
174
+	 * Gets Minimal Live Spotter data since xx seconds
175
+	 *
176
+	 * @return Array the spotter information
177
+	 *
178
+	 */
179 179
 	public function getMinLastLiveTrackerData($coord,$filter = array(),$limit = false)
180 180
 	{
181 181
 		global $globalDBdriver, $globalLiveInterval, $globalArchive, $globalMap3DTrackersLimit;
@@ -249,11 +249,11 @@  discard block
 block discarded – undo
249 249
 	}
250 250
 
251 251
 	/**
252
-	* Gets number of latest data entry
253
-	*
254
-	* @return String number of entry
255
-	*
256
-	*/
252
+	 * Gets number of latest data entry
253
+	 *
254
+	 * @return String number of entry
255
+	 *
256
+	 */
257 257
 	public function getLiveTrackerCount($filter = array())
258 258
 	{
259 259
 		global $globalDBdriver, $globalLiveInterval;
@@ -278,11 +278,11 @@  discard block
 block discarded – undo
278 278
 	}
279 279
 
280 280
 	/**
281
-	* Gets all the spotter information based on the latest data entry and coord
282
-	*
283
-	* @return Array the spotter information
284
-	*
285
-	*/
281
+	 * Gets all the spotter information based on the latest data entry and coord
282
+	 *
283
+	 * @return Array the spotter information
284
+	 *
285
+	 */
286 286
 	public function getLiveTrackerDatabyCoord($coord, $filter = array())
287 287
 	{
288 288
 		global $globalDBdriver, $globalLiveInterval;
@@ -306,11 +306,11 @@  discard block
 block discarded – undo
306 306
 	}
307 307
 
308 308
 	/**
309
-	* Gets all the spotter information based on the latest data entry and coord
310
-	*
311
-	* @return Array the spotter information
312
-	*
313
-	*/
309
+	 * Gets all the spotter information based on the latest data entry and coord
310
+	 *
311
+	 * @return Array the spotter information
312
+	 *
313
+	 */
314 314
 	public function getMinLiveTrackerDatabyCoord($coord, $filter = array())
315 315
 	{
316 316
 		global $globalDBdriver, $globalLiveInterval, $globalArchive;
@@ -378,11 +378,11 @@  discard block
 block discarded – undo
378 378
 	}
379 379
 
380 380
 	/**
381
-	* Gets all the spotter information based on a user's latitude and longitude
382
-	*
383
-	* @return Array the spotter information
384
-	*
385
-	*/
381
+	 * Gets all the spotter information based on a user's latitude and longitude
382
+	 *
383
+	 * @return Array the spotter information
384
+	 *
385
+	 */
386 386
 	public function getLatestTrackerForLayar($lat, $lng, $radius, $interval)
387 387
 	{
388 388
 		$Tracker = new Tracker($this->db);
@@ -395,142 +395,142 @@  discard block
 block discarded – undo
395 395
 		if ($lng != '')
396 396
 		{
397 397
 			if (!is_numeric($lng))
398
-                        {
399
-                                return false;
400
-                        }
401
-                }
402
-
403
-                if ($radius != '')
404
-                {
405
-                        if (!is_numeric($radius))
406
-                        {
407
-                                return false;
408
-                        }
409
-                }
398
+						{
399
+								return false;
400
+						}
401
+				}
402
+
403
+				if ($radius != '')
404
+				{
405
+						if (!is_numeric($radius))
406
+						{
407
+								return false;
408
+						}
409
+				}
410 410
 		$additional_query = '';
411 411
 		if ($interval != '')
412
-                {
413
-                        if (!is_string($interval))
414
-                        {
415
-                                //$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= tracker_live.date ';
416
-			        return false;
417
-                        } else {
418
-                if ($interval == '1m')
419
-                {
420
-                    $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= tracker_live.date ';
421
-                } else if ($interval == '15m'){
422
-                    $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 15 MINUTE) <= tracker_live.date ';
423
-                } 
424
-            }
425
-                } else {
426
-         $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= tracker_live.date ';   
427
-        }
428
-
429
-                $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 
412
+				{
413
+						if (!is_string($interval))
414
+						{
415
+								//$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= tracker_live.date ';
416
+					return false;
417
+						} else {
418
+				if ($interval == '1m')
419
+				{
420
+					$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= tracker_live.date ';
421
+				} else if ($interval == '15m'){
422
+					$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 15 MINUTE) <= tracker_live.date ';
423
+				} 
424
+			}
425
+				} else {
426
+		 $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= tracker_live.date ';   
427
+		}
428
+
429
+				$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 
430 430
                    WHERE tracker_live.latitude <> '' 
431 431
                                    AND tracker_live.longitude <> '' 
432 432
                    ".$additional_query."
433 433
                    HAVING distance < :radius  
434 434
                                    ORDER BY distance";
435 435
 
436
-                $spotter_array = $Tracker->getDataFromDB($query, array(':lat' => $lat, ':lng' => $lng,':radius' => $radius));
436
+				$spotter_array = $Tracker->getDataFromDB($query, array(':lat' => $lat, ':lng' => $lng,':radius' => $radius));
437 437
 
438
-                return $spotter_array;
439
-        }
438
+				return $spotter_array;
439
+		}
440 440
 
441 441
     
442
-        /**
443
-	* Gets all the spotter information based on a particular callsign
444
-	*
445
-	* @return Array the spotter information
446
-	*
447
-	*/
442
+		/**
443
+		 * Gets all the spotter information based on a particular callsign
444
+		 *
445
+		 * @return Array the spotter information
446
+		 *
447
+		 */
448 448
 	public function getLastLiveTrackerDataByIdent($ident)
449 449
 	{
450 450
 		$Tracker = new Tracker($this->db);
451 451
 		date_default_timezone_set('UTC');
452 452
 
453 453
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
454
-                $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';
454
+				$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';
455 455
 
456 456
 		$spotter_array = $Tracker->getDataFromDB($query,array(':ident' => $ident),'',true);
457 457
 
458 458
 		return $spotter_array;
459 459
 	}
460 460
 
461
-        /**
462
-	* Gets all the spotter information based on a particular callsign
463
-	*
464
-	* @return Array the spotter information
465
-	*
466
-	*/
461
+		/**
462
+		 * Gets all the spotter information based on a particular callsign
463
+		 *
464
+		 * @return Array the spotter information
465
+		 *
466
+		 */
467 467
 	public function getDateLiveTrackerDataByIdent($ident,$date)
468 468
 	{
469 469
 		$Tracker = new Tracker($this->db);
470 470
 		date_default_timezone_set('UTC');
471 471
 
472 472
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
473
-                $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';
473
+				$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';
474 474
 
475
-                $date = date('c',$date);
475
+				$date = date('c',$date);
476 476
 		$spotter_array = $Tracker->getDataFromDB($query,array(':ident' => $ident,':date' => $date));
477 477
 
478 478
 		return $spotter_array;
479 479
 	}
480 480
 
481
-        /**
482
-	* Gets last spotter information based on a particular callsign
483
-	*
484
-	* @return Array the spotter information
485
-	*
486
-	*/
481
+		/**
482
+		 * Gets last spotter information based on a particular callsign
483
+		 *
484
+		 * @return Array the spotter information
485
+		 *
486
+		 */
487 487
 	public function getLastLiveTrackerDataById($id)
488 488
 	{
489 489
 		$Tracker = new Tracker($this->db);
490 490
 		date_default_timezone_set('UTC');
491 491
 
492 492
 		$id = filter_var($id, FILTER_SANITIZE_STRING);
493
-                $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';
493
+				$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';
494 494
 
495 495
 		$spotter_array = $Tracker->getDataFromDB($query,array(':id' => $id),'',true);
496 496
 
497 497
 		return $spotter_array;
498 498
 	}
499 499
 
500
-        /**
501
-	* Gets last spotter information based on a particular callsign
502
-	*
503
-	* @return Array the spotter information
504
-	*
505
-	*/
500
+		/**
501
+		 * Gets last spotter information based on a particular callsign
502
+		 *
503
+		 * @return Array the spotter information
504
+		 *
505
+		 */
506 506
 	public function getDateLiveTrackerDataById($id,$date)
507 507
 	{
508 508
 		$Tracker = new Tracker($this->db);
509 509
 		date_default_timezone_set('UTC');
510 510
 
511 511
 		$id = filter_var($id, FILTER_SANITIZE_STRING);
512
-                $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';
513
-                $date = date('c',$date);
512
+				$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';
513
+				$date = date('c',$date);
514 514
 		$spotter_array = $Tracker->getDataFromDB($query,array(':id' => $id,':date' => $date),'',true);
515 515
 
516 516
 		return $spotter_array;
517 517
 	}
518 518
 
519
-        /**
520
-	* Gets altitude information based on a particular callsign
521
-	*
522
-	* @return Array the spotter information
523
-	*
524
-	*/
519
+		/**
520
+		 * Gets altitude information based on a particular callsign
521
+		 *
522
+		 * @return Array the spotter information
523
+		 *
524
+		 */
525 525
 	public function getAltitudeLiveTrackerDataByIdent($ident)
526 526
 	{
527 527
 
528 528
 		date_default_timezone_set('UTC');
529 529
 
530 530
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
531
-                $query  = 'SELECT tracker_live.altitude, tracker_live.date FROM tracker_live WHERE tracker_live.ident = :ident';
531
+				$query  = 'SELECT tracker_live.altitude, tracker_live.date FROM tracker_live WHERE tracker_live.ident = :ident';
532 532
 
533
-    		try {
533
+			try {
534 534
 			
535 535
 			$sth = $this->db->prepare($query);
536 536
 			$sth->execute(array(':ident' => $ident));
@@ -543,12 +543,12 @@  discard block
 block discarded – undo
543 543
 		return $spotter_array;
544 544
 	}
545 545
 
546
-        /**
547
-	* Gets all the spotter information based on a particular id
548
-	*
549
-	* @return Array the spotter information
550
-	*
551
-	*/
546
+		/**
547
+		 * Gets all the spotter information based on a particular id
548
+		 *
549
+		 * @return Array the spotter information
550
+		 *
551
+		 */
552 552
 	public function getAllLiveTrackerDataById($id,$liveinterval = false)
553 553
 	{
554 554
 		global $globalDBdriver, $globalLiveInterval;
@@ -576,18 +576,18 @@  discard block
 block discarded – undo
576 576
 		return $spotter_array;
577 577
 	}
578 578
 
579
-        /**
580
-	* Gets all the spotter information based on a particular ident
581
-	*
582
-	* @return Array the spotter information
583
-	*
584
-	*/
579
+		/**
580
+		 * Gets all the spotter information based on a particular ident
581
+		 *
582
+		 * @return Array the spotter information
583
+		 *
584
+		 */
585 585
 	public function getAllLiveTrackerDataByIdent($ident)
586 586
 	{
587 587
 		date_default_timezone_set('UTC');
588 588
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
589 589
 		$query  = self::$global_query.' WHERE tracker_live.ident = :ident';
590
-    		try {
590
+			try {
591 591
 			
592 592
 			$sth = $this->db->prepare($query);
593 593
 			$sth->execute(array(':ident' => $ident));
@@ -601,23 +601,23 @@  discard block
 block discarded – undo
601 601
 
602 602
 
603 603
 	/**
604
-	* Deletes all info in the table
605
-	*
606
-	* @return String success or false
607
-	*
608
-	*/
604
+	 * Deletes all info in the table
605
+	 *
606
+	 * @return String success or false
607
+	 *
608
+	 */
609 609
 	public function deleteLiveTrackerData()
610 610
 	{
611 611
 		global $globalDBdriver;
612 612
 		if ($globalDBdriver == 'mysql') {
613 613
 			//$query  = "DELETE FROM tracker_live WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL 30 MINUTE) >= tracker_live.date";
614 614
 			$query  = 'DELETE FROM tracker_live WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL 9 HOUR) >= tracker_live.date';
615
-            		//$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)";
615
+					//$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)";
616 616
 		} else {
617 617
 			$query  = "DELETE FROM tracker_live WHERE NOW() AT TIME ZONE 'UTC' - INTERVAL '9 HOURS' >= tracker_live.date";
618 618
 		}
619 619
         
620
-    		try {
620
+			try {
621 621
 			
622 622
 			$sth = $this->db->prepare($query);
623 623
 			$sth->execute();
@@ -629,18 +629,18 @@  discard block
 block discarded – undo
629 629
 	}
630 630
 
631 631
 	/**
632
-	* Deletes all info in the table for aircraft not seen since 2 HOUR
633
-	*
634
-	* @return String success or false
635
-	*
636
-	*/
632
+	 * Deletes all info in the table for aircraft not seen since 2 HOUR
633
+	 *
634
+	 * @return String success or false
635
+	 *
636
+	 */
637 637
 	public function deleteLiveTrackerDataNotUpdated()
638 638
 	{
639 639
 		global $globalDBdriver, $globalDebug;
640 640
 		if ($globalDBdriver == 'mysql') {
641 641
 			//$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';
642
-    			$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";
643
-    			try {
642
+				$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";
643
+				try {
644 644
 				
645 645
 				$sth = $this->db->prepare($query);
646 646
 				$sth->execute();
@@ -648,8 +648,8 @@  discard block
 block discarded – undo
648 648
 				return "error";
649 649
 			}
650 650
 			$query_delete = 'DELETE FROM tracker_live WHERE famtrackid IN (';
651
-                        $i = 0;
652
-                        $j =0;
651
+						$i = 0;
652
+						$j =0;
653 653
 			$all = $sth->fetchAll(PDO::FETCH_ASSOC);
654 654
 			foreach($all as $row)
655 655
 			{
@@ -657,20 +657,20 @@  discard block
 block discarded – undo
657 657
 				$j++;
658 658
 				if ($j == 30) {
659 659
 					if ($globalDebug) echo ".";
660
-				    	try {
660
+						try {
661 661
 						
662 662
 						$sth = $this->db->prepare(substr($query_delete,0,-1).")");
663 663
 						$sth->execute();
664 664
 					} catch(PDOException $e) {
665 665
 						return "error";
666 666
 					}
667
-                                	$query_delete = 'DELETE FROM tracker_live WHERE famtrackid IN (';
668
-                                	$j = 0;
667
+									$query_delete = 'DELETE FROM tracker_live WHERE famtrackid IN (';
668
+									$j = 0;
669 669
 				}
670 670
 				$query_delete .= "'".$row['famtrackid']."',";
671 671
 			}
672 672
 			if ($i > 0) {
673
-    				try {
673
+					try {
674 674
 					
675 675
 					$sth = $this->db->prepare(substr($query_delete,0,-1).")");
676 676
 					$sth->execute();
@@ -681,9 +681,9 @@  discard block
 block discarded – undo
681 681
 			return "success";
682 682
 		} elseif ($globalDBdriver == 'pgsql') {
683 683
 			//$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";
684
-    			//$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";
685
-    			$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)";
686
-    			try {
684
+				//$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";
685
+				$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)";
686
+				try {
687 687
 				
688 688
 				$sth = $this->db->prepare($query);
689 689
 				$sth->execute();
@@ -727,17 +727,17 @@  discard block
 block discarded – undo
727 727
 	}
728 728
 
729 729
 	/**
730
-	* Deletes all info in the table for an ident
731
-	*
732
-	* @return String success or false
733
-	*
734
-	*/
730
+	 * Deletes all info in the table for an ident
731
+	 *
732
+	 * @return String success or false
733
+	 *
734
+	 */
735 735
 	public function deleteLiveTrackerDataByIdent($ident)
736 736
 	{
737 737
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
738 738
 		$query  = 'DELETE FROM tracker_live WHERE ident = :ident';
739 739
         
740
-    		try {
740
+			try {
741 741
 			
742 742
 			$sth = $this->db->prepare($query);
743 743
 			$sth->execute(array(':ident' => $ident));
@@ -749,17 +749,17 @@  discard block
 block discarded – undo
749 749
 	}
750 750
 
751 751
 	/**
752
-	* Deletes all info in the table for an id
753
-	*
754
-	* @return String success or false
755
-	*
756
-	*/
752
+	 * Deletes all info in the table for an id
753
+	 *
754
+	 * @return String success or false
755
+	 *
756
+	 */
757 757
 	public function deleteLiveTrackerDataById($id)
758 758
 	{
759 759
 		$id = filter_var($id, FILTER_SANITIZE_STRING);
760 760
 		$query  = 'DELETE FROM tracker_live WHERE famtrackid = :id';
761 761
         
762
-    		try {
762
+			try {
763 763
 			
764 764
 			$sth = $this->db->prepare($query);
765 765
 			$sth->execute(array(':id' => $id));
@@ -772,11 +772,11 @@  discard block
 block discarded – undo
772 772
 
773 773
 
774 774
 	/**
775
-	* Gets the aircraft ident within the last hour
776
-	*
777
-	* @return String the ident
778
-	*
779
-	*/
775
+	 * Gets the aircraft ident within the last hour
776
+	 *
777
+	 * @return String the ident
778
+	 *
779
+	 */
780 780
 	public function getIdentFromLastHour($ident)
781 781
 	{
782 782
 		global $globalDBdriver, $globalTimezone;
@@ -802,14 +802,14 @@  discard block
 block discarded – undo
802 802
 			$ident_result = $row['ident'];
803 803
 		}
804 804
 		return $ident_result;
805
-        }
805
+		}
806 806
 
807 807
 	/**
808
-	* Check recent aircraft
809
-	*
810
-	* @return String the ident
811
-	*
812
-	*/
808
+	 * Check recent aircraft
809
+	 *
810
+	 * @return String the ident
811
+	 *
812
+	 */
813 813
 	public function checkIdentRecent($ident)
814 814
 	{
815 815
 		global $globalDBdriver, $globalTimezone;
@@ -835,14 +835,14 @@  discard block
 block discarded – undo
835 835
 			$ident_result = $row['famtrackid'];
836 836
 		}
837 837
 		return $ident_result;
838
-        }
838
+		}
839 839
 
840 840
 	/**
841
-	* Check recent aircraft by id
842
-	*
843
-	* @return String the ident
844
-	*
845
-	*/
841
+	 * Check recent aircraft by id
842
+	 *
843
+	 * @return String the ident
844
+	 *
845
+	 */
846 846
 	public function checkIdRecent($id)
847 847
 	{
848 848
 		global $globalDBdriver, $globalTimezone;
@@ -868,19 +868,19 @@  discard block
 block discarded – undo
868 868
 			$ident_result = $row['famtrackid'];
869 869
 		}
870 870
 		return $ident_result;
871
-        }
871
+		}
872 872
 
873 873
 	/**
874
-	* Adds a new spotter data
875
-	*
876
-	* @param String $famtrackid the ID from flightaware
877
-	* @param String $ident the flight ident
878
-	* @param String $aircraft_icao the aircraft type
879
-	* @param String $departure_airport_icao the departure airport
880
-	* @param String $arrival_airport_icao the arrival airport
881
-	* @return String success or false
882
-	*
883
-	*/
874
+	 * Adds a new spotter data
875
+	 *
876
+	 * @param String $famtrackid the ID from flightaware
877
+	 * @param String $ident the flight ident
878
+	 * @param String $aircraft_icao the aircraft type
879
+	 * @param String $departure_airport_icao the departure airport
880
+	 * @param String $arrival_airport_icao the arrival airport
881
+	 * @return String success or false
882
+	 *
883
+	 */
884 884
 	public function addLiveTrackerData($famtrackid = '', $ident = '', $latitude = '', $longitude = '', $altitude = '', $heading = '', $groundspeed = '', $date = '', $putinarchive = false, $comment = '', $type = '',$noarchive = false,$format_source = '', $source_name = '', $over_country = '')
885 885
 	{
886 886
 		global $globalURL, $globalArchive, $globalDebug;
@@ -953,8 +953,8 @@  discard block
 block discarded – undo
953 953
 		$comment = filter_var($comment,FILTER_SANITIZE_STRING);
954 954
 		$type = filter_var($type,FILTER_SANITIZE_STRING);
955 955
 
956
-            	if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) $groundspeed = 0;
957
-            	if ($heading == '' || $Common->isInteger($heading) === false ) $heading = 0;
956
+				if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) $groundspeed = 0;
957
+				if ($heading == '' || $Common->isInteger($heading) === false ) $heading = 0;
958 958
             	
959 959
 		$query = '';
960 960
 		if ($globalArchive) {
@@ -972,15 +972,15 @@  discard block
 block discarded – undo
972 972
 		} catch(PDOException $e) {
973 973
 			return "error : ".$e->getMessage();
974 974
 		}
975
-                /*
975
+				/*
976 976
                 echo 'putinarchive : '.$putinarchive."\n";
977 977
                 echo 'noarchive : '.$noarchive."\n";
978 978
                 */
979 979
 		if (isset($globalArchive) && $globalArchive && $putinarchive && $noarchive !== true) {
980
-		    if ($globalDebug) echo '(Add to Tracker archive '.$famtrackid.' : ';
981
-		    $TrackerArchive = new TrackerArchive($this->db);
982
-		    $result =  $TrackerArchive->addTrackerArchiveData($famtrackid, $ident,$latitude, $longitude, $altitude, $heading, $groundspeed, $date, $putinarchive, $comment, $type,$noarchive,$format_source, $source_name, $over_country);
983
-		    if ($globalDebug) echo $result.')';
980
+			if ($globalDebug) echo '(Add to Tracker archive '.$famtrackid.' : ';
981
+			$TrackerArchive = new TrackerArchive($this->db);
982
+			$result =  $TrackerArchive->addTrackerArchiveData($famtrackid, $ident,$latitude, $longitude, $altitude, $heading, $groundspeed, $date, $putinarchive, $comment, $type,$noarchive,$format_source, $source_name, $over_country);
983
+			if ($globalDebug) echo $result.')';
984 984
 		}
985 985
 
986 986
 		return "success";
Please login to merge, or discard this patch.
js/map-marine.2d.js.php 1 patch
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -553,8 +553,8 @@  discard block
 block discarded – undo
553 553
 			}
554 554
                     }
555 555
 		    <?php
556
-            		} else {
557
-            	    ?>
556
+					} else {
557
+					?>
558 558
 		    if (map.getZoom() > 7) {
559 559
                 	var style = {
560 560
                     	    "color": "#1a3151",
@@ -573,7 +573,7 @@  discard block
 block discarded – undo
573 573
                 	layer_marine_data.addLayer(layer);
574 574
 		    }
575 575
 <?php
576
-            		}
576
+					}
577 577
 ?>
578 578
 				}
579 579
 			    }
@@ -598,11 +598,11 @@  discard block
 block discarded – undo
598 598
 $( document ).ready(function() {
599 599
     map.on('moveend', function() {
600 600
 <?php
601
-    if (isset($globalMapUseBbox) && $globalMapUseBbox) {
601
+	if (isset($globalMapUseBbox) && $globalMapUseBbox) {
602 602
 ?>
603 603
 	getLiveMarineData(1);
604 604
 <?php
605
-    }
605
+	}
606 606
 ?>
607 607
     });
608 608
  //load the function on startup
Please login to merge, or discard this patch.
js/map-tracker.3d.js.php 1 patch
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -81,21 +81,21 @@  discard block
 block discarded – undo
81 81
 			var entityid = entity.id;
82 82
 			var lastupdateentity = entity.properties.valueOf('lastupdate')._lastupdate._value;
83 83
 			<?php 
84
-			    if (isset($globalMapUseBbox) && $globalMapUseBbox) {
84
+				if (isset($globalMapUseBbox) && $globalMapUseBbox) {
85 85
 			?>
86 86
 			if (lastupdateentity != lastupdatetracker) {
87 87
 				viewer.dataSources.get(dsn).entities.remove(entity);
88 88
 				czmldstracker.entities.removeById(entityid);
89 89
 			}
90 90
 			<?php
91
-			    } else {
91
+				} else {
92 92
 			?>
93 93
 			if (parseInt(lastupdateentity) < Math.floor(Date.now()-<?php if (isset($globalMapRefresh)) print $globalMapRefresh*2000; else print '60000'; ?>)) {
94 94
 				viewer.dataSources.get(dsn).entities.remove(entity);
95 95
 				czmldstracker.entities.removeById(entityid);
96 96
 			}
97 97
 			<?php
98
-			    }
98
+				}
99 99
 			?>
100 100
 		}
101 101
 	}
@@ -116,15 +116,15 @@  discard block
 block discarded – undo
116 116
 function updateTrackerData() {
117 117
 	lastupdatetracker = Date.now();
118 118
 <?php
119
-    if (isset($globalMapUseBbox) && $globalMapUseBbox) {
119
+	if (isset($globalMapUseBbox) && $globalMapUseBbox) {
120 120
 ?>
121 121
 	var livetrackerdata = czmldstracker.process('<?php print $globalURL; ?>/live-czml.php?tracker&coord='+bbox()+'&update=' + lastupdatetracker);
122 122
 <?php
123
-    } else {
123
+	} else {
124 124
 ?>
125 125
 	var livetrackerdata = czmldstracker.process('<?php print $globalURL; ?>/live-czml.php?tracker&update=' + lastupdatetracker);
126 126
 <?php
127
-    }
127
+	}
128 128
 ?>  
129 129
 	livetrackerdata.then(function (data) { 
130 130
 		displayTrackerData(data);
@@ -171,11 +171,11 @@  discard block
 block discarded – undo
171 171
 }, Cesium.ScreenSpaceEventType.LEFT_CLICK);
172 172
 camera.moveEnd.addEventListener(function() {
173 173
 <?php
174
-    if (isset($globalMapUseBbox) && $globalMapUseBbox) {
174
+	if (isset($globalMapUseBbox) && $globalMapUseBbox) {
175 175
 ?>
176 176
 	updateTrackerData();
177 177
 <?php
178
-    }
178
+	}
179 179
 ?>
180 180
 });
181 181
 
Please login to merge, or discard this patch.
sitemap.php 1 patch
Indentation   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -21,9 +21,9 @@  discard block
 block discarded – undo
21 21
 		foreach($spotter_array as $spotter_item)
22 22
 		{
23 23
 			$output .= '<url>';
24
-			    $output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/flightid/'.$spotter_item['spotter_id'].'</loc>';
25
-			    $output .= '<lastmod>'.date("c", time()).'</lastmod>';
26
-			    $output .= '<changefreq>weekly</changefreq>';
24
+				$output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/flightid/'.$spotter_item['spotter_id'].'</loc>';
25
+				$output .= '<lastmod>'.date("c", time()).'</lastmod>';
26
+				$output .= '<changefreq>weekly</changefreq>';
27 27
 			$output .= '</url>';
28 28
 		}
29 29
 	$output .= '</urlset>';
@@ -38,9 +38,9 @@  discard block
 block discarded – undo
38 38
 		foreach($aircraft_types as $aircraft_item)
39 39
 		{
40 40
 			$output .= '<url>';
41
-			    $output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/aircraft/'.urlencode($aircraft_item['aircraft_icao']).'</loc>';
42
-			    $output .= '<lastmod>'.date("c", time()).'</lastmod>';
43
-			    $output .= '<changefreq>daily</changefreq>';
41
+				$output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/aircraft/'.urlencode($aircraft_item['aircraft_icao']).'</loc>';
42
+				$output .= '<lastmod>'.date("c", time()).'</lastmod>';
43
+				$output .= '<changefreq>daily</changefreq>';
44 44
 			$output .= '</url>';
45 45
 		}
46 46
 	$output .= '</urlset>';
@@ -55,9 +55,9 @@  discard block
 block discarded – undo
55 55
 		foreach($aircraft_registrations as $aircraft_item)
56 56
 		{
57 57
 			$output .= '<url>';
58
-			    $output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/registration/'.urlencode($aircraft_item['registration']).'</loc>';
59
-			    $output .= '<lastmod>'.date("c", time()).'</lastmod>';
60
-			    $output .= '<changefreq>daily</changefreq>';
58
+				$output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/registration/'.urlencode($aircraft_item['registration']).'</loc>';
59
+				$output .= '<lastmod>'.date("c", time()).'</lastmod>';
60
+				$output .= '<changefreq>daily</changefreq>';
61 61
 			$output .= '</url>';
62 62
 		}
63 63
 	$output .= '</urlset>';
@@ -71,9 +71,9 @@  discard block
 block discarded – undo
71 71
 		foreach($airline_names as $airline_item)
72 72
 		{
73 73
 			$output .= '<url>';
74
-			    $output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/airline/'.urlencode($airline_item['airline_icao']).'</loc>';
75
-			    $output .= '<lastmod>'.date("c", time()).'</lastmod>';
76
-			    $output .= '<changefreq>daily</changefreq>';
74
+				$output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/airline/'.urlencode($airline_item['airline_icao']).'</loc>';
75
+				$output .= '<lastmod>'.date("c", time()).'</lastmod>';
76
+				$output .= '<changefreq>daily</changefreq>';
77 77
 			$output .= '</url>';
78 78
 		}
79 79
 	$output .= '</urlset>';
@@ -88,9 +88,9 @@  discard block
 block discarded – undo
88 88
 		foreach($airport_names as $airport_item)
89 89
 		{
90 90
 			$output .= '<url>';
91
-			    $output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/airport/'.$airport_item['airport_icao'].'</loc>';
92
-			    $output .= '<lastmod>'.date("c", time()).'</lastmod>';
93
-			    $output .= '<changefreq>daily</changefreq>';
91
+				$output .= '<loc>'.'http://'.$_SERVER['HTTP_HOST'].$globalURL.'/airport/'.$airport_item['airport_icao'].'</loc>';
92
+				$output .= '<lastmod>'.date("c", time()).'</lastmod>';
93
+				$output .= '<changefreq>daily</changefreq>';
94 94
 			$output .= '</url>';
95 95
 		}
96 96
 	$output .= '</urlset>';
Please login to merge, or discard this patch.
search.php 1 patch
Indentation   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -91,28 +91,28 @@
 block discarded – undo
91 91
 $limit_previous_2 = $limit_end - $absolute_difference;
92 92
 
93 93
 if (
94
-    (isset($_GET['q']) && $_GET['q'] != '') || 
95
-    (isset($_GET['registration']) && $_GET['registration'] != '') || 
96
-    (isset($_GET['aircraft']) && $_GET['aircraft'] != '') ||
97
-    (isset($_GET['manufacturer']) && $_GET['manufacturer'] != '') ||
98
-    (isset($_GET['highlights']) && $_GET['highlights'] != '') ||
99
-    (isset($_GET['airline']) && $_GET['airline'] != '') ||
100
-    (isset($_GET['airline_country']) && $_GET['airline_country'] != '') ||
101
-    (isset($_GET['airline_type']) && $_GET['airline_type'] != '') ||
102
-    (isset($_GET['airport']) && $_GET['airport'] != '') ||
103
-    (isset($_GET['airport_country']) && $_GET['airport_country'] != '') ||
104
-    (isset($_GET['callsign']) && $_GET['callsign'] != '') ||
105
-    (isset($_GET['owner']) && $_GET['owner'] != '') ||
106
-    (isset($_GET['pilot_name']) && $_GET['pilot_name'] != '') ||
107
-    (isset($_GET['pilot_id']) && $_GET['pilot_id'] != '') ||
108
-    (isset($_GET['departure_airport_route']) && $_GET['departure_airport_route'] != '') ||
109
-    (isset($_GET['arrival_airport_route']) && $_GET['arrival_airport_route'] != '') ||
110
-    (isset($_GET['mmsi']) && $_GET['mmsi'] != '') ||
111
-    (isset($_GET['imo']) && $_GET['imo'] != '') ||
112
-    ((isset($_GET['origlat']) && $_GET['origlat'] != '') &&
113
-    (isset($_GET['origlon']) && $_GET['origlon'] != '') &&
114
-    (isset($_GET['dist']) && $_GET['dist'] != ''))
115
-    ){  
94
+	(isset($_GET['q']) && $_GET['q'] != '') || 
95
+	(isset($_GET['registration']) && $_GET['registration'] != '') || 
96
+	(isset($_GET['aircraft']) && $_GET['aircraft'] != '') ||
97
+	(isset($_GET['manufacturer']) && $_GET['manufacturer'] != '') ||
98
+	(isset($_GET['highlights']) && $_GET['highlights'] != '') ||
99
+	(isset($_GET['airline']) && $_GET['airline'] != '') ||
100
+	(isset($_GET['airline_country']) && $_GET['airline_country'] != '') ||
101
+	(isset($_GET['airline_type']) && $_GET['airline_type'] != '') ||
102
+	(isset($_GET['airport']) && $_GET['airport'] != '') ||
103
+	(isset($_GET['airport_country']) && $_GET['airport_country'] != '') ||
104
+	(isset($_GET['callsign']) && $_GET['callsign'] != '') ||
105
+	(isset($_GET['owner']) && $_GET['owner'] != '') ||
106
+	(isset($_GET['pilot_name']) && $_GET['pilot_name'] != '') ||
107
+	(isset($_GET['pilot_id']) && $_GET['pilot_id'] != '') ||
108
+	(isset($_GET['departure_airport_route']) && $_GET['departure_airport_route'] != '') ||
109
+	(isset($_GET['arrival_airport_route']) && $_GET['arrival_airport_route'] != '') ||
110
+	(isset($_GET['mmsi']) && $_GET['mmsi'] != '') ||
111
+	(isset($_GET['imo']) && $_GET['imo'] != '') ||
112
+	((isset($_GET['origlat']) && $_GET['origlat'] != '') &&
113
+	(isset($_GET['origlon']) && $_GET['origlon'] != '') &&
114
+	(isset($_GET['dist']) && $_GET['dist'] != ''))
115
+	){  
116 116
 	$q = filter_input(INPUT_GET, 'q',FILTER_SANITIZE_STRING);
117 117
 	$registration = filter_input(INPUT_GET, 'registration',FILTER_SANITIZE_STRING);
118 118
 	$aircraft = filter_input(INPUT_GET, 'aircraft',FILTER_SANITIZE_STRING);
Please login to merge, or discard this patch.
require/class.Connection.php 1 patch
Indentation   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -56,11 +56,11 @@  discard block
 block discarded – undo
56 56
 	}
57 57
 
58 58
 	/**
59
-	* Creates the database connection
60
-	*
61
-	* @return Boolean of the database connection
62
-	*
63
-	*/
59
+	 * Creates the database connection
60
+	 *
61
+	 * @return Boolean of the database connection
62
+	 *
63
+	 */
64 64
 	public function createDBConnection($DBname = null, $user = null, $pass = null)
65 65
 	{
66 66
 		global $globalDBdriver, $globalDBhost, $globalDBuser, $globalDBpass, $globalDBname, $globalDebug, $globalDB, $globalDBport, $globalDBTimeOut, $globalDBretry, $globalDBPersistent;
@@ -158,7 +158,7 @@  discard block
 block discarded – undo
158 158
 			return false;
159 159
 		}
160 160
 		if($results->rowCount()>0) {
161
-		    return true; 
161
+			return true; 
162 162
 		}
163 163
 		else return false;
164 164
 	}
@@ -176,14 +176,14 @@  discard block
 block discarded – undo
176 176
 				$sum = $sum->fetchColumn(0);
177 177
 			} else $sum = 0;
178 178
 			if (intval($sum) !== 2) {
179
-			     return false;
179
+				 return false;
180 180
 			}
181 181
 			
182 182
 		} catch(PDOException $e) {
183 183
 			if($e->getCode() != 'HY000' || !stristr($e->getMessage(), 'server has gone away')) {
184
-            			throw $e;
185
-	                }
186
-	                //echo 'error ! '.$e->getMessage();
184
+						throw $e;
185
+					}
186
+					//echo 'error ! '.$e->getMessage();
187 187
 			return false;
188 188
 		}
189 189
 		return true; 
@@ -287,8 +287,8 @@  discard block
 block discarded – undo
287 287
 		$version = 0;
288 288
 		if ($this->tableExists('aircraft')) {
289 289
 			if (!$this->tableExists('config')) {
290
-	    			$version = '1';
291
-	    			return $version;
290
+					$version = '1';
291
+					return $version;
292 292
 			} else {
293 293
 				$query = "SELECT value FROM config WHERE name = 'schema_version' LIMIT 1";
294 294
 				try {
@@ -309,10 +309,10 @@  discard block
 block discarded – undo
309 309
 	* @return Boolean if latest version or not
310 310
 	*/
311 311
 	public function latest() {
312
-	    global $globalNoDB;
313
-	    if (isset($globalNoDB) && $globalNoDB === TRUE) return true;
314
-	    if ($this->check_schema_version() == $this->latest_schema) return true;
315
-	    else return false;
312
+		global $globalNoDB;
313
+		if (isset($globalNoDB) && $globalNoDB === TRUE) return true;
314
+		if ($this->check_schema_version() == $this->latest_schema) return true;
315
+		else return false;
316 316
 	}
317 317
 
318 318
 }
Please login to merge, or discard this patch.
require/class.Tracker.php 1 patch
Indentation   +210 added lines, -210 removed lines patch added patch discarded remove patch
@@ -14,10 +14,10 @@  discard block
 block discarded – undo
14 14
 	}
15 15
 
16 16
 	/**
17
-	* Get SQL query part for filter used
18
-	* @param Array $filter the filter
19
-	* @return Array the SQL part
20
-	*/
17
+	 * Get SQL query part for filter used
18
+	 * @param Array $filter the filter
19
+	 * @return Array the SQL part
20
+	 */
21 21
 	
22 22
 	public function getFilter($filter = array(),$where = false,$and = false) {
23 23
 		global $globalFilter, $globalStatsFilters, $globalFilterName, $globalDBdriver;
@@ -81,14 +81,14 @@  discard block
 block discarded – undo
81 81
 	}
82 82
 
83 83
 	/**
84
-	* Executes the SQL statements to get the tracker information
85
-	*
86
-	* @param String $query the SQL query
87
-	* @param Array $params parameter of the query
88
-	* @param String $limitQuery the limit query
89
-	* @return Array the tracker information
90
-	*
91
-	*/
84
+	 * Executes the SQL statements to get the tracker information
85
+	 *
86
+	 * @param String $query the SQL query
87
+	 * @param Array $params parameter of the query
88
+	 * @param String $limitQuery the limit query
89
+	 * @return Array the tracker information
90
+	 *
91
+	 */
92 92
 	public function getDataFromDB($query, $params = array(), $limitQuery = '',$schedules = false)
93 93
 	{
94 94
 		date_default_timezone_set('UTC');
@@ -201,11 +201,11 @@  discard block
 block discarded – undo
201 201
 	
202 202
 	
203 203
 	/**
204
-	* Gets all the tracker information based on the latest data entry
205
-	*
206
-	* @return Array the tracker information
207
-	*
208
-	*/
204
+	 * Gets all the tracker information based on the latest data entry
205
+	 *
206
+	 * @return Array the tracker information
207
+	 *
208
+	 */
209 209
 	public function getLatestTrackerData($limit = '', $sort = '', $filter = array())
210 210
 	{
211 211
 		global $global_query;
@@ -263,11 +263,11 @@  discard block
 block discarded – undo
263 263
 	}
264 264
 
265 265
 	/**
266
-	* Gets all the tracker information based on the callsign
267
-	*
268
-	* @return Array the tracker information
269
-	*
270
-	*/
266
+	 * Gets all the tracker information based on the callsign
267
+	 *
268
+	 * @return Array the tracker information
269
+	 *
270
+	 */
271 271
 	public function getTrackerDataByIdent($ident = '', $limit = '', $sort = '', $filter = array())
272 272
 	{
273 273
 		global $global_query;
@@ -378,12 +378,12 @@  discard block
 block discarded – undo
378 378
 
379 379
 
380 380
 	/**
381
-	* Gets all source name
382
-	*
383
-	* @param String type format of source
384
-	* @return Array list of source name
385
-	*
386
-	*/
381
+	 * Gets all source name
382
+	 *
383
+	 * @param String type format of source
384
+	 * @return Array list of source name
385
+	 *
386
+	 */
387 387
 	public function getAllSourceName($type = '',$filters = array())
388 388
 	{
389 389
 		$filter_query = $this->getFilter($filters,true,true);
@@ -413,11 +413,11 @@  discard block
 block discarded – undo
413 413
 
414 414
 
415 415
 	/**
416
-	* Gets a list of all idents/callsigns
417
-	*
418
-	* @return Array list of ident/callsign names
419
-	*
420
-	*/
416
+	 * Gets a list of all idents/callsigns
417
+	 *
418
+	 * @return Array list of ident/callsign names
419
+	 *
420
+	 */
421 421
 	public function getAllIdents($filters = array())
422 422
 	{
423 423
 		$filter_query = $this->getFilter($filters,true,true);
@@ -485,18 +485,18 @@  discard block
 block discarded – undo
485 485
 	
486 486
 	
487 487
 	/**
488
-	* Update ident tracker data
489
-	*
490
-	* @param String $flightaware_id the ID from flightaware
491
-	* @param String $ident the flight ident
492
-	* @return String success or false
493
-	*
494
-	*/	
488
+	 * Update ident tracker data
489
+	 *
490
+	 * @param String $flightaware_id the ID from flightaware
491
+	 * @param String $ident the flight ident
492
+	 * @return String success or false
493
+	 *
494
+	 */	
495 495
 	public function updateIdentTrackerData($famtrackid = '', $ident = '',$fromsource = NULL)
496 496
 	{
497 497
 
498 498
 		$query = 'UPDATE tracker_output SET ident = :ident WHERE famtrackid = :famtrackid';
499
-                $query_values = array(':famtrackid' => $famtrackid,':ident' => $ident);
499
+				$query_values = array(':famtrackid' => $famtrackid,':ident' => $ident);
500 500
 
501 501
 		try {
502 502
 			$sth = $this->db->prepare($query);
@@ -509,18 +509,18 @@  discard block
 block discarded – undo
509 509
 
510 510
 	}
511 511
 	/**
512
-	* Update latest tracker data
513
-	*
514
-	* @param String $flightaware_id the ID from flightaware
515
-	* @param String $ident the flight ident
516
-	* @param String $arrival_airport_icao the arrival airport
517
-	* @return String success or false
518
-	*
519
-	*/	
512
+	 * Update latest tracker data
513
+	 *
514
+	 * @param String $flightaware_id the ID from flightaware
515
+	 * @param String $ident the flight ident
516
+	 * @param String $arrival_airport_icao the arrival airport
517
+	 * @return String success or false
518
+	 *
519
+	 */	
520 520
 	public function updateLatestTrackerData($famtrackid = '', $ident = '', $latitude = '', $longitude = '', $altitude = '', $groundspeed = NULL, $date = '')
521 521
 	{
522 522
 		$query = 'UPDATE tracker_output SET ident = :ident, last_latitude = :last_latitude, last_longitude = :last_longitude, last_altitude = :last_altitude, last_seen = :last_seen, last_ground_speed = :last_ground_speed WHERE famtrackid = :famtrackid';
523
-                $query_values = array(':famtrackid' => $famtrackid,':last_latitude' => $latitude,':last_longitude' => $longitude, ':last_altitude' => $altitude,':last_ground_speed' => $groundspeed,':last_seen' => $date,':ident' => $ident);
523
+				$query_values = array(':famtrackid' => $famtrackid,':last_latitude' => $latitude,':last_longitude' => $longitude, ':last_altitude' => $altitude,':last_ground_speed' => $groundspeed,':last_seen' => $date,':ident' => $ident);
524 524
 
525 525
 		try {
526 526
 			$sth = $this->db->prepare($query);
@@ -534,32 +534,32 @@  discard block
 block discarded – undo
534 534
 	}
535 535
 
536 536
 	/**
537
-	* Adds a new tracker data
538
-	*
539
-	* @param String $flightaware_id the ID from flightaware
540
-	* @param String $ident the flight ident
541
-	* @param String $aircraft_icao the aircraft type
542
-	* @param String $departure_airport_icao the departure airport
543
-	* @param String $arrival_airport_icao the arrival airport
544
-	* @param String $latitude latitude of flight
545
-	* @param String $longitude latitude of flight
546
-	* @param String $waypoints waypoints of flight
547
-	* @param String $altitude altitude of flight
548
-	* @param String $heading heading of flight
549
-	* @param String $groundspeed speed of flight
550
-	* @param String $date date of flight
551
-	* @param String $departure_airport_time departure time of flight
552
-	* @param String $arrival_airport_time arrival time of flight
553
-	* @param String $squawk squawk code of flight
554
-	* @param String $route_stop route stop of flight
555
-	* @param String $highlight highlight or not
556
-	* @param String $ModeS ModesS code of flight
557
-	* @param String $registration registration code of flight
558
-	* @param String $pilot_id pilot id of flight (for virtual airlines)
559
-	* @param String $pilot_name pilot name of flight (for virtual airlines)
560
-	* @param String $verticalrate vertival rate of flight
561
-	* @return String success or false
562
-	*/
537
+	 * Adds a new tracker data
538
+	 *
539
+	 * @param String $flightaware_id the ID from flightaware
540
+	 * @param String $ident the flight ident
541
+	 * @param String $aircraft_icao the aircraft type
542
+	 * @param String $departure_airport_icao the departure airport
543
+	 * @param String $arrival_airport_icao the arrival airport
544
+	 * @param String $latitude latitude of flight
545
+	 * @param String $longitude latitude of flight
546
+	 * @param String $waypoints waypoints of flight
547
+	 * @param String $altitude altitude of flight
548
+	 * @param String $heading heading of flight
549
+	 * @param String $groundspeed speed of flight
550
+	 * @param String $date date of flight
551
+	 * @param String $departure_airport_time departure time of flight
552
+	 * @param String $arrival_airport_time arrival time of flight
553
+	 * @param String $squawk squawk code of flight
554
+	 * @param String $route_stop route stop of flight
555
+	 * @param String $highlight highlight or not
556
+	 * @param String $ModeS ModesS code of flight
557
+	 * @param String $registration registration code of flight
558
+	 * @param String $pilot_id pilot id of flight (for virtual airlines)
559
+	 * @param String $pilot_name pilot name of flight (for virtual airlines)
560
+	 * @param String $verticalrate vertival rate of flight
561
+	 * @return String success or false
562
+	 */
563 563
 	public function addTrackerData($famtrackid = '', $ident = '', $latitude = '', $longitude = '', $altitude = '', $heading = '', $groundspeed = '', $date = '', $comment = '', $type = '',$format_source = '', $source_name = '')
564 564
 	{
565 565
 		global $globalURL;
@@ -644,16 +644,16 @@  discard block
 block discarded – undo
644 644
 		$comment = filter_var($comment,FILTER_SANITIZE_STRING);
645 645
 		$type = filter_var($type,FILTER_SANITIZE_STRING);
646 646
 	
647
-                if ($latitude == '' && $longitude == '') {
648
-            		$latitude = 0;
649
-            		$longitude = 0;
650
-            	}
651
-                if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0;
652
-                if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0;
653
-                $query  = "INSERT INTO tracker_output (famtrackid, ident, latitude, longitude, altitude, heading, ground_speed, date, format_source, source_name, comment, type) 
647
+				if ($latitude == '' && $longitude == '') {
648
+					$latitude = 0;
649
+					$longitude = 0;
650
+				}
651
+				if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0;
652
+				if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0;
653
+				$query  = "INSERT INTO tracker_output (famtrackid, ident, latitude, longitude, altitude, heading, ground_speed, date, format_source, source_name, comment, type) 
654 654
                 VALUES (:famtrackid,:ident,:latitude,:longitude,:altitude,:heading,:speed,:date,:format_source, :source_name,:comment,:type)";
655 655
 
656
-                $query_values = array(':famtrackid' => $famtrackid,':ident' => $ident,':latitude' => $latitude,':longitude' => $longitude,':altitude' => $altitude,':heading' => $heading,':speed' => $groundspeed,':date' => $date,':format_source' => $format_source, ':source_name' => $source_name,':comment' => $comment,':type' => $type);
656
+				$query_values = array(':famtrackid' => $famtrackid,':ident' => $ident,':latitude' => $latitude,':longitude' => $longitude,':altitude' => $altitude,':heading' => $heading,':speed' => $groundspeed,':date' => $date,':format_source' => $format_source, ':source_name' => $source_name,':comment' => $comment,':type' => $type);
657 657
 
658 658
 		try {
659 659
 		        
@@ -661,7 +661,7 @@  discard block
 block discarded – undo
661 661
 			$sth->execute($query_values);
662 662
 			$this->db = null;
663 663
 		} catch (PDOException $e) {
664
-		    return "error : ".$e->getMessage();
664
+			return "error : ".$e->getMessage();
665 665
 		}
666 666
 		
667 667
 		return "success";
@@ -670,11 +670,11 @@  discard block
 block discarded – undo
670 670
 	
671 671
   
672 672
 	/**
673
-	* Gets the aircraft ident within the last hour
674
-	*
675
-	* @return String the ident
676
-	*
677
-	*/
673
+	 * Gets the aircraft ident within the last hour
674
+	 *
675
+	 * @return String the ident
676
+	 *
677
+	 */
678 678
 	public function getIdentFromLastHour($ident)
679 679
 	{
680 680
 		global $globalDBdriver, $globalTimezone;
@@ -690,11 +690,11 @@  discard block
 block discarded – undo
690 690
 								AND tracker_output.date >= now() AT TIME ZONE 'UTC' - INTERVAL '1 HOURS'
691 691
 								AND tracker_output.date < now() AT TIME ZONE 'UTC'";
692 692
 			$query_data = array(':ident' => $ident);
693
-    		}
693
+			}
694 694
 		
695 695
 		$sth = $this->db->prepare($query);
696 696
 		$sth->execute($query_data);
697
-    		$ident_result='';
697
+			$ident_result='';
698 698
 		while($row = $sth->fetch(PDO::FETCH_ASSOC))
699 699
 		{
700 700
 			$ident_result = $row['ident'];
@@ -705,11 +705,11 @@  discard block
 block discarded – undo
705 705
 	
706 706
 	
707 707
 	/**
708
-	* Gets the aircraft data from the last 20 seconds
709
-	*
710
-	* @return Array the tracker data
711
-	*
712
-	*/
708
+	 * Gets the aircraft data from the last 20 seconds
709
+	 *
710
+	 * @return Array the tracker data
711
+	 *
712
+	 */
713 713
 	public function getRealTimeData($q = '')
714 714
 	{
715 715
 		global $globalDBdriver;
@@ -743,11 +743,11 @@  discard block
 block discarded – undo
743 743
 	}
744 744
 
745 745
 	/**
746
-	* Gets all number of flight over countries
747
-	*
748
-	* @return Array the airline country list
749
-	*
750
-	*/
746
+	 * Gets all number of flight over countries
747
+	 *
748
+	 * @return Array the airline country list
749
+	 *
750
+	 */
751 751
 	public function countAllTrackerOverCountries($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array())
752 752
 	{
753 753
 		global $globalDBdriver, $globalArchive;
@@ -817,11 +817,11 @@  discard block
 block discarded – undo
817 817
 	}
818 818
 	
819 819
 	/**
820
-	* Gets all callsigns that have flown over
821
-	*
822
-	* @return Array the callsign list
823
-	*
824
-	*/
820
+	 * Gets all callsigns that have flown over
821
+	 *
822
+	 * @return Array the callsign list
823
+	 *
824
+	 */
825 825
 	public function countAllCallsigns($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array(),$year = '', $month = '', $day = '')
826 826
 	{
827 827
 		global $globalDBdriver;
@@ -888,11 +888,11 @@  discard block
 block discarded – undo
888 888
 
889 889
 
890 890
 	/**
891
-	* Counts all dates
892
-	*
893
-	* @return Array the date list
894
-	*
895
-	*/
891
+	 * Counts all dates
892
+	 *
893
+	 * @return Array the date list
894
+	 *
895
+	 */
896 896
 	public function countAllDates($filters = array())
897 897
 	{
898 898
 		global $globalTimezone, $globalDBdriver;
@@ -938,11 +938,11 @@  discard block
 block discarded – undo
938 938
 	
939 939
 	
940 940
 	/**
941
-	* Counts all dates during the last 7 days
942
-	*
943
-	* @return Array the date list
944
-	*
945
-	*/
941
+	 * Counts all dates during the last 7 days
942
+	 *
943
+	 * @return Array the date list
944
+	 *
945
+	 */
946 946
 	public function countAllDatesLast7Days($filters = array())
947 947
 	{
948 948
 		global $globalTimezone, $globalDBdriver;
@@ -964,7 +964,7 @@  discard block
 block discarded – undo
964 964
 			$query .= " GROUP BY date_name 
965 965
 								ORDER BY date_name ASC";
966 966
 			$query_data = array(':offset' => $offset);
967
-    		}
967
+			}
968 968
 		
969 969
 		$sth = $this->db->prepare($query);
970 970
 		$sth->execute($query_data);
@@ -984,11 +984,11 @@  discard block
 block discarded – undo
984 984
 	}
985 985
 
986 986
 	/**
987
-	* Counts all dates during the last month
988
-	*
989
-	* @return Array the date list
990
-	*
991
-	*/
987
+	 * Counts all dates during the last month
988
+	 *
989
+	 * @return Array the date list
990
+	 *
991
+	 */
992 992
 	public function countAllDatesLastMonth($filters = array())
993 993
 	{
994 994
 		global $globalTimezone, $globalDBdriver;
@@ -1010,7 +1010,7 @@  discard block
 block discarded – undo
1010 1010
 			$query .= " GROUP BY date_name 
1011 1011
 								ORDER BY date_name ASC";
1012 1012
 			$query_data = array(':offset' => $offset);
1013
-    		}
1013
+			}
1014 1014
 		
1015 1015
 		$sth = $this->db->prepare($query);
1016 1016
 		$sth->execute($query_data);
@@ -1032,11 +1032,11 @@  discard block
 block discarded – undo
1032 1032
 
1033 1033
 
1034 1034
 	/**
1035
-	* Counts all month
1036
-	*
1037
-	* @return Array the month list
1038
-	*
1039
-	*/
1035
+	 * Counts all month
1036
+	 *
1037
+	 * @return Array the month list
1038
+	 *
1039
+	 */
1040 1040
 	public function countAllMonths($filters = array())
1041 1041
 	{
1042 1042
 		global $globalTimezone, $globalDBdriver;
@@ -1081,11 +1081,11 @@  discard block
 block discarded – undo
1081 1081
 	
1082 1082
 
1083 1083
 	/**
1084
-	* Counts all dates during the last year
1085
-	*
1086
-	* @return Array the date list
1087
-	*
1088
-	*/
1084
+	 * Counts all dates during the last year
1085
+	 *
1086
+	 * @return Array the date list
1087
+	 *
1088
+	 */
1089 1089
 	public function countAllMonthsLastYear($filters)
1090 1090
 	{
1091 1091
 		global $globalTimezone, $globalDBdriver;
@@ -1107,7 +1107,7 @@  discard block
 block discarded – undo
1107 1107
 			$query .= " GROUP BY year_name, month_name
1108 1108
 								ORDER BY year_name, month_name ASC";
1109 1109
 			$query_data = array(':offset' => $offset);
1110
-    		}
1110
+			}
1111 1111
 		
1112 1112
 		$sth = $this->db->prepare($query);
1113 1113
 		$sth->execute($query_data);
@@ -1130,11 +1130,11 @@  discard block
 block discarded – undo
1130 1130
 	
1131 1131
 	
1132 1132
 	/**
1133
-	* Counts all hours
1134
-	*
1135
-	* @return Array the hour list
1136
-	*
1137
-	*/
1133
+	 * Counts all hours
1134
+	 *
1135
+	 * @return Array the hour list
1136
+	 *
1137
+	 */
1138 1138
 	public function countAllHours($orderby,$filters = array())
1139 1139
 	{
1140 1140
 		global $globalTimezone, $globalDBdriver;
@@ -1197,11 +1197,11 @@  discard block
 block discarded – undo
1197 1197
 	
1198 1198
 	
1199 1199
 	/**
1200
-	* Counts all hours by date
1201
-	*
1202
-	* @return Array the hour list
1203
-	*
1204
-	*/
1200
+	 * Counts all hours by date
1201
+	 *
1202
+	 * @return Array the hour list
1203
+	 *
1204
+	 */
1205 1205
 	public function countAllHoursByDate($date, $filters = array())
1206 1206
 	{
1207 1207
 		global $globalTimezone, $globalDBdriver;
@@ -1245,11 +1245,11 @@  discard block
 block discarded – undo
1245 1245
 	
1246 1246
 	
1247 1247
 	/**
1248
-	* Counts all hours by a ident/callsign
1249
-	*
1250
-	* @return Array the hour list
1251
-	*
1252
-	*/
1248
+	 * Counts all hours by a ident/callsign
1249
+	 *
1250
+	 * @return Array the hour list
1251
+	 *
1252
+	 */
1253 1253
 	public function countAllHoursByIdent($ident, $filters = array())
1254 1254
 	{
1255 1255
 		global $globalTimezone, $globalDBdriver;
@@ -1294,11 +1294,11 @@  discard block
 block discarded – undo
1294 1294
 	
1295 1295
 	
1296 1296
 	/**
1297
-	* Counts all trackers that have flown over
1298
-	*
1299
-	* @return Integer the number of trackers
1300
-	*
1301
-	*/
1297
+	 * Counts all trackers that have flown over
1298
+	 *
1299
+	 * @return Integer the number of trackers
1300
+	 *
1301
+	 */
1302 1302
 	public function countOverallTracker($filters = array(),$year = '',$month = '')
1303 1303
 	{
1304 1304
 		global $globalDBdriver;
@@ -1333,11 +1333,11 @@  discard block
 block discarded – undo
1333 1333
 	}
1334 1334
 	
1335 1335
 	/**
1336
-	* Counts all trackers type that have flown over
1337
-	*
1338
-	* @return Integer the number of flights
1339
-	*
1340
-	*/
1336
+	 * Counts all trackers type that have flown over
1337
+	 *
1338
+	 * @return Integer the number of flights
1339
+	 *
1340
+	 */
1341 1341
 	public function countOverallTrackerTypes($filters = array(),$year = '',$month = '')
1342 1342
 	{
1343 1343
 		global $globalDBdriver;
@@ -1372,11 +1372,11 @@  discard block
 block discarded – undo
1372 1372
 	
1373 1373
   
1374 1374
 	/**
1375
-	* Counts all hours of today
1376
-	*
1377
-	* @return Array the hour list
1378
-	*
1379
-	*/
1375
+	 * Counts all hours of today
1376
+	 *
1377
+	 * @return Array the hour list
1378
+	 *
1379
+	 */
1380 1380
 	public function countAllHoursFromToday($filters = array())
1381 1381
 	{
1382 1382
 		global $globalTimezone, $globalDBdriver;
@@ -1416,12 +1416,12 @@  discard block
 block discarded – undo
1416 1416
 	}
1417 1417
     
1418 1418
     
1419
-     /**
1420
-	* Gets the Barrie Spotter ID based on the FlightAware ID
1421
-	*
1422
-	* @return Integer the Barrie Spotter ID
1419
+	 /**
1420
+	  * Gets the Barrie Spotter ID based on the FlightAware ID
1421
+	  *
1422
+	  * @return Integer the Barrie Spotter ID
1423 1423
 q	*
1424
-	*/
1424
+	  */
1425 1425
 	public function getTrackerIDBasedOnFamTrackID($famtrackid)
1426 1426
 	{
1427 1427
 		$famtrackid = filter_var($famtrackid,FILTER_SANITIZE_STRING);
@@ -1442,13 +1442,13 @@  discard block
 block discarded – undo
1442 1442
   
1443 1443
  
1444 1444
 	/**
1445
-	* Parses a date string
1446
-	*
1447
-	* @param String $dateString the date string
1448
-	* @param String $timezone the timezone of a user
1449
-	* @return Array the time information
1450
-	*
1451
-	*/
1445
+	 * Parses a date string
1446
+	 *
1447
+	 * @param String $dateString the date string
1448
+	 * @param String $timezone the timezone of a user
1449
+	 * @return Array the time information
1450
+	 *
1451
+	 */
1452 1452
 	public function parseDateString($dateString, $timezone = '')
1453 1453
 	{
1454 1454
 		$time_array = array();
@@ -1481,12 +1481,12 @@  discard block
 block discarded – undo
1481 1481
 	}
1482 1482
 	
1483 1483
 	/**
1484
-	* Parses the direction degrees to working
1485
-	*
1486
-	* @param Float $direction the direction in degrees
1487
-	* @return Array the direction information
1488
-	*
1489
-	*/
1484
+	 * Parses the direction degrees to working
1485
+	 *
1486
+	 * @param Float $direction the direction in degrees
1487
+	 * @return Array the direction information
1488
+	 *
1489
+	 */
1490 1490
 	public function parseDirection($direction = 0)
1491 1491
 	{
1492 1492
 		if ($direction == '') $direction = 0;
@@ -1565,12 +1565,12 @@  discard block
 block discarded – undo
1565 1565
 	
1566 1566
 	
1567 1567
 	/**
1568
-	* Gets Country from latitude/longitude
1569
-	*
1570
-	* @param Float $latitude latitute of the flight
1571
-	* @param Float $longitude longitute of the flight
1572
-	* @return String the countrie
1573
-	*/
1568
+	 * Gets Country from latitude/longitude
1569
+	 *
1570
+	 * @param Float $latitude latitute of the flight
1571
+	 * @param Float $longitude longitute of the flight
1572
+	 * @return String the countrie
1573
+	 */
1574 1574
 	public function getCountryFromLatitudeLongitude($latitude,$longitude)
1575 1575
 	{
1576 1576
 		global $globalDBdriver, $globalDebug;
@@ -1607,11 +1607,11 @@  discard block
 block discarded – undo
1607 1607
 	}
1608 1608
 
1609 1609
 	/**
1610
-	* Gets Country from iso2
1611
-	*
1612
-	* @param String $iso2 ISO2 country code
1613
-	* @return String the countrie
1614
-	*/
1610
+	 * Gets Country from iso2
1611
+	 *
1612
+	 * @param String $iso2 ISO2 country code
1613
+	 * @return String the countrie
1614
+	 */
1615 1615
 	public function getCountryFromISO2($iso2)
1616 1616
 	{
1617 1617
 		global $globalDBdriver, $globalDebug;
@@ -1639,11 +1639,11 @@  discard block
 block discarded – undo
1639 1639
 	}
1640 1640
 
1641 1641
 	/**
1642
-	* Gets all vessels types that have flown over
1643
-	*
1644
-	* @return Array the vessel type list
1645
-	*
1646
-	*/
1642
+	 * Gets all vessels types that have flown over
1643
+	 *
1644
+	 * @return Array the vessel type list
1645
+	 *
1646
+	 */
1647 1647
 	public function countAllTrackerTypes($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array(),$year = '',$month = '',$day = '')
1648 1648
 	{
1649 1649
 		global $globalDBdriver;
@@ -1708,11 +1708,11 @@  discard block
 block discarded – undo
1708 1708
 	}
1709 1709
 
1710 1710
 	/**
1711
-	* Gets all the tracker information
1712
-	*
1713
-	* @return Array the tracker information
1714
-	*
1715
-	*/
1711
+	 * Gets all the tracker information
1712
+	 *
1713
+	 * @return Array the tracker information
1714
+	 *
1715
+	 */
1716 1716
 	public function searchTrackerData($q = '', $callsign = '', $date_posted = '', $limit = '', $sort = '', $includegeodata = '',$origLat = '',$origLon = '',$dist = '',$filters = array())
1717 1717
 	{
1718 1718
 		global $globalTimezone, $globalDBdriver;
@@ -1817,12 +1817,12 @@  discard block
 block discarded – undo
1817 1817
 	}
1818 1818
 
1819 1819
 	/**
1820
-	* Gets the short url from bit.ly
1821
-	*
1822
-	* @param String $url the full url
1823
-	* @return String the bit.ly url
1824
-	*
1825
-	*/
1820
+	 * Gets the short url from bit.ly
1821
+	 *
1822
+	 * @param String $url the full url
1823
+	 * @return String the bit.ly url
1824
+	 *
1825
+	 */
1826 1826
 	public function getBitlyURL($url)
1827 1827
 	{
1828 1828
 		global $globalBitlyAccessToken;
Please login to merge, or discard this patch.