Completed
Push — master ( 7b2761...d4dde6 )
by Yannick
29:28
created
require/class.TrackerArchive.php 4 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -14,7 +14,7 @@
 block discarded – undo
14 14
 	/**
15 15
 	* Get SQL query part for filter used
16 16
 	* @param Array $filter the filter
17
-	* @return Array the SQL part
17
+	* @return string the SQL part
18 18
 	*/
19 19
 	public function getFilter($filter = array(),$where = false,$and = false) {
20 20
 		global $globalFilter, $globalStatsFilters, $globalFilterName, $globalDBdriver;
Please login to merge, or discard this patch.
Indentation   +593 added lines, -593 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,188 +153,188 @@  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 339
 	public function deleteTrackerArchiveTrackData()
340 340
 	{
@@ -354,34 +354,34 @@  discard block
 block discarded – undo
354 354
 	}
355 355
 
356 356
 	/**
357
-        * Gets Minimal Live Tracker data
358
-        *
359
-        * @return Array the spotter information
360
-        *
361
-        */
362
-        public function getMinLiveTrackerData($begindate,$enddate,$filter = array())
363
-        {
364
-                global $globalDBdriver, $globalLiveInterval;
365
-                date_default_timezone_set('UTC');
366
-
367
-                $filter_query = '';
368
-                if (isset($filter['source']) && !empty($filter['source'])) {
369
-                        $filter_query .= " AND format_source IN ('".implode("','",$filter['source'])."') ";
370
-                }
371
-                // Use spotter_output also ?
372
-                if (isset($filter['airlines']) && !empty($filter['airlines'])) {
373
-                        $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 ";
374
-                }
375
-                if (isset($filter['airlinestype']) && !empty($filter['airlinestype'])) {
376
-                        $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 ";
377
-                }
378
-                if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) {
379
-                        $filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')";
380
-                }
357
+	 * Gets Minimal Live Tracker data
358
+	 *
359
+	 * @return Array the spotter information
360
+	 *
361
+	 */
362
+		public function getMinLiveTrackerData($begindate,$enddate,$filter = array())
363
+		{
364
+				global $globalDBdriver, $globalLiveInterval;
365
+				date_default_timezone_set('UTC');
381 366
 
382
-                //if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
383
-                if ($globalDBdriver == 'mysql') {
384
-                        /*
367
+				$filter_query = '';
368
+				if (isset($filter['source']) && !empty($filter['source'])) {
369
+						$filter_query .= " AND format_source IN ('".implode("','",$filter['source'])."') ";
370
+				}
371
+				// Use spotter_output also ?
372
+				if (isset($filter['airlines']) && !empty($filter['airlines'])) {
373
+						$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 ";
374
+				}
375
+				if (isset($filter['airlinestype']) && !empty($filter['airlinestype'])) {
376
+						$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 ";
377
+				}
378
+				if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) {
379
+						$filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')";
380
+				}
381
+
382
+				//if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
383
+				if ($globalDBdriver == 'mysql') {
384
+						/*
385 385
                         $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 
386 386
                     		    FROM tracker_archive 
387 387
                     		    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';
@@ -400,56 +400,56 @@  discard block
 block discarded – undo
400 400
 				    INNER JOIN (SELECT * FROM aircraft) a on tracker_archive.aircraft_icao = a.icao
401 401
 				    WHERE tracker_archive.date BETWEEN '."'".$begindate."'".' AND '."'".$begindate."'".' 
402 402
                         	    '.$filter_query.' ORDER BY famtrackid';
403
-                } else {
404
-                        //$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';
405
-                        $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
+				} else {
404
+						//$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';
405
+						$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 
406 406
                         	    FROM tracker_archive 
407 407
                         	    INNER JOIN (SELECT * FROM aircraft) a on tracker_archive.aircraft_icao = a.icao
408 408
                         	    WHERE tracker_archive.date >= '."'".$begindate."'".' AND tracker_archive.date <= '."'".$enddate."'".'
409 409
                         	    '.$filter_query.' ORDER BY famtrackid';
410
-                }
411
-                //echo $query;
412
-                try {
413
-                        $sth = $this->db->prepare($query);
414
-                        $sth->execute();
415
-                } catch(PDOException $e) {
416
-                        echo $e->getMessage();
417
-                        die;
418
-                }
419
-                $spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC);
410
+				}
411
+				//echo $query;
412
+				try {
413
+						$sth = $this->db->prepare($query);
414
+						$sth->execute();
415
+				} catch(PDOException $e) {
416
+						echo $e->getMessage();
417
+						die;
418
+				}
419
+				$spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC);
420 420
 
421
-                return $spotter_array;
422
-        }
421
+				return $spotter_array;
422
+		}
423 423
 
424 424
 	/**
425
-        * Gets Minimal Live Tracker data
426
-        *
427
-        * @return Array the spotter information
428
-        *
429
-        */
430
-        public function getMinLiveTrackerDataPlayback($begindate,$enddate,$filter = array())
431
-        {
432
-                global $globalDBdriver, $globalLiveInterval;
433
-                date_default_timezone_set('UTC');
434
-
435
-                $filter_query = '';
436
-                if (isset($filter['source']) && !empty($filter['source'])) {
437
-                        $filter_query .= " AND format_source IN ('".implode("','",$filter['source'])."') ";
438
-                }
439
-                // Should use spotter_output also ?
440
-                if (isset($filter['airlines']) && !empty($filter['airlines'])) {
441
-                        $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 ";
442
-                }
443
-                if (isset($filter['airlinestype']) && !empty($filter['airlinestype'])) {
444
-                        $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 ";
445
-                }
446
-                if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) {
447
-                        $filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')";
448
-                }
425
+	 * Gets Minimal Live Tracker data
426
+	 *
427
+	 * @return Array the spotter information
428
+	 *
429
+	 */
430
+		public function getMinLiveTrackerDataPlayback($begindate,$enddate,$filter = array())
431
+		{
432
+				global $globalDBdriver, $globalLiveInterval;
433
+				date_default_timezone_set('UTC');
434
+
435
+				$filter_query = '';
436
+				if (isset($filter['source']) && !empty($filter['source'])) {
437
+						$filter_query .= " AND format_source IN ('".implode("','",$filter['source'])."') ";
438
+				}
439
+				// Should use spotter_output also ?
440
+				if (isset($filter['airlines']) && !empty($filter['airlines'])) {
441
+						$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 ";
442
+				}
443
+				if (isset($filter['airlinestype']) && !empty($filter['airlinestype'])) {
444
+						$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 ";
445
+				}
446
+				if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) {
447
+						$filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')";
448
+				}
449 449
 
450
-                //if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
451
-                if ($globalDBdriver == 'mysql') {
452
-                        /*
450
+				//if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
451
+				if ($globalDBdriver == 'mysql') {
452
+						/*
453 453
                         $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 
454 454
                     		    FROM tracker_archive 
455 455
                     		    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';
@@ -460,95 +460,95 @@  discard block
 block discarded – undo
460 460
 				    WHERE (tracker_archive_output.date BETWEEN '."'".$begindate."'".' AND '."'".$enddate."'".') 
461 461
                         	    '.$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';
462 462
 
463
-                } else {
464
-                        //$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';
465
-                       /*
463
+				} else {
464
+						//$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';
465
+					   /*
466 466
                         $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
467 467
                         	    FROM tracker_archive_output 
468 468
                         	    INNER JOIN (SELECT * FROM aircraft) a on tracker_archive_output.aircraft_icao = a.icao
469 469
                         	    WHERE tracker_archive_output.date >= '."'".$begindate."'".' AND tracker_archive_output.date <= '."'".$enddate."'".'
470 470
                         	    '.$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';
471 471
                         */
472
-                        $query  = 'SELECT DISTINCT tracker_archive_output.famtrackid, tracker_archive_output.ident, tracker_archive_output.aircraft_icao, tracker_archive_output.departure_airport_icao as departure_airport, tracker_archive_output.arrival_airport_icao as arrival_airport, tracker_archive_output.latitude, tracker_archive_output.longitude, tracker_archive_output.altitude, tracker_archive_output.heading, tracker_archive_output.ground_speed, tracker_archive_output.squawk, a.aircraft_shadow
472
+						$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
473 473
                         	    FROM tracker_archive_output 
474 474
                         	    INNER JOIN (SELECT * FROM aircraft) a on tracker_archive_output.aircraft_icao = a.icao
475 475
                         	    WHERE tracker_archive_output.date >= '."'".$begindate."'".' AND tracker_archive_output.date <= '."'".$enddate."'".'
476 476
                         	    '.$filter_query.' LIMIT 200 OFFSET 0';
477 477
 //                        	    .' 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';
478 478
                         	    
479
-                }
480
-                //echo $query;
481
-                try {
482
-                        $sth = $this->db->prepare($query);
483
-                        $sth->execute();
484
-                } catch(PDOException $e) {
485
-                        echo $e->getMessage();
486
-                        die;
487
-                }
488
-                $spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC);
479
+				}
480
+				//echo $query;
481
+				try {
482
+						$sth = $this->db->prepare($query);
483
+						$sth->execute();
484
+				} catch(PDOException $e) {
485
+						echo $e->getMessage();
486
+						die;
487
+				}
488
+				$spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC);
489 489
 
490
-                return $spotter_array;
491
-        }
490
+				return $spotter_array;
491
+		}
492 492
 
493 493
 	 /**
494
-        * Gets count Live Tracker data
495
-        *
496
-        * @return Array the spotter information
497
-        *
498
-        */
499
-        public function getLiveTrackerCount($begindate,$enddate,$filter = array())
500
-        {
501
-                global $globalDBdriver, $globalLiveInterval;
502
-                date_default_timezone_set('UTC');
503
-
504
-                $filter_query = '';
505
-                if (isset($filter['source']) && !empty($filter['source'])) {
506
-                        $filter_query .= " AND format_source IN ('".implode("','",$filter['source'])."') ";
507
-                }
508
-                if (isset($filter['airlines']) && !empty($filter['airlines'])) {
509
-                        $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 ";
510
-                }
511
-                if (isset($filter['airlinestype']) && !empty($filter['airlinestype'])) {
512
-                        $filter_query .= " INNER JOIN (SELECT famtrackid FROM spotter_output WHERE spotter_output.airline_type = '".$filter['airlinestype']."') sa ON sa.famtrackid = tracker_archive.famtrackid ";
513
-                }
514
-                if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) {
515
-                        $filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')";
516
-                }
494
+	  * Gets count Live Tracker data
495
+	  *
496
+	  * @return Array the spotter information
497
+	  *
498
+	  */
499
+		public function getLiveTrackerCount($begindate,$enddate,$filter = array())
500
+		{
501
+				global $globalDBdriver, $globalLiveInterval;
502
+				date_default_timezone_set('UTC');
517 503
 
518
-                //if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
519
-                if ($globalDBdriver == 'mysql') {
504
+				$filter_query = '';
505
+				if (isset($filter['source']) && !empty($filter['source'])) {
506
+						$filter_query .= " AND format_source IN ('".implode("','",$filter['source'])."') ";
507
+				}
508
+				if (isset($filter['airlines']) && !empty($filter['airlines'])) {
509
+						$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 ";
510
+				}
511
+				if (isset($filter['airlinestype']) && !empty($filter['airlinestype'])) {
512
+						$filter_query .= " INNER JOIN (SELECT famtrackid FROM spotter_output WHERE spotter_output.airline_type = '".$filter['airlinestype']."') sa ON sa.famtrackid = tracker_archive.famtrackid ";
513
+				}
514
+				if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) {
515
+						$filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')";
516
+				}
517
+
518
+				//if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
519
+				if ($globalDBdriver == 'mysql') {
520 520
 			$query = 'SELECT COUNT(DISTINCT famtrackid) as nb 
521 521
 			FROM tracker_archive l 
522 522
 			WHERE (l.date BETWEEN DATE_SUB('."'".$begindate."'".',INTERVAL '.$globalLiveInterval.' SECOND) AND '."'".$begindate."'".')'.$filter_query;
523
-                } else {
523
+				} else {
524 524
 			$query = 'SELECT COUNT(DISTINCT famtrackid) as nb FROM tracker_archive l WHERE (l.date BETWEEN '."'".$begindate."' - INTERVAL '".$globalLiveInterval." SECONDS' AND "."'".$enddate."'".')'.$filter_query;
525
-                }
526
-                //echo $query;
527
-                try {
528
-                        $sth = $this->db->prepare($query);
529
-                        $sth->execute();
530
-                } catch(PDOException $e) {
531
-                        echo $e->getMessage();
532
-                        die;
533
-                }
525
+				}
526
+				//echo $query;
527
+				try {
528
+						$sth = $this->db->prepare($query);
529
+						$sth->execute();
530
+				} catch(PDOException $e) {
531
+						echo $e->getMessage();
532
+						die;
533
+				}
534 534
 		$result = $sth->fetch(PDO::FETCH_ASSOC);
535 535
 		$sth->closeCursor();
536
-                return $result['nb'];
536
+				return $result['nb'];
537 537
 
538
-        }
538
+		}
539 539
 
540 540
 
541 541
 
542 542
 	// tracker_archive_output
543 543
 	
