Completed
Push — master ( 1385f8...2c899b )
by Yannick
28:55 queued 01:47
created
require/class.TrackerArchive.php 1 patch
Indentation   +603 added lines, -603 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();
@@ -106,44 +106,44 @@  discard block
 block discarded – undo
106 106
 	}
107 107
 
108 108
 
109
-        /**
110
-        * Gets all the spotter information based on a particular callsign
111
-        *
112
-        * @return Array the spotter information
113
-        *
114
-        */
115
-        public function getLastArchiveTrackerDataByIdent($ident)
116
-        {
109
+		/**
110
+		 * Gets all the spotter information based on a particular callsign
111
+		 *
112
+		 * @return Array the spotter information
113
+		 *
114
+		 */
115
+		public function getLastArchiveTrackerDataByIdent($ident)
116
+		{
117 117
 		$Tracker = new Tracker($this->db);
118
-                date_default_timezone_set('UTC');
118
+				date_default_timezone_set('UTC');
119 119
 
120
-                $ident = filter_var($ident, FILTER_SANITIZE_STRING);
121
-                //$query  = "SELECT tracker_archive.* FROM tracker_archive INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_archive l WHERE l.ident = :ident GROUP BY l.famtrackid) s on tracker_archive.famtrackid = s.famtrackid AND tracker_archive.date = s.maxdate LIMIT 1";
122
-                $query  = "SELECT tracker_archive.* FROM tracker_archive WHERE ident = :ident ORDER BY date DESC LIMIT 1";
120
+				$ident = filter_var($ident, FILTER_SANITIZE_STRING);
121
+				//$query  = "SELECT tracker_archive.* FROM tracker_archive INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_archive l WHERE l.ident = :ident GROUP BY l.famtrackid) s on tracker_archive.famtrackid = s.famtrackid AND tracker_archive.date = s.maxdate LIMIT 1";
122
+				$query  = "SELECT tracker_archive.* FROM tracker_archive WHERE ident = :ident ORDER BY date DESC LIMIT 1";
123 123
 
124
-                $spotter_array = $Tracker->getDataFromDB($query,array(':ident' => $ident));
124
+				$spotter_array = $Tracker->getDataFromDB($query,array(':ident' => $ident));
125 125
 
126
-                return $spotter_array;
127
-        }
126
+				return $spotter_array;
127
+		}
128 128
 
129 129
 
130
-        /**
131
-        * Gets last the spotter information based on a particular id
132
-        *
133
-        * @return Array the spotter information
134
-        *
135
-        */
136
-        public function getLastArchiveTrackerDataById($id)
137
-        {
138
-    		$Tracker = new Tracker($this->db);
139
-                date_default_timezone_set('UTC');
140
-                $id = filter_var($id, FILTER_SANITIZE_STRING);
141
-                //$query  = TrackerArchive->$global_query." WHERE tracker_archive.famtrackid = :id";
142
-                //$query  = "SELECT tracker_archive.* FROM tracker_archive INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_archive l WHERE l.famtrackid = :id GROUP BY l.famtrackid) s on tracker_archive.famtrackid = s.famtrackid AND tracker_archive.date = s.maxdate LIMIT 1";
143
-                $query  = "SELECT * FROM tracker_archive WHERE famtrackid = :id ORDER BY date DESC LIMIT 1";
130
+		/**
131
+		 * Gets last the spotter information based on a particular id
132
+		 *
133
+		 * @return Array the spotter information
134
+		 *
135
+		 */
136
+		public function getLastArchiveTrackerDataById($id)
137
+		{
138
+			$Tracker = new Tracker($this->db);
139
+				date_default_timezone_set('UTC');
140
+				$id = filter_var($id, FILTER_SANITIZE_STRING);
141
+				//$query  = TrackerArchive->$global_query." WHERE tracker_archive.famtrackid = :id";
142
+				//$query  = "SELECT tracker_archive.* FROM tracker_archive INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_archive l WHERE l.famtrackid = :id GROUP BY l.famtrackid) s on tracker_archive.famtrackid = s.famtrackid AND tracker_archive.date = s.maxdate LIMIT 1";
143
+				$query  = "SELECT * FROM tracker_archive WHERE famtrackid = :id ORDER BY date DESC LIMIT 1";
144 144
 
145 145
 //              $spotter_array = Tracker->getDataFromDB($query,array(':id' => $id));
146
-                  /*
146
+				  /*
147 147
                 try {
148 148
                         $Connection = new Connection();
149 149
                         $sth = Connection->$db->prepare($query);
@@ -153,232 +153,232 @@  discard block
 block discarded – undo
153 153
                 }
154 154
                 $spotter_array = $sth->fetchAll(PDO->FETCH_ASSOC);
155 155
                 */
156
-                $spotter_array = $Tracker->getDataFromDB($query,array(':id' => $id));
157
-
158
-                return $spotter_array;
159
-        }
160
-
161
-        /**
162
-        * Gets all the spotter information based on a particular id
163
-        *
164
-        * @return Array the spotter information
165
-        *
166
-        */
167
-        public function getAllArchiveTrackerDataById($id)
156
+				$spotter_array = $Tracker->getDataFromDB($query,array(':id' => $id));
157
+
158
+				return $spotter_array;
159
+		}
160
+
161
+		/**
162
+		 * Gets all the spotter information based on a particular id
163
+		 *
164
+		 * @return Array the spotter information
165
+		 *
166
+		 */
167
+		public function getAllArchiveTrackerDataById($id)
168 168
 	{
169
-                date_default_timezone_set('UTC');
170
-                $id = filter_var($id, FILTER_SANITIZE_STRING);
171
-                $query  = $this->global_query." WHERE tracker_archive.famtrackid = :id ORDER BY date";
169
+				date_default_timezone_set('UTC');
170
+				$id = filter_var($id, FILTER_SANITIZE_STRING);
171
+				$query  = $this->global_query." WHERE tracker_archive.famtrackid = :id ORDER BY date";
172 172
 
173 173
 //              $spotter_array = Tracker->getDataFromDB($query,array(':id' => $id));
174 174
 
175
-                try {
176
-                        $sth = $this->db->prepare($query);
177
-                        $sth->execute(array(':id' => $id));
178
-                } catch(PDOException $e) {
179
-                        echo $e->getMessage();
180
-                        die;
181
-                }
182
-                $spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC);
183
-
184
-                return $spotter_array;
185
-        }
186
-
187
-        /**
188
-        * Gets coordinate & time spotter information based on a particular id
189
-        *
190
-        * @return Array the spotter information
191
-        *
192
-        */
193
-        public function getCoordArchiveTrackerDataById($id)
194
-        {
195
-                date_default_timezone_set('UTC');
196
-                $id = filter_var($id, FILTER_SANITIZE_STRING);
197
-                $query  = "SELECT tracker_archive.latitude, tracker_archive.longitude, tracker_archive.date FROM tracker_archive WHERE tracker_archive.famtrackid = :id";
175
+				try {
176
+						$sth = $this->db->prepare($query);
177
+						$sth->execute(array(':id' => $id));
178
+				} catch(PDOException $e) {
179
+						echo $e->getMessage();
180
+						die;
181
+				}
182
+				$spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC);
183
+
184
+				return $spotter_array;
185
+		}
186
+
187
+		/**
188
+		 * Gets coordinate & time spotter information based on a particular id
189
+		 *
190
+		 * @return Array the spotter information
191
+		 *
192
+		 */
193
+		public function getCoordArchiveTrackerDataById($id)
194
+		{
195
+				date_default_timezone_set('UTC');
196
+				$id = filter_var($id, FILTER_SANITIZE_STRING);
197
+				$query  = "SELECT tracker_archive.latitude, tracker_archive.longitude, tracker_archive.date FROM tracker_archive WHERE tracker_archive.famtrackid = :id";
198 198
 
199 199
 //              $spotter_array = Tracker->getDataFromDB($query,array(':id' => $id));
200 200
 
201
-                try {
202
-                        $sth = $this->db->prepare($query);
203
-                        $sth->execute(array(':id' => $id));
204
-                } catch(PDOException $e) {
205
-                        echo $e->getMessage();
206
-                        die;
207
-                }
208
-                $spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC);
201
+				try {
202
+						$sth = $this->db->prepare($query);
203
+						$sth->execute(array(':id' => $id));
204
+				} catch(PDOException $e) {
205
+						echo $e->getMessage();
206
+						die;
207
+				}
208
+				$spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC);
209 209
 
210
-                return $spotter_array;
211
-        }
210
+				return $spotter_array;
211
+		}
212 212
 
213 213
 
214
-        /**
215
-        * Gets altitude information based on a particular callsign
216
-        *
217
-        * @return Array the spotter information
218
-        *
219
-        */
220
-        public function getAltitudeArchiveTrackerDataByIdent($ident)
221
-        {
214
+		/**
215
+		 * Gets altitude information based on a particular callsign
216
+		 *
217
+		 * @return Array the spotter information
218
+		 *
219
+		 */
220
+		public function getAltitudeArchiveTrackerDataByIdent($ident)
221
+		{
222 222
 
223
-                date_default_timezone_set('UTC');
223
+				date_default_timezone_set('UTC');
224 224
 
225
-                $ident = filter_var($ident, FILTER_SANITIZE_STRING);
226
-                $query  = "SELECT tracker_archive.altitude, tracker_archive.date FROM tracker_archive WHERE tracker_archive.ident = :ident AND tracker_archive.latitude <> 0 AND tracker_archive.longitude <> 0 ORDER BY date";
225
+				$ident = filter_var($ident, FILTER_SANITIZE_STRING);
226
+				$query  = "SELECT tracker_archive.altitude, tracker_archive.date FROM tracker_archive WHERE tracker_archive.ident = :ident AND tracker_archive.latitude <> 0 AND tracker_archive.longitude <> 0 ORDER BY date";
227 227
 
228
-                try {
229
-                        $sth = $this->db->prepare($query);
230
-                        $sth->execute(array(':ident' => $ident));
231
-                } catch(PDOException $e) {
232
-                        echo $e->getMessage();
233
-                        die;
234
-                }
235
-                $spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC);
228
+				try {
229
+						$sth = $this->db->prepare($query);
230
+						$sth->execute(array(':ident' => $ident));
231
+				} catch(PDOException $e) {
232
+						echo $e->getMessage();
233
+						die;
234
+				}
235
+				$spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC);
236 236
 
237
-                return $spotter_array;
238
-        }
237
+				return $spotter_array;
238
+		}
239 239
 
240
-        /**
241
-        * Gets altitude information based on a particular id
242
-        *
243
-        * @return Array the spotter information
244
-        *
245
-        */
246
-        public function getAltitudeArchiveTrackerDataById($id)
247
-        {
240
+		/**
241
+		 * Gets altitude information based on a particular id
242
+		 *
243
+		 * @return Array the spotter information
244
+		 *
245
+		 */
246
+		public function getAltitudeArchiveTrackerDataById($id)
247
+		{
248 248
 
249
-                date_default_timezone_set('UTC');
249
+				date_default_timezone_set('UTC');
250 250
 
251
-                $id = filter_var($id, FILTER_SANITIZE_STRING);
252
-                $query  = "SELECT tracker_archive.altitude, tracker_archive.date FROM tracker_archive WHERE tracker_archive.famtrackid = :id AND tracker_archive.latitude <> 0 AND tracker_archive.longitude <> 0 ORDER BY date";
251
+				$id = filter_var($id, FILTER_SANITIZE_STRING);
252
+				$query  = "SELECT tracker_archive.altitude, tracker_archive.date FROM tracker_archive WHERE tracker_archive.famtrackid = :id AND tracker_archive.latitude <> 0 AND tracker_archive.longitude <> 0 ORDER BY date";
253 253
 
254
-                try {
255
-                        $sth = $this->db->prepare($query);
256
-                        $sth->execute(array(':id' => $id));
257
-                } catch(PDOException $e) {
258
-                        echo $e->getMessage();
259
-                        die;
260
-                }
261
-                $spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC);
254
+				try {
255
+						$sth = $this->db->prepare($query);
256
+						$sth->execute(array(':id' => $id));
257
+				} catch(PDOException $e) {
258
+						echo $e->getMessage();
259
+						die;
260
+				}
261
+				$spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC);
262 262
 
263
-                return $spotter_array;
264
-        }
263
+				return $spotter_array;
264
+		}
265 265
 
266
-        /**
267
-        * Gets altitude & speed information based on a particular id
268
-        *
269
-        * @return Array the spotter information
270
-        *
271
-        */
272
-        public function getAltitudeSpeedArchiveTrackerDataById($id)
273
-        {
266
+		/**
267
+		 * Gets altitude & speed information based on a particular id
268
+		 *
269
+		 * @return Array the spotter information
270
+		 *
271
+		 */
272
+		public function getAltitudeSpeedArchiveTrackerDataById($id)
273
+		{
274 274
 
275
-                date_default_timezone_set('UTC');
275
+				date_default_timezone_set('UTC');
276 276
 
277
-                $id = filter_var($id, FILTER_SANITIZE_STRING);
278
-                $query  = "SELECT tracker_archive.altitude, tracker_archive.ground_speed, tracker_archive.date FROM tracker_archive WHERE tracker_archive.famtrackid = :id ORDER BY date";
277
+				$id = filter_var($id, FILTER_SANITIZE_STRING);
278
+				$query  = "SELECT tracker_archive.altitude, tracker_archive.ground_speed, tracker_archive.date FROM tracker_archive WHERE tracker_archive.famtrackid = :id ORDER BY date";
279 279
 
280
-                try {
281
-                        $sth = $this->db->prepare($query);
282
-                        $sth->execute(array(':id' => $id));
283
-                } catch(PDOException $e) {
284
-                        echo $e->getMessage();
285
-                        die;
286
-                }
287
-                $spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC);
280
+				try {
281
+						$sth = $this->db->prepare($query);
282
+						$sth->execute(array(':id' => $id));
283
+				} catch(PDOException $e) {
284
+						echo $e->getMessage();
285
+						die;
286
+				}
287
+				$spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC);
288 288
 
289
-                return $spotter_array;
290
-        }
289
+				return $spotter_array;
290
+		}
291 291
 
292 292
 
293
-        /**
294
-        * Gets altitude information based on a particular callsign
295
-        *
296
-        * @return Array the spotter information
297
-        *
298
-        */
299
-        public function getLastAltitudeArchiveTrackerDataByIdent($ident)
300
-        {
293
+		/**
294
+		 * Gets altitude information based on a particular callsign
295
+		 *
296
+		 * @return Array the spotter information
297
+		 *
298
+		 */
299
+		public function getLastAltitudeArchiveTrackerDataByIdent($ident)
300
+		{
301 301
 
302
-                date_default_timezone_set('UTC');
302
+				date_default_timezone_set('UTC');
303 303
 
304
-                $ident = filter_var($ident, FILTER_SANITIZE_STRING);
305
-                $query  = "SELECT tracker_archive.altitude, tracker_archive.date FROM tracker_archive INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_archive l WHERE l.ident = :ident GROUP BY l.famtrackid) s on tracker_archive.famtrackid = s.famtrackid AND tracker_archive.date = s.maxdate LIMIT 1";
304
+				$ident = filter_var($ident, FILTER_SANITIZE_STRING);
305
+				$query  = "SELECT tracker_archive.altitude, tracker_archive.date FROM tracker_archive INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_archive l WHERE l.ident = :ident GROUP BY l.famtrackid) s on tracker_archive.famtrackid = s.famtrackid AND tracker_archive.date = s.maxdate LIMIT 1";
306 306
 //                $query  = "SELECT tracker_archive.altitude, tracker_archive.date FROM tracker_archive WHERE tracker_archive.ident = :ident";
307 307
 
308
-                try {
309
-                        $sth = $this->db->prepare($query);
310
-                        $sth->execute(array(':ident' => $ident));
311
-                } catch(PDOException $e) {
312
-                        echo $e->getMessage();
313
-                        die;
314
-                }
315
-                $spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC);
308
+				try {
309
+						$sth = $this->db->prepare($query);
310
+						$sth->execute(array(':ident' => $ident));
311
+				} catch(PDOException $e) {
312
+						echo $e->getMessage();
313
+						die;
314
+				}
315
+				$spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC);
316 316
 
317
-                return $spotter_array;
318
-        }
317
+				return $spotter_array;
318
+		}
319 319
 
320 320
 
321 321
 
322
-       /**
323
-        * Gets all the archive spotter information
324
-        *
325
-        * @return Array the spotter information
326
-        *
327
-        */
328
-        public function getTrackerArchiveData($ident,$famtrackid,$date)
329
-        {
330
-    		$Tracker = new Tracker($this->db);
331
-                $ident = filter_var($ident, FILTER_SANITIZE_STRING);
332
-                $query  = "SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM spotter_live l WHERE l.ident = :ident AND l.famtrackid = :famtrackid AND l.date LIKE :date GROUP BY l.famtrackid) s on spotter_live.famtrackid = s.famtrackid AND spotter_live.date = s.maxdate";
322
+	   /**
323
+	    * Gets all the archive spotter information
324
+	    *
325
+	    * @return Array the spotter information
326
+	    *
327
+	    */
328
+		public function getTrackerArchiveData($ident,$famtrackid,$date)
329
+		{
330
+			$Tracker = new Tracker($this->db);
331
+				$ident = filter_var($ident, FILTER_SANITIZE_STRING);
332
+				$query  = "SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM spotter_live l WHERE l.ident = :ident AND l.famtrackid = :famtrackid AND l.date LIKE :date GROUP BY l.famtrackid) s on spotter_live.famtrackid = s.famtrackid AND spotter_live.date = s.maxdate";
333 333
 
334
-                $spotter_array = $Tracker->getDataFromDB($query,array(':ident' => $ident,':famtrackid' => $famtrackid,':date' => $date.'%'));
334
+				$spotter_array = $Tracker->getDataFromDB($query,array(':ident' => $ident,':famtrackid' => $famtrackid,':date' => $date.'%'));
335 335
 
336
-                return $spotter_array;
337
-        }
336
+				return $spotter_array;
337
+		}
338 338
         
339
-        public function deleteTrackerArchiveTrackData()
340
-        {
339
+		public function deleteTrackerArchiveTrackData()
340
+		{
341 341
 		global $globalArchiveKeepTrackMonths;
342
-                date_default_timezone_set('UTC');
342
+				date_default_timezone_set('UTC');
343 343
 		$query = 'DELETE FROM tracker_archive WHERE tracker_archive.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$globalArchiveKeepTrackMonths.' MONTH)';
344
-                try {
345
-                        $sth = $this->db->prepare($query);
346
-                        $sth->execute();
347
-                } catch(PDOException $e) {
348
-                        echo $e->getMessage();
349
-                        die;
350
-                }
344
+				try {
345
+						$sth = $this->db->prepare($query);
346
+						$sth->execute();
347
+				} catch(PDOException $e) {
348
+						echo $e->getMessage();
349
+						die;
350
+				}
351 351
 	}
352 352
 
353 353
 	/**
354
-        * Gets Minimal Live Tracker data
355
-        *
356
-        * @return Array the spotter information
357
-        *
358
-        */
359
-        public function getMinLiveTrackerData($begindate,$enddate,$filter = array())
360
-        {
361
-                global $globalDBdriver, $globalLiveInterval;
362
-                date_default_timezone_set('UTC');
363
-
364
-                $filter_query = '';
365
-                if (isset($filter['source']) && !empty($filter['source'])) {
366
-                        $filter_query .= " AND format_source IN ('".implode("','",$filter['source'])."') ";
367
-                }
368
-                // Use spotter_output also ?
369
-                if (isset($filter['airlines']) && !empty($filter['airlines'])) {
370
-                        $filter_query .= " INNER JOIN (SELECT famtrackid FROM tracker_archive_output WHERE tracker_archive_output.airline_icao IN ('".implode("','",$filter['airlines'])."')) so ON so.famtrackid = tracker_archive.famtrackid ";
371
-                }
372
-                if (isset($filter['airlinestype']) && !empty($filter['airlinestype'])) {
373
-                        $filter_query .= " INNER JOIN (SELECT famtrackid FROM tracker_archive_output WHERE tracker_archive_output.airline_type = '".$filter['airlinestype']."') sa ON sa.famtrackid = tracker_archive.famtrackid ";
374
-                }
375
-                if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) {
376
-                        $filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')";
377
-                }
354
+	 * Gets Minimal Live Tracker data
355
+	 *
356
+	 * @return Array the spotter information
357
+	 *
358
+	 */
359
+		public function getMinLiveTrackerData($begindate,$enddate,$filter = array())
360
+		{
361
+				global $globalDBdriver, $globalLiveInterval;
362
+				date_default_timezone_set('UTC');
363
+
364
+				$filter_query = '';
365
+				if (isset($filter['source']) && !empty($filter['source'])) {
366
+						$filter_query .= " AND format_source IN ('".implode("','",$filter['source'])."') ";
367
+				}
368
+				// Use spotter_output also ?
369
+				if (isset($filter['airlines']) && !empty($filter['airlines'])) {
370
+						$filter_query .= " INNER JOIN (SELECT famtrackid FROM tracker_archive_output WHERE tracker_archive_output.airline_icao IN ('".implode("','",$filter['airlines'])."')) so ON so.famtrackid = tracker_archive.famtrackid ";
371
+				}
372
+				if (isset($filter['airlinestype']) && !empty($filter['airlinestype'])) {
373
+						$filter_query .= " INNER JOIN (SELECT famtrackid FROM tracker_archive_output WHERE tracker_archive_output.airline_type = '".$filter['airlinestype']."') sa ON sa.famtrackid = tracker_archive.famtrackid ";
374
+				}
375
+				if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) {
376
+						$filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')";
377
+				}
378 378
 
379
-                //if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
380
-                if ($globalDBdriver == 'mysql') {
381
-                        /*
379
+				//if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
380
+				if ($globalDBdriver == 'mysql') {
381
+						/*
382 382
                         $query  = 'SELECT a.aircraft_shadow, tracker_archive.ident, tracker_archive.famtrackid, tracker_archive.aircraft_icao, tracker_archive.departure_airport_icao as departure_airport, tracker_archive.arrival_airport_icao as arrival_airport, tracker_archive.latitude, tracker_archive.longitude, tracker_archive.altitude, tracker_archive.heading, tracker_archive.ground_speed, tracker_archive.squawk 
383 383
                     		    FROM tracker_archive 
384 384
                     		    INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_archive l WHERE (l.date BETWEEN '."'".$begindate."'".' AND '."'".$enddate."'".') GROUP BY l.famtrackid) s on tracker_archive.famtrackid = s.famtrackid AND tracker_archive.date = s.maxdate '.$filter_query.'LEFT JOIN (SELECT aircraft_shadow,icao FROM aircraft) a ON tracker_archive.aircraft_icao = a.icao';
@@ -397,56 +397,56 @@  discard block
 block discarded – undo
397 397
 				    INNER JOIN (SELECT * FROM aircraft) a on tracker_archive.aircraft_icao = a.icao
398 398
 				    WHERE tracker_archive.date BETWEEN '."'".$begindate."'".' AND '."'".$begindate."'".' 
399 399
                         	    '.$filter_query.' ORDER BY famtrackid';
400
-                } else {
401
-                        //$query  = 'SELECT tracker_archive.ident, tracker_archive.famtrackid, tracker_archive.aircraft_icao, tracker_archive.departure_airport_icao as departure_airport, tracker_archive.arrival_airport_icao as arrival_airport, tracker_archive.latitude, tracker_archive.longitude, tracker_archive.altitude, tracker_archive.heading, tracker_archive.ground_speed, tracker_archive.squawk, a.aircraft_shadow FROM tracker_archive INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_archive l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.famtrackid) s on tracker_archive.famtrackid = s.famtrackid AND tracker_archive.date = s.maxdate '.$filter_query.'INNER JOIN (SELECT * FROM aircraft) a on tracker_archive.aircraft_icao = a.icao';
402
-                        $query  = 'SELECT tracker_archive.date,tracker_archive.famtrackid, tracker_archive.ident, tracker_archive.aircraft_icao, tracker_archive.departure_airport_icao as departure_airport, tracker_archive.arrival_airport_icao as arrival_airport, tracker_archive.latitude, tracker_archive.longitude, tracker_archive.altitude, tracker_archive.heading, tracker_archive.ground_speed, tracker_archive.squawk, a.aircraft_shadow,a.engine_type, a.engine_count, a.wake_category 
400
+				} else {
401
+						//$query  = 'SELECT tracker_archive.ident, tracker_archive.famtrackid, tracker_archive.aircraft_icao, tracker_archive.departure_airport_icao as departure_airport, tracker_archive.arrival_airport_icao as arrival_airport, tracker_archive.latitude, tracker_archive.longitude, tracker_archive.altitude, tracker_archive.heading, tracker_archive.ground_speed, tracker_archive.squawk, a.aircraft_shadow FROM tracker_archive INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_archive l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.famtrackid) s on tracker_archive.famtrackid = s.famtrackid AND tracker_archive.date = s.maxdate '.$filter_query.'INNER JOIN (SELECT * FROM aircraft) a on tracker_archive.aircraft_icao = a.icao';
402
+						$query  = 'SELECT tracker_archive.date,tracker_archive.famtrackid, tracker_archive.ident, tracker_archive.aircraft_icao, tracker_archive.departure_airport_icao as departure_airport, tracker_archive.arrival_airport_icao as arrival_airport, tracker_archive.latitude, tracker_archive.longitude, tracker_archive.altitude, tracker_archive.heading, tracker_archive.ground_speed, tracker_archive.squawk, a.aircraft_shadow,a.engine_type, a.engine_count, a.wake_category 
403 403
                         	    FROM tracker_archive 
404 404
                         	    INNER JOIN (SELECT * FROM aircraft) a on tracker_archive.aircraft_icao = a.icao
405 405
                         	    WHERE tracker_archive.date >= '."'".$begindate."'".' AND tracker_archive.date <= '."'".$enddate."'".'
406 406
                         	    '.$filter_query.' ORDER BY famtrackid';
407
-                }
408
-                //echo $query;
409
-                try {
410
-                        $sth = $this->db->prepare($query);
411
-                        $sth->execute();
412
-                } catch(PDOException $e) {
413
-                        echo $e->getMessage();
414
-                        die;
415
-                }
416
-                $spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC);
407
+				}
408
+				//echo $query;
409
+				try {
410
+						$sth = $this->db->prepare($query);
411
+						$sth->execute();
412
+				} catch(PDOException $e) {
413
+						echo $e->getMessage();
414
+						die;
415
+				}
416
+				$spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC);
417 417
 
418
-                return $spotter_array;
419
-        }
418
+				return $spotter_array;
419
+		}
420 420
 
421 421
 	/**
422
-        * Gets Minimal Live Tracker data
423
-        *
424
-        * @return Array the spotter information
425
-        *
426
-        */
427
-        public function getMinLiveTrackerDataPlayback($begindate,$enddate,$filter = array())
428
-        {
429
-                global $globalDBdriver, $globalLiveInterval;
430
-                date_default_timezone_set('UTC');
431
-
432
-                $filter_query = '';
433
-                if (isset($filter['source']) && !empty($filter['source'])) {
434
-                        $filter_query .= " AND format_source IN ('".implode("','",$filter['source'])."') ";
435
-                }
436
-                // Should use spotter_output also ?
437
-                if (isset($filter['airlines']) && !empty($filter['airlines'])) {
438
-                        $filter_query .= " INNER JOIN (SELECT famtrackid FROM tracker_archive_output WHERE tracker_archive_output.airline_icao IN ('".implode("','",$filter['airlines'])."')) so ON so.famtrackid = tracker_archive.famtrackid ";
439
-                }
440
-                if (isset($filter['airlinestype']) && !empty($filter['airlinestype'])) {
441
-                        $filter_query .= " INNER JOIN (SELECT famtrackid FROM tracker_archive_output WHERE tracker_archive_output.airline_type = '".$filter['airlinestype']."') sa ON sa.famtrackid = tracker_archive.famtrackid ";
442
-                }
443
-                if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) {
444
-                        $filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')";
445
-                }
422
+	 * Gets Minimal Live Tracker data
423
+	 *
424
+	 * @return Array the spotter information
425
+	 *
426
+	 */
427
+		public function getMinLiveTrackerDataPlayback($begindate,$enddate,$filter = array())
428
+		{
429
+				global $globalDBdriver, $globalLiveInterval;
430
+				date_default_timezone_set('UTC');
431
+
432
+				$filter_query = '';
433
+				if (isset($filter['source']) && !empty($filter['source'])) {
434
+						$filter_query .= " AND format_source IN ('".implode("','",$filter['source'])."') ";
435
+				}
436
+				// Should use spotter_output also ?
437
+				if (isset($filter['airlines']) && !empty($filter['airlines'])) {
438
+						$filter_query .= " INNER JOIN (SELECT famtrackid FROM tracker_archive_output WHERE tracker_archive_output.airline_icao IN ('".implode("','",$filter['airlines'])."')) so ON so.famtrackid = tracker_archive.famtrackid ";
439
+				}
440
+				if (isset($filter['airlinestype']) && !empty($filter['airlinestype'])) {
441
+						$filter_query .= " INNER JOIN (SELECT famtrackid FROM tracker_archive_output WHERE tracker_archive_output.airline_type = '".$filter['airlinestype']."') sa ON sa.famtrackid = tracker_archive.famtrackid ";
442
+				}
443
+				if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) {
444
+						$filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')";
445
+				}
446 446
 
447
-                //if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
448
-                if ($globalDBdriver == 'mysql') {
449
-                        /*
447
+				//if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
448
+				if ($globalDBdriver == 'mysql') {
449
+						/*
450 450
                         $query  = 'SELECT a.aircraft_shadow, tracker_archive.ident, tracker_archive.famtrackid, tracker_archive.aircraft_icao, tracker_archive.departure_airport_icao as departure_airport, tracker_archive.arrival_airport_icao as arrival_airport, tracker_archive.latitude, tracker_archive.longitude, tracker_archive.altitude, tracker_archive.heading, tracker_archive.ground_speed, tracker_archive.squawk 
451 451
                     		    FROM tracker_archive 
452 452
                     		    INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_archive l WHERE (l.date BETWEEN '."'".$begindate."'".' AND '."'".$enddate."'".') GROUP BY l.famtrackid) s on tracker_archive.famtrackid = s.famtrackid AND tracker_archive.date = s.maxdate '.$filter_query.'LEFT JOIN (SELECT aircraft_shadow,icao FROM aircraft) a ON tracker_archive.aircraft_icao = a.icao';
@@ -457,95 +457,95 @@  discard block
 block discarded – undo
457 457
 				    WHERE (tracker_archive_output.date BETWEEN '."'".$begindate."'".' AND '."'".$enddate."'".') 
458 458
                         	    '.$filter_query.' GROUP BY tracker_archive_output.famtrackid, tracker_archive_output.ident, tracker_archive_output.aircraft_icao, tracker_archive_output.departure_airport_icao, tracker_archive_output.arrival_airport_icao, tracker_archive_output.latitude, tracker_archive_output.longitude, tracker_archive_output.altitude, tracker_archive_output.heading, tracker_archive_output.ground_speed, tracker_archive_output.squawk, a.aircraft_shadow';
459 459
 
460
-                } else {
461
-                        //$query  = 'SELECT tracker_archive_output.ident, tracker_archive_output.famtrackid, tracker_archive_output.aircraft_icao, tracker_archive_output.departure_airport_icao as departure_airport, tracker_archive_output.arrival_airport_icao as arrival_airport, tracker_archive_output.latitude, tracker_archive_output.longitude, tracker_archive_output.altitude, tracker_archive_output.heading, tracker_archive_output.ground_speed, tracker_archive_output.squawk, a.aircraft_shadow FROM tracker_archive_output INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_archive_output l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.famtrackid) s on tracker_archive_output.famtrackid = s.famtrackid AND tracker_archive_output.date = s.maxdate '.$filter_query.'INNER JOIN (SELECT * FROM aircraft) a on tracker_archive_output.aircraft_icao = a.icao';
462
-                       /*
460
+				} else {
461
+						//$query  = 'SELECT tracker_archive_output.ident, tracker_archive_output.famtrackid, tracker_archive_output.aircraft_icao, tracker_archive_output.departure_airport_icao as departure_airport, tracker_archive_output.arrival_airport_icao as arrival_airport, tracker_archive_output.latitude, tracker_archive_output.longitude, tracker_archive_output.altitude, tracker_archive_output.heading, tracker_archive_output.ground_speed, tracker_archive_output.squawk, a.aircraft_shadow FROM tracker_archive_output INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_archive_output l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.famtrackid) s on tracker_archive_output.famtrackid = s.famtrackid AND tracker_archive_output.date = s.maxdate '.$filter_query.'INNER JOIN (SELECT * FROM aircraft) a on tracker_archive_output.aircraft_icao = a.icao';
462
+					   /*
463 463
                         $query  = 'SELECT tracker_archive_output.ident, tracker_archive_output.famtrackid, tracker_archive_output.aircraft_icao, tracker_archive_output.departure_airport_icao as departure_airport, tracker_archive_output.arrival_airport_icao as arrival_airport, tracker_archive_output.latitude, tracker_archive_output.longitude, tracker_archive_output.altitude, tracker_archive_output.heading, tracker_archive_output.ground_speed, tracker_archive_output.squawk, a.aircraft_shadow
464 464
                         	    FROM tracker_archive_output 
465 465
                         	    INNER JOIN (SELECT * FROM aircraft) a on tracker_archive_output.aircraft_icao = a.icao
466 466
                         	    WHERE tracker_archive_output.date >= '."'".$begindate."'".' AND tracker_archive_output.date <= '."'".$enddate."'".'
467 467
                         	    '.$filter_query.' GROUP BY tracker_archive_output.famtrackid, tracker_archive_output.ident, tracker_archive_output.aircraft_icao, tracker_archive_output.departure_airport_icao, tracker_archive_output.arrival_airport_icao, tracker_archive_output.latitude, tracker_archive_output.longitude, tracker_archive_output.altitude, tracker_archive_output.heading, tracker_archive_output.ground_speed, tracker_archive_output.squawk, a.aircraft_shadow';
468 468
                         */
469
-                        $query  = 'SELECT DISTINCT tracker_archive_output.famtrackid, tracker_archive_output.ident, tracker_archive_output.aircraft_icao, tracker_archive_output.departure_airport_icao as departure_airport, tracker_archive_output.arrival_airport_icao as arrival_airport, tracker_archive_output.latitude, tracker_archive_output.longitude, tracker_archive_output.altitude, tracker_archive_output.heading, tracker_archive_output.ground_speed, tracker_archive_output.squawk, a.aircraft_shadow
469
+						$query  = 'SELECT DISTINCT tracker_archive_output.famtrackid, tracker_archive_output.ident, tracker_archive_output.aircraft_icao, tracker_archive_output.departure_airport_icao as departure_airport, tracker_archive_output.arrival_airport_icao as arrival_airport, tracker_archive_output.latitude, tracker_archive_output.longitude, tracker_archive_output.altitude, tracker_archive_output.heading, tracker_archive_output.ground_speed, tracker_archive_output.squawk, a.aircraft_shadow
470 470
                         	    FROM tracker_archive_output 
471 471
                         	    INNER JOIN (SELECT * FROM aircraft) a on tracker_archive_output.aircraft_icao = a.icao
472 472
                         	    WHERE tracker_archive_output.date >= '."'".$begindate."'".' AND tracker_archive_output.date <= '."'".$enddate."'".'
473 473
                         	    '.$filter_query.' LIMIT 200 OFFSET 0';
474 474
 //                        	    .' GROUP BY spotter_output.famtrackid, spotter_output.ident, spotter_output.aircraft_icao, spotter_output.departure_airport_icao, spotter_output.arrival_airport_icao, spotter_output.latitude, spotter_output.longitude, spotter_output.altitude, spotter_output.heading, spotter_output.ground_speed, spotter_output.squawk, a.aircraft_shadow';
475 475
                         	    
476
-                }
477
-                //echo $query;
478
-                try {
479
-                        $sth = $this->db->prepare($query);
480
-                        $sth->execute();
481
-                } catch(PDOException $e) {
482
-                        echo $e->getMessage();
483
-                        die;
484
-                }
485
-                $spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC);
476
+				}
477
+				//echo $query;
478
+				try {
479
+						$sth = $this->db->prepare($query);
480
+						$sth->execute();
481
+				} catch(PDOException $e) {
482
+						echo $e->getMessage();
483
+						die;
484
+				}
485
+				$spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC);
486 486
 