544
-    /**
545
-    * Gets all the spotter information
546
-    *
547
-    * @return Array the spotter information
548
-    *
549
-    */
550
-    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())
551
-    {
544
+	/**
545
+	 * Gets all the spotter information
546
+	 *
547
+	 * @return Array the spotter information
548
+	 *
549
+	 */
550
+	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())
551
+	{
552 552
 	global $globalTimezone, $globalDBdriver;
553 553
 	require_once(dirname(__FILE__).'/class.Translation.php');
554 554
 	$Translation = new Translation($this->db);
@@ -562,159 +562,159 @@  discard block
 block discarded – undo
562 562
 	$filter_query = $this->getFilter($filters);
563 563
 	if ($q != "")
564 564
 	{
565
-	    if (!is_string($q))
566
-	    {
565
+		if (!is_string($q))
566
+		{
567 567
 		return false;
568
-	    } else {
568
+		} else {
569 569
 	        
570 570
 		$q_array = explode(" ", $q);
571 571
 		
572 572
 		foreach ($q_array as $q_item){
573
-		    $additional_query .= " AND (";
574
-		    $additional_query .= "(tracker_archive_output.spotter_id like '%".$q_item."%') OR ";
575
-		    $additional_query .= "(tracker_archive_output.aircraft_icao like '%".$q_item."%') OR ";
576
-		    $additional_query .= "(tracker_archive_output.aircraft_name like '%".$q_item."%') OR ";
577
-		    $additional_query .= "(tracker_archive_output.aircraft_manufacturer like '%".$q_item."%') OR ";
578
-		    $additional_query .= "(tracker_archive_output.airline_icao like '%".$q_item."%') OR ";
579
-		    $additional_query .= "(tracker_archive_output.airline_name like '%".$q_item."%') OR ";
580
-		    $additional_query .= "(tracker_archive_output.airline_country like '%".$q_item."%') OR ";
581
-		    $additional_query .= "(tracker_archive_output.departure_airport_icao like '%".$q_item."%') OR ";
582
-		    $additional_query .= "(tracker_archive_output.departure_airport_name like '%".$q_item."%') OR ";
583
-		    $additional_query .= "(tracker_archive_output.departure_airport_city like '%".$q_item."%') OR ";
584
-		    $additional_query .= "(tracker_archive_output.departure_airport_country like '%".$q_item."%') OR ";
585
-		    $additional_query .= "(tracker_archive_output.arrival_airport_icao like '%".$q_item."%') OR ";
586
-		    $additional_query .= "(tracker_archive_output.arrival_airport_name like '%".$q_item."%') OR ";
587
-		    $additional_query .= "(tracker_archive_output.arrival_airport_city like '%".$q_item."%') OR ";
588
-		    $additional_query .= "(tracker_archive_output.arrival_airport_country like '%".$q_item."%') OR ";
589
-		    $additional_query .= "(tracker_archive_output.registration like '%".$q_item."%') OR ";
590
-		    $additional_query .= "(tracker_archive_output.owner_name like '%".$q_item."%') OR ";
591
-		    $additional_query .= "(tracker_archive_output.pilot_id like '%".$q_item."%') OR ";
592
-		    $additional_query .= "(tracker_archive_output.pilot_name like '%".$q_item."%') OR ";
593
-		    $additional_query .= "(tracker_archive_output.ident like '%".$q_item."%') OR ";
594
-		    $translate = $Translation->ident2icao($q_item);
595
-		    if ($translate != $q_item) $additional_query .= "(tracker_archive_output.ident like '%".$translate."%') OR ";
596
-		    $additional_query .= "(tracker_archive_output.highlight like '%".$q_item."%')";
597
-		    $additional_query .= ")";
573
+			$additional_query .= " AND (";
574
+			$additional_query .= "(tracker_archive_output.spotter_id like '%".$q_item."%') OR ";
575
+			$additional_query .= "(tracker_archive_output.aircraft_icao like '%".$q_item."%') OR ";
576
+			$additional_query .= "(tracker_archive_output.aircraft_name like '%".$q_item."%') OR ";
577
+			$additional_query .= "(tracker_archive_output.aircraft_manufacturer like '%".$q_item."%') OR ";
578
+			$additional_query .= "(tracker_archive_output.airline_icao like '%".$q_item."%') OR ";
579
+			$additional_query .= "(tracker_archive_output.airline_name like '%".$q_item."%') OR ";
580
+			$additional_query .= "(tracker_archive_output.airline_country like '%".$q_item."%') OR ";
581
+			$additional_query .= "(tracker_archive_output.departure_airport_icao like '%".$q_item."%') OR ";
582
+			$additional_query .= "(tracker_archive_output.departure_airport_name like '%".$q_item."%') OR ";
583
+			$additional_query .= "(tracker_archive_output.departure_airport_city like '%".$q_item."%') OR ";
584
+			$additional_query .= "(tracker_archive_output.departure_airport_country like '%".$q_item."%') OR ";
585
+			$additional_query .= "(tracker_archive_output.arrival_airport_icao like '%".$q_item."%') OR ";
586
+			$additional_query .= "(tracker_archive_output.arrival_airport_name like '%".$q_item."%') OR ";
587
+			$additional_query .= "(tracker_archive_output.arrival_airport_city like '%".$q_item."%') OR ";
588
+			$additional_query .= "(tracker_archive_output.arrival_airport_country like '%".$q_item."%') OR ";
589
+			$additional_query .= "(tracker_archive_output.registration like '%".$q_item."%') OR ";
590
+			$additional_query .= "(tracker_archive_output.owner_name like '%".$q_item."%') OR ";
591
+			$additional_query .= "(tracker_archive_output.pilot_id like '%".$q_item."%') OR ";
592
+			$additional_query .= "(tracker_archive_output.pilot_name like '%".$q_item."%') OR ";
593
+			$additional_query .= "(tracker_archive_output.ident like '%".$q_item."%') OR ";
594
+			$translate = $Translation->ident2icao($q_item);
595
+			if ($translate != $q_item) $additional_query .= "(tracker_archive_output.ident like '%".$translate."%') OR ";
596
+			$additional_query .= "(tracker_archive_output.highlight like '%".$q_item."%')";
597
+			$additional_query .= ")";
598
+		}
598 599
 		}
599
-	    }
600 600
 	}
601 601
 	
602 602
 	if ($registration != "")
603 603
 	{
604
-	    $registration = filter_var($registration,FILTER_SANITIZE_STRING);
605
-	    if (!is_string($registration))
606
-	    {
604
+		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
605
+		if (!is_string($registration))
606
+		{
607 607
 		return false;
608
-	    } else {
608
+		} else {
609 609
 		$additional_query .= " AND (tracker_archive_output.registration = '".$registration."')";
610
-	    }
610
+		}
611 611
 	}
612 612
 	
613 613
 	if ($aircraft_icao != "")
614 614
 	{
615
-	    $aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
616
-	    if (!is_string($aircraft_icao))
617
-	    {
615
+		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
616
+		if (!is_string($aircraft_icao))
617
+		{
618 618
 		return false;
619
-	    } else {
619
+		} else {
620 620
 		$additional_query .= " AND (tracker_archive_output.aircraft_icao = '".$aircraft_icao."')";
621
-	    }
621
+		}
622 622
 	}
623 623
 	
624 624
 	if ($aircraft_manufacturer != "")
625 625
 	{
626
-	    $aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
627
-	    if (!is_string($aircraft_manufacturer))
628
-	    {
626
+		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
627
+		if (!is_string($aircraft_manufacturer))
628
+		{
629 629
 		return false;
630
-	    } else {
630
+		} else {
631 631
 		$additional_query .= " AND (tracker_archive_output.aircraft_manufacturer = '".$aircraft_manufacturer."')";
632
-	    }
632
+		}
633 633
 	}
634 634
 	
635 635
 	if ($highlights == "true")
636 636
 	{
637
-	    if (!is_string($highlights))
638
-	    {
637
+		if (!is_string($highlights))
638
+		{
639 639
 		return false;
640
-	    } else {
640
+		} else {
641 641
 		$additional_query .= " AND (tracker_archive_output.highlight <> '')";
642
-	    }
642
+		}
643 643
 	}
644 644
 	
645 645
 	if ($airline_icao != "")
646 646
 	{
647
-	    $airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
648
-	    if (!is_string($airline_icao))
649
-	    {
647
+		$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
648
+		if (!is_string($airline_icao))
649
+		{
650 650
 		return false;
651
-	    } else {
651
+		} else {
652 652
 		$additional_query .= " AND (tracker_archive_output.airline_icao = '".$airline_icao."')";
653
-	    }
653
+		}
654 654
 	}
655 655
 	
656 656
 	if ($airline_country != "")
657 657
 	{
658
-	    $airline_country = filter_var($airline_country,FILTER_SANITIZE_STRING);
659
-	    if (!is_string($airline_country))
660
-	    {
658
+		$airline_country = filter_var($airline_country,FILTER_SANITIZE_STRING);
659
+		if (!is_string($airline_country))
660
+		{
661 661
 		return false;
662
-	    } else {
662
+		} else {
663 663
 		$additional_query .= " AND (tracker_archive_output.airline_country = '".$airline_country."')";
664
-	    }
664
+		}
665 665
 	}
666 666
 	
667 667
 	if ($airline_type != "")
668 668
 	{
669
-	    $airline_type = filter_var($airline_type,FILTER_SANITIZE_STRING);
670
-	    if (!is_string($airline_type))
671
-	    {
669
+		$airline_type = filter_var($airline_type,FILTER_SANITIZE_STRING);
670
+		if (!is_string($airline_type))
671
+		{
672 672
 		return false;
673
-	    } else {
673
+		} else {
674 674
 		if ($airline_type == "passenger")
675 675
 		{
676
-		    $additional_query .= " AND (tracker_archive_output.airline_type = 'passenger')";
676
+			$additional_query .= " AND (tracker_archive_output.airline_type = 'passenger')";
677 677
 		}
678 678
 		if ($airline_type == "cargo")
679 679
 		{
680
-		    $additional_query .= " AND (tracker_archive_output.airline_type = 'cargo')";
680
+			$additional_query .= " AND (tracker_archive_output.airline_type = 'cargo')";
681 681
 		}
682 682
 		if ($airline_type == "military")
683 683
 		{
684
-		    $additional_query .= " AND (tracker_archive_output.airline_type = 'military')";
684
+			$additional_query .= " AND (tracker_archive_output.airline_type = 'military')";
685
+		}
685 686
 		}
686
-	    }
687 687
 	}
688 688
 	
689 689
 	if ($airport != "")
690 690
 	{
691
-	    $airport = filter_var($airport,FILTER_SANITIZE_STRING);
692
-	    if (!is_string($airport))
693
-	    {
691
+		$airport = filter_var($airport,FILTER_SANITIZE_STRING);
692
+		if (!is_string($airport))
693
+		{
694 694
 		return false;
695
-	    } else {
695
+		} else {
696 696
 		$additional_query .= " AND ((tracker_archive_output.departure_airport_icao = '".$airport."') OR (tracker_archive_output.arrival_airport_icao = '".$airport."'))";
697
-	    }
697
+		}
698 698
 	}
699 699
 	
700 700
 	if ($airport_country != "")
701 701
 	{
702
-	    $airport_country = filter_var($airport_country,FILTER_SANITIZE_STRING);
703
-	    if (!is_string($airport_country))
704
-	    {
702
+		$airport_country = filter_var($airport_country,FILTER_SANITIZE_STRING);
703
+		if (!is_string($airport_country))
704
+		{
705 705
 		return false;
706
-	    } else {
706
+		} else {
707 707
 		$additional_query .= " AND ((tracker_archive_output.departure_airport_country = '".$airport_country."') OR (tracker_archive_output.arrival_airport_country = '".$airport_country."'))";
708
-	    }
708
+		}
709 709
 	}
710 710
     
711 711
 	if ($callsign != "")
712 712
 	{
713
-	    $callsign = filter_var($callsign,FILTER_SANITIZE_STRING);
714
-	    if (!is_string($callsign))
715
-	    {
713
+		$callsign = filter_var($callsign,FILTER_SANITIZE_STRING);
714
+		if (!is_string($callsign))
715
+		{
716 716
 		return false;
717
-	    } else {
717
+		} else {
718 718
 		$translate = $Translation->ident2icao($callsign);
719 719
 		if ($translate != $callsign) {
720 720
 			$additional_query .= " AND (tracker_archive_output.ident = :callsign OR tracker_archive_output.ident = :translate)";
@@ -722,99 +722,99 @@  discard block
 block discarded – undo
722 722
 		} else {
723 723
 			$additional_query .= " AND (tracker_archive_output.ident = '".$callsign."')";
724 724
 		}
725
-	    }
725
+		}
726 726
 	}
727 727
 
728 728
 	if ($owner != "")
729 729
 	{
730
-	    $owner = filter_var($owner,FILTER_SANITIZE_STRING);
731
-	    if (!is_string($owner))
732
-	    {
730
+		$owner = filter_var($owner,FILTER_SANITIZE_STRING);
731
+		if (!is_string($owner))
732
+		{
733 733
 		return false;
734
-	    } else {
734
+		} else {
735 735
 		$additional_query .= " AND (tracker_archive_output.owner_name = '".$owner."')";
736
-	    }
736
+		}
737 737
 	}
738 738
 
739 739
 	if ($pilot_name != "")
740 740
 	{
741
-	    $pilot_name = filter_var($pilot_name,FILTER_SANITIZE_STRING);
742
-	    if (!is_string($pilot_name))
743
-	    {
741
+		$pilot_name = filter_var($pilot_name,FILTER_SANITIZE_STRING);
742
+		if (!is_string($pilot_name))
743
+		{
744 744
 		return false;
745
-	    } else {
745
+		} else {
746 746
 		$additional_query .= " AND (tracker_archive_output.pilot_name = '".$pilot_name."')";
747
-	    }
747
+		}
748 748
 	}
749 749
 	
750 750
 	if ($pilot_id != "")
751 751
 	{
752
-	    $pilot_id = filter_var($pilot_id,FILTER_SANITIZE_NUMBER_INT);
753
-	    if (!is_string($pilot_id))
754
-	    {
752
+		$pilot_id = filter_var($pilot_id,FILTER_SANITIZE_NUMBER_INT);
753
+		if (!is_string($pilot_id))
754
+		{
755 755
 		return false;
756
-	    } else {
756
+		} else {
757 757
 		$additional_query .= " AND (tracker_archive_output.pilot_id = '".$pilot_id."')";
758
-	    }
758
+		}
759 759
 	}
760 760
 	
761 761
 	if ($departure_airport_route != "")
762 762
 	{
763
-	    $departure_airport_route = filter_var($departure_airport_route,FILTER_SANITIZE_STRING);
764
-	    if (!is_string($departure_airport_route))
765
-	    {
763
+		$departure_airport_route = filter_var($departure_airport_route,FILTER_SANITIZE_STRING);
764
+		if (!is_string($departure_airport_route))
765
+		{
766 766
 		return false;
767
-	    } else {
767
+		} else {
768 768
 		$additional_query .= " AND (tracker_archive_output.departure_airport_icao = '".$departure_airport_route."')";
769
-	    }
769
+		}
770 770
 	}
771 771
 	
772 772
 	if ($arrival_airport_route != "")
773 773
 	{
774
-	    $arrival_airport_route = filter_var($arrival_airport_route,FILTER_SANITIZE_STRING);
775
-	    if (!is_string($arrival_airport_route))
776
-	    {
774
+		$arrival_airport_route = filter_var($arrival_airport_route,FILTER_SANITIZE_STRING);
775
+		if (!is_string($arrival_airport_route))
776
+		{
777 777
 		return false;
778
-	    } else {
778
+		} else {
779 779
 		$additional_query .= " AND (tracker_archive_output.arrival_airport_icao = '".$arrival_airport_route."')";
780
-	    }
780
+		}
781 781
 	}
782 782
 	
783 783
 	if ($altitude != "")
784 784
 	{
785
-	    $altitude_array = explode(",", $altitude);
785
+		$altitude_array = explode(",", $altitude);
786 786
 	    
787
-	    $altitude_array[0] = filter_var($altitude_array[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
788
-	    $altitude_array[1] = filter_var($altitude_array[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
787
+		$altitude_array[0] = filter_var($altitude_array[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
788
+		$altitude_array[1] = filter_var($altitude_array[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
789 789
 	    
790 790
 
791
-	    if ($altitude_array[1] != "")
792
-	    {                
791
+		if ($altitude_array[1] != "")
792
+		{                
793 793
 		$altitude_array[0] = substr($altitude_array[0], 0, -2);
794 794
 		$altitude_array[1] = substr($altitude_array[1], 0, -2);
795 795
 		$additional_query .= " AND altitude BETWEEN '".$altitude_array[0]."' AND '".$altitude_array[1]."' ";
796
-	    } else {
796
+		} else {
797 797
 		$altitude_array[0] = substr($altitude_array[0], 0, -2);
798 798
 		$additional_query .= " AND altitude <= '".$altitude_array[0]."' ";
799
-	    }
799
+		}
800 800
 	}
801 801
 	
802 802
 	if ($date_posted != "")
803 803
 	{
804
-	    $date_array = explode(",", $date_posted);
804
+		$date_array = explode(",", $date_posted);
805 805
 	    
806
-	    $date_array[0] = filter_var($date_array[0],FILTER_SANITIZE_STRING);
807
-	    $date_array[1] = filter_var($date_array[1],FILTER_SANITIZE_STRING);
806
+		$date_array[0] = filter_var($date_array[0],FILTER_SANITIZE_STRING);
807
+		$date_array[1] = filter_var($date_array[1],FILTER_SANITIZE_STRING);
808 808
 	    
809
-	    if ($globalTimezone != '') {
809
+		if ($globalTimezone != '') {
810 810
 		date_default_timezone_set($globalTimezone);
811 811
 		$datetime = new DateTime();
812 812
 		$offset = $datetime->format('P');
813
-	    } else $offset = '+00:00';
813
+		} else $offset = '+00:00';
814 814
 
815 815
 
816
-	    if ($date_array[1] != "")
817
-	    {                
816
+		if ($date_array[1] != "")
817
+		{                
818 818
 		$date_array[0] = date("Y-m-d H:i:s", strtotime($date_array[0]));
819 819
 		$date_array[1] = date("Y-m-d H:i:s", strtotime($date_array[1]));
820 820
 		if ($globalDBdriver == 'mysql') {
@@ -822,28 +822,28 @@  discard block
 block discarded – undo
822 822
 		} else {
823 823
 			$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) ";
824 824
 		}
825
-	    } else {
825
+		} else {
826 826
 		$date_array[0] = date("Y-m-d H:i:s", strtotime($date_array[0]));
827
-                if ($globalDBdriver == 'mysql') {
827
+				if ($globalDBdriver == 'mysql') {
828 828
 			$additional_query .= " AND TIMESTAMP(CONVERT_TZ(tracker_archive_output.date,'+00:00', '".$offset."')) >= '".$date_array[0]."' ";
829 829
 		} else {
830 830
 			$additional_query .= " AND tracker_archive_output.date::timestamp AT TIME ZONE INTERVAL ".$offset." >= CAST('".$date_array[0]."' AS TIMESTAMP) ";
831 831
 		}
832
-	    }
832
+		}
833 833
 	}
834 834
 	
835 835
 	if ($limit != "")
836 836
 	{
837
-	    $limit_array = explode(",", $limit);
837
+		$limit_array = explode(",", $limit);
838 838
 	    
839
-	    $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
840
-	    $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
839
+		$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
840
+		$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
841 841
 	    
842
-	    if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
843
-	    {
842
+		if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
843
+		{
844 844
 		//$limit_query = " LIMIT ".$limit_array[0].",".$limit_array[1];
845 845
 		$limit_query = " LIMIT ".$limit_array[1]." OFFSET ".$limit_array[0];
846
-	    }
846
+		}
847 847
 	}
848 848
 	
849 849
 
@@ -874,33 +874,33 @@  discard block
 block discarded – undo
874 874
 	$spotter_array = $Tracker->getDataFromDB($query, $query_values,$limit_query);
875 875
 
876 876
 	return $spotter_array;
877
-    }
877
+	}
878 878
 
879
-    public function deleteTrackerArchiveData()
880
-    {
879
+	public function deleteTrackerArchiveData()
880
+	{
881 881
 		global $globalArchiveKeepMonths, $globalDBdriver;
882
-                date_default_timezone_set('UTC');
883
-                if ($globalDBdriver == 'mysql') {
882
+				date_default_timezone_set('UTC');
883
+				if ($globalDBdriver == 'mysql') {
884 884
 			$query = 'DELETE FROM tracker_archive_output WHERE tracker_archive_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$globalArchiveKeepMonths.' MONTH)';
885 885
 		} else {
886 886
 			$query = "DELETE FROM tracker_archive_output WHERE tracker_archive_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalArchiveKeepMonths." MONTH'";
887 887
 		}
888
-                try {
889
-                        $sth = $this->db->prepare($query);
890
-                        $sth->execute();
891
-                } catch(PDOException $e) {
892
-                        return "error";
893
-                }
888
+				try {
889
+						$sth = $this->db->prepare($query);
890
+						$sth->execute();
891
+				} catch(PDOException $e) {
892
+						return "error";
893
+				}
894 894
 	}
895 895
 
896
-    /**
897
-    * Gets all the spotter information based on the callsign
898
-    *
899
-    * @return Array the spotter information
900
-    *
901
-    */
902
-    public function getTrackerDataByIdent($ident = '', $limit = '', $sort = '')
903
-    {
896
+	/**
897
+	 * Gets all the spotter information based on the callsign
898
+	 *
899
+	 * @return Array the spotter information
900
+	 *
901
+	 */
902
+	public function getTrackerDataByIdent($ident = '', $limit = '', $sort = '')
903
+	{
904 904
 	$global_query = "SELECT tracker_archive_output.* FROM tracker_archive_output";
905 905
 	
906 906
 	date_default_timezone_set('UTC');
@@ -912,35 +912,35 @@  discard block
 block discarded – undo
912 912
 	
913 913
 	if ($ident != "")
914 914
 	{
915
-	    if (!is_string($ident))
916
-	    {
915
+		if (!is_string($ident))
916
+		{
917 917
 		return false;
918
-	    } else {
918
+		} else {
919 919
 		$additional_query = " AND (tracker_archive_output.ident = :ident)";
920 920
 		$query_values = array(':ident' => $ident);
921
-	    }
921
+		}
922 922
 	}
923 923
 	
924 924
 	if ($limit != "")
925 925
 	{
926
-	    $limit_array = explode(",", $limit);
926
+		$limit_array = explode(",", $limit);
927 927
 	    
928
-	    $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
929
-	    $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
928
+		$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
929
+		$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
930 930
 	    
931
-	    if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
932
-	    {
931
+		if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
932
+		{
933 933
 		//$limit_query = " LIMIT ".$limit_array[0].",".$limit_array[1];
934 934
 		$limit_query = " LIMIT ".$limit_array[1]." OFFSET ".$limit_array[0];
935
-	    }
935
+		}
936 936
 	}
937 937
 
938 938
 	if ($sort != "")
939 939
 	{
940
-	    $search_orderby_array = $Tracker->getOrderBy();
941
-	    $orderby_query = $search_orderby_array[$sort]['sql'];
940
+		$search_orderby_array = $Tracker->getOrderBy();
941
+		$orderby_query = $search_orderby_array[$sort]['sql'];
942 942
 	} else {
943
-	    $orderby_query = " ORDER BY tracker_archive_output.date DESC";
943
+		$orderby_query = " ORDER BY tracker_archive_output.date DESC";
944 944
 	}
945 945
 
946 946
 	$query = $global_query." WHERE tracker_archive_output.ident <> '' ".$additional_query." ".$orderby_query;
@@ -948,17 +948,17 @@  discard block
 block discarded – undo
948 948
 	$spotter_array = $Tracker->getDataFromDB($query, $query_values, $limit_query);
949 949
 
950 950
 	return $spotter_array;
951
-    }
951
+	}
952 952
 
953 953
 
954
-    /**
955
-    * Gets all the spotter information based on the owner
956
-    *
957
-    * @return Array the spotter information
958
-    *
959
-    */
960
-    public function getTrackerDataByOwner($owner = '', $limit = '', $sort = '', $filter = array())
961
-    {
954
+	/**
955
+	 * Gets all the spotter information based on the owner
956
+	 *
957
+	 * @return Array the spotter information
958
+	 *
959
+	 */
960
+	public function getTrackerDataByOwner($owner = '', $limit = '', $sort = '', $filter = array())
961
+	{
962 962
 	$global_query = "SELECT tracker_archive_output.* FROM tracker_archive_output";
963 963
 	
964 964
 	date_default_timezone_set('UTC');
@@ -971,35 +971,35 @@  discard block
 block discarded – undo
971 971
 	
972 972
 	if ($owner != "")
973 973
 	{
974
-	    if (!is_string($owner))
975
-	    {
974
+		if (!is_string($owner))
975
+		{
976 976
 		return false;
977
-	    } else {
977
+		} else {
978 978
 		$additional_query = " AND (tracker_archive_output.owner_name = :owner)";
979 979
 		$query_values = array(':owner' => $owner);
980
-	    }
980
+		}
981 981
 	}
982 982
 	
983 983
 	if ($limit != "")
984 984
 	{
985
-	    $limit_array = explode(",", $limit);
985
+		$limit_array = explode(",", $limit);
986 986
 	    
987
-	    $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
988
-	    $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
987
+		$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
988
+		$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
989 989
 	    
990
-	    if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
991
-	    {
990
+		if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
991
+		{
992 992
 		//$limit_query = " LIMIT ".$limit_array[0].",".$limit_array[1];
993 993
 		$limit_query = " LIMIT ".$limit_array[1]." OFFSET ".$limit_array[0];
994
-	    }
994
+		}
995 995
 	}
996 996
 
997 997
 	if ($sort != "")
998 998
 	{
999
-	    $search_orderby_array = $Tracker->getOrderBy();
1000
-	    $orderby_query = $search_orderby_array[$sort]['sql'];
999
+		$search_orderby_array = $Tracker->getOrderBy();
1000
+		$orderby_query = $search_orderby_array[$sort]['sql'];
1001 1001
 	} else {
1002
-	    $orderby_query = " ORDER BY tracker_archive_output.date DESC";
1002
+		$orderby_query = " ORDER BY tracker_archive_output.date DESC";
1003 1003
 	}
1004 1004
 
1005 1005
 	$query = $global_query.$filter_query." tracker_archive_output.owner_name <> '' ".$additional_query." ".$orderby_query;
@@ -1007,16 +1007,16 @@  discard block
 block discarded – undo
1007 1007
 	$spotter_array = $Tracker->getDataFromDB($query, $query_values, $limit_query);
1008 1008
 
1009 1009
 	return $spotter_array;
1010
-    }
1011
-
1012
-    /**
1013
-    * Gets all the spotter information based on the pilot
1014
-    *
1015
-    * @return Array the spotter information
1016
-    *
1017
-    */
1018
-    public function getTrackerDataByPilot($pilot = '', $limit = '', $sort = '', $filter = array())
1019
-    {
1010
+	}
1011
+
1012
+	/**
1013
+	 * Gets all the spotter information based on the pilot
1014
+	 *
1015
+	 * @return Array the spotter information
1016
+	 *
1017
+	 */
1018
+	public function getTrackerDataByPilot($pilot = '', $limit = '', $sort = '', $filter = array())
1019
+	{
1020 1020
 	$global_query = "SELECT tracker_archive_output.* FROM tracker_archive_output";
1021 1021
 	
1022 1022
 	date_default_timezone_set('UTC');
@@ -1035,24 +1035,24 @@  discard block
 block discarded – undo
1035 1035
 	
1036 1036
 	if ($limit != "")
1037 1037
 	{
1038
-	    $limit_array = explode(",", $limit);
1038
+		$limit_array = explode(",", $limit);
1039 1039
 	    
1040
-	    $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1041
-	    $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1040
+		$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1041
+		$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1042 1042
 	    
1043
-	    if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1044
-	    {
1043
+		if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1044
+		{
1045 1045
 		//$limit_query = " LIMIT ".$limit_array[0].",".$limit_array[1];
1046 1046
 		$limit_query = " LIMIT ".$limit_array[1]." OFFSET ".$limit_array[0];
1047
-	    }
1047
+		}
1048 1048
 	}
1049 1049
 
1050 1050
 	if ($sort != "")
1051 1051
 	{
1052
-	    $search_orderby_array = $Tracker->getOrderBy();
1053
-	    $orderby_query = $search_orderby_array[$sort]['sql'];
1052
+		$search_orderby_array = $Tracker->getOrderBy();
1053
+		$orderby_query = $search_orderby_array[$sort]['sql'];
1054 1054
 	} else {
1055
-	    $orderby_query = " ORDER BY tracker_archive_output.date DESC";
1055
+		$orderby_query = " ORDER BY tracker_archive_output.date DESC";
1056 1056
 	}
1057 1057
 
1058 1058
 	$query = $global_query.$filter_query." tracker_archive_output.pilot_name <> '' ".$additional_query." ".$orderby_query;
@@ -1060,16 +1060,16 @@  discard block
 block discarded – undo
1060 1060
 	$spotter_array = $Tracker->getDataFromDB($query, $query_values, $limit_query);
1061 1061
 
1062 1062
 	return $spotter_array;
1063
-    }
1064
-
1065
-    /**
1066
-    * Gets all number of flight over countries
1067
-    *
1068
-    * @return Array the airline country list
1069
-    *
1070
-    */
1071
-    public function countAllFlightOverCountries($limit = true,$olderthanmonths = 0,$sincedate = '')
1072
-    {
1063
+	}
1064
+
1065
+	/**
1066
+	 * Gets all number of flight over countries
1067
+	 *
1068
+	 * @return Array the airline country list
1069
+	 *
1070
+	 */
1071
+	public function countAllFlightOverCountries($limit = true,$olderthanmonths = 0,$sincedate = '')
1072
+	{
1073 1073
 	global $globalDBdriver;
1074 1074
 	/*
1075 1075
 	$query = "SELECT c.name, c.iso3, c.iso2, count(c.name) as nb 
@@ -1079,14 +1079,14 @@  discard block
 block discarded – undo
1079 1079
 	$query = "SELECT c.name, c.iso3, c.iso2, count(c.name) as nb
1080 1080
 		    FROM countries c, tracker_archive s
1081 1081
 		    WHERE c.iso2 = s.over_country ";
1082
-                if ($olderthanmonths > 0) {
1083
-            		if ($globalDBdriver == 'mysql') {
1082
+				if ($olderthanmonths > 0) {
1083
+					if ($globalDBdriver == 'mysql') {
1084 1084
 				$query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
1085 1085
 			} else {
1086 1086
 				$query .= "AND date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
1087 1087
 			}
1088 1088
 		}
1089
-                if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
1089
+				if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
1090 1090
 	$query .= "GROUP BY c.name, c.iso3, c.iso2 ORDER BY nb DESC";
1091 1091
 	if ($limit) $query .= " LIMIT 0,10";
1092 1092
       
@@ -1099,23 +1099,23 @@  discard block
 block discarded – undo
1099 1099
         
1100 1100
 	while($row = $sth->fetch(PDO::FETCH_ASSOC))
1101 1101
 	{
1102
-	    $temp_array['flight_count'] = $row['nb'];
1103
-	    $temp_array['flight_country'] = $row['name'];
1104
-	    $temp_array['flight_country_iso3'] = $row['iso3'];
1105
-	    $temp_array['flight_country_iso2'] = $row['iso2'];
1106
-	    $flight_array[] = $temp_array;
1102
+		$temp_array['flight_count'] = $row['nb'];
1103
+		$temp_array['flight_country'] = $row['name'];
1104
+		$temp_array['flight_country_iso3'] = $row['iso3'];
1105
+		$temp_array['flight_country_iso2'] = $row['iso2'];
1106
+		$flight_array[] = $temp_array;
1107 1107
 	}
1108 1108
 	return $flight_array;
1109
-    }
1110
-
1111
-    /**
1112
-    * Gets all number of flight over countries
1113
-    *
1114
-    * @return Array the airline country list
1115
-    *
1116
-    */
1117
-    public function countAllFlightOverCountriesByAirlines($limit = true,$olderthanmonths = 0,$sincedate = '')
1118
-    {
1109
+	}
1110
+
1111
+	/**
1112
+	 * Gets all number of flight over countries
1113
+	 *
1114
+	 * @return Array the airline country list
1115
+	 *
1116
+	 */
1117
+	public function countAllFlightOverCountriesByAirlines($limit = true,$olderthanmonths = 0,$sincedate = '')
1118
+	{
1119 1119
 	global $globalDBdriver;
1120 1120
 	/*
1121 1121
 	$query = "SELECT c.name, c.iso3, c.iso2, count(c.name) as nb 
@@ -1125,14 +1125,14 @@  discard block
 block discarded – undo
1125 1125
 	$query = "SELECT o.airline_icao,c.name, c.iso3, c.iso2, count(c.name) as nb
1126 1126
 		    FROM countries c, tracker_archive s, spotter_output o
1127 1127
 		    WHERE c.iso2 = s.over_country AND o.airline_icao <> '' AND o.famtrackid = s.famtrackid ";
1128
-                if ($olderthanmonths > 0) {
1129
-            		if ($globalDBdriver == 'mysql') {
1128
+				if ($olderthanmonths > 0) {
1129
+					if ($globalDBdriver == 'mysql') {
1130 1130
 				$query .= 'AND s.date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
1131 1131
 			} else {
1132 1132
 				$query .= "AND s.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
1133 1133
 			}
1134 1134
 		}
1135
-                if ($sincedate != '') $query .= "AND s.date > '".$sincedate."' ";
1135
+				if ($sincedate != '') $query .= "AND s.date > '".$sincedate."' ";
1136 1136
 	$query .= "GROUP BY o.airline_icao,c.name, c.iso3, c.iso2 ORDER BY nb DESC";
1137 1137
 	if ($limit) $query .= " LIMIT 0,10";
1138 1138
       
@@ -1145,24 +1145,24 @@  discard block
 block discarded – undo
1145 1145
         
1146 1146
 	while($row = $sth->fetch(PDO::FETCH_ASSOC))
1147 1147
 	{
1148
-	    $temp_array['airline_icao'] = $row['airline_icao'];
1149
-	    $temp_array['flight_count'] = $row['nb'];
1150
-	    $temp_array['flight_country'] = $row['name'];
1151
-	    $temp_array['flight_country_iso3'] = $row['iso3'];
1152
-	    $temp_array['flight_country_iso2'] = $row['iso2'];
1153
-	    $flight_array[] = $temp_array;
1148
+		$temp_array['airline_icao'] = $row['airline_icao'];
1149
+		$temp_array['flight_count'] = $row['nb'];
1150
+		$temp_array['flight_country'] = $row['name'];
1151
+		$temp_array['flight_country_iso3'] = $row['iso3'];
1152
+		$temp_array['flight_country_iso2'] = $row['iso2'];
1153
+		$flight_array[] = $temp_array;
1154 1154
 	}
1155 1155
 	return $flight_array;
1156
-    }
1157
-
1158
-    /**
1159
-    * Gets last spotter information based on a particular callsign
1160
-    *
1161
-    * @return Array the spotter information
1162
-    *
1163
-    */
1164
-    public function getDateArchiveTrackerDataById($id,$date)
1165
-    {
1156
+	}
1157
+
1158
+	/**
1159
+	 * Gets last spotter information based on a particular callsign
1160
+	 *
1161
+	 * @return Array the spotter information
1162
+	 *
1163
+	 */
1164
+	public function getDateArchiveTrackerDataById($id,$date)
1165
+	{
1166 1166
 	$Tracker = new Tracker($this->db);
1167 1167
 	date_default_timezone_set('UTC');
1168 1168
 	$id = filter_var($id, FILTER_SANITIZE_STRING);
@@ -1170,16 +1170,16 @@  discard block
 block discarded – undo
1170 1170
 	$date = date('c',$date);
1171 1171
 	$spotter_array = $Tracker->getDataFromDB($query,array(':id' => $id,':date' => $date));
1172 1172
 	return $spotter_array;
1173
-    }
1174
-
1175
-    /**
1176
-    * Gets all the spotter information based on a particular callsign
1177
-    *
1178
-    * @return Array the spotter information
1179
-    *
1180
-    */
1181
-    public function getDateArchiveTrackerDataByIdent($ident,$date)
1182
-    {
1173
+	}
1174
+
1175
+	/**
1176
+	 * Gets all the spotter information based on a particular callsign
1177
+	 *
1178
+	 * @return Array the spotter information
1179
+	 *
1180
+	 */
1181
+	public function getDateArchiveTrackerDataByIdent($ident,$date)
1182
+	{
1183 1183
 	$Tracker = new Tracker($this->db);
1184 1184
 	date_default_timezone_set('UTC');
1185 1185
 	$ident = filter_var($ident, FILTER_SANITIZE_STRING);
@@ -1187,16 +1187,16 @@  discard block
 block discarded – undo
1187 1187
 	$date = date('c',$date);
1188 1188
 	$spotter_array = $Tracker->getDataFromDB($query,array(':ident' => $ident,':date' => $date));
1189 1189
 	return $spotter_array;
1190
-    }
1191
-
1192
-    /**
1193
-    * Gets all the spotter information based on the airport
1194
-    *
1195
-    * @return Array the spotter information
1196
-    *
1197
-    */
1198
-    public function getTrackerDataByAirport($airport = '', $limit = '', $sort = '',$filters = array())
1199
-    {
1190
+	}
1191
+
1192
+	/**
1193
+	 * Gets all the spotter information based on the airport
1194
+	 *
1195
+	 * @return Array the spotter information
1196
+	 *
1197
+	 */
1198
+	public function getTrackerDataByAirport($airport = '', $limit = '', $sort = '',$filters = array())
1199
+	{
1200 1200
 	global $global_query;
1201 1201
 	$Tracker = new Tracker($this->db);
1202 1202
 	date_default_timezone_set('UTC');
@@ -1207,35 +1207,35 @@  discard block
 block discarded – undo
1207 1207
 	
1208 1208
 	if ($airport != "")
1209 1209
 	{
1210
-	    if (!is_string($airport))
1211
-	    {
1210
+		if (!is_string($airport))
1211
+		{
1212 1212
 		return false;
1213
-	    } else {
1213
+		} else {
1214 1214
 		$additional_query .= " AND ((tracker_archive_output.departure_airport_icao = :airport) OR (tracker_archive_output.arrival_airport_icao = :airport))";
1215 1215
 		$query_values = array(':airport' => $airport);
1216
-	    }
1216
+		}
1217 1217
 	}
1218 1218
 	
1219 1219
 	if ($limit != "")
1220 1220
 	{
1221
-	    $limit_array = explode(",", $limit);
1221
+		$limit_array = explode(",", $limit);
1222 1222
 	    
1223
-	    $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1224
-	    $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1223
+		$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1224
+		$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1225 1225
 	    
1226
-	    if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1227
-	    {
1226
+		if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1227
+		{
1228 1228
 		//$limit_query = " LIMIT ".$limit_array[0].",".$limit_array[1];
1229 1229
 		$limit_query = " LIMIT ".$limit_array[1]." OFFSET ".$limit_array[0];
1230
-	    }
1230
+		}
1231 1231
 	}
1232 1232
 	
1233 1233
 	if ($sort != "")
1234 1234
 	{
1235
-	    $search_orderby_array = $Tracker->getOrderBy();
1236
-	    $orderby_query = $search_orderby_array[$sort]['sql'];
1235
+		$search_orderby_array = $Tracker->getOrderBy();
1236
+		$orderby_query = $search_orderby_array[$sort]['sql'];
1237 1237
 	} else {
1238
-	    $orderby_query = " ORDER BY tracker_archive_output.date DESC";
1238
+		$orderby_query = " ORDER BY tracker_archive_output.date DESC";
1239 1239
 	}
1240 1240
 
1241 1241
 	$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;
@@ -1243,6 +1243,6 @@  discard block
 block discarded – undo
1243 1243
 	$spotter_array = $Tracker->getDataFromDB($query, $query_values, $limit_query);
1244 1244
 
1245 1245
 	return $spotter_array;
1246
-    }
1246
+	}
1247 1247
 }
1248 1248
 ?>
1249 1249
\ No newline at end of file
Please login to merge, or discard this patch.
Braces   +37 added lines, -13 removed lines patch added patch discarded remove patch
@@ -6,7 +6,9 @@  discard block
 block discarded – undo
6 6
 	public function __construct($dbc = null) {
7 7
 		$Connection = new Connection($dbc);
8 8
 		$this->db = $Connection->db;
9
-		if ($this->db === null) die('Error: No DB connection. (TrackerArchive)');
9
+		if ($this->db === null) {
10
+			die('Error: No DB connection. (TrackerArchive)');
11
+		}
10 12
 	}
11 13
 
12 14
 	/**
@@ -27,7 +29,9 @@  discard block
 block discarded – undo
27 29
 		if (isset($filter[0]['source'])) {
28 30
 			$filters = array_merge($filters,$filter);
29 31
 		}
30
-		if (is_array($globalFilter)) $filter = array_merge($filter,$globalFilter);
32
+		if (is_array($globalFilter)) {
33
+			$filter = array_merge($filter,$globalFilter);
34
+		}
31 35
 		$filter_query_join = '';
32 36
 		$filter_query_where = '';
33 37
 		foreach($filters as $flt) {
@@ -73,8 +77,11 @@  discard block
 block discarded – undo
73 77
 		if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) {
74 78
 			$filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')";
75 79
 		}
76
-		if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE';
77
-		elseif ($filter_query_where != '' && $and) $filter_query_where .= ' AND';
80
+		if ($filter_query_where == '' && $where) {
81
+			$filter_query_where = ' WHERE';
82
+		} elseif ($filter_query_where != '' && $and) {
83
+			$filter_query_where .= ' AND';
84
+		}
78 85
 		if ($filter_query_where != '') {
79 86
 			$filter_query_where = preg_replace('/^ AND/',' WHERE',$filter_query_where);
80 87
 		}
@@ -88,9 +95,14 @@  discard block
 block discarded – undo
88 95
 		if ($over_country == '') {
89 96
 			$Tracker = new Tracker($this->db);
90 97
 			$data_country = $Tracker->getCountryFromLatitudeLongitude($latitude,$longitude);
91
-			if (!empty($data_country)) $country = $data_country['iso2'];
92
-			else $country = '';
93
-		} else $country = $over_country;
98
+			if (!empty($data_country)) {
99
+				$country = $data_country['iso2'];
100
+			} else {
101
+				$country = '';
102
+			}
103
+		} else {
104
+			$country = $over_country;
105
+		}
94 106
 		// Route is not added in tracker_archive
95 107
 		$query  = 'INSERT INTO tracker_archive (famtrackid, ident, latitude, longitude, altitude, heading, ground_speed, date, format_source, source_name, over_country, comment, type) 
96 108
 		    VALUES (:famtrackid,:ident,:latitude,:longitude,:altitude,:heading,:groundspeed,:date,:format_source, :source_name, :over_country,:comment,:type)';
@@ -592,7 +604,9 @@  discard block
 block discarded – undo
592 604
 		    $additional_query .= "(tracker_archive_output.pilot_name like '%".$q_item."%') OR ";
593 605
 		    $additional_query .= "(tracker_archive_output.ident like '%".$q_item."%') OR ";
594 606
 		    $translate = $Translation->ident2icao($q_item);
595
-		    if ($translate != $q_item) $additional_query .= "(tracker_archive_output.ident like '%".$translate."%') OR ";
607
+		    if ($translate != $q_item) {
608
+		    	$additional_query .= "(tracker_archive_output.ident like '%".$translate."%') OR ";
609
+		    }
596 610
 		    $additional_query .= "(tracker_archive_output.highlight like '%".$q_item."%')";
597 611
 		    $additional_query .= ")";
598 612
 		}
@@ -810,7 +824,9 @@  discard block
 block discarded – undo
810 824
 		date_default_timezone_set($globalTimezone);
811 825
 		$datetime = new DateTime();
812 826
 		$offset = $datetime->format('P');
813
-	    } else $offset = '+00:00';
827
+	    } else {
828
+	    	$offset = '+00:00';
829
+	    }
814 830
 
815 831
 
816 832
 	    if ($date_array[1] != "")
@@ -1086,9 +1102,13 @@  discard block
 block discarded – undo
1086 1102
 				$query .= "AND date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
1087 1103
 			}
1088 1104
 		}
1089
-                if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
1105
+                if ($sincedate != '') {
1106
+                	$query .= "AND date > '".$sincedate."' ";
1107
+                }
1090 1108
 	$query .= "GROUP BY c.name, c.iso3, c.iso2 ORDER BY nb DESC";
1091
-	if ($limit) $query .= " LIMIT 0,10";
1109
+	if ($limit) {
1110
+		$query .= " LIMIT 0,10";
1111
+	}
1092 1112
       
1093 1113
 	
1094 1114
 	$sth = $this->db->prepare($query);
@@ -1132,9 +1152,13 @@  discard block
 block discarded – undo
1132 1152
 				$query .= "AND s.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
1133 1153
 			}
1134 1154
 		}
1135
-                if ($sincedate != '') $query .= "AND s.date > '".$sincedate."' ";
1155
+                if ($sincedate != '') {
1156
+                	$query .= "AND s.date > '".$sincedate."' ";
1157
+                }
1136 1158
 	$query .= "GROUP BY o.airline_icao,c.name, c.iso3, c.iso2 ORDER BY nb DESC";
1137
-	if ($limit) $query .= " LIMIT 0,10";
1159
+	if ($limit) {
1160
+		$query .= " LIMIT 0,10";
1161
+	}
1138 1162
       
1139 1163
 	
1140 1164
 	$sth = $this->db->prepare($query);
Please login to merge, or discard this patch.
Spacing   +107 added lines, -107 removed lines patch added patch discarded remove patch
@@ -14,33 +14,33 @@  discard block
 block discarded – undo
14 14
 	* @param Array $filter the filter
15 15
 	* @return Array the SQL part
16 16
 	*/
17
-	public function getFilter($filter = array(),$where = false,$and = false) {
17
+	public function getFilter($filter = array(), $where = false, $and = false) {
18 18
 		global $globalFilter, $globalStatsFilters, $globalFilterName, $globalDBdriver;
19 19
 		$filters = array();
20 20
 		if (is_array($globalStatsFilters) && isset($globalStatsFilters[$globalFilterName])) {
21 21
 			if (isset($globalStatsFilters[$globalFilterName][0]['source'])) {
22 22
 				$filters = $globalStatsFilters[$globalFilterName];
23 23
 			} else {
24
-				$filter = array_merge($filter,$globalStatsFilters[$globalFilterName]);
24
+				$filter = array_merge($filter, $globalStatsFilters[$globalFilterName]);
25 25
 			}
26 26
 		}
27 27
 		if (isset($filter[0]['source'])) {
28
-			$filters = array_merge($filters,$filter);
28
+			$filters = array_merge($filters, $filter);
29 29
 		}
30
-		if (is_array($globalFilter)) $filter = array_merge($filter,$globalFilter);
30
+		if (is_array($globalFilter)) $filter = array_merge($filter, $globalFilter);
31 31
 		$filter_query_join = '';
32 32
 		$filter_query_where = '';
33
-		foreach($filters as $flt) {
33
+		foreach ($filters as $flt) {
34 34
 			if (isset($flt['idents']) && !empty($flt['idents'])) {
35 35
 				if (isset($flt['source'])) {
36
-					$filter_query_join .= " INNER JOIN (SELECT famtrackid FROM tracker_archive_output WHERE tracker_archive_output.ident IN ('".implode("','",$flt['idents'])."') AND tracker_archive_output.format_source IN ('".implode("','",$flt['source'])."')) spid ON spid.famtrackid = tracker_archive.famtrackid";
36
+					$filter_query_join .= " INNER JOIN (SELECT famtrackid FROM tracker_archive_output WHERE tracker_archive_output.ident IN ('".implode("','", $flt['idents'])."') AND tracker_archive_output.format_source IN ('".implode("','", $flt['source'])."')) spid ON spid.famtrackid = tracker_archive.famtrackid";
37 37
 				} else {
38
-					$filter_query_join .= " INNER JOIN (SELECT famtrackid FROM tracker_archive_output WHERE tracker_archive_output.ident IN ('".implode("','",$flt['idents'])."')) spid ON spid.famtrackid = tracker_archive.famtrackid";
38
+					$filter_query_join .= " INNER JOIN (SELECT famtrackid FROM tracker_archive_output WHERE tracker_archive_output.ident IN ('".implode("','", $flt['idents'])."')) spid ON spid.famtrackid = tracker_archive.famtrackid";
39 39
 				}
40 40
 			}
41 41
 		}
42 42
 		if (isset($filter['source']) && !empty($filter['source'])) {
43
-			$filter_query_where .= " AND format_source IN ('".implode("','",$filter['source'])."')";
43
+			$filter_query_where .= " AND format_source IN ('".implode("','", $filter['source'])."')";
44 44
 		}
45 45
 		if (isset($filter['ident']) && !empty($filter['ident'])) {
46 46
 			$filter_query_where .= " AND ident = '".$filter['ident']."'";
@@ -68,38 +68,38 @@  discard block
 block discarded – undo
68 68
 					$filter_query_date .= " AND EXTRACT(DAY FROM tracker_archive_output.date) = '".$filter['day']."'";
69 69
 				}
70 70
 			}
71
-			$filter_query_join .= " INNER JOIN (SELECT famtrackid FROM tracker_archive_output".preg_replace('/^ AND/',' WHERE',$filter_query_date).") sd ON sd.famtrackid = tracker_archive.famtrackid";
71
+			$filter_query_join .= " INNER JOIN (SELECT famtrackid FROM tracker_archive_output".preg_replace('/^ AND/', ' WHERE', $filter_query_date).") sd ON sd.famtrackid = tracker_archive.famtrackid";
72 72
 		}
73 73
 		if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) {
74
-			$filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')";
74
+			$filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','", $filter['source_aprs'])."')";
75 75
 		}
76 76
 		if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE';
77 77
 		elseif ($filter_query_where != '' && $and) $filter_query_where .= ' AND';
78 78
 		if ($filter_query_where != '') {
79
-			$filter_query_where = preg_replace('/^ AND/',' WHERE',$filter_query_where);
79
+			$filter_query_where = preg_replace('/^ AND/', ' WHERE', $filter_query_where);
80 80
 		}
81 81
 		$filter_query = $filter_query_join.$filter_query_where;
82 82
 		return $filter_query;
83 83
 	}
84 84
 
85 85
 	// tracker_archive
86
-	public function addTrackerArchiveData($famtrackid = '', $ident = '', $latitude = '', $longitude = '', $altitude = '', $heading = '', $groundspeed = '', $date = '', $putinarchive = false, $comment = '', $type = '',$noarchive = false,$format_source = '', $source_name = '', $over_country = '') {
86
+	public function addTrackerArchiveData($famtrackid = '', $ident = '', $latitude = '', $longitude = '', $altitude = '', $heading = '', $groundspeed = '', $date = '', $putinarchive = false, $comment = '', $type = '', $noarchive = false, $format_source = '', $source_name = '', $over_country = '') {
87 87
 		require_once(dirname(__FILE__).'/class.Tracker.php');
88 88
 		if ($over_country == '') {
89 89
 			$Tracker = new Tracker($this->db);
90
-			$data_country = $Tracker->getCountryFromLatitudeLongitude($latitude,$longitude);
90
+			$data_country = $Tracker->getCountryFromLatitudeLongitude($latitude, $longitude);
91 91
 			if (!empty($data_country)) $country = $data_country['iso2'];
92 92
 			else $country = '';
93 93
 		} else $country = $over_country;
94 94
 		// Route is not added in tracker_archive
95
-		$query  = 'INSERT INTO tracker_archive (famtrackid, ident, latitude, longitude, altitude, heading, ground_speed, date, format_source, source_name, over_country, comment, type) 
95
+		$query = 'INSERT INTO tracker_archive (famtrackid, ident, latitude, longitude, altitude, heading, ground_speed, date, format_source, source_name, over_country, comment, type) 
96 96
 		    VALUES (:famtrackid,:ident,:latitude,:longitude,:altitude,:heading,:groundspeed,:date,:format_source, :source_name, :over_country,:comment,:type)';
97
-		$query_values = array(':famtrackid' => $famtrackid,':ident' => $ident,':latitude' => $latitude,':longitude' => $longitude,':altitude' => $altitude,':heading' => $heading,':groundspeed' => $groundspeed,':date' => $date, ':format_source' => $format_source, ':source_name' => $source_name, ':over_country' => $country,':comment' => $comment,':type' => $type);
97
+		$query_values = array(':famtrackid' => $famtrackid, ':ident' => $ident, ':latitude' => $latitude, ':longitude' => $longitude, ':altitude' => $altitude, ':heading' => $heading, ':groundspeed' => $groundspeed, ':date' => $date, ':format_source' => $format_source, ':source_name' => $source_name, ':over_country' => $country, ':comment' => $comment, ':type' => $type);
98 98
 		try {
99 99
 			$sth = $this->db->prepare($query);
100 100
 			$sth->execute($query_values);
101 101
 			$sth->closeCursor();
102
-		} catch(PDOException $e) {
102
+		} catch (PDOException $e) {
103 103
 			return "error : ".$e->getMessage();
104 104
 		}
105 105
 		return "success";
@@ -119,9 +119,9 @@  discard block
 block discarded – undo
119 119
 
120 120
                 $ident = filter_var($ident, FILTER_SANITIZE_STRING);
121 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";
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 126
                 return $spotter_array;
127 127
         }
@@ -140,7 +140,7 @@  discard block
 block discarded – undo
140 140
                 $id = filter_var($id, FILTER_SANITIZE_STRING);
141 141
                 //$query  = TrackerArchive->$global_query." WHERE tracker_archive.famtrackid = :id";
142 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";
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
                   /*
@@ -153,7 +153,7 @@  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));
156
+                $spotter_array = $Tracker->getDataFromDB($query, array(':id' => $id));
157 157
 
158 158
                 return $spotter_array;
159 159
         }
@@ -168,14 +168,14 @@  discard block
 block discarded – undo
168 168
 	{
169 169
                 date_default_timezone_set('UTC');
170 170
                 $id = filter_var($id, FILTER_SANITIZE_STRING);
171
-                $query  = $this->global_query." WHERE tracker_archive.famtrackid = :id ORDER BY date";
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 175
                 try {
176 176
                         $sth = $this->db->prepare($query);
177 177
                         $sth->execute(array(':id' => $id));
178
-                } catch(PDOException $e) {
178
+                } catch (PDOException $e) {
179 179
                         echo $e->getMessage();
180 180
                         die;
181 181
                 }
@@ -194,14 +194,14 @@  discard block
 block discarded – undo
194 194
         {
195 195
                 date_default_timezone_set('UTC');
196 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";
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 201
                 try {
202 202
                         $sth = $this->db->prepare($query);
203 203
                         $sth->execute(array(':id' => $id));
204
-                } catch(PDOException $e) {
204
+                } catch (PDOException $e) {
205 205
                         echo $e->getMessage();
206 206
                         die;
207 207
                 }
@@ -223,12 +223,12 @@  discard block
 block discarded – undo
223 223
                 date_default_timezone_set('UTC');
224 224
 
225 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";
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 228
                 try {
229 229
                         $sth = $this->db->prepare($query);
230 230
                         $sth->execute(array(':ident' => $ident));
231
-                } catch(PDOException $e) {
231
+                } catch (PDOException $e) {
232 232
                         echo $e->getMessage();
233 233
                         die;
234 234
                 }
@@ -249,12 +249,12 @@  discard block
 block discarded – undo
249 249
                 date_default_timezone_set('UTC');
250 250
 
251 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";
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 254
                 try {
255 255
                         $sth = $this->db->prepare($query);
256 256
                         $sth->execute(array(':id' => $id));
257
-                } catch(PDOException $e) {
257
+                } catch (PDOException $e) {
258 258
                         echo $e->getMessage();
259 259
                         die;
260 260
                 }
@@ -275,12 +275,12 @@  discard block
 block discarded – undo
275 275
                 date_default_timezone_set('UTC');
276 276
 
277 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";
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 280
                 try {
281 281
                         $sth = $this->db->prepare($query);
282 282
                         $sth->execute(array(':id' => $id));
283
-                } catch(PDOException $e) {
283
+                } catch (PDOException $e) {
284 284
                         echo $e->getMessage();
285 285
                         die;
286 286
                 }
@@ -302,13 +302,13 @@  discard block
 block discarded – undo
302 302
                 date_default_timezone_set('UTC');
303 303
 
304 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";
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 308
                 try {
309 309
                         $sth = $this->db->prepare($query);
310 310
                         $sth->execute(array(':ident' => $ident));
311
-                } catch(PDOException $e) {
311
+                } catch (PDOException $e) {
312 312
                         echo $e->getMessage();
313 313
                         die;
314 314
                 }
@@ -325,13 +325,13 @@  discard block
 block discarded – undo
325 325
         * @return Array the spotter information
326 326
         *
327 327
         */
328
-        public function getTrackerArchiveData($ident,$famtrackid,$date)
328
+        public function getTrackerArchiveData($ident, $famtrackid, $date)
329 329
         {
330 330
     		$Tracker = new Tracker($this->db);
331 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";
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 336
                 return $spotter_array;
337 337
         }
@@ -347,7 +347,7 @@  discard block
 block discarded – undo
347 347
 		try {
348 348
 			$sth = $this->db->prepare($query);
349 349
 			$sth->execute();
350
-		} catch(PDOException $e) {
350
+		} catch (PDOException $e) {
351 351
 			echo $e->getMessage();
352 352
 			die;
353 353
 		}
@@ -359,24 +359,24 @@  discard block
 block discarded – undo
359 359
         * @return Array the spotter information
360 360
         *
361 361
         */
362
-        public function getMinLiveTrackerData($begindate,$enddate,$filter = array())
362
+        public function getMinLiveTrackerData($begindate, $enddate, $filter = array())
363 363
         {
364 364
                 global $globalDBdriver, $globalLiveInterval;
365 365
                 date_default_timezone_set('UTC');
366 366
 
367 367
                 $filter_query = '';
368 368
                 if (isset($filter['source']) && !empty($filter['source'])) {
369
-                        $filter_query .= " AND format_source IN ('".implode("','",$filter['source'])."') ";
369
+                        $filter_query .= " AND format_source IN ('".implode("','", $filter['source'])."') ";
370 370
                 }
371 371
                 // Use spotter_output also ?
372 372
                 if (isset($filter['airlines']) && !empty($filter['airlines'])) {
373
-                        $filter_query .= " INNER JOIN (SELECT famtrackid FROM tracker_archive_output WHERE tracker_archive_output.airline_icao IN ('".implode("','",$filter['airlines'])."')) so ON so.famtrackid = tracker_archive.famtrackid ";
373
+                        $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 ";
374 374
                 }
375 375
                 if (isset($filter['airlinestype']) && !empty($filter['airlinestype'])) {
376 376
                         $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 ";
377 377
                 }
378 378
                 if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) {
379
-                        $filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')";
379
+                        $filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','", $filter['source_aprs'])."')";
380 380
                 }
381 381
 
382 382
                 //if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
@@ -395,14 +395,14 @@  discard block
 block discarded – undo
395 395
 						GROUP BY l.famtrackid) s on tracker_archive.famtrackid = s.famtrackid 
396 396
 				    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 397
 */
398
-			$query  = 'SELECT tracker_archive.date,tracker_archive.famtrackid, tracker_archive.ident, tracker_archive.aircraft_icao, tracker_archive.departure_airport_icao as departure_airport, tracker_archive.arrival_airport_icao as arrival_airport, tracker_archive.latitude, tracker_archive.longitude, tracker_archive.altitude, tracker_archive.heading, tracker_archive.ground_speed, tracker_archive.squawk, a.aircraft_shadow,a.engine_type, a.engine_count, a.wake_category 
398
+			$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 
399 399
 				    FROM tracker_archive 
400 400
 				    INNER JOIN (SELECT * FROM aircraft) a on tracker_archive.aircraft_icao = a.icao
401 401
 				    WHERE tracker_archive.date BETWEEN '."'".$begindate."'".' AND '."'".$begindate."'".' 
402 402
                         	    '.$filter_query.' ORDER BY famtrackid';
403 403
                 } else {
404 404
                         //$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';
405
-                        $query  = 'SELECT tracker_archive.date,tracker_archive.famtrackid, tracker_archive.ident, tracker_archive.aircraft_icao, tracker_archive.departure_airport_icao as departure_airport, tracker_archive.arrival_airport_icao as arrival_airport, tracker_archive.latitude, tracker_archive.longitude, tracker_archive.altitude, tracker_archive.heading, tracker_archive.ground_speed, tracker_archive.squawk, a.aircraft_shadow,a.engine_type, a.engine_count, a.wake_category 
405
+                        $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 
406 406
                         	    FROM tracker_archive 
407 407
                         	    INNER JOIN (SELECT * FROM aircraft) a on tracker_archive.aircraft_icao = a.icao
408 408
                         	    WHERE tracker_archive.date >= '."'".$begindate."'".' AND tracker_archive.date <= '."'".$enddate."'".'
@@ -412,7 +412,7 @@  discard block
 block discarded – undo
412 412
                 try {
413 413
                         $sth = $this->db->prepare($query);
414 414
                         $sth->execute();
415
-                } catch(PDOException $e) {
415
+                } catch (PDOException $e) {
416 416
                         echo $e->getMessage();
417 417
                         die;
418 418
                 }
@@ -427,24 +427,24 @@  discard block
 block discarded – undo
427 427
         * @return Array the spotter information
428 428
         *
429 429
         */
430
-        public function getMinLiveTrackerDataPlayback($begindate,$enddate,$filter = array())
430
+        public function getMinLiveTrackerDataPlayback($begindate, $enddate, $filter = array())
431 431
         {
432 432
                 global $globalDBdriver, $globalLiveInterval;
433 433
                 date_default_timezone_set('UTC');
434 434
 
435 435
                 $filter_query = '';
436 436
                 if (isset($filter['source']) && !empty($filter['source'])) {
437
-                        $filter_query .= " AND format_source IN ('".implode("','",$filter['source'])."') ";
437
+                        $filter_query .= " AND format_source IN ('".implode("','", $filter['source'])."') ";
438 438
                 }
439 439
                 // Should use spotter_output also ?
440 440
                 if (isset($filter['airlines']) && !empty($filter['airlines'])) {
441
-                        $filter_query .= " INNER JOIN (SELECT famtrackid FROM tracker_archive_output WHERE tracker_archive_output.airline_icao IN ('".implode("','",$filter['airlines'])."')) so ON so.famtrackid = tracker_archive.famtrackid ";
441
+                        $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 ";
442 442
                 }
443 443
                 if (isset($filter['airlinestype']) && !empty($filter['airlinestype'])) {
444 444
                         $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 ";
445 445
                 }
446 446
                 if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) {
447
-                        $filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')";
447
+                        $filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','", $filter['source_aprs'])."')";
448 448
                 }
449 449
 
450 450
                 //if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
@@ -454,7 +454,7 @@  discard block
 block discarded – undo
454 454
                     		    FROM tracker_archive 
455 455
                     		    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';
456 456
 			*/
457
-			$query  = 'SELECT a.aircraft_shadow, tracker_archive_output.ident, tracker_archive_output.famtrackid, tracker_archive_output.aircraft_icao, tracker_archive_output.departure_airport_icao as departure_airport, tracker_archive_output.arrival_airport_icao as arrival_airport, tracker_archive_output.latitude, tracker_archive_output.longitude, tracker_archive_output.altitude, tracker_archive_output.heading, tracker_archive_output.ground_speed, tracker_archive_output.squawk 
457
+			$query = 'SELECT a.aircraft_shadow, tracker_archive_output.ident, tracker_archive_output.famtrackid, tracker_archive_output.aircraft_icao, tracker_archive_output.departure_airport_icao as departure_airport, tracker_archive_output.arrival_airport_icao as arrival_airport, tracker_archive_output.latitude, tracker_archive_output.longitude, tracker_archive_output.altitude, tracker_archive_output.heading, tracker_archive_output.ground_speed, tracker_archive_output.squawk 
458 458
 				    FROM tracker_archive_output 
459 459
 				    LEFT JOIN (SELECT aircraft_shadow,icao FROM aircraft) a ON tracker_archive_output.aircraft_icao = a.icao 
460 460
 				    WHERE (tracker_archive_output.date BETWEEN '."'".$begindate."'".' AND '."'".$enddate."'".') 
@@ -469,7 +469,7 @@  discard block
 block discarded – undo
469 469
                         	    WHERE tracker_archive_output.date >= '."'".$begindate."'".' AND tracker_archive_output.date <= '."'".$enddate."'".'
470 470
                         	    '.$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';
471 471
                         */
472
-                        $query  = 'SELECT DISTINCT tracker_archive_output.famtrackid, tracker_archive_output.ident, tracker_archive_output.aircraft_icao, tracker_archive_output.departure_airport_icao as departure_airport, tracker_archive_output.arrival_airport_icao as arrival_airport, tracker_archive_output.latitude, tracker_archive_output.longitude, tracker_archive_output.altitude, tracker_archive_output.heading, tracker_archive_output.ground_speed, tracker_archive_output.squawk, a.aircraft_shadow
472
+                        $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
473 473
                         	    FROM tracker_archive_output 
474 474
                         	    INNER JOIN (SELECT * FROM aircraft) a on tracker_archive_output.aircraft_icao = a.icao
475 475
                         	    WHERE tracker_archive_output.date >= '."'".$begindate."'".' AND tracker_archive_output.date <= '."'".$enddate."'".'
@@ -481,7 +481,7 @@  discard block
 block discarded – undo
481 481
                 try {
482 482
                         $sth = $this->db->prepare($query);
483 483
                         $sth->execute();
484
-                } catch(PDOException $e) {
484
+                } catch (PDOException $e) {
485 485
                         echo $e->getMessage();
486 486
                         die;
487 487
                 }
@@ -496,23 +496,23 @@  discard block
 block discarded – undo
496 496
         * @return Array the spotter information
497 497
         *
498 498
         */
499
-        public function getLiveTrackerCount($begindate,$enddate,$filter = array())
499
+        public function getLiveTrackerCount($begindate, $enddate, $filter = array())
500 500
         {
501 501
                 global $globalDBdriver, $globalLiveInterval;
502 502
                 date_default_timezone_set('UTC');
503 503
 
504 504
                 $filter_query = '';
505 505
                 if (isset($filter['source']) && !empty($filter['source'])) {
506
-                        $filter_query .= " AND format_source IN ('".implode("','",$filter['source'])."') ";
506
+                        $filter_query .= " AND format_source IN ('".implode("','", $filter['source'])."') ";
507 507
                 }
508 508
                 if (isset($filter['airlines']) && !empty($filter['airlines'])) {
509
-                        $filter_query .= " INNER JOIN (SELECT famtrackid FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','",$filter['airlines'])."')) so ON so.famtrackid = tracker_archive.famtrackid ";
509
+                        $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 ";
510 510
                 }
511 511
                 if (isset($filter['airlinestype']) && !empty($filter['airlinestype'])) {
512 512
                         $filter_query .= " INNER JOIN (SELECT famtrackid FROM spotter_output WHERE spotter_output.airline_type = '".$filter['airlinestype']."') sa ON sa.famtrackid = tracker_archive.famtrackid ";
513 513
                 }
514 514
                 if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) {
515
-                        $filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')";
515
+                        $filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','", $filter['source_aprs'])."')";
516 516
                 }
517 517
 
518 518
                 //if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
@@ -527,7 +527,7 @@  discard block
 block discarded – undo
527 527
                 try {
528 528
                         $sth = $this->db->prepare($query);
529 529
                         $sth->execute();
530
-                } catch(PDOException $e) {
530
+                } catch (PDOException $e) {
531 531
                         echo $e->getMessage();
532 532
                         die;
533 533
                 }
@@ -547,7 +547,7 @@  discard block
 block discarded – undo
547 547
     * @return Array the spotter information
548 548
     *
549 549
     */
550
-    public function searchTrackerData($q = '', $registration = '', $aircraft_icao = '', $aircraft_manufacturer = '', $highlights = '', $airline_icao = '', $airline_country = '', $airline_type = '', $airport = '', $airport_country = '', $callsign = '', $departure_airport_route = '', $arrival_airport_route = '', $owner = '',$pilot_id = '',$pilot_name = '',$altitude = '', $date_posted = '', $limit = '', $sort = '', $includegeodata = '',$origLat = '',$origLon = '',$dist = '', $filters=array())
550
+    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())
551 551
     {
552 552
 	global $globalTimezone, $globalDBdriver;
553 553
 	require_once(dirname(__FILE__).'/class.Translation.php');
@@ -569,7 +569,7 @@  discard block
 block discarded – undo
569 569
 	        
570 570
 		$q_array = explode(" ", $q);
571 571
 		
572
-		foreach ($q_array as $q_item){
572
+		foreach ($q_array as $q_item) {
573 573
 		    $additional_query .= " AND (";
574 574
 		    $additional_query .= "(tracker_archive_output.spotter_id like '%".$q_item."%') OR ";
575 575
 		    $additional_query .= "(tracker_archive_output.aircraft_icao like '%".$q_item."%') OR ";
@@ -601,7 +601,7 @@  discard block
 block discarded – undo
601 601
 	
602 602
 	if ($registration != "")
603 603
 	{
604
-	    $registration = filter_var($registration,FILTER_SANITIZE_STRING);
604
+	    $registration = filter_var($registration, FILTER_SANITIZE_STRING);
605 605
 	    if (!is_string($registration))
606 606
 	    {
607 607
 		return false;
@@ -612,7 +612,7 @@  discard block
 block discarded – undo
612 612
 	
613 613
 	if ($aircraft_icao != "")
614 614
 	{
615
-	    $aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
615
+	    $aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
616 616
 	    if (!is_string($aircraft_icao))
617 617
 	    {
618 618
 		return false;
@@ -623,7 +623,7 @@  discard block
 block discarded – undo
623 623
 	
624 624
 	if ($aircraft_manufacturer != "")
625 625
 	{
626
-	    $aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
626
+	    $aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING);
627 627
 	    if (!is_string($aircraft_manufacturer))
628 628
 	    {
629 629
 		return false;
@@ -644,7 +644,7 @@  discard block
 block discarded – undo
644 644
 	
645 645
 	if ($airline_icao != "")
646 646
 	{
647
-	    $airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
647
+	    $airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING);
648 648
 	    if (!is_string($airline_icao))
649 649
 	    {
650 650
 		return false;
@@ -655,7 +655,7 @@  discard block
 block discarded – undo
655 655
 	
656 656
 	if ($airline_country != "")
657 657
 	{
658
-	    $airline_country = filter_var($airline_country,FILTER_SANITIZE_STRING);
658
+	    $airline_country = filter_var($airline_country, FILTER_SANITIZE_STRING);
659 659
 	    if (!is_string($airline_country))
660 660
 	    {
661 661
 		return false;
@@ -666,7 +666,7 @@  discard block
 block discarded – undo
666 666
 	
667 667
 	if ($airline_type != "")
668 668
 	{
669
-	    $airline_type = filter_var($airline_type,FILTER_SANITIZE_STRING);
669
+	    $airline_type = filter_var($airline_type, FILTER_SANITIZE_STRING);
670 670
 	    if (!is_string($airline_type))
671 671
 	    {
672 672
 		return false;
@@ -688,7 +688,7 @@  discard block
 block discarded – undo
688 688
 	
689 689
 	if ($airport != "")
690 690
 	{
691
-	    $airport = filter_var($airport,FILTER_SANITIZE_STRING);
691
+	    $airport = filter_var($airport, FILTER_SANITIZE_STRING);
692 692
 	    if (!is_string($airport))
693 693
 	    {
694 694
 		return false;
@@ -699,7 +699,7 @@  discard block
 block discarded – undo
699 699
 	
700 700
 	if ($airport_country != "")
701 701
 	{
702
-	    $airport_country = filter_var($airport_country,FILTER_SANITIZE_STRING);
702
+	    $airport_country = filter_var($airport_country, FILTER_SANITIZE_STRING);
703 703
 	    if (!is_string($airport_country))
704 704
 	    {
705 705
 		return false;
@@ -710,7 +710,7 @@  discard block
 block discarded – undo
710 710
     
711 711
 	if ($callsign != "")
712 712
 	{
713
-	    $callsign = filter_var($callsign,FILTER_SANITIZE_STRING);
713
+	    $callsign = filter_var($callsign, FILTER_SANITIZE_STRING);
714 714
 	    if (!is_string($callsign))
715 715
 	    {
716 716
 		return false;
@@ -718,7 +718,7 @@  discard block
 block discarded – undo
718 718
 		$translate = $Translation->ident2icao($callsign);
719 719
 		if ($translate != $callsign) {
720 720
 			$additional_query .= " AND (tracker_archive_output.ident = :callsign OR tracker_archive_output.ident = :translate)";
721
-			$query_values = array_merge($query_values,array(':callsign' => $callsign,':translate' => $translate));
721
+			$query_values = array_merge($query_values, array(':callsign' => $callsign, ':translate' => $translate));
722 722
 		} else {
723 723
 			$additional_query .= " AND (tracker_archive_output.ident = '".$callsign."')";
724 724
 		}
@@ -727,7 +727,7 @@  discard block
 block discarded – undo
727 727
 
728 728
 	if ($owner != "")
729 729
 	{
730
-	    $owner = filter_var($owner,FILTER_SANITIZE_STRING);
730
+	    $owner = filter_var($owner, FILTER_SANITIZE_STRING);
731 731
 	    if (!is_string($owner))
732 732
 	    {
733 733
 		return false;
@@ -738,7 +738,7 @@  discard block
 block discarded – undo
738 738
 
739 739
 	if ($pilot_name != "")
740 740
 	{
741
-	    $pilot_name = filter_var($pilot_name,FILTER_SANITIZE_STRING);
741
+	    $pilot_name = filter_var($pilot_name, FILTER_SANITIZE_STRING);
742 742
 	    if (!is_string($pilot_name))
743 743
 	    {
744 744
 		return false;
@@ -749,7 +749,7 @@  discard block
 block discarded – undo
749 749
 	
750 750
 	if ($pilot_id != "")
751 751
 	{
752
-	    $pilot_id = filter_var($pilot_id,FILTER_SANITIZE_NUMBER_INT);
752
+	    $pilot_id = filter_var($pilot_id, FILTER_SANITIZE_NUMBER_INT);
753 753
 	    if (!is_string($pilot_id))
754 754
 	    {
755 755
 		return false;
@@ -760,7 +760,7 @@  discard block
 block discarded – undo
760 760
 	
761 761
 	if ($departure_airport_route != "")
762 762
 	{
763
-	    $departure_airport_route = filter_var($departure_airport_route,FILTER_SANITIZE_STRING);
763
+	    $departure_airport_route = filter_var($departure_airport_route, FILTER_SANITIZE_STRING);
764 764
 	    if (!is_string($departure_airport_route))
765 765
 	    {
766 766
 		return false;
@@ -771,7 +771,7 @@  discard block
 block discarded – undo
771 771
 	
772 772
 	if ($arrival_airport_route != "")
773 773
 	{
774
-	    $arrival_airport_route = filter_var($arrival_airport_route,FILTER_SANITIZE_STRING);
774
+	    $arrival_airport_route = filter_var($arrival_airport_route, FILTER_SANITIZE_STRING);
775 775
 	    if (!is_string($arrival_airport_route))
776 776
 	    {
777 777
 		return false;
@@ -784,8 +784,8 @@  discard block
 block discarded – undo
784 784
 	{
785 785
 	    $altitude_array = explode(",", $altitude);
786 786
 	    
787
-	    $altitude_array[0] = filter_var($altitude_array[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
788
-	    $altitude_array[1] = filter_var($altitude_array[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
787
+	    $altitude_array[0] = filter_var($altitude_array[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
788
+	    $altitude_array[1] = filter_var($altitude_array[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
789 789
 	    
790 790
 
791 791
 	    if ($altitude_array[1] != "")
@@ -803,8 +803,8 @@  discard block
 block discarded – undo
803 803
 	{
804 804
 	    $date_array = explode(",", $date_posted);
805 805
 	    
806
-	    $date_array[0] = filter_var($date_array[0],FILTER_SANITIZE_STRING);
807
-	    $date_array[1] = filter_var($date_array[1],FILTER_SANITIZE_STRING);
806
+	    $date_array[0] = filter_var($date_array[0], FILTER_SANITIZE_STRING);
807
+	    $date_array[1] = filter_var($date_array[1], FILTER_SANITIZE_STRING);
808 808
 	    
809 809
 	    if ($globalTimezone != '') {
810 810
 		date_default_timezone_set($globalTimezone);
@@ -836,8 +836,8 @@  discard block
 block discarded – undo
836 836
 	{
837 837
 	    $limit_array = explode(",", $limit);
838 838
 	    
839
-	    $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
840
-	    $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
839
+	    $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
840
+	    $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
841 841
 	    
842 842
 	    if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
843 843
 	    {
@@ -848,8 +848,8 @@  discard block
 block discarded – undo
848 848
 	
849 849
 
850 850
 	if ($origLat != "" && $origLon != "" && $dist != "") {
851
-		$dist = number_format($dist*0.621371,2,'.','');
852
-		$query="SELECT tracker_archive_output.*, 3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - ABS(CAST(tracker_archive.latitude as double precision)))*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(ABS(CAST(tracker_archive.latitude as double precision))*pi()/180)*POWER(SIN(($origLon-CAST(tracker_archive.longitude as double precision))*pi()/180/2),2))) as distance 
851
+		$dist = number_format($dist*0.621371, 2, '.', '');
852
+		$query = "SELECT tracker_archive_output.*, 3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - ABS(CAST(tracker_archive.latitude as double precision)))*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(ABS(CAST(tracker_archive.latitude as double precision))*pi()/180)*POWER(SIN(($origLon-CAST(tracker_archive.longitude as double precision))*pi()/180/2),2))) as distance 
853 853
                           FROM tracker_archive_output, tracker_archive WHERE spotter_output_archive.famtrackid = tracker_archive.famtrackid AND spotter_output.ident <> '' ".$additional_query."AND CAST(tracker_archive.longitude as double precision) between ($origLon-$dist/ABS(cos(radians($origLat))*69)) and ($origLon+$dist/ABS(cos(radians($origLat))*69)) and CAST(tracker_archive.latitude as double precision) between ($origLat-($dist/69)) and ($origLat+($dist/69)) 
854 854
                           AND (3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - ABS(CAST(tracker_archive.latitude as double precision)))*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(ABS(CAST(tracker_archive.latitude as double precision))*pi()/180)*POWER(SIN(($origLon-CAST(tracker_archive.longitude as double precision))*pi()/180/2),2)))) < $dist".$filter_query." ORDER BY distance";
855 855
 	} else {
@@ -866,12 +866,12 @@  discard block
 block discarded – undo
866 866
 			$additional_query .= " AND (tracker_archive_output.waypoints <> '')";
867 867
 		}
868 868
 
869
-		$query  = "SELECT tracker_archive_output.* FROM tracker_archive_output 
869
+		$query = "SELECT tracker_archive_output.* FROM tracker_archive_output 
870 870
 		    WHERE tracker_archive_output.ident <> '' 
871 871
 		    ".$additional_query."
872 872
 		    ".$filter_query.$orderby_query;
873 873
 	}
874
-	$spotter_array = $Tracker->getDataFromDB($query, $query_values,$limit_query);
874
+	$spotter_array = $Tracker->getDataFromDB($query, $query_values, $limit_query);
875 875
 
876 876
 	return $spotter_array;
877 877
     }
@@ -888,7 +888,7 @@  discard block
 block discarded – undo
888 888
                 try {
889 889
                         $sth = $this->db->prepare($query);
890 890
                         $sth->execute();
891
-                } catch(PDOException $e) {
891
+                } catch (PDOException $e) {
892 892
                         return "error";
893 893
                 }
894 894
 	}
@@ -925,8 +925,8 @@  discard block
 block discarded – undo
925 925
 	{
926 926
 	    $limit_array = explode(",", $limit);
927 927
 	    
928
-	    $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
929
-	    $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
928
+	    $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
929
+	    $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
930 930
 	    
931 931
 	    if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
932 932
 	    {
@@ -967,7 +967,7 @@  discard block
 block discarded – undo
967 967
 	$query_values = array();
968 968
 	$limit_query = '';
969 969
 	$additional_query = '';
970
-	$filter_query = $this->getFilter($filter,true,true);
970
+	$filter_query = $this->getFilter($filter, true, true);
971 971
 	
972 972
 	if ($owner != "")
973 973
 	{
@@ -984,8 +984,8 @@  discard block
 block discarded – undo
984 984
 	{
985 985
 	    $limit_array = explode(",", $limit);
986 986
 	    
987
-	    $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
988
-	    $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
987
+	    $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
988
+	    $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
989 989
 	    
990 990
 	    if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
991 991
 	    {
@@ -1025,7 +1025,7 @@  discard block
 block discarded – undo
1025 1025
 	$query_values = array();
1026 1026
 	$limit_query = '';
1027 1027
 	$additional_query = '';
1028
-	$filter_query = $this->getFilter($filter,true,true);
1028
+	$filter_query = $this->getFilter($filter, true, true);
1029 1029
 	
1030 1030
 	if ($pilot != "")
1031 1031
 	{
@@ -1037,8 +1037,8 @@  discard block
 block discarded – undo
1037 1037
 	{
1038 1038
 	    $limit_array = explode(",", $limit);
1039 1039
 	    
1040
-	    $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1041
-	    $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1040
+	    $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1041
+	    $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1042 1042
 	    
1043 1043
 	    if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1044 1044
 	    {
@@ -1068,7 +1068,7 @@  discard block
 block discarded – undo
1068 1068
     * @return Array the airline country list
1069 1069
     *
1070 1070
     */
1071
-    public function countAllFlightOverCountries($limit = true,$olderthanmonths = 0,$sincedate = '')
1071
+    public function countAllFlightOverCountries($limit = true, $olderthanmonths = 0, $sincedate = '')
1072 1072
     {
1073 1073
 	global $globalDBdriver;
1074 1074
 	/*
@@ -1097,7 +1097,7 @@  discard block
 block discarded – undo
1097 1097
 	$flight_array = array();
1098 1098
 	$temp_array = array();
1099 1099
         
1100
-	while($row = $sth->fetch(PDO::FETCH_ASSOC))
1100
+	while ($row = $sth->fetch(PDO::FETCH_ASSOC))
1101 1101
 	{
1102 1102
 	    $temp_array['flight_count'] = $row['nb'];
1103 1103
 	    $temp_array['flight_country'] = $row['name'];
@@ -1114,7 +1114,7 @@  discard block
 block discarded – undo
1114 1114
     * @return Array the airline country list
1115 1115
     *
1116 1116
     */
1117
-    public function countAllFlightOverCountriesByAirlines($limit = true,$olderthanmonths = 0,$sincedate = '')
1117
+    public function countAllFlightOverCountriesByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '')
1118 1118
     {
1119 1119
 	global $globalDBdriver;
1120 1120
 	/*
@@ -1143,7 +1143,7 @@  discard block
 block discarded – undo
1143 1143
 	$flight_array = array();
1144 1144
 	$temp_array = array();
1145 1145
         
1146
-	while($row = $sth->fetch(PDO::FETCH_ASSOC))
1146
+	while ($row = $sth->fetch(PDO::FETCH_ASSOC))
1147 1147
 	{
1148 1148
 	    $temp_array['airline_icao'] = $row['airline_icao'];
1149 1149
 	    $temp_array['flight_count'] = $row['nb'];
@@ -1161,14 +1161,14 @@  discard block
 block discarded – undo
1161 1161
     * @return Array the spotter information
1162 1162
     *
1163 1163
     */
1164
-    public function getDateArchiveTrackerDataById($id,$date)
1164
+    public function getDateArchiveTrackerDataById($id, $date)
1165 1165
     {
1166 1166
 	$Tracker = new Tracker($this->db);
1167 1167
 	date_default_timezone_set('UTC');
1168 1168
 	$id = filter_var($id, FILTER_SANITIZE_STRING);
1169
-	$query  = 'SELECT tracker_archive.* FROM tracker_archive INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_archive l WHERE l.famtrackid = :id AND l.date <= :date GROUP BY l.famtrackid) s on tracker_archive.famtrackid = s.famtrackid AND tracker_archive.date = s.maxdate ORDER BY tracker_archive.date DESC';
1170
-	$date = date('c',$date);
1171
-	$spotter_array = $Tracker->getDataFromDB($query,array(':id' => $id,':date' => $date));
1169
+	$query = 'SELECT tracker_archive.* FROM tracker_archive INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_archive l WHERE l.famtrackid = :id AND l.date <= :date GROUP BY l.famtrackid) s on tracker_archive.famtrackid = s.famtrackid AND tracker_archive.date = s.maxdate ORDER BY tracker_archive.date DESC';
1170
+	$date = date('c', $date);
1171
+	$spotter_array = $Tracker->getDataFromDB($query, array(':id' => $id, ':date' => $date));
1172 1172
 	return $spotter_array;
1173 1173
     }
1174 1174
 
@@ -1178,14 +1178,14 @@  discard block
 block discarded – undo
1178 1178
     * @return Array the spotter information
1179 1179
     *
1180 1180
     */
1181
-    public function getDateArchiveTrackerDataByIdent($ident,$date)
1181
+    public function getDateArchiveTrackerDataByIdent($ident, $date)
1182 1182
     {
1183 1183
 	$Tracker = new Tracker($this->db);
1184 1184
 	date_default_timezone_set('UTC');
1185 1185
 	$ident = filter_var($ident, FILTER_SANITIZE_STRING);
1186
-	$query  = 'SELECT tracker_archive.* FROM tracker_archive INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_archive l WHERE l.ident = :ident AND l.date <= :date GROUP BY l.famtrackid) s on tracker_archive.famtrackid = s.famtrackid AND tracker_archive.date = s.maxdate ORDER BY tracker_archive.date DESC';
1187
-	$date = date('c',$date);
1188
-	$spotter_array = $Tracker->getDataFromDB($query,array(':ident' => $ident,':date' => $date));
1186
+	$query = 'SELECT tracker_archive.* FROM tracker_archive INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_archive l WHERE l.ident = :ident AND l.date <= :date GROUP BY l.famtrackid) s on tracker_archive.famtrackid = s.famtrackid AND tracker_archive.date = s.maxdate ORDER BY tracker_archive.date DESC';
1187
+	$date = date('c', $date);
1188
+	$spotter_array = $Tracker->getDataFromDB($query, array(':ident' => $ident, ':date' => $date));
1189 1189
 	return $spotter_array;
1190 1190
     }
1191 1191
 
@@ -1195,7 +1195,7 @@  discard block
 block discarded – undo
1195 1195
     * @return Array the spotter information
1196 1196
     *
1197 1197
     */
1198
-    public function getTrackerDataByAirport($airport = '', $limit = '', $sort = '',$filters = array())
1198
+    public function getTrackerDataByAirport($airport = '', $limit = '', $sort = '', $filters = array())
1199 1199
     {
1200 1200
 	global $global_query;
1201 1201
 	$Tracker = new Tracker($this->db);
@@ -1203,7 +1203,7 @@  discard block
 block discarded – undo
1203 1203
 	$query_values = array();
1204 1204
 	$limit_query = '';
1205 1205
 	$additional_query = '';
1206
-	$filter_query = $this->getFilter($filters,true,true);
1206
+	$filter_query = $this->getFilter($filters, true, true);
1207 1207
 	
1208 1208
 	if ($airport != "")
1209 1209
 	{
@@ -1220,8 +1220,8 @@  discard block
 block discarded – undo
1220 1220
 	{
1221 1221
 	    $limit_array = explode(",", $limit);
1222 1222
 	    
1223
-	    $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1224
-	    $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1223
+	    $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1224
+	    $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1225 1225
 	    
1226 1226
 	    if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1227 1227
 	    {
Please login to merge, or discard this patch.
table-output.php 3 patches
Braces   +63 added lines, -23 removed lines patch added patch discarded remove patch
@@ -7,7 +7,9 @@  discard block
 block discarded – undo
7 7
 $showRouteStop = $Common->multiKeyExists($spotter_array,'route_stop');
8 8
 $showDuration = $Common->multiKeyExists($spotter_array,'duration');
9 9
 
10
-if (!isset($type)) $type = 'aircraft';
10
+if (!isset($type)) {
11
+	$type = 'aircraft';
12
+}
11 13
 
12 14
 if (!isset($_GET['sort'])) 
13 15
 {
@@ -440,7 +442,9 @@  discard block
 block discarded – undo
440 442
 	if (isset($globalTimezone))
441 443
 	{
442 444
 		date_default_timezone_set($globalTimezone);
443
-	} else date_default_timezone_set('UTC');
445
+	} else {
446
+		date_default_timezone_set('UTC');
447
+	}
444 448
 	if ($showSpecial === true)
445 449
 	{
446 450
 		print '<tr class="special">'."\n";
@@ -455,7 +459,9 @@  discard block
 block discarded – undo
455 459
 			print '<tr class="active">';
456 460
 		} elseif (isset($spotter_item['spotted_registration'])) {
457 461
 			print '<tr class="info">';
458
-		} else print '<tr>';
462
+		} else {
463
+			print '<tr>';
464
+		}
459 465
 	}
460 466
 	if (strtolower($current_page) == "acars-latest" || strtolower($current_page) == "acars-archive" || strtolower($current_page) == "currently" || strtolower($current_page) == "accident-latest" || strtolower($current_page) == "incident-latest" || strtolower($current_page) == "accident-detailed" || strtolower($current_page) == "incident-detailed") {
461 467
 		if ($type == 'aircraft') {
@@ -463,8 +469,9 @@  discard block
 block discarded – undo
463 469
 			{
464 470
 				print '<td class="aircraft_thumbnail">'."\n";
465 471
 				if ($spotter_item['image_source'] == 'planespotters') {
466
-					if ($spotter_item['image_source_website'] != '') $image_src = $spotter_item['image_source_website'];
467
-					else {
472
+					if ($spotter_item['image_source_website'] != '') {
473
+						$image_src = $spotter_item['image_source_website'];
474
+					} else {
468 475
 						$planespotter_url_array = explode("_", $spotter_item['image']);
469 476
 						$planespotter_id = str_replace(".jpg", "", $planespotter_url_array[1]);
470 477
 						$image_src = 'https://www.planespotters.net/Aviation_Photos/photo.show?id='.$planespotter_id;
@@ -477,7 +484,9 @@  discard block
 block discarded – undo
477 484
 				} else {
478 485
 					if ($spotter_item['image_source'] == 'wikimedia' || $spotter_item['image_source'] == 'devianart' || $spotter_item['image_source'] == 'flickr') {
479 486
 						$image_thumbnail = preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']);
480
-					} else 	$image_thumbnail = $spotter_item['image_thumbnail'];
487
+					} else {
488
+						$image_thumbnail = $spotter_item['image_thumbnail'];
489
+					}
481 490
 					if (isset($spotter_item['airline_name'])) {
482 491
 						print '<img src="'.$image_thumbnail.'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['registration'].' - '.$spotter_item['airline_name'].'" alt="'.$spotter_item['registration'].' - '.$spotter_item['airline_name'].'" data-content="'._("Registration:").' '.$spotter_item['registration'].'<br />'._("Airline:").' '.$spotter_item['airline_name'].'" data-html="true" width="100px" />'."\n".'<div class="thumbnail-copyright">&copy; '.$spotter_item['image_copyright'].'</div>';
483 492
 					} else {
@@ -496,7 +505,9 @@  discard block
 block discarded – undo
496 505
 				print '<td class="aircraft_thumbnail">'."\n";
497 506
 				if ($spotter_item['image_source'] == 'wikimedia' || $spotter_item['image_source'] == 'devianart' || $spotter_item['image_source'] == 'flickr') {
498 507
 					$image_thumbnail = preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']);
499
-				} else 	$image_thumbnail = $spotter_item['image_thumbnail'];
508
+				} else {
509
+					$image_thumbnail = $spotter_item['image_thumbnail'];
510
+				}
500 511
 				if (isset($spotter_item['airline_name'])) {
501 512
 					print '<img src="'.$image_thumbnail.'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['mmsi'].'" alt="'.$spotter_item['mmsi'].'" data-content="'._("MMSI:").' '.$spotter_item['mmsi'].'" data-html="true" width="100px" />'."\n".'<div class="thumbnail-copyright">&copy; '.$spotter_item['image_copyright'].'</div>';
502 513
 				} else {
@@ -514,7 +525,9 @@  discard block
 block discarded – undo
514 525
 				print '<td class="aircraft_thumbnail">'."\n";
515 526
 				if ($spotter_item['image_source'] == 'wikimedia' || $spotter_item['image_source'] == 'devianart' || $spotter_item['image_source'] == 'flickr') {
516 527
 					$image_thumbnail = preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']);
517
-				} else 	$image_thumbnail = $spotter_item['image_thumbnail'];
528
+				} else {
529
+					$image_thumbnail = $spotter_item['image_thumbnail'];
530
+				}
518 531
 				print '<img src="'.$image_thumbnail.'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['ident'].'" alt="'.$spotter_item['type'].'" data-content="'._("Type:").' '.$spotter_item['type'].'" data-html="true" width="100px" />'."\n".'<div class="thumbnail-copyright">&copy; '.$spotter_item['image_copyright'].'</div>';
519 532
 				print '</td>'."\n";
520 533
 			} else {
@@ -565,8 +578,9 @@  discard block
 block discarded – undo
565 578
 				print '<td class="aircraft_thumbnail">'."\n";
566 579
 				//print '<a href="'.$globalURL.'/flightid/'.$spotter_item['spotter_id'].'"><img src="'.$spotter_item['image_thumbnail'].'" alt="Click to see more information about this flight" title="Click to see more information about this flight" width="100px" /></a>';
567 580
 				if ($spotter_item['image_source'] == 'planespotters') {
568
-					if ($spotter_item['image_source_website'] != '') $image_src = $spotter_item['image_source_website'];
569
-					else {
581
+					if ($spotter_item['image_source_website'] != '') {
582
+						$image_src = $spotter_item['image_source_website'];
583
+					} else {
570 584
 						$planespotter_url_array = explode("_", $spotter_array[0]['image']);
571 585
 						$planespotter_id = str_replace(".jpg", "", $planespotter_url_array[1]);
572 586
 						$image_src = 'https://www.planespotters.net/Aviation_Photos/photo.show?id='.$planespotter_id;
@@ -583,7 +597,9 @@  discard block
 block discarded – undo
583 597
 				} else {
584 598
 					if ($spotter_item['image_source'] == 'wikimedia' || $spotter_item['image_source'] == 'devianart' || $spotter_item['image_source'] == 'flickr') {
585 599
 						$image_thumbnail = preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']);
586
-					} else 	$image_thumbnail = $spotter_item['image_thumbnail'];
600
+					} else {
601
+						$image_thumbnail = $spotter_item['image_thumbnail'];
602
+					}
587 603
 					if (!isset($spotter_item['airline_name']) && isset($spotter_item['aircraft_name'])) {
588 604
 						print '<a href="'.$globalURL.'/flightid/'.$spotter_item['spotter_id'].'"><img src="'.$image_thumbnail.'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '._("Not available").'" alt="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '._("Not available").'" data-content="'._("Registration:").' '.$spotter_item['registration'].'<br />'._("Aircraft:").' '.$spotter_item['aircraft_name'].' ('.$spotter_item['aircraft_type'].')<br />'._("Airline:").' '._("Not available").'<br />'._("Squawk:").' '.$spotter_item['squawk'].'" data-html="true" width="100px" /></a>'."\n".'<div class="thumbnail-copyright">&copy; '.$spotter_item['image_copyright'].'</div>';
589 605
 					} elseif (!isset($spotter_item['aircraft_name']) && isset($spotter_item['airline_name'])) {
@@ -616,7 +632,9 @@  discard block
 block discarded – undo
616 632
 				print '<td class="aircraft_thumbnail">'."\n";
617 633
 				if ($spotter_item['image_source'] == 'wikimedia' || $spotter_item['image_source'] == 'devianart' || $spotter_item['image_source'] == 'flickr') {
618 634
 					$image_thumbnail = preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']);
619
-				} else 	$image_thumbnail = $spotter_item['image_thumbnail'];
635
+				} else {
636
+					$image_thumbnail = $spotter_item['image_thumbnail'];
637
+				}
620 638
 				print '<img src="'.$image_thumbnail.'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['mmsi'].'" alt="'.$spotter_item['mmsi'].'" data-content="'._("MMSI:").' '.$spotter_item['mmsi'].'" data-html="true" width="100px" />'."\n".'<div class="thumbnail-copyright">&copy; '.$spotter_item['image_copyright'].'</div>';
621 639
 				print '</td>'."\n";
622 640
 			} else {
@@ -630,7 +648,9 @@  discard block
 block discarded – undo
630 648
 				print '<td class="aircraft_thumbnail">'."\n";
631 649
 				if ($spotter_item['image_source'] == 'wikimedia' || $spotter_item['image_source'] == 'devianart' || $spotter_item['image_source'] == 'flickr') {
632 650
 					$image_thumbnail = preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']);
633
-				} else 	$image_thumbnail = $spotter_item['image_thumbnail'];
651
+				} else {
652
+					$image_thumbnail = $spotter_item['image_thumbnail'];
653
+				}
634 654
 				print '<img src="'.$image_thumbnail.'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['ident'].'" alt="'.$spotter_item['type'].'" data-content="'._("Type:").' '.$spotter_item['type'].'" data-html="true" width="100px" />'."\n".'<div class="thumbnail-copyright">&copy; '.$spotter_item['image_copyright'].'</div>';
635 655
 				print '</td>'."\n";
636 656
 			} else {
@@ -783,15 +803,21 @@  discard block
 block discarded – undo
783 803
 			if (isset($spotter_item['departure_airport_time']) && isset($spotter_item['real_departure_airport_time'])) {
784 804
 				if ($spotter_item['departure_airport_time'] > 2460) {
785 805
 					$departure_airport_time = date('H:m',$spotter_item['departure_airport_time']);
786
-				} else $departure_airport_time = substr($spotter_item['departure_airport_time'],0,-2).':'.substr($spotter_item['departure_airport_time'],-2);
806
+				} else {
807
+					$departure_airport_time = substr($spotter_item['departure_airport_time'],0,-2).':'.substr($spotter_item['departure_airport_time'],-2);
808
+				}
787 809
 				if ($spotter_item['real_departure_airport_time'] > 2460) {
788 810
 					$real_departure_airport_time = date('H:m',$spotter_item['real_departure_airport_time']);
789
-				} else $real_departure_airport_time = $spotter_item['real_departure_airport_time'];
811
+				} else {
812
+					$real_departure_airport_time = $spotter_item['real_departure_airport_time'];
813
+				}
790 814
 				print '<br /><span class="airport_time">'.$departure_airport_time.' ('.$real_departure_airport_time.')</span>'."\n";
791 815
 			} elseif (isset($spotter_item['real_departure_airport_time']) && $spotter_item['real_departure_airport_time'] != 'NULL') {
792 816
 				if ($spotter_item['real_departure_airport_time'] > 2460) {
793 817
 					$real_departure_airport_time = date('H:m',$spotter_item['real_departure_airport_time']);
794
-				} else $real_departure_airport_time = $spotter_item['real_departure_airport_time'];
818
+				} else {
819
+					$real_departure_airport_time = $spotter_item['real_departure_airport_time'];
820
+				}
795 821
 				print '<br /><span class="airport_time">'.$real_departure_airport_time.'</span>'."\n";
796 822
 			} elseif (isset($spotter_item['departure_airport_time']) && $spotter_item['departure_airport_time'] != 'NULL') {
797 823
 				if ($spotter_item['departure_airport_time'] > 2460) {
@@ -813,7 +839,9 @@  discard block
 block discarded – undo
813 839
 						$longitude = $spotter_item['longitude'];
814 840
 					}
815 841
 					$distance = $Spotter->getAirportDistance($spotter_item['departure_airport'],$latitude,$longitude);
816
-				} else $distance = '';
842
+				} else {
843
+					$distance = '';
844
+				}
817 845
 				if ($distance != '') {
818 846
 					if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'nm') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'nm')) {
819 847
 						echo '<br/><i>'.round($distance*0.539957).' nm</i>';
@@ -840,7 +868,9 @@  discard block
 block discarded – undo
840 868
 			} else {
841 869
 				if (isset($spotter_item['real_arrival_airport']) && $spotter_item['real_arrival_airport'] != $spotter_item['arrival_airport']) {
842 870
 					print '<span class="nomobile">Scheduled : <a href="'.$globalURL.'/airport/'.$spotter_item['arrival_airport'].'">'.$spotter_item['arrival_airport_city'].', '.$spotter_item['arrival_airport_country'].' ('.$spotter_item['arrival_airport'].')</a></span>'."\n";
843
-					if (!isset($Spotter)) $Spotter = new Spotter();
871
+					if (!isset($Spotter)) {
872
+						$Spotter = new Spotter();
873
+					}
844 874
 					$arrival_airport_info = $Spotter->getAllAirportInfo($spotter_item['real_arrival_airport']);
845 875
 					print '<br /><span class="nomobile">'._("Real:").' <a href="'.$globalURL.'/airport/'.$spotter_item['real_arrival_airport'].'">'.$arrival_airport_info[0]['city'].','.$arrival_airport_info[0]['country'].' ('.$spotter_item['real_arrival_airport'].')</a></span>'."\n";
846 876
 					print '<span class="mobile">'._("Scheduled:").' <a href="'.$globalURL.'/airport/'.$spotter_item['real_arrival_airport'].'">'.$spotter_item['real_arrival_airport'].'</a></span>'."\n";
@@ -856,20 +886,28 @@  discard block
 block discarded – undo
856 886
 			if (isset($spotter_item['arrival_airport_time']) && isset($spotter_item['real_arrival_airport_time'])) {
857 887
 				if ($spotter_item['arrival_airport_time'] > 2460) {
858 888
 					$arrival_airport_time = date('H:m',$spotter_item['arrival_airport_time']);
859
-				} else $arrival_airport_time = $spotter_item['arrival_airport_time'];
889
+				} else {
890
+					$arrival_airport_time = $spotter_item['arrival_airport_time'];
891
+				}
860 892
 				if ($spotter_item['real_arrival_airport_time'] > 2460) {
861 893
 					$real_arrival_airport_time = date('H:m',$spotter_item['real_arrival_airport_time']);
862
-				} else $real_arrival_airport_time = $spotter_item['real_arrival_airport_time'];
894
+				} else {
895
+					$real_arrival_airport_time = $spotter_item['real_arrival_airport_time'];
896
+				}
863 897
 				print '<br /><span class="airport_time">'.$spotter_item['arrival_airport_time'].' ('.$spotter_item['real_arrival_airport_time'].')</span>'."\n";
864 898
 			} elseif (isset($spotter_item['real_arrival_airport_time'])) {
865 899
 				if ($spotter_item['real_arrival_airport_time'] > 2460) {
866 900
 					$real_arrival_airport_time = date('H:m',$spotter_item['real_arrival_airport_time']);
867
-				} else $real_arrival_airport_time = $spotter_item['real_arrival_airport_time'];
901
+				} else {
902
+					$real_arrival_airport_time = $spotter_item['real_arrival_airport_time'];
903
+				}
868 904
 				print '<br /><span class="airport_time">'.$real_arrival_airport_time.'</span>'."\n";
869 905
 			} elseif (isset($spotter_item['arrival_airport_time']) && $spotter_item['arrival_airport_time'] != 'NULL') {
870 906
 				if ($spotter_item['arrival_airport_time'] > 2460) {
871 907
 					$arrival_airport_time = date('H:m',$spotter_item['arrival_airport_time']);
872
-				} else $arrival_airport_time = $spotter_item['arrival_airport_time'];
908
+				} else {
909
+					$arrival_airport_time = $spotter_item['arrival_airport_time'];
910
+				}
873 911
 				print '<br /><span class="airport_time">'.$arrival_airport_time.'</span>'."\n";
874 912
 			}
875 913
 			if (!isset($spotter_item['real_arrival_airport']) && $spotter_item['arrival_airport'] != 'NA') {
@@ -882,7 +920,9 @@  discard block
 block discarded – undo
882 920
 						$longitude = $spotter_item['longitude'];
883 921
 					}
884 922
 					$distance = $Spotter->getAirportDistance($spotter_item['arrival_airport'],$latitude,$longitude);
885
-				} else $distance = '';
923
+				} else {
924
+					$distance = '';
925
+				}
886 926
 				if ($distance != '') {
887 927
 					if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'nm') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'nm')) {
888 928
 						echo '<br/><i>'.round($distance*0.539957).' nm</i>';
Please login to merge, or discard this patch.
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -277,7 +277,7 @@  discard block
 block discarded – undo
277 277
 				print '<th class="arrival"><span class="nomobile">'._("Going to").'</span><span class="mobile">'._("To").'</span></th>';
278 278
 			}
279 279
 		}
280
-    		if ($type == 'aircraft') {
280
+			if ($type == 'aircraft') {
281 281
 			if ((isset($globalUsePilot) && $globalUsePilot) || (!isset($globalUsePilot) && ((isset($globalVA) && $globalVA) || (isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalVAM) && $globalVAM) || (isset($globalphpVMS) && $globalphpVMS)))) {
282 282
 				print '<th class="pilot"><span class="nomobile">'._("Pilot name").'</span><span class="mobile">'._("Pilot").'</span></a></th>';
283 283
 			}
@@ -579,7 +579,7 @@  discard block
 block discarded – undo
579 579
 	} elseif(strtolower($current_page) != "currently" && strtolower($current_page) != "upcoming" && strtolower($current_page) != "acars-latest" && strtolower($current_page) != "acars-archive" && strtolower($current_page) != "accident-latest" && strtolower($current_page) != "incident-latest" && strtolower($current_page) != "accident-detailed" && strtolower($current_page) != "incident-detailed"){
580 580
 		if ($type == 'aircraft') {
581 581
 			if (!isset($spotter_item['squawk']) || $spotter_item['squawk'] == 0) {
582
-			    $spotter_item['squawk'] = '-';
582
+				$spotter_item['squawk'] = '-';
583 583
 			}
584 584
 			if ($spotter_item['image_thumbnail'] != "")
585 585
 			{
@@ -618,7 +618,7 @@  discard block
 block discarded – undo
618 618
 				print '</td>'."\n";
619 619
 			} else {
620 620
 				print '<td class="aircraft_thumbnail">'."\n";
621
-	       //   	 	print '<a href="'.$globalURL.'/flightid/'.$spotter_item['spotter_id'].'"><img src="'.$globalURL.'/images/placeholder_thumb.png" alt="Click to see more information about this flight" title="Click to see more information about this flight" width="100px" /></a>';
621
+		   //   	 	print '<a href="'.$globalURL.'/flightid/'.$spotter_item['spotter_id'].'"><img src="'.$globalURL.'/images/placeholder_thumb.png" alt="Click to see more information about this flight" title="Click to see more information about this flight" width="100px" /></a>';
622 622
 		//}
623 623
 				if (!isset($spotter_item['airline_name']) && !isset($spotter_item['aircraft_name'])) {
624 624
 					print '<a href="'.$globalURL.'/flightid/'.$spotter_item['spotter_id'].'"><img src="'.$globalURL.'/images/placeholder_thumb.png" class="img-rounded" data-toggle="popover" title="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '._("Not available").'" alt="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '._("Not available").'" data-content="'._("Registration:").' '.$spotter_item['registration'].'<br />'._("Aircraft:").' '._("Not available").' ('.$spotter_item['aircraft_type'].')<br />'._("Airline:").' '._("Not available").'<br />'._("Squawk:").' '.$spotter_item['squawk'].'" data-html="true" width="100px" /></a>'."\n";
Please login to merge, or discard this patch.
Spacing   +47 added lines, -47 removed lines patch added patch discarded remove patch
@@ -4,8 +4,8 @@  discard block
 block discarded – undo
4 4
 
5 5
 require_once(dirname(__FILE__).'/require/class.Common.php');
6 6
 $Common = new Common();
7
-$showRouteStop = $Common->multiKeyExists($spotter_array,'route_stop');
8
-$showDuration = $Common->multiKeyExists($spotter_array,'duration');
7
+$showRouteStop = $Common->multiKeyExists($spotter_array, 'route_stop');
8
+$showDuration = $Common->multiKeyExists($spotter_array, 'duration');
9 9
 
10 10
 if (!isset($type)) $type = 'aircraft';
11 11
 
@@ -106,7 +106,7 @@  discard block
 block discarded – undo
106 106
 	}
107 107
 	print '<th class="more"></th>';
108 108
 	print '</thead>';
109
-} else if (strtolower($current_page) == "upcoming"){
109
+} else if (strtolower($current_page) == "upcoming") {
110 110
 	print '<thead>';
111 111
 	if (!isset($globalNoAirlines) || $globalNoAirlines === FALSE) {
112 112
 		if ($_GET['sort'] == "airline_name_asc")
@@ -160,7 +160,7 @@  discard block
 block discarded – undo
160 160
 	}
161 161
 	*/
162 162
 	print '</thead>';
163
-} else if (strtolower($current_page) == "acars-latest" || strtolower($current_page) == "acars-archive"){
163
+} else if (strtolower($current_page) == "acars-latest" || strtolower($current_page) == "acars-archive") {
164 164
 	print '<thead>';
165 165
 	print '<th class="aircraft_thumbnail"></th>';
166 166
 	print '<th class="logo">'._("Airline").'</th>';
@@ -197,7 +197,7 @@  discard block
 block discarded – undo
197 197
 	print '</thead>';
198 198
 } else {
199 199
 
200
-	if ($hide_th_links === true){
200
+	if ($hide_th_links === true) {
201 201
 		print '<thead>';
202 202
 		print '<th class="aircraft_thumbnail"></th>';
203 203
 		if ($type == 'aircraft') {
@@ -454,7 +454,7 @@  discard block
 block discarded – undo
454 454
 }
455 455
 
456 456
 print '<tbody>'."\n";
457
-foreach($spotter_array as $spotter_item)
457
+foreach ($spotter_array as $spotter_item)
458 458
 {
459 459
 	if (isset($globalTimezone))
460 460
 	{
@@ -489,13 +489,13 @@  discard block
 block discarded – undo
489 489
 						$image_src = 'https://www.planespotters.net/Aviation_Photos/photo.show?id='.$planespotter_id;
490 490
 					}
491 491
 					if (isset($spotter_item['airline_name'])) {
492
-						print '<a href="'.$image_src.'"><img src="'.preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']).'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['registration'].' - '.$spotter_item['airline_name'].'" alt="'.$spotter_item['registration'].' - '.$spotter_item['airline_name'].'" data-content="'._("Registration:").' '.$spotter_item['registration'].'<br />'._("Airline:").' '.$spotter_item['airline_name'].'" data-html="true" width="100px" /></a>'."\n".'<div class="thumbnail-copyright">&copy; '.$spotter_item['image_copyright'].'</div>';
492
+						print '<a href="'.$image_src.'"><img src="'.preg_replace("/^http:/i", "https:", $spotter_item['image_thumbnail']).'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['registration'].' - '.$spotter_item['airline_name'].'" alt="'.$spotter_item['registration'].' - '.$spotter_item['airline_name'].'" data-content="'._("Registration:").' '.$spotter_item['registration'].'<br />'._("Airline:").' '.$spotter_item['airline_name'].'" data-html="true" width="100px" /></a>'."\n".'<div class="thumbnail-copyright">&copy; '.$spotter_item['image_copyright'].'</div>';
493 493
 					} else {
494
-						print '<a href="'.$image_src.'"><img src="'.preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']).'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['registration'].' - '._("Not available").'" alt="'.$spotter_item['registration'].' - '._("Not available").'" data-content="'._("Registration:").' '.$spotter_item['registration'].'<br />'._("Airline:").' '._("Not available").'" data-html="true" width="100px" /></a>'."\n".'<div class="thumbnail-copyright">&copy; '.$spotter_item['image_copyright'].'</div>';
494
+						print '<a href="'.$image_src.'"><img src="'.preg_replace("/^http:/i", "https:", $spotter_item['image_thumbnail']).'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['registration'].' - '._("Not available").'" alt="'.$spotter_item['registration'].' - '._("Not available").'" data-content="'._("Registration:").' '.$spotter_item['registration'].'<br />'._("Airline:").' '._("Not available").'" data-html="true" width="100px" /></a>'."\n".'<div class="thumbnail-copyright">&copy; '.$spotter_item['image_copyright'].'</div>';
495 495
 					}
496 496
 				} else {
497 497
 					if ($spotter_item['image_source'] == 'wikimedia' || $spotter_item['image_source'] == 'devianart' || $spotter_item['image_source'] == 'flickr') {
498
-						$image_thumbnail = preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']);
498
+						$image_thumbnail = preg_replace("/^http:/i", "https:", $spotter_item['image_thumbnail']);
499 499
 					} else 	$image_thumbnail = $spotter_item['image_thumbnail'];
500 500
 					if (isset($spotter_item['airline_name'])) {
501 501
 						print '<img src="'.$image_thumbnail.'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['registration'].' - '.$spotter_item['airline_name'].'" alt="'.$spotter_item['registration'].' - '.$spotter_item['airline_name'].'" data-content="'._("Registration:").' '.$spotter_item['registration'].'<br />'._("Airline:").' '.$spotter_item['airline_name'].'" data-html="true" width="100px" />'."\n".'<div class="thumbnail-copyright">&copy; '.$spotter_item['image_copyright'].'</div>';
@@ -514,7 +514,7 @@  discard block
 block discarded – undo
514 514
 			{
515 515
 				print '<td class="aircraft_thumbnail">'."\n";
516 516
 				if ($spotter_item['image_source'] == 'wikimedia' || $spotter_item['image_source'] == 'devianart' || $spotter_item['image_source'] == 'flickr') {
517
-					$image_thumbnail = preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']);
517
+					$image_thumbnail = preg_replace("/^http:/i", "https:", $spotter_item['image_thumbnail']);
518 518
 				} else 	$image_thumbnail = $spotter_item['image_thumbnail'];
519 519
 				if (isset($spotter_item['airline_name'])) {
520 520
 					print '<img src="'.$image_thumbnail.'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['mmsi'].'" alt="'.$spotter_item['mmsi'].'" data-content="'._("MMSI:").' '.$spotter_item['mmsi'].'" data-html="true" width="100px" />'."\n".'<div class="thumbnail-copyright">&copy; '.$spotter_item['image_copyright'].'</div>';
@@ -532,7 +532,7 @@  discard block
 block discarded – undo
532 532
 			{
533 533
 				print '<td class="aircraft_thumbnail">'."\n";
534 534
 				if ($spotter_item['image_source'] == 'wikimedia' || $spotter_item['image_source'] == 'devianart' || $spotter_item['image_source'] == 'flickr') {
535
-					$image_thumbnail = preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']);
535
+					$image_thumbnail = preg_replace("/^http:/i", "https:", $spotter_item['image_thumbnail']);
536 536
 				} else 	$image_thumbnail = $spotter_item['image_thumbnail'];
537 537
 				print '<img src="'.$image_thumbnail.'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['ident'].'" alt="'.$spotter_item['type'].'" data-content="'._("Type:").' '.$spotter_item['type'].'" data-html="true" width="100px" />'."\n".'<div class="thumbnail-copyright">&copy; '.$spotter_item['image_copyright'].'</div>';
538 538
 				print '</td>'."\n";
@@ -576,7 +576,7 @@  discard block
 block discarded – undo
576 576
 				print '</td>'."\n";
577 577
 			}
578 578
 		}
579
-	} elseif(strtolower($current_page) != "currently" && strtolower($current_page) != "upcoming" && strtolower($current_page) != "acars-latest" && strtolower($current_page) != "acars-archive" && strtolower($current_page) != "accident-latest" && strtolower($current_page) != "incident-latest" && strtolower($current_page) != "accident-detailed" && strtolower($current_page) != "incident-detailed"){
579
+	} elseif (strtolower($current_page) != "currently" && strtolower($current_page) != "upcoming" && strtolower($current_page) != "acars-latest" && strtolower($current_page) != "acars-archive" && strtolower($current_page) != "accident-latest" && strtolower($current_page) != "incident-latest" && strtolower($current_page) != "accident-detailed" && strtolower($current_page) != "incident-detailed") {
580 580
 		if ($type == 'aircraft') {
581 581
 			if (!isset($spotter_item['squawk']) || $spotter_item['squawk'] == 0) {
582 582
 			    $spotter_item['squawk'] = '-';
@@ -593,17 +593,17 @@  discard block
 block discarded – undo
593 593
 						$image_src = 'https://www.planespotters.net/Aviation_Photos/photo.show?id='.$planespotter_id;
594 594
 					}
595 595
 					if (!isset($spotter_item['airline_name']) && isset($spotter_item['aircraft_name'])) {
596
-						print '<a href="'.$image_src.'"><img src="'.preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']).'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '._("Not available").'" alt="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '._("Not available").'" data-content="'._("Registration:").' '.$spotter_item['registration'].'<br />'._("Aircraft:").' '.$spotter_item['aircraft_name'].' ('.$spotter_item['aircraft_type'].')<br />'._("Airline:").' '._("Not available").'<br />'._("Squawk:").' '.$spotter_item['squawk'].'" data-html="true" width="100px" /></a>'."\n".'<div class="thumbnail-copyright">&copy; '.$spotter_item['image_copyright'].'</div>';
596
+						print '<a href="'.$image_src.'"><img src="'.preg_replace("/^http:/i", "https:", $spotter_item['image_thumbnail']).'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '._("Not available").'" alt="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '._("Not available").'" data-content="'._("Registration:").' '.$spotter_item['registration'].'<br />'._("Aircraft:").' '.$spotter_item['aircraft_name'].' ('.$spotter_item['aircraft_type'].')<br />'._("Airline:").' '._("Not available").'<br />'._("Squawk:").' '.$spotter_item['squawk'].'" data-html="true" width="100px" /></a>'."\n".'<div class="thumbnail-copyright">&copy; '.$spotter_item['image_copyright'].'</div>';
597 597
 					} elseif (!isset($spotter_item['aircraft_name']) && isset($spotter_item['airline_name'])) {
598
-						print '<a href="'.$image_src.'"><img src="'.preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']).'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '.$spotter_item['airline_name'].'" alt="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '.$spotter_item['airline_name'].'" data-content="'._("Registration:").' '.$spotter_item['registration'].'<br />'._("Aircraft:").' ('.$spotter_item['aircraft_type'].')<br />'._("Airline:").' '.$spotter_item['airline_name'].'<br />'._("Squawk:").' '.$spotter_item['squawk'].'" data-html="true" width="100px" /></a>'."\n".'<div class="thumbnail-copyright">&copy; '.$spotter_item['image_copyright'].'</div>';
598
+						print '<a href="'.$image_src.'"><img src="'.preg_replace("/^http:/i", "https:", $spotter_item['image_thumbnail']).'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '.$spotter_item['airline_name'].'" alt="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '.$spotter_item['airline_name'].'" data-content="'._("Registration:").' '.$spotter_item['registration'].'<br />'._("Aircraft:").' ('.$spotter_item['aircraft_type'].')<br />'._("Airline:").' '.$spotter_item['airline_name'].'<br />'._("Squawk:").' '.$spotter_item['squawk'].'" data-html="true" width="100px" /></a>'."\n".'<div class="thumbnail-copyright">&copy; '.$spotter_item['image_copyright'].'</div>';
599 599
 					} elseif (!isset($spotter_item['aircraft_name']) && !isset($spotter_item['airline_name'])) {
600
-						print '<a href="'.$image_src.'"><img src="'.preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']).'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '._("Not available").'" alt="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '._("Not available").'" data-content="'._("Registration:").' '.$spotter_item['registration'].'<br />'._("Aircraft:").' ('.$spotter_item['aircraft_type'].')<br />'._("Airline:").' '._("Not available").'<br />'._("Squawk:").' '.$spotter_item['squawk'].'" data-html="true" width="100px" /></a>'."\n".'<div class="thumbnail-copyright">&copy; '.$spotter_item['image_copyright'].'</div>';
600
+						print '<a href="'.$image_src.'"><img src="'.preg_replace("/^http:/i", "https:", $spotter_item['image_thumbnail']).'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '._("Not available").'" alt="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '._("Not available").'" data-content="'._("Registration:").' '.$spotter_item['registration'].'<br />'._("Aircraft:").' ('.$spotter_item['aircraft_type'].')<br />'._("Airline:").' '._("Not available").'<br />'._("Squawk:").' '.$spotter_item['squawk'].'" data-html="true" width="100px" /></a>'."\n".'<div class="thumbnail-copyright">&copy; '.$spotter_item['image_copyright'].'</div>';
601 601
 					} else {
602
-						print '<a href="'.$image_src.'"><img src="'.preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']).'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '.$spotter_item['airline_name'].'" alt="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '.$spotter_item['airline_name'].'" data-content="'._("Registration:").' '.$spotter_item['registration'].'<br />'._("Aircraft:").' '.$spotter_item['aircraft_name'].' ('.$spotter_item['aircraft_type'].')<br />'._("Airline:").' '.$spotter_item['airline_name'].'<br />'._("Squawk:").' '.$spotter_item['squawk'].'" data-html="true" width="100px" /></a>'."\n".'<div class="thumbnail-copyright">&copy; '.$spotter_item['image_copyright'].'</div>';
602
+						print '<a href="'.$image_src.'"><img src="'.preg_replace("/^http:/i", "https:", $spotter_item['image_thumbnail']).'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '.$spotter_item['airline_name'].'" alt="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '.$spotter_item['airline_name'].'" data-content="'._("Registration:").' '.$spotter_item['registration'].'<br />'._("Aircraft:").' '.$spotter_item['aircraft_name'].' ('.$spotter_item['aircraft_type'].')<br />'._("Airline:").' '.$spotter_item['airline_name'].'<br />'._("Squawk:").' '.$spotter_item['squawk'].'" data-html="true" width="100px" /></a>'."\n".'<div class="thumbnail-copyright">&copy; '.$spotter_item['image_copyright'].'</div>';
603 603
 					}
604 604
 				} else {
605 605
 					if ($spotter_item['image_source'] == 'wikimedia' || $spotter_item['image_source'] == 'devianart' || $spotter_item['image_source'] == 'flickr') {
606
-						$image_thumbnail = preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']);
606
+						$image_thumbnail = preg_replace("/^http:/i", "https:", $spotter_item['image_thumbnail']);
607 607
 					} else 	$image_thumbnail = $spotter_item['image_thumbnail'];
608 608
 					if (!isset($spotter_item['airline_name']) && isset($spotter_item['aircraft_name'])) {
609 609
 						print '<a href="'.$globalURL.'/flightid/'.$spotter_item['spotter_id'].'"><img src="'.$image_thumbnail.'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '._("Not available").'" alt="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '._("Not available").'" data-content="'._("Registration:").' '.$spotter_item['registration'].'<br />'._("Aircraft:").' '.$spotter_item['aircraft_name'].' ('.$spotter_item['aircraft_type'].')<br />'._("Airline:").' '._("Not available").'<br />'._("Squawk:").' '.$spotter_item['squawk'].'" data-html="true" width="100px" /></a>'."\n".'<div class="thumbnail-copyright">&copy; '.$spotter_item['image_copyright'].'</div>';
@@ -636,7 +636,7 @@  discard block
 block discarded – undo
636 636
 			{
637 637
 				print '<td class="aircraft_thumbnail">'."\n";
638 638
 				if ($spotter_item['image_source'] == 'wikimedia' || $spotter_item['image_source'] == 'devianart' || $spotter_item['image_source'] == 'flickr') {
639
-					$image_thumbnail = preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']);
639
+					$image_thumbnail = preg_replace("/^http:/i", "https:", $spotter_item['image_thumbnail']);
640 640
 				} else 	$image_thumbnail = $spotter_item['image_thumbnail'];
641 641
 				print '<img src="'.$image_thumbnail.'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['mmsi'].'" alt="'.$spotter_item['mmsi'].'" data-content="'._("MMSI:").' '.$spotter_item['mmsi'].'" data-html="true" width="100px" />'."\n".'<div class="thumbnail-copyright">&copy; '.$spotter_item['image_copyright'].'</div>';
642 642
 				print '</td>'."\n";
@@ -650,7 +650,7 @@  discard block
 block discarded – undo
650 650
 			{
651 651
 				print '<td class="aircraft_thumbnail">'."\n";
652 652
 				if ($spotter_item['image_source'] == 'wikimedia' || $spotter_item['image_source'] == 'devianart' || $spotter_item['image_source'] == 'flickr') {
653
-					$image_thumbnail = preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']);
653
+					$image_thumbnail = preg_replace("/^http:/i", "https:", $spotter_item['image_thumbnail']);
654 654
 				} else 	$image_thumbnail = $spotter_item['image_thumbnail'];
655 655
 				print '<img src="'.$image_thumbnail.'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['ident'].'" alt="'.$spotter_item['type'].'" data-content="'._("Type:").' '.$spotter_item['type'].'" data-html="true" width="100px" />'."\n".'<div class="thumbnail-copyright">&copy; '.$spotter_item['image_copyright'].'</div>';
656 656
 				print '</td>'."\n";
@@ -759,7 +759,7 @@  discard block
 block discarded – undo
759 759
 		print '</td>'."\n";
760 760
 	}
761 761
 	// Aircraft type
762
-	if(strtolower($current_page) != "upcoming" && strtolower($current_page) != "acars-latest" && strtolower($current_page) != "acars-archive"){
762
+	if (strtolower($current_page) != "upcoming" && strtolower($current_page) != "acars-latest" && strtolower($current_page) != "acars-archive") {
763 763
 		print '<td class="type">'."\n";
764 764
 		if ($type == 'aircraft') {
765 765
 			if (!isset($spotter_item['aircraft_type']) && isset($spotter_item['aircraft_name'])) {
@@ -810,22 +810,22 @@  discard block
 block discarded – undo
810 810
 			}
811 811
 			if (isset($spotter_item['departure_airport_time']) && isset($spotter_item['real_departure_airport_time'])) {
812 812
 				if ($spotter_item['departure_airport_time'] > 2460) {
813
-					$departure_airport_time = date('H:m',$spotter_item['departure_airport_time']);
814
-				} else $departure_airport_time = substr($spotter_item['departure_airport_time'],0,-2).':'.substr($spotter_item['departure_airport_time'],-2);
813
+					$departure_airport_time = date('H:m', $spotter_item['departure_airport_time']);
814
+				} else $departure_airport_time = substr($spotter_item['departure_airport_time'], 0, -2).':'.substr($spotter_item['departure_airport_time'], -2);
815 815
 				if ($spotter_item['real_departure_airport_time'] > 2460) {
816
-					$real_departure_airport_time = date('H:m',$spotter_item['real_departure_airport_time']);
816
+					$real_departure_airport_time = date('H:m', $spotter_item['real_departure_airport_time']);
817 817
 				} else $real_departure_airport_time = $spotter_item['real_departure_airport_time'];
818 818
 				print '<br /><span class="airport_time">'.$departure_airport_time.' ('.$real_departure_airport_time.')</span>'."\n";
819 819
 			} elseif (isset($spotter_item['real_departure_airport_time']) && $spotter_item['real_departure_airport_time'] != 'NULL') {
820 820
 				if ($spotter_item['real_departure_airport_time'] > 2460) {
821
-					$real_departure_airport_time = date('H:m',$spotter_item['real_departure_airport_time']);
821
+					$real_departure_airport_time = date('H:m', $spotter_item['real_departure_airport_time']);
822 822
 				} else $real_departure_airport_time = $spotter_item['real_departure_airport_time'];
823 823
 				print '<br /><span class="airport_time">'.$real_departure_airport_time.'</span>'."\n";
824 824
 			} elseif (isset($spotter_item['departure_airport_time']) && $spotter_item['departure_airport_time'] != 'NULL') {
825 825
 				if ($spotter_item['departure_airport_time'] > 2460) {
826
-					$departure_airport_time = date('H:m',$spotter_item['departure_airport_time']);
826
+					$departure_airport_time = date('H:m', $spotter_item['departure_airport_time']);
827 827
 				} else {
828
-					$departure_airport_time = substr($spotter_item['departure_airport_time'],0,-2).':'.substr($spotter_item['departure_airport_time'],-2);
828
+					$departure_airport_time = substr($spotter_item['departure_airport_time'], 0, -2).':'.substr($spotter_item['departure_airport_time'], -2);
829 829
 				}
830 830
 				print '<br /><span class="airport_time">'.$departure_airport_time.'</span>'."\n";
831 831
 			}
@@ -840,7 +840,7 @@  discard block
 block discarded – undo
840 840
 						$latitude = $spotter_item['latitude'];
841 841
 						$longitude = $spotter_item['longitude'];
842 842
 					}
843
-					$distance = $Spotter->getAirportDistance($spotter_item['departure_airport'],$latitude,$longitude);
843
+					$distance = $Spotter->getAirportDistance($spotter_item['departure_airport'], $latitude, $longitude);
844 844
 				} else $distance = '';
845 845
 				if ($distance != '') {
846 846
 					if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'nm') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'nm')) {
@@ -883,20 +883,20 @@  discard block
 block discarded – undo
883 883
 			}
884 884
 			if (isset($spotter_item['arrival_airport_time']) && isset($spotter_item['real_arrival_airport_time'])) {
885 885
 				if ($spotter_item['arrival_airport_time'] > 2460) {
886
-					$arrival_airport_time = date('H:m',$spotter_item['arrival_airport_time']);
886
+					$arrival_airport_time = date('H:m', $spotter_item['arrival_airport_time']);
887 887
 				} else $arrival_airport_time = $spotter_item['arrival_airport_time'];
888 888
 				if ($spotter_item['real_arrival_airport_time'] > 2460) {
889
-					$real_arrival_airport_time = date('H:m',$spotter_item['real_arrival_airport_time']);
889
+					$real_arrival_airport_time = date('H:m', $spotter_item['real_arrival_airport_time']);
890 890
 				} else $real_arrival_airport_time = $spotter_item['real_arrival_airport_time'];
891 891
 				print '<br /><span class="airport_time">'.$spotter_item['arrival_airport_time'].' ('.$spotter_item['real_arrival_airport_time'].')</span>'."\n";
892 892
 			} elseif (isset($spotter_item['real_arrival_airport_time'])) {
893 893
 				if ($spotter_item['real_arrival_airport_time'] > 2460) {
894
-					$real_arrival_airport_time = date('H:m',$spotter_item['real_arrival_airport_time']);
894
+					$real_arrival_airport_time = date('H:m', $spotter_item['real_arrival_airport_time']);
895 895
 				} else $real_arrival_airport_time = $spotter_item['real_arrival_airport_time'];
896 896
 				print '<br /><span class="airport_time">'.$real_arrival_airport_time.'</span>'."\n";
897 897
 			} elseif (isset($spotter_item['arrival_airport_time']) && $spotter_item['arrival_airport_time'] != 'NULL') {
898 898
 				if ($spotter_item['arrival_airport_time'] > 2460) {
899
-					$arrival_airport_time = date('H:m',$spotter_item['arrival_airport_time']);
899
+					$arrival_airport_time = date('H:m', $spotter_item['arrival_airport_time']);
900 900
 				} else $arrival_airport_time = $spotter_item['arrival_airport_time'];
901 901
 				print '<br /><span class="airport_time">'.$arrival_airport_time.'</span>'."\n";
902 902
 			}
@@ -909,7 +909,7 @@  discard block
 block discarded – undo
909 909
 						$latitude = $spotter_item['latitude'];
910 910
 						$longitude = $spotter_item['longitude'];
911 911
 					}
912
-					$distance = $Spotter->getAirportDistance($spotter_item['arrival_airport'],$latitude,$longitude);
912
+					$distance = $Spotter->getAirportDistance($spotter_item['arrival_airport'], $latitude, $longitude);
913 913
 				} else $distance = '';
914 914
 				if ($distance != '') {
915 915
 					if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'nm') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'nm')) {
@@ -952,19 +952,19 @@  discard block
 block discarded – undo
952 952
 				print '<span class="mobile">-</span>'."\n";
953 953
 			} else {
954 954
 				if ((!isset($_COOKIE['unitdistance']) && ((isset($globalUnitDistance) && $globalUnitDistance == 'km') || !isset($globalUnitDistance))) || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'km')) {
955
-					print '<span class="nomobile">'.round($spotter_item['distance'],2).' km</span>'."\n";
956
-					print '<span class="mobile">'.round($spotter_item['distance'],2).' km</span><br />'."\n";
955
+					print '<span class="nomobile">'.round($spotter_item['distance'], 2).' km</span>'."\n";
956
+					print '<span class="mobile">'.round($spotter_item['distance'], 2).' km</span><br />'."\n";
957 957
 				} elseif ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'mi') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'mi')) {
958
-					print '<span class="nomobile">'.round($spotter_item['distance']*0.621371,2).' mi</span>'."\n";
959
-					print '<span class="mobile">'.round($spotter_item['distance']*0.621371,2).' mi</span><br />'."\n";
958
+					print '<span class="nomobile">'.round($spotter_item['distance']*0.621371, 2).' mi</span>'."\n";
959
+					print '<span class="mobile">'.round($spotter_item['distance']*0.621371, 2).' mi</span><br />'."\n";
960 960
 				} elseif ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'nm') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'nm')) {
961
-					print '<span class="nomobile">'.round($spotter_item['distance']*0.539957,2).' nm</span>'."\n";
962
-					print '<span class="mobile">'.round($spotter_item['distance']*0.539957,2).' nm</span><br />'."\n";
961
+					print '<span class="nomobile">'.round($spotter_item['distance']*0.539957, 2).' nm</span>'."\n";
962
+					print '<span class="mobile">'.round($spotter_item['distance']*0.539957, 2).' nm</span><br />'."\n";
963 963
 				}
964 964
 			}
965 965
 			print '</td>'."\n";
966 966
 		}
967
-		if(strtolower($current_page) != "upcoming"){
967
+		if (strtolower($current_page) != "upcoming") {
968 968
 			if ($type == 'aircraft') {
969 969
 				//if ((isset($globalVA) && $globalVA) || (isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS)) {
970 970
 				if ((isset($globalUsePilot) && $globalUsePilot) || !isset($globalUsePilot) && ((isset($globalVA) && $globalVA) || (isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS) || (isset($globalVAM) && $globalVAM))) {
@@ -1007,7 +1007,7 @@  discard block
 block discarded – undo
1007 1007
 		
1008 1008
 		if ($showRouteStop) {
1009 1009
 		// Route stop
1010
-			if(strtolower($current_page) != "upcoming"){
1010
+			if (strtolower($current_page) != "upcoming") {
1011 1011
 				print '<td class="route_stop">'."\n";
1012 1012
 				if (!isset($spotter_item['route_stop']) || $spotter_item['route_stop'] == '' || $spotter_item['route_stop'] == 'NULL') {
1013 1013
 					print '<span class="nomobile">-</span>'."\n";
@@ -1026,11 +1026,11 @@  discard block
 block discarded – undo
1026 1026
 		}
1027 1027
 		if ($showDuration) {
1028 1028
 		// Duration
1029
-			if(strtolower($current_page) != "upcoming"){
1029
+			if (strtolower($current_page) != "upcoming") {
1030 1030
 				print '<td class="duration">'."\n";
1031 1031
 				if (isset($spotter_item['duration'])) {
1032
-					print '<span class="nomobile">'.gmdate('H:i:s',$spotter_item['duration']).'</span>'."\n";
1033
-					print '<span class="mobile">'.gmdate('H:i:s',$spotter_item['duration']).'</span>'."\n";
1032
+					print '<span class="nomobile">'.gmdate('H:i:s', $spotter_item['duration']).'</span>'."\n";
1033
+					print '<span class="mobile">'.gmdate('H:i:s', $spotter_item['duration']).'</span>'."\n";
1034 1034
 				} else {
1035 1035
 					print '<span class="nomobile">-</span>'."\n";
1036 1036
 					print '<span class="mobile">-</span>'."\n";
@@ -1043,7 +1043,7 @@  discard block
 block discarded – undo
1043 1043
 	if (strtolower($current_page) == "acars-latest" || strtolower($current_page) == "acars-archive") {
1044 1044
 		if (isset($spotter_item['decode']) && $spotter_item['decode'] != '') {
1045 1045
 			print '<td class="message"><p>'."\n";
1046
-			print str_replace(array("\r\n", "\n", "\r"),'<br />',$spotter_item['message']);
1046
+			print str_replace(array("\r\n", "\n", "\r"), '<br />', $spotter_item['message']);
1047 1047
 			print '</p><p class="decode">';
1048 1048
 			$decode_array = json_decode($spotter_item['decode']);
1049 1049
 			foreach ($decode_array as $key => $value) {
@@ -1053,7 +1053,7 @@  discard block
 block discarded – undo
1053 1053
 			print '</td>'."\n";
1054 1054
 		} else {
1055 1055
 			print '<td class="message">'."\n";
1056
-			print str_replace(array("\r\n", "\n", "\r"),'<br />',$spotter_item['message']);
1056
+			print str_replace(array("\r\n", "\n", "\r"), '<br />', $spotter_item['message']);
1057 1057
 			print '</td>'."\n";
1058 1058
 		}
1059 1059
 	}
@@ -1078,7 +1078,7 @@  discard block
 block discarded – undo
1078 1078
 		}
1079 1079
 		print '</td>'."\n";
1080 1080
 		print '<td class="message">'."\n";
1081
-		print str_replace(array("\r\n", "\n", "\r"),'<br />',$spotter_item['message']);
1081
+		print str_replace(array("\r\n", "\n", "\r"), '<br />', $spotter_item['message']);
1082 1082
 		print '</td>'."\n";
1083 1083
 	}
1084 1084
 	if (strtolower($current_page) == "incident-latest" || strtolower($current_page) == "incident-detailed") {
@@ -1104,7 +1104,7 @@  discard block
 block discarded – undo
1104 1104
 		print '</td>'."\n";
1105 1105
 		*/
1106 1106
 		print '<td class="message">'."\n";
1107
-		print str_replace(array("\r\n", "\n", "\r"),'<br />',$spotter_item['message']);
1107
+		print str_replace(array("\r\n", "\n", "\r"), '<br />', $spotter_item['message']);
1108 1108
 		print '</td>'."\n";
1109 1109
 	}
1110 1110
 
Please login to merge, or discard this patch.
js/map-marine.2d.js.php 3 patches
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -2,7 +2,7 @@  discard block
 block discarded – undo
2 2
 require_once('../require/settings.php');
3 3
 require_once('../require/class.Language.php'); 
4 4
 
5
-setcookie("MapFormat",'2d');
5
+setcookie("MapFormat", '2d');
6 6
 
7 7
 // Compressed GeoJson is used if true
8 8
 if (!isset($globalJsonCompress)) $compress = true;
@@ -16,10 +16,10 @@  discard block
 block discarded – undo
16 16
 
17 17
 <?php
18 18
 	if (isset($_GET['fammarine_id'])) {
19
-		$fammarine_id = filter_input(INPUT_GET,'fammarine_id',FILTER_SANITIZE_STRING);
19
+		$fammarine_id = filter_input(INPUT_GET, 'fammarine_id', FILTER_SANITIZE_STRING);
20 20
 	}
21 21
 	if (isset($_GET['ident'])) {
22
-		$ident = filter_input(INPUT_GET,'ident',FILTER_SANITIZE_STRING);
22
+		$ident = filter_input(INPUT_GET, 'ident', FILTER_SANITIZE_STRING);
23 23
 	}
24 24
 	if (!isset($ident) && !isset($fammarine_id)) {
25 25
 ?>
@@ -182,7 +182,7 @@  discard block
 block discarded – undo
182 182
 <?php
183 183
 		} else {
184 184
 ?>
185
-		    var movingtime = Math.round(<?php if (isset($archiveupdatetime)) print $archiveupdatetime*1000; else print $globalMapRefresh*1000+20000; ?>+feature.properties.sqt*1000);
185
+		    var movingtime = Math.round(<?php if (isset($archiveupdatetime)) print $archiveupdatetime*1000; else print $globalMapRefresh*1000 + 20000; ?>+feature.properties.sqt*1000);
186 186
 		    return new L.Marker.movingMarker([latLng, feature.properties.nextlatlon],[movingtime],{
187 187
 <?php
188 188
 		}
@@ -198,7 +198,7 @@  discard block
 block discarded – undo
198 198
 			    /*
199 199
 			    shadowUrl: iconURLShadowpath,
200 200
 			    shadowSize: [<?php print $globalAircraftSize; ?>, <?php print $globalAircraftSize; ?>],
201
-			    shadowAnchor: [<?php print ($globalAircraftSize/2)+1; ?>, <?php print $globalAircraftSize; ?>]
201
+			    shadowAnchor: [<?php print ($globalAircraftSize/2) + 1; ?>, <?php print $globalAircraftSize; ?>]
202 202
 			    */
203 203
 			})
204 204
 		    })
@@ -231,7 +231,7 @@  discard block
 block discarded – undo
231 231
 <?php
232 232
 		} else {
233 233
 ?>
234
-			    var movingtime = Math.round(<?php if (isset($archiveupdatetime)) print $archiveupdatetime*1000; else print $globalMapRefresh*1000+20000; ?>+feature.properties.sqt*1000);
234
+			    var movingtime = Math.round(<?php if (isset($archiveupdatetime)) print $archiveupdatetime*1000; else print $globalMapRefresh*1000 + 20000; ?>+feature.properties.sqt*1000);
235 235
 			    return new L.Marker.movingMarker([latLng, feature.properties.nextlatlon],[movingtime],{
236 236
 <?php
237 237
 		}
@@ -279,7 +279,7 @@  discard block
 block discarded – undo
279 279
 <?php
280 280
 		} else {
281 281
 ?>
282
-			    var movingtime = Math.round(<?php if (isset($archiveupdatetime)) print $archiveupdatetime*1000; else print $globalMapRefresh*1000+20000; ?>+feature.properties.sqt*1000);
282
+			    var movingtime = Math.round(<?php if (isset($archiveupdatetime)) print $archiveupdatetime*1000; else print $globalMapRefresh*1000 + 20000; ?>+feature.properties.sqt*1000);
283 283
 			    return new L.Marker.movingMarker([latLng, feature.properties.nextlatlon],[movingtime],{
284 284
 <?php
285 285
 		}
Please login to merge, or discard this patch.
Braces   +42 added lines, -10 removed lines patch added patch discarded remove patch
@@ -5,8 +5,11 @@  discard block
 block discarded – undo
5 5
 setcookie("MapFormat",'2d');
6 6
 
7 7
 // Compressed GeoJson is used if true
8
-if (!isset($globalJsonCompress)) $compress = true;
9
-else $compress = $globalJsonCompress;
8
+if (!isset($globalJsonCompress)) {
9
+	$compress = true;
10
+} else {
11
+	$compress = $globalJsonCompress;
12
+}
10 13
 ?>
11 14
 
12 15
 
@@ -156,9 +159,13 @@  discard block
 block discarded – undo
156 159
 		    if (callsign != ""){ markerMarineLabel += callsign; }
157 160
 		    if (type != ""){ markerMarineLabel += ' - '+type; }
158 161
 <?php
159
-	if (isset($_COOKIE['MarineIconColor'])) $MarineIconColor = $_COOKIE['MarineIconColor'];
160
-	elseif (isset($globalMarineIconColor)) $MarineIconColor = $globalMarineIconColor;
161
-	else $MarineIconColor = '1a3151';
162
+	if (isset($_COOKIE['MarineIconColor'])) {
163
+		$MarineIconColor = $_COOKIE['MarineIconColor'];
164
+	} elseif (isset($globalMarineIconColor)) {
165
+		$MarineIconColor = $globalMarineIconColor;
166
+	} else {
167
+		$MarineIconColor = '1a3151';
168
+	}
162 169
 	if (!isset($ident) && !isset($fammarine_id)) {
163 170
 ?>
164 171
 		    //info_marine_update(feature.properties.fc);
@@ -193,7 +200,12 @@  discard block
 block discarded – undo
193 200
 <?php
194 201
 		} else {
195 202
 ?>
196
-		    var movingtime = Math.round(<?php if (isset($archiveupdatetime)) print $archiveupdatetime*1000; else print $globalMapRefresh*1000+20000; ?>+feature.properties.sqt*1000);
203
+		    var movingtime = Math.round(<?php if (isset($archiveupdatetime)) {
204
+	print $archiveupdatetime*1000;
205
+} else {
206
+	print $globalMapRefresh*1000+20000;
207
+}
208
+?>+feature.properties.sqt*1000);
197 209
 		    return new L.Marker.movingMarker([latLng, feature.properties.nextlatlon],[movingtime],{
198 210
 <?php
199 211
 		}
@@ -249,7 +261,12 @@  discard block
 block discarded – undo
249 261
 <?php
250 262
 		} else {
251 263
 ?>
252
-			    var movingtime = Math.round(<?php if (isset($archiveupdatetime)) print $archiveupdatetime*1000; else print $globalMapRefresh*1000+20000; ?>+feature.properties.sqt*1000);
264
+			    var movingtime = Math.round(<?php if (isset($archiveupdatetime)) {
265
+	print $archiveupdatetime*1000;
266
+} else {
267
+	print $globalMapRefresh*1000+20000;
268
+}
269
+?>+feature.properties.sqt*1000);
253 270
 			    return new L.Marker.movingMarker([latLng, feature.properties.nextlatlon],[movingtime],{
254 271
 <?php
255 272
 		}
@@ -304,7 +321,12 @@  discard block
 block discarded – undo
304 321
 <?php
305 322
 		} else {
306 323
 ?>
307
-			    var movingtime = Math.round(<?php if (isset($archiveupdatetime)) print $archiveupdatetime*1000; else print $globalMapRefresh*1000+20000; ?>+feature.properties.sqt*1000);
324
+			    var movingtime = Math.round(<?php if (isset($archiveupdatetime)) {
325
+	print $archiveupdatetime*1000;
326
+} else {
327
+	print $globalMapRefresh*1000+20000;
328
+}
329
+?>+feature.properties.sqt*1000);
308 330
 			    return new L.Marker.movingMarker([latLng, feature.properties.nextlatlon],[movingtime],{
309 331
 <?php
310 332
 		}
@@ -594,14 +616,24 @@  discard block
 block discarded – undo
594 616
 	if (isset($archive) && $archive) {
595 617
 ?>
596 618
 //then load it again every 30 seconds
597
-//  var reload = setInterval(function(){if (noTimeout) getLiveMarineData(0)},<?php if (isset($globalMapRefresh)) print ($globalMapRefresh*1000)/2; else print '15000'; ?>);
619
+//  var reload = setInterval(function(){if (noTimeout) getLiveMarineData(0)},<?php if (isset($globalMapRefresh)) {
620
+	print ($globalMapRefresh*1000)/2;
621
+} else {
622
+	print '15000';
623
+}
624
+?>);
598 625
 reloadMarinePage = setInterval(function(){if (noTimeout) getLiveMarineData(0)},<?php print $archiveupdatetime*1000; ?>);
599 626
 <?php
600 627
 	} else {
601 628
 ?>
602 629
 //then load it again every 30 seconds
603 630
 reloadMarinePage = setInterval(
604
-    function(){if (noTimeout) getLiveMarineData(0)},<?php if (isset($globalMapRefresh)) print $globalMapRefresh*1000; else print '30000'; ?>);
631
+    function(){if (noTimeout) getLiveMarineData(0)},<?php if (isset($globalMapRefresh)) {
632
+	print $globalMapRefresh*1000;
633
+} else {
634
+	print '30000';
635
+}
636
+?>);
605 637
 <?php
606 638
 	}
607 639
 ?>
Please login to merge, or discard this patch.
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -553,8 +553,8 @@  discard block
 block discarded – undo
553 553
 			}
554 554
                     }
555 555
 		    <?php
556
-            		} else {
557
-            	    ?>
556
+					} else {
557
+					?>
558 558
 		    if (map.getZoom() > 7) {
559 559
                 	var style = {
560 560
                     	    "color": "#1a3151",
@@ -573,7 +573,7 @@  discard block
 block discarded – undo
573 573
                 	layer_marine_data.addLayer(layer);
574 574
 		    }
575 575
 <?php
576
-            		}
576
+					}
577 577
 ?>
578 578
 				}
579 579
 			    }
@@ -598,11 +598,11 @@  discard block
 block discarded – undo
598 598
 $( document ).ready(function() {
599 599
     map.on('moveend', function() {
600 600
 <?php
601
-    if (isset($globalMapUseBbox) && $globalMapUseBbox) {
601
+	if (isset($globalMapUseBbox) && $globalMapUseBbox) {
602 602
 ?>
603 603
 	getLiveMarineData(1);
604 604
 <?php
605
-    }
605
+	}
606 606
 ?>
607 607
     });
608 608
  //load the function on startup
Please login to merge, or discard this patch.
js/map-tracker.2d.js.php 3 patches
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -2,7 +2,7 @@  discard block
 block discarded – undo
2 2
 require_once('../require/settings.php');
3 3
 require_once('../require/class.Language.php'); 
4 4
 
5
-setcookie("MapFormat",'2d');
5
+setcookie("MapFormat", '2d');
6 6
 
7 7
 // Compressed GeoJson is used if true
8 8
 if (!isset($globalJsonCompress)) $compress = true;
@@ -17,10 +17,10 @@  discard block
 block discarded – undo
17 17
 
18 18
 <?php
19 19
 	if (isset($_GET['famtrackid'])) {
20
-		$famtrackid = filter_input(INPUT_GET,'famtrackid',FILTER_SANITIZE_STRING);
20
+		$famtrackid = filter_input(INPUT_GET, 'famtrackid', FILTER_SANITIZE_STRING);
21 21
 	}
22 22
 	if (isset($_GET['ident'])) {
23
-		$ident = filter_input(INPUT_GET,'ident',FILTER_SANITIZE_STRING);
23
+		$ident = filter_input(INPUT_GET, 'ident', FILTER_SANITIZE_STRING);
24 24
 	}
25 25
 	if (!isset($ident) && !isset($famtrackid)) {
26 26
 ?>
@@ -182,7 +182,7 @@  discard block
 block discarded – undo
182 182
 <?php
183 183
 		} else {
184 184
 ?>
185
-		    var movingtime = Math.round(<?php if (isset($archiveupdatetime)) print $archiveupdatetime*1000; else print $globalMapRefresh*1000+20000; ?>+feature.properties.sqt*1000);
185
+		    var movingtime = Math.round(<?php if (isset($archiveupdatetime)) print $archiveupdatetime*1000; else print $globalMapRefresh*1000 + 20000; ?>+feature.properties.sqt*1000);
186 186
 		    return new L.Marker.movingMarker([latLng, feature.properties.nextlatlon],[movingtime],{
187 187
 <?php
188 188
 		}
@@ -198,7 +198,7 @@  discard block
 block discarded – undo
198 198
 			    /*
199 199
 			    shadowUrl: iconURLShadowpath,
200 200
 			    shadowSize: [<?php print $globalAircraftSize; ?>, <?php print $globalAircraftSize; ?>],
201
-			    shadowAnchor: [<?php print ($globalAircraftSize/2)+1; ?>, <?php print $globalAircraftSize; ?>]
201
+			    shadowAnchor: [<?php print ($globalAircraftSize/2) + 1; ?>, <?php print $globalAircraftSize; ?>]
202 202
 			    */
203 203
 			})
204 204
 		    })
@@ -231,7 +231,7 @@  discard block
 block discarded – undo
231 231
 <?php
232 232
 		} else {
233 233
 ?>
234
-			    var movingtime = Math.round(<?php if (isset($archiveupdatetime)) print $archiveupdatetime*1000; else print $globalMapRefresh*1000+20000; ?>+feature.properties.sqt*1000);
234
+			    var movingtime = Math.round(<?php if (isset($archiveupdatetime)) print $archiveupdatetime*1000; else print $globalMapRefresh*1000 + 20000; ?>+feature.properties.sqt*1000);
235 235
 			    return new L.Marker.movingMarker([latLng, feature.properties.nextlatlon],[movingtime],{
236 236
 <?php
237 237
 		}
@@ -279,7 +279,7 @@  discard block
 block discarded – undo
279 279
 <?php
280 280
 		} else {
281 281
 ?>
282
-			    var movingtime = Math.round(<?php if (isset($archiveupdatetime)) print $archiveupdatetime*1000; else print $globalMapRefresh*1000+20000; ?>+feature.properties.sqt*1000);
282
+			    var movingtime = Math.round(<?php if (isset($archiveupdatetime)) print $archiveupdatetime*1000; else print $globalMapRefresh*1000 + 20000; ?>+feature.properties.sqt*1000);
283 283
 			    return new L.Marker.movingMarker([latLng, feature.properties.nextlatlon],[movingtime],{
284 284
 <?php
285 285
 		}
Please login to merge, or discard this patch.
Braces   +42 added lines, -10 removed lines patch added patch discarded remove patch
@@ -5,8 +5,11 @@  discard block
 block discarded – undo
5 5
 setcookie("MapFormat",'2d');
6 6
 
7 7
 // Compressed GeoJson is used if true
8
-if (!isset($globalJsonCompress)) $compress = true;
9
-else $compress = $globalJsonCompress;
8
+if (!isset($globalJsonCompress)) {
9
+	$compress = true;
10
+} else {
11
+	$compress = $globalJsonCompress;
12
+}
10 13
 ?>
11 14
 
12 15
 
@@ -157,9 +160,13 @@  discard block
 block discarded – undo
157 160
 		    if (callsign != ""){ markerTrackerLabel += callsign; }
158 161
 		    if (type != ""){ markerTrackerLabel += ' - '+type; }
159 162
 <?php
160
-	if (isset($_COOKIE['TrackerIconColor'])) $IconColor = $_COOKIE['TrackerIconColor'];
161
-	elseif (isset($globalTrackerIconColor)) $IconColor = $globalTrackerIconColor;
162
-	else $IconColor = '1a3151';
163
+	if (isset($_COOKIE['TrackerIconColor'])) {
164
+		$IconColor = $_COOKIE['TrackerIconColor'];
165
+	} elseif (isset($globalTrackerIconColor)) {
166
+		$IconColor = $globalTrackerIconColor;
167
+	} else {
168
+		$IconColor = '1a3151';
169
+	}
163 170
 	if (!isset($ident) && !isset($famtrackid)) {
164 171
 ?>
165 172
 		    //info_tracker_update(feature.properties.fc);
@@ -193,7 +200,12 @@  discard block
 block discarded – undo
193 200
 <?php
194 201
 		} else {
195 202
 ?>
196
-		    var movingtime = Math.round(<?php if (isset($archiveupdatetime)) print $archiveupdatetime*1000; else print $globalMapRefresh*1000+20000; ?>+feature.properties.sqt*1000);
203
+		    var movingtime = Math.round(<?php if (isset($archiveupdatetime)) {
204
+	print $archiveupdatetime*1000;
205
+} else {
206
+	print $globalMapRefresh*1000+20000;
207
+}
208
+?>+feature.properties.sqt*1000);
197 209
 		    return new L.Marker.movingMarker([latLng, feature.properties.nextlatlon],[movingtime],{
198 210
 <?php
199 211
 		}
@@ -249,7 +261,12 @@  discard block
 block discarded – undo
249 261
 <?php
250 262
 		} else {
251 263
 ?>
252
-			    var movingtime = Math.round(<?php if (isset($archiveupdatetime)) print $archiveupdatetime*1000; else print $globalMapRefresh*1000+20000; ?>+feature.properties.sqt*1000);
264
+			    var movingtime = Math.round(<?php if (isset($archiveupdatetime)) {
265
+	print $archiveupdatetime*1000;
266
+} else {
267
+	print $globalMapRefresh*1000+20000;
268
+}
269
+?>+feature.properties.sqt*1000);
253 270
 			    return new L.Marker.movingMarker([latLng, feature.properties.nextlatlon],[movingtime],{
254 271
 <?php
255 272
 		}
@@ -304,7 +321,12 @@  discard block
 block discarded – undo
304 321
 <?php
305 322
 		} else {
306 323
 ?>
307
-			    var movingtime = Math.round(<?php if (isset($archiveupdatetime)) print $archiveupdatetime*1000; else print $globalMapRefresh*1000+20000; ?>+feature.properties.sqt*1000);
324
+			    var movingtime = Math.round(<?php if (isset($archiveupdatetime)) {
325
+	print $archiveupdatetime*1000;
326
+} else {
327
+	print $globalMapRefresh*1000+20000;
328
+}
329
+?>+feature.properties.sqt*1000);
308 330
 			    return new L.Marker.movingMarker([latLng, feature.properties.nextlatlon],[movingtime],{
309 331
 <?php
310 332
 		}
@@ -595,14 +617,24 @@  discard block
 block discarded – undo
595 617
 	if (isset($archive) && $archive) {
596 618
 ?>
597 619
 //then load it again every 30 seconds
598
-//  var reload = setInterval(function(){if (noTimeout) getLiveTrackerData(0)},<?php if (isset($globalMapRefresh)) print ($globalMapRefresh*1000)/2; else print '15000'; ?>);
620
+//  var reload = setInterval(function(){if (noTimeout) getLiveTrackerData(0)},<?php if (isset($globalMapRefresh)) {
621
+	print ($globalMapRefresh*1000)/2;
622
+} else {
623
+	print '15000';
624
+}
625
+?>);
599 626
 reloadTrackerPage = setInterval(function(){if (noTimeout) getLiveTrackerData(0)},<?php print $archiveupdatetime*1000; ?>);
600 627
 <?php
601 628
 	} else {
602 629
 ?>
603 630
 //then load it again every 30 seconds
604 631
 reloadTrackerPage = setInterval(
605
-    function(){if (noTimeout) getLiveTrackerData(0)},<?php if (isset($globalMapRefresh)) print $globalMapRefresh*1000; else print '30000'; ?>);
632
+    function(){if (noTimeout) getLiveTrackerData(0)},<?php if (isset($globalMapRefresh)) {
633
+	print $globalMapRefresh*1000;
634
+} else {
635
+	print '30000';
636
+}
637
+?>);
606 638
 <?php
607 639
 	}
608 640
 ?>
Please login to merge, or discard this patch.
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -554,8 +554,8 @@  discard block
 block discarded – undo
554 554
 			}
555 555
                     }
556 556
 		    <?php
557
-            		} else {
558
-            	    ?>
557
+					} else {
558
+					?>
559 559
 		    if (map.getZoom() > 7) {
560 560
                 	var style = {
561 561
                     	    "color": "#1a3151",
@@ -574,7 +574,7 @@  discard block
 block discarded – undo
574 574
                 	layer_tracker_data.addLayer(layer);
575 575
 		    }
576 576
 <?php
577
-            		}
577
+					}
578 578
 ?>
579 579
 				}
580 580
 			    }
@@ -599,11 +599,11 @@  discard block
 block discarded – undo
599 599
 $( document ).ready(function() {
600 600
 	map.on('moveend', function() {
601 601
 <?php
602
-    if (isset($globalMapUseBbox) && $globalMapUseBbox) {
602
+	if (isset($globalMapUseBbox) && $globalMapUseBbox) {
603 603
 ?>
604 604
 		getLiveTrackerData(1);
605 605
 <?php
606
-    }
606
+	}
607 607
 ?>
608 608
 	});
609 609
  //load the function on startup
Please login to merge, or discard this patch.
statistics-country.php 3 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@
 block discarded – undo
21 21
 }
22 22
 $airline_icao = (string)filter_input(INPUT_GET,'airline',FILTER_SANITIZE_STRING);
23 23
 if ($airline_icao == '' && isset($globalFilter)) {
24
-    if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0];
24
+	if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0];
25 25
 }
26 26
 
27 27
 require_once('header.php');
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -19,7 +19,7 @@  discard block
 block discarded – undo
19 19
 } else {
20 20
 	$title = _("Statistics").' - '._("Most common Country a flight was over");
21 21
 }
22
-$airline_icao = (string)filter_input(INPUT_GET,'airline',FILTER_SANITIZE_STRING);
22
+$airline_icao = (string) filter_input(INPUT_GET, 'airline', FILTER_SANITIZE_STRING);
23 23
 if ($airline_icao == '' && isset($globalFilter)) {
24 24
     if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0];
25 25
 }
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
 }
49 49
 
50 50
 if ($type == 'aircraft') {
51
-	$flightover_array = $Stats->countAllFlightOverCountries(false,$airline_icao,$filter_name);
51
+	$flightover_array = $Stats->countAllFlightOverCountries(false, $airline_icao, $filter_name);
52 52
 } elseif ($type == 'marine') {
53 53
 	$flightover_array = $Marine->countAllMarineOverCountries();
54 54
 } elseif ($type == 'tracker') {
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
 print '<div id="chart" class="chart" width="100%"></div><script>';
63 63
 print 'var series = [';
64 64
 $flightover_data = '';
65
-foreach($flightover_array as $flightover_item)
65
+foreach ($flightover_array as $flightover_item)
66 66
 {
67 67
 	if ($type == 'aircraft') $flightover_data .= '[ "'.$flightover_item['flight_country_iso3'].'",'.$flightover_item['flight_count'].'],';
68 68
 	elseif ($type == 'marine') $flightover_data .= '[ "'.$flightover_item['marine_country_iso3'].'",'.$flightover_item['marine_count'].'],';
@@ -113,8 +113,8 @@  discard block
 block discarded – undo
113 113
 	print '</thead>';
114 114
 	print '<tbody>';
115 115
 	$i = 1;
116
-	array_splice($flightover_array,10);
117
-	foreach($flightover_array as $flightover_item)
116
+	array_splice($flightover_array, 10);
117
+	foreach ($flightover_array as $flightover_item)
118 118
 	{
119 119
 		print '<tr>';
120 120
 		print '<td><strong>'.$i.'</strong></td>';
Please login to merge, or discard this patch.
Braces   +15 added lines, -7 removed lines patch added patch discarded remove patch
@@ -4,7 +4,9 @@  discard block
 block discarded – undo
4 4
 require_once('require/class.Language.php');
5 5
 $Stats = new Stats();
6 6
 
7
-if (!isset($filter_name)) $filter_name = '';
7
+if (!isset($filter_name)) {
8
+	$filter_name = '';
9
+}
8 10
 $type = 'aircraft';
9 11
 if (isset($_GET['marine'])) {
10 12
 	$type = 'marine';
@@ -21,8 +23,10 @@  discard block
 block discarded – undo
21 23
 }
22 24
 $airline_icao = (string)filter_input(INPUT_GET,'airline',FILTER_SANITIZE_STRING);
23 25
 if ($airline_icao == '' && isset($globalFilter)) {
24
-    if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0];
25
-}
26
+    if (isset($globalFilter['airline'])) {
27
+    	$airline_icao = $globalFilter['airline'][0];
28
+    }
29
+    }
26 30
 
27 31
 require_once('header.php');
28 32
 include('statistics-sub-menu.php'); 
@@ -64,10 +68,14 @@  discard block
 block discarded – undo
64 68
 $flightover_data = '';
65 69
 foreach($flightover_array as $flightover_item)
66 70
 {
67
-	if ($type == 'aircraft') $flightover_data .= '[ "'.$flightover_item['flight_country_iso3'].'",'.$flightover_item['flight_count'].'],';
68
-	elseif ($type == 'marine') $flightover_data .= '[ "'.$flightover_item['marine_country_iso3'].'",'.$flightover_item['marine_count'].'],';
69
-	elseif ($type == 'tracker') $flightover_data .= '[ "'.$flightover_item['tracker_country_iso3'].'",'.$flightover_item['tracker_count'].'],';
70
-}
71
+	if ($type == 'aircraft') {
72
+		$flightover_data .= '[ "'.$flightover_item['flight_country_iso3'].'",'.$flightover_item['flight_count'].'],';
73
+	} elseif ($type == 'marine') {
74
+		$flightover_data .= '[ "'.$flightover_item['marine_country_iso3'].'",'.$flightover_item['marine_count'].'],';
75
+	} elseif ($type == 'tracker') {
76
+		$flightover_data .= '[ "'.$flightover_item['tracker_country_iso3'].'",'.$flightover_item['tracker_count'].'],';
77
+	}
78
+	}
71 79
 $flightover_data = substr($flightover_data, 0, -1);
72 80
 print $flightover_data;
73 81
 print '];';
Please login to merge, or discard this patch.
statistics-sub-menu.php 3 patches
Indentation   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
 ?>
38 38
 	</div>
39 39
 <?php 
40
-    if (!isset($year) || (isset($year) && $year == '') && !isset($month) || (isset($month) && $month == '')) {
40
+	if (!isset($year) || (isset($year) && $year == '') && !isset($month) || (isset($month) && $month == '')) {
41 41
 ?>
42 42
 <div class="sub-menu sub-menu-container">
43 43
 	<ul class="nav">
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
 		    </ul>
96 96
 		</li>
97 97
 		<?php
98
-		    if (isset($globalAccidents) && $globalAccidents && (!isset($airline_icao) || $airline_icao == '' || $airline_icao == 'all')) {
98
+			if (isset($globalAccidents) && $globalAccidents && (!isset($airline_icao) || $airline_icao == '' || $airline_icao == 'all')) {
99 99
 		?>
100 100
 		<li class="dropdown">
101 101
 		    <a class="dropdown-toggle <?php if(strtolower($current_page) == "statistics-fatalities-year" || strtolower($current_page) == "statistics-fatalities-month"){ print 'active'; } ?>" data-toggle="dropdown" href="#">
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
 		    </ul>
108 108
 		</li>
109 109
 		<?php
110
-		    }
110
+			}
111 111
 		?>
112 112
 <?php
113 113
 	} elseif ($type == 'marine' || $type == 'tracker') {
@@ -127,7 +127,7 @@  discard block
 block discarded – undo
127 127
 	</ul>
128 128
 </div>
129 129
 <?php
130
-    } else {
130
+	} else {
131 131
 ?>
132 132
 <div class="sub-menu sub-menu-container">
133 133
 	<ul class="nav">
@@ -189,7 +189,7 @@  discard block
 block discarded – undo
189 189
 		</li>
190 190
 		-->
191 191
 		<?php
192
-		    if (isset($globalAccidents) && $globalAccidents && (!isset($airline_icao) || $airline_icao == '' || $airline_icao == 'all')) {
192
+			if (isset($globalAccidents) && $globalAccidents && (!isset($airline_icao) || $airline_icao == '' || $airline_icao == 'all')) {
193 193
 		?>
194 194
 		<!--
195 195
 		<li class="dropdown">
@@ -203,7 +203,7 @@  discard block
 block discarded – undo
203 203
 		</li>
204 204
 		-->
205 205
 		<?php
206
-		    }
206
+			}
207 207
 		?>
208 208
 <?php
209 209
 	} elseif ($type == 'marine' || $type == 'tracker') {
@@ -224,5 +224,5 @@  discard block
 block discarded – undo
224 224
 	</ul>
225 225
 </div>
226 226
 <?php
227
-    }
227
+	}
228 228
 ?>
229 229
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -23,11 +23,11 @@  discard block
 block discarded – undo
23 23
 					$Spotter = new Spotter();
24 24
 					$alliances = $Spotter->getAllAllianceNames();
25 25
 					if (!empty($alliances)) {
26
-						foreach($alliances as $alliance) {
27
-							if (isset($airline_icao) && str_replace('_',' ',str_replace('alliance_','',$airline_icao)) == $alliance['alliance']) {
28
-								print '<option value="alliance_'.str_replace(' ','_',$alliance['alliance']).'" selected>'.$alliance['alliance'].'</option>';
26
+						foreach ($alliances as $alliance) {
27
+							if (isset($airline_icao) && str_replace('_', ' ', str_replace('alliance_', '', $airline_icao)) == $alliance['alliance']) {
28
+								print '<option value="alliance_'.str_replace(' ', '_', $alliance['alliance']).'" selected>'.$alliance['alliance'].'</option>';
29 29
 							} else {
30
-								print '<option value="alliance_'.str_replace(' ','_',$alliance['alliance']).'">'.$alliance['alliance'].'</option>';
30
+								print '<option value="alliance_'.str_replace(' ', '_', $alliance['alliance']).'">'.$alliance['alliance'].'</option>';
31 31
 							}
32 32
 						}
33 33
 						print '<option disabled>──────────</option>';
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
 					$Stats = new Stats();
36 36
 					if (!isset($filter_name)) $filter_name = '';
37 37
 					$airlines = $Stats->getAllAirlineNames($filter_name);
38
-					foreach($airlines as $airline) {
38
+					foreach ($airlines as $airline) {
39 39
 						if (isset($airline_icao) && $airline_icao == $airline['airline_icao']) {
40 40
 							print '<option value="'.$airline['airline_icao'].'" selected>'.$airline['airline_name'].'</option>';
41 41
 						} else {
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
 	if (!isset($type) || $type == 'aircraft') {
59 59
 ?>
60 60
 		<li class="dropdown">
61
-		    <a class="dropdown-toggle <?php if(strtolower($current_page) == "statistics-aircraft" || strtolower($current_page) == "statistics-registration" || strtolower($current_page) == "statistics-manufacturer"){ print 'active'; } ?>" data-toggle="dropdown" href="#" >
61
+		    <a class="dropdown-toggle <?php if (strtolower($current_page) == "statistics-aircraft" || strtolower($current_page) == "statistics-registration" || strtolower($current_page) == "statistics-manufacturer") { print 'active'; } ?>" data-toggle="dropdown" href="#" >
62 62
 		      <?php echo _("Aircraft"); ?> <span class="caret"></span>
63 63
 		    </a>
64 64
 		    <ul class="dropdown-menu">
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
 		    </ul>
70 70
 		</li>
71 71
 		<li class="dropdown">
72
-		    <a class="dropdown-toggle <?php if(strtolower($current_page) == "statistics-airline" || strtolower($current_page) == "statistics-airline-country" || strtolower($current_page) == "statistics-callsign"){ print 'active'; } ?>" data-toggle="dropdown" href="#">
72
+		    <a class="dropdown-toggle <?php if (strtolower($current_page) == "statistics-airline" || strtolower($current_page) == "statistics-airline-country" || strtolower($current_page) == "statistics-callsign") { print 'active'; } ?>" data-toggle="dropdown" href="#">
73 73
 		      <?php echo _("Airline"); ?> <span class="caret"></span>
74 74
 		    </a>
75 75
 		    <ul class="dropdown-menu" role="menu">
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
 		    </ul>
86 86
 		</li>
87 87
 		<li class="dropdown">
88
-		    <a class="dropdown-toggle <?php if(strtolower($current_page) == "statistics-airport-departure" || strtolower($current_page) == "statistics-airport-departure-country" || strtolower($current_page) == "statistics-airport-arrival" || strtolower($current_page) == "statistics-airport-arrival-country"){ print 'active'; } ?>" data-toggle="dropdown" href="#">
88
+		    <a class="dropdown-toggle <?php if (strtolower($current_page) == "statistics-airport-departure" || strtolower($current_page) == "statistics-airport-departure-country" || strtolower($current_page) == "statistics-airport-arrival" || strtolower($current_page) == "statistics-airport-arrival-country") { print 'active'; } ?>" data-toggle="dropdown" href="#">
89 89
 		      <?php echo _("Airport"); ?> <span class="caret"></span>
90 90
 		    </a>
91 91
 		    <ul class="dropdown-menu" role="menu">
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
 		    </ul>
97 97
 		</li>
98 98
 		<li class="dropdown">
99
-		    <a class="dropdown-toggle <?php if(strtolower($current_page) == "statistics-route-airport" || strtolower($current_page) == "statistics-route-waypoint"){ print 'active'; } ?>" data-toggle="dropdown" href="#">
99
+		    <a class="dropdown-toggle <?php if (strtolower($current_page) == "statistics-route-airport" || strtolower($current_page) == "statistics-route-waypoint") { print 'active'; } ?>" data-toggle="dropdown" href="#">
100 100
 		      <?php echo _("Route"); ?> <span class="caret"></span>
101 101
 		    </a>
102 102
 		    <ul class="dropdown-menu" role="menu">
@@ -105,7 +105,7 @@  discard block
 block discarded – undo
105 105
 		    </ul>
106 106
 		</li>
107 107
 		<li class="dropdown">
108
-		    <a class="dropdown-toggle <?php if(strtolower($current_page) == "statistics-date" || strtolower($current_page) == "statistics-time"){ print 'active'; } ?>" data-toggle="dropdown" href="#">
108
+		    <a class="dropdown-toggle <?php if (strtolower($current_page) == "statistics-date" || strtolower($current_page) == "statistics-time") { print 'active'; } ?>" data-toggle="dropdown" href="#">
109 109
 		      <?php echo _("Date &amp; Time"); ?> <span class="caret"></span>
110 110
 		    </a>
111 111
 		    <ul class="dropdown-menu" role="menu">
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
 		    if (isset($globalAccidents) && $globalAccidents && (!isset($airline_icao) || $airline_icao == '' || $airline_icao == 'all')) {
118 118
 		?>
119 119
 		<li class="dropdown">
120
-		    <a class="dropdown-toggle <?php if(strtolower($current_page) == "statistics-fatalities-year" || strtolower($current_page) == "statistics-fatalities-month"){ print 'active'; } ?>" data-toggle="dropdown" href="#">
120
+		    <a class="dropdown-toggle <?php if (strtolower($current_page) == "statistics-fatalities-year" || strtolower($current_page) == "statistics-fatalities-month") { print 'active'; } ?>" data-toggle="dropdown" href="#">
121 121
 		      <?php echo _("Fatalities"); ?> <span class="caret"></span>
122 122
 		    </a>
123 123
 		    <ul class="dropdown-menu" role="menu">
@@ -132,7 +132,7 @@  discard block
 block discarded – undo
132 132
 	} elseif ($type == 'marine' || $type == 'tracker') {
133 133
 ?>
134 134
 		<li class="dropdown">
135
-		    <a class="dropdown-toggle <?php if(strtolower($current_page) == "statistics-date" || strtolower($current_page) == "statistics-time"){ print 'active'; } ?>" data-toggle="dropdown" href="#">
135
+		    <a class="dropdown-toggle <?php if (strtolower($current_page) == "statistics-date" || strtolower($current_page) == "statistics-time") { print 'active'; } ?>" data-toggle="dropdown" href="#">
136 136
 		      <?php echo _("Date &amp; Time"); ?> <span class="caret"></span>
137 137
 		    </a>
138 138
 		    <ul class="dropdown-menu" role="menu">
@@ -154,7 +154,7 @@  discard block
 block discarded – undo
154 154
 	if (!isset($type) || $type == 'aircraft') {
155 155
 ?>
156 156
 		<li class="dropdown">
157
-		    <a class="dropdown-toggle <?php if(strtolower($current_page) == "statistics-aircraft" || strtolower($current_page) == "statistics-registration" || strtolower($current_page) == "statistics-manufacturer"){ print 'active'; } ?>" data-toggle="dropdown" href="#" >
157
+		    <a class="dropdown-toggle <?php if (strtolower($current_page) == "statistics-aircraft" || strtolower($current_page) == "statistics-registration" || strtolower($current_page) == "statistics-manufacturer") { print 'active'; } ?>" data-toggle="dropdown" href="#" >
158 158
 		      <?php echo _("Aircraft"); ?> <span class="caret"></span>
159 159
 		    </a>
160 160
 		    <ul class="dropdown-menu">
@@ -165,7 +165,7 @@  discard block
 block discarded – undo
165 165
 		    </ul>
166 166
 		</li>
167 167
 		<li class="dropdown">
168
-		    <a class="dropdown-toggle <?php if(strtolower($current_page) == "statistics-airline" || strtolower($current_page) == "statistics-airline-country" || strtolower($current_page) == "statistics-callsign"){ print 'active'; } ?>" data-toggle="dropdown" href="#">
168
+		    <a class="dropdown-toggle <?php if (strtolower($current_page) == "statistics-airline" || strtolower($current_page) == "statistics-airline-country" || strtolower($current_page) == "statistics-callsign") { print 'active'; } ?>" data-toggle="dropdown" href="#">
169 169
 		      <?php echo _("Airline"); ?> <span class="caret"></span>
170 170
 		    </a>
171 171
 		    <ul class="dropdown-menu" role="menu">
@@ -181,7 +181,7 @@  discard block
 block discarded – undo
181 181
 		    </ul>
182 182
 		</li>
183 183
 		<li class="dropdown">
184
-		    <a class="dropdown-toggle <?php if(strtolower($current_page) == "statistics-airport-departure" || strtolower($current_page) == "statistics-airport-departure-country" || strtolower($current_page) == "statistics-airport-arrival" || strtolower($current_page) == "statistics-airport-arrival-country"){ print 'active'; } ?>" data-toggle="dropdown" href="#">
184
+		    <a class="dropdown-toggle <?php if (strtolower($current_page) == "statistics-airport-departure" || strtolower($current_page) == "statistics-airport-departure-country" || strtolower($current_page) == "statistics-airport-arrival" || strtolower($current_page) == "statistics-airport-arrival-country") { print 'active'; } ?>" data-toggle="dropdown" href="#">
185 185
 		      <?php echo _("Airport"); ?> <span class="caret"></span>
186 186
 		    </a>
187 187
 		    <ul class="dropdown-menu" role="menu">
@@ -193,7 +193,7 @@  discard block
 block discarded – undo
193 193
 		</li>
194 194
 		<!--
195 195
 		<li class="dropdown">
196
-		    <a class="dropdown-toggle <?php if(strtolower($current_page) == "statistics-route-airport" || strtolower($current_page) == "statistics-route-waypoint"){ print 'active'; } ?>" data-toggle="dropdown" href="#">
196
+		    <a class="dropdown-toggle <?php if (strtolower($current_page) == "statistics-route-airport" || strtolower($current_page) == "statistics-route-waypoint") { print 'active'; } ?>" data-toggle="dropdown" href="#">
197 197
 		      <?php echo _("Route"); ?> <span class="caret"></span>
198 198
 		    </a>
199 199
 		    <ul class="dropdown-menu" role="menu">
@@ -204,7 +204,7 @@  discard block
 block discarded – undo
204 204
 		-->
205 205
 		<!--
206 206
 		<li class="dropdown">
207
-		    <a class="dropdown-toggle <?php if(strtolower($current_page) == "statistics-date" || strtolower($current_page) == "statistics-time"){ print 'active'; } ?>" data-toggle="dropdown" href="#">
207
+		    <a class="dropdown-toggle <?php if (strtolower($current_page) == "statistics-date" || strtolower($current_page) == "statistics-time") { print 'active'; } ?>" data-toggle="dropdown" href="#">
208 208
 		      <?php echo _("Date &amp; Time"); ?> <span class="caret"></span>
209 209
 		    </a>
210 210
 		    <ul class="dropdown-menu" role="menu">
@@ -218,7 +218,7 @@  discard block
 block discarded – undo
218 218
 		?>
219 219
 		<!--
220 220
 		<li class="dropdown">
221
-		    <a class="dropdown-toggle <?php if(strtolower($current_page) == "statistics-fatalities-year" || strtolower($current_page) == "statistics-fatalities-month"){ print 'active'; } ?>" data-toggle="dropdown" href="#">
221
+		    <a class="dropdown-toggle <?php if (strtolower($current_page) == "statistics-fatalities-year" || strtolower($current_page) == "statistics-fatalities-month") { print 'active'; } ?>" data-toggle="dropdown" href="#">
222 222
 		      <?php echo _("Fatalities"); ?> <span class="caret"></span>
223 223
 		    </a>
224 224
 		    <ul class="dropdown-menu" role="menu">
@@ -234,7 +234,7 @@  discard block
 block discarded – undo
234 234
 	} elseif ($type == 'marine' || $type == 'tracker') {
235 235
 ?>
236 236
 		<li class="dropdown">
237
-		    <a class="dropdown-toggle <?php if(strtolower($current_page) == "statistics-date" || strtolower($current_page) == "statistics-time"){ print 'active'; } ?>" data-toggle="dropdown" href="#">
237
+		    <a class="dropdown-toggle <?php if (strtolower($current_page) == "statistics-date" || strtolower($current_page) == "statistics-time") { print 'active'; } ?>" data-toggle="dropdown" href="#">
238 238
 		      <?php echo _("Date &amp; Time"); ?> <span class="caret"></span>
239 239
 		    </a>
240 240
 		    <ul class="dropdown-menu" role="menu">
Please login to merge, or discard this patch.
Braces   +110 added lines, -27 removed lines patch added patch discarded remove patch
@@ -6,7 +6,13 @@  discard block
 block discarded – undo
6 6
 	if (!isset($type) || $type != 'satellite') {
7 7
 ?>
8 8
 		<form id="changedate" method="post">
9
-			<input type="month" name="date" onchange="statsdatechange(this);" value="<?php if (isset($year) && $year != '') echo $year.'-'; ?><?php if (isset($month) && $month != '') echo $month; ?>" />
9
+			<input type="month" name="date" onchange="statsdatechange(this);" value="<?php if (isset($year) && $year != '') {
10
+	echo $year.'-';
11
+}
12
+?><?php if (isset($month) && $month != '') {
13
+	echo $month;
14
+}
15
+?>" />
10 16
 		</form>
11 17
 <?php
12 18
 	}
@@ -38,7 +44,9 @@  discard block
 block discarded – undo
38 44
 						print '<option disabled>──────────</option>';
39 45
 					}
40 46
 					$Stats = new Stats();
41
-					if (!isset($filter_name)) $filter_name = '';
47
+					if (!isset($filter_name)) {
48
+						$filter_name = '';
49
+					}
42 50
 					$airlines = $Stats->getAllAirlineNames($filter_name);
43 51
 					foreach($airlines as $airline) {
44 52
 						if (isset($airline_icao) && $airline_icao == $airline['airline_icao']) {
@@ -67,10 +75,22 @@  discard block
 block discarded – undo
67 75
 		      <?php echo _("Aircraft"); ?> <span class="caret"></span>
68 76
 		    </a>
69 77
 		    <ul class="dropdown-menu">
70
-			<li><a href="<?php print $globalURL; ?>/statistics/aircraft<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>"><?php echo _("Aircraft"); ?></a></li>
71
-			<li><a href="<?php print $globalURL; ?>/statistics/registration<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>"><?php echo _("Registration"); ?></a></li>
72
-			<li><a href="<?php print $globalURL; ?>/statistics/manufacturer<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>"><?php echo _("Manufacturer"); ?></a></li>
73
-			<li><a href="<?php print $globalURL; ?>/statistics/country<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>"><?php echo _("Country"); ?></a></li>
78
+			<li><a href="<?php print $globalURL; ?>/statistics/aircraft<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') {
79
+	echo '/'.$airline_icao;
80
+}
81
+?>"><?php echo _("Aircraft"); ?></a></li>
82
+			<li><a href="<?php print $globalURL; ?>/statistics/registration<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') {
83
+	echo '/'.$airline_icao;
84
+}
85
+?>"><?php echo _("Registration"); ?></a></li>
86
+			<li><a href="<?php print $globalURL; ?>/statistics/manufacturer<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') {
87
+	echo '/'.$airline_icao;
88
+}
89
+?>"><?php echo _("Manufacturer"); ?></a></li>
90
+			<li><a href="<?php print $globalURL; ?>/statistics/country<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') {
91
+	echo '/'.$airline_icao;
92
+}
93
+?>"><?php echo _("Country"); ?></a></li>
74 94
 		    </ul>
75 95
 		</li>
76 96
 		<li class="dropdown">
@@ -81,12 +101,21 @@  discard block
 block discarded – undo
81 101
 <?php
82 102
 		if (!isset($airline_icao) || $airline_icao == 'all') {
83 103
 ?>
84
-		      <li><a href="<?php print $globalURL; ?>/statistics/airline<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>"><?php echo _("Airline"); ?></a></li>
85
-		      <li><a href="<?php print $globalURL; ?>/statistics/airline-country<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>"><?php echo _("Airline by Country"); ?></a></li>
104
+		      <li><a href="<?php print $globalURL; ?>/statistics/airline<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') {
105
+	echo '/'.$airline_icao;
106
+}
107
+?>"><?php echo _("Airline"); ?></a></li>
108
+		      <li><a href="<?php print $globalURL; ?>/statistics/airline-country<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') {
109
+	echo '/'.$airline_icao;
110
+}
111
+?>"><?php echo _("Airline by Country"); ?></a></li>
86 112
 <?php
87 113
 		}
88 114
 ?>
89
-		      <li><a href="<?php print $globalURL; ?>/statistics/callsign<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>"><?php echo _("Callsign"); ?></a></li>
115
+		      <li><a href="<?php print $globalURL; ?>/statistics/callsign<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') {
116
+	echo '/'.$airline_icao;
117
+}
118
+?>"><?php echo _("Callsign"); ?></a></li>
90 119
 		    </ul>
91 120
 		</li>
92 121
 		<li class="dropdown">
@@ -94,10 +123,22 @@  discard block
 block discarded – undo
94 123
 		      <?php echo _("Airport"); ?> <span class="caret"></span>
95 124
 		    </a>
96 125
 		    <ul class="dropdown-menu" role="menu">
97
-		      <li><a href="<?php print $globalURL; ?>/statistics/airport-departure<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>"><?php echo _("Departure Airport"); ?></a></li>
98
-		      <li><a href="<?php print $globalURL; ?>/statistics/airport-departure-country<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>"><?php echo _("Departure Airport by Country"); ?></a></li>
99
-		      <li><a href="<?php print $globalURL; ?>/statistics/airport-arrival<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>"><?php echo _("Arrival Airport"); ?></a></li>
100
-		      <li><a href="<?php print $globalURL; ?>/statistics/airport-arrival-country<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>"><?php echo _("Arrival Airport by Country"); ?></a></li>
126
+		      <li><a href="<?php print $globalURL; ?>/statistics/airport-departure<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') {
127
+	echo '/'.$airline_icao;
128
+}
129
+?>"><?php echo _("Departure Airport"); ?></a></li>
130
+		      <li><a href="<?php print $globalURL; ?>/statistics/airport-departure-country<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') {
131
+	echo '/'.$airline_icao;
132
+}
133
+?>"><?php echo _("Departure Airport by Country"); ?></a></li>
134
+		      <li><a href="<?php print $globalURL; ?>/statistics/airport-arrival<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') {
135
+	echo '/'.$airline_icao;
136
+}
137
+?>"><?php echo _("Arrival Airport"); ?></a></li>
138
+		      <li><a href="<?php print $globalURL; ?>/statistics/airport-arrival-country<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') {
139
+	echo '/'.$airline_icao;
140
+}
141
+?>"><?php echo _("Arrival Airport by Country"); ?></a></li>
101 142
 		    </ul>
102 143
 		</li>
103 144
 		<li class="dropdown">
@@ -105,8 +146,14 @@  discard block
 block discarded – undo
105 146
 		      <?php echo _("Route"); ?> <span class="caret"></span>
106 147
 		    </a>
107 148
 		    <ul class="dropdown-menu" role="menu">
108
-		      <li><a href="<?php print $globalURL; ?>/statistics/route-airport<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>"><?php echo _("Route by Airport"); ?></a></li>
109
-		      <li><a href="<?php print $globalURL; ?>/statistics/route-waypoint<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>"><?php echo _("Route by Waypoint"); ?></a></li>
149
+		      <li><a href="<?php print $globalURL; ?>/statistics/route-airport<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') {
150
+	echo '/'.$airline_icao;
151
+}
152
+?>"><?php echo _("Route by Airport"); ?></a></li>
153
+		      <li><a href="<?php print $globalURL; ?>/statistics/route-waypoint<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') {
154
+	echo '/'.$airline_icao;
155
+}
156
+?>"><?php echo _("Route by Waypoint"); ?></a></li>
110 157
 		    </ul>
111 158
 		</li>
112 159
 		<li class="dropdown">
@@ -114,8 +161,14 @@  discard block
 block discarded – undo
114 161
 		      <?php echo _("Date &amp; Time"); ?> <span class="caret"></span>
115 162
 		    </a>
116 163
 		    <ul class="dropdown-menu" role="menu">
117
-		      <li><a href="<?php print $globalURL; ?>/statistics/date<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>"><?php echo _("Date"); ?></a></li>
118
-			  <li><a href="<?php print $globalURL; ?>/statistics/time<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>"><?php echo _("Time"); ?></a></li>
164
+		      <li><a href="<?php print $globalURL; ?>/statistics/date<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') {
165
+	echo '/'.$airline_icao;
166
+}
167
+?>"><?php echo _("Date"); ?></a></li>
168
+			  <li><a href="<?php print $globalURL; ?>/statistics/time<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') {
169
+	echo '/'.$airline_icao;
170
+}
171
+?>"><?php echo _("Time"); ?></a></li>
119 172
 		    </ul>
120 173
 		</li>
121 174
 		<?php
@@ -163,9 +216,18 @@  discard block
 block discarded – undo
163 216
 		      <?php echo _("Aircraft"); ?> <span class="caret"></span>
164 217
 		    </a>
165 218
 		    <ul class="dropdown-menu">
166
-			<li><a href="<?php print $globalURL; ?>/statistics/aircraft<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>/<?php echo $year.'/'.$month.'/'; ?>"><?php echo _("Aircraft"); ?></a></li>
167
-			<li><a href="<?php print $globalURL; ?>/statistics/registration<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>/<?php echo $year.'/'.$month.'/'; ?>"><?php echo _("Registration"); ?></a></li>
168
-			<li><a href="<?php print $globalURL; ?>/statistics/manufacturer<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>/<?php echo $year.'/'.$month.'/'; ?>"><?php echo _("Manufacturer"); ?></a></li>
219
+			<li><a href="<?php print $globalURL; ?>/statistics/aircraft<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') {
220
+	echo '/'.$airline_icao;
221
+}
222
+?>/<?php echo $year.'/'.$month.'/'; ?>"><?php echo _("Aircraft"); ?></a></li>
223
+			<li><a href="<?php print $globalURL; ?>/statistics/registration<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') {
224
+	echo '/'.$airline_icao;
225
+}
226
+?>/<?php echo $year.'/'.$month.'/'; ?>"><?php echo _("Registration"); ?></a></li>
227
+			<li><a href="<?php print $globalURL; ?>/statistics/manufacturer<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') {
228
+	echo '/'.$airline_icao;
229
+}
230
+?>/<?php echo $year.'/'.$month.'/'; ?>"><?php echo _("Manufacturer"); ?></a></li>
169 231
 			<!-- <li><a href="<?php print $globalURL; ?>/statistics/country"><?php echo _("Country"); ?></a></li> -->
170 232
 		    </ul>
171 233
 		</li>
@@ -177,12 +239,21 @@  discard block
 block discarded – undo
177 239
 <?php
178 240
 		if (!isset($airline_icao) || $airline_icao == 'all') {
179 241
 ?>
180
-		      <li><a href="<?php print $globalURL; ?>/statistics/airline<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>/<?php echo $year.'/'.$month.'/'; ?>"><?php echo _("Airline"); ?></a></li>
181
-		      <li><a href="<?php print $globalURL; ?>/statistics/airline-country<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>/<?php echo $year.'/'.$month.'/'; ?>"><?php echo _("Airline by Country"); ?></a></li>
242
+		      <li><a href="<?php print $globalURL; ?>/statistics/airline<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') {
243
+	echo '/'.$airline_icao;
244
+}
245
+?>/<?php echo $year.'/'.$month.'/'; ?>"><?php echo _("Airline"); ?></a></li>
246
+		      <li><a href="<?php print $globalURL; ?>/statistics/airline-country<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') {
247
+	echo '/'.$airline_icao;
248
+}
249
+?>/<?php echo $year.'/'.$month.'/'; ?>"><?php echo _("Airline by Country"); ?></a></li>
182 250
 <?php
183 251
 		}
184 252
 ?>
185
-		      <li><a href="<?php print $globalURL; ?>/statistics/callsign<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>/<?php echo $year.'/'.$month.'/'; ?>"><?php echo _("Callsign"); ?></a></li>
253
+		      <li><a href="<?php print $globalURL; ?>/statistics/callsign<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') {
254
+	echo '/'.$airline_icao;
255
+}
256
+?>/<?php echo $year.'/'.$month.'/'; ?>"><?php echo _("Callsign"); ?></a></li>
186 257
 		    </ul>
187 258
 		</li>
188 259
 		<li class="dropdown">
@@ -190,10 +261,22 @@  discard block
 block discarded – undo
190 261
 		      <?php echo _("Airport"); ?> <span class="caret"></span>
191 262
 		    </a>
192 263
 		    <ul class="dropdown-menu" role="menu">
193
-		      <li><a href="<?php print $globalURL; ?>/statistics/airport-departure<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>/<?php echo $year.'/'.$month.'/'; ?>"><?php echo _("Departure Airport"); ?></a></li>
194
-		      <li><a href="<?php print $globalURL; ?>/statistics/airport-departure-country<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>/<?php echo $year.'/'.$month.'/'; ?>"><?php echo _("Departure Airport by Country"); ?></a></li>
195
-		      <li><a href="<?php print $globalURL; ?>/statistics/airport-arrival<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>/<?php echo $year.'/'.$month.'/'; ?>"><?php echo _("Arrival Airport"); ?></a></li>
196
-		      <li><a href="<?php print $globalURL; ?>/statistics/airport-arrival-country<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>/<?php echo $year.'/'.$month.'/'; ?>"><?php echo _("Arrival Airport by Country"); ?></a></li>
264
+		      <li><a href="<?php print $globalURL; ?>/statistics/airport-departure<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') {
265
+	echo '/'.$airline_icao;
266
+}
267
+?>/<?php echo $year.'/'.$month.'/'; ?>"><?php echo _("Departure Airport"); ?></a></li>
268
+		      <li><a href="<?php print $globalURL; ?>/statistics/airport-departure-country<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') {
269
+	echo '/'.$airline_icao;
270
+}
271
+?>/<?php echo $year.'/'.$month.'/'; ?>"><?php echo _("Departure Airport by Country"); ?></a></li>
272
+		      <li><a href="<?php print $globalURL; ?>/statistics/airport-arrival<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') {
273
+	echo '/'.$airline_icao;
274
+}
275
+?>/<?php echo $year.'/'.$month.'/'; ?>"><?php echo _("Arrival Airport"); ?></a></li>
276
+		      <li><a href="<?php print $globalURL; ?>/statistics/airport-arrival-country<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') {
277
+	echo '/'.$airline_icao;
278
+}
279
+?>/<?php echo $year.'/'.$month.'/'; ?>"><?php echo _("Arrival Airport by Country"); ?></a></li>
197 280
 		    </ul>
198 281
 		</li>
199 282
 		<!--
Please login to merge, or discard this patch.
atc-data.php 3 patches
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -40,15 +40,15 @@
 block discarded – undo
40 40
 //print '<div><span>'._("Country").'</span>'.$spotter_item['country'].'</div>';
41 41
 print '<div><span>'._("Coordinates").'</span>'.round($spotter_item['latitude'],3).', '.round($spotter_item['longitude'],3).'</div>';
42 42
 if ($spotter_item['atc_range'] > 0) {
43
-    print '<div><span>'._("Range").'</span>';
44
-    print $spotter_item['atc_range'];
45
-    print '</div>';
43
+	print '<div><span>'._("Range").'</span>';
44
+	print $spotter_item['atc_range'];
45
+	print '</div>';
46 46
 }
47 47
 print '</div>';
48 48
 if ($spotter_item['info'] != '') {
49
-    print '<div class="notamtext"><span>'._("Info").'</span>';
50
-    print $spotter_item['info'];
51
-    print '</div>';
49
+	print '<div class="notamtext"><span>'._("Info").'</span>';
50
+	print $spotter_item['info'];
51
+	print '</div>';
52 52
 }
53 53
 print '</div>';
54 54
 }
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -5,8 +5,8 @@  discard block
 block discarded – undo
5 5
 $ATC = new ATC();
6 6
 
7 7
 if (isset($_GET['atcid'])) {
8
-	$atcid = filter_input(INPUT_GET,'atcid',FILTER_SANITIZE_NUMBER_INT);
9
-	$atcident = filter_input(INPUT_GET,'atcident',FILTER_SANITIZE_STRING);
8
+	$atcid = filter_input(INPUT_GET, 'atcid', FILTER_SANITIZE_NUMBER_INT);
9
+	$atcident = filter_input(INPUT_GET, 'atcident', FILTER_SANITIZE_STRING);
10 10
 	$atc_data = $ATC->getById($atcid);
11 11
 	if (!isset($atc_data[0])) $atc_data = $ATC->getByIdent($atcident);
12 12
  ?>
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
 print '</div>';
39 39
 
40 40
 //print '<div><span>'._("Country").'</span>'.$spotter_item['country'].'</div>';
41
-print '<div><span>'._("Coordinates").'</span>'.round($spotter_item['latitude'],3).', '.round($spotter_item['longitude'],3).'</div>';
41
+print '<div><span>'._("Coordinates").'</span>'.round($spotter_item['latitude'], 3).', '.round($spotter_item['longitude'], 3).'</div>';
42 42
 if ($spotter_item['atc_range'] > 0) {
43 43
     print '<div><span>'._("Range").'</span>';
44 44
     print $spotter_item['atc_range'];
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -8,7 +8,9 @@
 block discarded – undo
8 8
 	$atcid = filter_input(INPUT_GET,'atcid',FILTER_SANITIZE_NUMBER_INT);
9 9
 	$atcident = filter_input(INPUT_GET,'atcident',FILTER_SANITIZE_STRING);
10 10
 	$atc_data = $ATC->getById($atcid);
11
-	if (!isset($atc_data[0])) $atc_data = $ATC->getByIdent($atcident);
11
+	if (!isset($atc_data[0])) {
12
+		$atc_data = $ATC->getByIdent($atcident);
13
+	}
12 14
  ?>
13 15
 <div class="alldetails">
14 16
 <button type="button" class="close">&times;</button>
Please login to merge, or discard this patch.
live-geojson.php 3 patches
Indentation   +63 added lines, -63 removed lines patch added patch discarded remove patch
@@ -5,23 +5,23 @@  discard block
 block discarded – undo
5 5
 $marine = false;
6 6
 $usecoord = false;
7 7
 if (isset($_GET['tracker'])) {
8
-    $tracker = true;
8
+	$tracker = true;
9 9
 }
10 10
 if (isset($_GET['marine'])) {
11
-    $marine = true;
11
+	$marine = true;
12 12
 }
13 13
 if ($tracker) {
14
-    require_once('require/class.Tracker.php');
15
-    require_once('require/class.TrackerLive.php');
16
-    require_once('require/class.TrackerArchive.php');
14
+	require_once('require/class.Tracker.php');
15
+	require_once('require/class.TrackerLive.php');
16
+	require_once('require/class.TrackerArchive.php');
17 17
 } elseif ($marine) {
18
-    require_once('require/class.Marine.php');
19
-    require_once('require/class.MarineLive.php');
20
-    require_once('require/class.MarineArchive.php');
18
+	require_once('require/class.Marine.php');
19
+	require_once('require/class.MarineLive.php');
20
+	require_once('require/class.MarineArchive.php');
21 21
 } else {
22
-    require_once('require/class.Spotter.php');
23
-    require_once('require/class.SpotterLive.php');
24
-    require_once('require/class.SpotterArchive.php');
22
+	require_once('require/class.Spotter.php');
23
+	require_once('require/class.SpotterLive.php');
24
+	require_once('require/class.SpotterArchive.php');
25 25
 }
26 26
 
27 27
 $begintime = microtime(true);
@@ -41,10 +41,10 @@  discard block
 block discarded – undo
41 41
 $Common = new Common();
42 42
 
43 43
 if (isset($_GET['download'])) {
44
-    if ($_GET['download'] == "true")
45
-    {
44
+	if ($_GET['download'] == "true")
45
+	{
46 46
 	header('Content-disposition: attachment; filename="flightairmap.json"');
47
-    }
47
+	}
48 48
 }
49 49
 header('Content-Type: text/javascript');
50 50
 
@@ -498,17 +498,17 @@  discard block
 block discarded – undo
498 498
 				if ($history == '' && isset($_COOKIE['history'])) $history = $_COOKIE['history'];
499 499
 				
500 500
 				if (
501
-				    (isset($_COOKIE['flightpath']) && $_COOKIE['flightpath'] == 'true') 
502
-				    || ((isset($globalMapHistory) && $globalMapHistory) || $allhistory)
501
+					(isset($_COOKIE['flightpath']) && $_COOKIE['flightpath'] == 'true') 
502
+					|| ((isset($globalMapHistory) && $globalMapHistory) || $allhistory)
503 503
 				//    || (isset($history) && $history != '' && $history != 'NA' && ($history == $spotter_item['ident'] || $history == $spotter_item['flightaware_id']))
504 504
 				//    || (isset($history) && $history != '' && $history != 'NA' && $history == $spotter_item['ident'])
505
-				    || (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['flightaware_id']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['flightaware_id']))
506
-				    || (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['flightaware_id']) && $_GET['flightaware_id'] == $spotter_item['flightaware_id'])
507
-				    || (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['fammarine_id']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['fammarine_id']))
508
-				    || (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['fammarine_id']) && $_GET['fammarine_id'] == $spotter_item['fammarine_id'])
509
-				    || (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['famtrackid']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['famtrackid']))
510
-				    || (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['famtrackid']) && $_GET['famtrackid'] == $spotter_item['famtrackid'])
511
-				    ) {
505
+					|| (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['flightaware_id']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['flightaware_id']))
506
+					|| (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['flightaware_id']) && $_GET['flightaware_id'] == $spotter_item['flightaware_id'])
507
+					|| (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['fammarine_id']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['fammarine_id']))
508
+					|| (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['fammarine_id']) && $_GET['fammarine_id'] == $spotter_item['fammarine_id'])
509
+					|| (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['famtrackid']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['famtrackid']))
510
+					|| (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['famtrackid']) && $_GET['famtrackid'] == $spotter_item['famtrackid'])
511
+					) {
512 512
 					if ($tracker) {
513 513
 						if ($from_archive || $globalArchive) {
514 514
 							$spotter_history_array = $TrackerArchive->getAllArchiveTrackerDataById($spotter_item['famtrackid']);
@@ -597,65 +597,65 @@  discard block
 block discarded – undo
597 597
 				}
598 598
 				
599 599
 				if (((isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['flightaware_id']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['flightaware_id']))
600
-				    || (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['flightaware_id']) && $_GET['flightaware_id'] == $spotter_item['flightaware_id']))
601
-				     && (isset($spotter_item['departure_airport']) 
602
-				        && $spotter_item['departure_airport'] != 'NA' 
603
-				        && isset($spotter_item['arrival_airport']) 
604
-				        && $spotter_item['arrival_airport'] != 'NA' 
605
-				        && ((isset($_COOKIE['MapRoute']) && $_COOKIE['MapRoute'] == "true") 
606
-				    	    || (!isset($_COOKIE['MapRoute']) && isset($globalMapRoute) && $globalMapRoute)))) {
607
-				    if ($compress) $output_air = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "route"},"geometry": {"type": "LineString","coordinates": [';
608
-				    else $output_air = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "route"},"geometry": {"type": "LineString","coordinates": [';
609
-				    if (isset($spotter_item['departure_airport_latitude'])) {
600
+					|| (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['flightaware_id']) && $_GET['flightaware_id'] == $spotter_item['flightaware_id']))
601
+					 && (isset($spotter_item['departure_airport']) 
602
+						&& $spotter_item['departure_airport'] != 'NA' 
603
+						&& isset($spotter_item['arrival_airport']) 
604
+						&& $spotter_item['arrival_airport'] != 'NA' 
605
+						&& ((isset($_COOKIE['MapRoute']) && $_COOKIE['MapRoute'] == "true") 
606
+							|| (!isset($_COOKIE['MapRoute']) && isset($globalMapRoute) && $globalMapRoute)))) {
607
+					if ($compress) $output_air = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "route"},"geometry": {"type": "LineString","coordinates": [';
608
+					else $output_air = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "route"},"geometry": {"type": "LineString","coordinates": [';
609
+					if (isset($spotter_item['departure_airport_latitude'])) {
610 610
 					$output_air .= '['.$spotter_item['departure_airport_longitude'].','.$spotter_item['departure_airport_latitude'].'],';
611
-				    } elseif (isset($spotter_item['departure_airport']) && $spotter_item['departure_airport'] != 'NA') {
611
+					} elseif (isset($spotter_item['departure_airport']) && $spotter_item['departure_airport'] != 'NA') {
612 612
 					$dairport = $Spotter->getAllAirportInfo($spotter_item['departure_airport']);
613 613
 					if (isset($dairport[0]['latitude'])) {
614
-					    $output_air .= '['.$dairport[0]['longitude'].','.$dairport[0]['latitude'].'],';
614
+						$output_air .= '['.$dairport[0]['longitude'].','.$dairport[0]['latitude'].'],';
615 615
 					}
616
-				    }
617
-				    if (isset($spotter_item['arrival_airport_latitude'])) {
616
+					}
617
+					if (isset($spotter_item['arrival_airport_latitude'])) {
618 618
 					$output_air .= '['.$spotter_item['arrival_airport_longitude'].','.$spotter_item['arrival_airport_latitude'].'],';
619
-				    } elseif (isset($spotter_item['arrival_airport']) && $spotter_item['arrival_airport'] != 'NA') {
619
+					} elseif (isset($spotter_item['arrival_airport']) && $spotter_item['arrival_airport'] != 'NA') {
620 620
 					$aairport = $Spotter->getAllAirportInfo($spotter_item['arrival_airport']);
621 621
 					if (isset($aairport[0]['latitude'])) {
622
-					    $output_air .= '['.$aairport[0]['longitude'].','.$aairport[0]['latitude'].'],';
622
+						$output_air .= '['.$aairport[0]['longitude'].','.$aairport[0]['latitude'].'],';
623 623
 					}
624
-				    }
625
-				    $output_air  = substr($output_air, 0, -1);
626
-				    $output_air .= ']}},';
627
-				    $output .= $output_air;
628
-				    unset($output_air);
624
+					}
625
+					$output_air  = substr($output_air, 0, -1);
626
+					$output_air .= ']}},';
627
+					$output .= $output_air;
628
+					unset($output_air);
629 629
 				}
630 630
 
631 631
 				//if (isset($history) && $history != '' && $history == $spotter_item['ident'] && isset($spotter_item['departure_airport']) && $spotter_item['departure_airport'] != 'NA' && isset($spotter_item['arrival_airport']) && $spotter_item['arrival_airport'] != 'NA' && ((isset($_COOKIE['MapRoute']) && $_COOKIE['MapRoute'] == "true") || (!isset($_COOKIE['MapRoute']) && (!isset($globalMapRoute) || (isset($globalMapRoute) && $globalMapRoute))))) {
632 632
 				//if (isset($history) && $history != '' && $history == $spotter_item['ident'] && isset($spotter_item['arrival_airport']) && $spotter_item['arrival_airport'] != 'NA' && ((isset($_COOKIE['MapRoute']) && $_COOKIE['MapRoute'] == "true") || (!isset($_COOKIE['MapRoute']) && (!isset($globalMapRoute) || (isset($globalMapRoute) && $globalMapRoute))))) {
633 633
 				if (((isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['flightaware_id']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['flightaware_id']))
634
-				    || (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['flightaware_id']) && $_GET['flightaware_id'] == $spotter_item['flightaware_id']))
635
-				     && (isset($spotter_item['arrival_airport']) 
636
-				        && $spotter_item['arrival_airport'] != 'NA' 
637
-				        && ((isset($_COOKIE['MapRemainingRoute']) && $_COOKIE['MapRemainingRoute'] == "true") 
638
-				    	    || (!isset($_COOKIE['MapRemainaingRoute']) && (!isset($globalMapRemainingRoute) 
639
-				    	    || (isset($globalMapRemainingRoute) && $globalMapRemainingRoute)))))) {
640
-				    $havedata = false;
641
-				    if ($compress) $output_dest = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "routedest"},"geometry": {"type": "LineString","coordinates": [';
642
-				    else $output_dest = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "routedest"},"geometry": {"type": "LineString","coordinates": [';
643
-				    $output_dest .= '['.$spotter_item['longitude'].','.$spotter_item['latitude'].'],';
634
+					|| (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['flightaware_id']) && $_GET['flightaware_id'] == $spotter_item['flightaware_id']))
635
+					 && (isset($spotter_item['arrival_airport']) 
636
+						&& $spotter_item['arrival_airport'] != 'NA' 
637
+						&& ((isset($_COOKIE['MapRemainingRoute']) && $_COOKIE['MapRemainingRoute'] == "true") 
638
+							|| (!isset($_COOKIE['MapRemainaingRoute']) && (!isset($globalMapRemainingRoute) 
639
+							|| (isset($globalMapRemainingRoute) && $globalMapRemainingRoute)))))) {
640
+					$havedata = false;
641
+					if ($compress) $output_dest = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "routedest"},"geometry": {"type": "LineString","coordinates": [';
642
+					else $output_dest = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "routedest"},"geometry": {"type": "LineString","coordinates": [';
643
+					$output_dest .= '['.$spotter_item['longitude'].','.$spotter_item['latitude'].'],';
644 644
 
645
-				    if (isset($spotter_item['arrival_airport_latitude'])) {
645
+					if (isset($spotter_item['arrival_airport_latitude'])) {
646 646
 					$output_dest .= '['.$spotter_item['arrival_airport_longitude'].','.$spotter_item['arrival_airport_latitude'].']';
647 647
 					$havedata = true;
648
-				    } elseif (isset($spotter_item['arrival_airport']) && $spotter_item['arrival_airport'] != 'NA') {
648
+					} elseif (isset($spotter_item['arrival_airport']) && $spotter_item['arrival_airport'] != 'NA') {
649 649
 					$aairport = $Spotter->getAllAirportInfo($spotter_item['arrival_airport']);
650 650
 					if (isset($aairport[0]['latitude'])) {
651
-					    $output_dest .= '['.$aairport[0]['longitude'].','.$aairport[0]['latitude'].']';
652
-					    $havedata = true;
651
+						$output_dest .= '['.$aairport[0]['longitude'].','.$aairport[0]['latitude'].']';
652
+						$havedata = true;
653 653
 					}
654
-				    }
655
-				    //$output_dest  = substr($output_dest, 0, -1);
656
-				    $output_dest .= ']}},';
657
-				    if ($havedata) $output .= $output_dest;
658
-				    unset($output_dest);
654
+					}
655
+					//$output_dest  = substr($output_dest, 0, -1);
656
+					$output_dest .= ']}},';
657
+					if ($havedata) $output .= $output_dest;
658
+					unset($output_dest);
659 659
 				}
660 660
 			}
661 661
 			$output  = substr($output, 0, -1);
Please login to merge, or discard this patch.
Spacing   +61 added lines, -61 removed lines patch added patch discarded remove patch
@@ -55,24 +55,24 @@  discard block
 block discarded – undo
55 55
 $min = true;
56 56
 $allhistory = false;
57 57
 $filter['source'] = array();
58
-if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') $filter['source'] = array_merge($filter['source'],array('vatsimtxt'));
59
-if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') $filter['source'] = array_merge($filter['source'],array('whazzup'));
60
-if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') $filter['source'] = array_merge($filter['source'],array('phpvmacars'));
61
-if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') $filter['source'] = array_merge($filter['source'],array('sbs','famaprs'));
62
-if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') $filter['source'] = array_merge($filter['source'],array('aprs'));
63
-if (isset($_COOKIE['filter_ident']) && $_COOKIE['filter_ident'] != '') $filter['ident'] = filter_var($_COOKIE['filter_ident'],FILTER_SANITIZE_STRING);
64
-if (isset($_COOKIE['filter_mmsi']) && $_COOKIE['filter_mmsi'] != '') $filter['mmsi'] = filter_var($_COOKIE['filter_mmsi'],FILTER_SANITIZE_STRING);
65
-if (isset($_COOKIE['filter_Airlines']) && $_COOKIE['filter_Airlines'] != '') $filter['airlines'] = filter_var_array(explode(',',$_COOKIE['filter_Airlines']),FILTER_SANITIZE_STRING);
66
-if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') $filter['source_aprs'] = filter_var_array(explode(',',$_COOKIE['filter_Sources']),FILTER_SANITIZE_STRING);
67
-if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') $filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'],FILTER_SANITIZE_STRING);
68
-if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] != 'all') $filter['alliance'] = filter_var($_COOKIE['filter_alliance'],FILTER_SANITIZE_STRING);
58
+if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') $filter['source'] = array_merge($filter['source'], array('vatsimtxt'));
59
+if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') $filter['source'] = array_merge($filter['source'], array('whazzup'));
60
+if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') $filter['source'] = array_merge($filter['source'], array('phpvmacars'));
61
+if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') $filter['source'] = array_merge($filter['source'], array('sbs', 'famaprs'));
62
+if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') $filter['source'] = array_merge($filter['source'], array('aprs'));
63
+if (isset($_COOKIE['filter_ident']) && $_COOKIE['filter_ident'] != '') $filter['ident'] = filter_var($_COOKIE['filter_ident'], FILTER_SANITIZE_STRING);
64
+if (isset($_COOKIE['filter_mmsi']) && $_COOKIE['filter_mmsi'] != '') $filter['mmsi'] = filter_var($_COOKIE['filter_mmsi'], FILTER_SANITIZE_STRING);
65
+if (isset($_COOKIE['filter_Airlines']) && $_COOKIE['filter_Airlines'] != '') $filter['airlines'] = filter_var_array(explode(',', $_COOKIE['filter_Airlines']), FILTER_SANITIZE_STRING);
66
+if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') $filter['source_aprs'] = filter_var_array(explode(',', $_COOKIE['filter_Sources']), FILTER_SANITIZE_STRING);
67
+if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') $filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'], FILTER_SANITIZE_STRING);
68
+if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] != 'all') $filter['alliance'] = filter_var($_COOKIE['filter_alliance'], FILTER_SANITIZE_STRING);
69 69
 
70 70
 if (isset($globalMapPopup) && !$globalMapPopup && !(isset($_COOKIE['flightpopup']) && $_COOKIE['flightpopup'] == 'true')) {
71 71
 	$min = true;
72 72
 } else $min = false;
73 73
 
74 74
 if (isset($_GET['ident'])) {
75
-	$ident = urldecode(filter_input(INPUT_GET,'ident',FILTER_SANITIZE_STRING));
75
+	$ident = urldecode(filter_input(INPUT_GET, 'ident', FILTER_SANITIZE_STRING));
76 76
 	if ($tracker) {
77 77
 		$spotter_array = $TrackerLive->getLastLiveTrackerDataByIdent($ident);
78 78
 	} elseif ($marine) {
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
 	}
87 87
 	$allhistory = true;
88 88
 } elseif (isset($_GET['flightaware_id'])) {
89
-	$flightaware_id = filter_input(INPUT_GET,'flightaware_id',FILTER_SANITIZE_STRING);
89
+	$flightaware_id = filter_input(INPUT_GET, 'flightaware_id', FILTER_SANITIZE_STRING);
90 90
 	$spotter_array = $SpotterLive->getLastLiveSpotterDataById($flightaware_id);
91 91
 	if (empty($spotter_array)) {
92 92
 		$from_archive = true;
@@ -94,44 +94,44 @@  discard block
 block discarded – undo
94 94
 	}
95 95
 	$allhistory = true;
96 96
 } elseif (isset($_GET['famtrack_id'])) {
97
-	$famtrack_id = urldecode(filter_input(INPUT_GET,'famtrack_id',FILTER_SANITIZE_STRING));
97
+	$famtrack_id = urldecode(filter_input(INPUT_GET, 'famtrack_id', FILTER_SANITIZE_STRING));
98 98
 	$spotter_array = $TrackerLive->getLastLiveTrackerDataById($famtrack_id);
99 99
 	$allhistory = true;
100 100
 } elseif (isset($_GET['fammarine_id'])) {
101
-	$fammarine_id = urldecode(filter_input(INPUT_GET,'fammarine_id',FILTER_SANITIZE_STRING));
101
+	$fammarine_id = urldecode(filter_input(INPUT_GET, 'fammarine_id', FILTER_SANITIZE_STRING));
102 102
 	$spotter_array = $MarineLive->getLastLiveMarineDataById($fammarine_id);
103 103
 	$allhistory = true;
104 104
 } elseif (isset($globalMapUseBbox) && $globalMapUseBbox && isset($_GET['coord']) && (!isset($globalMapPopup) || $globalMapPopup || (isset($_COOKIE['flightpopup']) && $_COOKIE['flightpopup'] == 'true'))) {
105 105
 //} elseif (isset($_GET['coord'])) {
106 106
 	$usecoord = true;
107
-	$coord = explode(',',$_GET['coord']);
107
+	$coord = explode(',', $_GET['coord']);
108 108
 	if ($tracker) {
109
-		$spotter_array = $TrackerLive->getLiveTrackerDatabyCoord($coord,$filter);
109
+		$spotter_array = $TrackerLive->getLiveTrackerDatabyCoord($coord, $filter);
110 110
 	} elseif ($marine) {
111
-		$spotter_array = $MarineLive->getLiveMarineDatabyCoord($coord,$filter);
111
+		$spotter_array = $MarineLive->getLiveMarineDatabyCoord($coord, $filter);
112 112
 	} else {
113
-		$spotter_array = $SpotterLive->getLiveSpotterDatabyCoord($coord,$filter);
113
+		$spotter_array = $SpotterLive->getLiveSpotterDatabyCoord($coord, $filter);
114 114
 	}
115 115
 } elseif (isset($globalMapUseBbox) && $globalMapUseBbox && isset($_GET['coord']) && $min) {
116 116
 	$usecoord = true;
117
-	$coord = explode(',',$_GET['coord']);
117
+	$coord = explode(',', $_GET['coord']);
118 118
 	if ($tracker) {
119
-		$spotter_array = $TrackerLive->getMinLiveTrackerDatabyCoord($coord,$filter);
119
+		$spotter_array = $TrackerLive->getMinLiveTrackerDatabyCoord($coord, $filter);
120 120
 	} elseif ($marine) {
121
-		$spotter_array = $MarineLive->getMinLiveMarineDatabyCoord($coord,$filter);
121
+		$spotter_array = $MarineLive->getMinLiveMarineDatabyCoord($coord, $filter);
122 122
 	} else {
123
-		$spotter_array = $SpotterLive->getMinLiveSpotterDatabyCoord($coord,$filter);
123
+		$spotter_array = $SpotterLive->getMinLiveSpotterDatabyCoord($coord, $filter);
124 124
 	}
125 125
 } elseif (isset($_GET['archive']) && isset($_GET['begindate']) && isset($_GET['enddate']) && isset($_GET['speed']) && !isset($_GET['tracker']) && !isset($_GET['marine'])) {
126 126
 	$from_archive = true;
127 127
 //	$begindate = filter_input(INPUT_GET,'begindate',FILTER_VALIDATE_REGEXP,array("options"=>array("regexp"=>'~^\d{4}/\d{2}/\d{2}$~')));
128 128
 //	$enddate = filter_input(INPUT_GET,'enddate',FILTER_VALIDATE_REGEXP,array("options"=>array("regexp"=>'~^\d{4}/\d{2}/\d{2}$~')));
129
-	$begindate = filter_input(INPUT_GET,'begindate',FILTER_SANITIZE_NUMBER_INT);
130
-	$enddate = filter_input(INPUT_GET,'enddate',FILTER_SANITIZE_NUMBER_INT);
131
-	$archivespeed = filter_input(INPUT_GET,'speed',FILTER_SANITIZE_NUMBER_INT);
132
-	$begindate = date('Y-m-d H:i:s',$begindate);
133
-	$enddate = date('Y-m-d H:i:s',$enddate);
134
-	$spotter_array = $SpotterArchive->getMinLiveSpotterData($begindate,$enddate,$filter);
129
+	$begindate = filter_input(INPUT_GET, 'begindate', FILTER_SANITIZE_NUMBER_INT);
130
+	$enddate = filter_input(INPUT_GET, 'enddate', FILTER_SANITIZE_NUMBER_INT);
131
+	$archivespeed = filter_input(INPUT_GET, 'speed', FILTER_SANITIZE_NUMBER_INT);
132
+	$begindate = date('Y-m-d H:i:s', $begindate);
133
+	$enddate = date('Y-m-d H:i:s', $enddate);
134
+	$spotter_array = $SpotterArchive->getMinLiveSpotterData($begindate, $enddate, $filter);
135 135
 } elseif ($min) {
136 136
 	if ($tracker) {
137 137
 		$spotter_array = $TrackerLive->getMinLiveTrackerData($filter);
@@ -143,17 +143,17 @@  discard block
 block discarded – undo
143 143
 #	$min = true;
144 144
 } else {
145 145
 	if ($tracker) {
146
-		$spotter_array = $TrackerLive->getLiveTrackerData('','',$filter);
146
+		$spotter_array = $TrackerLive->getLiveTrackerData('', '', $filter);
147 147
 	} elseif ($marine) {
148
-		$spotter_array = $marineLive->getLiveMarineData('','',$filter);
148
+		$spotter_array = $marineLive->getLiveMarineData('', '', $filter);
149 149
 	} else {
150
-		$spotter_array = $SpotterLive->getLiveSpotterData('','',$filter);
150
+		$spotter_array = $SpotterLive->getLiveSpotterData('', '', $filter);
151 151
 	}
152 152
 }
153 153
 
154 154
 if ($usecoord) {
155 155
 	if (isset($_GET['archive'])) {
156
-		$flightcnt = $SpotterArchive->getLiveSpotterCount($begindate,$enddate,$filter);
156
+		$flightcnt = $SpotterArchive->getLiveSpotterCount($begindate, $enddate, $filter);
157 157
 	} else {
158 158
 		if ($tracker) {
159 159
 			$flightcnt = $TrackerLive->getLiveTrackerCount($filter);
@@ -166,9 +166,9 @@  discard block
 block discarded – undo
166 166
 	if ($flightcnt == '') $flightcnt = 0;
167 167
 } else $flightcnt = 0;
168 168
 
169
-$sqltime = round(microtime(true)-$begintime,2);
169
+$sqltime = round(microtime(true) - $begintime, 2);
170 170
 
171
-$currenttime = filter_input(INPUT_GET,'currenttime',FILTER_SANITIZE_NUMBER_INT);
171
+$currenttime = filter_input(INPUT_GET, 'currenttime', FILTER_SANITIZE_NUMBER_INT);
172 172
 if ($currenttime != '') $currenttime = round($currenttime/1000);
173 173
 
174 174
 if ((!isset($_COOKIE['flightestimation']) && isset($globalMapEstimation) && $globalMapEstimation == FALSE) || (isset($_COOKIE['flightestimation']) && $_COOKIE['flightestimation'] == 'false')) $usenextlatlon = false;
@@ -187,7 +187,7 @@  discard block
 block discarded – undo
187 187
 		if (!empty($spotter_array) && is_array($spotter_array))
188 188
 		{
189 189
 			$output .= '"features": [';
190
-			foreach($spotter_array as $spotter_item)
190
+			foreach ($spotter_array as $spotter_item)
191 191
 			{
192 192
 				$j++;
193 193
 				date_default_timezone_set('UTC');
@@ -243,8 +243,8 @@  discard block
 block discarded – undo
243 243
 */
244 244
 							//$output .= '"fc": "'.$spotter_item['nb'].'",';
245 245
 						if (isset($spotter_item['ident']) && $spotter_item['ident'] != '') {
246
-							if ($compress) $output .= '"c": "'.str_replace('\\','',$spotter_item['ident']).'",';
247
-							else $output .= '"callsign": "'.str_replace('\\','',$spotter_item['ident']).'",';
246
+							if ($compress) $output .= '"c": "'.str_replace('\\', '', $spotter_item['ident']).'",';
247
+							else $output .= '"callsign": "'.str_replace('\\', '', $spotter_item['ident']).'",';
248 248
 							//"
249 249
 						} else {
250 250
 							if ($compress) $output .= '"c": "NA",';
@@ -253,7 +253,7 @@  discard block
 block discarded – undo
253 253
 						if (isset($spotter_item['registration'])) $output .= '"registration": "'.$spotter_item['registration'].'",';
254 254
 						if (isset($spotter_item['aircraft_name']) && isset($spotter_item['aircraft_type'])) {
255 255
 							$output .= '"aircraft_name": "'.$spotter_item['aircraft_name'].' ('.$spotter_item['aircraft_type'].')",';
256
-							$output .= '"aircraft_wiki": "http://'.strtolower($globalLanguage).'.wikipedia.org/wiki/'.urlencode(str_replace(' ','_',$spotter_item['aircraft_name'])).'",';
256
+							$output .= '"aircraft_wiki": "http://'.strtolower($globalLanguage).'.wikipedia.org/wiki/'.urlencode(str_replace(' ', '_', $spotter_item['aircraft_name'])).'",';
257 257
 						} elseif (isset($spotter_item['aircraft_type'])) {
258 258
 							$output .= '"aircraft_name": "NA ('.$spotter_item['aircraft_type'].')",';
259 259
 						} elseif (!$min) {
@@ -396,26 +396,26 @@  discard block
 block discarded – undo
396 396
 						if ($currenttime != '') {
397 397
 							if (strtotime($spotter_item['date']) < $currenttime) {
398 398
 								if (isset($archivespeed)) {
399
-									$nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$spotter_item['heading'],$archivespeed,($currenttime-strtotime($spotter_item['date'])+$globalMapRefresh));
399
+									$nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $spotter_item['heading'], $archivespeed, ($currenttime - strtotime($spotter_item['date']) + $globalMapRefresh));
400 400
 									$output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],';
401 401
 								} elseif ($usenextlatlon) {
402
-									$nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$spotter_item['heading'],1,($currenttime-strtotime($spotter_item['date'])+$globalMapRefresh));
402
+									$nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $spotter_item['heading'], 1, ($currenttime - strtotime($spotter_item['date']) + $globalMapRefresh));
403 403
 									$output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],';
404 404
 								}
405 405
 							}
406 406
 						} else {
407 407
 							if (isset($archivespeed)) {
408
-								$nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$spotter_item['heading'],$archivespeed);
408
+								$nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $spotter_item['heading'], $archivespeed);
409 409
 								$output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],';
410 410
 							} elseif ($usenextlatlon) {
411
-								$nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$spotter_item['heading']);
411
+								$nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $spotter_item['heading']);
412 412
 								$output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],';
413 413
 							}
414 414
 						}
415 415
 
416 416
 						if (!$min) $output .= '"image": "'.$image.'",';
417 417
 						if (isset($spotter_item['image_copyright']) && $spotter_item['image_copyright'] != '') {
418
-							$output .= '"image_copyright": "'.str_replace('"',"'",trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'',$spotter_item['image_copyright']))).'",';
418
+							$output .= '"image_copyright": "'.str_replace('"', "'", trim(str_replace(array("\r\n", "\r", "\n", "\\r", "\\n", "\\r\\n"), '', $spotter_item['image_copyright']))).'",';
419 419
 						}
420 420
 						if (isset($spotter_item['image_source_website'])) {
421 421
 							$output .= '"image_source_website": "'.urlencode($spotter_item['image_source_website']).'",';
@@ -437,7 +437,7 @@  discard block
 block discarded – undo
437 437
 							$output .= '"waypoints": "'.$spotter_item['waypoints'].'",';
438 438
 						}
439 439
 						if (isset($spotter_item['acars'])) {
440
-							$output .= '"acars": "'.trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"), '<br />',$spotter_item['acars']['message'])).'",';
440
+							$output .= '"acars": "'.trim(str_replace(array("\r\n", "\r", "\n", "\\r", "\\n", "\\r\\n"), '<br />', $spotter_item['acars']['message'])).'",';
441 441
 						}
442 442
 						// type when not aircraft ?
443 443
 						if (isset($spotter_item['type'])) {
@@ -457,7 +457,7 @@  discard block
 block discarded – undo
457 457
 								if ($currenttime != '') {
458 458
 									if (strtotime($spotter_item['date']) < $currenttime) {
459 459
 										if (!isset($archivespeed)) $archivespeed = 1;
460
-										$nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$spotter_item['heading'],$archivespeed,$currenttime-strtotime($spotter_item['date']));
460
+										$nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $spotter_item['heading'], $archivespeed, $currenttime - strtotime($spotter_item['date']));
461 461
 										$output .= $nextcoord['longitude'].','.$nextcoord['latitude'];
462 462
 									} else {
463 463
 										$output .= $spotter_item['longitude'].', ';
@@ -526,7 +526,7 @@  discard block
 block discarded – undo
526 526
                 
527 527
 			}
528 528
 */
529
-				$history = filter_input(INPUT_GET,'history',FILTER_SANITIZE_STRING);
529
+				$history = filter_input(INPUT_GET, 'history', FILTER_SANITIZE_STRING);
530 530
 				if ($history == '' && isset($_COOKIE['history'])) $history = $_COOKIE['history'];
531 531
 				
532 532
 				if (
@@ -534,11 +534,11 @@  discard block
 block discarded – undo
534 534
 				    || ((isset($globalMapHistory) && $globalMapHistory) || $allhistory)
535 535
 				//    || (isset($history) && $history != '' && $history != 'NA' && ($history == $spotter_item['ident'] || $history == $spotter_item['flightaware_id']))
536 536
 				//    || (isset($history) && $history != '' && $history != 'NA' && $history == $spotter_item['ident'])
537
-				    || (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['flightaware_id']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['flightaware_id']))
537
+				    || (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['flightaware_id']) && str_replace('-', '', $history) == str_replace('-', '', $spotter_item['flightaware_id']))
538 538
 				    || (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['flightaware_id']) && $_GET['flightaware_id'] == $spotter_item['flightaware_id'])