487
-                return $spotter_array;
488
-        }
487
+				return $spotter_array;
488
+		}
489 489
 
490 490
 	 /**
491
-        * Gets count Live Tracker data
492
-        *
493
-        * @return Array the spotter information
494
-        *
495
-        */
496
-        public function getLiveTrackerCount($begindate,$enddate,$filter = array())
497
-        {
498
-                global $globalDBdriver, $globalLiveInterval;
499
-                date_default_timezone_set('UTC');
500
-
501
-                $filter_query = '';
502
-                if (isset($filter['source']) && !empty($filter['source'])) {
503
-                        $filter_query .= " AND format_source IN ('".implode("','",$filter['source'])."') ";
504
-                }
505
-                if (isset($filter['airlines']) && !empty($filter['airlines'])) {
506
-                        $filter_query .= " INNER JOIN (SELECT famtrackid FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','",$filter['airlines'])."')) so ON so.famtrackid = tracker_archive.famtrackid ";
507
-                }
508
-                if (isset($filter['airlinestype']) && !empty($filter['airlinestype'])) {
509
-                        $filter_query .= " INNER JOIN (SELECT famtrackid FROM spotter_output WHERE spotter_output.airline_type = '".$filter['airlinestype']."') sa ON sa.famtrackid = tracker_archive.famtrackid ";
510
-                }
511
-                if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) {
512
-                        $filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')";
513
-                }
491
+	  * Gets count Live Tracker data
492
+	  *
493
+	  * @return Array the spotter information
494
+	  *
495
+	  */
496
+		public function getLiveTrackerCount($begindate,$enddate,$filter = array())
497
+		{
498
+				global $globalDBdriver, $globalLiveInterval;
499
+				date_default_timezone_set('UTC');
514 500
 
515
-                //if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
516
-                if ($globalDBdriver == 'mysql') {
501
+				$filter_query = '';
502
+				if (isset($filter['source']) && !empty($filter['source'])) {
503
+						$filter_query .= " AND format_source IN ('".implode("','",$filter['source'])."') ";
504
+				}
505
+				if (isset($filter['airlines']) && !empty($filter['airlines'])) {
506
+						$filter_query .= " INNER JOIN (SELECT famtrackid FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','",$filter['airlines'])."')) so ON so.famtrackid = tracker_archive.famtrackid ";
507
+				}
508
+				if (isset($filter['airlinestype']) && !empty($filter['airlinestype'])) {
509
+						$filter_query .= " INNER JOIN (SELECT famtrackid FROM spotter_output WHERE spotter_output.airline_type = '".$filter['airlinestype']."') sa ON sa.famtrackid = tracker_archive.famtrackid ";
510
+				}
511
+				if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) {
512
+						$filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')";
513
+				}
514
+
515
+				//if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
516
+				if ($globalDBdriver == 'mysql') {
517 517
 			$query = 'SELECT COUNT(DISTINCT famtrackid) as nb 
518 518
 			FROM tracker_archive l 
519 519
 			WHERE (l.date BETWEEN DATE_SUB('."'".$begindate."'".',INTERVAL '.$globalLiveInterval.' SECOND) AND '."'".$begindate."'".')'.$filter_query;
520
-                } else {
520
+				} else {
521 521
 			$query = 'SELECT COUNT(DISTINCT famtrackid) as nb FROM tracker_archive l WHERE (l.date BETWEEN '."'".$begindate."' - INTERVAL '".$globalLiveInterval." SECONDS' AND "."'".$enddate."'".')'.$filter_query;
522
-                }
523
-                //echo $query;
524
-                try {
525
-                        $sth = $this->db->prepare($query);
526
-                        $sth->execute();
527
-                } catch(PDOException $e) {
528
-                        echo $e->getMessage();
529
-                        die;
530
-                }
522
+				}
523
+				//echo $query;
524
+				try {
525
+						$sth = $this->db->prepare($query);
526
+						$sth->execute();
527
+				} catch(PDOException $e) {
528
+						echo $e->getMessage();
529
+						die;
530
+				}
531 531
 		$result = $sth->fetch(PDO::FETCH_ASSOC);
532 532
 		$sth->closeCursor();
533
-                return $result['nb'];
533
+				return $result['nb'];
534 534
 
535
-        }
535
+		}
536 536
 
537 537
 
538 538
 
539 539
 	// tracker_archive_output
540 540
 	
541
-    /**
542
-    * Gets all the spotter information
543
-    *
544
-    * @return Array the spotter information
545
-    *
546
-    */
547
-    public function searchTrackerData($q = '', $registration = '', $aircraft_icao = '', $aircraft_manufacturer = '', $highlights = '', $airline_icao = '', $airline_country = '', $airline_type = '', $airport = '', $airport_country = '', $callsign = '', $departure_airport_route = '', $arrival_airport_route = '', $owner = '',$pilot_id = '',$pilot_name = '',$altitude = '', $date_posted = '', $limit = '', $sort = '', $includegeodata = '',$origLat = '',$origLon = '',$dist = '', $filters=array())
548
-    {
541
+	/**
542
+	 * Gets all the spotter information
543
+	 *
544
+	 * @return Array the spotter information
545
+	 *
546
+	 */
547
+	public function searchTrackerData($q = '', $registration = '', $aircraft_icao = '', $aircraft_manufacturer = '', $highlights = '', $airline_icao = '', $airline_country = '', $airline_type = '', $airport = '', $airport_country = '', $callsign = '', $departure_airport_route = '', $arrival_airport_route = '', $owner = '',$pilot_id = '',$pilot_name = '',$altitude = '', $date_posted = '', $limit = '', $sort = '', $includegeodata = '',$origLat = '',$origLon = '',$dist = '', $filters=array())
548
+	{
549 549
 	global $globalTimezone, $globalDBdriver;
550 550
 	require_once(dirname(__FILE__).'/class.Translation.php');
551 551
 	$Translation = new Translation($this->db);
@@ -559,159 +559,159 @@  discard block
 block discarded – undo
559 559
 	$filter_query = $this->getFilter($filters);
560 560
 	if ($q != "")
561 561
 	{
562
-	    if (!is_string($q))
563
-	    {
562
+		if (!is_string($q))
563
+		{
564 564
 		return false;
565
-	    } else {
565
+		} else {
566 566
 	        
567 567
 		$q_array = explode(" ", $q);
568 568
 		
569 569
 		foreach ($q_array as $q_item){
570
-		    $additional_query .= " AND (";
571
-		    $additional_query .= "(tracker_archive_output.spotter_id like '%".$q_item."%') OR ";
572
-		    $additional_query .= "(tracker_archive_output.aircraft_icao like '%".$q_item."%') OR ";
573
-		    $additional_query .= "(tracker_archive_output.aircraft_name like '%".$q_item."%') OR ";
574
-		    $additional_query .= "(tracker_archive_output.aircraft_manufacturer like '%".$q_item."%') OR ";
575
-		    $additional_query .= "(tracker_archive_output.airline_icao like '%".$q_item."%') OR ";
576
-		    $additional_query .= "(tracker_archive_output.airline_name like '%".$q_item."%') OR ";
577
-		    $additional_query .= "(tracker_archive_output.airline_country like '%".$q_item."%') OR ";
578
-		    $additional_query .= "(tracker_archive_output.departure_airport_icao like '%".$q_item."%') OR ";
579
-		    $additional_query .= "(tracker_archive_output.departure_airport_name like '%".$q_item."%') OR ";
580
-		    $additional_query .= "(tracker_archive_output.departure_airport_city like '%".$q_item."%') OR ";
581
-		    $additional_query .= "(tracker_archive_output.departure_airport_country like '%".$q_item."%') OR ";
582
-		    $additional_query .= "(tracker_archive_output.arrival_airport_icao like '%".$q_item."%') OR ";
583
-		    $additional_query .= "(tracker_archive_output.arrival_airport_name like '%".$q_item."%') OR ";
584
-		    $additional_query .= "(tracker_archive_output.arrival_airport_city like '%".$q_item."%') OR ";
585
-		    $additional_query .= "(tracker_archive_output.arrival_airport_country like '%".$q_item."%') OR ";
586
-		    $additional_query .= "(tracker_archive_output.registration like '%".$q_item."%') OR ";
587
-		    $additional_query .= "(tracker_archive_output.owner_name like '%".$q_item."%') OR ";
588
-		    $additional_query .= "(tracker_archive_output.pilot_id like '%".$q_item."%') OR ";
589
-		    $additional_query .= "(tracker_archive_output.pilot_name like '%".$q_item."%') OR ";
590
-		    $additional_query .= "(tracker_archive_output.ident like '%".$q_item."%') OR ";
591
-		    $translate = $Translation->ident2icao($q_item);
592
-		    if ($translate != $q_item) $additional_query .= "(tracker_archive_output.ident like '%".$translate."%') OR ";
593
-		    $additional_query .= "(tracker_archive_output.highlight like '%".$q_item."%')";
594
-		    $additional_query .= ")";
570
+			$additional_query .= " AND (";
571
+			$additional_query .= "(tracker_archive_output.spotter_id like '%".$q_item."%') OR ";
572
+			$additional_query .= "(tracker_archive_output.aircraft_icao like '%".$q_item."%') OR ";
573
+			$additional_query .= "(tracker_archive_output.aircraft_name like '%".$q_item."%') OR ";
574
+			$additional_query .= "(tracker_archive_output.aircraft_manufacturer like '%".$q_item."%') OR ";
575
+			$additional_query .= "(tracker_archive_output.airline_icao like '%".$q_item."%') OR ";
576
+			$additional_query .= "(tracker_archive_output.airline_name like '%".$q_item."%') OR ";
577
+			$additional_query .= "(tracker_archive_output.airline_country like '%".$q_item."%') OR ";
578
+			$additional_query .= "(tracker_archive_output.departure_airport_icao like '%".$q_item."%') OR ";
579
+			$additional_query .= "(tracker_archive_output.departure_airport_name like '%".$q_item."%') OR ";
580
+			$additional_query .= "(tracker_archive_output.departure_airport_city like '%".$q_item."%') OR ";
581
+			$additional_query .= "(tracker_archive_output.departure_airport_country like '%".$q_item."%') OR ";
582
+			$additional_query .= "(tracker_archive_output.arrival_airport_icao like '%".$q_item."%') OR ";
583
+			$additional_query .= "(tracker_archive_output.arrival_airport_name like '%".$q_item."%') OR ";
584
+			$additional_query .= "(tracker_archive_output.arrival_airport_city like '%".$q_item."%') OR ";
585
+			$additional_query .= "(tracker_archive_output.arrival_airport_country like '%".$q_item."%') OR ";
586
+			$additional_query .= "(tracker_archive_output.registration like '%".$q_item."%') OR ";
587
+			$additional_query .= "(tracker_archive_output.owner_name like '%".$q_item."%') OR ";
588
+			$additional_query .= "(tracker_archive_output.pilot_id like '%".$q_item."%') OR ";
589
+			$additional_query .= "(tracker_archive_output.pilot_name like '%".$q_item."%') OR ";
590
+			$additional_query .= "(tracker_archive_output.ident like '%".$q_item."%') OR ";
591
+			$translate = $Translation->ident2icao($q_item);
592
+			if ($translate != $q_item) $additional_query .= "(tracker_archive_output.ident like '%".$translate."%') OR ";
593
+			$additional_query .= "(tracker_archive_output.highlight like '%".$q_item."%')";
594
+			$additional_query .= ")";
595
+		}
595 596
 		}
596
-	    }
597 597
 	}
598 598
 	
599 599
 	if ($registration != "")
600 600
 	{
601
-	    $registration = filter_var($registration,FILTER_SANITIZE_STRING);
602
-	    if (!is_string($registration))
603
-	    {
601
+		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
602
+		if (!is_string($registration))
603
+		{
604 604
 		return false;
605
-	    } else {
605
+		} else {
606 606
 		$additional_query .= " AND (tracker_archive_output.registration = '".$registration."')";
607
-	    }
607
+		}
608 608
 	}
609 609
 	
610 610
 	if ($aircraft_icao != "")
611 611
 	{
612
-	    $aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
613
-	    if (!is_string($aircraft_icao))
614
-	    {
612
+		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
613
+		if (!is_string($aircraft_icao))
614
+		{
615 615
 		return false;
616
-	    } else {
616
+		} else {
617 617
 		$additional_query .= " AND (tracker_archive_output.aircraft_icao = '".$aircraft_icao."')";
618
-	    }
618
+		}
619 619
 	}
620 620
 	
621 621
 	if ($aircraft_manufacturer != "")
622 622
 	{
623
-	    $aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
624
-	    if (!is_string($aircraft_manufacturer))
625
-	    {
623
+		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
624
+		if (!is_string($aircraft_manufacturer))
625
+		{
626 626
 		return false;
627
-	    } else {
627
+		} else {
628 628
 		$additional_query .= " AND (tracker_archive_output.aircraft_manufacturer = '".$aircraft_manufacturer."')";
629
-	    }
629
+		}
630 630
 	}
631 631
 	
632 632
 	if ($highlights == "true")
633 633
 	{
634
-	    if (!is_string($highlights))
635
-	    {
634
+		if (!is_string($highlights))
635
+		{
636 636
 		return false;
637
-	    } else {
637
+		} else {
638 638
 		$additional_query .= " AND (tracker_archive_output.highlight <> '')";
639
-	    }
639
+		}
640 640
 	}
641 641
 	
642 642
 	if ($airline_icao != "")
643 643
 	{
644
-	    $airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
645
-	    if (!is_string($airline_icao))
646
-	    {
644
+		$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
645
+		if (!is_string($airline_icao))
646
+		{
647 647
 		return false;
648
-	    } else {
648
+		} else {
649 649
 		$additional_query .= " AND (tracker_archive_output.airline_icao = '".$airline_icao."')";
650
-	    }
650
+		}
651 651
 	}
652 652
 	
653 653
 	if ($airline_country != "")
654 654
 	{
655
-	    $airline_country = filter_var($airline_country,FILTER_SANITIZE_STRING);
656
-	    if (!is_string($airline_country))
657
-	    {
655
+		$airline_country = filter_var($airline_country,FILTER_SANITIZE_STRING);
656
+		if (!is_string($airline_country))
657
+		{
658 658
 		return false;
659
-	    } else {
659
+		} else {
660 660
 		$additional_query .= " AND (tracker_archive_output.airline_country = '".$airline_country."')";
661
-	    }
661
+		}
662 662
 	}
663 663
 	
664 664
 	if ($airline_type != "")
665 665
 	{
666
-	    $airline_type = filter_var($airline_type,FILTER_SANITIZE_STRING);
667
-	    if (!is_string($airline_type))
668
-	    {
666
+		$airline_type = filter_var($airline_type,FILTER_SANITIZE_STRING);
667
+		if (!is_string($airline_type))
668
+		{
669 669
 		return false;
670
-	    } else {
670
+		} else {
671 671
 		if ($airline_type == "passenger")
672 672
 		{
673
-		    $additional_query .= " AND (tracker_archive_output.airline_type = 'passenger')";
673
+			$additional_query .= " AND (tracker_archive_output.airline_type = 'passenger')";
674 674
 		}
675 675
 		if ($airline_type == "cargo")
676 676
 		{
677
-		    $additional_query .= " AND (tracker_archive_output.airline_type = 'cargo')";
677
+			$additional_query .= " AND (tracker_archive_output.airline_type = 'cargo')";
678 678
 		}
679 679
 		if ($airline_type == "military")
680 680
 		{
681
-		    $additional_query .= " AND (tracker_archive_output.airline_type = 'military')";
681
+			$additional_query .= " AND (tracker_archive_output.airline_type = 'military')";
682
+		}
682 683
 		}
683
-	    }
684 684
 	}
685 685
 	
686 686
 	if ($airport != "")
687 687
 	{
688
-	    $airport = filter_var($airport,FILTER_SANITIZE_STRING);
689
-	    if (!is_string($airport))
690
-	    {
688
+		$airport = filter_var($airport,FILTER_SANITIZE_STRING);
689
+		if (!is_string($airport))
690
+		{
691 691
 		return false;
692
-	    } else {
692
+		} else {
693 693
 		$additional_query .= " AND ((tracker_archive_output.departure_airport_icao = '".$airport."') OR (tracker_archive_output.arrival_airport_icao = '".$airport."'))";
694
-	    }
694
+		}
695 695
 	}
696 696
 	
697 697
 	if ($airport_country != "")
698 698
 	{
699
-	    $airport_country = filter_var($airport_country,FILTER_SANITIZE_STRING);
700
-	    if (!is_string($airport_country))
701
-	    {
699
+		$airport_country = filter_var($airport_country,FILTER_SANITIZE_STRING);
700
+		if (!is_string($airport_country))
701
+		{
702 702
 		return false;
703
-	    } else {
703
+		} else {
704 704
 		$additional_query .= " AND ((tracker_archive_output.departure_airport_country = '".$airport_country."') OR (tracker_archive_output.arrival_airport_country = '".$airport_country."'))";
705
-	    }
705
+		}
706 706
 	}
707 707
     
708 708
 	if ($callsign != "")
709 709
 	{
710
-	    $callsign = filter_var($callsign,FILTER_SANITIZE_STRING);
711
-	    if (!is_string($callsign))
712
-	    {
710
+		$callsign = filter_var($callsign,FILTER_SANITIZE_STRING);
711
+		if (!is_string($callsign))
712
+		{
713 713
 		return false;
714
-	    } else {
714
+		} else {
715 715
 		$translate = $Translation->ident2icao($callsign);
716 716
 		if ($translate != $callsign) {
717 717
 			$additional_query .= " AND (tracker_archive_output.ident = :callsign OR tracker_archive_output.ident = :translate)";
@@ -719,99 +719,99 @@  discard block
 block discarded – undo
719 719
 		} else {
720 720
 			$additional_query .= " AND (tracker_archive_output.ident = '".$callsign."')";
721 721
 		}
722
-	    }
722
+		}
723 723
 	}
724 724
 
725 725
 	if ($owner != "")
726 726
 	{
727
-	    $owner = filter_var($owner,FILTER_SANITIZE_STRING);
728
-	    if (!is_string($owner))
729
-	    {
727
+		$owner = filter_var($owner,FILTER_SANITIZE_STRING);
728
+		if (!is_string($owner))
729
+		{
730 730
 		return false;
731
-	    } else {
731
+		} else {
732 732
 		$additional_query .= " AND (tracker_archive_output.owner_name = '".$owner."')";
733
-	    }
733
+		}
734 734
 	}
735 735
 
736 736
 	if ($pilot_name != "")
737 737
 	{
738
-	    $pilot_name = filter_var($pilot_name,FILTER_SANITIZE_STRING);
739
-	    if (!is_string($pilot_name))
740
-	    {
738
+		$pilot_name = filter_var($pilot_name,FILTER_SANITIZE_STRING);
739
+		if (!is_string($pilot_name))
740
+		{
741 741
 		return false;
742
-	    } else {
742
+		} else {
743 743
 		$additional_query .= " AND (tracker_archive_output.pilot_name = '".$pilot_name."')";
744
-	    }
744
+		}
745 745
 	}
746 746
 	
747 747
 	if ($pilot_id != "")
748 748
 	{
749
-	    $pilot_id = filter_var($pilot_id,FILTER_SANITIZE_NUMBER_INT);
750
-	    if (!is_string($pilot_id))
751
-	    {
749
+		$pilot_id = filter_var($pilot_id,FILTER_SANITIZE_NUMBER_INT);
750
+		if (!is_string($pilot_id))
751
+		{
752 752
 		return false;
753
-	    } else {
753
+		} else {
754 754
 		$additional_query .= " AND (tracker_archive_output.pilot_id = '".$pilot_id."')";
755
-	    }
755
+		}
756 756
 	}
757 757
 	
758 758
 	if ($departure_airport_route != "")
759 759
 	{
760
-	    $departure_airport_route = filter_var($departure_airport_route,FILTER_SANITIZE_STRING);
761
-	    if (!is_string($departure_airport_route))
762
-	    {
760
+		$departure_airport_route = filter_var($departure_airport_route,FILTER_SANITIZE_STRING);
761
+		if (!is_string($departure_airport_route))
762
+		{
763 763
 		return false;
764
-	    } else {
764
+		} else {
765 765
 		$additional_query .= " AND (tracker_archive_output.departure_airport_icao = '".$departure_airport_route."')";
766
-	    }
766
+		}
767 767
 	}
768 768
 	
769 769
 	if ($arrival_airport_route != "")
770 770
 	{
771
-	    $arrival_airport_route = filter_var($arrival_airport_route,FILTER_SANITIZE_STRING);
772
-	    if (!is_string($arrival_airport_route))
773
-	    {
771
+		$arrival_airport_route = filter_var($arrival_airport_route,FILTER_SANITIZE_STRING);
772
+		if (!is_string($arrival_airport_route))
773
+		{
774 774
 		return false;
775
-	    } else {
775
+		} else {
776 776
 		$additional_query .= " AND (tracker_archive_output.arrival_airport_icao = '".$arrival_airport_route."')";
777
-	    }
777
+		}
778 778
 	}
779 779
 	
780 780
 	if ($altitude != "")
781 781
 	{
782
-	    $altitude_array = explode(",", $altitude);
782
+		$altitude_array = explode(",", $altitude);
783 783
 	    
784
-	    $altitude_array[0] = filter_var($altitude_array[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
785
-	    $altitude_array[1] = filter_var($altitude_array[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
784
+		$altitude_array[0] = filter_var($altitude_array[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
785
+		$altitude_array[1] = filter_var($altitude_array[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
786 786
 	    
787 787
 
788
-	    if ($altitude_array[1] != "")
789
-	    {                
788
+		if ($altitude_array[1] != "")
789
+		{                
790 790
 		$altitude_array[0] = substr($altitude_array[0], 0, -2);
791 791
 		$altitude_array[1] = substr($altitude_array[1], 0, -2);
792 792
 		$additional_query .= " AND altitude BETWEEN '".$altitude_array[0]."' AND '".$altitude_array[1]."' ";
793
-	    } else {
793
+		} else {
794 794
 		$altitude_array[0] = substr($altitude_array[0], 0, -2);
795 795
 		$additional_query .= " AND altitude <= '".$altitude_array[0]."' ";
796
-	    }
796
+		}
797 797
 	}
798 798
 	
799 799
 	if ($date_posted != "")
800 800
 	{
801
-	    $date_array = explode(",", $date_posted);
801
+		$date_array = explode(",", $date_posted);
802 802
 	    
803
-	    $date_array[0] = filter_var($date_array[0],FILTER_SANITIZE_STRING);
804
-	    $date_array[1] = filter_var($date_array[1],FILTER_SANITIZE_STRING);
803
+		$date_array[0] = filter_var($date_array[0],FILTER_SANITIZE_STRING);
804
+		$date_array[1] = filter_var($date_array[1],FILTER_SANITIZE_STRING);
805 805
 	    
806
-	    if ($globalTimezone != '') {
806
+		if ($globalTimezone != '') {
807 807
 		date_default_timezone_set($globalTimezone);
808 808
 		$datetime = new DateTime();
809 809
 		$offset = $datetime->format('P');
810
-	    } else $offset = '+00:00';
810
+		} else $offset = '+00:00';
811 811
 
812 812
 
813
-	    if ($date_array[1] != "")
814
-	    {                
813
+		if ($date_array[1] != "")
814
+		{                
815 815
 		$date_array[0] = date("Y-m-d H:i:s", strtotime($date_array[0]));
816 816
 		$date_array[1] = date("Y-m-d H:i:s", strtotime($date_array[1]));
817 817
 		if ($globalDBdriver == 'mysql') {
@@ -819,28 +819,28 @@  discard block
 block discarded – undo
819 819
 		} else {
820 820
 			$additional_query .= " AND tracker_archive_output.date::timestamp AT TIME ZONE INTERVAL ".$offset." >= CAST('".$date_array[0]."' AS TIMESTAMP) AND tracker_archive_output.date::timestamp AT TIME ZONE INTERVAL ".$offset." <= CAST('".$date_array[1]."' AS TIMESTAMP) ";
821 821
 		}
822
-	    } else {
822
+		} else {
823 823
 		$date_array[0] = date("Y-m-d H:i:s", strtotime($date_array[0]));
824
-                if ($globalDBdriver == 'mysql') {
824
+				if ($globalDBdriver == 'mysql') {
825 825
 			$additional_query .= " AND TIMESTAMP(CONVERT_TZ(tracker_archive_output.date,'+00:00', '".$offset."')) >= '".$date_array[0]."' ";
826 826
 		} else {
827 827
 			$additional_query .= " AND tracker_archive_output.date::timestamp AT TIME ZONE INTERVAL ".$offset." >= CAST('".$date_array[0]."' AS TIMESTAMP) ";
828 828
 		}
829
-	    }
829
+		}
830 830
 	}
831 831
 	
832 832
 	if ($limit != "")
833 833
 	{
834
-	    $limit_array = explode(",", $limit);
834
+		$limit_array = explode(",", $limit);
835 835
 	    
836
-	    $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
837
-	    $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
836
+		$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
837
+		$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
838 838
 	    
839
-	    if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
840
-	    {
839
+		if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
840
+		{
841 841
 		//$limit_query = " LIMIT ".$limit_array[0].",".$limit_array[1];
842 842
 		$limit_query = " LIMIT ".$limit_array[1]." OFFSET ".$limit_array[0];
843
-	    }
843
+		}
844 844
 	}
845 845
 	
846 846
 
@@ -871,33 +871,33 @@  discard block
 block discarded – undo
871 871
 	$spotter_array = $Tracker->getDataFromDB($query, $query_values,$limit_query);
872 872
 
873 873
 	return $spotter_array;
874
-    }
874
+	}
875 875
 
876
-    public function deleteTrackerArchiveData()
877
-    {
876
+	public function deleteTrackerArchiveData()
877
+	{
878 878
 		global $globalArchiveKeepMonths, $globalDBdriver;
879
-                date_default_timezone_set('UTC');
880
-                if ($globalDBdriver == 'mysql') {
879
+				date_default_timezone_set('UTC');
880
+				if ($globalDBdriver == 'mysql') {
881 881
 			$query = 'DELETE FROM tracker_archive_output WHERE tracker_archive_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$globalArchiveKeepMonths.' MONTH)';
882 882
 		} else {
883 883
 			$query = "DELETE FROM tracker_archive_output WHERE tracker_archive_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalArchiveKeepMonths." MONTH'";
884 884
 		}
885
-                try {
886
-                        $sth = $this->db->prepare($query);
887
-                        $sth->execute();
888
-                } catch(PDOException $e) {
889
-                        return "error";
890
-                }
885
+				try {
886
+						$sth = $this->db->prepare($query);
887
+						$sth->execute();
888
+				} catch(PDOException $e) {
889
+						return "error";
890
+				}
891 891
 	}
892 892
 
893
-    /**
894
-    * Gets all the spotter information based on the callsign
895
-    *
896
-    * @return Array the spotter information
897
-    *
898
-    */
899
-    public function getTrackerDataByIdent($ident = '', $limit = '', $sort = '')
900
-    {
893
+	/**
894
+	 * Gets all the spotter information based on the callsign
895
+	 *
896
+	 * @return Array the spotter information
897
+	 *
898
+	 */
899
+	public function getTrackerDataByIdent($ident = '', $limit = '', $sort = '')
900
+	{
901 901
 	$global_query = "SELECT tracker_archive_output.* FROM tracker_archive_output";
902 902
 	
903 903
 	date_default_timezone_set('UTC');
@@ -909,35 +909,35 @@  discard block
 block discarded – undo
909 909
 	
910 910
 	if ($ident != "")
911 911
 	{
912
-	    if (!is_string($ident))
913
-	    {
912
+		if (!is_string($ident))
913
+		{
914 914
 		return false;
915
-	    } else {
915
+		} else {
916 916
 		$additional_query = " AND (tracker_archive_output.ident = :ident)";
917 917
 		$query_values = array(':ident' => $ident);
918
-	    }
918
+		}
919 919
 	}
920 920
 	
921 921
 	if ($limit != "")
922 922
 	{
923
-	    $limit_array = explode(",", $limit);
923
+		$limit_array = explode(",", $limit);
924 924
 	    
925
-	    $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
926
-	    $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
925
+		$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
926
+		$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
927 927
 	    
928
-	    if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
929
-	    {
928
+		if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
929
+		{
930 930
 		//$limit_query = " LIMIT ".$limit_array[0].",".$limit_array[1];
931 931
 		$limit_query = " LIMIT ".$limit_array[1]." OFFSET ".$limit_array[0];
932
-	    }
932
+		}
933 933
 	}
934 934
 
935 935
 	if ($sort != "")
936 936
 	{
937
-	    $search_orderby_array = $Tracker->getOrderBy();
938
-	    $orderby_query = $search_orderby_array[$sort]['sql'];
937
+		$search_orderby_array = $Tracker->getOrderBy();
938
+		$orderby_query = $search_orderby_array[$sort]['sql'];
939 939
 	} else {
940
-	    $orderby_query = " ORDER BY tracker_archive_output.date DESC";
940
+		$orderby_query = " ORDER BY tracker_archive_output.date DESC";
941 941
 	}
942 942
 
943 943
 	$query = $global_query." WHERE tracker_archive_output.ident <> '' ".$additional_query." ".$orderby_query;
@@ -945,17 +945,17 @@  discard block
 block discarded – undo
945 945
 	$spotter_array = $Tracker->getDataFromDB($query, $query_values, $limit_query);
946 946
 
947 947
 	return $spotter_array;
948
-    }
948
+	}
949 949
 
950 950
 
951
-    /**
952
-    * Gets all the spotter information based on the owner
953
-    *
954
-    * @return Array the spotter information
955
-    *
956
-    */
957
-    public function getTrackerDataByOwner($owner = '', $limit = '', $sort = '', $filter = array())
958
-    {
951
+	/**
952
+	 * Gets all the spotter information based on the owner
953
+	 *
954
+	 * @return Array the spotter information
955
+	 *
956
+	 */
957
+	public function getTrackerDataByOwner($owner = '', $limit = '', $sort = '', $filter = array())
958
+	{
959 959
 	$global_query = "SELECT tracker_archive_output.* FROM tracker_archive_output";
960 960
 	
961 961
 	date_default_timezone_set('UTC');
@@ -968,35 +968,35 @@  discard block
 block discarded – undo
968 968
 	
969 969
 	if ($owner != "")
970 970
 	{
971
-	    if (!is_string($owner))
972
-	    {
971
+		if (!is_string($owner))
972
+		{
973 973
 		return false;
974
-	    } else {
974
+		} else {
975 975
 		$additional_query = " AND (tracker_archive_output.owner_name = :owner)";
976 976
 		$query_values = array(':owner' => $owner);
977
-	    }
977
+		}
978 978
 	}
979 979
 	
980 980
 	if ($limit != "")
981 981
 	{
982
-	    $limit_array = explode(",", $limit);
982
+		$limit_array = explode(",", $limit);
983 983
 	    
984
-	    $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
985
-	    $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
984
+		$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
985
+		$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
986 986
 	    
987
-	    if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
988
-	    {
987
+		if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
988
+		{
989 989
 		//$limit_query = " LIMIT ".$limit_array[0].",".$limit_array[1];
990 990
 		$limit_query = " LIMIT ".$limit_array[1]." OFFSET ".$limit_array[0];
991
-	    }
991
+		}
992 992
 	}
993 993
 
994 994
 	if ($sort != "")
995 995
 	{
996
-	    $search_orderby_array = $Tracker->getOrderBy();
997
-	    $orderby_query = $search_orderby_array[$sort]['sql'];
996
+		$search_orderby_array = $Tracker->getOrderBy();
997
+		$orderby_query = $search_orderby_array[$sort]['sql'];
998 998
 	} else {
999
-	    $orderby_query = " ORDER BY tracker_archive_output.date DESC";
999
+		$orderby_query = " ORDER BY tracker_archive_output.date DESC";
1000 1000
 	}
1001 1001
 
1002 1002
 	$query = $global_query.$filter_query." tracker_archive_output.owner_name <> '' ".$additional_query." ".$orderby_query;
@@ -1004,16 +1004,16 @@  discard block
 block discarded – undo
1004 1004
 	$spotter_array = $Tracker->getDataFromDB($query, $query_values, $limit_query);
1005 1005
 
1006 1006
 	return $spotter_array;
1007
-    }
1008
-
1009
-    /**
1010
-    * Gets all the spotter information based on the pilot
1011
-    *
1012
-    * @return Array the spotter information
1013
-    *
1014
-    */
1015
-    public function getTrackerDataByPilot($pilot = '', $limit = '', $sort = '', $filter = array())
1016
-    {
1007
+	}
1008
+
1009
+	/**
1010
+	 * Gets all the spotter information based on the pilot
1011
+	 *
1012
+	 * @return Array the spotter information
1013
+	 *
1014
+	 */
1015
+	public function getTrackerDataByPilot($pilot = '', $limit = '', $sort = '', $filter = array())
1016
+	{
1017 1017
 	$global_query = "SELECT tracker_archive_output.* FROM tracker_archive_output";
1018 1018
 	
1019 1019
 	date_default_timezone_set('UTC');
@@ -1032,24 +1032,24 @@  discard block
 block discarded – undo
1032 1032
 	
1033 1033
 	if ($limit != "")
1034 1034
 	{
1035
-	    $limit_array = explode(",", $limit);
1035
+		$limit_array = explode(",", $limit);
1036 1036
 	    
1037
-	    $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1038
-	    $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1037
+		$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1038
+		$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1039 1039
 	    
1040
-	    if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1041
-	    {
1040
+		if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1041
+		{
1042 1042
 		//$limit_query = " LIMIT ".$limit_array[0].",".$limit_array[1];
1043 1043
 		$limit_query = " LIMIT ".$limit_array[1]." OFFSET ".$limit_array[0];
1044
-	    }
1044
+		}
1045 1045
 	}
1046 1046
 
1047 1047
 	if ($sort != "")
1048 1048
 	{
1049
-	    $search_orderby_array = $Tracker->getOrderBy();
1050
-	    $orderby_query = $search_orderby_array[$sort]['sql'];
1049
+		$search_orderby_array = $Tracker->getOrderBy();
1050
+		$orderby_query = $search_orderby_array[$sort]['sql'];
1051 1051
 	} else {
1052
-	    $orderby_query = " ORDER BY tracker_archive_output.date DESC";
1052
+		$orderby_query = " ORDER BY tracker_archive_output.date DESC";
1053 1053
 	}
1054 1054
 
1055 1055
 	$query = $global_query.$filter_query." tracker_archive_output.pilot_name <> '' ".$additional_query." ".$orderby_query;
@@ -1057,16 +1057,16 @@  discard block
 block discarded – undo
1057 1057
 	$spotter_array = $Tracker->getDataFromDB($query, $query_values, $limit_query);
1058 1058
 
1059 1059
 	return $spotter_array;
1060
-    }
1061
-
1062
-    /**
1063
-    * Gets all number of flight over countries
1064
-    *
1065
-    * @return Array the airline country list
1066
-    *
1067
-    */
1068
-    public function countAllFlightOverCountries($limit = true,$olderthanmonths = 0,$sincedate = '')
1069
-    {
1060
+	}
1061
+
1062
+	/**
1063
+	 * Gets all number of flight over countries
1064
+	 *
1065
+	 * @return Array the airline country list
1066
+	 *
1067
+	 */
1068
+	public function countAllFlightOverCountries($limit = true,$olderthanmonths = 0,$sincedate = '')
1069
+	{
1070 1070
 	global $globalDBdriver;
1071 1071
 	/*
1072 1072
 	$query = "SELECT c.name, c.iso3, c.iso2, count(c.name) as nb 
@@ -1076,14 +1076,14 @@  discard block
 block discarded – undo
1076 1076
 	$query = "SELECT c.name, c.iso3, c.iso2, count(c.name) as nb
1077 1077
 		    FROM countries c, tracker_archive s
1078 1078
 		    WHERE c.iso2 = s.over_country ";
1079
-                if ($olderthanmonths > 0) {
1080
-            		if ($globalDBdriver == 'mysql') {
1079
+				if ($olderthanmonths > 0) {
1080
+					if ($globalDBdriver == 'mysql') {
1081 1081
 				$query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
1082 1082
 			} else {
1083 1083
 				$query .= "AND date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
1084 1084
 			}
1085 1085
 		}
1086
-                if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
1086
+				if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
1087 1087
 	$query .= "GROUP BY c.name, c.iso3, c.iso2 ORDER BY nb DESC";
1088 1088
 	if ($limit) $query .= " LIMIT 0,10";
1089 1089
       
@@ -1096,23 +1096,23 @@  discard block
 block discarded – undo
1096 1096
         
1097 1097
 	while($row = $sth->fetch(PDO::FETCH_ASSOC))
1098 1098
 	{
1099
-	    $temp_array['flight_count'] = $row['nb'];
1100
-	    $temp_array['flight_country'] = $row['name'];
1101
-	    $temp_array['flight_country_iso3'] = $row['iso3'];
1102
-	    $temp_array['flight_country_iso2'] = $row['iso2'];
1103
-	    $flight_array[] = $temp_array;
1099
+		$temp_array['flight_count'] = $row['nb'];
1100
+		$temp_array['flight_country'] = $row['name'];
1101
+		$temp_array['flight_country_iso3'] = $row['iso3'];
1102
+		$temp_array['flight_country_iso2'] = $row['iso2'];
1103
+		$flight_array[] = $temp_array;
1104 1104
 	}
1105 1105
 	return $flight_array;
1106
-    }
1107
-
1108
-    /**
1109
-    * Gets all number of flight over countries
1110
-    *
1111
-    * @return Array the airline country list
1112
-    *
1113
-    */
1114
-    public function countAllFlightOverCountriesByAirlines($limit = true,$olderthanmonths = 0,$sincedate = '')
1115
-    {
1106
+	}
1107
+
1108
+	/**
1109
+	 * Gets all number of flight over countries
1110
+	 *
1111
+	 * @return Array the airline country list
1112
+	 *
1113
+	 */
1114
+	public function countAllFlightOverCountriesByAirlines($limit = true,$olderthanmonths = 0,$sincedate = '')
1115
+	{
1116 1116
 	global $globalDBdriver;
1117 1117
 	/*
1118 1118
 	$query = "SELECT c.name, c.iso3, c.iso2, count(c.name) as nb 
@@ -1122,14 +1122,14 @@  discard block
 block discarded – undo
1122 1122
 	$query = "SELECT o.airline_icao,c.name, c.iso3, c.iso2, count(c.name) as nb
1123 1123
 		    FROM countries c, tracker_archive s, spotter_output o
1124 1124
 		    WHERE c.iso2 = s.over_country AND o.airline_icao <> '' AND o.famtrackid = s.famtrackid ";
1125
-                if ($olderthanmonths > 0) {
1126
-            		if ($globalDBdriver == 'mysql') {
1125
+				if ($olderthanmonths > 0) {
1126
+					if ($globalDBdriver == 'mysql') {
1127 1127
 				$query .= 'AND s.date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
1128 1128
 			} else {
1129 1129
 				$query .= "AND s.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
1130 1130
 			}
1131 1131
 		}
1132
-                if ($sincedate != '') $query .= "AND s.date > '".$sincedate."' ";
1132
+				if ($sincedate != '') $query .= "AND s.date > '".$sincedate."' ";
1133 1133
 	$query .= "GROUP BY o.airline_icao,c.name, c.iso3, c.iso2 ORDER BY nb DESC";
1134 1134
 	if ($limit) $query .= " LIMIT 0,10";
1135 1135
       
@@ -1142,24 +1142,24 @@  discard block
 block discarded – undo
1142 1142
         
1143 1143
 	while($row = $sth->fetch(PDO::FETCH_ASSOC))
1144 1144
 	{
1145
-	    $temp_array['airline_icao'] = $row['airline_icao'];
1146
-	    $temp_array['flight_count'] = $row['nb'];
1147
-	    $temp_array['flight_country'] = $row['name'];
1148
-	    $temp_array['flight_country_iso3'] = $row['iso3'];
1149
-	    $temp_array['flight_country_iso2'] = $row['iso2'];
1150
-	    $flight_array[] = $temp_array;
1145
+		$temp_array['airline_icao'] = $row['airline_icao'];
1146
+		$temp_array['flight_count'] = $row['nb'];
1147
+		$temp_array['flight_country'] = $row['name'];
1148
+		$temp_array['flight_country_iso3'] = $row['iso3'];
1149
+		$temp_array['flight_country_iso2'] = $row['iso2'];
1150
+		$flight_array[] = $temp_array;
1151 1151
 	}
1152 1152
 	return $flight_array;
1153
-    }
1154
-
1155
-    /**
1156
-    * Gets last spotter information based on a particular callsign
1157
-    *
1158
-    * @return Array the spotter information
1159
-    *
1160
-    */
1161
-    public function getDateArchiveTrackerDataById($id,$date)
1162
-    {
1153
+	}
1154
+
1155
+	/**
1156
+	 * Gets last spotter information based on a particular callsign
1157
+	 *
1158
+	 * @return Array the spotter information
1159
+	 *
1160
+	 */
1161
+	public function getDateArchiveTrackerDataById($id,$date)
1162
+	{
1163 1163
 	$Tracker = new Tracker($this->db);
1164 1164
 	date_default_timezone_set('UTC');
1165 1165
 	$id = filter_var($id, FILTER_SANITIZE_STRING);
@@ -1167,16 +1167,16 @@  discard block
 block discarded – undo
1167 1167
 	$date = date('c',$date);
1168 1168
 	$spotter_array = $Tracker->getDataFromDB($query,array(':id' => $id,':date' => $date));
1169 1169
 	return $spotter_array;
1170
-    }
1171
-
1172
-    /**
1173
-    * Gets all the spotter information based on a particular callsign
1174
-    *
1175
-    * @return Array the spotter information
1176
-    *
1177
-    */
1178
-    public function getDateArchiveTrackerDataByIdent($ident,$date)
1179
-    {
1170
+	}
1171
+
1172
+	/**
1173
+	 * Gets all the spotter information based on a particular callsign
1174
+	 *
1175
+	 * @return Array the spotter information
1176
+	 *
1177
+	 */
1178
+	public function getDateArchiveTrackerDataByIdent($ident,$date)
1179
+	{
1180 1180
 	$Tracker = new Tracker($this->db);
1181 1181
 	date_default_timezone_set('UTC');
1182 1182
 	$ident = filter_var($ident, FILTER_SANITIZE_STRING);
@@ -1184,16 +1184,16 @@  discard block
 block discarded – undo
1184 1184
 	$date = date('c',$date);
1185 1185
 	$spotter_array = $Tracker->getDataFromDB($query,array(':ident' => $ident,':date' => $date));
1186 1186
 	return $spotter_array;
1187
-    }
1188
-
1189
-    /**
1190
-    * Gets all the spotter information based on the airport
1191
-    *
1192
-    * @return Array the spotter information
1193
-    *
1194
-    */
1195
-    public function getTrackerDataByAirport($airport = '', $limit = '', $sort = '',$filters = array())
1196
-    {
1187
+	}
1188
+
1189
+	/**
1190
+	 * Gets all the spotter information based on the airport
1191
+	 *
1192
+	 * @return Array the spotter information
1193
+	 *
1194
+	 */
1195
+	public function getTrackerDataByAirport($airport = '', $limit = '', $sort = '',$filters = array())
1196
+	{
1197 1197
 	global $global_query;
1198 1198
 	$Tracker = new Tracker($this->db);
1199 1199
 	date_default_timezone_set('UTC');
@@ -1204,35 +1204,35 @@  discard block
 block discarded – undo
1204 1204
 	
1205 1205
 	if ($airport != "")
1206 1206
 	{
1207
-	    if (!is_string($airport))
1208
-	    {
1207
+		if (!is_string($airport))
1208
+		{
1209 1209
 		return false;
1210
-	    } else {
1210
+		} else {
1211 1211
 		$additional_query .= " AND ((tracker_archive_output.departure_airport_icao = :airport) OR (tracker_archive_output.arrival_airport_icao = :airport))";
1212 1212
 		$query_values = array(':airport' => $airport);
1213
-	    }
1213
+		}
1214 1214
 	}
1215 1215
 	
1216 1216
 	if ($limit != "")
1217 1217
 	{
1218
-	    $limit_array = explode(",", $limit);
1218
+		$limit_array = explode(",", $limit);
1219 1219
 	    
1220
-	    $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1221
-	    $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1220
+		$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1221
+		$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1222 1222
 	    
1223
-	    if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1224
-	    {
1223
+		if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1224
+		{
1225 1225
 		//$limit_query = " LIMIT ".$limit_array[0].",".$limit_array[1];
1226 1226
 		$limit_query = " LIMIT ".$limit_array[1]." OFFSET ".$limit_array[0];
1227
-	    }
1227
+		}
1228 1228
 	}
1229 1229
 	
1230 1230
 	if ($sort != "")
1231 1231
 	{
1232
-	    $search_orderby_array = $Tracker->getOrderBy();
1233
-	    $orderby_query = $search_orderby_array[$sort]['sql'];
1232
+		$search_orderby_array = $Tracker->getOrderBy();
1233
+		$orderby_query = $search_orderby_array[$sort]['sql'];
1234 1234
 	} else {
1235
-	    $orderby_query = " ORDER BY tracker_archive_output.date DESC";
1235
+		$orderby_query = " ORDER BY tracker_archive_output.date DESC";
1236 1236
 	}
1237 1237
 
1238 1238
 	$query = $global_query.$filter_query." tracker_archive_output.ident <> '' ".$additional_query." AND ((tracker_archive_output.departure_airport_icao <> 'NA') AND (tracker_archive_output.arrival_airport_icao <> 'NA')) ".$orderby_query;
@@ -1240,6 +1240,6 @@  discard block
 block discarded – undo
1240 1240
 	$spotter_array = $Tracker->getDataFromDB($query, $query_values, $limit_query);
1241 1241
 
1242 1242
 	return $spotter_array;
1243
-    }
1243
+	}
1244 1244
 }
1245 1245
 ?>
1246 1246
\ No newline at end of file
Please login to merge, or discard this patch.
require/class.SpotterLive.php 1 patch
Indentation   +201 added lines, -201 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();
@@ -129,11 +129,11 @@  discard block
 block discarded – undo
129 129
 	}
130 130
 
131 131
 	/**
132
-	* Gets all the spotter information based on the latest data entry
133
-	*
134
-	* @return Array the spotter information
135
-	*
136
-	*/
132
+	 * Gets all the spotter information based on the latest data entry
133
+	 *
134
+	 * @return Array the spotter information
135
+	 *
136
+	 */
137 137
 	public function getLiveSpotterData($limit = '', $sort = '', $filter = array())
138 138
 	{
139 139
 		global $globalDBdriver, $globalLiveInterval;
@@ -176,11 +176,11 @@  discard block
 block discarded – undo
176 176
 	}
177 177
 
178 178
 	/**
179
-	* Gets Minimal Live Spotter data
180
-	*
181
-	* @return Array the spotter information
182
-	*
183
-	*/
179
+	 * Gets Minimal Live Spotter data
180
+	 *
181
+	 * @return Array the spotter information
182
+	 *
183
+	 */
184 184
 	public function getMinLiveSpotterData($filter = array())
185 185
 	{
186 186
 		global $globalDBdriver, $globalLiveInterval, $globalArchive;
@@ -217,11 +217,11 @@  discard block
 block discarded – undo
217 217
 	}
218 218
 
219 219
 	/**
220
-	* Gets Minimal Live Spotter data since xx seconds
221
-	*
222
-	* @return Array the spotter information
223
-	*
224
-	*/
220
+	 * Gets Minimal Live Spotter data since xx seconds
221
+	 *
222
+	 * @return Array the spotter information
223
+	 *
224
+	 */
225 225
 	public function getMinLastLiveSpotterData($coord = array(),$filter = array(), $limit = false)
226 226
 	{
227 227
 		global $globalDBdriver, $globalLiveInterval, $globalArchive, $globalMap3DAircraftsLimit;
@@ -302,11 +302,11 @@  discard block
 block discarded – undo
302 302
 	}
303 303
 
304 304
 	/**
305
-	* Gets number of latest data entry
306
-	*
307
-	* @return String number of entry
308
-	*
309
-	*/
305
+	 * Gets number of latest data entry
306
+	 *
307
+	 * @return String number of entry
308
+	 *
309
+	 */
310 310
 	public function getLiveSpotterCount($filter = array())
311 311
 	{
312 312
 		global $globalDBdriver, $globalLiveInterval;
@@ -333,11 +333,11 @@  discard block
 block discarded – undo
333 333
 	}
334 334
 
335 335
 	/**
336
-	* Gets all the spotter information based on the latest data entry and coord
337
-	*
338
-	* @return Array the spotter information
339
-	*
340
-	*/
336
+	 * Gets all the spotter information based on the latest data entry and coord
337
+	 *
338
+	 * @return Array the spotter information
339
+	 *
340
+	 */
341 341
 	public function getLiveSpotterDatabyCoord($coord, $filter = array())
342 342
 	{
343 343
 		global $globalDBdriver, $globalLiveInterval;
@@ -362,11 +362,11 @@  discard block
 block discarded – undo
362 362
 	}
363 363
 
364 364
 	/**
365
-	* Gets all the spotter information based on the latest data entry and coord
366
-	*
367
-	* @return Array the spotter information
368
-	*
369
-	*/
365
+	 * Gets all the spotter information based on the latest data entry and coord
366
+	 *
367
+	 * @return Array the spotter information
368
+	 *
369
+	 */
370 370
 	public function getMinLiveSpotterDatabyCoord($coord, $filter = array())
371 371
 	{
372 372
 		global $globalDBdriver, $globalLiveInterval, $globalArchive;
@@ -431,11 +431,11 @@  discard block
 block discarded – undo
431 431
 	}
432 432
 
433 433
 	/**
434
-	* Gets all the spotter information based on a user's latitude and longitude
435
-	*
436
-	* @return Array the spotter information
437
-	*
438
-	*/
434
+	 * Gets all the spotter information based on a user's latitude and longitude
435
+	 *
436
+	 * @return Array the spotter information
437
+	 *
438
+	 */
439 439
 	public function getLatestSpotterForLayar($lat, $lng, $radius, $interval)
440 440
 	{
441 441
 		$Spotter = new Spotter($this->db);
@@ -445,98 +445,98 @@  discard block
 block discarded – undo
445 445
 				return false;
446 446
 			}
447 447
 		}
448
-        if ($lng != '')
449
-                {
450
-                        if (!is_numeric($lng))
451
-                        {
452
-                                return false;
453
-                        }
454
-                }
455
-
456
-                if ($radius != '')
457
-                {
458
-                        if (!is_numeric($radius))
459
-                        {
460
-                                return false;
461
-                        }
462
-                }
448
+		if ($lng != '')
449
+				{
450
+						if (!is_numeric($lng))
451
+						{
452
+								return false;
453
+						}
454
+				}
455
+
456
+				if ($radius != '')
457
+				{
458
+						if (!is_numeric($radius))
459
+						{
460
+								return false;
461
+						}
462
+				}
463 463
 		$additional_query = '';
464
-        if ($interval != '')
465
-                {
466
-                        if (!is_string($interval))
467
-                        {
468
-                                //$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= spotter_live.date ';
469
-			        return false;
470
-                        } else {
471
-                if ($interval == '1m')
472
-                {
473
-                    $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= spotter_live.date ';
474
-                } else if ($interval == '15m'){
475
-                    $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 15 MINUTE) <= spotter_live.date ';
476
-                } 
477
-            }
478
-                } else {
479
-         $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= spotter_live.date ';   
480
-        }
481
-
482
-                $query  = "SELECT spotter_live.*, ( 6371 * acos( cos( radians(:lat) ) * cos( radians( latitude ) ) * cos( radians( longitude ) - radians(:lng) ) + sin( radians(:lat) ) * sin( radians( latitude ) ) ) ) AS distance FROM spotter_live 
464
+		if ($interval != '')
465
+				{
466
+						if (!is_string($interval))
467
+						{
468
+								//$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= spotter_live.date ';
469
+					return false;
470
+						} else {
471
+				if ($interval == '1m')
472
+				{
473
+					$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= spotter_live.date ';
474
+				} else if ($interval == '15m'){
475
+					$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 15 MINUTE) <= spotter_live.date ';
476
+				} 
477
+			}
478
+				} else {
479
+		 $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= spotter_live.date ';   
480
+		}
481
+
482
+				$query  = "SELECT spotter_live.*, ( 6371 * acos( cos( radians(:lat) ) * cos( radians( latitude ) ) * cos( radians( longitude ) - radians(:lng) ) + sin( radians(:lat) ) * sin( radians( latitude ) ) ) ) AS distance FROM spotter_live 
483 483
                    WHERE spotter_live.latitude <> '' 
484 484
                                    AND spotter_live.longitude <> '' 
485 485
                    ".$additional_query."
486 486
                    HAVING distance < :radius  
487 487
                                    ORDER BY distance";
488 488
 
489
-                $spotter_array = $Spotter->getDataFromDB($query, array(':lat' => $lat, ':lng' => $lng,':radius' => $radius));
489
+				$spotter_array = $Spotter->getDataFromDB($query, array(':lat' => $lat, ':lng' => $lng,':radius' => $radius));
490 490
 
491
-                return $spotter_array;
492
-        }
491
+				return $spotter_array;
492
+		}
493 493
 
494 494
     
495
-        /**
496
-	* Gets all the spotter information based on a particular callsign
497
-	*
498
-	* @return Array the spotter information
499
-	*
500
-	*/
495
+		/**
496
+		 * Gets all the spotter information based on a particular callsign
497
+		 *
498
+		 * @return Array the spotter information
499
+		 *
500
+		 */
501 501
 	public function getLastLiveSpotterDataByIdent($ident)
502 502
 	{
503 503
 		$Spotter = new Spotter($this->db);
504 504
 		date_default_timezone_set('UTC');
505 505
 
506 506
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
507
-                $query  = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.ident = :ident GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC';
507
+				$query  = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.ident = :ident GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC';
508 508
 
509 509
 		$spotter_array = $Spotter->getDataFromDB($query,array(':ident' => $ident),'',true);
510 510
 
511 511
 		return $spotter_array;
512 512
 	}
513 513
 
514
-        /**
515
-	* Gets all the spotter information based on a particular callsign
516
-	*
517
-	* @return Array the spotter information
518
-	*
519
-	*/
514
+		/**
515
+		 * Gets all the spotter information based on a particular callsign
516
+		 *
517
+		 * @return Array the spotter information
518
+		 *
519
+		 */
520 520
 	public function getDateLiveSpotterDataByIdent($ident,$date)
521 521
 	{
522 522
 		$Spotter = new Spotter($this->db);
523 523
 		date_default_timezone_set('UTC');
524 524
 
525 525
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
526
-                $query  = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.ident = :ident AND l.date <= :date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC';
526
+				$query  = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.ident = :ident AND l.date <= :date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC';
527 527
 
528
-                $date = date('c',$date);
528
+				$date = date('c',$date);
529 529
 		$spotter_array = $Spotter->getDataFromDB($query,array(':ident' => $ident,':date' => $date));
530 530
 
531 531
 		return $spotter_array;
532 532
 	}
533 533
 
534
-        /**
535
-	* Gets last spotter information based on a particular callsign
536
-	*
537
-	* @return Array the spotter information
538
-	*
539
-	*/
534
+		/**
535
+		 * Gets last spotter information based on a particular callsign
536
+		 *
537
+		 * @return Array the spotter information
538
+		 *
539
+		 */
540 540
 	public function getLastLiveSpotterDataById($id)
541 541
 	{
542 542
 		$Spotter = new Spotter($this->db);
@@ -547,12 +547,12 @@  discard block
 block discarded – undo
547 547
 		return $spotter_array;
548 548
 	}
549 549
 
550
-        /**
551
-	* Gets last spotter information based on a particular callsign
552
-	*
553
-	* @return Array the spotter information
554
-	*
555
-	*/
550
+		/**
551
+		 * Gets last spotter information based on a particular callsign
552
+		 *
553
+		 * @return Array the spotter information
554
+		 *
555
+		 */
556 556
 	public function getDateLiveSpotterDataById($id,$date)
557 557
 	{
558 558
 		$Spotter = new Spotter($this->db);
@@ -565,21 +565,21 @@  discard block
 block discarded – undo
565 565
 		return $spotter_array;
566 566
 	}
567 567
 
568
-        /**
569
-	* Gets altitude information based on a particular callsign
570
-	*
571
-	* @return Array the spotter information
572
-	*
573
-	*/
568
+		/**
569
+		 * Gets altitude information based on a particular callsign
570
+		 *
571
+		 * @return Array the spotter information
572
+		 *
573
+		 */
574 574
 	public function getAltitudeLiveSpotterDataByIdent($ident)
575 575
 	{
576 576
 
577 577
 		date_default_timezone_set('UTC');
578 578
 
579 579
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
580
-                $query  = 'SELECT spotter_live.altitude, spotter_live.date FROM spotter_live WHERE spotter_live.ident = :ident';
580
+				$query  = 'SELECT spotter_live.altitude, spotter_live.date FROM spotter_live WHERE spotter_live.ident = :ident';
581 581
 
582
-    		try {
582
+			try {
583 583
 			
584 584
 			$sth = $this->db->prepare($query);
585 585
 			$sth->execute(array(':ident' => $ident));
@@ -592,12 +592,12 @@  discard block
 block discarded – undo
592 592
 		return $spotter_array;
593 593
 	}
594 594
 
595
-        /**
596
-	* Gets all the spotter information based on a particular id
597
-	*
598
-	* @return Array the spotter information
599
-	*
600
-	*/
595
+		/**
596
+		 * Gets all the spotter information based on a particular id
597
+		 *
598
+		 * @return Array the spotter information
599
+		 *
600
+		 */
601 601
 	public function getAllLiveSpotterDataById($id,$liveinterval = false)
602 602
 	{
603 603
 		global $globalDBdriver, $globalLiveInterval;
@@ -625,18 +625,18 @@  discard block
 block discarded – undo
625 625
 		return $spotter_array;
626 626
 	}
627 627
 
628
-        /**
629
-	* Gets all the spotter information based on a particular ident
630
-	*
631
-	* @return Array the spotter information
632
-	*
633
-	*/
628
+		/**
629
+		 * Gets all the spotter information based on a particular ident
630
+		 *
631
+		 * @return Array the spotter information
632
+		 *
633
+		 */
634 634
 	public function getAllLiveSpotterDataByIdent($ident)
635 635
 	{
636 636
 		date_default_timezone_set('UTC');
637 637
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
638 638
 		$query  = self::$global_query.' WHERE spotter_live.ident = :ident';
639
-    		try {
639
+			try {
640 640
 			
641 641
 			$sth = $this->db->prepare($query);
642 642
 			$sth->execute(array(':ident' => $ident));
@@ -650,23 +650,23 @@  discard block
 block discarded – undo
650 650
 
651 651
 
652 652
 	/**
653
-	* Deletes all info in the table
654
-	*
655
-	* @return String success or false
656
-	*
657
-	*/
653
+	 * Deletes all info in the table
654
+	 *
655
+	 * @return String success or false
656
+	 *
657
+	 */
658 658
 	public function deleteLiveSpotterData()
659 659
 	{
660 660
 		global $globalDBdriver;
661 661
 		if ($globalDBdriver == 'mysql') {
662 662
 			//$query  = "DELETE FROM spotter_live WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL 30 MINUTE) >= spotter_live.date";
663 663
 			$query  = 'DELETE FROM spotter_live WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL 9 HOUR) >= spotter_live.date';
664
-            		//$query  = "DELETE FROM spotter_live WHERE spotter_live.id IN (SELECT spotter_live.id FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 HOUR) >= spotter_live.date)";
664
+					//$query  = "DELETE FROM spotter_live WHERE spotter_live.id IN (SELECT spotter_live.id FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 HOUR) >= spotter_live.date)";
665 665
 		} else {
666 666
 			$query  = "DELETE FROM spotter_live WHERE NOW() AT TIME ZONE 'UTC' - INTERVAL '9 HOURS' >= spotter_live.date";
667 667
 		}
668 668
         
669
-    		try {
669
+			try {
670 670
 			
671 671
 			$sth = $this->db->prepare($query);
672 672
 			$sth->execute();
@@ -678,18 +678,18 @@  discard block
 block discarded – undo
678 678
 	}
679 679
 
680 680
 	/**
681
-	* Deletes all info in the table for aircraft not seen since 2 HOUR
682
-	*
683
-	* @return String success or false
684
-	*
685
-	*/
681
+	 * Deletes all info in the table for aircraft not seen since 2 HOUR
682
+	 *
683
+	 * @return String success or false
684
+	 *
685
+	 */
686 686
 	public function deleteLiveSpotterDataNotUpdated()
687 687
 	{
688 688
 		global $globalDBdriver, $globalDebug;
689 689
 		if ($globalDBdriver == 'mysql') {
690 690
 			//$query = 'SELECT flightaware_id FROM spotter_live WHERE DATE_SUB(UTC_TIMESTAMP(), INTERVAL 1 HOUR) >= spotter_live.date AND spotter_live.flightaware_id NOT IN (SELECT flightaware_id FROM spotter_live WHERE DATE_SUB(UTC_TIMESTAMP(), INTERVAL 1 HOUR) < spotter_live.date) LIMIT 800 OFFSET 0';
691
-    			$query = "SELECT spotter_live.flightaware_id FROM spotter_live INNER JOIN (SELECT flightaware_id,MAX(date) as max_date FROM spotter_live GROUP BY flightaware_id) s ON s.flightaware_id = spotter_live.flightaware_id AND DATE_SUB(UTC_TIMESTAMP(), INTERVAL 2 HOUR) >= s.max_date LIMIT 2000 OFFSET 0";
692
-    			try {
691
+				$query = "SELECT spotter_live.flightaware_id FROM spotter_live INNER JOIN (SELECT flightaware_id,MAX(date) as max_date FROM spotter_live GROUP BY flightaware_id) s ON s.flightaware_id = spotter_live.flightaware_id AND DATE_SUB(UTC_TIMESTAMP(), INTERVAL 2 HOUR) >= s.max_date LIMIT 2000 OFFSET 0";
692
+				try {
693 693
 				
694 694
 				$sth = $this->db->prepare($query);
695 695
 				$sth->execute();
@@ -697,8 +697,8 @@  discard block
 block discarded – undo
697 697
 				return "error";
698 698
 			}
699 699
 			$query_delete = 'DELETE FROM spotter_live WHERE flightaware_id IN (';
700
-                        $i = 0;
701
-                        $j =0;
700
+						$i = 0;
701
+						$j =0;
702 702
 			$all = $sth->fetchAll(PDO::FETCH_ASSOC);
703 703
 			foreach($all as $row)
704 704
 			{
@@ -706,20 +706,20 @@  discard block
 block discarded – undo
706 706
 				$j++;
707 707
 				if ($j == 30) {
708 708
 					if ($globalDebug) echo ".";
709
-				    	try {
709
+						try {
710 710
 						
711 711
 						$sth = $this->db->prepare(substr($query_delete,0,-1).")");
712 712
 						$sth->execute();
713 713
 					} catch(PDOException $e) {
714 714
 						return "error";
715 715
 					}
716
-                                	$query_delete = 'DELETE FROM spotter_live WHERE flightaware_id IN (';
717
-                                	$j = 0;
716
+									$query_delete = 'DELETE FROM spotter_live WHERE flightaware_id IN (';
717
+									$j = 0;
718 718
 				}
719 719
 				$query_delete .= "'".$row['flightaware_id']."',";
720 720
 			}
721 721
 			if ($i > 0) {
722
-    				try {
722
+					try {
723 723
 					
724 724
 					$sth = $this->db->prepare(substr($query_delete,0,-1).")");
725 725
 					$sth->execute();
@@ -730,9 +730,9 @@  discard block
 block discarded – undo
730 730
 			return "success";
731 731
 		} elseif ($globalDBdriver == 'pgsql') {
732 732
 			//$query = "SELECT flightaware_id FROM spotter_live WHERE NOW() AT TIME ZONE 'UTC' - INTERVAL '9 HOURS' >= spotter_live.date AND spotter_live.flightaware_id NOT IN (SELECT flightaware_id FROM spotter_live WHERE NOW() AT TIME ZONE 'UTC' - INTERVAL '9 HOURS' < spotter_live.date) LIMIT 800 OFFSET 0";
733
-    			//$query = "SELECT spotter_live.flightaware_id FROM spotter_live INNER JOIN (SELECT flightaware_id,MAX(date) as max_date FROM spotter_live GROUP BY flightaware_id) s ON s.flightaware_id = spotter_live.flightaware_id AND NOW() AT TIME ZONE 'UTC' - INTERVAL '2 HOURS' >= s.max_date LIMIT 800 OFFSET 0";
734
-    			$query = "DELETE FROM spotter_live WHERE flightaware_id IN (SELECT spotter_live.flightaware_id FROM spotter_live INNER JOIN (SELECT flightaware_id,MAX(date) as max_date FROM spotter_live GROUP BY flightaware_id) s ON s.flightaware_id = spotter_live.flightaware_id AND NOW() AT TIME ZONE 'UTC' - INTERVAL '2 HOURS' >= s.max_date LIMIT 2000 OFFSET 0)";
735
-    			try {
733
+				//$query = "SELECT spotter_live.flightaware_id FROM spotter_live INNER JOIN (SELECT flightaware_id,MAX(date) as max_date FROM spotter_live GROUP BY flightaware_id) s ON s.flightaware_id = spotter_live.flightaware_id AND NOW() AT TIME ZONE 'UTC' - INTERVAL '2 HOURS' >= s.max_date LIMIT 800 OFFSET 0";
734
+				$query = "DELETE FROM spotter_live WHERE flightaware_id IN (SELECT spotter_live.flightaware_id FROM spotter_live INNER JOIN (SELECT flightaware_id,MAX(date) as max_date FROM spotter_live GROUP BY flightaware_id) s ON s.flightaware_id = spotter_live.flightaware_id AND NOW() AT TIME ZONE 'UTC' - INTERVAL '2 HOURS' >= s.max_date LIMIT 2000 OFFSET 0)";
735
+				try {
736 736
 				
737 737
 				$sth = $this->db->prepare($query);
738 738
 				$sth->execute();
@@ -776,17 +776,17 @@  discard block
 block discarded – undo
776 776
 	}
777 777
 
778 778
 	/**
779
-	* Deletes all info in the table for an ident
780
-	*
781
-	* @return String success or false
782
-	*
783
-	*/
779
+	 * Deletes all info in the table for an ident
780
+	 *
781
+	 * @return String success or false
782
+	 *
783
+	 */
784 784
 	public function deleteLiveSpotterDataByIdent($ident)
785 785
 	{
786 786
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
787 787
 		$query  = 'DELETE FROM spotter_live WHERE ident = :ident';
788 788
         
789
-    		try {
789
+			try {
790 790
 			
791 791
 			$sth = $this->db->prepare($query);
792 792
 			$sth->execute(array(':ident' => $ident));
@@ -798,17 +798,17 @@  discard block
 block discarded – undo
798 798
 	}
799 799
 
800 800
 	/**
801
-	* Deletes all info in the table for an id
802
-	*
803
-	* @return String success or false
804
-	*
805
-	*/
801
+	 * Deletes all info in the table for an id
802
+	 *
803
+	 * @return String success or false
804
+	 *
805
+	 */
806 806
 	public function deleteLiveSpotterDataById($id)
807 807
 	{
808 808
 		$id = filter_var($id, FILTER_SANITIZE_STRING);
809 809
 		$query  = 'DELETE FROM spotter_live WHERE flightaware_id = :id';
810 810
         
811
-    		try {
811
+			try {
812 812
 			
813 813
 			$sth = $this->db->prepare($query);
814 814
 			$sth->execute(array(':id' => $id));
@@ -821,11 +821,11 @@  discard block
 block discarded – undo
821 821
 
822 822
 
823 823
 	/**
824
-	* Gets the aircraft ident within the last hour
825
-	*
826
-	* @return String the ident
827
-	*
828
-	*/
824
+	 * Gets the aircraft ident within the last hour
825
+	 *
826
+	 * @return String the ident
827
+	 *
828
+	 */
829 829
 	public function getIdentFromLastHour($ident)
830 830
 	{
831 831
 		global $globalDBdriver, $globalTimezone;
@@ -851,14 +851,14 @@  discard block
 block discarded – undo
851 851
 			$ident_result = $row['ident'];
852 852
 		}
853 853
 		return $ident_result;
854
-        }
854
+		}
855 855
 
856 856
 	/**
857
-	* Check recent aircraft
858
-	*
859
-	* @return String the ident
860
-	*
861
-	*/
857
+	 * Check recent aircraft
858
+	 *
859
+	 * @return String the ident
860
+	 *
861
+	 */
862 862
 	public function checkIdentRecent($ident)
863 863
 	{
864 864
 		global $globalDBdriver, $globalTimezone;
@@ -884,14 +884,14 @@  discard block
 block discarded – undo
884 884
 			$ident_result = $row['flightaware_id'];
885 885
 		}
886 886
 		return $ident_result;
887
-        }
887
+		}
888 888
 
889 889
 	/**
890
-	* Check recent aircraft by id
891
-	*
892
-	* @return String the ident
893
-	*
894
-	*/
890
+	 * Check recent aircraft by id
891
+	 *
892
+	 * @return String the ident
893
+	 *
894
+	 */
895 895
 	public function checkIdRecent($id)
896 896
 	{
897 897
 		global $globalDBdriver, $globalTimezone;
@@ -917,14 +917,14 @@  discard block
 block discarded – undo
917 917
 			$ident_result = $row['flightaware_id'];
918 918
 		}
919 919
 		return $ident_result;
920
-        }
920
+		}
921 921
 
922 922
 	/**
923
-	* Check recent aircraft by ModeS
924
-	*
925
-	* @return String the ModeS
926
-	*
927
-	*/
923
+	 * Check recent aircraft by ModeS
924
+	 *
925
+	 * @return String the ModeS
926
+	 *
927
+	 */
928 928
 	public function checkModeSRecent($modes)
929 929
 	{
930 930
 		global $globalDBdriver, $globalTimezone;
@@ -951,19 +951,19 @@  discard block
 block discarded – undo
951 951
 			$ident_result = $row['flightaware_id'];
952 952
 		}
953 953
 		return $ident_result;
954
-        }
954
+		}
955 955
 
956 956
 	/**
957
-	* Adds a new spotter data
958
-	*
959
-	* @param String $flightaware_id the ID from flightaware
960
-	* @param String $ident the flight ident
961
-	* @param String $aircraft_icao the aircraft type
962
-	* @param String $departure_airport_icao the departure airport
963
-	* @param String $arrival_airport_icao the arrival airport
964
-	* @return String success or false
965
-	*
966
-	*/
957
+	 * Adds a new spotter data
958
+	 *
959
+	 * @param String $flightaware_id the ID from flightaware
960
+	 * @param String $ident the flight ident
961
+	 * @param String $aircraft_icao the aircraft type
962
+	 * @param String $departure_airport_icao the departure airport
963
+	 * @param String $arrival_airport_icao the arrival airport
964
+	 * @return String success or false
965
+	 *
966
+	 */
967 967
 	public function addLiveSpotterData($flightaware_id = '', $ident = '', $aircraft_icao = '', $departure_airport_icao = '', $arrival_airport_icao = '', $latitude = '', $longitude = '', $waypoints = '', $altitude = '', $altitude_real = '',$heading = '', $groundspeed = '', $date = '',$departure_airport_time = '', $arrival_airport_time = '', $squawk = '', $route_stop = '', $ModeS = '', $putinarchive = false,$registration = '',$pilot_id = '', $pilot_name = '', $verticalrate = '', $noarchive = false, $ground = false,$format_source = '', $source_name = '', $over_country = '')
968 968
 	{
969 969
 		global $globalURL, $globalArchive, $globalDebug;
@@ -1106,10 +1106,10 @@  discard block
 block discarded – undo
1106 1106
 		$arrival_airport_country = '';
1107 1107
 		
1108 1108
             	
1109
-            	if ($squawk == '' || $Common->isInteger($squawk) === false ) $squawk = NULL;
1110
-            	if ($verticalrate == '' || $Common->isInteger($verticalrate) === false ) $verticalrate = NULL;
1111
-            	if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) $groundspeed = 0;
1112
-            	if ($heading == '' || $Common->isInteger($heading) === false ) $heading = 0;
1109
+				if ($squawk == '' || $Common->isInteger($squawk) === false ) $squawk = NULL;
1110
+				if ($verticalrate == '' || $Common->isInteger($verticalrate) === false ) $verticalrate = NULL;
1111
+				if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) $groundspeed = 0;
1112
+				if ($heading == '' || $Common->isInteger($heading) === false ) $heading = 0;
1113 1113
 		
1114 1114
 		$query = '';
1115 1115
 		if ($globalArchive) {
@@ -1130,10 +1130,10 @@  discard block
 block discarded – undo
1130 1130
 			return "error : ".$e->getMessage();
1131 1131
 		}
1132 1132
 		if (isset($globalArchive) && $globalArchive && $putinarchive && $noarchive !== true) {
1133
-		    if ($globalDebug) echo '(Add to SBS archive : ';
1134
-		    $SpotterArchive = new SpotterArchive($this->db);
1135
-		    $result =  $SpotterArchive->addSpotterArchiveData($flightaware_id, $ident, $registration, $airline_name, $airline_icao, $airline_country, $airline_type, $aircraft_icao, $aircraft_shadow, $aircraft_name, $aircraft_manufacturer, $departure_airport_icao, $departure_airport_name, $departure_airport_city, $departure_airport_country, $departure_airport_time,$arrival_airport_icao, $arrival_airport_name, $arrival_airport_city, $arrival_airport_country, $arrival_airport_time, $route_stop, $date,$latitude, $longitude, $waypoints, $altitude, $altitude_real,$heading, $groundspeed, $squawk, $ModeS, $pilot_id, $pilot_name,$verticalrate,$format_source,$source_name, $over_country);
1136
-		    if ($globalDebug) echo $result.')';
1133
+			if ($globalDebug) echo '(Add to SBS archive : ';
1134
+			$SpotterArchive = new SpotterArchive($this->db);
1135
+			$result =  $SpotterArchive->addSpotterArchiveData($flightaware_id, $ident, $registration, $airline_name, $airline_icao, $airline_country, $airline_type, $aircraft_icao, $aircraft_shadow, $aircraft_name, $aircraft_manufacturer, $departure_airport_icao, $departure_airport_name, $departure_airport_city, $departure_airport_country, $departure_airport_time,$arrival_airport_icao, $arrival_airport_name, $arrival_airport_city, $arrival_airport_country, $arrival_airport_time, $route_stop, $date,$latitude, $longitude, $waypoints, $altitude, $altitude_real,$heading, $groundspeed, $squawk, $ModeS, $pilot_id, $pilot_name,$verticalrate,$format_source,$source_name, $over_country);
1136
+			if ($globalDebug) echo $result.')';
1137 1137
 		} elseif ($globalDebug && $putinarchive !== true) {
1138 1138
 			echo '(Not adding to archive)';
1139 1139
 		} elseif ($globalDebug && $noarchive === true) {
Please login to merge, or discard this patch.
require/class.TrackerLive.php 1 patch
Indentation   +196 added lines, -196 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;
@@ -247,11 +247,11 @@  discard block
 block discarded – undo
247 247
 	}
248 248
 
249 249
 	/**
250
-	* Gets number of latest data entry
251
-	*
252
-	* @return String number of entry
253
-	*
254
-	*/
250
+	 * Gets number of latest data entry
251
+	 *
252
+	 * @return String number of entry
253
+	 *
254
+	 */
255 255
 	public function getLiveTrackerCount($filter = array())
256 256
 	{
257 257
 		global $globalDBdriver, $globalLiveInterval;
@@ -276,11 +276,11 @@  discard block
 block discarded – undo
276 276
 	}
277 277
 
278 278
 	/**
279
-	* Gets all the spotter information based on the latest data entry and coord
280
-	*
281
-	* @return Array the spotter information
282
-	*
283
-	*/
279
+	 * Gets all the spotter information based on the latest data entry and coord
280
+	 *
281
+	 * @return Array the spotter information
282
+	 *
283
+	 */
284 284
 	public function getLiveTrackerDatabyCoord($coord, $filter = array())
285 285
 	{
286 286
 		global $globalDBdriver, $globalLiveInterval;
@@ -304,11 +304,11 @@  discard block
 block discarded – undo
304 304
 	}
305 305
 
306 306
 	/**
307
-	* Gets all the spotter information based on the latest data entry and coord
308
-	*
309
-	* @return Array the spotter information
310
-	*
311
-	*/
307
+	 * Gets all the spotter information based on the latest data entry and coord
308
+	 *
309
+	 * @return Array the spotter information
310
+	 *
311
+	 */
312 312
 	public function getMinLiveTrackerDatabyCoord($coord, $filter = array())
313 313
 	{
314 314
 		global $globalDBdriver, $globalLiveInterval;
@@ -335,11 +335,11 @@  discard block
 block discarded – undo
335 335
 	}
336 336
 
337 337
 	/**
338
-	* Gets all the spotter information based on a user's latitude and longitude
339
-	*
340
-	* @return Array the spotter information
341
-	*
342
-	*/
338
+	 * Gets all the spotter information based on a user's latitude and longitude
339
+	 *
340
+	 * @return Array the spotter information
341
+	 *
342
+	 */
343 343
 	public function getLatestTrackerForLayar($lat, $lng, $radius, $interval)
344 344
 	{
345 345
 		$Tracker = new Tracker($this->db);
@@ -352,142 +352,142 @@  discard block
 block discarded – undo
352 352
 		if ($lng != '')
353 353
 		{
354 354
 			if (!is_numeric($lng))
355
-                        {
356
-                                return false;
357
-                        }
358
-                }
359
-
360
-                if ($radius != '')
361
-                {
362
-                        if (!is_numeric($radius))
363
-                        {
364
-                                return false;
365
-                        }
366
-                }
355
+						{
356
+								return false;
357
+						}
358
+				}
359
+
360
+				if ($radius != '')
361
+				{
362
+						if (!is_numeric($radius))
363
+						{
364
+								return false;
365
+						}
366
+				}
367 367
 		$additional_query = '';
368 368
 		if ($interval != '')
369
-                {
370
-                        if (!is_string($interval))
371
-                        {
372
-                                //$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= tracker_live.date ';
373
-			        return false;
374
-                        } else {
375
-                if ($interval == '1m')
376
-                {
377
-                    $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= tracker_live.date ';
378
-                } else if ($interval == '15m'){
379
-                    $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 15 MINUTE) <= tracker_live.date ';
380
-                } 
381
-            }
382
-                } else {
383
-         $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= tracker_live.date ';   
384
-        }
385
-
386
-                $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 
369
+				{
370
+						if (!is_string($interval))
371
+						{
372
+								//$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= tracker_live.date ';
373
+					return false;
374
+						} else {
375
+				if ($interval == '1m')
376
+				{
377
+					$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= tracker_live.date ';
378
+				} else if ($interval == '15m'){
379
+					$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 15 MINUTE) <= tracker_live.date ';
380
+				} 
381
+			}
382
+				} else {
383
+		 $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= tracker_live.date ';   
384
+		}
385
+
386
+				$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 
387 387
                    WHERE tracker_live.latitude <> '' 
388 388
                                    AND tracker_live.longitude <> '' 
389 389
                    ".$additional_query."
390 390
                    HAVING distance < :radius  
391 391
                                    ORDER BY distance";
392 392
 
393
-                $spotter_array = $Tracker->getDataFromDB($query, array(':lat' => $lat, ':lng' => $lng,':radius' => $radius));
393
+				$spotter_array = $Tracker->getDataFromDB($query, array(':lat' => $lat, ':lng' => $lng,':radius' => $radius));
394 394
 
395
-                return $spotter_array;
396
-        }
395
+				return $spotter_array;
396
+		}
397 397
 
398 398
     
399
-        /**
400
-	* Gets all the spotter information based on a particular callsign
401
-	*
402
-	* @return Array the spotter information
403
-	*
404
-	*/
399
+		/**
400
+		 * Gets all the spotter information based on a particular callsign
401
+		 *
402
+		 * @return Array the spotter information
403
+		 *
404
+		 */
405 405
 	public function getLastLiveTrackerDataByIdent($ident)
406 406
 	{
407 407
 		$Tracker = new Tracker($this->db);
408 408
 		date_default_timezone_set('UTC');
409 409
 
410 410
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
411
-                $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';
411
+				$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';
412 412
 
413 413
 		$spotter_array = $Tracker->getDataFromDB($query,array(':ident' => $ident),'',true);
414 414
 
415 415
 		return $spotter_array;
416 416
 	}
417 417
 
418
-        /**
419
-	* Gets all the spotter information based on a particular callsign
420
-	*
421
-	* @return Array the spotter information
422
-	*
423
-	*/
418
+		/**
419
+		 * Gets all the spotter information based on a particular callsign
420
+		 *
421
+		 * @return Array the spotter information
422
+		 *
423
+		 */
424 424
 	public function getDateLiveTrackerDataByIdent($ident,$date)
425 425
 	{
426 426
 		$Tracker = new Tracker($this->db);
427 427
 		date_default_timezone_set('UTC');
428 428
 
429 429
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
430
-                $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';
430
+				$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';
431 431
 
432
-                $date = date('c',$date);
432
+				$date = date('c',$date);
433 433
 		$spotter_array = $Tracker->getDataFromDB($query,array(':ident' => $ident,':date' => $date));
434 434
 
435 435
 		return $spotter_array;
436 436
 	}
437 437
 
438
-        /**
439
-	* Gets last spotter information based on a particular callsign
440
-	*
441
-	* @return Array the spotter information
442
-	*
443
-	*/
438
+		/**
439
+		 * Gets last spotter information based on a particular callsign
440
+		 *
441
+		 * @return Array the spotter information
442
+		 *
443
+		 */
444 444
 	public function getLastLiveTrackerDataById($id)
445 445
 	{
446 446
 		$Tracker = new Tracker($this->db);
447 447
 		date_default_timezone_set('UTC');
448 448
 
449 449
 		$id = filter_var($id, FILTER_SANITIZE_STRING);
450
-                $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';
450
+				$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';
451 451
 
452 452
 		$spotter_array = $Tracker->getDataFromDB($query,array(':id' => $id),'',true);
453 453
 
454 454
 		return $spotter_array;
455 455
 	}
456 456
 
457
-        /**
458
-	* Gets last spotter information based on a particular callsign
459
-	*
460
-	* @return Array the spotter information
461
-	*
462
-	*/
457
+		/**
458
+		 * Gets last spotter information based on a particular callsign
459
+		 *
460
+		 * @return Array the spotter information
461
+		 *
462
+		 */
463 463
 	public function getDateLiveTrackerDataById($id,$date)
464 464
 	{
465 465
 		$Tracker = new Tracker($this->db);
466 466
 		date_default_timezone_set('UTC');
467 467
 
468 468
 		$id = filter_var($id, FILTER_SANITIZE_STRING);
469
-                $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';
470
-                $date = date('c',$date);
469
+				$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';
470
+				$date = date('c',$date);
471 471
 		$spotter_array = $Tracker->getDataFromDB($query,array(':id' => $id,':date' => $date),'',true);
472 472
 
473 473
 		return $spotter_array;
474 474
 	}
475 475
 
476
-        /**
477
-	* Gets altitude information based on a particular callsign
478
-	*
479
-	* @return Array the spotter information
480
-	*
481
-	*/
476
+		/**
477
+		 * Gets altitude information based on a particular callsign
478
+		 *
479
+		 * @return Array the spotter information
480
+		 *
481
+		 */
482 482
 	public function getAltitudeLiveTrackerDataByIdent($ident)
483 483
 	{
484 484
 
485 485
 		date_default_timezone_set('UTC');
486 486
 
487 487
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
488
-                $query  = 'SELECT tracker_live.altitude, tracker_live.date FROM tracker_live WHERE tracker_live.ident = :ident';
488
+				$query  = 'SELECT tracker_live.altitude, tracker_live.date FROM tracker_live WHERE tracker_live.ident = :ident';
489 489
 
490
-    		try {
490
+			try {
491 491
 			
492 492
 			$sth = $this->db->prepare($query);
493 493
 			$sth->execute(array(':ident' => $ident));
@@ -500,12 +500,12 @@  discard block
 block discarded – undo
500 500
 		return $spotter_array;
501 501
 	}
502 502
 
503
-        /**
504
-	* Gets all the spotter information based on a particular id
505
-	*
506
-	* @return Array the spotter information
507
-	*
508
-	*/
503
+		/**
504
+		 * Gets all the spotter information based on a particular id
505
+		 *
506
+		 * @return Array the spotter information
507
+		 *
508
+		 */
509 509
 	public function getAllLiveTrackerDataById($id,$liveinterval = false)
510 510
 	{
511 511
 		global $globalDBdriver, $globalLiveInterval;
@@ -533,18 +533,18 @@  discard block
 block discarded – undo
533 533
 		return $spotter_array;
534 534
 	}
535 535
 
536
-        /**
537
-	* Gets all the spotter information based on a particular ident
538
-	*
539
-	* @return Array the spotter information
540
-	*
541
-	*/
536
+		/**
537
+		 * Gets all the spotter information based on a particular ident
538
+		 *
539
+		 * @return Array the spotter information
540
+		 *
541
+		 */
542 542
 	public function getAllLiveTrackerDataByIdent($ident)
543 543
 	{
544 544
 		date_default_timezone_set('UTC');
545 545
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
546 546
 		$query  = self::$global_query.' WHERE tracker_live.ident = :ident';
547
-    		try {
547
+			try {
548 548
 			
549 549
 			$sth = $this->db->prepare($query);
550 550
 			$sth->execute(array(':ident' => $ident));
@@ -558,23 +558,23 @@  discard block
 block discarded – undo
558 558
 
559 559
 
560 560
 	/**
561
-	* Deletes all info in the table
562
-	*
563
-	* @return String success or false
564
-	*
565
-	*/
561
+	 * Deletes all info in the table
562
+	 *
563
+	 * @return String success or false
564
+	 *
565
+	 */
566 566
 	public function deleteLiveTrackerData()
567 567
 	{
568 568
 		global $globalDBdriver;
569 569
 		if ($globalDBdriver == 'mysql') {
570 570
 			//$query  = "DELETE FROM tracker_live WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL 30 MINUTE) >= tracker_live.date";
571 571
 			$query  = 'DELETE FROM tracker_live WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL 9 HOUR) >= tracker_live.date';
572
-            		//$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)";
572
+					//$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)";
573 573
 		} else {
574 574
 			$query  = "DELETE FROM tracker_live WHERE NOW() AT TIME ZONE 'UTC' - INTERVAL '9 HOURS' >= tracker_live.date";
575 575
 		}
576 576
         
577
-    		try {
577
+			try {
578 578
 			
579 579
 			$sth = $this->db->prepare($query);
580 580
 			$sth->execute();
@@ -586,18 +586,18 @@  discard block
 block discarded – undo
586 586
 	}
587 587
 
588 588
 	/**
589
-	* Deletes all info in the table for aircraft not seen since 2 HOUR
590
-	*
591
-	* @return String success or false
592
-	*
593
-	*/
589
+	 * Deletes all info in the table for aircraft not seen since 2 HOUR
590
+	 *
591
+	 * @return String success or false
592
+	 *
593
+	 */
594 594
 	public function deleteLiveTrackerDataNotUpdated()
595 595
 	{
596 596
 		global $globalDBdriver, $globalDebug;
597 597
 		if ($globalDBdriver == 'mysql') {
598 598
 			//$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';
599
-    			$query = "SELECT tracker_live.famtrackid FROM tracker_live INNER JOIN (SELECT famtrackid,MAX(date) as max_date FROM tracker_live GROUP BY famtrackid) s ON s.famtrackid = tracker_live.famtrackid AND DATE_SUB(UTC_TIMESTAMP(), INTERVAL 2 HOUR) >= s.max_date LIMIT 1200 OFFSET 0";
600
-    			try {
599
+				$query = "SELECT tracker_live.famtrackid FROM tracker_live INNER JOIN (SELECT famtrackid,MAX(date) as max_date FROM tracker_live GROUP BY famtrackid) s ON s.famtrackid = tracker_live.famtrackid AND DATE_SUB(UTC_TIMESTAMP(), INTERVAL 2 HOUR) >= s.max_date LIMIT 1200 OFFSET 0";
600
+				try {
601 601
 				
602 602
 				$sth = $this->db->prepare($query);
603 603
 				$sth->execute();
@@ -605,8 +605,8 @@  discard block
 block discarded – undo
605 605
 				return "error";
606 606
 			}
607 607
 			$query_delete = 'DELETE FROM tracker_live WHERE famtrackid IN (';
608
-                        $i = 0;
609
-                        $j =0;
608
+						$i = 0;
609
+						$j =0;
610 610
 			$all = $sth->fetchAll(PDO::FETCH_ASSOC);
611 611
 			foreach($all as $row)
612 612
 			{
@@ -614,20 +614,20 @@  discard block
 block discarded – undo
614 614
 				$j++;
615 615
 				if ($j == 30) {
616 616
 					if ($globalDebug) echo ".";
617
-				    	try {
617
+						try {
618 618
 						
619 619
 						$sth = $this->db->prepare(substr($query_delete,0,-1).")");
620 620
 						$sth->execute();
621 621
 					} catch(PDOException $e) {
622 622
 						return "error";
623 623
 					}
624
-                                	$query_delete = 'DELETE FROM tracker_live WHERE famtrackid IN (';
625
-                                	$j = 0;
624
+									$query_delete = 'DELETE FROM tracker_live WHERE famtrackid IN (';
625
+									$j = 0;
626 626
 				}
627 627
 				$query_delete .= "'".$row['famtrackid']."',";
628 628
 			}
629 629
 			if ($i > 0) {
630
-    				try {
630
+					try {
631 631
 					
632 632
 					$sth = $this->db->prepare(substr($query_delete,0,-1).")");
633 633
 					$sth->execute();
@@ -638,9 +638,9 @@  discard block
 block discarded – undo
638 638
 			return "success";
639 639
 		} elseif ($globalDBdriver == 'pgsql') {
640 640
 			//$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";
641
-    			//$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";
642
-    			$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)";
643
-    			try {
641
+				//$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";
642
+				$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)";
643
+				try {
644 644
 				
645 645
 				$sth = $this->db->prepare($query);
646 646
 				$sth->execute();
@@ -684,17 +684,17 @@  discard block
 block discarded – undo
684 684
 	}
685 685
 
686 686
 	/**
687
-	* Deletes all info in the table for an ident
688
-	*
689
-	* @return String success or false
690
-	*
691
-	*/
687
+	 * Deletes all info in the table for an ident
688
+	 *
689
+	 * @return String success or false
690
+	 *
691
+	 */
692 692
 	public function deleteLiveTrackerDataByIdent($ident)
693 693
 	{
694 694
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
695 695
 		$query  = 'DELETE FROM tracker_live WHERE ident = :ident';
696 696
         
697
-    		try {
697
+			try {
698 698
 			
699 699
 			$sth = $this->db->prepare($query);
700 700
 			$sth->execute(array(':ident' => $ident));
@@ -706,17 +706,17 @@  discard block
 block discarded – undo
706 706
 	}
707 707
 
708 708
 	/**
709
-	* Deletes all info in the table for an id
710
-	*
711
-	* @return String success or false
712
-	*
713
-	*/
709
+	 * Deletes all info in the table for an id
710
+	 *
711
+	 * @return String success or false
712
+	 *
713
+	 */
714 714
 	public function deleteLiveTrackerDataById($id)
715 715
 	{
716 716
 		$id = filter_var($id, FILTER_SANITIZE_STRING);
717 717
 		$query  = 'DELETE FROM tracker_live WHERE famtrackid = :id';
718 718
         
719
-    		try {
719
+			try {
720 720
 			
721 721
 			$sth = $this->db->prepare($query);
722 722
 			$sth->execute(array(':id' => $id));
@@ -729,11 +729,11 @@  discard block
 block discarded – undo
729 729
 
730 730
 
731 731
 	/**
732
-	* Gets the aircraft ident within the last hour
733
-	*
734
-	* @return String the ident
735
-	*
736
-	*/
732
+	 * Gets the aircraft ident within the last hour
733
+	 *
734
+	 * @return String the ident
735
+	 *
736
+	 */
737 737
 	public function getIdentFromLastHour($ident)
738 738
 	{
739 739
 		global $globalDBdriver, $globalTimezone;
@@ -759,14 +759,14 @@  discard block
 block discarded – undo
759 759
 			$ident_result = $row['ident'];
760 760
 		}
761 761
 		return $ident_result;
762
-        }
762
+		}
763 763
 
764 764
 	/**
765
-	* Check recent aircraft
766
-	*
767
-	* @return String the ident
768
-	*
769
-	*/
765
+	 * Check recent aircraft
766
+	 *
767
+	 * @return String the ident
768
+	 *
769
+	 */
770 770
 	public function checkIdentRecent($ident)
771 771
 	{
772 772
 		global $globalDBdriver, $globalTimezone;
@@ -792,14 +792,14 @@  discard block
 block discarded – undo
792 792
 			$ident_result = $row['famtrackid'];
793 793
 		}
794 794
 		return $ident_result;
795
-        }
795
+		}
796 796
 
797 797
 	/**
798
-	* Check recent aircraft by id
799
-	*
800
-	* @return String the ident
801
-	*
802
-	*/
798
+	 * Check recent aircraft by id
799
+	 *
800
+	 * @return String the ident
801
+	 *
802
+	 */
803 803
 	public function checkIdRecent($id)
804 804
 	{
805 805
 		global $globalDBdriver, $globalTimezone;
@@ -825,19 +825,19 @@  discard block
 block discarded – undo
825 825
 			$ident_result = $row['famtrackid'];
826 826
 		}
827 827
 		return $ident_result;
828
-        }
828
+		}
829 829
 
830 830
 	/**
831
-	* Adds a new spotter data
832
-	*
833
-	* @param String $famtrackid the ID from flightaware
834
-	* @param String $ident the flight ident
835
-	* @param String $aircraft_icao the aircraft type
836
-	* @param String $departure_airport_icao the departure airport
837
-	* @param String $arrival_airport_icao the arrival airport
838
-	* @return String success or false
839
-	*
840
-	*/
831
+	 * Adds a new spotter data
832
+	 *
833
+	 * @param String $famtrackid the ID from flightaware
834
+	 * @param String $ident the flight ident
835
+	 * @param String $aircraft_icao the aircraft type
836
+	 * @param String $departure_airport_icao the departure airport
837
+	 * @param String $arrival_airport_icao the arrival airport
838
+	 * @return String success or false
839
+	 *
840
+	 */
841 841
 	public function addLiveTrackerData($famtrackid = '', $ident = '', $latitude = '', $longitude = '', $altitude = '', $heading = '', $groundspeed = '', $date = '', $putinarchive = false, $comment = '', $type = '',$noarchive = false,$format_source = '', $source_name = '', $over_country = '')
842 842
 	{
843 843
 		global $globalURL, $globalArchive, $globalDebug;
@@ -910,8 +910,8 @@  discard block
 block discarded – undo
910 910
 		$comment = filter_var($comment,FILTER_SANITIZE_STRING);
911 911
 		$type = filter_var($type,FILTER_SANITIZE_STRING);
912 912
 
913
-            	if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) $groundspeed = 0;
914
-            	if ($heading == '' || $Common->isInteger($heading) === false ) $heading = 0;
913
+				if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) $groundspeed = 0;
914
+				if ($heading == '' || $Common->isInteger($heading) === false ) $heading = 0;
915 915
             	
916 916
 		$query = '';
917 917
 		if ($globalArchive) {
@@ -926,18 +926,18 @@  discard block
 block discarded – undo
926 926
 			
927 927
 			$sth = $this->db->prepare($query);
928 928
 			$sth->execute($query_values);
929
-                } catch(PDOException $e) {
930
-                	return "error : ".$e->getMessage();
931
-                }
932
-                /*
929
+				} catch(PDOException $e) {
930
+					return "error : ".$e->getMessage();
931
+				}
932
+				/*
933 933
                 echo 'putinarchive : '.$putinarchive."\n";
934 934
                 echo 'noarchive : '.$noarchive."\n";
935 935
                 */
936 936
 		if (isset($globalArchive) && $globalArchive && $putinarchive && $noarchive !== true) {
937
-		    if ($globalDebug) echo '(Add to Tracker archive '.$famtrackid.' : ';
938
-		    $TrackerArchive = new TrackerArchive($this->db);
939
-		    $result =  $TrackerArchive->addTrackerArchiveData($famtrackid, $ident,$latitude, $longitude, $altitude, $heading, $groundspeed, $date, $putinarchive, $comment, $type,$noarchive,$format_source, $source_name, $over_country);
940
-		    if ($globalDebug) echo $result.')';
937
+			if ($globalDebug) echo '(Add to Tracker archive '.$famtrackid.' : ';
938
+			$TrackerArchive = new TrackerArchive($this->db);
939
+			$result =  $TrackerArchive->addTrackerArchiveData($famtrackid, $ident,$latitude, $longitude, $altitude, $heading, $groundspeed, $date, $putinarchive, $comment, $type,$noarchive,$format_source, $source_name, $over_country);
940
+			if ($globalDebug) echo $result.')';
941 941
 		}
942 942
 
943 943
 		return "success";
Please login to merge, or discard this patch.
js/map-aircraft.3d.js.php 1 patch
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -209,21 +209,21 @@  discard block
 block discarded – undo
209 209
 			var entityid = entity.id;
210 210
 			var lastupdateentity = entity.properties.valueOf('lastupdate')._lastupdate._value;
211 211
 			<?php 
212
-			    if (isset($globalMapUseBbox) && $globalMapUseBbox) {
212
+				if (isset($globalMapUseBbox) && $globalMapUseBbox) {
213 213
 			?>
214 214
 			if (lastupdateentity != lastupdate) {
215 215
 				viewer.dataSources.get(dsn).entities.remove(entity);
216 216
 				czmlds.entities.removeById(entityid);
217 217
 			}
218 218
 			<?php
219
-			    } else {
219
+				} else {
220 220
 			?>
221 221
 			if (parseInt(lastupdateentity) < Math.floor(Date.now()-<?php if (isset($globalMapRefresh)) print $globalMapRefresh*2000; else print '60000'; ?>)) {
222 222
 				viewer.dataSources.get(dsn).entities.remove(entity);
223 223
 				czmlds.entities.removeById(entityid);
224 224
 			}
225 225
 			<?php
226
-			    }
226
+				}
227 227
 			?>
228 228
 		}
229 229
 	}
@@ -629,12 +629,12 @@  discard block
 block discarded – undo
629 629
 	update_airportsLayer();
630 630
 }
631 631
 <?php
632
-    if ((isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM)) {
632
+	if ((isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM)) {
633 633
 ?>
634 634
 update_atcLayer();
635 635
 setInterval(function(){update_atcLayer()},<?php if (isset($globalMapRefresh)) print $globalMapRefresh*1000*2; else print '60000'; ?>);
636 636
 <?php
637
-    }
637
+	}
638 638
 ?>
639 639
 
640 640
 function iconColor(color) {
Please login to merge, or discard this patch.
js/map-marine.3d.js.php 1 patch
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -38,20 +38,20 @@  discard block
 block discarded – undo
38 38
 			var entityid = entity.id;
39 39
 			var lastupdateentity = entity.properties.valueOf('lastupdate')._lastupdate._value;
40 40
 			<?php 
41
-			    if (isset($globalMapUseBbox) && $globalMapUseBbox) {
41
+				if (isset($globalMapUseBbox) && $globalMapUseBbox) {
42 42
 			?>
43 43
 			if (lastupdateentity != lastupdatemarine) {
44 44
 				viewer.dataSources.get(dsn).entities.remove(entity);
45 45
 				czmldsmarine.entities.removeById(entityid);
46 46
 			}
47 47
 			<?php
48
-			    } else {
48
+				} else {
49 49
 			?>
50 50
 			if (parseInt(lastupdateentity) < Math.floor(Date.now()-<?php if (isset($globalMapRefresh)) print $globalMapRefresh*2000; else print '60000'; ?>)) {
51 51
 				viewer.dataSources.get(dsn).entities.remove(entity);
52 52
 			}
53 53
 			<?php
54
-			    }
54
+				}
55 55
 			?>
56 56
 		}
57 57
 	}
@@ -73,15 +73,15 @@  discard block
 block discarded – undo
73 73
 function updateMarineData() {
74 74
 	lastupdatemarine = Date.now();
75 75
 <?php
76
-    if (isset($globalMapUseBbox) && $globalMapUseBbox) {
76
+	if (isset($globalMapUseBbox) && $globalMapUseBbox) {
77 77
 ?>
78 78
 	var livemarinedata = czmldsmarine.process('<?php print $globalURL; ?>/live-czml.php?marine&coord='+bbox()+'&update=' + lastupdatemarine);
79 79
 <?php
80
-    } else {
80
+	} else {
81 81
 ?>
82 82
 	var livemarinedata = czmldsmarine.process('<?php print $globalURL; ?>/live-czml.php?marine&update=' + lastupdatemarine);
83 83
 <?php
84
-    }
84
+	}
85 85
 ?>
86 86
 	livemarinedata.then(function (data) { 
87 87
 		displayMarineData(data);
Please login to merge, or discard this patch.
js/map-tracker.3d.js.php 1 patch
Indentation   +6 added lines, -6 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);
Please login to merge, or discard this patch.
require/class.MarineLive.php 1 patch
Indentation   +188 added lines, -188 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 getLiveMarineData($limit = '', $sort = '', $filter = array())
96 96
 	{
97 97
 		global $globalDBdriver, $globalLiveInterval;
@@ -134,11 +134,11 @@  discard block
 block discarded – undo
134 134
 	}
135 135
 
136 136
 	/**
137
-	* Gets Minimal Live Spotter data
138
-	*
139
-	* @return Array the spotter information
140
-	*
141
-	*/
137
+	 * Gets Minimal Live Spotter data
138
+	 *
139
+	 * @return Array the spotter information
140
+	 *
141
+	 */
142 142
 	public function getMinLiveMarineData($filter = array())
143 143
 	{
144 144
 		global $globalDBdriver, $globalLiveInterval;
@@ -168,11 +168,11 @@  discard block
 block discarded – undo
168 168
 	}
169 169
 
170 170
 	/**
171
-	* Gets Minimal Live Spotter data since xx seconds
172
-	*
173
-	* @return Array the spotter information
174
-	*
175
-	*/
171
+	 * Gets Minimal Live Spotter data since xx seconds
172
+	 *
173
+	 * @return Array the spotter information
174
+	 *
175
+	 */
176 176
 	public function getMinLastLiveMarineData($coord = array(),$filter = array(), $limit = false)
177 177
 	{
178 178
 		global $globalDBdriver, $globalLiveInterval, $globalMap3DMarinesLimit, $globalArchive;
@@ -243,11 +243,11 @@  discard block
 block discarded – undo
243 243
 	}
244 244
 
245 245
 	/**
246
-	* Gets number of latest data entry
247
-	*
248
-	* @return String number of entry
249
-	*
250
-	*/
246
+	 * Gets number of latest data entry
247
+	 *
248
+	 * @return String number of entry
249
+	 *
250
+	 */
251 251
 	public function getLiveMarineCount($filter = array())
252 252
 	{
253 253
 		global $globalDBdriver, $globalLiveInterval;
@@ -272,11 +272,11 @@  discard block
 block discarded – undo
272 272
 	}
273 273
 
274 274
 	/**
275
-	* Gets all the spotter information based on the latest data entry and coord
276
-	*
277
-	* @return Array the spotter information
278
-	*
279
-	*/
275
+	 * Gets all the spotter information based on the latest data entry and coord
276
+	 *
277
+	 * @return Array the spotter information
278
+	 *
279
+	 */
280 280
 	public function getLiveMarineDatabyCoord($coord, $filter = array())
281 281
 	{
282 282
 		global $globalDBdriver, $globalLiveInterval;
@@ -300,11 +300,11 @@  discard block
 block discarded – undo
300 300
 	}
301 301
 
302 302
 	/**
303
-	* Gets all the spotter information based on the latest data entry and coord
304
-	*
305
-	* @return Array the spotter information
306
-	*
307
-	*/
303
+	 * Gets all the spotter information based on the latest data entry and coord
304
+	 *
305
+	 * @return Array the spotter information
306
+	 *
307
+	 */
308 308
 	public function getMinLiveMarineDatabyCoord($coord, $filter = array())
309 309
 	{
310 310
 		global $globalDBdriver, $globalLiveInterval;
@@ -332,11 +332,11 @@  discard block
 block discarded – undo
332 332
 	}
333 333
 
334 334
 	/**
335
-	* Gets all the spotter information based on a user's latitude and longitude
336
-	*
337
-	* @return Array the spotter information
338
-	*
339
-	*/
335
+	 * Gets all the spotter information based on a user's latitude and longitude
336
+	 *
337
+	 * @return Array the spotter information
338
+	 *
339
+	 */
340 340
 	public function getLatestMarineForLayar($lat, $lng, $radius, $interval)
341 341
 	{
342 342
 		$Marine = new Marine($this->db);
@@ -349,134 +349,134 @@  discard block
 block discarded – undo
349 349
 		if ($lng != '')
350 350
 		{
351 351
 			if (!is_numeric($lng))
352
-                        {
353
-                                return false;
354
-                        }
355
-                }
356
-
357
-                if ($radius != '')
358
-                {
359
-                        if (!is_numeric($radius))
360
-                        {
361
-                                return false;
362
-                        }
363
-                }
352
+						{
353
+								return false;
354
+						}
355
+				}
356
+
357
+				if ($radius != '')
358
+				{
359
+						if (!is_numeric($radius))
360
+						{
361
+								return false;
362
+						}
363
+				}
364 364
 		$additional_query = '';
365 365
 		if ($interval != '')
366
-                {
367
-                        if (!is_string($interval))
368
-                        {
369
-                                //$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= marine_live.date ';
370
-			        return false;
371
-                        } else {
372
-                if ($interval == '1m')
373
-                {
374
-                    $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= marine_live.date ';
375
-                } else if ($interval == '15m'){
376
-                    $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 15 MINUTE) <= marine_live.date ';
377
-                } 
378
-            }
379
-                } else {
380
-         $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= marine_live.date ';   
381
-        }
382
-
383
-                $query  = "SELECT marine_live.*, ( 6371 * acos( cos( radians(:lat) ) * cos( radians( latitude ) ) * cos( radians( longitude ) - radians(:lng) ) + sin( radians(:lat) ) * sin( radians( latitude ) ) ) ) AS distance FROM marine_live 
366
+				{
367
+						if (!is_string($interval))
368
+						{
369
+								//$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= marine_live.date ';
370
+					return false;
371
+						} else {
372
+				if ($interval == '1m')
373
+				{
374
+					$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= marine_live.date ';
375
+				} else if ($interval == '15m'){
376
+					$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 15 MINUTE) <= marine_live.date ';
377
+				} 
378
+			}
379
+				} else {
380
+		 $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= marine_live.date ';   
381
+		}
382
+
383
+				$query  = "SELECT marine_live.*, ( 6371 * acos( cos( radians(:lat) ) * cos( radians( latitude ) ) * cos( radians( longitude ) - radians(:lng) ) + sin( radians(:lat) ) * sin( radians( latitude ) ) ) ) AS distance FROM marine_live 
384 384
                    WHERE marine_live.latitude <> '' 
385 385
                                    AND marine_live.longitude <> '' 
386 386
                    ".$additional_query."
387 387
                    HAVING distance < :radius  
388 388
                                    ORDER BY distance";
389 389
 
390
-                $spotter_array = $Marine->getDataFromDB($query, array(':lat' => $lat, ':lng' => $lng,':radius' => $radius));
390
+				$spotter_array = $Marine->getDataFromDB($query, array(':lat' => $lat, ':lng' => $lng,':radius' => $radius));
391 391
 
392
-                return $spotter_array;
393
-        }
392
+				return $spotter_array;
393
+		}
394 394
 
395 395
     
396
-        /**
397
-	* Gets all the spotter information based on a particular callsign
398
-	*
399
-	* @return Array the spotter information
400
-	*
401
-	*/
396
+		/**
397
+		 * Gets all the spotter information based on a particular callsign
398
+		 *
399
+		 * @return Array the spotter information
400
+		 *
401
+		 */
402 402
 	public function getLastLiveMarineDataByIdent($ident)
403 403
 	{
404 404
 		$Marine = new Marine($this->db);
405 405
 		date_default_timezone_set('UTC');
406 406
 
407 407
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
408
-                $query  = 'SELECT marine_live.* FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l WHERE l.ident = :ident GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate ORDER BY marine_live.date DESC';
408
+				$query  = 'SELECT marine_live.* FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l WHERE l.ident = :ident GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate ORDER BY marine_live.date DESC';
409 409
 
410 410
 		$spotter_array = $Marine->getDataFromDB($query,array(':ident' => $ident),'',true);
411 411
 
412 412
 		return $spotter_array;
413 413
 	}
414 414
 
415
-        /**
416
-	* Gets all the spotter information based on a particular callsign
417
-	*
418
-	* @return Array the spotter information
419
-	*
420
-	*/
415
+		/**
416
+		 * Gets all the spotter information based on a particular callsign
417
+		 *
418
+		 * @return Array the spotter information
419
+		 *
420
+		 */
421 421
 	public function getDateLiveMarineDataByIdent($ident,$date)
422 422
 	{
423 423
 		$Marine = new Marine($this->db);
424 424
 		date_default_timezone_set('UTC');
425 425
 
426 426
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
427
-                $query  = 'SELECT marine_live.* FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l WHERE l.ident = :ident AND l.date <= :date GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate ORDER BY marine_live.date DESC';
427
+				$query  = 'SELECT marine_live.* FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l WHERE l.ident = :ident AND l.date <= :date GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate ORDER BY marine_live.date DESC';
428 428
 
429
-                $date = date('c',$date);
429
+				$date = date('c',$date);
430 430
 		$spotter_array = $Marine->getDataFromDB($query,array(':ident' => $ident,':date' => $date));
431 431
 
432 432
 		return $spotter_array;
433 433
 	}
434 434
 
435
-        /**
436
-	* Gets last spotter information based on a particular callsign
437
-	*
438
-	* @return Array the spotter information
439
-	*
440
-	*/
435
+		/**
436
+		 * Gets last spotter information based on a particular callsign
437
+		 *
438
+		 * @return Array the spotter information
439
+		 *
440
+		 */
441 441
 	public function getLastLiveMarineDataById($id)
442 442
 	{
443 443
 		$Marine = new Marine($this->db);
444 444
 		date_default_timezone_set('UTC');
445 445
 
446 446
 		$id = filter_var($id, FILTER_SANITIZE_STRING);
447
-                $query  = 'SELECT marine_live.* FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l WHERE l.fammarine_id = :id GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate ORDER BY marine_live.date DESC';
447
+				$query  = 'SELECT marine_live.* FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l WHERE l.fammarine_id = :id GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate ORDER BY marine_live.date DESC';
448 448
 
449 449
 		$spotter_array = $Marine->getDataFromDB($query,array(':id' => $id),'',true);
450 450
 
451 451
 		return $spotter_array;
452 452
 	}
453 453
 
454
-        /**
455
-	* Gets last spotter information based on a particular callsign
456
-	*
457
-	* @return Array the spotter information
458
-	*
459
-	*/
454
+		/**
455
+		 * Gets last spotter information based on a particular callsign
456
+		 *
457
+		 * @return Array the spotter information
458
+		 *
459
+		 */
460 460
 	public function getDateLiveMarineDataById($id,$date)
461 461
 	{
462 462
 		$Marine = new Marine($this->db);
463 463
 		date_default_timezone_set('UTC');
464 464
 
465 465
 		$id = filter_var($id, FILTER_SANITIZE_STRING);
466
-                $query  = 'SELECT marine_live.* FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l WHERE l.fammarine_id = :id AND l.date <= :date GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate ORDER BY marine_live.date DESC';
467
-                $date = date('c',$date);
466
+				$query  = 'SELECT marine_live.* FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l WHERE l.fammarine_id = :id AND l.date <= :date GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate ORDER BY marine_live.date DESC';
467
+				$date = date('c',$date);
468 468
 		$spotter_array = $Marine->getDataFromDB($query,array(':id' => $id,':date' => $date),'',true);
469 469
 
470 470
 		return $spotter_array;
471 471
 	}
472 472
 
473 473
 
474
-        /**
475
-	* Gets all the spotter information based on a particular id
476
-	*
477
-	* @return Array the spotter information
478
-	*
479
-	*/
474
+		/**
475
+		 * Gets all the spotter information based on a particular id
476
+		 *
477
+		 * @return Array the spotter information
478
+		 *
479
+		 */
480 480
 	public function getAllLiveMarineDataById($id,$liveinterval = false)
481 481
 	{
482 482
 		global $globalDBdriver, $globalLiveInterval;
@@ -504,18 +504,18 @@  discard block
 block discarded – undo
504 504
 		return $spotter_array;
505 505
 	}
506 506
 
507
-        /**
508
-	* Gets all the spotter information based on a particular ident
509
-	*
510
-	* @return Array the spotter information
511
-	*
512
-	*/
507
+		/**
508
+		 * Gets all the spotter information based on a particular ident
509
+		 *
510
+		 * @return Array the spotter information
511
+		 *
512
+		 */
513 513
 	public function getAllLiveMarineDataByIdent($ident)
514 514
 	{
515 515
 		date_default_timezone_set('UTC');
516 516
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
517 517
 		$query  = self::$global_query.' WHERE marine_live.ident = :ident';
518
-    		try {
518
+			try {
519 519
 			
520 520
 			$sth = $this->db->prepare($query);
521 521
 			$sth->execute(array(':ident' => $ident));
@@ -529,23 +529,23 @@  discard block
 block discarded – undo
529 529
 
530 530
 
531 531
 	/**
532
-	* Deletes all info in the table
533
-	*
534
-	* @return String success or false
535
-	*
536
-	*/
532
+	 * Deletes all info in the table
533
+	 *
534
+	 * @return String success or false
535
+	 *
536
+	 */
537 537
 	public function deleteLiveMarineData()
538 538
 	{
539 539
 		global $globalDBdriver;
540 540
 		if ($globalDBdriver == 'mysql') {
541 541
 			//$query  = "DELETE FROM marine_live WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL 30 MINUTE) >= marine_live.date";
542 542
 			$query  = 'DELETE FROM marine_live WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL 9 HOUR) >= marine_live.date';
543
-            		//$query  = "DELETE FROM marine_live WHERE marine_live.id IN (SELECT marine_live.id FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 HOUR) >= marine_live.date)";
543
+					//$query  = "DELETE FROM marine_live WHERE marine_live.id IN (SELECT marine_live.id FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 HOUR) >= marine_live.date)";
544 544
 		} else {
545 545
 			$query  = "DELETE FROM marine_live WHERE NOW() AT TIME ZONE 'UTC' - INTERVAL '9 HOURS' >= marine_live.date";
546 546
 		}
547 547
         
548
-    		try {
548
+			try {
549 549
 			
550 550
 			$sth = $this->db->prepare($query);
551 551
 			$sth->execute();
@@ -557,18 +557,18 @@  discard block
 block discarded – undo
557 557
 	}
558 558
 
559 559
 	/**
560
-	* Deletes all info in the table for aircraft not seen since 2 HOUR
561
-	*
562
-	* @return String success or false
563
-	*
564
-	*/
560
+	 * Deletes all info in the table for aircraft not seen since 2 HOUR
561
+	 *
562
+	 * @return String success or false
563
+	 *
564
+	 */
565 565
 	public function deleteLiveMarineDataNotUpdated()
566 566
 	{
567 567
 		global $globalDBdriver, $globalDebug;
568 568
 		if ($globalDBdriver == 'mysql') {
569 569
 			//$query = 'SELECT fammarine_id FROM marine_live WHERE DATE_SUB(UTC_TIMESTAMP(), INTERVAL 1 HOUR) >= marine_live.date AND marine_live.fammarine_id NOT IN (SELECT fammarine_id FROM marine_live WHERE DATE_SUB(UTC_TIMESTAMP(), INTERVAL 1 HOUR) < marine_live.date) LIMIT 800 OFFSET 0';
570
-    			$query = "SELECT marine_live.fammarine_id FROM marine_live INNER JOIN (SELECT fammarine_id,MAX(date) as max_date FROM marine_live GROUP BY fammarine_id) s ON s.fammarine_id = marine_live.fammarine_id AND DATE_SUB(UTC_TIMESTAMP(), INTERVAL 2 HOUR) >= s.max_date LIMIT 1200 OFFSET 0";
571
-    			try {
570
+				$query = "SELECT marine_live.fammarine_id FROM marine_live INNER JOIN (SELECT fammarine_id,MAX(date) as max_date FROM marine_live GROUP BY fammarine_id) s ON s.fammarine_id = marine_live.fammarine_id AND DATE_SUB(UTC_TIMESTAMP(), INTERVAL 2 HOUR) >= s.max_date LIMIT 1200 OFFSET 0";
571
+				try {
572 572
 				
573 573
 				$sth = $this->db->prepare($query);
574 574
 				$sth->execute();
@@ -576,8 +576,8 @@  discard block
 block discarded – undo
576 576
 				return "error";
577 577
 			}
578 578
 			$query_delete = 'DELETE FROM marine_live WHERE fammarine_id IN (';
579
-                        $i = 0;
580
-                        $j =0;
579
+						$i = 0;
580
+						$j =0;
581 581
 			$all = $sth->fetchAll(PDO::FETCH_ASSOC);
582 582
 			foreach($all as $row)
583 583
 			{
@@ -585,20 +585,20 @@  discard block
 block discarded – undo
585 585
 				$j++;
586 586
 				if ($j == 30) {
587 587
 					if ($globalDebug) echo ".";
588
-				    	try {
588
+						try {
589 589
 						
590 590
 						$sth = $this->db->prepare(substr($query_delete,0,-1).")");
591 591
 						$sth->execute();
592 592
 					} catch(PDOException $e) {
593 593
 						return "error";
594 594
 					}
595
-                                	$query_delete = 'DELETE FROM marine_live WHERE fammarine_id IN (';
596
-                                	$j = 0;
595
+									$query_delete = 'DELETE FROM marine_live WHERE fammarine_id IN (';
596
+									$j = 0;
597 597
 				}
598 598
 				$query_delete .= "'".$row['fammarine_id']."',";
599 599
 			}
600 600
 			if ($i > 0) {
601
-    				try {
601
+					try {
602 602
 					
603 603
 					$sth = $this->db->prepare(substr($query_delete,0,-1).")");
604 604
 					$sth->execute();
@@ -609,9 +609,9 @@  discard block
 block discarded – undo
609 609
 			return "success";
610 610
 		} elseif ($globalDBdriver == 'pgsql') {
611 611
 			//$query = "SELECT fammarine_id FROM marine_live WHERE NOW() AT TIME ZONE 'UTC' - INTERVAL '9 HOURS' >= marine_live.date AND marine_live.fammarine_id NOT IN (SELECT fammarine_id FROM marine_live WHERE NOW() AT TIME ZONE 'UTC' - INTERVAL '9 HOURS' < marine_live.date) LIMIT 800 OFFSET 0";
612
-    			//$query = "SELECT marine_live.fammarine_id FROM marine_live INNER JOIN (SELECT fammarine_id,MAX(date) as max_date FROM marine_live GROUP BY fammarine_id) s ON s.fammarine_id = marine_live.fammarine_id AND NOW() AT TIME ZONE 'UTC' - INTERVAL '2 HOURS' >= s.max_date LIMIT 800 OFFSET 0";
613
-    			$query = "DELETE FROM marine_live WHERE fammarine_id IN (SELECT marine_live.fammarine_id FROM marine_live INNER JOIN (SELECT fammarine_id,MAX(date) as max_date FROM marine_live GROUP BY fammarine_id) s ON s.fammarine_id = marine_live.fammarine_id AND NOW() AT TIME ZONE 'UTC' - INTERVAL '2 HOURS' >= s.max_date LIMIT 800 OFFSET 0)";
614
-    			try {
612
+				//$query = "SELECT marine_live.fammarine_id FROM marine_live INNER JOIN (SELECT fammarine_id,MAX(date) as max_date FROM marine_live GROUP BY fammarine_id) s ON s.fammarine_id = marine_live.fammarine_id AND NOW() AT TIME ZONE 'UTC' - INTERVAL '2 HOURS' >= s.max_date LIMIT 800 OFFSET 0";
613
+				$query = "DELETE FROM marine_live WHERE fammarine_id IN (SELECT marine_live.fammarine_id FROM marine_live INNER JOIN (SELECT fammarine_id,MAX(date) as max_date FROM marine_live GROUP BY fammarine_id) s ON s.fammarine_id = marine_live.fammarine_id AND NOW() AT TIME ZONE 'UTC' - INTERVAL '2 HOURS' >= s.max_date LIMIT 800 OFFSET 0)";
614
+				try {
615 615
 				
616 616
 				$sth = $this->db->prepare($query);
617 617
 				$sth->execute();
@@ -655,17 +655,17 @@  discard block
 block discarded – undo
655 655
 	}
656 656
 
657 657
 	/**
658
-	* Deletes all info in the table for an ident
659
-	*
660
-	* @return String success or false
661
-	*
662
-	*/
658
+	 * Deletes all info in the table for an ident
659
+	 *
660
+	 * @return String success or false
661
+	 *
662
+	 */
663 663
 	public function deleteLiveMarineDataByIdent($ident)
664 664
 	{
665 665
 		$ident = filter_var($ident, FILTER_SANITIZE_STRING);
666 666
 		$query  = 'DELETE FROM marine_live WHERE ident = :ident';
667 667
         
668
-    		try {
668
+			try {
669 669
 			
670 670
 			$sth = $this->db->prepare($query);
671 671
 			$sth->execute(array(':ident' => $ident));
@@ -677,17 +677,17 @@  discard block
 block discarded – undo
677 677
 	}
678 678
 
679 679
 	/**
680
-	* Deletes all info in the table for an id
681
-	*
682
-	* @return String success or false
683
-	*
684
-	*/
680
+	 * Deletes all info in the table for an id
681
+	 *
682
+	 * @return String success or false
683
+	 *
684
+	 */
685 685
 	public function deleteLiveMarineDataById($id)
686 686
 	{
687 687
 		$id = filter_var($id, FILTER_SANITIZE_STRING);
688 688
 		$query  = 'DELETE FROM marine_live WHERE fammarine_id = :id';
689 689
         
690
-    		try {
690
+			try {
691 691
 			
692 692
 			$sth = $this->db->prepare($query);
693 693
 			$sth->execute(array(':id' => $id));
@@ -700,11 +700,11 @@  discard block
 block discarded – undo
700 700
 
701 701
 
702 702
 	/**
703
-	* Gets the aircraft ident within the last hour
704
-	*
705
-	* @return String the ident
706
-	*
707
-	*/
703
+	 * Gets the aircraft ident within the last hour
704
+	 *
705
+	 * @return String the ident
706
+	 *
707
+	 */
708 708
 	public function getIdentFromLastHour($ident)
709 709
 	{
710 710
 		global $globalDBdriver, $globalTimezone;
@@ -730,14 +730,14 @@  discard block
 block discarded – undo
730 730
 			$ident_result = $row['ident'];
731 731
 		}
732 732
 		return $ident_result;
733
-        }
733
+		}
734 734
 
735 735
 	/**
736
-	* Check recent aircraft
737
-	*
738
-	* @return String the ident
739
-	*
740
-	*/
736
+	 * Check recent aircraft
737
+	 *
738
+	 * @return String the ident
739
+	 *
740
+	 */
741 741
 	public function checkIdentRecent($ident)
742 742
 	{
743 743
 		global $globalDBdriver, $globalTimezone;
@@ -763,14 +763,14 @@  discard block
 block discarded – undo
763 763
 			$ident_result = $row['fammarine_id'];
764 764
 		}
765 765
 		return $ident_result;
766
-        }
766
+		}
767 767
 
768 768
 	/**
769
-	* Check recent aircraft by id
770
-	*
771
-	* @return String the ident
772
-	*
773
-	*/
769
+	 * Check recent aircraft by id
770
+	 *
771
+	 * @return String the ident
772
+	 *
773
+	 */
774 774
 	public function checkIdRecent($id)
775 775
 	{
776 776
 		global $globalDBdriver, $globalTimezone;
@@ -796,14 +796,14 @@  discard block
 block discarded – undo
796 796
 			$ident_result = $row['fammarine_id'];
797 797
 		}
798 798
 		return $ident_result;
799
-        }
799
+		}
800 800
 
801 801
 	/**
802
-	* Check recent aircraft by mmsi
803
-	*
804
-	* @return String the ident
805
-	*
806
-	*/
802
+	 * Check recent aircraft by mmsi
803
+	 *
804
+	 * @return String the ident
805
+	 *
806
+	 */
807 807
 	public function checkMMSIRecent($mmsi)
808 808
 	{
809 809
 		global $globalDBdriver, $globalTimezone;
@@ -829,19 +829,19 @@  discard block
 block discarded – undo
829 829
 			$ident_result = $row['fammarine_id'];
830 830
 		}
831 831
 		return $ident_result;
832
-        }
832
+		}
833 833
 
834 834
 	/**
835
-	* Adds a new spotter data
836
-	*
837
-	* @param String $fammarine_id the ID from flightaware
838
-	* @param String $ident the flight ident
839
-	* @param String $aircraft_icao the aircraft type
840
-	* @param String $departure_airport_icao the departure airport
841
-	* @param String $arrival_airport_icao the arrival airport
842
-	* @return String success or false
843
-	*
844
-	*/
835
+	 * Adds a new spotter data
836
+	 *
837
+	 * @param String $fammarine_id the ID from flightaware
838
+	 * @param String $ident the flight ident
839
+	 * @param String $aircraft_icao the aircraft type
840
+	 * @param String $departure_airport_icao the departure airport
841
+	 * @param String $arrival_airport_icao the arrival airport
842
+	 * @return String success or false
843
+	 *
844
+	 */
845 845
 	public function addLiveMarineData($fammarine_id = '', $ident = '', $latitude = '', $longitude = '', $heading = '', $groundspeed = '', $date = '', $putinarchive = false, $mmsi = '',$type = '',$typeid = '',$imo = '', $callsign = '',$arrival_code = '',$arrival_date = '',$status = '',$statusid = '',$noarchive = false,$format_source = '', $source_name = '', $over_country = '')
846 846
 	{
847 847
 		global $globalURL, $globalArchive, $globalDebug;
@@ -912,10 +912,10 @@  discard block
 block discarded – undo
912 912
 		$arrival_date = filter_var($arrival_date,FILTER_SANITIZE_STRING);
913 913
 		
914 914
 
915
-            	if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) $groundspeed = 0;
916
-            	if ($heading == '' || $Common->isInteger($heading) === false ) $heading = 0;
917
-            	if ($arrival_date == '') $arrival_date = NULL;
918
-            	$query = '';
915
+				if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) $groundspeed = 0;
916
+				if ($heading == '' || $Common->isInteger($heading) === false ) $heading = 0;
917
+				if ($arrival_date == '') $arrival_date = NULL;
918
+				$query = '';
919 919
 		if ($globalArchive) {
920 920
 			if ($globalDebug) echo '-- Delete previous data -- ';
921 921
 			$query .= 'DELETE FROM marine_live WHERE fammarine_id = :fammarine_id;';
Please login to merge, or discard this patch.
install/class.update_db.php 1 patch
Indentation   +372 added lines, -372 removed lines patch added patch discarded remove patch
@@ -85,38 +85,38 @@  discard block
 block discarded – undo
85 85
 		try {
86 86
 			//$Connection = new Connection();
87 87
 			$sth = $Connection->db->prepare($query);
88
-                        $sth->execute(array(':source' => $database_file));
89
-                } catch(PDOException $e) {
90
-                        return "error : ".$e->getMessage();
91
-                }
88
+						$sth->execute(array(':source' => $database_file));
89
+				} catch(PDOException $e) {
90
+						return "error : ".$e->getMessage();
91
+				}
92 92
 
93
-    		if ($globalDebug) echo " - Add routes to DB -";
94
-    		update_db::connect_sqlite($database_file);
93
+			if ($globalDebug) echo " - Add routes to DB -";
94
+			update_db::connect_sqlite($database_file);
95 95
 		//$query = 'select Route.RouteID, Route.callsign, operator.Icao AS operator_icao, FromAir.Icao AS FromAirportIcao, ToAir.Icao AS ToAirportIcao from Route inner join operator ON Route.operatorId = operator.operatorId LEFT JOIN Airport AS FromAir ON route.FromAirportId = FromAir.AirportId LEFT JOIN Airport AS ToAir ON ToAir.AirportID = route.ToAirportID';
96 96
 		$query = "select Route.RouteID, Route.callsign, operator.Icao AS operator_icao, FromAir.Icao AS FromAirportIcao, ToAir.Icao AS ToAirportIcao, rstp.allstop AS AllStop from Route inner join operator ON Route.operatorId = operator.operatorId LEFT JOIN Airport AS FromAir ON route.FromAirportId = FromAir.AirportId LEFT JOIN Airport AS ToAir ON ToAir.AirportID = route.ToAirportID LEFT JOIN (select RouteId,GROUP_CONCAT(icao,' ') as allstop from routestop left join Airport as air ON routestop.AirportId = air.AirportID group by RouteID) AS rstp ON Route.RouteID = rstp.RouteID";
97 97
 		try {
98
-                        $sth = update_db::$db_sqlite->prepare($query);
99
-                        $sth->execute();
100
-                } catch(PDOException $e) {
101
-                        return "error : ".$e->getMessage();
102
-                }
98
+						$sth = update_db::$db_sqlite->prepare($query);
99
+						$sth->execute();
100
+				} catch(PDOException $e) {
101
+						return "error : ".$e->getMessage();
102
+				}
103 103
 		//$query_dest = 'INSERT INTO routes (`RouteID`,`CallSign`,`Operator_ICAO`,`FromAirport_ICAO`,`ToAirport_ICAO`,`RouteStop`,`Source`) VALUES (:RouteID, :CallSign, :Operator_ICAO, :FromAirport_ICAO, :ToAirport_ICAO, :routestop, :source)';
104 104
 		$query_dest = 'INSERT INTO routes (CallSign,Operator_ICAO,FromAirport_ICAO,ToAirport_ICAO,RouteStop,Source) VALUES (:CallSign, :Operator_ICAO, :FromAirport_ICAO, :ToAirport_ICAO, :routestop, :source)';
105 105
 		$Connection = new Connection();
106 106
 		$sth_dest = $Connection->db->prepare($query_dest);
107 107
 		try {
108 108
 			if ($globalTransaction) $Connection->db->beginTransaction();
109
-            		while ($values = $sth->fetch(PDO::FETCH_ASSOC)) {
109
+					while ($values = $sth->fetch(PDO::FETCH_ASSOC)) {
110 110
 				//$query_dest_values = array(':RouteID' => $values['RouteId'],':CallSign' => $values['Callsign'],':Operator_ICAO' => $values['operator_icao'],':FromAirport_ICAO' => $values['FromAirportIcao'],':ToAirport_ICAO' => $values['ToAirportIcao'],':routestop' => $values['AllStop'],':source' => $database_file);
111 111
 				$query_dest_values = array(':CallSign' => $values['Callsign'],':Operator_ICAO' => $values['operator_icao'],':FromAirport_ICAO' => $values['FromAirportIcao'],':ToAirport_ICAO' => $values['ToAirportIcao'],':routestop' => $values['AllStop'],':source' => $database_file);
112 112
 				$sth_dest->execute($query_dest_values);
113
-            		}
113
+					}
114 114
 			if ($globalTransaction) $Connection->db->commit();
115 115
 		} catch(PDOException $e) {
116 116
 			if ($globalTransaction) $Connection->db->rollBack(); 
117 117
 			return "error : ".$e->getMessage();
118 118
 		}
119
-                return '';
119
+				return '';
120 120
 	}
121 121
 	public static function retrieve_route_oneworld($database_file) {
122 122
 		global $globalDebug, $globalTransaction;
@@ -127,12 +127,12 @@  discard block
 block discarded – undo
127 127
 		try {
128 128
 			//$Connection = new Connection();
129 129
 			$sth = $Connection->db->prepare($query);
130
-                        $sth->execute(array(':source' => 'oneworld'));
131
-                } catch(PDOException $e) {
132
-                        return "error : ".$e->getMessage();
133
-                }
130
+						$sth->execute(array(':source' => 'oneworld'));
131
+				} catch(PDOException $e) {
132
+						return "error : ".$e->getMessage();
133
+				}
134 134
 
135
-    		if ($globalDebug) echo " - Add routes to DB -";
135
+			if ($globalDebug) echo " - Add routes to DB -";
136 136
 		require_once(dirname(__FILE__).'/../require/class.Spotter.php');
137 137
 		$Spotter = new Spotter();
138 138
 		if ($fh = fopen($database_file,"r")) {
@@ -156,7 +156,7 @@  discard block
 block discarded – undo
156 156
 			}
157 157
 			if ($globalTransaction) $Connection->db->commit();
158 158
 		}
159
-                return '';
159
+				return '';
160 160
 	}
161 161
 	
162 162
 	public static function retrieve_route_skyteam($database_file) {
@@ -168,12 +168,12 @@  discard block
 block discarded – undo
168 168
 		try {
169 169
 			//$Connection = new Connection();
170 170
 			$sth = $Connection->db->prepare($query);
171
-                        $sth->execute(array(':source' => 'skyteam'));
172
-                } catch(PDOException $e) {
173
-                        return "error : ".$e->getMessage();
174
-                }
171
+						$sth->execute(array(':source' => 'skyteam'));
172
+				} catch(PDOException $e) {
173
+						return "error : ".$e->getMessage();
174
+				}
175 175
 
176
-    		if ($globalDebug) echo " - Add routes to DB -";
176
+			if ($globalDebug) echo " - Add routes to DB -";
177 177
 
178 178
 		require_once(dirname(__FILE__).'/../require/class.Spotter.php');
179 179
 		$Spotter = new Spotter();
@@ -199,7 +199,7 @@  discard block
 block discarded – undo
199 199
 				return "error : ".$e->getMessage();
200 200
 			}
201 201
 		}
202
-                return '';
202
+				return '';
203 203
 	}
204 204
 	public static function retrieve_modes_sqlite_to_dest($database_file) {
205 205
 		global $globalTransaction;
@@ -208,27 +208,27 @@  discard block
 block discarded – undo
208 208
 		try {
209 209
 			$Connection = new Connection();
210 210
 			$sth = $Connection->db->prepare($query);
211
-                        $sth->execute(array(':source' => $database_file));
212
-                } catch(PDOException $e) {
213
-                        return "error : ".$e->getMessage();
214
-                }
211
+						$sth->execute(array(':source' => $database_file));
212
+				} catch(PDOException $e) {
213
+						return "error : ".$e->getMessage();
214
+				}
215 215
 		$query = "DELETE FROM aircraft_owner WHERE Source = '' OR Source IS NULL OR Source = :source";
216 216
 		try {
217 217
 			$Connection = new Connection();
218 218
 			$sth = $Connection->db->prepare($query);
219
-                        $sth->execute(array(':source' => $database_file));
220
-                } catch(PDOException $e) {
221
-                        return "error : ".$e->getMessage();
222
-                }
219
+						$sth->execute(array(':source' => $database_file));
220
+				} catch(PDOException $e) {
221
+						return "error : ".$e->getMessage();
222
+				}
223 223
 
224
-    		update_db::connect_sqlite($database_file);
224
+			update_db::connect_sqlite($database_file);
225 225
 		$query = 'select * from Aircraft';
226 226
 		try {
227
-                        $sth = update_db::$db_sqlite->prepare($query);
228
-                        $sth->execute();
229
-                } catch(PDOException $e) {
230
-                        return "error : ".$e->getMessage();
231
-                }
227
+						$sth = update_db::$db_sqlite->prepare($query);
228
+						$sth->execute();
229
+				} catch(PDOException $e) {
230
+						return "error : ".$e->getMessage();
231
+				}
232 232
 		//$query_dest = 'INSERT INTO aircraft_modes (`AircraftID`,`FirstCreated`,`LastModified`, `ModeS`,`ModeSCountry`,`Registration`,`ICAOTypeCode`,`SerialNo`, `OperatorFlagCode`, `Manufacturer`, `Type`, `FirstRegDate`, `CurrentRegDate`, `Country`, `PreviousID`, `DeRegDate`, `Status`, `PopularName`,`GenericName`,`AircraftClass`, `Engines`, `OwnershipStatus`,`RegisteredOwners`,`MTOW`, `TotalHours`, `YearBuilt`, `CofACategory`, `CofAExpiry`, `UserNotes`, `Interested`, `UserTag`, `InfoUrl`, `PictureUrl1`, `PictureUrl2`, `PictureUrl3`, `UserBool1`, `UserBool2`, `UserBool3`, `UserBool4`, `UserBool5`, `UserString1`, `UserString2`, `UserString3`, `UserString4`, `UserString5`, `UserInt1`, `UserInt2`, `UserInt3`, `UserInt4`, `UserInt5`) VALUES (:AircraftID,:FirstCreated,:LastModified,:ModeS,:ModeSCountry,:Registration,:ICAOTypeCode,:SerialNo, :OperatorFlagCode, :Manufacturer, :Type, :FirstRegDate, :CurrentRegDate, :Country, :PreviousID, :DeRegDate, :Status, :PopularName,:GenericName,:AircraftClass, :Engines, :OwnershipStatus,:RegisteredOwners,:MTOW, :TotalHours,:YearBuilt, :CofACategory, :CofAExpiry, :UserNotes, :Interested, :UserTag, :InfoUrl, :PictureUrl1, :PictureUrl2, :PictureUrl3, :UserBool1, :UserBool2, :UserBool3, :UserBool4, :UserBool5, :UserString1, :UserString2, :UserString3, :UserString4, :UserString5, :UserInt1, :UserInt2, :UserInt3, :UserInt4, :UserInt5)';
233 233
 		$query_dest = 'INSERT INTO aircraft_modes (LastModified, ModeS,ModeSCountry,Registration,ICAOTypeCode,type_flight,Source) VALUES (:LastModified,:ModeS,:ModeSCountry,:Registration,:ICAOTypeCode,:type,:source)';
234 234
 		
@@ -239,17 +239,17 @@  discard block
 block discarded – undo
239 239
 		$sth_dest_owner = $Connection->db->prepare($query_dest_owner);
240 240
 		try {
241 241
 			if ($globalTransaction) $Connection->db->beginTransaction();
242
-            		while ($values = $sth->fetch(PDO::FETCH_ASSOC)) {
242
+					while ($values = $sth->fetch(PDO::FETCH_ASSOC)) {
243 243
 			//$query_dest_values = array(':AircraftID' => $values['AircraftID'],':FirstCreated' => $values['FirstCreated'],':LastModified' => $values['LastModified'],':ModeS' => $values['ModeS'],':ModeSCountry' => $values['ModeSCountry'],':Registration' => $values['Registration'],':ICAOTypeCode' => $values['ICAOTypeCode'],':SerialNo' => $values['SerialNo'], ':OperatorFlagCode' => $values['OperatorFlagCode'], ':Manufacturer' => $values['Manufacturer'], ':Type' => $values['Type'], ':FirstRegDate' => $values['FirstRegDate'], ':CurrentRegDate' => $values['CurrentRegDate'], ':Country' => $values['Country'], ':PreviousID' => $values['PreviousID'], ':DeRegDate' => $values['DeRegDate'], ':Status' => $values['Status'], ':PopularName' => $values['PopularName'],':GenericName' => $values['GenericName'],':AircraftClass' => $values['AircraftClass'], ':Engines' => $values['Engines'], ':OwnershipStatus' => $values['OwnershipStatus'],':RegisteredOwners' => $values['RegisteredOwners'],':MTOW' => $values['MTOW'], ':TotalHours' => $values['TotalHours'],':YearBuilt' => $values['YearBuilt'], ':CofACategory' => $values['CofACategory'], ':CofAExpiry' => $values['CofAExpiry'], ':UserNotes' => $values['UserNotes'], ':Interested' => $values['Interested'], ':UserTag' => $values['UserTag'], ':InfoUrl' => $values['InfoURL'], ':PictureUrl1' => $values['PictureURL1'], ':PictureUrl2' => $values['PictureURL2'], ':PictureUrl3' => $values['PictureURL3'], ':UserBool1' => $values['UserBool1'], ':UserBool2' => $values['UserBool2'], ':UserBool3' => $values['UserBool3'], ':UserBool4' => $values['UserBool4'], ':UserBool5' => $values['UserBool5'], ':UserString1' => $values['UserString1'], ':UserString2' => $values['UserString2'], ':UserString3' => $values['UserString3'], ':UserString4' => $values['UserString4'], ':UserString5' => $values['UserString5'], ':UserInt1' => $values['UserInt1'], ':UserInt2' => $values['UserInt2'], ':UserInt3' => $values['UserInt3'], ':UserInt4' => $values['UserInt4'], ':UserInt5' => $values['UserInt5']);
244 244
 				if ($values['UserString4'] == 'M') $type = 'military';
245 245
 				else $type = null;
246 246
 				$query_dest_values = array(':LastModified' => $values['LastModified'],':ModeS' => $values['ModeS'],':ModeSCountry' => $values['ModeSCountry'],':Registration' => $values['Registration'],':ICAOTypeCode' => $values['ICAOTypeCode'],':source' => $database_file,':type' => $type);
247 247
 				$sth_dest->execute($query_dest_values);
248 248
 				if ($values['RegisteredOwners'] != '' && $values['RegisteredOwners'] != NULL && $values['RegisteredOwners'] != 'Private') {
249
-				    $query_dest_owner_values = array(':registration' => $values['Registration'],':source' => $database_file,':owner' => $values['RegisteredOwners']);
250
-				    $sth_dest_owner->execute($query_dest_owner_values);
249
+					$query_dest_owner_values = array(':registration' => $values['Registration'],':source' => $database_file,':owner' => $values['RegisteredOwners']);
250
+					$sth_dest_owner->execute($query_dest_owner_values);
251 251
 				}
252
-            		}
252
+					}
253 253
 			if ($globalTransaction) $Connection->db->commit();
254 254
 		} catch(PDOException $e) {
255 255
 			return "error : ".$e->getMessage();
@@ -260,10 +260,10 @@  discard block
 block discarded – undo
260 260
 		try {
261 261
 			$Connection = new Connection();
262 262
 			$sth = $Connection->db->prepare($query);
263
-                        $sth->execute(array(':source' => $database_file));
264
-                } catch(PDOException $e) {
265
-                        return "error : ".$e->getMessage();
266
-                }
263
+						$sth->execute(array(':source' => $database_file));
264
+				} catch(PDOException $e) {
265
+						return "error : ".$e->getMessage();
266
+				}
267 267
 		return '';
268 268
 	}
269 269
 
@@ -275,10 +275,10 @@  discard block
 block discarded – undo
275 275
 		try {
276 276
 			$Connection = new Connection();
277 277
 			$sth = $Connection->db->prepare($query);
278
-                        $sth->execute(array(':source' => $database_file));
279
-                } catch(PDOException $e) {
280
-                        return "error : ".$e->getMessage();
281
-                }
278
+						$sth->execute(array(':source' => $database_file));
279
+				} catch(PDOException $e) {
280
+						return "error : ".$e->getMessage();
281
+				}
282 282
 		
283 283
 		if ($fh = fopen($database_file,"r")) {
284 284
 			//$query_dest = 'INSERT INTO aircraft_modes (`AircraftID`,`FirstCreated`,`LastModified`, `ModeS`,`ModeSCountry`,`Registration`,`ICAOTypeCode`,`SerialNo`, `OperatorFlagCode`, `Manufacturer`, `Type`, `FirstRegDate`, `CurrentRegDate`, `Country`, `PreviousID`, `DeRegDate`, `Status`, `PopularName`,`GenericName`,`AircraftClass`, `Engines`, `OwnershipStatus`,`RegisteredOwners`,`MTOW`, `TotalHours`, `YearBuilt`, `CofACategory`, `CofAExpiry`, `UserNotes`, `Interested`, `UserTag`, `InfoUrl`, `PictureUrl1`, `PictureUrl2`, `PictureUrl3`, `UserBool1`, `UserBool2`, `UserBool3`, `UserBool4`, `UserBool5`, `UserString1`, `UserString2`, `UserString3`, `UserString4`, `UserString5`, `UserInt1`, `UserInt2`, `UserInt3`, `UserInt4`, `UserInt5`) VALUES (:AircraftID,:FirstCreated,:LastModified,:ModeS,:ModeSCountry,:Registration,:ICAOTypeCode,:SerialNo, :OperatorFlagCode, :Manufacturer, :Type, :FirstRegDate, :CurrentRegDate, :Country, :PreviousID, :DeRegDate, :Status, :PopularName,:GenericName,:AircraftClass, :Engines, :OwnershipStatus,:RegisteredOwners,:MTOW, :TotalHours,:YearBuilt, :CofACategory, :CofAExpiry, :UserNotes, :Interested, :UserTag, :InfoUrl, :PictureUrl1, :PictureUrl2, :PictureUrl3, :UserBool1, :UserBool2, :UserBool3, :UserBool4, :UserBool5, :UserString1, :UserString2, :UserString3, :UserString4, :UserString5, :UserInt1, :UserInt2, :UserInt3, :UserInt4, :UserInt5)';
@@ -288,26 +288,26 @@  discard block
 block discarded – undo
288 288
 			$sth_dest = $Connection->db->prepare($query_dest);
289 289
 			try {
290 290
 				if ($globalTransaction) $Connection->db->beginTransaction();
291
-            			while (!feof($fh)) {
292
-            				$values = array();
293
-            				$line = $Common->hex2str(fgets($fh,9999));
291
+						while (!feof($fh)) {
292
+							$values = array();
293
+							$line = $Common->hex2str(fgets($fh,9999));
294 294
 					//FFFFFF                     RIDEAU VALLEY SOARINGASW-20               C-FBKN MZ 123.400
295
-            				$values['ModeS'] = substr($line,0,6);
296
-            				$values['Registration'] = trim(substr($line,69,6));
297
-            				$aircraft_name = trim(substr($line,48,6));
298
-            				// Check if we can find ICAO, else set it to GLID
299
-            				$aircraft_name_split = explode(' ',$aircraft_name);
300
-            				$search_more = '';
301
-            				if (count($aircraft_name) > 1 && strlen($aircraft_name_split[1]) > 3) $search_more .= " AND LIKE '%".$aircraft_name_split[0]."%'";
302
-            				$query_search = "SELECT * FROM aircraft WHERE type LIKE '%".$aircraft_name."%'".$search_more;
303
-            				$sth_search = $Connection->db->prepare($query_search);
295
+							$values['ModeS'] = substr($line,0,6);
296
+							$values['Registration'] = trim(substr($line,69,6));
297
+							$aircraft_name = trim(substr($line,48,6));
298
+							// Check if we can find ICAO, else set it to GLID
299
+							$aircraft_name_split = explode(' ',$aircraft_name);
300
+							$search_more = '';
301
+							if (count($aircraft_name) > 1 && strlen($aircraft_name_split[1]) > 3) $search_more .= " AND LIKE '%".$aircraft_name_split[0]."%'";
302
+							$query_search = "SELECT * FROM aircraft WHERE type LIKE '%".$aircraft_name."%'".$search_more;
303
+							$sth_search = $Connection->db->prepare($query_search);
304 304
 					try {
305
-                                    		$sth_search->execute();
306
-	            				$result = $sth_search->fetch(PDO::FETCH_ASSOC);
307
-	            				//if (count($result) > 0) {
308
-	            				if (isset($result['icao']) && $result['icao'] != '') {
309
-	            				    $values['ICAOTypeCode'] = $result['icao'];
310
-	            				} 
305
+											$sth_search->execute();
306
+								$result = $sth_search->fetch(PDO::FETCH_ASSOC);
307
+								//if (count($result) > 0) {
308
+								if (isset($result['icao']) && $result['icao'] != '') {
309
+									$values['ICAOTypeCode'] = $result['icao'];
310
+								} 
311 311
 					} catch(PDOException $e) {
312 312
 						return "error : ".$e->getMessage();
313 313
 					}
@@ -330,10 +330,10 @@  discard block
 block discarded – undo
330 330
 		try {
331 331
 			$Connection = new Connection();
332 332
 			$sth = $Connection->db->prepare($query);
333
-                        $sth->execute(array(':source' => $database_file));
334
-                } catch(PDOException $e) {
335
-                        return "error : ".$e->getMessage();
336
-                }
333
+						$sth->execute(array(':source' => $database_file));
334
+				} catch(PDOException $e) {
335
+						return "error : ".$e->getMessage();
336
+				}
337 337
 		return '';
338 338
 	}
339 339
 
@@ -344,10 +344,10 @@  discard block
 block discarded – undo
344 344
 		try {
345 345
 			$Connection = new Connection();
346 346
 			$sth = $Connection->db->prepare($query);
347
-                        $sth->execute(array(':source' => $database_file));
348
-                } catch(PDOException $e) {
349
-                        return "error : ".$e->getMessage();
350
-                }
347
+						$sth->execute(array(':source' => $database_file));
348
+				} catch(PDOException $e) {
349
+						return "error : ".$e->getMessage();
350
+				}
351 351
 		
352 352
 		if ($fh = fopen($database_file,"r")) {
353 353
 			//$query_dest = 'INSERT INTO aircraft_modes (`AircraftID`,`FirstCreated`,`LastModified`, `ModeS`,`ModeSCountry`,`Registration`,`ICAOTypeCode`,`SerialNo`, `OperatorFlagCode`, `Manufacturer`, `Type`, `FirstRegDate`, `CurrentRegDate`, `Country`, `PreviousID`, `DeRegDate`, `Status`, `PopularName`,`GenericName`,`AircraftClass`, `Engines`, `OwnershipStatus`,`RegisteredOwners`,`MTOW`, `TotalHours`, `YearBuilt`, `CofACategory`, `CofAExpiry`, `UserNotes`, `Interested`, `UserTag`, `InfoUrl`, `PictureUrl1`, `PictureUrl2`, `PictureUrl3`, `UserBool1`, `UserBool2`, `UserBool3`, `UserBool4`, `UserBool5`, `UserString1`, `UserString2`, `UserString3`, `UserString4`, `UserString5`, `UserInt1`, `UserInt2`, `UserInt3`, `UserInt4`, `UserInt5`) VALUES (:AircraftID,:FirstCreated,:LastModified,:ModeS,:ModeSCountry,:Registration,:ICAOTypeCode,:SerialNo, :OperatorFlagCode, :Manufacturer, :Type, :FirstRegDate, :CurrentRegDate, :Country, :PreviousID, :DeRegDate, :Status, :PopularName,:GenericName,:AircraftClass, :Engines, :OwnershipStatus,:RegisteredOwners,:MTOW, :TotalHours,:YearBuilt, :CofACategory, :CofAExpiry, :UserNotes, :Interested, :UserTag, :InfoUrl, :PictureUrl1, :PictureUrl2, :PictureUrl3, :UserBool1, :UserBool2, :UserBool3, :UserBool4, :UserBool5, :UserString1, :UserString2, :UserString3, :UserString4, :UserString5, :UserInt1, :UserInt2, :UserInt3, :UserInt4, :UserInt5)';
@@ -358,25 +358,25 @@  discard block
 block discarded – undo
358 358
 			try {
359 359
 				if ($globalTransaction) $Connection->db->beginTransaction();
360 360
 				$tmp = fgetcsv($fh,9999,',',"'");
361
-            			while (!feof($fh)) {
362
-            				$line = fgetcsv($fh,9999,',',"'");
361
+						while (!feof($fh)) {
362
+							$line = fgetcsv($fh,9999,',',"'");
363 363
             				
364 364
 					//FFFFFF                     RIDEAU VALLEY SOARINGASW-20               C-FBKN MZ 123.400
365 365
 					//print_r($line);
366
-            				$values['ModeS'] = $line[1];
367
-            				$values['Registration'] = $line[3];
368
-            				$values['ICAOTypeCode'] = '';
369
-            				$aircraft_name = $line[2];
370
-            				// Check if we can find ICAO, else set it to GLID
371
-            				$aircraft_name_split = explode(' ',$aircraft_name);
372
-            				$search_more = '';
373
-            				if (count($aircraft_name) > 1 && strlen($aircraft_name_split[1]) > 3) $search_more .= " AND LIKE '%".$aircraft_name_split[0]."%'";
374
-            				$query_search = "SELECT * FROM aircraft WHERE type LIKE '%".$aircraft_name."%'".$search_more;
375
-            				$sth_search = $Connection->db->prepare($query_search);
366
+							$values['ModeS'] = $line[1];
367
+							$values['Registration'] = $line[3];
368
+							$values['ICAOTypeCode'] = '';
369
+							$aircraft_name = $line[2];
370
+							// Check if we can find ICAO, else set it to GLID
371
+							$aircraft_name_split = explode(' ',$aircraft_name);
372
+							$search_more = '';
373
+							if (count($aircraft_name) > 1 && strlen($aircraft_name_split[1]) > 3) $search_more .= " AND LIKE '%".$aircraft_name_split[0]."%'";
374
+							$query_search = "SELECT * FROM aircraft WHERE type LIKE '%".$aircraft_name."%'".$search_more;
375
+							$sth_search = $Connection->db->prepare($query_search);
376 376
 					try {
377
-                                    		$sth_search->execute();
378
-	            				$result = $sth_search->fetch(PDO::FETCH_ASSOC);
379
-	            				if (isset($result['icao']) && $result['icao'] != '') $values['ICAOTypeCode'] = $result['icao'];
377
+											$sth_search->execute();
378
+								$result = $sth_search->fetch(PDO::FETCH_ASSOC);
379
+								if (isset($result['icao']) && $result['icao'] != '') $values['ICAOTypeCode'] = $result['icao'];
380 380
 					} catch(PDOException $e) {
381 381
 						return "error : ".$e->getMessage();
382 382
 					}
@@ -399,10 +399,10 @@  discard block
 block discarded – undo
399 399
 		try {
400 400
 			$Connection = new Connection();
401 401
 			$sth = $Connection->db->prepare($query);
402
-                        $sth->execute(array(':source' => $database_file));
403
-                } catch(PDOException $e) {
404
-                        return "error : ".$e->getMessage();
405
-                }
402
+						$sth->execute(array(':source' => $database_file));
403
+				} catch(PDOException $e) {
404
+						return "error : ".$e->getMessage();
405
+				}
406 406
 		return '';
407 407
 	}
408 408
 
@@ -413,16 +413,16 @@  discard block
 block discarded – undo
413 413
 		try {
414 414
 			$Connection = new Connection();
415 415
 			$sth = $Connection->db->prepare($query);
416
-                        $sth->execute(array(':source' => $database_file));
417
-                } catch(PDOException $e) {
418
-                        return "error : ".$e->getMessage();
419
-                }
416
+						$sth->execute(array(':source' => $database_file));
417
+				} catch(PDOException $e) {
418
+						return "error : ".$e->getMessage();
419
+				}
420 420
 		require_once(dirname(__FILE__).'/../require/class.Spotter.php');
421 421
 		$Spotter = new Spotter();
422 422
 		if ($fh = fopen($database_file,"r")) {
423 423
 			//$query_dest = 'INSERT INTO aircraft_modes (`AircraftID`,`FirstCreated`,`LastModified`, `ModeS`,`ModeSCountry`,`Registration`,`ICAOTypeCode`,`SerialNo`, `OperatorFlagCode`, `Manufacturer`, `Type`, `FirstRegDate`, `CurrentRegDate`, `Country`, `PreviousID`, `DeRegDate`, `Status`, `PopularName`,`GenericName`,`AircraftClass`, `Engines`, `OwnershipStatus`,`RegisteredOwners`,`MTOW`, `TotalHours`, `YearBuilt`, `CofACategory`, `CofAExpiry`, `UserNotes`, `Interested`, `UserTag`, `InfoUrl`, `PictureUrl1`, `PictureUrl2`, `PictureUrl3`, `UserBool1`, `UserBool2`, `UserBool3`, `UserBool4`, `UserBool5`, `UserString1`, `UserString2`, `UserString3`, `UserString4`, `UserString5`, `UserInt1`, `UserInt2`, `UserInt3`, `UserInt4`, `UserInt5`) VALUES (:AircraftID,:FirstCreated,:LastModified,:ModeS,:ModeSCountry,:Registration,:ICAOTypeCode,:SerialNo, :OperatorFlagCode, :Manufacturer, :Type, :FirstRegDate, :CurrentRegDate, :Country, :PreviousID, :DeRegDate, :Status, :PopularName,:GenericName,:AircraftClass, :Engines, :OwnershipStatus,:RegisteredOwners,:MTOW, :TotalHours,:YearBuilt, :CofACategory, :CofAExpiry, :UserNotes, :Interested, :UserTag, :InfoUrl, :PictureUrl1, :PictureUrl2, :PictureUrl3, :UserBool1, :UserBool2, :UserBool3, :UserBool4, :UserBool5, :UserString1, :UserString2, :UserString3, :UserString4, :UserString5, :UserInt1, :UserInt2, :UserInt3, :UserInt4, :UserInt5)';
424 424
 			$query_dest = 'INSERT INTO aircraft_owner (registration,base,owner,date_first_reg,Source) VALUES (:registration,:base,:owner,:date_first_reg,:source)';
425
-		        $query_modes = 'INSERT INTO aircraft_modes (ModeS,ModeSCountry,Registration,ICAOTypeCode,Source) VALUES (:modes,:modescountry,:registration,:icaotypecode,:source)';
425
+				$query_modes = 'INSERT INTO aircraft_modes (ModeS,ModeSCountry,Registration,ICAOTypeCode,Source) VALUES (:modes,:modescountry,:registration,:icaotypecode,:source)';
426 426
 		        
427 427
 			$Connection = new Connection();
428 428
 			$sth_dest = $Connection->db->prepare($query_dest);
@@ -430,126 +430,126 @@  discard block
 block discarded – undo
430 430
 			try {
431 431
 				if ($globalTransaction) $Connection->db->beginTransaction();
432 432
 				$tmp = fgetcsv($fh,9999,',','"');
433
-            			while (!feof($fh)) {
434
-            				$line = fgetcsv($fh,9999,',','"');
435
-            				$values = array();
436
-            				//print_r($line);
437
-            				if ($country == 'F') {
438
-            				    $values['registration'] = $line[0];
439
-            				    $values['base'] = $line[4];
440
-            				    $values['owner'] = $line[5];
441
-            				    if ($line[6] == '') $values['date_first_reg'] = null;
442
-					    else $values['date_first_reg'] = date("Y-m-d",strtotime($line[6]));
443
-					    $values['cancel'] = $line[7];
433
+						while (!feof($fh)) {
434
+							$line = fgetcsv($fh,9999,',','"');
435
+							$values = array();
436
+							//print_r($line);
437
+							if ($country == 'F') {
438
+								$values['registration'] = $line[0];
439
+								$values['base'] = $line[4];
440
+								$values['owner'] = $line[5];
441
+								if ($line[6] == '') $values['date_first_reg'] = null;
442
+						else $values['date_first_reg'] = date("Y-m-d",strtotime($line[6]));
443
+						$values['cancel'] = $line[7];
444 444
 					} elseif ($country == 'EI') {
445
-					    // TODO : add modeS & reg to aircraft_modes
446
-            				    $values['registration'] = $line[0];
447
-            				    $values['base'] = $line[3];
448
-            				    $values['owner'] = $line[2];
449
-            				    if ($line[1] == '') $values['date_first_reg'] = null;
450
-					    else $values['date_first_reg'] = date("Y-m-d",strtotime($line[1]));
451
-					    $values['cancel'] = '';
452
-					    $values['modes'] = $line[7];
453
-					    $values['icao'] = $line[8];
445
+						// TODO : add modeS & reg to aircraft_modes
446
+								$values['registration'] = $line[0];
447
+								$values['base'] = $line[3];
448
+								$values['owner'] = $line[2];
449
+								if ($line[1] == '') $values['date_first_reg'] = null;
450
+						else $values['date_first_reg'] = date("Y-m-d",strtotime($line[1]));
451
+						$values['cancel'] = '';
452
+						$values['modes'] = $line[7];
453
+						$values['icao'] = $line[8];
454 454
 					    
455 455
 					} elseif ($country == 'HB') {
456
-					    // TODO : add modeS & reg to aircraft_modes
457
-            				    $values['registration'] = $line[0];
458
-            				    $values['base'] = null;
459
-            				    $values['owner'] = $line[5];
460
-            				    $values['date_first_reg'] = null;
461
-					    $values['cancel'] = '';
462
-					    $values['modes'] = $line[4];
463
-					    $values['icao'] = $line[7];
456
+						// TODO : add modeS & reg to aircraft_modes
457
+								$values['registration'] = $line[0];
458
+								$values['base'] = null;
459
+								$values['owner'] = $line[5];
460
+								$values['date_first_reg'] = null;
461
+						$values['cancel'] = '';
462
+						$values['modes'] = $line[4];
463
+						$values['icao'] = $line[7];
464 464
 					} elseif ($country == 'OK') {
465
-					    // TODO : add modeS & reg to aircraft_modes
466
-            				    $values['registration'] = $line[3];
467
-            				    $values['base'] = null;
468
-            				    $values['owner'] = $line[5];
469
-            				    if ($line[18] == '') $values['date_first_reg'] = null;
470
-					    else $values['date_first_reg'] = date("Y-m-d",strtotime($line[18]));
471
-					    $values['cancel'] = '';
465
+						// TODO : add modeS & reg to aircraft_modes
466
+								$values['registration'] = $line[3];
467
+								$values['base'] = null;
468
+								$values['owner'] = $line[5];
469
+								if ($line[18] == '') $values['date_first_reg'] = null;
470
+						else $values['date_first_reg'] = date("Y-m-d",strtotime($line[18]));
471
+						$values['cancel'] = '';
472 472
 					} elseif ($country == 'VH') {
473
-					    // TODO : add modeS & reg to aircraft_modes
474
-            				    $values['registration'] = $line[0];
475
-            				    $values['base'] = null;
476
-            				    $values['owner'] = $line[12];
477
-            				    if ($line[28] == '') $values['date_first_reg'] = null;
478
-					    else $values['date_first_reg'] = date("Y-m-d",strtotime($line[28]));
479
-
480
-					    $values['cancel'] = $line[39];
473
+						// TODO : add modeS & reg to aircraft_modes
474
+								$values['registration'] = $line[0];
475
+								$values['base'] = null;
476
+								$values['owner'] = $line[12];
477
+								if ($line[28] == '') $values['date_first_reg'] = null;
478
+						else $values['date_first_reg'] = date("Y-m-d",strtotime($line[28]));
479
+
480
+						$values['cancel'] = $line[39];
481 481
 					} elseif ($country == 'OE' || $country == '9A' || $country == 'VP' || $country == 'LX' || $country == 'P2' || $country == 'HC') {
482
-            				    $values['registration'] = $line[0];
483
-            				    $values['base'] = null;
484
-            				    $values['owner'] = $line[4];
485
-            				    $values['date_first_reg'] = null;
486
-					    $values['cancel'] = '';
482
+								$values['registration'] = $line[0];
483
+								$values['base'] = null;
484
+								$values['owner'] = $line[4];
485
+								$values['date_first_reg'] = null;
486
+						$values['cancel'] = '';
487 487
 					} elseif ($country == 'CC') {
488
-            				    $values['registration'] = $line[0];
489
-            				    $values['base'] = null;
490
-            				    $values['owner'] = $line[6];
491
-            				    $values['date_first_reg'] = null;
492
-					    $values['cancel'] = '';
488
+								$values['registration'] = $line[0];
489
+								$values['base'] = null;
490
+								$values['owner'] = $line[6];
491
+								$values['date_first_reg'] = null;
492
+						$values['cancel'] = '';
493 493
 					} elseif ($country == 'HJ') {
494
-            				    $values['registration'] = $line[0];
495
-            				    $values['base'] = null;
496
-            				    $values['owner'] = $line[8];
497
-            				    if ($line[7] == '') $values['date_first_reg'] = null;
498
-					    else $values['date_first_reg'] = date("Y-m-d",strtotime($line[7]));
499
-					    $values['cancel'] = '';
494
+								$values['registration'] = $line[0];
495
+								$values['base'] = null;
496
+								$values['owner'] = $line[8];
497
+								if ($line[7] == '') $values['date_first_reg'] = null;
498
+						else $values['date_first_reg'] = date("Y-m-d",strtotime($line[7]));
499
+						$values['cancel'] = '';
500 500
 					} elseif ($country == 'PP') {
501
-            				    $values['registration'] = $line[0];
502
-            				    $values['base'] = null;
503
-            				    $values['owner'] = $line[4];
504
-            				    if ($line[6] == '') $values['date_first_reg'] = null;
505
-					    else $values['date_first_reg'] = date("Y-m-d",strtotime($line[6]));
506
-					    $values['cancel'] = $line[7];
501
+								$values['registration'] = $line[0];
502
+								$values['base'] = null;
503
+								$values['owner'] = $line[4];
504
+								if ($line[6] == '') $values['date_first_reg'] = null;
505
+						else $values['date_first_reg'] = date("Y-m-d",strtotime($line[6]));
506
+						$values['cancel'] = $line[7];
507 507
 					} elseif ($country == 'E7') {
508
-            				    $values['registration'] = $line[0];
509
-            				    $values['base'] = null;
510
-            				    $values['owner'] = $line[4];
511
-            				    if ($line[5] == '') $values['date_first_reg'] = null;
512
-					    else $values['date_first_reg'] = date("Y-m-d",strtotime($line[5]));
513
-					    $values['cancel'] = '';
508
+								$values['registration'] = $line[0];
509
+								$values['base'] = null;
510
+								$values['owner'] = $line[4];
511
+								if ($line[5] == '') $values['date_first_reg'] = null;
512
+						else $values['date_first_reg'] = date("Y-m-d",strtotime($line[5]));
513
+						$values['cancel'] = '';
514 514
 					} elseif ($country == '8Q') {
515
-            				    $values['registration'] = $line[0];
516
-            				    $values['base'] = null;
517
-            				    $values['owner'] = $line[3];
518
-            				    if ($line[7] == '') $values['date_first_reg'] = null;
519
-					    else $values['date_first_reg'] = date("Y-m-d",strtotime($line[7]));
520
-					    $values['cancel'] = '';
515
+								$values['registration'] = $line[0];
516
+								$values['base'] = null;
517
+								$values['owner'] = $line[3];
518
+								if ($line[7] == '') $values['date_first_reg'] = null;
519
+						else $values['date_first_reg'] = date("Y-m-d",strtotime($line[7]));
520
+						$values['cancel'] = '';
521 521
 					} elseif ($country == 'ZK') {
522
-            				    $values['registration'] = $line[0];
523
-            				    $values['base'] = null;
524
-            				    $values['owner'] = $line[3];
525
-            				    $values['date_first_reg'] = null;
526
-					    $values['cancel'] = '';
527
-					    $values['modes'] = $line[5];
528
-					    $values['icao'] = $line[9];
522
+								$values['registration'] = $line[0];
523
+								$values['base'] = null;
524
+								$values['owner'] = $line[3];
525
+								$values['date_first_reg'] = null;
526
+						$values['cancel'] = '';
527
+						$values['modes'] = $line[5];
528
+						$values['icao'] = $line[9];
529 529
 					} elseif ($country == 'M') {
530
-            				    $values['registration'] = $line[0];
531
-            				    $values['base'] = null;
532
-            				    $values['owner'] = $line[6];
533
-            				    $values['date_first_reg'] = date("Y-m-d",strtotime($line[5]));
534
-					    $values['cancel'] = date("Y-m-d",strtotime($line[8]));
535
-					    $values['modes'] = $line[4];
536
-					    $values['icao'] = $line[10];
530
+								$values['registration'] = $line[0];
531
+								$values['base'] = null;
532
+								$values['owner'] = $line[6];
533
+								$values['date_first_reg'] = date("Y-m-d",strtotime($line[5]));
534
+						$values['cancel'] = date("Y-m-d",strtotime($line[8]));
535
+						$values['modes'] = $line[4];
536
+						$values['icao'] = $line[10];
537 537
 					} elseif ($country == 'OY') {
538
-            				    $values['registration'] = $line[0];
539
-            				    $values['date_first_reg'] = date("Y-m-d",strtotime($line[4]));
540
-					    $values['modes'] = $line[5];
541
-					    $values['icao'] = $line[6];
538
+								$values['registration'] = $line[0];
539
+								$values['date_first_reg'] = date("Y-m-d",strtotime($line[4]));
540
+						$values['modes'] = $line[5];
541
+						$values['icao'] = $line[6];
542 542
 					} elseif ($country == 'PH') {
543
-            				    $values['registration'] = $line[0];
544
-            				    $values['date_first_reg'] = date("Y-m-d",strtotime($line[3]));
545
-					    $values['modes'] = $line[4];
546
-					    $values['icao'] = $line[5];
543
+								$values['registration'] = $line[0];
544
+								$values['date_first_reg'] = date("Y-m-d",strtotime($line[3]));
545
+						$values['modes'] = $line[4];
546
+						$values['icao'] = $line[5];
547 547
 					} elseif ($country == 'OM' || $country == 'TF') {
548
-            				    $values['registration'] = $line[0];
549
-            				    $values['base'] = null;
550
-            				    $values['owner'] = $line[3];
551
-            				    $values['date_first_reg'] = null;
552
-					    $values['cancel'] = '';
548
+								$values['registration'] = $line[0];
549
+								$values['base'] = null;
550
+								$values['owner'] = $line[3];
551
+								$values['date_first_reg'] = null;
552
+						$values['cancel'] = '';
553 553
 					}
554 554
 					if (isset($values['cancel']) && $values['cancel'] == '' && $values['registration'] != null && isset($values['owner'])) {
555 555
 						$query_dest_values = array(':registration' => $values['registration'],':base' => $values['base'],':date_first_reg' => $values['date_first_reg'],':owner' => $values['owner'],':source' => $database_file);
@@ -682,7 +682,7 @@  discard block
 block discarded – undo
682 682
                         return "error : ".$e->getMessage();
683 683
                 }
684 684
                 */
685
-                /*
685
+				/*
686 686
 		$query = 'ALTER TABLE airport DROP INDEX icaoidx';
687 687
 		try {
688 688
 			$Connection = new Connection();
@@ -927,10 +927,10 @@  discard block
 block discarded – undo
927 927
 		try {
928 928
 			$Connection = new Connection();
929 929
 			$sth = $Connection->db->prepare($query);
930
-                        $sth->execute(array(':source' => 'translation.csv'));
931
-                } catch(PDOException $e) {
932
-                        return "error : ".$e->getMessage();
933
-                }
930
+						$sth->execute(array(':source' => 'translation.csv'));
931
+				} catch(PDOException $e) {
932
+						return "error : ".$e->getMessage();
933
+				}
934 934
 
935 935
 		
936 936
 		//update_db::unzip($out_file);
@@ -949,21 +949,21 @@  discard block
 block discarded – undo
949 949
 					$data = $row;
950 950
 					$operator = $data[2];
951 951
 					if ($operator != '' && is_numeric(substr(substr($operator, 0, 3), -1, 1))) {
952
-                                                $airline_array = $Spotter->getAllAirlineInfo(substr($operator, 0, 2));
953
-                                                //echo substr($operator, 0, 2)."\n";;
954
-                                                if (count($airline_array) > 0) {
952
+												$airline_array = $Spotter->getAllAirlineInfo(substr($operator, 0, 2));
953
+												//echo substr($operator, 0, 2)."\n";;
954
+												if (count($airline_array) > 0) {
955 955
 							//print_r($airline_array);
956 956
 							$operator = $airline_array[0]['icao'].substr($operator,2);
957
-                                                }
958
-                                        }
957
+												}
958
+										}
959 959
 					
960 960
 					$operator_correct = $data[3];
961 961
 					if ($operator_correct != '' && is_numeric(substr(substr($operator_correct, 0, 3), -1, 1))) {
962
-                                                $airline_array = $Spotter->getAllAirlineInfo(substr($operator_correct, 0, 2));
963
-                                                if (count($airline_array) > 0) {
964
-                                            		$operator_correct = $airline_array[0]['icao'].substr($operator_correct,2);
965
-                                            	}
966
-                                        }
962
+												$airline_array = $Spotter->getAllAirlineInfo(substr($operator_correct, 0, 2));
963
+												if (count($airline_array) > 0) {
964
+													$operator_correct = $airline_array[0]['icao'].substr($operator_correct,2);
965
+												}
966
+										}
967 967
 					$query = 'INSERT INTO translation (Reg,Reg_correct,Operator,Operator_correct,Source) VALUES (:Reg, :Reg_correct, :Operator, :Operator_correct, :source)';
968 968
 					try {
969 969
 						$sth = $Connection->db->prepare($query);
@@ -977,7 +977,7 @@  discard block
 block discarded – undo
977 977
 			//$Connection->db->commit();
978 978
 		}
979 979
 		return '';
980
-        }
980
+		}
981 981
 	
982 982
 	public static function translation_fam() {
983 983
 		global $tmp_dir, $globalTransaction;
@@ -1015,7 +1015,7 @@  discard block
 block discarded – undo
1015 1015
 			//$Connection->db->commit();
1016 1016
 		}
1017 1017
 		return '';
1018
-        }
1018
+		}
1019 1019
 
1020 1020
 	/*
1021 1021
 	* This function use FAA public data.
@@ -1027,19 +1027,19 @@  discard block
 block discarded – undo
1027 1027
 		try {
1028 1028
 			$Connection = new Connection();
1029 1029
 			$sth = $Connection->db->prepare($query);
1030
-                        $sth->execute(array(':source' => 'website_faa'));
1031
-                } catch(PDOException $e) {
1032
-                        return "error : ".$e->getMessage();
1033
-                }
1030
+						$sth->execute(array(':source' => 'website_faa'));
1031
+				} catch(PDOException $e) {
1032
+						return "error : ".$e->getMessage();
1033
+				}
1034 1034
 
1035 1035
 		$query = "DELETE FROM aircraft_owner WHERE Source = '' OR Source = :source";
1036 1036
 		try {
1037 1037
 			$Connection = new Connection();
1038 1038
 			$sth = $Connection->db->prepare($query);
1039
-                        $sth->execute(array(':source' => 'website_faa'));
1040
-                } catch(PDOException $e) {
1041
-                        return "error : ".$e->getMessage();
1042
-                }
1039
+						$sth->execute(array(':source' => 'website_faa'));
1040
+				} catch(PDOException $e) {
1041
+						return "error : ".$e->getMessage();
1042
+				}
1043 1043
 
1044 1044
 		$delimiter = ",";
1045 1045
 		$mfr = array();
@@ -1207,7 +1207,7 @@  discard block
 block discarded – undo
1207 1207
 		}
1208 1208
 		*/
1209 1209
 		return '';
1210
-        }
1210
+		}
1211 1211
         
1212 1212
 	public static function owner_fam() {
1213 1213
 		global $tmp_dir, $globalTransaction;
@@ -1215,10 +1215,10 @@  discard block
 block discarded – undo
1215 1215
 		try {
1216 1216
 			$Connection = new Connection();
1217 1217
 			$sth = $Connection->db->prepare($query);
1218
-                        $sth->execute(array(':source' => 'website_fam'));
1219
-                } catch(PDOException $e) {
1220
-                        return "error : ".$e->getMessage();
1221
-                }
1218
+						$sth->execute(array(':source' => 'website_fam'));
1219
+				} catch(PDOException $e) {
1220
+						return "error : ".$e->getMessage();
1221
+				}
1222 1222
 
1223 1223
 		$delimiter = "\t";
1224 1224
 		$Connection = new Connection();
@@ -1244,7 +1244,7 @@  discard block
 block discarded – undo
1244 1244
 			if ($globalTransaction) $Connection->db->commit();
1245 1245
 		}
1246 1246
 		return '';
1247
-        }
1247
+		}
1248 1248
 
1249 1249
 	public static function routes_fam() {
1250 1250
 		global $tmp_dir, $globalTransaction, $globalDebug;
@@ -1279,7 +1279,7 @@  discard block
 block discarded – undo
1279 1279
 			if ($globalTransaction) $Connection->db->commit();
1280 1280
 		}
1281 1281
 		return '';
1282
-        }
1282
+		}
1283 1283
 
1284 1284
 	public static function marine_identity_fam() {
1285 1285
 		global $tmp_dir, $globalTransaction;
@@ -1287,10 +1287,10 @@  discard block
 block discarded – undo
1287 1287
 		try {
1288 1288
 			$Connection = new Connection();
1289 1289
 			$sth = $Connection->db->prepare($query);
1290
-                        $sth->execute();
1291
-                } catch(PDOException $e) {
1292
-                        return "error : ".$e->getMessage();
1293
-                }
1290
+						$sth->execute();
1291
+				} catch(PDOException $e) {
1292
+						return "error : ".$e->getMessage();
1293
+				}
1294 1294
 
1295 1295
 		
1296 1296
 		//update_db::unzip($out_file);
@@ -1320,7 +1320,7 @@  discard block
 block discarded – undo
1320 1320
 			if ($globalTransaction) $Connection->db->commit();
1321 1321
 		}
1322 1322
 		return '';
1323
-        }
1323
+		}
1324 1324
 
1325 1325
 	public static function satellite_fam() {
1326 1326
 		global $tmp_dir, $globalTransaction;
@@ -1391,7 +1391,7 @@  discard block
 block discarded – undo
1391 1391
 			if ($globalTransaction) $Connection->db->commit();
1392 1392
 		}
1393 1393
 		return '';
1394
-        }
1394
+		}
1395 1395
 
1396 1396
 	public static function tle($filename,$tletype) {
1397 1397
 		require_once(dirname(__FILE__).'/../require/class.Spotter.php');
@@ -1402,10 +1402,10 @@  discard block
 block discarded – undo
1402 1402
 		try {
1403 1403
 			$Connection = new Connection();
1404 1404
 			$sth = $Connection->db->prepare($query);
1405
-                        $sth->execute(array(':source' => $filename));
1406
-                } catch(PDOException $e) {
1407
-                        return "error : ".$e->getMessage();
1408
-                }
1405
+						$sth->execute(array(':source' => $filename));
1406
+				} catch(PDOException $e) {
1407
+						return "error : ".$e->getMessage();
1408
+				}
1409 1409
 		
1410 1410
 		$Connection = new Connection();
1411 1411
 		if (($handle = fopen($filename, 'r')) !== FALSE)
@@ -1440,7 +1440,7 @@  discard block
 block discarded – undo
1440 1440
 			//$Connection->db->commit();
1441 1441
 		}
1442 1442
 		return '';
1443
-        }
1443
+		}
1444 1444
 
1445 1445
 	public static function satellite_ucsdb($filename) {
1446 1446
 		global $tmp_dir, $globalTransaction;
@@ -1689,11 +1689,11 @@  discard block
 block discarded – undo
1689 1689
 							try {
1690 1690
 								$sth = $Connection->db->prepare($query);
1691 1691
 								$sth->execute(array(
1692
-								    ':name' => $result['name'], ':name_alternate' => '', ':country_un' => '', ':country_owner' => $result['country_owner'], ':owner' => $result['owner'], ':users' => '', ':purpose' => '', ':purpose_detailed' => '', ':orbit' => $result['status'],
1693
-								    ':type' => '', ':longitude_geo' => NULL, ':perigee' => !empty($result['perigee']) ? $result['perigee'] : NULL, ':apogee' => !empty($result['apogee']) ? $result['apogee'] : NULL, ':eccentricity' => NULL, ':inclination' => $result['inclination'],
1694
-								    ':period' => !empty($result['period']) ? $result['period'] : NULL, ':launch_mass' => NULL, ':dry_mass' => NULL, ':power' => NULL, ':launch_date' => $result['launch_date'], ':lifetime' => $result['lifetime'], 
1695
-								    ':contractor' => '',':country_contractor' => '', ':launch_site' => $result['launch_site'], ':launch_vehicule' => '', ':cospar' => $result['cospar'], ':norad' => $result['norad'], ':comments' => '', ':source_orbital' => '', ':sources' => ''
1696
-								    )
1692
+									':name' => $result['name'], ':name_alternate' => '', ':country_un' => '', ':country_owner' => $result['country_owner'], ':owner' => $result['owner'], ':users' => '', ':purpose' => '', ':purpose_detailed' => '', ':orbit' => $result['status'],
1693
+									':type' => '', ':longitude_geo' => NULL, ':perigee' => !empty($result['perigee']) ? $result['perigee'] : NULL, ':apogee' => !empty($result['apogee']) ? $result['apogee'] : NULL, ':eccentricity' => NULL, ':inclination' => $result['inclination'],
1694
+									':period' => !empty($result['period']) ? $result['period'] : NULL, ':launch_mass' => NULL, ':dry_mass' => NULL, ':power' => NULL, ':launch_date' => $result['launch_date'], ':lifetime' => $result['lifetime'], 
1695
+									':contractor' => '',':country_contractor' => '', ':launch_site' => $result['launch_site'], ':launch_vehicule' => '', ':cospar' => $result['cospar'], ':norad' => $result['norad'], ':comments' => '', ':source_orbital' => '', ':sources' => ''
1696
+									)
1697 1697
 								);
1698 1698
 							} catch(PDOException $e) {
1699 1699
 								return "error : ".$e->getMessage();
@@ -1717,13 +1717,13 @@  discard block
 block discarded – undo
1717 1717
 			//$Connection->db->commit();
1718 1718
 		}
1719 1719
 		return '';
1720
-        }
1720
+		}
1721 1721
 
1722 1722
 	/**
1723
-        * Convert a HTML table to an array
1724
-        * @param String $data HTML page
1725
-        * @return Array array of the tables in HTML page
1726
-        */
1723
+	 * Convert a HTML table to an array
1724
+	 * @param String $data HTML page
1725
+	 * @return Array array of the tables in HTML page
1726
+	 */
1727 1727
 /*
1728 1728
         private static function table2array($data) {
1729 1729
                 $html = str_get_html($data);
@@ -1753,11 +1753,11 @@  discard block
 block discarded – undo
1753 1753
                 return(array_filter($tabledata));
1754 1754
         }
1755 1755
 */
1756
-       /**
1757
-        * Get data from form result
1758
-        * @param String $url form URL
1759
-        * @return String the result
1760
-        */
1756
+	   /**
1757
+	    * Get data from form result
1758
+	    * @param String $url form URL
1759
+	    * @return String the result
1760
+	    */
1761 1761
 /*
1762 1762
         private static function getData($url) {
1763 1763
                 $ch = curl_init();
@@ -1850,7 +1850,7 @@  discard block
 block discarded – undo
1850 1850
 			if ($globalTransaction) $Connection->db->commit();
1851 1851
 		}
1852 1852
 		return '';
1853
-        }
1853
+		}
1854 1854
 
1855 1855
 	public static function ivao_airlines($filename) {
1856 1856
 		//require_once(dirname(__FILE__).'/../require/class.Spotter.php');
@@ -1860,10 +1860,10 @@  discard block
 block discarded – undo
1860 1860
 		try {
1861 1861
 			$Connection = new Connection();
1862 1862
 			$sth = $Connection->db->prepare($query);
1863
-                        $sth->execute();
1864
-                } catch(PDOException $e) {
1865
-                        return "error : ".$e->getMessage();
1866
-                }
1863
+						$sth->execute();
1864
+				} catch(PDOException $e) {
1865
+						return "error : ".$e->getMessage();
1866
+				}
1867 1867
 
1868 1868
 		$header = NULL;
1869 1869
 		$delimiter = ':';
@@ -1887,7 +1887,7 @@  discard block
 block discarded – undo
1887 1887
 			if ($globalTransaction) $Connection->db->commit();
1888 1888
 		}
1889 1889
 		return '';
1890
-        }
1890
+		}
1891 1891
 	
1892 1892
 	public static function update_airspace() {
1893 1893
 		global $tmp_dir, $globalDBdriver;
@@ -1897,11 +1897,11 @@  discard block
 block discarded – undo
1897 1897
 			$query = 'DROP TABLE airspace';
1898 1898
 			try {
1899 1899
 				$sth = $Connection->db->prepare($query);
1900
-                    		$sth->execute();
1901
-	                } catch(PDOException $e) {
1900
+							$sth->execute();
1901
+					} catch(PDOException $e) {
1902 1902
 				return "error : ".$e->getMessage();
1903
-	                }
1904
-	        }
1903
+					}
1904
+			}
1905 1905
 
1906 1906
 
1907 1907
 		if ($globalDBdriver == 'mysql') update_db::gunzip('../db/airspace.sql.gz',$tmp_dir.'airspace.sql');
@@ -1966,10 +1966,10 @@  discard block
 block discarded – undo
1966 1966
 			$query = 'DROP TABLE countries';
1967 1967
 			try {
1968 1968
 				$sth = $Connection->db->prepare($query);
1969
-            	        	$sth->execute();
1970
-	                } catch(PDOException $e) {
1971
-    	                	echo "error : ".$e->getMessage();
1972
-	                }
1969
+							$sth->execute();
1970
+					} catch(PDOException $e) {
1971
+							echo "error : ".$e->getMessage();
1972
+					}
1973 1973
 		}
1974 1974
 		if ($globalDBdriver == 'mysql') {
1975 1975
 			update_db::gunzip('../db/countries.sql.gz',$tmp_dir.'countries.sql');
@@ -2426,7 +2426,7 @@  discard block
 block discarded – undo
2426 2426
 						$error = update_db::airlines_fam();
2427 2427
 						update_db::insert_airlines_version($airlines_md5);
2428 2428
 					} else $error = "File ".$tmp_dir.'airlines.tsv.gz'." md5 failed. Download failed.";
2429
-			    } else $error = "File ".$tmp_dir.'airlines.tsv.gz'." doesn't exist. Download failed.";
2429
+				} else $error = "File ".$tmp_dir.'airlines.tsv.gz'." doesn't exist. Download failed.";
2430 2430
 			} elseif ($globalDebug) echo "No update.";
2431 2431
 		} else $error = "File ".$tmp_dir.'airlines.tsv.gz.md5'." doesn't exist. Download failed.";
2432 2432
 		if ($error != '') {
@@ -2800,12 +2800,12 @@  discard block
 block discarded – undo
2800 2800
 		echo $data;
2801 2801
 		*/
2802 2802
 		if (file_exists($tmp_dir.'aircrafts.html')) {
2803
-		    //var_dump(file_get_html($tmp_dir.'aircrafts.html'));
2804
-		    $fh = fopen($tmp_dir.'aircrafts.html',"r");
2805
-		    $result = fread($fh,100000000);
2806
-		    //echo $result;
2807
-		    //var_dump(str_get_html($result));
2808
-		    //print_r(self::table2array($result));
2803
+			//var_dump(file_get_html($tmp_dir.'aircrafts.html'));
2804
+			$fh = fopen($tmp_dir.'aircrafts.html',"r");
2805
+			$result = fread($fh,100000000);
2806
+			//echo $result;
2807
+			//var_dump(str_get_html($result));
2808
+			//print_r(self::table2array($result));
2809 2809
 		}
2810 2810
 
2811 2811
 	}
@@ -2819,10 +2819,10 @@  discard block
 block discarded – undo
2819 2819
 		try {
2820 2820
 			$Connection = new Connection();
2821 2821
 			$sth = $Connection->db->prepare($query);
2822
-                        $sth->execute();
2823
-                } catch(PDOException $e) {
2824
-                        return "error : ".$e->getMessage();
2825
-                }
2822
+						$sth->execute();
2823
+				} catch(PDOException $e) {
2824
+						return "error : ".$e->getMessage();
2825
+				}
2826 2826
 
2827 2827
 		$error = '';
2828 2828
 		if ($globalDebug) echo "Notam : Download...";
@@ -2878,8 +2878,8 @@  discard block
 block discarded – undo
2878 2878
 					$data['date_end'] = date("Y-m-d H:i:s",strtotime($to));
2879 2879
 					$data['permanent'] = 0;
2880 2880
 				} else {
2881
-				    $data['date_end'] = NULL;
2882
-				    $data['permanent'] = 1;
2881
+					$data['date_end'] = NULL;
2882
+					$data['permanent'] = 1;
2883 2883
 				}
2884 2884
 				$data['full_notam'] = $notam['title'].'<br>'.$notam['description'];
2885 2885
 				$NOTAM = new NOTAM();
@@ -2953,13 +2953,13 @@  discard block
 block discarded – undo
2953 2953
 		try {
2954 2954
 			$Connection = new Connection();
2955 2955
 			$sth = $Connection->db->prepare($query);
2956
-                        $sth->execute();
2957
-                } catch(PDOException $e) {
2958
-                        return "error : ".$e->getMessage();
2959
-                }
2960
-                $row = $sth->fetch(PDO::FETCH_ASSOC);
2961
-                if ($row['nb'] > 0) return false;
2962
-                else return true;
2956
+						$sth->execute();
2957
+				} catch(PDOException $e) {
2958
+						return "error : ".$e->getMessage();
2959
+				}
2960
+				$row = $sth->fetch(PDO::FETCH_ASSOC);
2961
+				if ($row['nb'] > 0) return false;
2962
+				else return true;
2963 2963
 	}