539
-				    || (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['fammarine_id']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['fammarine_id']))
539
+				    || (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['fammarine_id']) && str_replace('-', '', $history) == str_replace('-', '', $spotter_item['fammarine_id']))
540 540
 				    || (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['fammarine_id']) && $_GET['fammarine_id'] == $spotter_item['fammarine_id'])
541
-				    || (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['famtrackid']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['famtrackid']))
541
+				    || (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['famtrackid']) && str_replace('-', '', $history) == str_replace('-', '', $spotter_item['famtrackid']))
542 542
 				    || (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['famtrackid']) && $_GET['famtrackid'] == $spotter_item['famtrackid'])
543 543
 				    ) {
544 544
 					if ($tracker) {
@@ -575,9 +575,9 @@  discard block
 block discarded – undo
575 575
 								else $output_history = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "history","altitude": "'.$alt.'"},"geometry": {"type": "LineString","coordinates": [';
576 576
 							}
577 577
 							$output_history .= '[';
578
-							$output_history .=  $spotter_history['longitude'].', ';
579
-							$output_history .=  $spotter_history['latitude'].', ';
580
-							$output_history .=  $spotter_history['altitude']*30.48;
578
+							$output_history .= $spotter_history['longitude'].', ';
579
+							$output_history .= $spotter_history['latitude'].', ';
580
+							$output_history .= $spotter_history['altitude']*30.48;
581 581
 							$output_history .= '],';
582 582
 							/*
583 583
 							if ($from_archive === false) {
@@ -595,8 +595,8 @@  discard block
 block discarded – undo
595 595
 								else $output_history = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "history"},"geometry": {"type": "LineString","coordinates": [';
596 596
 							} else $d = true;
597 597
 							$output_history .= '[';
598
-							$output_history .=  $spotter_history['longitude'].', ';
599
-							$output_history .=  $spotter_history['latitude'];
598
+							$output_history .= $spotter_history['longitude'].', ';
599
+							$output_history .= $spotter_history['latitude'];
600 600
 							$output_history .= '],';
601 601
 							/*
602 602
 							if ($from_archive === false) {
@@ -612,9 +612,9 @@  discard block
 block discarded – undo
612 612
 					
613 613
 						if ($from_archive === false) {
614 614
 							$output_historyd = '[';
615
-							$output_historyd .=  $spotter_item['longitude'].', ';
616
-							$output_historyd .=  $spotter_item['latitude'];
617
-							if (isset($spotter_history['altitude'])) $output_historyd .=  ','.$spotter_item['altitude']*30.48;
615
+							$output_historyd .= $spotter_item['longitude'].', ';
616
+							$output_historyd .= $spotter_item['latitude'];
617
+							if (isset($spotter_history['altitude'])) $output_historyd .= ','.$spotter_item['altitude']*30.48;
618 618
 							$output_historyd .= '],';
619 619
 							//$output_history = $output_historyd.$output_history;
620 620
 							$output_history = $output_history.$output_historyd;
@@ -628,7 +628,7 @@  discard block
 block discarded – undo
628 628
 					}
629 629
 				}
630 630
 				
631
-				if (((isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['flightaware_id']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['flightaware_id']))
631
+				if (((isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['flightaware_id']) && str_replace('-', '', $history) == str_replace('-', '', $spotter_item['flightaware_id']))
632 632
 				    || (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['flightaware_id']) && $_GET['flightaware_id'] == $spotter_item['flightaware_id']))
633 633
 				     && (isset($spotter_item['departure_airport']) 
634 634
 				        && $spotter_item['departure_airport'] != 'NA' 
@@ -662,7 +662,7 @@  discard block
 block discarded – undo
662 662
 
663 663
 				//if (isset($history) && $history != '' && $history == $spotter_item['ident'] && isset($spotter_item['departure_airport']) && $spotter_item['departure_airport'] != 'NA' && isset($spotter_item['arrival_airport']) && $spotter_item['arrival_airport'] != 'NA' && ((isset($_COOKIE['MapRoute']) && $_COOKIE['MapRoute'] == "true") || (!isset($_COOKIE['MapRoute']) && (!isset($globalMapRoute) || (isset($globalMapRoute) && $globalMapRoute))))) {
664 664
 				//if (isset($history) && $history != '' && $history == $spotter_item['ident'] && isset($spotter_item['arrival_airport']) && $spotter_item['arrival_airport'] != 'NA' && ((isset($_COOKIE['MapRoute']) && $_COOKIE['MapRoute'] == "true") || (!isset($_COOKIE['MapRoute']) && (!isset($globalMapRoute) || (isset($globalMapRoute) && $globalMapRoute))))) {
665
-				if (((isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['flightaware_id']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['flightaware_id']))
665
+				if (((isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['flightaware_id']) && str_replace('-', '', $history) == str_replace('-', '', $spotter_item['flightaware_id']))
666 666
 				    || (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['flightaware_id']) && $_GET['flightaware_id'] == $spotter_item['flightaware_id']))
667 667
 				     && (isset($spotter_item['arrival_airport']) 
668 668
 				        && $spotter_item['arrival_airport'] != 'NA' 
@@ -693,7 +693,7 @@  discard block
 block discarded – undo
693 693
 			$output  = substr($output, 0, -1);
694 694
 			$output .= ']';
695 695
 			$output .= ',"initial_sqltime": "'.$sqltime.'",';
696
-			$output .= '"totaltime": "'.round(microtime(true)-$begintime,2).'",';
696
+			$output .= '"totaltime": "'.round(microtime(true) - $begintime, 2).'",';
697 697
 			if (isset($begindate)) $output .= '"archive_date": "'.$begindate.'",';
698 698
 			$output .= '"fc": "'.$j.'"';
699 699
 		} else {
Please login to merge, or discard this patch.
Braces   +300 added lines, -117 removed lines patch added patch discarded remove patch
@@ -48,28 +48,55 @@  discard block
 block discarded – undo
48 48
 }
49 49
 header('Content-Type: text/javascript');
50 50
 
51
-if (!isset($globalJsonCompress)) $compress = true;
52
-else $compress = $globalJsonCompress;
51
+if (!isset($globalJsonCompress)) {
52
+	$compress = true;
53
+} else {
54
+	$compress = $globalJsonCompress;
55
+}
53 56
 
54 57
 $from_archive = false;
55 58
 $min = true;
56 59
 $allhistory = false;
57 60
 $filter['source'] = array();
58
-if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') $filter['source'] = array_merge($filter['source'],array('vatsimtxt'));
59
-if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') $filter['source'] = array_merge($filter['source'],array('whazzup'));
60
-if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') $filter['source'] = array_merge($filter['source'],array('phpvmacars'));
61
-if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') $filter['source'] = array_merge($filter['source'],array('sbs','famaprs'));
62
-if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') $filter['source'] = array_merge($filter['source'],array('aprs'));
63
-if (isset($_COOKIE['filter_ident']) && $_COOKIE['filter_ident'] != '') $filter['ident'] = filter_var($_COOKIE['filter_ident'],FILTER_SANITIZE_STRING);
64
-if (isset($_COOKIE['filter_mmsi']) && $_COOKIE['filter_mmsi'] != '') $filter['mmsi'] = filter_var($_COOKIE['filter_mmsi'],FILTER_SANITIZE_STRING);
65
-if (isset($_COOKIE['filter_Airlines']) && $_COOKIE['filter_Airlines'] != '') $filter['airlines'] = filter_var_array(explode(',',$_COOKIE['filter_Airlines']),FILTER_SANITIZE_STRING);
66
-if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') $filter['source_aprs'] = filter_var_array(explode(',',$_COOKIE['filter_Sources']),FILTER_SANITIZE_STRING);
67
-if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') $filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'],FILTER_SANITIZE_STRING);
68
-if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] != 'all') $filter['alliance'] = filter_var($_COOKIE['filter_alliance'],FILTER_SANITIZE_STRING);
61
+if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') {
62
+	$filter['source'] = array_merge($filter['source'],array('vatsimtxt'));
63
+}
64
+if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') {
65
+	$filter['source'] = array_merge($filter['source'],array('whazzup'));
66
+}
67
+if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') {
68
+	$filter['source'] = array_merge($filter['source'],array('phpvmacars'));
69
+}
70
+if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') {
71
+	$filter['source'] = array_merge($filter['source'],array('sbs','famaprs'));
72
+}
73
+if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') {
74
+	$filter['source'] = array_merge($filter['source'],array('aprs'));
75
+}
76
+if (isset($_COOKIE['filter_ident']) && $_COOKIE['filter_ident'] != '') {
77
+	$filter['ident'] = filter_var($_COOKIE['filter_ident'],FILTER_SANITIZE_STRING);
78
+}
79
+if (isset($_COOKIE['filter_mmsi']) && $_COOKIE['filter_mmsi'] != '') {
80
+	$filter['mmsi'] = filter_var($_COOKIE['filter_mmsi'],FILTER_SANITIZE_STRING);
81
+}
82
+if (isset($_COOKIE['filter_Airlines']) && $_COOKIE['filter_Airlines'] != '') {
83
+	$filter['airlines'] = filter_var_array(explode(',',$_COOKIE['filter_Airlines']),FILTER_SANITIZE_STRING);
84
+}
85
+if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') {
86
+	$filter['source_aprs'] = filter_var_array(explode(',',$_COOKIE['filter_Sources']),FILTER_SANITIZE_STRING);
87
+}
88
+if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') {
89
+	$filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'],FILTER_SANITIZE_STRING);
90
+}
91
+if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] != 'all') {
92
+	$filter['alliance'] = filter_var($_COOKIE['filter_alliance'],FILTER_SANITIZE_STRING);
93
+}
69 94
 
70 95
 if (isset($globalMapPopup) && !$globalMapPopup && !(isset($_COOKIE['flightpopup']) && $_COOKIE['flightpopup'] == 'true')) {
71 96
 	$min = true;
72
-} else $min = false;
97
+} else {
98
+	$min = false;
99
+}
73 100
 
74 101
 if (isset($_GET['ident'])) {
75 102
 	$ident = urldecode(filter_input(INPUT_GET,'ident',FILTER_SANITIZE_STRING));
@@ -163,24 +190,38 @@  discard block
 block discarded – undo
163 190
 			$flightcnt = $SpotterLive->getLiveSpotterCount($filter);
164 191
 		}
165 192
 	}
166
-	if ($flightcnt == '') $flightcnt = 0;
167
-} else $flightcnt = 0;
193
+	if ($flightcnt == '') {
194
+		$flightcnt = 0;
195
+	}
196
+	} else {
197
+	$flightcnt = 0;
198
+}
168 199
 
169 200
 $sqltime = round(microtime(true)-$begintime,2);
170 201
 
171 202
 $currenttime = filter_input(INPUT_GET,'currenttime',FILTER_SANITIZE_NUMBER_INT);
172
-if ($currenttime != '') $currenttime = round($currenttime/1000);
203
+if ($currenttime != '') {
204
+	$currenttime = round($currenttime/1000);
205
+}
173 206
 
174
-if ((!isset($_COOKIE['flightestimation']) && isset($globalMapEstimation) && $globalMapEstimation == FALSE) || (isset($_COOKIE['flightestimation']) && $_COOKIE['flightestimation'] == 'false')) $usenextlatlon = false;
175
-else $usenextlatlon = true;
176
-if ($usenextlatlon === false) $currenttime = '';
207
+if ((!isset($_COOKIE['flightestimation']) && isset($globalMapEstimation) && $globalMapEstimation == FALSE) || (isset($_COOKIE['flightestimation']) && $_COOKIE['flightestimation'] == 'false')) {
208
+	$usenextlatlon = false;
209
+} else {
210
+	$usenextlatlon = true;
211
+}
212
+if ($usenextlatlon === false) {
213
+	$currenttime = '';
214
+}
177 215
 $j = 0;
178 216
 $prev_flightaware_id = '';
179 217
 $aircrafts_shadow = array();
180 218
 $output = '{';
181 219
 	$output .= '"type": "FeatureCollection",';
182
-		if ($min) $output .= '"minimal": "true",';
183
-		else $output .= '"minimal": "false",';
220
+		if ($min) {
221
+			$output .= '"minimal": "true",';
222
+		} else {
223
+			$output .= '"minimal": "false",';
224
+		}
184 225
 		//$output .= '"fc": "'.$flightcnt.'",';
185 226
 		$output .= '"sqt": "'.$sqltime.'",';
186 227
 
@@ -224,18 +265,29 @@  discard block
 block discarded – undo
224 265
 						}
225 266
 						$output .= '"properties": {';
226 267
 						if (isset($spotter_item['flightaware_id'])) {
227
-							if ($compress) $output .= '"fi": "'.$spotter_item['flightaware_id'].'",';
228
-							else $output .= '"flightaware_id": "'.$spotter_item['flightaware_id'].'",';
268
+							if ($compress) {
269
+								$output .= '"fi": "'.$spotter_item['flightaware_id'].'",';
270
+							} else {
271
+								$output .= '"flightaware_id": "'.$spotter_item['flightaware_id'].'",';
272
+							}
229 273
 						} elseif (isset($spotter_item['famtrackid'])) {
230
-							if ($compress) $output .= '"fti": "'.$spotter_item['famtrackid'].'",';
231
-							else $output .= '"famtrackid": "'.$spotter_item['famtrackid'].'",';
274
+							if ($compress) {
275
+								$output .= '"fti": "'.$spotter_item['famtrackid'].'",';
276
+							} else {
277
+								$output .= '"famtrackid": "'.$spotter_item['famtrackid'].'",';
278
+							}
232 279
 						} elseif (isset($spotter_item['fammarine_id'])) {
233
-							if ($compress) $output .= '"fmi": "'.$spotter_item['fammarine_id'].'",';
234
-							else $output .= '"fammarineid": "'.$spotter_item['fammarine_id'].'",';
280
+							if ($compress) {
281
+								$output .= '"fmi": "'.$spotter_item['fammarine_id'].'",';
282
+							} else {
283
+								$output .= '"fammarineid": "'.$spotter_item['fammarine_id'].'",';
284
+							}
235 285
 						}
236 286
 							$output .= '"fc": "'.$flightcnt.'",';
237 287
 							$output .= '"sqt": "'.$sqltime.'",';
238
-							if (isset($begindate)) $output .= '"archive_date": "'.$begindate.'",';
288
+							if (isset($begindate)) {
289
+								$output .= '"archive_date": "'.$begindate.'",';
290
+							}
239 291
 
240 292
 /*
241 293
 							if ($min) $output .= '"minimal": "true",';
@@ -243,14 +295,22 @@  discard block
 block discarded – undo
243 295
 */
244 296
 							//$output .= '"fc": "'.$spotter_item['nb'].'",';
245 297
 						if (isset($spotter_item['ident']) && $spotter_item['ident'] != '') {
246
-							if ($compress) $output .= '"c": "'.str_replace('\\','',$spotter_item['ident']).'",';
247
-							else $output .= '"callsign": "'.str_replace('\\','',$spotter_item['ident']).'",';
298
+							if ($compress) {
299
+								$output .= '"c": "'.str_replace('\\','',$spotter_item['ident']).'",';
300
+							} else {
301
+								$output .= '"callsign": "'.str_replace('\\','',$spotter_item['ident']).'",';
302
+							}
248 303
 							//"
249 304
 						} else {
250
-							if ($compress) $output .= '"c": "NA",';
251
-							else $output .= '"callsign": "NA",';
305
+							if ($compress) {
306
+								$output .= '"c": "NA",';
307
+							} else {
308
+								$output .= '"callsign": "NA",';
309
+							}
310
+						}
311
+						if (isset($spotter_item['registration'])) {
312
+							$output .= '"registration": "'.$spotter_item['registration'].'",';
252 313
 						}
253
-						if (isset($spotter_item['registration'])) $output .= '"registration": "'.$spotter_item['registration'].'",';
254 314
 						if (isset($spotter_item['aircraft_name']) && isset($spotter_item['aircraft_type'])) {
255 315
 							$output .= '"aircraft_name": "'.$spotter_item['aircraft_name'].' ('.$spotter_item['aircraft_type'].')",';
256 316
 							$output .= '"aircraft_wiki": "http://'.strtolower($globalLanguage).'.wikipedia.org/wiki/'.urlencode(str_replace(' ','_',$spotter_item['aircraft_name'])).'",';
@@ -263,16 +323,23 @@  discard block
 block discarded – undo
263 323
 							$output .= '"aircraft_icao": "'.$spotter_item['aircraft_icao'].'",';
264 324
 						}
265 325
 						if (!isset($spotter_item['aircraft_shadow']) && !$tracker) {
266
-							if (!isset($spotter_item['aircraft_icao']) || $spotter_item['aircraft_icao'] == '') $spotter_item['aircraft_shadow'] = '';
267
-							else {
326
+							if (!isset($spotter_item['aircraft_icao']) || $spotter_item['aircraft_icao'] == '') {
327
+								$spotter_item['aircraft_shadow'] = '';
328
+							} else {
268 329
 								$aircraft_icao = $spotter_item['aircraft_icao'];
269
-								if (isset($aircrafts_shadow[$aircraft_icao])) $spotter_item['aircraft_shadow'] = $aircrafts_shadow[$aircraft_icao];
270
-								else {
330
+								if (isset($aircrafts_shadow[$aircraft_icao])) {
331
+									$spotter_item['aircraft_shadow'] = $aircrafts_shadow[$aircraft_icao];
332
+								} else {
271 333
 									$aircraft_info = $Spotter->getAllAircraftInfo($spotter_item['aircraft_icao']);
272
-									if (count($aircraft_info) > 0) $spotter_item['aircraft_shadow'] = $aircraft_info[0]['aircraft_shadow'];
273
-									elseif (isset($spotter_item['format_source']) && $spotter_item['format_source'] == 'aprs') $spotter_item['aircraft_shadow'] = 'PA18.png';
274
-									elseif ($aircraft_icao == 'PARAGLIDER') $spotter_item['aircraft_shadow'] = 'PARAGLIDER.png';
275
-									else $spotter_item['aircraft_shadow'] = '';
334
+									if (count($aircraft_info) > 0) {
335
+										$spotter_item['aircraft_shadow'] = $aircraft_info[0]['aircraft_shadow'];
336
+									} elseif (isset($spotter_item['format_source']) && $spotter_item['format_source'] == 'aprs') {
337
+										$spotter_item['aircraft_shadow'] = 'PA18.png';
338
+									} elseif ($aircraft_icao == 'PARAGLIDER') {
339
+										$spotter_item['aircraft_shadow'] = 'PARAGLIDER.png';
340
+									} else {
341
+										$spotter_item['aircraft_shadow'] = '';
342
+									}
276 343
 									$aircrafts_shadow[$aircraft_icao] = $spotter_item['aircraft_shadow'];
277 344
 								}
278 345
 							}
@@ -280,73 +347,139 @@  discard block
 block discarded – undo
280 347
 						if (!isset($spotter_item['aircraft_shadow']) || $spotter_item['aircraft_shadow'] == '') {
281 348
 							if ($tracker) {
282 349
 								if (isset($spotter_item['type']) && $spotter_item['type'] == 'Ambulance') {
283
-									if ($compress) $output .= '"as": "ambulance.png",';
284
-									else $output .= '"aircraft_shadow": "ambulance.png",';
350
+									if ($compress) {
351
+										$output .= '"as": "ambulance.png",';
352
+									} else {
353
+										$output .= '"aircraft_shadow": "ambulance.png",';
354
+									}
285 355
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Police') {
286
-									if ($compress) $output .= '"as": "police.png",';
287
-									else $output .= '"aircraft_shadow": "police.png",';
356
+									if ($compress) {
357
+										$output .= '"as": "police.png",';
358
+									} else {
359
+										$output .= '"aircraft_shadow": "police.png",';
360
+									}
288 361
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Yacht (Sail)') {
289
-									if ($compress) $output .= '"as": "ship.png",';
290
-									else $output .= '"aircraft_shadow": "ship.png",';
362
+									if ($compress) {
363
+										$output .= '"as": "ship.png",';
364
+									} else {
365
+										$output .= '"aircraft_shadow": "ship.png",';
366
+									}
291 367
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Ship (Power Boat)') {
292
-									if ($compress) $output .= '"as": "ship.png",';
293
-									else $output .= '"aircraft_shadow": "ship.png",';
368
+									if ($compress) {
369
+										$output .= '"as": "ship.png",';
370
+									} else {
371
+										$output .= '"aircraft_shadow": "ship.png",';
372
+									}
294 373
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Shuttle') {
295
-									if ($compress) $output .= '"as": "ship.png",';
296
-									else $output .= '"aircraft_shadow": "ship.png",';
374
+									if ($compress) {
375
+										$output .= '"as": "ship.png",';
376
+									} else {
377
+										$output .= '"aircraft_shadow": "ship.png",';
378
+									}
297 379
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Truck') {
298
-									if ($compress) $output .= '"as": "truck.png",';
299
-									else $output .= '"aircraft_shadow": "truck.png",';
380
+									if ($compress) {
381
+										$output .= '"as": "truck.png",';
382
+									} else {
383
+										$output .= '"aircraft_shadow": "truck.png",';
384
+									}
300 385
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Truck (18 Wheeler)') {
301
-									if ($compress) $output .= '"as": "truck.png",';
302
-									else $output .= '"aircraft_shadow": "truck.png",';
386
+									if ($compress) {
387
+										$output .= '"as": "truck.png",';
388
+									} else {
389
+										$output .= '"aircraft_shadow": "truck.png",';
390
+									}
303 391
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Aircraft (small)') {
304
-									if ($compress) $output .= '"as": "aircraft.png",';
305
-									else $output .= '"aircraft_shadow": "aircraft.png",';
392
+									if ($compress) {
393
+										$output .= '"as": "aircraft.png",';
394
+									} else {
395
+										$output .= '"aircraft_shadow": "aircraft.png",';
396
+									}
306 397
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Large Aircraft') {
307
-									if ($compress) $output .= '"as": "aircraft.png",';
308
-									else $output .= '"aircraft_shadow": "aircraft.png",';
398
+									if ($compress) {
399
+										$output .= '"as": "aircraft.png",';
400
+									} else {
401
+										$output .= '"aircraft_shadow": "aircraft.png",';
402
+									}
309 403
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Helicopter') {
310
-									if ($compress) $output .= '"as": "helico.png",';
311
-									else $output .= '"aircraft_shadow": "helico.png",';
404
+									if ($compress) {
405
+										$output .= '"as": "helico.png",';
406
+									} else {
407
+										$output .= '"aircraft_shadow": "helico.png",';
408
+									}
312 409
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Railroad Engine') {
313
-									if ($compress) $output .= '"as": "rail.png",';
314
-									else $output .= '"aircraft_shadow": "rail.png",';
410
+									if ($compress) {
411
+										$output .= '"as": "rail.png",';
412
+									} else {
413
+										$output .= '"aircraft_shadow": "rail.png",';
414
+									}
315 415
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Firetruck') {
316
-									if ($compress) $output .= '"as": "firetruck.png",';
317
-									else $output .= '"aircraft_shadow": "firetruck.png",';
416
+									if ($compress) {
417
+										$output .= '"as": "firetruck.png",';
418
+									} else {
419
+										$output .= '"aircraft_shadow": "firetruck.png",';
420
+									}
318 421
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Bus') {
319
-									if ($compress) $output .= '"as": "bus.png",';
320
-									else $output .= '"aircraft_shadow": "bus.png",';
422
+									if ($compress) {
423
+										$output .= '"as": "bus.png",';
424
+									} else {
425
+										$output .= '"aircraft_shadow": "bus.png",';
426
+									}
321 427
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Phone') {
322
-									if ($compress) $output .= '"as": "phone.png",';
323
-									else $output .= '"aircraft_shadow": "phone.png",';
428
+									if ($compress) {
429
+										$output .= '"as": "phone.png",';
430
+									} else {
431
+										$output .= '"aircraft_shadow": "phone.png",';
432
+									}
324 433
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Jogger') {
325
-									if ($compress) $output .= '"as": "jogger.png",';
326
-									else $output .= '"aircraft_shadow": "jogger.png",';
434
+									if ($compress) {
435
+										$output .= '"as": "jogger.png",';
436
+									} else {
437
+										$output .= '"aircraft_shadow": "jogger.png",';
438
+									}
327 439
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Bike') {
328
-									if ($compress) $output .= '"as": "bike.png",';
329
-									else $output .= '"aircraft_shadow": "bike.png",';
440
+									if ($compress) {
441
+										$output .= '"as": "bike.png",';
442
+									} else {
443
+										$output .= '"aircraft_shadow": "bike.png",';
444
+									}
330 445
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Motorcycle') {
331
-									if ($compress) $output .= '"as": "motorcycle.png",';
332
-									else $output .= '"aircraft_shadow": "motorcycle.png",';
446
+									if ($compress) {
447
+										$output .= '"as": "motorcycle.png",';
448
+									} else {
449
+										$output .= '"aircraft_shadow": "motorcycle.png",';
450
+									}
333 451
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Balloon') {
334
-									if ($compress) $output .= '"as": "balloon.png",';
335
-									else $output .= '"aircraft_shadow": "balloon.png",';
452
+									if ($compress) {
453
+										$output .= '"as": "balloon.png",';
454
+									} else {
455
+										$output .= '"aircraft_shadow": "balloon.png",';
456
+									}
336 457
 								} else {
337
-									if ($compress) $output .= '"as": "car.png",';
338
-									else $output .= '"aircraft_shadow": "car.png",';
458
+									if ($compress) {
459
+										$output .= '"as": "car.png",';
460
+									} else {
461
+										$output .= '"aircraft_shadow": "car.png",';
462
+									}
339 463
 								}
340 464
 							} elseif ($marine) {
341
-								if ($compress) $output .= '"as": "ship.png",';
342
-								else $output .= '"aircraft_shadow": "ship.png",';
465
+								if ($compress) {
466
+									$output .= '"as": "ship.png",';
467
+								} else {
468
+									$output .= '"aircraft_shadow": "ship.png",';
469
+								}
343 470
 							} else {
344
-								if ($compress) $output .= '"as": "default.png",';
345
-								else $output .= '"aircraft_shadow": "default.png",';
471
+								if ($compress) {
472
+									$output .= '"as": "default.png",';
473
+								} else {
474
+									$output .= '"aircraft_shadow": "default.png",';
475
+								}
346 476
 							}
347 477
 						} else {
348
-							if ($compress) $output .= '"as": "'.$spotter_item['aircraft_shadow'].'",';
349
-							else $output .= '"aircraft_shadow": "'.$spotter_item['aircraft_shadow'].'",';
478
+							if ($compress) {
479
+								$output .= '"as": "'.$spotter_item['aircraft_shadow'].'",';
480
+							} else {
481
+								$output .= '"aircraft_shadow": "'.$spotter_item['aircraft_shadow'].'",';
482
+							}
350 483
 						}
351 484
 						if (isset($spotter_item['airline_name'])) {
352 485
 							$output .= '"airline_name": "'.$spotter_item['airline_name'].'",';
@@ -354,8 +487,11 @@  discard block
 block discarded – undo
354 487
 							$output .= '"airline_name": "NA",';
355 488
 						}
356 489
 						if (isset($spotter_item['departure_airport'])) {
357
-							if ($compress) $output .= '"dac": "'.$spotter_item['departure_airport'].'",';
358
-							else $output .= '"departure_airport_code": "'.$spotter_item['departure_airport'].'",';
490
+							if ($compress) {
491
+								$output .= '"dac": "'.$spotter_item['departure_airport'].'",';
492
+							} else {
493
+								$output .= '"departure_airport_code": "'.$spotter_item['departure_airport'].'",';
494
+							}
359 495
 						}
360 496
 						if (isset($spotter_item['departure_airport_city'])) {
361 497
 							$output .= '"departure_airport": "'.$spotter_item['departure_airport_city'].', '.$spotter_item['departure_airport_country'].'",';
@@ -367,8 +503,11 @@  discard block
 block discarded – undo
367 503
 							$output .= '"arrival_airport_time": "'.$spotter_item['arrival_airport_time'].'",';
368 504
 						}
369 505
 						if (isset($spotter_item['arrival_airport'])) {
370
-							if ($compress) $output .= '"aac": "'.$spotter_item['arrival_airport'].'",';
371
-							else $output .= '"arrival_airport_code": "'.$spotter_item['arrival_airport'].'",';
506
+							if ($compress) {
507
+								$output .= '"aac": "'.$spotter_item['arrival_airport'].'",';
508
+							} else {
509
+								$output .= '"arrival_airport_code": "'.$spotter_item['arrival_airport'].'",';
510
+							}
372 511
 						}
373 512
 						if (isset($spotter_item['arrival_airport_city'])) {
374 513
 							$output .= '"arrival_airport": "'.$spotter_item['arrival_airport_city'].', '.$spotter_item['arrival_airport_country'].'",';
@@ -387,11 +526,17 @@  discard block
 block discarded – undo
387 526
 						}
388 527
 						
389 528
 						if (isset($spotter_item['altitude'])) {
390
-							if ($compress) $output .= '"a": "'.$spotter_item['altitude'].'",';
391
-							else $output .= '"altitude": "'.$spotter_item['altitude'].'",';
529
+							if ($compress) {
530
+								$output .= '"a": "'.$spotter_item['altitude'].'",';
531
+							} else {
532
+								$output .= '"altitude": "'.$spotter_item['altitude'].'",';
533
+							}
534
+						}
535
+						if ($compress) {
536
+							$output .= '"h": "'.$spotter_item['heading'].'",';
537
+						} else {
538
+							$output .= '"heading": "'.$spotter_item['heading'].'",';
392 539
 						}
393
-						if ($compress)$output .= '"h": "'.$spotter_item['heading'].'",';
394
-						else $output .= '"heading": "'.$spotter_item['heading'].'",';
395 540
 						
396 541
 						if ($currenttime != '') {
397 542
 							if (strtotime($spotter_item['date']) < $currenttime) {
@@ -413,7 +558,9 @@  discard block
 block discarded – undo
413 558
 							}
414 559
 						}
415 560
 
416
-						if (!$min) $output .= '"image": "'.$image.'",';
561
+						if (!$min) {
562
+							$output .= '"image": "'.$image.'",';
563
+						}
417 564
 						if (isset($spotter_item['image_copyright']) && $spotter_item['image_copyright'] != '') {
418 565
 							$output .= '"image_copyright": "'.str_replace('"',"'",trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'',$spotter_item['image_copyright']))).'",';
419 566
 						}
@@ -421,8 +568,11 @@  discard block
 block discarded – undo
421 568
 							$output .= '"image_source_website": "'.urlencode($spotter_item['image_source_website']).'",';
422 569
 						}
423 570
 						if (isset($spotter_item['squawk'])) {
424
-							if ($compress) $output .= '"sq": "'.$spotter_item['squawk'].'",';
425
-							else $output .= '"squawk": "'.$spotter_item['squawk'].'",';
571
+							if ($compress) {
572
+								$output .= '"sq": "'.$spotter_item['squawk'].'",';
573
+							} else {
574
+								$output .= '"squawk": "'.$spotter_item['squawk'].'",';
575
+							}
426 576
 						}
427 577
 						if (isset($spotter_item['squawk_usage'])) {
428 578
 							$output .= '"squawk_usage": "'.$spotter_item['squawk_usage'].'",';
@@ -441,14 +591,23 @@  discard block
 block discarded – undo
441 591
 						}
442 592
 						// type when not aircraft ?
443 593
 						if (isset($spotter_item['type'])) {
444
-							if ($compress) $output .= '"t": "'.$spotter_item['type'].'"';
445
-							else $output .= '"type": "'.$spotter_item['type'].'"';
594
+							if ($compress) {
595
+								$output .= '"t": "'.$spotter_item['type'].'"';
596
+							} else {
597
+								$output .= '"type": "'.$spotter_item['type'].'"';
598
+							}
446 599
 						} elseif ($marine) {
447
-							if ($compress) $output .= '"t": "ship"';
448
-							else $output .= '"type": "ship"';
600
+							if ($compress) {
601
+								$output .= '"t": "ship"';
602
+							} else {
603
+								$output .= '"type": "ship"';
604
+							}
449 605
 						} else {
450
-							if ($compress) $output .= '"t": "aircraft"';
451
-							else $output .= '"type": "aircraft"';
606
+							if ($compress) {
607
+								$output .= '"t": "aircraft"';
608
+							} else {
609
+								$output .= '"type": "aircraft"';
610
+							}
452 611
 						}
453 612
 						$output .= '},';
454 613
 						$output .= '"geometry": {';
@@ -456,7 +615,9 @@  discard block
 block discarded – undo
456 615
 								$output .= '"coordinates": [';
457 616
 								if ($currenttime != '') {
458 617
 									if (strtotime($spotter_item['date']) < $currenttime) {
459
-										if (!isset($archivespeed)) $archivespeed = 1;
618
+										if (!isset($archivespeed)) {
619
+											$archivespeed = 1;
620
+										}
460 621
 										$nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$spotter_item['heading'],$archivespeed,$currenttime-strtotime($spotter_item['date']));
461 622
 										$output .= $nextcoord['longitude'].','.$nextcoord['latitude'];
462 623
 									} else {
@@ -527,7 +688,9 @@  discard block
 block discarded – undo
527 688
 			}
528 689
 */
529 690
 				$history = filter_input(INPUT_GET,'history',FILTER_SANITIZE_STRING);
530
-				if ($history == '' && isset($_COOKIE['history'])) $history = $_COOKIE['history'];
691
+				if ($history == '' && isset($_COOKIE['history'])) {
692
+					$history = $_COOKIE['history'];
693
+				}
531 694
 				
532 695
 				if (
533 696
 				    (isset($_COOKIE['flightpath']) && $_COOKIE['flightpath'] == 'true') 
@@ -571,8 +734,11 @@  discard block
 block discarded – undo
571 734
 									$output_history .= ']}},';
572 735
 									$output .= $output_history;
573 736
 								}
574
-								if ($compress) $output_history = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "history","a": "'.$alt.'"},"geometry": {"type": "LineString","coordinates": [';
575
-								else $output_history = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "history","altitude": "'.$alt.'"},"geometry": {"type": "LineString","coordinates": [';
737
+								if ($compress) {
738
+									$output_history = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "history","a": "'.$alt.'"},"geometry": {"type": "LineString","coordinates": [';
739
+								} else {
740
+									$output_history = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "history","altitude": "'.$alt.'"},"geometry": {"type": "LineString","coordinates": [';
741
+								}
576 742
 							}
577 743
 							$output_history .= '[';
578 744
 							$output_history .=  $spotter_history['longitude'].', ';
@@ -591,9 +757,14 @@  discard block
 block discarded – undo
591 757
 							$prev_alt = $alt;
592 758
 						} else {
593 759
 							if ($d == false) {
594
-								if ($compress) $output_history = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "history"},"geometry": {"type": "LineString","coordinates": [';
595
-								else $output_history = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "history"},"geometry": {"type": "LineString","coordinates": [';
596
-							} else $d = true;
760
+								if ($compress) {
761
+									$output_history = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "history"},"geometry": {"type": "LineString","coordinates": [';
762
+								} else {
763
+									$output_history = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "history"},"geometry": {"type": "LineString","coordinates": [';
764
+								}
765
+							} else {
766
+								$d = true;
767
+							}
597 768
 							$output_history .= '[';
598 769
 							$output_history .=  $spotter_history['longitude'].', ';
599 770
 							$output_history .=  $spotter_history['latitude'];
@@ -614,7 +785,9 @@  discard block
 block discarded – undo
614 785
 							$output_historyd = '[';
615 786
 							$output_historyd .=  $spotter_item['longitude'].', ';
616 787
 							$output_historyd .=  $spotter_item['latitude'];
617
-							if (isset($spotter_history['altitude'])) $output_historyd .=  ','.$spotter_item['altitude']*30.48;
788
+							if (isset($spotter_history['altitude'])) {
789
+								$output_historyd .=  ','.$spotter_item['altitude']*30.48;
790
+							}
618 791
 							$output_historyd .= '],';
619 792
 							//$output_history = $output_historyd.$output_history;
620 793
 							$output_history = $output_history.$output_historyd;
@@ -636,8 +809,11 @@  discard block
 block discarded – undo
636 809
 				        && $spotter_item['arrival_airport'] != 'NA' 
637 810
 				        && ((isset($_COOKIE['MapRoute']) && $_COOKIE['MapRoute'] == "true") 
638 811
 				    	    || (!isset($_COOKIE['MapRoute']) && isset($globalMapRoute) && $globalMapRoute)))) {
639
-				    if ($compress) $output_air = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "route"},"geometry": {"type": "LineString","coordinates": [';
640
-				    else $output_air = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "route"},"geometry": {"type": "LineString","coordinates": [';
812
+				    if ($compress) {
813
+				    	$output_air = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "route"},"geometry": {"type": "LineString","coordinates": [';
814
+				    } else {
815
+				    	$output_air = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "route"},"geometry": {"type": "LineString","coordinates": [';
816
+				    }
641 817
 				    if (isset($spotter_item['departure_airport_latitude'])) {
642 818
 					$output_air .= '['.$spotter_item['departure_airport_longitude'].','.$spotter_item['departure_airport_latitude'].'],';
643 819
 				    } elseif (isset($spotter_item['departure_airport']) && $spotter_item['departure_airport'] != 'NA') {
@@ -670,8 +846,11 @@  discard block
 block discarded – undo
670 846
 				    	    || (!isset($_COOKIE['MapRemainaingRoute']) && (!isset($globalMapRemainingRoute) 
671 847
 				    	    || (isset($globalMapRemainingRoute) && $globalMapRemainingRoute)))))) {
672 848
 				    $havedata = false;
673
-				    if ($compress) $output_dest = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "routedest"},"geometry": {"type": "LineString","coordinates": [';
674
-				    else $output_dest = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "routedest"},"geometry": {"type": "LineString","coordinates": [';
849
+				    if ($compress) {
850
+				    	$output_dest = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "routedest"},"geometry": {"type": "LineString","coordinates": [';
851
+				    } else {
852
+				    	$output_dest = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "routedest"},"geometry": {"type": "LineString","coordinates": [';
853
+				    }
675 854
 				    $output_dest .= '['.$spotter_item['longitude'].','.$spotter_item['latitude'].'],';
676 855
 
677 856
 				    if (isset($spotter_item['arrival_airport_latitude'])) {
@@ -686,7 +865,9 @@  discard block
 block discarded – undo
686 865
 				    }
687 866
 				    //$output_dest  = substr($output_dest, 0, -1);
688 867
 				    $output_dest .= ']}},';
689
-				    if ($havedata) $output .= $output_dest;
868
+				    if ($havedata) {
869
+				    	$output .= $output_dest;
870
+				    }
690 871
 				    unset($output_dest);
691 872
 				}
692 873
 			}
@@ -694,7 +875,9 @@  discard block
 block discarded – undo
694 875
 			$output .= ']';
695 876
 			$output .= ',"initial_sqltime": "'.$sqltime.'",';
696 877
 			$output .= '"totaltime": "'.round(microtime(true)-$begintime,2).'",';
697
-			if (isset($begindate)) $output .= '"archive_date": "'.$begindate.'",';
878
+			if (isset($begindate)) {
879
+				$output .= '"archive_date": "'.$begindate.'",';
880
+			}
698 881
 			$output .= '"fc": "'.$j.'"';
699 882
 		} else {
700 883
 			$output .= '"features": ';
Please login to merge, or discard this patch.
require/class.Elevation.php 3 patches
Doc Comments   +11 added lines, -1 removed lines patch added patch discarded remove patch
@@ -52,6 +52,10 @@  discard block
 block discarded – undo
52 52
 		$this->openedFiles = [];
53 53
 	}
54 54
 
55
+	/**
56
+	 * @param double $row
57
+	 * @param double $column
58
+	 */
55 59
 	private function getElevationAtPosition($fileName, $row, $column) {
56 60
 		if (!array_key_exists($fileName, $this->openedFiles)) {
57 61
 			if (!file_exists($this->htgFilesDestination . DIRECTORY_SEPARATOR . $fileName)) {
@@ -85,7 +89,7 @@  discard block
 block discarded – undo
85 89
 	 * @param float $lon
86 90
 	 * @param null  $fName
87 91
 	 *
88
-	 * @return mixed
92
+	 * @return double
89 93
 	 * @throws \Exception
90 94
 	 */
91 95
 	public function getElevation($lat, $lon, &$fName = null) {
@@ -142,6 +146,9 @@  discard block
 block discarded – undo
142 146
 		return $zN;
143 147
 	}
144 148
 
149
+	/**
150
+	 * @param integer $numPrefix
151
+	 */
145 152
 	private function getDeg($deg, $numPrefix) {
146 153
 		$deg = abs($deg);
147 154
 		$d   = floor($deg);     // round degrees
@@ -156,6 +163,9 @@  discard block
 block discarded – undo
156 163
 		return $d;
157 164
 	}
158 165
 
166
+	/**
167
+	 * @param double $deg
168
+	 */
159 169
 	private function getSec($deg) {
160 170
 		$deg = abs($deg);
161 171
 		$sec = round($deg * 3600, 4);
Please login to merge, or discard this patch.
Braces   +18 added lines, -6 removed lines patch added patch discarded remove patch
@@ -28,7 +28,9 @@  discard block
 block discarded – undo
28 28
 	private $openedFiles = [];
29 29
 
30 30
 	public function __construct($htgFilesDestination = '', $resolution = 3) {
31
-		if ($htgFilesDestination == '') $htgFilesDestination = dirname(__FILE__).'/../data/';
31
+		if ($htgFilesDestination == '') {
32
+			$htgFilesDestination = dirname(__FILE__).'/../data/';
33
+		}
32 34
 		$this->htgFilesDestination = $htgFilesDestination;
33 35
 		$this->resolution          = $resolution;
34 36
 		switch ($resolution) {
@@ -171,16 +173,26 @@  discard block
 block discarded – undo
171 173
 		$fileName  = "N{$N}E{$E}.hgt";
172 174
 		if (!file_exists($this->htgFilesDestination . DIRECTORY_SEPARATOR . $fileName)) {
173 175
 			$Common = new Common();
174
-			if ($debug) echo 'Downloading '.$fileName.'.gz ...';
176
+			if ($debug) {
177
+				echo 'Downloading '.$fileName.'.gz ...';
178
+			}
175 179
 			$Common->download('https://s3.amazonaws.com/elevation-tiles-prod/skadi/N'.$N.'/'.$fileName.'.gz',$this->htgFilesDestination . DIRECTORY_SEPARATOR . $fileName . '.gz');
176 180
 			if (!file_exists($this->htgFilesDestination . DIRECTORY_SEPARATOR . $fileName . '.gz')) {
177
-				if ($debug) echo "File '{$fileName}.gz' not exists.";
181
+				if ($debug) {
182
+					echo "File '{$fileName}.gz' not exists.";
183
+				}
178 184
 				return false;
179 185
 			}
180
-			if ($debug) echo 'Done'."\n";
181
-			if ($debug) echo 'Decompress '.$fileName.' ....';
186
+			if ($debug) {
187
+				echo 'Done'."\n";
188
+			}
189
+			if ($debug) {
190
+				echo 'Decompress '.$fileName.' ....';
191
+			}
182 192
 			$Common->gunzip($this->htgFilesDestination . DIRECTORY_SEPARATOR . $fileName . '.gz',$this->htgFilesDestination . DIRECTORY_SEPARATOR . $fileName);
183
-			if ($debug) echo 'Done'."\n";
193
+			if ($debug) {
194
+				echo 'Done'."\n";
195
+			}
184 196
 			unlink($this->htgFilesDestination . DIRECTORY_SEPARATOR . $fileName . '.gz');
185 197
 		}
186 198
 		return true;
Please login to merge, or discard this patch.
Spacing   +28 added lines, -28 removed lines patch added patch discarded remove patch
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
 			default:
42 42
 				throw new \Exception("bad resolution can be only one of 1,3");
43 43
 		}
44
-		register_shutdown_function(function () {
44
+		register_shutdown_function(function() {
45 45
 			$this->closeAllFiles();
46 46
 		});
47 47
 	}
@@ -55,10 +55,10 @@  discard block
 block discarded – undo
55 55
 
56 56
 	private function getElevationAtPosition($fileName, $row, $column) {
57 57
 		if (!array_key_exists($fileName, $this->openedFiles)) {
58
-			if (!file_exists($this->htgFilesDestination . DIRECTORY_SEPARATOR . $fileName)) {
58
+			if (!file_exists($this->htgFilesDestination.DIRECTORY_SEPARATOR.$fileName)) {
59 59
 				throw new \Exception("File '{$fileName}' not exists.");
60 60
 			}
61
-			$file = fopen($this->htgFilesDestination . DIRECTORY_SEPARATOR . $fileName, "r");
61
+			$file = fopen($this->htgFilesDestination.DIRECTORY_SEPARATOR.$fileName, "r");
62 62
 			if ($file === false) {
63 63
 				throw new \Exception("Cant open file '{$fileName}' for reading.");
64 64
 			}
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
 			throw new \Exception("Not implemented yet");
73 73
 		}
74 74
 		$aRow     = $this->measPerDeg - $row;
75
-		$position = ($this->measPerDeg * ($aRow - 1)) + $column;
75
+		$position = ($this->measPerDeg*($aRow - 1)) + $column;
76 76
 		$position *= 2;
77 77
 		fseek($file, $position);
78 78
 		$short  = fread($file, 2);
@@ -100,8 +100,8 @@  discard block
 block discarded – undo
100 100
 		$latSec = $this->getSec($lat);
101 101
 		$lonSec = $this->getSec($lon);
102 102
 
103
-		$Xn = round($latSec / $this->resolution, 3);
104
-		$Yn = round($lonSec / $this->resolution, 3);
103
+		$Xn = round($latSec/$this->resolution, 3);
104
+		$Yn = round($lonSec/$this->resolution, 3);
105 105
 
106 106
 		$a1 = round($Xn);
107 107
 		$a2 = round($Yn);
@@ -133,55 +133,55 @@  discard block
 block discarded – undo
133 133
 		$b3 = $this->getElevationAtPosition($fName, $b1, $b2);
134 134
 		$c3 = $this->getElevationAtPosition($fName, $c1, $c2);
135 135
 
136
-		$n1 = ($c2 - $a2) * ($b3 - $a3) - ($c3 - $a3) * ($b2 - $a2);
137
-		$n2 = ($c3 - $a3) * ($b1 - $a1) - ($c1 - $a1) * ($b3 - $a3);
138
-		$n3 = ($c1 - $a1) * ($b2 - $a2) - ($c2 - $a2) * ($b1 - $a1);
136
+		$n1 = ($c2 - $a2)*($b3 - $a3) - ($c3 - $a3)*($b2 - $a2);
137
+		$n2 = ($c3 - $a3)*($b1 - $a1) - ($c1 - $a1)*($b3 - $a3);
138
+		$n3 = ($c1 - $a1)*($b2 - $a2) - ($c2 - $a2)*($b1 - $a1);
139 139
 
140
-		$d  = -$n1 * $a1 - $n2 * $a2 - $n3 * $a3;
141
-		$zN = (-$n1 * $Xn - $n2 * $Yn - $d) / $n3;
140
+		$d  = -$n1*$a1 - $n2*$a2 - $n3*$a3;
141
+		$zN = (-$n1*$Xn - $n2*$Yn - $d)/$n3;
142 142
 
143 143
 		return $zN;
144 144
 	}
145 145
 
146 146
 	private function getDeg($deg, $numPrefix) {
147 147
 		$deg = abs($deg);
148
-		$d   = floor($deg);     // round degrees
148
+		$d   = floor($deg); // round degrees
149 149
 		if ($numPrefix >= 3) {
150 150
 			if ($d < 100) {
151
-				$d = '0' . $d;
151
+				$d = '0'.$d;
152 152
 			}
153 153
 		} // pad with leading zeros
154 154
 		if ($d < 10) {
155
-			$d = '0' . $d;
155
+			$d = '0'.$d;
156 156
 		}
157 157
 		return $d;
158 158
 	}
159 159
 
160 160
 	private function getSec($deg) {
161 161
 		$deg = abs($deg);
162
-		$sec = round($deg * 3600, 4);
163
-		$m   = fmod(floor($sec / 60), 60);
162
+		$sec = round($deg*3600, 4);
163
+		$m   = fmod(floor($sec/60), 60);
164 164
 		$s   = round(fmod($sec, 60), 4);
165
-		return ($m * 60) + $s;
165
+		return ($m*60) + $s;
166 166
 	}
167 167
 
168
-	public function download($lat,$lon, $debug = false) {
168
+	public function download($lat, $lon, $debug = false) {
169 169
 		$N      = $this->getDeg($lat, 2);
170 170
 		$E      = $this->getDeg($lon, 3);
171
-		$fileName  = "N{$N}E{$E}.hgt";
172
-		if (!file_exists($this->htgFilesDestination . DIRECTORY_SEPARATOR . $fileName)) {
171
+		$fileName = "N{$N}E{$E}.hgt";
172
+		if (!file_exists($this->htgFilesDestination.DIRECTORY_SEPARATOR.$fileName)) {
173 173
 			$Common = new Common();
174 174
 			if ($debug) echo 'Downloading '.$fileName.'.gz ...';
175
-			$Common->download('https://s3.amazonaws.com/elevation-tiles-prod/skadi/N'.$N.'/'.$fileName.'.gz',$this->htgFilesDestination . DIRECTORY_SEPARATOR . $fileName . '.gz');
176
-			if (!file_exists($this->htgFilesDestination . DIRECTORY_SEPARATOR . $fileName . '.gz')) {
175
+			$Common->download('https://s3.amazonaws.com/elevation-tiles-prod/skadi/N'.$N.'/'.$fileName.'.gz', $this->htgFilesDestination.DIRECTORY_SEPARATOR.$fileName.'.gz');
176
+			if (!file_exists($this->htgFilesDestination.DIRECTORY_SEPARATOR.$fileName.'.gz')) {
177 177
 				if ($debug) echo "File '{$fileName}.gz' not exists.";
178 178
 				return false;
179 179
 			}
180 180
 			if ($debug) echo 'Done'."\n";
181 181
 			if ($debug) echo 'Decompress '.$fileName.' ....';
182
-			$Common->gunzip($this->htgFilesDestination . DIRECTORY_SEPARATOR . $fileName . '.gz',$this->htgFilesDestination . DIRECTORY_SEPARATOR . $fileName);
182
+			$Common->gunzip($this->htgFilesDestination.DIRECTORY_SEPARATOR.$fileName.'.gz', $this->htgFilesDestination.DIRECTORY_SEPARATOR.$fileName);
183 183
 			if ($debug) echo 'Done'."\n";
184
-			unlink($this->htgFilesDestination . DIRECTORY_SEPARATOR . $fileName . '.gz');
184
+			unlink($this->htgFilesDestination.DIRECTORY_SEPARATOR.$fileName.'.gz');
185 185
 		}
186 186
 		return true;
187 187
 	}
@@ -194,22 +194,22 @@  discard block
 block discarded – undo
194 194
 		try {
195 195
 			$sth = $db->prepare($query);
196 196
 			$sth->execute($query_values);
197
-		} catch(PDOException $e) {
197
+		} catch (PDOException $e) {
198 198
 			return "error : ".$e->getMessage();
199 199
 		}
200 200
 		while ($data = $sth->fetch(PDO::FETCH_ASSOC)) {
201
-			$this->download($data['latitude'],$data['longitude'],true);
201
+			$this->download($data['latitude'], $data['longitude'], true);
202 202
 		}
203 203
 		$query = 'SELECT latitude, longitude FROM tracker_output WHERE latitude <> 0 AND longitude <> 0 ORDER BY date DESC LIMIT 10';
204 204
 		$query_values = array();
205 205
 		try {
206 206
 			$sth = $db->prepare($query);
207 207
 			$sth->execute($query_values);
208
-		} catch(PDOException $e) {
208
+		} catch (PDOException $e) {
209 209
 			return "error : ".$e->getMessage();
210 210
 		}
211 211
 		while ($data = $sth->fetch(PDO::FETCH_ASSOC)) {
212
-			$this->download($data['latitude'],$data['longitude'],true);
212
+			$this->download($data['latitude'], $data['longitude'], true);
213 213
 		}
214 214
 	}
215 215
 }
Please login to merge, or discard this patch.