2964 2964
 
2965 2965
 	public static function insert_last_update() {
@@ -2968,10 +2968,10 @@  discard block
 block discarded – undo
2968 2968
 		try {
2969 2969
 			$Connection = new Connection();
2970 2970
 			$sth = $Connection->db->prepare($query);
2971
-                        $sth->execute();
2972
-                } catch(PDOException $e) {
2973
-                        return "error : ".$e->getMessage();
2974
-                }
2971
+						$sth->execute();
2972
+				} catch(PDOException $e) {
2973
+						return "error : ".$e->getMessage();
2974
+				}
2975 2975
 	}
2976 2976
 
2977 2977
 	public static function check_airspace_version($version) {
@@ -2979,13 +2979,13 @@  discard block
 block discarded – undo
2979 2979
 		try {
2980 2980
 			$Connection = new Connection();
2981 2981
 			$sth = $Connection->db->prepare($query);
2982
-                        $sth->execute(array(':version' => $version));
2983
-                } catch(PDOException $e) {
2984
-                        return "error : ".$e->getMessage();
2985
-                }
2986
-                $row = $sth->fetch(PDO::FETCH_ASSOC);
2987
-                if ($row['nb'] > 0) return true;
2988
-                else return false;
2982
+						$sth->execute(array(':version' => $version));
2983
+				} catch(PDOException $e) {
2984
+						return "error : ".$e->getMessage();
2985
+				}
2986
+				$row = $sth->fetch(PDO::FETCH_ASSOC);
2987
+				if ($row['nb'] > 0) return true;
2988
+				else return false;
2989 2989
 	}
2990 2990
 
2991 2991
 	public static function check_geoid_version($version) {
@@ -2993,13 +2993,13 @@  discard block
 block discarded – undo
2993 2993
 		try {
2994 2994
 			$Connection = new Connection();
2995 2995
 			$sth = $Connection->db->prepare($query);
2996
-                        $sth->execute(array(':version' => $version));
2997
-                } catch(PDOException $e) {
2998
-                        return "error : ".$e->getMessage();
2999
-                }
3000
-                $row = $sth->fetch(PDO::FETCH_ASSOC);
3001
-                if ($row['nb'] > 0) return true;
3002
-                else return false;
2996
+						$sth->execute(array(':version' => $version));
2997
+				} catch(PDOException $e) {
2998
+						return "error : ".$e->getMessage();
2999
+				}
3000
+				$row = $sth->fetch(PDO::FETCH_ASSOC);
3001
+				if ($row['nb'] > 0) return true;
3002
+				else return false;
3003 3003
 	}
3004 3004
 
3005 3005
 	public static function check_marine_identity_version($version) {
@@ -3100,10 +3100,10 @@  discard block
 block discarded – undo
3100 3100
 		try {
3101 3101
 			$Connection = new Connection();
3102 3102
 			$sth = $Connection->db->prepare($query);
3103
-                        $sth->execute(array(':version' => $version));
3104
-                } catch(PDOException $e) {
3105
-                        return "error : ".$e->getMessage();
3106
-                }
3103
+						$sth->execute(array(':version' => $version));
3104
+				} catch(PDOException $e) {
3105
+						return "error : ".$e->getMessage();
3106
+				}
3107 3107
 	}
3108 3108
 
3109 3109
 	public static function insert_marine_identity_version($version) {
@@ -3140,13 +3140,13 @@  discard block
 block discarded – undo
3140 3140
 		try {
3141 3141
 			$Connection = new Connection();
3142 3142
 			$sth = $Connection->db->prepare($query);
3143
-                        $sth->execute();
3144
-                } catch(PDOException $e) {
3145
-                        return "error : ".$e->getMessage();
3146
-                }
3147
-                $row = $sth->fetch(PDO::FETCH_ASSOC);
3148
-                if ($row['nb'] > 0) return false;
3149
-                else return true;
3143
+						$sth->execute();
3144
+				} catch(PDOException $e) {
3145
+						return "error : ".$e->getMessage();
3146
+				}
3147
+				$row = $sth->fetch(PDO::FETCH_ASSOC);
3148
+				if ($row['nb'] > 0) return false;
3149
+				else return true;
3150 3150
 	}
3151 3151
 
3152 3152
 	public static function insert_last_notam_update() {
@@ -3155,10 +3155,10 @@  discard block
 block discarded – undo
3155 3155
 		try {
3156 3156
 			$Connection = new Connection();
3157 3157
 			$sth = $Connection->db->prepare($query);
3158
-                        $sth->execute();
3159
-                } catch(PDOException $e) {
3160
-                        return "error : ".$e->getMessage();
3161
-                }
3158
+						$sth->execute();
3159
+				} catch(PDOException $e) {
3160
+						return "error : ".$e->getMessage();
3161
+				}
3162 3162
 	}
3163 3163
 
3164 3164
 	public static function check_last_airspace_update() {
@@ -3171,13 +3171,13 @@  discard block
 block discarded – undo
3171 3171
 		try {
3172 3172
 			$Connection = new Connection();
3173 3173
 			$sth = $Connection->db->prepare($query);
3174
-                        $sth->execute();
3175
-                } catch(PDOException $e) {
3176
-                        return "error : ".$e->getMessage();
3177
-                }
3178
-                $row = $sth->fetch(PDO::FETCH_ASSOC);
3179
-                if ($row['nb'] > 0) return false;
3180
-                else return true;
3174
+						$sth->execute();
3175
+				} catch(PDOException $e) {
3176
+						return "error : ".$e->getMessage();
3177
+				}
3178
+				$row = $sth->fetch(PDO::FETCH_ASSOC);
3179
+				if ($row['nb'] > 0) return false;
3180
+				else return true;
3181 3181
 	}
3182 3182
 
3183 3183
 	public static function insert_last_airspace_update() {
@@ -3186,10 +3186,10 @@  discard block
 block discarded – undo
3186 3186
 		try {
3187 3187
 			$Connection = new Connection();
3188 3188
 			$sth = $Connection->db->prepare($query);
3189
-                        $sth->execute();
3190
-                } catch(PDOException $e) {
3191
-                        return "error : ".$e->getMessage();
3192
-                }
3189
+						$sth->execute();
3190
+				} catch(PDOException $e) {
3191
+						return "error : ".$e->getMessage();
3192
+				}
3193 3193
 	}
3194 3194
 
3195 3195
 	public static function check_last_geoid_update() {
@@ -3202,13 +3202,13 @@  discard block
 block discarded – undo
3202 3202
 		try {
3203 3203
 			$Connection = new Connection();
3204 3204
 			$sth = $Connection->db->prepare($query);
3205
-                        $sth->execute();
3206
-                } catch(PDOException $e) {
3207
-                        return "error : ".$e->getMessage();
3208
-                }
3209
-                $row = $sth->fetch(PDO::FETCH_ASSOC);
3210
-                if ($row['nb'] > 0) return false;
3211
-                else return true;
3205
+						$sth->execute();
3206
+				} catch(PDOException $e) {
3207
+						return "error : ".$e->getMessage();
3208
+				}
3209
+				$row = $sth->fetch(PDO::FETCH_ASSOC);
3210
+				if ($row['nb'] > 0) return false;
3211
+				else return true;
3212 3212
 	}
3213 3213
 
3214 3214
 	public static function insert_last_geoid_update() {
@@ -3217,10 +3217,10 @@  discard block
 block discarded – undo
3217 3217
 		try {
3218 3218
 			$Connection = new Connection();
3219 3219
 			$sth = $Connection->db->prepare($query);
3220
-                        $sth->execute();
3221
-                } catch(PDOException $e) {
3222
-                        return "error : ".$e->getMessage();
3223
-                }
3220
+						$sth->execute();
3221
+				} catch(PDOException $e) {
3222
+						return "error : ".$e->getMessage();
3223
+				}
3224 3224
 	}
3225 3225
 
3226 3226
 	public static function check_last_owner_update() {
@@ -3248,10 +3248,10 @@  discard block
 block discarded – undo
3248 3248
 		try {
3249 3249
 			$Connection = new Connection();
3250 3250
 			$sth = $Connection->db->prepare($query);
3251
-                        $sth->execute();
3252
-                } catch(PDOException $e) {
3253
-                        return "error : ".$e->getMessage();
3254
-                }
3251
+						$sth->execute();
3252
+				} catch(PDOException $e) {
3253
+						return "error : ".$e->getMessage();
3254
+				}
3255 3255
 	}
3256 3256
 
3257 3257
 	public static function check_last_airlines_update() {
@@ -3295,13 +3295,13 @@  discard block
 block discarded – undo
3295 3295
 		try {
3296 3296
 			$Connection = new Connection();
3297 3297
 			$sth = $Connection->db->prepare($query);
3298
-                        $sth->execute();
3299
-                } catch(PDOException $e) {
3300
-                        return "error : ".$e->getMessage();
3301
-                }
3302
-                $row = $sth->fetch(PDO::FETCH_ASSOC);
3303
-                if ($row['nb'] > 0) return false;
3304
-                else return true;
3298
+						$sth->execute();
3299
+				} catch(PDOException $e) {
3300
+						return "error : ".$e->getMessage();
3301
+				}
3302
+				$row = $sth->fetch(PDO::FETCH_ASSOC);
3303
+				if ($row['nb'] > 0) return false;
3304
+				else return true;
3305 3305
 	}
3306 3306
 
3307 3307
 	public static function insert_last_schedules_update() {
@@ -3481,10 +3481,10 @@  discard block
 block discarded – undo
3481 3481
 		try {
3482 3482
 			$Connection = new Connection();
3483 3483
 			$sth = $Connection->db->prepare($query);
3484
-                        $sth->execute();
3485
-                } catch(PDOException $e) {
3486
-                        return "error : ".$e->getMessage();
3487
-                }
3484
+						$sth->execute();
3485
+				} catch(PDOException $e) {
3486
+						return "error : ".$e->getMessage();
3487
+				}
3488 3488
 	}
3489 3489
 	public static function delete_duplicateowner() {
3490 3490
 		global $globalDBdriver;
@@ -3496,10 +3496,10 @@  discard block
 block discarded – undo
3496 3496
 		try {
3497 3497
 			$Connection = new Connection();
3498 3498
 			$sth = $Connection->db->prepare($query);
3499
-                        $sth->execute();
3500
-                } catch(PDOException $e) {
3501
-                        return "error : ".$e->getMessage();
3502
-                }
3499
+						$sth->execute();
3500
+				} catch(PDOException $e) {
3501
+						return "error : ".$e->getMessage();
3502
+				}
3503 3503
 	}
3504 3504
 	
3505 3505
 	public static function update_all() {
Please login to merge, or discard this patch.
index.php 1 patch
Indentation   +93 added lines, -93 removed lines patch added patch discarded remove patch
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
     <?php }; if (isset($globalSatellite) && $globalSatellite) { ?><td><div id="ibxsatellite"><h4><?php echo _("Satellites Displayed"); ?></h4><br /><i class="fa fa-spinner fa-pulse fa-fw"></i></div></td><?php } ?>
47 47
 </tr></table></div>
48 48
 <?php
49
-    if ((!isset($_COOKIE['MapFormat']) && isset($globalMap3Ddefault) && $globalMap3Ddefault) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d')) {
49
+	if ((!isset($_COOKIE['MapFormat']) && isset($globalMap3Ddefault) && $globalMap3Ddefault) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d')) {
50 50
 ?>
51 51
 <script src="<?php echo $globalURL; ?>/js/map.3d.js.php"></script>
52 52
 <?php
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
 <script src="<?php echo $globalURL; ?>/js/map-marine.3d.js.php"></script>
71 71
 <?php
72 72
 	}
73
-    }
73
+	}
74 74
 ?>
75 75
 
76 76
 <div id="sidebar" class="sidebar collapsed">
@@ -81,34 +81,34 @@  discard block
 block discarded – undo
81 81
 	<li><a href="#" onclick="getUserLocation(); return false;" title="<?php echo _("Plot your Location"); ?>"><i class="fa fa-map-marker"></i></a></li>
82 82
 	<li><a href="#" onclick="getCompassDirection(); return false;" title="<?php echo _("Compass Mode"); ?>"><i class="fa fa-compass"></i></a></li>
83 83
 <?php
84
-    if (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d') {
84
+	if (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d') {
85 85
 	if (isset($globalArchive) && $globalArchive == TRUE) {
86 86
 ?>
87 87
 	<li><a href="#archive" role="tab" title="<?php echo _("Archive"); ?>"><i class="fa fa-archive"></i></a></li>
88 88
 <?php
89 89
 	}
90
-    }
90
+	}
91 91
 ?>
92 92
 	<li><a href="#home" role="tab" title="<?php echo _("Layers"); ?>"><i class="fa fa-map"></i></a></li>
93 93
 	<li><a href="#filters" role="tab" title="<?php echo _("Filters"); ?>"><i class="fa fa-filter"></i></a></li>
94 94
 	<li><a href="#settings" role="tab" title="<?php echo _("Settings"); ?>"><i class="fa fa-gears"></i></a></li>
95 95
 <?php
96
-    if (isset($globalMap3D) && $globalMap3D) {
96
+	if (isset($globalMap3D) && $globalMap3D) {
97 97
 	if ((!isset($_COOKIE['MapFormat']) && (!isset($globalMap3Ddefault) || !$globalMap3Ddefault)) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] != '3d')) {
98 98
 ?>
99 99
 	<li><a href="#" onclick="show3D(); return false;" role="tab" title="3D"><b>3D</b></a></li>
100 100
 <?php
101
-	    if (isset($globalSatellite) && $globalSatellite) {
101
+		if (isset($globalSatellite) && $globalSatellite) {
102 102
 ?>
103 103
 	<li><a href="#satellites" role="tab" title="<?php echo _("Satellites"); ?>"><i class="satellite"></i></a></li>
104 104
 <?php
105
-	    }
105
+		}
106 106
 	} else {
107 107
 ?>
108 108
 	<li><a href="#" onclick="show2D(); return false;" role="tab" title="2D"><b>2D</b></a></li>
109 109
 <?php
110 110
 	}
111
-    }
111
+	}
112 112
 ?>
113 113
     </ul>
114 114
 
@@ -183,7 +183,7 @@  discard block
 block discarded – undo
183 183
 ?>
184 184
         </div>
185 185
 <?php
186
-    if (isset($globalArchive) && $globalArchive == TRUE) {
186
+	if (isset($globalArchive) && $globalArchive == TRUE) {
187 187
 ?>
188 188
         <div class="sidebar-pane" id="archive">
189 189
 	    <h1 class="sidebar-header"><?php echo _("Playback"); ?> <i>Bêta</i><span class="sidebar-close"><i class="fa fa-caret-left"></i></span></h1>
@@ -242,7 +242,7 @@  discard block
 block discarded – undo
242 242
 	    </form>
243 243
 	</div>
244 244
 <?php
245
-    }
245
+	}
246 246
 ?>
247 247
         <div class="sidebar-pane" id="settings">
248 248
 	    <h1 class="sidebar-header"><?php echo _("Settings"); ?><span class="sidebar-close"><i class="fa fa-caret-left"></i></span></h1>
@@ -253,56 +253,56 @@  discard block
 block discarded – undo
253 253
 			    <?php
254 254
 				if (!isset($_COOKIE['MapType']) || $_COOKIE['MapType'] == '') $MapType = $globalMapProvider;
255 255
 				else $MapType = $_COOKIE['MapType'];
256
-			    ?>
256
+				?>
257 257
 			    <?php
258 258
 				if (isset($globalBingMapKey) && $globalBingMapKey != '') {
259
-			    ?>
259
+				?>
260 260
 			    <option value="Bing-Aerial"<?php if ($MapType == 'Bing-Aerial') print ' selected'; ?>>Bing-Aerial</option>
261 261
 			    <option value="Bing-Hybrid"<?php if ($MapType == 'Bing-Hybrid') print ' selected'; ?>>Bing-Hybrid</option>
262 262
 			    <option value="Bing-Road"<?php if ($MapType == 'Bing-Road') print ' selected'; ?>>Bing-Road</option>
263 263
 			    <?php
264 264
 				}
265
-			    ?>
265
+				?>
266 266
 			    <?php
267
-			        if ((!isset($_COOKIE['MapFormat']) && (!isset($globalMap3Ddefault) || !$globalMap3Ddefault)) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] != '3d')) {
268
-			    ?>
267
+					if ((!isset($_COOKIE['MapFormat']) && (!isset($globalMap3Ddefault) || !$globalMap3Ddefault)) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] != '3d')) {
268
+				?>
269 269
 			    <?php
270
-				    if (isset($globalHereappId) && $globalHereappId != '' && isset($globalHereappCode) && $globalHereappCode != '') {
271
-			    ?>
270
+					if (isset($globalHereappId) && $globalHereappId != '' && isset($globalHereappCode) && $globalHereappCode != '') {
271
+				?>
272 272
 			    <option value="Here-Aerial"<?php if ($MapType == 'Here') print ' selected'; ?>>Here-Aerial</option>
273 273
 			    <option value="Here-Hybrid"<?php if ($MapType == 'Here') print ' selected'; ?>>Here-Hybrid</option>
274 274
 			    <option value="Here-Road"<?php if ($MapType == 'Here') print ' selected'; ?>>Here-Road</option>
275 275
 			    <?php
276
-				    }
277
-			    ?>
276
+					}
277
+				?>
278 278
 			    <?php
279
-				    if (isset($globalGoogleAPIKey) && $globalGoogleAPIKey != '') {
280
-			    ?>
279
+					if (isset($globalGoogleAPIKey) && $globalGoogleAPIKey != '') {
280
+				?>
281 281
 			    <option value="Google-Roadmap"<?php if ($MapType == 'Google-Roadmap') print ' selected'; ?>>Google Roadmap</option>
282 282
 			    <option value="Google-Satellite"<?php if ($MapType == 'Google-Satellite') print ' selected'; ?>>Google Satellite</option>
283 283
 			    <option value="Google-Hybrid"<?php if ($MapType == 'Google-Hybrid') print ' selected'; ?>>Google Hybrid</option>
284 284
 			    <option value="Google-Terrain"<?php if ($MapType == 'Google-Terrain') print ' selected'; ?>>Google Terrain</option>
285 285
 			    <?php
286
-				    }
287
-			    ?>
286
+					}
287
+				?>
288 288
 			    <?php
289
-				    if (isset($globalMapQuestKey) && $globalMapQuestKey != '') {
290
-			    ?>
289
+					if (isset($globalMapQuestKey) && $globalMapQuestKey != '') {
290
+				?>
291 291
 			    <option value="MapQuest-OSM"<?php if ($MapType == 'MapQuest-OSM') print ' selected'; ?>>MapQuest-OSM</option>
292 292
 			    <option value="MapQuest-Aerial"<?php if ($MapType == 'MapQuest-Aerial') print ' selected'; ?>>MapQuest-Aerial</option>
293 293
 			    <option value="MapQuest-Hybrid"<?php if ($MapType == 'MapQuest-Hybrid') print ' selected'; ?>>MapQuest-Hybrid</option>
294 294
 			    <?php
295
-				    }
296
-			    ?>
295
+					}
296
+				?>
297 297
 			    <option value="Yandex"<?php if ($MapType == 'Yandex') print ' selected'; ?>>Yandex</option>
298 298
 			    <?php
299 299
 				}
300
-			    ?>
300
+				?>
301 301
 			    <?php
302
-				    if (isset($globalMapboxToken) && $globalMapboxToken != '') {
302
+					if (isset($globalMapboxToken) && $globalMapboxToken != '') {
303 303
 					if (!isset($_COOKIE['MapTypeId'])) $MapBoxId = 'default';
304 304
 					else $MapBoxId = $_COOKIE['MapTypeId'];
305
-			    ?>
305
+				?>
306 306
 			    <option value="Mapbox-default"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'default') print ' selected'; ?>>Mapbox default</option>
307 307
 			    <option value="Mapbox-mapbox.streets"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.streets') print ' selected'; ?>>Mapbox streets</option>
308 308
 			    <option value="Mapbox-mapbox.light"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.light') print ' selected'; ?>>Mapbox light</option>
@@ -316,13 +316,13 @@  discard block
 block discarded – undo
316 316
 			    <option value="Mapbox-mapbox.pirates"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.pirates') print ' selected'; ?>>Mapbox pirates</option>
317 317
 			    <option value="Mapbox-mapbox.emerald"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.emerald') print ' selected'; ?>>Mapbox emerald</option>
318 318
 			    <?php
319
-				    }
320
-			    ?>
319
+					}
320
+				?>
321 321
 			    <option value="OpenStreetMap"<?php if ($MapType == 'OpenStreetMap') print ' selected'; ?>>OpenStreetMap</option>
322 322
 			</select>
323 323
 		    </li>
324 324
 <?php
325
-    if (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d') {
325
+	if (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d') {
326 326
 ?>
327 327
 		    <li><?php echo _("Type of Terrain:"); ?>
328 328
 			<select  class="selectpicker" onchange="terrainType(this);">
@@ -333,10 +333,10 @@  discard block
 block discarded – undo
333 333
 			</select>
334 334
 		    </li>
335 335
 <?php
336
-    }
336
+	}
337 337
 ?>
338 338
 <?php
339
-    if (!isset($_COOKIE['MapFormat']) || $_COOKIE['MapFormat'] != '3d') {
339
+	if (!isset($_COOKIE['MapFormat']) || $_COOKIE['MapFormat'] != '3d') {
340 340
 ?>
341 341
 <?php
342 342
 	if (!isset($globalAircraft) || $globalAircraft === TRUE) {
@@ -353,88 +353,88 @@  discard block
 block discarded – undo
353 353
 		    <li><div class="checkbox"><label><input type="checkbox" name="satelliteestimation" value="1" onclick="clickSatelliteEstimation(this)" <?php if ((isset($_COOKIE['satelliteestimation']) && $_COOKIE['satelliteestimation'] == 'true') || (!isset($_COOKIE['satelliteestimation']) && !isset($globalMapEstimation)) || (!isset($_COOKIE['satelliteestimation']) && isset($globalMapEstimation) && $globalMapEstimation)) print 'checked'; ?> ><?php echo _("Satellites animate between updates"); ?></label></div></li>
354 354
 <?php
355 355
 	}
356
-    }
356
+	}
357 357
 ?>
358 358
 		    <li><div class="checkbox"><label><input type="checkbox" name="displayairports" value="1" onclick="clickDisplayAirports(this)" <?php if (isset($_COOKIE['displayairports']) && $_COOKIE['displayairports'] == 'true' || !isset($_COOKIE['displayairports'])) print 'checked'; ?> ><?php echo _("Display airports on map"); ?></label></div></li>
359 359
 		    <li><div class="checkbox"><label><input type="checkbox" name="displaygroundstation" value="1" onclick="clickDisplayGroundStation(this)" <?php if ((isset($_COOKIE['show_GroundStation']) && $_COOKIE['show_GroundStation'] == 'true') || (!isset($_COOKIE['show_GroundStation']) && (!isset($globalMapGroundStation) || $globalMapGroundStation === TRUE))) print 'checked'; ?> ><?php echo _("Display ground station on map"); ?></label></div></li>
360 360
 		    <li><div class="checkbox"><label><input type="checkbox" name="displayweatherstation" value="1" onclick="clickDisplayWeatherStation(this)" <?php if ((isset($_COOKIE['show_WeatherStation']) && $_COOKIE['show_WeatherStation'] == 'true') || (!isset($_COOKIE['show_WeatherStation']) && (!isset($globalMapWeatherStation) || $globalMapWeatherStation === TRUE))) print 'checked'; ?> ><?php echo _("Display weather station on map"); ?></label></div></li>
361 361
 		    <li><div class="checkbox"><label><input type="checkbox" name="displaylightning" value="1" onclick="clickDisplayLightning(this)" <?php if ((isset($_COOKIE['show_Lightning']) && $_COOKIE['show_Lightning'] == 'true') || (!isset($_COOKIE['show_Lightning']) && (!isset($globalMapLightning) || $globalMapLightning === TRUE))) print 'checked'; ?> ><?php echo _("Display lightning on map"); ?></label></div></li>
362 362
 <?php
363
-    if (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d') {
363
+	if (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d') {
364 364
 ?>
365 365
 		    <li><div class="checkbox"><label><input type="checkbox" name="displayminimap" value="1" onclick="clickDisplayMinimap(this)" <?php if (!isset($_COOKIE['displayminimap']) || (isset($_COOKIE['displayminimap']) && $_COOKIE['displayminimap'] == 'true')) print 'checked'; ?> ><?php echo _("Show mini-map"); ?></label></div></li>
366 366
 <?php
367
-    }
368
-    if (time() > mktime(0,0,0,12,1,date("Y")) && time() < mktime(0,0,0,12,31,date("Y"))) {
367
+	}
368
+	if (time() > mktime(0,0,0,12,1,date("Y")) && time() < mktime(0,0,0,12,31,date("Y"))) {
369 369
 ?>
370 370
 		    <li><div class="checkbox"><label><input type="checkbox" name="displaysanta" value="1" onclick="clickSanta(this)"><i class="fa fa-snowflake-o" aria-hidden="true"></i> <?php echo _("Show Santa Claus now"); ?> <i class="fa fa-snowflake-o" aria-hidden="true"></i></label></div></li>
371 371
 <?php
372
-    }
372
+	}
373 373
 ?>
374 374
 		    <?php
375 375
 			if (function_exists('array_column')) {
376
-			    if (array_search(TRUE, array_column($globalSources, 'sourcestats')) !== FALSE) {
377
-		    ?>
376
+				if (array_search(TRUE, array_column($globalSources, 'sourcestats')) !== FALSE) {
377
+			?>
378 378
 		    <li><div class="checkbox"><label><input type="checkbox" name="flightpolar" value="1" onclick="clickPolar(this)" <?php if ((isset($_COOKIE['polar']) && $_COOKIE['polar'] == 'true')) print 'checked'; ?> ><?php echo _("Display polar on map"); ?></label></div></li>
379 379
 		    <?php
380
-			    }
380
+				}
381 381
 			} elseif (isset($globalSources)) {
382
-			    $dispolar = false;
383
-			    foreach ($globalSources as $testsource) {
384
-			        if (isset($globalSources['sourcestats']) && $globalSources['sourcestats'] !== FALSE) $dispolar = true;
385
-			    }
386
-			    if ($dispolar) {
387
-		    ?>
382
+				$dispolar = false;
383
+				foreach ($globalSources as $testsource) {
384
+					if (isset($globalSources['sourcestats']) && $globalSources['sourcestats'] !== FALSE) $dispolar = true;
385
+				}
386
+				if ($dispolar) {
387
+			?>
388 388
 		    <li><div class="checkbox"><label><input type="checkbox" name="flightpolar" value="1" onclick="clickPolar(this)" <?php if ((isset($_COOKIE['polar']) && $_COOKIE['polar'] == 'true')) print 'checked'; ?> ><?php echo _("Display polar on map"); ?></label></div></li>
389 389
 		    <?php
390
-			    }
391
-		        }
392
-		    ?>
390
+				}
391
+				}
392
+			?>
393 393
 <?php
394
-    if (!isset($_COOKIE['MapFormat']) || $_COOKIE['MapFormat'] != '3d') {
394
+	if (!isset($_COOKIE['MapFormat']) || $_COOKIE['MapFormat'] != '3d') {
395 395
 ?>
396 396
 
397 397
 		    <?php
398 398
 			if (!isset($globalAircraft) || $globalAircraft === TRUE) {
399
-		    	    if (extension_loaded('gd') && function_exists('gd_info')) {
400
-		    ?>
399
+					if (extension_loaded('gd') && function_exists('gd_info')) {
400
+			?>
401 401
 		    <li><input type="checkbox" name="aircraftcoloraltitude" value="1" onclick="iconColorAltitude(this)" <?php if (isset($_COOKIE['IconColorAltitude']) && $_COOKIE['IconColorAltitude'] == 'true') print 'checked'; ?> ><?php echo _("Aircraft icon color based on altitude"); ?></li>
402 402
 		    <?php 
403 403
 				if (!isset($_COOKIE['IconColorAltitude']) || $_COOKIE['IconColorAltitude'] == 'false') {
404
-		    ?>
404
+			?>
405 405
 		    <li><?php echo _("Aircraft icon color:"); ?>
406 406
 			<input type="color" name="aircraftcolor" id="html5colorpicker" onchange="iconColor(aircraftcolor.value);" value="#<?php if (isset($_COOKIE['IconColor'])) print $_COOKIE['IconColor']; elseif (isset($globalAircraftIconColor)) print $globalAircraftIconColor; else print '1a3151'; ?>">
407 407
 		    </li>
408 408
 		    <?php
409 409
 				}
410
-			    }
411
-		        }
412
-		    ?>
410
+				}
411
+				}
412
+			?>
413 413
 		    <?php
414 414
 			if (isset($globalMarine) && $globalMarine === TRUE) {
415
-			    if (extension_loaded('gd') && function_exists('gd_info')) {
416
-		    ?>
415
+				if (extension_loaded('gd') && function_exists('gd_info')) {
416
+			?>
417 417
 		    <li><?php echo _("Marine icon color:"); ?>
418 418
 			<input type="color" name="marinecolor" id="html5colorpicker" onchange="MarineiconColor(marinecolor.value);" value="#<?php if (isset($_COOKIE['MarineIconColor'])) print $_COOKIE['MarineIconColor']; elseif (isset($globalMarineIconColor)) print $globalMarineIconColor; else print '1a3151'; ?>">
419 419
 		    </li>
420 420
 		    <?php
421
-			    }
422
-		        }
423
-		    ?>
421
+				}
422
+				}
423
+			?>
424 424
 		    <?php
425 425
 			if (isset($globalTracker) && $globalTracker === TRUE) {
426
-			    if (extension_loaded('gd') && function_exists('gd_info')) {
427
-		    ?>
426
+				if (extension_loaded('gd') && function_exists('gd_info')) {
427
+			?>
428 428
 		    <li><?php echo _("Tracker icon color:"); ?>
429 429
 			<input type="color" name="trackercolor" id="html5colorpicker" onchange="TrackericonColor(trackercolor.value);" value="#<?php if (isset($_COOKIE['TrackerIconColor'])) print $_COOKIE['TrackerIconColor']; elseif (isset($globalTrackerIconColor)) print $globalTrackerIconColor; else print '1a3151'; ?>">
430 430
 		    </li>
431 431
 		    <?php
432
-			    }
433
-		        }
434
-		    ?>
432
+				}
433
+				}
434
+			?>
435 435
 		    <?php
436 436
 			if (!isset($globalAircraft) || $globalAircraft === TRUE) {
437
-		    ?>
437
+			?>
438 438
 		    <li><?php echo _("Show airport icon at zoom level:"); ?>
439 439
 			<div class="range">
440 440
 			    <input type="range" min="0" max="19" step="1" name="airportzoom" onchange="range.value=value;airportDisplayZoom(airportzoom.value);" value="<?php if (isset($_COOKIE['AirportZoom'])) print $_COOKIE['AirportZoom']; elseif (isset($globalAirportZoom)) print $globalAirportZoom; else print '7'; ?>">
@@ -443,9 +443,9 @@  discard block
 block discarded – undo
443 443
 		    </li>
444 444
 		    <?php
445 445
 			}
446
-		    ?>
446
+			?>
447 447
 <?php
448
-    } elseif (isset($_COOKIE['MapFormat']) || $_COOKIE['MapFOrmat'] == '3d') {
448
+	} elseif (isset($_COOKIE['MapFormat']) || $_COOKIE['MapFOrmat'] == '3d') {
449 449
 ?>
450 450
 <?php
451 451
 	if (!isset($globalAircraft) || $globalAircraft === TRUE) {
@@ -476,7 +476,7 @@  discard block
 block discarded – undo
476 476
 		    </li>
477 477
 <?php
478 478
 	}
479
-    }
479
+	}
480 480
 ?>
481 481
 		    <li><?php echo _("Distance unit:"); ?>
482 482
 			<select class="selectpicker" onchange="unitdistance(this);">
@@ -509,19 +509,19 @@  discard block
 block discarded – undo
509 509
 		    <ul>
510 510
 		    <?php
511 511
 			if (!isset($globalAircraft) || $globalAircraft) {
512
-		    ?>
512
+			?>
513 513
 		    <?php
514 514
 			if (((isset($globalVATSIM) && $globalVATSIM) || isset($globalIVAO) && $globalIVAO || isset($globalphpVMS) && $globalphpVMS) && (!isset($globalMapVAchoose) || $globalMapVAchoose)) {
515
-		    ?>
515
+			?>
516 516
 			<?php if (isset($globalVATSIM) && $globalVATSIM) { ?><li><input type="checkbox" name="vatsim" value="1" onclick="clickVATSIM(this)" <?php if ((isset($_COOKIE['ShowVATSIM']) && $_COOKIE['ShowVATSIM'] == 'true') || !isset($_COOKIE['ShowVATSIM'])) print 'checked'; ?> ><?php echo _("Display VATSIM data"); ?></li><?php } ?>
517 517
 			<?php if (isset($globalIVAO) && $globalIVAO) { ?><li><input type="checkbox" name="ivao" value="1" onclick="clickIVAO(this)" <?php if ((isset($_COOKIE['ShowIVAO']) && $_COOKIE['ShowIVAO'] == 'true') || !isset($_COOKIE['ShowIVAO'])) print 'checked'; ?> ><?php echo _("Display IVAO data"); ?></li><?php } ?>
518 518
 			<?php if (isset($globalphpVMS) && $globalphpVMS) { ?><li><input type="checkbox" name="phpvms" value="1" onclick="clickphpVMS(this)" <?php if ((isset($_COOKIE['ShowVMS']) && $_COOKIE['ShowVMS'] == 'true') || !isset($_COOKIE['ShowVMS'])) print 'checked'; ?> ><?php echo _("Display phpVMS data"); ?></li><?php } ?>
519 519
 		    <?php
520 520
 			}
521
-		    ?>
521
+			?>
522 522
 		    <?php
523 523
 			if (!(isset($globalVA) && $globalVA) && !(isset($globalVATSIM) && $globalVATSIM) && !(isset($globalIVAO) && $globalIVAO) && !(isset($globalphpVMS) && $globalphpVMS) && isset($globalSBS1) && $globalSBS1 && isset($globalAPRS) && $globalAPRS && (!isset($globalMapchoose) || $globalMapchoose)) {
524
-		    ?>
524
+			?>
525 525
 			<?php if (isset($globalSBS1) && $globalSBS1) { ?>
526 526
 			    <li><div class="checkbox"><label><input type="checkbox" name="sbs" value="1" onclick="clickSBS1(this)" <?php if ((isset($_COOKIE['ShowSBS1']) && $_COOKIE['ShowSBS1'] == 'true') || !isset($_COOKIE['ShowSBS1'])) print 'checked'; ?> ><?php echo _("Display ADS-B data"); ?></label></div></li>
527 527
 			<?php } ?>
@@ -530,7 +530,7 @@  discard block
 block discarded – undo
530 530
 			<?php } ?>
531 531
 		    <?php
532 532
 			}
533
-		    ?>
533
+			?>
534 534
 		    <li><?php echo _("Display airlines:"); ?>
535 535
 		    <br/>
536 536
 			<select class="selectpicker" multiple onchange="airlines(this);" id="display_airlines">
@@ -550,14 +550,14 @@  discard block
 block discarded – undo
550 550
 						echo '<option value="'.$airline['airline_icao'].'">'.$airline_name.'</option>';
551 551
 					}
552 552
 				}
553
-			    ?>
553
+				?>
554 554
 			</select>
555 555
 		    </li>
556 556
 		    <?php
557 557
 			$Spotter = new Spotter();
558 558
 			$allalliancenames = $Spotter->getAllAllianceNames();
559 559
 			if (!empty($allalliancenames)) {
560
-		    ?>
560
+			?>
561 561
 		    <li><?php echo _("Display alliance:"); ?>
562 562
 		    <br/>
563 563
 			<select class="selectpicker" onchange="alliance(this);" id="display_alliance">
@@ -571,18 +571,18 @@  discard block
 block discarded – undo
571 571
 						echo '<option value="'.$alliance_name.'">'.$alliance_name.'</option>';
572 572
 					}
573 573
 				}
574
-			    ?>
574
+				?>
575 575
 			</select>
576 576
 		    </li>
577 577
 		    <?php
578 578
 			}
579
-		    ?>
579
+			?>
580 580
 		    <?php
581 581
 			}
582
-		    ?>
582
+			?>
583 583
 		    <?php
584 584
 			if (isset($globalAPRS) && $globalAPRS) {
585
-		    ?>
585
+			?>
586 586
 		    <li><?php echo _("Display APRS sources name:"); ?>
587 587
 			<select class="selectpicker" multiple onchange="sources(this);">
588 588
 			    <?php
@@ -607,18 +607,18 @@  discard block
 block discarded – undo
607 607
 					}                                
608 608
 				}
609 609
 				
610
-			    ?>
610
+				?>
611 611
 			</select>
612 612
 		    </li>
613 613
 		    <?php
614 614
 			}
615
-		    ?>
615
+			?>
616 616
 		    <?php
617 617
 			if (!isset($globalAircraft) && $globalAircraft) {
618
-		    ?>
618
+			?>
619 619
 		    <?php
620 620
 			if (!(isset($globalVATSIM) && $globalVATSIM) && !(isset($globalIVAO) && $globalIVAO) && !(isset($globalphpVMS) && $globalphpVMS)) {
621
-		    ?>
621
+			?>
622 622
 		    <li><?php echo _("Display airlines of type:"); ?><br/>
623 623
 			<select class="selectpicker" onchange="airlinestype(this);">
624 624
 			    <option value="all"<?php if (!isset($_COOKIE['filter_airlinestype']) || $_COOKIE['filter_airlinestype'] == 'all' || $_COOKIE['filter_airlinestype'] == '') echo ' selected'; ?>><?php echo _("All"); ?></option>
@@ -629,14 +629,14 @@  discard block
 block discarded – undo
629 629
 		    </li>
630 630
 		    <?php
631 631
 			}
632
-		    ?>
632
+			?>
633 633
 		    <li>
634 634
 			<?php echo _("Display flight with ident:"); ?>
635 635
 			<input type="text" name="identfilter" onchange="identfilter();" id="identfilter" value="<?php if (isset($_COOKIE['filter_ident'])) print $_COOKIE['filter_ident']; ?>" />
636 636
 		    </li>
637 637
 		    <?php
638 638
 			}
639
-		    ?>
639
+			?>
640 640
 		</ul>
641 641
 	    </form>
642 642
 	    <form method="post">
@@ -645,7 +645,7 @@  discard block
 block discarded – undo
645 645
 	    </form>
646 646
     	</div>
647 647
 <?php
648
-    if (isset($globalSatellite) && $globalSatellite) {
648
+	if (isset($globalSatellite) && $globalSatellite) {
649 649
 ?>
650 650
         <div class="sidebar-pane" id="satellites">
651 651
 	    <h1 class="sidebar-header"><?php echo _("Satellites"); ?><span class="sidebar-close"><i class="fa fa-caret-left"></i></span></h1>
@@ -685,14 +685,14 @@  discard block
 block discarded – undo
685 685
 						print '<option value="'.$type['tle_type'].'">'.$type_name.'</option>';
686 686
 					}
687 687
 				}
688
-			    ?>
688
+				?>
689 689
 			</select>
690 690
 		    </li>
691 691
 		</ul>
692 692
 	    </form>
693 693
 	</div>
694 694
 <?php
695
-    }
695
+	}
696 696
 ?>
697 697
     </div>
698 698
 </div>
Please login to merge, or discard this patch.